Index: tags/visualization-10.5-before-10.6_test/.gdb_history
===================================================================
--- tags/visualization-10.5-before-10.6_test/.gdb_history	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/.gdb_history	(revision 1102)
@@ -0,0 +1,2 @@
+run
+quit
Index: tags/visualization-10.5-before-10.6_test/FukuiRenderer/CUSTOMIZE
===================================================================
--- tags/visualization-10.5-before-10.6_test/FukuiRenderer/CUSTOMIZE	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/FukuiRenderer/CUSTOMIZE	(revision 1102)
@@ -0,0 +1,261 @@
+###########################################
+## Environmental variables to CUSTOMIZE  ##
+## Geant4 DAWNFILE visualization driver  ##  
+###########################################
+
+                 Sept. 1, 2002
+                 Satoshi Tanaka
+                 stanaka@cs.ritsumei.ac.jp           
+
+#----- << G4DAWNFILE_DEST_DIR >> -----
+#      Set a directory where g4_XX.prim and g4_XX.eps files 
+#      are generated.  
+#      Do not forget to add the file separator 
+#      "/" (Unix/Linux) or "\" (Windows) at the end. 
+#      The default directory is the current directory.
+#
+#  Example:
+#
+#   setenv  G4DAWNFILE_DEST_DIR  "/home/username/tmp/"
+
+
+#----- << G4DAWNFILE_MAX_FILE_NUM >> -----
+#      Set a maximal number of generated g4_XX.prim files.
+#      Upto this number "XX" is automatically incremented,
+#      starting from "00".
+#      The default number is 100.
+#      
+#  Example:
+#
+#   setenv G4DAWNFILE_MAX_FILE_NUM  100
+
+
+#----- << G4DAWNFILE_MULTI_WINDOW >> -----
+#      Boolean flag to set on/off multi-window mode.
+#      If this variable is set and its value is non-zero,
+#      Geant4 invokes Renderer DAWN with the multi-X-window mode.  
+#      Otherwise DAWN is invoked with the EPS mode, in which
+#      EPS files are generated and viewed with a PS viewer.
+#      The default value is "0".
+#      
+#  Example:
+#
+#   setenv  G4DAWNFILE_MULTI_WINDOW      "0"
+#   setenv  G4DAWNFILE_MULTI_WINDOW      "1"
+
+
+#----- << G4DAWNFILE_PRECISION >> -----
+#      Set precision of double numbers in g4_XX.prim files.
+#      The number is used as 
+#        sprintf( string, "%*.*g", (precision+8), precision, value).
+#      See G4DAWNFILESceneHandler::G4DAWNFILESceneHandler() 
+#      for more details.
+#      The default precision is "9".
+#      
+#  Example:
+#
+#   setenv  G4DAWNFILE_PRECISION   9
+
+
+#----- << G4DAWNFILE_PS_VIEWER >> -----
+#      Set a name of the PostScript viewer to visualize 
+#      generated g4_XX.eps files.
+#      The default viewer name is "gv".
+#      
+#  Example:
+#
+#   setenv  G4DAWNFILE_PS_VIEWER  gv
+
+
+#----- << G4DAWNFILE_VIEWER >> -----
+#      Set a name of the renderer to visualize 
+#      generated g4_XX.prim files. 
+#      The default renderer name is "dawn".
+#      Set this variable to "david" to execute 
+#      volume-overlapping detection.
+#      
+#  Example:
+#
+#   setenv  G4DAWNFILE_VIEWER dawn
+#   setenv  G4DAWNFILE_VIEWER david
+
+###########################################
+## Environmental variables to CUSTOMIZE  ##
+## Renderer DAWN                         ##  
+###########################################
+
+#----- << DAWN_BATCH >> -----
+#      Set on/off the batch mode.
+#
+#      If this variable is set to "1", 
+#      the DAWN GUI panel does not invoked.
+#      Visualization is not performed, either.
+#      But an EPS file is generated.
+#
+#      If this variable is set to "a", 
+#      the effects are the same as "1" except that 
+#      every generated EPS data is appended to one file.
+#      In the on-line use of Renderer DAWN connected 
+#      with the Geant4 DAWNFILE driver, 
+#      you should also set as
+#
+#        setenv G4DAWNFILE_MAX_FILENUM  1
+#
+#      The dafault value is "0", i.e., the batch mode is off.
+#
+#  Example:
+#
+#   setenv  DAWN_BATCH                "0"
+#   setenv  DAWN_BATCH                "1"
+#   setenv  DAWN_BATCH                "a"
+
+
+#----- << DAWN_BFC_MODE >> -----
+#      Set on/off the back-face-culling mode.
+#      If this mode is set on, analytical hidden-surface removal 
+#      is skipped, and only back-face culling is performed.
+#      This mode is fast, but inaccurate.
+#        "1": on
+#        "0": off 
+#      The default value of "0".
+#
+#  Example:
+#
+#   setenv  DAWN_BFC_MODE   "0"
+#   setenv  DAWN_BFC_MODE   "1"
+
+
+#----- << DAWN_DEVICE >> -----
+#      Set the default viewing device
+#        1: PS: 2: XWIN, 3: PS2, 4: XWIN2, 5: OPEN_GL
+#
+#  Note: This variable is effective only in the 
+#        off-line use of Renderer DAWN.
+#
+#  Example:
+#
+#   setenv  DAWN_DEVICE  "1"
+#   setenv  DAWN_DEVICE  "2"
+#   setenv  DAWN_DEVICE  "3"
+#   setenv  DAWN_DEVICE  "4"
+#   setenv  DAWN_DEVICE  "5"
+
+
+#----- << DAWN_HIDLINE_REMOVAL >> -----
+#      Set on/off the hidden-line-removal mode
+#      If this mode is on, hidden-line removal is performed.
+#        "1": on
+#        "0": off 
+#      The default value is "1".
+#
+#  Example:
+#
+#   setenv  DAWN_HIDLINE_REMOVAL "0"
+#   setenv  DAWN_HIDLINE_REMOVAL "1"
+
+
+#----- << DAWN_PS_PREVIEWER >> -----
+#      Set a name of the PostScript viewer. 
+#      The default value is "gv".
+#      "NONE" to skip viewing.
+#
+#  Example:
+#
+#   setenv  DAWN_PS_PREVIEWER          "gv"
+
+
+#----- << DAWN_UP_DIRECTION >> -----
+#      Set viewing-upward direction. 
+#      Select "Y" or "Z".
+#      The default is "Y", i.e., (0,1,0)-direction
+#
+#  Example:
+#
+#   setenv  DAWN_UP_DIRECTION "Y"
+#   setenv  DAWN_UP_DIRECTION "Z" 
+
+
+#----- << DAWN_USE_STENCIL >> -----
+#      Set on/off use of the stencil buffer in the OpenGL mode.
+#      If this mode is on, edges are drawn.
+#        "1": on
+#        "0": off 
+#      The default value of "0".
+#
+#  Example:
+#
+#   setenv  DAWN_USE_STENCIL "0"
+#   setenv  DAWN_USE_STENCIL "1"
+
+
+###############################################
+## Environmental variables to CUSTOMIZE      ##
+## Geant4 DAWN-Network visualization driver  ##  
+##                                           ##
+##  Note: This driver should be used only    ##
+##        for remote visualizaton.)          ##
+###############################################
+
+#----- << G4DAWN_GUI_ALWAYS >>
+#      Boolean flag to control GUI invokation.
+#      If this variable is set and the value is non-zero,
+#      DAWN connected with GEANT4 always pops up GUI menu.
+#      The default is "0", i.e., no GUI.
+#
+#  Example:
+#
+#   setenv  G4DAWN_GUI_ALWAYS                  "0" 
+#   setenv  G4DAWN_GUI_ALWAYS                  "1" 
+
+
+#----- << G4DAWN_HOST_NAME >>
+#      Set a host where Renderer DAWN is running with 
+#      the INET mode, i.e., invoked as "dawn -G".
+#      If the environmental variable G4DAWN_NAMED_PIPE 
+#      is set to "1", this host setting is ignored.
+#
+#  Example:
+#
+# setenv  G4DAWN_HOST_NAME  cernsp.cern.ch
+
+
+#----- << G4DAWN_MULTI_WINDOW >>
+#      Boolean flag to set on/off multi-window mode.
+#      If this variable is set and its value is non-zero,
+#      Geant4 invokes Renderer DAWN with the multi-X-window mode.  
+#      Otherwise DAWN is invoked with the EPS mode, in which
+#      EPS files are generated and viewed with a PS viewer.
+#      The default value is "0".
+#
+#  Example:
+#
+#   setenv  G4DAWN_MULTI_WINDOW      "0"
+#   setenv  G4DAWN_MULTI_WINDOW      "1"
+
+
+#----- << G4DAWN_NAMED_PIPE >> -----
+#      Boolean flag to set on/off BSD-type Unix-domain connection.
+#      If this variable is set and the value is non-zero,
+#      Renderer DAWN connected with GEANT4 in the BSD-type Unix domain,
+#      i.e. through named pipe.
+#      The default is "0", i.e., do no use this type of connection.
+#
+#  Example:
+#
+#   setenv  G4DAWN_NAMED_PIPE             "0"
+#   setenv  G4DAWN_NAMED_PIPE             "1"
+
+
+#----- << G4DAWN_PRECISION >> -----
+#      Set precision of double numbers in g4_XX.prim files.
+#      The number is used as 
+#        sprintf( string, "%*.*g", (precision+8), precision, value).
+#      See G4DAWNFILESceneHandler::G4DAWNFILESceneHandler() 
+#      for more details.
+#      The default precision is "9".
+#      
+#  Example:
+#
+#   setenv  G4DAWN_PRECISION   9
+
+
Index: tags/visualization-10.5-before-10.6_test/FukuiRenderer/GNUmakefile
===================================================================
--- tags/visualization-10.5-before-10.6_test/FukuiRenderer/GNUmakefile	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/FukuiRenderer/GNUmakefile	(revision 1102)
@@ -0,0 +1,30 @@
+# $Id: GNUmakefile,v 1.5 2004/06/03 11:40:12 gcosmo Exp $
+
+name := G4FR
+
+ifndef G4INSTALL
+  G4INSTALL = ../../..
+endif
+
+GLOBLIBS  = libG4vis_management.lib libG4modeling.lib
+GLOBLIBS += libG4run.lib libG4event.lib
+GLOBLIBS += libG4tracking.lib libG4processes.lib libG4digits_hits.lib
+GLOBLIBS += libG4track.lib libG4particles.lib libG4geometry.lib
+GLOBLIBS += libG4materials.lib libG4graphics_reps.lib
+GLOBLIBS += libG4intercoms.lib libG4global.lib
+
+include $(G4INSTALL)/config/architecture.gmk
+include $(G4INSTALL)/config/G4VIS_BUILD.gmk
+include $(G4INSTALL)/config/interactivity.gmk
+
+CPPFLAGS += -I$(G4BASE)/visualization/management/include
+CPPFLAGS += -I$(G4BASE)/visualization/modeling/include
+CPPFLAGS += -I$(G4BASE)/global/management/include
+CPPFLAGS += -I$(G4BASE)/graphics_reps/include
+CPPFLAGS += -I$(G4BASE)/intercoms/include
+CPPFLAGS += -I$(G4BASE)/global/HEPGeometry/include
+CPPFLAGS += -I$(G4BASE)/geometry/solids/CSG/include
+CPPFLAGS += -I$(G4BASE)/geometry/solids/specific/include
+CPPFLAGS += -I$(G4BASE)/geometry/management/include
+
+include $(G4INSTALL)/config/common.gmk
Index: tags/visualization-10.5-before-10.6_test/FukuiRenderer/History
===================================================================
--- tags/visualization-10.5-before-10.6_test/FukuiRenderer/History	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/FukuiRenderer/History	(revision 1102)
@@ -0,0 +1,165 @@
+$Id: History,v 1.26 2006/07/10 15:32:27 allison Exp $
+-------------------------------------------------------------------
+
+     =========================================================
+     Geant4 - an Object-Oriented Toolkit for Simulation in HEP
+     =========================================================
+
+                      Category History file
+                      ---------------------
+This file should be used by G4 developers and category coordinators
+to briefly summarize all major modifications introduced in the code
+and keep track of all category-tags.
+It DOES NOT substitute the  CVS log-message one should put at every
+committal in the CVS repository !
+
+     ----------------------------------------------------------
+     * Reverse chronological order (last date on top), please *
+     ----------------------------------------------------------
+
+History file for visualization/FukuiRenderer sub-category
+---------------------------------------------------------
+
+10th July 2006  John Allison  (DAWN-V08-01-00)
+- G4FRSceneFunc.icc: G4FRSCENEHANDLER::SendNdiv respects forced line
+  segments per circle.
+
+12th June 2006  John Allison  (DAWN-V08-00-04)
+- Fixed rewind problem:
+  o G4FRofstream.hh: Removed rewind (badly implemented).
+  o G4DAWNFILEViewer.cc: ClearView closes and re-opens file.
+- G4DAWNFILESceneHandler.cc: Fixed file closure on exit:
+
+2nd June 2006  John Allison  (DAWN-V08-00-03)
+- G4DAWNFILESceneHandler.cc: Close file in destructor if required.
+- G4FRSceneFunc.icc: Improve behaviour when no model exists.
+
+4th May 2006  John Allison  (DAWN-V08-00-02)
+- Improved protection for null models and parameters.
+
+19th April 2006  John Allison  (DAWN-V08-00-01)
+- G4FRSceneFunc.icc: Migrated to direct access to G4PhysicalVolumeModel.
+
+23rd January 2006  John Allison  (DAWN-V08-00-00)
+- Implemented G4FRofstream::Rewind.  Used in ClearView.  Avoids
+  duplicate geomtries in output file.
+
+13th October 2005  John Allison  (DAWN-V07-01-00)
+- Migrated to <sstream>.
+
+27th May 2005  John Allison  (DAWN-V07-00-00)
+- Fixed bug introduced in ClearTransientStore.
+
+22nd September 2004  John Allison  (DAWN-V06-02-00)
+- Improve diagnostic on trapping non-regular polyhedra.
+
+4th October 2003  Gabriele Cosmo (vis-V05-02-01)
+- Simplified GNUmakefile.
+
+DAWN-V04-01-01 Satoshi TANAKA  Sept 01, 2002
+- Precision control with "setenv G4DAWNFILE_PRECISION number".  
+
+DAWN-V03-02-01 Satoshi TANAKA  Sept 18, 2001
+- Maximal number of g4.prim file is changed from 99 to 100.
+
+DAWN-V03-02-00 Satoshi TANAKA  Sept 17, 2001
+- Updation for automatic visualization implemented at 
+  Hebden Bridge mini-workshop.
+
+DAWN-V01-01-04
+- Target =  standard target in scene 
+          + relative target in view
+  (G4DAWNFILEView.cc, G4FukuiRendererView.cc)
+- Automatic filename incrementation is made default.
+  g4_00.prim, g4_01.prim, ... , g4_99.prim
+  g4_00.eps , g4_01.eps , ... , g4_99.eps
+
+DAWN-V01-01-03  Satoshi TANAKA  May 11, 2000
+- In G4DAWNFILEViewer.cc, 
+  <       strcpy( fPSViewer, "ghostview" );
+  ---
+  > //    strcpy( fPSViewer, "ghostview" );
+  >       strcpy( fPSViewer, "gv" );
+
+DAWN-V00-01-08
+- Removed implicit casting from the previous updation
+
+DAWN-V00-01-06  Satoshi TANAKA  Nov 30, 1999
+- Fixing improper definition of alpha1, alpha2
+
+DAWN-V00-01-05  Satoshi TANAKA  Nov 23, 1999
+- Protection to special cases of G4Trap in AddThis()
+
+DAWN-V00-01-04  Satoshi TANAKA  Nov 02, 1999
+- Protection to AddPrimitive( G4NURBS )
+
+DAWN-V00-01-03  Satoshi TANAKA  Nov 02, 1999
+- Environmental variable G4DAWN_MULTI_WINDOW is	
+  renamed to G4DAWNFILE_MULTI_WINDOW for DAWN-file driver.
+  (G4DAWN_MULTI_WINDOW	still works for a while.)
+
+DAWN-V00-01-02  Satoshi TANAKA	Nov 01, 1999  
+- Separation of BeginModeling() and FRBeginModeling().
+  Co-workable with /run/beamOn with the new vis commands.
+
+DAWN-V00-01-01  Satoshi TANAKA	Aug 26, 1999  
+- Protection for invalid calling of BeginModeling
+- .DAWN.history ==> .DAWN_1.history 
+   **** It means DAWN version 3.80a or  after is  required ***
+
+DAWN-00-03-06	Satoshi TANAKA	Dec 04, 1998  
+- Maximun number of generated g4.prim files in the destination
+  directory is customizable as: "setenv G4DAWNFILE_MAX_FILE_NUM  N"
+  (N is the integer greater than or equal to 1. The default value is 1.)
+
+DAWN-00-03-05	Satoshi TANAKA	Dec 04, 1998  
+- Revised G4FRSocketConfig.hh together with architecture.gmk.
+  Compilation at SUN-CC was made automatic
+
+DAWN-00-03-04	Satoshi TANAKA	Dec 04, 1998  
+- Bug fix
+
+DAWN-00-03-03	Satoshi TANAKA	Nov 30, 1998  
+- Destination directiory of g4.prim and g4.eps is customizable 
+  with the environmental variable "G4DAWNFILE_DEST_DIR".
+
+  Unix:
+   % setenv G4DAWNFILE_DEST_DIR   directory_name/
+
+   For example, 
+
+   % setenv G4DAWNFILE_DEST_DIR   /tmp/
+
+   Do not forget to add "/" at the end of the directory name.
+
+  NT: 
+   DOS> set G4DAWNFILE_DEST_DIR   directory_name\
+
+   Do not forget to add "\" at the end of the directory name.
+
+- Auto incremetaion of output file names is supported.
+  Names of generated files are:
+
+   DAWN-format files: g4.prim, g4_1.prim, g4_2.prim, ... , g4_100.prim 
+   EPS files        : g4.eps , g4_1.eps , g4_2.eps , ... , g4_100.eps
+
+  Maximal number of files in one directory is restricted in order to 
+  avoid explosion of your hard disk. The maximal number is hard-coded.
+  You can revise is by editing enum of G4DAWNFILEScene.hh.
+
+  Note that the incrementation is done as follows (pseudo codes)
+
+    filename = "g4.prim" // initialization
+
+    while( filename already exists in the dest directory )
+    {
+	  increment filename
+    }
+
+  It means that if you delete file "g4.prim" in the destination directory,
+  the file name in the next generation is still g4.prim.
+ 
+
+DAWN-00-03-02	Satoshi TANAKA	Nov 30, 1998  
+
+- Backup before going on to tag DAWN-00-03-03.
Index: tags/visualization-10.5-before-10.6_test/FukuiRenderer/README
===================================================================
--- tags/visualization-10.5-before-10.6_test/FukuiRenderer/README	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/FukuiRenderer/README	(revision 1102)
@@ -0,0 +1,30 @@
+<< Portability >>
+
+Compilation of DAWN-file and DAWN-network drivers 
+are confirmed at the following platforms:
+
+  Linux, DEC, HP, AIX, Solaris, IRIX 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: tags/visualization-10.5-before-10.6_test/FukuiRenderer/include/G4DAWNFILE.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/FukuiRenderer/include/G4DAWNFILE.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/FukuiRenderer/include/G4DAWNFILE.hh	(revision 1102)
@@ -0,0 +1,57 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4DAWNFILE.hh,v 1.9 2006/06/29 21:16:28 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// Satoshi TANAKA
+// DAWNFILE driver factory.
+
+#ifndef G4DAWNFILE_HH
+#define G4DAWNFILE_HH
+
+#include "G4VGraphicsSystem.hh"
+
+	//----- prototype
+class G4VSceneHandler   ;
+
+	//----------------------------//
+	//----- class G4DAWNFILE -----// 
+	//----------------------------//
+class G4DAWNFILE: public G4VGraphicsSystem {
+
+public:
+  G4DAWNFILE ();
+  virtual ~G4DAWNFILE ();
+  G4VSceneHandler* CreateSceneHandler (const G4String& name = "");
+  G4VViewer*  CreateViewer  (G4VSceneHandler&, const G4String& name = "");
+
+private:
+
+
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/FukuiRenderer/include/G4DAWNFILESceneHandler.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/FukuiRenderer/include/G4DAWNFILESceneHandler.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/FukuiRenderer/include/G4DAWNFILESceneHandler.hh	(revision 1102)
@@ -0,0 +1,246 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4DAWNFILESceneHandler.hh,v 1.16 2006/06/29 21:16:30 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// Satoshi TANAKA
+
+#ifndef G4DAWNFILE_SCENE_HANDLER_HH
+#define G4DAWNFILE_SCENE_HANDLER_HH
+
+#include "globals.hh"
+
+#include "G4VSceneHandler.hh"
+
+#include "G4FRofstream.hh"
+#include "G4FRConst.hh"
+
+
+class G4VisAttributes ;
+class G4DAWNFILE;
+
+
+	//-----
+class G4DAWNFILESceneHandler: public G4VSceneHandler {
+
+  friend class G4DAWNFILEViewer;
+
+public:
+
+	//----- constructor and destructor
+  G4DAWNFILESceneHandler (G4DAWNFILE& system, const G4String& name = "");
+  virtual ~G4DAWNFILESceneHandler ();
+
+	//----- overriding base class methods
+  void AddPrimitive (const G4Polyline& line);
+  void AddPrimitive (const G4Polyhedron& p);
+  void AddPrimitive (const G4NURBS& nurb);
+  void AddPrimitive (const G4Text&);
+  void AddPrimitive (const G4Circle&);
+  void AddPrimitive (const G4Square&);
+
+	//----- explicitly invoke base class methods to avoid warnings about
+        //----- hiding of base class methods.
+  void AddPrimitive (const G4Polymarker& polymarker) 
+       { G4VSceneHandler::AddPrimitive (polymarker); }
+  void AddPrimitive (const G4Scale& scale) 
+       { G4VSceneHandler::AddPrimitive (scale); }
+
+  virtual void BeginModeling () { G4VSceneHandler::BeginModeling ();} 
+  virtual void EndModeling   () { G4VSceneHandler::EndModeling   ();}
+
+  virtual void BeginPrimitives (const G4Transform3D& objectTransformation);
+  virtual void EndPrimitives ();
+
+  void AddSolid ( const G4Box&    box    );
+  void AddSolid ( const G4Cons&   cons   );
+  void AddSolid ( const G4Tubs&   tubs   );
+  void AddSolid ( const G4Trd&    trd    );
+  void AddSolid ( const G4Trap&   trap   );
+  void AddSolid ( const G4Sphere& sphere );
+  void AddSolid ( const G4Para&   para   );
+  void AddSolid ( const G4Torus&  torus  );
+  void AddSolid ( const G4Polycone& polycone ) {
+    G4VSceneHandler::AddSolid (polycone);
+  }
+  void AddSolid ( const G4Polyhedra& polyhedra) {
+    G4VSceneHandler::AddSolid (polyhedra);
+  }
+  void AddSolid ( const G4VSolid& solid  );
+  void AddCompound ( const G4VTrajectory& traj) {
+    G4VSceneHandler::AddCompound(traj);
+  }
+  void AddCompound ( const G4VHit& hit) {
+    G4VSceneHandler::AddCompound(hit);
+  }
+
+  void ClearTransientStore();  // Used for triggering detector re-drawing.
+
+	//----- public methods inherent to this class
+  void         FRBeginModeling () ;
+  void         FREndModeling   () ;
+  G4bool       FRIsInModeling  () { return FRflag_in_modeling ; }
+
+  G4bool IsSavingG4Prim   ( void ) { return flag_saving_g4_prim ;	}
+  void	BeginSavingG4Prim( void ); 
+  void	EndSavingG4Prim  ( void ) ;
+  void	SetG4PrimFileName() ;
+
+  G4DAWNFILE&  GetSystem   () { return fSystem   ; }
+  void         SendBoundingBox   ( void );
+  const char*  GetG4PrimFileName () { return fG4PrimFileName ; }
+
+
+private:
+
+	//----- Utilities etc (common to DAWN and DAWNFILE drivers )
+  G4bool    SendVisAttributes ( const G4VisAttributes*  pAV );
+  G4bool    IsVisible     ( void ) ;
+  void	    SendTransformedCoordinates( void ) ;
+  void	    SendPhysVolName           ( void ) ;
+  void	    SendNdiv                  ( void ) ;
+
+	//----- public methods common to DAWN and DAWNFILE drivers
+public:
+  void	 SendStr   (	const char*	char_string ) ;
+  void	 SendStrInt(	const char*	char_string ,
+			G4int		ival    );
+  void	 SendStrInt3(	const char*	char_string ,
+			G4int		ival1  ,
+			G4int		ival2  ,
+			G4int		ival3   );
+  void	 SendStrInt4(	const char*	char_string ,
+			G4int		ival1  ,
+			G4int		ival2  ,
+			G4int		ival3  ,
+			G4int		ival4   );
+  void   SendStrDouble(	const char*	char_string ,
+			G4double	dval   );
+  void	 SendStrDouble2(	const char*	char_string ,
+				G4double	dval1  ,
+				G4double	dval2  );
+  void	 SendStrDouble3(	const char*	char_string ,
+				G4double	dval1  ,
+				G4double	dval2  ,
+				G4double	dval3   );
+
+  void	 SendStrDouble4(	const char*	char_string ,
+				G4double	dval1  ,
+				G4double	dval2  ,
+				G4double	dval3  ,
+				G4double	dval4  );
+
+  void	 SendStrDouble5(	const char*	char_string ,
+				G4double	dval1  ,
+				G4double	dval2  ,
+				G4double	dval3  ,
+				G4double	dval4  ,
+				G4double	dval5  );
+
+  void	 SendStrDouble6(	const char*	char_string ,
+				G4double	dval1  ,
+				G4double	dval2  ,
+				G4double	dval3  ,
+				G4double	dval4  ,
+				G4double	dval5  ,
+				G4double	dval6   );
+
+  void   SendStrDouble7(	const char*	char_string ,
+				G4double	dval1  ,
+				G4double	dval2  ,
+				G4double	dval3  ,
+				G4double	dval4  ,
+				G4double	dval5  ,
+				G4double	dval6  ,
+				G4double	dval7   );
+
+  void	SendStrDouble11(	const char*	char_string ,
+				G4double	dval1  ,
+				G4double	dval2  ,
+				G4double	dval3  ,
+				G4double	dval4  ,
+				G4double	dval5  ,
+				G4double	dval6  ,
+				G4double	dval7  ,
+				G4double	dval8  ,
+				G4double	dval9  ,
+				G4double	dval10  ,
+				G4double	dval11   ) ;
+
+  void	 SendIntDouble3(	G4int		ival   ,
+				G4double	dval1  ,
+				G4double	dval2  ,
+				G4double	dval3  );
+  void   SendInt3Str(	G4int		ival1  ,
+			G4int		ival2  ,
+			G4int		ival3  ,
+			const char*	char_string );
+  void   SendInt4Str(	G4int		ival1  ,
+			G4int		ival2  ,
+			G4int		ival3  ,
+			G4int		ival4  ,
+			const char*	char_string );
+
+  void	SendStrDouble6Str(	const char*	char_string1 ,
+				G4double	dval1  ,
+				G4double	dval2  ,
+				G4double	dval3  ,
+				G4double	dval4  ,
+				G4double	dval5  ,
+				G4double	dval6  ,
+				const char*	char_string2 );
+
+  void	SendInt   (	G4int 		val );
+  void	SendDouble(	G4double 	val );
+
+private:
+  G4DAWNFILE&	fSystem;     // Graphics system for this scene.
+  static G4int	fSceneIdCount;
+
+  G4FRofstream	fPrimDest    ;  // defined here
+  G4bool	FRflag_in_modeling ;	
+		// true:  FR_BEGIN_MODELING has sent to DAWN, and
+		//        FR_END_MODELING   has not sent yet.
+		// false:  otherwise
+		// 
+		// FRflag_in_modeling is set to "true"
+		// in FRBeginModeling(), and to "false" 
+		// in FREndModeling().
+
+  G4bool	flag_saving_g4_prim ;	
+
+  const int	COMMAND_BUF_SIZE    ;
+
+  char		fG4PrimDestDir [256] ; 
+  char          fG4PrimFileName[256] ;
+  G4int		fMaxFileNum           ;
+
+  G4int         fPrec, fPrec2 ;
+	
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/FukuiRenderer/include/G4DAWNFILEViewer.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/FukuiRenderer/include/G4DAWNFILEViewer.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/FukuiRenderer/include/G4DAWNFILEViewer.hh	(revision 1102)
@@ -0,0 +1,72 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4DAWNFILEViewer.hh,v 1.10 2006/06/29 21:16:32 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// Satoshi TANAKA
+// DAWNFILE viewer - opens window, hard copy, etc.
+
+#ifndef G4DAWNFILE_VIEWER_HH
+#define G4DAWNFILE_VIEWER_HH
+
+#include "G4VViewer.hh"
+#include "globals.hh"
+
+class G4DAWNFILESceneHandler ;
+
+class G4DAWNFILEViewer: public G4VViewer {
+
+	enum FRDEV {FRDEV_PS=1, FRDEV_XWIN=2, FRDEV_PS2=3, FRDEV_XWIN2=4, FRDEV_OPEN_GL=5, FRDEV_DEVICE_END=6} ;
+
+public:
+	//----- constructor and destructor
+  G4DAWNFILEViewer  (G4DAWNFILESceneHandler& scene, const G4String& name = "");
+  virtual ~G4DAWNFILEViewer ();
+
+	//----- overriding base class methods
+  void SetView   (); // Do nothing. SendViewParameters will do its job. 
+  void ClearView ();
+  void DrawView  ();
+  void ShowView  ();
+
+	//---- methods inherent to this class
+  void SendViewParameters ()  ;
+  const char* GetG4PrimViewer          () { return fG4PrimViewer ;}
+  const char* GetG4PrimViewerInvocation() { return fG4PrimViewerInvocation ;}
+  const char* GetPSViewer              () { return fPSViewer ;}
+  void  SendDrawingStyleToDAWNGUI( std::ostream& out ) ;
+
+private:
+  G4DAWNFILESceneHandler& fSceneHandler; // Reference to Graphics Scene for this view.
+
+  char  fG4PrimViewer          [32] ;
+  char  fG4PrimViewerInvocation[64] ;
+  char  fPSViewer              [32] ;
+
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/FukuiRenderer/include/G4FRClientServer.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/FukuiRenderer/include/G4FRClientServer.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/FukuiRenderer/include/G4FRClientServer.hh	(revision 1102)
@@ -0,0 +1,143 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4FRClientServer.hh,v 1.7 2006/06/29 21:16:34 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// Satoshi TANAKA, Wed Jul  3 14:13:52 JST 1996
+////////////////////////////////
+///// G4FRClientServer.h  /////
+////////////////////////////////
+
+//=================//
+#if defined (G4VIS_BUILD_DAWN_DRIVER) || defined (G4VIS_USE_DAWN)
+//=================//
+
+
+#if !defined G4FR_CLIENT_SERVER_H
+#define G4FR_CLIENT_SERVER_H
+
+#include<sys/types.h>
+#include<sys/socket.h>
+#include<netinet/in.h>
+#include<arpa/inet.h>
+#include<netdb.h>
+#include<sys/un.h>
+#include<unistd.h>
+#include<stdio.h>
+#include<stdlib.h>
+#include<string.h>
+#include"G4ios.hh"
+
+
+//----- constants
+const  char	FR_ENV_SERVER_HOST_NAME[]	= "G4DAWN_HOST_NAME"  ;
+const  char	FR_ENV_NAMED_PIPE_CONNECTION[]	= "G4DAWN_NAMED_PIPE" ;
+
+	//-----------------------------------//
+	//-----  class G4FRClientServer -----//
+	//-----------------------------------//
+
+class G4FRClientServer { 
+ public:
+	enum { SEND_BUFMAX = 1024 , RECV_BUFMAX = 1024 };
+	enum { SUN_PATH_MAX = 16 };
+
+ protected:	
+	const char		TERMINATOR ;
+	const char		END_OF_LINE;
+	char			SUN_PATH[ SUN_PATH_MAX ];
+	int			PORT_NUMBER ;
+	int			fSocketFd ;
+
+	char		fReceivedMessage [ RECV_BUFMAX ];
+	char		fSendingMessage  [ SEND_BUFMAX ];
+
+ protected:
+
+	void		Err( const char* message ) { perror(message) ;}
+	void		SetSendingMessage( const char* message ) 
+				{ strcpy( fSendingMessage, message );}
+	void		Send() ; // send command in fSendingMessage
+
+ public:	
+		//----- Server
+	int		AcceptUnix(){ return 0;}  // made unfunctioned  
+	int		AcceptINET(){ return 0 ;}  // made unfunctioned  
+
+		//----- Client
+	int		ConnectUnix(); 
+	int		ConnectINET(); 
+
+		//----- Common to server and client
+
+		//---------- (1)
+	G4FRClientServer (	char terminator = '.'           ,
+				char end_line = '\n'              ) ;  
+	virtual ~G4FRClientServer () {;}
+	void		SetSunPath( const char* sun_path ) 
+			{ strcpy     ( SUN_PATH, sun_path ); }
+	void		SetPortNumber( int port_num ) 
+			{ PORT_NUMBER = port_num ; }
+	void		IncrementPortNumber( int incr = 1 ) 
+			{ PORT_NUMBER += incr ; }
+	const char*	GetSendingMessage() const
+				{ return  fSendingMessage            ;}
+	int		GetSendingMessageLength() const
+				{ return  strlen(fSendingMessage)    ;}
+	void		SetReceivedMessage( const char* message ) 
+				{ strcpy( fReceivedMessage, message );}
+	const char*	GetReceivedMessage() const
+				{ return fReceivedMessage            ;}
+	int		GetReceivedMessageLength() const    
+				{ return strlen(fReceivedMessage)    ;}
+	int		GetSofd() const { return fSocketFd ; }
+	int		GetPortNumber () const { return PORT_NUMBER ; }
+	void		ClearReceivedMessage () 
+			{ memset(fReceivedMessage, '\0', RECV_BUFMAX) ;	}
+
+	int		IsTerminator(char ch ) { return ( ch == TERMINATOR ); }
+	char		GetTerminator()  const  { return TERMINATOR ; }
+	int		IsEndOfLine (char ch ) { return ( ch == END_OF_LINE ); }
+	char		GetEndOfLine() const { return END_OF_LINE ; }
+	void		DisConnect();
+	void		Clear();
+	void		WaitSendBack( const char* command_string ) ;
+
+		//---------- (2) send and receive
+	virtual	void	Send     ( const char* message ) ; 
+	virtual void	SendLine ( const char* message ) ; 
+				// Add END_OF_LINE if the message does not
+				// Terminate with it. And then send the message.
+	virtual	void	Receive() ;
+	virtual void	ReceiveLine() ;
+
+}; // G4FRClientServer
+
+
+#endif
+#endif //G4VIS_BUILD_DAWN_DRIVER
+
Index: tags/visualization-10.5-before-10.6_test/FukuiRenderer/include/G4FRConst.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/FukuiRenderer/include/G4FRConst.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/FukuiRenderer/include/G4FRConst.hh	(revision 1102)
@@ -0,0 +1,197 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4FRConst.hh,v 1.7 2006/06/29 21:16:36 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// Satoshi TANAKA, Tue Jul  2 15:30:49 JST 1996
+///////////////////////////////////
+///// G4FRConst.hh /////
+///////////////////////////////////
+
+#if !defined G4_FR_COMMAND_LIST_HH
+#define G4_FR_COMMAND_LIST_HH
+
+	//----- Header comment
+const   char  FR_G4_PRIM_HEADER        [] = "##G4.PRIM-FORMAT-2.4" ;
+//const   char  FR_PHYSICAL_VOLUME_NAME  [] = "#/PhysicalVolumeName" ;
+const   char  FR_PHYSICAL_VOLUME_NAME  [] = "#/PVName" ;
+
+	//----- Execution control (beginning with !)
+const   char  FR_GUI                   [] = "!GraphicalUserInterface" ;
+const   char  FR_DEVICE                [] = "!Device"           ;
+const   char  FR_SET_CAMERA            [] = "!SetCamera"        ;
+const	char  FR_OPEN_DEVICE           [] = "!OpenDevice"       ;
+const	char  FR_CLOSE_DEVICE          [] = "!CloseDevice"      ;
+const   char  FR_DRAW_ALL              [] = "!DrawAll"          ;
+const   char  FR_CLEAR_DATA            [] = "!ClearData"        ;
+const   char  FR_QUIT                  [] = "!Quit"             ;
+const	char  FR_DISCONNECT_DAWND      [] = "!DisconnectDawnd"  ;
+const	char  FR_TERMINATE_DAWND       [] = "!TerminateDawnd"   ;
+const   char  FR_SAVE                  [] = "!Save"             ;
+const   char  FR_END_SAVE              [] = "!EndSave"          ;
+const   char  FR_WAIT                  [] = "!Wait"             ;
+const   char  FR_PAUSE                 [] = "!Pause"            ;
+
+	//----- Drawing Style
+const	char  FR_WIREFRAME   [] = "/Wireframe" ;
+const	char  FR_SURFACE     [] = "/Surface"   ;
+const   char  FR_LINES       [] = "/Lines"     ;
+
+	//----- Begin and End of Modeling
+const	char  FR_BEGIN_MODELING        [] = "!BeginModeling"    ;
+const	char  FR_END_MODELING          [] = "!EndModeling"      ;
+
+	//----- Bounding box
+const	char  FR_BOUNDING_BOX   [] = "/BoundingBox"    ;
+const	char  FR_BOUNDING_BOX_UNIT [] = "/BoundingBox -0.5 -0.5 -0.5  0.5 0.5 0.5" ;
+
+	//----- Number of divising curved surface
+const	int   FR_DEFALUT_NDIV_VALUE = 24 ;
+
+const	char  FR_NDIV           [] = "/Ndiv"           ;
+const	char  FR_NDIV_DEFAULT [] = "/Ndiv  24" ;
+const	char  FR_NDIV_3  [] = "/Ndiv   3"      ;
+const	char  FR_NDIV_4  [] = "/Ndiv   4"      ;
+const	char  FR_NDIV_8  [] = "/Ndiv   8"      ;
+const	char  FR_NDIV_16 [] = "/Ndiv  16"      ;
+const	char  FR_NDIV_24 [] = "/Ndiv  24"      ;
+const	char  FR_NDIV_48 [] = "/Ndiv  48"      ;
+const	char  FR_NDIV_96 [] = "/Ndiv  96"      ;
+
+	//----- Camera information
+const	char  FR_CAMERA_POSITION[] = "/CameraPosition" ;
+const	char  FR_CAMERA_POSITION_DEFAULT[] = "/CameraPosition  100000.0  0.0  0.0" ;
+				// see from far upward position
+const	char  FR_TARGET_POINT   [] = "/TargetPoint";
+const	char  FR_ZOOM_FACTOR    [] = "/ZoomFactor";
+const	char  FR_SCALE          [] = "/Scale";
+const	char  FR_FOCAL_DISTANCE [] = "/FocalDistance";
+
+	//----- Body coordinate information
+const	char  FR_BASE_VECTOR    [] = "/BaseVector" ; 
+			// Give e1 and e2. Then e3 is calculated. 
+const	char  FR_BASE_VECTOR_DEFAULT    [] = "/BaseVector 1.0 0.0 0.0  0.0 1.0 0.0"  ;
+const	char  FR_ORIGIN         [] = "/Origin"         ;
+const	char  FR_ORIGIN_DEFAULT [] = "/Origin  0.0  0.0  0.0"  ;
+
+	//----- Attribute information
+const	char  FR_DIFFUSE_RGB       []  = "/DiffuseRGB" ;
+					// old name of /ColorRGB
+
+const	char  FR_COLOR_RGB         []  = "/ColorRGB"   ;
+const	char  FR_COLOR_RGB_DEFAULT []  = "/ColorRGB  1.0  1.0  1.0" ;
+const	char  FR_COLOR_RGB_WHITE   []  = "/ColorRGB  1.0  1.0  1.0" ;
+
+const	char  FR_COLOR_RGB_RED     []  = "/ColorRGB  1.0  0.0  0.0" ;
+const	char  FR_COLOR_RGB_GREEN   []  = "/ColorRGB  0.0  1.0  0.0" ;
+const	char  FR_COLOR_RGB_BLUE    []  = "/ColorRGB  0.0  0.0  1.0" ;
+
+const	char  FR_COLOR_RGB_CYAN    []  = "/ColorRGB  0.0  1.0  1.0" ;
+const	char  FR_COLOR_RGB_MAGENTA []  = "/ColorRGB  1.0  0.0  1.0" ;
+const	char  FR_COLOR_RGB_YELLOW  []  = "/ColorRGB  1.0  1.0  0.0" ;
+
+const	char  FR_SPECULAR_RGB   [] = "/SpecularRGB"  ;
+const	char  FR_SPECULAR_RGB_DEFAULT [] = "/SpecularRGB  1.0  1.0  1.0"  ;
+const	char  FR_SPECULAR_RGB_WHITE   [] = "/SpecularRGB  1.0  1.0  1.0"  ;
+
+const	char  FR_PHONG_POWER    [] = "/PhongPower"   ;
+const	char  FR_PHONG_POWER_DEFAULT [] = "/PhongPower  3"   ;
+
+const	char  FR_TRANSPARENCY   [] = "/Transparency" ;
+const	char  FR_TRANSPARENCY_ON   [] = "/Transparency  1 " ; // transparent
+const	char  FR_TRANSPARENCY_OFF  [] = "/Transparency  0 " ; // non-transparent
+
+const	char  FR_FORCE_WIREFRAME   [] = "/ForceWireframe" ;
+const	char  FR_FORCE_WIREFRAME_ON   [] = "/ForceWireframe  1" ;
+const	char  FR_FORCE_WIREFRAME_OFF  [] = "/ForceWireframe  0" ;
+
+const	char  FR_VISIBILITY     [] = "/Visibility"   ;
+const	char  FR_VISIBILITY_ON     [] = "/Visibility  1"    ; // visible
+const	char  FR_VISIBILITY_OFF    [] = "/Visibility  0"    ; // invisible
+
+	//----- 3D Primitives
+const	char  FR_POLYHEDRON     [] = "/Polyhedron"    ;
+const	char  FR_VERTEX         [] = "/Vertex"        ;
+const	char  FR_FACET          [] = "/Facet"         ;
+const	char  FR_END_POLYHEDRON [] = "/EndPolyhedron" ;
+
+const	char  FR_BOX            [] = "/Box"            ; 
+const	char  FR_BOX_UNIT  [] = "/Box  0.5  0.5  0.5" ; // dx, dy, dz
+
+const	char  FR_COLUMN         [] = "/Column"         ; 
+const	char  FR_COLUMN_UNIT [] = "/Column 0.5  0.5" ; // R dz
+
+const	char  FR_POLYLINE         [] = "/Polyline"          ; 
+const	char  FR_PL_VERTEX        [] = "/PLVertex"          ; 
+const	char  FR_PL_VERTEX_OLD    [] = "PLVertex"           ; 
+const	char  FR_END_POLYLINE     [] = "/EndPolyline"       ; 
+
+const	char  FR_TRD            [] = "/Trd"                  ; 
+	// /Trd  dx1 dx2 dy1 dy2 dz    ; 
+const	char  FR_TRAP           [] = "/Trap"                 ; 
+	// /Trap dz theta phi h1 bl1 tl1 alpha1 h2 bl2 tl2 alpha2
+const	char  FR_TUBS           [] = "/Tubs"                 ; 
+	// /Tubs rmin rmax dz sphi dphi  
+const	char  FR_CONS           [] = "/Cons"                 ; 
+	// /Cons rmin1 rmax1 rmin2 rmax2 dz sphi dphi  
+const	char  FR_SPHERE           [] = "/Sphere"             ; 
+	// /Sphere  R
+const	char  FR_SPHERE_SEG       [] = "/SphereSeg"          ; 
+	// /SphereSeg  rmin rmax s_theta d_theta s_phi d_phi
+const	char  FR_PARA             [] = "/Parallelepiped"     ;
+	// /Parallelepiped  dx dy dz tanAlpha tanTheta_cosPhi tanTheta_sinPhi
+const	char  FR_PCON             [] = "/PolyCone"           ;
+	// /PolyCone  sphi  dphi  nz  z[nz]  rmin[nz]  rmax[nz]
+const	char  FR_PGON             [] = "/PolyGon"            ;
+	// /PolyGon   sphi  dphi  ndiv  nz  z[nz]  rmin[nz]  rmax[nz]
+const	char  FR_TORUS            [] = "/Torus"              ;
+	// /PolyGon   sphi  dphi  ndiv  nz  z[nz]  rmin[nz]  rmax[nz]
+
+//----- Marks I (arg: x y z half_size_3d)
+const   char  FR_FONT_NAME       [] = "/FontName" ;
+
+//----- Marks I (arg: x y z half_size_3d)
+const	char  FR_MARK_CIRCLE_2D  [] = "/MarkCircle2D"   ; 
+const	char  FR_MARK_SQUARE_2D  [] = "/MarkSquare2D"   ; 
+const	char  FR_MARK_TEXT_2D    [] = "/MarkText2D"   ; 
+	// /MarkText2D  x y z  size_world x_offset_world y_offset_world string
+
+//----- Marks II (arg: x y z half_size_2d)
+const	char  FR_MARK_CIRCLE_2DS  [] = "/MarkCircle2DS"   ; 
+const	char  FR_MARK_SQUARE_2DS  [] = "/MarkSquare2DS"   ; 
+const	char  FR_MARK_TEXT_2DS    [] = "/MarkText2DS"   ; 
+	// /MarkText2DS  x y z  size_pt x_offset_pt y_offset_pt string
+
+//----- Text
+const	char  FR_TEXT_2DS    [] = "/Text2DS"   ; 	
+
+//----- For DAWNCUT
+const	char  FR_CLIPPING_PLANE  [] = "/ClippingPlane"   ; 
+	// /ClippingPlaneMarkCross2D  a b c d 
+	//   for plane   ax + by + cz + d = 0 
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/FukuiRenderer/include/G4FRFeatures.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/FukuiRenderer/include/G4FRFeatures.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/FukuiRenderer/include/G4FRFeatures.hh	(revision 1102)
@@ -0,0 +1,60 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4FRFeatures.hh,v 1.6 2006/06/29 21:16:38 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+#if !defined G4_FR_FEATURES_HH
+#define      G4_FR_FEATURES_HH
+
+
+const char FR_DAWN_FEATURES[] = "High quality technical renderer.\
+\n    Features:      exact hidden line, hidden surface algorithms.\
+\n                   high (unlimited) resolution.\
+\n                   renders to PostScript for viewing and/or hardcopy.\
+\n                   remote rendering.\
+\n                   off-line rendering.\
+\n                   graphical user interface.\
+\n                   connection via TCP/IP socket or named pipe Fukui Renderer DAWN.\
+\n    Disadvantages: compute intensive, takes time (use a fast graphics\
+\n                   system, such as OpenGL, to select view, then copy\
+\n                   to this renderer - /vis~/copy/view, /vis~/set/view).";
+
+
+const char FR_DAWNFILE_FEATURES[] ="High quality technical renderer.\
+\n    Features:      exact hidden line, hidden surface algorithms.\
+\n                   high (unlimited) resolution.\
+\n                   renders to PostScript for viewing and/or hardcopy.\
+\n                   remote rendering.\
+\n                   off-line rendering.\
+\n                   graphical user interface.\
+\n                   connection via g4.prim file to Fukui Renderer DAWN,\
+\n                   DAVID (DAwn's Visual Intersection Debugger, etc.\
+\n    Disadvantages: compute intensive, takes time (use a fast graphics\
+\n                   system, such as OpenGL, to select view, then copy\
+\n                   to this renderer - /vis~/copy/view, /vis~/set/view).";
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/FukuiRenderer/include/G4FRSceneFunc.icc
===================================================================
--- tags/visualization-10.5-before-10.6_test/FukuiRenderer/include/G4FRSceneFunc.icc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/FukuiRenderer/include/G4FRSceneFunc.icc	(revision 1102)
@@ -0,0 +1,1472 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4FRSceneFunc.icc,v 1.15 2006/07/10 15:31:45 allison Exp $
+// GEANT4 tag $Name:  $
+//
+
+#include "G4PhysicalVolumeModel.hh"
+#include "G4LogicalVolume.hh"
+
+//========== AddPrimitive() functions ==========//
+
+//----- Add polyline 
+void G4FRSCENEHANDLER::AddPrimitive (const G4Polyline& polyline) 
+{
+#if defined DEBUG_FR_SCENE
+      G4cerr << "***** AddPrimitive\n";
+#endif 
+		//----- Initialize Fukui Renderer IF NECESSARY
+     FRBeginModeling();
+
+          //----- local working variables
+     G4int            nPoints = polyline.size ();
+     G4int            i ;  
+     const            G4VisAttributes*  pVA =
+       fpViewer->GetApplicableVisAttributes ( polyline.GetVisAttributes() ); 
+
+		//----- skip drawing invisible primitive
+     if( pVA ){
+	if( !(pVA->IsVisible()) ) { return ; }
+     }
+
+		//----- Attributes   
+     if(!SendVisAttributes( pVA ) ) {
+       SendStr( FR_COLOR_RGB_RED ); // color 
+     }
+
+	//----- send coordinates to Fukui Renderer
+     SendTransformedCoordinates();
+
+	//----- send beginning of polyline
+     SendStr( FR_POLYLINE );
+
+	//----- vertices on polyline
+     for ( i = 0; i < nPoints; i++ ) {
+	  SendStrDouble3( FR_PL_VERTEX   , \
+			  polyline[i].x(), \
+			  polyline[i].y(), \
+			  polyline[i].z()   );
+     }
+
+	//----- send ending of polyline
+     SendStr( FR_END_POLYLINE );
+
+} // G4FRSCENEHANDLER::AddPrimitive (polyline)
+
+
+//----- Add nurbes
+void G4FRSCENEHANDLER::AddPrimitive (const G4NURBS&)
+{
+		//----- 
+#if defined DEBUG_FR_SCENE
+	G4cerr << "***** AddPrimitive( G4NURBS )\n";
+#endif
+
+		//----- Initialize DAWN IF NECESSARY
+	FRBeginModeling();
+	
+	///////////////////////////////////////////////
+	// DAWN does not support NUBS visualizaition //
+	///////////////////////////////////////////////
+}
+
+
+
+//----- Add text
+void G4FRSCENEHANDLER::AddPrimitive ( const G4Text& text )
+{
+		//----- 
+#if defined DEBUG_FR_SCENE
+	G4cerr << "***** AddPrimitive( G4Text )\n";
+#endif
+		//----- Initialize DAWN IF NECESSARY
+	FRBeginModeling();
+
+		//----- send color
+        const G4Color&	color     = GetTextColor (text) ;
+	SendStrDouble3(	FR_COLOR_RGB    ,
+			color.GetRed  (), 
+			color.GetGreen(),
+			color.GetBlue () );
+
+		//----- send body coordinates
+	SendTransformedCoordinates();
+
+		//----- Calc size 
+	MarkerSizeType size_type;
+	G4double	fontsize  = GetMarkerDiameter( text , size_type );
+
+		//----- Calc position
+	const G4Point3D&	position       = text.GetPosition  () ;
+
+		//----- offset
+	G4double x_offset = text.GetXOffset();
+	G4double y_offset = text.GetYOffset();
+
+		//----- get string to be visualized and Calc its length
+	const char* vis_text    = text.GetText();
+	const int   STR_LENGTH  = strlen ( vis_text );
+
+		//----- create buffer and copy the string there
+	int   MAX_STR_LENGTH   =  COMMAND_BUF_SIZE - 100 ;
+	if  ( MAX_STR_LENGTH <= 0 ) { 
+		G4cerr << "ERROR (FukuiRenderer) : Not enough buffer size for data transferring." << G4endl;
+		G4cerr << "                        G4Text Visualization is aborted" << G4endl;
+		return ;
+	}
+	char*  buf  = new char [ (MAX_STR_LENGTH + 1) ] ; 
+	if  ( MAX_STR_LENGTH >= STR_LENGTH  ) {
+		strcpy  ( buf, vis_text ) ; 
+	} else {
+		strncpy ( buf, vis_text, MAX_STR_LENGTH ) ;
+	}
+
+		//----- select string command 
+	char  text_command[32];
+	switch (size_type) {
+	case world:
+		strcpy ( text_command, FR_MARK_TEXT_2D  );
+		break;
+	case screen:
+	default:
+		strcpy ( text_command, FR_MARK_TEXT_2DS );
+		break;
+	}
+
+		//----- Send string command 
+	SendStrDouble6Str(	text_command, \
+				position.x() , position.y() , position.z(), 
+				fontsize     , x_offset     , y_offset    , 
+				buf                                    );
+
+		//----- delete buffer
+	delete [] buf ;
+
+} // G4FRSCENEHANDLER::AddPrimitive ( text )
+
+
+//----- Add circle
+void G4FRSCENEHANDLER::AddPrimitive ( const G4Circle& mark_circle )
+{
+		//----- 
+#if defined DEBUG_FR_SCENE
+	G4cerr << "***** AddPrimitive( G4Circle )\n";
+#endif
+		//----- Initialize Fukui Renderer IF NECESSARY
+	FRBeginModeling();
+
+		//----- send color
+        const G4Color&	color     = GetColor (mark_circle) ;
+	SendStrDouble3(	FR_COLOR_RGB    ,
+			color.GetRed  (), 
+			color.GetGreen(),
+			color.GetBlue () );
+
+		//----- send body coordinates
+	SendTransformedCoordinates();
+
+		//----- Calc position
+	const G4Point3D&	position       = mark_circle.GetPosition  () ;
+
+		//----- Calc size 
+	MarkerSizeType size_type;
+	G4double	size = GetMarkerRadius( mark_circle , size_type );
+
+		//----- send mark
+	switch (size_type) {
+	case world:
+		SendStrDouble4( FR_MARK_CIRCLE_2D, \
+				position.x() , position.y() , position.z(), size );
+		break;
+	default:
+	case screen:
+		SendStrDouble4( FR_MARK_CIRCLE_2DS, \
+				position.x() , position.y() , position.z(), size );
+		break;
+	}
+
+} // G4FRSCENEHANDLER::AddPrimitive ( mark_circle )
+
+
+//----- Add square
+void G4FRSCENEHANDLER::AddPrimitive (const G4Square& mark_square )
+{
+		//----- 
+#if defined DEBUG_FR_SCENE
+	G4cerr << "***** AddPrimitive( G4Square )\n";
+#endif
+		//----- Initialize Fukui Renderer IF NECESSARY
+	FRBeginModeling();
+
+		//----- send color
+        const G4Color&	color     = GetColor (mark_square) ;
+	SendStrDouble3(	FR_COLOR_RGB    ,
+			color.GetRed  (), 
+			color.GetGreen(),
+			color.GetBlue () );
+
+		//----- send body coordinates 
+	SendTransformedCoordinates();
+
+		//----- Calc position
+	const G4Point3D&  position = mark_square.GetPosition  () ;
+
+		//----- Calc size 
+	MarkerSizeType size_type;
+	G4double	size = GetMarkerRadius( mark_square , size_type );
+
+		//----- send mark
+	switch (size_type) {
+	case world:
+		SendStrDouble4( FR_MARK_SQUARE_2D, \
+				position.x() , position.y() , position.z(), size );
+		break;
+	default:
+	case screen:
+		SendStrDouble4( FR_MARK_SQUARE_2DS, \
+				position.x() , position.y() , position.z(), size );
+		break;
+	}
+
+} // G4FRSCENEHANDLER::AddPrimitive ( mark_square )
+
+
+//----- Add polyhedron
+void G4FRSCENEHANDLER::AddPrimitive ( const G4Polyhedron& polyhedron ) 
+{
+		//----- 
+#if defined DEBUG_FR_SCENE
+	G4cerr << "***** AddPrimitive( G4Polyhedron )\n";
+#endif
+
+	if (polyhedron.GetNoFacets() == 0) return;
+
+		//----- Initialize Fukui Renderer IF NECESSARY
+	FRBeginModeling();
+
+		//----- Attributes
+	if(!SendVisAttributes( fpViewer->GetApplicableVisAttributes
+			       (polyhedron.GetVisAttributes() ) ) ) {
+		  SendStr( FR_COLOR_RGB_RED ); // color 
+	}
+
+		//----- Coordinates
+	SendTransformedCoordinates();
+
+		//----- Brep data 
+
+		//---------- (1) Declare beginning of Brep data
+	SendStr(FR_POLYHEDRON);
+
+		//---------- (2) Vertex block
+	G4int i, j;
+	for (i = 1, j = polyhedron.GetNoVertices(); j; j--, i++){
+		G4Point3D point = polyhedron.GetVertex(i);
+		SendStrDouble3( FR_VERTEX, point.x (), point.y (), point.z ());
+	}
+	
+		//---------- (3) Facet block
+	for (int f = polyhedron.GetNoFacets(); f; f--){
+		G4int notLastEdge;
+		G4int index = -1; // initialization
+		G4int edgeFlag = 1;
+		G4int preedgeFlag = 1;
+		G4int work[4], i = 0;
+		do {
+			preedgeFlag = edgeFlag;
+			notLastEdge = polyhedron.GetNextVertexIndex(index, edgeFlag);
+			work[i++] = index;
+		}while (notLastEdge);
+		switch (i){
+		case 3:
+			SendStrInt3(FR_FACET, work[0], work[1], work[2] );
+			break;
+		case 4:
+			SendStrInt4(FR_FACET, work[0], work[1], work[2], work[3] );
+			break;
+		default:
+			G4cerr <<
+	"ERROR G4FRSCENEHANDLER::AddPrimitive(G4Polyhedron)\n";
+      G4PhysicalVolumeModel* pPVModel =
+        dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
+      if (pPVModel) G4cerr <<
+	"Volume " << pPVModel->GetCurrentPV()->GetName() <<
+	", Solid " << pPVModel->GetCurrentLV()->GetSolid()->GetName() <<
+	" (" << pPVModel->GetCurrentLV()->GetSolid()->GetEntityType();
+                        G4cerr <<
+	"\nG4Polyhedron facet with " << i << " edges" << G4endl;	
+		}
+	}
+
+		//---------- (4) Declare ending of Brep data
+	SendStr(FR_END_POLYHEDRON);
+
+} // G4FRSCENEHANDLER::AddPrimitive (polyhedron) 
+
+
+//----- 
+void G4FRSCENEHANDLER::SendNdiv ( void )
+{
+//////////////////////////////////////////////////
+//#if defined DEBUG_FR_SCENE
+//	G4cerr << "***** SendNdiv() (/Ndiv)" << G4endl;
+//#endif
+//////////////////////////////////////////////////
+
+		//----- local
+	G4int	num_division = FR_DEFALUT_NDIV_VALUE ;
+
+		//-----  number used for dividing a curved surface, Ndiv
+	// if ( GetModel() ) {  ?? Why test for model.  Can be zero.  JA ??
+	   const G4VisAttributes* pVisAttribs =
+	     fpViewer -> GetApplicableVisAttributes (fpVisAttribs);
+	   num_division = GetNoOfSides(pVisAttribs);
+	// } else {
+#if defined DEBUG_FR_SCENE
+	   G4cerr << "WARNING: GetNoOfSides() failed. " ;
+	   G4cerr << "The default value " << num_division ;
+	   G4cerr << " is assigned." << G4endl;
+#endif
+	//}
+
+		//---------- Error recovery for too small Ndiv
+	num_division = ( num_division < 3 ? 3 : num_division ); 
+
+//////////////////////////////////////////////////
+//#if defined DEBUG_FR_SCENE
+//	G4cerr << "Ndiv = " << num_division << G4endl;
+//#endif
+//////////////////////////////////////////////////
+
+		//----- Send resultant Ndiv
+	this->SendStrInt( FR_NDIV, num_division );
+
+
+}
+
+//----- 
+void G4FRSCENEHANDLER::FREndModeling ()
+{
+		//----- 		
+#if defined DEBUG_FR_SCENE
+	G4cerr << "***** FREndModeling (called)" << G4endl;
+#endif
+	if( FRIsInModeling() ) {
+
+#if defined DEBUG_FR_SCENE
+		G4cerr << "***** FREndModeling (started) " ; 
+		G4cerr << "(/EndModeling, /DrawAll, /CloseDevice)" << G4endl;
+#endif
+
+		SendStr( "#--------------------" );	
+
+			//----- !EndModeling
+		SendStr( FR_END_MODELING );
+
+			//----- !DrawAll
+		SendStr( FR_DRAW_ALL );
+
+			//----- !CloseDevice
+		SendStr( FR_CLOSE_DEVICE );
+
+			//----- End saving data to g4.prim
+		EndSavingG4Prim() ;
+
+			//------ Reset flag 
+		FRflag_in_modeling = false ;
+	}
+}
+
+
+//----- 
+void G4FRSCENEHANDLER::BeginPrimitives (const G4Transform3D& objectTransformation)
+{
+#if defined DEBUG_FR_SCENE
+	G4cerr << "***** BeginPrimitives \n";
+#endif
+
+  FRBeginModeling();
+
+  G4VSceneHandler::BeginPrimitives (objectTransformation);
+  fpObjectTransformation = &objectTransformation;
+
+}
+
+
+//----- 
+void G4FRSCENEHANDLER::EndPrimitives ()
+{
+#if defined DEBUG_FR_SCENE
+	G4cerr << "***** EndPrimitives \n";
+#endif
+  G4VSceneHandler::EndPrimitives ();
+}
+
+
+//========== AddSolid() functions ==========//
+
+//----- Add box
+void G4FRSCENEHANDLER::AddSolid( const G4Box& box )
+{
+#if defined DEBUG_FR_SCENE
+	G4cerr << "***** AddSolid ( box )\n";
+#endif
+		//----- skip drawing invisible primitive
+	if( !IsVisible() ) { return ; }
+
+		//----- Initialize Fukui Renderer IF NECESSARY
+	FRBeginModeling();
+
+		//----- Send Name 
+	SendPhysVolName();
+
+		//----- Send Ndiv
+	// SendNdiv();
+
+		//----- Attributes
+	if(!SendVisAttributes
+	   ( fpViewer->GetApplicableVisAttributes( fpVisAttribs ) ) ) {
+	  SendStr( FR_COLOR_RGB_GREEN ); // color 
+	}
+
+		//----- parameters (half lengths of box)
+	G4double dx = box.GetXHalfLength ();
+	G4double dy = box.GetYHalfLength ();
+	G4double dz = box.GetZHalfLength ();     
+  
+		//----- send coordinates to Fukui Renderer
+	SendTransformedCoordinates();
+
+		//----- send box to Fukui Renderer
+	SendStrDouble3( FR_BOX, dx, dy, dz );
+
+} // void G4FRSCENEHANDLER::AddSolid( const G4Box& box )
+
+
+//----- Add tubes
+void 
+G4FRSCENEHANDLER::AddSolid( const G4Tubs& tubes )
+{
+#if defined DEBUG_FR_SCENE
+	G4cerr << "***** AddSolid ( tubes )\n";
+#endif
+		//----- skip drawing invisible primitive
+	if( !IsVisible() ) { return ; }
+
+		//----- Initialize Fukui Renderer IF NECESSARY
+	FRBeginModeling();
+
+		//----- Send Name 
+	SendPhysVolName();
+
+		//----- Send Ndiv
+	SendNdiv();
+
+		//----- Attributes
+	if(!SendVisAttributes
+	   ( fpViewer->GetApplicableVisAttributes( fpVisAttribs ) ) ) {
+	  SendStr( FR_COLOR_RGB_BLUE ); // color 
+	}
+
+		//----- parameters
+	const G4double  R    = tubes.GetRMax() ;     // outside radius
+	const G4double  r    = tubes.GetRMin() ;     // inside radius
+	const G4double  dz   = tubes.GetDz  () ;     // half length in z
+  	const G4double  sphi = tubes.GetSPhi() ;     // starting angle
+  	const G4double  dphi = tubes.GetDPhi() ;     // angle width
+
+		//----- send coordinates to Fukui Renderer
+	SendTransformedCoordinates();
+
+		//----- send tubes to Fukui Renderer
+	SendStrDouble5( FR_TUBS, r, R, dz , sphi, dphi );
+
+} // void G4FRSCENEHANDLER::AddSolid( const G4Tubs& )
+
+
+
+//----- Add cons
+void 
+G4FRSCENEHANDLER::AddSolid( const G4Cons& cons )
+{
+#if defined DEBUG_FR_SCENE
+	G4cerr << "***** AddSolid ( cons )\n";
+#endif
+		//----- skip drawing invisible primitive
+	if( !IsVisible() ) { return ; }
+
+		//----- Initialize Fukui Renderer IF NECESSARY
+	FRBeginModeling();
+
+		//----- Send Name 
+	SendPhysVolName();
+
+		//----- Send Ndiv
+	SendNdiv();
+
+		//----- Attributes
+	if(!SendVisAttributes
+	   ( fpViewer->GetApplicableVisAttributes( fpVisAttribs ) ) ) {
+	  SendStr( FR_COLOR_RGB_CYAN ); // color 
+	}
+
+		//----- parameters
+	const G4double  r1    = cons.GetRmin1() ; // inside radius  at -dz
+	const G4double  R1    = cons.GetRmax1() ; // outside radius at -dz
+	const G4double  r2    = cons.GetRmin2() ; // inside radius  at +dz
+	const G4double  R2    = cons.GetRmax2() ; // outside radius at +dz
+	const G4double  dz    = cons.GetDz  ()  ; // half length in z
+  	const G4double  sphi  = cons.GetSPhi()  ; // starting angle
+  	const G4double  dphi  = cons.GetDPhi()  ; // angle width
+
+		//----- send coordinates to Fukui Renderer
+	SendTransformedCoordinates();
+
+		//----- send cons to Fukui Renderer
+	SendStrDouble7( FR_CONS, r1, R1, r2, R2, dz , sphi, dphi );
+
+}// G4FRSCENEHANDLER::AddSolid( cons )
+
+
+//----- Add trd
+void G4FRSCENEHANDLER::AddSolid ( const G4Trd& trd )
+{
+#if defined DEBUG_FR_SCENE
+	G4cerr << "***** AddSolid ( trd )\n";
+#endif
+
+		//----- skip drawing invisible primitive
+	if( !IsVisible() ) { return ; }
+
+		//----- Initialize Fukui Renderer IF NECESSARY
+	FRBeginModeling();
+
+		//----- Send Name 
+	SendPhysVolName();
+
+		//----- Send Ndiv
+	// SendNdiv();
+
+		//----- Attributes
+	if(!SendVisAttributes
+	   ( fpViewer->GetApplicableVisAttributes( fpVisAttribs ) ) ) {
+	  SendStr( FR_COLOR_RGB_MAGENTA ); // color 
+	}
+
+		//----- parameters
+	G4double dx1 = trd.GetXHalfLength1 ();
+	G4double dx2 = trd.GetXHalfLength2 ();
+	G4double dy1 = trd.GetYHalfLength1 ();
+	G4double dy2 = trd.GetYHalfLength2 ();
+	G4double dz  = trd.GetZHalfLength  ();
+  
+		//----- send coordinates to Fukui Renderer
+	SendTransformedCoordinates();
+
+		//----- send trd to Fukui Renderer
+	SendStrDouble5( FR_TRD, dx1, dx2, dy1, dy2, dz );
+
+} // G4FRSCENEHANDLER::AddSolid ( trd )
+
+
+//----- Add sphere
+void G4FRSCENEHANDLER::AddSolid ( const G4Sphere& sphere )
+{
+#if defined DEBUG_FR_SCENE
+	G4cerr << "***** AddSolid ( sphere )\n";
+#endif
+		//----- skip drawing invisible primitive
+	if( !IsVisible() ) { return ; }
+
+		//----- Initialize Fukui Renderer IF NECESSARY
+	FRBeginModeling();
+
+		//----- Send Name 
+	SendPhysVolName();
+
+		//----- Send Ndiv
+	SendNdiv();
+
+		//----- Attributes
+	if(!SendVisAttributes
+	   ( fpViewer->GetApplicableVisAttributes( fpVisAttribs ) ) ) {
+	  SendStr( FR_COLOR_RGB_YELLOW ); // color 
+	}
+
+		//----- parameters
+//	const G4double  rmin    = sphere.GetRmin();
+	const G4double  rmax    = sphere.GetRmax();
+//  	const G4double  sphi    = sphere.GetSPhi();
+  	const G4double  dphi    = sphere.GetDPhi();
+//	const G4double  stheta  = sphere.GetSTheta();
+	const G4double  dtheta  = sphere.GetDTheta();
+
+		//----- send coordinates to Fukui Renderer
+	SendTransformedCoordinates();
+
+		//----- send sphere to Fukui Renderer
+	const G4double PI_minus  = 0.9999 * pi ;
+	const G4double PI2_minus = 1.9999 * pi ;
+	if( dphi > PI2_minus    &&   dtheta > PI_minus ) {
+			//----- full sphere
+		SendStrDouble ( FR_SPHERE, rmax );
+	} else {
+
+			//----- call AddPrimitives( G4Polyhedron )
+			//...... For sphere "segment", 
+			//...... G4Polyhedron is used for visualization.
+			//...... Visualization attributes and 
+			//...... local coordinates are resent and overwritten.
+		G4VSceneHandler::AddSolid( sphere ) ; 
+
+////////////////////////////////////////////////////////////////
+//			//----- sphere segment
+//		SendStrDouble6( FR_SPHERE_SEG, rmin, rmax, stheta, dtheta, sphi, dphi );
+////////////////////////////////////////////////////////////////
+		
+	}
+
+} // G4FRSCENEHANDLER::AddSolid ( sphere )
+
+
+//----- Add para
+void G4FRSCENEHANDLER::AddSolid (const G4Para& para)
+{
+#if defined DEBUG_FR_SCENE
+	G4cerr << "***** AddSolid ( para )\n";
+#endif
+
+		//----- skip drawing invisible primitive
+	if( !IsVisible() ) { return ; }
+
+		//----- Initialize Fukui Renderer IF NECESSARY
+	FRBeginModeling();
+
+		//----- Send Name 
+	SendPhysVolName();
+
+		//----- Send Ndiv
+	// SendNdiv();
+
+		//----- Attributes
+	if(!SendVisAttributes
+	   ( fpViewer->GetApplicableVisAttributes( fpVisAttribs ) ) ) {
+	  SendStr( FR_COLOR_RGB_RED ); // color 
+	}
+
+		//----- local
+	const G4double epsilon = 1.0e-5 ;
+
+		//----- parameters preprocessing
+	G4double cosTheta                  = para.GetSymAxis().z() ;
+	if( cosTheta < epsilon ) {
+		G4cerr << "WARNING from FukuiRenderer (DAWN) driver:" << G4endl;
+		G4cerr << "  Invalid parameter for parallelepiped."   << G4endl;
+		G4cerr << "  Drawing is skipped."                     << G4endl;
+		return ;
+	}
+	G4double tanTheta_cosPhi_cosTheta  = para.GetSymAxis().x() ;
+	G4double tanTheta_sinPhi_cosTheta  = para.GetSymAxis().y() ;
+
+		//----- parameters 
+	G4double dx              = para.GetXHalfLength ();
+	G4double dy              = para.GetYHalfLength ();
+	G4double dz              = para.GetZHalfLength ();     
+	G4double tanAlpha        = para.GetTanAlpha();
+	G4double tanTheta_cosPhi = tanTheta_cosPhi_cosTheta / cosTheta ;
+	G4double tanTheta_sinPhi = tanTheta_sinPhi_cosTheta / cosTheta ; 
+
+		//----- send coordinates to Fukui Renderer
+	SendTransformedCoordinates();
+
+		//----- send data to Fukui Renderer
+	SendStrDouble6  ( FR_PARA, dx, dy, dz, tanAlpha, tanTheta_cosPhi, tanTheta_sinPhi );
+
+} // G4FRSCENEHANDLER::AddSolid ( para )
+
+
+//----- Add trap
+void G4FRSCENEHANDLER::AddSolid (const G4Trap& trap)
+{
+#if defined DEBUG_FR_SCENE
+	G4cerr << "***** AddSolid ( trap )\n";
+#endif
+
+		//----- skip drawing invisible primitive
+	if( !IsVisible() ) { return ; }
+
+		//----- Initialize Fukui Renderer IF NECESSARY
+	FRBeginModeling();
+
+		//----- Send Name 
+	SendPhysVolName();
+
+		//----- Send Ndiv
+	// SendNdiv();
+
+		//----- Attributes
+	if(!SendVisAttributes
+	   ( fpViewer->GetApplicableVisAttributes( fpVisAttribs ) ) ) {
+		  SendStr( FR_COLOR_RGB_GREEN ); // color 
+	}
+
+		//----- local
+	const G4double epsilon = 1.0e-5     ;
+
+		//----- parameters preprocessing
+	G4double cosTheta                  = trap.GetSymAxis().z() ;
+	if( cosTheta < epsilon ) {
+		G4cerr << "WARNING from FukuiRenderer (DAWN) driver:" << G4endl;
+		G4cerr << "  Invalid parameter for trap, 1" << G4endl;
+		G4cerr << "  Drawing is skipped."           << G4endl;
+		return ;
+	}
+
+	G4double  nx = trap.GetSymAxis().x() ;
+	G4double  ny = trap.GetSymAxis().y() ;
+
+		//----- parameters (half lengths of box)
+	G4double  dz      = trap.GetZHalfLength ();     
+	G4double  theta   = std::acos( cosTheta )      ;
+        G4double  phi;
+        if ( ny==0. && nx ==0.) { 
+          phi     = 0.;   // std::atan2(0.,0.) gives undefined value of phi 
+        } else {
+          phi = std::atan2( ny, nx ) ;  if( phi < 0. ) { phi += twopi ; } 
+					// -PI < std::atan() < PI 
+        }
+/////////////////////////////////////////////////
+//  	G4double  phi     = std::atan2( ny, nx ) ;  
+//	if( phi < 0.0 ) { phi += twopi ; } 
+//				// -PI < std::atan() < PI 
+/////////////////////////////////////////////////
+
+  	G4double  h1      = trap.GetYHalfLength1 ();     
+  	G4double  bl1     = trap.GetXHalfLength1 (); 
+  	G4double  tl1     = trap.GetXHalfLength2 (); 
+  	G4double  alpha1  = std::atan( trap.GetTanAlpha1()) ;
+  	G4double  h2      = trap.GetYHalfLength2 ();     
+  	G4double  bl2     = trap.GetXHalfLength3 (); 
+  	G4double  tl2     = trap.GetXHalfLength4 (); 
+  	G4double  alpha2  = std::atan( trap.GetTanAlpha2()) ;
+
+		//----- send coordinates to Fukui Renderer
+	SendTransformedCoordinates();
+
+		//----- Change sign of alpha for compatibility 
+		//      with the DAWN format
+	G4double  alpha_sign = -1.0 ;
+	alpha1 *= alpha_sign ;		alpha2 *= alpha_sign ;
+
+		//----- send box to Fukui Renderer
+	SendStrDouble11(	FR_TRAP ,
+				dz      , 
+				theta   ,
+				phi     ,
+				h1      ,
+				bl1     ,
+				tl1     ,
+				alpha1  ,
+				h2      ,
+				bl2     ,
+				tl2     ,
+				alpha2   );
+
+} // G4FRSCENEHANDLER::AddSolid (const G4Trap& trap)
+
+
+//----- Add torus
+void 
+G4FRSCENEHANDLER::AddSolid( const G4Torus& torus )
+{
+#if defined DEBUG_FR_SCENE
+	G4cerr << "***** AddSolid ( torus )\n";
+#endif
+		//----- skip drawing invisible primitive
+	if( !IsVisible() ) { return ; }
+
+		//----- Initialize Fukui Renderer IF NECESSARY
+	FRBeginModeling();
+
+		//----- Send Name 
+	SendPhysVolName();
+
+		//----- Send Ndiv
+	SendNdiv();
+
+		//----- Attributes
+	if(!SendVisAttributes
+	   ( fpViewer->GetApplicableVisAttributes( fpVisAttribs ) ) ) {
+		  SendStr( FR_COLOR_RGB_BLUE ); // color 
+	}
+
+		//----- parameters
+	const G4double  r    = torus.GetRmin() ; 
+	const G4double  R    = torus.GetRmax() ; 
+	const G4double  t    = torus.GetRtor() ; 
+  	const G4double  sphi = torus.GetSPhi() ; 
+  	const G4double  dphi = torus.GetDPhi() ; 
+
+		//----- send coordinates to Fukui Renderer
+	SendTransformedCoordinates();
+
+		//----- send torus to Fukui Renderer
+	SendStrDouble5( FR_TORUS, r, R, t , sphi, dphi );
+
+} // void G4FRSCENEHANDLER::AddSolid( const G4Torus& )
+
+
+
+//----- Add a shape which is not treated above
+void G4FRSCENEHANDLER::AddSolid ( const G4VSolid& solid  )
+{
+		//----- skip drawing invisible primitive
+        if( !IsVisible() ) { return ; }
+
+		//----- Initialize Fukui Renderer IF NECESSARY
+        FRBeginModeling();
+
+		//----- Send Name 
+	SendPhysVolName() ; 
+
+		//----- Send Ndiv
+	// SendNdiv();
+
+		//----- Send a primitive
+	G4VSceneHandler::AddSolid( solid ) ; 
+
+} //G4FRSCENEHANDLER::AddSolid ( const G4VSolid& ) 
+
+
+//----- 
+G4bool
+G4FRSCENEHANDLER::SendVisAttributes ( const G4VisAttributes*  pAV )
+{
+
+  // Have a look at G4VSceneHandler::GetDrawingStyle (const G4Visible&). (John)
+
+  G4bool status = true ; // initialization
+  const G4double ALPHA_MIN = 0.001 ; // min of alpha factor of color
+
+  if( pAV == NULL ) { 
+        // No attribute is given.
+        // Do nothing. Status is "fail".
+    status = false ; 
+
+  } else {
+        // Send attributes. Status is "success".
+    status = true ;
+    SendStrDouble3( FR_COLOR_RGB, 
+		    pAV->GetColor().GetRed  (), 
+		    pAV->GetColor().GetGreen(), 
+		    pAV->GetColor().GetBlue () ); 
+    if ( pAV->GetColor().GetAlpha() < ALPHA_MIN ) {
+      SendStr( FR_FORCE_WIREFRAME_ON ) ;
+    } 
+    else if ( pAV->IsForceDrawingStyle () &&
+	      (pAV->GetForcedDrawingStyle () ==  G4VisAttributes::wireframe)) {
+      SendStr( FR_FORCE_WIREFRAME_ON ) ;
+    } else {
+      SendStr( FR_FORCE_WIREFRAME_OFF ) ;
+    }
+  } 
+
+  return status ;
+
+} // G4FRSCENEHANDLER::SendVisAttributes ()
+
+
+//----- 
+G4bool G4FRSCENEHANDLER::IsVisible()
+{
+	//----- 
+	G4bool  visibility  = true ;
+
+	//----- 
+	const G4VisAttributes* pVisAttribs =
+	  fpViewer->GetApplicableVisAttributes( fpVisAttribs );
+
+	//----- 
+	if( ( getenv( FR_ENV_CULL_INVISIBLE_OBJECTS ) != NULL      )   && \
+	    ( strcmp( getenv( FR_ENV_CULL_INVISIBLE_OBJECTS ),"0"  ) ) && \
+	    ( pVisAttribs )                                             ) 
+	{
+		visibility = pVisAttribs->IsVisible();
+	} 
+
+	//----- 
+	return visibility ;
+
+} // G4FRSCENEHANDLER::IsVisible()
+
+
+//----- 
+void G4FRSCENEHANDLER::SendBoundingBox( void )
+{
+#if defined DEBUG_FR_SCENE
+	G4cerr << "***** SendBoundingBox ()  (/BoundingBox)" << G4endl;
+#endif
+
+		//----- (1A) CALC bounding box of the bounding sphere
+	const  G4VisExtent&  extent = GetScene()->GetExtent();
+	const  G4Point3D&    center = extent.GetExtentCenter(); 
+	const  G4double      radius = extent.GetExtentRadius();
+
+	G4double xmin = center.x() - radius ; 
+	G4double ymin = center.y() - radius ; 
+	G4double zmin = center.z() - radius ; 
+
+	G4double xmax = center.x() + radius ; 
+	G4double ymax = center.y() + radius ; 
+	G4double zmax = center.z() + radius ; 
+
+////////////////////////////////////////////
+//	G4double xmin = extent.GetXmin ();
+//	G4double ymin = extent.GetYmin ();
+//	G4double zmin = extent.GetZmin ();
+//	G4double xmax = extent.GetXmax ();
+//	G4double ymax = extent.GetYmax ();
+//	G4double zmax = extent.GetZmax ();
+////////////////////////////////////////////
+
+		//----- (1B) SEND bounding box
+	SendStrDouble6(	FR_BOUNDING_BOX, 
+			xmin, ymin, zmin,
+			xmax, ymax, zmax ); 
+
+} // G4FRSCENEHANDLER::SendBoundingBox()
+
+
+//----- 
+void 
+G4FRSCENEHANDLER::SendTransformedCoordinates()
+{
+		//----- coord info
+	G4Point3D  zero ( 0.0 , 0.0 , 0.0 ); 	
+	G4Point3D  x1   ( 1.0 , 0.0 , 0.0 ); 
+	G4Point3D  y1   ( 0.0 , 1.0 , 0.0 ); 
+	G4Vector3D x_unit_vec( 1.0 , 0.0 , 0.0 ); 
+	G4Vector3D y_unit_vec( 0.0 , 1.0 , 0.0 ); 
+
+		//----- transformed origin
+	zero.transform( *fpObjectTransformation );
+
+		//----- transformed base vectors
+	x1.transform( *fpObjectTransformation );
+	x_unit_vec = x1 - zero ;
+	y1.transform( *fpObjectTransformation );
+ 	y_unit_vec = y1 - zero ;
+
+		//----- send transformed origin
+	SendStrDouble3( FR_ORIGIN ,  (zero.x()), (zero.y()), (zero.z()) ) ; 
+
+		//----- send transformed base vectors
+	SendStrDouble6( 	 FR_BASE_VECTOR , \
+				(x_unit_vec.x()), (x_unit_vec.y()), (x_unit_vec.z()) , \
+				(y_unit_vec.x()), (y_unit_vec.y()), (y_unit_vec.z())     ) ; 
+
+} // G4FRSCENEHANDLER::SendTransformedCoordinates()
+
+
+//----- 
+void  G4FRSCENEHANDLER::SendPhysVolName ( void )
+{
+	// Local 
+	G4int i ;
+
+	// Current Model
+	const G4VModel* pv_model  = GetModel();
+	if (!pv_model) { return ; } 
+
+        G4PhysicalVolumeModel* pPVModel =
+          dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
+        if (!pPVModel) { return ; }
+
+	// Current Physical volume name 
+	G4String  pv_name  = pPVModel->GetCurrentTag() ;
+
+	// Current depth of volume
+	G4int cur_depth = pPVModel->GetCurrentDepth() ;
+
+	// Make a string to be sent
+	// e.g. experimental_Hall.1, where "1" is the copy number
+	G4String name_comment ( FR_PHYSICAL_VOLUME_NAME );  
+	name_comment += "     " ;
+
+	for ( i = 0 ; i < cur_depth; i++) { 
+		// Make tree
+		name_comment += "     " ;
+	}
+	name_comment += pv_name ;
+
+	// Send physical volume name 
+	SendStr ( "#--------------------" );
+	SendStr ( name_comment );
+
+} // G4FRSCENEHANDLER::SendPhysVolName ()
+
+
+//----- 
+void G4FRSCENEHANDLER::SendStr( const char* char_string )
+{
+	fPrimDest.SendLine( char_string );
+} 
+
+
+//----- 
+void G4FRSCENEHANDLER::SendStrInt(	const char*	char_string ,
+					G4int		ival    )
+{
+		//----- make command char_string and send 
+	G4int	num_char ;
+	char*	command = new char [ COMMAND_BUF_SIZE ];
+
+	num_char  = sprintf( command, "%s  %d", char_string , ival ) ; 
+	if( num_char < 0 ) { 
+		G4cerr << "ERROR G4FRSCENEHANDLER::SendStrInt(), 1\n" ;
+	}
+	SendStr( command );
+	delete [] command ;
+} // G4FRSCENEHANDLER::SendStrInt()
+
+
+//----- 
+void 
+G4FRSCENEHANDLER::SendStrInt3(	const char*	char_string ,
+					G4int		ival1  ,
+					G4int		ival2  ,
+					G4int		ival3   )
+{
+		//----- make command char_string and send 
+	G4int	num_char ;
+	char*	command = new char [ COMMAND_BUF_SIZE ];
+
+	num_char  = \
+	 sprintf( command, "%s  %d  %d  %d", char_string , ival1, ival2, ival3 ) ; 
+
+	if( num_char < 0 ) { 
+		G4cerr << "ERROR G4FRSCENEHANDLER::SendStrInt3(), 1\n" ;
+	}
+	SendStr( command );
+	delete [] command ;
+
+} // G4FRSCENEHANDLER::SendStrInt3()
+
+
+//----- 
+void 
+G4FRSCENEHANDLER::SendStrInt4(	const char*	char_string ,
+					G4int		ival1  ,
+					G4int		ival2  ,
+					G4int		ival3  ,
+					G4int		ival4   )
+{
+		//----- make command char_string and send 
+	G4int	num_char ;
+	char*	command = new char [ COMMAND_BUF_SIZE ];
+
+	num_char  = \
+	 sprintf( command, "%s  %d  %d  %d  %d", char_string , ival1, ival2, ival3, ival4 ) ; 
+
+	if( num_char < 0 ) { 
+		G4cerr << "ERROR G4FRSCENEHANDLER::SendStrInt4(), 1\n" ;
+	}
+	SendStr( command );
+	delete [] command ;
+
+} // G4FRSCENEHANDLER::SendStrInt4()
+
+//----- 
+void G4FRSCENEHANDLER::SendStrDouble(	const char*	char_string ,
+						G4double	dval    )
+{
+		//----- make command char_string and send 
+	G4int	num_char ;
+	char*	command = new char [ COMMAND_BUF_SIZE ];
+
+	num_char  = sprintf( command, "%s  %*.*g", \
+					char_string , \
+					fPrec2, fPrec, dval ) ; 
+	if( num_char < 0 ) { 
+		G4cerr << "ERROR G4FRSCENEHANDLER::SendStrDouble(), 1\n" ;
+	}
+	SendStr( command );
+	delete [] command ;
+
+} // G4FRSCENEHANDLER::SendStrDouble()
+
+
+//----- 
+void 
+G4FRSCENEHANDLER::SendStrDouble2(	const char*	char_string ,
+					G4double	dval1  ,
+					G4double	dval2  )
+{
+		//----- make command char_string and send 
+	G4int	num_char ;
+	char*	command = new char [ COMMAND_BUF_SIZE ];
+
+	num_char  = sprintf( command, "%s  %*.*g  %*.*g", char_string , \
+					fPrec2, fPrec, dval1, \
+					fPrec2, fPrec, dval2         ) ; 
+	if( num_char < 0 ) { 
+		G4cerr << "ERROR G4FRSCENEHANDLER::SendStrDouble2(), 1\n" ;
+	}
+	SendStr( command );
+	delete [] command ;
+
+} // G4FRSCENEHANDLER::SendStrDouble2()
+
+
+//----- 
+void 
+G4FRSCENEHANDLER::SendStrDouble3(	const char*	char_string ,
+					G4double	dval1  ,
+					G4double	dval2  ,
+					G4double	dval3   )
+{
+		//----- make command char_string and send 
+	G4int	num_char ;
+	char*	command = new char [ COMMAND_BUF_SIZE ];
+
+	num_char  = sprintf( command, "%s  %*.*g  %*.*g  %*.*g", \
+				char_string , \
+				fPrec2, fPrec, dval1, \
+				fPrec2, fPrec, dval2, \
+				fPrec2, fPrec, dval3   ) ; 
+	if( num_char < 0 ) { 
+		G4cerr << "ERROR G4FRSCENEHANDLER::SendStrDouble3(), 1\n" ;
+	}
+	SendStr( command );
+	delete [] command ;
+
+} // G4FRSCENEHANDLER::SendStrDouble3()
+
+
+//----- 
+void 
+G4FRSCENEHANDLER::SendStrDouble4(	const char*	char_string ,
+					G4double	dval1  ,
+					G4double	dval2  ,
+					G4double	dval3  ,
+					G4double	dval4  )
+{
+		//----- make command char_string and send 
+	G4int	num_char ;
+	char*	command = new char [ COMMAND_BUF_SIZE ];
+
+	num_char  = sprintf( command, "%s  %*.*g  %*.*g  %*.*g  %*.*g", \
+                                       char_string , \
+					fPrec2, fPrec, dval1, \
+					fPrec2, fPrec, dval2, \
+					fPrec2, fPrec, dval3, \
+					fPrec2, fPrec, dval4) ; 
+	if( num_char < 0 ) { 
+		G4cerr << "ERROR G4FRSCENEHANDLER::SendStrDouble4(), 1\n" ;
+	}
+	SendStr( command );
+	delete [] command ;
+
+} // G4FRSCENEHANDLER::SendStrDouble4()
+
+
+//----- 
+void 
+G4FRSCENEHANDLER::SendStrDouble5(	const char*	char_string ,
+					G4double	dval1  ,
+					G4double	dval2  ,
+					G4double	dval3  ,
+					G4double	dval4  ,
+					G4double	dval5  )
+{
+		//----- make command char_string and send 
+	G4int	num_char ;
+	char*	command = new char [ COMMAND_BUF_SIZE ];
+
+	num_char  = sprintf( command, "%s  %*.*g  %*.*g  %*.*g  %*.*g  %*.*g", \
+                                       char_string , \
+					fPrec2, fPrec, dval1, \
+					fPrec2, fPrec, dval2, \
+					fPrec2, fPrec, dval3, \
+					fPrec2, fPrec, dval4, \
+					fPrec2, fPrec, dval5    ) ; 
+	if( num_char < 0 ) { 
+		G4cerr << "ERROR G4FRSCENEHANDLER::SendStrDouble5(), 1\n" ;
+	}
+	SendStr( command );
+	delete [] command ;
+
+} // G4FRSCENEHANDLER::SendStrDouble5()
+
+
+//----- 
+void 
+G4FRSCENEHANDLER::SendStrDouble6(	const char*	char_string ,
+					G4double	dval1  ,
+					G4double	dval2  ,
+					G4double	dval3  ,
+					G4double	dval4  ,
+					G4double	dval5  ,
+					G4double	dval6   )
+{
+		//----- make command char_string and send 
+	G4int	num_char ;
+	char*	command = new char [ COMMAND_BUF_SIZE ];
+
+	num_char  = sprintf( command, "%s  %*.*g  %*.*g  %*.*g  %*.*g  %*.*g  %*.*g", \
+                                       char_string , \
+					fPrec2, fPrec, dval1, \
+					fPrec2, fPrec, dval2, \
+					fPrec2, fPrec, dval3, \
+					fPrec2, fPrec, dval4, \
+					fPrec2, fPrec, dval5, \
+					fPrec2, fPrec, dval6    ) ; 
+	if( num_char < 0 ) { 
+		G4cerr << "ERROR G4FRSCENEHANDLER::SendStrDouble6(), 1\n" ;
+	}
+	SendStr( command );
+	delete [] command ;
+
+} // G4FRSCENEHANDLER::SendStrDouble6()
+
+
+//----- 
+void 
+G4FRSCENEHANDLER::SendStrDouble7(	const char*	char_string ,
+					G4double	dval1  ,
+					G4double	dval2  ,
+					G4double	dval3  ,
+					G4double	dval4  ,
+					G4double	dval5  ,
+					G4double	dval6  ,
+					G4double	dval7   )
+{
+		//----- make command char_string and send 
+	G4int	num_char ;
+	char*	command = new char [ COMMAND_BUF_SIZE ];
+
+	num_char  = sprintf( command, "%s  %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g", \
+                             char_string , \
+				fPrec2, fPrec, dval1,\
+				fPrec2, fPrec, dval2,\
+				fPrec2, fPrec, dval3,\
+				fPrec2, fPrec, dval4,\
+				fPrec2, fPrec, dval5,\
+				fPrec2, fPrec, dval6,\
+				fPrec2, fPrec, dval7  ) ; 
+	if( num_char < 0 ) { 
+		G4cerr << "ERROR G4FRSCENEHANDLER::SendStrDouble7(), 1\n" ;
+	}
+	SendStr( command );
+	delete [] command ;
+
+} // G4FRSCENEHANDLER::SendStrDouble7()
+
+
+//----- 
+void 
+G4FRSCENEHANDLER::SendStrDouble11(	const char*	char_string ,
+					G4double	dval1  ,
+					G4double	dval2  ,
+					G4double	dval3  ,
+					G4double	dval4  ,
+					G4double	dval5  ,
+					G4double	dval6  ,
+					G4double	dval7  ,
+					G4double	dval8  ,
+					G4double	dval9  ,
+					G4double	dval10  ,
+					G4double	dval11   )
+{
+		//----- make command char_string and send 
+	G4int	num_char ;
+	char*	command = new char [ COMMAND_BUF_SIZE ];
+
+	num_char  = sprintf( command, "%s  %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g", \
+                             char_string ,\
+				fPrec2, fPrec, dval1, \
+				fPrec2, fPrec, dval2, \
+				fPrec2, fPrec, dval3, \
+				fPrec2, fPrec, dval4, \
+				fPrec2, fPrec, dval5, \
+				fPrec2, fPrec, dval6, \
+				fPrec2, fPrec, dval7, \
+				fPrec2, fPrec, dval8, \
+				fPrec2, fPrec, dval9, \
+				fPrec2, fPrec, dval10,\
+				fPrec2, fPrec, dval11 ) ; 
+	if( num_char < 0 ) { 
+		G4cerr << "ERROR G4FRSCENEHANDLER::SendStrDouble11(), 1\n" ;
+	}
+	SendStr( command );
+	delete [] command ;
+
+} // G4FRSCENEHANDLER::SendStrDouble11()
+
+
+//----- 
+void 
+G4FRSCENEHANDLER::SendIntDouble3(	G4int		ival   ,
+					G4double	dval1  ,
+					G4double	dval2  ,
+					G4double	dval3  )
+{
+		//----- make command char_string and send 
+	G4int	num_char ;
+	char*	command = new char [ COMMAND_BUF_SIZE ];
+
+	num_char  = sprintf( command, "%d  %*.*g  %*.*g  %*.*g", \
+                                       ival , \
+					fPrec2, fPrec, dval1, \
+					fPrec2, fPrec, dval2, \
+					fPrec2, fPrec, dval3    ) ; 
+	if( num_char < 0 ) { 
+		G4cerr << "ERROR G4FRSCENEHANDLER::SendIntDouble3(),1\n" ;
+	}
+	SendStr( command );
+	delete [] command ;
+}
+
+//----- 
+void 
+G4FRSCENEHANDLER::SendInt3Str(	G4int		ival1  ,
+					G4int		ival2  ,
+					G4int		ival3  ,
+					const char*	char_string )
+{
+		//----- make command char_string and send 
+	G4int	num_char ;
+	char*	command = new char [ COMMAND_BUF_SIZE ];
+
+	num_char  = sprintf( command, "%d %d %d %s", \
+                                       ival1, ival2, ival3, char_string ) ; 
+	if( num_char < 0 ) { 
+		G4cerr << "ERROR G4FRSCENEHANDLER::SendInt3Str(),1\n" ;
+	}
+	SendStr( command );
+	delete [] command ;
+}
+
+//----- 
+void 
+G4FRSCENEHANDLER::SendInt4Str(	G4int		ival1  ,
+					G4int		ival2  ,
+					G4int		ival3  ,
+					G4int		ival4  ,
+					const char*	char_string )
+{
+		//----- make command char_string and send 
+	G4int	num_char ;
+	char*	command = new char [ COMMAND_BUF_SIZE ];
+
+	num_char  = sprintf( command, "%d %d %d %d %s", \
+                                       ival1, ival2, ival3, ival4, char_string ) ; 
+	if( num_char < 0 ) { 
+		G4cerr << "ERROR G4FRSCENEHANDLER::SendInt4Str(),1\n" ;
+	}
+	SendStr( command );
+	delete [] command ;
+}
+
+//----- 
+void 
+G4FRSCENEHANDLER::SendStrDouble6Str(	const char*	char_string1 ,
+						G4double	dval1  ,
+						G4double	dval2  ,
+						G4double	dval3  ,
+						G4double	dval4  ,
+						G4double	dval5  ,
+						G4double	dval6  ,
+						const char*	char_string2 )
+{
+		//----- make command char_string and send 
+	G4int	num_char ;
+	char*	command = new char [ COMMAND_BUF_SIZE ];
+
+	num_char  = sprintf(	command, "%s  %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g %s", \
+				char_string1,\
+				fPrec2, fPrec, dval1 , \
+				fPrec2, fPrec, dval2 , \
+				fPrec2, fPrec, dval3 , \
+				fPrec2, fPrec, dval4 , \
+				fPrec2, fPrec, dval5 , \
+				fPrec2, fPrec, dval6, \
+				char_string2              );
+	if( num_char < 0 ) { 
+		G4cerr << "ERROR G4FRSCENEHANDLER::SendStrDouble6Str(), 1\n" ;
+	}
+	SendStr( command );
+	delete [] command ;
+
+} 
+
+
+//----- 
+void G4FRSCENEHANDLER::SendInt( G4int		val    )
+{
+		//----- make command char_string and send 
+	G4int	num_char ;
+	char*	command = new char [ COMMAND_BUF_SIZE ];
+
+	num_char  = sprintf( command, "%d", val ) ; 
+	if( num_char < 0 ) { 
+		G4cerr << "ERROR G4FRSCENEHANDLER::SendStrInt(), 1\n" ;
+	}
+	SendStr( command );
+	delete [] command ;
+} // G4FRSCENEHANDLER::SendStrInt()
+
+
+//----- 
+void G4FRSCENEHANDLER::SendDouble( G4double	val    )
+{
+		//----- make command char_string and send 
+	G4int	num_char ;
+	char*	command = new char [ COMMAND_BUF_SIZE ];
+
+	num_char  = sprintf( command, "%*.*g", fPrec2, fPrec, val ) ; 
+	if( num_char < 0 ) { 
+		G4cerr << "ERROR G4FRSCENEHANDLER::SendStrInt(), 1\n" ;
+	}
+	SendStr( command );
+	delete [] command ;
+} // G4FRSCENEHANDLER::SendStrInt()
+
+//----- 
+void G4FRSCENEHANDLER::ClearTransientStore() 
+{
+  G4VSceneHandler::ClearTransientStore ();
+  // This is typically called after an update and before drawing hits
+  // of the next event.  To simulate the clearing of "transients"
+  // (hits, etc.) the detector is redrawn...
+  if (fpViewer) {
+    fpViewer -> SetView ();
+    fpViewer -> ClearView ();
+    fpViewer -> DrawView ();
+  }
+}
+
Index: tags/visualization-10.5-before-10.6_test/FukuiRenderer/include/G4FRofstream.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/FukuiRenderer/include/G4FRofstream.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/FukuiRenderer/include/G4FRofstream.hh	(revision 1102)
@@ -0,0 +1,126 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4FRofstream.hh,v 1.9 2006/06/29 21:16:42 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+#include <fstream>
+
+#if !defined G4_FR_OFSTREAM_HH
+#define      G4_FR_OFSTREAM_HH
+
+
+#include "globals.hh"
+
+/////////////////////
+//typedef int G4bool ;
+//#define false 0 ;
+//#define true  1 ;
+////////////////////
+
+class G4FRofstream {
+
+ public:
+	enum { SEND_BUFMAX = 1024 };
+
+ public: 
+	
+	// constructors
+	G4FRofstream ()                       { flag_file_open = false ; } 
+	G4FRofstream ( const char* filename ) ;
+
+	// destructor
+	virtual ~G4FRofstream ();
+
+	// open and close 
+	void Open ( const char* filename );
+	void Close() ;
+	G4bool IsOpen() { return flag_file_open ;}
+
+	// utilities
+	void SendLine( const char* string ) ; // save string with new line
+
+	// static functions
+	static G4bool DoesFileExist( const char* filename ) ;
+
+ protected:
+	G4bool flag_file_open ;
+	std::ofstream fout ;
+} ;
+
+
+inline  void G4FRofstream::Open ( const char* filename )
+{ 
+	if( !IsOpen() ) {
+		fout.open( filename ) ; 
+		flag_file_open = true ;
+	}
+}
+
+
+inline  void G4FRofstream::Close ()
+{ 
+	if( IsOpen() ) {
+		fout.close();
+		flag_file_open = false ;
+	}
+}
+
+inline  void    G4FRofstream::SendLine ( const char* message ) 
+{
+	if ( IsOpen() ) {
+		fout << message << G4endl;
+	}		
+}
+
+
+inline  G4bool  G4FRofstream::DoesFileExist ( const char* filename ) 
+{
+	G4bool status = false ;
+
+	std::ifstream fout_tmp( filename ) ; 
+	if( fout_tmp ) { status = true ; }
+	fout_tmp.close();
+
+	return status ;
+}
+
+
+inline 
+G4FRofstream::G4FRofstream ( const char* filename ) 
+{
+	flag_file_open = false ; 
+	Open( filename ); 
+} 
+
+inline 
+G4FRofstream::~G4FRofstream () 
+{
+	Close() ;
+} 
+
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/FukuiRenderer/include/G4FukuiRenderer.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/FukuiRenderer/include/G4FukuiRenderer.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/FukuiRenderer/include/G4FukuiRenderer.hh	(revision 1102)
@@ -0,0 +1,84 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4FukuiRenderer.hh,v 1.8 2006/06/29 21:16:44 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Satoshi TANAKA
+// Fukui Renderer factory.
+
+//=================//
+#if defined (G4VIS_BUILD_DAWN_DRIVER) || defined (G4VIS_USE_DAWN)
+//=================//
+
+#ifndef G4FUKUI_RENDERER_HH
+#define G4FUKUI_RENDERER_HH
+
+#include "G4VGraphicsSystem.hh"
+#include "G4FRClientServer.hh"
+
+	//----- prototype
+class G4VSceneHandler   ;
+
+	//---------------------------------//
+	//----- class G4FukuiRenderer -----// 
+	//---------------------------------//
+class G4FukuiRenderer: public G4VGraphicsSystem {
+
+public:
+  G4FukuiRenderer ();
+  virtual ~G4FukuiRenderer ();
+  G4VSceneHandler* CreateSceneHandler (const G4String& name = "");
+  G4VViewer*  CreateViewer  (G4VSceneHandler&, const G4String& name = "");
+
+  G4FRClientServer& GetPrimDest() { return fPrimDest ; }
+
+	//----- inter-process communication
+  enum { IP_UNIX, IP_INET };
+  enum { FR_MAX_PORT_INCR = 10 };
+  G4bool IsUnixDomain() const { return (fIPMode == G4FukuiRenderer::IP_UNIX); }
+  G4bool IsInetDomain() const { return (fIPMode == G4FukuiRenderer::IP_INET); }
+  void                  UseInetDomainAuto();
+  void                  UseInetDomain();
+  void                  UseBSDUnixDomainAuto();
+  void                  ConnectPort( int max_port_incr = FR_MAX_PORT_INCR);
+
+  G4bool	        IsGUIMode   (void) { return flag_use_gui   ; }
+  G4bool	        IsConnected (void) { return flag_connected ; }
+
+public:
+	//----- inter-process communication
+  G4FRClientServer  fPrimDest ;
+
+private:
+  int		fIPMode   ;
+  G4bool	flag_use_gui ;
+  G4int		flag_connected ;
+};
+
+#endif
+#endif //G4VIS_BUILD_DAWN_DRIVER
Index: tags/visualization-10.5-before-10.6_test/FukuiRenderer/include/G4FukuiRendererSceneHandler.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/FukuiRenderer/include/G4FukuiRendererSceneHandler.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/FukuiRenderer/include/G4FukuiRendererSceneHandler.hh	(revision 1102)
@@ -0,0 +1,255 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4FukuiRendererSceneHandler.hh,v 1.15 2006/06/29 21:16:46 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Satoshi TANAKA, Fri Jun 28 11:19:19 JST 1996
+
+
+//=================//
+#ifdef G4VIS_BUILD_DAWN_DRIVER
+//=================//
+
+
+#ifndef G4FUKUI_RENDERER_SCENE_HANDLER_HH
+#define G4FUKUI_RENDERER_SCENE_HANDLER_HH
+
+#include "globals.hh"
+
+#include "G4VSceneHandler.hh"
+
+#include "G4FRClientServer.hh"
+#include "G4FRConst.hh"
+
+class G4VisAttributes ;
+class G4FukuiRenderer;
+
+	//-----
+class G4FukuiRendererSceneHandler: public G4VSceneHandler {
+
+public:
+
+	//----- constructor and destructor
+  G4FukuiRendererSceneHandler (G4FukuiRenderer& system, const G4String& name = "");
+  virtual ~G4FukuiRendererSceneHandler ();
+
+	//----- overriding base class methods
+  void AddPrimitive (const G4Polyline& line);
+  void AddPrimitive (const G4Polyhedron& p);
+  void AddPrimitive (const G4NURBS& nurb);
+  void AddPrimitive (const G4Text&);
+  void AddPrimitive (const G4Circle&);
+  void AddPrimitive (const G4Square&);
+
+	//----- explicitly invoke base class methods to avoid warnings about
+        //----- hiding of base class methods.
+  void AddPrimitive (const G4Polymarker& polymarker) 
+       { G4VSceneHandler::AddPrimitive (polymarker); }
+  void AddPrimitive (const G4Scale& scale) 
+       { G4VSceneHandler::AddPrimitive (scale); }
+
+  virtual void BeginModeling () { G4VSceneHandler::BeginModeling ();} 
+  virtual void EndModeling   () { G4VSceneHandler::EndModeling   ();}
+
+  virtual void BeginPrimitives (const G4Transform3D& objectTransformation);
+  virtual void EndPrimitives ();
+
+  void AddSolid ( const G4Box&    box    );
+  void AddSolid ( const G4Cons&   cons   );
+  void AddSolid ( const G4Tubs&   tubs   );
+  void AddSolid ( const G4Trd&    trd    );
+  void AddSolid ( const G4Trap&   trap   );
+  void AddSolid ( const G4Sphere& sphere );
+  void AddSolid ( const G4Para&   para   );
+  void AddSolid ( const G4Torus&  torus  );
+  void AddSolid ( const G4Polycone& polycone) {
+    G4VSceneHandler::AddSolid (polycone);
+  }
+  void AddSolid ( const G4Polyhedra& polyhedra) {
+    G4VSceneHandler::AddSolid (polyhedra);
+  }
+  void AddSolid ( const G4VSolid& solid  );
+  void AddCompound ( const G4VTrajectory& traj) {
+    G4VSceneHandler::AddCompound(traj);
+  }
+  void AddCompound ( const G4VHit& hit) {
+    G4VSceneHandler::AddCompound(hit);
+  }
+
+  void ClearTransientStore();  // Used for triggering detector re-drawing.
+
+	//----- methods inherent to this class
+  void         FRBeginModeling () ;
+  void         FREndModeling   () ;
+  G4bool       FRIsInModeling    () { return FRflag_in_modeling ; }
+
+  G4bool IsSavingG4Prim   ( void ) { return flag_saving_g4_prim ;	}
+  void   BeginSavingG4Prim( void ) 
+	{
+		if( !IsSavingG4Prim() ) 
+		{ 
+			SendStr( FR_SAVE )    ; 
+			SendStr( FR_G4_PRIM_HEADER   )    ; 
+			flag_saving_g4_prim = true  ; 
+		} 
+	}
+  void   EndSavingG4Prim  ( void ) 
+         { if(  IsSavingG4Prim() ) { SendStr( FR_END_SAVE ); flag_saving_g4_prim = false ; } }
+
+  G4FRClientServer& GetPrimDest () { return fPrimDest ; }
+  G4FukuiRenderer&  GetSystem   () { return fSystem   ; }
+  void              SendBoundingBox   ( void );
+
+private:
+
+	//----- Utilities etc
+  G4bool    SendVisAttributes ( const G4VisAttributes*  pAV );
+  G4bool    IsVisible     ( void ) ;
+  void	    SendTransformedCoordinates( void ) ;
+  void	    SendPhysVolName           ( void ) ;
+  void	    SendNdiv                  ( void ) ;
+
+public:
+
+  void	 SendStr   (	const char*	char_string ) ;
+  void	 SendStrInt(	const char*	char_string ,
+			G4int		ival    );
+  void	 SendStrInt3(	const char*	char_string ,
+			G4int		ival1  ,
+			G4int		ival2  ,
+			G4int		ival3   );
+  void	 SendStrInt4(	const char*	char_string ,
+			G4int		ival1  ,
+			G4int		ival2  ,
+			G4int		ival3  ,
+			G4int		ival4   );
+  void   SendStrDouble(	const char*	char_string ,
+			G4double	dval   );
+  void	 SendStrDouble2(	const char*	char_string ,
+				G4double	dval1  ,
+				G4double	dval2  );
+  void	 SendStrDouble3(	const char*	char_string ,
+				G4double	dval1  ,
+				G4double	dval2  ,
+				G4double	dval3   );
+
+  void	 SendStrDouble4(	const char*	char_string ,
+				G4double	dval1  ,
+				G4double	dval2  ,
+				G4double	dval3  ,
+				G4double	dval4  );
+
+  void	 SendStrDouble5(	const char*	char_string ,
+				G4double	dval1  ,
+				G4double	dval2  ,
+				G4double	dval3  ,
+				G4double	dval4  ,
+				G4double	dval5  );
+
+  void	 SendStrDouble6(	const char*	char_string ,
+				G4double	dval1  ,
+				G4double	dval2  ,
+				G4double	dval3  ,
+				G4double	dval4  ,
+				G4double	dval5  ,
+				G4double	dval6   );
+
+  void   SendStrDouble7(	const char*	char_string ,
+				G4double	dval1  ,
+				G4double	dval2  ,
+				G4double	dval3  ,
+				G4double	dval4  ,
+				G4double	dval5  ,
+				G4double	dval6  ,
+				G4double	dval7   );
+
+  void	SendStrDouble11(	const char*	char_string ,
+				G4double	dval1  ,
+				G4double	dval2  ,
+				G4double	dval3  ,
+				G4double	dval4  ,
+				G4double	dval5  ,
+				G4double	dval6  ,
+				G4double	dval7  ,
+				G4double	dval8  ,
+				G4double	dval9  ,
+				G4double	dval10  ,
+				G4double	dval11   ) ;
+
+  void	 SendIntDouble3(	G4int		ival   ,
+				G4double	dval1  ,
+				G4double	dval2  ,
+				G4double	dval3  );
+  void   SendInt3Str(	G4int		ival1  ,
+			G4int		ival2  ,
+			G4int		ival3  ,
+			const char*	char_string );
+  void   SendInt4Str(	G4int		ival1  ,
+			G4int		ival2  ,
+			G4int		ival3  ,
+			G4int		ival4  ,
+			const char*	char_string );
+
+  void	SendStrDouble6Str(	const char*	char_string1 ,
+				G4double	dval1  ,
+				G4double	dval2  ,
+				G4double	dval3  ,
+				G4double	dval4  ,
+				G4double	dval5  ,
+				G4double	dval6  ,
+				const char*	char_string2 );
+
+  void	SendInt   (	G4int 		val );
+  void	SendDouble(	G4double 	val );
+
+
+
+private:
+  G4FukuiRenderer& fSystem;     // Graphics system for this scene.
+  static G4int	fSceneIdCount;
+
+  G4FRClientServer&	fPrimDest    ;  // defined in G4FukuiRenderer
+  G4bool		FRflag_in_modeling ;	
+		// true:  FR_BEGIN_MODELING has sent to DAWN, and
+		//        FR_END_MODELING   has not sent yet.
+		// false:  otherwise
+		// 
+		// FRflag_in_modeling is set to "true"
+		// in FRBeginModeling(), and to "false" 
+		// in FREndModeling().
+
+  G4bool		flag_saving_g4_prim ;	
+
+  const int		COMMAND_BUF_SIZE    ;
+
+  G4int                 fPrec, fPrec2 ;
+
+};
+
+#endif
+#endif //G4VIS_BUILD_DAWN_DRIVER
Index: tags/visualization-10.5-before-10.6_test/FukuiRenderer/include/G4FukuiRendererViewer.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/FukuiRenderer/include/G4FukuiRendererViewer.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/FukuiRenderer/include/G4FukuiRendererViewer.hh	(revision 1102)
@@ -0,0 +1,77 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4FukuiRendererViewer.hh,v 1.8 2006/06/29 21:16:48 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Satoshi TANAKA, Fri Jun 28 12:10:14 JST 1996
+// FukuiRenderer viewer - opens window, hard copy, etc.
+
+//=================//
+#ifdef G4VIS_BUILD_DAWN_DRIVER
+//=================//
+
+
+#ifndef G4FUKUI_RENDERER_VIEWER_HH
+#define G4FUKUI_RENDERER_VIEWER_HH
+
+#include "G4VViewer.hh"
+#include "globals.hh"
+
+class G4FukuiRendererSceneHandler ;
+
+
+class G4FukuiRendererViewer: public G4VViewer {
+
+public:
+
+	enum FRDEV {FRDEV_PS=1, FRDEV_XWIN=2, FRDEV_PS2=3, FRDEV_XWIN2=4, FRDEV_OPEN_GL=5, FRDEV_DEVICE_END=6} ;
+
+	//----- constructor and destructor
+  G4FukuiRendererViewer  (G4FukuiRendererSceneHandler& scene, const G4String& name);
+  virtual ~G4FukuiRendererViewer ();
+
+	//----- overriding base class methods
+  void SetView   (); // Do nothing. SendViewParameters will do its job. 
+  void ClearView ();
+  void DrawView  ();
+  void ShowView  ();
+
+	//---- methods inherent to this class
+  void Wait() ;
+  void SendViewParameters ()  ;
+
+  void  SendDevice( FRDEV dev );
+  void  SendDrawingStyle() ; 
+
+private:
+
+  G4FukuiRendererSceneHandler& fSceneHandler; // Reference to Graphics Scene for this view.
+};
+
+#endif
+#endif //G4VIS_BUILD_DAWN_DRIVER
Index: tags/visualization-10.5-before-10.6_test/FukuiRenderer/src/G4DAWNFILE.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/FukuiRenderer/src/G4DAWNFILE.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/FukuiRenderer/src/G4DAWNFILE.cc	(revision 1102)
@@ -0,0 +1,75 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4DAWNFILE.cc,v 1.11 2006/06/29 21:16:50 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// Satoshi TANAKA
+// DAWNFILE factory.
+
+
+//#define DEBUG_FR_SYSTEM
+
+
+#include "G4DAWNFILE.hh"
+
+#define __G_ANSI_C__
+
+//#include "G4VisFeaturesOfDAWNFILE.hh"
+#include "G4FRFeatures.hh" 
+#include "G4VSceneHandler.hh"
+#include "G4DAWNFILESceneHandler.hh"
+#include "G4DAWNFILEViewer.hh"
+#include "G4FRConst.hh"
+
+
+	//----- G4DAWNFILE, constructor
+G4DAWNFILE::G4DAWNFILE ():
+  G4VGraphicsSystem ("DAWNFILE",
+		     "DAWNFILE",
+		     FR_DAWNFILE_FEATURES,
+		     G4VGraphicsSystem::threeD)
+{}
+
+	//----- G4DAWNFILE, destructor
+G4DAWNFILE::~G4DAWNFILE () 
+{}
+
+
+	//-----  G4DAWNFILE::CreateSceneHandler (const G4String& name) 
+G4VSceneHandler* G4DAWNFILE::CreateSceneHandler (const G4String& name) 
+{
+	G4VSceneHandler* p = new G4DAWNFILESceneHandler (*this, name);
+	return p;
+}
+
+	//-----  G4DAWNFILE::CreateViewer ()
+G4VViewer* G4DAWNFILE::CreateViewer (G4VSceneHandler& scene, const G4String& name) 
+{
+       	G4VViewer* pView = 
+	  new G4DAWNFILEViewer ((G4DAWNFILESceneHandler&) scene, name);
+	return pView;
+}
Index: tags/visualization-10.5-before-10.6_test/FukuiRenderer/src/G4DAWNFILESceneHandler.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/FukuiRenderer/src/G4DAWNFILESceneHandler.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/FukuiRenderer/src/G4DAWNFILESceneHandler.cc	(revision 1102)
@@ -0,0 +1,295 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4DAWNFILESceneHandler.cc,v 1.18 2006/06/29 21:16:52 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// Satoshi TANAKA
+// DAWNFILE scene.
+
+
+#define __G_ANSI_C__
+
+// #define DEBUG_FR_SCENE
+
+     //----- header files
+#include <fstream>
+#include <stdlib.h>
+#include <string.h>
+#include "globals.hh"
+#include "G4FRConst.hh"
+#include "G4DAWNFILE.hh"
+#include "G4DAWNFILESceneHandler.hh"
+#include "G4DAWNFILEViewer.hh"
+#include "G4Point3D.hh"
+#include "G4VisAttributes.hh"
+#include "G4Scene.hh"
+#include "G4Transform3D.hh"
+#include "G4Polyhedron.hh"
+#include "G4Box.hh"
+#include "G4Cons.hh"
+#include "G4Polyline.hh"
+#include "G4Trd.hh"
+#include "G4Tubs.hh"
+#include "G4Trap.hh"
+#include "G4Torus.hh"
+#include "G4Sphere.hh"
+#include "G4Para.hh"
+#include "G4Text.hh"
+#include "G4Circle.hh"
+#include "G4Square.hh"
+#include "G4VPhysicalVolume.hh"
+
+//----- constants
+const char  FR_ENV_CULL_INVISIBLE_OBJECTS [] = "G4DAWN_CULL_INVISIBLE_OBJECTS";
+const char  G4PRIM_FILE_HEADER      [] = "g4_";
+const char  DEFAULT_G4PRIM_FILE_NAME[] = "g4_00.prim";
+
+// const int   FR_MAX_FILE_NUM = 1 ;
+// const int   FR_MAX_FILE_NUM = 5 ;
+// const int   FR_MAX_FILE_NUM = 10 ;
+// const int   FR_MAX_FILE_NUM = 15 ;
+// const int   FR_MAX_FILE_NUM = 20 ;
+   const int   FR_MAX_FILE_NUM = 100 ;
+
+
+///////////////////////////
+// Driver-dependent part //
+///////////////////////////
+
+
+	//----- G4DAWNFILESceneHandler, constructor
+G4DAWNFILESceneHandler::G4DAWNFILESceneHandler (G4DAWNFILE& system, const G4String& name):
+G4VSceneHandler  (system, fSceneIdCount++, name) ,
+fSystem   (system)                        ,
+fPrimDest ()                              ,
+FRflag_in_modeling     (false)            ,
+flag_saving_g4_prim    (false)            ,
+COMMAND_BUF_SIZE       (G4FRofstream::SEND_BUFMAX),
+fPrec (9), fPrec2 (16)
+{
+	// g4.prim filename and its directory
+	if ( getenv( "G4DAWNFILE_DEST_DIR" ) == NULL ) {
+		strcpy( fG4PrimDestDir , "" )                      ;  // output dir
+		strcpy( fG4PrimFileName, DEFAULT_G4PRIM_FILE_NAME );  // filename
+	} else {
+		strcpy( fG4PrimDestDir , getenv( "G4DAWNFILE_DEST_DIR" ) ); // output dir
+		strcpy( fG4PrimFileName, DEFAULT_G4PRIM_FILE_NAME        ); // filename 
+	}
+		
+	// maximum number of g4.prim files in the dest directory
+	fMaxFileNum = FR_MAX_FILE_NUM ; // initialization
+	if ( getenv( "G4DAWNFILE_MAX_FILE_NUM" ) != NULL ) {	
+		
+		sscanf( getenv("G4DAWNFILE_MAX_FILE_NUM"), "%d", &fMaxFileNum ) ;
+
+	} else {
+		fMaxFileNum = FR_MAX_FILE_NUM ;
+	}
+	if( fMaxFileNum < 1 ) { fMaxFileNum = 1 ; }
+
+
+		//----- precision control
+	if( getenv( "G4DAWNFILE_PRECISION" ) != NULL ) {
+		sscanf( getenv("G4DAWNFILE_PRECISION"), "%d", &fPrec ) ;
+	} else {
+                fPrec = 9 ;
+	}
+	fPrec2 = fPrec + 7 ;
+
+} 
+
+
+	//----- G4DAWNFILESceneHandler, destructor
+G4DAWNFILESceneHandler::~G4DAWNFILESceneHandler () 
+{
+#if defined DEBUG_FR_SCENE
+	G4cerr << "***** ~G4DAWNFILESceneHandler" << G4endl;
+#endif 
+	if (fPrimDest.IsOpen()) 
+	  {
+			//----- End of modeling
+			// !EndModeling, !DrawAll, !CloseDevice,
+			// close g4.prim
+		FREndModeling();
+	}
+  ClearStore (); // clear current scene
+}
+
+//-----
+void	G4DAWNFILESceneHandler::SetG4PrimFileName() 
+{
+	// g4_00.prim, g4_01.prim, ..., g4_MAX_FILE_INDEX.prim
+	const int MAX_FILE_INDEX = fMaxFileNum - 1 ;
+
+	// dest directory (null if no environmental variables is set)
+	strcpy ( fG4PrimFileName, fG4PrimDestDir) ; 
+
+	// create full path name (default)
+	strcat ( fG4PrimFileName, DEFAULT_G4PRIM_FILE_NAME );
+
+	// Automatic updation of file names
+	for( int i = 0 ; i < fMaxFileNum ; i++) { 
+
+		// Message in the final execution
+		if( i == MAX_FILE_INDEX ) 
+		{
+		  G4cerr << "==========================================="   << G4endl; 
+		  G4cerr << "WARNING MESSAGE from DAWNFILE driver:      "   << G4endl;
+		  G4cerr << "  This file name is the final one in the   "   << G4endl;
+		  G4cerr << "  automatic updation of the output file name." << G4endl; 
+		  G4cerr << "  You may overwrite existing files, i.e.   "   << G4endl; 
+                  G4cerr << "  g4_XX.prim and g4_XX.eps                 "   << G4endl;
+		  G4cerr << "==========================================="   << G4endl; 
+		}
+
+		// re-determine file name as G4DAWNFILE_DEST_DIR/g4_XX.prim 
+		if( i >=  0 && i <= 9 ) { 
+			sprintf( fG4PrimFileName, "%s%s%s%d.prim" , fG4PrimDestDir,  G4PRIM_FILE_HEADER, "0", i );
+		} else {
+			sprintf( fG4PrimFileName, "%s%s%d.prim" , fG4PrimDestDir,  G4PRIM_FILE_HEADER, i );
+		}
+
+		// check validity of the file name
+		std::ifstream  fin ; 
+		fin.open(fG4PrimFileName) ;
+		if(!fin) { 
+			// new file	
+			fin.close();  
+			break; 
+		} else { 
+			// already exists (try next) 
+			fin.close(); 
+		} 
+
+	} // for 
+
+	G4cerr << "===========================================    " << G4endl; 
+	G4cerr << "Output file: " <<    fG4PrimFileName             << G4endl; 
+	G4cerr << "Destination directory (current dir if NULL): "       << fG4PrimDestDir    << G4endl; 
+	G4cerr << "Maximal number of files in the destination directory: " << fMaxFileNum << G4endl; 
+	G4cerr << "Note:                                                " << G4endl; 
+	G4cerr << "  * The maximal number is customizable as:           " << G4endl;
+	G4cerr << "       % setenv  G4DAWNFILE_MAX_FILE_NUM  number " << G4endl;        
+	G4cerr << "  * The destination directory is customizable as:" << G4endl;
+	G4cerr << "       % setenv  G4DAWNFILE_DEST_DIR  dir_name/  " << G4endl;        
+	G4cerr << "     ** Do not forget \"/\" at the end of the    " << G4endl;              
+	G4cerr << "        dir_name, e.g. \"./tmp/\".  " << G4endl;              
+	G4cerr << "===========================================      " << G4endl; 
+
+} // G4DAWNFILESceneHandler::SetG4PrimFileName()
+
+
+//-----
+void	G4DAWNFILESceneHandler::BeginSavingG4Prim( void ) 
+{
+#if defined DEBUG_FR_SCENE
+	G4cerr << "***** BeginSavingG4Prim (called)\n";
+#endif
+
+	if( !IsSavingG4Prim() ) 
+	{ 
+#if defined DEBUG_FR_SCENE
+	        G4cerr << "*****                   (started) " ;
+	        G4cerr << "(open g4.prim, ##)"  << G4endl;
+#endif
+		SetG4PrimFileName() ; // result set to fG4PrimFileName
+		fPrimDest.Open(fG4PrimFileName)   ;
+
+		SendStr( FR_G4_PRIM_HEADER   )    ; 
+		flag_saving_g4_prim = true        ; 
+	} 
+}
+
+void	G4DAWNFILESceneHandler::EndSavingG4Prim  ( void ) 
+{
+#if defined DEBUG_FR_SCENE
+	G4cerr << "***** EndSavingG4Prim (called)\n";
+#endif
+
+	if(  IsSavingG4Prim() )
+	{
+#if defined DEBUG_FR_SCENE
+          G4cerr << "*****                 (started) (close g4.prim)" << G4endl;
+#endif
+		fPrimDest.Close()               ;
+		flag_saving_g4_prim = false ; 
+	} 
+}
+
+
+//----- 
+void G4DAWNFILESceneHandler::FRBeginModeling( void )
+{
+	if( !FRIsInModeling() )  	
+	{
+#if defined DEBUG_FR_SCENE
+	  G4cerr << "***** G4DAWNFILESceneHandler::FRBeginModeling (called & started)" << G4endl;
+#endif
+
+			//----- Send saving command and heading comment
+		BeginSavingG4Prim();
+
+			//----- Send bounding box command
+		SendBoundingBox();
+
+			//----- send SET_CAMERA command 
+#if defined DEBUG_FR_SCENE
+		G4cerr << "*****   (!SetCamera in FRBeginModeling())" << G4endl;
+#endif
+		SendStr( FR_SET_CAMERA );
+
+		//----- open device
+#if defined DEBUG_FR_SCENE
+		G4cerr << "*****   (!OpenDevice in FRBeginModeling())" << G4endl;
+#endif
+		SendStr( FR_OPEN_DEVICE      );
+
+		//----- begin sending primitives
+#if defined DEBUG_FR_SCENE
+		G4cerr << "*****   (!BeginModeling in FRBeginModeling())" << G4endl;
+#endif
+		SendStr( FR_BEGIN_MODELING );  FRflag_in_modeling = true ;
+
+	} // if
+
+} 
+
+
+/////////////////////////////////////////
+// Common to DAWN and DAWNFILE drivers //
+/////////////////////////////////////////
+
+#define  G4FRSCENEHANDLER  G4DAWNFILESceneHandler
+#include "G4FRSceneFunc.icc"
+#undef   G4FRSCENEHANDLER 
+
+//////////////////////
+// static variables //
+//////////////////////
+
+	//----- static variables
+G4int G4DAWNFILESceneHandler::fSceneIdCount = 0; 
Index: tags/visualization-10.5-before-10.6_test/FukuiRenderer/src/G4DAWNFILEViewer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/FukuiRenderer/src/G4DAWNFILEViewer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/FukuiRenderer/src/G4DAWNFILEViewer.cc	(revision 1102)
@@ -0,0 +1,366 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4DAWNFILEViewer.cc,v 1.20 2006/06/29 21:16:54 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// Satoshi TANAKA
+// DAWNFILE view - opens window, hard copy, etc.
+
+
+#define __G_ANSI_C__
+#define G4DAWNFILE_STRUCTURE_PRIORITY  1.
+
+// #define DEBUG_FR_VIEW
+
+#include "G4ios.hh"
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+#include "G4Scene.hh"
+#include "G4Vector3D.hh"
+#include "G4VisExtent.hh"
+#include "G4LogicalVolume.hh"
+#include "G4VSolid.hh"
+
+#include "G4FRConst.hh"
+#include "G4DAWNFILE.hh"
+#include "G4DAWNFILESceneHandler.hh"
+#include "G4DAWNFILEViewer.hh"
+
+
+
+	//----- constants
+const char  FR_ENV_MULTI_WINDOW [] = "G4DAWN_MULTI_WINDOW" ;
+const char  FR_ENV_MULTI_WINDOW2[] = "G4DAWNFILE_MULTI_WINDOW" ;
+
+	//----- G4DAWNFILEViewer, constructor
+G4DAWNFILEViewer::G4DAWNFILEViewer (G4DAWNFILESceneHandler& sceneHandler,
+				const G4String& name): 
+  G4VViewer (sceneHandler,
+	     sceneHandler.IncrementViewCount (),
+	     name),
+  fSceneHandler (sceneHandler)
+{
+	// Set a g4.prim-file viewer 
+	strcpy( fG4PrimViewer, "dawn" ); 
+	if( getenv( "G4DAWNFILE_VIEWER" ) != NULL ) {
+		strcpy( fG4PrimViewer, getenv( "G4DAWNFILE_VIEWER" ) ) ;			
+	} 
+
+	// string for viewer invocation
+	if ( !strcmp( fG4PrimViewer, "NONE" ) ) {
+		
+		strcpy( fG4PrimViewerInvocation, "" );
+	} else {
+
+		strcpy( fG4PrimViewerInvocation, fG4PrimViewer );
+		strcat( fG4PrimViewerInvocation, " ");
+		strcat( fG4PrimViewerInvocation, fSceneHandler.GetG4PrimFileName() );
+	}
+
+	// Set a PostScript Viewer
+//	strcpy( fPSViewer, "ghostview" ); 
+	strcpy( fPSViewer, "gv" ); 
+	if( getenv( "G4DAWNFILE_PS_VIEWER" ) != NULL ) {
+		strcpy( fPSViewer, getenv( "G4DAWNFILE_PS_VIEWER" ) ) ;			
+	} 
+
+}
+
+	//----- G4DAWNFILEViewer, destructor
+G4DAWNFILEViewer::~G4DAWNFILEViewer () 
+{}
+
+	//----- G4DAWNFILEViewer::SetView () 
+void G4DAWNFILEViewer::SetView () 
+{
+#if defined DEBUG_FR_VIEW
+  G4cerr << "***** G4DAWNFILEViewer::SetView(): No effects" << G4endl;
+#endif 
+// Do nothing, since DAWN is running as a different process.
+// SendViewParameters () will do this job instead.
+}
+
+
+	//----- G4DAWNFILEViewer::ClearView()
+void
+G4DAWNFILEViewer::ClearView( void )
+{
+#if defined DEBUG_FR_VIEW
+	G4cerr << "***** G4DAWNFILEViewer::ClearView (): No effects " << G4endl;
+#endif
+	if (fSceneHandler.fPrimDest.IsOpen()) {
+	  fSceneHandler.fPrimDest.Close();
+	  // Re-open with same filename...
+	  fSceneHandler.fPrimDest.Open(fSceneHandler.fG4PrimFileName);
+	  fSceneHandler.SendStr( FR_G4_PRIM_HEADER );
+	  fSceneHandler.FRflag_in_modeling = false;
+	  fSceneHandler.FRBeginModeling();
+	}
+}
+
+
+	//----- G4DAWNFILEViewer::DrawView () 
+void G4DAWNFILEViewer::DrawView () 
+{
+#if defined DEBUG_FR_VIEW
+	G4cerr << "***** G4DAWNFILEViewer::DrawView () " << G4endl;
+#endif
+		//----- 
+	fSceneHandler.FRBeginModeling() ;
+
+		//----- Always visit G4 kernel 
+	NeedKernelVisit ();
+	                           
+		//----- Draw
+	ProcessView () ;
+
+} // G4DAWNFILEViewer::DrawView () 
+
+
+
+	//----- G4DAWNFILEViewer::ShowView()
+void G4DAWNFILEViewer::ShowView( void )
+{
+#if defined DEBUG_FR_VIEW
+	G4cerr << "***** G4DAWNFILEViewer::ShowView () " << G4endl;
+#endif
+
+	if( fSceneHandler.FRIsInModeling() ) 
+	{
+			//----- End of modeling
+			// !EndModeling, !DrawAll, !CloseDevice,
+			// close g4.prim
+		fSceneHandler.FREndModeling();
+
+			//----- Output DAWN GUI file 
+		SendViewParameters(); 
+
+			//----- string for viewer invocation
+		if ( !strcmp( fG4PrimViewer, "NONE" ) ) {
+		
+			strcpy( fG4PrimViewerInvocation, "" );
+		} else {
+
+			strcpy( fG4PrimViewerInvocation, fG4PrimViewer );
+			strcat( fG4PrimViewerInvocation, " ");
+			strcat( fG4PrimViewerInvocation, fSceneHandler.GetG4PrimFileName() );
+		}
+
+
+		//----- Invoke DAWN
+		G4cout << G4endl ;
+		if( false == G4FRofstream::DoesFileExist( fSceneHandler.GetG4PrimFileName() ) )   
+		{
+			G4cout << "ERROR: Failed to generate file  ";
+			G4cout << fSceneHandler.GetG4PrimFileName() << G4endl;
+
+		} else 	if( strcmp( GetG4PrimViewerInvocation(), "" ) )  
+		{
+			G4cout << "File  " << fSceneHandler.GetG4PrimFileName() ;
+			G4cout << "  is generated." << G4endl;
+			G4cout << GetG4PrimViewerInvocation() << G4endl;
+			system( GetG4PrimViewerInvocation() );
+
+		} else { // no view, i.e., only file generation
+			G4cout << "File  " << fSceneHandler.GetG4PrimFileName() ; 
+			G4cout << "  is generated." << G4endl;
+			G4cout << "No viewer is invoked." << G4endl;
+		}
+
+	}
+
+} // G4DAWNFILEViewer::ShowView()
+
+
+	//----- G4DAWNFILEViewer::SendDrawingStyleToDAWNGUI( std::ostream& out ) 
+void  G4DAWNFILEViewer::SendDrawingStyleToDAWNGUI( std::ostream& out ) 
+{
+///////////////////////
+//#if defined DEBUG_FR_VIEW
+//  G4cerr << "***** G4DAWNFILEViewer::SendDrawingStyleToDAWNGUI()" << G4endl;
+//#endif
+//////////////////////
+
+	G4int  style = fVP.GetDrawingStyle();
+
+	enum {	FR_WIREFRAME = 1, FR_WF_STORED = 2, FR_HID =3  , \
+		FR_HID2      = 4, FR_HID3      = 5, FR_DRAWING_MODE_END = 6 };
+
+	switch( style )
+	{
+	  case G4ViewParameters::wireframe: 
+		out <<  FR_WIREFRAME << G4endl;
+		break;
+	  case G4ViewParameters::hlr:
+		out <<  FR_HID2      << G4endl; // LINE
+		break;
+	  case G4ViewParameters::hsr:
+	  case G4ViewParameters::hlhsr:
+		out <<  FR_HID       << G4endl; // SURFACE
+		break;
+	  default:
+		out <<  FR_WIREFRAME << G4endl;
+		break;
+	}
+
+} // G4DAWNFILEViewer::SendDrawingStyle()  
+
+
+
+//----- 
+void G4DAWNFILEViewer::SendViewParameters () 
+{
+  // Calculates view representation based on extent of object being
+  // viewed and (initial) direction of camera.  (Note: it can change
+  // later due to user interaction via visualization system's GUI.)
+
+#if defined DEBUG_FR_VIEW
+  G4cerr << "***** G4DAWNFILEViewer::SendViewParameters()  "; 
+  G4cerr << "(GUI parameters)" << G4endl;
+#endif 
+
+		//----- Magic number to decide camera distance automatically
+	const    G4double        HOW_FAR            = 1000.0       ; // to define "infinity"
+	const    G4double        MIN_HALF_ANGLE     = 0.01         ;
+	const    G4double        MAX_HALF_ANGLE     = 0.499 * pi ;
+
+		//----- CALC camera distance
+		//..... Note: Camera cannot enter inside object
+	G4double  camera_distance ;
+	G4double  radius = fSceneHandler.GetScene()->GetExtent().GetExtentRadius();
+
+	G4double half_view_angle  = std::fabs ( fVP.GetFieldHalfAngle () ) ;
+	if( half_view_angle > MAX_HALF_ANGLE ) { 
+	  half_view_angle = MAX_HALF_ANGLE ; 
+	} 
+
+	if( half_view_angle < MIN_HALF_ANGLE ) {
+			//----- infinity (or ortho projection)
+		camera_distance = radius * HOW_FAR ;  
+	} else {
+			//----- Calc camera distance from half view angle
+		camera_distance = radius / std::sin ( half_view_angle );
+		camera_distance -= fVP.GetDolly();
+	}
+
+	if ( camera_distance < radius ) { 
+		G4cerr << "WARNING from DAWNFILE driver:" << G4endl;
+		G4cerr << "  Camera cannot enter inside objects"      << G4endl;
+		camera_distance = radius ; 
+	}
+
+		//----- CALC camera direction
+	const G4Vector3D& camera_direction \
+	  = fVP.GetViewpointDirection().unit();
+	const G4double v_angle =  (180.0 / pi) * camera_direction.theta() ;
+	const G4double h_angle =  (180.0 / pi) * camera_direction.phi  () ;
+
+
+	//########### Generation of the file .DAWN.history for DAWN GUI
+		//-----
+	std::ofstream gui_out (".DAWN_1.history") ; 
+
+	// ######### P1 
+
+		//----- camera position
+	gui_out << camera_distance << G4endl;
+	gui_out << v_angle  << G4endl ;
+        gui_out << h_angle  << G4endl ;
+        gui_out << "0"  << G4endl     ; // auto target
+
+		//----- target point 
+	const G4Point3D&  target_point
+	  = fSceneHandler.GetScene()->GetStandardTargetPoint()
+	  + fVP.GetCurrentTargetPoint();
+	gui_out << target_point.x()          << G4endl ;
+	gui_out << target_point.y()          << G4endl ;
+	gui_out << target_point.z()          << G4endl ;
+
+		//----- Magnification
+	const G4double   zoom_factor  = fVP.GetZoomFactor();
+	if( half_view_angle < MIN_HALF_ANGLE ) {
+
+		gui_out << zoom_factor << G4endl;
+
+	} else {
+		const G4double FR_HALF_SCREEN_SIZE = 0.5 ;
+		G4double  focal_distance \
+		  = FR_HALF_SCREEN_SIZE / std::tan( half_view_angle ); 
+		focal_distance *= zoom_factor ;
+
+		gui_out << "fd" << focal_distance << G4endl;
+
+	}
+	SendDrawingStyleToDAWNGUI( gui_out ) ; // gui_out, viewing mode
+	gui_out << "0.001" << G4endl           ; // 3D Tolerance 
+	gui_out << "0"     << G4endl           ; // not display parameters
+
+
+	// ######### P2
+	gui_out << 1 << G4endl;   // Source light 
+	gui_out << 1 << G4endl;   
+	gui_out << 1 << G4endl;   
+	gui_out << 0.5 << G4endl; // Ambient light
+	gui_out << 0.5 << G4endl;
+	gui_out << 0.5 << G4endl;
+	gui_out << 19.0 << G4endl; // Light direction (Polar)
+	gui_out << 71.0 << G4endl; // Light direction (Azimuthal)
+
+	// ######### P3
+	gui_out << 0.1 << G4endl;    // Real edge width
+	gui_out << 0.1 << G4endl;    // outline   width
+	gui_out << 0.1 << G4endl;    // aux edge  width
+	gui_out << 3   << G4endl;      // aux edge  style
+	gui_out << 70.0<< G4endl;   // aux-edge threshold angle
+	gui_out << 0.1 << G4endl;       // line width
+	gui_out << 0   << G4endl;        // haloing
+	gui_out << 1   << G4endl;        // Dashed edged for back faces
+
+	//######### P4
+               //----- drawing device
+  //	enum {PS=1, XWIN=2, PS2=3, XWIN2=4, OPEN_GL=5, DEVICE_END=6};
+        if( ( ( getenv( FR_ENV_MULTI_WINDOW ) != NULL        ) && \
+              ( strcmp( getenv( FR_ENV_MULTI_WINDOW ),"0"  ) )       ) || \
+            ( ( getenv( FR_ENV_MULTI_WINDOW2 ) != NULL        ) && \
+              ( strcmp( getenv( FR_ENV_MULTI_WINDOW2 ),"0"  ) )      )     )
+        {
+                gui_out << 2 << G4endl; // OpenWindow
+        } else {
+                gui_out << 1 << G4endl; // Invoke PS viewer
+        }
+
+	gui_out << GetPSViewer() << G4endl; // PS viewer
+	gui_out << 1 << G4endl            ; // Do not add showpage 
+	gui_out << 0 << G4endl            ; // Non-append mode
+
+	gui_out.close();
+	//########### end of generating file .DAWN.history 
+
+
+} 
Index: tags/visualization-10.5-before-10.6_test/FukuiRenderer/src/G4FRClientServer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/FukuiRenderer/src/G4FRClientServer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/FukuiRenderer/src/G4FRClientServer.cc	(revision 1102)
@@ -0,0 +1,319 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4FRClientServer.cc,v 1.6 2006/06/29 21:16:56 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// Satoshi TANAKA, Wed Jul  3 14:14:29 JST 1996
+////////////////////////////////
+///// G4FRClientServer.cc /////
+////////////////////////////////
+
+
+//=================//
+#ifdef G4VIS_BUILD_DAWN_DRIVER
+//=================//
+
+#include "G4FRClientServer.hh"
+
+// #define DEBUG_CLIENT_SERVER
+
+#include<sys/param.h>
+
+	//----- const 	
+const  char	DEFAULT_SUN_PATH[]		= "FR_TMP3"        ;
+const  int	DEFAULT_PORT_NUMBER		= 40701            ;
+//const  char	FR_ENV_SERVER_HOST_NAME[]	= "G4DAWN_HOST_NAME" ; // moved to .hh
+const  int	MAX_BINDING_TRIAL		= 10               ;
+const  int	BINDING_TRIAL_INTERVAL		= 5                ;
+const  int	MAX_CONNECT_TRIAL		= 10               ;
+const  char     FR_DEFAULT_HOST_NAME[]          = "localhost"      ;      
+
+	//----- G4FRClientServer::G4FRClientServer ()
+G4FRClientServer::G4FRClientServer ( char terminator , char end_line ) :  
+	TERMINATOR ( terminator ) , 
+	END_OF_LINE( end_line   ) ,
+	fSocketFd  ( -1 )           
+{ 
+	SetSunPath    ( DEFAULT_SUN_PATH ) ; // for Unix domain
+	SetPortNumber ( DEFAULT_PORT_NUMBER ) ;
+	ClearReceivedMessage () ;
+}
+
+
+	//----- G4FRClientServer::ConnectUnix()
+int G4FRClientServer::ConnectUnix()
+{
+		//----- local
+	int			flag_connected = 0 ; 
+	struct sockaddr_un	server_address ;
+
+		//----- make socket
+	fSocketFd = socket( AF_UNIX, SOCK_STREAM, 0 );
+	if( fSocketFd < 0 ) { Err("G4FRClientServer::ConnectUnix(),socket"); }
+
+		//----- set server address
+	memset( (char *)&server_address, '\0', sizeof(server_address)) ;
+	server_address.sun_family = AF_UNIX ;
+	strcpy( server_address.sun_path, SUN_PATH );
+
+		//----- connection
+	int	connection_status = -1  ;
+	int	num_trial         = 0 ;
+	while( connection_status < 0 && num_trial <= MAX_CONNECT_TRIAL ) {
+		num_trial++ ; 
+		connection_status = connect( fSocketFd, (struct sockaddr * )(&server_address), sizeof( server_address ) ) ;
+		if( connection_status  <0 ) 
+		{
+#if defined DEBUG_CLIENT_SERVER
+			Err("G4FRClientServer::ConnectUnix(),connect => RETRY");
+#endif
+			flag_connected = 0 ;
+		} else {
+			flag_connected = 1 ;
+			break ;
+		}
+
+		sleep(1);
+		
+	} // while(connection_status...)
+
+		//----- return status of connection
+	return flag_connected ;
+
+} // G4FRClientServer::ConnectUnix()
+
+
+	//-----	G4FRClientServer::Receive()
+void	G4FRClientServer::Receive()
+{
+		//-----
+	ClearReceivedMessage () ;
+	if( recv( fSocketFd, fReceivedMessage, G4FRClientServer::RECV_BUFMAX , 0 ) < 0 ) 
+	{
+		Err("G4FRClientServer::Receive(), recv");
+	}
+
+#if defined DEBUG_CLIENT_SERVER
+	G4cerr << ">>>>> receivedMessage = " << fReceivedMessage << G4endl;
+#endif
+
+}
+
+
+	//-----	G4FRClientServer::ReceiveLine()
+void	G4FRClientServer::ReceiveLine()
+{
+		//----- local
+	char    buf[1];
+	int index = 0 ;
+
+		//----- receive a line (until newline)
+	memset(fReceivedMessage, '\0', RECV_BUFMAX) ;	
+	while( read( fSocketFd, buf, 1 ) == 1 ) {
+		fReceivedMessage[index++] = buf[0];
+		if( IsEndOfLine(buf[0]) ) { break ;}
+	}
+} // G4FRClientServer::ReceiveLine()
+
+
+	//-----	G4FRClientServer::Send()
+void	G4FRClientServer::Send()
+{
+	if( send( fSocketFd, fSendingMessage, strlen(fSendingMessage) , 0 ) < 0 ) 
+	{
+		Err("G4FRClientServer::Send(), send");
+	}
+
+#if defined DEBUG_CLIENT_SERVER
+	G4cerr << "<<<<< SentMessage = " << fSendingMessage << G4endl;
+#endif
+
+} // G4FRClientServer::Send()
+
+
+	//-----	G4FRClientServer::Send( message )
+void	G4FRClientServer::Send( const char* message ) 
+{
+	this->SetSendingMessage( message )      ;
+	this->Send();
+
+} // G4FRClientServer::Send( message )
+
+
+	//-----	G4FRClientServer::SendLine()
+void	G4FRClientServer::SendLine( const char* message ) 
+{
+		//----- local
+	int	smsg_length ;
+
+		//----- set message to sending buf
+	this->SetSendingMessage( message )      ;
+	smsg_length = GetSendingMessageLength() ;
+
+		//----- add newline if necessary
+	if( !IsEndOfLine( fSendingMessage[ (smsg_length - 1)] ) ) {
+		fSendingMessage[ smsg_length ]      = GetEndOfLine() ;
+		fSendingMessage[ (smsg_length +1) ] = '\0' ;
+		smsg_length = GetSendingMessageLength();
+	}
+
+		//----- send
+	this->Send();
+
+}// G4FRClientServer::SendLine()
+
+
+	//----- G4FRClientServer::DisConnect()
+void G4FRClientServer::DisConnect()
+{
+		//----- close connection
+	if( shutdown(fSocketFd,2) < 0 ) { 
+		Err("G4FRClientServer::DisConnect,shutdown");
+	}
+	close( fSocketFd );
+
+	this->Clear();
+}
+
+
+
+	//----- G4FRClientServer::Clear()
+void G4FRClientServer::Clear()
+{
+	unlink(SUN_PATH) ;
+	fSocketFd = -1   ;
+}
+
+
+	//----- G4FRClientServer::ConnectINET()
+int G4FRClientServer::ConnectINET()
+{
+		//----- local
+	int			flag_connected = 0 ;
+	sockaddr_in		server_address ;
+	char			server_hostname[32] ;
+	hostent*		server_host_p ;
+
+		//----- make socket
+	fSocketFd = socket( AF_INET, SOCK_STREAM, 0 );
+	if( fSocketFd < 0 ) { 
+#if defined DEBUG_CLIENT_SERVER
+	  Err("G4FRClientServer::ConnectINET(),socket"); 
+#endif
+	}
+
+		//----- get IP address of server from its name
+	if( getenv( FR_ENV_SERVER_HOST_NAME ) != NULL ) 
+	{
+			//----- get server name
+		strcpy( server_hostname, getenv( FR_ENV_SERVER_HOST_NAME ) );
+
+			//----- get IP address of server from its name,
+			//..... reading /etc/hosts
+		server_host_p = gethostbyname( server_hostname ) ;
+			
+			//----- If the host specified by FR_ENV_SERVER_HOST_NAME
+			//.....  is not written in /etc/hosts, 
+			//...... server host is set to the same as the
+			//...... client host
+		if( !server_host_p ) {
+#if defined DEBUG_CLIENT_SERVER
+			Err("G4FRClientServer::ConnectINET(), gethostbyname");
+#endif
+			server_host_p = gethostbyname( FR_DEFAULT_HOST_NAME ) ;
+		}
+
+	} else {
+			server_host_p = gethostbyname( FR_DEFAULT_HOST_NAME ) ;
+	}
+
+
+
+// #if defined DEBUG_CLIENT_SERVER
+	G4cerr << "***** Trying connection to  " << server_hostname << G4endl;
+// #endif 
+	
+
+		//----- connection and binding 
+	memset( (char *)&server_address, '\0', sizeof(server_address)) ; 
+				// clear server_address
+	server_address.sin_family = AF_INET ;
+	server_address.sin_port   = htons( PORT_NUMBER );
+	memcpy( (char *)(&server_address.sin_addr ), 
+		(char *)( server_host_p->h_addr   ), 
+		server_host_p->h_length             ); 
+
+	int	connection_status = -1  ;
+	int	num_trial         = 0 ;
+	while( connection_status < 0 && num_trial <= MAX_CONNECT_TRIAL ) {
+		num_trial++ ; 
+		connection_status = connect( fSocketFd, (struct sockaddr * )(&server_address), sizeof( server_address ) ) ;
+		if( connection_status  <0 ) 
+		{
+#if defined DEBUG_CLIENT_SERVER
+			Err("G4FRClientServer::ConnectINET(),connect => RETRY");
+#endif 
+			flag_connected  = 0 ;
+		} else {
+			flag_connected  = 1 ;
+			break ;
+		}
+
+		sleep(1);
+
+	} // while(connection_status...)
+
+		//----- return status of connection
+	return flag_connected ;
+
+} // G4FRClientServer::ConnectINET()
+
+
+	//----- G4FRClientServer::WaitSendBack()
+void	G4FRClientServer::WaitSendBack( const char* command_string ) 
+{
+		//----- wait for sending back
+	while(1) { 
+		this->ReceiveLine();
+
+		if( !strncmp(	this->GetReceivedMessage(), \
+				command_string                , \
+				(strlen(command_string))       )   )
+		{
+			break;
+		} else {
+			sleep(2);
+		}
+
+	} // while
+
+		//----- clear buffer to receive message
+	this->ClearReceivedMessage();	
+
+} // G4FRClientServer::WaitSendBack()
+
+#endif // G4VIS_BUILD_DAWN_DRIVER
Index: tags/visualization-10.5-before-10.6_test/FukuiRenderer/src/G4FukuiRenderer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/FukuiRenderer/src/G4FukuiRenderer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/FukuiRenderer/src/G4FukuiRenderer.cc	(revision 1102)
@@ -0,0 +1,254 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4FukuiRenderer.cc,v 1.9 2006/06/29 21:16:58 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Satoshi TANAKA
+// FukuiRenderer factory.
+
+//=================//
+#ifdef G4VIS_BUILD_DAWN_DRIVER
+//=================//
+
+//#define DEBUG_FR_SYSTEM
+
+
+#include "G4FukuiRenderer.hh"
+
+#define __G_ANSI_C__
+
+//#include "G4VisFeaturesOfFukuiRenderer.hh"
+#include "G4VSceneHandler.hh"
+#include "G4FukuiRendererSceneHandler.hh"
+#include "G4FukuiRendererViewer.hh"
+#include "G4FRClientServer.hh"
+#include "G4FRConst.hh"
+#include "G4FRFeatures.hh"
+
+	//----- constant
+const int FR_DEFAULT_CONNECTION_TIME = 5  ;
+const char FR_ENV_CONNECTION_TIME [] = "G4DAWN_CONNECTION_TIME";
+const char FR_ENV_DAWN_GUI_ALWAYS [] = "G4DAWN_GUI_ALWAYS";
+
+	//----- G4FukuiRenderer, constructor
+G4FukuiRenderer::G4FukuiRenderer ():
+  G4VGraphicsSystem ("FukuiRenderer",
+		     "DAWN",
+		     FR_DAWNFILE_FEATURES,
+		     G4VGraphicsSystem::threeD),
+  fPrimDest() ,
+  fIPMode( G4FukuiRenderer::IP_UNIX ),
+  flag_use_gui     (false) ,
+  flag_connected   (0) 
+{
+		//----- sorting of objects
+	if( ( getenv( FR_ENV_DAWN_GUI_ALWAYS ) != NULL        ) && \
+	    ( strcmp( getenv( FR_ENV_DAWN_GUI_ALWAYS ),"0"  ) )      ) 
+	{
+		flag_use_gui =	true ;
+	} 
+}
+
+
+	//----- G4FukuiRenderer, destructor
+G4FukuiRenderer::~G4FukuiRenderer () 
+{
+	if( flag_connected ) {
+			//----- Terminate FukuiRenderer
+		fPrimDest.SendLine( FR_TERMINATE_DAWND ) ; 
+
+			//----- disconnection
+		fPrimDest.DisConnect(); 
+		flag_connected = 0 ;
+	}
+}
+
+	//-----  G4FukuiRenderer::CreateSceneHandler () 
+G4VSceneHandler* G4FukuiRenderer::CreateSceneHandler (const G4String& name) 
+{
+	G4VSceneHandler* p = new G4FukuiRendererSceneHandler (*this, name);
+
+	if(!flag_connected) { delete p ;  p = NULL ; }
+
+	return p;
+}
+
+	//-----  G4FukuiRenderer::CreateViewer () 
+G4VViewer* G4FukuiRenderer::CreateViewer (G4VSceneHandler& scene, const G4String& name) 
+{
+	if(!flag_connected) return NULL;
+       	G4VViewer* pView = 
+	  new G4FukuiRendererViewer ((G4FukuiRendererSceneHandler&) scene, name);
+	return pView;
+}
+
+	//----- G4FukuiRenderer::UseInetDomainAuto()
+void G4FukuiRenderer::UseInetDomainAuto()
+{
+	int		pid ;
+
+#if defined DEBUG_FR_SYSTEM
+	G4cerr << "***** Unix Inet Domain (AUTO mode)" << G4endl;
+#endif
+	fIPMode = G4FukuiRenderer::IP_UNIX ;
+
+	if( ( pid = fork() ) == 0 ) { // child
+		if ( execlp ( "dawn", "dawn", "-G" , (char *)0 ) < 0 ) 
+		{
+			perror("dawn") ;
+		}
+	} else { // parent 
+
+			//----- Set waiting time to ensure connection
+		int connection_time = FR_DEFAULT_CONNECTION_TIME  ;
+		if( getenv( FR_ENV_CONNECTION_TIME ) != NULL  ) {
+			int sscanf_status = \
+				sscanf( getenv( FR_ENV_CONNECTION_TIME ), "%d", &connection_time) ;
+			if ( sscanf_status == EOF ) {  
+			  connection_time = FR_DEFAULT_CONNECTION_TIME  ;
+			}
+		}
+
+
+			//----- Wait for starting up of FukuiRenderer
+		sleep(connection_time); 
+
+			//----- establish connection
+		this->ConnectPort();
+	}
+
+	if(!flag_connected) { 
+	  G4cerr << "***** ERROR: Connection failed" << G4endl; 
+	}
+	else { 
+	  G4cerr << "***** GEANT4 is connected to FukuiRenderer DAWN ";
+	  G4cerr << "in the same host" << G4endl; 
+	}
+
+} //  G4FukuiRenderer::UseInetDomainAuto()
+
+
+	//----- G4FukuiRenderer::UseInetDomain()
+void
+G4FukuiRenderer::UseInetDomain()
+{
+#if defined DEBUG_FR_SYSTEM
+	G4cerr << "***** INET Domain " << G4endl;
+#endif
+	fIPMode = G4FukuiRenderer::IP_INET ;
+
+	this->ConnectPort();
+
+	if(!flag_connected) {
+	  G4cerr << "***** ERROR: Connection failed" << G4endl; 
+	}
+	else { 
+	  G4cerr << "GEANT4 is connected to FukuiRenderer DAWN via socket" ; 
+	  G4cerr << G4endl; 
+	}
+
+} // G4FukuiRenderer::UseInetDomain()
+
+void
+G4FukuiRenderer::ConnectPort( int max_port_incr )
+{
+	//----- establish connection
+  int connect_trial = 0 ;
+  while(1) {
+    if ( ++connect_trial > max_port_incr ) {
+	this->flag_connected = 0 ;
+	G4cerr << "***** INET Connection failed."                << G4endl;
+	G4cerr << "      Maybe, you have not invoked DAWN yet,"  << G4endl;
+	G4cerr << "      or too many DAWN's are already running" << G4endl;
+	G4cerr << "      in the server host."                    << G4endl;
+	fPrimDest.IncrementPortNumber( (- FR_MAX_PORT_INCR) );
+	return ;
+    } else if ( fPrimDest.ConnectINET() ) { 
+	    // INET domain connection is established
+	this->flag_connected = 1 ;
+	G4cerr << "***** GEANT4 is connected to port  " ;
+	G4cerr << fPrimDest.GetPortNumber() ; 
+	G4cerr << "  of server" << G4endl;
+	break ; 
+    } else { 
+	    // Connection failed. Try the next port.
+      this->flag_connected = 0 ;
+      fPrimDest.IncrementPortNumber();
+      G4cerr << "***** GEANT4 incremented targeting port to " ;
+      G4cerr << fPrimDest.GetPortNumber() << G4endl;
+
+    } // if-elseif-else
+
+  } // while (1) 
+}
+
+
+	//----- G4FukuiRenderer::UseBSDUnixDomainAuto()
+void G4FukuiRenderer::UseBSDUnixDomainAuto()
+{
+	int     pid ;
+
+#if defined DEBUG_FR_SYSTEM
+	G4cerr << "***** UseBSDUnixDomainAuto " << G4endl;
+#endif
+	fIPMode = G4FukuiRenderer::IP_UNIX ; // Unix domain
+
+	if( ( pid = fork() ) == 0 ) { // child
+		if ( execlp ( "dawn", "dawn", "-g" , (char *)0 ) < 0 ) 
+		{
+			perror("dawn") ;
+		}
+	} else { // parent 
+
+	  		//----- Sleep for a while to make sure that 
+			//..... FukuiRenderer is ready
+		int connection_time = FR_DEFAULT_CONNECTION_TIME  ;
+		if( getenv( FR_ENV_CONNECTION_TIME ) != NULL  ) {
+			int sscanf_status = \
+				sscanf( getenv( FR_ENV_CONNECTION_TIME ), "%d", &connection_time) ;
+			if ( sscanf_status == EOF ) {  connection_time = FR_DEFAULT_CONNECTION_TIME  ;}
+		}
+		sleep(connection_time); 
+
+			//----- connect GEANT4 to FukuiRenderer
+		this->flag_connected = fPrimDest.ConnectUnix();
+
+			//----- display status
+		if(!flag_connected) {
+		  G4cerr << "***** ERROR: Connection failed" << G4endl; 
+		} else { 
+		  G4cerr << "*** GEANT4 is connected to FukuiRenderer DAWN ";
+		  G4cerr <<  "in the same host" << G4endl; 
+		}
+
+	} // if--else
+
+}// G4FukuiRenderer::UseBSDUnixDomainAuto()
+
+
+#endif // G4VIS_BUILD_DAWN_DRIVER
Index: tags/visualization-10.5-before-10.6_test/FukuiRenderer/src/G4FukuiRendererSceneHandler.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/FukuiRenderer/src/G4FukuiRendererSceneHandler.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/FukuiRenderer/src/G4FukuiRendererSceneHandler.cc	(revision 1102)
@@ -0,0 +1,212 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4FukuiRendererSceneHandler.cc,v 1.14 2006/06/29 21:17:00 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Satoshi TANAKA, Fri Jun 28 11:34:24 JST 1996
+// FukuiRenderer scene.
+
+
+//=================//
+#ifdef G4VIS_BUILD_DAWN_DRIVER
+//=================//
+
+
+#define __G_ANSI_C__
+
+// #define DEBUG_FR_SCENE
+
+     //----- header files
+#include <fstream>
+#include <string.h>
+#include "globals.hh"
+#include "G4FRConst.hh"
+#include "G4FukuiRenderer.hh"
+#include "G4FukuiRendererSceneHandler.hh"
+#include "G4FukuiRendererViewer.hh"
+#include "G4Point3D.hh"
+#include "G4VisAttributes.hh"
+#include "G4Scene.hh"
+#include "G4Transform3D.hh"
+#include "G4Polyhedron.hh"
+#include "G4Box.hh"
+#include "G4Cons.hh"
+#include "G4Polyline.hh"
+#include "G4Trd.hh"
+#include "G4Tubs.hh"
+#include "G4Trap.hh"
+#include "G4Torus.hh"
+#include "G4Sphere.hh"
+#include "G4Para.hh"
+#include "G4Text.hh"
+#include "G4Circle.hh"
+#include "G4Square.hh"
+#include "G4VPhysicalVolume.hh"
+
+//----- constants
+const char  FR_ENV_CULL_INVISIBLE_OBJECTS [] = "G4DAWN_CULL_INVISIBLE_OBJECTS";
+const char  FR_ENV_MULTI_WINDOW[]            = "G4DAWN_MULTI_WINDOW" ;
+
+///////////////////////////
+// Driver-dependent part //
+///////////////////////////
+
+
+	//----- G4FukuiRendererSceneHandler, constructor
+G4FukuiRendererSceneHandler::G4FukuiRendererSceneHandler (G4FukuiRenderer& system,
+					    const G4String& name):
+G4VSceneHandler  (system, fSceneIdCount++, name) ,
+fSystem   (system)                  ,
+fPrimDest (system.GetPrimDest() )   ,
+FRflag_in_modeling     (false)      ,
+flag_saving_g4_prim    (false)      ,
+COMMAND_BUF_SIZE       (G4FRClientServer::SEND_BUFMAX),
+fPrec (9), fPrec2 (16)
+{
+
+		//----- Connection to FukuiRenderer is set in the first scene
+	if( !fSystem.IsConnected() ) 
+	{
+		if ( getenv( FR_ENV_NAMED_PIPE_CONNECTION ) != NULL &&\
+		     strcmp( getenv( FR_ENV_NAMED_PIPE_CONNECTION ), "0" ) )
+		{ 
+				// Invoke DAWN locally and make connection
+				// via named pipe (not supported in AIX etc)
+			fSystem.UseBSDUnixDomainAuto();
+		} else if( getenv( FR_ENV_SERVER_HOST_NAME ) == NULL  ) 
+		{
+				// Invoke DAWN locally and make connection
+				// via socket
+			fSystem.UseInetDomainAuto();
+		} else {
+				// Connect to remote DAWN via socket
+			fSystem.UseInetDomain();
+		}
+	}
+
+		//----- precision control
+	if( getenv( "G4DAWN_PRECISION" ) != NULL ) {
+		sscanf( getenv("G4DAWN_PRECISION"), "%d", &fPrec ) ;
+	} else {
+                fPrec = 9 ;
+	}
+	fPrec2 = fPrec + 7 ;
+
+} // G4FukuiRendererSceneHandler, constructor
+
+
+	//----- G4FukuiRendererSceneHandler, destructor
+G4FukuiRendererSceneHandler::~G4FukuiRendererSceneHandler () 
+{
+#if defined DEBUG_FR_SCENE
+	G4cerr << "***** ~G4FukuiRendererSceneHandler" << G4endl;
+#endif 
+  ClearStore (); // clear current scene
+
+}
+
+//-----
+void G4FukuiRendererSceneHandler::FRBeginModeling( void )
+{
+	if( !FRIsInModeling() )  	
+	{
+#if defined DEBUG_FR_SCENE
+	  G4cerr << "***** G4FukuiRendererSceneHandler::FRBeginModeling (called & started)" << G4endl;
+#endif
+
+	  //----- Begin Saving g4.prim file
+	  // open g4.prim, ##
+	  BeginSavingG4Prim();
+
+	  //----- Send Bounding Box
+	  // /BoundingBox
+	  SendBoundingBox();
+
+	  //----- drawing device
+	  // !Device 
+	  // (Note: Not saved in g4.prim) 
+	  if( ( getenv( FR_ENV_MULTI_WINDOW ) != NULL      )   && \
+	      ( strcmp( getenv( FR_ENV_MULTI_WINDOW ),"0"  )      )  )
+	    {
+	      ((G4FukuiRendererViewer*)fpViewer)->SendDevice( G4FukuiRendererViewer::FRDEV_XWIN ) ; 
+	    } else {
+	      ((G4FukuiRendererViewer*)fpViewer)->SendDevice( G4FukuiRendererViewer::FRDEV_PS ) ; 
+	    }
+
+	  //----- drawing style
+	  // /WireFrame, /Surface etc
+	  // (Note: Not saved in g4.prim) 
+	  ((G4FukuiRendererViewer*)fpViewer)->SendDrawingStyle() ; 
+
+	  //----- set view parameters
+	  //   /CameraPosition, /TargetPoint, 
+	  //   /ZoomFactor, /FocalDistance, 
+	  //   !GraphicalUserInterface
+	  ((G4FukuiRendererViewer*)fpViewer)->SendViewParameters(); 
+
+	  //----- send SET_CAMERA command 
+	  //   !SetCamera
+#if defined DEBUG_FR_SCENE
+		G4cerr << "*****   (!SetCamera in FRBeginModeling())" << G4endl;
+#endif
+	  SendStr( FR_SET_CAMERA );
+
+	  //----- open device
+	  //   !OpenDevice
+#if defined DEBUG_FR_SCENE
+		G4cerr << "*****   (!OpenDevice in FRBeginModeling())" << G4endl;
+#endif
+	  SendStr( FR_OPEN_DEVICE      );
+
+	  //----- begin sending primitives
+	  //   !BeginModeling
+#if defined DEBUG_FR_SCENE
+	  G4cerr << "*****   (!BeginModeling in FRBeginModeling())" << G4endl;
+#endif
+	  SendStr( FR_BEGIN_MODELING );  FRflag_in_modeling = true ;
+
+	} // if
+
+}
+
+/////////////////////////////////////////
+// Common to DAWN and DAWNFILE drivers //
+/////////////////////////////////////////
+
+#define  G4FRSCENEHANDLER  G4FukuiRendererSceneHandler
+#include "G4FRSceneFunc.icc"
+#undef   G4FRSCENEHANDLER
+
+//////////////////////
+// static variables //
+//////////////////////
+
+	//----- static variables
+G4int G4FukuiRendererSceneHandler::fSceneIdCount = 0; 
+
+#endif // G4VIS_BUILD_DAWN_DRIVER
Index: tags/visualization-10.5-before-10.6_test/FukuiRenderer/src/G4FukuiRendererViewer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/FukuiRenderer/src/G4FukuiRendererViewer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/FukuiRenderer/src/G4FukuiRendererViewer.cc	(revision 1102)
@@ -0,0 +1,300 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4FukuiRendererViewer.cc,v 1.11 2006/06/29 21:17:02 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Satoshi TANAKA, Fri Jun 28 12:09:11 JST 1996
+// FukuiRenderer view - opens window, hard copy, etc.
+
+
+//=================//
+#ifdef G4VIS_BUILD_DAWN_DRIVER
+//=================//
+
+#define __G_ANSI_C__
+#define G4FukuiRenderer_STRUCTURE_PRIORITY  1.
+
+// #define DEBUG_FR_VIEW
+
+#include "G4ios.hh"
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+#include "G4Scene.hh"
+#include "G4Vector3D.hh"
+#include "G4VisExtent.hh"
+#include "G4LogicalVolume.hh"
+#include "G4VSolid.hh"
+
+#include "G4FRConst.hh"
+#include "G4FukuiRenderer.hh"
+#include "G4FukuiRendererSceneHandler.hh"
+#include "G4FukuiRendererViewer.hh"
+
+
+//----- Constructor
+G4FukuiRendererViewer::G4FukuiRendererViewer (G4FukuiRendererSceneHandler& sceneHandler,
+					  const G4String& name): 
+  G4VViewer (sceneHandler,
+	     sceneHandler.IncrementViewCount (),
+	     name),
+  fSceneHandler (sceneHandler)
+{}
+
+//----- Destructor
+G4FukuiRendererViewer::~G4FukuiRendererViewer () 
+{}
+
+//----- 
+void G4FukuiRendererViewer::SetView () 
+{
+#if defined DEBUG_FR_VIEW
+  G4cerr << "***** G4FukuiRendererViewer::SetView(): No effects" << G4endl;
+#endif 
+// Do nothing, since DAWN is running as a different process.
+// SendViewParameters () will do this job instead.
+}
+
+//----- 
+void
+G4FukuiRendererViewer::ClearView( void )
+{
+#if defined DEBUG_FR_VIEW
+  G4cerr << "***** G4FukuiRendererViewer::ClearView (): No effects " << G4endl;
+#endif
+
+}
+
+
+//----- 
+void G4FukuiRendererViewer::DrawView () 
+{
+#if defined DEBUG_FR_VIEW
+	G4cerr << "***** G4FukuiRendererViewer::DrawView () " << G4endl;
+#endif
+
+	//----- Begin modeling 3D 
+	fSceneHandler.FRBeginModeling();	
+
+	//----- Always visit G4 kernel 
+	NeedKernelVisit ();
+	                           
+	//----- Draw
+	ProcessView () ;
+
+} 
+
+
+//----- 
+void G4FukuiRendererViewer::ShowView( void )
+{
+#if defined DEBUG_FR_VIEW
+	G4cerr << "***** G4FukuiRendererViewer::ShowView () " << G4endl;
+#endif
+
+	if( fSceneHandler.FRIsInModeling() ) 
+	{
+			//----- End of modeling
+			// !EndModeling, !DrawAll, !CloseDevice,
+			// close g4.prim
+		fSceneHandler.FREndModeling();
+
+			//----- Wait user clicks drawing Area
+		this->Wait();
+	}
+
+} 
+
+
+//----- 
+void  G4FukuiRendererViewer::Wait()
+{
+#if defined DEBUG_FR_VIEW
+	G4cerr << "***** G4FukuiRendererViewer::Wait () : Begin" << G4endl;
+#endif
+  fSceneHandler.SendStr    ( FR_WAIT );
+  fSceneHandler.GetPrimDest().WaitSendBack( FR_WAIT );
+#if defined DEBUG_FR_VIEW
+	G4cerr << "***** G4FukuiRendererViewer::Wait () : end" << G4endl;
+#endif
+
+}
+
+
+//----- 
+void
+G4FukuiRendererViewer::SendDevice( FRDEV dev )
+{
+#if defined DEBUG_FR_VIEW
+	G4cerr << "***** G4FukuiRendererViewer::SendDevice() " << G4endl;
+#endif
+
+  //	enum {PS=1, XWIN=2, PS2=3, XWIN2=4, OPEN_GL=5, DEVICE_END=6};
+  
+	if( dev >= FRDEV_PS || dev < FRDEV_DEVICE_END ) {
+		fSceneHandler.SendStrInt ( FR_DEVICE, dev );
+	}
+}
+
+
+//----- 
+void  G4FukuiRendererViewer::SendDrawingStyle() 
+{
+#if defined DEBUG_FR_VIEW
+	G4cerr << "***** G4FukuiRendererViewer::SendDrawingStyle() " << G4endl;
+#endif
+
+	G4int  style = fVP.GetDrawingStyle();
+
+	switch( style )
+	{
+	  case G4ViewParameters::wireframe: 
+		fSceneHandler.SendStr( FR_WIREFRAME );
+		break;
+	  case G4ViewParameters::hlr:
+		fSceneHandler.SendStr( FR_LINES     );
+		break;
+	  case G4ViewParameters::hsr:
+	  case G4ViewParameters::hlhsr:
+		fSceneHandler.SendStr( FR_SURFACE   );
+		break;
+	  default:
+		fSceneHandler.SendStr( FR_WIREFRAME );
+		break;
+	}
+
+} 
+
+
+//----- 
+void G4FukuiRendererViewer::SendViewParameters () 
+{
+  // Calculates view representation based on extent of object being
+  // viewed and (initial) direction of camera.  (Note: it can change
+  // later due to user interaction via visualization system's GUI.)
+
+#if defined DEBUG_FR_VIEW
+  G4cerr << "***** G4FukuiRendererViewer::SendViewParameters()" << G4endl;
+#endif 
+
+		//----- Magic number to decide camera distance automatically
+	const    G4double        HOW_FAR            = 1000.0       ; // to define "infinity"
+	const    G4double        MIN_HALF_ANGLE     = 0.01         ;
+	const    G4double        MAX_HALF_ANGLE     = 0.499 * pi ;
+
+		//----- (2A) CALC camera distance
+		//..... Note: Camera cannot enter inside object
+	G4double  camera_distance ;
+	G4double  radius = fSceneHandler.GetScene()->GetExtent().GetExtentRadius();
+
+	G4double half_view_angle  = std::fabs ( fVP.GetFieldHalfAngle () ) ;
+	if( half_view_angle > MAX_HALF_ANGLE ) { 
+	  half_view_angle = MAX_HALF_ANGLE ; 
+	} 
+
+	if( half_view_angle < MIN_HALF_ANGLE ) {
+			//----- infinity (or ortho projection)
+		camera_distance = radius * HOW_FAR ;  
+	} else {
+			//----- Calc camera distance from half view angle
+		camera_distance = radius / std::sin ( half_view_angle );
+		camera_distance -= fVP.GetDolly();
+	}
+
+	if ( camera_distance < radius ) { 
+		G4cerr << "WARNING from FukuiRenderer (DAWN) driver:" << G4endl;
+		G4cerr << "  Camera cannot enter inside objects"      << G4endl;
+		camera_distance = radius ; 
+	}
+
+		//----- (3A) CALC camera direction
+	const G4Vector3D& camera_direction \
+	  = fVP.GetViewpointDirection().unit();
+	const G4double v_angle =  (180.0 / pi) * camera_direction.theta() ;
+	const G4double h_angle =  (180.0 / pi) * camera_direction.phi  () ;
+
+		//----- (2B), (3B) SEND camera position
+	fSceneHandler.SendStrDouble3( FR_CAMERA_POSITION, 
+			       camera_distance, 
+			       v_angle, 
+			       h_angle ); 
+
+		//----- (4A) CALC target point
+	const G4Point3D&  target_point
+	  = fSceneHandler.GetScene()->GetStandardTargetPoint()
+	  + fVP.GetCurrentTargetPoint();
+
+		//----- (4B) SEND target point
+	fSceneHandler.SendStrDouble3( FR_TARGET_POINT, 
+			       target_point.x(), 
+			       target_point.y(), 
+			       target_point.z() );
+
+		//----- (5A) CALC zoom factor
+	const G4double   zoom_factor  = fVP.GetZoomFactor();
+
+		//----- (5B) SEND zoom factor or focal length
+	if( half_view_angle < MIN_HALF_ANGLE ) {
+
+		const G4Point3D&  std_target_point \
+	  		= fSceneHandler.GetScene()->GetStandardTargetPoint();
+
+		fSceneHandler.SendStrDouble4( FR_ZOOM_FACTOR, 
+				       zoom_factor ,
+				       std_target_point.x(), 
+				       std_target_point.y(), 
+				       std_target_point.z());
+			// Note that target point, camera position, 
+			// and bounding box have already been sent above.
+			// The std_target_point is necessary to
+			// Calc focal distance from the zoom factor.
+	} else {
+		const G4double FR_HALF_SCREEN_SIZE = 0.5 ;
+		G4double  focal_distance \
+		  = FR_HALF_SCREEN_SIZE / std::tan( half_view_angle ); 
+		focal_distance *= zoom_factor ;
+		fSceneHandler.SendStrDouble ( FR_FOCAL_DISTANCE, focal_distance );
+	}
+
+		//----- INVOKE GUI: not executed in the default setting
+	if( fSceneHandler.GetSystem().IsGUIMode() ) {
+			//----- send GUI command
+		fSceneHandler.SendStr( FR_GUI );
+
+			//----- wait the same command is sent back:
+			//..... This avoids to send many data before
+			//..... GUI session is over.
+		fSceneHandler.GetPrimDest().WaitSendBack( FR_GUI );
+	}
+
+} 
+
+#endif // G4VIS_BUILD_DAWN_DRIVER
+
+
Index: tags/visualization-10.5-before-10.6_test/G4History.macro
===================================================================
--- tags/visualization-10.5-before-10.6_test/G4History.macro	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/G4History.macro	(revision 1102)
@@ -0,0 +1,18 @@
+/run/verbose 2
+/vis/scene/create
+/vis/open OGLSQT
+/vis/sceneHandler/create OGLSQT
+/vis/sceneHandler/attach
+/vis/viewer/create ! ! 600
+/vis/viewer/refresh
+/vis/scene/notifyHandlers
+/vis/viewer/flush
+/vis/viewer/refresh viewer-0
+/vis/viewer/update viewer-0
+/vis/scene/add/trajectories
+/tracking/storeTrajectory 1
+/vis/scene/notifyHandlers
+/vis/modeling/trajectories/create/drawByCharge
+/vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true
+/vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 2
+/vis/scene/endOfEventAction accumulate
Index: tags/visualization-10.5-before-10.6_test/GNUmakefile
===================================================================
--- tags/visualization-10.5-before-10.6_test/GNUmakefile	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/GNUmakefile	(revision 1102)
@@ -0,0 +1,72 @@
+# $Id: GNUmakefile,v 1.23 2009/03/05 11:32:07 lgarnier Exp $
+# -----------------------------------------------------------------------
+# GNUmakefile for visualization and modeling.  John Allison, 5/7/95.
+# Modeling is always made.  Others by environment.  John Allison  4/7/98.
+# -----------------------------------------------------------------------
+
+MAKEFLAGS= --no-print-directory
+
+name := G4visualization
+
+ifndef G4INSTALL
+  G4INSTALL = ../..
+endif
+
+include $(G4INSTALL)/config/architecture.gmk
+include $(G4INSTALL)/config/G4VIS_BUILD.gmk
+include $(G4INSTALL)/config/interactivity.gmk
+
+SUBDIRS := modeling
+SUBLIBS := G4modeling
+
+ifdef G4LIB_BUILD_ZLIB
+  SUBDIRS += externals/zlib
+  SUBLIBS += G4zlib
+endif
+
+# For Debug mode
+CPPFLAGS += -DG4DEBUG_VIS_OGL
+CPPFLAGS += -DG4DEBUG_VIS_OI
+CPPFLAGS += -DG4DEBUG_VIS_MANAGEMENT
+
+# Libraries which can be used without external packages or libraries...
+ifdef G4VIS_BUILD
+  SUBDIRS += management
+  SUBLIBS += G4vis_management
+  SUBDIRS += FukuiRenderer
+  SUBLIBS += G4FR
+  SUBDIRS += HepRep
+  SUBLIBS += G4visHepRep
+  SUBDIRS += RayTracer
+  SUBLIBS += G4RayTracer
+  SUBDIRS += VRML
+  SUBLIBS += G4VRML
+  SUBDIRS += Tree
+  SUBLIBS += G4Tree
+  SUBDIRS += XXX
+  SUBLIBS += G4visXXX
+
+ifdef G4VIS_BUILD_OPENGL_DRIVER
+  SUBDIRS += externals/gl2ps
+  SUBDIRS += OpenGL
+  SUBLIBS += G4OpenGL
+endif
+ifdef G4VIS_BUILD_OI_DRIVER
+  SUBDIRS += externals/gl2ps
+  SUBDIRS += OpenInventor
+  SUBLIBS += G4OpenInventor
+endif
+endif #G4VIS_BUILD
+
+.PHONY: granular glob global clean
+
+glob global: granular
+
+granular:
+	@for dir in $(SUBDIRS); do (cd $$dir; $(MAKE)); done
+
+includes:
+	@for dir in $(SUBDIRS); do (cd $$dir && $(MAKE) $@ ); done
+
+clean clean_libs:
+	@for dir in $(SUBDIRS); do (cd $$dir; $(MAKE) $@); done
Index: tags/visualization-10.5-before-10.6_test/HepRep/GNUmakefile
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/GNUmakefile	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/GNUmakefile	(revision 1102)
@@ -0,0 +1,44 @@
+# $Id: GNUmakefile,v 1.24 2006/05/22 08:54:13 allison Exp $
+
+name := G4visHepRep
+
+ifndef G4INSTALL
+  G4INSTALL = ../../..
+endif
+
+GLOBLIBS  = libG4vis_management.lib libG4modeling.lib
+ifdef G4LIB_BUILD_ZLIB
+  GLOBLIBS += libG4zlib.lib
+endif
+GLOBLIBS += libG4tracking.lib libG4digits_hits.lib
+GLOBLIBS += libG4geometry.lib
+GLOBLIBS += libG4materials.lib libG4graphics_reps.lib
+GLOBLIBS += libG4intercoms.lib libG4global.lib
+
+include $(G4INSTALL)/config/architecture.gmk
+include $(G4INSTALL)/config/G4VIS_BUILD.gmk
+include $(G4INSTALL)/config/interactivity.gmk
+
+ifdef G4LIB_USE_ZLIB
+  CPPFLAGS += -DG4LIB_USE_ZLIB
+  ifdef G4LIB_BUILD_ZLIB
+    CPPFLAGS += -I$(G4BASE)/visualization/externals/zlib/include
+  endif
+else
+  CPPFLAGS += -DCHEPREP_NO_ZLIB
+endif
+
+CPPFLAGS += -I$(G4BASE)/digits_hits/hits/include
+CPPFLAGS += -I$(G4BASE)/tracking/include
+CPPFLAGS += -I$(G4BASE)/visualization/management/include
+CPPFLAGS += -I$(G4BASE)/visualization/modeling/include
+CPPFLAGS += -I$(G4BASE)/global/management/include
+CPPFLAGS += -I$(G4BASE)/global/HEPGeometry/include
+CPPFLAGS += -I$(G4BASE)/graphics_reps/include
+CPPFLAGS += -I$(G4BASE)/intercoms/include
+CPPFLAGS += -I$(G4BASE)/geometry/management/include
+CPPFLAGS += -I$(G4BASE)/geometry/solids/CSG/include
+CPPFLAGS += -I$(G4BASE)/geometry/solids/specific/include
+CPPFLAGS += -I$(G4BASE)/materials/include
+
+include $(G4INSTALL)/config/common.gmk
Index: tags/visualization-10.5-before-10.6_test/HepRep/History
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/History	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/History	(revision 1102)
@@ -0,0 +1,428 @@
+.$Id: History,v 1.129 2009/05/08 09:29:23 gcosmo Exp $
+-------------------------------------------------------------------
+
+     =========================================================
+     Geant4 - an Object-Oriented Toolkit for Simulation in HEP
+     =========================================================
+
+                      Category History file
+                      ---------------------
+This file should be used by G4 developers and category coordinators
+to briefly summarize all major modifications introduced in the code
+and keep track of all category-tags.
+It DOES NOT substitute the  CVS log-message one should put at every
+committal in the CVS repository !
+
+     ----------------------------------------------------------
+     * Reverse chronological order (last date on top), please *
+     ----------------------------------------------------------
+
+History file for visualization/HepRep sub-category
+--------------------------------------------------
+
+8 May 2009  Gabriele Cosmo  (vis-HepRep-V09-02-00)
+- Added inclusion of <cstdio> in DeflateOutputStreamBuffer.h to resolve
+  compilation errors reported by gcc-4.4.0.
+
+4 January 2008  John Allison  (vis-HepRep-V09-01-00)
+- Adapted to new BeginPrimitives2D signature.
+
+16 November 2007 Joseph Perl (vis-HepRep-V09-00-01)
+- Adjust geometry hierarchy in G4HepRepFileSceneHandler to accomodate
+  parallel worlds.  Where used to just have world at top of hierarchy,
+  now have world or worlds as one level below top level of geometry.
+- Cleaned up G4HepRepSceneHandler (just removing inaccurate old comment).
+
+22 May 2007 John Allison (vis-HepRep-V08-03-00)
+- Fixed memory leak in G4HepRepFile.
+
+16 November 2006 Joseph Perl (vis-HepRep-V08-01-04)
+- Omit Pos and Aux attributes for hits.
+- Protect against null Region (as in parallel geometries).
+
+14 November 2006 Joseph Perl (vis-HepRep-V08-01-03)
+- Improve handling of Trajectory Points.
+
+13 November 2006 Joseph Perl (vis-HepRep-V08-01-02)
+- Corrected handling of Hits that come via AddSolids.
+
+5 November 2006 John Allison  (vis-HepRep-V08-01-01)
+- Protected against zero material pointer.
+- Corrected material pointer - pick up from PVModel instead of logical volume
+  so that it is correct for parameterised volumes.
+
+1 November 2006 John Allison  (vis-HepRep-V08-01-00)
+- G4HepRepFileSceneHandler.cc:
+  o Exploit G4PhysicalVolumeModel::G4PhysicalVolumeNodeID::GetNonCulledDepth().
+    (Saves some lines of code.)
+
+4 June 2006 Joseph Perl  (vis-HepRep-V08-00-04)
+- G4HepRepFileSceneHandler: Bring trajectory points under control of filtering.
+- G4HepRepFileSceneHandler: Correct direction of G4Cons and G4Tubs.
+- G4HepRepFileSceneHandler: Use GetMarkerSize for marks and text.
+- G4HepRepFileSceneHandler: Apply correct units for Density and Radlen.
+- G4HepRepFileSceneHandler: Use BeginPrimitives2D and EndPrimitives2D to be able to cleanly
+  reject cases that don't apply to HepRep: 3D text and 2D lines and markers.
+- G4HepRepFileSceneHandler: Improve handling for case of culled volumes.
+
+2 June 2006 Joseph Perl  (vis-HepRep-V08-00-03)
+- G4HepRepFileSceneHandler: Support 2D Text.
+- G4HepRepFileSceneHandler: Avoid creating Traj or Hit instances if they
+  have no primitives due to filtering.
+- G4HepRepFileSceneHandler: Assign Hits to various HepRepTypes depending on
+  attribute HitType.
+- G4HepRepFileSceneHandler: Support G4VisTrajContext.
+- G4HepRepFileSceneHandler: Include G4Version attribute in HepRep file.
+- G4HepRepFileSceneHandler: Handle Axes and other primitives that are neither
+  transients nor geometry.
+- G4HepRepFileViewer: Call ShowView from destructor to assure file is
+  properly terminated.
+
+22nd May 2006 John Allison (vis-HepRep-V08-00-02)
+- Removed dependency on Run.  (G4HepRepSceneHandler.cc: Version string
+  now obtained directly from G4Version.hh.)
+
+4th May 2006 John Allison (vis-HepRep-V08-00-01)
+- Improved protection for null models and parameters.
+
+19 April 2006 John Allison (vis-HepRep-V08-00-00)
+- G4HepRepSceneHandler and G4HepRepFileSceneHandler: Migrated to direct
+  access to G4PhysicalVolumeModel.
+
+31 October 2005 Mark Donszelmann (vis-HepRep-V07-01-04)
+- Further fix for GEANT-61.
+
+13 October 2005 John Allison (vis-HepRep-V07-01-03)
+- Migrated to <sstream>.
+
+12 October 2005 Mark Donszelmann (vis-HepRep-V07-01-02)
+- Fixed compilation warning on MacOSX
+- Further fix for GEANT-61.
+
+27 September 2005 Mark Donszelmann (vis-HepRep-V07-01-01)
+- Fixed GEANT-61: Cones face wrong way.
+
+4 August 2005 Mark Donszelmann (vis-HepRep-V07-01-00)
+- Fixed GEANT-60: DrawAs value wrong for solids that use Geant4 primitives.
+
+28 June 2005 Gabriele Cosmo (vis-HepRep-V07-00-04)
+- Fixed GNUmakefile to include ZLIB module for DLLs build on Windows.
+
+2 June 2005 Mark Donszelmann (vis-HepRep-V07-00-03)
+- HepRepXML (heprep2) handles: Solids, Attributes on Hits and Tracks.
+- cheprep at 2.0.5, fix for g++ 4.0.
+
+1 June 2005 Joseph Perl
+- For HeRepFile, use attributes from hits.
+
+1 June 2005 Mark Donszelmann (vis-HepRep-V07-00-02)
+- updated documentation.
+
+31 May 2005 Joseph Perl
+- For HeRepFile, use G4AttCheck to standardize attribute units.
+
+30 May 2005 Joseph Perl
+- For HeRepFile, respect Drawing Mode.
+
+30 May 2005 Joseph Perl
+- For HeRepFile, make trajectory color come from visible->GetColour.
+
+28 May 2005 Joseph Perl
+- For HeRepFile, implement G4HEPREPFILE_CULL.
+
+28 May 2005 Joseph Perl
+- For HeRepFile, correct heprep xmlns reference.
+
+25 May 2005 Joseph Perl
+- For HeRepFile, allow user to specify output directory, filename
+  and whether to overwrite.
+
+25 May 2005 Mark Donszelmann (vis-HepRep-V07-00-01 against geant4-07-00-ref-03)
+- optionally needs externals/zlib (vis-zlib-V07-00-00)
+- HEPREP at version 2.0.1
+- cheprep at version 2.0.4
+- Added writing an EOF marker for each binary HepRep file.
+- Added version files to the copied filesets from FreeHEP.
+
+24 May 2005 Joseph Perl
+- Improve handling of solids (in HepRepFile).
+
+16 May 2005 Mark Donszelmann
+- Fixed problems with sequential heprep files, gz files, 
+  too much info in the heprep file and some compilation mistakes.
+
+12 May 2005 Mark Donszelmann
+- Renamed zconf.h, zlib.h and zutil.h back into their old names.
+- Removed -DZ_PREFIX from the zlib compilation step.
+- Added G4LIB_BUILD_ZLIB for building zlib and G4LIB_USE_ZLIB for using zlib.
+- Removed all files belonging to zipios++ from include and src.
+- Removed all files from the ref include directory.
+- Moved zlib to the externals/zlib package.
+- Added cheprep src and include files and changed GNUmakefile.
+
+3 May 2005 Mark Donszelmann
+- Removed the following zlib and zipios files which are not necessary for writing
+  zip or gz files: include/zipios++/basicentry.h, include/zipios++/collcoll.h, 
+  include/zipios++/dircoll.h, include/zipios++/filepath.h, 
+  include/zipios++/filterinputstreambuf.h, include/zipios++/inflateinputstreambuf.h, 
+  include/zipios++/zipfile.h, include/zipios++/zipinputstream.h, 
+  include/zipios++/zipinputstreambuf.h, 
+  include/zlib/inffast.h, include/zlib/inffixed.h, include/zlib/inflate.h, 
+  include/zlib/inftrees.h, src/basicentry.cc, src/collcoll.cc, src/filepath.cc, 
+  src/filterinputstreambuf.cc, src/infback.cc, src/inffast.cc, src/inflate.cc, 
+  src/inflateinputstreambuf.cc, src/inftrees.cc, src/uncompr.cc, src/zipfile.cc, 
+  src/zipinputstream.cc, src/zipinputstreambuf.cc
+
+16 February 2005 Mark Donszelmann (vis-HepRep-V07-00-00 against geant4-07-00-ref-00)
+- Fix for g++ compiler 2.95.2 on Linux.
+
+22 November 2004 Mark Donszelmann (vis-HepRep-V06-02-02 against geant4-06-02-ref)
+- Upgraded to latest version C++ HepRep driver from FreeHEP.
+- Fixed GEANT-51, upgrade zlib to version 1.2.2 (for AMD64 compatibility).
+
+22 August 2004 Mark Donszelmann (vis-HepRep-V06-02-01)
+- Fixed a compilation problem in zlib for AMD64, reported by Peter Niessen.
+
+17 June 2004 Mark Donszelmann (vis-HepRep-V06-01-05 against geant4-06-02-cand-02)
+- Fixed GEANT-50:
+  - Renamed zlib prefix from z_ to heprep_z_
+  - Added symbol z_errmsg to list for renaming to avoid conflicts with other
+    programs who contain a copy of zlib (such as Root).
+  
+4 June 2004 Mark Donszelmann (vis-HepRep-V06-01-04 against geant4-06-01-ref-02)
+- Fixed compilation problem with G4RunManagerKernel
+
+27 May 2004 Joseph Perl (vis-HepRep-V06-01-02)
+- Added attributes for Region and Root Region to both HepRep drivers.
+
+27 May 2004 Mark Donszelmann (vis-HepRep-V06-01-01)
+- Fixed GEANT17: geometry files can be written separately.
+- Updated README with instructions
+  see http://bugs.freehep.org/secure/BrowseProject.jspa?id=10041
+
+26 May 2004 Mark Donszelmann (vis-HepRep-V06-01-00)
+- Fixed GEANT-47: Added initial viewpoint settings and a command to set the 
+  coordinate system.
+- Fixed GEANT-41: copied new interfaces for HepRep, which uses fewer pointers,
+  see http://bugs.freehep.org/secure/BrowseProject.jspa?id=10041
+
+14 March 2004 Joseph Perl (vis-HepRep-V06-00-06)
+- HepRepFile handle duplicate ShowView.
+- HepRepFile improve layering and hierarchy for hits.
+
+1 March 2004 Mark Donszelmann (vis-HepRep-V06-00-05)
+- Fixed compilation warnings for the Linux-icc (8.0) compiler.
+
+18 February 2004 Mark Donszelmann
+- Removed appendzip.cc file, since it is strictly not necessary.
+
+12 Febryary 2004 Mark Donszelmann
+- GEANT-42: Renamed the HepRep schema locator to 
+  http://java.freehep.org/schemas/heprep/2.0
+  
+5 February 2004 Mark Donszelmann (vis-HepRep-V06-00-04)
+- Fixed compilation problems for the Linux-icc (7.0) compiler.
+
+3 February 2004 Mark Donszelmann (vis-HepRep-V06-00-03)
+- Further fix to GEANT-40, renamed zutil.h, zlib.h and zconf.h
+  into HepRep-zutil.h, ... to avoid conflicts with those files
+  on Unix systems if /usr/include or /usr/local/include is
+  on the include search path.
+
+28 January 2004 Mark Donszelmann (vis-HepRep-V06-00-01)
+- Attempted to fix GEANT-40. For some unclear reason the symbols zcalloc and zcfree
+  of the zlib library were being called as C++ mangled names. 
+  To get rid of the situation of a mix of C++ and C names, we took
+  out the 'extern "C"' declarations from our zlib.h and zutil.h.
+  All names are C++ mangled now.
+
+11 December 2003 Mark Donszelmann
+- Removed the HepRep2 driver from FreeHEP, so the HepRep2 sources now live
+  in this directory. Modified the copyfreehep scripts, and the READMEs.
+  Re-added the cvs expand keywords to show revision and tagname.
+
+05 December 2003 Joseph Perl (vis-HepRep-V05-02-09)
+- Fix bug with CalHits by moving faces to separate HepRepType
+
+19 November 2003 Joseph Perl (vis-HepRep-V05-02-07)
+- Set two additional attributes to get correct pick response within client,
+  PickParent and ShowParentAttributes.
+  Fixes GEANT-38
+
+17 November 2003 Mark Donszelmann (vis-HepRep-V05-02-06)
+- Removed dependency on sstream which made compilation fail on Linux-g++2.95.2
+  and on Solaris 5.2. 
+- Added flags for zipios++ to compile OutputStringStream using sstream only on
+  g++ 3.x (Linux/MacOS X) and on WIN32. 
+- Added include to OutputStringStream.h to make it work on Solaris.
+- Removed our own sstream since it is no longer used.
+- Fixed GEANT-34  
+  
+14 November 2003 Mark Donszelmann 
+- Fixed GEANT-25, GEANT-35 and GEANT-36 (vis-HepRep-V05-02-05)
+  see http://bugs.freehep.org/secure/BrowseProject.jspa?id=10041
+
+14 November 2003 Joseph Perl
+- Fixed GEANT-30
+
+14 November 2003 Mark Donszelmann and Joseph Perl (vis-HepRep-05-02-03)
+- Fixed GEANT-32
+
+13 November 2003 Mark Donszelmann
+- Fixed GEANT-29, GEANT-33
+
+12 November 2003 Joseph Perl
+- Added G4HepRepFileSceneHandler::ClearTransientStore to make geometry
+  be properly included with each event of a /run/beamOn n.
+
+12 November 2003 Mark Donszelmann
+- Fixed GEANT-18, GEANT-19, GEANT-28
+
+11 November 2003 Mark Donszelmann
+- Fixed GEANT-23, GEANT-26, GEANT-27
+
+10 November 2003 Mark Donszelmann
+- Fixed GEANT-22, GEANT-24
+
+6 November 2003 Mark Donszelmann
+- Fixed GEANT-14, GEANT-20
+
+5 November 2003 Mark Donszelmann
+- Fixed GEANT-16
+
+4 November 2003 Mark Donszelmann
+- Fixed GEANT-15
+
+30 October 2003 Mark Donszelmann
+- Fixed GEANT-10, WIRED-170
+
+28 October 2003 Mark Donszelmann
+- Several fixes (GEANT-11, GEANT-12, GEANT-3 and GEANT-13)
+  
+24 October 2003 Mark Donszelmann
+- Several fixes (GEANT-2, GEANT-4, GEANT-8 and GEANT-9)
+
+22 October 2003 Mark Donszelmann
+- Added latest HepRep2 driver.
+
+12th July 2003 Mark Donszelmann
+- Renamed XMLHepRepWriter to G4HepRepFileXMLWriter and moved its header to include.
+  Fixed initialization of some variabled in G4HepRep and G4HepRepSceneHandler, found
+  by valgrind. Removed dependency in gzio.cc of fdopen (platform specific).
+
+11th July 2003 Mark Donszelmann
+- Removed the HepRepStreamer and replaced it by a fully functional HepRep implementation
+  in C++. Added compression using ZLIB and ZIPIOS++. Moved private header files to
+  subdirectories of include so that they do not get copied by the "gmake includes"
+  command.
+  The current HepRep files are invalid, but we first need to get rid of some memory
+  leaks, using Linux, so we check this in.
+
+30th May 2003  John Allison
+- Eliminated pedantic warnings at head (johna-030530) and on
+  geant4-05-01-ref-02 (vis-V05-00-02).
+
+29th May 2003 Mark Donszelmann and Joseph Perl (mark-joseph-050329)
+- Modified G4HepRepSceneHandler (HEPREP2) to write more complete heprep, including
+  attributes.
+- Copied new Streamer from FREEHEP library.
+
+28th February 2003  Joseph Perl
+- Modified G4HepRepFileSceneHandler to allow some volumes to be initially invisible.
+
+24th January 2003  Joseph Perl
+- Modified G4HepRepFileSceneHandler:AddThis (const G4VTrajectory& traj)
+  to incorporate G4Attributes into the HepRep1 file.
+- Moved some of HepRepXMLWriter's warning messages into ifdef debug blocks.
+
+11th December 2002  John Allison  (vis-V04-01-10)
+- Fixed default view parameters (global culling false).
+
+9th December 2002 Mark Donszelmann
+- Fixed bug that files were left open. Will close now, apart from stdin/stderr
+- Fixed color call not to use array creation.
+- Fixed HepRep standard (reader related), G4 is a writer.
+- Fixed include file now to only include HepRep.h (which includes all others)
+
+3rd December 2002 Mark Donszelmann
+- Fixed bug that XML Output can be routed to stdout or stderr.
+
+27th November 2002 Mark Donszelmann
+- Fixed core dump (Solaris) if open HepRepXML and closed it w/o writing anything
+
+27th November 2002  John Allison  (vis-V04-01-08)
+- Changed mickname of HepRep to HepRepXML.
+- Fixed description of HepRepFile.
+
+26th November 2002 Mark Donszelmann
+- Fixed FillStyle, LineStyle, LineWidth, HasFrame and Symbol Names
+- Fixed parent-child relationship  for calorimeter hits
+- Fixed material state number, now a string
+- Fixed fillColor to be equal to color
+
+25th November 2002 Mark Donszelmann
+- Fixed HepRep1 warnings in HepRepFileSceneHandler
+- Fixed HepRep2 radius of markers to be non-zero
+- Fixed HepRep2 attributes some of which had wrong names, especially the markers
+- Fixed HepRep2 filename to have sequence number
+
+13th November 2002 Mark Donszelmann
+- Added HepRep2 Driver
+
+4th February 2002  Joseph Perl  (vis-V04-00-01)
+- Check for missing hierarchy layers in HepRepXMLWriter.
+  (Not strictly needed since have a culled layer check in SceneHandler,
+  but may be useful in other applications of HepRepXMLWriter).
+
+3rd February 2002  Joseph Perl
+- Detect transient data by testing for
+  !fpCurrentPV || fReadyForTransients
+  rather than just fReadyForTransients
+
+1st February 2002  Joseph Perl
+- Defer file opening until first real HepRepType is to be written.
+- Moved HepRep code from AddThis to AddPrimitive.
+- Add additional levels to hierarchy if any appear to have been
+  removed by culling.
+- Add visibility attribute.
+
+29th January 2002  Joseph Perl
+- Relocate file-opening logic to constructor and ShowView
+  (had been in SetView).
+
+28th January 2002  Joseph Perl
+- Produce hierarchical output rather than flat HepRepType structure.
+- Handle trajectories as well as detector geometry.
+- Output files now named G4Data<n>.heprep where n increments with each open.
+
+19th November 2001  John Allison  (vis-V03-02-19)
+- Added G4HEPREPFILEDEBUG to control debug code.
+- Changed <fstream.h> to "g4std/fstream".
+- Changed cout to G4cout, endl to G4endl.
+- Changed G4HepRep.xml to G4HepRepFile.xml in hepRepXMLWriter->open("..."");
+
+8th November 2001  Joseph Perl
+- HepRep Type names now come from Physical Volume names.
+- Added many HepRep Attributes for other volume properties.
+
+6th November 2001  John Allison  (HepRep-pure-C++-1st-version)
+- Removed HepRep files G4HepRep.hh, G4HepRepSceneHandler.hh,
+  G4HepRepViewer.hh, G4HepRep.cc, G4HepRepSceneHandler.cc and
+  G4HepRepViewer.cc (recoverable with tag HepRep-Java-version).
+- Added HepRepFile from version of 27th September 2001  Joseph Perl.
+  First pure C++ version (eliminates need for Java jni or freehep).
+  Named as HepRepFile rather than HepRep.
+- GNUmakefile: removed CPPFLAGS += -DHEPREP and CPPFLAGS += -DDEBUG.
+- README: completely re-written for HepRepFile.
+
+6th November 2001  John Allison  (HepRep-Java-version)
+- Tagged before major revision.
+
+4th September 2001  Joseph Perl
+- minor improvements to README.
+
+26th August 2001  Joseph Perl
+- handle PolyHedron.getNoFacets()==0 and improve README.
+
+24th August 2001  Joseph Perl  (vis-V03-02-13-00)
+- First version of HepRep Graphics Driver
Index: tags/visualization-10.5-before-10.6_test/HepRep/README
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/README	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/README	(revision 1102)
@@ -0,0 +1,152 @@
+This G4 Graphics Driver creates a HepRep File suitable for viewing
+by the HepRApp, Wired4 or FRED Event Display clients.
+It requires no external packages.
+
+The HepRep graphics format is further described at
+http://www.slac.stanford.edu/~perl/heprep/
+
+
+Two different drivers are available for either HepRep1 or HepRep2.
+
+
+Driver: HepRepFile
+------------------
+The version of HepRep produced by this driver is HepRep Version 1.
+
+Writes files with file extension .heprep.
+
+First file is written to current directory and is named G4Data0.heprep.
+Subsequent files increment the number, as in G4Data1.heprep, G4Data2.heprep...
+
+To specify a different output file directory (instead of current directory),
+set G4HEPREPFILE_DIR
+
+To specify a different output file name (instead of G4Data),
+set G4HEPREPFILE_NAME
+
+To repeatedly overwrite the same output file (instead of having incremental
+numbers at the end of the file name),
+set G4HEPREPFILE_OVERWRITE
+
+By default, invisible objects are not culled but are left in the heprep file
+with their visibility initially set to false (so that you can subsequently
+choose to make them visible from within the heprep browser).
+To force culling of invisible objects,
+set G44HEPREPFILE_CULL
+
+View the file using the HepRApp HepRep Browser, available from:
+http://www.slac.stanford.edu/~perl/HepRApp
+
+HepRApp can read xml files in zipped format as well as unzipped,
+so you can save space by applying gzip to the xml file.
+This will reduce the file to about five percent of its original size.
+
+Joseph Perl
+15 November 2007
+
+
+Driver: HepRepXML
+-----------------
+The version of HepRep produced by this driver is HepRep Version 2.
+
+This driver can write both Binary HepRep (.bheprep) and XML HepRep 
+(.heprep) files. Binary HepRep files are a one-to-one translation
+of XML HepRep files, but they are considerably shorter and faster
+to parse by a HepRepViewer such as WIRED 4.
+
+You can view the files using the WIRED 4 Event Display, available from:
+
+http://wired4.freehep.org
+
+Both Binary HepRep and XML HepRep can be compressed using the standard
+zlib library if linked into Geant4 using G4LIB_USE_ZLIB. If a standard
+zlib is not available (WIN32-VC for instance) you should also set 
+G4LIB_BUILD_ZLIB to build G4zlib included with Geant4.
+
+HepRep files (Binary and XML) can contain multiple HepRep events/geometries.
+If the file contains more than one HepRep it is not strictly XML anymore.
+Files can be written in .heprep.zip, .heprep.gz or .heprep format and their
+binary versions .bheprep.zip, .bheprep.gz or .bheprep.
+
+The .heprep.zip is the default for file output, the .heprep is the default 
+for stdout and stderr.
+
+(Optional) To set the filename with a particular extension such as: 
+.heprep.zip, .heprep.gz, .heprep, .bheprep.zip, .bheprep.gz or .bheprep
+use for instance:
+
+/vis/scene/create filename.bheprep.zip
+
+
+(Optional) To create separate files for each event, you can set a suffix such as 
+"-0001" to start writing files from filename-0001.bheprep.zip to 
+filename-9999.bheprep.zip (or up), while "-55-sub" will start write files 
+filename-55-sub.bheprep.zip to filename-99-sub.bheprep.zip (or up).
+
+/vis/heprep/setEventNumberSuffix -0001
+(Note: suffix has to contain at least one digit)
+
+
+(Optional) To route the HepRep XML output to stdout (or stderr), 
+by default uncompressed, use:
+
+/vis/scene/create stdout
+
+
+To select the driver, where the file if not create by scene is set to 
+G4HepRepOutput.heprep.zip, use:
+
+/vis/open HepRepXML
+
+
+(Optional) To write a geometry, use:
+
+/vis/viewer/flush
+
+
+(Optional) To signal a change in geometry (to be written with the next event), use:
+
+/vis/viewer/refresh
+
+
+To write 10 events (and geometries), use:
+
+/run/beamOn 10
+
+
+(Optional) To accumulate multiple (5) G4 events into one HepRep event, use:
+/vis/scene/endOfEventAction accumulate
+/run/beamOn 5
+/vis/viewer/update
+
+
+(Optional) To add attributes to each point on a trajectory, use:
+/vis/heprep/addPointAttributes 1
+Be aware that this may increase the size of the output dramatically.
+
+
+(Optional) You may use the commands:
+/vis/viewer/zoom                            to set an initial zoom factor
+/vis/viewer/set/viewpointThetaPhi           to set an initial view point
+/vis/heprep/setCoordinateSystem uvw         to change the coordinate system, where uvw can be "xyz", "zxy", ...
+
+
+(Optional) You may decide to write .zip files with events and geometry separated (but linked).
+This results in a smaller zip file, as the geometry is only written once. Use the command:
+
+/vis/heprep/appendGeometry false
+
+
+(Optional) To close the file, remove the SceneHandler, use:
+
+/vis/sceneHandler/remove scene-handler-0
+
+
+Limitations:
+
+Only one SceneHandler can exist at any time, connected to a single Viewer. 
+Since the HepRep format is a model rather than a view this is not a real
+limitation. In WIRED 4 you can create as many views (SceneHandlers) as you like.
+
+1 June 2005
+Mark.Donszelmann@slac.stanford.edu
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/G4HepRep.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/G4HepRep.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/G4HepRep.hh	(revision 1102)
@@ -0,0 +1,57 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4HepRep.hh,v 1.17 2006/06/29 21:17:04 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+
+/**
+ * @author Mark Donszelmann
+ */
+#ifndef G4HEPREP_HH
+#define G4HEPREP_HH 1
+
+//G4
+#include "G4VGraphicsSystem.hh"
+
+class G4HepRepMessenger;
+
+class G4HepRep: public G4VGraphicsSystem {
+    public:
+        G4HepRep ();
+        virtual ~G4HepRep ();
+        G4VSceneHandler* CreateSceneHandler (const G4String& name = "");
+        G4VViewer* CreateViewer (G4VSceneHandler&, const G4String& name = "");
+
+        void removeSceneHandler();
+        void removeViewer();
+
+    private:
+        G4VSceneHandler* sceneHandler;
+        G4VViewer* viewer;
+        G4HepRepMessenger* messenger;        
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/G4HepRepFile.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/G4HepRepFile.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/G4HepRepFile.hh	(revision 1102)
@@ -0,0 +1,52 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4HepRepFile.hh,v 1.8 2006/06/29 21:17:06 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  5th April 2001
+// A graphics system to dump geometry hierarchy.
+
+#ifndef G4HepRepFile_HH
+#define G4HepRepFile_HH
+
+#include "G4VGraphicsSystem.hh"
+
+// HepRep
+#include "G4HepRepFileXMLWriter.hh"
+
+class G4HepRepFile: public G4VGraphicsSystem {
+public:
+  G4HepRepFile();
+  virtual ~G4HepRepFile();
+  G4VSceneHandler* CreateSceneHandler(const G4String& name = "");
+  G4VViewer* CreateViewer (G4VSceneHandler&, const G4String& name = "");
+
+  G4HepRepFileXMLWriter *GetHepRepXMLWriter();
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/G4HepRepFileSceneHandler.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/G4HepRepFileSceneHandler.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/G4HepRepFileSceneHandler.hh	(revision 1102)
@@ -0,0 +1,167 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4HepRepFileSceneHandler.hh,v 1.30 2008/01/04 22:11:31 allison Exp $
+// GEANT4 tag $Name:  $
+//
+//
+// Joseph Perl  27th January 2002
+// A base class for a scene handler to export geometry and trajectories
+// to the HepRep xml file format.
+
+#ifndef G4HepRepFileSCENEHANDLER_HH
+#define G4HepRepFileSCENEHANDLER_HH
+
+//#define G4HEPREPFILEDEBUG  // Comment this out to suppress debug code.
+
+#include "G4VSceneHandler.hh"
+#include "G4Box.hh"
+#include "G4Cons.hh"
+#include "G4Tubs.hh"
+#include "G4Trd.hh"
+#include "G4Trap.hh"
+#include "G4Sphere.hh"
+#include "G4Para.hh"
+#include "G4Torus.hh"
+#include "G4Polycone.hh"
+#include "G4Polyhedra.hh"
+
+// HepRep
+#include "G4HepRepFileXMLWriter.hh"
+
+class G4VPhysicalVolume;
+class G4LogicalVolume;
+class G4ModelingParameters;
+class G4VisTrajContext;
+
+class G4HepRepFileSceneHandler: public G4VSceneHandler {
+
+public:
+  G4HepRepFileSceneHandler(G4VGraphicsSystem& system,
+		      const G4String& name);
+  virtual ~G4HepRepFileSceneHandler();
+
+  ////////////////////////////////////////////////////////////////
+  // No need to implement these, but if you do...
+  void AddSolid(const G4Box&);
+  void AddSolid(const G4Cons&);
+  void AddSolid(const G4Tubs&);
+  void AddSolid(const G4Trd&);
+  void AddSolid(const G4Trap&);
+  void AddSolid(const G4Sphere&);
+  void AddSolid(const G4Para&);
+  void AddSolid(const G4Torus&);
+  void AddSolid(const G4Polycone&);
+  void AddSolid(const G4Polyhedra&);
+  void AddSolid(const G4VSolid&);
+  void AddCompound (const G4VTrajectory&);
+  void InitTrajectory();
+  void AddCompound (const G4VHit&);
+  void InitHit();
+  // void PreAddSolid(const G4Transform3D& objectTransformation,
+  //                 const G4VisAttributes&);
+  // void PostAddSolid();
+
+  ////////////////////////////////////////////////////////////////
+  // Required implementation of pure virtual functions...
+
+  void AddPrimitive(const G4Polyline&);
+  void AddPrimitive(const G4Text&);
+  void AddPrimitive(const G4Circle&);
+  void AddPrimitive(const G4Square&);
+  void AddPrimitive(const G4Polyhedron&);
+  void AddPrimitive(const G4NURBS&);
+
+  ////////////////////////////////////////////////////////////////
+  ////////////////////////////////////////////////////////////////
+  // Further optional AddPrimtive methods.  Explicitly invoke base
+  // class methods if not otherwise defined to avoid warnings about
+  // hiding of base class methods.
+  void AddPrimitive(const G4Polymarker&);
+  void AddPrimitive(const G4Scale& scale) {
+    G4VSceneHandler::AddPrimitive (scale);
+  }
+
+  ////////////////////////////////////////////////////////////////
+  // Further optional virtual functions...
+
+  // void BeginPrimitives(const G4Transform3D& objectTransformation);
+  // void EndPrimitives();
+
+  void BeginModeling();
+  void EndModeling();
+  
+  void BeginPrimitives2D(const G4Transform3D& objectTransformation);
+  void EndPrimitives2D();
+
+  //////////////////////////////////////////////////////////////
+  // Administration functions.
+
+  //void ClearStore ();
+  void ClearTransientStore ();
+
+  ////////////////////////////////////////////////////////////////
+  // Required...
+
+  G4HepRepFileXMLWriter *GetHepRepXMLWriter();
+
+protected:
+  static G4int         fSceneIdCount;  // Counter for HepRep scene handlers.
+
+private:
+  G4HepRepFileXMLWriter *hepRepXMLWriter;
+  void AddHepRepInstance(const char* primName,
+			 const G4Visible visible);
+  void CheckFileOpen();
+  int fileCounter;
+  char fileDir[256]; 
+  char fileName[256];
+  G4bool fileOverwrite;
+  G4bool cullInvisibleObjects;
+  G4bool haveVisible;
+  G4bool inPrimitives2D;
+  G4bool warnedAbout3DText;
+  G4bool warnedAbout2DMarkers;
+  G4bool drawingTraj;
+  G4bool doneInitTraj;
+  G4bool drawTrajPts;
+  G4bool drawingHit;
+  G4bool doneInitHit;
+  
+  const G4VisTrajContext* trajContext;
+  
+  std::vector<G4AttValue>* trajAttValues;
+  std::map<G4String,G4AttDef>* trajAttDefs;
+  std::vector<G4AttValue>* hitAttValues;
+  std::map<G4String,G4AttDef>* hitAttDefs;
+  
+#ifdef G4HEPREPFILEDEBUG
+  void PrintThings();
+#endif
+
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/G4HepRepFileViewer.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/G4HepRepFileViewer.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/G4HepRepFileViewer.hh	(revision 1102)
@@ -0,0 +1,57 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4HepRepFileViewer.hh,v 1.9 2006/06/29 21:17:10 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  5th April 2001
+// A base class for a dummy viewer to dump geometry hierarchy.
+
+#ifndef G4HepRepFileVIEWER_HH
+#define G4HepRepFileVIEWER_HH
+
+// #define G4HEPREPFILEDEBUG  // Comment this out to suppress debug code.
+
+#include "G4VViewer.hh"
+
+#include "G4HepRepFileXMLWriter.hh"
+#include "G4HepRepFileSceneHandler.hh"
+
+class G4HepRepFileViewer: public G4VViewer {
+public:
+  G4HepRepFileViewer(G4VSceneHandler&,const G4String& name);
+  virtual ~G4HepRepFileViewer();
+  void SetView();
+  void ClearView();
+  void DrawView();
+  void ShowView();
+
+private:
+  G4HepRepFileXMLWriter *hepRepXMLWriter;
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/G4HepRepFileXMLWriter.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/G4HepRepFileXMLWriter.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/G4HepRepFileXMLWriter.hh	(revision 1102)
@@ -0,0 +1,109 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+//--------------------------------------------------------------------------
+// File and Version Information:
+// 	$Id: G4HepRepFileXMLWriter.hh,v 1.2 2006/06/29 21:17:12 gunter Exp $
+//
+// Description:
+//	Create a HepRep XML File (HepRep version 1).
+//
+// Environment:
+//	Software developed for the general High Energy Physics community.
+//
+// Author :
+//       J. Perl                    Original Author
+//
+// Copyright Information:
+//      Copyright (C) 2001          Stanford Linear Accelerator Center
+//------------------------------------------------------------------------
+#ifndef G4HepRepFileXMLWriter_hh
+#define G4HepRepFileXMLWriter_hh
+
+//#define G4HEPREPFILEDEBUG  // Comment this out to suppress debug code.
+
+#include "globals.hh"
+#include <fstream>
+
+class G4HepRepFileXMLWriter
+{
+public:
+  G4HepRepFileXMLWriter();
+
+  void addType(const char* name, int newTypeDepth);
+  void addInstance();
+  void addPrimitive();
+  void addPoint(double x, double y, double z);
+
+  void addAttDef(const char* name,
+		 const char* desc,
+		 const char* type,
+		 const char* extra);
+
+  void addAttValue(const char* name,
+		   const char* value);
+
+  void addAttValue(const char* name,
+		   double value);
+
+  void addAttValue(const char* name,
+		   int value);
+
+  void addAttValue(const char* name,
+		   bool value);
+
+  void addAttValue(const char* name,
+		   double value1,
+		   double value2,
+		   double value3);
+
+  void open(const char* filespec);
+  void close();
+
+  void endTypes();
+
+  bool isOpen;
+  int typeDepth;
+  bool inType[50];
+  bool inInstance[50];
+  char* prevTypeName[50];
+  
+private:
+  std::ofstream fout;
+
+  void init();
+
+  bool inPrimitive;
+  bool inPoint;
+
+  void endType();
+  void endInstance();
+  void endPrimitive();
+  void endPoint();
+
+  void indent();
+};
+#endif
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/G4HepRepMessenger.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/G4HepRepMessenger.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/G4HepRepMessenger.hh	(revision 1102)
@@ -0,0 +1,73 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4HepRepMessenger.hh,v 1.7 2006/06/29 21:17:14 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+//
+#ifndef G4HepRepMessenger_HH
+#define G4HepRepMessenger_HH 1
+
+#include "G4UImessenger.hh"
+#include "G4UIdirectory.hh"
+#include "G4UIcmdWithABool.hh"
+#include "G4UIcmdWithAString.hh"
+#include "G4UIcommand.hh"
+
+class G4HepRepMessenger : public G4UImessenger {
+    
+    public:
+        G4HepRepMessenger();
+        virtual ~G4HepRepMessenger();
+
+        virtual G4String GetCurrentValue(G4UIcommand * command);
+        virtual void SetNewValue(G4UIcommand * command, G4String newValue);
+        
+        virtual G4String getEventNumberSuffix();
+        virtual G4bool appendGeometry();
+        virtual G4bool addPointAttributes();
+        virtual G4bool useSolids();
+        virtual G4bool writeInvisibles();
+
+    private:            
+        G4UIdirectory* heprepDirectory;
+        
+        G4String suffix;
+        G4UIcmdWithAString* setEventNumberSuffixCommand;
+        
+        G4bool geometry;
+        G4UIcmdWithABool* appendGeometryCommand;
+
+        G4bool pointAttributes;
+        G4UIcmdWithABool* addPointAttributesCommand;
+
+        G4bool solids;
+        G4UIcmdWithABool* useSolidsCommand;
+
+        G4bool invisibles;
+        G4UIcmdWithABool* writeInvisiblesCommand;
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/G4HepRepSceneHandler.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/G4HepRepSceneHandler.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/G4HepRepSceneHandler.hh	(revision 1102)
@@ -0,0 +1,227 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4HepRepSceneHandler.hh,v 1.42 2006/11/06 09:22:26 allison Exp $
+// GEANT4 tag $Name:  $
+//
+
+/**
+ * @author Mark Donszelmann
+ */
+
+#ifndef G4HEPREPSCENEHANDLER_HH
+#define G4HEPREPSCENEHANDLER_HH 1
+
+#include "globals.hh"
+#include <iostream>
+#include <stack>
+#include <map>
+#include <vector>
+
+// HepRep
+#include "HEPREP/HepRep.h"
+
+//G4
+#include "G4Box.hh"
+#include "G4Cons.hh"
+#include "G4Tubs.hh"
+#include "G4Trd.hh"
+#include "G4Trap.hh"
+#include "G4Sphere.hh"
+#include "G4Para.hh"
+#include "G4Torus.hh"
+#include "G4Polycone.hh"
+#include "G4Polyhedra.hh"
+
+#include "G4VGraphicsSystem.hh"
+#include "G4VSceneHandler.hh"
+#include "G4Visible.hh"
+#include "G4Material.hh"
+#include "G4LogicalVolume.hh"
+#include "G4PhysicalVolumeModel.hh"
+
+#include "G4HepRepMessenger.hh"
+
+class G4HepRepSceneHandler: public G4VSceneHandler {
+
+    public:
+        G4HepRepSceneHandler (G4VGraphicsSystem& system, G4HepRepMessenger& messenger, const G4String& name = "");
+        virtual ~G4HepRepSceneHandler ();
+
+        void AddSolid (const G4Box& box);
+        void AddSolid (const G4Cons& cons);
+        void AddSolid (const G4Tubs& tubs);
+        void AddSolid (const G4Trd& trd);
+        void AddSolid (const G4Trap& trap);          
+        void AddSolid (const G4Sphere& sphere);      
+        void AddSolid (const G4Para& para);          
+        void AddSolid (const G4Torus& torus);        
+        void AddSolid (const G4Polycone& polycone);  
+        void AddSolid (const G4Polyhedra& polyhedra);
+        void AddSolid (const G4VSolid& solid);       
+        
+        void AddCompound (const G4VTrajectory&);
+        void AddCompound (const G4VHit& hit);
+
+        void PreAddSolid (const G4Transform3D& objectTransformation, const G4VisAttributes& visAttribs);
+        void PostAddSolid ();
+
+        void AddPrimitive (const G4Polyline&);
+        void AddPrimitive (const G4Text&);
+        void AddPrimitive (const G4Circle&);
+        void AddPrimitive (const G4Square&);
+        void AddPrimitive (const G4Polyhedron&);
+        void AddPrimitive (const G4NURBS&);
+
+        void AddPrimitive (const G4Polymarker&);
+        void AddPrimitive (const G4Scale& scale);
+
+        void BeginPrimitives (const G4Transform3D& objectTransformation);
+        void EndPrimitives ();
+        void BeginModeling ();
+        void EndModeling ();
+
+        void openHepRep();
+        bool closeHepRep(bool final = false);
+        void openFile(G4String name);
+        void closeFile();
+
+    private:
+        static G4int sceneIdCount;
+        const G4ModelingParameters* originalMP;  // Keeps pointer to original.
+        G4ModelingParameters* nonCullingMP;      // For temporary non-culling.
+
+        G4Transform3D transform;
+
+        std::ostream* out;
+        HEPREP::HepRepFactory* factory;
+        HEPREP::HepRepWriter* writer;
+        
+        // Methods
+        G4bool dontWrite();
+        
+        void setColor (HEPREP::HepRepAttribute *attribute, const G4Color& color,
+			            const G4String& key = G4String("Color"));
+        G4Color getColorFor (const G4Visible& visible);
+        G4Color getColorFor (const G4VSolid& solid);
+        
+        void setVisibility (HEPREP::HepRepAttribute *attribute, const G4VSolid& solid);
+        void setLine   (HEPREP::HepRepAttribute *attribute, const G4VSolid& solid);
+        
+        void setVisibility (HEPREP::HepRepAttribute *attribute, const G4Visible& visible);
+        void setLine   (HEPREP::HepRepAttribute *attribute, const G4Visible& visible);
+
+        void setMarker (HEPREP::HepRepAttribute *attribute, const G4VMarker& marker);
+
+        inline void setAttribute (HEPREP::HepRepAttribute* attribute, G4String name, char* value) {
+            setAttribute(attribute, name, G4String(value));
+        }
+        void setAttribute (HEPREP::HepRepAttribute* attribute, G4String name, G4String value);
+        void setAttribute (HEPREP::HepRepAttribute* attribute, G4String name, bool value);
+        void setAttribute (HEPREP::HepRepAttribute* attribute, G4String name, double value);
+        void setAttribute (HEPREP::HepRepAttribute* attribute, G4String name, int value);
+        void setAttribute (HEPREP::HepRepAttribute* attribute, G4String name, double red, double green, double blue, double alpha);
+
+        bool isEventData();
+
+        void open(G4String name);
+        void close();
+
+        void writeLayers(HEPREP::HepRep* heprep);
+
+        void addAttributes(HEPREP::HepRepInstance* instance, HEPREP::HepRepType* type);
+
+        void addAttDefs(HEPREP::HepRepDefinition* definition, const std::map<G4String,G4AttDef>* attDefs);
+        void addAttVals(HEPREP::HepRepAttribute* attribute, const std::map<G4String,G4AttDef>* attDefs, std::vector<G4AttValue>* attValues);
+
+        void addTopLevelAttributes(HEPREP::HepRepType* type);
+
+        HEPREP::HepRepInstance*     getGeometryOrEventInstance(HEPREP::HepRepType* type);
+
+        // Returns the particular instance/type or if not created, creates them and adds them to the HepRep
+        HEPREP::HepRep*             getHepRep();
+        HEPREP::HepRep*             getHepRepGeometry();
+        HEPREP::HepRepInstanceTree* getGeometryInstanceTree();
+        HEPREP::HepRepInstance*     getGeometryInstance(G4LogicalVolume* volume, G4Material* material, int depth);
+        HEPREP::HepRepInstance*     getGeometryInstance(G4String volumeName, int depth);
+        HEPREP::HepRepInstance*     getGeometryRootInstance();
+        HEPREP::HepRepTypeTree*     getGeometryTypeTree();
+        HEPREP::HepRepType*         getGeometryType(G4String volumeName, int depth);
+        HEPREP::HepRepType*         getGeometryRootType();
+        HEPREP::HepRepInstanceTree* getEventInstanceTree();
+        HEPREP::HepRepInstance*     getEventInstance();
+        HEPREP::HepRepTypeTree*     getEventTypeTree();
+        HEPREP::HepRepType*         getEventType();
+        HEPREP::HepRepType*         getTrajectoryType       ();
+        HEPREP::HepRepType*         getHitType              ();
+        HEPREP::HepRepType*         getCalHitType           ();
+        HEPREP::HepRepType*         getCalHitFaceType       ();
+
+        G4String getFullTypeName(G4String volumeName, int depth);
+        G4String getParentTypeName(int currentDepth);
+
+        // initialized Member Variables
+        G4HepRepMessenger& messenger;
+        G4String geometryLayer, eventLayer, calHitLayer;
+        G4String trajectoryLayer, hitLayer;
+        G4String rootVolumeName;
+        
+        G4String baseName;
+        G4String eventNumberPrefix;
+        G4String eventNumberSuffix;
+        G4int eventNumber;
+        G4int eventNumberWidth;
+        G4String extension;
+        G4bool writeBinary;
+        G4bool writeZip;
+        G4bool writeGZ;
+        G4bool writeMultipleFiles;
+        const G4VHit* currentHit;
+        const G4VTrajectory* currentTrack;
+
+        // DO NOT USE member vars directly, use get methods.
+        HEPREP::HepRep*                         _heprep;
+        HEPREP::HepRep*                         _heprepGeometry;
+        HEPREP::HepRepInstanceTree*             _geometryInstanceTree;
+        std::vector<HEPREP::HepRepInstance*>    _geometryInstance;
+        HEPREP::HepRepInstance*                 _geometryRootInstance;
+        HEPREP::HepRepTypeTree*                 _geometryTypeTree;
+        std::vector<G4String>                   _geometryTypeName;
+        std::map<G4String, HEPREP::HepRepType*> _geometryType;
+        HEPREP::HepRepType*                     _geometryRootType;
+        HEPREP::HepRepInstanceTree*             _eventInstanceTree;
+        HEPREP::HepRepInstance*                 _eventInstance;
+        HEPREP::HepRepTypeTree*                 _eventTypeTree;
+        HEPREP::HepRepType*                     _eventType;
+        HEPREP::HepRepType*                     _trajectoryType;
+        HEPREP::HepRepType*                     _hitType;
+        HEPREP::HepRepType*                     _calHitType;
+        HEPREP::HepRepType*                     _calHitFaceType;        
+
+        std::map<int, G4String> materialState;
+};
+
+#endif
+
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/G4HepRepViewer.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/G4HepRepViewer.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/G4HepRepViewer.hh	(revision 1102)
@@ -0,0 +1,62 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4HepRepViewer.hh,v 1.18 2006/06/29 21:17:18 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+
+/**
+ * @author Mark Donszelmann
+ */
+
+#ifndef G4HEPREPVIEWER_HH
+#define G4HEPREPVIEWER_HH 1
+
+// HepRep
+#include "HEPREP/HepRep.h"
+
+// Geant4
+#include "G4VViewer.hh"
+
+#include "G4HepRepMessenger.hh"
+
+class G4HepRepViewer: public G4VViewer {
+    public:
+        G4HepRepViewer (G4VSceneHandler& scene, G4HepRepMessenger& messenger, const G4String& name = "");
+        virtual ~G4HepRepViewer ();
+        void SetView ();
+        void ClearView ();
+        void DrawView ();
+        void ShowView ();
+        void FinishView ();
+
+        void reset();
+        
+    private:
+        bool geometryIncluded;
+        G4HepRepMessenger& messenger;
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HasHepRep.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HasHepRep.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HasHepRep.h	(revision 1102)
@@ -0,0 +1,34 @@
+// -*- C++ -*-
+// AID-GENERATED
+// =========================================================================
+// This class was generated by AID - Abstract Interface Definition          
+// DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it. 
+// =========================================================================
+#ifndef HEPREP_HASHEPREP_H
+#define HEPREP_HASHEPREP_H 1
+
+// Copyright 2000-2005, FreeHEP.
+
+namespace HEPREP {
+
+class HepRep;
+
+/**
+ * The HasHepRep interface.
+ *
+ * @author Mark Donszelmann
+ */
+class HasHepRep {
+
+public: 
+    /// Destructor.
+    virtual ~HasHepRep() { /* nop */; }
+
+    /**
+     * Returns the associated HepRep to this object.
+     *
+     */
+    virtual HepRep & getHepRep() = 0;
+}; // class
+} // namespace HEPREP
+#endif /* ifndef HEPREP_HASHEPREP_H */
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRep.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRep.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRep.h	(revision 1102)
@@ -0,0 +1,210 @@
+// -*- C++ -*-
+// AID-GENERATED
+// =========================================================================
+// This class was generated by AID - Abstract Interface Definition          
+// DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it. 
+// =========================================================================
+#ifndef HEPREP_HEPREP_H
+#define HEPREP_HEPREP_H 1
+
+// Copyright 2000-2005, FreeHEP.
+
+#include <string>
+#include <vector>
+
+// Include all other HepRep header files here for convenience
+#include "HEPREP/HasHepRep.h"
+#include "HEPREP/HepRepAction.h"
+#include "HEPREP/HepRepAttDef.h"
+#include "HEPREP/HepRepAttribute.h"
+#include "HEPREP/HepRepAttributeListener.h"
+#include "HEPREP/HepRepAttValue.h"
+#include "HEPREP/HepRepConstants.h"
+#include "HEPREP/HepRepDefinition.h"
+#include "HEPREP/HepRepFactory.h"
+#include "HEPREP/HepRepFrameListener.h"
+#include "HEPREP/HepRepInstance.h"
+#include "HEPREP/HepRepInstanceTree.h"
+#include "HEPREP/HepRepIterator.h"
+#include "HEPREP/HepRepPoint.h"
+#include "HEPREP/HepRepSelectFilter.h"
+#include "HEPREP/HepRepTreeID.h"
+#include "HEPREP/HepRepType.h"
+#include "HEPREP/HepRepTypeTree.h"
+#include "HEPREP/HepRepWriter.h"
+
+namespace HEPREP {
+
+class HepRepAction;
+class HepRepInstanceTree;
+class HepRepSelectFilter;
+class HepRepTypeTree;
+
+/**
+ * The HepRep interface.
+ *
+ * Any of these methods may throw a UnsupportedOperationException in Java.
+ *
+ * This interface is NOT final yet.
+ *
+ * @author Mark Donszelmann
+ */
+class HepRep {
+
+public: 
+    /// Destructor.
+    virtual ~HepRep() { /* nop */; }
+
+    /**
+     * Add a layer to the list of layers in this heprep.
+     * The layer is added to the back of the list.
+     *
+     * @param layer name of layer to be added to the back of the list.
+     */
+    virtual void addLayer(std::string layer) = 0;
+
+    /**
+     * Returns the list of layers.
+     *
+     * @return the known layer names, in the order back-to-front.
+     */
+    virtual std::vector<std::string>  getLayerOrder() = 0;
+
+    /**
+     * Add a typetree to this heprep.
+     *
+     * @param typeTree to be added.
+     */
+    virtual void addTypeTree(HepRepTypeTree * typeTree) = 0;
+
+    /**
+     * Remove a typetree from this heprep.
+     *
+     * @param typeTree to be removed.
+     */
+    virtual void removeTypeTree(HepRepTypeTree * typeTree) = 0;
+
+    /**
+     * Returns the collection of all typetrees of this heprep.
+     *
+     * @return collection of HepRepTypeTrees.
+     */
+    virtual std::vector<HepRepTypeTree *>  getTypeTreeList() = 0;
+
+    /**
+     * Returns a named and versioned typetree.
+     *
+     * @param name name of the typetree.
+     * @param version version of the typetree.
+     * @return named and versioned HepRepTypeTree.
+     */
+    virtual HepRepTypeTree * getTypeTree(std::string name, std::string version) = 0;
+
+    /**
+     * Searches for a named type in any of the typetrees.
+     * The first occurrence found is returned.
+     *
+     * @param name name of type.
+     * @return named HepRepType.
+     */
+//    HepRepType* getType(String name);
+    /**
+     * Adds an instancetree to this heprep.
+     *
+     * @param instanceTree to be added.
+     */
+    virtual void addInstanceTree(HepRepInstanceTree * instanceTree) = 0;
+
+    /**
+     * Overlays an instancetree to this heprep, overriding attributes and adding children.
+     *
+     * @param instanceTree to be overlaid.
+     */
+    virtual void overlayInstanceTree(HepRepInstanceTree * instanceTree) = 0;
+
+    /**
+     * Remove an instanectree from this heprep.
+     *
+     * @param instanceTree to be removed.
+     */
+    virtual void removeInstanceTree(HepRepInstanceTree * instanceTree) = 0;
+
+    /**
+     * Returns a collection of instancetrees.
+     *
+     * @return collection of HepRepInstanceTrees.
+     */
+    virtual std::vector<HepRepInstanceTree *>  getInstanceTreeList() = 0;
+
+    /**
+     * Returns a named and versioned instancetree.
+     * FIXME: doc is incorrect here, should only return TOP of the tree. Filling
+     * in should be done by getInstances calls.
+     * <p>
+     * This tree needs to be added to the heprep afterwards.
+     *
+     * @param name name of the instancetree.
+     * @param version version of the instancetree.
+     * @return HepRepIntanceTree
+     */
+    virtual HepRepInstanceTree * getInstanceTreeTop(std::string name, std::string version) = 0;
+
+    /**
+     * Returns a named and versioned instancetree for a list of typenames.
+     * <p>
+     * This tree needs to be added to the heprep afterwards.
+     *
+     * @param name name of the instancetree.
+     * @param version version of the instancetree.
+     * @param typeNames a list of typenames for which we need instancetrees.
+     * @return HepRepIntanceTree
+     */
+    virtual HepRepInstanceTree * getInstances(std::string name, std::string version, std::vector<std::string>  typeNames) = 0;
+
+    /**
+     * Returns a named and versioned instancetree for a list of typenames
+     * after executing some action and for specific filters.
+     *
+     * This tree needs to be added to the heprep afterwards.
+     * <p>
+     * The inversion effect of invertAtts depends on the values of
+     * GetDrawAtts and GetNonDrawAtts as follows:
+     * <UL>
+     * <LI>GetDrawAtts	GetNonDrawAtts	effect of InvertAtts
+     * <LI>FALSE		FALSE			all Attributes specified will be downloaded
+     * <LI>TRUE		    FALSE			Draw Attributes specified will be omitted, NonDraw Attributes specified will be included
+     * <LI>FALSE		TRUE			Draw Attributes specified will be included, NonDraw Attributes specified will be omitted
+     * <LI>TRUE		    TRUE			all Attributes specified will be omitted
+     * </UL>
+     *
+     * @param name name of the instancetree.
+     * @param version version of the instancetree.
+     * @param typeNames a list of typenames for which we need instancetrees.
+     * @param actions execute this list of actions before returning.
+     * @param getPoints include the HepRepPoints in the instance tree.
+     * @param getDrawAtts include the Draw attributes in the instance tree.
+     * @param getNonDrawAtts include the Non-Draw attributes in the instance tree.
+     * @param invertAtts list of attributes to be included or not depending on getDrawAtts and getNonDrawAtts.
+     * @return HepRepIntanceTree
+     */
+    virtual HepRepInstanceTree * getInstancesAfterAction(std::string name, std::string version, std::vector<std::string>  typeNames, std::vector<HepRepAction *>  actions, bool getPoints, bool getDrawAtts, bool getNonDrawAtts, std::vector<std::string>  invertAtts) = 0;
+
+    /**
+     * Returns last exception thrown and clears it. Useful for implementations without
+     * exception handling.
+     *
+     * @return last exception and clears it.
+     */
+    virtual std::string checkForException() = 0;
+
+    /**
+     * Returns a deep copy of the heprep, with all its attached trees, where
+     * instances are filtered using a HepRepSelectFilter.
+     *
+     * @param filter to be used for filtering instances.
+     * @return copy of heprep.
+     */
+    virtual HepRep * copy(HepRepSelectFilter * filter = NULL) = 0;
+}; // class
+} // namespace HEPREP
+#endif /* ifndef HEPREP_HEPREP_H */
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepAction.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepAction.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepAction.h	(revision 1102)
@@ -0,0 +1,49 @@
+// -*- C++ -*-
+// AID-GENERATED
+// =========================================================================
+// This class was generated by AID - Abstract Interface Definition          
+// DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it. 
+// =========================================================================
+#ifndef HEPREP_HEPREPACTION_H
+#define HEPREP_HEPREPACTION_H 1
+
+// Copyright 2000-2005, FreeHEP.
+
+#include <string>
+
+namespace HEPREP {
+
+/**
+ * HepRepAction interface.
+ *
+ * @author Mark Donszelmann
+ */
+class HepRepAction {
+
+public: 
+    /// Destructor.
+    virtual ~HepRepAction() { /* nop */; }
+
+    /**
+     * Returns name of this action.
+     *
+     * @return name of this action.
+     */
+    virtual std::string getName() = 0;
+
+    /**
+     * Returns expression associated with this action.
+     *
+     * @return expression of this action.
+     */
+    virtual std::string getExpression() = 0;
+
+    /**
+     * Returns a deep copy of this action.
+     *
+     * @return copy of this action.
+     */
+    virtual HepRepAction * copy() = 0;
+}; // class
+} // namespace HEPREP
+#endif /* ifndef HEPREP_HEPREPACTION_H */
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepAttDef.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepAttDef.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepAttDef.h	(revision 1102)
@@ -0,0 +1,70 @@
+// -*- C++ -*-
+// AID-GENERATED
+// =========================================================================
+// This class was generated by AID - Abstract Interface Definition          
+// DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it. 
+// =========================================================================
+#ifndef HEPREP_HEPREPATTDEF_H
+#define HEPREP_HEPREPATTDEF_H 1
+
+// Copyright 2000-2005, FreeHEP.
+
+#include <string>
+
+namespace HEPREP {
+
+/**
+ * HepRepAttDef interface.
+ *
+ * @author Mark Donszelmann
+ */
+class HepRepAttDef {
+
+public: 
+    /// Destructor.
+    virtual ~HepRepAttDef() { /* nop */; }
+
+    /**
+     * Returns the mixed case name of this attdef.
+     *
+     * @return name.
+     */
+    virtual std::string getName() = 0;
+
+    /**
+     * Returns the lowercased name of this attdef.
+     *
+     * @return lowercased name.
+     */
+    virtual std::string getLowerCaseName() = 0;
+
+    /**
+     * Returns a description of this attdef.
+     *
+     * @return description.
+     */
+    virtual std::string getDescription() = 0;
+
+    /**
+     * Returns category of this attdef.
+     *
+     * @return category.
+     */
+    virtual std::string getCategory() = 0;
+
+    /**
+     * Returns any extra information of this attdef.
+     *
+     * @return extra info.
+     */
+    virtual std::string getExtra() = 0;
+
+    /**
+     * Returns a deep copy of this attdef.
+     *
+     * @return copy of this attdef.
+     */
+    virtual HepRepAttDef * copy() = 0;
+}; // class
+} // namespace HEPREP
+#endif /* ifndef HEPREP_HEPREPATTDEF_H */
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepAttValue.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepAttValue.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepAttValue.h	(revision 1102)
@@ -0,0 +1,129 @@
+// -*- C++ -*-
+// AID-GENERATED
+// =========================================================================
+// This class was generated by AID - Abstract Interface Definition          
+// DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it. 
+// =========================================================================
+#ifndef HEPREP_HEPREPATTVALUE_H
+#define HEPREP_HEPREPATTVALUE_H 1
+
+// Copyright 2000-2005, FreeHEP.
+
+#include <string>
+#include <vector>
+
+#include "HEPREP/Types.h"
+
+namespace HEPREP {
+
+/**
+ * HepRepAttValue interface.
+ *
+ * @author Mark Donszelmann
+ */
+class HepRepAttValue {
+
+public: 
+    /// Destructor.
+    virtual ~HepRepAttValue() { /* nop */; }
+
+    /**
+     * Returns name of the attvalue.
+     *
+     * @return Capitalized Name.
+     */
+    virtual std::string getName() = 0;
+
+    /**
+     * Returns lowercased name of the attvalue.
+     *
+     * @return Lowercased Name.
+     */
+    virtual std::string getLowerCaseName() = 0;
+
+    /**
+     * Returns type of the attvalue, defined in HepRepConstants with names TYPE_xxx.
+     *
+     * @return type.
+     */
+    virtual int getType() = 0;
+
+    /**
+     * Returns the Java-like name for the type of this attvalue.
+     *
+     * @return type name.
+     */
+    virtual std::string getTypeName() = 0;
+
+    /**
+     * Returns the flag bits for showing this attvalue as a label, defined in HepRepConstants with names SHOW_xxx.
+     *
+     * @return flag bits if should be shown as label.
+     */
+    virtual int showLabel() = 0;
+
+    /**
+     * Returns value as string.
+     *
+     * @return value as string (if type is string).
+     */
+    virtual std::string getString() = 0;
+
+    /**
+     * Returns value as lowercase string.
+     *
+     * @return value as string (if type is string).
+     */
+    virtual std::string getLowerCaseString() = 0;
+
+    /**
+     * Returns value as string.
+     *
+     * @return value (of any type) in string format.
+     */
+    virtual std::string getAsString() = 0;
+
+    /**
+     * Returns value as Color.
+     *
+     * @return value as Color.
+     */
+    virtual std::vector<double> getColor() = 0;
+
+    /**
+     * Returns value as long.
+     *
+     * @return value as long.
+     */
+    virtual int64 getLong() = 0;
+
+    /**
+     * Returns value as int.
+     *
+     * @return value as integer.
+     */
+    virtual int getInteger() = 0;
+
+    /**
+     * Returns value as double.
+     *
+     * @return value as double.
+     */
+    virtual double getDouble() = 0;
+
+    /**
+     * Returns value as boolean.
+     *
+     * @return value as boolean.
+     */
+    virtual bool getBoolean() = 0;
+
+    /**
+     * Returns a deep copy of this attvalue.
+     *
+     * @return copy of this attvalue.
+     */
+    virtual HepRepAttValue * copy() = 0;
+}; // class
+} // namespace HEPREP
+#endif /* ifndef HEPREP_HEPREPATTVALUE_H */
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepAttribute.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepAttribute.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepAttribute.h	(revision 1102)
@@ -0,0 +1,153 @@
+// -*- C++ -*-
+// AID-GENERATED
+// =========================================================================
+// This class was generated by AID - Abstract Interface Definition          
+// DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it. 
+// =========================================================================
+#ifndef HEPREP_HEPREPATTRIBUTE_H
+#define HEPREP_HEPREPATTRIBUTE_H 1
+
+// Copyright 2000-2005, FreeHEP.
+
+#include <set>
+#include <string>
+#include <vector>
+
+#include "HEPREP/Types.h"
+
+#include "HEPREP/HepRepConstants.h"
+
+namespace HEPREP {
+
+class HepRepAttValue;
+
+/**
+ * HepRepAttribute interface.
+ *
+ * @author Mark Donszelmann
+ */
+class HepRepAttribute {
+
+public: 
+    /// Destructor.
+    virtual ~HepRepAttribute() { /* nop */; }
+
+    /**
+     * Adds an attValue.
+     *
+     * @param attValue to be added.
+     */
+    virtual void addAttValue(HepRepAttValue * attValue) = 0;
+
+
+    /**
+     * Adds a char* attValue as a String.
+     * This call should be mapped to addAttValue(std::string, std::string, int); and necessary
+     * because C++ converts char* into bool and would thus call addAttValue(std::string, bool, int)
+     * for a call such as addAttValue("drawAs", "Cylinder", 0);
+     *
+     * @param key name of attValue
+     * @param value value of attValue
+     * @param showLabel show this as label
+     */
+    virtual void addAttValue(std::string key, char* value, int showLabel = HepRepConstants::SHOW_NONE) = 0;
+    /**
+     * Adds an attValue.
+     *
+     * @param key name of attValue
+     * @param value value of attValue
+     * @param showLabel show this as label
+     */
+    virtual void addAttValue(std::string key, std::string value, int showLabel = HepRepConstants::SHOW_NONE) = 0;
+
+    /**
+     * Adds an attValue.
+     *
+     * @param key name of attValue
+     * @param value value of attValue
+     * @param showLabel show this as label
+     */
+    virtual void addAttValue(std::string key, int64 value, int showLabel = HepRepConstants::SHOW_NONE) = 0;
+
+    /**
+     * Adds an attValue.
+     *
+     * @param key name of attValue
+     * @param value value of attValue
+     * @param showLabel show this as label
+     */
+    virtual void addAttValue(std::string key, int value, int showLabel = HepRepConstants::SHOW_NONE) = 0;
+
+    /**
+     * Adds an attValue.
+     *
+     * @param key name of attValue
+     * @param value value of attValue
+     * @param showLabel show this as label
+     */
+    virtual void addAttValue(std::string key, double value, int showLabel = HepRepConstants::SHOW_NONE) = 0;
+
+    /**
+     * Adds an attValue.
+     *
+     * @param key name of attValue
+     * @param value value of attValue
+     * @param showLabel show this as label
+     */
+    virtual void addAttValue(std::string key, bool value, int showLabel = HepRepConstants::SHOW_NONE) = 0;
+
+    /**
+     * Adds a Color attValue.
+     *
+     * @param key name of attValue
+     * @param value value of attValue
+     * @param showLabel show this as label
+     */
+    virtual void addAttValue(std::string key, std::vector<double> value, int showLabel = HepRepConstants::SHOW_NONE) = 0;
+
+    /**
+     * Adds a Color attValue.
+     *
+     * @param key name of attValue
+     * @param red color
+     * @param green color
+     * @param blue color
+     * @param alpha value
+     * @param showLabel show this as label
+     */
+    virtual void addAttValue(std::string key, double red, double green, double blue, double alpha = 1.0, int showLabel = HepRepConstants::SHOW_NONE) = 0;
+
+    /**
+     * Remove the attvalue named by key.
+     *
+     * @param key name of the attValue to be removed.
+     * @return removed HepRepAttValue, or null if not removed.
+     */
+    virtual HepRepAttValue * removeAttValue(std::string key) = 0;
+
+    /**
+     * Returns the attValue specified by name. This attValue is normally searched
+     * on the node itself and then on its type, moving up the typetree.
+     *
+     * @param name of attribute value.
+     * @return attribute value.
+     */
+    virtual HepRepAttValue * getAttValue(std::string name) = 0;
+
+    /**
+     * Returns a collection of all attribute values from this node.
+     *
+     * @return collection of HepRepAttValues.
+     */
+    virtual std::set<HepRepAttValue *>  getAttValuesFromNode() = 0;
+
+    /**
+     * Returns a named attribute value from this node.
+     *
+     * @param lowerCaseName name in all lowercase.
+     * @return corresponding HepRepAttValue.
+     */
+    virtual HepRepAttValue * getAttValueFromNode(std::string lowerCaseName) = 0;
+}; // class
+} // namespace HEPREP
+#endif /* ifndef HEPREP_HEPREPATTRIBUTE_H */
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepAttributeListener.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepAttributeListener.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepAttributeListener.h	(revision 1102)
@@ -0,0 +1,103 @@
+// -*- C++ -*-
+// AID-GENERATED
+// =========================================================================
+// This class was generated by AID - Abstract Interface Definition          
+// DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it. 
+// =========================================================================
+#ifndef HEPREP_HEPREPATTRIBUTELISTENER_H
+#define HEPREP_HEPREPATTRIBUTELISTENER_H 1
+
+// Copyright 2000-2005, FreeHEP.
+
+#include <string>
+#include <vector>
+
+namespace HEPREP {
+
+class HepRepInstance;
+
+/**
+ * HepRepAttributeListener interface. The implementor is called back for changes
+ * of attributes while using the HepRepIterator to iterate over all the HepRepInstances.
+ *
+ * All names are lowercased.
+ *
+ * @author Mark Donszelmann
+ */
+class HepRepAttributeListener {
+
+public: 
+    /// Destructor.
+    virtual ~HepRepAttributeListener() { /* nop */; }
+
+    /**
+     * Called if attribute key changes its value.
+     *
+     * @param instance instance for which this attribute is set.
+     * @param key name of the changed attribute.
+     * @param value value of the changed attribute.
+     * @param lowerCaseValue lower case value of the changed attribute.
+     * @param showLabel value of showLabel.
+     */
+    virtual void setAttribute(HepRepInstance * instance, std::string key, std::string value, std::string lowerCaseValue, int showLabel) = 0;
+
+    /**
+     * Called if attribute key changes its value.
+     *
+     * @param instance instance for which this attribute is set.
+     * @param key name of the changed attribute.
+     * @param value value of the changed attribute.
+     * @param showLabel value of showLabel.
+     */
+    virtual void setAttribute(HepRepInstance * instance, std::string key, std::vector<double> value, int showLabel) = 0;
+
+    /**
+     * Called if attribute key changes its value.
+     *
+     * @param instance instance for which this attribute is set.
+     * @param key name of the changed attribute.
+     * @param value value of the changed attribute.
+     * @param showLabel value of showLabel.
+     */
+    virtual void setAttribute(HepRepInstance * instance, std::string key, long value, int showLabel) = 0;
+
+    /**
+     * Called if attribute key changes its value.
+     *
+     * @param instance instance for which this attribute is set.
+     * @param key name of the changed attribute.
+     * @param value value of the changed attribute.
+     * @param showLabel value of showLabel.
+     */
+    virtual void setAttribute(HepRepInstance * instance, std::string key, int value, int showLabel) = 0;
+
+    /**
+     * Called if attribute key changes its value.
+     *
+     * @param instance instance for which this attribute is set.
+     * @param key name of the changed attribute.
+     * @param value value of the changed attribute.
+     * @param showLabel value of showLabel.
+     */
+    virtual void setAttribute(HepRepInstance * instance, std::string key, double value, int showLabel) = 0;
+
+    /**
+     * Called if attribute key changes its value.
+     *
+     * @param instance instance for which this attribute is set.
+     * @param key name of the changed attribute.
+     * @param value value of the changed attribute.
+     * @param showLabel value of showLabel.
+     */
+    virtual void setAttribute(HepRepInstance * instance, std::string key, bool value, int showLabel) = 0;
+
+    /**
+     * Called if attribute key is removed from the attribute set.
+     *
+     * @param instance instance for which this attribute is set.
+     * @param key name of the removed attribute.
+     */
+    virtual void removeAttribute(HepRepInstance * instance, std::string key) = 0;
+}; // class
+} // namespace HEPREP
+#endif /* ifndef HEPREP_HEPREPATTRIBUTELISTENER_H */
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepConstants.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepConstants.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepConstants.h	(revision 1102)
@@ -0,0 +1,36 @@
+// -*- C++ -*-
+// AID-GENERATED
+// =========================================================================
+// This class was generated by AID - Abstract Interface Definition          
+// DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it. 
+// =========================================================================
+#ifndef HEPREP_HEPREPCONSTANTS_H
+#define HEPREP_HEPREPCONSTANTS_H 1
+
+// Copyright 2000-2005, FreeHEP.
+
+namespace HEPREP {
+
+/**
+ * Constants for HepRep interfaces.
+ *
+ * @author Mark Donszelmann
+ */
+class HepRepConstants {
+
+public: 
+    /// Destructor.
+    virtual ~HepRepConstants() { /* nop */; }
+
+    /**
+     * Defines constants for type
+     */
+    enum { TYPE_UNKNOWN = -1, TYPE_STRING = 1, TYPE_COLOR = 2, TYPE_LONG = 10, TYPE_INT = 11, TYPE_DOUBLE = 20, TYPE_BOOLEAN = 30 };
+
+    /**
+     * Defines constants for showLabel
+     */
+    enum { SHOW_NONE = 0x0000, SHOW_NAME = 0x0001, SHOW_DESC = 0x0002, SHOW_VALUE = 0x0004, SHOW_EXTRA = 0x0008 };
+}; // class
+} // namespace HEPREP
+#endif /* ifndef HEPREP_HEPREPCONSTANTS_H */
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepDefinition.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepDefinition.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepDefinition.h	(revision 1102)
@@ -0,0 +1,74 @@
+// -*- C++ -*-
+// AID-GENERATED
+// =========================================================================
+// This class was generated by AID - Abstract Interface Definition          
+// DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it. 
+// =========================================================================
+#ifndef HEPREP_HEPREPDEFINITION_H
+#define HEPREP_HEPREPDEFINITION_H 1
+
+// Copyright 2000-2005, FreeHEP.
+
+#include <set>
+#include <string>
+
+#include "HEPREP/HepRepAttribute.h"
+
+namespace HEPREP {
+
+class HepRepAttDef;
+
+/**
+ * HepRepDefinition interface.
+ *
+ * @author Mark Donszelmann
+ *
+ */
+class HepRepDefinition : virtual public HepRepAttribute {
+
+public: 
+    /// Destructor.
+    virtual ~HepRepDefinition() { /* nop */; }
+
+    /**
+     * Adds an attdef.
+     *
+     * @param name name of the definition.
+     * @param desc description of the definition.
+     * @param category category of the definition.
+     * @param extra extra info of the definition.
+     */
+    virtual void addAttDef(std::string name, std::string desc, std::string category, std::string extra) = 0;
+
+    /**
+     * Adds an attdef.
+     *
+     * @param attDef to be added.
+     */
+    virtual void addAttDef(HepRepAttDef * attDef) = 0;
+
+    /**
+     * Return a named attribute definition searched on this node and any parent nodes.
+     *
+     * @param name of attribute definition.
+     * @return attribute definition.
+     */
+    virtual HepRepAttDef * getAttDef(std::string name) = 0;
+
+    /**
+     * Returns a collection of all attribute definitions defined on this node.
+     *
+     * @return collection of attributes definitions.
+     */
+    virtual std::set<HepRepAttDef *>  getAttDefsFromNode() = 0;
+
+    /**
+     * Returns a named attribute definition defined on this node.
+     *
+     * @param lowerCaseName name of the attribute in lower case.
+     * @return attribute definition.
+     */
+    virtual HepRepAttDef * getAttDefFromNode(std::string lowerCaseName) = 0;
+}; // class
+} // namespace HEPREP
+#endif /* ifndef HEPREP_HEPREPDEFINITION_H */
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepFactory.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepFactory.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepFactory.h	(revision 1102)
@@ -0,0 +1,148 @@
+// -*- C++ -*-
+// AID-GENERATED
+// =========================================================================
+// This class was generated by AID - Abstract Interface Definition          
+// DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it. 
+// =========================================================================
+#ifndef HEPREP_HEPREPFACTORY_H
+#define HEPREP_HEPREPFACTORY_H 1
+
+// Copyright 2000-2005, FreeHEP.
+
+#include <iostream>
+#include <string>
+
+namespace HEPREP {
+
+class HepRep;
+class HepRepAction;
+class HepRepInstance;
+class HepRepInstanceTree;
+class HepRepPoint;
+class HepRepReader;
+class HepRepTreeID;
+class HepRepType;
+class HepRepTypeTree;
+class HepRepWriter;
+
+/**
+ * HepRepFactory interface.
+ *
+ * @author Mark Donszelmann
+ */
+class HepRepFactory {
+
+public: 
+    /// Destructor.
+    virtual ~HepRepFactory() { /* nop */; }
+
+    /**
+     * Creates a HepRepReader from a stream.
+     *
+     * @param in input stream.
+     */
+    virtual HepRepReader * createHepRepReader(std::istream * in) = 0;
+
+    /**
+     * Creates a HepRepReader from a file name.
+     *
+     * @param inputFileName file name.
+     */
+    virtual HepRepReader * createHepRepReader(std::string inputFileName) = 0;
+
+    /**
+     * Creates a HepRepWriter.
+     *
+     * @param out output stream.
+     * @param randomAccess create a writer in a format that will allow random access (may be ignored).
+     * @param compress create a writer that uses compression (may be ignored).
+     */
+    virtual HepRepWriter * createHepRepWriter(std::ostream * out, bool randomAccess, bool compress) = 0;
+
+    /**
+     * Creates a HepRepPoint.
+     *
+     * @param instance to add the point to.
+     * @param x x coordinate of point.
+     * @param y y coordinate of point.
+     * @param z z coordinate of point.
+     */
+    virtual HepRepPoint * createHepRepPoint(HepRepInstance * instance, double x, double y, double z) = 0;
+
+    /**
+     * Creates a HepRepInstance.
+     *
+     * @parent to add the instance to.
+     * @type type the associated type.
+     */
+    virtual HepRepInstance * createHepRepInstance(HepRepInstance * parent, HepRepType * type) = 0;
+
+    /**
+     * Creates a HepRepInstance.
+     *
+     * @parent to add the instance to.
+     * @type type the associated type.
+     */
+    virtual HepRepInstance * createHepRepInstance(HepRepInstanceTree * parent, HepRepType * type) = 0;
+
+    /**
+     * Creates a HepRepTreeID.
+     *
+     * @param name of the treeID.
+     * @param version of the treeID.
+     * @param qualifier of the treeID.
+     */
+    virtual HepRepTreeID * createHepRepTreeID(std::string name, std::string version, std::string qualifier = "top-level") = 0;
+
+    /**
+     * Creates a HepRepAction.
+     *
+     * @param name of the action.
+     * @param expression of the action.
+     */
+    virtual HepRepAction * createHepRepAction(std::string name, std::string expression) = 0;
+
+    /**
+     * Creates a HepRepInstanceTree.
+     * <p>
+     * The tree needs to be added to the HepRep.
+     *
+     * @param name of the instancetree.
+     * @param version of the instancetree.
+     * @param typeTree associated typetree.
+     */
+    virtual HepRepInstanceTree * createHepRepInstanceTree(std::string name, std::string version, HepRepTreeID * typeTree) = 0;
+
+    /**
+     * Creates a HepRepType.
+     *
+     * @param parent to add this type to.
+     * @param name of the type to create.
+     */
+    virtual HepRepType * createHepRepType(HepRepTypeTree * parent, std::string name) = 0;
+
+    /**
+     * Creates a HepRepType.
+     *
+     * @param parent to add this type to.
+     * @param name of the type to create.
+     */
+    virtual HepRepType * createHepRepType(HepRepType * parent, std::string name) = 0;
+
+    /**
+     * Creates a HepRepTypeTree.
+     * <p>
+     * The tree needs to be added to the HepRep.
+     *
+     * @param treeID to name the tree being created.
+     */
+    virtual HepRepTypeTree * createHepRepTypeTree(HepRepTreeID * treeID) = 0;
+
+    /**
+     * Creates a HepRep.
+     *
+     */
+    virtual HepRep * createHepRep() = 0;
+}; // class
+} // namespace HEPREP
+#endif /* ifndef HEPREP_HEPREPFACTORY_H */
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepFrameListener.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepFrameListener.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepFrameListener.h	(revision 1102)
@@ -0,0 +1,34 @@
+// -*- C++ -*-
+// AID-GENERATED
+// =========================================================================
+// This class was generated by AID - Abstract Interface Definition          
+// DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it. 
+// =========================================================================
+#ifndef HEPREP_HEPREPFRAMELISTENER_H
+#define HEPREP_HEPREPFRAMELISTENER_H 1
+
+// Copyright 2004-2005, FreeHEP.
+
+namespace HEPREP {
+
+/**
+ * HepRepFrameListener interface. The implementor is called back for changes in
+ * drawing in or out of the frame layer.
+ *
+ * @author Mark Donszelmann
+ */
+class HepRepFrameListener {
+
+public: 
+    /// Destructor.
+    virtual ~HepRepFrameListener() { /* nop */; }
+
+    /**
+     * Called if we switch from a normal layer to a frame layer, and back.
+     *
+     * @param inFrame true if in a frame layer
+     */
+    virtual void setFrameLayer(bool inFrame) = 0;
+}; // class
+} // namespace HEPREP
+#endif /* ifndef HEPREP_HEPREPFRAMELISTENER_H */
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepInstance.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepInstance.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepInstance.h	(revision 1102)
@@ -0,0 +1,138 @@
+// -*- C++ -*-
+// AID-GENERATED
+// =========================================================================
+// This class was generated by AID - Abstract Interface Definition          
+// DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it. 
+// =========================================================================
+#ifndef HEPREP_HEPREPINSTANCE_H
+#define HEPREP_HEPREPINSTANCE_H 1
+
+// Copyright 2000-2005, FreeHEP.
+
+#include <vector>
+
+#include "HEPREP/HepRepAttribute.h"
+
+namespace HEPREP {
+
+class HepRepInstanceTree;
+class HepRepPoint;
+class HepRepSelectFilter;
+class HepRepType;
+class HepRepTypeTree;
+
+/**
+ * HepRepInstance interface.
+ *
+ * @author Mark Donszelmann
+ */
+class HepRepInstance : virtual public HepRepAttribute {
+
+public: 
+    /// Destructor.
+    virtual ~HepRepInstance() { /* nop */; }
+
+    /**
+     * Overlays the instance on the current instance.
+     *
+     * Attributes of the instance override or are added to the current instance.
+     * Sub-instances of the instance are added only if the current instance has no sub-instances.
+     * Points of the instance are added only if the current instance has no points.
+     */
+    virtual void overlay(HepRepInstance * instance) = 0;
+
+    /**
+     * Adds an sub-instance to this instance.
+     *
+     * @param instance sub-instance.
+     */
+    virtual void addInstance(HepRepInstance * instance) = 0;
+
+    /**
+     * Removes a sub-instance from this instance.
+     *
+     * @param instance sub-instance.
+     */
+    virtual void removeInstance(HepRepInstance * instance) = 0;
+
+    /**
+     * Returns a collection of all sub-instances this instance keeps.
+     *
+     * @return collection of HepRepInstances.
+     */
+    virtual std::vector<HepRepInstance *>  getInstances() = 0;
+
+    /**
+     * Returns the associated type for this instance.
+     *
+     * @return associated HepRepType.
+     */
+    virtual HepRepType * getType() = 0;
+
+    /**
+     * Adds a point to this instance.
+     *
+     * @param point to be added.
+     */
+    virtual void addPoint(HepRepPoint * point) = 0;
+
+    /**
+     * Returns a collection of all points this instance keeps.
+     *
+     * @return collection of HepRepPoints.
+     */
+    virtual std::vector<HepRepPoint *>  getPoints() = 0;
+
+    /**
+     * Fills a double[3][n] array with the coordinates of all points, if
+     * none of the points have any attributes defined on them.
+     * The actual number of points filled is returned. In case the number
+     * of points is larger than n, or if any points have attributes, -1 is returned.
+     * One could then call getPoint().
+     *
+     * @see #getPoints()
+     *
+     * @param xyz a double[3][n] array to be filled with points.
+     * @return number of points filled in xyz, or -1 in case of error or non-implementation.
+     *
+     * ONLY in JAVA
+     */
+    /**
+     * Returns true if this instance has a frame. Speedy access for iterator.
+     *
+     * ONLY in JAVA
+     */
+    /**
+     * Returns String layername. Speedy access for iterator.
+     *
+     * ONLY in JAVA
+     */
+    /**
+     * Returns the parent of this instance.
+     *
+     * @return parent of instance, or null if top-level.
+     */
+    virtual HepRepInstance * getSuperInstance() = 0;
+
+    /**
+     * Returns a deep copy of this instance.
+     *
+     * @param typeTree needed to find the associated type.
+     * @param parent to which the copy is added.
+     * @param filter run on all instances before copying.
+     * @return copy of this instance.
+     */
+    virtual HepRepInstance * copy(HepRepTypeTree * typeTree, HepRepInstance * parent, HepRepSelectFilter * filter = NULL) = 0;
+
+    /**
+     * Returns a deep copy of this instance.
+     *
+     * @param typeTree needed to find the associated type.
+     * @param parent to which the copy is added.
+     * @param filter run on all instances before copying.
+     * @return copy of this instance.
+     */
+    virtual HepRepInstance * copy(HepRepTypeTree * typeTree, HepRepInstanceTree * parent, HepRepSelectFilter * filter = NULL) = 0;
+}; // class
+} // namespace HEPREP
+#endif /* ifndef HEPREP_HEPREPINSTANCE_H */
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepInstanceTree.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepInstanceTree.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepInstanceTree.h	(revision 1102)
@@ -0,0 +1,92 @@
+// -*- C++ -*-
+// AID-GENERATED
+// =========================================================================
+// This class was generated by AID - Abstract Interface Definition          
+// DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it. 
+// =========================================================================
+#ifndef HEPREP_HEPREPINSTANCETREE_H
+#define HEPREP_HEPREPINSTANCETREE_H 1
+
+// Copyright 2000-2005, FreeHEP.
+
+#include <vector>
+
+#include "HEPREP/HepRepTreeID.h"
+
+namespace HEPREP {
+
+class HepRepInstance;
+class HepRepSelectFilter;
+class HepRepTreeID;
+class HepRepTypeTree;
+
+/**
+ * HepRepInstanceTree interface.
+ *
+ * @author Mark Donszelmann
+ */
+class HepRepInstanceTree : virtual public HepRepTreeID {
+
+public: 
+    /// Destructor.
+    virtual ~HepRepInstanceTree() { /* nop */; }
+
+    /**
+     * Overlays the instance tree on the current tree.
+     *
+     * The list of instances of the instanceTree has to be the same as the current tree.
+     */
+    virtual void overlay(HepRepInstanceTree * instanceTree) = 0;
+
+    /**
+     * Adds an instance to this instancetree.
+     *
+     * @param instance to be added.
+     */
+    virtual void addInstance(HepRepInstance * instance) = 0;
+
+    /**
+     * Removes an instance from this instancetree.
+     *
+     * @param instance to be removed.
+     */
+    virtual void removeInstance(HepRepInstance * instance) = 0;
+
+    /**
+     * Returns a collection of instances.
+     *
+     * @return collection of HepRepInstances.
+     */
+    virtual std::vector<HepRepInstance *>  getInstances() = 0;
+
+    /**
+     * Adds a related instance tree to this instancetree.
+     *
+     * @param instanceTree related instancetree.
+     */
+    virtual void addInstanceTree(HepRepTreeID * instanceTree) = 0;
+
+    /**
+     * Returns a collection of associated instance trees.
+     *
+     * @return collection of HepRepTreeIDs.
+     */
+    virtual std::vector<HepRepTreeID *>  getInstanceTreeList() = 0;
+
+    /**
+     * Returns the associated typetree.
+     *
+     * @return TreeID of the associated typetree.
+     */
+    virtual HepRepTreeID * getTypeTree() = 0;
+
+    /**
+     * Returns a deep copy of this instancetree.
+     *
+     * @param filter to filter the instances.
+     * @return copy of this instancetree.
+     */
+    virtual HepRepInstanceTree * copy(HepRepTypeTree * typeTree, HepRepSelectFilter * filter = NULL) = 0;
+}; // class
+} // namespace HEPREP
+#endif /* ifndef HEPREP_HEPREPINSTANCETREE_H */
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepIterator.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepIterator.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepIterator.h	(revision 1102)
@@ -0,0 +1,87 @@
+// -*- C++ -*-
+// AID-GENERATED
+// =========================================================================
+// This class was generated by AID - Abstract Interface Definition          
+// DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it. 
+// =========================================================================
+#ifndef HEPREP_HEPREPITERATOR_H
+#define HEPREP_HEPREPITERATOR_H 1
+
+// Copyright 2000-2005, FreeHEP.
+
+#include <string>
+
+namespace HEPREP {
+
+class HepRepAttributeListener;
+class HepRepFrameListener;
+class HepRepInstance;
+
+/**
+ * HepRepIterator interface.
+ *
+ * @author Mark Donszelmann
+ */
+class HepRepIterator {
+
+public: 
+    /// Destructor.
+    virtual ~HepRepIterator() { /* nop */; }
+
+    /**
+     * Signals if there is a next instance to iterate to.
+     *
+     * @return true if next() can be called.
+     */
+    virtual bool hasNext() = 0;
+
+    /**
+     * Returns next instance.
+     *
+     * @return next HepRepInstance.
+     */
+    virtual HepRepInstance * nextInstance() = 0;
+
+    /**
+     * Adds a listener to be informed about attribute changes while iterating.
+     *
+     * @param listener to be added.
+     */
+    virtual void addHepRepAttributeListener(std::string name, HepRepAttributeListener * listener) = 0;
+
+    /**
+     * Removes a listener.
+     *
+     * @param listener to be removed.
+     */
+    virtual void removeHepRepAttributeListener(std::string name, HepRepAttributeListener * listener) = 0;
+
+    /**
+     * Adds a listener to be informed about attribute changes while iterating.
+     *
+     * @param listener to be added.
+     */
+    virtual void addHepRepFrameListener(HepRepFrameListener * listener) = 0;
+
+    /**
+     * Removes a listener.
+     *
+     * @param listener to be removed.
+     */
+    virtual void removeHepRepFrameListener(HepRepFrameListener * listener) = 0;
+
+    /**
+     * Returns true if the current instance, just delivered by nextInstance(), is to be drawn as a frame.
+     */
+    virtual bool drawAsFrame() = 0;
+
+    /**
+     * Returns the attValue for key at the current point of iteration.
+     *
+     * @param key name of the attribute to be looked up.
+     * @return value associated to name at this point in the iteration.
+     */
+//    HepRepAttValue* getAttValue(String key);
+}; // class
+} // namespace HEPREP
+#endif /* ifndef HEPREP_HEPREPITERATOR_H */
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepPoint.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepPoint.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepPoint.h	(revision 1102)
@@ -0,0 +1,168 @@
+// -*- C++ -*-
+// AID-GENERATED
+// =========================================================================
+// This class was generated by AID - Abstract Interface Definition          
+// DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it. 
+// =========================================================================
+#ifndef HEPREP_HEPREPPOINT_H
+#define HEPREP_HEPREPPOINT_H 1
+
+// Copyright 2000-2005, FreeHEP.
+
+#include <vector>
+
+#include "HEPREP/HepRepAttribute.h"
+
+namespace HEPREP {
+
+class HepRepInstance;
+
+/**
+ * HepRepPoint interface. The HepRepMath class can be used to deal with the conversions.
+ *
+ * @author Mark Donszelmann
+ */
+class HepRepPoint : virtual public HepRepAttribute {
+
+public: 
+    /// Destructor.
+    virtual ~HepRepPoint() { /* nop */; }
+
+    /**
+     * Returns coordinate with respect to vertex at (0, 0, 0).
+     *
+     * @return dx-coordinate
+     */
+    virtual double getX() = 0;
+
+    /**
+     * Returns coordinate with respect to vertex at (0, 0, 0).
+     *
+     * @return dy-coordinate
+     */
+    virtual double getY() = 0;
+
+    /**
+     * Returns coordinate with respect to vertex at (0, 0, 0).
+     *
+     * @return dz-coordinate
+     */
+    virtual double getZ() = 0;
+
+    /**
+     * Returns coordinate with respect to vertex at (0, 0, 0).
+     *
+     * @return rho = std::sqrt(dx2+dy2);
+     */
+    virtual double getRho() = 0;
+
+    /**
+     * Returns coordinate with respect to vertex at (0, 0, 0).
+     *
+     * @return phi = std::atan2(dy, dx);
+     */
+    virtual double getPhi() = 0;
+
+    /**
+     * Returns coordinate with respect to vertex at (0, 0, 0).
+     *
+     * @return theta = std::atan2(rho, dx);
+     */
+    virtual double getTheta() = 0;
+
+    /**
+     * Returns coordinate with respect to vertex at (0, 0, 0).
+     *
+     * @return r = std::sqrt(dx2+dy2+dz2);
+     */
+    virtual double getR() = 0;
+
+    /**
+     * Returns coordinate with respect to vertex at (0, 0, 0).
+     *
+     * @return eta = -0.5*clog((1.-ct)/(1.+ct)), where ct = .cos(getTheta(dx, dy, dz));
+     */
+    virtual double getEta() = 0;
+
+    /**
+     * Returns coordinate with respect to vertex at (xVertex, yVertex, zVertex).
+     *
+     * @return dx-coordinate
+     */
+    virtual double getX(double xVertex, double yVertex, double zVertex) = 0;
+
+    /**
+     * Returns coordinate with respect to vertex at (xVertex, yVertex, zVertex).
+     *
+     * @return dy-coordinate
+     */
+    virtual double getY(double xVertex, double yVertex, double zVertex) = 0;
+
+    /**
+     * Returns coordinate with respect to vertex at (xVertex, yVertex, zVertex).
+     *
+     * @return dz-coordinate
+     */
+    virtual double getZ(double xVertex, double yVertex, double zVertex) = 0;
+
+    /**
+     * Returns coordinate with respect to vertex at (xVertex, yVertex, zVertex).
+     *
+     * @return rho = std::sqrt(dx2+dy2);
+     */
+    virtual double getRho(double xVertex, double yVertex, double zVertex) = 0;
+
+    /**
+     * Returns coordinate with respect to vertex at (xVertex, yVertex, zVertex).
+     *
+     * @return phi = std::atan2(dy, dx);
+     */
+    virtual double getPhi(double xVertex, double yVertex, double zVertex) = 0;
+
+    /**
+     * Returns coordinate with respect to vertex at (xVertex, yVertex, zVertex).
+     *
+     * @return theta = std::atan2(rho, dx);
+     */
+    virtual double getTheta(double xVertex, double yVertex, double zVertex) = 0;
+
+    /**
+     * Returns coordinate with respect to vertex at (xVertex, yVertex, zVertex).
+     *
+     * @return r = std::sqrt(dx2+dy2+dz2);
+     */
+    virtual double getR(double xVertex, double yVertex, double zVertex) = 0;
+
+    /**
+     * Returns coordinate with respect to vertex at (xVertex, yVertex, zVertex).
+     *
+     * @return eta = -0.5*clog((1.-ct)/(1.+ct)), where ct = .cos(getTheta(dx, dy, dz));
+     */
+    virtual double getEta(double xVertex, double yVertex, double zVertex) = 0;
+
+    /**
+     * Returns coordinate with respect to vertex at (0, 0, 0).
+     *
+     * @param xyz list of three coordinates which are filled and returned.
+     *            If null, a new list of three coordinates is allocated.
+     * @return list of 3 coordinates.
+     */
+    virtual std::vector<double>  * getXYZ(std::vector<double>  * xyz) = 0;
+
+    /**
+     * Returns associated instance (parent).
+     *
+     * @return HepRepInstance.
+     */
+    virtual HepRepInstance * getInstance() = 0;
+
+    /**
+     * Returns a deep copy of this point.
+     *
+     * @param parent to add the copy to.
+     * @return copy of this point.
+     */
+    virtual HepRepPoint * copy(HepRepInstance * parent) = 0;
+}; // class
+} // namespace HEPREP
+#endif /* ifndef HEPREP_HEPREPPOINT_H */
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepReader.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepReader.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepReader.h	(revision 1102)
@@ -0,0 +1,124 @@
+// -*- C++ -*-
+// AID-GENERATED
+// =========================================================================
+// This class was generated by AID - Abstract Interface Definition          
+// DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it. 
+// =========================================================================
+#ifndef HEPREP_HEPREPREADER_H
+#define HEPREP_HEPREPREADER_H 1
+
+// Copyright 2002-2004, Freehep.
+
+#include <string>
+#include <vector>
+
+namespace HEPREP {
+
+class HepRep;
+
+/**
+ * HepRepReader interface.
+ *
+ * @author Mark Donszelmann
+ */
+class HepRepReader {
+
+public: 
+    /// Destructor.
+    virtual ~HepRepReader() { /* nop */; }
+
+    /**
+     * Returns a property (if set in the heprep.properties file).
+     *
+     * @param key property name
+     * @param defaultValue value if property not found
+     */
+    virtual std::string getProperty(std::string key, std::string defaultValue) = 0;
+
+    /**
+     * Closes the reader and its underlying stream.
+     *
+     * @return false in case of a stream problem.
+     */
+    virtual bool close() = 0;
+
+    /**
+     * Allows random access.
+     *
+     * @return true if this reader provides random access
+     */
+    virtual bool hasRandomAccess() = 0;
+
+    /**
+     * Reads a HepRep by name (random access only).
+     *
+     * @param name for the heprep to be read.
+     * @return heprep.
+     */
+    virtual HepRep * read(std::string name) = 0;
+
+    /**
+     * Returns the current entry name (random acces only).
+     *
+     * @return name of the current entry or null if not supported.
+     */
+    virtual std::string entryName() = 0;
+
+    /**
+     * Returns a list of names of available entries (random rccess only). 
+     * Zip files may contain instructions to skip a number of files. These files 
+     * will not be included in the entries.
+     *
+     * @return list of entrynames or null if not supported.
+     */
+    virtual std::vector<std::string>  entryNames() = 0;
+
+    /**
+     * Allows for sequential access.
+     *
+     * @return true if sequential access is possible.
+     */
+    virtual bool hasSequentialAccess() = 0;
+
+    /**
+     * Resets a sequential HepRep reader.
+     *
+     * @return false in case of a stream problem.
+     */
+    virtual bool reset() = 0;
+
+    /**
+     * Returns the (estimated) number of HepReps in the reader.
+     * Zip files may contain instructions to skip a number of files. These files 
+     * will not be included in the estimate.
+     *
+     * @return number of HepReps, or -1 if cannot be calculated.
+     */
+    virtual int size() = 0;
+
+    /**
+     * Skips a number of HepReps in the reader.
+     * Zip files may contain instructions to skip a number of files. These files 
+     * will not be included in the count to be skipped.
+     *
+     * @param n number of HepReps to be skipped.
+     * @return number of HepReps skipped.
+     */
+    virtual int skip(int n) = 0;
+
+    /**
+     * Is there a next heprep.
+     *
+     * @return true if the next heprep is available.
+     */
+    virtual bool hasNext() = 0;
+
+    /**
+     * Reads the next HepRep from the Reader.
+     *
+     * @return heprep.
+     */
+    virtual HepRep * next() = 0;
+}; // class
+} // namespace HEPREP
+#endif /* ifndef HEPREP_HEPREPREADER_H */
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepSelectFilter.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepSelectFilter.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepSelectFilter.h	(revision 1102)
@@ -0,0 +1,36 @@
+// -*- C++ -*-
+// AID-GENERATED
+// =========================================================================
+// This class was generated by AID - Abstract Interface Definition          
+// DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it. 
+// =========================================================================
+#ifndef HEPREP_HEPREPSELECTFILTER_H
+#define HEPREP_HEPREPSELECTFILTER_H 1
+
+// Copyright 2000-2005, FreeHEP.
+
+namespace HEPREP {
+
+class HepRepInstance;
+
+/**
+ * HepRepSelectFilter interface used in copying HepReps.
+ *
+ * @author Mark Donszelmann
+ */
+class HepRepSelectFilter {
+
+public: 
+    /// Destructor.
+    virtual ~HepRepSelectFilter() { /* nop */; }
+
+    /**
+     * Selects if the given instance will pass.
+     *
+     * @param instance to be checked.
+     * @return true if instance passes.
+     */
+    virtual bool select(HepRepInstance * instance) = 0;
+}; // class
+} // namespace HEPREP
+#endif /* ifndef HEPREP_HEPREPSELECTFILTER_H */
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepTreeID.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepTreeID.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepTreeID.h	(revision 1102)
@@ -0,0 +1,64 @@
+// -*- C++ -*-
+// AID-GENERATED
+// =========================================================================
+// This class was generated by AID - Abstract Interface Definition          
+// DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it. 
+// =========================================================================
+#ifndef HEPREP_HEPREPTREEID_H
+#define HEPREP_HEPREPTREEID_H 1
+
+// Copyright 2000-2005, FreeHEP.
+
+#include <string>
+
+namespace HEPREP {
+
+/**
+ * HepRepTreeID interface.
+ *
+ * @author Mark Donszelmann
+ */
+class HepRepTreeID {
+
+public: 
+    /// Destructor.
+    virtual ~HepRepTreeID() { /* nop */; }
+
+    /**
+     * Returns the name of this treeID.
+     *
+     * @return name of treeID.
+     */
+    virtual std::string getName() = 0;
+
+    /**
+     * Returns the version of this treeID.
+     *
+     * @return version of treeID.
+     */
+    virtual std::string getVersion() = 0;
+
+    /**
+     * Returns the qualifier that qualifies the relation that this treeID has with what it refers to.
+     *
+     * @return qualifier.
+     */
+    virtual std::string getQualifier() = 0;
+
+    /**
+     * Sets the qualifier that qualifies the relation that this treeID has with what it refers to.
+     *
+     * @param qualifier to be set.
+     */
+    virtual void setQualifier(std::string qualifier) = 0;
+
+    /**
+     * Returns a deep copy of this treeID.
+     *
+     * @return copy of this treeID.
+     * @throws CloneNotSupportedException if copying is not possible.
+     */
+//    HepRepTreeID* copy() throws CloneNotSupportedException;
+}; // class
+} // namespace HEPREP
+#endif /* ifndef HEPREP_HEPREPTREEID_H */
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepType.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepType.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepType.h	(revision 1102)
@@ -0,0 +1,109 @@
+// -*- C++ -*-
+// AID-GENERATED
+// =========================================================================
+// This class was generated by AID - Abstract Interface Definition          
+// DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it. 
+// =========================================================================
+#ifndef HEPREP_HEPREPTYPE_H
+#define HEPREP_HEPREPTYPE_H 1
+
+// Copyright 2000-2005, FreeHEP.
+
+#include <string>
+#include <vector>
+
+#include "HEPREP/HepRepDefinition.h"
+
+namespace HEPREP {
+
+/**
+ * HepRepType interface.
+ *
+ * @author Mark Donszelmann
+ */
+class HepRepType : virtual public HepRepDefinition {
+
+public: 
+    /// Destructor.
+    virtual ~HepRepType() { /* nop */; }
+
+    /**
+     * Adds a sub-type to this type.
+     *
+     * @param type sub-type to be added.
+     */
+    virtual void addType(HepRepType * type) = 0;
+
+    /**
+     * Returns the name of this type.
+     * This is the full name if one uses flat-types, and the node name if one
+     * uses hierarchical typenames. It is the name supplied at construction of the type.
+     *
+     * @return name of type.
+     * @see #getFullName()
+     */
+    virtual std::string getName() = 0;
+
+    /**
+     * Returns the full name of this type.
+     * The full name is constructed from the root of the typeTree (without the typeTreeName)
+     * by concatenating all the node names separated by slashes "/". For example:
+     * Geometry/InnerDetector/Sector24/Wire20
+     *
+     * @return full name of type.
+     * @see #getName()
+     */
+    virtual std::string getFullName() = 0;
+
+    /**
+     * Returns the description of this type.
+     *
+     * @return description of type.
+     */
+    virtual std::string getDescription() = 0;
+
+    /**
+     * Sets the description of this type.
+     *
+     * @param infoURL
+     */
+    virtual void setDescription(std::string description) = 0;
+
+    /**
+     * Returns the information URL of this type.
+     *
+     * @return info URL of type.
+     */
+    virtual std::string getInfoURL() = 0;
+
+    /**
+     * Sets the information URL of this type.
+     *
+     * @param infoURL
+     */
+    virtual void setInfoURL(std::string infoURL) = 0;
+
+    /**
+     * Returns the parent of this type.
+     *
+     * @return parent of type, or null if top-level.
+     */
+    virtual HepRepType * getSuperType() = 0;
+
+    /**
+     * Returns a collection of all the sub-types of this type.
+     *
+     * @return collection of HepRepTypes.
+     */
+    virtual std::vector<HepRepType *>  getTypeList() = 0;
+
+    /**
+     * Returns a deep copy of this type.
+     *
+     * @param parent to which this copy is added.
+     * @return copy of this type.
+     */
+    virtual HepRepType * copy(HepRepType * parent) = 0;
+}; // class
+} // namespace HEPREP
+#endif /* ifndef HEPREP_HEPREPTYPE_H */
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepTypeTree.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepTypeTree.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepTypeTree.h	(revision 1102)
@@ -0,0 +1,66 @@
+// -*- C++ -*-
+// AID-GENERATED
+// =========================================================================
+// This class was generated by AID - Abstract Interface Definition          
+// DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it. 
+// =========================================================================
+#ifndef HEPREP_HEPREPTYPETREE_H
+#define HEPREP_HEPREPTYPETREE_H 1
+
+// Copyright 2000-2005, FreeHEP.
+
+#include <string>
+#include <vector>
+
+#include "HEPREP/HepRepTreeID.h"
+
+namespace HEPREP {
+
+class HepRepType;
+
+/**
+ * HepRepTypeTree interface.
+ *
+ * @author Mark Donszelmann
+ */
+class HepRepTypeTree : virtual public HepRepTreeID {
+
+public: 
+    /// Destructor.
+    virtual ~HepRepTypeTree() { /* nop */; }
+
+    /**
+     * Adds a type to this typetree.
+     *
+     * @param type to be added.
+     */
+    virtual void addType(HepRepType * type) = 0;
+
+    /**
+     * Returns a collection of all types in this tree.
+     *
+     * @return collection of HepRepTypes.
+     */
+    virtual std::vector<HepRepType *>  getTypeList() = 0;
+
+    /**
+     * Returns type
+     */
+    virtual HepRepType * getType(std::string fullName) = 0;
+
+    /**
+     * Returns a deep copy of this typetree.
+     *
+     * @return copy of this typetree.
+     */
+    virtual HepRepTypeTree * copy() = 0;
+
+//          
+// To be enable in g++ 3.0
+//    using HepRep::HepRepTreeID::copy;
+// To be disabled in g++ 3.0
+//    HepRepTreeID * copy();
+//      
+}; // class
+} // namespace HEPREP
+#endif /* ifndef HEPREP_HEPREPTYPETREE_H */
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepViewer.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepViewer.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepViewer.h	(revision 1102)
@@ -0,0 +1,34 @@
+// -*- C++ -*-
+// AID-GENERATED
+// =========================================================================
+// This class was generated by AID - Abstract Interface Definition          
+// DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it. 
+// =========================================================================
+#ifndef HEPREP_HEPREPVIEWER_H
+#define HEPREP_HEPREPVIEWER_H 1
+
+// Copyright 2000-2005, FreeHEP.
+
+namespace HEPREP {
+
+class HepRep;
+
+/**
+ * The HepRepViewer interface.
+ *
+ * @author Mark Donszelmann
+ */
+class HepRepViewer {
+
+public: 
+    /// Destructor.
+    virtual ~HepRepViewer() { /* nop */; }
+
+    /**
+     * Display a heprep
+     *
+     */
+    virtual void display(HepRep heprep) = 0;
+}; // class
+} // namespace HEPREP
+#endif /* ifndef HEPREP_HEPREPVIEWER_H */
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepWriter.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepWriter.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/HepRepWriter.h	(revision 1102)
@@ -0,0 +1,163 @@
+// -*- C++ -*-
+// AID-GENERATED
+// =========================================================================
+// This class was generated by AID - Abstract Interface Definition          
+// DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it. 
+// =========================================================================
+#ifndef HEPREP_HEPREPWRITER_H
+#define HEPREP_HEPREPWRITER_H 1
+
+// Copyright 2002-2005, Freehep.
+
+#include <string>
+#include <vector>
+
+namespace HEPREP {
+
+class HepRep;
+class HepRepAction;
+class HepRepAttDef;
+class HepRepAttValue;
+class HepRepAttribute;
+class HepRepDefinition;
+class HepRepInstance;
+class HepRepInstanceTree;
+class HepRepPoint;
+class HepRepTreeID;
+class HepRepType;
+class HepRepTypeTree;
+
+/**
+ * HepRepWriter interface.
+ *
+ * @author Mark Donszelmann
+ */
+class HepRepWriter {
+
+public: 
+    /// Destructor.
+    virtual ~HepRepWriter() { /* nop */; }
+
+    /**
+     * Adds a property, to be written to the HepRep file when closed.
+     *
+     * @param key
+     * @param value
+     * @return false in case of a stream problem.
+     */
+    virtual bool addProperty(std::string key, std::string value) = 0;
+
+    /**
+     * Closes the writer and its underlying stream.
+     *
+     * @return false in case of a stream problem.
+     */
+    virtual bool close() = 0;
+
+    /**
+     * Writes a HepRep.
+     *
+     * @param heprep to be written.
+     * @param name for the heprep to be written (for tagged access), may be ommited.
+     * @return false in case of a stream problem.
+     */
+    virtual bool write(HepRep * heprep, std::string name) = 0;
+
+    /**
+     * Writes the layerOrder.
+     *
+     * @param layerOrder to be written.
+     * @return false in case of a stream problem.
+     */
+    virtual bool write(std::vector<std::string>  layerOrder) = 0;
+
+    /**
+     * Writes a HepRepTypeTree.
+     *
+     * @param typeTree to be written.
+     * @return false in case of a stream problem.
+     */
+    virtual bool write(HepRepTypeTree * typeTree) = 0;
+
+    /**
+     * Writes a HepRepType.
+     *
+     * @param type to be written.
+     * @return false in case of a stream problem.
+     */
+    virtual bool write(HepRepType * type) = 0;
+
+    /**
+     * Writes a HepRepTreeID.
+     *
+     * @param treeID to be written.
+     * @return false in case of a stream problem.
+     */
+    virtual bool write(HepRepTreeID * treeID) = 0;
+
+    /**
+     * Writes a HepRepAction.
+     *
+     * @param action to be written.
+     * @return false in case of a stream problem.
+     */
+    virtual bool write(HepRepAction * action) = 0;
+
+    /**
+     * Writes a HepRepInstanceTree.
+     *
+     * @param instanceTree to be written.
+     * @return false in case of a stream problem.
+     */
+    virtual bool write(HepRepInstanceTree * instanceTree) = 0;
+
+    /**
+     * Writes a HepRepInstance.
+     *
+     * @param instance to be written.
+     * @return false in case of a stream problem.
+     */
+    virtual bool write(HepRepInstance * instance) = 0;
+
+    /**
+     * Writes a HepRepPoint.
+     *
+     * @param point to be written.
+     * @return false in case of a stream problem.
+     */
+    virtual bool write(HepRepPoint * point) = 0;
+
+    /**
+     * Writes a HepRepAttribute.
+     *
+     * @param attribute to be written.
+     * @return false in case of a stream problem.
+     */
+    virtual bool write(HepRepAttribute * attribute) = 0;
+
+    /**
+     * Writes a HepRepDefinition.
+     *
+     * @param definition to be written.
+     * @return false in case of a stream problem.
+     */
+    virtual bool write(HepRepDefinition * definition) = 0;
+
+    /**
+     * Writes a HepRepAttValue.
+     *
+     * @param attValue to be written.
+     * @return false in case of a stream problem.
+     */
+    virtual bool write(HepRepAttValue * attValue) = 0;
+
+    /**
+     * Writes a HepRepAttDef.
+     *
+     * @param attDef to be written.
+     * @return false in case of a stream problem.
+     */
+    virtual bool write(HepRepAttDef * attDef) = 0;
+}; // class
+} // namespace HEPREP
+#endif /* ifndef HEPREP_HEPREPWRITER_H */
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/Types.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/Types.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/Types.h	(revision 1102)
@@ -0,0 +1,36 @@
+#ifndef HEPREP_TYPES_H
+#define HEPREP_TYPES_H 1
+
+namespace HEPREP {
+
+#if defined(WIN32) && !defined(GNU_GCC)
+
+// WIN32 and NOT GNU_GCC
+typedef long int32;
+typedef __int64 int64;
+#define HEPREP_INT32_FORMAT "%d"
+#define HEPREP_INT64_FORMAT "%ld"
+
+#else // other than WIN32-MSVC
+#if defined(_LP64) 
+
+// 64 Bit Platforms
+typedef int int32;
+typedef long int64;
+#define HEPREP_INT32_FORMAT "%d"
+#define HEPREP_INT64_FORMAT "%ld"
+
+#else 
+
+// 32-Bit Platforms
+typedef long int32;
+typedef long long int64;
+#define HEPREP_INT32_FORMAT "%ld"
+#define HEPREP_INT64_FORMAT "%lld"
+
+#endif // 32-Bit Platforms
+#endif // other than WIN32-MSVC
+
+} // namespace HEPREP
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/freehep-heprep.version
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/freehep-heprep.version	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/HEPREP/freehep-heprep.version	(revision 1102)
@@ -0,0 +1,1 @@
+source = freehep-heprep-2.0.1
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/README
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/README	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/README	(revision 1102)
@@ -0,0 +1,23 @@
+Apart from the heprep1 files:
+
+G4HepRepFile.hh
+G4HepRepFileSceneHandler.hh
+G4HepRepFileViewer.hh
+G4HepRepFileXMLWriter.hh
+
+and heprep2 files:
+
+G4HepRep.hh
+G4HepRepSceneHandler.hh
+G4HepRepMessenger.hh
+G4HepRepViewer.hh
+
+the other sources are copies from the FreeHEP library
+(java.freehep.org) and are maintained there.
+
+The files starting with G4 are geant4 compliant, the others may not be.
+
+Changes made here may be overwritten.
+
+4 May 2005
+Mark Donszelmann
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/AbstractXMLWriter.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/AbstractXMLWriter.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/AbstractXMLWriter.h	(revision 1102)
@@ -0,0 +1,48 @@
+// Copyright FreeHEP, 2005.
+#ifndef ABSTRACTXMLWRITER_H
+#define ABSTRACTXMLWRITER_H 1
+
+#include "cheprep/config.h"
+
+#include <string>
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: AbstractXMLWriter.h,v 1.3 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+    
+    class AbstractXMLWriter {
+    
+        public:
+            AbstractXMLWriter(std::string defaultNameSpace) : defaultNameSpace(defaultNameSpace) {
+            }
+            virtual ~AbstractXMLWriter() {
+            }
+
+            virtual void openTag(std::string ns, std::string name) = 0;
+            virtual void printTag(std::string ns, std::string name) = 0;
+            virtual void setAttribute(std::string ns, std::string name, std::string value) = 0;
+            virtual void setAttribute(std::string ns, std::string name, double value) = 0;
+                        
+            virtual void close() = 0;
+            virtual void openDoc(std::string version = "1.0", std::string encoding = "", bool standalone = false) = 0;
+            virtual void closeDoc(bool force = false) = 0;
+            virtual void openTag(std::string name) = 0;
+            virtual void closeTag() = 0;
+            virtual void printTag(std::string name) = 0;
+            virtual void setAttribute(std::string name, char* value) = 0;
+            virtual void setAttribute(std::string name, std::string value) = 0;
+            virtual void setAttribute(std::string name, std::vector<double> value) = 0;
+            virtual void setAttribute(std::string name, int64 value) = 0;
+            virtual void setAttribute(std::string name, int value) = 0;
+            virtual void setAttribute(std::string name, bool value) = 0;
+            virtual void setAttribute(std::string name, double value) = 0;
+        
+        protected:
+            std::string defaultNameSpace;
+    };
+
+} // cheprep
+
+#endif  // ABSTRACTXMLWRITER_H
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/BHepRepWriter.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/BHepRepWriter.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/BHepRepWriter.h	(revision 1102)
@@ -0,0 +1,131 @@
+// Copyright FreeHEP, 2005.
+#ifndef CHEPREP_BHEPREPWRITER_H
+#define CHEPREP_BHEPREPWRITER_H
+
+#include "cheprep/config.h"
+
+#include <string>
+#include <iostream>
+#include <vector>
+#include <map>
+
+#include "cheprep/AbstractXMLWriter.h"
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: BHepRepWriter.h,v 1.9 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+    class BHepRepWriter : public AbstractXMLWriter {
+
+        public:
+
+            BHepRepWriter(std::ostream& os);
+            virtual ~BHepRepWriter();
+
+            void close();
+            void openDoc(std::string version = "BinaryHepRep/1.0", std::string encoding = "UTF-8", bool standalone = false);
+            void closeDoc(bool force = false);
+            void openTag(std::string name);
+            void closeTag();
+            void printTag(std::string name);
+            void setAttribute(std::string name, char* value);
+            void setAttribute(std::string name, std::string value);
+            void setAttribute(std::string name, std::vector<double> value);
+            void setAttribute(std::string name, int64 value);
+            void setAttribute(std::string name, int value);
+            void setAttribute(std::string name, bool value);
+            void setAttribute(std::string name, double value);
+
+            //
+            // Can be removed when we can properly inherit those (since names are equal to overloaded ones).
+            // 
+            void openTag(std::string ns, std::string name) {
+                openTag(ns == defaultNameSpace ? name : ns.append(":").append(name));
+            }
+            void printTag(std::string ns, std::string name) {
+                printTag(ns == defaultNameSpace ? name : ns.append(":").append(name));
+            }
+            void setAttribute(std::string ns, std::string name, std::string value) {
+                setAttribute(ns.append(":").append(name), value);
+            }
+            void setAttribute(std::string ns, std::string name, double value) {
+                setAttribute(ns.append(":").append(name), value);
+            }
+
+        private:
+            static const unsigned char WBXML_VERSION    = 0x03;
+            static const unsigned char UNKNOWN_PID      = 0x01;
+            static const unsigned char UTF8             = 0x6a;
+        
+            // standard tags
+            static const unsigned char SWITCH_PAGE      = 0x00;
+            static const unsigned char END              = 0x01;
+            static const unsigned char ENTITY           = 0x02;
+            static const unsigned char STR_I            = 0x03;
+            static const unsigned char LITERAL          = 0x04;
+            
+            static const unsigned char CONTENT          = 0x40;
+            static const unsigned char EXT_I_0          = 0x40;
+            static const unsigned char EXT_I_1          = 0x41;
+            static const unsigned char EXT_I_2          = 0x42;
+            static const unsigned char PI               = 0x43;
+            static const unsigned char LITERAL_C        = 0x44;
+            
+            static const unsigned char ATTRIBUTE        = 0x80;
+            static const unsigned char EXT_T_0          = 0x80;
+            static const unsigned char EXT_T_1          = 0x81;
+            static const unsigned char EXT_T_2          = 0x82;
+            static const unsigned char STR_T            = 0x83;
+            static const unsigned char LITERAL_A        = 0x84;
+            
+            static const unsigned char EXT_0            = 0xC0;
+            static const unsigned char EXT_1            = 0xC1;
+            static const unsigned char EXT_2            = 0xC2;
+            static const unsigned char OPAQUE           = 0xC3;
+            static const unsigned char LITERAL_AC       = 0xC4;
+            
+            // our own extensions            
+            static const unsigned char STR_D            = EXT_I_0;
+            static const unsigned char STR_R            = EXT_T_0;
+            
+            // class definitions
+            static std::map<std::string, unsigned char> tags; 
+            static std::map<std::string, unsigned char> attributes;           
+            static std::map<std::string, unsigned char> values;
+
+            // outputstream variables
+            std::ostream& os;
+            bool singlePrecision;    
+            bool isBigEndian;
+            
+            // document variables            
+            std::map<std::string, unsigned int> stringValues;
+            
+            // tag variables
+            std::map<std::string, std::string> stringAttributes;
+            std::map<std::string, std::vector<double> > colorAttributes;
+            std::map<std::string, int64> longAttributes;
+            std::map<std::string, int> intAttributes;
+            std::map<std::string, bool> booleanAttributes;
+            std::map<std::string, double> doubleAttributes;
+            
+            // point array
+            std::vector<double> points;
+            
+            // methods
+            void writeTag(std::string name, bool content = false);
+            void writePoints();
+            void writeStringDefine(std::string s);                     
+            void writeMultiByteInt(unsigned int ui);                     
+            void writeReal(double ui);
+            void writeLong(int64 i);
+            void writeInt(int i);
+            void writeByte(unsigned char b);
+            void writeString(std::string s);
+    };
+ 
+} // cheprep
+
+#endif // CHEPREP_BHEPREPWRITER_H
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/DefaultHepRep.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/DefaultHepRep.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/DefaultHepRep.h	(revision 1102)
@@ -0,0 +1,63 @@
+// Copyright FreeHEP, 2005.
+#ifndef CHEPREP_DEFAULTHEPREP_H
+#define CHEPREP_DEFAULTHEPREP_H 1
+
+#include "cheprep/config.h"
+
+#include <string>
+#include <vector>
+#include <set>
+
+#include "HEPREP/HepRep.h"
+#include "HEPREP/HepRepSelectFilter.h"
+#include "HEPREP/HepRepWriter.h"
+#include "HEPREP/HepRepType.h"
+#include "HEPREP/HepRepTypeTree.h"
+#include "HEPREP/HepRepInstanceTree.h"
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: DefaultHepRep.h,v 1.3 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+class DefaultHepRep : public virtual HEPREP::HepRep {
+
+    private:
+        std::vector<std::string> layers;
+        std::vector<HEPREP::HepRepTypeTree*> typeTrees;
+        std::vector<HEPREP::HepRepInstanceTree*> instanceTrees;
+
+    public:
+        DefaultHepRep();
+        ~DefaultHepRep();
+
+        HEPREP::HepRep* copy(HEPREP::HepRepSelectFilter* filter);
+        std::vector<std::string> getLayerOrder();
+        void addLayer(std::string layer);
+        void addTypeTree(HEPREP::HepRepTypeTree* typeTree);
+        void removeTypeTree(HEPREP::HepRepTypeTree* typeTree);
+        HEPREP::HepRepTypeTree* getTypeTree(std::string name, std::string version);
+        std::vector<HEPREP::HepRepTypeTree*> getTypeTreeList();
+        void addInstanceTree(HEPREP::HepRepInstanceTree* instanceTree);
+        void overlayInstanceTree(HEPREP::HepRepInstanceTree * instanceTree);
+        void removeInstanceTree(HEPREP::HepRepInstanceTree* instanceTree);
+        HEPREP::HepRepInstanceTree* getInstanceTreeTop(std::string name, std::string version);
+        HEPREP::HepRepInstanceTree* getInstances(std::string name, std::string version,
+                                                 std::vector<std::string> typeNames);
+        HEPREP::HepRepInstanceTree* getInstancesAfterAction(
+                                            std::string name,
+                                            std::string version,
+                                            std::vector<std::string> typeNames,
+                                            std::vector<HEPREP::HepRepAction*> actions,
+                                            bool getPoints,
+                                            bool getDrawAtts,
+                                            bool getNonDrawAtts,
+                                            std::vector<std::string> invertAtts);
+        std::string checkForException();
+        std::vector<HEPREP::HepRepInstanceTree*> getInstanceTreeList();
+};
+
+} // cheprep
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/DefaultHepRepAction.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/DefaultHepRepAction.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/DefaultHepRepAction.h	(revision 1102)
@@ -0,0 +1,35 @@
+// Copyright FreeHEP, 2005.
+#ifndef CHEPREP_DEFAULTHEPREPACTION_H
+#define CHEPREP_DEFAULTHEPREPACTION_H 1
+
+#include "cheprep/config.h"
+
+#include <string>
+
+#include "HEPREP/HepRepAction.h"
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: DefaultHepRepAction.h,v 1.3 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+class DefaultHepRepAction : public virtual HEPREP::HepRepAction {
+
+    private:
+        std::string name;
+        std::string expression;
+
+    public:
+        DefaultHepRepAction(std::string name, std::string expression);
+        ~DefaultHepRepAction();
+
+        std::string getName();
+        std::string getExpression();
+        HEPREP::HepRepAction* copy();
+};
+
+} // cheprep
+
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/DefaultHepRepAttDef.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/DefaultHepRepAttDef.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/DefaultHepRepAttDef.h	(revision 1102)
@@ -0,0 +1,37 @@
+// Copyright FreeHEP, 2005.
+#ifndef CHEPREP_DEFAULTHEPREPATTDEF_H
+#define CHEPREP_DEFAULTHEPREPATTDEF_H 1
+
+#include "cheprep/config.h"
+
+#include <string>
+
+#include "HEPREP/HepRepAttDef.h"
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: DefaultHepRepAttDef.h,v 1.3 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+class DefaultHepRepAttDef : public virtual HEPREP::HepRepAttDef {
+
+    private:
+        std::string name, desc, category, extra;
+
+    public:
+        DefaultHepRepAttDef(std::string name, std::string desc, std::string category, std::string extra);
+        ~DefaultHepRepAttDef();
+
+        HEPREP::HepRepAttDef* copy();
+        std::string getName();
+        std::string getLowerCaseName();
+        std::string getDescription();
+        std::string getCategory();
+        std::string getExtra();
+};
+
+} // cheprep
+
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/DefaultHepRepAttValue.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/DefaultHepRepAttValue.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/DefaultHepRepAttValue.h	(revision 1102)
@@ -0,0 +1,76 @@
+// Copyright FreeHEP, 2005.
+#ifndef CHEPREP_DEFAULTHEPREPATTVALUE_H
+#define CHEPREP_DEFAULTHEPREPATTVALUE_H 1
+
+#include "cheprep/config.h"
+
+#include <string>
+
+#include "HEPREP/HepRepAttValue.h"
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: DefaultHepRepAttValue.h,v 1.3 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+class DefaultHepRepAttValue : public virtual HEPREP::HepRepAttValue {
+
+    private:
+        enum { LABELSTRINGS_LEN = 4 };
+        std::string name;
+        int type;
+
+        // values implemented as separate items, so that they do not take up unnecessary space for an Object
+        // only ONE of these is filled
+        std::string stringValue;
+        int64 longValue;
+        double doubleValue;
+        bool booleanValue;
+        std::vector<double> colorValue;
+
+        int showLabelValue;
+        static std::string labelStrings[LABELSTRINGS_LEN];
+
+        void init();
+
+    public:
+        DefaultHepRepAttValue(std::string name, std::string value, int showLabel);
+        DefaultHepRepAttValue(std::string name, int64 value, int showLabel);
+        DefaultHepRepAttValue(std::string name, int value, int showLabel);
+        DefaultHepRepAttValue(std::string name, double value, int showLabel);
+        DefaultHepRepAttValue(std::string name, bool value, int showLabel);
+        DefaultHepRepAttValue(std::string name, std::vector<double> value, int showLabel);
+        ~DefaultHepRepAttValue();
+
+        HEPREP::HepRepAttValue* copy();
+
+        std::string getName();
+        std::string getLowerCaseName();
+        int getType();
+        std::string getTypeName();
+        int showLabel();
+        std::string getString();
+        std::string getLowerCaseString();
+        int64 getLong();
+        int getInteger();
+        double getDouble();
+        bool getBoolean();
+        std::vector<double> getColor();
+
+        std::string getAsString();
+        static std::string getAsString(std::vector<double> c);
+        static std::string getAsString(int i);
+        static std::string getAsString(int64 i);
+        static std::string getAsString(double d);
+        static std::string getAsString(bool b);
+        
+        std::string toShowLabel();
+        static std::string toShowLabel(int showLabel);
+};
+
+} // cheprep
+
+
+#endif
+
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/DefaultHepRepAttribute.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/DefaultHepRepAttribute.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/DefaultHepRepAttribute.h	(revision 1102)
@@ -0,0 +1,51 @@
+// Copyright FreeHEP, 2005.
+#ifndef CHEPREP_DEFAULTHEPREPATTRIBUTE_H
+#define CHEPREP_DEFAULTHEPREPATTRIBUTE_H 1
+
+#include "cheprep/config.h"
+
+#include <string>
+#include <map>
+#include <set>
+#include <vector>
+
+#include "HEPREP/HepRepAttribute.h"
+#include "HEPREP/HepRepAttValue.h"
+#include "HEPREP/HepRepConstants.h"
+#include "HEPREP/HepRepWriter.h"
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: DefaultHepRepAttribute.h,v 1.3 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+class DefaultHepRepAttribute : public virtual HEPREP::HepRepAttribute {
+
+    private:
+        std::map<std::string, HEPREP::HepRepAttValue*> attValues;
+
+    public:
+        DefaultHepRepAttribute();
+        ~DefaultHepRepAttribute();
+
+        std::set<HEPREP::HepRepAttValue*> getAttValuesFromNode();
+        void addAttValue(HEPREP::HepRepAttValue* hepRepAttValue);
+        void addAttValue(std::string key, char *value, int showLabel);
+        void addAttValue(std::string key, std::string value, int showLabel);
+        void addAttValue(std::string key, int value, int showLabel);
+        void addAttValue(std::string key, int64 value, int showLabel);
+        void addAttValue(std::string key, double value, int showLabel);
+        void addAttValue(std::string key, bool value, int showLabel);
+        void addAttValue(std::string key, std::vector<double> value, int showLabel);
+        void addAttValue(std::string key, double red, double green, double blue, double alpha, int showLabel);
+        HEPREP::HepRepAttValue* getAttValueFromNode(std::string lowerCaseName);
+        HEPREP::HepRepAttValue* removeAttValue(std::string key);
+
+        HEPREP::HepRepAttValue* getAttValue(std::string name) = 0;
+};
+
+} // cheprep
+
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/DefaultHepRepDefinition.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/DefaultHepRepDefinition.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/DefaultHepRepDefinition.h	(revision 1102)
@@ -0,0 +1,43 @@
+// Copyright FreeHEP, 2005.
+#ifndef CHEPREP_DEFAULTHEPREPDEFINITION_H
+#define CHEPREP_DEFAULTHEPREPDEFINITION_H 1
+
+#include "cheprep/config.h"
+
+#include <string>
+#include <vector>
+#include <set>
+
+#include "HEPREP/HepRepDefinition.h"
+#include "HEPREP/HepRepWriter.h"
+
+#include "DefaultHepRepAttribute.h"
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: DefaultHepRepDefinition.h,v 1.3 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+class DefaultHepRepDefinition : public DefaultHepRepAttribute, public virtual HEPREP::HepRepDefinition {
+
+    private:
+        std::map<std::string, HEPREP::HepRepAttDef*> attDefs;
+
+    public:
+        DefaultHepRepDefinition();
+        ~DefaultHepRepDefinition();
+
+        void addAttDef(HEPREP::HepRepAttDef* hepRepAttDef);
+        void addAttDef(std::string name, std::string desc, std::string type, std::string extra);
+        std::set<HEPREP::HepRepAttDef *> getAttDefsFromNode();
+        HEPREP::HepRepAttDef* getAttDefFromNode(std::string lowerCaseName);
+
+        HEPREP::HepRepAttDef* getAttDef(std::string name) = 0;
+        HEPREP::HepRepAttValue* getAttValue(std::string name) = 0;
+};
+
+} // cheprep
+
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/DefaultHepRepFactory.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/DefaultHepRepFactory.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/DefaultHepRepFactory.h	(revision 1102)
@@ -0,0 +1,55 @@
+// Copyright FreeHEP, 2005.
+#ifndef CHEPREP_DEFAULTHEPREPFACTORY_H
+#define CHEPREP_DEFAULTHEPREPFACTORY_H 1
+
+#include "cheprep/config.h"
+
+#include <string>
+#include <iostream>
+
+#include "HEPREP/HepRep.h"
+#include "HEPREP/HepRepFactory.h"
+#include "HEPREP/HepRepReader.h"
+#include "HEPREP/HepRepWriter.h"
+#include "HEPREP/HepRepPoint.h"
+#include "HEPREP/HepRepInstance.h"
+#include "HEPREP/HepRepInstanceTree.h"
+#include "HEPREP/HepRepTreeID.h"
+#include "HEPREP/HepRepAction.h"
+#include "HEPREP/HepRepType.h"
+#include "HEPREP/HepRepTypeTree.h"
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: DefaultHepRepFactory.h,v 1.3 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+class DefaultHepRepFactory : public virtual HEPREP::HepRepFactory {
+
+    public:
+        DefaultHepRepFactory();
+        ~DefaultHepRepFactory();
+
+//        static HEPREP::HepRepFactory* create();
+        HEPREP::HepRepReader* createHepRepReader (std::istream* in);
+        HEPREP::HepRepReader* createHepRepReader (std::string filename);
+        HEPREP::HepRepWriter* createHepRepWriter (std::ostream* out, bool randomAccess, bool compress);
+        HEPREP::HepRepPoint* createHepRepPoint (HEPREP::HepRepInstance* instance,
+                                   double x, double y, double z);
+        HEPREP::HepRepInstance* createHepRepInstance (HEPREP::HepRepInstance* parent, HEPREP::HepRepType* type);
+        HEPREP::HepRepInstance* createHepRepInstance (HEPREP::HepRepInstanceTree* parent, HEPREP::HepRepType* type);
+        HEPREP::HepRepTreeID* createHepRepTreeID (std::string name, std::string version, std::string qualifier = "top-level");
+        HEPREP::HepRepAction* createHepRepAction (std::string name, std::string expression);
+        HEPREP::HepRepInstanceTree* createHepRepInstanceTree (std::string name, std::string version,
+                                                        HEPREP::HepRepTreeID* typeTreeID);
+        HEPREP::HepRepType* createHepRepType (HEPREP::HepRepType* parent, std::string name);
+        HEPREP::HepRepType* createHepRepType (HEPREP::HepRepTypeTree* parent, std::string name);
+        HEPREP::HepRepTypeTree* createHepRepTypeTree (HEPREP::HepRepTreeID* treeID);
+        HEPREP::HepRep* createHepRep ();
+};
+
+} // cheprep
+
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/DefaultHepRepInstance.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/DefaultHepRepInstance.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/DefaultHepRepInstance.h	(revision 1102)
@@ -0,0 +1,59 @@
+// Copyright FreeHEP, 2005.
+#ifndef CHEPREP_DEFAULTHEPREPINSTANCE_H
+#define CHEPREP_DEFAULTHEPREPINSTANCE_H 1
+
+#include "cheprep/config.h"
+
+#include <string>
+#include <vector>
+
+#include "HEPREP/HepRep.h"
+#include "HEPREP/HepRepSelectFilter.h"
+#include "HEPREP/HepRepInstanceTree.h"
+#include "HEPREP/HepRepInstance.h"
+#include "HEPREP/HepRepWriter.h"
+#include "HEPREP/HepRepType.h"
+#include "HEPREP/HepRepPoint.h"
+#include "HEPREP/HepRepAttValue.h"
+
+#include "DefaultHepRepAttribute.h"
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: DefaultHepRepInstance.h,v 1.3 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+class DefaultHepRepInstance : public DefaultHepRepAttribute, public virtual HEPREP::HepRepInstance {
+
+    private:
+        HEPREP::HepRepInstance* parent;
+        HEPREP::HepRepType* type;
+        std::vector<HEPREP::HepRepPoint*> points;
+        std::vector<HEPREP::HepRepInstance*> instances;
+
+    public:
+        DefaultHepRepInstance(HEPREP::HepRepInstance* parent, HEPREP::HepRepType* type);
+        DefaultHepRepInstance(HEPREP::HepRepInstanceTree* parent, HEPREP::HepRepType* type);
+        ~DefaultHepRepInstance();
+
+        void overlay(HEPREP::HepRepInstance * instance);
+        HEPREP::HepRepInstance* copy(HEPREP::HepRepTypeTree* typeTree, HEPREP::HepRepInstance* parent, HEPREP::HepRepSelectFilter* filter);
+        HEPREP::HepRepInstance* copy(HEPREP::HepRepTypeTree* typeTree, HEPREP::HepRepInstanceTree* parent, HEPREP::HepRepSelectFilter* filter);
+        HEPREP::HepRepType* getType();
+        void addPoint(HEPREP::HepRepPoint* point);
+        std::vector<HEPREP::HepRepPoint *> getPoints();
+        HEPREP::HepRepInstance* getSuperInstance();
+        void addInstance(HEPREP::HepRepInstance* instance);
+        void removeInstance(HEPREP::HepRepInstance* instance);
+        std::vector<HEPREP::HepRepInstance *> getInstances();
+
+        HEPREP::HepRepAttValue* getAttValue(std::string name);
+
+        void *getParent() { return parent; }
+};
+
+} // cheprep
+
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/DefaultHepRepInstanceTree.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/DefaultHepRepInstanceTree.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/DefaultHepRepInstanceTree.h	(revision 1102)
@@ -0,0 +1,50 @@
+// Copyright FreeHEP, 2005.
+#ifndef CHEPREP_DEFAULTHEPREPINSTANCETREE_H
+#define CHEPREP_DEFAULTHEPREPINSTANCETREE_H 1
+
+#include "cheprep/config.h"
+
+#include <string>
+#include <vector>
+#include <set>
+
+#include "HEPREP/HepRep.h"
+#include "HEPREP/HepRepSelectFilter.h"
+#include "HEPREP/HepRepInstanceTree.h"
+#include "HEPREP/HepRepInstance.h"
+#include "HEPREP/HepRepWriter.h"
+#include "HEPREP/HepRepTreeID.h"
+
+#include "DefaultHepRepTreeID.h"
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: DefaultHepRepInstanceTree.h,v 1.3 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+class DefaultHepRepInstanceTree : public DefaultHepRepTreeID, public virtual HEPREP::HepRepInstanceTree {
+
+    private:
+        HEPREP::HepRepTreeID* typeTree;
+        std::vector<HEPREP::HepRepInstance*> instances;
+        std::vector<HEPREP::HepRepTreeID*> instanceTrees;
+
+    public:
+        DefaultHepRepInstanceTree(std::string name, std::string version, HEPREP::HepRepTreeID* typeTree);
+        ~DefaultHepRepInstanceTree();
+
+        void overlay(HEPREP::HepRepInstanceTree * instanceTree);
+        HEPREP::HepRepInstanceTree* copy(HEPREP::HepRepTypeTree* typeTree, HEPREP::HepRepSelectFilter* filter);
+        void addInstance(HEPREP::HepRepInstance* instance);
+        void removeInstance(HEPREP::HepRepInstance* instance);
+        std::vector<HEPREP::HepRepInstance*> getInstances();
+        void addInstanceTree(HEPREP::HepRepTreeID* treeID);
+        HEPREP::HepRepTreeID* getTypeTree();
+        std::vector<HEPREP::HepRepTreeID*> getInstanceTreeList();
+};
+
+} // cheprep
+
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/DefaultHepRepPoint.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/DefaultHepRepPoint.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/DefaultHepRepPoint.h	(revision 1102)
@@ -0,0 +1,62 @@
+// Copyright FreeHEP, 2005.
+#ifndef CHEPREP_DEFAULTHEPREPPOINT_H
+#define CHEPREP_DEFAULTHEPREPPOINT_H 1
+
+#include "cheprep/config.h"
+
+#include <string>
+#include <vector>
+
+#include "HEPREP/HepRepInstance.h"
+#include "HEPREP/HepRepWriter.h"
+#include "HEPREP/HepRepAttValue.h"
+#include "HEPREP/HepRepPoint.h"
+
+#include "DefaultHepRepAttribute.h"
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: DefaultHepRepPoint.h,v 1.3 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+class DefaultHepRepPoint : public DefaultHepRepAttribute, public virtual HEPREP::HepRepPoint {
+
+    private:
+        HEPREP::HepRepInstance* instance;
+
+    protected:
+        double x, y, z;
+
+    public:
+        DefaultHepRepPoint(HEPREP::HepRepInstance* instance, double x, double y, double z);
+        ~DefaultHepRepPoint();
+
+        HEPREP::HepRepInstance* getInstance();
+
+        HEPREP::HepRepAttValue* getAttValue(std::string lowerCaseName);
+
+        HEPREP::HepRepPoint* copy(HEPREP::HepRepInstance* parent);
+        double getX();
+        double getY();
+        double getZ();
+        std::vector<double>* getXYZ(std::vector<double>* xyz);
+        double getRho();
+        double getPhi();
+        double getTheta();
+        double getR();
+        double getEta();
+        double getX(double xVertex, double yVertex, double zVertex);
+        double getY(double xVertex, double yVertex, double zVertex);
+        double getZ(double xVertex, double yVertex, double zVertex);
+        double getRho(double xVertex, double yVertex, double zVertex);
+        double getPhi(double xVertex, double yVertex, double zVertex);
+        double getTheta(double xVertex, double yVertex, double zVertex);
+        double getR(double xVertex, double yVertex, double zVertex);
+        double getEta(double xVertex, double yVertex, double zVertex);
+};
+
+} // cheprep
+
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/DefaultHepRepTreeID.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/DefaultHepRepTreeID.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/DefaultHepRepTreeID.h	(revision 1102)
@@ -0,0 +1,37 @@
+// Copyright FreeHEP, 2005.
+#ifndef CHEPREP_DEFAULTHEPREPTREEID_H
+#define CHEPREP_DEFAULTHEPREPTREEID_H 1
+
+#include "cheprep/config.h"
+
+#include <string>
+
+#include "HEPREP/HepRepTreeID.h"
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: DefaultHepRepTreeID.h,v 1.3 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+class DefaultHepRepTreeID : public virtual HEPREP::HepRepTreeID {
+
+    private:
+        std::string name;
+        std::string version;
+        std::string qualifier;
+
+    public:
+        DefaultHepRepTreeID(std::string name, std::string version, std::string qualifier = "top_level");
+        ~DefaultHepRepTreeID();
+
+        std::string getQualifier();
+        void setQualifier(std::string qualifier);
+        std::string getName();
+        std::string getVersion();
+};
+
+} // cheprep
+
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/DefaultHepRepType.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/DefaultHepRepType.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/DefaultHepRepType.h	(revision 1102)
@@ -0,0 +1,56 @@
+// Copyright FreeHEP, 2005.
+#ifndef CHEPREP_DEFAULTHEPREPTYPE_H
+#define CHEPREP_DEFAULTHEPREPTYPE_H 1
+
+#include "cheprep/config.h"
+
+#include <string>
+#include <vector>
+#include <set>
+
+#include "HEPREP/HepRep.h"
+#include "HEPREP/HepRepType.h"
+#include "HEPREP/HepRepAttDef.h"
+#include "HEPREP/HepRepAttValue.h"
+#include "HEPREP/HepRepWriter.h"
+
+#include "DefaultHepRepDefinition.h"
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: DefaultHepRepType.h,v 1.3 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+class DefaultHepRepType : public DefaultHepRepDefinition, public virtual HEPREP::HepRepType {
+
+    private:
+        HEPREP::HepRepType* parent;
+        std::vector<HEPREP::HepRepType*> types;
+        std::string name;
+        std::string description;
+        std::string infoURL;
+
+    public:
+        DefaultHepRepType(HEPREP::HepRepType* parent, std::string name);
+        DefaultHepRepType(HEPREP::HepRepTypeTree* parent, std::string name);
+        ~DefaultHepRepType();
+
+        HEPREP::HepRepType* getSuperType();
+        HEPREP::HepRepAttDef* getAttDef(std::string name);
+        HEPREP::HepRepAttValue* getAttValue(std::string name);
+        HEPREP::HepRepType* copy(HEPREP::HepRepType* parent);
+        std::string getName();
+        std::string getFullName();
+        std::string getDescription();
+        void setDescription(std::string description);
+        std::string getInfoURL();
+        void setInfoURL(std::string infoURL);
+        void addType(HEPREP::HepRepType* type);
+        std::vector<HEPREP::HepRepType*> getTypeList();
+};
+
+} // cheprep
+
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/DefaultHepRepTypeTree.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/DefaultHepRepTypeTree.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/DefaultHepRepTypeTree.h	(revision 1102)
@@ -0,0 +1,43 @@
+// Copyright FreeHEP, 2005.
+#ifndef CHEPREP_DEFAULTHEPREPTYPETREE_H
+#define CHEPREP_DEFAULTHEPREPTYPETREE_H 1
+
+#include "cheprep/config.h"
+
+#include <string>
+#include <vector>
+#include <set>
+
+#include "HEPREP/HepRep.h"
+#include "HEPREP/HepRepTypeTree.h"
+#include "HEPREP/HepRepType.h"
+#include "HEPREP/HepRepWriter.h"
+#include "HEPREP/HepRepTreeID.h"
+
+#include "DefaultHepRepTreeID.h"
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: DefaultHepRepTypeTree.h,v 1.3 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+class DefaultHepRepTypeTree : public DefaultHepRepTreeID, public virtual HEPREP::HepRepTypeTree {
+
+    private:
+        std::vector<HEPREP::HepRepType*> types;
+
+    public:
+        DefaultHepRepTypeTree(HEPREP::HepRepTreeID* typeTree);
+        ~DefaultHepRepTypeTree();
+
+        HEPREP::HepRepTypeTree* copy();
+        void addType(HEPREP::HepRepType* type);
+        std::vector<HEPREP::HepRepType* > getTypeList();
+        HEPREP::HepRepType* getType(std::string name);
+};
+
+} // cheprep
+
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/DeflateOutputStreamBuffer.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/DeflateOutputStreamBuffer.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/DeflateOutputStreamBuffer.h	(revision 1102)
@@ -0,0 +1,99 @@
+// Copyright FreeHEP, 2005.
+#ifndef CHEPREP_DEFLATEOUTPUTSTREAMBUF_H
+#define CHEPREP_DEFLATEOUTPUTSTREAMBUF_H
+
+#include <vector>
+#include <iostream>
+#include <string>
+#include <cstdio>
+
+#ifndef CHEPREP_NO_ZLIB
+#include <zlib.h>
+#endif // CHEPREP_NO_ZLIB
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: DeflateOutputStreamBuffer.h,v 1.6 2009/05/08 09:26:58 gcosmo Exp $
+ */
+namespace cheprep {
+
+    class DeflateOutputStreamBuffer : public std::streambuf {
+
+        public:
+        
+            DeflateOutputStreamBuffer(std::streambuf *buffer);
+        
+            void init(bool compress);
+            void finish();
+        
+            virtual ~DeflateOutputStreamBuffer();
+    
+        
+        protected:
+            int overflow(int c = EOF);
+
+#ifndef CHEPREP_NO_ZLIB
+            bool flushOut();
+#endif // CHEPREP_NO_ZLIB
+
+            inline void putUI(unsigned int ui) {
+                unsigned char* ucp = reinterpret_cast<unsigned char *>(&ui);
+                unsigned int i   = (static_cast<unsigned int>(ucp[ 3 ]) << 24) +  
+                                   (static_cast<unsigned int>(ucp[ 2 ]) << 16) + 
+                                   (static_cast<unsigned int>(ucp[ 1 ]) << 8 ) + 
+                                   (static_cast<unsigned int>(ucp[ 0 ]));                   
+                buffer->sputn(reinterpret_cast<char *>(&i), sizeof(unsigned int));
+            }
+
+            inline void putUS(unsigned short us) {
+                unsigned char* ucp = reinterpret_cast<unsigned char *>(&us);
+                unsigned short s   = (static_cast<unsigned short>(ucp[ 1 ]) << 8 ) + 
+                                     (static_cast<unsigned short>(ucp[ 0 ]));                   
+                buffer->sputn(reinterpret_cast<char *>(&s), sizeof(unsigned short));
+            }
+
+            inline void putUB(unsigned char ub) {
+                buffer->sputc(ub);
+            }
+
+            inline void putS(const std::string s) {
+                buffer->sputn(s.c_str(), s.length());                
+            }
+            
+            inline std::streampos pos() {
+                std::ostream os(buffer);
+                return os.tellp();
+            }
+            
+            inline unsigned int getSize() {
+                return size;
+            }
+            
+            inline unsigned int getCRC() {
+                return crc;
+            }
+            
+        private:
+            static unsigned long crctable[256];                
+            std::streambuf *buffer;
+            
+            unsigned int crc;
+            unsigned int size;
+
+#ifndef CHEPREP_NO_ZLIB            
+            static const unsigned int inSize = 1000;
+            static const unsigned int outSize = 1000;
+            z_stream zStream;
+            bool zStreamOpen;
+
+            std::vector<char> in;
+            std::vector<char> out;
+#endif // CHEPREP_NO_ZLIB
+};
+
+
+} // cheprep
+
+
+
+#endif // CHEPREP_DEFLATEOUTPUTSTREAMBUF_H 
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/GZIPOutputStream.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/GZIPOutputStream.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/GZIPOutputStream.h	(revision 1102)
@@ -0,0 +1,34 @@
+// Copyright FreeHEP, 2005.
+#ifndef CHEPREP_GZIPOUTPUTSTREAM_H
+#define CHEPREP_GZIPOUTPUTSTREAM_H
+
+#include <string>
+
+#include "cheprep/GZIPOutputStreamBuffer.h"
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: GZIPOutputStream.h,v 1.3 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+    class GZIPOutputStream : public std::ostream {
+        
+        public:
+
+            GZIPOutputStream(std::ostream &os);
+
+            void setFilename(const std::string &filename);
+            void setComment(const std::string &comment);
+  
+            void close();
+
+            virtual ~GZIPOutputStream();
+
+        private:
+            GZIPOutputStreamBuffer *buffer;
+    };
+ 
+} // cheprep.
+
+#endif // CHEPREP_GZIPOUTPUTSTREAM_H
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/GZIPOutputStreamBuffer.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/GZIPOutputStreamBuffer.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/GZIPOutputStreamBuffer.h	(revision 1102)
@@ -0,0 +1,42 @@
+// Copyright FreeHEP, 2005.
+#ifndef CHEPREP_GZIPOUTPUTSTREAMBUF_H
+#define CHEPREP_GZIPOUTPUTSTREAMBUF_H
+
+#include <string>
+
+#include "cheprep/DeflateOutputStreamBuffer.h"
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: GZIPOutputStreamBuffer.h,v 1.4 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+    class GZIPOutputStreamBuffer : public DeflateOutputStreamBuffer {
+
+        public:
+
+            GZIPOutputStreamBuffer( std::streambuf *outbuf );
+
+            int overflow(int);
+
+            void setFilename( const std::string &filename );
+            void setComment( const std::string &comment );
+
+            void close() ;
+
+            virtual ~GZIPOutputStreamBuffer() ;
+
+        private:
+            void writeHeader();
+            void writeTrailer();
+  
+            std::string filename;
+            std::string comment;
+            bool open;
+    };
+
+
+} // cheprep
+
+#endif // CHEPREP_GZIPOUTPUTSTREAMBUF_H
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/IndentPrintWriter.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/IndentPrintWriter.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/IndentPrintWriter.h	(revision 1102)
@@ -0,0 +1,55 @@
+// Copyright FreeHEP, 2005.
+#ifndef CHEPREP_INDENTPRINTWRITER_H
+#define CHEPREP_INDENTPRINTWRITER_H 1
+
+#include "cheprep/config.h"
+
+#include <iostream>
+#include <string>
+
+/**
+ * A PrintWriter that keeps track of an indentation level
+ * and indents the output appropriately.
+ *
+ * <b>Warning:</b> Only print and println methods taking strings have been overriden,
+ * print, println methods taking other arguments may not be indented properly.
+ *
+ * @author Mark Donszelmann
+ * @version $Id: IndentPrintWriter.h,v 1.3 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+class IndentPrintWriter {
+
+	public:
+	    IndentPrintWriter(std::ostream* out, int level = 0);
+        virtual ~IndentPrintWriter();
+
+        void close();
+        IndentPrintWriter& operator<< (const std::string & s);
+        IndentPrintWriter& operator<< (std::ostream& (*pf)(std::ostream&));
+	    void println(const std::string & s);
+        void print(const std::string & s);
+	    void println();
+	    void indent();
+	    void outdent();
+	    int getIndent() const;
+        void setIndent(const int level);
+        std::string getIndentString() const;
+        void setIndentString(const std::string & indentString);
+
+    private:
+        void doIndent();
+
+        std::ostream* out;
+        bool closed;
+        int indentLevel;
+        bool indented;
+        std::string indentString;
+};
+
+} // cheprep
+
+
+#endif
+
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/XMLHepRepFactory.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/XMLHepRepFactory.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/XMLHepRepFactory.h	(revision 1102)
@@ -0,0 +1,33 @@
+// Copyright FreeHEP, 2005.
+#ifndef XMLHEPREPFACTORY_H
+#define XMLHEPREPFACTORY_H 1
+
+#include <string>
+#include <iostream>
+
+#include "HEPREP/HepRepReader.h"
+#include "HEPREP/HepRepWriter.h"
+
+#include "DefaultHepRepFactory.h"
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: XMLHepRepFactory.h,v 1.3 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+class XMLHepRepFactory : public DefaultHepRepFactory {
+
+    public:
+        XMLHepRepFactory();
+        ~XMLHepRepFactory();
+
+        HEPREP::HepRepReader* createHepRepReader (std::istream* in);
+        HEPREP::HepRepReader* createHepRepReader (std::string filename);
+        HEPREP::HepRepWriter* createHepRepWriter (std::ostream* out, bool randomAccess, bool compress);
+};
+
+} // cheprep
+
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/XMLHepRepWriter.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/XMLHepRepWriter.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/XMLHepRepWriter.h	(revision 1102)
@@ -0,0 +1,73 @@
+// Copyright FreeHEP, 2005.
+#ifndef CHEPREP_XMLHEPREPWRITER_H
+#define CHEPREP_XMLHEPREPWRITER_H 1
+
+#include "cheprep/config.h"
+
+#include <iostream>
+#include <string>
+#include <stack>
+#include <set>
+#include <vector>
+#include <map>
+
+#include "HEPREP/HepRep.h"
+#include "HEPREP/HepRepFactory.h"
+#include "HEPREP/HepRepWriter.h"
+#include "HEPREP/HepRepPoint.h"
+#include "HEPREP/HepRepInstance.h"
+#include "HEPREP/HepRepInstanceTree.h"
+#include "HEPREP/HepRepTreeID.h"
+#include "HEPREP/HepRepAction.h"
+#include "HEPREP/HepRepType.h"
+#include "HEPREP/HepRepTypeTree.h"
+#include "HEPREP/HepRepAttDef.h"
+#include "HEPREP/HepRepAttValue.h"
+#include "HEPREP/HepRepAttribute.h"
+
+#include "cheprep/AbstractXMLWriter.h"
+#include "cheprep/ZipOutputStream.h"
+#include "cheprep/GZIPOutputStream.h"
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: XMLHepRepWriter.h,v 1.4 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+class XMLHepRepWriter : public virtual HEPREP::HepRepWriter {
+
+    private:
+        std::ostream *out;
+        bool compress;
+        std::string nameSpace;
+        AbstractXMLWriter *xml;
+        cheprep::ZipOutputStream *zip;
+        cheprep::GZIPOutputStream *gz;
+        std::map<std::string, std::string> properties;
+        
+    public:
+        XMLHepRepWriter(std::ostream* out, bool randomAccess, bool compress);
+        ~XMLHepRepWriter();
+
+        bool addProperty(std::string key, std::string value);
+        bool close();
+        bool write(HEPREP::HepRep* heprep, std::string name);
+        bool write(std::vector<std::string> layers);
+        bool write(HEPREP::HepRepTypeTree* typeTree);
+        bool write(HEPREP::HepRepType* type);
+        bool write(HEPREP::HepRepTreeID* treeID);
+        bool write(HEPREP::HepRepAction* action);
+        bool write(HEPREP::HepRepInstanceTree* instanceTree);
+        bool write(HEPREP::HepRepInstance* instance);
+        bool write(HEPREP::HepRepPoint* point);
+        bool write(HEPREP::HepRepAttribute* attribute);
+        bool write(HEPREP::HepRepDefinition* definition);
+        bool write(HEPREP::HepRepAttValue* attValue);
+        bool write(HEPREP::HepRepAttDef* attDef);        
+};
+
+} // cheprep
+
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/XMLWriter.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/XMLWriter.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/XMLWriter.h	(revision 1102)
@@ -0,0 +1,81 @@
+// Copyright FreeHEP, 2005.
+#ifndef CHEPREP_XMLWRITER_H
+#define CHEPREP_XMLWRITER_H 1
+
+#include "cheprep/config.h"
+
+#include <iostream>
+#include <map>
+#include <stack>
+#include <vector>
+#include <string>
+
+#include "cheprep/AbstractXMLWriter.h"
+#include "cheprep/IndentPrintWriter.h"
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: XMLWriter.h,v 1.3 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+class XMLWriter : public AbstractXMLWriter {
+
+    public:
+        XMLWriter(std::ostream* out, std::string indentString = "  ", std::string defaultNameSpace = "");
+        virtual ~XMLWriter();
+        void close();
+        void openDoc(std::string version = "1.0", std::string encoding = "", bool standalone = false);
+        void referToDTD(std::string name, std::string pid, std::string ref);
+        void referToDTD(std::string name, std::string system);
+        void closeDoc(bool force = false);
+        void printComment(std::string comment);
+        void printPlain(std::string text);
+        void print(std::string text);
+        void println(std::string text);
+        void openTag(std::string name);
+        void closeTag();
+        void printTag(std::string name);
+        void setAttribute(std::string name, char* value);
+        void setAttribute(std::string name, std::string value);
+        void setAttribute(std::string name, std::vector<double> value);
+        void setAttribute(std::string name, int64 value);
+        void setAttribute(std::string name, int value);
+        void setAttribute(std::string name, bool value);
+        void setAttribute(std::string name, double value);
+        void printAttributes(int tagLength);
+        std::string normalize(std::string s);
+        std::string normalizeText(std::string s);
+        void checkNameValid(std::string s);
+
+        //
+        // Can be removed when we can properly inherit those (since names are equal to overloaded ones).
+        // 
+        void openTag(std::string ns, std::string name) {
+            openTag(ns == defaultNameSpace ? name : ns.append(":").append(name));
+        }
+        void printTag(std::string ns, std::string name) {
+            printTag(ns == defaultNameSpace ? name : ns.append(":").append(name));
+        }
+        void setAttribute(std::string ns, std::string name, std::string value) {
+            setAttribute(ns.append(":").append(name), value);
+        }
+        void setAttribute(std::string ns, std::string name, double value) {
+            setAttribute(ns.append(":").append(name), value);
+        }
+
+
+
+    protected:
+        bool closed;
+	    IndentPrintWriter* writer;
+
+    private:
+        std::string dtdName;
+	    std::map<std::string, std::string> attributes;
+	    std::stack<std::string> openTags;
+};
+
+} // cheprep
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/ZipEntry.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/ZipEntry.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/ZipEntry.h	(revision 1102)
@@ -0,0 +1,37 @@
+// Copyright FreeHEP, 2005.
+#ifndef CHEPREP_ZIPENTRY_H
+#define CHEPREP_ZIPENTRY_H
+
+#include <string>
+#include <vector>
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: ZipEntry.h,v 1.9 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+    class ZipEntry {
+
+        public:
+
+            std::string name;
+            int method;
+            int date;
+            int time;
+            unsigned int crc;
+            unsigned int size;
+            unsigned int csize;
+            long offset;
+            long data;
+            
+            ZipEntry() {
+            }
+  
+            virtual ~ZipEntry() {
+            }
+    };
+ 
+} // cheprep
+
+#endif // CHEPREP_ZIPENTRY_H
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/ZipOutputStream.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/ZipOutputStream.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/ZipOutputStream.h	(revision 1102)
@@ -0,0 +1,40 @@
+// Copyright FreeHEP, 2005.
+#ifndef CHEPREP_ZIPOUTPUTSTREAM_H
+#define CHEPREP_ZIPOUTPUTSTREAM_H
+
+#include <string>
+#include <iostream>
+#include <vector>
+
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: ZipOutputStream.h,v 1.9 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+    class ZipOutputStreamBuffer;
+
+    class ZipOutputStream : public std::ostream {
+
+        public:
+
+            ZipOutputStream(std::ostream& os);
+  
+            void closeEntry();
+
+            void close();
+
+            void putNextEntry(const std::string& name, bool compress);
+            
+            void setComment(const std::string& comment);
+
+            virtual ~ZipOutputStream();
+
+        private:
+            ZipOutputStreamBuffer* buffer;
+    };
+ 
+} // cheprep
+
+#endif // CHEPREP_ZIPOUTPUTSTREAM_H
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/ZipOutputStreamBuffer.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/ZipOutputStreamBuffer.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/ZipOutputStreamBuffer.h	(revision 1102)
@@ -0,0 +1,58 @@
+// Copyright FreeHEP, 2005.
+#ifndef CHEPREP_ZIPOUTPUTSTREAMBUFFER_H
+#define CHEPREP_ZIPOUTPUTSTREAMBUFFER_H
+
+#include <string>
+#include <iostream>
+#include <vector>
+
+#include "cheprep/DeflateOutputStreamBuffer.h"
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: ZipOutputStreamBuffer.h,v 1.9 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+    class ZipEntry;
+
+    class ZipOutputStreamBuffer : public DeflateOutputStreamBuffer {
+
+        public:
+
+            ZipOutputStreamBuffer(std::streambuf* buffer);
+  
+            int overflow(int c);
+    
+            void closeEntry();
+
+            void close();
+
+            void putNextEntry(const std::string& name, bool compress);
+
+            void setMethod(int method);
+            
+            void setComment(const std::string& comment);
+
+            virtual ~ZipOutputStreamBuffer();
+
+        private:
+            std::string comment;
+
+            bool closed;
+            ZipEntry* entry;
+            std::vector<ZipEntry*>* entries;
+                                
+            static const unsigned int LOCSIG = 0x04034b50;
+            static const unsigned int EXTSIG = 0x08074b50;
+            static const unsigned int CENSIG = 0x02014b50;
+            static const unsigned int ENDSIG = 0x06054b50;
+        
+            static const unsigned int VERSIONMADE           = 0x0014;
+            static const unsigned int VERSIONEXTRACT        = 0x0014;
+            static const unsigned int GENFLAG               = 0x0008;
+    };
+ 
+} // cheprep
+
+#endif // CHEPREP_ZIPOUTPUTSTREAMBUFFER_H
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/config.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/config.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/config.h	(revision 1102)
@@ -0,0 +1,63 @@
+// Copyright FreeHEP, 2005.
+#ifndef CHEPREP_CONFIG_H
+#define CHEPREP_CONFIG_H 1
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: config.h,v 1.4 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+#if defined(WIN32) && !defined(GNU_GCC)
+
+// WIN32 and NOT GNU_GCC
+typedef __int64 int64;
+typedef unsigned __int64 uint64;
+#define CHEPREP_INT64_FORMAT "%ld"
+#define CHEPREP_UINT64_FORMAT "%uld"
+
+#else // other than WIN32-MSVC
+#if defined(_LP64) 
+
+// 64 Bit Platforms
+typedef long int64;
+typedef unsigned long uint64;
+#define CHEPREP_INT64_FORMAT "%ld"
+#define CHEPREP_UINT64_FORMAT "%uld"
+
+#else 
+
+// 32-Bit Platforms
+typedef long long int64;
+typedef unsigned long long uint64;
+#define CHEPREP_INT64_FORMAT "%lld"
+#define CHEPREP_UINT64_FORMAT "%ulld"
+
+#endif // 32-Bit Platforms
+#endif // other than WIN32-MSVC
+
+} // namespace cheprep
+
+#ifdef WIN32
+#ifndef GNU_GCC
+// Disable warning C4786: identifier was truncated to '255' characters in the debug information
+    #pragma warning ( disable : 4786 )
+// Disable warning C4250: inherits via dominance
+    #pragma warning ( disable : 4250 )
+#ifdef VC6
+// FIX for KB 168440 - VC6
+// Stream Operator << Cannot Handle __int64 Type
+    #include<iostream>
+
+    inline std::ostream& operator<<(std::ostream& os, __int64 i ) {
+        char buf[20];
+        sprintf(buf,"%I64d", i );
+        os << buf;
+        return os;
+    }
+#endif // VC6
+#endif // GNU_GCC
+#endif // WIN32
+
+
+#endif  // CHEPREP_CONFIG_H
Index: tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/freehep-cheprep.version
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/freehep-cheprep.version	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/include/cheprep/freehep-cheprep.version	(revision 1102)
@@ -0,0 +1,1 @@
+source = freehep-cheprep-2.0.5
Index: tags/visualization-10.5-before-10.6_test/HepRep/src/BHepRepWriter.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/src/BHepRepWriter.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/src/BHepRepWriter.cc	(revision 1102)
@@ -0,0 +1,545 @@
+// Copyright FreeHEP, 2005.
+
+#include "cheprep/config.h"
+
+#include <iostream>
+#include <algorithm>
+
+#include "cheprep/BHepRepWriter.h"
+                        
+/**
+ * @author Mark Donszelmann
+ * @version $Id: BHepRepWriter.cc,v 1.9 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+    // class variables
+    std::map<std::string, unsigned char> BHepRepWriter::tags; 
+    std::map<std::string, unsigned char> BHepRepWriter::attributes;           
+    std::map<std::string, unsigned char> BHepRepWriter::values;
+
+    BHepRepWriter::BHepRepWriter( std::ostream& os) 
+            : AbstractXMLWriter("heprep"), 
+            os(os), 
+            singlePrecision(true) {        
+
+        // resolve endiannes        
+        union { long l; char c[sizeof (long)]; } u;
+        u.l = 1;
+        isBigEndian = (u.c[sizeof (long) - 1] == 1);
+               
+//        std::cout << "Host is " << (isBigEndian ? "Big-Endian" : "Little-Endian") << "." << std::endl;
+       
+        if (tags.size() <= 0) { 
+            // tags
+            tags["heprep"]              = 0x05;
+            tags["attdef"]              = 0x06;
+            tags["attvalue"]            = 0x07;
+            tags["instance"]            = 0x08;
+            tags["treeid"]              = 0x09;
+            tags["action"]              = 0x0a;
+            tags["instancetree"]        = 0x0b;
+            tags["type"]                = 0x0c;
+            tags["typetree"]            = 0x0d;
+            tags["layer"]               = 0x0e;
+            tags["point"]               = 0x0f;
+        }
+
+        if (attributes.size() <= 0) {
+            // attribute names
+            attributes["version"]               = 0x05;
+            attributes["xmlns"]                 = 0x06;
+            attributes["xmlns:xsi"]             = 0x07;
+            attributes["xsi:schemaLocation"]    = 0x08;
+    
+            attributes["valueString"]           = 0x10;
+            attributes["valueColor"]            = 0x11;
+            attributes["valueLong"]             = 0x12;
+            attributes["valueInt"]              = 0x13;
+            attributes["valueBoolean"]          = 0x14;
+            attributes["valueDouble"]           = 0x15;
+    
+            attributes["name"]                  = 0x20;
+            attributes["type"]                  = 0x22;
+            attributes["showlabel"]             = 0x23;
+            attributes["desc"]                  = 0x24;
+            attributes["category"]              = 0x25;
+            attributes["extra"]                 = 0x26;
+            attributes["x"]                     = 0x27;
+            attributes["y"]                     = 0x28;
+            attributes["z"]                     = 0x29;
+            attributes["qualifier"]             = 0x2a;
+            attributes["expression"]            = 0x2b;
+            attributes["typetreename"]          = 0x2c;
+            attributes["typetreeversion"]       = 0x2d;
+            attributes["order"]                 = 0x2e;
+            
+            // for PI
+            attributes["eof"]                   = 0x7f;
+        }
+        
+        if (values.size() <= 0) { 
+            // attribute values
+            values["drawas"]                     = 0x85;
+            values["drawasoptions"]              = 0x86;
+            values["visibility"]                 = 0x87;
+    
+            values["label"]                      = 0x88;
+    
+            values["fontname"]                   = 0x89;
+            values["fontstyle"]                  = 0x8a;
+            values["fontsize"]                   = 0x8b;
+            values["fontcolor"]                  = 0x8c;
+            values["fonthasframe"]               = 0x8d;
+            values["fontframecolor"]             = 0x8e;
+            values["fontframewidth"]             = 0x8f;
+            values["fonthasbanner"]              = 0x90;
+            values["fontbannercolor"]            = 0x91;
+    
+            values["color"]                      = 0x92;
+            values["framecolor"]                 = 0x93;
+            values["layer"]                      = 0x94;
+            values["markname"]                   = 0x95;
+            values["marksize"]                   = 0x96;
+            values["marksizemultiplier"]         = 0x97;
+            values["marktype"]                   = 0x98;
+            values["hasframe"]                   = 0x99;
+            values["framecolor"]                 = 0x9a;
+            values["framewidth"]                 = 0x9b;
+    
+            values["linestyle"]                  = 0x9c;
+            values["linewidth"]                  = 0x9d;
+            values["linewidthmultiplier"]        = 0x9e;
+            values["linehasarrow"]               = 0x9f;
+            
+            values["fillcolor"]                  = 0xa0;
+            values["filltype"]                   = 0xa1;
+            values["fill"]                       = 0xa2;
+    
+            values["radius"]                     = 0xa3;
+            values["phi"]                        = 0xa4;
+            values["theta"]                      = 0xa5;
+            values["omega"]                      = 0xa6;
+            values["radius1"]                    = 0xa7;
+            values["radius2"]                    = 0xa8;
+            values["radius3"]                    = 0xa9;
+            values["curvature"]                  = 0xaa;
+            values["flylength"]                  = 0xab;
+            values["faces"]                      = 0xac;
+    
+            values["text"]                       = 0xad;
+            values["hpos"]                       = 0xae;
+            values["vpos"]                       = 0xaf;
+            values["halign"]                     = 0xb0;
+            values["valign"]                     = 0xb1;
+    
+            values["ispickable"]                 = 0xb2;
+            values["showparentvalues"]           = 0xb3;
+            values["pickparent"]                 = 0xb4;
+            
+            // attvalue values
+            values["false"]         = 0xd0;
+            values["true"]          = 0xd1;
+            
+            values["point"]         = 0xd2;
+            values["line"]          = 0xd3;
+            values["helix"]         = 0xd4;
+            values["polygon"]       = 0xd5;
+            values["circle"]        = 0xd6;
+            values["curve"]         = 0xd7;
+            values["ellipse"]       = 0xd8;
+            values["ellipsoid"]     = 0xd9;
+            values["prism"]         = 0xda;
+            values["cylinder"]      = 0xdb;
+            values["ellipseprism"]  = 0xdc;
+            values["text"]          = 0xdd;
+    
+            values["nonzero"]       = 0xde;
+            values["evenodd"]       = 0xdf;
+            
+            values["circle"]        = 0xe0;
+            values["box"]           = 0xe1;
+            values["uptriangle"]    = 0xe2;
+            values["dntriangle"]    = 0xe3;
+            values["diamond"]       = 0xe4;
+            values["cross"]         = 0xe5;
+            values["star"]          = 0xe6;
+            values["plus"]          = 0xe7;
+            values["hline"]         = 0xe8;
+            values["vline"]         = 0xe9;
+    
+            values["solid"]         = 0xea;
+            values["dotted"]        = 0xeb;
+            values["dashed"]        = 0xec;
+            values["dotdash"]       = 0xed;
+            
+            values["none"]          = 0xee;
+            values["start"]         = 0xef;
+            values["end"]           = 0xf0;
+            values["both"]          = 0xf1;
+    
+            values["serif"]         = 0xf2;
+            values["sansserif"]     = 0xf3;
+            values["monotype"]      = 0xf4;
+            values["symbol"]        = 0xf5;
+    
+            values["plain"]         = 0xf6;
+            values["bold"]          = 0xf7;
+            values["italic"]        = 0xf8;
+    
+            values["top"]           = 0xf9;
+            values["baseline"]      = 0xfa;
+            values["center"]        = 0xfb;
+            values["bottom"]        = 0xfc;
+    
+            values["left"]          = 0xfd;
+            values["right"]         = 0xfe;
+    
+            values["default"]       = 0xff;
+        }        
+    }
+    
+    BHepRepWriter::~BHepRepWriter() {
+    }
+
+    void BHepRepWriter::close() {
+    }
+    
+    void BHepRepWriter::openDoc(std::string version, std::string /* encoding */, bool /* standalone */) {
+        stringValues.clear();
+        
+        // header
+        writeByte(WBXML_VERSION);
+        writeMultiByteInt(UNKNOWN_PID);
+        writeMultiByteInt(UTF8);        
+        
+        version = "BinaryHepRep/1.0"; 
+       
+        // string table
+        writeMultiByteInt(version.length()+1);
+        
+        // BHepRep Header (as part of the string table)
+        writeString(version);
+        
+    }
+    
+    void BHepRepWriter::closeDoc(bool /* force */) {
+        writeByte(PI);
+        writeByte(attributes["eof"]);
+        writeByte(END);
+    }
+
+    void BHepRepWriter::openTag(std::string name) {
+        writeTag(name, true);
+    }
+    
+    void BHepRepWriter::closeTag() {
+        writePoints();
+        writeByte(END);
+    }
+    
+    void BHepRepWriter::printTag(std::string name) {
+        writeTag(name);
+    }
+    
+    void BHepRepWriter::writeTag(std::string name, bool hasContent) {
+        std::string s = name;
+        std::transform(s.begin(), s.end(), s.begin(), (int(*)(int)) tolower);
+        
+        // find tag
+        if (tags.count(s) <= 0) {
+            std::cerr << "Cannot find tag '" << s << "' in tags table." << std::endl;
+            return;
+        }
+        
+        // write tag
+        bool isPoint = (s == "point");
+        bool hasAttributes = (stringAttributes.size() > 0) || (doubleAttributes.size() > (unsigned int)(isPoint ? 3 : 0));
+        
+        if (!hasAttributes && isPoint) {
+            // store the point for the future
+            points.push_back(doubleAttributes["x"]);
+            points.push_back(doubleAttributes["y"]);
+            points.push_back(doubleAttributes["z"]);
+            return;
+        }
+
+        writePoints();
+        writeByte(tags[s] | ((hasContent || isPoint) ? CONTENT : 0x00) | (hasAttributes ? ATTRIBUTE : 0x00));        
+            
+        // write attributes
+        if (hasAttributes) {
+            // write string attributes
+	        for (std::map<std::string,std::string>::iterator i = stringAttributes.begin(); i != stringAttributes.end(); i++) {
+    		    std::string name = i->first;
+    		    std::string value = i->second;
+
+                // write ATTRSTART
+                writeByte(attributes[name]);
+                std::string v = value;
+                std::transform(v.begin(), v.end(), v.begin(), (int(*)(int)) tolower);
+                if (values.count(v) > 0) {
+                    // write ATTRVALUE
+                    writeByte(values[v]);
+                } else {
+                    if (stringValues.count(value) <= 0) {
+                        // define this new string
+                        writeStringDefine(value);
+                        int index = stringValues.size();
+                        stringValues[value] = index;
+                    } else {
+                        // write string ref
+                        writeByte(STR_R);
+                        writeMultiByteInt(stringValues[value]);    
+                    }
+                }
+            }
+    	    stringAttributes.clear();   	     
+
+            // write color attributes
+	        for (std::map<std::string,std::vector<double> >::iterator i = colorAttributes.begin(); i != colorAttributes.end(); i++) {
+    		    std::string name = i->first;
+    		    std::vector<double> value = i->second;
+                // write ATTRSTART
+                writeByte(attributes[name]);
+                // write OPAQUE
+                writeByte(OPAQUE);
+                writeMultiByteInt(value.size());
+                writeByte((int)(value[0] * 0xff) & 0xff);
+                writeByte((int)(value[1] * 0xff) & 0xff);
+                writeByte((int)(value[2] * 0xff) & 0xff);
+                if (value.size() > 3) writeByte((int)(value[3] * 0xff) & 0xff);
+            }
+    	    colorAttributes.clear();
+    	    
+            // write long attributes
+	        for (std::map<std::string,int64>::iterator i = longAttributes.begin(); i != longAttributes.end(); i++) {
+    		    std::string name = i->first;
+    		    int64 value = i->second;
+                 // write ATTRSTART
+                writeByte(attributes[name]);
+                // write OPAQUE
+                writeByte(OPAQUE);
+                writeMultiByteInt(8);
+                writeLong(value);
+            }
+    	    longAttributes.clear();
+    	    
+            // write int attributes
+	        for (std::map<std::string,int>::iterator i = intAttributes.begin(); i != intAttributes.end(); i++) {
+    		    std::string name = i->first;
+    		    int value = i->second;
+                // write ATTRSTART
+                writeByte(attributes[name]);
+                // write OPAQUE
+                writeByte(OPAQUE);
+                writeMultiByteInt(4);
+                writeInt(value);
+            }
+    	    intAttributes.clear();
+    	    
+            // write boolean attributes
+	        for (std::map<std::string,bool>::iterator i = booleanAttributes.begin(); i != booleanAttributes.end(); i++) {
+    		    std::string name = i->first;
+    		    bool value = i->second;
+                // write ATTRSTART
+                writeByte(attributes[name]);
+                // write ATTRVALUE
+                writeByte(value ? values["true"] : values["false"]);
+            }
+    	    booleanAttributes.clear();
+    	    
+            // write double attributes
+	        for (std::map<std::string,double>::iterator i = doubleAttributes.begin(); i != doubleAttributes.end(); i++) {
+    		    std::string name = i->first;
+    		    double value = i->second;
+    		    if (!isPoint && (name != "x") && (name != "y") && (name != "z")) {
+                    // write ATTRSTART
+                    writeByte(attributes[name]);
+                    // write OPAQUE
+                    writeByte(OPAQUE);
+                    writeMultiByteInt(singlePrecision ? 4 : 8);
+                    writeReal(value);
+                }        
+            }
+    	    doubleAttributes.clear();
+    	    
+    	    // end of attributes
+    	    writeByte(END);   	     
+	    }
+        
+        if (s == "point") {
+            writeByte(OPAQUE);
+            writeMultiByteInt(singlePrecision ?  12 : 24);
+            writeReal(doubleAttributes["x"]);
+            writeReal(doubleAttributes["y"]);
+            writeReal(doubleAttributes["z"]);
+        }
+        
+        if (isPoint && !hasContent) {
+            // end this tag
+            writeByte(END);
+        }    
+    }
+    
+    void BHepRepWriter::writePoints() {
+        if (points.size() <= 0) return;
+        
+        writeByte(tags["point"] | CONTENT);                
+        writeByte(OPAQUE);
+        writeMultiByteInt(points.size()*(singlePrecision ? 4 : 8));
+        for (std::vector<double>::iterator i = points.begin(); i != points.end(); ) {
+            writeReal(*i++);
+            writeReal(*i++);
+            writeReal(*i++);
+        }
+        writeByte(END);
+        
+        points.clear();
+    }
+        
+    void BHepRepWriter::setAttribute(std::string name, char* value) {
+        setAttribute(name, (std::string)value);
+    }
+
+    void BHepRepWriter::setAttribute(std::string name, std::string value) {
+        if (name == "value") name = name.append("String");
+                
+        // make sure the attribute name is defined
+        if (attributes.count(name) <= 0) {
+            std::cerr << "Cannot find attribute name '" << name << "' in attributes table, skipped." << std::endl;
+            return;
+        }
+                    
+        stringAttributes[name] = value;
+    }
+
+    void BHepRepWriter::setAttribute(std::string name, std::vector<double> value) {
+        if (name == "value") name = name.append("Color");
+
+        // make sure the attribute name is defined
+        if (attributes.count(name) <= 0) {
+            std::cerr << "Cannot find attribute name '" << name << "' in attributes table, skipped." << std::endl;
+            return;
+        }
+                    
+        colorAttributes[name] = value;
+    }
+    
+    void BHepRepWriter::setAttribute(std::string name, int64 value) {
+        if (name == "value") name = name.append("Long");
+
+        // make sure the attribute name is defined
+        if (attributes.count(name) <= 0) {
+            std::cerr << "Cannot find attribute name '" << name << "' in attributes table, skipped." << std::endl;
+            return;
+        }
+                    
+        longAttributes[name] = value;
+    }
+    
+    void BHepRepWriter::setAttribute(std::string name, int value) {
+        if (name == "value") name = name.append("Int");
+
+        // make sure the attribute name is defined
+        if (attributes.count(name) <= 0) {
+            std::cerr << "Cannot find attribute name '" << name << "' in attributes table, skipped." << std::endl;
+            return;
+        }
+                    
+        intAttributes[name] = value;
+    }
+    
+    void BHepRepWriter::setAttribute(std::string name, bool value) {
+        if (name == "value") name = name.append("Boolean");
+
+        // make sure the attribute name is defined
+        if (attributes.count(name) <= 0) {
+            std::cerr << "Cannot find attribute name '" << name << "' in attributes table, skipped." << std::endl;
+            return;
+        }
+                    
+        booleanAttributes[name] = value;
+    }
+    
+    void BHepRepWriter::setAttribute(std::string name, double value) {
+        if (name == "value") name = name.append("Double");
+
+        // make sure the attribute name is defined
+        if (attributes.count(name) <= 0) {
+            std::cerr << "Cannot find attribute name '" << name << "' in attributes table, skipped." << std::endl;
+            return;
+        }
+                    
+        doubleAttributes[name] = value;
+    }
+
+    void BHepRepWriter::writeStringDefine(std::string s) {
+        writeByte(STR_D);
+        writeString(s);
+    }
+
+    void BHepRepWriter::writeMultiByteInt(unsigned int ui) {
+        unsigned char buf[5];
+        int idx = 0;
+        
+        do {
+            buf[idx++] = (unsigned char) (ui & 0x7f);
+            ui = ui >> 7;
+        }
+        while (ui != 0);
+
+        while (idx > 1) {
+            writeByte(buf[--idx] | 0x80);
+        }
+        writeByte(buf[0]);
+    }
+
+    void BHepRepWriter::writeReal(double d) {
+        if (singlePrecision) {
+            union {
+    	        int i;
+    	        float f;
+            } u;
+            u.f = (float)d;
+            writeInt(u.i);
+        } else {
+            union {
+    	        int64 i;
+    	        double d;
+            } u;
+            u.d = d;
+     
+            writeLong(u.i);
+        }
+    }
+
+    void BHepRepWriter::writeLong(int64 i) {        
+        // write network-order
+        os.put((i >> 56) & 0xff);
+        os.put((i >> 48) & 0xff);
+        os.put((i >> 40) & 0xff);
+        os.put((i >> 32) & 0xff);
+        os.put((i >> 24) & 0xff);
+        os.put((i >> 16) & 0xff);
+        os.put((i >>  8) & 0xff);
+        os.put((i      ) & 0xff);
+    }    
+    
+    void BHepRepWriter::writeInt(int i) {
+        // write network-order
+        os.put((i >> 24) & 0xff);
+        os.put((i >> 16) & 0xff);
+        os.put((i >>  8) & 0xff);
+        os.put((i      ) & 0xff);
+    }
+    
+    void BHepRepWriter::writeByte(unsigned char b) {
+        os.put((char)b);
+    }
+    
+    void BHepRepWriter::writeString(std::string s) {
+        os << s;
+        os.put(0);
+    }
+} // cheprep
Index: tags/visualization-10.5-before-10.6_test/HepRep/src/DefaultHepRep.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/src/DefaultHepRep.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/src/DefaultHepRep.cc	(revision 1102)
@@ -0,0 +1,103 @@
+// Copyright FreeHEP, 2005.
+
+#include "cheprep/DefaultHepRep.h"
+
+using namespace std;
+using namespace HEPREP;
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: DefaultHepRep.cc,v 1.9 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+DefaultHepRep::DefaultHepRep() {
+}
+
+DefaultHepRep::~DefaultHepRep() {
+    for (vector<HepRepTypeTree*>::iterator i1 = typeTrees.begin(); i1 != typeTrees.end(); i1++) {
+        delete (*i1);
+    }
+    for (vector<HepRepInstanceTree*>::iterator i2 = instanceTrees.begin(); i2 != instanceTrees.end(); i2++) {
+        delete (*i2);
+    }
+}
+
+HepRep* DefaultHepRep::copy(HepRepSelectFilter*) {
+    cerr << "DefaultHepRep::copy(HepRepSelectFilter*) not implemented." << endl;
+    return NULL;
+}
+
+vector<string> DefaultHepRep::getLayerOrder() {
+    return layers;
+}
+
+void DefaultHepRep::addLayer(string layer) {
+    layers.push_back(layer);
+}
+
+void DefaultHepRep::addTypeTree(HepRepTypeTree* typeTree) {
+    // FIXME check if already exist    
+    typeTrees.push_back(typeTree);
+}
+
+void DefaultHepRep::removeTypeTree(HepRepTypeTree*) {
+    cerr << "DefaultHepRep::removeTypeTree(HepRepTypeTree*) not implemented." << endl;
+}
+
+HepRepTypeTree* DefaultHepRep::getTypeTree(string, string) {
+    cerr << "DefaultHepRep::getTypeTree(string, string) not implemented." << endl;
+    return NULL;
+}
+
+vector<HepRepTypeTree*> DefaultHepRep::getTypeTreeList() {
+    return typeTrees;
+}
+
+void DefaultHepRep::addInstanceTree(HepRepInstanceTree* instanceTree) {
+    // FIXME check if already exist    
+    instanceTrees.push_back(instanceTree);
+}
+
+void DefaultHepRep::overlayInstanceTree(HepRepInstanceTree *) {
+    cerr << "DefaultHepRep::overlayInstanceTree(HepRepInstanceTree * instanceTree) not implemented." << endl;
+}
+
+void DefaultHepRep::removeInstanceTree(HepRepInstanceTree*) {
+    cerr << "DefaultHepRep::removeInstanceTree(HepRepInstanceTree*) not implemented." << endl;
+}
+
+HepRepInstanceTree* DefaultHepRep::getInstanceTreeTop(string, string) {
+    cerr << "DefaultHepRep::getInstanceTreeTop(string, string) not implemented." << endl;
+    return NULL;
+}
+
+HepRepInstanceTree* DefaultHepRep::getInstances(string, string,
+                                                vector<string>) {
+    cerr << "DefaultHepRep::getInstances(string, string, vector<string>) not implemented." << endl;
+    return NULL;
+}
+
+HepRepInstanceTree* DefaultHepRep::getInstancesAfterAction(
+                                string,
+                                string,
+                                vector<string>,
+                                vector<HepRepAction*>,
+                                bool,
+                                bool,
+                                bool,
+                                vector<string>) {
+    cerr << "DefaultHepRep::getInstancesAfterAction(string, string, vector<string>, vector<HepRepAction*>, bool, bool, bool, vector<string>) not implemented." << endl;
+    return NULL;
+}
+
+string DefaultHepRep::checkForException() {
+    return NULL;
+}
+
+vector<HepRepInstanceTree*> DefaultHepRep::getInstanceTreeList() {
+    return instanceTrees;
+}
+
+} // cheprep
+
Index: tags/visualization-10.5-before-10.6_test/HepRep/src/DefaultHepRepAction.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/src/DefaultHepRepAction.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/src/DefaultHepRepAction.cc	(revision 1102)
@@ -0,0 +1,36 @@
+// Copyright FreeHEP, 2005.
+
+#include <iostream>
+
+#include "cheprep/DefaultHepRepAction.h"
+
+using namespace std;
+using namespace HEPREP;
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: DefaultHepRepAction.cc,v 1.8 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+DefaultHepRepAction::DefaultHepRepAction(string name, string expression)
+    : name(name), expression(expression) {
+}
+
+DefaultHepRepAction::~DefaultHepRepAction() {
+}
+
+string DefaultHepRepAction::getName() {
+    return name;
+}
+
+string DefaultHepRepAction::getExpression() {
+    return expression;
+}
+
+HepRepAction* DefaultHepRepAction::copy() {
+    return new DefaultHepRepAction(name, expression);
+}
+
+} // cheprep
+
Index: tags/visualization-10.5-before-10.6_test/HepRep/src/DefaultHepRepAttDef.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/src/DefaultHepRepAttDef.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/src/DefaultHepRepAttDef.cc	(revision 1102)
@@ -0,0 +1,52 @@
+// Copyright FreeHEP, 2005.
+
+#include <iostream>
+#include <cstring>
+#include <cctype>
+#include <algorithm>
+
+#include "cheprep/DefaultHepRepAttDef.h"
+
+using namespace std;
+using namespace HEPREP;
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: DefaultHepRepAttDef.cc,v 1.8 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+DefaultHepRepAttDef::DefaultHepRepAttDef(string name, string desc, string category, string extra)
+    : name(name), desc(desc), category(category), extra(extra) {
+}
+
+DefaultHepRepAttDef::~DefaultHepRepAttDef() {
+}
+
+HepRepAttDef* DefaultHepRepAttDef::copy() {
+    return new DefaultHepRepAttDef(name, desc, category, extra);
+}
+
+string DefaultHepRepAttDef::getName() {
+    return name;
+}
+
+string DefaultHepRepAttDef::getLowerCaseName() {
+    string s = name;
+    transform(s.begin(), s.end(), s.begin(), (int(*)(int)) tolower);
+    return s;
+}
+
+string DefaultHepRepAttDef::getDescription() {
+    return desc;
+}
+
+string DefaultHepRepAttDef::getCategory() {
+    return category;
+}
+
+string DefaultHepRepAttDef::getExtra() {
+    return extra;
+}
+
+} // cheprep
Index: tags/visualization-10.5-before-10.6_test/HepRep/src/DefaultHepRepAttValue.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/src/DefaultHepRepAttValue.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/src/DefaultHepRepAttValue.cc	(revision 1102)
@@ -0,0 +1,232 @@
+// Copyright FreeHEP, 2005.
+
+#include "cheprep/config.h"
+
+#include <cstdlib>
+#include <cstring>
+#include <cctype>
+#include <cstdio>
+#include <iostream>
+#include <algorithm>
+
+#include "HEPREP/HepRepConstants.h"
+
+#include "cheprep/DefaultHepRepAttValue.h"
+
+using namespace std;
+using namespace HEPREP;
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: DefaultHepRepAttValue.cc,v 1.10 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+std::string DefaultHepRepAttValue::labelStrings[LABELSTRINGS_LEN];
+
+DefaultHepRepAttValue::DefaultHepRepAttValue(string name, string value, int showLabel)
+    : name(name), type(HepRepConstants::TYPE_STRING), stringValue(value), showLabelValue(showLabel) {
+
+    init();
+}
+
+DefaultHepRepAttValue::DefaultHepRepAttValue(string name, int64 value, int showLabel)
+    : name(name), type(HepRepConstants::TYPE_LONG), longValue(value), showLabelValue(showLabel) {
+
+    init();
+}
+
+DefaultHepRepAttValue::DefaultHepRepAttValue(string name, int value, int showLabel)
+    : name(name), type(HepRepConstants::TYPE_INT), longValue(value), showLabelValue(showLabel) {
+
+    init();
+}
+
+DefaultHepRepAttValue::DefaultHepRepAttValue(string name, double value, int showLabel)
+    : name(name), type(HepRepConstants::TYPE_DOUBLE), doubleValue(value), showLabelValue(showLabel) {
+
+    init();
+}
+
+DefaultHepRepAttValue::DefaultHepRepAttValue(string name, bool value, int showLabel)
+    : name(name), type(HepRepConstants::TYPE_BOOLEAN), booleanValue(value), showLabelValue(showLabel) {
+
+    init();
+}
+
+DefaultHepRepAttValue::DefaultHepRepAttValue(string name, vector<double> value, int showLabel)
+    : name(name), type(HepRepConstants::TYPE_COLOR), colorValue(value), showLabelValue(showLabel) {
+
+    init();
+}
+
+DefaultHepRepAttValue::~DefaultHepRepAttValue() {
+}
+
+void DefaultHepRepAttValue::init() {
+    labelStrings[0] = "NAME";
+    labelStrings[1] = "DESC";
+    labelStrings[2] = "VALUE";
+    labelStrings[3] = "EXTRA";
+}
+
+HepRepAttValue* DefaultHepRepAttValue::copy() {
+    switch(type) {
+        case HepRepConstants::TYPE_COLOR: new DefaultHepRepAttValue(name, colorValue, showLabelValue);
+        case HepRepConstants::TYPE_STRING: new DefaultHepRepAttValue(name, stringValue, showLabelValue);
+        case HepRepConstants::TYPE_LONG: new DefaultHepRepAttValue(name, longValue, showLabelValue);
+        case HepRepConstants::TYPE_INT: new DefaultHepRepAttValue(name, (int)longValue, showLabelValue);
+        case HepRepConstants::TYPE_DOUBLE: new DefaultHepRepAttValue(name, doubleValue, showLabelValue);
+        case HepRepConstants::TYPE_BOOLEAN: new DefaultHepRepAttValue(name, booleanValue, showLabelValue);
+        default: return new DefaultHepRepAttValue(name, "Unknown type stored in HepRepAttDef", showLabelValue);
+    }
+}
+
+string DefaultHepRepAttValue::getName() {
+    return name;
+}
+
+string DefaultHepRepAttValue::getLowerCaseName() {
+    string s = name;
+    transform(s.begin(), s.end(), s.begin(), (int(*)(int)) tolower);
+    return s;
+}
+
+int DefaultHepRepAttValue::getType() {
+    return type;
+}
+
+string DefaultHepRepAttValue::getTypeName() {
+    switch(type) {
+        case HepRepConstants::TYPE_COLOR: return("Color");
+        case HepRepConstants::TYPE_STRING: return("String");
+        case HepRepConstants::TYPE_LONG: return("long");
+        case HepRepConstants::TYPE_INT: return("int");
+        case HepRepConstants::TYPE_DOUBLE: return("double");
+        case HepRepConstants::TYPE_BOOLEAN: return("boolean");
+        default: return "Unknown type stored in HepRepAttDef";
+    }
+}
+
+int DefaultHepRepAttValue::showLabel() {
+    return showLabelValue;
+}
+
+string DefaultHepRepAttValue::getString() {
+    if (type != HepRepConstants::TYPE_STRING) cerr << "Trying to access AttValue '" << getName() << "' as 'string'" << endl;
+    return stringValue;
+}
+
+string DefaultHepRepAttValue::getLowerCaseString() {
+    if (type != HepRepConstants::TYPE_STRING) cerr << "Trying to access AttValue '" << getName() << "' as 'string'" << endl;
+    string s = stringValue;
+    transform(s.begin(), s.end(), s.begin(), (int(*)(int)) tolower);
+    return s;
+}
+
+int64 DefaultHepRepAttValue::getLong() {
+    if (type != HepRepConstants::TYPE_LONG) cerr << "Trying to access AttValue '" << getName() << "' as 'long'" << endl;
+    return longValue;
+}
+
+int DefaultHepRepAttValue::getInteger() {
+    if (type != HepRepConstants::TYPE_INT) cerr << "Trying to access AttValue '" << getName() << "' as 'int'" << endl;
+    return (int64)longValue;
+}
+
+double DefaultHepRepAttValue::getDouble() {
+    if (type != HepRepConstants::TYPE_DOUBLE) cerr << "Trying to access AttValue '" << getName() << "' as 'double'" << endl;
+    return doubleValue;
+}
+
+bool DefaultHepRepAttValue::getBoolean() {
+    if (type != HepRepConstants::TYPE_BOOLEAN) cerr << "Trying to access AttValue '" << getName() << "' as 'boolean'" << endl;
+    return booleanValue;
+}
+
+vector<double> DefaultHepRepAttValue::getColor() {
+    if (type != HepRepConstants::TYPE_COLOR) cerr << "Trying to access AttValue '" << getName() << "' as 'color'" << endl;
+    return colorValue;
+}
+
+
+string DefaultHepRepAttValue::getAsString() {
+    switch(type) {
+        case HepRepConstants::TYPE_COLOR:   return getAsString(getColor());
+        case HepRepConstants::TYPE_STRING:  return getString();
+        case HepRepConstants::TYPE_LONG:    return getAsString(getLong());
+        case HepRepConstants::TYPE_INT:     return getAsString(getInteger());
+        case HepRepConstants::TYPE_DOUBLE:  return getAsString(getDouble());
+        case HepRepConstants::TYPE_BOOLEAN: return getAsString(getBoolean());
+        default:                            return "Unknown typecode";
+    }
+}
+
+string DefaultHepRepAttValue::getAsString(vector<double> c) {
+    char buffer[40];
+    sprintf(buffer, "%4.2f, %4.2f, %4.2f, %4.2f",
+                                                c[0],
+                                                c[1],
+                                                c[2],
+                                                (c.size() > 3) ? c[3] : 1.0);
+    return buffer;        
+}
+
+string DefaultHepRepAttValue::getAsString(int i) {
+    char buffer[40];
+    sprintf(buffer, "%d", i);
+    return buffer;        
+}
+
+string DefaultHepRepAttValue::getAsString(int64 i) {
+    char buffer[40];
+    sprintf(buffer, CHEPREP_INT64_FORMAT, i);
+    return buffer;        
+}
+
+// NOTE: keep at %g rather than %lg for backward compatibility
+string DefaultHepRepAttValue::getAsString(double d) {
+    char buffer[40];
+    sprintf(buffer, "%g", d);
+    return buffer;        
+}
+
+string DefaultHepRepAttValue::getAsString(bool b) {
+    return b ? "true" : "false";        
+}
+
+
+
+
+string DefaultHepRepAttValue::toShowLabel() {
+    return toShowLabel(showLabel());
+}
+
+
+string DefaultHepRepAttValue::toShowLabel(int showLabel) {
+    string label = "";
+    bool first = true;
+    if (showLabel == HepRepConstants::SHOW_NONE) {
+        label = "NONE";
+    } else {
+        for (int i=0; i<16; i++) {
+            if (((showLabel >> i) & 0x0001) == 0x0001) {
+                if (first) {
+                    first = false;
+                } else {
+                    label.append(", ");
+                }
+                if (i < LABELSTRINGS_LEN) {
+                    label.append(labelStrings[i]);
+                } else {
+                    char hex[20];
+                    sprintf(hex, "%0x", 1 << i);
+                    label.append(hex);
+                }
+            }
+        }
+    }
+    return label;
+}
+
+} // cheprep
Index: tags/visualization-10.5-before-10.6_test/HepRep/src/DefaultHepRepAttribute.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/src/DefaultHepRepAttribute.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/src/DefaultHepRepAttribute.cc	(revision 1102)
@@ -0,0 +1,96 @@
+// Copyright FreeHEP, 2005.
+
+#include "cheprep/config.h"
+
+#include <iostream>
+#include <algorithm>
+
+#include "cheprep/DefaultHepRepAttribute.h"
+#include "cheprep/DefaultHepRepAttValue.h"
+
+using namespace std;
+using namespace HEPREP;
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: DefaultHepRepAttribute.cc,v 1.8 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+
+DefaultHepRepAttribute::DefaultHepRepAttribute() {
+}
+
+DefaultHepRepAttribute::~DefaultHepRepAttribute() {
+    for (map<string, HepRepAttValue*>::iterator i = attValues.begin(); i != attValues.end(); i++) {
+        delete (*i).second;
+    }
+}
+
+set<HepRepAttValue*> DefaultHepRepAttribute::getAttValuesFromNode() {
+    set<HepRepAttValue*> attSet;
+    for (map<string, HepRepAttValue*>::iterator i = attValues.begin(); i != attValues.end(); i++) {
+        if ((*i).first != "layer") attSet.insert((*i).second);
+    }
+    return attSet;
+}
+
+void DefaultHepRepAttribute::addAttValue(HepRepAttValue* hepRepAttValue) {
+    string lowerCaseName = hepRepAttValue->getLowerCaseName();
+    if (attValues[lowerCaseName] != NULL) delete attValues[lowerCaseName];
+    attValues[lowerCaseName] = hepRepAttValue;
+}
+
+void DefaultHepRepAttribute::addAttValue(string key, char *value, int showLabel) {
+    addAttValue(key, (std::string)value, showLabel);
+}
+
+void DefaultHepRepAttribute::addAttValue(string key, string value, int showLabel) {
+    addAttValue(new DefaultHepRepAttValue(key, value, showLabel));
+}
+
+void DefaultHepRepAttribute::addAttValue(string key, int64 value, int showLabel) {
+    addAttValue(new DefaultHepRepAttValue(key, value, showLabel));
+}
+
+void DefaultHepRepAttribute::addAttValue(string key, int value, int showLabel) {
+    addAttValue(new DefaultHepRepAttValue(key, value, showLabel));
+}
+
+void DefaultHepRepAttribute::addAttValue(string key, double value, int showLabel) {
+    addAttValue(new DefaultHepRepAttValue(key, value, showLabel));
+}
+
+void DefaultHepRepAttribute::addAttValue(string key, bool value, int showLabel) {
+    addAttValue(new DefaultHepRepAttValue(key, value, showLabel));
+}
+
+void DefaultHepRepAttribute::addAttValue(string key, vector<double> value, int showLabel) {
+    addAttValue(new DefaultHepRepAttValue(key, value, showLabel));
+}
+
+void DefaultHepRepAttribute::addAttValue(string key, double red, double green, double blue, double alpha, int showLabel) {
+    vector<double> color;
+    color.push_back(red);
+    color.push_back(green);
+    color.push_back(blue);
+    color.push_back(alpha);
+    addAttValue(new DefaultHepRepAttValue(key, color, showLabel));
+}
+
+HepRepAttValue* DefaultHepRepAttribute::getAttValueFromNode(string name) {
+    string s = name;
+    transform(s.begin(), s.end(), s.begin(), (int(*)(int)) tolower);
+    return (attValues.count(s) > 0) ? attValues[s] : NULL;    
+}
+
+HepRepAttValue* DefaultHepRepAttribute::removeAttValue(string name) {
+    string s = name;
+    transform(s.begin(), s.end(), s.begin(), (int(*)(int)) tolower);
+    HepRepAttValue* attValue = attValues[s];
+    attValues.erase(s);
+    return attValue;
+}
+
+
+} // cheprep
Index: tags/visualization-10.5-before-10.6_test/HepRep/src/DefaultHepRepDefinition.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/src/DefaultHepRepDefinition.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/src/DefaultHepRepDefinition.cc	(revision 1102)
@@ -0,0 +1,53 @@
+// Copyright FreeHEP, 2005.
+
+#include "cheprep/DefaultHepRepDefinition.h"
+#include "cheprep/DefaultHepRepAttDef.h"
+
+#include <iostream>
+#include <algorithm>
+
+using namespace std;
+using namespace HEPREP;
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: DefaultHepRepDefinition.cc,v 1.8 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+DefaultHepRepDefinition::DefaultHepRepDefinition()
+    : DefaultHepRepAttribute() {
+}
+
+DefaultHepRepDefinition::~DefaultHepRepDefinition() {
+    set<HepRepAttDef *> list = getAttDefsFromNode();
+    for (set<HepRepAttDef*>::iterator i1 = list.begin(); i1 != list.end(); i1++) {
+        delete (*i1);
+    }
+}
+
+set<HepRepAttDef *> DefaultHepRepDefinition::getAttDefsFromNode() {
+    set<HepRepAttDef*> attSet;
+    for (map<string, HepRepAttDef*>::iterator i = attDefs.begin(); i != attDefs.end(); i++) {
+        attSet.insert((*i).second);
+    }
+    return attSet;
+}
+
+void DefaultHepRepDefinition::addAttDef(HepRepAttDef* hepRepAttDef) {
+    string lowerCaseName = hepRepAttDef->getLowerCaseName();
+    if (attDefs[lowerCaseName] != NULL) delete attDefs[lowerCaseName];
+    attDefs[lowerCaseName] = hepRepAttDef;
+}
+
+void DefaultHepRepDefinition::addAttDef(string name, string desc, string type, string extra) {
+    addAttDef(new DefaultHepRepAttDef(name, desc, type, extra));
+}
+
+HepRepAttDef* DefaultHepRepDefinition::getAttDefFromNode(string name) {
+    string s = name;
+    transform(s.begin(), s.end(), s.begin(), (int(*)(int)) tolower);
+    return (attDefs.count(s) > 0) ? attDefs[s] : NULL;    
+}
+
+} // cheprep
Index: tags/visualization-10.5-before-10.6_test/HepRep/src/DefaultHepRepFactory.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/src/DefaultHepRepFactory.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/src/DefaultHepRepFactory.cc	(revision 1102)
@@ -0,0 +1,90 @@
+// Copyright FreeHEP, 2005.
+
+#include <iostream>
+#include <fstream>
+
+#include "cheprep/DefaultHepRepFactory.h"
+#include "cheprep/DefaultHepRepPoint.h"
+#include "cheprep/DefaultHepRepInstance.h"
+#include "cheprep/DefaultHepRepInstanceTree.h"
+#include "cheprep/DefaultHepRepType.h"
+#include "cheprep/DefaultHepRepTypeTree.h"
+#include "cheprep/DefaultHepRep.h"
+#include "cheprep/DefaultHepRepAction.h"
+#include "cheprep/DefaultHepRepTreeID.h"
+
+using namespace std;
+using namespace HEPREP;
+
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: DefaultHepRepFactory.cc,v 1.6 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+DefaultHepRepFactory::DefaultHepRepFactory() {
+}
+
+DefaultHepRepFactory::~DefaultHepRepFactory() {
+}
+
+HepRepReader* DefaultHepRepFactory::createHepRepReader (istream*) {
+    cerr << "DefaultHepRepFactory::createHepRepReader not implemented" << endl;
+    return NULL;
+}
+
+HepRepReader* DefaultHepRepFactory::createHepRepReader (std::string) {
+    cerr << "DefaultHepRepFactory::createHepRepReader not implemented" << endl;
+    return NULL;
+}
+
+HepRepWriter* DefaultHepRepFactory::createHepRepWriter(ostream*, bool, bool) {
+    cerr << "DefaultHepRepFactory::createHepRepWriter not implemented" << endl;
+    return NULL;
+}
+
+HepRepPoint* DefaultHepRepFactory::createHepRepPoint (HepRepInstance* instance,
+                               double x, double y, double z) {
+    return new DefaultHepRepPoint(instance, x, y, z);
+}
+
+HepRepInstance* DefaultHepRepFactory::createHepRepInstance (HepRepInstance* parent, HepRepType* type) {
+    return new DefaultHepRepInstance(parent, type);
+}
+
+HepRepInstance* DefaultHepRepFactory::createHepRepInstance (HepRepInstanceTree* parent, HepRepType* type) {
+    return new DefaultHepRepInstance(parent, type);
+}
+
+HepRepTreeID* DefaultHepRepFactory::createHepRepTreeID (string name, string version, string qualifier) {
+    return new DefaultHepRepTreeID(name, version, qualifier);
+}
+
+HepRepAction* DefaultHepRepFactory::createHepRepAction (string name, string expression) {
+    return new DefaultHepRepAction(name, expression);
+}
+
+HepRepInstanceTree* DefaultHepRepFactory::createHepRepInstanceTree (string name, string version,
+                                                    HepRepTreeID* typeTreeID) {
+    return new DefaultHepRepInstanceTree(name, version, typeTreeID);
+}
+
+HepRepType* DefaultHepRepFactory::createHepRepType (HepRepType* parent, string name) {
+    return new DefaultHepRepType(parent, name);
+}
+
+HepRepType* DefaultHepRepFactory::createHepRepType (HepRepTypeTree* parent, string name) {
+    return new DefaultHepRepType(parent, name);
+}
+
+HepRepTypeTree* DefaultHepRepFactory::createHepRepTypeTree (HepRepTreeID* treeID) {
+    return new DefaultHepRepTypeTree(treeID);
+}
+
+HepRep* DefaultHepRepFactory::createHepRep () {
+    return new DefaultHepRep();
+}
+
+} // cheprep
+
Index: tags/visualization-10.5-before-10.6_test/HepRep/src/DefaultHepRepInstance.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/src/DefaultHepRepInstance.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/src/DefaultHepRepInstance.cc	(revision 1102)
@@ -0,0 +1,88 @@
+// Copyright FreeHEP, 2005.
+
+#include <iostream>
+
+#include "cheprep/DefaultHepRepInstance.h"
+
+using namespace std;
+using namespace HEPREP;
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: DefaultHepRepInstance.cc,v 1.7 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+DefaultHepRepInstance::DefaultHepRepInstance(HepRepInstance* instance, HepRepType* heprepType)
+    : DefaultHepRepAttribute(), parent(instance), type(heprepType) {
+
+    if (type == NULL) cerr << "HepRepInstance cannot be created without a HepRepType." << endl;
+    parent->addInstance(this);
+}
+
+DefaultHepRepInstance::DefaultHepRepInstance(HepRepInstanceTree* instanceTree, HepRepType* heprepType)
+    : DefaultHepRepAttribute(), parent(NULL), type(heprepType) {
+
+    if (type == NULL) cerr << "HepRepInstance cannot be created without a HepRepType." << endl;
+    instanceTree->addInstance(this);
+}
+
+DefaultHepRepInstance::~DefaultHepRepInstance() {
+    parent = NULL;
+    type = NULL;
+    for (vector<HepRepInstance*>::iterator i1 = instances.begin(); i1 != instances.end(); i1++) {
+        delete (*i1);
+    }
+    for (vector<HepRepPoint*>::iterator i2 = points.begin(); i2 != points.end(); i2++) {
+        delete (*i2);
+    }
+}
+
+void DefaultHepRepInstance::overlay(HepRepInstance *) {
+    cerr << "DefaultHepRepInstance::overlay(HepRepInstance * instance) not implemented." << endl;
+}
+
+HepRepInstance* DefaultHepRepInstance::copy(HepRepTypeTree*, HepRepInstance*, HepRepSelectFilter*) {
+    cerr << "DefaultHepRepInstance::copy(HepRepTypeTree*, HepRepInstance*, HepRepSelectFilter*) not implemented." << endl;
+    return NULL;
+}
+
+HepRepInstance* DefaultHepRepInstance::copy(HepRepTypeTree*, HepRepInstanceTree*, HepRepSelectFilter*) {
+    cerr << "DefaultHepRepInstance::copy(HepRepTypeTree*, HepRepInstanceTree*, HepRepSelectFilter*) not implemented." << endl;
+    return NULL;
+}
+
+HepRepType* DefaultHepRepInstance::getType() {
+    return type;
+}
+
+void DefaultHepRepInstance::addPoint(HepRepPoint* point) {
+    points.push_back(point);
+}
+
+vector<HepRepPoint*> DefaultHepRepInstance::getPoints() {
+    return points;
+}
+
+HepRepInstance* DefaultHepRepInstance::getSuperInstance() {
+    return parent;
+}
+
+void DefaultHepRepInstance::addInstance(HepRepInstance* instance) {
+    instances.push_back(instance);
+}
+
+void DefaultHepRepInstance::removeInstance(HepRepInstance*) {
+    cerr << "DefaultHepRepInstance::removeInstance(HepRepInstance*) not implemented." << endl;
+}
+
+vector<HepRepInstance*> DefaultHepRepInstance::getInstances() {
+    return instances;
+}
+
+HepRepAttValue* DefaultHepRepInstance::getAttValue(string name) {
+    HepRepAttValue* value = getAttValueFromNode(name);
+    return (value != NULL) ? value : type->getAttValue(name);
+}
+
+} // cheprep
Index: tags/visualization-10.5-before-10.6_test/HepRep/src/DefaultHepRepInstanceTree.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/src/DefaultHepRepInstanceTree.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/src/DefaultHepRepInstanceTree.cc	(revision 1102)
@@ -0,0 +1,59 @@
+// Copyright FreeHEP, 2005.
+
+#include "cheprep/DefaultHepRepInstanceTree.h"
+
+using namespace std;
+using namespace HEPREP;
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: DefaultHepRepInstanceTree.cc,v 1.11 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+DefaultHepRepInstanceTree::DefaultHepRepInstanceTree(string name, string version, HepRepTreeID* typeTree)
+    : DefaultHepRepTreeID(name, version), typeTree(typeTree) {
+}
+
+DefaultHepRepInstanceTree::~DefaultHepRepInstanceTree() {
+    for (vector<HepRepInstance*>::iterator i1 = instances.begin(); i1 != instances.end(); i1++) {
+        delete (*i1);
+    }
+    instances.clear();
+}
+
+void DefaultHepRepInstanceTree::overlay(HepRepInstanceTree *) {
+    cerr << "DefaultHepRepInstanceTree::overlay(HepRepInstanceTree * instanceTree) not implemented." << endl;
+}
+
+HepRepInstanceTree* DefaultHepRepInstanceTree::copy(HepRepTypeTree*, HepRepSelectFilter*) {
+    cerr << "DefaultHepRepInstanceTree::copy(HepRepTypeTree*, HepRepSelectFilter*) not implemented." << endl;
+    return NULL;
+}
+
+void DefaultHepRepInstanceTree::addInstance(HepRepInstance* instance) {
+    instances.push_back(instance);
+}
+
+void DefaultHepRepInstanceTree::removeInstance(HepRepInstance*) {
+    cerr << "DefaultHepRepInstanceTree::removeInstance(HepRepInstance*) not implemented." << endl;
+}
+
+vector<HepRepInstance*> DefaultHepRepInstanceTree::getInstances() {
+    return instances;
+}
+
+void DefaultHepRepInstanceTree::addInstanceTree(HepRepTreeID* treeID) {
+    instanceTrees.push_back(treeID);
+}
+
+HepRepTreeID* DefaultHepRepInstanceTree::getTypeTree() {
+    return typeTree;
+}
+
+vector<HepRepTreeID*> DefaultHepRepInstanceTree::getInstanceTreeList() {
+    return instanceTrees;
+}
+
+} // cheprep
+
Index: tags/visualization-10.5-before-10.6_test/HepRep/src/DefaultHepRepPoint.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/src/DefaultHepRepPoint.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/src/DefaultHepRepPoint.cc	(revision 1102)
@@ -0,0 +1,124 @@
+// Copyright FreeHEP, 2005.
+
+#include <string>
+#include <iostream>
+#include <cmath>
+
+#include "cheprep/DefaultHepRepPoint.h"
+
+using namespace std;
+using namespace HEPREP;
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: DefaultHepRepPoint.cc,v 1.5 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+DefaultHepRepPoint::DefaultHepRepPoint(HepRepInstance* inst, double x, double y, double z)
+    : DefaultHepRepAttribute(), instance(inst), x(x), y(y), z(z) {
+
+    if (instance == NULL) {
+        cerr << "HepRepPoints cannot be created without a HepRepInstance." << endl;
+    } else {
+        instance->addPoint(this);
+    }
+}
+
+DefaultHepRepPoint::~DefaultHepRepPoint() {
+}
+
+HepRepInstance* DefaultHepRepPoint::getInstance() {
+    return instance;
+}
+
+HepRepAttValue* DefaultHepRepPoint::getAttValue(string lowerCaseName) {
+    HepRepAttValue* value = getAttValueFromNode(lowerCaseName);
+    return (value != NULL) ? value : instance->getAttValue(lowerCaseName);
+}
+
+HepRepPoint* DefaultHepRepPoint::copy(HepRepInstance* inst) {
+    return new DefaultHepRepPoint(inst, x, y, z);
+}
+
+double DefaultHepRepPoint::getX() {
+    return x;
+}
+
+double DefaultHepRepPoint::getY() {
+    return y;
+}
+
+double DefaultHepRepPoint::getZ() {
+    return z;
+}
+
+vector<double>* DefaultHepRepPoint::getXYZ(vector<double>* xyz) {
+    (*xyz)[0] = x;
+    (*xyz)[1] = y;
+    (*xyz)[2] = z;
+    return xyz;
+}
+
+double DefaultHepRepPoint::getRho() {
+    return sqrt(x*x + y*y);
+}
+
+double DefaultHepRepPoint::getPhi() {
+    return atan2(y, x);
+}
+
+double DefaultHepRepPoint::getTheta() {
+    return atan2(getRho(), z);
+}
+
+double DefaultHepRepPoint::getR() {
+    double r = getRho();
+    return sqrt(r*r + z*z);
+}
+
+double DefaultHepRepPoint::getEta() {
+    double ct = cos(getTheta());
+    return -0.5*log((1.-ct)/(1.+ct));
+}
+
+double DefaultHepRepPoint::getX(double xVertex, double, double) {
+    return x - xVertex;
+}
+
+double DefaultHepRepPoint::getY(double, double yVertex, double) {
+    return y - yVertex;
+}
+
+double DefaultHepRepPoint::getZ(double, double, double zVertex) {
+    return z - zVertex;
+}
+
+double DefaultHepRepPoint::getRho(double xVertex, double yVertex, double zVertex) {
+    double dx = getX(xVertex, yVertex, zVertex);
+    double dy = getY(xVertex, yVertex, zVertex);
+    return sqrt(dx*dx + dy*dy);
+}
+
+double DefaultHepRepPoint::getPhi(double xVertex, double yVertex, double zVertex) {
+    return atan2(getY(xVertex, yVertex, zVertex), getX(xVertex, yVertex, zVertex));
+}
+
+double DefaultHepRepPoint::getTheta(double xVertex, double yVertex, double zVertex) {
+    return atan2(getRho(xVertex, yVertex, zVertex), getZ(xVertex, yVertex, zVertex));
+}
+
+double DefaultHepRepPoint::getR(double xVertex, double yVertex, double zVertex) {
+    double dr = getRho(xVertex, yVertex, zVertex);
+    double dz = getZ(xVertex, yVertex, zVertex);
+    return sqrt(dr*dr + dz*dz);
+}
+
+double DefaultHepRepPoint::getEta(double xVertex, double yVertex, double zVertex) {
+    double ct = cos(getTheta(xVertex, yVertex, zVertex));
+    return -0.5*log((1.-ct)/(1.+ct));
+}
+
+
+} // cheprep
+
Index: tags/visualization-10.5-before-10.6_test/HepRep/src/DefaultHepRepTreeID.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/src/DefaultHepRepTreeID.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/src/DefaultHepRepTreeID.cc	(revision 1102)
@@ -0,0 +1,39 @@
+// Copyright FreeHEP, 2005.
+
+#include <iostream>
+
+#include "cheprep/DefaultHepRepTreeID.h"
+
+using namespace std;
+using namespace HEPREP;
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: DefaultHepRepTreeID.cc,v 1.9 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+DefaultHepRepTreeID::DefaultHepRepTreeID(string name, string version, string qualifier)
+    : name(name), version(version), qualifier(qualifier) {
+}
+
+DefaultHepRepTreeID::~DefaultHepRepTreeID() {
+}
+
+string DefaultHepRepTreeID::getQualifier() {
+    return qualifier;
+}
+
+void DefaultHepRepTreeID::setQualifier(string qual) {
+    this->qualifier = qual;
+}
+
+string DefaultHepRepTreeID::getName() {
+    return name;
+}
+
+string DefaultHepRepTreeID::getVersion() {
+    return version;
+}
+
+} // cheprep
Index: tags/visualization-10.5-before-10.6_test/HepRep/src/DefaultHepRepType.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/src/DefaultHepRepType.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/src/DefaultHepRepType.cc	(revision 1102)
@@ -0,0 +1,113 @@
+// Copyright FreeHEP, 2005.
+
+#include "cheprep/DefaultHepRepType.h"
+
+using namespace std;
+using namespace HEPREP;
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: DefaultHepRepType.cc,v 1.8 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+DefaultHepRepType::DefaultHepRepType(HepRepType* parentType, string typeName)
+    : DefaultHepRepDefinition(), parent(parentType), name(typeName) {
+    this->description = "No Description";
+    this->infoURL = "No Info URL";
+
+    // HepRepTypes are sometimes used without a parent (top-level)
+    if (parent != NULL) {
+        parent->addType(this);
+    }
+}
+
+DefaultHepRepType::DefaultHepRepType(HepRepTypeTree* parentTypeTree, string typeName)
+    : DefaultHepRepDefinition(), parent(NULL), name(typeName) {
+    this->description = "No Description";
+    this->infoURL = "No Info URL";
+    
+    parentTypeTree->addType(this);
+}
+
+DefaultHepRepType::~DefaultHepRepType() {
+    for (vector<HepRepType*>::iterator i1 = types.begin(); i1 != types.end(); i1++) {
+        delete (*i1);
+    }
+}
+
+HepRepType* DefaultHepRepType::getSuperType() {
+    return parent;
+}
+
+HepRepAttDef* DefaultHepRepType::getAttDef(string defName) {
+    HepRepAttDef* def = NULL;
+    HepRepType* type = this;
+    while ((def == NULL) && (type != NULL)) {
+        def = type->getAttDefFromNode(defName);
+        type = type->getSuperType();
+    }
+    if (def == NULL) {
+        cerr << "ERROR: No HepRepDefaults, trying to get definition for: " << defName << endl;
+        // FIXME, no HepRepDefaults
+    }
+    return def;
+}
+
+/**
+ * searched for a value with given name. Search up the type tree if needed.
+ */
+HepRepAttValue* DefaultHepRepType::getAttValue(string attName) {
+    HepRepAttValue* value = NULL;
+    HepRepType* type = this;
+    while ((value == NULL) && (type != NULL)) {
+        value = type->getAttValueFromNode(attName);
+        type = type->getSuperType();
+    }
+    if (value == NULL) {
+        cerr << "ERROR: No HepRepDefaults, trying to get value for: " << attName << endl;
+        // FIXME, no HepRepDefaults
+    }
+    return value;
+}
+
+HepRepType* DefaultHepRepType::copy(HepRepType*) {
+    cerr << "DefaultHepRepType::copy(HepRepType*) not implemented." << endl;
+    return NULL;
+}
+
+string DefaultHepRepType::getName() {
+    return name;
+}
+
+string DefaultHepRepType::getFullName() {
+    return (getSuperType() == NULL) ? getName() : getSuperType()->getFullName() + "/" + getName();
+}
+
+string DefaultHepRepType::getDescription() {
+    return description;
+}
+
+void DefaultHepRepType::setDescription(string desc) {
+    this->description = desc;
+}
+
+string DefaultHepRepType::getInfoURL() {
+    return infoURL;
+}
+
+void DefaultHepRepType::setInfoURL(string info) {
+    this->infoURL = info;
+}
+
+void DefaultHepRepType::addType(HepRepType* type) {
+    // FIXME should check if type already exists
+    types.push_back(type);
+}
+
+vector<HepRepType*> DefaultHepRepType::getTypeList() {
+    return types;
+}
+
+
+} // cheprep
Index: tags/visualization-10.5-before-10.6_test/HepRep/src/DefaultHepRepTypeTree.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/src/DefaultHepRepTypeTree.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/src/DefaultHepRepTypeTree.cc	(revision 1102)
@@ -0,0 +1,46 @@
+// Copyright FreeHEP, 2005.
+
+#include <iostream>
+
+#include "cheprep/DefaultHepRepTypeTree.h"
+
+using namespace std;
+using namespace HEPREP;
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: DefaultHepRepTypeTree.cc,v 1.7 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+DefaultHepRepTypeTree::DefaultHepRepTypeTree(HepRepTreeID* typeTree)
+    : DefaultHepRepTreeID(typeTree->getName(), typeTree->getVersion()) {
+    delete typeTree;
+}
+
+DefaultHepRepTypeTree::~DefaultHepRepTypeTree() {
+    for (vector<HepRepType*>::iterator i1 = types.begin(); i1 != types.end(); i1++) {
+        delete (*i1);
+    }
+}
+
+HepRepTypeTree* DefaultHepRepTypeTree::copy() {
+    cerr << "DefaultHepRepTypeTree::copy() not implemented." << endl;
+    return NULL;
+}
+
+void DefaultHepRepTypeTree::addType(HepRepType* type) {
+    // FIXME should check if type already exists
+    types.push_back(type);
+}
+
+vector<HepRepType*> DefaultHepRepTypeTree::getTypeList() {
+    return types;
+}
+
+HepRepType* DefaultHepRepTypeTree::getType(string /*typeName*/) {
+    cerr << "DefaultHepRepTypeTree::getType(string) not implemented." << endl;
+    return NULL;
+}
+
+} // cheprep
Index: tags/visualization-10.5-before-10.6_test/HepRep/src/DeflateOutputStreamBuffer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/src/DeflateOutputStreamBuffer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/src/DeflateOutputStreamBuffer.cc	(revision 1102)
@@ -0,0 +1,243 @@
+// Copyright FreeHEP, 2005.
+
+#include "cheprep/DeflateOutputStreamBuffer.h"
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: DeflateOutputStreamBuffer.cc,v 1.6 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+    using namespace std;
+
+    unsigned long DeflateOutputStreamBuffer::crctable[] = {
+        0x00000000L, 0x77073096L, 0xEE0E612CL, 0x990951BAL,
+        0x076DC419L, 0x706AF48FL, 0xE963A535L, 0x9E6495A3L,
+        0x0EDB8832L, 0x79DCB8A4L, 0xE0D5E91EL, 0x97D2D988L,
+        0x09B64C2BL, 0x7EB17CBDL, 0xE7B82D07L, 0x90BF1D91L,
+        0x1DB71064L, 0x6AB020F2L, 0xF3B97148L, 0x84BE41DEL,
+        0x1ADAD47DL, 0x6DDDE4EBL, 0xF4D4B551L, 0x83D385C7L,
+        0x136C9856L, 0x646BA8C0L, 0xFD62F97AL, 0x8A65C9ECL,
+        0x14015C4FL, 0x63066CD9L, 0xFA0F3D63L, 0x8D080DF5L,
+        0x3B6E20C8L, 0x4C69105EL, 0xD56041E4L, 0xA2677172L,
+        0x3C03E4D1L, 0x4B04D447L, 0xD20D85FDL, 0xA50AB56BL,
+        0x35B5A8FAL, 0x42B2986CL, 0xDBBBC9D6L, 0xACBCF940L,
+        0x32D86CE3L, 0x45DF5C75L, 0xDCD60DCFL, 0xABD13D59L,
+        0x26D930ACL, 0x51DE003AL, 0xC8D75180L, 0xBFD06116L,
+        0x21B4F4B5L, 0x56B3C423L, 0xCFBA9599L, 0xB8BDA50FL,
+        0x2802B89EL, 0x5F058808L, 0xC60CD9B2L, 0xB10BE924L,
+        0x2F6F7C87L, 0x58684C11L, 0xC1611DABL, 0xB6662D3DL,
+        0x76DC4190L, 0x01DB7106L, 0x98D220BCL, 0xEFD5102AL,
+        0x71B18589L, 0x06B6B51FL, 0x9FBFE4A5L, 0xE8B8D433L,
+        0x7807C9A2L, 0x0F00F934L, 0x9609A88EL, 0xE10E9818L,
+        0x7F6A0DBBL, 0x086D3D2DL, 0x91646C97L, 0xE6635C01L,
+        0x6B6B51F4L, 0x1C6C6162L, 0x856530D8L, 0xF262004EL,
+        0x6C0695EDL, 0x1B01A57BL, 0x8208F4C1L, 0xF50FC457L,
+        0x65B0D9C6L, 0x12B7E950L, 0x8BBEB8EAL, 0xFCB9887CL,
+        0x62DD1DDFL, 0x15DA2D49L, 0x8CD37CF3L, 0xFBD44C65L,
+        0x4DB26158L, 0x3AB551CEL, 0xA3BC0074L, 0xD4BB30E2L,
+        0x4ADFA541L, 0x3DD895D7L, 0xA4D1C46DL, 0xD3D6F4FBL,
+        0x4369E96AL, 0x346ED9FCL, 0xAD678846L, 0xDA60B8D0L,
+        0x44042D73L, 0x33031DE5L, 0xAA0A4C5FL, 0xDD0D7CC9L,
+        0x5005713CL, 0x270241AAL, 0xBE0B1010L, 0xC90C2086L,
+        0x5768B525L, 0x206F85B3L, 0xB966D409L, 0xCE61E49FL,
+        0x5EDEF90EL, 0x29D9C998L, 0xB0D09822L, 0xC7D7A8B4L,
+        0x59B33D17L, 0x2EB40D81L, 0xB7BD5C3BL, 0xC0BA6CADL,
+        0xEDB88320L, 0x9ABFB3B6L, 0x03B6E20CL, 0x74B1D29AL,
+        0xEAD54739L, 0x9DD277AFL, 0x04DB2615L, 0x73DC1683L,
+        0xE3630B12L, 0x94643B84L, 0x0D6D6A3EL, 0x7A6A5AA8L,
+        0xE40ECF0BL, 0x9309FF9DL, 0x0A00AE27L, 0x7D079EB1L,
+        0xF00F9344L, 0x8708A3D2L, 0x1E01F268L, 0x6906C2FEL,
+        0xF762575DL, 0x806567CBL, 0x196C3671L, 0x6E6B06E7L,
+        0xFED41B76L, 0x89D32BE0L, 0x10DA7A5AL, 0x67DD4ACCL,
+        0xF9B9DF6FL, 0x8EBEEFF9L, 0x17B7BE43L, 0x60B08ED5L,
+        0xD6D6A3E8L, 0xA1D1937EL, 0x38D8C2C4L, 0x4FDFF252L,
+        0xD1BB67F1L, 0xA6BC5767L, 0x3FB506DDL, 0x48B2364BL,
+        0xD80D2BDAL, 0xAF0A1B4CL, 0x36034AF6L, 0x41047A60L,
+        0xDF60EFC3L, 0xA867DF55L, 0x316E8EEFL, 0x4669BE79L,
+        0xCB61B38CL, 0xBC66831AL, 0x256FD2A0L, 0x5268E236L,
+        0xCC0C7795L, 0xBB0B4703L, 0x220216B9L, 0x5505262FL,
+        0xC5BA3BBEL, 0xB2BD0B28L, 0x2BB45A92L, 0x5CB36A04L,
+        0xC2D7FFA7L, 0xB5D0CF31L, 0x2CD99E8BL, 0x5BDEAE1DL,
+        0x9B64C2B0L, 0xEC63F226L, 0x756AA39CL, 0x026D930AL,
+        0x9C0906A9L, 0xEB0E363FL, 0x72076785L, 0x05005713L,
+        0x95BF4A82L, 0xE2B87A14L, 0x7BB12BAEL, 0x0CB61B38L,
+        0x92D28E9BL, 0xE5D5BE0DL, 0x7CDCEFB7L, 0x0BDBDF21L,
+        0x86D3D2D4L, 0xF1D4E242L, 0x68DDB3F8L, 0x1FDA836EL,
+        0x81BE16CDL, 0xF6B9265BL, 0x6FB077E1L, 0x18B74777L,
+        0x88085AE6L, 0xFF0F6A70L, 0x66063BCAL, 0x11010B5CL,
+        0x8F659EFFL, 0xF862AE69L, 0x616BFFD3L, 0x166CCF45L,
+        0xA00AE278L, 0xD70DD2EEL, 0x4E048354L, 0x3903B3C2L,
+        0xA7672661L, 0xD06016F7L, 0x4969474DL, 0x3E6E77DBL,
+        0xAED16A4AL, 0xD9D65ADCL, 0x40DF0B66L, 0x37D83BF0L,
+        0xA9BCAE53L, 0xDEBB9EC5L, 0x47B2CF7FL, 0x30B5FFE9L,
+        0xBDBDF21CL, 0xCABAC28AL, 0x53B39330L, 0x24B4A3A6L,
+        0xBAD03605L, 0xCDD70693L, 0x54DE5729L, 0x23D967BFL,
+        0xB3667A2EL, 0xC4614AB8L, 0x5D681B02L, 0x2A6F2B94L,
+        0xB40BBE37L, 0xC30C8EA1L, 0x5A05DF1BL, 0x2D02EF8DL
+    };
+
+    DeflateOutputStreamBuffer::DeflateOutputStreamBuffer(streambuf *buffer) 
+            : buffer(buffer)
+              , crc(0)
+              , size(0)
+#ifndef CHEPREP_NO_ZLIB               
+              , zStreamOpen(false)
+              , in(inSize)
+              , out(outSize) 
+#endif // CHEPREP_NO_ZLIB
+              {
+        
+#ifndef CHEPREP_NO_ZLIB
+        zStream.zalloc = Z_NULL;
+        zStream.zfree = Z_NULL;
+        zStream.opaque = Z_NULL;
+#endif // CHEPREP_NO_ZLIB
+    }
+        
+
+    void DeflateOutputStreamBuffer::init(bool compress) {
+
+#ifndef CHEPREP_NO_ZLIB        
+        if (compress) {
+            if (zStreamOpen) return;
+            
+            zStream.next_in = reinterpret_cast<unsigned char *>(&(in[0]));
+            zStream.avail_in = 0 ;
+    
+            zStream.next_out = reinterpret_cast<unsigned char *>(&(out[0]));
+            zStream.avail_out = out.size();
+    
+            if (deflateInit2(&zStream, 6, Z_DEFLATED, -MAX_WBITS, 8, Z_DEFAULT_STRATEGY ) != Z_OK) {
+                cerr << "ERROR: deflateInit2 failed" << endl;
+            } else {
+                zStreamOpen = true;
+                setp(&(in[0]), &(in[0])+inSize);
+            }
+        }
+#else
+        // suppress warning about unused var
+        compress = false;
+#endif // CHEPREP_NO_ZLIB
+
+        crc = 0;
+        size = 0;
+    }
+    
+    void DeflateOutputStreamBuffer::finish() {
+
+#ifndef CHEPREP_NO_ZLIB        
+        if (zStreamOpen) {
+
+            overflow() ;
+
+            zStream.next_out  = reinterpret_cast<unsigned char *>(&(out[0]));
+            zStream.avail_out = outSize;
+    
+            int err = Z_OK ;
+            while ( err == Z_OK ) {
+                if (zStream.avail_out == 0) {
+                    flushOut();
+                }
+                err = deflate(&zStream, Z_FINISH);
+            }
+        
+            flushOut() ;
+    
+            if (err != Z_STREAM_END) {
+                cerr << "ERROR: deflation failed" << endl;
+            }
+    
+            if (deflateEnd(&zStream) != Z_OK) {
+                cerr << "ERROR: deflateEnd failed" << endl;
+            }
+            
+            zStreamOpen = false ;
+        }      
+#endif // CHEPREP_NO_ZLIB
+    }
+                
+    DeflateOutputStreamBuffer::~DeflateOutputStreamBuffer() {
+    }
+
+
+#ifndef CHEPREP_NO_ZLIB        
+    #define DO1 crc = crctable[(crc ^ (*buf++)) & 0xff] ^ (crc >> 8)
+    #define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1
+#endif // CHEPREP_NO_ZLIB
+
+
+    int DeflateOutputStreamBuffer::overflow(int c) {
+
+#ifndef CHEPREP_NO_ZLIB        
+        if (zStreamOpen) {
+            zStream.avail_in = pptr() - pbase() ;
+            zStream.next_in = reinterpret_cast<unsigned char *>(&(in[0]));
+        
+            int len = zStream.avail_in;
+            unsigned char* buf = zStream.next_in;
+        
+            crc = crc ^ 0xffffffffUL;
+            while (len >= 8) {
+                DO8;
+                len -= 8;
+            }
+            if (len) do {
+                DO1;
+            } while (--len);
+            crc = crc ^ 0xffffffffUL;
+    
+            size += zStream.avail_in;
+
+            zStream.next_out  = reinterpret_cast<unsigned char *>(&(out[0]));
+            zStream.avail_out = outSize ;
+        
+            int err = Z_OK ;
+            while ((zStream.avail_in > 0 || zStream.avail_out == 0) && err == Z_OK) {
+                if (zStream.avail_out == 0 ) {
+                    flushOut();
+                }
+                err = deflate(&zStream, Z_NO_FLUSH);
+            }
+
+            flushOut();
+        
+            setp(&(in[0]), &(in[0]) + inSize);
+
+            if ((err != Z_OK) && (err != Z_STREAM_END)) {
+                cerr << "ERROR: deflation failed" << endl;
+                return EOF ;
+            }
+
+            if ( c != EOF ) {
+                *pptr() = c ;
+                pbump(1);
+            }
+    
+            return 0 ;
+        } else {
+#endif // CHEPREP_NO_ZLIB
+            crc = crc ^ 0xffffffffUL;
+            crc = crctable[(crc ^ c) & 0xff] ^ (crc >> 8);
+            crc = crc ^ 0xffffffffUL;
+            size++;
+            return buffer->sputc((char)c);
+#ifndef CHEPREP_NO_ZLIB        
+        }
+#endif // CHEPREP_NO_ZLIB
+    }
+    
+
+#ifndef CHEPREP_NO_ZLIB        
+    bool DeflateOutputStreamBuffer::flushOut() {
+        int deflatedCount = outSize - zStream.avail_out;
+        int byteCount = buffer->sputn(&(out[0]), deflatedCount);
+
+        zStream.next_out = reinterpret_cast<unsigned char *>(&(out[0]));
+        zStream.avail_out = outSize ;
+
+        return deflatedCount == byteCount ;
+    }
+#endif // CHEPREP_NO_ZLIB
+    
+} // cheprep
Index: tags/visualization-10.5-before-10.6_test/HepRep/src/G4HepRep.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/src/G4HepRep.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/src/G4HepRep.cc	(revision 1102)
@@ -0,0 +1,90 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4HepRep.cc,v 1.22 2006/06/29 21:17:20 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+
+/**
+ * We allow only one HepRep Scene handler and one attached Viewer.
+ * The sceneHandler associates with the output file
+ *
+ * @author Mark Donszelmann
+ */
+
+//G4
+#include "G4Types.hh"
+#include "G4HepRepViewer.hh"
+#include "G4HepRepSceneHandler.hh"
+#include "G4HepRepMessenger.hh"
+
+//This
+#include "G4HepRep.hh"
+
+using namespace HEPREP;
+using namespace std;
+
+G4HepRep::G4HepRep ()
+        : G4VGraphicsSystem ("G4HepRep",
+                             "HepRepXML",
+        	             "HepRep Generic Driver for XML, RMI and CORBA",
+                             G4VGraphicsSystem::threeD),
+          sceneHandler(NULL),
+          viewer(NULL) {
+    messenger = new G4HepRepMessenger();
+}
+
+G4HepRep::~G4HepRep () {
+    delete messenger;
+}
+
+G4VSceneHandler* G4HepRep::CreateSceneHandler (const G4String& name) {
+    if (sceneHandler != NULL) {
+        cout << "G4HepRep::CreateSceneHandler: Cannot create more than one G4HepRepSceneHandler" << endl;
+        return NULL;
+    }
+    sceneHandler = new G4HepRepSceneHandler (*this, *messenger, name);
+    return sceneHandler;
+}
+
+G4VViewer* G4HepRep::CreateViewer (G4VSceneHandler& scene, const G4String& name) {
+    if (viewer != NULL) {
+        cout << "G4HepRep::CreateViewer: Cannot create more than one G4HepRepViewer" << endl;
+        return NULL;
+    }
+    viewer  = new G4HepRepViewer ((G4HepRepSceneHandler&)scene, *messenger, name);
+    return viewer;
+}
+
+void G4HepRep::removeSceneHandler() {
+    // actual deletion is done in VisManager
+    sceneHandler = NULL;
+}
+
+void G4HepRep::removeViewer() {
+    // actual deletion is done in VisManager
+    viewer = NULL;
+}
+
Index: tags/visualization-10.5-before-10.6_test/HepRep/src/G4HepRepFile.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/src/G4HepRepFile.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/src/G4HepRepFile.cc	(revision 1102)
@@ -0,0 +1,86 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4HepRepFile.cc,v 1.11 2007/05/22 17:05:26 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Joseph Perl  1 October 2001
+// A graphics system to dump geometry hierarchy to the
+// HepRep graphics format (HepRep version 1).
+
+//HepRep
+#include "G4HepRepFileXMLWriter.hh"
+
+#include "G4HepRepFile.hh"
+#include "G4HepRepFileSceneHandler.hh"
+#include "G4HepRepFileViewer.hh"
+
+static G4HepRepFileXMLWriter* hepRepXMLWriter;
+
+G4HepRepFile::G4HepRepFile():
+  G4VGraphicsSystem("G4HepRepFile",
+		    "HepRepFile",
+		    "A HepRep (format 1) ascii file driver",
+		    G4VGraphicsSystem::threeD) {
+        hepRepXMLWriter = new G4HepRepFileXMLWriter();
+}
+
+G4HepRepFile::~G4HepRepFile()
+{
+        delete hepRepXMLWriter;
+}
+
+G4VSceneHandler* G4HepRepFile::CreateSceneHandler(const G4String& name) {
+  G4VSceneHandler* pScene = new G4HepRepFileSceneHandler(*this, name);
+  return pScene;
+}
+
+G4VViewer* G4HepRepFile::CreateViewer(G4VSceneHandler& scene,
+			       const G4String& name) {
+  G4VViewer* pView =
+    new G4HepRepFileViewer((G4HepRepFileSceneHandler&) scene, name);
+  if (pView) {
+    if (pView->GetViewId() < 0) {
+      G4cout <<
+	"G4HepRepFile::CreateViewer: ERROR flagged by negative"
+        " view id in G4HepRepFileViewer creation."
+        "\n Destroying view and returning null pointer."
+	     << G4endl;
+      delete pView;
+      pView = 0;
+    }
+  }
+  else {
+    G4cout <<
+      "G4HepRepFile::CreateViewer: ERROR: null pointer on new G4HepRepFileViewer."
+	   << G4endl;
+  }
+  return pView;
+}
+
+G4HepRepFileXMLWriter* G4HepRepFile::GetHepRepXMLWriter () {
+    return hepRepXMLWriter;
+}
Index: tags/visualization-10.5-before-10.6_test/HepRep/src/G4HepRepFileSceneHandler.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/src/G4HepRepFileSceneHandler.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/src/G4HepRepFileSceneHandler.cc	(revision 1102)
@@ -0,0 +1,1556 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4HepRepFileSceneHandler.cc,v 1.66 2008/01/04 22:11:31 allison Exp $
+// GEANT4 tag $Name:  $
+//
+//
+// Joseph Perl  27th January 2002
+// A base class for a scene handler to export geometry and trajectories
+// to the HepRep xml file format.
+
+#include "G4HepRepFileSceneHandler.hh"
+#include "G4HepRepFile.hh"
+
+#include "G4Version.hh"
+#include "G4VSolid.hh"
+#include "G4PhysicalVolumeModel.hh"
+#include "G4VPhysicalVolume.hh"
+#include "G4LogicalVolume.hh"
+#include "G4Material.hh"
+#include "G4Polymarker.hh"
+#include "G4Polyline.hh"
+#include "G4Text.hh"
+#include "G4Circle.hh"
+#include "G4Square.hh"
+#include "G4Polyhedron.hh"
+#include "G4NURBS.hh"
+#include "G4VTrajectory.hh"
+#include "G4VTrajectoryPoint.hh"
+#include "G4TrajectoriesModel.hh"
+#include "G4VHit.hh"
+#include "G4AttDef.hh"
+#include "G4AttValue.hh"
+#include "G4AttCheck.hh"
+#include "G4VisManager.hh"
+#include "G4VisTrajContext.hh"
+#include "G4VTrajectoryModel.hh"
+
+//HepRep
+#include "G4HepRepFileXMLWriter.hh"
+
+G4int G4HepRepFileSceneHandler::fSceneIdCount = 0;
+// Counter for HepRep scene handlers.
+
+G4HepRepFileSceneHandler::G4HepRepFileSceneHandler(G4VGraphicsSystem& system,
+												   const G4String& name):
+G4VSceneHandler(system, fSceneIdCount++, name)
+{
+	hepRepXMLWriter = ((G4HepRepFile*)(&system))->GetHepRepXMLWriter();
+	fileCounter = 0;
+	int length;
+	
+	if (getenv("G4HEPREPFILE_DIR") == NULL)
+		strcpy(fileDir, "");
+	else
+		length = sprintf (fileDir, "%s%s", getenv("G4HEPREPFILE_DIR"),"/");
+	
+	if (getenv("G4HEPREPFILE_NAME") == NULL)
+		strcpy(fileName, "G4Data");
+	else
+		strcpy(fileName, getenv("G4HEPREPFILE_NAME"));
+	
+	if (getenv("G4HEPREPFILE_OVERWRITE") == NULL)
+		fileOverwrite = false;
+	else
+		fileOverwrite = strcmp(getenv("G4HEPREPFILE_OVERWRITE"),"0");
+	
+	if (getenv("G4HEPREPFILE_CULL") == NULL)
+		cullInvisibleObjects = false;
+	else
+		cullInvisibleObjects = strcmp(getenv("G4HEPREPFILE_CULL"),"0");
+	
+	inPrimitives2D = false;
+	warnedAbout3DText = false;
+	warnedAbout2DMarkers = false;
+	haveVisible = false;
+	drawingTraj = false;
+	doneInitTraj = false;
+	drawingHit = false;
+	doneInitHit = false;
+}
+
+
+G4HepRepFileSceneHandler::~G4HepRepFileSceneHandler() {}
+
+
+void G4HepRepFileSceneHandler::BeginModeling() {
+    G4VisManager* visManager = G4VisManager::GetInstance();
+    const G4VTrajectoryModel* model = visManager->CurrentTrajDrawModel();
+    trajContext = & model->GetContext();
+	
+	G4VSceneHandler::BeginModeling();  // Required: see G4VSceneHandler.hh.
+}
+
+
+void G4HepRepFileSceneHandler::EndModeling() {
+	G4VSceneHandler::EndModeling();  // Required: see G4VSceneHandler.hh.
+}
+
+void G4HepRepFileSceneHandler::BeginPrimitives2D
+(const G4Transform3D& objectTransformation) {
+#ifdef G4HEPREPFILEDEBUG
+	G4cout << "G4HepRepFileSceneHandler::BeginPrimitives2D() " << G4endl;
+#endif
+	inPrimitives2D = true;
+	G4VSceneHandler::BeginPrimitives2D(objectTransformation);
+}
+
+void G4HepRepFileSceneHandler::EndPrimitives2D () {
+#ifdef G4HEPREPFILEDEBUG
+	G4cout << "G4HepRepFileSceneHandler::EndPrimitives2D() " << G4endl;
+#endif
+	G4VSceneHandler::EndPrimitives2D();
+	inPrimitives2D = false;
+}
+
+
+#ifdef G4HEPREPFILEDEBUG
+void G4HepRepFileSceneHandler::PrintThings() {
+	G4cout <<
+    "  with transformation "
+	<< (void*)fpObjectTransformation;
+	G4PhysicalVolumeModel* pPVModel =
+		dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
+	if (pPVModel) {
+		G4VPhysicalVolume* pCurrentPV = pPVModel->GetCurrentPV();
+		G4LogicalVolume* pCurrentLV = pPVModel->GetCurrentLV();
+		G4int currentDepth = pPVModel->GetCurrentDepth();
+		G4cout <<
+			"\n  current physical volume: "
+			<< pCurrentPV->GetName() <<
+			"\n  current logical volume: "
+			<< pCurrentLV->GetName() <<
+			"\n  current depth of geometry tree: "
+			<< currentDepth;
+	}
+	G4cout << G4endl;
+}
+#endif
+
+
+void G4HepRepFileSceneHandler::AddSolid(const G4Box& box) {
+#ifdef G4HEPREPFILEDEBUG
+	G4cout <<
+    "G4HepRepFileSceneHandler::AddSolid(const G4Box& box) called for "
+	<< box.GetName()
+	<< G4endl;
+	PrintThings();
+#endif
+	
+	if (drawingTraj)
+		return;
+	
+	if (drawingHit)
+		InitHit();
+	
+	haveVisible = false;
+	AddHepRepInstance("Prism", NULL);
+	
+	if (fpVisAttribs && (fpVisAttribs->IsVisible()==0) && cullInvisibleObjects)
+		return;
+	
+	hepRepXMLWriter->addPrimitive();
+	
+	G4double dx = box.GetXHalfLength();
+	G4double dy = box.GetYHalfLength();
+	G4double dz = box.GetZHalfLength();
+	
+	G4Point3D vertex1(G4Point3D( dx, dy,-dz));
+	G4Point3D vertex2(G4Point3D( dx,-dy,-dz));
+	G4Point3D vertex3(G4Point3D(-dx,-dy,-dz));
+	G4Point3D vertex4(G4Point3D(-dx, dy,-dz));
+	G4Point3D vertex5(G4Point3D( dx, dy, dz));
+	G4Point3D vertex6(G4Point3D( dx,-dy, dz));
+	G4Point3D vertex7(G4Point3D(-dx,-dy, dz));
+	G4Point3D vertex8(G4Point3D(-dx, dy, dz));
+	
+	vertex1 = (*fpObjectTransformation) * vertex1;
+	vertex2 = (*fpObjectTransformation) * vertex2;
+	vertex3 = (*fpObjectTransformation) * vertex3;
+	vertex4 = (*fpObjectTransformation) * vertex4;
+	vertex5 = (*fpObjectTransformation) * vertex5;
+	vertex6 = (*fpObjectTransformation) * vertex6;
+	vertex7 = (*fpObjectTransformation) * vertex7;
+	vertex8 = (*fpObjectTransformation) * vertex8;
+	
+	hepRepXMLWriter->addPoint(vertex1.x(), vertex1.y(), vertex1.z());
+	hepRepXMLWriter->addPoint(vertex2.x(), vertex2.y(), vertex2.z());
+	hepRepXMLWriter->addPoint(vertex3.x(), vertex3.y(), vertex3.z());
+	hepRepXMLWriter->addPoint(vertex4.x(), vertex4.y(), vertex4.z());
+	hepRepXMLWriter->addPoint(vertex5.x(), vertex5.y(), vertex5.z());
+	hepRepXMLWriter->addPoint(vertex6.x(), vertex6.y(), vertex6.z());
+	hepRepXMLWriter->addPoint(vertex7.x(), vertex7.y(), vertex7.z());
+	hepRepXMLWriter->addPoint(vertex8.x(), vertex8.y(), vertex8.z());
+}
+
+
+void G4HepRepFileSceneHandler::AddSolid(const G4Cons& cons) {
+#ifdef G4HEPREPFILEDEBUG
+	G4cout <<
+    "G4HepRepFileSceneHandler::AddSolid(const G4Cons& cons) called for "
+	<< cons.GetName()
+	<< G4endl;
+	PrintThings();
+#endif
+	
+	// HepRep does not have a primitive for a cut cone,
+	// so if this cone is cut, let the base class convert this
+	// solid to polygons.
+	if (cons.GetDeltaPhiAngle() < twopi) {
+		G4VSceneHandler::AddSolid(cons);  // Invoke default action.
+	} else {
+	
+		if (drawingTraj)
+			return;
+		
+		if (drawingHit)
+			InitHit();
+
+		haveVisible = false;
+		AddHepRepInstance("Cylinder", NULL);
+		
+		if (fpVisAttribs && (fpVisAttribs->IsVisible()==0) && cullInvisibleObjects)
+			return;
+		
+		G4Point3D vertex1(G4Point3D( 0., 0., -cons.GetZHalfLength()));
+		G4Point3D vertex2(G4Point3D( 0., 0.,  cons.GetZHalfLength()));
+		
+		vertex1 = (*fpObjectTransformation) * vertex1;
+		vertex2 = (*fpObjectTransformation) * vertex2;
+		
+		// Outer cylinder.
+		hepRepXMLWriter->addPrimitive();
+		hepRepXMLWriter->addAttValue("Radius1",cons.GetOuterRadiusMinusZ());
+		hepRepXMLWriter->addAttValue("Radius2",cons.GetOuterRadiusPlusZ());
+		hepRepXMLWriter->addPoint(vertex1.x(), vertex1.y(), vertex1.z());
+		hepRepXMLWriter->addPoint(vertex2.x(), vertex2.y(), vertex2.z());
+		
+		// Inner cylinder.
+		hepRepXMLWriter->addPrimitive();
+		hepRepXMLWriter->addAttValue("Radius1",cons.GetInnerRadiusMinusZ());
+		hepRepXMLWriter->addAttValue("Radius2",cons.GetInnerRadiusPlusZ());
+		hepRepXMLWriter->addPoint(vertex1.x(), vertex1.y(), vertex1.z());
+		hepRepXMLWriter->addPoint(vertex2.x(), vertex2.y(), vertex2.z());
+	}
+}
+
+
+void G4HepRepFileSceneHandler::AddSolid(const G4Tubs& tubs) {
+#ifdef G4HEPREPFILEDEBUG
+	G4cout <<
+    "G4HepRepFileSceneHandler::AddSolid(const G4Tubs& tubs) called for "
+	<< tubs.GetName()
+	<< G4endl;
+	PrintThings();
+#endif
+	
+	// HepRep does not have a primitive for a cut cylinder,
+	// so if this cylinder is cut, let the base class convert this
+	// solid to polygons.
+	if (tubs.GetDeltaPhiAngle() < twopi) {
+		G4VSceneHandler::AddSolid(tubs);  // Invoke default action.
+	} else {
+	
+		if (drawingTraj)
+			return;
+		
+		if (drawingHit)
+			InitHit();
+
+		haveVisible = false;
+		AddHepRepInstance("Cylinder", NULL);
+		
+		if (fpVisAttribs && (fpVisAttribs->IsVisible()==0) && cullInvisibleObjects)
+			return;
+		
+		G4Point3D vertex1(G4Point3D( 0., 0., -tubs.GetZHalfLength()));
+		G4Point3D vertex2(G4Point3D( 0., 0.,  tubs.GetZHalfLength()));
+		
+		vertex1 = (*fpObjectTransformation) * vertex1;
+		vertex2 = (*fpObjectTransformation) * vertex2;
+		
+		// Outer cylinder.
+		hepRepXMLWriter->addPrimitive();
+		hepRepXMLWriter->addAttValue("Radius1", tubs.GetOuterRadius());
+		hepRepXMLWriter->addAttValue("Radius2", tubs.GetOuterRadius());
+		hepRepXMLWriter->addPoint(vertex1.x(), vertex1.y(), vertex1.z());
+		hepRepXMLWriter->addPoint(vertex2.x(), vertex2.y(), vertex2.z());
+		
+		// Inner cylinder.
+		if (tubs.GetInnerRadius() != 0.) {
+			hepRepXMLWriter->addPrimitive();
+			hepRepXMLWriter->addAttValue("Radius1", tubs.GetInnerRadius());
+			hepRepXMLWriter->addAttValue("Radius2", tubs.GetInnerRadius());
+			hepRepXMLWriter->addPoint(vertex1.x(), vertex1.y(), vertex1.z());
+			hepRepXMLWriter->addPoint(vertex2.x(), vertex2.y(), vertex2.z());
+		}
+	}
+}
+
+
+void G4HepRepFileSceneHandler::AddSolid(const G4Trd& trd) {
+#ifdef G4HEPREPFILEDEBUG
+	G4cout <<
+    "G4HepRepFileSceneHandler::AddSolid(const G4Trd& trd) called for "
+	<< trd.GetName()
+	<< G4endl;
+	PrintThings();
+#endif
+	
+	if (drawingTraj)
+		return;
+	
+	if (drawingHit)
+		InitHit();
+	
+	haveVisible = false;
+	AddHepRepInstance("Prism", NULL);
+	
+	if (fpVisAttribs && (fpVisAttribs->IsVisible()==0) && cullInvisibleObjects)
+		return;
+	
+	hepRepXMLWriter->addPrimitive();
+	
+	G4double dx1 = trd.GetXHalfLength1();
+	G4double dy1 = trd.GetYHalfLength1();
+	G4double dx2 = trd.GetXHalfLength2();
+	G4double dy2 = trd.GetYHalfLength2();
+	G4double dz = trd.GetZHalfLength();
+	
+	G4Point3D vertex1(G4Point3D( dx1, dy1,-dz));
+	G4Point3D vertex2(G4Point3D( dx1,-dy1,-dz));
+	G4Point3D vertex3(G4Point3D(-dx1,-dy1,-dz));
+	G4Point3D vertex4(G4Point3D(-dx1, dy1,-dz));
+	G4Point3D vertex5(G4Point3D( dx2, dy2, dz));
+	G4Point3D vertex6(G4Point3D( dx2,-dy2, dz));
+	G4Point3D vertex7(G4Point3D(-dx2,-dy2, dz));
+	G4Point3D vertex8(G4Point3D(-dx2, dy2, dz));
+	
+	vertex1 = (*fpObjectTransformation) * vertex1;
+	vertex2 = (*fpObjectTransformation) * vertex2;
+	vertex3 = (*fpObjectTransformation) * vertex3;
+	vertex4 = (*fpObjectTransformation) * vertex4;
+	vertex5 = (*fpObjectTransformation) * vertex5;
+	vertex6 = (*fpObjectTransformation) * vertex6;
+	vertex7 = (*fpObjectTransformation) * vertex7;
+	vertex8 = (*fpObjectTransformation) * vertex8;
+	
+	hepRepXMLWriter->addPoint(vertex1.x(), vertex1.y(), vertex1.z());
+	hepRepXMLWriter->addPoint(vertex2.x(), vertex2.y(), vertex2.z());
+	hepRepXMLWriter->addPoint(vertex3.x(), vertex3.y(), vertex3.z());
+	hepRepXMLWriter->addPoint(vertex4.x(), vertex4.y(), vertex4.z());
+	hepRepXMLWriter->addPoint(vertex5.x(), vertex5.y(), vertex5.z());
+	hepRepXMLWriter->addPoint(vertex6.x(), vertex6.y(), vertex6.z());
+	hepRepXMLWriter->addPoint(vertex7.x(), vertex7.y(), vertex7.z());
+	hepRepXMLWriter->addPoint(vertex8.x(), vertex8.y(), vertex8.z());
+}
+
+
+void G4HepRepFileSceneHandler::AddSolid(const G4Trap& trap) {
+#ifdef G4HEPREPFILEDEBUG
+	G4cout <<
+    "G4HepRepFileSceneHandler::AddSolid(const G4Trap& trap) called for "
+	<< trap.GetName()
+	<< G4endl;
+	PrintThings();
+#endif
+	G4VSceneHandler::AddSolid(trap);  // Invoke default action.
+}
+
+
+void G4HepRepFileSceneHandler::AddSolid(const G4Sphere& sphere) {
+#ifdef G4HEPREPFILEDEBUG
+	G4cout <<
+    "G4HepRepFileSceneHandler::AddSolid(const G4Sphere& sphere) called for "
+	<< sphere.GetName()
+	<< G4endl;
+	PrintThings();
+#endif
+	G4VSceneHandler::AddSolid(sphere);  // Invoke default action.
+}
+
+
+void G4HepRepFileSceneHandler::AddSolid(const G4Para& para) {
+#ifdef G4HEPREPFILEDEBUG
+	G4cout <<
+    "G4HepRepFileSceneHandler::AddSolid(const G4Para& para) called for "
+	<< para.GetName()
+	<< G4endl;
+	PrintThings();
+#endif
+	G4VSceneHandler::AddSolid(para);  // Invoke default action.
+}
+
+
+void G4HepRepFileSceneHandler::AddSolid(const G4Torus& torus) {
+#ifdef G4HEPREPFILEDEBUG
+	G4cout <<
+    "G4HepRepFileSceneHandler::AddSolid(const G4Torus& torus) called for "
+	<< torus.GetName()
+	<< G4endl;
+	PrintThings();
+#endif
+	G4VSceneHandler::AddSolid(torus);  // Invoke default action.
+}
+
+
+void G4HepRepFileSceneHandler::AddSolid(const G4Polycone& polycone) {
+#ifdef G4HEPREPFILEDEBUG
+	G4cout <<
+    "G4HepRepFileSceneHandler::AddSolid(const G4Polycone& polycone) called for "
+	<< polycone.GetName()
+	<< G4endl;
+	PrintThings();
+#endif
+	G4VSceneHandler::AddSolid(polycone);  // Invoke default action.
+}
+
+
+void G4HepRepFileSceneHandler::AddSolid(const G4Polyhedra& polyhedra) {
+#ifdef G4HEPREPFILEDEBUG
+	G4cout <<
+    "G4HepRepFileSceneHandler::AddSolid(const G4Polyhedra& polyhedra) called for "
+	<< polyhedra.GetName()
+	<< G4endl;
+	PrintThings();
+#endif
+	G4VSceneHandler::AddSolid(polyhedra);  // Invoke default action.
+}
+
+
+void G4HepRepFileSceneHandler::AddSolid(const G4VSolid& solid) {
+#ifdef G4HEPREPFILEDEBUG
+	G4cout <<
+    "G4HepRepFileSceneHandler::AddSolid(const G4Solid& solid) called for "
+	<< solid.GetName()
+	<< G4endl;
+	PrintThings();
+#endif
+	G4VSceneHandler::AddSolid(solid);  // Invoke default action.
+}
+
+
+void G4HepRepFileSceneHandler::AddCompound (const G4VTrajectory& traj) {
+#ifdef G4HEPREPFILEDEBUG
+	G4cout << "G4HepRepFileSceneHandler::AddCompound(const G4VTrajectory&) " << G4endl;
+#endif
+	
+	G4TrajectoriesModel* pTrModel =
+		dynamic_cast<G4TrajectoriesModel*>(fpModel);
+	if (!pTrModel) G4Exception
+		("G4HepRepFileSceneHandler::AddCompound(const G4VTrajectory&): Not a G4TrajectoriesModel.");
+	G4int drawingMode = pTrModel->GetDrawingMode();
+	
+	// Pointers to hold trajectory attribute values and definitions.
+	std::vector<G4AttValue>* rawTrajAttValues = traj.CreateAttValues();
+	trajAttValues =
+		new std::vector<G4AttValue>;
+	trajAttDefs =
+		new std::map<G4String,G4AttDef>;
+	
+	// Iterators to use with attribute values and definitions.
+	std::vector<G4AttValue>::iterator iAttVal;
+	std::map<G4String,G4AttDef>::const_iterator iAttDef;
+	G4int i;
+	
+	// Get trajectory attributes and definitions in standard HepRep style
+	// (uniform units, 3Vectors decomposed).
+	if (rawTrajAttValues) {
+		G4bool error = G4AttCheck(rawTrajAttValues,
+								  traj.GetAttDefs()).Standard(trajAttValues,trajAttDefs);
+		if (error) {
+			G4cout << "G4HepRepFileSceneHandler::AddCompound(traj):"
+			"\nERROR found during conversion to standard trajectory attributes."
+			<< G4endl;
+		}
+#ifdef G4HEPREPFILEDEBUG 
+		G4cout <<
+			"G4HepRepFileSceneHandler::AddCompound(traj): standardised attributes:\n"
+			<< G4AttCheck(trajAttValues,trajAttDefs) << G4endl;
+#endif
+		delete rawTrajAttValues;
+	}
+	
+	// Open the HepRep output file if it is not already open.
+	CheckFileOpen();
+	
+	// Add the Event Data Type if it hasn't already been added.
+	if (strcmp("Event Data",hepRepXMLWriter->prevTypeName[0])!=0) {
+		hepRepXMLWriter->addType("Event Data",0);
+		hepRepXMLWriter->addInstance();
+	}
+	
+	// Add the Trajectories Type.
+	G4String previousName = hepRepXMLWriter->prevTypeName[1];
+	hepRepXMLWriter->addType("Trajectories",1);
+	
+	// If this is the first trajectory of this event,
+	// specify attribute values common to all trajectories.
+	if (strcmp("Trajectories",previousName)!=0) {
+		hepRepXMLWriter->addAttValue("Layer",100);
+		
+		// Take all Trajectory attDefs from first trajectory.
+		// Would rather be able to get these attDefs without needing a reference from any
+		// particular trajectory, but don't know how to do that.
+		// Write out trajectory attribute definitions.
+		if (trajAttValues && trajAttDefs) {
+			for (iAttVal = trajAttValues->begin();
+				 iAttVal != trajAttValues->end(); ++iAttVal) {
+				iAttDef = trajAttDefs->find(iAttVal->GetName());
+				if (iAttDef != trajAttDefs->end()) {
+					// Protect against incorrect use of Category.  Anything value other than the
+					// standard ones will be considered to be in the physics category.
+					G4String category = iAttDef->second.GetCategory();
+					if (strcmp(category,"Draw")!=0 &&
+						strcmp(category,"Physics")!=0 &&
+						strcmp(category,"Association")!=0 &&
+						strcmp(category,"PickAction")!=0)
+						category = "Physics";
+					hepRepXMLWriter->addAttDef(iAttVal->GetName(), iAttDef->second.GetDesc(),
+											   category, iAttDef->second.GetExtra());
+				}
+			} 
+		}
+		
+		// Take all TrajectoryPoint attDefs from first point of first trajectory.
+		// Would rather be able to get these attDefs without needing a reference from any
+		// particular point, but don't know how to do that.
+		if ((drawingMode!=0 || trajContext->GetDrawStepPts() || trajContext->GetDrawAuxPts())
+			&& traj.GetPointEntries()>0) {
+			G4VTrajectoryPoint* aTrajectoryPoint = traj.GetPoint(0);
+			
+			// Pointers to hold trajectory point attribute values and definitions.
+			std::vector<G4AttValue>* rawPointAttValues = aTrajectoryPoint->CreateAttValues();
+			std::vector<G4AttValue>* pointAttValues =
+			new std::vector<G4AttValue>;
+			std::map<G4String,G4AttDef>* pointAttDefs =
+			new std::map<G4String,G4AttDef>;
+			
+			// Get first trajectory point's attributes and definitions in standard HepRep style
+			// (uniform units, 3Vectors decomposed).
+			if (rawPointAttValues) {
+				G4bool error = G4AttCheck(rawPointAttValues,
+										  aTrajectoryPoint->GetAttDefs()).Standard(pointAttValues,pointAttDefs);
+				if (error) {
+					G4cout << "G4HepRepFileSceneHandler::AddCompound(traj):"
+					"\nERROR found during conversion to standard first point attributes." << G4endl;
+				}
+				
+				// Write out point attribute definitions.
+				if (pointAttValues && pointAttDefs) {
+					for (iAttVal = pointAttValues->begin();
+						 iAttVal != pointAttValues->end(); ++iAttVal) {
+						iAttDef =
+						pointAttDefs->find(iAttVal->GetName());
+						if (iAttDef != pointAttDefs->end()) {
+							// Protect against incorrect use of Category.  Anything value other than the
+							// standard ones will be considered to be in the physics category.
+							G4String category = iAttDef->second.GetCategory();
+							if (strcmp(category,"Draw")!=0 &&
+								strcmp(category,"Physics")!=0 &&
+								strcmp(category,"Association")!=0 &&
+								strcmp(category,"PickAction")!=0)
+								category = "Physics";
+							// Do not write out the Aux or Pos attribute.  Aux does not conform to the HepRep rule
+							// that each object can have only one instance of a given AttValue.
+							// Both of these attributes are redundant to actual position information of the point.
+							if (strcmp(iAttVal->GetName(),"Aux-X")!=0 &&
+								strcmp(iAttVal->GetName(),"Aux-Y")!=0 &&
+								strcmp(iAttVal->GetName(),"Aux-Z")!=0 &&
+								strcmp(iAttVal->GetName(),"Pos-X")!=0 &&
+								strcmp(iAttVal->GetName(),"Pos-Y")!=0 &&
+								strcmp(iAttVal->GetName(),"Pos-Z")!=0)
+								hepRepXMLWriter->addAttDef(iAttVal->GetName(), iAttDef->second.GetDesc(),
+														category, iAttDef->second.GetExtra());
+						}
+					}
+				}
+				delete rawPointAttValues;
+			}
+			
+			// Clean up point attributes.
+			if (pointAttValues)
+				delete pointAttValues;
+			if (pointAttDefs)
+				delete pointAttDefs;
+		}
+	} // end of special treatment for when this is the first trajectory.
+	
+	// Now that we have written out all of the attributes that are based on the
+	// trajectory's particulars, call base class to deconstruct trajectory into polyline and/or points
+	// (or nothing if trajectory is to be filtered out).
+	// If base class calls for drawing points, no points will actually be drawn there since we
+	// instead need to do point drawing from here (in order to obtain the points attributes,
+	// not available from AddPrimitive(...point).  Instead, such a call will just serve to set the
+	// flag that tells us that point drawing was requested for this trajectory (depends on several
+	// factors including i_mode, trajContext and filtering).
+	drawingTraj = true;
+	doneInitTraj = false;
+	G4VSceneHandler::AddCompound(traj);
+	drawingTraj = false;
+	
+	// Draw step points.
+	if (drawingMode!=0 || trajContext->GetDrawStepPts()) {
+		if (!doneInitTraj)
+			InitTrajectory();
+		// Create Trajectory Points as a subType of Trajectories.
+		// Note that we should create this heprep type even if there are no actual points.
+		// This allows the user to tell that points don't exist (admittedly odd) rather
+		// than that they were omitted by the drawing mode.
+		previousName = hepRepXMLWriter->prevTypeName[2];
+		hepRepXMLWriter->addType("Trajectory Step Points",2);
+
+		float redness;
+		float greenness;
+		float blueness;			
+		G4int markSize;
+		G4bool visible;
+		G4bool square;
+		if (drawingMode==0) {
+			G4Colour colour = trajContext->GetStepPtsColour();
+			redness = colour.GetRed();
+			greenness = colour.GetGreen();
+			blueness = colour.GetBlue();
+			markSize = (G4int) trajContext->GetStepPtsSize();
+			visible = (G4int) trajContext->GetStepPtsVisible();
+			square = (trajContext->GetStepPtsType()==G4Polymarker::squares);
+		} else {
+			redness = 1.;
+			greenness = 1.;
+			blueness = 1.;
+			markSize = std::abs(drawingMode/1000);
+			visible = true;
+			square = false;
+		}
+
+		// Avoiding drawing anything black on black.  
+		if (redness==0. && greenness==0. && blueness==0.) {
+			redness = 1.;
+			greenness = 1.;
+			blueness = 1.;
+		}
+		
+		// Specify attributes common to all trajectory points.
+		if (strcmp("Trajectory Step Points",previousName)!=0) {
+			hepRepXMLWriter->addAttValue("DrawAs","Point");
+			hepRepXMLWriter->addAttValue("MarkColor", redness, greenness, blueness);
+			hepRepXMLWriter->addAttValue("MarkSize",markSize);
+			hepRepXMLWriter->addAttValue("Layer",110);
+			hepRepXMLWriter->addAttValue("Visibility",visible);
+			if (square)
+				hepRepXMLWriter->addAttValue("MarkName","square");
+			else
+				hepRepXMLWriter->addAttValue("MarkName","dot");
+		}
+		
+		// Loop over all points on this trajectory.
+		for (i = 0; i < traj.GetPointEntries(); i++) {
+			G4VTrajectoryPoint* aTrajectoryPoint = traj.GetPoint(i);
+			
+			// Each point is a separate instance of the type Trajectory Points.
+			hepRepXMLWriter->addInstance();
+			
+			// Pointers to hold trajectory point attribute values and definitions.
+			std::vector<G4AttValue>* rawPointAttValues = aTrajectoryPoint->CreateAttValues();
+			std::vector<G4AttValue>* pointAttValues =
+				new std::vector<G4AttValue>;
+			std::map<G4String,G4AttDef>* pointAttDefs =
+				new std::map<G4String,G4AttDef>;
+			
+			// Get trajectory point attributes and definitions in standard HepRep style
+			// (uniform units, 3Vectors decomposed).
+			if (rawPointAttValues) {
+				G4bool error = G4AttCheck(rawPointAttValues,
+										  aTrajectoryPoint->GetAttDefs()).Standard(pointAttValues,pointAttDefs);
+				if (error) {
+					G4cout << "G4HepRepFileSceneHandler::AddCompound(traj):"
+					"\nERROR found during conversion to standard point attributes." << G4endl;
+				}
+				
+				// Write out point attribute values.
+				if (pointAttValues) {
+					std::vector<G4AttValue>::iterator iAttVal;
+					for (iAttVal = pointAttValues->begin();
+						 iAttVal != pointAttValues->end(); ++iAttVal)
+						// Do not write out the Aux or Pos attribute.  Aux does not conform to the HepRep rule
+						// that each object can have only one instance of a given AttValue.
+						// Both of these attributes are redundant to actual position information of the point.
+						if (strcmp(iAttVal->GetName(),"Aux-X")!=0 &&
+							strcmp(iAttVal->GetName(),"Aux-Y")!=0 &&
+							strcmp(iAttVal->GetName(),"Aux-Z")!=0 &&
+							strcmp(iAttVal->GetName(),"Pos-X")!=0 &&
+							strcmp(iAttVal->GetName(),"Pos-Y")!=0 &&
+							strcmp(iAttVal->GetName(),"Pos-Z")!=0)
+							hepRepXMLWriter->addAttValue(iAttVal->GetName(), iAttVal->GetValue());
+					delete pointAttValues;
+				}
+				delete rawPointAttValues;
+			}
+			
+			// Clean up point attributes.
+			if (pointAttDefs)
+				delete pointAttDefs;
+			
+			// Each trajectory point is made of a single primitive, a point.
+			hepRepXMLWriter->addPrimitive();
+			G4Point3D vertex = aTrajectoryPoint->GetPosition();
+			hepRepXMLWriter->addPoint(vertex.x(), vertex.y(), vertex.z());
+		}
+	}
+	
+	// Draw Auxiliary Points
+	if (drawingMode!=0 || trajContext->GetDrawAuxPts()) {
+		if (!doneInitTraj)
+			InitTrajectory();
+		// Create Trajectory Points as a subType of Trajectories.
+		// Note that we should create this heprep type even if there are no actual points.
+		// This allows the user to tell that points don't exist (admittedly odd) rather
+		// than that they were omitted by the drawing mode.
+		previousName = hepRepXMLWriter->prevTypeName[2];
+		hepRepXMLWriter->addType("Trajectory Auxiliary Points",2);
+
+		float redness;
+		float greenness;
+		float blueness;			
+		G4int markSize;
+		G4bool visible;
+		G4bool square;
+		if (drawingMode==0) {
+			G4Colour colour = trajContext->GetAuxPtsColour();
+			redness = colour.GetRed();
+			greenness = colour.GetGreen();
+			blueness = colour.GetBlue();
+			markSize = (G4int) trajContext->GetAuxPtsSize();
+			visible = (G4int) trajContext->GetAuxPtsVisible();
+			square = (trajContext->GetAuxPtsType()==G4Polymarker::squares);
+		} else {
+			redness = 1.;
+			greenness = 1.;
+			blueness = 1.;
+			markSize = std::abs(drawingMode/1000);
+			visible = true;
+			square = false;
+		}
+
+		// Avoiding drawing anything black on black.  
+		if (redness==0. && greenness==0. && blueness==0.) {
+			redness = 1.;
+			greenness = 1.;
+			blueness = 1.;
+		}
+		
+		// Specify attributes common to all trajectory points.
+		if (strcmp("Trajectory Auxiliary Points",previousName)!=0) {
+			hepRepXMLWriter->addAttValue("DrawAs","Point");
+			hepRepXMLWriter->addAttValue("MarkColor", redness, greenness, blueness);
+			hepRepXMLWriter->addAttValue("MarkSize",markSize);
+			hepRepXMLWriter->addAttValue("Layer",110);
+			hepRepXMLWriter->addAttValue("Visibility",visible);
+			if (square)
+				hepRepXMLWriter->addAttValue("MarkName","Square");
+			else
+				hepRepXMLWriter->addAttValue("MarkName","Dot");
+		}
+		
+		// Loop over all points on this trajectory.
+		for (i = 0; i < traj.GetPointEntries(); i++) {
+			G4VTrajectoryPoint* aTrajectoryPoint = traj.GetPoint(i);
+			
+			// Each point is a separate instance of the type Trajectory Points.
+			hepRepXMLWriter->addInstance();
+			
+			// Pointers to hold trajectory point attribute values and definitions.
+			std::vector<G4AttValue>* rawPointAttValues = aTrajectoryPoint->CreateAttValues();
+			std::vector<G4AttValue>* pointAttValues =
+				new std::vector<G4AttValue>;
+			std::map<G4String,G4AttDef>* pointAttDefs =
+				new std::map<G4String,G4AttDef>;
+			
+			// Get trajectory point attributes and definitions in standard HepRep style
+			// (uniform units, 3Vectors decomposed).
+			if (rawPointAttValues) {
+				G4bool error = G4AttCheck(rawPointAttValues,
+										  aTrajectoryPoint->GetAttDefs()).Standard(pointAttValues,pointAttDefs);
+				if (error) {
+					G4cout << "G4HepRepFileSceneHandler::AddCompound(traj):"
+					"\nERROR found during conversion to standard point attributes." << G4endl;
+				}
+				
+				// Write out point attribute values.
+				if (pointAttValues) {
+					std::vector<G4AttValue>::iterator iAttVal;
+					for (iAttVal = pointAttValues->begin();
+						 iAttVal != pointAttValues->end(); ++iAttVal)
+						// Do not write out the Aux or Pos attribute.  Aux does not conform to the HepRep rule
+						// that each object can have only one instance of a given AttValue.
+						// Both of these attributes are redundant to actual position information of the point.
+						if (strcmp(iAttVal->GetName(),"Aux-X")!=0 &&
+							strcmp(iAttVal->GetName(),"Aux-Y")!=0 &&
+							strcmp(iAttVal->GetName(),"Aux-Z")!=0 &&
+							strcmp(iAttVal->GetName(),"Pos-X")!=0 &&
+							strcmp(iAttVal->GetName(),"Pos-Y")!=0 &&
+							strcmp(iAttVal->GetName(),"Pos-Z")!=0)
+							hepRepXMLWriter->addAttValue(iAttVal->GetName(), iAttVal->GetValue());
+					delete pointAttValues;
+				}
+				delete rawPointAttValues;
+			}
+			
+			// Clean up point attributes.
+			if (pointAttDefs)
+				delete pointAttDefs;
+			
+			// Each trajectory point is made of a single primitive, a point.
+			G4Point3D vertex = aTrajectoryPoint->GetPosition();
+			
+			// Loop over auxiliary points associated with this Trajectory Point.
+			const std::vector<G4ThreeVector>* auxiliaries = aTrajectoryPoint->GetAuxiliaryPoints();
+			if (0 != auxiliaries) {
+				for (size_t iAux=0; iAux<auxiliaries->size(); ++iAux) {
+					const G4ThreeVector auxPos((*auxiliaries)[iAux]);
+					hepRepXMLWriter->addPrimitive();
+					hepRepXMLWriter->addPoint(auxPos.x(), auxPos.y(), auxPos.z());
+				}
+			}
+		}
+	}
+}
+
+
+void G4HepRepFileSceneHandler::AddCompound (const G4VHit& hit) {
+#ifdef G4HEPREPFILEDEBUG
+	G4cout << "G4HepRepFileSceneHandler::AddCompound(G4VHit&) " << G4endl;
+#endif
+	
+	// Pointers to hold hit attribute values and definitions.
+	std::vector<G4AttValue>* rawHitAttValues = hit.CreateAttValues();
+	hitAttValues =
+		new std::vector<G4AttValue>;
+	hitAttDefs =
+		new std::map<G4String,G4AttDef>;
+	
+	// Iterators to use with attribute values and definitions.
+	std::vector<G4AttValue>::iterator iAttVal;
+	std::map<G4String,G4AttDef>::const_iterator iAttDef;
+	
+	// Get hit attributes and definitions in standard HepRep style
+	// (uniform units, 3Vectors decomposed).
+	if (rawHitAttValues) {
+		G4bool error = G4AttCheck(rawHitAttValues,
+								  hit.GetAttDefs()).Standard(hitAttValues,hitAttDefs);
+		if (error) {
+			G4cout << "G4HepRepFileSceneHandler::AddCompound(hit):"
+			"\nERROR found during conversion to standard hit attributes."
+			<< G4endl;
+		}
+#ifdef G4HEPREPFILEDEBUG 
+		G4cout <<
+			"G4HepRepFileSceneHandler::AddCompound(hit): standardised attributes:\n"
+			<< G4AttCheck(hitAttValues,hitAttDefs) << G4endl;
+#endif
+		delete rawHitAttValues;
+	}
+	
+	// Open the HepRep output file if it is not already open.
+	CheckFileOpen();
+	
+	// Add the Event Data Type if it hasn't already been added.
+	if (strcmp("Event Data",hepRepXMLWriter->prevTypeName[0])!=0) {
+		hepRepXMLWriter->addType("Event Data",0);
+		hepRepXMLWriter->addInstance();
+	}
+	
+	// Find out the current HitType.
+	G4String hitType = "Hits";
+	if (hitAttValues) {
+		G4bool found = false;
+		for (iAttVal = hitAttValues->begin();
+			 iAttVal != hitAttValues->end() && !found; ++iAttVal) {
+			if (strcmp(iAttVal->GetName(),"HitType")==0) {
+				hitType = iAttVal->GetValue();
+				found = true;
+			}
+		}
+	}
+	
+	// Add the Hits Type.
+	G4String previousName = hepRepXMLWriter->prevTypeName[1];
+	hepRepXMLWriter->addType(hitType,1);
+	
+	// If this is the first hit of this event,
+	// specify attribute values common to all hits.
+	if (strcmp(hitType,previousName)!=0) {
+		hepRepXMLWriter->addAttValue("Layer",130);
+		
+		// Take all Hit attDefs from first hit.
+		// Would rather be able to get these attDefs without needing a reference from any
+		// particular hit, but don't know how to do that.
+		// Write out hit attribute definitions.
+		if (hitAttValues && hitAttDefs) {
+			for (iAttVal = hitAttValues->begin();
+				 iAttVal != hitAttValues->end(); ++iAttVal) {
+				iAttDef = hitAttDefs->find(iAttVal->GetName());
+				if (iAttDef != hitAttDefs->end()) {
+					// Protect against incorrect use of Category.  Anything value other than the
+					// standard ones will be considered to be in the physics category.
+					G4String category = iAttDef->second.GetCategory();
+					if (strcmp(category,"Draw")!=0 &&
+						strcmp(category,"Physics")!=0 &&
+						strcmp(category,"Association")!=0 &&
+						strcmp(category,"PickAction")!=0)
+						category = "Physics";
+					hepRepXMLWriter->addAttDef(iAttVal->GetName(), iAttDef->second.GetDesc(),
+											   category, iAttDef->second.GetExtra());
+				}
+			}
+		}
+	} // end of special treatment for when this is the first hit.
+	
+	// Now that we have written out all of the attributes that are based on the
+	// hit's particulars, call base class to deconstruct hit into a primitives.
+	drawingHit = true;
+	doneInitHit = false;
+	G4VSceneHandler::AddCompound(hit);  // Invoke default action.
+	drawingHit = false;
+}
+
+
+void G4HepRepFileSceneHandler::InitTrajectory() {
+	if (!doneInitTraj) {
+		// For every trajectory, add an instance of Type Trajectory.
+		hepRepXMLWriter->addInstance();
+		
+		// Write out the trajectory's attribute values.
+		if (trajAttValues) {
+			std::vector<G4AttValue>::iterator iAttVal;
+			for (iAttVal = trajAttValues->begin();
+				 iAttVal != trajAttValues->end(); ++iAttVal)
+				hepRepXMLWriter->addAttValue(iAttVal->GetName(), iAttVal->GetValue());
+			delete trajAttValues; 
+		}
+		
+		// Clean up trajectory attributes.
+		if (trajAttDefs)
+			delete trajAttDefs;
+		
+		doneInitTraj = true;
+	}
+}
+
+
+void G4HepRepFileSceneHandler::InitHit() {
+	if (!doneInitHit) {
+		// For every hit, add an instance of Type Hit.
+		hepRepXMLWriter->addInstance();
+		
+		// Write out the hit's attribute values.
+		if (hitAttValues) {
+			std::vector<G4AttValue>::iterator iAttVal;
+			for (iAttVal = hitAttValues->begin();
+				 iAttVal != hitAttValues->end(); ++iAttVal)
+				hepRepXMLWriter->addAttValue(iAttVal->GetName(), iAttVal->GetValue());
+			delete hitAttValues;
+		}
+		
+		// Clean up hit attributes.
+		if (hitAttDefs)
+			delete hitAttDefs;
+		
+		doneInitHit = true;
+	}
+}
+
+
+void G4HepRepFileSceneHandler::AddPrimitive(const G4Polyline& polyline) {
+#ifdef G4HEPREPFILEDEBUG
+	G4cout <<
+    "G4HepRepFileSceneHandler::AddPrimitive(const G4Polyline& polyline) called:"
+    "\n  polyline: " << polyline
+	<< G4endl;
+	PrintThings();
+#endif
+	
+	if (fpVisAttribs && (fpVisAttribs->IsVisible()==0) && cullInvisibleObjects)
+		return;
+	
+	if (inPrimitives2D) {
+		if (!warnedAbout2DMarkers) {
+			G4cout << "HepRepFile does not currently support 2D lines." << G4endl;
+			warnedAbout2DMarkers = true;
+		}
+		return;
+    }
+	
+	if (drawingTraj)
+		InitTrajectory();
+		
+	if (drawingHit)
+		InitHit();
+	
+	haveVisible = true;
+	AddHepRepInstance("Line", polyline);
+	
+	hepRepXMLWriter->addPrimitive();
+	
+	for (size_t i=0; i < polyline.size(); i++) {
+		G4Point3D vertex = (*fpObjectTransformation) * polyline[i];
+		hepRepXMLWriter->addPoint(vertex.x(), vertex.y(), vertex.z());
+	}
+}
+
+
+
+void G4HepRepFileSceneHandler::AddPrimitive (const G4Polymarker& line) {
+#ifdef G4HEPREPFILEDEBUG
+	G4cout <<
+    "G4HepRepFileSceneHandler::AddPrimitive(const G4Polymarker& line) called"
+	<< G4endl;
+	PrintThings();
+#endif
+	
+	if (fpVisAttribs && (fpVisAttribs->IsVisible()==0) && cullInvisibleObjects)
+		return;
+	
+	if (inPrimitives2D) {
+		if (!warnedAbout2DMarkers) {
+			G4cout << "HepRepFile does not currently support 2D lines." << G4endl;
+			warnedAbout2DMarkers = true;
+		}
+		return;
+    }
+	
+	MarkerSizeType sizeType;
+	G4double size = GetMarkerSize (line, sizeType);
+	if (sizeType==world)
+		size = 4.;
+	
+	if (drawingTraj)
+		return;
+	
+	if (drawingHit)
+		InitHit();
+	
+	haveVisible = true;
+	AddHepRepInstance("Point", line);
+	
+	hepRepXMLWriter->addAttValue("MarkName", "Dot");
+	hepRepXMLWriter->addAttValue("MarkSize", (G4int) size);
+	
+	hepRepXMLWriter->addPrimitive();
+	
+	for (size_t i=0; i < line.size(); i++) {
+		G4Point3D vertex = (*fpObjectTransformation) * line[i];
+		hepRepXMLWriter->addPoint(vertex.x(), vertex.y(), vertex.z());
+	}
+}
+
+
+void G4HepRepFileSceneHandler::AddPrimitive(const G4Text& text) {
+#ifdef G4HEPREPFILEDEBUG
+	G4cout <<
+    "G4HepRepFileSceneHandler::AddPrimitive(const G4Text& text) called:"
+    "\n  text: " << text.GetText()
+	<< G4endl;
+	PrintThings();
+#endif
+	
+	if (!inPrimitives2D) {
+		if (!warnedAbout3DText) {
+			G4cout << "HepRepFile does not currently support 3D text." << G4endl;
+			G4cout << "HepRep browsers can directly display text attributes on request." << G4endl;
+			G4cout << "See Application Developers Guide for how to attach attributes to viewable objects." << G4endl;
+			warnedAbout3DText = true;
+		}
+		return;
+    }
+	
+	MarkerSizeType sizeType;
+	G4double size = GetMarkerSize (text, sizeType);
+	if (sizeType==world)
+		size = 12.;
+	
+	haveVisible = true;
+	AddHepRepInstance("Text", text);
+	
+	hepRepXMLWriter->addAttValue("VAlign", "Top");
+	hepRepXMLWriter->addAttValue("HAlign", "Left");
+	hepRepXMLWriter->addAttValue("FontName", "Arial");
+	hepRepXMLWriter->addAttValue("FontStyle", "Plain");
+	hepRepXMLWriter->addAttValue("FontSize", (G4int) size);
+	hepRepXMLWriter->addAttValue("FontHasBanner", "TRUE");
+	hepRepXMLWriter->addAttValue("FontBannerColor", "0,0,0");
+	
+	const G4Colour& colour = GetTextColour(text);
+	float redness = colour.GetRed();
+	float greenness = colour.GetGreen();
+	float blueness = colour.GetBlue();
+    
+	// Avoiding drawing anything black on black.  
+	if (redness==0. && greenness==0. && blueness==0.) {
+		redness = 1.;
+		greenness = 1.;
+		blueness = 1.;
+	}
+	hepRepXMLWriter->addAttValue("FontColor",redness,greenness,blueness);
+	
+	hepRepXMLWriter->addPrimitive();
+	
+	hepRepXMLWriter->addAttValue("Text", text.GetText());
+	hepRepXMLWriter->addAttValue("VPos", .99-text.GetYOffset());
+	hepRepXMLWriter->addAttValue("HPos", text.GetXOffset());
+}
+
+
+void G4HepRepFileSceneHandler::AddPrimitive(const G4Circle& circle) {
+#ifdef G4HEPREPFILEDEBUG
+	G4cout <<
+    "G4HepRepFileSceneHandler::AddPrimitive(const G4Circle& circle) called:"
+    "\n  radius: " << circle.GetWorldRadius()
+	<< G4endl;
+	PrintThings();
+#endif
+	
+	if (fpVisAttribs && (fpVisAttribs->IsVisible()==0) && cullInvisibleObjects)
+		return;
+	
+	if (inPrimitives2D) {
+		if (!warnedAbout2DMarkers) {
+			G4cout << "HepRepFile does not currently support 2D circles." << G4endl;
+			warnedAbout2DMarkers = true;
+		}
+		return;
+    }
+	
+	MarkerSizeType sizeType;
+	G4double size = GetMarkerSize (circle, sizeType);
+	if (sizeType==world)
+		size = 4.;
+	
+	if (drawingTraj)
+		return;
+	
+	if (drawingHit)
+		InitHit();
+	
+	haveVisible = true;
+	AddHepRepInstance("Point", circle);
+	
+	hepRepXMLWriter->addAttValue("MarkName", "Dot");
+	hepRepXMLWriter->addAttValue("MarkSize", (G4int) size);
+	
+	hepRepXMLWriter->addPrimitive();
+	
+	G4Point3D center = (*fpObjectTransformation) * circle.GetPosition();
+	hepRepXMLWriter->addPoint(center.x(), center.y(), center.z());
+}
+
+
+void G4HepRepFileSceneHandler::AddPrimitive(const G4Square& square) {
+#ifdef G4HEPREPFILEDEBUG
+	G4cout <<
+    "G4HepRepFileSceneHandler::AddPrimitive(const G4Square& square) called:"
+    "\n  side: " << square.GetWorldRadius()
+	<< G4endl;
+	PrintThings();
+#endif
+	
+	if (fpVisAttribs && (fpVisAttribs->IsVisible()==0) && cullInvisibleObjects)
+		return;
+	
+	if (inPrimitives2D) {
+		if (!warnedAbout2DMarkers) {
+			G4cout << "HepRepFile does not currently support 2D squares." << G4endl;
+			warnedAbout2DMarkers = true;
+		}
+		return;
+    }
+	
+	MarkerSizeType sizeType;
+	G4double size = GetMarkerSize (square, sizeType);
+	if (sizeType==world)
+		size = 4.;
+	
+	if (drawingTraj)
+		return;
+	
+	if (drawingHit)
+		InitHit();
+	
+	haveVisible = true;
+	AddHepRepInstance("Point", square);
+	
+	hepRepXMLWriter->addAttValue("MarkName", "Square");
+	hepRepXMLWriter->addAttValue("MarkSize", (G4int) size);
+	
+	hepRepXMLWriter->addPrimitive();
+	
+	G4Point3D center = (*fpObjectTransformation) * square.GetPosition();
+	hepRepXMLWriter->addPoint(center.x(), center.y(), center.z());
+}
+
+
+void G4HepRepFileSceneHandler::AddPrimitive(const G4Polyhedron& polyhedron) {
+#ifdef G4HEPREPFILEDEBUG
+	G4cout <<
+    "G4HepRepFileSceneHandler::AddPrimitive(const G4Polyhedron& polyhedron) called."
+	<< G4endl;
+	PrintThings();
+#endif
+	
+	if (fpVisAttribs && (fpVisAttribs->IsVisible()==0) && cullInvisibleObjects)
+		return;
+	
+	if(polyhedron.GetNoFacets()==0)return;
+	
+	if (drawingTraj)
+		return;
+	
+	if (drawingHit)
+		InitHit();
+	
+	haveVisible = true;
+	AddHepRepInstance("Polygon", polyhedron);
+	
+	G4Normal3D surfaceNormal;
+	G4Point3D vertex;
+	
+	G4bool notLastFace;
+	do {
+		hepRepXMLWriter->addPrimitive();
+		notLastFace = polyhedron.GetNextNormal (surfaceNormal);
+		
+		G4int edgeFlag = 1;
+		G4bool notLastEdge;
+		do {
+			notLastEdge = polyhedron.GetNextVertex (vertex, edgeFlag);
+			vertex = (*fpObjectTransformation) * vertex;
+			hepRepXMLWriter->addPoint(vertex.x(), vertex.y(), vertex.z());
+		} while (notLastEdge);
+	} while (notLastFace);
+}
+
+
+void G4HepRepFileSceneHandler::AddPrimitive(const G4NURBS&) {
+#ifdef G4HEPREPFILEDEBUG
+	G4cout <<
+    "G4HepRepFileSceneHandler::AddPrimitive(const G4NURBS& nurbs) called."
+	<< G4endl;
+	PrintThings();
+#endif
+    G4cout << "G4HepRepFileSceneHandler::AddPrimitive G4NURBS : not implemented. " << G4endl;
+}
+
+
+G4HepRepFileXMLWriter *G4HepRepFileSceneHandler::GetHepRepXMLWriter() {
+    return hepRepXMLWriter;
+}
+
+
+void G4HepRepFileSceneHandler::AddHepRepInstance(const char* primName,
+												 const G4Visible visible) {
+#ifdef G4HEPREPFILEDEBUG
+	G4cout <<
+    "G4HepRepFileSceneHandler::AddHepRepInstance called."
+	<< G4endl;
+#endif
+	
+	// Open the HepRep output file if it is not already open.
+	CheckFileOpen();
+	
+	G4VPhysicalVolume* pCurrentPV = 0;
+	G4LogicalVolume* pCurrentLV = 0;
+	G4int currentDepth = 0;
+	G4PhysicalVolumeModel* pPVModel = dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
+	if (pPVModel) {
+		pCurrentPV = pPVModel->GetCurrentPV();
+		pCurrentLV = pPVModel->GetCurrentLV();
+		currentDepth = pPVModel->GetCurrentDepth();
+	}
+	
+#ifdef G4HEPREPFILEDEBUG
+	G4cout <<
+		"pCurrentPV:" << pCurrentPV << ", readyForTransients:" << fReadyForTransients
+		<< G4endl;
+#endif
+	
+	if (drawingTraj || drawingHit) {
+		// In this case, HepRep type, layer and instance were already created
+		// in the AddCompound method.
+	}
+	else if (fReadyForTransients) {
+		if (strcmp("Event Data",hepRepXMLWriter->prevTypeName[0])!=0) {
+			hepRepXMLWriter->addType("Event Data",0);
+			hepRepXMLWriter->addInstance();
+		}
+		
+		// Applications have the option of either calling AddSolid(G4VTrajectory&) and
+		// AddSolid(G4VHits&), or of just decomposing these into simpler primitives.
+		// In the former case, drawing will be handled above and will include setting of
+		// physics attributes.
+		// In the latter case, which is an older style of working, we end up drawing the
+		// trajectories and hits here, where we have no access to physics attributes. 
+		// We receive primitives here.  We can figure out that these are transients, but we
+		// have to guess exactly what these transients represent.
+		// We assume the primitives are being used as in G4VTrajectory, hence we assume:
+		// Lines are Trajectories
+		// Squares that come after we've seen trajectories are Auxiliary Points
+		// Circles that come after we've seen trajectories are Step Points
+		// Other primitives are Hits
+		
+		int layer;
+		
+		if (strcmp("Text",primName)==0) {
+			hepRepXMLWriter->addType("EventID",1);
+		} else {
+			if (strcmp("Line",primName)==0) {
+				hepRepXMLWriter->addType("TransientPolylines",1);
+				layer = 100;
+			} else {
+				if (strcmp(hepRepXMLWriter->prevTypeName[1],"TransientPolylines")==0 &&
+					strcmp("Square",primName)==0)
+				{
+					hepRepXMLWriter->addType("AuxiliaryPoints",2);
+					layer = 110;
+				} else {
+					if (strcmp(hepRepXMLWriter->prevTypeName[1],"TransientPolylines")==0 &&
+						strcmp("Circle",primName)==0)
+					{
+						hepRepXMLWriter->addType("StepPoints",2);
+						layer = 120;
+					} else {
+						hepRepXMLWriter->addType("Hits",1);
+						layer = 130;
+					}
+				}
+			}
+			hepRepXMLWriter->addAttValue("Layer",layer);
+		}
+		
+		hepRepXMLWriter->addInstance();
+		
+		// Handle Type declaration for Axes, Ruler, etc.
+	} else if (pCurrentPV==0) {
+		if (strcmp("AxesEtc",hepRepXMLWriter->prevTypeName[0])!=0) {
+			hepRepXMLWriter->addType("AxesEtc",0);
+			hepRepXMLWriter->addInstance();
+		}
+		
+		int layer;
+		
+		if (strcmp("Text",primName)==0) {
+			hepRepXMLWriter->addType("Text",1);
+		} else {
+			if (strcmp("Line",primName)==0) {
+				hepRepXMLWriter->addType("Polylines",1);
+				layer = 100;
+			} else {
+				hepRepXMLWriter->addType("Points",1);
+				layer = 130;
+			}
+			hepRepXMLWriter->addAttValue("Layer",layer);
+		}
+		
+		hepRepXMLWriter->addInstance();
+		
+		// Handle Type declaration for Detector Geometry,
+		// replacing G4's top geometry level name "worldPhysical" with the
+		// name "Detector Geometry".
+	} else {
+		//G4cout << "CurrentDepth" << currentDepth << G4endl;
+		//G4cout << "currentName" << pCurrentPV->GetName() << G4endl;
+		if (strcmp("Detector Geometry",hepRepXMLWriter->prevTypeName[0])!=0) {
+			//G4cout << "Adding Det Geom type" << G4endl;
+			hepRepXMLWriter->addType("Detector Geometry",0);
+			hepRepXMLWriter->addInstance();
+		}
+		
+		// Re-insert any layers of the hierarchy that were removed by G4's culling process.
+		// Don't bother checking if same type name as last instance.
+		if(strcmp(hepRepXMLWriter->prevTypeName[currentDepth+1],pCurrentPV->GetName())!=0) {
+			//G4cout << "Looking for mother of:" << pCurrentLV->GetName() << G4endl;
+			typedef G4PhysicalVolumeModel::G4PhysicalVolumeNodeID PVNodeID;
+			typedef std::vector<PVNodeID> PVPath;
+			const PVPath& drawnPVPath = pPVModel->GetDrawnPVPath();
+			PVPath::const_reverse_iterator ri = ++drawnPVPath.rbegin();
+			G4int drawnMotherDepth;
+			if (ri != drawnPVPath.rend()) {
+				// This volume has a mother.
+				drawnMotherDepth = ri->GetNonCulledDepth();
+				//G4cout << "drawnMotherDepth" << drawnMotherDepth << G4endl;
+			} else {
+				// This volume has no mother.  Must be a top level volume.
+				drawnMotherDepth = -1;
+				//G4cout << "Mother must be very top" << G4endl;
+			}
+			
+			while (drawnMotherDepth < (currentDepth-1)) {
+				G4String culledParentName = "Culled parent of " + pCurrentPV->GetName();
+				//G4cout << "Inserting culled layer " << culledParentName << " at depth:" << drawnMotherDepth+2 << G4endl;
+				hepRepXMLWriter->addType(culledParentName, drawnMotherDepth+2);
+				hepRepXMLWriter->addInstance();
+				drawnMotherDepth ++;
+			}
+		}
+		
+		// Add the HepRepType for the current volume.
+		hepRepXMLWriter->addType(pCurrentPV->GetName(),currentDepth+1);
+		hepRepXMLWriter->addInstance();
+		
+		if (fpVisAttribs && (fpVisAttribs->IsVisible()==0) && cullInvisibleObjects)
+			return;
+		
+		// Additional attributes.
+		hepRepXMLWriter->addAttValue("Layer",hepRepXMLWriter->typeDepth);
+		hepRepXMLWriter->addAttValue("LVol", pCurrentLV->GetName());
+		G4Region* region = pCurrentLV->GetRegion();
+		G4String regionName = region? region->GetName(): G4String("No region");
+		hepRepXMLWriter->addAttValue("Region", regionName);
+		hepRepXMLWriter->addAttValue("RootRegion", pCurrentLV->IsRootRegion());
+		hepRepXMLWriter->addAttValue("Solid", pCurrentLV->GetSolid()->GetName());
+		hepRepXMLWriter->addAttValue("EType", pCurrentLV->GetSolid()->GetEntityType());
+		G4Material * material = pPVModel->GetCurrentMaterial();
+		G4String matName = material? material->GetName(): G4String("No material");
+		hepRepXMLWriter->addAttValue("Material", matName);
+		G4double matDensity = material? material->GetDensity(): 0.;
+		hepRepXMLWriter->addAttValue("Density", matDensity*m3/kg);
+		G4State matState = material? material->GetState(): kStateUndefined;
+		hepRepXMLWriter->addAttValue("State", matState);
+		G4double matRadlen = material? material->GetRadlen(): 0.;
+		hepRepXMLWriter->addAttValue("Radlen", matRadlen/m);
+	}
+	
+	hepRepXMLWriter->addAttValue("DrawAs",primName);
+	
+	// Handle color and visibility attributes.
+	float redness;
+	float greenness;
+	float blueness;
+	G4bool isVisible; 
+	
+	if (fpVisAttribs || haveVisible) {
+		G4Colour colour;
+		
+		if (fpVisAttribs) {
+			colour = fpVisAttribs->GetColour();
+			isVisible = fpVisAttribs->IsVisible();
+		} else {
+			colour = GetColour(visible);
+			isVisible = fpViewer->
+				GetApplicableVisAttributes(visible.GetVisAttributes())->IsVisible();
+		}
+		
+		redness = colour.GetRed();
+		greenness = colour.GetGreen();
+		blueness = colour.GetBlue();
+		
+		// Avoiding drawing anything black on black.  
+		if (redness==0. && greenness==0. && blueness==0.) {
+			redness = 1.;
+			greenness = 1.;
+			blueness = 1.;
+		}
+	} else {
+#ifdef G4HEPREPFILEDEBUG
+		G4cout <<
+		"G4HepRepFileSceneHandler::AddHepRepInstance using default colour."
+		<< G4endl;
+#endif
+		redness = 1.;
+		greenness = 1.;
+		blueness = 1.;
+		isVisible = true;
+	}
+	
+	if (strcmp(primName,"Point")==0)
+		hepRepXMLWriter->addAttValue("MarkColor",redness,greenness,blueness);
+	else
+		hepRepXMLWriter->addAttValue("LineColor",redness,greenness,blueness);
+	
+	hepRepXMLWriter->addAttValue("Visibility",isVisible);
+}
+
+
+void G4HepRepFileSceneHandler::CheckFileOpen() {
+#ifdef G4HEPREPFILEDEBUG
+	G4cout <<
+    "G4HepRepFileSceneHandler::CheckFileOpen called."
+	<< G4endl;
+#endif
+	
+	if (!hepRepXMLWriter->isOpen) {
+		char* newFileSpec;
+		newFileSpec = new char [256];
+		int length;
+		
+		if (fileOverwrite)
+			length = sprintf (newFileSpec, "%s%s%s",fileDir,fileName,".heprep");
+		else
+			length = sprintf (newFileSpec, "%s%s%d%s",fileDir,fileName,fileCounter,".heprep");
+		G4cout << "HepRepFile writing to " << newFileSpec << G4endl;
+		
+		hepRepXMLWriter->open(newFileSpec);
+		fileCounter++;
+		
+		hepRepXMLWriter->addAttDef("Generator", "HepRep Data Generator", "Physics","");
+		G4String versionString = G4Version;
+		versionString = versionString.substr(1,versionString.size()-2);
+		versionString = " Geant4 version " + versionString + "   " + G4Date;
+		hepRepXMLWriter->addAttValue("Generator", versionString);
+		
+		hepRepXMLWriter->addAttDef("LVol", "Logical Volume", "Physics","");
+		hepRepXMLWriter->addAttDef("Region", "Cuts Region", "Physics","");
+		hepRepXMLWriter->addAttDef("RootRegion", "Root Region", "Physics","");
+		hepRepXMLWriter->addAttDef("Solid", "Solid Name", "Physics","");
+		hepRepXMLWriter->addAttDef("EType", "Entity Type", "Physics","");
+		hepRepXMLWriter->addAttDef("Material", "Material Name", "Physics","");
+		hepRepXMLWriter->addAttDef("Density", "Material Density", "Physics","kg/m3");
+		hepRepXMLWriter->addAttDef("State", "Material State", "Physics","");
+		hepRepXMLWriter->addAttDef("Radlen", "Material Radiation Length", "Physics","m");
+	}
+}
+
+
+void G4HepRepFileSceneHandler::ClearTransientStore() {
+	G4VSceneHandler::ClearTransientStore();
+	// This is typically called after an update and before drawing hits
+	// of the next event.  To simulate the clearing of "transients"
+	// (hits, etc.) the detector is redrawn...
+	if (fpViewer) {
+		fpViewer -> SetView();
+		fpViewer -> ClearView();
+		fpViewer -> DrawView();
+	}
+}
Index: tags/visualization-10.5-before-10.6_test/HepRep/src/G4HepRepFileViewer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/src/G4HepRepFileViewer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/src/G4HepRepFileViewer.cc	(revision 1102)
@@ -0,0 +1,79 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4HepRepFileViewer.cc,v 1.15 2006/06/29 21:17:26 gunter Exp $
+// GEANT4 tag $Name:  $
+
+#include "G4HepRepFileViewer.hh"
+
+#include "G4VSceneHandler.hh"
+
+#include "G4HepRepFileSceneHandler.hh"
+
+//HepRep
+#include "G4HepRepFileXMLWriter.hh"
+
+G4HepRepFileViewer::G4HepRepFileViewer
+(G4VSceneHandler& sceneHandler, const G4String& name):
+  G4VViewer(sceneHandler, sceneHandler.IncrementViewCount(), name) {
+  hepRepXMLWriter = ((G4HepRepFileSceneHandler*)(&sceneHandler))->GetHepRepXMLWriter();
+  // Make changes to view parameters for HepRep...
+  fVP.SetCulling(false);
+  fDefaultVP.SetCulling(false);
+}
+
+G4HepRepFileViewer::~G4HepRepFileViewer() {
+  ShowView ();
+}
+
+void G4HepRepFileViewer::SetView() {
+#ifdef G4HEPREPFILEDEBUG
+  G4cout << "G4HepRepFileViewer::SetView() called.=" << G4endl;
+#endif
+}
+
+void G4HepRepFileViewer::ClearView() {
+#ifdef G4HEPREPFILEDEBUG
+  G4cout << "G4HepRepFileViewer::ClearView() called." << G4endl;
+#endif
+}
+
+void G4HepRepFileViewer::DrawView() {
+#ifdef G4HEPREPFILEDEBUG
+  G4cout << "G4HepRepFileViewer::DrawView() called." << G4endl;
+#endif
+  NeedKernelVisit ();  // Always need to visit G4 kernel.
+  ProcessView ();
+}
+
+void G4HepRepFileViewer::ShowView () {
+#ifdef G4HEPREPFILEDEBUG
+  G4cout << "G4HepRepFileViewer::ShowView" << G4endl;
+#endif
+  G4VViewer::ShowView();
+  
+  if (hepRepXMLWriter->isOpen)
+    hepRepXMLWriter->close();
+}
Index: tags/visualization-10.5-before-10.6_test/HepRep/src/G4HepRepFileXMLWriter.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/src/G4HepRepFileXMLWriter.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/src/G4HepRepFileXMLWriter.cc	(revision 1102)
@@ -0,0 +1,393 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//--------------------------------------------------------------------------
+// File and Version Information:
+// 	$Id: G4HepRepFileXMLWriter.cc,v 1.3 2006/06/29 21:17:28 gunter Exp $
+//
+// Description:
+//	Create a HepRep XML File (HepRep version 1).
+//
+// Environment:
+//	Software developed for the general High Energy Physics community.
+//
+// Author :
+//       J. Perl                    Original Author
+//
+// Copyright Information:
+//      Copyright (C) 2001          Stanford Linear Accelerator Center
+//------------------------------------------------------------------------
+
+#include "G4HepRepFileXMLWriter.hh"
+
+#include "G4ios.hh"
+
+G4HepRepFileXMLWriter::G4HepRepFileXMLWriter()
+{
+  isOpen = false;
+  init();
+}
+
+void G4HepRepFileXMLWriter::init()
+{
+  typeDepth = -1;
+
+  int i = -1;
+  while (i++<49) {
+    prevTypeName[i] = new char[1];
+    strcpy(prevTypeName[i],"");
+
+    inType[i] = false;
+    inInstance[i] = false;
+  }
+
+  inPrimitive = false;
+  inPoint = false;
+}
+
+void G4HepRepFileXMLWriter::addType(const char* name,int newTypeDepth)
+{
+  if (fout.good())
+  {
+    // Flatten structure if it exceeds maximum allowed typeDepth of 49.
+    if (newTypeDepth > 49)
+      newTypeDepth = 49;
+
+    if (newTypeDepth < 0)
+      newTypeDepth = 0;
+
+    // Insert any layers that are missing from the hierarchy (protects against
+    // callers that skip from, say, layer 1 to layer 3 with no layer 2).
+    while (typeDepth < (newTypeDepth-1)) {
+      addType("Layer Inserted by G4HepRepFileXMLWriter", typeDepth + 1);
+      addInstance();
+    }
+
+    // If moving closer to the root, close previously open types.
+    while (newTypeDepth<typeDepth)
+      endType();
+
+    // Close any remaining primitives of the current instance.
+    endPrimitive();
+
+    // If this is a new type name for the current depth, declare the
+    // new Type.  Otherwise, it is just another Instance of the current Type.
+    if (strcmp(name,prevTypeName[newTypeDepth])!=0)
+    {
+      if (inType[newTypeDepth])
+	endType();
+
+      prevTypeName[newTypeDepth] = new char[strlen(name)+1];
+      strcpy(prevTypeName[newTypeDepth],name);
+
+      inType[newTypeDepth] = true;
+      indent();
+      fout << "<heprep:type version=\"null\" name=\"" << name << "\">"
+	 << G4endl;
+
+      typeDepth = newTypeDepth;
+    }
+  } else {
+#ifdef G4HEPREPFILEDEBUG
+    G4cout << "G4HepRepFileXMLWriter:addType No file is currently open." << G4endl;
+#endif
+  }
+}
+
+void G4HepRepFileXMLWriter::addInstance()
+{
+  if (fout.good())
+  {
+    if (inType[typeDepth])
+    {
+      endInstance();
+      inInstance[typeDepth] = true;
+      indent();
+      fout << "<heprep:instance>" << G4endl;
+    } else {
+#ifdef G4HEPREPFILEDEBUG
+      G4cout << "G4HepRepFileXMLWriter:addInstance No HepRep Type is currently open" << G4endl;
+#endif
+    }
+  } else {
+#ifdef G4HEPREPFILEDEBUG
+    G4cout << "G4HepRepFileXMLWriter:addInstance No file is currently open" << G4endl;
+#endif
+  }
+}
+
+void G4HepRepFileXMLWriter::addPrimitive()
+{
+  if (fout.good())
+  {
+    if (inInstance[typeDepth])
+    {
+      endPrimitive();
+      inPrimitive = true;
+      indent();
+      fout << "<heprep:primitive>" << G4endl;
+    } else {
+#ifdef G4HEPREPFILEDEBUG
+      G4cout << "G4HepRepFileXMLWriter:addPrimitive No HepRep Instance is currently open" << G4endl; 
+#endif
+    }
+  } else {
+#ifdef G4HEPREPFILEDEBUG
+    G4cout << "G4HepRepFileXMLWriter:addPrimitive No file is currently open" << G4endl;
+#endif
+  }
+}
+
+void G4HepRepFileXMLWriter::addPoint(double x, double y, double z)
+{
+  if (fout.good())
+  {
+    if (inPrimitive)
+    {
+      endPoint();
+      inPoint = true;
+      indent();
+      fout << "<heprep:point x=\"" << x << "\" y=\"" << y << "\" z=\"" << z << "\">" << G4endl;
+    } else {
+#ifdef G4HEPREPFILEDEBUG
+      G4cout <<	"G4HepRepFileXMLWriter:addPoint No HepRep Primitive is currently open" << G4endl;
+#endif
+    }
+  } else {
+#ifdef G4HEPREPFILEDEBUG
+    G4cout << "G4HepRepFileXMLWriter:addPoint No file is currently open" << G4endl;
+#endif
+  }
+}
+
+void G4HepRepFileXMLWriter::addAttDef(const char* name,
+	       const char* desc,
+	       const char* type,
+	       const char* extra)
+{
+  if (fout.good())
+  {
+    indent();
+    fout << "  <heprep:attdef extra=\"" << extra << "\" name=\"" << name << "\" type=\"" << type << "\"" << G4endl;
+    indent();
+    fout << "  desc=\"" << desc << "\"/>" << G4endl;
+  } else {
+#ifdef G4HEPREPFILEDEBUG
+    G4cout << "G4HepRepFileXMLWriter:addAttDef No file is currently open" << G4endl;
+#endif
+  }
+}
+
+// Four methods to fill attValues
+void G4HepRepFileXMLWriter::addAttValue (const char* name,
+		  const char* value)
+{
+  if (fout.good())
+  {
+    indent();
+    fout << "  <heprep:attvalue showLabel=\"NONE\" name=\"" << name << "\"" << G4endl;
+    indent();
+    fout << "    value=\"" << value << "\"/>" << G4endl;
+  } else {
+#ifdef G4HEPREPFILEDEBUG
+    G4cout << "G4HepRepFileXMLWriter:addAttValue No file is currently open" << G4endl;
+#endif
+  }
+}
+
+void G4HepRepFileXMLWriter::addAttValue (const char* name,
+		  double value)
+{
+  if (fout.good())
+  {
+    indent();
+    fout << "  <heprep:attvalue showLabel=\"NONE\" name=\"" << name << "\"" << G4endl;
+    indent();
+    fout << "    value=\"" << value << "\"/>" << G4endl;
+  } else {
+#ifdef G4HEPREPFILEDEBUG
+    G4cout << "G4HepRepFileXMLWriter:addAttValue No file is currently open" << G4endl;
+#endif
+  }
+}
+
+void G4HepRepFileXMLWriter::addAttValue (const char* name,
+		  int value)
+{
+  if (fout.good())
+  {
+    indent();
+    fout << "  <heprep:attvalue showLabel=\"NONE\" name=\"" << name << "\"" << G4endl;
+    indent();
+    fout << "    value=\"" << value << "\"/>" << G4endl;
+  } else {
+#ifdef G4HEPREPFILEDEBUG
+    G4cout << "G4HepRepFileXMLWriter:addAttValue No file is currently open" << G4endl;
+#endif
+  }
+}
+
+void G4HepRepFileXMLWriter::addAttValue (const char* name,
+		  bool value)
+{
+  if (fout.good())
+  {
+    indent();
+    fout << "  <heprep:attvalue showLabel=\"NONE\" name=\"" << name << "\"" << G4endl;
+    indent();
+    if (value)
+      fout << "    value=\"True\"/>" << G4endl;
+    else
+      fout << "    value=\"False\"/>" << G4endl;
+  } else {
+#ifdef G4HEPREPFILEDEBUG
+    G4cout << "G4HepRepFileXMLWriter:addAttValue No file is currently open" << G4endl;
+#endif
+  }
+}
+
+void G4HepRepFileXMLWriter::addAttValue (const char* name,
+				   double value1,
+				   double value2,
+				   double value3)
+{
+  if (fout.good())
+  {
+    int redness = int(value1*255.);
+    int greenness = int(value2*255.);
+    int blueness = int(value3*255.);
+    indent();
+    fout << "  <heprep:attvalue showLabel=\"NONE\" name=\"" << name << "\"" << G4endl;
+    indent();
+    fout << "    value=\"" << redness << "," << greenness << "," << blueness << "\"/>" << G4endl;
+  } else {
+#ifdef G4HEPREPFILEDEBUG
+    G4cout << "G4HepRepFileXMLWriter:addAttValue No file is currently open" << G4endl;
+#endif
+  }
+}
+
+void G4HepRepFileXMLWriter::open(const char* fileSpec)
+{
+  if (isOpen)
+    close();
+  
+  fout.open(fileSpec);
+    
+  if (fout.good()) {
+    fout << "<?xml version=\"1.0\" ?>" << G4endl;
+    fout << "<heprep:heprep xmlns:heprep=\"http://www.slac.stanford.edu/~perl/heprep/\"" << G4endl;
+    fout << "  xmlns:xsi=\"http://www.w3.org/1999/XMLSchema-instance\" xsi:schemaLocation=\"HepRep.xsd\">" << G4endl;
+    
+    isOpen = true;
+    init();
+  } else {
+    G4cout << "G4HepRepFileXMLWriter:open Unable to write to file " << fileSpec << G4endl;
+  }
+}
+
+void G4HepRepFileXMLWriter::close()
+{
+  // Close any remaining open Types
+  endTypes();
+
+  if (fout.good()) {      
+    fout << "</heprep:heprep>" << G4endl;
+    fout.close( );
+    isOpen = false;
+  } else {
+    G4cout << "G4HepRepFileXMLWriter:close No file is currently open" << G4endl;
+  }
+}
+
+void G4HepRepFileXMLWriter::endTypes()
+{
+  // Close any remaining open Types
+    while(typeDepth>-1)
+      endType();
+}
+
+void G4HepRepFileXMLWriter::endType()
+{
+  endInstance();
+  indent();
+  fout << "</heprep:type>" << G4endl;
+  inType[typeDepth] = false;
+  delete [] prevTypeName[typeDepth];
+  prevTypeName[typeDepth] = new char[1];
+  strcpy(prevTypeName[typeDepth],"");
+  typeDepth--;
+}
+
+void G4HepRepFileXMLWriter::endInstance()
+{
+  if (inInstance[typeDepth])
+  {
+    endPrimitive();
+    indent();
+    fout << "</heprep:instance>" << G4endl;
+    inInstance[typeDepth] = false;
+  }
+}
+
+void G4HepRepFileXMLWriter::endPrimitive()
+{
+  if (inPrimitive)
+  {
+    endPoint();
+    indent();
+    fout << "</heprep:primitive>" << G4endl;
+    inPrimitive = false;
+  }
+}
+
+void G4HepRepFileXMLWriter::endPoint()
+{
+  if (inPoint)
+  {
+    indent();
+    fout << "</heprep:point>" << G4endl;
+    inPoint = false;
+  }
+}
+
+void G4HepRepFileXMLWriter::indent()
+{
+  if (fout.good())
+  {
+    int i = 0;
+    while (inType[i] && i<12) {
+      fout << "  ";
+      if (inInstance[i])
+        fout << "  ";
+      i++;
+    }
+
+    if (inPrimitive)
+      fout << "  ";
+    if (inPoint)
+      fout << "  ";
+  }
+}
Index: tags/visualization-10.5-before-10.6_test/HepRep/src/G4HepRepMessenger.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/src/G4HepRepMessenger.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/src/G4HepRepMessenger.cc	(revision 1102)
@@ -0,0 +1,132 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4HepRepMessenger.cc,v 1.10 2006/06/29 21:17:30 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+#include "G4HepRepMessenger.hh"
+
+G4HepRepMessenger::G4HepRepMessenger() :
+    suffix (""),
+    geometry(true),
+    solids(true),
+    invisibles(true) {
+
+    heprepDirectory = new G4UIdirectory("/vis/heprep/");
+    heprepDirectory->SetGuidance("HepRep commands.");
+
+    setEventNumberSuffixCommand = new G4UIcmdWithAString("/vis/heprep/setEventNumberSuffix", this);
+    setEventNumberSuffixCommand->SetGuidance("Write separate event files, appended with given suffix.");
+    setEventNumberSuffixCommand->SetGuidance("Define the suffix with a pattern such as '-0000'.");
+    setEventNumberSuffixCommand->SetParameterName("suffix",false);
+    setEventNumberSuffixCommand->SetDefaultValue("");
+    setEventNumberSuffixCommand->AvailableForStates(G4State_Idle);
+    
+    appendGeometryCommand = new G4UIcmdWithABool("/vis/heprep/appendGeometry", this);
+    appendGeometryCommand->SetGuidance("Appends copy of geometry to every event.");
+    appendGeometryCommand->SetParameterName("flag",false);
+    appendGeometryCommand->SetDefaultValue(true);
+    appendGeometryCommand->AvailableForStates(G4State_Idle);
+
+    addPointAttributesCommand = new G4UIcmdWithABool("/vis/heprep/addPointAttributes", this);
+    addPointAttributesCommand->SetGuidance("Adds point attributes to the points of trajectories.");
+    addPointAttributesCommand->SetParameterName("flag",false);
+    addPointAttributesCommand->SetDefaultValue(false);
+    addPointAttributesCommand->AvailableForStates(G4State_Idle);
+
+    useSolidsCommand = new G4UIcmdWithABool("/vis/heprep/useSolids", this);
+    useSolidsCommand->SetGuidance("Use HepRep Solids, rather than Geant4 Primitives.");
+    useSolidsCommand->SetParameterName("flag",false);
+    useSolidsCommand->SetDefaultValue(true);
+    useSolidsCommand->AvailableForStates(G4State_Idle);
+
+/* Not Enabled Yet
+    writeInvisiblesCommand = new G4UIcmdWithABool("/vis/heprep/writeInvisibles", this);
+    writeInvisiblesCommand->SetGuidance("Write invisible objects.");
+    writeInvisiblesCommand->SetParameterName("flag",false);
+    writeInvisiblesCommand->SetDefaultValue(true);
+    writeInvisiblesCommand->AvailableForStates(G4State_Idle);
+*/
+}
+
+G4HepRepMessenger::~G4HepRepMessenger() {
+    delete setEventNumberSuffixCommand;
+    delete appendGeometryCommand;
+    delete addPointAttributesCommand;
+    delete useSolidsCommand;
+//    delete writeInvisiblesCommand;
+    delete heprepDirectory;
+}
+
+G4String G4HepRepMessenger::GetCurrentValue(G4UIcommand * command) {
+    if (command==setEventNumberSuffixCommand) {
+        return suffix;
+    } else if (command==appendGeometryCommand) {
+        return appendGeometryCommand->ConvertToString(geometry); 
+    } else if (command==addPointAttributesCommand) {
+        return addPointAttributesCommand->ConvertToString(pointAttributes); 
+    } else if (command==useSolidsCommand) {
+        return useSolidsCommand->ConvertToString(solids);
+//    } else if (command==writeInvisiblesCommand) {
+//        return writeInvisiblesCommand->ConvertToString(invisibles);
+    } else {
+        return "";
+    }
+}
+
+void G4HepRepMessenger::SetNewValue(G4UIcommand * command, G4String newValue) {
+    if (command==setEventNumberSuffixCommand) {
+        suffix = newValue;
+    } else if (command==appendGeometryCommand) {
+        geometry = appendGeometryCommand->GetNewBoolValue(newValue);
+    } else if (command==addPointAttributesCommand) {
+        pointAttributes = addPointAttributesCommand->GetNewBoolValue(newValue);
+    } else if (command==useSolidsCommand) {
+        solids = useSolidsCommand->GetNewBoolValue(newValue);
+//    } else if (command==writeInvisiblesCommand) {
+//        invisibles = writeInvisiblesCommand->GetNewBoolValue(newValue);
+    } 
+}
+
+G4String G4HepRepMessenger::getEventNumberSuffix() {
+    return suffix;
+}
+
+G4bool G4HepRepMessenger::appendGeometry() {
+    return geometry;
+}
+
+G4bool G4HepRepMessenger::addPointAttributes() {
+    return pointAttributes;
+}
+
+G4bool G4HepRepMessenger::useSolids() {
+    return solids;
+}
+
+G4bool G4HepRepMessenger::writeInvisibles() {
+    return invisibles;
+}
+
Index: tags/visualization-10.5-before-10.6_test/HepRep/src/G4HepRepSceneHandler.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/src/G4HepRepSceneHandler.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/src/G4HepRepSceneHandler.cc	(revision 1102)
@@ -0,0 +1,1680 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4HepRepSceneHandler.cc,v 1.101 2007/11/16 20:29:04 perl Exp $
+// GEANT4 tag $Name:  $
+//
+
+/**
+ * @author Mark Donszelmann
+ */
+
+#include <stdio.h>
+
+#include "globals.hh"
+#include <vector>
+#include <iostream>
+// NOTE not available on Solaris 5.2 and Linux g++ 2.95.2
+// #include <sstream>
+#include <iomanip>
+#include <fstream>
+#include <cmath>
+
+//HepRep
+#include "HEPREP/HepRep.h"
+
+//G4
+#include "G4Vector3D.hh"
+#include "G4Version.hh"
+#include "G4Types.hh"
+#include "G4Point3D.hh"
+#include "G4Normal3D.hh"
+#include "G4Polyline.hh"
+#include "G4Polymarker.hh"
+#include "G4Polyhedron.hh"
+#include "G4Circle.hh"
+#include "G4Square.hh"
+#include "G4Text.hh"
+#include "G4NURBS.hh"
+#include "G4VPhysicalVolume.hh"
+#include "G4VisAttributes.hh"
+#include "G4VSolid.hh"
+#include "G4VTrajectory.hh"
+#include "G4VTrajectoryPoint.hh"
+#include "G4VHit.hh"
+#include "G4Scene.hh"
+#include "G4Material.hh"
+#include "G4AttDef.hh"
+#include "G4AttValue.hh"
+#include "G4AttCheck.hh"
+
+// CHepRep
+#include "cheprep/XMLHepRepFactory.h"
+
+// This
+#include "G4HepRep.hh"
+#include "G4HepRepSceneHandler.hh"
+#include "G4HepRepViewer.hh"
+
+
+using namespace HEPREP;
+using namespace cheprep;
+using namespace std;
+
+G4int G4HepRepSceneHandler::sceneIdCount = 0;
+
+//#define LDEBUG 1
+//#define SDEBUG 1
+//#define PDEBUG 1
+
+G4HepRepSceneHandler::G4HepRepSceneHandler (G4VGraphicsSystem& system, G4HepRepMessenger& heprepMessenger, const G4String& name)
+        : G4VSceneHandler (system, sceneIdCount++, name),
+          messenger             (heprepMessenger),
+          geometryLayer         ("Geometry"),
+          eventLayer            ("Event"),
+          calHitLayer           ("CalHit"),
+          trajectoryLayer       ("Trajectory"),
+          hitLayer              ("Hit"),
+          rootVolumeName        ("Geometry"),
+          baseName              (""),
+          eventNumberPrefix     (""),
+          eventNumberSuffix     (""),
+          eventNumber           (1),
+          eventNumberWidth      (-1),
+          extension             (""),
+          writeBinary           (false),
+          writeZip              (false),
+          writeGZ               (false),
+          writeMultipleFiles    (false),
+          currentHit            (NULL),
+          currentTrack          (NULL),
+          _heprep               (NULL),
+          _heprepGeometry       (NULL)
+{
+
+#ifdef LDEBUG
+    cout << "G4HepRepSceneHandler::G4HepRepSceneHandler: " << system << endl;
+#endif
+
+    materialState[kStateSolid]      = G4String("Solid");
+    materialState[kStateLiquid]     = G4String("Liquid");
+    materialState[kStateGas]        = G4String("Gas");
+    materialState[kStateUndefined]  = G4String("Undefined");    
+
+    factory = new XMLHepRepFactory();
+    writer = NULL;
+    
+    // opening of file deferred to closeHepRep();
+    openHepRep();
+}
+
+
+G4HepRepSceneHandler::~G4HepRepSceneHandler () {
+#ifdef LDEBUG
+    cout << "G4HepRepSceneHandler::~G4HepRepSceneHandler() " << endl;
+#endif
+    close();
+
+    delete factory;
+    factory = NULL;
+
+    dynamic_cast<G4HepRep*>(GetGraphicsSystem())->removeSceneHandler();
+}
+
+
+void G4HepRepSceneHandler::open(G4String name) {
+    if (writer != NULL) return;
+
+    if (name == "stdout") {
+#ifdef LDEBUG
+        cout << "G4HepRepSceneHandler::Open() stdout" << endl;
+#endif
+        writer = factory->createHepRepWriter(&cout, false, false);
+        out  = NULL;
+        baseName = name;
+        eventNumberPrefix = "";
+        eventNumberSuffix = "";
+        extension = "";
+        writeBinary = false;
+        writeZip = false;
+        writeGZ = false;
+        writeMultipleFiles = false;
+        eventNumber = 0;
+        eventNumberWidth = 0;        
+    } else if (name == "stderr") {
+#ifdef LDEBUG
+        cout << "G4HepRepSceneHandler::Open() stderr" << endl;
+#endif
+        writer = factory->createHepRepWriter(&cerr, false, false);
+        out = NULL;
+        baseName = name;
+        eventNumberPrefix = "";
+        eventNumberSuffix = "";
+        extension = "";
+        writeBinary = false;
+        writeZip = false;
+        writeGZ = false;
+        writeMultipleFiles = false;
+        eventNumber = 0;
+        eventNumberWidth = 0;        
+    } else {
+#ifdef LDEBUG
+        cout << "G4HepRepSceneHandler::Open() " << name << endl;
+#endif
+        if (eventNumberWidth < 0) {
+            // derive filename(s)
+            // check for extensions
+            const unsigned int numberOfExtensions = 8;
+            string ext[numberOfExtensions] = {".heprep", ".heprep.xml", ".heprep.zip", ".heprep.gz",
+                                              ".bheprep", ".bheprep.xml", ".bheprep.zip", ".bheprep.gz"};
+            unsigned int i=0;
+            while (i < numberOfExtensions) {
+                int dot = name.size() - ext[i].size();
+                if ((dot >= 0) && 
+                    (name.substr(dot, ext[i].size()) == ext[i])) break;
+                i++;
+            }
+        
+            if (i != numberOfExtensions) {
+                extension = ext[i];
+                writeBinary = i >= (numberOfExtensions/2);
+                writeZip = (i == 2) || (i == 6);
+                writeGZ = (i == 3) || (i == 7);
+
+                int dot = name.length() - extension.length();
+                baseName = (dot >= 0) ? name.substr(0, dot) : "";
+
+#ifndef G4LIB_USE_ZLIB               
+                if (writeGZ) {
+                    cerr << endl;
+                    cerr << "WARNING: the .gz output file you are creating will be a plain file," << endl;
+                    cerr << "       since compression support (ZLIB) was not compiled into the Geant4." << endl;
+                    cerr << "       To avoid confusion with real gz files, the output filename has been" << endl;
+                    cerr << "       extended with the name '.no-gz'." << endl;
+                    cerr << "       A plain heprep or bheprep file can be fairly large." << endl; 
+                }
+                if (writeZip) {
+                    cerr << endl;
+                    cerr << "WARNING: the .zip output file you are creating will not be compressed," << endl;
+                    cerr << "       since compression support (ZLIB) was not compiled into the Geant4." << endl;
+                    cerr << "       A zip file containing non-compressed heprep or bheprep files can" << endl;
+                    cerr << "       be fairly large." << endl;
+                }
+                if (writeGZ || writeZip) {
+                    cerr << "SOLUTION: To add compression support using ZLIB, you need to:" << endl;
+                    cerr << "       1. Define G4LIB_USE_ZLIB and recompile the visualization category." << endl;
+                    cerr << "       2. Optionally define G4_LIB_BUILD_ZLIB if your system does not have" << endl;
+                    cerr << "          zlib installed (e.g. WIN32-VC)." << endl;
+                    cerr << "       3. Relink your application code." << endl;  
+                    cerr << endl;
+                }
+                if (writeGZ) {
+                    extension = extension + ".no-gz";
+                    writeGZ = false;
+                }
+#endif // G4LIB_USE_ZLIB
+            } else {
+                // Default for no extension  
+                extension = ".heprep.zip";
+                writeBinary = false;
+                writeZip = true;
+                writeGZ = false;
+                baseName = name;
+            }
+        
+            writeMultipleFiles = false;
+            int startDigit = -1; int endDigit = -1;
+            string suffix = messenger.getEventNumberSuffix();
+            if (suffix != "") {
+                // look for 0000 pattern in suffix
+                endDigit = suffix.length()-1; 
+                while (endDigit >= 0) {
+                    if (isdigit(suffix.at(endDigit))) break;
+                    endDigit--;
+                }
+                if (endDigit < 0) {
+                    cerr << "/vis/heprep/appendEventNumberSuffix contains no digits" << endl;
+                } else {
+                    writeMultipleFiles = true;
+                    startDigit = endDigit;
+                    while (startDigit >= 0) {
+                        if (!isdigit(suffix.at(startDigit))) break;
+                        startDigit--;
+                    }
+                    startDigit++;
+                }                
+            }
+
+            if (writeMultipleFiles) {
+                eventNumberPrefix = suffix.substr(0, startDigit);
+                eventNumber = atoi(suffix.substr(startDigit, endDigit).c_str());
+                eventNumberWidth = endDigit +1 - startDigit;
+                eventNumberSuffix = suffix.substr(endDigit+1);
+            } else {
+                // open single file here
+                openFile(baseName+extension);
+        
+                eventNumber = 1;
+                eventNumberWidth = 10;
+                eventNumberPrefix = "";
+                eventNumberSuffix = "";
+            }   
+        }    
+    }
+}
+
+
+void G4HepRepSceneHandler::openHepRep() {
+#ifdef LDEBUG
+    cout << "G4HepRepSceneHandler::OpenHepRep() " << endl;
+#endif
+
+    if (_heprep != NULL) return;
+
+    // all done on demand, once pointers are set to NULL
+    _heprepGeometry       = NULL;
+    _geometryInstanceTree = NULL;
+    _geometryRootInstance = NULL;
+    _geometryInstance.clear();
+    _geometryTypeTree     = NULL;
+    _geometryRootType     = NULL;
+    _geometryTypeName.clear();
+    _geometryType.clear();
+    _eventInstanceTree    = NULL;
+    _eventInstance        = NULL;
+    _eventTypeTree        = NULL;
+    _eventType            = NULL;
+    _trajectoryType       = NULL;
+    _hitType              = NULL;
+    _calHitType           = NULL;
+    _calHitFaceType       = NULL;     
+}
+
+
+/**
+ * Returns true if the HepRep was (already) closed, false if the HepRep is still open
+ */
+bool G4HepRepSceneHandler::closeHepRep(bool final) {
+    if (_heprep == NULL) return true;
+
+#ifdef LDEBUG
+    cout << "G4HepRepSceneHandler::CloseHepRep() start" << endl;
+#endif
+
+    // if this is the final close, then there should not be any event pending to be written.
+    if (final) {
+        if (_eventInstanceTree != NULL) {
+            cerr << "WARNING: you probably used '/vis/viewer/endOfEventAction accumulate' and "
+                 << "forgot to call /vis/viewer/update before exit. No event written." << endl;
+        }
+    } else {
+
+        // add geometry to the heprep if there is an event (separate geometries are written
+        // using DrawView() called from /vis/viewer/flush)
+        if (_eventInstanceTree != NULL) {
+            GetCurrentViewer()->DrawView();
+        
+            // couple geometry
+            if (messenger.appendGeometry()) {
+                // couple geometry to event if geometry was written
+                if ((_geometryInstanceTree != NULL)) {
+                    getEventInstanceTree()->addInstanceTree(getGeometryInstanceTree());
+                }
+            } else {
+                char name[128];
+                if (writeMultipleFiles) {
+                    sprintf(name, "%s%s%s#%s", baseName.c_str(), "-geometry", extension.c_str(), "G4GeometryData");
+                } else {
+                    sprintf(name, "%s%s#%s", "geometry", (writeBinary ? ".bheprep" : ".heprep"), "G4GeometryData");
+                }   
+                getEventInstanceTree()->addInstanceTree(factory->createHepRepTreeID(name, "1.0"));
+            }
+        }
+    
+        // force inclusion of all subtypes of event
+        if (_eventInstanceTree != NULL) {
+            getEventType();
+            getTrajectoryType();
+            getHitType();
+            getCalHitType();
+            getCalHitFaceType();
+        }
+    
+        // Give this HepRep all of the layer order info for both geometry and event,
+        // since these will both end up in a single HepRep.
+        writeLayers(_heprepGeometry);
+        writeLayers(_heprep);
+
+        // open heprep file
+        if (writer == NULL) {
+            open((GetScene() == NULL) ? G4String("G4HepRepOutput.heprep.zip") : GetScene()->GetName());
+        }
+
+        // write out separate geometry
+        if (!messenger.appendGeometry() && (_heprepGeometry != NULL)) {
+            if (writeMultipleFiles) {
+                char fileName[128];
+                sprintf(fileName, "%s%s%s", baseName.c_str(), "-geometry", extension.c_str());
+                openFile(G4String(fileName));
+            }
+
+            char name[128];
+            sprintf(name, "%s%s", "geometry", (writeBinary ? ".bheprep" : ".heprep"));
+            if (!writeMultipleFiles) {
+                writer->addProperty("RecordLoop.ignore", name);
+            }
+
+            writer->write(_heprepGeometry, G4String(name));
+            
+            delete _heprepGeometry;
+            _heprepGeometry = NULL;
+            
+            if (writeMultipleFiles) closeFile();
+        }
+    
+        if (writeMultipleFiles) {
+// NOTE: does not work on Solaris 5.2 and Linux 2.95.2
+//            stringstream fileName;
+//            fileName << baseName << eventNumberPrefix << setw(eventNumberWidth) << setfill('0') << eventNumber << eventNumberSuffix << extension;
+//            openFile(fileName.str());
+// Use instead:
+            char fileName[128];
+            char fileFormat[128];
+            sprintf(fileFormat, "%s%d%s", "%s%s%0", eventNumberWidth, "d%s%s");
+            sprintf(fileName, fileFormat, baseName.c_str(), eventNumberPrefix.c_str(), eventNumber, eventNumberSuffix.c_str(), extension.c_str());
+            openFile(G4String(fileName));
+        }
+            
+        // write out the heprep
+// NOTE: does not work on Solaris 5.2 and Linux 2.95.2
+//        stringstream eventName;
+//        eventName << "event-" << setw(eventNumberWidth) << setfill('0') << eventNumber << (writeBinary ? ".bheprep" : ".heprep");
+//        writer->write(_heprep, eventName.str());
+// Use instead:
+        char eventName[128];
+        char eventFormat[128];
+        sprintf(eventFormat, "%s%d%s%s", "event-%0", eventNumberWidth, "d", (writeBinary ? ".bheprep" : ".heprep"));
+        sprintf(eventName, eventFormat, eventNumber);
+        writer->write(_heprep, G4String(eventName));
+
+        eventNumber++;
+    }
+    
+    delete _heprep;
+    _heprep = NULL;
+
+    if (writeMultipleFiles) closeFile();
+
+    return true;
+}
+
+
+void G4HepRepSceneHandler::close() {
+
+#ifdef LDEBUG
+    cout << "G4HepRepSceneHandler::Close() " << endl;
+#endif
+
+    if (writer == NULL) return;
+    
+    if (!writeMultipleFiles) {
+        closeHepRep(true);
+        closeFile();
+    }
+    
+    G4HepRepViewer* viewer = dynamic_cast<G4HepRepViewer*>(GetCurrentViewer());
+    viewer->reset();
+}
+
+void G4HepRepSceneHandler::openFile(G4String name) {
+    out = new ofstream(name.c_str(), std::ios::out | std::ios::binary );
+    writer = factory->createHepRepWriter(out, writeZip, writeZip || writeGZ);
+}
+
+void G4HepRepSceneHandler::closeFile() {
+    writer->close();
+    delete writer;
+    writer = NULL;
+
+    delete out;
+    out = NULL;
+}
+
+void G4HepRepSceneHandler::writeLayers(HepRep* heprep) {
+    if (heprep == NULL) return;
+    heprep->addLayer(geometryLayer); 
+    heprep->addLayer(eventLayer);
+    heprep->addLayer(calHitLayer);
+    heprep->addLayer(trajectoryLayer);
+    heprep->addLayer(hitLayer);
+}  
+
+void G4HepRepSceneHandler::BeginModeling() {
+#ifdef SDEBUG
+    cout << "G4HepRepSceneHandler::BeginModeling() " << endl;
+#endif
+    G4VSceneHandler::BeginModeling();
+}
+
+
+void G4HepRepSceneHandler::EndModeling() {
+#ifdef SDEBUG
+    cout << "G4HepRepSceneHandler::EndModeling() " << endl;
+#endif
+    G4VSceneHandler::EndModeling();
+}
+
+void G4HepRepSceneHandler::AddSolid(const G4Box& box) {
+#ifdef SDEBUG
+    cout << "G4HepRepSceneHandler::AddSolid(const G4Box& box)" << endl;
+#endif
+
+    if (dontWrite()) return;
+
+    if (!messenger.useSolids()) {
+        G4VSceneHandler::AddSolid(box);
+        return;
+    }
+    
+    G4double dx = box.GetXHalfLength();
+    G4double dy = box.GetYHalfLength();
+    G4double dz = box.GetZHalfLength();
+    
+    G4Point3D vertex1(G4Point3D( dx, dy,-dz));
+    G4Point3D vertex2(G4Point3D( dx,-dy,-dz));
+    G4Point3D vertex3(G4Point3D(-dx,-dy,-dz));
+    G4Point3D vertex4(G4Point3D(-dx, dy,-dz));
+    G4Point3D vertex5(G4Point3D( dx, dy, dz));
+    G4Point3D vertex6(G4Point3D( dx,-dy, dz));
+    G4Point3D vertex7(G4Point3D(-dx,-dy, dz));
+    G4Point3D vertex8(G4Point3D(-dx, dy, dz));
+    
+    vertex1 = (transform) * vertex1;
+    vertex2 = (transform) * vertex2;
+    vertex3 = (transform) * vertex3;
+    vertex4 = (transform) * vertex4;
+    vertex5 = (transform) * vertex5;
+    vertex6 = (transform) * vertex6;
+    vertex7 = (transform) * vertex7;
+    vertex8 = (transform) * vertex8;
+
+    HepRepInstance* instance = getGeometryOrEventInstance(getCalHitType());
+    addAttributes(instance, getCalHitType());
+
+    setAttribute(instance, "DrawAs", G4String("Prism"));
+        
+    setVisibility(instance, box);
+    setLine(instance, box);
+    setColor(instance, getColorFor(box));
+
+    factory->createHepRepPoint(instance, vertex1.x(), vertex1.y(), vertex1.z());
+    factory->createHepRepPoint(instance, vertex2.x(), vertex2.y(), vertex2.z());
+    factory->createHepRepPoint(instance, vertex3.x(), vertex3.y(), vertex3.z());
+    factory->createHepRepPoint(instance, vertex4.x(), vertex4.y(), vertex4.z());
+    factory->createHepRepPoint(instance, vertex5.x(), vertex5.y(), vertex5.z());
+    factory->createHepRepPoint(instance, vertex6.x(), vertex6.y(), vertex6.z());
+    factory->createHepRepPoint(instance, vertex7.x(), vertex7.y(), vertex7.z());
+    factory->createHepRepPoint(instance, vertex8.x(), vertex8.y(), vertex8.z());
+}
+
+
+void G4HepRepSceneHandler::AddSolid(const G4Cons& cons) {
+#ifdef SDEBUG
+    cout << "G4HepRepSceneHandler::AddSolid(const G4Cons& cons)" << endl;
+#endif
+
+    if (dontWrite()) return;
+
+    if (!messenger.useSolids() || (cons.GetDeltaPhiAngle() < twopi)) {
+        G4VSceneHandler::AddSolid(cons);
+        return;
+    }
+
+    G4PhysicalVolumeModel* pPVModel =
+      dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
+    if (!pPVModel) {
+      G4VSceneHandler::AddSolid(cons);
+        return;
+    }
+
+    G4LogicalVolume* pCurrentLV = pPVModel->GetCurrentLV();
+    G4int currentDepth = pPVModel->GetCurrentDepth();
+    G4Material* pCurrentMaterial = pPVModel->GetCurrentMaterial();
+
+    G4Point3D vertex1(G4Point3D( 0., 0., cons.GetZHalfLength()));
+    G4Point3D vertex2(G4Point3D( 0., 0.,-cons.GetZHalfLength()));
+
+    vertex1 = (transform) * vertex1;
+    vertex2 = (transform) * vertex2;
+
+    HepRepInstance* instance = getGeometryInstance(pCurrentLV, pCurrentMaterial, currentDepth);
+    setAttribute(instance, "DrawAs", G4String("Cylinder"));
+        
+    setVisibility(instance, cons);
+    setLine(instance, cons);
+    setColor(instance, getColorFor(cons));
+
+    HepRepType* type = getGeometryType(pCurrentLV->GetName(), currentDepth);
+
+    // Outer cylinder.
+    HepRepInstance* outer = factory->createHepRepInstance(instance, type);
+    outer->addAttValue("pickParent",true);
+    outer->addAttValue("showParentAttributes",true);
+    
+    HepRepPoint* op1 = factory->createHepRepPoint(outer, vertex1.x(), vertex1.y(), vertex1.z());
+    op1->addAttValue("Radius",cons.GetOuterRadiusPlusZ());
+    
+    HepRepPoint* op2 = factory->createHepRepPoint(outer, vertex2.x(), vertex2.y(), vertex2.z());
+    op2->addAttValue("Radius",cons.GetOuterRadiusMinusZ());
+
+    // Inner cylinder.
+    HepRepInstance* inner = factory->createHepRepInstance(instance, type);
+    inner->addAttValue("pickParent",true);
+    inner->addAttValue("showParentAttributes",true);
+    
+    HepRepPoint* ip1 = factory->createHepRepPoint(inner, vertex1.x(), vertex1.y(), vertex1.z());
+    ip1->addAttValue("Radius",cons.GetInnerRadiusPlusZ());
+    
+    HepRepPoint* ip2 = factory->createHepRepPoint(inner, vertex2.x(), vertex2.y(), vertex2.z());
+    ip2->addAttValue("Radius",cons.GetInnerRadiusMinusZ());
+}
+
+
+void G4HepRepSceneHandler::AddSolid(const G4Tubs& tubs) {
+#ifdef SDEBUG
+    cout << "G4HepRepSceneHandler::AddSolid(const G4Tubs& tubs)" << endl;
+#endif
+
+    if (dontWrite()) return;
+
+    if (!messenger.useSolids() || (tubs.GetDeltaPhiAngle() < twopi)) {
+        G4VSceneHandler::AddSolid(tubs);
+        return;
+    }
+    
+    G4PhysicalVolumeModel* pPVModel =
+      dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
+    if (!pPVModel) {
+      G4VSceneHandler::AddSolid(tubs);
+        return;
+    }
+
+    G4LogicalVolume* pCurrentLV = pPVModel->GetCurrentLV();
+    G4int currentDepth = pPVModel->GetCurrentDepth();
+    G4Material* pCurrentMaterial = pPVModel->GetCurrentMaterial();
+
+    G4Point3D vertex1(G4Point3D( 0., 0., tubs.GetZHalfLength()));
+    G4Point3D vertex2(G4Point3D( 0., 0.,-tubs.GetZHalfLength()));
+
+    vertex1 = (transform) * vertex1;
+    vertex2 = (transform) * vertex2;
+
+    HepRepInstance* instance = getGeometryInstance(pCurrentLV, pCurrentMaterial, currentDepth);
+    setAttribute(instance, "DrawAs", G4String("Cylinder"));
+        
+    setVisibility(instance, tubs);
+    setLine(instance, tubs);
+    setColor(instance, getColorFor(tubs));
+
+    HepRepType* type = getGeometryType(pCurrentLV->GetName(), currentDepth);
+
+    // Outer cylinder.
+    HepRepInstance* outer = factory->createHepRepInstance(instance, type);
+    outer->addAttValue("Radius",tubs.GetOuterRadius());
+    outer->addAttValue("pickParent",true);
+    outer->addAttValue("showParentAttributes",true);
+    factory->createHepRepPoint(outer, vertex1.x(), vertex1.y(), vertex1.z());
+    factory->createHepRepPoint(outer, vertex2.x(), vertex2.y(), vertex2.z());
+
+    // Inner cylinder.
+    if (tubs.GetInnerRadius() > 0.) {
+        HepRepInstance* inner = factory->createHepRepInstance(instance, type);
+        inner->addAttValue("Radius",tubs.GetInnerRadius());
+        inner->addAttValue("pickParent",true);
+        inner->addAttValue("showParentAttributes",true);
+        factory->createHepRepPoint(inner, vertex1.x(), vertex1.y(), vertex1.z());
+        factory->createHepRepPoint(inner, vertex2.x(), vertex2.y(), vertex2.z());
+    }
+}
+
+
+void G4HepRepSceneHandler::AddSolid(const G4Trd& trd) {
+#ifdef SDEBUG
+    cout << "G4HepRepSceneHandler::AddSolid(const G4Trd& trd)" << endl;
+#endif
+    if (dontWrite()) return;
+
+    if (!messenger.useSolids()) {
+        G4VSceneHandler::AddSolid(trd);
+        return;
+    }
+    
+    G4double dx1 = trd.GetXHalfLength1();
+    G4double dy1 = trd.GetYHalfLength1();
+    G4double dx2 = trd.GetXHalfLength2();
+    G4double dy2 = trd.GetYHalfLength2();
+    G4double dz = trd.GetZHalfLength();
+    
+    G4Point3D vertex1(G4Point3D( dx1, dy1,-dz));
+    G4Point3D vertex2(G4Point3D( dx1,-dy1,-dz));
+    G4Point3D vertex3(G4Point3D(-dx1,-dy1,-dz));
+    G4Point3D vertex4(G4Point3D(-dx1, dy1,-dz));
+    G4Point3D vertex5(G4Point3D( dx2, dy2, dz));
+    G4Point3D vertex6(G4Point3D( dx2,-dy2, dz));
+    G4Point3D vertex7(G4Point3D(-dx2,-dy2, dz));
+    G4Point3D vertex8(G4Point3D(-dx2, dy2, dz));
+    
+    vertex1 = (transform) * vertex1;
+    vertex2 = (transform) * vertex2;
+    vertex3 = (transform) * vertex3;
+    vertex4 = (transform) * vertex4;
+    vertex5 = (transform) * vertex5;
+    vertex6 = (transform) * vertex6;
+    vertex7 = (transform) * vertex7;
+    vertex8 = (transform) * vertex8;
+
+    HepRepInstance* instance = getGeometryOrEventInstance(getCalHitType());
+
+    addAttributes(instance, getCalHitType());
+
+    setAttribute(instance, "DrawAs", G4String("Prism"));
+        
+    setVisibility(instance, trd);
+    setLine(instance, trd);
+    setColor(instance, getColorFor(trd));
+
+    factory->createHepRepPoint(instance, vertex1.x(), vertex1.y(), vertex1.z());
+    factory->createHepRepPoint(instance, vertex2.x(), vertex2.y(), vertex2.z());
+    factory->createHepRepPoint(instance, vertex3.x(), vertex3.y(), vertex3.z());
+    factory->createHepRepPoint(instance, vertex4.x(), vertex4.y(), vertex4.z());
+    factory->createHepRepPoint(instance, vertex5.x(), vertex5.y(), vertex5.z());
+    factory->createHepRepPoint(instance, vertex6.x(), vertex6.y(), vertex6.z());
+    factory->createHepRepPoint(instance, vertex7.x(), vertex7.y(), vertex7.z());
+    factory->createHepRepPoint(instance, vertex8.x(), vertex8.y(), vertex8.z());
+}
+
+void G4HepRepSceneHandler::AddSolid (const G4Trap& trap) { 
+    if (dontWrite()) return;
+    G4VSceneHandler::AddSolid (trap); 
+}
+
+void G4HepRepSceneHandler::AddSolid (const G4Sphere& sphere) { 
+    if (dontWrite()) return;
+    G4VSceneHandler::AddSolid (sphere); 
+}
+
+void G4HepRepSceneHandler::AddSolid (const G4Para& para) { 
+    if (dontWrite()) return;
+    G4VSceneHandler::AddSolid (para); 
+}
+
+void G4HepRepSceneHandler::AddSolid (const G4Torus& torus) { 
+    if (dontWrite()) return;
+    G4VSceneHandler::AddSolid (torus); 
+}
+
+void G4HepRepSceneHandler::AddSolid (const G4Polycone& polycone) { 
+    if (dontWrite()) return;
+    G4VSceneHandler::AddSolid (polycone); 
+}
+
+void G4HepRepSceneHandler::AddSolid (const G4Polyhedra& polyhedra) { 
+    if (dontWrite()) return;
+    G4VSceneHandler::AddSolid (polyhedra); 
+}
+
+void G4HepRepSceneHandler::AddSolid (const G4VSolid& solid) { 
+    if (dontWrite()) return;
+    G4VSceneHandler::AddSolid(solid); 
+}
+
+
+void G4HepRepSceneHandler::AddPrimitive (const G4Polyline& line) {
+
+#ifdef PDEBUG
+    cout << "G4HepRepSceneHandler::AddPrimitive(G4Polyline&) " << line.size() << endl;
+#endif
+    if (dontWrite()) return;
+
+    HepRepInstance* instance = factory->createHepRepInstance(getEventInstance(), getTrajectoryType());
+
+    addAttributes(instance, getTrajectoryType());
+
+    setColor(instance, GetColor(line));
+
+    setVisibility(instance, line);
+
+    setLine(instance, line);
+
+    for (size_t i=0; i < line.size(); i++) {
+        G4Point3D vertex = transform * line[i];
+        factory->createHepRepPoint(instance, vertex.x(), vertex.y(), vertex.z());
+    }
+}
+
+
+void G4HepRepSceneHandler::AddPrimitive (const G4Polymarker& line) {
+
+#ifdef PDEBUG
+    cout << "G4HepRepSceneHandler::AddPrimitive(G4Polymarker&) " << line.size() << endl;
+#endif
+    if (dontWrite()) return;
+
+    HepRepInstance* instance = factory->createHepRepInstance(getEventInstance(), getHitType());
+
+    addAttributes(instance, getHitType());
+
+    setColor(instance, GetColor(line));
+
+    setVisibility(instance, line);
+
+    setMarker(instance, line);
+
+    // Default MarkName is set to Circle for this Type.
+    int mtype = line.GetMarkerType();
+    
+    // Cannot be case statement since line.xxx is not a constant
+    if (mtype == line.dots) {
+        setAttribute(instance, "Fill", true);
+        setColor(instance, GetColor(line), G4String("FillColor"));
+    } else if (mtype == line.circles) {
+    } else if (line.squares) {
+        setAttribute(instance, "MarkName", G4String("Box"));
+    } else {
+        // line.line + default
+        setAttribute(instance, "MarkName", G4String("Plus"));
+    }
+
+    for (size_t i=0; i < line.size(); i++) {
+        G4Point3D vertex = transform * line[i];
+        factory->createHepRepPoint(instance, vertex.x(), vertex.y(), vertex.z());
+    }
+}
+
+
+void G4HepRepSceneHandler::AddPrimitive (const G4Circle& circle) {
+#ifdef PDEBUG
+    cout << "G4HepRepSceneHandler::AddPrimitive(G4Circle&) " << endl;
+#endif
+    if (dontWrite()) return;
+
+    HepRepInstance* instance = factory->createHepRepInstance(getEventInstance(), getHitType());
+
+    addAttributes(instance, getHitType());
+
+    G4Point3D center = transform * circle.GetPosition();
+
+    setColor (instance, GetColor(circle));
+
+    setVisibility(instance, circle);
+
+    setMarker(instance, circle);
+
+    factory->createHepRepPoint(instance, center.x(), center.y(), center.z());
+}
+
+
+void G4HepRepSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron) {
+
+#ifdef PDEBUG
+    cout << "G4HepRepSceneHandler::AddPrimitive(G4Polyhedron&) " << endl;
+#endif
+    if (dontWrite()) return;
+
+    G4Normal3D surfaceNormal;
+    G4Point3D vertex;
+
+    if (polyhedron.GetNoFacets()==0) return;
+
+    HepRepInstance* instance = getGeometryOrEventInstance(getCalHitType());
+        
+    addAttributes(instance, getCalHitType());
+
+    setVisibility(instance, polyhedron);
+	
+    G4int currentDepth = 0;
+    G4PhysicalVolumeModel* pPVModel =
+      dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
+    if (pPVModel) currentDepth = pPVModel->GetCurrentDepth();
+
+    G4bool notLastFace;
+    do {
+        HepRepInstance* face;
+        if (isEventData()) {
+            face = factory->createHepRepInstance(instance, getCalHitFaceType());
+        } else {
+            face = getGeometryInstance("*Face", currentDepth+1);
+            setAttribute(face, "PickParent", true);
+            setAttribute(face, "DrawAs", G4String("Polygon"));
+        }
+        
+        setLine(face, polyhedron);
+        setColor(face, GetColor(polyhedron));
+        if (isEventData()) setColor(face, GetColor(polyhedron), G4String("FillColor"));
+
+        notLastFace = polyhedron.GetNextNormal (surfaceNormal);
+
+        G4int edgeFlag = 1;
+        G4bool notLastEdge;
+        do {
+	        notLastEdge = polyhedron.GetNextVertex (vertex, edgeFlag);
+            vertex = transform * vertex;
+            factory->createHepRepPoint(face, vertex.x(), vertex.y(), vertex.z());
+        } while (notLastEdge);
+    } while (notLastFace);
+}
+
+
+void G4HepRepSceneHandler::AddPrimitive (const G4Text&) {
+#ifdef PDEBUG
+    cout << "G4HepRepSceneHandler::AddPrimitive(G4Text&) " << endl;
+#endif
+    if (dontWrite()) return;
+
+    cout << "G4HepRepSceneHandler::AddPrimitive G4Text : not yet implemented. " << endl;
+}
+
+
+void G4HepRepSceneHandler::AddPrimitive (const G4Square& square) {
+#ifdef PDEBUG
+    cout << "G4HepRepSceneHandler::AddPrimitive(G4Square&) " << endl;
+#endif
+    if (dontWrite()) return;
+
+    HepRepInstance* instance = factory->createHepRepInstance(getEventInstance(), getHitType());
+
+    addAttributes(instance, getHitType());
+
+    G4Point3D center = transform * square.GetPosition();
+
+    setColor (instance, getColorFor(square));
+
+    setVisibility(instance, square);
+
+    setMarker(instance, square);
+
+    factory->createHepRepPoint(instance, center.x(), center.y(), center.z());
+}
+
+void G4HepRepSceneHandler::AddPrimitive (const G4NURBS&) {
+#ifdef PDEBUG
+    cout << "G4HepRepSceneHandler::AddPrimitive(G4NURBS&) " << endl;
+#endif
+    if (dontWrite()) return;
+
+    cout << "G4HepRepSceneHandler::AddPrimitive G4NURBS : not yet implemented. " << endl;
+}
+
+void G4HepRepSceneHandler::AddPrimitive (const G4Scale& scale) { 
+    if (dontWrite()) return;
+    G4VSceneHandler::AddPrimitive(scale); 
+}
+
+void G4HepRepSceneHandler::AddCompound (const G4VTrajectory& trajectory) {
+#ifdef PDEBUG
+    cout << "G4HepRepSceneHandler::AddCompound(G4VTrajectory&) " << endl;
+#endif
+    if (dontWrite()) return;
+    
+    currentTrack = &trajectory;
+    G4VSceneHandler::AddCompound(trajectory); 
+    currentTrack = NULL;    
+}
+
+
+void G4HepRepSceneHandler::AddCompound (const G4VHit& hit) { 
+#ifdef PDEBUG
+    cout << "G4HepRepSceneHandler::AddCompound(G4VHit&) " << endl;
+#endif
+    if (dontWrite()) return;
+    
+    currentHit = &hit;
+    G4VSceneHandler::AddCompound(hit); 
+    currentHit = NULL;
+}
+
+void G4HepRepSceneHandler::PreAddSolid (const G4Transform3D& objectTransformation,
+				  const G4VisAttributes& visAttribs) {
+
+    G4VSceneHandler::PreAddSolid (objectTransformation, visAttribs);
+
+    transform = objectTransformation;
+#ifdef SDEBUG
+    cout << "G4HepRepSceneHandler::PreAddSolid(G4Transform3D&, G4VisAttributes&)" << endl;
+#endif
+}
+
+
+void G4HepRepSceneHandler::PostAddSolid () {
+#ifdef SDEBUG
+    cout << "G4HepRepSceneHandler::PostAddSolid()" << endl;
+#endif
+    G4VSceneHandler::PostAddSolid();
+}
+
+
+void G4HepRepSceneHandler::BeginPrimitives (const G4Transform3D& objectTransformation) {
+#ifdef SDEBUG
+    cout << "G4HepRepSceneHandler::BeginPrimitives(G4Transform3D&)" << endl;
+#endif
+
+    G4VSceneHandler::BeginPrimitives (objectTransformation);
+    transform = objectTransformation;
+}
+
+
+void G4HepRepSceneHandler::EndPrimitives () {
+#ifdef SDEBUG
+    cout << "G4HepRepSceneHandler::EndPrimitives" << endl;
+#endif
+    G4VSceneHandler::EndPrimitives ();
+}
+
+
+G4bool G4HepRepSceneHandler::dontWrite() {
+    return !(messenger.writeInvisibles() || (fpVisAttribs ? (bool)fpVisAttribs->IsVisible() : true));
+}
+
+void G4HepRepSceneHandler::setColor (HepRepAttribute *attribute,
+				      const G4Color& color,
+				      const G4String& key) {
+#ifdef CDEBUG
+    cout << "G4HepRepSceneHandler::setColor : red : " << color.GetRed ()   <<
+                                  " green : " << color.GetGreen () <<
+                                  " blue : " << color.GetBlue ()   << endl;
+#endif
+
+    setAttribute(attribute, key, color.GetRed(), color.GetGreen(), color.GetBlue(), color.GetAlpha());
+}
+
+G4Color G4HepRepSceneHandler::getColorFor (const G4VSolid& /* solid */) {
+    return fpVisAttribs ? fpVisAttribs->GetColor() : GetColor(NULL);    
+}
+
+G4Color G4HepRepSceneHandler::getColorFor (const G4Visible& visible) {
+    return GetColor(visible);
+}
+
+void G4HepRepSceneHandler::setVisibility (HepRepAttribute *attribute, const G4VSolid& /* solid */) {
+    setAttribute(attribute, "Visibility", (fpVisAttribs ? (bool)fpVisAttribs->IsVisible() : true));
+}
+
+void G4HepRepSceneHandler::setVisibility ( HepRepAttribute *attribute, const G4Visible& visible) {
+    const G4VisAttributes* atts = visible.GetVisAttributes();
+
+    setAttribute(attribute, "Visibility", (atts && (atts->IsVisible()==0)) ? false : true);
+}
+
+void G4HepRepSceneHandler::setLine (HepRepAttribute *attribute, const G4VSolid& /* solid*/) {
+    setAttribute(attribute, "LineWidth", 1.0);
+}
+
+void G4HepRepSceneHandler::setLine (HepRepAttribute *attribute, const G4Visible& visible) {
+    const G4VisAttributes* atts = visible.GetVisAttributes();
+    
+    setAttribute(attribute, "LineWidth", (atts != NULL) ? atts->GetLineWidth() : 1.0);
+    
+    if (atts != NULL) {
+        switch (atts->GetLineStyle()) {
+            case G4VisAttributes::dotted:
+                setAttribute(attribute, "LineStyle", G4String("Dotted"));
+                break;
+            case G4VisAttributes::dashed:
+                setAttribute(attribute, "LineStyle", G4String("Dashed"));
+                break;
+            case G4VisAttributes::unbroken:
+            default:
+                break;
+        }
+    }
+}
+
+void G4HepRepSceneHandler::setMarker (HepRepAttribute *attribute, const G4VMarker& marker) {
+    MarkerSizeType markerType;
+    G4double size = GetMarkerRadius( marker , markerType );
+
+    setAttribute(attribute, "MarkSize", size);
+
+    if (markerType == screen) setAttribute(attribute, "MarkType", G4String("Symbol"));
+    if (marker.GetFillStyle() == G4VMarker::noFill) {
+        setAttribute(attribute, "Fill", false);
+    } else {
+        setColor(attribute, GetColor(marker), G4String("FillColor"));
+    }
+}
+
+void G4HepRepSceneHandler::addAttributes(HepRepInstance* instance, HepRepType* type) {
+    if (currentHit) {
+        vector<G4AttValue>* hitAttValues = currentHit->CreateAttValues();
+        const map<G4String,G4AttDef>* hitAttDefs = currentHit->GetAttDefs();
+
+        addAttDefs(getHitType(), hitAttDefs);
+
+        // these attValues are non-standard, so can only be added when we have the attDef.
+        type->addAttValue("LVol", G4String(""));
+        type->addAttValue("HitType", G4String(""));
+        type->addAttValue("ID", -1);
+        type->addAttValue("Column", -1);
+        type->addAttValue("Row", -1);
+        type->addAttValue("Energy", 0.0);
+        type->addAttValue("Pos", G4String(""));
+
+        addAttVals(instance, hitAttDefs, hitAttValues);
+    
+        delete hitAttValues;
+    
+    } else if (currentTrack) {
+        vector<G4AttValue>* trajectoryAttValues = currentTrack->CreateAttValues();
+        const map<G4String,G4AttDef>* trajectoryAttDefs = currentTrack->GetAttDefs();
+
+        addAttDefs(type, trajectoryAttDefs);
+    
+        // these attValues are non-standard, so can only be added when we have the attDef.
+        type->addAttValue("Ch", 0.0);
+        type->addAttValue("Color", 1.0, 1.0, 1.0, 1.0);
+        type->addAttValue("ID", -1);
+        type->addAttValue("IMom", G4String(""));
+        type->addAttValue("IMag", 0.0);
+        type->addAttValue("PDG", -1);
+        type->addAttValue("PN", G4String(""));
+        type->addAttValue("PID", -1);
+
+        addAttVals(instance, trajectoryAttDefs, trajectoryAttValues);
+    
+        delete trajectoryAttValues;
+        
+    }
+}
+
+void G4HepRepSceneHandler::setAttribute(HepRepAttribute* attribute, G4String name, G4String value) {
+    HepRepAttValue* attValue = attribute->getAttValue(name);
+    if ((attValue == NULL) || (attValue->getString() != value)) {
+        HepRepPoint* point = dynamic_cast<HepRepPoint*>(attribute);
+        if (point != NULL) {
+            if (point->getInstance()->getAttValueFromNode(name) == NULL) {
+                attribute = point->getInstance();
+            }
+        }
+        
+        HepRepInstance* instance = dynamic_cast<HepRepInstance*>(attribute);
+        if (instance != NULL) {
+            // look for definition on type (node only)
+            if (instance->getType()->getAttValueFromNode(name) == NULL) {
+                attribute = instance->getType();
+            }   
+        }
+        
+        attribute->addAttValue(name, value);
+    }
+}
+
+void G4HepRepSceneHandler::setAttribute(HepRepAttribute* attribute, G4String name, bool value) {
+    HepRepAttValue* attValue = attribute->getAttValue(name);
+    if ((attValue == NULL) || (attValue->getBoolean() != value)) {
+        HepRepPoint* point = dynamic_cast<HepRepPoint*>(attribute);
+        if (point != NULL) {
+            if (point->getInstance()->getAttValueFromNode(name) == NULL) {
+                attribute = point->getInstance();
+            }
+        }
+        
+        HepRepInstance* instance = dynamic_cast<HepRepInstance*>(attribute);
+        if (instance != NULL) {
+            // look for definition on type (node only)
+            if (instance->getType()->getAttValueFromNode(name) == NULL) {
+                attribute = instance->getType();
+            }   
+        }
+        
+        attribute->addAttValue(name, value);
+    }
+}
+
+void G4HepRepSceneHandler::setAttribute(HepRepAttribute* attribute, G4String name, double value) {
+    HepRepAttValue* attValue = attribute->getAttValue(name);
+    if ((attValue == NULL) || (attValue->getDouble() != value)) {
+        HepRepPoint* point = dynamic_cast<HepRepPoint*>(attribute);
+        if (point != NULL) {
+            if (point->getInstance()->getAttValueFromNode(name) == NULL) {
+                attribute = point->getInstance();
+            }
+        }
+        
+        HepRepInstance* instance = dynamic_cast<HepRepInstance*>(attribute);
+        if (instance != NULL) {
+            // look for definition on type (node only)
+            if (instance->getType()->getAttValueFromNode(name) == NULL) {
+                attribute = instance->getType();
+            }   
+        }
+        
+        attribute->addAttValue(name, value);
+    }
+}
+
+void G4HepRepSceneHandler::setAttribute(HepRepAttribute* attribute, G4String name, int value) {
+    HepRepAttValue* attValue = attribute->getAttValue(name);
+    if ((attValue == NULL) || (attValue->getInteger() != value)) {
+        HepRepPoint* point = dynamic_cast<HepRepPoint*>(attribute);
+        if (point != NULL) {
+            if (point->getInstance()->getAttValueFromNode(name) == NULL) {
+                attribute = point->getInstance();
+            }
+        }
+        
+        HepRepInstance* instance = dynamic_cast<HepRepInstance*>(attribute);
+        if (instance != NULL) {
+            // look for definition on type (node only)
+            if (instance->getType()->getAttValueFromNode(name) == NULL) {
+                attribute = instance->getType();
+            }   
+        }
+        
+        attribute->addAttValue(name, value);
+    }
+}
+
+void G4HepRepSceneHandler::setAttribute(HepRepAttribute* attribute, G4String name, double red, double green, double blue, double alpha) {
+    HepRepAttValue* attValue = attribute->getAttValue(name);
+    vector<double> color;
+    if (attValue != NULL) color = attValue->getColor();
+    if ((color.size() == 0) ||
+        (color[0] != red) ||
+        (color[1] != green) ||
+        (color[2] != blue) ||
+        ((color.size() > 3) && (color[3] != alpha))) {
+        
+        HepRepPoint* point = dynamic_cast<HepRepPoint*>(attribute);
+        if (point != NULL) {
+            if (point->getInstance()->getAttValueFromNode(name) == NULL) {
+                attribute = point->getInstance();
+            }
+        }
+        
+        HepRepInstance* instance = dynamic_cast<HepRepInstance*>(attribute);
+        if (instance != NULL) {
+            // look for definition on type (node only)
+            if (instance->getType()->getAttValueFromNode(name) == NULL) {
+                attribute = instance->getType();
+            }   
+        }
+        
+        attribute->addAttValue(name, red, green, blue, alpha);
+    }
+}
+
+void G4HepRepSceneHandler::addAttDefs(HepRepDefinition* definition, const map<G4String,G4AttDef>* attDefs) {
+    if (attDefs == NULL) return;
+
+    // Specify additional attribute definitions.
+    map<G4String,G4AttDef>::const_iterator attDefIterator = attDefs->begin();
+    while (attDefIterator != attDefs->end()) {
+        definition->addAttDef(attDefIterator->first, attDefIterator->second.GetDesc(),
+                        attDefIterator->second.GetCategory(), attDefIterator->second.GetExtra());
+        attDefIterator++;
+    }
+}
+
+void G4HepRepSceneHandler::addAttVals(HepRepAttribute* attribute, const map<G4String,G4AttDef>* attDefs, vector<G4AttValue>* attValues) {
+    if (attValues == NULL) return;
+
+    // Copy the instance's G4AttValues to HepRepAttValues.
+    for (vector<G4AttValue>::iterator attValIterator = attValues->begin(); attValIterator != attValues->end(); attValIterator++) {        
+        G4String name = attValIterator->GetName();
+
+        HepRepPoint* point = dynamic_cast<HepRepPoint*>(attribute);
+        if ((name == "Pos") && (point != NULL)) {
+            G4String pos = attValIterator->GetValue();
+//            cout << "Pos* " << pos << endl;
+            int s = 0;
+            int n = 0;
+            int m = 0;
+            G4String unit;
+            for (unsigned int i=0; i<pos.length(); i++) {
+                if (pos[i] == ' ') {
+                    if (n == 0) {
+                        // first coordinate
+                        double factor = atof(pos.substr(s, i-s).c_str())/point->getX();
+                        m = (int)(std::log10(factor)+((factor < 1) ? -0.5 : 0.5));
+//                        cout << factor << ", " << m << endl;
+                    } else if (n == 3) {
+                        // unit
+                        unit = pos.substr(s, i-s);
+                        if (unit == G4String("mum")) {
+                            m += -6;
+                        } else if (unit == G4String("mm")) {
+                            m += -3;
+                        } else if (unit == G4String("cm")) {
+                            m += -2;
+                        } else if (unit == G4String("m")) {
+                            m += 0;
+                        } else if (unit == G4String("km")) {
+                            m += 3;
+                        } else {
+                            cerr << "HepRepSceneHandler: Unrecognized Unit: '" << unit << "'" << endl;
+                        }
+                    }
+                    s = i+1;
+                    n++;
+                }
+            }
+            switch(m) {
+                case -6:
+                    unit = G4String("mum");
+                    break;
+                case -3:
+                    unit = G4String("mm");
+                    break;
+                case -2:
+                    unit = G4String("cm");
+                    break;
+                case 0:
+                    unit = G4String("m");
+                    break;
+                case 3:
+                    unit = G4String("km");
+                    break;
+                default:
+                    cerr << "HepRepSceneHandler: No valid unit found for m: " << m << endl;
+                    unit = G4String("*m");                        
+                    break;
+            }
+//            cout << "U: " << unit << endl;
+            setAttribute(attribute, G4String("PointUnit"), unit);
+            continue;
+        }
+                
+        // NTP already in points being written
+        if (name == "NTP") continue;
+        
+        // find type of attribute using def
+        const map<G4String,G4AttDef>::const_iterator attDefIterator = attDefs->find(name);
+        G4String type = attDefIterator->second.GetValueType();
+                
+        // set based on type
+        if ((type == "G4double") || (type == "double")) {   
+            setAttribute(attribute, attValIterator->GetName(), atof(attValIterator->GetValue()));           
+        } else if ((type == "G4int") || (type == "int")) {  
+            setAttribute(attribute, attValIterator->GetName(), atoi(attValIterator->GetValue()));           
+        } else { // G4String, string and others
+            setAttribute(attribute, attValIterator->GetName(), attValIterator->GetValue());
+        }
+    }
+}
+
+
+bool G4HepRepSceneHandler::isEventData () {
+    G4PhysicalVolumeModel* pPVModel =
+      dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
+    return !pPVModel || fReadyForTransients || currentHit || currentTrack;
+}
+
+void G4HepRepSceneHandler::addTopLevelAttributes(HepRepType* type) {
+    
+    // Some non-standard attributes
+    type->addAttDef(  "Generator", "Generator of the file", "General", "");
+    type->addAttValue("Generator", G4String("Geant4"));
+
+    type->addAttDef(  "GeneratorVersion", "Version of the Generator", "General", "");
+    G4String versionString = G4Version;
+    versionString = versionString.substr(1,versionString.size()-2);
+    versionString = " Geant4 version " + versionString + "   " + G4Date;
+    type->addAttValue("GeneratorVersion", versionString);
+    
+    const G4ViewParameters parameters = GetCurrentViewer()->GetViewParameters();
+    const G4Vector3D& viewPointDirection = parameters.GetViewpointDirection();    
+    type->addAttDef(  "ViewTheta", "Theta of initial suggested viewpoint", "Draw", "rad");
+    type->addAttValue("ViewTheta", viewPointDirection.theta());    
+    
+    type->addAttDef(  "ViewPhi", "Phi of initial suggested viewpoint", "Draw", "rad");
+    type->addAttValue("ViewPhi", viewPointDirection.phi());    
+    
+    type->addAttDef(  "ViewScale", "Scale of initial suggested viewpoint", "Draw", "");
+    type->addAttValue("ViewScale", parameters.GetZoomFactor());    
+    
+// FIXME, no way to set these
+    type->addAttDef(  "ViewTranslateX", "Translate in X of initial suggested viewpoint", "Draw", "");
+    type->addAttValue("ViewTranslateX", 0.0);    
+    
+    type->addAttDef(  "ViewTranslateY", "Translate in Y of initial suggested viewpoint", "Draw", "");
+    type->addAttValue("ViewTranslateY", 0.0);    
+    
+    type->addAttDef(  "ViewTranslateZ", "Translate in Z of initial suggested viewpoint", "Draw", "");
+    type->addAttValue("ViewTranslateZ", 0.0);    
+    
+    type->addAttDef(  "PointUnit", "Length", "Physics", "");
+    type->addAttValue("PointUnit", G4String("m"));
+
+    type->addAttDef(  "UseSolids", "Use HepRep Solids rather than Geant4 Primitives", "Draw", "");
+    type->addAttValue("UseSolids", messenger.useSolids());
+
+    type->addAttDef(  "WriteInvisibles", "Write Invisible Objects", "Draw", "");
+    type->addAttValue("WriteInvisibles", messenger.writeInvisibles());
+}           
+
+
+HepRepInstance* G4HepRepSceneHandler::getGeometryOrEventInstance(HepRepType* type) {
+    if (isEventData()) {
+      return factory->createHepRepInstance(getEventInstance(), type);
+    } else {
+      G4PhysicalVolumeModel* pPVModel =
+	dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
+      G4LogicalVolume* pCurrentLV = pPVModel->GetCurrentLV();
+      G4int currentDepth = pPVModel->GetCurrentDepth();
+      G4Material* pCurrentMaterial = pPVModel->GetCurrentMaterial();
+      return getGeometryInstance(pCurrentLV, pCurrentMaterial, currentDepth);
+    }
+}
+
+HepRep* G4HepRepSceneHandler::getHepRep() {
+    if (_heprep == NULL) {
+        // Create the HepRep that holds the Trees.
+        _heprep = factory->createHepRep();
+    }
+    return _heprep;
+}   
+
+HepRep* G4HepRepSceneHandler::getHepRepGeometry() {
+    if (_heprepGeometry == NULL) {
+        // Create the HepRep that holds the Trees.
+        _heprepGeometry = factory->createHepRep();
+    }
+    return _heprepGeometry;
+}   
+
+HepRepInstanceTree* G4HepRepSceneHandler::getGeometryInstanceTree() {
+    if (_geometryInstanceTree == NULL) {
+        // Create the Geometry InstanceTree.
+        _geometryInstanceTree = factory->createHepRepInstanceTree("G4GeometryData", "1.0", getGeometryTypeTree());
+        if (messenger.appendGeometry()) {
+            getHepRep()->addInstanceTree(_geometryInstanceTree);
+        } else {
+            getHepRepGeometry()->addInstanceTree(_geometryInstanceTree);
+        }
+    }
+    return _geometryInstanceTree;
+}
+
+HepRepInstance* G4HepRepSceneHandler::getGeometryRootInstance() {
+    if (_geometryRootInstance == NULL) {
+        // Create the top level Geometry Instance.
+        _geometryRootInstance = factory->createHepRepInstance(getGeometryInstanceTree(), getGeometryRootType());
+    }
+    return _geometryRootInstance;
+}
+
+HepRepInstance* G4HepRepSceneHandler::getGeometryInstance(G4LogicalVolume* volume, G4Material* material, int depth) {
+    HepRepInstance* instance = getGeometryInstance(volume->GetName(), depth);
+
+    setAttribute(instance, "LVol",       volume->GetName());
+    G4Region* region = volume->GetRegion();
+    G4String regionName = region? region->GetName(): G4String("No region");
+    setAttribute(instance, "Region",     regionName);
+    setAttribute(instance, "RootRegion", volume->IsRootRegion());
+    setAttribute(instance, "Solid",      volume->GetSolid()->GetName());
+    setAttribute(instance, "EType",      volume->GetSolid()->GetEntityType());
+    G4String matName = material? material->GetName(): G4String("No material");
+    setAttribute(instance, "Material",   matName );
+    G4double matDensity = material? material->GetDensity(): 0.;
+    setAttribute(instance, "Density",    matDensity);
+    G4double matRadlen = material? material->GetRadlen(): 0.;
+    setAttribute(instance, "Radlen",     matRadlen);
+    
+    G4State matState = material? material->GetState(): kStateUndefined;
+    G4String state = materialState[matState];
+    setAttribute(instance, "State", state);
+    
+    return instance;
+}
+
+HepRepInstance* G4HepRepSceneHandler::getGeometryInstance(G4String volumeName, int depth) {
+    // no extra checks since these are done in the geometryType already
+
+    // adjust depth, also pop the current instance
+    while ((int)_geometryInstance.size() > depth) {
+        _geometryInstance.pop_back();
+    }
+    
+    // get parent
+    HepRepInstance* parent = (_geometryInstance.empty()) ? getGeometryRootInstance() : _geometryInstance.back();
+    
+    // get type
+    HepRepType* type = getGeometryType(volumeName, depth);
+    
+    // create instance
+    HepRepInstance* instance = factory->createHepRepInstance(parent, type);
+    _geometryInstance.push_back(instance);
+
+    return instance;
+}
+
+HepRepTypeTree* G4HepRepSceneHandler::getGeometryTypeTree() {
+    if (_geometryTypeTree == NULL) {
+        // Create the Geometry TypeTree.
+        HepRepTreeID* geometryTreeID = factory->createHepRepTreeID("G4GeometryTypes", "1.0");
+        _geometryTypeTree = factory->createHepRepTypeTree(geometryTreeID);
+        if (messenger.appendGeometry()) {
+            getHepRep()->addTypeTree(_geometryTypeTree);
+        } else {
+            getHepRepGeometry()->addTypeTree(_geometryTypeTree);
+        }
+    }
+    return _geometryTypeTree;
+}
+
+HepRepType* G4HepRepSceneHandler::getGeometryRootType() {
+    if (_geometryRootType == NULL) {
+        // Create the top level Geometry Type.
+        _geometryRootType = factory->createHepRepType(getGeometryTypeTree(), rootVolumeName);
+        _geometryRootType->addAttValue("Layer", geometryLayer);
+    
+        // Add attdefs used by all geometry types.
+        _geometryRootType->addAttDef  ("LVol", "Logical Volume", "Physics","");
+        _geometryRootType->addAttValue("LVol", G4String(""));
+        _geometryRootType->addAttDef  ("Region", "Cuts Region", "Physics","");
+        _geometryRootType->addAttValue("Region", G4String(""));
+        _geometryRootType->addAttDef  ("RootRegion", "Root Region", "Physics","");
+        _geometryRootType->addAttValue("RootRegion", false);
+        _geometryRootType->addAttDef  ("Solid", "Solid Name", "Physics","");
+        _geometryRootType->addAttValue("Solid", G4String(""));
+        _geometryRootType->addAttDef  ("EType", "Entity Type", "Physics","");
+        _geometryRootType->addAttValue("EType", G4String("G4Box"));
+        _geometryRootType->addAttDef  ("Material", "Material Name", "Physics","");
+        _geometryRootType->addAttValue("Material", G4String("Air"));
+        _geometryRootType->addAttDef  ("Density", "Material Density", "Physics","");
+        _geometryRootType->addAttValue("Density", 0.0);
+        _geometryRootType->addAttDef  ("State", "Material State", "Physics","");
+        _geometryRootType->addAttValue("State", G4String("Gas"));
+        _geometryRootType->addAttDef  ("Radlen", "Material Radiation Length", "Physics","");
+        _geometryRootType->addAttValue("Radlen", 0.0);
+        
+        // add defaults for Geometry
+        _geometryRootType->addAttValue("Color", 0.8, 0.8, 0.8, 1.0);
+        _geometryRootType->addAttValue("Visibility", true);
+        _geometryRootType->addAttValue("FillColor", 0.8, 0.8, 0.8, 1.0);
+        _geometryRootType->addAttValue("LineWidth", 1.0);
+        _geometryRootType->addAttValue("DrawAs", G4String("Polygon"));
+        _geometryRootType->addAttValue("PickParent", false);
+        _geometryRootType->addAttValue("ShowParentAttributes", true);
+        
+        _geometryRootType->addAttValue("MarkSizeMultiplier", 4.0);
+        _geometryRootType->addAttValue("LineWidthMultiplier", 1.0);
+
+        addTopLevelAttributes(_geometryRootType);       
+                
+        _geometryType["/"+_geometryRootType->getName()] = _geometryRootType;
+    }
+    return _geometryRootType;
+}
+
+HepRepType* G4HepRepSceneHandler::getGeometryType(G4String volumeName, int depth) {
+    // make sure we have a root
+    getGeometryRootType();   
+
+    // construct the full name for this volume
+    G4String name = getFullTypeName(volumeName, depth);
+    
+    // lookup type and create if necessary
+    HepRepType* type = _geometryType[name];    
+    if (type == NULL) {
+        G4String parentName = getParentTypeName(depth);
+        HepRepType* parentType = _geometryType[parentName];
+        // HepRep uses hierarchical names
+        type = factory->createHepRepType(parentType, volumeName);
+        _geometryType[name] = type;
+    }
+    return type;   
+}
+
+G4String G4HepRepSceneHandler::getFullTypeName(G4String volumeName, int depth) {
+    // check for name depth
+    if (depth > (int)_geometryTypeName.size()) {
+        // there is a problem, book this type under problems
+        G4String problem = "HierarchyProblem";
+        if (_geometryType["/"+problem] == NULL) {
+            // HepRep uses hierarchical names
+            HepRepType* type = factory->createHepRepType(getGeometryRootType(), problem);
+            _geometryType["/"+problem] = type;
+        }
+        return "/" + problem + "/" + volumeName;
+    }
+    
+    // adjust name depth, also pop the current volumeName
+    while ((int)_geometryTypeName.size() > depth) {
+        _geometryTypeName.pop_back();
+    }
+    
+    // construct full name and push it
+    G4String name = (_geometryTypeName.empty()) ? G4String("/"+rootVolumeName) : _geometryTypeName.back();
+    name = name + "/" + volumeName;
+    _geometryTypeName.push_back(name);
+    return name;
+}
+
+G4String G4HepRepSceneHandler::getParentTypeName(int depth) {
+    return (depth >= 1) ? _geometryTypeName[depth-1] : G4String("/"+rootVolumeName);
+}       
+
+HepRepInstanceTree* G4HepRepSceneHandler::getEventInstanceTree() {
+    if (_eventInstanceTree == NULL) {
+        // Create the Event InstanceTree.
+        _eventInstanceTree = factory->createHepRepInstanceTree("G4EventData", "1.0", getEventTypeTree());
+        getHepRep()->addInstanceTree(_eventInstanceTree);
+    }
+    return _eventInstanceTree;
+}
+
+HepRepInstance* G4HepRepSceneHandler::getEventInstance() {
+    if (_eventInstance == NULL) {
+        // Create the top level Event Instance.
+        _eventInstance = factory->createHepRepInstance(getEventInstanceTree(), getEventType());
+    }
+    return _eventInstance;
+}
+
+HepRepTypeTree* G4HepRepSceneHandler::getEventTypeTree() {
+    if (_eventTypeTree == NULL) {
+        // Create the Event TypeTree.
+        HepRepTreeID* eventTreeID = factory->createHepRepTreeID("G4EventTypes", "1.0");
+        _eventTypeTree = factory->createHepRepTypeTree(eventTreeID);
+        getHepRep()->addTypeTree(_eventTypeTree);    
+    }
+    
+    return _eventTypeTree;
+}
+
+HepRepType* G4HepRepSceneHandler::getEventType() {
+    if (_eventType == NULL) {
+        // Create the top level Event Type.
+        _eventType = factory->createHepRepType(getEventTypeTree(), "Event");
+        _eventType->addAttValue("Layer", eventLayer);
+
+        // add defaults for Events
+        _eventType->addAttValue("Visibility", true);
+        _eventType->addAttValue("Color", 1.0, 1.0, 1.0, 1.0);
+        _eventType->addAttValue("FillColor", 1.0, 1.0, 1.0, 1.0);
+        _eventType->addAttValue("LineWidth", 1.0);
+        _eventType->addAttValue("HasFrame", true);
+        _eventType->addAttValue("PickParent", false);
+        _eventType->addAttValue("ShowParentAttributes", false);
+
+        _eventType->addAttValue("MarkSizeMultiplier", 4.0);
+        _eventType->addAttValue("LineWidthMultiplier", 1.0);
+
+        addTopLevelAttributes(_eventType);
+    }
+    
+    return _eventType;
+}
+
+HepRepType* G4HepRepSceneHandler::getTrajectoryType() {
+    if (_trajectoryType == NULL) {
+        _trajectoryType = factory->createHepRepType(getEventType(), "Trajectory");
+        
+        _trajectoryType->addAttValue("Layer", trajectoryLayer);
+        _trajectoryType->addAttValue("DrawAs", G4String("Line"));
+
+        _trajectoryType->addAttValue("LineWidthMultiplier", 2.0);
+        
+        // attributes to draw the points of a track as markers.
+        _trajectoryType->addAttValue("MarkName", G4String("Box"));
+        _trajectoryType->addAttValue("MarkSize", 4);
+        _trajectoryType->addAttValue("MarkType", G4String("Symbol"));
+        _trajectoryType->addAttValue("Fill", true);
+    }
+    return _trajectoryType;
+}
+
+HepRepType* G4HepRepSceneHandler::getHitType() {
+    if (_hitType == NULL) {
+        _hitType = factory->createHepRepType(getEventType(), "Hit");
+        _hitType->addAttValue("Layer", hitLayer);
+        _hitType->addAttValue("DrawAs", G4String("Point"));
+        _hitType->addAttValue("MarkName", G4String("Box"));
+        _hitType->addAttValue("MarkSize", 4.0);
+        _hitType->addAttValue("MarkType", G4String("Symbol"));
+        _hitType->addAttValue("Fill", true);
+    }
+    return _hitType;
+}
+
+HepRepType* G4HepRepSceneHandler::getCalHitType() {
+    if (_calHitType == NULL) {
+        _calHitType = factory->createHepRepType(getEventType(), "CalHit");
+        _calHitType->addAttValue("Layer", calHitLayer);
+        _calHitType->addAttValue("Fill", true);
+        _calHitType->addAttValue("DrawAs", G4String("Polygon"));
+    }
+    return _calHitType;
+}
+
+HepRepType* G4HepRepSceneHandler::getCalHitFaceType() {
+    if (_calHitFaceType == NULL) {
+        _calHitFaceType = factory->createHepRepType(getCalHitType(), "CalHitFace");
+        _calHitFaceType->addAttValue("PickParent", true);
+    }
+    return _calHitFaceType;
+}
+
Index: tags/visualization-10.5-before-10.6_test/HepRep/src/G4HepRepViewer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/src/G4HepRepViewer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/src/G4HepRepViewer.cc	(revision 1102)
@@ -0,0 +1,126 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4HepRepViewer.cc,v 1.26 2006/06/29 21:17:34 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+
+/**
+ * @author Mark Donszelmann
+ */
+
+//HepRep
+#include "HEPREP/HepRep.h"
+
+//G4
+#include "G4Types.hh"
+//#include "G4VInteractorManager.hh"
+#include "G4Scene.hh"
+#include "G4HepRep.hh"
+#include "G4HepRepSceneHandler.hh"
+//This
+#include "G4HepRepViewer.hh"
+
+using namespace HEPREP;
+using namespace std;
+
+G4HepRepViewer::G4HepRepViewer (G4VSceneHandler& sceneHandler, G4HepRepMessenger& heprepMessenger, const G4String& name)
+        : G4VViewer (sceneHandler, sceneHandler.IncrementViewCount(), name),
+        geometryIncluded(false),
+        messenger(heprepMessenger) {
+
+#ifdef SDEBUG
+    cout << "G4HepRepViewer::G4HepRepViewer " << name << endl;
+#endif
+
+    // Make changes to view parameters for HepRep...
+    fVP.SetCulling(false);
+    fDefaultVP.SetCulling(false);
+}
+
+
+
+G4HepRepViewer::~G4HepRepViewer () {
+#ifdef SDEBUG
+    cout << "G4HepRepViewer::~G4HepRepViewer" << endl;
+#endif
+    dynamic_cast<G4HepRep*>(GetSceneHandler()->GetGraphicsSystem())->removeViewer();
+}
+
+
+void G4HepRepViewer::ClearView () {
+#ifdef SDEBUG
+    cout << "G4HepRepViewer::ClearView" << endl;
+#endif
+}
+
+void G4HepRepViewer::SetView () {
+#ifdef SDEBUG
+    cout << "G4HepRepViewer::SetView" << endl;
+#endif
+}
+
+
+/* NOTE:
+    /run/beamOn         calls ShowView for every event (unless accumulate is set)
+    /vis/viewer/flush   calls /vis/viewer/refresh followed by /vis/viewer/update
+    /vis/viewer/refresh calls SetView, ClearView, DrawView
+    /vis/viewer/update  calls ShowView
+*/
+void G4HepRepViewer::DrawView () {
+#ifdef SDEBUG
+    cout << "G4HepRepViewer::DrawView" << endl;
+#endif
+    if (!geometryIncluded) {
+        // draws the geometry
+        NeedKernelVisit();
+        ProcessView();
+        geometryIncluded = true;
+    }
+}
+
+void G4HepRepViewer::ShowView () {
+#ifdef SDEBUG
+    cout << "G4HepRepViewer::ShowView" << endl;
+#endif
+    G4VViewer::ShowView();
+
+    G4HepRepSceneHandler* sceneHandler = dynamic_cast<G4HepRepSceneHandler*>(GetSceneHandler());
+    if (sceneHandler->closeHepRep()) {
+        sceneHandler->openHepRep();
+        if (messenger.appendGeometry()) geometryIncluded = false;
+    }
+}
+
+void G4HepRepViewer::FinishView () {
+#ifdef SDEBUG
+    cout << "G4HepRepViewer::FinishView" << endl;
+#endif
+    G4VViewer::FinishView();
+}
+
+void G4HepRepViewer::reset() {
+    geometryIncluded = false;
+}  
Index: tags/visualization-10.5-before-10.6_test/HepRep/src/GZIPOutputStream.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/src/GZIPOutputStream.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/src/GZIPOutputStream.cc	(revision 1102)
@@ -0,0 +1,39 @@
+// Copyright FreeHEP, 2005.
+
+#include "cheprep/GZIPOutputStreamBuffer.h"
+#include "cheprep/GZIPOutputStream.h"
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: GZIPOutputStream.cc,v 1.4 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+    using namespace std;
+
+    GZIPOutputStream::GZIPOutputStream(ostream &os)
+                : std::ostream(NULL) {
+      
+        buffer = new GZIPOutputStreamBuffer(os.rdbuf()); 
+        init(buffer);   
+    }
+
+
+    void GZIPOutputStream::setFilename(const string &filename) {
+        buffer->setFilename(filename);
+    }
+
+    void GZIPOutputStream::setComment(const string &comment) {
+        buffer->setComment(comment);
+    }
+
+    void GZIPOutputStream::close() {
+        buffer->close();
+    }
+
+
+    GZIPOutputStream::~GZIPOutputStream() {
+        delete buffer;
+    }
+
+} // cheprep
Index: tags/visualization-10.5-before-10.6_test/HepRep/src/GZIPOutputStreamBuffer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/src/GZIPOutputStreamBuffer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/src/GZIPOutputStreamBuffer.cc	(revision 1102)
@@ -0,0 +1,78 @@
+// Copyright FreeHEP, 2005.
+
+#include "cheprep/GZIPOutputStreamBuffer.h"
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: GZIPOutputStreamBuffer.cc,v 1.4 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+    using namespace std;
+
+    GZIPOutputStreamBuffer::GZIPOutputStreamBuffer( streambuf *buffer)
+        : DeflateOutputStreamBuffer(buffer),
+          open(false) {
+            
+        init(true);
+    }
+    
+    void GZIPOutputStreamBuffer::setFilename( const string &name ) {
+        filename = name ;
+    }
+    
+    void GZIPOutputStreamBuffer::setComment( const string &c ) {
+        comment = c ;
+    }
+    
+    void GZIPOutputStreamBuffer::close() {
+        if (!open) return;
+
+        finish();         
+        writeTrailer();
+      
+        open = false ;
+    }
+    
+    GZIPOutputStreamBuffer::~GZIPOutputStreamBuffer() {
+        close() ;
+    }
+    
+    int GZIPOutputStreamBuffer::overflow( int c ) {
+        if (!open) {
+            writeHeader();
+            open = true;
+        }
+        return DeflateOutputStreamBuffer::overflow( c ) ;
+    }
+        
+    void GZIPOutputStreamBuffer::writeHeader() {
+        unsigned char flag = 0x00;
+        flag |= (filename == "") ? 0x00 : 0x08;
+        flag |= (comment  == "") ? 0x00 : 0x10;
+    
+        putUB(0x1f);  // Magic #
+        putUB(0x8b);  // Magic #        
+        putUB(0x08);  // Deflater.DEFLATED
+        putUB(flag);  // FLG
+        putUI(0x00000000);  // MTIME
+        putUB(0x00);  // XFLG
+        putUB(0x00);  // OS
+            
+        if (filename != "") {
+            putS(filename); // Filename
+            putUB(0x00);
+        }
+        
+        if (comment != "") {
+            putS(comment); // Comment
+            putUB(0x00);
+        }
+    }
+    
+    void GZIPOutputStreamBuffer::writeTrailer() {
+        putUI(getCRC());
+        putUI(getSize());
+    }
+    
+} // cheprep
Index: tags/visualization-10.5-before-10.6_test/HepRep/src/IndentPrintWriter.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/src/IndentPrintWriter.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/src/IndentPrintWriter.cc	(revision 1102)
@@ -0,0 +1,89 @@
+// Copyright FreeHEP, 2005.
+
+#include <fstream>
+
+#include "cheprep/IndentPrintWriter.h"
+
+using namespace std;
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: IndentPrintWriter.cc,v 1.14 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+IndentPrintWriter::IndentPrintWriter(ostream* out, int level)
+    : out(out), 
+      closed(false), 
+      indentLevel(level),
+      indented(false),
+      indentString("  ") {
+}
+
+IndentPrintWriter::~IndentPrintWriter() {
+}
+
+void IndentPrintWriter::close() {
+    if (!closed) {
+        out->flush();
+        closed = true;
+    }
+}
+
+IndentPrintWriter& IndentPrintWriter::operator<< (const std::string & s) {
+    if (!indented) doIndent();
+    *out << s;
+    return *this;
+}
+
+IndentPrintWriter& IndentPrintWriter::operator<< (ostream& (*)(ostream&)) {
+    *out << endl;
+    indented = false;
+    return *this;
+}
+
+void IndentPrintWriter::println(const string & s) {
+	*this << s << endl;
+}
+
+void IndentPrintWriter::print(const string & s) {
+    *this << s;
+}
+
+void IndentPrintWriter::println() {
+    *out << endl;
+	indented = false;
+}
+
+void IndentPrintWriter::doIndent() {
+	for (int i=0; i<indentLevel; i++) {
+	    *out << indentString;
+	}
+	indented = true;
+}
+
+void IndentPrintWriter::indent() {
+    indentLevel++;
+}
+
+void IndentPrintWriter::outdent() {
+    indentLevel--;
+}
+
+int IndentPrintWriter::getIndent() const {
+    return indentLevel;
+}
+
+void IndentPrintWriter::setIndent(const int level) {
+    indentLevel = level;
+}
+
+string IndentPrintWriter::getIndentString() const {
+    return indentString;
+}
+
+void IndentPrintWriter::setIndentString(const string & indent) {
+    indentString = indent;
+}
+
+} // cheprep
Index: tags/visualization-10.5-before-10.6_test/HepRep/src/README
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/src/README	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/src/README	(revision 1102)
@@ -0,0 +1,25 @@
+Apart from the heprep1 files:
+
+G4HepRepFile.cc
+G4HepRepFileSceneHandler.cc
+G4HepRepFileViewer.cc
+HepRepXMLWriter.cc
+
+and heprep2 files:
+
+G4HepRep.cc
+G4HepRepSceneHandler.cc
+G4HepRepMessenger.cc
+G4HepRepViewer.cc
+
+and the zlib sources
+
+the other sources are copies from the FreeHEP library
+(java.freehep.org) and are maintained there.
+
+The files starting with G4 are geant4 compliant, the others may not be.
+
+Changes made here may be overwritten.
+
+3 May 2005
+Mark Donszelmann
Index: tags/visualization-10.5-before-10.6_test/HepRep/src/XMLHepRepFactory.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/src/XMLHepRepFactory.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/src/XMLHepRepFactory.cc	(revision 1102)
@@ -0,0 +1,40 @@
+// Copyright FreeHEP, 2005.
+
+#include <iostream>
+#include <fstream>
+
+#include "cheprep/XMLHepRepWriter.h"
+#include "cheprep/XMLHepRepFactory.h"
+
+using namespace std;
+using namespace HEPREP;
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: XMLHepRepFactory.cc,v 1.5 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+
+XMLHepRepFactory::XMLHepRepFactory() {
+}
+
+XMLHepRepFactory::~XMLHepRepFactory() {
+}
+
+HepRepReader* XMLHepRepFactory::createHepRepReader (istream*) {
+    cerr << "XMLHepRepFactory::createHepRepReader not implemented" << endl;
+    return NULL;
+}
+
+HepRepReader* XMLHepRepFactory::createHepRepReader (std::string) {
+    cerr << "XMLHepRepFactory::createHepRepReader not implemented" << endl;
+    return NULL;
+}
+
+HepRepWriter* XMLHepRepFactory::createHepRepWriter(ostream* out, bool randomAccess, bool compress) {
+    return new XMLHepRepWriter(out, randomAccess, compress);
+}
+
+} // cheprep
+
Index: tags/visualization-10.5-before-10.6_test/HepRep/src/XMLHepRepWriter.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/src/XMLHepRepWriter.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/src/XMLHepRepWriter.cc	(revision 1102)
@@ -0,0 +1,288 @@
+// Copyright FreeHEP, 2005.
+
+#include "cheprep/XMLHepRepWriter.h"
+#include "cheprep/XMLWriter.h"
+#include "cheprep/BHepRepWriter.h"
+
+#include "cheprep/DefaultHepRepInstance.h"
+#include "cheprep/DefaultHepRepAttValue.h"
+
+#define NAMESPACE "heprep"
+
+using namespace std;
+using namespace HEPREP;
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: XMLHepRepWriter.cc,v 1.15 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+XMLHepRepWriter::XMLHepRepWriter(ostream* os, bool randomAccess, bool useCompression) 
+        : out(os),
+          compress(useCompression) {
+            
+    this->nameSpace = NAMESPACE;
+
+    if (randomAccess) {
+        zip = new ZipOutputStream(*os);
+        out = zip;
+        gz = NULL;
+    } else {
+        zip = NULL;
+        if (useCompression) {
+#ifndef CHEPREP_NO_ZLIB
+            gz = new GZIPOutputStream(*os);
+            out = gz;
+#else
+            cerr << "WARNING: the .gz output stream you are creating will be a plain file," << endl;
+            cerr << "since compression support (ZLIB) was not compiled into the library." << endl;
+            cerr << "To add ZLIB support, you need to undefine CHEPREP_NO_ZLIB." << endl;  
+            gz = NULL;            
+#endif
+        } else {
+            gz = NULL;
+        }
+    }
+}
+
+XMLHepRepWriter::~XMLHepRepWriter() {
+    delete gz;
+    delete zip;
+}
+
+bool XMLHepRepWriter::addProperty(std::string key, std::string value) {
+    properties[key] = value;
+    return true;
+}
+
+bool XMLHepRepWriter::close() {
+    if (zip != NULL) {
+        zip->putNextEntry("heprep.properties", true);
+        
+        map<string, string>::iterator i = properties.begin();
+        while (i != properties.end()) {
+            *zip << (*i).first << "=" << (*i).second << endl;
+            i++;
+        }
+        zip->closeEntry();
+        zip->close();
+    }
+
+    if (gz != NULL) {
+        gz->close();
+    }
+    return true;
+}
+
+bool XMLHepRepWriter::write(HepRep* heprep, string name) {
+    if (zip != NULL) {
+        zip->putNextEntry(name, compress);
+    }
+    
+    if (name.rfind(".bheprep") == name.length()-8) {
+       xml = new BHepRepWriter(*out);
+    } else { 
+       xml = new XMLWriter(out, "  ", NAMESPACE);
+    }
+            
+    xml->openDoc();
+    xml->setAttribute("version", (string)"2.0");
+    xml->setAttribute("xmlns", (string)"http://java.freehep.org/schemas/heprep/2.0");
+    xml->setAttribute("xmlns", "xsi", "http://www.w3.org/2001/XMLSchema-instance");
+    xml->setAttribute("xsi", "schemaLocation", "http://java.freehep.org/schemas/heprep/2.0 http://java.freehep.org/schemas/heprep/2.0/HepRep.xsd");
+    xml->openTag(nameSpace, "heprep");
+    write(heprep->getLayerOrder());
+    vector<HepRepTypeTree*> typeTreeSet = heprep->getTypeTreeList();
+    for (vector<HepRepTypeTree*>::iterator i1=typeTreeSet.begin(); i1 != typeTreeSet.end(); i1++) {
+        write(*i1);
+    }
+    vector<HepRepInstanceTree*> instanceTreeSet = heprep->getInstanceTreeList();
+    for (vector<HepRepInstanceTree*>::iterator i2=instanceTreeSet.begin(); i2 != instanceTreeSet.end(); i2++) {
+        write(*i2);
+    }
+    xml->closeTag();
+    xml->closeDoc();
+//    xml->close();
+    delete xml;
+   
+    if (zip != NULL) {
+        zip->closeEntry();
+    }
+
+    return true;
+}
+
+bool XMLHepRepWriter::write(vector<string> layers) {
+    string layerOrder = "";
+    bool comma = false;
+    for (vector<string>::iterator i=layers.begin(); i != layers.end(); i++) {
+        if (comma) {
+            layerOrder.append(", ");
+        }
+        layerOrder.append(*i);
+        comma = true;
+    }
+    xml->setAttribute("order", layerOrder);
+    xml->printTag(nameSpace, "layer");
+    return true;
+}
+
+bool XMLHepRepWriter::write(HepRepTypeTree* typeTree) {
+    xml->setAttribute("name", typeTree->getName());
+    xml->setAttribute("version", typeTree->getVersion());
+    xml->openTag(nameSpace, "typetree");
+
+    vector<HepRepType*> types = typeTree->getTypeList();
+    for (vector<HepRepType*>::iterator i=types.begin(); i != types.end(); i++) {
+        write(*i);
+    }
+    
+    xml->closeTag();
+    return true;
+}
+
+bool XMLHepRepWriter::write(HepRepType* type) {
+    xml->setAttribute("name", type->getName());
+    xml->openTag(nameSpace, "type");
+    write((HepRepDefinition*)type);
+    write((HepRepAttribute*)type);
+    
+    vector<HepRepType*> types = type->getTypeList();
+    for (vector<HepRepType*>::iterator i=types.begin(); i != types.end(); i++) {
+        write(*i);
+    }
+    xml->closeTag();
+    return true;
+}
+
+bool XMLHepRepWriter::write(HepRepTreeID* treeID) {
+    xml->setAttribute("qualifier", treeID->getQualifier());
+    xml->setAttribute("name", treeID->getName());
+    xml->setAttribute("version", treeID->getVersion());
+    xml->printTag(nameSpace, "treeid");
+    return true;
+}
+
+bool XMLHepRepWriter::write(HepRepAction* action) {
+    xml->setAttribute("name", action->getName());
+    xml->setAttribute("expression", action->getExpression());
+    xml->printTag(nameSpace, "action");
+    return true;
+}
+
+bool XMLHepRepWriter::write(HepRepInstanceTree* instanceTree) {
+    xml->setAttribute("name", instanceTree->getName());
+    xml->setAttribute("version", instanceTree->getVersion());
+    xml->setAttribute("typetreename", instanceTree->getTypeTree()->getName());
+    xml->setAttribute("typetreeversion", instanceTree->getTypeTree()->getVersion());
+    xml->openTag(nameSpace, "instancetree");
+    // refs
+    vector<HepRepTreeID*> instanceTreeSet = instanceTree->getInstanceTreeList();
+    for (vector<HepRepTreeID*>::iterator i1=instanceTreeSet.begin(); i1 != instanceTreeSet.end(); i1++) {
+        write(*i1);
+    }
+
+    // instances
+    vector<HepRepInstance*> instanceList = instanceTree->getInstances();
+    for (vector<HepRepInstance*>::iterator i2=instanceList.begin(); i2 != instanceList.end(); i2++) {
+        write(*i2);
+    }
+    xml->closeTag();
+    return true;
+}
+
+bool XMLHepRepWriter::write(HepRepInstance* instance) {
+    // FIXME FREEHEP-356
+    xml->setAttribute("type", instance->getType()->getFullName());
+    xml->openTag(nameSpace, "instance");
+    write((HepRepAttribute*)instance);
+
+    vector<HepRepPoint*> pointList = instance->getPoints();
+    for (vector<HepRepPoint*>::iterator i1=pointList.begin(); i1 != pointList.end(); i1++) {
+        write(*i1);
+    }
+
+    vector<HepRepInstance*> instanceList = instance->getInstances();
+    for (vector<HepRepInstance*>::iterator i2=instanceList.begin(); i2 != instanceList.end(); i2++) {
+        write(*i2);
+    }
+    xml->closeTag();
+    return true;
+}
+
+bool XMLHepRepWriter::write(HepRepPoint* point) {
+    xml->setAttribute("x", point->getX());
+    xml->setAttribute("y", point->getY());
+    xml->setAttribute("z", point->getZ());
+    if (point->getAttValuesFromNode().size() != 0) {
+        xml->openTag(nameSpace, "point");
+        write((HepRepAttribute*)point);
+        xml->closeTag();
+    } else {
+        xml->printTag(nameSpace, "point");
+    }
+    return true;
+}
+
+bool XMLHepRepWriter::write(HepRepAttribute* attribute) {
+    // BUG FIX.  Do something special for layers, because these do not end
+    // up in the normal iteration.
+    HepRepAttValue* layerAtt = attribute->getAttValueFromNode("layer");
+    if (layerAtt != NULL) write(layerAtt);
+
+    set<HepRepAttValue*> attSet = attribute->getAttValuesFromNode();
+    for (set<HepRepAttValue*>::iterator i=attSet.begin(); i != attSet.end(); i++) {
+        write(*i);
+    }
+    return true;
+}
+
+bool XMLHepRepWriter::write(HepRepDefinition* definition) {
+    set<HepRepAttDef*> list = definition->getAttDefsFromNode();
+    for (set<HepRepAttDef*>::iterator i=list.begin(); i != list.end(); i++) {
+        write(*i);
+    }
+    return true;
+}
+
+bool XMLHepRepWriter::write(HepRepAttValue* attValue) {
+    string name = attValue->getName();
+
+    xml->setAttribute("name", name);
+
+    switch(attValue->getType()) {
+        default:                            xml->setAttribute("value", attValue->getAsString());
+                                            break;                           
+        case HepRepConstants::TYPE_STRING:  xml->setAttribute("value", attValue->getString());
+                                            break;
+        case HepRepConstants::TYPE_LONG:    xml->setAttribute("value", attValue->getLong());
+                                            break;
+        case HepRepConstants::TYPE_INT:     xml->setAttribute("value", attValue->getInteger());
+                                            break;
+        case HepRepConstants::TYPE_DOUBLE:  xml->setAttribute("value", attValue->getDouble());
+                                            break;
+        case HepRepConstants::TYPE_BOOLEAN: xml->setAttribute("value", attValue->getBoolean());
+                                            break;
+        case HepRepConstants::TYPE_COLOR:   xml->setAttribute("value", attValue->getColor());
+    }
+
+    if (attValue->showLabel() != HepRepConstants::SHOW_NONE) {
+        xml->setAttribute("showlabel", attValue->showLabel());
+    }
+
+    xml->printTag(nameSpace, "attvalue");
+    return true;
+}
+
+bool XMLHepRepWriter::write(HepRepAttDef* attDef) {
+    xml->setAttribute("name", attDef->getName());
+    xml->setAttribute("desc", attDef->getDescription());
+    xml->setAttribute("category", attDef->getCategory());
+    xml->setAttribute("extra", attDef->getExtra());
+    xml->printTag(nameSpace, "attdef");
+    return true;
+}
+
+} // cheprep
+
Index: tags/visualization-10.5-before-10.6_test/HepRep/src/XMLWriter.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/src/XMLWriter.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/src/XMLWriter.cc	(revision 1102)
@@ -0,0 +1,286 @@
+// Copyright FreeHEP, 2005.
+
+#include "cheprep/config.h"
+
+#include <cstdio>
+
+#include "cheprep/DefaultHepRepAttValue.h"
+#include "cheprep/XMLWriter.h"
+
+using namespace std;
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: XMLWriter.cc,v 1.12 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+XMLWriter::XMLWriter(ostream* out, string indentString, string defaultNameSpace)
+    : AbstractXMLWriter(defaultNameSpace) {
+    writer = new IndentPrintWriter(out);
+    writer->setIndentString(indentString);
+    closed = false;
+    dtdName = "";
+}
+
+XMLWriter::~XMLWriter() {
+    writer->close();
+    delete writer;
+}
+
+void XMLWriter::close() {
+    closeDoc();
+    writer->close();
+}
+
+void XMLWriter::openDoc(string version, string encoding, bool standalone) {
+    string indentString = writer->getIndentString();
+    writer->setIndentString(indentString);
+
+//    if (!XMLCharacterProperties.validVersionNum(version)) throw new RuntimeException("Invalid version number: "+version);
+    *writer << "<?xml version=\"" << version.c_str() << "\" ";
+    if (encoding.compare("") != 0) {
+//        if (!XMLCharacterProperties.validEncName(encoding)) throw new RuntimeException("Invalid encoding name: "+encoding);
+        *writer << "encoding=\"" << encoding.c_str() << "\" ";
+    }
+    if (standalone) {
+        *writer << "standalone=\"yes\" ";
+    }
+    *writer << "?>";
+    *writer << endl;
+    writer->setIndentString(indentString);
+}
+
+void XMLWriter::referToDTD(string name, string pid, string ref) {
+    if (dtdName != "") {
+        cerr << "XMLWriter::ReferToDTD cannot be called twice" << endl;
+    }
+    dtdName = name;
+    *writer << "<!DOCTYPE " << name.c_str() << " PUBLIC \"" << pid.c_str() << "\" \"" << ref.c_str() << "\">" << endl;
+}
+
+void XMLWriter::referToDTD(string name, string system) {
+    if (dtdName != "") {
+        cerr << "XMLWriter::ReferToDTD cannot be called twice";
+    }
+    dtdName = name;
+    *writer << "<!DOCTYPE " << name.c_str() << " SYSTEM \"" << system.c_str() << "\">" << endl;
+}
+
+void XMLWriter::closeDoc(bool force) {
+    if (!closed) {
+        if (!openTags.empty()) {
+            if (!force) cerr << "Not all tags were closed before closing XML document:" << endl;
+            while (!openTags.empty()) {
+                if (force) {
+                    closeTag();
+                } else {
+                    cerr << "   </" << openTags.top().c_str() << ">" << endl;
+                    openTags.pop();
+                }
+            }
+        }
+        closed = true;
+    }
+}
+
+void XMLWriter::printComment(string comment) {
+    if (comment.find("--") != string::npos) {
+        cerr << "XMLWriter::printComment '--' sequence not allowed in comment" << endl;
+    }
+    *writer << "<!--" << normalizeText(comment).c_str() << "-->" << endl;
+}
+
+void XMLWriter::printPlain(string text) {
+    *writer << text.c_str();
+}
+
+void XMLWriter::print(string text) {
+    *writer << normalizeText(text).c_str();
+}
+
+void XMLWriter::println(string text) {
+    print(text);
+    *writer << endl;
+}
+
+void XMLWriter::openTag(string name) {
+    checkNameValid(name);
+    if (openTags.empty() && dtdName.compare("") && dtdName.compare(name)) {
+        cerr << "XMLWriter::openTag(), First tag: '" << name << "' not equal to DTD id: '" << dtdName << "'" << endl;
+    }
+    *writer << "<" << name.c_str();
+    printAttributes(name.length());
+    *writer << ">" << endl;
+    writer->indent();
+    openTags.push(name);
+}
+
+void XMLWriter::closeTag() {
+    if (openTags.empty()) {
+        writer->close();
+        cerr << "XMLWriter::closeTag(), No open tags" << endl;
+    }
+    string name = openTags.top();
+    openTags.pop();
+    writer->outdent();
+    *writer << "</" << name.c_str() << ">" << endl;
+}
+
+void XMLWriter::printTag(string name) {
+    checkNameValid(name);
+    *writer << "<" << name.c_str();
+    printAttributes(name.length());
+    *writer << "/>" << endl;
+}
+
+void XMLWriter::setAttribute(string name, char* value) {
+    setAttribute(name, (string)value);
+}
+
+void XMLWriter::setAttribute(string name, string value) {
+    attributes[name] = value;
+    // NOTE: never set type here
+}
+
+void XMLWriter::setAttribute(std::string name, std::vector<double> value) {
+    if (name == "value") setAttribute("type", (std::string)"Color");
+    setAttribute(name, DefaultHepRepAttValue::getAsString(value));
+}
+
+void XMLWriter::setAttribute(std::string name, int64 value) {
+    if (name == "value") setAttribute("type", (std::string)"long");
+    setAttribute(name, DefaultHepRepAttValue::getAsString(value));
+}
+
+void XMLWriter::setAttribute(std::string name, int value) {
+    if (name == "showlabel") {
+        string label = DefaultHepRepAttValue::toShowLabel(value);
+        setAttribute("showlabel", label);
+    } else {
+        if (name == "value") setAttribute("type", (std::string)"int");
+        setAttribute(name, DefaultHepRepAttValue::getAsString(value));
+    }
+}
+
+void XMLWriter::setAttribute(std::string name, bool value) {
+    if (name == "value") setAttribute("type", (std::string)"boolean");
+    setAttribute(name, DefaultHepRepAttValue::getAsString(value));
+}
+
+void XMLWriter::setAttribute(string name, double value) {
+    if (name == "value") setAttribute("type", (std::string)"double");
+    setAttribute(name, DefaultHepRepAttValue::getAsString(value));
+}
+
+void XMLWriter::printAttributes(int tagLength) {
+	int width = tagLength + 1;
+	bool extraIndent = false;
+	for (map<string,string>::iterator i = attributes.begin(); i != attributes.end(); i++) {
+		string key = i->first;
+		checkNameValid(key);
+		string value = normalize(i->second);
+		int length = key.length() + value.length() + 3;
+		if (width > 0 && width + length + 2*writer->getIndent() > 60) {
+			width = 0;
+			*writer << endl;
+			if (!extraIndent) {
+				writer->indent();
+				extraIndent = true;
+			}
+		} else {
+			width += length;
+			*writer << " ";
+		}
+		*writer << key.c_str() << "=\"" << value.c_str() << "\"";
+	}
+	attributes.clear();
+	if (extraIndent) writer->outdent();
+}
+
+string XMLWriter::normalize(string s) {
+    string str = "";
+    char buffer[20];
+
+    int len = s.length();
+    for (int i = 0; i < len; i++) {
+        char ch = s[i];
+        switch (ch) {
+            case '<': {
+                str.append("&lt;");
+                break;
+            }
+            case '>': {
+                str.append("&gt;");
+                break;
+            }
+            case '&': {
+                str.append("&amp;");
+                break;
+            }
+            case '"': {
+                str.append("&quot;");
+                break;
+            }
+            case '\r':
+            case '\n': {
+                sprintf(buffer, "&#%ud", ch);
+                str.append(buffer);
+                str.append(";");
+                break;
+            }
+            default: {
+//                if (ch > 0x00FF) {
+//                    sprintf(buffer, "&#x%4.4x", ch);
+//                    str.append(buffer);
+//                    str.append(";");
+//                } else {
+                    str.append(&ch, 1);
+//                }
+            }
+        }
+    }
+
+    return str;
+}
+
+string XMLWriter::normalizeText(string s) {
+    string str = "";
+
+    int len = s.length();
+    for (int i = 0; i < len; i++) {
+        char ch = s[i];
+        switch (ch) {
+            case '<': {
+                str.append("&lt;");
+                break;
+            }
+            case '>': {
+                str.append("&gt;");
+                break;
+            }
+            case '&': {
+                str.append("&amp;");
+                break;
+            }
+            default: {
+//                if (ch > 0x00FF) {
+//                    sprintf(buffer, "&#x%4.4x", ch);
+//                    str.append(buffer);
+//                    str.append(";");
+//                } else {
+                    str.append(&ch, 1);
+//                }
+            }
+        }
+    }
+    return str;
+}
+
+void XMLWriter::checkNameValid(string) {
+// Could be added.
+//    if (!XMLCharacterProperties.validName(s)) throw new RuntimeException("Invalid name: "+s);
+}
+
+
+} // cheprep
Index: tags/visualization-10.5-before-10.6_test/HepRep/src/ZipOutputStream.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/src/ZipOutputStream.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/src/ZipOutputStream.cc	(revision 1102)
@@ -0,0 +1,44 @@
+// Copyright FreeHEP, 2005.
+
+#include <iostream>
+#include <ctime>
+#include <vector>
+
+#include "cheprep/ZipOutputStreamBuffer.h"
+#include "cheprep/ZipOutputStream.h"
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: ZipOutputStream.cc,v 1.9 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+    ZipOutputStream::ZipOutputStream(std::ostream& os) : std::ostream(0) {
+        buffer = new ZipOutputStreamBuffer(os.rdbuf());
+        
+        init(buffer);
+    }
+    
+    void ZipOutputStream::closeEntry() {
+        buffer->closeEntry();
+    }
+
+
+    void ZipOutputStream::close() {
+        buffer->close();
+    }
+
+    void ZipOutputStream::putNextEntry(const std::string& name, bool compress) {
+        buffer->putNextEntry(name, compress);
+    }
+
+    void ZipOutputStream::setComment(const std::string& comment ) {
+        buffer->setComment(comment);
+    }
+
+    ZipOutputStream::~ZipOutputStream() {
+        close();
+        delete buffer;
+    }
+
+} // cheprep
Index: tags/visualization-10.5-before-10.6_test/HepRep/src/ZipOutputStreamBuffer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/HepRep/src/ZipOutputStreamBuffer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/HepRep/src/ZipOutputStreamBuffer.cc	(revision 1102)
@@ -0,0 +1,144 @@
+// Copyright FreeHEP, 2005.
+
+#include <iostream>
+#include <ctime>
+#include <vector>
+
+#include "cheprep/ZipOutputStream.h"
+#include "cheprep/ZipOutputStreamBuffer.h"
+#include "cheprep/ZipEntry.h"
+
+/**
+ * @author Mark Donszelmann
+ * @version $Id: ZipOutputStreamBuffer.cc,v 1.9 2005/06/02 21:28:45 duns Exp $
+ */
+namespace cheprep {
+
+    ZipOutputStreamBuffer::ZipOutputStreamBuffer(std::streambuf* buffer)
+        : DeflateOutputStreamBuffer(buffer), 
+          comment("") {
+        
+        closed = false;
+        entry = NULL;
+        
+        entries = new std::vector<ZipEntry*>();
+    }
+
+    int ZipOutputStreamBuffer::overflow(int c) {
+        return DeflateOutputStreamBuffer::overflow(c);
+    }
+            
+    void ZipOutputStreamBuffer::closeEntry() {
+        if (closed) return;
+        if (entry == NULL) return;
+        
+        finish();
+                
+        entry->crc = getCRC();
+        // NOTE: pos()::operator- is ambiguous on gcc 4.0, so convert to long first
+        entry->csize = (long)pos() - entry->data;
+        entry->size = getSize();
+        putUI(EXTSIG);
+        putUI(entry->crc);            // crc
+        putUI(entry->csize);          // compressed size
+        putUI(entry->size);           // uncompressed size
+        entry = NULL;
+    }
+
+
+    void ZipOutputStreamBuffer::close() {
+        if (closed) return;
+        closeEntry();
+        
+        long dirStart = pos();
+        for (std::vector<ZipEntry*>::iterator i=entries->begin(); i != entries->end(); i++) {
+            entry = *i;
+            putUI(CENSIG);
+            putUS(VERSIONMADE);                   // made by version
+            putUS(VERSIONEXTRACT);                // extraction version
+            putUS(GENFLAG);                       // general purpose bit flag
+            putUS(entry->method);                 // compression method
+            putUS(entry->time);                   // time
+            putUS(entry->date);                   // date
+            putUI(entry->crc);                    // crc
+            putUI(entry->csize);                  // compressed size
+            putUI(entry->size);                   // uncompressed size
+            putUS(entry->name.length());          // file name length
+            putUS(0);                             // extra field length
+            putUS(0);                             // file comment length
+            putUS(0);                             // disk number start
+            putUS(0);                             // internal file attributes
+            putUI(0);                             // external file attributes
+            putUI(entry->offset);                 // relative offset of local file header
+            putS(entry->name);                    // file name
+            
+            // delete entry
+            delete entry;
+            entry = NULL;
+        }
+        // NOTE: pos()::operator- is ambiguous on gcc 4.0, so convert to long first
+        long dirSize = (long)pos() - dirStart;
+        putUI(ENDSIG);
+        putUS(0);                             // number of this disk
+        putUS(0);                             // number of the disk with the start of central directory
+        putUS(entries->size());               // total number of entries in the central directory of this disk
+        putUS(entries->size());               // total number of entries in the central directory
+        putUI(dirSize);                       // size of the central directory
+        putUI(dirStart);                      // offset of the start of central directory with respect to the starting disk number
+        putUS(comment.length());              // .ZIP file comment length
+        putS(comment);                        // .ZIP file comment
+        
+        delete entries;
+        entries = NULL;
+        closed = true;
+    }
+
+    void ZipOutputStreamBuffer::putNextEntry(const std::string& name, bool compress) {
+        if (closed) return;
+        
+        closeEntry();
+
+#ifdef CHEPREP_NO_ZLIB
+        compress = false;
+#endif
+        init(compress);
+
+        entry = new ZipEntry();
+        entries->push_back(entry);
+        
+        entry->name = name;
+        entry->method = compress ? 8 : 0;
+        
+        time_t ltime;
+        time( &ltime );
+        struct tm *utc = gmtime( &ltime );
+        entry->date = (utc->tm_year - 80) << 9 | (utc->tm_mon + 1) << 5 | utc->tm_mday;
+        entry->time = utc->tm_hour << 11 | utc->tm_min << 5 | utc->tm_sec >> 1;
+
+        entry->offset = (long)pos();
+        putUI(LOCSIG);                        // signature
+        putUS(VERSIONEXTRACT);                // extraction version
+        putUS(GENFLAG);                       // general purpose bit flag
+        putUS(entry->method);                 // compression method
+        putUS(entry->time);                   // time
+        putUS(entry->date);                   // date
+        putUI(0x00000000);                    // crc ATEND
+        putUI(0x00000000);                    // compressed size ATEND
+        putUI(0x00000000);                    // uncompressed size ATEND
+        putUS(entry->name.length());          // file name length
+        putUS(0);                             // extra field length
+        putS(entry->name);                    // file name
+        entry->data = (long)pos();
+        entry->crc = 0;
+    }
+            
+    void ZipOutputStreamBuffer::setComment(const std::string& c) {
+        if (closed) return;
+        comment = c;        
+    }
+
+    ZipOutputStreamBuffer::~ZipOutputStreamBuffer() {
+        close();
+    }
+
+} // cheprep
Index: tags/visualization-10.5-before-10.6_test/History
===================================================================
--- tags/visualization-10.5-before-10.6_test/History	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/History	(revision 1102)
@@ -0,0 +1,3018 @@
+$Id: History,v 1.442 2009/05/14 16:58:54 lgarnier Exp $
+-------------------------------------------------------------------
+
+     =========================================================
+     Geant4 - an Object-Oriented Toolkit for Simulation in HEP
+     =========================================================
+
+                      Category History file
+                      ---------------------
+This file should be used by G4 developers and category coordinators
+to briefly summarize all major modifications introduced in the code
+and keep track of all category-tags.
+It DOES NOT substitute the  CVS log-message one should put at every
+committal in the CVS repository !
+
+     *************************************************************
+     * Note that modeling and test have their own History files. *
+     *************************************************************
+
+     ----------------------------------------------------------
+     * Reverse chronological order (last date on top), please *
+     ----------------------------------------------------------
+
+History file for visualization category
+---------------------------------------
+
+14th May 2009  Laurent Garnier
+ - opengl-V09-02-04 Added /vis/ogl/set/printSize and /vis/ogl/set/printFilename
+
+13th May 2009  John Allison
+- visman-V09-02-02: Added /vis/viewer/set/targetPoint and minor
+  wording improvements.
+
+6 May 2009, Laurent Garnier
+ - G4OpenGLQtViewer.cc: Fix compilation warning and error with gcc4.4
+
+29 April 2009, John Allison (vis-V09-02-03)
+- visexternal-V09-02-04: Fix a circular dependency to G4OpenGL.
+
+28th April 2009, Laurent Garnier
+ - printEPS is now fully functionnal for X, Xm, Qt Win viewers.   
+
+27th April 2009  John Allison (vis-V09-02-02)
+- opengl-V09-02-03: Fix compiler warnings.
+- visexternal-V09-02-03: Fix compiler warnings.
+
+6th April 2009  Joseph Perl (vis-V09-02-01)
+- opengl-V09-02-02 : Improvments in order to use GL2PS for printing
+- openinventor-V09-02-01 : Improvments in order to use GL2PS for printing
+- visexternal-V09-02-02 :  Add GL2PS library in external (it was in 
+  OpenInventor before)
+
+14th March 2009  John Allison
+- visman-V09-02-01:
+  o Introduced /vis/initialize.
+  o G4VisManager.cc: /vis/verbose and /vis/initialize instantiated in
+    constructor so that a user may set verbosity before initialisation.
+  o G4VisExecutive.icc: made methods inline.
+
+5th March 2009, Laurent Garnier
+ - Now using Gl2PS method to do PS
+ - Add flag in GNUMakefile to compile in debug mode
+ - Remplacing glBitmap by GL_POINTS to draw marker : Speed improvment
+  and gl2ps can now draw Markers.
+
+25th February 2009  John Allison
+- modeling-V09-02-01 - needs greps-V09-02-01:
+  o G4ModelApplyCommandsT: Added visManager->NotifyHandlers() after
+    application (Apply) of all commands.  Forces update of all viewers
+    after a change of model, e.g., trajectory colour, point size, etc.
+- visman-V09-02-00 - needs greps-V09-02-01:
+  o G4VisManager: Implemented NotifyHandlers.  A user may notify scene
+    handlers (G4VGraphicsScene objects) that the scene has changed so
+    that they may rebuild their graphics database, if any, and redraw
+    all views.
+
+24th February 2009  John Allison
+- modeling-V09-02-00 - needs greps-V09-02-00:
+  o Added setAux/StepPtsSizeType commands (candidates: "none world screen").
+  o Added unit to setAux/StepPtsSize for SizeType == world.
+
+16 February 2009, Laurent Garnier
+ - Creation of this gl2ps library in order to have a gl2ps for all viewers.
+ - GNUMakefile : Add the gl2ps external library
+ - Some modifications in GNUMakefile for gl2ps. Packages OpenInventor,
+   OpenGL had also been modified for gl2ps.
+
+22th January 2009  Laurent Garnier
+- Fix bug in ratio and geometry on X/Xm/Qt/Win32 viewers. Now Could 
+  pass XString like 400x600-0+0 to viewers and set position and location.
+
+21st November 2008  Joseph Perl  (vis-V09-01-06)
+- visman-V09-01-05: Trap recursive use of /vis/reviewKeptEvents.
+- modeling-V09-01-01: Improve message.
+- opengl-V09-01-03: Many changes to add Qt support.
+
+30th April 2008  John Allison  (vis-V09-01-05)
+- visman-V09-01-04: Fixes more gcc-4.3.0 compiler warnings.
+- openinventor-V09-01-01: Fixes more gcc-4.3.0 compiler warnings.
+
+28th April 2008  John Allison  (vis-V09-01-04)
+- visman-V09-01-03: Cosmetic improvements.
+- opengl-V09-01-02: Tidied.
+
+4th April 2008  John Allison  (vis-V09-01-03, needs greps-V09-01-03)
+- Back on HEAD.  Contains vis-V09-01-00.
+- visman-V09-01-02: Fixed gcc-4.3.0 compiler warnings.
+- opengl-V09-01-01:
+  o Fixed gcc-4.3.0 compiler warnings.
+  o Fixed DBL_MAX problem in 2D drawing.
+  o A lot of Qt development.
+- openinventor-V09-01-00): Fixed most gcc-4.3.0 compiler warnings.
+- raytracer-V09-01-00): Fixed gcc-4.3.0 compiler warnings.
+- vistest-V09-01-01: Zero thickness of box for 2D drawing.
+
+30th January 2008  John Allison  (vis-V09-01-02)
+- Bug fix tag (re-instated G4DAWNFILE) on branch vis-V09-00-03-branch.
+- DOES NOT CONTAIN vis-V09-01-00 STUFF.
+
+29th January 2008  John Allison  (vis-V09-01-01)
+- visman-V09-01-01: Re-instated G4DAWNFILE (somehow got lost!!)
+
+4th January 2008  John Allison  (vis-V09-01-00 with greps-V09-01-00)
+- Draw2D capability, already available for G4Text, extended to:
+  G4Circle, G4Polyhedron, G4Polyline, G4Polymarker, G4Square.
+  o modeling-V09-01-00: Adapted to new BeginPrimitives2D signature.
+  o visman-V09-01-00: Implemented extended 2D interface.
+  o opengl-V09-01-00: Implemented extended 2D interface.
+  o vis-HepRep-V09-01-00: Adapted to new BeginPrimitives2D signature.
+  o vistest-V09-01-00: MyEventAction: Added 2D polyhedron.
+
+19th November 2007 Joseph Perl  (vis-V09-00-03)
+- visman-V09-00-02: Replace references to Wired3 in command guidance
+- vis-HepRep-V09-00-01: Adjust geometry hierarchy for parallel worlds.
+- opengl-V09-00-04: Added GEANT4_QT_DEBUG flag to more places
+
+13th November 2007  John Allison  (vis-V09-00-02)
+- Removed OpenGL Qt files from tag.  File are still at head - need fixing.
+
+10th November 2007  John Allison  (vis-V09-00-01)
+- opengl-V09-00-01: Minor improvements in design and messaging.
+- modeling-V09-00-00: Minor improvements in messaging.
+- visman-V09-00-01:Minor improvement in messaging.
+
+10th July 2007  John Allison  (vis-V09-00-00)
+- visman-V09-00-00: Remove redundant method declarations and minor tidies.
+
+14th June 2007  John Allison  (vis-V08-03-07)
+- raytracer-V08-03-01: Fixed memory leak in G4RayTracer.
+
+30th May 2007  John Allison  (vis-V08-03-06)
+- modeling-V08-03-02: Fixed gcc-4.2.0 warning.
+
+30th May 2007  John Allison  (vis-V08-03-05)
+- modeling-V08-03-01: Fix for SUN.
+
+25th May 2007  John Allison  (vis-V08-03-04)
+- opengl-V08-03-03: Fixed gcc-4.1.2 compiler warnings.
+
+25th May 2007  John Allison  (vis-V08-03-03)
+- visman-V08-03-01: Improved error trapping and big fix.
+- opengl-V08-03-02: Improved error trapping.
+
+24th May 2007  John Allison  (vis-V08-03-02)
+- opengl-V08-03-01: Fixes for SUN.
+
+22nd May 2007  John Allison  (vis-V08-03-01)
+- modeling-V08-03-00: Simplified G4Atts for Physical Volume Path.
+- vis-HepRep-V08-03-00: Fixed memory leak in G4HepRepFile.
+- raytracer-V08-03-00: Fixed for dubious ValGrind diagnostic.
+
+16th May 2007  John Allison  (vis-V08-03-00)
+- visman-V08-03-00: Fix for Windows compiler.
+- opengl-V08-03-00: Fix compiler warnings and bug fixes in opengl-V08-02-06.
+
+8th May 2007  John Allison
+- opengl-V08-02-06: /vis/ogl/printEPS should work for all viewers.
+
+4th April 2007  John Allison  (vis-V08-02-04)
+- visman-V08-02-04: Bug fix for zero pointer in G4VscenHamdler::LoadAtts.
+- opengl-V08-02-05: Implemented picking for OGLSX (as well as OGLIX).
+
+3rd April 2007  John Allison  (vis-V08-02-03)
+- modeling-V08-02-02: Added further information on volume G4Atts.
+- visman-V08-02-03: Added /vis/viewer/set/picking.  Picking is "false"
+  by default, except for Open Inventor.
+- opengl-V08-02-04:
+  o Implemented picking for OGLIX.
+  o Some reorganisation of display list construction to fix rare bug\
+    in Display-by-Time feature
+- openinventor-V08-02-02: Picking is "true" by default for OI.
+
+25th March 2007  John Allison  (vis-V08-02-02)
+-  modeling-V08-02-01: Added solid dump and volume transformation to G4Atts.
+- visman-V08-02-02:
+  o Removed G4GAGTree.
+  o Removed /vis/scene/add/eventID (once again) from /vis/drawVolume.
+- opengl-V08-02-03: Fix compiler warnings.
+- vistree-V08-02-01: Removed GAGTree.
+- openinventor-V08-02-01): Added scale factor to list of changes
+  requiring kernel visit, and some rationalisation.
+
+11th January 2007  John Allison  (vis-V08-02-01)
+- visman-V08-02-01:
+  o Added /vis/abortReviewKeptEvents.
+  o /vis/reviewKeptEvents: Improved guidance.
+  o Bug fix: /vis/open in /vis/reviewKeptEvents loop.
+  o Reduced WARNING noise.
+
+9th January 2007  John Allison
+- opengl-V08-02-01:
+  o Implemented bitmap markers (for MarkerSizeType == screen).
+  o Bug fix: Added missing break in X colormap lookup routine.
+
+5th January 2007  John Allison  (vis-V08-02-00 - needs greps-V08-02-00)
+- modeling-V08-02-00 (needs greps-V08-02-00):
+  o Bug fix: Correct treatment of ForcedLineSegmentsPerCircle when clipping.
+- visman-V08-02-00:
+  o G4VSceneHandler:
+    ~ Introduced utility LoadAtts for G4AttValues and G4AttDefs.
+    ~ Improved other utilities (changed signature of GetLineWidth).
+  o Introduced /vis/geometry/set/forceLineSegmentsPerCircle.
+  o Re-introduced /vis/scene/add/eventID into /vis/drawVolume (removed
+    in visman-V08-01-16 for release 8.2).
+  o Other minor improvements.
+- opengl-V08-02-00:
+  o Followed change of signature of GetLineWidth in visman-V08-02-00.
+- openinventor-V08-02-00: Moved LoadAtts to vis management.
+- raytracer-V08-02-00: Bug fix: use of window size hints.
+- vistree-V08-02-00: Bug fix: Format of total mass.
+- vistest-V08-02-00: test19.cc: Refined usage.
+
+12th December 2006  Gabriele Cosmo
+- visman-V08-01-16: Commented command "vis/scene/add/eventID" forcing
+  event ID to scene in G4VisCommandsCompound.cc.
+
+11th December 2006  John Allison
+- Tree: Trapped sequential G4PVPlacements.
+
+25th November 2006  John Allison  (vis-V08-01-17)
+- visman-V08-01-15: Follow change of behaviour of G4StateManager and
+  minor message corrections.
+
+22nd November 2006  John Allison  (vis-V08-01-16)
+- visman-V08-01-14: Fixed /vis/reviewKeptEvents for "stored" viewers.
+
+21st November 2006  John Allison  (vis-V08-01-15)
+- visman-V08-01-13:
+  o Fixed double drawing of event.
+  o Restored old verbosity and printing interface (for obsolete user vis
+    managers).
+  o Fixed compiler warnings.
+- opengl-V08-01-09: Fixed compiler warnings.
+
+17th November 2006  Joseph Perl (vis-V08-01-14)
+- vis-HepRep-V08-01-04:
+  o Omit Pos and Aux attributes for hits.
+  o Protect against null Region (as in parallel geometries).
+- raytracer-V08-01-02
+  o Deprecate /vis/rayTracer/backgroundColour.
+
+16th November 2006  John Allison
+- modeling-V08-01-15: More protection for parallel worlds.
+- visman-V08-01-12:
+  o /vis/scene/notifyHandlers: Refreshes only auto-refresh viewers.
+    (Warning of scene change issued for other viewers.)
+
+15th November 2006  John Allison  (vis-V08-01-13)
+- visman-V08-01-11: First implementation of /vis/reviewKeptEvents.
+
+14th November 2006  Joseph Perl
+- vis-HepRep-V08-01-03: Improve handling of Trajectory Points.
+
+14th November 2006  John Allison  (vis-V08-01-12)
+- modeling-V08-01-14: Merged modeling-V08-01-13-branch onto main branch:
+  o Added G4Event pointer to modeling parameters.
+- visman-V08-01-10: Merged visman-V08-01-08-branch onto main branch:
+  o Visualisation of parallel worlds.
+  o Event refreshing (events are re-drawn on change or refresh of viewer).
+- raytracer-V08-01-01: Merged raytracer-V08-01-00-branch onto main branch:
+  o Followed change to G4Scene.
+- vistest-V08-01-05: Added G4EllipticalCone.
+
+13 November 2006 Joseph Perl
+- vis-HepRep-V08-01-02: Corrected handling of Hits that come via AddSolids.
+
+5th November 2006  John Allison  (vis-V08-01-11)
+- modeling-V08-01-13: Further, hopefully, complete, protection against
+  zero materials pointer.
+- vis-HepRep-V08-01-01, openinventor-V08-01-04, vistree-V08-01-02,
+  visXXX-V08-01-06: Protected against zero material pointer.
+- visman-V08-01-09: Tidy warning messages.
+
+3rd November 2006  John Allison
+- modeling-V08-01-12: Protected against zero material pointer.
+
+-----------------------------------------------
+3rd November 2006  John Allison  (vis-V08-01-10)
+- Needs greps-V08-01-10 for bug fix in G4Visible.
+- Needs tracking-V08-01-05 for new storeTrajectory command.
+- Committed tracking-V08-01-05.  Now required by vis. 
+  o Augmented /tracking/storeTrajectory.  Now takes integer parameter:
+    0 : Don't Store trajectories.
+    !=0 : Store trajectories.
+    1 : Choose G4Trajectory as default.
+    2 : Choose G4SmoothTrajectory as default.
+    3 : Choose G4RichTrajectory as default.
+  o All trajectories:
+    ~ Protect points container pointer in destructor.
+    ~ Make G4AttDef descriptions more concise.
+  o G4RichTrajectory:
+    ~ Bug fix: Create G4AttValues for user-defined creator process.
+  o G4VTrajectory: Improved ShowTrajectory.
+- visman-V08-01-08: Activated /vis/scene/add/trajectories with "rich" and
+  "smooth".  Needs tracking-V08-01-05.
+- modeling-V08-01-11: Improved protections.
+- vistest-V08-01-04: Removed MyTrackingAction (use storeTrajectory instead.)
+
+2nd November 2006  John Allison
+- modeling-V08-01-10: G4HitsModel: Added GetCurrentHit.
+- openinventor-V08-01-03: Extended picking to hits.
+
+-------------------------------------------------------------------------
+1st November 2006  John Allison  (vis-V08-01-09; co-works greps-V08-01-09)
+- modeling-V08-01-09: Minor rationalisation.
+- visman-V08-01-07:
+  o /vis/scene/add/trajectories: Allow string parameters "rich" and "smooth".
+    (Not yet activated - awaiting tags in tracking.)
+- openinventor-V08-01-02:
+  o Follow changes to greps-V08-01-09: G4AttCheck/Holder rationalisation.
+- vis-HepRep-V08-01-00: Minor rationalisation.
+- opengl-V08-01-08: Replace /vis/oglx/set/printEPS by /vis/oglx/printEPS.
+- vistree-V08-01-01: ASCIITree: Added printing of material name.
+- vistest-V08-01-03: Added G4Polycone and some G4Atts to an event action box.
+
+26th October 2006  John Allison
+- openinventor-V08-01-01:
+  o Print G4AttValues of solids and trajectories on picking.
+- modeling-V08-01-08: Cosmetics.
+
+-------------------------------------------------------------------------
+24th October 2006  John Allison  (vis-V08-01-08; co-works greps-V08-01-08)
+- opengl-V08-01-07:
+  o Calculate light front horizon properly.
+  o Improve refresh behaviour for /vis/opengl commands.
+- visXXX-V08-01-04; co-works greps-V08-01-08:
+  o Follow change to G4VisAttributes in greps-V08-01-08.
+
+-------------------------------------------------
+19th September 2006  John Allison  (vis-V08-01-07)
+- modeling-V08-01-07:
+  o G4ModelingParameters: Added ExplodeCentre
+  o Fix for Mac XCode 2.0 problem.
+- visman-V08-01-06:
+  o G4ViewParameters: Added ExplodeCentre.
+  o Bug fix in /vis/geometry/set/colour.
+- opengl-V08-01-06: Improved display-by-time feature.
+
+---------------------------------------------------------------------------
+15th September 2006  John Allison  (vis-V08-01-06 - coworks greps-V08-01-04)
+- modeling-V08-01-06
+  o Implemented explode factor(radial move) feature for top level drawn
+    volumes.  John Allison
+  o Add attribute based trajectory drawing & filtering, and attribute
+    based hit filtering.  Jane Tinsley
+- visman-V08-01-05
+  o Added /vis/viewer/clone and /vis/viewer/set/explodeFactor.  John Allison
+  o Add attribute based trajectory drawing & filtering, and attribute
+    based hit filtering.  Jane Tinsley
+
+13th September 2006  John Allison
+- visXXX-V08-01-03: Improved G4Att printing and checking.
+
+4th September 2006  John Allison
+- visman-V08-01-04: Added commands for cutaways.
+- opengl-V08-01-05: Implemented cutaways.
+
+----------------------------------------------
+30th August 2006  John Allison  (vis-V08-01-05)
+- modeling-V08-01-05:
+  o Implemented code for augmented /vis/scene/add/volume (subtraction
+    *and* intersection of clipping volume).
+  o Equipped for generic sectioning (DCUT) and cutaways.
+  o Improved DrawWithTime.
+- visman-V08-01-03:
+  o Added /vis/viewer/set/globalLineWidthScale.
+  o Augmented /vis/scene/add/volume to include intersection of clipping volume.
+  o Added G4VSceneHandler::CreateSection/CutawayPolyhedron to exploit generic
+    sectioning (DCUT) and cutaways.  Currently not activated due to
+    instabilities in BooleanProcessor.
+- opengl-V08-01-04:
+  o Implemented line width.
+  o Switched off back face culling when clipping so that the inside of
+    volumes can be seen.
+  o Added position and colour to /vis/ogl/set/displayHeadTime.
+  o Added /vis/ogl/set/displayLightFront.
+  
+29th August 2006  John Allison
+- openinventor-V08-01-00: Kernel visit rationalisation.
+- visXXX-V08-01-02: Minor tidying.
+
+-------------------------------------------------------------------------
+26th August 2006  John Allison  (vis-V08-01-04 - requires greps-V08-01-03)
+- modeling-V08-01-04:
+  o Fixed compilation warning.
+  o Follow G4VFilter const change.
+
+16th August 2006  John Allison
+- modeling-V08-01-03: Improved robustness of time slicing.
+
+----------------------------------------------
+16th August 2006  John Allison  (vis-V08-01-03)
+- opengl-V08-01-03:
+  o Fixed Solaris compilation problem.
+  o Added /vis/ogl/set/fade and displayHeadTime.
+
+-----------------------------------------------
+14th August 2006  John Allison  (vis-V08-01-02)
+- modeling-V08-01-02: Added trajectory time slicing.
+- visman-V08-01-02: Friendship extended to new OpenGL messengers.
+- opengl-V08-01-02:
+  o Implemented display-by-time.
+  o Added /vis/ogl/set/startTime and endTime.
+- raytracer-V08-01-00: Improved robustness under vis manager control.
+- vistest-V08-01-02: Added MyTrackingAction - uses G4RichTrajectory.
+
+17th July 2006  John Allison
+- opengl-V08-01-01: Added /vis/oglx/set/printEPS.
+
+---------------------------------------------
+10th July 2006  John Allison  (vis-V08-01-01)
+- Co-works with greps-V08-01-01.
+- modeling-V08-01-01:
+  o Rationalised G4VModel and G4ModelingParameters.
+  o G4PhysicalVolumeModel:
+    ^ Removed Establish/DecommissionSpecials to conform with
+      greps-V08-01-01.
+    ^ Rationalised G4Atts: Added GetAttDefs/CreateAttValues.
+- visman-V08-01-01:
+  o Removed Establish/DecommissionSpecials to conform with greps-V08-01-01.
+  o Respect rationalised G4ModelingParameters.
+  o Added GetNoOfSides that respects forced line segments per circle.
+- G4VisCommandsScene.cc: Spelling correction.
+- DAWN-V08-01-00: Respects forced line segments per circle.
+- visXXX-V08-01-01: Gets solid's G4Atts created by G4PhysicalVolumeModel.
+- vistest-V08-01-01: SetForceLineSegmentsPerCircle(100) for G4Sphere.
+
+--------------------------------------------------------------------
+3rd July 2006  John Allison  (vis-V08-01-00 - needs greps-V08-01-00)
+- modeling-V08-01-00: Added G4Atts for solids.  (Needs greps-V08-01-00.)
+- visman-V08-01-00:
+  o /vis/scene/transientsAction: Added max number of events parameter.
+  o Added /vis/viewer/clearTransients.
+  o Improved /vis/list.
+  o (Commented out) code for event copying.
+- opengl-V08-01-00:
+  o Eliminated redundant variable, doublebuffer.
+  o Implemented FinishView in all viewers.
+- vistree-V08-01-00: ASCIITree: Layout improvement.
+- visXXX-V08-01-00: General tidy and improvement to XXXFile.
+- vistest-V08-01-00: Protect against zero run manager pointer.
+
+---------------------------------------------
+12th June 2006  John Allison  (vis-V08-00-13)
+- DAWN-V08-00-04: Fixed rewind and file closure on exit.
+- VRML-V08-00-02: Fixed rewind and file closure on exit.
+
+------------------------------------------
+8th June 2006 John Allison (vis-V08-00-12)
+- visman-V08-00-23: Fixed bug in /vis/scene/endOfRunAction.
+
+-------------------------------------------
+7th June 2006  John Allison (vis-V08-00-11)
+- modeling-V08-00-14: Added protection for zero vis atts.
+- visman-V08-00-22: Zeroed modeling parameters pointer after use.
+
+-------------------------------------------
+6th June 2006  John Allison (vis-V08-00-10)
+- modeling-V08-00-13: Fixes for Sun and bug fix in G4PhysicalVolumeModel.
+- visman-V08-00-21: /vis/viewer/create: Fixed view params copy to self.
+
+------------------------------------------
+4th June 2005  Joseph Perl (vis-V08-00-09)
+- Global tag for Geant4 release 8.1
+- Corresponds to the following subdirectory tags:
+- DAWN-V08-00-03
+- vis-HepRep-V08-00-04
+- visman-V08-00-20
+- modeling-V08-00-12
+- opengl-V08-00-08
+- openinventor-V08-00-05
+- raytracer-V08-00-04
+- vistest-V08-00-08
+- vistree-V08-00-04
+- VRML-V08-00-01
+- visXXX-V08-00-04
+
+2nd June 2006  Joseph Perl
+- vis-HepRep-V08-00-03: Improvements to HepRepFile.
+
+2nd June 2006  John Allison
+- DAWN-V08-00-03: Handle file closing in DAWNFILE destructor.
+- VRML-V08-00-01: Protect zero model pointer.
+
+30th May 2006  Joseph Perl
+- opengl-V08-00-08: Fixed buffering problem in Win32.
+
+--------------------------------------------
+25th May 2006  John Allison  (vis-V08-00-08)
+- visman-V08-00-19:
+  o Changed re-computation of transients default to "off".
+  o Indent printing of models plus other minor improvements.
+- modeling-V08-00-11: Indent printing of models, fix trivial compiler warnings.
+- vistest-V08-00-07: Removed standalone - moved to
+  examples/extended/visualization.
+
+22nd May 2006  John Allison
+- modeling-V08-00-10:
+  o Remove dependency on Run.
+  o Protect zero pointer in output of G4ModelingParameters.
+- visman-V08-00-18:
+  o Remove G4Scene:Clear().  (Not used.)
+  o Require Idle state for transient re-computation.
+  o Reduce dependency on Run.  (Still used for transient re-computation.)
+  o /vis/.../list commands: Default verbosity changed to "warnings".
+- vis-HepRep-V08-00-02: Remove dependency on Run.
+
+--------------------------------------------
+12th May 2006  John Allison  (vis-V08-00-07)
+- Needs run-V08-00-02 and event-V08-00-03.
+- Main features:
+  o Protect against non-instantiation of run manager.
+  o Final refinements for re-computation of transients.
+  o G4OpenGLWin32Viewer: Fixed buffer swapping behaviour.
+- visman-V08-00-16:
+  o Added /vis/list and /vis/scene/add/eventID.
+  o Final refinements for event/run reprocessing (re-computation of
+    transients).
+- modeling-V08-00-09:
+  o Removed dependency on G4RunManager.
+  o G4CallbackModel: Added G4VGraphicsScene argument to operator().
+- opengl-V08-00-06: G4OpenGLWin32Viewer: Fixed buffer swapping behaviour.
+- raytracer-V08-00-04: SetRecomputeTransients(false).
+- raytracer-V08-00-03: Moved G4RayShooter class to Event category.
+- vistest-V08-00-06: Uses /vis/scene/add/eventID.
+
+----------------------------------------------
+21st April 2006  John Allison  (vis-V08-00-06)
+- Main features:
+  o Improved protection for null models and parameters.
+  o Improved trajectory drawing.
+  o Improved re-computation of transients in OpenGL.
+- modeling-V08-00-08:
+  o Improved protection for null models and parameters.
+  o Add context to trajectory drawers.
+  o Add generic drawer, G4TrajectoryGenericDrawer.
+- visman-V08-00-15: Improved protection for null models and parameters.
+- DAWN-V08-00-02: Improved protection for null models and parameters.
+- vis-HepRep-V08-00-01: Improved protection for null models and parameters.
+- raytracer-V08-00-02): 
+  o Relies on improved protection for null models and parameters.
+- vistree-V08-00-04: Improved protection for null models and parameters.
+- visXXX-V08-00-04: Improved protection for null models and parameters.
+- vistest-V08-00-05: Tidied.
+
+28th April 2006  John Allison
+- Co-working tags:
+  o opengl-V08-00-05: Fixes re-computation of transients in stored viewers.
+  o visman-V08-00-14: Includes changes that improve behaviour of
+    double buffered and interactive viewers when recomputing
+    transients.
+
+----------------------------------------------
+24th April 2006  John Allison  (vis-V08-00-05)
+- visman-V08-00-13:
+  o Fix bug #861.
+  o Print available models on initialisation.
+- modeling-V08-00-07:
+  o Add Print method to G4VModelFactory.
+  o Fix warnings on Linux.
+- opengl-V08-00-04: Fixed compilation problem on Windows.
+
+---------------------------------------------------------------------
+19th April 2006  John Allison (vis-V08-00-04 - needs greps-V08-00-02)
+- Main features:
+  o Implementation of 2D text in base classes and concrete implementation
+    of same in OpenGL.
+  o Continued migration to direct access to G4PhysicalVolumeModel.
+  o Addition of Trajectory Filter Models (Jane Tinslay).
+- visman-V08-00-12 (needs greps-V08-00-02):
+  o Implemented Draw2D(const G4Text&).
+  o Implemented Begin/EndPrimitives2D.
+  o Migrated to direct access to G4PhysicalVolumeModel.
+  o Introduced G4VisFilterManager.hh to manager filtering
+- modeling-V08-00-06:
+  o Upgrade to greps-V08-00-02 and minor improvements.
+  o Added G4TrajectoryFilterFactories and G4TrajectoryParticleFilter
+- DAWN-V08-00-01: Migrated to direct access to G4PhysicalVolumeModel.
+- vis-HepRep-V08-00-00: Migrated to direct access to G4PhysicalVolumeModel.
+- opengl-V08-00-03:
+  o Implemented Begin/EndPrimitives2D.
+  o Migrated to direct access to G4PhysicalVolumeModel.
+- vistree-V08-00-03:
+  o G4GAGTreeSceneHandler: Migration to direct access to G4PhysicalVolumeModel.
+- visXXX-V08-00-03: Improvement of legibility.
+- openinventor-V08-00-04: Use cmath instead of math.h.
+- vistest-V08-00-04: Added drawing of 2D text.
+
+----------------------------------------------
+28th March 2006  John Allison  (vis-V08-00-03)
+- visman-V08-00-11:
+  o Introduces trajectory drawing manager.
+  o G4VisExecutive: Adds G4TrajectoryDrawByOriginVolumeFactory.
+  o Corrects logic of transients re-computation:
+  o Unifies treatment of bools in commands.
+- modeling-V08-00-05:
+  o Introduces G4TrajectoryDrawByOriginVolume.
+  o Part migration away from EstablishSpecials mechanism.
+- vistree-V08-00-02 (needs modeling-V08-00-05):
+  o Made compatible with modeling-V08-00-05. 
+  o Migration away from EstablishSpecials mechanism.
+- openinventor-V08-00-03: Much improvement in logic.
+- visXXX-V08-00-02: Added G4XXXFile, G4XXXStored, G4XXXSG.
+- vistest-V08-00-03: Modernised and improved.
+
+----------------------------------------------
+14th March 2006  John Allison  (vis-V08-00-02)
+- opengl-V08-00-02: Refinement of display list handling.
+- vistree-V08-00-01: G4VTree and G4ASCIITree: Minor improvements to
+  readability of code.
+- modeling-V08-00-04: Added output operator<< for PVNodeID.
+
+13th March 2006  John Allison
+- visman-V08-00-10: Fixes recomputation of transients when changing drivers.
+
+---------------------------------------------
+8th March 2006  John Allison  (vis-V08-00-01)
+- visman-V08-00-09: Small bug fix to vis-V08-00-00.
+
+6th March 2006  John Allison  (vis-V08-00-00)
+- Collected tags below.  Main features since Release 8.0:
+  o Added /vis/scene/transientsAction.  The default is "rerun", i.e.,
+    when the viewer requests, the previous event or run will be
+    processed again with the original random number seed so that
+    transients (trajectories, hits, user drawing, etc.) are
+    reconstructed.  Thus, transients are "remembered" and may be
+    copied between graphics systems.  Turn off with
+    "/vis/scene/transientsAction none".
+  o Introduced /vis/geometry/... for editing vis attributes of
+    geometry volumes.
+  o For developers:
+    * Migration from use of Establish/DecommisionSpecials.
+    * Drawn path available.
+
+6th March 2006  John Allison
+- visman-V08-00-08: Added /vis/scene/transientsAction.
+
+3rd March 2006  John Allison
+- vistest-V08-00-02: Added test of transient handling.
+
+16th February 2006  John Allison
+- modeling-V08-00-03: For future removal of Establish/DecommisionSpecials.
+
+9th February 2006  John Allison
+- visman-V08-00-07: First implementation of refresh end-of-event.
+
+8th February 2006  John Allison
+- modeling-V08-00-02: Added DrawingStyle to G4ModelingParameters and fixed
+  bug in culling of covered daughters
+- visman-V08-00-06 (needs modeling-V08-00-02): Made use of
+  G4ModelingParameters::DrawingStyle.
+- vistree-V08-00-00: Fixed bug in treatment of repeated replicas.
+- visXXX-V08-00-01: Improved handling of DrawnPVPath.
+
+3rd February 2006  John Allison
+- visman-V08-00-05: Introduced /vis/geometry/...
+
+30th January 2006  John Allison
+- openinventor-V08-00-01: Implemented drawn volume path.
+
+26th January 2006  John Allison
+- raytracer-V08-00-01: Minor improvements.
+- vistest-V08-00-01: Improved ray tracer; commented about voxelisation crash.
+- modeling-V08-00-01: G4PhysicalVolumeModel: Added drawn volume path
+  capability.
+- visXXX-V08-00-00: Uses drawn volume path.  Needs modeling-V08-00-01
+  and visman-V08-00-04.
+- 3 co-working tags due to removal of fModified:
+  o visman-V08-00-04: Removed fModified plus minor improvements.
+  o opengl-V08-00-01: Removed fModified plus tidying.
+  o openinventor-V08-00-00: Removed fModified.
+
+----------------------------------------------------------------------
+The tags below since Release 8.0 were collected in geant4-08-00-ref-01
+and geant4-08-00-ref-02.
+
+23rd January 2006  John Allison
+- DAWN-V08-00-00: Rewind output file in ClearView.  Avoids duplicate
+  geometries in output file.
+- VRML-V08-00-00: As above.
+
+11th January 2006  John Allison
+- vistest-V08-00-00: Added twisted solids and improved Perspective example.
+- visman-V08-00-02: Minor improvements.
+- raytracer-V08-00-00: Reorganisation (needs visman-V08-00-02).
+- opengl-V08-00-00: Improved efficiency; made G4OpenGLXmViewerMessenger smart.
+- modeling-V08-00-00: Changed last remaining G4Transform3D::Identity to
+  G4Transform3D().
+
+9th January 2006  John Allison
+- visman-V08-00-00: geant4-08-00-ref-00 + reversal of change of 22nd
+  November 2005: fMarkForClearingTransientStore(true) initially now.
+- visman-V08-00-01: Improved /vis/scene/notifyHandlers, improved warning
+  messages and some bug fixes, including visman-V08-00-00.
+
+----------------------------------------------
+4th December 2005  Joseph Perl (vis-V07-01-10)
+- Global tag for Geant4 release 8.0
+- Corresponds to the following subdirectory tags:
+- externals: geant4-07-01-ref-05
+- FukuiRenderer: geant4-07-01-ref-05
+- HepRep: geant4-07-01-ref-05
+- management: visman-V07-01-10
+- modeling: modeling-V07-01-07
+- OpenGL: opengl-V07-01-09
+- OpenInventor: openinventor-V07-01-04
+- RayTracer: raytracer-V07-01-08
+- test: vistest-V07-01-04
+- Tree: vistree-V07-01-01
+- VRML: geant4-07-01-ref-05
+- XXX: visXXX-V07-01-02
+
+29th November 2005  Jane Tinslay (vis-V07-01-09)
+- Make G4VisManager::RegisterModelFactories() non-pure for 
+  backwards compatibility.
+- Add information message to G4VisManager::DispatchToModel
+  when default trajectory model is used.
+- Removed names of unused paramaters to stop compiler warnings:
+  G4VModelCommand.hh, G4ModelCommandsDrawByCharge.cc,
+  G4ModelCommandsDrawByParticleID.cc, G4VRTScanner.hh
+
+25th November 2005  Joseph Perl (vis-V07-01-08)
+- Global tag for Geant4 release 8.0
+- Corresponds to the following subdirectory tags:
+- externals: geant4-07-01-ref-05
+- FukuiRenderer: geant4-07-01-ref-05
+- HepRep: geant4-07-01-ref-05
+- management: visman-V07-01-09
+- modeling: modeling-V07-01-05
+- OpenGL: opengl-V07-01-09
+- OpenInventor: openinventor-V07-01-03
+- RayTracer: raytracer-V07-01-06
+- test: vistest-V07-01-04
+- Tree: vistree-V07-01-01
+- VRML: geant4-07-01-ref-05
+- XXX: visXXX-V07-01-02
+
+22nd November 2005  John Allison
+- vistest-V07-01-04: Added G4Tet and PerspectiveVisAction. Refined G4Polyhedra.
+- opengl-V07-01-08: Added G4OpenGLXmViewerMessenger. Corrected text position.
+- vistree-V07-01-01: Refined guidance and printing.
+- visXXX-V07-01-02: Simplified guidance.
+- modeling-V07-01-03: Implemented radial replicas for G4Tubs.
+
+18th November 2005  John Allison
+- raytracer-V07-01-06: merged developments to the head, including RayTracerX.
+
+18th November 2005  Joseph Perl  (vis-V07-01-07)
+- Minor modification of geant4-07-01-ref-05 to facilitate acceptance
+  of greps-V07-01-09 and tracking tracking-V07-01-02.  As with
+  vis-V07-01-06, it should subsequently simply be ignored.
+
+15th November 2005  Guy Barrand
+- openinventor-V07-01-03: Background, scaling and window positioning.  Also
+  reading and wroting of .iv files.
+
+14th November 2005  John Allison (vis-V07-01-06)
+- Minor modification of vis-V07-01-03 + vis-HepRep-V07-01-04 (to avoid
+  warnings on Sun), i.e., it excludes all development since then. This
+  tag is purely to facilitate acceptance of greps-V07-01-09.  To
+  achieve this, the modification was made on a branch -
+  vis-V07-01-03-branch - of just one file, namely G4VisManager.hh.
+  This should subsequently simply be ignored.
+
+13th November 2005  John Allison
+- visman-V07-01-08: Added XGeometryString and background opacity parameter.
+- opengl-V07-01-07: Implemented window placing (XGeometryString) in OGL*X.
+
+24th October 2005  John Allison
+- modeling-V07-01-02: Added trajectory models.
+- visman-V07-01-07: Added methods for managing trajectory models.
+
+20th October 2005  Joseph Perl (vis-V07-01-05)
+- New Global Vis Tag.
+- Includes head of everything except RayTracer and OpenInventor.
+- Requires geant4-07-01-ref-03 plus the following:
+- graphics_reps: greps-V07-01-06
+- intercoms: intercoms-V07-01-01
+- event: event-V07-01-0
+- run: run-V07-01-02
+
+13th October 2005  John Allison (vis-V07-01-04)
+- Implemented non-uniform scaling in management and OpenGL.
+- Implemented arbitrary background in management, OpenGL and RayTracer.
+- Migrated to <sstream>.
+- The above consists of:
+  o vistest-V07-01-03: Migrated to <sstream> plus minor changes.
+  o DAWN-V07-01-00: Migrated to <sstream>.
+  o vis-HepRep-V07-01-03: Migrated to <sstream>.
+  o opengl-V07-01-06: Migrated to <sstream>, non-uniform scaling, any
+    background.
+  o vistree-V07-01-00: Migrated to <sstream>, fixed bug in mass calculations.
+  o visXXX-V07-01-01: Migrated to <sstream>.
+  o modeling-V07-01-01: Migrated to <sstream>.
+  o visman-V07-01-05: Migrated to <sstream>, non-uniform scaling, any
+    background.
+
+12th October 2005  John Allison (vis-V07-01-03)
+- G4VisCommandsViewer.cc: Trapped zero viewer pointer in /vis/viewer/update
+  (bug found by system test of vis-V07-01-02).
+
+2nd Oct 2005  Joseph Perl (vis-V07-01-02)
+  Same as vis-V07-01-01 but with earlier raytracer tag:
+  raytracer-V07-01-02
+
+30th Sep 2005  Joseph Perl (vis-V07-01-01)
+  New global tag for Vis.  Corresponds to vis-V07-01-00 plus:
+  vistest-V07-01-02
+  visman-V07-01-04
+  raytracer-V07-01-03
+  modeling-V07-01-00
+  opengl-V07-01-05
+  openinventor-V07-01-02
+  visXXX-V07-01-00
+  vis-HepRep-V07-01-01
+
+30th September 2005  Joseph Perl (raytracer-V07-01-03)
+New tag to include change Makoto made an hour after V07-01-02 was tagged.
+Change seems to just involve passing pWorld to material list where no argument was passed in previous version.
+
+29th September 2005  John Allison  (opengl-V07-01-05)
+- Added G4OpenGLViewerDataStore to facilitate access of viewer data by
+  scene handler.
+- Re-implemented transparency button in OpenGLXm.
+
+New tags to be included 16th Sep 2005 (JA):
+  o visman-V07-01-03:
+    + Issue "/tracking/storeTrajectory 1" on /vis/scene/add/trajectories.
+    + Warning: Attempt to add volume to a scene already containing the world.
+    + Error: Logical volume model must be only volume model in scene.
+  o visman-V07-01-04: Simplified use of ConcreteInstance..
+  o raytracer-V07-01-02: Bug fix (black holes).
+  o vistest-V07-01-02: Added a G4AttValue with time.
+
+To be included:
+  o visman-V07-01-01: Introduced (optional) second pass over scene.
+  o visman-V07-01-02: Added /vis/viewer/set/whiteBackground.
+                      Added RayTracerX to G4VisExecutive.
+  o modeling-V07-01-00: Fixed (non-)culling of transparent volumes.
+  o opengl-V07-01-01: Half-way implementation of transparency.
+  o opengl-V07-01-02: "Better algorithm" for transparency.
+  o opengl-V07-01-03: Bug fix.
+  o opengl-V07-01-04: Fixed hidden line removal.
+  o vis-HepRep-V07-01-00 (4 August 2005 Mark Donszelmann)
+  o openinventor-V07-01-01 (1st August 2005  Gabriele Cosmo)
+  o openinventor-V07-01-02: Corrected treatment of edgeflags.
+  o raytracer-V07-01-01: Protected RayTracerX by G4VIS macro.
+  o visXXX-V07-01-00: Improved guidance for rendering polyhedron objects.
+  o vistest-V07-01-01: RayTracerX instantiation removed - now in
+                       G4VisExecutive.
+
+20th July 2005  John Allison (vis-V07-01-00)
+- opengl-V07-01-00: Introduced smooth shading.  Also window size hints for Xm.
+- openinventor-V07-01-00: Changed Geant4_SoPolyhedron to construct
+    from G4Polyhedron.  Functionality unchanged.
+- visman-V07-01-00: Protected new viewer pointer.
+- vistest-V07-01-00
+- Removed top level README files.  (All wisdom now transferred
+    properly to User Guides.)
+
+17th July 2005  John Allison
+- raytracer-V07-01-00: Introduced RayTracerX.
+
+7th June 2005  John Allison (vis-V07-00-19)
+- visXXX-V07-00-00: Fixed compiler warnings.
+- visman-V07-00-02: bug fix.
+- modeling-V07-00-02: bug fix.
+- Incorporates vis-gmk-V07-00-00 - a fix for addition of zlib to
+  SUBLIBS and SUBDIRS (Gabriele)
+
+2nd June 2005  Joseph Perl (vis-V07-00-18)
+- Candidate tag for release.
+- Includes Mark's additional changes for HepRep2.
+- Includes Mark's fix for gcc-4.0 compilation.
+
+2nd June 2005  Joseph Perl (vis-V07-00-17)
+- Candidate tag for release.  May or may not be final.
+- Undid Gabriele's fix to G4HepRepFileSceneHandler.cc.
+
+2nd June 2005  John Allison
+- Removed scene handler count and made small cosmetic improvements.
+
+2nd June 2005  Joseph Perl (vis-V07-00-16)
+- Incorporate improvements to HepRepFile and HepRepXML
+
+30th May 2005  John Allison  (vis-V07-00-15)
+- opengl-V07-00-03: Fixed compilation problem in OpenGL on SUN.
+- HepRepFile: Fixed bug introduced in ClearTransientStore. (Joseph Perl)
+
+27th May 2005  John Allison
+- DAWN-V07-00-00, VRML-V07-00-00:
+    Fixed bug introduced in ClearTransientStore.
+- openinventor-V07-00-00 and 01:
+    fixes for CLHEP and marker sizes.
+- vis-HepRep-V07-00-01 and vis-zlib-V07-00-00  (Mark Donszelmann)
+    Migration to G4LIB_BUILD_ZLIB and some developments.
+- management:
+  o Reduced text size of scale annotation to 12 pixels.
+  o Fixed default values in /vis/scene/add/text.
+
+12th May 2005  John Allison
+- Moved zlib to externals/zlib.
+
+6th May 2005  John Allison  (vis-V07-00-14)
+- OpenGL: fixed bug (views not refreshed - opengl-V07-00-02).
+- Improved ASSCIITree guidance.
+- G4VisExecutive: Replaced printing of available graphics systems.
+  Now corresponds to behaviour of most old examples vis managers.
+- Fixed some pedantic warnings from gcc 4.
+- G4PhysicalVolumeModel: SetCopyNo of replicas and paramaterised
+  volumes (modeling-V07-00-00).
+
+5th May 2005  John Allison
+- Introduced zlib directory.
+
+22nd April 2005  John Allison
+- OpenGL: Implemented text for X-Windows viewers (opengl-V07-00-00/1).
+
+10th April 2005  John Allison  (visman-V07-00-00)
+- G4VisCommandsSceneAdd.cc: 2nd attempt to fix access to fpVisManager
+  from nested class for SUN.
+
+16th March 2005  John Allison  (vis-V07-00-13)
+- G4VisCommandsSceneAdd.cc: fixed access to fpVisManager from nested class.
+- For gcc 2.95.2: Fixed G4String return for viewer commands.
+- Added constructor and virtual destructor to G4VUserVisAction.
+
+15th March 2005  John Allison  (vis-V07-00-12)
+- Added return type G4int to G4ViewParameters::SetNoOfSides and
+  G4ModelingParameters::SetNoOfSides.  They return no. of sides, i.e.,
+  sides per circle in polyhedron contruction, that are actually set;
+  there is a lower limit of 12.
+- G4PhysicalVolumeModel: bug fix: no. of rotation steps correctly applied.
+
+10th March 2005  John Allison  (vis-V07-00-11)
+- Reviewed all vis commands.  Improved guidance, simplified and
+  rationalised the commands.
+
+9th March 2005  John Allison
+- Removed "remove" and "edit" commands.
+- G4VisManager: removed "Delete" methods. (Removing or deleting an
+  existing scene, scene handler or viewer is very messy and not
+  necessary.  When a user creates a new one, he/she may leave the old
+  one around without harm.  It may be left unused or selected again later
+  if the user wants.)
+- Removed automatic parameter candidate specification for commands
+  that take an argument that is a scene, scene handler or viewer
+  name - it is checked in SetNewValue methods.  (The code was just
+  too complicated and, anyway, the result hindered, rather than
+  helped the user, because it restricted the parameter values and
+  mis-typing gave obscure messages.  Now the messages are clearer and,
+  as the guidance points out, the list of possible names can be
+  obtained with a "list" command.)
+- Made "list" commands flag current items.
+- Improved guidance for /vis/scene commands.  Still to do (groan!):
+    /vis/scene/add
+    /vis/sceneHandler
+    /vis/viewer
+
+9th March 2005  John Allison  (vis-V07-00-10, needs greps-V07-00-01)
+- Refined logo and scale.
+- Improved physical volume clipping.
+- G4VisManager: Added default G4Transform3D::Identity to
+  objectTransformation argument in Draw methods.
+
+4th March 2005  John Allison  (vis-V07-00-09)
+- Added first implementation of cutaway - a clipping box for physical
+  volume tree:
+    vis/scene/add/volume ! ! ! box km 0 1 0 1 0 1
+  (Does not seem properly to clip volumes wholly inside clipping volume.)
+
+3rd March 2005  John Allison  (vis-V07-00-08)
+- Introduced /vis/scene/add/logo.
+- Added Set methods to G4VModel.
+- Added argument to G4CallbackModel::operator()(const G4Transform3D&) so that
+  the model could implement a given transformation.  Provided default for
+  G4VUserVisAction::(const G4Transform3D& = G4Transform3D::Identity).
+- Improved guidance for:
+    compound commands
+    ASCIITree commands
+- Used std::istrstream::istrstream(std::string) throughout.
+
+23rd February 2005  John Allison  (vis-V07-00-07)
+- Protected scene handlers for the case of the drawing of solids NOT
+  from a physical volume tree:
+    G4FRSceneFunc.icc
+    G4OpenGLSceneHandler.cc
+    G4OpenGLStoredSceneHandler.cc
+    G4ASCIITreeSceneHandler.cc
+    G4GAGTreeSceneHandler.cc
+- Fixed a problem with ClearTransientStore.  ClearTransientStore
+  should restrict itself to its job.  In the following files,
+  ClearTransientStore also redraws the view.  In other places, a draw
+  command often follows, so it is not needed here.  In fact it can
+  cause a double recursive descent into DrawView, so the existing code
+  has been commented out (JA - 23/Jan/05):
+    G4FRSceneFunc.icc
+    G4HepRepFileSceneHandler.cc
+    G4OpenGLImmediateSceneHandler.cc
+    G4OpenGLStoredSceneHandler.cc
+    G4VRML1SceneHandlerFunc.icc
+    G4VRML2SceneHandlerFunc.icc
+    G4XXXSceneHandler.cc
+- Removed (commented out) some code that forced extra kernel visits,
+  purportedly to overcome a problem in OpenGLStored methods.  Let's
+  fix OpenGL if necessary:
+    G4VSceneHandler.cc
+    G4VViewer.cc
+- Commented out SetView and ClearView in /vis/viewer/refresh:
+    G4VisCommandsViewer.cc
+- Changed signature of G4VViewer::SetNeedKernelVisit(G4bool) for compatibility.
+
+19th February 2005  John Allison  (vis-V07-00-06 with greps-V07-00-00)
+- Added G4VUserVisAction and G4CallbackModel.
+- Implemented /vis/scene/add/userAction.
+- Fixed bug in /vis/viewer/update (check existence of scene handler and scene).
+
+15th February 2005  John Allison  (vis-V07-00-05)
+- Introduced drawing of readout geometry for logical volumes.
+- For drawing of logical volumes, introduced boolean flags to control 
+  drawing of:
+    o boolean components (if any)
+    o voxels (if any) (note: voxels are not created until start of run)
+    o readout geometry (if any)
+- Augmented commands /vis/specify and /vis/scene/add/logicalVolume to use
+  above flags.
+- G4ASCIITree: Added printing of names of sensitive detector (if any) and
+  readout geometry (if any).
+
+15th February 2005  John Allison  (vis-V07-00-04)
+- Updated READMEs for G4VisExecutive.  Removed references to OPACS.
+
+9th February 2005  John Allison  (vis-V07-00-03)
+- Migration from AddThis to AddSolid and AddCompound: fixed previously
+  missed FukuiRendererSceneHander.
+
+4th February 2005  John Allison  (vis-V07-00-02)
+- Introduced G4VisExecutive.  MyVisManager deprecated.
+
+27th January 2005  John Allison  (vis-V07-00-01, needs intercoms-V07-00-00)
+- Migration from AddThis to AddSolid and AddCompound.
+- AddSolid: Methods for adding solids to the scene handler.  They
+  must always be called in the triplet PreAddSolid, AddSolid and
+  PostAddSolid.  The transformation and visualization attributes
+  must be set by the call to PreAddSolid.  A possible default
+  implementation is to request the solid to provide a G4Polyhedron
+  or similar primitive - see, for example, G4VSceneHandler.
+- AddCompound: Methods for adding "compound" GEANT4 objects to the scene
+  handler.  These methods may either (a) invoke "user code" that
+  uses the "user interface", G4VVisManager (see, for example,
+  G4VSceneHandler in the Visualization Category, which for
+  trajectories uses G4VTrajectory::DrawTrajectory, via
+  G4TrajectoriesModel in the Modeling Category) or (b) invoke
+  AddPrimitives below (between calls to Begin/EndPrimitives) or (c)
+  use graphics-system-specific code or (d) any combination of the
+  above.
+
+26th January 2005  John Allison  (vis-V07-00-00)
+- G4VisManager:: removed optional argument
+  const G4Transform3D& objectTransformation = G4Transform3D::Identity
+  from Draw methods for a hit and trajectory.
+- Trapped illegal nesting of Begin/EndPrimitives.
+- Added fpCurrentMaterial to G4VSceneHandler and relevant derived
+  classes and models for work with G4PhysicalVolumeModel via
+  EstablishSpecials.  So now, the material is also available (in addition
+  to current depth, logical and physical volum) during drawing of geometry
+  items.
+- Changed ASCIITree to use G4VSolid::GetCubicVolume and
+  G4LogicalVolume::GetMass.
+- Changed G4PhysicalVolumeMassScene to use G4VSolid::GetCubicVolume.
+- Improved guidance for /vis/viewer/set/hiddenMarker.
+- G4VisCommandsViewerSet: made Up and Viewpoint vectors unit for safety.
+- Some additions to test area.
+
+10th December 2004 Gabriele Cosmo (vis-V06-02-09)
+- Replaced M_PI with CLHEP's pi.
+
+7th December 2004 Joseph Perl (vis-V06-02-08)
+- Tagged right after migration to cmath
+- All occurences of include <math.h> have now become include <cmath>.
+- All math functions are now prefaced with std::
+
+7th December 2004 Joseph Perl (vis-V06-02-07)
+- Tagged right before migration to cmath
+
+26th November 2004 Joseph Perl (vis-V06-02-06)
+- Tagged for release 7.0.
+- Made from vis-V06-02-05
+- plus opengl-V06-02-07 by John Allison
+- plus vis-HepRep-V06-02-02 by Mark Donszelmann
+- plus openinventor-V07-00-00 by Guy Barrand
+
+18th November 2004  John Allison
+- Included opengl-V06-02-07.
+
+11th November 2004  John Allison  (vis-V06-02-05)
+- Made use of smart method GetPolyhedron for solids.  This greatly
+  speeds 2nd and subsequent drawings when kernel access is required.
+- Rationalised use of EstablishSpecials: functionality moved to base class.
+- Removed use of obsolete G4Polymarker::line.
+
+22nd September 2004  John Allison  (vis-V06-02-04)
+- Moved Doxyfile to management.  doxygen output to tmp area.
+- modeling-V06-02-01 - small fixes.
+- vistree-V06-02-01 - small fixes.
+- opengl-V06-02-06 - Trap non-regular polyhedra and other small changes.
+- DAWN-V06-02-00 - Improve diagnostic on trapping non-regular polyhedra.
+- vistest-V06-02-02: refined rotated tube test.
+
+13th September 2004  John Allison  (vis-V06-02-03)
+- vistree-V06-02-00: Improved ASCIITree:
+  verbosity >= 3: prints volume, density of all volumes in hierarchy.
+  verbosity >= 4: calculates the mass of the complete geometry tree taking
+    into account daughters up to the depth specified for each physical
+    volume in the current scene.  Culling is ignored so that all volumes
+    are processed.  The calculation is quite tricky, since it involves
+    subtracting the mass of that part of the mother that is occupied by
+    each daughter and then adding the mass of the daughter, and so on
+    down the heirarchy.  Uses G4PhysicalVolumeMassScene - see below.
+  Added option to write to file (/vis/ASCIITree/set/outFile).
+- modeling-V06-02-00: Added G4PhysicalVolumeMassScene and improvements
+  to G4PhysicalVolumeModel.  See modeling/History for more details.
+- Removed obsolete file: G4VisToOldVisCommands.hh
+- Corrected mistake in /vis/viewer/set/*Vector commands.
+- Augmented ParameterisedBox and rotated a tracker tube in test directory.
+- Brought README.built_in_commands up to date for Geant4 6.2.  Removed all
+  references to old commands.'
+
+3rd August 2004  John Allison
+- Rationalised vis command code (uses G4UIcommand static conversion
+  functions where possible).
+- Removed G4ViewParameters::DrawingStyle GetDrawingStyle (const
+  G4Visible&).  Instead, developer has to:
+    // Get vis attributes - pick up defaults if none.
+    const G4VisAttributes* pVA =
+      fpViewer -> GetApplicableVisAttributes (v.GetVisAttributes ());
+  where v is the visible object (polyline, circle, polyhedron, etc.), and:
+    // Get view parameters that the user can force through the vis
+    // attributes, thereby over-riding the current view parameter.
+    G4ViewParameters::DrawingStyle drawing_style = GetDrawingStyle (pVA);
+    G4bool isAuxEdgeVisible = GetAuxEdgeVisible (pVA);
+  Most developers do this anyway, so the removed routine was redundant
+  and resulting code is more efficient and transparent.  To get
+  colour, the developer can pick up directly from the vis attrributes,
+  pVA, obtained as above:
+    const G4Colour& c = pVA -> GetColour ();
+  or use a slightly less efficient method:
+    const G4Colour& c = GetColour (v);
+  where v is the visible object.
+  Note that for text, the developer must use a different procedure,
+  since the default text colour is determined by the default text vis
+  attributes, which may be specified independent of default vis
+  attributes of other types of visible objects.  A function,
+  GetTextColour, is provided and the recommended use is:
+    const G4Colour& c = GetTextColour (text);  // Picks up default if none.
+- Rationalised use of vis attributes in OpenGL and XXX.
+
+28th July 2004  John Allison  (vis-V06-02-02 with greps-V06-02-00)
+- Implemented force auxiliary edge visible feature of G4VisAttributes.
+- Included openinventor-V06-02-00 (minor revision - Guy Barrand).
+
+23rd July 2004  John Allison
+- Added auxiliary edge visible flag to G4ViewParameters and a new
+  command, /vis/viewer/set/auxiliaryEdge.  (Auxiliary edges are not
+  genuine edges of the volume.  They may be in a curved surface made
+  out of polygons, for example, or in plane surface of complicated
+  shape that has to be broken down into simpler polygons.
+  HepPolyhedron breaks all surfaces into triangles or quadrilaterals.
+  There will be auxiliary edges for any volumes with a curved surface,
+  such as a tube or a sphere, or a volume resulting from a Boolean
+  operation.  Normally, they are not shown, but sometimes it is useful
+  to see them.  In particular, a sphere, because it has no egdes, will
+  not be seen in wireframe mode in some graphics systems unless this
+  flag is turned on.)
+
+16th July 2004  John Allison
+- Refined forced wireframe algorithm - *always* force wireframe even
+  if hidden line removal is specified.
+- opengl-V06-02-04.
+
+15th July 2004  John Allison
+- Small improvement to G4XXX (sample graphics system).
+
+14th July 2004  John Allison  (vis-V06-02-01)
+- Removed deprecated commands:
+    /vis/viewer/show               (use /vis/viewer/update)
+    /vis/viewer/lightsThetaPhi     (use /vis/viewer/set/lightsThetaPhi)
+    /vis/viewer/lightsVector       (use /vis/viewer/set/lightsVector)
+    /vis/viewer/viewpointThetaPhi  (use /vis/viewer/set/viewpointThetaPhi)
+    /vis/viewer/viewpointVector    (use /vis/viewer/set/viewpointVector)
+  (See geant4/source/visualization/README.built_in_commands for list
+  of current commands.)
+- Tidied guidance for /vis/viewer/set.
+- Included opengl-V06-02-03 (cosmetic).
+
+14th July 2004  John Allison  (vis-V06-02-00)
+- opengl-V06-02-02 and vistest-V06-02-01:
+  Hidden line *and/or* hidden surface removal now work for OGL*X and OGL*Xm.
+
+1st July 2004  John Allison
+- Correction to guidance of /vis/viewer/set/hiddenEdge.
+- Small improvement to README of /vis/scene/add/axes.
+- vistest-V06-02-00.
+- opengl-V06-02-00.
+- visman-V06-02-00: Fix for porting on gcc-3.4.0: made ProcessView()
+  public, since used as private friend (Gabriele Cosmo).
+
+9th June 2004  Gabriele Cosmo  (vis-V06-01-03)
+- Adopt G4DLLIMPORT/G4DLLEXPORT technique to handle extern simbols for
+  allowing support of DLLs on Windows.
+- Minor correction in modeling/GNUmakefile for GLOBLIBS definition.
+- Coworks with "global-V06-01-02b".
+
+7th June 2004  Gabriele Cosmo  (vis-V06-01-02)
+- Includes "vis-HepRep-V06-01-04".
+- Export extern symbols for allowing support of DLLs on Windows.
+  Modified files: G4RayTrajectory.hh, G4RayTrajectoryPoint.hh.
+- GNUmakefiles: added definition of GLOBLIBS for DLLs support on Windows.
+- Coworks with "global-V06-01-02a".
+
+9th April 2004  John Allison  (vis-V06-01-01 + interfaces-V06-01-00)
+- Tagged OpenGL as below.  Joint with interfaces-V06-01-00.
+
+7th April 2004  Guy Barrand
+- visualization/OpenGL/* : use the G4OpenGL.hh file.
+- Added : visualization/OpenGL/include/G4OpenGL.hh to encapsulate
+  the include of gl/gl.h and gl/glu.h that may be platform dependant.
+  It permits to rm some #ifdef WIN32 spread in the code. It opens also
+  the way to the usage of the Apple OpenGL on a Mac.
+
+14 March 2004 Joseph Perl (vis-V06-00-01)
+- HepRepFile handle duplicate ShowView.
+- HepRepFile improve layering and hierarchy for hits.
+
+17th February 2004  John Allison  (opengl-V06-00-00)
+- Fixed bug #581: wrong order of statements in
+  G4OpenGLXViewer::~G4OpenGLXViewer (see bug report).
+
+1st December 2003  John Allison
+- Added checks and minor improvment of behaviour at end of event and run:
+  o G4VisManager::EndOfRun: added check on MarkForClearingTransientStore.
+  o G4VisCommandsScene.cc: For "/vis/scene/endOf[Event|Run]Action refresh",
+    SetMarkForClearingTransientStore(true).
+
+27th November 2003  John Allison  (vis-V05-02-06)
+- Added /vis/scene/endOfRunAction.
+- Includes vis-HepRep-V05-02-08.
+- G4VisManager: Removed PrintAllGraphicsSystems and
+  PrintInstalledGraphicsSystems.  They are difficult to maintain and
+  are anyway not used.  (There remains PrintAvailableGraphicsSystems,
+  which is much used, and iterates over instantiated graphics systems
+  and needs no maintenance.)
+
+20th November 2003  John Allison  (vis-V05-02-05)
+- Re-submitted.  Includes vis-HepRep-05-02-07: fixes compiler issues and
+  other minor fixes.
+
+14th November 2003  John Allison  (vis-V05-02-04)
+- Includes vis-HepRep-05-02-03: new HepRep XML driver for HepRep Version 2.
+- Bug fix in G4VisManager::EndOfEvent.
+
+12th November 2003  John Allison
+- Bug in /vis/scene/add/volume: requestedDepthOfDescent now correctly
+  propagated to "world" volume.
+- modeling-V05-02-02: G4PhysicalVolumeModel: CalculateExtent always
+  searches complete hierarchy.
+- Change initialisation of G4VSceneHandler so that there is always a
+  clear on first drawing  - fMarkForClearingTransientStore(true).
+- Removed redundant code from G4VisManager::::EndOfRun.
+
+6th November 2003  John Allison  (vis-V05-02-03)
+- management:
+  o G4VisManager: improved handling of auto refresh at end of event and run.
+  o G4VisCommandsScene: improved endOfEventAction and improved guidance.
+  o GNUmakefile: rationalised.
+- GNUmakefile: removed G4LIBDIR and G4TMPDIR.
+- RayTracer/GNUmakefile: rationalised (raytracer-V05-02-04).
+- Tree: improved printing.
+- G4VRML2SceneHandlerFunc: changed const char* pv_name to G4String pv_name.
+- G4XXXViewer: improved comments.
+- modeling: GNUmakefile: rationalised (modeling-V05-02-01).
+- test: changed MyPhysicsList to follow kernel changes.
+
+4th November 2003  Gabriele Cosmo  (vis-V05-02-02)
+- Includes removal of OPACS module.
+- Includes "modeling-V05-02-00".
+
+17th October 2003  Guy Barrand
+- OPACS being (for long) deprecated, remove OPACS related things
+  in Geant4 repository.
+
+4th October 2003  Gabriele Cosmo  (vis-V05-02-01)
+- Modified GNUmakefiles:
+  o added dependency to new module "geometry/navigation".
+  o replaced "digits+hits" with "digits_hits".
+- Coworks with "geometry-V05-02-00" and "digits_hits-V05-02-00".
+
+22nd September 2003  John Allison  (vis-V05-02-00, greps-V05-02-00)
+- Incorporates raytracer-V05-02-01 (needs greps-V05-02-00) - see
+  RayTracer/History:
+  o Introduced G4VRTScanner.
+  o Added /vis/rayTracer/backgroundColour.
+- Introduced Doxygen documentation for management, OpenGL and test.
+- Improved guidance for /vis/scene/notifyHandlers.
+- OpenGL: Cosmetic change to regularise names.
+
+2nd September 2003  John Allison
+- Fixed pedantic warnings etc. in test suite - see test/History.
+
+2nd June 2003  John Allison  (vis-V05-01-01)
+- Small fix for pedantic warnings in RayTracer.
+
+30th May 2003  John Allison  (vis-V05-01-00 - does not include HepRep below)
+- Improved README.built_in_commands.  Removed unlikely-to-be-implemented
+  commands.
+- Eliminated pedantic warnings.
+
+28th February 2003  Joseph Perl
+- Minor Fix to HepRep - see History file.
+
+20th January 2003  John Allison
+- Changed "/vis/scene/add/trajectories [<drawing-mode>]" so that if
+  the command is issued more than once on any given scene, the last
+  command takes effect, i.e., so that the last value of drawing-mode
+  takes effect.
+
+17th February 2003 Satoshi Tanaka (vis-V05-00-01)
+- A Small bug fixing of VRML2 driver 
+ (Explicit cast from G4String to char* in G4VRML2SceneHandlerFunc.icc).
+
+24th January 2003  Joseph Perl
+- Fixes to HepRep - see History file.
+
+20th January 2003  John Allison  (vis-V05-00-00, co-works intercoms-V05-00-00)
+- Incorporated openinventor-V05-00-00: Removed erroneous additional
+  transformation.
+- Added G4VisManager::Draw methods for hits and trajectories.
+
+11th December 2002  John Allison  (vis-V04-01-10)
+- Fix for SUN-CC warnings: AddThis hides the virtual function...
+- Fix memory leak in RayTracer.
+- Fixed /vis/scene/add/trajectories command.
+- Some fixes in HepRep.
+
+4th December 2002  Makoto Asai (vis-V04-01-09)
+- Migration to new G4ApplicationState
+
+27th November 2002  John Allison  (vis-V04-01-08)
+- Fixes to HepRep - see History file.
+- Added RegisterGraphicsSystem (new G4HepRep) in MyVisManager.cc.
+- Fix (removal) of ambiguous G4VVisCommand::GetNewDoubleValue.
+- Added /vis/viewer/set/globalMarkerScale.
+- Improved algorithm of CompareForKernelVisit on OpenGL and OpenInventor.
+
+21st November 2002  Gabriele Cosmo  (vis-V04-01-07)
+- Corrections to HepRep module to allow porting on egcs compiler
+  (M.Donszelmann).
+- Patched access to static data in G4VisCommandsSceneAdd.cc, G4VisManager.cc
+  and G4FlavoredParallelWorldModel.cc to allow porting on Windows DLLs.
+  It requires co-working with tags "greps-V04-01-04" and "intercoms-V04-01-02".
+
+15th November 2002  Mark Donszelmann  (vis-V04-01-06)
+- HepRep2 driver implemented.
+
+11th November 2002  John Allison  (vis-V04-01-05)
+- Corrected inclusion of G4OpenGLXViewer #ifdef X_DRIVER for Windows
+  and other small changes in OpenGL (opengl-V04-01-02).
+- Added integer argument to /vis/scene/add/trajectories [drawing-mode].
+  drawing-mode is passed to DrawTrajectory.  See also modeling-V04-00-00.
+- Fixed bug in G4VisManager wich lead to zero G4VModel pointer.
+- Improved hamdling of models.
+- Corrected G4RayTracer.cc devide-by-zero (raytracer-V04-00-01).
+- VRML: bug fixing for marker size (*.icc files) (VRML-V04-01-00).
+- Samll improvements to README.built_in_commands.
+- Improved sample driver XXX.
+
+1st November 2002  John Allison (vis-V04-01-04 with...)
+geant4/source/tracking       tracking-V04-01-03
+geant4/source/intercoms      intercoms-V04-01-00
+geant4/source/graphics_reps  greps-V04-01-01
+geant4/source/digits+hits    digits+hits-V04-01-01
+
+Oct 28, 2002, J.Allison  (vis-traj03, co-works with...
+geant4/source/tracking       traj03 (head as of Tue Oct 29 15:42:14 UTC 2002)
+geant4/source/intercoms      intercoms-V04-01-00 (ditto)
+geant4/source/graphics_reps  greps-V04-01-01 (ditto)
+geant4/source/digits+hits    hits-traj03 (*not* the head)
+- Changed G4XXXSceneHandler.cc for map of G4AttDefs, and improved.
+
+17th October 2002  John Allison (vis-V04-01-03 with...)
+- Coworking tags are:
+    geant4/source/tracking       traj02
+    geant4/source/intercoms      intercoms-V04-00-04
+    geant4/source/graphics_reps  greps-V04-01-00
+    geant4/source/digits+hits    hits-traj02
+- More changes for AddThis(const G4VTrajectory&) and (const G4VHit&).
+- Minor corrections to warning messages, etc.
+- Improved end of run behaviour for non-post-processing graphics
+  systems by changing false to true in G4VisManager::EndOfRun
+  fpSceneHandler->SetMarkForClearingTransientStore(true);
+- Further corrections/improvements in OpenGLWin32 - not yet complete.
+
+17th October 2002  John Allison (vis-V04-01-02 with intercoms-V04-01-00)
+- Added two new pure virtual functions to G4VGraphicsScene:
+    AddThis(const G4VTrajectory&)
+    AddThis(const G4VHit&)
+
+16th October 2002  John Allison  (vis-traj01 co-works with tracking tag traj01)
+- Tag for changes in G4VTrajectory, etc. (raytracer-V04-00-00).
+
+16th October 2002  John Allison  (vis-V04-01-01)
+- Fix for WIN32.  Now compiles but viewer not implemented.  (opengl-V04-01-01)
+- Small improvement to README.built_in_commands.
+
+1st Sept 2002  Satoshi Tanaka  (vis-V04-01-00)
+- Precision control of g4_XX.prim files generated by 
+  the DAWNFILE/DAWN-Network drivers. 
+
+   Example:
+     setenv  G4DAWNFILE_PRECISION   9
+
+  The precision number is used as:
+
+      sprintf( string, "%*.*g", (precision+8), precision, value)
+
+  The default precision is also changed from 6 to 9.
+
+24th June 2002  John Allison
+- Further cosmetic changes in G4OpenGL for DEC compiler (opengl-V04-01-00).
+
+24th June 2002  Gabriele Cosmo  (vis-V04-00-10)
+- Exclude latest changes to OpenGL driver (opengl-V04-00-03), causing compilation
+  errors on some platforms (DEC-cxx).
+
+23th June 2002  Satshi Tanaka  (vis-V04-00-09)
+- Bug fixes in G4VRMLXFileSceneHandlerFunc.icc
+- Protection of VRML-Newtork drivers for Windows platform.
+  (The compilation is skipped in the Windows platform.)
+
+19th June 2002  John Allison  (vis-V04-00-08)
+- Cosmetic changes in G4VRML2FileSceneHandler.cc and G4VRML2SceneHandler.cc
+  (Gabriele)
+
+10th June 2002  John Allison
+- Cosmetic changes for SUN-CC in G4OpenGLXmConvenienceRoutines.cc
+  (opengl-V04-00-03).
+- Improvement to /vis/scene/add/logicalVolume guidance.
+
+6th June 2002  John Allison
+- Cosmetic changes for GNU compiler in G4OpenGLXViewer.cc (opengl-V04-00-02).
+
+8th May 2002  John Allison (vis-V04-00-07)
+- Minor changes to warning messages and README.built_in_commands.
+- Added test fro G4EllipticalTube to test/src/MyDetectorConstruction.cc.
+
+1st May 2002  John Allison (vis-V04-00-06)
+- Deprecated /vis/viewer/set/autoRefresh.
+
+26th April 2002  Makoto Asai (vis-V04-00-05)
+- Corresponds to the changes in intercoms-V04-00-00
+- Affected files :
+   G4VisManager.cc G4VisCommandsViewer.cc G4VisCommandsCompound.cc
+
+22nd April 2002  John Allison (vis-V04-00-04)
+- Prevent copying of autoRefresh status with /vis/viewer/set/all command.
+- Corrected out of date advice about /vis/set/culling, etc.
+- Workaround for pseudo-parallel/orthogonal projection in Ray Tracer.
+
+28th February 2002  John Allison (vis-V04-00-03)
+- Updated OpenGL to compile (but not run) on Windows (opengl-V04-00-01).
+- Removed redundant code in GNUmakefiles in OPACS, OpenGL, OpenInventor, VRML.
+- Improved README.adding_graphics_system.
+
+23rd February 2002  John Allison (vis-V04-00-02)
+- Bug fix in modeling, which was causing nested calls to Begin/EndPrimitives.
+
+4th February 2002  Joseph Perl  (vis-V04-00-01)
+- HepRep: Check for missing hierarchy layers in HepRepXMLWriter.
+  (Not strictly needed since have a culled layer check in SceneHandler,
+  but may be useful in other applications of HepRepXMLWriter).
+
+3rd February 2002  Joseph Perl
+- HepRep: Detect transient data by testing for
+  !fpCurrentPV || fReadyForTransients
+  rather than just fReadyForTransients
+
+1st February 2002  Joseph Perl
+- Improvements to HepRep:
+- Defer file opening until first real HepRepType is to be written.
+- Moved HepRep code from AddThis to AddPrimitive.
+- Add additional levels to hierarchy if any appear to have been
+  removed by culling.
+- Add visibility attribute.
+
+29th January 2002  Joseph Perl
+- Relocate HepRep file-opening logic to constructor and ShowView
+  (had been in SetView).
+
+28th January 2002  vis-V03-02-23 Joseph Perl
+- Improvements to HepRep:
+- Produce hierarchical output rather than flat HepRepType structure.
+- Handle trajectories as well as detector geometry.
+- Output files now named G4Data<n>.heprep where n increments with each open.
+
+14th January 2002  vis-V03-02-22 Joseph Perl
+- Corrected handling for already open file in HepRepXMLWriter.
+
+01th December 2001 vis-V03-02-21 Satoshi Tanaka
+- Code refinements in FukuiRenderer/ directory:
+  * Noisy warnings for Linux-g++ are suppressed.
+    (%lg ==> %g etc)
+  * G4FRSceneFunc.icc is moved from /src to /include
+
+29th November 2001  John Allison
+- Fixed some pedantic warnings and a bug thrown up by such in OpenGL.
+
+28th November 2001  Gabriele Cosmo (visman-V03-02-00 in management only).
+- Fixed pointer initialisation for porting on VC++ in G4VisCommandsSceneAdd.cc.
+
+21st November 2001  John Allison  (vis-V03-02-20)
+- Fixed G4std bug in G4HepRepFileSceneHandler.hh.
+- Fixed "hides the virtual function" warnings from G4HepRepFileSceneHandler.
+- Change to comments in G4XXXSceneHandler.hh.
+
+19th November 2001  John Allison  (vis-V03-02-19 needs config-V03-02-09+)
+- Cosmetic changes to HepRep.
+
+16th November 2001  John Allison
+- Added G4XXXDEBUG to XXX dummy system.
+
+14th November 2001  John Allison
+- Fixed bug in G4VisManager::EndOfEvent.
+- Moved code from G4VisManagerRegisterMessengers.cc to G4VisManager.cc and
+  removed G4VisManagerRegisterMessengers.cc.
+
+14th November 2001  Guy Barrand
+- OpenInventor : move HEPVis/SoWindow under vis/OpenInventor/G4SoWindow
+  to prepare HEPVis/6.0. (HEPVis/SoWindow will disappear from HEPVis/6.0).
+
+14th November 2001  John Allison
+- Added README.built_in_commands.
+
+13th November 2001  Satoshi Tanaka
+- visualization/README file is updated, adding minimal description
+  on the HepRepFile driver. 
+
+12th November 2001  John Allison  (vis-V03-02-18 needs config-V03-02-09)
+- Fixed some warnings and one error from gcc-2.95.2.
+- HepRep Type names now come from Physical Volume names (Joseph Perl).
+- Added many HepRep Attributes for other volume properties (Joseph Perl).
+
+13th Nov 2001 (JST)  Hajime Yoshida and Minamimoto (vis-V03-02-17)
+- Updation of G4RTJpegMaker.cc for Windows platform (raytracer-V03-02-01). 
+
+7th November 2001  John Allison  (vis-V03-02-16 needs config-V03-02-09)
+- Corrected compilation error.
+
+6th November 2001  John Allison  (vis-V03-02-15 needs config-V03-02-09)
+- Added /vis/viewer/flush = refresh + update.
+- Moved /vis/viewer/lights and viewpoint to /vis/viewer/set.
+- Added /vis/viewer/set/upThetaPhi and upVector.
+- Added refresh|flush option to /vis/scene/notifyHandlers.
+- Moved HepRepFile classes to HepRep/ directory and removed HepRep classes
+  therein.
+
+1st October 2001  Joseph Perl
+- Added first version of pure C++ HepRep driver, HepRepFile.
+  See HepRep/README for details.
+
+10th September 2001  John Allison  (needs greps-V03-02-04)
+- (Non-standard tag JA-RAEOE.) 
+
+10th September 2001  John Allison  (not tagged but needs greps-V03-02-04)
+- Added BeginOfRun, BeginOfEvent and EndOfRun to G4VisManager, invoked via
+  G4VisStateDependent.
+- Improved handling of refresh-at-end-of-event.  All scene handlers need to
+  implement ClearTransientStore and ensure rebuilding of permanent store if
+  necessary.
+- Auto-refresh (notifyHandlers) after attaching scene.
+- Changed default colour of scale to red and fixed a couple of small bugs in
+  the implementation of AddPrimitive(G4Scale).
+- Improved verbosity guidance.
+- Improved /vis/scene/add/scale guidance (needs greps-V03-02-04).
+- Removed /vis/viewer/refresh from compound commands.
+- Capitalised 'R' in /vis/viewer/set/autoRefresh.
+
+29th August 2001  John Allison/Joseph Perl  (vis-V03-02-14)
+- Needs config-V03-02-06.
+- First developers release of HepRep graphics driver.
+
+24th August 2001  Joseph Perl  (vis-V03-02-13-00)
+- First inclusion of HepRep graphics driver.
+
+24th August 2001  John Allison  (vis-V03-02-13)
+- Fixed bugs in G4VisManager::GeometryHasChanged.
+- Separated out G4Scene::CalculateExtent.
+- Improved robustness and timeliness of invocation of some commands.
+- Improved READMEs.
+- Reduced warnings from OpenGL - see OpenGL/History.
+- Cosmetic changes to test.
+- Added explicit invocation of base class methods to avoid warnings about
+  hiding of base class methods.
+
+17th August 2001  John Allison  (vis-V03-02-12)
+- Coworks with greps-V03-02-02 and intercoms-V03-02-04.
+- Added G4VisManager::Draw(const G4Scale&,...  Needs intercoms-V03-02-04.
+- Added template graphics system XXX.
+- Improved verbosity guidance.
+
+14th August 2001  John Allison  (vis-V03-02-11)
+- Coworks with greps-V03-02-02 and intercoms-V03-02-03.
+- Moved default value G4Transform3D::Identity of argument from
+  G4VSceneHandler::BeginPrimitives to
+  G4VGraphicsScene::BeginPrimitives.  Needs intercoms-V03-02-03.
+- Fixed bug in G4VSceneHandler::AddPrimitive(const G4Scale&).  Needs
+  greps-V03-02-02.
+- Added sceneHandler.Begin/EndPrimitives messages to models (long
+  standing bug!).
+- Removed "dummy" graphics systems in G4VisManager.cc.
+- Improved robustness of some commands, particularly
+  /vis/scene/notifyHandlers.
+- Improved support for multiple viewers (but see OpenGL/History).
+
+11th August 2001  John Allison  (vis-V03-02-10-01)
+- Implemented /vis/scene/endOfEventAction.
+
+9th August 2001  John Allison  (vis-V03-02-10-00)
+- Note: non-standard tag to indicate internal use only.
+- Added /vis/scene/create at start of compound command /vis/open to avoid
+  warnings.
+- Removed G4ModelingParameters::hierarchy.  It is no longer used.  The
+  textual or graphical representation of the geometry hierarchy is now
+  done in G4xxxTree classes in visua;ization/Tree.
+- Removed /vis/scene/notifyHandlers from
+  G4VVisCommandScene::UpdateVisManagerScene - too much updating going on.
+  It was leading to recursive refreshing/updating.
+- Implemented auto-refresh at end of event.  (See also OpenGL/History.)
+  Introduced G4VSceneHandler::Get/SetMarkForClearingTransientStore for
+  postponed (lazy) clearing of transients (e.g., trajectories) from store
+  (graphical database) and view.  The mark is set at the end of
+  G4VisManager::EndOfEvent and the actual clearing is done in:
+    void G4VisManager::ClearTransientStoreIfMarked(){
+      // Assumes valid view.
+      if (fpSceneHandler->GetMarkForClearingTransientStore()) {
+        fpSceneHandler->SetMarkForClearingTransientStore(false);
+        fpSceneHandler->ClearTransientStore();
+      }
+    }
+  which is called at the start of each G4VisManager::Draw and the beginning
+  of G4VisManager::EndOfEvent.  Thus the picture stays from the end of all
+  drawing for the event until the first drawing of the next event.
+    
+5th August 2001  John Allison
+- Small refinements to printing under new verbosity control.
+
+4th August 2001  John Allison  (vis-V03-02-10)
+- Re-implemented verbosity control.  Output statements wherever possible
+  are controlled by the verbosity in a simple graded message scheme:
+    enum Verbosity {
+      quiet,         // Nothing is printed.
+      startup,       // Startup and endup messages are printed...
+      errors,        // ...and errors...
+      warnings,      // ...and warnings...
+      confirmations, // ...and confirming messages...
+      parameters,    // ...and parameters of scenes and views...
+      all            // ...and everything available.
+    };
+  Note that the G4VisManager member object name and type have changed:
+    Verbosity             fVerbosity;  // New.
+    const G4int           fVerbose;
+    // fVerbose is kept for backwards compatibility for some user
+    // examples.  (It is used in the derived user vis managers to print
+    // available graphics systems.)  It is initialised to 1 in the
+    // constructor and cannot be changed.
+
+3rd August 2001  John Allison
+- Added README.quick, a quick installation guide.
+
+30th July 2001  John Allison  (vis-V03-02-09)
+- Eliminated view parameters from G4VisManager.  Now, each view maintains its
+  own parameters.  Can be copied from one view to another with:
+    /vis/viewer/set/all <from-viewer-name>
+    Copies view parameters from from-viewer to current viewer.
+    Affects current viewer.
+- Removed redundant methods from G4VisManager, mostly to do with old-style
+  commands.
+
+27th July 2001  John Allison  (vis-V03-02-08)
+- Needs config-V03-02-01.
+- Introduced environment variable G4VIS_NONE that, if set, no visualization
+  drivers are built and no vis libraries are built, not even
+  libG4vis_management.  (libG4modeling is still built.)  The C-pre-processor
+  variables G4VIS_BUILD and G4VIS_USE are *not* set.
+- Removed the need to specify environment variables for visualization drivers
+  which do not need external packages or libraries, namely :
+      G4VIS_BUILD_DAWNFILE_DRIVER
+      G4VIS_BUILD_RAYTRACER_DRIVER
+      G4VIS_BUILD_VRMLFILE_DRIVER
+      G4VIS_BUILD_ASCIITREE_DRIVER
+      G4VIS_BUILD_GAGTREE_DRIVER
+    with associated G4VIS_USE environment variables:
+      G4VIS_USE_DAWNFILE
+      G4VIS_USE_RAYTRACER
+      G4VIS_USE_VRMLFILE
+      G4VIS_USE_ASCIITREE
+      G4VIS_USE_GAGTREE
+  For backwards compatibility, unless G4VIS_NONE is set, the corresponding
+  C-pre-processor variables are automatically set.  Also, the C-pre-processor
+  variables G4VIS_BUILD and G4VIS_USE are set.
+- As before, environment variables for other drivers still need positive
+  setting of their G4VIS_BUILD and G4VIS_USE environment variables.  In this
+  category are:
+      G4VIS_BUILD_DAWN_DRIVER
+      G4VIS_BUILD_OPACS_DRIVER
+      G4VIS_BUILD_OPENGLX_DRIVER
+      G4VIS_BUILD_OPENGLWIN32_DRIVER
+      G4VIS_BUILD_OPENGLXM_DRIVER
+      G4VIS_BUILD_OIX_DRIVER
+      G4VIS_BUILD_OIWIN32_DRIVER
+      G4VIS_BUILD_VRML_DRIVER
+    with associated G4VIS_USE environment variables:
+      G4VIS_USE_DAWN
+      G4VIS_USE_OPACS
+      G4VIS_USE_OPENGLX
+      G4VIS_USE_OPENGLWIN32
+      G4VIS_USE_OPENGLXM
+      G4VIS_USE_OIX
+      G4VIS_USE_OIWIN32
+      G4VIS_USE_VRML
+  In this case G4VIS_NONE must *not* be set.
+- Fixed unchecked pointer in G4VSceneHandler::ClearStore().
+
+25th July 2001  John Allison  (vis-V03-02-07)
+- Improved access to models (modeling-V03-02-03).
+- Made G4VSceneHandler::fpModel non-const G4VModel* for convenience.
+- Improved checks and warning messages in /vis/scene/add/scale.
+
+24th July 2001  John Allison  (vis-V03-02-06)
+- Needs greps-V03-02-01 for small interface change to G4Scale.
+- Includes modeling-V03-02-02.
+- Force rebuild of graphics "stores" (graphical databases) and, if
+  auto-refresh is true, refresh of all views
+  (/vis/scene/notifyHandlers) after an addition to scene.
+- Improvements to /vis/scene/add/scale:
+  o Added colour.
+  o Assigned a genuine extent.
+
+23rd July 2001  John Allison  (vis-V03-02-05 is non existent - sorry!!!)
+- Improved /vis/scene/add/scale.
+- Improved auto-refreshing.
+
+21st July 2001  John Allison  (vis-V03-02-04)
+- Added /vis/scene/add/scale.  Needs greps-V03-02-00 and intercoms-V03-02-02.
+
+19th July 2001  Satoshi Tanaka  (vis-V03-02-03)
+- Modification of G4DAWNFILEViewer.cc
+- PostScript command "showpage" is always added to g4_XX.eps
+  so that it is printable. (It can also be inserted into
+  LaTeX documents.
+
+18th July 2001  John Allison  (vis-V03-02-02)
+- Ensured rotation and translation of replica is restored (modeling-V03-02-00)
+  (fixes crashes in replica tracking).
+
+14th July 2001  John Allison  (vis-V03-02-01)
+- Included raytracer-V03-02-00 (minor cosmetics).
+- Minor changes in G4OpenGLXViewer.cc to eliminate pedantic ISO C++ warnings.
+- Merged vis-V03-02-patch01 (below) to head.
+- Included new disclaimer.
+
+14th July 2001  John Allison (vis-V03-02-patch01 in branch geant4-03-02-branch)
+- Fixed crash in optimised mode: added Initialise() to viewers so
+  that windows are opened after viewers are fully constructed.
+
+10th July 2001  John Allison  (vis-V03-02-00)
+- Removed old-style commands.
+- Removed maintenance of G4VisManager's G4ViewParameters object (this
+  will be removed soon).
+- Merged vis-V03-02-patch00 (below) to head.
+
+10th July  John Allison  (vis-V03-02-patch00 in branch geant4-03-02-branch)
+- Corrected mistake which could cause crash if user specified a non-
+  existent scene handler in /vis/sceneHandler/remove.
+
+19th June 2001  Satoshi Tanaka (vis-V03-01-07)
+-OS dependence is removed from the DAWN-network driver.
+ * gethostname() removed
+ * G4SocketConfig.hh and G4SocketMacro.hh are removed.
+- Now "setenv G4DAWN_HOST_NAME hostname" is mandatory to use 
+  the DAWN-network driver.
+
+15th June 2001  John Allison
+- Added GAGTree to G4VisManager.cc, MyVisManager.cc.  Need corresponding
+  changes in config.
+
+15th June 2001  John Allison (vis-V03-01-06)
+- Added 2nd template argument (less) to sets in G4ASCIITreeSceneHandler and
+  G4GAGTreeSceneHandler.
+
+15th June 2001  Satoshi Tanaka (vis-V03-01-05)
+- The  first committing of GAGTree driver.
+- Other files in ./Tree/ are the same as vis-V03-01-04.
+
+5th June 2001  John Allison (vis-V03-01-04)
+- Moved re-useable code from G4ASCIITree to G4VTree.
+- Made sure all pointers in G4VisManager are initialised on construction.
+
+4th June 2001  John Allison
+- G4ASCIITree: Added logical volume name and solid name and type under
+  verbosity control.
+- G4ASCIITree: Forced culling off so that all volumes are seen, even if
+  "invisible".
+
+29th May 2001  John Allison
+- Small clean up in test directory.
+
+25th May 2001  John Allison
+- Bug fix in G4ASCIITree.cc: initialise fVerbosity(0).
+
+24th May 2001  John Allison  (vis-V03-01-03)
+- Added missing files G4ASCIITreeMessenger.hh/cc.
+- Bug fix in G4ASCIITreeMessenger.cc: currentAsDefault = true.
+- Drivers in alphabetical order in MyVisManager.cc.
+
+23rd May 2001  John Allison
+- Eliminated Linux pedantic warnings, except FukuiRenderer, VRML and OPACS.
+
+22nd May 2001  John Allison
+- Refined ASCIITree.
+
+21st May 2001  John Allison (vis-V03-01-02)
+- Minor bug corrections (mostly to fix things that used to work with the
+  old /vis~/ commands but ceased to work with the new /vis/commands:
+  o If a scene is empty at drawing time, the "world" is added.
+  o Window size hint now works for OpenGL.
+- Fixed some minor warnings for strict C++ (size_t, etc.).
+
+18th May 2001 John Allison
+- Removed unnecessary virtual inheritance of G4VViewer in G4RayTracerViewer.
+- Introduced verbosity to ASCIITree.
+- Proper deletion of directories in G4VisManagerRegisterMessengers.
+
+15th May 2001 John Allison
+- Fixed bug in name of /vis/viewer/set/sectionPlane command.
+
+3rd May 2001 John Allison (vis-V03-01-01)
+- Changes for greps-V03-01-01 (elimination of RW).
+- Improvements in /vis/scene/add/volume.
+- Added /vis/drawTree.
+
+10th April 2001  John Allison (vis-V03-01-00)
+- Added two new commands:
+    /vis/scene/add/text
+    /vis/scene/add/axes
+- Added first version of ASCIITree to dump geometry hierarchy to
+  standard output as ASCII stream.
+  This requires two new environment variables:
+    G4VIS_BUILD_ASCIITREE_DRIVER
+    G4VIS_USE_ASCIITREE
+  and config-V03-01-00.
+
+2nd April 2001  John Allison
+- Tidied OpenGL (opengl-V03-00-01) - see OpenGL/History.
+
+2nd April 2001  John Allison  (vis-V03-00-09)
+- Fixed some warnings from DEC cxx.
+
+15th March 2001  John Allison  (vis-V03-00-08)
+- Changed rotation of phi-replicas in G4PhysicalVolumeModel.cc to
+  ensure correspondence with rule that phi=0 bisects the replica.
+  WARNING: Prior to this fix the graphics did NOT correspond to the
+  replica navigation.  If you have been relying on the graphics to
+  position daughter volumes in a phi-replica, navigation will have
+  been incorrect, possibly without causing a crash.  The above fix
+  will change the apparent position as shown by the graphics and you
+  will have to correct the positioning of daughters.  Make sure the
+  diaghters are all properly enclosed within the replica.  Graphics
+  and navigation now correspond,
+
+7th March 2001  John Allison  (vis-V03-00-07)
+- Cosmetic corrections for ISO compliance.
+
+23rd February 2001  John Allison  (vis-V03-00-06)
+- Removed all references to RogueWave.
+
+4th February 2001  John Allison  (vis-V03-00-05)
+- Reverted to /vis/viewer commands updating vis manager's view parameters.
+  Otherwise this can have a big effect on users if old commands are still
+  being used.  Let's schedule this change for the next version of Geant4.
+- Added the following new commands:
+  /vis/enable [true|false]
+  /vis/disable
+  /vis/verbose [<verbosity-integer>]
+  /vis/viewer/set/lineSegmentsPerCircle  [<number-of-sides-per-circle>]
+  /vis/viewer/set/sectionPlane ...
+  Only /vis/scene/add/text and /vis/scene/add/axes to go!!!
+
+4th February 2001  John Allison  (vis-V03-00-04)
+- /vis/viewer commands no longer update vis manager's view parameters.
+- Most /vis~/ copmmands give DEPRECATED warning, except:
+  /vis~/draw/axes
+  /vis~/draw/text
+  /vis~/set/section_plane
+  /vis~/set/sides
+  /vis~/set/verbose
+  which have still to be re-implemented.  All /vis~/ commands are still
+  available through /vis/ for the time being.  (Window size hint no longer
+   works.)
+- Added "auto refresh" to view parameters.
+- Added "default" view parameters to viewers.
+- Made OpenGL viewers "auto refresh" by default.
+- Added:
+  /vis/viewer/set/autoRefresh
+  /vis/viewer/set/projection
+- Added compound command:
+  /vis/drawView [<theta-deg>] [<phi-deg>]
+                [<pan-right>] [<pan-up>] [<pan-unit>]
+                [<zoom-factor>]
+                [<dolly>] [<dolly-unit>]
+
+4th February 2001  John Allison  (vis-V03-00-03)
+- Added several new vis commands:
+  /vis/viewer/dolly
+  /vis/viewer/dollyTo
+  /vis/viewer/lightsThetaPhi
+  /vis/viewer/lightsVector
+  /vis/viewer/pan
+  /vis/viewer/panTo
+  /vis/viewer/viewpointThetaPhi
+  /vis/viewer/viewpointVector
+  /vis/viewer/zoom
+  /vis/viewer/zoomTo
+  /vis/viewer/set/hiddenMarker
+  /vis/viewer/set/lightsMove
+
+3rd February 2001  John Allison  (vis-V03-00-02)
+- Tidied for CodeWizard.  Small changes to many files in management, modeling
+  and OpenGL.
+
+1st February 2001  John Allison  (vis-V03-00-01)
+- Fixed cause of crash when setting viewpoint before creating scene (Bug #157).
+  Solution: SetView no longer called when view parameters are changed.  In
+  any case it's called just before drawing, whixh is the right place.
+- Fixed /vis/set/sides problem (Satoshi Tanaka) (Bug #204).
+  Solution: Update view's view parameters in /vis/set/sides - had somehow
+  been overlooked.
+
+25th January 2001  John Allison
+- Added protection against empty G4Polyhedron objects.
+   FukuiRenderer/src/G4FRSceneFunc.icc
+   OPACS/src/G4GoSceneHandler.cc
+   OpenGL/src/G4OpenGLSceneHandler.cc
+   OpenInventor/src/G4OpenInventorSceneHandler.cc
+   VRML/src/G4VRML1SceneHandlerFunc.icc
+   VRML/src/G4VRML2SceneHandlerFunc.icc
+
+25th January 2001  John Allison  (opengl-V03-00-00)
+- Fixed Bug #120.  Implemented running re-calculation of up-vector in
+  the case of "object rotation" (lights move with camera) to prevent
+  "flipping" of view when camera passes through up-vector.  Note that
+  the default is "camera rotation" (lights do not move with camera,
+  i.e., remain fixed relative to object) so the default is that this
+  "flipping" can happen.  To set "object rotation" (lights move with
+  camera) use /vis/lights/move_with_camera true (soon to be
+  /vis/viewer/set/lights move-with-camera) or click "Object" radio
+  button on Rotation Panel in OpenGLXm mode.
+- Changed some objects to references for efficiency.  E.g.:
+  const G4Vector3D& vp = pView->fVP.GetViewpointDirection ().unit ();
+
+18th January 2001  John Allison
+- Corrected G4PhysicalVolumeModel.  This corrects a bug whereby the
+  requested drawing of a physical volume and its decendants starting
+  at a depth greater than 2 was incorrectly positioned on the screen.
+- /vis/scene/include commands withdrawn - use equivalent commands
+  /vis/scene/add.
+- OpenGL: cosmetic and minor performance improvements.
+
+16th January 2001  John Allison  (vis-03-00-00)
+- All vis commands "available" in all G4 states.
+- Other small cosmetic changes to commands.
+- OpenGL: square and circle markers correctly rendered.
+  Note: subsequent rotations in stored mode also rotate these markers.
+- Some small changes to test  - see test/History.
+
+2nd November 2000  Gunter Folger  (vis-V02-00-02)
+- Added targets includes and clean_libs to visualization/GNUmakefile.
+
+18th October 2000  John Allison  (vis-V02-00-01)
+- G4PhysicalVolumeModel: protected against volumes without material.
+- Removed /vis/viewer/update from compound commands /vis/drawVolume
+  and /vis/specify.
+- Updated comments in G4VisManagerRegisterMessengers.cc.
+
+19th August 2000  John Allison  (vis-V02-00-00)
+- Fixed bug in /vis/lights/direction - now does not refresh view.
+- Corrected "scene" where it should read "scene handler" in some
+  comments and output statements.
+
+3rd July 2000  John Allison
+- Explicitly initialised all data members of G4ViewParameters in constructor.
+
+9th June 2000  John Allison  (vis-V01-01-06)
+- Tagged for system testing.
+
+8th June 2000  Guy Barrand
+- OPACS/src/G4GoSceneHandler.cc : correct polyhedron 
+  wire-frame in order to remove some edges. Now the
+  rendering is the same than for OpenGL driver.
+   This was requested for long by ALICE, and had been
+  requested for ATLAS by Gaston Parrour recently.
+
+7th June 2000  John Allison
+- /vis/viewer/update preferred, synonym /vis/viewer/show deprecated.
+
+7th June 2000  Makoto Asai
+- Fix the flip view of RayTracer.
+
+2nd June May 2000  John Allison
+- Forced /control/verbose 2 for compound commands.
+
+20th May 2000  John Allison
+- Bug fix in G4PhysicalVolumeModel for replicas (Guy Barrand).
+
+26 May 2000  Guy Barrand
+- management/src/G4VisCommandsScene.
+  Protect against a null pointer for aScene in NotifyHandlers::SetNewValue.
+- OPACS/src/G4WoViewer.cc :
+  Change camera name checking so that a viewer created
+  by the GUI (Wo) could be hooked.
+- OPACS/src/G4GoSceneHandler.cc :
+  Change circle rendering.
+- OpenInventor/G4OpenInventorSceneHandler : protect against null pointers.
+
+22nd May 2000  John Allison  (vis-V01-01-05)
+- Many bug fixes from in OpenGL (opengl-V01-01-00) - see OpenGL/History.  Main
+  features:
+  o workaround for bug in Mesa which slowed OpenGLXm (Guy Barrand).
+  o multiple OpenGLXm windows no longer cause crash on exit (Guy).
+- modeling-V01-01-00: Added G4VTreeGraphicsScene (DTREE).
+- G4Scene::IsEmpty if empty of RunDurationModels - VisManager adds world in
+  this case.
+
+18th/19th May 2000  John Allison
+- Introduced some /vis/viewer/set commands.
+- /vis/scene/include/trajectories changed to /vis/scene/add/trajectories.
+  Similarly hits.  (Old commands kept but deprecated.)
+- G4ViewParameters.cc: bug fix in density culling printing.
+- G4VisCommandsSceneHandler.cc: bug fix in /vis/sceneHandler/create.
+- G4VisManagerRegisterMessengers.cc: improved comments.
+
+18th May 2000  John Allison  vis-V01-01-04
+- Included DAWN-V01-01-04: Automatic filename incrementation is made default.
+
+15th May 2000  John Allison
+- Added compound commands /vis/open, /vis/drawVolume and /vis/specify.
+- /vis/viewer/reset now resets *all* view parameters.
+- Fixed double application of transformation in /vis/scene/add/volume.
+- Fixed verbosity parameter in /vis/scene/list.
+- Made G4BoundingSphereScene::PreAddThis non-inline.
+
+13th May 2000  John Allison
+- Redefined current target point to be *relative* to standard target point.
+  (No longer necessary to initialize current target point in G4VViewer
+  constructor.  The fix of 4th May is reversed.)
+
+11th May 2000  Satoshi Tanaka vis-V01-01-03
+- In G4DAWNFILEViewer.cc, 
+  <       strcpy( fPSViewer, "ghostview" );
+  ---
+  > //    strcpy( fPSViewer, "ghostview" );
+  >       strcpy( fPSViewer, "gv" );
+
+
+4th May 2000  John Allison
+- Tidied comments in G4VisManagerRegisterMessengers.cc.
+- Initialize current target point in G4VViewer constructor.
+- Re-implemented /vis/viewer/reset to change view parameters of
+  viewer directly.
+
+2nd May 2000  John Allison  vis-V01-01-02
+- Added /vis/viewer/reset.
+- G4VSceneHandler, G4VViewer, G4OpenGLXmMainMenubarCallbacks: corrected
+  some name anomolies - "scene" was still being used in places where it
+  meant "scene handler".
+- G4VViewer: added GetShortName(), corrected SetName(...).
+- G4ViewParameters.hh: improved class description.
+- G4VisManager: added ViewerShortName(...) and GetViewer(...) utilities.
+- G4RayTracer: set out-of-world ray to black.
+- G4RayTracerViewer: corrected trapping of orthogonal projection.
+- Some minor enhancements to tests.
+
+27th April 2000  Gabriele Cosmo
+- Removed unnecessary #include "G4Transform.hh" from VRML.  (Since
+  geometry-V01-01-02 G4Transform.hh no longer exists.)  
+
+27th April 2000  John Allison
+- Updated README file.
+
+12th April 2000  John Allison  vis-V01-01-01
+- Made G4PhysicalVolumeModel::DescribeSolid virtual.
+- G4PhysicalVolumeModel::DescribeSolid no longer deals with composite
+  solids - now programmed into CompositeSolid::CreatePolyhedron, where
+  CompositeSolid means G4IntersectionSolid, G4SubtractionSolid and
+  G4UnionSolid.
+- G4PhysicalVolumeModel::DescribeSolid no longer deals with displaced
+  solids - now programmed into G4DisplacedSolid::CreatePolyhedron.
+- Added G4LogicalVolumeModel::DescribeSolid, which explicitly adds
+  components of composite solids as white forced-wireframe objects.
+- Removed unnecessary #includes from G4VSceneHandler.hh which required
+  consequent inclusion in many other scene handlers and viewers.
+
+7th April 2000  John Allison  vis-V01-01-00
+- Modified GNUmakefiles for restructured geometry.
+
+29th February 2000  John Allison  vis-V01-00-06
+- Changed `char*' to `const char*' in G4FRClientServer::Err(...).
+
+28th February 2000  John Allison
+- Cosmetic improvements to G4RayTracerSceneHandler.hh and G4RayTracerViewer.hh.
+
+24th February 2000  John Allison
+- Minor inmprovement of messages from /vis/viewer/refresh.
+- Cosmetic tidying in G4OpenGLViewer.cc.
+- Added protection for null viewer in G4RTSteppingAction.cc and
+  G4RayTrajectory.cc.
+- Corrected for zoom, etc., in G4RayTracerViewer.cc.
+
+23rd February 2000  John Allison
+- Added G4RayTracerSceneHandler and Viewer.
+- Some modifications to other RayTracer routines for vis compliance.
+- (Note: headAngle still not right - ray traced views are sometimes tipped.)
+
+23rd February 2000  John Allison  vis-V01-00-05
+- Includes raytracer-V01-00-01a which is original version plus fixes for
+  ISO compliance.
+
+21st February 2000  John Allison
+- /vis/viewer/refresh no longer invokes ShowView().
+- G4VViewer: introduced data member fShortName.
+- Added G4RTSteppingAction and G4RayTrajectory to list of G4VisManager's
+  friends.
+- Improved G4VisManager::CreateSceneHandler() and CreateViewer() and
+  handling of error in G4VisCommandSceneHandler::Create() and
+  G4VisCommandViewer::Create().
+- OpenGL: char* becomes const char*.  Small output text improvement.
+- test: some changes for Ray Tracer.  Boolean intersection instead of union.
+
+02 February 2000  Guy Barrand
+- OPACS/src/G4XoViewer.cc : change WaitForNotify signature to 
+  be able to compile with DEC-cxx 6.1.
+
+vis-V01-00-04 29th January 2000  Satoshi Tanaka
+- CVS tag is assigned to the Makoto's committing below.
+
+29th January 2000  Makoto Asai
+- Introduction of G4RayTracer (visualization/RayTracer/...)
+- Migration of G4RayTracer
+  affected files :
+    visualization/GNUmakefile
+    visualization/management/include/MyVisManager.cc
+    visualization/management/src/G4VisManager.cc
+  affected files in other directory :
+    config/G4VIS_BUILD.gmk
+    config/G4VIS_USE.gmk
+
+vis-V01-00-03  17th January 2000  John Allison
+- Added protection for no voxelisation in G4LogicalVolumeModel.cc.
+- Changed endl to G4endl in G4VisCommandsViewer.cc and G4GoSceneHandler.cc.
+
+14th January 2000  John Allison
+- Added protection for no viewer in G4VisCommandsViewer.cc.
+
+vis-V01-00-02  11th January 2000  John Allison
+- General handling of displaced solid (G4PhysicalVolumeModel).
+- Introduced /vis/viewer/show (/vis/viewer/update is synonym).
+- Improved printing in /vis/camera/reset.
+
+vis-V01-00-01  27th December 1999  Satoshi Tanaka
+- VRML-V01-00-00 27th December 1999  Satoshi Tanaka
+- G4endl ==> "\n" for fDest objects ... for ISO standard C++ compiler
+
+vis-V01-00-00  16th December 1999  John Allison
+- (Note: NOT FOR SYSTEM TESTING - this tag still has problems with
+   displaying logical volumes and text.)
+- Added /vis/viewer/refresh.
+- Rationalised command lists for keeping parameter lists up to date,
+  G4VVisCommand::sceneNameCommands, etc.
+- Added AddThis(const G4Polycone&), etc., to prevent hiding warnings.
+- Developments in test - see test/History.
+
+vis-V00-01-14a  7th December 1999  John Allison
+- Added `class' keyword in friend statement in G4VisStateDependent.hh
+  to keep HP happy.
+
+vis-V00-01-14  6th December 1999  John Allison
+- Invert rotation of boolean component in G4PhysicalVolumeModel.cc.
+
+vis-V00-01-13  Satoshi TANAKA  Dec 01, 1999
+- DAWN-V00-01-08
+- Removed implicit casting from the previous updation
+
+vis-V00-01-12  Satoshi TANAKA  Nov 30, 1999
+- DAWN-V00-01-06
+- Fixing improper definition of alpha1, alpha2
+
+vis-V00-01-11  29th November 1999  John Allison
+- Introduced helper class G4VisStateDependent to decouple G4VisManager from
+  G4StateManager, G4RunManager, etc.
+- Archived old directoris inside test subdirectory.
+
+vis-V00-01-10  25th November 1999  John Allison
+- Adapted relevant header files of modeling and management for
+  Software Reference Manual.
+
+vis-V00-01-09  23th November 1999  Satoshi Tanaka
+- Protection to ill-defined G4Trap in AddThis() 
+
+vis-V00-01-08  10th November 1999  John Allison
+- Added capability of viewing Boolean solids - coworks with geometry-V00-01-01.
+- Fixed bug in G4VViewer to maintain proper status of fNeedKernelVisit.
+- Added Boolean solids to test/src/MyDetectorConstruction.cc.
+- Added circle to represent end of step in test/src/MySteppingAction.cc.
+
+vis-V00-01-07  5th November  John Allison
+- Added /vis/viewer/update [<viewer-name>].
+- Some groundwork for /vis/scene/edit.
+- Added additional check in G4VisManager::IsValidView().
+- G4VSceneHandler::ClearStore() invokes fpViewer -> NeedKernelVisit().
+  (After a clear of the graphical database it is necessary to do this.
+  So if a derived class redefines, it must still invoke this base
+  class method.
+- G4Scene::AddRunDurationModel(), AddWorldIfEmpty(), AddEndOfEventModel():
+  avoid duplicate models and flag with G4bool return argument.
+- G4VisCommandsSceneAdd: respect the above G4bool return value.
+- G4Scene::AddRunDurationModel(): remove temporary workaround for old CLHEP
+  non-const problem.
+- Added 3rd template argument of map (to keep Sun CC 4.2 happy) in
+  G4OpenGLStoredSceneHandler.hh and G4OpenInventorSceneHandler.hh.
+- G4OpenGLStoredSceneHandler::ClearStore() and
+  G4OpenInventorSceneHandler::ClearStore() invoke base class function
+  G4VSceneHandler::ClearStore().
+
+VRML-V00-01-01 4th November 1999  Satoshi Tanaka
+- Introduction of VRMLBeginModeling() for new vis commands  
+- Updation and tagging of visualization/VRML/
+  and this History file 
+
+DAWN-V00-01-04  04th November 1999 Satoshi TANAKA  
+- Protection to AddPrimitive( G4NURBS )
+- Updation and tagging of visualization/FukuiRenderer/
+  and this History file
+
+DAWN-V00-01-03  02nd November 1999 Satoshi TANAKA
+- Updation and tagging of visualization/FukuiRenderer/
+  and this History file
+- Environmental variable G4DAWN_MULTI_WINDOW is	
+  renamed to G4DAWNFILE_MULTI_WINDOW for DAWN-file driver.
+  (G4DAWN_MULTI_WINDOW	still works for a while.)
+
+DAWN-V00-01-02  01st November 1999 Satoshi TANAKA
+- Updation and tagging of visualization/FukuiRenderer/
+  and this History file
+- Separation of BeginModeling() and FRBeginModeling().
+  Co-workable with /run/beamOn with the new vis commands.
+
+29 Oct 1999  Guy Barrand
+- Modify  G4Xo.cc to not load G4Xo.xrm resource file.
+  Resource must be grouped in some g4.xrm file.
+
+vis-V00-01-06  25th October 1999  John Allison
+- No longer update view parameters in /vis/scene/add/volume, etc.
+- Change G4RWTValHashDictionary to G4std::map in G4OpenGLStoredSceneHandler
+  and G4OpenInventorSceneHandler (needs global-V00-01-03).
+
+11 Oct 1999  Guy Barrand
+- G4GoSceneHandler.cc/G4GoSceneHandler::EndPrimitives : modify
+  the logic of setting the OMatrix for Go objects in order
+  to avoid the usage of the CLHEP/Rotation.getAngleAxis that
+  clearly has precision problem on some platforms (at least 
+  Linux and HP-UX).
+
+vis-V00-01-05  4th October 1999  John Allison
+- Implemented /vis/scene/add/logicalVolume.
+- Added G4LogicalVolumeModel.
+- Augmented G4PhysicalVolumeModel so G4LogicalVolumeModel could inherit.
+- Updated G4BoundingSphereScene and G4PhysicalVolumeSearchScene to
+  implement extra virtual functions in G4VSceneHandler interface.
+- Moved virtual destructor G4VModel::~G4VModel to non-inline implementation.
+- Tidied G4VSceneHandler.
+
+vis-V00-01-04 30 Sep 1999  Satoshi Tanaka
+- RW/STL dependence was removed from VRML 1.0 driver
+
+15 Sep 1999  Guy Barrand
+- Modify  G4OpenGLStoredSceneHandler.cc to compile on Linux-g++ with STL.
+
+vis-V00-01-03  27th August  John Allison
+- Modified GNUmakefile to prevent building of global libraries.
+
+vis-V00-01-02  27th August  John Allison
+- Eliminate residual references to G4Ray.
+- Improved some informational printing in G4VisManager::IsValidView.
+- G4Vis
+Manager::SetCurrentGraphicsSystem no longer gives spurious warnings.
+- Improved README (change `gmake global' to plain `gmake').
+
+vis-V00-01-01 26th August Satoshi TANAKA
+- Protection for invalid calling of BeginModeling
+- .DAWN.history ==> .DAWN_1.history 
+   **** It means DAWN version 3.80a or  after is  required ***
+
+vis-V00-01-00  24th August Satoshi TANAKA
+- Improved README.
+
+vis-01-00-15a  3rd July 1999  John Allison
+- Improved README (Guy).
+- Corrected a fprintf statement in G4OpenGLXViewer::spewWireframeEPS.
+
+vis-01-00-15  29th June 1999  John Allison
+- Moved #include <rw/tvhdict.h> from G4OpenGLSceneHandler.hh to .cc.
+- Corrected #ifdef G4VIS_BUILD_OPENGL_DRIVER in G4OpenGLXViewer.hh.
+
+vis-01-00-14  19th June 1999  John Allison
+- Removed references to G4Ray from GNUmakefile.
+- Archived (cvs removed) all G4Ray files.
+- Cosmetic change to an output statement in G4VisToOldVisCommands.cc/
+
+vis-01-00-13  1st June 1999  John Allison
+- Updated README for May Release (Satoshi, John).
+- Removed G4Ray from tag.
+
+31 Mai 1999  Guy Barrand
+- G4XoViewer : remove enabling/disabling XoCamera popup menu logic. 
+  In some situation (N03) we were loosing the XoCamera popup menu. 
+- G4XoViewer : correct ClearStore, ClearTransientStore.
+
+vis-01-00-12a  26th May 1999  John Allison
+- G4TrajectoriesModel.cc: (*TC) [iT] -> DrawTrajectory ();
+
+vis-01-00-12  25th May 1999  John Allison
+- Moved global operator != to member function.
+- Updated OPACS to handle "ClearTransientStore" (Guy).
+
+vis-01-00-11  12th May 1999  Guy Barrand
+- G4VSceneHandler : ClearTransientStore.
+- G4VisCommandsSceneHandler : protect against a null pointer.
+- OpenInventor : use HEPVis/SoWindow to create windows (needed 
+  on NT). Implement the a "transient scene graph" for "event"
+  things. Use fXxx convention for fields.
+- G4TrajectoriesModeling : do not draw a "marker" at each step by default. 
+
+vis-01-00-10  10th May 1999  John Allison
+- Acted upon Code Wizard reports.  Mainly made destructors virtual.
+
+vis-01-00-09  28th April 1999  John Allison
+- Changes for UserAction classes.
+
+vis-01-00-08  John Allison
+- Changes by Paulo Mora de Freitas for decoupling vis from parameterisation.
+
+18th April 1999  John Allison
+- Added "defined" after || in VRML1(1)(File).hh.  (Some preprocessors
+  give an error without it.)
+
+vis-01-00-07  15th April 1999  John Allison
+- Replaced visualization/test/GNUmakefile by a simple one using binmake.gmk.
+- Added CPPFLAGS += -I$(G4BASE)/intercoms/include to some GNUmakefiles ready
+    for the move of G4VGraphicsScene to intercoms.
+
+vis-01-00-06  29th March 1999  John Allison
+- Platform dependency fix in G4VisCommandsScene.cc.
+
+vis-01-00-05  7th February 1999  John Allison
+- management: - Added /vis/scene/notifyHandlers.
+              - Added virtual functions AddThis (const G4Polycone and
+                G4Polyhedra to G4VSceneHandler
+              - Moved some code from G4VisManager to G4Scene::AddWorldIfEmpty.
+              - Various refinements and bug fixes.
+- modeling: Augmented G4PhysicalVolumeSearchScene and G4BoundingSphereScene
+            See modeling/History.
+- OpenGL: - Corrected edgeCount check for triangles in
+            G4OpenGLSceneHandler::AddPrimitive (const G4Polyhedron&).
+          - Added (long unsigned int) cast in G4OpenGLXmRotationCallbacks.cc.
+          - Added SetView and ShowView to G4OpenGLXViewer:
+              // To force change of context...
+              void G4OpenGLXViewer::SetView () {
+                glXMakeCurrent (dpy, win, cx);
+                G4OpenGLViewer::SetView ();  
+              }
+              // Hopefully to get better flushing in DEC OpenGL...
+              void G4OpenGLXViewer::ShowView () {
+                glXWaitGL ();
+                glFlush ();
+              }
+
+
+vis-01-00-04 11th January 1999  John Allison
+- Completed change of names from scene to sceneHandler, view to viewer.
+- Vis manager and scene handlers now keep pointer to scene, rather than a copy.
+- G4SceneList now a simple G4RWTPtrOrderedVector.
+- /vis/camera/reset now resets viewpoint direction and up vector.
+
+vis-01-00-03 10th January 1999  John Allison
+- Added flags for viewing geom, hits, digis to G4ModelingParameters.
+
+vis-01-00-02  9th January 1999  John Allison
+- Changed Scene to SceneHandler, View to Viewer.
+
+vis-01-00-01  6th January 1999  John Allison
+- Made G4VisManager::GetInstance() private to prevent inadvertent misuse.
+- Removed #include GNU_GCC - no longer necessary for egcs.
+- Continued developing the new commands.
+
+vis-00-04-04  16th December 1998  John Allison
+- test/GNUmakefile for Linux-g++
+- test/test19.cc - removed g4templates.hh
+- OpenGL - reverted to 100%.
+
+vis-00-04-03  9th December 1998  John Allison
+- Made /vis/ commands from /vis~/.  The idea is to maintain backwards
+  compatibility while allowing us to "deprecate" the old commands over
+  a period of time.  Some of these /vis/ commands respond with "superceded",
+  i.e., superceded by new commands, but still available in /vis~/.
+- OpenGL viewing volume increased by 20% to prevent corners being clipped.
+
+- 08/12/98 : G.Barrand : OpenInventor : due to 
+  huge load problems on various platforms, init only
+  the HEPVis things that are needed.
+
+vis-00-04-02  30th November 1998  Satoshi Tanaka
+- G4VRMLFILE_DEST_DIR for customising out file name - see VRML/History.
+
+29th November 1998
+- Added CPPFLAGS += -I....electromagnetic/utils/include to test/GNUmakefile.
+- Added fName to G4SceneData.
+
+vis-00-04-01  25th November 1998  John Allison.
+- G4Ray/GNUmakefile update for move of files in particles.
+- Added const G4VisAttributes* fpDefaultVisAttributes and access
+  functions to G4ModelingParameters.
+- Reverted to default assignment operator and copy constructor for
+  G4ModelingParameters and G4ViewParameters.
+- G4PhysicalVolumeModel can now handle invisible daughters.
+- More new /vis/ commands - depends on intercoms-00-04-01.
+- G4VScene passes DefaultVisAttributes* to ModelingParameters.
+
+vis-00-03-07  23rd November 1998  John Allison.
+- modeling/GNUmakefile update for move of files in particles (Hisaya).
+- Removed semi-colon in G4BoundingSphereScene.cc.
+
+vis-00-03-06  9th November 1998  John Allison.
+- Small change to a message in G4VisManager.
+- VRML refinement - see VRML/History.
+- Needs greps-00-03-03.
+
+vis-00-03-05b  9th November 1998  John Allison.
+- Merged 6th November changes with vis-00-03-05a
+- Bug fix in G4VisManager::IsValidView for batch running.
+- Needs greps-00-03-03.
+
+vis-00-03-05a  9th November 1998  Satoshi Tanaka
+- VRML 2.0 Visualization driver is added to 
+  management/include/MyVisManager.cc.
+
+vis-00-03-05  9th November 1998  Satoshi Tanaka
+- VRML 2.0 Visualization driver is commited:
+ (1) Generatin of VRML 2.0 format files to describe Geant4 simulation.
+ (2) Interactive displaying of physiccal-volume names and copy numbers
+ (3) Interactive displaying of hit positions (displayed strings are
+     costomizable.
+ (4) Wireframe drawing style of Geant4 visualization is reflected as
+     transparency = 0.7.  This value is customizable.
+     If transparency is 1.0, drawing of detector geometry is skipped,
+     and hits can be picked easily.
+
+6th November 1998  John Allison
+- Implemented basic /vis/viewer commands.
+- Added `const G4String& name' argument to G4VScene and G4VView constructors.
+
+vis-00-03-04  30th October 1998  John Allison
+- Tagged.
+
+29th October 1998  Guy Barrand
+- G4OpenGLXView.hh, G4OpenGLXmView.cc, G4OpenGLXmWindowHandlingCallbacks.cc
+  in order that things compile and compile without warnings on HP/aCC
+
+14th October 1998  John Allison
+- Augmented the new /vis/ commands.  Still not complete but they
+  co-work with the old commands.
+- Changed char* fName to G4String fName in G4VScene and G4VView.
+  Consequent changes in G4OpenGLView.  Also OpenInventor?  Etc.
+
+11th October 1998 Andy Walkden
+- added (not a very good) version of hidden lines removal code. This code 
+  suffers from depth buffering artefacts. glPolygonOffset is a feature of 
+  OpenGL version 1.1, and can help overcome depth buffer problems. The code 
+  to utilise glPolygonOffset is committed, but commented out, as it doesn't 
+  seem to work with the version of Mesa available on rsplus currently. My 
+  ideal strategy is to enable depth testing, draw the model as lines, enable 
+  filled polygon offsetting (glPolygonOffset(1.0 /*offset scale factor*/, 
+  2/*offset bias*/); glEnable (GL_POLYGON_OFFSET_FILLED);) then draw the 
+  model as filled polygons. The offsetting should just add `2' (in window 
+  coordinates, I think) onto the z value of all vertices relating to filled 
+  polygons, thus dismissing the conflict between almost identical z values 
+  for lines and filled polygon edges.
+
+vis-00-03-03 9th October 1998  John Allison
+- G4VisManager inherits G4VStateDependent.  This is used to draw
+  end-of-event models.
+
+4th October 1998 Andy Walkden
+- Added ability for all G4OpenGLX derived graphics systems to produce
+  vectored PostScript hardcopy. Facility for `automated screen dump'
+  (i.e. pixmap output) still kept, as some rasterization features
+  don't make it into the vectored PostScript output (such as haloing
+  effects). Facility currently available via G4OpenGLXm by clicking
+  `Miscellany' then `Create .eps file', to get a popup printing
+  window.
+
+vis-00-03-02a  26th September 1998  
+- DAWNFILE driver is made platform dependent.
+  (It is now compilable both at both Unix and NT without necessity
+   of C macros like WIN32.)
+
+vis-00-03-02  25th September 1998  
+- DAWNFILE driver is ported to VC++
+
+vis-00-03-01  24th September 1998  John Allison
+- Eliminated G4VPhysicalVolume* fpWorld data memebr from G4VisManager.
+
+22th September 1998 Guy Barrand.
+- Correct modeling, management, G4Ray /GNUmakefile to have
+  correct digits+hits includes.
+
+19th September 1998 Guy Barrand.
+- Due to a correction in globals.h restore correct code
+  so that OpenInventor files compile correctly on NT.
+
+vis-00-02-06  31st August 1998  John Allison
+- Added G4VModel::Validate() and in subclasses.
+- Reverted to default copy constructir and assignment operator in G4SceneData.
+- Implemented G4VisManager::GeometryHasChanged().
+- Switched on echoing of commands and history mechanism in test19.g4m.
+
+vis-00-02-05  27th August 1998  John Allison
+- Added G4HitsModel and G4TrajectoriesModel.
+- Added /vis/scene/include/hits and trajectories, and some bug fixes.
+
+vis-00-02-04  22nd August 1998  John Allison
+- Many changes in modeling - see modeling/History.
+- New commands: /vis/scene/create, list, add/volume, add/ghosts.
+
+vis-00-02-03a  20th August 1998  John Allison
+- Restored some code in G4SceneData.cc
+- Fixed syntax bug in G4PhysicalVolumeSearchScene.hh
+
+vis-00-02-03  14th August 1998  John Allison
+- Added G4VisManager::GeometryHasChanged() - run manager can notify change.
+- Removed AddRun(Event)DurationModelToCurrentSceneData - no longer used.
+- Some bug corrections in visualization/OpenGL (Guy Barrand - see
+  vis blackboard for details).
+- Some protection added in visualization/OPACS (do.)
+- Created visualization/test/OPACS (do.)
+
+12th August 1998  John Allison
+- More new commands - not fully functional yet.
+
+11th August 1998  Guy Barrand
+- G4OpenInventor : remove uneccesary includes.
+
+vis-00-02-02b  11th August  Satoshi Tanaka
+- AddPrimitive() for polymarker are implemented in DAWN and VRML drivers.
+
+vis-00-02-02a  9th August  John Allison
+- Small bug fix in G4VisCommandsScene.cc.
+
+vis-00-02-02  9th August  John Allison
+- Changed '.' to '-' in scene/view names.
+- Began introduction of new /vis/ commands.
+- Consequent changes to test - see test/History.
+
+7th August  Guy Barrand.
+- OPACS : use G4VView name to build widget names.
+- OPACS : use new interactor parenting logic.
+- OpenGL, OpenInventor, G4Ray : clean compilation warnings for OSF1/cxx, HP/aCC.
+
+7th August  John Allison/Satoshi Tanaka/Guy Barrand.
+- Added G4<driver>Scene::AddPrimitive (const G4Polymarker&) to keep
+  compilers happy.
+
+vis-00-02-01  6th August  John Allison
+- Created G4VisManagerRegisterMessengers.cc.
+- Bug fix in G4VisManager: now follows change of world volume after
+  /vis~/clear/scene.
+- OpenInventor: Correct some upper -> lower case mess (Guy Barrand)
+- G4RayView: syntax bug fixes.
+
+4th August 1998 Andy Walkden
+I made some changes to OpenGL code...
+The changes are (i) to tidy up some redundant hidden line 
+removal function calls, (ii) to put some hidden line removal 
+code in G4OpenGLScene::AddPrimitive(G4Polyhedron) and 
+(iii) to add an option to generate an encapsulated postscript 
+file of the current view in OpenGLXm. There is now a button 
+in the Miscellany pulldown of the main menubar to bring up 
+a shell in which you can specify a filename, colour or black 
+and white and request the creation of a .eps file. The 
+code is to be found in G4OpenGLXView, and so is not bound 
+to the Xm user. Also it needs fixing for some Mesa 
+implementations, and the HP CDE environment manages to stuff 
+things up when rendering to a pixmap (although CDE makes a 
+mess of most other things as well, so this isn't
+disastrous).
+
+
+vis-00-01-08  21th July 1998  John Allison
+- Removed automatic refresh from /vis/camera/reset in G4VisCommandsCamera.cc.
+
+vis-00-01-07b  21th July 1998  Satoshi Tanaka
+- Revised G4FRSCENE::SendBoundingBox() so that 
+  zooming polycy of  DAWN drivers becomes consistent with 
+  OpenGL drivers
+
+vis-00-01-07  20th July 1998  John Allison
+- Corrected bug in G4VisManager::IsViewValid to trap drawing commands
+  before geometry is available.
+
+vis-00-01-06  19th July 1998  John Allison
+- Default culling: culling - on, culling of invisible objects - on.
+- set/drawing_style does *not* change culling flags.
+- Minor bug fixes.
+
+vis-00-01-05  15th July 1998  John Allison
+- Cleaned up after name changes.
+- Minor bug fixes.
+
+vis-00-01-04  7th July 1998  Guy Barrand
+- Introduced interactivity.gmk into GNUmakefiles.
+
+vis-00-01-03  6th July 1998  John Allison
+- Changes for interface restructuring.
+- Simplified MyVisManager.
+
+vis-00-01-02  5th July 1998  John Allison
+- Changed visualization/GNUmakefile to use globlib.gmk.
+- Updated README for geant4beta.
+- Changed /vis~/draw/Ghosts to /vis~/draw/ghosts.
+
+vis-00-01-01  4th July 1998  John Allison
+- Moved G4VIS_BUILD.gmk and G4VIS_USE.gmk to geant4beta/config.
+- Changed /vis/ to /vis~/.
+
+3rd July 1998  John Allison
+- Small changes to test - see test/History.
+- Tidied.
+- Removed GNUmakefile.G4VIS_USE and make_list.sh.
+
+30th June 1998 - Paulo & Marc
+- added the G4FlavoredParallelWorldModel.hh file to 
+  visualization/modeling/include;
+- added the /vis~/draw/Ghosts [particle name] command
+  in the G4VisManMessDraw.cc file;
+- added 
+  CPPFLAGS += -I$(G4BASE)/geometry/magneticfield/include and
+  CPPFLAGS += -I$(G4BASE)/processes/parameterisation/include
+  lines to GNUmakefile to compile G4VisManMessDraw.cc.
+
+geant4beta
+============================================================
+geant4alpha
+
+vis-00-06-09  26th June 1998  John Allison
+- OPACS and Open Inventor - something about widget parents (GB)
+- Removed /new_vis/ commands.
+
+vis-00-06-08a  26th June 1998 Satoshi Tanaka
+- Updated G4VIS_USE.gmk
+- (1) Macro -DG4VIS_USE_DAWNFILE is made properly set
+- (2) G4VIS_USE_DAWN_ is renamed to G4VIS_USE_DAWN_OR_DAWNFILE
+- (3) G4VIS_USE_VRML_ is renamed to G4VIS_USE_VRML_OR_VRMLFILE
+
+vis-00-06-08  22nd June 1998  John Allison
+- Changed G4BASE = ../.. to G4BASE = $(shell (cd ../..; pwd))
+- Changed GNUmakefile.G4VIS_BUILD to G4VIS_BUILD.gmk
+
+vis-00-06-07  19th June 1998  John Allison
+- Defined G4_SOLVE_VIS_TEMPLATES in G4VIS_USE.gmk.  Needs
+  the head version of GNUmakefile.architecture.
+- Consequential changes (improvements) to template handling in test19.cc
+- Some minor improvements in modeling.
+
+vis-00-06-06  11th June 1998  John Allison
+- Fixes to test_utils - see test/History.
+- Improvements in modeling - see modeling/History.
+
+vis-00-06-05  11th June 1998  Satoshi Tanaka
+- In G4VisManMessDraw.cc and G4VisManMessSet.cc , ...
+  //    G4double unit = G4UIcommand::valueOf (unitString);
+        G4double unit = G4UnitDefinition::GetValueOf (unitString);
+
+vis-00-06-04  10th June 1998  John Allison
+- Created G4VIS_USE.gmk to replace GNUmakefile.G4VIS_USE.
+- Changed test/GNUmakefile to use G4VIS_USE.gmk.
+- Separate libraries are now default in GNUmakefile.
+- Committed an interim version of README.
+- Moved G4BoundingSphereScene from management to modeling.
+- First attempt at defining the "scene" as lists of models.
+- Removed some unnecessary checks in G4VisManMess*.
+
+vis-00-06-03  27th May   1998  Satoshi Tanaka
+- DAWNFILE driver is added. It is to generate g4.prim file
+  under the current directory.  And make DAWN or DAVID invoke 
+  using the g4.prim file as an input. For details, see the blackboard 
+  document.
+
+21st May 1998 Andy Walkden
+- Added hidden line removal code to G4OpenGLView. HLR utilises OpenGL's
+  stencil buffer, but still the drawn lines are a little fragmented
+  (an effect seen often when depth buffering is used to resolve pixel
+  rendering disputes). 
+- HLR requires wireframe rendering, filled polygon rendering and then wireframe
+  rendering again. Hence, three visits to the kernel help to slow HLR
+  rendering right down.
+
+vis-00-06-02  20th May   1998  Satoshi Tanaka
+- Added G4VisFeaturesOfDAWNFILE.hh, cc
+- Revised visualization/GNUmakefile, GNUmakefile.G4VIS_BUILD,
+  GNUmakefile.G4VIS_USE
+- These are for DAWNFILE driver in preparation, which enables to
+  invoke DAVID directly from Geant4.
+
+vis-00-06-01a 20th May   1998  Satoshi Tanaka
+- code refinement of FukuiRenderer driver
+
+vis-00-06-01  29th April 1998  John Allison
+- Introduced non-pure virtual functions
+  Establish/DecommissionSpecials (G4PhysicalVolumeModel&) in
+  G4VGraphicsScene with implementation of the former in G4VScene.
+  Modified G4PhysicalVolumeModel to use it; also protected
+  G4PhysicalVolumeModel against non-implementation of
+  Establish/DecommissionSpecials.
+- Template instantiations in G4RayView made exclusive to GNU_GCC
+- Some minor changes under test - see test/History.
+
+27th April 1998 Andy Walkden
+- altered OpenGLView's structure a little. Now, G4OpenGLXmView is a
+  type of (inherits from) G4OpenGLXView.
+- made code for haloing effects common to all OpenGL views.
+- changed XUnmapWindow in G4OpenGLXView::~G4OpenGLXView to XDestroyWindow
+  (idea of Guy's)
+
+27th April 1998 Guy Barrand
+- vis/OPACS : remove Begin/EndModeling in G4GoScene.
+
+vis-00-05-06  23rd April 1998  John Allison
+- Changed test19.mac to test19.g4m and consequent change in test19.cc.
+- Fixed order of linking vis-a-vis -lG4track and -lG4tracking (GB).
+- Fixed inadvertent bug in test_utils/src/MyPhysicsList.cc.
+- Bug fix in G4OpenGLXmConvenienceRoutines.cc (GB).
+
+vis-00-05-05  21st April 1998  John Allison
+- Added run-time command line argument: test19 [<session-type>] [<verbosity>]
+- Removed #if GNU_GCC from template instantiation requests in test19.cc.
+- Added fDefaultTextVisAttributes to G4ViewParameters.
+- Added G4VScene::GetTextColour (changed G4FukuiRendererScene, G4GoScene and
+  G4OpenInventorScene.
+- Changed default view parameters: culling on and invisible object culling on.
+- Tidied CreateScene/View.
+- Continued BaBar development.
+
+15th April 1998  John Allison
+- Added test/EucIntfce/, test/Bogus/ and test/babar_utils/ for BaBar test code.
+  Also a new main() in BaBarCallListTest.cc.  Also a data file call_list.dat.
+  See babar_utils/README.
+- Camera commands, except spin and orbit, no longer initiate draw.
+- Text is blue for time being (visible on black or white background.)
+
+15th April 1998 : Guy Barrand
+- From discussion with John and Simone G4VToolkit 
+  has been renamed to G4VInteractorManager.
+
+vis-00-05-04a  11th April 1998  Satoshi Tanaka
+- Code improvements in DAWN driver
+- (1) View parameters are sent to DAWN only at drawing times.
+- (2) Way of getting marker size are made simpler by using
+-     G4VScene::GetMarkerRadius ()  etc.
+
+vis-00-05-04  8th April 1998  John Allison
+- Small bug fix - then tag for Easter.
+
+HEAD  6th April 1998  John Allison
+- Added error printing to G4OpenGLScene::AddPrimitive (const G4Text& text).
+- Added /vis~/draw/text.
+- Added units to /vis~/draw/axes.
+- Began the job of restructuring vis commands; so there is a new class
+  G4VisCommandsCameraMessengers for starters!
+
+HEAD  4th April 1998  John Allison
+- Removed automatic drawing after /vis~/set commands.  Now an explicit
+  redraw is necessary, but it allows you to change parameters during
+  building a view.  For example to superimpose projected hits on a
+  section:
+    /vis~/clear/view
+    /vis~/set/section_plane on 0 0 20 cm 0 0 1
+    /vis~/draw/current
+    /vis~/set/section_plane off
+    /run/beamOn
+- Fixed small bug in OpenGL for section drawing.
+- Made some small improvements in G4ViewParameters.
+
+vis-00-05-03  4th April 1998  John Allison
+- Re-engineered maintenance of current depth, etc.  Needed new method
+  G4VGraphicsScene::BeginModeling (G4PhysicalVolumeModel&) in
+  graphics_reps.  The result is much cleaner model and modeling
+  parameters classes.  Also, the current depth, physical volume and
+  logical volume are immediately available as protected pointers in
+  G4VScene.
+- Required G4VScene::Begin/EndModeling to be invoked from subclass.
+- Introduced G4NullModel to hold modeling parameters.  This avoids
+  having to create a G4VModel for each graphics primitive.
+
+HEAD  3rd April 1998  John Allison
+- Added GetMarkerDiameter/Radius to G4VScene.
+- Bug fix in G4VScene::GetMarkerSize.
+- Removed GetCurrentPhysicalVolume from G4PhysicalVolumeModel - now in
+  G4ModelingParameters (but might move again soon!).
+- test/GNUmakefile now uses "$(MAKE) separate" for vis libraries.
+- test19 recognises argument "1" as a verbose flag value.
+
+HEAD April 2, 98 G.Barrand
+- Modifications for Win32/NT.
+- G4VIS_BUILD_[OIX, OIWIN32]_DRIVER, G4VIS_USE_[OIX, OIWIN32]
+
+vis-00-05-02  26th March 1998  John Allison
+- Added GetMarkerSize to G4VScene.
+- Made ~G4VisManager virtual.
+- Added current logical volume and current physical volume to working
+  space in modeling parameters.  So it is no longer necessary to cast
+  to G4PhysicalVolumeModel; all such casts removed.
+- Moved nested classes out of G4RayView.
+
+HEAD March 24, 98 G.Cosmo
+- Modified G4VisManMessExpert.cc to correctly use random numbers
+  by calling directly G4UniformRand().
+
+HEAD March 24, 98 G.Barrand
+- GNUmakefile : MAKESHLIB changed in G4MAKESHLIB
+
+vis-00-05-01a  24 March 1998  Satoshi Tanaka
+- Geometry tree can be obtained by, e.g., 
+  % grep PVName g4.prim > g4.tree
+
+vis-00-05-01  23rd March 1998  John Allison
+- Made RegisterGraphicsSystems pure virtual.
+- Added verbose level control to printing at initialization.
+- Fixed (hopefully) bug in scene deletion.
+- Made AddPrimitive (const G4Text/Circle/Square) pure virtual.
+  (Had to add dummy void G4VRML1SCENE::AddPrimitive (const G4Text&).)
+- Made AddPrimitive (const G4Polymarker&) virtual again.
+- Opened some .hh files to G4VIS_USE flags.
+- Removed Pre/PostAddThis from some graphics systems (not OPACS, OI).
+- First implementation of G4ModelingParameters::hierarchy (DTREE).
+- Added Get Global/Current Tag/Description to G4VModel.
+- Introduced "working space" in G4ModelingParameters for geometry depth.
+- Relocated some template instantiation requests (might give trouble on DEC).
+
+vis-00-04-05a  16th March 1998  Satoshi Tanaka
+- DAWN driver outputs physical-volume names and copy number.
+
+vis-00-04-05  5th March 1998  John Allison
+- Added G4Text/Circle/Square in G4RayScene.hh.
+- Added G4Text/Circle/Square in G4BoundingSphereScene.hh.
+- Made AddPrimitive (const G4Polymarker&) non-virtual in G4VScene.hh.
+
+HEAD  5th March 1998  Andy Walkden
+- Implemented G4Circle/Square.
+- Added haloing to OpenGLXm "value added" options.
+
+HEAD  5th March 1998  S.Sadilov
+- visualization/GNUmakefile - using $OUT_LIB intoduced in
+  GNUmakefile.architecture
+- visualization/management/GNUmakefile - compiling G4VisManMessSet.cc
+  without optimization on WinNT
+
+vis-00-04-04a  5th March 1998  Satoshi TANAKA
+- Environmental variables  to customized DAWN driver is
+  renamed from DAWN_... to G4DAWN_...
+- Default mode of DAWN driver is  EPS mode, i.e. 
+  mode in which EPS files are generated.
+
+vis-00-04-04  4th March 1998  John Allison
+- First tag with modeling under visualization.
+  Here's what you need to do...
+    cd prototype
+    cvs update -A -d -P modeling
+    cd visualization
+    cvs update -r vis-00-04-04 -d -P
+  Change the following lines in your GNUmakefile...
+    CPPFLAGS += -I../../visualization/modeling/include
+    LDFLAGS  += -L../../visualization/modeling/$(G4SYSTEM)
+    Remove: @cd ../../modeling      &&   $(MAKE)
+
+vis-00-04-03  4th March 1998  John Allison
+- Last tag with modeling at same level as visualization.
+- Renamed near and far (VC++ keywords) in G4ViewParameters.cc.
+- Removed unnecessary #include <strstream.h> or adapted for WIN32.
+
+vis-00-04-02b  22nd February 1998  Satoshi Tanaka
+- Split G4VIS_BUILD_VRML1_DRIVER into G4VIS_BUILD_VRML_DRIVER 
+                                 and  G4VIS_BUILD_VRMLFILE_DRIVER.
+- Split G4VIS_USE_VRML1          into G4VIS_USE_VRML           
+                                 and  G4VIS_USE_VRMLFILE.
+
+vis-00-04-02a  18th February 1998  John Allison
+- Bug fix in G4RayView!
+
+vis-00-04-02  18th February 1998  John Allison
+- Introduced /vis~/set/section_plane.
+
+vis-00-04-01  13th February 1998  John Allison
+- Made messengers compatible with the new style.
+
+vis-00-03-02a  3rd February 1998  John Allison
+- Bug fix for 02.
+- Changed GNUmakefile to use processes sub-libraries.
+
+vis-00-03-02  2nd February 1998  John Allison
+- Modernised messengers.
+
+vis-00-03-01a 29th January 1998  John Allison
+- Tagged a few improvement in OpenGL
+
+vis-00-03-01 26th January 1998  John Allison
+- Old environment variables abandoned - see visualization/README.
+- G4VisManager is now instantiated *and* deleted in main().
+- G4VisRegisterGraphicsSystem.icc replaced by
+  MyVisManager::RegisterGraphicsSystems as a way - now optional - of
+  a user overriding the default graphics system registration.
+
+Januray 20 , 98 G. Barrand
+
+- Implement object rotation in OPACS driver
+  
+Januray 19 , 98 G. Barrand
+
+- Correct OpenInventor code so that it is ANSI-C++
+  and then compiles with OSF1/cxx, HP-UX/aCC.
+
+7th January 1998  John Allison
+- Restructuring to use modeling category.
+
+December 19, 97 G. Cosmo - (alpha03)
+
+- 1st December 1997 - John Allison.
+- This is interim code for testing by the visualization
+  group and it will be tagged soon.  You must update to the
+  head of graphics_reps and visualization simulatanouesly.
+  It coworks (I hope - it's difficult to be 100% sure about
+  this since I have a few changes for other categories in
+  the pipeline - see previous email) with:
+    digits+hits              digi-00-02-01
+    events+tracks            event-00-02-01
+    geometry                 HEAD
+    global                   global-00-02-01
+    intercoms                intercoms-00-02-01
+    interfaces               interfaces-00-02-01
+    particle+matter          piim-00-02-01
+    run                      run-00-02-01
+    track                    track-00-02-01
+    tracking                 tracking-00-02-01
+- Addition of:
+    visualization/GNUmakefile.transition_to_G4VIS_BUILD
+    visualization/GNUmakefile.transition_to_G4VIS_USE
+    visualization/GNUmakefile.vis_cppflags_for_G4VIS_USE
+  to turn the existing environment variables into the
+  to-be-adopted G4VIS_... variables - see visualization/test/README.
+- Consequent changes to other visualization GNUmakefiles.
+- New way of instantiating graphics systems:
+  Set the appropriate environment variables and include and
+  compile G4VisRegisterGraphicsSystems.icc in your main():
+    ...
+    #include G4VisRegisterGraphicsSystems.icc
+    ...
+    main() {
+      ...
+- Added G4VisFeaturesOfXXX files which simple return a G4String.
+ (Guy, Jeff, would you like to join this scheme?)
+- Added commands /vis~/delete/scene and /vis~/delete/view.
+- Added /vis~/show/view to test19.odb.
+
+vis-00-02-01 to vis-00-02-05a not logged!!!
+
+vis-00-01-02  13th July 1997  John Allison
+- Consolidation of previous tag.
+
+vis-00-01-01  8th June 1997  John Allison
+- First systematic tag.
+- G4Ray introduced.
Index: tags/visualization-10.5-before-10.6_test/OpenGL/Doxyfile
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/Doxyfile	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/Doxyfile	(revision 1102)
@@ -0,0 +1,1093 @@
+# Doxyfile 1.3.4
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+#       TAG = value [value, ...]
+# For lists items can also be appended using:
+#       TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded 
+# by quotes) that should identify the project.
+
+PROJECT_NAME           = G4OpenGL
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. 
+# This could be handy for archiving the generated documentation or 
+# if some version control system is used.
+
+PROJECT_NUMBER         = vis-V05-01-01
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
+# base path where the generated documentation will be put. 
+# If a relative path is entered, it will be relative to the location 
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY       = $(G4WORKDIR)/tmp/$(G4SYSTEM)/G4OpenGL
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all 
+# documentation generated by doxygen is written. Doxygen will use this 
+# information to generate all constant output in the proper language. 
+# The default language is English, other supported languages are: 
+# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, Dutch, 
+# Finnish, French, German, Greek, Hungarian, Italian, Japanese, Japanese-en 
+# (Japanese with English messages), Korean, Norwegian, Polish, Portuguese, 
+# Romanian, Russian, Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian.
+
+OUTPUT_LANGUAGE        = English
+
+# This tag can be used to specify the encoding used in the generated output. 
+# The encoding is not always determined by the language that is chosen, 
+# but also whether or not the output is meant for Windows or non-Windows users. 
+# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES 
+# forces the Windows encoding (this is the default for the Windows binary), 
+# whereas setting the tag to NO uses a Unix-style encoding (the default for 
+# all platforms other than Windows).
+
+USE_WINDOWS_ENCODING   = NO
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will 
+# include brief member descriptions after the members that are listed in 
+# the file and class documentation (similar to JavaDoc). 
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend 
+# the brief description of a member or function before the detailed description. 
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the 
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF           = YES
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then 
+# Doxygen will generate a detailed section even if there is only a brief 
+# description.
+
+ALWAYS_DETAILED_SEC    = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all inherited 
+# members of a class in the documentation of that class as if those members were 
+# ordinary class members. Constructors, destructors and assignment operators of 
+# the base classes will not be shown.
+
+INLINE_INHERITED_MEMB  = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full 
+# path before files name in the file list and in the header files. If set 
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES        = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag 
+# can be used to strip a user-defined part of the path. Stripping is 
+# only done if one of the specified strings matches the left-hand part of 
+# the path. It is allowed to use relative paths in the argument list.
+
+STRIP_FROM_PATH        = 
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter 
+# (but less readable) file names. This can be useful is your file systems 
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES            = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen 
+# will interpret the first line (until the first dot) of a JavaDoc-style 
+# comment as the brief description. If set to NO, the JavaDoc 
+# comments will behave just like the Qt-style comments (thus requiring an 
+# explict @brief command for a brief description.
+
+JAVADOC_AUTOBRIEF      = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen 
+# treat a multi-line C++ special comment block (i.e. a block of //! or /// 
+# comments) as a brief description. This used to be the default behaviour. 
+# The new default is to treat a multi-line C++ comment block as a detailed 
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the DETAILS_AT_TOP tag is set to YES then Doxygen 
+# will output the detailed description near the top, like JavaDoc.
+# If set to NO, the detailed description appears after the member 
+# documentation.
+
+DETAILS_AT_TOP         = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented 
+# member inherits the documentation from any documented member that it 
+# reimplements.
+
+INHERIT_DOCS           = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC 
+# tag is set to YES, then doxygen will reuse the documentation of the first 
+# member in the group (if any) for the other members of the group. By default 
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC   = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. 
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE               = 8
+
+# This tag can be used to specify a number of aliases that acts 
+# as commands in the documentation. An alias has the form "name=value". 
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to 
+# put the command \sideeffect (or @sideeffect) in the documentation, which 
+# will result in a user-defined paragraph with heading "Side Effects:". 
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES                = 
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources 
+# only. Doxygen will then generate output that is more tailored for C. 
+# For instance, some of the names that are used will be different. The list 
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C  = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources 
+# only. Doxygen will then generate output that is more tailored for Java. 
+# For instance, namespaces will be presented as packages, qualified scopes 
+# will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA   = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of 
+# the same type (for instance a group of public functions) to be put as a 
+# subgroup of that type (e.g. under the Public Functions section). Set it to 
+# NO to prevent subgrouping. Alternatively, this can be done per class using 
+# the \nosubgrouping command.
+
+SUBGROUPING            = YES
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in 
+# documentation are documented, even if no documentation was available. 
+# Private class members and static file members will be hidden unless 
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL            = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class 
+# will be included in the documentation.
+
+EXTRACT_PRIVATE        = YES
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file 
+# will be included in the documentation.
+
+EXTRACT_STATIC         = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) 
+# defined locally in source files will be included in the documentation. 
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES  = YES
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all 
+# undocumented members of documented classes, files or namespaces. 
+# If set to NO (the default) these members will be included in the 
+# various overviews, but no documentation section is generated. 
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS     = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all 
+# undocumented classes that are normally visible in the class hierarchy. 
+# If set to NO (the default) these classes will be included in the various 
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES     = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all 
+# friend (class|struct|union) declarations. 
+# If set to NO (the default) these declarations will be included in the 
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS  = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any 
+# documentation blocks found inside the body of a function. 
+# If set to NO (the default) these blocks will be appended to the 
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS      = NO
+
+# The INTERNAL_DOCS tag determines if documentation 
+# that is typed after a \internal command is included. If the tag is set 
+# to NO (the default) then the documentation will be excluded. 
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS          = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate 
+# file names in lower-case letters. If set to YES upper-case letters are also 
+# allowed. This is useful if you have classes or files whose names only differ 
+# in case and if your file system supports case sensitive file names. Windows 
+# users are advised to set this option to NO.
+
+CASE_SENSE_NAMES       = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen 
+# will show members with their full class and namespace scopes in the 
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES       = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen 
+# will put a list of the files that are included by a file in the documentation 
+# of that file.
+
+SHOW_INCLUDE_FILES     = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] 
+# is inserted in the documentation for inline members.
+
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen 
+# will sort the (detailed) documentation of file and class members 
+# alphabetically by member name. If set to NO the members will appear in 
+# declaration order.
+
+SORT_MEMBER_DOCS       = YES
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or 
+# disable (NO) the todo list. This list is created by putting \todo 
+# commands in the documentation.
+
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or 
+# disable (NO) the test list. This list is created by putting \test 
+# commands in the documentation.
+
+GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or 
+# disable (NO) the bug list. This list is created by putting \bug 
+# commands in the documentation.
+
+GENERATE_BUGLIST       = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or 
+# disable (NO) the deprecated list. This list is created by putting 
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional 
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS       = 
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines 
+# the initial value of a variable or define consists of for it to appear in 
+# the documentation. If the initializer consists of more lines than specified 
+# here it will be hidden. Use a value of 0 to hide initializers completely. 
+# The appearance of the initializer of individual variables and defines in the 
+# documentation can be controlled using \showinitializer or \hideinitializer 
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES  = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated 
+# at the bottom of the documentation of classes and structs. If set to YES the 
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES        = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated 
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET                  = YES
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are 
+# generated by doxygen. Possible values are YES and NO. If left blank 
+# NO is used.
+
+WARNINGS               = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings 
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will 
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED   = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for 
+# potential errors in the documentation, such as not documenting some 
+# parameters in a documented function, or documenting parameters that 
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR      = YES
+
+# The WARN_FORMAT tag determines the format of the warning messages that 
+# doxygen can produce. The string should contain the $file, $line, and $text 
+# tags, which will be replaced by the file and line number from which the 
+# warning originated and the warning text.
+
+WARN_FORMAT            = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning 
+# and error messages should be written. If left blank the output is written 
+# to stderr.
+
+WARN_LOGFILE           = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain 
+# documented source files. You may enter file names like "myfile.cpp" or 
+# directories like "/usr/src/myproject". Separate the files or directories 
+# with spaces.
+
+INPUT                  = include \
+                         src \
+                         ../management/include \
+                         ../management/src \
+                         ../modeling/include \
+                         ../modeling/src \
+                         ../../graphics_reps/include/G4VGraphicsScene.hh \
+                         ../../graphics_reps/include/G4VVisManager.hh \
+                         ../../graphics_reps/src/G4VVisManager.cc
+
+# If the value of the INPUT tag contains directories, you can use the 
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank the following patterns are tested: 
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp 
+# *.h++ *.idl *.odl *.cs *.php *.php3 *.inc
+
+FILE_PATTERNS          = 
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories 
+# should be searched for input files as well. Possible values are YES and NO. 
+# If left blank NO is used.
+
+RECURSIVE              = NO
+
+# The EXCLUDE tag can be used to specify files and/or directories that should 
+# excluded from the INPUT source files. This way you can easily exclude a 
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE                = 
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories 
+# that are symbolic links (a Unix filesystem feature) are excluded from the input.
+
+EXCLUDE_SYMLINKS       = NO
+
+# If the value of the INPUT tag contains directories, you can use the 
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude 
+# certain files from those directories.
+
+EXCLUDE_PATTERNS       = *Command*
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or 
+# directories that contain example code fragments that are included (see 
+# the \include command).
+
+EXAMPLE_PATH           = 
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the 
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank all files are included.
+
+EXAMPLE_PATTERNS       = 
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be 
+# searched for input files to be used with the \include or \dontinclude 
+# commands irrespective of the value of the RECURSIVE tag. 
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE      = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or 
+# directories that contain image that are included in the documentation (see 
+# the \image command).
+
+IMAGE_PATH             = 
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should 
+# invoke to filter for each input file. Doxygen will invoke the filter program 
+# by executing (via popen()) the command <filter> <input-file>, where <filter> 
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an 
+# input file. Doxygen will then use the output that the filter program writes 
+# to standard output.
+
+INPUT_FILTER           = 
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using 
+# INPUT_FILTER) will be used to filter the input files when producing source 
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES    = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will 
+# be generated. Documented entities will be cross-referenced with these sources.
+
+SOURCE_BROWSER         = YES
+
+# Setting the INLINE_SOURCES tag to YES will include the body 
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES         = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct 
+# doxygen to hide any special comment blocks from generated source code 
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS    = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES (the default) 
+# then for each documented function all documented 
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = YES
+
+# If the REFERENCES_RELATION tag is set to YES (the default) 
+# then for each documented function all documented entities 
+# called/used by that function will be listed.
+
+REFERENCES_RELATION    = YES
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen 
+# will generate a verbatim copy of the header file for each class for 
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS       = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index 
+# of all compounds will be generated. Enable this if the project 
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX     = NO
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then 
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns 
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX    = 5
+
+# In case all classes in a project start with a common prefix, all 
+# classes will be put under the same header in the alphabetical index. 
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that 
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX          = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will 
+# generate HTML output.
+
+GENERATE_HTML          = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT            = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for 
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank 
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION    = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard header.
+
+HTML_HEADER            = 
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard footer.
+
+HTML_FOOTER            = 
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading 
+# style sheet that is used by each HTML page. It can be used to 
+# fine-tune the look of the HTML output. If the tag is left blank doxygen 
+# will generate a default style sheet
+
+HTML_STYLESHEET        = 
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, 
+# files or namespaces will be aligned in HTML using tables. If set to 
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS     = YES
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files 
+# will be generated that can be used as input for tools like the 
+# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) 
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP      = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can 
+# be used to specify the file name of the resulting .chm file. You 
+# can add a path in front of the file if the result should not be 
+# written to the html output dir.
+
+CHM_FILE               = 
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can 
+# be used to specify the location (absolute path including file name) of 
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run 
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION           = 
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag 
+# controls if a separate .chi index file is generated (YES) or that 
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI           = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag 
+# controls whether a binary table of contents is generated (YES) or a 
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members 
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND             = NO
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at 
+# top of each HTML page. The value NO (the default) enables the index and 
+# the value YES disables it.
+
+DISABLE_INDEX          = NO
+
+# This tag can be used to set the number of enum values (range [1..20]) 
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE   = 4
+
+# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
+# generated containing a tree-like index structure (just like the one that 
+# is generated for HTML Help). For this to work a browser that supports 
+# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, 
+# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are 
+# probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW      = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be 
+# used to set the initial width (in pixels) of the frame in which the tree 
+# is shown.
+
+TREEVIEW_WIDTH         = 250
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will 
+# generate Latex output.
+
+GENERATE_LATEX         = YES
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT           = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be 
+# invoked. If left blank `latex' will be used as the default command name.
+
+LATEX_CMD_NAME         = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to 
+# generate index for LaTeX. If left blank `makeindex' will be used as the 
+# default command name.
+
+MAKEINDEX_CMD_NAME     = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact 
+# LaTeX documents. This may be useful for small projects and may help to 
+# save some trees in general.
+
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used 
+# by the printer. Possible values are: a4, a4wide, letter, legal and 
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE             = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX 
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES         = 
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for 
+# the generated latex document. The header should contain everything until 
+# the first chapter. If it is left blank doxygen will generate a 
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER           = 
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated 
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will 
+# contain links (just like the HTML output) instead of page references 
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS         = NO
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of 
+# plain latex in the generated Makefile. Set this option to YES to get a 
+# higher quality PDF documentation.
+
+USE_PDFLATEX           = NO
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. 
+# command to the generated LaTeX files. This will instruct LaTeX to keep 
+# running if errors occur, instead of asking the user for help. 
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE        = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not 
+# include the index chapters (such as File Index, Compound Index, etc.) 
+# in the output.
+
+LATEX_HIDE_INDICES     = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output 
+# The RTF output is optimised for Word 97 and may not look very pretty with 
+# other RTF readers or editors.
+
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact 
+# RTF documents. This may be useful for small projects and may help to 
+# save some trees in general.
+
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated 
+# will contain hyperlink fields. The RTF file will 
+# contain links (just like the HTML output) instead of page references. 
+# This makes the output suitable for online browsing using WORD or other 
+# programs which support those fields. 
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS         = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's 
+# config file, i.e. a series of assigments. You only have to provide 
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE    = 
+
+# Set optional variables used in the generation of an rtf document. 
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE    = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will 
+# generate man pages
+
+GENERATE_MAN           = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT             = man
+
+# The MAN_EXTENSION tag determines the extension that is added to 
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION          = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output, 
+# then it will generate one additional man file for each entity 
+# documented in the real man page(s). These additional files 
+# only source the real man page, but without them the man command 
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will 
+# generate an XML file that captures the structure of 
+# the code including all documentation. Note that this 
+# feature is still experimental and incomplete at the 
+# moment.
+
+GENERATE_XML           = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT             = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema, 
+# which can be used by a validating XML parser to check the 
+# syntax of the XML files.
+
+XML_SCHEMA             = 
+
+# The XML_DTD tag can be used to specify an XML DTD, 
+# which can be used by a validating XML parser to check the 
+# syntax of the XML files.
+
+XML_DTD                = 
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will 
+# generate an AutoGen Definitions (see autogen.sf.net) file 
+# that captures the structure of the code including all 
+# documentation. Note that this feature is still experimental 
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF   = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will 
+# generate a Perl module file that captures the structure of 
+# the code including all documentation. Note that this 
+# feature is still experimental and incomplete at the 
+# moment.
+
+GENERATE_PERLMOD       = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate 
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able 
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX          = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be 
+# nicely formatted so it can be parsed by a human reader.  This is useful 
+# if you want to understand what is going on.  On the other hand, if this 
+# tag is set to NO the size of the Perl module output will be much smaller 
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY         = YES
+
+# The names of the make variables in the generated doxyrules.make file 
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. 
+# This is useful so different doxyrules.make files included by the same 
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX = 
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will 
+# evaluate all C-preprocessor directives found in the sources and include 
+# files.
+
+ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro 
+# names in the source code. If set to NO (the default) only conditional 
+# compilation will be performed. Macro expansion can be done in a controlled 
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION        = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES 
+# then the macro expansion is limited to the macros specified with the 
+# PREDEFINED and EXPAND_AS_PREDEFINED tags.
+
+EXPAND_ONLY_PREDEF     = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files 
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that 
+# contain include files that are not input files but should be processed by 
+# the preprocessor.
+
+INCLUDE_PATH           = 
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard 
+# patterns (like *.h and *.hpp) to filter out the header-files in the 
+# directories. If left blank, the patterns specified with FILE_PATTERNS will 
+# be used.
+
+INCLUDE_FILE_PATTERNS  = 
+
+# The PREDEFINED tag can be used to specify one or more macro names that 
+# are defined before the preprocessor is started (similar to the -D option of 
+# gcc). The argument of the tag is a list of macros of the form: name 
+# or name=definition (no spaces). If the definition and the = are 
+# omitted =1 is assumed.
+
+PREDEFINED             = G4VIS_USE_OPENGL=1 \
+                         G4VIS_USE_OPENGLX=1 \
+                         G4VIS_USE_OPENGLXM=1 \
+                         G4VIS_USE_OPENGLWIN32=1 \
+                         G4VIS_BUILD_OPENGL_DRIVER=1 \
+                         G4VIS_BUILD_OPENGLX_DRIVER=1 \
+                         G4VIS_BUILD_OPENGLXM_DRIVER=1 \
+                         G4VIS_BUILD_OPENGLWIN32_DRIVER=1
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then 
+# this tag can be used to specify a list of macro names that should be expanded. 
+# The macro definition that is found in the sources will be used. 
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED      = 
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then 
+# doxygen's preprocessor will remove all function-like macros that are alone 
+# on a line, have an all uppercase name, and do not end with a semicolon. Such 
+# function macros are typically used for boiler-plate code, and will confuse the 
+# parser if not removed.
+
+SKIP_FUNCTION_MACROS   = YES
+
+#---------------------------------------------------------------------------
+# Configuration::addtions related to external references   
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles. 
+# Optionally an initial location of the external documentation 
+# can be added for each tagfile. The format of a tag file without 
+# this location is as follows: 
+#   TAGFILES = file1 file2 ... 
+# Adding location for the tag files is done as follows: 
+#   TAGFILES = file1=loc1 "file2 = loc2" ... 
+# where "loc1" and "loc2" can be relative or absolute paths or 
+# URLs. If a location is present for each tag, the installdox tool 
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen 
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES               = 
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create 
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE       = 
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed 
+# in the class index. If set to NO only the inherited external classes 
+# will be listed.
+
+ALLEXTERNALS           = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed 
+# in the modules index. If set to NO, only the current project's groups will 
+# be listed.
+
+EXTERNAL_GROUPS        = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script 
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH              = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will 
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base or 
+# super classes. Setting the tag to NO turns the diagrams off. Note that this 
+# option is superceded by the HAVE_DOT option below. This is only a fallback. It is 
+# recommended to install and use dot, since it yields more powerful graphs.
+
+CLASS_DIAGRAMS         = YES
+
+# If set to YES, the inheritance and collaboration graphs will hide 
+# inheritance and usage relations if the target is undocumented 
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS   = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is 
+# available from the path. This tool is part of Graphviz, a graph visualization 
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section 
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT               = NO
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect inheritance relations. Setting this tag to YES will force the 
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect implementation dependencies (inheritance, containment, and 
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH    = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and 
+# collaboration diagrams in a style similiar to the OMG's Unified Modeling 
+# Language.
+
+UML_LOOK               = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the 
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS     = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT 
+# tags are set to YES then doxygen will generate a graph for each documented 
+# file showing the direct and indirect include dependencies of the file with 
+# other documented files.
+
+INCLUDE_GRAPH          = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and 
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each 
+# documented header file showing the documented files that directly or 
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH      = YES
+
+# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will 
+# generate a call dependency graph for every global function or class method. 
+# Note that enabling this option will significantly increase the time of a run. 
+# So in most cases it will be better to enable call graphs for selected 
+# functions only using the \callgraph command.
+
+CALL_GRAPH             = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen 
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY    = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images 
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT       = gif
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be 
+# found. If left blank, it is assumed the dot tool can be found on the path.
+
+DOT_PATH               = 
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that 
+# contain dot files that are included in the documentation (see the 
+# \dotfile command).
+
+DOTFILE_DIRS           = 
+
+# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width 
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than 
+# this value, doxygen will try to truncate the graph, so that it fits within 
+# the specified constraint. Beware that most browsers cannot cope with very 
+# large images.
+
+MAX_DOT_GRAPH_WIDTH    = 1024
+
+# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height 
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than 
+# this value, doxygen will try to truncate the graph, so that it fits within 
+# the specified constraint. Beware that most browsers cannot cope with very 
+# large images.
+
+MAX_DOT_GRAPH_HEIGHT   = 1024
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the 
+# graphs generated by dot. A depth value of 3 means that only nodes reachable 
+# from the root by following a path via at most 3 edges will be shown. Nodes that 
+# lay further from the root node will be omitted. Note that setting this option to 
+# 1 or 2 may greatly reduce the computation time needed for large code bases. Also 
+# note that a graph may be further truncated if the graph's image dimensions are 
+# not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH and MAX_DOT_GRAPH_HEIGHT). 
+# If 0 is used for the depth value (the default), the graph is not depth-constrained.
+
+MAX_DOT_GRAPH_DEPTH    = 0
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will 
+# generate a legend page explaining the meaning of the various boxes and 
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will 
+# remove the intermediate dot files that are used to generate 
+# the various graphs.
+
+DOT_CLEANUP            = YES
+
+#---------------------------------------------------------------------------
+# Configuration::addtions related to the search engine   
+#---------------------------------------------------------------------------
+
+# The SEARCHENGINE tag specifies whether or not a search engine should be 
+# used. If set to NO the values of all tags below this one will be ignored.
+
+SEARCHENGINE           = NO
Index: tags/visualization-10.5-before-10.6_test/OpenGL/GNUmakefile
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/GNUmakefile	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/GNUmakefile	(revision 1102)
@@ -0,0 +1,43 @@
+# $Id: GNUmakefile,v 1.10 2009/03/05 11:17:42 lgarnier Exp $
+
+name := G4OpenGL
+
+ifndef G4INSTALL
+  G4INSTALL = ../../..
+endif
+
+# Definition of macro for moc files (for Qt use only)
+MOC_MACRO = -DG4VIS_BUILD_OPENGLQT_DRIVER
+
+# For debug mode
+CPPFLAGS += -DG4DEBUG_VIS_OGL
+
+GLOBLIBS  = libG4vis_management.lib libG4modeling.lib
+GLOBLIBS += libG4interfaces.lib libG4run.lib libG4event.lib
+GLOBLIBS += libG4tracking.lib libG4processes.lib libG4digits_hits.lib
+GLOBLIBS += libG4track.lib libG4particles.lib libG4geometry.lib
+GLOBLIBS += libG4materials.lib libG4graphics_reps.lib
+GLOBLIBS += libG4intercoms.lib libG4global.lib
+
+include $(G4INSTALL)/config/architecture.gmk
+include $(G4INSTALL)/config/G4VIS_BUILD.gmk
+include $(G4INSTALL)/config/interactivity.gmk
+
+CPPFLAGS += -I$(G4BASE)/visualization/externals/gl2ps/include
+CPPFLAGS += -I$(G4BASE)/visualization/management/include
+CPPFLAGS += -I$(G4BASE)/visualization/modeling/include
+CPPFLAGS += -I$(G4BASE)/global/management/include
+CPPFLAGS += -I$(G4BASE)/global/HEPGeometry/include
+CPPFLAGS += -I$(G4BASE)/geometry/solids/CSG/include
+CPPFLAGS += -I$(G4BASE)/geometry/solids/specific/include
+CPPFLAGS += -I$(G4BASE)/graphics_reps/include
+CPPFLAGS += -I$(G4BASE)/geometry/management/include
+CPPFLAGS += -I$(G4BASE)/intercoms/include
+CPPFLAGS += -I$(G4BASE)/interfaces/common/include
+CPPFLAGS += -I$(G4BASE)/tracking/include
+CPPFLAGS += -I$(G4BASE)/digits_hits/hits/include
+
+INTYLIBS += -L$(G4LIBDIR) -lG4gl2ps
+
+include $(G4INSTALL)/config/moc.gmk
+include $(G4INSTALL)/config/common.gmk
Index: tags/visualization-10.5-before-10.6_test/OpenGL/History
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/History	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/History	(revision 1102)
@@ -0,0 +1,788 @@
+$Id: History,v 1.146 2009/08/19 13:28:10 lgarnier Exp $
+-------------------------------------------------------------------
+
+     =========================================================
+     Geant4 - an Object-Oriented Toolkit for Simulation in HEP
+     =========================================================
+
+           Category History file for visualization/OpenGL
+           ----------------------------------------------
+This file should be used by G4 developers and category coordinators
+to briefly summarize all major modifications introduced in the code
+and keep track of all category-tags.
+It DOES NOT substitute the  CVS log-message one should put at every
+committal in the CVS repository !
+
+     ----------------------------------------------------------
+     * Reverse chronological order (last date on top), please *
+     ----------------------------------------------------------
+
+18 August 2009 Laurent Garnier
+ - G4OpenGLXmViewer : Fix a wrong initialization introduce by the 
+   new way of handling window size hints (January 2009)
+
+29 July 2009, Laurent Garnier
+ - G4OpenGLQtViewer : Ensure the GL frame size will be correct
+   by setting a 0 size margin around 
+
+27 July 2009, Laurent Garnier
+ - G4OpenGLStoredQtViewer : Remove picking to true at initialisation 
+
+20 May 2009, Laurent Garnier (opengl-V09-02-06)
+ - Fixed compilation errors on WIN32-VC for WIN32 specific drivers.
+
+18 May 2009, Joseph Perl (opengl-V09-02-05)
+ - Correct G4OpenGLViewerMessenger.hh
+
+14 May 2009, Laurent Garnier (opengl-V09-02-04)
+ - G4OpenGLViewer : Add methods to manage print size and filename
+ - G4OpenGLViewerMessenger : Added /vis/ogl/set/printSize
+ - G4OpenGLViewerMessenger : Added /vis/ogl/set/printFilename
+ - G4OpenGLQtViewer.cc,G4OpenGLXmMainMenuBarCallback.cc, renaming
+   according to first point.
+
+13 May 2009, Laurent Garnier
+ - G4OpenGLStoredQtViewer.cc: Fix a second view redraw at ShowView() call
+ - G4OpenGLQtViewer : Remove unuseful variables, renaming others
+ - G4OpenGLViewer : Add method for resizing properly windows. Add methods
+   to get window width, height and to know if size has changed
+ - G4OpenGLQtViewer, G4OpenGLStoredQtViewer, G4OpenGLImmediateQtViewer,
+   G4OpenGLXmViewer, G4XmWindowsHandlingCallback, G4OpenGLXViewer :
+     Apply the previous changes.
+
+6 May 2009, Laurent Garnier
+ - G4OpenGLQtViewer.cc: Fix compilation warning and error with gcc4.4
+
+28th April 2009, John Allison
+ - G4OpenGLViewerMessenger.cc: Added return statement at end of every
+   "if (command == ..." statement.  (Because of test for OGLS, it is
+   not elegant to use "if...else if...else" structure.)
+
+28th April 2009, Laurent Garnier
+ - G4OpenGLXViewer,G4OpenGLViewer : End of moving printEPS and associated 
+   functions from GLXViewer to GLViewer.   
+ - G4OpenGLXViewer :
+   - Remove debug methods
+   - Add check in SetView() method
+ - G4OpenGLViewer : Add a glReadBuffer before glReadPixel in grabPixel method 
+
+8th April 2009, Laurent Garnier
+ - G4OpenGLBitmapStore.hh : BugFix correction for windows (introduce 2nd February ?)
+ - G4OpenGLViewer.hh : move methods in private
+ - G4OpenGLXViewer.hh : Add debug methods
+ - G4OpenGLImmediateXmViewer.cc, G4OpenGLStoredViewer.cc, G4OpenGLStoredXmViewer.cc,
+   G4OpenGLStoredXViewer.cc, G4OpenGLViewer.cc   : Add debug messages
+ - G4OpenGLStoredXmViewer.cc,G4OpenGLStoredXViewer.cc, G4OpenGLStoredWin32Viewer.cc :
+   - Add a DrawDisplay list in case of KernelVisit=1 and  nothing new to display. 
+   - Add a flush at the end of the view.
+ - G4OpenGLViewer.cc : 
+   - Improve the fix and resizing when X/Y size was even (lack of precision
+     in a /2)
+   - Set line/point size at a default size when printing.
+ - G4OpenGLXmWindowsHandlingCallbacks.cc : print method rename in printEPS
+ - G4OpenGLXViewer.cc : Lot of changes, try to debug it. Pb when printing in pixmap
+   mode on some windows size
+
+6th April 2009, Joseph Perl (opengl-V09-02-02, then opengl-V09-02-03)
+ - New tag to clean up all of the cases of files that changed only in the cvs id.
+
+24th March 2009, Laurent Garnier (opengl-V09-02-01)
+ - G4OpenGLViewer : Add a fix and resizing when X/Y size was even (lack of precision
+   in a /2)
+
+18th March 2009  John Allison
+- G4OpenGLViewerMessenger.cc: printMode and transparency are available
+  for all OGL windows (they were previously inadvertently hidden by
+  an OGLS requirement).
+
+16th March 2009, Laurent Garnier
+ - G4OpenGLViewer : Add a check on max viewport dimensions when setting size.
+
+4rd March 2009, Laurent Garnier
+ - G4OpenGLQtViewer:
+   - Suppress some warnings when saving file
+   - Changing size is now allowed when saving (to save with better resolution than screen size)
+ - G4OpenGLViewer: 
+  - Some renaming for print methods to be more clear about Vectored and non Vectored
+  - Now using Gl2PS method to do PS (changes also in G4OpenGLXViewer and G4OpenGLQtViewer)
+  - Suppress unuseful printX methods (heritated form XViewer)
+  - Add methods to handle printVectored and NonVector cases
+ - G4OpenGLViewerMessanger : Changes methods to get new G4OpenGLViewer methods to print
+
+1st March 2009, Laurent Garnier
+ - Remplacing glBitmap by GL_POINTS to draw marker : Speed improvment
+  and gl2ps can now draw Markers.
+
+16 February 2009, Laurent Garnier
+ - Modifications in GNUMakefile for gl2ps.
+ - G4OpenGLViewer,G4OpenGLViewerMessenger.cc,G4OpenGLXmMainMenubarCallbacks.cc
+   ,G4OpenGLXmViewer.cc modified for gl2ps and some renaming "print" in 
+   "printVectoredEPS"
+
+2nd February 2009  Laurent Garnier
+- Improve Anticipate headers declaration in all files
+- Factorize grabPixels function in G4OpenGLViewer
+- Begin of refactoring printEPS function
+
+22th January 2009  Laurent Garnier
+- Fix bug in ratio and geometry on X/Xm/Qt/Win32 viewers
+
+19th January 2009  Laurent Garnier
+- Change G4DEBUG definition by G4DEBUG_VIS_OGL
+
+12th January 2009  John Allison
+- G4OpenGLViewer.cc: Pick up X and Y window size hints to define viewport.
+
+2 December, Laurent Garnier
+ - G4OpenGLImmediateXmViewer,G4OpenGLStoredXmViewer,G4OpenGLXmViewer
+   G4OpenGLImmediateXViewer, G4OpenGLStoredXViewer, G4OpenGLXViewer,
+   G4OpenGLXmWindowHandlingCallbacks,
+   G4OpenGLImmediateQtViewer.cc, G4OpenGLStoredQtViewer, G4OpenGLQtViewer
+   G4OpenGLImmediateWin32Viewer.cc, G4OpenGLStoredWin32Viewer, G4OpenGLWin32Viewer 
+   ->  Replace WinSize by fWinSize and some improvments about size initialization
+
+ - G4OpenGLQtViewer.hh : Suppress WinSize private variable
+ - Now Could pass XString like 400x600-0+0 to viewers and set position and location. It
+   will work for Qt, X, Win32 for the moment.
+
+24 October, Laurent Garnier (opengl-V09-01-03)
+ - Change GEANT4_QT_DEBUG flag by QTDEBUG
+ - Suppress unuseful DEBUG messages
+
+12th October Laurent Garnier
+ - G4OpenGLQtExportDialog : improvments for Qt3"
+ - G4OpenGLQtViewer,G4OpenGLImmediateQtViewer,G4OpenGLStoreQtViewer : Add the name on OpenGlQt viewers
+ - G4OpenGLStoredQtViewer,G4OpenGLImmediateQt, G4OpenGLStoredQt : Change OGLSQT and OGLIQT by OGLSQt and OGLIQt
+
+2 October Laurent Garnier
+ - Fix a crash when there was no scene.
+
+28 July Laurent Garnier
+ - Fix a bug in XmRotation panel introduce in last commit by myself.
+
+20th June 2008  Laurent Garnier
+ - Correct some warnings
+ - Move rotation code of Xm and Qt in G4OpenGLViewer::rotateScene. Same code in now shared
+
+12th June 2008  Laurent Garnier
+ - Emit signals when moving/rotate scene, in order to get them in external app
+
+28th Mai 2008  Laurent Garnier
+ - Add mouse wheel zoom commands
+
+28th April 2008  Laurent Garnier
+ - Add better moc control/compilation step in GNUmakefile 
+ - Fix a problem when launching QT VIS without QT UI (N02 for example)
+
+28th April 2008  John Allison  (opengl-V09-01-02)
+- G4OpenGLStoredSceneHandler: Tidied constructors of nested classes.
+
+4th April 2008  John Allison  (opengl-V09-01-01)
+- Fixed DBL_MAX problem in 2D drawing:
+  o changed G4OPENGL_DBL_MAX to G4OPENGL_FLT_BIG.
+- Fix gcc-4.3.0 compiler warnings.
+
+11th March 2008, Laurent Garnier
+ - Resolve QT3 compilation errors
+
+10th March 2008, Laurent Garnier
+ - Add a dialog panel to make movies (Right button->Actions->Movie parameters)
+ - Add ability to "auto rotate" volume launched with quick mouse move
+ - Lots of improvments for Qt3
+ - Improvments on moving steps with shortcuts
+ - Could now select between orthogonal/perspective view mode
+
+1st February 2008  John Allison
+ - G4OpenGLQtViewer.cc: Fix #ifdef QT protection.
+ - G4OpenGLSceneHandler.cc: Small improvement to logic of setting GL_LIGHTING.
+
+30th January 2008, Laurent Garnier
+ - Add moving camera on left/right/up/down arrown, going forward/backward
+   on SHIFT+up/down, zoom in with +/- keys
+ - Add a context menu entry for projection perspective/orthographic
+ - Fix some bugs on windows in export dialog
+
+15th January 2008, Laurent Garnier
+ - Fixed some layout problems on export dialog box
+ - Some improvements on exports formats
+ - Fix a bug in the help command : The clic callback on a item was not 
+   working on windows
+ - Fix a crash at exit when launched on a MAC.
+ - EPS export format is now ready for Qt3
+ - Add Vectoriel EPS export format
+ - Fix an aspect ratio deformation when resize the widget
+ - Fix a crash at launch with leopard 
+ - When selecting the "move" mouse action, this action was set even when 
+   mouse button was released. Fixed : Now we should clic to have the move action
+ - GNUmakefile : Added a macro for moc file
+ - Moc files : Suppression of all theses files. They are now autogenerated 
+   thanks to config/common.gmk
+
+4th January 2008  John Allison  (opengl-V09-01-00)
+- Implemented extended 2D interface.
+
+30th November 2007  Laurent Garnier
+- Improvements for Qt3
+- moc files : Adding other versions for QT_MOC_REVISION 28,58 and
+   59, but this is not the right solution..
+
+19th November 2007  Joseph Perl (for Laurent Garnier) (opengl-V09-00-04)
+- Added GEANT4_QT_DEBUG flag to more places
+
+15th November 2007  John Allison  (opengl-V09-00-03)
+- Re-introduced Qt files, now properly protected by cpp flags.
+- cpp flags also added to some other files not previously properly protected.
+
+15 Nov 2007, Laurent Garnier
+ - G4UIQt,G4Qt : Adding a GEANT4_QT_DEBUG flag to hide all debug messages
+ - G4UIQt,G4Qt : Compilation improvements for Qt3
+ - G4UIQt,G4Qt : Minors corrections on G4UIQt helpWidget
+
+14 Nov 2007, Laurent Garnier
+ - G4OpenGLStoredQtViewer.cc : Correction of a bug with mouse move event in
+     Qt4
+ - G4OpenGLQtExportDialog_moc.cc, G4OpenGLQtViewer.cc, G4OpenGLQtViewer_moc.cc :
+     Adding protection for Qt version between 4.0 and 4.2
+
+13th November 2007  John Allison  (opengl-V09-00-02)
+- Removed Qt files from tag.  File are still at head - need fixing.
+
+13 Nov 2007, Laurent Garnier
+ - G4UIQt,G4Qt : Moving all moc in one big file interface/G4UIQT_moc.cc,
+   including Qt3 and Qt4 moc support
+
+10th November 2007  John Allison  (opengl-V09-00-01)
+- Moved WinSize_x, y to base class G4OpenGLViewer.
+- Minor improvement in guidance for /vis/ogl/printEPS.
+
+09 Nov 2007, Laurent Garnier
+ - G4UIQt,G4Qt : Change all include directive to be compatible with Qt3
+
+08 Nov 2007, Laurent Garnier
+ - moc_G4OpenGLQtExportDialog.cc move in G4OpenGLQtExportDialog_moc.cc
+ - moc_G4OpenGLQtViewer.cc move to G4OpenGLQtViewer_moc.cc
+
+27 Sept 2007, Laurent Garnier
+ - Adding sur files for G4UIQt driver :
+   - G4OpenGLImmediateQt.cc
+   - G4OpenGLImmediateQtViewer.cc
+   - G4OpenGLQtExportDialog.cc
+   - G4OpenGLQtViewer.cc
+   - G4OpenGLStoredQt.cc
+   - G4OpenGLStoredQtViewer.cc
+   - moc_G4OpenGLQtExportDialog.cc
+   - moc_G4OpenGLQtViewer.cc
+
+28th September 2007  lgarnier
+- first import of G4UI Qt files : Do not try to compil them
+
+21st August 2007  John Allison  (opengl-V09-00-00)
+- Removed redundant G4OpenGLXViewerMessenger.
+
+25th May 2007  John Allison  (opengl-V08-03-03)
+- G4OpenGLSceneHandler and G4OpenGLXViewerMessenger:
+  Fixed gcc-4.1.2 compiler warnings.
+
+25th May 2007  John Allison  (opengl-V08-03-02)
+- G4OpenGLXViewer: Trapped glXMakeCurrent in Initialise function.
+
+24th May 2007  John Allison  (opengl-V08-03-01)
+- Fixes for SUN.
+
+16th May 2007  John Allison  (opengl-V08-03-00)
+- Fix compiler warnings on SLC4.
+- Bug fixes:
+  o Correct path /vis/ogl/set/printMode.
+  o Add SetView to pixmap screen dump ("/vis/ogl/set/printMode pixmap"
+    and "/vis/ogl/printEPS").
+
+8th May 2007  John Allison  (opengl-V08-02-06)
+- Moved vectored PostScript printing to G4OpenGLViewer.
+- /vis/ogl/printEPS should work for all viewers, including Win32.
+- Introduced /vis/ogl/set/printMode vectored|pixmap, currently only
+  effective on X windows (and still somewhat buggy).
+
+4th April 2007  John Allison  (opengl-V08-02-05 - needs visman-V08-02-04)
+- Implemented picking for OGLSX ( as well as OGLIX).  Hopefully works
+  for OGL*Win32.  Still doesn't work for OGL*Xm.
+
+3rd April 2007  John Allison  (opengl-V08-02-04 - needs visman-V08-02-03)
+- G4OpenGLStoredSceneHandler:
+  o Re-organised display lists on a per-primitive basis, i.e., one
+    display list per primitive.  (This is so that, except for text,
+    the colour - or, rather, intensity - can be brought out of the
+    display list into the TOList (Transient Object List) and
+    controlled for the Display-by-Time feature.  Previously, if more
+    than one primitive were drawn between BeginPrimitives and
+    EndPrimitives, it would finish up all in one display list, colour
+    commands included. Rationalises and fixes a rare bug in the
+    Display-by-Time feature - see August 2006.)
+  o Added AddPrimitive(const G4Polymarker&) so that it is treated as
+    one primoitive to fit with the above re-organisation.
+- Implemented picking for OGLIX.
+
+25th March 2007  John Allison  (opengl-V08-02-03)
+- Fix compiler warnings.
+
+8th February 2007  John Allison  (opengl-V08-02-02)
+- Fixed Windows problem with DBL_MAX.  (Introduced G4OPENGL_DBL_MAX.)
+- G4OpenGLXViewer.cc: Small bug fix in print().  (Context was switched
+  .but not switched back.  Not serious, because context was always set
+  before normal drawing.)
+
+9th January 2007  John Allison  (opengl-V08-02-01)
+- Implemented bitmap markers for MarkerSizeType == screen.  (The old
+  polygon implementation remains for MarkerSizeType == world.)
+- Added G4OpenGLBitMapStore to assist the above.
+- G4OpenGLXViewer::CreateGLXContext:
+  o Bug fix: Added missing break in colormap lookup routine.
+
+5th January 2007  John Allison  (opengl-V08-02-00)
+- G4OpenGLSceneHandler.cc:
+  o Followed change of signature of GetLineWidth in visman-V08-02-00.
+  o Minor efficiency improvements.
+
+21st November 2006  John Allison  (opengl-V08-01-09)
+- Fixed compiler warnings.
+
+1st November 2006  John Allison  (opengl-V08-01-08)
+- Replace /vis/oglx/set/printEPS by /vis/oglx/printEPS.  The new command
+  actually initiates a print, rather than set a flag for printing.
+
+24th October 2006  John Allison  (opengl-V08-01-07)
+- G4OpenGLStoredViewer.cc: Calculate light front horizon properly.
+- G4OpenGLViewerMessenger.cc: Make refresh depend on auto-refresh.
+
+19th September 2006  John Allison  (opengl-V08-01-06)
+- Added time origin for light front.
+- Added /vis/ogl/set/transparency.
+- G4OpenGLStoredViewer.cc: Bug fix in time range acceptance.
+
+4th September 2006  John Allison  (opengl-V08-01-05)
+- Implement cutaways.
+- Immediate mode: G4OpenGLImmediateSceneHandler.cc: Flush all
+  primitives (see detector being drawn).
+- /vis/oglx/set/printEPS: change parameter default to true.
+
+30th August 2006  John Allison  (opengl-V08-01-04)
+- G4OpenGLSceneHandler:
+  o Implemented line width.
+  o Switched off back face culling when clipping so that the inside of
+    volumes can be seen.
+  o Added CreateSection/CutawayPolyhedron to exploit generic
+    sectioning (DCUT) and cutaways.  Currently not activated due to
+    instabilities in BooleanProcessor.  Local sectioning still active
+    but broken (at least on Mac) due to apparent change in effect of
+    clipping planes (polyhedron edges not reconstructed).
+  o Rationalised calculation of marker size.
+- G4OpenGLStoredSceneHandler:
+  o Fixed bug due to recursive calls of AddPrimitive (polymarkers -> markers).
+  o Pick up time range from G4VisAttributes.
+- G4OpenGLViewer(Messenger):
+  o Added position and colour to /vis/ogl/set/displayHeadTime.
+  o Added /vis/ogl/set/displayLightFront.
+- G4OpenGLStoredViewer.cc:
+  o Rationalised CompareForKernelVisit.  (Local sectioning still active.)
+  o Added position and colour to DisplayHeadTime.
+  o Added DisplayLightFront.
+  
+16th August 2006  John Allison  (opengl-V08-01-03)
+- Corrected Solaris compilation error.
+- Added /vis/ogl/set/fade and displayHeadTime.
+
+14th August 2006  John Allison  (opengl-V08-01-02)
+- Needs visman-V08-01-02.
+- G4OpenGLStored: Implemented display-by-time.  Only available in
+  stored mode at present.  Only implemented for circle, square,
+  polyline and polymarker at present, enough for currently available
+  trajectory models.  Time is communicated via G4AttValues.
+- Added G4OpenGLViewerMessenger.
+- Added /vis/ogl/set/startTime and endTime of displayed objects.
+- All factories: Instantiated G4OpenGLViewerMessenger.
+- G4OpenGLViewer: Added fStart/EndTime.
+- G4OpenGLXViewer.cc: Graceful recovery from unexpected tokens in
+  spewPrimitiveEPS and spewSortedFeedback.
+
+17th July  John Allison  (opengl-V08-01-01)
+- Added /vis/oglx/set/printEPS (prints eps file on every update).
+
+3rd July 2006  John Allison  (opengl-V08-01-00)
+- Elimination of redundant variable doublebuffer and implementation of
+  FinishView in all viewers.
+
+30th May 2006  Joseph Perl  (opengl-V08-00-08)
+- G4OpenGLImmediateWin32Viewer: Removed tests on doublebuffer since that
+  variable seems to have random behavior and should be assumed false for
+  this viewer.
+
+29th May 2006  Joseph Perl  (opengl-V08-00-07)
+- G4OpenGLWin32Viewer, G4OpenGLImmediateWin32Viewer, G4OpenGLStoredWin32Viewer:
+  Removed common FinishView and instead made separate FinishView for the two different
+  versions of this viewer since each wants a different buffer swapping behaviour.
+
+12th May 2006  John Allison  (opengl-V08-00-06)
+- G4OpenGLWin32Viewer: Fixed buffer swapping behaviour.
+
+28th April 2006  John Allison  (opengl-V08-00-05 - needs visman-V08-00-14)
+- G4OpenGLStoredX/Xm/Win32Viewer.cc: Fixed buffer swapping problem when
+  recomputing transients.
+
+24th April 2006  John Allison  (opengl-V08-00-04)
+- Fixed compilation problem on Windows.
+
+19th April 2006  John Allison  (opengl-V08-00-03)
+- G4OpenGLSceneHandler, G4OpenGLStoredSceneHandler and
+  G4OpenGLImmediateSceneHandler:
+  o Implemented Begin/EndPrimitives2D (needs visman-V08-00-12 and
+    greps-V08-00-02).
+  o Migrated to direct access to G4PhysicalVolumeModel.
+- G4OpenGLStoredX/Xm/Win32Viewer.cc: bug fix for conditional drawing
+  of display lists in DrawView.
+
+14th March 2006  John Allison  (opengl-V08-00-02)
+- Refined display list building and re-drawing algorithm.
+  o G4OpenGLStoredSceneHandler::EndModeling: Changed to GL_COMPILE_AND_EXECUTE.
+  o Avoided unnecessary re-execution in DrawView (X, Xm and Win32).
+- G4OpenGLStoredSceneHandler::RequestPrimitives: Refined display list
+  re-use algorithm.  In test19 with global culling off, numbers of
+  display lists used are:
+  o 191  No re-use:
+  o  73  Before this change: re-use except replicas (includes parameterised).
+  o  33  After this change: re-use except parameterised and replicas in radius.
+
+26th January 2006  John Allison  (opengl-V08-00-01)
+- Coworks with visman-V08-00-04 (removed fModified).
+- Removed references to fModified.
+- Tidying: Removed unnecessary ClearView.
+- G4OpenGLSceneHandler.cc: Added some (commented out) code for
+  possible future implementation of 2D drawing.
+- G4OpenGLXViewer.cc: Improved exception printing.
+
+11th January 2006  John Allison  (opengl-V08-00-00)
+- Improved efficiency: all DrawView's:
+  o Don't call ClearView.
+  o Set flag so SetView will not be called in ProcessView.
+  o Leave background colour to ClearView.
+- Used dynamic_cast<G4OpenGLViewer*>, no need for G4OpenGLViewerDataStore.
+- G4OpenGLXmViewerMessenger: Made a smart singleton; interrogates vis manager
+  for current viewer.
+
+24th November 2005  John Allison  (opengl-V07-01-09)
+- Protected G4OpenGLXmViewerMessenger with #ifdef G4VIS_BUILD_OPENGLXM_DRIVER.
+
+22nd November 2005  John Allison  (opengl-V07-01-08)
+- Added G4OpenGLXmViewerMessenger.
+- Corrected text position.
+- Made depth test for polyhedron GL_LEQUAL (slightly dominant).
+
+17th November 2005  Gabriele Cosmo
+- Fixed settings of background style for WIN32 viewers.
+
+13th November 2005  John Allison  (opengl-V07-01-07)
+- Implemented X-Window-style geometry hints in G4OpenGLXViewer.
+
+13th October 2005  John Allison  (opengl-V07-01-06)
+- Allowed any colour background.
+- Implemented non-uniform scaling.
+- Migration to <sstream>.
+
+29th September 2005  John Allison  (opengl-V07-01-05)
+- Added G4OpenGLViewerDataStore to facilitate access of viewer data by
+  scene handler.
+- Re-implemented transparency button in OpenGLXm.
+
+13th September 2005  John Allison  (opengl-V07-01-04 - needs visman-V07-01-02)
+- Implemented white background for all OGL viewers.
+- G4OpenGLSceneHandler.cc:
+  o Fixed hidden line removal (bug introduced in opengl-V07-01-02).
+  o Fixed treatment of triangular polygons for drawing of auxiliary/soft lines.
+  o Corrected GetTextColour(text).
+  o Corrected GetColour(polyhedron).
+
+5th September 2005  John Allison  (opengl-V07-01-03)
+- Bug fix: stored transparent objects were being lost.
+
+2nd September 2005  John Allison  (opengl-V07-01-02 - needs visman-V07-01-01)
+- Bug fix: edgeflags problem introduced with smooth shading in
+  opengl-V07-01-00.
+- Implementation of a "better algorithm" for the rendering of
+  transparent polyhedron objects.  It renders all opaque objects
+  first, then renders the transparent objects with the depth buffer in
+  read-only mode (see OpenGL Programming Guide).  It uses the new
+  facility in G4VSceneHandler::ProcessScene for an optional second pass
+  of the run-duration models in the scene.  Note this algorithm is
+  still only an approximation.  It will still give the wrong blended
+  colour if two transparent objects are rendered front first.  For
+  nested transparent objects, this is unfortunate, because
+  G4PhysicalVolumeModel traverses Geant4's mother-daughter hierarchy
+  in such a way that mothers come first.  Also, there is no guaranteed
+  relationship between the order of rendering and the depth of two
+  transparent objects if they are at the same level or in different
+  branches of the hierarchy.  Still, the only error will be an
+  incorrect colour - the objects will still give the appearance of
+  transparency, so it's a pretty good algorithm.  (An even better
+  algorithm would be to attempt to render the facets in depth order,
+  deepest first.  But how do you calculate the depth - centre of area,
+  deepest corner?  One can still imagine pathalogical cases that would
+  sometimes give the wrong colour.  Also, for stored mode, the order
+  is fixed in a display list so when the user rotates the view, one
+  would lose the depth ordering.  I think we have to accept that
+  blending in OpenGL is only ever an approximation.  For accurate
+  blending, use RayTracer.)
+
+28th August 2005  John Allison  (opengl-V07-01-01)
+- Half-way implementation of rendering of transparent polyhedron
+  objects.  In this implementation, no account is taken of the order
+  of rendering.  Transparent objects are rendered with depth testing
+  off so that objects behind can still be seen.  But this means that
+  opaque objects in front do not obscure them - and they jolly well
+  should!  A better algorithm is to render all opaque objects first,
+  then render the transparent objects with the depth buffer in
+  read-only mode (see OpenGL Programming Guide).  This is going to
+  take a little more thought - see opengl-V07-01-02.
+
+20th July 2005  John Allison  (opengl-V07-01-00)
+- Introduced smooth shading, taking advantage of hitherto un-noticed
+  feature of HepPolyhedron::GetNextFacet that calculates the normals
+  at each vertex so that curved surfaces are rendered more
+  realistically (Gouraud shading).
+- G4OpenGLImmediateSceneHandler.cc: Removed unnecessary #include's.
+- G4OpenGLXmViewer.cc: Fixed to use window size hints.  This changes
+  the default window size.  It used to be 400x400, hardcoded in
+  G4OpenGLXmViewer.cc, but now it picks up the
+  G4ViewParameters::GetWindowSizeHintX/Y, which defaults to 600x600.
+  The user may change it on the command line, e.g:
+    /vis/open OGLSXm 500
+  or
+    /vis/viewer/create ! ! 500
+
+30th May 2005  John Allison  (opengl-V07-00-03)
+- Fixed compilation problem in OpenGL on SUN.  (Replaced multimap by
+  map of vectors in G4OpenGLFontBaseStore.)
+
+4th May 2005  John Allison  (opengl-V07-00-02)
+- Restored sequence Set/Clear/DrawView in ClearTransientStore.  (It
+  was taken out to prevent recursive calling, but that seems to be OK,
+  and it is needed to implement refresh at end of event/run.)
+
+22nd April 2005  John Allison  (opengl-V07-00-01)
+- Rationalised work of opengl-V07-00-00.  Functionality unchanged.
+  o G4OpenGLViewer.hh: Created virtual void CreateFontLists(){}.
+  o In all concrete viewers, added call to CreateFontLists().
+  o Moved font code for X to G4OpenGLXViewer::CreateFontLists().
+  o There is no longer a need to implement in the XmViewer, since it
+    now inherits.  Thus the font code now only appears once for X.
+  o Awaiting implementation for WIN32.
+
+17th April 2005  John Allison  (opengl-V07-00-00)
+- Based on vis-V07-00-13.
+- Implemented text for X-Windows viewers.  Uses glXUseXFont, which
+  creates display lists for nominated fonts.  Simple-minded scheme in
+  which each viewer creates its own font display lists for a variety
+  of sizes, which are accessed by the scene handler through a new
+  class, G4OpenGLFontBaseStore.  Affected methods:
+    G4OpenGLXViewer::CreateMainWindow()
+    G4OpenGLXmViewer::CreateMainWindow()
+    G4OpenGLSceneHandler::AddPrimitive (const G4Text& text)
+
+18th November 2004  John Allison  (opengl-V06-02-07)
+- Removed redundant fLastVP from G4OpenGLStoredSceneHandler.
+
+15th November 2004  Guy Barrand
+- G4OpenGLWin32Viewer::ShowView : glFlush was not sufficient 
+  to see trajectories (for example with N03). Correct so that
+  ShowView do a FinishView that does : glFlush, wglSwapBuffer
+  and empty the Windows message queue.
+
+22nd September 2004  John Allison  (opengl-V06-02-06)
+- doxygen output to tmp area.
+- Trap non-regular polyhedrons.
+
+13th September 2004  Gabriele Cosmo  (opengl-V06-02-05)
+- G4OpenGLTransform3D.cc: simplified implementation for GetMatrix()
+  to allow for porting on CLHEP-1.9.X series.
+
+23rd July 2004  John Allison
+- Draws auxiliary edges if required.
+- Added auxiliary edge button.
+
+16th July 2004  John Allison  (opengl-V06-02-04)
+- Refinements to hidden line, hidden surface removal.
+
+14th July 2004  John Allison  (opengl-V06-02-03)
+- Removed superfluous #include "G4VisManager.hh" from G4OpenGLXmViewer.cc.
+
+13th July 2004  John Allison  (opengl-V06-02-02)
+- Hidden line *and* hidden surface removal now works.
+
+9th July 2004  John Allison  (opengl-V06-02-01)
+- Fixed long-standing problem with hidden line removal.
+- Improved messages on failure to get visual.
+- Added GLX_STENCIL_SIZE explicit request to visual attributes - most
+  systems provided by default anyway, so no effect.
+
+1st July 2004  John Allison  (opengl-V06-02-00)
+- Rationalised G4OpenGLSceneHandler ready for hidden line removal.
+- Bug fix in G4OpenGLXmPanningCallbacks.cc for dolly control.
+
+18th June 2004  Gunter Folger (geant4-06-02)
+9th June 2004  Gabriele Cosmo  (vis-V06-01-03)
+7th June 2004  Gabriele Cosmo  (vis-V06-01-02)
+- GNUmakefile and disclaimer changes - see visualization/History.
+
+9th April 2004  John Allison  (vis-V06-01-01 + interfaces-V06-01-00)
+- Tagged OpenGL as below.  Joint with interfaces-V06-01-00.
+
+7th April 2004  Guy Barrand
+- visualization/OpenGL/* : use the G4OpenGL.hh file.
+- Added : visualization/OpenGL/include/G4OpenGL.hh to encapsulate
+  the include of gl/gl.h and gl/glu.h that may be platform dependant.
+  It permits to rm some #ifdef WIN32 spread in the code. It opens also
+  the way to the usage of the Apple OpenGL on a Mac.
+
+17th February 2004  John Allison  (opengl-V06-00-00)
+- Fixed bug #581: wrong order of statements in
+  G4OpenGLXViewer::~G4OpenGLXViewer (see bug report).
+
+4th October 2003  Gabriele Cosmo  (vis-V05-02-01)
+- GNUmakefile:
+  o replaced "digits+hits" with "digits_hits".
+- Coworks with "geometry-V05-02-00" and "digits_hits-V05-02-00".
+
+22nd September 2003  John Allison  (vis-V05-02-00, greps-V05-02-00)
+- Cosmetic change to regularise names:
+  o changed _Feedback3Dcolo to G4OpenGLXViewerFeedback3Dcolor.
+  o changed _DepthIndex to G4OpenGLXViewerDepthIndex.
+
+23rd June 2003  Guy Barrand  (opengl-V05-01-02)
+- Commit a first implementation of G4OpenGLWin32Viewer.
+
+10th June 2003  Gabriele Cosmo  (opengl-V05-01-01)
+- More fixes for warnings in viewers classes.
+- Added inclusion of <windows.h> for WIN32 platforms when GL headers
+  are included.
+
+05th June 2003  Gabriele Cosmo  (opengl-V05-01-00)
+- Fixes for porting compilation on WIN32:
+  o G4OpenGLWin32Viewer[.hh.cc]: removed inclusion of <GL/glx.h>.
+  o G4OpenGLViewer.cc: replaced local variables near/far with pnear/pfar
+    since declared 'obsolete' in WIN32 platforms.
+
+27th November 2002  John Allison  (vis-V04-01-08)
+- Improved algorithm of CompareForKernelVisit.
+
+11th November 2002  John Allison  (opengl-V04-01-02)
+- Corrected inclusion of G4OpenGLXViewer #ifdef X_DRIVER.
+- Added G4OpenGLSceneHandler::AddThis for trajectories and hits - simply
+  call default but there as a marker and encourager.
+- Added tracking and digits+hits/hits to GNUmakefile.
+
+16th October 2002  John Allison  (opengl-V04-01-01)
+- Fix for WIN32.  Now compiles but viewer not implemented.
+
+24th June 2002  John Allison  (opengl-V04-01-00)
+- Further cosmetic changes in G4OpenGLXViewer.cc for DEC compiler.
+
+10th June 2002  John Allison  (opengl-V04-00-03)
+- Cosmetic changes for SUN-CC in G4OpenGLXmConvenienceRoutines.cc.
+
+6th June 2002  John Allison  (opengl-V04-00-02)
+- Cosmetic changes for GNU compiler in G4OpenGLXViewer.cc.
+
+23rd February 2002  John Allison  (opengl-V04-00-01)
+- Changes to encourage compilation on Windows in preparation for
+  implementation of G4OpenGLWin32Viewer.  Removed spurious includes of
+  glx.h, unistd.h and assert.h.
+
+24th August 2001  John Allison  (vis-V03-02-13)
+- Limited the printing of warnings in
+  G4OpenGLSceneHandler::AddPrimitive (const G4Text& text).
+
+14th August 2001  John Allison  (vis-V03-02-11)
+- Improved KernelVisitDecision.
+- Fixed a few small bugs in multiple "stored" viewers, but see next item.
+- There's an outstanding bug in OpenGL Stored.  If there is more than
+  one viewer controlled by a scene handler, after a ClearStore on the
+  scene handler, e.g., with /vis/scene/notifyHandlers, the first
+  viewer to get refreshed should trigger the display list rebuild, but
+  the second need not.  However, when the second viewer's turn comes,
+  the display lists are there, and are called, e.g.,
+  G4OpenGLStoredXViewer::DrawView calls
+  G4OpenGLStoredViewer::DrawDisplayLists that calls glCallList, but
+  nothing appears on the screen.  To overcome this there is some
+  temporary code in G4VViewer::NeedKernelVisit which marks *all*
+  viewers to force a rebuild.  To see the symptoms, comment out that
+  temporary code and issue these commands:
+    /vis/verbose c
+    /control/verbose 2
+    /vis/scene/create
+    /vis/scene/add/volume
+    /vis/sceneHandler/create OGLSX
+    /vis/viewer/create ! ! 1
+    /run/beamOn
+    /vis/viewer/create ! ! 1
+    /vis/viewer/select viewer-0
+    /vis/viewer/viewpointThetaPhi 20 20
+    /vis/viewer/select viewer-1
+    /vis/viewer/viewpointThetaPhi 40 40
+    /vis/viewer/set/style surface
+    /vis/viewer/refresh
+    /vis/viewer/select viewer-0
+    /vis/viewer/refresh
+    /vis/viewer/select viewer-1
+    /vis/viewer/set/style wireframe
+    /vis/scene/notifyHandlers
+  You may have to do this too:
+    /vis/viewer/select viewer-0
+    /vis/scene/notifyHandlers
+  One of the viewers is empty.  Curious!!
+
+9th August 2001  John Allison  (vis-V03-02-10-00)
+- Implemented G4OpenGLStoredSceneHandler::ClearTransientStore()
+- Removed G4OpenGLSceneHandler::AddPrimitive (const G4Polymarker&) (it only
+  invoked G4VSceneHandler::AddPrimitive (const G4Polymarker&) which is
+  picked up by inheritance anyway.
+- Removed lots of unnecessary header files from G4OpenGLStoredSceneHandler.cc.
+- Corrected order of calling base class functions in
+  G4OpenGLStoredSceneHandler::Begin/EndModeling.
+
+24th July 2001  John Allison  (vis-V03-02-06)
+- G4OpenGLSceneHandler::AddPrimitive (const G4Text&) handles transformation.
+
+14th July 2001  John Allison (opengl-V03-02-00)
+- Fixed crash in optimised mode: added Initialise() to viewers so
+  that windows are opened after viewers are fully constructed.
+
+2nd April 2001  John Allison (opengl-V03-00-01 wrt vis-V03-00-09)
+- Tidied G4OpenGLXmViewer callback code.  Removed superfluous header files.
+
+7th March 2001  John Allison
+- Changed char* to const char* in many places and that gave problems in
+  calls to Xt and Xm.  Hope all's OK.  Differences:
+    cvs diff -r vis-V03-00-06 vis-V03-00-07
+
+25th January 2001  John Allison  (opengl-V03-00-00)
+- Implemented running re-calculation of up-vector in the case of "object
+  rotation" (lights move with camera) to prevent "flipping" of view when
+  camera passes through up-vector.  Note that the default is "camera
+  rotation" (lights do not move with camera, i.e., remain fixed relative
+  to object) so the default is that this "flipping" can happen.  To set
+  "object rotation" (lights move with camera) use
+  /vis/lights/move_with_camera true (soon to be
+  /vis/viewer/set/lights move-with-camera) or click "Object" radio button
+  on Rotation Panel in OpenGLXm mode.
+- Changed some objects to references for efficiency.  E.g.:
+  const G4Vector3D& vp = pView->fVP.GetViewpointDirection ().unit ();
+
+22nd May 2000  John Allison  (opengl-V01-01-00)
+- Fixed slow response of 2nd window of OpenGLXm.  Worked around Mesa bug
+  by sharing static visuals in G4OpenGLXViewer (Guy Barrand):
+    static XVisualInfo* vi_single_buffer;
+    static XVisualInfo* vi_double_buffer;
+- Removed ChooseVisual from G4OpenGLXmViewer.cc - done in base class
+  G4OpenGLXViewer.
+- Protected double deletion of window in destructors of G4OpenGLXmViewer
+  and G4OpenGLXViewer (Guy Barrand).
+- Changed requested bits per colour to r,g,b = 1,1,1 in G4OpenGLViewer.cc.
+- Corrected order of CreateMainWindow() and InitializeGLView() in X*Viewer
+  constructors.
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGL.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGL.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGL.hh	(revision 1102)
@@ -0,0 +1,47 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4OpenGL.hh,v 1.8 2009/02/04 16:48:40 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// G.Barrand.
+
+#ifdef G4VIS_BUILD_OPENGL_DRIVER
+
+#ifndef G4OpenGL_h
+#define G4OpenGL_h 
+
+#ifdef WIN32
+#include <windows.h>
+#endif
+
+#include <GL/gl.h>
+#include <GL/glu.h>
+
+#define G4OPENGL_FLT_BIG 1.e20
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLBitMapStore.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLBitMapStore.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLBitMapStore.hh	(revision 1102)
@@ -0,0 +1,81 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLBitMapStore.hh,v 1.4 2009/04/08 15:15:07 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  6th January 2007
+//
+// Class description
+//
+// Keeps bit maps on byte boundaries suitable for drawing.  For
+// example, in OpenGL:
+//
+//   const char* circle = G4OpenGLBitMapStore::GetCircle(size, true);
+//   glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+//   glBitmap(size, size, size/2., size/2., 0., 0., circle);
+
+#ifdef G4VIS_BUILD_OPENGL_DRIVER
+
+#ifndef G4OPENGLBITMAPSTORE_HH
+#define G4OPENGLBITMAPSTORE_HH
+
+#include "globals.hh"
+#include <map>
+
+#include "G4OpenGL.hh"
+#include <GL/gl.h>
+#include <GL/glu.h>
+
+namespace G4OpenGLBitMapStore {
+
+  enum Shape {circle, square};
+
+  const GLubyte* GetBitMap(Shape, G4double& size, G4bool filled);
+  // Size in pixels (gets changed to a rationalised value).
+
+  struct Key{
+    Key(Shape shape, G4int size, G4bool filled):
+      fShape(shape), fSize(size), fFilled(filled) {}
+    bool operator<(const Key& rhs) const {
+      if (fShape < rhs.fShape) return true;
+      else if (fSize < rhs.fSize) return true;
+      else if (fFilled != rhs.fFilled) return true;
+      else return false;
+    }
+    Shape fShape;
+    G4int fSize;
+    G4bool fFilled;
+  };
+
+  extern std::map<Key, GLubyte*> fStore;
+
+}
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLFontBaseStore.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLFontBaseStore.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLFontBaseStore.hh	(revision 1102)
@@ -0,0 +1,61 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4OpenGLFontBaseStore.hh,v 1.4 2009/02/04 16:48:40 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// J.Allison  Apr 2005.
+
+// Class Description:
+// Facilitates sharing of font bases between scene handler and viewers.
+
+#ifndef G4OPENGLFONTBASESTORE_HH
+#define G4OPENGLFONTBASESTORE_HH
+
+#include "globals.hh"
+#include <map>
+#include <vector>
+
+class G4VViewer;
+
+class G4OpenGLFontBaseStore {
+public:
+  static void AddFontBase(G4VViewer*, G4int fontBase,
+			  G4double size, const G4String& fontName);
+  static G4int GetFontBase(G4VViewer*, G4double size);
+private:
+  struct FontInfo {
+    FontInfo():
+      fFontName(""), fSize(0), fFontBase(-1) {}
+    FontInfo(const G4String& fontName, G4double size, G4int fontBase):
+      fFontName(fontName), fSize(size), fFontBase(fontBase) {}
+    G4String fFontName;
+    G4double fSize;  // In terms of G4VMarker Screen Size.
+    G4int fFontBase;
+  };
+  static std::map<G4VViewer*,std::vector<FontInfo> > fFontBaseMap;
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLImmediateQt.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLImmediateQt.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLImmediateQt.hh	(revision 1102)
@@ -0,0 +1,49 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLImmediateQt.hh,v 1.2 2009/02/04 16:48:40 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// OpenGLImmediateQt graphics system factory.
+
+#if defined (G4VIS_BUILD_OPENGLQT_DRIVER) || defined (G4VIS_USE_OPENGLQT)
+
+#ifndef G4OPENGLIMMEDIATEQT_HH
+#define G4OPENGLIMMEDIATEQT_HH
+
+#include "G4VGraphicsSystem.hh"
+
+class G4OpenGLImmediateQt: public G4VGraphicsSystem {
+public:
+  G4OpenGLImmediateQt ();
+  G4VSceneHandler* CreateSceneHandler (const G4String& name = "");
+  G4VViewer*  CreateViewer  (G4VSceneHandler&, const G4String& name = "");
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLImmediateQtViewer.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLImmediateQtViewer.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLImmediateQtViewer.hh	(revision 1102)
@@ -0,0 +1,80 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLImmediateQtViewer.hh,v 1.5 2009/02/04 16:48:40 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Class G4OpenGLImmediateQtViewer : a class derived from
+//   G4OpenGLQtViewer and G4OpenGLImmediateViewer.
+
+#ifdef G4VIS_BUILD_OPENGLQT_DRIVER
+
+#ifndef G4OpenGLIMMEDIATEQTVIEWER_HH
+#define G4OpenGLIMMEDIATEQTVIEWER_HH
+
+#include "G4VViewer.hh"
+#include "G4OpenGLImmediateViewer.hh"
+#include "G4OpenGLQtViewer.hh"
+
+#include <qgl.h> // include <qglwidget.h>
+
+#include "globals.hh"
+
+class G4OpenGLImmediateSceneHandler;
+
+class G4OpenGLImmediateQtViewer:
+  public G4OpenGLQtViewer, public G4OpenGLImmediateViewer, public QGLWidget {
+  
+public:
+  G4OpenGLImmediateQtViewer (G4OpenGLImmediateSceneHandler& scene,
+                const G4String& name = "");
+  ~G4OpenGLImmediateQtViewer ();
+  void Initialise ();
+  void initializeGL ();
+  void DrawView ();
+  void FinishView ();
+  void resizeGL(int width,int height);
+  void paintGL();
+  void updateQWidget();
+  void ShowView ();
+
+protected:
+  void wheelEvent(QWheelEvent *event);
+  void mousePressEvent(QMouseEvent *event);
+  void mouseMoveEvent(QMouseEvent *event);
+  void mouseDoubleClickEvent(QMouseEvent *event);
+  void mouseReleaseEvent(QMouseEvent *event);
+  void contextMenuEvent(QContextMenuEvent *e);
+  void keyPressEvent (QKeyEvent * event); 
+private:
+  void ComputeView ();
+
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLImmediateSceneHandler.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLImmediateSceneHandler.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLImmediateSceneHandler.hh	(revision 1102)
@@ -0,0 +1,76 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLImmediateSceneHandler.hh,v 1.15 2009/02/04 16:48:40 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Andrew Walkden  10th February 1997
+// G4OpenGLImmediateSceneHandler - no Display lists.
+
+#ifdef G4VIS_BUILD_OPENGL_DRIVER
+
+#ifndef G4OPENGLIMMEDIATESCENEHANDLER_HH
+#define G4OPENGLIMMEDIATESCENEHANDLER_HH
+
+#include "G4OpenGLSceneHandler.hh"
+#include "globals.hh"
+
+class G4OpenGLImmediate;
+
+class G4OpenGLImmediateSceneHandler: public G4OpenGLSceneHandler {
+
+public:
+
+  G4OpenGLImmediateSceneHandler (G4VGraphicsSystem& system, const G4String& name);
+  virtual ~G4OpenGLImmediateSceneHandler ();
+  void BeginPrimitives (const G4Transform3D& objectTransformation);
+  void EndPrimitives ();
+  void BeginPrimitives2D (const G4Transform3D& objectTransformation);
+  void EndPrimitives2D ();
+  void BeginModeling ();
+  void EndModeling ();
+  void AddPrimitive (const G4Polyline&);
+  void AddPrimitive (const G4Polymarker&);
+  void AddPrimitive (const G4Text& text);
+  void AddPrimitive (const G4Circle&);
+  void AddPrimitive (const G4Square&);
+  void AddPrimitive (const G4Scale& scale);
+  void AddPrimitive (const G4Polyhedron&);
+  void AddPrimitive (const G4NURBS&);
+  void ClearTransientStore ();
+
+protected:
+
+  void RequestPrimitives (const G4VSolid& solid);
+  void AddPrimitivePreamble(const G4Visible& visible);
+
+  static G4int    fSceneIdCount;  // static counter for OpenGLImmediate scenes.
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLImmediateViewer.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLImmediateViewer.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLImmediateViewer.hh	(revision 1102)
@@ -0,0 +1,56 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLImmediateViewer.hh,v 1.10 2009/02/04 16:48:40 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Andrew Walkden  7th February 1997
+// Class G4OpenGLImmediateViewer : Encapsulates the `immediateness' of
+//                                 an OpenGL viewer, for inheritance by
+//                                 derived (X, Xm...) classes.
+
+#ifdef G4VIS_BUILD_OPENGL_DRIVER
+
+#ifndef G4OPENGLIMMEDIATEVIEWER_HH
+#define G4OPENGLIMMEDIATEVIEWER_HH
+
+#include "G4OpenGLViewer.hh"
+#include "globals.hh"
+
+class G4OpenGLSceneHandler;
+class G4OpenGLImmediateSceneHandler;
+
+class G4OpenGLImmediateViewer: virtual public G4OpenGLViewer {
+  
+public:
+  G4OpenGLImmediateViewer (G4OpenGLImmediateSceneHandler& scene);
+  void ProcessView ();
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLImmediateWin32.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLImmediateWin32.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLImmediateWin32.hh	(revision 1102)
@@ -0,0 +1,49 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLImmediateWin32.hh,v 1.8 2009/02/04 16:48:40 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// OpenGLImmediateWin32 graphics system factory.
+
+#if defined (G4VIS_BUILD_OPENGLWIN32_DRIVER) || defined (G4VIS_USE_OPENGLWIN32)
+
+#ifndef G4OPENGLIMMEDIATEWIN32_HH
+#define G4OPENGLIMMEDIATEWIN32_HH
+
+#include "G4VGraphicsSystem.hh"
+
+class G4OpenGLImmediateWin32: public G4VGraphicsSystem {
+public:
+  G4OpenGLImmediateWin32 ();
+  G4VSceneHandler* CreateSceneHandler (const G4String& name = "");
+  G4VViewer*  CreateViewer  (G4VSceneHandler&, const G4String& name = "");
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLImmediateWin32Viewer.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLImmediateWin32Viewer.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLImmediateWin32Viewer.hh	(revision 1102)
@@ -0,0 +1,59 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLImmediateWin32Viewer.hh,v 1.10 2009/02/04 16:48:40 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Class G4OpenGLImmediateWin32Viewer : a class derived from
+//   G4OpenGLWin32Viewer and G4OpenGLImmediateViewer.
+
+#ifdef G4VIS_BUILD_OPENGLWIN32_DRIVER
+
+#ifndef G4OpenGLIMMEDIATEWIN32VIEWER_HH
+#define G4OpenGLIMMEDIATEWIN32VIEWER_HH
+
+#include "G4OpenGLImmediateViewer.hh"
+#include "G4OpenGLWin32Viewer.hh"
+
+#include "globals.hh"
+
+class G4OpenGLImmediateSceneHandler;
+
+class G4OpenGLImmediateWin32Viewer:
+public G4OpenGLWin32Viewer, public G4OpenGLImmediateViewer{
+  
+public:
+  G4OpenGLImmediateWin32Viewer (G4OpenGLImmediateSceneHandler& scene,
+				const G4String& name = "");
+  void Initialise ();
+  void DrawView ();
+  void FinishView ();
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLImmediateX.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLImmediateX.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLImmediateX.hh	(revision 1102)
@@ -0,0 +1,51 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLImmediateX.hh,v 1.8 2009/02/04 16:48:40 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Andrew Walkden  10th February 1997
+// OpenGL graphics system factory.
+
+#if defined (G4VIS_BUILD_OPENGLX_DRIVER) || defined (G4VIS_USE_OPENGLX)
+
+#ifndef G4OPENGLIMMEDIATEX_HH
+#define G4OPENGLIMMEDIATEX_HH
+
+#include "G4VGraphicsSystem.hh"
+
+class G4OpenGLImmediateX: public G4VGraphicsSystem {
+public:
+  G4OpenGLImmediateX ();
+  virtual ~G4OpenGLImmediateX ();
+  G4VSceneHandler* CreateSceneHandler (const G4String& name = "");
+  G4VViewer*  CreateViewer  (G4VSceneHandler&, const G4String& name = "");
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLImmediateXViewer.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLImmediateXViewer.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLImmediateXViewer.hh	(revision 1102)
@@ -0,0 +1,61 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLImmediateXViewer.hh,v 1.10 2009/02/04 16:48:40 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Andrew Walkden  7th February 1997
+// Class G4OpenGLImmediateXViewer : a class derived from G4OpenGLXViewer and
+//                                  G4OpenGLImmediateViewer.
+
+#ifdef G4VIS_BUILD_OPENGLX_DRIVER
+
+#ifndef G4OpenGLIMMEDIATEXVIEWER_HH
+#define G4OpenGLIMMEDIATEXVIEWER_HH
+
+#include "G4OpenGLImmediateViewer.hh"
+#include "G4OpenGLXViewer.hh"
+
+#include "globals.hh"
+
+class G4OpenGLImmediateSceneHandler;
+
+class G4OpenGLImmediateXViewer:
+public G4OpenGLXViewer, public G4OpenGLImmediateViewer{
+  
+public:
+  G4OpenGLImmediateXViewer (G4OpenGLImmediateSceneHandler& scene,
+			  const G4String& name = "");
+  virtual ~G4OpenGLImmediateXViewer ();
+  void Initialise ();
+  void DrawView ();
+  void FinishView ();
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLImmediateXm.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLImmediateXm.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLImmediateXm.hh	(revision 1102)
@@ -0,0 +1,51 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLImmediateXm.hh,v 1.8 2009/02/04 16:48:40 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Andrew Walkden  10th February 1997
+// OpenGL graphics system factory.
+
+#if defined (G4VIS_BUILD_OPENGLXM_DRIVER) || defined (G4VIS_USE_OPENGLXM)
+
+#ifndef G4OPENGLIMMEDIATEXM_HH
+#define G4OPENGLIMMEDIATEXM_HH
+
+#include "G4VGraphicsSystem.hh"
+
+class G4OpenGLImmediateXm: public G4VGraphicsSystem {
+public:
+  G4OpenGLImmediateXm ();
+  virtual ~G4OpenGLImmediateXm ();
+  G4VSceneHandler* CreateSceneHandler (const G4String& name = "");
+  G4VViewer*  CreateViewer  (G4VSceneHandler&, const G4String& name = "");
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLImmediateXmViewer.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLImmediateXmViewer.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLImmediateXmViewer.hh	(revision 1102)
@@ -0,0 +1,62 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLImmediateXmViewer.hh,v 1.10 2009/02/04 16:48:40 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Andrew Walkden  10th February 1997
+// G4OpenGLXmViewer : Class derived from G4OpenGLXViewer, to provide
+//                  (Motif) widget OpenGL functionality for GEANT4.
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#ifndef G4OPENGLIMMEDIATEXMVIEWER_HH
+#define G4OPENGLIMMEDIATEXMVIEWER_HH
+
+#include "G4OpenGLImmediateViewer.hh"
+#include "G4OpenGLXmViewer.hh"
+
+#include "globals.hh"
+
+class G4OpenGLImmediateSceneHandler;
+
+class G4OpenGLImmediateXmViewer:
+public G4OpenGLXmViewer, public G4OpenGLImmediateViewer{
+  
+public:
+  G4OpenGLImmediateXmViewer (G4OpenGLImmediateSceneHandler& scene,
+			   const G4String& name = "");
+  virtual ~G4OpenGLImmediateXmViewer ();
+  void Initialise ();
+  void DrawView ();
+  void FinishView ();
+
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLQtExportDialog.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLQtExportDialog.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLQtExportDialog.hh	(revision 1102)
@@ -0,0 +1,137 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLQtExportDialog.hh,v 1.7 2009/02/04 16:48:40 lgarnier Exp $
+// GEANT4 tag $Name: 
+//
+// 
+
+#ifdef G4VIS_BUILD_OPENGLQT_DRIVER
+
+#ifndef G4OPENGLQTEXPORTDIALOG_HH
+#define G4OPENGLQTEXPORTDIALOG_HH
+
+#include <qdialog.h>
+
+class QButtonGroup;
+class QPushButton;
+class QRadioButton;
+class QCheckBox;
+class QSlider;
+class QComboBox;
+class QLabel;
+class QLineEdit;
+
+#if QT_VERSION >= 0x040000
+class QGroupBox;
+#endif
+
+/** The G4OpenGLQtExportDialog class provide a Dialog displaying differents options
+    for each file format
+*/
+class G4OpenGLQtExportDialog : public QDialog
+{
+  Q_OBJECT
+
+ public:
+  /** Construct a G4OpenGLQtExportDialog
+      @param parent : parent widget
+      @param format : format of save file in lower case
+      @param height : height of the original file
+      @param width : width of the original file
+  */
+  G4OpenGLQtExportDialog(QWidget* parent, QString format, int height =0, int width=0);
+
+  /** Destroys G4OpenGLQtExportDialog */
+  ~G4OpenGLQtExportDialog();
+
+  /** @return the value of the slider if format has a slider widget, instead return -1 */
+  int getSliderValue();
+
+  /** return the new width for file if format has a width widget, instead return 
+      the original value */
+  int getWidth();
+
+  /** return the new height for file if format has a height widget, instead return
+      the original value  */
+  int getHeight();
+
+  /** return the value of the transparency if format has a transparency, instead return -1 */
+  int getTransparency();
+
+  /** return the numbers of colors in the picture if format has a BW/Color widget, instead return -1 */
+  int getNbColor();
+
+  /** return if vector EPS is checked, if button does'nt exist, return 0 */
+  bool getVectorEPS();
+
+	    public slots:
+
+	    /** Called by a clic on modify/original size button.This will 
+		invert buttons and hide/unhide size
+	    */
+	    void changeSizeBox();  
+
+  /** Called by a clic on vectorEPS check box.If vectorEPS checkBox is checked,
+      it will enable change size buttons. Else it will disable them.
+  */
+  void changeVectorEPS();
+
+  /** Called by changing value in height lineEdit. If ratio is keep, will also change the width
+   */
+  void textWidthChanged(const QString &); 
+
+  /** Called by changing value in width lineEdit. If ratio is keep, will also change the height
+   */
+  void textHeightChanged(const QString &); 
+
+ private:
+  QString f_name, f_type, f_dir;
+  QLabel* qualityLabel;
+  bool expAll;
+  QPushButton* buttonOk;
+  QPushButton* buttonCancel;
+
+#if QT_VERSION >= 0x040000
+  QGroupBox * sizeGroupBox;
+#endif
+
+  QCheckBox* transparencyEPS,*boxTransparency,*vectorEPSCheckBox;
+  QCheckBox* ratioCheckBox;
+  QSlider * qualitySlider;
+  QLabel *formatLabel;
+  QRadioButton* colorButton,*BWButton;
+  QRadioButton* original,* modify;
+  QLineEdit* height,*width;
+  QWidget* heightWidget,* widthWidget;
+  int originalWidth;
+  int originalHeight;
+  bool isChangingSize;
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLQtMovieDialog.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLQtMovieDialog.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLQtMovieDialog.hh	(revision 1102)
@@ -0,0 +1,97 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLQtMovieDialog.hh,v 1.4 2008/10/07 05:36:11 lgarnier Exp $
+// GEANT4 tag $Name: 
+//
+// 
+
+#ifdef G4VIS_BUILD_OPENGLQT_DRIVER
+
+#ifndef G4OPENGLQTMOVIEDIALOG_HH
+#define G4OPENGLQTMOVIEDIALOG_HH
+
+#include <qdialog.h>
+
+class QPushButton;
+class QLabel;
+class QLineEdit;
+class G4OpenGLQtViewer;
+
+#if QT_VERSION >= 0x040000
+class QGroupBox;
+#endif
+
+/** The G4OpenGLQtMovieDialog class provide a Dialog displaying differents options
+    for each file format
+*/
+class G4OpenGLQtMovieDialog : public QDialog
+{
+  Q_OBJECT
+
+ public:
+  /** Construct a G4OpenGLQtMovieDialog
+      @param parent : parent widget
+  */
+  G4OpenGLQtMovieDialog(G4OpenGLQtViewer*,QWidget*);
+
+  /** Destroys G4OpenGLQtMovieDialog */
+  ~G4OpenGLQtMovieDialog();
+  void setRecordingStatus(QString);
+  void setRecordingInfos(QString);
+
+private :
+  QLineEdit* fEncoderPath;
+  QLineEdit* fTempFolderPath;
+  QLineEdit* fSaveFileName;
+  G4OpenGLQtViewer *fParentViewer;
+  QLabel *fEncoderStatus;
+  QLabel *fTempFolderStatus;
+  QLabel *fSaveFileStatus;
+  QLabel *fRecordingStatus;
+  QLabel *fRecordingInfos;
+  QPushButton *fButtonStopFinishClose;
+  QPushButton *fButtonSave;
+  QPushButton *fButtonStartPause;
+
+public slots :
+  void stopFinishClose();
+  void save();
+  bool checkEncoderSwParameters();
+  bool checkSaveFileNameParameters();
+  bool checkTempFolderParameters();
+
+private slots :
+  void selectEncoderPathAction();
+  void selectTempPathAction();
+  void selectSaveFileNameAction();
+  void resetRecording();
+  void enabledApplyButton();
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLQtViewer.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLQtViewer.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLQtViewer.hh	(revision 1102)
@@ -0,0 +1,242 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLQtViewer.hh,v 1.17 2009/05/13 10:28:00 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// G4OpenGLQtViewer : Class to provide WindowsNT specific
+//                       functionality for OpenGL in GEANT4
+
+#ifdef G4VIS_BUILD_OPENGLQT_DRIVER
+
+#ifndef G4OPENGLQTVIEWER_HH
+#define G4OPENGLQTVIEWER_HH
+
+#include "globals.hh"
+
+#include "G4OpenGLViewer.hh"
+
+#include <qobject.h>
+#include <qpoint.h>
+
+class G4OpenGLSceneHandler;
+
+class QGLWidget;
+class QDialog;
+class QContextMenuEvent;
+#if QT_VERSION < 0x040000
+class QPopupMenu;
+#else
+class QMenu;
+#endif
+class QImage;
+class QAction;
+class QMouseEvent;
+class QKeyEvent;
+class QWheelEvent;
+class QProcess;
+class QTime;
+
+class G4OpenGLSceneHandler;
+class G4OpenGLQtMovieDialog;
+
+class G4OpenGLQtViewer: public QObject, virtual public G4OpenGLViewer {
+
+  Q_OBJECT
+
+public:
+  G4OpenGLQtViewer (G4OpenGLSceneHandler& scene);
+  virtual ~G4OpenGLQtViewer ();
+  void SetView ();
+  virtual void updateQWidget()=0;
+  QString setEncoderPath(QString path);
+  QString getEncoderPath();
+  QString setTempFolderPath(QString path);
+  QString getTempFolderPath();
+  QString setSaveFileName(QString path);
+  QString getSaveFileName();
+  bool isRecording();
+  bool isStopped();
+  bool isPaused();
+  bool isEncoding();
+  bool isWaiting();
+  bool isFailed();
+  void setWaiting();
+  bool isBadEncoder();
+  bool isBadOutput();
+  bool isBadTmp();
+  bool isSuccess();
+  void setBadTmp();
+  void setBadOutput();
+  void setBadEncoder();
+  bool isReadyToEncode();
+  void resetRecording();
+  void encodeVideo();
+  void stopVideo();
+  void saveVideo();
+  bool generateMpegEncoderParameters();
+  void displayRecordingStatus();
+
+protected:
+  void CreateGLQtContext ();
+  virtual void CreateMainWindow (QGLWidget*,QString);
+  void G4manageContextMenuEvent(QContextMenuEvent *e);
+  void G4MousePressEvent(QMouseEvent *event);
+  void G4MouseReleaseEvent();
+  void G4MouseDoubleClickEvent();
+  void G4MouseMoveEvent(QMouseEvent *event);
+  void G4wheelEvent (QWheelEvent * event); 
+  void G4keyPressEvent (QKeyEvent * event); 
+  void rotateQtScene(float, float);
+  void rotateQtCamera(float, float);
+  void moveScene(float, float, float,bool);
+  void FinishView();
+
+
+protected:
+  QGLWidget* fWindow;
+  QDialog* fGLWindow;
+  bool hasPendingEvents();
+  void savePPMToTemp();
+  int fRecordFrameNumber;
+  float fRotationAngleX;
+  float fRotationAngleY;
+  float fRotationAngleZ;
+  float fDeltaRotationAngleX;
+  float fDeltaRotationAngleY;
+  float fDeltaRotationAngleZ;
+
+  bool fHasToRepaint;
+  bool fReadyToPaint;
+
+private:
+  enum mouseActions {STYLE1,STYLE2,STYLE3,STYLE4}; 
+  enum RECORDING_STEP {WAIT,START,PAUSE,CONTINUE,STOP,READY_TO_ENCODE,ENCODING,FAILED,SUCCESS,BAD_ENCODER,BAD_OUTPUT,BAD_TMP,SAVE}; 
+
+  void createPopupMenu();
+  void createRadioAction(QAction *,QAction *, const std::string&,unsigned int a=1);
+  void rescaleImage(int, int);
+  bool printPDF(const std::string,int,QImage);  
+  void showMovieParametersDialog();
+  void initMovieParameters();
+  QString createTempFolder();
+  QString removeTempFolder();
+  void setRecordingStatus(RECORDING_STEP);
+  void setRecordingInfos(QString);
+  QString getProcessErrorMsg();
+
+
+#if QT_VERSION < 0x040000
+  QPopupMenu *fContextMenu;
+#else
+  QMenu *fContextMenu;
+#endif
+
+  mouseActions fMouseAction; // 1: rotate 2:move 3:pick 4:shortcuts 
+  QPoint fLastPos1;
+  QPoint fLastPos2;
+  QPoint fLastPos3;
+  /** delta of scene rotation. This delta is put in degree */
+  G4double fDeltaRotation;
+  /** delta of scene translation. This delta is put in % of the scene view */
+  G4double fDeltaSceneTranslation;
+  /** delta of depth move. This delta is put in % of the scene view */
+  G4double fDeltaDepth;
+  /** delta of zoom move. This delta is put in % of the scene view */
+  G4double fDeltaZoom;
+  /** delta of auto move/rotation. This delta is put in % of the move/rotation param */
+  G4double fDeltaMove;
+  /** To ensure key event are keep one by one */
+  bool fHoldKeyEvent;
+  /** To ensure move event are keep one by one */
+  bool fHoldMoveEvent;
+  /** To ensure rotate event are keep one by one */
+  bool fHoldRotateEvent;
+  bool fAutoMove;
+  QString fEncoderPath;
+  QString fTempFolderPath;
+  QString fMovieTempFolderPath;
+  QString fSaveFileName;
+  QString fParameterFileName;
+  QAction *fRotateAction;
+  QAction *fMoveAction;
+  QAction *fPickAction;
+  QAction *fFullScreenOn;
+  QAction *fFullScreenOff;
+  QAction *fDrawingWireframe;
+  QAction *fDrawingLineRemoval;
+  QAction *fDrawingSurfaceRemoval;
+  QAction *fDrawingLineSurfaceRemoval;
+  G4OpenGLQtMovieDialog* fMovieParametersDialog;
+  RECORDING_STEP fRecordingStep;
+  QProcess *fProcess;
+  QTime *fLastEventTime;
+  int fSpinningDelay;
+  int fLaunchSpinDelay;
+
+signals:
+ void rotateTheta(int);
+ void rotatePhi(int);
+ void moveX(int);
+ void moveY(int);
+ void moveZ(int);
+
+public slots :
+  void startPauseVideo();
+
+private slots :
+  void actionMouseRotate();
+  void actionMouseMove();
+  void actionMousePick();
+  void actionDrawingWireframe();
+  void actionDrawingLineRemoval();
+  void actionDrawingSurfaceRemoval();
+  void actionDrawingLineSurfaceRemoval();
+  void actionSaveImage();
+  void actionMovieParameters();
+
+  void showShortcuts();
+  void toggleDrawingAction(int);
+  void toggleMouseAction(mouseActions);
+  void toggleRepresentation(bool);
+  void toggleProjection(bool);
+  void toggleBackground(bool);
+  void toggleTransparency(bool);
+  void toggleAntialiasing(bool);
+  void toggleHaloing(bool);
+  void toggleAux(bool);
+  void toggleFullScreen(bool);
+  void processEncodeFinished();
+  void processLookForFinished();
+  void processEncodeStdout();
+  // Only use for Qt>4.0
+  //  void dialogClosed();
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLSceneHandler.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLSceneHandler.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLSceneHandler.hh	(revision 1102)
@@ -0,0 +1,124 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLSceneHandler.hh,v 1.26 2009/04/23 10:13:56 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Andrew Walkden  27th March 1996
+// OpenGL scene handler - base for immediate mode and stored mode classes to
+//                        inherit from.
+
+#ifdef G4VIS_BUILD_OPENGL_DRIVER
+
+#ifndef G4OPENGLSCENEHANDLER_HH
+#define G4OPENGLSCENEHANDLER_HH
+
+#include "globals.hh"
+
+#include "G4VSceneHandler.hh"
+#include "G4OpenGLBitMapStore.hh"
+#include <GL/gl.h>
+#include <GL/glu.h>
+
+#include <map>
+
+class G4AttHolder;
+
+// Base class for various OpenGLSceneHandler classes.
+class G4OpenGLSceneHandler: public G4VSceneHandler {
+
+  friend class G4OpenGLViewer;
+
+public:
+  virtual void BeginPrimitives (const G4Transform3D& objectTransformation);
+  virtual void EndPrimitives ();
+  virtual void BeginPrimitives2D (const G4Transform3D& objectTransformation);
+  virtual void EndPrimitives2D ();
+  void AddPrimitive (const G4Polyline&);
+  void AddPrimitive (const G4Polymarker&);
+  void AddPrimitive (const G4Text&);
+  void AddPrimitive (const G4Circle&);
+  void AddPrimitive (const G4Square&);
+  void AddPrimitive (const G4Scale&);
+  void AddPrimitive (const G4Polyhedron&);
+  void AddPrimitive (const G4NURBS&);
+
+  void PreAddSolid (const G4Transform3D& objectTransformation,
+		    const G4VisAttributes&);
+  void AddSolid (const G4Box&);
+  void AddSolid (const G4Cons&);
+  void AddSolid (const G4Tubs&);
+  void AddSolid (const G4Trd&);
+  void AddSolid (const G4Trap&);
+  void AddSolid (const G4Sphere&);
+  void AddSolid (const G4Para&);
+  void AddSolid (const G4Torus&);
+  void AddSolid (const G4Polycone&);
+  void AddSolid (const G4Polyhedra&);
+  void AddSolid (const G4VSolid&);
+  void AddCompound (const G4VTrajectory&);
+  void AddCompound (const G4VHit&);
+
+protected:
+
+  G4OpenGLSceneHandler (G4VGraphicsSystem& system,
+			G4int id,
+			const G4String& name = "");
+  virtual ~G4OpenGLSceneHandler ();
+
+  const G4Polyhedron* CreateSectionPolyhedron ();
+  const G4Polyhedron* CreateCutawayPolyhedron ();
+
+  void ClearAndDestroyAtts();  // Destroys att holders and clears pick map.
+
+  GLuint fPickName;
+  std::map<GLuint, G4AttHolder*> fPickMap;  // For picking.
+
+  G4bool fProcessing2D;
+
+private:
+
+  void AddCircleSquare (const G4VMarker&, G4OpenGLBitMapStore::Shape);
+
+  void DrawXYPolygon
+  (G4OpenGLBitMapStore::Shape,
+   G4double size,
+   const G4Point3D& centre,
+   const G4VisAttributes* pApplicableVisAtts);
+  // Draws in world coordinates a polygon in the screen plane knowing
+  // viewpoint direction and up vector.
+
+  static const GLubyte fStippleMaskHashed [128];
+
+  G4bool fProcessingPolymarker;
+};
+
+#include "G4OpenGLSceneHandler.icc"
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLSceneHandler.icc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLSceneHandler.icc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLSceneHandler.icc	(revision 1102)
@@ -0,0 +1,75 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLSceneHandler.icc,v 1.9 2009/02/04 16:48:40 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Andrew Walkden  20th January 1998
+
+inline void G4OpenGLSceneHandler::AddSolid (const G4Box& box) {
+  G4VSceneHandler::AddSolid (box);
+}
+
+inline void G4OpenGLSceneHandler::AddSolid (const G4Cons& cons) {
+  G4VSceneHandler::AddSolid (cons);
+}
+
+inline void G4OpenGLSceneHandler::AddSolid (const G4Tubs& tubs) {
+  G4VSceneHandler::AddSolid (tubs);
+}
+
+inline void G4OpenGLSceneHandler::AddSolid (const G4Trd& trd) {
+  G4VSceneHandler::AddSolid (trd);
+}
+
+inline void G4OpenGLSceneHandler::AddSolid (const G4Trap& trap) {
+  G4VSceneHandler::AddSolid (trap);
+}
+
+inline void G4OpenGLSceneHandler::AddSolid (const G4Sphere& sphere) {
+  G4VSceneHandler::AddSolid (sphere);
+}
+
+inline void G4OpenGLSceneHandler::AddSolid (const G4Para& para) {
+  G4VSceneHandler::AddSolid (para);
+}
+
+inline void G4OpenGLSceneHandler::AddSolid (const G4Torus& torus) {
+  G4VSceneHandler::AddSolid (torus);
+}
+
+inline void G4OpenGLSceneHandler::AddSolid (const G4Polycone& polycone) {
+  G4VSceneHandler::AddSolid (polycone);
+}
+
+inline void G4OpenGLSceneHandler::AddSolid (const G4Polyhedra& polyhedra) {
+  G4VSceneHandler::AddSolid (polyhedra);
+}
+
+inline void G4OpenGLSceneHandler::AddSolid (const G4VSolid& vsolid) {
+  G4VSceneHandler::AddSolid (vsolid);
+}
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLStoredQt.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLStoredQt.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLStoredQt.hh	(revision 1102)
@@ -0,0 +1,49 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLStoredQt.hh,v 1.2 2009/02/04 16:48:40 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// OpenGLStoredQt graphics system factory.
+
+#if defined (G4VIS_BUILD_OPENGLQT_DRIVER) || defined (G4VIS_USE_OPENGLQT)
+
+#ifndef G4OPENGLSTOREDQT_HH
+#define G4OPENGLSTOREDQT_HH
+
+#include "G4VGraphicsSystem.hh"
+
+class G4OpenGLStoredQt: public G4VGraphicsSystem {
+public:
+  G4OpenGLStoredQt ();
+  G4VSceneHandler* CreateSceneHandler (const G4String& name = "");
+  G4VViewer*  CreateViewer  (G4VSceneHandler&, const G4String& name = "");
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLStoredQtViewer.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLStoredQtViewer.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLStoredQtViewer.hh	(revision 1102)
@@ -0,0 +1,81 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLStoredQtViewer.hh,v 1.8 2009/02/04 16:48:40 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Class G4OpenGLStoredQtViewer : a class derived from
+//   G4OpenGLQtViewer and G4OpenGLStoredViewer.
+
+#ifdef G4VIS_BUILD_OPENGLQT_DRIVER
+
+#ifndef G4OpenGLSTOREDQTVIEWER_HH
+#define G4OpenGLSTOREDQTVIEWER_HH
+
+#include "G4OpenGLStoredViewer.hh"
+#include "G4OpenGLQtViewer.hh"
+
+#include <qgl.h>  // include qglwidget
+
+class QMouseEvent;
+class QWheelEvent;
+class QContextMenuEvent;
+
+class G4OpenGLStoredSceneHandler;
+
+class G4OpenGLStoredQtViewer:
+  public G4OpenGLQtViewer, public G4OpenGLStoredViewer, public QGLWidget {
+  
+public:
+  G4OpenGLStoredQtViewer (G4OpenGLStoredSceneHandler& scene,
+				const G4String& name = "");
+  ~G4OpenGLStoredQtViewer ();
+  void Initialise ();
+  void initializeGL ();
+  void DrawView ();
+  void resizeGL(int width,int height);
+  void paintGL();
+  void updateQWidget();
+  void ShowView ();
+
+protected:
+  void wheelEvent(QWheelEvent *event);
+  void mousePressEvent(QMouseEvent *event);
+  void mouseMoveEvent(QMouseEvent *event);
+  void mouseDoubleClickEvent(QMouseEvent *event);
+  void mouseReleaseEvent(QMouseEvent *event);
+  void contextMenuEvent(QContextMenuEvent *e);
+  void keyPressEvent (QKeyEvent * event); 
+private:
+  void ComputeView ();
+
+  //  QImage glBufferImage;
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLStoredSceneHandler.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLStoredSceneHandler.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLStoredSceneHandler.hh	(revision 1102)
@@ -0,0 +1,116 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLStoredSceneHandler.hh,v 1.28 2009/02/04 16:48:40 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Andrew Walkden  10th February 1997
+// G4OpenGLStoredSceneHandler - creates OpenGL Display lists.
+
+#ifdef G4VIS_BUILD_OPENGL_DRIVER
+
+#ifndef G4OPENGLSTOREDSCENEHANDLER_HH
+#define G4OPENGLSTOREDSCENEHANDLER_HH
+
+#include "globals.hh"
+#include "G4OpenGLSceneHandler.hh"
+#include <map>
+#include <vector>
+#include "G4Polymarker.hh"
+
+class G4OpenGLStored;
+
+class G4OpenGLStoredSceneHandler: public G4OpenGLSceneHandler {
+
+  friend class G4OpenGLStoredViewer;  // ..allows access to P/TODLs.
+
+public:
+
+  G4OpenGLStoredSceneHandler (G4VGraphicsSystem& system, const G4String& name = "");
+  virtual ~G4OpenGLStoredSceneHandler ();
+  void BeginPrimitives (const G4Transform3D& objectTransformation);
+  void EndPrimitives ();
+  void BeginPrimitives2D (const G4Transform3D& objectTransformation);
+  void EndPrimitives2D ();
+  void BeginModeling ();
+  void EndModeling ();
+  void AddPrimitive (const G4Polyline&);
+  void AddPrimitive (const G4Polymarker&);
+  void AddPrimitive (const G4Circle&);
+  void AddPrimitive (const G4Square&);
+  void AddPrimitive (const G4Text&);
+  void AddPrimitive (const G4Scale&);
+  void AddPrimitive (const G4Polyhedron&);
+  void AddPrimitive (const G4NURBS&);
+  void ClearStore ();
+  void ClearTransientStore ();
+
+protected:
+
+  void RequestPrimitives (const G4VSolid& solid);
+  void AddPrimitivePreamble(const G4Visible& visible);
+  void AddPrimitivePostamble();
+
+  static G4int     fSceneIdCount;   // static counter for OpenGLStored scenes.
+  G4int            fDisplayListId;  // Workspace.
+  G4bool  fMemoryForDisplayLists;   // avoid memory overflow
+  G4int fAddPrimitivePreambleNestingDepth;
+  
+  // PODL = Persistent Object Display List.
+  GLint  fTopPODL;                  // List which calls the other PODLs.
+  struct PO {
+    PO(G4int id, const G4Transform3D& tr = G4Transform3D());
+    G4int fDisplayListId;
+    G4Transform3D fTransform;
+    GLuint fPickName;
+  };
+  std::vector<PO> fPOList; 
+  
+  // TO = Transparent Object.
+  struct TO {
+    TO(G4int id, const G4Transform3D& tr = G4Transform3D());
+    G4int fDisplayListId;
+    G4Transform3D fTransform;
+    GLuint fPickName;
+    G4double fStartTime, fEndTime;  // Time range (e.g., for trajectory steps).
+    G4Colour fColour;
+  };
+  std::vector<TO> fTOList; 
+  
+  // Stop-gap solution of structure re-use.
+  // A proper implementation would use geometry hierarchy.
+  std::map <const G4VSolid*, G4int, std::less <const G4VSolid*> > fSolidMap;
+
+private:
+  G4Polymarker fLastPolymarker ;
+  std::vector<   std::vector< G4Polymarker> > fLastPolymarkers ;
+  int nbDoublons;
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLStoredViewer.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLStoredViewer.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLStoredViewer.hh	(revision 1102)
@@ -0,0 +1,66 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLStoredViewer.hh,v 1.10 2009/02/04 16:48:40 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Andrew Walkden  7th February 1997
+// Class G4OpenGLStoredViewer : Encapsulates the `storedness' of
+//                              an OpenGL viewer, for inheritance by
+//                              derived (X, Xm...) classes.
+
+#ifdef G4VIS_BUILD_OPENGL_DRIVER
+
+#ifndef G4OPENGLSTOREDVIEWER_HH
+#define G4OPENGLSTOREDVIEWER_HH
+
+#include "G4VViewer.hh"
+#include "G4OpenGLViewer.hh"
+#include "G4OpenGLSceneHandler.hh"
+#include "G4OpenGLStoredSceneHandler.hh"
+#include "G4OpenGLTransform3D.hh"
+#include "globals.hh"
+
+class G4OpenGLStoredSceneHandler;
+
+class G4OpenGLStoredViewer: virtual public G4OpenGLViewer {
+  
+public:
+  G4OpenGLStoredViewer (G4OpenGLStoredSceneHandler& scene);
+  virtual ~G4OpenGLStoredViewer ();
+  
+protected:
+  void KernelVisitDecision ();
+  G4bool CompareForKernelVisit(G4ViewParameters&);
+  void DrawDisplayLists ();
+  G4OpenGLStoredSceneHandler& fG4OpenGLStoredSceneHandler;
+  G4ViewParameters fLastVP;  // Memory for making kernel visit decisions.
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLStoredWin32.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLStoredWin32.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLStoredWin32.hh	(revision 1102)
@@ -0,0 +1,49 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLStoredWin32.hh,v 1.8 2009/02/04 16:48:40 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// OpenGLStoredWin32 graphics system factory.
+
+#if defined (G4VIS_BUILD_OPENGLWIN32_DRIVER) || defined (G4VIS_USE_OPENGLWIN32)
+
+#ifndef G4OPENGLSTOREDWIN32_HH
+#define G4OPENGLSTOREDWIN32_HH
+
+#include "G4VGraphicsSystem.hh"
+
+class G4OpenGLStoredWin32: public G4VGraphicsSystem {
+public:
+  G4OpenGLStoredWin32 ();
+  G4VSceneHandler* CreateSceneHandler (const G4String& name = "");
+  G4VViewer*  CreateViewer  (G4VSceneHandler&, const G4String& name = "");
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLStoredWin32Viewer.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLStoredWin32Viewer.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLStoredWin32Viewer.hh	(revision 1102)
@@ -0,0 +1,59 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLStoredWin32Viewer.hh,v 1.8 2009/02/04 16:48:40 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Class G4OpenGLStoredWin32Viewer : a class derived from
+//   G4OpenGLWin32Viewer and G4OpenGLStoredViewer.
+
+#ifdef G4VIS_BUILD_OPENGLWIN32_DRIVER
+
+#ifndef G4OPENGLSTOREDWIN32VIEWER_HH
+#define G4OPENGLSTOREDWIN32VIEWER_HH
+
+#include "G4VViewer.hh"
+#include "G4OpenGLStoredViewer.hh"
+#include "G4OpenGLWin32Viewer.hh"
+
+class G4OpenGLStoredSceneHandler;
+
+class G4OpenGLStoredWin32Viewer:
+public G4OpenGLWin32Viewer, public G4OpenGLStoredViewer{
+  
+public:
+  G4OpenGLStoredWin32Viewer (G4OpenGLStoredSceneHandler& scene,
+			     const G4String& name = "");
+  void Initialise ();
+  void DrawView ();
+  void FinishView ();
+};
+
+#endif
+
+#endif
+
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLStoredX.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLStoredX.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLStoredX.hh	(revision 1102)
@@ -0,0 +1,51 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLStoredX.hh,v 1.8 2009/02/04 16:48:40 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Andrew Walkden  10th February 1997
+// OpenGL graphics system factory.
+
+#if defined (G4VIS_BUILD_OPENGLX_DRIVER) || defined (G4VIS_USE_OPENGLX)
+
+#ifndef G4OPENGLSTOREDX_HH
+#define G4OPENGLSTOREDX_HH
+
+#include "G4VGraphicsSystem.hh"
+
+class G4OpenGLStoredX: public G4VGraphicsSystem {
+public:
+  G4OpenGLStoredX ();
+  virtual ~G4OpenGLStoredX ();
+  G4VSceneHandler* CreateSceneHandler (const G4String& name = "");
+  G4VViewer*  CreateViewer  (G4VSceneHandler&, const G4String& name = "");
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLStoredXViewer.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLStoredXViewer.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLStoredXViewer.hh	(revision 1102)
@@ -0,0 +1,59 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLStoredXViewer.hh,v 1.8 2009/02/04 16:48:40 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Andrew Walkden  7th February 1997
+// Class G4OpenGLStoredXViewer : a class derived from G4OpenGLXViewer and
+//                               G4OpenGLStoredViewer.
+
+#ifdef G4VIS_BUILD_OPENGLX_DRIVER
+
+#ifndef G4OPENGLSTOREDXVIEWER_HH
+#define G4OPENGLSTOREDXVIEWER_HH
+
+#include "G4OpenGLStoredViewer.hh"
+#include "G4OpenGLXViewer.hh"
+
+class G4OpenGLStoredSceneHandler;
+
+class G4OpenGLStoredXViewer:
+public G4OpenGLXViewer, public G4OpenGLStoredViewer{
+  
+public:
+  G4OpenGLStoredXViewer (G4OpenGLStoredSceneHandler& scene, const G4String& name = "");
+  virtual ~G4OpenGLStoredXViewer ();
+  void Initialise ();
+  void DrawView ();
+  void FinishView ();
+};
+
+#endif
+
+#endif
+
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLStoredXm.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLStoredXm.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLStoredXm.hh	(revision 1102)
@@ -0,0 +1,50 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLStoredXm.hh,v 1.7 2009/02/04 16:48:40 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Andrew Walkden  10th February 1997
+// OpenGL graphics system factory.
+
+#if defined (G4VIS_BUILD_OPENGLXM_DRIVER) || defined (G4VIS_USE_OPENGLXM)
+
+#ifndef G4OPENGLSTOREDXM_HH
+#define G4OPENGLSTOREDXM_HH
+
+#include "G4VGraphicsSystem.hh"
+
+class G4OpenGLStoredXm: public G4VGraphicsSystem {
+public:
+  G4OpenGLStoredXm ();
+  G4VSceneHandler* CreateSceneHandler (const G4String& name = "");
+  G4VViewer*  CreateViewer  (G4VSceneHandler&, const G4String& name = "");
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLStoredXmViewer.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLStoredXmViewer.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLStoredXmViewer.hh	(revision 1102)
@@ -0,0 +1,59 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLStoredXmViewer.hh,v 1.8 2009/02/04 16:48:40 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Andrew Walkden  10th February 1997
+// Class G4OpenGLStoredXmViewer : a class derived from G4OpenGLXmViewer 
+//                                and G4OpenGLStoredViewer.
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#ifndef G4OpenGLSTOREDXMVIEWER_HH
+#define G4OpenGLSTOREDXMVIEWER_HH
+
+#include "G4OpenGLStoredViewer.hh"
+#include "G4OpenGLXmViewer.hh"
+
+class G4OpenGLStoredSceneHandler;
+
+class G4OpenGLStoredXmViewer:
+public G4OpenGLXmViewer, public G4OpenGLStoredViewer{
+  
+public:
+  G4OpenGLStoredXmViewer (G4OpenGLStoredSceneHandler& scene, const G4String& name = "");
+  virtual ~G4OpenGLStoredXmViewer ();
+  void Initialise ();
+  void DrawView ();
+  void FinishView ();
+
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLTransform3D.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLTransform3D.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLTransform3D.hh	(revision 1102)
@@ -0,0 +1,54 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLTransform3D.hh,v 1.8 2009/02/04 16:48:41 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Andrew Walkden  24th October 1996
+// G4OpenGLTransform3D provides OpenGL style transformation matrix
+// from G4Transform3D.
+
+#ifdef G4VIS_BUILD_OPENGL_DRIVER
+
+#ifndef G4OPENGLTRANSFORM3D_HH
+#define G4OPENGLTRANSFORM3D_HH
+
+#include "G4Transform3D.hh"
+
+#include "G4OpenGL.hh"
+
+class G4OpenGLTransform3D : public G4Transform3D {
+public:
+  G4OpenGLTransform3D (const G4Transform3D &t);
+  const GLdouble* GetGLMatrix ();
+private:
+  GLdouble m[16];
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLViewer.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLViewer.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLViewer.hh	(revision 1102)
@@ -0,0 +1,146 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLViewer.hh,v 1.32 2009/05/14 16:38:23 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Andrew Walkden  27th March 1996
+// OpenGL viewer - opens window, hard copy, etc.
+
+#ifdef G4VIS_BUILD_OPENGL_DRIVER
+
+#ifndef G4OPENGLVIEWER_HH
+#define G4OPENGLVIEWER_HH
+
+#include "G4VViewer.hh"
+#include "G4OpenGL.hh"
+
+class G4OpenGLSceneHandler;
+class G4OpenGL2PSAction;
+
+// Base class for various OpenGLView classes.
+class G4OpenGLViewer: virtual public G4VViewer {
+
+  friend class G4OpenGLSceneHandler;
+  friend class G4OpenGLImmediateSceneHandler;
+  friend class G4OpenGLStoredSceneHandler;
+  friend class G4OpenGLFileSceneHandler;
+  friend class G4OpenGLViewerMessenger;
+
+public:
+  void ClearView  ();
+
+protected:
+  G4OpenGLViewer (G4OpenGLSceneHandler& scene);
+  virtual ~G4OpenGLViewer ();
+  void SetView    ();
+  void HaloingFirstPass ();
+  void HaloingSecondPass ();
+  void HLRFirstPass ();
+  void HLRSecondPass ();
+  void HLRThirdPass ();
+  void InitializeGLView ();
+  void ResizeGLView();
+  void ResizeWindow(unsigned int, unsigned int);
+  void Pick(GLdouble x, GLdouble y);
+  virtual void CreateFontLists () {}
+  void rotateScene (G4double dx, G4double dy,G4double delta);
+//////////////////////////////Vectored PostScript production functions///
+  void printEPS();
+  // print EPS file. Depending of fVectoredPs, it will print Vectored or not
+  void setPrintSize(G4int,G4int);
+  // set the new print size. 
+  // -1 means 'print size' = 'window size'
+  // Setting size greater than max OpenGL viewport size will set the size to
+  // maximum
+  void setPrintFilename(G4String name,G4bool inc);
+  // set print filename. 
+  // if inc, then the filename will be increment by one each time
+  std::string getRealPrintFilename();
+  unsigned int getWinWidth();
+  unsigned int getWinHeight();
+  G4bool sizeHasChanged();
+  // return true if size has change since last redraw
+  GLdouble getSceneNearWidth();
+  GLdouble getSceneFarWidth();
+  GLdouble getSceneDepth();
+  G4bool                            fPrintColour;
+  G4bool                            fVectoredPs;
+
+  G4OpenGLSceneHandler& fOpenGLSceneHandler;
+  G4Colour background;      //the OpenGL clear colour
+  G4bool
+    transparency_enabled,   //is alpha blending enabled?
+    antialiasing_enabled,   //is antialiasing enabled?
+    haloing_enabled;        //is haloing enabled for wireframe?
+  G4double fStartTime, fEndTime;  // Time range (e.g., for trajectory steps).
+  G4double fFadeFactor;  // 0: no fade; 1: maximum fade with time within range.
+  G4bool fDisplayHeadTime;  // Display head time (fEndTime) in 2D text.
+  G4double fDisplayHeadTimeX, fDisplayHeadTimeY;  // 2D screen coords.
+  G4double fDisplayHeadTimeSize;  // Screen size.
+  G4double fDisplayHeadTimeRed, fDisplayHeadTimeGreen, fDisplayHeadTimeBlue;
+  G4bool fDisplayLightFront;// Display light front at head time originating at
+  G4double fDisplayLightFrontX, fDisplayLightFrontY, fDisplayLightFrontZ,
+    fDisplayLightFrontT;
+  G4double fDisplayLightFrontRed, fDisplayLightFrontGreen, fDisplayLightFrontBlue;
+  G4OpenGL2PSAction* fGL2PSAction;
+
+private :
+  G4int                             fPrintSizeX;
+  G4int                             fPrintSizeY;
+  G4String                          fPrintFilename;
+  int                               fPrintFilenameIndex;
+  unsigned int fWinSize_x, fWinSize_y;
+  G4float                           fPointSize;
+  G4bool fSizeHasChanged;
+  // size of the OpenGL frame
+  bool printGl2PS();
+  G4int getRealPrintSizeX();
+  G4int getRealPrintSizeY();
+  GLubyte* grabPixels (int inColor,
+		       unsigned int width,
+		       unsigned int height);
+  bool printNonVectoredEPS ();
+  // print non vectored EPS files
+
+  bool printVectoredEPS();
+  // print vectored EPS files
+};
+
+typedef struct G4OpenGLViewerFeedback3Dcolor {
+  GLfloat x;
+  GLfloat y;
+  GLfloat z;
+  GLfloat red;
+  GLfloat green;
+  GLfloat blue;
+  GLfloat alpha;
+} Feedback3Dcolor;
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLViewerMessenger.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLViewerMessenger.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLViewerMessenger.hh	(revision 1102)
@@ -0,0 +1,67 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLViewerMessenger.hh,v 1.7 2009/05/18 09:07:12 lgarnier Exp $
+// GEANT4 tag $Name:  $
+
+#ifndef G4OPENGLVIEWERMESSENGER_HH
+#define G4OPENGLVIEWERMESSENGER_HH
+
+#include "G4UImessenger.hh"
+
+#include "G4String.hh"
+
+class G4UIdirectory;
+class G4UIcommand;
+class G4UIcmdWithoutParameter;
+class G4UIcmdWithADouble;
+class G4UIcmdWithABool;
+class G4UIcmdWithAString;
+
+class G4OpenGLViewerMessenger: public G4UImessenger {
+public:
+  static G4OpenGLViewerMessenger* GetInstance();  // Singleton constructor.
+  ~G4OpenGLViewerMessenger();
+  void SetNewValue (G4UIcommand*, G4String);
+
+private:
+  G4OpenGLViewerMessenger();  // Private constructor.
+  static G4OpenGLViewerMessenger* fpInstance;
+  G4UIdirectory* fpDirectory;
+  G4UIcmdWithoutParameter* fpCommandPrintEPS;
+  G4UIcommand* fpCommandPrintSize;
+  G4UIcommand* fpCommandPrintFilename;
+  G4UIdirectory* fpDirectorySet;
+  G4UIcommand* fpCommandDisplayHeadTime;
+  G4UIcommand* fpCommandDisplayLightFront;
+  G4UIcommand* fpCommandEndTime;
+  G4UIcmdWithADouble* fpCommandFade;
+  G4UIcmdWithAString* fpCommandPrintMode;
+  G4UIcommand* fpCommandStartTime;
+  G4UIcmdWithABool* fpCommandTransparency;
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLWin32Viewer.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLWin32Viewer.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLWin32Viewer.hh	(revision 1102)
@@ -0,0 +1,67 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLWin32Viewer.hh,v 1.15 2009/02/04 16:48:41 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// G4OpenGLWin32Viewer : Class to provide WindowsNT specific
+//                       functionality for OpenGL in GEANT4
+
+#ifdef G4VIS_BUILD_OPENGLWIN32_DRIVER
+
+#ifndef G4OPENGLWIN32VIEWER_HH
+#define G4OPENGLWIN32VIEWER_HH
+
+#include "globals.hh"
+
+#include "G4OpenGLViewer.hh"
+
+class G4OpenGLSceneHandler;
+
+class G4OpenGLWin32Viewer: virtual public G4OpenGLViewer {
+
+public:
+  G4OpenGLWin32Viewer (G4OpenGLSceneHandler& scene);
+  virtual ~G4OpenGLWin32Viewer ();
+  void SetView ();
+  void ShowView ();
+protected:
+  void GetWin32Connection ();
+  void CreateGLWin32Context ();
+  virtual void CreateMainWindow ();
+  HDC fHDC;
+private:
+  static LRESULT CALLBACK WindowProc(HWND,UINT,WPARAM,LPARAM);
+  static bool SetWindowPixelFormat(HDC);
+private:
+  HWND fWindow;
+  HGLRC fHGLRC;
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXViewer.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXViewer.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXViewer.hh	(revision 1102)
@@ -0,0 +1,107 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXViewer.hh,v 1.32 2009/04/28 14:33:04 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Andrew Walkden  7th February 1997
+// G4OpenGLXViewer : Class to provide XWindows specific
+//                   functionality for OpenGL in GEANT4
+
+#ifdef G4VIS_BUILD_OPENGLX_DRIVER
+
+#ifndef G4OPENGLXVIEWER_HH
+#define G4OPENGLXVIEWER_HH
+
+#include "G4OpenGLViewer.hh"
+#include "globals.hh"
+
+#include <X11/Intrinsic.h>
+
+#include <GL/glx.h>
+
+class G4OpenGLSceneHandler;
+
+class G4OpenGLXViewer: virtual public G4OpenGLViewer {
+
+  friend class G4OpenGLXViewerMessenger;
+  friend class G4OpenGLXmViewer;
+
+public:
+  G4OpenGLXViewer (G4OpenGLSceneHandler& scene);
+  virtual ~G4OpenGLXViewer ();
+  void SetView ();
+  void ShowView ();
+
+protected:
+  void GetXConnection ();
+  void CreateGLXContext (XVisualInfo* vi);
+  virtual void CreateMainWindow ();
+  virtual void CreateFontLists ();
+
+  static int snglBuf_RGBA[12];
+  static int dblBuf_RGBA[13];
+
+//////////////////////////////Pixmap (screen dump) production functions/////
+
+  XWindowAttributes                 xwa;
+  Display                           *dpy;
+  static XVisualInfo                *vi_single_buffer;
+  static XVisualInfo                *vi_double_buffer;
+  XVisualInfo                       *vi_immediate,
+                                    *vi_stored,
+                                    *vi;
+  Colormap                          cmap;
+  XSetWindowAttributes              swa;
+  GLXDrawable                       win;
+  GLXContext                        cx;
+  XEvent                            event;
+  G4int                             *attributeList,
+                                    errorBase,
+                                    eventBase,
+                                    major,
+                                    minor;
+  XSizeHints                        *norm_hints;
+  XWMHints                          *wm_hints;
+  XClassHint                        *class_hints;
+  Pixmap                            icon_pixmap;
+  XSizeHints                        *size_hints;
+  Atom                              Xatom;
+  XTextProperty                     windowName,
+                                    iconName;
+  char                              charViewName [100];
+
+
+private:
+  G4OpenGLXViewer (const G4OpenGLXViewer&);
+  G4OpenGLXViewer& operator = (const G4OpenGLXViewer&);
+  GLXContext                        tmp_cx;
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXViewerMessenger.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXViewerMessenger.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXViewerMessenger.hh	(revision 1102)
@@ -0,0 +1,58 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXViewerMessenger.hh,v 1.2 2006/11/01 11:22:26 allison Exp $
+// GEANT4 tag $Name: geant4-08-02-patch-01 $
+
+#ifdef G4VIS_BUILD_OPENGLX_DRIVER
+
+#ifndef G4OPENGLXVIEWERMESSENGER_HH
+#define G4OPENGLXVIEWERMESSENGER_HH
+
+#include "G4UImessenger.hh"
+
+#include "G4String.hh"
+
+class G4OpenGLXViewer;
+class G4UIdirectory;
+class G4UIcmdWithoutParameter;
+
+class G4OpenGLXViewerMessenger: public G4UImessenger {
+public:
+  static G4OpenGLXViewerMessenger* GetInstance();  // Singleton constructor.
+  ~G4OpenGLXViewerMessenger();
+  void SetNewValue (G4UIcommand*, G4String);
+
+private:
+  G4OpenGLXViewerMessenger();  // Private constructor.
+  static G4OpenGLXViewerMessenger* fpInstance;
+  G4UIdirectory* fpDirectory;
+  G4UIcmdWithoutParameter* fpCommandPrintEPS;
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmBox.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmBox.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmBox.hh	(revision 1102)
@@ -0,0 +1,74 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmBox.hh,v 1.8 2009/02/04 16:48:41 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+//Box container class
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#ifndef G4OPENGLXMBOX_HH
+#define G4OPENGLXMBOX_HH
+
+#include "G4OpenGLXmVWidgetContainer.hh"
+#include "globals.hh"
+
+class G4OpenGLXmVWidgetComponent;
+class G4OpenGLXmVWidgetShell;
+
+class G4OpenGLXmBox : public G4OpenGLXmVWidgetContainer
+{
+
+public:
+  G4OpenGLXmBox (const char* = NULL,
+		 G4bool = False);   //constructor
+  virtual ~G4OpenGLXmBox ();  //destructor
+
+  void AddChild (G4OpenGLXmVWidgetComponent*);
+  void AddYourselfTo (G4OpenGLXmVWidgetShell*);
+
+  Widget* GetPointerToParent ();
+  Widget* GetPointerToWidget ();
+  
+  const char* GetName ();
+  void SetName (const char*);
+
+protected:
+  const char* name;
+  Widget* parent;
+  Widget box_row_col;
+  G4bool radio;
+
+private:
+  G4OpenGLXmBox (const G4OpenGLXmBox&);
+  G4OpenGLXmBox& operator = (const G4OpenGLXmBox&);
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmFourArrowButtons.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmFourArrowButtons.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmFourArrowButtons.hh	(revision 1102)
@@ -0,0 +1,70 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmFourArrowButtons.hh,v 1.7 2009/02/04 16:48:41 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+//Four arrow buttons class. Inherits from G4OpenGLXmVWidgetComponent
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#ifndef G4OPENGLXMFOURARROWBUTTONS_HH
+#define G4OPENGLXMFOURARROWBUTTONS_HH
+
+#include "G4OpenGLXmVWidgetComponent.hh"
+
+class G4OpenGLXmFourArrowButtons : public G4OpenGLXmVWidgetComponent
+{
+
+public:
+  G4OpenGLXmFourArrowButtons (XtCallbackRec** = NULL); // array of 4 callbacks
+                                                       //constructor
+  virtual ~G4OpenGLXmFourArrowButtons ();              //destructor
+
+  void SetName (char*);
+ 
+  char* GetName ();
+
+  void AddYourselfTo (G4OpenGLXmVWidgetContainer*);
+
+  Widget* GetPointerToParent ();
+  Widget* GetPointerToWidget ();
+
+private:
+  XtCallbackRec** callback;
+  Widget arrow_form;
+  Widget arrow;
+  Widget* parent;
+
+private:
+  G4OpenGLXmFourArrowButtons (const G4OpenGLXmFourArrowButtons&);
+  G4OpenGLXmFourArrowButtons& operator = (const G4OpenGLXmFourArrowButtons&);
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmFramedBox.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmFramedBox.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmFramedBox.hh	(revision 1102)
@@ -0,0 +1,64 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmFramedBox.hh,v 1.8 2009/02/04 16:48:41 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+//Framed box container class
+//Inherits from G4OpenGLXmBox
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#ifndef G4OPENGLXMFRAMEDBOX_HH
+#define G4OPENGLXMFRAMEDBOX_HH
+
+#include "G4OpenGLXmBox.hh"
+#include "globals.hh"
+
+class G4OpenGLXmVWidgetComponent;
+class G4OpenGLXmVWidgetShell;
+
+class G4OpenGLXmFramedBox : public G4OpenGLXmBox
+{
+
+public:
+  G4OpenGLXmFramedBox (const char* = NULL, 
+		       G4bool = False);   //constructor
+  virtual ~G4OpenGLXmFramedBox ();               //destructor
+
+  void AddChild (G4OpenGLXmVWidgetComponent*);
+  void AddYourselfTo (G4OpenGLXmVWidgetShell*);
+
+private:
+  G4OpenGLXmFramedBox (const G4OpenGLXmFramedBox&);
+  G4OpenGLXmFramedBox& operator = (const G4OpenGLXmFramedBox&);
+  Widget frame;
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmPushButton.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmPushButton.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmPushButton.hh	(revision 1102)
@@ -0,0 +1,67 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmPushButton.hh,v 1.8 2009/02/04 16:48:41 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+//Push button class. Inherits from G4OpenGLXmVWidgetComponent
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#ifndef G4OPENGLXMPUSHBUTTON_HH
+#define G4OPENGLXMPUSHBUTTON_HH
+
+#include "G4OpenGLXmVWidgetComponent.hh"
+
+class G4OpenGLXmPushButton : public G4OpenGLXmVWidgetComponent
+{
+
+public:
+  G4OpenGLXmPushButton (const char* = NULL,
+			XtCallbackRec* = NULL); //constructor
+  virtual ~G4OpenGLXmPushButton ();             //destructor
+
+  void SetName (const char*);
+  const char* GetName ();
+
+  void AddYourselfTo (G4OpenGLXmVWidgetContainer*);
+
+  Widget* GetPointerToParent ();
+  Widget* GetPointerToWidget ();
+
+private:
+  G4OpenGLXmPushButton (const G4OpenGLXmPushButton&);
+  G4OpenGLXmPushButton& operator = (const G4OpenGLXmPushButton&);
+  const char* name;
+  XtCallbackRec* callback;
+  Widget button;
+  Widget* parent;
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmRadioButton.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmRadioButton.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmRadioButton.hh	(revision 1102)
@@ -0,0 +1,71 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmRadioButton.hh,v 1.8 2009/02/04 16:48:41 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+//Radio button class. Inherits from G4OpenGLXmVWidgetComponent
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#ifndef G4OPENGLXMRADIOBUTTON_HH
+#define G4OPENGLXMRADIOBUTTON_HH
+
+#include "G4OpenGLXmVWidgetComponent.hh"
+
+class G4OpenGLXmRadioButton : public G4OpenGLXmVWidgetComponent
+{
+
+public:
+  G4OpenGLXmRadioButton (const char*,
+			 XtCallbackRec*,
+			 G4bool,
+			 G4int);                    //constructor
+  virtual ~G4OpenGLXmRadioButton ();                //destructor
+
+  void SetName (const char*);
+  const char* GetName ();
+
+  void AddYourselfTo (G4OpenGLXmVWidgetContainer*);
+
+  Widget* GetPointerToParent ();
+  Widget* GetPointerToWidget ();
+
+private:
+  G4OpenGLXmRadioButton (const G4OpenGLXmRadioButton&);
+  G4OpenGLXmRadioButton& operator = (const G4OpenGLXmRadioButton&);
+  const char* name;
+  XtCallbackRec* callback;
+  Widget button;
+  Widget* parent;
+  G4bool default_button;
+  G4int number;
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmResources.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmResources.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmResources.hh	(revision 1102)
@@ -0,0 +1,49 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmResources.hh,v 1.6 2009/02/04 16:48:41 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+//
+// Default resources file for GEANT4 OpenGL Motif windows.
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#ifndef G4OPENGLXMRESOURCES_HH
+#define G4OPENGLXMRESOURCES_HH
+
+static String fallbackResources[] = {
+  "*glxarea*width: 500", "*glxarea*height: 500",
+  "*frame*x: 10", "*frame*y: 10",
+  "*frame*topOffset: 10", "*frame*bottomOffset: 10",
+  "*frame*rightOffset: 10", "*frame*leftOffset: 10",
+  "*frame*shadowType: SHADOW_IN", "*useColorObj: False", 
+  NULL
+  };
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmSeparator.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmSeparator.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmSeparator.hh	(revision 1102)
@@ -0,0 +1,62 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmSeparator.hh,v 1.7 2009/02/04 16:48:41 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+//Separator class. Inherits from G4OpenGLXmVWidgetComponent
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#ifndef G4OPENGLXMSEPARATOR_HH
+#define G4OPENGLXMSEPARATOR_HH
+
+#include "G4OpenGLXmVWidgetComponent.hh"
+
+class G4OpenGLXmSeparator : public G4OpenGLXmVWidgetComponent
+{
+
+public:
+  G4OpenGLXmSeparator (unsigned char = XmSINGLE_LINE);           //constructor
+  virtual ~G4OpenGLXmSeparator ();                               //destructor
+
+  void AddYourselfTo (G4OpenGLXmVWidgetContainer*);
+
+  Widget* GetPointerToParent ();
+  Widget* GetPointerToWidget ();
+
+private:
+  G4OpenGLXmSeparator (const G4OpenGLXmSeparator&);
+  G4OpenGLXmSeparator& operator = (const G4OpenGLXmSeparator&);
+  unsigned char line_type;
+  Widget line;
+  Widget* parent;
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmSliderBar.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmSliderBar.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmSliderBar.hh	(revision 1102)
@@ -0,0 +1,98 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmSliderBar.hh,v 1.8 2009/02/04 16:48:41 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+//Slider bar class. Inherits from G4OpenGLXmVWidgetComponent
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#ifndef G4OPENGLXMSLIDERBAR_HH
+#define G4OPENGLXMSLIDERBAR_HH
+
+#include "G4OpenGLXmVWidgetComponent.hh"
+
+class G4OpenGLXmSliderBar : public G4OpenGLXmVWidgetComponent
+{
+
+public:
+  G4OpenGLXmSliderBar (const char* = NULL,     // name of slider bar
+		       XtCallbackRec* = NULL,  // callbacks for slider bar
+		       G4bool = False,         // show current value if True
+		       short = 0,              // decimal places for show value
+		       G4double = 0.,          // initial value
+		       G4double = 0.,          // max value
+		       G4double = 0.,          // min value
+		       unsigned char = XmHORIZONTAL,
+		       unsigned char = XmMAX_ON_RIGHT); 
+                                               //constructor
+  virtual ~G4OpenGLXmSliderBar ();             //destructor
+
+  void SetName (const char*);
+  void SetShow (G4bool);
+  void SetDecimalPlaces (short);
+  void SetInitialValue (G4double);
+  void SetMaxValue (G4double);
+  void SetMinValue (G4double);
+  void SetOrientation (unsigned char);
+  void SetDirection (unsigned char);
+
+ 
+  const char* GetName ();
+  G4bool GetShow ();
+  short GetDecimalPlaces ();
+  G4double GetInitialValue ();
+  G4double GetMaxValue ();
+  G4double GetMinValue ();
+  unsigned char GetOrientation ();
+  unsigned char GetDirection ();
+
+  void AddYourselfTo (G4OpenGLXmVWidgetContainer*);
+
+  Widget* GetPointerToParent ();
+  Widget* GetPointerToWidget ();
+
+private:
+  G4OpenGLXmSliderBar (const G4OpenGLXmSliderBar&);
+  G4OpenGLXmSliderBar& operator = (const G4OpenGLXmSliderBar&);
+  const char* name;
+  XtCallbackRec* callback;
+  Widget sliderbar;
+  Widget* parent;
+  G4bool show;
+  short decimal_places;
+  G4int initial_value;
+  G4int max_value;
+  G4int min_value;
+  unsigned char orientation;
+  unsigned char direction;
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmTextField.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmTextField.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmTextField.hh	(revision 1102)
@@ -0,0 +1,75 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmTextField.hh,v 1.8 2009/02/04 16:48:41 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+//Text field class. Inherits from G4OpenGLXmVWidgetComponent
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#ifndef G4OPENGLXMTEXTFIELD_HH
+#define G4OPENGLXMTEXTFIELD_HH
+
+#include "G4OpenGLXmVWidgetComponent.hh"
+//#include "G4OpenGLXmConvenienceRoutines.hh"
+
+class G4OpenGLXmTextField : public G4OpenGLXmVWidgetComponent
+{
+
+public:
+  G4OpenGLXmTextField (const char*,G4double*);   //constructor
+  G4OpenGLXmTextField (const char*,const char*); //constructor
+  virtual ~G4OpenGLXmTextField ();               //destructor
+
+  void SetName (const char*);
+  const char* GetName ();
+
+  void SetValue (G4double);
+  void SetValue (const char*);
+  const char* GetValue ();
+
+  void AddYourselfTo (G4OpenGLXmVWidgetContainer*);
+
+  Widget* GetPointerToParent ();
+  Widget* GetPointerToWidget ();
+
+private:
+  G4OpenGLXmTextField (const G4OpenGLXmTextField&);
+  G4OpenGLXmTextField& operator = (const G4OpenGLXmTextField&);
+  const char* name;
+  void* value;
+  G4bool text;
+  char* initial;
+  Widget text_label;
+  Widget text_field;
+  Widget* parent;
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmTopLevelShell.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmTopLevelShell.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmTopLevelShell.hh	(revision 1102)
@@ -0,0 +1,66 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmTopLevelShell.hh,v 1.7 2009/02/04 16:48:41 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+//Top level shell class
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#ifndef G4OPENGLXMTOPLEVELSHELL_HH
+#define G4OPENGLXMTOPLEVELSHELL_HH
+
+#include "G4OpenGLXmVWidgetShell.hh"
+
+class G4OpenGLXmVWidgetContainer;
+
+class G4OpenGLXmTopLevelShell : public G4OpenGLXmVWidgetShell
+{
+
+public:
+  G4OpenGLXmTopLevelShell(G4OpenGLXmViewer*, char*);   //constructor
+  virtual ~G4OpenGLXmTopLevelShell();  //destructor
+
+  void AddChild (G4OpenGLXmVWidgetContainer*);
+  void Realize ();
+
+  Widget* GetPointerToWidget ();
+  char* GetName ();
+
+private:
+  G4OpenGLXmTopLevelShell (const G4OpenGLXmTopLevelShell&);
+  G4OpenGLXmTopLevelShell& operator = (const G4OpenGLXmTopLevelShell&);
+  char* name;
+  Widget toplevel;
+  Widget top_box;
+  Widget frame;
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmVWidgetComponent.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmVWidgetComponent.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmVWidgetComponent.hh	(revision 1102)
@@ -0,0 +1,60 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmVWidgetComponent.hh,v 1.7 2009/02/04 16:48:41 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+//Base class for all Motif component widgets
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#ifndef G4OPENGLXMVWIDGETCOMPONENT_HH
+#define G4OPENGLXMVWIDGETCOMPONENT_HH
+
+#include "G4OpenGLXmVWidgetObject.hh"
+
+class G4OpenGLXmVWidgetContainer;
+
+class G4OpenGLXmVWidgetComponent : public G4OpenGLXmVWidgetObject
+{
+
+public:
+  G4OpenGLXmVWidgetComponent();           //constructor
+  virtual ~G4OpenGLXmVWidgetComponent();  //destructor
+
+  virtual void AddYourselfTo (G4OpenGLXmVWidgetContainer*) = 0;
+
+  virtual Widget* GetPointerToParent () = 0;
+  virtual Widget* GetPointerToWidget () = 0;
+
+private:
+  
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmVWidgetContainer.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmVWidgetContainer.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmVWidgetContainer.hh	(revision 1102)
@@ -0,0 +1,62 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmVWidgetContainer.hh,v 1.7 2009/02/04 16:48:41 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+//Base class for all Motif container widgets
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#ifndef G4OPENGLXMVWIDGETCONTAINER_HH
+#define G4OPENGLXMVWIDGETCONTAINER_HH
+
+#include "G4OpenGLXmVWidgetObject.hh"
+
+class G4OpenGLXmVWidgetShell;
+class G4OpenGLXmVWidgetComponent;
+
+class G4OpenGLXmVWidgetContainer : public G4OpenGLXmVWidgetObject
+{
+
+public:
+  G4OpenGLXmVWidgetContainer();           //constructor
+  virtual ~G4OpenGLXmVWidgetContainer();  //destructor
+
+  virtual void AddChild (G4OpenGLXmVWidgetComponent*) = 0;
+  virtual void AddYourselfTo (G4OpenGLXmVWidgetShell*) = 0;
+
+  virtual Widget* GetPointerToParent () = 0;
+  virtual Widget* GetPointerToWidget () = 0;
+  
+private:
+
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmVWidgetObject.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmVWidgetObject.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmVWidgetObject.hh	(revision 1102)
@@ -0,0 +1,66 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmVWidgetObject.hh,v 1.7 2009/02/04 16:48:41 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+//Virtual base class for all Motif widgets.
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#ifndef G4OPENGLXMVWIDGETOBJECT_HH
+#define G4OPENGLXMVWIDGETOBJECT_HH
+
+#include "globals.hh"
+#include <Xm/Xm.h>
+
+class G4OpenGLXmViewer;
+class G4OpenGLXmVWidgetObject {
+
+public:
+
+  G4OpenGLXmVWidgetObject ();          //constructor
+  virtual ~G4OpenGLXmVWidgetObject (); //destructor
+  
+  G4OpenGLXmViewer* GetView ();  //access to the pView
+  void ProcesspView ();
+
+protected:
+  G4OpenGLXmVWidgetObject (const G4OpenGLXmVWidgetObject&);
+  G4OpenGLXmVWidgetObject& operator = (const G4OpenGLXmVWidgetObject&);
+  G4OpenGLXmViewer* pView;
+  Colormap cmap;
+  Pixel borcol;
+  Pixel bgnd;
+  unsigned int depth;
+  Visual* visual;
+  Widget top;
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmVWidgetShell.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmVWidgetShell.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmVWidgetShell.hh	(revision 1102)
@@ -0,0 +1,58 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmVWidgetShell.hh,v 1.7 2009/02/04 16:48:41 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+//Base class for all Motif window widgets (shells)
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#ifndef G4OPENGLXMVWIDGETSHELL_HH
+#define G4OPENGLXMVWIDGETSHELL_HH
+
+#include "G4OpenGLXmVWidgetObject.hh"
+
+class G4OpenGLXmVWidgetContainer;
+
+class G4OpenGLXmVWidgetShell : public G4OpenGLXmVWidgetObject
+{
+
+public:
+  G4OpenGLXmVWidgetShell();   //constructor
+  virtual ~G4OpenGLXmVWidgetShell();  //destructor
+
+  virtual Widget* GetPointerToWidget() = 0;
+  virtual void AddChild (G4OpenGLXmVWidgetContainer*) = 0;
+  virtual void Realize () = 0;
+
+private:
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmViewer.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmViewer.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmViewer.hh	(revision 1102)
@@ -0,0 +1,384 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmViewer.hh,v 1.11 2009/02/04 16:48:41 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Andrew Walkden  10th February 1997
+// G4OpenGLXmViewer : Class derived from G4OpenGLXViewer, to provide
+//                    (Motif) widget OpenGL functionality for GEANT4.
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#ifndef G4OPENGLXMVIEWER_HH
+#define G4OPENGLXMVIEWER_HH
+
+#include "G4OpenGLXViewer.hh"
+#include "globals.hh"
+
+#include <Xm/Xm.h>
+
+class G4OpenGLXmTopLevelShell;
+class G4OpenGLXmRadioButton;
+class G4OpenGLXmPushButton;
+class G4OpenGLXmSliderBar;
+class G4OpenGLXmBox;
+class G4OpenGLXmTextField;
+class G4OpenGLXmFramedBox;
+class G4OpenGLXmFourArrowButtons;
+class G4OpenGLXmSeparator;
+
+class G4OpenGLXmViewer: public G4OpenGLXViewer {
+
+public:
+  G4OpenGLXmViewer (G4OpenGLSceneHandler& scene);
+  virtual ~G4OpenGLXmViewer ();
+  
+protected:
+  virtual void ShowView ();
+  void GetXmConnection ();
+  virtual void CreateMainWindow ();
+
+  XtAppContext                      app;
+  XtWorkProcId                      workId;
+  Widget                            toplevel, 
+                                    shell,
+                                    main_win, 
+                                    menubar,
+                                    style_cascade,
+                                    actions_cascade,
+                                    misc_cascade,
+                                    spec_cascade,
+                                    rep_style_pullright, 
+                                    drawing_style_pullright, 
+                                    background_color_pullright, 
+                                    transparency_pullright, 
+                                    antialias_pullright, 
+                                    haloing_pullright, 
+                                    aux_edge_pullright, 
+                                    frame, 
+                                    glxarea;
+  
+  XmString                          style_str,
+                                    actions_str,
+                                    misc_str,
+                                    spec_str,
+                                    rep_str,
+                                    draw_str,
+                                    polyhedron_str,
+                                    nurbs_str,
+                                    wireframe_str,
+                                    hlr_str,
+                                    hsr_str,
+                                    hlhsr_str,
+                                    set_str,
+				    rot_str,
+				    pan_str,
+				    exit_str,
+				    quit_str,
+                                    print_str,
+				    white_str,
+				    black_str,
+				    anti_str,
+				    trans_str,
+				    halo_str,
+				    aux_edge_str,
+				    bgnd_str,
+				    off_str,
+				    on_str;
+
+  G4double                          zoom_high,
+                                    zoom_low,
+                                    pan_low,
+                                    pan_high,
+                                    dolly_low,
+                                    dolly_high,
+                                    fov,
+                                    rot_sens_limit,
+                                    pan_sens_limit,
+                                    rot_sens,
+                                    pan_sens,
+                                    wob_sens;
+
+  Pixel                             bgnd, 
+                                    borcol;
+
+  G4bool                            pan_right,
+                                    rotate_right,
+                                    pan_up,
+                                    rotate_up;
+
+  XtIntervalId                      rotation_timer,
+                                    pan_timer,
+                                    wobble_timer;
+
+  G4Vector3D                        original_vp;
+
+  G4int                             frameNo;
+
+  G4OpenGLXmTopLevelShell*          fprotation_top;
+  G4OpenGLXmBox*                    fprotation_button_box;
+  G4OpenGLXmRadioButton*            fprotation_button1;
+  G4OpenGLXmRadioButton*            fprotation_button2;
+  G4OpenGLXmBox*                    fprotation_slider_box;
+  G4OpenGLXmSliderBar*              fprotation_slider;
+  G4OpenGLXmBox*                    fprotation_arrow_box;
+  G4OpenGLXmFourArrowButtons*       fprotation_arrow;
+
+  G4OpenGLXmTopLevelShell*          fppanning_top; 
+  G4OpenGLXmFramedBox*              fppanning_box;
+  G4OpenGLXmFourArrowButtons*       fppanning_arrows;
+  G4OpenGLXmSliderBar*              fppanning_slider;
+  G4OpenGLXmFramedBox*              fpzoom_box;
+  G4OpenGLXmSliderBar*              fpzoom_slider;
+  G4OpenGLXmFramedBox*              fpdolly_box;
+  G4OpenGLXmSliderBar*              fpdolly_slider;
+
+  G4OpenGLXmTopLevelShell*          fpsetting_top;
+  G4OpenGLXmFramedBox*              fpsetting_box;
+  G4OpenGLXmTextField*              fppan_set;
+  G4OpenGLXmTextField*              fprot_set;
+  G4OpenGLXmTextField*              fpzoom_upper;
+  G4OpenGLXmTextField*              fpzoom_lower;
+  G4OpenGLXmTextField*              fpdolly_upper;
+  G4OpenGLXmTextField*              fpdolly_lower;
+  G4OpenGLXmPushButton*             fpok_button;
+
+  G4OpenGLXmTopLevelShell*          fpmiscellany_top;
+  G4OpenGLXmFramedBox*              fpwobble_box;
+  G4OpenGLXmPushButton*             fpwobble_button;
+  G4OpenGLXmSliderBar*              fpwobble_slider;
+  G4OpenGLXmFramedBox*              fpreset_box;
+  G4OpenGLXmPushButton*             fpreset_button;
+  G4OpenGLXmFramedBox*              fpproj_style_box;
+  G4OpenGLXmRadioButton*            fporthogonal_button;
+  G4OpenGLXmRadioButton*            fpperspective_button;
+  G4OpenGLXmTextField*              fpfov_text;
+
+  G4OpenGLXmTopLevelShell*          fpprint_top;
+  G4OpenGLXmFramedBox*              fpprint_box;
+  G4OpenGLXmFramedBox*              fpprint_col_box;
+  G4OpenGLXmFramedBox*              fpprint_style_box;
+  G4OpenGLXmTextField*              fpprint_text;
+  G4OpenGLXmPushButton*             fpprint_button;
+  G4OpenGLXmSeparator*              fpprint_line;
+  G4OpenGLXmRadioButton*            fpprint_col_radio1;
+  G4OpenGLXmRadioButton*            fpprint_col_radio2;
+  G4OpenGLXmRadioButton*            fpprint_style_radio1;
+  G4OpenGLXmRadioButton*            fpprint_style_radio2;
+
+public:
+
+  static void expose_callback (Widget w, 
+			       XtPointer clientData, 
+			       XtPointer callData);
+  
+  static void resize_callback (Widget w, 
+			       XtPointer clientData, 
+			       XtPointer callData);
+  
+  static void activate_callback (Widget w, 
+			       XtPointer clientData, 
+			       XtPointer callData);
+  
+  static void actions_callback (Widget w, 
+				XtPointer clientData, 
+				XtPointer callData);
+  
+  static void misc_callback (Widget w, 
+			     XtPointer clientData, 
+			     XtPointer callData);
+  
+  static void Add_set_field (char* widget, 
+			     char* widget_text, 
+			     Widget* row_col_box, 
+			     Widget* wid, 
+			     G4double* val,
+			     G4OpenGLXmViewer* pView);
+  
+  static void zoom_callback (Widget w, 
+			     XtPointer clientData, 
+			     XtPointer callData);
+  
+  static void dolly_callback (Widget w, 
+			      XtPointer clientData, 
+			      XtPointer callData);
+  
+  static void pan_left_right_callback (Widget w, 
+				       XtPointer clientData, 
+				       XtPointer callData);
+  
+  static void left_right_pan_callback (XtPointer clientData, 
+				       XtIntervalId* timer_id); 
+  
+  static void theta_rotation_callback (Widget w, 
+				       XtPointer clientData, 
+				       XtPointer callData);
+  
+  static void phi_rotation_callback (Widget w, 
+				     XtPointer clientData, 
+				     XtPointer callData);
+  
+  static void pan_up_down_callback (Widget w, 
+				    XtPointer clientData, 
+				    XtPointer callData);
+  
+  static void up_down_pan_callback (XtPointer clientData, 
+				    XtIntervalId* timer_id); 
+  
+  static void drawing_style_callback (Widget w, 
+				      XtPointer clientData, 
+				      XtPointer callData);
+  
+  static void rep_style_callback (Widget w, 
+				  XtPointer clientData, 
+				  XtPointer callData);
+  
+  static void background_color_callback (Widget w, 
+					 XtPointer clientData, 
+					 XtPointer callData);
+  
+  static void set_rot_subject_callback (Widget w, 
+					XtPointer clientData, 
+					XtPointer callData);
+  
+  static void set_rot_sens_callback (Widget w, 
+				     XtPointer clientData, 
+				     XtPointer callData);
+  
+  static void set_pan_sens_callback (Widget w, 
+				     XtPointer clientData, 
+				     XtPointer callData);
+  
+  static void set_wob_sens_callback (Widget w, 
+				     XtPointer clientData, 
+				     XtPointer callData);
+  
+  static void projection_callback (Widget w, 
+				   XtPointer clientData, 
+				   XtPointer callData);
+  
+  static void wobble_callback (Widget w, 
+			       XtPointer clientData, 
+			       XtPointer callData);
+  
+  static void reset_callback (Widget w, 
+			      XtPointer clientData, 
+			      XtPointer callData);
+  
+  static void update_panels_callback (Widget w, 
+				      XtPointer clientData, 
+				      XtPointer callData);
+  
+  static void wobble_timer_callback (XtPointer clientData, 
+				     XtIntervalId* timerid);
+  
+  static void Add_radio_box (char* label_string,
+			     Widget* parent_frame_widget,
+			     XtCallbackRec* radio_box_cb,
+			     G4int num_buttons,
+			     G4int default_button,
+			     char* radio_box_name,
+			     char** button_names,
+			     G4OpenGLXmViewer* pView);
+  
+  static void Add_four_arrow_buttons (G4OpenGLXmViewer* pView,
+				      XtCallbackRec** arrow_callbacks,
+				      Widget* parent_widget);
+  
+  static void Add_slider_box (char* label_string,
+			      G4int num_sliders,
+			      char** slider_name,
+			      G4OpenGLXmViewer* pView,
+			      G4double* min_array,
+			      G4double* max_array,
+			      G4double* value_array,
+			      G4bool* show,
+			      short* decimals,
+			      unsigned char* orientation,
+			      unsigned char* direction,
+			      XtCallbackRec** slider_box_cb,
+			      Widget* parent_frame_widget);
+  
+  static void rotate_in_theta (XtPointer clientData,
+			       XtIntervalId* timer_id);
+  
+  static void rotate_in_phi (XtPointer clientData,
+			     XtIntervalId* timer_id);
+  
+  static void get_double_value_callback (Widget w, 
+					 XtPointer clientData, 
+					 XtPointer callData); 
+  
+  static void get_text_callback (Widget w, 
+				 XtPointer clientData, 
+				 XtPointer callData); 
+  
+  static void transparency_callback (Widget w, 
+				     XtPointer clientData, 
+				     XtPointer callData); 
+  
+  static void antialias_callback (Widget w, 
+				  XtPointer clientData, 
+				  XtPointer callData); 
+
+  static void haloing_callback (Widget w, 
+				XtPointer clientData, 
+				XtPointer callData); 
+
+  static void aux_edge_callback (Widget w, 
+				XtPointer clientData, 
+				XtPointer callData); 
+
+  static void set_print_colour_callback (Widget w, 
+					 XtPointer clientData, 
+					 XtPointer callData); 
+
+  static void set_print_style_callback (Widget w, 
+					XtPointer clientData, 
+					XtPointer callData); 
+
+  static void print_callback (Widget w, 
+			      XtPointer clientData, 
+			      XtPointer callData); 
+
+  static G4bool get_boolean_userData (Widget w);
+
+  static G4int  get_int_userData (Widget w);
+
+  friend class G4OpenGLXmVWidgetObject;
+  friend class G4OpenGLXmViewerMessenger;
+  
+private:
+  G4OpenGLXmViewer (const G4OpenGLXmViewer&);
+  G4OpenGLXmViewer& operator = (const G4OpenGLXmViewer&);
+};
+
+#endif
+
+#endif
+  
Index: tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmViewerMessenger.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmViewerMessenger.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/include/G4OpenGLXmViewerMessenger.hh	(revision 1102)
@@ -0,0 +1,66 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmViewerMessenger.hh,v 1.5 2009/02/04 16:48:41 lgarnier Exp $
+// GEANT4 tag $Name:  $
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#ifndef G4OPENGLXMVIEWERMESSENGER_HH
+#define G4OPENGLXMVIEWERMESSENGER_HH
+
+#include "G4UImessenger.hh"
+
+#include "G4String.hh"
+
+class G4OpenGLXmViewer;
+class G4UIdirectory;
+class G4UIcmdWithADoubleAndUnit;
+class G4UIcmdWithADouble;
+
+class G4OpenGLXmViewerMessenger: public G4UImessenger {
+public:
+  static G4OpenGLXmViewerMessenger* GetInstance();  // Singleton constructor.
+  ~G4OpenGLXmViewerMessenger();
+  void SetNewValue (G4UIcommand*, G4String);
+
+private:
+  G4OpenGLXmViewerMessenger();  // Private constructor.
+  static G4OpenGLXmViewerMessenger* fpInstance;
+  G4UIdirectory* fpDirectory;
+  G4UIdirectory* fpDirectorySet;
+  G4UIcmdWithADoubleAndUnit* fpCommandSetDollyHigh;
+  G4UIcmdWithADoubleAndUnit* fpCommandSetDollyLow;
+  G4UIcmdWithADoubleAndUnit* fpCommandSetPanHigh;
+  G4UIcmdWithADoubleAndUnit* fpCommandSetRotationHigh;
+  G4UIcmdWithADouble* fpCommandSetZoomHigh;
+  G4UIcmdWithADouble* fpCommandSetZoomLow;
+};
+
+#endif
+
+#endif
+
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLBitMapStore.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLBitMapStore.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLBitMapStore.cc	(revision 1102)
@@ -0,0 +1,106 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLBitMapStore.cc,v 1.4 2007/11/15 10:14:23 allison Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
+//
+// 
+// John Allison  6th January 2007
+
+#ifdef G4VIS_BUILD_OPENGL_DRIVER
+
+#include "G4OpenGLBitMapStore.hh"
+
+namespace G4OpenGLBitMapStore {
+
+std::map<Key, GLubyte*> fStore;
+
+void SetBit(G4int i, G4int j, GLubyte* bitmap, G4int byteColumns)
+{
+  G4int k = i / 8 + byteColumns * j;
+  bitmap[k] |= 0x80 >> i % 8;
+}
+
+const GLubyte* GetBitMap(Shape shape, G4double& size, G4bool filled)
+{
+  // Rationalise size
+  G4int bitSize = G4int(std::abs(size) + 0.49);
+  if (bitSize < 1) bitSize = 1;
+
+  // Modify size in calling function (passed by reference).
+  size = bitSize;
+
+  Key key(shape, bitSize, filled);
+
+  // If previously encountered, return.
+  if (fStore.find(key) != fStore.end()) return fStore[key];
+
+  // Create and store new bitmap.
+  G4int byteColumns = (G4int(bitSize - 1) / 8) + 1;
+  G4int byteRows = bitSize;
+  G4int nBytes = byteColumns*byteRows;
+  GLubyte* bitmap = new GLubyte[nBytes];
+  fStore[key] = bitmap;
+
+  if (shape == square && filled) {  // Set all bits and return.
+    for (G4int i = 0; i < nBytes; ++i) bitmap[i] = 0xff;
+    return bitmap;
+  } else {  // Clear ready for setting bits.
+    for (G4int i = 0; i < nBytes; ++i) bitmap[i] = 0x00;
+  }
+
+  // Fill bitmap.
+  GLint linewidth;
+  glGetIntegerv(GL_LINE_WIDTH, &linewidth);
+  if (linewidth > bitSize) linewidth = bitSize;
+  G4double outer = bitSize / 2.;
+  G4double outer2 = outer * outer;
+  G4double inner = bitSize / 2. - linewidth;
+  G4double inner2 = inner * inner;
+  for (G4int i = 0; i < bitSize; ++i) {
+    for (G4int j = 0; j < bitSize; ++j) {
+      G4double x = i - (bitSize - 1) * 0.5;
+      G4double y = j - (bitSize - 1) * 0.5;
+      G4double r2 = x * x + y * y;
+      if (shape == circle) {
+	if (filled) {
+	  if (r2 < outer2) SetBit(i, j, bitmap, byteColumns);
+	} else {
+	  if (r2 < outer2 && r2 > inner2) SetBit(i, j, bitmap, byteColumns);
+	}
+      } else {  // Unfilled square.
+	if (x < -inner || x > inner || y < -inner || y > inner)
+	  SetBit(i, j, bitmap, byteColumns);
+      }
+    }
+  }
+
+  return bitmap;
+}
+
+} // End namespace G4OpenGLBitMapStore.
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLFontBaseStore.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLFontBaseStore.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLFontBaseStore.cc	(revision 1102)
@@ -0,0 +1,59 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLFontBaseStore.cc,v 1.3 2006/06/29 21:18:56 gunter Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
+//
+
+#include "G4OpenGLFontBaseStore.hh"
+
+std::map<G4VViewer*,std::vector<G4OpenGLFontBaseStore::FontInfo> >
+G4OpenGLFontBaseStore::fFontBaseMap;
+
+void G4OpenGLFontBaseStore::AddFontBase
+(G4VViewer* viewer,G4int fontBase,
+ G4double size, const G4String& fontName) {
+  fFontBaseMap[viewer].push_back(FontInfo(fontName, size, fontBase));
+}
+
+G4int G4OpenGLFontBaseStore::GetFontBase(G4VViewer* viewer, G4double size) {
+  G4int fontBase = -1;
+  std::map<G4VViewer*,std::vector<FontInfo> >::const_iterator i;
+  i = fFontBaseMap.find(viewer);
+  if (i != fFontBaseMap.end()) {
+    G4double sizeDiscrepancy = 9999.;
+    std::vector<FontInfo>::const_iterator j, k;
+    for (j = i->second.begin(); j != i->second.end(); ++j) {
+      G4double d = std::abs(size - j->fSize);
+      if (d < sizeDiscrepancy) {
+	sizeDiscrepancy = d;
+	k = j;
+      }
+    }
+    fontBase = k->fFontBase;
+  }
+  return fontBase;
+}
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLImmediateQt.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLImmediateQt.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLImmediateQt.cc	(revision 1102)
@@ -0,0 +1,87 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLImmediateQt.cc,v 1.6 2009/02/04 16:48:41 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// OpenGLImmediateQt graphics system factory.
+
+#ifdef G4VIS_BUILD_OPENGLQT_DRIVER
+
+#include "G4VisFeaturesOfOpenGL.hh"
+#include "G4VSceneHandler.hh"
+#include "G4OpenGLSceneHandler.hh"
+#include "G4OpenGLViewer.hh"
+#include "G4OpenGLImmediateQt.hh"
+#include "G4OpenGLImmediateQtViewer.hh"
+#include "G4OpenGLViewerMessenger.hh"
+#include "G4OpenGLImmediateSceneHandler.hh"
+
+G4OpenGLImmediateQt::G4OpenGLImmediateQt ():
+  G4VGraphicsSystem ("OpenGLImmediateQt",
+		     "OGLIQt",
+		     G4VisFeaturesOfOpenGLIQt (),
+		     G4VGraphicsSystem::threeD)
+{
+  G4OpenGLViewerMessenger::GetInstance();
+}
+
+G4VSceneHandler* G4OpenGLImmediateQt::CreateSceneHandler
+(const G4String& name) {
+  G4VSceneHandler* pScene = new G4OpenGLImmediateSceneHandler (*this, name);
+  return    pScene;
+}
+
+G4VViewer* G4OpenGLImmediateQt::CreateViewer
+(G4VSceneHandler& scene, const G4String& name) {
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLImmediateQt::CreateViewer \n");
+#endif
+  G4VViewer* pView =
+    new G4OpenGLImmediateQtViewer
+    ((G4OpenGLImmediateSceneHandler&) scene, name);
+  if (pView) {
+    if (pView -> GetViewId () < 0) {
+      G4cerr << "G4OpenGLImmediateQt::CreateViewer: error flagged by negative"
+	" view id in G4OpenGLImmediateQtViewer creation."
+	"\n Destroying view and returning null pointer."
+	   << G4endl;
+      delete pView;
+      pView = 0;
+    }
+  }
+  else {
+    G4cerr << "G4OpenGLImmediateQt::CreateViewer: null pointer on"
+      " new G4OpenGLImmediateQtViewer." << G4endl;
+  }
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLImmediateQt::CreateViewer END \n");
+#endif
+   return pView;
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLImmediateQtViewer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLImmediateQtViewer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLImmediateQtViewer.cc	(revision 1102)
@@ -0,0 +1,271 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLImmediateQtViewer.cc,v 1.14 2009/05/13 10:28:00 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+//
+// Class G4OpenGLImmediateQtViewer : a class derived from G4OpenGLQtViewer and
+//                                G4OpenGLImmediateViewer.
+
+#ifdef G4VIS_BUILD_OPENGLQT_DRIVER
+
+#include "G4OpenGLImmediateQtViewer.hh"
+#include "G4OpenGLImmediateSceneHandler.hh"
+
+#include "G4ios.hh"
+
+G4OpenGLImmediateQtViewer::G4OpenGLImmediateQtViewer
+(G4OpenGLImmediateSceneHandler& sceneHandler,
+ const G4String&  name):
+  G4VViewer (sceneHandler, sceneHandler.IncrementViewCount (), name),
+  G4OpenGLViewer (sceneHandler),
+  G4OpenGLQtViewer (sceneHandler),
+  G4OpenGLImmediateViewer (sceneHandler)
+{
+
+  //set true to picking
+  fVP.SetPicking(true);
+  fDefaultVP.SetPicking(true);
+#if QT_VERSION < 0x040000
+  setFocusPolicy(QWidget::StrongFocus); // enable keybord events
+#else
+  setFocusPolicy(Qt::StrongFocus); // enable keybord events
+#endif
+  fHasToRepaint =false;
+
+  if (fViewId < 0) return;  // In case error in base class instantiation.
+}
+
+G4OpenGLImmediateQtViewer::~G4OpenGLImmediateQtViewer() {
+  makeCurrent();
+}
+
+void G4OpenGLImmediateQtViewer::Initialise() {
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLImmediateQtViewer::Initialise \n");
+#endif
+  fReadyToPaint = false;
+  CreateMainWindow (this,QString(fName));
+  CreateFontLists ();
+
+  fReadyToPaint = true;
+}
+
+void G4OpenGLImmediateQtViewer::initializeGL () {
+
+  InitializeGLView ();
+
+
+  // If a double buffer context has been forced upon us, ignore the
+  // back buffer for this OpenGLImmediate view.
+  //   glDrawBuffer (GL_FRONT); // FIXME : Ne marche pas avec cette ligne, mais affiche le run correctement...
+  // clear the buffers and window.
+  ClearView ();
+  FinishView ();
+
+  glDepthFunc (GL_LEQUAL);
+  glDepthMask (GL_TRUE);
+
+  if (fSceneHandler.GetScene() == 0) {
+    fHasToRepaint =false;
+  } else {
+    fHasToRepaint =true;
+  }
+
+}
+
+
+/** To ensure compatibility with DrawView method
+ */
+void  G4OpenGLImmediateQtViewer::DrawView() {
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLImmediateQtViewer::DrawView  VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV\n");
+#endif
+  // That's no the same logic as Stored Viewer, I don't know why...
+  // see G4OpenGLStoredQtViewer::DrawView for more informations
+
+  updateQWidget();
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLImmediateQtViewer::DrawView  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");
+#endif
+}
+
+
+void G4OpenGLImmediateQtViewer::ComputeView () {
+
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLImmediateQtViewer::ComputeView %d %d   VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV\n",getWinWidth(), getWinHeight());
+#endif
+  makeCurrent();
+  // If a double buffer context has been forced upon us, ignore the
+  // back buffer for this OpenGLImmediate view.
+  //  glDrawBuffer (GL_FRONT);
+
+  G4ViewParameters::DrawingStyle style = GetViewParameters().GetDrawingStyle();
+
+  if(style!=G4ViewParameters::hlr &&
+     haloing_enabled) {
+
+    HaloingFirstPass ();
+    NeedKernelVisit ();
+    ProcessView ();
+    glFlush ();
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLImmediateQtViewer::ComputeView First ProcessView ok\n");
+#endif
+    HaloingSecondPass ();
+
+  }
+
+  NeedKernelVisit ();  // Always need to visit G4 kernel.
+  ProcessView ();
+
+  if (isRecording()) {
+    savePPMToTemp();
+  }
+   
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLImmediateQtViewer::ComputeView %d %d ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n",getWinWidth(), getWinHeight());
+#endif
+  fHasToRepaint = true;
+}
+
+void G4OpenGLImmediateQtViewer::FinishView()
+{
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLImmediateQtViewer::FinishView() BEGIN\n");
+#endif
+  glFlush ();
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLImmediateQtViewer::FinishView() END\n");
+#endif
+
+}
+
+
+/**
+   - Lors du resize de la fenetre, on doit non pas redessiner le detecteur, mais aussi les evenements
+*/
+void G4OpenGLImmediateQtViewer::resizeGL(
+ int aWidth
+,int aHeight)
+{  
+  ResizeWindow(aWidth,aHeight);
+  fHasToRepaint = sizeHasChanged();
+}
+
+
+void G4OpenGLImmediateQtViewer::paintGL()
+{
+#ifdef G4DEBUG_VIS_OGL
+  printf("\n\nG4OpenGLImmediateQtViewer::paintGL ??\n");
+#endif
+  if (!fReadyToPaint) {
+    fReadyToPaint= true;
+    return;
+  }
+  // DO NOT RESIZE IF SIZE HAS NOT CHANGE
+  if ( !fHasToRepaint) {
+    if (((getWinWidth() == (unsigned int)width())) &&(getWinHeight() == (unsigned int) height())) {
+      return;
+    }
+  }
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLImmediateQtViewer::paintGL VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV ready %d\n",fReadyToPaint);
+#endif
+
+  SetView();
+   
+  ClearView (); //ok, put the background correct
+  ComputeView();
+
+  fHasToRepaint = false; // could be set to false by ComputeView
+
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLImmediateQtViewer::paintGL ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ready %d\n\n\n",fReadyToPaint);
+#endif
+}
+
+void G4OpenGLImmediateQtViewer::mousePressEvent(QMouseEvent *event)
+{
+  G4MousePressEvent(event);
+}
+
+void G4OpenGLImmediateQtViewer::keyPressEvent (QKeyEvent * event) 
+{
+  G4keyPressEvent(event);
+}
+
+void G4OpenGLImmediateQtViewer::wheelEvent (QWheelEvent * event) 
+{
+  G4wheelEvent(event);
+}
+
+/**
+ * This function was build in order to make a zoom on double clic event.
+ * It was think to build a rubberband on the zoom area, but never work fine
+ */
+void G4OpenGLImmediateQtViewer::mouseDoubleClickEvent(QMouseEvent *)
+{
+  G4MouseDoubleClickEvent();
+}
+
+void G4OpenGLImmediateQtViewer::mouseReleaseEvent(QMouseEvent *)
+{
+  G4MouseReleaseEvent();
+}
+
+void G4OpenGLImmediateQtViewer::mouseMoveEvent(QMouseEvent *event)
+{
+  G4MouseMoveEvent(event);
+}
+
+
+void G4OpenGLImmediateQtViewer::contextMenuEvent(QContextMenuEvent *e)
+{
+  G4manageContextMenuEvent(e);
+}
+
+void G4OpenGLImmediateQtViewer::updateQWidget() {
+  fHasToRepaint= true;
+  updateGL();
+  fHasToRepaint= false;
+}
+
+
+void G4OpenGLImmediateQtViewer::ShowView (
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+#if QT_VERSION < 0x040000
+  setActiveWindow();
+#else
+  activateWindow();
+#endif
+}
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLImmediateSceneHandler.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLImmediateSceneHandler.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLImmediateSceneHandler.cc	(revision 1102)
@@ -0,0 +1,261 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLImmediateSceneHandler.cc,v 1.31 2009/02/04 16:48:41 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Andrew Walkden  10th February 1997
+// OpenGL immediate scene - draws immediately to buffer
+//                           (saving space on server).
+
+#ifdef G4VIS_BUILD_OPENGL_DRIVER
+
+// Included here - problems with HP compiler if not before other includes?
+#include "G4NURBS.hh"
+
+// Here follows a special for Mesa, the OpenGL emulator.  Does not affect
+// other OpenGL's, as far as I'm aware.   John Allison 18/9/96.
+#define CENTERLINE_CLPP  /* CenterLine C++ workaround: */
+// Also seems to be required for HP's CC and AIX xlC, at least.
+
+#include "G4OpenGLImmediateSceneHandler.hh"
+
+#include "G4OpenGLViewer.hh"
+#include "G4OpenGLTransform3D.hh"
+#include "G4Polyline.hh"
+#include "G4Polymarker.hh"
+#include "G4Text.hh"
+#include "G4Circle.hh"
+#include "G4Square.hh"
+#include "G4Scale.hh"
+#include "G4Polyhedron.hh"
+
+G4OpenGLImmediateSceneHandler::G4OpenGLImmediateSceneHandler
+(G4VGraphicsSystem& system,const G4String& name):
+  G4OpenGLSceneHandler (system, fSceneIdCount++, name)
+{
+#ifdef G4DEBUG_VIS_OGL
+  printf("INIT G4OpenGLImmediateSceneHandler (after G4OpenGLSceneHandler (system, fSceneIdCount++, name)\n");
+#endif
+}
+
+G4OpenGLImmediateSceneHandler::~G4OpenGLImmediateSceneHandler ()
+{}
+
+#include <iomanip>
+
+void G4OpenGLImmediateSceneHandler::AddPrimitivePreamble(const G4Visible& visible)
+{
+  if (fpViewer->GetViewParameters().IsPicking()) {
+    glLoadName(++fPickName);
+    fPickMap[fPickName] = 0;
+  }
+
+  const G4Colour& c = GetColour (visible);
+  glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
+}
+
+void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4Polyline& polyline)
+{
+  AddPrimitivePreamble(polyline);
+  G4OpenGLSceneHandler::AddPrimitive(polyline);
+}
+
+void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4Polymarker& polymarker)
+{
+  AddPrimitivePreamble(polymarker);
+  G4OpenGLSceneHandler::AddPrimitive(polymarker);
+}
+
+void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4Text& text)
+{
+  // Note: colour is still handled in
+  // G4OpenGLSceneHandler::AddPrimitive(const G4Text&).
+  AddPrimitivePreamble(text);
+  G4OpenGLSceneHandler::AddPrimitive(text);
+}
+
+void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4Circle& circle)
+{
+  AddPrimitivePreamble(circle);
+  G4OpenGLSceneHandler::AddPrimitive(circle);
+}
+
+void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4Square& square)
+{
+  AddPrimitivePreamble(square);
+  G4OpenGLSceneHandler::AddPrimitive(square);
+}
+
+void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4Scale& scale)
+{
+  AddPrimitivePreamble(scale);
+  G4OpenGLSceneHandler::AddPrimitive(scale);
+}
+
+void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron)
+{
+  // Note: colour is still handled in
+  // G4OpenGLSceneHandler::AddPrimitive(const G4Polyhedron&).
+  AddPrimitivePreamble(polyhedron);
+  G4OpenGLSceneHandler::AddPrimitive(polyhedron);
+}
+
+void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4NURBS& nurbs)
+{
+  // Note: colour is still handled in
+  // G4OpenGLSceneHandler::AddPrimitive(const G4NURBS&).
+  AddPrimitivePreamble(nurbs);
+  G4OpenGLSceneHandler::AddPrimitive(nurbs);
+}
+
+void G4OpenGLImmediateSceneHandler::BeginPrimitives
+(const G4Transform3D& objectTransformation)
+{
+  G4OpenGLSceneHandler::BeginPrimitives (objectTransformation);
+
+  G4OpenGLTransform3D oglt (objectTransformation);
+
+  glPushMatrix();
+
+  /*************************** Check matrix.
+  const GLdouble* m = oglt.GetGLMatrix ();
+  G4cout << "G4OpenGLTransform3D matrix:";
+  for (int i = 0; i < 16; i++) {
+    if ((i % 4) == 0) G4cout << '\n';
+    G4cout << std::setw (15) << m[i];
+  }
+  G4cout << G4endl;
+  *****************************************/
+
+  glMultMatrixd (oglt.GetGLMatrix ());
+}
+
+void G4OpenGLImmediateSceneHandler::EndPrimitives ()
+{
+  glPopMatrix();
+
+  // See all primitives immediately...
+  glFlush ();
+
+  G4OpenGLSceneHandler::EndPrimitives ();
+}
+
+void G4OpenGLImmediateSceneHandler::BeginPrimitives2D
+(const G4Transform3D& objectTransformation)
+{
+  G4OpenGLSceneHandler::BeginPrimitives2D(objectTransformation);
+
+  // Push current 3D world matrices and load identity to define screen
+  // coordinates...
+  glMatrixMode (GL_PROJECTION);
+  glPushMatrix();
+  glLoadIdentity();
+  glOrtho (-1., 1., -1., 1., -G4OPENGL_FLT_BIG, G4OPENGL_FLT_BIG);
+  glMatrixMode (GL_MODELVIEW);
+  glPushMatrix();
+  glLoadIdentity();
+  G4OpenGLTransform3D oglt (objectTransformation);
+  glMultMatrixd (oglt.GetGLMatrix ());
+}
+
+void G4OpenGLImmediateSceneHandler::EndPrimitives2D()
+{
+  // Pop current 3D world matrices back again...
+  glMatrixMode (GL_PROJECTION);
+  glPopMatrix();
+  glMatrixMode (GL_MODELVIEW);
+  glPopMatrix();
+
+  // See all primitives immediately...
+  glFlush ();
+
+  G4OpenGLSceneHandler::EndPrimitives2D ();
+}
+
+void G4OpenGLImmediateSceneHandler::BeginModeling () {
+  G4VSceneHandler::BeginModeling();
+}
+
+void G4OpenGLImmediateSceneHandler::EndModeling () {
+  G4VSceneHandler::EndModeling ();
+}
+
+void G4OpenGLImmediateSceneHandler::ClearTransientStore () {
+
+  G4VSceneHandler::ClearTransientStore ();
+
+  // Make sure screen corresponds to graphical database...
+  if (fpViewer) {
+    fpViewer -> SetView ();
+    fpViewer -> ClearView ();
+    fpViewer -> DrawView ();
+  }
+}
+
+void G4OpenGLImmediateSceneHandler::RequestPrimitives (const G4VSolid& solid)
+{
+  if (fReadyForTransients) {
+    // Always draw transient solids, e.g., hits represented as solids.
+    // (As we have no control over the order of drawing of transient
+    // objects, we cannot do anything about transparent ones, as
+    // below, so always draw them.)
+    G4VSceneHandler::RequestPrimitives (solid);
+    return;
+  }
+
+  // For non-transient (run-duration) objects, ensure transparent
+  // objects are drawn last.  The problem of
+  // blending/transparency/alpha is quite a tricky one - see History
+  // of opengl-V07-01-01/2/3.
+  // Get vis attributes - pick up defaults if none.
+  const G4VisAttributes* pVA =
+    fpViewer -> GetApplicableVisAttributes(fpVisAttribs);
+  const G4Colour& c = pVA -> GetColour ();
+  G4double opacity = c.GetAlpha ();
+
+  if (!fSecondPass) {
+    G4bool transparency_enabled = true;
+    G4OpenGLViewer* pViewer = dynamic_cast<G4OpenGLViewer*>(fpViewer);
+    if (pViewer) transparency_enabled = pViewer->transparency_enabled;
+    if (transparency_enabled && opacity < 1.) {
+      // On first pass, transparent objects are not drawn, but flag is set...
+      fSecondPassRequested = true;
+      return;
+    }
+  }
+
+  // On second pass, opaque objects are not drwan...
+  if (fSecondPass && opacity >= 1.) return;
+
+  // Else invoke base class method...
+  G4VSceneHandler::RequestPrimitives (solid);
+}
+
+G4int G4OpenGLImmediateSceneHandler::fSceneIdCount = 0;
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLImmediateViewer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLImmediateViewer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLImmediateViewer.cc	(revision 1102)
@@ -0,0 +1,77 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLImmediateViewer.cc,v 1.10 2009/02/04 16:48:41 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Andrew Walkden  7th February 1997
+// Class G4OpenGLImmediateViewer : Encapsulates the `immediateness' of
+//                               an OpenGL view, for inheritance by
+//                               derived (X, Xm...) classes.
+
+#ifdef G4VIS_BUILD_OPENGL_DRIVER
+
+#include "G4OpenGLImmediateViewer.hh"
+#include "G4OpenGLImmediateSceneHandler.hh"
+
+G4OpenGLImmediateViewer::G4OpenGLImmediateViewer (G4OpenGLImmediateSceneHandler& scene):
+G4VViewer (scene, -1),
+G4OpenGLViewer (scene)
+{
+#ifdef G4DEBUG_VIS_OGL
+  printf("INIT G4OpenGLImmediateViewer (after G4VViewer and G4OpenGLVIewer \n");
+#endif
+}
+
+void G4OpenGLImmediateViewer::ProcessView ()
+{
+  printf("G4OpenGLImmediateViewer::ProcessView\n");
+
+  const G4Planes& cutaways = fVP.GetCutawayPlanes();
+  G4bool cutawayUnion = fVP.IsCutaway() &&
+    fVP.GetCutawayMode() == G4ViewParameters::cutawayUnion;
+  size_t nPasses = cutawayUnion? cutaways.size(): 1;
+  for (size_t i = 0; i < nPasses; ++i) {
+
+    if (cutawayUnion) {
+      double a[4];
+      a[0] = cutaways[i].a();
+      a[1] = cutaways[i].b();
+      a[2] = cutaways[i].c();
+      a[3] = cutaways[i].d();
+      glClipPlane (GL_CLIP_PLANE2, a);
+      glEnable (GL_CLIP_PLANE2);
+    }
+
+    NeedKernelVisit ();  // Always need to visit G4 kernel.
+    G4VViewer::ProcessView ();
+
+    if (cutawayUnion) glDisable (GL_CLIP_PLANE2);
+  }
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLImmediateWin32.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLImmediateWin32.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLImmediateWin32.cc	(revision 1102)
@@ -0,0 +1,81 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLImmediateWin32.cc,v 1.13 2009/05/20 09:58:10 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// OpenGLImmediateWin32 graphics system factory.
+
+#ifdef G4VIS_BUILD_OPENGLWIN32_DRIVER
+
+#include "G4VisFeaturesOfOpenGL.hh"
+#include "G4VSceneHandler.hh"
+#include "G4OpenGLSceneHandler.hh"
+#include "G4OpenGLViewer.hh"
+#include "G4OpenGLImmediateWin32.hh"
+#include "G4OpenGLImmediateWin32Viewer.hh"
+#include "G4OpenGLViewerMessenger.hh"
+#include "G4OpenGLImmediateSceneHandler.hh"
+
+G4OpenGLImmediateWin32::G4OpenGLImmediateWin32 ():
+  G4VGraphicsSystem ("OpenGLImmediateWin32",
+		     "OGLIWin32",
+		     G4VisFeaturesOfOpenGLIWin32 (),
+		     G4VGraphicsSystem::threeD)
+{
+  G4OpenGLViewerMessenger::GetInstance();
+}
+
+G4VSceneHandler* G4OpenGLImmediateWin32::CreateSceneHandler
+(const G4String& name) {
+  G4VSceneHandler* pScene = new G4OpenGLImmediateSceneHandler (*this, name);
+  return    pScene;
+}
+
+G4VViewer* G4OpenGLImmediateWin32::CreateViewer
+(G4VSceneHandler& scene, const G4String& name) {
+  G4VViewer* pView =
+    new G4OpenGLImmediateWin32Viewer
+    ((G4OpenGLImmediateSceneHandler&) scene, name);
+  if (pView) {
+    if (pView -> GetViewId () < 0) {
+      G4cerr << "G4OpenGLImmediateWin32::CreateViewer: error flagged by negative"
+	" view id in G4OpenGLImmediateWin32Viewer creation."
+	"\n Destroying view and returning null pointer."
+	   << G4endl;
+      delete pView;
+      pView = 0;
+    }
+  }
+  else {
+    G4cerr << "G4OpenGLImmediateWin32::CreateViewer: null pointer on"
+      " new G4OpenGLImmediateWin32Viewer." << G4endl;
+  }
+  return pView;
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLImmediateWin32Viewer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLImmediateWin32Viewer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLImmediateWin32Viewer.cc	(revision 1102)
@@ -0,0 +1,121 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLImmediateWin32Viewer.cc,v 1.19 2009/05/20 10:19:51 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Class G4OpenGLImmediateWin32Viewer : a class derived from G4OpenGLWin32Viewer and
+//                                G4OpenGLImmediateViewer.
+
+#ifdef G4VIS_BUILD_OPENGLWIN32_DRIVER
+
+#include "G4OpenGLImmediateWin32Viewer.hh"
+#include "G4OpenGLImmediateSceneHandler.hh"
+
+#include "G4ios.hh"
+
+G4OpenGLImmediateWin32Viewer::G4OpenGLImmediateWin32Viewer
+(G4OpenGLImmediateSceneHandler& sceneHandler,
+ const G4String&  name):
+G4OpenGLViewer (sceneHandler),
+G4OpenGLWin32Viewer (sceneHandler),
+G4OpenGLImmediateViewer (sceneHandler),
+G4VViewer (sceneHandler, sceneHandler.IncrementViewCount (), name) {
+
+  if (fViewId < 0) return;  // In case error in base class instantiation.
+}
+
+void G4OpenGLImmediateWin32Viewer::Initialise () {
+
+// ensure a suitable window was found
+
+  CreateGLWin32Context ();
+  CreateMainWindow ();
+  CreateFontLists ();
+
+  // If a double buffer context has been forced upon us, ignore the
+  // back buffer for this OpenGLImmediate view.
+  glDrawBuffer (GL_FRONT);
+
+  // clear the buffers and window.
+  ClearView ();
+  FinishView ();
+
+  glDepthFunc (GL_LEQUAL);
+  glDepthMask (GL_TRUE);
+}
+
+void G4OpenGLImmediateWin32Viewer::DrawView () {
+
+  // If a double buffer context has been forced upon us, ignore the
+  // back buffer for this OpenGLImmediate view.
+  glDrawBuffer (GL_FRONT);
+
+  G4ViewParameters::DrawingStyle style = GetViewParameters().GetDrawingStyle();
+
+  //Make sure current viewer is attached and clean...
+  //Win32 version needed
+  //glXMakeCurrent (dpy, win, cx);
+  glViewport (0, 0, getWinWidth(), getWinHeight());
+
+  if(style!=G4ViewParameters::hlr &&
+     haloing_enabled) {
+
+    HaloingFirstPass ();
+    NeedKernelVisit ();
+    ProcessView ();
+    glFlush ();
+
+    HaloingSecondPass ();
+
+  }
+
+  NeedKernelVisit ();  // Always need to visit G4 kernel.
+  ProcessView ();
+  FinishView ();
+
+}
+
+//////////////////////////////////////////////////////////////////////////////
+void G4OpenGLImmediateWin32Viewer::FinishView (
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  if(!fHDC) return;
+
+  glFlush ();
+
+  // Empty the Windows message queue :
+  MSG event;
+  while ( ::PeekMessage(&event, NULL, 0, 0, PM_REMOVE) ) {
+    ::TranslateMessage(&event);
+    ::DispatchMessage (&event);
+  }
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLImmediateX.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLImmediateX.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLImmediateX.cc	(revision 1102)
@@ -0,0 +1,81 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLImmediateX.cc,v 1.15 2009/02/04 16:48:41 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Andrew Walkden  27th March 1996
+// OpenGL graphics system factory.
+
+#ifdef G4VIS_BUILD_OPENGLX_DRIVER
+
+#include "G4VisFeaturesOfOpenGL.hh"
+#include "G4VSceneHandler.hh"
+#include "G4OpenGLSceneHandler.hh"
+#include "G4OpenGLViewer.hh"
+#include "G4OpenGLImmediateX.hh"
+#include "G4OpenGLImmediateXViewer.hh"
+#include "G4OpenGLViewerMessenger.hh"
+#include "G4OpenGLImmediateSceneHandler.hh"
+G4OpenGLImmediateX::G4OpenGLImmediateX ():
+  G4VGraphicsSystem ("OpenGLImmediateX",
+		     "OGLIX",
+		     G4VisFeaturesOfOpenGLIX (),
+		     G4VGraphicsSystem::threeD)
+{
+  G4OpenGLViewerMessenger::GetInstance();
+}
+
+G4OpenGLImmediateX::~G4OpenGLImmediateX () {}
+
+G4VSceneHandler* G4OpenGLImmediateX::CreateSceneHandler (const G4String& name) {
+  G4VSceneHandler* pScene = new G4OpenGLImmediateSceneHandler (*this, name);
+  return    pScene;
+}
+
+G4VViewer* G4OpenGLImmediateX::CreateViewer (G4VSceneHandler& scene,
+					 const G4String& name) {
+  G4VViewer* pView =
+    new G4OpenGLImmediateXViewer ((G4OpenGLImmediateSceneHandler&) scene, name);
+  if (pView) {
+    if (pView -> GetViewId () < 0) {
+      G4cerr << "G4OpenGLImmediateX::CreateViewer: error flagged by negative"
+	" view id in G4OpenGLImmediateXViewer creation."
+	"\n Destroying view and returning null pointer."
+	   << G4endl;
+      delete pView;
+      pView = 0;
+    }
+  }
+  else {
+    G4cerr << "G4OpenGLImmediateX::CreateViewer: null pointer on"
+      " new G4OpenGLImmediateXViewer." << G4endl;
+  }
+  return pView;
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLImmediateXViewer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLImmediateXViewer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLImmediateXViewer.cc	(revision 1102)
@@ -0,0 +1,114 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLImmediateXViewer.cc,v 1.19 2009/02/04 16:48:41 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Andrew Walkden  7th February 1997
+// Class G4OpenGLImmediateXViewer : a class derived from G4OpenGLXViewer and
+//                                G4OpenGLImmediateViewer.
+
+#ifdef G4VIS_BUILD_OPENGLX_DRIVER
+
+#include "G4OpenGLImmediateXViewer.hh"
+#include "G4OpenGLImmediateSceneHandler.hh"
+
+#include "G4ios.hh"
+
+G4OpenGLImmediateXViewer::
+G4OpenGLImmediateXViewer (G4OpenGLImmediateSceneHandler& sceneHandler,
+			  const G4String&  name)
+ : G4VViewer (sceneHandler, sceneHandler.IncrementViewCount (), name),
+   G4OpenGLViewer (sceneHandler),
+   G4OpenGLXViewer (sceneHandler),
+   G4OpenGLImmediateViewer (sceneHandler)
+{
+  if (fViewId < 0) return;  // In case error in base class instantiation.
+
+// ensure a suitable window was found
+  if (!vi_immediate) {
+    G4cerr << "G4OpenGLImmediateXViewer::G4OpenGLImmediateXViewer -"
+      " G4OpenGLXViewer couldn't get a visual." << G4endl;  
+    fViewId = -1;  // This flags an error.
+    return;
+  }
+}
+
+G4OpenGLImmediateXViewer::~G4OpenGLImmediateXViewer () {}
+
+void G4OpenGLImmediateXViewer::Initialise () {
+
+  CreateGLXContext (vi_immediate);
+  CreateMainWindow ();
+  CreateFontLists ();
+
+  InitializeGLView ();
+
+  // clear the buffers and window.
+  ClearView ();
+  FinishView ();
+
+  // If a double buffer context has been forced upon us, ignore the
+  // back buffer for this OpenGLImmediate view.
+  glDrawBuffer (GL_FRONT);
+
+  glDepthFunc (GL_LEQUAL);
+  glDepthMask (GL_TRUE);
+}
+
+void G4OpenGLImmediateXViewer::DrawView () {
+
+  G4ViewParameters::DrawingStyle style = GetViewParameters().GetDrawingStyle();
+
+  //Make sure current viewer is attached and clean...
+  glXMakeCurrent (dpy, win, cx);
+
+  if(style!=G4ViewParameters::hlr &&
+     haloing_enabled) {
+
+    HaloingFirstPass ();
+    NeedKernelVisit ();
+    ProcessView ();
+    glFlush ();
+
+    HaloingSecondPass ();
+
+  }
+
+  NeedKernelVisit ();  // Always need to visit G4 kernel.
+  ProcessView ();
+  FinishView ();
+
+}
+
+void G4OpenGLImmediateXViewer::FinishView () {
+  glXWaitGL (); //Wait for effects of all previous OpenGL commands to
+                //be propogated before progressing.
+  glFlush ();
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLImmediateXm.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLImmediateXm.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLImmediateXm.cc	(revision 1102)
@@ -0,0 +1,86 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLImmediateXm.cc,v 1.15 2009/02/04 16:48:41 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Andrew Walkden  10th February 1997
+// OpenGL graphics system factory.
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4VisFeaturesOfOpenGL.hh"
+#include "G4VSceneHandler.hh"
+#include "G4OpenGLSceneHandler.hh"
+#include "G4OpenGLViewer.hh"
+#include "G4OpenGLImmediateXm.hh"
+#include "G4OpenGLImmediateXmViewer.hh"
+#include "G4OpenGLViewerMessenger.hh"
+#include "G4OpenGLXmViewerMessenger.hh"
+#include "G4OpenGLImmediateSceneHandler.hh"
+
+G4OpenGLImmediateXm::G4OpenGLImmediateXm ():
+  G4VGraphicsSystem ("OpenGLImmediateXm",
+		     "OGLIXm",
+		     G4VisFeaturesOfOpenGLIXm (),
+		     G4VGraphicsSystem::threeD)
+{
+#ifdef G4DEBUG_VIS_OGL
+  printf("INIT G4OpenGLImmediateXm (after   G4VGraphicsSystem (,,)\n");
+#endif
+  G4OpenGLViewerMessenger::GetInstance();
+  G4OpenGLXmViewerMessenger::GetInstance();
+}
+
+G4OpenGLImmediateXm::~G4OpenGLImmediateXm () {}
+
+G4VSceneHandler* G4OpenGLImmediateXm::CreateSceneHandler (const G4String& name) {
+  G4VSceneHandler* pScene = new G4OpenGLImmediateSceneHandler (*this, name);
+  return    pScene;
+}
+
+G4VViewer* G4OpenGLImmediateXm::CreateViewer (G4VSceneHandler& scene,
+					  const G4String& name) {
+  G4VViewer* pView =
+    new G4OpenGLImmediateXmViewer ((G4OpenGLImmediateSceneHandler&) scene, name);
+  if (pView) {
+    if (pView -> GetViewId () < 0) {
+      G4cerr << "G4OpenGLImmediateXm::CreateViewer: error flagged by"
+	" negative view id in G4OpenGLImmediateXmViewer creation."
+	"\n Destroying view and returning null pointer." << G4endl;
+      delete pView;
+      pView = 0;
+    }
+  }
+  else {
+    G4cerr << "G4OpenGLImmediateXm::CreateViewer: null pointer on"
+      " new G4OpenGLImmediateXmViewer." << G4endl;
+  }
+  return pView;
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLImmediateXmViewer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLImmediateXmViewer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLImmediateXmViewer.cc	(revision 1102)
@@ -0,0 +1,133 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLImmediateXmViewer.cc,v 1.21 2009/04/08 16:55:44 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Andrew Walkden  10th February 1997
+// Class G4OpenGLImmediateXmViewer : a class derived from G4OpenGLXmViewer
+//                                     and G4OpenGLImmediateViewer.
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4OpenGLImmediateXmViewer.hh"
+#include "G4OpenGLImmediateSceneHandler.hh"
+
+#include "G4ios.hh"
+
+G4OpenGLImmediateXmViewer::
+G4OpenGLImmediateXmViewer(G4OpenGLImmediateSceneHandler& sceneHandler,
+                          const G4String& name)
+ : G4VViewer (sceneHandler, sceneHandler.IncrementViewCount (), name),
+   G4OpenGLViewer (sceneHandler),
+   G4OpenGLXmViewer (sceneHandler),
+   G4OpenGLImmediateViewer (sceneHandler)
+{
+  if (fViewId < 0) return;  // In case error in base class instantiation.
+
+// ensure a suitable window was found
+  if (!vi_immediate) {
+    G4cerr << "G4OpenGLImmediateXmViewer::G4OpenGLImmediateXmViewer -"
+      " G4OpenGLXmViewer couldn't get a visual." << G4endl;  
+    fViewId = -1;  // This flags an error.
+    return;
+  }
+}
+
+G4OpenGLImmediateXmViewer::~G4OpenGLImmediateXmViewer () {}
+
+void G4OpenGLImmediateXmViewer::Initialise () {
+
+  CreateGLXContext (vi_immediate);
+  CreateMainWindow ();
+  CreateFontLists ();
+
+  InitializeGLView ();
+
+  // clear the buffers and window.
+  ClearView ();
+  FinishView ();
+
+  glDepthFunc (GL_LEQUAL);
+  glDepthMask (GL_TRUE);
+  
+  glColorMask (GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
+  glLineWidth (1.0);
+
+  glEnable (GL_BLEND);
+  glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+  // If a double buffer context has been forced upon us, ignore the
+  // back buffer for this OpenGLImmediate view.
+  glDrawBuffer (GL_FRONT);
+}
+
+void G4OpenGLImmediateXmViewer::DrawView () {
+
+  G4ViewParameters::DrawingStyle style = GetViewParameters().GetDrawingStyle();
+
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLImmediateXmViewer::DrawView : \n");
+#endif
+
+  //Make sure current viewer is attached and clean...
+  glXMakeCurrent (dpy, win, cx);
+
+  if(style!=G4ViewParameters::hlr &&
+     haloing_enabled) {
+
+    HaloingFirstPass ();
+    NeedKernelVisit ();
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLImmediateXmViewer::DrawView : change param\n");
+#endif
+    ProcessView ();
+    glFlush ();
+
+    HaloingSecondPass ();
+
+  }
+
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLImmediateXmViewer::DrawView : need Kernel/Process/Finish\n");
+#endif
+  NeedKernelVisit ();  // Always need to visit G4 kernel.
+  ProcessView ();
+  FinishView ();
+
+}
+
+void G4OpenGLImmediateXmViewer::FinishView () {
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLImmediateXmViewer::FinishView : \n");
+#endif
+  glXWaitGL (); //Wait for effects of all previous OpenGL commands to
+                //be propogated before progressing.
+  glFlush ();
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLQtExportDialog.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLQtExportDialog.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLQtExportDialog.cc	(revision 1102)
@@ -0,0 +1,491 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLQtExportDialog.cc,v 1.9 2008/10/24 14:17:10 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+
+#ifdef G4VIS_BUILD_OPENGLQT_DRIVER
+
+#include "G4OpenGLQtExportDialog.hh"
+
+#include <qvariant.h>
+#include <qpushbutton.h>
+#include <qcheckbox.h>
+#include <qlabel.h>
+#include <qcombobox.h>
+#include <qslider.h>
+#include <qlayout.h>
+#include <qgroupbox.h>
+#include <qradiobutton.h>
+#include <qimage.h>
+#include <qlineedit.h>
+#include <qbuttongroup.h>
+
+G4OpenGLQtExportDialog::G4OpenGLQtExportDialog(
+ QWidget* parent
+,QString format
+ ,int aHeight
+ ,int aWidth
+)
+  : QDialog( parent ),
+    isChangingSize(false)
+{
+#if QT_VERSION < 0x040000
+  setCaption( tr( " Export options" ));
+#else
+  setWindowTitle( tr( " Export options" ));
+#endif
+  originalWidth = aWidth;
+  originalHeight = aHeight;
+
+  // Initializations
+  qualitySlider = NULL;
+  width = NULL;
+  height = NULL;
+  colorButton = NULL;
+  BWButton = NULL;
+
+  // global layout
+  QVBoxLayout* globalVLayout = new QVBoxLayout(this);
+  globalVLayout->setMargin(10);
+  globalVLayout->setSpacing(10);
+  
+
+
+  // FIXME : L. Garnier 4/12/07
+  // Not implented. Should deal with alpha channel
+
+//   if((format == "tif") ||
+//      (format == "tiff") ||
+//      (format == "jpg") ||
+//      (format == "jpeg") ||
+//      (format == "png") ||
+//      (format == "xpm")) {
+
+//     QGroupBox *transparencyGroupBox = new QGroupBox(tr("Transparency"),this);
+//     QVBoxLayout *transparencyGroupBoxLayout = new QVBoxLayout(transparencyGroupBox);
+
+//     boxTransparency = new QCheckBox("Save transparency",transparencyGroupBox);
+//     boxTransparency->setChecked( false );
+
+//     transparencyGroupBoxLayout->addWidget(boxTransparency);    
+// #if QT_VERSION >= 0x040000
+//     transparencyGroupBox->setLayout(transparencyGroupBoxLayout);
+// #endif
+//     globalVLayout->addWidget(transparencyGroupBox);
+
+//   }
+
+  // FIXME : L. Garnier 4/12/07
+  // This is not working for PS and PDF images, it does nothing.
+  // Image is staying in color mode
+  //  if ((format == "ps") || (format == "pdf") || (format == "eps")) {
+
+
+  // size box
+
+  QWidget * sizeWidget = new QWidget(this); // widget containing group button
+  QVBoxLayout * sizeWidgetLayout = new QVBoxLayout(sizeWidget);
+  sizeWidgetLayout->setMargin (10); 
+
+  // original and modify radiobuttons
+#if QT_VERSION < 0x040000
+  QButtonGroup * sizeButtonGroupBox = new QButtonGroup ( 2,Qt::Vertical, tr("Size"),this);
+  sizeButtonGroupBox->setInsideMargin (15); 
+
+  original = new QRadioButton("Original",sizeButtonGroupBox);
+  modify = new QRadioButton("Modify",sizeButtonGroupBox);
+
+  sizeButtonGroupBox->insert(original);
+  sizeButtonGroupBox->insert(modify);
+  sizeButtonGroupBox->setExclusive(true);
+  sizeWidgetLayout->add(sizeButtonGroupBox);
+
+  connect( sizeButtonGroupBox, SIGNAL( clicked(int) ), this, SLOT( changeSizeBox()) );
+#else
+  
+  sizeGroupBox = new QGroupBox(tr("Size"));
+  QVBoxLayout *sizeGroupBoxLayout = new QVBoxLayout(sizeGroupBox);
+  QButtonGroup * sizeButtonGroupBox = new QButtonGroup();
+  sizeGroupBoxLayout->setMargin (15); 
+
+  original = new QRadioButton("Original");
+  modify = new QRadioButton("Modify");
+
+  sizeButtonGroupBox->addButton(original);
+  sizeButtonGroupBox->addButton(modify);
+  sizeButtonGroupBox->setExclusive(true);
+
+  sizeGroupBoxLayout->addWidget(original);    
+  sizeGroupBoxLayout->addWidget(modify);    
+
+  sizeGroupBox->setLayout(sizeGroupBoxLayout);
+  sizeWidgetLayout->addWidget(sizeGroupBox);
+  
+  connect( sizeButtonGroupBox, SIGNAL( buttonClicked(QAbstractButton*) ), this, SLOT( changeSizeBox()) );
+#endif
+  original->setChecked( true );
+
+
+  // height
+  heightWidget = new QWidget(sizeWidget);
+
+  QHBoxLayout *heightLineLayout = new QHBoxLayout(heightWidget);
+
+  QString tmp;
+ 
+  heightLineLayout->addWidget(new QLabel("Height",heightWidget));
+  height = new QLineEdit(tmp.setNum(originalHeight),heightWidget);
+  height->setMaxLength(5);
+#if QT_VERSION < 0x040000
+  heightLineLayout->add(height);
+#else
+  heightLineLayout->addWidget(height);
+#endif
+
+#if QT_VERSION >= 0x040000
+  heightWidget->setLayout(heightLineLayout);
+#endif
+
+#if QT_VERSION < 0x040000
+  sizeWidgetLayout->add(heightWidget);
+#else
+  sizeWidgetLayout->addWidget(heightWidget);
+#endif
+  connect( height, SIGNAL( textChanged ( const QString& ) ), this, SLOT( textHeightChanged(const QString &) ) );
+
+
+  // width
+  widthWidget = new QWidget(sizeWidget);
+
+  QHBoxLayout *widthLineLayout = new QHBoxLayout(widthWidget);
+
+#if QT_VERSION < 0x040000
+  widthLineLayout->add(new QLabel("Width ",widthWidget));
+#else
+  widthLineLayout->addWidget(new QLabel("Width ",widthWidget));
+#endif
+  width = new QLineEdit(tmp.setNum(originalWidth),widthWidget);
+  width->setMaxLength(5);
+#if QT_VERSION < 0x040000
+  widthLineLayout->add(width);
+#else
+  widthLineLayout->addWidget(width);
+#endif
+#if QT_VERSION >= 0x040000
+  widthWidget->setLayout(widthLineLayout);
+#endif
+#if QT_VERSION < 0x040000
+  sizeWidgetLayout->add(widthWidget);
+#else
+  sizeWidgetLayout->addWidget(widthWidget);
+#endif
+  connect( width, SIGNAL( textChanged ( const QString& ) ), this, SLOT( textWidthChanged(const QString &) ) );
+
+
+
+  // ratio check box
+
+  ratioCheckBox = new QCheckBox( "Keep ratio",sizeWidget);
+  ratioCheckBox->setChecked( true );
+
+#if QT_VERSION < 0x040000
+  sizeWidgetLayout->add(ratioCheckBox);
+#else
+  sizeWidgetLayout->addWidget(ratioCheckBox);
+#endif
+
+#if QT_VERSION < 0x040000
+  ratioCheckBox->setEnabled ( false );
+  heightWidget->setEnabled ( false );
+  widthWidget->setEnabled ( false );
+#else
+  ratioCheckBox->hide();
+  heightWidget->hide();
+  widthWidget->hide();
+#endif
+
+#if QT_VERSION >= 0x040000
+  sizeWidget->setLayout(sizeWidgetLayout);
+#endif
+  globalVLayout->addWidget(sizeWidget);
+
+ if (format == "eps") {
+
+   QGroupBox *EPSWidgetGroupBox = new QGroupBox(tr("EPS options"),this); // widget containing group button
+
+
+#if QT_VERSION < 0x040000
+
+    EPSWidgetGroupBox->setInsideMargin (15); 
+
+    //    QButtonGroup * EPSColorButtonGroupBox = new QButtonGroup( 2,Qt::Vertical, tr("EPS options"),this);
+    //    EPSGroupBoxLayout = new QVBoxLayout(EPSColorButtonGroupBox);
+    //     colorButton = new QRadioButton("Color",EPSColorButtonGroupBox);
+    //     BWButton = new QRadioButton("Grayscale",EPSColorButtonGroupBox);
+    //     EPSColorButtonGroupBox->setInsideMargin (15); 
+    //     EPSColorButtonGroupBox->insert(colorButton);
+    //     EPSColorButtonGroupBox->insert(BWButton);
+    //     EPSColorButtonGroupBox->setExclusive(true);
+    //     EPSWidgetGroupBox->add(EPSColorButtonGroupBox);
+
+    vectorEPSCheckBox = new QCheckBox( "Vector EPS File",EPSWidgetGroupBox);
+
+#else
+    QVBoxLayout * EPSGroupBoxLayout = new QVBoxLayout(EPSWidgetGroupBox);
+     EPSGroupBoxLayout->setMargin (15); 
+
+//     colorButton = new QRadioButton("Color",EPSWidgetGroupBox);
+//     BWButton = new QRadioButton("Grayscale",EPSWidgetGroupBox);
+
+//     QButtonGroup * EPSColorButtonGroupBox = new QButtonGroup();
+//     EPSColorButtonGroupBox->addButton(colorButton);
+//     EPSColorButtonGroupBox->addButton(BWButton);
+//     EPSColorButtonGroupBox->setExclusive(true);
+
+//     EPSGroupBoxLayout->addWidget(colorButton);    
+//     EPSGroupBoxLayout->addWidget(BWButton);    
+
+    vectorEPSCheckBox = new QCheckBox( "Vector EPS File",EPSWidgetGroupBox);
+    EPSGroupBoxLayout->addWidget(vectorEPSCheckBox);
+
+    EPSWidgetGroupBox->setLayout(EPSGroupBoxLayout);
+#endif
+    //    colorButton->setChecked( true );
+    vectorEPSCheckBox->setChecked( true );
+    
+    globalVLayout->addWidget(EPSWidgetGroupBox);
+    connect( vectorEPSCheckBox, SIGNAL( clicked() ), this, SLOT( changeVectorEPS()) );
+
+  }
+
+  if ((format == "jpg") || 
+      (format == "jpeg")) {
+    
+    QGroupBox *imageGroupBox = new QGroupBox(tr("Image quality"),this);
+    QHBoxLayout *hSliderLayout = new QHBoxLayout(imageGroupBox);
+    hSliderLayout->setMargin (15); 
+
+    qualitySlider= new QSlider(Qt::Horizontal,imageGroupBox);
+#if QT_VERSION < 0x040000
+    qualitySlider->setMinValue(0);
+    qualitySlider->setMaxValue(100);
+    qualitySlider->setTickmarks(QSlider::Below); 
+#else
+    qualitySlider->setMinimum(0);
+    qualitySlider->setMaximum(100);
+    qualitySlider->setTickPosition(QSlider::TicksBelow);
+#endif
+    qualitySlider->setValue(60);
+    hSliderLayout->addWidget(new QLabel("Low ",imageGroupBox));
+    hSliderLayout->addWidget(qualitySlider);
+    hSliderLayout->addWidget(new QLabel(" Maximum",imageGroupBox));
+    
+#if QT_VERSION >= 0x040000
+    imageGroupBox->setLayout(hSliderLayout);
+#endif
+
+    globalVLayout->addWidget(imageGroupBox);
+  }
+
+
+  // button ok/cancel box
+
+  QWidget *buttonBox = new QWidget(this);
+
+  QHBoxLayout *buttonBoxLayout = new QHBoxLayout(buttonBox);
+
+  buttonOk = new QPushButton( tr( "&OK" ),buttonBox );
+  buttonOk->setAutoDefault( TRUE );
+  buttonOk->setDefault( TRUE );
+  buttonBoxLayout->addWidget(buttonOk);
+
+  buttonCancel = new QPushButton( tr( "&Cancel" ),buttonBox );
+  buttonCancel->setAutoDefault( TRUE );
+  buttonBoxLayout->addWidget(buttonCancel);
+
+#if QT_VERSION >= 0x040000
+  buttonBox->setLayout(buttonBoxLayout);
+#endif
+  globalVLayout->addWidget(buttonBox);
+
+
+
+#if QT_VERSION >= 0x040000
+  setLayout(globalVLayout);
+#endif
+
+  // signals and slots connections
+  connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
+  connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
+}
+
+
+
+int G4OpenGLQtExportDialog::getSliderValue()
+{
+  if (!qualitySlider) return -1;
+  return qualitySlider->value();
+}
+
+int G4OpenGLQtExportDialog::getHeight()
+{
+  if (!height) return originalHeight;
+  return height->text().toInt();
+}
+
+int G4OpenGLQtExportDialog::getWidth()
+{
+  if (!width) return originalWidth;
+  return width->text().toInt();
+}
+
+int G4OpenGLQtExportDialog::getTransparency()
+{
+  if (!boxTransparency) return -1;
+  return boxTransparency->isChecked();
+}
+
+int G4OpenGLQtExportDialog::getNbColor()
+{
+  if (!colorButton) return -1;
+  // Black and white
+  if (!colorButton->isChecked())
+    return 1;
+  // rgb color
+  return 3;
+}
+
+bool G4OpenGLQtExportDialog::getVectorEPS()
+{
+  if (!vectorEPSCheckBox) return 0;
+  return vectorEPSCheckBox->isChecked();
+}
+
+
+void G4OpenGLQtExportDialog::changeVectorEPS()
+{
+  if (!vectorEPSCheckBox) return;
+  if (vectorEPSCheckBox->isChecked()) {
+#if QT_VERSION < 0x040000
+    original->setEnabled ( true );
+    modify->setEnabled ( true );
+#else
+    sizeGroupBox->show();
+    original->show();
+    modify->show();
+#endif
+    changeSizeBox();
+  } else {
+#if QT_VERSION < 0x040000
+    original->setEnabled ( false );
+    modify->setEnabled ( false );
+    ratioCheckBox->setEnabled ( false );
+    heightWidget->setEnabled ( false );
+    widthWidget->setEnabled ( false );
+#else
+    sizeGroupBox->hide();
+    original->hide();
+    modify->hide();
+    ratioCheckBox->hide();
+    heightWidget->hide();
+    widthWidget->hide();
+#endif
+  }
+}
+
+
+void G4OpenGLQtExportDialog::changeSizeBox()
+{
+  if (!original) return;
+  if (!heightWidget) return;
+  if (!widthWidget) return;
+  if (!ratioCheckBox) return;
+
+  if ( original->isChecked()) {
+#if QT_VERSION < 0x040000
+    ratioCheckBox->setEnabled ( false );
+    heightWidget->setEnabled ( false );
+    widthWidget->setEnabled ( false );
+#else
+    ratioCheckBox->hide();
+    heightWidget->hide();
+    widthWidget->hide();
+#endif
+  } else {
+#if QT_VERSION < 0x040000
+    ratioCheckBox->setEnabled ( true );
+    heightWidget->setEnabled ( true );
+    widthWidget->setEnabled ( true );
+#else
+    heightWidget->show();
+    widthWidget->show();
+    ratioCheckBox->show();
+#endif
+  }
+}
+
+
+void G4OpenGLQtExportDialog::textWidthChanged(
+ const QString & s
+ )
+{
+  if (!ratioCheckBox) return;
+  if (!width) return;
+  if (isChangingSize == true) return; // exclusive slot
+
+  if (ratioCheckBox->isChecked()){
+    isChangingSize = true;
+    QString tmp;
+  height->setText(tmp.setNum((int)(s.toInt()*(double)((double)originalHeight/(double)originalWidth))));
+  isChangingSize = false;
+  }
+}
+
+void G4OpenGLQtExportDialog::  textHeightChanged(
+ const QString & s
+)
+{
+  if (!ratioCheckBox) return;
+  if (!width) return;
+  if (isChangingSize == true) return; // exclusive slot
+
+  if (ratioCheckBox->isChecked()){
+  isChangingSize = true;
+    QString tmp;
+    width->setText(tmp.setNum(s.toInt()*originalWidth/originalHeight));
+  isChangingSize = false;
+  }
+} 
+
+G4OpenGLQtExportDialog::~G4OpenGLQtExportDialog()
+{
+}
+
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLQtMovieDialog.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLQtMovieDialog.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLQtMovieDialog.cc	(revision 1102)
@@ -0,0 +1,594 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLQtMovieDialog.cc,v 1.8 2008/10/24 13:49:19 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+
+#ifdef G4VIS_BUILD_OPENGLQT_DRIVER
+
+#include "G4OpenGLQtMovieDialog.hh"
+#include "G4OpenGLQtViewer.hh"
+
+#include <qpushbutton.h>
+#include <qpalette.h>
+#include <qlabel.h>
+#include <qgroupbox.h>
+#include <qlayout.h>
+#include <qlineedit.h>
+#include <qfiledialog.h>
+#include <qprocess.h>
+
+
+// +---------------------------------------+
+// +        Path for encoder               +
+// +  _______                              +
+// + | select| ____________________        +
+// +  -------                              +
+// +        Temp path                      +
+// +  _______                              +
+// + | select| ____________________        +
+// +  -------                              +
+// +                                       +
+// + max number of frames  ________        +
+// + ....                                  +
+// +                                       +
+// +     Label : X frames Saves/Encoding   +
+// +         Cancel        Encode          +
+// +---------------------------------------+
+
+G4OpenGLQtMovieDialog::G4OpenGLQtMovieDialog(
+ G4OpenGLQtViewer* parentViewer,
+ QWidget* parentWidget
+)
+  : QDialog( parentWidget ),
+    fParentViewer(parentViewer)
+{
+#if QT_VERSION > 0x030200
+  setModal(false);
+#endif
+#if QT_VERSION < 0x040000
+  setCaption( tr( " Movie parameters" ));
+#else
+  setWindowTitle( tr( " Movie parameters" ));
+#endif
+
+
+  // global layout
+  QVBoxLayout* globalVLayout = new QVBoxLayout(this);
+  globalVLayout->setMargin(10);
+  globalVLayout->setSpacing(10);
+  
+  // Encoder group box
+  QGroupBox *encoderGroupBox = new QGroupBox(tr("Encoder path"),this);		
+  QVBoxLayout *encoderVGroupBoxLayout = new QVBoxLayout(encoderGroupBox);
+
+  // Encoder Path 
+  QWidget *encoderHBox = new QWidget(encoderGroupBox);
+  QHBoxLayout *encoderHBoxLayout = new QHBoxLayout(encoderHBox);
+  fEncoderPath = new QLineEdit("",encoderHBox);
+
+  QPushButton *encoderButton = new QPushButton(tr("..."),encoderHBox);
+  encoderButton->setMaximumWidth (30);
+
+  fEncoderStatus = new QLabel(encoderGroupBox);
+
+#if QT_VERSION > 0x040000
+  fEncoderStatus->setWordWrap(true);
+  encoderVGroupBoxLayout->setMargin(15);
+#else
+  fEncoderStatus->setAlignment ( Qt::AlignAuto |Qt::WordBreak );
+  encoderGroupBox->setInsideMargin(15);
+#endif
+
+  fEncoderStatus->setText("");
+
+#if QT_VERSION < 0x040000
+  encoderHBoxLayout->add(fEncoderPath);
+  encoderHBoxLayout->add(encoderButton);
+  encoderVGroupBoxLayout->add(encoderHBox);
+  encoderVGroupBoxLayout->add(fEncoderStatus);
+
+  globalVLayout->add(encoderGroupBox);
+#else
+  encoderHBoxLayout->addWidget(fEncoderPath);
+  encoderHBoxLayout->addWidget(encoderButton);
+  encoderVGroupBoxLayout->addWidget(encoderHBox);
+  encoderVGroupBoxLayout->addWidget(fEncoderStatus);
+
+  encoderGroupBox->setLayout(encoderVGroupBoxLayout);
+  globalVLayout->addWidget(encoderGroupBox);
+#endif
+
+  connect( encoderButton, SIGNAL( clicked( ) ), this, SLOT(selectEncoderPathAction() ) );
+
+
+  // temp folder group box
+  QGroupBox *tempFolderGroupBox = new QGroupBox(tr("Temporary folder path"),this);
+  QVBoxLayout *tempFolderVGroupBoxLayout = new QVBoxLayout(tempFolderGroupBox);
+
+  // temp folder Path 
+  QWidget *tempFolderHBox = new QWidget(tempFolderGroupBox);
+  QHBoxLayout *tempFolderHBoxLayout = new QHBoxLayout(tempFolderHBox);
+
+  fTempFolderPath = new QLineEdit("",tempFolderHBox);
+
+  QPushButton *tempButton = new QPushButton(tr("..."),tempFolderHBox);
+  tempButton->setMaximumWidth (30);
+
+  fTempFolderStatus = new QLabel(tempFolderGroupBox);
+#if QT_VERSION > 0x040000
+  fTempFolderStatus->setWordWrap(true);
+  tempFolderVGroupBoxLayout->setMargin(15);
+#else
+  fTempFolderStatus->setAlignment ( Qt::AlignAuto |Qt::WordBreak );
+  tempFolderGroupBox->setInsideMargin(15);
+#endif
+  fTempFolderStatus->setText("");
+
+#if QT_VERSION < 0x040000
+  tempFolderHBoxLayout->add(fTempFolderPath);
+  tempFolderHBoxLayout->add(tempButton);
+  tempFolderVGroupBoxLayout->add(tempFolderHBox);
+  tempFolderVGroupBoxLayout->add(fTempFolderStatus);
+
+  globalVLayout->add(tempFolderGroupBox);
+#else
+  tempFolderHBoxLayout->addWidget(fTempFolderPath);
+  tempFolderHBoxLayout->addWidget(tempButton);
+  tempFolderVGroupBoxLayout->addWidget(tempFolderHBox);
+  tempFolderVGroupBoxLayout->addWidget(fTempFolderStatus);
+
+  tempFolderGroupBox->setLayout(tempFolderVGroupBoxLayout);
+  globalVLayout->addWidget(tempFolderGroupBox);
+#endif
+
+  connect( tempButton, SIGNAL( clicked( ) ), this, SLOT(selectTempPathAction() ) );
+
+
+
+
+  // save file group box
+  QGroupBox *saveFileGroupBox = new QGroupBox(tr("Save as"),this);
+  QVBoxLayout *saveFileVGroupBoxLayout = new QVBoxLayout(saveFileGroupBox);
+
+  // save file 
+  QWidget *saveFileHBox = new QWidget(saveFileGroupBox);
+  QHBoxLayout *saveFileHBoxLayout = new QHBoxLayout(saveFileHBox);
+
+  fSaveFileName = new QLineEdit("G4Movie.mpeg",saveFileHBox);
+
+  QPushButton *saveButton = new QPushButton(tr("..."),saveFileHBox);
+  saveButton->setMaximumWidth (30);
+
+  fSaveFileStatus = new QLabel(saveFileGroupBox);
+#if QT_VERSION > 0x040000
+  fSaveFileStatus->setWordWrap(true);
+  saveFileVGroupBoxLayout->setMargin(15);
+#else
+  fSaveFileStatus->setAlignment ( Qt::AlignAuto |Qt::WordBreak );
+  saveFileGroupBox->setInsideMargin(15);
+#endif
+  fSaveFileStatus->setText("");
+
+#if QT_VERSION < 0x040000
+  saveFileHBoxLayout->add(fSaveFileName);
+  saveFileHBoxLayout->add(saveButton);
+  saveFileVGroupBoxLayout->add(saveFileHBox);
+  saveFileVGroupBoxLayout->add(fSaveFileStatus);
+
+  globalVLayout->add(saveFileGroupBox);
+#else
+  saveFileHBoxLayout->addWidget(fSaveFileName);
+  saveFileHBoxLayout->addWidget(saveButton);
+  saveFileVGroupBoxLayout->addWidget(saveFileHBox);
+  saveFileVGroupBoxLayout->addWidget(fSaveFileStatus);
+
+  saveFileGroupBox->setLayout(saveFileVGroupBoxLayout);
+  globalVLayout->addWidget(saveFileGroupBox);
+#endif
+
+  connect( saveButton, SIGNAL( clicked( ) ), this, SLOT(selectSaveFileNameAction() ) );
+
+
+
+  // label
+
+  QLabel *infoLabel = new QLabel("  Press SPACE to Start/Pause video recording \n  Press RETURN to Stop video recording",this);
+
+  // global status
+  QGroupBox *statusGroupBox = new QGroupBox(tr("Status"),this);
+  QVBoxLayout *statusVGroupBoxLayout = new QVBoxLayout(statusGroupBox);
+
+  fRecordingStatus = new QLabel(statusGroupBox);
+#if QT_VERSION > 0x040000
+  statusVGroupBoxLayout->setMargin(15);
+  fRecordingStatus->setWordWrap(true);
+#else
+  statusGroupBox->setInsideMargin(15);
+  fRecordingStatus->setAlignment ( Qt::AlignAuto |Qt::WordBreak );
+#endif
+  QPalette palette( fRecordingStatus->palette() );
+#if QT_VERSION > 0x040000
+  palette.setColor( QPalette::Text, Qt::green);
+#else
+  palette.setColor( QColorGroup::Text, Qt::green);
+#endif
+  fRecordingStatus->setPalette(palette);
+
+  fRecordingInfos = new QLabel(statusGroupBox);
+#if QT_VERSION > 0x040000
+  fRecordingInfos->setWordWrap(true);
+#else
+  fRecordingInfos->setAlignment ( Qt::AlignAuto |Qt::WordBreak );
+#endif
+  setRecordingInfos("");
+
+#if QT_VERSION < 0x040000
+  statusVGroupBoxLayout->add(fRecordingStatus);
+  statusVGroupBoxLayout->add(fRecordingInfos);
+
+  globalVLayout->add(infoLabel);
+  globalVLayout->add(statusGroupBox);
+#else
+  statusVGroupBoxLayout->addWidget(fRecordingStatus);
+  statusVGroupBoxLayout->addWidget(fRecordingInfos);
+
+  statusGroupBox->setLayout(statusVGroupBoxLayout);
+  globalVLayout->addWidget(infoLabel);
+  globalVLayout->addWidget(statusGroupBox);
+#endif
+
+  // buttons
+  QWidget *buttonBox = new QWidget(this);
+
+  QHBoxLayout *buttonBoxLayout = new QHBoxLayout(buttonBox);
+
+  QPushButton *buttonReset = new QPushButton( tr( "&Reset" ),buttonBox );
+  buttonReset->setAutoDefault( TRUE );
+  buttonBoxLayout->addWidget(buttonReset);
+
+  fButtonStartPause = new QPushButton( tr( "  &Start " ),buttonBox );
+  fButtonStartPause->setEnabled(true);
+  fButtonStartPause->setAutoDefault( TRUE );
+  buttonBoxLayout->addWidget(fButtonStartPause);
+
+  fButtonStopFinishClose = new QPushButton( tr( "&Stop" ),buttonBox );
+  fButtonStopFinishClose->setEnabled(false);
+  fButtonStopFinishClose->setAutoDefault( TRUE );
+  buttonBoxLayout->addWidget(fButtonStopFinishClose);
+
+  fButtonSave = new QPushButton( tr( "&Save" ),buttonBox );
+  fButtonSave->setEnabled(false);
+  fButtonSave->setAutoDefault( TRUE );
+  buttonBoxLayout->addWidget(fButtonSave);
+
+  QPushButton *buttonCancel = new QPushButton( tr( "&Cancel" ),buttonBox );
+  buttonCancel->setAutoDefault( TRUE );
+  buttonBoxLayout->addWidget(buttonCancel);
+
+#if QT_VERSION >= 0x040000
+  buttonBox->setLayout(buttonBoxLayout);
+#endif
+  globalVLayout->addWidget(buttonBox);
+
+
+
+#if QT_VERSION >= 0x040000
+  setLayout(globalVLayout);
+#endif
+
+  // signals and slots connections
+  connect( fButtonStartPause, SIGNAL( clicked() ), fParentViewer, SLOT(    startPauseVideo() ) );
+  connect( buttonReset, SIGNAL( clicked() ), this, SLOT( resetRecording() ) );
+  connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
+  connect( fButtonStopFinishClose, SIGNAL( clicked() ), this, SLOT( stopFinishClose() ) );
+  connect( fButtonSave, SIGNAL( clicked() ), this, SLOT( save() ) );
+
+  // fill
+  setRecordingStatus("");
+  fEncoderPath->setText(fParentViewer->getEncoderPath());
+  fTempFolderPath->setText(fParentViewer->getTempFolderPath());
+
+  // connect line edit signals
+  connect (fEncoderPath,SIGNAL(textChanged ( const QString&)),this,SLOT(checkEncoderSwParameters()));
+  connect (fTempFolderPath,SIGNAL(textChanged ( const QString&)),this,SLOT(checkTempFolderParameters()));
+  connect (fSaveFileName,SIGNAL(textChanged ( const QString&)),this,SLOT(checkSaveFileNameParameters()));
+
+#if QT_VERSION >= 0x040000
+  connect (fEncoderPath,SIGNAL(editingFinished ()),this,SLOT(checkEncoderSwParameters()));
+  connect (fTempFolderPath,SIGNAL(editingFinished ()),this,SLOT(checkTempFolderParameters()));
+  connect (fSaveFileName,SIGNAL(editingFinished ()),this,SLOT(checkSaveFileNameParameters()));
+#else
+  connect (fEncoderPath,SIGNAL(lostFocus ()),this,SLOT(checkEncoderSwParameters()));
+  connect (fTempFolderPath,SIGNAL(lostFocus ()),this,SLOT(checkTempFolderParameters()));
+  connect (fSaveFileName,SIGNAL(lostFocus ()),this,SLOT(checkSaveFileNameParameters()));
+#endif
+
+}
+
+
+
+G4OpenGLQtMovieDialog::~G4OpenGLQtMovieDialog()
+{
+}
+
+void G4OpenGLQtMovieDialog::selectEncoderPathAction()
+{
+#if QT_VERSION < 0x040000
+  QString nomFich =  QFileDialog::getOpenFileName ( ".",
+                                                    NULL,
+                                                    this,
+                                                    "Select your encoder",
+                                                    tr("Select your encoder ..."));
+#else
+  QString nomFich =  QFileDialog::getOpenFileName ( this,
+                                                    "Select your encoder",
+                                                    tr("Select your encoder ...")); 
+
+#endif
+
+  if (nomFich == "") {
+    return;
+  }
+  fEncoderPath->setText(nomFich);
+  checkEncoderSwParameters();
+ }
+
+
+void G4OpenGLQtMovieDialog::selectTempPathAction()
+{
+#if QT_VERSION < 0x040000
+  QString nomFich =  QFileDialog::getExistingDirectory (NULL,
+                                                    this,
+                                                    "Select temporary folder",
+                                                    tr("Select temporary folder ..."));
+#else
+  QString nomFich =  QFileDialog::getExistingDirectory ( this,
+                                                    "Select temporary folder",
+                                                    tr("Select temporary folder ...")); 
+
+#endif
+  if (nomFich == "") {
+    return;
+  }
+  fTempFolderPath->setText(nomFich);
+  checkTempFolderParameters();
+ }
+
+
+void G4OpenGLQtMovieDialog::selectSaveFileNameAction()
+{
+#if QT_VERSION < 0x040000
+  QString nomFich =  QFileDialog::getSaveFileName ( ".",
+                                                    NULL,
+                                                    this,
+                                                    "Select saved file",
+                                                    tr("Select saved file ..."));
+#else
+  QString nomFich =  QFileDialog::getSaveFileName ( this,
+                                                    "Select saved file",
+                                                    tr("Select saved file ...")); 
+
+#endif
+  if (nomFich == "") {
+    return;
+  }
+  fSaveFileName->setText(nomFich);
+  checkSaveFileNameParameters();
+ }
+
+
+void G4OpenGLQtMovieDialog::stopFinishClose() {
+  fParentViewer->stopVideo();
+}
+
+void G4OpenGLQtMovieDialog::save() {
+  if (((fParentViewer->isPaused()) || fParentViewer->isRecording() || fParentViewer->isStopped())) {
+    fParentViewer->saveVideo();
+  }
+}
+
+	/**
+ * If one of parameter is incorrect, put it in red and don't valid it
+ * If valid, save it
+ */
+bool G4OpenGLQtMovieDialog::checkEncoderSwParameters() {
+
+  bool status = true;
+  QPalette palette( fEncoderPath->palette() );
+
+  QString temp = fParentViewer->setEncoderPath(fEncoderPath->text());
+  setRecordingInfos("");
+  fEncoderStatus->setText(temp);
+  if (temp != "") {
+#if QT_VERSION > 0x040000
+    palette.setColor( QPalette::Base, Qt::red);
+#else
+    palette.setColor( QColorGroup::Base, Qt::red);
+#endif
+    if (fParentViewer->isReadyToEncode()) {
+      setRecordingInfos("No valid encode defined, screen capture had been saved in the temp folder in ppm format.\nPlease define a encoder and clic on Apply button");
+	}
+    status = false;
+  } else {
+#if QT_VERSION > 0x040000
+    palette.setColor( QPalette::Base, Qt::white);
+#else
+    palette.setColor( QColorGroup::Base, Qt::white);
+#endif
+    fEncoderPath->setText(fParentViewer->getEncoderPath());
+  }
+  fEncoderPath->setPalette(palette);
+  return status;
+}
+
+
+/**
+ * If one of parameter is incorrect, put it in red and don't valid it
+ * If valid, save it
+ */
+bool G4OpenGLQtMovieDialog::checkTempFolderParameters() {
+
+  bool status = true;
+  QPalette palette( fTempFolderPath->palette() );
+
+  QString temp = fParentViewer->setTempFolderPath(fTempFolderPath->text());
+  fTempFolderStatus->setText(temp);
+  if (temp != "") {
+#if QT_VERSION > 0x040000
+    palette.setColor( QPalette::Base, Qt::red);
+#else
+    palette.setColor( QColorGroup::Base, Qt::red);
+#endif
+    status = false;
+  } else {
+#if QT_VERSION > 0x040000
+    palette.setColor( QPalette::Base, Qt::white);
+#else
+    palette.setColor( QColorGroup::Base, Qt::white);
+#endif
+    fTempFolderPath->setText(fParentViewer->getTempFolderPath());
+  }
+  fTempFolderPath->setPalette(palette);
+  return status;
+}
+
+
+/**
+ * If one of parameter is incorrect, put it in red and don't valid it
+ * If valid, save it
+ */
+bool G4OpenGLQtMovieDialog::checkSaveFileNameParameters() {
+
+  bool status = true;
+  QPalette palette( fSaveFileName->palette() );
+
+  QString temp = fParentViewer->setSaveFileName(fSaveFileName->text());
+  fSaveFileStatus->setText(temp);
+  if (temp != "") { 
+#if QT_VERSION > 0x040000
+    palette.setColor( QPalette::Base, Qt::red);
+#else
+    palette.setColor( QColorGroup::Base, Qt::red);
+#endif
+    status = false;
+  } else {
+#if QT_VERSION > 0x040000
+    palette.setColor( QPalette::Base, Qt::white);
+#else
+    palette.setColor( QColorGroup::Base, Qt::white);
+#endif
+    fSaveFileName->setText(fParentViewer->getSaveFileName());
+  }
+  fSaveFileName->setPalette(palette);
+  return status;
+}
+
+
+void G4OpenGLQtMovieDialog::resetRecording() {
+  fParentViewer->resetRecording();
+}
+
+
+void G4OpenGLQtMovieDialog::setRecordingStatus(QString txt) {
+  fRecordingStatus->setText(txt);
+  if (fParentViewer->isWaiting()) {
+    fButtonStartPause->setText("  &Start ");
+    fButtonStartPause->setEnabled(true);
+    fButtonStopFinishClose->setEnabled(false);
+    fButtonSave->setEnabled(false);
+
+  } else if (fParentViewer->isPaused()) {
+
+    fButtonStartPause->setText("  &Continue ");
+    fButtonStartPause->setEnabled(true);
+    fButtonStopFinishClose->setEnabled(true);
+    fButtonSave->setEnabled(false);
+
+  } else if (fParentViewer->isRecording()) {
+
+    fButtonStartPause->setText("  &Pause ");
+    fButtonStartPause->setEnabled(true);
+    fButtonStopFinishClose->setEnabled(true);
+    fButtonSave->setEnabled(false);
+
+  } else if (fParentViewer->isBadOutput()) {
+
+    fButtonStartPause->setText("  &Start ");
+    fButtonStartPause->setEnabled(true);
+    fButtonStopFinishClose->setEnabled(false);
+    fButtonSave->setEnabled(false);
+
+  } else if (fParentViewer->isBadTmp()) {
+
+    fButtonStartPause->setText("  &Start ");
+    fButtonStartPause->setEnabled(false);
+    fButtonStopFinishClose->setEnabled(false);
+    fButtonSave->setEnabled(false);
+
+  } else if (fParentViewer->isBadEncoder()) {
+
+    fButtonStartPause->setText("  &Start ");
+    fButtonStartPause->setEnabled(true);
+    fButtonStopFinishClose->setEnabled(false);
+    fButtonSave->setEnabled(false);
+
+  } else if (fParentViewer->isSuccess()) {
+
+    fButtonStartPause->setText("  &Start ");
+    fButtonStartPause->setEnabled(false);
+    fButtonStopFinishClose->setEnabled(false);
+    fButtonSave->setEnabled(false);
+
+  } else if (fParentViewer->isFailed()) {
+
+    fButtonStartPause->setText("  &Start ");
+    fButtonStartPause->setEnabled(false);
+    fButtonStopFinishClose->setEnabled(false);
+    fButtonSave->setEnabled(false);
+
+  } else if (fParentViewer->isStopped()) {
+
+    fButtonStartPause->setText("  &Start ");
+    fButtonStartPause->setEnabled(false);
+    fButtonStopFinishClose->setEnabled(false);
+    fButtonSave->setEnabled(true);
+  }
+}
+
+
+void G4OpenGLQtMovieDialog::setRecordingInfos(QString txt) {
+  fRecordingInfos->setText(txt);
+}
+
+
+void G4OpenGLQtMovieDialog::enabledApplyButton() {
+  fButtonStartPause->setEnabled(true);
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLQtViewer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLQtViewer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLQtViewer.cc	(revision 1102)
@@ -0,0 +1,2670 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLQtViewer.cc,v 1.43 2009/07/29 10:04:45 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// G4OpenGLQtViewer : Class to provide Qt specific
+//                     functionality for OpenGL in GEANT4
+//
+// 27/06/2003 : G.Barrand : implementation (at last !).
+
+#ifdef G4VIS_BUILD_OPENGLQT_DRIVER
+
+#include "G4OpenGLQtViewer.hh"
+#include "G4VViewer.hh"
+#include "G4VSceneHandler.hh"
+#include "G4OpenGLSceneHandler.hh"
+
+#include "G4ios.hh"
+#include "G4VisExtent.hh"
+#include "G4LogicalVolume.hh"
+#include "G4VSolid.hh"
+#include "G4Point3D.hh"
+#include "G4Normal3D.hh"
+#include "G4Scene.hh"
+#include "G4OpenGLQtExportDialog.hh"
+#include "G4OpenGLQtMovieDialog.hh"
+#include "G4UnitsTable.hh"
+#include "G4Qt.hh"
+#include "G4UImanager.hh"
+#include "G4UIcommandTree.hh"
+#include <qlayout.h>
+#include <qdialog.h>
+#include <qprocess.h>
+#include <qapplication.h>
+#include <qdesktopwidget.h>
+
+#if QT_VERSION >= 0x040000
+#include <qmenu.h>
+#include <qimagewriter.h>
+#else
+#include <qaction.h>
+#include <qwidgetlist.h>
+#include <qpopupmenu.h>
+#include <qimage.h>
+#endif
+
+#include <qapplication.h>
+#include <qmessagebox.h>
+#include <qfiledialog.h>
+#include <qprinter.h>
+#include <qdatetime.h>
+#include <qpainter.h>
+#include <qgl.h> // include <qglwidget.h>
+#include <qdialog.h>
+#include <qevent.h> //include <qcontextmenuevent.h>
+
+
+//////////////////////////////////////////////////////////////////////////////
+/**
+   Implementation of virtual method of G4VViewer
+*/
+void G4OpenGLQtViewer::SetView (
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  G4OpenGLViewer::SetView ();
+}
+
+
+
+
+//////////////////////////////////////////////////////////////////////////////
+void G4OpenGLQtViewer::CreateMainWindow (
+ QGLWidget* glWidget
+ ,QString name
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+
+  if(fWindow) return; //Done.
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLQtViewer::CreateMainWindow glWidget\n");
+#endif
+
+  // launch Qt if not
+  G4Qt* interactorManager = G4Qt::getInstance ();
+  //  G4UImanager* UI = G4UImanager::GetUIpointer();
+
+  fWindow = glWidget ;
+  //  fWindow->makeCurrent();
+
+  // create window
+  if (((QApplication*)interactorManager->GetMainInteractor())) {
+    // look for the main window
+    bool found = false;
+#if QT_VERSION < 0x040000
+    // theses lines does nothing exept this one "GLWindow = new QDialog(0..."
+    // but if I comment them, it doesn't work...
+    QWidgetList  *list = QApplication::allWidgets();
+    QWidgetListIt it( *list );         // iterate over the widgets
+    QWidget * widget;
+    while ( (widget=it.current()) != 0 ) {  // for each widget...
+      ++it;
+      if ((found== false) && (widget->inherits("QMainWindow"))) {
+        fGLWindow = new QDialog(0,0,FALSE,Qt::WStyle_Title | Qt::WStyle_SysMenu | Qt::WStyle_MinMax );
+        found = true;
+      }
+    }
+    delete list;                      // delete the list, not the widgets
+#else
+    foreach (QWidget *widget, QApplication::allWidgets()) {
+      if ((found== false) && (widget->inherits("QMainWindow"))) {
+        fGLWindow = new QDialog(0,Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint);
+        found = true;
+      }
+    }
+#endif
+
+#if QT_VERSION < 0x040000
+    glWidget->reparent(fGLWindow,0,QPoint(0,0));  
+#else
+    glWidget->setParent(fGLWindow);  
+#endif
+
+    if (found==false) {
+#ifdef G4DEBUG_VIS_OGL
+      printf("G4OpenGLQtViewer::CreateMainWindow case Qapp exist, but not found\n");
+#endif
+      fGLWindow = new QDialog();
+    }
+  } else {
+#ifdef G4DEBUG_VIS_OGL
+    printf("G4OpenGLQtViewer::CreateMainWindow case Qapp exist\n");
+#endif
+    fGLWindow = new QDialog();
+  }
+
+  QHBoxLayout *mainLayout = new QHBoxLayout(fGLWindow);
+  mainLayout->setMargin(0);
+  mainLayout->setSpacing(0);   
+  mainLayout->addWidget(fWindow);
+
+#if QT_VERSION < 0x040000
+  fGLWindow->setCaption(name );
+#else
+  fGLWindow->setLayout(mainLayout);
+  fGLWindow->setWindowTitle( name);
+#endif
+  ResizeWindow(fVP.GetWindowSizeHintX(),fVP.GetWindowSizeHintY());
+
+  //useful for MACOSX, we have to compt the menuBar height
+  int offset = QApplication::desktop()->height() 
+                      - QApplication::desktop()->availableGeometry().height();
+
+  G4int YPos= fVP.GetWindowAbsoluteLocationHintY(QApplication::desktop()->height());
+  if (fVP.GetWindowAbsoluteLocationHintY(QApplication::desktop()->height())< offset) {
+    YPos = offset;
+  }
+  fGLWindow->resize(getWinWidth(), getWinHeight());
+  fGLWindow->move(fVP.GetWindowAbsoluteLocationHintX(QApplication::desktop()->width()),YPos);
+  fGLWindow->show();
+  
+  if(!fWindow) return;
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLQtViewer::CreateMainWindow glWidget END\n");
+#endif
+
+  if (!fContextMenu) 
+    createPopupMenu();
+
+}
+
+#if QT_VERSION >= 0x040000
+/**  Close the dialog and set the pointer to NULL
+ */
+// void G4OpenGLQtViewer::dialogClosed() {
+//   //  fGLWindow = NULL;
+// }
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+G4OpenGLQtViewer::G4OpenGLQtViewer (
+                                    G4OpenGLSceneHandler& scene
+                                    )
+  :G4VViewer (scene, -1)
+  ,G4OpenGLViewer (scene)
+  ,fWindow(0)
+  ,fRecordFrameNumber(0)
+  ,fRotationAngleX(0)
+  ,fRotationAngleY(0)
+  ,fDeltaRotationAngleX(0)
+  ,fDeltaRotationAngleY(0)
+  ,fContextMenu(0)
+  ,fMouseAction(STYLE1)
+  ,fDeltaRotation(1)
+  ,fDeltaSceneTranslation(0.01)
+  ,fDeltaDepth(0.01)
+  ,fDeltaZoom(0.05)
+  ,fDeltaMove(0.05)
+  ,fHoldKeyEvent(false)
+  ,fHoldMoveEvent(false)
+  ,fHoldRotateEvent(false)
+  ,fAutoMove(false)
+  ,fEncoderPath("")
+  ,fTempFolderPath("")
+  ,fMovieTempFolderPath("")
+  ,fSaveFileName("")
+  ,fParameterFileName("mpeg_encode_parameter_file.par")
+  ,fMovieParametersDialog(NULL)
+  ,fRecordingStep(WAIT)
+  ,fProcess(NULL)
+  ,fLaunchSpinDelay(100)
+{
+
+  // launch Qt if not
+  G4Qt::getInstance ();
+
+  fLastPos3 = QPoint(-1,-1);    
+  fLastPos2 = QPoint(-1,-1);    
+  fLastPos1 = QPoint(-1,-1);    
+  
+  initMovieParameters();
+
+  fLastEventTime = new QTime();
+
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLQtViewer::G4OpenGLQtViewer END\n");
+#endif
+}
+
+//////////////////////////////////////////////////////////////////////////////
+G4OpenGLQtViewer::~G4OpenGLQtViewer (
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+#if QT_VERSION < 0x040000
+  G4cout <<removeTempFolder().ascii() <<G4endl;
+#else
+  G4cout <<removeTempFolder().toStdString().c_str() <<G4endl;
+#endif
+}
+
+
+/**
+   Create a popup menu for the widget. This menu is activated by right-mouse click
+*/
+void G4OpenGLQtViewer::createPopupMenu()    {
+
+#if QT_VERSION < 0x040000
+  fContextMenu = new QPopupMenu( fGLWindow,"All" );
+#else
+  fContextMenu = new QMenu("All");
+#endif
+
+#if QT_VERSION < 0x040000
+  QPopupMenu *mMouseAction = new QPopupMenu( fContextMenu );
+  fContextMenu->insertItem("&Mouse actions",mMouseAction);
+#if QT_VERSION < 0x030200
+  fRotateAction =  new QAction("&Rotate","&Rotate",CTRL+Key_R,mMouseAction,0,true);
+  fMoveAction =  new QAction("&Move","&Move",CTRL+Key_M,mMouseAction,0,true);
+  fPickAction =  new QAction("&Pick","&Pick",CTRL+Key_P,mMouseAction,0,true);
+  QAction * shortcutsAction =  new QAction("&Show shortcuts","&Show shortcuts",CTRL+Key_S,mMouseAction,0,true);
+#else
+  fRotateAction =  new QAction("&Rotate",CTRL+Key_R,mMouseAction);
+  fMoveAction =  new QAction("&Move",CTRL+Key_M,mMouseAction);
+  fPickAction =  new QAction("&Pick",CTRL+Key_P,mMouseAction);
+  QAction *shortcutsAction =  new QAction("&Show shortcuts",CTRL+Key_S,mMouseAction);
+#endif
+  fRotateAction->addTo(mMouseAction);
+  fMoveAction->addTo(mMouseAction);
+  fPickAction->addTo(mMouseAction);
+  shortcutsAction->addTo(mMouseAction);
+
+  fRotateAction->setToggleAction(true);
+  fMoveAction->setToggleAction(true);
+  fPickAction->setToggleAction(true);
+  shortcutsAction->setToggleAction(true);
+
+  fRotateAction->setOn(true);
+  fMoveAction->setOn(false);
+  fPickAction->setOn(false);
+  shortcutsAction->setOn(false);
+
+
+  QObject ::connect(fRotateAction, 
+                    SIGNAL(activated()),
+                    this,
+                    SLOT(actionMouseRotate()));
+
+  QObject ::connect(fMoveAction, 
+                    SIGNAL(activated()),
+                    this,
+                    SLOT(actionMouseMove()));
+
+  QObject ::connect(fPickAction, 
+                    SIGNAL(activated()),
+                    this,
+                    SLOT(actionMousePick()));
+
+  QObject ::connect(shortcutsAction, 
+                    SIGNAL(activated()),
+                    this,
+                    SLOT(showShortcuts()));
+
+#else
+  QMenu *mMouseAction = fContextMenu->addMenu("&Mouse actions");
+
+  fRotateAction = mMouseAction->addAction("Rotate");
+  fMoveAction = mMouseAction->addAction("Move");
+  fPickAction = mMouseAction->addAction("Pick");
+  QAction *shortcutsAction = mMouseAction->addAction("Show shortcuts");
+
+  fRotateAction->setCheckable(true);
+  fMoveAction->setCheckable(false);
+  fPickAction->setCheckable(false);
+  shortcutsAction->setCheckable(false);
+
+  fRotateAction->setChecked(true);
+  fMoveAction->setChecked(false);
+  fPickAction->setChecked(false);
+  shortcutsAction->setChecked(false);
+
+  QObject ::connect(fRotateAction, 
+                    SIGNAL(triggered(bool)),
+                    this, 
+                    SLOT(actionMouseRotate()));
+
+  QObject ::connect(fMoveAction, 
+                    SIGNAL(triggered(bool)),
+                    this, 
+                    SLOT(actionMouseMove()));
+
+  QObject ::connect(fPickAction, 
+                    SIGNAL(triggered(bool)),
+                    this, 
+                    SLOT(actionMousePick()));
+
+  QObject ::connect(shortcutsAction, 
+                    SIGNAL(triggered(bool)),
+                    this, 
+                    SLOT(showShortcuts()));
+#endif
+
+#if QT_VERSION < 0x040000
+  // === Style Menu ===
+  QPopupMenu *mStyle = new QPopupMenu(fContextMenu);
+
+  QPopupMenu *mRepresentation = new QPopupMenu(fContextMenu);
+
+  QPopupMenu *mProjection = new QPopupMenu(fContextMenu);
+
+#if QT_VERSION < 0x030200
+  QAction *polyhedron = new QAction("&Polyhedron","&Polyhedron",CTRL+Key_P,mRepresentation,0,true);
+  QAction *nurbs = new QAction("&NURBS","&NURBS",CTRL+Key_N,mRepresentation,0,true);
+
+  QAction *ortho = new QAction("&Orthographic","&Orthographic",CTRL+Key_O,mProjection,0,true);
+  QAction *perspective = new QAction("&Perspective","&Perspective",CTRL+Key_P,mProjection,0,true);
+#else
+  QAction *polyhedron = new QAction("&Polyhedron",CTRL+Key_P,mRepresentation);
+  QAction *nurbs = new QAction("&NURBS",CTRL+Key_N,mRepresentation);
+
+  QAction *ortho = new QAction("&Orthographic",CTRL+Key_O,mProjection);
+  QAction *perspective = new QAction("&Perspective",CTRL+Key_P,mProjection);
+  polyhedron->setToggleAction(true);
+  nurbs->setToggleAction(true);
+  ortho->setToggleAction(true);
+  perspective->setToggleAction(true);
+#endif
+  polyhedron->addTo(mRepresentation);
+  nurbs->addTo(mRepresentation);
+
+  ortho->addTo(mProjection);
+  perspective->addTo(mProjection);
+
+  mStyle->insertItem("&Representation",mRepresentation);
+  mStyle->insertItem("&Projection",mProjection);
+  fContextMenu->insertItem("&Style",mStyle);
+
+
+#else
+  // === Style Menu ===
+  QMenu *mStyle = fContextMenu->addMenu("&Style");
+
+  QMenu *mRepresentation = mStyle->addMenu("&Representation");
+  QMenu *mProjection = mStyle->addMenu("&Projection");
+  QAction *polyhedron = mRepresentation->addAction("Polyhedron");
+  QAction *nurbs = mRepresentation->addAction("NURBS");
+
+  QAction *ortho = mProjection->addAction("Orthographic");
+  QAction *perspective = mProjection->addAction("Persepective");
+#endif
+
+  // INIT mRepresentation
+  G4ViewParameters::RepStyle style;
+  style = fVP.GetRepStyle();
+  if (style == G4ViewParameters::polyhedron) {
+    createRadioAction(polyhedron,nurbs,SLOT(toggleRepresentation(bool)),1);
+  } else if (style == G4ViewParameters::nurbs) {
+    createRadioAction(polyhedron,nurbs,SLOT(toggleRepresentation(bool)),2);
+  } else {
+    mRepresentation->clear();
+  }
+
+  // INIT mProjection
+  if (fVP.GetFieldHalfAngle() == 0) {
+    createRadioAction(ortho, perspective,SLOT(toggleProjection(bool)),1);
+  } else {
+    createRadioAction(ortho, perspective,SLOT(toggleProjection(bool)),2);
+  }
+
+#if QT_VERSION < 0x040000
+  // === Drawing Menu ===
+  QPopupMenu *mDrawing = new QPopupMenu(fContextMenu);
+  fContextMenu->insertItem("&Drawing",mDrawing);
+
+#if QT_VERSION < 0x030200
+  fDrawingWireframe = new QAction("&Wireframe","&Wireframe",CTRL+Key_W,mDrawing,0,true);
+  fDrawingLineRemoval = new QAction("&Hidden line removal","&Hidden line removal",CTRL+Key_L,mDrawing,0,true);
+  fDrawingSurfaceRemoval = new QAction("&Hidden surface removal","&Hidden surface removal",CTRL+Key_S,mDrawing,0,true);
+  fDrawingLineSurfaceRemoval = new QAction("&Hidden line and surface removal","&Hidden line and surface removal",CTRL+Key_R,mDrawing,0,true);
+#else
+  fDrawingWireframe = new QAction("&Wireframe",CTRL+Key_W,mDrawing);
+  fDrawingLineRemoval = new QAction("&Hidden line removal",CTRL+Key_L,mDrawing);
+  fDrawingSurfaceRemoval = new QAction("&Hidden surface removal",CTRL+Key_S,mDrawing);
+  fDrawingLineSurfaceRemoval = new QAction("&Hidden line and surface removal",CTRL+Key_R,mDrawing);
+#endif
+  fDrawingWireframe->setToggleAction(true);
+  fDrawingLineRemoval->setToggleAction(true);
+  fDrawingSurfaceRemoval->setToggleAction(true);
+  fDrawingLineSurfaceRemoval->setToggleAction(true);
+
+  fDrawingWireframe->addTo(mDrawing);
+  fDrawingLineRemoval->addTo(mDrawing);
+  fDrawingSurfaceRemoval->addTo(mDrawing);
+  fDrawingLineSurfaceRemoval->addTo(mDrawing);
+
+
+#else
+  // === Drawing Menu ===
+  QMenu *mDrawing = mStyle->addMenu("&Drawing");
+
+  fDrawingWireframe = mDrawing->addAction("Wireframe");
+  fDrawingWireframe->setCheckable(true);
+
+  fDrawingLineRemoval = mDrawing->addAction("Hidden line removal");
+  fDrawingLineRemoval->setCheckable(true);
+
+  fDrawingSurfaceRemoval = mDrawing->addAction("Hidden Surface removal");
+  fDrawingSurfaceRemoval->setCheckable(true);
+
+  fDrawingLineSurfaceRemoval = mDrawing->addAction("Hidden line and surface removal");
+  fDrawingLineSurfaceRemoval->setCheckable(true);
+#endif
+  // INIT Drawing
+  G4ViewParameters::DrawingStyle d_style;
+  d_style = fVP.GetDrawingStyle();
+  
+#if QT_VERSION < 0x040000
+  if (d_style == G4ViewParameters::wireframe) {
+    fDrawingWireframe->setOn(true);
+  } else if (d_style == G4ViewParameters::hlr) {
+    fDrawingLineRemoval->setOn(true);
+  } else if (d_style == G4ViewParameters::hsr) {
+    fDrawingSurfaceRemoval->setOn(true);
+  } else if (d_style == G4ViewParameters::hlhsr) {
+    fDrawingLineSurfaceRemoval->setOn(true);
+  } else {
+    mDrawing->clear();
+  }
+  QObject ::connect(fDrawingWireframe, 
+                    SIGNAL(activated()),
+                    this, 
+                    SLOT(actionDrawingWireframe()));
+  QObject ::connect(fDrawingLineRemoval, 
+                    SIGNAL(activated()),
+                    this, 
+                    SLOT(actionDrawingLineRemoval()));
+  QObject ::connect(fDrawingSurfaceRemoval, 
+                    SIGNAL(activated()),
+                    this, 
+                    SLOT(actionDrawingSurfaceRemoval()));
+  QObject ::connect(fDrawingLineSurfaceRemoval, 
+                    SIGNAL(activated()),
+                    this, 
+                    SLOT(actionDrawingLineSurfaceRemoval()));
+#else
+  if (d_style == G4ViewParameters::wireframe) {
+    fDrawingWireframe->setChecked(true);
+  } else if (d_style == G4ViewParameters::hlr) {
+    fDrawingLineRemoval->setChecked(true);
+  } else if (d_style == G4ViewParameters::hsr) {
+    fDrawingSurfaceRemoval->setChecked(true);
+  } else if (d_style == G4ViewParameters::hlhsr) {
+    fDrawingLineSurfaceRemoval->setChecked(true);
+  } else {
+    mDrawing->clear();
+  }
+  QObject ::connect(fDrawingWireframe, 
+                    SIGNAL(triggered(bool)),
+                    this, 
+                    SLOT(actionDrawingWireframe()));
+  QObject ::connect(fDrawingLineRemoval, 
+                    SIGNAL(triggered(bool)),
+                    this, 
+                    SLOT(actionDrawingLineRemoval()));
+  QObject ::connect(fDrawingSurfaceRemoval, 
+                    SIGNAL(triggered(bool)),
+                    this, 
+                    SLOT(actionDrawingSurfaceRemoval()));
+  QObject ::connect(fDrawingLineSurfaceRemoval, 
+                    SIGNAL(triggered(bool)),
+                    this, 
+                    SLOT(actionDrawingLineSurfaceRemoval()));
+#endif
+
+
+
+#if QT_VERSION < 0x040000
+  QPopupMenu *mBackground = new QPopupMenu(mStyle);
+  mStyle->insertItem("&Background color",mBackground);
+
+#if QT_VERSION < 0x030200
+  QAction *white = new QAction("&White","&White",CTRL+Key_W,mBackground,0,true);
+  QAction *black =  new QAction("&Black","&Black",CTRL+Key_B,mBackground,0,true);
+#else
+  QAction *white = new QAction("&White",CTRL+Key_W,mBackground);
+  QAction *black =  new QAction("&Black",CTRL+Key_B,mBackground);
+  white->setToggleAction(true);
+  black->setToggleAction(true);
+#endif
+  white->addTo(mBackground);
+  black->addTo(mBackground);
+
+#else
+  QMenu *mBackground = mStyle->addMenu("&Background color");
+  QAction *white = mBackground->addAction("White");
+  QAction *black = mBackground->addAction("Black");
+
+#endif
+  if (background.GetRed() == 1. &&
+      background.GetGreen() == 1. &&
+      background.GetBlue() == 1.) {
+    createRadioAction(white,black,SLOT(toggleBackground(bool)),1);
+  } else {
+    createRadioAction(white,black,SLOT(toggleBackground(bool)),2);
+  }
+
+
+#if QT_VERSION < 0x040000
+  // === Action Menu ===
+  QPopupMenu *mActions = new QPopupMenu(fContextMenu);
+  fContextMenu->insertItem("&Actions",mActions);
+
+#if QT_VERSION < 0x030200
+  QAction *createEPS =  new QAction("&Save as ...","&Save as ...",CTRL+Key_S,mActions,0,true);
+#else
+  QAction *createEPS =  new QAction("&Save as ...",CTRL+Key_S,mActions);
+#endif
+  createEPS->addTo(mActions);
+  QObject ::connect(createEPS, 
+                    SIGNAL(activated()),
+                    this,
+                    SLOT(actionSaveImage()));
+
+#else
+  // === Action Menu ===
+  QMenu *mActions = fContextMenu->addMenu("&Actions");
+  QAction *createEPS = mActions->addAction("Save as ...");
+  QObject ::connect(createEPS, 
+                    SIGNAL(triggered()),
+                    this,
+                    SLOT(actionSaveImage()));
+#endif
+
+#if QT_VERSION < 0x040000
+#if QT_VERSION < 0x030200
+  QAction *movieParameters =  new QAction("&Make Movie...","&Make movie ...",CTRL+Key_M,mActions,0,true);
+#else
+  QAction *movieParameters =  new QAction("&Make Movie...",CTRL+Key_M,mActions);
+#endif
+  movieParameters->addTo(mActions);
+  QObject ::connect(movieParameters, 
+                    SIGNAL(activated()),
+                    this,
+                    SLOT(actionMovieParameters()));
+
+#else
+  // === Action Menu ===
+  QAction *movieParameters = mActions->addAction("Movie parameters...");
+  QObject ::connect(movieParameters, 
+                    SIGNAL(triggered()),
+                    this,
+                    SLOT(actionMovieParameters()));
+#endif
+
+
+
+
+#if QT_VERSION < 0x040000
+  // === Special Menu ===
+  QPopupMenu *mSpecial = new QPopupMenu(fContextMenu);
+  fContextMenu->insertItem("S&pecial",mSpecial);
+
+  QPopupMenu *mTransparency = new QPopupMenu(mSpecial);
+  mSpecial->insertItem("Transparency",mTransparency);
+
+#if QT_VERSION < 0x030200
+  QAction *transparencyOn = new QAction("&On","&On",CTRL+Key_O,mTransparency,0,true);
+  QAction *transparencyOff = new QAction("&Off","&Off",CTRL+Key_F,mTransparency,0,true);
+#else
+  QAction *transparencyOn = new QAction("&On",CTRL+Key_O,mTransparency);
+  QAction *transparencyOff = new QAction("&Off",CTRL+Key_F,mTransparency);
+  transparencyOn->setToggleAction(true);
+  transparencyOff->setToggleAction(true);
+#endif
+  transparencyOn->addTo(mTransparency);
+  transparencyOff->addTo(mTransparency);
+
+#else
+  // === Special Menu ===
+  QMenu *mSpecial = fContextMenu->addMenu("S&pecial");
+  QMenu *mTransparency = mSpecial->addMenu("Transparency");
+  QAction *transparencyOn = mTransparency->addAction("On");
+  QAction *transparencyOff = mTransparency->addAction("Off");
+#endif
+
+  if (transparency_enabled == false) {
+    createRadioAction(transparencyOn,transparencyOff,SLOT(toggleTransparency(bool)),2);
+  } else if (transparency_enabled == true) {
+    createRadioAction(transparencyOn,transparencyOff,SLOT(toggleTransparency(bool)),1);
+  } else {
+    mSpecial->clear();
+  }
+
+
+#if QT_VERSION < 0x040000
+  QPopupMenu *mAntialiasing = new QPopupMenu(mSpecial);
+  mSpecial->insertItem("Antialiasing",mAntialiasing);
+
+#if QT_VERSION < 0x030200
+  QAction *antialiasingOn = new QAction("&On","&On",CTRL+Key_O,mAntialiasing,0,true);
+  QAction *antialiasingOff = new QAction("&Off","&Off",CTRL+Key_F,mAntialiasing,0,true);
+#else
+  QAction *antialiasingOn = new QAction("&On",CTRL+Key_O,mAntialiasing);
+  QAction *antialiasingOff = new QAction("&Off",CTRL+Key_F,mAntialiasing);
+  antialiasingOn->setToggleAction(true);
+  antialiasingOff->setToggleAction(true);
+#endif
+  antialiasingOn->addTo(mAntialiasing);
+  antialiasingOff->addTo(mAntialiasing);
+
+#else
+  QMenu *mAntialiasing = mSpecial->addMenu("Antialiasing");
+  QAction *antialiasingOn = mAntialiasing->addAction("On");
+  QAction *antialiasingOff = mAntialiasing->addAction("Off");
+#endif
+
+  if (antialiasing_enabled == false) {
+    createRadioAction(antialiasingOn,antialiasingOff,SLOT(toggleAntialiasing(bool)),2);
+  } else if (antialiasing_enabled == true) {
+    createRadioAction(antialiasingOn,antialiasingOff,SLOT(toggleAntialiasing(bool)),1);
+  } else {
+    mAntialiasing->clear();
+  }
+
+#if QT_VERSION < 0x040000
+  QPopupMenu *mHaloing = new QPopupMenu(mSpecial);
+  mSpecial->insertItem("Haloing",mHaloing);
+
+#if QT_VERSION < 0x030200
+  QAction *haloingOn = new QAction("&On","&On",CTRL+Key_O,mHaloing,0,true);
+  QAction *haloingOff = new QAction("&Off","&Off",CTRL+Key_F,mHaloing,0,true);
+#else
+  QAction *haloingOn = new QAction("&On",CTRL+Key_O,mHaloing);
+  QAction *haloingOff = new QAction("&Off",CTRL+Key_F,mHaloing);
+  haloingOn->setToggleAction(true);
+  haloingOff->setToggleAction(true);
+#endif
+  haloingOn->addTo(mHaloing);
+  haloingOff->addTo(mHaloing);
+#else
+  QMenu *mHaloing = mSpecial->addMenu("Haloing");
+  QAction *haloingOn = mHaloing->addAction("On");
+  QAction *haloingOff = mHaloing->addAction("Off");
+#endif
+  if (haloing_enabled == false) {
+    createRadioAction(haloingOn,haloingOff,SLOT(toggleHaloing(bool)),2);
+  } else if (haloing_enabled == true) {
+    createRadioAction(haloingOn,haloingOff,SLOT(toggleHaloing(bool)),1);
+  } else {
+    mHaloing->clear();
+  }
+
+#if QT_VERSION < 0x040000
+  QPopupMenu *mAux = new QPopupMenu(mSpecial);
+  mSpecial->insertItem("Auxiliairy edges",mAux);
+
+#if QT_VERSION < 0x030200
+  QAction *auxOn = new QAction("&On","&On",CTRL+Key_O,mAux,0,true);
+  QAction *auxOff = new QAction("&Off","&Off",CTRL+Key_F,mAux,0,true);
+#else
+  QAction *auxOn = new QAction("&On",CTRL+Key_O,mAux);
+  QAction *auxOff = new QAction("&Off",CTRL+Key_F,mAux);
+  auxOn->setToggleAction(true);
+  auxOff->setToggleAction(true);
+#endif
+  auxOn->addTo(mAux);
+  auxOff->addTo(mAux);
+
+#else
+  QMenu *mAux = mSpecial->addMenu("Auxiliary edges");
+  QAction *auxOn = mAux->addAction("On");
+  QAction *auxOff = mAux->addAction("Off");
+#endif
+  if (!fVP.IsAuxEdgeVisible()) {
+    createRadioAction(auxOn,auxOff,SLOT(toggleAux(bool)),1);
+  } else {
+    createRadioAction(auxOn,auxOff,SLOT(toggleAux(bool)),2);
+  }
+
+
+
+#if QT_VERSION < 0x040000
+  QPopupMenu *mFullScreen = new QPopupMenu(mSpecial);
+  mSpecial->insertItem("Full screen",mFullScreen);
+
+#if QT_VERSION < 0x030200
+  fFullScreenOn = new QAction("&On","&On",CTRL+Key_O,mFullScreen,0,true);
+  fFullScreenOff = new QAction("&Off","&Off",CTRL+Key_F,mFullScreen,0,true);
+#else
+  fFullScreenOn = new QAction("&On",CTRL+Key_O,mFullScreen);
+  fFullScreenOff = new QAction("&Off",CTRL+Key_F,mFullScreen);
+  fFullScreenOn->setToggleAction(true);
+  fFullScreenOff->setToggleAction(true);
+#endif
+  fFullScreenOn->addTo(mFullScreen);
+  fFullScreenOff->addTo(mFullScreen);
+#else
+  QMenu *mFullScreen = mSpecial->addMenu("&Full screen");
+  fFullScreenOn = mFullScreen->addAction("On");
+  fFullScreenOff = mFullScreen->addAction("Off");
+#endif
+  createRadioAction(fFullScreenOn,fFullScreenOff,SLOT(toggleFullScreen(bool)),2);
+
+}
+
+
+void G4OpenGLQtViewer::G4manageContextMenuEvent(QContextMenuEvent *e)
+{
+  if (!fGLWindow) {
+    G4cerr << "Visualization window not defined, please choose one before" << G4endl;
+  } else {
+  
+    if (!fContextMenu) 
+      createPopupMenu();
+    
+    // launch menu
+    if ( fContextMenu ) {
+      fContextMenu->exec( e->globalPos() );
+      //    delete fContextMenu;
+    }
+  }
+  e->accept();
+}
+
+
+/**
+   Create a radio button menu. The two menu will be connected. When click on one,
+   eatch state will be invert and callback method will be called.
+   @param action1 first action to connect
+   @param action2 second action to connect
+   @param method callback method
+   @param nCheck: 1 : first action will be set true. 2 : second action will be set true
+*/
+#if QT_VERSION < 0x040000
+void G4OpenGLQtViewer::createRadioAction(QAction *action1,QAction *action2, const std::string& method,unsigned int nCheck) {
+
+  if (action1->parent()->inherits("QPopupMenu")){
+    ((QPopupMenu*)action1->parent())->setCheckable(true);
+    ((QPopupMenu*)action2->parent())->setCheckable(true);
+  }
+  action1->setOn(false);
+   action2->setOn(false);
+
+  if (nCheck ==1)
+    action1->setOn(true);
+  else
+    action2->setOn(true);
+   
+  //FIXME : Should not work on Qt3
+  QObject ::connect(action1, SIGNAL(activated()),action2, SLOT(toggle()));
+  QObject ::connect(action2, SIGNAL(activated()),action1, SLOT(toggle()));
+
+  QObject ::connect(action1, SIGNAL(toggled(bool)),this, method.c_str());
+}
+
+#else
+void G4OpenGLQtViewer::createRadioAction(QAction *action1,QAction *action2, const std::string& method,unsigned int nCheck) {
+
+  action1->setCheckable(true);
+  action2->setCheckable(true);
+
+  if (nCheck ==1)
+    action1->setChecked (true);
+  else
+    action2->setChecked (true);
+   
+  QObject ::connect(action1, SIGNAL(triggered(bool)),action2, SLOT(toggle()));
+  QObject ::connect(action2, SIGNAL(triggered(bool)),action1, SLOT(toggle()));
+
+  QObject ::connect(action1, SIGNAL(toggled(bool)),this, method.c_str());
+
+}
+#endif
+
+/**
+   Slot activate when mouseAction->rotate menu is set 
+ */
+void G4OpenGLQtViewer::actionMouseRotate() {
+  emit toggleMouseAction(STYLE1);
+}
+
+
+/**
+   Slot activate when mouseAction->rotate menu is set 
+ */
+void G4OpenGLQtViewer::actionMouseMove() {
+  emit toggleMouseAction(STYLE2);
+}
+
+
+/**
+   Slot activate when mouseAction->zoom menu is set 
+ */
+void G4OpenGLQtViewer::actionMousePick() {
+  emit toggleMouseAction(STYLE3);
+}
+
+
+/**
+   Slot activate when drawing->wireframe menu is set 
+ */
+void G4OpenGLQtViewer::actionDrawingWireframe() {
+  emit toggleDrawingAction(1);
+}
+
+/**
+   Slot activate when drawing->line removal menu is set 
+ */
+void G4OpenGLQtViewer::actionDrawingLineRemoval() {
+  emit toggleDrawingAction(2);
+}
+
+/**
+   Slot activate when drawing->surface removal menu is set 
+ */
+void G4OpenGLQtViewer::actionDrawingSurfaceRemoval() {
+  emit toggleDrawingAction(3);
+}
+
+/**
+   Slot activate when drawing->wireframe menu is set 
+ */
+void G4OpenGLQtViewer::actionDrawingLineSurfaceRemoval() {
+  emit toggleDrawingAction(4);
+}
+
+
+/**
+   Slot activated when mouse action is toggle
+   @param aAction : STYLE1, STYLE2, STYLE3
+ */
+void G4OpenGLQtViewer::toggleMouseAction(mouseActions aAction) {
+  
+  if ((aAction == STYLE1) || //initialize all
+      (aAction == STYLE2) ||
+      (aAction == STYLE3))  {
+#if QT_VERSION < 0x040000
+    fRotateAction->setOn (false);
+    fMoveAction->setOn (false);
+    fPickAction->setOn (false);
+#else
+    fRotateAction->setChecked (false);
+    fMoveAction->setChecked (false);
+    fPickAction->setChecked (false);
+#endif
+    fVP.SetPicking(false);
+    fMouseAction = aAction;
+  }
+  // rotate
+  if (aAction == STYLE1) {  // rotate
+    showShortcuts();
+#if QT_VERSION < 0x040000
+    fRotateAction->setOn (true);
+#else
+    fRotateAction->setChecked (true);
+#endif
+  } else  if (aAction == STYLE2) { //move
+#if QT_VERSION < 0x040000
+    fMoveAction->setOn (true);
+#else
+    fMoveAction->setChecked (true);
+#endif
+  } else  if (aAction == STYLE3) { //pick
+#if QT_VERSION < 0x040000
+    fPickAction->setOn (true);
+#else
+    fPickAction->setChecked (true);
+#endif
+    fVP.SetPicking(true);
+  }
+}
+
+/**
+   Show shortcuts for this mouse action
+ */
+void G4OpenGLQtViewer::showShortcuts() {
+  if (fMouseAction == STYLE1) {  // rotate
+    G4cout << "Click and move mouse to rotate volume " << G4endl;
+    G4cout << "Press left/right arrows to move volume left/right" << G4endl;
+    G4cout << "Press up/down arrows to move volume up/down" << G4endl;
+    G4cout << "Press ALT+up/down arrows to move volume toward/forward" << G4endl;
+    G4cout << "Press SHIFT+left/right arrows to rotate volume left/right" << G4endl;
+    G4cout << "Press SHIFT+up/down arrows to rotate volume up/down" << G4endl;
+    G4cout << "Press ALT+/- to slow/speed auto rotation/move" << G4endl;
+    G4cout << "In video mode : " << G4endl;
+    G4cout << " Press SPACE to Start/Pause video recording " << G4endl;
+    G4cout << " Press RETURN to Stop video recording " << G4endl;
+  } else  if (fMouseAction == STYLE2) { //move
+    G4cout << "Move camera point of view with mouse" << G4endl;
+    G4cout << "Press left/right arrows to move volume left/right" << G4endl;
+    G4cout << "Press up/down arrows to move volume up/down" << G4endl;
+    G4cout << "Press ALT+up/down arrows to move volume toward/forward" << G4endl;
+    G4cout << "Press SHIFT+left/right arrows to rotate volume left/right" << G4endl;
+    G4cout << "Press SHIFT+up/down arrows to rotate volume up/down" << G4endl;
+    G4cout << "Press +/- to zoom into volume" << G4endl;
+    G4cout << "Press ALT+/- to slow/speed auto rotation/move" << G4endl;
+    G4cout << "In video mode : " << G4endl;
+    G4cout << " Press SPACE to Start/Pause video recording " << G4endl;
+    G4cout << " Press RETURN to Stop video recording " << G4endl;
+  } else  if (fMouseAction == STYLE3) { //pick
+    G4cout << "Click and pick " << G4endl;
+  } else {
+    G4cout << "Move camera point of view with mouse" << G4endl;
+    G4cout << "Press left/right arrows to move volume left/right" << G4endl;
+    G4cout << "Press up/down arrows to move volume up/down" << G4endl;
+    G4cout << "Press ALT+up/down arrows to move volume toward/forward" << G4endl;
+    G4cout << "Press SHIFT+left/right arrows to rotate volume left/right" << G4endl;
+    G4cout << "Press SHIFT+up/down arrows to rotate volume up/down" << G4endl;
+    G4cout << "Press +/- to zoom into volume" << G4endl;
+    G4cout << "Press ALT+/- to slow/speed auto rotation/move" << G4endl;
+    G4cout << "In video mode : " << G4endl;
+    G4cout << " Press SPACE to Start/Pause video recording " << G4endl;
+    G4cout << " Press RETURN to Stop video recording " << G4endl;
+  }
+
+}
+
+
+
+/**
+   Slot activated when drawing menu is toggle
+   Warning : When G4OpenGLStoredQtViewer::DrawView() method call,
+   KernelVisitDecision () will be call and will set the fNeedKernelVisit
+   to 1. See G4XXXStoredViewer::CompareForKernelVisit for explanations.
+   It will cause a redraw of the view
+   @param aAction : 1 wireframe, 2 line removal, 3 surface removal, 4 line & surface removal
+   @see G4OpenGLStoredQtViewer::DrawView
+   @see G4XXXStoredViewer::CompareForKernelVisit
+ */
+void G4OpenGLQtViewer::toggleDrawingAction(int aAction) {
+
+  G4ViewParameters::DrawingStyle d_style = G4ViewParameters::wireframe;
+  
+
+  // initialize
+  if ((aAction >0) && (aAction <5)) {
+#if QT_VERSION < 0x040000
+    fDrawingWireframe->setOn(false);
+    fDrawingLineRemoval->setOn(false);
+    fDrawingSurfaceRemoval->setOn(false);
+    fDrawingLineSurfaceRemoval->setOn(false);
+#else
+    fDrawingWireframe->setChecked (false);
+    fDrawingLineRemoval->setChecked (false);
+    fDrawingSurfaceRemoval->setChecked (false);
+    fDrawingLineSurfaceRemoval->setChecked (false);
+#endif
+  }
+  if (aAction ==1) {
+#if QT_VERSION < 0x040000
+    fDrawingWireframe->setOn(true);
+#else
+    fDrawingWireframe->setChecked (true);
+#endif
+
+    d_style = G4ViewParameters::wireframe;
+
+  } else  if (aAction ==2) {
+#if QT_VERSION < 0x040000
+    fDrawingLineRemoval->setOn(true);
+#else
+    fDrawingLineRemoval->setChecked (true);
+#endif
+
+    d_style = G4ViewParameters::hlr;
+
+  } else  if (aAction ==3) {
+#if QT_VERSION < 0x040000
+    fDrawingSurfaceRemoval->setOn(true);
+#else
+    fDrawingSurfaceRemoval->setChecked (true);
+#endif
+
+    d_style = G4ViewParameters::hsr;
+
+  } else  if (aAction ==4) {
+#if QT_VERSION < 0x040000
+    fDrawingLineSurfaceRemoval->setOn(true);
+#else
+    fDrawingLineSurfaceRemoval->setChecked (true);
+#endif
+    d_style = G4ViewParameters::hlhsr;
+  }
+  fVP.SetDrawingStyle(d_style);
+
+  updateQWidget();
+}
+
+
+/**
+   SLOT Activate by a click on the representation menu
+   Warning : When G4OpenGLStoredQtViewer::DrawView() method call,
+   KernelVisitDecision () will be call and will set the fNeedKernelVisit
+   to 1. See G4XXXStoredViewer::CompareForKernelVisit for explanations.
+   It will cause a redraw of the view
+   @param check : 1 polyhedron, 0 nurbs
+   @see G4OpenGLStoredQtViewer::DrawView
+   @see G4XXXStoredViewer::CompareForKernelVisit
+*/
+void G4OpenGLQtViewer::toggleRepresentation(bool check) {
+
+  G4ViewParameters::RepStyle style;
+  if (check == 1) {
+    style = G4ViewParameters::polyhedron;
+  } else {
+    style = G4ViewParameters::nurbs;
+  }
+  fVP.SetRepStyle (style);
+
+  updateQWidget();
+}
+
+/**
+   SLOT Activate by a click on the projection menu
+   Warning : When G4OpenGLStoredQtViewer::DrawView() method call,
+   KernelVisitDecision () will be call and will set the fNeedKernelVisit
+   to 1. See G4XXXStoredViewer::CompareForKernelVisit for explanations.
+   It will cause a redraw of the view
+   @param check : 1 orthographic, 2 perspective
+   @see G4OpenGLStoredQtViewer::DrawView
+   @see G4XXXStoredViewer::CompareForKernelVisit
+*/
+void G4OpenGLQtViewer::toggleProjection(bool check) {
+
+  if (check == 1) {
+    fVP.SetFieldHalfAngle (0);
+  } else {
+
+    // look for the default parameter hidden in G4UIcommand parameters
+    G4UImanager* UI = G4UImanager::GetUIpointer();
+    if(UI==NULL)
+      return;
+    G4UIcommandTree * treeTop = UI->GetTree();
+
+    // find command
+    G4UIcommand* command = treeTop->FindPath("/vis/viewer/set/projection");
+    if (!command)
+      return;
+
+    // find param
+    G4UIparameter * angleParam = NULL;
+    for(G4int i=0;  i<command->GetParameterEntries(); i++)
+    {
+      if( command->GetParameter(i)->GetParameterName() == "field-half-angle" ) {
+        angleParam = command->GetParameter(i);
+      }
+    }
+    if (!angleParam)
+      return;
+
+    // find unit
+    G4UIparameter * unitParam = NULL;
+    for(G4int i=0;  i<command->GetParameterEntries(); i++)
+    {
+      if( command->GetParameter(i)->GetParameterName() == "unit" ) {
+        unitParam = command->GetParameter(i);
+      }
+    }
+    if (!unitParam)
+      return;
+
+    G4double defaultValue = command->ConvertToDouble(angleParam->GetDefaultValue())
+                            * G4UnitDefinition::GetValueOf(unitParam->GetDefaultValue()); 
+    if (defaultValue > 89.5 || defaultValue <= 0.0) {
+      G4cerr << "Field half angle should be 0 < angle <= 89.5 degrees. Check your default Field half angle parameter";
+    } else {
+      G4cout << "Perspective view has been set to default value. Field half angle="<<angleParam->GetDefaultValue() <<" " << G4endl;
+      fVP.SetFieldHalfAngle (defaultValue);
+      SetView ();
+    }
+  }  
+  updateQWidget();
+}
+
+
+/**
+   SLOT Activate by a click on the background menu
+@param check : 1 white, 0 black
+*/
+void G4OpenGLQtViewer::toggleBackground(bool check) {
+
+  //   //I need to revisit the kernel if the background colour changes and
+  //   //hidden line removal is enabled, because hlr drawing utilises the
+  //   //background colour in its drawing...
+  //   // (Note added by JA 13/9/2005) Background now handled in view
+  //   // parameters.  A kernel visit is triggered on change of background.
+  if (check == 1) {
+    ((G4ViewParameters&)this->GetViewParameters()).
+      SetBackgroundColour(G4Colour(1.,1.,1.));  // White
+  } else {
+    ((G4ViewParameters&)this->GetViewParameters()).
+      SetBackgroundColour(G4Colour(0.,0.,0.));  // Black
+  }
+  updateQWidget();
+}
+
+/**
+   SLOT Activate by a click on the transparency menu
+@param check : 1 , 0
+*/
+void G4OpenGLQtViewer::toggleTransparency(bool check) {
+  
+  if (check) {
+    transparency_enabled = false;
+  } else {
+    transparency_enabled = true;
+  }
+  SetNeedKernelVisit (true);
+  updateQWidget();
+}
+
+/**
+   SLOT Activate by a click on the antialiasing menu
+@param check : 1 , 0
+*/
+void G4OpenGLQtViewer::toggleAntialiasing(bool check) {
+
+  if (!check) {
+    antialiasing_enabled = false;
+    glDisable (GL_LINE_SMOOTH);
+    glDisable (GL_POLYGON_SMOOTH);
+  } else {
+    antialiasing_enabled = true;
+    glEnable (GL_LINE_SMOOTH);
+    glHint (GL_LINE_SMOOTH_HINT, GL_NICEST);
+    glEnable (GL_POLYGON_SMOOTH);
+    glHint (GL_POLYGON_SMOOTH_HINT, GL_NICEST);
+  }
+
+  updateQWidget();
+}
+
+/**
+   SLOT Activate by a click on the haloing menu
+@param check : 1 , 0
+*/
+//FIXME : I SEE NOTHING...
+void G4OpenGLQtViewer::toggleHaloing(bool check) {
+  if (check) {
+    haloing_enabled = false;
+  } else {
+    haloing_enabled = true;
+  }
+
+  updateQWidget();
+
+}
+
+/**
+   SLOT Activate by a click on the auxiliaire edges menu
+@param check : 1 , 0
+*/
+void G4OpenGLQtViewer::toggleAux(bool check) {
+  if (check) {
+    fVP.SetAuxEdgeVisible(false);
+  } else {
+    fVP.SetAuxEdgeVisible(true);
+  }
+  SetNeedKernelVisit (true);
+  updateQWidget();
+
+}
+
+/**
+   SLOT Activate by a click on the full screen menu
+*/
+void G4OpenGLQtViewer::toggleFullScreen(bool check) {
+  if (check != fGLWindow->isFullScreen()) { //toggle
+#if QT_VERSION >= 0x030200
+    fGLWindow->setWindowState(fGLWindow->windowState() ^ Qt::WindowFullScreen);
+#else
+    G4cerr << "This version of Qt could not do fullScreen. Resizing the widget is the only solution available." << G4endl;
+#endif
+  }
+}
+
+
+void G4OpenGLQtViewer::savePPMToTemp() {
+  if (fMovieTempFolderPath == "") {
+    return;
+  }
+  QString fileName ="Test"+QString::number(fRecordFrameNumber)+".ppm";
+  QString filePath =fMovieTempFolderPath+fileName;
+
+  QImage image;
+  image = fWindow->grabFrameBuffer();
+  bool res = false;
+  
+#if QT_VERSION < 0x040000
+  res = image.save(filePath,"PPM");
+#else
+  res = image.save(filePath,0);
+#endif
+  if (res == false) { 
+    resetRecording();
+    setRecordingInfos("Can't save tmp file "+filePath);
+    return;
+  }
+  
+  setRecordingInfos("File "+fileName+" saved");
+  fRecordFrameNumber++;
+}
+
+
+
+void G4OpenGLQtViewer::actionSaveImage() {
+  QString filters;
+#if QT_VERSION < 0x040000
+  QStrList listFormat=QImageIO::outputFormats();
+  char *tmp=listFormat.first();
+  while (tmp!=0) {
+    filters += QString(tmp) + ";;";
+    tmp=listFormat.next();
+  }
+#else
+  QList<QByteArray> formats =  QImageWriter::supportedImageFormats ();
+  for (int i = 0; i < formats.size(); ++i) {
+    filters +=formats.at(i) + ";;";
+  }
+#endif
+  filters += "eps;;";
+  filters += "ps;;";
+  filters += "pdf";
+  QString* selectedFormat = new QString();
+  std::string name;
+#if QT_VERSION < 0x040000
+  name =  QFileDialog::getSaveFileName ( ".",
+                                                    filters,
+                                                    fGLWindow,
+                                                    "Save file dialog",
+                                                    tr("Save as ..."),
+                                                    selectedFormat ).ascii(); 
+#else
+  name =  QFileDialog::getSaveFileName ( fGLWindow,
+                                                    tr("Save as ..."),
+                                                    ".",
+                                                    filters,
+                                                    selectedFormat ).toStdString().c_str(); 
+#endif
+  // bmp jpg jpeg png ppm xbm xpm
+  if (name.empty()) {
+    return;
+  }
+#if QT_VERSION < 0x040000
+  name += "." + std::string(selectedFormat->ascii());
+  QString format = selectedFormat->lower();
+#else
+  name += "." + selectedFormat->toStdString();
+  QString format = selectedFormat->toLower();
+#endif
+  setPrintFilename(name.c_str(),0);
+  G4OpenGLQtExportDialog* exportDialog= new G4OpenGLQtExportDialog(fGLWindow,format,fWindow->height(),fWindow->width());
+  if(  exportDialog->exec()) {
+
+    QImage image;
+    bool res = false;
+    if ((exportDialog->getWidth() !=fWindow->width()) ||
+        (exportDialog->getHeight() !=fWindow->height())) {
+      setPrintSize(exportDialog->getWidth(),exportDialog->getHeight());
+      if ((format != QString("eps")) && (format != QString("ps"))) {
+      G4cerr << "Export->Change Size : This function is not implemented, to export in another size, please resize your frame to what you need" << G4endl;
+      
+      //    rescaleImage(exportDialog->getWidth(),exportDialog->getHeight());// re-scale image
+      //      QGLWidget* glResized = fWindow;
+
+      // FIXME :
+      // L.Garnier : I've try to implement change size function, but the problem is 
+      // the renderPixmap function call the QGLWidget to resize and it doesn't draw
+      // the content of this widget... It only draw the background.
+
+      //      fWindow->renderPixmap (exportDialog->getWidth()*2,exportDialog->getHeight()*2,true );
+
+      //      QPixmap pixmap = fWindow->renderPixmap ();
+      
+      //      image = pixmap->toImage();
+      //      glResized->resize(exportDialog->getWidth()*2,exportDialog->getHeight()*2);
+      //      image = glResized->grabFrameBuffer();
+      }      
+    } else {
+      image = fWindow->grabFrameBuffer();
+    }    
+    if (format == QString("eps")) {
+      fVectoredPs = exportDialog->getVectorEPS();
+      printEPS();
+    } else if (format == "ps") {
+      fVectoredPs = true;
+      printEPS();
+    } else if (format == "pdf") {
+
+      res = printPDF(name,exportDialog->getNbColor(),image);
+
+    } else if ((format == "tif") ||
+               (format == "tiff") ||
+               (format == "jpg") ||
+               (format == "jpeg") ||
+               (format == "png") ||
+               (format == "pbm") ||
+               (format == "pgm") ||
+               (format == "ppm") ||
+               (format == "bmp") ||
+               (format == "xbm") ||
+               (format == "xpm")) {
+#if QT_VERSION < 0x040000
+      res = image.save(QString(name.c_str()),selectedFormat->ascii(),exportDialog->getSliderValue());
+#else
+      res = image.save(QString(name.c_str()),0,exportDialog->getSliderValue());
+#endif
+    } else {
+      G4cerr << "This version of G4UI Could not generate the selected format" << G4endl;
+    }
+    if ((format == QString("eps")) && (format == QString("ps"))) {
+      if (res == false) {
+        G4cerr << "Error while saving file... "<<name.c_str()<< G4endl;
+      } else {
+        G4cout << "File "<<name.c_str()<<" has been saved " << G4endl;
+      }
+    }
+    
+  } else { // cancel selected
+    return;
+  }
+  
+}
+
+
+void G4OpenGLQtViewer::actionMovieParameters() {
+  showMovieParametersDialog();
+}
+
+
+void G4OpenGLQtViewer::showMovieParametersDialog() {
+  if (!fMovieParametersDialog) {
+    fMovieParametersDialog= new G4OpenGLQtMovieDialog(this,fGLWindow);
+    displayRecordingStatus();
+    fMovieParametersDialog->checkEncoderSwParameters();
+    fMovieParametersDialog->checkSaveFileNameParameters();
+    fMovieParametersDialog->checkTempFolderParameters();
+    if (getEncoderPath() == "") {
+      setRecordingInfos("mpeg_encode is needed to encode in video format. It is available here: http://bmrc.berkeley.edu/frame/research/mpeg/");
+    }
+  }
+  fMovieParametersDialog->show();
+}
+
+
+/*
+// http://www.google.com/codesearch?hl=en&q=+jpg+Qt+quality+QDialog+show:FZkUoth8oiw:TONpW2mR-_c:tyTfrKMO-xI&sa=N&cd=2&ct=rc&cs_p=http://soft.proindependent.com/src/qtiplot-0.8.9.zip&cs_f=qtiplot-0.8.9/qtiplot/src/application.cpp#a0
+
+void Graph::exportToSVG(const QString& fname)
+{
+  // enable workaround for Qt3 misalignments
+  QwtPainter::setSVGMode(true);
+  QPicture picture;
+  QPainter p(&picture);
+  d_plot->print(&p, d_plot->rect());
+  p.end();
+
+  picture.save(fname, "svg");
+}
+*/
+
+
+
+void G4OpenGLQtViewer::FinishView()
+{
+   glFlush ();
+   fWindow->swapBuffers ();
+}
+
+/**
+   Save the current mouse press point
+   @param p mouse click point
+*/
+void G4OpenGLQtViewer::G4MousePressEvent(QMouseEvent *event)
+{
+#if QT_VERSION < 0x040000
+  if ((event->button() & Qt::LeftButton)
+      && !((event->state() & Qt::ShiftButton)
+           || (event->state() & Qt::ControlButton)
+           || (event->state() & Qt::AltButton)
+           || (event->state() & Qt::MetaButton))) {
+#else
+  if ((event->buttons() & Qt::LeftButton)
+      && !((event->modifiers() & Qt::ShiftModifier)
+           || (event->modifiers() & Qt::ControlModifier)
+           || (event->modifiers() & Qt::AltModifier)
+           || (event->modifiers() & Qt::MetaModifier))) {
+#endif
+    fWindow->setMouseTracking(true);
+    fAutoMove = false; // stop automove
+    fLastPos1 = event->pos();
+    fLastPos2 = fLastPos1;
+    fLastPos3 = fLastPos2;
+    fLastEventTime->start();
+    if (fMouseAction == STYLE3){  // pick
+      Pick(event->pos().x(),event->pos().y());
+    }
+  }
+}
+
+/**
+*/
+void G4OpenGLQtViewer::G4MouseReleaseEvent()
+{
+  fSpinningDelay = fLastEventTime->elapsed();
+  QPoint delta = (fLastPos3-fLastPos1);
+  if ((delta.x() == 0) && (delta.y() == 0)) {
+    return;
+  }
+  if (fSpinningDelay < fLaunchSpinDelay ) {
+    fAutoMove = true;
+    QTime lastMoveTime;
+    lastMoveTime.start();
+    // try to addapt speed move/rotate looking to drawing speed
+    int cycles = 4;
+    while (fAutoMove) {
+      //      if ( lastMoveTime.elapsed() > (fSpinningDelay / (cycles/2))) {
+        if (fMouseAction == STYLE1) {  // rotate
+          rotateQtScene(((float)delta.x())/cycles,((float)delta.y())/cycles);
+        } else if (fMouseAction == STYLE2) {  // move
+          moveScene(-((float)delta.x())/cycles,-((float)delta.y())/cycles,0,true);
+        }
+        lastMoveTime.start();
+        cycles = 1 ;
+      ((QApplication*)G4Qt::getInstance ())->processEvents();
+      cycles ++ ;
+    }
+  }
+  fWindow->setMouseTracking(false);
+
+}
+
+
+void G4OpenGLQtViewer::G4MouseDoubleClickEvent()
+{
+  fWindow->setMouseTracking(true);
+}
+
+
+/**
+   @param pos_x mouse x position
+   @param pos_y mouse y position
+   @param mButtons mouse button active
+   @param mAutoMove true: apply this move till another evnt came, false :one time move
+*/
+
+void G4OpenGLQtViewer::G4MouseMoveEvent(QMouseEvent *event)
+{
+  
+#if QT_VERSION < 0x040000
+  Qt::ButtonState mButtons = event->state();
+#else
+  Qt::MouseButtons mButtons = event->buttons();
+#endif
+
+  if (fAutoMove) {
+    return;
+  }
+
+  fLastPos3 = fLastPos2;
+  fLastPos2 = fLastPos1;
+  fLastPos1 = QPoint(event->x(), event->y());
+
+  int deltaX = fLastPos2.x()-fLastPos1.x();
+  int deltaY = fLastPos2.y()-fLastPos1.y();
+
+  if (fMouseAction == STYLE1) {  // rotate
+    if (mButtons & Qt::LeftButton) {
+      rotateQtScene(deltaX,deltaY);
+    }
+  } else if (fMouseAction == STYLE2) {  // move
+    if (mButtons & Qt::LeftButton) {
+      moveScene(-deltaX,-deltaY,0,true);
+    }
+  }
+
+  fLastEventTime->start();
+}
+
+
+/**
+   Move the scene of dx, dy, dz values.
+   @param dx delta mouse x position
+   @param dy delta mouse y position
+   @param mouseMove : true if even comes from a mouse move, false if even comes from key action
+*/
+
+void G4OpenGLQtViewer::moveScene(float dx,float dy, float dz,bool mouseMove)
+{
+  if (fHoldMoveEvent)
+    return;
+  fHoldMoveEvent = true;
+
+  G4double coefTrans = 0;
+  GLdouble coefDepth = 0;
+  if(mouseMove) {
+    coefTrans = ((G4double)getSceneNearWidth())/((G4double)getWinWidth());
+    if (getWinHeight() <getWinWidth()) {
+      coefTrans = ((G4double)getSceneNearWidth())/((G4double)getWinHeight());
+    }
+  } else {
+    coefTrans = getSceneNearWidth()*fDeltaSceneTranslation;
+    coefDepth = getSceneDepth()*fDeltaDepth;
+  }
+  fVP.IncrementPan(-dx*coefTrans,dy*coefTrans,dz*coefDepth);
+  emit moveX(-dx*coefTrans);
+  emit moveY(dy*coefTrans);
+  emit moveZ(dz*coefTrans);
+  
+  updateQWidget();
+  if (fAutoMove)
+    ((QApplication*)G4Qt::getInstance ())->processEvents();
+  
+  fHoldMoveEvent = false;
+}
+
+
+/**
+   @param dx delta mouse x position
+   @param dy delta mouse y position
+*/
+
+void G4OpenGLQtViewer::rotateQtScene(float dx, float dy)
+{
+  if (fHoldRotateEvent)
+    return;
+  fHoldRotateEvent = true;
+  
+  if( dx != 0) {
+    rotateScene(dx,0,fDeltaRotation);
+    emit rotateTheta(dx);
+  }
+  if( dy != 0) {
+    rotateScene(0,dy,fDeltaRotation);
+    emit rotatePhi(dy);
+  }
+  updateQWidget();
+  
+  fHoldRotateEvent = false;
+}
+
+/**
+   @param dx delta mouse x position
+   @param dy delta mouse y position
+*/
+
+void G4OpenGLQtViewer::rotateQtCamera(float dx, float dy)
+{
+  if (fHoldRotateEvent)
+    return;
+  fHoldRotateEvent = true;
+
+  rotateScene(dx,dy,fDeltaRotation);
+  emit rotateTheta(dx);
+  emit rotatePhi(dy);
+  updateQWidget();
+  
+  fHoldRotateEvent = false;
+}
+
+
+
+
+/** This is the benning of a rescale function. It does nothing for the moment
+    @param aWidth : new width
+    @param aHeight : new height
+*/
+void G4OpenGLQtViewer::rescaleImage(
+ int /* aWidth */
+,int /* aHeight */
+){
+  //  GLfloat* feedback_buffer;
+  //  GLint returned;
+  //  FILE* file;
+  
+//   feedback_buffer = new GLfloat[size];
+//   glFeedbackBuffer (size, GL_3D_COLOR, feedback_buffer);
+//   glRenderMode (GL_FEEDBACK);
+  
+//   DrawView();
+//   returned = glRenderMode (GL_RENDER);
+
+}
+
+
+
+/**
+   Generate Postscript or PDF form image
+   @param aFilename : name of file
+   @param aInColor : numbers of colors : 1->BW 2->RGB
+   @param aImage : Image to print
+*/
+bool G4OpenGLQtViewer::printPDF (
+ const std::string aFilename
+,int aInColor
+,QImage aImage
+)
+{
+
+#if QT_VERSION < 0x040000
+#if defined(Q_WS_MAC) || defined(Q_WS_X11)
+  QPrinter printer;
+  //  printer.setPageSize(pageSize);
+  if (aInColor == 1) {
+    printer.setColorMode(QPrinter::GrayScale);
+  } else {
+    printer.setColorMode(QPrinter::Color);
+  }
+
+  /* FIXME : I don't know which format it will save...
+     if (aFilename.endsWith(".ps")) {
+     printer.setOutputFormat(QPrinter::PostScriptFormat);
+     } else {
+     printer.setOutputFormat(QPrinter::PdfFormat);
+     }
+  */
+  printer.setOutputFileName(aFilename);
+  //  printer.setFullPage ( true);
+  QPainter paint(&printer);
+  paint.drawImage (0,0,aImage );
+  paint.end();
+#else
+  G4cerr << "This fonction is only supported on Mac OsX or X11 with Qt3. Full platform supported with Qt4" << G4endl;
+  // FIXME 
+  // L.Garnier 6 May 2009 : Only to fix compilation warnings
+  if (aFilename.empty()) {
+    aInColor = 0;
+    aImage = 0;
+  }
+  // END_OF FIXME
+#endif
+#else
+  QPrinter printer;
+  //  printer.setPageSize(pageSize);
+
+  // FIXME : L. Garnier 4/12/07
+  // This is not working, it does nothing. Image is staying in color mode
+  // So I have desactivate the B/W button in GUI
+  if ((!aImage.isGrayscale ()) &&(aInColor ==1 )) {
+#if QT_VERSION < 0x040000
+    aImage = aImage.convertDepth(1,Qt::MonoOnly);
+#else
+    aImage = aImage.convertToFormat ( aImage.format(), Qt::MonoOnly);
+#endif
+  }
+
+
+  if (aFilename.substr(aFilename.size()-3) == ".ps") {
+#if QT_VERSION > 0x040200
+    printer.setOutputFormat(QPrinter::PostScriptFormat);
+#endif
+  } else {
+#if QT_VERSION > 0x040100
+    printer.setOutputFormat(QPrinter::PdfFormat);
+#endif
+  }
+#if QT_VERSION > 0x040100
+  printer.setOutputFileName(QString(aFilename.c_str()));
+#endif
+  //  printer.setFullPage ( true);
+  QPainter paint(&printer);
+  paint.drawImage (0,0,aImage);
+  paint.end();
+#endif
+  return true;
+}
+
+
+void G4OpenGLQtViewer::G4wheelEvent (QWheelEvent * event) 
+{
+  fVP.SetZoomFactor(fVP.GetZoomFactor()+(fVP.GetZoomFactor()*(event->delta())/1200)); 
+  updateQWidget();
+}
+
+
+void G4OpenGLQtViewer::G4keyPressEvent (QKeyEvent * event) 
+{
+  if (fHoldKeyEvent)
+    return;
+
+  fHoldKeyEvent = true;
+
+#if QT_VERSION < 0x040000
+  if ((event->key() == Qt::Key_Down) && (event->state() & Qt::AltButton )) { // go backward
+#else
+  if ((event->key() == Qt::Key_Down) && (event->modifiers() & Qt::AltModifier )) { // go backward
+#endif
+    
+    moveScene(0,0,1,false);
+  }
+#if QT_VERSION < 0x040000
+  else if ((event->key() == Qt::Key_Up) && (event->state() & Qt::AltButton)) { // go forward
+#else
+  else if ((event->key() == Qt::Key_Up) && (event->modifiers() & Qt::AltModifier)) { // go forward
+#endif
+    moveScene(0,0,-1,false);
+  }
+#if QT_VERSION < 0x040000
+  if ((event->key() == Qt::Key_Down) && (event->state() & Qt::ShiftButton)) { // rotate phi
+#else
+  if ((event->key() == Qt::Key_Down) && (event->modifiers() & Qt::ShiftModifier)) { // rotate phi
+#endif
+    rotateQtCamera(0,-1);
+  }
+#if QT_VERSION < 0x040000
+  else if ((event->key() == Qt::Key_Up) && (event->state() & Qt::ShiftButton)) { // rotate phi
+#else
+  else if ((event->key() == Qt::Key_Up) && (event->modifiers() & Qt::ShiftModifier)) { // rotate phi
+#endif
+    rotateQtCamera(0,1);
+  }
+#if QT_VERSION < 0x040000
+  if ((event->key() == Qt::Key_Left) && (event->state() & Qt::ShiftButton)) { // rotate theta
+#else
+  if ((event->key() == Qt::Key_Left) && (event->modifiers() & Qt::ShiftModifier)) { // rotate theta
+#endif
+    rotateQtCamera(1,0);
+  }
+#if QT_VERSION < 0x040000
+  else if ((event->key() == Qt::Key_Right) && (event->state() & Qt::ShiftButton)) { // rotate theta
+#else
+  else if ((event->key() == Qt::Key_Right) && (event->modifiers() & Qt::ShiftModifier)) { // rotate theta
+#endif
+    rotateQtCamera(-1,0);
+  }
+
+#if QT_VERSION < 0x040000
+  if ((event->state() & Qt::AltButton)) {
+#else
+  if ((event->modifiers() & Qt::AltModifier)) {
+#endif
+    if (event->key() == Qt::Key_Plus) {
+      fDeltaRotation = fDeltaRotation/0.7;
+    }
+    else if (event->key() == Qt::Key_Minus) {
+      fDeltaRotation = fDeltaRotation*0.7;
+    }
+  } else {
+    if (event->key() == Qt::Key_Plus) {
+      fVP.SetZoomFactor(fVP.GetZoomFactor()*(1+fDeltaZoom)); 
+      updateQWidget();
+    }
+    else if (event->key() == Qt::Key_Minus) {
+      fVP.SetZoomFactor(fVP.GetZoomFactor()*(1-fDeltaZoom)); 
+      updateQWidget();
+    }
+  }
+  
+  
+  if (event->key() == Qt::Key_Escape) { // escaped from full screen
+#if QT_VERSION >= 0x030200
+      toggleFullScreen(false);
+#endif
+  }
+  // several case here : If return is pressed, in every case -> display the movie parameters dialog
+  // If one parameter is wrong -> put it in red (only save filenam could be wrong..)
+  // If encoder not found-> does nothing.Only display a message in status box
+  // If all ok-> generate parameter file
+  // If ok -> put encoder button enabled
+ 
+  if ((event->key() == Qt::Key_Return) || (event->key() == Qt::Key_Enter)){ // end of video
+   stopVideo();
+  }
+  if (event->key() == Qt::Key_Space){ // start/pause of video
+   startPauseVideo();
+  }
+
+  // with no modifiers
+#if QT_VERSION < 0x040000
+  if (event->state() == Qt::NoButton) {
+#else
+  if ((event->modifiers() == Qt::NoModifier) || (event->modifiers() == Qt::KeypadModifier )) {
+#endif
+    if (event->key() == Qt::Key_Down) { // go down
+      moveScene(0,1,0,false);
+    }
+    else if (event->key() == Qt::Key_Up) {  // go up
+      moveScene(0,-1,0,false);
+    }
+    if (event->key() == Qt::Key_Left) { // go left
+      moveScene(-1,0,0,false);
+    }
+    else if (event->key() == Qt::Key_Right) { // go right
+      moveScene(1,0,0,false);
+    }
+  }
+  fHoldKeyEvent = false;
+}
+  
+
+/** Stop the video. Check all parameters and enable encoder button if all is ok.
+*/
+void G4OpenGLQtViewer::stopVideo() {
+
+ // if encoder parameter is wrong, display parameters dialog and return
+  if (!fMovieParametersDialog) {
+    showMovieParametersDialog();
+  }
+  setRecordingStatus(STOP);
+
+  if (fRecordFrameNumber >0) {
+    // check parameters if they were modified (Re APPLY them...)
+    if (!(fMovieParametersDialog->checkEncoderSwParameters())) {
+      setRecordingStatus(BAD_ENCODER);
+    }  else if (!(fMovieParametersDialog->checkSaveFileNameParameters())) {
+      setRecordingStatus(BAD_OUTPUT);
+    }
+  } else {
+    resetRecording();
+    setRecordingInfos("No frame to encode.");
+  }
+}
+
+/** Stop the video. Check all parameters and enable encoder button if all is ok.
+*/
+void G4OpenGLQtViewer::saveVideo() {
+
+  // if encoder parameter is wrong, display parameters dialog and return
+  if (!fMovieParametersDialog) {
+    showMovieParametersDialog();
+  }
+
+  fMovieParametersDialog->checkEncoderSwParameters();
+  fMovieParametersDialog->checkSaveFileNameParameters();
+  
+  if (fRecordingStep == STOP) {
+    setRecordingStatus(SAVE);
+    generateMpegEncoderParameters();
+    encodeVideo();
+  }
+}
+
+
+/** Start/Pause the video..
+*/
+void G4OpenGLQtViewer::startPauseVideo() {
+   
+  // first time, if temp parameter is wrong, display parameters dialog and return
+
+  if (( fRecordingStep == WAIT)) {
+    if ( fRecordFrameNumber == 0) {
+      if (getTempFolderPath() == "") { // BAD_OUTPUT
+        showMovieParametersDialog();
+        setRecordingInfos("You should specified the temp folder in order to make movie");
+        return;
+      } else  {
+        // remove temp folder if it was create
+        QString tmp = removeTempFolder();
+        if (tmp !="") {
+          setRecordingInfos(tmp);
+          return;
+        }
+        tmp = createTempFolder();
+        if (tmp != "") {
+          setRecordingInfos("Can't create temp folder."+tmp);
+          return;
+        }
+      }
+    }
+  }
+  if ((fRecordingStep == WAIT)) {
+    setRecordingStatus(START); 
+  } else if (fRecordingStep == START) {
+    setRecordingStatus(PAUSE);
+  } else if (fRecordingStep == PAUSE) {
+    setRecordingStatus(CONTINUE);
+  } else if (fRecordingStep == CONTINUE) {
+    setRecordingStatus(PAUSE);
+  }
+}
+
+void G4OpenGLQtViewer::setRecordingStatus(RECORDING_STEP step) {
+
+  fRecordingStep = step;
+  displayRecordingStatus();
+}
+
+
+void G4OpenGLQtViewer::displayRecordingStatus() {
+  
+  QString txtStatus = "";
+  if (fRecordingStep == WAIT) {
+    txtStatus  = "Waiting to start...";
+    fRecordFrameNumber = 0; // reset the frame number
+  } else if (fRecordingStep == START) {
+    txtStatus  = "Start Recording...";
+  } else if (fRecordingStep == PAUSE) {
+    txtStatus  = "Pause Recording...";
+  } else if (fRecordingStep == CONTINUE) {
+    txtStatus  = "Continue Recording...";
+  } else if (fRecordingStep == STOP) {
+    txtStatus  = "Stop Recording...";
+  } else if (fRecordingStep == READY_TO_ENCODE) {
+    txtStatus  = "Ready to Encode...";
+  } else if (fRecordingStep == ENCODING) {
+    txtStatus  = "Encoding...";
+  } else if (fRecordingStep == FAILED) {
+    txtStatus  = "Failed to encode...";
+  } else if ((fRecordingStep == BAD_ENCODER)
+         || (fRecordingStep == BAD_OUTPUT)
+             || (fRecordingStep == BAD_TMP)) {
+    txtStatus  = "Correct above errors first";
+  } else if (fRecordingStep == SUCCESS) {
+    txtStatus  = "File encoded successfully";
+  } else {
+  }
+
+  if (fMovieParametersDialog) {
+    fMovieParametersDialog->setRecordingStatus(txtStatus);
+  } else {
+#if QT_VERSION < 0x040000
+    G4cout << txtStatus.ascii() << G4endl;
+#else
+    G4cout << txtStatus.toStdString().c_str() << G4endl;
+#endif
+  }
+  setRecordingInfos("");
+}
+
+
+void G4OpenGLQtViewer::setRecordingInfos(QString txt) {
+  if (fMovieParametersDialog) {
+    fMovieParametersDialog->setRecordingInfos(txt);
+  } else {
+#if QT_VERSION < 0x040000
+    G4cout << txt.ascii() << G4endl;
+#else
+    G4cout << txt.toStdString().c_str() << G4endl;
+#endif
+  }
+}
+
+/** Init the movie parameters. Temp dir and encoder path
+*/
+void G4OpenGLQtViewer::initMovieParameters() {
+  //init encoder
+  
+   //look for encoderPath
+     fProcess = new QProcess();
+     
+#if QT_VERSION < 0x040000
+     QObject ::connect(fProcess,SIGNAL(processExited ()),
+		       this,SLOT(processLookForFinished()));
+     fProcess->setCommunication(QProcess::DupStderr);
+     fProcess->setArguments(QStringList("which mpeg_encode"));
+     fProcess->start();
+#else
+     QObject ::connect(fProcess,SIGNAL(finished ( int)),
+		       this,SLOT(processLookForFinished()));
+     fProcess->setReadChannelMode(QProcess::MergedChannels);
+     fProcess->start ("which mpeg_encode");
+#endif
+  
+}
+
+/** @return encoder path or "" if it does not exist
+ */
+QString G4OpenGLQtViewer::getEncoderPath() {
+  return fEncoderPath;
+}
+ 
+
+/**
+ * set the new encoder path
+ * @return "" if correct. The error otherwise
+*/
+QString G4OpenGLQtViewer::setEncoderPath(QString path) {
+  if (path == "") {
+    return "File does not exist";
+  }
+
+#if QT_VERSION < 0x040000
+  path =  QDir::cleanDirPath(path);
+#else
+  path =  QDir::cleanPath(path);
+#endif
+  QFileInfo *f = new QFileInfo(path);
+  if (!f->exists()) {
+    return "File does not exist";
+  } else if (f->isDir()) {
+    return "This is a directory";
+  } else if (!f->isExecutable()) {
+    return "File exist but is not executable";
+  } else if (!f->isFile()) {
+    return "This is not a file";
+  }
+  fEncoderPath = path;
+
+  if ((fRecordingStep == BAD_ENCODER)) {
+    setRecordingStatus(STOP);
+  } 
+  return "";
+}
+
+
+bool G4OpenGLQtViewer::isRecording(){
+  if ((fRecordingStep == START) || (fRecordingStep == CONTINUE)) {
+    return true;
+  }
+  return false;
+}
+
+bool G4OpenGLQtViewer::isPaused(){
+  if (fRecordingStep == PAUSE) {
+    return true;
+  }
+  return false;
+}
+
+bool G4OpenGLQtViewer::isEncoding(){
+  if (fRecordingStep == ENCODING) {
+    return true;
+  }
+  return false;
+}
+
+bool G4OpenGLQtViewer::isWaiting(){
+  if (fRecordingStep == WAIT) {
+    return true;
+  }
+  return false;
+}
+
+bool G4OpenGLQtViewer::isStopped(){
+  if (fRecordingStep == STOP) {
+    return true;
+  }
+  return false;
+}
+
+bool G4OpenGLQtViewer::isFailed(){
+  if (fRecordingStep == FAILED) {
+    return true;
+  }
+  return false;
+}
+
+bool G4OpenGLQtViewer::isSuccess(){
+  if (fRecordingStep == SUCCESS) {
+    return true;
+  }
+  return false;
+}
+
+bool G4OpenGLQtViewer::isBadEncoder(){
+  if (fRecordingStep == BAD_ENCODER) {
+    return true;
+  }
+  return false;
+}
+bool G4OpenGLQtViewer::isBadTmp(){
+  if (fRecordingStep == BAD_TMP) {
+    return true;
+  }
+  return false;
+}
+bool G4OpenGLQtViewer::isBadOutput(){
+  if (fRecordingStep == BAD_OUTPUT) {
+    return true;
+  }
+  return false;
+}
+
+void G4OpenGLQtViewer::setBadEncoder(){
+  fRecordingStep = BAD_ENCODER;
+  displayRecordingStatus();
+}
+void G4OpenGLQtViewer::setBadTmp(){
+  fRecordingStep = BAD_TMP;
+  displayRecordingStatus();
+}
+void G4OpenGLQtViewer::setBadOutput(){
+  fRecordingStep = BAD_OUTPUT;
+  displayRecordingStatus();
+}
+
+void G4OpenGLQtViewer::setWaiting(){
+  fRecordingStep = WAIT;
+  displayRecordingStatus();
+}
+
+
+bool G4OpenGLQtViewer::isReadyToEncode(){
+  if (fRecordingStep == READY_TO_ENCODE) {
+    return true;
+  }
+  return false;
+}
+
+void G4OpenGLQtViewer::resetRecording() {
+    setRecordingStatus(WAIT);
+}
+
+/**
+ * set the temp folder path
+ * @return "" if correct. The error otherwise
+*/
+QString G4OpenGLQtViewer::setTempFolderPath(QString path) {
+
+  if (path == "") {
+    return "Path does not exist";
+  }
+#if QT_VERSION < 0x040000
+  path =  QDir::cleanDirPath(path);
+#else
+  path =  QDir::cleanPath(path);
+#endif
+  QFileInfo *d = new QFileInfo(path);
+  if (!d->exists()) {
+    return "Path does not exist";
+  } else if (!d->isDir()) {
+    return "This is not a directory";
+  } else if (!d->isReadable()) {
+    return path +" is read protected";
+  } else if (!d->isWritable()) {
+    return path +" is write protected";
+  }
+  
+  if ((fRecordingStep == BAD_TMP)) {
+    setRecordingStatus(WAIT); 
+  }
+  fTempFolderPath = path;
+  return "";
+}
+
+/** @return the temp folder path or "" if it does not exist
+ */
+QString G4OpenGLQtViewer::getTempFolderPath() {
+  return fTempFolderPath;
+}
+ 
+/**
+ * set the save file name path
+ * @return "" if correct. The error otherwise
+*/
+QString G4OpenGLQtViewer::setSaveFileName(QString path) {
+
+  if (path == "") {
+    return "Path does not exist";
+  }
+  
+  QFileInfo *file = new QFileInfo(path);
+  QDir dir = file->dir();
+#if QT_VERSION < 0x040000
+  path =  QDir::cleanDirPath(path);
+#else
+  path =  QDir::cleanPath(path);
+#endif
+  if (file->exists()) {
+    return "File already exist, please choose a new one";
+  } else if (!dir.exists()) {
+    return "Dir does not exist";
+  } else if (!dir.isReadable()) {
+    return path +" is read protected";
+  }
+  
+  if ((fRecordingStep == BAD_OUTPUT)) {
+    setRecordingStatus(STOP); 
+  }
+  fSaveFileName = path;
+  return "";
+}
+
+/** @return the save file path
+ */
+QString G4OpenGLQtViewer::getSaveFileName() {
+  return fSaveFileName ;
+}
+
+/** Create a Qt_temp folder in the temp folder given
+* The temp folder will be like this /tmp/QtMovie_12-02-2008_12_12_58/
+* @return "" if success. Error message if not.
+*/
+QString G4OpenGLQtViewer::createTempFolder() {
+  fMovieTempFolderPath = "";
+  //check
+  QString tmp = setTempFolderPath(fTempFolderPath);
+  if (tmp != "") {
+    return tmp;
+  }
+#if QT_VERSION < 0x040000
+  QString sep = QChar(QDir::separator());
+#else
+  QString sep = QString(QDir::separator());
+#endif
+  QString path = sep+"QtMovie_"+QDateTime::currentDateTime ().toString("dd-MM-yyyy_hh-mm-ss")+sep; 
+#if QT_VERSION < 0x040000
+  QDir *d = new QDir(QDir::cleanDirPath(fTempFolderPath));
+#else
+  QDir *d = new QDir(QDir::cleanPath(fTempFolderPath));
+#endif
+  // check if it is already present
+  if (d->exists(path)) {
+    return "Folder "+path+" already exists.Please remove it first";
+  }
+  if (d->mkdir(fTempFolderPath+path)) {
+    fMovieTempFolderPath = fTempFolderPath+path;
+    return "";
+  } else {
+    return "Can't create "+fTempFolderPath+path;
+  }
+  return "-";
+}
+
+/** Remove the Qt_temp folder in the temp folder
+*/
+QString G4OpenGLQtViewer::removeTempFolder() {
+	// remove files in Qt_temp folder
+  if (fMovieTempFolderPath == "") {
+    return "";
+  }
+#if QT_VERSION < 0x040000
+  QDir *d = new QDir(QDir::cleanDirPath(fMovieTempFolderPath));
+#else
+  QDir *d = new QDir(QDir::cleanPath(fMovieTempFolderPath));
+#endif
+  if (!d->exists()) {
+    return "";  // already remove
+  }
+
+  d->setFilter( QDir::Files );
+  QStringList subDirList = d->entryList();
+  int res = true;
+  QString error = "";
+  for (QStringList::ConstIterator it = subDirList.begin() ;(it != subDirList.end()) ; it++) {
+    const QString currentFile = *it;
+      if (!d->remove(currentFile)) {
+        res = false;
+        QString file = fMovieTempFolderPath+currentFile;
+        error +="Removing file failed : "+file;
+      } else {
+      }
+  }
+  if (res) {
+    if (d->rmdir(fMovieTempFolderPath)) {
+      fMovieTempFolderPath = "";
+      return "";
+    } else {
+      return "Dir "+fMovieTempFolderPath+" should be empty, but could not remove it";
+    }
+
+  }
+  return "Could not remove "+fMovieTempFolderPath+" because of the following errors :"+error;
+}
+
+
+
+bool G4OpenGLQtViewer::hasPendingEvents () {
+  return ((QApplication*)G4Qt::getInstance ())->hasPendingEvents ();
+}
+
+bool G4OpenGLQtViewer::generateMpegEncoderParameters () {
+
+		// save the parameter file
+  FILE* fp;
+#if QT_VERSION < 0x040000
+  fp = fopen (QString(fMovieTempFolderPath+fParameterFileName).ascii(), "w");
+#else
+  fp = fopen (QString(fMovieTempFolderPath+fParameterFileName).toStdString().c_str(), "w");
+#endif
+
+  if (fp == NULL) {
+    setRecordingInfos("Generation of parameter file failed");
+    return false;
+  }
+
+  fprintf (fp,"# parameter file template with lots of comments to assist you\n");
+  fprintf (fp,"#\n");
+  fprintf (fp,"# you can use this as a template, copying it to a separate file then modifying\n");
+  fprintf (fp,"# the copy\n");
+  fprintf (fp,"#\n");
+  fprintf (fp,"#\n");
+  fprintf (fp,"# any line beginning with '#' is a comment\n");
+  fprintf (fp,"#\n");
+  fprintf (fp,"# no line should be longer than 255 characters\n");
+  fprintf (fp,"#\n");
+  fprintf (fp,"#\n");
+  fprintf (fp,"# general format of each line is:\n");
+  fprintf (fp,"#	  \n");
+  fprintf (fp,"#\n");
+  fprintf (fp,"# lines can generally be in any order\n");
+  fprintf (fp,"#\n");
+  fprintf (fp,"# an exception is the option 'INPUT' which must be followed by input\n");
+  fprintf (fp,"# files in the order in which they must appear, followed by 'END_INPUT'\n");
+  fprintf (fp,"#\n");
+  fprintf (fp,"# Also, if you use the `command` method of generating input file names,\n");
+  fprintf (fp,"# the command will only be executed in the INPUT_DIR if INPUT_DIR preceeds\n");
+  fprintf (fp,"# the INPUT parameter.\n");
+  fprintf (fp,"#\n");
+  fprintf (fp,"#  MUST be in UPPER CASE\n");
+  fprintf (fp,"#\n");
+  fprintf (fp,"\n");
+  fprintf (fp,"# Pattern affects speed, quality and compression. See the User's Guide\n");
+  fprintf (fp,"# for more info.\n");
+  fprintf (fp,"\n");
+  fprintf (fp,"PATTERN		IBBPBBPBBPBBPBBP\n");
+#if QT_VERSION < 0x040000
+  fprintf (fp,"OUTPUT		%s\n",getSaveFileName().ascii());
+#else
+  fprintf (fp,"OUTPUT		%s\n",getSaveFileName().toStdString().c_str());
+#endif
+  fprintf (fp,"\n");
+  fprintf (fp,"# mpeg_encode really only accepts 3 different file formats, but using a\n");
+  fprintf (fp,"# conversion statement it can effectively handle ANY file format\n");
+  fprintf (fp,"#\n");
+  fprintf (fp,"# You must specify the type of the input files.  The choices are:\n");
+  fprintf (fp,"#    YUV, PPM, JMOVIE, Y, JPEG, PNM\n");
+  fprintf (fp,"#	(must be upper case)\n");
+  fprintf (fp,"#\n");
+  fprintf (fp,"BASE_FILE_FORMAT	PPM\n");
+  fprintf (fp,"\n");
+  fprintf (fp,"#\n");
+  fprintf (fp,"# if YUV format (or using parallel version), must provide width and height\n");
+  fprintf (fp,"# YUV_SIZE	widthxheight\n");
+  fprintf (fp,"# this option is ignored if BASE_FILE_FORMAT is not YUV and you're running\n");
+  fprintf (fp,"# on just one machine\n");
+  fprintf (fp,"#\n");
+  fprintf (fp,"YUV_SIZE	352x240\n");
+  fprintf (fp,"\n");
+  fprintf (fp,"# If you are using YUV, there are different supported file formats.\n");
+  fprintf (fp,"# EYUV or UCB are the same as previous versions of this encoder.\n");
+  fprintf (fp,"# (All the Y's, then U's then V's, in 4:2:0 subsampling.)\n");
+  fprintf (fp,"# Other formats, such as Abekas, Phillips, or a general format are\n");
+  fprintf (fp,"# permissible, the general format is a string of Y's, U's, and V's\n");
+  fprintf (fp,"# to specify the file order.\n");
+  fprintf (fp,"\n");
+  fprintf (fp,"INPUT_FORMAT UCB\n");
+  fprintf (fp,"\n");
+  fprintf (fp,"# the conversion statement\n");
+  fprintf (fp,"#\n");
+  fprintf (fp,"# Each occurrence of '*' will be replaced by the input file\n");
+  fprintf (fp,"#\n");
+  fprintf (fp,"# e.g., if you have a bunch of GIF files, then this might be:\n");
+  fprintf (fp,"#	INPUT_CONVERT	giftoppm *\n");
+  fprintf (fp,"#\n");
+  fprintf (fp,"# e.g., if you have a bunch of files like a.Y a.U a.V, etc., then:\n");
+  fprintf (fp,"#	INPUT_CONVERT	cat *.Y *.U *.V\n");
+  fprintf (fp,"#\n");
+  fprintf (fp,"# e.g., if you are grabbing from laser disc you might have something like\n");
+  fprintf (fp,"#	INPUT_CONVERT	goto frame *; grabppm\n");
+  fprintf (fp,"# 'INPUT_CONVERT *' means the files are already in the base file format\n");
+  fprintf (fp,"#\n");
+  fprintf (fp,"INPUT_CONVERT	* \n");
+  fprintf (fp,"\n");
+  fprintf (fp,"# number of frames in a GOP.\n");
+  fprintf (fp,"#\n");
+  fprintf (fp,"# since each GOP must have at least one I-frame, the encoder will find the\n");
+  fprintf (fp,"# the first I-frame after GOP_SIZE frames to start the next GOP\n");
+  fprintf (fp,"#\n");
+  fprintf (fp,"# later, will add more flexible GOP signalling\n");
+  fprintf (fp,"#\n");
+  fprintf (fp,"GOP_SIZE	16\n");
+  fprintf (fp,"\n");
+  fprintf (fp,"# number of slices in a frame\n");
+  fprintf (fp,"#\n");
+  fprintf (fp,"# 1 is a good number.  another possibility is the number of macroblock rows\n");
+  fprintf (fp,"# (which is the height divided by 16)\n");
+  fprintf (fp,"#\n");
+  fprintf (fp,"SLICES_PER_FRAME	1\n");
+  fprintf (fp,"\n");
+  fprintf (fp,"# directory to get all input files from (makes this file easier to read)\n");
+#if QT_VERSION < 0x040000
+  fprintf (fp,"INPUT_DIR	%s\n",fMovieTempFolderPath.ascii());
+#else
+  fprintf (fp,"INPUT_DIR	%s\n",fMovieTempFolderPath.toStdString().c_str());
+#endif
+  fprintf (fp,"\n");
+  fprintf (fp,"# There are a bunch of ways to specify the input files.\n");
+  fprintf (fp,"# from a simple one-per-line listing, to the following \n");
+  fprintf (fp,"# way of numbering them.  See the manual for more information.\n");
+  fprintf (fp,"INPUT\n");
+  fprintf (fp,"# '*' is replaced by the numbers 01, 02, 03, 04\n");
+  fprintf (fp,"# if I instead do [01-11], it would be 01, 02, ..., 09, 10, 11\n");
+  fprintf (fp,"# if I instead do [1-11], it would be 1, 2, 3, ..., 9, 10, 11\n");
+  fprintf (fp,"# if I instead do [1-11+3], it would be 1, 4, 7, 10\n");
+  fprintf (fp,"# the program assumes none of your input files has a name ending in ']'\n");
+  fprintf (fp,"# if you do, too bad!!!\n");
+  fprintf (fp,"#\n");
+  fprintf (fp,"#\n");
+  fprintf (fp,"Test*.ppm	[0-%d]\n",fRecordFrameNumber-1);
+  fprintf (fp,"# can have more files here if you want...there is no limit on the number\n");
+  fprintf (fp,"# of files\n");
+  fprintf (fp,"END_INPUT\n");
+  fprintf (fp,"\n");
+  fprintf (fp,"\n");
+  fprintf (fp,"\n");
+  fprintf (fp,"# Many of the remaining options have to do with the motion search and qscale\n");
+  fprintf (fp,"\n");
+  fprintf (fp,"# FULL or HALF -- must be upper case\n");
+  fprintf (fp,"# Should be FULL for computer generated images\n");
+  fprintf (fp,"PIXEL		FULL\n");
+  fprintf (fp,"\n");
+  fprintf (fp,"# means +/- this many pixels for both P and B frame searches\n");
+  fprintf (fp,"# specify two numbers if you wish to serc different ranges in the two.\n");
+  fprintf (fp,"RANGE		10\n");
+  fprintf (fp,"\n");
+  fprintf (fp,"# The two search algorithm parameters below mostly affect speed,\n");
+  fprintf (fp,"# with some affect on compression and almost none on quality.\n");
+  fprintf (fp,"\n");
+  fprintf (fp,"# this must be one of {EXHAUSTIVE, SUBSAMPLE, LOGARITHMIC}\n");
+  fprintf (fp,"PSEARCH_ALG	LOGARITHMIC\n");
+  fprintf (fp,"\n");
+  fprintf (fp,"# this must be one of {SIMPLE, CROSS2, EXHAUSTIVE}\n");
+  fprintf (fp,"#\n");
+  fprintf (fp,"# note that EXHAUSTIVE is really, really, really slow\n");
+  fprintf (fp,"#\n");
+  fprintf (fp,"BSEARCH_ALG	SIMPLE\n");
+  fprintf (fp,"\n");
+  fprintf (fp,"#\n");
+  fprintf (fp,"# these specify the q-scale for I, P, and B frames\n");
+  fprintf (fp,"# (values must be between 1 and 31)\n");
+  fprintf (fp,"# These are the Qscale values for the entire frame in variable bit-rate\n");
+  fprintf (fp,"# mode, and starting points (but not important) for constant bit rate\n");
+  fprintf (fp,"#\n");
+  fprintf (fp,"\n");
+  fprintf (fp,"# Qscale (Quantization scale) affects quality and compression,\n");
+  fprintf (fp,"# but has very little effect on speed.\n");
+  fprintf (fp,"\n");
+  fprintf (fp,"IQSCALE		4\n");
+  fprintf (fp,"PQSCALE		5\n");
+  fprintf (fp,"BQSCALE		12\n");
+  fprintf (fp,"\n");
+  fprintf (fp,"# this must be ORIGINAL or DECODED\n");
+  fprintf (fp,"REFERENCE_FRAME	ORIGINAL\n");
+  fprintf (fp,"\n");
+  fprintf (fp,"# for parallel parameters see parallel.param in the exmaples subdirectory\n");
+  fprintf (fp,"\n");
+  fprintf (fp,"# if you want constant bit-rate mode, specify it as follows (number is bits/sec):\n");
+  fprintf (fp,"#BIT_RATE  1000000\n");
+  fprintf (fp,"\n");
+  fprintf (fp,"# To specify the buffer size (327680 is default, measused in bits, for 16bit words)\n");
+  fprintf (fp,"BUFFER_SIZE 327680\n");
+  fprintf (fp,"\n");
+  fprintf (fp,"# The frame rate is the number of frames/second (legal values:\n");
+  fprintf (fp,"# 23.976, 24, 25, 29.97, 30, 50 ,59.94, 60\n");
+  fprintf (fp,"FRAME_RATE 30\n");
+  fprintf (fp,"\n");
+  fprintf (fp,"# There are many more options, see the users manual for examples....\n");
+  fprintf (fp,"# ASPECT_RATIO, USER_DATA, GAMMA, IQTABLE, etc.\n");
+  fprintf (fp,"\n");
+  fprintf (fp,"\n");
+  fclose (fp);
+
+  setRecordingInfos("Parameter file "+fParameterFileName+" generated in "+fMovieTempFolderPath);
+  setRecordingStatus(READY_TO_ENCODE);
+  return true;
+}
+
+void G4OpenGLQtViewer::encodeVideo()
+{
+  if ((getEncoderPath() != "") && (getSaveFileName() != "")) {
+    setRecordingStatus(ENCODING);
+    
+#if QT_VERSION < 0x040000
+    QStringList args = QStringList(fEncoderPath);
+    args.push_back(fMovieTempFolderPath+fParameterFileName);
+    fProcess = new QProcess(args);
+    QObject ::connect(fProcess,SIGNAL(processExited ()),
+                      this,SLOT(processEncodeFinished()));
+    QObject ::connect(fProcess,SIGNAL(readyReadStdout ()),
+                      this,SLOT(processEncodeStdout()));
+    fProcess->setCommunication(QProcess::DupStderr);
+    fProcess->launch("");
+#else
+    fProcess = new QProcess();
+#if QT_VERSION > 0x040100
+    QObject ::connect(fProcess,SIGNAL(finished ( int,QProcess::ExitStatus)),
+                      this,SLOT(processEncodeFinished()));
+    QObject ::connect(fProcess,SIGNAL(readyReadStandardOutput ()),
+                      this,SLOT(processEncodeStdout()));
+#else
+    QObject ::connect(fProcess,SIGNAL(finished ( int)),
+                      this,SLOT(processEncodeFinished()));
+    QObject ::connect(fProcess,SIGNAL(readyReadStandardOutput ()),
+                      this,SLOT(processEncodeStdout()));
+#endif
+    fProcess->setReadChannelMode(QProcess::MergedChannels);
+    fProcess->start (fEncoderPath, QStringList(fMovieTempFolderPath+fParameterFileName));
+#endif
+  }
+}
+
+
+// FIXME : does not work on Qt3
+void G4OpenGLQtViewer::processEncodeStdout()
+{
+#if QT_VERSION > 0x040000
+  QString tmp = fProcess->readAllStandardOutput ().data();
+  int start = tmp.lastIndexOf("ESTIMATED TIME");
+  tmp = tmp.mid(start,tmp.indexOf("\n",start)-start);
+#else
+  QString tmp = fProcess->readStdout ().data();
+  int start = tmp.findRev("ESTIMATED TIME");
+  tmp = tmp.mid(start,tmp.find("\n",start)-start);
+#endif
+  setRecordingInfos(tmp);
+}
+
+
+void G4OpenGLQtViewer::processEncodeFinished()
+{
+
+  QString txt = "";
+  txt = getProcessErrorMsg();
+  if (txt == "") {
+    setRecordingStatus(SUCCESS);
+  } else {
+    setRecordingStatus(FAILED);
+  }
+  //  setRecordingInfos(txt+removeTempFolder());
+}
+
+
+void G4OpenGLQtViewer::processLookForFinished() 
+ {
+
+  QString txt = getProcessErrorMsg();
+  if (txt != "") {
+    fEncoderPath = "";
+  } else {
+#if QT_VERSION > 0x040000
+    fEncoderPath = QString(fProcess->readAllStandardOutput ().data()).trimmed();
+#else
+    fEncoderPath = QString(fProcess->readStdout ().data()).simplifyWhiteSpace();
+#endif
+    // if not found, return "not found"
+    if (fEncoderPath.contains(" ")) {
+      fEncoderPath = "";
+    } else if (!fEncoderPath.contains("mpeg_encode")) {
+      fEncoderPath = "";
+    }
+    setEncoderPath(fEncoderPath);
+  }
+  // init temp folder
+#if QT_VERSION > 0x040000
+  setTempFolderPath(QDir::temp ().absolutePath ());
+#else
+  // Let's have a try
+  setTempFolderPath("/tmp/");
+#endif
+}
+
+
+QString G4OpenGLQtViewer::getProcessErrorMsg()
+{
+  QString txt = "";
+#if QT_VERSION < 0x040000
+  if (!fProcess->normalExit ()) {
+    txt = "Exist status "+ fProcess->exitStatus ();
+  }
+#else
+  if (fProcess->exitCode() != 0) {
+    switch (fProcess->error()) {
+    case QProcess::FailedToStart:
+      txt = "The process failed to start. Either the invoked program is missing, or you may have insufficient permissions to invoke the program.\n";
+      break;
+    case QProcess::Crashed:
+      txt = "The process crashed some time after starting successfully.\n";
+      break;
+    case QProcess::Timedout:
+      txt = "The last waitFor...() function timed out. The state of QProcess is unchanged, and you can try calling waitFor...() again.\n";
+      break;
+    case QProcess::WriteError:
+      txt = "An error occurred when attempting to write to the process. For example, the process may not be running, or it may have closed its input channel.\n";
+      break;
+    case QProcess::ReadError:
+      txt = "An error occurred when attempting to read from the process. For example, the process may not be running.\n";
+      break;
+    case QProcess::UnknownError:
+      txt = "An unknown error occurred. This is the default return value of error().\n";
+      break;
+    }
+  }
+#endif
+   return txt;
+}
+
+/*
+  
+void MultiLayer::exportToSVG(const QString& fname)
+{
+  QPicture picture;
+  QPainter p(&picture);
+  for (int i=0;i<(int)graphsList->count();i++)
+    {
+      Graph *gr=(Graph *)graphsList->at(i);
+      Plot *myPlot= (Plot *)gr->plotWidget();
+      
+      QPoint pos=gr->pos();
+      
+      int width=int(myPlot->frameGeometry().width());
+      int height=int(myPlot->frameGeometry().height());
+      
+      myPlot->print(&p, QRect(pos,QSize(width,height)));
+    }
+  
+  p.end();
+  picture.save(fname, "svg");
+}
+*/
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLSceneHandler.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLSceneHandler.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLSceneHandler.cc	(revision 1102)
@@ -0,0 +1,853 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLSceneHandler.cc,v 1.55 2009/03/03 14:51:29 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Andrew Walkden  27th March 1996
+// OpenGL stored scene - creates OpenGL display lists.
+// OpenGL immediate scene - draws immediately to buffer
+//                           (saving space on server).
+
+#ifdef G4VIS_BUILD_OPENGL_DRIVER
+
+// Included here - problems with HP compiler if not before other includes?
+#include "G4NURBS.hh"
+
+// Here follows a special for Mesa, the OpenGL emulator.  Does not affect
+// other OpenGL's, as far as I'm aware.   John Allison 18/9/96.
+#define CENTERLINE_CLPP  /* CenterLine C++ workaround: */
+// Also seems to be required for HP's CC and AIX xlC, at least.
+
+#include "G4OpenGLSceneHandler.hh"
+#include "G4OpenGLViewer.hh"
+#include "G4OpenGLFontBaseStore.hh"
+#include "G4OpenGLTransform3D.hh"
+#include "G4Point3D.hh"
+#include "G4Normal3D.hh"
+#include "G4Transform3D.hh"
+#include "G4Polyline.hh"
+#include "G4Polymarker.hh"
+#include "G4Text.hh"
+#include "G4Circle.hh"
+#include "G4Square.hh"
+#include "G4VMarker.hh"
+#include "G4Polyhedron.hh"
+#include "G4VisAttributes.hh"
+#include "G4PhysicalVolumeModel.hh"
+#include "G4VPhysicalVolume.hh"
+#include "G4LogicalVolume.hh"
+#include "G4VSolid.hh"
+#include "G4Scene.hh"
+#include "G4VisExtent.hh"
+#include "G4AttHolder.hh"
+
+G4OpenGLSceneHandler::G4OpenGLSceneHandler (G4VGraphicsSystem& system,
+			      G4int id,
+			      const G4String& name):
+  G4VSceneHandler (system, id, name),
+  fPickName(0),
+  fProcessing2D (false),
+  fProcessingPolymarker(false)
+{
+#ifdef G4DEBUG_VIS_OGL
+  printf("INIT G4OpenGLSceneHandler (after G4OpenGLSceneHandler G4VSceneHandler (system, id, name)\n");
+#endif
+}
+
+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
+};
+
+void G4OpenGLSceneHandler::ClearAndDestroyAtts()
+{
+  std::map<GLuint, G4AttHolder*>::iterator i;
+  for (i = fPickMap.begin(); i != fPickMap.end(); ++i) delete i->second;
+  fPickMap.clear();
+}
+
+void G4OpenGLSceneHandler::PreAddSolid
+(const G4Transform3D& objectTransformation,
+ const G4VisAttributes& visAttribs)
+{
+  G4VSceneHandler::PreAddSolid (objectTransformation, visAttribs);
+}
+
+void G4OpenGLSceneHandler::BeginPrimitives
+(const G4Transform3D& objectTransformation)
+{
+  G4VSceneHandler::BeginPrimitives (objectTransformation);
+}
+
+void G4OpenGLSceneHandler::EndPrimitives ()
+{
+  G4VSceneHandler::EndPrimitives ();
+}
+
+void G4OpenGLSceneHandler::BeginPrimitives2D
+(const G4Transform3D& objectTransformation)
+{
+  G4VSceneHandler::BeginPrimitives2D (objectTransformation);
+  fProcessing2D = true;
+}
+
+void G4OpenGLSceneHandler::EndPrimitives2D ()
+{
+  fProcessing2D = false;
+  G4VSceneHandler::EndPrimitives2D ();
+}
+
+const G4Polyhedron* G4OpenGLSceneHandler::CreateSectionPolyhedron ()
+{
+  // Clipping done in G4OpenGLViewer::SetView.
+  return 0;
+
+  // But...OpenGL no longer seems to reconstruct clipped edges, so,
+  // when the BooleanProcessor is up to it, abandon this and use
+  // generic clipping in G4VSceneHandler::CreateSectionPolyhedron...
+  // return G4VSceneHandler::CreateSectionPolyhedron();
+}
+
+const G4Polyhedron* G4OpenGLSceneHandler::CreateCutawayPolyhedron ()
+{
+  // Cutaway done in G4OpenGLViewer::SetView.
+  return 0;
+
+  // But...if not, when the BooleanProcessor is up to it...
+  // return G4VSceneHandler::CreateCutawayPolyhedron();
+}
+
+void G4OpenGLSceneHandler::AddPrimitive (const G4Polyline& line)
+{
+  G4int nPoints = line.size ();
+  if (nPoints <= 0) return;
+
+  // Loads G4Atts for picking...
+  if (fpViewer->GetViewParameters().IsPicking()) {
+    G4AttHolder* holder = new G4AttHolder;
+    LoadAtts(line, holder);
+    fPickMap[fPickName] = holder;
+  }
+
+  // Note: colour treated in sub-class.
+
+  if (fpViewer -> GetViewParameters ().IsMarkerNotHidden ())
+    glDisable (GL_DEPTH_TEST);
+  else {glEnable (GL_DEPTH_TEST); glDepthFunc (GL_LESS);}
+
+  glDisable (GL_LIGHTING);
+
+  // Get vis attributes - pick up defaults if none.
+  const G4VisAttributes* pVA =
+    fpViewer -> GetApplicableVisAttributes (line.GetVisAttributes ());
+
+  G4double lineWidth = GetLineWidth(pVA);
+  glLineWidth(lineWidth);
+
+  glBegin (GL_LINE_STRIP);
+  for (G4int iPoint = 0; iPoint < nPoints; iPoint++) {
+  G4double x, y, z;
+    x = line[iPoint].x(); 
+    y = line[iPoint].y();
+    z = line[iPoint].z();
+    glVertex3d (x, y, z);
+  }
+  glEnd ();
+}
+
+void G4OpenGLSceneHandler::AddPrimitive (const G4Polymarker& polymarker)
+{
+  G4int nPoints = polymarker.size ();
+  if (nPoints <= 0) return;
+
+  fProcessingPolymarker = true;
+
+  // Loads G4Atts for picking...
+  if (fpViewer->GetViewParameters().IsPicking()) {
+    G4AttHolder* holder = new G4AttHolder;
+    LoadAtts(polymarker, holder);
+    fPickMap[fPickName] = holder;
+  }
+
+  switch (polymarker.GetMarkerType()) {
+  default:
+  case G4Polymarker::dots:
+    {
+      for (size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
+        G4Circle dot (polymarker);
+        dot.SetPosition (polymarker[iPoint]);
+        dot.SetWorldSize  (0.);
+        dot.SetScreenSize (0.1);  // Very small circle.
+        G4OpenGLSceneHandler::AddPrimitive (dot);
+      }
+    }
+    break;
+  case G4Polymarker::circles:
+    {
+      for (size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
+        G4Circle circle (polymarker);
+        circle.SetPosition (polymarker[iPoint]);
+        G4OpenGLSceneHandler::AddPrimitive (circle);
+      }
+    }
+    break;
+  case G4Polymarker::squares:
+    {
+      for (size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
+        G4Square square (polymarker);
+        square.SetPosition (polymarker[iPoint]);
+        G4OpenGLSceneHandler::AddPrimitive (square);
+      }
+    }
+    break;
+  }
+
+  fProcessingPolymarker = false;
+}
+
+void G4OpenGLSceneHandler::AddPrimitive (const G4Text& text) {
+
+  // Loads G4Atts for picking...
+  if (fpViewer->GetViewParameters().IsPicking()) {
+    G4AttHolder* holder = new G4AttHolder;
+    LoadAtts(text, holder);
+    fPickMap[fPickName] = holder;
+  }
+
+  const G4Colour& c = GetTextColour (text);  // Picks up default if none.
+  MarkerSizeType sizeType;
+  G4double size = GetMarkerSize (text, sizeType);
+  G4ThreeVector position (text.GetPosition ());
+  G4String textString = text.GetText();
+
+  G4int font_base = G4OpenGLFontBaseStore::GetFontBase(fpViewer,size);
+  if (font_base < 0) {
+    static G4int callCount = 0;
+    ++callCount;
+    if (callCount <= 10 || callCount%100 == 0) {
+      G4cout <<
+	"G4OpenGLSceneHandler::AddPrimitive (const G4Text&) call count "
+	     << callCount <<
+	"\n  No fonts available."
+	"\n  Called with text \""
+	     << text.GetText ()
+	     << "\"\n  at " << position
+	     << ", size " << size
+	     << ", offsets " << text.GetXOffset () << ", " << text.GetYOffset ()
+	     << ", type " << G4int(sizeType)
+	     << ", colour " << c
+	     << G4endl;
+    }
+    return;
+  }
+  const char* textCString = textString.c_str();
+  glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
+  glDisable (GL_DEPTH_TEST);
+  glDisable (GL_LIGHTING);
+  
+  glRasterPos3d(position.x(),position.y(),position.z());
+  // No action on offset or layout at present.
+   glPushAttrib(GL_LIST_BIT);
+   glListBase(font_base);
+   glCallLists(strlen(textCString), GL_UNSIGNED_BYTE, (GLubyte *)textCString);
+   glPopAttrib();
+}
+
+void G4OpenGLSceneHandler::AddPrimitive (const G4Circle& circle) {
+  glEnable (GL_POINT_SMOOTH);
+  AddCircleSquare (circle, G4OpenGLBitMapStore::circle);
+}
+
+void G4OpenGLSceneHandler::AddPrimitive (const G4Square& square) {
+  glDisable (GL_POINT_SMOOTH);
+  AddCircleSquare (square, G4OpenGLBitMapStore::square);
+}
+
+void G4OpenGLSceneHandler::AddCircleSquare
+(const G4VMarker& marker,
+ G4OpenGLBitMapStore::Shape shape) {
+
+  if (!fProcessingPolymarker) {  // Polymarker has already loaded atts.
+    // Loads G4Atts for picking...
+    if (fpViewer->GetViewParameters().IsPicking()) {
+      G4AttHolder* holder = new G4AttHolder;
+      LoadAtts(marker, holder);
+      fPickMap[fPickName] = holder;
+    }
+  }
+
+  // Note: colour treated in sub-class.
+
+  if (fpViewer -> GetViewParameters ().IsMarkerNotHidden ())
+    glDisable (GL_DEPTH_TEST);
+  else {glEnable (GL_DEPTH_TEST); glDepthFunc (GL_LESS);}
+  
+  glDisable (GL_LIGHTING);
+  
+  // Get vis attributes - pick up defaults if none.
+  const G4VisAttributes* pVA =
+    fpViewer -> GetApplicableVisAttributes (marker.GetVisAttributes ());
+
+  G4double lineWidth = GetLineWidth(pVA);
+  glLineWidth(lineWidth);
+
+  G4VMarker::FillStyle style = marker.GetFillStyle();
+
+  G4bool filled = false;
+  static G4bool hashedWarned = false;
+  
+  switch (style) {
+  case G4VMarker::noFill: 
+    glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
+    filled = false;
+    break;
+    
+  case G4VMarker::hashed:
+    if (!hashedWarned) {
+      G4cout << "Hashed fill style in G4OpenGLSceneHandler."
+	     << "\n  Not implemented.  Using G4VMarker::filled."
+	     << G4endl;
+      hashedWarned = true;
+    }
+    // Maybe use
+    //glPolygonStipple (fStippleMaskHashed);
+    // Drop through to filled...
+    
+  case G4VMarker::filled:
+    glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
+    filled = true;
+    break;
+    
+  }
+
+  // A few useful quantities...
+  G4Point3D centre = marker.GetPosition();
+  MarkerSizeType sizeType;
+  G4double size = GetMarkerSize(marker, sizeType);
+
+  // Draw...
+   if (sizeType == world) {  // Size specified in world coordinates.
+
+     DrawXYPolygon (shape, size, centre, pVA);
+
+   } else { // Size specified in screen (window) coordinates.
+     glPointSize (size);       
+     glBegin (GL_POINTS);
+     glVertex3f(centre.x(),centre.y(),centre.z());
+     glEnd();
+     //Antialiasing
+     glEnable (GL_POINT_SMOOTH);
+     //Transparency
+     glEnable(GL_BLEND);
+     glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+     // L. GARNIER 1 March 2009
+     // Old method, we draw a bitmap instead of a GL_POINT. 
+     // I remove it because it cost in term of computing performances
+     // and gl2ps can't draw bitmaps
+
+     //      glRasterPos3d(centre.x(),centre.y(),centre.z());
+     //      const GLubyte* marker =
+     //        G4OpenGLBitMapStore::GetBitMap(shape, size, filled);
+     //      glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+     //      glBitmap(GLsizei(size), GLsizei(size), size/2., size/2., 0., 0., marker);
+   }
+}
+
+void G4OpenGLSceneHandler::DrawXYPolygon
+(G4OpenGLBitMapStore::Shape shape,
+ G4double size,
+ const G4Point3D& centre,
+ const G4VisAttributes* pApplicableVisAtts)
+{
+  G4int nSides;
+  G4double startPhi;
+  if (shape == G4OpenGLBitMapStore::circle) {
+    nSides = GetNoOfSides(pApplicableVisAtts);
+    startPhi = 0.;
+  } else {
+    nSides = 4;
+    startPhi = -pi / 4.;
+  }
+
+  const G4Vector3D& viewpointDirection =
+    fpViewer -> GetViewParameters().GetViewpointDirection();
+  const G4Vector3D& up = fpViewer->GetViewParameters().GetUpVector();
+  const G4double dPhi = twopi / nSides;
+  const G4double radius = size / 2.;
+  G4Vector3D start = radius * (up.cross(viewpointDirection)).unit();
+  G4double phi;
+  G4int i;
+
+  glBegin (GL_POLYGON);
+  for (i = 0, phi = startPhi; i < nSides; i++, phi += dPhi) {
+    G4Vector3D r = start; r.rotate(phi, viewpointDirection);
+    G4Vector3D p = centre + r;
+    glVertex3d (p.x(), p.y(), p.z());
+  }
+  glEnd ();
+}
+
+void G4OpenGLSceneHandler::AddPrimitive (const G4Scale& scale)
+{
+  G4VSceneHandler::AddPrimitive(scale);
+}
+
+//Method for handling G4Polyhedron objects for drawing solids.
+void G4OpenGLSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron) {
+  // Assume all facets are planar convex quadrilaterals.
+  // Draw each facet individually
+  
+  if (polyhedron.GetNoFacets() == 0) return;
+
+  // Loads G4Atts for picking...
+  if (fpViewer->GetViewParameters().IsPicking()) {
+    G4AttHolder* holder = new G4AttHolder;
+    const G4Visible vis;
+    printf ("G4OpenGLSceneHandler::AddPrimitives poly %d",&polyhedron);
+    LoadAtts(vis, holder);
+    //    LoadAtts(polyhedron, holder);
+    fPickMap[fPickName] = holder;
+  }
+
+  // Get vis attributes - pick up defaults if none.
+  const G4VisAttributes* pVA =
+    fpViewer -> GetApplicableVisAttributes (polyhedron.GetVisAttributes ());
+
+  // Get view parameters that the user can force through the vis
+  // attributes, thereby over-riding the current view parameter.
+  G4ViewParameters::DrawingStyle drawing_style = GetDrawingStyle (pVA);
+
+  //Get colour, etc...
+  G4bool transparency_enabled = true;
+  G4OpenGLViewer* pViewer = dynamic_cast<G4OpenGLViewer*>(fpViewer);
+  if (pViewer) transparency_enabled = pViewer->transparency_enabled;
+  const G4Colour& c = pVA->GetColour();
+  GLfloat materialColour [4];
+  materialColour [0] = c.GetRed ();
+  materialColour [1] = c.GetGreen ();
+  materialColour [2] = c.GetBlue ();
+  if (transparency_enabled) {
+    materialColour [3] = c.GetAlpha ();
+  } else {
+    materialColour [3] = 1.;
+  }
+
+  G4double lineWidth = GetLineWidth(pVA);
+  glLineWidth(lineWidth);
+
+  GLfloat clear_colour[4];
+  glGetFloatv (GL_COLOR_CLEAR_VALUE, clear_colour);
+
+  G4bool isAuxEdgeVisible = GetAuxEdgeVisible (pVA);
+
+  G4bool clipping = pViewer->fVP.IsSection() || pViewer->fVP.IsCutaway();
+
+  // Lighting disabled unless otherwise requested
+  glDisable (GL_LIGHTING);
+
+  switch (drawing_style) {
+  case (G4ViewParameters::hlhsr):
+    // Set up as for hidden line removal but paint polygon faces later...
+  case (G4ViewParameters::hlr):
+    glEnable (GL_STENCIL_TEST);
+    // The stencil buffer is cleared in G4OpenGLViewer::ClearView.
+    // The procedure below leaves it clear.
+    glStencilFunc (GL_ALWAYS, 0, 1);
+    glStencilOp (GL_INVERT, GL_INVERT, GL_INVERT);
+    glEnable (GL_DEPTH_TEST);
+    glDepthFunc (GL_LEQUAL);
+    if (materialColour[3] < 1.) {
+      // Transparent...
+      glDisable (GL_CULL_FACE);
+      glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
+    } else {
+      // Opaque...
+      if (clipping) {
+	glDisable (GL_CULL_FACE);
+	glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
+      } else {
+	glEnable (GL_CULL_FACE);
+	glCullFace (GL_BACK);
+	glPolygonMode (GL_FRONT, GL_LINE);
+      }
+    }
+    glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
+    break;
+  case (G4ViewParameters::hsr):
+    glEnable (GL_DEPTH_TEST);
+    glDepthFunc (GL_LEQUAL);    
+    if (materialColour[3] < 1.) {
+      // Transparent...
+      glDepthMask (0);  // Make depth buffer read-only.
+      glDisable (GL_CULL_FACE);
+      glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
+      glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, materialColour);
+    } else {
+      // Opaque...
+      glDepthMask (1);  // Make depth buffer writable (default).
+      if (clipping) {
+	glDisable (GL_CULL_FACE);
+	glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
+      } else {
+	glEnable (GL_CULL_FACE);
+	glCullFace (GL_BACK);
+	glPolygonMode (GL_FRONT, GL_FILL);
+      }
+      glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE, materialColour);
+    }
+    if (!fProcessing2D) glEnable (GL_LIGHTING);
+    break;
+  case (G4ViewParameters::wireframe):
+  default:
+    glEnable (GL_DEPTH_TEST);
+    glDepthFunc (GL_LEQUAL);    //??? was GL_ALWAYS
+    glDisable (GL_CULL_FACE);
+    glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
+    glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
+    break;
+  }
+
+  //Loop through all the facets...
+  glBegin (GL_QUADS);
+  G4bool notLastFace;
+  do {
+
+    //First, find vertices, edgeflags and normals and note "not last facet"...
+    G4Point3D vertex[4];
+    G4int edgeFlag[4];
+    G4Normal3D normals[4];
+    G4int n;
+    notLastFace = polyhedron.GetNextFacet(n, vertex, edgeFlag, normals);
+
+    //Loop through the four edges of each G4Facet...
+    G4int edgeCount = 0;
+    for(edgeCount = 0; edgeCount < n; ++edgeCount) {
+      // Check to see if edge is visible or not...
+      if (isAuxEdgeVisible) {
+	edgeFlag[edgeCount] = 1;
+      }
+      if (edgeFlag[edgeCount] > 0) {
+	glEdgeFlag (GL_TRUE);
+      } else {
+	glEdgeFlag (GL_FALSE);
+      }
+      glNormal3d (normals[edgeCount].x(), 
+		  normals[edgeCount].y(),
+		  normals[edgeCount].z());
+      glVertex3d (vertex[edgeCount].x(), 
+		  vertex[edgeCount].y(),
+		  vertex[edgeCount].z());
+    }
+    // HepPolyhedron produces triangles too; in that case add an extra
+    // vertex identical to first...
+    if (n == 3) {
+      edgeCount = 3;
+      normals[edgeCount] = normals[0];
+      vertex[edgeCount] = vertex[0];
+      edgeFlag[edgeCount] = -1;
+      glEdgeFlag (GL_FALSE);
+      glNormal3d (normals[edgeCount].x(),
+		  normals[edgeCount].y(), 
+		  normals[edgeCount].z());
+      glVertex3d (vertex[edgeCount].x(),
+		  vertex[edgeCount].y(), 
+		  vertex[edgeCount].z());
+    }
+    // Trap situation where number of edges is > 4...
+    if (n > 4) {
+      G4cerr <<
+	"G4OpenGLSceneHandler::AddPrimitive(G4Polyhedron): WARNING";
+      G4PhysicalVolumeModel* pPVModel =
+	dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
+      if (pPVModel) {
+	G4VPhysicalVolume* pCurrentPV = pPVModel->GetCurrentPV();
+	G4LogicalVolume* pCurrentLV = pPVModel->GetCurrentLV();
+	G4cerr <<
+	"\n  Volume " << pCurrentPV->GetName() <<
+	", Solid " << pCurrentLV->GetSolid()->GetName() <<
+	  " (" << pCurrentLV->GetSolid()->GetEntityType();
+      }
+      G4cerr<<
+	"\n   G4Polyhedron facet with " << n << " edges" << G4endl;
+    }
+
+    // Do it all over again (twice) for hlr...
+    if  (drawing_style == G4ViewParameters::hlr ||
+	 drawing_style == G4ViewParameters::hlhsr) {
+
+      glEnd ();  // Placed here to balance glBegin above, allowing GL
+		 // state changes below, then glBegin again.  Avoids
+		 // having glBegin/End pairs *inside* loop in the more
+		 // usual case of no hidden line removal.
+
+      // Lighting disabled unless otherwise requested
+      glDisable (GL_LIGHTING);
+
+      // Draw through stencil...
+      glStencilFunc (GL_EQUAL, 0, 1);
+      glStencilOp (GL_KEEP, GL_KEEP, GL_KEEP);
+      if (drawing_style == G4ViewParameters::hlhsr) {
+	if (!fProcessing2D) glEnable (GL_LIGHTING);
+      }
+      glEnable (GL_DEPTH_TEST);
+      glDepthFunc (GL_LEQUAL);    
+      if (materialColour[3] < 1.) {
+	// Transparent...
+	glDepthMask (0);  // Make depth buffer read-only.
+	glDisable (GL_CULL_FACE);
+	glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
+      } else {
+	// Opaque...
+	glDepthMask (1);  // Make depth buffer writable (default).
+	if (clipping) {
+	  glDisable (GL_CULL_FACE);
+	  glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
+	} else {
+	  glEnable (GL_CULL_FACE);
+	  glCullFace (GL_BACK);
+	  glPolygonMode (GL_FRONT, GL_FILL);
+	}
+      }
+      GLfloat* painting_colour;
+      if  (drawing_style == G4ViewParameters::hlr) {
+	if (materialColour[3] < 1.) {
+	  // Transparent - don't paint...
+	  goto end_of_drawing_through_stencil;
+	}
+	painting_colour = clear_colour;
+      } else {  // drawing_style == G4ViewParameters::hlhsr
+	painting_colour = materialColour;
+      }
+      if (materialColour[3] < 1.) {
+	// Transparent...
+	glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, painting_colour);
+      } else {
+	// Opaque...
+	glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE, painting_colour);
+      }
+      glColor4fv (painting_colour);
+      glBegin (GL_QUADS);
+      for (int edgeCount = 0; edgeCount < 4; ++edgeCount) {
+	if (edgeFlag[edgeCount] > 0) {
+	  glEdgeFlag (GL_TRUE);
+	} else {
+	  glEdgeFlag (GL_FALSE);
+	}
+	glNormal3d (normals[edgeCount].x(), 
+		    normals[edgeCount].y(),
+		    normals[edgeCount].z());
+	glVertex3d (vertex[edgeCount].x(), 
+		    vertex[edgeCount].y(),
+		    vertex[edgeCount].z());
+      }
+      glEnd ();
+    end_of_drawing_through_stencil:
+
+      // and once more to reset the stencil bits...
+      glStencilFunc (GL_ALWAYS, 0, 1);
+      glStencilOp (GL_INVERT, GL_INVERT, GL_INVERT);
+      glDepthFunc (GL_LEQUAL);  // to make sure line gets drawn.  
+      if (materialColour[3] < 1.) {
+	// Transparent...
+	glDisable (GL_CULL_FACE);
+	glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
+      } else {
+	// Opaque...
+	if (clipping) {
+	  glDisable (GL_CULL_FACE);
+	  glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
+	} else {
+	  glEnable (GL_CULL_FACE);
+	  glCullFace (GL_BACK);
+	  glPolygonMode (GL_FRONT, GL_LINE);
+	}
+      }
+      glDisable (GL_LIGHTING);
+      glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
+      glBegin (GL_QUADS);
+      for (int edgeCount = 0; edgeCount < 4; ++edgeCount) {
+	if (edgeFlag[edgeCount] > 0) {
+	  glEdgeFlag (GL_TRUE);
+	} else {
+	  glEdgeFlag (GL_FALSE);
+	}
+	glNormal3d (normals[edgeCount].x(), 
+		    normals[edgeCount].y(),
+		    normals[edgeCount].z());
+	glVertex3d (vertex[edgeCount].x(), 
+		    vertex[edgeCount].y(),
+		    vertex[edgeCount].z());
+      }
+      glEnd ();
+      glDepthFunc (GL_LEQUAL);   // Revert for next facet.
+      glBegin (GL_QUADS);      // Ready for next facet.  GL
+			       // says it ignores incomplete
+			       // quadrilaterals, so final empty
+			       // glBegin/End sequence should be OK.
+    }
+  } while (notLastFace);  
+  
+  glEnd ();
+  glDisable (GL_STENCIL_TEST);  // Revert to default for next primitive.
+  glDepthMask (1);              // Revert to default for next primitive.
+  glDisable (GL_LIGHTING);      // Revert to default for next primitive.
+}
+
+//Method for handling G4NURBS objects for drawing solids.
+//Knots and Ctrl Pnts MUST be arrays of GLfloats.
+void G4OpenGLSceneHandler::AddPrimitive (const G4NURBS& nurb) {
+
+  // Loads G4Atts for picking...
+  if (fpViewer->GetViewParameters().IsPicking()) {
+    G4AttHolder* holder = new G4AttHolder;
+    LoadAtts(nurb, holder);
+    fPickMap[fPickName] = holder;
+  }
+
+  GLUnurbsObj *gl_nurb;
+  gl_nurb = gluNewNurbsRenderer ();
+
+  GLfloat *u_knot_array, *u_knot_array_ptr;
+  u_knot_array = u_knot_array_ptr = new GLfloat [nurb.GetnbrKnots(G4NURBS::U)];
+  G4NURBS::KnotsIterator u_iterator (nurb, G4NURBS::U);
+  while (u_iterator.pick (u_knot_array_ptr++)){}
+
+  GLfloat *v_knot_array, *v_knot_array_ptr;
+  v_knot_array = v_knot_array_ptr = new GLfloat [nurb.GetnbrKnots(G4NURBS::V)];
+  G4NURBS::KnotsIterator v_iterator (nurb, G4NURBS::V);
+  while (v_iterator.pick (v_knot_array_ptr++)){}
+
+  GLfloat *ctrl_pnt_array, *ctrl_pnt_array_ptr;
+  ctrl_pnt_array = ctrl_pnt_array_ptr =
+    new GLfloat [nurb.GettotalnbrCtrlPts () * G4NURBS::NofC];
+  G4NURBS::CtrlPtsCoordsIterator c_p_iterator (nurb);
+  while (c_p_iterator.pick (ctrl_pnt_array_ptr++)){}
+
+  // Get vis attributes - pick up defaults if none.
+  const G4VisAttributes* pVA =
+    fpViewer -> GetApplicableVisAttributes (nurb.GetVisAttributes ());
+
+  // Get view parameters that the user can force through the vis
+  // attributes, thereby over-riding the current view parameter.
+  G4ViewParameters::DrawingStyle drawing_style = GetDrawingStyle (pVA);
+  //G4bool isAuxEdgeVisible = GetAuxEdgeVisible (pVA);
+  
+  //Get colour, etc..
+  const G4Colour& c = pVA -> GetColour ();
+
+  switch (drawing_style) {
+
+  case (G4ViewParameters::hlhsr):
+    //    G4cout << "Hidden line removal not implememented in G4OpenGL.\n"
+    // << "Using hidden surface removal." << G4endl;
+  case (G4ViewParameters::hsr):
+    {
+      if (!fProcessing2D) glEnable (GL_LIGHTING);
+      glEnable (GL_DEPTH_TEST);
+      glEnable (GL_AUTO_NORMAL);
+      glEnable (GL_NORMALIZE);
+      gluNurbsProperty (gl_nurb, GLU_DISPLAY_MODE, GLU_FILL);
+      gluNurbsProperty (gl_nurb, GLU_SAMPLING_TOLERANCE, 50.0);
+      GLfloat materialColour [4];
+      materialColour [0] = c.GetRed ();
+      materialColour [1] = c.GetGreen ();
+      materialColour [2] = c.GetBlue ();
+      materialColour [3] = 1.0;  // = c.GetAlpha () for transparency -
+				 // but see complication in
+				 // AddPrimitive(const G4Polyhedron&).
+      glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE, materialColour);
+      break;
+    }
+  case (G4ViewParameters::hlr):
+    //    G4cout << "Hidden line removal not implememented in G4OpenGL.\n"
+    // << "Using wireframe." << G4endl;
+  case (G4ViewParameters::wireframe):
+  default:
+    glDisable (GL_LIGHTING);
+//    glDisable (GL_DEPTH_TEST);
+    glEnable (GL_DEPTH_TEST);
+    glDisable (GL_AUTO_NORMAL);
+    glDisable (GL_NORMALIZE);
+    gluNurbsProperty (gl_nurb, GLU_DISPLAY_MODE, GLU_OUTLINE_POLYGON);
+    gluNurbsProperty (gl_nurb, GLU_SAMPLING_TOLERANCE, 50.0);
+    glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
+    break;
+  }	
+
+  gluBeginSurface (gl_nurb);
+  G4int u_stride = 4;
+  G4int v_stride = nurb.GetnbrCtrlPts(G4NURBS::U) * 4;
+
+  gluNurbsSurface (gl_nurb, 
+		   nurb.GetnbrKnots (G4NURBS::U), (GLfloat*)u_knot_array, 
+		   nurb.GetnbrKnots (G4NURBS::V), (GLfloat*)v_knot_array,
+		   u_stride,
+		   v_stride,  
+		   ctrl_pnt_array,
+		   nurb.GetUorder (),
+		   nurb.GetVorder (), 
+		   GL_MAP2_VERTEX_4);
+  
+  gluEndSurface (gl_nurb);
+
+  delete [] u_knot_array;  // These should be allocated with smart allocators
+  delete [] v_knot_array;  // to avoid memory explosion.
+  delete [] ctrl_pnt_array;
+
+  gluDeleteNurbsRenderer (gl_nurb);
+}
+
+void G4OpenGLSceneHandler::AddCompound(const G4VTrajectory& traj) {
+  G4VSceneHandler::AddCompound(traj);  // For now.
+}
+
+void G4OpenGLSceneHandler::AddCompound(const G4VHit& hit) {
+  G4VSceneHandler::AddCompound(hit);  // For now.
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLStoredQt.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLStoredQt.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLStoredQt.cc	(revision 1102)
@@ -0,0 +1,86 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLStoredQt.cc,v 1.10 2009/01/19 16:26:40 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// OpenGLStoredQt graphics system factory.
+
+#ifdef G4VIS_BUILD_OPENGLQT_DRIVER
+
+#include "G4VisFeaturesOfOpenGL.hh"
+#include "G4VSceneHandler.hh"
+#include "G4OpenGLSceneHandler.hh"
+#include "G4OpenGLViewer.hh"
+#include "G4OpenGLStoredQt.hh"
+#include "G4OpenGLStoredQtViewer.hh"
+#include "G4OpenGLViewerMessenger.hh"
+
+G4OpenGLStoredQt::G4OpenGLStoredQt ():
+  G4VGraphicsSystem ("OpenGLStoredQt",
+		     "OGLSQt",
+		     G4VisFeaturesOfOpenGLSQt (),
+		     G4VGraphicsSystem::threeD)
+{
+  G4OpenGLViewerMessenger::GetInstance();
+}
+
+G4VSceneHandler* G4OpenGLStoredQt::CreateSceneHandler
+(const G4String& name) {
+  G4VSceneHandler* pScene = new G4OpenGLStoredSceneHandler (*this, name);
+  return    pScene;
+}
+
+G4VViewer* G4OpenGLStoredQt::CreateViewer
+(G4VSceneHandler& scene, const G4String& name) {
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLStoredQt::CreateViewer \n");
+#endif
+  G4VViewer* pView =
+    new G4OpenGLStoredQtViewer
+    ((G4OpenGLStoredSceneHandler&) scene, name);
+  if (pView) {
+    if (pView -> GetViewId () < 0) {
+      G4cerr << "G4OpenGLStoredQt::CreateViewer: error flagged by negative"
+	" view id in G4OpenGLStoredQtViewer creation."
+	"\n Destroying view and returning null pointer."
+	   << G4endl;
+      delete pView;
+      pView = 0;
+    }
+  }
+  else {
+    G4cerr << "G4OpenGLStoredQt::CreateViewer: null pointer on"
+      " new G4OpenGLStoredQtViewer." << G4endl;
+  }
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLStoredQt::CreateViewer END \n");
+#endif
+   return pView;
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLStoredQtViewer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLStoredQtViewer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLStoredQtViewer.cc	(revision 1102)
@@ -0,0 +1,305 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLStoredQtViewer.cc,v 1.26 2009/07/27 14:01:13 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+//
+// Class G4OpenGLStoredQtViewer : a class derived from G4OpenGLQtViewer and
+//                                G4OpenGLStoredViewer.
+
+#ifdef G4VIS_BUILD_OPENGLQT_DRIVER
+
+#include "G4OpenGLStoredQtViewer.hh"
+
+#include "G4ios.hh"
+
+//#include <qmouseevent.h>
+#include <qevent.h> // include <qcontextmenuevent.h>
+
+G4OpenGLStoredQtViewer::G4OpenGLStoredQtViewer
+(G4OpenGLStoredSceneHandler& sceneHandler,
+ const G4String&  name):
+  G4VViewer (sceneHandler, sceneHandler.IncrementViewCount (), name),
+  G4OpenGLViewer (sceneHandler),
+  G4OpenGLQtViewer (sceneHandler),
+  G4OpenGLStoredViewer (sceneHandler)             // FIXME : gerer le pb du parent !
+{
+
+#if QT_VERSION < 0x040000
+  setFocusPolicy(QWidget::StrongFocus); // enable keybord events
+#else
+  setFocusPolicy(Qt::StrongFocus); // enable keybord events
+#endif
+  fHasToRepaint =false;
+
+  if (fViewId < 0) return;  // In case error in base class instantiation.
+}
+
+G4OpenGLStoredQtViewer::~G4OpenGLStoredQtViewer() {
+  makeCurrent();
+  // this is connect to the Dialog for deleting it properly
+  // when close event.
+  //   ((QDialog*)window())->reject();
+}
+
+void G4OpenGLStoredQtViewer::Initialise() {
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLStoredQtViewer::Initialise 1\n");
+#endif
+  fReadyToPaint = false;
+  CreateMainWindow (this,QString(fName));
+  CreateFontLists ();
+  
+  fReadyToPaint = true;
+}
+
+void G4OpenGLStoredQtViewer::initializeGL () {
+
+  InitializeGLView ();
+
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLStoredQtViewer::InitialiseGL () 1\n");
+#endif
+
+  // clear the buffers and window.
+  ClearView ();
+  FinishView ();
+   
+  glDepthFunc (GL_LEQUAL);
+  glDepthMask (GL_TRUE);
+
+  if (fSceneHandler.GetScene() == 0) {
+    fHasToRepaint =false;
+  } else {
+    fHasToRepaint =true;
+  }
+
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLStoredQtViewer::InitialiseGL  END\n");
+#endif
+}
+
+
+void G4OpenGLStoredQtViewer::DrawView () {
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLStoredQtViewer::DrawView  VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV\n");
+#endif
+  // That's no the same logic as Immediate Viewer, I don't know why...
+  // But if I send updateGL here, we go here :
+  //  updateQWidget -> paintGL -> ComputeView
+  // whih is not the same as ComputeView Directly
+  // And we loose the redraw of things !
+  
+  ComputeView();
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLStoredQtViewer::DrawView  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");
+#endif
+}
+
+void G4OpenGLStoredQtViewer::ComputeView () {
+
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLStoredQtViewer::ComputeView %d %d   VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV\n",getWinWidth(), getWinHeight());
+#endif
+  makeCurrent();
+  G4ViewParameters::DrawingStyle style = GetViewParameters().GetDrawingStyle();
+
+  //Make sure current viewer is attached and clean...
+
+  //See if things have changed from last time and remake if necessary...
+  // The fNeedKernelVisit flag might have been set by the user in
+  // /vis/viewer/rebuild, but if not, make decision and set flag only
+  // if necessary...
+  if (!fNeedKernelVisit) {
+    KernelVisitDecision ();
+  }
+  G4bool kernelVisitWasNeeded = fNeedKernelVisit; // Keep (ProcessView resets).
+  ProcessView ();
+   
+
+  if(style!=G4ViewParameters::hlr &&
+     haloing_enabled) {
+#ifdef G4DEBUG_VIS_OGL
+    printf("G4OpenGLStoredQtViewer::ComputeView DANS LE IF\n");
+#endif
+
+    HaloingFirstPass ();
+    DrawDisplayLists ();
+    glFlush ();
+
+    HaloingSecondPass ();
+
+    DrawDisplayLists ();
+    FinishView ();
+
+  } else {
+     
+    // If kernel visit was needed, drawing and FinishView will already
+    // have been done, so...
+    if (!kernelVisitWasNeeded) {
+#ifdef G4DEBUG_VIS_OGL
+      printf("**************************  G4OpenGLStoredQtViewer::ComputeView Don't need kernel Visit \n");
+#endif
+      DrawDisplayLists ();
+      FinishView ();
+    } else {
+#ifdef G4DEBUG_VIS_OGL
+      printf("**************************  G4OpenGLStoredQtViewer::ComputeView need kernel Visit \n");
+#endif
+      // However, union cutaways are implemented in DrawDisplayLists, so make
+      // an extra pass...
+      if (fVP.IsCutaway() &&
+          fVP.GetCutawayMode() == G4ViewParameters::cutawayUnion) {
+        ClearView();
+        DrawDisplayLists ();
+        FinishView ();
+#ifdef G4DEBUG_VIS_OGL
+        printf("***************************  CASE 4 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n");
+#endif
+      } else { // ADD TO AVOID KernelVisit=1 and nothing to display
+        DrawDisplayLists ();
+        FinishView ();
+      }
+    }
+  }
+
+  if (isRecording()) {
+    savePPMToTemp();
+  }
+
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLStoredQtViewer::ComputeView %d %d ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n",getWinWidth(), getWinHeight());
+#endif
+  fHasToRepaint =true;
+}
+
+
+/**
+   - Lors du resize de la fenetre, on doit non pas redessiner le detecteur, mais aussi les evenements
+*/
+void G4OpenGLStoredQtViewer::resizeGL(
+                                      int aWidth
+                                      ,int aHeight)
+{  
+  // Set new size, it will be update when next Repaint()->SetView() called
+  ResizeWindow(aWidth,aHeight);
+  fHasToRepaint = sizeHasChanged();
+}
+
+
+void G4OpenGLStoredQtViewer::paintGL()
+{
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLStoredQtViewer::paintGL ready:%d fHasTo:%d??\n",fReadyToPaint,fHasToRepaint);
+#endif
+  if (!fReadyToPaint) {
+    fReadyToPaint= true;
+    return;
+  }
+  // DO NOT RESIZE IF SIZE HAS NOT CHANGE :
+  //    WHEN CLICK ON THE FRAME FOR EXAMPLE
+  //    EXECEPT WHEN MOUSE MOVE EVENT
+  if ( !fHasToRepaint) {
+    if (((getWinWidth() == (unsigned int)width())) &&(getWinHeight() == (unsigned int) height())) {
+      return;
+    }
+  }
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLStoredQtViewer::paintGL VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV ready %d\n",fReadyToPaint);
+#endif
+
+  SetView();
+          
+  ClearView (); //ok, put the background correct
+  ComputeView();
+     
+  fHasToRepaint =false;
+     
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLStoredQtViewer::paintGL ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ready %d\n",fReadyToPaint);
+#endif
+}
+
+void G4OpenGLStoredQtViewer::mousePressEvent(QMouseEvent *event)
+{
+  G4MousePressEvent(event);
+}
+
+void G4OpenGLStoredQtViewer::keyPressEvent (QKeyEvent * event) 
+{
+  G4keyPressEvent(event);
+}
+
+void G4OpenGLStoredQtViewer::wheelEvent (QWheelEvent * event) 
+{
+  G4wheelEvent(event);
+}
+
+/**
+ * This function was build in order to make a zoom on double clic event.
+ * It was think to build a rubberband on the zoom area, but never work fine
+ */
+void G4OpenGLStoredQtViewer::mouseDoubleClickEvent(QMouseEvent *)
+{
+  G4MouseDoubleClickEvent();
+}
+
+void G4OpenGLStoredQtViewer::mouseReleaseEvent(QMouseEvent *)
+{
+  G4MouseReleaseEvent();
+}
+
+void G4OpenGLStoredQtViewer::mouseMoveEvent(QMouseEvent *event)
+{
+  G4MouseMoveEvent(event);
+}
+
+
+void G4OpenGLStoredQtViewer::contextMenuEvent(QContextMenuEvent *e)
+{
+  G4manageContextMenuEvent(e);
+}
+
+void G4OpenGLStoredQtViewer::updateQWidget() {
+  fHasToRepaint= true;
+  updateGL();
+  fHasToRepaint= false;
+}
+
+void G4OpenGLStoredQtViewer::ShowView (
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+#if QT_VERSION < 0x040000
+  setActiveWindow();
+#else
+  activateWindow();
+#endif
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLStoredSceneHandler.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLStoredSceneHandler.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLStoredSceneHandler.cc	(revision 1102)
@@ -0,0 +1,559 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLStoredSceneHandler.cc,v 1.40 2009/02/04 16:48:41 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Andrew Walkden  10th February 1997
+// OpenGL stored scene - creates OpenGL display lists.
+
+#ifdef G4VIS_BUILD_OPENGL_DRIVER
+
+// Included here - problems with HP compiler if not before other includes?
+#include "G4NURBS.hh"
+
+// Here follows a special for Mesa, the OpenGL emulator.  Does not affect
+// other OpenGL's, as far as I'm aware.   John Allison 18/9/96.
+#define CENTERLINE_CLPP  /* CenterLine C++ workaround: */
+// Also seems to be required for HP's CC and AIX xlC, at least.
+
+#include "G4OpenGLStoredSceneHandler.hh"
+
+#include "G4PhysicalVolumeModel.hh"
+#include "G4VPhysicalVolume.hh"
+#include "G4LogicalVolume.hh"
+#include "G4Polyline.hh"
+#include "G4Polymarker.hh"
+#include "G4Text.hh"
+#include "G4Circle.hh"
+#include "G4Square.hh"
+#include "G4Polyhedron.hh"
+#include "G4AttHolder.hh"
+#include "G4OpenGLTransform3D.hh"
+#include "G4OpenGLViewer.hh"
+
+G4OpenGLStoredSceneHandler::PO::PO
+(G4int id,
+ const G4Transform3D& tr):
+  fDisplayListId(id),
+  fTransform(tr),
+  fPickName(0)
+{}
+
+G4OpenGLStoredSceneHandler::TO::TO
+(G4int id,
+ const G4Transform3D& tr):
+  fDisplayListId(id),
+  fTransform(tr),
+  fPickName(0),
+  fStartTime(-DBL_MAX),
+  fEndTime(DBL_MAX)
+{}
+
+G4OpenGLStoredSceneHandler::G4OpenGLStoredSceneHandler
+(G4VGraphicsSystem& system,
+ const G4String& name):
+G4OpenGLSceneHandler (system, fSceneIdCount++, name),
+fMemoryForDisplayLists (true),
+fAddPrimitivePreambleNestingDepth (0),
+fTopPODL (0),
+fLastPolymarker(),
+fLastPolymarkers(),
+nbDoublons(0)
+{}
+
+G4OpenGLStoredSceneHandler::~G4OpenGLStoredSceneHandler ()
+{}
+
+void G4OpenGLStoredSceneHandler::AddPrimitivePreamble(const G4Visible& visible)
+{
+  // Track nesting depth to avoid recursive calls, for example, from a
+  // G4Polymarker that invokes a G4Circle...
+  fAddPrimitivePreambleNestingDepth++;
+  if (fAddPrimitivePreambleNestingDepth > 1) return;
+
+  // Because of our need to control colour of transients (display by
+  // time fading), display lists may only cover a single primitive.
+  // So display list setup is here.
+
+  if (fpViewer->GetViewParameters().IsPicking()) {
+    fPickMap[++fPickName] = 0;
+  }
+
+  const G4Colour& c = GetColour (visible);
+
+  if (fMemoryForDisplayLists) {
+    fDisplayListId = glGenLists (1);
+    if (glGetError() == GL_OUT_OF_MEMORY) {  // Could pre-allocate?
+      G4cout <<
+	"********************* WARNING! ********************"
+	"\nUnable to allocate any more display lists in OpenGL."
+	"\n     Continuing drawing in IMMEDIATE MODE."
+	"\n***************************************************"
+	     << G4endl;
+      fMemoryForDisplayLists = false;
+    }
+  }
+  if (fMemoryForDisplayLists) {
+    if (fReadyForTransients) {
+      TO to(fDisplayListId, *fpObjectTransformation);
+      to.fPickName = fPickName;
+      to.fColour = c;
+      const G4VisAttributes* pVA =
+	fpViewer->GetApplicableVisAttributes(visible.GetVisAttributes());
+      to.fStartTime = pVA->GetStartTime();
+      to.fEndTime = pVA->GetEndTime();
+      fTOList.push_back(to);
+      glDrawBuffer (GL_FRONT);
+      glPushMatrix();
+      G4OpenGLTransform3D oglt (*fpObjectTransformation);
+      glMultMatrixd (oglt.GetGLMatrix ());
+      glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
+      glNewList (fDisplayListId, GL_COMPILE_AND_EXECUTE);
+    }
+    else {
+      PO po(fDisplayListId, *fpObjectTransformation);
+      po.fPickName = fPickName;
+      fPOList.push_back(po);
+      glNewList (fDisplayListId, GL_COMPILE);
+      glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
+    }
+  } else {
+    glDrawBuffer (GL_FRONT);
+    glPushMatrix();
+    G4OpenGLTransform3D oglt (*fpObjectTransformation);
+    glMultMatrixd (oglt.GetGLMatrix ());
+    glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
+  }
+
+  if (fProcessing2D) {
+    // Push current 3D world matrices and load identity to define screen
+    // coordinates...
+    glMatrixMode (GL_PROJECTION);
+    glPushMatrix();
+    glLoadIdentity();
+    glOrtho (-1., 1., -1., 1., -G4OPENGL_FLT_BIG, G4OPENGL_FLT_BIG);
+    glMatrixMode (GL_MODELVIEW);
+    glPushMatrix();
+    glLoadIdentity();
+    G4OpenGLTransform3D oglt (*fpObjectTransformation);
+    glMultMatrixd (oglt.GetGLMatrix ());
+    glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
+  }
+}
+
+void G4OpenGLStoredSceneHandler::AddPrimitivePostamble()
+{
+  if (fProcessing2D) {
+    // Pop current 3D world matrices back again...
+    glMatrixMode (GL_PROJECTION);
+    glPopMatrix();
+    glMatrixMode (GL_MODELVIEW);
+    glPopMatrix();
+  }
+
+  //  if ((glGetError() == GL_TABLE_TOO_LARGE) || (glGetError() == GL_OUT_OF_MEMORY)) {  // Could close?
+  if (glGetError() == GL_OUT_OF_MEMORY) {  // Could close?
+    G4cout <<
+      "ERROR: G4OpenGLStoredSceneHandler::EndModeling: Failure to allocate"
+      "  display List for fTopPODL - try OpenGL Immediated mode."
+           << G4endl;
+  }
+  if (fMemoryForDisplayLists) {
+    glEndList();
+    if (glGetError() == GL_OUT_OF_MEMORY) {  // Could close?
+      G4cout <<
+        "ERROR: G4OpenGLStoredSceneHandler::EndModeling: Failure to allocate"
+        "  display List for fTopPODL - try OpenGL Immediated mode."
+             << G4endl;
+    }
+  }
+  if (fReadyForTransients || !fMemoryForDisplayLists) {
+    glPopMatrix();
+#ifdef G4DEBUG_VIS_OGL
+    //    printf("G4OpenGLStoredSceneHandler::AddPrimitivePostamble glFlush\n");
+#endif
+    glFlush ();
+    glDrawBuffer (GL_BACK);
+  }
+  fAddPrimitivePreambleNestingDepth--;
+}
+
+void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Polyline& polyline)
+{
+  AddPrimitivePreamble(polyline);
+  G4OpenGLSceneHandler::AddPrimitive(polyline);
+  AddPrimitivePostamble();
+}
+
+void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Polymarker& polymarker)
+{
+
+#ifdef G4DEBUG_VIS_OGL
+  //  printf("G4OpenGLStoredSceneHandler::AddPrimitive\n");
+#endif
+  std::vector< G4Polymarker > poly;
+    // 40,83 N03 lancement
+    // 289,69 10Gev supp doublons   + bitmap 21 frame en 10 sec
+    // 343,45 10Gev full polymarker + bitmap 15 frame en 10 sec
+    // 351,67 10Gev full polymarker - bitmap 31 frame en 10 sec
+    // 257,90 10Gev supp doublons MAX  - bitmap 42 frame en 10 sec 45757 markers et 16243 enleves
+  // Check
+  int reste = polymarker.size();
+  bool res = false;
+  if (fLastPolymarkers.size() > 0 ) {
+
+    // Loop new point to check
+    for (unsigned int b=0; b< polymarker.size();b++) {
+      //      printf("check %d/%d\n",b,polymarker.size());
+      res= false;
+
+      // Look for stored point list
+      for (unsigned int a=0; a< fLastPolymarkers.size() ;a++) {
+        //        printf("against vect %d/%d\n",a,fLastPolymarker.size());
+        std::vector < G4Polymarker > storedPoly = fLastPolymarkers[a];
+        int size= storedPoly.size()-1;
+
+        // Look for point
+        for (int aPoly=0; aPoly< size ;aPoly++) {
+          //          printf("against poly %d/%d\n",aPoly,storedPoly.size());
+          if (( storedPoly[size-aPoly].GetPosition().x() == polymarker[b].x()) &&
+              ( storedPoly[size-aPoly].GetPosition().y() == polymarker[b].y()) &&
+              ( storedPoly[size-aPoly].GetPosition().z() == polymarker[b].z())) {
+            reste --;
+//            res= true;
+            nbDoublons++;
+            //            printf("G4OpenGLStoredSceneHandler::AddPrimitive  PT %d/%d ALREADY FOUND TOT:%d. OLD pos %d/%d in %d PolyMarkerList STILL %d Marker in list. Point is %f %f %f\n",b,polymarker.size(),  nbDoublons,  aPoly,size,a   ,reste,polymarker[b].x(),polymarker[b].y(),polymarker[b].z());
+          }
+        }
+      }
+      // Add
+      if (!res) {
+        G4Polymarker tmp;
+        tmp.SetPosition(polymarker[b]);
+        poly.push_back(tmp);
+      }
+    }
+  } else {
+    for (unsigned int b=0; b< polymarker.size();b++) {
+      G4Polymarker tmp;
+      tmp.SetPosition(polymarker[b]);
+      poly.push_back(tmp);
+    }
+  }
+  fLastPolymarkers.push_back(poly);
+#define TEST_MARKER 1
+#ifdef TEST_MARKER 
+  // if it is already done
+  if (poly.size() == 1 ) {
+    //   if (polymarker.size() >0) {
+    //     if (( fLastPolymarker.GetPosition().x() == polymarker[0].x()) &&
+    //         ( fLastPolymarker.GetPosition().y() == polymarker[0].y()) &&
+    //         ( fLastPolymarker.GetPosition().z() == polymarker[0].z())) {
+    //       if (fpViewer->GetViewParameters().IsPicking()) {
+    //         glLoadName(++fPickName);
+    //         fPickMap[fPickName] = 0;
+    //       }
+    //       printf("G4OpenGLStoredSceneHandler::AddPrimitive  SUPPR ----------- point %f %f %f\n",polymarker[0].x(),polymarker[0].y(),polymarker[0].z());
+    const G4Colour& c = GetColour (polymarker);
+    glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
+    G4OpenGLSceneHandler::AddPrimitive(poly[0]);
+    //    fLastPolymarker.SetPosition(polymarker[poly]);
+    return;
+  }
+#endif  
+#ifdef G4DEBUG_VIS_OGL
+  //  printf("G4OpenGLStoredSceneHandler::AddPrimitive new marker list\n");
+#endif
+  AddPrimitivePreamble(polymarker);
+  G4OpenGLSceneHandler::AddPrimitive(polymarker);
+  AddPrimitivePostamble();
+//  fLastPolymarker.SetPosition(polymarker[polymarker.size()-1]);
+}
+
+void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Text& text)
+{
+  // Note: colour is still handled in
+  // G4OpenGLSceneHandler::AddPrimitive(const G4Text&), so it still
+  // gets into the display list
+  AddPrimitivePreamble(text);
+  G4OpenGLSceneHandler::AddPrimitive(text);
+  AddPrimitivePostamble();
+}
+
+void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Circle& circle)
+{
+  AddPrimitivePreamble(circle);
+  G4OpenGLSceneHandler::AddPrimitive(circle);
+  AddPrimitivePostamble();
+}
+
+void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Square& square)
+{
+  AddPrimitivePreamble(square);
+  G4OpenGLSceneHandler::AddPrimitive(square);
+  AddPrimitivePostamble();
+}
+
+void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Scale& scale)
+{
+  // Let base class split into primitives.
+  G4OpenGLSceneHandler::AddPrimitive(scale);
+}
+
+void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron)
+{
+  // Note: colour is still handled in
+  // G4OpenGLSceneHandler::AddPrimitive(const G4Polyhedron&), so it still
+  // gets into the display list
+  AddPrimitivePreamble(polyhedron);
+  printf("G4OpenGLStoredSceneHandler::AddPrimitive :\n");
+  G4OpenGLSceneHandler::AddPrimitive(polyhedron);
+  AddPrimitivePostamble();
+}
+
+void G4OpenGLStoredSceneHandler::AddPrimitive (const G4NURBS& nurbs)
+{
+  // Note: colour is still handled in
+  // G4OpenGLSceneHandler::AddPrimitive(const G4NURBS&), so it still
+  // gets into the display list
+  AddPrimitivePreamble(nurbs);
+  G4OpenGLSceneHandler::AddPrimitive(nurbs);
+  AddPrimitivePostamble();
+}
+
+void G4OpenGLStoredSceneHandler::BeginPrimitives
+(const G4Transform3D& objectTransformation)
+{  
+  G4OpenGLSceneHandler::BeginPrimitives (objectTransformation);
+
+  // Display list setup moved to AddPrimitivePreamble.  See notes there.
+}
+
+void G4OpenGLStoredSceneHandler::EndPrimitives ()
+{
+  G4OpenGLSceneHandler::EndPrimitives ();
+}
+
+void G4OpenGLStoredSceneHandler::BeginPrimitives2D
+(const G4Transform3D& objectTransformation)
+{
+  G4OpenGLSceneHandler::BeginPrimitives2D(objectTransformation);
+}
+
+void G4OpenGLStoredSceneHandler::EndPrimitives2D ()
+{
+  G4OpenGLSceneHandler::EndPrimitives2D ();
+}
+
+void G4OpenGLStoredSceneHandler::BeginModeling () {
+  G4VSceneHandler::BeginModeling();
+  ClearStore();  // ...and all that goes with it.
+  /* Debug...
+  fDisplayListId = glGenLists (1);
+  G4cout << "OGL::fDisplayListId (start): " << fDisplayListId << G4endl;
+  */
+}
+
+void G4OpenGLStoredSceneHandler::EndModeling () {
+  // Make a List which calls the other lists.
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLStoredSceneHandler::EndModeling Cree une nouvelle liste+++++++++++++++++++++++++++\n");
+#endif
+  fTopPODL = glGenLists (1);
+  if (glGetError() == GL_OUT_OF_MEMORY) {  // Could pre-allocate?
+    G4cout <<
+      "ERROR: G4OpenGLStoredSceneHandler::EndModeling: Failure to allocate"
+      "  display List for fTopPODL - try OpenGL Immediated mode."
+	   << G4endl;
+  } else {
+    glNewList (fTopPODL, GL_COMPILE_AND_EXECUTE); {
+      for (size_t i = 0; i < fPOList.size (); i++) {
+	glPushMatrix();
+	G4OpenGLTransform3D oglt (fPOList[i].fTransform);
+	glMultMatrixd (oglt.GetGLMatrix ());
+	if (fpViewer->GetViewParameters().IsPicking())
+	  glLoadName(fPOList[i].fPickName);
+	glCallList (fPOList[i].fDisplayListId);
+	glPopMatrix();
+      }
+    }
+    glEndList ();
+    if (glGetError() == GL_OUT_OF_MEMORY) {  // Could close?
+      G4cout <<
+        "ERROR: G4OpenGLStoredSceneHandler::EndModeling: Failure to allocate"
+        "  display List for fTopPODL - try OpenGL Immediated mode."
+             << G4endl;
+    }
+  }
+
+  G4VSceneHandler::EndModeling ();
+
+  /* Debug...
+  fDisplayListId = glGenLists (1);
+  G4cout << "OGL::fDisplayListId (end): " << fDisplayListId << G4endl;
+  */
+}
+
+void G4OpenGLStoredSceneHandler::ClearStore () {
+
+  G4VSceneHandler::ClearStore ();  // Sets need kernel visit, etc.
+
+  // Delete OpenGL permanent display lists.
+  for (size_t i = 0; i < fPOList.size (); i++)
+    glDeleteLists (fPOList[i].fDisplayListId, 1);
+  if (fTopPODL) glDeleteLists (fTopPODL, 1);
+  fTopPODL = 0;
+
+  // Clear other lists, dictionary, etc.
+  fPOList.clear ();
+  fSolidMap.clear ();
+  ClearAndDestroyAtts();
+
+  // ...and clear transient store...
+  for (size_t i = 0; i < fTOList.size (); i++)
+    glDeleteLists(fTOList[i].fDisplayListId, 1);
+  fTOList.clear ();
+}
+
+void G4OpenGLStoredSceneHandler::ClearTransientStore () {
+
+  G4VSceneHandler::ClearTransientStore ();
+
+  // Delete OpenGL transient display lists and Transient Objects themselves.
+  for (size_t i = 0; i < fTOList.size (); i++)
+    glDeleteLists(fTOList[i].fDisplayListId, 1);
+  fTOList.clear ();
+
+  // Make sure screen corresponds to graphical database...
+  if (fpViewer) {
+#ifdef G4DEBUG_VIS_OGL
+    printf("G4OpenGLStoredSceneHandler::ClearTransientStore () BEGIN\n");
+#endif
+    fpViewer -> SetView ();
+    fpViewer -> ClearView ();
+    fpViewer -> DrawView ();
+#ifdef G4DEBUG_VIS_OGL
+    printf("G4OpenGLStoredSceneHandler::ClearTransientStore () END\n");
+#endif
+  }
+}
+
+void G4OpenGLStoredSceneHandler::RequestPrimitives (const G4VSolid& solid)
+{
+  if (fReadyForTransients) {
+    // Always draw transient solids, e.g., hits represented as solids.
+    // (As we have no control over the order of drawing of transient
+    // objects, we cannot do anything about transparent ones, as
+    // below, so always draw them.)
+    G4VSceneHandler::RequestPrimitives (solid);
+    return;
+  }
+
+  // For non-transient (run-duration) objects, ensure transparent
+  // objects are drawn last.  The problem of
+  // blending/transparency/alpha is quite a tricky one - see History
+  // of opengl-V07-01-01/2/3.
+  // Get vis attributes - pick up defaults if none.
+  const G4VisAttributes* pVA =
+    fpViewer -> GetApplicableVisAttributes(fpVisAttribs);
+  const G4Colour& c = pVA -> GetColour ();
+  G4double opacity = c.GetAlpha ();
+
+  if (!fSecondPass) {
+    G4bool transparency_enabled = true;
+    G4OpenGLViewer* pViewer = dynamic_cast<G4OpenGLViewer*>(fpViewer);
+    if (pViewer) transparency_enabled = pViewer->transparency_enabled;
+    if (transparency_enabled && opacity < 1.) {
+      // On first pass, transparent objects are not drawn, but flag is set...
+      fSecondPassRequested = true;
+      return;
+    }
+  }
+
+  // On second pass, opaque objects are not drwan...
+  if (fSecondPass && opacity >= 1.) return;
+
+  G4PhysicalVolumeModel* pPVModel =
+    dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
+ 
+  if (pPVModel) {
+    // If part of the geometry hierarchy, i.e., from a
+    // G4PhysicalVolumeModel, check if a display list already exists for
+    // this solid, re-use it if possible.  We could be smarter, and
+    // recognise repeated branches of the geometry hierarchy, for
+    // example.  But this algorithm should be secure, I think...
+    const G4VSolid* pSolid = &solid;
+    EAxis axis = kRho;
+    G4VPhysicalVolume* pCurrentPV = pPVModel->GetCurrentPV();
+    if (pCurrentPV -> IsReplicated ()) {
+      G4int nReplicas;
+      G4double width;
+      G4double offset;
+      G4bool consuming;
+      pCurrentPV->GetReplicationData(axis,nReplicas,width,offset,consuming);
+    }
+    // Provided it is not parametrised (because if so, the
+    // solid's parameters might have been changed)...
+    if (!(pCurrentPV -> IsParameterised ()) &&
+	// Provided it is not replicated radially (because if so, the
+	// solid's parameters will have been changed)...
+	!(pCurrentPV -> IsReplicated () && axis == kRho) &&
+	// ...and if the solid has already been rendered...
+	(fSolidMap.find (pSolid) != fSolidMap.end ())) {
+      fDisplayListId = fSolidMap [pSolid];
+      PO po(fDisplayListId,*fpObjectTransformation);
+      if (fpViewer->GetViewParameters().IsPicking()) {
+	G4AttHolder* holder = new G4AttHolder;
+	// Load G4Atts from G4VisAttributes, if any...
+	const G4VisAttributes* va = pPVModel->GetCurrentLV()->GetVisAttributes();
+	if (va) {
+	  const std::map<G4String,G4AttDef>* vaDefs = va->GetAttDefs();
+	  if (vaDefs) holder->AddAtts(va->CreateAttValues(), vaDefs);
+	}
+	// Load G4Atts from G4PhysicalVolumeModel...
+	const std::map<G4String,G4AttDef>* defs = pPVModel->GetAttDefs();
+	if (defs) holder->AddAtts(pPVModel->CreateCurrentAttValues(), defs);
+	fPickMap[++fPickName] = holder;
+	po.fPickName = fPickName;
+      }
+      fPOList.push_back(po);
+    }
+    else {
+      G4VSceneHandler::RequestPrimitives (solid);
+      fSolidMap [pSolid] = fDisplayListId;
+    }
+    return;
+  }
+
+  // Otherwise invoke base class method...
+  G4VSceneHandler::RequestPrimitives (solid);
+}
+
+G4int G4OpenGLStoredSceneHandler::fSceneIdCount = 0;
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLStoredViewer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLStoredViewer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLStoredViewer.cc	(revision 1102)
@@ -0,0 +1,262 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLStoredViewer.cc,v 1.26 2009/04/08 16:55:44 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Andrew Walkden  7th February 1997
+// Class G4OpenGLStoredViewer : Encapsulates the `storedness' of
+//                            an OpenGL view, for inheritance by
+//                            derived (X, Xm...) classes.
+
+#ifdef G4VIS_BUILD_OPENGL_DRIVER
+
+#include "G4OpenGLStoredViewer.hh"
+
+#include "G4OpenGLStoredSceneHandler.hh"
+#include "G4Text.hh"
+#include "G4Circle.hh"
+#include "G4UnitsTable.hh"
+#include "G4Scene.hh"
+
+G4OpenGLStoredViewer::G4OpenGLStoredViewer
+(G4OpenGLStoredSceneHandler& sceneHandler):
+G4VViewer (sceneHandler, -1),  
+G4OpenGLViewer (sceneHandler), 
+fG4OpenGLStoredSceneHandler (sceneHandler)
+{
+  fLastVP = fDefaultVP; // Not sure if this gets executed before or
+  // after G4VViewer::G4VViewer!!  Doesn't matter much.
+}
+
+G4OpenGLStoredViewer::~G4OpenGLStoredViewer () {}
+
+void G4OpenGLStoredViewer::KernelVisitDecision () {
+  
+  // If there's a significant difference with the last view parameters
+  // of either the scene handler or this viewer, trigger a rebuild.
+
+  if (!fG4OpenGLStoredSceneHandler.fTopPODL ||
+      CompareForKernelVisit(fLastVP)) {
+    NeedKernelVisit ();
+  }      
+  fLastVP = fVP;
+}
+
+G4bool G4OpenGLStoredViewer::CompareForKernelVisit(G4ViewParameters& lastVP) {
+
+  if (
+      (lastVP.GetDrawingStyle ()    != fVP.GetDrawingStyle ())    ||
+      (lastVP.IsAuxEdgeVisible ()   != fVP.IsAuxEdgeVisible ())   ||
+      (lastVP.GetRepStyle ()        != fVP.GetRepStyle ())        ||
+      (lastVP.IsCulling ()          != fVP.IsCulling ())          ||
+      (lastVP.IsCullingInvisible () != fVP.IsCullingInvisible ()) ||
+      (lastVP.IsDensityCulling ()   != fVP.IsDensityCulling ())   ||
+      (lastVP.IsCullingCovered ()   != fVP.IsCullingCovered ())   ||
+      (lastVP.IsSection ()          != fVP.IsSection ())          ||
+      // Section (DCUT) implemented locally.  But still need to visit
+      // kernel if status changes so that back plane culling can be
+      // switched.
+      (lastVP.IsCutaway ()          != fVP.IsCutaway ())          ||
+      // Cutaways implemented locally.  But still need to visit kernel
+      // if status changes so that back plane culling can be switched.
+      (lastVP.IsExplode ()          != fVP.IsExplode ())          ||
+      (lastVP.GetNoOfSides ()       != fVP.GetNoOfSides ())       ||
+      (lastVP.IsMarkerNotHidden ()  != fVP.IsMarkerNotHidden ())  ||
+      (lastVP.GetBackgroundColour ()!= fVP.GetBackgroundColour ())||
+      (lastVP.IsPicking ()          != fVP.IsPicking ())
+      )
+    return true;
+  
+  if (lastVP.IsDensityCulling () &&
+      (lastVP.GetVisibleDensity () != fVP.GetVisibleDensity ()))
+    return true;
+
+  /**************************************************************
+  Section (DCUT) implemented locally.  No need to visit kernel if
+  section plane itself changes.
+  if (lastVP.IsSection () &&
+      (lastVP.GetSectionPlane () != fVP.GetSectionPlane ()))
+    return true;
+  ***************************************************************/
+
+  /**************************************************************
+  Cutaways implemented locally.  No need to visit kernel if cutaway
+  planes themselves change.
+  if (lastVP.IsCutaway ()) {
+    if (lastVP.GetCutawayPlanes ().size () !=
+	fVP.GetCutawayPlanes ().size ()) return true;
+    for (size_t i = 0; i < lastVP.GetCutawayPlanes().size(); ++i)
+      if (lastVP.GetCutawayPlanes()[i] != fVP.GetCutawayPlanes()[i])
+	return true;
+  }
+  ***************************************************************/
+
+  if (lastVP.IsExplode () &&
+      (lastVP.GetExplodeFactor () != fVP.GetExplodeFactor ()))
+    return true;
+
+  return false;
+}
+
+void G4OpenGLStoredViewer::DrawDisplayLists () {
+#ifdef G4DEBUG_VIS_OGL
+      printf("G4OpenGLStoredViewer::DrawDisplayLists \n");
+#endif
+
+  const G4Planes& cutaways = fVP.GetCutawayPlanes();
+  G4bool cutawayUnion = fVP.IsCutaway() &&
+    fVP.GetCutawayMode() == G4ViewParameters::cutawayUnion;
+  size_t nPasses = cutawayUnion? cutaways.size(): 1;
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLStoredViewer::DrawDisplayLists");
+#endif
+  for (size_t i = 0; i < nPasses; ++i) {
+#ifdef G4DEBUG_VIS_OGL
+    printf("+");
+#endif
+
+    if (cutawayUnion) {
+      double a[4];
+      a[0] = cutaways[i].a();
+      a[1] = cutaways[i].b();
+      a[2] = cutaways[i].c();
+      a[3] = cutaways[i].d();
+      glClipPlane (GL_CLIP_PLANE2, a);
+      glEnable (GL_CLIP_PLANE2);
+    }
+
+    if (fG4OpenGLStoredSceneHandler.fTopPODL) 
+      glCallList (fG4OpenGLStoredSceneHandler.fTopPODL);
+
+    for (size_t i = 0; i < fG4OpenGLStoredSceneHandler.fTOList.size(); ++i) {
+#ifdef G4DEBUG_VIS_OGL
+      printf("-");
+#endif
+      G4OpenGLStoredSceneHandler::TO& to =
+	fG4OpenGLStoredSceneHandler.fTOList[i];
+      if (to.fEndTime >= fStartTime && to.fStartTime <= fEndTime) {
+	glPushMatrix();
+	G4OpenGLTransform3D oglt (to.fTransform);
+	glMultMatrixd (oglt.GetGLMatrix ());
+	if (fVP.IsPicking()) glLoadName(to.fPickName);
+	G4Colour& c = to.fColour;
+	G4double bsf = 1.;  // Brightness scaling factor.
+	if (fFadeFactor > 0. && to.fEndTime < fEndTime)
+	  bsf = 1. - fFadeFactor *
+	    ((fEndTime - to.fEndTime) / (fEndTime - fStartTime));
+	glColor3d(bsf * c.GetRed (), bsf * c.GetGreen (), bsf * c.GetBlue ());
+	glCallList (to.fDisplayListId);
+	glPopMatrix();
+      }
+    }
+
+    if (cutawayUnion) glDisable (GL_CLIP_PLANE2);
+  }
+#ifdef G4DEBUG_VIS_OGL
+      printf("\n");
+#endif
+
+  // Display time at "head" of time range, which is fEndTime...
+  if (fDisplayHeadTime && fEndTime < DBL_MAX) {
+    glMatrixMode (GL_PROJECTION);
+    glPushMatrix();
+    glLoadIdentity();
+    glOrtho (-1., 1., -1., 1., -G4OPENGL_FLT_BIG, G4OPENGL_FLT_BIG);
+    glMatrixMode (GL_MODELVIEW);
+    glPushMatrix();
+    glLoadIdentity();
+    G4Text headTimeText(G4BestUnit(fEndTime,"Time"),
+			G4Point3D(fDisplayHeadTimeX, fDisplayHeadTimeY, 0.));
+    headTimeText.SetScreenSize(fDisplayHeadTimeSize);
+    G4VisAttributes visAtts (G4Colour
+			     (fDisplayHeadTimeRed,
+			      fDisplayHeadTimeGreen,
+			      fDisplayHeadTimeBlue));
+    headTimeText.SetVisAttributes(&visAtts);
+    static_cast<G4OpenGLSceneHandler&>(fSceneHandler).
+      G4OpenGLSceneHandler::AddPrimitive(headTimeText);
+    glMatrixMode (GL_PROJECTION);
+    glPopMatrix();
+    glMatrixMode (GL_MODELVIEW);
+    glPopMatrix();
+  }
+
+  // Display light front...
+  if (fDisplayLightFront && fEndTime < DBL_MAX) {
+    G4double lightFrontRadius = (fEndTime - fDisplayLightFrontT) * c_light;
+    if (lightFrontRadius > 0.) {
+      G4Point3D lightFrontCentre(fDisplayLightFrontX, fDisplayLightFrontY, fDisplayLightFrontZ);
+      G4Point3D circleCentre = lightFrontCentre;
+      G4double circleRadius = lightFrontRadius;
+      if (fVP.GetFieldHalfAngle() > 0.) {
+	// Perspective view.  Find horizon centre and radius...
+	G4Point3D targetPoint = fSceneHandler.GetScene()->GetStandardTargetPoint() +
+	  fVP.GetCurrentTargetPoint();
+	G4double sceneRadius = fSceneHandler.GetScene()->GetExtent().GetExtentRadius();
+	if(sceneRadius <= 0.) sceneRadius = 1.;
+	G4double cameraDistance = fVP.GetCameraDistance(sceneRadius);
+	G4Point3D cameraPosition = targetPoint + cameraDistance * fVP.GetViewpointDirection().unit();
+	G4Vector3D lightFrontToCameraDirection = cameraPosition - lightFrontCentre;
+	G4double lightFrontCentreDistance = lightFrontToCameraDirection.mag();
+	/*
+	G4cout << "cameraPosition: " << cameraPosition
+	       << ", lightFrontCentre: " << lightFrontCentre
+	       << ", lightFrontRadius: " << lightFrontRadius
+	       << ", lightFrontCentreDistance: " << lightFrontCentreDistance
+	       << ", dot: " << lightFrontToCameraDirection * fVP.GetViewpointDirection()
+	       << G4endl;
+	*/
+	if (lightFrontToCameraDirection * fVP.GetViewpointDirection() > 0. && lightFrontRadius < lightFrontCentreDistance) {
+	  // Light front in front of camera...
+	  G4double sineHorizonAngle = lightFrontRadius / lightFrontCentreDistance;
+	  circleCentre = lightFrontCentre + (lightFrontRadius * sineHorizonAngle) * lightFrontToCameraDirection.unit();
+	  circleRadius = lightFrontRadius * std::sqrt(1. - std::pow(sineHorizonAngle, 2));
+	  /*
+	  G4cout << "sineHorizonAngle: " << sineHorizonAngle
+		 << ", circleCentre: " << circleCentre
+		 << ", circleRadius: " << circleRadius
+		 << G4endl;
+	  */
+	} else {
+	  circleRadius = -1.;
+	}
+      }
+      if (circleRadius > 0.) {
+	G4Circle lightFront(circleCentre);
+	lightFront.SetWorldRadius(circleRadius);
+	glColor3d(fDisplayLightFrontRed,
+		  fDisplayLightFrontGreen,
+		  fDisplayLightFrontBlue);
+	static_cast<G4OpenGLSceneHandler&>(fSceneHandler).
+	  G4OpenGLSceneHandler::AddPrimitive(lightFront);
+      }
+    }
+  }
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLStoredWin32.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLStoredWin32.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLStoredWin32.cc	(revision 1102)
@@ -0,0 +1,80 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLStoredWin32.cc,v 1.14 2006/08/14 12:07:19 allison Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
+//
+// 
+// OpenGLStoredWin32 graphics system factory.
+
+
+#ifdef G4VIS_BUILD_OPENGLWIN32_DRIVER
+
+#include "G4VisFeaturesOfOpenGL.hh"
+#include "G4VSceneHandler.hh"
+#include "G4OpenGLSceneHandler.hh"
+#include "G4OpenGLViewer.hh"
+#include "G4OpenGLStoredWin32.hh"
+#include "G4OpenGLStoredWin32Viewer.hh"
+#include "G4OpenGLViewerMessenger.hh"
+
+G4OpenGLStoredWin32::G4OpenGLStoredWin32 ():
+  G4VGraphicsSystem ("OpenGLStoredWin32",
+		     "OGLSWin32",
+		     G4VisFeaturesOfOpenGLSWin32 (),
+		     G4VGraphicsSystem::threeD)
+{
+  G4OpenGLViewerMessenger::GetInstance();
+}
+
+G4VSceneHandler* G4OpenGLStoredWin32::CreateSceneHandler
+(const G4String& name) {
+  G4VSceneHandler* pScene = new G4OpenGLStoredSceneHandler (*this, name);
+  return    pScene;
+}
+
+G4VViewer* G4OpenGLStoredWin32::CreateViewer
+(G4VSceneHandler& scene, const G4String& name) {
+  G4VViewer* pView =
+    new G4OpenGLStoredWin32Viewer ((G4OpenGLStoredSceneHandler&) scene, name);
+  if (pView) {
+    if (pView -> GetViewId () < 0) {
+      delete pView;
+      pView = 0;
+      G4cerr << "G4OpenGLStoredWin32::CreateViewer: error flagged by"
+	" negative view id in G4OpenGLStoredWin32Viewer creation."
+	"\n Destroying view and returning null pointer." << G4endl;
+    }
+  }
+  else {
+    G4cerr << "G4OpenGLStoredWin32::CreateViewer: null pointer on"
+      " new G4OpenGLStoredWin32Viewer." << G4endl;
+  }
+  return pView;
+}
+
+#endif
+
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLStoredWin32Viewer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLStoredWin32Viewer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLStoredWin32Viewer.cc	(revision 1102)
@@ -0,0 +1,140 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLStoredWin32Viewer.cc,v 1.22 2009/05/20 13:19:09 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Class G4OpenGLStoredWin32Viewer : a class derived from G4OpenGLWin32Viewer and
+//                             G4OpenGLStoredViewer.
+
+#ifdef G4VIS_BUILD_OPENGLWIN32_DRIVER
+
+#include "G4OpenGLStoredWin32Viewer.hh"
+
+#include "G4ios.hh"
+
+G4OpenGLStoredWin32Viewer::G4OpenGLStoredWin32Viewer
+(G4OpenGLStoredSceneHandler& sceneHandler,
+ const G4String&  name):
+G4OpenGLViewer (sceneHandler),
+G4OpenGLWin32Viewer (sceneHandler),
+G4OpenGLStoredViewer (sceneHandler),
+G4VViewer (sceneHandler, sceneHandler.IncrementViewCount (), name) {
+
+  if (fViewId < 0) return;  // In case error in base class instantiation.
+}
+
+void G4OpenGLStoredWin32Viewer::Initialise () {
+
+  //Check that G4OpenGLWin32Viewer got a double buffered colour visual
+
+  CreateGLWin32Context ();
+  CreateMainWindow ();
+  CreateFontLists ();
+
+// clear the buffers and window.
+  ClearView ();
+  FinishView ();
+
+  glDepthFunc (GL_LEQUAL);
+  glDepthMask (GL_TRUE);
+}
+
+void G4OpenGLStoredWin32Viewer::DrawView () {
+
+  //Make sure current viewer is attached and clean...
+  //Win32 version needed
+  //  glXMakeCurrent (dpy, win, cx);
+  glViewport (0, 0, getWinWidth(), getWinHeight());
+
+  G4ViewParameters::DrawingStyle style = GetViewParameters().GetDrawingStyle();
+
+  //See if things have changed from last time and remake if necessary...
+  // The fNeedKernelVisit flag might have been set by the user in
+  // /vis/viewer/rebuild, but if not, make decision and set flag only
+  // if necessary...
+  if (!fNeedKernelVisit) KernelVisitDecision ();
+  G4bool kernelVisitWasNeeded = fNeedKernelVisit; // Keep (ProcessView resets).
+  ProcessView ();
+
+  if(style!=G4ViewParameters::hlr &&
+     haloing_enabled) {
+
+    HaloingFirstPass ();
+    DrawDisplayLists ();
+    glFlush ();
+
+    HaloingSecondPass ();
+
+    DrawDisplayLists ();
+    FinishView ();
+
+  } else {
+
+    // If kernel visit was needed, drawing and FinishView will already
+    // have been done, so...
+    if (!kernelVisitWasNeeded) {
+      DrawDisplayLists ();
+      FinishView ();
+    } else {
+    // However, union cutaways are implemented in DrawDisplayLists, so make
+    // an extra pass...
+      if (fVP.IsCutaway() &&
+	  fVP.GetCutawayMode() == G4ViewParameters::cutawayUnion) {
+	ClearView();
+	DrawDisplayLists ();
+	FinishView ();
+      } else { // ADD TO AVOID KernelVisit=1 and nothing to display
+        DrawDisplayLists ();
+        FinishView ();
+      }
+    }
+  }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+void G4OpenGLStoredWin32Viewer::FinishView (
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  if(!fHDC) return;
+
+  glFlush ();
+  GLint renderMode;
+  glGetIntegerv(GL_RENDER_MODE, &renderMode);
+  if (renderMode == GL_RENDER) ::SwapBuffers(fHDC);
+
+  // Empty the Windows message queue :
+  MSG event;
+  while ( ::PeekMessage(&event, NULL, 0, 0, PM_REMOVE) ) {
+    ::TranslateMessage(&event);
+    ::DispatchMessage (&event);
+  }
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLStoredX.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLStoredX.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLStoredX.cc	(revision 1102)
@@ -0,0 +1,82 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLStoredX.cc,v 1.14 2007/08/21 14:05:51 allison Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
+//
+// 
+// Andrew Walkden  10th February 1997
+// OpenGL graphics system factory.
+
+
+#ifdef G4VIS_BUILD_OPENGLX_DRIVER
+
+#include "G4VisFeaturesOfOpenGL.hh"
+#include "G4VSceneHandler.hh"
+#include "G4OpenGLSceneHandler.hh"
+#include "G4OpenGLViewer.hh"
+#include "G4OpenGLStoredX.hh"
+#include "G4OpenGLStoredXViewer.hh"
+#include "G4OpenGLViewerMessenger.hh"
+
+G4OpenGLStoredX::G4OpenGLStoredX ():
+  G4VGraphicsSystem ("OpenGLStoredX",
+		     "OGLSX",
+		     G4VisFeaturesOfOpenGLSX (),
+		     G4VGraphicsSystem::threeD)
+{
+  G4OpenGLViewerMessenger::GetInstance();
+}
+
+G4OpenGLStoredX::~G4OpenGLStoredX () {}
+
+G4VSceneHandler* G4OpenGLStoredX::CreateSceneHandler (const G4String& name) {
+  G4VSceneHandler* pScene = new G4OpenGLStoredSceneHandler (*this, name);
+  return    pScene;
+}
+
+G4VViewer* G4OpenGLStoredX::CreateViewer (G4VSceneHandler& scene,
+				      const G4String& name) {
+  G4VViewer* pView =
+    new G4OpenGLStoredXViewer ((G4OpenGLStoredSceneHandler&) scene, name);
+  if (pView) {
+    if (pView -> GetViewId () < 0) {
+      delete pView;
+      pView = 0;
+      G4cerr << "G4OpenGLStoredX::CreateViewer: error flagged by"
+	" negative view id in G4OpenGLStoredXViewer creation."
+	"\n Destroying view and returning null pointer." << G4endl;
+    }
+  }
+  else {
+    G4cerr << "G4OpenGLStoredX::CreateViewer: null pointer on"
+      " new G4OpenGLStoredXViewer." << G4endl;
+  }
+  return pView;
+}
+
+#endif
+
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLStoredXViewer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLStoredXViewer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLStoredXViewer.cc	(revision 1102)
@@ -0,0 +1,159 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLStoredXViewer.cc,v 1.25 2009/04/08 16:55:44 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Andrew Walkden  7th February 1997
+// Class G4OpenGLStoredXViewer : a class derived from G4OpenGLXViewer and
+//                             G4OpenGLStoredViewer.
+
+#ifdef G4VIS_BUILD_OPENGLX_DRIVER
+
+#include "G4OpenGLStoredXViewer.hh"
+
+#include "G4ios.hh"
+
+G4OpenGLStoredXViewer::
+G4OpenGLStoredXViewer (G4OpenGLStoredSceneHandler& sceneHandler,
+		 const G4String& name)
+ : G4VViewer (sceneHandler, sceneHandler.IncrementViewCount (), name),
+   G4OpenGLViewer (sceneHandler),
+   G4OpenGLXViewer (sceneHandler),
+   G4OpenGLStoredViewer (sceneHandler)
+{
+  if (fViewId < 0) return;  // In case error in base class instantiation.
+
+  if (!vi_stored) {
+    fViewId = -1;  // This flags an error.
+    G4cerr << "G4OpenGLStoredXViewer::G4OpenGLStoredXViewer -"
+      " G4OpenGLXViewer couldn't get a visual." << G4endl;
+    return;
+  }
+}
+
+G4OpenGLStoredXViewer::~G4OpenGLStoredXViewer () {}
+
+void G4OpenGLStoredXViewer::Initialise () {
+
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLStoredXViewer::Initialise\n");
+#endif
+  CreateGLXContext (vi_stored);
+  CreateMainWindow ();
+  CreateFontLists ();
+
+  InitializeGLView ();
+
+// clear the buffers and window.
+  ClearView ();
+  FinishView ();
+
+  glDepthFunc (GL_LEQUAL);
+  glDepthMask (GL_TRUE);
+}
+
+void G4OpenGLStoredXViewer::DrawView () {
+
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLStoredXViewer::DrawView\n");
+#endif
+  //Make sure current viewer is attached and clean...
+  glXMakeCurrent (dpy, win, cx);
+
+  G4ViewParameters::DrawingStyle style = GetViewParameters().GetDrawingStyle();
+
+  //See if things have changed from last time and remake if necessary...
+  // The fNeedKernelVisit flag might have been set by the user in
+  // /vis/viewer/rebuild, but if not, make decision and set flag only
+  // if necessary...
+  if (!fNeedKernelVisit) KernelVisitDecision ();
+  G4bool kernelVisitWasNeeded = fNeedKernelVisit; // Keep (ProcessView resets).
+  ProcessView ();
+
+  if(style!=G4ViewParameters::hlr &&
+     haloing_enabled) {
+
+    HaloingFirstPass ();
+    DrawDisplayLists ();
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLStoredXViewer::DrawView flush \n");
+#endif
+    glFlush ();
+
+    HaloingSecondPass ();
+
+    DrawDisplayLists ();
+    FinishView ();
+
+  } else {
+
+    // If kernel visit was needed, drawing and FinishView will already
+    // have been done, so...
+    if (!kernelVisitWasNeeded) {
+#ifdef G4DEBUG_VIS_OGL
+      printf("G4OpenGLStoredXViewer::DrawView NO need kernel visit\n");
+#endif
+      DrawDisplayLists ();
+      FinishView ();
+    } else {
+#ifdef G4DEBUG_VIS_OGL
+      printf("G4OpenGLStoredXViewer::DrawView NEED kernel visit\n");
+#endif
+    // However, union cutaways are implemented in DrawDisplayLists, so make
+    // an extra pass...
+      if (fVP.IsCutaway() &&
+	  fVP.GetCutawayMode() == G4ViewParameters::cutawayUnion) {
+	ClearView();
+	DrawDisplayLists ();
+	FinishView ();
+      } else { // ADD TO AVOID KernelVisit=1 and nothing to display
+        DrawDisplayLists ();
+        FinishView ();
+      }
+    }
+  }
+}
+
+void G4OpenGLStoredXViewer::FinishView () {
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLStoredXViewer::FinishView\n");
+#endif
+  glXWaitGL (); //Wait for effects of all previous OpenGL commands to
+                //be propogated before progressing.
+
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLStoredXViewer::FinishView flush \n");
+#endif
+  glFlush (); //FIXME
+
+  GLint renderMode;
+  glGetIntegerv(GL_RENDER_MODE, &renderMode);
+  if (renderMode == GL_RENDER) glXSwapBuffers (dpy, win);  
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLStoredXm.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLStoredXm.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLStoredXm.cc	(revision 1102)
@@ -0,0 +1,79 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLStoredXm.cc,v 1.12 2009/01/19 16:53:42 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Andrew Walkden  10th February 1997
+// OpenGL graphics system factory.
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4VisFeaturesOfOpenGL.hh"
+#include "G4VSceneHandler.hh"
+#include "G4OpenGLSceneHandler.hh"
+#include "G4OpenGLViewer.hh"
+#include "G4OpenGLStoredXm.hh"
+#include "G4OpenGLStoredXmViewer.hh"
+#include "G4OpenGLViewerMessenger.hh"
+#include "G4OpenGLXmViewerMessenger.hh"
+
+G4OpenGLStoredXm::G4OpenGLStoredXm ():
+  G4VGraphicsSystem ("OpenGLStoredXm",
+		     "OGLSXm",
+		     G4VisFeaturesOfOpenGLSXm (),
+		     G4VGraphicsSystem::threeD)
+{
+  G4OpenGLViewerMessenger::GetInstance();
+  G4OpenGLXmViewerMessenger::GetInstance();
+}
+
+G4VSceneHandler* G4OpenGLStoredXm::CreateSceneHandler (const G4String& name) {
+  G4VSceneHandler* pScene = new G4OpenGLStoredSceneHandler (*this, name);
+  return    pScene;
+}
+
+G4VViewer* G4OpenGLStoredXm::CreateViewer (G4VSceneHandler& scene, const G4String& name) {
+  G4VViewer* pView =
+    new G4OpenGLStoredXmViewer ((G4OpenGLStoredSceneHandler&) scene, name);
+  if (pView) {
+    if (pView -> GetViewId () < 0) {
+      delete pView;
+      pView = 0;
+      G4cerr << "G4OpenGLStoredXm::CreateViewer: error flagged by"
+	" negative view id in G4OpenGLStoredXmViewer creation."
+	"\n Destroying view and returning null pointer." << G4endl;
+    }
+  }
+  else {
+    G4cerr << "G4OpenGLStoredXm::CreateViewer: null pointer on"
+      " new G4OpenGLStoredXmViewer." << G4endl;
+  }
+  return pView;
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLStoredXmViewer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLStoredXmViewer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLStoredXmViewer.cc	(revision 1102)
@@ -0,0 +1,164 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLStoredXmViewer.cc,v 1.25 2009/04/08 16:55:44 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Andrew Walkden  10th February 1997
+// Class G4OpenGLStoredXmViewer : a class derived from G4OpenGLXmViewer 
+//                              and G4OpenGLStoredViewer.
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4OpenGLStoredXmViewer.hh"
+
+#include "G4ios.hh"
+
+G4OpenGLStoredXmViewer::
+G4OpenGLStoredXmViewer (G4OpenGLStoredSceneHandler& sceneHandler,
+			const G4String& name)
+ : G4VViewer (sceneHandler, sceneHandler.IncrementViewCount (), name),
+   G4OpenGLViewer (sceneHandler),
+   G4OpenGLXmViewer (sceneHandler),
+   G4OpenGLStoredViewer (sceneHandler)
+{
+
+  if (fViewId < 0) return;  // In case error in base class instantiation.
+
+  if (!vi_stored) {
+    fViewId = -1;  // This flags an error.
+    G4cerr << "G4OpenGLStoredXmViewer::G4OpenGLStoredXmViewer -"
+      " G4OpenGLXmViewer couldn't get a visual." << G4endl;
+    return;
+  }
+}
+
+G4OpenGLStoredXmViewer::~G4OpenGLStoredXmViewer () {}
+
+void G4OpenGLStoredXmViewer::Initialise () {
+
+  CreateGLXContext (vi_stored);
+  CreateMainWindow ();
+  CreateFontLists ();
+
+  InitializeGLView ();
+
+// clear the buffers and window.
+  ClearView ();
+  FinishView ();
+  
+  glDepthFunc (GL_LEQUAL);
+  glDepthMask (GL_TRUE);
+  
+  glEnable (GL_BLEND);
+  glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+  glDrawBuffer (GL_BACK);
+}
+
+void G4OpenGLStoredXmViewer::DrawView () {
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLStoredXmViewer::DrawView \n");
+#endif
+
+  //Make sure current viewer is attached and clean...
+  glXMakeCurrent (dpy, win, cx);
+
+  G4ViewParameters::DrawingStyle style = GetViewParameters().GetDrawingStyle();
+
+  //See if things have changed from last time and remake if necessary...
+  // /vis/viewer/rebuild, but if not, make decision and set flag only
+  // if necessary...
+  if (!fNeedKernelVisit) KernelVisitDecision ();
+  G4bool kernelVisitWasNeeded = fNeedKernelVisit; // Keep (ProcessView resets).
+  ProcessView ();
+
+  if(style!=G4ViewParameters::hlr &&
+     haloing_enabled) {
+
+    HaloingFirstPass ();
+    DrawDisplayLists ();
+#ifdef G4DEBUG_VIS_OGL
+    printf("G4OpenGLStoredXmViewer::DrawView () flush\n");
+#endif
+    glFlush ();
+
+    HaloingSecondPass ();
+
+    DrawDisplayLists ();
+    FinishView ();
+
+  } else {
+
+#ifdef G4DEBUG_VIS_OGL
+    printf("G4OpenGLStoredXmViewer::DrawView not hlr \n");
+#endif
+    // If kernel visit was needed, drawing and FinishView will already
+    // have been done, so...
+    if (!kernelVisitWasNeeded) {
+#ifdef G4DEBUG_VIS_OGL
+      printf("G4OpenGLStoredXmViewer::ComputeView Don't need kernel Visit \n");
+#endif
+      DrawDisplayLists ();
+      FinishView ();
+    } else {
+#ifdef G4DEBUG_VIS_OGL
+      printf("G4OpenGLStoredXmViewer::ComputeView Need kernel Visit \n");
+#endif
+    // However, union cutaways are implemented in DrawDisplayLists, so make
+    // an extra pass...
+      if (fVP.IsCutaway() &&
+	  fVP.GetCutawayMode() == G4ViewParameters::cutawayUnion) {
+	ClearView();
+	DrawDisplayLists ();
+	FinishView ();
+      } else { // ADD TO AVOID KernelVisit=1 and nothing to display
+        DrawDisplayLists ();
+        FinishView ();
+      }
+    }
+  }
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLStoredXmViewer::DrawView  ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");
+#endif
+}
+
+void G4OpenGLStoredXmViewer::FinishView () {
+  glXWaitGL (); //Wait for effects of all previous OpenGL commands to
+                //be propogated before progressing.
+
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLStoredXmViewer::FinishView () flush \n");
+#endif
+  glFlush (); //FIXME
+
+  GLint renderMode;
+  glGetIntegerv(GL_RENDER_MODE, &renderMode);
+  if (renderMode == GL_RENDER) glXSwapBuffers (dpy, win);  
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLTransform3D.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLTransform3D.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLTransform3D.cc	(revision 1102)
@@ -0,0 +1,57 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLTransform3D.cc,v 1.8 2006/06/29 21:19:32 gunter Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
+//
+// 
+// Andrew Walkden  24th October 1996
+// G4OpenGLTransform3D provides OpenGL style transformation matrix
+// from G4Transform3D.
+
+#ifdef G4VIS_BUILD_OPENGL_DRIVER
+
+#include "G4OpenGLTransform3D.hh"
+
+G4OpenGLTransform3D::G4OpenGLTransform3D (const G4Transform3D &t):
+  G4Transform3D (t) {}
+
+const GLdouble* G4OpenGLTransform3D::GetGLMatrix () 
+{
+  GLdouble *p = m;
+  for (size_t i=0; i<4; i++)
+  { 
+    for (size_t k=0; k<3; k++)
+    {
+      *p++ = operator()(k,i);
+    }
+    *p++ = 0.; 
+  } 
+  m[15] = 1.; 
+  return m;
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLViewer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLViewer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLViewer.cc	(revision 1102)
@@ -0,0 +1,848 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLViewer.cc,v 1.57 2009/08/19 13:28:10 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Andrew Walkden  27th March 1996
+// OpenGL view - opens window, hard copy, etc.
+
+#ifdef G4VIS_BUILD_OPENGL_DRIVER
+
+#include "G4ios.hh"
+#include "G4OpenGLViewer.hh"
+#include "G4OpenGLSceneHandler.hh"
+#include "G4OpenGLTransform3D.hh"
+#include "G4OpenGL2PSAction.hh"
+
+#include "G4Scene.hh"
+#include "G4VisExtent.hh"
+#include "G4LogicalVolume.hh"
+#include "G4VSolid.hh"
+#include "G4Point3D.hh"
+#include "G4Normal3D.hh"
+#include "G4Plane3D.hh"
+#include "G4AttHolder.hh"
+#include "G4AttCheck.hh"
+
+// GL2PS
+#include "Geant4_gl2ps.h"
+
+#include <sstream>
+
+G4OpenGLViewer::G4OpenGLViewer (G4OpenGLSceneHandler& scene):
+G4VViewer (scene, -1),
+fPrintColour (true),
+fVectoredPs (true),
+fOpenGLSceneHandler(scene),
+background (G4Colour(0.,0.,0.)),
+transparency_enabled (true),
+antialiasing_enabled (false),
+haloing_enabled (false),
+fStartTime(-DBL_MAX),
+fEndTime(DBL_MAX),
+fFadeFactor(0.),
+fDisplayHeadTime(false),
+fDisplayHeadTimeX(-0.9),
+fDisplayHeadTimeY(-0.9),
+fDisplayHeadTimeSize(24.),
+fDisplayHeadTimeRed(0.),
+fDisplayHeadTimeGreen(1.),
+fDisplayHeadTimeBlue(1.),
+fDisplayLightFront(false),
+fDisplayLightFrontX(0.),
+fDisplayLightFrontY(0.),
+fDisplayLightFrontZ(0.),
+fDisplayLightFrontT(0.),
+fDisplayLightFrontRed(0.),
+fDisplayLightFrontGreen(1.),
+fDisplayLightFrontBlue(0.),
+fPrintSizeX(-1),
+fPrintSizeY(-1),
+fPrintFilename ("G4OpenGL"),
+fPrintFilenameIndex(0),
+fPointSize (0),
+fSizeHasChanged(0)
+{
+  // Make changes to view parameters for OpenGL...
+  fVP.SetAutoRefresh(true);
+  fDefaultVP.SetAutoRefresh(true);
+
+  fGL2PSAction = new G4OpenGL2PSAction();
+
+  //  glClearColor (0.0, 0.0, 0.0, 0.0);
+  //  glClearDepth (1.0);
+  //  glDisable (GL_BLEND);
+  //  glDisable (GL_LINE_SMOOTH);
+  //  glDisable (GL_POLYGON_SMOOTH);
+
+}
+
+G4OpenGLViewer::~G4OpenGLViewer () {}
+
+void G4OpenGLViewer::InitializeGLView () 
+{
+  glClearColor (0.0, 0.0, 0.0, 0.0);
+  glClearDepth (1.0);
+  glDisable (GL_BLEND);
+  glDisable (GL_LINE_SMOOTH);
+  glDisable (GL_POLYGON_SMOOTH);
+
+  fWinSize_x = fVP.GetWindowSizeHintX();
+  fWinSize_y = fVP.GetWindowSizeHintY();
+}  
+
+void G4OpenGLViewer::ClearView () {
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLViewer::ClearView\n");
+#endif
+  glClearColor (background.GetRed(),
+		background.GetGreen(),
+		background.GetBlue(),
+		1.);
+  glClearDepth (1.0);
+  //Below line does not compile with Mesa includes. 
+  //glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 
+  glClear (GL_COLOR_BUFFER_BIT);
+  glClear (GL_DEPTH_BUFFER_BIT);
+  glClear (GL_STENCIL_BUFFER_BIT);
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLViewer::ClearView flush\n");
+#endif
+  glFlush ();
+}
+
+
+void G4OpenGLViewer::ResizeWindow(unsigned int aWidth, unsigned int aHeight) {
+  if ((fWinSize_x != aWidth) || (fWinSize_y != aHeight)) {
+    fWinSize_x = aWidth;
+    fWinSize_y = aHeight;
+    fSizeHasChanged = true;
+  } else {
+    fSizeHasChanged = false;
+  }
+}
+
+/**
+ * Set the viewport of the scene
+ * MAXIMUM SIZE is :
+ * GLint dims[2];
+ * glGetIntegerv(GL_MAX_VIEWPORT_DIMS, dims);
+ */
+void G4OpenGLViewer::ResizeGLView()
+{
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLViewer::ResizeGLView %d %d\n",fWinSize_x,fWinSize_y);
+#endif
+  // Check size
+  GLint dims[2];
+  glGetIntegerv(GL_MAX_VIEWPORT_DIMS, dims);
+  if (fWinSize_x > (unsigned)dims[0]) {
+    G4cerr << "Try to resize view greater than max X viewport dimension. Desired size "<<dims[0] <<" is resize to "<<  dims[0] << G4endl;
+    fWinSize_x = dims[0];
+  }
+  if (fWinSize_y > (unsigned)dims[1]) {
+    G4cerr << "Try to resize view greater than max Y viewport dimension. Desired size "<<dims[0] <<" is resize to "<<  dims[1] << G4endl;
+    fWinSize_y = dims[1];
+  }
+  GLsizei side = fWinSize_x;
+  if (fWinSize_y < fWinSize_x) side = fWinSize_y;
+
+  // SPECIAL CASE if fWinSize_x is even (69 for example) 
+  // Ex : X: 69 Y: 26
+  // side = 26
+  // width / 2 = 21,5
+  // height / 2 = 0
+  // Should be fixed to closed : 21 0 for ex
+  // Then size must by change to :
+  // X:68 Y: 26
+
+  // SPECIAL CASE
+  if ((fWinSize_x - side)%2) {
+    //    fWinSize_x --;
+
+    side = fWinSize_x;
+    if (fWinSize_y < fWinSize_x) side = fWinSize_y;
+  }
+  if ((fWinSize_y - side)%2) {
+    //    fWinSize_y --;
+
+    side = fWinSize_x;
+    if (fWinSize_y < fWinSize_x) side = fWinSize_y;
+  }
+  
+  GLint X = (fWinSize_x - side) / 2;
+  GLint Y = (fWinSize_y - side) / 2;
+  
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLViewer::ResizeGLView X:%d Y:%d W:%d H:%d --side%d\n",(fWinSize_x - side) / 2,(fWinSize_y - side) / 2,fWinSize_x,fWinSize_y,side);
+#endif
+  glViewport(X, Y, side, side);
+  //    glViewport(0, 0, fWinSize_x,fWinSize_y);  
+  
+
+}
+
+
+void G4OpenGLViewer::SetView () {
+
+  if (!fSceneHandler.GetScene()) {
+    G4cerr << "G4OpenGLStoredViewer: Creating a Viewer without a scene is not allowed. \nPlease use /vis/scene/create before /vis/open/.... "
+	   << G4endl;
+    return;
+  }
+  // Calculates view representation based on extent of object being
+  // viewed and (initial) viewpoint.  (Note: it can change later due
+  // to user interaction via visualization system's GUI.)
+  
+  // Lighting.
+  GLfloat lightPosition [4];
+  lightPosition [0] = fVP.GetActualLightpointDirection().x();
+  lightPosition [1] = fVP.GetActualLightpointDirection().y();
+  lightPosition [2] = fVP.GetActualLightpointDirection().z();
+  lightPosition [3] = 0.;
+  // Light position is "true" light direction, so must come after gluLookAt.
+  GLfloat ambient [] = { 0.2, 0.2, 0.2, 1.};
+  GLfloat diffuse [] = { 0.8, 0.8, 0.8, 1.};
+  glEnable (GL_LIGHT0);
+  glLightfv (GL_LIGHT0, GL_AMBIENT, ambient);
+  glLightfv (GL_LIGHT0, GL_DIFFUSE, diffuse);
+  
+  // Get radius of scene, etc.
+  // Note that this procedure properly takes into account zoom, dolly and pan.
+  const G4Point3D targetPoint
+    = fSceneHandler.GetScene()->GetStandardTargetPoint()
+    + fVP.GetCurrentTargetPoint ();
+  G4double radius = fSceneHandler.GetScene()->GetExtent().GetExtentRadius();
+  if(radius<=0.) radius = 1.;
+  const G4double cameraDistance = fVP.GetCameraDistance (radius);
+  const G4Point3D cameraPosition =
+    targetPoint + cameraDistance * fVP.GetViewpointDirection().unit();
+  const GLdouble pnear  = fVP.GetNearDistance (cameraDistance, radius);
+  const GLdouble pfar   = fVP.GetFarDistance  (cameraDistance, pnear, radius);
+  const GLdouble right  = fVP.GetFrontHalfHeight (pnear, radius);
+  const GLdouble left   = -right;
+  const GLdouble bottom = left;
+  const GLdouble top    = right;
+  
+  // FIXME
+  ResizeGLView();
+  //SHOULD SetWindowsSizeHint()...
+
+  glMatrixMode (GL_PROJECTION); // set up Frustum.
+  glLoadIdentity();
+
+  const G4Vector3D scaleFactor = fVP.GetScaleFactor();
+  glScaled(scaleFactor.x(),scaleFactor.y(),scaleFactor.z());
+  
+  if (fVP.GetFieldHalfAngle() == 0.) {
+    glOrtho (left, right, bottom, top, pnear, pfar);
+  }
+  else {
+    glFrustum (left, right, bottom, top, pnear, pfar);
+  }  
+
+  glMatrixMode (GL_MODELVIEW); // apply further transformations to scene.
+  glLoadIdentity();
+  
+  const G4Normal3D& upVector = fVP.GetUpVector ();  
+  G4Point3D gltarget;
+  if (cameraDistance > 1.e-6 * radius) {
+    gltarget = targetPoint;
+  }
+  else {
+    gltarget = targetPoint - radius * fVP.GetViewpointDirection().unit();
+  }
+
+  const G4Point3D& pCamera = cameraPosition;  // An alias for brevity.
+  gluLookAt (pCamera.x(),  pCamera.y(),  pCamera.z(),       // Viewpoint.
+	     gltarget.x(), gltarget.y(), gltarget.z(),      // Target point.
+	     upVector.x(), upVector.y(), upVector.z());     // Up vector.
+
+  // Light position is "true" light direction, so must come after gluLookAt.
+  glLightfv (GL_LIGHT0, GL_POSITION, lightPosition);
+
+  // OpenGL no longer seems to reconstruct clipped edges, so, when the
+  // BooleanProcessor is up to it, abandon this and use generic
+  // clipping in G4OpenGLSceneHandler::CreateSectionPolyhedron.  Also,
+  // force kernel visit on change of clipping plane in
+  // G4OpenGLStoredViewer::CompareForKernelVisit.
+  if (fVP.IsSection () ) {  // pair of back to back clip planes.
+    const G4Plane3D& s = fVP.GetSectionPlane ();
+    double sArray[4];
+    sArray[0] = s.a();
+    sArray[1] = s.b();
+    sArray[2] = s.c();
+    sArray[3] = s.d() + radius * 1.e-05;
+    glClipPlane (GL_CLIP_PLANE0, sArray);
+    glEnable (GL_CLIP_PLANE0);
+    sArray[0] = -s.a();
+    sArray[1] = -s.b();
+    sArray[2] = -s.c();
+    sArray[3] = -s.d() + radius * 1.e-05;
+    glClipPlane (GL_CLIP_PLANE1, sArray);
+    glEnable (GL_CLIP_PLANE1);
+  } else {
+    glDisable (GL_CLIP_PLANE0);
+    glDisable (GL_CLIP_PLANE1);
+  }
+
+  const G4Planes& cutaways = fVP.GetCutawayPlanes();
+  size_t nPlanes = cutaways.size();
+  if (fVP.IsCutaway() &&
+      fVP.GetCutawayMode() == G4ViewParameters::cutawayIntersection &&
+      nPlanes > 0) {
+    double a[4];
+    a[0] = cutaways[0].a();
+    a[1] = cutaways[0].b();
+    a[2] = cutaways[0].c();
+    a[3] = cutaways[0].d();
+    glClipPlane (GL_CLIP_PLANE2, a);
+    glEnable (GL_CLIP_PLANE2);
+    if (nPlanes > 1) {
+      a[0] = cutaways[1].a();
+      a[1] = cutaways[1].b();
+      a[2] = cutaways[1].c();
+      a[3] = cutaways[1].d();
+      glClipPlane (GL_CLIP_PLANE3, a);
+      glEnable (GL_CLIP_PLANE3);
+    }
+    if (nPlanes > 2) {
+      a[0] = cutaways[2].a();
+      a[1] = cutaways[2].b();
+      a[2] = cutaways[2].c();
+      a[3] = cutaways[2].d();
+      glClipPlane (GL_CLIP_PLANE4, a);
+      glEnable (GL_CLIP_PLANE4);
+    }
+  } else {
+    glDisable (GL_CLIP_PLANE2);
+    glDisable (GL_CLIP_PLANE3);
+    glDisable (GL_CLIP_PLANE4);
+  }
+
+  // Background.
+  background = fVP.GetBackgroundColour ();
+
+}
+
+void G4OpenGLViewer::HaloingFirstPass () {
+  
+  //To perform haloing, first Draw all information to the depth buffer
+  //alone, using a chunky line width, and then Draw all info again, to
+  //the colour buffer, setting a thinner line width an the depth testing 
+  //function to less than or equal, so if two lines cross, the one 
+  //passing behind the other will not pass the depth test, and so not
+  //get rendered either side of the infront line for a short distance.
+
+  //First, disable writing to the colo(u)r buffer...
+  glColorMask (GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
+
+  //Now enable writing to the depth buffer...
+  glDepthMask (GL_TRUE);
+  glDepthFunc (GL_LESS);
+  glClearDepth (1.0);
+
+  //Finally, set the line width to something wide...
+  glLineWidth (3.0);
+
+}
+
+void G4OpenGLViewer::HaloingSecondPass () {
+
+  //And finally, turn the colour buffer back on with a sesible line width...
+  glColorMask (GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
+  glDepthFunc (GL_LEQUAL);
+  glLineWidth (1.0);
+
+}
+
+void G4OpenGLViewer::Pick(GLdouble x, GLdouble y)
+{
+  //G4cout << "X: " << x << ", Y: " << y << G4endl;
+  const G4int BUFSIZE = 512;
+  GLuint selectBuffer[BUFSIZE];
+  glSelectBuffer(BUFSIZE, selectBuffer);
+  glRenderMode(GL_SELECT);
+  glInitNames();
+  glPushName(0);
+  glMatrixMode(GL_PROJECTION);
+  G4double currentProjectionMatrix[16];
+  glGetDoublev(GL_PROJECTION_MATRIX, currentProjectionMatrix);
+  glPushMatrix();
+  glLoadIdentity();
+  GLint viewport[4];
+  glGetIntegerv(GL_VIEWPORT, viewport);
+  // Define 5x5 pixel pick area
+  gluPickMatrix(x, viewport[3] - y, 5., 5., viewport);
+  glMultMatrixd(currentProjectionMatrix);
+  glMatrixMode(GL_MODELVIEW);
+  DrawView();
+  GLint hits = glRenderMode(GL_RENDER);
+  if (hits < 0)
+    G4cout << "Too many hits.  Zoom in to reduce overlaps." << G4cout;
+  else if (hits > 0) {
+    //G4cout << hits << " hit(s)" << G4endl;
+    GLuint* p = selectBuffer;
+    for (GLint i = 0; i < hits; ++i) {
+      GLuint nnames = *p++;
+      *p++; //OR GLuint zmin = *p++;
+      *p++; //OR GLuint zmax = *p++;
+      //G4cout << "Hit " << i << ": " << nnames << " names"
+      //     << "\nzmin: " << zmin << ", zmax: " << zmax << G4endl;
+      for (GLuint j = 0; j < nnames; ++j) {
+	GLuint name = *p++;
+	//G4cout << "Name " << j << ": PickName: " << name << G4endl;
+	std::map<GLuint, G4AttHolder*>::iterator iter =
+	  fOpenGLSceneHandler.fPickMap.find(name);
+	if (iter != fOpenGLSceneHandler.fPickMap.end()) {
+	  G4AttHolder* attHolder = iter->second;
+	  if(attHolder && attHolder->GetAttDefs().size()) {
+	    for (size_t i = 0; i < attHolder->GetAttDefs().size(); ++i) {
+	      G4cout << G4AttCheck(attHolder->GetAttValues()[i],
+				   attHolder->GetAttDefs()[i]);
+	    }
+	  }
+	}
+      }
+      G4cout << G4endl;
+    }
+  }
+  glMatrixMode(GL_PROJECTION);
+  glPopMatrix();
+  glMatrixMode(GL_MODELVIEW);
+}
+
+
+
+
+GLubyte* G4OpenGLViewer::grabPixels (int inColor, unsigned int width, unsigned int height) {
+  
+  GLubyte* buffer;
+  GLint swapbytes, lsbfirst, rowlength;
+  GLint skiprows, skippixels, alignment;
+  GLenum format;
+  int size;
+
+  if (inColor) {
+    format = GL_RGB;
+    size = width*height*3;
+  } else {
+    format = GL_LUMINANCE;
+    size = width*height*1;
+  }
+
+  buffer = new GLubyte[size];
+  if (buffer == NULL)
+    return NULL;
+
+  glGetIntegerv (GL_UNPACK_SWAP_BYTES, &swapbytes);
+  glGetIntegerv (GL_UNPACK_LSB_FIRST, &lsbfirst);
+  glGetIntegerv (GL_UNPACK_ROW_LENGTH, &rowlength);
+
+  glGetIntegerv (GL_UNPACK_SKIP_ROWS, &skiprows);
+  glGetIntegerv (GL_UNPACK_SKIP_PIXELS, &skippixels);
+  glGetIntegerv (GL_UNPACK_ALIGNMENT, &alignment);
+
+  glPixelStorei (GL_UNPACK_SWAP_BYTES, GL_FALSE);
+  glPixelStorei (GL_UNPACK_LSB_FIRST, GL_FALSE);
+  glPixelStorei (GL_UNPACK_ROW_LENGTH, 0);
+
+  glPixelStorei (GL_UNPACK_SKIP_ROWS, 0);
+  glPixelStorei (GL_UNPACK_SKIP_PIXELS, 0);
+  glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
+
+  glReadBuffer(GL_FRONT);
+  glReadPixels (0, 0, (GLsizei)width, (GLsizei)height, format, GL_UNSIGNED_BYTE, (GLvoid*) buffer);
+
+  glPixelStorei (GL_UNPACK_SWAP_BYTES, swapbytes);
+  glPixelStorei (GL_UNPACK_LSB_FIRST, lsbfirst);
+  glPixelStorei (GL_UNPACK_ROW_LENGTH, rowlength);
+  
+  glPixelStorei (GL_UNPACK_SKIP_ROWS, skiprows);
+  glPixelStorei (GL_UNPACK_SKIP_PIXELS, skippixels);
+  glPixelStorei (GL_UNPACK_ALIGNMENT, alignment);
+  
+  return buffer;
+}
+
+void G4OpenGLViewer::printEPS() {
+  bool res;
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLViewer::printEPS file:%s Vec:%d Name:%s\n",getRealPrintFilename().c_str(),fVectoredPs,GetName().c_str());
+#endif
+  if (fVectoredPs) {
+    res = printVectoredEPS();
+  } else {
+    res = printNonVectoredEPS();
+  }
+  if (res == false) {
+    G4cerr << "Error while saving file... "<<getRealPrintFilename().c_str()<< G4endl;
+  } else {
+    G4cout << "File "<<getRealPrintFilename().c_str()<<" has been saved " << G4endl;
+  }
+
+  // increment index if necessary
+  if ( fPrintFilenameIndex != -1) {
+    fPrintFilenameIndex++;
+  }
+
+}
+
+bool G4OpenGLViewer::printVectoredEPS() {
+  return printGl2PS();
+}
+
+bool G4OpenGLViewer::printNonVectoredEPS () {
+
+  int width = getRealPrintSizeX();
+  int height = getRealPrintSizeY();
+
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLViewer::printNonVectoredEPS file:%s Vec:%d X:%d Y:%d col:%d\n",getRealPrintFilename().c_str(),fVectoredPs,width,height,fPrintColour);
+#endif
+  FILE* fp;
+  GLubyte* pixels;
+  GLubyte* curpix;
+  int components, pos, i;
+
+  pixels = grabPixels (fPrintColour, width, height);
+
+  if (pixels == NULL) {
+      G4cerr << "Failed to get pixels from OpenGl viewport" << G4endl;
+    return false;
+  }
+  if (fPrintColour) {
+    components = 3;
+  } else {
+    components = 1;
+  }
+  std::string name = getRealPrintFilename();
+  fp = fopen (name.c_str(), "w");
+  if (fp == NULL) {
+    G4cerr << "Can't open filename " << name.c_str() << G4endl;
+    return false;
+  }
+  
+  fprintf (fp, "%%!PS-Adobe-2.0 EPSF-1.2\n");
+  fprintf (fp, "%%%%Title: %s\n", name.c_str());
+  fprintf (fp, "%%%%Creator: OpenGL pixmap render output\n");
+  fprintf (fp, "%%%%BoundingBox: 0 0 %d %d\n", width, height);
+  fprintf (fp, "%%%%EndComments\n");
+  fprintf (fp, "gsave\n");
+  fprintf (fp, "/bwproc {\n");
+  fprintf (fp, "    rgbproc\n");
+  fprintf (fp, "    dup length 3 idiv string 0 3 0 \n");
+  fprintf (fp, "    5 -1 roll {\n");
+  fprintf (fp, "    add 2 1 roll 1 sub dup 0 eq\n");
+  fprintf (fp, "    { pop 3 idiv 3 -1 roll dup 4 -1 roll dup\n");
+  fprintf (fp, "       3 1 roll 5 -1 roll } put 1 add 3 0 \n");
+  fprintf (fp, "    { 2 1 roll } ifelse\n");
+  fprintf (fp, "    }forall\n");
+  fprintf (fp, "    pop pop pop\n");
+  fprintf (fp, "} def\n");
+  fprintf (fp, "systemdict /colorimage known not {\n");
+  fprintf (fp, "   /colorimage {\n");
+  fprintf (fp, "       pop\n");
+  fprintf (fp, "       pop\n");
+  fprintf (fp, "       /rgbproc exch def\n");
+  fprintf (fp, "       { bwproc } image\n");
+  fprintf (fp, "   }  def\n");
+  fprintf (fp, "} if\n");
+  fprintf (fp, "/picstr %d string def\n", width * components);
+  fprintf (fp, "%d %d scale\n", width, height);
+  fprintf (fp, "%d %d %d\n", width, height, 8);
+  fprintf (fp, "[%d 0 0 %d 0 0]\n", width, height);
+  fprintf (fp, "{currentfile picstr readhexstring pop}\n");
+  fprintf (fp, "false %d\n", components);
+  fprintf (fp, "colorimage\n");
+  
+  curpix = (GLubyte*) pixels;
+  pos = 0;
+  for (i = width*height*components; i>0; i--) {
+    fprintf (fp, "%02hx ", *(curpix++));
+    if (++pos >= 32) {
+      fprintf (fp, "\n");
+      pos = 0; 
+    }
+  }
+  if (pos)
+    fprintf (fp, "\n");
+
+  fprintf (fp, "grestore\n");
+  fprintf (fp, "showpage\n");
+  delete pixels;
+  fclose (fp);
+
+  // Reset for next time (useful is size change)
+  //  fPrintSizeX = -1;
+  //  fPrintSizeY = -1;
+
+  return true;
+}
+
+
+bool G4OpenGLViewer::printGl2PS() {
+
+  int width = getRealPrintSizeX();
+  int height = getRealPrintSizeY();
+
+  if (!fGL2PSAction) return false;
+
+  fGL2PSAction->setFileName(getRealPrintFilename().c_str());
+  // try to resize
+  int X = fWinSize_x;
+  int Y = fWinSize_y;
+
+  fWinSize_x = width;
+  fWinSize_y = height;
+  ResizeGLView();
+  if (fGL2PSAction->enableFileWriting()) {
+
+    // By default, we choose the line width (trajectories...)
+    fGL2PSAction->setLineWidth(1);
+    // By default, we choose the point size (markers...)
+    fGL2PSAction->setPointSize(2);
+
+    DrawView ();
+    fGL2PSAction->disableFileWriting();
+  }
+
+  fWinSize_x = X;
+  fWinSize_y = Y;
+  ResizeGLView();
+
+  // Reset for next time (useful is size change)
+  //  fPrintSizeX = 0;
+  //  fPrintSizeY = 0;
+
+  return true;
+}
+
+unsigned int G4OpenGLViewer::getWinWidth() {
+  return fWinSize_x;
+}
+
+unsigned int G4OpenGLViewer::getWinHeight() {
+  return fWinSize_y;
+}
+
+G4bool G4OpenGLViewer::sizeHasChanged() {
+  return fSizeHasChanged;
+}
+
+G4int G4OpenGLViewer::getRealPrintSizeX() {
+  if (fPrintSizeX == -1) {
+    return fWinSize_x;
+  }
+  GLint dims[2];
+  glGetIntegerv(GL_MAX_VIEWPORT_DIMS, dims);
+  if (fPrintSizeX > dims[0]){
+    return dims[0];
+  }
+  if (fPrintSizeX < -1){
+    return 0;
+  }
+  return fPrintSizeX;
+}
+
+G4int G4OpenGLViewer::getRealPrintSizeY() {
+  if (fPrintSizeY == -1) {
+    return fWinSize_y;
+  }
+  GLint dims[2];
+  glGetIntegerv(GL_MAX_VIEWPORT_DIMS, dims);
+  if (fPrintSizeY > dims[1]){
+    return dims[1];
+  }
+  if (fPrintSizeY < -1){
+    return 0;
+  }
+  return fPrintSizeY;
+}
+
+void G4OpenGLViewer::setPrintSize(G4int X, G4int Y) {
+  fPrintSizeX = X;
+  fPrintSizeY = Y;
+}
+
+void G4OpenGLViewer::setPrintFilename(G4String name,G4bool inc) {
+  if (name != "") {
+    fPrintFilename = name;
+  } else {
+    fPrintFilename = "G4OpenGL";  // by default
+  }
+  if (inc) {
+    fPrintFilenameIndex=0;
+  } else {
+    fPrintFilenameIndex=-1;
+  }
+}
+
+std::string G4OpenGLViewer::getRealPrintFilename() {
+  std::string temp = fPrintFilename;
+  if (fPrintFilenameIndex != -1) {
+    temp += std::string("_");
+    std::ostringstream os;
+    os << fPrintFilenameIndex;
+    std::string nb_str = os.str();
+    temp += nb_str;
+  }
+  temp += ".eps";
+  return temp;
+}
+
+GLdouble G4OpenGLViewer::getSceneNearWidth()
+{
+  const G4Point3D targetPoint
+    = fSceneHandler.GetScene()->GetStandardTargetPoint()
+    + fVP.GetCurrentTargetPoint ();
+  G4double radius = fSceneHandler.GetScene()->GetExtent().GetExtentRadius();
+  if(radius<=0.) radius = 1.;
+  const G4double cameraDistance = fVP.GetCameraDistance (radius);
+  const GLdouble pnear   = fVP.GetNearDistance (cameraDistance, radius);
+  return 2 * fVP.GetFrontHalfHeight (pnear, radius);
+}
+
+GLdouble G4OpenGLViewer::getSceneFarWidth()
+{
+  const G4Point3D targetPoint
+    = fSceneHandler.GetScene()->GetStandardTargetPoint()
+    + fVP.GetCurrentTargetPoint ();
+  G4double radius = fSceneHandler.GetScene()->GetExtent().GetExtentRadius();
+  if(radius<=0.) radius = 1.;
+  const G4double cameraDistance = fVP.GetCameraDistance (radius);
+  const GLdouble pnear   = fVP.GetNearDistance (cameraDistance, radius);
+  const GLdouble pfar    = fVP.GetFarDistance  (cameraDistance, pnear, radius);
+  return 2 * fVP.GetFrontHalfHeight (pfar, radius);
+}
+
+
+GLdouble G4OpenGLViewer::getSceneDepth()
+{
+  const G4Point3D targetPoint
+    = fSceneHandler.GetScene()->GetStandardTargetPoint()
+    + fVP.GetCurrentTargetPoint ();
+  G4double radius = fSceneHandler.GetScene()->GetExtent().GetExtentRadius();
+  if(radius<=0.) radius = 1.;
+  const G4double cameraDistance = fVP.GetCameraDistance (radius);
+  const GLdouble pnear   = fVP.GetNearDistance (cameraDistance, radius);
+  return fVP.GetFarDistance  (cameraDistance, pnear, radius)- pnear;
+}
+
+
+
+void G4OpenGLViewer::rotateScene(G4double dx, G4double dy,G4double deltaRotation)
+{
+
+  G4Vector3D vp;
+  G4Vector3D up;
+  
+  G4Vector3D xprime;
+  G4Vector3D yprime;
+  G4Vector3D zprime;
+  
+  G4double delta_alpha;
+  G4double delta_theta;
+  
+  G4Vector3D new_vp;
+  G4Vector3D new_up;
+  
+  G4double cosalpha;
+  G4double sinalpha;
+  
+  G4Vector3D a1;
+  G4Vector3D a2;
+  G4Vector3D delta;
+  G4Vector3D viewPoint;
+
+    
+  //phi spin stuff here
+  
+  vp = fVP.GetViewpointDirection ().unit ();
+  up = fVP.GetUpVector ().unit ();
+  
+  yprime = (up.cross(vp)).unit();
+  zprime = (vp.cross(yprime)).unit();
+  
+  if (fVP.GetLightsMoveWithCamera()) {
+    delta_alpha = dy * deltaRotation;
+    delta_theta = -dx * deltaRotation;
+  } else {
+    delta_alpha = -dy * deltaRotation;
+    delta_theta = dx * deltaRotation;
+  }    
+  
+  delta_alpha *= deg;
+  delta_theta *= deg;
+  
+  new_vp = std::cos(delta_alpha) * vp + std::sin(delta_alpha) * zprime;
+  
+  // to avoid z rotation flipping
+  // to allow more than 360° rotation
+
+  const G4Point3D targetPoint
+    = fSceneHandler.GetScene()->GetStandardTargetPoint()
+    + fVP.GetCurrentTargetPoint ();
+  G4double radius = fSceneHandler.GetScene()->GetExtent().GetExtentRadius();
+  if(radius<=0.) radius = 1.;
+  const G4double cameraDistance = fVP.GetCameraDistance (radius);
+  const G4Point3D cameraPosition =
+    targetPoint + cameraDistance * fVP.GetViewpointDirection().unit();
+
+  if (fVP.GetLightsMoveWithCamera()) {
+    new_up = (new_vp.cross(yprime)).unit();
+    if (new_vp.z()*vp.z() <0) {
+      new_up.set(new_up.x(),-new_up.y(),new_up.z());
+    }
+  } else {
+    new_up = up;
+    if (new_vp.z()*vp.z() <0) {
+      new_up.set(new_up.x(),-new_up.y(),new_up.z());
+    }
+  }
+  fVP.SetUpVector(new_up);
+  ////////////////
+  // Rotates by fixed azimuthal angle delta_theta.
+  
+  cosalpha = new_up.dot (new_vp.unit());
+  sinalpha = std::sqrt (1. - std::pow (cosalpha, 2));
+  yprime = (new_up.cross (new_vp.unit())).unit ();
+  xprime = yprime.cross (new_up);
+  // Projection of vp on plane perpendicular to up...
+  a1 = sinalpha * xprime;
+  // Required new projection...
+  a2 = sinalpha * (std::cos (delta_theta) * xprime + std::sin (delta_theta) * yprime);
+  // Required Increment vector...
+  delta = a2 - a1;
+  // So new viewpoint is...
+  viewPoint = new_vp.unit() + delta;
+  
+  fVP.SetViewAndLights (viewPoint);
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLViewerMessenger.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLViewerMessenger.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLViewerMessenger.cc	(revision 1102)
@@ -0,0 +1,418 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLViewerMessenger.cc,v 1.18 2009/05/14 16:38:23 lgarnier Exp $
+// GEANT4 tag $Name:  $
+
+#ifdef G4VIS_BUILD_OPENGL_DRIVER
+
+#include "G4OpenGLViewerMessenger.hh"
+
+#include "G4OpenGLViewer.hh"
+#include "G4OpenGLStoredViewer.hh"
+#include "G4UImanager.hh"
+#include "G4UIcommand.hh"
+#include "G4UIdirectory.hh"
+#include "G4UIcmdWithoutParameter.hh"
+#include "G4UIcmdWithADouble.hh"
+#include "G4UIcmdWithABool.hh"
+#include "G4UIcmdWithAString.hh"
+#include "G4VisManager.hh"
+#include <sstream>
+
+G4OpenGLViewerMessenger*
+G4OpenGLViewerMessenger::fpInstance = 0;
+
+G4OpenGLViewerMessenger*
+G4OpenGLViewerMessenger::GetInstance()
+{
+  if (!fpInstance) fpInstance = new G4OpenGLViewerMessenger;
+  return fpInstance;
+}
+
+G4OpenGLViewerMessenger::G4OpenGLViewerMessenger()
+{
+  G4bool omitable;
+
+  fpDirectory = new G4UIdirectory("/vis/ogl/");
+  fpDirectory->SetGuidance("G4OpenGLViewer commands.");
+
+  fpCommandPrintEPS =
+    new G4UIcmdWithoutParameter("/vis/ogl/printEPS", this);
+  fpCommandPrintEPS->SetGuidance("Print Encapsulated PostScript file.");
+  fpCommandPrintEPS->SetGuidance
+    ("Generates files with names G4OpenGL_n.eps, where n is a sequence"
+     "\nnumber, starting at 0."
+     "\nCan be \"vectored\" or \"pixmap\" - see \"/vis/ogl/set/printMode\".");
+
+  fpCommandPrintSize =
+    new G4UIcommand("/vis/ogl/set/printSize", this);
+  fpCommandPrintSize->SetGuidance ("Set print size");
+  fpCommandPrintSize->SetGuidance ("Tip : -1 will mean 'print size' = 'window size'");
+  fpCommandPrintSize->SetGuidance ("       Setting size greatter than your maximum graphic card capacity , will set the size to maximum  size.");
+  G4UIparameter* parameterPrintSize;
+  parameterPrintSize = new G4UIparameter ("width", 'd', omitable = false);
+  parameterPrintSize->SetDefaultValue(-1);
+  fpCommandPrintSize->SetParameter(parameterPrintSize);
+  parameterPrintSize = new G4UIparameter ("height", 'd', omitable = false);
+  parameterPrintSize->SetDefaultValue(-1);
+  fpCommandPrintSize->SetParameter(parameterPrintSize);
+
+  fpCommandPrintFilename =
+    new G4UIcommand("/vis/ogl/set/printFilename", this);
+  fpCommandPrintFilename->SetGuidance ("Set print filename");
+  fpCommandPrintFilename->SetGuidance ("Setting 'incremental' will increment filename by one at each new print, starting at 0");
+  G4UIparameter* parameterPrintFilename;
+  parameterPrintFilename = new G4UIparameter ("name", 's', omitable = true);
+  parameterPrintFilename->SetDefaultValue("G4OpenGL");
+  fpCommandPrintFilename->SetParameter(parameterPrintFilename);
+  parameterPrintFilename = new G4UIparameter ("incremental", 'b', omitable = true);
+  parameterPrintFilename->SetDefaultValue(1);
+  fpCommandPrintFilename->SetParameter(parameterPrintFilename);
+
+  fpDirectorySet = new G4UIdirectory ("/vis/ogl/set/");
+  fpDirectorySet->SetGuidance("G4OpenGLViewer set commands.");
+
+  G4UIparameter* parameter;
+
+  fpCommandDisplayHeadTime =
+    new G4UIcommand("/vis/ogl/set/displayHeadTime", this);
+  fpCommandDisplayHeadTime->SetGuidance
+    ("Display head time of range in 2D text.");
+  parameter = new G4UIparameter ("displayHeadTime", 'b', omitable = false);
+  parameter->SetDefaultValue(false);
+  fpCommandDisplayHeadTime->SetParameter(parameter);
+  parameter = new G4UIparameter ("screenX", 'd', omitable = true);
+  parameter->SetGuidance("-1 < screenX < 1");
+  parameter->SetParameterRange("screenX >= -1. && screenX <= 1.");
+  parameter->SetDefaultValue(-0.9);
+  fpCommandDisplayHeadTime->SetParameter(parameter);
+  parameter = new G4UIparameter ("screenY", 'd', omitable = true);
+  parameter->SetGuidance("-1 < screenY < 1");
+  parameter->SetParameterRange("screenY >= -1. && screenY <= 1.");
+  parameter->SetDefaultValue(-0.9);
+  fpCommandDisplayHeadTime->SetParameter(parameter);
+  parameter = new G4UIparameter ("screenSize", 'd', omitable = true);
+  parameter->SetDefaultValue(24.);
+  fpCommandDisplayHeadTime->SetParameter(parameter);
+  parameter = new G4UIparameter ("red", 'd', omitable = true);
+  parameter->SetParameterRange("red >= 0. && red <= 1.");
+  parameter->SetDefaultValue(0.);
+  fpCommandDisplayHeadTime->SetParameter(parameter);
+  parameter = new G4UIparameter ("green", 'd', omitable = true);
+  parameter->SetParameterRange("green >= 0. && green <= 1.");
+  parameter->SetDefaultValue(1.);
+  fpCommandDisplayHeadTime->SetParameter(parameter);
+  parameter = new G4UIparameter ("blue", 'd', omitable = true);
+  parameter->SetParameterRange("blue >= 0. && blue <= 1.");
+  parameter->SetDefaultValue(1.);
+  fpCommandDisplayHeadTime->SetParameter(parameter);
+
+  fpCommandDisplayLightFront =
+    new G4UIcommand("/vis/ogl/set/displayLightFront", this);
+  fpCommandDisplayLightFront->SetGuidance
+    ("Display the light front at head time.");
+  fpCommandDisplayLightFront->SetGuidance
+    ("Tip: The trajectories can appear of jump ahead of the light front"
+     "\nbecause their time range overlaps the viewer's time range.  To"
+     "\naverage out this discrete time effect, advance the light front by"
+     "\nhalf the trajectories interval. E.g., if the trajectory time slice"
+     "\ninterval is 0.01 ns:"
+     "\n  /vis/ogl/set/displayLightFront true -90 0 0 mm -0.005 ns"
+     "\nTo prevent them beating the light front at all:"
+     "\n  /vis/ogl/set/displayLightFront true -90 0 0 mm -0.01 ns");
+  parameter = new G4UIparameter ("displayLightFront", 'b', omitable = false);
+  parameter->SetDefaultValue(false);
+  fpCommandDisplayLightFront->SetParameter(parameter);
+  parameter = new G4UIparameter ("originX", 'd', omitable = true);
+  parameter->SetDefaultValue(0.);
+  fpCommandDisplayLightFront->SetParameter(parameter);
+  parameter = new G4UIparameter ("originY", 'd', omitable = true);
+  parameter->SetDefaultValue(0.);
+  fpCommandDisplayLightFront->SetParameter(parameter);
+  parameter = new G4UIparameter ("originZ", 'd', omitable = true);
+  parameter->SetDefaultValue(0.);
+  fpCommandDisplayLightFront->SetParameter(parameter);
+  parameter = new G4UIparameter ("space_unit", 's', omitable = true);
+  parameter->SetDefaultValue("m");
+  fpCommandDisplayLightFront->SetParameter(parameter);
+  parameter = new G4UIparameter ("originT", 'd', omitable = true);
+  parameter->SetDefaultValue(0.);
+  fpCommandDisplayLightFront->SetParameter(parameter);
+  parameter = new G4UIparameter ("time_unit", 's', omitable = true);
+  parameter->SetDefaultValue("s");
+  fpCommandDisplayLightFront->SetParameter(parameter);
+  parameter = new G4UIparameter ("red", 'd', omitable = true);
+  parameter->SetParameterRange("red >= 0. && red <= 1.");
+  parameter->SetDefaultValue(0.);
+  fpCommandDisplayLightFront->SetParameter(parameter);
+  parameter = new G4UIparameter ("green", 'd', omitable = true);
+  parameter->SetParameterRange("green >= 0. && green <= 1.");
+  parameter->SetDefaultValue(1.);
+  fpCommandDisplayLightFront->SetParameter(parameter);
+  parameter = new G4UIparameter ("blue", 'd', omitable = true);
+  parameter->SetParameterRange("blue >= 0. && blue <= 1.");
+  parameter->SetDefaultValue(0.);
+  fpCommandDisplayLightFront->SetParameter(parameter);
+
+  fpCommandEndTime =
+    new G4UIcommand("/vis/ogl/set/endTime", this);
+  fpCommandEndTime->SetGuidance("Set end and range of track time.");
+  parameter = new G4UIparameter ("end-time", 'd', omitable = false);
+  parameter->SetDefaultValue(DBL_MAX);
+  fpCommandEndTime->SetParameter(parameter);
+  parameter = new G4UIparameter ("end-time-unit", 's', omitable = false);
+  parameter->SetDefaultValue("ns");
+  fpCommandEndTime->SetParameter(parameter);
+  parameter = new G4UIparameter ("time-range", 'd', omitable = true);
+  parameter->SetDefaultValue(-1.);
+  fpCommandEndTime->SetParameter(parameter);
+  parameter = new G4UIparameter ("time-range-unit", 's', omitable = true);
+  parameter->SetDefaultValue("ns");
+  fpCommandEndTime->SetParameter(parameter);
+
+  fpCommandFade = new G4UIcmdWithADouble("/vis/ogl/set/fade", this);
+  fpCommandFade->SetGuidance
+    ("0: no fade; 1: maximum fade with time within range.");
+  fpCommandFade->SetParameterName("fadefactor", omitable = false);
+  fpCommandFade->SetRange("fadefactor>=0.&&fadefactor<=1.");
+  fpCommandFade->SetDefaultValue(0.);
+
+  fpCommandPrintMode = new G4UIcmdWithAString
+    ("/vis/ogl/set/printMode",this);
+  fpCommandPrintMode->SetGuidance("Set print mode");
+  fpCommandPrintMode->SetParameterName("print_mode",omitable = true);
+  fpCommandPrintMode->SetCandidates("vectored pixmap");
+  fpCommandPrintMode->SetDefaultValue("vectored");
+
+  fpCommandStartTime =
+    new G4UIcommand("/vis/ogl/set/startTime", this);
+  fpCommandStartTime->SetGuidance("Set start and range of track time.");
+  parameter = new G4UIparameter ("start-time", 'd', omitable = false);
+  parameter->SetDefaultValue(-DBL_MAX);
+  fpCommandStartTime->SetParameter(parameter);
+  parameter = new G4UIparameter ("start-time-unit", 's', omitable = false);
+  parameter->SetDefaultValue("ns");
+  fpCommandStartTime->SetParameter(parameter);
+  parameter = new G4UIparameter ("time-range", 'd', omitable = true);
+  parameter->SetDefaultValue(-1.);
+  fpCommandStartTime->SetParameter(parameter);
+  parameter = new G4UIparameter ("time-range-unit", 's', omitable = true);
+  parameter->SetDefaultValue("ns");
+  fpCommandStartTime->SetParameter(parameter);
+
+  fpCommandTransparency =
+    new G4UIcmdWithABool("/vis/ogl/set/transparency", this);
+  fpCommandTransparency->SetGuidance
+    ("True/false to enable/disable rendering of transparent objects.");
+  fpCommandTransparency->SetParameterName
+    ("transparency-enabled", omitable = true);
+  fpCommandTransparency->SetDefaultValue(true);
+}
+
+G4OpenGLViewerMessenger::~G4OpenGLViewerMessenger ()
+{
+  delete fpCommandPrintMode;
+  delete fpCommandTransparency;
+  delete fpCommandStartTime;
+  delete fpCommandFade;
+  delete fpCommandEndTime;
+  delete fpCommandDisplayLightFront;
+  delete fpCommandDisplayHeadTime;
+  delete fpDirectorySet;
+  delete fpCommandPrintEPS;
+  delete fpDirectory;
+
+  delete fpInstance;
+}
+
+void G4OpenGLViewerMessenger::SetNewValue
+(G4UIcommand* command, G4String newValue)
+{
+  G4VisManager* pVisManager = G4VisManager::GetInstance();
+
+  G4VViewer* pViewer = pVisManager->GetCurrentViewer();
+
+  if (!pViewer) {
+    G4cout <<
+      "G4OpenGLViewerMessenger::SetNewValue: No current viewer."
+      "\n  \"/vis/open\", or similar, to get one."
+           << G4endl;
+    return;
+  }
+
+  G4OpenGLViewer* pOGLViewer = dynamic_cast<G4OpenGLViewer*>(pViewer);
+
+  if (!pOGLViewer) {
+    G4cout <<
+      "G4OpenGLViewerMessenger::SetNewValue: Current viewer is not of type"
+      "\n  OGL.  Use \"/vis/viewer/select\" or \"/vis/open\"."
+           << G4endl;
+    return;
+  }
+
+  if (command == fpCommandPrintEPS) 
+    {
+      pOGLViewer->printEPS();
+      return;
+    }
+
+  if (command == fpCommandPrintSize) 
+    {
+      G4int width,height;
+      std::istringstream iss(newValue);
+      iss >> width
+	  >> height;
+      pOGLViewer->setPrintSize(width,height);
+    }
+
+  if (command == fpCommandPrintFilename) 
+    {
+      G4String name;
+      G4bool inc;
+      std::istringstream iss(newValue);
+      iss >> name
+	  >> inc;
+      pOGLViewer->setPrintFilename(name,inc);
+    }
+
+  if (command == fpCommandPrintMode)
+    {
+      if (newValue == "vectored") pOGLViewer->fVectoredPs = true;
+      if (newValue == "pixmap") pOGLViewer->fVectoredPs = false;
+      return;
+    }
+
+  if (command == fpCommandTransparency)
+    {
+      pOGLViewer->transparency_enabled = command->ConvertToBool(newValue);
+      if (pOGLViewer->fVP.IsAutoRefresh())
+	G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/refresh");
+      return;
+    }
+
+  G4OpenGLStoredViewer* pOGLSViewer =
+    dynamic_cast<G4OpenGLStoredViewer*>(pViewer);
+
+  if (!pOGLSViewer)
+    {
+      G4cout <<
+  "G4OpenGLViewerMessenger::SetNewValue: Current viewer is not of type OGLS."
+  "\n  The time slice viewing feature is only implemented for OGL Stored"
+  "\n  viewers at present.  Use \"/vis/viewer/select\" or \"/vis/open OGLS...\"."
+	     << G4endl;
+      return;
+    }
+
+  if (command == fpCommandDisplayHeadTime)
+    {
+      G4String display;
+      G4double screenX, screenY, screenSize, red, green, blue;
+      std::istringstream iss(newValue);
+      iss >> display >> screenX >> screenY
+	  >> screenSize >> red >> green >> blue;
+      pOGLSViewer->fDisplayHeadTime = command->ConvertToBool(display);
+      pOGLSViewer->fDisplayHeadTimeX = screenX;
+      pOGLSViewer->fDisplayHeadTimeY = screenY;
+      pOGLSViewer->fDisplayHeadTimeSize = screenSize;
+      pOGLSViewer->fDisplayHeadTimeRed = red;
+      pOGLSViewer->fDisplayHeadTimeGreen = green;
+      pOGLSViewer->fDisplayHeadTimeBlue = blue;
+      return;
+    }
+
+  if (command == fpCommandDisplayLightFront)
+    {
+      G4String display, originX, originY, originZ, unitS, originT, unitT;
+      G4double red, green, blue;
+      std::istringstream iss(newValue);
+      iss >> display
+	  >> originX >> originY >> originZ >> unitS
+	  >> originT >> unitT
+	  >> red >> green >> blue;
+      pOGLSViewer->fDisplayLightFront = command->ConvertToBool(display);
+      pOGLSViewer->fDisplayLightFrontX =
+	command->ConvertToDimensionedDouble(G4String(originX + ' ' + unitS));
+      pOGLSViewer->fDisplayLightFrontY =
+	command->ConvertToDimensionedDouble(G4String(originY + ' ' + unitS));
+      pOGLSViewer->fDisplayLightFrontZ =
+	command->ConvertToDimensionedDouble(G4String(originZ + ' ' + unitS));
+      pOGLSViewer->fDisplayLightFrontT =
+	command->ConvertToDimensionedDouble(G4String(originT + ' ' + unitT));
+      pOGLSViewer->fDisplayLightFrontRed = red;
+      pOGLSViewer->fDisplayLightFrontGreen = green;
+      pOGLSViewer->fDisplayLightFrontBlue = blue;
+      return;
+    }
+
+  if (command == fpCommandEndTime)
+    {
+      G4String end_time_string, end_time_unit,
+	time_range_string, time_range_unit;
+      std::istringstream iss(newValue);
+      iss >> end_time_string >> end_time_unit
+	  >> time_range_string >> time_range_unit;
+      pOGLSViewer->fEndTime = command->ConvertToDimensionedDouble
+	(G4String(end_time_string + ' ' + end_time_unit));
+      G4double timeRange = command->ConvertToDimensionedDouble
+	(G4String(time_range_string + ' ' + time_range_unit));
+      if (timeRange > 0.) {
+	pOGLSViewer->fStartTime = pOGLSViewer->fEndTime - timeRange;
+      }
+      if (pOGLSViewer->fVP.IsAutoRefresh())
+	G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/refresh");
+      return;
+    }
+
+  if (command == fpCommandFade)
+    {
+      pOGLSViewer->fFadeFactor = command->ConvertToDouble(newValue);
+      if (pOGLSViewer->fVP.IsAutoRefresh())
+	G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/refresh");
+    }
+
+  if (command == fpCommandStartTime)
+    {
+      G4String start_time_string, start_time_unit,
+	time_range_string, time_range_unit;
+      std::istringstream iss(newValue);
+      iss >> start_time_string >> start_time_unit
+	  >> time_range_string >> time_range_unit;
+      pOGLSViewer->fStartTime = command->ConvertToDimensionedDouble
+	(G4String(start_time_string + ' ' + start_time_unit));
+      G4double timeRange = command->ConvertToDimensionedDouble
+	(G4String(time_range_string + ' ' + time_range_unit));
+      if (timeRange > 0.) {
+	pOGLSViewer->fEndTime = pOGLSViewer->fStartTime + timeRange;
+      }
+      if (pOGLSViewer->fVP.IsAutoRefresh())
+	G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/refresh");
+      return;
+    }
+
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLWin32Viewer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLWin32Viewer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLWin32Viewer.cc	(revision 1102)
@@ -0,0 +1,293 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLWin32Viewer.cc,v 1.20 2009/05/20 13:19:09 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// G4OpenGLWin32Viewer : Class to provide WindowsNT specific
+//                     functionality for OpenGL in GEANT4
+//
+// 27/06/2003 : G.Barrand : implementation (at last !).
+
+#ifdef G4VIS_BUILD_OPENGLWIN32_DRIVER
+
+#include "G4OpenGLWin32Viewer.hh"
+#include "G4VViewer.hh"
+#include "G4VSceneHandler.hh"
+#include "G4OpenGLSceneHandler.hh"
+
+#include "G4ios.hh"
+#include "G4VisExtent.hh"
+#include "G4LogicalVolume.hh"
+#include "G4VSolid.hh"
+#include "G4Point3D.hh"
+#include "G4Normal3D.hh"
+
+
+//////////////////////////////////////////////////////////////////////////////
+void G4OpenGLWin32Viewer::SetView (
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  if(!fHDC) return;
+  if(!fHGLRC) return;
+  ::wglMakeCurrent(fHDC,fHGLRC);
+  G4OpenGLViewer::SetView ();  
+}
+
+//////////////////////////////////////////////////////////////////////////////
+void G4OpenGLWin32Viewer::ShowView (
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  if(!fHDC) return;
+  glFlush ();
+  // Empty the Windows message queue :
+  MSG event;
+  while ( ::PeekMessage(&event, NULL, 0, 0, PM_REMOVE) ) {
+    ::TranslateMessage(&event);
+    ::DispatchMessage (&event);
+  }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+void G4OpenGLWin32Viewer::GetWin32Connection (
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+void G4OpenGLWin32Viewer::CreateGLWin32Context (
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+void G4OpenGLWin32Viewer::CreateMainWindow (
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  if(fWindow) return; //Done.
+
+  // Bill Gates stuff...
+  static const char className[] = "G4OpenGLWin32";
+  static bool done = false;
+  if(done==false) {
+    WNDCLASS wc;
+    wc.style = CS_HREDRAW | CS_VREDRAW;
+    wc.lpfnWndProc = (WNDPROC)WindowProc;
+    wc.cbClsExtra = 0;
+    wc.cbWndExtra = 0;
+    wc.hInstance = ::GetModuleHandle(NULL);
+    wc.hIcon = LoadIcon  (NULL, IDI_APPLICATION);
+    wc.hCursor = LoadCursor(NULL,IDC_CROSS);
+    wc.hbrBackground = NULL;
+    wc.lpszMenuName = className;
+    wc.lpszClassName = className;
+    ::RegisterClass(&wc);
+    done = true;
+  }  
+  
+  ResizeWindow(fVP.GetWindowSizeHintX(),fVP.GetWindowSizeHintY());
+
+  int x_res=GetSystemMetrics(SM_CXSCREEN);
+  int y_res=GetSystemMetrics(SM_CYSCREEN);
+  
+  //FIXME : NOT tested !
+  fWindow = ::CreateWindow(className,fName.c_str(), 
+			   WS_OVERLAPPEDWINDOW,
+			   //WS_CHILD | WS_VISIBLE,
+                           //			   0,0,
+                           fVP.GetWindowAbsoluteLocationHintX(x_res),
+                           fVP.GetWindowAbsoluteLocationHintY(y_res),
+			   getWinWidth(), getWinHeight(),
+			   NULL, NULL, 
+			   ::GetModuleHandle(NULL),
+			   NULL);
+  if(!fWindow) return;
+
+  ::SetWindowLong(fWindow,GWL_USERDATA,LONG(this));
+
+  // initialize OpenGL rendering :
+  fHDC = ::GetDC(fWindow);
+  if( fHDC && (SetWindowPixelFormat(fHDC)==TRUE) ) {
+    fHGLRC = ::wglCreateContext(fHDC);
+  }
+  
+  if(fHDC && fHGLRC) {
+    ::wglMakeCurrent(fHDC,fHGLRC);
+  }
+
+  ::SetForegroundWindow(fWindow);
+  ::ShowWindow(fWindow,SW_SHOWDEFAULT);
+  ::UpdateWindow(fWindow);
+  ::DrawMenuBar(fWindow);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+G4OpenGLWin32Viewer::G4OpenGLWin32Viewer (
+ G4OpenGLSceneHandler& scene
+)
+:G4VViewer (scene, -1)
+,G4OpenGLViewer (scene)
+,fWindow(0)
+,fHDC(0)
+,fHGLRC(0)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+G4OpenGLWin32Viewer::~G4OpenGLWin32Viewer (
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  // This is the end (Jim Morisson).
+  if (fViewId >= 0) {
+    if(wglGetCurrentContext()!=NULL) wglMakeCurrent(NULL,NULL);
+    if(fHGLRC)	{
+      wglDeleteContext(fHGLRC);
+      fHGLRC = NULL;
+    }
+    
+    if(fWindow) {
+      ::SetWindowLong(fWindow,GWL_USERDATA,LONG(NULL));
+      if(fHDC) ::ReleaseDC(fWindow,fHDC);
+      ::DestroyWindow(fWindow);
+    }
+  }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+LRESULT CALLBACK G4OpenGLWin32Viewer::WindowProc ( 
+ HWND   aWindow
+,UINT   aMessage
+,WPARAM aWParam
+,LPARAM aLParam
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+/*
+  switch (aMessage) { 
+  case WM_PAINT:{
+    printf("debug : PAINT\n");
+    HDC	hDC;
+    PAINTSTRUCT	ps;
+    hDC = BeginPaint(aWindow,&ps);
+    if(This) {
+      // FIXME : To have an automatic refresh someone have to redraw here.
+    }
+    EndPaint(aWindow, &ps);
+
+    //FIXME : have to handle WM_RESIZE
+    //pView->fWinSize_x = (G4int) width;
+    //pView->fWinSize_y = (G4int) height;
+    G4OpenGLWin32Viewer* This = 
+      (G4OpenGLWin32Viewer*)::GetWindowLong(aWindow,GWL_USERDATA);
+    if(This) {
+      This->SetView();
+      glViewport(0,0,This->fWinSize_x,This->fWinSize_y);
+      This->ClearView();
+      This->DrawView();
+      // WARNING : the below empty the Windows message queue...
+      This->FinishView();
+    }
+  } return 0;
+  default:
+    return DefWindowProc(aWindow,aMessage,aWParam,aLParam);
+  }
+*/
+  return DefWindowProc(aWindow,aMessage,aWParam,aLParam);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+bool G4OpenGLWin32Viewer::SetWindowPixelFormat(
+ HDC aHdc
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  // The ungessable...
+
+  PIXELFORMATDESCRIPTOR pfd;
+  pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);
+  pfd.nVersion = 1;
+  pfd.dwFlags = 
+    PFD_DRAW_TO_WINDOW | 
+    PFD_SUPPORT_OPENGL | 
+    PFD_DOUBLEBUFFER | 
+    PFD_STEREO_DONTCARE;  
+  pfd.iPixelType = PFD_TYPE_RGBA;
+  pfd.cColorBits = 32;
+  pfd.cRedBits = 8;
+  pfd.cRedShift = 16;
+  pfd.cGreenBits = 8;
+  pfd.cGreenShift = 8;
+  pfd.cBlueBits	= 8;
+  pfd.cBlueShift = 0;
+  pfd.cAlphaBits = 0;
+  pfd.cAlphaShift = 0;
+  pfd.cAccumBits = 64;	
+  pfd.cAccumRedBits = 16;
+  pfd.cAccumGreenBits = 16;
+  pfd.cAccumBlueBits = 16;
+  pfd.cAccumAlphaBits = 0;
+  pfd.cDepthBits = 32;
+  pfd.cStencilBits = 8;
+  pfd.cAuxBuffers = 0;
+  pfd.iLayerType = PFD_MAIN_PLANE;
+  pfd.bReserved	= 0;
+  pfd.dwLayerMask = 0;
+  pfd.dwVisibleMask = 0;
+  pfd.dwDamageMask = 0;
+  
+  int pixelIndex = ::ChoosePixelFormat(aHdc,&pfd);
+  if (pixelIndex==0) {
+    pixelIndex = 1;	
+    if (::DescribePixelFormat(aHdc, 
+			      pixelIndex, 
+			      sizeof(PIXELFORMATDESCRIPTOR), 
+			      &pfd)==0) {
+      return false;
+    }
+  }
+  if (::SetPixelFormat(aHdc,pixelIndex,&pfd)==FALSE) return false;
+  return true;
+}
+
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXViewer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXViewer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXViewer.cc	(revision 1102)
@@ -0,0 +1,424 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXViewer.cc,v 1.55 2009/05/13 10:28:00 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Andrew Walkden  7th February 1997
+// G4OpenGLXViewer : Class to provide XWindows specific
+//                 functionality for OpenGL in GEANT4
+
+#ifdef G4VIS_BUILD_OPENGLX_DRIVER
+
+#include "G4OpenGLXViewer.hh"
+#include "G4VViewer.hh"
+#include "G4OpenGLSceneHandler.hh"
+#include <GL/glu.h>
+
+#include "G4OpenGLFontBaseStore.hh"
+
+#include <sstream>
+
+#include "G4VisExtent.hh"
+#include "G4LogicalVolume.hh"
+#include "G4VSolid.hh"
+#include "G4Point3D.hh"
+#include "G4Normal3D.hh"
+#include "G4StateManager.hh"
+
+#include <X11/Xatom.h>
+#include <X11/Xutil.h>
+#include <X11/Xmu/StdCmap.h>
+
+#include <assert.h>
+
+int G4OpenGLXViewer::snglBuf_RGBA[12] =
+{ GLX_RGBA,
+  GLX_RED_SIZE, 1,
+  GLX_GREEN_SIZE, 1, 
+  GLX_BLUE_SIZE, 1,
+  GLX_DEPTH_SIZE, 1,
+  GLX_STENCIL_SIZE, 1,
+  None };
+
+int G4OpenGLXViewer::dblBuf_RGBA[13] =
+{ GLX_RGBA,
+  GLX_RED_SIZE, 1,
+  GLX_GREEN_SIZE, 1,
+  GLX_BLUE_SIZE, 1,
+  GLX_DOUBLEBUFFER,
+  GLX_DEPTH_SIZE, 1,
+  GLX_STENCIL_SIZE, 1,
+  None };
+
+#define NewString(str) \
+ ((str) != NULL ? (strcpy((char*)malloc((unsigned)strlen(str) + 1), str)) : (char*)NULL)
+
+#define USE_DEFAULT_COLORMAP 1
+#define USE_STANDARD_COLORMAP 0
+
+XVisualInfo*  G4OpenGLXViewer::vi_single_buffer = 0;
+XVisualInfo*  G4OpenGLXViewer::vi_double_buffer = 0;
+
+extern "C" {
+  static Bool G4OpenGLXViewerWaitForNotify (Display*, XEvent* e, char* arg) {
+    return (e->type == MapNotify) && (e->xmap.window == (Window) arg);
+  }
+}
+
+void G4OpenGLXViewer::SetView () {
+  Bool success = glXMakeCurrent (dpy, win, cx);
+  if (!success) {
+    fViewId = -1;  // This flags an error.
+    G4cerr << "G4OpenGLViewer::G4OpenGLViewer failed to attach a GLX context."
+           << G4endl;
+    GLint error = GL_NO_ERROR;
+    while ((error = glGetError()) != GL_NO_ERROR) {
+      G4cout << "GL Error: " << gluErrorString(error) << G4endl;
+    }
+    return;
+  }
+  G4OpenGLViewer::SetView ();  
+}
+
+void G4OpenGLXViewer::ShowView () {
+  glXWaitGL (); //Wait for effects of all previous OpenGL commands to
+                //be propagated before progressing.
+  glFlush ();
+
+  if (fVP.IsPicking()) {
+    G4cout <<
+      "Window activated for picking (left-mouse), exit (middle-mouse)."
+	   << G4endl;
+    while (true) {
+      if (XPending(dpy)) {
+	XNextEvent(dpy, &event);
+	if (event.type == ButtonPress && event.xbutton.button == 1) {
+	  Pick(event.xbutton.x, event.xbutton.y);
+	}
+	else if (event.type == ButtonPress && event.xbutton.button == 2) break;
+      }
+    }
+  }
+}
+
+void G4OpenGLXViewer::GetXConnection () {
+// get a connection.
+  dpy = XOpenDisplay (0);
+  if (!dpy) {
+    fViewId = -1;  // This flags an error.
+    G4cerr << "G4OpenGLViewer::G4OpenGLViewer couldn't open display." << G4endl;
+    return;
+  }
+
+// make sure OpenGL is supported and installed properly.
+  if (!glXQueryExtension (dpy, &errorBase, &eventBase)) {
+    fViewId = -1;  // This flags an error.
+    G4cerr << "G4OpenGLViewer::G4OpenGLViewer X Server has no GLX extension." 
+	 << G4endl;
+    return;
+  }
+
+}
+
+void G4OpenGLXViewer::CreateGLXContext (XVisualInfo* v) {
+
+  vi = v;
+// get window's attributes
+  if (!XGetWindowAttributes(dpy, XRootWindow (dpy, vi -> screen), &xwa)) {
+    fViewId = -1;  // This flags an error.
+    G4cerr << "G4OpenGLViewer::G4OpenGLViewer couldn't return window attributes"
+	 << G4endl;
+    return;
+  }
+  
+// create a GLX context
+  cx = glXCreateContext (dpy, vi, 0, true);
+  if (!cx) {
+    fViewId = -1;  // This flags an error.
+    G4cerr << "G4OpenGLViewer::G4OpenGLViewer couldn't create context."
+	 << G4endl;
+    return;
+  }
+
+// New stab at getting a colormap
+
+  Status status;
+  XStandardColormap *standardCmaps = XAllocStandardColormap ();
+  int i, numCmaps;
+
+  status = XmuLookupStandardColormap (dpy, 
+				      vi -> screen, 
+				      vi -> visualid, 
+				      vi -> depth, 
+				      XA_RGB_DEFAULT_MAP, 
+				      False, 
+				      True);
+  
+  if (status == 1) {
+    cmap = 0;
+    status = XGetRGBColormaps (dpy, 
+			       XRootWindow (dpy, vi -> screen), 
+			       &standardCmaps, 
+			       &numCmaps, 
+			       XA_RGB_DEFAULT_MAP);
+    if (status == 1)
+      for (i = 0; i < numCmaps; i++) {
+	if (standardCmaps[i].visualid == vi -> visualid) {
+	  cmap = standardCmaps[i].colormap;
+	  XFree (standardCmaps);
+	  break;
+	}
+      }
+    if (!cmap) {
+      fViewId = -1;  // This flags an error.
+      G4cerr <<
+   "G4OpenGLViewer::G4OpenGLViewer failed to allocate a standard colormap."
+	     << G4endl;
+      return;
+    }
+    G4cout << "Got standard cmap" << G4endl;
+  } else {
+    cmap = XCreateColormap (dpy, 
+			    XRootWindow(dpy, vi -> screen), 
+			    vi -> visual, 
+			    AllocNone);
+    G4cout << "Created own cmap" << G4endl;
+  }
+
+  if (!cmap) {
+    fViewId = -1;  // This flags an error.
+    G4cerr << "G4OpenGLViewer::G4OpenGLViewer failed to allocate a Colormap."
+	 << G4endl;
+    return;
+  }
+
+}
+  
+void G4OpenGLXViewer::CreateMainWindow () {
+  
+// create a window
+  swa.colormap = cmap;
+  swa.border_pixel = 0;
+  swa.event_mask = ExposureMask | ButtonPressMask | StructureNotifyMask;
+  swa.backing_store = WhenMapped;
+
+  // Window size and position...
+  size_hints = XAllocSizeHints();
+    
+  ResizeWindow(fVP.GetWindowSizeHintX(),fVP.GetWindowSizeHintY());
+
+  G4int x_origin = fVP.GetWindowAbsoluteLocationHintX(DisplayWidth(dpy, vi -> screen));
+
+  // FIXME,  screen size != window size on MAC, but I don't know have to get the menuBar
+  // size on MAC. L.Garnier 01/2009
+  G4int y_origin = fVP.GetWindowAbsoluteLocationHintY(DisplayHeight(dpy, vi -> screen));
+
+  size_hints->base_width = getWinWidth();
+  size_hints->base_height = getWinHeight();
+  size_hints->x = x_origin;
+  size_hints->y = y_origin;
+  if (fVP.IsWindowSizeHintX () && fVP.IsWindowLocationHintX () && fVP.IsWindowLocationHintY ()) {
+    size_hints->flags |= PSize | PPosition;
+  } else if (fVP.IsWindowSizeHintX () && !(fVP.IsWindowLocationHintX () || fVP.IsWindowLocationHintY ())) {
+    size_hints->flags |= PSize;
+  } else if ((!fVP.IsWindowSizeHintX ()) && fVP.IsWindowLocationHintX () && fVP.IsWindowLocationHintY ()) {
+    size_hints->flags |= PPosition;
+  }
+  G4cout << "Window name: " << fName << G4endl;
+  strncpy (charViewName, fName, 100);
+  char *window_name = charViewName;
+  char *icon_name = charViewName;
+  //char tmpatom[] = "XA_WM_NORMAL_HINTS"; 
+  wm_hints = XAllocWMHints();
+  class_hints = XAllocClassHint();
+
+  XStringListToTextProperty (&window_name, 1, &windowName);
+  XStringListToTextProperty (&icon_name, 1, &iconName);
+
+  wm_hints -> initial_state = NormalState;
+  wm_hints -> input = True;
+  wm_hints -> icon_pixmap = icon_pixmap;
+  wm_hints -> flags = StateHint | IconPixmapHint | InputHint;
+
+  class_hints -> res_name  = NewString("G4OpenGL");
+  class_hints -> res_class = NewString("G4OpenGL");
+
+   win = XCreateWindow (dpy, XRootWindow (dpy, vi -> screen), x_origin, 
+                        y_origin, getWinWidth(), getWinHeight(), 0, vi -> depth,
+                        InputOutput, vi -> visual,  
+                        CWBorderPixel | CWColormap | 
+                        CWEventMask | CWBackingStore,
+                        &swa);
+  
+   XSetWMProperties (dpy, win, &windowName, &iconName, 0, 0, 
+                     size_hints, wm_hints, class_hints);
+  
+// request X to Draw window on screen.
+  XMapWindow (dpy, win);
+
+// Wait for window to appear (wait for an "expose" event).
+  XIfEvent (dpy, &event, G4OpenGLXViewerWaitForNotify, (char*) win);
+
+// connect the context to a window
+  Bool success = glXMakeCurrent (dpy, win, cx);
+  if (!success) {
+    fViewId = -1;  // This flags an error.
+    G4cerr << "G4OpenGLViewer::G4OpenGLViewer failed to attach a GLX context."
+	 << G4endl;
+    GLint error = GL_NO_ERROR;
+    while ((error = glGetError()) != GL_NO_ERROR) {
+      G4cout << "GL Error: " << gluErrorString(error) << G4endl;
+    }
+    return;
+  }
+
+}
+
+void G4OpenGLXViewer::CreateFontLists () {
+
+  std::map<G4double,G4String> fonts;  // G4VMarker screen size and font name.
+  fonts[10.] = "-adobe-courier-bold-r-normal--10-100-75-75-m-60-iso8859-1";
+  fonts[11.] = "-adobe-courier-bold-r-normal--11-80-100-100-m-60-iso8859-1";
+  fonts[12.] = "-adobe-courier-bold-r-normal--12-120-75-75-m-70-iso8859-1";
+  fonts[13.] = "fixed";
+  fonts[14.] = "-adobe-courier-bold-r-normal--14-100-100-100-m-90-iso8859-1";
+  fonts[17.] = "-adobe-courier-bold-r-normal--17-120-100-100-m-100-iso8859-1";
+  fonts[18.] = "-adobe-courier-bold-r-normal--18-180-75-75-m-110-iso8859-1";
+  fonts[20.] = "-adobe-courier-bold-r-normal--20-140-100-100-m-110-iso8859-1";
+  fonts[24.] = "-adobe-courier-bold-r-normal--24-240-75-75-m-150-iso8859-1";
+  fonts[25.] = "-adobe-courier-bold-r-normal--25-180-100-100-m-150-iso8859-1";
+  fonts[34.] = "-adobe-courier-bold-r-normal--34-240-100-100-m-200-iso8859-1";
+  std::map<G4double,G4String>::const_iterator i;
+  for (i = fonts.begin(); i != fonts.end(); ++i) {
+    XFontStruct* font_info = XLoadQueryFont(dpy, i->second);
+    if (!font_info) {
+      G4cerr <<
+	"G4OpenGLXViewer: XLoadQueryFont failed for font\n  "
+	     << i->second
+	     << G4endl;
+      continue;
+    }
+    G4int font_base = glGenLists(256);
+    if (!font_base) {
+      G4cerr << "G4OpenGLXViewer: out of display lists for fonts." 
+	     << G4endl;
+      continue;
+    }
+    G4int first = font_info->min_char_or_byte2;
+    G4int last  = font_info->max_char_or_byte2;
+    glXUseXFont(font_info->fid, first, last-first+1,font_base+first);
+    G4OpenGLFontBaseStore::AddFontBase(this,font_base,i->first,i->second);
+  }
+}
+
+G4OpenGLXViewer::G4OpenGLXViewer (G4OpenGLSceneHandler& scene):
+G4VViewer (scene, -1),
+G4OpenGLViewer (scene),
+vi_immediate (0),
+vi_stored (0),
+vi (0),
+cmap (0)
+{
+  GetXConnection ();
+  if (fViewId < 0) return;
+  
+  // Try for a visual suitable for OpenGLImmediate..
+  // first try for a single buffered RGB window
+  if (!vi_single_buffer) {
+    vi_single_buffer =
+      glXChooseVisual (dpy, XDefaultScreen (dpy), snglBuf_RGBA);
+  }
+  if (!vi_double_buffer) {
+    vi_double_buffer =
+      glXChooseVisual (dpy, XDefaultScreen (dpy), dblBuf_RGBA);
+  }
+
+  if (vi_single_buffer || vi_double_buffer) {
+    if (!vi_double_buffer) {
+      G4cout <<
+	"G4OpenGLXViewer::G4OpenGLXViewer: unable to get a double buffer visual."
+	"\n  Working with a single buffer."
+	     << G4endl;
+    }
+  } else {
+    if (!vi_single_buffer) {
+      G4cout <<
+	"G4OpenGLXViewer::G4OpenGLXViewer: unable to get a single buffer visual."
+	     << G4endl;
+    }
+    if (!vi_double_buffer) {
+      G4cout <<
+	"G4OpenGLXViewer::G4OpenGLXViewer: unable to get a double buffer visual."
+	     << G4endl;
+    }
+  }
+
+  if (vi_single_buffer) {
+    vi_immediate = vi_single_buffer;
+    attributeList = snglBuf_RGBA;
+  }
+  
+  if (!vi_immediate){
+    // next try for a double buffered RGB, but Draw to top buffer
+    if (vi_double_buffer) {
+      vi_immediate = vi_double_buffer;
+      attributeList = dblBuf_RGBA;
+    }
+  }
+
+  // Now try for a visual suitable for OpenGLStored...
+  // Try for a double buffered RGB window
+  if (vi_double_buffer) {
+    vi_stored = vi_double_buffer;
+    attributeList = dblBuf_RGBA;
+  }
+
+  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.);
+}
+
+G4OpenGLXViewer::~G4OpenGLXViewer () {
+  if (fViewId >= 0) {
+    //Close a window from here
+    glXMakeCurrent (dpy, None, NULL);
+    glXDestroyContext (dpy, cx);
+    if (win) XDestroyWindow (dpy, win); // ...if already deleted in
+    // sub-class G4OpenGLXmViewer.
+    XFlush (dpy);
+  }
+}
+	
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXViewerMessenger.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXViewerMessenger.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXViewerMessenger.cc	(revision 1102)
@@ -0,0 +1,104 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXViewerMessenger.cc,v 1.5 2006/11/21 16:24:00 allison Exp $
+// GEANT4 tag $Name: geant4-08-02-patch-01 $
+
+#ifdef G4VIS_BUILD_OPENGLX_DRIVER
+
+#include "G4OpenGLXViewerMessenger.hh"
+
+#include "G4OpenGLXViewer.hh"
+
+#include "G4UImanager.hh"
+#include "G4UIcommand.hh"
+#include "G4UIdirectory.hh"
+#include "G4UIcmdWithoutParameter.hh"
+#include "G4UIcmdWithABool.hh"
+#include "G4VisManager.hh"
+#include <sstream>
+
+G4OpenGLXViewerMessenger* G4OpenGLXViewerMessenger::fpInstance = 0;
+
+G4OpenGLXViewerMessenger* G4OpenGLXViewerMessenger::GetInstance()
+{
+  if (!fpInstance) fpInstance = new G4OpenGLXViewerMessenger;
+  return fpInstance;
+}
+
+G4OpenGLXViewerMessenger::G4OpenGLXViewerMessenger()
+{
+  fpDirectory = new G4UIdirectory("/vis/oglx/");
+  fpDirectory->SetGuidance("G4OpenGLXViewer commands.");
+
+  fpCommandPrintEPS =
+    new G4UIcmdWithoutParameter("/vis/oglx/printEPS", this);
+  fpCommandPrintEPS->SetGuidance("Print Encapsulated PostScript file.");
+  fpCommandPrintEPS->SetGuidance
+    ("Generates files with names G4OpenGL_n.eps, where n is a sequence"
+     "\nnumber, starting at 0.");
+}
+
+G4OpenGLXViewerMessenger::~G4OpenGLXViewerMessenger ()
+{
+  delete fpCommandPrintEPS;
+  delete fpDirectory;
+}
+
+void G4OpenGLXViewerMessenger::SetNewValue
+(G4UIcommand* command, G4String)
+{
+  G4VisManager* pVisManager = G4VisManager::GetInstance();
+
+  G4VViewer* pVViewer = pVisManager->GetCurrentViewer();
+
+  if (!pVViewer) {
+    G4cout <<
+      "G4OpenGLXViewerMessenger::SetNewValue: No current viewer."
+      "\n  \"/vis/open\", or similar, to get one."
+           << G4endl;
+    return;
+  }
+
+  G4OpenGLXViewer* pViewer = dynamic_cast<G4OpenGLXViewer*>(pVViewer);
+
+  if (!pViewer) {
+    G4cout <<
+      "G4OpenGLXViewerMessenger::SetNewValue: Current viewer is not of type"
+      "\n  OGL*X*.  This feature currently only available on X Windows."
+           << G4endl;
+    return;
+  }
+
+  if (command == fpCommandPrintEPS)
+    {
+      // Print eps file...
+      pViewer->printEPS();
+    }
+
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmBox.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmBox.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmBox.cc	(revision 1102)
@@ -0,0 +1,110 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmBox.cc,v 1.8 2009/02/04 16:48:41 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+//Box container class
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4OpenGLXmFramedBox.hh"
+#include "G4OpenGLXmBox.hh"
+#include "G4OpenGLXmVWidgetComponent.hh"
+#include "G4OpenGLXmVWidgetShell.hh"
+#include <Xm/RowColumn.h>
+#include <Xm/Xm.h>
+
+G4OpenGLXmBox::G4OpenGLXmBox (const char* n, 
+			      G4bool r)
+{
+  name = n;
+  radio = r;
+  parent = NULL;
+  box_row_col = NULL;
+}
+
+G4OpenGLXmBox::~G4OpenGLXmBox () 
+{}
+
+void G4OpenGLXmBox::AddChild (G4OpenGLXmVWidgetComponent* component)
+{
+  component->AddYourselfTo(this);
+  Cardinal num_children;
+  XtVaGetValues (box_row_col,
+		 XmNnumChildren, &num_children,
+		 NULL);
+//  G4cout << name << " now parents " << num_children << " children." << G4endl;
+}
+
+void G4OpenGLXmBox::AddYourselfTo (G4OpenGLXmVWidgetShell* window)
+{
+
+  pView = window->GetView ();
+  ProcesspView ();
+  parent = window->GetPointerToWidget ();
+  
+  box_row_col =  XtVaCreateManagedWidget (name,
+					  xmRowColumnWidgetClass,
+					  *parent,
+					  
+					  XmNadjustMargin, True,
+					  XmNisHomogeneous, False,
+					  XmNlabelString, (XmString)name,
+					  XmNradioAlwaysOne, radio,
+					  XmNradioBehavior, radio,
+					  
+					  XtNvisual, visual,
+					  XtNdepth, depth,
+					  XtNcolormap, cmap,
+					  XtNborderColor, borcol,
+					  XtNbackground, bgnd,
+					  
+					  NULL);
+  
+}
+
+Widget* G4OpenGLXmBox::GetPointerToParent ()
+{
+  return parent;
+}
+
+Widget* G4OpenGLXmBox::GetPointerToWidget ()
+{
+  return &box_row_col;
+}
+
+const char* G4OpenGLXmBox::GetName ()
+{
+  return name;
+}
+
+void G4OpenGLXmBox::SetName (const char* n)
+{
+  name = n;
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmConvenienceRoutines.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmConvenienceRoutines.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmConvenienceRoutines.cc	(revision 1102)
@@ -0,0 +1,535 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmConvenienceRoutines.cc,v 1.13 2009/02/04 16:48:41 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Andrew Walkden  16th April 1997
+// G4OpenGLXmConvenienceRoutines : 
+//                       Collection of routines to facilitate
+//                       the addition of simple push button boxes,
+//                       and slider bars to the control panel.
+//
+// See G4OpenGLXmConvenienceRoutines.hh for more information.
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4OpenGLXmViewer.hh"
+
+#include <Xm/Form.h>
+#include <Xm/ToggleB.h>
+#include <Xm/ArrowBG.h>
+#include <Xm/RowColumn.h>
+#include <Xm/TextF.h>
+#include <Xm/Separator.h>
+#include <Xm/Scale.h>
+
+void G4OpenGLXmViewer::Add_four_arrow_buttons (G4OpenGLXmViewer* pView,
+					     XtCallbackRec** arrow_callbacks,
+					     Widget* parent_widget) {
+  
+  Widget arrow_form = XtVaCreateWidget 
+    ("arrow_form",
+     xmFormWidgetClass,
+     *parent_widget,
+     XmNfractionBase, 3,
+     XtNvisual, pView->vi->visual, 
+     XtNdepth, pView->vi->depth, 
+     XtNcolormap, pView->cmap, 
+     XtNborderColor, pView->borcol,
+     XtNbackground, pView->bgnd,
+     NULL);
+  
+  Widget arrow = XtVaCreateManagedWidget 
+    ("up_arrow",
+     xmArrowButtonGadgetClass, 
+     arrow_form,
+     XmNtopAttachment, XmATTACH_POSITION,
+     XmNtopPosition, 0,
+     XmNbottomAttachment, XmATTACH_POSITION,
+     XmNbottomPosition, 1,
+     XmNleftAttachment, XmATTACH_POSITION,
+     XmNleftPosition, 1,
+     XmNrightAttachment, XmATTACH_POSITION,
+     XmNrightPosition, 2,
+     XmNarrowDirection, XmARROW_UP,
+     NULL);
+  
+  XtVaSetValues (arrow,
+		 XmNuserData, True,
+		 NULL);
+  
+  XtAddCallbacks (arrow, 
+		 XmNactivateCallback, 
+		 arrow_callbacks[0]);
+  
+  XtAddCallbacks (arrow, 
+		 XmNarmCallback, 
+		 arrow_callbacks[0]);
+  
+  XtAddCallbacks (arrow, 
+		 XmNdisarmCallback, 
+		 arrow_callbacks[0]);
+  
+  arrow = XtVaCreateManagedWidget 
+    ("down_arrow",
+     xmArrowButtonGadgetClass, 
+     arrow_form,
+     XmNtopAttachment, XmATTACH_POSITION,
+     XmNtopPosition, 2,
+     XmNbottomAttachment, XmATTACH_POSITION,
+     XmNbottomPosition, 3,
+     XmNleftAttachment, XmATTACH_POSITION,
+     XmNleftPosition, 1,
+     XmNrightAttachment, XmATTACH_POSITION,
+     XmNrightPosition, 2,
+     XmNarrowDirection, XmARROW_DOWN,
+     NULL);
+  
+  XtVaSetValues (arrow,
+		 XmNuserData, False,
+		 NULL);
+  
+  XtAddCallbacks (arrow, 
+		 XmNactivateCallback, 
+		 arrow_callbacks[1]);
+  
+  XtAddCallbacks (arrow, 
+		 XmNarmCallback,
+		 arrow_callbacks[1]);
+  
+  XtAddCallbacks (arrow, 
+		 XmNdisarmCallback, 
+		 arrow_callbacks[1]);
+  
+  arrow = XtVaCreateManagedWidget 
+    ("left_arrow",
+     xmArrowButtonGadgetClass, 
+     arrow_form,
+     XmNtopAttachment, XmATTACH_POSITION,
+     XmNtopPosition, 1,
+     XmNbottomAttachment, XmATTACH_POSITION,
+     XmNbottomPosition, 2,
+     XmNleftAttachment, XmATTACH_POSITION,
+     XmNleftPosition, 0,
+     XmNrightAttachment, XmATTACH_POSITION,
+     XmNrightPosition, 1,
+     XmNarrowDirection, XmARROW_LEFT,
+     NULL);
+  
+  XtVaSetValues (arrow,
+		 XmNuserData, False,
+		 NULL);
+
+  XtAddCallbacks (arrow, 
+		 XmNactivateCallback, 
+		 arrow_callbacks[2]);
+
+  XtAddCallbacks (arrow, 
+		 XmNarmCallback, 
+		 arrow_callbacks[2]);
+  
+  XtAddCallbacks (arrow, 
+		 XmNdisarmCallback, 
+		 arrow_callbacks[2]);
+      
+  arrow = XtVaCreateManagedWidget 
+    ("right_arrow",
+     xmArrowButtonGadgetClass, 
+     arrow_form,
+     XmNtopAttachment, XmATTACH_POSITION,
+     XmNtopPosition, 1,
+     XmNbottomAttachment, XmATTACH_POSITION,
+     XmNbottomPosition, 2,
+     XmNleftAttachment, XmATTACH_POSITION,
+     XmNleftPosition, 2,
+     XmNrightAttachment, XmATTACH_POSITION,
+     XmNrightPosition, 3,
+     XmNarrowDirection, XmARROW_RIGHT,
+     NULL);
+  
+  XtVaSetValues (arrow,
+		 XmNuserData, True,
+		 NULL);
+  
+  XtAddCallbacks (arrow, 
+		 XmNactivateCallback, 
+		 arrow_callbacks[3]);
+  
+  XtAddCallbacks (arrow, 
+		 XmNarmCallback, 
+		 arrow_callbacks[3]);
+
+  XtAddCallbacks (arrow, 
+		 XmNdisarmCallback, 
+		 arrow_callbacks[3]);
+  
+  XtManageChild (arrow_form);
+  
+}
+
+void G4OpenGLXmViewer::Add_radio_box (char* label_string,
+				    Widget* parent_widget,
+				    XtCallbackRec* radio_box_callback,
+				    G4int num_buttons,
+				    G4int default_button,
+				    char* radio_box_name,
+				    char** button_names,
+				    G4OpenGLXmViewer* pView)
+{
+  XmString button_str = XmStringCreateLocalized((char*) ""); // ...to
+  // initialise to something to avoid pedantic warning.
+  Arg** args;
+  args = new Arg* [num_buttons];
+  Widget button;
+
+  G4int i;
+  for (i = 0; i < num_buttons; i++) {
+
+    args[i] = new Arg[7];
+    button_str = XmStringCreateLocalized (button_names[i]);
+
+    XtSetArg (args[i][0], XtNvisual, pView->vi->visual);
+    XtSetArg (args[i][1], XtNdepth, pView->vi->depth);
+    XtSetArg (args[i][2], XtNcolormap, pView->cmap);
+    XtSetArg (args[i][3], XtNborderColor, pView->borcol);
+    XtSetArg (args[i][4], XtNbackground, pView->bgnd);
+    XtSetArg (args[i][5], XmNlabelString, button_str); 
+
+    if (i == default_button) {
+      XtSetArg (args[i][6], XmNset, True);
+    } else {
+      XtSetArg (args[i][6], XmNset, False);
+    }
+  }
+  
+  Widget radio_box = XtVaCreateWidget (radio_box_name,
+				       xmRowColumnWidgetClass,
+				       *parent_widget,
+				       XmNisHomogeneous, False,
+				       XmNradioBehavior, True,
+				       XmNradioAlwaysOne, True,
+				       XmNuserData, pView,
+				       XtNvisual, pView->vi->visual,
+				       XtNdepth, pView->vi->depth,
+				       XtNcolormap, pView->cmap,
+				       XtNborderColor, pView->borcol,
+				       XtNbackground, pView->bgnd,
+				       NULL);
+
+  XmString lab = XmStringCreateLocalized (label_string);
+
+  // Unused!
+  //Widget label = XtVaCreateManagedWidget ("radio_label",
+  //				  xmLabelWidgetClass,
+  //				  radio_box,
+  //				  XmNalignment, XmALIGNMENT_CENTER,
+  //				  XmNlabelString, lab,
+  //				  XtNvisual, pView->vi->visual,
+  //				  XtNdepth, pView->vi->depth,
+  //				  XtNcolormap, pView->cmap,
+  //				  XtNborderColor, pView->borcol,
+  //				  XtNbackground, pView->bgnd,
+  //				  NULL);
+
+  XmStringFree (lab);
+
+  for (i = 0; i < num_buttons; i++) {
+    button = XtCreateManagedWidget (button_names[i],
+				    xmToggleButtonWidgetClass,
+				    radio_box,
+				    args[i],
+				    7);
+    XtVaSetValues (button,
+		   XmNuserData, i,
+		   NULL);
+    
+    XtAddCallbacks (button,
+		   XmNarmCallback,
+		   radio_box_callback);
+  }
+
+  XtManageChild (radio_box);
+
+  XmStringFree (button_str);
+  
+  for (i = 0; i < num_buttons; i++) {
+
+    delete[] args[i];
+
+  }
+
+  delete[] args;
+}  
+
+void G4OpenGLXmViewer::Add_set_field (char* w_name, 
+				    char* w_text,
+				    Widget* row_col_box,
+				    Widget* wid,
+				    G4double* val,
+				    G4OpenGLXmViewer* pView)
+{
+
+  char local_w_text[50];
+  strcpy (local_w_text, w_text);
+
+  char label_name[50];
+  strcpy (label_name, w_name);
+  strcat (label_name, "_label");
+  
+  char text_field_name[50];
+  strcpy (text_field_name, w_name);
+  strcat (text_field_name, "_text_field");
+  
+  XmString local_text = XmStringCreateLocalized (local_w_text);
+
+  // Unused!
+  //  Widget label = XtVaCreateManagedWidget (label_name, 
+  //				  xmLabelWidgetClass,
+  //				  *row_col_box,
+  //				  XmNlabelString, local_text,
+  //				  XtNvisual, pView->vi->visual, 
+  //				  XtNdepth, pView->vi->depth, 
+  //				  XtNcolormap, pView->cmap, 
+  //				  XtNborderColor, pView->borcol,
+  //				  XtNbackground, pView->bgnd,
+  //				  NULL);
+
+  XmStringFree (local_text);
+
+  char initial[50];
+  sprintf (initial, "%6.2f", *val);
+  
+  *wid = XtVaCreateManagedWidget (text_field_name,
+				  xmTextFieldWidgetClass,
+				  *row_col_box,
+				  XmNvalue, (String)initial,
+				  XtNvisual, pView->vi->visual, 
+				  XtNdepth, pView->vi->depth, 
+				  XtNcolormap, pView->cmap, 
+				  XtNborderColor, pView->borcol,
+				  XtNbackground, pView->bgnd,
+				  NULL);
+
+  XtAddCallback (*wid, 
+		 XmNvalueChangedCallback,
+		 get_double_value_callback,
+		 val);
+
+  Widget sep = XtVaCreateManagedWidget ("sep",
+					xmSeparatorWidgetClass,
+					*row_col_box,
+					XmNorientation, XmHORIZONTAL,
+					XtNvisual, pView->vi->visual, 
+					XtNdepth, pView->vi->depth, 
+					XtNcolormap, pView->cmap, 
+					XtNborderColor, pView->borcol,
+					XtNbackground, pView->bgnd,
+					NULL);
+
+  sep = XtVaCreateManagedWidget ("sep",
+				 xmSeparatorWidgetClass,
+				 *row_col_box,
+				 XmNseparatorType, XmNO_LINE,
+				 XmNmargin, 1,
+				 XmNorientation, XmHORIZONTAL,
+				 XtNvisual, pView->vi->visual, 
+				 XtNdepth, pView->vi->depth, 
+				 XtNcolormap, pView->cmap, 
+				 XtNborderColor, pView->borcol,
+				 XtNbackground, pView->bgnd,
+				 NULL);
+}
+
+void G4OpenGLXmViewer::Add_slider_box (char* label_string,
+				     G4int num_sliders,
+				     char** slider_names,
+				     G4OpenGLXmViewer* pView,
+				     G4double* min_array,
+				     G4double* max_array,
+				     G4double* value_array,
+				     G4bool* show,
+				     short* decimals,
+				     unsigned char* orientation,
+				     unsigned char* direction,
+				     XtCallbackRec** slider_box_callbacks,
+				     Widget* parent_widget)
+{
+  XmString slider_name_str = XmStringCreateLocalized((char*) ""); // ...to
+  // initialise to something to avoid pedantic warning.
+  Arg** slider_args;
+  slider_args = new Arg*[num_sliders];
+  Widget slider;
+  G4int j = 0;
+
+  G4int i;
+  for (i = 0; i < num_sliders; i++) {
+    j = 0; 
+    slider_args[i] = new Arg[13];
+    slider_name_str = XmStringCreateLtoR (slider_names[i], 
+					  XmFONTLIST_DEFAULT_TAG);
+    
+    XtSetArg (slider_args[i][j], 
+	      XtNvisual, pView->vi->visual); j++;
+    XtSetArg (slider_args[i][j], 
+	      XtNdepth, pView->vi->depth); j++;
+    XtSetArg (slider_args[i][j], 
+	      XtNcolormap, pView->cmap); j++;
+    XtSetArg (slider_args[i][j], 
+	      XtNborderColor, pView->borcol); j++;
+    XtSetArg (slider_args[i][j], 
+	      XtNbackground, pView->bgnd); j++;
+    
+    XtSetArg (slider_args[i][j], 
+	      XmNtitleString, slider_name_str);  j++;
+    
+    XtSetArg (slider_args[i][j], 
+	      XmNmaximum, G4int(max_array[i] * std::pow(10.0, (G4double)decimals[i]))); j++;
+    XtSetArg (slider_args[i][j], 
+	      XmNminimum, G4int(min_array[i] * std::pow(10.0, (G4double)decimals[i]))); j++;
+    XtSetArg (slider_args[i][j], 
+	      XmNvalue, G4int(value_array[i] * std::pow(10.0, (G4double)decimals[i]))); j++;
+    XtSetArg (slider_args[i][j], 
+	      XmNshowValue, show[i]); j++;
+    XtSetArg (slider_args[i][j], 
+	      XmNdecimalPoints, decimals[i]); j++;
+    
+    XtSetArg (slider_args[i][j], 
+	      XmNorientation, orientation[i]);  j++;
+    XtSetArg (slider_args[i][j], 
+	      XmNprocessingDirection, direction[i]); j++;
+
+  }
+
+  Widget slider_box = XtVaCreateWidget ("slider_box",
+					xmRowColumnWidgetClass,
+					*parent_widget,
+					XmNisHomogeneous, False,
+					XtNvisual, pView->vi->visual,
+					XtNdepth, pView->vi->depth,
+					XtNcolormap, pView->cmap,
+					XtNborderColor, pView->borcol,
+					XtNbackground, pView->bgnd,
+					NULL);
+
+  XmString lab = XmStringCreateLocalized (label_string);
+
+  // Unused!
+  //Widget label = XtVaCreateManagedWidget ("slider_label",
+  //				  xmLabelWidgetClass,
+  //				  slider_box,
+  //				  XmNlabelString, lab,
+  //				  XmNalignment, XmALIGNMENT_CENTER,
+  //				  XtNvisual, pView->vi->visual,
+  //				  XtNdepth, pView->vi->depth,
+  //				  XtNcolormap, pView->cmap,
+  //				  XtNborderColor, pView->borcol,
+  //				  XtNbackground, pView->bgnd,
+  //				  NULL);
+
+  XmStringFree (lab);
+  
+  for (i = 0; i < num_sliders; i++) {
+    
+    slider = XtCreateManagedWidget (slider_names[i],
+				    xmScaleWidgetClass,
+				    slider_box,
+				    slider_args[i],
+				    j);
+
+    XtAddCallbacks (slider,
+		   XmNvalueChangedCallback,
+		   slider_box_callbacks[i]);
+    
+    XtAddCallbacks (slider,
+		   XmNdragCallback,
+		   slider_box_callbacks[i]);
+    
+  }
+
+  XtManageChild (slider_box);
+  XmStringFree (slider_name_str);
+
+  for (i = 0; i < num_sliders; i++) {
+
+    delete[] slider_args[i];
+
+  }
+
+  delete[] slider_args;
+
+}
+
+void G4OpenGLXmViewer::get_double_value_callback (Widget w, 
+						XtPointer clientData, 
+						XtPointer) 
+{
+  G4double* val = (G4double*) clientData;
+  String string;
+
+  XtVaGetValues (w,
+		 XmNvalue, &string,
+		 NULL);
+
+  sscanf (string, "%lg", val);
+
+}
+
+void G4OpenGLXmViewer::get_text_callback (Widget w, 
+					XtPointer clientData, 
+					XtPointer) 
+{
+  char* txt = (char*)clientData;
+  String string;
+
+  XtVaGetValues (w,
+		 XmNvalue, &string,
+		 NULL);
+
+  sscanf (string, "%s", txt);
+}
+
+G4bool G4OpenGLXmViewer::get_boolean_userData (Widget w)
+{
+  XtPointer userData;
+  XtVaGetValues (w,XmNuserData,&userData,NULL);
+  return (G4bool)(unsigned long)userData;
+}
+
+G4int G4OpenGLXmViewer::get_int_userData (Widget w)
+{
+  XtPointer userData;
+  XtVaGetValues (w,XmNuserData,&userData,NULL);
+  return (G4int)(unsigned long)userData;
+}
+
+#endif
+
+
+
+
+
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmFourArrowButtons.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmFourArrowButtons.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmFourArrowButtons.cc	(revision 1102)
@@ -0,0 +1,222 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmFourArrowButtons.cc,v 1.7 2009/02/04 16:48:41 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+//Four arrow buttons class. Inherits from G4OpenGLXmVWidgetComponent
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4OpenGLXmVWidgetComponent.hh"
+#include "G4OpenGLXmVWidgetContainer.hh"
+#include "G4OpenGLXmFourArrowButtons.hh"
+#include <X11/Intrinsic.h>
+#include <Xm/Form.h>
+#include <Xm/ArrowBG.h>
+
+#include "globals.hh"
+
+G4OpenGLXmFourArrowButtons::G4OpenGLXmFourArrowButtons (XtCallbackRec** c)
+{
+  callback = c;
+}
+
+G4OpenGLXmFourArrowButtons::~G4OpenGLXmFourArrowButtons ()
+{}
+
+void G4OpenGLXmFourArrowButtons::AddYourselfTo (G4OpenGLXmVWidgetContainer* container)
+{
+
+  pView = container->GetView ();
+  ProcesspView ();
+
+  parent = container->GetPointerToWidget ();
+
+  arrow_form = XtVaCreateManagedWidget 
+    ("arrow_form",
+     xmFormWidgetClass,
+     *parent,
+     XmNfractionBase, 3,
+
+     XtNvisual, visual, 
+     XtNdepth, depth, 
+     XtNcolormap, cmap, 
+     XtNborderColor, borcol,
+     XtNbackground, bgnd,
+
+     NULL);
+
+
+///////////////`up' arrow///////////////  
+  arrow = XtVaCreateManagedWidget 
+    ("up_arrow",
+     xmArrowButtonGadgetClass, 
+     arrow_form,
+     
+     XmNtopAttachment, XmATTACH_POSITION,
+     XmNtopPosition, 0,
+     
+     XmNbottomAttachment, XmATTACH_POSITION,
+     XmNbottomPosition, 1,
+     
+     XmNleftAttachment, XmATTACH_POSITION,
+     XmNleftPosition, 1,
+
+     XmNrightAttachment, XmATTACH_POSITION,
+     XmNrightPosition, 2,
+
+     XmNarrowDirection, XmARROW_UP,
+     XmNuserData, True,
+     NULL);
+  
+  XtAddCallbacks (arrow, 
+		  XmNactivateCallback, 
+		  callback[0]);
+  
+  XtAddCallbacks (arrow, 
+		  XmNarmCallback, 
+		  callback[0]);
+  
+  XtAddCallbacks (arrow, 
+		  XmNdisarmCallback, 
+		  callback[0]);
+  
+///////////////`down' arrow///////////////  
+  arrow = XtVaCreateManagedWidget 
+    ("down_arrow",
+     xmArrowButtonGadgetClass, 
+     arrow_form,
+     
+     XmNtopAttachment, XmATTACH_POSITION,
+     XmNtopPosition, 2,
+
+     XmNbottomAttachment, XmATTACH_POSITION,
+     XmNbottomPosition, 3,
+
+     XmNleftAttachment, XmATTACH_POSITION,
+     XmNleftPosition, 1,
+
+     XmNrightAttachment, XmATTACH_POSITION,
+     XmNrightPosition, 2,
+
+     XmNarrowDirection, XmARROW_DOWN,
+     XmNuserData, False,
+     NULL);
+  
+  XtAddCallbacks (arrow, 
+		  XmNactivateCallback, 
+		  callback[1]);
+  
+  XtAddCallbacks (arrow, 
+		  XmNarmCallback, 
+		  callback[1]);
+  
+  XtAddCallbacks (arrow, 
+		  XmNdisarmCallback, 
+		  callback[1]);
+  
+///////////////`left' arrow///////////////  
+  arrow = XtVaCreateManagedWidget 
+    ("left_arrow",
+     xmArrowButtonGadgetClass, 
+     arrow_form,
+     
+     XmNtopAttachment, XmATTACH_POSITION,
+     XmNtopPosition, 1,
+     
+     XmNbottomAttachment, XmATTACH_POSITION,
+     XmNbottomPosition, 2,
+     
+     XmNleftAttachment, XmATTACH_POSITION,
+     XmNleftPosition, 0,
+     
+     XmNrightAttachment, XmATTACH_POSITION,
+     XmNrightPosition, 1,
+     
+     XmNarrowDirection, XmARROW_LEFT,
+     XmNuserData, False,
+     NULL);
+  
+  XtAddCallbacks (arrow, 
+		  XmNactivateCallback, 
+		  callback[2]);
+  
+  XtAddCallbacks (arrow, 
+		  XmNarmCallback, 
+		  callback[2]);
+  
+  XtAddCallbacks (arrow, 
+		  XmNdisarmCallback, 
+		  callback[2]);
+  
+///////////////`right' arrow///////////////  
+  arrow = XtVaCreateManagedWidget 
+    ("right_arrow",
+     xmArrowButtonGadgetClass, 
+     arrow_form,
+     
+     XmNtopAttachment, XmATTACH_POSITION,
+     XmNtopPosition, 1,
+     
+     XmNbottomAttachment, XmATTACH_POSITION,
+     XmNbottomPosition, 2,
+
+     XmNleftAttachment, XmATTACH_POSITION,
+     XmNleftPosition, 2,
+
+     XmNrightAttachment, XmATTACH_POSITION,
+     XmNrightPosition, 3,
+
+     XmNarrowDirection, XmARROW_RIGHT,
+     XmNuserData, True,
+     NULL);
+  
+  XtAddCallbacks (arrow, 
+		  XmNactivateCallback, 
+		  callback[3]);
+  
+  XtAddCallbacks (arrow, 
+		  XmNarmCallback, 
+		  callback[3]);
+  
+  XtAddCallbacks (arrow, 
+		  XmNdisarmCallback, 
+		  callback[3]);
+
+}
+
+Widget* G4OpenGLXmFourArrowButtons::GetPointerToParent ()
+{
+  return parent;
+}
+
+Widget* G4OpenGLXmFourArrowButtons::GetPointerToWidget () 
+{
+  return &arrow_form;
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmFramedBox.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmFramedBox.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmFramedBox.cc	(revision 1102)
@@ -0,0 +1,105 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmFramedBox.cc,v 1.8 2009/02/04 16:48:41 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+//Framed box container class
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4OpenGLXmBox.hh"
+#include "G4OpenGLXmFramedBox.hh"
+#include "G4OpenGLXmVWidgetComponent.hh"
+#include "G4OpenGLXmVWidgetShell.hh"
+#include <Xm/RowColumn.h>
+#include <Xm/Frame.h>
+
+G4OpenGLXmFramedBox::G4OpenGLXmFramedBox (const char* n, 
+					  G4bool r) :
+G4OpenGLXmBox (n, r)
+{
+  frame = NULL;
+}
+
+G4OpenGLXmFramedBox::~G4OpenGLXmFramedBox () 
+{}
+
+void G4OpenGLXmFramedBox::AddChild (G4OpenGLXmVWidgetComponent* component)
+{
+  component->AddYourselfTo(this);
+  Cardinal num_children;
+  XtVaGetValues (box_row_col,
+		 XmNnumChildren, &num_children,
+		 NULL);
+//  G4cout << name << " now parents " << num_children << " children." << G4endl;
+}
+
+void G4OpenGLXmFramedBox::AddYourselfTo (G4OpenGLXmVWidgetShell* window)
+{
+
+  pView = window->GetView ();
+  ProcesspView ();
+  char framename[50];
+  strcpy (framename, name);
+  strcat (framename, "_frame");
+
+  parent = window->GetPointerToWidget ();
+  frame = XtVaCreateManagedWidget (framename,
+				    xmFrameWidgetClass,
+				    *parent,
+				    
+				    XtNvisual, visual,
+				    XtNdepth, depth,
+				    XtNcolormap, cmap,
+				    XtNborderColor, borcol,
+				    XtNbackground, bgnd,
+				    
+				    NULL);
+  
+  
+  
+  box_row_col =  XtVaCreateManagedWidget (name,
+					  xmRowColumnWidgetClass,
+					  frame,
+					  
+					  XmNadjustMargin, True,
+					  XmNisHomogeneous, False,
+					  XmNlabelString, (XmString)name,
+					  XmNradioAlwaysOne, radio,
+					  XmNradioBehavior, radio,
+					  
+					  XtNvisual, visual,
+					  XtNdepth, depth,
+					  XtNcolormap, cmap,
+					  XtNborderColor, borcol,
+					  XtNbackground, bgnd,
+					  
+					  NULL);
+  
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmMainMenubarCallbacks.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmMainMenubarCallbacks.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmMainMenubarCallbacks.cc	(revision 1102)
@@ -0,0 +1,571 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmMainMenubarCallbacks.cc,v 1.17 2009/05/14 16:38:23 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Andrew Walkden  16th April 1997
+// G4OpenGLXmMainMenubarCallbacks : 
+//                       Collection of callback functions
+//                       to handle events generated by the
+//                       main OpenGLXm window menubar.
+//
+// See G4OpenGLXmMainMenubarCallbacks.hh for more information.
+
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4Xt.hh"
+
+#include "G4OpenGLXmViewer.hh"
+#include "G4VSceneHandler.hh"
+
+#include "G4Scene.hh"
+
+#include "G4OpenGLXmRadioButton.hh"
+#include "G4OpenGLXmSliderBar.hh"
+#include "G4OpenGLXmFourArrowButtons.hh"
+#include "G4OpenGLXmTextField.hh"
+#include "G4OpenGLXmPushButton.hh"
+#include "G4OpenGLXmBox.hh"
+#include "G4OpenGLXmFramedBox.hh"
+#include "G4OpenGLXmTopLevelShell.hh"
+#include "G4OpenGLXmSeparator.hh"
+
+#include <sstream>
+
+void G4OpenGLXmViewer::actions_callback (Widget w, 
+				       XtPointer clientData,
+				       XtPointer)
+{
+  
+  G4OpenGLXmViewer* pView;
+  G4long choice = (G4long)clientData;
+  
+  
+  XtVaGetValues (XtParent(w), 
+		 XmNuserData, &pView, 
+		 NULL);
+  
+  switch (choice) {
+    
+  case 0:
+    
+    {
+      
+      if (!pView->fprotation_top) {
+	std::ostringstream rot_Name;
+	rot_Name << pView->GetSceneHandler()->GetSceneHandlerId() << '-' << pView->fViewId;
+	
+	pView->fprotation_top = new G4OpenGLXmTopLevelShell (pView,
+							     (char*)rot_Name.str().c_str());
+	pView->fprotation_button_box = new G4OpenGLXmBox ("Rotation button box", True);
+	
+	pView->fprotation_top->AddChild (pView->fprotation_button_box);
+	
+	XtCallbackRec* rot_cb_list = new XtCallbackRec[2];
+	rot_cb_list[0].callback = set_rot_subject_callback;
+	rot_cb_list[0].closure = pView; 
+	rot_cb_list[1].callback = NULL;
+	
+	pView->fprotation_button1 = new G4OpenGLXmRadioButton
+	  ("Object",
+	   rot_cb_list,
+	   pView->GetViewParameters().GetLightsMoveWithCamera(),
+	   0);
+	
+	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);
+	
+	pView->fprotation_slider_box = new G4OpenGLXmBox ("Rotation slider box", False);
+	pView->fprotation_top->AddChild (pView->fprotation_slider_box);
+	
+	XtCallbackRec* rot_slider_list = new XtCallbackRec[2];
+	rot_slider_list[0].callback = set_rot_sens_callback;
+	rot_slider_list[0].closure = pView; 
+	rot_slider_list[1].callback = NULL;
+	
+	pView->fprotation_slider = new G4OpenGLXmSliderBar ("Rotation slider",
+							    rot_slider_list,
+							    True,
+							    2,
+							    pView->rot_sens,
+							    pView->rot_sens_limit,
+							    0);
+	pView->fprotation_slider_box->AddChild (pView->fprotation_slider);
+	
+	pView->fprotation_arrow_box = new G4OpenGLXmBox ("Rotation arrow box", False);
+	pView->fprotation_top->AddChild (pView->fprotation_arrow_box);
+	
+	XtCallbackRec** rotation_callbacks = new XtCallbackRec*[4];
+	for (G4int i = 0; i < 4; i++) {
+	  rotation_callbacks[i] = new XtCallbackRec[2];
+	}
+	rotation_callbacks[0][0].callback = phi_rotation_callback;
+	rotation_callbacks[0][0].closure =  pView;
+	rotation_callbacks[0][1].callback	= NULL;
+	
+	rotation_callbacks[1][0].callback = phi_rotation_callback;
+	rotation_callbacks[1][0].closure =  pView;
+	rotation_callbacks[1][1].callback	= NULL;
+	
+	rotation_callbacks[2][0].callback = theta_rotation_callback;
+	rotation_callbacks[2][0].closure =  pView;
+	rotation_callbacks[2][1].callback	= NULL;
+	
+	rotation_callbacks[3][0].callback = theta_rotation_callback;
+	rotation_callbacks[3][0].closure =  pView;
+	rotation_callbacks[3][1].callback	= NULL;
+	
+	pView->fprotation_arrow = new G4OpenGLXmFourArrowButtons (rotation_callbacks);
+	
+	pView->fprotation_arrow_box->AddChild (pView->fprotation_arrow);
+	
+	pView->fprotation_top->Realize ();
+      }
+      break;
+      
+    }
+  
+  
+  case 1:
+    {
+
+      if (!pView->fppanning_top) {
+	std::ostringstream pan_Name;
+	pan_Name << pView->GetSceneHandler()->GetSceneHandlerId() << '-' << pView->fViewId;
+	
+	pView->fppanning_top = new G4OpenGLXmTopLevelShell (pView, 
+							    (char*)pan_Name.str().c_str());
+	
+	pView->fppanning_box = new G4OpenGLXmFramedBox ("Pan up-down-left-right", 
+							False);
+	
+	pView->fppanning_top->AddChild (pView->fppanning_box);
+	
+	XtCallbackRec** pan_callbacks = new XtCallbackRec*[4];
+	for (G4int i = 0; i < 4; i++) {
+	  pan_callbacks[i] = new XtCallbackRec[2];
+	}
+	pan_callbacks[0][0].callback = pan_up_down_callback;
+	pan_callbacks[0][0].closure = pView; 
+	pan_callbacks[0][1].callback = NULL;
+	
+	pan_callbacks[1][0].callback = pan_up_down_callback;
+	pan_callbacks[1][0].closure = pView; 
+	pan_callbacks[1][1].callback = NULL;
+	
+	pan_callbacks[2][0].callback = pan_left_right_callback;
+	pan_callbacks[2][0].closure = pView; 
+	pan_callbacks[2][1].callback = NULL;
+	
+	pan_callbacks[3][0].callback = pan_left_right_callback;
+	pan_callbacks[3][0].closure = pView; 
+	pan_callbacks[3][1].callback = NULL;
+	
+	pView->fppanning_arrows = new G4OpenGLXmFourArrowButtons (pan_callbacks);
+	
+	pView->fppanning_box->AddChild (pView->fppanning_arrows);
+	
+	XtCallbackRec* pan_slider_list = new XtCallbackRec[2];
+	pan_slider_list[0].callback = set_pan_sens_callback;
+	pan_slider_list[0].closure = pView; 
+	pan_slider_list[1].callback = NULL;
+	
+	pView->fppanning_slider = new G4OpenGLXmSliderBar ("Panning slider",
+							   pan_slider_list,
+							   True,
+							   2,
+							   pView->pan_sens = pView->GetSceneHandler()->GetScene()->GetExtent().GetExtentRadius() / 10.0,
+							   pView->pan_sens_limit = pView->GetSceneHandler()->GetScene()->GetExtent().GetExtentRadius(),
+							   0);
+	pView->fppanning_box->AddChild (pView->fppanning_slider);
+	
+	pView->fpzoom_box = new G4OpenGLXmFramedBox ("Zoom", 
+						     False);      
+	pView->fppanning_top->AddChild (pView->fpzoom_box);
+	
+	XtCallbackRec* zoom_slider_list = new XtCallbackRec[2];
+	zoom_slider_list[0].callback = zoom_callback;
+	zoom_slider_list[0].closure = pView; 
+	zoom_slider_list[1].callback = NULL;
+	
+	pView->fpzoom_slider = new G4OpenGLXmSliderBar ("Zoom slider",
+							zoom_slider_list,
+							True,
+							2,
+							pView->fVP.GetZoomFactor(),
+							pView->zoom_high,
+							pView->zoom_low);
+	pView->fpzoom_box->AddChild (pView->fpzoom_slider);
+	
+	pView->fpdolly_box = new G4OpenGLXmFramedBox ("Dolly", 
+						      False);      
+	pView->fppanning_top->AddChild (pView->fpdolly_box);
+	
+	XtCallbackRec* dolly_slider_list = new XtCallbackRec[2];
+	dolly_slider_list[0].callback = dolly_callback;
+	dolly_slider_list[0].closure = pView; 
+	dolly_slider_list[1].callback = NULL;
+	
+	pView->fpdolly_slider = new G4OpenGLXmSliderBar ("Dolly slider",
+							 dolly_slider_list,
+							 True,
+							 2,
+							 pView->fVP.GetDolly(),
+							 pView->dolly_high = pView->GetSceneHandler()->GetScene()->GetExtent().GetExtentRadius(),
+							 pView->dolly_low = -(pView->GetSceneHandler()->GetScene()->GetExtent().GetExtentRadius()));
+	//							 pView->dolly_high,
+	//							 pView->dolly_low);
+	pView->fpdolly_box->AddChild (pView->fpdolly_slider);
+	
+	pView->fppanning_top->Realize ();
+      }
+
+      break;
+      
+    }
+  case 2:
+    {
+      
+      if (!pView->fpsetting_top) {
+	std::ostringstream set_Name;
+	set_Name << pView->GetSceneHandler()->GetSceneHandlerId() << '-' << pView->fViewId;
+	
+	pView->fpsetting_top = new G4OpenGLXmTopLevelShell(pView,
+							   (char*)set_Name.str().c_str());
+	
+	pView->fpsetting_box = new G4OpenGLXmFramedBox ("Set values for control panels",
+							False);
+	pView->fpsetting_top->AddChild (pView->fpsetting_box);
+	
+	pView->fppan_set = new G4OpenGLXmTextField ("Upper limit of pan sensitivity",
+						    &(pView->pan_sens_limit));
+	
+	pView->fprot_set = new G4OpenGLXmTextField ("Upper limit of rotation sensitivity",
+						    &(pView->rot_sens_limit));
+	
+	pView->fpzoom_upper = new G4OpenGLXmTextField ("Upper limit of zoom",
+						       &(pView->zoom_high));
+	
+	pView->fpzoom_lower = new G4OpenGLXmTextField ("Lower limit of zoom",
+						       &(pView->zoom_low));
+	
+	pView->fpdolly_upper = new G4OpenGLXmTextField ("Upper limit of dolly",
+							&(pView->dolly_high));
+	
+	pView->fpdolly_lower = new G4OpenGLXmTextField ("Lower limit of dolly",
+							&(pView->dolly_low));
+	
+	XtCallbackRec* ok_list = new XtCallbackRec[2];
+	ok_list[0].callback = update_panels_callback;
+	ok_list[0].closure = pView; 
+	ok_list[1].callback = NULL;
+	
+	
+	pView->fpok_button = new G4OpenGLXmPushButton ("ok",
+						       ok_list);
+	
+	pView->fpsetting_box->AddChild (pView->fppan_set);
+	pView->fpsetting_box->AddChild (pView->fprot_set);
+	pView->fpsetting_box->AddChild (pView->fpzoom_upper);
+	pView->fpsetting_box->AddChild (pView->fpzoom_lower);
+	pView->fpsetting_box->AddChild (pView->fpdolly_upper);
+	pView->fpsetting_box->AddChild (pView->fpdolly_lower);
+	pView->fpsetting_box->AddChild (pView->fpok_button);
+	
+	pView->fpsetting_top->Realize ();
+	
+      }
+
+      break;
+    }
+  
+  default:
+    G4Exception("Unrecognised widget child of control_callback");
+  }
+  
+  return;
+}
+
+
+
+void G4OpenGLXmViewer::misc_callback (Widget w, 
+				    XtPointer clientData, 
+				    XtPointer) 
+{
+  G4OpenGLXmViewer* pView;
+  G4long choice = (G4long)clientData;
+  XtVaGetValues (XtParent(w), 
+		 XmNuserData, &pView, 
+		 NULL);
+  
+  switch (choice) {
+    
+  case 0:
+    {
+
+      if (!pView->fpmiscellany_top) {
+	
+	std::ostringstream misc_Name;
+	misc_Name << pView->GetSceneHandler()->GetSceneHandlerId() << '-' << pView->fViewId;
+	
+	pView->fpmiscellany_top = new G4OpenGLXmTopLevelShell (pView, 
+							       (char*)misc_Name.str().c_str());
+	pView->fpwobble_box = new G4OpenGLXmFramedBox ("Wobble view",
+						       True);
+	pView->fpmiscellany_top->AddChild (pView->fpwobble_box);
+	
+	XtCallbackRec* wob_cb_list = new XtCallbackRec[2];
+	wob_cb_list[0].callback = wobble_callback;
+	wob_cb_list[0].closure = pView; 
+	wob_cb_list[1].callback = NULL;
+	
+	
+	pView->fpwobble_button = new G4OpenGLXmPushButton ("Wobble",
+							   wob_cb_list);
+	
+	XtCallbackRec* wobble_slider_list = new XtCallbackRec[2];
+	wobble_slider_list[0].callback = set_wob_sens_callback;
+	wobble_slider_list[0].closure = pView; 
+	wobble_slider_list[1].callback = NULL;
+	
+	pView->fpwobble_slider = new G4OpenGLXmSliderBar ("Wobble slider",
+							  wobble_slider_list,
+							  True,
+							  0,
+							  20,
+							  50,
+							  0);
+	pView->fpwobble_box->AddChild (pView->fpwobble_button);
+	pView->fpwobble_box->AddChild (pView->fpwobble_slider);
+	
+	pView->fpreset_box = new G4OpenGLXmFramedBox ("Reset view",
+						      True);
+	pView->fpmiscellany_top->AddChild (pView->fpreset_box);
+	
+	XtCallbackRec* rst_cb_list = new XtCallbackRec[3];
+	rst_cb_list[0].callback = reset_callback;
+	rst_cb_list[0].closure = pView; 
+	rst_cb_list[1].callback = update_panels_callback;
+	rst_cb_list[1].closure = pView; 
+	rst_cb_list[2].callback = NULL;
+	
+	pView->fpreset_button = new G4OpenGLXmPushButton ("Reset",
+							  rst_cb_list);
+	
+	pView->fpreset_box->AddChild (pView->fpreset_button);
+	
+	pView->fpproj_style_box = new G4OpenGLXmFramedBox ("Projection style",
+							   True);
+	pView->fpmiscellany_top->AddChild (pView->fpproj_style_box);
+	
+	XtCallbackRec* proj_cb_list = new XtCallbackRec[2];
+	proj_cb_list[0].callback = projection_callback;
+	proj_cb_list[0].closure = pView; 
+	proj_cb_list[1].callback = NULL;
+	
+	pView->fporthogonal_button = new G4OpenGLXmRadioButton ("Orthographic",
+								proj_cb_list,
+								pView->fVP.GetFieldHalfAngle() > 0. ? False : True,
+								0);
+	
+	pView->fpperspective_button = new G4OpenGLXmRadioButton ("Perspective",
+								 proj_cb_list,
+								 pView->fVP.GetFieldHalfAngle() > 0. ? True : False,
+								 1);
+	
+	pView->fpfov_text = new G4OpenGLXmTextField ("Field of view 0.1 -> 89.5 degrees.",
+						     &(pView->fov));
+	
+	pView->fpproj_style_box->AddChild (pView->fpperspective_button);
+	pView->fpproj_style_box->AddChild (pView->fporthogonal_button);
+	pView->fpproj_style_box->AddChild (pView->fpfov_text);
+	
+	pView->fpmiscellany_top->Realize ();
+
+      }
+      
+      break;
+    }
+  
+  case 1:
+    {
+      G4Xt::getInstance () -> RequireExitSecondaryLoop (OGL_EXIT_CODE);
+      break;
+    }
+  
+  case 2:
+    {
+      if (!pView->fpprint_top) {
+	
+	std::ostringstream print_Name;
+	print_Name << pView->GetSceneHandler()->GetSceneHandlerId() << '-' << pView->fViewId;
+	
+	pView->fpprint_top = new G4OpenGLXmTopLevelShell (pView, 
+							  (char*)print_Name.str().c_str());
+
+	pView->fpprint_box = new G4OpenGLXmFramedBox ("Create EPS file of current view",
+						       False);
+
+	pView->fpprint_top->AddChild (pView->fpprint_box);
+	
+	pView->fpprint_col_box = new G4OpenGLXmFramedBox ("Colour choice",
+							  True);
+	pView->fpprint_top->AddChild (pView->fpprint_col_box);
+
+	XtCallbackRec* prcol_cb_list = new XtCallbackRec[2];
+	prcol_cb_list[0].callback = set_print_colour_callback;
+	prcol_cb_list[0].closure = pView; 
+	prcol_cb_list[1].callback = NULL;
+	
+	pView->fpprint_col_radio1 = new G4OpenGLXmRadioButton ("Black and white",
+							       prcol_cb_list,
+							       pView->fPrintColour==false ? True : False,
+							       0);
+	
+	pView->fpprint_col_radio2 = new G4OpenGLXmRadioButton ("Colour",
+							       prcol_cb_list,
+							       pView->fPrintColour==true ? True : False,
+							       1);
+	
+	pView->fpprint_col_box->AddChild (pView->fpprint_col_radio1);
+	pView->fpprint_col_box->AddChild (pView->fpprint_col_radio2);
+
+	pView->fpprint_style_box = new G4OpenGLXmFramedBox ("File type",
+							    True);
+	pView->fpprint_top->AddChild (pView->fpprint_style_box);
+
+	XtCallbackRec* prsty_cb_list = new XtCallbackRec[2];
+	prsty_cb_list[0].callback = set_print_style_callback;
+	prsty_cb_list[0].closure = pView; 
+	prsty_cb_list[1].callback = NULL;
+	
+	pView->fpprint_style_radio1 = new G4OpenGLXmRadioButton ("Screen dump (pixmap)",
+								 prsty_cb_list,
+								 pView->fVectoredPs==false ? True : False,
+								 0);
+	
+	pView->fpprint_style_radio2 = new G4OpenGLXmRadioButton ("PostScript",
+								 prsty_cb_list,
+								 pView->fVectoredPs==true ? True : False,
+								 1);
+	
+	pView->fpprint_style_box->AddChild (pView->fpprint_style_radio1);
+	pView->fpprint_style_box->AddChild (pView->fpprint_style_radio2);
+	
+	pView->fpprint_text = new G4OpenGLXmTextField ("Name of .eps file to save",
+						       (pView->getRealPrintFilename().c_str()));
+	pView->fpprint_box->AddChild (pView->fpprint_text);	
+	
+	pView->fpprint_line = new G4OpenGLXmSeparator ();
+	pView->fpprint_box->AddChild (pView->fpprint_line);
+
+	XtCallbackRec* pri_cb_list = new XtCallbackRec[2];
+	pri_cb_list[0].callback = print_callback;
+	pri_cb_list[0].closure = pView; 
+	pri_cb_list[1].callback = NULL;
+	
+	
+	pView->fpprint_button = new G4OpenGLXmPushButton ("Create EPS file",
+							  pri_cb_list);
+	
+	pView->fpprint_box->AddChild (pView->fpprint_button);
+	pView->fpprint_top->Realize ();
+
+      }
+      
+      ///ajw
+      break;
+    }
+  
+  default:
+    G4Exception("Unrecognised widget child of misc_callback.");
+  }
+  
+  return;
+  
+}
+
+void G4OpenGLXmViewer::set_wob_sens_callback (Widget w, 
+					    XtPointer clientData, 
+					    XtPointer callData) 
+{
+  XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct*) callData;
+  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
+  short dp = -1;
+  G4float ten_to_the_dp = 10.;
+  
+  XtVaGetValues (w, 
+		 XmNdecimalPoints, &dp,
+		 NULL);
+  
+  if (dp == 0) {
+    ten_to_the_dp = 1.;
+  } else if ( dp > 0) {
+    for (G4int i = 1; i < (G4int)dp; i++) {
+      ten_to_the_dp *= 10.;
+    }
+  } else {
+    G4Exception("Bad value returned for dp in set_rot_sens_callback");
+  }
+  
+  pView->wob_sens = (G4float)(cbs->value) / ten_to_the_dp;
+}  
+
+void G4OpenGLXmViewer::update_panels_callback (Widget, 
+					     XtPointer clientData, 
+					     XtPointer) 
+{
+  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
+  
+  if (pView->fppanning_slider) {
+    pView->fppanning_slider->SetMaxValue (pView->pan_sens_limit);
+  }
+  if (pView->fprotation_slider) {
+    pView->fprotation_slider->SetMaxValue (pView->rot_sens_limit);
+  }
+  
+  if (pView->fpzoom_slider) {
+    pView->fpzoom_slider->SetMaxValue (pView->zoom_high);
+    pView->fpzoom_slider->SetMinValue (pView->zoom_low);
+    pView->fpzoom_slider->SetInitialValue (pView->fVP.GetZoomFactor());
+  }
+  
+  if (pView->fpdolly_slider) {
+    pView->fpdolly_slider->SetMaxValue (pView->dolly_high);
+    pView->fpdolly_slider->SetMinValue (pView->dolly_low);
+  }
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmPanningCallbacks.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmPanningCallbacks.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmPanningCallbacks.cc	(revision 1102)
@@ -0,0 +1,249 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmPanningCallbacks.cc,v 1.10 2009/02/04 16:48:41 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Andrew Walkden  16th April 1997
+// G4OpenGLXmPanningCallbacks : 
+//                       Several callback functions used by
+//                       elements of the control panel to`pan' 
+//                       the view (i.e. move the viewpoint and 
+//                       camera positions by equal amounts).
+//                       Zoom callback is also here.
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4OpenGLXmViewer.hh"
+#include "G4VSceneHandler.hh"
+#include <Xm/ToggleB.h>
+
+#include "G4Scene.hh"
+
+void G4OpenGLXmViewer::zoom_callback (Widget w, 
+				    XtPointer clientData, 
+				    XtPointer callData) 
+{
+  XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct*) callData;
+  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
+  short dp = -1;
+  G4float ten_to_the_dp = 10.;
+
+  XtVaGetValues (w, 
+		 XmNdecimalPoints, &dp,
+		 NULL);
+
+  if (dp == 0) {
+    ten_to_the_dp = 1.;
+  } else if ( dp > 0) {
+    for (G4int i = 1; i < (G4int)dp; i++) {
+      ten_to_the_dp *= 10.;
+    }
+  } else {
+    G4cout << "dp is " << dp << G4endl;
+    return;
+  }
+
+
+  G4double zoomBy = (G4double)(cbs->value) / ten_to_the_dp;
+  if (zoomBy <= 0.01) {
+    zoomBy = 0.01;
+  }
+
+  pView->fVP.SetZoomFactor (zoomBy);
+  pView->SetView ();
+  pView->ClearView ();
+  pView -> DrawView ();
+}  
+
+void G4OpenGLXmViewer::dolly_callback (Widget w, 
+				     XtPointer clientData, 
+				     XtPointer callData) 
+{
+  XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct*) callData;
+  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
+  short dp = -1;
+  G4float ten_to_the_dp = 10.;
+
+  XtVaGetValues (w, 
+		 XmNdecimalPoints, &dp,
+		 NULL);
+
+  if (dp == 0) {
+    ten_to_the_dp = 1.;
+  } else if ( dp > 0) {
+    for (G4int i = 1; i < (G4int)dp; i++) {
+      ten_to_the_dp *= 10.;
+    }
+  } else {
+    G4cout << "dp is " << dp << G4endl;
+    return;
+  }
+
+  G4double dolly = (G4double)(cbs->value) / ten_to_the_dp;
+
+  pView->fVP.SetDolly (dolly);
+  pView->SetView ();
+  pView->ClearView ();
+  pView->DrawView ();
+
+}  
+
+void G4OpenGLXmViewer::pan_left_right_callback (Widget w, 
+					      XtPointer clientData, 
+					      XtPointer callData) 
+{
+  XmArrowButtonCallbackStruct *cbs = (XmArrowButtonCallbackStruct*) callData;
+  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
+
+  pView->pan_right = get_boolean_userData (w);
+
+  if (cbs->reason == XmCR_ARM) {
+    left_right_pan_callback (pView,NULL);
+  } else if (cbs->reason == XmCR_DISARM) {
+    XtRemoveTimeOut (pView->pan_timer);
+  }
+}
+
+void G4OpenGLXmViewer::left_right_pan_callback (XtPointer clientData,
+					      XtIntervalId* timer_id) 
+
+{
+  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
+  G4double delta;
+  
+  if (pView->pan_right) {
+    delta = (G4double)pView->pan_sens;
+  } else {
+    delta = -((G4double)pView->pan_sens);
+  }
+  
+  G4Point3D stp
+    = pView -> GetSceneHandler()->GetScene()->GetStandardTargetPoint();
+
+  G4Point3D tp = stp + pView -> fVP.GetCurrentTargetPoint ();
+  
+  const G4Vector3D& upVector = pView->fVP.GetUpVector ();
+  const G4Vector3D& vpVector = pView->fVP.GetViewpointDirection ();
+  
+  G4Vector3D unitRight = (upVector.cross (vpVector)).unit();
+  G4Vector3D unitUp    = (vpVector.cross (unitRight)).unit();
+  
+  tp += delta * unitRight;
+  pView->fVP.SetCurrentTargetPoint (tp - stp);
+
+  pView->SetView ();
+  pView->ClearView ();
+  pView->DrawView ();
+
+  pView->pan_timer = XtAppAddTimeOut 
+    (pView->app,
+     timer_id == NULL ? 500 : 1,
+     left_right_pan_callback,
+     pView);
+}  
+
+void G4OpenGLXmViewer::pan_up_down_callback (Widget w, 
+					   XtPointer clientData, 
+					   XtPointer callData) 
+{
+  XmArrowButtonCallbackStruct *cbs = (XmArrowButtonCallbackStruct*) callData;
+  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
+
+  pView->pan_up = get_boolean_userData (w);
+
+  if (cbs->reason == XmCR_ARM) {
+    up_down_pan_callback (pView,NULL);
+  } else if (cbs->reason == XmCR_DISARM) {
+    XtRemoveTimeOut (pView->pan_timer);
+  }
+}
+
+void G4OpenGLXmViewer::up_down_pan_callback (XtPointer clientData,
+					   XtIntervalId* timer_id) 
+{
+  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
+  G4double delta;
+  
+  if (pView->pan_up) {
+    delta = (G4double)pView->pan_sens;
+  } else {
+    delta = -((G4double)pView->pan_sens);
+  }
+  
+  G4Point3D stp
+    = pView -> GetSceneHandler()->GetScene()->GetStandardTargetPoint();
+  G4Point3D tp = stp + pView -> fVP.GetCurrentTargetPoint ();
+  const G4Vector3D& upVector = pView->fVP.GetUpVector ();
+  const G4Vector3D& vpVector = pView->fVP.GetViewpointDirection ();
+  
+  G4Vector3D unitRight = (upVector.cross (vpVector)).unit();
+  G4Vector3D unitUp    = (vpVector.cross (unitRight)).unit();
+  tp += delta * unitUp;
+  pView->fVP.SetCurrentTargetPoint (tp - stp);
+  
+  pView->SetView ();
+  pView->ClearView ();
+  pView->DrawView ();
+
+  pView->pan_timer = XtAppAddTimeOut 
+    (pView->app,
+     timer_id == NULL ? 500 : 1,
+     up_down_pan_callback,
+     pView);
+}  
+
+void G4OpenGLXmViewer::set_pan_sens_callback (Widget w, 
+					    XtPointer clientData, 
+					    XtPointer callData) 
+{
+  XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct*) callData;
+  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
+  short dp = -1;
+  G4float ten_to_the_dp = 10.;
+
+  XtVaGetValues (w, 
+		 XmNdecimalPoints, &dp,
+		 NULL);
+
+  if (dp == 0) {
+    ten_to_the_dp = 1.;
+  } else if ( dp > 0) {
+    for (G4int i = 1; i < (G4int)dp; i++) {
+      ten_to_the_dp *= 10.;
+    }
+  } else {
+    G4cout << "dp is " << dp << G4endl;
+    return;
+  }
+  
+  pView->pan_sens = (G4double)((cbs->value) / ten_to_the_dp);
+}  
+
+#endif
+
+
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmPushButton.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmPushButton.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmPushButton.cc	(revision 1102)
@@ -0,0 +1,110 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmPushButton.cc,v 1.8 2009/02/04 16:48:41 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+//Push button class. Inherits from G4OpenGLXmVWidgetComponent
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4OpenGLXmVWidgetComponent.hh"
+#include "G4OpenGLXmVWidgetContainer.hh"
+#include "G4OpenGLXmPushButton.hh"
+#include <X11/Intrinsic.h>
+#include <Xm/PushB.h>
+
+#include "globals.hh"
+
+G4OpenGLXmPushButton::G4OpenGLXmPushButton (const char* n,
+					    XtCallbackRec* c) 
+{
+  name = n;
+  callback = c;
+}
+
+G4OpenGLXmPushButton::~G4OpenGLXmPushButton ()
+{}
+
+void G4OpenGLXmPushButton::SetName (const char* n) 
+{
+  name = n;
+  XmString button_string = XmStringCreateLocalized ((char*)name);
+  XtVaSetValues (button,
+		 XmNlabelString, button_string,
+		 NULL);
+  XmStringFree (button_string);
+}
+
+const char* G4OpenGLXmPushButton::GetName () 
+{
+  return name;
+}
+
+void G4OpenGLXmPushButton::AddYourselfTo (G4OpenGLXmVWidgetContainer* container)
+{
+
+  pView = container->GetView ();
+  ProcesspView ();
+  parent = container->GetPointerToWidget ();
+
+  XmString button_str = XmStringCreateLocalized ((char*)name);
+  button = XtVaCreateManagedWidget 
+    (name,
+     xmPushButtonWidgetClass,
+     *parent,
+     XmNlabelString, button_str,
+     XmNalignment, XmALIGNMENT_CENTER,
+     XmNuserData, pView,
+
+     XtNvisual, visual, 
+     XtNdepth, depth, 
+     XtNcolormap, cmap, 
+     XtNborderColor, borcol,
+     XtNbackground, bgnd,
+     
+     NULL);
+  
+  XtAddCallbacks (button,
+		  XmNarmCallback,
+		  callback);
+  
+  XmStringFree (button_str);
+}
+
+Widget* G4OpenGLXmPushButton::GetPointerToParent ()
+{
+  return parent;
+}
+
+Widget* G4OpenGLXmPushButton::GetPointerToWidget () 
+{
+  return &button;
+}
+
+#endif
+
+
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmRadioButton.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmRadioButton.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmRadioButton.cc	(revision 1102)
@@ -0,0 +1,111 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmRadioButton.cc,v 1.8 2009/02/04 16:48:41 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+//Radio button class. Inherits from G4OpenGLXmVWidgetComponent
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4OpenGLXmVWidgetComponent.hh"
+#include "G4OpenGLXmVWidgetContainer.hh"
+#include "G4OpenGLXmRadioButton.hh"
+#include <X11/Intrinsic.h>
+#include <Xm/ToggleB.h>
+
+#include "globals.hh"
+
+G4OpenGLXmRadioButton::G4OpenGLXmRadioButton (const char* n,
+					      XtCallbackRec* c,
+					      G4bool d,
+					      G4int num) 
+{
+  name = n;
+  callback = c;
+  default_button = d;
+  number = num;
+}
+
+G4OpenGLXmRadioButton::~G4OpenGLXmRadioButton ()
+{}
+
+void G4OpenGLXmRadioButton::SetName (const char* n) 
+{
+  name = n;
+  XmString button_string = XmStringCreateLocalized ((char*)name);
+  XtVaSetValues (button,
+		 XmNlabelString, button_string,
+		 NULL);
+  XmStringFree (button_string);
+}
+
+const char* G4OpenGLXmRadioButton::GetName () 
+{
+  return name;
+}
+
+void G4OpenGLXmRadioButton::AddYourselfTo (G4OpenGLXmVWidgetContainer* container)
+{
+
+  pView = container->GetView ();
+  ProcesspView ();
+  parent = container->GetPointerToWidget ();
+  XmString button_string = XmStringCreateLocalized ((char*)name);
+  button = XtVaCreateManagedWidget (name,
+				    xmToggleButtonWidgetClass,
+				    *parent,
+				    
+				    XmNlabelString, button_string,
+				    XmNset, default_button,
+				    XmNuserData, number,
+				    
+				    XtNvisual, visual,
+				    XtNdepth, depth,
+				    XtNcolormap, cmap,
+				    XtNborderColor, borcol,
+				    XtNbackground, bgnd,
+				    
+				    NULL);
+  
+  XtAddCallbacks (button,
+		  XmNarmCallback,
+		  callback);
+
+  XmStringFree (button_string);
+}
+
+Widget* G4OpenGLXmRadioButton::GetPointerToParent ()
+{
+  return parent;
+}
+
+Widget* G4OpenGLXmRadioButton::GetPointerToWidget () 
+{
+  return &button;
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmRotationCallbacks.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmRotationCallbacks.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmRotationCallbacks.cc	(revision 1102)
@@ -0,0 +1,320 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmRotationCallbacks.cc,v 1.17 2009/01/19 16:53:42 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Andrew Walkden  16th April 1997
+// G4OpenGLXmRotationCallbacks : 
+//                       Several callback functions used by
+//                       elements of the control panel to
+//                       rotate the view.
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4OpenGLXmViewer.hh"
+
+#include "G4Scene.hh"
+#include "G4UImanager.hh"
+#include "G4ios.hh"
+
+void G4OpenGLXmViewer::theta_rotation_callback (Widget w, 
+					      XtPointer clientData, 
+					      XtPointer callData) 
+{
+  XmArrowButtonCallbackStruct *cbs = (XmArrowButtonCallbackStruct*) callData;
+  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
+
+  pView->rotate_right = get_boolean_userData (w);
+
+  if (cbs->reason == XmCR_ARM) {
+    rotate_in_theta (pView, NULL);
+  } else if (cbs->reason == XmCR_DISARM) {
+    XtRemoveTimeOut (pView->rotation_timer);
+  }
+}
+
+void G4OpenGLXmViewer::rotate_in_theta (XtPointer clientData,
+				      XtIntervalId* timer_id) 
+{
+  //theta spin stuff here
+  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
+
+  if (pView->rotate_right) {
+    pView->rotateScene((G4double)pView->rot_sens,0,1);
+  } else {
+    pView->rotateScene(-(G4double)pView->rot_sens,0,1);
+  }
+  /*
+  G4double delta_theta;
+
+  if (pView->fVP.GetLightsMoveWithCamera()) {
+    if (pView->rotate_right) {
+      delta_theta = -((G4double)pView->rot_sens);
+    } else {
+      delta_theta = (G4double)pView->rot_sens;
+    }
+  } else {
+    if (pView->rotate_right) {
+      delta_theta = (G4double)pView->rot_sens;
+    } else {
+      delta_theta = -((G4double)pView->rot_sens);
+    }
+  }    
+  delta_theta *= deg;
+  // Rotates by fixed azimuthal angle delta_theta.
+
+  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 = std::sqrt (1. - std::pow (cosalpha, 2));
+  G4Vector3D yprime = (zprime.cross (vp)).unit ();
+  G4Vector3D xprime = yprime.cross (zprime);
+  // Projection of vp on plane perpendicular to up...
+  G4Vector3D a1 = sinalpha * xprime;
+  // Required new projection...
+  G4Vector3D a2 =
+    sinalpha * (std::cos (delta_theta) * xprime + std::sin (delta_theta) * yprime);
+  // Required Increment vector...
+  G4Vector3D delta = a2 - a1;
+  // So new viewpoint is...
+  G4Vector3D viewPoint = vp + delta;
+
+  pView->fVP.SetViewAndLights (viewPoint);  
+  */
+
+  pView->SetView ();
+  pView->ClearView ();
+  pView->DrawView ();
+
+  pView->rotation_timer = XtAppAddTimeOut 
+    (pView->app,
+     timer_id == NULL ? 500 : 1,
+     rotate_in_theta,
+     pView);
+}  
+
+void G4OpenGLXmViewer::phi_rotation_callback (Widget w, 
+					    XtPointer clientData, 
+					    XtPointer callData) 
+{
+  XmArrowButtonCallbackStruct *cbs = (XmArrowButtonCallbackStruct*) callData;
+  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
+
+  pView->rotate_up = get_boolean_userData (w);
+
+  if (cbs->reason == XmCR_ARM) {
+    rotate_in_phi (pView, NULL);
+  } else if (cbs->reason == XmCR_DISARM) {
+    XtRemoveTimeOut (pView->rotation_timer);
+  }
+}
+
+void G4OpenGLXmViewer::rotate_in_phi (XtPointer clientData,
+				    XtIntervalId* timer_id)
+{
+  //phi spin stuff here
+  //  G4double delta_alpha;
+  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
+
+  if (pView -> rotate_up) {
+    pView->rotateScene(0,-(G4double)pView->rot_sens,1);
+  } else {
+    pView->rotateScene(0,(G4double)pView->rot_sens,1);
+  }
+  /*
+  if (pView->fVP.GetLightsMoveWithCamera()) {
+    if (pView -> rotate_up) {
+      delta_alpha = -((G4double)pView->rot_sens);
+    } else {
+      delta_alpha = (G4double)pView->rot_sens;
+    }
+  } else {
+    if (pView -> rotate_up) {
+      delta_alpha = (G4double)pView->rot_sens;
+    } else {
+      delta_alpha = -((G4double)pView->rot_sens);
+    }
+  }    
+
+  delta_alpha *= deg;
+
+  const G4Vector3D& vp = pView->fVP.GetViewpointDirection ().unit ();
+  const G4Vector3D& up = pView->fVP.GetUpVector ().unit ();
+
+  const G4Vector3D& xprime = vp;
+  G4Vector3D yprime = (up.cross(xprime)).unit();
+  G4Vector3D zprime = (xprime.cross(yprime)).unit();
+
+  G4Vector3D new_vp = std::cos(delta_alpha) * xprime + std::sin(delta_alpha) * zprime;
+
+  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 ();
+  
+  pView->rotation_timer = XtAppAddTimeOut 
+    (pView->app,
+     timer_id == NULL ? 500 : 1,
+     rotate_in_phi,
+     pView);
+}
+
+void G4OpenGLXmViewer::set_rot_sens_callback (Widget w, 
+					    XtPointer clientData, 
+					    XtPointer callData) 
+{
+  XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct*) callData;
+  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
+  short dp = -1;
+  G4float ten_to_the_dp = 10.;
+
+  XtVaGetValues (w, 
+		 XmNdecimalPoints, &dp,
+		 NULL);
+
+  if (dp == 0) {
+    ten_to_the_dp = 1.;
+  } else if ( dp > 0) {
+    for (G4int i = 1; i < (G4int)dp; i++) {
+      ten_to_the_dp *= 10.;
+    }
+  } else {
+    G4Exception("Bad value returned for dp in set_rot_sens_callback");
+  }
+
+  pView->rot_sens = (G4float)(cbs->value) / ten_to_the_dp;
+}  
+
+void G4OpenGLXmViewer::set_rot_subject_callback (Widget w, 
+					       XtPointer clientData, 
+					       XtPointer) 
+{
+  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*)clientData;
+  
+  G4int choice = get_int_userData (w);
+  
+  switch (choice) {
+  case 0: 
+    {
+      pView->fVP.SetLightsMoveWithCamera (true);
+      break;
+    }
+  case 1:
+    {
+      pView->fVP.SetLightsMoveWithCamera (false);
+      break;
+    }
+  default:
+    {
+      G4Exception("Unrecognised choice made in set_rot_subject_callback"); 
+    }
+  }
+}  
+
+void G4OpenGLXmViewer::wobble_callback (Widget w, 
+				      XtPointer, 
+				      XtPointer) 
+{
+  G4OpenGLXmViewer* pView;
+  
+  XtVaGetValues (w,
+		 XmNuserData, &pView,
+		 NULL);
+  
+  pView->original_vp = pView->fVP.GetViewpointDirection();
+  pView->wobble_timer = XtAppAddTimeOut
+    (pView->app,
+     (long unsigned int) (1000. * (1. / pView->wob_sens)),
+     wobble_timer_callback,
+     pView);
+}  
+
+void G4OpenGLXmViewer::wobble_timer_callback (XtPointer clientData,
+					    XtIntervalId*) 
+{
+  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*)clientData;
+  const G4Vector3D& up = pView->fVP.GetUpVector();
+  G4Vector3D third_axis = up.cross(pView->original_vp);
+  G4double pi_div_by_ten = pi / 10.0;
+  G4Vector3D d_up = 0.1 * (std::sin ((G4double)pView->frameNo * pi_div_by_ten * 2.)) * up;
+  G4Vector3D d_third_axis = 0.1 * (std::sin ((G4double)pView->frameNo * (pi_div_by_ten))) * third_axis;
+
+  pView->fVP.SetViewAndLights (pView->original_vp + d_up + d_third_axis);
+
+  pView->SetView ();
+  pView->ClearView ();
+  pView->DrawView ();
+  
+  if (pView->frameNo++ == 20) {
+    if (pView->wobble_timer) {
+      XtRemoveTimeOut (pView->wobble_timer);
+      pView->frameNo = 0;
+      pView->fVP.SetViewAndLights (pView->original_vp);
+      pView->SetView ();
+      pView->ClearView ();
+      pView->DrawView ();
+   }
+  } else {
+    pView->wobble_timer = XtAppAddTimeOut
+      (pView->app,
+       (long unsigned int) (1000. * (1. / pView->wob_sens)),
+       wobble_timer_callback,
+       pView);
+  }
+}
+
+void G4OpenGLXmViewer::reset_callback (Widget w, 
+				     XtPointer, 
+				     XtPointer) 
+{
+  
+  G4OpenGLXmViewer* pView;
+  
+  XtVaGetValues (w,
+		 XmNuserData, &pView,
+		 NULL);
+  
+  pView->fVP.SetCurrentTargetPoint(G4Point3D());
+  pView->fVP.SetZoomFactor(1.0);
+  pView->fVP.SetDolly(0.0);
+  pView->SetView ();
+  pView->ClearView ();
+  pView->DrawView ();
+  pView->zoom_low = 0.1;
+  pView->zoom_high = 10.0;
+  
+}
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmSeparator.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmSeparator.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmSeparator.cc	(revision 1102)
@@ -0,0 +1,84 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmSeparator.cc,v 1.7 2009/02/04 16:48:41 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+//Separator class. Inherits from G4OpenGLXmVWidgetComponent
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4OpenGLXmVWidgetComponent.hh"
+#include "G4OpenGLXmVWidgetContainer.hh"
+#include "G4OpenGLXmSeparator.hh"
+#include <X11/Intrinsic.h>
+#include <Xm/Separator.h>
+
+#include "globals.hh"
+
+G4OpenGLXmSeparator::G4OpenGLXmSeparator (unsigned char l) 
+{
+  line_type = l;
+}
+
+G4OpenGLXmSeparator::~G4OpenGLXmSeparator ()
+{}
+
+void G4OpenGLXmSeparator::AddYourselfTo (G4OpenGLXmVWidgetContainer* container)
+{
+
+  pView = container->GetView ();
+  ProcesspView ();
+
+  parent = container->GetPointerToWidget ();
+
+  line = XtVaCreateManagedWidget ("sep",
+				  xmSeparatorWidgetClass,
+				  *parent,
+				  XmNseparatorType, line_type,
+				  XmNmargin, 1,
+				  XmNorientation, XmHORIZONTAL,
+				  
+				  XtNvisual, visual, 
+				  XtNdepth, depth, 
+				  XtNcolormap, cmap, 
+				  XtNborderColor, borcol,
+				  XtNbackground, bgnd,
+				  
+				  NULL);
+}
+
+Widget* G4OpenGLXmSeparator::GetPointerToParent ()
+{
+  return parent;
+}
+
+Widget* G4OpenGLXmSeparator::GetPointerToWidget () 
+{
+  return &line;
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmSliderBar.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmSliderBar.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmSliderBar.cc	(revision 1102)
@@ -0,0 +1,227 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmSliderBar.cc,v 1.7 2006/06/29 21:20:00 gunter Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
+//
+//Slider bar class. Inherits from G4OpenGLXmVWidgetComponent
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4OpenGLXmVWidgetComponent.hh"
+#include "G4OpenGLXmVWidgetContainer.hh"
+#include "G4OpenGLXmSliderBar.hh"
+#include <X11/Intrinsic.h>
+#include <Xm/Scale.h>
+#include "globals.hh"
+
+G4OpenGLXmSliderBar::G4OpenGLXmSliderBar (const char* n,
+					  XtCallbackRec* c,
+					  G4bool s,
+					  short dp,
+					  G4double v,
+					  G4double max,
+					  G4double min,
+					  unsigned char o,
+					  unsigned char d) 
+{
+  name = n;
+  callback = c;
+  show = s;
+  decimal_places = dp;
+  initial_value = int(v * std::pow(10.0, (G4double)dp));
+  max_value = int(max * std::pow(10.0, (G4double)dp));
+  min_value = int(min * std::pow(10.0, (G4double)dp));
+  orientation = o;
+  direction = d;
+}
+
+G4OpenGLXmSliderBar::~G4OpenGLXmSliderBar ()
+{}
+
+const char* G4OpenGLXmSliderBar::GetName () 
+{
+  return name;
+}
+
+G4bool G4OpenGLXmSliderBar::GetShow () 
+{
+  return show;
+}
+
+short G4OpenGLXmSliderBar::GetDecimalPlaces () 
+{
+  return decimal_places;
+}
+
+G4double G4OpenGLXmSliderBar::GetInitialValue () 
+{
+  return (G4double)initial_value / std::pow(10.0, (G4double)GetDecimalPlaces());
+}
+
+G4double G4OpenGLXmSliderBar::GetMaxValue () 
+{
+  return (G4double)max_value / std::pow(10.0, (G4double)GetDecimalPlaces());
+}
+
+G4double G4OpenGLXmSliderBar::GetMinValue () 
+{
+  return (G4double)min_value / std::pow(10.0, (G4double)GetDecimalPlaces());
+}
+
+unsigned char G4OpenGLXmSliderBar::GetOrientation () 
+{
+  return orientation;
+}
+
+unsigned char G4OpenGLXmSliderBar::GetDirection () 
+{
+  return direction;
+}
+
+void G4OpenGLXmSliderBar::SetName (const char* n) 
+{
+  name = n;
+  XmString sliderbar_string = XmStringCreateLocalized ((char*)name);
+  XtVaSetValues (sliderbar,
+		 XmNlabelString, sliderbar_string,
+		 NULL);
+ XmStringFree (sliderbar_string);
+}
+
+void G4OpenGLXmSliderBar::SetShow (G4bool s) 
+{
+  show = s;
+  XtVaSetValues (sliderbar,
+		 XmNshowValue, show,
+		 NULL);
+  
+}
+
+void G4OpenGLXmSliderBar::SetDecimalPlaces (short dp) 
+{
+  decimal_places = dp;
+  XtVaSetValues (sliderbar,
+		 XmNdecimalPoints, decimal_places,
+		 NULL);
+  
+}
+
+void G4OpenGLXmSliderBar::SetInitialValue (G4double v) 
+{
+  initial_value = int(v * std::pow(10.0, (G4double)GetDecimalPlaces()));
+  XtVaSetValues (sliderbar,
+		 XmNvalue, initial_value,
+		 NULL);
+  
+}
+
+void G4OpenGLXmSliderBar::SetMaxValue (G4double v) 
+{
+  max_value = int(v * std::pow(10.0, (G4double)GetDecimalPlaces()));
+  XtVaSetValues (sliderbar,
+		 XmNmaximum, max_value,
+		 NULL);
+  
+}
+
+void G4OpenGLXmSliderBar::SetMinValue (G4double v) 
+{
+  min_value = int(v * std::pow(10.0, (G4double)GetDecimalPlaces()));
+  XtVaSetValues (sliderbar,
+		 XmNminimum, min_value,
+		 NULL);
+  
+}
+
+void G4OpenGLXmSliderBar::SetOrientation (unsigned char o) 
+{
+  orientation = o;
+  XtVaSetValues (sliderbar,
+		 XmNorientation, orientation,
+		 NULL);
+  
+}
+
+void G4OpenGLXmSliderBar::SetDirection (unsigned char d) 
+{
+  direction = d;
+  XtVaSetValues (sliderbar,
+		 XmNprocessingDirection, direction,
+		 NULL);
+  
+}
+
+void G4OpenGLXmSliderBar::AddYourselfTo (G4OpenGLXmVWidgetContainer* container)
+{
+
+  pView = container->GetView ();
+  ProcesspView ();
+
+  parent = container->GetPointerToWidget ();
+  XmString name_string = XmStringCreateLocalized ((char*)name);
+  sliderbar = XtVaCreateManagedWidget (name,
+				       xmScaleWidgetClass,
+				       *parent,
+				       
+				       XmNtitleString, name_string,
+				       XmNmaximum, max_value,
+				       XmNminimum, min_value,
+				       XmNvalue, initial_value,
+				       XmNshowValue, show,
+				       XmNdecimalPoints, decimal_places,
+				       XmNorientation, orientation,
+				       XmNprocessingDirection, direction,
+  
+				       XtNvisual, visual,
+				       XtNdepth, depth,
+				       XtNcolormap, cmap,
+				       XtNborderColor, borcol,
+				       XtNbackground, bgnd,
+
+				       NULL);
+				       
+  XtAddCallbacks (sliderbar,
+		  XmNvalueChangedCallback,
+		  callback);
+
+  XtAddCallbacks (sliderbar,
+		  XmNdragCallback,
+		  callback);
+  XmStringFree (name_string);
+}
+
+Widget* G4OpenGLXmSliderBar::GetPointerToParent ()
+{
+  return parent;
+}
+
+Widget* G4OpenGLXmSliderBar::GetPointerToWidget () 
+{
+  return &sliderbar;
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmStyleCallbacks.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmStyleCallbacks.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmStyleCallbacks.cc	(revision 1102)
@@ -0,0 +1,314 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmStyleCallbacks.cc,v 1.15 2009/01/19 16:53:42 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Andrew Walkden  16th April 1997
+// G4OpenGLXmStyleCallbacks : 
+//                       Several callback functions used by
+//                       elements of the control panel to
+//                       determine how to visualize the view.
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4OpenGLXmViewer.hh"
+
+void G4OpenGLXmViewer::drawing_style_callback (Widget w, 
+					     XtPointer clientData, 
+					     XtPointer) 
+{
+  G4long choice = (G4long)clientData;
+  G4OpenGLXmViewer* pView;
+  XtVaGetValues (XtParent(w),
+		 XmNuserData, &pView,
+		 NULL);
+  G4ViewParameters::DrawingStyle style;
+
+  switch (choice) {
+    
+  case 0:
+    style = G4ViewParameters::wireframe;
+    break;
+
+  case 1:
+    style = G4ViewParameters::hlr;
+    break;
+
+  case 2:
+    style = G4ViewParameters::hsr;
+    break;
+
+  case 3:
+    style = G4ViewParameters::hlhsr;
+    break;
+
+  default:
+    style = G4ViewParameters::wireframe;
+    G4Exception("Unrecognised case in drawing_style_callback.");
+  }
+
+  pView->fVP.SetDrawingStyle (style);
+  
+  pView->SetView ();
+  pView->ClearView ();
+  pView->DrawView ();
+}
+
+void G4OpenGLXmViewer::rep_style_callback (Widget w, 
+					 XtPointer clientData, 
+					 XtPointer) 
+{
+  G4long choice = (G4long)clientData;
+  G4OpenGLXmViewer* pView;
+  XtVaGetValues (XtParent(w),
+		 XmNuserData, &pView,
+		 NULL);
+  G4ViewParameters::RepStyle style;
+
+  switch (choice) {
+    
+  case 0:
+    style = G4ViewParameters::polyhedron;
+    break;
+
+  case 1:
+    style = G4ViewParameters::nurbs;
+    break;
+
+  default:
+    style = G4ViewParameters::polyhedron;
+    G4Exception("Unrecognised case in rep_style_callback.");
+  }
+
+  pView->fVP.SetRepStyle (style);
+
+  pView->SetView ();
+  pView->ClearView ();
+  pView->DrawView ();
+}
+
+void G4OpenGLXmViewer::background_color_callback (Widget w, 
+						XtPointer clientData, 
+						XtPointer) 
+{
+  G4long choice = (G4long)clientData;
+  G4OpenGLXmViewer* pView;
+  XtVaGetValues (XtParent(w),
+		 XmNuserData, &pView,
+		 NULL);
+
+
+  //I need to revisit the kernel if the background colour changes and
+  //hidden line removal is enabled, because hlr drawing utilises the
+  //background colour in its drawing...
+  // (Note added by JA 13/9/2005) Background now handled in view
+  // parameters.  A kernel visit is triggered on change of background.
+  switch (choice) {
+    
+  case 0:
+    ((G4ViewParameters&)pView->GetViewParameters()).
+      SetBackgroundColour(G4Colour(1.,1.,1.));  // White
+    break;
+
+  case 1:
+    ((G4ViewParameters&)pView->GetViewParameters()).
+      SetBackgroundColour(G4Colour(0.,0.,0.));  // Black
+    break;
+
+  default:
+    G4Exception("Unrecognised case in background_color_callback.");
+  }
+
+  pView->SetView ();
+  pView->ClearView ();
+  pView->DrawView ();
+}
+
+void G4OpenGLXmViewer::transparency_callback (Widget w, 
+					    XtPointer clientData, 
+					    XtPointer) 
+{
+  G4long choice = (G4long)clientData;
+  G4OpenGLXmViewer* pView;
+  XtVaGetValues (XtParent(w),
+		 XmNuserData, &pView,
+		 NULL);
+
+  switch (choice) {
+    
+  case 0:
+    pView->transparency_enabled = false;
+    break;
+
+  case 1:
+    pView->transparency_enabled = true;
+    break;
+
+  default:
+    G4Exception("Unrecognised case in transparency_callback.");
+  }
+
+  pView->SetNeedKernelVisit (true);
+  pView->SetView ();
+  pView->ClearView ();
+  pView->DrawView ();
+}
+
+void G4OpenGLXmViewer::antialias_callback (Widget w, 
+					 XtPointer clientData, 
+					 XtPointer) 
+{
+  G4long choice = (G4long)clientData;
+  G4OpenGLXmViewer* pView;
+  XtVaGetValues (XtParent(w),
+		 XmNuserData, &pView,
+		 NULL);
+
+  switch (choice) {
+    
+  case 0:
+    pView->antialiasing_enabled = false;
+    glDisable (GL_LINE_SMOOTH);
+    glDisable (GL_POLYGON_SMOOTH);
+    break;
+
+  case 1:
+    pView->antialiasing_enabled = true;
+    glEnable (GL_LINE_SMOOTH);
+    glHint (GL_LINE_SMOOTH_HINT, GL_NICEST);
+    glEnable (GL_POLYGON_SMOOTH);
+    glHint (GL_POLYGON_SMOOTH_HINT, GL_NICEST);
+    break;
+
+  default:
+    G4Exception("Unrecognised case in antialiasing_callback.");
+  }
+
+  pView->SetView ();
+  pView->ClearView ();
+  pView->DrawView ();
+}
+
+void G4OpenGLXmViewer::haloing_callback (Widget w, 
+				       XtPointer clientData, 
+				       XtPointer) 
+{
+  G4long choice = (G4long)clientData;
+  G4OpenGLXmViewer* pView;
+  XtVaGetValues (XtParent(w),
+		 XmNuserData, &pView,
+		 NULL);
+
+  switch (choice) {
+    
+  case 0:
+    pView->haloing_enabled = false;
+    break;
+
+  case 1:
+    pView->haloing_enabled = true;
+    break;
+
+  default:
+    G4Exception("Unrecognised case in haloing_callback.");
+  }
+
+  pView->SetView ();
+  pView->ClearView ();
+  pView->DrawView ();
+}
+
+void G4OpenGLXmViewer::aux_edge_callback (Widget w, 
+				       XtPointer clientData, 
+				       XtPointer) 
+{
+  G4long choice = (G4long)clientData;
+  G4OpenGLXmViewer* pView;
+  XtVaGetValues (XtParent(w),
+		 XmNuserData, &pView,
+		 NULL);
+
+  switch (choice) {
+    
+  case 0:
+    pView->fVP.SetAuxEdgeVisible(false);
+    break;
+
+  case 1:
+    pView->fVP.SetAuxEdgeVisible(true);
+    break;
+
+  default:
+    G4Exception("Unrecognised case in aux_edge_callback.");
+  }
+
+  pView->SetNeedKernelVisit (true);
+  pView->SetView ();
+  pView->ClearView ();
+  pView->DrawView ();
+}
+
+void G4OpenGLXmViewer::projection_callback (Widget w, 
+					  XtPointer clientData, 
+					  XtPointer) 
+{
+  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*)clientData;
+
+  G4int choice = get_int_userData (w);
+
+  switch (choice) {
+  case 0:
+    {
+      pView->fVP.SetFieldHalfAngle (0.);
+      break;
+    }
+
+  case 1:
+    {
+      if (pView->fov > 89.5 || pView->fov <= 0.0) {
+	G4cout << "Field half angle should be 0 < angle <= 89.5 degrees.";
+	G4cout << G4endl;
+      }
+      else {
+	pView->fVP.SetFieldHalfAngle (pView->fov * deg);
+      }
+      break;
+    }
+  default:
+    {
+      G4Exception("Unrecognised choice made in projection_callback");
+    }
+  }
+
+  pView->SetView ();
+  pView->ClearView ();
+  pView->DrawView ();
+}  
+
+#endif
+
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmTextField.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmTextField.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmTextField.cc	(revision 1102)
@@ -0,0 +1,183 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmTextField.cc,v 1.9 2009/02/04 16:48:41 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+//Text field class. Inherits from G4OpenGLXmVWidgetComponent
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4OpenGLXmVWidgetComponent.hh"
+#include "G4OpenGLXmVWidgetContainer.hh"
+#include "G4OpenGLXmViewer.hh"
+#include "G4OpenGLXmTextField.hh"
+
+#include <X11/Intrinsic.h>
+#include <Xm/Label.h>
+#include <Xm/TextF.h>
+
+#include "globals.hh"
+
+G4OpenGLXmTextField::G4OpenGLXmTextField (const char* n,
+					  G4double* val)
+{
+  name = n;
+  initial = new char[50];
+  sprintf (initial, "%6.2f", *val);
+  value = (void*)val;
+  text=false;
+}
+
+G4OpenGLXmTextField::G4OpenGLXmTextField (const char* n,
+					  const char* val)
+{
+  name = n;
+  initial = new char[50];
+  sprintf (initial, "%s", val);
+  value = (void*)val;
+  text=true;
+  //  strcpy (initial, val);
+}
+
+G4OpenGLXmTextField::~G4OpenGLXmTextField ()
+{
+  delete[] initial;
+}
+
+void G4OpenGLXmTextField::SetName (const char* n) 
+{
+  name = n;
+  XmString text_string = XmStringCreateLocalized ((char*)name);
+  XtVaSetValues (text_label,
+		 XmNlabelString, text_string,
+		 NULL);
+  XmStringFree (text_string);
+}
+
+const char* G4OpenGLXmTextField::GetName () 
+{
+  return name;
+}
+
+void G4OpenGLXmTextField::SetValue (G4double val)
+{
+  sprintf (initial, "%6.2f", val);
+  
+  XtVaSetValues (text_field,
+		 XmNvalue, (String)initial,
+		 NULL);
+  
+}
+
+void G4OpenGLXmTextField::SetValue (const char* val)
+{
+  sprintf (initial, "%s", val);
+  //  strcpy (initial, val);
+
+  XtVaSetValues (text_field,
+		 XmNvalue, (String)initial,
+		 NULL);
+  
+}
+
+const char* G4OpenGLXmTextField::GetValue ()
+{
+  return initial;
+}
+
+void G4OpenGLXmTextField::AddYourselfTo (G4OpenGLXmVWidgetContainer* container)
+{
+
+  pView = container->GetView ();
+  ProcesspView ();
+  parent = container->GetPointerToWidget ();
+
+  char local_w_text[50];
+  strcpy (local_w_text, name);
+
+  char label_name[50];
+  strcpy (label_name, name);
+  strcat (label_name, "_label");
+  
+  char text_field_name[50];
+  strcpy (text_field_name, name);
+  strcat (text_field_name, "_text_field");
+  
+  XmString local_text = XmStringCreateLocalized (local_w_text);
+  text_label = XtVaCreateManagedWidget (label_name, 
+					xmLabelWidgetClass,
+					*parent,
+
+					XmNlabelString, local_text,
+					
+					XtNvisual, visual, 
+					XtNdepth, depth, 
+					XtNcolormap, cmap, 
+					XtNborderColor, borcol,
+					XtNbackground, bgnd,
+					
+					NULL);
+  XmStringFree (local_text);
+
+  text_field = XtVaCreateManagedWidget (text_field_name,
+					xmTextFieldWidgetClass,
+					*parent,
+
+					XmNvalue, (String)initial, 
+					
+					XtNvisual, visual, 
+					XtNdepth, depth, 
+					XtNcolormap, cmap, 
+					XtNborderColor, borcol,
+					XtNbackground, bgnd,
+					
+					NULL);
+
+  if (!text) {
+    XtAddCallback (text_field, 
+		   XmNvalueChangedCallback,
+		   G4OpenGLXmViewer::get_double_value_callback,
+		   value);
+  } else {
+    XtAddCallback (text_field, 
+		   XmNvalueChangedCallback,
+		   G4OpenGLXmViewer::get_text_callback,
+		   value);
+  }
+}
+
+Widget* G4OpenGLXmTextField::GetPointerToParent ()
+{
+  return parent;
+}
+
+Widget* G4OpenGLXmTextField::GetPointerToWidget () 
+{
+  return &text_field;
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmTopLevelShell.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmTopLevelShell.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmTopLevelShell.cc	(revision 1102)
@@ -0,0 +1,127 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmTopLevelShell.cc,v 1.7 2009/02/04 16:48:41 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+//Top level shell class
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4OpenGLXmTopLevelShell.hh"
+#include "G4OpenGLXmVWidgetContainer.hh"
+#include "G4OpenGLXmViewer.hh"
+
+#include <Xm/Frame.h>
+#include <Xm/RowColumn.h>
+
+G4OpenGLXmTopLevelShell::G4OpenGLXmTopLevelShell (G4OpenGLXmViewer* v,
+						  char* n) 
+{
+  pView = v;
+  ProcesspView ();
+  name = n;
+  toplevel = XtVaCreatePopupShell 
+    (name,
+     topLevelShellWidgetClass,
+     top,
+     
+     XtNiconName, name,
+     XtNtitle, name,
+     XmNdeleteResponse, XmDO_NOTHING,
+     XmNisHomogeneous, False,
+     
+     XtNvisual, visual, 
+     XtNdepth, depth, 
+     XtNcolormap, cmap, 
+     XtNborderColor, borcol,
+     XtNbackground, bgnd,
+     NULL);
+
+  frame = XtVaCreateManagedWidget (name,
+				   xmFrameWidgetClass,
+				   toplevel,
+				   
+				   XtNvisual, visual,
+				   XtNdepth, depth,
+				   XtNcolormap, cmap,
+				   XtNborderColor, borcol,
+				   XtNbackground, bgnd,
+				   
+				   NULL);
+  
+  
+  
+  top_box =  XtVaCreateManagedWidget (name,
+				      xmRowColumnWidgetClass,
+				      frame,
+				      
+				      XmNadjustMargin, True,
+				      XmNisHomogeneous, False,
+				      
+				      XtNvisual, visual,
+				      XtNdepth, depth,
+				      XtNcolormap, cmap,
+				      XtNborderColor, borcol,
+				      XtNbackground, bgnd,
+				      
+				      NULL);  
+
+}
+
+G4OpenGLXmTopLevelShell::~G4OpenGLXmTopLevelShell ()
+{
+  XtDestroyWidget (toplevel);
+}
+
+void G4OpenGLXmTopLevelShell::AddChild (G4OpenGLXmVWidgetContainer* container)
+{
+  container->AddYourselfTo (this);
+}
+
+void G4OpenGLXmTopLevelShell::Realize () 
+{
+  Cardinal num_children;
+  XtVaGetValues (toplevel,
+		 XmNnumChildren, &num_children,
+		 NULL);
+//  G4cout << name << " now parents " << num_children << " children." << G4endl;
+  XtManageChild (toplevel);
+  XtRealizeWidget (toplevel);
+  XtPopup (toplevel, XtGrabNonexclusive);
+}
+
+Widget* G4OpenGLXmTopLevelShell::GetPointerToWidget ()
+{
+  return &top_box;
+}
+
+char* G4OpenGLXmTopLevelShell::GetName ()
+{
+  return name;
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmVWidgetComponent.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmVWidgetComponent.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmVWidgetComponent.cc	(revision 1102)
@@ -0,0 +1,42 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmVWidgetComponent.cc,v 1.5 2006/06/29 21:20:08 gunter Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
+//
+//Base class for all Motif component widgets
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4OpenGLXmVWidgetComponent.hh"
+
+G4OpenGLXmVWidgetComponent::G4OpenGLXmVWidgetComponent ()
+{}
+
+G4OpenGLXmVWidgetComponent::~G4OpenGLXmVWidgetComponent ()
+{}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmVWidgetContainer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmVWidgetContainer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmVWidgetContainer.cc	(revision 1102)
@@ -0,0 +1,42 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmVWidgetContainer.cc,v 1.5 2006/06/29 21:20:10 gunter Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
+//
+//Base class for all Motif container widgets
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4OpenGLXmVWidgetContainer.hh"
+
+G4OpenGLXmVWidgetContainer::G4OpenGLXmVWidgetContainer ()
+{}
+
+G4OpenGLXmVWidgetContainer::~G4OpenGLXmVWidgetContainer ()
+{}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmVWidgetObject.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmVWidgetObject.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmVWidgetObject.cc	(revision 1102)
@@ -0,0 +1,58 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmVWidgetObject.cc,v 1.7 2009/02/04 16:48:41 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+//Virtual base class for all Motif widgets.
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4OpenGLXmVWidgetObject.hh"
+#include "G4OpenGLXmViewer.hh"
+
+G4OpenGLXmVWidgetObject::G4OpenGLXmVWidgetObject ()
+{}
+
+G4OpenGLXmVWidgetObject::~G4OpenGLXmVWidgetObject ()
+{}
+
+G4OpenGLXmViewer* G4OpenGLXmVWidgetObject::GetView ()
+{
+  return pView;
+}
+
+void G4OpenGLXmVWidgetObject::ProcesspView () 
+{
+  cmap = pView->cmap;
+  depth = pView->vi->depth;
+  visual = pView->vi->visual;
+  borcol = pView->borcol;
+  bgnd = pView->bgnd;
+  top = pView->toplevel;
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmVWidgetShell.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmVWidgetShell.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmVWidgetShell.cc	(revision 1102)
@@ -0,0 +1,42 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmVWidgetShell.cc,v 1.5 2006/06/29 21:20:14 gunter Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
+//
+//Base class for all Motif shell widgets
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4OpenGLXmVWidgetShell.hh"
+
+G4OpenGLXmVWidgetShell::G4OpenGLXmVWidgetShell ()
+{}
+
+G4OpenGLXmVWidgetShell::~G4OpenGLXmVWidgetShell ()
+{}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmViewer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmViewer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmViewer.cc	(revision 1102)
@@ -0,0 +1,723 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmViewer.cc,v 1.31 2009/05/13 10:28:00 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Andrew Walkden  10th February 1997
+// G4OpenGLXmViewer : Class derived from G4OpenGLXViewer, to provide
+//                  (Motif) widget OpenGL functionality for GEANT4.
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "globals.hh"
+
+#include "G4OpenGLXmViewer.hh"
+#include "G4OpenGLSceneHandler.hh"
+
+#include "G4VisExtent.hh"
+#include "G4LogicalVolume.hh"
+#include "G4VSolid.hh"
+#include "G4Point3D.hh"
+#include "G4Normal3D.hh"
+
+#include "G4OpenGLXmSliderBar.hh"
+
+#include "G4Xt.hh"
+#include <X11/Shell.h>
+#include <Xm/MainW.h>
+#include <Xm/Frame.h>
+#include <Xm/DrawingA.h>
+
+#include <sstream>
+
+void G4OpenGLXmViewer::ShowView () {
+
+  G4Xt::getInstance () -> SecondaryLoop ();
+
+}
+
+void G4OpenGLXmViewer::GetXmConnection () {
+  
+  G4Xt* interactorManager = G4Xt::getInstance ();
+  toplevel = (Widget)interactorManager->GetMainInteractor();
+  app      = XtWidgetToApplicationContext(toplevel);
+
+  if (!toplevel) {
+    fViewId = -1;  // This flags an error.
+    G4cerr << "G4OpenGLXmViewer::GetXmConnection unable to Initialize"
+      " application context." << G4endl;
+    return;
+  }
+
+  // Better to put this in an X11 resource file !!!
+  std::ostringstream oss;
+  oss <<
+    "*glxarea*width: " << fVP.GetWindowSizeHintX() << "\n"
+    "*glxarea*height: " << fVP.GetWindowSizeHintY() << "\n"
+    /*
+    // Tried this as a replacement for the above two lines, but
+    // sub-windows (rotation, etc.) came same size!!
+    "*geometry: " << fVP.GetXGeometryString() << "\n"
+    */
+    "*frame*x: 10\n"
+    "*frame*y: 10\n"
+    "*frame*topOffset: 10\n"
+    "*frame*bottomOffset: 10\n"
+    "*frame*rightOffset: 10\n"
+    "*frame*leftOffset: 10\n"
+    "*frame*shadowType: SHADOW_IN\n"
+    "*frame*useColorObj: False\n"
+    "*frame*primaryColorSetId: 3\n"
+    "*frame*secondaryColorSetId: 3\n"
+    "*menubar*useColorObj: False\n"
+    "*menubar*primaryColorSetId: 3\n"
+    "*menubar*secondaryColorSetId: 3\n"
+    "*toplevel*useColorObj: False\n"
+    "*toplevel*primaryColorSetId: 3\n"
+    "*toplevel*secondaryColorSetId: 3\n";
+  interactorManager->PutStringInResourceDatabase ((char*)oss.str().c_str());
+
+  //  interactorManager->AddSecondaryLoopPostAction ((G4SecondaryLoopAction)G4OpenGLXmViewerSecondaryLoopPostAction);
+  
+  shell = XtAppCreateShell ((String)fName.data(),(String)fName.data(),topLevelShellWidgetClass,XtDisplay(toplevel),NULL,0); 
+  interactorManager->AddShell (shell);
+
+  dpy = XtDisplay (shell);
+
+  if (!dpy) {
+    fViewId = -1;  // This flags an error.
+    G4cerr << "G4OpenGLXmViewer::GetXmConnection unable to connect to display."
+	 << G4endl;
+    return;
+  }
+
+  if (!glXQueryExtension (dpy, &errorBase, &eventBase)) {
+    fViewId = -1;  // This flags an error.
+    G4cerr << "G4OpenGLXmViewer::GetXmConnection. X Server has no GLX extension."
+	 << G4endl;;
+    return;
+  }
+}
+
+void G4OpenGLXmViewer::CreateMainWindow () {
+
+  bgnd = XWhitePixelOfScreen (XtScreen(shell));
+  borcol = XBlackPixelOfScreen (XtScreen(shell));
+  
+  ResizeWindow(fVP.GetWindowSizeHintX(),fVP.GetWindowSizeHintY());
+
+  G4int x_origin = fVP.GetWindowAbsoluteLocationHintX(DisplayWidth(dpy, vi -> screen));
+
+  // FIXME,  screen size != window size on MAC, but I don't know have to get the menuBar
+  // size on MAC. L.Garnier 01/2009
+  G4int y_origin = fVP.GetWindowAbsoluteLocationHintY(DisplayHeight(dpy, vi -> screen));
+
+  if (fVP.IsWindowSizeHintX () && fVP.IsWindowLocationHintX () && fVP.IsWindowLocationHintY ()) {
+    XtVaSetValues (shell, 
+                   XtNvisual, vi -> visual, 
+                   XtNdepth, vi -> depth,
+                   XtNcolormap, cmap, 
+                   XtNwidth, getWinWidth(),
+                   XtNheight, getWinHeight(),
+                   XtNx, x_origin,
+                   XtNy, y_origin,
+                   XtNborderColor, &borcol,
+                   XtNbackground, &bgnd,
+                   XmNtitle, fName.data(),
+                   NULL);
+  } else if (fVP.IsWindowSizeHintX () && !(fVP.IsWindowLocationHintX () || fVP.IsWindowLocationHintY ())) {
+    XtVaSetValues (shell, 
+                   XtNvisual, vi -> visual, 
+                   XtNdepth, vi -> depth,
+                   XtNcolormap, cmap, 
+                   XtNwidth, getWinWidth(),
+                   XtNheight, getWinHeight(),
+                   XtNborderColor, &borcol,
+                   XtNbackground, &bgnd,
+                   XmNtitle, fName.data(),
+                   NULL);
+  } else if ((!fVP.IsWindowSizeHintX ()) && fVP.IsWindowLocationHintX () && fVP.IsWindowLocationHintY ()) {
+    XtVaSetValues (shell, 
+                   XtNvisual, vi -> visual, 
+                   XtNdepth, vi -> depth,
+                   XtNcolormap, cmap, 
+                   XtNx, x_origin,
+                   XtNy, y_origin,
+                   XtNborderColor, &borcol,
+                   XtNbackground, &bgnd,
+                   XmNtitle, fName.data(),
+                   NULL);
+  } else {
+    XtVaSetValues (shell, 
+                   XtNvisual, vi -> visual, 
+                   XtNdepth, vi -> depth,
+                   XtNcolormap, cmap, 
+                   XtNborderColor, &borcol,
+                   XtNbackground, &bgnd,
+                   XmNtitle, fName.data(),
+                   NULL);
+  }
+
+
+  main_win = XtVaCreateManagedWidget ("main_win", 
+				      xmMainWindowWidgetClass,
+				      shell,
+				      XtNvisual, vi -> visual, 
+				      XtNdepth, vi -> depth, 
+				      XtNcolormap, cmap, 
+				      XtNborderColor, borcol,
+				      XtNbackground, bgnd,
+				      NULL);
+
+  //*********Create a menu bar for the window********
+  style_str = XmStringCreateLocalized ((char*)"Style");
+  actions_str = XmStringCreateLocalized ((char*)"Actions");
+  misc_str = XmStringCreateLocalized ((char*)"Miscellany");
+  spec_str = XmStringCreateLocalized ((char*)"Special");
+
+  menubar = XmVaCreateSimpleMenuBar (main_win,
+				     (char*)"menubar",
+				     XmVaCASCADEBUTTON, style_str, 'S',
+				     XmVaCASCADEBUTTON, actions_str, 'A',
+				     XmVaCASCADEBUTTON, misc_str, 'M',
+				     XmVaCASCADEBUTTON, spec_str, 'p',
+				     XtNvisual, vi -> visual, 
+				     XtNdepth, vi -> depth, 
+				     XtNcolormap, cmap, 
+				     XtNborderColor, borcol,
+				     XtNbackground, bgnd,
+				     NULL);
+
+  XmStringFree (style_str);
+  XmStringFree (actions_str);
+  XmStringFree (misc_str);
+  XmStringFree (spec_str);
+
+  G4cout << "Created menubar" << G4endl;
+
+
+  //*********Create style pulldown menu on menubar*********
+  rep_str = XmStringCreateLocalized ((char*)"Representation");
+  draw_str = XmStringCreateLocalized ((char*)"Drawing");
+  bgnd_str = XmStringCreateLocalized ((char*)"Background color");
+
+  style_cascade = XmVaCreateSimplePulldownMenu
+    (menubar,
+     (char*)"style",
+     0,
+     NULL,
+     XmVaCASCADEBUTTON, rep_str, 'R',
+     XmVaCASCADEBUTTON, draw_str, 'D',
+     XmVaCASCADEBUTTON, bgnd_str, 'B',
+     XtNvisual, vi -> visual, 
+     XtNdepth, vi -> depth, 
+     XtNcolormap, cmap, 
+     XtNborderColor, borcol,
+     XtNbackground, bgnd,
+     NULL);
+  
+  XmStringFree (rep_str);
+  XmStringFree (draw_str);
+  XmStringFree (bgnd_str);
+
+  //  G4cout << "Created Style pulldown menu" << G4endl;
+
+  //Add Representation pullright menu to style cascade...
+  polyhedron_str = XmStringCreateLocalized ((char*)"Polyhedron");
+  nurbs_str = XmStringCreateLocalized ((char*)"NURBS");
+
+  rep_style_pullright = XmVaCreateSimplePulldownMenu 
+    (style_cascade,
+     (char*)"rep_style",
+     0,
+     rep_style_callback,
+     XmVaRADIOBUTTON, polyhedron_str, 'P', NULL, NULL,
+     XmVaRADIOBUTTON, nurbs_str, 'N', NULL, NULL,
+     XmNradioBehavior, True, 
+     XmNradioAlwaysOne, True, 
+     XmNuserData, this, 
+     XtNvisual, vi -> visual, 
+     XtNdepth, vi -> depth, 
+     XtNcolormap, cmap, 
+     XtNborderColor, borcol,
+     XtNbackground, bgnd,
+     NULL);
+  
+  Widget special_widget;
+
+  G4ViewParameters::RepStyle style;
+  style = fVP.GetRepStyle();
+  
+  if (style == G4ViewParameters::polyhedron) {
+    special_widget = XtNameToWidget(rep_style_pullright, "button_0");
+    if(special_widget) {
+      XtVaSetValues (special_widget, XmNset, True, NULL);
+    }
+  } else if (style == G4ViewParameters::nurbs) {
+    special_widget = XtNameToWidget(rep_style_pullright, "button_1");
+    if(special_widget) {
+      XtVaSetValues (special_widget, XmNset, True, NULL);
+    }
+  } else {
+    G4Exception("Invalid Representation style in G4OpenGLXmViewer::CreateContext");
+  }
+  XmStringFree (polyhedron_str);
+  XmStringFree (nurbs_str);
+  
+  //  G4cout << "Created Representation pulldown menu" << G4endl;
+
+  //Add Drawing pullright menu to style cascade...
+  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,
+     (char*)"drawing_style",
+     1,
+     drawing_style_callback,
+     XmVaRADIOBUTTON, wireframe_str, 'W', NULL, NULL,
+     XmVaRADIOBUTTON, hlr_str, 'L', NULL, NULL,
+     XmVaRADIOBUTTON, hsr_str, 'S', NULL, NULL,
+     XmVaRADIOBUTTON, hlhsr_str, 'H', NULL, NULL,
+     XmNradioBehavior, True, 
+     XmNradioAlwaysOne, True, 
+     XmNuserData, this,
+     XtNvisual, vi -> visual, 
+     XtNdepth, vi -> depth, 
+     XtNcolormap, cmap, 
+     XtNborderColor, borcol,
+     XtNbackground, bgnd,
+     NULL);
+  
+  G4ViewParameters::DrawingStyle d_style;
+  d_style = fVP.GetDrawingStyle();
+  
+  if (d_style == G4ViewParameters::wireframe) {
+    special_widget = XtNameToWidget(drawing_style_pullright, "button_0");
+    if(special_widget) {
+      XtVaSetValues (special_widget, XmNset, True, NULL);
+    }
+  } else if (d_style == G4ViewParameters::hlr) {
+    special_widget = XtNameToWidget(drawing_style_pullright, "button_1");
+    if(special_widget) {
+      XtVaSetValues (special_widget, XmNset, True, NULL);
+    }
+  } else if (d_style == G4ViewParameters::hsr) {
+    special_widget = XtNameToWidget(drawing_style_pullright, "button_2");
+    if(special_widget) {
+      XtVaSetValues (special_widget, XmNset, True, NULL);
+    }
+  } else if (d_style == G4ViewParameters::hlhsr) {
+    special_widget = XtNameToWidget(drawing_style_pullright, "button_3");
+    if(special_widget) {
+      XtVaSetValues (special_widget, XmNset, True, NULL);
+    }
+  } else {
+    G4Exception("Invalid Drawing style in G4OpenGLXmViewer::CreateContext");
+  }
+
+  XmStringFree (wireframe_str);
+  XmStringFree (hlr_str);
+  XmStringFree (hsr_str);
+  XmStringFree (hlhsr_str);
+
+  //  G4cout << "Created Drawing pullright menu" << G4endl;
+
+  //Add Drawing pullright menu to style cascade...
+  white_str = XmStringCreateLocalized ((char*)"White");
+  black_str = XmStringCreateLocalized ((char*)"Black");
+
+  background_color_pullright = XmVaCreateSimplePulldownMenu 
+    (style_cascade,
+     (char*)"background_color",
+     2,
+     background_color_callback,
+     XmVaRADIOBUTTON, white_str, 'W', NULL, NULL,
+     XmVaRADIOBUTTON, black_str, 'B', NULL, NULL,
+     XmNradioBehavior, True, 
+     XmNradioAlwaysOne, True, 
+     XmNuserData, this,
+     XtNvisual, vi -> visual, 
+     XtNdepth, vi -> depth, 
+     XtNcolormap, cmap, 
+     XtNborderColor, borcol,
+     XtNbackground, bgnd,
+     NULL);
+  
+  if (background.GetRed() == 1. &&
+      background.GetGreen() == 1. &&
+      background.GetBlue() == 1.) {
+    special_widget = XtNameToWidget(background_color_pullright, "button_0");
+    if(special_widget) {
+      XtVaSetValues (special_widget, XmNset, True, NULL);
+    }
+  } else {
+    special_widget = XtNameToWidget(background_color_pullright, "button_1");
+    if(special_widget) {
+      XtVaSetValues (special_widget, XmNset, True, NULL);
+    }
+  }
+
+  XmStringFree (white_str);
+  XmStringFree (black_str);
+
+  //  G4cout << "Created Background color pullright menu" << G4endl;
+
+  //*********Create actions pulldown menu on menubar*********
+  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,
+     (char*)"actions",
+     1,
+     actions_callback,
+     XmVaPUSHBUTTON, rot_str, 'R', NULL, NULL,
+     XmVaPUSHBUTTON, pan_str, 'P', NULL, NULL,
+     XmVaPUSHBUTTON, set_str, 'S', NULL, NULL,
+     XmNuserData, this, 
+     XtNvisual, vi -> visual, 
+     XtNdepth, vi -> depth, 
+     XtNcolormap, cmap, 
+     XtNborderColor, borcol,
+     XtNbackground, bgnd,
+     NULL);
+  
+  XmStringFree (rot_str);
+  XmStringFree (pan_str);
+  XmStringFree (set_str);
+  G4cout << "Created Actions pulldown menu" << G4endl;
+
+  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,
+     (char*)"miscellany",
+     2,
+     misc_callback,
+     XmVaPUSHBUTTON, misc_str, 'M', NULL, NULL,
+     XmVaPUSHBUTTON, exit_str, 'E', NULL, NULL,
+     XmVaPUSHBUTTON, print_str, 'P', NULL, NULL,
+     XmNuserData, this,
+     XtNvisual, vi -> visual, 
+     XtNdepth, vi -> depth, 
+     XtNcolormap, cmap, 
+     XtNborderColor, borcol,
+     XtNbackground, bgnd,
+     NULL);
+  
+  XmStringFree (misc_str);
+  XmStringFree (exit_str);
+  XmStringFree (print_str);
+  G4cout << "Created Miscellany pulldown menu" << G4endl;
+
+  trans_str = XmStringCreateLocalized ((char*)"Transparency");
+  anti_str = XmStringCreateLocalized ((char*)"Antialiasing");
+  halo_str = XmStringCreateLocalized ((char*)"Haloing");
+  aux_edge_str = XmStringCreateLocalized ((char*)"Auxiliary edges");
+
+  //*********Create special pulldown menu on menubar*********
+  spec_cascade = XmVaCreateSimplePulldownMenu
+    (menubar,
+     (char*)"special",
+     3,
+     NULL,
+     XmVaCASCADEBUTTON, trans_str, 'T',
+     XmVaCASCADEBUTTON, anti_str, 'A',
+     XmVaCASCADEBUTTON, halo_str, 'H',
+     XmVaCASCADEBUTTON, aux_edge_str, 'E',
+     XtNvisual, vi -> visual, 
+     XtNdepth, vi -> depth, 
+     XtNcolormap, cmap, 
+     XtNborderColor, borcol,
+     XtNbackground, bgnd,
+     NULL);
+  
+  XmStringFree (trans_str);
+  XmStringFree (anti_str);
+  XmStringFree (halo_str);
+  XmStringFree (aux_edge_str);
+
+  //  G4cout << "Created Special pulldown menu" << G4endl;
+
+  //Add Transparency pullright menu to special cascade...
+  off_str = XmStringCreateLocalized ((char*)"Off");
+  on_str = XmStringCreateLocalized ((char*)"On");
+
+  transparency_pullright = XmVaCreateSimplePulldownMenu 
+    (spec_cascade,
+     (char*)"transparency",
+     0,
+     transparency_callback,
+     XmVaRADIOBUTTON, off_str, 'f', NULL, NULL,
+     XmVaRADIOBUTTON, on_str, 'n', NULL, NULL,
+     XmNradioBehavior, True, 
+     XmNradioAlwaysOne, True, 
+     XmNuserData, this,
+     XtNvisual, vi -> visual, 
+     XtNdepth, vi -> depth, 
+     XtNcolormap, cmap, 
+     XtNborderColor, borcol,
+     XtNbackground, bgnd,
+     NULL);
+  
+  if (transparency_enabled == false) {
+    special_widget = XtNameToWidget(transparency_pullright, "button_0");
+    if(special_widget) {
+      XtVaSetValues (special_widget, XmNset, True, NULL);
+    }
+  } else if (transparency_enabled == true) {
+    special_widget = XtNameToWidget(transparency_pullright, "button_1");
+    if(special_widget) {
+      XtVaSetValues (special_widget, XmNset, True, NULL);
+    }
+  } else {
+    G4Exception("transparency_enabled in G4OpenGLXmViewer is neither true nor false!!");
+  }
+
+  //Add antialias pullright menu to special cascade...
+  antialias_pullright = XmVaCreateSimplePulldownMenu 
+    (spec_cascade,
+     (char*)"antialias",
+     1,
+     antialias_callback,
+     XmVaRADIOBUTTON, off_str, 'f', NULL, NULL,
+     XmVaRADIOBUTTON, on_str, 'n', NULL, NULL,
+     XmNradioBehavior, True, 
+     XmNradioAlwaysOne, True, 
+     XmNuserData, this,
+     XtNvisual, vi -> visual, 
+     XtNdepth, vi -> depth, 
+     XtNcolormap, cmap, 
+     XtNborderColor, borcol,
+     XtNbackground, bgnd,
+     NULL);
+  
+  if (antialiasing_enabled == false) {
+    special_widget = XtNameToWidget(antialias_pullright, "button_0");
+    if(special_widget) {
+      XtVaSetValues (special_widget, XmNset, True, NULL);
+    }
+  } else if (antialiasing_enabled == true) {
+    special_widget = XtNameToWidget(antialias_pullright, "button_1");
+    if(special_widget) {
+      XtVaSetValues (special_widget, XmNset, True, NULL);
+    }
+  } else {
+    G4Exception("antialiasing_enabled in G4OpenGLXmViewer is neither true nor false!!");
+  }
+
+  //Add Haloing pullright menu to special cascade...
+  haloing_pullright = XmVaCreateSimplePulldownMenu 
+    (spec_cascade,
+     (char*)"haloing",
+     2,
+     haloing_callback,
+     XmVaRADIOBUTTON, off_str, 'f', NULL, NULL,
+     XmVaRADIOBUTTON, on_str, 'n', NULL, NULL,
+     XmNradioBehavior, True, 
+     XmNradioAlwaysOne, True, 
+     XmNuserData, this,
+     XtNvisual, vi -> visual, 
+     XtNdepth, vi -> depth, 
+     XtNcolormap, cmap, 
+     XtNborderColor, borcol,
+     XtNbackground, bgnd,
+     NULL);
+  
+  if (haloing_enabled == false) {
+    special_widget = XtNameToWidget(haloing_pullright, "button_0");
+    if(special_widget) {
+      XtVaSetValues (special_widget, XmNset, True, NULL);
+    }
+  } else if (haloing_enabled == true) {
+    special_widget = XtNameToWidget(haloing_pullright, "button_1");
+    if(special_widget) {
+      XtVaSetValues (special_widget, XmNset, True, NULL);
+    }
+  } else {
+    G4Exception("haloing_enabled in G4OpenGLXmViewer is neither true nor false!!");
+  }
+
+  //Add Aux_Edge pullright menu to special cascade...
+  aux_edge_pullright = XmVaCreateSimplePulldownMenu 
+    (spec_cascade,
+     (char*)"aux_edge",
+     3,
+     aux_edge_callback,
+     XmVaRADIOBUTTON, off_str, 'f', NULL, NULL,
+     XmVaRADIOBUTTON, on_str, 'n', NULL, NULL,
+     XmNradioBehavior, True, 
+     XmNradioAlwaysOne, True, 
+     XmNuserData, this,
+     XtNvisual, vi -> visual, 
+     XtNdepth, vi -> depth, 
+     XtNcolormap, cmap, 
+     XtNborderColor, borcol,
+     XtNbackground, bgnd,
+     NULL);
+  
+  if (!fVP.IsAuxEdgeVisible()) {
+    special_widget = XtNameToWidget(aux_edge_pullright, "button_0");
+    if(special_widget) {
+      XtVaSetValues (special_widget, XmNset, True, NULL);
+    }
+  } else {
+    special_widget = XtNameToWidget(aux_edge_pullright, "button_1");
+    if(special_widget) {
+      XtVaSetValues (special_widget, XmNset, True, NULL);
+    }
+  }
+
+  XtManageChild (menubar);
+  frame = XtVaCreateManagedWidget ((char*)"frame",
+				   xmFrameWidgetClass, main_win,
+				   XtNvisual, vi -> visual, 
+				   XtNdepth, vi -> depth, 
+				   XtNcolormap, cmap, 
+				   XtNborderColor, borcol,
+				   XtNbackground, bgnd,
+				   NULL);
+
+  glxarea = XtVaCreateManagedWidget ((char*)"glxarea", 
+				     xmDrawingAreaWidgetClass,
+				     frame,
+				     XtNvisual, vi -> visual, 
+				     XtNdepth, vi -> depth, 
+				     XtNcolormap, cmap, 
+				     XtNborderColor, borcol,
+				     XtNbackground, bgnd,
+				     NULL);
+  
+
+  XmMainWindowSetAreas (main_win,  // main widget, children are specified 
+			menubar,   // widget to use as menu bar
+			NULL,      // widget to use as command window
+			NULL,      // widget for horizontal scroll bar
+			NULL,      // widget for vertical scroll bar
+			frame      // widget to be used for work window
+			);
+  
+  XtRealizeWidget(shell);
+  
+  // Once widget is realized (ie, associated with a created X window), we
+  // can bind the OpenGL rendering context to the window.
+
+  win = XtWindow (glxarea);
+  
+  /* Change once the bit gravity of the Drawing Area; default
+     is north west and we want forget, so that resize
+     always generates exposure events */
+   XSetWindowAttributes attrs;
+   attrs.bit_gravity = ForgetGravity ;
+   XChangeWindowAttributes(XtDisplay(glxarea), win,
+                               CWBitGravity, &attrs);
+
+  glXMakeCurrent (dpy, win, cx);
+
+   // This should be add AFTER glXMakeCurrent done because it will fire a resizeCallback
+  XtAddCallback (glxarea, 
+  		 XmNresizeCallback, 
+                 resize_callback, 
+  		 this);
+  
+  XtAddCallback (glxarea, 
+		 XmNexposeCallback, 
+		 expose_callback, 
+		 this);
+
+  XtAddCallback (glxarea, 
+		 XmNactivateCallback, 
+		 activate_callback, 
+		 this);
+
+}
+
+G4OpenGLXmViewer::G4OpenGLXmViewer (G4OpenGLSceneHandler& scene):
+G4VViewer (scene, -1),
+G4OpenGLViewer (scene),
+G4OpenGLXViewer (scene),
+zoom_high (fVP.GetZoomFactor() * 10.0),
+zoom_low (fVP.GetZoomFactor() / 10.0),
+dolly_low (fVP.GetDolly() - 1000.0),
+dolly_high (fVP.GetDolly() + 1000.0),
+fov (0.0),
+rot_sens_limit (90.),
+pan_sens_limit (100.),
+rot_sens (1.),
+wob_sens (20.),
+original_vp(fVP.GetViewpointDirection()),
+frameNo (0),
+fprotation_top (0),
+fprotation_slider (0),
+fppanning_top (0),
+fppanning_slider (0),
+fpzoom_slider (0),
+fpdolly_slider (0),
+fpsetting_top (0),
+fpmiscellany_top (0),
+fpprint_top (0)
+{
+  GetXmConnection ();
+  if (fViewId < 0) return;
+}
+
+G4OpenGLXmViewer::~G4OpenGLXmViewer ()
+{
+  XtDestroyWidget  (shell);
+  win = 0; // ...to avoid XDestroyWindow in G4OpenGLXViewer base class
+  // because XtDestroyWidget has already destroyed it.
+  G4Xt::getInstance () ->RemoveShell (shell);
+
+/******************************
+  if (fprotation_top) {
+    delete fprotation_top;
+  }
+
+  if (fppanning_top) {
+    delete fppanning_top;
+  }
+
+  if (fpsetting_top) {
+    delete fpsetting_top;
+  }
+
+  if (fpmiscellany_top) {
+    delete fpmiscellany_top;
+  }
+******************************/
+
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmViewerMessenger.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmViewerMessenger.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmViewerMessenger.cc	(revision 1102)
@@ -0,0 +1,280 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmViewerMessenger.cc,v 1.4 2006/06/29 21:20:18 gunter Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4OpenGLXmViewerMessenger.hh"
+
+#include "G4OpenGLXmViewer.hh"
+#include "G4OpenGLXmSliderBar.hh"
+
+#include "G4UImanager.hh"
+#include "G4UIcommand.hh"
+#include "G4UIdirectory.hh"
+#include "G4UIcmdWithADoubleAndUnit.hh"
+#include "G4UIcmdWithADouble.hh"
+
+#include "G4VisManager.hh"
+
+G4OpenGLXmViewerMessenger* G4OpenGLXmViewerMessenger::fpInstance = 0;
+
+G4OpenGLXmViewerMessenger* G4OpenGLXmViewerMessenger::GetInstance()
+{
+  if (!fpInstance) fpInstance = new G4OpenGLXmViewerMessenger;
+  return fpInstance;
+}
+
+G4OpenGLXmViewerMessenger::G4OpenGLXmViewerMessenger()
+{
+  G4bool omitable;
+
+  fpDirectory = new G4UIdirectory("/vis/oglxm/");
+  fpDirectory->SetGuidance("G4OpenGLXmViewer commands.");
+
+  fpDirectorySet = new G4UIdirectory ("/vis/oglxm/set/");
+  fpDirectorySet->SetGuidance("G4OpenGLXmViewer set commands.");
+
+  fpCommandSetDollyHigh =
+    new G4UIcmdWithADoubleAndUnit("/vis/oglxm/set/dolly-high", this);
+  fpCommandSetDollyHigh->SetGuidance("Higher limit of dolly slider.");
+  fpCommandSetDollyHigh->SetParameterName("dolly-high", omitable = false);
+
+  fpCommandSetDollyLow =
+    new G4UIcmdWithADoubleAndUnit("/vis/oglxm/set/dolly-low", this);
+  fpCommandSetDollyLow->SetGuidance("Lower limit of dolly slider.");
+  fpCommandSetDollyLow->SetParameterName("dolly-low", omitable = false);
+
+  fpCommandSetPanHigh =
+    new G4UIcmdWithADoubleAndUnit("/vis/oglxm/set/pan-high", this);
+  fpCommandSetPanHigh->SetGuidance("Higher limit of pan slider.");
+  fpCommandSetPanHigh->SetParameterName("pan-high", omitable = false);
+
+  fpCommandSetRotationHigh =
+    new G4UIcmdWithADoubleAndUnit("/vis/oglxm/set/rotation-high", this);
+  fpCommandSetRotationHigh->SetGuidance("Higher limit of rotation slider.");
+  fpCommandSetRotationHigh->SetParameterName("rotation-high", omitable = false);
+
+  fpCommandSetZoomHigh =
+    new G4UIcmdWithADouble("/vis/oglxm/set/zoom-high", this);
+  fpCommandSetZoomHigh->SetGuidance("Higher limit of zoom slider.");
+  fpCommandSetZoomHigh->SetParameterName("zoom-high", omitable = false);
+
+  fpCommandSetZoomLow =
+    new G4UIcmdWithADouble("/vis/oglxm/set/zoom-low", this);
+  fpCommandSetZoomLow->SetGuidance("Lower limit of zoom slider.");
+  fpCommandSetZoomLow->SetParameterName("zoom-low", omitable = false);
+}
+
+G4OpenGLXmViewerMessenger::~G4OpenGLXmViewerMessenger ()
+{
+  delete fpCommandSetZoomLow;
+  delete fpCommandSetZoomHigh;
+  delete fpCommandSetRotationHigh;
+  delete fpCommandSetPanHigh;
+  delete fpCommandSetDollyLow;
+  delete fpCommandSetDollyHigh;
+  delete fpDirectorySet;
+  delete fpDirectory;
+}
+
+void G4OpenGLXmViewerMessenger::SetNewValue
+(G4UIcommand* command, G4String newValue)
+{
+  G4VisManager* pVisManager = G4VisManager::GetInstance();
+
+  G4VViewer* pVViewer = pVisManager->GetCurrentViewer();
+
+  if (!pVViewer) {
+    G4cout <<
+      "G4OpenGLXmViewerMessenger::SetNewValue: No current viewer."
+      "\n  \"/vis/open\", or similar, to get one."
+           << G4endl;
+    return;
+  }
+
+  G4OpenGLXmViewer* pViewer = dynamic_cast<G4OpenGLXmViewer*>(pVViewer);
+
+  if (!pViewer) {
+    G4cout <<
+      "G4OpenGLXmViewerMessenger::SetNewValue: Current viewer is not of type"
+      "\n  OGLIXm or OGLSXm.  Use \"/vis/viewer/select\" or \"/vis/open\"."
+           << G4endl;
+    return;
+  }
+
+  G4bool panningControlPanel = true;
+  G4bool rotationControlPanel = true;
+
+  if (command == fpCommandSetDollyHigh)
+    {
+      if (pViewer->fpdolly_slider)
+	{
+	  pViewer->dolly_high =
+	    fpCommandSetDollyHigh->GetNewDoubleValue(newValue);
+	  pViewer->fpdolly_slider->SetMaxValue (pViewer->dolly_high);
+	  if (pViewer->fVP.GetDolly() > pViewer->dolly_high)
+	    {
+	      pViewer->fpdolly_slider->SetInitialValue (pViewer->dolly_high);
+	      pViewer->fVP.SetDolly(pViewer->dolly_high);
+	    }
+	  else
+	    {
+	      pViewer->fpdolly_slider->SetInitialValue (pViewer->fVP.GetDolly());
+	    }
+	}
+      else
+	{
+	  panningControlPanel = false;
+	}
+    }
+
+  else if (command == fpCommandSetDollyLow)
+    {
+      if (pViewer->fpdolly_slider)
+	{
+	  pViewer->dolly_low =
+	    fpCommandSetDollyLow->GetNewDoubleValue(newValue);
+	  pViewer->fpdolly_slider->SetMinValue (pViewer->dolly_low);
+	  if (pViewer->fVP.GetDolly() < pViewer->dolly_low)
+	    {
+	      pViewer->fpdolly_slider->SetInitialValue (pViewer->dolly_low);
+	      pViewer->fVP.SetDolly(pViewer->dolly_low);
+	    }
+	  else
+	    {
+	      pViewer->fpdolly_slider->SetInitialValue (pViewer->fVP.GetDolly());
+	    }
+	}
+      else
+	{
+	  panningControlPanel = false;
+	}
+    }
+
+  else if (command == fpCommandSetPanHigh)
+    {
+      if (pViewer->fppanning_slider)
+	{
+	  pViewer->pan_sens_limit =
+	    fpCommandSetPanHigh->GetNewDoubleValue(newValue);
+	  pViewer->fppanning_slider->SetMaxValue (pViewer->pan_sens_limit);
+	  pViewer->fppanning_slider->SetInitialValue (pViewer->pan_sens_limit / 2.);
+	}
+      else
+	{
+	  panningControlPanel = false;
+	}
+    }
+
+  else if (command == fpCommandSetRotationHigh)
+    {
+      if (pViewer->fprotation_slider)
+	{
+	  // Internally in OpenGLXm, it's in degrees...
+	  pViewer->rot_sens_limit =
+	    fpCommandSetRotationHigh->GetNewDoubleValue(newValue) / deg;
+	  pViewer->fprotation_slider->SetMaxValue (pViewer->rot_sens_limit);
+	  pViewer->fprotation_slider->SetInitialValue (pViewer->rot_sens_limit / 2.);
+	}
+      else
+	{
+	  rotationControlPanel = false;
+	}
+    }
+
+  else if (command == fpCommandSetZoomHigh)
+    {
+      if (pViewer->fpzoom_slider)
+	{
+	  pViewer->zoom_high =
+	    fpCommandSetZoomHigh->GetNewDoubleValue(newValue);
+	  pViewer->fpzoom_slider->SetMaxValue (pViewer->zoom_high);
+	  pViewer->fpzoom_slider->SetInitialValue (pViewer->fVP.GetZoomFactor());
+	  if (pViewer->fVP.GetZoomFactor() > pViewer->zoom_high)
+	    {
+	      pViewer->fpzoom_slider->SetInitialValue (pViewer->zoom_high);
+	      pViewer->fVP.SetZoomFactor(pViewer->zoom_high);
+	    }
+	  else
+	    {
+	      pViewer->fpzoom_slider->SetInitialValue (pViewer->fVP.GetZoomFactor());
+	    }
+	}
+      else
+	{
+	  panningControlPanel = false;
+	}
+    }
+
+  else if (command == fpCommandSetZoomLow)
+    {
+      if (pViewer->fpzoom_slider)
+	{
+	  pViewer->zoom_low =
+	    fpCommandSetZoomLow->GetNewDoubleValue(newValue);
+	  pViewer->fpzoom_slider->SetMinValue (pViewer->zoom_low);
+	  pViewer->fpzoom_slider->SetInitialValue (pViewer->fVP.GetZoomFactor());
+	  if (pViewer->fVP.GetZoomFactor() < pViewer->zoom_low)
+	    {
+	      pViewer->fpzoom_slider->SetInitialValue (pViewer->zoom_low);
+	      pViewer->fVP.SetZoomFactor(pViewer->zoom_low);
+	    }
+	  else
+	    {
+	      pViewer->fpzoom_slider->SetInitialValue (pViewer->fVP.GetZoomFactor());
+	    }
+	}
+      else
+	{
+	  panningControlPanel = false;
+	}
+    }
+
+  if (!panningControlPanel)
+    {
+	  G4cout << 
+	    "G4OpenGLXmViewerMessenger::SetNewValue: pull down panning"
+	    "\n  control panel and re-issue command."
+		 << G4endl;
+	  return;
+    }
+
+  if (!rotationControlPanel)
+    {
+	  G4cout << 
+	    "G4OpenGLXmViewerMessenger::SetNewValue: pull down rotation"
+	    "\n  control panel and re-issue command."
+		 << G4endl;
+	  return;
+    }
+
+  G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/rebuild");
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmWindowHandlingCallbacks.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmWindowHandlingCallbacks.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenGL/src/G4OpenGLXmWindowHandlingCallbacks.cc	(revision 1102)
@@ -0,0 +1,224 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmWindowHandlingCallbacks.cc,v 1.11 2009/05/13 10:28:00 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Andrew Walkden  16th June 1997
+// G4OpenGLXmWindowHandlingCallbacks : Callback functions for
+//                                     (Motif) widgets to use.
+//                                     in handling (Xm) windows
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+//#define RESIZE_TEST
+#include "G4OpenGLXmViewer.hh"
+
+
+
+// L. Garnier 20 May 2009
+// Each resize event send 2-3-4 expose events. Sequence on MacOsX 10.5 is : 
+// - Expose(s) callback for pixels top/left from resize button
+// - Resize callback
+// - Expose for main part of content
+// - Expose(s) for new part of content
+//
+// BUT we want to redraw things only ONE time.
+// First expose is send with size=="before resize" size and x,y !=0
+// and  x+dw!=w || y+dh !=h
+void G4OpenGLXmViewer::resize_callback (Widget w, 
+				      XtPointer clientData, 
+				      XtPointer callData) 
+{
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLXmViewer::resize_callback \n");
+#endif
+  XmDrawingAreaCallbackStruct *data = (XmDrawingAreaCallbackStruct *)callData;
+
+  XEvent                       event;
+
+  // flush others resize events
+#ifdef G4DEBUG_VIS_OGL
+  while (XCheckWindowEvent(XtDisplay(w), data->window,
+                           ResizeRedirectMask, &event)) {
+    printf("G4OpenGLXmViewer::resize_callback ------ next RESIZE ! %d\n");
+  }
+#endif
+#ifdef RESIZE_TEST
+  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
+  Dimension width, height;
+
+  XtVaGetValues (w, 
+		 XmNwidth, &width, 
+		 XmNheight, &height, 
+		 NULL);
+  pView->ResizeWindow(width,height);
+#endif
+}
+
+
+void G4OpenGLXmViewer::activate_callback (Widget w, 
+				      XtPointer clientData, 
+				      XtPointer callData) 
+{
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLXmViewer::activate_callback \n");
+#endif
+}
+
+void G4OpenGLXmViewer::expose_callback (Widget w, 
+				      XtPointer clientData, 
+				      XtPointer callData) 
+{
+  /* ensure last expose event in sequence */
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLXmViewer::expose_callback ?\n");
+#endif
+  XmDrawingAreaCallbackStruct *data = (XmDrawingAreaCallbackStruct *)callData;
+
+  XEvent                       event;
+
+  Dimension width, height;
+  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
+
+  XtVaGetValues (w, 
+		 XmNwidth, &width, 
+		 XmNheight, &height, 
+		 NULL);
+  
+  XSetWindowAttributes xswa;
+  xswa.bit_gravity = ForgetGravity ;
+  XChangeWindowAttributes(XtDisplay(w), XtWindow(w),
+                          CWBitGravity, &xswa);
+  
+    // look for next 
+    //    while (XCheckTypedWindowEvent(XtDisplay(w), XtWindow(w), ResizeRequest, &event)) {
+    //    printf("G4OpenGLXmViewer::expose_callback --- event type :%d\n",event.type);
+    //    printf("G4OpenGLXmViewer::expose_callback --- resize %d\n",event.type);
+    //  }
+    
+  // Several expose events are send for each area to be redraw.
+  // Because we want to optimise redrawing, we only need to redraw once.
+    if (((XExposeEvent *) data->event)->count != 0) {
+#ifdef G4DEBUG_VIS_OGL
+      printf("G4OpenGLXmViewer::expose_callback NOOOOO %d %d type:%d number:%d send:%d x:%d y:%d w:%d h:%d c:%d\n",width,height,
+           ((XExposeEvent *) data->event)->type,
+           ((XExposeEvent *) data->event)->serial,
+           ((XExposeEvent *) data->event)->send_event,
+           ((XExposeEvent *) data->event)->x,
+           ((XExposeEvent *) data->event)->y,
+           ((XExposeEvent *) data->event)->width,
+           ((XExposeEvent *) data->event)->height,
+           ((XExposeEvent *) data->event)->count);
+
+
+#endif
+      return;
+    }
+#ifdef G4DEBUG_VIS_OGL
+    printf("G4OpenGLXmViewer::expose_callback Should redraw %d %d type:%d number:%d send:%d x:%d y:%d w:%d h:%d c:%d\n",width,height,
+           ((XExposeEvent *) data->event)->type,
+           ((XExposeEvent *) data->event)->serial,
+           ((XExposeEvent *) data->event)->send_event,
+           ((XExposeEvent *) data->event)->x,
+           ((XExposeEvent *) data->event)->y,
+           ((XExposeEvent *) data->event)->width,
+           ((XExposeEvent *) data->event)->height,
+           ((XExposeEvent *) data->event)->count);
+#endif
+    
+#ifdef G4DEBUG_VIS_OGL
+    while (XCheckMaskEvent(XtDisplay(w), ResizeRedirectMask, &event)) {
+      //       printf("G4OpenGLXmViewer::expose_callback ------ next EXPOSE ! %d\n");
+      //     }
+      //     while (XCheckWindowEvent(XtDisplay(w), data->window,
+      //                              ResizeRedirectMask, &event)) {
+      printf("G4OpenGLXmViewer::expose_callback ------ next RESIZE ! \n");
+    }
+#endif
+  
+#ifdef RESIZE_TEST
+    glXMakeCurrent (pView->dpy, XtWindow(pView->glxarea), pView->cx);
+#ifdef G4DEBUG_VIS_OGL
+  G4cout << "G4OpenGLXmViewer::expose_callback" << G4endl;
+  printf("G4OpenGLXmViewer::expose_callback Call SetView()\n");
+#endif
+  pView->SetView ();
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLXmViewer::expose_callback Call SetView() END \n");
+  printf("G4OpenGLXmViewer::expose_callback Call ClearView() \n");
+#endif
+  pView->ClearView ();
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLXmViewer::expose_callback Call ClearView() END \n");
+  printf("G4OpenGLXmViewer::expose_callback Call DrawView() \n");
+#endif
+  pView->DrawView ();
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLXmViewer::expose_callback Call DrawView() END \n");
+  G4cout << "G4OpenGLXmViewer::expose_callback END" << G4endl;
+#endif
+#endif
+  return;
+    
+ 
+}
+
+void G4OpenGLXmViewer::print_callback (Widget, 
+				    XtPointer clientData, 
+				    XtPointer) 
+{
+  G4OpenGLXViewer* pView = (G4OpenGLXmViewer*) clientData;
+  pView->printEPS();
+}
+
+void G4OpenGLXmViewer::set_print_colour_callback (Widget w,
+						XtPointer clientData,
+						XtPointer) 
+{
+  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*)clientData;
+  
+  G4int choice = get_int_userData (w);
+  
+  pView->fPrintColour=(G4bool)choice;
+  G4cout << "Print colour set to " << pView->fPrintColour;
+  
+}
+
+void G4OpenGLXmViewer::set_print_style_callback (Widget w,
+					       XtPointer clientData,
+					       XtPointer) 
+{
+  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*)clientData;
+  
+  G4int choice = get_int_userData (w);
+  
+  pView->fVectoredPs=(G4bool)choice;
+  G4cout << "`Produce vectored PostScript ?' set to : " << pView->fPrintColour;
+  
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/GNUmakefile
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/GNUmakefile	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/GNUmakefile	(revision 1102)
@@ -0,0 +1,44 @@
+# $Id: GNUmakefile,v 1.9 2009/02/16 15:31:05 lgarnier Exp $
+
+name := G4OpenInventor
+
+ifndef G4INSTALL
+  G4INSTALL = ../../..
+endif
+
+# For debug mode
+CPPFLAGS += -DG4DEBUG_VIS_OI
+
+GLOBLIBS  = libG4vis_management.lib libG4modeling.lib
+GLOBLIBS += libG4interfaces.lib libG4run.lib libG4event.lib
+GLOBLIBS += libG4tracking.lib libG4processes.lib libG4digits_hits.lib
+GLOBLIBS += libG4track.lib libG4particles.lib libG4geometry.lib
+GLOBLIBS += libG4materials.lib libG4graphics_reps.lib
+GLOBLIBS += libG4intercoms.lib libG4global.lib
+
+include $(G4INSTALL)/config/architecture.gmk
+include $(G4INSTALL)/config/G4VIS_BUILD.gmk
+include $(G4INSTALL)/config/interactivity.gmk
+
+CPPFLAGS += -I$(G4BASE)/visualization/externals/gl2ps/include
+CPPFLAGS += -I$(G4BASE)/visualization/management/include
+CPPFLAGS += -I$(G4BASE)/visualization/modeling/include
+CPPFLAGS += -I$(G4BASE)/global/management/include
+CPPFLAGS += -I$(G4BASE)/global/HEPGeometry/include
+CPPFLAGS += -I$(G4BASE)/geometry/solids/CSG/include
+CPPFLAGS += -I$(G4BASE)/geometry/solids/specific/include
+CPPFLAGS += -I$(G4BASE)/graphics_reps/include
+CPPFLAGS += -I$(G4BASE)/geometry/management/include
+CPPFLAGS += -I$(G4BASE)/interfaces/common/include
+CPPFLAGS += -I$(G4BASE)/intercoms/include
+CPPFLAGS += -I$(G4BASE)/materials/include
+CPPFLAGS += -I$(G4BASE)/global/HEPRandom/include
+CPPFLAGS += -I$(G4BASE)/tracking/include
+CPPFLAGS += -I$(G4BASE)/digits_hits/hits/include
+
+INTYLIBS += -L$(G4LIBDIR) -lG4gl2ps
+
+include $(G4INSTALL)/config/common.gmk
+
+debug:
+	@echo $(CPPFLAGS)
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/History
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/History	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/History	(revision 1102)
@@ -0,0 +1,396 @@
+$Id: History,v 1.100 2009/07/24 10:21:14 lgarnier Exp $
+-------------------------------------------------------------------
+
+     =========================================================
+     Geant4 - an Object-Oriented Toolkit for Simulation in HEP
+     =========================================================
+
+                      Category History file
+                      ---------------------
+This file should be used by G4 developers and category coordinators
+to briefly summarize all major modifications introduced in the code
+and keep track of all category-tags.
+It DOES NOT substitute the  CVS log-message one should put at every
+committal in the CVS repository !
+
+     ----------------------------------------------------------
+     * Reverse chronological order (last date on top), please *
+     ----------------------------------------------------------
+
+History file for visualization/OpenInventor
+-------------------------------------------
+
+18 August 2009 Laurent Garnier
+ - G4OpenInventorXt/WinViewer : Fix a wrong initialization introduce by the 
+   new way of handling window size hints (January 2009)
+
+24 July 2009, Laurent Garnier
+ - Remove Geant4_gl2ps.h gl2ps.cc gl2ps.h which were copied in external/gl2ps
+   in february but forgot to remove them from OpenInventor
+
+18 February 2009, Laurent Garnier (openinventor-V09-02-01)
+ - Bug fix in gl2ps drawing
+
+16 February 2009, Laurent Garnier
+ - Modifications in GNUMakefile for gl2ps.
+ - SoGL2PSAction Modified.
+ - G4OpenInventorViewer.cc add a protection on file writing in gl2ps
+
+30th April 2008  John Allison  (openinventor-V09-01-01)
+- Fixes more gcc-4.3.0 compiler warnings.
+
+4th April 2008  John Allison  (openinventor-V09-01-00)
+- Fixes most gcc-4.3.0 compiler warnings.
+
+23rd October 2007  Gabriele Cosmo
+- Initialise local vectors in SoPolyhedron.cc to fix compilation warnings
+  on gcc-4.2.2 for use of non-initialised values.
+
+3rd April 2007  John Allison  (openinventor-V08-02-02 - needs visman-V08-02-03)
+- Introduced picking control.  Default is "true" for Open Inventor.
+
+25th March 2007  John Allison  (openinventor-V08-02-01)
+- G4OpenInventorSceneHandler: Introduced AddProperties. Rationalises.
+- G4OpenInventorViewer.cc: Added scale factor to list of changes
+  requiring kernel visit.
+
+5th January 2007  John Allison  (openinventor-V08-02-00)
+- Moved LoadAtts to vis management.
+
+5th November 2006  John Allison  (openinventor-V08-01-04)
+- Protected against zero material pointer.
+
+2nd November 2006  John Allison  (openinventor-V08-01-03)
+- Rationalised G4Att loading and extended picking to hits.
+
+1st November 2006  John Allison  (openinventor-V08-01-02)
+- Follow changes to greps-V08-01-09: G4AttCheck/Holder rationalisation.
+
+26th October 2006  John Allison  (openinventor-V08-01-01)
+- Added SoG4LineSet, SoG4MarkerSet and SoG4Polyhedron - classes extended to
+  include G4Atts (G4AttValues and G4AttDefs) for picking.
+- G4OpenInventorSceneHandler.cc: Load lines, markers and polyhedron objects
+  with G4Atts.
+- G4OpenInventorViewer.cc: print G4Atts on picking.
+
+29th August 2006  John Allison  (openinventor-V08-01-00)
+- G4OpenInventorViewer::CompareForKernelVisit: Rationalisation. This
+  assumes use of generic clipping (sectioning, slicing, DCUT,
+  cutaway).  If a decision is made to implement locally, this will
+  need changing.  See G4OpenGLViewer::SetView,
+  G4OpenGLStoredViewer.cc::CompareForKernelVisit and
+  G4OpenGLStoredSceneHander::CreateSection/CutawayPolyhedron.
+
+4th June 2006 Joseph Perl (openinventor-V08-00-05)
+- This tag includes all the changes below.
+
+2 June 2006  Guy Barrand :
+- G4OpenInvenot, G4OpenInvenotXt, G4OpenInvenotWin : have an Initialize 
+  method in order to init Xt and Inventor only is really used 
+  (when creating a viewer or a scene handler).
+
+19th April 2006  Gabriele Cosmo  (openinventor-V08-00-04)
+- Use cmath instead of math.h.
+
+28th March John Allison  (openinventor-V08-00-03)
+- Cosmetic.
+
+21st March John Allison  (openinventor-V08-00-02)
+- Rationalised G4OpenInventorSceneHandler:
+  o Introduced GeneratePrerequisites.
+  o Uses dynamic_cast<G4PhysicalVolumeModel*>(fpModel) instead
+    of fpCurrentPV, etc.
+  o Uses G4VSceneHandler utility functions,
+    GetApplicableVisAttributes, GetColour, GetTextColour,
+    GetMarkerSize, GetDrawingStyle, GetAuxEdgeVisible, where possible.
+  o Revision 1.43: messy version with original code commented out.
+  o Revision 1.44 (.cc) and 1.28 (.hh) (tagged): tidied versions.
+- Investigated G4OpenInventorViewer:
+  o Changed: DrawDetector and UpdateScene.  No noticeable effect!
+
+20th March John Allison
+- G4OpenInventorSceneHandler:
+  o Bug fix for transient solids.
+  o Replaced some code in AddPrimitive(const G4Polymarker&) by GetMarkerSize.
+  o Attempt to finish AddPrimitive (const G4Text&) - still draws at origin.
+
+30th January 2006  John Allison  (openinventor-V08-00-01)
+- Implemented drawn volume path.  Needs modeling-V08-00-01.  Scene
+  graph now corresponds to drawn, i.e., non-culled geometry.
+  Inability to find (drawn) mothers shouldn't happen now, and it
+  triggers an error message.
+
+26th January 2006  John Allison  (openinventor-V08-00-00)
+- Coworks with visman-V08-00-04 (removed fModified).
+- Removed references to fModified.
+
+20th December 2005  Guy Barrand
+- SoAlternateRepAction.cc : add the #ifdef G4VIS_BUILD_OI_DRIVER.
+
+12th December 2005  John Allison
+- G4OpenInventorSceneHandler.cc: Pick up colour and transformation
+  correctly for non-physical-volume solids.
+  o G4OpenInventorSceneHandler::AddPrimitive (const G4Polyhedron&):
+    Added code to pick up colour if LV and PV pointers are zero.
+  o G4OpenInventorSceneHandler::BeginPrimitives: Pick up
+    transformation if LV and PV pointers are zero.
+  o G4OpenInventorSceneHandler::PreAddSolid: Added code to pick up
+    colour if LV and PV pointers are zero and removed return statement
+    so that transformation is picked up too.
+
+30th November 2005  Gabriele Cosmo (openinventor-V07-01-04)
+- Trivial fix to SoPolyhedron for support of CLHEP-2.0.X series.
+
+15th November 2005  Guy Barrand (openinventor-V07-01-03)
+- G4OpenInventorXtViewer : handle fVP.GetXGeometryString().
+- G4OpenInventorSceneHandler : handle global scale view parameter.
+  Done in BeginPrimitives and PreAddSolid by doing a 
+  SbMatrix::multRight(sbScale) to the incoming global G4Transform3D matrix.
+- G4OpenInventor[Xt,Win]Viewer : handle set background. Done
+  in the overloaded SetView method.
+
+17th October 2005  Guy Barrand
+- G4OpenInventorViewer::G4OpenInventorViewer : read a g4view.iv
+  file at creating of a view. If found, the scene graph in g4view.iv
+  if added at head of the overall scene graph. This permits easy
+  out of band customization of the scene without having to touch
+  the code.
+- Modification in order to save geometry in an Inventor file.
+  Addition of an "alternateRep" for the SoPolyhedron (see Inventor doc).
+  Addition of an "alternateRep" for the SoDetectorTreeKit.
+  Addition of the SoAlternaterRepAction to traverse a scene graph
+  and construct / delete the alternate reps.
+  Modification of G4OpenInventorViewer::WriteInventor to write the
+  alternateRep of the SoPolyhedron and then save geometry in a 
+  .iv file by using Inventor standard lib. In particular the produced
+  .iv files are readable by the ivview standard tool.
+
+2nd September 2005  John Allison (openinventor-V07-01-02)
+- Corrected treatment of edgeflags.
+
+1st August 2005  Gabriele Cosmo  (openinventor-V07-01-01)
+- Fixed compilation errors and warnings on gcc-4.0.0. Modified files:
+  SoDetectorTreeKit.cc, gl2ps[.h.cc].
+
+20th July 2005  John Allison  (openinventor-V07-01-00)
+- Changed Geant4_SoPolyhedron to construct from G4Polyhedron rather
+  than its base class, HepPolyhedron, for possible future
+  developments.  Functionality unchanged.
+
+2nd June 2005  John Allison  (openinventor-V07-00-02)
+- Changed char* to const char* in gl2psMsg.
+
+27th May 2005  John Allison  (openinventor-V07-00-01)
+- Implemented marker sizes.
+
+25th May 2005  Guy Barrand  (openinventor-V07-00-00)
+- G4OpenInventorTransform3D.cc : use the CLHEP::Transform3D::operator(i,j)
+  to initialize the m array in order to be compatible with new versions
+  of CLHEP.
+
+19th March 2005  Guy Barrand
+- SoCounterAction.cc : remove extra ';' at end of SO_ACTION_SOURCE.
+  Code with ';;' does not compile with the "-pedantic" mode of g++-3.4.
+
+26th November 2004  Guy Barrand  (openinventor-V06-02-02)
+- G4OpenInventorXtViewer, SoPolyhedron, SoCounterAction.h : 
+  correct some warnings on g++-3.2.1 (reported by Tom Roberts).
+
+25th November 2004  Guy Barrand
+- G4OpenInventor[Viewer,SceneHandle] : handle aux edges.
+- G4OpenInventorViewer : in SetSolid, etc... avoid to do a FinishView
+  that will do a viewAll that may displace the camera.
+- G4OpenInventorViewer : put the camera under a group and put
+  a sensor (fGroupCameraSensor) on the group to detect that the viewer 
+  changed the camera type.
+- G4OpenInventor[Xt,Win]Viewer : GetCamera() to get camera of the viewer.
+- G4OpenInventorViewer : delete fSoCameraSensor.
+
+24th November 2004  John Allison
+- Fixed SetView to respond to view parameters and CameraSensorCB to
+  provide view parameters. Target point not quite right. Only for
+  orthogonal view so far.
+
+24th November 2004  Guy Barrand
+- So*.cc : have #ifdef G4VIS_BUILD_OI_DRIVER instead of OIX_DRIVER !!!
+- G4OpenInventor[Xt,Win]Viewer, SceneHandler : handle reduced wire frame
+  at the level of the view.
+- SoPolyhedron : reducedWireFramw field.
+
+23th November 2004  Guy Barrand
+- So*.cc : have #ifdef G4VIS_BUILD_OIX_DRIVER.
+
+22th November 2004  Guy Barrand
+- G4OpenInventor[Xt,Win]Viewer : "Set preview", "Set preview and full" 
+  menu items.
+- G4OpenInventorViewer : count nodes and shapes.
+- SoCounterAction : to count nodes.
+- G4OpenInventorViewer : SetSolid, SetWireFrame : arrange to avoid a SetView
+  for the moment. It will move the camera ! Arrange to not clear the
+  transient store.
+- G4OpenInventorViewer : commit commented SoNodeSensor on fSoCamera.
+- G4OpenInventorXtViewer : have a help dialog.
+- G4OpenInventorSceneHandler : delete the SbMatrix returned 
+  by G4OpenInventorTransform3D::GetSbMatrix. Not done before !
+- G4OpenInventorTransform3D : use SbMatrix instead of SoSFMatrix.
+- G4OpenInventorSceneHandler : cache SoResetTransform.
+- SoStyleCache : destructor protected.
+- G4OpenInventor[Xt,Win]Viewer : Help pulldown menu.
+- G4OpenInventorViewer : in "Scene graph stats", count triangles,lines,points.
+- G4OpenInventorViewer : set auto refresh by default.
+
+21th November 2004  Guy Barrand
+- G4OpenInventor[Xt,Win]Viewer, SceneHandler : add a simple picking that
+  dumps picked SoNode address, type and name.
+- G4OpenInventor[Xt,Win]Viewer : "Help controls" menu item.
+- G4OpenInventorSceneHandler::PreAddThis : comment the "ERROR leaf protocal"
+  message. Misleading to users.
+
+19th November 2004  Guy Barrand
+- G4OpenInventorSceneHandler::ClearStore: clear the fSeparatorMap.
+
+18th November 2004  Guy Barrand
+- G4OpenInventorSceneHandler::PreAddThis : handle viewer style.
+- G4OpenInventorView : have an SoOrthographicCamera
+  and a first implementation of SetView.
+- Removed redundant fLastVP from G4OpenInventorSceneHandler (JA).
+
+17th November 2004  Guy Barrand
+- G4OpenInventorSceneHandler : rm the AddThis(G4Box,....). We use
+  then only the generic AddPrimitive(G4Polyhedron). Much simpler.
+
+15th November 2004  Guy Barrand
+- G4OpenInventorViewer : //FIXME comment out on 
+  f[Default]VP.SetCulling(false) by default. Not convinced that it is
+  the right thing to do.
+- G4OpenInventorViewer : have f[Default]VP.SetCulling(false) by default.
+- On viewer have "Erase detector, event" menuitems for Xt and Win.
+- G4OpenInventorWinViewer : have it inheriting G4OpenInventorViewer.
+- G4OpenInventorSceneHandler : WIN32 : correct some warnings.
+
+14th November 2004  Guy Barrand
+- G4OpenInventorSceneHandler.cc : handle transparency.
+- SoImageWriter, SbPainter, SbPainterPS : material to produce pixmap PS.
+- G4OpenInventorViewer : base class for Inventor viewers.
+- Menuitem "Etc/Triangles" : to count rendered triangles.
+- Menuitem "File/IV" : to write the scene in an inventor file.
+
+14th November 2004  John Allison  (openinventor-V06-02-01)
+- Tag on branch openinventor-V06-02-01-branch.
+- Consolidating the changes below, plus:
+  - forcing culling off by default;
+  - forcing solid mode;
+  so that the user:
+  - sees all of the requested geometry volume tree;
+  - can use pointer button and CTRL-left-click to uncover (SHIFT-left-click
+    to re-cover);
+  - can use the hand button and right-click to get wireframe.
+- Removed G4OpenInventorSceneHandler::EndModeling (empty function).
+
+12th November 2004  Guy Barrand
+- G4OpenInventor.cc : initClass of Geant4_SoPolyhedron.
+- G4OpenInventorWinViewer.cc : WM_COMMAND : filter only messages
+  from the window viewer menu.
+- G4OpenInventorSceneHandler.cc : rm G4Polymarker::line handling.
+
+11th November 2004  Guy Barrand
+- Add SoPolyhedron that permits to visualize directly HepPolyhedron.
+- G4OpenInventorSceneHandler::AddThis : uses the generic
+  SoPolyhedron. Modeling is wireFrame by default.
+  Solid modeling is used only in case visAtb.SetForceSolid(true).
+- G4OpenInventorSceneHandler::PreAddThis : correct a flaw
+  in the non-leaf part ; in case mother not found in fSeparatorMap
+  the SoDetectorTreeKit were added nowhere ! This induced that 
+  exaN03Vis5 displayed no gemetry.
+- SoStyleCache : permit to cache commonly used colors, line styles and
+  light models.
+- G4OpenInventorSceneHandler : use SoStyleCache to minimize number of nodes.
+- End of the first world war. 
+- Death of Arrafat.
+
+10th November 2004  Guy Barrand
+- SoMarkerSet, SoGL2PSAction : corrections to work with SGI Inventor.
+- gl2ps : gl2psPrintPostScriptPixmap : fix nbit=2,4 width truncation. 
+  (On SoMarkerSet, the last column of pixmapswere missing ).
+
+9th November 2004  Guy Barrand
+- WIN32 : G4OpenInventorWinViewer : have a File pulldown menu
+  with an Escape button to quit secondary Windows event loops.
+- Xt : G4OpenInventorXtViewer : in destructor comment (and //FIXME)
+  the "delete fViewer". With SGI, it hangs.
+- Xt : Have a menubar and put escape button in the File pulldown menu.
+- SoGL2PSAction, gl2ps : action to handle PostScript production with gl2ps.
+- Xt : "PostScript" menu item.
+- WIN32 : "PostScript" menu item.
+
+8th November 2004  Guy Barrand
+- WIN32 : Have HEPVis/SbGL.h to access GL.h properly on Windows.
+  Use by SoMarkerSet.cc.
+- G4OpenInventor.cc : initialize SoMarkerSet.
+- G4OpenInventorWinViewer : correct bad viewer look and feel.
+
+7th November 2004  Guy Barrand
+- Have SoMarkerSet.h, .cc in the repository.
+- G4OpenInventorSceneHandler : 
+  Have a AddPrimitive(G4Polymarker) using SoMarkerSet.
+  SoMarkerSet draws markers in the frame buffer. It is much
+  more performant than having SoSphere and SoCube for markers.
+
+6th November 2004  Guy Barrand
+- G4OpenInventorXtViewer : restore the escape button.
+  This button is put in the "app buttons" of the SoXtExaminerViewer.
+  (The "app buttons" are put in the left border of decoration).
+  It is ok with SGI-2.1.510 and recent SoXt of Coin, 
+
+21th July 2004  Guy Barrand (openinventor-V06-02-00)
+- G4OpenInventorXtViewer : add include X11/Shell.h to have
+  XtNgeometry that may not come throught the includes of some
+  Inventor implementation.
+
+08th April 2004  Guy Barrand (openinventor-V06-01-00)
+- Bring in the repository the necessary HEPVis code. In fact few of HEPVis
+  is used in this G4 driver. Then HEPVis is no more needed.
+  Note that, to avoid clashes of G4/vis within experiments, the HEPVis
+  node are protected by some : #define Geant4_<node> <node>.  Then, for
+  example, within the G4OpenInventor lib there are Geant4_SoBox, etc...
+  (and not SoBox,... that may clash with other HEPVis code in  experiments).
+- Have code to run on Windows.
+- Split Viewer to have G4OpenInventorXtViewer and G4OpenInventorWinViewer.
+- Split G4OpenInventor to have G4OpenInventorXt and G4OpenInventorWin.
+  Xt and Win (and not X and Win32 like in vis/OpenGL) to follow 
+  the conventions found in the OpenInventor world.
+
+29th October 2003  Cosmo Gabriele (openinventor-V05-02-00)
+- Patch in G4OpenInventorSceneHandler in PreAddThis() to cope with changes
+  introduced in G4VPhysicalVolume in "geant4-05-02-ref-04", where pointer to
+  mother physical-volume was removed.
+  Separators map now refers to logical-volumes and is no longer built
+  iteratively for each call to the method as it was done in an attempt
+  implemented previously.
+  NOTE: requires more investigation and eventually a revision of the
+        adopted algorithm.
+- Cleared usage of 'NULL' in favour of '0'.
+
+4th October 2003  Cosmo Gabriele (vis-V05-02-01)
+- Simplified GNUmakefile.
+
+14th January 2003  John Allison  (openinventor-V05-00-00)
+- Removed vertex.transform (*fpObjectTransformation) from
+  G4OpenInventorSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron).
+  Symptom was that polyhedron objects were being transformed twice.
+  The transformation is stored in 
+  G4OpenInventorSceneHandler::PreAddThis
+  ...
+  G4OpenInventorTransform3D oiTran (objectTransformation);
+  SoSFMatrix* oiMat = oiTran.GetOIMatrix();
+  SoMatrixTransform* xform = new SoMatrixTransform;
+  xform->matrix.setValue(oiMat->getValue());
+  currentSeparator->addChild(new SoResetTransform);
+  currentSeparator->addChild(xform);
+}
+
+27th November 2002  John Allison  (vis-V04-01-08)
+- Improved algorithm of CompareForKernelVisit.
+
+14th August 2001  John Allison  (vis-V03-02-11)
+- Improved KernelVisitDecision - but see note therein.
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/include/G4OpenInventor.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/include/G4OpenInventor.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/include/G4OpenInventor.hh	(revision 1102)
@@ -0,0 +1,58 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenInventor.hh,v 1.9 2006/06/29 21:20:22 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// Guy Barrand 26 Mar 1998.
+// OpenInventor graphics system factory.
+
+#ifndef G4OPENINVENTOR_HH
+#define G4OPENINVENTOR_HH
+
+#if defined(G4VIS_BUILD_OI_DRIVER) || defined(G4VIS_USE_OI)
+
+#include "G4VGraphicsSystem.hh"
+
+class G4VInteractorManager;
+
+class G4OpenInventor: public G4VGraphicsSystem {
+public:
+  G4OpenInventor(const G4String,const G4String,G4VGraphicsSystem::Functionality);
+  virtual ~G4OpenInventor();
+  void SetInteractorManager(G4VInteractorManager*);
+  G4VInteractorManager* GetInteractorManager();
+  G4VSceneHandler* CreateSceneHandler (const G4String& name);
+  void InitNodes();
+private:
+  virtual void Initialize() = 0;
+private:
+  G4VInteractorManager* interactorManager;
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/include/G4OpenInventorSceneHandler.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/include/G4OpenInventorSceneHandler.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/include/G4OpenInventorSceneHandler.hh	(revision 1102)
@@ -0,0 +1,107 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenInventorSceneHandler.hh,v 1.33 2007/03/27 15:24:15 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// J Kallenbach  27th Aug 1996
+// OpenInventor scene handler - creates OpenInventor Display lists.
+// 20 dec 1996  jck  Add HEPVis primitives - trd, box, etc.
+
+#ifndef G4OPENINVENTORSCENEHANDLER_HH
+#define G4OPENINVENTORSCENEHANDLER_HH
+
+#ifdef G4VIS_BUILD_OI_DRIVER
+
+// Inheritance :
+#include "G4VSceneHandler.hh"
+
+#include "G4PhysicalVolumeModel.hh"
+
+#include <map>
+
+class G4OpenInventor;
+class SoSeparator;
+class Geant4_SoStyleCache;
+class G4VisAttributes;
+
+// Base class for various OpenInventorScene classes.
+class G4OpenInventorSceneHandler: public G4VSceneHandler {
+
+friend class G4OpenInventorViewer;
+
+public:
+
+  G4OpenInventorSceneHandler (G4OpenInventor& system, const G4String& name = "");
+  virtual ~G4OpenInventorSceneHandler ();
+  void AddPrimitive (const G4Polyline& line);
+  void AddPrimitive (const G4Text&);
+  void AddPrimitive (const G4Circle&);
+  void AddPrimitive (const G4Square&);
+  void AddPrimitive (const G4Polyhedron& p);
+  void AddPrimitive (const G4NURBS& nurb);
+  void AddPrimitive (const G4Polymarker&);
+  ////////////////////////////////////////////////////////////////
+  // Explicitly invoke base class methods to avoid warnings about
+  // hiding of base class methods.
+  void AddPrimitive (const G4Scale& scale) {
+    G4VSceneHandler::AddPrimitive (scale);
+  }
+  ///////////////////////////////////////////////////////////////
+  // Other inherited functions.
+  void 		ClearStore ();
+  void 		ClearTransientStore ();
+  
+  //
+  // Primitives for use of HEPVis
+  //
+  void PreAddSolid (const G4Transform3D& objectTransformation,
+		    const G4VisAttributes& visAttribs);
+  void BeginPrimitives (const G4Transform3D& objectTransformation);
+
+private:
+
+  static G4int fSceneIdCount;   // static counter for OpenInventor scenes.
+  enum G4OIMarker {G4OICircle, G4OISquare};
+  void AddCircleSquare (G4OIMarker markerType, const G4VMarker&);
+  void GeneratePrerequisites();
+  void AddProperties(const G4VisAttributes*);
+  std::map <G4LogicalVolume*, SoSeparator*,
+    std::less <G4LogicalVolume*> > fSeparatorMap;
+  SoSeparator* fRoot;
+  SoSeparator* fDetectorRoot;
+  SoSeparator* fTransientRoot;
+  SoSeparator* fCurrentSeparator;
+  G4bool fModelingSolid;
+  G4bool fReducedWireFrame;
+  Geant4_SoStyleCache* fStyleCache;
+  bool fPreviewAndFull;
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/include/G4OpenInventorTransform3D.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/include/G4OpenInventorTransform3D.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/include/G4OpenInventorTransform3D.hh	(revision 1102)
@@ -0,0 +1,54 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenInventorTransform3D.hh,v 1.7 2006/06/29 21:20:26 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// jck  17 Dec 1996
+// G4OpenGLInventorTransform3D provides SoSFMatrix transformation matrix
+// from G4Transform3D.
+
+#ifndef G4OPENINVENTORTRANSFORM3D_HH
+#define G4OPENINVENTORTRANSFORM3D_HH
+
+#ifdef G4VIS_BUILD_OI_DRIVER
+
+#include "G4Transform3D.hh"
+
+class SbMatrix;
+
+class G4OpenInventorTransform3D : public G4Transform3D {
+public:
+  G4OpenInventorTransform3D (const G4Transform3D &t);
+  SbMatrix* GetSbMatrix () const;
+private:
+  G4float m[16];
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/include/G4OpenInventorViewer.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/include/G4OpenInventorViewer.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/include/G4OpenInventorViewer.hh	(revision 1102)
@@ -0,0 +1,104 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+
+#ifndef G4OPENINVENTORVIEWER_HH
+#define G4OPENINVENTORVIEWER_HH
+
+#ifdef G4VIS_BUILD_OI_DRIVER
+
+// Inheritance :
+#include "G4VViewer.hh"
+
+class SoSelection;
+class SoPath;
+class SoCamera;
+class SoSensor;
+class SoNodeSensor;
+
+class Geant4_SoImageWriter;
+class Geant4_SoGL2PSAction;
+class G4OpenInventorSceneHandler;
+class G4VInteractorManager;
+class SbVec3f;
+
+//
+// Base class for various OpenInventorView classes.
+//
+class G4OpenInventorViewer: public G4VViewer {
+public: //G4VViewer
+  virtual void DrawView();
+  virtual void ShowView();
+  virtual void ClearView();
+  virtual void SetView();
+  virtual void KernelVisitDecision();
+public:
+  G4OpenInventorViewer(G4OpenInventorSceneHandler& scene,
+		       const G4String& name = "");
+  virtual ~G4OpenInventorViewer();
+protected:
+  virtual void ViewerRender() = 0;
+  virtual SoCamera* GetCamera() = 0;
+  void Escape();
+  void WritePostScript(const G4String& file = "g4out.ps");
+  void WritePixmapPostScript(const G4String& file = "g4out.ps");
+  void WriteInventor(const G4String& file = "g4out.iv");
+  void SceneGraphStatistics();
+  void EraseDetector();
+  void EraseEvent();
+  void SetPreviewAndFull();
+  void SetPreview();
+  void SetSolid();
+  void SetWireFrame();
+  void SetReducedWireFrame(bool);
+  void UpdateScene();
+  G4String Help(const G4String& topic = "controls");
+private:
+  static void SelectionCB(void*,SoPath*);
+  //static void DeselectionCB(void*,SoPath*);
+  static void GroupCameraSensorCB(void*,SoSensor*);
+  static void CameraSensorCB(void*,SoSensor*);
+  static void pointAt(SoCamera*,const SbVec3f & targetpoint, const SbVec3f & upvector);
+  static void lookAt(SoCamera*,const SbVec3f & dir, const SbVec3f & up);
+  static void lookedAt(SoCamera*,SbVec3f & dir, SbVec3f & up);
+private:
+  G4bool CompareForKernelVisit(G4ViewParameters&);
+  void DrawDetector();
+private:
+  G4ViewParameters fLastVP;  // Memory for making kernel visit decisions.
+protected:
+  G4OpenInventorSceneHandler& fG4OpenInventorSceneHandler;
+  G4VInteractorManager* fInteractorManager;
+  SoSelection* fSoSelection;
+  Geant4_SoImageWriter* fSoImageWriter;
+  Geant4_SoGL2PSAction* fGL2PSAction;
+  SoNodeSensor* fGroupCameraSensor;
+  SoNodeSensor* fCameraSensor;
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/include/G4OpenInventorWin.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/include/G4OpenInventorWin.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/include/G4OpenInventorWin.hh	(revision 1102)
@@ -0,0 +1,52 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenInventorWin.hh,v 1.3 2006/06/29 21:20:30 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// OpenInventor graphics system factory.
+
+#if defined (G4VIS_BUILD_OIWIN32_DRIVER) || defined (G4VIS_USE_OIWIN32)
+
+#ifndef G4OPENINVENTORWIN_HH
+#define G4OPENINVENTORWIN_HH
+
+#include "G4OpenInventor.hh"
+
+class G4OpenInventorWin: public G4OpenInventor {
+public:
+  G4OpenInventorWin ();
+  virtual ~G4OpenInventorWin ();
+  G4VViewer* CreateViewer(G4VSceneHandler&,const G4String& name = "");
+private:
+  virtual void Initialize();
+private:
+  bool fInited;
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/include/G4OpenInventorWin32.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/include/G4OpenInventorWin32.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/include/G4OpenInventorWin32.hh	(revision 1102)
@@ -0,0 +1,49 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenInventorWin32.hh,v 1.7 2006/06/29 21:20:32 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// OpenInventor graphics system factory.
+
+#if defined (G4VIS_BUILD_OIWIN32_DRIVER) || defined (G4VIS_USE_OIWIN32)
+
+#ifndef G4OPENINVENTORWIN32_HH
+#define G4OPENINVENTORWIN32_HH
+
+// For backward compatibilty.
+
+#include "G4OpenInventorWin.hh"
+
+class G4OpenInventorWin32: public G4OpenInventorWin {
+public:
+  G4OpenInventorWin32 () {}
+  virtual ~G4OpenInventorWin32 () {}
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/include/G4OpenInventorWinViewer.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/include/G4OpenInventorWinViewer.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/include/G4OpenInventorWinViewer.hh	(revision 1102)
@@ -0,0 +1,68 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenInventorWinViewer.hh,v 1.9 2006/06/29 21:20:34 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Jeff Kallenbach 01 Aug 1996
+// OpenInventor viewer - opens window, hard copy, etc.
+
+#ifndef G4OPENINVENTORWINVIEWER_HH
+#define G4OPENINVENTORWINVIEWER_HH
+
+#ifdef G4VIS_BUILD_OI_DRIVER
+
+// Inheritance :
+#include "G4OpenInventorViewer.hh"
+
+#include <windows.h>
+
+class Geant4_SoWinExaminerViewer;
+
+class G4OpenInventorWinViewer: public G4OpenInventorViewer {
+public: //G4VViewer
+  virtual void FinishView();
+  virtual void SetView();
+protected:
+  virtual void ViewerRender();
+  virtual SoCamera* GetCamera();
+public:
+  G4OpenInventorWinViewer(G4OpenInventorSceneHandler& scene,
+		       const G4String& name = "");
+  virtual ~G4OpenInventorWinViewer();
+  void Initialise();
+
+private:
+  static LRESULT CALLBACK WindowProc(HWND,UINT,WPARAM,LPARAM);
+private:
+  HWND fShell;
+  Geant4_SoWinExaminerViewer* fViewer;
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/include/G4OpenInventorX.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/include/G4OpenInventorX.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/include/G4OpenInventorX.hh	(revision 1102)
@@ -0,0 +1,51 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenInventorX.hh,v 1.7 2006/06/29 21:20:36 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Andrew Walkden  27th March 1996
+// OpenInventor graphics system factory.
+
+#if defined (G4VIS_BUILD_OIX_DRIVER) || defined (G4VIS_USE_OIX)
+
+#ifndef G4OPENINVENTORX_HH
+#define G4OPENINVENTORX_HH
+
+// For backward compatibilty.
+
+#include "G4OpenInventorXt.hh"
+
+class G4OpenInventorX: public G4OpenInventorXt {
+public:
+  G4OpenInventorX () {}
+  virtual ~G4OpenInventorX () {}
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/include/G4OpenInventorXt.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/include/G4OpenInventorXt.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/include/G4OpenInventorXt.hh	(revision 1102)
@@ -0,0 +1,54 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenInventorXt.hh,v 1.3 2006/06/29 21:20:38 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Andrew Walkden  27th March 1996
+// OpenInventor graphics system factory.
+
+#if defined (G4VIS_BUILD_OIX_DRIVER) || defined (G4VIS_USE_OIX)
+
+#ifndef G4OPENINVENTORXT_HH
+#define G4OPENINVENTORXT_HH
+
+#include "G4OpenInventor.hh"
+
+class G4OpenInventorXt: public G4OpenInventor {
+public:
+  G4OpenInventorXt ();
+  virtual ~G4OpenInventorXt ();
+  G4VViewer* CreateViewer(G4VSceneHandler&,const G4String& name = "");
+private:
+  virtual void Initialize();
+private:
+  bool fInited;
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/include/G4OpenInventorXtViewer.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/include/G4OpenInventorXtViewer.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/include/G4OpenInventorXtViewer.hh	(revision 1102)
@@ -0,0 +1,87 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenInventorXtViewer.hh,v 1.14 2006/06/29 21:20:40 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Jeff Kallenbach 01 Aug 1996
+// OpenInventor viewer - opens window, hard copy, etc.
+
+#ifndef G4OPENINVENTORXTVIEWER_HH
+#define G4OPENINVENTORXTVIEWER_HH
+
+#ifdef G4VIS_BUILD_OI_DRIVER
+
+// Inheritance :
+#include "G4OpenInventorViewer.hh"
+
+#include <X11/Intrinsic.h>
+class SoXtExaminerViewer;
+
+class G4OpenInventorXtViewer: public G4OpenInventorViewer {
+public: //G4VViewer
+  virtual void FinishView();
+  virtual void SetView();
+protected:
+  virtual void ViewerRender();
+  virtual SoCamera* GetCamera();
+public:
+  G4OpenInventorXtViewer(G4OpenInventorSceneHandler& scene,
+		         const G4String& name = "");
+  void Initialise();
+
+  virtual ~G4OpenInventorXtViewer();
+private:
+  Widget AddMenu(Widget,const G4String&,const G4String&);
+  void AddButton(Widget,const G4String&,XtCallbackProc);
+private:
+  static void PostScriptCbk(Widget,XtPointer,XtPointer);
+  static void PixmapPostScriptCbk(Widget,XtPointer,XtPointer);
+  static void WriteInventorCbk(Widget,XtPointer,XtPointer);
+  static void EscapeCbk(Widget,XtPointer,XtPointer);
+  static void SceneGraphStatisticsCbk(Widget,XtPointer,XtPointer);
+  static void EraseDetectorCbk(Widget,XtPointer,XtPointer);
+  static void EraseEventCbk(Widget,XtPointer,XtPointer);
+  static void SetSolidCbk(Widget,XtPointer,XtPointer);
+  static void SetWireFrameCbk(Widget,XtPointer,XtPointer);
+  static void SetReducedWireFrameCbk(Widget,XtPointer,XtPointer);
+  static void SetFullWireFrameCbk(Widget,XtPointer,XtPointer);
+  static void UpdateSceneCbk(Widget,XtPointer,XtPointer);
+  static void HelpCbk(Widget,XtPointer,XtPointer);
+  static void HelpCancelCbk(Widget,XtPointer,XtPointer);
+  static void SetPreviewCbk(Widget,XtPointer,XtPointer);
+  static void SetPreviewAndFullCbk(Widget,XtPointer,XtPointer);
+private:
+  Widget fShell;
+  SoXtExaminerViewer* fViewer;
+  Widget fHelpForm;
+  Widget fHelpText;
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/include/Geant4_SoPolyhedron.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/include/Geant4_SoPolyhedron.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/include/Geant4_SoPolyhedron.h	(revision 1102)
@@ -0,0 +1,78 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+#ifndef Geant4_SoPolyhedron_h
+#define Geant4_SoPolyhedron_h
+
+// Inheritance :
+#include <Inventor/nodes/SoShape.h>
+
+#include <Inventor/fields/SoSFBool.h>
+#include <Inventor/fields/SoSFNode.h>
+
+class G4Polyhedron;
+
+/**
+ *  SoPolyhedron is an Inventor encapsulation of the G4Polyedron
+ * class written by E.Chernyaev. In particular SoPolyhedron permits
+ * to represent boolean operations over solids.
+ *  To avoid clashes with other libraries (Geant4) where the G4Polyhedron
+ * classes may be found, the G4Polyhedron (through usage of CPP macros)
+ * had been renamed G4Polyhedron in the HEPVis lib.
+ *  The solids are modeled with G4Polyedron objects. The G4Polyhedron
+ * permits to produce a new G4Polyhedron according to the boolean 
+ * operation done on them. The resulting G4Polyhedron  is then given
+ * to an SoPolyhedron for rendering.
+ *  Note that a boolean operation could be rendered in wire frame
+ * by drawing the contour of the resulting solid (not by drawing
+ * the wire frame of a triangulation).
+ *  See the applications/Polyhedron example.
+ */
+
+class Geant4_SoPolyhedron : public SoShape {
+  SO_NODE_HEADER(Geant4_SoPolyhedron);
+public:
+  SoSFBool solid;
+  SoSFBool reducedWireFrame;
+  SoSFNode alternateRep;
+public:
+  Geant4_SoPolyhedron();
+  Geant4_SoPolyhedron(const G4Polyhedron&);
+  Geant4_SoPolyhedron(G4Polyhedron*);
+  virtual void generateAlternateRep();
+  virtual void clearAlternateRep();
+public:
+  static void initClass();
+protected:
+  virtual void computeBBox(SoAction*,SbBox3f&,SbVec3f&);
+  virtual void generatePrimitives(SoAction*);
+  virtual void doAction(SoAction*);
+protected:
+  virtual ~Geant4_SoPolyhedron();
+private: 
+  G4Polyhedron* fPolyhedron;
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/SbGL.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/SbGL.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/SbGL.h	(revision 1102)
@@ -0,0 +1,41 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+#ifndef HEPVis_SbGL_h
+#define HEPVis_SbGL_h 
+
+#ifdef WIN32
+#include <windows.h>
+#endif
+
+#ifdef APPLE_GL
+#include <gl.h>
+#include <glu.h>
+#else
+#include <GL/gl.h>
+#include <GL/glu.h>
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/SbMath.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/SbMath.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/SbMath.h	(revision 1102)
@@ -0,0 +1,56 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: SbMath.h,v 1.4 2006/06/29 21:20:46 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+#ifndef HEPVis_SbMath_h
+#define HEPVis_SbMath_h
+
+#include <cmath>
+#ifndef M_PI
+#define M_PI       3.1415926535897931160E0
+#define M_PI_2     1.5707963267948965580E0  
+#endif
+
+#define SbMinimum(a,b) ((a)<(b)?a:b)
+#define SbMaximum(a,b) ((a)>(b)?a:b)
+
+#define FCOS(x)   ((float)cos((double)(x)))
+#define FSIN(x)   ((float)sin((double)(x)))
+#define FACOS(x)  ((float)acos((double)(x)))
+#define FASIN(x)  ((float)asin((double)(x)))
+#define FTAN(x)   ((float)tan((double)(x)))
+#define FATAN(x)  ((float)atan((double)(x)))
+#define FSQRT(x)  ((float)sqrt((double)(x)))
+#define FPOW(x,y) ((float)pow((double)(x),(double)(y)))
+#define FLOG(x)   ((float)log((double)(x)))
+#define FLOG10(x) ((float)log10((double)(x)))
+#define FFLOOR(x) ((float)floor((double)(x)))
+#define FFABS(x)  ((float)fabs((double)(x)))
+#define FCEIL(x)  ((float)ceil((double)(x)))
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/SbPainter.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/SbPainter.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/SbPainter.h	(revision 1102)
@@ -0,0 +1,77 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// History :
+// - 09/12/98, G.Barrand : creation.
+
+#ifndef HEPVis_SbPainter_h
+#define HEPVis_SbPainter_h 
+
+#include <Inventor/SbBasic.h>
+
+/*
+#include <HEPVis/SbStyle.h>
+
+typedef enum {
+  SbPrimitivePoints,
+  SbPrimitiveLineStrip,
+  SbPrimitiveLineLoop,
+  SbPrimitiveLines,
+  SbPrimitivePolygon
+} SbPrimitiveType;
+
+class SbPainterContext {
+public:
+  float fRed,fGreen,fBlue;
+  int fLineWidth;
+  SbLineStyle fLineStyle;
+  int fMarkerSize;
+  SbMarkerStyle fMarkerStyle;
+  SbAreaStyle fAreaStyle;
+  int fPolygonMode;
+};
+*/
+
+#define SbPainter Geant4_SbPainter
+
+class SbPainter {
+public:
+  SbPainter();
+  virtual ~SbPainter();
+  void setWindowSize(int,int);
+  void enableEdges(SbBool);
+  virtual void beginTraversal() = 0;
+  virtual void clearColorBuffer(float,float,float) = 0;
+  //virtual void drawPrimitive(SbPrimitiveType,
+  //                          int,float*,float*,float*,
+   //                        const SbPainterContext&) = 0;
+  virtual void endTraversal() = 0;
+protected:
+  int fWindowWidth,fWindowHeight;
+  float fRed,fGreen,fBlue;
+  SbBool fEdges;
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/SbPainterPS.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/SbPainterPS.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/SbPainterPS.h	(revision 1102)
@@ -0,0 +1,130 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// History :
+// - 25/09/98, G.Barrand : creation.
+
+#ifndef HEPVis_SbPainterPS_h
+#define HEPVis_SbPainterPS_h 
+
+// Inheritance :
+#include <HEPVis/SbPainter.h>
+
+#include <stdarg.h>
+
+#include <Inventor/SbViewportRegion.h>
+
+#define SbPainterPS Geant4_SbPainterPS
+
+class SbPainterPS : public SbPainter {
+public:
+  SbPainterPS();
+  ~SbPainterPS();
+  void beginTraversal();
+  void clearColorBuffer(float,float,float);
+  //void drawPrimitive(SbPrimitiveType,
+  //                   int,float*,float*,float*,
+  //                   const SbPainterContext&);
+  void endTraversal();
+public:
+  void setColorScheme(int);
+  void setOrientation(int);
+  void setBackgroundDrawn(int);
+  void setBitsPerPixel(int);
+  void setLineWidth(int);
+  void* getStream();
+  void setFileName(const char*);
+  const char* getFileName() const;
+  void openFileForWriting(const char*);
+  void closeStream();
+  void putPageScaleInStream(float,float);
+  void putSaveStateInStream();
+  void putRestoreStateInStream();
+  void putTranslationInStream(float,float);
+  void putScaleInStream(float,float);
+  void putBeginPageInStream();
+  void putEndPageInStream();
+  void putRGB_InStream(float,float,float);
+  void putMarkerSizeInStream(float);
+  //void putMarkerStyleInStream(SbMarkerStyle);
+  void putBackgroundInStream(float,float,float,float,float);
+  void putFrameInStream(float,float,float,float,float);
+  void putRotateInStream(float);
+  void putNewPathInStream();
+  void putStrokeInStream();
+  void putFillInStream();
+  void putClosePathInStream();
+  void putCapInStream(int);
+  void putLineToInStream(float,float);
+  void putMoveInStream(float,float);
+  void putCircleInStream(float,float,float);
+  void putLineWidthInStream(int);
+  //void putLineStyleInStream(SbLineStyle);
+  typedef int(*GetRGB_Function)(unsigned int,unsigned int,
+                                double&,double&,double&);
+  void putImageInStream(unsigned int,unsigned int,GetRGB_Function);
+private:
+  //void drawPolygon(int,float*,float*,float,float,float,const SbAreaStyle&);
+  //void drawLines(int,float*,float*,float,float,float,const SbLineStyle&,int);
+  //void drawMarkers(int,float*,float*,
+  //                 float,float,float,const SbMarkerStyle&,int);
+  enum ColorScheme {
+    Color = 0,
+    Grey = 1,
+    BlackWhite = 2
+  };
+  struct {
+    int shade;
+    int portrait;
+    int nbit;
+    int doBack;
+    float lineWidth;
+  } fParams;
+  float fDeviceWidth;
+  float fDeviceHeight;
+  int fPageNumber;
+  long fPagePos;
+  float fMarkerSize;
+  FILE* fFile;
+  char* fFileName;
+  int fGSave;
+  int fBufferCount;
+  char* fBufferString;
+#define METAFILE_RECORD_LENGTH  80
+  unsigned char fBufferPointer[METAFILE_RECORD_LENGTH+1];
+private:
+  void putInStreamF(const char*,...);
+  void printFLN(const char*,...);
+  void printV(const char*,va_list);
+  float convertRGB_ToGrey(float,float,float);
+  void writeByte(unsigned char);
+};
+
+#endif
+
+
+
+
+
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/actions/SoAlternateRepAction.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/actions/SoAlternateRepAction.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/actions/SoAlternateRepAction.h	(revision 1102)
@@ -0,0 +1,69 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+#ifndef HEPVis_SoAlternateRepAction_h
+#define HEPVis_SoAlternateRepAction_h 
+
+// Inheritance :
+#include <Inventor/actions/SoAction.h>
+
+#include <Inventor/actions/SoSubAction.h>
+
+#define SoAlternateRepAction Geant4_SoAlternateRepAction
+
+class SoAlternateRepAction : public SoAction {
+  SO_ACTION_HEADER(SoAlternateRepAction);
+public:
+  SoAlternateRepAction();
+  virtual ~SoAlternateRepAction();  
+  static void initClass(void);
+  void setGenerate(SbBool);
+  SbBool getGenerate() const;
+private:
+  static void nodeAction(SoAction*,SoNode*);
+private:
+  SbBool fGenerate;
+};
+
+#define SO_ALTERNATEREP_DO_ACTION(aAction) \
+  if(aAction->isOfType(SoAlternateRepAction::getClassTypeId())) {\
+    if(((SoAlternateRepAction*)aAction)->getGenerate()==TRUE) {\
+      if(alternateRep.getValue()==NULL) {\
+        generateAlternateRep();\
+        SoNode* altRep = alternateRep.getValue();\
+        if((altRep!=NULL) && altRep->isOfType(SoGroup::getClassTypeId()))\
+          altRep->doAction(aAction);\
+      }\
+    } else {\
+      SoNode* altRep = alternateRep.getValue();\
+      if((altRep!=NULL) && altRep->isOfType(SoGroup::getClassTypeId()))\
+        altRep->doAction(aAction);\
+      clearAlternateRep();\
+    }\
+    return;\
+  }
+
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/actions/SoCounterAction.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/actions/SoCounterAction.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/actions/SoCounterAction.h	(revision 1102)
@@ -0,0 +1,60 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+#ifndef HEPVis_SoCounterAction_h
+#define HEPVis_SoCounterAction_h 
+
+// Inheritance :
+#include <Inventor/actions/SoAction.h>
+
+#include <Inventor/actions/SoSubAction.h>
+
+#define SoCounterAction Geant4_SoCounterAction
+
+class SoCounterAction : public SoAction {
+  SO_ACTION_HEADER(SoCounterAction);
+public:
+  SoCounterAction();
+  virtual ~SoCounterAction();  
+  static void initClass(void);
+  enum LookFor { NODE = 1,TYPE = 2, NAME = 3 };
+  void setLookFor(LookFor);
+  void setType(const SoType,SbBool = TRUE);
+  void setName(const SbName);
+public:
+  int getCount() const;
+protected:
+  virtual void beginTraversal(SoNode*);
+private:
+  static void actionMethod(SoAction*,SoNode*);
+private:
+  int fCount;
+  int fLookFor;
+  SbName fName;
+  SoType fType;
+  SbBool fCheckDerived;
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/actions/SoGL2PSAction.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/actions/SoGL2PSAction.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/actions/SoGL2PSAction.h	(revision 1102)
@@ -0,0 +1,54 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+#ifndef HEPVis_SoGL2PSAction_h
+#define HEPVis_SoGL2PSAction_h 
+
+#include <Inventor/actions/SoGLRenderAction.h>
+#include "G4OpenGL2PSAction.hh"
+
+/**
+ *  SoGL2PSAction inherits Inventor/SoGLRenderAction.
+ * It uses the gl2ps software to produce vector PostScript of a scene graph.
+ *  See applications/DetectorTreeKit, Polyhedron for examples.
+ */
+
+#define SoGL2PSAction Geant4_SoGL2PSAction
+
+class SoGL2PSAction : public SoGLRenderAction, public G4OpenGL2PSAction {
+  SO_ACTION_HEADER(SoGL2PSAction);
+public:
+  SoGL2PSAction(const SbViewportRegion&);
+public: /*SoINTERNAL*/
+  static void initClass();
+  bool enableFileWriting();
+  void disableFileWriting();
+  bool addBitmap(int,int,float=0,float=0,float=0,float=0);
+protected:
+  virtual void beginTraversal(SoNode*);
+};
+
+#endif
+
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/misc/SoStyleCache.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/misc/SoStyleCache.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/misc/SoStyleCache.h	(revision 1102)
@@ -0,0 +1,63 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//  27/03/2004 : G.Barrand : creation.
+
+#ifndef HEPVis_SoStyleCache_h
+#define HEPVis_SoStyleCache_h
+
+#include <Inventor/nodes/SoGroup.h>
+
+//#include <HEPVis/SbStyle.h>
+
+class SoMaterial;
+class SoDrawStyle;
+class SoLightModel;
+class SoResetTransform;
+class SbColor;
+ 
+#define SoStyleCache Geant4_SoStyleCache
+
+class SoStyleCache : public SoGroup {
+public:
+  SoStyleCache();
+protected:
+  ~SoStyleCache();
+public:
+  SoMaterial* getMaterial(const SbColor&,float = 0); 
+  SoMaterial* getMaterial(float,float,float,float = 0); 
+  //SoDrawStyle* getLineStyle(SbLineStyle,float = 0); 
+  SoDrawStyle* getLineStyle(unsigned short = 0xFFFF,float = 0); 
+  SoLightModel* getLightModelPhong(); 
+  SoLightModel* getLightModelBaseColor(); 
+  SoResetTransform* getResetTransform();
+private:
+  SoGroup* fMaterials;
+  SoGroup* fLineStyles;
+  SoGroup* fLightModels;
+  SoResetTransform* fResetTransform;
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/nodekits/SoDetectorTreeKit.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/nodekits/SoDetectorTreeKit.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/nodekits/SoDetectorTreeKit.h	(revision 1102)
@@ -0,0 +1,123 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: SoDetectorTreeKit.h,v 1.5 2006/06/29 21:21:16 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+/*-----------------------------HEPVis----------------------------------------*/
+/*                                                                           */
+/* Node:             SoDetectorTreeKit                                       */
+/* Description:      Easy way of browsing through a tree of detectors        */
+/* Author:           Joe Boudreau Nov 11 1996                                */
+/*                                                                           */
+/*---------------------------------------------------------------------------*/
+#ifndef HEPVis_SoDetectorTreeKit_h
+#define HEPVis_SoDetectorTreeKit_h
+
+// Inheritance :
+#include <Inventor/nodekits/SoBaseKit.h>
+
+class SoEventCallback;
+class SoSeparator;
+
+#define SoDetectorTreeKit Geant4_SoDetectorTreeKit
+
+
+class SoDetectorTreeKit:public SoBaseKit {
+
+  // The following is required:
+  SO_KIT_HEADER(SoDetectorTreeKit);
+  ////////////////////////////////////////////
+public:
+  SoSFNode alternateRep; //public in order to query if alternateRep done.
+private:
+  ////////////////////////////////////////////
+  SO_KIT_CATALOG_ENTRY_HEADER(callbackList);
+  SO_KIT_CATALOG_ENTRY_HEADER(topSeparator);
+    SO_KIT_CATALOG_ENTRY_HEADER(pickStyle);
+    SO_KIT_CATALOG_ENTRY_HEADER(appearance);
+    SO_KIT_CATALOG_ENTRY_HEADER(units);
+    SO_KIT_CATALOG_ENTRY_HEADER(transform);
+    SO_KIT_CATALOG_ENTRY_HEADER(texture2Transform);
+    SO_KIT_CATALOG_ENTRY_HEADER(childList);
+      SO_KIT_CATALOG_ENTRY_HEADER(previewSeparator);
+      SO_KIT_CATALOG_ENTRY_HEADER(fullSeparator);
+   
+
+public:
+
+  // Constructor, required
+  SoDetectorTreeKit();
+
+  // This is required
+  virtual SbBool affectsState() const;
+
+  // Class Initializer, required
+  static void initClass();
+
+  // Turn the preview on or off
+  virtual void setPreview(SbBool Flag);
+
+  // Return the preview state
+  virtual SbBool getPreview() const;
+
+  // Set SoSwitch::whichChild = SO_SWITCH_ALL
+  void setPreviewAndFull();
+
+  // Return the preview Separator
+  virtual SoSeparator *getPreviewSeparator() const;
+
+  // Return the full Separator
+  virtual SoSeparator *getFullSeparator() const;
+
+  // Generate AlternateRep, required.  Generating an alternate representation
+  // must be done upon users request.  It allows an Inventor program to read
+  // back the file without requiring *this* code to be dynamically linked. 
+  // If the users expects that *this* code will be dynamically linked, he
+  // need not invoke this method.  
+  virtual void generateAlternateRep();
+
+  // We better be able to clear it, too!
+  virtual void clearAlternateRep();
+
+protected:
+
+  // Destructor.
+  virtual ~SoDetectorTreeKit();
+
+  virtual void doAction(SoAction*);
+private: 
+
+  // This is needed as well
+  void createInitialTree();
+
+  // This is the callback function that will be 
+  // added to the callback list
+  static void   expand   (void *userData, SoEventCallback *eventCB);
+  static void   contract (void *userData, SoEventCallback *eventCB);
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/nodes/SoBox.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/nodes/SoBox.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/nodes/SoBox.h	(revision 1102)
@@ -0,0 +1,158 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: SoBox.h,v 1.3 2006/06/29 21:21:18 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+/*-----------------------------Hepvis----------------------------------------*/
+/*                                                                           */
+/* Node:             SoBox                                                   */
+/* Description:      Represents the G4Box Geant Geometry entity              */
+/* Author:           Joe Boudreau Nov 11 1996                                */
+/*                                                                           */
+/*---------------------------------------------------------------------------*/
+#ifndef HEPVis_SoBox_h
+#define HEPVis_SoBox_h
+
+#include <Inventor/fields/SoSFFloat.h>
+#include <Inventor/fields/SoSFNode.h>
+#include <Inventor/nodes/SoShape.h>
+
+class SoSFNode;
+
+//! SoBox - Inventor version of the G4Box Geant Geometry entity
+/*!
+ * Node:	     SoBox
+ * 
+ * Description:      The Inventor version of the G4Box Geant Geometry entity
+ * 
+ * Author:	     Joe Boudreau Nov 11 1996
+ * 
+ * class G4Box
+ *
+ * A Box is a cuboid of given half lengths dx,dy,dz. The Box is
+ * centred on the origin with sides parallel to the x/y/z axes.
+ *
+ * Always use Inventor Fields. This allows Inventor to detect a change to
+ * the data field and take the appropriate action; e.g., redraw the scene.
+*/
+
+#define SoBox Geant4_SoBox
+
+class SoBox:public SoShape {
+
+  // The following is required:
+  SO_NODE_HEADER(SoBox);
+ 
+public:
+
+  //
+  //! Half-length along X
+  //
+  SoSFFloat fDx;   
+  //
+  //! Half-length along Y
+  //
+  SoSFFloat fDy;
+  //
+  //! Half-length along Z
+  //
+  SoSFFloat fDz;
+  //
+  //! Alternate rep - for use by users without HEPVis shared objects
+  //
+  SoSFNode  alternateRep;
+
+  //
+  //! Constructor, required
+  //
+  SoBox();
+
+  //
+  //! Class Initializer, required
+  //
+  static void initClass();
+
+  //
+  //! Generate AlternateRep, required.  Generating an alternate representation
+  //! must be done upon users request.  It allows an Inventor program to read
+  //! back the file without requiring *this* code to be dynamically linked. 
+  //! If the users expects that *this* code will be dynamically linked, he
+  //! need not invoke this method.  
+  //
+  virtual void generateAlternateRep();
+
+  //
+  //! We better be able to clear it, too!
+  //
+  virtual void clearAlternateRep();
+
+protected:
+
+  //
+  //! compute bounding Box, required
+  //
+  virtual void computeBBox(SoAction *action, SbBox3f &box, SbVec3f &center );
+
+  //
+  //! Generate Primitives, required
+  //
+  virtual void generatePrimitives(SoAction *action);
+
+  //
+  //! GetChildList, required whenever the class has hidden children
+  //
+  virtual SoChildList *getChildren() const;
+
+
+protected:
+  //
+  //! Destructor, required
+  //
+  virtual ~SoBox();
+
+private: 
+
+  //
+  //! Generate Children. Used to create the hidden children. Required whenever
+  //! the node has hidden children.  
+  //
+  void generateChildren();  
+
+  //
+  //! Used to modify hidden children when a data field is changed. Required 
+  //! whenever the class has hidden children. 
+  //
+  void updateChildren();
+
+  //
+  //! ChildList. Required whenever the class has hidden children.  
+  //
+  SoChildList *children;
+
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/nodes/SoCons.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/nodes/SoCons.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/nodes/SoCons.h	(revision 1102)
@@ -0,0 +1,194 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: SoCons.h,v 1.3 2006/06/29 21:21:20 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+/*-----------------------------Hepvis----------------------------------------*/
+/*                                                                           */
+/* Node:             SoCons                                                  */
+/* Description:      Represents the G4Cons Geant Geometry entity             */
+/* Author:           Joe Boudreau Nov 11 1996                                */
+/*                                                                           */
+/*---------------------------------------------------------------------------*/
+#ifndef HEPVis_SoCons_h
+#define HEPVis_SoCons_h
+
+#include <Inventor/fields/SoSFFloat.h>
+#include <Inventor/fields/SoSFNode.h>
+#include <Inventor/fields/SoSFBool.h>
+#include <Inventor/nodes/SoShape.h>
+
+class SoSFNode;
+//! SoCons - Inventor version of the G4Cons Geant Geometry entity
+/*!
+ * Node:	     SoCons
+ *
+ * Description:      The Inventor version of the G4Cons Geant Geometry entity
+ *
+ * Author:	     Joe Boudreau Nov 11 1996
+ *
+ * A G4Cons is, in the general case, a Phi segment of a cone, with half-length
+ * fDz, inner and outer radii specified at -fDz and +fDz. The Phi segment is
+ * described by a starting fSPhi angle, and the +fDPhi delta angle for the shape.
+ * If the delta angle is >=2*M_PI, the shape is treated as continuous in Phi
+ *
+ * Member Data:
+ *
+ *      fRmin1  inside radius at  -fDz
+ *      fRmin2  inside radius at  +fDz
+ *      fRmax1  outside radius at -fDz
+ *      fRmax2  outside radius at +fDz
+ *      fDz     half length in z
+ *
+ *      fSPhi   starting angle of the segment in radians
+ *      fDPhi   delta angle of the segment in radians
+*/
+
+#define SoCons Geant4_SoCons
+
+class SoCons:public SoShape {
+
+  // The following is required:
+  SO_NODE_HEADER(SoCons);
+ 
+public:
+
+  //
+  //! Inside radius at -fDz
+  //
+  SoSFFloat fRmin1;   
+  //
+  //! Inside radius at +fDz
+  //
+  SoSFFloat fRmin2;   
+  //
+  //! Outside radius at -fDz
+  //
+  SoSFFloat fRmax1;
+  //
+  //! Outside radius at +fDz
+  //
+  SoSFFloat fRmax2;
+  //
+  //! Half-length along Z
+  //
+  SoSFFloat fDz;
+  //
+  //! Starting angle, in radians
+  //
+  SoSFFloat fSPhi;
+  //
+  //! Delta-angle, in radians
+  //
+  SoSFFloat fDPhi;             
+  //
+  //! An Inventor option - slightly better render, worse performance
+  //
+  SoSFBool  smoothDraw;
+  //
+  //! Alternate rep required - for use by users without HEPVis shared objects
+  //
+  SoSFNode  alternateRep;
+
+  //
+  //! Constructor, required
+  //
+  SoCons();
+
+  //
+  //! Class Initializer, required
+  //
+  static void initClass();
+
+  //
+  //! Generate AlternateRep, required.  Generating an alternate representation
+  //! must be done upon users request.  It allows an Inventor program to read
+  //! back the file without requiring *this* code to be dynamically linked. 
+  //! If the users expects that *this* code will be dynamically linked, he
+  //! need not invoke this method.  
+  //
+  virtual void generateAlternateRep();
+
+  //
+  //! We better be able to clear it, too!
+  //
+  virtual void clearAlternateRep();
+
+protected:
+
+  //
+  //! compute bounding Box, required
+  //
+  virtual void computeBBox(SoAction *action, SbBox3f &box, SbVec3f &center );
+
+  //
+  //! Generate Primitives, required
+  //
+  virtual void generatePrimitives(SoAction *action);
+
+  //
+  //! GetChildList, required whenever the class has hidden children
+  //
+  virtual SoChildList *getChildren() const;
+
+
+protected:
+  //
+  //! Destructor, required
+  //
+  virtual ~SoCons();
+
+private: 
+
+  //
+  //! Generate Children. Used to create the hidden children. Required whenever
+  //! the node has hidden children.  
+  //
+  void generateChildren();  
+
+  //
+  //! Used to modify hidden children when a data field is changed. Required 
+  //! whenever the class has hidden children. 
+  //
+  void updateChildren();
+
+  //
+  //! ChildList. Required whenever the class has hidden children.  
+  //
+  SoChildList *children;
+
+  //
+  //! help with trigonometry.  increments sines an cosines by an angle.
+  //
+  void inc(double & sinPhi, double & cosPhi, double sinDeltaPhi, double cosDeltaPhi) const {
+    double oldSin=sinPhi,oldCos=cosPhi;
+    sinPhi = oldSin*cosDeltaPhi+oldCos*sinDeltaPhi;
+    cosPhi = oldCos*cosDeltaPhi-oldSin*sinDeltaPhi;    
+  }
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/nodes/SoImageWriter.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/nodes/SoImageWriter.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/nodes/SoImageWriter.h	(revision 1102)
@@ -0,0 +1,67 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+////////////////////////////////////////////////////////////
+//
+//  This node is able to produce PostScript, GIF files. 
+//
+////////////////////////////////////////////////////////////
+
+
+#ifndef HEPVis_SoImageWriter_h
+#define HEPVis_SoImageWriter_h 
+
+#include <Inventor/nodes/SoSubNode.h>
+#include <Inventor/fields/SoSFEnum.h>
+#include <Inventor/fields/SoSFString.h>
+
+#define SoImageWriter Geant4_SoImageWriter
+
+class SoImageWriter : public SoNode {
+  SO_NODE_HEADER(SoImageWriter);
+public:
+/*  enum Format {
+    POST_SCRIPT,
+    GIF
+  };
+  SoSFEnum format;*/
+  SoSFString fileName;
+  SoImageWriter();
+  void enable();
+  void disable();
+  SbBool getStatus() const;
+protected:
+  virtual  ~SoImageWriter();
+public: /*SoEXTENDER*/
+  virtual void GLRender(SoGLRenderAction*);
+public: /*SoINTERNAL*/
+  static void initClass();
+private:
+  SbBool fEnabled;
+  SbBool fStatus;
+};
+
+#endif
+
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/nodes/SoMarkerSet.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/nodes/SoMarkerSet.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/nodes/SoMarkerSet.h	(revision 1102)
@@ -0,0 +1,111 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+#ifndef HEPVis_SoMarkerSet_h
+#define HEPVis_SoMarkerSet_h 
+
+#include <Inventor/nodes/SoPointSet.h>
+
+#include <Inventor/fields/SoMFInt32.h>
+
+#define HEPVis_SoMarkerSet Geant4_HEPVis_SoMarkerSet
+
+class HEPVis_SoMarkerSet : public SoPointSet {
+  SO_NODE_HEADER(HEPVis_SoMarkerSet);
+public:
+  SoMFInt32 markerIndex ;
+  HEPVis_SoMarkerSet();
+
+  enum MarkerType {
+    //************ 5x5 markers
+    PLUS_5_5 = 0,
+    ASTERISK_5_5,
+    CROSS_5_5,
+    STAR_5_5,
+    CIRCLE_LINE_5_5,
+    CIRCLE_FILLED_5_5,
+    TRIANGLE_UP_LINE_5_5,
+    TRIANGLE_UP_FILLED_5_5,
+    TRIANGLE_DOWN_LINE_5_5,
+    TRIANGLE_DOWN_FILLED_5_5,
+    DAVID_STAR_LINE_5_5 = 10,
+    DAVID_STAR_FILLED_5_5,
+    SWISS_CROSS_LINE_5_5,
+    SWISS_CROSS_FILLED_5_5,
+    DIAMOND_LINE_5_5,
+    DIAMOND_FILLED_5_5,
+    SQUARE_LINE_5_5,
+    SQUARE_FILLED_5_5 = 17,
+
+    //************ 7x7 markers
+    PLUS_7_7 = 18,
+    ASTERISK_7_7,
+    CROSS_7_7,
+    STAR_7_7,
+    CIRCLE_LINE_7_7,
+    CIRCLE_FILLED_7_7,
+    TRIANGLE_UP_LINE_7_7,
+    TRIANGLE_UP_FILLED_7_7,
+    TRIANGLE_DOWN_LINE_7_7,
+    TRIANGLE_DOWN_FILLED_7_7,
+    DAVID_STAR_LINE_7_7,
+    DAVID_STAR_FILLED_7_7,
+    SWISS_CROSS_LINE_7_7 = 30,
+    SWISS_CROSS_FILLED_7_7,
+    DIAMOND_LINE_7_7,
+    DIAMOND_FILLED_7_7,
+    SQUARE_LINE_7_7,
+    SQUARE_FILLED_7_7 = 35,
+
+    //************ 9x9 markers
+    PLUS_9_9 = 36,
+    ASTERISK_9_9,
+    CROSS_9_9,
+    STAR_9_9,
+    CIRCLE_LINE_9_9,
+    CIRCLE_FILLED_9_9,
+    TRIANGLE_UP_LINE_9_9,
+    TRIANGLE_UP_FILLED_9_9,
+    TRIANGLE_DOWN_LINE_9_9,
+    TRIANGLE_DOWN_FILLED_9_9,
+    DAVID_STAR_LINE_9_9,
+    DAVID_STAR_FILLED_9_9,
+    SWISS_CROSS_LINE_9_9 = 30,
+    SWISS_CROSS_FILLED_9_9,
+    DIAMOND_LINE_9_9,
+    DIAMOND_FILLED_9_9,
+    SQUARE_LINE_9_9,
+    SQUARE_FILLED_9_9 = 53
+  } ;
+
+public: /*SoEXTENDER*/
+  virtual void GLRender(SoGLRenderAction*);
+public: /*SoINTERNAL*/
+  static void initClass();
+protected:
+  virtual ~HEPVis_SoMarkerSet();
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/nodes/SoTrap.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/nodes/SoTrap.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/nodes/SoTrap.h	(revision 1102)
@@ -0,0 +1,220 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: SoTrap.h,v 1.4 2006/06/29 21:22:06 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+/*-----------------------------Hepvis----------------------------------------*/
+/*                                                                           */
+/* Node:             SoTrap                                                  */
+/* Description:      Represents the G4Trap Geant Geometry entity             */
+/* Author:           Joe Boudreau Nov 11 1996                                */
+/*                                                                           */
+/*---------------------------------------------------------------------------*/
+#ifndef HEPVis_SoTrap_h
+#define HEPVis_SoTrap_h
+
+// Inheritance :
+#include <Inventor/nodes/SoShape.h>
+
+#include <Inventor/fields/SoSFNode.h>
+#include <Inventor/fields/SoSFBool.h>
+#include <Inventor/fields/SoSFFloat.h>
+
+//adding fields 
+#ifdef WIN32
+#include <SoWinEnterScope.h>
+#endif
+
+
+// Defining Class
+#ifdef WIN32
+#include <SoWinLeaveScope.h>
+#endif
+
+class SoSFNode;
+
+//! SoTrap - Inventor version of the G4Trap Geant Geometry entity
+/*! Node:          SoTrap
+ *
+ * Description:	   Inventor version of the G4Trap Geant Geometry entity
+ *
+ * Author:	   Joe Boudreau Nov 11 1996
+ *
+ * A G4Trap is a general trapezoid: The faces perpendicular to the z planes
+ * are tapezia, and their centres are not necessarily on a line parallel to
+ * the z axis.
+ *
+ * Note that of the 11 parameters desribed below, only 9 are really
+ * independent - a check for planarity is made in the calculation of the
+ * equation for each plane. If the planes are not parallel, a call to
+ * G4Exception is made.
+ *
+ * Always use Inventor Fields. This allows Inventor to detect a change to
+ * the data field and take the appropriate action; e.g., redraw the scene.
+ *
+*/
+
+#define SoTrap Geant4_SoTrap
+
+class SoTrap:public SoShape {
+
+  // The following is required:
+  SO_NODE_HEADER(SoTrap);
+ 
+public:
+#if defined(WIN32) && defined(BUILDING_DLL)
+   // When building the node as a DLL under Win32 we must explicitly
+   // declare this entry point as visible outside the DLL.  The macro
+   // BUILDING_DLL is defined in the node's source file.
+      _declspec(dllexport)
+#endif
+
+  //
+  //! half-length along Z
+  //
+  SoSFFloat pDz;                  
+  //
+  //! Polar angle of the line joining the centres of the faces at -/+pDz
+  //
+  SoSFFloat pTheta;
+  //
+  //! Azimuthal angle of the line joing the centre of the face at -pDz 
+  //! to the centre of the face at +pDz
+  //
+  SoSFFloat pPhi;
+  //
+  //! Half-length along y of the face at -pDz
+  //
+  SoSFFloat pDy1;
+  //
+  //! Half-length along x of the side at y=-pDy1 of the face at -pDz
+  //
+  SoSFFloat pDx1;
+  //
+  //! Half-length along x of the side at y=+pDy1 of the face at -pDz
+  //
+  SoSFFloat pDx2;
+  //
+  //! Half-length along y of the face at +pDz
+  //
+  SoSFFloat pDy2;
+  //
+  //! Half-length along x of the side at y=-pDy2 of the face at +pDz
+  //
+  SoSFFloat pDx3;
+  //
+  //! Half-length along x of the side at y=+pDy2 of the face at +pDz
+  //
+  SoSFFloat pDx4;
+  //
+  //! Angle with respect to the y axis from the centre of the side at 
+  //! y=-pDy1 to the centre at y=+pDy1 of the face at -pDz
+  //
+  SoSFFloat pAlp1;
+  //
+  //! Angle with respect to the y axis from the centre of the side at 
+  //! y=-pDy2 to the centre at y=+pDy2 of the face at +pDz
+  //
+  SoSFFloat pAlp2;
+ 
+  //
+  //! Alternate rep - required
+  //
+  SoSFNode  alternateRep;
+
+  //
+  //! Constructor, required
+  //
+  SoTrap();
+
+  //
+  //! Class Initializer, required
+  //
+  static void initClass();
+
+  //
+  //! Generate AlternateRep, required.  Generating an alternate representation
+  //! must be done upon users request.  It allows an Inventor program to read
+  //! back the file without requiring *this* code to be dynamically linked. 
+  //! If the users expects that *this* code will be dynamically linked, he
+  //! need not invoke this method.  
+  //
+  virtual void generateAlternateRep();
+
+  //
+  //! We better be able to clear it, too!
+  //
+  virtual void clearAlternateRep();
+
+protected:
+
+  //
+  //! compute bounding Box, required
+  //
+  virtual void computeBBox(SoAction *action, SbBox3f &box, SbVec3f &center );
+
+  //
+  //! Generate Primitives, required
+  //
+  virtual void generatePrimitives(SoAction *action);
+
+  //
+  //! GetChildList, required whenever the class has hidden children
+  //
+  virtual SoChildList *getChildren() const;
+
+  //
+  //! Destructor, required
+  //
+  virtual ~SoTrap();
+
+private: 
+
+  //
+  //! Generate Children. Used to create the hidden children. Required whenever
+  //! the node has hidden children.  
+  //
+  void generateChildren();  
+
+  //
+  //! Used to modify hidden children when a data field is changed. Required 
+  //! whenever the class has hidden children. 
+  //
+  void updateChildren();
+
+  //
+  //! ChildList. Required whenever the class has hidden children.  
+  //
+  SoChildList *children;
+
+};
+
+#ifdef WIN32
+#include <SoWinEnterScope.h>
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/nodes/SoTrd.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/nodes/SoTrd.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/nodes/SoTrd.h	(revision 1102)
@@ -0,0 +1,172 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: SoTrd.h,v 1.3 2006/06/29 21:22:08 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+/*-----------------------------Hepvis----------------------------------------*/
+/*                                                                           */
+/* Node:             SoTrd                                                   */
+/* Description:      Represents the G4Trd Geant Geometry entity              */
+/* Author:           Joe Boudreau Nov 11 1996                                */
+/*                                                                           */
+/*---------------------------------------------------------------------------*/
+#ifndef HEPVis_SoTrd_h
+#define HEPVis_SoTrd_h
+
+#include <Inventor/fields/SoSFFloat.h>
+#include <Inventor/fields/SoSFNode.h>
+#include <Inventor/fields/SoSFBool.h>
+#include <Inventor/nodes/SoShape.h>
+
+class SoSFNode;
+
+//! SoTrd - Inventor version of the G4Trd Geant Geometry entity
+/*!
+ * Node:            SoTrd
+ * 
+ * Description:     Inventor version of the G4Trd Geant Geometry entity
+ * 
+ * Author:	    Joe Boudreau Nov 11 1996
+ * 
+ * A Trd is a trapezoid with the x and y dimensions varying along z
+ *
+ * Always use Inventor Fields. This allows Inventor to detect a change to
+ * the data field and take the appropriate action; e.g., redraw the scene.
+ *
+ */
+
+#define SoTrd Geant4_SoTrd
+
+class SoTrd:public SoShape {
+
+  //
+  //! This is required
+  //
+  SO_NODE_HEADER(SoTrd);
+ 
+public:
+
+  //
+  //! half-length of x, at -fDz
+  //
+  SoSFFloat fDx1;                  
+
+  //
+  //! half-length of x, at +fDz
+  //
+  SoSFFloat fDx2;
+
+  //
+  //! half-length of y, at -fDz
+  //
+  SoSFFloat fDy1;
+
+  //
+  //! half-length of y, at +fDz
+  //
+  SoSFFloat fDy2;
+
+  //
+  //! half-length along Z
+  //
+  SoSFFloat fDz;
+
+  //
+  //! Alternate rep - required
+  //
+  SoSFNode  alternateRep;
+
+  //
+  //! Constructor, required
+  //
+  SoTrd();
+
+  //
+  //! Class Initializer, required
+  //
+  static void initClass();
+
+  //
+  //! Generate AlternateRep, required.  Generating an alternate representation
+  //! must be done upon users request.  It allows an Inventor program to read
+  //! back the file without requiring *this* code to be dynamically linked. 
+  //! If the users expects that *this* code will be dynamically linked, he
+  //! need not invoke this method.  
+  //
+  virtual void generateAlternateRep();
+
+  //
+  //! We better be able to clear it, too!
+  //
+  virtual void clearAlternateRep();
+
+protected:
+
+  //
+  //! compute bounding Box, required
+  //
+  virtual void computeBBox(SoAction *action, SbBox3f &box, SbVec3f &center );
+
+  //
+  //! Generate Primitives, required
+  //
+  virtual void generatePrimitives(SoAction *action);
+
+  //
+  //! GetChildList, required whenever the class has hidden children
+  //
+  virtual SoChildList *getChildren() const;
+
+
+protected:
+
+  //
+  //! Destructor, required
+  //
+  virtual ~SoTrd();
+
+private: 
+
+  //
+  //! Generate Children. Used to create the hidden children. Required whenever
+  //! the node has hidden children.  
+  //
+  void generateChildren();  
+
+  //
+  //! Used to modify hidden children when a data field is changed. Required 
+  //! whenever the class has hidden children. 
+  //
+  void updateChildren();
+
+  //
+  //! ChildList. Required whenever the class has hidden children.  
+  //
+  SoChildList *children;
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/nodes/SoTubs.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/nodes/SoTubs.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/include/HEPVis/nodes/SoTubs.h	(revision 1102)
@@ -0,0 +1,183 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: SoTubs.h,v 1.3 2006/06/29 21:22:10 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+/*-----------------------------Hepvis----------------------------------------*/
+/*                                                                           */
+/* Node:             SoTubs                                                  */
+/* Description:      Represents the G4Tubs Geant Geometry entity             */
+/* Author:           Joe Boudreau Nov 11 1996                                */
+/*                                                                           */
+/*---------------------------------------------------------------------------*/
+#ifndef HEPVis_SoTubs_h
+#define HEPVis_SoTubs_h
+
+#include <Inventor/fields/SoSFFloat.h>
+#include <Inventor/fields/SoSFNode.h>
+#include <Inventor/fields/SoSFBool.h>
+#include <Inventor/nodes/SoShape.h>
+
+class SoSFNode;
+
+//! SoTubs - Inventor version of the G4Tubs Geant Geometry entity
+/*!
+ * Node:	     SoTubs
+ * 
+ * Description:      The Inventor version of the G4Tubs Geant Geometry entity
+ * 
+ * Author:	     Joe Boudreau Nov 11 1996
+ * 
+ * class G4Tubs
+ * 
+ * A tube or tube segment with curved sides parallel to
+ * the z-axis. The tube has a specified half-length along
+ * the z axis, about which it is centred, and a given
+ * minimum and maximum radius. A minimum radius of 0
+ * signifies a filled tube /cylinder. The tube segment is
+ * specified by starting and delta
+ * angles for phi, with 0 being the +x axis, PI/2
+ * the +y axis. A delta angle of 2PI signifies a
+ * complete, unsegmented tube/cylinder
+ *
+ * Always use Inventor Fields. This allows Inventor to detect a change to
+ * the data field and take the appropriate action; e.g., redraw the scene.
+*/
+
+#define SoTubs Geant4_SoTubs
+
+class SoTubs:public SoShape {
+
+  // The following is required:
+  SO_NODE_HEADER(SoTubs);
+ 
+public:
+
+  //
+  //! Inside radius of the tube
+  //
+  SoSFFloat pRMin;   
+  //
+  //! Outside radius of the tube
+  //
+  SoSFFloat pRMax;
+  //
+  //! Half-length in Z
+  //
+  SoSFFloat pDz;
+  //
+  //! Starting angle, in radians
+  //
+  SoSFFloat pSPhi;
+  //
+  //! Delta-angle, in radians
+  //
+  SoSFFloat pDPhi;             
+  //
+  //! Alternate rep - required
+  //
+  SoSFNode  alternateRep;
+
+  //
+  //! Constructor, required
+  //
+  SoTubs();
+
+  //
+  //! Class Initializer, required
+  //
+  static void initClass();
+
+  //
+  //! Generate AlternateRep, required.  Generating an alternate representation
+  //! must be done upon users request.  It allows an Inventor program to read
+  //! back the file without requiring *this* code to be dynamically linked. 
+  //! If the users expects that *this* code will be dynamically linked, he
+  //! need not invoke this method.  
+  //
+  virtual void generateAlternateRep();
+
+  //
+  //! We better be able to clear it, too!
+  //
+  virtual void clearAlternateRep();
+
+protected:
+
+  //
+  //! compute bounding Box, required
+  //
+  virtual void computeBBox(SoAction *action, SbBox3f &box, SbVec3f &center );
+
+  //
+  //! Generate Primitives, required
+  //
+  virtual void generatePrimitives(SoAction *action);
+
+  //
+  //! GetChildList, required whenever the class has hidden children
+  //
+  virtual SoChildList *getChildren() const;
+
+
+protected:
+  //
+  //! Destructor, required
+  //
+  virtual ~SoTubs();
+
+private: 
+
+  //
+  //! Generate Children. Used to create the hidden children. Required whenever
+  //! the node has hidden children.  
+  //
+  void generateChildren();  
+
+  //
+  //! Used to modify hidden children when a data field is changed. Required 
+  //! whenever the class has hidden children. 
+  //
+  void updateChildren();
+
+  //
+  //! ChildList. Required whenever the class has hidden children.  
+  //
+  SoChildList *children;
+
+  //
+  //! help with trigonometry.  increments sines an cosines by an angle.
+  //
+  void inc(double & sinPhi, double & cosPhi, double sinDeltaPhi, double cosDeltaPhi) const {
+    double oldSin=sinPhi,oldCos=cosPhi;
+    sinPhi = oldSin*cosDeltaPhi+oldCos*sinDeltaPhi;
+    cosPhi = oldCos*cosDeltaPhi-oldSin*sinDeltaPhi;    
+  }
+
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/include/SoG4LineSet.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/include/SoG4LineSet.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/include/SoG4LineSet.h	(revision 1102)
@@ -0,0 +1,41 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: SoG4LineSet.h,v 1.2 2006/12/13 15:49:51 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// John Allison  26th October 2006
+// Extended SoLineSet to include G4Atts.
+
+#ifndef SoG4LineSet_h
+#define SoG4LineSet_h
+
+// Inheritance :
+#include <Inventor/nodes/SoLineSet.h>
+#include "G4AttHolder.hh"
+
+class SoG4LineSet: public SoLineSet, public G4AttHolder {};
+
+#endif  //SoG4LineSet_h
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/include/SoG4MarkerSet.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/include/SoG4MarkerSet.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/include/SoG4MarkerSet.h	(revision 1102)
@@ -0,0 +1,41 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: SoG4MarkerSet.h,v 1.2 2006/12/13 15:49:53 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// John Allison  26th October 2006
+// Extended SoMarkerSet to include G4Atts.
+
+#ifndef SoG4MarkerSet_h
+#define SoG4MarkerSet_h
+
+// Inheritance :
+#include <HEPVis/nodes/SoMarkerSet.h>
+#include "G4AttHolder.hh"
+
+class SoG4MarkerSet: public SoMarkerSet, public G4AttHolder {};
+
+#endif  //SoG4MarkerSet_h
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/include/SoG4Polyhedron.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/include/SoG4Polyhedron.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/include/SoG4Polyhedron.h	(revision 1102)
@@ -0,0 +1,48 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: SoG4Polyhedron.h,v 1.3 2007/09/17 16:08:00 gcosmo Exp $
+// GEANT4 tag $Name:  $
+//
+// John Allison  26th October 2006
+// Extended Geant4_SoPolyhedron to include G4Atts.
+
+#ifndef SoG4Polyhedron_h
+#define SoG4Polyhedron_h
+
+// Inheritance :
+#include "Geant4_SoPolyhedron.h"
+#include "G4AttHolder.hh"
+
+class G4Polyhedron;
+
+class SoG4Polyhedron: public Geant4_SoPolyhedron, public G4AttHolder {
+ public:
+  SoG4Polyhedron(const G4Polyhedron& polyhedron):
+    Geant4_SoPolyhedron(polyhedron){}
+};
+
+#endif  //SoG4Polyhedron_h
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/src/G4OpenInventor.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/src/G4OpenInventor.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/src/G4OpenInventor.cc	(revision 1102)
@@ -0,0 +1,94 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenInventor.cc,v 1.20 2006/06/29 21:22:12 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+#ifdef G4VIS_BUILD_OI_DRIVER
+
+// this :
+#include "G4OpenInventor.hh"
+
+#include "HEPVis/nodes/SoBox.h"
+#include "HEPVis/nodes/SoTubs.h"
+#include "HEPVis/nodes/SoCons.h"
+#include "HEPVis/nodes/SoTrd.h"
+#include "HEPVis/nodes/SoTrap.h"
+#include "HEPVis/nodes/SoMarkerSet.h"
+#include "HEPVis/nodes/SoImageWriter.h"
+#include "HEPVis/nodekits/SoDetectorTreeKit.h"
+#include "HEPVis/actions/SoGL2PSAction.h"
+#include "HEPVis/actions/SoCounterAction.h"
+#include "HEPVis/actions/SoAlternateRepAction.h"
+
+#include "Geant4_SoPolyhedron.h"
+
+#include "G4OpenInventorSceneHandler.hh"
+
+G4OpenInventor::G4OpenInventor (
+ const G4String name
+,const G4String nickname
+,G4VGraphicsSystem::Functionality f
+)
+:G4VGraphicsSystem(name,nickname,f)
+,interactorManager(0)
+{
+}
+
+G4OpenInventor::~G4OpenInventor () {}
+
+void G4OpenInventor::SetInteractorManager (G4VInteractorManager* im) {
+  interactorManager = im;
+}
+G4VInteractorManager* G4OpenInventor::GetInteractorManager () {
+  return interactorManager;
+}
+G4VSceneHandler* G4OpenInventor::CreateSceneHandler (const G4String& name) {
+  Initialize();
+  G4VSceneHandler* p = new G4OpenInventorSceneHandler (*this, name);
+  return    p;
+}
+
+void G4OpenInventor::InitNodes()
+{
+  SoBox::initClass();
+  SoTubs::initClass();
+  SoCons::initClass();
+  SoTrd::initClass();
+  SoTrap::initClass();
+  SoDetectorTreeKit::initClass();
+  HEPVis_SoMarkerSet::initClass();
+  SoImageWriter::initClass();
+  Geant4_SoPolyhedron::initClass();
+
+  SoGL2PSAction::initClass();
+  SoCounterAction::initClass();
+  SoAlternateRepAction::initClass();
+}
+
+
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/src/G4OpenInventorSceneHandler.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/src/G4OpenInventorSceneHandler.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/src/G4OpenInventorSceneHandler.cc	(revision 1102)
@@ -0,0 +1,829 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenInventorSceneHandler.cc,v 1.55 2009/02/18 14:21:38 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Jeff Kallenbach 01 Aug 1996
+// OpenInventor stored scene - creates OpenInventor display lists.
+#ifdef G4VIS_BUILD_OI_DRIVER
+
+// this :
+#include "G4OpenInventorSceneHandler.hh"
+
+#include <Inventor/SoPath.h>
+#include <Inventor/SoNodeKitPath.h>
+#include <Inventor/nodes/SoCoordinate3.h>
+#include <Inventor/nodes/SoCoordinate4.h>
+#include <Inventor/nodes/SoSeparator.h>
+#include <Inventor/nodes/SoDrawStyle.h>
+#include <Inventor/nodes/SoLightModel.h>
+#include <Inventor/nodes/SoMaterial.h>
+#include <Inventor/nodes/SoLineSet.h>
+#include <Inventor/nodes/SoCube.h>
+#include <Inventor/nodes/SoFont.h>
+#include <Inventor/nodes/SoText2.h>
+#include <Inventor/nodes/SoFaceSet.h>
+#include <Inventor/nodes/SoNormal.h>
+#include <Inventor/nodes/SoNormalBinding.h>
+#include <Inventor/nodes/SoComplexity.h>
+#include <Inventor/nodes/SoNurbsSurface.h>
+#include <Inventor/nodes/SoTranslation.h>
+#include <Inventor/nodes/SoTransform.h>
+#include <Inventor/nodes/SoResetTransform.h>
+#include <Inventor/nodes/SoMatrixTransform.h>
+
+#define USE_SOPOLYHEDRON
+
+#ifndef USE_SOPOLYHEDRON
+#include "HEPVis/nodes/SoBox.h"
+#include "HEPVis/nodes/SoTubs.h"
+#include "HEPVis/nodes/SoCons.h"
+#include "HEPVis/nodes/SoTrd.h"
+#include "HEPVis/nodes/SoTrap.h"
+#endif
+#include "HEPVis/nodes/SoMarkerSet.h"
+typedef HEPVis_SoMarkerSet SoMarkerSet;
+#include "HEPVis/nodekits/SoDetectorTreeKit.h"
+#include "HEPVis/misc/SoStyleCache.h"
+
+#include "SoG4Polyhedron.h"
+#include "SoG4LineSet.h"
+#include "SoG4MarkerSet.h"
+
+#include "G4Scene.hh"
+#include "G4NURBS.hh"
+#include "G4OpenInventor.hh"
+#include "G4OpenInventorTransform3D.hh"
+#include "G4ThreeVector.hh"
+#include "G4Point3D.hh"
+#include "G4Normal3D.hh"
+#include "G4Transform3D.hh"
+#include "G4Polyline.hh"
+#include "G4Text.hh"
+#include "G4Circle.hh"
+#include "G4Square.hh"
+#include "G4Polymarker.hh"
+#include "G4Polyhedron.hh"
+#include "G4Box.hh"
+#include "G4Tubs.hh"
+#include "G4Cons.hh"
+#include "G4Trap.hh"
+#include "G4Trd.hh"
+#include "G4ModelingParameters.hh"
+#include "G4VPhysicalVolume.hh"
+#include "G4LogicalVolume.hh"
+#include "G4Material.hh"
+#include "G4VisAttributes.hh"
+
+G4int G4OpenInventorSceneHandler::fSceneIdCount = 0;
+
+G4OpenInventorSceneHandler::G4OpenInventorSceneHandler (G4OpenInventor& system,
+                                          const G4String& name)
+:G4VSceneHandler (system, fSceneIdCount++, name)
+,fRoot(0)
+,fDetectorRoot(0)
+,fTransientRoot(0)
+,fCurrentSeparator(0)
+,fModelingSolid(false)
+,fReducedWireFrame(true)
+,fStyleCache(0)
+,fPreviewAndFull(false)
+{
+  fStyleCache = new SoStyleCache;
+  fStyleCache->ref();
+
+  fRoot = new SoSeparator;
+  fRoot->ref();
+  fRoot->setName("Root");
+  
+  fDetectorRoot = new SoSeparator;
+  fDetectorRoot->setName("StaticRoot");
+  fRoot->addChild(fDetectorRoot);
+  
+  fTransientRoot = new SoSeparator;
+  fTransientRoot->setName("TransientRoot");
+  fRoot->addChild(fTransientRoot);
+  
+  fCurrentSeparator = fTransientRoot;
+}
+
+G4OpenInventorSceneHandler::~G4OpenInventorSceneHandler ()
+{
+  fRoot->unref();
+  fStyleCache->unref();
+}
+
+void G4OpenInventorSceneHandler::ClearStore () {
+  G4VSceneHandler::ClearStore();
+
+  fDetectorRoot->removeAllChildren();
+  fSeparatorMap.clear();
+
+  fTransientRoot->removeAllChildren();
+}
+
+void G4OpenInventorSceneHandler::ClearTransientStore () {
+  G4VSceneHandler::ClearTransientStore ();
+
+  fTransientRoot->removeAllChildren();
+}
+
+//
+// Generates prerequisites for solids
+//  
+void G4OpenInventorSceneHandler::PreAddSolid
+(const G4Transform3D& objectTransformation,
+ const G4VisAttributes& visAttribs)
+{
+  G4VSceneHandler::PreAddSolid (objectTransformation, visAttribs);
+  // Stores arguments away for future use, e.g., AddPrimitives.
+
+  GeneratePrerequisites();
+}
+
+//
+// Generates prerequisites for primitives
+//  
+void G4OpenInventorSceneHandler::BeginPrimitives
+(const G4Transform3D& objectTransformation) {
+
+  G4VSceneHandler::BeginPrimitives (objectTransformation);
+
+  // If thread of control has already passed through PreAddSolid,
+  // avoid opening a graphical data base component again.
+  if (!fProcessingSolid) {
+    GeneratePrerequisites();
+  }
+}
+
+//
+// Method for handling G4Polyline objects (from tracking).
+//
+void G4OpenInventorSceneHandler::AddPrimitive (const G4Polyline& line)
+{
+  AddProperties(line.GetVisAttributes());  // Transformation, colour, etc.
+
+  G4int nPoints = line.size();
+  SbVec3f* pCoords = new SbVec3f[nPoints];
+
+  for (G4int iPoint = 0; iPoint < nPoints ; iPoint++) {
+    pCoords[iPoint].setValue((float)line[iPoint].x(),
+                             (float)line[iPoint].y(),
+                             (float)line[iPoint].z());
+  }
+
+  //
+  // Point Set
+  // 
+  SoCoordinate3 *polyCoords = new SoCoordinate3;
+  polyCoords->point.setValues(0,nPoints,pCoords);
+  fCurrentSeparator->addChild(polyCoords);
+  
+  //
+  // Wireframe
+  // 
+  SoDrawStyle* drawStyle = fStyleCache->getLineStyle();
+  fCurrentSeparator->addChild(drawStyle);
+
+  SoG4LineSet *pLine = new SoG4LineSet;
+
+  // Loads G4Atts for picking...
+  if (fpViewer->GetViewParameters().IsPicking()) LoadAtts(line, pLine);
+
+#ifdef INVENTOR2_0
+  pLine->numVertices.setValues(0,1,(const long *)&nPoints);
+#else 
+  pLine->numVertices.setValues(0,1,&nPoints);
+#endif
+
+  fCurrentSeparator->addChild(pLine);
+
+  delete [] pCoords;
+}
+
+void G4OpenInventorSceneHandler::AddPrimitive (const G4Polymarker& polymarker)
+{
+  AddProperties(polymarker.GetVisAttributes()); // Transformation, colour, etc.
+
+  G4int pointn = polymarker.size();
+  if(pointn<=0) return;
+
+  SbVec3f* points = new SbVec3f[pointn];
+  for (G4int iPoint = 0; iPoint < pointn ; iPoint++) {
+    points[iPoint].setValue((float)polymarker[iPoint].x(),
+                            (float)polymarker[iPoint].y(),
+                            (float)polymarker[iPoint].z());
+  }
+
+  SoCoordinate3* coordinate3 = new SoCoordinate3;
+  coordinate3->point.setValues(0,pointn,points);
+  fCurrentSeparator->addChild(coordinate3);
+
+  MarkerSizeType sizeType;
+  G4double screenSize = GetMarkerSize (polymarker, sizeType);
+  switch (sizeType) {
+  default:
+  case screen:
+    // Draw in screen coordinates.  OK.
+    break;
+  case world:
+    // Draw in world coordinates.   Not implemented.  Use screenSize = 10.
+    screenSize = 10.;
+    break;
+  }
+  
+  SoG4MarkerSet* markerSet = new SoG4MarkerSet;
+  markerSet->numPoints = pointn;
+
+  // Loads G4Atts for picking...
+  if (fpViewer->GetViewParameters().IsPicking())
+    LoadAtts(polymarker, markerSet);
+
+  G4VMarker::FillStyle style = polymarker.GetFillStyle();
+  switch (polymarker.GetMarkerType()) {
+  default:
+    // Are available 5_5, 7_7 and 9_9
+  case G4Polymarker::dots:
+    if (screenSize <= 5.) {
+      markerSet->markerIndex = SoMarkerSet::CIRCLE_FILLED_5_5;
+    } else if (screenSize <= 7.) {
+      markerSet->markerIndex = SoMarkerSet::CIRCLE_FILLED_7_7;
+    } else {
+      markerSet->markerIndex = SoMarkerSet::CIRCLE_FILLED_9_9;
+    }
+    break;
+  case G4Polymarker::circles:
+    if (screenSize <= 5.) {
+      if (style == G4VMarker::filled) {
+	markerSet->markerIndex = SoMarkerSet::CIRCLE_FILLED_5_5;
+      } else {
+	markerSet->markerIndex = SoMarkerSet::CIRCLE_LINE_5_5;
+      }
+    } else if (screenSize <= 7.) {
+      if (style == G4VMarker::filled) {
+	markerSet->markerIndex = SoMarkerSet::CIRCLE_FILLED_7_7;
+      } else {
+	markerSet->markerIndex = SoMarkerSet::CIRCLE_LINE_7_7;
+      }
+    } else {
+      if (style == G4VMarker::filled) {
+	markerSet->markerIndex = SoMarkerSet::CIRCLE_FILLED_9_9;
+      } else {
+	markerSet->markerIndex = SoMarkerSet::CIRCLE_LINE_9_9;
+      }
+    }
+    break;
+  case G4Polymarker::squares:
+    if (screenSize <= 5.) {
+      if (style == G4VMarker::filled) {
+	markerSet->markerIndex = SoMarkerSet::SQUARE_FILLED_5_5;
+      } else {
+	markerSet->markerIndex = SoMarkerSet::SQUARE_LINE_5_5;
+      }
+    } else if (screenSize <= 7.) {
+      if (style == G4VMarker::filled) {
+	markerSet->markerIndex = SoMarkerSet::SQUARE_FILLED_7_7;
+      } else {
+	markerSet->markerIndex = SoMarkerSet::SQUARE_LINE_7_7;
+      }
+    } else {
+      if (style == G4VMarker::filled) {
+	markerSet->markerIndex = SoMarkerSet::SQUARE_FILLED_9_9;
+      } else {
+	markerSet->markerIndex = SoMarkerSet::SQUARE_LINE_9_9;
+      }
+    }
+  }
+  fCurrentSeparator->addChild(markerSet);
+
+  delete [] points;
+}
+
+// ********* NOTE ********* NOTE ********* NOTE ********* NOTE *********
+//
+//  This method (Text) has not been tested, as it is 
+//  innaccessible from the menu in the current configuration
+//
+//  Currently draws at the origin!  How do I get it to draw at
+//  text.GetPosition()?  JA
+//
+// ********* NOTE ********* NOTE ********* NOTE ********* NOTE *********
+//
+// Method for handling G4Text objects
+//
+void G4OpenInventorSceneHandler::AddPrimitive (const G4Text& text)
+{
+  AddProperties(text.GetVisAttributes());  // Transformation, colour, etc.
+
+  //
+  // Color.  Note: text colour is worked out differently.  This
+  // over-rides the colour added in AddProperties...
+  //
+  const G4Colour& c = GetTextColour (text);
+  SoMaterial* material = 
+    fStyleCache->getMaterial((float)c.GetRed(),
+                             (float)c.GetGreen(),
+                             (float)c.GetBlue(),
+                             (float)(1-c.GetAlpha()));
+  fCurrentSeparator->addChild(material);
+
+  MarkerSizeType sizeType;
+  G4double size = GetMarkerSize (text, sizeType);
+  switch (sizeType) {
+  default:
+  case screen:
+    // Draw in screen coordinates.  OK.
+    break;
+  case world:
+    // Draw in world coordinates.   Not implemented.  Use size = 20.
+    size = 20.;
+    break;
+  }
+
+  //
+  // Font
+  // 
+  SoFont *g4Font = new SoFont();
+  g4Font->size = size;
+  fCurrentSeparator->addChild(g4Font);
+
+  //
+  // Text
+  // 
+  SoText2 *g4String = new SoText2();
+  g4String->string.setValue(text.GetText());
+  g4String->spacing = 2.0;
+  switch (text.GetLayout()) {
+  default:
+  case G4Text::left:
+    g4String->justification = SoText2::LEFT; break;
+  case G4Text::centre:
+    g4String->justification = SoText2::CENTER; break;
+  case G4Text::right:
+    g4String->justification = SoText2::RIGHT; break;
+  }
+  fCurrentSeparator->addChild(g4String);
+}
+
+//
+// Method for handling G4Circle objects
+//
+void G4OpenInventorSceneHandler::AddPrimitive (const G4Circle& circle) {
+  AddCircleSquare(G4OICircle, circle);
+}
+
+//
+// Method for handling G4Square objects - defaults to wireframe
+//
+void G4OpenInventorSceneHandler::AddPrimitive (const G4Square& square) {
+  AddCircleSquare(G4OISquare, square);
+}
+
+void G4OpenInventorSceneHandler::AddCircleSquare
+(G4OIMarker markerType, const G4VMarker& marker)
+{
+  AddProperties(marker.GetVisAttributes());  // Transformation, colour, etc.
+
+  MarkerSizeType sizeType;
+  G4double screenSize = GetMarkerSize (marker, sizeType);
+  switch (sizeType) {
+  default:
+  case screen:
+    // Draw in screen coordinates.  OK.
+    break;
+  case world:
+    // Draw in world coordinates.   Not implemented.  Use size = 10.
+    screenSize = 10.;
+    break;
+  }
+
+  G4Point3D centre = marker.GetPosition();
+
+  // Borrowed from AddPrimitive(G4Polymarker) - inefficient? JA
+  SbVec3f* points = new SbVec3f[1];
+  points[0].setValue((float)centre.x(),
+		     (float)centre.y(),
+		     (float)centre.z());
+  SoCoordinate3* coordinate3 = new SoCoordinate3;
+  coordinate3->point.setValues(0,1,points);
+  fCurrentSeparator->addChild(coordinate3);
+
+  SoG4MarkerSet* markerSet = new SoG4MarkerSet;
+  markerSet->numPoints = 1;
+
+  // Loads G4Atts for picking...
+  if (fpViewer->GetViewParameters().IsPicking()) LoadAtts(marker, markerSet);
+
+  G4VMarker::FillStyle style = marker.GetFillStyle();
+  switch (markerType) {
+  case G4OICircle:
+    if (screenSize <= 5.) {
+      if (style == G4VMarker::filled) {
+	markerSet->markerIndex = SoMarkerSet::CIRCLE_FILLED_5_5;
+      } else {
+	markerSet->markerIndex = SoMarkerSet::CIRCLE_LINE_5_5;
+      }
+    } else if (screenSize <= 7.) {
+      if (style == G4VMarker::filled) {
+	markerSet->markerIndex = SoMarkerSet::CIRCLE_FILLED_7_7;
+      } else {
+	markerSet->markerIndex = SoMarkerSet::CIRCLE_LINE_7_7;
+      }
+    } else {
+      if (style == G4VMarker::filled) {
+	markerSet->markerIndex = SoMarkerSet::CIRCLE_FILLED_9_9;
+      } else {
+	markerSet->markerIndex = SoMarkerSet::CIRCLE_LINE_9_9;
+      }
+    }
+    break;
+  case G4OISquare:
+    if (screenSize <= 5.) {
+      if (style == G4VMarker::filled) {
+	markerSet->markerIndex = SoMarkerSet::SQUARE_FILLED_5_5;
+      } else {
+	markerSet->markerIndex = SoMarkerSet::SQUARE_LINE_5_5;
+      }
+    } else if (screenSize <= 7.) {
+      if (style == G4VMarker::filled) {
+	markerSet->markerIndex = SoMarkerSet::SQUARE_FILLED_7_7;
+      } else {
+	markerSet->markerIndex = SoMarkerSet::SQUARE_LINE_7_7;
+      }
+    } else {
+      if (style == G4VMarker::filled) {
+	markerSet->markerIndex = SoMarkerSet::SQUARE_FILLED_9_9;
+      } else {
+	markerSet->markerIndex = SoMarkerSet::SQUARE_LINE_9_9;
+      }
+    }
+  break;
+  }
+  fCurrentSeparator->addChild(markerSet);
+
+  delete [] points;
+}
+
+//
+// Method for handling G4Polyhedron objects for drawing solids.
+//
+void G4OpenInventorSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron)
+{
+  if (polyhedron.GetNoFacets() == 0) return;
+
+  AddProperties(polyhedron.GetVisAttributes()); // Transformation, colour, etc.
+
+  SoG4Polyhedron* soPolyhedron = new SoG4Polyhedron(polyhedron);
+
+  // Loads G4Atts for picking...
+  if (fpViewer->GetViewParameters().IsPicking())
+    LoadAtts(polyhedron, soPolyhedron);
+
+  SbString name = "Non-geometry";
+  G4PhysicalVolumeModel* pPVModel =
+    dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
+  if (pPVModel) {
+    name = pPVModel->GetCurrentLV()->GetName().c_str();
+  }
+  SbName sbName(name);
+  soPolyhedron->setName(sbName);
+  soPolyhedron->solid.setValue(fModelingSolid);
+  soPolyhedron->reducedWireFrame.setValue(fReducedWireFrame?TRUE:FALSE);
+  fCurrentSeparator->addChild(soPolyhedron);  
+}
+
+//
+// Method for handling G4NURBS objects for drawing solids.
+// Knots and Ctrl Pnts MUST be arrays of GLfloats.
+//
+void G4OpenInventorSceneHandler::AddPrimitive (const G4NURBS& nurb) {
+
+  AddProperties(nurb.GetVisAttributes()); // Transformation, colour, etc.
+
+  G4float *u_knot_array, *u_knot_array_ptr;
+  u_knot_array = u_knot_array_ptr = new G4float [nurb.GetnbrKnots(G4NURBS::U)];
+  G4NURBS::KnotsIterator u_iterator (nurb, G4NURBS::U);
+  while (u_iterator.pick (u_knot_array_ptr++)){}
+
+  G4float *v_knot_array, *v_knot_array_ptr;
+  v_knot_array = v_knot_array_ptr = new G4float [nurb.GetnbrKnots(G4NURBS::V)];
+  G4NURBS::KnotsIterator v_iterator (nurb, G4NURBS::V);
+  while (v_iterator.pick (v_knot_array_ptr++)){}
+
+  G4float *ctrl_pnt_array, *ctrl_pnt_array_ptr;
+  ctrl_pnt_array = ctrl_pnt_array_ptr =
+    new G4float [nurb.GettotalnbrCtrlPts () * G4NURBS::NofC*sizeof(G4float)];
+  G4NURBS::CtrlPtsCoordsIterator c_p_iterator (nurb);
+  while (c_p_iterator.pick (ctrl_pnt_array_ptr++)){}
+  
+  SoSeparator *surfSep = new SoSeparator();
+
+  //
+  // Set up NURBS
+  //
+  SoComplexity *complexity = new SoComplexity;
+  SoCoordinate4 *ctlPts = new SoCoordinate4;
+  SoNurbsSurface *oi_nurb = new SoNurbsSurface;
+  
+  complexity->value = (float)0.6;
+  G4int    nPoints = nurb.GettotalnbrCtrlPts ();
+  SbVec4f* points  = new SbVec4f[nPoints];
+  for (G4int iPoint = 0; iPoint < nPoints ; iPoint++) {
+    points[iPoint].setValue(
+                            ctrl_pnt_array[iPoint*4 + 0],
+                            ctrl_pnt_array[iPoint*4 + 1],
+                            ctrl_pnt_array[iPoint*4 + 2],
+                            ctrl_pnt_array[iPoint*4 + 3]);
+  }
+  ctlPts->point.setValues (0,nPoints,points);
+  oi_nurb->numUControlPoints = nurb.GetnbrCtrlPts(G4NURBS::U);
+  oi_nurb->numVControlPoints = nurb.GetnbrCtrlPts(G4NURBS::V);
+  oi_nurb->uKnotVector.setValues(0,nurb.GetnbrKnots(G4NURBS::U),u_knot_array);
+  oi_nurb->vKnotVector.setValues(0,nurb.GetnbrKnots(G4NURBS::V),v_knot_array);
+
+  surfSep->addChild(complexity);
+  surfSep->addChild(ctlPts);
+  surfSep->addChild(oi_nurb);
+  
+  fCurrentSeparator->addChild(surfSep);
+
+  //
+  // Clean-up
+  //
+  delete [] u_knot_array;
+  delete [] v_knot_array;
+  delete [] ctrl_pnt_array;
+  delete [] points;
+}
+
+void G4OpenInventorSceneHandler::GeneratePrerequisites()
+{
+  // Utility for PreAddSolid and BeginPrimitives.
+
+  // This routines prepares for adding items to the scene database.  We
+  // are expecting two kinds of solids: leaf parts and non-leaf parts.
+  // For non-leaf parts, we create a detector tree kit.  This has two
+  // separators.  The solid itself goes in the preview separator, the
+  // full separator is forseen for daughters.  This separator is not
+  // only created--it is also put in a dictionary for future use by
+  // the leaf part.
+
+  // For leaf parts, we first locate the mother volume and find its
+  // separator through the dictionary.
+
+  // The private member fCurrentSeparator is set to the proper
+  // location on in the scene database so that when the solid is
+  // actually added (in addthis), it is put in the right place.
+
+  G4PhysicalVolumeModel* pPVModel =
+    dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
+  
+  if (pPVModel) {
+
+    // This call comes from a G4PhysicalVolumeModel.  drawnPVPath is
+    // the path of the current drawn (non-culled) volume in terms of
+    // drawn (non-culled) ancesters.  Each node is identified by a
+    // PVNodeID object, which is a physical volume and copy number.  It
+    // is a vector of PVNodeIDs corresponding to the geometry hierarchy
+    // actually selected, i.e., not culled.
+    typedef G4PhysicalVolumeModel::G4PhysicalVolumeNodeID PVNodeID;
+    typedef std::vector<PVNodeID> PVPath;
+    const PVPath& drawnPVPath = pPVModel->GetDrawnPVPath();
+    //G4int currentDepth = pPVModel->GetCurrentDepth();
+    G4VPhysicalVolume* pCurrentPV = pPVModel->GetCurrentPV();
+    G4LogicalVolume* pCurrentLV = pPVModel->GetCurrentLV();
+    //G4Material* pCurrentMaterial = pPVModel->GetCurrentMaterial();
+    // Note: pCurrentMaterial may be zero (parallel world).
+
+    // The simplest algorithm, used by the Open Inventor Driver
+    // developers, is to rely on the fact the G4PhysicalVolumeModel
+    // traverses the geometry hierarchy in an orderly manner.  The last
+    // mother, if any, will be the node to which the volume should be
+    // added.  So it is enough to keep a map of scene graph nodes keyed
+    // on the volume path ID.  Actually, it is enough to use the logical
+    // volume as the key.  (An alternative would be to keep the PVNodeID
+    // in the tree and match the PVPath from the root down.)
+
+    // Find mother.  ri points to mother, if any...
+    PVPath::const_reverse_iterator ri;
+    G4LogicalVolume* MotherVolume = 0;
+    ri = ++drawnPVPath.rbegin();
+    if (ri != drawnPVPath.rend()) {
+      // This volume has a mother.
+      MotherVolume = ri->GetPhysicalVolume()->GetLogicalVolume();
+    }
+
+    if (pCurrentLV->GetNoDaughters()!=0 ||
+	pCurrentPV->IsReplicated()) {  //????Don't understand this???? JA
+      // This block of code is executed for non-leaf parts:
+
+      // Make the detector tree kit:
+      SoDetectorTreeKit* detectorTreeKit = new SoDetectorTreeKit();  
+
+      SoSeparator* previewSeparator   =  
+	(SoSeparator*) detectorTreeKit->getPart("previewSeparator",TRUE);
+      previewSeparator->renderCaching = SoSeparator::OFF;
+
+      SoSeparator* fullSeparator =  
+	(SoSeparator*) detectorTreeKit->getPart("fullSeparator",   TRUE);
+      fullSeparator->renderCaching = SoSeparator::OFF;
+
+      if(fPreviewAndFull) detectorTreeKit->setPreviewAndFull();
+      else detectorTreeKit->setPreview(TRUE);
+
+      // Colour, etc., for SoDetectorTreeKit.  Treated differently to
+      // othere SoNodes(?).  Use fpVisAttribs stored away in
+      // PreAddSolid...
+      const G4VisAttributes* pApplicableVisAttribs =
+	fpViewer->GetApplicableVisAttributes (fpVisAttribs);
+
+      // First find the color attributes...
+      const G4Colour& g4Col =  pApplicableVisAttribs->GetColour ();
+      const double red = g4Col.GetRed ();
+      const double green = g4Col.GetGreen ();
+      const double blue = g4Col.GetBlue ();
+      double transparency = 1 - g4Col.GetAlpha();
+
+      // Drawing style...
+      G4ViewParameters::DrawingStyle drawing_style =
+	GetDrawingStyle(pApplicableVisAttribs);
+      switch (drawing_style) {
+      case (G4ViewParameters::wireframe):    
+	fModelingSolid = false;
+	break;
+      case (G4ViewParameters::hlr):
+      case (G4ViewParameters::hsr):
+      case (G4ViewParameters::hlhsr):
+	fModelingSolid = true;
+	break;
+      }
+
+      SoMaterial* material = 
+	fStyleCache->getMaterial((float)red,
+				 (float)green,
+				 (float)blue,
+				 (float)transparency);
+      detectorTreeKit->setPart("appearance.material",material);
+
+      SoLightModel* lightModel = 
+	fModelingSolid ? fStyleCache->getLightModelPhong() : 
+	fStyleCache->getLightModelBaseColor();
+      detectorTreeKit->setPart("appearance.lightModel",lightModel);
+
+      // Add the full separator to the dictionary; it is indexed by the 
+      // address of the logical volume!
+      fSeparatorMap[pCurrentLV] = fullSeparator;
+
+      // Find out where to add this volume.
+      // If no mother can be found, it goes under root.
+      if (MotherVolume) {
+	if (fSeparatorMap.find(MotherVolume) != fSeparatorMap.end()) {
+	  //printf("debug : PreAddSolid : mother %s found in map\n",
+	  //     MotherVolume->GetName().c_str());
+	  fSeparatorMap[MotherVolume]->addChild(detectorTreeKit);
+	} else {
+	  // Mother not previously encountered.  Shouldn't happen, since
+	  // G4PhysicalVolumeModel sends volumes as it encounters them,
+	  // i.e., mothers before daughters, in its descent of the
+	  // geometry tree.  Error!
+	  G4cout <<
+	    "ERROR: G4OpenInventorSceneHandler::GeneratePrerequisites: Mother "
+		 << ri->GetPhysicalVolume()->GetName()
+		 << ':' << ri->GetCopyNo()
+		 << " not previously encountered."
+	    "\nShouldn't happen!  Please report to visualization coordinator."
+		 << G4endl;
+	  // Continue anyway.  Add to root of scene graph tree...
+	  //printf("debug : PreAddSolid : mother %s not found in map !!!\n",
+	  //     MotherVolume->GetName().c_str());
+	  fDetectorRoot->addChild(detectorTreeKit);
+	}
+      } else {
+	//printf("debug : PreAddSolid : has no mother\n");
+	fDetectorRoot->addChild(detectorTreeKit);
+      }
+
+      fCurrentSeparator = previewSeparator;
+
+    } else {
+      // This block of code is executed for leaf parts.
+
+      if (MotherVolume) {
+	if (fSeparatorMap.find(MotherVolume) != fSeparatorMap.end()) {
+	  fCurrentSeparator = fSeparatorMap[MotherVolume];
+	} else {
+	  // Mother not previously encountered.  Shouldn't happen, since
+	  // G4PhysicalVolumeModel sends volumes as it encounters them,
+	  // i.e., mothers before daughters, in its descent of the
+	  // geometry tree.  Error!
+	  G4cout << "ERROR: G4OpenInventorSceneHandler::PreAddSolid: Mother "
+		 << ri->GetPhysicalVolume()->GetName()
+		 << ':' << ri->GetCopyNo()
+		 << " not previously encountered."
+	    "\nShouldn't happen!  Please report to visualization coordinator."
+		 << G4endl;
+	  // Continue anyway.  Add to root of scene graph tree...
+	  fCurrentSeparator = fDetectorRoot;
+	}
+      } else {
+	fCurrentSeparator = fDetectorRoot;
+      }
+    }
+
+  } else {
+    // Not from G4PhysicalVolumeModel, so add to root as leaf part...
+
+    if (fReadyForTransients) {
+      fCurrentSeparator = fTransientRoot;
+    } else {
+      fCurrentSeparator = fDetectorRoot;
+    }
+  }
+}
+
+void G4OpenInventorSceneHandler::AddProperties(const G4VisAttributes* visAtts)
+{
+  // Use the applicable vis attributes...
+  const G4VisAttributes* pApplicableVisAttribs =
+    fpViewer->GetApplicableVisAttributes (visAtts);
+
+  // First find the color attributes...
+  const G4Colour& g4Col =  pApplicableVisAttribs->GetColour ();
+  const double red = g4Col.GetRed ();
+  const double green = g4Col.GetGreen ();
+  const double blue = g4Col.GetBlue ();
+  double transparency = 1 - g4Col.GetAlpha();
+
+  // Drawing style...
+  G4ViewParameters::DrawingStyle drawing_style =
+    GetDrawingStyle(pApplicableVisAttribs);
+  switch (drawing_style) {
+  case (G4ViewParameters::wireframe):    
+    fModelingSolid = false;
+    break;
+  case (G4ViewParameters::hlr):
+  case (G4ViewParameters::hsr):
+  case (G4ViewParameters::hlhsr):
+    fModelingSolid = true;
+    break;
+  }
+
+  // Edge visibility...
+  G4bool isAuxEdgeVisible = GetAuxEdgeVisible (pApplicableVisAttribs);
+  fReducedWireFrame = !isAuxEdgeVisible;
+
+  SoMaterial* material = 
+    fStyleCache->getMaterial((float)red,
+			     (float)green,
+			     (float)blue,
+			     (float)transparency);
+  fCurrentSeparator->addChild(material);
+
+  SoLightModel* lightModel = 
+    fModelingSolid ? fStyleCache->getLightModelPhong() : 
+    fStyleCache->getLightModelBaseColor();
+  fCurrentSeparator->addChild(lightModel);
+
+  // Set up the geometrical transformation for the coming 
+  fCurrentSeparator->addChild(fStyleCache->getResetTransform());
+
+  SoMatrixTransform* matrixTransform = new SoMatrixTransform;
+  G4OpenInventorTransform3D oiTran(*fpObjectTransformation);
+  SbMatrix* sbMatrix = oiTran.GetSbMatrix();
+
+  const G4Vector3D scale = fpViewer->GetViewParameters().GetScaleFactor();
+  SbMatrix sbScale;
+  sbScale.setScale
+    (SbVec3f((float)scale.x(),(float)scale.y(),(float)scale.z()));
+  sbMatrix->multRight(sbScale);
+
+  matrixTransform->matrix.setValue(*sbMatrix);
+  delete sbMatrix;
+  fCurrentSeparator->addChild(matrixTransform);
+}
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/src/G4OpenInventorTransform3D.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/src/G4OpenInventorTransform3D.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/src/G4OpenInventorTransform3D.cc	(revision 1102)
@@ -0,0 +1,73 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenInventorTransform3D.cc,v 1.8 2006/06/29 21:22:16 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// jck 17 Dec 1996
+// G4OpenInventorTransform3D provides OpenGL style transformation matrix
+// from G4Transform3D.
+// gb 22 Nov 2004 : use SbMatrix instead of SoSFMatrix.
+
+#ifdef G4VIS_BUILD_OI_DRIVER
+
+// this :
+#include "G4OpenInventorTransform3D.hh"
+
+#include <Inventor/SbLinear.h>
+
+G4OpenInventorTransform3D::G4OpenInventorTransform3D (const G4Transform3D &t) 
+: G4Transform3D (t) {
+#define elem(i,j) ((float)t(i,j))
+  m[0]  = elem(0,0); //xx
+  m[1]  = elem(1,0); //yx
+  m[2]  = elem(2,0); //zx
+  m[3]  = 0;
+  m[4]  = elem(0,1); //xy
+  m[5]  = elem(1,1); //yy
+  m[6]  = elem(2,1); //zy
+  m[7]  = 0;
+  m[8]  = elem(0,2); //xz
+  m[9]  = elem(1,2); //yz
+  m[10] = elem(2,2); //zz
+  m[11] = 0;
+  m[12] = elem(0,3); //dx
+  m[13] = elem(1,3); //dy
+  m[14] = elem(2,3); //dz
+  m[15] = 1;
+#undef elem
+}
+
+SbMatrix* G4OpenInventorTransform3D::GetSbMatrix () const {
+  SbMatrix* tm = new SbMatrix(m[0],m[1],m[2],m[3],
+                              m[4],m[5],m[6],m[7],
+                              m[8],m[9],m[10],m[11],
+                              m[12],m[13],m[14],m[15]);
+  return tm;
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/src/G4OpenInventorViewer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/src/G4OpenInventorViewer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/src/G4OpenInventorViewer.cc	(revision 1102)
@@ -0,0 +1,731 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4OpenInventorViewer.cc,v 1.60 2009/02/16 15:31:05 lgarnier Exp $
+// GEANT4 tag $Name:  $
+
+#ifdef G4VIS_BUILD_OI_DRIVER
+
+// this :
+#include "G4OpenInventorViewer.hh"
+
+#include <Inventor/nodes/SoSelection.h>
+#include <Inventor/nodes/SoShape.h>
+#include <Inventor/nodes/SoOrthographicCamera.h>
+#include <Inventor/nodes/SoPerspectiveCamera.h>
+#include <Inventor/actions/SoCallbackAction.h>
+#include <Inventor/actions/SoWriteAction.h>
+#include <Inventor/sensors/SoNodeSensor.h>
+
+#include "HEPVis/nodes/SoImageWriter.h"
+#include "HEPVis/actions/SoGL2PSAction.h"
+#include "HEPVis/actions/SoCounterAction.h"
+#include "HEPVis/actions/SoAlternateRepAction.h"
+
+#include "G4OpenInventor.hh"
+#include "G4OpenInventorSceneHandler.hh"
+#include "G4VInteractorManager.hh"
+#include "G4Scene.hh"
+#include "Geant4_SoPolyhedron.h"
+#include "G4AttValue.hh"
+#include "G4AttDef.hh"
+#include "G4AttCheck.hh"
+#include "G4AttHolder.hh"
+
+G4OpenInventorViewer::G4OpenInventorViewer(
+ G4OpenInventorSceneHandler& sceneHandler
+,const G4String& name)
+:G4VViewer(sceneHandler, sceneHandler.IncrementViewCount(), name)
+,fG4OpenInventorSceneHandler(sceneHandler)
+,fInteractorManager(0)
+,fSoSelection(0)
+,fSoImageWriter(0)
+,fGL2PSAction(0) //To be set be suclass.
+,fGroupCameraSensor(0)
+,fCameraSensor(0)
+{
+  fNeedKernelVisit = true;  //?? Temporary, until KernelVisitDecision fixed.
+
+  fVP.SetAutoRefresh(true);
+  fDefaultVP.SetAutoRefresh(true);
+  fVP.SetPicking(true);
+  fDefaultVP.SetPicking(true);
+
+  //FIXME : G.Barrand : not convinced that we have to rm culling.
+  // For viewing of all objects by default :
+  //fDefaultVP.SetCulling(false);
+  //fVP.SetCulling(false);
+
+  fInteractorManager = 
+    ((G4OpenInventor*)fG4OpenInventorSceneHandler.GetGraphicsSystem())->
+    GetInteractorManager();
+
+  // Main user scene graph root sent to the viewers.
+  fSoSelection = new SoSelection;
+  fSoSelection->ref();
+  fSoSelection->addSelectionCallback(SelectionCB,this);
+  //fSoSelection->addDeselectionCallback(DeselectionCB,this);
+  fSoSelection->policy = SoSelection::SINGLE;
+
+  SoGroup* group = new SoGroup;
+  fSoSelection->addChild(group);
+
+  //  Have a camera under fSoSelection in order
+  // that the below SceneGraphSensor be notifed
+  // when the viewer changes the camera type.
+  //  But we put the camera under a SoGroup so that
+  // the SceneGraphSensor be not triggered at each change
+  // under the fG4OpenInventorSceneHandler.fRoot.
+  SoOrthographicCamera* camera = new SoOrthographicCamera;
+  camera->viewportMapping.setValue(SoCamera::ADJUST_CAMERA);
+  //camera->aspectRatio.setValue(10);
+  camera->position.setValue(0,0,10);
+  camera->orientation.setValue(SbRotation(SbVec3f(0,1,0),0));
+  camera->height.setValue(10);
+  camera->nearDistance.setValue(1);
+  camera->farDistance.setValue(100);
+  camera->focalDistance.setValue(10);
+  group->addChild(camera);
+
+ {SoInput soInput;
+   if(soInput.openFile("g4view.iv",TRUE)) {
+    SoSeparator* separator = SoDB::readAll(&soInput);
+    if(separator) fSoSelection->addChild(separator);
+  }}
+
+  fSoSelection->addChild(fG4OpenInventorSceneHandler.fRoot);
+
+  // SoImageWriter should be the last.
+  fSoImageWriter = new SoImageWriter();
+  fSoImageWriter->fileName.setValue("g4out.ps");
+  fSoSelection->addChild(fSoImageWriter);
+
+  // Sensors :
+  // To detect that the viewer had changed the camera type :
+  fGroupCameraSensor = new SoNodeSensor(GroupCameraSensorCB,this);
+  fGroupCameraSensor->setPriority(0);//Needed in order to do getTriggerNode()
+  fGroupCameraSensor->attach(group);
+
+  fCameraSensor = new SoNodeSensor(CameraSensorCB,this);
+  fCameraSensor->setPriority(0);//Needed in order to do getTriggerNode()
+}
+
+G4OpenInventorViewer::~G4OpenInventorViewer () {
+  fCameraSensor->detach();
+  delete fCameraSensor;
+  fGroupCameraSensor->detach();
+  delete fGroupCameraSensor;
+  fSoSelection->unref();
+}
+
+void G4OpenInventorViewer::KernelVisitDecision () {
+  
+  // If there's a significant difference with the last view parameters
+  // of either the scene handler or this viewer, trigger a rebuild.
+
+  if (
+      //??fG4OpenInventorSceneHandler.fPODLList.size() == 0 ||
+      // We need a test for empty scene graph, such as
+      // staticRoot.size() or something??????????  See temporary fix
+      // in contructor.  (John Allison Aug 2001)
+      CompareForKernelVisit(fLastVP)) {
+    NeedKernelVisit ();
+  }      
+  fLastVP = fVP;
+}
+ 
+G4bool G4OpenInventorViewer::CompareForKernelVisit(G4ViewParameters& vp) {
+
+  if (
+      (vp.GetDrawingStyle ()    != fVP.GetDrawingStyle ())    ||
+      (vp.IsAuxEdgeVisible ()   != fVP.IsAuxEdgeVisible ())   ||
+      (vp.GetRepStyle ()        != fVP.GetRepStyle ())        ||
+      (vp.IsCulling ()          != fVP.IsCulling ())          ||
+      (vp.IsCullingInvisible () != fVP.IsCullingInvisible ()) ||
+      (vp.IsDensityCulling ()   != fVP.IsDensityCulling ())   ||
+      (vp.IsCullingCovered ()   != fVP.IsCullingCovered ())   ||
+      (vp.IsSection ()          != fVP.IsSection ())          ||
+      (vp.IsCutaway ()          != fVP.IsCutaway ())          ||
+      // This assumes use of generic clipping (sectioning, slicing,
+      // DCUT, cutaway).  If a decision is made to implement locally,
+      // this will need changing.  See G4OpenGLViewer::SetView,
+      // G4OpenGLStoredViewer.cc::CompareForKernelVisit and
+      // G4OpenGLStoredSceneHander::CreateSection/CutawayPolyhedron.
+      (vp.IsExplode ()          != fVP.IsExplode ())          ||
+      (vp.GetNoOfSides ()       != fVP.GetNoOfSides ())       ||
+      (vp.IsMarkerNotHidden ()  != fVP.IsMarkerNotHidden ())  ||
+      (vp.GetBackgroundColour ()!= fVP.GetBackgroundColour ())||
+      (vp.IsPicking ()          != fVP.IsPicking ())          ||
+      // Scaling for Open Inventor is done by the scene handler so it
+      // needs a kernel visit.  (In this respect, it differs from the
+      // OpenGL drivers, where it's done in SetView.)
+      (vp.GetScaleFactor ()     != fVP.GetScaleFactor ())
+      )
+    return true;
+
+  if (vp.IsDensityCulling () &&
+      (vp.GetVisibleDensity () != fVP.GetVisibleDensity ()))
+    return true;
+
+  if (vp.IsSection () &&
+      (vp.GetSectionPlane () != fVP.GetSectionPlane ()))
+    return true;
+
+  if (vp.IsCutaway ()) {
+    if (vp.GetCutawayPlanes ().size () !=
+	fVP.GetCutawayPlanes ().size ()) return true;
+    for (size_t i = 0; i < vp.GetCutawayPlanes().size(); ++i)
+      if (vp.GetCutawayPlanes()[i] != fVP.GetCutawayPlanes()[i])
+	return true;
+  }
+
+  if (vp.IsExplode () &&
+      (vp.GetExplodeFactor () != fVP.GetExplodeFactor ()))
+    return true;
+      
+  return false;
+}
+
+void G4OpenInventorViewer::ClearView () {
+}
+
+void G4OpenInventorViewer::SetView () {
+
+  // Get G4 camera infos :
+  const G4Point3D target
+    = fSceneHandler.GetScene()->GetStandardTargetPoint()
+    + fVP.GetCurrentTargetPoint ();
+  G4double radius = fSceneHandler.GetScene()->GetExtent().GetExtentRadius();
+  if(radius<=0.) radius = 1.;
+  const G4double cameraDistance = fVP.GetCameraDistance (radius);
+  const G4Vector3D& direction = fVP.GetViewpointDirection().unit();
+  const G4Point3D cameraPosition = target + cameraDistance * direction;
+  //const G4double pnear = fVP.GetNearDistance (cameraDistance, radius);
+  //const G4double pfar  = fVP.GetFarDistance  (cameraDistance, pnear, radius);
+  const G4Normal3D& up = fVP.GetUpVector ();  
+
+/*
+  printf("debug : target : %g %g %g\n",target.x(),
+                                       target.y(),
+                                       target.z());
+  printf("debug : dir : %g %g %g\n",direction.x(),
+                                    direction.y(),
+                                    direction.z());
+  printf("debug : pos : %g %g %g\n",cameraPosition.x(),
+                                    cameraPosition.y(),
+                                    cameraPosition.z());
+  //printf("debug : near %g far %g\n",pnear,pfar);
+*/
+
+  SoCamera* camera = GetCamera();
+  if(!camera) return;
+
+  // viewer camera setup :
+  camera->position.setValue((float)cameraPosition.x(),
+                               (float)cameraPosition.y(),
+                               (float)cameraPosition.z());
+
+  SbVec3f sbTarget((float)target.x(),
+                   (float)target.y(),
+                   (float)target.z());
+  SbVec3f sbUp((float)up.x(),
+	       (float)up.y(),
+	       (float)up.z());
+  sbUp.normalize();
+  // Need Coin's camera->pointAt(sbTarget,sbUp); not in the SGI API
+  // Stole Coin's code...
+  pointAt(camera,sbTarget,sbUp);
+
+  //camera->height.setValue(10);
+  //camera->nearDistance.setValue((float)pnear);
+  //camera->farDistance.setValue((float)pfar);
+  //camera->focalDistance.setValue((float)cameraDistance);
+
+  if(camera->isOfType(SoOrthographicCamera::getClassTypeId())) {
+    if (fVP.GetFieldHalfAngle() == 0.) {
+      //FIXME : ((SoOrthographicCamera*)camera)->height.setValue();
+      //FIXME : (Don't think we have to do that.)
+    } else {
+      //FIXME : Have to set a perspective camera !
+      //FIXME : viewer->setCameraType(SoPerspectiveCamera::getClassTypeId())
+      //FIXME : ((SoPerspectiveCamera*)camera)->heightAngle.setValue
+      //FIXME :   (2.*fVP.GetFieldHalfAngle());
+    }
+  } else if(camera->isOfType(SoPerspectiveCamera::getClassTypeId())) {
+    if (fVP.GetFieldHalfAngle() == 0.) {
+      //FIXME : Have to set an orthographic camera !
+      //FIXME : viewer->setCameraType(SoOrthographicCamera::getClassTypeId())
+    } else {
+      //FIXME : ((SoPerspectiveCamera*)camera)->heightAngle.setValue
+      //FIXME :   (2.*fVP.GetFieldHalfAngle());
+    }
+  }
+}
+
+//COIN_FUNCTION_EXTENSION
+void
+G4OpenInventorViewer::pointAt(SoCamera* camera,const SbVec3f & targetpoint, const SbVec3f & upvector)
+{
+  SbVec3f dir = targetpoint - camera->position.getValue();
+  if (dir.normalize() == 0.0f) return;
+  lookAt(camera,dir, upvector);
+}
+
+//COIN_FUNCTION
+// Private method that calculates a new orientation based on camera
+// direction and camera up vector. Vectors must be unit length.
+void
+G4OpenInventorViewer::lookAt(SoCamera* camera,const SbVec3f & dir, const SbVec3f & up)
+{
+  SbVec3f z = -dir;
+  SbVec3f y = up;
+  SbVec3f x = y.cross(z);
+
+  // recompute y to create a valid coordinate system
+  y = z.cross(x);
+
+  // normalize x and y to create an orthonormal coord system
+  y.normalize();
+  x.normalize();
+
+  // create a rotation matrix
+  SbMatrix rot = SbMatrix::identity();
+  rot[0][0] = x[0];
+  rot[0][1] = x[1];
+  rot[0][2] = x[2];
+
+  rot[1][0] = y[0];
+  rot[1][1] = y[1];
+  rot[1][2] = y[2];
+
+  rot[2][0] = z[0];
+  rot[2][1] = z[1];
+  rot[2][2] = z[2];
+
+  camera->orientation.setValue(SbRotation(rot));
+}
+
+void
+G4OpenInventorViewer::lookedAt(SoCamera* camera,SbVec3f & dir, SbVec3f & up)
+{
+  SbRotation rot = camera->orientation.getValue();
+  SbMatrix mrot; rot.getValue(mrot);
+
+  SbVec3f x, y, z;
+
+  // create a rotation matrix
+  x[0] = mrot[0][0];
+  x[1] = mrot[0][1];
+  x[2] = mrot[0][2];
+
+  y[0] = mrot[1][0];
+  y[1] = mrot[1][1];
+  y[2] = mrot[1][2];
+
+  z[0] = mrot[2][0];
+  z[1] = mrot[2][1];
+  z[2] = mrot[2][2];
+
+  dir = -z;
+  dir.normalize();
+  up = SbVec3f(0.f,1.f,0.f);  // Choose y-axis if possible.
+  if (std::abs(up.dot(z)) > 1.e-6) {
+    up = y;
+    up.normalize();
+  }
+}
+
+void G4OpenInventorViewer::DrawView () {
+  //G4cout << "debug Iv::DrawViewer " <<G4endl;
+  if (!fNeedKernelVisit) KernelVisitDecision();
+  ProcessView();
+  FinishView();
+}
+
+void G4OpenInventorViewer::ShowView () {
+  fInteractorManager -> SecondaryLoop ();
+}
+
+void G4OpenInventorViewer::GroupCameraSensorCB(void* aThis,SoSensor* aSensor){ 
+  G4OpenInventorViewer* This = (G4OpenInventorViewer*)aThis;
+
+  SoNode* node = ((SoNodeSensor*)aSensor)->getTriggerNode();
+  //printf("debug : GroupCameraSensorCB %s\n",
+  //node->getTypeId().getName().getString());
+
+  if(node->isOfType(SoCamera::getClassTypeId())) {
+    // Viewer had changed the camera type, 
+    // attach the fCameraSensor to the new camera.
+    SoCamera* camera = (SoCamera*)node;
+    This->fCameraSensor->detach();
+    This->fCameraSensor->attach(camera);
+  }
+
+}
+
+void G4OpenInventorViewer::CameraSensorCB(void* aThis,SoSensor* aSensor) { 
+  G4OpenInventorViewer* This = (G4OpenInventorViewer*)aThis;
+
+  //printf("debug : CameraSensorCB\n");
+
+  SoNode* node = ((SoNodeSensor*)aSensor)->getTriggerNode();
+
+  if(node->isOfType(SoCamera::getClassTypeId())) {
+    SoCamera* camera = (SoCamera*)node;
+
+    SbVec3f direction, up;
+    lookedAt(camera,direction, up);
+    This->fVP.SetViewpointDirection
+      (G4Vector3D(-direction[0],-direction[1],-direction[2]));
+    This->fVP.SetUpVector(G4Vector3D(up[0],up[1],up[2]));
+
+    SbVec3f pos = camera->position.getValue();
+    SbVec3f target = pos + direction * camera->focalDistance.getValue();
+
+    This->fVP.SetCurrentTargetPoint(G4Point3D(target[0],target[1],target[2]));
+  }
+}
+
+void G4OpenInventorViewer::SelectionCB(
+ void* aThis
+,SoPath* aPath
+) 
+{
+  G4OpenInventorViewer* This = (G4OpenInventorViewer*)aThis;
+  SoNode* node = ((SoFullPath*)aPath)->getTail();
+  G4AttHolder* attHolder = dynamic_cast<G4AttHolder*>(node);
+  if(attHolder && attHolder->GetAttDefs().size()) {
+    for (size_t i = 0; i < attHolder->GetAttDefs().size(); ++i) {
+      G4cout << G4AttCheck(attHolder->GetAttValues()[i],
+			   attHolder->GetAttDefs()[i]);
+    }
+  } else {
+    G4String name((char*)node->getName().getString());
+    G4String cls((char*)node->getTypeId().getName().getString());
+    G4cout << "SoNode : " << node 
+	   << " SoType : " << cls 
+	   << " name : " << name 
+	   << G4endl;
+    G4cout << "No attributes attached." << G4endl;
+  }
+  /*FIXME : to explore (need different button - this is used for picking.
+  if(node->isOfType(Geant4_SoPolyhedron::getClassTypeId())) {
+    Geant4_SoPolyhedron* polyhedron = (Geant4_SoPolyhedron*)node;
+    if(polyhedron->solid.getValue()==FALSE)
+      polyhedron->solid.setValue(TRUE);
+    else
+      polyhedron->solid.setValue(FALSE);
+  }*/
+  This->fSoSelection->deselectAll();
+}
+/*
+void G4OpenInventorViewer::DeselectionCB(
+ void* aThis
+,SoPath* aPath
+) 
+{
+  //G4OpenInventorViewer* This = (G4OpenInventorViewer*)aThis;
+  G4String name((char*)aPath->getTail()->getTypeId().getName().getString());
+  G4cout << "Deselect : " << name << G4endl;
+}
+*/
+
+void G4OpenInventorViewer::DrawDetector() {
+  /* Replace this... - JA
+  // DrawView does a ClearStore. Do not clear the transient store :
+  SoSeparator* tmp = fG4OpenInventorSceneHandler.fTransientRoot;
+  fG4OpenInventorSceneHandler.fTransientRoot = new SoSeparator;
+  if (!fNeedKernelVisit) KernelVisitDecision();
+  ProcessView();
+  fG4OpenInventorSceneHandler.fTransientRoot->unref();
+  fG4OpenInventorSceneHandler.fTransientRoot = tmp;
+  */
+  // ...by this... - JA
+  DrawView();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+/// Menu items callbacks /////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+
+void G4OpenInventorViewer::Escape(){
+  G4cout << "Escape..." <<G4endl;
+  fInteractorManager->RequireExitSecondaryLoop (OIV_EXIT_CODE);
+}
+
+void G4OpenInventorViewer::WritePostScript(const G4String& aFile) {
+#ifdef G4DEBUG_VIS_OI
+  printf("G4OpenInventorViewer::WritePostScript %s\n",aFile.c_str());
+#endif
+  if(!fGL2PSAction) return;
+  fGL2PSAction->setFileName(aFile.c_str());
+  G4cout << "Produce " << aFile << "..." << G4endl;
+  if (fGL2PSAction->enableFileWriting()) {
+#ifdef G4DEBUG_VIS_OI
+    printf("G4OpenInventorViewer::WritePostScript produce OK\n");
+#endif
+    ViewerRender();
+    fGL2PSAction->disableFileWriting();
+  }
+}
+
+void G4OpenInventorViewer::WritePixmapPostScript(const G4String& aFile) {
+#ifdef G4DEBUG_VIS_OI
+  printf("G4OpenInventorViewer::WritePixmapPostScript %s\n",aFile.c_str());
+#endif
+
+  fSoImageWriter->fileName.setValue(aFile.c_str());
+  //imageWriter->format.setValue(SoImageWriter::POST_SCRIPT);
+  fSoImageWriter->enable();
+  ViewerRender();
+  fSoImageWriter->disable();
+  if(fSoImageWriter->getStatus()) {
+    G4cout << G4String(fSoImageWriter->fileName.getValue().getString()) 
+           << " produced."
+           << G4endl;
+  } else {
+    G4cout << G4String(fSoImageWriter->fileName.getValue().getString()) 
+           << " not produced."
+           << G4endl;
+  }
+#ifdef G4DEBUG_VIS_OI
+  printf("G4OpenInventorViewer::WritePixmapPostScript END\n");
+#endif
+}  
+
+void G4OpenInventorViewer::WriteInventor(const G4String& aFile) {
+  G4cout << "Produce " << aFile << "..." << G4endl;
+
+  SbBool genAlternateRep = TRUE;
+  //SbBool binary = FALSE;
+  SbBool binary = TRUE;
+  SoAlternateRepAction alternateRepAction;
+  if(genAlternateRep==TRUE) {
+    alternateRepAction.setGenerate(TRUE); //Clear alternate reps.
+    alternateRepAction.apply(fSoSelection);
+  }
+
+  SoWriteAction writeAction;
+  writeAction.getOutput()->openFile(aFile.c_str());
+  writeAction.getOutput()->setBinary(binary);
+  writeAction.apply(fSoSelection);
+  writeAction.getOutput()->closeFile();
+
+  if(genAlternateRep==TRUE) {
+    alternateRepAction.setGenerate(FALSE); //Clear alternate reps.
+    alternateRepAction.apply(fSoSelection);
+  }
+
+
+
+}
+
+struct Counter {
+ int fTriangles;
+ int fLineSegments;
+ int fPoints;
+};
+
+static void CountTrianglesCB(
+ void* userData
+,SoCallbackAction*
+,const SoPrimitiveVertex*
+,const SoPrimitiveVertex*,
+const SoPrimitiveVertex*)
+{
+  Counter* counter = (Counter*)userData;
+  counter->fTriangles++;
+}
+
+static void CountLineSegmentsCB(
+ void* userData
+,SoCallbackAction*
+,const SoPrimitiveVertex*
+,const SoPrimitiveVertex*)
+{
+  Counter* counter = (Counter*)userData;
+  counter->fLineSegments++;
+}
+
+static void CountPointsCB(
+ void* userData
+,SoCallbackAction*
+,const SoPrimitiveVertex*)
+{
+  Counter* counter = (Counter*)userData;
+  counter->fPoints++;
+}
+
+void G4OpenInventorViewer::SceneGraphStatistics() {
+  Counter counter;
+  counter.fTriangles = 0;
+  counter.fLineSegments = 0;
+  counter.fPoints = 0;
+
+  SoCallbackAction callbackAction;
+  callbackAction.addTriangleCallback
+    (SoShape::getClassTypeId(),CountTrianglesCB,(void*)&counter);
+  callbackAction.addLineSegmentCallback
+    (SoShape::getClassTypeId(),CountLineSegmentsCB,(void*)&counter);
+  callbackAction.addPointCallback
+    (SoShape::getClassTypeId(),CountPointsCB,(void*)&counter);
+  callbackAction.apply(fSoSelection);
+
+  SoCounterAction counterAction;
+  counterAction.apply(fSoSelection);
+  int nodes = counterAction.getCount();
+
+  counterAction.setLookFor(SoCounterAction::TYPE);
+  counterAction.setType(SoShape::getClassTypeId());
+  counterAction.apply(fSoSelection);
+  int shapes = counterAction.getCount();
+
+  G4cout << "Number of triangles : " << counter.fTriangles << G4endl;
+  G4cout << "Number of line segments : " << counter.fLineSegments << G4endl;
+  G4cout << "Number of points : " << counter.fPoints << G4endl;
+  G4cout << "Number of nodes : " << nodes << G4endl;
+  G4cout << "Number of shapes : " << shapes << G4endl;
+}
+
+void G4OpenInventorViewer::EraseDetector() {
+  fG4OpenInventorSceneHandler.fDetectorRoot->removeAllChildren();
+}
+void G4OpenInventorViewer::EraseEvent() {
+  fG4OpenInventorSceneHandler.fTransientRoot->removeAllChildren();
+}
+
+void G4OpenInventorViewer::SetPreviewAndFull() {
+  fG4OpenInventorSceneHandler.fPreviewAndFull = true;
+
+  NeedKernelVisit();
+  DrawDetector();
+}
+
+void G4OpenInventorViewer::SetPreview() {
+  fG4OpenInventorSceneHandler.fPreviewAndFull = false;
+
+  NeedKernelVisit();
+  DrawDetector();
+}
+
+// When ViewParameter <-> SoCamera mapping ready 
+// uncomment the below
+//#define USE_SET_VIEW
+
+void G4OpenInventorViewer::SetSolid() {
+  G4ViewParameters vp = GetViewParameters();
+  G4ViewParameters::DrawingStyle existingStyle = vp.GetDrawingStyle();
+  //From G4VisCommandsViewerSet : /vis/viewer/set/style solid.
+  switch (existingStyle) {
+  case G4ViewParameters::wireframe:
+    vp.SetDrawingStyle(G4ViewParameters::hsr);
+    break;
+  case G4ViewParameters::hlr:
+    vp.SetDrawingStyle(G4ViewParameters::hlhsr);
+    break;
+  case G4ViewParameters::hsr:
+    break;
+  case G4ViewParameters::hlhsr:
+    break;
+  }
+  SetViewParameters(vp);
+  DrawDetector();
+}
+void G4OpenInventorViewer::SetWireFrame() {
+  G4ViewParameters vp = GetViewParameters();
+  G4ViewParameters::DrawingStyle existingStyle = vp.GetDrawingStyle();
+  switch (existingStyle) {
+  case G4ViewParameters::wireframe:
+    break;
+  case G4ViewParameters::hlr:
+    break;
+  case G4ViewParameters::hsr:
+    vp.SetDrawingStyle(G4ViewParameters::wireframe);
+    break;
+  case G4ViewParameters::hlhsr:
+    vp.SetDrawingStyle(G4ViewParameters::hlr);
+    break;
+  }
+  SetViewParameters(vp);
+  DrawDetector();
+}
+
+
+void G4OpenInventorViewer::SetReducedWireFrame(bool aValue) {
+  G4ViewParameters vp = GetViewParameters();
+
+  // Set the wire frame kind :
+  vp.SetAuxEdgeVisible(!aValue);
+
+  // Set wire frame :
+  G4ViewParameters::DrawingStyle existingStyle = vp.GetDrawingStyle();
+  switch (existingStyle) {
+  case G4ViewParameters::wireframe:
+    break;
+  case G4ViewParameters::hlr:
+    break;
+  case G4ViewParameters::hsr:
+    vp.SetDrawingStyle(G4ViewParameters::wireframe);
+    break;
+  case G4ViewParameters::hlhsr:
+    vp.SetDrawingStyle(G4ViewParameters::hlr);
+    break;
+  }
+  SetViewParameters(vp);
+  NeedKernelVisit(); // Just in case it was alread in wire framw.
+  DrawDetector();
+}
+
+void G4OpenInventorViewer::UpdateScene() {
+  /* Replace this... - JA
+  fG4OpenInventorSceneHandler.ClearStore();
+  ClearView();
+  if (!fNeedKernelVisit) KernelVisitDecision();
+  ProcessView();
+  ShowView();
+  */
+  // ...by this - JA
+  NeedKernelVisit();
+  DrawView();
+}
+G4String G4OpenInventorViewer::Help(const G4String& aTopic) {
+  if(aTopic=="controls") {
+    return G4String("\
+Controls on an Inventor examiner viewer are :\n\
+- in picking mode (cursor is the upper left arrow)\n\
+  Ctrl + pick a volume : see daughters.\n\
+  Shift + pick a volume : see mother.\n\
+- in viewing mode (cursor is the hand)\n\
+  Left-button + pointer move : rotate.\n\
+  Ctrl+Left-button + pointer move : pan.\n\
+  Ctrl+Shift+Left-button + pointer move : scale.\n\
+  Middle-button + pointer move : pan.\n\
+  Right-button : popup menu.\n");
+  } else {
+    return "";
+  }
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/src/G4OpenInventorWin.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/src/G4OpenInventorWin.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/src/G4OpenInventorWin.cc	(revision 1102)
@@ -0,0 +1,76 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenInventorWin.cc,v 1.6 2006/06/29 21:22:20 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// OpenInventor graphics system factory.
+
+#ifdef G4VIS_BUILD_OIWIN32_DRIVER
+
+// this :
+#include "G4OpenInventorWin.hh"
+
+#include <Inventor/Win/SoWin.h>
+
+#include "G4OpenInventorSceneHandler.hh"
+#include "G4OpenInventorWinViewer.hh"
+#include "G4Win32.hh"
+
+G4OpenInventorWin::G4OpenInventorWin ()
+:G4OpenInventor("OpenInventorWin","OIWin32",G4VGraphicsSystem::threeD)
+,fInited(false)
+{
+}
+
+void G4OpenInventorWin::Initialize ()
+{
+  if(fInited) return; //Done
+
+  SetInteractorManager (G4Win32::getInstance());
+  GetInteractorManager () -> RemoveDispatcher((G4DispatchFunction)G4Win32::DispatchWin32Event);  
+
+  //  GetInteractorManager () -> AddDispatcher((G4DispatchFunction)SoWin::dispatchEvent);
+
+  HWND toplevel = (HWND)GetInteractorManager()->GetMainInteractor();
+
+  SoWin::init(toplevel);
+
+  InitNodes();
+
+  fInited = true;
+}
+
+G4OpenInventorWin::~G4OpenInventorWin () {}
+G4VViewer* G4OpenInventorWin::CreateViewer (G4VSceneHandler& scene, const G4String& name) 
+{
+  Initialize();
+  G4OpenInventorSceneHandler* pScene = (G4OpenInventorSceneHandler*)&scene;
+  return new G4OpenInventorWinViewer (*pScene, name);
+}
+
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/src/G4OpenInventorWinViewer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/src/G4OpenInventorWinViewer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/src/G4OpenInventorWinViewer.cc	(revision 1102)
@@ -0,0 +1,327 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenInventorWinViewer.cc,v 1.25 2006/06/29 21:22:22 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+/*
+ * jck : 05 Feb 1997 : Initial Implementation
+ * jck : 21 Apr 1997 : Mods for SoXtHepViewer
+ * gb : on Win32 use an SoXtExaminerViewer.
+ * gb : 05 April 2004 : creation.
+ * gb : 09 November 2004 : Pulldown menu with the escape menu item.
+ * gb 14 November 2004 : inherit G4OpenInventorViewer.
+ */
+
+#ifdef G4VIS_BUILD_OIWIN32_DRIVER
+
+// this :
+#include "G4OpenInventorWinViewer.hh"
+
+#include <Inventor/nodes/SoSelection.h>
+
+#include <Inventor/Win/SoWin.h>
+#include <Inventor/Win/viewers/SoWinExaminerViewer.h>
+
+#include "HEPVis/actions/SoGL2PSAction.h"
+
+#include "G4OpenInventor.hh"
+#include "G4OpenInventorSceneHandler.hh"
+#include "G4VInteractorManager.hh"
+
+#include <windowsx.h>
+
+// To have sizeChanged public :
+class Geant4_SoWinExaminerViewer : public SoWinExaminerViewer {
+public:
+  Geant4_SoWinExaminerViewer(HWND parent,const char* name,SbBool embed)
+  :SoWinExaminerViewer(parent,name,embed){}
+  virtual void sizeChanged(const SbVec2s & size){
+    SoWinExaminerViewer::sizeChanged(size);
+  }
+};
+
+// File : 
+#define ID_FILE_POSTSCRIPT 1
+#define ID_FILE_PIXMAP_POSTSCRIPT 2
+#define ID_FILE_INVENTOR 3
+#define ID_FILE_ESCAPE 4
+// Etc : 
+#define ID_ETC_ERASE_DETECTOR 101
+#define ID_ETC_ERASE_EVENT 102
+#define ID_ETC_SET_SOLID 103
+#define ID_ETC_SET_WIRE_FRAME 104
+#define ID_ETC_SET_REDUCED_WIRE_FRAME 105
+#define ID_ETC_SET_FULL_WIRE_FRAME 106
+#define ID_ETC_SET_PREVIEW 107
+#define ID_ETC_SET_PREVIEW_AND_FULL 108
+#define ID_ETC_UPDATE_SCENE 109
+#define ID_ETC_STATS 110
+// Help :
+#define ID_HELP_CONTROLS 201
+
+//static void SecondaryLoopPostAction ();
+
+static const char className[] = "G4OpenInventorShellWindow";
+
+G4OpenInventorWinViewer::G4OpenInventorWinViewer(
+ G4OpenInventorSceneHandler& sceneHandler
+,const G4String& name)
+:G4OpenInventorViewer (sceneHandler, name)
+,fShell(0)
+,fViewer(0)
+{
+  G4cout << "Window name: " << fName << G4endl;
+
+}
+
+
+void G4OpenInventorWinViewer::Initialise() {
+
+  G4String wName = fName;
+
+  int width = 600;
+  int height = 600;
+
+  HWND parent = (HWND)fInteractorManager->GetParentInteractor ();
+  if(!parent) {
+    //Create a shell window :
+    G4String shellName = wName;
+    shellName += "_shell"; 
+    static SbBool done = FALSE;
+    if(done==FALSE) {
+      HBRUSH brush = (HBRUSH) GetSysColorBrush(COLOR_BTNFACE);
+      WNDCLASS wc;
+      wc.style = CS_HREDRAW | CS_VREDRAW;
+      wc.lpfnWndProc = (WNDPROC)WindowProc;
+      wc.cbClsExtra = 0;
+      wc.cbWndExtra = 0;
+      wc.hInstance = ::GetModuleHandle(0);
+      wc.hIcon = ::LoadIcon(0, IDI_APPLICATION);
+      wc.hCursor = ::LoadCursor(0, IDC_ARROW);
+      wc.hbrBackground = brush;
+      wc.lpszMenuName = className;
+      wc.lpszClassName = className;
+      ::RegisterClass(&wc);
+      done = TRUE;
+    }
+    
+    width = fVP.GetWindowSizeHintX();
+    height = fVP.GetWindowSizeHintX();
+    
+    HMENU menuBar = CreateMenu();
+
+   {HMENU casc = CreatePopupMenu();
+    ::AppendMenu(menuBar,MF_POPUP,(UINT)casc,"File");
+    ::AppendMenu(casc,MF_STRING,ID_FILE_POSTSCRIPT,"PS (gl2ps)");
+    ::AppendMenu(casc,MF_STRING,ID_FILE_PIXMAP_POSTSCRIPT,"PS (pixmap)");
+    ::AppendMenu(casc,MF_STRING,ID_FILE_INVENTOR,"IV");
+    ::AppendMenu(casc,MF_STRING,ID_FILE_ESCAPE,"Escape");}
+
+   {HMENU casc = CreatePopupMenu();
+    ::AppendMenu(menuBar,MF_POPUP,(UINT)casc,"Etc");
+    ::AppendMenu(casc,MF_STRING,ID_ETC_ERASE_DETECTOR,"Erase detector");
+    ::AppendMenu(casc,MF_STRING,ID_ETC_ERASE_EVENT,"Erase event");
+    ::AppendMenu(casc,MF_STRING,ID_ETC_SET_SOLID,"Set solid");
+    //::AppendMenu(casc,MF_STRING,ID_ETC_SET_WIRE_FRAME,"Set (G4) wire frame");
+    ::AppendMenu(casc,MF_STRING,ID_ETC_SET_REDUCED_WIRE_FRAME,
+                      "Set (G4) reduced wire frame");
+    ::AppendMenu(casc,MF_STRING,ID_ETC_SET_FULL_WIRE_FRAME,
+                      "Set (G4) full wire frame");
+    ::AppendMenu(casc,MF_STRING,ID_ETC_SET_PREVIEW,
+                      "Visible mothers + invisible daughters");
+    ::AppendMenu(casc,MF_STRING,ID_ETC_SET_PREVIEW_AND_FULL,
+                      "Visible mothers + visible daughters");
+    ::AppendMenu(casc,MF_STRING,ID_ETC_UPDATE_SCENE,"Update scene");
+    ::AppendMenu(casc,MF_STRING,ID_ETC_STATS,"Scene graph stats");}
+
+   {HMENU casc = CreatePopupMenu();
+    ::AppendMenu(menuBar,MF_POPUP,(UINT)casc,"Help");
+    ::AppendMenu(casc,MF_STRING,ID_HELP_CONTROLS,"Controls");}
+
+    fShell = ::CreateWindow(className, shellName.c_str(), 
+                            WS_OVERLAPPEDWINDOW |
+                            WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
+                            CW_USEDEFAULT, CW_USEDEFAULT, 
+                            width,height,
+                            0,menuBar,::GetModuleHandle(0),0);
+    // Retreive window and client sizez :
+    RECT wrect,crect;
+    GetWindowRect((HWND)fShell,&wrect);
+    GetClientRect((HWND)fShell,&crect);
+    int ww = wrect.right-wrect.left;
+    int wh = wrect.bottom-wrect.top;
+    int cw = crect.right-crect.left;
+    int ch = crect.bottom-crect.top;
+    // Compell client rect to be width height :
+    MoveWindow((HWND)fShell,wrect.left,wrect.top,width+ww-cw,height+wh-ch,TRUE);
+    ::SetWindowLong((HWND)fShell,GWL_USERDATA,LONG(this));
+    ::SetWindowText((HWND)fShell,shellName.c_str());
+    parent = fShell;
+    fInteractorManager->AddShell(fShell);
+  } else {
+    char* str = fInteractorManager->GetCreationString();
+    if(str!=0) wName = str;
+  }
+  fViewer = new Geant4_SoWinExaminerViewer(parent,wName.c_str(),TRUE);
+
+  // Have a GL2PS render action :
+  const SbViewportRegion& vpRegion = fViewer->getViewportRegion();
+  fGL2PSAction = new SoGL2PSAction(vpRegion);
+  fViewer->setGLRenderAction(fGL2PSAction);
+
+  fViewer->setSize(SbVec2s(width,height));
+  fViewer->setSceneGraph(fSoSelection);
+  fViewer->viewAll();
+  fViewer->saveHomePosition();
+  fViewer->setTitle(fName);
+  fViewer->show();
+  if(fShell) {
+    SoWin::show(fShell);
+    fInteractorManager->FlushAndWaitExecution ();
+  }
+  fInteractorManager->SetCreatedInteractor (fViewer -> getWidget());
+}
+
+G4OpenInventorWinViewer::~G4OpenInventorWinViewer () {
+  if(fShell) fInteractorManager->RemoveShell(fShell);
+  if(fViewer) {
+    fViewer->setSceneGraph(0);
+    delete fViewer;
+  }
+  if(fShell) {
+    ::SetWindowLong((HWND)fShell,GWL_USERDATA,LONG(0));
+    ::DestroyWindow((HWND)fShell);
+  }
+}
+
+void G4OpenInventorWinViewer::FinishView () {
+  if(!fViewer) return;
+  fViewer->viewAll();
+  fViewer->saveHomePosition();
+}
+
+void G4OpenInventorWinViewer::SetView () {
+  G4OpenInventorViewer::SetView ();
+  if(!fViewer) return;
+  // Background.
+  G4Colour b = fVP.GetBackgroundColour ();
+  fViewer->setBackgroundColor
+    (SbColor((float)b.GetRed(),(float)b.GetGreen(),(float)b.GetBlue()));
+}
+void G4OpenInventorWinViewer::ViewerRender () {
+  if(!fViewer) return;
+  fViewer->render();
+}
+
+SoCamera* G4OpenInventorWinViewer::GetCamera () {
+  if(!fViewer) return 0;
+  return fViewer->getCamera();
+}
+
+
+//////////////////////////////////////////////////////////////////////////////
+LRESULT CALLBACK G4OpenInventorWinViewer::WindowProc ( 
+ HWND   aWindow
+,UINT   aMessage
+,WPARAM aWParam
+,LPARAM aLParam
+)
+//////////////////////////////////////////////////////////////////////////////
+//  Below treatment of WM_SIZE, WM_SETFOCUS not necessary 
+// with TGS, but needed with SoFree. WM_DESTROY needed for 
+// 'main top level window' so that 'Close window' induces
+// the end of the task.
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  switch (aMessage) { 
+  case WM_SIZE:{ // Assume one child window !
+    int width = LOWORD(aLParam);
+    int height = HIWORD(aLParam);
+    //printf("debug : G4SoWindow : WMS_SIZE : %d %d\n",width,height);
+    G4OpenInventorWinViewer* This = 
+      (G4OpenInventorWinViewer*)::GetWindowLong(aWindow,GWL_USERDATA);
+    if(This && This->fViewer) {
+      This->fViewer->sizeChanged(SbVec2s(width,height));
+    }
+  }return 0;
+  case WM_SETFOCUS:{ // Assume one child window !
+    HWND hwnd = ::GetFirstChild(aWindow);
+    if(hwnd!=0) ::SetFocus(hwnd);
+  }return 0;
+  case WM_DESTROY:{
+    //G4OpenInventorWinViewer* This = 
+    //  (G4OpenInventorWinViewer*)::GetWindowLong(aWindow,GWL_USERDATA);
+    //::PostQuitMessage(0);
+  }return 0;
+  case WM_COMMAND:{
+    G4OpenInventorWinViewer* This = 
+      (G4OpenInventorWinViewer*)::GetWindowLong(aWindow,GWL_USERDATA);
+    if(This) {
+      if(aLParam==0) { //From menu.
+        // File :
+        if(aWParam==ID_FILE_POSTSCRIPT) {
+          This->WritePostScript();
+        } else if(aWParam==ID_FILE_PIXMAP_POSTSCRIPT) {
+          This->WritePixmapPostScript();
+        } else if(aWParam==ID_FILE_INVENTOR) {
+          This->WriteInventor();
+        } else if(aWParam==ID_FILE_ESCAPE) {
+          This->Escape();
+        // Etc :
+        } else if(aWParam==ID_ETC_ERASE_DETECTOR) {
+          This->EraseDetector();
+        } else if(aWParam==ID_ETC_ERASE_EVENT) {
+          This->EraseEvent();
+        } else if(aWParam==ID_ETC_SET_SOLID) {
+          This->SetSolid();
+        } else if(aWParam==ID_ETC_SET_WIRE_FRAME) {
+          This->SetWireFrame();
+        } else if(aWParam==ID_ETC_SET_REDUCED_WIRE_FRAME) {
+          This->SetReducedWireFrame(true);
+        } else if(aWParam==ID_ETC_SET_FULL_WIRE_FRAME) {
+          This->SetReducedWireFrame(false);
+        } else if(aWParam==ID_ETC_SET_PREVIEW) {
+          This->SetPreview();
+        } else if(aWParam==ID_ETC_SET_PREVIEW_AND_FULL) {
+          This->SetPreviewAndFull();
+        } else if(aWParam==ID_ETC_UPDATE_SCENE) {
+          This->UpdateScene();
+        } else if(aWParam==ID_ETC_STATS) {
+          This->SceneGraphStatistics();
+        // Help :
+        } else if(aWParam==ID_HELP_CONTROLS) {
+          G4cout << This->Help() << G4endl;
+        }
+      }
+    }
+  }return 0;
+  default:
+    return (::DefWindowProc(aWindow,aMessage,aWParam,aLParam));
+  }
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/src/G4OpenInventorXt.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/src/G4OpenInventorXt.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/src/G4OpenInventorXt.cc	(revision 1102)
@@ -0,0 +1,99 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenInventorXt.cc,v 1.4 2006/06/29 21:22:24 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Jeff Kallenbach 01 Aug 1996
+// OpenInventor graphics system factory.
+
+#ifdef G4VIS_BUILD_OIX_DRIVER
+
+// this :
+#include "G4OpenInventorXt.hh"
+
+#include <Inventor/Xt/SoXt.h>
+
+#include "G4Xt.hh"
+#include "G4OpenInventorSceneHandler.hh"
+#include "G4OpenInventorXtViewer.hh"
+
+G4OpenInventorXt::G4OpenInventorXt ()
+:G4OpenInventor("OpenInventorXt","OIX",G4VGraphicsSystem::threeD)
+,fInited(false)
+{
+}
+
+void G4OpenInventorXt::Initialize()
+{
+  if(fInited) return; //Done
+
+  SetInteractorManager (G4Xt::getInstance ());
+  GetInteractorManager () -> 
+    RemoveDispatcher((G4DispatchFunction)XtDispatchEvent);  
+  GetInteractorManager () -> 
+    AddDispatcher   ((G4DispatchFunction)SoXt::dispatchEvent);
+
+  Widget top = (Widget)GetInteractorManager()->GetMainInteractor();
+
+  if(getenv("XENVIRONMENT")==NULL) {
+    XrmDatabase database = XrmGetDatabase(XtDisplay(top));
+    if(database!=NULL) {
+      XrmPutLineResource(&database,"*topShadowColor:white");
+      XrmPutLineResource(&database,"*bottomShadowColor:black");
+      XrmPutLineResource(&database,"*foreground:black");
+      XrmPutLineResource(&database,"*background:lightgrey");
+      XrmPutLineResource(&database,"*borderColor:lightgrey");
+      XrmPutLineResource(&database,"*fontList:-*-helvetica-bold-r-*-*-*-120-*-*-*-*-iso8859-1");
+      XrmPutLineResource(&database,"*help_popup.title:Help");
+      XrmPutLineResource(&database,"*helpCancel.labelString:Cancel");
+      XrmPutLineResource(&database,"*helpText.editMode:multi_line_edit");
+      XrmPutLineResource(&database,"*helpText.columns:60");
+      XrmPutLineResource(&database,"*helpText.rows:20");
+      XrmPutLineResource(&database,"*helpText.background:white");
+      XrmPutLineResource(&database,"*helpText.fontList:*courier*-r-*--14-*");
+      XrmPutLineResource(&database,"*helpText.maxLength:8000");
+    }
+  }
+
+  SoXt::init(top);
+
+  InitNodes();
+
+  fInited = true;
+}
+
+G4OpenInventorXt::~G4OpenInventorXt () {}
+G4VViewer* G4OpenInventorXt::CreateViewer (G4VSceneHandler& scene, const G4String& name) 
+{
+  Initialize();
+  G4OpenInventorSceneHandler* pScene = (G4OpenInventorSceneHandler*)&scene;
+  return new G4OpenInventorXtViewer (*pScene, name);
+}
+
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/src/G4OpenInventorXtViewer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/src/G4OpenInventorXtViewer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/src/G4OpenInventorXtViewer.cc	(revision 1102)
@@ -0,0 +1,379 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenInventorXtViewer.cc,v 1.24 2006/06/29 21:22:26 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+/*
+ * jck 05 Feb 1997 - Initial Implementation
+ * jck 21 Apr 1997 
+ *	Mods for SoXtHepViewer
+ * gb : on Win32 use an SoXtExaminerViewer.
+ * gb 05 April 2004 : revisit to separate Windows things.
+ * gb 09 November 2004 : restore the escape button.
+ * gb 09 November 2004 : have a menu bar in the viewer shell.
+ * gb 09 November 2004 : have gl2ps file production.
+ * gb 14 November 2004 : inherit G4OpenInventorViewer.
+ */
+
+#ifdef G4VIS_BUILD_OIX_DRIVER
+
+// this :
+#include "G4OpenInventorXtViewer.hh"
+
+#include <Inventor/nodes/SoSelection.h>
+
+#include <Inventor/Xt/SoXt.h>
+#include <Inventor/Xt/viewers/SoXtExaminerViewer.h>
+
+#include <X11/StringDefs.h>
+#include <X11/Shell.h>
+
+#include <Xm/Xm.h>
+#include <Xm/PushB.h>
+#include <Xm/Form.h>
+#include <Xm/CascadeB.h>
+#include <Xm/RowColumn.h>
+#include <Xm/Text.h>
+
+#include "HEPVis/actions/SoGL2PSAction.h"
+
+#include "G4OpenInventor.hh"
+#include "G4OpenInventorSceneHandler.hh"
+#include "G4VInteractorManager.hh"
+
+G4OpenInventorXtViewer::G4OpenInventorXtViewer(
+ G4OpenInventorSceneHandler& sceneHandler
+,const G4String& name)
+:G4OpenInventorViewer (sceneHandler, name)
+,fShell(0)
+,fViewer(0)
+,fHelpForm(0)
+,fHelpText(0)
+{
+  G4cout << "Window name: " << fName << G4endl;
+}
+
+
+void G4OpenInventorXtViewer::Initialise() {
+  
+  G4String wName = fName;
+  
+  Widget parent = (Widget)fInteractorManager->GetParentInteractor ();
+  int width = 600;
+  int height = 600;
+
+  if(!parent) {  
+    // Check if user has specified an X-Windows-type geometry string...
+    char s[32];
+
+    G4String sgeometry = fVP.GetXGeometryString();
+    if(sgeometry.empty()) {
+      G4cout << "ERROR: Geometry string \""
+             << sgeometry	   
+             << "\" is empty.  Using \"600x600\"."
+             << G4endl;
+      width = 600;
+      height = 600;  
+      sprintf(s,"%dx%d",width,height);
+      sgeometry = s;
+    } else {
+      width = fVP.GetWindowSizeHintX();
+      height = fVP.GetWindowSizeHintX();
+    }
+
+    //Create a shell window :
+    G4String shellName = wName;
+    shellName += "_shell"; 
+    Arg args[10];
+    XtSetArg(args[0],XtNgeometry,XtNewString(sgeometry.c_str()));
+    XtSetArg(args[1],XtNborderWidth,0);
+    XtSetArg(args[2],XtNtitle,XtNewString(wName.c_str()));
+    fShell = XtAppCreateShell(shellName.c_str(),"Inventor",
+	  		       topLevelShellWidgetClass,
+			       SoXt::getDisplay(),
+			       args,3); 
+
+    XtSetArg(args[0],XmNtopAttachment   ,XmATTACH_FORM);
+    XtSetArg(args[1],XmNleftAttachment  ,XmATTACH_FORM);
+    XtSetArg(args[2],XmNrightAttachment ,XmATTACH_FORM);
+    XtSetArg(args[3],XmNbottomAttachment,XmATTACH_FORM);
+    Widget form = XmCreateForm (fShell,(char*)"form",args,4);
+    XtManageChild (form);
+
+    XtSetArg(args[0],XmNtopAttachment   ,XmATTACH_FORM);
+    XtSetArg(args[1],XmNleftAttachment  ,XmATTACH_FORM);
+    XtSetArg(args[2],XmNrightAttachment ,XmATTACH_FORM);
+    Widget menuBar = XmCreateMenuBar (form,(char*)"menuBar",args,3);
+    XtManageChild(menuBar);
+
+   {Widget menu = AddMenu(menuBar,"File","File");
+    AddButton(menu,"PS (gl2ps)",PostScriptCbk);
+    AddButton(menu,"PS (pixmap)",PixmapPostScriptCbk);
+    AddButton(menu,"IV",WriteInventorCbk);
+    AddButton(menu,"Escape",EscapeCbk);}
+
+   {Widget menu = AddMenu(menuBar,"Etc","Etc");
+    AddButton(menu,"Erase detector",EraseDetectorCbk);
+    AddButton(menu,"Erase event",EraseEventCbk);
+    AddButton(menu,"Set solid",SetSolidCbk);
+/*    AddButton(menu,"Set (G4) wire frame",SetWireFrameCbk);*/
+    AddButton(menu,"Set (G4) reduced wire frame",SetReducedWireFrameCbk);
+    AddButton(menu,"Set (G4) full wire frame",SetFullWireFrameCbk);
+    AddButton(menu,"Visible mothers + invisible daughters",SetPreviewCbk);
+    AddButton(menu,"Visible mothers + visible daughters",SetPreviewAndFullCbk);
+    AddButton(menu,"Update scene",UpdateSceneCbk);
+    AddButton(menu,"Scene graph stats",SceneGraphStatisticsCbk);
+   }
+
+   {Widget menu = AddMenu(menuBar,"Help","Help");
+    AddButton(menu,"Controls",HelpCbk);}
+
+    fViewer = new SoXtExaminerViewer(form,wName.c_str(),TRUE);
+    
+    XtSetArg(args[0],XmNtopAttachment   ,XmATTACH_WIDGET);
+    XtSetArg(args[1],XmNtopWidget       ,menuBar);
+    XtSetArg(args[2],XmNleftAttachment  ,XmATTACH_FORM);
+    XtSetArg(args[3],XmNrightAttachment ,XmATTACH_FORM);
+    XtSetArg(args[4],XmNbottomAttachment,XmATTACH_FORM);
+    XtSetValues(fViewer->getWidget(),args,5);
+
+    fHelpForm = XmCreateFormDialog(fShell,(char*)"help",NULL,0);
+    XtSetArg(args[0],XmNleftAttachment  ,XmATTACH_FORM);
+    XtSetArg(args[1],XmNrightAttachment ,XmATTACH_FORM);
+    XtSetArg(args[2],XmNbottomAttachment,XmATTACH_FORM);
+    Widget cancel = XmCreatePushButton(fHelpForm,(char*)"helpCancel",args,3);
+    XtAddCallback(cancel,XmNactivateCallback,HelpCancelCbk,(XtPointer)this);
+    XtManageChild(cancel);
+    XtSetArg(args[0],XmNtopAttachment   ,XmATTACH_FORM);
+    XtSetArg(args[1],XmNleftAttachment  ,XmATTACH_FORM);
+    XtSetArg(args[2],XmNrightAttachment ,XmATTACH_FORM);
+    XtSetArg(args[3],XmNbottomAttachment,XmATTACH_WIDGET);
+    XtSetArg(args[4],XmNbottomWidget    ,cancel);
+    fHelpText = XmCreateScrolledText(fHelpForm,(char*)"helpText",args,5);
+    XtManageChild(fHelpText);
+
+    fInteractorManager->AddShell(fShell);
+
+  } else {
+    char* str = fInteractorManager->GetCreationString();
+    if(str!=0) wName = str;
+    fViewer = new SoXtExaminerViewer(parent,wName.c_str(),TRUE);
+  }
+
+  fViewer->setSize(SbVec2s(width,height));
+
+  // Have a GL2PS render action :
+  const SbViewportRegion& vpRegion = fViewer->getViewportRegion();
+  fGL2PSAction = new SoGL2PSAction(vpRegion);
+  fViewer->setGLRenderAction(fGL2PSAction);
+
+  // Else :
+  fViewer->setSceneGraph(fSoSelection);
+  fViewer->viewAll();
+  fViewer->saveHomePosition();
+  fViewer->setTitle(fName);
+  fViewer->show();
+  if(fShell) {
+    SoXt::show(fShell);
+    fInteractorManager->FlushAndWaitExecution ();
+  }
+  fInteractorManager->SetCreatedInteractor (fViewer -> getWidget());
+}
+
+G4OpenInventorXtViewer::~G4OpenInventorXtViewer () {
+  if(fShell) fInteractorManager->RemoveShell(fShell);
+  if(fViewer) {
+    fViewer->setSceneGraph(0);
+    //FIXME : SGI : the below "delete" block things.
+    //FIXME : CoinXt : the below "delete" crashe in ~SoXtRenderArea.
+    //FIXME : delete fViewer;
+  }
+  if(fShell) XtDestroyWidget(fShell);
+}
+
+void G4OpenInventorXtViewer::FinishView () {
+  if(!fViewer) return;
+  fViewer->viewAll();
+  fViewer->saveHomePosition();
+}
+
+void G4OpenInventorXtViewer::SetView () {
+  G4OpenInventorViewer::SetView ();
+  if(!fViewer) return;
+  // Background.
+  G4Colour b = fVP.GetBackgroundColour ();
+  fViewer->setBackgroundColor
+    (SbColor((float)b.GetRed(),(float)b.GetGreen(),(float)b.GetBlue()));
+}
+
+
+void G4OpenInventorXtViewer::ViewerRender () {
+  if(!fViewer) return;
+  fViewer->render();
+}
+
+SoCamera* G4OpenInventorXtViewer::GetCamera () {
+  if(!fViewer) return 0;
+  return fViewer->getCamera();
+}
+
+Widget G4OpenInventorXtViewer::AddMenu(
+ Widget aMenuBar
+,const G4String& aName
+,const G4String& aLabel
+)
+{
+  // Pulldown menu :
+  Widget menu = XmCreatePulldownMenu(aMenuBar,(char*)aName.c_str(),NULL,0);
+  // Cascade button :
+  Arg args[2];
+  XmString cps = 
+    XmStringLtoRCreate((char*)aLabel.c_str(),XmSTRING_DEFAULT_CHARSET);
+  XtSetArg (args[0],XmNlabelString,cps);
+  XtSetArg (args[1],XmNsubMenuId,menu);
+  Widget widget = XmCreateCascadeButton(aMenuBar,(char*)aName.c_str(),args,2);
+  XmStringFree (cps);
+  XtManageChild(widget);
+  return menu;
+}
+void G4OpenInventorXtViewer::AddButton (
+ Widget aMenu
+,const G4String& aLabel
+,XtCallbackProc aCallback
+)
+{
+  Widget widget = XmCreatePushButton(aMenu,(char*)aLabel.c_str(),NULL,0);
+  XtManageChild(widget);
+  XtAddCallback(widget,XmNactivateCallback,aCallback,(XtPointer)this);
+}
+
+void G4OpenInventorXtViewer::HelpCancelCbk(
+  Widget,XtPointer aData,XtPointer) {
+  G4OpenInventorXtViewer* This = (G4OpenInventorXtViewer*)aData;
+  XtUnmanageChild(This->fHelpForm);
+}
+
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+
+void G4OpenInventorXtViewer::EscapeCbk(
+  Widget,XtPointer aData,XtPointer) {
+  G4OpenInventorXtViewer* This = (G4OpenInventorXtViewer*)aData;
+  This->Escape();
+}
+
+void G4OpenInventorXtViewer::PostScriptCbk(
+  Widget,XtPointer aData,XtPointer) {
+  G4OpenInventorXtViewer* This = (G4OpenInventorXtViewer*)aData;
+  This->WritePostScript();
+}
+
+void G4OpenInventorXtViewer::PixmapPostScriptCbk(
+  Widget,XtPointer aData,XtPointer) {
+  G4OpenInventorXtViewer* This = (G4OpenInventorXtViewer*)aData;
+  This->WritePixmapPostScript();
+}
+
+void G4OpenInventorXtViewer::SceneGraphStatisticsCbk(
+  Widget,XtPointer aData,XtPointer) {
+  G4OpenInventorXtViewer* This = (G4OpenInventorXtViewer*)aData;
+  This->SceneGraphStatistics();
+}
+
+void G4OpenInventorXtViewer::WriteInventorCbk(
+  Widget,XtPointer aData,XtPointer) {
+  G4OpenInventorXtViewer* This = (G4OpenInventorXtViewer*)aData;
+  This->WriteInventor();
+}
+
+void G4OpenInventorXtViewer::EraseDetectorCbk(
+  Widget,XtPointer aData,XtPointer) {
+  G4OpenInventorXtViewer* This = (G4OpenInventorXtViewer*)aData;
+  This->EraseDetector();
+}
+
+void G4OpenInventorXtViewer::EraseEventCbk(
+  Widget,XtPointer aData,XtPointer) {
+  G4OpenInventorXtViewer* This = (G4OpenInventorXtViewer*)aData;
+  This->EraseEvent();
+}
+
+void G4OpenInventorXtViewer::SetSolidCbk(
+  Widget,XtPointer aData,XtPointer) {
+  G4OpenInventorXtViewer* This = (G4OpenInventorXtViewer*)aData;
+  This->SetSolid();
+}
+
+void G4OpenInventorXtViewer::SetWireFrameCbk(
+  Widget,XtPointer aData,XtPointer) {
+  G4OpenInventorXtViewer* This = (G4OpenInventorXtViewer*)aData;
+  This->SetWireFrame();
+}
+
+void G4OpenInventorXtViewer::SetReducedWireFrameCbk(
+  Widget,XtPointer aData,XtPointer) {
+  G4OpenInventorXtViewer* This = (G4OpenInventorXtViewer*)aData;
+  This->SetReducedWireFrame(true);
+}
+
+void G4OpenInventorXtViewer::SetFullWireFrameCbk(
+  Widget,XtPointer aData,XtPointer) {
+  G4OpenInventorXtViewer* This = (G4OpenInventorXtViewer*)aData;
+  This->SetReducedWireFrame(false);
+}
+
+void G4OpenInventorXtViewer::UpdateSceneCbk(
+  Widget,XtPointer aData,XtPointer) {
+  G4OpenInventorXtViewer* This = (G4OpenInventorXtViewer*)aData;
+  This->UpdateScene();
+}
+
+void G4OpenInventorXtViewer::SetPreviewCbk(
+  Widget,XtPointer aData,XtPointer) {
+  G4OpenInventorXtViewer* This = (G4OpenInventorXtViewer*)aData;
+  This->SetPreview();
+}
+
+void G4OpenInventorXtViewer::SetPreviewAndFullCbk(
+  Widget,XtPointer aData,XtPointer) {
+  G4OpenInventorXtViewer* This = (G4OpenInventorXtViewer*)aData;
+  This->SetPreviewAndFull();
+}
+
+void G4OpenInventorXtViewer::HelpCbk(
+  Widget,XtPointer aData,XtPointer) {
+  G4OpenInventorXtViewer* This = (G4OpenInventorXtViewer*)aData;
+  XtManageChild(This->fHelpForm);
+  XmTextSetString(This->fHelpText,(char*)This->Help().c_str());
+}
+
+
+#endif
+
+
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/src/SbPainter.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/src/SbPainter.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/src/SbPainter.cc	(revision 1102)
@@ -0,0 +1,79 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+#ifdef G4VIS_BUILD_OI_DRIVER
+
+/*----------------------------HEPVis----------------------------------------*/
+/*                                                                          */
+/* Node:             SbPainter                                              */
+/* Author:           Guy Barrand                                            */
+/*                                                                          */
+/*--------------------------------------------------------------------------*/
+
+// this :
+#include <HEPVis/SbPainter.h>
+
+//////////////////////////////////////////////////////////////////////////////
+SbPainter::SbPainter(
+)
+:fWindowWidth(0)
+,fWindowHeight(0)
+,fRed(0.)
+,fGreen(0.)
+,fBlue(0.)
+,fEdges(FALSE)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+}
+//////////////////////////////////////////////////////////////////////////////
+SbPainter::~SbPainter(
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+}
+//////////////////////////////////////////////////////////////////////////////
+void SbPainter::setWindowSize(
+ int aWindowWidth
+,int aWindowHeight
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  fWindowWidth = aWindowWidth;
+  fWindowHeight = aWindowHeight;
+}
+//////////////////////////////////////////////////////////////////////////////
+void SbPainter::enableEdges(
+ SbBool aValue
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  fEdges = aValue;
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/src/SbPainterPS.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/src/SbPainterPS.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/src/SbPainterPS.cc	(revision 1102)
@@ -0,0 +1,1055 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+#ifdef G4VIS_BUILD_OI_DRIVER
+
+/*----------------------------HEPVis----------------------------------------*/
+/*                                                                          */
+/* Node:             SbPainterPS                                            */
+/* Author:           Guy Barrand                                            */
+/*                                                                          */
+/*--------------------------------------------------------------------------*/
+// this :
+#include <HEPVis/SbPainterPS.h>
+
+//#include <HEPVis/SbString.h>
+#define STRDUP(str)  ((str) != NULL ? (::strcpy((char*)::malloc((unsigned)::strlen(str) + 1), str)) : (char*)NULL)
+#define STRDEL(str) {if((str)!=NULL) {::free(str);str=NULL;}}
+
+//#define DEBUG
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <time.h>
+#include <locale.h>
+
+#define METAFILE_DEFAULT "out.ps"
+#define METAFILE_SCALE 1.
+
+static char* GetDate();
+static double ConvertRGB_ToGrey(double,double,double);
+//////////////////////////////////////////////////////////////////////////////
+SbPainterPS::SbPainterPS(
+)
+:fDeviceWidth((8.5-1.) * 72. * METAFILE_SCALE) /* 540. * METAFILE_SCALE */
+,fDeviceHeight(11.     * 72. * METAFILE_SCALE) /* 792. * METAFILE_SCALE */
+,fPageNumber(0)
+,fPagePos(0)
+,fMarkerSize(2.)
+,fFile(NULL)
+,fFileName(NULL)
+,fGSave(0)
+,fBufferCount(0)
+,fBufferString(NULL)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  fParams.shade = Color;
+  fParams.portrait = 1;
+  fParams.nbit = 2;
+  fParams.doBack = 1;
+  fParams.lineWidth = -1.;
+#ifdef WIN32
+  ::setlocale(LC_NUMERIC,"USA");
+#endif
+}
+//////////////////////////////////////////////////////////////////////////////
+SbPainterPS::~SbPainterPS(
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  if(fFile!=NULL) closeStream ();
+  if(fBufferString!=NULL) ::free(fBufferString);
+  fBufferString = NULL;
+  if(fGSave!=0) {
+    ::printf("SbPainterPS : bad gsave/grestore balance : %d.\n",fGSave);
+  }
+}
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+void SbPainterPS::beginTraversal (
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  if(fFile==NULL) openFileForWriting(NULL);
+  if(fFile==NULL) return;
+  putBeginPageInStream();
+  putPageScaleInStream((float)fWindowWidth,(float)fWindowHeight);
+  putSaveStateInStream();
+}
+//////////////////////////////////////////////////////////////////////////////
+void SbPainterPS::endTraversal(
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  if(fFile==NULL) return;
+  putFrameInStream(0.0,0.0,0.0,(float)fWindowWidth,(float)fWindowHeight);
+  putRestoreStateInStream();
+  putEndPageInStream();
+}
+//////////////////////////////////////////////////////////////////////////////
+void SbPainterPS::clearColorBuffer(
+ float aRed
+,float aGreen
+,float aBlue
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  if(fFile==NULL) return;
+  putBackgroundInStream(aRed,aGreen,aBlue,
+                           (float)fWindowWidth,(float)fWindowHeight);
+}
+/*
+//////////////////////////////////////////////////////////////////////////////
+void SbPainterPS::drawPrimitive (
+ SbPrimitiveType aType
+,int aPointn
+,float* aXs
+,float* aYs
+,float* //aZs
+,const SbPainterContext& aAtb
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  if(fFile==NULL) return;
+  switch(aType) {
+  case SbPrimitivePoints:
+    drawMarkers(aPointn,
+                aXs,aYs,
+                aAtb.fRed,aAtb.fGreen,aAtb.fBlue,
+                aAtb.fMarkerStyle,aAtb.fMarkerSize);
+    break;
+  case SbPrimitiveLineStrip:
+  case SbPrimitiveLineLoop:
+    drawLines(aPointn,
+              aXs,aYs,
+              aAtb.fRed,aAtb.fGreen,aAtb.fBlue,
+              aAtb.fLineStyle,aAtb.fLineWidth);
+    break;
+  case SbPrimitivePolygon:
+    drawPolygon(aPointn,
+                aXs,aYs,
+                aAtb.fRed,aAtb.fGreen,aAtb.fBlue,
+                aAtb.fAreaStyle);
+    break;
+  default:
+    break;
+  }
+}
+//////////////////////////////////////////////////////////////////////////////
+void SbPainterPS::drawPolygon(
+ int aPointn
+,float* aXs
+,float* aYs
+,float aRed
+,float aGreen
+,float aBlue
+,const SbAreaStyle& //aStyle
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  if(fFile==NULL) return;
+  if(aPointn<=0) return;
+  putNewPathInStream(); 
+  putMoveInStream(aXs[0],aYs[0]);
+  for(int count=1;count<aPointn;count++) {
+    putLineToInStream(aXs[count] - aXs[count-1],
+                      aYs[count] - aYs[count-1]);
+  }
+  if ( (aXs[0]==aXs[aPointn-1]) &&
+       (aYs[0]==aYs[aPointn-1]) ) 
+    putClosePathInStream();
+  putRGB_InStream(aRed,aGreen,aBlue);
+  putFillInStream();
+}
+//////////////////////////////////////////////////////////////////////////////
+void SbPainterPS::drawLines(
+ int aPointn
+,float* aXs
+,float* aYs
+,float aRed
+,float aGreen
+,float aBlue
+,const SbLineStyle& aStyle
+,int aWidth
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  if(fFile==NULL) return;
+  if(aPointn<=0) return;
+  putMoveInStream(aXs[0],aYs[0]);
+  for(int count=1;count<aPointn;count++) {
+    putLineToInStream(aXs[count] - aXs[count-1],
+                      aYs[count] - aYs[count-1]);
+  }
+  if ( (aXs[0]==aXs[aPointn-1]) &&
+       (aYs[0]==aYs[aPointn-1]) ) 
+    putClosePathInStream();
+  putRGB_InStream(aRed,aGreen,aBlue);
+  putLineWidthInStream(aWidth);
+  putCapInStream(1);
+  putLineStyleInStream(aStyle);
+  putStrokeInStream();
+}
+//////////////////////////////////////////////////////////////////////////////
+void SbPainterPS::drawMarkers (
+ int aPointn
+,float* aXs
+,float* aYs
+,float aRed
+,float aGreen
+,float aBlue
+,const SbMarkerStyle& aStyle 
+,int aSize
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  if(fFile==NULL) return;
+  float mark_size  = (float)(aSize <=0 ? 1. : aSize);   
+  mark_size *= 0.6F;
+  if(aStyle==SbMarkerCircleLine) {
+    putNewPathInStream();
+    int icount = 1;
+    for(int count=0;count<aPointn;count++) {
+      putCircleInStream(aXs[count],aYs[count],mark_size);
+#define MAX_PATH_POINT 100
+      if(icount==MAX_PATH_POINT) {
+        putRGB_InStream(aRed,aGreen,aBlue);
+        putLineWidthInStream(1);
+        putCapInStream(1);
+        putStrokeInStream();
+        icount = 1;
+        if(count!=aPointn-1) putNewPathInStream();
+      } else {
+        icount++;
+      }
+    }
+    putRGB_InStream(aRed,aGreen,aBlue);
+    putLineWidthInStream(1);
+    putCapInStream(1);
+    putStrokeInStream();
+  } else {
+    putNewPathInStream();
+    int icount = 1;
+    for(int count=0;count<aPointn;count++) {
+      putMoveInStream(aXs[count],aYs[count]);
+      putMarkerSizeInStream(mark_size);
+      putMarkerStyleInStream(aStyle);
+      if(icount==MAX_PATH_POINT) {
+        putRGB_InStream(aRed,aGreen,aBlue);
+        putLineWidthInStream(1);
+        putCapInStream(1);
+        putStrokeInStream();
+        icount = 1;
+        if(count!=aPointn-1) putNewPathInStream();
+      } else {
+        icount++;
+      }
+    }
+    putRGB_InStream(aRed,aGreen,aBlue);
+    putLineWidthInStream(1);
+    putCapInStream(1);
+    putStrokeInStream();
+  }
+}
+*/
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+void SbPainterPS::setColorScheme(
+ int aShade
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  fParams.shade = aShade;
+}
+//////////////////////////////////////////////////////////////////////////////
+void SbPainterPS::setOrientation(
+ int aPortrait
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  fParams.portrait = aPortrait;
+}
+//////////////////////////////////////////////////////////////////////////////
+void SbPainterPS::setBackgroundDrawn(
+ int aDoback
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  fParams.doBack = aDoback;
+}
+//////////////////////////////////////////////////////////////////////////////
+void SbPainterPS::setBitsPerPixel(
+ int aNbit
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  if( (aNbit==2) || (aNbit==4) || (aNbit==8) )
+    fParams.nbit = aNbit;
+  else 
+    fParams.nbit = 2;
+}
+//////////////////////////////////////////////////////////////////////////////
+void SbPainterPS::setLineWidth(
+ int aWidth
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  fParams.lineWidth = (float)aWidth;
+}
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+void SbPainterPS::setFileName(
+ const char* aString
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  STRDEL(fFileName);
+  fFileName = STRDUP(aString);
+}
+//////////////////////////////////////////////////////////////////////////////
+const char* SbPainterPS::getFileName(
+) const
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  return fFileName;
+}
+//////////////////////////////////////////////////////////////////////////////
+void* SbPainterPS::getStream(
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  return fFile;
+}
+//////////////////////////////////////////////////////////////////////////////
+void SbPainterPS::openFileForWriting(
+ const char* aString
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  if(fFile!=NULL) closeStream ();
+  if( (aString==NULL) || (*aString=='\0') ) {
+    if( (fFileName==NULL) || (*fFileName=='\0') ) { // Take default name :
+      fFile = ::fopen(METAFILE_DEFAULT,"wb");
+      STRDEL(fFileName);
+      fFileName = STRDUP(METAFILE_DEFAULT);
+    } else {
+      fFile = ::fopen(fFileName,"wb");
+    }
+  } else {
+    fFile = ::fopen(aString,"wb");
+    STRDEL(fFileName);
+    fFileName = STRDUP(aString);
+  }
+  if(fFile==NULL) return;
+
+  fBufferCount = 0;
+  fBufferPointer[METAFILE_RECORD_LENGTH] = '\0';
+  fPageNumber = 0;
+  // Header :
+  printFLN   ("%%!PS-Adobe-2.0");
+  printFLN   ("%%%%Creator: HEPVis::SbPainterPS.");
+  printFLN("%%%%CreationDate: %s",GetDate());
+  printFLN("%%%%Title: %s",fFileName);
+  printFLN("%%%%Pages: (atend)");
+  printFLN("%%%%BoundingBox: 0 0 %d %d",
+           (int)fDeviceWidth,(int)fDeviceHeight);
+  printFLN("%%%%DocumentFonts: Courier-Bold");
+  printFLN("%%%%DocumentPaperSizes: a4");
+  printFLN("%%%%EndComments");
+  // PostScript :
+  putSaveStateInStream      ();
+  // General :
+  putInStreamF("/n {newpath} def ");
+  putInStreamF("/cl {closepath} def ");
+  putInStreamF("/s {stroke} def ");
+  putInStreamF("/f {fill} def ");
+  // Move :
+  putInStreamF("/m  {moveto} def ");
+  putInStreamF("/rm {rmoveto} def ");
+  putInStreamF("/rl {rlineto} def ");
+  // Line :
+  putInStreamF("/lc {setlinecap} def ");
+  putInStreamF("/lw {setlinewidth} def ");
+  putInStreamF("/rgb {setrgbcolor} def ");
+  putInStreamF("/ss {[] 0 setdash} def ") ;            /* style solid       */
+  putInStreamF("/sd {[12 6] 0 setdash} def ");         /* style dashed      */
+  putInStreamF("/so {[6 12] 0 setdash} def ");         /* style dotted      */
+  putInStreamF("/sdo {[18 12 6 12] 0 setdash} def ");  /* style dash dotted */
+  // Mark :
+  fMarkerSize = 2.;
+  putInStreamF("/ms 2. def /msi .5 def ");        /* mark size */
+  putInStreamF("/cross {ms ms scale -1. -1. rm  ");
+  putInStreamF("2. 2. rl 0. -2. rm -2. 2. rl msi msi scale} def ");
+  putInStreamF("/plus  {ms ms scale -1. 0. rm 2. 0. rl ");
+  putInStreamF("-1. 1. rm 0. -2. rl msi msi scale} def ");
+  putInStreamF("/asterisk {ms ms scale -1. 0. rm 2. 0. rl -1. 1. rm ");
+  putInStreamF("0. -2. rl 0. 1. rm -0.707 -0.707 rm 1.414 1.414 rl ");
+  putInStreamF("0. -1.414 rm -1.414 1.414 rl msi msi scale} def ");
+  putInStreamF("/triangle {ms ms scale 0. 1. rm -0.6 -1.5 rl ");
+  putInStreamF("1.2 0. rl -0.6 1.5 rl msi msi scale} def ");
+  // Text :
+  putInStreamF("/sh {show} def ");
+  putInStreamF("/df {/Courier-Bold findfont} def ");
+  putInStreamF("/mf {makefont setfont} def ");
+  printFLN("%%%%EndProlog");
+}
+//////////////////////////////////////////////////////////////////////////////
+void SbPainterPS::closeStream(
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  if(fFile==NULL) return;
+  putRestoreStateInStream    ();
+  printFLN("%%%%Trailer");
+  printFLN("%%%%Pages: %d",fPageNumber);
+  printFLN("%%%%EOF");
+  if(fFile!=NULL) ::fclose(fFile);
+  fFile = NULL;
+  STRDEL(fFileName);
+  fFileName = NULL;
+}
+//////////////////////////////////////////////////////////////////////////////
+void SbPainterPS::putInStreamF(
+ const char* aFormat 
+,...
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  if(fFile==NULL) return;
+  va_list  args;
+  va_start(args,aFormat);
+  printV(aFormat,args);
+  va_end(args);
+  int length = ::strlen(fBufferString);
+  if(length>METAFILE_RECORD_LENGTH) {
+    ::printf("SoPostScript::putInStreamF overflow\n");
+    return;
+  }
+  int nlength = fBufferCount + length;
+  if(nlength>METAFILE_RECORD_LENGTH) {
+      fBufferPointer[fBufferCount] = '\0';
+      if(::fprintf(fFile,"%s\n",(char*)fBufferPointer)<0) {
+        ::printf("SoPostScript::putInStreamF fprintf error\n");
+      }
+      fBufferCount = 0;
+      nlength = length;
+    }
+  unsigned char* pointer = fBufferPointer + fBufferCount;
+  ::strcpy((char*)pointer,fBufferString);
+  fBufferCount = nlength;
+}
+//////////////////////////////////////////////////////////////////////////////
+void SbPainterPS::printFLN(
+ const char* aFormat 
+,...
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  if(fFile==NULL) return;
+  va_list args;
+  va_start(args,aFormat);
+  printV(aFormat,args);
+  va_end(args);
+/* put buffer in file */
+  if(fBufferCount>0) {
+    fBufferPointer[fBufferCount] = '\0';
+    if(::fprintf (fFile,"%s\n",(char*)fBufferPointer)<0) {
+      ::printf("SbPainterPS::printFLN fprintf error\n");
+    }
+    fBufferCount = 0;
+  }
+/* put comment in file */
+  if(::fprintf (fFile,"%s\n",fBufferString)<0) {
+    ::printf("SbPainterPS::printFLN fprintf error\n");
+  }
+}
+//////////////////////////////////////////////////////////////////////////////
+void SbPainterPS::printV(
+ const char* This 
+,va_list aArgs  
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+#define MAX_STR    2048
+  if(fBufferString==NULL) {
+    fBufferString = (char*)::malloc(MAX_STR * sizeof(char));
+    if(fBufferString==NULL) return;
+  }
+  fBufferString[MAX_STR-1]  = '\0';
+  ::vsprintf(fBufferString,This,aArgs);
+  if(fBufferString[MAX_STR-1]!='\0') {
+    ::printf("SbPainterPS::printV overflow\n");
+    fBufferString[0] = '\0';
+  }
+}
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+void SbPainterPS::putPageScaleInStream(
+ float aWidth 
+,float aHeight 
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  if(aWidth <=0.) aWidth  = 100.;
+  if(aHeight<=0.) aHeight = 100.;
+
+  putScaleInStream (1./METAFILE_SCALE,1./METAFILE_SCALE);
+  putTranslationInStream ((float)(fDeviceWidth/20.),
+                          (float)(fDeviceHeight/30.));
+
+  float scale;
+  if(fDeviceWidth<=fDeviceHeight)
+    scale = (aHeight<=aWidth ? 
+             fDeviceWidth /aWidth  : fDeviceWidth /aHeight );
+  else 
+    scale = (aHeight<=aWidth ? 
+             fDeviceHeight /aWidth : fDeviceHeight /aHeight );
+
+  float xtra,ytra;
+  if(fParams.portrait==1) {
+    xtra = (fDeviceWidth  - scale * aWidth)/2;
+    ytra = (fDeviceHeight - scale * aHeight)/2;
+  } else {
+    putTranslationInStream(fDeviceWidth,0.);
+    putRotateInStream(90);
+    xtra = (fDeviceHeight  - scale * aWidth)/2;
+    ytra = (fDeviceWidth   - scale * aHeight)/2;
+  }
+  putTranslationInStream (xtra,ytra);
+
+  putScaleInStream (scale,scale);
+}
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+void SbPainterPS::putSaveStateInStream(
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  putInStreamF("gsave ");
+  fGSave++;
+}
+//////////////////////////////////////////////////////////////////////////////
+void SbPainterPS::putRestoreStateInStream(
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  putInStreamF("grestore ");
+  fGSave--;
+}
+//////////////////////////////////////////////////////////////////////////////
+void SbPainterPS::putTranslationInStream(
+ float aX
+,float aY
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  putInStreamF("%.2f %.2f translate ",aX,aY);
+}
+//////////////////////////////////////////////////////////////////////////////
+void SbPainterPS::putScaleInStream(
+ float aX
+,float aY
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  putInStreamF("%.2f %.2f scale ",aX,aY);
+}
+//////////////////////////////////////////////////////////////////////////////
+void SbPainterPS::putBeginPageInStream(
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  fPageNumber++;
+  printFLN("%%%%Page: %d %d",fPageNumber,fPageNumber);
+  putSaveStateInStream();
+}
+//////////////////////////////////////////////////////////////////////////////
+void SbPainterPS::putEndPageInStream (
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  putInStreamF("showpage ");
+  putRestoreStateInStream();
+}
+//////////////////////////////////////////////////////////////////////////////
+void SbPainterPS::putRGB_InStream (
+ float aR 
+,float aG
+,float aB 
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  if(fParams.shade==Color)       
+    putInStreamF("%.2f %.2f %.2f rgb ",aR,aG,aB);
+  else if(fParams.shade==Grey)
+    putInStreamF("%.2f setgray ",convertRGB_ToGrey(aR,aG,aB));
+  else if(fParams.shade==BlackWhite)  
+    putInStreamF("0. setgray ",convertRGB_ToGrey(aR,aG,aB));
+}
+//////////////////////////////////////////////////////////////////////////////
+void SbPainterPS::putLineWidthInStream(
+ int aWidth
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  if(fParams.lineWidth<0.) {
+    if(aWidth==1) {
+      putInStreamF("%.1f lw ",0.5); // For a better rendering.
+    } else {
+      putInStreamF("%.1f lw ",(float)(aWidth));
+    }
+  } else {
+    putInStreamF("%.1f lw ",fParams.lineWidth); 
+  }
+}
+//////////////////////////////////////////////////////////////////////////////
+void SbPainterPS::putMarkerSizeInStream (
+ float aSize
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  if(aSize==fMarkerSize) return;
+  fMarkerSize = aSize;
+  putInStreamF("/ms %g def /msi %g def ",aSize,1./aSize);
+}
+/*
+//////////////////////////////////////////////////////////////////////////////
+void SbPainterPS::putMarkerStyleInStream (
+ SbMarkerStyle aStyle 
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  switch (aStyle) {
+  case SbMarkerPlus:
+    putInStreamF("plus ");
+    break;
+  case SbMarkerAsterisk:
+  case SbMarkerStar:
+    putInStreamF("asterisk ");
+    break;
+  case SbMarkerCross:
+    putInStreamF("cross ");
+    break;
+  case SbMarkerTriangleUpLine:
+    putInStreamF("triangle ");
+    break;
+  default:
+    putLineToInStream(0.,0.);
+    break;
+  }
+}
+*/
+//////////////////////////////////////////////////////////////////////////////
+void SbPainterPS::putBackgroundInStream (
+ float aR
+,float aG
+,float aB
+,float aWidth 
+,float aHeight 
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  putNewPathInStream(); 
+  putMoveInStream(0.,0.);
+  putLineToInStream(aWidth,0.);
+  putLineToInStream(0.,aHeight);
+  putLineToInStream(-aWidth,0.);
+  putLineToInStream(0.,-aHeight);
+  putClosePathInStream();
+  if(fParams.doBack==1) {
+    // Back :
+    putSaveStateInStream();
+    putRGB_InStream(aR,aG,aB);
+    putFillInStream();       
+    putRestoreStateInStream();
+  }
+  // Clip :
+  putInStreamF("clip ");
+}
+//////////////////////////////////////////////////////////////////////////////
+void SbPainterPS::putFrameInStream (
+ float aR
+,float aG
+,float aB
+,float aWidth 
+,float aHeight 
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  putNewPathInStream(); 
+  putMoveInStream(0.,0.);
+  putLineToInStream(aWidth,0.);
+  putLineToInStream(0.,aHeight);
+  putLineToInStream(-aWidth,0.);
+  putLineToInStream(0.,-aHeight);
+  putClosePathInStream();
+  putRGB_InStream(aR,aG,aB);
+  putLineWidthInStream(1);
+  putCapInStream(1);
+  putInStreamF("ss ");
+  putStrokeInStream();
+}
+//////////////////////////////////////////////////////////////////////////////
+float SbPainterPS::convertRGB_ToGrey (
+ float aRed
+,float aGreen
+,float aBlue
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  return (0.3F * aRed + 0.59F * aGreen + 0.11F * aBlue);
+}
+//////////////////////////////////////////////////////////////////////////////
+void SbPainterPS::putRotateInStream(
+ float aX                  
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  putInStreamF("%.2f  rotate ",aX);
+}
+//////////////////////////////////////////////////////////////////////////////
+void SbPainterPS::putNewPathInStream(
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  putInStreamF("n ");
+}
+//////////////////////////////////////////////////////////////////////////////
+void SbPainterPS::putStrokeInStream(
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  putInStreamF("s ");
+}
+//////////////////////////////////////////////////////////////////////////////
+void SbPainterPS::putFillInStream(
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  putInStreamF("f ");
+}
+//////////////////////////////////////////////////////////////////////////////
+void SbPainterPS::putClosePathInStream(
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  putInStreamF("cl ");
+}
+//////////////////////////////////////////////////////////////////////////////
+void SbPainterPS::putCapInStream(
+ int aX
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  putInStreamF("%1d lc ",aX);
+}
+//////////////////////////////////////////////////////////////////////////////
+void SbPainterPS::putLineToInStream(
+ float aX
+,float aY
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  putInStreamF ("%.2f %.2f rl ",aX,aY);
+}
+//////////////////////////////////////////////////////////////////////////////
+void SbPainterPS::putMoveInStream(
+ float aX
+,float aY
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  putInStreamF ("%.2f %.2f m ",aX,aY);
+}
+//////////////////////////////////////////////////////////////////////////////
+void SbPainterPS::putCircleInStream(
+ float aX                            
+,float aY                            
+,float aR                            
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  putInStreamF("%.2f %.2f %.2f 0 360 arc s ",aX,aY,aR);
+}
+/*
+//////////////////////////////////////////////////////////////////////////////
+void SbPainterPS::putLineStyleInStream(
+ SbLineStyle aStyle
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  switch(aStyle) {
+  case SbLineSolid:putInStreamF("ss ") ;break;
+  case SbLineDashed:putInStreamF("sd ") ;break;
+  case SbLineDotted:putInStreamF("so ") ;break;
+  case SbLineDashDotted:putInStreamF("sdo ");break;
+  }
+}
+*/
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+/////// Image ////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+void SbPainterPS::putImageInStream (
+ unsigned int aWidth
+,unsigned int aHeight
+,GetRGB_Function aProc
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  if((aWidth<=0)||(aHeight<=0)) return;
+  if(!aProc) return;
+
+  putSaveStateInStream      ();
+  putInStreamF     ("%d %d scale ", aWidth, aHeight ); 
+  int status = 1;
+  int      nbhex;
+  unsigned int row,col,col_max;
+  double   dr,dg,db;
+  typedef unsigned char Uchar;
+  Uchar    red,green,blue,b;
+  if(fParams.shade!=0) { /*grey*/
+    putInStreamF   ("/picstr %d string def ",aWidth); 
+    putInStreamF   ("%d %d %d ",aWidth,aHeight,8); 
+    putInStreamF   ("[ %d 0 0 -%d 0 %d ] ",aWidth,aHeight,aHeight); 
+    putInStreamF   ("{ currentfile picstr readhexstring pop } " );
+    printFLN ("image " );
+    for ( row = 0; row < aHeight; row++ ){
+      for ( col = 0; col < aWidth; col++){ 
+        double    fgrey;
+        Uchar     grey;
+        status    = aProc(col,row,dr,dg,db)==0 ? 0 : status;
+        fgrey     = ConvertRGB_ToGrey(dr,dg,db);
+        grey      = (Uchar) ( 255. * fgrey);
+        writeByte (grey);
+      }
+    }
+    nbhex     = aWidth * aHeight * 2; 
+    printFLN ("%%%% nbhex digit          :%d ",nbhex); 
+    printFLN ("%%%% nbhex/record_length  :%d ",nbhex/METAFILE_RECORD_LENGTH); 
+    printFLN ("%%%% nbhex%%record_length :%d ",nbhex%METAFILE_RECORD_LENGTH); 
+  }else if(fParams.nbit==2){ 
+    int       nbyte2;
+    nbyte2    = (aWidth   *  3)/4;
+    nbyte2   /=3;
+    nbyte2   *=3;
+    col_max   = (nbyte2  *  4)/3;
+    /* 2 bit for r and g and b   */
+    /* rgbs following each other */
+    putInStreamF   ("/rgbstr %d string def ",nbyte2); 
+    putInStreamF   ("%d %d %d ",col_max,aHeight,2); 
+    putInStreamF   ("[ %d 0 0 -%d 0 %d ] ",col_max,aHeight,aHeight); 
+    putInStreamF   ("{ currentfile rgbstr readhexstring pop } " );
+    putInStreamF   ("false 3 " );
+    printFLN ("colorimage " );
+    for ( row = 0; row < aHeight; row++ ){
+      for ( col = 0; col < col_max; col+=4){
+        status  = aProc(col,row,dr,dg,db)==0 ? 0 : status;
+        red     = (Uchar) ( 3. * dr);
+        green   = (Uchar) ( 3. * dg);
+        blue    = (Uchar) ( 3. * db);
+        b       = red;
+        b       = (b<<2)+green;
+        b       = (b<<2)+blue;
+        status  = aProc(col+1,row,dr,dg,db)==0 ? 0 : status;
+        red     = (Uchar) ( 3. * dr);
+        green   = (Uchar) ( 3. * dg);
+        blue    = (Uchar) ( 3. * db);
+        b     = (b<<2)+red;
+        writeByte (b);
+        
+        b       = green;
+        b       = (b<<2)+blue;
+        status  = aProc(col+2,row,dr,dg,db)==0 ? 0 : status;
+        red     = (Uchar) ( 3. * dr);
+        green   = (Uchar) ( 3. * dg);
+        blue    = (Uchar) ( 3. * db);
+        b     = (b<<2)+red;
+        b     = (b<<2)+green;
+        writeByte (b);
+        
+        b       = blue;
+        status  = aProc(col+3,row,dr,dg,db)==0 ? 0 : status;
+        red     = (Uchar) ( 3. * dr);
+        green   = (Uchar) ( 3. * dg);
+        blue    = (Uchar) ( 3. * db);
+        b     = (b<<2)+red;
+        b     = (b<<2)+green;
+        b     = (b<<2)+blue;
+        writeByte (b);
+      }
+    }
+  }else if(fParams.nbit==4){ 
+    int       nbyte4;
+    nbyte4    = (aWidth  * 3)/2;
+    nbyte4   /=3;
+    nbyte4   *=3;
+    col_max   = (nbyte4 * 2)/3;
+    /* 4 bit for r and g and b   */
+    /* rgbs following each other */
+    putInStreamF   ("/rgbstr %d string def ",nbyte4); 
+    putInStreamF   ("%d %d %d ",col_max,aHeight,4); 
+    putInStreamF   ("[ %d 0 0 -%d 0 %d ] ",col_max,aHeight,aHeight); 
+    putInStreamF   ("{ currentfile rgbstr readhexstring pop } " );
+    putInStreamF   ("false 3 " );
+    printFLN ("colorimage " );
+    for ( row = 0; row < aHeight; row++ ){
+      for ( col = 0; col < col_max; col+=2){
+        status  = aProc(col,row,dr,dg,db)==0 ? 0 : status;
+        red     = (Uchar) ( 15. * dr);
+        green   = (Uchar) ( 15. * dg);
+        putInStreamF ("%x%x",red,green);
+        blue    = (Uchar) ( 15. * db);
+        
+        status  = aProc(col+1,row,dr,dg,db)==0 ? 0 : status;
+        red     = (Uchar) ( 15. * dr);
+        putInStreamF ("%x%x",blue,red);
+        green   = (Uchar) ( 15. * dg);
+        blue    = (Uchar) ( 15. * db);
+        putInStreamF ("%x%x",green,blue);
+      }
+    }
+  }else{ 
+    int       nbyte8;
+    nbyte8    = aWidth   * 3;
+    /* 8 bit for r and g and b   */
+    putInStreamF   ("/rgbstr %d string def ",nbyte8); 
+    putInStreamF   ("%d %d %d ",aWidth,aHeight,8); 
+    putInStreamF   ("[ %d 0 0 -%d 0 %d ] ",aWidth,aHeight,aHeight); 
+    putInStreamF   ("{ currentfile rgbstr readhexstring pop } " );
+    putInStreamF   ("false 3 " );
+    printFLN   ("colorimage " );
+    for ( row = 0; row < aHeight; row++ ){
+      for ( col = 0; col < aWidth; col++){
+        status     = aProc(col,row,dr,dg,db)==0 ? 0 : status;
+        red        = (Uchar) ( 255. * dr);
+        writeByte (red);
+        green      = (Uchar) ( 255. * dg);
+        writeByte (green);
+        blue       = (Uchar) ( 255. * db);
+        writeByte (blue);
+      }
+    }
+  }
+  if(status==0) 
+    ::printf("SbPainterPS::putImageInStream: problem to retreive some pixel rgb.\n");
+  putRestoreStateInStream();
+}
+//////////////////////////////////////////////////////////////////////////////
+void SbPainterPS::writeByte (
+ unsigned char a_byte
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  unsigned char h = a_byte / 16;
+  unsigned char l = a_byte % 16;
+  putInStreamF ("%x%x",h,l);
+}
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+char* GetDate (
+)
+//////////////////////////////////////////////////////////////////////////////
+// Return local date.
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  time_t d;
+  time(&d);
+  char* string = ctime(&d);
+  string[24] = '\0';
+  return string;
+}
+//////////////////////////////////////////////////////////////////////////////
+double ConvertRGB_ToGrey(
+ double a_red
+,double a_green
+,double a_blue
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  return (0.30 * a_red + 0.59 * a_green + 0.11 * a_blue);
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/src/SoAlternateRepAction.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/src/SoAlternateRepAction.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/src/SoAlternateRepAction.cc	(revision 1102)
@@ -0,0 +1,149 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+#ifdef G4VIS_BUILD_OI_DRIVER
+
+
+// this :
+#include <HEPVis/actions/SoAlternateRepAction.h>
+
+// Inventor :
+#include <Inventor/nodes/SoNode.h>
+#include <Inventor/elements/SoSwitchElement.h>
+#include <Inventor/elements/SoCoordinateElement.h>
+
+SO_ACTION_SOURCE(SoAlternateRepAction)
+
+//////////////////////////////////////////////////////////////////////////////
+void SoAlternateRepAction::initClass(
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  SO_ACTION_INIT_CLASS(SoAlternateRepAction,SoAction);
+
+  SO_ENABLE(SoAlternateRepAction,SoSwitchElement); //SGI wants that.
+  SO_ENABLE(SoAlternateRepAction,SoCoordinateElement); //For SoMarkerSet.
+
+  SO_ACTION_ADD_METHOD(SoNode,nodeAction);
+}
+//////////////////////////////////////////////////////////////////////////////
+SoAlternateRepAction::SoAlternateRepAction(
+)
+:fGenerate(FALSE)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  SO_ACTION_CONSTRUCTOR(SoAlternateRepAction);
+}
+//////////////////////////////////////////////////////////////////////////////
+SoAlternateRepAction::~SoAlternateRepAction(
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+}
+//////////////////////////////////////////////////////////////////////////////
+void SoAlternateRepAction::setGenerate(
+ SbBool aGenerate
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  fGenerate = aGenerate;
+}
+//////////////////////////////////////////////////////////////////////////////
+SbBool SoAlternateRepAction::getGenerate(
+) const
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  return fGenerate;
+}
+
+// Inventor :
+#include <Inventor/nodes/SoNode.h>
+#include <Inventor/nodes/SoGroup.h>
+#include <Inventor/nodes/SoCoordinate3.h>
+
+// HEPVisUtils :
+//#include <HEPVis/nodes/SoHighlightMaterial.h>
+//#include <HEPVis/nodes/SoSplineCurve.h>
+
+#define IF_CLASS(aClass) \
+  if(aNode->isOfType(aClass::getClassTypeId())) {\
+    /*printf("debug : SoAlternateRepAction::nodeAction : %s generate %d\n",#aClass,This->fGenerate);*/\
+    aClass* node = (aClass*)aNode;\
+    if(This->fGenerate==TRUE) {\
+      if(node->alternateRep.getValue()==NULL) {\
+        node->generateAlternateRep();\
+        /* Then go down if needed : */\
+        SoNode* altRep = node->alternateRep.getValue();\
+        if((altRep!=NULL) && altRep->isOfType(SoGroup::getClassTypeId()))\
+          altRep->doAction(This);\
+      }\
+    } else {\
+      /* First go down if needed : */\
+      SoNode* altRep = node->alternateRep.getValue();\
+      if((altRep!=NULL) && altRep->isOfType(SoGroup::getClassTypeId()))\
+        altRep->doAction(This);\
+      /* Then clear : */\
+      node->clearAlternateRep();\
+    }\
+  }
+
+//////////////////////////////////////////////////////////////////////////////
+void SoAlternateRepAction::nodeAction(
+ SoAction* aThis
+,SoNode* aNode
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  /*printf("debug : SoAlternateRepAction::nodeAction : %s %s\n",
+    aNode->getName().getString(),
+    aNode->getTypeId().getName().getString());*/
+  //SoAlternateRepAction* This = (SoAlternateRepAction*)aThis;
+
+  if(false) {}
+  // HEPVisUtils :
+  //else IF_CLASS(SoHighlightMaterial)
+  //else IF_CLASS(SoSplineCurve)
+
+  // Inventor :
+  else if(aNode->isOfType(SoGroup::getClassTypeId())) {
+    aNode->doAction(aThis);
+  }
+  else if(aNode->isOfType(SoCoordinate3::getClassTypeId())) { //For SoMakerSet.
+    aNode->doAction(aThis);
+  }
+  // Else :
+  else if(aNode->getField("alternateRep")!=NULL) {
+    aNode->doAction(aThis);
+  }
+
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/src/SoBox.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/src/SoBox.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/src/SoBox.cc	(revision 1102)
@@ -0,0 +1,282 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+//
+// $Id: SoBox.cc,v 1.8 2006/06/29 21:22:36 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+/*----------------------------HEPVis----------------------------------------*/
+/*                                                                          */
+/* Node:             SoBox                                                  */
+/* Description:      Represents the G4Box Geant Geometry entity             */
+/* Author:           Joe Boudreau Nov 11 1996                               */
+/*                                                                          */
+/*--------------------------------------------------------------------------*/
+
+#ifdef G4VIS_BUILD_OI_DRIVER
+
+// this :
+#include "HEPVis/nodes/SoBox.h"
+
+#include <assert.h>
+#include <cmath>
+
+#include <Inventor/SbBox.h>
+#include <Inventor/fields/SoSFFloat.h>
+#include <Inventor/misc/SoChildList.h>
+#include <Inventor/nodes/SoSeparator.h>
+#include <Inventor/nodes/SoCube.h>
+#include <Inventor/nodes/SoScale.h>
+#include <Inventor/actions/SoAction.h>
+#include <Inventor/nodes/SoIndexedFaceSet.h>
+#include <Inventor/SoPrimitiveVertex.h>
+#include <Inventor/elements/SoTextureCoordinateElement.h>
+
+// This statement is required
+SO_NODE_SOURCE(SoBox)
+
+// Constructor
+SoBox::SoBox() {
+  // This statement is required
+  SO_NODE_CONSTRUCTOR(SoBox);
+
+  // Data fields are initialized like this:
+  SO_NODE_ADD_FIELD(fDx,                (1.0));
+  SO_NODE_ADD_FIELD(fDy,                (1.0));
+  SO_NODE_ADD_FIELD(fDz,                (1.0));
+  SO_NODE_ADD_FIELD(alternateRep,       (NULL));
+  children = new SoChildList(this);
+}
+
+// Destructor
+SoBox::~SoBox() {
+ delete children;
+}
+
+
+// initClass
+void SoBox::initClass(){
+  // This statement is required.
+  SO_NODE_INIT_CLASS(SoBox,SoShape,"Shape");
+}
+
+
+// generatePrimitives
+void SoBox::generatePrimitives(SoAction *action) {
+  // This variable is used to store each vertex
+  SoPrimitiveVertex pv;
+
+  // Access the stat from the action
+  SoState *state = action->getState();
+
+  // See if we have to use a texture coordinate function,
+  // rather than generating explicit texture coordinates.
+  SbBool useTexFunction=
+    (SoTextureCoordinateElement::getType(state) == 
+     SoTextureCoordinateElement::FUNCTION);
+
+  // If we need to generate texture coordinates with a function,
+  // we'll need an SoGLTextureCoordinateElement.  Otherwise, we'll
+  // set up the coordinates directly.
+  const SoTextureCoordinateElement *tce = NULL;
+  SbVec4f texCoord;
+  if (useTexFunction) {
+    tce = SoTextureCoordinateElement::getInstance(state);
+  }
+  else {
+    texCoord[2] = 0.0;
+    texCoord[3] = 1.0;
+  }
+  SbVec3f point, normal;
+
+
+  //////////////////////////////////////////
+  //----------------------------------------
+#define GEN_VERTEX(pv,x,y,z,s,t,nx,ny,nz)  \
+  point.setValue(x,y,z);                   \
+  normal.setValue(nx,ny,nz);               \
+  if (useTexFunction) {                    \
+    texCoord=tce->get(point,normal);       \
+  }                                        \
+  else {                                   \
+    texCoord[0]=s;                         \
+    texCoord[1]=t;                         \
+  }                                        \
+  pv.setPoint(point);                      \
+  pv.setNormal(normal);                    \
+  pv.setTextureCoords(texCoord);           \
+  shapeVertex(&pv);
+  //----------------------------------------
+  //////////////////////////////////////////
+
+  const int NPOINTS=8, NFACES=6, NINDICES = NFACES*5;
+  int indices[NINDICES] = {3,2,1,0, SO_END_FACE_INDEX,  //z back.
+			   4,5,6,7, SO_END_FACE_INDEX,  //z front.
+			   0,1,5,4, SO_END_FACE_INDEX,  //y up.
+			   1,2,6,5, SO_END_FACE_INDEX,  //x left.
+			   2,3,7,6, SO_END_FACE_INDEX,  //y down.
+			   3,0,4,7, SO_END_FACE_INDEX}; //x right.
+
+  
+  // points for the eight vertices
+  float points[NPOINTS][3];
+  points[0][0] =  fDx.getValue(); 
+  points[0][1] =  fDy.getValue(); 
+  points[0][2] = -fDz.getValue();
+
+  points[1][0] = -fDx.getValue();
+  points[1][1] =  fDy.getValue();
+  points[1][2] = -fDz.getValue();
+
+  points[2][0] = -fDx.getValue(); 
+  points[2][1] = -fDy.getValue(); 
+  points[2][2] = -fDz.getValue();
+
+  points[3][0] =  fDx.getValue(); 
+  points[3][1] = -fDy.getValue(); 
+  points[3][2] = -fDz.getValue();
+
+  points[4][0] =  fDx.getValue(); 
+  points[4][1] =  fDy.getValue(); 
+  points[4][2] =  fDz.getValue();
+
+  points[5][0] = -fDx.getValue(); 
+  points[5][1] =  fDy.getValue(); 
+  points[5][2] =  fDz.getValue();
+
+  points[6][0] = -fDx.getValue(); 
+  points[6][1] = -fDy.getValue(); 
+  points[6][2] =  fDz.getValue();
+
+  points[7][0] =  fDx.getValue(); 
+  points[7][1] = -fDy.getValue(); 
+  points[7][2] =  fDz.getValue();
+
+  float normals[NFACES][3];
+  //z back.
+  normals[0][0] =  0  ; normals[0][1] =    0; normals [0][2] =  -1;    
+  //z front.
+  normals[1][0] =  0  ; normals[1][1] =    0; normals [1][2] =   1;    
+  //y up.
+  normals[2][0] =  0  ; normals[2][1] =    1; normals [2][2] =   0;    
+  //x left.
+  normals[3][0] = -1  ; normals[3][1] =    0; normals [3][2] =   0;    
+  //y down.
+  normals[4][0] =  0  ; normals[4][1] =   -1; normals [4][2] =   0;    
+  //x right.
+  normals[5][0] =  1  ; normals[5][1] =    0; normals [5][2] =   0;    
+
+  float x,y,z;
+  int   index;
+  for (int nf=0;nf<NFACES;nf++) {
+    beginShape(action,TRIANGLE_FAN);
+    index = indices[nf * 5];   
+    x = points[index][0];
+    y = points[index][1];
+    z = points[index][2];
+    GEN_VERTEX(pv,x,y,z,0.0,0.0,normals[nf][0],normals[nf][1],normals[nf][2]);   
+    index = indices[nf * 5 + 1];   
+    x = points[index][0];
+    y = points[index][1];
+    z = points[index][2];
+    GEN_VERTEX(pv,x,y,z,0.0,0.0,normals[nf][0],normals[nf][1],normals[nf][2]);   
+    index = indices[nf * 5 + 2];   
+    x = points[index][0];
+    y = points[index][1];
+    z = points[index][2];
+    GEN_VERTEX(pv,x,y,z,0.0,0.0,normals[nf][0],normals[nf][1],normals[nf][2]);   
+    index = indices[nf * 5 + 3];   
+    x = points[index][0];
+    y = points[index][1];
+    z = points[index][2];
+    GEN_VERTEX(pv,x,y,z,0.0,0.0,normals[nf][0],normals[nf][1],normals[nf][2]);   
+    endShape();
+  }
+}
+
+// getChildren
+SoChildList *SoBox::getChildren() const {
+  return children;
+}
+
+
+// computeBBox
+void SoBox::computeBBox(SoAction *, SbBox3f &box, SbVec3f &center ){
+  SbVec3f vmin(-fDx.getValue(),-fDy.getValue(),-fDz.getValue()), 
+          vmax( fDx.getValue(), fDy.getValue(), fDz.getValue());
+  center.setValue(0,0,0);
+  box.setBounds(vmin,vmax);
+}
+
+
+
+
+// updateChildren
+void SoBox::updateChildren() {
+
+
+  // Redraw the G4Box....
+
+  assert(children->getLength()==1);
+  SoSeparator       *sep                = (SoSeparator *)  ( *children)[0];
+  SoScale           *scale              = (SoScale *)( sep->getChild(0));
+  //SoCube            *cube               = (SoCube  *)( sep->getChild(1));
+  scale->scaleFactor.setValue(fDx.getValue(), fDy.getValue(), fDz.getValue());
+}
+
+// generateChildren
+void SoBox::generateChildren() {
+
+  // A box consists of a set of scale factors and a 
+  // cube.
+
+  assert(children->getLength() ==0);
+  SoSeparator      *sep              = new SoSeparator(); 
+  SoScale          *scale            = new SoScale();
+  SoCube           *cube             = new SoCube();
+
+  sep->addChild(scale);
+  sep->addChild(cube);
+  children->append(sep);
+}
+
+// generateAlternateRep
+void SoBox::generateAlternateRep() {
+
+  // This routine sets the alternate representation to the child
+  // list of this mode.  
+
+  if (children->getLength() == 0) generateChildren();
+  updateChildren();
+  alternateRep.setValue((SoSeparator *)  ( *children)[0]);
+}
+
+// clearAlternateRep
+void SoBox::clearAlternateRep() {
+  alternateRep.setValue(NULL);
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/src/SoCons.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/src/SoCons.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/src/SoCons.cc	(revision 1102)
@@ -0,0 +1,446 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+//
+// $Id: SoCons.cc,v 1.8 2006/06/29 21:22:38 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+/*-----------------------------HEPVis---------------------------------------*/
+/*                                                                          */
+/* Node:             SoCons                                                 */
+/* Description:      Represents the G4Cons Geant Geometry entity            */
+/* Author:           Joe Boudreau Nov 11 1996                               */
+/*                                                                          */
+/*--------------------------------------------------------------------------*/
+
+#ifdef G4VIS_BUILD_OI_DRIVER
+
+// this :
+#include "HEPVis/nodes/SoCons.h"
+
+#include <assert.h>
+#include <cmath>
+#include <Inventor/SbBox.h>
+#include <Inventor/actions/SoAction.h>
+#include <Inventor/fields/SoSFFloat.h>
+#include <Inventor/misc/SoChildList.h>
+#include <Inventor/nodes/SoSeparator.h>
+#include <Inventor/nodes/SoIndexedFaceSet.h>
+#include <Inventor/nodes/SoNormal.h>
+#include <Inventor/nodes/SoCoordinate3.h>
+#include <Inventor/nodes/SoNormalBinding.h>
+#include <Inventor/SoPrimitiveVertex.h>
+#include <Inventor/elements/SoTextureCoordinateElement.h>
+
+#include "HEPVis/SbMath.h"
+
+// This statement is required
+SO_NODE_SOURCE(SoCons)
+
+// Constructor
+SoCons::SoCons() {
+  // This statement is required
+  SO_NODE_CONSTRUCTOR(SoCons);
+
+  // Data fields are initialized like this:
+  SO_NODE_ADD_FIELD(fRmin1,               (0.0));
+  SO_NODE_ADD_FIELD(fRmin2,               (0.0));
+  SO_NODE_ADD_FIELD(fRmax1,               (1.0));
+  SO_NODE_ADD_FIELD(fRmax2,               (1.0));
+  SO_NODE_ADD_FIELD(fDz,                 (10.0));
+  SO_NODE_ADD_FIELD(fSPhi,                (0.0));
+  SO_NODE_ADD_FIELD(fDPhi,             ((float)(2*M_PI)));
+  SO_NODE_ADD_FIELD(smoothDraw,          (TRUE));
+  SO_NODE_ADD_FIELD(alternateRep,        (NULL));
+  children = new SoChildList(this);
+}
+
+// Destructor
+SoCons::~SoCons() {
+  delete children;
+}
+
+
+// initClass
+void SoCons::initClass(){
+  // This statement is required.
+  SO_NODE_INIT_CLASS(SoCons,SoShape,"Shape");
+}
+
+
+// generatePrimitives
+void SoCons::generatePrimitives(SoAction *action) {
+  // This variable is used to store each vertex
+  SoPrimitiveVertex pv;
+
+  // Access the stat from the action
+  SoState *state = action->getState();
+
+  // See if we have to use a texture coordinate function,
+  // rather than generating explicit texture coordinates.
+  SbBool useTexFunction=
+    (SoTextureCoordinateElement::getType(state) == 
+     SoTextureCoordinateElement::FUNCTION);
+
+  // If we need to generate texture coordinates with a function,
+  // we'll need an SoGLTextureCoordinateElement.  Otherwise, we'll
+  // set up the coordinates directly.
+  const SoTextureCoordinateElement *tce = NULL;
+  SbVec4f texCoord;
+  if (useTexFunction) {
+    tce = SoTextureCoordinateElement::getInstance(state);
+  } else {
+    texCoord[2] = 0.0;
+    texCoord[3] = 1.0;
+  }
+  SbVec3f point, normal;
+
+  ///////////////////////////////////////////////////////
+  //-----------------------------------------------------
+#define GEN_VERTEX(pv,x,y,z,s,t,nx,ny,nz)               \
+  point.setValue((float)(x),(float)(y),(float)(z));     \
+  normal.setValue((float)(nx),(float)(ny),(float)(nz)); \
+  if (useTexFunction) {                                 \
+    texCoord=tce->get(point,normal);                    \
+  } else {                                              \
+    texCoord[0]=(float)(s);                             \
+    texCoord[1]=(float)(t);                             \
+  }                                                     \
+  pv.setPoint(point);                                   \
+  pv.setNormal(normal);                                 \
+  pv.setTextureCoords(texCoord);                        \
+  shapeVertex(&pv);
+  //-----------------------------------------------------
+  ///////////////////////////////////////////////////////
+
+
+  int NPHI = (int)(2+22*std::fabs(fDPhi.getValue()/(2.0*M_PI)));
+  double deltaPhi = fDPhi.getValue()/NPHI;
+  double phi0     = fSPhi.getValue();
+  double phi1     = phi0 + fDPhi.getValue();
+  double rMax1    = fRmax1.getValue();
+  double rMin1    = fRmin1.getValue();
+  double rMax2    = fRmax2.getValue();
+  double rMin2    = fRmin2.getValue();
+  double zMax     = fDz.getValue();
+  double zMin     = -zMax;
+  double cosPhi0  = std::cos(phi0);
+  double sinPhi0  = std::sin(phi0);
+  double cosPhi1  = std::cos(phi1);
+  double sinPhi1  = std::sin(phi1);
+  double cosDeltaPhi = std::cos(deltaPhi);
+  double sinDeltaPhi = std::sin(deltaPhi);
+  //
+  // The outer surface!
+  //
+  beginShape(action,TRIANGLE_STRIP);
+  int    i;
+  double sinPhi=sinPhi0;
+  double cosPhi=cosPhi0;
+  for (i = 0; i<=NPHI; i++) {
+    GEN_VERTEX(pv,rMax2*cosPhi,rMax2*sinPhi,zMax,0.0,0.0,cosPhi,sinPhi,0);   
+    GEN_VERTEX(pv,rMax1*cosPhi,rMax1*sinPhi,zMin,1.0,1.0,cosPhi,sinPhi,0);   
+    inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);    
+  }
+  endShape();
+  //
+  // The inner surface!
+  //
+  beginShape(action,TRIANGLE_STRIP);
+  sinPhi=sinPhi0;
+  cosPhi=cosPhi0;
+  for (i = 0; i<=NPHI; i++) {
+    GEN_VERTEX(pv,rMin2*cosPhi,rMin2*sinPhi,zMax,0.0,0.0,-cosPhi,-sinPhi,0);   
+    GEN_VERTEX(pv,rMin1*cosPhi,rMin1*sinPhi,zMin,1.0,1.0,-cosPhi,-sinPhi,0);   
+    inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);    
+  } 
+  endShape();
+  if (std::fabs(deltaPhi)<2.0*M_PI) { 
+    //
+    // The end 
+    //
+    beginShape(action,TRIANGLE_STRIP);
+    sinPhi=sinPhi0;
+    cosPhi=cosPhi0;
+    GEN_VERTEX(pv,rMax2*cosPhi,rMax2*sinPhi,zMax,0.0,0.0,sinPhi,-cosPhi,0);   
+    GEN_VERTEX(pv,rMax1*cosPhi,rMax1*sinPhi,zMin,1.0,1.0,sinPhi,-cosPhi,0);   
+    GEN_VERTEX(pv,rMin2*cosPhi,rMin2*sinPhi,zMax,1.0,0.0,sinPhi,-cosPhi,0);   
+    GEN_VERTEX(pv,rMin1*cosPhi,rMin1*sinPhi,zMin,0.0,1.0,sinPhi,-cosPhi,0);   
+    endShape();
+    //
+    // The other end 
+    //
+    beginShape(action,TRIANGLE_STRIP);
+    sinPhi=sinPhi1;
+    cosPhi=cosPhi1;
+    GEN_VERTEX(pv,rMax2*cosPhi,rMax2*sinPhi, zMax,0.0,0.0,-sinPhi,+cosPhi,0);  
+    GEN_VERTEX(pv,rMax1*cosPhi,rMax1*sinPhi, zMin,1.0,1.0,-sinPhi,+cosPhi,0);  
+    GEN_VERTEX(pv,rMin2*cosPhi,rMin2*sinPhi, zMax,1.0,0.0,-sinPhi,+cosPhi,0);  
+    GEN_VERTEX(pv,rMin1*cosPhi,rMin1*sinPhi, zMin,0.0,1.0,-sinPhi,+cosPhi,0);  
+    endShape();
+  }
+
+  //
+  // The outer surface at z=+PDZ
+  //
+  beginShape(action,TRIANGLE_STRIP);
+  sinPhi=sinPhi0;
+  cosPhi=cosPhi0;
+  for (i = 0; i<=NPHI; i++) {
+    GEN_VERTEX(pv,rMin2*cosPhi,rMin2*sinPhi,zMax,0.0,0.0,0,0,1);   
+    GEN_VERTEX(pv,rMax2*cosPhi,rMax2*sinPhi,zMax,1.0,1.0,0,0,1);   
+    inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);    
+  }
+  endShape();
+  //
+  // The outer surface at z=-PDZ
+  //
+  beginShape(action,TRIANGLE_STRIP);
+  sinPhi=sinPhi0;
+  cosPhi=cosPhi0;
+  for (i = 0; i<=NPHI; i++) {
+    GEN_VERTEX(pv,rMin1*cosPhi,rMin1*sinPhi,zMin,0.0,0.0,0,0,-1);   
+    GEN_VERTEX(pv,rMax1*cosPhi,rMax1*sinPhi,zMin,1.0,1.0,0,0,-1);   
+    inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);    
+  }
+  endShape();
+
+}
+
+// getChildren
+SoChildList *SoCons::getChildren() const {
+  return children;
+}
+
+
+// computeBBox
+void SoCons::computeBBox(SoAction *, SbBox3f &box, SbVec3f &center ){
+  float fRmax= fRmax1.getValue();  
+  if (fRmax2.getValue() > fRmax) fRmax = fRmax2.getValue(); 
+
+  SbVec3f vmin(-fRmax,-fRmax,-fDz.getValue()), 
+          vmax( fRmax, fRmax, fDz.getValue());
+  center.setValue(0,0,0);
+  box.setBounds(vmin,vmax);
+}
+
+
+
+
+// updateChildren
+void SoCons::updateChildren() {
+
+
+  // Redraw the G4Cons....
+
+  assert(children->getLength()==1);
+  SoSeparator       *sep                = (SoSeparator *)  ( *children)[0];
+  SoCoordinate3     *theCoordinates     = (SoCoordinate3 *)      ( sep->getChild(0));
+  SoNormal          *theNormals         = (SoNormal *)           ( sep->getChild(1)); 
+  SoNormalBinding   *theNormalBinding   = (SoNormalBinding *)    ( sep->getChild(2));
+  SoIndexedFaceSet  *theFaceSet         = (SoIndexedFaceSet *)   ( sep->getChild(3));
+
+  const int NPHI=24, NPOINTS=2*(2*NPHI+2), NFACES=4*NPHI+2, NINDICES = NFACES*5;
+  float points[NPOINTS][3], normals[NFACES][3];
+#ifdef INVENTOR2_0
+  static long     indices[NINDICES];
+#else
+  static int32_t  indices[NINDICES];
+#endif
+  static int init=0;
+  double phi, pp, DeltaPhi;
+
+  // Indices need to be generated once! This is here to keep it close to the point
+  // generation, since otherwise it will be confusing.
+
+  int i;
+  if (!init) {
+    init = 1;
+    // Outer face
+    for (i = 0; i< NPHI; i++) {
+      // 0 1 3 2;
+      indices[5*i+0] =  2*i+0;
+      indices[5*i+1] =  2*i+1;
+      indices[5*i+2] =  2*i+3;
+      indices[5*i+3] =  2*i+2;
+      indices[5*i+4] = SO_END_FACE_INDEX;
+    }
+    // the inner face
+    for (i=0;i<NPHI;i++) {
+      indices[5*1*NPHI + 5*i+0] = 2*NPHI+2 + 2*i+0;  
+      indices[5*1*NPHI + 5*i+1] = 2*NPHI+2 + 2*i+1;
+      indices[5*1*NPHI + 5*i+2] = 2*NPHI+2 + 2*i+3;
+      indices[5*1*NPHI + 5*i+3] = 2*NPHI+2 + 2*i+2;
+      indices[5*1*NPHI + 5*i+4] = SO_END_FACE_INDEX;
+    }
+    // the top side
+    for (i=0;i<NPHI;i++) {
+      indices[5*2*NPHI + 5*i+0] = 2*i+0;
+      indices[5*2*NPHI + 5*i+1] = 2*i+2;
+      indices[5*2*NPHI + 5*i+2] = NPOINTS - (2*i+4);
+      indices[5*2*NPHI + 5*i+3] = NPOINTS - (2*i+2);
+      indices[5*2*NPHI + 5*i+4] = SO_END_FACE_INDEX;
+    }
+    // the bottom side
+    for (i=0;i<NPHI;i++) {
+      indices[5*3*NPHI + 5*i+0] = 2*i+1;
+      indices[5*3*NPHI + 5*i+1] = NPOINTS - (2*i+1);
+      indices[5*3*NPHI + 5*i+2] = NPOINTS - (2*i+3);
+      indices[5*3*NPHI + 5*i+3] = 2*i+3;
+      indices[5*3*NPHI + 5*i+4] = SO_END_FACE_INDEX;
+    }
+    // the odd side
+    indices[5*4*NPHI +0] = 2*NPHI;
+    indices[5*4*NPHI +1] = 2*NPHI+1;
+    indices[5*4*NPHI +2] = 2*NPHI+3;
+    indices[5*4*NPHI +3] = 2*NPHI+2;
+    indices[5*4*NPHI +4] = SO_END_FACE_INDEX;
+    // aother odd side
+    indices[5*4*NPHI +5 +0] = 0;
+    indices[5*4*NPHI +5 +1] = NPOINTS-2;
+    indices[5*4*NPHI +5 +2] = NPOINTS-1;
+    indices[5*4*NPHI +5 +3] = 1;
+    indices[5*4*NPHI +5 +4] = SO_END_FACE_INDEX;
+  }
+  // Points need to be generated each time:
+  // The outer surface
+  DeltaPhi = fDPhi.getValue()/NPHI, phi = fSPhi.getValue();
+  float  t,st,ct;
+  t = FATAN((fRmax2.getValue()-fRmax1.getValue())/(2*fDz.getValue()));
+  st = FSIN(t);
+  ct = FCOS(t);
+  for (i = 0; i<=NPHI; i++) {
+    points[2*i+0][0] = fRmax2.getValue()*FCOS(phi); 
+    points[2*i+0][1] = fRmax2.getValue()*FSIN(phi); 
+    points[2*i+0][2] = +fDz.getValue();
+    points[2*i+1][0] = fRmax1.getValue()*FCOS(phi); 
+    points[2*i+1][1] = fRmax1.getValue()*FSIN(phi); 
+    points[2*i+1][2] = -fDz.getValue();
+    pp = phi+DeltaPhi/2.0;
+    if (i!=NPHI) {
+      normals[i][0] = ct * FCOS(pp); 
+      normals[i][1] = ct * FSIN(pp); 
+      normals[i][2] = -st;
+    }
+    phi+=DeltaPhi;
+  }
+  // The inner surface
+  phi = fSPhi.getValue() + fDPhi.getValue();
+  t = FATAN((fRmin2.getValue()-fRmin1.getValue())/(2*fDz.getValue()));
+  st = FSIN(t);
+  ct = FCOS(t);
+  for (i = 0; i<=NPHI; i++) {
+    points[2*NPHI+2+2*i+0][0] = fRmin2.getValue()*FCOS(phi); 
+    points[2*NPHI+2+2*i+0][1] = fRmin2.getValue()*FSIN(phi); 
+    points[2*NPHI+2+2*i+0][2] = +fDz.getValue();
+    points[2*NPHI+2+2*i+1][0] = fRmin1.getValue()*FCOS(phi); 
+    points[2*NPHI+2+2*i+1][1] = fRmin1.getValue()*FSIN(phi); 
+    points[2*NPHI+2+2*i+1][2] = -fDz.getValue();
+    pp = phi-DeltaPhi/2.0;
+    if (i!=NPHI) {
+      normals[NPHI+i][0] = -ct*FCOS(pp); 
+      normals[NPHI+i][1] = -ct*FSIN(pp); 
+      normals[NPHI+i][2] = st;
+    }
+    phi-=DeltaPhi;
+  }
+  // The top side
+  for (i=0;i<NPHI;i++) {
+    normals[2*NPHI+i][0]=normals[2*NPHI+i][1]=0; 
+    normals[2*NPHI+i][2]=  1.0;
+  } 
+  // The bottom side
+  for (i=0;i<NPHI;i++) {
+    normals[3*NPHI+i][0]=normals[3*NPHI+i][1]=0; 
+    normals[3*NPHI+i][2]= -1.0;
+  } 
+  // The odd side
+  phi = fSPhi.getValue(); 
+  normals[4*NPHI+0][0]=  FSIN(phi); 
+  normals[4*NPHI+0][1]= -FCOS(phi); 
+  normals[4*NPHI+0][2]= 0;
+
+  // Another odd side
+  phi = fSPhi.getValue()+fDPhi.getValue(); 
+  normals[4*NPHI+1][0]= -FSIN(phi); 
+  normals[4*NPHI+1][1]= +FCOS(phi); 
+  normals[4*NPHI+1][2]=0;
+
+  for (int np=0;np<NPOINTS;np++) theCoordinates->point.set1Value(np,points[np][0],points[np][1],points[np][2]);
+  theFaceSet->coordIndex.setValues(0,NINDICES,indices);
+  if (smoothDraw.getValue()) {
+    //    This Line is replaced by the next one because of an apparent Bug in Inventor (mem. leak).
+    //    theNormals->vector.deleteValues(0);
+    for (int nf=0;nf<NFACES;nf++) theNormals->vector.set1Value(nf,normals[nf][0],normals[nf][1],normals[nf][2]);
+    theNormalBinding->value=SoNormalBinding::PER_FACE;
+  }
+  else {
+    for (int nf=0;nf<NFACES;nf++) theNormals->vector.set1Value(nf,normals[nf][0],normals[nf][1],normals[nf][2]);
+    theNormalBinding->value=SoNormalBinding::PER_FACE;
+  }
+}
+
+// generateChildren
+void SoCons::generateChildren() {
+
+  // This routines creates one SoSeparator, one SoCoordinate3, and
+  // one SoLineSet, and puts it in the child list.  This is done only
+  // once, whereas redrawing the position of the coordinates occurs each
+  // time an update is necessary, in the updateChildren routine. 
+
+  assert(children->getLength() ==0);
+  SoSeparator      *sep              = new SoSeparator(); 
+  SoCoordinate3    *theCoordinates   = new SoCoordinate3();
+  SoNormal         *theNormals       = new SoNormal(); 
+  SoNormalBinding  *theNormalBinding = new SoNormalBinding();
+  SoIndexedFaceSet *theFaceSet       = new SoIndexedFaceSet();
+  // 
+  // This line costs some in render quality! but gives speed.
+  // 
+  sep->addChild(theCoordinates);
+  sep->addChild(theNormals);
+  sep->addChild(theNormalBinding);
+  sep->addChild(theFaceSet);
+  children->append(sep);
+}
+
+// generateAlternateRep
+void SoCons::generateAlternateRep() {
+
+  // This routine sets the alternate representation to the child
+  // list of this mode.  
+
+  if (children->getLength() == 0) generateChildren();
+  updateChildren();
+  alternateRep.setValue((SoSeparator *)  ( *children)[0]);
+}
+
+// clearAlternateRep
+void SoCons::clearAlternateRep() {
+  alternateRep.setValue(NULL);
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/src/SoCounterAction.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/src/SoCounterAction.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/src/SoCounterAction.cc	(revision 1102)
@@ -0,0 +1,105 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+#ifdef G4VIS_BUILD_OI_DRIVER
+
+/*----------------------------HEPVis----------------------------------------*/
+/*                                                                          */
+/* Node:             SoCounterAction                                        */
+/* Author:           Guy Barrand                                            */
+/*                                                                          */
+/*--------------------------------------------------------------------------*/
+
+// this :
+#include <HEPVis/actions/SoCounterAction.h>
+
+#include <Inventor/nodes/SoNode.h>
+#include <Inventor/nodes/SoGroup.h>
+#include <Inventor/nodes/SoSwitch.h>
+#include <Inventor/nodekits/SoBaseKit.h>
+#include <Inventor/elements/SoSwitchElement.h>
+
+SO_ACTION_SOURCE(SoCounterAction)
+
+void SoCounterAction::initClass(void){
+  SO_ACTION_INIT_CLASS(SoCounterAction,SoAction);
+
+  SO_ENABLE(SoCounterAction,SoSwitchElement);
+
+  SO_ACTION_ADD_METHOD(SoNode,SoCounterAction::actionMethod);
+}
+SoCounterAction::SoCounterAction()
+:fCount(0),fLookFor(NODE),fCheckDerived(TRUE){
+  SO_ACTION_CONSTRUCTOR(SoCounterAction);
+}
+SoCounterAction::~SoCounterAction(){}
+void SoCounterAction::beginTraversal(SoNode* node){
+  fCount = 0;
+  SoAction::beginTraversal(node);
+}
+void SoCounterAction::actionMethod(SoAction* aThis,SoNode* aNode) {
+  //printf("debug : begin : %s %s\n",aNode->getName().getString(),
+    //aNode->getTypeId().getName().getString());
+  SoCounterAction* This = (SoCounterAction*)aThis;
+  if(This->fLookFor==NODE) {
+    This->fCount++;
+  } else if(This->fLookFor==TYPE) {
+    if(This->fCheckDerived==TRUE) {
+      if(aNode->getTypeId().isDerivedFrom(This->fType)) This->fCount++;
+    } else {
+      if(aNode->getTypeId()==This->fType) This->fCount++;
+    }
+  } else if(This->fLookFor==NAME) {
+    if(This->fName==aNode->getName()) This->fCount++;
+  }
+  if(aNode->isOfType(SoSwitch::getClassTypeId())) {
+    SoSwitch* sw = (SoSwitch*)aNode;
+    SbBool flag = sw->whichChild.enableNotify(FALSE);
+    int old = sw->whichChild.getValue();
+    sw->whichChild.setValue(SO_SWITCH_ALL);
+    aNode->doAction(aThis);
+    sw->whichChild.setValue(old);
+    sw->whichChild.enableNotify(flag);
+  } else if(aNode->isOfType(SoGroup::getClassTypeId())) {
+    aNode->doAction(aThis);
+  } else if(aNode->isOfType(SoBaseKit::getClassTypeId())) {
+    aNode->doAction(aThis);
+  }
+}
+void SoCounterAction::setLookFor(LookFor aLookFor) {
+  fLookFor = aLookFor;
+}
+void SoCounterAction::setType(const SoType aType,SbBool aCheckDerived) {
+  fType = aType;
+  fCheckDerived = aCheckDerived;
+}
+void SoCounterAction::setName(const SbName aName){
+  fName = aName;
+}
+int SoCounterAction::getCount() const {
+  return fCount;
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/src/SoDetectorTreeKit.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/src/SoDetectorTreeKit.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/src/SoDetectorTreeKit.cc	(revision 1102)
@@ -0,0 +1,243 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+//
+// $Id: SoDetectorTreeKit.cc,v 1.13 2006/06/29 21:22:51 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+/*-----------------------------HEPVis----------------------------------------*/
+/*                                                                           */
+/* Node:             SoDetectorTreeKit                                       */
+/* Description:      Represents a single sided silicon strip detector        */
+/* Author:           Joe Boudreau Nov 11 1996                                */
+/*                                                                           */
+/*---------------------------------------------------------------------------*/
+
+#ifdef G4VIS_BUILD_OI_DRIVER
+
+// this :
+#include "HEPVis/nodekits/SoDetectorTreeKit.h"
+
+#include <Inventor/SoPickedPoint.h>
+#include <Inventor/nodes/SoSeparator.h>
+#include <Inventor/nodes/SoPickStyle.h>
+#include <Inventor/nodes/SoDrawStyle.h>
+#include <Inventor/nodes/SoSwitch.h>
+#include <Inventor/nodes/SoMaterial.h>
+#include <Inventor/nodes/SoUnits.h>
+#include <Inventor/nodes/SoTransform.h>
+#include <Inventor/nodes/SoEventCallback.h>
+#include <Inventor/nodekits/SoSeparatorKit.h>
+#include <Inventor/nodekits/SoShapeKit.h>
+#include <Inventor/nodekits/SoAppearanceKit.h>
+#include <Inventor/nodekits/SoNodeKitListPart.h>
+#include <Inventor/nodekits/SoBaseKit.h>
+#include <Inventor/nodes/SoTexture2Transform.h>
+#include <Inventor/events/SoMouseButtonEvent.h>
+#include <Inventor/actions/SoHandleEventAction.h>
+
+#include <HEPVis/actions/SoAlternateRepAction.h>
+
+#include <cmath>
+
+// This statement is required
+SO_KIT_SOURCE(SoDetectorTreeKit)
+ 
+// initClass
+void SoDetectorTreeKit::initClass(){
+  SO_KIT_INIT_CLASS(SoDetectorTreeKit,SoBaseKit,"BaseKit");
+}
+
+// Constructor
+SoDetectorTreeKit::SoDetectorTreeKit() {
+  SO_KIT_CONSTRUCTOR(SoDetectorTreeKit);
+
+  SO_NODE_ADD_FIELD(alternateRep, (NULL));
+
+  SO_KIT_ADD_CATALOG_ENTRY     (     topSeparator,         SoSeparator, FALSE,          this,\0, FALSE);
+  SO_KIT_ADD_CATALOG_ENTRY     (        pickStyle,         SoSeparator, TRUE ,  topSeparator,\0, TRUE);
+  SO_KIT_ADD_CATALOG_ENTRY     (       appearance,     SoAppearanceKit, TRUE,  topSeparator ,\0, TRUE);
+  SO_KIT_ADD_CATALOG_ENTRY     (            units,             SoUnits, TRUE,  topSeparator ,\0, TRUE);
+  SO_KIT_ADD_CATALOG_ENTRY     (        transform,         SoTransform, TRUE ,  topSeparator,\0, TRUE);
+  SO_KIT_ADD_CATALOG_ENTRY     (texture2Transform, SoTexture2Transform, TRUE,  topSeparator ,\0, TRUE);
+  SO_KIT_ADD_CATALOG_ENTRY     (        childList,            SoSwitch, FALSE,  topSeparator,\0, FALSE);
+  SO_KIT_ADD_CATALOG_ENTRY     ( previewSeparator,         SoSeparator, FALSE,     childList,\0, TRUE);
+  SO_KIT_ADD_CATALOG_ENTRY     (    fullSeparator,         SoSeparator, FALSE,     childList,\0, TRUE);
+
+  SO_KIT_INIT_INSTANCE();
+  createInitialTree();
+}
+
+// Destructor
+SoDetectorTreeKit::~SoDetectorTreeKit() {
+}
+
+
+SbBool SoDetectorTreeKit::affectsState() const {
+  return FALSE;
+}
+
+void SoDetectorTreeKit::createInitialTree() {
+
+  SoEventCallback *myCallback = new SoEventCallback();
+  myCallback->addEventCallback(SoMouseButtonEvent::getClassTypeId(),
+                               SoDetectorTreeKit::expand,
+                               this);
+  myCallback->addEventCallback(SoMouseButtonEvent::getClassTypeId(),
+                               SoDetectorTreeKit::contract  ,
+                               this);
+  if(setPart("callbackList[0]",myCallback)==FALSE) myCallback->unref(); 
+
+  SoSwitch *theChildList = (SoSwitch *) childList.getValue();
+  theChildList->whichChild.setValue(0);
+}
+
+void SoDetectorTreeKit::expand(void *userData, SoEventCallback *eventCB){
+
+  // Was the event previously handled? Is it the right kind?
+
+  if (eventCB->isHandled()) return;
+  const SoMouseButtonEvent *event= (SoMouseButtonEvent *) eventCB->getEvent();
+  if (!SoMouseButtonEvent::isButtonPressEvent(event,SoMouseButtonEvent::BUTTON1)) return;
+  if (!event->wasCtrlDown()) return;
+  if (event->wasShiftDown()) return;
+
+  // Which Detector is this being called for?
+  SoDetectorTreeKit* This = (SoDetectorTreeKit *) userData;
+
+  // Find out whether that's the one that has been picked.  
+  // "This' is the lowest detector tree kit in the hierarchy.
+  SoHandleEventAction *handleEventAction = eventCB->getAction();
+  const SoPickedPoint *pickedPoint = handleEventAction->getPickedPoint();
+  if (!pickedPoint) return;
+
+  SoFullPath* path = (SoFullPath*)pickedPoint->getPath();
+  SoNode *ancestorNode=NULL;
+  for (int i=0;i<path->getLength();i++) {
+    ancestorNode  = path->getNodeFromTail(i);
+    if (ancestorNode->isOfType(SoDetectorTreeKit::getClassTypeId()))  break;
+  }
+  if (This!=ancestorNode) return;
+  //  if (!ancestorNode->isOfType(SoDetectorTreeKit::getClassTypeId())) return;
+ 
+  // Deactivate the Preview
+  This->setPreview(FALSE);
+  eventCB->setHandled();
+     
+}
+
+void SoDetectorTreeKit::contract(void *userData, SoEventCallback *eventCB){
+
+  // Was the event previously handled? Is it the right kind?
+  if (eventCB->isHandled()) return;
+  const SoMouseButtonEvent *event= (SoMouseButtonEvent *) eventCB->getEvent();
+  if (!SoMouseButtonEvent::isButtonPressEvent(event,SoMouseButtonEvent::BUTTON1)) return;
+  if (event->wasCtrlDown()) return;
+  if (!event->wasShiftDown()) return;
+
+  // Which Detector is this being called for?
+  SoDetectorTreeKit* This = (SoDetectorTreeKit *) userData;
+
+  // Find out whether that's the one that has been picked
+  SoHandleEventAction *handleEventAction = eventCB->getAction();
+  const SoPickedPoint *pickedPoint = handleEventAction->getPickedPoint();
+  if (!pickedPoint) return;
+ 
+  // Find out whether that's the one that has been picked.  
+  // "This" is the lowest detector tree kit in the hierarchy.
+  SoFullPath* path = (SoFullPath*)pickedPoint->getPath();
+  SoNode *ancestorNode=NULL;
+  SbBool firstTreeFound=FALSE;
+  for (int i=0;i<path->getLength();i++) {
+    ancestorNode  = path->getNodeFromTail(i);
+    if (ancestorNode->isOfType(SoDetectorTreeKit::getClassTypeId())) {
+      if (!firstTreeFound) {
+        if (This!=ancestorNode) return;
+        firstTreeFound=TRUE;
+      }
+      SoDetectorTreeKit *That = (SoDetectorTreeKit *) ancestorNode;
+      if (!That->getPreview()) {
+        That->setPreview(TRUE);
+        eventCB->setHandled();
+        return;
+      }
+    }
+  }
+}
+
+void SoDetectorTreeKit::setPreview(SbBool Flag) {
+  SoSwitch *theChildList = (SoSwitch *) childList.getValue();
+  if (Flag) {
+    theChildList->whichChild.setValue(0);
+  }
+  else {
+    theChildList->whichChild.setValue(1);
+  }
+}
+
+SbBool SoDetectorTreeKit::getPreview() const {
+  SoSwitch *theChildList = (SoSwitch *) childList.getValue();
+  if (theChildList->whichChild.getValue()==0) return TRUE;
+  return FALSE;
+}
+
+
+void SoDetectorTreeKit::setPreviewAndFull() {
+  SoSwitch *theChildList = (SoSwitch *) childList.getValue();
+  theChildList->whichChild.setValue(SO_SWITCH_ALL);
+}
+
+SoSeparator *SoDetectorTreeKit::getPreviewSeparator() const {
+  return (SoSeparator *) previewSeparator.getValue();
+}
+
+SoSeparator *SoDetectorTreeKit::getFullSeparator() const {
+  return (SoSeparator *) fullSeparator.getValue();
+}
+
+
+
+
+// generateAlternateRep
+void SoDetectorTreeKit::generateAlternateRep() {
+  alternateRep.setValue(topSeparator.getValue());
+}
+
+void SoDetectorTreeKit::clearAlternateRep() {
+  alternateRep.setValue(NULL);
+}
+//////////////////////////////////////////////////////////////////////////////
+void SoDetectorTreeKit::doAction(
+ SoAction* aAction
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  SO_ALTERNATEREP_DO_ACTION(aAction)
+  SoBaseKit::doAction(aAction);
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/src/SoGL2PSAction.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/src/SoGL2PSAction.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/src/SoGL2PSAction.cc	(revision 1102)
@@ -0,0 +1,166 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+#ifdef G4VIS_BUILD_OI_DRIVER
+
+/*----------------------------HEPVis----------------------------------------*/
+/*                                                                          */
+/* Node:             SoGL2PSAction                                          */
+/* Author:           Guy Barrand                                            */
+/*                                                                          */
+/*--------------------------------------------------------------------------*/
+
+// this :
+#include <HEPVis/actions/SoGL2PSAction.h>
+
+// Inventor :
+#include <Inventor/elements/SoViewportRegionElement.h>
+#include <Inventor/errors/SoDebugError.h>
+
+#include "Geant4_gl2ps.h"
+
+#include <stdio.h>
+
+SO_ACTION_SOURCE(SoGL2PSAction)
+//////////////////////////////////////////////////////////////////////////////
+void SoGL2PSAction::initClass(
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  SO_ACTION_INIT_CLASS(SoGL2PSAction,SoGLRenderAction);
+}
+//////////////////////////////////////////////////////////////////////////////
+SoGL2PSAction::SoGL2PSAction(
+ const SbViewportRegion& aViewPortRegion
+)
+:SoGLRenderAction(aViewPortRegion)
+,G4OpenGL2PSAction()
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  setFileName("out.ps");
+  SO_ACTION_CONSTRUCTOR(SoGL2PSAction);
+}
+
+bool SoGL2PSAction::enableFileWriting(
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+#ifdef G4DEBUG_VIS_OI
+    printf("SoGL2PSAction::enableFileWriting\n");
+#endif
+  fFile = ::fopen(fFileName,"w");
+  if(!fFile) {
+    SoDebugError::post("SoGL2PSAction::enableFileWriting",
+                       "Cannot open file %s",fFileName);
+    return false;
+  }
+#ifdef __COIN__
+#else //SGI
+  const SbViewportRegion& vpr = getViewportRegion();
+  SoViewportRegionElement::set(getState(),vpr);
+  G4gl2psBegin();
+#endif
+  return true;
+}
+//////////////////////////////////////////////////////////////////////////////
+void SoGL2PSAction::disableFileWriting(
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+#ifdef __COIN__
+#else //SGI
+  gl2psEndPage();        
+#endif
+  ::fclose(fFile);
+  fFile = 0;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+bool SoGL2PSAction::addBitmap(
+ int aWidth
+,int aHeight
+,float aXorig
+,float aYorig
+,float aXmove
+,float aYmove
+)
+/////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  if(!fFile) return false;
+  GLboolean valid;
+  glGetBooleanv(GL_CURRENT_RASTER_POSITION_VALID,&valid);
+  if(!valid) return false;
+  float pos[4];
+  glGetFloatv(GL_CURRENT_RASTER_POSITION,pos);
+  int xoff = -(int)(aXmove + aXorig);
+  int yoff = -(int)(aYmove + aYorig);
+  int x = (int)(pos[0] + xoff);
+  int y = (int)(pos[1] + yoff);
+  // Should clip against viewport area :
+  GLint vp[4];
+  glGetIntegerv(GL_VIEWPORT,vp);
+  GLsizei w = aWidth;
+  GLsizei h = aHeight;
+  if(x+w>(vp[0]+vp[2])) w = vp[0]+vp[2]-x;
+  if(y+h>(vp[1]+vp[3])) h = vp[1]+vp[3]-y;
+  int s = 3 * w * h;
+  if(s<=0) return false;
+  float* image = (float*)::malloc(s * sizeof(float));
+  if(!image) return false;
+  glReadPixels(x,y,w,h,GL_RGB,GL_FLOAT,image);
+  GLint status = gl2psDrawPixels(w,h,xoff,yoff,GL_RGB,GL_FLOAT,image);
+  ::free(image);
+  return (status!=GL2PS_SUCCESS ? false : true);
+}
+//////////////////////////////////////////////////////////////////////////////
+void SoGL2PSAction::beginTraversal(
+ SoNode* aNode
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  if(fFile) {
+#ifdef __COIN__
+    const SbViewportRegion& vpr = getViewportRegion();
+    SoViewportRegionElement::set(getState(),vpr);
+    G4gl2psBegin();
+    traverse(aNode);
+    gl2psEndPage();       
+#else //SGI
+    // Should have already do G4gl2psBegin() before
+    SoGLRenderAction::beginTraversal(aNode);
+    // Should do gl2psEndPage() after
+#endif
+  } else {
+    SoGLRenderAction::beginTraversal(aNode);
+  }
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/src/SoImageWriter.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/src/SoImageWriter.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/src/SoImageWriter.cc	(revision 1102)
@@ -0,0 +1,346 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+#ifdef G4VIS_BUILD_OI_DRIVER
+
+/*----------------------------HEPVis----------------------------------------*/
+/*                                                                          */
+/* Node:             SoImageWriter                                          */
+/* Author:           Guy Barrand                                            */
+/*                                                                          */
+/*--------------------------------------------------------------------------*/
+
+// this :
+#include <HEPVis/nodes/SoImageWriter.h>
+
+#include <Inventor/errors/SoDebugError.h>
+#include <Inventor/elements/SoViewportRegionElement.h>
+#include <Inventor/actions/SoGLRenderAction.h>
+
+#include <HEPVis/SbGL.h>
+#include <HEPVis/SbPainterPS.h>
+//#include <HEPVis/SbGIF.h>
+
+#include <stdlib.h>
+
+typedef struct {
+  unsigned char red;
+  unsigned char green;
+  unsigned char blue;
+} Pixel;
+typedef unsigned char Uchar;
+
+//static void getImagePixels(int,int,float*,int&,
+//                         Uchar*&,Uchar*&,Uchar*&,Uchar*&);
+
+static int sWidth = 0;
+static int sHeight = 0;
+static float* sImage = 0;
+static int getRGB(unsigned int,unsigned int,double&,double&,double&);
+
+SO_NODE_SOURCE(SoImageWriter)
+//////////////////////////////////////////////////////////////////////////////
+void SoImageWriter::initClass (
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  SO_NODE_INIT_CLASS(SoImageWriter,SoNode,"Node");
+}
+//////////////////////////////////////////////////////////////////////////////
+SoImageWriter::SoImageWriter(
+)
+:fEnabled(FALSE)
+,fStatus(FALSE)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  SO_NODE_CONSTRUCTOR(SoImageWriter);
+  //SO_NODE_ADD_FIELD(format,(POST_SCRIPT));
+  SO_NODE_ADD_FIELD(fileName,("out.ps"));
+  
+  //SO_NODE_DEFINE_ENUM_VALUE(Format,POST_SCRIPT);
+  //SO_NODE_DEFINE_ENUM_VALUE(Format,GIF);
+  
+  //SO_NODE_SET_SF_ENUM_TYPE(format,Format);
+}
+//////////////////////////////////////////////////////////////////////////////
+SoImageWriter::~SoImageWriter (
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+}
+//////////////////////////////////////////////////////////////////////////////
+void SoImageWriter::enable(
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  fEnabled = TRUE;
+}
+//////////////////////////////////////////////////////////////////////////////
+void SoImageWriter::disable(
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  fEnabled = FALSE;
+}
+//////////////////////////////////////////////////////////////////////////////
+SbBool SoImageWriter::getStatus(
+) const
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  return fStatus;
+}
+//////////////////////////////////////////////////////////////////////////////
+void SoImageWriter::GLRender(
+ SoGLRenderAction* aAction
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  fStatus = FALSE;
+  //printf("debug : SoImageWriter::GLRender : enabled : %d\n",fEnabled);
+  if(!fEnabled) return;
+  SbViewportRegion vpr = SoViewportRegionElement::get(aAction->getState());
+  const SbVec2s& win = vpr.getWindowSize();
+  int w = win[0];
+  int h = win[1];
+  if((w*h)<=0) {
+    SoDebugError::postInfo("SoImageWriter::GLRender","null area window !");
+    return;
+  }
+
+  int x = 0;
+  int y = 0;
+  int s = 3 * w * h;
+  float* image = new float[s];
+  if(!image) return;
+
+  //printf("debug : SoImageWriter::GLRender : %d %d %d %d\n",x,y,w,h);
+
+  //glReadPixels(x,y,w,h,GL_RGB,GL_UNSIGNED_BYTE,image); Don't work !
+  glReadPixels(x,y,w,h,GL_RGB,GL_FLOAT,image);
+
+  //Format fm = (Format)format.getValue();
+  //if(fm==GIF) {  
+/*
+    FILE* file = fopen(fileName.getValue().getString(),"wb");
+    if(!file) {
+      SoDebugError::postInfo("SoImageWriter::GLRender",
+        "can't open file \"%s\".",fileName.getValue().getString());
+    } else {
+      int coln;
+      Uchar* rs;
+      Uchar* gs;
+      Uchar* bs;
+      Uchar* data;
+      getImagePixels(w,h,image,coln,rs,gs,bs,data);
+      
+      SbGIF::putBytesInStream(file,data,w,h,coln,rs,gs,bs);
+      
+      delete [] data;
+
+      if(rs) free(rs);
+      if(gs) free(gs);
+      if(bs) free(bs);
+
+      fclose(file);
+
+      fStatus = TRUE;
+    }
+  } else {
+*/
+
+    SbPainterPS painterPS;
+    painterPS.openFileForWriting(fileName.getValue().getString());
+    if(!painterPS.getStream()) {
+      SoDebugError::postInfo("SoImageWriter::GLRender",
+        "can't open file \"%s\".",fileName.getValue().getString());
+    } else {
+      painterPS.setWindowSize(w,h);
+      //painterPS.setBitsPerPixel(8);
+      painterPS.setBitsPerPixel(4);
+      painterPS.beginTraversal();
+      painterPS.clearColorBuffer(1.,1.,1.);
+
+      sWidth = w;
+      sHeight = h;
+      sImage = image;
+      painterPS.putImageInStream((unsigned int)w,(unsigned int)h,getRGB);
+      
+      painterPS.endTraversal();
+      
+      painterPS.closeStream();
+      
+      fStatus = TRUE;
+    }
+  //}
+  delete [] image;
+
+}
+/*
+//////////////////////////////////////////////////////////////////////////////
+void getImagePixels (
+ int aWidth
+,int aHeight
+,float* aImage
+,int& aColorn
+,Uchar*& aReds
+,Uchar*& aGreens
+,Uchar*& aBlues
+,Uchar*& aData
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  aColorn = 0;
+  aReds = 0;
+  aGreens = 0;
+  aBlues = 0;
+  aData = 0;
+  if( (aWidth * aHeight) <=0) return;
+  int size = 256;
+  Uchar* rs = (Uchar*)malloc(size * sizeof(Uchar));
+  Uchar* gs = (Uchar*)malloc(size * sizeof(Uchar));
+  Uchar* bs = (Uchar*)malloc(size * sizeof(Uchar));
+  Uchar* data = new Uchar[aWidth * aHeight];
+  if( !rs || !gs || !bs || !data ) {
+    if(rs) free(rs);
+    if(gs) free(gs);
+    if(bs) free(bs);
+    delete [] data;
+    return;
+  }
+  int pixeln = 0;
+  int row,col;
+  Uchar red,green,blue;
+  Uchar ored = 0,ogreen = 0,oblue = 0;
+  float* pimag = aImage;
+  Uchar* pdata = 0;
+  Uchar index = 0;
+  int status = 0;
+  for(row=0;row<aHeight;row++) {
+    pdata = data + (aHeight - 1 - row) * aWidth;
+    for(col=0;col<aWidth;col++){ 
+      red   = (Uchar)(255 * (*pimag));pimag++;
+      green = (Uchar)(255 * (*pimag));pimag++;
+      blue  = (Uchar)(255 * (*pimag));pimag++;
+      //printf("debug : %d %d : %d %d %d\n",row,col,red,green,blue);
+      if( (pixeln==0) || (red!=ored) || (green!=ogreen) || (blue!=oblue) ){
+        // Search exact color :
+        int found = 0;
+        for(int count=0;count<pixeln;count++){
+          if( (red==rs[count]) && (green==gs[count]) && (blue==bs[count]) ){
+            found = 1;
+            index = count;
+            break;
+          }
+        }
+        if(found==0){
+          if(pixeln>=256) {
+            // We can't store more than 256 on an Uchar.
+            // Search closest color :
+            int dr,dg,db;
+            int PRECISION = 20;
+            int closest = 0;
+            for(int count=0;count<pixeln;count++){
+              dr = red   - rs[count];dr = dr<0 ? -dr : dr;
+              dg = green - gs[count];dg = dg<0 ? -dg : dg;
+              db = blue  - bs[count];db = db<0 ? -db : db;
+              if( (dr<=PRECISION) && (dg<=PRECISION) && (db<=PRECISION) ){
+                closest = 1;
+                index = count;
+                break;
+              }
+            }
+            if(closest==0) {
+              index = 0;
+              status  = 1;
+            }
+          } else {
+            if(pixeln>=size){
+              size += 256;
+              rs = (Uchar*)realloc(rs,size * sizeof(Uchar));
+              gs = (Uchar*)realloc(gs,size * sizeof(Uchar));
+              bs = (Uchar*)realloc(bs,size * sizeof(Uchar));
+              if( !rs || !gs || !bs ) {
+                if(rs) free(rs);
+                if(gs) free(gs);
+                if(bs) free(bs);
+                delete [] data;
+                return;
+              } 
+            } 
+            //printf("debug : SoImageWriter pixeln %d : %d %d %d\n",
+            //   pixeln,red,green,blue);
+            rs[pixeln] = red;
+            gs[pixeln] = green;
+            bs[pixeln] = blue;
+            index = pixeln;
+            pixeln++;
+          }
+        }
+      }
+      *pdata = index;
+      pdata++;
+      ored = red;
+      ogreen = green;
+      oblue = blue;
+    }
+  }
+  if(status==1) 
+    printf("SoImageWriter : more than 256 colors in picture ; some colors approximated.\n");
+  aColorn = pixeln;
+  aReds = rs;
+  aGreens = gs;
+  aBlues = bs;
+  aData = data;
+}
+*/
+//////////////////////////////////////////////////////////////////////////////
+int getRGB(
+ unsigned int aX
+,unsigned int aY
+,double& aRed
+,double& aGreen
+,double& aBlue
+)
+//////////////////////////////////////////////////////////////////////////////
+// OpenGL image is from down to up.
+// PS image is up to down.
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  float* pimag = sImage + 3 * (sWidth * (sHeight - 1 - aY) + aX);
+  aRed   = *pimag;pimag++;
+  aGreen = *pimag;pimag++;
+  aBlue  = *pimag;pimag++;
+  return 1;
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/src/SoMarkerSet.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/src/SoMarkerSet.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/src/SoMarkerSet.cc	(revision 1102)
@@ -0,0 +1,793 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+#ifdef G4VIS_BUILD_OI_DRIVER
+
+/*----------------------------HEPVis----------------------------------------*/
+/*                                                                          */
+/* Node:             SoMarkerSet                                            */
+/* Author:           Guy Barrand                                            */
+/*                                                                          */
+/*--------------------------------------------------------------------------*/
+
+// this :
+#include <HEPVis/nodes/SoMarkerSet.h>
+
+#include <Inventor/errors/SoDebugError.h>
+#include <Inventor/misc/SoState.h>
+#include <Inventor/actions/SoGLRenderAction.h>
+#include <Inventor/nodes/SoPointSet.h>
+
+#include <Inventor/elements/SoCoordinateElement.h>
+#include <Inventor/elements/SoCacheElement.h>
+#include <Inventor/elements/SoLazyElement.h>
+
+#include <HEPVis/SbGL.h>
+#include <HEPVis/actions/SoGL2PSAction.h>
+
+static void drawMarker(SoAction*,int);
+static GLubyte* getBitmap(int,int,char []); 
+
+/* 
+  "  x  "
+  "  x  "
+  "xxxxx"
+  "  x  "
+  "  x  "
+
+  Should produce bitmap :
+  0x20,0x20,0xf8,0x20,0x20
+
+  The rows will be rendered down to top ; first row at bottom, last at top.
+  In the below, '-' means that glBitmap will move the pointer to next byte.
+
+  32103210 32103210 32103210 32103210 32103210
+  ..1..--- ..1..--- 11111--- ..1..--- ..1..---
+
+  0x20     0x20     0xf8     0x20     0x20
+*/
+
+///////////////////////////////////////////////////////////////
+/// 5 5 ///////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////
+static char plus_5_5[] = {
+  "  x  "
+  "  x  "
+  "xxxxx"
+  "  x  "
+  "  x  "
+};
+static char asterisk_5_5[] = {
+  "x x x"
+  " xxx "
+  "  x  "
+  " xxx "
+  "x x x"
+};
+static char cross_5_5[] = {
+  "x   x"
+  " x x "
+  "  x  "
+  " x x "
+  "x   x"
+};
+static char star_5_5[] = {
+  "x x x"
+  " xxx "
+  "xxxxx"
+  " xxx "
+  "x x x"
+};
+static char circle_line_5_5[] = {
+  " xxx "
+  "x   x"
+  "x   x"
+  "x   x"
+  " xxx "
+};       
+static char circle_filled_5_5[] = {
+  " xxx "
+  "xxxxx"
+  "xxxxx"
+  "xxxxx"
+  " xxx "
+};       
+static char triangle_up_line_5_5[] = { //OpenGL will draw with y reversed.
+  "xxxxx"
+  " x x "
+  " x x "
+  "  x  "
+  "  x  "
+};
+static char triangle_up_filled_5_5[] = {
+  "xxxxx"
+  " xxx "
+  " xxx "
+  "  x  "
+  "  x  "
+};
+static char triangle_down_line_5_5[] = {
+  "  x  "
+  "  x  "
+  " x x "
+  " x x "
+  "xxxxx"
+};
+static char triangle_down_filled_5_5[] = {
+  "  x  "
+  "  x  "
+  " xxx "
+  " xxx "
+  "xxxxx"
+};
+static char david_star_line_5_5[] = {
+  "  x  "
+  "xxxxx"
+  " x x "
+  "xxxxx"
+  "  x  "
+};       
+static char david_star_filled_5_5[] = {
+  "  x  "
+  "xxxxx"
+  " xxx "
+  "xxxxx"
+  "  x  "
+};       
+static char swiss_cross_line_5_5[] = {
+  " xxx "
+  "xx xx"
+  "x   x"
+  "xx xx"
+  " xxx "
+};       
+static char swiss_cross_filled_5_5[] = {
+  " xxx "
+  "xxxxx"
+  "xxxxx"
+  "xxxxx"
+  " xxx "
+};       
+static char diamond_line_5_5[] = {
+  "  x  "
+  " x x "
+  "x   x"
+  " x x "
+  "  x  "
+};
+static char diamond_filled_5_5[] = {
+  "  x  "
+  " xxx "
+  "xxxxx"
+  " xxx "
+  "  x  "
+};
+static char square_line_5_5[] = {
+  "xxxxx"
+  "x   x"
+  "x   x"
+  "x   x"
+  "xxxxx"
+};
+static char square_filled_5_5[] = {
+  "xxxxx"
+  "xxxxx"
+  "xxxxx"
+  "xxxxx"
+  "xxxxx"
+};
+///////////////////////////////////////////////////////////////
+/// 7 7 ///////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////
+static char plus_7_7[] = {
+  "   x   "
+  "   x   "
+  "   x   "
+  "xxxxxxx"
+  "   x   "
+  "   x   "
+  "   x   "
+};
+static char asterisk_7_7[] = {
+  "x  x  x"
+  " x x x "
+  "  xxx  "
+  "   x   "
+  "  xxx  "
+  " x x x "
+  "x  x  x"
+};
+static char cross_7_7[] = {
+  "x     x"
+  " x   x "
+  "  xxx  "
+  "   x   "
+  "  xxx  "
+  " x   x "
+  "x     x"
+};
+static char star_7_7[] = {
+  "x  x  x"
+  " x x x "
+  "  xxx  "
+  "xxxxxxx"
+  "  xxx  "
+  " x x x "
+  "x  x  x"
+};
+static char circle_line_7_7[] = {
+  " xxxxx "
+  "x     x"
+  "x     x"
+  "x     x"
+  "x     x"
+  "x     x"
+  " xxxxx "
+};       
+static char circle_filled_7_7[] = {
+  " xxxxx "
+  "xxxxxxx"
+  "xxxxxxx"
+  "xxxxxxx"
+  "xxxxxxx"
+  "xxxxxxx"
+  " xxxxx "
+};       
+static char triangle_up_line_7_7[] = { //OpenGL will draw with y reversed.
+  "xxxxxxx"
+  " x   x "
+  " x   x "
+  "  x x  "
+  "  x x  "
+  "   x   "
+  "   x   "
+};
+static char triangle_up_filled_7_7[] = {
+  "xxxxxxx"
+  " xxxxx "
+  " xxxxx "
+  "  xxx  "
+  "  xxx  "
+  "   x   "
+  "   x   "
+};
+static char triangle_down_line_7_7[] = {
+  "   x   "
+  "   x   "
+  "  x x  "
+  "  x x  "
+  " x   x "
+  " x   x "
+  "xxxxxxx"
+};
+static char triangle_down_filled_7_7[] = {
+  "   x   "
+  "   x   "
+  "  xxx  "
+  "  xxx  "
+  " xxxxx "
+  " xxxxx "
+  "xxxxxxx"
+};
+static char david_star_line_7_7[] = {
+  "   x   "
+  "xxxxxxx"
+  " x   x "
+  "  x x  "
+  " x   x "
+  "xxxxxxx"
+  "   x   "
+};       
+static char david_star_filled_7_7[] = {
+  "   x   "
+  "xxxxxxx"
+  " xxxxx "
+  "  xxx  "
+  " xxxxx "
+  "xxxxxxx"
+  "   x   "
+};       
+static char swiss_cross_line_7_7[] = {
+  "  xxx  "
+  "  x x  "
+  "xxx xxx"
+  "x     x"
+  "xxx xxx"
+  "  x x  "
+  "  xxx  "
+};       
+static char swiss_cross_filled_7_7[] = {
+  "  xxx  "
+  "  xxx  "
+  "xxxxxxx"
+  "xxxxxxx"
+  "xxxxxxx"
+  "  xxx  "
+  "  xxx  "
+};       
+static char diamond_line_7_7[] = {
+  "   x   "
+  "  x x  "
+  " x   x "
+  "x     x"
+  " x   x "
+  "  x x  "
+  "   x   "
+};
+static char diamond_filled_7_7[] = {
+  "   x   "
+  "  xxx  "
+  " xxxxx "
+  "xxxxxxx"
+  " xxxxx "
+  "  xxx  "
+  "   x   "
+};
+static char square_line_7_7[] = {
+  "xxxxxxx"
+  "x     x"
+  "x     x"
+  "x     x"
+  "x     x"
+  "x     x"
+  "xxxxxxx"
+};
+static char square_filled_7_7[] = {
+  "xxxxxxx"
+  "xxxxxxx"
+  "xxxxxxx"
+  "xxxxxxx"
+  "xxxxxxx"
+  "xxxxxxx"
+  "xxxxxxx"
+};
+
+///////////////////////////////////////////////////////////////
+/// 9 9 ///////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////
+static char plus_9_9[] = {
+  "    x    "
+  "    x    "
+  "    x    "
+  "    x    "
+  "xxxxxxxxx"
+  "    x    "
+  "    x    "
+  "    x    "
+  "    x    "
+};
+static char asterisk_9_9[] = {
+  "x   x   x"
+  " x  x  x "
+  "  x x x  "
+  "   xxx   "
+  "    x    "
+  "   xxx   "
+  "  x x x  "
+  " x  x  x "
+  "x   x   x"
+};
+static char cross_9_9[] = {
+  "x       x"
+  " x     x "
+  "  x   x  "
+  "   x x   "
+  "    x    "
+  "   x x   "
+  "  x   x  "
+  " x     x "
+  "x       x"
+};
+static char star_9_9[] = {
+  "x   x   x"
+  " x  x  x "
+  "  x x x  "
+  "   xxx   "
+  "xxxxxxxxx"
+  "   xxx   "
+  "  x x x  "
+  " x  x  x "
+  "x   x   x"
+};
+static char circle_line_9_9[] = {
+  "   xxx   "
+  " xx   xx "
+  " x     x "
+  "x       x"
+  "x       x"
+  "x       x"
+  " x     x "
+  " xx   xx "
+  "   xxx   "
+};       
+static char circle_filled_9_9[] = {
+  "   xxx   "
+  " xxxxxxx "
+  " xxxxxxx "
+  "xxxxxxxxx"
+  "xxxxxxxxx"
+  "xxxxxxxxx"
+  " xxxxxxx "
+  " xxxxxxx "
+  "   xxx   "
+};       
+static char triangle_up_line_9_9[] = { //OpenGL will draw with y reversed.
+  "xxxxxxxxx"
+  " x     x "
+  " x     x "
+  "  x   x  "
+  "  x   x  "
+  "   x x   "
+  "   x x   "
+  "    x    "
+  "    x    "
+};
+static char triangle_up_filled_9_9[] = {
+  "xxxxxxxxx"
+  " xxxxxxx "
+  " xxxxxxx "
+  "  xxxxx  "
+  "  xxxxx  "
+  "   xxx   "
+  "   xxx   "
+  "    x    "
+  "    x    "
+};
+static char triangle_down_line_9_9[] = {
+  "    x    "
+  "    x    "
+  "   x x   "
+  "   x x   "
+  "  x   x  "
+  "  x   x  "
+  " x     x "
+  " x     x "
+  "xxxxxxxxx"
+};
+static char triangle_down_filled_9_9[] = {
+  "    x    "
+  "    x    "
+  "   xxx   "
+  "   xxx   "
+  "  xxxxx  "
+  "  xxxxx  "
+  " xxxxxxx "
+  " xxxxxxx "
+  "xxxxxxxxx"
+};
+static char david_star_line_9_9[] = {
+  "    x    "
+  "   x x   "
+  "xxxxxxxxx"
+  " x     x "
+  "  x   x  "
+  " x     x "
+  "xxxxxxxxx"
+  "   x x   "
+  "    x    "
+};       
+static char david_star_filled_9_9[] = {
+  "    x    "
+  "   xxx   "
+  "xxxxxxxxx"
+  " xxxxxxx "
+  "  xxxxx  "
+  " xxxxxxx "
+  "xxxxxxxxx"
+  "   xxx   "
+  "    x    "
+};       
+static char swiss_cross_line_9_9[] = {
+  "   xxx   "
+  "   x x   "
+  "   x x   "
+  "xxxx xxxx"
+  "x       x"
+  "xxxx xxxx"
+  "   x x   "
+  "   x x   "
+  "   xxx   "
+};       
+static char swiss_cross_filled_9_9[] = {
+  "   xxx   "
+  "   xxx   "
+  "   xxx   "
+  "xxxxxxxxx"
+  "xxxxxxxxx"
+  "xxxxxxxxx"
+  "   xxx   "
+  "   xxx   "
+  "   xxx   "
+};       
+static char diamond_line_9_9[] = {
+  "    x    "
+  "   x x   "
+  "  x   x  "
+  " x     x "
+  "x       x"
+  " x     x "
+  "  x   x  "
+  "   x x   "
+  "    x    "
+};
+static char diamond_filled_9_9[] = {
+  "    x    "
+  "   xxx   "
+  "  xxxxx  "
+  " xxxxxxx "
+  "xxxxxxxxx"
+  " xxxxxxx "
+  "  xxxxx  "
+  "   xxx   "
+  "    x    "
+};
+static char square_line_9_9[] = {
+  "xxxxxxxxx"
+  "x       x"
+  "x       x"
+  "x       x"
+  "x       x"
+  "x       x"
+  "x       x"
+  "x       x"
+  "xxxxxxxxx"
+};
+static char square_filled_9_9[] = {
+  "xxxxxxxxx"
+  "xxxxxxxxx"
+  "xxxxxxxxx"
+  "xxxxxxxxx"
+  "xxxxxxxxx"
+  "xxxxxxxxx"
+  "xxxxxxxxx"
+  "xxxxxxxxx"
+  "xxxxxxxxx"
+};
+
+static char* sFigures[54] = {
+ plus_5_5,   //0
+ asterisk_5_5,
+ cross_5_5,
+ star_5_5,
+ circle_line_5_5,
+ circle_filled_5_5,
+ triangle_up_line_5_5,
+ triangle_up_filled_5_5,
+ triangle_down_line_5_5,
+ triangle_down_filled_5_5,
+ david_star_line_5_5,
+ david_star_filled_5_5,
+ swiss_cross_line_5_5,
+ swiss_cross_filled_5_5,
+ diamond_line_5_5,
+ diamond_filled_5_5,
+ square_line_5_5,
+ square_filled_5_5, //17
+ plus_7_7,
+ asterisk_7_7,
+ cross_7_7,
+ star_7_7,
+ circle_line_7_7,
+ circle_filled_7_7,
+ triangle_up_line_7_7,
+ triangle_up_filled_7_7,
+ triangle_down_line_7_7,
+ triangle_down_filled_7_7,
+ david_star_line_7_7,
+ david_star_filled_7_7,
+ swiss_cross_line_7_7,
+ swiss_cross_filled_7_7,
+ diamond_line_7_7,
+ diamond_filled_7_7,
+ square_line_7_7,
+ square_filled_7_7, //35
+ plus_9_9,
+ asterisk_9_9,
+ cross_9_9,
+ star_9_9,
+ circle_line_9_9,
+ circle_filled_9_9,
+ triangle_up_line_9_9,
+ triangle_up_filled_9_9,
+ triangle_down_line_9_9,
+ triangle_down_filled_9_9,
+ david_star_line_9_9,
+ david_star_filled_9_9,
+ swiss_cross_line_9_9,
+ swiss_cross_filled_9_9,
+ diamond_line_9_9,
+ diamond_filled_9_9,
+ square_line_9_9,
+ square_filled_9_9 //53
+};
+
+SO_NODE_SOURCE(HEPVis_SoMarkerSet)
+//////////////////////////////////////////////////////////////////////////////
+void HEPVis_SoMarkerSet::initClass (
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  SO_NODE_INIT_CLASS(HEPVis_SoMarkerSet,SoPointSet,"PointSet");
+}
+//////////////////////////////////////////////////////////////////////////////
+HEPVis_SoMarkerSet::HEPVis_SoMarkerSet (
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  SO_NODE_CONSTRUCTOR(HEPVis_SoMarkerSet);
+  
+  SO_NODE_ADD_FIELD(markerIndex,(CROSS_5_5));
+}
+//////////////////////////////////////////////////////////////////////////////
+HEPVis_SoMarkerSet::~HEPVis_SoMarkerSet (
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+}
+//////////////////////////////////////////////////////////////////////////////
+void HEPVis_SoMarkerSet::GLRender (
+ SoGLRenderAction* aAction
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  SoState* state = aAction->getState();
+
+  const SoCoordinateElement* coordinateElement = 
+    SoCoordinateElement::getInstance(state);
+  if(coordinateElement==NULL) return;
+
+  if(aAction->isOfType(SoGL2PSAction::getClassTypeId())) {
+    SoCacheElement::invalidate(state);
+  }
+
+  const SbColor& color = SoLazyElement::getDiffuse(aAction->getState(),0);
+  float red,green,blue;
+  color.getValue(red,green,blue);
+
+  int mark = markerIndex[0];
+
+  int starti = startIndex.getValue();
+  int pointn = numPoints.getValue();
+  int pointi;
+
+  glPushAttrib( (GLbitfield)(GL_CURRENT_BIT | GL_ENABLE_BIT));
+  glDisable(GL_LIGHTING);
+  glColor3f(red,green,blue);
+
+#ifdef WIN32  
+  //WIN32 : depth test is out over bitmap !
+  glDisable(GL_DEPTH_TEST);
+#endif
+
+  glPixelStorei(GL_UNPACK_ALIGNMENT,1);
+  for(pointi=starti;pointi<pointn;pointi++){
+    const SbVec3f& vec = coordinateElement->get3(pointi);
+    glRasterPos3f(vec[0],vec[1],vec[2]);
+    // Do a push, pop to correct a deffect of Mesa-3.1. 
+    // If not, further line drawing will have bad colors.
+    // The glPopAttrib will compell a reinitialisation of
+    // some internal Mesa state.
+    //glPushAttrib(GL_ALL_ATTRIB_BITS);
+    //glPopAttrib();
+    //
+    drawMarker(aAction,mark);
+  }
+
+  glPopAttrib();
+}
+//////////////////////////////////////////////////////////////////////////////
+void drawMarker(
+ SoAction* aAction
+,int aStyle
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  GLsizei w = 0,h = 0;
+  GLfloat xorig = 0,yorig = 0;
+  GLfloat xmove = 0,ymove = 0;
+
+  if((aStyle>=0)&&(aStyle<18)) {
+    w = h = 5;
+    xorig = yorig = 2;
+  } else if((aStyle>=18)&&(aStyle<36)) {
+    w = h = 7;
+    xorig = yorig = 3;
+  } else if((aStyle>=36)&&(aStyle<54)) {
+    w = h = 9;
+    xorig = yorig = 4;
+  } else {
+    return;
+  }
+  if (w != 0) {
+    GLubyte* bitmap = getBitmap(w,h,sFigures[aStyle]);
+    glBitmap(w,h,xorig,yorig,0.,0.,bitmap);
+    delete bitmap;
+  }
+#ifdef G4DEBUG_VIS_OI
+  printf("DM %d %d %f %f",w,h,xorig,yorig);
+#endif
+
+  if(aAction->isOfType(SoGL2PSAction::getClassTypeId())) {
+#ifdef G4DEBUG_VIS_OI
+    printf(" GL2PS ");
+#endif
+    ((SoGL2PSAction*)aAction)->addBitmap(w-2,h-2,xorig,yorig,xmove,ymove);
+  }
+
+}
+//////////////////////////////////////////////////////////////////////////////
+GLubyte* getBitmap(
+ int aW
+,int aH
+,char aFigure[]
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  int index = 0;
+  GLubyte* bitmap = new GLubyte[aW * aH + 1];
+  int ichar = 0;
+  int ibit = 0;
+  unsigned char byte = 0;
+  for ( int row = 0; row < aH; row++ ){
+    for ( int col = 0; col < aW; col++){ 
+      unsigned char c = aFigure[ichar];
+      ichar++;
+      if(c==' ') {
+        ibit++;
+      } else { 
+        byte += (1<<(7-ibit));
+        ibit++;
+      }
+      if(ibit==8) {
+        //unsigned char h = byte / 16;
+        //unsigned char l = byte % 16;
+        //printf("0x%x%x\n",h,l);
+        bitmap[index] = byte;
+        index++;
+        ibit = 0;
+        byte = 0;
+      }
+
+    }
+    if(ibit!=8) { //Jump to next byte.
+      //unsigned char h = byte / 16;
+      //unsigned char l = byte % 16;
+      //printf("0x%x%x\n",h,l);
+      bitmap[index] = byte;
+      index++;
+      ibit = 0;
+      byte = 0;
+    }
+  }
+  return bitmap; 
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/src/SoPolyhedron.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/src/SoPolyhedron.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/src/SoPolyhedron.cc	(revision 1102)
@@ -0,0 +1,563 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+#ifdef G4VIS_BUILD_OI_DRIVER
+
+/*----------------------------HEPVis----------------------------------------*/
+/*                                                                          */
+/* Node:             SoPolyhedron                                           */
+/* Description:      SoNode to represent HepPolyhedron                      */
+/* Author:           Guy Barrand                                            */
+/*                                                                          */
+/*--------------------------------------------------------------------------*/
+
+// this :
+#include "Geant4_SoPolyhedron.h"
+
+#include <Inventor/SbBox.h>
+#include <Inventor/actions/SoAction.h>
+#include <Inventor/SoPrimitiveVertex.h>
+#include <Inventor/elements/SoTextureCoordinateElement.h>
+#include <Inventor/nodes/SoSeparator.h>
+
+//#include <HEPVis/SbMath.h>
+#define SbMinimum(a,b) ((a)<(b)?a:b)
+#define SbMaximum(a,b) ((a)>(b)?a:b)
+
+#include <HEPVis/actions/SoAlternateRepAction.h>
+
+#include "G4Polyhedron.hh"
+
+//typedef SbVec3f HVPoint3D;
+//typedef SbVec3f HVNormal3D;
+
+typedef HepGeom::Point3D<double> HVPoint3D;
+typedef HepGeom::Normal3D<double> HVNormal3D;
+
+SO_NODE_SOURCE(Geant4_SoPolyhedron) 
+//////////////////////////////////////////////////////////////////////////////
+void Geant4_SoPolyhedron::initClass(
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  SO_NODE_INIT_CLASS(Geant4_SoPolyhedron,SoShape,"Shape");
+}
+//////////////////////////////////////////////////////////////////////////////
+Geant4_SoPolyhedron::Geant4_SoPolyhedron(
+)
+:fPolyhedron(0)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  SO_NODE_CONSTRUCTOR(Geant4_SoPolyhedron);
+  SO_NODE_ADD_FIELD(solid,(TRUE));
+  SO_NODE_ADD_FIELD(reducedWireFrame,(TRUE));
+  SO_NODE_ADD_FIELD(alternateRep,(NULL));
+}
+//////////////////////////////////////////////////////////////////////////////
+Geant4_SoPolyhedron::Geant4_SoPolyhedron(
+ const G4Polyhedron& aPolyhedron
+)
+:fPolyhedron(0)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  SO_NODE_CONSTRUCTOR(Geant4_SoPolyhedron);
+  SO_NODE_ADD_FIELD(solid,(TRUE));
+  SO_NODE_ADD_FIELD(reducedWireFrame,(TRUE));
+  SO_NODE_ADD_FIELD(alternateRep,(NULL));
+
+  fPolyhedron = new G4Polyhedron(aPolyhedron);
+}
+//////////////////////////////////////////////////////////////////////////////
+Geant4_SoPolyhedron::Geant4_SoPolyhedron(
+ G4Polyhedron* aPolyhedron
+)
+:fPolyhedron(aPolyhedron)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  SO_NODE_CONSTRUCTOR(Geant4_SoPolyhedron);
+  SO_NODE_ADD_FIELD(solid,(TRUE));
+  SO_NODE_ADD_FIELD(reducedWireFrame,(TRUE));
+  SO_NODE_ADD_FIELD(alternateRep,(NULL));
+}
+//////////////////////////////////////////////////////////////////////////////
+Geant4_SoPolyhedron::~Geant4_SoPolyhedron(
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  delete fPolyhedron;
+}
+//////////////////////////////////////////////////////////////////////////////
+void Geant4_SoPolyhedron::generatePrimitives(
+ SoAction* aAction
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  if(!fPolyhedron) return;
+  if(fPolyhedron->GetNoFacets()<=0) return; // Abnormal polyhedron.
+
+  SoState *state = aAction->getState();
+  SbBool useTexFunction =
+    (SoTextureCoordinateElement::getType(state) == 
+     SoTextureCoordinateElement::FUNCTION);
+  const SoTextureCoordinateElement *tce = NULL;
+  SbVec4f texCoord(0.,0.,0.,0.);
+  if (useTexFunction) {
+    tce = SoTextureCoordinateElement::getInstance(state);
+  } else {
+    texCoord[2] = 0.0;
+    texCoord[3] = 1.0;
+  }
+
+  if(solid.getValue()==TRUE) {
+    SoPrimitiveVertex pv;
+    SbVec3f point, normal;
+    //////////////////////////////////////////
+    //----------------------------------------
+#define GEN_VERTEX(pv,x,y,z,s,t,nx,ny,nz)  \
+  point.setValue(x,y,z);                   \
+  normal.setValue(nx,ny,nz);               \
+  if (useTexFunction) {                    \
+    texCoord=tce->get(point,normal);       \
+  } else {                                 \
+    texCoord[0]=s;                         \
+    texCoord[1]=t;                         \
+  }                                        \
+  pv.setPoint(point);                      \
+  pv.setNormal(normal);                    \
+  pv.setTextureCoords(texCoord);           \
+  shapeVertex(&pv);
+  //----------------------------------------
+  //////////////////////////////////////////
+
+    // Assume all facets are convex quadrilaterals :
+    bool notLastFace;
+    do {
+      HVNormal3D unitNormal;
+      notLastFace = fPolyhedron->GetNextUnitNormal(unitNormal);
+
+      beginShape(aAction,POLYGON);
+      bool notLastEdge;
+      int edgeFlag = 1;
+      do {
+        HVPoint3D vertex;
+        notLastEdge = fPolyhedron->GetNextVertex(vertex,edgeFlag);
+        GEN_VERTEX(pv,
+                   vertex[0],
+                   vertex[1],
+                   vertex[2],
+                   0.0,0.0,
+                   unitNormal[0],
+                   unitNormal[1],
+                   unitNormal[2]);
+      } while (notLastEdge);
+      endShape();
+    } while (notLastFace);
+  } else {
+    SoPrimitiveVertex pvb,pve;
+    pve.setTextureCoords(texCoord);
+    pvb.setTextureCoords(texCoord);
+
+#ifdef __COIN__ // To bypass a bug in invokeLineSegment when picking.
+    beginShape(aAction,POLYGON);
+    endShape();
+#endif
+
+    SbVec3f point;
+    bool notLastFace;
+    do {
+      HVNormal3D unitNormal;
+      notLastFace = fPolyhedron->GetNextUnitNormal(unitNormal);
+
+      SbVec3f normal;
+      normal.setValue(unitNormal[0],unitNormal[1],unitNormal[2]);
+
+      // Treat edges :
+      int edgeFlag = 1;
+      int prevEdgeFlag = edgeFlag;
+      bool notLastEdge;
+      SbBool firstEdge = TRUE;
+      do {
+        HVPoint3D vertex;
+        notLastEdge = fPolyhedron->GetNextVertex(vertex,edgeFlag);
+        if(reducedWireFrame.getValue()==FALSE) edgeFlag = 1;        
+        if(firstEdge) {
+          if(edgeFlag > 0) {
+            pvb.setNormal(normal);
+            point.setValue(vertex[0],vertex[1],vertex[2]);
+            pvb.setPoint(point);
+          } else {
+          }
+          firstEdge = FALSE;
+          prevEdgeFlag = edgeFlag;
+        } else {
+          if(edgeFlag!=prevEdgeFlag) { 
+            if(edgeFlag > 0) { // Pass to a visible edge :
+              pvb.setNormal(normal);
+              point.setValue(vertex[0],vertex[1],vertex[2]);
+              pvb.setPoint(point);
+            } else { // Pass to an invisible edge :
+              pve.setNormal(normal);
+              point.setValue(vertex[0],vertex[1],vertex[2]);
+              pve.setPoint(point);
+              invokeLineSegmentCallbacks(aAction,&pvb,&pve);
+            }
+            prevEdgeFlag = edgeFlag;
+          } else {
+            if(edgeFlag > 0) {
+              pve.setNormal(normal);
+              point.setValue(vertex[0],vertex[1],vertex[2]);
+              pve.setPoint(point);
+              invokeLineSegmentCallbacks(aAction,&pvb,&pve);
+              pvb = pve;
+            } else {
+            }
+          }
+        }
+      } while (notLastEdge);
+    } while (notLastFace);
+  }
+
+}
+//////////////////////////////////////////////////////////////////////////////
+void Geant4_SoPolyhedron::computeBBox(
+ SoAction*
+,SbBox3f& aBox
+,SbVec3f& aCenter
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  if(!fPolyhedron) return;
+  if(fPolyhedron->GetNoFacets()<=0) { // Abnormal polyhedron.
+    SbVec3f vmin(-1,-1,-1);
+    SbVec3f vmax( 1, 1, 1);
+    aBox.setBounds(vmin,vmax);
+    aCenter.setValue(0,0,0);
+  } else {
+    SbBool first = TRUE;
+    float xmn = 0,ymn = 0,zmn = 0;
+    float xmx = 0,ymx = 0,zmx = 0;
+    float xct = 0,yct = 0,zct = 0;
+    SbVec3f point;
+    int count = 0;
+    // Assume all facets are convex quadrilaterals :
+    bool notLastFace;
+    do {
+      HVNormal3D unitNormal;
+      notLastFace = fPolyhedron->GetNextUnitNormal(unitNormal);
+      bool notLastEdge;
+      do {
+        HVPoint3D vertex;
+        int edgeFlag = 1;
+        notLastEdge = fPolyhedron->GetNextVertex(vertex,edgeFlag);
+        point.setValue(vertex[0],vertex[1],vertex[2]);
+        if(first==TRUE) {
+          xct = xmx = xmn = point[0];
+          yct = ymx = ymn = point[1];
+          zct = zmx = zmn = point[2];
+          count++;
+          first = FALSE;
+        } else {
+          xmn = SbMinimum(xmn,point[0]);
+          ymn = SbMinimum(ymn,point[1]);
+          zmn = SbMinimum(zmn,point[2]);
+          //
+          xmx = SbMaximum(xmx,point[0]);
+          ymx = SbMaximum(ymx,point[1]);
+          zmx = SbMaximum(zmx,point[2]);
+          //
+          xct += point[0];
+          yct += point[1];
+          zct += point[2];
+          count++;
+        }
+        //
+      } while (notLastEdge);
+    } while (notLastFace);
+    SbVec3f vmin(xmn,ymn,zmn);
+    SbVec3f vmax(xmx,ymx,zmx);
+    aBox.setBounds(vmin,vmax);
+    if(count==0)
+      aCenter.setValue(0,0,0);
+    else
+      aCenter.setValue(xct/count,yct/count,zct/count);
+  }
+}
+
+#include <Inventor/nodes/SoNormalBinding.h>
+#include <Inventor/nodes/SoNormal.h>
+#include <Inventor/nodes/SoCoordinate3.h>
+#include <Inventor/nodes/SoIndexedFaceSet.h>
+#include <Inventor/nodes/SoIndexedLineSet.h>
+//////////////////////////////////////////////////////////////////////////////
+void Geant4_SoPolyhedron::generateAlternateRep(
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  if(!fPolyhedron) return;
+  if(fPolyhedron->GetNoFacets()<=0) return; // Abnormal polyhedron.
+  if(fPolyhedron->GetNoVertices()<=0) return; // Abnormal polyhedron.
+
+  if(solid.getValue()==TRUE) {
+
+    SoSeparator* separator = new SoSeparator;
+
+    SoNormalBinding* normalBinding = new SoNormalBinding;
+    normalBinding->value = SoNormalBinding::PER_FACE;
+    separator->addChild(normalBinding);
+
+    SoCoordinate3* coordinate3 = new SoCoordinate3;
+    separator->addChild(coordinate3);
+    SoNormal* normal = new SoNormal;
+    separator->addChild(normal);
+    SoIndexedFaceSet* indexedFaceSet = new SoIndexedFaceSet;
+    separator->addChild(indexedFaceSet);
+
+    SbBool empty = TRUE;
+
+    int nvert = fPolyhedron->GetNoVertices();
+    int nface = fPolyhedron->GetNoFacets();
+
+    SbVec3f* normals = new SbVec3f[nface];
+    //FIXME : have the exact booking.
+    SbVec3f* points = new SbVec3f[nvert];
+    int32_t* coords = new int32_t[nvert+1];
+
+    int inormal = 0;
+    int icoord = 0;
+    int iindex = 0;
+
+    // Assume all facets are convex quadrilaterals :
+    bool notLastFace;
+    do {
+      HVNormal3D unitNormal;
+      notLastFace = fPolyhedron->GetNextUnitNormal(unitNormal);
+
+      // begin face POLYGON
+      int ipoint = 0;
+
+      bool notLastEdge;
+      int edgeFlag = 1;
+      do {
+        HVPoint3D vertex;
+        notLastEdge = fPolyhedron->GetNextVertex(vertex,edgeFlag);
+        points[ipoint].setValue(vertex[0],vertex[1],vertex[2]);
+        coords[ipoint] = icoord + ipoint;
+        ipoint++;
+        empty = FALSE;
+
+      } while (notLastEdge);
+
+      // end face.
+      coords[ipoint] = SO_END_FACE_INDEX;
+      coordinate3->point.setValues(icoord,ipoint,points);
+      icoord += ipoint;
+
+      normals[inormal].setValue(unitNormal[0],unitNormal[1],unitNormal[2]);
+      inormal++;  
+
+      indexedFaceSet->coordIndex.setValues(iindex,(ipoint+1),coords);
+      iindex += ipoint+1;
+
+    } while (notLastFace);
+
+    normal->vector.setValues(0,inormal,normals);
+
+    delete [] normals;
+    delete [] coords;
+    delete [] points;
+
+    if(empty==TRUE) {
+      separator->unref();
+    } else {
+      alternateRep.setValue(separator);
+    }
+
+  } else {
+
+    SoSeparator* separator = new SoSeparator;
+
+    int nvert = fPolyhedron->GetNoVertices();
+
+    //FIXME : have the exact booking.
+    int nedge = nvert * 3;
+    int npoint = nedge*2;
+    SbVec3f* points = new SbVec3f[npoint];
+    int ncoord = nedge*3;
+    int32_t* coords = new int32_t[ncoord];
+
+    SbVec3f pvb(0.,0.,0.), pve(0.,0.,0.);
+
+    SbBool empty = TRUE;
+    int ipoint = 0;
+    int icoord = 0;
+
+    bool notLastFace;
+    do {
+      HVNormal3D unitNormal;
+      notLastFace = fPolyhedron->GetNextUnitNormal(unitNormal);
+
+      //SbVec3f normal;
+      //if( (fProjection==SbProjectionRZ) || (fProjection==SbProjectionZR) ) {
+        //normal.setValue(0,0,1);
+      //} else {
+        //normal.setValue(unitNormal[0],unitNormal[1],unitNormal[2]);
+      //}
+
+      // Treat edges :
+      int edgeFlag = 1;
+      int prevEdgeFlag = edgeFlag;
+      bool notLastEdge;
+      SbBool firstEdge = TRUE;
+      do {
+        HVPoint3D vertex;
+        notLastEdge = fPolyhedron->GetNextVertex(vertex,edgeFlag);
+        if(reducedWireFrame.getValue()==FALSE) edgeFlag = 1;        
+        if(firstEdge) {
+          if(edgeFlag > 0) {
+            pvb.setValue(vertex[0],vertex[1],vertex[2]);
+          } else {
+          }
+          firstEdge = FALSE;
+          prevEdgeFlag = edgeFlag;
+        } else {
+          if(edgeFlag!=prevEdgeFlag) { 
+            if(edgeFlag > 0) { // Pass to a visible edge :
+              pvb.setValue(vertex[0],vertex[1],vertex[2]);
+            } else { // Pass to an invisible edge :
+              pve.setValue(vertex[0],vertex[1],vertex[2]);
+
+              if((ipoint+1)>=npoint) {
+                int new_npoint = 2 * npoint;
+                SbVec3f* new_points = new SbVec3f[new_npoint];
+                for(int i=0;i<npoint;i++) new_points[i] = points[i];
+                delete [] points;
+                npoint = new_npoint;
+                points = new_points;
+              }
+
+              if((icoord+2)>=ncoord) {
+                int new_ncoord = 2 * ncoord;
+                int32_t* new_coords = new int32_t[new_ncoord];
+                for(int i=0;i<ncoord;i++) new_coords[i] = coords[i];
+                delete [] coords;
+                ncoord = new_ncoord;
+                coords = new_coords;
+              }
+
+              points[ipoint+0] = pvb;
+              points[ipoint+1] = pve;
+              coords[icoord+0] = ipoint + 0;
+              coords[icoord+1] = ipoint + 1;
+              coords[icoord+2] = SO_END_LINE_INDEX;
+              ipoint += 2;
+              icoord += 3;
+              empty = FALSE;
+            }
+            prevEdgeFlag = edgeFlag;
+          } else {
+            if(edgeFlag > 0) {
+              pve.setValue(vertex[0],vertex[1],vertex[2]);
+
+              if((ipoint+1)>=npoint) {
+                int new_npoint = 2 * npoint;
+                SbVec3f* new_points = new SbVec3f[new_npoint];
+                for(int i=0;i<npoint;i++) new_points[i] = points[i];
+                delete [] points;
+                npoint = new_npoint;
+                points = new_points;
+              }
+
+              if((icoord+2)>=ncoord) {
+                int new_ncoord = 2 * ncoord;
+                int32_t* new_coords = new int32_t[new_ncoord];
+                for(int i=0;i<ncoord;i++) new_coords[i] = coords[i];
+                delete [] coords;
+                ncoord = new_ncoord;
+                coords = new_coords;
+              }
+
+              points[ipoint+0] = pvb;
+              points[ipoint+1] = pve;
+              coords[icoord+0] = ipoint + 0;
+              coords[icoord+1] = ipoint + 1;
+              coords[icoord+2] = SO_END_LINE_INDEX;
+              ipoint += 2;
+              icoord += 3;
+              empty = FALSE;
+
+              pvb = pve;
+            } else {
+            }
+          }
+        }
+      } while (notLastEdge);
+    } while (notLastFace);
+
+    SoCoordinate3* coordinate3 = new SoCoordinate3;
+    coordinate3->point.setValues(0,ipoint,points);
+    separator->addChild(coordinate3);
+
+    SoIndexedLineSet* indexedLineSet = new SoIndexedLineSet;
+    indexedLineSet->coordIndex.setValues(0,icoord,coords);
+    separator->addChild(indexedLineSet);
+
+    delete [] coords;
+    delete [] points;
+
+    if(empty==TRUE) {
+      separator->unref();
+    } else {
+      alternateRep.setValue(separator);
+    }
+  }
+}
+//////////////////////////////////////////////////////////////////////////////
+void Geant4_SoPolyhedron::clearAlternateRep(
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  alternateRep.setValue(NULL);
+}
+//////////////////////////////////////////////////////////////////////////////
+void Geant4_SoPolyhedron::doAction(
+ SoAction* aAction
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  SO_ALTERNATEREP_DO_ACTION(aAction)
+  SoShape::doAction(aAction);
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/src/SoStyleCache.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/src/SoStyleCache.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/src/SoStyleCache.cc	(revision 1102)
@@ -0,0 +1,212 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+#ifdef G4VIS_BUILD_OI_DRIVER
+
+/*----------------------------HEPVis----------------------------------------*/
+/*                                                                          */
+/* Node:             SoStyleCache                                           */
+/* Author:           Guy Barrand                                            */
+/*                                                                          */
+/*--------------------------------------------------------------------------*/
+
+// this :
+#include <HEPVis/misc/SoStyleCache.h>
+
+#include <Inventor/nodes/SoMaterial.h>
+#include <Inventor/nodes/SoDrawStyle.h>
+#include <Inventor/nodes/SoLightModel.h>
+#include <Inventor/nodes/SoResetTransform.h>
+
+//////////////////////////////////////////////////////////////////////////////
+SoStyleCache::SoStyleCache(
+) 
+:fMaterials(0)
+,fLineStyles(0)
+,fLightModels(0)
+,fResetTransform(0)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  fMaterials = new SoGroup;
+  addChild(fMaterials);
+  fLineStyles = new SoGroup;
+  addChild(fLineStyles);
+  fLightModels = new SoGroup;
+  addChild(fLightModels);
+  fResetTransform = new SoResetTransform;
+  addChild(fResetTransform);
+}
+//////////////////////////////////////////////////////////////////////////////
+SoStyleCache::~SoStyleCache(
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+}
+//////////////////////////////////////////////////////////////////////////////
+SoMaterial* SoStyleCache::getMaterial(
+ const SbColor& aRGB
+,float aTransparency
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  int number = fMaterials->getNumChildren();
+  for(int index=0;index<number;index++) { 
+    SoMaterial* material = (SoMaterial*)fMaterials->getChild(index);
+    if( (material->diffuseColor[0]==aRGB) &&
+        (material->transparency[0]==aTransparency) ) {
+      return material;
+    }
+  }
+  SoMaterial* material = new SoMaterial;
+  material->diffuseColor.setValue(aRGB);
+  material->transparency.setValue(aTransparency);
+  fMaterials->addChild(material);
+  return material;
+}
+//////////////////////////////////////////////////////////////////////////////
+SoMaterial* SoStyleCache::getMaterial(
+ float aRed
+,float aGreen
+,float aBlue
+,float aTransparency
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  SbColor aRGB(aRed,aGreen,aBlue);
+  int number = fMaterials->getNumChildren();
+  for(int index=0;index<number;index++) { 
+    SoMaterial* material = (SoMaterial*)fMaterials->getChild(index);
+    if( (material->diffuseColor[0]==aRGB) &&
+        (material->transparency[0]==aTransparency) ) {
+      return material;
+    }
+  }
+  SoMaterial* material = new SoMaterial;
+  material->diffuseColor.setValue(aRGB);
+  material->transparency.setValue(aTransparency);
+  fMaterials->addChild(material);
+  return material;
+}
+/*
+//////////////////////////////////////////////////////////////////////////////
+SoDrawStyle* SoStyleCache::getLineStyle(
+ SbLineStyle aStyle
+,float aWidth
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  unsigned short pattern = 0xFFFF;
+  switch(aStyle) {
+  case SbLineDashed:
+    pattern = 0x00FF;
+    break;
+  case SbLineDotted:
+    pattern = 0x0101;
+    break;
+  case SbLineDashDotted:
+    pattern = 0x1C47;
+    break;
+  default: //SbLineSolid:
+    pattern = 0xFFFF;
+    break;
+  }
+  int number = fLineStyles->getNumChildren();
+  for(int index=0;index<number;index++) { 
+    SoDrawStyle* drawStyle = (SoDrawStyle*)fLineStyles->getChild(index);
+    if( (drawStyle->style.getValue()==SoDrawStyle::LINES) &&
+        (drawStyle->lineWidth.getValue()==aWidth) &&
+        (drawStyle->linePattern.getValue()==pattern) ) {
+      return drawStyle;
+    }
+  }
+  SoDrawStyle* drawStyle = new SoDrawStyle;
+  drawStyle->style.setValue(SoDrawStyle::LINES);
+  drawStyle->lineWidth.setValue(aWidth);
+  drawStyle->linePattern.setValue(pattern);
+  fLineStyles->addChild(drawStyle);
+  return drawStyle;
+}
+*/
+//////////////////////////////////////////////////////////////////////////////
+SoDrawStyle* SoStyleCache::getLineStyle(
+ unsigned short aPattern
+,float aWidth
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  int number = fLineStyles->getNumChildren();
+  for(int index=0;index<number;index++) { 
+    SoDrawStyle* drawStyle = (SoDrawStyle*)fLineStyles->getChild(index);
+    if( (drawStyle->style.getValue()==SoDrawStyle::LINES) &&
+        (drawStyle->lineWidth.getValue()==aWidth) &&
+        (drawStyle->linePattern.getValue()==aPattern) ) {
+      return drawStyle;
+    }
+  }
+  SoDrawStyle* drawStyle = new SoDrawStyle;
+  drawStyle->style.setValue(SoDrawStyle::LINES);
+  drawStyle->lineWidth.setValue(aWidth);
+  drawStyle->linePattern.setValue(aPattern);
+  fLineStyles->addChild(drawStyle);
+  return drawStyle;
+}
+//////////////////////////////////////////////////////////////////////////////
+SoLightModel* SoStyleCache::getLightModelPhong(
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  SoLightModel* lightModel = new SoLightModel;
+  lightModel->model.setValue(SoLightModel::PHONG);
+  fLightModels->addChild(lightModel);
+  return lightModel;
+}
+//////////////////////////////////////////////////////////////////////////////
+SoLightModel* SoStyleCache::getLightModelBaseColor(
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  SoLightModel* lightModel = new SoLightModel;
+  lightModel->model.setValue(SoLightModel::BASE_COLOR);
+  fLightModels->addChild(lightModel);
+  return lightModel;
+}
+//////////////////////////////////////////////////////////////////////////////
+SoResetTransform* SoStyleCache::getResetTransform(
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  return fResetTransform;
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/src/SoTrap.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/src/SoTrap.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/src/SoTrap.cc	(revision 1102)
@@ -0,0 +1,413 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+//
+// $Id: SoTrap.cc,v 1.8 2006/06/29 21:23:03 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+/*-----------------------------HEPVis----------------------------------------*/
+/*                                                                           */
+/* Node:             SoTrap                                                  */
+/* Description:      Represents the G4Trap Geant Geometry entity             */
+/* Author:           Joe Boudreau Nov 11 1996                                */
+/*                                                                           */
+/*                                                                           */
+/*---------------------------------------------------------------------------*/
+
+#ifdef G4VIS_BUILD_OI_DRIVER
+
+// this :
+#include "HEPVis/nodes/SoTrap.h"
+
+#include <assert.h>
+#include <cmath>
+#include <Inventor/SbBox.h>
+#include <Inventor/actions/SoGLRenderAction.h>
+#include <Inventor/actions/SoAction.h>
+#include <Inventor/fields/SoSFFloat.h>
+#include <Inventor/misc/SoChildList.h>
+#include <Inventor/nodes/SoSeparator.h>
+#include <Inventor/nodes/SoIndexedFaceSet.h>
+#include <Inventor/nodes/SoNormal.h>
+#include <Inventor/nodes/SoCoordinate3.h>
+#include <Inventor/nodes/SoNormalBinding.h>
+#include <Inventor/SoPrimitiveVertex.h>
+#include <Inventor/elements/SoTextureCoordinateElement.h>
+
+#include "HEPVis/SbMath.h"
+
+// This statement is required
+SO_NODE_SOURCE(SoTrap)
+
+// Constructor
+SoTrap::SoTrap() {
+  // This statement is required
+  SO_NODE_CONSTRUCTOR(SoTrap);
+
+  // Data fields are initialized like this:
+  SO_NODE_ADD_FIELD(pDz,                 (1.0));
+  SO_NODE_ADD_FIELD(pTheta,              (0.0));
+  SO_NODE_ADD_FIELD(pPhi,                (0.0));
+  SO_NODE_ADD_FIELD(pDy1,                (1.0));
+  SO_NODE_ADD_FIELD(pDx1,                (1.0));
+  SO_NODE_ADD_FIELD(pDx2,                (1.0));
+  SO_NODE_ADD_FIELD(pDy2,                (1.0));
+  SO_NODE_ADD_FIELD(pDx3,                (1.0));
+  SO_NODE_ADD_FIELD(pDx4,                (1.0));
+  SO_NODE_ADD_FIELD(pAlp1,               (0.0));
+  SO_NODE_ADD_FIELD(pAlp2,               (0.0));
+  SO_NODE_ADD_FIELD(alternateRep,        (NULL));
+  children = new SoChildList(this);
+}
+
+// Destructor
+SoTrap::~SoTrap() {
+ delete children;
+}
+
+
+// initClass
+void SoTrap::initClass(){
+  // This statement is required.
+  SO_NODE_INIT_CLASS(SoTrap,SoShape,"Shape");
+}
+
+
+// generatePrimitives
+void SoTrap::generatePrimitives(SoAction *action) {
+  // This variable is used to store each vertex
+  SoPrimitiveVertex pv;
+
+  // Access the stat from the action
+  SoState *state = action->getState();
+
+  // See if we have to use a texture coordinate function,
+  // rather than generating explicit texture coordinates.
+  SbBool useTexFunction=
+    (SoTextureCoordinateElement::getType(state) == 
+     SoTextureCoordinateElement::FUNCTION);
+
+  // If we need to generate texture coordinates with a function,
+  // we'll need an SoGLTextureCoordinateElement.  Otherwise, we'll
+  // set up the coordinates directly.
+  const SoTextureCoordinateElement *tce = NULL;
+  SbVec4f texCoord;
+  if (useTexFunction) {
+    tce = SoTextureCoordinateElement::getInstance(state);
+  }
+  else {
+    texCoord[2] = 0.0;
+    texCoord[3] = 1.0;
+  }
+  SbVec3f point, normal;
+
+
+  //////////////////////////////////////////
+  //----------------------------------------
+#define GEN_VERTEX(pv,x,y,z,s,t,nx,ny,nz)  \
+  point.setValue(x,y,z);                   \
+  normal.setValue(nx,ny,nz);               \
+  if (useTexFunction) {                    \
+    texCoord=tce->get(point,normal);       \
+  }                                        \
+  else {                                   \
+    texCoord[0]=s;                         \
+    texCoord[1]=t;                         \
+  }                                        \
+  pv.setPoint(point);                      \
+  pv.setNormal(normal);                    \
+  pv.setTextureCoords(texCoord);           \
+  shapeVertex(&pv);
+  //----------------------------------------
+  //////////////////////////////////////////
+
+  const int NPOINTS=8, NFACES=6, NINDICES = NFACES*5;
+  int indices[NINDICES] = {3,2,1,0, SO_END_FACE_INDEX,  //z back.
+			   4,5,6,7, SO_END_FACE_INDEX,  //z front.
+			   0,1,5,4, SO_END_FACE_INDEX,  //y up.
+			   1,2,6,5, SO_END_FACE_INDEX,  //x left.
+			   2,3,7,6, SO_END_FACE_INDEX,  //y down.
+			   3,0,4,7, SO_END_FACE_INDEX}; //x right.
+
+  // points for the eight vertices
+  float TthetaCphi = FTAN(pTheta.getValue())*FCOS(pPhi.getValue());
+  float TthetaSphi = FTAN(pTheta.getValue())*FSIN(pPhi.getValue());
+  float Talp1 = FTAN(pAlp1.getValue()); 
+  float Talp2 = FTAN(pAlp2.getValue());
+
+  float points[NPOINTS][3];
+  points[0][0] =  pDx2.getValue()+pDy1.getValue()*Talp1;
+  points[0][1] =  pDy1.getValue();
+  points[0][2] = -pDz.getValue();
+
+  points[1][0] = -pDx2.getValue()+pDy1.getValue()*Talp1;
+  points[1][1] =  pDy1.getValue();
+  points[1][2] = -pDz.getValue();
+
+  points[2][0] = -pDx1.getValue()-pDy1.getValue()*Talp1;
+  points[2][1] = -pDy1.getValue();
+  points[2][2] = -pDz.getValue();
+
+  points[3][0] =  pDx1.getValue()-pDy1.getValue()*Talp1;
+  points[3][1] = -pDy1.getValue();
+  points[3][2] = -pDz.getValue();
+
+  points[4][0] =  pDx4.getValue()+pDy2.getValue()*Talp2;
+  points[4][1] =  pDy2.getValue();
+  points[4][2] =  pDz.getValue();
+
+  points[5][0] = -pDx4.getValue()+pDy2.getValue()*Talp2;
+  points[5][1] =  pDy2.getValue();
+  points[5][2] =  pDz.getValue();
+
+  points[6][0] = -pDx3.getValue()-pDy2.getValue()*Talp2;
+  points[6][1] = -pDy2.getValue();
+  points[6][2] =  pDz.getValue();
+
+  points[7][0] =  pDx3.getValue()-pDy2.getValue()*Talp2;
+  points[7][1] = -pDy2.getValue();
+  points[7][2] =  pDz.getValue();
+
+  int i;
+  for (i=0;i<4;i++) {
+    points[i][0] -= pDz.getValue()*TthetaCphi;
+    points[i][1] -= pDz.getValue()*TthetaSphi;
+  }
+  for (i=4;i<8;i++) {
+    points[i][0] += pDz.getValue()*TthetaCphi;
+    points[i][1] += pDz.getValue()*TthetaSphi;
+  }
+
+  SbVec3f normals[NFACES];
+  int nf;
+  for (nf=0;nf<NFACES;nf++) {
+    int j0 = indices[5*nf + 0];
+    int j1 = indices[5*nf + 1];
+    int j2 = indices[5*nf + 2];
+    SbVec3f p0(points[j0][0],points[j0][1],points[j0][2]); 
+    SbVec3f p1(points[j1][0],points[j1][1],points[j1][2]); 
+    SbVec3f p2(points[j2][0],points[j2][1],points[j2][2]); 
+    normals[nf] = (p1-p0).cross(p2-p0);
+    normals[nf].normalize();
+  }
+
+  float x,y,z;
+  int   index;
+  for (nf=0;nf<NFACES;nf++) {
+    beginShape(action,TRIANGLE_FAN);
+    index = indices[nf * 5];   
+    x = points[index][0];
+    y = points[index][1];
+    z = points[index][2];
+    GEN_VERTEX(pv,x,y,z,0.0,0.0,normals[nf][0],normals[nf][1],normals[nf][2]);   
+    index = indices[nf * 5 + 1];   
+    x = points[index][0];
+    y = points[index][1];
+    z = points[index][2];
+    GEN_VERTEX(pv,x,y,z,0.0,0.0,normals[nf][0],normals[nf][1],normals[nf][2]);   
+    index = indices[nf * 5 + 2];   
+    x = points[index][0];
+    y = points[index][1];
+    z = points[index][2];
+    GEN_VERTEX(pv,x,y,z,0.0,0.0,normals[nf][0],normals[nf][1],normals[nf][2]);   
+    index = indices[nf * 5 + 3];   
+    x = points[index][0];
+    y = points[index][1];
+    z = points[index][2];
+    GEN_VERTEX(pv,x,y,z,0.0,0.0,normals[nf][0],normals[nf][1],normals[nf][2]);   
+    endShape();
+  }
+}
+
+// getChildren
+SoChildList *SoTrap::getChildren() const {
+  return children;
+}
+
+
+// computeBBox
+void SoTrap::computeBBox(SoAction *, SbBox3f &box, SbVec3f &center ){
+  float pDx= pDx1.getValue(),pDy=pDy1.getValue();
+  
+  if (pDx2.getValue() > pDx) pDx = pDx2.getValue(); 
+  if (pDx3.getValue() > pDx) pDx = pDx3.getValue(); 
+  if (pDx4.getValue() > pDx) pDx = pDx4.getValue(); 
+  if (pDy2.getValue() > pDy) pDy = pDy2.getValue(); 
+  float TthetaCphi = FTAN(pTheta.getValue())*FCOS(pPhi.getValue());
+  float TthetaSphi = FTAN(pTheta.getValue())*FSIN(pPhi.getValue());
+  float Xalp = FFABS(std::tan(pAlp1.getValue())*pDy1.getValue());
+  float Xalp2 = FFABS(std::tan(pAlp2.getValue())*pDy2.getValue());
+  if (Xalp< Xalp2) Xalp=Xalp2;
+  pDx += FFABS(TthetaCphi*pDz.getValue());
+  pDx += Xalp;
+  pDy += FFABS(TthetaSphi*pDz.getValue());  
+
+
+  center.setValue(0,0,0);
+  box.setBounds(SbVec3f(-pDx,-pDy,-pDz.getValue()),
+	  SbVec3f( pDx, pDy, pDz.getValue()));
+}
+
+
+
+
+// updateChildren
+void SoTrap::updateChildren() {
+
+
+  // Redraw the G4Trap....
+
+  assert(children->getLength()==1);
+  SoSeparator       *sep                = (SoSeparator *)  ( *children)[0];
+  SoCoordinate3     *theCoordinates     = (SoCoordinate3 *)      ( sep->getChild(0));
+  SoNormal          *theNormals         = (SoNormal *)           ( sep->getChild(1)); 
+  SoNormalBinding   *theNormalBinding   = (SoNormalBinding *)    ( sep->getChild(2));
+  SoIndexedFaceSet  *theFaceSet         = (SoIndexedFaceSet *)   ( sep->getChild(3));
+
+  const int NPOINTS=8, NFACES=6, NINDICES = NFACES*5;
+  float points[NPOINTS][3];
+  // Indices for the eight faces
+#ifdef INVENTOR2_0
+  static long  
+#else 
+  static int32_t
+#endif
+  indices[NINDICES] = {3,2,1,0, SO_END_FACE_INDEX, // bottom
+                     4,5,6,7, SO_END_FACE_INDEX, // top
+                     0,1,5,4, SO_END_FACE_INDEX, 
+                     1,2,6,5, SO_END_FACE_INDEX,
+                     2,3,7,6, SO_END_FACE_INDEX,
+                     3,0,4,7, SO_END_FACE_INDEX};
+
+  
+  // points for the eight vertices
+  float TthetaCphi = FTAN(pTheta.getValue())*FCOS(pPhi.getValue());
+  float TthetaSphi = FTAN(pTheta.getValue())*FSIN(pPhi.getValue());
+  float Talp1 = FTAN(pAlp1.getValue()); 
+  float Talp2 = FTAN(pAlp2.getValue());
+
+  points[0][0] =  pDx2.getValue()+pDy1.getValue()*Talp1;
+  points[0][1] =  pDy1.getValue();
+  points[0][2] = -pDz.getValue();
+
+  points[1][0] = -pDx2.getValue()+pDy1.getValue()*Talp1;
+  points[1][1] =  pDy1.getValue();
+  points[1][2] = -pDz.getValue();
+
+  points[2][0] = -pDx1.getValue()-pDy1.getValue()*Talp1;
+  points[2][1] = -pDy1.getValue();
+  points[2][2] = -pDz.getValue();
+
+  points[3][0] =  pDx1.getValue()-pDy1.getValue()*Talp1;
+  points[3][1] = -pDy1.getValue();
+  points[3][2] = -pDz.getValue();
+
+  points[4][0] =  pDx4.getValue()+pDy2.getValue()*Talp2;
+  points[4][1] =  pDy2.getValue();
+  points[4][2] =  pDz.getValue();
+
+  points[5][0] = -pDx4.getValue()+pDy2.getValue()*Talp2;
+  points[5][1] =  pDy2.getValue();
+  points[5][2] =  pDz.getValue();
+
+  points[6][0] = -pDx3.getValue()-pDy2.getValue()*Talp2;
+  points[6][1] = -pDy2.getValue();
+  points[6][2] =  pDz.getValue();
+
+  points[7][0] =  pDx3.getValue()-pDy2.getValue()*Talp2;
+  points[7][1] = -pDy2.getValue();
+  points[7][2] =  pDz.getValue();
+
+  int i;
+  for (i=0;i<4;i++) {
+    points[i][0] -= pDz.getValue()*TthetaCphi;
+    points[i][1] -= pDz.getValue()*TthetaSphi;
+  }
+  for (i=4;i<8;i++) {
+    points[i][0] += pDz.getValue()*TthetaCphi;
+    points[i][1] += pDz.getValue()*TthetaSphi;
+  }
+
+  for (int np=0;np<NPOINTS;np++) theCoordinates->point.set1Value(np,points[np][0],points[np][1],points[np][2]);
+  theFaceSet->coordIndex.setValues(0,NINDICES,indices);
+  theNormals->vector.deleteValues(0);
+  theNormals->vector.insertSpace(0,6);
+  for (int n=0;n<6;n++) {
+    int i0 = 5*n+0,i1=5*n+1,i2=5*n+2;
+    int j0 = theFaceSet->coordIndex[i0];
+    int j1 = theFaceSet->coordIndex[i1];
+    int j2 = theFaceSet->coordIndex[i2];
+    SbVec3f p0= theCoordinates->point[j0]; 
+    SbVec3f p1= theCoordinates->point[j1]; 
+    SbVec3f p2= theCoordinates->point[j2]; 
+    SbVec3f normal = (p1-p0).cross(p2-p0);
+    normal.normalize();
+    theNormals->vector.set1Value(n,normal);
+  }
+  theNormalBinding->value=SoNormalBinding::PER_FACE;
+}
+
+// generateChildren
+void SoTrap::generateChildren() {
+
+  // This routines creates one SoSeparator, one SoCoordinate3, and
+  // one SoLineSet, and puts it in the child list.  This is done only
+  // once, whereas redrawing the position of the coordinates occurs each
+  // time an update is necessary, in the updateChildren routine. 
+
+  assert(children->getLength() ==0);
+  SoSeparator      *sep              = new SoSeparator(); 
+  SoCoordinate3    *theCoordinates   = new SoCoordinate3();
+  SoNormal         *theNormals       = new SoNormal(); 
+  SoNormalBinding  *theNormalBinding = new SoNormalBinding();
+  SoIndexedFaceSet *theFaceSet       = new SoIndexedFaceSet();
+  // 
+  // This line costs some in render quality! but gives speed.
+  // 
+  sep->addChild(theCoordinates);
+  sep->addChild(theNormals);
+  sep->addChild(theNormalBinding);
+  sep->addChild(theFaceSet);
+  children->append(sep);
+}
+
+// generateAlternateRep
+void SoTrap::generateAlternateRep() {
+
+  // This routine sets the alternate representation to the child
+  // list of this mode.  
+
+  if (children->getLength() == 0) generateChildren();
+  updateChildren();
+  alternateRep.setValue((SoSeparator *)  ( *children)[0]);
+}
+
+// clearAlternateRep
+void SoTrap::clearAlternateRep() {
+  alternateRep.setValue(NULL);
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/src/SoTrd.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/src/SoTrd.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/src/SoTrd.cc	(revision 1102)
@@ -0,0 +1,347 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+//
+// $Id: SoTrd.cc,v 1.8 2006/06/29 21:23:05 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+/*-----------------------------HEPVis---------------------------------------*/
+/*                                                                          */
+/* Node:             SoTrd                                                  */
+/* Description:      Represents the G4Trd Geant Geometry entity             */
+/* Author:           Joe Boudreau Nov 11 1996                               */
+/*                                                                          */
+/*--------------------------------------------------------------------------*/
+
+#ifdef G4VIS_BUILD_OI_DRIVER
+
+#include <assert.h>
+#include <cmath>
+
+#include <Inventor/SbBox.h>
+#include <Inventor/actions/SoAction.h>
+#include <Inventor/fields/SoSFFloat.h>
+#include <Inventor/misc/SoChildList.h>
+#include <Inventor/nodes/SoSeparator.h>
+#include <Inventor/nodes/SoIndexedFaceSet.h>
+#include <Inventor/nodes/SoNormal.h>
+#include <Inventor/nodes/SoCoordinate3.h>
+#include <Inventor/nodes/SoNormalBinding.h>
+#include <Inventor/SoPrimitiveVertex.h>
+#include <Inventor/elements/SoTextureCoordinateElement.h>
+
+#include "HEPVis/SbMath.h"
+#include "HEPVis/nodes/SoTrd.h"
+
+// This statement is required
+SO_NODE_SOURCE(SoTrd)
+
+// initClass
+void SoTrd::initClass(){
+  SO_NODE_INIT_CLASS(SoTrd,SoShape,"Shape");
+}
+// Constructor
+SoTrd::SoTrd() {
+  // This statement is required
+  SO_NODE_CONSTRUCTOR(SoTrd);
+  // Data fields are initialized like this:
+  SO_NODE_ADD_FIELD(fDx1,(1.0));
+  SO_NODE_ADD_FIELD(fDx2,(1.0));
+  SO_NODE_ADD_FIELD(fDy1,(1.0));
+  SO_NODE_ADD_FIELD(fDy2,(1.0));
+  SO_NODE_ADD_FIELD(fDz,(1.0));
+  SO_NODE_ADD_FIELD(alternateRep,(NULL));
+  children = new SoChildList(this);
+}
+// Destructor
+SoTrd::~SoTrd() {
+  delete children;
+}
+// generatePrimitives
+void SoTrd::generatePrimitives(SoAction *action) {
+  // This variable is used to store each vertex
+  SoPrimitiveVertex pv;
+
+  // Access the stat from the action
+  SoState *state = action->getState();
+
+  // See if we have to use a texture coordinate function,
+  // rather than generating explicit texture coordinates.
+  SbBool useTexFunction=
+    (SoTextureCoordinateElement::getType(state) == 
+     SoTextureCoordinateElement::FUNCTION);
+
+  // If we need to generate texture coordinates with a function,
+  // we'll need an SoGLTextureCoordinateElement.  Otherwise, we'll
+  // set up the coordinates directly.
+  const SoTextureCoordinateElement *tce = NULL;
+  SbVec4f texCoord;
+  if (useTexFunction) {
+    tce = SoTextureCoordinateElement::getInstance(state);
+  }
+  else {
+    texCoord[2] = 0.0;
+    texCoord[3] = 1.0;
+  }
+  SbVec3f point, normal;
+
+
+  //////////////////////////////////////////
+  //----------------------------------------
+#define GEN_VERTEX(pv,x,y,z,s,t,nx,ny,nz)  \
+  point.setValue(x,y,z);                   \
+  normal.setValue(nx,ny,nz);               \
+  if (useTexFunction) {                    \
+    texCoord=tce->get(point,normal);       \
+  }                                        \
+  else {                                   \
+    texCoord[0]=s;                         \
+    texCoord[1]=t;                         \
+  }                                        \
+  pv.setPoint(point);                      \
+  pv.setNormal(normal);                    \
+  pv.setTextureCoords(texCoord);           \
+  shapeVertex(&pv);
+  //----------------------------------------
+  //////////////////////////////////////////
+
+  const int NPOINTS=8, NFACES=6, NINDICES = NFACES*5;
+  int indices[NINDICES] = {3,2,1,0, SO_END_FACE_INDEX,  //z back.
+			   4,5,6,7, SO_END_FACE_INDEX,  //z front.
+			   0,1,5,4, SO_END_FACE_INDEX,  //y up.
+			   1,2,6,5, SO_END_FACE_INDEX,  //x left.
+			   2,3,7,6, SO_END_FACE_INDEX,  //y down.
+			   3,0,4,7, SO_END_FACE_INDEX}; //x right.
+
+  
+  // points for the eight vertices
+  float points[NPOINTS][3];
+  points[0][0] =  fDx1.getValue(); 
+  points[0][1] =  fDy1.getValue(); 
+  points[0][2] = -fDz.getValue();
+
+  points[1][0] = -fDx1.getValue();
+  points[1][1] =  fDy1.getValue();
+  points[1][2] = -fDz.getValue();
+
+  points[2][0] = -fDx1.getValue(); 
+  points[2][1] = -fDy1.getValue(); 
+  points[2][2] = -fDz.getValue();
+
+  points[3][0] =  fDx1.getValue(); 
+  points[3][1] = -fDy1.getValue(); 
+  points[3][2] = -fDz.getValue();
+
+  points[4][0] =  fDx2.getValue(); 
+  points[4][1] =  fDy2.getValue(); 
+  points[4][2] =  fDz.getValue();
+
+  points[5][0] = -fDx2.getValue(); 
+  points[5][1] =  fDy2.getValue(); 
+  points[5][2] =  fDz.getValue();
+
+  points[6][0] = -fDx2.getValue(); 
+  points[6][1] = -fDy2.getValue(); 
+  points[6][2] =  fDz.getValue();
+
+  points[7][0] =  fDx2.getValue(); 
+  points[7][1] = -fDy2.getValue(); 
+  points[7][2] =  fDz.getValue();
+
+  float t1  = FATAN((fDx2.getValue()-fDx1.getValue())/(2*fDz.getValue()));
+  float t2  = FATAN((fDy2.getValue()-fDy1.getValue())/(2*fDz.getValue()));
+  float st1 = FSIN(t1);
+  float st2 = FSIN(t2);
+  float ct1 = FCOS(t1);
+  float ct2 = FCOS(t2);
+
+  float normals[NFACES][3];
+  //z back.
+  normals[0][0] = 0   ; normals[0][1] =    0; normals [0][2] =  -1;    
+  //z front.
+  normals[1][0] = 0   ; normals[1][1] =    0; normals [1][2] =   1;    
+  //y up.
+  normals[2][0] = 0   ; normals[2][1] =  ct2; normals [2][2] = -st2;    
+  //x left.
+  normals[3][0] = -ct1; normals[3][1] =    0; normals [3][2] = -st1;    
+  //y down.
+  normals[4][0] = 0   ; normals[4][1] = -ct2; normals [4][2] = -st2;    
+  //x right.
+  normals[5][0] =  ct1; normals[5][1] =    0; normals [5][2] = -st1;    
+
+  float x,y,z;
+  int   index;
+  for (int nf=0;nf<NFACES;nf++) {
+    beginShape(action,TRIANGLE_FAN);
+    index = indices[nf * 5];   
+    x = points[index][0];
+    y = points[index][1];
+    z = points[index][2];
+    GEN_VERTEX(pv,x,y,z,0.0,0.0,normals[nf][0],normals[nf][1],normals[nf][2]);   
+    index = indices[nf * 5 + 1];   
+    x = points[index][0];
+    y = points[index][1];
+    z = points[index][2];
+    GEN_VERTEX(pv,x,y,z,0.0,0.0,normals[nf][0],normals[nf][1],normals[nf][2]);   
+    index = indices[nf * 5 + 2];   
+    x = points[index][0];
+    y = points[index][1];
+    z = points[index][2];
+    GEN_VERTEX(pv,x,y,z,0.0,0.0,normals[nf][0],normals[nf][1],normals[nf][2]);   
+    index = indices[nf * 5 + 3];   
+    x = points[index][0];
+    y = points[index][1];
+    z = points[index][2];
+    GEN_VERTEX(pv,x,y,z,0.0,0.0,normals[nf][0],normals[nf][1],normals[nf][2]);   
+    endShape();
+  }
+}
+
+// getChildren
+SoChildList *SoTrd::getChildren() const {
+  return children;
+}
+
+
+// computeBBox
+void SoTrd::computeBBox(SoAction *, SbBox3f &box, SbVec3f &center ){
+  float fDx= fDx1.getValue(),fDy=fDy1.getValue();
+  
+  if (fDx2.getValue() > fDx) fDx = fDx2.getValue(); 
+  if (fDy2.getValue() > fDy) fDy = fDy2.getValue(); 
+
+  SbVec3f vmin(-fDx,-fDy,-fDz.getValue()), 
+          vmax( fDx, fDy, fDz.getValue());
+
+  center.setValue(0,0,0);
+  box.setBounds(vmin,vmax);
+}
+
+
+
+
+// updateChildren
+void SoTrd::updateChildren() {
+
+
+  // Redraw the G4Trd....
+
+  assert(children->getLength()==1);
+  SoSeparator       *sep                = (SoSeparator *)  ( *children)[0];
+  SoCoordinate3     *theCoordinates     = (SoCoordinate3 *)      ( sep->getChild(0));
+  SoNormal          *theNormals         = (SoNormal *)           ( sep->getChild(1)); 
+  SoNormalBinding   *theNormalBinding   = (SoNormalBinding *)    ( sep->getChild(2));
+  SoIndexedFaceSet  *theFaceSet         = (SoIndexedFaceSet *)   ( sep->getChild(3));
+
+  const int NPOINTS=8, NFACES=6, NINDICES = NFACES*5;
+  float points[NPOINTS][3];
+  float normals[NFACES][3]= {{0,0,-1}, {0,0,1}, {0,1,0}, {-1, 0, 0}, {0, -1, 0}, {1,0,0}};
+
+  // Indices for the eight faces
+#ifdef INVENTOR2_0
+  static long  
+#else 
+  static int32_t
+#endif
+  indices[NINDICES] = {3,2,1,0, SO_END_FACE_INDEX, // bottom
+                                       4,5,6,7, SO_END_FACE_INDEX, // top
+                                       0,1,5,4, SO_END_FACE_INDEX, 
+                                       1,2,6,5, SO_END_FACE_INDEX,
+                                       2,3,7,6, SO_END_FACE_INDEX,
+                                       3,0,4,7, SO_END_FACE_INDEX};
+
+  
+  // points for the eight vertices
+  points[0][0] =  fDx1.getValue(); points[0][1] =  fDy1.getValue(); points[0][2] = -fDz.getValue();
+  points[1][0] = -fDx1.getValue(); points[1][1] =  fDy1.getValue(); points[1][2] = -fDz.getValue();
+  points[2][0] = -fDx1.getValue(); points[2][1] = -fDy1.getValue(); points[2][2] = -fDz.getValue();
+  points[3][0] =  fDx1.getValue(); points[3][1] = -fDy1.getValue(); points[3][2] = -fDz.getValue();
+  points[4][0] =  fDx2.getValue(); points[4][1] =  fDy2.getValue(); points[4][2] =  fDz.getValue();
+  points[5][0] = -fDx2.getValue(); points[5][1] =  fDy2.getValue(); points[5][2] =  fDz.getValue();
+  points[6][0] = -fDx2.getValue(); points[6][1] = -fDy2.getValue(); points[6][2] =  fDz.getValue();
+  points[7][0] =  fDx2.getValue(); points[7][1] = -fDy2.getValue(); points[7][2] =  fDz.getValue();
+
+  float t1 = FATAN((fDx2.getValue()-fDx1.getValue())/(2*fDz.getValue()));
+  float t2 = FATAN((fDy2.getValue()-fDy1.getValue())/(2*fDz.getValue()));
+  float st1 = FSIN(t1);
+  float st2 = FSIN(t2);
+  float ct1 = FCOS(t1);
+  float ct2 = FCOS(t2);
+
+  normals[0][0] = 0   ; normals[0][1] =    0; normals [0][2] =  -1;    
+  normals[1][0] = 0   ; normals[1][1] =    0; normals [1][2] =   1;    
+  normals[2][0] = 0   ; normals[2][1] =  ct2; normals [2][2] = -st2;    
+  normals[3][0] = -ct1; normals[3][1] =    0; normals [3][2] = -st1;    
+  normals[4][0] = 0   ; normals[4][1] = -ct2; normals [4][2] = -st2;    
+  normals[5][0] =  ct1; normals[5][1] =    0; normals [5][2] = -st1;    
+
+  for (int np=0;np<NPOINTS;np++) theCoordinates->point.set1Value(np,points[np][0],points[np][1],points[np][2]);
+  theFaceSet->coordIndex.setValues(0,NINDICES,indices);
+  for (int nf=0;nf<NFACES;nf++) theNormals->vector.set1Value(nf,normals[nf][0],normals[nf][1],normals[nf][2]);
+  theNormalBinding->value=SoNormalBinding::PER_FACE;
+}
+
+// generateChildren
+void SoTrd::generateChildren() {
+
+  // This routines creates one SoSeparator, one SoCoordinate3, and
+  // one SoLineSet, and puts it in the child list.  This is done only
+  // once, whereas redrawing the position of the coordinates occurs each
+  // time an update is necessary, in the updateChildren routine. 
+
+  assert(children->getLength() ==0);
+  SoSeparator      *sep              = new SoSeparator(); 
+  SoCoordinate3    *theCoordinates   = new SoCoordinate3();
+  SoNormal         *theNormals       = new SoNormal(); 
+  SoNormalBinding  *theNormalBinding = new SoNormalBinding();
+  SoIndexedFaceSet *theFaceSet       = new SoIndexedFaceSet();
+  // 
+  // This line costs some in render quality! but gives speed.
+  // 
+  sep->addChild(theCoordinates);
+  sep->addChild(theNormals);
+  sep->addChild(theNormalBinding);
+  sep->addChild(theFaceSet);
+  children->append(sep);
+}
+
+// generateAlternateRep
+void SoTrd::generateAlternateRep() {
+
+  // This routine sets the alternate representation to the child
+  // list of this mode.  
+
+  if (children->getLength() == 0) generateChildren();
+  updateChildren();
+  alternateRep.setValue((SoSeparator *)  ( *children)[0]);
+}
+
+// clearAlternateRep
+void SoTrd::clearAlternateRep() {
+  alternateRep.setValue(NULL);
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/OpenInventor/src/SoTubs.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/OpenInventor/src/SoTubs.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/OpenInventor/src/SoTubs.cc	(revision 1102)
@@ -0,0 +1,473 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+//
+// $Id: SoTubs.cc,v 1.8 2006/06/29 21:23:07 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+/*-----------------------------HEPVis---------------------------------------*/
+/*                                                                          */
+/* Node:             SoTubs                                                 */
+/* Description:      Represents the G4Tubs Geant Geometry entity            */
+/* Author:           Joe Boudreau Nov 11 1996                               */
+/*                                                                          */
+/*--------------------------------------------------------------------------*/
+
+#ifdef G4VIS_BUILD_OI_DRIVER
+
+// this :
+#include "HEPVis/nodes/SoTubs.h"
+
+#include <assert.h>
+#include <cmath>
+
+#include <Inventor/SbBox.h>
+#include <Inventor/actions/SoGLRenderAction.h>
+#include <Inventor/fields/SoSFFloat.h>
+#include <Inventor/misc/SoChildList.h>
+#include <Inventor/nodes/SoSeparator.h>
+#include <Inventor/nodes/SoIndexedFaceSet.h>
+#include <Inventor/nodes/SoNormal.h>
+#include <Inventor/nodes/SoCoordinate3.h>
+#include <Inventor/nodes/SoNormalBinding.h>
+#include <Inventor/SoPrimitiveVertex.h>
+#include <Inventor/elements/SoTextureCoordinateElement.h>
+
+#include "HEPVis/SbMath.h"
+
+// This statement is required
+SO_NODE_SOURCE(SoTubs)
+
+// Constructor
+SoTubs::SoTubs() {
+
+
+  // This statement is required
+  SO_NODE_CONSTRUCTOR(SoTubs);
+
+  // Data fields are initialized like this:
+  SO_NODE_ADD_FIELD(pRMin,               (0));
+  SO_NODE_ADD_FIELD(pRMax,               (1));
+  SO_NODE_ADD_FIELD(pDz,                 (10));
+  SO_NODE_ADD_FIELD(pSPhi,               (0));
+  SO_NODE_ADD_FIELD(pDPhi,               ((float)(2*M_PI)));
+  SO_NODE_ADD_FIELD(alternateRep,        (NULL));
+  children = new SoChildList(this);
+}
+
+// Destructor
+SoTubs::~SoTubs() {
+  delete children;
+}
+
+
+// initClass
+void SoTubs::initClass(){
+  // This statement is required.
+  SO_NODE_INIT_CLASS(SoTubs,SoShape,"Shape");
+}
+
+// generatePrimitives
+void SoTubs::generatePrimitives(SoAction *action) {
+  // This variable is used to store each vertex
+  SoPrimitiveVertex pv;
+
+  // Access the stat from the action
+  SoState *state = action->getState();
+
+  // See if we have to use a texture coordinate function,
+  // rather than generating explicit texture coordinates.
+  SbBool useTexFunction=
+    (SoTextureCoordinateElement::getType(state) == 
+     SoTextureCoordinateElement::FUNCTION);
+
+  // If we need to generate texture coordinates with a function,
+  // we'll need an SoGLTextureCoordinateElement.  Otherwise, we'll
+  // set up the coordinates directly.
+  const SoTextureCoordinateElement* tce = NULL;
+  SbVec4f texCoord;
+  if (useTexFunction) {
+    tce = SoTextureCoordinateElement::getInstance(state);
+  }
+  else {
+    texCoord[2] = 0.0;
+    texCoord[3] = 1.0;
+  }
+  SbVec3f point, normal;
+
+
+  ///////////////////////////////////////////////////////
+  //-----------------------------------------------------
+#define GEN_VERTEX(pv,x,y,z,s,t,nx,ny,nz)               \
+  point.setValue((float)(x),(float)(y),(float)(z));     \
+  normal.setValue((float)(nx),(float)(ny),(float)(nz)); \
+  if (useTexFunction) {                                 \
+    texCoord=tce->get(point,normal);                    \
+  } else {                                              \
+    texCoord[0]=(float)(s);                             \
+    texCoord[1]=(float)(t);                             \
+  }                                                     \
+  pv.setPoint(point);                                   \
+  pv.setNormal(normal);                                 \
+  pv.setTextureCoords(texCoord);                        \
+  shapeVertex(&pv);
+  //-----------------------------------------------------
+  ///////////////////////////////////////////////////////
+
+  int NPHI = (int)(2+22*std::fabs(pDPhi.getValue()/(2.0*M_PI)));
+  double deltaPhi = pDPhi.getValue()/NPHI, phi0 = pSPhi.getValue(),phi1=phi0+pDPhi.getValue();
+  double rMax=pRMax.getValue(),rMin=pRMin.getValue();
+  double zMax=pDz.getValue(),zMin=-zMax;
+  double cosPhi0=std::cos(phi0), sinPhi0=std::sin(phi0);
+  double cosPhi1=std::cos(phi1), sinPhi1=std::sin(phi1);
+  double cosDeltaPhi=std::cos(deltaPhi),sinDeltaPhi=std::sin(deltaPhi);
+  //
+  // The outer surface!
+  //
+  int i;
+  double sinPhi,cosPhi;
+  beginShape(action,TRIANGLE_STRIP);
+  sinPhi=sinPhi0;
+  cosPhi=cosPhi0;
+  for (i = 0; i<=NPHI; i++) {
+    GEN_VERTEX(pv,rMax*cosPhi,rMax*sinPhi,zMax,0.0,0.0,cosPhi,sinPhi,0);   
+    GEN_VERTEX(pv,rMax*cosPhi,rMax*sinPhi,zMin,1.0,1.0,cosPhi,sinPhi,0);   
+    inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);    
+  }
+  endShape();
+  //
+  // The inner surface!
+  //
+  if(rMin!=0.F) {
+    beginShape(action,TRIANGLE_STRIP);
+    sinPhi=sinPhi0;
+    cosPhi=cosPhi0;
+    for (i = 0; i<=NPHI; i++) {
+      GEN_VERTEX(pv,rMin*cosPhi,rMin*sinPhi,zMax,0.0,0.0,-cosPhi,-sinPhi,0);   
+      GEN_VERTEX(pv,rMin*cosPhi,rMin*sinPhi,zMin,1.0,1.0,-cosPhi,-sinPhi,0);   
+      inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);    
+    } 
+    endShape();
+  }
+  if (std::fabs(deltaPhi)<2.0*M_PI) { 
+    //
+    // The end 
+    //
+    beginShape(action,TRIANGLE_STRIP);
+    sinPhi=sinPhi0;
+    cosPhi=cosPhi0;
+    GEN_VERTEX(pv,rMax*cosPhi,rMax*sinPhi,zMax,0.0,0.0,sinPhi,-cosPhi,0);   
+    GEN_VERTEX(pv,rMax*cosPhi,rMax*sinPhi,zMin,1.0,1.0,sinPhi,-cosPhi,0);   
+    GEN_VERTEX(pv,rMin*cosPhi,rMin*sinPhi,zMax,1.0,0.0,sinPhi,-cosPhi,0);   
+    GEN_VERTEX(pv,rMin*cosPhi,rMin*sinPhi,zMin,0.0,1.0,sinPhi,-cosPhi,0);   
+    endShape();
+    //
+    // The other end 
+    //
+    beginShape(action,TRIANGLE_STRIP);
+    sinPhi=sinPhi1;
+    cosPhi=cosPhi1;
+    GEN_VERTEX(pv,rMax*cosPhi,rMax*sinPhi, zMax,0.0,0.0,-sinPhi,+cosPhi,0);   
+    GEN_VERTEX(pv,rMax*cosPhi,rMax*sinPhi, zMin,1.0,1.0,-sinPhi,+cosPhi,0);   
+    GEN_VERTEX(pv,rMin*cosPhi,rMin*sinPhi, zMax,1.0,0.0,-sinPhi,+cosPhi,0);   
+    GEN_VERTEX(pv,rMin*cosPhi,rMin*sinPhi, zMin,0.0,1.0,-sinPhi,+cosPhi,0);   
+    endShape();
+  }
+  //
+  // The outer surface at z=+PDZ
+  //
+  if(rMin==0.F) {
+    beginShape(action,TRIANGLE_FAN);
+    sinPhi=sinPhi0;
+    cosPhi=cosPhi0;
+    GEN_VERTEX(pv,0,0,zMax,0.0,0.0,0,0,1);   
+    for (i = 0; i<=NPHI; i++) {
+      GEN_VERTEX(pv,rMax*cosPhi,rMax*sinPhi,zMax,1.0,1.0,0,0,1);   
+      inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);    
+    }
+    endShape();
+    //
+    // The outer surface at z=-PDZ
+    //
+    beginShape(action,TRIANGLE_FAN);
+    sinPhi=sinPhi0;
+    cosPhi=cosPhi0;
+    GEN_VERTEX(pv,0,0,zMin,0.0,0.0,0,0,-1);   
+    for (i = 0; i<=NPHI; i++) {
+      GEN_VERTEX(pv,rMax*cosPhi,rMax*sinPhi,zMin,1.0,1.0,0,0,-1);   
+      inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);    
+    }
+    endShape();
+  } else {
+    beginShape(action,TRIANGLE_STRIP);
+    sinPhi=sinPhi0;
+    cosPhi=cosPhi0;
+    for (i = 0; i<=NPHI; i++) {
+      GEN_VERTEX(pv,rMin*cosPhi,rMin*sinPhi,zMax,0.0,0.0,0,0,1);   
+      GEN_VERTEX(pv,rMax*cosPhi,rMax*sinPhi,zMax,1.0,1.0,0,0,1);   
+      inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);    
+    }
+    endShape();
+    //
+    // The outer surface at z=-PDZ
+    //
+    beginShape(action,TRIANGLE_STRIP);
+    sinPhi=sinPhi0;
+    cosPhi=cosPhi0;
+    for (i = 0; i<=NPHI; i++) {
+      GEN_VERTEX(pv,rMin*cosPhi,rMin*sinPhi,zMin,0.0,0.0,0,0,-1);   
+      GEN_VERTEX(pv,rMax*cosPhi,rMax*sinPhi,zMin,1.0,1.0,0,0,-1);   
+      inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);    
+    }
+    endShape();
+  }
+}
+
+// getChildren
+SoChildList *SoTubs::getChildren() const {
+  return children;
+}
+
+
+// computeBBox
+void SoTubs::computeBBox(SoAction *, SbBox3f &box, SbVec3f &center ){
+  SbVec3f vmin(-pRMax.getValue(),-pRMax.getValue(),-pDz.getValue()), 
+          vmax( pRMax.getValue(), pRMax.getValue(), pDz.getValue());
+  center.setValue(0,0,0);
+  box.setBounds(vmin,vmax);
+}
+
+
+// updateChildren
+void SoTubs::updateChildren() {
+
+  // Redraw the G4Tubs....
+
+  assert(children->getLength()==1);
+  SoSeparator       *sep                = (SoSeparator *)  ( *children)[0];
+  SoCoordinate3     *theCoordinates     = (SoCoordinate3 *)      ( sep->getChild(0));
+  SoNormal          *theNormals         = (SoNormal *)           ( sep->getChild(1)); 
+  SoNormalBinding   *theNormalBinding   = (SoNormalBinding *)    ( sep->getChild(2));
+  SoIndexedFaceSet  *theFaceSet         = (SoIndexedFaceSet *)   ( sep->getChild(3));
+  
+  
+  const int NPHI=24, NPOINTS=2*(2*NPHI+2), NFACES=4*NPHI+2, NINDICES = NFACES*5;
+  float points[NPOINTS][3],normals[NFACES][3];
+#ifdef INVENTOR2_0
+  static long     indices[NINDICES];
+#else
+  static int32_t  indices[NINDICES];
+#endif
+    
+  static int init=0;
+  double phi, pp, DeltaPhi;
+    
+  // Indices need to be generated once! This is here to keep it close to the point
+  // generation, since otherwise it will be confusing.
+    
+  int i;
+  if (!init) {
+    init = 1;
+    // Outer face
+    for (i = 0; i< NPHI; i++) {
+      // 0 1 3 2;
+      indices[5*i+0] =  2*i+0;
+      indices[5*i+1] =  2*i+1;
+      indices[5*i+2] =  2*i+3;
+      indices[5*i+3] =  2*i+2;
+      indices[5*i+4] = SO_END_FACE_INDEX;
+    }
+    // the inner face
+    for (i=0;i<NPHI;i++) {
+      indices[5*1*NPHI + 5*i+0] = 2*NPHI+2 + 2*i+0;  
+      indices[5*1*NPHI + 5*i+1] = 2*NPHI+2 + 2*i+1;
+      indices[5*1*NPHI + 5*i+2] = 2*NPHI+2 + 2*i+3;
+      indices[5*1*NPHI + 5*i+3] = 2*NPHI+2 + 2*i+2;
+      indices[5*1*NPHI + 5*i+4] = SO_END_FACE_INDEX;
+    }
+    // the top side
+    for (i=0;i<NPHI;i++) {
+      indices[5*2*NPHI + 5*i+0] = 2*i+0;
+      indices[5*2*NPHI + 5*i+1] = 2*i+2;
+      indices[5*2*NPHI + 5*i+2] = NPOINTS - (2*i+4);
+      indices[5*2*NPHI + 5*i+3] = NPOINTS - (2*i+2);
+      indices[5*2*NPHI + 5*i+4] = SO_END_FACE_INDEX;
+    }
+    // the bottom side
+    for (i=0;i<NPHI;i++) {
+      indices[5*3*NPHI + 5*i+0] = 2*i+1;
+      indices[5*3*NPHI + 5*i+1] = NPOINTS - (2*i+1);
+      indices[5*3*NPHI + 5*i+2] = NPOINTS - (2*i+3);
+      indices[5*3*NPHI + 5*i+3] = 2*i+3;
+      indices[5*3*NPHI + 5*i+4] = SO_END_FACE_INDEX;
+    }
+    // the odd side
+    indices[5*4*NPHI +0] = 2*NPHI;
+    indices[5*4*NPHI +1] = 2*NPHI+1;
+    indices[5*4*NPHI +2] = 2*NPHI+3;
+    indices[5*4*NPHI +3] = 2*NPHI+2;
+    indices[5*4*NPHI +4] = SO_END_FACE_INDEX;
+    // aother odd side
+    indices[5*4*NPHI +5 +0] = 0;
+    indices[5*4*NPHI +5 +1] = NPOINTS-2;
+    indices[5*4*NPHI +5 +2] = NPOINTS-1;
+    indices[5*4*NPHI +5 +3] = 1;
+    indices[5*4*NPHI +5 +4] = SO_END_FACE_INDEX;
+  }
+  // Points need to be generated each time:
+  if (pDPhi.getValue()<2*M_PI) {
+    // the odd side
+    indices[5*4*NPHI +0] = 2*NPHI;
+    indices[5*4*NPHI +1] = 2*NPHI+1;
+    indices[5*4*NPHI +2] = 2*NPHI+3;
+    indices[5*4*NPHI +3] = 2*NPHI+2;
+    indices[5*4*NPHI +4] = SO_END_FACE_INDEX;
+    // aother odd side
+    indices[5*4*NPHI +5 +0] = 0;
+    indices[5*4*NPHI +5 +1] = NPOINTS-2;
+    indices[5*4*NPHI +5 +2] = NPOINTS-1;
+    indices[5*4*NPHI +5 +3] = 1;
+    indices[5*4*NPHI +5 +4] = SO_END_FACE_INDEX;
+  } 
+  else {
+    // the odd side
+    indices[5*4*NPHI +0] = SO_END_FACE_INDEX;
+    indices[5*4*NPHI +1] = SO_END_FACE_INDEX;
+    indices[5*4*NPHI +2] = SO_END_FACE_INDEX;
+    indices[5*4*NPHI +3] = SO_END_FACE_INDEX;
+    indices[5*4*NPHI +4] = SO_END_FACE_INDEX;
+    // aother odd side
+    indices[5*4*NPHI +5 +0] = SO_END_FACE_INDEX;
+    indices[5*4*NPHI +5 +1] = SO_END_FACE_INDEX;
+    indices[5*4*NPHI +5 +2] = SO_END_FACE_INDEX;
+    indices[5*4*NPHI +5 +3] = SO_END_FACE_INDEX;
+    indices[5*4*NPHI +5 +4] = SO_END_FACE_INDEX;
+  }
+  // The outer surface
+  DeltaPhi = pDPhi.getValue()/NPHI, phi = pSPhi.getValue();
+  for (i = 0; i<=NPHI; i++) {
+    points[2*i+0][0] = pRMax.getValue()*FCOS(phi); 
+    points[2*i+0][1]= pRMax.getValue()*FSIN(phi); 
+    points[2*i+0][2] = +pDz.getValue();
+
+    points[2*i+1][0] = pRMax.getValue()*FCOS(phi); 
+    points[2*i+1][1]= pRMax.getValue()*FSIN(phi); 
+    points[2*i+1][2] = -pDz.getValue();
+
+    pp = phi+DeltaPhi/2.0;
+    if (i!=NPHI) {
+      normals[i][0] = FCOS(pp); 
+      normals[i][1] = FSIN(pp); 
+      normals[i][2] = 0;
+    }
+    phi+=DeltaPhi;
+  }
+  // The inner surface
+  phi = pSPhi.getValue() + pDPhi.getValue();
+  for (i = 0; i<=NPHI; i++) {
+    points[2*NPHI+2+2*i+0][0] = pRMin.getValue()*FCOS(phi); 
+    points[2*NPHI+2+2*i+0][1] = pRMin.getValue()*FSIN(phi); 
+    points[2*NPHI+2+2*i+0][2] = +pDz.getValue();
+    points[2*NPHI+2+2*i+1][0] = pRMin.getValue()*FCOS(phi); 
+    points[2*NPHI+2+2*i+1][1] = pRMin.getValue()*FSIN(phi); 
+    points[2*NPHI+2+2*i+1][2] = -pDz.getValue();
+    pp = phi-DeltaPhi/2.0;
+    if (i!=NPHI) {
+      normals[NPHI+i][0] = -FCOS(pp); 
+      normals[NPHI+i][1] = -FSIN(pp); 
+      normals[NPHI+i][2] = 0;
+    }
+    phi-=DeltaPhi;
+  }
+  // The top side
+  for (i=0;i<NPHI;i++) {
+    normals[2*NPHI+i][0]=normals[2*NPHI+i][1]=0; 
+    normals[2*NPHI+i][2]=  1.0;
+  } 
+  // The bottom side
+  for (i=0;i<NPHI;i++) {
+    normals[3*NPHI+i][0]=normals[3*NPHI+i][1]=0; 
+    normals[3*NPHI+i][2]= -1.0;
+  } 
+  // The odd side
+  phi = pSPhi.getValue(); 
+  normals[4*NPHI+0][0]=  FSIN(phi); 
+  normals[4*NPHI+0][1]= -FCOS(phi); 
+  normals[4*NPHI+0][2]=0;
+    
+    // Another odd side
+  phi = pSPhi.getValue()+pDPhi.getValue(); 
+  normals[4*NPHI+1][0]= -FSIN(phi); 
+  normals[4*NPHI+1][1]= +FCOS(phi); 
+  normals[4*NPHI+1][2]=0;
+    
+  for (int np=0;np<NPOINTS; np++) theCoordinates->point.set1Value(np,points[np][0],points[np][1],points[np][2]);
+  for (int ni=0;ni<NINDICES;ni++) theFaceSet->coordIndex.set1Value(ni,indices[ni]);
+  for (int nf=0;nf<NFACES;nf++) theNormals->vector.set1Value(nf,normals[nf][0],normals[nf][1],normals[nf][2]);
+  theNormalBinding->value=SoNormalBinding::PER_FACE;
+}
+
+// generateChildren
+void SoTubs::generateChildren() {
+
+  // This routines creates one SoSeparator, one SoCoordinate3, and
+  // one SoLineSet, and puts it in the child list.  This is done only
+  // once, whereas redrawing the position of the coordinates occurs each
+  // time an update is necessary, in the updateChildren routine. 
+
+  assert(children->getLength() ==0);
+  SoSeparator      *sep              = new SoSeparator(); 
+  SoCoordinate3    *theCoordinates   = new SoCoordinate3();
+  SoNormal         *theNormals       = new SoNormal(); 
+  SoNormalBinding  *theNormalBinding = new SoNormalBinding();
+  SoIndexedFaceSet *theFaceSet       = new SoIndexedFaceSet();
+  // 
+  // This line costs some in render quality! but gives speed.
+  // 
+  sep->addChild(theCoordinates);
+  sep->addChild(theNormals);
+  sep->addChild(theNormalBinding);
+  sep->addChild(theFaceSet);
+  children->append(sep);
+}
+
+// generateAlternateRep
+void SoTubs::generateAlternateRep() {
+
+  // This routine sets the alternate representation to the child
+  // list of this mode.  
+
+  if (children->getLength() == 0) generateChildren();
+  updateChildren();
+  alternateRep.setValue((SoSeparator *)  ( *children)[0]);
+}
+
+// clearAlternateRep
+void SoTubs::clearAlternateRep() {
+  alternateRep.setValue(NULL);
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/RayTracer/GNUmakefile
===================================================================
--- tags/visualization-10.5-before-10.6_test/RayTracer/GNUmakefile	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/RayTracer/GNUmakefile	(revision 1102)
@@ -0,0 +1,44 @@
+# $Id: GNUmakefile,v 1.11 2005/11/18 23:07:04 allison Exp $
+
+name := G4RayTracer
+
+ifndef G4INSTALL
+  G4INSTALL = ../../..
+endif
+
+GLOBLIBS  = libG4vis_management.lib libG4modeling.lib
+GLOBLIBS += libG4run.lib libG4event.lib
+GLOBLIBS += libG4tracking.lib libG4processes.lib libG4digits_hits.lib
+GLOBLIBS += libG4track.lib libG4particles.lib libG4geometry.lib
+GLOBLIBS += libG4materials.lib libG4graphics_reps.lib
+GLOBLIBS += libG4intercoms.lib libG4global.lib
+
+include $(G4INSTALL)/config/architecture.gmk
+include $(G4INSTALL)/config/G4VIS_BUILD.gmk
+include $(G4INSTALL)/config/interactivity.gmk
+
+CPPFLAGS += -DG4VIS_ALLOC_EXPORT
+
+CPPFLAGS += -I$(G4BASE)/visualization/modeling/include
+CPPFLAGS += -I$(G4BASE)/visualization/management/include
+CPPFLAGS += -I$(G4BASE)/graphics_reps/include
+CPPFLAGS += -I$(G4BASE)/global/management/include
+CPPFLAGS += -I$(G4BASE)/global/HEPGeometry/include
+CPPFLAGS += -I$(G4BASE)/global/HEPRandom/include
+CPPFLAGS += -I$(G4BASE)/geometry/management/include
+CPPFLAGS += -I$(G4BASE)/geometry/navigation/include
+CPPFLAGS += -I$(G4BASE)/geometry/volumes/include
+CPPFLAGS += -I$(G4BASE)/digits_hits/detector/include
+CPPFLAGS += -I$(G4BASE)/digits_hits/digits/include
+CPPFLAGS += -I$(G4BASE)/intercoms/include
+CPPFLAGS += -I$(G4BASE)/event/include
+CPPFLAGS += -I$(G4BASE)/track/include
+CPPFLAGS += -I$(G4BASE)/tracking/include
+CPPFLAGS += -I$(G4BASE)/digits_hits/hits/include
+CPPFLAGS += -I$(G4BASE)/particles/bosons/include
+CPPFLAGS += -I$(G4BASE)/particles/management/include
+CPPFLAGS += -I$(G4BASE)/processes/management/include
+CPPFLAGS += -I$(G4BASE)/processes/cuts/include
+CPPFLAGS += -I$(G4BASE)/materials/include
+
+include $(G4INSTALL)/config/common.gmk
Index: tags/visualization-10.5-before-10.6_test/RayTracer/History
===================================================================
--- tags/visualization-10.5-before-10.6_test/RayTracer/History	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/RayTracer/History	(revision 1102)
@@ -0,0 +1,227 @@
+$Id: History,v 1.56 2009/08/19 08:39:19 lgarnier Exp $
+-------------------------------------------------------------------
+
+     =========================================================
+     Geant4 - an Object-Oriented Toolkit for Simulation in HEP
+     =========================================================
+
+                      Category History file
+                      ---------------------
+This file should be used by G4 developers and category coordinators
+to briefly summarize all major modifications introduced in the code
+and keep track of all category-tags.
+It DOES NOT substitute the  CVS log-message one should put at every
+committal in the CVS repository !
+
+     *************************************************************
+     * Note that modeling and test have their own History files. *
+     *************************************************************
+
+     ----------------------------------------------------------
+     * Reverse chronological order (last date on top), please *
+     ----------------------------------------------------------
+
+History file for Ray Tracer category
+---------------------------------------
+
+19 August 2009 Laurent Garnier
+ - G4RayTracerViewer.cc, G4RayTracerXViewer.cc : Fix an bad use of fVP
+   parameters
+
+18 August 2009 Laurent Garnier
+ - G4RayTracerXViewer, G4RTXScanner : Fix a crash introduce by the 
+   new way of handling window size hints (January 2009)
+
+4th April 2008  John Allison  (raytracer-V09-01-00)
+ - Fixed gcc-4.3.0 compiler warnings.
+
+14th June 2007  John Allison  (raytracer-V08-03-01)
+- Fixed memory leak in G4RayTracer (wrapper class).
+
+22nd May 2007  John Allison  (raytracer-V08-03-00)
+- Fixed for dubious ValGrind diagnostic showing apparent memory leak in
+  G4RTSimpleScanner and G4RTXScanner.
+
+5th January 2007  John Allison  (raytracer-V08-02-00)
+- Bug fix: use of window size hints.
+
+17th November 2006  Joseph Perl  (raytracer-V08-01-02)
+- Deprecate /vis/rayTracer/backgroundColour.
+- Hasn't worked for some time anyway.
+- Users are instead referred to /vis/viewer/set/background.
+
+14th November 2006  John Allison  (raytracer-V08-01-01)
+- Merged raytracer-V08-01-00-branch onto main branch.
+
+11th November 2006  John Allison  (raytracer-V08-01-00-00)
+- Followed change to G4Scene.
+
+14th August 2006  John Allison  (raytracer-V08-01-00)
+- G4RayTracerSceneHandler.cc: Added world to dummy scene to improve
+  robustness when under control of vis manager.
+
+12th May 2006  John Allison  (raytracer-V08-00-04)
+- SetRecomputeTransients(false).
+
+10th May 2006  Makoto Asai (raytracer-V08-00-03)
+- Remove G4RayShooter class to Event category.
+
+21st April 2006  John Allison  (raytracer-V08-00-02)
+- Relies on improved protection for null models and parameters.
+
+26th January 2006  John Allison  (raytracer-V08-00-01)
+- G4RayTracerSceneHandler: Improved handling of dummy scene.
+- G4TheRayTracer: Advance work for possible inclusion of
+  anti-aliasing.  Currently no change of functionality.
+
+11th January 2006  John Allison  (raytracer-V08-00-00)
+- Reorganisation (needs visman-V08-00-02):
+  o Allowed multiple ray tracers.
+  o Separated out the original ray tracer into G4TheRayTracer, to be
+    used by viewers.
+  o Made G4RTMessenger a smart singleton that queries the vis manager
+    for tracers.
+  o Caused G4RayTracer to instantiate a default ray tracer if the user
+    wants to use /vis/rayTracer commands without the benefit of the
+    vis system (scene handlers and viewers).
+
+4th December 2005  Makoto Asai (raytracer-V07-01-08)
+- Correct initialization of G4RTTrackingAction and G4RTSteppingAction
+
+28th November 2005  Jane Tinslay (raytracer-V07-01-07)
+- Remove names of unused parameters to stop compiler warnings
+
+18th November 2005  John Allison  (raytracer-V07-01-06)
+- Merged in raytracer-V07-01-04 - see below.
+- Implemented window positioning.
+
+28th October 2005  Makoto Asai (raytracer-V07-01-05)
+- Working tag for merging "envelope" into G4Region.
+- This tag does not contain raytracer-V07-01-04 tag that might be
+  already done by J. Allison but does not yet appear on this file.
+
+13th October September 2005  John Allison (raytracer-V07-01-04)
+(On branch raytracer-V07-01-01-branch; changes *not* merged into head -
+need to cvs update -j raytracer-V07-01-02 -j raytracer-V07-01-01-branch.)
+- Migrated to <sstream>.
+- Default background black - can be changed by /vis/viewer/set/background.
+- GNUmakefile: Removed temporary CPPFLAGS += -DG4VIS_BUILD_RAYTRACERX_DRIVER.
+
+30th September 2005  Joseph Perl (raytracer-V07-01-03)
+New tag to include change Makoto made an hour after V07-01-02 was tagged.
+Change seems to just involve passing pWorld to material list where no argument was passed in previous version.
+
+16th September 2005  John Allison (raytracer-V07-01-02)
+(On branch raytracer-V07-01-01-branch; changes merged into head.)
+- Bug fix (black holes): Made small epsilon push into world to ensure inside.
+
+20th July 2005  John Allison (raytracer-V07-01-01)
+- Protected RayTracerX by G4VIS macro.
+
+17th July 2005  John Allison (raytracer-V07-01-00)
+- Introduced RayTracerX.  RayTracerX opens an X window and builds up
+  the picture, refining it gradually.  Already calculated pixels are
+  not recalculated, so it is as efficient as a top-to-bottom raster
+  scan.  It produces a jpeg file as well, just like RayTracer.
+
+11th June 2004  Gabriele Cosmo  (raytracer-V06-01-00)
+- Use global flag G4VIS_ALLOC_EXPORT to export extern symbols for DLLs.
+  Modified GNUmakefile and rearranged usage of extern symbols in classes.
+
+12th November 2003  Mark Donszelmann
+- GNUmakefile: added Modeling/include directory to compile on Windows.
+
+6th November 2003  John Allison  (raytracer-V05-02-04, vis-V05-02-03)
+- GNUmakefile: rationalised.
+
+4th October 2003  Gabriele Cosmo  (raytracer-V05-02-03)
+- GNUmakefile:
+  o added dependency to new module "geometry/navigation".
+  o replaced "digits+hits" with "digits_hits".
+- Coworks with "geometry-V05-02-00" and "digits_hits-V05-02-00".
+
+25th September 2003  Hisaya Kurashige  (raytracer-V05-02-02)
+- Modify GNUmakefile to use processes/cuts category 
+
+18th September 2003  John Allison  (raytracer-V05-02-01, greps-V05-02-00)
+- Introduced G4VRTScanner and its default concrete implementation,
+  G4RTSimpleScanner.  It controls the shooting order of rays.
+- Added new command /vis/rayTracer/backgroundColour.
+
+4th August 2003  Makoto Asai  (raytracer-V05-02-00)
+- Migrate to the changes with "Cuts per region"
+
+18th June 2003  Gabriele Cosmo  (raytracer-V05-01-01)
+- Removed usage of G4USE_STD_NAMESPACE in G4RTJpegMaker.cc, after
+  migration from G4std.
+
+30th May 2003  Makoto Asai  (raytracer-V05-01-00)
+- Fix pedantic warning message.
+
+11th December 2002  John Allison  (vis-V04-01-10)
+- Fix for SUN-CC warnings: AddThis hides the virtual function...
+- Fix memory leak in RayTracer.
+
+11th November 2002  Hajime Yoshida and Minamimoto (raytracer-V04-00-01)
+- Corrected G4RayTracer.cc devide-by-zero.
+
+16th October 2002  John Allison  (raytracer-V04-00-00)
+- Tag for changes in G4VTrajectory, etc.
+
+22nd April 2002  John Allison
+- Workaround for pseudo-parallel/orthogonal projection in Ray Tracer.  It is
+  perspective projection with *very* small field angle (perMillion).
+
+22nd Nov 2001   Gabriele Cosmo  (raytracer-V03-02-02)
+- G4RTJpegMaker.cc: added check on ISO compliance for binary mode on
+  file streamsi, to allow compilation on non-ISO compilers.
+
+13th Nov 2001   Hajime Yoshida and Minamimoto (raytracer-V03-02-01)
+- Updation of G4RTJpegMaker.cc for Windows platform.
+
+14th July 2001  John Allison  (raytracer-V03-02-00)
+- Changed some arguments in G4RayTracer.hh from G4ThreeVector to const
+  G4ThreeVector& to keep Sun compiler happy.
+
+18th May 2001  John Allison  (raytracer-V03-01-00)
+- Removed unnecessary virtual inheritance of G4VViewer in G4RayTracerViewer.
+
+2nd May 2000  John Allison
+- G4RayTracer: set out-of-world ray to black.
+- G4RayTracerViewer: corrected trapping of orthogonal projection.
+
+10th March 2000  Makoto Asai
+- Added some comments for copyright notice and for the software reference manual.
+
+24th February 2000  John Allison
+- Added protection for null viewer in G4RTSteppingAction.cc and
+  G4RayTrajectory.cc.
+- Corrected for zoom, etc., in G4RayTracerViewer.cc.
+
+23rd February 2000  John Allison
+- Added G4RayTracerSceneHandler and Viewer.
+- Some modifications to other RayTracer routines for vis compliance.
+- (Note: headAngle still not right - ray traced views are sometimes tipped.)
+
+22nd February 2000  John Allison (raytracer-V01-00-01a)
+- Added G4std:: in a few places to obtain ISO compliance.
+- Change "char*" to "const char*" in G4OutBitStream::CopyByte(...).
+
+22nd February 2000  Makoto Asai (raytracer-V01-00-01)
+- Change "char*" to "const char*"
+- use g4std/fstream
+
+17th February 2000  Makoto Asai (raytracer-V01-00-00)
+- Primary tag of sub-category
+
+29th January 2000  Makoto Asai
+- Introduction of G4RayTracer (visualization/RayTracer/...)
+- Migration of G4RayTracer
+  affected files :
+    visualization/GNUmakefile
+    visualization/management/include/MyVisManager.cc
+    visualization/management/src/G4VisManager.cc
+  affected files in other directory :
+    config/G4VIS_BUILD.gmk
+    config/G4VIS_USE.gmk
+
Index: tags/visualization-10.5-before-10.6_test/RayTracer/README
===================================================================
--- tags/visualization-10.5-before-10.6_test/RayTracer/README	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/RayTracer/README	(revision 1102)
@@ -0,0 +1,82 @@
+
+G4RayTracer  version 1.0  (29/Jan/00)
+
+1. Introduction
+
+ G4RayTracer is a "ray tracing" package which uses Geant4 kernel mechanism
+of tracking/navigation. It visualizes any kinds of solids that Geant4
+kernel can navigate.
+
+2. Building a library
+
+ G4RayTracer is one of visualization driver which Geant4 supports. To build
+a library of G4RayTracer (library name G4RayTracer), set an environment
+variable G4VIS_BUILD_RAYTRACER_DRIVER.
+
+ $ setenv G4VIS_BUILD_RAYTRACER_DRIVER 1
+
+3. Using G4RayTracer
+
+ To use G4RayTracer, set an environment variable G4VIS_USE_RAYTRACER.
+
+ $ setenv G4VIS_USE_RAYTRACER 1
+
+Also, G4RayTracer has to be registored to the user's concrete VisManager.
+Refer an example given in 
+  geant4/source/visualization/management/include/MyVisManager.cc.
+
+4. Notes
+
+a) G4RayTracer generates JPEG file(s). To visualize these files, use your
+local program such as NetScape or xview, etc.
+
+b) The eye position must be inside of the defined world volume. If you want 
+to draw your detector setup from very far position, you need to enlarge
+your world volume.
+
+c) G4RayTracer ignores volumes without G4VisAttributes, volumes which are
+set as "forced wire frame", and volumes which are set as "invisible".
+
+d) In case you get unexpected figure, check 
+ d.1) eye position and target position are properly set,
+ d.2) light direction is properly set (note light direction is from
+     illumination light source to the objects),
+ d.3) span angle (given by angle for 100 pixels) is reasonable,
+ d.4) there is no surrounding volume(s) without transparency.
+
+e) G4RayTracer can be executed ONLY AT "Idle" state.
+
+5. Basic UI commands
+
+a) /vis/rayTracer/eyePosition x y z unit
+    eye position
+
+b) /vis/rayTracer/target x y z unit
+    target position
+    in default it is set to the origine
+
+c) /vis/rayTracer/lightDirection ex ey ez
+    vector of the illuminating light (need not to be a unit vector)
+    note light direction is from illumination light source to the objects
+
+d) /vis/rayTracer/column nColumn
+    number of holizontal pixels
+    in default 640 pixels
+
+e) /vis/rayTracer/row nRow
+    number of virtical pixels
+    in default 640 pixels
+
+f) /vis/rayTracer/span angle unit
+    angle for 100 pixels
+    in default 5 degree
+
+g) /vis/rayTracer/trace fileName
+    execution of G4RayTracer
+    "fileName" is the out put JPEG file name 
+    in default "g4RayTracer.jpeg"
+    NOTE THAT THIS COMMAND IS AVAILABLE ONLY AT IDLE STATE
+
+
+
+
Index: tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RTJpeg.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RTJpeg.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RTJpeg.hh	(revision 1102)
@@ -0,0 +1,210 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4RTJpeg.hh,v 1.6 2006/06/29 21:23:13 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+//
+
+// class description:
+//
+//  This header file defines some static constant variables and error classes
+// used internally by G4JpegMaker and related classes
+//
+
+#ifndef G4RTJpeg_H
+#define G4RTJpeg_H 1
+
+typedef	unsigned char	u_char;
+typedef unsigned int	u_int;
+
+const char      JFIF[] = "JFIF";
+const char      JFXX[] = "JFXX";
+
+const double    Sqrt2 = 1.41421356;
+const double    DisSqrt2 = 1.0 / Sqrt2;
+const double    PaiDiv16 = 3.14159265 / 16;
+
+//Zigzag
+static const int Zigzag[64] = {
+                 0,  1,  8, 16,  9,  2,  3, 10,
+                17, 24, 32, 25, 18, 11,  4,  5,
+                12, 19, 26, 33, 40, 48, 41, 34,
+                27, 20, 13,  6,  7, 14, 21, 28,
+                35, 42, 49, 56, 57, 50, 43, 36,
+                29, 22, 15, 23, 30, 37, 44, 51,
+                58, 59, 52, 45, 38, 31, 39, 46,
+                53, 60, 61, 54, 47, 55, 62, 63
+};
+
+//ProcessResult
+enum
+jProcessResult{
+  M_NoError = 0,
+  M_RuntimeError = -1,
+  M_DataError = -2
+};
+
+// JpegMarkerCode
+enum
+jMarker{
+
+        M_SOF0  = 0xc0,
+        M_SOF1  = 0xc1,
+        M_SOF2  = 0xc2,
+        M_SOF3  = 0xc3,
+
+        M_SOF5  = 0xc5,
+        M_SOF6  = 0xc6,
+        M_SOF7  = 0xc7,
+
+        M_JPG   = 0xc8,
+        M_SOF9  = 0xc9,
+        M_SOF10 = 0xca,
+        M_SOF11 = 0xcb,
+
+        M_SOF13 = 0xcd,
+        M_SOF14 = 0xce,
+        M_SOF15 = 0xcf,
+
+        M_DHT   = 0xc4,
+
+        M_DAC   = 0xcc,
+
+        M_RST0  = 0xd0,         M_RST1  = 0xd1,
+        M_RST2  = 0xd2,         M_RST3  = 0xd3,
+        M_RST4  = 0xd4,         M_RST5  = 0xd5,
+        M_RST6  = 0xd6,         M_RST7  = 0xd7,
+
+        M_SOI   = 0xd8,
+        M_EOI   = 0xd9,
+        M_SOS   = 0xda,
+        M_DQT   = 0xdb,
+        M_DNL   = 0xdc,
+        M_DRI   = 0xdd,
+        M_DHP   = 0xde,
+        M_EXP   = 0xdf,
+        M_COM   = 0xfe,
+
+        M_APP0  = 0xe0,         M_APP1  = 0xe1,
+        M_APP2  = 0xe2,         M_APP3  = 0xe3,
+        M_APP4  = 0xe4,         M_APP5  = 0xe5,
+        M_APP6  = 0xe6,         M_APP7  = 0xe7,
+        M_APP8  = 0xe8,         M_APP9  = 0xe9,
+        M_APP10 = 0xea,         M_APP11 = 0xeb,
+        M_APP12 = 0xec,         M_APP13 = 0xed,
+        M_APP14 = 0xee,         M_APP15 = 0xef,
+
+
+        M_JPG0  = 0xf0,         M_JPG1  = 0xf1,
+        M_JPG2  = 0xf2,         M_JPG3  = 0xf3,
+        M_JPG4  = 0xf4,         M_JPG5  = 0xf5,
+        M_JPG6  = 0xf6,         M_JPG7  = 0xf7,
+        M_JPG8  = 0xf8,         M_JPG9  = 0xf9,
+        M_JPG10 = 0xfa,         M_JPG11 = 0xfb,
+        M_JPG12 = 0xfc,         M_JPG13 = 0xfd,
+
+
+        M_TEM   = 0x01,
+        M_RESst  = 0x02,
+        M_RESend = 0xbf,
+
+        M_Error  = 0xff,
+        M_Marker  = 0xff
+};
+
+//JpegProperty
+struct
+G4JpegProperty{
+  int nRow;
+  int nColumn;
+  int Dimension;
+  int SamplePrecision;
+  const char * Comment;
+  int Format;
+  u_char MajorRevisions;
+  u_char MinorRevisions;
+  int Units;
+  int HDensity;
+  int VDensity;
+  int HThumbnail;
+  int VThumbnail;
+  int ExtensionCode;
+};
+
+
+//MemoryError
+class G4MemoryError
+{
+  public:
+    G4MemoryError(int size, const char* message)
+        {mSize = size;          mMessage = message;};
+        int mSize;
+        const char* mMessage;
+};
+
+//IndexError
+class G4IndexError
+{
+  public:
+    G4IndexError(int maxIndex, int errorIndex, const char* mes)
+        {mMaxIndex = maxIndex;  mErrorIndex = errorIndex;  mMessage = mes;};
+        int mMaxIndex;
+        int mErrorIndex;
+        const char* mMessage;
+};
+
+//BufferError
+class G4BufferError
+{
+  public:
+    G4BufferError(const char* mes)
+        {mMessage = mes;};
+        const char* mMessage;
+};
+
+//DataFormatError
+class G4DataFormatError
+{
+  public:
+    G4DataFormatError(void* address, const char* message)
+        {mAddress = address;            mMessage = message;};
+        void* mAddress;
+        const char* mMessage;
+};
+
+
+//NotSupported
+class G4NotSupported
+{
+  public:
+    G4NotSupported(jMarker aMark, void* address)
+        {mMark = aMark;         mAddress = address;};
+        jMarker mMark;
+        void* mAddress;
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RTJpegCoder.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RTJpegCoder.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RTJpegCoder.hh	(revision 1102)
@@ -0,0 +1,99 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4RTJpegCoder.hh,v 1.6 2006/06/29 21:23:15 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+//
+
+// class description:
+//
+//  This class converts 8 bit unsighned ints array to JPEG code.
+//
+
+#ifndef G4RTJpegCoder_H
+#define G4RTJpegCoder_H 1
+#include "G4RTJpeg.hh"
+
+//HuffmanTable
+struct
+G4HuffmanCodeTable
+{
+        int     numOfElement;
+        int*    SizeT;
+        int*    CodeT;
+};
+
+class G4OutBitStream;
+
+class G4JpegCoder
+{
+  public:
+    G4JpegCoder(u_char* colorR,u_char* colorG,u_char* colorB);
+    ~G4JpegCoder(void);
+
+    void GetJpegData(char** aJpegData,int& size);
+
+    void SetJpegProperty(const G4JpegProperty& aProperty);
+
+    int DoCoding(void);
+
+
+  protected:
+        u_char* mRgb[3];
+        int mYBlock[4][64];
+        int mCbBlock[64];
+        int mCrBlock[64];
+        double mCosT[8][8];
+        int mDCTData[64];
+        int mPreDC[3];
+
+        G4JpegProperty mProperty;
+        int mNumVUnits;
+        int mNumHUnits;
+
+        G4OutBitStream *mOBSP;
+
+        void CodeMCU();
+
+        void makeYCC(int ux,int uy);
+
+        void CodeHuffman(int cs);
+
+        void ForwardDCT(int* picData);
+
+        void Quantization(int cs);
+
+        void WriteHeader(void);
+        void WriteEOI(void);
+};
+
+const u_int JFIFLength = 16;
+const u_int JFIFVersion = 0x0102;     //JFIF Ver 1.02
+const u_char YSampleF = 0x22;
+const u_char CSampleF = 0x11;
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RTJpegCoderTables.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RTJpegCoderTables.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RTJpegCoderTables.hh	(revision 1102)
@@ -0,0 +1,335 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4RTJpegCoderTables.hh,v 1.6 2006/06/29 21:23:17 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+
+// class description:
+//  
+//  This header file defines some hard coded numbers used by G4RTJpegCoder
+// to convert 8 bits RGB to JPEG.
+//
+
+#ifndef G4RTJpegCoderTable_H
+#define G4RTJpegCoderTable_H 1
+
+#include "G4RTJpeg.hh"
+
+//QuantumTable
+
+static const int	YQuantumT[] = {
+
+	1,  1,  1,  1,  1,  1,  1,  1,
+	1,  1,  1,  1,  1,  1,  1,  1,
+	1,  1,  1,  1,  1,  1,  1,  1,
+	1,  1,  1,  1,  1,  1,  1,  1,
+	1,  1,  1,  1,  1,  1,  1,  1,
+	1,  1,  1,  1,  1,  1,  1,  1,
+	1,  1,  1,  1,  1,  1,  1,  1,
+	1,  1,  1,  1,  1,  1,  1,  1,
+};
+
+static const int	CQuantumT[] = {
+
+	1,  1,  1,  1,  1,  1,  1,  1,
+	1,  1,  1,  1,  1,  1,  1,  1,
+	1,  1,  1,  1,  1,  1,  1,  1,
+	1,  1,  1,  1,  1,  1,  1,  1,
+	1,  1,  1,  1,  1,  1,  1,  1,
+	1,  1,  1,  1,  1,  1,  1,  1,
+	1,  1,  1,  1,  1,  1,  1,  1,
+	1,  1,  1,  1,  1,  1,  1,  1,
+};
+
+//HuffmanCode
+
+static const int	YDcSizeT[] = {
+		0x0002, 0x0003, 0x0003, 0x0003,
+		0x0003, 0x0003, 0x0004, 0x0005,
+		0x0006, 0x0007, 0x0008, 0x0009	};
+static const int	YDcCodeT[] = {	
+		0x0000, 0x0002, 0x0003, 0x0004,
+		0x0005, 0x0006, 0x000e, 0x001e,
+		0x003e, 0x007e, 0x00fe, 0x01fe	};
+static const G4HuffmanCodeTable	YDcHuffmanT = {
+	12,
+	(int*)YDcSizeT,
+	(int*)YDcCodeT	
+};
+
+
+static const int	CDcSizeT[] = {	 
+		0x0002, 0x0002, 0x0002, 0x0003,
+		0x0004, 0x0005, 0x0006, 0x0007,
+		0x0008, 0x0009, 0x000a, 0x000b	};
+static const int	CDcCodeT[] = {	 
+		0x0000, 0x0001, 0x0002, 0x0006,
+		0x000e, 0x001e, 0x003e, 0x007e,
+		0x00fe, 0x01fe, 0x03fe, 0x07fe	};
+static const G4HuffmanCodeTable	CDcHuffmanT = {
+	12, 
+	(int*)CDcSizeT,
+	(int*)CDcCodeT 
+};
+
+ 
+static const int	YAcSizeT[] = {
+		 4,  2,  2,  3,  4,  5,  7,  8,
+		10, 16, 16,  4,  5,  7,  9, 11,
+		16, 16, 16, 16, 16,  5,  8, 10,
+		12, 16, 16, 16, 16, 16, 16,  6,
+		 9, 12, 16, 16, 16, 16, 16, 16,
+		16,  6, 10, 16, 16, 16, 16, 16,
+		16, 16, 16,  7, 11, 16, 16, 16,
+		16, 16, 16, 16, 16,  7, 12, 16,
+		16, 16, 16, 16, 16, 16, 16,  8,
+		12, 16, 16, 16, 16, 16, 16, 16,
+		16,  9, 15, 16, 16, 16, 16, 16,
+		16, 16, 16,  9, 16, 16, 16, 16,
+		16, 16, 16, 16, 16,  9, 16, 16,
+		16, 16, 16, 16, 16, 16, 16, 10,
+		16, 16, 16, 16, 16, 16, 16, 16,
+		16, 10, 16, 16, 16, 16, 16, 16,
+		16, 16, 16, 11, 16, 16, 16, 16,
+		16, 16, 16, 16, 16, 16, 16, 16,
+		16, 16, 16, 16, 16, 16, 16, 11,
+		16, 16, 16, 16, 16, 16, 16, 16,
+		16, 16 };
+static const int	YAcCodeT[] = { 
+		0x000a, 0x0000, 0x0001, 0x0004,
+		0x000b, 0x001a, 0x0078, 0x00f8,
+		0x03f6, 0xff82, 0xff83, 0x000c,
+		0x001b, 0x0079, 0x01f6, 0x07f6,
+		0xff84, 0xff85, 0xff86, 0xff87,
+		0xff88, 0x001c, 0x00f9, 0x03f7,
+		0x0ff4, 0xff89, 0xff8a, 0xff8b,
+		0xff8c, 0xff8d, 0xff8e, 0x003a,
+		0x01f7, 0x0ff5, 0xff8f, 0xff90,
+		0xff91, 0xff92, 0xff93, 0xff94,
+		0xff95, 0x003b, 0x03f8, 0xff96,
+		0xff97, 0xff98, 0xff99, 0xff9a,
+		0xff9b, 0xff9c, 0xff9d, 0x007a,
+		0x07f7, 0xff9e, 0xff9f, 0xffa0,
+		0xffa1, 0xffa2, 0xffa3, 0xffa4,
+		0xffa5, 0x007b, 0x0ff6, 0xffa6,
+		0xffa7, 0xffa8, 0xffa9, 0xffaa,
+		0xffab, 0xffac, 0xffad, 0x00fa,
+		0x0ff7, 0xffae, 0xffaf, 0xffb0,
+		0xffb1, 0xffb2, 0xffb3, 0xffb4,
+		0xffb5, 0x01f8, 0x7fc0, 0xffb6,
+		0xffb7, 0xffb8, 0xffb9, 0xffba,
+		0xffbb, 0xffbc, 0xffbd, 0x01f9,
+		0xffbe, 0xffbf, 0xffc0, 0xffc1,
+		0xffc2, 0xffc3, 0xffc4, 0xffc5,
+		0xffc6, 0x01fa, 0xffc7, 0xffc8,
+		0xffc9, 0xffca, 0xffcb, 0xffcc,
+		0xffcd, 0xffce, 0xffcf, 0x03f9,
+		0xffd0, 0xffd1, 0xffd2, 0xffd3,
+		0xffd4, 0xffd5, 0xffd6, 0xffd7,
+		0xffd8, 0x03fa, 0xffd9, 0xffda,
+		0xffdb, 0xffdc, 0xffdd, 0xffde,
+		0xffdf, 0xffe0, 0xffe1, 0x07f8,
+		0xffe2, 0xffe3, 0xffe4, 0xffe5,
+		0xffe6, 0xffe7, 0xffe8, 0xffe9,
+		0xffea, 0xffeb, 0xffec, 0xffed,
+		0xffee, 0xffef, 0xfff0, 0xfff1,
+		0xfff2, 0xfff3, 0xfff4, 0x07f9,
+		0xfff5, 0xfff6, 0xfff7, 0xfff8,
+		0xfff9, 0xfffa, 0xfffb, 0xfffc,
+		0xfffd, 0xfffe };
+static const G4HuffmanCodeTable	YAcHuffmanT = {
+	162, 
+	(int*)YAcSizeT,
+	(int*)YAcCodeT 
+};
+
+static const int		YEOBidx = 0;
+static const int		YZRLidx = 151;
+
+
+static const int	CAcSizeT[] = {
+		 2,  2,  3,  4,  5,  5,  6,  7,
+		 9, 10, 12,  4,  6,  8,  9, 11,
+		12, 16, 16, 16, 16,  5,  8, 10,
+		12, 15, 16, 16, 16, 16, 16,  5,
+		 8, 10, 12, 16, 16, 16, 16, 16,
+		16,  6,  9, 16, 16, 16, 16, 16,
+		16, 16, 16,  6, 10, 16, 16, 16,
+		16, 16, 16, 16, 16,  7, 11, 16,
+		16, 16, 16, 16, 16, 16, 16,  7,
+		11, 16, 16, 16, 16, 16, 16, 16,
+		16,  8, 16, 16, 16, 16, 16, 16,
+		16, 16, 16,  9, 16, 16, 16, 16,
+		16, 16, 16, 16, 16,  9, 16, 16,
+		16, 16, 16, 16, 16, 16, 16,  9,
+		16, 16, 16, 16, 16, 16, 16, 16,
+		16,  9, 16, 16, 16, 16, 16, 16,
+		16, 16, 16, 11, 16, 16, 16, 16,
+		16, 16, 16, 16, 16, 14, 16, 16,
+		16, 16, 16, 16, 16, 16, 16, 10,
+		15, 16, 16, 16, 16, 16, 16, 16,
+		16, 16 };
+static const int	CAcCodeT[] = { 
+		0x0000, 0x0001, 0x0004, 0x000a,
+		0x0018, 0x0019, 0x0038, 0x0078,
+		0x01f4, 0x03f6, 0x0ff4, 0x000b,
+		0x0039, 0x00f6, 0x01f5, 0x07f6,
+		0x0ff5, 0xff88, 0xff89, 0xff8a,
+		0xff8b, 0x001a, 0x00f7, 0x03f7,
+		0x0ff6, 0x7fc2, 0xff8c, 0xff8d,
+		0xff8e, 0xff8f, 0xff90, 0x001b,
+		0x00f8, 0x03f8, 0x0ff7, 0xff91,
+		0xff92, 0xff93, 0xff94, 0xff95,
+		0xff96, 0x003a, 0x01f6, 0xff97,
+		0xff98, 0xff99, 0xff9a, 0xff9b,
+		0xff9c, 0xff9d, 0xff9e, 0x003b,
+		0x03f9, 0xff9f, 0xffa0, 0xffa1,
+		0xffa2, 0xffa3, 0xffa4, 0xffa5,
+		0xffa6, 0x0079, 0x07f7, 0xffa7,
+		0xffa8, 0xffa9, 0xffaa, 0xffab,
+		0xffac, 0xffad, 0xffae, 0x007a,
+		0x07f8, 0xffaf, 0xffb0, 0xffb1,
+		0xffb2, 0xffb3, 0xffb4, 0xffb5,
+		0xffb6, 0x00f9, 0xffb7, 0xffb8,
+		0xffb9, 0xffba, 0xffbb, 0xffbc,
+		0xffbd, 0xffbe, 0xffbf, 0x01f7,
+		0xffc0, 0xffc1, 0xffc2, 0xffc3,
+		0xffc4, 0xffc5, 0xffc6, 0xffc7,
+		0xffc8, 0x01f8, 0xffc9, 0xffca,
+		0xffcb, 0xffcc, 0xffcd, 0xffce,
+		0xffcf, 0xffd0, 0xffd1, 0x01f9,
+		0xffd2, 0xffd3, 0xffd4, 0xffd5,
+		0xffd6, 0xffd7, 0xffd8, 0xffd9,
+		0xffda, 0x01fa, 0xffdb, 0xffdc,
+		0xffdd, 0xffde, 0xffdf, 0xffe0,
+		0xffe1, 0xffe2, 0xffe3, 0x07f9,
+		0xffe4, 0xffe5, 0xffe6, 0xffe7,
+		0xffe8, 0xffe9, 0xffea, 0xffeb,
+		0xffec, 0x3fe0, 0xffed, 0xffee,
+		0xffef, 0xfff0, 0xfff1, 0xfff2,
+		0xfff3, 0xfff4, 0xfff5, 0x03fa,
+		0x7fc3, 0xfff6, 0xfff7, 0xfff8,
+		0xfff9, 0xfffa, 0xfffb, 0xfffc,
+		0xfffd, 0xfffe };
+static const G4HuffmanCodeTable	CAcHuffmanT = {
+	162,
+	(int*)CAcSizeT,
+	(int*)CAcCodeT 
+};
+
+static const int		CEOBidx = 0;
+static const int		CZRLidx = 151;
+
+//HuffmanCode
+
+static const int		DcDhtLength = 0x21;
+static const int		AcDhtLength = 0xb7;
+
+static const u_char	YDcDht[] = {
+	0xff, 0xc4,		
+	0x00, 0x1f,			
+	0x00,			 
+	0x00, 0x01, 0x05, 0x01, 0x01, 0x01, 0x01, 0x01,	 
+	0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,	
+	0x08, 0x09, 0x0a, 0x0b
+};
+
+static const u_char	CDcDht[] = {	
+	0xff, 0xc4,	
+	0x00, 0x1f,			
+	0x01,			 
+	0x00, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,	 
+	0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,	
+	0x08, 0x09, 0x0a, 0x0b
+};
+
+static const u_char	YAcDht[] = {	
+	0xff, 0xc4,			
+	0x00, 0xb5,			
+	0x10,			 
+
+	0x00, 0x02, 0x01, 0x03, 0x03, 0x02, 0x04, 0x03,	 
+	0x05, 0x05, 0x04, 0x04, 0x00, 0x00, 0x01, 0x7d,
+
+	0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12,	
+	0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07,
+	0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08,
+	0x23, 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, 0xf0,
+	0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0a, 0x16,
+	0x17, 0x18, 0x19, 0x1a, 0x25, 0x26, 0x27, 0x28,
+	0x29, 0x2a, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
+	0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,
+	0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,
+	0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
+	0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
+	0x7a, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
+	0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98,
+	0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
+	0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6,
+	0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, 0xc5,
+	0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4,
+	0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2,
+	0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea,
+	0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
+	0xf9, 0xfa
+};
+
+static const u_char	CAcDht[] = {	
+	0xff, 0xc4,			
+	0x00, 0xb5,			
+	0x11,			 
+
+	0x00, 0x02, 0x01, 0x02, 0x04, 0x04, 0x03, 0x04,	 
+	0x07, 0x05, 0x04, 0x04, 0x00, 0x01, 0x02, 0x77,
+
+	0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21,	
+	0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71,
+	0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91,
+	0xa1, 0xb1, 0xc1, 0x09, 0x23, 0x33, 0x52, 0xf0,
+	0x15, 0x62, 0x72, 0xd1, 0x0a, 0x16, 0x24, 0x34,
+	0xe1, 0x25, 0xf1, 0x17, 0x18, 0x19, 0x1a, 0x26,
+	0x27, 0x28, 0x29, 0x2a, 0x35, 0x36, 0x37, 0x38,
+	0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
+	0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
+	0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
+	0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
+	0x79, 0x7a, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
+	0x88, 0x89, 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96,
+	0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5,
+	0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4,
+	0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3,
+	0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2,
+	0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda,
+	0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
+	0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
+	0xf9, 0xfa
+};
+
+#endif
+
Index: tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RTJpegMaker.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RTJpegMaker.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RTJpegMaker.hh	(revision 1102)
@@ -0,0 +1,60 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4RTJpegMaker.hh,v 1.6 2006/06/29 21:23:19 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+//
+
+// class description:
+//
+//  This is a concrete class of G4VFigureFileMaker.
+//  This class converts 8 bits unsighned integer arrays which represent RGB of
+// each pixel to JPEG code and stores it to a file. The only one public method
+// of this class will be invoked by G4RayTracer.
+//
+
+#ifndef G4RTJpegMaker_H
+#define G4RTJpegMaker_H 1
+
+#include "G4VFigureFileMaker.hh"
+#include "G4RTJpeg.hh"
+
+class G4RTJpegMaker : public G4VFigureFileMaker
+{
+  public:
+    G4RTJpegMaker();
+	virtual ~G4RTJpegMaker();
+
+  public:
+    virtual void CreateFigureFile(G4String fileName,
+	          int nColumn,int nRow,
+		  u_char* colorR, u_char* colorG,
+		  u_char* colorB);
+};
+
+#endif
+
Index: tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RTMessenger.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RTMessenger.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RTMessenger.hh	(revision 1102)
@@ -0,0 +1,89 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4RTMessenger.hh,v 1.7 2006/06/29 21:23:21 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+//
+
+// class description:
+//
+//  This is a concrete class of G4UImessenger. This class defines various
+// UI commands which are unique to G4RayTracer.
+//
+
+
+#ifndef G4RTMessenger_HH
+#define G4RTMessenger_HH 1
+
+#include "G4UImessenger.hh"
+class G4UIdirectory;
+class G4UIcmdWithABool;
+class G4UIcmdWith3Vector;
+class G4UIcmdWith3VectorAndUnit;
+class G4UIcmdWithADoubleAndUnit;
+class G4UIcmdWithAnInteger;
+class G4UIcmdWithAString;
+class G4TheRayTracer;
+class G4RTSteppingAction;
+
+class G4RTMessenger : public G4UImessenger
+{
+  public:
+    static G4RTMessenger* GetInstance
+    (G4TheRayTracer* p1,G4RTSteppingAction* p2);  // Singleton constructor.
+    virtual ~G4RTMessenger();
+    
+    virtual G4String GetCurrentValue(G4UIcommand * command);
+    virtual void SetNewValue(G4UIcommand * command,G4String newValue);
+
+  private:
+    G4RTMessenger(G4TheRayTracer* p1,G4RTSteppingAction* p2);
+    static G4RTMessenger* fpInstance;
+    G4TheRayTracer* theDefaultTracer;  // The first tracer to
+				       // instantiate this messenger.
+    G4TheRayTracer* theTracer;         // The current tracer.
+    G4RTSteppingAction* theSteppingAction;
+
+    G4UIdirectory* rayDirectory;
+    G4UIcmdWithAnInteger* columnCmd;
+    G4UIcmdWithAnInteger* rowCmd;
+    G4UIcmdWith3VectorAndUnit* targetCmd;
+    G4UIcmdWith3VectorAndUnit* eyePosCmd;
+    G4UIcmdWith3Vector* lightCmd;
+    G4UIcmdWithADoubleAndUnit* spanXCmd;
+    G4UIcmdWithADoubleAndUnit* headCmd;
+    G4UIcmdWithADoubleAndUnit* attCmd;
+    G4UIcmdWithABool* distCmd;
+    G4UIcmdWithABool* transCmd;
+    G4UIcmdWithAString* fileCmd;
+    G4UIcmdWith3Vector* bkgColCmd;
+};
+
+#endif
+
+
+
Index: tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RTOutBitStream.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RTOutBitStream.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RTOutBitStream.hh	(revision 1102)
@@ -0,0 +1,72 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4RTOutBitStream.hh,v 1.7 2006/06/29 21:23:23 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+//
+
+// class description:
+//
+//  This class represents a line of JPEG code. This class must be used exclusively
+// by G4RTJpegCoder.
+//
+
+#ifndef G4RTOutBitStream_H
+#define G4RTOutBitStream_H 1
+#include "G4RTJpeg.hh"
+
+static const u_char BitFullMaskT[8] = {0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f
+, 0xff};
+
+class G4OutBitStream
+{
+  public:
+    G4OutBitStream(int size);
+        void SetBits(int v, int numBits);
+        void SetByte(u_char dat);
+        void SetWord(u_int dat);
+        void CopyByte(const char* src, int n);
+
+        u_char* GetStreamAddress(void){return mHeadOfBuf;};
+        int GetStreamSize(void){return mBuf - mHeadOfBuf;};
+
+
+  protected:
+        u_char* mHeadOfBuf;
+        u_char* mBuf;
+        u_char* mEndOfBuf;
+        int mBitPos;
+        int mWriteFlag;
+
+        void IncBuf(void);
+        void FullBit(void);
+        void Set8Bits(u_char v, int numBits);
+        void SetFewBits(u_char v, int numBits);
+        void SetBits2Byte(u_char v, int numBits);
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RTSimpleScanner.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RTSimpleScanner.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RTSimpleScanner.hh	(revision 1102)
@@ -0,0 +1,72 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4RTSimpleScanner.hh,v 1.3 2006/06/29 21:23:25 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+//
+
+#ifndef G4RTSimpleScanner_H
+#define G4RTSimpleScanner_H 1
+
+// class description:
+//
+// G4RTSimpleScanner
+// Provides a simple raster of window coordinates.
+
+#include "G4VRTScanner.hh"
+
+class G4RTSimpleScanner: public G4VRTScanner {
+
+public: // with description
+
+  G4RTSimpleScanner();
+
+  // Compiler defaults for destructor, copy constructor and
+  // assignmemt.
+
+  virtual const G4String& GetGSName() const;
+  // Get name that acts as graphics system name.
+
+  virtual const G4String& GetGSNickname() const;
+  // Get name that acts as graphics system nickname.  It is this that
+  // the user specifies on the /vis/open and /vis/sceneHandler/create
+  // commands.
+
+  virtual void Initialize(G4int nRow, G4int nColumn);
+  // Intialises scanner for window with nRow rows and nColumn columns.
+
+  virtual G4bool Coords(G4int& iRow, G4int& iColumn);
+  // Supplies coordinate (iRow,iColumn) and returns false when the
+  // sequence has finished, i.e., on the call *after* suplying the
+  // last valid coordinate.
+
+protected:
+  G4String theGSName, theGSNickname;
+  G4int theNRow, theNColumn, theIRow, theIColumn;
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RTSteppingAction.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RTSteppingAction.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RTSteppingAction.hh	(revision 1102)
@@ -0,0 +1,71 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4RTSteppingAction.hh,v 1.5 2006/06/29 21:23:27 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+//
+
+// class description:
+//
+//  This is a concrete class of G4UserSteppingAction. This class is used
+// by G4RayTracer for managing a ray tracked through volumes. An object
+// of this class is constructed by G4RayTracer and set to G4SteppingManager
+// with replacement of user defined stepping action during the period of
+// ray tracing.
+//
+
+//////////////////////
+//G4RTSteppingAction
+/////////////////////
+
+
+#ifndef G4RTSteppingAction_h
+#define G4RTSteppingAction_h 1
+
+
+#include "G4UserSteppingAction.hh"
+#include "globals.hh"
+
+class G4RTSteppingAction : public G4UserSteppingAction
+{
+  public:
+    G4RTSteppingAction();
+    virtual ~G4RTSteppingAction(){;}
+
+    virtual void UserSteppingAction(const G4Step*);
+
+  private:
+    G4bool ignoreTransparency;
+
+  public:
+    inline void SetIgnoreTransparency(G4bool val)
+    { ignoreTransparency = val; }
+    inline G4bool GetIgnoreTransparency() const
+    { return ignoreTransparency; }
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RTTrackingAction.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RTTrackingAction.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RTTrackingAction.hh	(revision 1102)
@@ -0,0 +1,75 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4RTTrackingAction.hh,v 1.6 2006/06/29 21:23:29 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+//
+
+// class description:
+//
+//  This is a concrete class of G4UserTrackingAction. This class is used
+// by G4RayTracer for managing a ray tracked through volumes. An object
+// of this class is constructed by G4RayTracer and set to G4TrackingManager
+// with replacement of user defined tracking action during the period of
+// ray tracing.
+//
+
+///////////////////////
+//G4RTTrackingAction.hh
+///////////////////////
+
+
+#ifndef G4RTTrackingAction_h
+#define G4RTTrackingAction_h 1
+
+#include "G4UserTrackingAction.hh"
+
+class G4Track;
+
+///////////////////////////
+class G4RTTrackingAction : public G4UserTrackingAction
+///////////////////////////
+{
+
+//--------
+   public:
+//--------
+
+// Constructor & Destructor
+   G4RTTrackingAction(){;}
+   virtual ~G4RTTrackingAction(){;}
+
+// Member functions
+   virtual void PreUserTrackingAction(const G4Track* aTrack);
+   virtual void PostUserTrackingAction(const G4Track*){;}
+
+
+};
+
+#endif
+
+
Index: tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RTXScanner.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RTXScanner.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RTXScanner.hh	(revision 1102)
@@ -0,0 +1,93 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4RTXScanner.hh,v 1.4 2006/06/29 21:23:31 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+//
+
+#ifdef G4VIS_BUILD_RAYTRACERX_DRIVER
+
+#ifndef G4RTXScanner_H
+#define G4RTXScanner_H 1
+
+// class description:
+//
+// G4RTXScanner
+// Provides a sequence of window coordinates suitable for a visible
+// window of ever increasing resolution.
+
+#include "G4VRTScanner.hh"
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+
+class G4ViewParameters;
+
+class G4RTXScanner: public G4VRTScanner {
+
+public: // with description
+
+  G4RTXScanner();
+
+  // Compiler defaults for destructor, copy constructor and
+  // assignmemt.
+
+  virtual const G4String& GetGSName() const;
+  // Get name that acts as graphics system name.
+
+  virtual const G4String& GetGSNickname() const;
+  // Get name that acts as graphics system nickname.  It is this that
+  // the user specifies on the /vis/open and /vis/sceneHandler/create
+  // commands.
+
+  virtual void Initialize(G4int nRow, G4int nColumn);
+  // Intialises scanner for window with nRow rows and nColumn columns.
+
+  virtual G4bool Coords(G4int& iRow, G4int& iColumn);
+  // Supplies coordinate (iRow,iColumn) and returns false when the
+  // sequence has finished, i.e., on the call *after* suplying the
+  // last valid coordinate.
+
+  virtual void Draw
+  (unsigned char red, unsigned char green, unsigned char blue);
+  // Draw coloured square at current position.
+
+  G4bool GetXWindow(const G4String& name, G4ViewParameters&);
+
+protected:
+  G4String theGSName, theGSNickname;
+  G4int theNRow, theNColumn, theStep, theIRow, theIColumn;
+  // X Window variables...
+  Display* display;
+  Window win;
+  GC gc;
+  XStandardColormap *scmap;
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RayTracer.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RayTracer.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RayTracer.hh	(revision 1102)
@@ -0,0 +1,58 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4RayTracer.hh,v 1.12 2007/06/14 15:25:20 allison Exp $
+// GEANT4 tag $Name:  $
+//
+//
+
+
+#ifndef G4RayTracer_H
+#define G4RayTracer_H 1
+
+// class description:
+//
+// G4RayTracer
+// This is a factory for G4RayTracerSceneHandler and G4RayTracerViewer
+// objects.  The viewer uses the original G4RayTracer, which has now
+// been renamed G4TheRayTracer.
+
+#include "G4VGraphicsSystem.hh"
+
+class G4TheRayTracer;
+
+class G4RayTracer : public G4VGraphicsSystem
+{
+public: // with description
+  G4RayTracer();
+  ~G4RayTracer();
+  G4VSceneHandler* CreateSceneHandler (const G4String& );
+  G4VViewer* CreateViewer (G4VSceneHandler&, const G4String& );
+private:
+  G4TheRayTracer* theRayTracer;
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RayTracerFeatures.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RayTracerFeatures.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RayTracerFeatures.hh	(revision 1102)
@@ -0,0 +1,47 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4RayTracerFeatures.hh,v 1.4 2006/06/29 21:23:35 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+//
+
+
+#ifndef G4RayTracerFeatures_HH
+#define G4RayTracerFeatures_HH 1
+
+// To make John Allison happy...........
+
+const char RAYTRACER_FEATURES[] =
+"Low quality high speed visualization using Geant4 kernel tracking mechanism.\
+\n Features: Generate JPEG file(s) as default \
+\n           Visualize all kinds of solids including boolean solids \
+\n Disadvantages : Conceptually trajectories and hits cannot be drawn \
+\n                 No direct visualization";
+
+#endif
+
+
Index: tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RayTracerSceneHandler.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RayTracerSceneHandler.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RayTracerSceneHandler.hh	(revision 1102)
@@ -0,0 +1,72 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4RayTracerSceneHandler.hh,v 1.11 2006/06/29 21:23:37 gunter Exp $
+// GEANT4 tag $Name:  $
+
+// John Allison  17th March 2000
+
+#ifndef G4RAYTRACERSCENEHANDLER_HH
+#define G4RAYTRACERSCENEHANDLER_HH
+
+#include "G4VSceneHandler.hh"
+
+class G4RayTracerSceneHandler: public G4VSceneHandler {
+
+public:
+
+  G4RayTracerSceneHandler(G4VGraphicsSystem& system,
+			  const G4String& name = "");
+  virtual ~G4RayTracerSceneHandler();
+
+  void AddPrimitive(const G4Polyline&){}
+  void AddPrimitive(const G4Text&){}
+  void AddPrimitive(const G4Circle&){}
+  void AddPrimitive(const G4Square&){}
+  void AddPrimitive(const G4Polyhedron&){}
+  void AddPrimitive(const G4NURBS&){}
+  void AddPrimitive(const G4Polymarker&){}
+  void AddPrimitive(const G4Scale&){}
+
+  void AddSolid(const G4Box&){}
+  void AddSolid(const G4Cons&){}
+  void AddSolid(const G4Tubs&){}
+  void AddSolid(const G4Trd&){}
+  void AddSolid(const G4Trap&){}
+  void AddSolid(const G4Sphere&){}
+  void AddSolid(const G4Para&){}
+  void AddSolid(const G4Torus&){}
+  void AddSolid(const G4Polycone&){}
+  void AddSolid(const G4Polyhedra&){}
+  void AddSolid(const G4VSolid&){}
+  void AddCompound(const G4VTrajectory&){}
+  void AddCompound(const G4VHit&){}
+
+private:
+  static G4int    fSceneIdCount;  // Counter for RayTracer scene handlers.
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RayTracerViewer.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RayTracerViewer.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RayTracerViewer.hh	(revision 1102)
@@ -0,0 +1,54 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4RayTracerViewer.hh,v 1.7 2006/06/29 21:23:39 gunter Exp $
+// GEANT4 tag $Name:  $
+
+// John Allison  17th March 2000
+
+#ifndef G4RAYTRACERVIEWER_HH
+#define G4RAYTRACERVIEWER_HH
+
+#include "G4VViewer.hh"
+
+class G4TheRayTracer;
+
+class G4RayTracerViewer: public G4VViewer {
+public:
+  G4RayTracerViewer(G4VSceneHandler&,
+		    const G4String& name,
+		    G4TheRayTracer* = 0);
+  virtual ~G4RayTracerViewer();
+  void SetView();
+  void ClearView();
+  void DrawView();
+  G4TheRayTracer* GetTracer() {return theTracer;}
+protected:
+  G4int fFileCount;
+  G4TheRayTracer* theTracer;
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RayTracerX.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RayTracerX.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RayTracerX.hh	(revision 1102)
@@ -0,0 +1,56 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4RayTracerX.hh,v 1.4 2006/06/29 21:23:41 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+//
+// John Allison  11th September 2003
+
+#if defined (G4VIS_BUILD_RAYTRACERX_DRIVER) || (G4VIS_USE_RAYTRACERX)
+
+#ifndef G4RAYTRACERX_HH
+#define G4RAYTRACERX_HH
+
+// class description:
+//
+// G4RayTracerX
+// X window version of RayTracer - opens X window for viewing as well
+// as producing jpeg file just like G4RayTracer.
+
+#include "G4VGraphicsSystem.hh"
+
+class G4RayTracerX : public G4VGraphicsSystem
+{
+  public: // with description
+    G4RayTracerX();
+    ~G4RayTracerX();
+    G4VSceneHandler* CreateSceneHandler (const G4String& );
+    G4VViewer* CreateViewer (G4VSceneHandler&, const G4String& );
+};
+
+#endif
+#endif
Index: tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RayTracerXViewer.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RayTracerXViewer.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RayTracerXViewer.hh	(revision 1102)
@@ -0,0 +1,48 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4RayTracerXViewer.hh,v 1.4 2009/08/18 14:13:57 lgarnier Exp $
+// GEANT4 tag $Name:  $
+
+// John Allison  17th March 2000
+
+#ifdef G4VIS_BUILD_RAYTRACERX_DRIVER
+
+#ifndef G4RAYTRACERXVIEWER_HH
+#define G4RAYTRACERXVIEWER_HH
+
+#include "G4RayTracerViewer.hh"
+
+class G4RayTracerXViewer: public G4RayTracerViewer {
+public:
+  G4RayTracerXViewer(G4VSceneHandler&,const G4String& name);
+  virtual ~G4RayTracerXViewer();
+  void Initialise ();
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RayTrajectory.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RayTrajectory.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RayTrajectory.hh	(revision 1102)
@@ -0,0 +1,113 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4RayTrajectory.hh,v 1.15 2006/06/29 21:23:45 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+//
+
+// class description:
+//
+//  This is a concrete class of G4VTrajectory which represents a trajectory of a ray.
+//  This class is used by G4RayTracer. Objects of this class are created by G4RTTrackingAction.
+//  This class does not have concrete implementations of draw and print methods but
+// information stored in this class is used by determining a colour of a pixel of the picture.
+//
+
+///////////////////
+//G4RayTrajectory.hh
+///////////////////
+
+#ifndef G4RayTrajectory_h
+#define G4RayTrajectory_h 1
+
+class G4Step;
+
+#include "G4VTrajectory.hh"
+#include "G4Allocator.hh"
+#include <stdlib.h>
+#include <vector>
+#include "globals.hh"
+#include "G4Track.hh"
+#include "G4RayTrajectoryPoint.hh"
+
+
+class G4RayTrajectory : public G4VTrajectory
+{
+   public:
+
+   G4RayTrajectory(); 
+   G4RayTrajectory(G4RayTrajectory & right);
+   virtual ~G4RayTrajectory();
+
+   inline void* operator new(size_t);
+   inline void  operator delete(void*);
+  //   inline int operator == (const G4RayTrajectory& right){return (this==&right);}
+
+   virtual void AppendStep(const G4Step*);
+   virtual void ShowTrajectory(std::ostream&) const;
+   virtual void DrawTrajectory(G4int) const {;}
+   virtual int GetPointEntries() const {return positionRecord->size();}
+   virtual G4VTrajectoryPoint* GetPoint(G4int i) const 
+   { return (*positionRecord)[i]; }
+   G4RayTrajectoryPoint* GetPointC(G4int i) const 
+   { return (*positionRecord)[i]; }
+   virtual void MergeTrajectory(G4VTrajectory* secondTrajectory);  
+
+// Get/Set functions to satisfy pure virtual functions of base class.
+   inline G4int GetTrackID() const { return 0; }
+   inline G4int GetParentID() const { return 0; }
+   inline G4String GetParticleName() const { return ""; }
+   inline G4double GetCharge() const { return 0.; }
+   inline G4int GetPDGEncoding() const { return 0; }
+   inline G4ThreeVector GetInitialMomentum() const { return G4ThreeVector(); }
+
+   private:
+
+   std::vector<G4RayTrajectoryPoint*>* positionRecord;
+};
+
+#if defined G4VIS_ALLOC_EXPORT
+  extern G4DLLEXPORT G4Allocator<G4RayTrajectory> G4RayTrajectoryAllocator;
+#else
+  extern G4DLLIMPORT G4Allocator<G4RayTrajectory> G4RayTrajectoryAllocator;
+#endif
+
+inline void* G4RayTrajectory::operator new(size_t)
+{
+   void* aTrajectory;
+   aTrajectory = (void*)G4RayTrajectoryAllocator.MallocSingle();
+   return aTrajectory;
+}
+
+inline void G4RayTrajectory::operator delete(void* aTrajectory)
+{
+   G4RayTrajectoryAllocator.FreeSingle((G4RayTrajectory*)aTrajectory);
+}
+
+
+#endif
+
Index: tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RayTrajectoryPoint.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RayTrajectoryPoint.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/RayTracer/include/G4RayTrajectoryPoint.hh	(revision 1102)
@@ -0,0 +1,102 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4RayTrajectoryPoint.hh,v 1.9 2006/06/29 21:23:47 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+//
+
+// class description:
+//
+//  This is a concrete class of G4VTrajectoryPoint which represents a point where
+// a ray crosses upon a surface of a volume regardless of its visibility. Objects
+// of this class are created by G4RayTrajectory class object.
+//
+
+/////////////////////////
+//G4RayTrajectoryPoint.hh
+/////////////////////////
+
+#ifndef G4RayTrajectoryPoint_h
+#define G4RayTrajectoryPoint_h 1
+
+class G4VisAttributes;
+#include "globals.hh"
+#include "G4VTrajectoryPoint.hh"
+#include "G4Allocator.hh"
+#include "G4ThreeVector.hh"
+
+class G4RayTrajectoryPoint :public G4VTrajectoryPoint
+{
+  public:
+    G4RayTrajectoryPoint();
+    virtual ~G4RayTrajectoryPoint();
+
+    inline void *operator new(size_t);
+    inline void operator delete(void *aTrajectoryPoint);
+  //    inline int operator==(const G4RayTrajectoryPoint& right) const
+  // { return (this==&right); };
+
+  private:
+    const G4VisAttributes* preStepAtt;
+    const G4VisAttributes* postStepAtt;
+    G4ThreeVector    surfaceNormal;
+    G4double         stepLength;
+
+  public:
+    inline void SetPreStepAtt(const G4VisAttributes* val) { preStepAtt = val; }
+    inline const G4VisAttributes* GetPreStepAtt() const { return preStepAtt; }
+    inline void SetPostStepAtt(const G4VisAttributes* val) { postStepAtt = val; }
+    inline const G4VisAttributes* GetPostStepAtt() const { return postStepAtt; }
+    inline void SetSurfaceNormal(G4ThreeVector val) { surfaceNormal = val; }
+    inline G4ThreeVector GetSurfaceNormal() const { return surfaceNormal; }
+    inline void SetStepLength(G4double val) { stepLength = val; }
+    inline G4double GetStepLength() const { return stepLength; }
+
+    inline const G4ThreeVector GetPosition() const { return G4ThreeVector();}
+    // Dummy function (not used) to satisfy base class pure virtual function.
+};
+
+#if defined G4VIS_ALLOC_EXPORT
+  extern G4DLLEXPORT G4Allocator<G4RayTrajectoryPoint> G4RayTrajectoryPointAllocator;
+#else
+  extern G4DLLIMPORT G4Allocator<G4RayTrajectoryPoint> G4RayTrajectoryPointAllocator;
+#endif
+
+inline void* G4RayTrajectoryPoint::operator new(size_t)
+{
+   void *aTrajectoryPoint;
+   aTrajectoryPoint = (void *) G4RayTrajectoryPointAllocator.MallocSingle();
+   return aTrajectoryPoint;
+}
+
+inline void G4RayTrajectoryPoint::operator delete(void *aTrajectoryPoint)
+{
+   G4RayTrajectoryPointAllocator.FreeSingle((G4RayTrajectoryPoint *) aTrajectoryPoint);
+}
+
+#endif
+
Index: tags/visualization-10.5-before-10.6_test/RayTracer/include/G4TheRayTracer.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/RayTracer/include/G4TheRayTracer.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/RayTracer/include/G4TheRayTracer.hh	(revision 1102)
@@ -0,0 +1,186 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4TheRayTracer.hh,v 1.3 2006/06/29 21:23:49 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+//
+
+
+#ifndef G4TheRayTracer_H
+#define G4TheRayTracer_H 1
+
+// class description:
+//
+// G4TheRayTracer
+//   This is a graphics driver of Geant4 which generates a figure file by
+// ray tracing technique. The format of output figure file can be selected
+// by assigning a pointer of G4VFigureFileMaker concrete class object.
+//   The main entry of ray tracing is Trace() method, which is available
+// only at Idle state. G4TheRayTracer shoots rays and controls its own event
+// loop. It generates G4Event objects used for its own purpose. When ray
+// tracing is working, all sensitive detectors are inactivated and all
+// user action classes are swapped out. Still, verbosities set to Geant4
+// manager classes are concerned. Thus, it is recommended to set verbosities
+// to minimum (usually zero).
+//   G4TheRayTracer can visualise absolutely all kinds of geometrical shapes
+// which G4Navigator can deal with. Instead, it can NOT visualise hits
+// nor trajectories generated by usual simulation.
+
+#include "globals.hh"
+#include "G4ThreeVector.hh"
+#include "G4Colour.hh"
+
+class G4Event;
+class G4EventManager;
+class G4UserEventAction;
+class G4UserStackingAction;
+class G4UserTrackingAction;
+class G4UserSteppingAction;
+class G4RTTrackingAction;
+class G4RTSteppingAction;
+class G4RTMessenger;
+class G4RayShooter;
+class G4VFigureFileMaker;
+class G4RayTrajectoryPoint;
+class G4VisAttributes;
+class G4VRTScanner;
+
+
+class G4TheRayTracer
+{
+  public: // with description
+    G4TheRayTracer(G4VFigureFileMaker* figMaker = 0,
+		   G4VRTScanner* scanner = 0);
+    // Constructor. The argument is the pointer to G4VFigureFileMaker
+    // concrete class object. If it is not set and
+    // SetFigureFileMaker() method is not invoked before Trace()
+    // command is invoked, then G4RTJpegMaker will be used and JPEG
+    // file will be generated.  The second argument is a scanner that
+    // produces a sequence of window coordinates.  If it is not set
+    // here or if SetScanner is not invoked before Trace(), a default
+    // G4RTSimpleScanner will be used.
+
+  public:
+    ~G4TheRayTracer();
+
+  public: // with description
+    void Trace(G4String fileName);
+    // The main entry point which triggers ray tracing. "fileName" is output
+    // file name, and it must contain extention (e.g. myFigure.jpg). This
+    // method is available only if Geant4 is at Idle state.
+
+  protected:
+    G4bool CreateBitMap();
+    // Event loop
+    void CreateFigureFile(G4String fileName);
+    // Create figure file after an event loop
+    G4bool GenerateColour(G4Event* anEvent);
+    // Calcurate RGB for one trajectory
+    void StoreUserActions();
+    void RestoreUserActions();
+    // Store and restore user action classes if defined
+
+    G4Colour GetSurfaceColour(G4RayTrajectoryPoint* point);
+    G4Colour GetMixedColour(G4Colour surfCol,G4Colour transCol,G4double weight=0.5);
+    G4Colour Attenuate(G4RayTrajectoryPoint* point, G4Colour sourceCol);
+    G4bool ValidColour(const G4VisAttributes* visAtt);
+
+  public: // with description
+    inline void SetFigureFileMaker(G4VFigureFileMaker* figMaker)
+    // Set a concrete class of G4VFigureFileMaker for assigning the format of
+    // output figure file.
+    { theFigMaker = figMaker; }
+    inline G4VFigureFileMaker* GetFigureFileMaker() {return theFigMaker;}
+    inline void SetScanner(G4VRTScanner* scanner)
+    // Set a concrete class of G4VRTScanner for producing a sequence
+    // of window coordinates.
+    { theScanner = scanner; }
+    inline G4VRTScanner* GetScanner() {return theScanner;}
+
+  protected:
+    G4RayShooter * theRayShooter;
+    G4VFigureFileMaker * theFigMaker;
+    G4RTMessenger * theMessenger;
+    G4VRTScanner * theScanner;
+
+    G4EventManager * theEventManager;
+
+    G4UserEventAction * theUserEventAction;
+    G4UserStackingAction * theUserStackingAction;
+    G4UserTrackingAction * theUserTrackingAction;
+    G4UserSteppingAction * theUserSteppingAction;
+
+    G4UserEventAction * theRayTracerEventAction;
+    G4UserStackingAction * theRayTracerStackingAction;
+    G4RTTrackingAction * theRayTracerTrackingAction;
+    G4RTSteppingAction * theRayTracerSteppingAction;
+
+    unsigned char* colorR;
+    unsigned char* colorG;
+    unsigned char* colorB;
+
+    G4int nColumn;
+    G4int nRow;
+
+    G4ThreeVector eyePosition;
+    G4ThreeVector targetPosition;
+    G4ThreeVector eyeDirection;
+    G4ThreeVector lightDirection;
+    G4double headAngle;
+    G4double viewSpan; // Angle per 100 pixels
+    G4double attenuationLength;
+
+    G4bool distortionOn;
+    G4bool antialiasingOn;
+
+    G4Colour rayColour;
+    G4Colour backgroundColour;
+
+  public:
+    inline void SetNColumn(G4int val) { nColumn = val; }
+    inline G4int GetNColumn() const { return nColumn; }
+    inline void SetNRow(G4int val) { nRow = val; }
+    inline G4int GetNRow() const { return nRow; }
+    inline void SetEyePosition(const G4ThreeVector& val) { eyePosition = val; }
+    inline G4ThreeVector GetEyePosition() const { return eyePosition; }
+    inline void SetTargetPosition(const G4ThreeVector& val) { targetPosition = val; }
+    inline G4ThreeVector GetTargetPosition() const { return targetPosition; }
+    inline void SetLightDirection(const G4ThreeVector& val) { lightDirection = val.unit(); }
+    inline G4ThreeVector GetLightDirection() const { return lightDirection; }
+    inline void SetHeadAngle(G4double val) { headAngle = val; }
+    inline G4double GetHeadAngle() const { return headAngle; }
+    inline void SetViewSpan(G4double val) { viewSpan = val; }
+    inline G4double GetViewSpan() const { return viewSpan; }
+    inline void SetAttenuationLength(G4double val) { attenuationLength = val; }
+    inline G4double GetAttenuationLength() const { return attenuationLength; }
+    inline void SetDistortion(G4bool val) { distortionOn = val; }
+    inline G4bool GetDistortion() const { return distortionOn; }
+    inline void SetBackgroundColour(G4Colour val) { backgroundColour = val; }
+    inline G4Colour GetBackgroundColour() const { return backgroundColour; }
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/RayTracer/include/G4VFigureFileMaker.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/RayTracer/include/G4VFigureFileMaker.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/RayTracer/include/G4VFigureFileMaker.hh	(revision 1102)
@@ -0,0 +1,57 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VFigureFileMaker.hh,v 1.5 2006/06/29 21:23:51 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+//
+
+// class description:
+//
+//  This is an abstract class represents a class which generates a figure file
+// converting from RGB 8 bits unsigned integers to a kind of picture format.
+//
+
+#ifndef G4VFigureFileMaker_H
+#define G4VFigureFileMaker_H 1
+
+#include "globals.hh"
+
+class G4VFigureFileMaker
+{
+  public:
+    G4VFigureFileMaker() {;}
+    virtual ~G4VFigureFileMaker() {;}
+
+  public:
+    virtual void CreateFigureFile(G4String fileName,
+              int nColumn,int nRow,
+              unsigned char* colorR, unsigned char* colorG, 
+              unsigned char* colorB) = 0;
+};
+
+#endif
+
Index: tags/visualization-10.5-before-10.6_test/RayTracer/include/G4VRTScanner.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/RayTracer/include/G4VRTScanner.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/RayTracer/include/G4VRTScanner.hh	(revision 1102)
@@ -0,0 +1,72 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VRTScanner.hh,v 1.5 2006/06/29 21:23:53 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+//
+
+#ifndef G4VRTScanner_H
+#define G4VRTScanner_H 1
+
+// class description:
+//
+// G4VRTScanner
+// Interface class for provider of a sequence of window coordinates.
+
+#include "globals.hh"
+
+class G4VRTScanner {
+
+public: // with description
+
+  virtual const G4String& GetGSName() const = 0;
+  // Get name that acts as graphics system name.
+
+  virtual const G4String& GetGSNickname() const = 0;
+  // Get name that acts as graphics system nickname.  It is this that
+  // the user specifies on the /vis/open and /vis/sceneHandler/create
+  // commands.
+
+  virtual void Initialize(G4int nRow, G4int nColumn) = 0;
+  // Intialises scanner for window with nRow rows and nColumn columns.
+
+  virtual G4bool Coords(G4int& iRow, G4int& iColumn) = 0;
+  // Supplies coordinate (iRow,iColumn) and returns false when the
+  // sequence has finished, i.e., on the call *after* suplying the
+  // last valid coordinate.
+
+  virtual void Draw
+  (unsigned char red, unsigned char green, unsigned char blue);
+  // Draw coloured square at current position.
+
+};
+
+inline void G4VRTScanner::Draw
+(unsigned char, unsigned char, unsigned char)
+{}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/RayTracer/src/G4RTJpegCoder.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/RayTracer/src/G4RTJpegCoder.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/RayTracer/src/G4RTJpegCoder.cc	(revision 1102)
@@ -0,0 +1,382 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4RTJpegCoder.cc,v 1.6 2006/06/29 21:23:55 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+//
+//
+
+#include <stdlib.h>
+#include <string.h>
+#include <cmath>
+
+#include "G4RTJpeg.hh"
+#include "G4RTOutBitStream.hh"
+#include "G4RTJpegMaker.hh"
+#include "G4RTJpegCoder.hh"
+#include "G4RTJpegCoderTables.hh"
+
+
+G4JpegCoder::G4JpegCoder(u_char* colorR,u_char* colorG,u_char* colorB)
+{
+  mRgb[0] = colorR;
+  mRgb[1] = colorG;
+  mRgb[2] = colorB;
+
+  mPreDC[0] = mPreDC[1] = mPreDC[2] = 0;
+  mOBSP = 0;
+
+  for(int n=0; n<8; n++)
+                for(int m=0; m<8; m++)
+                                mCosT[n][m] = std::cos((2 * m + 1) * n * PaiDiv16);
+}
+
+G4JpegCoder::~G4JpegCoder(void)
+{
+  if(mOBSP != 0)
+                delete mOBSP;
+}
+
+void
+G4JpegCoder::GetJpegData(char** aJpegData, int& size)
+{
+  if (mOBSP != 0){
+    *aJpegData = (char*)mOBSP->GetStreamAddress();
+        size = mOBSP->GetStreamSize();
+        }
+        else{
+          *aJpegData = 0;
+          size = 0;
+        }
+
+}
+
+int
+G4JpegCoder::DoCoding(void)
+{
+  mNumVUnits = (mProperty.nRow / 16) + ((mProperty.nRow % 16) ? 1 : 0);
+  mNumHUnits = (mProperty.nColumn / 16) + ((mProperty.nColumn % 16) ? 1 : 0);
+
+  int size = mProperty.nColumn * mProperty.nRow * 3;
+  if(size < 10240)
+    size = 10240;
+
+  try{
+       mOBSP = new G4OutBitStream(size);
+           WriteHeader();
+           for(int yu=0; yu<mNumVUnits; yu++){
+                   for(int xu=0; xu<mNumHUnits; xu++){
+                           makeYCC(xu, yu);
+
+  //mRgb->YCrCb
+  #ifdef GRAY
+  for(int i=0; i<64; i++)
+        mCbBlock[i] = mCrBlock[i] = 0;
+  #endif
+         CodeMCU();
+         }
+       }
+       WriteEOI();
+           return M_NoError;
+     }
+
+  catch(G4MemoryError &me){
+                return M_RuntimeError;
+  }
+  catch(G4BufferError &be){
+                return M_RuntimeError;
+  }
+  catch(G4IndexError &ie){
+                return M_RuntimeError;
+  }
+}
+
+//MCU
+void
+G4JpegCoder::CodeMCU(void)
+{
+  for(int n=0; n<4; n++){
+                ForwardDCT(mYBlock[n]);
+                Quantization(0);
+                CodeHuffman(0);
+  }
+  ForwardDCT(mCbBlock);
+  Quantization(1);
+  CodeHuffman(1);
+
+  ForwardDCT(mCrBlock);
+  Quantization(2);
+  CodeHuffman(2);
+}
+
+void
+G4JpegCoder::makeYCC(int ux, int uy)
+{
+  u_char  rv, gv, bv;
+  int tCrBlock[4][64];
+  int tCbBlock[4][64];
+
+  for(int u=0; u<4; u++){
+        int *yp = mYBlock[u];
+        int *cbp = tCbBlock[u];
+        int *crp = tCrBlock[u];
+
+        int sx = ux * 16 + ((u&1) ? 8 : 0);
+        int ex = sx + 8;
+        int sy = uy * 16 + ((u>1) ? 8 : 0);
+        int ey = sy + 8;
+
+     for(int iv=sy; iv<ey; iv++){
+          int ii = iv < mProperty.nRow ? iv : mProperty.nRow - 1;
+          for(int ih=sx; ih<ex; ih++){
+            int jj = ih < mProperty.nColumn ? ih : mProperty.nColumn - 1;
+                int index = ii * mProperty.nColumn + jj;
+                rv = mRgb[0][index];
+                gv = mRgb[1][index];
+                bv = mRgb[2][index];
+
+                *yp++ = int((0.2990 * rv) + (0.5870 * gv) + (0.1140 * bv) - 128)
+;
+                *cbp++ = int(-(0.1687 * rv) - (0.3313 * gv) + (0.5000 * bv));
+                *crp++ = int((0.5000 * rv) - (0.4187 * gv) - (0.0813 * bv));
+                                }       // ih
+                           }    //iv
+  }     //u
+
+ int   n = 0;
+  for(int b=0; b<4; b++){
+        switch(b){
+                case 0:         n=0;    break;
+                case 1:         n=4;    break;
+                case 2:         n=32;   break;
+                case 3:         n=36;
+        }
+        for(int y=0; y<8; y+=2){
+                for(int x=0; x<8; x+=2){
+                        int idx = y * 8 + x;
+                        mCrBlock[n] = tCrBlock[b][idx];
+                        mCbBlock[n] = tCbBlock[b][idx];
+                        n++;
+                }
+                n += 4;
+        }
+  }
+}
+
+void
+G4JpegCoder::CodeHuffman(int cs)
+{
+  const G4HuffmanCodeTable& dcT = cs ? CDcHuffmanT : YDcHuffmanT;
+  const G4HuffmanCodeTable& acT = cs ? CAcHuffmanT : YAcHuffmanT;
+  const int eobIdx = cs ? CEOBidx : YEOBidx;
+  const int zrlIdx = cs ? CZRLidx : YZRLidx;
+
+  int diff = mDCTData[0] - mPreDC[cs];
+  mPreDC[cs] = mDCTData[0];
+  int absDiff = std::abs(diff);
+  int dIdx = 0;
+
+  while(absDiff > 0){
+        absDiff >>= 1;
+        dIdx++;
+  }
+  if(dIdx > dcT.numOfElement)
+        throw(G4IndexError(dcT.numOfElement, dIdx, "CodeHuffman:DC"));
+  mOBSP->SetBits((dcT.CodeT)[dIdx], (dcT.SizeT)[dIdx]);
+
+  if(dIdx){
+        if(diff < 0)
+                diff--;
+        mOBSP->SetBits(diff, dIdx);
+  }
+
+  int run = 0;
+  for(int n=1; n<64; n++){
+        int absCoefficient = std::abs( mDCTData[ Zigzag[n] ] );
+        if( absCoefficient ){
+                while( run > 15 ){
+                mOBSP->SetBits((acT.CodeT)[zrlIdx], (acT.SizeT)[zrlIdx]);
+                run -= 16;
+                }
+                int s = 0;
+                while( absCoefficient > 0 ){
+                        absCoefficient >>= 1;
+                        s++;
+                }
+                int     aIdx = run * 10 + s + (run == 15);
+                if( aIdx >= acT.numOfElement ) 
+                  throw( G4IndexError( acT.numOfElement, aIdx, "CodeHuffman:AC" )
+ );
+  mOBSP->SetBits( (acT.CodeT)[aIdx], (acT.SizeT)[aIdx] );
+                int     v = mDCTData[ Zigzag[n] ];
+                if( v < 0 )
+                  v--;
+                mOBSP->SetBits( v, s );
+                run = 0;
+                }
+                else{
+                  if(n == 63)
+                  mOBSP->SetBits( (acT.CodeT)[eobIdx], (acT.SizeT)[eobIdx] );
+                else
+                run++;
+                }
+        }
+}
+
+
+void
+G4JpegCoder::Quantization(int cs)
+{
+  int* qt = (int*)(cs ? CQuantumT : YQuantumT);
+  for( int i=0; i<64; i++ ){
+    mDCTData[i] /= qt[i];
+  }
+}
+
+
+void
+G4JpegCoder::ForwardDCT(int* picData)
+{
+  for( int v=0; v<8; v++ ){
+    double cv = v ? 1.0 : DisSqrt2;
+    for( int u=0; u<8; u++ ){
+      double cu = u ? 1.0 : DisSqrt2;
+      double sum = 0;
+
+      for( int y=0; y<8; y++ )
+        for( int x=0; x<8; x++ )
+          sum += picData[ y * 8 + x ] * mCosT[u][x] * mCosT[v][y];
+          mDCTData[ v * 8 + u ] = int( sum * cu * cv / 4 );
+        }
+    }
+}
+
+
+void
+G4JpegCoder::WriteHeader( void )
+{
+  int i = 0;    //counter
+  //SOI
+  mOBSP->SetByte( M_Marker );   //FF
+  mOBSP->SetByte( M_SOI );      //SOI
+
+  //APP0(JFIF Header)
+  mOBSP->SetByte( M_Marker );   //FF
+  mOBSP->SetByte( M_APP0 );     //APP0
+  mOBSP->SetWord( JFIFLength );        //parameter
+  mOBSP->CopyByte( (char*)JFIF, 5 );   //"JFIF\0"
+  mOBSP->SetWord( JFIFVersion );       //Version
+  mOBSP->SetByte( mProperty.Units );
+  mOBSP->SetWord( mProperty.HDensity );
+  mOBSP->SetWord( mProperty.VDensity );
+  mOBSP->SetByte( 0 );
+  mOBSP->SetByte( 0 );
+
+ //comment
+  if( mProperty.Comment != 0 ){
+    mOBSP->SetByte( M_Marker ); //FF
+    mOBSP->SetByte( M_COM );    //comment
+    int length = strlen( mProperty.Comment ) + 1;
+    mOBSP->SetWord( length + 2 );
+    mOBSP->CopyByte( mProperty.Comment, length );
+  }
+
+  //DQT
+  mOBSP->SetByte( M_Marker );
+  mOBSP->SetByte( M_DQT );
+  mOBSP->SetWord( 67 );
+  mOBSP->SetByte( 0 );
+  for( i=0; i<64; i++ )
+        mOBSP->SetByte( u_char( YQuantumT[Zigzag[i]] ) );
+  mOBSP->SetByte( M_Marker );
+  mOBSP->SetByte( M_DQT );
+  mOBSP->SetWord( 67 );
+  mOBSP->SetByte( 1 );
+  for( i=0; i<64; i++ )
+        mOBSP->SetByte( u_char( CQuantumT[Zigzag[i]] ) );
+   // DHT
+  mOBSP->CopyByte( (char*)YDcDht, DcDhtLength );
+  mOBSP->CopyByte( (char*)CDcDht, DcDhtLength );
+  mOBSP->CopyByte( (char*)YAcDht, AcDhtLength );
+  mOBSP->CopyByte( (char*)CAcDht, AcDhtLength );
+
+  // Frame Header
+  mOBSP->SetByte( M_Marker );   // FF
+  mOBSP->SetByte( M_SOF0 );
+  mOBSP->SetWord( 3 * mProperty.Dimension + 8 );
+  mOBSP->SetByte( mProperty.SamplePrecision );
+  mOBSP->SetWord( mProperty.nRow );
+  mOBSP->SetWord( mProperty.nColumn );
+  mOBSP->SetByte( mProperty.Dimension );
+
+  mOBSP->SetByte( 0 );
+  mOBSP->SetByte( YSampleF );
+  mOBSP->SetByte( 0 );
+
+  mOBSP->SetByte( 1 );
+  mOBSP->SetByte( CSampleF );
+
+  mOBSP->SetByte( 1 );
+  mOBSP->SetByte( 2 );
+  mOBSP->SetByte( CSampleF );
+  mOBSP->SetByte( 1 );
+
+  //Scan Header
+  mOBSP->SetByte( M_Marker );
+  mOBSP->SetByte( M_SOS );
+  mOBSP->SetWord( 2 * mProperty.Dimension + 6 );
+  mOBSP->SetByte( mProperty.Dimension );
+  for( i=0; i<mProperty.Dimension; i++ ){
+        mOBSP->SetByte( i );
+        mOBSP->SetByte( i==0 ? 0 : 0x11 );
+  }
+  mOBSP->SetByte( 0 );  //Ss
+  mOBSP->SetByte( 63 ); //Se
+  mOBSP->SetByte( 0 );  //Ah,Al
+}
+
+//EOI
+void
+G4JpegCoder::WriteEOI( void )
+{
+  mOBSP->SetByte( M_Marker );
+  mOBSP->SetByte( M_EOI );
+}
+
+//SetJpegProperty
+void
+G4JpegCoder::SetJpegProperty(const G4JpegProperty& aProperty )
+{
+  mProperty = aProperty;
+  mProperty.Dimension = 3;
+  mProperty.SamplePrecision = 8;
+  mProperty.Format = 1;
+  mProperty.MajorRevisions = 1;
+  mProperty.MinorRevisions = 2;
+  mProperty.HThumbnail = 0;
+  mProperty.VThumbnail = 0;
+}
Index: tags/visualization-10.5-before-10.6_test/RayTracer/src/G4RTJpegMaker.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/RayTracer/src/G4RTJpegMaker.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/RayTracer/src/G4RTJpegMaker.cc	(revision 1102)
@@ -0,0 +1,72 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4RTJpegMaker.cc,v 1.10 2006/06/29 21:23:57 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+//
+//
+
+#include "G4RTJpeg.hh"
+#include "G4RTJpegMaker.hh"
+#include "G4RTJpegCoder.hh"
+#include <fstream>
+
+G4RTJpegMaker::G4RTJpegMaker()
+{;}
+
+G4RTJpegMaker::~G4RTJpegMaker()
+{;}
+
+void G4RTJpegMaker::CreateFigureFile(G4String fileName,
+              int nColumn, int nRow,
+              u_char* colorR,
+              u_char* colorG,
+	      u_char* colorB)
+{
+        G4JpegCoder aFigure(colorR,colorG,colorB);
+        G4JpegProperty aProperty;
+        aProperty.nColumn = nColumn;
+        aProperty.nRow = nRow;
+        aProperty.Units = 0;
+        aProperty.HDensity = 1;
+        aProperty.VDensity = 1;
+        aProperty.ExtensionCode = 0;
+        aProperty.Comment = "Geant4 Ray Tracer Version 1.0 by M.Asai K.Minamimoto C.Kishinaga";
+
+        aFigure.SetJpegProperty(aProperty);
+        aFigure.DoCoding();
+
+        char* jpegAddress;
+        int jpegSize;
+
+        aFigure.GetJpegData(&jpegAddress,jpegSize);
+
+        std::ofstream ofs;
+        ofs.open(fileName,std::ios::out|std::ios::trunc|std::ios::binary);
+        ofs.write(jpegAddress,jpegSize);
+        ofs.close();
+}
Index: tags/visualization-10.5-before-10.6_test/RayTracer/src/G4RTMessenger.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/RayTracer/src/G4RTMessenger.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/RayTracer/src/G4RTMessenger.cc	(revision 1102)
@@ -0,0 +1,244 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4RTMessenger.cc,v 1.10 2006/11/17 21:34:12 perl Exp $
+// GEANT4 tag $Name:  $
+//
+//
+//
+
+
+#include "G4RTMessenger.hh"
+
+#include "G4UIdirectory.hh"
+#include "G4UIcmdWithABool.hh"
+#include "G4UIcmdWith3Vector.hh"
+#include "G4UIcmdWith3VectorAndUnit.hh"
+#include "G4UIcmdWithADoubleAndUnit.hh"
+#include "G4UIcmdWithAnInteger.hh"
+#include "G4UIcmdWithAString.hh"
+#include "G4TheRayTracer.hh"
+#include "G4RTSteppingAction.hh"
+#include "G4ThreeVector.hh"
+#include "G4VisManager.hh"
+#include "G4RayTracerViewer.hh"
+
+G4RTMessenger* G4RTMessenger::fpInstance = 0;
+
+G4RTMessenger* G4RTMessenger::GetInstance
+(G4TheRayTracer* p1,G4RTSteppingAction* p2)
+{
+  if (!fpInstance) fpInstance = new G4RTMessenger(p1, p2);
+  return fpInstance;
+}
+
+G4RTMessenger::G4RTMessenger(G4TheRayTracer* p1,G4RTSteppingAction* p2)
+{
+  theDefaultTracer = p1;
+  theSteppingAction = p2;
+
+  rayDirectory = new G4UIdirectory("/vis/rayTracer/");
+  rayDirectory->SetGuidance("RayTracer commands.");
+
+  fileCmd = new G4UIcmdWithAString("/vis/rayTracer/trace",this);
+  fileCmd->SetGuidance("Start the ray tracing.");
+  fileCmd->SetGuidance("Define the name of output JPEG file.");
+  fileCmd->SetParameterName("fileName",true);
+  fileCmd->SetDefaultValue("g4RayTracer.jpeg");
+  fileCmd->AvailableForStates(G4State_Idle);
+
+  columnCmd = new G4UIcmdWithAnInteger("/vis/rayTracer/column",this);
+  columnCmd->SetGuidance("Define the number of horizontal pixels.");
+  columnCmd->SetParameterName("nPixel",false);
+  columnCmd->SetRange("nPixel > 0");
+
+  rowCmd = new G4UIcmdWithAnInteger("/vis/rayTracer/row",this);
+  rowCmd->SetGuidance("Define the number of virtical pixels.");
+  rowCmd->SetParameterName("nPixel",false);
+  rowCmd->SetRange("nPixel > 0");
+
+  targetCmd = new G4UIcmdWith3VectorAndUnit("/vis/rayTracer/target",this);
+  targetCmd->SetGuidance("Define the center position of the target.");
+  targetCmd->SetParameterName("X","Y","Z",true);
+  targetCmd->SetDefaultValue(G4ThreeVector(0.,0.,0.));
+  targetCmd->SetDefaultUnit("m");
+
+  eyePosCmd = new G4UIcmdWith3VectorAndUnit("/vis/rayTracer/eyePosition",this);
+  eyePosCmd->SetGuidance("Define the eye position.");
+  eyePosCmd->SetGuidance("Eye direction is calsurated from (target - eyePosition).");
+  eyePosCmd->SetParameterName("X","Y","Z",true);
+  eyePosCmd->SetDefaultValue(G4ThreeVector(0.,0.,0.));
+  eyePosCmd->SetDefaultUnit("m");
+
+  lightCmd = new G4UIcmdWith3Vector("/vis/rayTracer/lightDirection",this);
+  lightCmd->SetGuidance("Define the direction of illumination light.");
+  lightCmd->SetGuidance("The vector needs not to be a unit vector, but it must not be a zero vector.");
+  lightCmd->SetParameterName("Px","Py","Pz",true);
+  lightCmd->SetDefaultValue(G4ThreeVector(0.1,0.2,0.3));
+  lightCmd->SetRange("Px != 0 || Py != 0 || Pz != 0");
+
+  spanXCmd = new G4UIcmdWithADoubleAndUnit("/vis/rayTracer/span",this);
+  spanXCmd->SetGuidance("Define the angle per 100 pixels.");
+  spanXCmd->SetParameterName("span",true);
+  spanXCmd->SetDefaultValue(50.);
+  spanXCmd->SetDefaultUnit("deg");
+  spanXCmd->SetRange("span>0.");
+
+  headCmd = new G4UIcmdWithADoubleAndUnit("/vis/rayTracer/headAngle",this);
+  headCmd->SetGuidance("Define the head direction.");
+  headCmd->SetParameterName("headAngle",true);
+  headCmd->SetDefaultValue(270.);
+  headCmd->SetDefaultUnit("deg");
+  headCmd->SetRange("headAngle>=0. && headAngle<360.");
+
+  attCmd = new G4UIcmdWithADoubleAndUnit("/vis/rayTracer/attenuation",this);
+  attCmd->SetGuidance("Define the attenuation length for transparent material.");
+  attCmd->SetGuidance("Note that this value is independent to the attenuation length for the optical photon processes.");
+  attCmd->SetParameterName("Length",true);
+  attCmd->SetDefaultValue(1.0);
+  attCmd->SetDefaultUnit("m");
+  attCmd->SetRange("Length > 0.");
+
+  distCmd = new G4UIcmdWithABool("/vis/rayTracer/distortion",this);
+  distCmd->SetGuidance("Distortion effect of the fish eye lens.");
+  distCmd->SetParameterName("flag",true);
+  distCmd->SetDefaultValue(false);
+
+  transCmd = new G4UIcmdWithABool("/vis/rayTracer/ignoreTransparency",this);
+  transCmd->SetGuidance("Ignore transparency even if the alpha of G4Colour < 1.");
+  transCmd->SetParameterName("flag",true);
+  transCmd->SetDefaultValue(false);
+
+  bkgColCmd = new G4UIcmdWith3Vector("/vis/rayTracer/backgroundColour",this);
+  bkgColCmd->SetGuidance("Command has been deprecated.  Use /vis/viewer/set/background instead.");
+  bkgColCmd->SetParameterName("red","green","blue",true);
+  bkgColCmd->SetDefaultValue(G4ThreeVector(1.,1.,1.));
+}
+
+G4RTMessenger::~G4RTMessenger()
+{
+  delete columnCmd;
+  delete rowCmd;
+  delete targetCmd;
+  delete eyePosCmd;
+  delete lightCmd;
+  delete spanXCmd;
+  delete headCmd;
+  delete attCmd;
+  delete distCmd;
+  delete transCmd;
+  delete fileCmd;
+  delete bkgColCmd;
+  delete rayDirectory;
+}
+
+G4String G4RTMessenger::GetCurrentValue(G4UIcommand * command)
+{
+  G4String currentValue;
+  if(command==columnCmd)
+  { currentValue = columnCmd->ConvertToString(theTracer->GetNColumn()); }
+  else if(command==rowCmd)
+  { currentValue = rowCmd->ConvertToString(theTracer->GetNRow()); }
+  else if(command==targetCmd)
+  { currentValue = targetCmd->ConvertToString(theTracer->GetTargetPosition(),"m"); }
+  else if(command==eyePosCmd)
+  { currentValue = eyePosCmd->ConvertToString(theTracer->GetEyePosition(),"m"); }
+  else if(command==lightCmd)
+  { currentValue = lightCmd->ConvertToString(theTracer->GetLightDirection()); }
+  else if(command==spanXCmd)
+  { currentValue = spanXCmd->ConvertToString(theTracer->GetViewSpan(),"deg"); }
+  else if(command==headCmd)
+  { currentValue = headCmd->ConvertToString(theTracer->GetHeadAngle(),"deg"); }
+  else if(command==attCmd)
+  { currentValue = attCmd->ConvertToString(theTracer->GetAttenuationLength(),"m");}
+  else if(command==distCmd)
+  { currentValue = distCmd->ConvertToString(theTracer->GetDistortion()); }
+  else if(command==transCmd)
+  { currentValue = transCmd->ConvertToString(theSteppingAction->GetIgnoreTransparency()); }
+  else if(command==bkgColCmd)
+  { currentValue = bkgColCmd->ConvertToString(theTracer->GetBackgroundColour()); }
+  return currentValue;
+}
+
+void G4RTMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
+{
+  G4VisManager* pVisManager = G4VisManager::GetInstance();
+
+  theTracer = theDefaultTracer;
+
+  G4VViewer* pVViewer = pVisManager->GetCurrentViewer();
+  if (pVViewer) {
+    G4RayTracerViewer* pViewer = dynamic_cast<G4RayTracerViewer*>(pVViewer);
+    if (pViewer) {
+      theTracer = pViewer->GetTracer();
+    } else {
+      G4cout <<
+	"G4RTMessenger::SetNewValue: Current viewer is not of type RayTracer."
+	"\n  Use \"/vis/viewer/select\" or \"/vis/open\"."
+	     << G4endl;
+    }
+  }
+
+  if (theTracer == theDefaultTracer) {
+    G4cout <<
+"G4RTMessenger::SetNewValue: No valid current viewer. Using default RayTracer."
+	   << G4endl;
+  }
+
+  if(command==columnCmd)
+  { theTracer->SetNColumn(columnCmd->GetNewIntValue(newValue)); }
+  else if(command==rowCmd)
+  { theTracer->SetNRow(rowCmd->GetNewIntValue(newValue)); }
+  else if(command==targetCmd)
+  { theTracer->SetTargetPosition(targetCmd->GetNew3VectorValue(newValue)); }
+  else if(command==eyePosCmd)
+  { theTracer->SetEyePosition(eyePosCmd->GetNew3VectorValue(newValue)); }
+  else if(command==lightCmd)
+  { theTracer->SetLightDirection(lightCmd->GetNew3VectorValue(newValue)); }
+  else if(command==spanXCmd)
+  { theTracer->SetViewSpan(spanXCmd->GetNewDoubleValue(newValue)); }
+  else if(command==headCmd)
+  { theTracer->SetHeadAngle(headCmd->GetNewDoubleValue(newValue)); }
+  else if(command==attCmd)
+  { theTracer->SetAttenuationLength(attCmd->GetNewDoubleValue(newValue)); }
+  else if(command==distCmd)
+  { theTracer->SetDistortion(distCmd->GetNewBoolValue(newValue)); }
+  else if(command==bkgColCmd)
+  {
+	G4cout << "WARNING: /vis/rayTracer/backgroundColour has been deprecated."
+	"\n  Use \"/vis/viewer/set/background\" instead."
+		<< G4endl;
+  }
+  else if(command==transCmd)
+  { theSteppingAction->SetIgnoreTransparency(transCmd->GetNewBoolValue(newValue)); }
+  else if(command==fileCmd)
+  { theTracer->Trace(newValue); }
+}
+
+
+ 
+
+
Index: tags/visualization-10.5-before-10.6_test/RayTracer/src/G4RTOutBitStream.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/RayTracer/src/G4RTOutBitStream.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/RayTracer/src/G4RTOutBitStream.cc	(revision 1102)
@@ -0,0 +1,164 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4RTOutBitStream.cc,v 1.6 2008/04/04 13:52:48 allison Exp $
+// GEANT4 tag $Name:  $
+//
+//
+//
+
+#include <string.h>
+#include "G4RTJpeg.hh"
+#include "G4RTOutBitStream.hh"
+
+
+
+G4OutBitStream::G4OutBitStream(int size)
+{
+  if(size < 1)
+        throw( G4MemoryError( size, "G4OutBitStream" ) );
+
+  mHeadOfBuf = mBuf = new u_char[size];
+  if( mHeadOfBuf == 0 )
+        throw( G4MemoryError( size, "G4OutBitStream" ) );
+
+  mEndOfBuf = mBuf + size;
+
+  memset( mHeadOfBuf, 0, size );
+
+  mBitPos = 7;
+  mWriteFlag = 1;
+}
+
+void
+G4OutBitStream::IncBuf( void )
+{
+  if( ++mBuf >= mEndOfBuf )
+        mWriteFlag = 0;
+}
+
+
+
+void
+G4OutBitStream::SetBits(int v, int numBits)
+{
+  if( numBits == 0 )
+        return;
+  if( numBits > 16 )
+        throw( G4BufferError( "SetBits:Max Bit Over" ) );
+  if( numBits > 8 ){
+        Set8Bits( u_char(v>>8), numBits-8 );
+        numBits = 8;
+  }
+  Set8Bits( u_char(v), numBits );
+}
+
+void
+G4OutBitStream::SetFewBits(u_char v, int numBits)
+{
+  v &= BitFullMaskT[numBits-1];
+  *mBuf |= v << (mBitPos + 1 - numBits);
+  if( (mBitPos -= numBits) < 0 ){
+        if( *mBuf == 0xff ){
+          IncBuf();
+          *mBuf = 0;
+        }
+        IncBuf();
+        mBitPos = 7;
+    }
+}
+
+void
+G4OutBitStream::SetBits2Byte(u_char v, int numBits)
+{
+  v &= BitFullMaskT[numBits-1];
+  int nextBits = numBits - (mBitPos + 1);
+  *mBuf |= ( v >> nextBits ) & BitFullMaskT[mBitPos];
+  if( *mBuf == 0xff ){
+        IncBuf();
+        *mBuf = 0;
+  }
+  IncBuf();
+
+  *mBuf = v << (8 - nextBits);
+  mBitPos = 7 - nextBits;
+}
+
+void
+G4OutBitStream::Set8Bits(u_char v, int numBits)
+{
+  if( mBitPos + 1 >= numBits )
+        SetFewBits( (u_char)v, numBits );
+ else
+        SetBits2Byte( (u_char)v, numBits );
+}
+
+
+void
+G4OutBitStream::FullBit( void )
+{
+  if( mBitPos != 7 )
+        SetFewBits( BitFullMaskT[mBitPos], mBitPos+1 );
+}
+
+void
+G4OutBitStream::SetByte(u_char dat)
+{
+  if( mWriteFlag ){
+        FullBit();
+        *mBuf = dat;
+        IncBuf();
+        return;
+  }
+  throw( G4BufferError( "SetByte" ) );
+}
+
+void
+G4OutBitStream::SetWord(u_int dat)
+{
+  if( mWriteFlag ){
+        FullBit();
+        *mBuf = (dat >> 8) & 0xff;
+        IncBuf();
+        *mBuf = dat & 0xff;
+        IncBuf();
+        return;
+  }
+  throw( G4BufferError( "SetWord" ) );
+}
+
+void
+G4OutBitStream::CopyByte(const char* src, int n)
+{
+  if( mBuf+n < mEndOfBuf ){
+        FullBit();
+        memcpy( mBuf, src, n );
+        mBuf += n;
+        return;
+  }
+  throw( G4BufferError( "CopyByte" ) );
+}
+
Index: tags/visualization-10.5-before-10.6_test/RayTracer/src/G4RTSimpleScanner.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/RayTracer/src/G4RTSimpleScanner.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/RayTracer/src/G4RTSimpleScanner.cc	(revision 1102)
@@ -0,0 +1,70 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4RTSimpleScanner.cc,v 1.4 2007/05/22 17:10:42 allison Exp $
+// GEANT4 tag $Name:  $
+//
+//
+
+#include "G4RTSimpleScanner.hh"
+
+G4RTSimpleScanner::G4RTSimpleScanner():
+  theNRow(0), theNColumn(0), theIRow(0), theIColumn(0)
+{
+  theGSName = "RayTracer";
+  theGSNickname = "RayTracer";
+}
+
+const G4String& G4RTSimpleScanner::GetGSName() const
+{return theGSName;}
+
+const G4String& G4RTSimpleScanner::GetGSNickname() const
+{return theGSNickname;}
+
+void G4RTSimpleScanner::Initialize(G4int nRow, G4int nColumn) {
+  theNRow = nRow;
+  theNColumn = nColumn;
+  theIRow = 0;
+  theIColumn = -1;
+}
+
+G4bool G4RTSimpleScanner::Coords(G4int& iRow, G4int& iColumn)
+{
+  // Increment column and, if necessary, increment row...
+  ++theIColumn;
+  if (theIColumn >= theNColumn) {
+    theIColumn = 0;
+    ++theIRow;
+  }
+
+  // Return if finished...
+  if (theIRow >= theNRow) return false;
+
+  // Return current row and column...
+  iRow = theIRow;
+  iColumn = theIColumn;
+  return true;
+}
Index: tags/visualization-10.5-before-10.6_test/RayTracer/src/G4RTSteppingAction.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/RayTracer/src/G4RTSteppingAction.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/RayTracer/src/G4RTSteppingAction.cc	(revision 1102)
@@ -0,0 +1,82 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4RTSteppingAction.cc,v 1.7 2006/06/29 21:24:05 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+//
+//
+
+
+#include "G4RTSteppingAction.hh"
+
+#include "G4SteppingManager.hh"
+#include "G4VisManager.hh"
+#include "G4VisAttributes.hh"
+#include "G4Colour.hh"
+#include "G4Track.hh"
+#include "G4StepStatus.hh"
+#include "G4TransportationManager.hh"
+
+G4RTSteppingAction::G4RTSteppingAction()
+{
+  ignoreTransparency=false;
+}
+
+void G4RTSteppingAction::UserSteppingAction(const G4Step* aStep)
+{
+  // Stop the ray particle if it reaches to the coloured volume with its alpha = 1
+  // or coloured volume and the user request to ignore transparency
+
+  G4StepPoint* fpStepPoint = aStep -> GetPostStepPoint();
+  G4VPhysicalVolume* postVolume_phys=fpStepPoint->GetPhysicalVolume();
+
+  if(!postVolume_phys) return;   // Reach to out of the world
+
+  const G4LogicalVolume* postVolume_log = postVolume_phys->GetLogicalVolume();
+  const G4VisAttributes* postVisAtt = postVolume_log -> GetVisAttributes();
+  G4VisManager* visManager = G4VisManager::GetInstance();
+  if(visManager) {
+    G4VViewer* viewer = visManager->GetCurrentViewer();
+    if (viewer) {
+      postVisAtt = viewer->GetApplicableVisAttributes(postVisAtt);
+    }
+  }
+  if((!postVisAtt) || (!(postVisAtt->IsVisible()))) return; // Invisible volume, continue tracking
+
+  if((postVisAtt->IsForceDrawingStyle())
+    &&(postVisAtt->GetForcedDrawingStyle()==G4VisAttributes::wireframe)) return;
+                                          // Wire frame volume, continue tracking
+
+  G4double postAlpha=(postVisAtt->GetColour()).GetAlpha();
+
+  if(postAlpha==1.0 || ignoreTransparency) // Stop stepping
+  { 
+    G4Track* currentTrack = aStep -> GetTrack();
+    currentTrack -> SetTrackStatus(fStopAndKill);
+  }
+}
+
Index: tags/visualization-10.5-before-10.6_test/RayTracer/src/G4RTTrackingAction.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/RayTracer/src/G4RTTrackingAction.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/RayTracer/src/G4RTTrackingAction.cc	(revision 1102)
@@ -0,0 +1,56 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4RTTrackingAction.cc,v 1.5 2006/06/29 21:24:07 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+//
+//
+
+///////////////////////
+//G4RTTrackingAction.cc
+///////////////////////
+
+
+#include "G4RTTrackingAction.hh"
+#include "G4RayTrajectory.hh"
+#include "G4TrackingManager.hh"
+#include "G4ios.hh"
+
+
+void G4RTTrackingAction :: PreUserTrackingAction(const G4Track*)
+{
+  G4RayTrajectory* aTrajectory=new G4RayTrajectory;
+  fpTrackingManager->SetTrajectory(aTrajectory);
+
+}
+
+
+
+
+
+
+
Index: tags/visualization-10.5-before-10.6_test/RayTracer/src/G4RTXScanner.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/RayTracer/src/G4RTXScanner.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/RayTracer/src/G4RTXScanner.cc	(revision 1102)
@@ -0,0 +1,238 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4RTXScanner.cc,v 1.6 2009/08/18 10:47:15 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+//
+
+#ifdef G4VIS_BUILD_RAYTRACERX_DRIVER
+
+#include "G4RTXScanner.hh"
+
+#include "G4TheRayTracer.hh"
+#include "G4RayTracerXViewer.hh"
+#include "G4ViewParameters.hh"
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/Xatom.h>
+
+extern "C" {
+  Bool G4RayTracerXScannerWaitForNotify (Display*, XEvent* e, char* arg) {
+    return (e->type == MapNotify) && (e->xmap.window == (Window) arg);
+  }
+}
+
+G4RTXScanner::G4RTXScanner():
+  theNRow(0), theNColumn(0), theIRow(0), theIColumn(0)
+{
+  theGSName = "RayTracerX";
+  theGSNickname = "RayTracerX";
+}
+
+const G4String& G4RTXScanner::GetGSName() const
+{return theGSName;}
+
+const G4String& G4RTXScanner::GetGSNickname() const
+{return theGSNickname;}
+
+void G4RTXScanner::Initialize(G4int nRow, G4int nColumn) {
+  theNRow = nRow;
+  theNColumn = nColumn;
+  G4int nMax = std::max (nRow, nColumn);
+  theStep = 1;
+  if (nMax > 3) {
+    for (;;) {
+      theStep *= 3;
+      if (theStep > nMax) break;
+    }
+  }
+  theIRow = theStep / 2;
+  theIColumn = theStep / 2 - theStep;
+}
+
+G4bool G4RTXScanner::Coords(G4int& iRow, G4int& iColumn)
+{
+  // Increment column...
+  theIColumn += theStep;
+
+  // Skip coordinates covered in the previous scan...
+  if ((theIColumn + (3 * theStep) / 2 + 1)%(3 * theStep) == 0 &&
+      (theIRow + (3 * theStep) / 2 + 1)%(3 * theStep) == 0)
+    theIColumn += theStep;
+
+  //  If necessary, increment row...
+  if (theIColumn >= theNColumn) {
+    theIColumn = theStep / 2;
+    theIRow += theStep;
+  }
+
+  // Return if finished...
+  if (theIRow >= theNRow && theStep <= 1) return false;
+
+  // Start next scan if necessary...
+  if (theIRow >= theNRow) {
+    theStep /= 3;
+    theIRow = theStep / 2;
+    theIColumn = theStep / 2;
+  }
+
+  // Return current row and column...
+  iRow = theIRow;
+  iColumn = theIColumn;
+  return true;
+}
+
+G4bool G4RTXScanner::GetXWindow(const G4String& name, G4ViewParameters& vp)
+{
+  display = XOpenDisplay(0);  // Use display defined by DISPLAY environment.
+  if (!display) {
+    G4cerr << "G4RTXScanner::Initialize(): cannot get display."
+	   << G4endl;
+    return false;
+  }
+
+  int screen_num = DefaultScreen(display);
+
+  // Window size and position...
+  int xOffset = 0, yOffset = 0;
+  unsigned int width, height;
+  XSizeHints* size_hints = XAllocSizeHints();
+  const G4String& XGeometryString = vp.GetXGeometryString();
+  if (!XGeometryString.empty()) {
+    G4int geometryResultMask = XParseGeometry
+      ((char*)XGeometryString.c_str(),
+       &xOffset, &yOffset, &width, &height);
+    if (geometryResultMask & (WidthValue | HeightValue)) {
+      if (geometryResultMask & XValue) {
+	if (geometryResultMask & XNegative) {
+	  xOffset = DisplayWidth(display, screen_num) + xOffset - width;
+	}
+	size_hints->flags |= PPosition;
+	size_hints->x = xOffset;
+      }
+      if (geometryResultMask & YValue) {
+	if (geometryResultMask & YNegative) {
+	  yOffset = DisplayHeight(display, screen_num) + yOffset - height;
+	}
+	size_hints->flags |= PPosition;
+	size_hints->y = yOffset;
+      }
+    } else {
+      G4cout << "ERROR: Geometry string \""
+	     << XGeometryString
+	     << "\" invalid.  Using \"600x600\"."
+	     << G4endl;
+      width = 600;
+      height = 600;
+    }
+  } else {
+    G4cout << "ERROR: Geometry string \""
+	   << XGeometryString	   
+           << "\" is empty.  Using \"600x600\"."
+	   << G4endl;
+    width = 600;
+    height = 600;  
+  }
+  size_hints->width = width;
+  size_hints->height = height;
+  size_hints->flags |= PSize;
+
+  win = XCreateSimpleWindow
+    (display, RootWindow(display, screen_num),
+     xOffset, yOffset, width, height,
+     0,                                 // Border width.
+     WhitePixel(display, screen_num),   // Border colour.
+     BlackPixel(display, screen_num));  // Background colour.
+
+  XGCValues values;
+  gc = XCreateGC(display, win, 0, &values);
+
+  int nMaps;
+  Status status = XGetRGBColormaps
+    (display, RootWindow(display, screen_num),
+     &scmap, &nMaps, XA_RGB_BEST_MAP);
+  if (!status) {
+    system("xstdcmap -best");  // ...and try again...
+    Status status = XGetRGBColormaps
+      (display, RootWindow(display, screen_num),
+       &scmap, &nMaps, XA_RGB_BEST_MAP);
+    if (!status) {
+      G4cerr <<
+	"G4RTXScanner::Initialize(): cannot get color map."
+	"\n  Perhaps your system does not support RGB_BEST_MAP."
+	     << G4endl;
+      return false;
+    }
+  }
+  if (!scmap->colormap) {
+    G4cerr << "G4RTXScanner::Initialize(): color map empty."
+	   << G4endl;
+    return false;
+  }
+
+  XWMHints* wm_hints = XAllocWMHints();
+  XClassHint* class_hint = XAllocClassHint();
+  const char* window_name = name.c_str();
+  XTextProperty windowName;
+  XStringListToTextProperty((char**)&window_name, 1, &windowName);
+
+  XSetWMProperties(display, win, &windowName, &windowName,
+		   0, 0, size_hints, wm_hints, class_hint);
+
+  XMapWindow(display, win);
+
+  // Wait for window to appear (wait for an "map notify" event).
+  XSelectInput(display, win, StructureNotifyMask);
+  XEvent event;
+  XIfEvent (display, &event, G4RayTracerXScannerWaitForNotify, (char*) win);
+
+  return true;
+}
+
+void G4RTXScanner::Draw
+(unsigned char red, unsigned char green, unsigned char blue)
+// Draw coloured square at current position.
+{
+  unsigned long pixel_value = scmap->base_pixel +
+    ((unsigned long) ((red * scmap->red_max) / 256.) * scmap->red_mult) +
+    ((unsigned long) ((green * scmap->green_max) / 256.) * scmap->green_mult) +
+    ((unsigned long) ((blue * scmap->blue_max) / 256.) * scmap->blue_mult);
+  XSetForeground(display, gc, pixel_value);
+
+  if (theStep > 1) {
+    XFillRectangle(display, win, gc,
+		   theIColumn - theStep / 2,
+		   theIRow - theStep / 2,
+		   theStep, theStep);
+  } else {
+    XDrawPoint(display, win, gc, theIColumn, theIRow);
+  }
+
+  XFlush(display);
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/RayTracer/src/G4RayTracer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/RayTracer/src/G4RayTracer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/RayTracer/src/G4RayTracer.cc	(revision 1102)
@@ -0,0 +1,76 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4RayTracer.cc,v 1.22 2007/06/14 15:25:20 allison Exp $
+// GEANT4 tag $Name:  $
+
+#include "G4RayTracer.hh"
+#include "G4RayTracerFeatures.hh"
+#include "G4RayTracerSceneHandler.hh"
+#include "G4RayTracerViewer.hh"
+#include "G4TheRayTracer.hh"
+
+G4RayTracer::G4RayTracer():
+  G4VGraphicsSystem("RayTracer",
+		     "RayTracer",
+		     RAYTRACER_FEATURES,
+		     G4VGraphicsSystem::threeD)
+{
+  theRayTracer = new G4TheRayTracer;  // Establish default ray tracer.
+}
+
+G4RayTracer::~G4RayTracer()
+{
+  delete theRayTracer;
+}
+
+G4VSceneHandler* G4RayTracer::CreateSceneHandler (const G4String& name) {
+  G4VSceneHandler* pScene = new G4RayTracerSceneHandler (*this, name);
+  return pScene;
+}
+
+G4VViewer* G4RayTracer::CreateViewer (G4VSceneHandler& sceneHandler,
+				      const G4String& name) {
+  printf("G4RayTracer::CreateViewer\n");
+  G4VViewer* pViewer = new G4RayTracerViewer (sceneHandler, name);
+  if (pViewer) {
+    if (pViewer->GetViewId() < 0) {
+      G4cout <<
+        "G4RayTracer::CreateViewer: ERROR flagged by negative"
+        " view id in G4RayTracerViewer creation."
+        "\n Destroying view and returning null pointer."
+             << G4endl;
+      delete pViewer;
+      pViewer = 0;
+    }
+  }
+  else {
+    G4cout <<
+      "G4RayTracer::CreateViewer: ERROR: null pointer on new G4RayTracerViewer."
+           << G4endl;
+  }
+  return pViewer;
+}
Index: tags/visualization-10.5-before-10.6_test/RayTracer/src/G4RayTracerSceneHandler.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/RayTracer/src/G4RayTracerSceneHandler.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/RayTracer/src/G4RayTracerSceneHandler.cc	(revision 1102)
@@ -0,0 +1,64 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4RayTracerSceneHandler.cc,v 1.10 2006/11/14 14:46:37 allison Exp $
+// GEANT4 tag $Name:  $
+
+#include "G4RayTracerSceneHandler.hh"
+#include "G4VisManager.hh"
+
+G4RayTracerSceneHandler::G4RayTracerSceneHandler(G4VGraphicsSystem& system,
+						 const G4String& name):
+  G4VSceneHandler(system, fSceneIdCount++, name)
+{
+  // Ray Tracer does not use the vis concept of scene (G4Scene) - keep
+  // vis manager happy when someone opens a ray tracer with "/vis/open
+  // RayTracer" but uses the ray tracer with "/vis/rayTracer" commands
+  // before creating any scenes, for example, instead of using
+  // "/vis/drawVolume"...
+  G4VisManager* visManager = G4VisManager::GetInstance();
+  if(visManager) {
+    G4Scene* pScene = visManager->GetCurrentScene();
+    if (!pScene) {
+      // Create new scene like /vis/scene/create...
+      fpScene = new G4Scene("dummy-ray-tracer-scene");
+      // Add dummy run-duration model to avoid world being added and
+      // notifyHandler being invoked...
+      fpScene->AddWorldIfEmpty();
+      // Avoid code triggered at end of events...
+      fpScene->SetRefreshAtEndOfEvent(false);
+      // Add to vis manager list; ownership thereby passes to vis manager...
+      visManager->SetSceneList().push_back(fpScene);
+      // ...and make current...
+      visManager->SetCurrentScene(fpScene);
+    }
+  }
+}
+
+G4RayTracerSceneHandler::~G4RayTracerSceneHandler()
+{}
+
+G4int G4RayTracerSceneHandler::fSceneIdCount = 0;
Index: tags/visualization-10.5-before-10.6_test/RayTracer/src/G4RayTracerViewer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/RayTracer/src/G4RayTracerViewer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/RayTracer/src/G4RayTracerViewer.cc	(revision 1102)
@@ -0,0 +1,108 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4RayTracerViewer.cc,v 1.18 2009/08/19 08:39:19 lgarnier Exp $
+// GEANT4 tag $Name:  $
+
+#include "G4RayTracerViewer.hh"
+
+#include "G4ios.hh"
+#include <sstream>
+
+#include "G4VSceneHandler.hh"
+#include "G4Scene.hh"
+#include "G4TheRayTracer.hh"
+#include "G4UImanager.hh"
+
+G4RayTracerViewer::G4RayTracerViewer
+(G4VSceneHandler& sceneHandler,
+ const G4String& name,
+ G4TheRayTracer* aTracer):
+  G4VViewer(sceneHandler, sceneHandler.IncrementViewCount(), name),
+  fFileCount(0)
+{
+  theTracer = aTracer;
+  if (!aTracer) theTracer = new G4TheRayTracer;
+}
+
+G4RayTracerViewer::~G4RayTracerViewer() {}
+
+void G4RayTracerViewer::SetView()
+{
+  // Get radius of scene, etc.  (See G4OpenGLViewer::SetView().)
+  // Note that this procedure properly takes into account zoom, dolly and pan.
+  const G4Point3D& targetPoint
+    = fSceneHandler.GetScene()->GetStandardTargetPoint()
+    + fVP.GetCurrentTargetPoint();
+  G4double radius =  // See G4ViewParameters for following procedure.
+    fSceneHandler.GetScene()->GetExtent().GetExtentRadius();
+  if(radius<=0.) radius = 1.;
+  const G4double cameraDistance = fVP.GetCameraDistance(radius);
+  const G4Point3D cameraPosition =
+    targetPoint + cameraDistance * fVP.GetViewpointDirection().unit();
+  const G4double nearDistance  = fVP.GetNearDistance(cameraDistance,radius);
+  const G4double frontHalfHeight = fVP.GetFrontHalfHeight(nearDistance,radius);
+  const G4double frontHalfAngle = std::atan(frontHalfHeight / nearDistance);
+
+  // Calculate and set ray tracer parameters.
+  theTracer->
+    SetViewSpan(200. * frontHalfAngle / theTracer->GetNColumn());
+  theTracer->SetTargetPosition(targetPoint);
+  theTracer->SetEyePosition(cameraPosition);
+  theTracer->SetHeadAngle(fVP.GetViewpointDirection().phi());
+  const G4Vector3D
+    actualLightpointDirection(-fVP.GetActualLightpointDirection());
+  theTracer->SetLightDirection(actualLightpointDirection);
+  theTracer->SetBackgroundColour(fVP.GetBackgroundColour());
+  theTracer->SetNColumn(fVP.GetWindowSizeHintX());
+  theTracer->SetNRow(fVP.GetWindowSizeHintY());
+}
+
+
+void G4RayTracerViewer::ClearView() {}
+
+void G4RayTracerViewer::DrawView()
+{
+  if (fVP.GetFieldHalfAngle() == 0.) { // Orthogonal (parallel) projection.
+    G4double fieldHalfAngle = perMillion;
+    fVP.SetFieldHalfAngle(fieldHalfAngle);
+    G4cout << 
+      "WARNING: G4RayTracerViewer::DrawView: true orthogonal projection"
+      "\n  not yet implemented.  Doing a \"long shot\", i.e., a perspective"
+      "\n  projection with a half field angle of "
+	   << fieldHalfAngle <<
+      " radians."
+	   << G4endl;
+    SetView();  // Special graphics system - bypass ProcessView().
+    fVP.SetFieldHalfAngle(0.);
+  }
+  else {
+    SetView();  // Special graphics system - bypass ProcessView().
+  }
+  std::ostringstream filename;
+  filename << "g4RayTracer." << fShortName << '_' << fFileCount++ << ".jpeg";
+  theTracer->Trace(filename.str());
+}
Index: tags/visualization-10.5-before-10.6_test/RayTracer/src/G4RayTracerX.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/RayTracer/src/G4RayTracerX.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/RayTracer/src/G4RayTracerX.cc	(revision 1102)
@@ -0,0 +1,78 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4RayTracerX.cc,v 1.5 2006/06/29 21:24:17 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+//
+//
+
+#ifdef G4VIS_BUILD_RAYTRACERX_DRIVER
+
+#include "G4RayTracerX.hh"
+#include "G4RayTracerFeatures.hh"
+#include "G4RayTracerSceneHandler.hh"
+#include "G4RayTracerXViewer.hh"
+
+G4RayTracerX::G4RayTracerX():
+  G4VGraphicsSystem("RayTracerX",
+		    "RayTracerX",
+		    RAYTRACER_FEATURES,
+		    G4VGraphicsSystem::threeD)
+{}
+
+G4RayTracerX::~G4RayTracerX()
+{}
+
+G4VSceneHandler* G4RayTracerX::CreateSceneHandler (const G4String& name) {
+  G4VSceneHandler* pSceneHandler = new G4RayTracerSceneHandler (*this, name);
+  return pSceneHandler;
+}
+
+G4VViewer* G4RayTracerX::CreateViewer (G4VSceneHandler& sceneHandler,
+				       const G4String& name) {
+  printf("G4RayTracerX::CreateViewer\n");
+  G4VViewer* pViewer = new G4RayTracerXViewer (sceneHandler, name);
+  if (pViewer) {
+    if (pViewer->GetViewId() < 0) {
+      G4cout <<
+        "G4RayTracerX::CreateViewer: ERROR flagged by negative"
+        " view id in G4RayTracerXViewer creation."
+        "\n Destroying view and returning null pointer."
+             << G4endl;
+      delete pViewer;
+      pViewer = 0;
+    }
+  }
+  else {
+    G4cout <<
+      "G4RayTracerX::CreateViewer: ERROR: null pointer on new G4RayTracerXViewer."
+           << G4endl;
+  }
+  return pViewer;
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/RayTracer/src/G4RayTracerXViewer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/RayTracer/src/G4RayTracerXViewer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/RayTracer/src/G4RayTracerXViewer.cc	(revision 1102)
@@ -0,0 +1,68 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4RayTracerXViewer.cc,v 1.7 2009/08/19 08:39:19 lgarnier Exp $
+// GEANT4 tag $Name:  $
+
+#ifdef G4VIS_BUILD_RAYTRACERX_DRIVER
+
+#include "G4RayTracerXViewer.hh"
+
+#include "G4VSceneHandler.hh"
+#include "G4Scene.hh"
+#include "G4TheRayTracer.hh"
+#include "G4RTJpegMaker.hh"
+#include "G4RTXScanner.hh"
+#include "G4UImanager.hh"
+
+#include <cstdlib>
+
+G4RayTracerXViewer::G4RayTracerXViewer
+(G4VSceneHandler& sceneHandler, const G4String& name):
+  G4RayTracerViewer(sceneHandler,
+		    name,
+		    new G4TheRayTracer(new G4RTJpegMaker, new G4RTXScanner))
+{
+}
+
+void G4RayTracerXViewer::Initialise() {
+
+  if (theTracer) {
+    theTracer->SetNColumn(fVP.GetWindowSizeHintX());
+    theTracer->SetNRow(fVP.GetWindowSizeHintY());
+  }
+
+  // Set up X Window...
+  G4RTXScanner* theXScanner = (G4RTXScanner*)theTracer->GetScanner();
+  if (!theXScanner->GetXWindow(fName,fVP)) {
+    fViewId = -1;  // This flags an error.
+    return;
+  }
+}
+
+G4RayTracerXViewer::~G4RayTracerXViewer() {}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/RayTracer/src/G4RayTrajectory.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/RayTracer/src/G4RayTrajectory.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/RayTracer/src/G4RayTrajectory.cc	(revision 1102)
@@ -0,0 +1,130 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4RayTrajectory.cc,v 1.15 2006/06/29 21:24:21 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+//
+//
+
+///////////////////
+//G4RayTrajectory.cc
+///////////////////
+
+#include "G4RayTrajectory.hh"
+#include "G4RayTrajectoryPoint.hh"
+#include "G4Step.hh"
+#include "G4VPhysicalVolume.hh"
+#include "G4VisManager.hh"
+#include "G4VisAttributes.hh"
+#include "G4Colour.hh"
+#include "G4TransportationManager.hh"
+#include "G4ios.hh"
+
+G4Allocator<G4RayTrajectory> G4RayTrajectoryAllocator;
+
+G4RayTrajectory :: G4RayTrajectory()
+{
+  positionRecord = new std::vector<G4RayTrajectoryPoint*>;
+}
+
+G4RayTrajectory :: G4RayTrajectory(G4RayTrajectory & right)
+: G4VTrajectory()
+{
+  positionRecord = new std::vector<G4RayTrajectoryPoint*>;
+  for(size_t i=0;i<right.positionRecord->size();i++)
+  {
+    G4RayTrajectoryPoint* rightPoint = (G4RayTrajectoryPoint*)
+				((*(right.positionRecord))[i]);
+    positionRecord->push_back(new G4RayTrajectoryPoint(*rightPoint));
+  }
+}
+
+G4RayTrajectory :: ~G4RayTrajectory()
+{
+  //positionRecord->clearAndDestroy();
+  for(size_t i=0;i<positionRecord->size();i++)
+  { delete (*positionRecord)[i]; }
+  positionRecord->clear();
+  delete positionRecord;
+}
+
+void G4RayTrajectory::AppendStep(const G4Step* aStep)
+{
+  G4RayTrajectoryPoint* trajectoryPoint = new G4RayTrajectoryPoint();
+
+  trajectoryPoint->SetStepLength(aStep->GetStepLength());
+
+  G4Navigator* theNavigator 
+    = G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking();
+  G4bool valid;
+  G4ThreeVector theLocalNormal = theNavigator->GetLocalExitNormal(&valid);
+  if(valid) { theLocalNormal = -theLocalNormal; }
+  G4ThreeVector theGrobalNormal 
+    = theNavigator->GetLocalToGlobalTransform().TransformAxis(theLocalNormal);
+  trajectoryPoint->SetSurfaceNormal(theGrobalNormal);
+
+  G4VPhysicalVolume* prePhys = aStep->GetPreStepPoint()->GetPhysicalVolume();
+  const G4VisAttributes* preVisAtt = prePhys->GetLogicalVolume()->GetVisAttributes();
+  G4VisManager* visManager = G4VisManager::GetInstance();
+  if(visManager) {
+    G4VViewer* viewer = visManager->GetCurrentViewer();
+    if (viewer) {
+      preVisAtt = viewer->GetApplicableVisAttributes(preVisAtt);
+    }
+  }
+  trajectoryPoint->SetPreStepAtt(preVisAtt);
+
+  const G4VPhysicalVolume* postPhys = aStep->GetPostStepPoint()->GetPhysicalVolume();
+  const G4VisAttributes* postVisAtt = NULL;
+  if(postPhys) {
+    postVisAtt = postPhys->GetLogicalVolume()->GetVisAttributes();
+    if(visManager) {
+      G4VViewer* viewer = visManager->GetCurrentViewer();
+      if (viewer) {
+	postVisAtt = viewer->GetApplicableVisAttributes(postVisAtt);
+      }
+    }
+  }
+  trajectoryPoint->SetPostStepAtt(postVisAtt);
+
+  positionRecord->push_back(trajectoryPoint);
+}
+
+void G4RayTrajectory::ShowTrajectory(std::ostream&) const
+{ }
+
+void G4RayTrajectory::MergeTrajectory(G4VTrajectory* secondTrajectory)
+{
+  if(!secondTrajectory) return;
+
+  G4RayTrajectory* seco = (G4RayTrajectory*)secondTrajectory;
+  G4int ent = seco->GetPointEntries();
+  for(G4int i=0;i<ent;i++)
+  { positionRecord->push_back((G4RayTrajectoryPoint*)seco->GetPoint(i)); }
+  seco->positionRecord->clear();
+}
+
Index: tags/visualization-10.5-before-10.6_test/RayTracer/src/G4RayTrajectoryPoint.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/RayTracer/src/G4RayTrajectoryPoint.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/RayTracer/src/G4RayTrajectoryPoint.cc	(revision 1102)
@@ -0,0 +1,46 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4RayTrajectoryPoint.cc,v 1.6 2006/06/29 21:24:23 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+//
+//
+
+///////////////////////
+//G4RayTrajectoryPoint.cc
+///////////////////////
+
+#include"G4RayTrajectoryPoint.hh"
+
+G4Allocator<G4RayTrajectoryPoint> G4RayTrajectoryPointAllocator;
+
+G4RayTrajectoryPoint :: G4RayTrajectoryPoint()
+{;}
+
+G4RayTrajectoryPoint :: ~G4RayTrajectoryPoint()
+{;}
+
Index: tags/visualization-10.5-before-10.6_test/RayTracer/src/G4TheRayTracer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/RayTracer/src/G4TheRayTracer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/RayTracer/src/G4TheRayTracer.cc	(revision 1102)
@@ -0,0 +1,407 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4TheRayTracer.cc,v 1.3 2006/06/29 21:24:25 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+//
+//
+
+
+#include "G4TheRayTracer.hh"
+#include "G4EventManager.hh"
+#include "G4RTMessenger.hh"
+#include "G4RayShooter.hh"
+#include "G4VFigureFileMaker.hh"
+#include "G4RTTrackingAction.hh"
+#include "G4RTSteppingAction.hh"
+#include "G4RayTrajectory.hh"
+#include "G4RayTrajectoryPoint.hh"
+#include "G4RTJpegMaker.hh"
+#include "G4RTSimpleScanner.hh"
+#include "G4GeometryManager.hh"
+#include "G4SDManager.hh"
+#include "G4StateManager.hh"
+#include "G4Event.hh"
+#include "G4TrajectoryContainer.hh"
+#include "G4Colour.hh"
+#include "G4VisAttributes.hh"
+#include "G4UImanager.hh"
+#include "G4TransportationManager.hh"
+#include "G4RegionStore.hh"
+#include "G4ProductionCutsTable.hh"
+
+G4TheRayTracer::G4TheRayTracer(G4VFigureFileMaker* figMaker,
+			       G4VRTScanner* scanner)
+{
+  theFigMaker = figMaker;
+  if(!theFigMaker) theFigMaker = new G4RTJpegMaker;
+  theScanner = scanner;
+  if(!theScanner) theScanner = new G4RTSimpleScanner;
+  theRayShooter = new G4RayShooter();
+  theRayTracerEventAction = 0;
+  theRayTracerStackingAction = 0;
+  theRayTracerTrackingAction = 0;
+  theRayTracerSteppingAction = 0;
+  theMessenger = G4RTMessenger::GetInstance(this,theRayTracerSteppingAction);
+  theEventManager = G4EventManager::GetEventManager();
+
+  nColumn = 640;
+  nRow = 640;
+
+  eyePosition = G4ThreeVector(1.*m,1.*m,1.*m);
+  targetPosition = G4ThreeVector(0.,0.,0.);
+  lightDirection = G4ThreeVector(-0.1,-0.2,-0.3).unit();
+  viewSpan = 5.0*deg;
+  headAngle = 270.*deg; 
+  attenuationLength = 1.0*m;
+
+  distortionOn = false;
+  antialiasingOn = false;
+
+  backgroundColour = G4Colour(1.,1.,1.);
+}
+
+G4TheRayTracer::~G4TheRayTracer()
+{
+  delete theRayShooter;
+  if(theRayTracerTrackingAction) delete theRayTracerTrackingAction;
+  if(theRayTracerSteppingAction) delete theRayTracerSteppingAction;
+  delete theMessenger;
+  delete theScanner;
+  delete theFigMaker;
+}
+
+void G4TheRayTracer::Trace(G4String fileName)
+{
+  G4StateManager* theStateMan = G4StateManager::GetStateManager();
+  G4ApplicationState currentState = theStateMan->GetCurrentState();
+  if(currentState!=G4State_Idle)
+  {
+    G4cerr << "Illegal application state - Trace() ignored." << G4endl;
+    return;
+  }
+
+  if(!theFigMaker)
+  {
+    G4cerr << "Figure file maker class is not specified - Trace() ignored." << G4endl;
+    return;
+  }
+
+  G4UImanager* UI = G4UImanager::GetUIpointer();
+  G4int storeTrajectory = UI->GetCurrentIntValue("/tracking/storeTrajectory");
+  if(storeTrajectory==0) UI->ApplyCommand("/tracking/storeTrajectory 1");
+
+
+  G4ThreeVector tmpVec = targetPosition - eyePosition;
+  eyeDirection = tmpVec.unit();
+  colorR = new unsigned char[nColumn*nRow];
+  colorG = new unsigned char[nColumn*nRow];
+  colorB = new unsigned char[nColumn*nRow];
+
+  StoreUserActions();
+  G4bool succeeded = CreateBitMap();
+  if(succeeded)
+  { CreateFigureFile(fileName); }
+  else
+  { G4cerr << "Could not create figure file" << G4endl;
+    G4cerr << "You might set the eye position outside of the world volume" << G4endl; }
+  RestoreUserActions();
+
+  if(storeTrajectory==0) UI->ApplyCommand("/tracking/storeTrajectory 0");
+
+  delete [] colorR;
+  delete [] colorG;
+  delete [] colorB;
+}
+
+void G4TheRayTracer::StoreUserActions()
+{ 
+  theUserEventAction = theEventManager->GetUserEventAction();
+  theUserStackingAction = theEventManager->GetUserStackingAction();
+  theUserTrackingAction = theEventManager->GetUserTrackingAction();
+  theUserSteppingAction = theEventManager->GetUserSteppingAction();
+
+  if(!theRayTracerTrackingAction) theRayTracerTrackingAction = new G4RTTrackingAction();
+  if(!theRayTracerSteppingAction) theRayTracerSteppingAction = new G4RTSteppingAction();
+
+  theEventManager->SetUserAction(theRayTracerEventAction);
+  theEventManager->SetUserAction(theRayTracerStackingAction);
+  theEventManager->SetUserAction(theRayTracerTrackingAction);
+  theEventManager->SetUserAction(theRayTracerSteppingAction);
+
+  G4SDManager* theSDMan = G4SDManager::GetSDMpointerIfExist();
+  if(theSDMan)
+  { theSDMan->Activate("/",false); }
+
+  G4GeometryManager* theGeomMan = G4GeometryManager::GetInstance();
+  theGeomMan->OpenGeometry();
+  theGeomMan->CloseGeometry(true);
+}
+
+void G4TheRayTracer::RestoreUserActions()
+{
+  theEventManager->SetUserAction(theUserEventAction);
+  theEventManager->SetUserAction(theUserStackingAction);
+  theEventManager->SetUserAction(theUserTrackingAction);
+  theEventManager->SetUserAction(theUserSteppingAction);
+
+  G4SDManager* theSDMan = G4SDManager::GetSDMpointerIfExist();
+  if(theSDMan)
+  { theSDMan->Activate("/",true); }
+}
+
+#include "G4ProcessManager.hh"
+#include "G4ProcessVector.hh"
+#include "G4Geantino.hh"
+
+G4bool G4TheRayTracer::CreateBitMap()
+{
+  G4int iEvent = 0;
+  G4double stepAngle = viewSpan/100.;
+  G4double viewSpanX = stepAngle*nColumn;
+  G4double viewSpanY = stepAngle*nRow;
+  G4bool succeeded;
+
+// Confirm process(es) of Geantino is initialized
+  G4VPhysicalVolume* pWorld =
+	G4TransportationManager::GetTransportationManager()->
+	GetNavigatorForTracking()->GetWorldVolume();
+  G4RegionStore::GetInstance()->UpdateMaterialList(pWorld);
+  G4ProductionCutsTable::GetProductionCutsTable()->UpdateCoupleTable(pWorld);
+  G4ProcessVector* pVector
+    = G4Geantino::GeantinoDefinition()->GetProcessManager()->GetProcessList();
+  for (G4int j=0; j < pVector->size(); ++j) {
+      (*pVector)[j]->BuildPhysicsTable(*(G4Geantino::GeantinoDefinition()));
+  }
+
+// Close geometry and set the application state
+  G4GeometryManager* geomManager = G4GeometryManager::GetInstance();
+  geomManager->OpenGeometry();
+  geomManager->CloseGeometry(1,0);
+  
+  G4ThreeVector center(0,0,0);
+  G4Navigator* navigator =
+      G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking();
+  navigator->LocateGlobalPointAndSetup(center,0,false);
+
+  G4StateManager* theStateMan = G4StateManager::GetStateManager();
+  theStateMan->SetNewState(G4State_GeomClosed); 
+
+// Event loop
+  theScanner->Initialize(nRow,nColumn);
+  G4int iRow, iColumn;
+  while (theScanner->Coords(iRow,iColumn)) {
+      G4int iCoord = iRow * nColumn + iColumn;
+      G4double dRow = 0, dColumn = 0;  // Antialiasing increments.
+      G4Event* anEvent = new G4Event(iEvent++);
+      G4double angleX = -(viewSpanX/2. - (iColumn+dColumn)*stepAngle);
+      G4double angleY = viewSpanY/2. - (iRow+dRow)*stepAngle;
+      G4ThreeVector rayDirection;
+      if(distortionOn)
+      {
+	rayDirection = G4ThreeVector(std::tan(angleX)/std::cos(angleY),-std::tan(angleY)/std::cos(angleX),1.0);
+      }
+      else
+      {
+	rayDirection = G4ThreeVector(std::tan(angleX),-std::tan(angleY),1.0);
+      }
+      rayDirection.rotateZ(headAngle);
+      rayDirection.rotateUz(eyeDirection);
+      G4ThreeVector rayPosition(eyePosition);
+      G4bool interceptable = true;
+      // Check if rayPosition is in the world.
+      EInside whereisit =
+	pWorld->GetLogicalVolume()->GetSolid()->Inside(rayPosition);
+      if (whereisit != kInside) {
+	// It's outside the world, so move it inside.
+	G4double outsideDistance =
+	  pWorld->GetLogicalVolume()->GetSolid()->
+	  DistanceToIn(rayPosition,rayDirection);  
+	if (outsideDistance != kInfinity) {
+	  // Borrowing from geometry, where 1e-8 < epsilon < 1e-3, in
+	  // absolute/internal length units, is used for ensuring good
+	  // behaviour, choose to add 0.001 to ensure rayPosition is
+	  // definitely inside the world volume (JA 16/9/2005)...
+	  rayPosition = rayPosition+(outsideDistance+0.001)*rayDirection;
+	}
+	else {
+	  interceptable = false;
+	}
+      }
+      if (interceptable) {
+	theRayShooter->Shoot(anEvent,rayPosition,rayDirection);
+	theEventManager->ProcessOneEvent(anEvent);
+	succeeded = GenerateColour(anEvent);
+	colorR[iCoord] = (unsigned char)(int(255*rayColour.GetRed()));
+	colorG[iCoord] = (unsigned char)(int(255*rayColour.GetGreen()));
+	colorB[iCoord] = (unsigned char)(int(255*rayColour.GetBlue()));
+      } else {  // Ray does not intercept world at all.
+	// Store background colour...
+	colorR[iCoord] = (unsigned char)(int(255*backgroundColour.GetRed()));
+	colorG[iCoord] = (unsigned char)(int(255*backgroundColour.GetGreen()));
+	colorB[iCoord] = (unsigned char)(int(255*backgroundColour.GetBlue()));
+	succeeded = true;
+      }
+
+      theScanner->Draw(colorR[iCoord],colorG[iCoord],colorB[iCoord]);
+
+      delete anEvent;
+      if(!succeeded) return false;
+  }
+
+  theStateMan->SetNewState(G4State_Idle); 
+  return true;
+}
+
+void G4TheRayTracer::CreateFigureFile(G4String fileName)
+{
+  //G4cout << nColumn << " " << nRow << G4endl;
+  theFigMaker->CreateFigureFile(fileName,nColumn,nRow,colorR,colorG,colorB);
+}
+
+G4bool G4TheRayTracer::GenerateColour(G4Event* anEvent)
+{
+  G4TrajectoryContainer * trajectoryContainer = anEvent->GetTrajectoryContainer();
+  
+  G4RayTrajectory* trajectory = (G4RayTrajectory*)( (*trajectoryContainer)[0] );
+  if(!trajectory) return false;
+
+  G4int nPoint = trajectory->GetPointEntries();
+  if(nPoint==0) return false;
+
+  G4Colour initialColour(backgroundColour);
+  if( trajectory->GetPointC(nPoint-1)->GetPostStepAtt() )
+  { initialColour = GetSurfaceColour(trajectory->GetPointC(nPoint-1)); }
+  rayColour = Attenuate(trajectory->GetPointC(nPoint-1),initialColour);
+
+  for(int i=nPoint-2;i>=0;i--)
+  {
+    G4Colour surfaceColour = GetSurfaceColour(trajectory->GetPointC(i));
+    G4double weight = 1.0 - surfaceColour.GetAlpha();
+    G4Colour mixedColour = GetMixedColour(rayColour,surfaceColour,weight);
+    rayColour = Attenuate(trajectory->GetPointC(i),mixedColour);
+  }
+    
+  return true;
+}
+
+G4Colour G4TheRayTracer::GetMixedColour(G4Colour surfCol,G4Colour transCol,G4double weight)
+{
+  G4double r = weight*surfCol.GetRed() + (1.-weight)*transCol.GetRed();
+  G4double g = weight*surfCol.GetGreen() + (1.-weight)*transCol.GetGreen();
+  G4double b = weight*surfCol.GetBlue() + (1.-weight)*transCol.GetBlue();
+  G4double a = weight*surfCol.GetAlpha() + (1.-weight)*transCol.GetAlpha();
+  return G4Colour(r,g,b,a);
+}
+
+G4Colour G4TheRayTracer::GetSurfaceColour(G4RayTrajectoryPoint* point)
+{
+  const G4VisAttributes* preAtt = point->GetPreStepAtt();
+  const G4VisAttributes* postAtt = point->GetPostStepAtt();
+
+  G4bool preVis = ValidColour(preAtt);
+  G4bool postVis = ValidColour(postAtt);
+
+  G4Colour transparent(1.,1.,1.,0.);
+
+  if(!preVis&&!postVis) return transparent;
+
+  G4ThreeVector normal = point->GetSurfaceNormal();
+
+  G4Colour preCol(1.,1.,1.);
+  G4Colour postCol(1.,1.,1.);
+
+  if(preVis)
+  {
+    G4double brill = (1.0-(-lightDirection).dot(normal))/2.0;
+    G4double r = preAtt->GetColour().GetRed();
+    G4double g = preAtt->GetColour().GetGreen();
+    G4double b = preAtt->GetColour().GetBlue();
+    preCol = G4Colour(r*brill,g*brill,b*brill,preAtt->GetColour().GetAlpha());
+  }
+  else
+  { preCol = transparent; }
+
+  if(postVis)
+  {
+    G4double brill = (1.0-(-lightDirection).dot(-normal))/2.0;
+    G4double r = postAtt->GetColour().GetRed();
+    G4double g = postAtt->GetColour().GetGreen();
+    G4double b = postAtt->GetColour().GetBlue();
+    postCol = G4Colour(r*brill,g*brill,b*brill,postAtt->GetColour().GetAlpha());
+  }
+  else
+  { postCol = transparent; }
+    
+  if(!preVis) return postCol;
+  if(!postVis) return preCol;
+
+  G4double weight = 0.5;
+  return GetMixedColour(preCol,postCol,weight);
+}
+
+G4Colour G4TheRayTracer::Attenuate(G4RayTrajectoryPoint* point, G4Colour sourceCol)
+{
+  const G4VisAttributes* preAtt = point->GetPreStepAtt();
+
+  G4bool visible = ValidColour(preAtt);
+  if(!visible) return sourceCol;
+
+  G4Colour objCol = preAtt->GetColour();
+  G4double stepRed = objCol.GetRed();
+  G4double stepGreen = objCol.GetGreen();
+  G4double stepBlue = objCol.GetBlue();
+  G4double stepAlpha = objCol.GetAlpha();
+  G4double stepLength = point->GetStepLength();
+
+  G4double attenuationFuctor;
+  if(stepAlpha > 0.9999999){ stepAlpha = 0.9999999; } // patch to the next line
+    attenuationFuctor = -stepAlpha/(1.0-stepAlpha)*stepLength/attenuationLength;
+ 
+  G4double KtRed = std::exp((1.0-stepRed)*attenuationFuctor);
+  G4double KtGreen = std::exp((1.0-stepGreen)*attenuationFuctor);
+  G4double KtBlue = std::exp((1.0-stepBlue)*attenuationFuctor);
+  if(KtRed>1.0){KtRed=1.0;}
+  if(KtGreen>1.0){KtGreen=1.0;}
+  if(KtBlue>1.0){KtBlue=1.0;}
+  return G4Colour(sourceCol.GetRed()*KtRed,
+    sourceCol.GetGreen()*KtGreen,sourceCol.GetBlue()*KtBlue);
+}
+
+G4bool G4TheRayTracer::ValidColour(const G4VisAttributes* visAtt)
+{
+  G4bool val = true;
+  if(!visAtt)
+  { val = false; }
+  else if(!(visAtt->IsVisible()))
+  { val = false; }
+  else if(visAtt->IsForceDrawingStyle()
+    &&(visAtt->GetForcedDrawingStyle()==G4VisAttributes::wireframe))
+  { val = false; }
+  return val;
+}
+
Index: tags/visualization-10.5-before-10.6_test/Tree/GNUmakefile
===================================================================
--- tags/visualization-10.5-before-10.6_test/Tree/GNUmakefile	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/Tree/GNUmakefile	(revision 1102)
@@ -0,0 +1,37 @@
+# $Id: GNUmakefile,v 1.6 2006/11/05 20:45:45 allison Exp $
+
+name := G4Tree
+
+ifndef G4INSTALL
+  G4INSTALL = ../../..
+endif
+
+GLOBLIBS  = libG4vis_management.lib libG4modeling.lib
+GLOBLIBS += libG4run.lib libG4event.lib
+GLOBLIBS += libG4tracking.lib libG4processes.lib libG4digits_hits.lib
+GLOBLIBS += libG4track.lib libG4particles.lib libG4geometry.lib
+GLOBLIBS += libG4materials.lib libG4graphics_reps.lib
+GLOBLIBS += libG4intercoms.lib libG4global.lib
+
+include $(G4INSTALL)/config/architecture.gmk
+include $(G4INSTALL)/config/G4VIS_BUILD.gmk
+include $(G4INSTALL)/config/interactivity.gmk
+
+CPPFLAGS += -I$(G4BASE)/visualization/management/include
+CPPFLAGS += -I$(G4BASE)/visualization/modeling/include
+CPPFLAGS += -I$(G4BASE)/global/management/include
+CPPFLAGS += -I$(G4BASE)/global/HEPGeometry/include
+CPPFLAGS += -I$(G4BASE)/graphics_reps/include
+CPPFLAGS += -I$(G4BASE)/intercoms/include
+CPPFLAGS += -I$(G4BASE)/geometry/management/include
+CPPFLAGS += -I$(G4BASE)/geometry/navigation/include
+CPPFLAGS += -I$(G4BASE)/geometry/volumes/include
+CPPFLAGS += -I$(G4BASE)/geometry/solids/CSG/include
+CPPFLAGS += -I$(G4BASE)/geometry/solids/specific/include
+CPPFLAGS += -I$(G4BASE)/materials/include
+CPPFLAGS += -I$(G4BASE)/digits_hits/hits/include
+CPPFLAGS += -I$(G4BASE)/digits_hits/detector/include
+CPPFLAGS += -I$(G4BASE)/track/include
+CPPFLAGS += -I$(G4BASE)/particles/management/include
+
+include $(G4INSTALL)/config/common.gmk
Index: tags/visualization-10.5-before-10.6_test/Tree/History
===================================================================
--- tags/visualization-10.5-before-10.6_test/Tree/History	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/Tree/History	(revision 1102)
@@ -0,0 +1,144 @@
+$Id: History,v 1.30 2007/03/27 15:11:43 allison Exp $
+-------------------------------------------------------------------
+
+     =========================================================
+     Geant4 - an Object-Oriented Toolkit for Simulation in HEP
+     =========================================================
+
+                      Category History file
+                      ---------------------
+This file should be used by G4 developers and category coordinators
+to briefly summarize all major modifications introduced in the code
+and keep track of all category-tags.
+It DOES NOT substitute the  CVS log-message one should put at every
+committal in the CVS repository !
+
+     *************************************************************
+     * Note that modeling and test have their own History files. *
+     *************************************************************
+
+     ----------------------------------------------------------
+     * Reverse chronological order (last date on top), please *
+     ----------------------------------------------------------
+
+History file for visualization/Tree sub-category
+------------------------------------------------
+
+25th March 2007  John Allison  (vistree-V08-02-01)
+- Removed GAGTree.
+
+5th January 2007  John Allison  (vistree-V08-02-00)
+- Bug fix: Format of total mass.
+
+11th December 2006  John Allison
+- Trapped sequential G4PVPlacements.
+
+5th November 2006  John Allison  (vistree-V08-01-02)
+- Protected against zero material pointer.
+
+1st November 2006  John Allison  (vistree-V08-01-01)
+- G4ASCIITreeSceneHandler.cc: Added printing of material name.
+
+3rd July 2006  John Allison  (vistree-V08-01-00)
+- G4ASCIITreeSceneHandler.cc: Layout improvement.
+
+4th May 2006  John Allison (vistree-V08-00-04)
+- Improved protection for null models and parameters.
+
+19th April March 2006  John Allison (vistree-V08-00-03)
+- G4GAGTreeSceneHandler.cc: Migration away from EstablishSpecials mechanism
+  to direct access to G4PhysicalVolumeModel.
+- Replaced previousMotherID == i->rend() that gives problems on VC++ Net 7.1.
+
+28th March 2006  John Allison (vistree-V08-00-02)
+- Made compatible with modeling-V08-00-05. 
+- Migration away from EstablishSpecials mechanism.
+
+14th March 2006  John Allison (vistree-V08-00-01)
+- G4VTree and G4ASCIITree: Minor improvements to readability of code.
+
+8th February 2006  John Allison (vistree-V08-00-00)
+- G4ASCIITree: Fixed bug in treatment of repeated replicas.
+
+22nd November 2005  John Allison  (vistree-V07-01-01)
+- Refined guidance and printing.
+
+13th October 2005  John Allison  (vistree-V07-01-00)
+- Fixed bug in mass calculations.
+- Migrated to <sstream>.
+
+22nd September 2004  John Allison  (vistree-V06-02-01)
+- Fixed directory name (trailing /).
+- Fixed memory leak in G4ASCIITreeSceneHandler.
+
+13th September 2004  John Allison  (vistree-V06-02-00)
+- Improved ASCIITree:
+  verbosity >= 3: prints volume, density of all volumes in hierarchy.
+  verbosity >= 4: calculates the mass of the complete geometry tree taking
+    into account daughters up to the depth specified for each physical
+    volume in the current scene.  Culling is ignored so that all volumes
+    are processed.  The calculation is quite tricky, since it involves
+    subtracting the mass of that part of the mother that is occupied by
+    each daughter and then adding the mass of the daughter, and so on
+    down the heirarchy.  Uses G4PhysicalVolumeMassScene.
+  Added option to write to file (/vis/ASCIITree/set/outFile).
+- Minor changes to comments in header files of G4VTreeScenehandler and
+  G4GAGTreeScenehandler.
+
+6th November 2003  John Allison  (vis-V05-02-03)
+- Improved printing.
+
+4th October 2003  Gabriele Cosmo (vis-V05-02-01)
+- Simplified GNUmakefile.
+
+04th June 2003  Gabriele Cosmo  (vistree-V05-01-00)
+- Fixed trivial warning in G4GAGTreeList.hh.
+- Fixes for inclusion of <strstream> in G4GAGTreeSceneHandler.cc
+  in view of the g4std wrappers migration.
+
+11th December 2002  John Allison  (vis-V04-01-10)
+- Fixed default view parameters (global culling false).
+
+24th August 2001  John Allison  (vis-V03-02-13)
+- Replaced Dump by RequestPrimitives.  No change of functionality.
+
+25th July 2001  John Allison  (vis-V03-02-07)
+- Improved use of G4PhysicalVolumeModel::CurtailDescent().
+
+15th June 2001  John Allison (vis-V03-01-06)
+- Changed char* to const char* in G4GAGTreeList.hh".
+- Added 2nd template argument (less) to sets in G4ASCIITreeSceneHandler and
+  G4GAGTreeSceneHandler.
+
+15th June 2001  Satoshi Tanaka (vis-V03-01-05)
+- The  first committing of GAGTree driver.
+- Other files are the same as vis-V03-01-04
+ 
+5th June 2001  John Allison (vis-V03-01-04)
+- Moved re-useable code from G4ASCIITree to G4VTree.
+
+4th June 2001  John Allison
+- G4ASCIITree: Added logical volume name and solid name and type under
+  verbosity control.
+- Forced culling off so that all volumes are seen, even if "invisible".
+
+25th May 2001  John Allison
+- Bug fix in G4ASCIITree.cc: initialise fVerbosity(0).
+
+24th May 2001  John Allison  (vis-V03-01-03)
+- Added missing files G4ASCIITreeMessenger.hh/cc.
+- Bug fix in G4ASCIITreeMessenger.cc: currentAsDefault = true.
+
+22nd May 2001  John Allison
+- Refined ASCIITree.
+
+10th April 2001  John Allison (vis-V03-01-00)
+- Added first version of ASCIITree to dump geometry hierarchy to
+  standard output as ASCII stream.
+  This requires two new environment variables:
+    G4VIS_BUILD_ASCIITREE_DRIVER
+    G4VIS_USE_ASCIITREE
+  and config-V03-01-00.
+
+5th April 2001  John Allison (vis-V03-01-00)
+- First version of G4VTree and G4ASCIITree.
Index: tags/visualization-10.5-before-10.6_test/Tree/include/G4ASCIITree.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/Tree/include/G4ASCIITree.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/Tree/include/G4ASCIITree.hh	(revision 1102)
@@ -0,0 +1,58 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4ASCIITree.hh,v 1.7 2006/06/29 21:24:27 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  5th April 2001
+// A graphics system to dump geometry hierarchy to standard output as
+//   ASCII stream.
+
+#ifndef G4ASCIITREE_HH
+#define G4ASCIITREE_HH
+
+#include "G4VTree.hh"
+
+class G4ASCIITreeMessenger;
+
+class G4ASCIITree: public G4VTree {
+public:
+  G4ASCIITree ();
+  virtual ~G4ASCIITree ();
+  G4VSceneHandler* CreateSceneHandler (const G4String& name = "");
+  G4VViewer*  CreateViewer  (G4VSceneHandler&, const G4String& name = "");
+  G4int    GetVerbosity() const {return fVerbosity;}
+  G4String GetOutFileName () const {return fOutFileName;}
+  void SetVerbosity    (G4int verbosity) {fVerbosity = verbosity;}
+  void SetOutFileName (G4String name)  {fOutFileName = name;}
+protected:
+  G4int fVerbosity;
+  G4ASCIITreeMessenger* fpMessenger;
+  G4String fOutFileName;
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/Tree/include/G4ASCIITreeMessenger.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/Tree/include/G4ASCIITreeMessenger.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/Tree/include/G4ASCIITreeMessenger.hh	(revision 1102)
@@ -0,0 +1,63 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4ASCIITreeMessenger.hh,v 1.7 2006/06/29 21:24:29 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  5th April 2001
+// A scene handler to dump geometry hierarchy to standard output as
+//   ASCII stream.
+// Based on a provisional G4ASCIITreeGraphicsScene (was in modeling).
+
+#ifndef G4ASCIITREEMESSENGER_HH
+#define G4ASCIITREEMESSENGER_HH
+
+#include "G4UImessenger.hh"
+
+#include <vector>
+
+class G4ASCIITree;
+class G4UIcommand;
+class G4UIcmdWithAnInteger;
+class G4UIcmdWithAString;
+
+class G4ASCIITreeMessenger: public G4UImessenger {
+public:
+  G4ASCIITreeMessenger(G4ASCIITree*);
+  virtual ~G4ASCIITreeMessenger();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+  static std::vector<G4String> fVerbosityGuidance;
+private:
+  G4ASCIITree* fpASCIITree;
+  G4UIcommand* fpDirectory;
+  G4UIcommand* fpDirectorySet;
+  G4UIcmdWithAnInteger* fpCommandVerbose;
+  G4UIcmdWithAString* fpCommandSetOutFile;
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/Tree/include/G4ASCIITreeSceneHandler.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/Tree/include/G4ASCIITreeSceneHandler.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/Tree/include/G4ASCIITreeSceneHandler.hh	(revision 1102)
@@ -0,0 +1,82 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4ASCIITreeSceneHandler.hh,v 1.17 2006/12/11 21:14:45 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  5th April 2001
+// A scene handler to dump geometry hierarchy to standard output as
+//   ASCII stream.
+// Based on a provisional G4ASCIITreeGraphicsScene (was in modeling).
+
+#ifndef G4ASCIITREESCENEHANDLER_HH
+#define G4ASCIITREESCENEHANDLER_HH
+
+#include "G4VTreeSceneHandler.hh"
+
+#include <set>
+#include <vector>
+#include <iostream>
+#include <fstream>
+#include <sstream>
+
+class G4VPhysicalVolume;
+
+class G4ASCIITreeSceneHandler: public G4VTreeSceneHandler {
+public:
+  G4ASCIITreeSceneHandler(G4VGraphicsSystem& system,
+			  const G4String& name);
+  virtual ~G4ASCIITreeSceneHandler();
+  virtual void BeginModeling();
+  virtual void EndModeling();
+protected:
+  virtual void RequestPrimitives(const G4VSolid&);
+  // Overrides G4VScenehandler::RequestPrimitives and implements dump
+  // of the geometry hierarchy.
+
+  void WriteHeader (std::ostream &);
+
+  std::ostream* fpOutFile;      // Pointer to output file.
+  std::ofstream fOutFile;       // Actual output file (if not G4cout).
+  std::ostringstream fRestOfLine;  // For accumulating rest of line
+				   // pending arrival of new
+				   // G4PVPlacement.
+  const G4VPhysicalVolume* fpLastPV;
+  G4String fLastPVName;
+  G4int    fLastCopyNo;
+  G4int    fLastNonSequentialCopyNo;
+
+  std::set<G4LogicalVolume*> fLVSet;
+  typedef std::set<G4LogicalVolume*>::iterator LVSetIterator;
+  typedef G4PhysicalVolumeModel::G4PhysicalVolumeNodeID PVNodeID;
+  typedef std::vector<PVNodeID> PVPath;
+  std::set<PVPath> fReplicaSet;
+  typedef std::set<PVPath>::iterator ReplicaSetIterator;
+  typedef std::set<PVPath>::reverse_iterator ReplicaSetReverseIterator;
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/Tree/include/G4ASCIITreeViewer.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/Tree/include/G4ASCIITreeViewer.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/Tree/include/G4ASCIITreeViewer.hh	(revision 1102)
@@ -0,0 +1,45 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4ASCIITreeViewer.hh,v 1.5 2006/06/29 21:24:33 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  5th April 2001
+// A dummy viewer for ASCIITreeSceneHandler.
+
+#ifndef G4ASCIITREEVIEWER_HH
+#define G4ASCIITREEVIEWER_HH
+
+#include "G4VTreeViewer.hh"
+
+class G4ASCIITreeViewer: public G4VTreeViewer {
+public:
+  G4ASCIITreeViewer(G4VSceneHandler&,const G4String& name);
+  virtual ~G4ASCIITreeViewer();
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/Tree/include/G4VTree.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/Tree/include/G4VTree.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/Tree/include/G4VTree.hh	(revision 1102)
@@ -0,0 +1,48 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VTree.hh,v 1.5 2006/06/29 21:24:45 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  5th April 2001
+// A graphics system to dump geometry hierarchy.
+
+#ifndef G4VTREE_HH
+#define G4VTREE_HH
+
+#include "G4VGraphicsSystem.hh"
+
+class G4VTree: public G4VGraphicsSystem {
+public:
+  G4VTree (const G4String& name,
+	   const G4String& nickname,
+	   const G4String& description,
+	   Functionality f);
+  virtual ~G4VTree ();
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/Tree/include/G4VTreeSceneHandler.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/Tree/include/G4VTreeSceneHandler.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/Tree/include/G4VTreeSceneHandler.hh	(revision 1102)
@@ -0,0 +1,87 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VTreeSceneHandler.hh,v 1.18 2006/06/29 21:24:47 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  5th April 2001
+// A base class for a scene handler to dump geometry hierarchy.
+// In the derived class, override G4VScenehandler::RequestPrimitives
+// to implement dump of the geometry hierarchy.
+
+#ifndef G4VTREESCENEHANDLER_HH
+#define G4VTREESCENEHANDLER_HH
+
+#include "G4VSceneHandler.hh"
+
+#include "G4PhysicalVolumeModel.hh"
+#include <vector>
+#include <set>
+
+class G4VPhysicalVolume;
+class G4LogicalVolume;
+class G4ModelingParameters;
+
+class G4VTreeSceneHandler: public G4VSceneHandler {
+
+public:
+  G4VTreeSceneHandler(G4VGraphicsSystem& system,
+		      const G4String& name);
+  virtual ~G4VTreeSceneHandler ();
+  void PreAddSolid (const G4Transform3D& objectTransformation,
+		   const G4VisAttributes&);
+  void PostAddSolid ();
+
+  ////////////////////////////////////////////////////////////////
+  // Functions not used but required by the abstract interface.
+
+  virtual void BeginPrimitives (const G4Transform3D&) {}
+  virtual void EndPrimitives () {}
+  virtual void AddPrimitive (const G4Polyline&)   {}
+  virtual void AddPrimitive (const G4Text&)       {}
+  virtual void AddPrimitive (const G4Circle&)     {}
+  virtual void AddPrimitive (const G4Square&)     {}
+  virtual void AddPrimitive (const G4Polyhedron&) {}
+  virtual void AddPrimitive (const G4NURBS&)      {}
+  virtual void AddPrimitive (const G4Polymarker&) {}
+  virtual void AddPrimitive (const G4Scale&)      {}
+
+  virtual void BeginModeling();
+  virtual void EndModeling();
+
+protected:
+
+  // In the derived class, override G4VScenehandler::RequestPrimitives
+  // to implement dump of the geometry hierarchy.
+  static G4int         fSceneIdCount;  // Counter for Tree scene handlers.
+  const G4Transform3D* fpCurrentObjectTransformation;
+  std::set<G4LogicalVolume*> fDrawnLVStore;  // Stores encountered LVs.
+};
+
+#include "G4VTreeSceneHandler.icc"
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/Tree/include/G4VTreeSceneHandler.icc
===================================================================
--- tags/visualization-10.5-before-10.6_test/Tree/include/G4VTreeSceneHandler.icc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/Tree/include/G4VTreeSceneHandler.icc	(revision 1102)
@@ -0,0 +1,34 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VTreeSceneHandler.icc,v 1.8 2006/06/29 21:24:49 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  18th May 2000
+// An artificial graphics scene to find dump geometry hierarchy.
+
+inline void G4VTreeSceneHandler::PostAddSolid () {}
Index: tags/visualization-10.5-before-10.6_test/Tree/include/G4VTreeViewer.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/Tree/include/G4VTreeViewer.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/Tree/include/G4VTreeViewer.hh	(revision 1102)
@@ -0,0 +1,48 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VTreeViewer.hh,v 1.5 2006/06/29 21:24:51 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  5th April 2001
+// A base class for a dummy viewer to dump geometry hierarchy.
+
+#ifndef G4VTREEVIEWER_HH
+#define G4VTREEVIEWER_HH
+
+#include "G4VViewer.hh"
+
+class G4VTreeViewer: public G4VViewer {
+public:
+  G4VTreeViewer(G4VSceneHandler&,const G4String& name);
+  virtual ~G4VTreeViewer();
+  void SetView();
+  void ClearView();
+  void DrawView();
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/Tree/src/G4ASCIITree.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/Tree/src/G4ASCIITree.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/Tree/src/G4ASCIITree.cc	(revision 1102)
@@ -0,0 +1,79 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4ASCIITree.cc,v 1.12 2007/01/05 16:59:43 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  5th April 2001
+// A graphics system to dump geometry hierarchy.
+
+#include "G4ASCIITree.hh"
+#include "G4ASCIITreeSceneHandler.hh"
+#include "G4ASCIITreeViewer.hh"
+#include "G4ASCIITreeMessenger.hh"
+
+G4ASCIITree::G4ASCIITree ():
+  G4VTree ("ASCIITree",
+	   "ATree",
+	   "A graphics system to dump geometry hierarchy"
+	   "\n  to standard output as an ASCII stream.",
+	   G4VGraphicsSystem::nonEuclidian),
+  fVerbosity(0),
+  fOutFileName ("G4cout")
+{
+  fpMessenger = new G4ASCIITreeMessenger(this);
+}
+
+G4ASCIITree::~G4ASCIITree () {
+  delete fpMessenger;
+}
+
+G4VSceneHandler* G4ASCIITree::CreateSceneHandler (const G4String& name) {
+  G4VSceneHandler* pScene = new G4ASCIITreeSceneHandler (*this, name);
+  return pScene;
+}
+
+G4VViewer* G4ASCIITree::CreateViewer (G4VSceneHandler& scene,
+				  const G4String& name) {
+  G4VViewer* pView =
+    new G4ASCIITreeViewer ((G4ASCIITreeSceneHandler&) scene, name);
+  if (pView) {
+    if (pView -> GetViewId () < 0) {
+      G4cout << "G4ASCIITree::CreateViewer: ERROR flagged by negative"
+        " view id in G4ASCIITreeViewer creation."
+        "\n Destroying view and returning null pointer."
+           << G4endl;
+      delete pView;
+      pView = 0;
+    }
+  }
+  else {
+    G4cout << "G4ASCIITree::CreateViewer: ERROR: null pointer on"
+      " new G4ASCIITreeViewer." << G4endl;
+  }
+  return pView;
+}
Index: tags/visualization-10.5-before-10.6_test/Tree/src/G4ASCIITreeMessenger.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/Tree/src/G4ASCIITreeMessenger.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/Tree/src/G4ASCIITreeMessenger.cc	(revision 1102)
@@ -0,0 +1,144 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4ASCIITreeMessenger.cc,v 1.19 2007/01/05 16:59:43 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  5th April 2001
+// A scene handler to dump geometry hierarchy in readable ASCII.
+// Based on a provisional G4ASCIITreeGraphicsScene (was in modeling).
+
+#include "G4ASCIITreeMessenger.hh"
+
+#include "G4ASCIITree.hh"
+#include "G4UIcommand.hh"
+#include "G4UIdirectory.hh"
+#include "G4UIcmdWithAnInteger.hh"
+#include "G4UIcmdWithAString.hh"
+
+std::vector<G4String> G4ASCIITreeMessenger::fVerbosityGuidance;
+
+G4ASCIITreeMessenger::G4ASCIITreeMessenger
+(G4ASCIITree* ASCIITree):
+  fpASCIITree(ASCIITree) {
+
+  G4bool omitable;
+
+  fpDirectory = new G4UIdirectory ("/vis/ASCIITree/");
+  fpDirectory -> SetGuidance ("Commands for ASCIITree control.");
+
+  fpDirectorySet = new G4UIdirectory ("/vis/ASCIITree/set/");
+  fpDirectorySet -> SetGuidance ("Settings for ASCIITree control.");
+
+  fpCommandVerbose = new G4UIcmdWithAnInteger ("/vis/ASCIITree/verbose", this);
+  fVerbosityGuidance.push_back
+    ("  <  10: - does not print daughters of repeated placements,"
+     " does not repeat replicas.");
+  fVerbosityGuidance.push_back
+    ("  >= 10: prints all physical volumes.");
+  fVerbosityGuidance.push_back
+    ("The level of detail is given by verbosity%10:");
+  fVerbosityGuidance.push_back
+    ("for each volume:");
+  fVerbosityGuidance.push_back
+    ("  >=  0: physical volume name.");
+  fVerbosityGuidance.push_back
+    ("  >=  1: logical volume name (and names of sensitive detector"
+     " and readout geometry, if any).");
+  fVerbosityGuidance.push_back
+    ("  >=  2: solid name and type.");
+  fVerbosityGuidance.push_back
+    ("  >=  3: volume and density.");
+  fVerbosityGuidance.push_back
+    ("  >=  5: daughter-subtracted volume and mass.");
+  fVerbosityGuidance.push_back
+    ("and in the summary at the end of printing:");
+  fVerbosityGuidance.push_back
+    ("  >=  4: daughter-included mass of top physical volume(s) in scene"
+     " to depth specified.");
+  fVerbosityGuidance.push_back
+    ("Note: by default, culling is switched off so all volumes are seen.");
+  fVerbosityGuidance.push_back
+    ("Note: the mass calculation takes into account daughters, which can be"
+     " time consuming.  If you want the mass of a particular subtree to a"
+     " particular depth:");
+  fVerbosityGuidance.push_back
+    ("  /vis/open ATree");
+  fVerbosityGuidance.push_back
+    ("  /vis/ASCIITree/verbose 14");
+  fVerbosityGuidance.push_back
+    ("  /vis/scene/create");
+  fVerbosityGuidance.push_back
+    ("  /vis/scene/add/volume <subtree-physical-volume> ! <depth>");
+  fVerbosityGuidance.push_back
+    ("  /vis/sceneHandler/attach");
+  fVerbosityGuidance.push_back
+    ("  /vis/viewer/flush");
+  for (size_t i = 0; i < fVerbosityGuidance.size(); ++i) {
+    fpCommandVerbose -> SetGuidance(fVerbosityGuidance[i]);
+  }
+  fpCommandVerbose -> SetParameterName ("verbosity",omitable = true);
+  fpCommandVerbose -> SetDefaultValue(0);
+
+  fpCommandSetOutFile = new G4UIcmdWithAString ("/vis/ASCIITree/set/outFile", this
+);
+  fpCommandSetOutFile -> SetGuidance ("Set name of output file.");
+  fpCommandSetOutFile -> SetParameterName ("out-filename",
+					   omitable = true);
+  fpCommandSetOutFile -> SetDefaultValue ("G4cout");
+}
+
+G4ASCIITreeMessenger::~G4ASCIITreeMessenger() {
+  delete fpCommandSetOutFile;
+  delete fpDirectorySet;
+  delete fpCommandVerbose;
+  delete fpDirectory;
+}
+
+G4String G4ASCIITreeMessenger::GetCurrentValue(G4UIcommand*) {
+  return "";
+}
+
+void G4ASCIITreeMessenger::SetNewValue
+(G4UIcommand* command,
+ G4String newValue) {
+  if (command == fpCommandVerbose)
+    {
+      fpASCIITree->SetVerbosity
+	(fpCommandVerbose->GetNewIntValue(newValue));
+      G4cout << "G4ASCIITree verbosity now "
+	     << fpASCIITree->GetVerbosity()
+	     << G4endl;
+    }
+  else if (command == fpCommandSetOutFile)
+    {
+      fpASCIITree -> SetOutFileName (newValue);      
+      G4cout << "G4ASCIITree out filename now "
+             << fpASCIITree -> GetOutFileName()
+             << G4endl;  
+    }
+}
Index: tags/visualization-10.5-before-10.6_test/Tree/src/G4ASCIITreeSceneHandler.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/Tree/src/G4ASCIITreeSceneHandler.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/Tree/src/G4ASCIITreeSceneHandler.cc	(revision 1102)
@@ -0,0 +1,401 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4ASCIITreeSceneHandler.cc,v 1.34 2007/01/05 17:00:27 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  5th April 2001
+// A scene handler to dump geometry hierarchy.
+// Based on a provisional G4ASCIITreeGraphicsScene (was in modeling).
+
+#include "G4ASCIITreeSceneHandler.hh"
+
+#include "G4ASCIITree.hh"
+#include "G4ASCIITreeMessenger.hh"
+#include "G4VSolid.hh"
+#include "G4PhysicalVolumeModel.hh"
+#include "G4VPhysicalVolume.hh"
+#include "G4LogicalVolume.hh"
+#include "G4VPVParameterisation.hh"
+#include "G4Polyhedron.hh"
+#include "G4UnitsTable.hh"
+#include "G4Material.hh"
+#include "G4Scene.hh"
+#include "G4ModelingParameters.hh"
+#include "G4PhysicalVolumeMassScene.hh"
+#include "G4VSensitiveDetector.hh"
+#include "G4VReadOutGeometry.hh"
+#include "G4TransportationManager.hh"
+
+G4ASCIITreeSceneHandler::G4ASCIITreeSceneHandler
+(G4VGraphicsSystem& system,
+ const G4String& name):
+  G4VTreeSceneHandler(system, name),
+  fpOutFile(0),
+  fpLastPV(0),
+  fLastCopyNo(-99),
+  fLastNonSequentialCopyNo(-99)
+{}
+
+G4ASCIITreeSceneHandler::~G4ASCIITreeSceneHandler () {}
+
+void G4ASCIITreeSceneHandler::BeginModeling () {
+
+  G4VTreeSceneHandler::BeginModeling ();  // To re-use "culling off" code.
+
+  const G4ASCIITree* pSystem = (G4ASCIITree*)GetGraphicsSystem();
+  const G4String& outFileName = pSystem -> GetOutFileName();
+  if (outFileName == "G4cout") {
+    fpOutFile = &G4cout;
+  } else {
+    fOutFile.open (outFileName);
+    fpOutFile = &fOutFile;
+  }
+
+  G4cout << "G4ASCIITreeSceneHandler::BeginModeling: writing to ";
+  if (outFileName == "G4cout") {
+    G4cout << "G4 standard output (G4cout)";
+  } else {
+    G4cout << "file \"" << outFileName << "\"";
+  }
+  G4cout << G4endl;
+
+  WriteHeader (G4cout); G4cout << G4endl;
+  if (outFileName != "G4cout") {
+    WriteHeader (fOutFile); fOutFile << std::endl;
+  }
+}
+
+void G4ASCIITreeSceneHandler::WriteHeader (std::ostream& os)
+{
+  const G4ASCIITree* pSystem = (G4ASCIITree*)GetGraphicsSystem();
+  const G4int verbosity = pSystem->GetVerbosity();
+  const G4int detail = verbosity % 10;
+  os << "#  Set verbosity with \"/vis/ASCIITree/verbose <verbosity>\":";
+  for (size_t i = 0;
+       i < G4ASCIITreeMessenger::fVerbosityGuidance.size(); ++i) {
+    os << "\n#  " << G4ASCIITreeMessenger::fVerbosityGuidance[i];
+  }
+  os << "\n#  Now printing with verbosity " << verbosity;
+  os << "\n#  Format is: PV:n";
+  if (detail >= 1) os << " / LV (SD,RO)";
+  if (detail >= 2) os << " / Solid(type)";
+  if (detail >= 3) os << ", volume, density";
+  if (detail >= 5) os << ", daughter-subtracted volume and mass";
+  os <<
+    "\n#  Abbreviations: PV = Physical Volume,     LV = Logical Volume,"
+    "\n#                 SD = Sensitive Detector,  RO = Read Out Geometry.";
+}
+
+void G4ASCIITreeSceneHandler::EndModeling () {
+  const G4ASCIITree* pSystem = (G4ASCIITree*) GetGraphicsSystem();
+  const G4int verbosity = pSystem->GetVerbosity();
+  const G4int detail = verbosity % 10;
+  const G4String& outFileName = pSystem -> GetOutFileName();
+
+  // Output left over copy number, if any...
+  if (fLastCopyNo != fLastNonSequentialCopyNo) {
+    if (fLastCopyNo == fLastNonSequentialCopyNo + 1) *fpOutFile << ',';
+    else *fpOutFile << '-';
+    *fpOutFile << fLastCopyNo;
+  }
+  // Output outstanding rest of line, if any...
+  if (!fRestOfLine.str().empty()) *fpOutFile << fRestOfLine.str();
+  fRestOfLine.str("");
+  fpLastPV = 0;
+  fLastPVName.clear();
+  fLastCopyNo = -99;
+  fLastNonSequentialCopyNo = -99;
+
+  // This detail to G4cout regardless of outFileName...
+  if (detail >= 4) {
+    G4cout << "Calculating mass(es)..." << G4endl;
+    const std::vector<G4VModel*>& models = fpScene->GetRunDurationModelList();
+    std::vector<G4VModel*>::const_iterator i;
+    for (i = models.begin(); i != models.end(); ++i) {
+      G4PhysicalVolumeModel* pvModel =
+	dynamic_cast<G4PhysicalVolumeModel*>(*i);
+      if (pvModel) {
+	if (pvModel->GetTopPhysicalVolume() ==
+	    G4TransportationManager::GetTransportationManager()
+	    ->GetNavigatorForTracking()->GetWorldVolume()) {
+	  const G4ModelingParameters* tempMP =
+	    pvModel->GetModelingParameters();
+	  G4ModelingParameters mp;  // Default - no culling.
+	  pvModel->SetModelingParameters (&mp);
+	  G4PhysicalVolumeMassScene massScene(pvModel);
+	  pvModel->DescribeYourselfTo (massScene);
+	  G4double volume = massScene.GetVolume();
+	  G4double mass = massScene.GetMass();
+
+	  G4cout << "Overall volume of \""
+		 << pvModel->GetTopPhysicalVolume()->GetName()
+		 << "\":"
+		 << pvModel->GetTopPhysicalVolume()->GetCopyNo()
+		 << ", is "
+		 << G4BestUnit (volume, "Volume")
+		 << " and the daughter-included mass";
+	  G4int requestedDepth = pvModel->GetRequestedDepth();
+	  if (requestedDepth == G4PhysicalVolumeModel::UNLIMITED) {
+	    G4cout << " to unlimited depth";
+	  } else {
+	    G4cout << ", ignoring daughters at depth "
+		   << requestedDepth
+		   << " and below,";
+	  }
+	  G4cout << " is " << G4BestUnit (mass, "Mass")
+		 << G4endl;
+
+	  pvModel->SetModelingParameters (tempMP);
+	}
+      }
+    }
+  }
+
+  if (outFileName != "G4cout") {
+    fOutFile.close();
+    G4cout << "Output file \"" << outFileName << "\" closed." << G4endl;
+  }
+  fLVSet.clear();
+  fReplicaSet.clear();
+  G4cout << "G4ASCIITreeSceneHandler::EndModeling" << G4endl;
+  G4VTreeSceneHandler::EndModeling ();  // To re-use "culling off" code.
+}
+
+void G4ASCIITreeSceneHandler::RequestPrimitives(const G4VSolid& solid) {
+  
+  G4PhysicalVolumeModel* pPVModel =
+    dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
+  if (!pPVModel) return;  // Not from a G4PhysicalVolumeModel.
+
+  // This call comes from a G4PhysicalVolumeModel.  drawnPVPath is
+  // the path of the current drawn (non-culled) volume in terms of
+  // drawn (non-culled) ancesters.  Each node is identified by a
+  // PVNodeID object, which is a physical volume and copy number.  It
+  // is a vector of PVNodeIDs corresponding to the geometry hierarchy
+  // actually selected, i.e., not culled.
+  typedef G4PhysicalVolumeModel::G4PhysicalVolumeNodeID PVNodeID;
+  typedef std::vector<PVNodeID> PVPath;
+  const PVPath& drawnPVPath = pPVModel->GetDrawnPVPath();
+  //G4int currentDepth = pPVModel->GetCurrentDepth();
+  G4VPhysicalVolume* pCurrentPV = pPVModel->GetCurrentPV();
+  G4LogicalVolume* pCurrentLV = pPVModel->GetCurrentLV();
+  G4Material* pCurrentMaterial = pPVModel->GetCurrentMaterial();
+
+  G4ASCIITree* pSystem = (G4ASCIITree*)GetGraphicsSystem();
+  G4int verbosity = pSystem->GetVerbosity();
+  G4int detail = verbosity % 10;
+
+  if (verbosity < 10 && pCurrentPV->IsReplicated()) {
+    // See if this has been a replica found before with same mother LV...
+    PVPath::const_reverse_iterator thisID = drawnPVPath.rbegin();
+    PVPath::const_reverse_iterator motherID = ++drawnPVPath.rbegin();
+    G4bool ignore = false;
+    for (ReplicaSetIterator i = fReplicaSet.begin(); i != fReplicaSet.end();
+	 ++i) {
+      if (i->back().GetPhysicalVolume()->GetLogicalVolume() ==
+	  thisID->GetPhysicalVolume()->GetLogicalVolume()) {
+	// For each one previously found (if more than one, they must
+	// have different mothers)...
+	// To avoid compilation errors on VC++ .Net 7.1...
+	// Previously:
+	//   PVNodeID previousMotherID = ++(i->rbegin());
+	// (Should that have been: PVNodeID::const_iterator previousMotherID?)
+	// Replace
+	//   previousMotherID == i->rend()
+	// by
+	//   i->size() <= 1
+	// Replace
+	//   previousMotherID != i->rend()
+	// by
+	//   i->size() > 1
+	// Replace
+	//   previousMotherID->
+	// by
+	//   (*i)[i->size() - 2].
+	if (motherID == drawnPVPath.rend() &&
+	    i->size() <= 1)
+	  ignore = true;  // Both have no mother.
+	if (motherID != drawnPVPath.rend() &&
+	    i->size() > 1 &&
+	    motherID->GetPhysicalVolume()->GetLogicalVolume() ==
+	    (*i)[i->size() - 2].GetPhysicalVolume()->GetLogicalVolume())
+	  ignore = true;  // Same mother LV...
+      }
+    }
+    if (ignore) {
+      pPVModel->CurtailDescent();
+      return;
+    }
+  }
+
+  const G4String& currentPVName = pCurrentPV->GetName();
+  const G4int currentCopyNo = pCurrentPV->GetCopyNo();
+
+  if (verbosity < 10 && 
+      currentPVName == fLastPVName &&
+      currentCopyNo != fLastCopyNo) {
+    // For low verbosity, trap series of G4PVPlacements with the same name but
+    // different copy number (replicas should have been taken out above)...
+    // Check...
+    if (pCurrentPV->IsReplicated()) {
+      G4Exception("G4ASCIITreeSceneHandler::RequestPrimitives",
+		  "",
+		  JustWarning,
+		  "Replica unexpected");
+    }
+    // Check mothers are identical...
+    else if (pCurrentLV == (fpLastPV? fpLastPV->GetLogicalVolume(): 0)) {
+      if (currentCopyNo != fLastCopyNo + 1) {
+	// Non-sequential copy number...
+	*fpOutFile << ',' << currentCopyNo;
+	fLastNonSequentialCopyNo = currentCopyNo;
+      }
+      fLastCopyNo = currentCopyNo;
+      pPVModel->CurtailDescent();
+      return;
+    }
+  }
+  fpLastPV = pCurrentPV;
+
+  // High verbosity or a new G4VPhysicalVolume...
+  // Output copy number, if any, from previous invocation...
+  if (fLastCopyNo != fLastNonSequentialCopyNo) {
+    if (fLastCopyNo == fLastNonSequentialCopyNo + 1) *fpOutFile << ',';
+    else *fpOutFile << '-';
+    *fpOutFile << fLastCopyNo;
+  }
+  // Output rest of line, if any, from previous invocation...
+  if (!fRestOfLine.str().empty()) *fpOutFile << fRestOfLine.str();
+  fRestOfLine.str("");
+  fLastPVName = currentPVName;
+  fLastCopyNo = currentCopyNo;
+  fLastNonSequentialCopyNo = currentCopyNo;
+  // Indent according to drawn path depth...
+  for (size_t i = 0; i < drawnPVPath.size(); i++ ) *fpOutFile << "  ";
+  // Start next line...
+  *fpOutFile << "\"" << currentPVName
+	     << "\":" << currentCopyNo;
+
+  if (pCurrentPV->IsReplicated()) {
+    if (verbosity < 10) {
+      // Add printing for replicas (when replicas are ignored)...
+      EAxis axis;
+      G4int nReplicas;
+      G4double width;
+      G4double offset;
+      G4bool consuming;
+      pCurrentPV->GetReplicationData(axis,nReplicas,width,offset,consuming);
+      G4VPVParameterisation* pP = pCurrentPV->GetParameterisation();
+      if (pP) {
+	if (detail < 3) {
+	  fReplicaSet.insert(drawnPVPath);
+	  if (nReplicas > 2) fRestOfLine << '-';
+	  else fRestOfLine << ',';
+	  fRestOfLine << nReplicas - 1
+		      << " (" << nReplicas << " parametrised volumes)";
+	}
+      }
+      else {
+	fReplicaSet.insert(drawnPVPath);
+	if (nReplicas > 2) fRestOfLine << '-';
+	else fRestOfLine << ',';
+	fRestOfLine << nReplicas - 1
+		    << " (" << nReplicas << " replicas)";
+      }
+    }
+  } else {
+    if (fLVSet.find(pCurrentLV) != fLVSet.end()) {
+      if (verbosity <  10) {
+	// Add printing for repeated LV (if it has daughters)...
+	if (pCurrentLV->GetNoDaughters()) fRestOfLine << " (repeated LV)";
+	// ...and curtail descent.
+	pPVModel->CurtailDescent();
+      }
+    }
+  }
+
+  if (detail >= 1) {
+    fRestOfLine << " / \""
+		<< pCurrentLV->GetName() << "\"";
+    G4VSensitiveDetector* sd = pCurrentLV->GetSensitiveDetector();
+    if (sd) {
+      fRestOfLine << " (SD=\"" << sd->GetName() << "\"";
+      G4VReadOutGeometry* roGeom = sd->GetROgeometry();
+      if (roGeom) {
+	fRestOfLine << ",RO=\"" << roGeom->GetName() << "\"";
+      }
+      fRestOfLine << ")";
+    }
+  }
+
+  if (detail >= 2) {
+    fRestOfLine << " / \""
+	       << solid.GetName()
+	       << "\"("
+	       << solid.GetEntityType() << ")";
+  }
+
+  if (detail >= 3) {
+    fRestOfLine << ", "
+		<< G4BestUnit(((G4VSolid&)solid).GetCubicVolume(),"Volume")
+		<< ", ";
+    if (pCurrentMaterial) {
+      fRestOfLine
+	<< G4BestUnit(pCurrentMaterial->GetDensity(), "Volumic Mass")
+	<< " (" << pCurrentMaterial->GetName() << ")";
+    } else {
+      fRestOfLine << "(No material)";
+    }
+  }
+
+  if (detail >= 5) {
+    if (pCurrentMaterial) {
+      G4Material* pMaterial = const_cast<G4Material*>(pCurrentMaterial);
+      // ...and find daughter-subtracted mass...
+      G4double daughter_subtracted_mass = pCurrentLV->GetMass
+	(pCurrentPV->IsParameterised(),  // Force if parametrised.
+	 false,  // Do not propagate - calculate for this volume minus
+	 // volume of daughters.
+	 pMaterial);
+      G4double daughter_subtracted_volume =
+	daughter_subtracted_mass / pCurrentMaterial->GetDensity();
+      fRestOfLine << ", "
+		  << G4BestUnit(daughter_subtracted_volume,"Volume")
+		  << ", "
+		  << G4BestUnit(daughter_subtracted_mass,"Mass");
+    }
+  }
+
+  if (fLVSet.find(pCurrentLV) == fLVSet.end()) {
+    fLVSet.insert(pCurrentLV);  // Record new logical volume.
+  }
+
+  fRestOfLine << std::endl;
+
+  return;
+}
Index: tags/visualization-10.5-before-10.6_test/Tree/src/G4ASCIITreeViewer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/Tree/src/G4ASCIITreeViewer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/Tree/src/G4ASCIITreeViewer.cc	(revision 1102)
@@ -0,0 +1,40 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4ASCIITreeViewer.cc,v 1.8 2006/06/29 21:24:59 gunter Exp $
+// GEANT4 tag $Name:  $
+
+#include "G4ASCIITreeViewer.hh"
+
+G4ASCIITreeViewer::G4ASCIITreeViewer
+(G4VSceneHandler& sceneHandler, const G4String& name):
+  G4VTreeViewer(sceneHandler, name) {
+  // Make changes to view parameters for ASCIITree...
+  fVP.SetCulling(false);
+  fDefaultVP.SetCulling(false);
+}
+
+G4ASCIITreeViewer::~G4ASCIITreeViewer() {}
Index: tags/visualization-10.5-before-10.6_test/Tree/src/G4VTree.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/Tree/src/G4VTree.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/Tree/src/G4VTree.cc	(revision 1102)
@@ -0,0 +1,47 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VTree.cc,v 1.5 2006/06/29 21:25:09 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  5th April 2001
+// A graphics system to dump geometry hierarchy.
+
+#include "G4VTree.hh"
+#include "G4VTreeSceneHandler.hh"
+#include "G4VTreeViewer.hh"
+
+G4VTree::G4VTree (const G4String& name,
+		  const G4String& nickname,
+		  const G4String& description,
+		  Functionality f):
+  G4VGraphicsSystem (name,
+		     nickname,
+		     description,
+		     f) {}
+
+G4VTree::~G4VTree () {}
Index: tags/visualization-10.5-before-10.6_test/Tree/src/G4VTreeSceneHandler.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/Tree/src/G4VTreeSceneHandler.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/Tree/src/G4VTreeSceneHandler.cc	(revision 1102)
@@ -0,0 +1,119 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VTreeSceneHandler.cc,v 1.14 2006/06/29 21:25:11 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  5th April 2001
+// A base class for a scene handler to dump geometry hierarchy.
+// Based on a provisional G4VTreeGraphicsScene (was in modeling).
+
+#include "G4VTreeSceneHandler.hh"
+
+#include "G4VSolid.hh"
+#include "G4PhysicalVolumeModel.hh"
+#include "G4VPhysicalVolume.hh"
+#include "G4LogicalVolume.hh"
+
+G4int G4VTreeSceneHandler::fSceneIdCount = 0;
+// Counter for Tree scene handlers.
+
+G4VTreeSceneHandler::G4VTreeSceneHandler(G4VGraphicsSystem& system,
+					 const G4String& name):
+  G4VSceneHandler(system, fSceneIdCount++, name),
+  fpCurrentObjectTransformation (0)
+{}
+
+G4VTreeSceneHandler::~G4VTreeSceneHandler () {}
+
+void G4VTreeSceneHandler::BeginModeling() {
+  G4VSceneHandler::BeginModeling();  // Required: see G4VSceneHandler.hh.
+}
+
+void G4VTreeSceneHandler::EndModeling() {
+  fDrawnLVStore.clear();
+  G4VSceneHandler::EndModeling();  // Required: see G4VSceneHandler.hh.
+}
+
+void G4VTreeSceneHandler::PreAddSolid
+(const G4Transform3D& objectTransformation, const G4VisAttributes& visAttribs)
+{
+  G4VSceneHandler::PreAddSolid (objectTransformation, visAttribs);
+
+  G4PhysicalVolumeModel* pPVModel =
+    dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
+  if (!pPVModel) return;  // Not from a G4PhysicalVolumeModel.
+
+  // This call comes from a G4PhysicalVolumeModel, drawnPVPath is
+  // the path of the current drawn (non-culled) volume in terms of
+  // drawn (non-culled) ancesters.  Each node is identified by a
+  // PVNodeID object, which is a physical volume and copy number.  It
+  // is a vector of PVNodeIDs corresponding to the geometry hierarchy
+  // actually selected, i.e., not culled.
+  typedef G4PhysicalVolumeModel::G4PhysicalVolumeNodeID PVNodeID;
+  typedef std::vector<PVNodeID> PVPath;
+  const PVPath& drawnPVPath = pPVModel->GetDrawnPVPath();
+  //G4int currentDepth = pPVModel->GetCurrentDepth();
+  //G4VPhysicalVolume* pCurrentPV = pPVModel->GetCurrentPV();
+  //G4LogicalVolume* pCurrentLV = pPVModel->GetCurrentLV();
+  //G4Material* pCurrentMaterial = pPVModel->GetCurrentMaterial();
+
+  // Actually, it is enough to store the logical volume of current
+  // physical volume...
+  fDrawnLVStore.insert
+    (drawnPVPath.back().GetPhysicalVolume()->GetLogicalVolume());
+
+  // Find mother.  ri points to drawn mother, if any.
+  PVPath::const_reverse_iterator ri = ++drawnPVPath.rbegin();
+  if (ri != drawnPVPath.rend()) {
+    // This volume has a mother.
+    G4LogicalVolume* drawnMotherLV =
+      ri->GetPhysicalVolume()->GetLogicalVolume();
+    if (fDrawnLVStore.find(drawnMotherLV) != fDrawnLVStore.end()) {
+      // Mother previously encountered.  Add this volume to
+      // appropriate node in scene graph tree.
+      // ...
+    } else {
+      // Mother not previously encountered.  Shouldn't happen, since
+      // G4PhysicalVolumeModel sends volumes as it encounters them,
+      // i.e., mothers before daughters, in its descent of the
+      // geometry tree.  Error!
+      G4cout << "ERROR: G4XXXSceneHandler::PreAddSolid: Mother "
+	     << ri->GetPhysicalVolume()->GetName()
+	     << ':' << ri->GetCopyNo()
+	     << " not previously encountered."
+	"\nShouldn't happen!  Please report to visualization coordinator."
+	     << G4endl;
+      // Continue anyway.  Add to root of scene graph tree.
+      // ...
+    }
+  } else {
+    // This volume has no mother.  Must be a top level un-culled
+    // volume.  Add to root of scene graph tree.
+    // ...
+  }
+}
Index: tags/visualization-10.5-before-10.6_test/Tree/src/G4VTreeViewer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/Tree/src/G4VTreeViewer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/Tree/src/G4VTreeViewer.cc	(revision 1102)
@@ -0,0 +1,47 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VTreeViewer.cc,v 1.7 2006/06/29 21:25:13 gunter Exp $
+// GEANT4 tag $Name:  $
+
+#include "G4VTreeViewer.hh"
+
+#include "G4VSceneHandler.hh"
+
+G4VTreeViewer::G4VTreeViewer
+(G4VSceneHandler& sceneHandler, const G4String& name):
+  G4VViewer(sceneHandler, sceneHandler.IncrementViewCount(), name) {}
+
+G4VTreeViewer::~G4VTreeViewer() {}
+
+void G4VTreeViewer::SetView() {}
+
+void G4VTreeViewer::ClearView() {}
+
+void G4VTreeViewer::DrawView() {
+  NeedKernelVisit ();  // Always need to visit G4 kernel.
+  ProcessView ();
+}
Index: tags/visualization-10.5-before-10.6_test/VRML/GNUmakefile
===================================================================
--- tags/visualization-10.5-before-10.6_test/VRML/GNUmakefile	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/VRML/GNUmakefile	(revision 1102)
@@ -0,0 +1,32 @@
+# $Id: GNUmakefile,v 1.7 2004/06/03 11:40:14 gcosmo Exp $
+
+# lib name
+name := G4VRML
+
+ifndef G4INSTALL
+  G4INSTALL = ../../..
+endif
+
+GLOBLIBS  = libG4vis_management.lib libG4modeling.lib
+GLOBLIBS += libG4run.lib libG4event.lib
+GLOBLIBS += libG4tracking.lib libG4processes.lib libG4digits_hits.lib
+GLOBLIBS += libG4track.lib libG4particles.lib libG4geometry.lib
+GLOBLIBS += libG4materials.lib libG4graphics_reps.lib
+GLOBLIBS += libG4intercoms.lib libG4global.lib
+
+include $(G4INSTALL)/config/architecture.gmk
+include $(G4INSTALL)/config/G4VIS_BUILD.gmk
+include $(G4INSTALL)/config/interactivity.gmk
+
+CPPFLAGS += -I$(G4BASE)/visualization/management/include
+CPPFLAGS += -I$(G4BASE)/visualization/modeling/include
+CPPFLAGS += -I$(G4BASE)/global/management/include
+CPPFLAGS += -I$(G4BASE)/global/HEPGeometry/include
+CPPFLAGS += -I$(G4BASE)/geometry/solids/CSG/include
+CPPFLAGS += -I$(G4BASE)/geometry/solids/specific/include
+CPPFLAGS += -I$(G4BASE)/graphics_reps/include
+CPPFLAGS += -I$(G4BASE)/intercoms/include
+CPPFLAGS += -I$(G4BASE)/geometry/management/include
+CPPFLAGS += -I$(G4BASE)/visualization/VRML/include
+
+include $(G4INSTALL)/config/common.gmk
Index: tags/visualization-10.5-before-10.6_test/VRML/History
===================================================================
--- tags/visualization-10.5-before-10.6_test/VRML/History	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/VRML/History	(revision 1102)
@@ -0,0 +1,135 @@
+$Id: History,v 1.15 2006/06/12 08:32:16 allison Exp $
+-------------------------------------------------------------------
+
+     =========================================================
+     Geant4 - an Object-Oriented Toolkit for Simulation in HEP
+     =========================================================
+
+                      Category History file
+                      ---------------------
+This file should be used by G4 developers and category coordinators
+to briefly summarize all major modifications introduced in the code
+and keep track of all category-tags.
+It DOES NOT substitute the  CVS log-message one should put at every
+committal in the CVS repository !
+
+     ----------------------------------------------------------
+     * Reverse chronological order (last date on top), please *
+     ----------------------------------------------------------
+
+History file for visualization/VRML sub-category
+------------------------------------------------
+
+12th June 2006  John Allison  (VRML-V08-00-02)
+- G4VRML1/2FileViewer.cc: Fixed rewind problem. ClearView closes and
+  re-opens file.
+- G4VRML1/2FileSceneHandler.cc: Proper terminator on exit:
+
+2nd June 2006  John Allison  (VRML-V08-00-01)
+- G4VRML2SceneHandlerFunc.icc: Protect zero model pointer.
+
+23rd January 2006  John Allison  (VRML-V08-00-00)
+- Rewind output file in G4VRML*FileViewer::ClearView.  Avoids
+  duplicate geometries in output file.
+
+27th May 2005  John Allison  (VRML-V07-00-00)
+- Fixed bug introduced in ClearTransientStore.
+
+19th April 2004  Gabriele Cosmo (VRML-V06-01-00)
+- Fixed typo in printout in G4VRML1FileSceneHandler.cc and
+  G4VRML2FileSceneHandler.cc.
+
+6th November 2003  John Allison  (vis-V05-02-03)
+- G4VRML2SceneHandlerFunc: changed const char* pv_name to G4String pv_name.
+
+4th October 2003  Gabriele Cosmo (vis-V05-02-01)
+- Simplified GNUmakefile.
+
+VRML-V05-00-00 17th February 2003 Satoshi Tanaka
+- A Small bug fixing of VRML2 driver
+ (Explicit cast from G4String to char*).
+
+VRML-V04-01-00 November 10 2002
+- Bug fixing for marker size (*.icc files)
+
+VRML-V03-02-01 18th September 2001  
+- Updation for automatic visualization at Hebden Bridge mini-workshop.
+- Filename incrementation is made the same as the DAWNFILE driver
+
+27th April 2000  Gabriele Cosmo
+- Removed unnecessary #include "G4Transform.hh".
+
+VRML-V01-00-00 27th December 1999  Satoshi Tanaka
+- G4endl ==> "\n" for fDest objects
+
+VRML-V00-01-01 4th November 1999  Satoshi Tanaka
+- Introduction of VRMLBeginModeling() for new vis commands
+
+VRML-00-03-07	Satoshi TANAKA	Dec 07, 1998  
+- An environmental variable "G4VRML_VIEWER" is renames to 
+  "G4VRMLFILE_VIEWER" for consistency.
+
+VRML-00-03-06	Satoshi TANAKA	Dec 04, 1998  
+- Maximun number of generated g4.wrl files in the destination
+  directory is customizable as: "setenv G4VRMLFILE_MAX_FILE_NUM  N"
+  (N is the integer greater than or equal to 1. The default value is 1.)
+
+VRML-00-03-04	Satoshi TANAKA	Dec 03, 1998  
+- Bug fix of SetPVPickability();
+
+VRML-00-03-03	Satoshi TANAKA	Nov 30, 1998  
+- Destination directiory of g4.wrl and g4_X.wrl is customizable 
+  with the environmental variable "G4VRMLFILE_DEST_DIR".
+
+  Unix:
+   % setenv G4VRMLFILE_DEST_DIR   directory_name/
+
+   For example, 
+
+   % setenv G4VRMLFILE_DEST_DIR   /tmp/
+
+   Do not forget to add "/" at the end of the directory name.
+
+  NT: 
+   DOS> set G4VRMLFILE_DEST_DIR   directory_name\
+
+   Do not forget to add "\" at the end of the directory name.
+
+- Minor change in policy of automatic incremation of output VRML file:
+
+  OLD way: g4.wrl, g4_2.wrl, .....           , g4_100.wrl
+  NEW way: g4.wrl, g4_1.wrl, g4_2.wrl, ..... , g4_100.wrl
+
+  Maximal number of files in one directory is restricted in order to 
+  avoid explosion of your hard disk. The maximal number is hard-coded.
+  You can revise is by editing enum's of G4VRML1FILEScene.hh and 
+  G4VRML2FILESchene.hh
+
+  Note that the incrementation is done as follows (pseudo codes)
+
+    filename = "g4.wrl" // initialization
+
+    while( filename already exists in the dest directory )
+    {
+	  increment filename
+    }
+
+  It means that if you delete file "g4.wrl" in the destination directory,
+  the file name in the next generation is still g4.wrl.
+
+  The JAVA application VRML/g4vrmlview/g4vrmlview.java 
+  for network visualization is also updated.
+
+
+VRML-00-03-02	Satoshi TANAKA	Nov 13, 1998  
+- Code refinement of VRML 2.0 driver
+- Pickability of Physical volume is controllable with 
+  setenv G4VRML_PV_PICKABLE  1/0
+- Nickname of VRML drivers are renames:
+  (Old names were, e.g., "VRML1File")
+
+  VRML1 file    : VRML1FILE
+  VRML1 network : VRML1
+
+  VRML2 file    : VRML2FILE
+  VRML1 network : VRML2
Index: tags/visualization-10.5-before-10.6_test/VRML/g4vrmlview/Makefile
===================================================================
--- tags/visualization-10.5-before-10.6_test/VRML/g4vrmlview/Makefile	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/VRML/g4vrmlview/Makefile	(revision 1102)
@@ -0,0 +1,20 @@
+INSTALL_DIR = "/usr/local/javaclass"
+
+JAVAC       = javac
+
+g4vrmlview.class: g4vrmlview.java
+	$(JAVAC) g4vrmlview.java
+	$(JAVAC) g4mini.java
+
+install: 
+	@if [ ! -d $(INSTALL_DIR) ] ; then mkdir $(INSTALL_DIR) ;fi	
+	cp g4vrmlview.class        $(INSTALL_DIR)
+	cp g4vrmlviewThread.class  $(INSTALL_DIR)
+
+clean:
+	rm -f *.class
+	rm -f \#*  *~ *.bak
+
+wrlclean:
+	rm -f g4.wrl  g4_*.wrl
+
Index: tags/visualization-10.5-before-10.6_test/VRML/g4vrmlview/README
===================================================================
--- tags/visualization-10.5-before-10.6_test/VRML/g4vrmlview/README	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/VRML/g4vrmlview/README	(revision 1102)
@@ -0,0 +1,222 @@
+    ----- How to visualize Geant4 simulation -----
+    ----- with VRML-network drivers  and  g4vrmlview  -----
+
+                November 04, 1999
+
+		Satoshi Tanaka  and  Yasuhide Sawada
+		Fukui University, Japan
+		tanaka@i1nws1.fuis.fukui-u.ac.jp
+
+------------------------
+Section 1: Introduction
+------------------------
+
+This is a document to explain how to perform Geant4 
+"remote" visualization with VRML.  You can visualize Geant4 
+simulation on your WWW browser. 
+You have to prepare the following softwares beforehand:
+
+  (1) Geant4 
+  (2) g4vrmlview, a small java software included in the Geant4 package  
+
+       geant4/source/visualization/VRML/g4vrmlview/
+
+      Or you can also obtain it from our ftp site: 
+
+       ftp://i1nws2.fuis.fukui-u.ac.jp/pub/graphics
+              /fukui_graphics_system/g4vrmlview_VERSION.tar.gz
+
+
+  (3) VRML browser, e.g., vrweb, VRMLview, etc
+
+
+-----------------------------------------------
+Section 2: What is the Geant4 VRML-network drivers?
+-----------------------------------------------
+
+  Geant4 VRML-network drivers are included in visualization category of 
+  the Geant4 package:
+
+    geant4/source/visualization/VRML/
+
+  The VRML-network drivers work as follows:
+
+  (1) Convert 3D data of Geant4 simulation into VRML 1.0/2.0 codes.
+  (2) Send the generated VRML codes to another process of "g4vrmlview",
+      running at either local or remote host.
+
+  (Note: For local visualization, use the VRML-file drivers, 
+         which can be invoked with the following commands:
+
+         .....
+
+           Idle> /vis/sceneHandler/create VRML1FILE
+
+         for VRML 1.0 and 
+
+           Idle> /vis/sceneHandler/create VRML2FILE
+ 
+         for VRML 2.0.
+
+
+------------------------------------------------------------------------
+Section 3: Environmental variables to customize the VRML-network drivers
+------------------------------------------------------------------------
+
+  You can customize the VRML-network drivers by setting environmental 
+  variables at Geant4 host, i.e., the host where Geant4 runs:
+
+    Geant4_host % setenv   G4VRML_PORT        port_number  
+    Geant4_host % setenv   G4VRML_HOST_NAME   host_name 
+
+  The default port number is 40801, and the default host name 
+  is "localhost".  You need not define the environmental 
+  variables if you use the default values.
+
+
+---------------------------------
+Section 4: What is g4vrmlview?
+---------------------------------
+
+g4vrmlview is a software written in java. 
+It works as follows:
+
+ (1) Receive VRML codes from a VRML-network driver of Geant4 
+     via local or wide-area network.
+ (2) Save the received VRML codes to a local file named "g4.wrl" etc. 
+ (3) Invoke a VRML viewer, which is specified at the command line, 
+     automatically. 
+
+--------------------------------------
+Section 5: How to install g4vrmlview
+--------------------------------------
+
+  You need JDK1.1 to install g4vrmlview.
+  The installation can be done by doing the following steps:
+
+  (1) % cd g4vrmlview
+  (2) Edit Makefile and set a proper directory name to variable 
+      "INSTALL_DIR".  The default setting is:
+
+       INSTALL_DIR = "/usr/local/javaclass" 
+ 
+       Later, java classes (g4vrmlview.class etc) are installed 
+       to the directory specified by the variable INSTALL_DIR.
+
+  (3) Set the environmental variable "CLASSPATH" in .cshrc etc.
+      (This step can be skipped in some platforms.)
+      For example, if JDK1.1.1 is installed in the directory
+      "/usr/local/dev/jdk1.1.1"  and you want to install g4vrmlview 
+      into  "/usr/local/javaclass",  then the variable CLASSPATH 
+      should be defined as:
+
+        # java in Unix (.cshrc)
+        setenv CLASSPATH .:/usr/local/dev/jdk1.1.1/lib/classes.zip:\
+        /usr/local/javaclass
+
+      Similarly, in Windows NT/95, if JDK.1.1 is installed in 
+      the directory  "C:\jdk1.1.1" and you want to install g4vrmlview
+      into C:\dev\javaclass, you should add the following lines to 
+      AUTOEXEC.BAT:
+
+       # java in Windows NT/95 (autoexec.bat)
+       SET CLASSPATH = .;C:\jdk1.1.1\lib\classes.zip;C:\dev\javaclass
+
+  (4) % make clean
+  (5) % make 
+
+  (6) Test created java classes using g4mini.
+      You can do it using two separate windows, 
+      instead of using two separate hosts.
+      Here we assume that we use windows named "window_1" 
+      and "window_2", and use the VRML browser "vrweb".
+
+        window_1 % java g4vrmlview vrweb
+        Waiting for requests at port  40801 ...
+
+        window_2 % java g4vrmlview vrweb
+        % java g4mini
+        Usage: java g4mini  src_file  server_hostname
+
+        window_2 % java g4mini sample.wrl localhost
+
+      The test is successful if you see pictures on the VRML browser.
+
+  Now you can use g4vrmlview if the class path of java is, 
+  explicitly or implicitly set to the current directory.
+  Go on to the next step if you want to install g4vrmlview into
+  a public place.
+
+  Here you have to become root if you do not have permission 
+  to INSTALL_DIR.  If the directory INSTALL_DIR does not exist, 
+  it will be created automatically. 
+    
+   (5) % make install 
+
+
+--------------------------------------
+Section 6: How to use g4vrmlview
+--------------------------------------
+
+  (1) Invoke g4vrmlview at the host where g4vrmlview runs,
+      say, "VRML_host". For example, 
+
+        VRML_host% java g4vrmlview  VRML_browser_name
+
+      where the last argument is a name of your favorite VRML browser. 
+
+  (2) Invoke Geant4 at the host, where Geant4 runs, say, Geant4_host.
+      For example,
+
+       Geant4_host% exampleN03
+
+       .....
+
+         Idel> /vis/sceneHandler/create VRML1
+
+       for VRML 1.0 and  
+
+         Idel> /vis/sceneHandler/create VRML2
+
+       for VRML 2.0.
+
+
+---------------------------------------
+Section 7: More notes on g4vrmlview
+---------------------------------------
+
+  (1) Format of invoking g4vrmlview:
+
+      % java  g4vrmlview  VRML_browser_name  [port_number]
+
+        VRML_browser_name: 
+             "netscape", "vrweb", etc, 
+             or "NONE" to suppress invoking VRML browser
+
+        port_number: 
+             The default port number is 40801.
+             If you have set the environmental variable 
+             "G4VRML_PORT" at Geant4 host, 
+             you have to give the same port number. 
+             For example, 
+
+             Geant4_host % setenv G4VRML_PORT         40802 
+             VRML_host   % java g4vrmlview  netscape  40802
+
+  (2) Auto increment of port number:
+        If the port number 40801 is already in use, it is 
+        automatically incremented one by one up to 40810.
+
+  (3) Multiple thread:
+        g4vrmlview is a multi-thread software.
+        It can accept data from plural Geant4 at the same time.
+
+  (4) Saving VRML codes to files:
+      VRML codes sent from Geant4 is saved to a file named 
+      "g4.wrl".  If g4.wrl already exists, the file name is 
+      incremented to  g4_2.wrl.  Similarly the file name is 
+      incremented to g4_3.wrl, g4_4.wrl, etc.
+      The files are created in the directory where you invoked g4vrmlview. 
+
+
+===== End of document =====
Index: tags/visualization-10.5-before-10.6_test/VRML/g4vrmlview/g4mini.java
===================================================================
--- tags/visualization-10.5-before-10.6_test/VRML/g4vrmlview/g4mini.java	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/VRML/g4vrmlview/g4mini.java	(revision 1102)
@@ -0,0 +1,83 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: g4mini.java,v 1.4 2006/06/29 21:25:15 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+import java.io.*;
+import java.net.*;
+
+public class g4mini
+{
+	public static void main( String[] args )
+	{
+	try{
+
+		// port number 
+		final int DEFALUT_PORT_NO = 40801 ;
+		int   portNo =  DEFALUT_PORT_NO ;
+
+		// argument checking
+		if( args.length != 2 ) 
+		{
+			System.out.println( "Usage: java g4mini  src_file  server_hostname");
+			return ;
+		}
+		String src         = args[0];
+		String server      = args[1];
+
+		// open connection
+		Socket   socket    =  new Socket( server, portNo ) ;
+
+		// get input stream from file
+		BufferedReader br 
+			= new BufferedReader ( new FileReader ( src ) ) ;
+
+		// get output stream to socket
+		BufferedWriter bw 
+		= new BufferedWriter ( new OutputStreamWriter ( socket.getOutputStream() ) ) ;
+
+		// file ==> socket
+		String line ;
+		while ( (line = br.readLine()) != null )
+		{
+			bw.write( line );   
+			bw.newLine()    ;
+			bw.flush  ()    ;
+		}
+
+		// close streams
+		br.close();
+		bw.close();
+		socket.close() ; 
+	 }
+
+	catch( Exception e ) 
+	{
+		System.out.println( e.toString() );
+	}	
+	} // main
+}
Index: tags/visualization-10.5-before-10.6_test/VRML/g4vrmlview/g4vrmlview.java
===================================================================
--- tags/visualization-10.5-before-10.6_test/VRML/g4vrmlview/g4vrmlview.java	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/VRML/g4vrmlview/g4vrmlview.java	(revision 1102)
@@ -0,0 +1,247 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: g4vrmlview.java,v 1.4 2006/06/29 21:25:17 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+import java.io.*;
+import java.net.*;
+
+//------------------//
+// class g4vrmlview //
+// ( main() )       // 
+//------------------//
+public class g4vrmlview
+{
+	public static void main( String[] args )
+	{
+	try{
+		// CONST 
+		final String VERSION             = "1.00"   ;
+		final String DATE                = "August 19, 1997";
+
+		final int    PORT_NO             = 40801    ;
+		final String OUTPUT_FILE_HEAD    = "g4"     ;
+		final String OUTPUT_FILE_EXT     = "wrl"    ;
+		final int    MAX_TRIAL           = 10       ;
+
+		// local
+		int          portNo              = PORT_NO  ; 
+
+		// argument checking
+		if(  args.length != 1 && args.length != 2 )
+		{
+			System.out.println( "-------------------------------");
+			System.out.println( " G4VRMLView version  " + VERSION );
+			System.out.println( "     " + DATE                   );
+			System.out.println( "-------------------------------");
+			System.out.println( "Usage: java g4vrmlview browser_name [port_number]");
+			System.out.println( "  Browser_name: netscape, vrweb, etc, or NONE");
+			return ;
+		}
+		
+		// VRML browser
+		String       browser = new String ( args[0] ) ;
+
+		// port number
+		if( args.length == 2 ) 
+		{
+			portNo = Integer.parseInt( args[1] );
+		}
+
+		// make a server socket
+		ServerSocket  ss = null ;
+		for ( int i = 0 ; i < MAX_TRIAL ; i++ )
+		{
+			try 
+			{
+				ss = new ServerSocket( portNo );
+				System.out.println( "Waiting for requests at port  " +portNo + " ...");
+				break ;
+			}
+			catch ( Exception e ) 
+			{
+				portNo++ ; 
+				if( i >= MAX_TRIAL ) 
+				{ 
+					System.out.println( "Sockets are not available.");
+					return ;
+				}
+			}
+		} // for 
+
+
+		// open connection and invoke thread
+		int nSpawn = 0 ;
+		while( true )
+		{
+			Socket socket = ss.accept();	nSpawn++ ;
+
+			System.out.println( "Connection accepted by thread " + nSpawn ); 
+
+			( new g4vrmlviewThread( socket, OUTPUT_FILE_HEAD, OUTPUT_FILE_EXT , browser )).start() ;
+
+		} // while
+
+	}
+	catch ( Exception e ) 
+	{
+		System.out.println( e.toString() );
+	}	
+	} // main()
+
+} // g4vrmlview
+
+
+//------------------------//
+// class g4vrmlviewThread //
+//------------------------//
+class g4vrmlviewThread extends Thread
+{
+	private final String NONE = "NONE" ; // no browser
+	private  Socket     m_socket     ;
+	private  String     m_outputFile     ;		
+	private  String     m_browser    ;
+
+	// constuctor
+	public g4vrmlviewThread(	Socket socket          , 
+					String outputFileHead  , 
+					String outputFileExt   , 
+					String browser     ) 
+	{
+		m_socket     = socket ;
+		SetOutputFileName ( outputFileHead  , outputFileExt );
+		m_browser    = new String ( browser    );
+	}
+
+	private void SetOutputFileName(	String outputFileHead,
+					String outputFileExt  )
+	{
+		// temporary file name
+		String  outputFile_tmp 
+		= new String (	outputFileHead + 
+				"."            +
+				outputFileExt   ) ; 
+
+		// for modification of temporary filename
+		int n = 1 ; 
+
+		// make a non-existing filename
+		while ( true )
+		{
+			File file = new File ( outputFile_tmp );
+
+			if ( !file.exists() ) 
+			{ 
+				break ; 
+			} else {
+
+				outputFile_tmp 
+				= new String (	outputFileHead + 
+						"_"            +
+						(n++)          +
+						"."            +
+						outputFileExt   ); 
+			}
+
+		} // while
+
+		// set decided filename to data field
+		m_outputFile = new String ( outputFile_tmp ); 
+
+	} // g4vrmlviewThread::setOutputFileName()
+
+
+	// run ()
+	public void run ()
+	{
+	try{
+		// get input stream from socket
+		BufferedReader br 
+		= new BufferedReader ( new InputStreamReader ( m_socket.getInputStream() ) ) ;
+
+		// get output stream to file
+		BufferedWriter bw 
+		= new BufferedWriter ( new FileWriter ( m_outputFile ) ) ;
+
+		// socket ==> file
+		String line ;
+		while ( (line = br.readLine()) != null )
+		{
+			bw.write( line );   
+			bw.newLine()    ;
+			bw.flush  ()    ;
+		}
+		System.out.println( "VRML data is saved to file " +m_outputFile );
+
+		// close streams and socket
+		br.close();
+		bw.close();
+		m_socket.close() ; 
+
+		// invoke browser
+		if( !m_browser.equals(NONE) )
+		{
+			try 
+			{
+
+				File file = new File ( m_outputFile );
+
+				// visualize created VRML file with browser	
+				if ( file.exists() ) 
+				{
+					String  outputFileAbs  = new String ( file.getAbsolutePath() ) ;
+					String[] command = { m_browser, outputFileAbs };
+					System.out.println( "Command: " + command[0] + " " + command[1] );
+
+					Process  exec_process    = null ;
+	
+					Runtime runtime = Runtime.getRuntime();
+					exec_process 	= runtime.exec( command );
+					exec_process.waitFor() ;
+				} else {
+						System.out.println( "Error: Failed to open file" + m_outputFile );
+				}
+			} 
+			catch ( Exception e ) 
+			{  
+				System.out.println( e.toString() );
+			}
+
+		} 
+		else 
+		{
+			System.out.println( "No browser was invoked" );
+		}
+
+	}
+	catch( Exception e ) 
+	{
+		System.out.println( e.toString() );
+	}	
+	} // run()
+
+} // g4vrmlviewThread 
Index: tags/visualization-10.5-before-10.6_test/VRML/g4vrmlview/sample.wrl
===================================================================
--- tags/visualization-10.5-before-10.6_test/VRML/g4vrmlview/sample.wrl	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/VRML/g4vrmlview/sample.wrl	(revision 1102)
@@ -0,0 +1,700 @@
+#VRML V1.0 ascii
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1
+	}
+	DEF box_WBox_10 Separator {
+		Material {
+			diffuseColor 1 1 1
+		}
+		Cube {
+			width 12000
+			height 24000
+			depth 20000
+		}
+	}
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 0 1
+	}
+	DEF box_WSBox_11 Separator {
+		Material {
+			diffuseColor 1 0 0
+		}
+		Cube {
+			width 3200
+			height 1300
+			depth 3200
+		}
+	}
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 0 1
+	}
+	DEF box_WSWBox_12 Separator {
+		Material {
+			diffuseColor 0 1 0
+		}
+		Cube {
+			width 3180
+			height 1280
+			depth 3180
+		}
+	}
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 400 0 1
+	}
+	DEF box_WSSBox_13 Separator {
+		Material {
+			diffuseColor 0 0 1
+		}
+		Cube {
+			width 3180
+			height 2
+			depth 3180
+		}
+	}
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 460 0 1
+	}
+	USE box_WSSBox_13
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 520 0 1
+	}
+	USE box_WSSBox_13
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 580 0 1
+	}
+	USE box_WSSBox_13
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 640 0 1
+	}
+	USE box_WSSBox_13
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 700 0 1
+	}
+	USE box_WSSBox_13
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 760 0 1
+	}
+	USE box_WSSBox_13
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 820 0 1
+	}
+	USE box_WSSBox_13
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 880 0 1
+	}
+	USE box_WSSBox_13
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 940 0 1
+	}
+	USE box_WSSBox_13
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 0 1
+	}
+	USE box_WSSBox_13
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1060 0 1
+	}
+	USE box_WSSBox_13
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1120 0 1
+	}
+	USE box_WSSBox_13
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1180 0 1
+	}
+	USE box_WSSBox_13
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1240 0 1
+	}
+	USE box_WSSBox_13
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1300 0 1
+	}
+	USE box_WSSBox_13
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1360 0 1
+	}
+	USE box_WSSBox_13
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1420 0 1
+	}
+	USE box_WSSBox_13
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1480 0 1
+	}
+	USE box_WSSBox_13
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1540 0 1
+	}
+	USE box_WSSBox_13
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1600 0 1
+	}
+	USE box_WSSBox_13
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 -1220 1
+	}
+	DEF tubs_CUTubsR_14 Separator {
+		ShapeHints {
+			vertexOrdering COUNTERCLOCKWISE
+			shapeType SOLID
+			faceType CONVEX
+		}
+		Material {
+			diffuseColor 1 1 1
+		}
+		Coordinate3 {
+			point [
+				1512.5 1512.5 305,
+				1069.5 1852.43 305,
+				553.614 2066.12 305,
+				1.30972e-13 2139 305,
+				1512.5 1512.5 -305,
+				1069.5 1852.43 -305,
+				553.614 2066.12 -305,
+				1.30972e-13 2139 -305,
+				1234.86 1234.86 305,
+				873.18 1512.39 305,
+				451.991 1686.85 305,
+				1.0693e-13 1746.36 305,
+				1234.86 1234.86 -305,
+				873.18 1512.39 -305,
+				451.991 1686.85 -305,
+				1.0693e-13 1746.36 -305,
+			]
+		}
+		IndexedFaceSet {
+			coordIndex [
+				0, 4, 5, 1, -1,
+				1, 5, 6, 2, -1,
+				2, 6, 7, 3, -1,
+				12, 8, 9, 13, -1,
+				13, 9, 10, 14, -1,
+				14, 10, 11, 15, -1,
+				8, 0, 1, 9, -1,
+				9, 1, 2, 10, -1,
+				10, 2, 3, 11, -1,
+				4, 12, 13, 5, -1,
+				5, 13, 14, 6, -1,
+				6, 14, 15, 7, -1,
+				0, 8, 12, 4, -1,
+				7, 15, 11, 3, -1,
+			]
+		}
+	}
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 -1220 1
+	}
+	DEF tubs_CRTubsR_15 Separator {
+		ShapeHints {
+			vertexOrdering COUNTERCLOCKWISE
+			shapeType SOLID
+			faceType CONVEX
+		}
+		Material {
+			diffuseColor 1 1 1
+		}
+		Coordinate3 {
+			point [
+				1505.43 1505.43 305,
+				1064.5 1843.77 305,
+				551.026 2056.46 305,
+				1.30359e-13 2129 305,
+				1505.43 1505.43 -305,
+				1064.5 1843.77 -305,
+				551.026 2056.46 -305,
+				1.30359e-13 2129 -305,
+				1234.86 1234.86 305,
+				873.18 1512.39 305,
+				451.991 1686.85 305,
+				1.0693e-13 1746.36 305,
+				1234.86 1234.86 -305,
+				873.18 1512.39 -305,
+				451.991 1686.85 -305,
+				1.0693e-13 1746.36 -305,
+			]
+		}
+		IndexedFaceSet {
+			coordIndex [
+				0, 4, 5, 1, -1,
+				1, 5, 6, 2, -1,
+				2, 6, 7, 3, -1,
+				12, 8, 9, 13, -1,
+				13, 9, 10, 14, -1,
+				14, 10, 11, 15, -1,
+				8, 0, 1, 9, -1,
+				9, 1, 2, 10, -1,
+				10, 2, 3, 11, -1,
+				4, 12, 13, 5, -1,
+				5, 13, 14, 6, -1,
+				6, 14, 15, 7, -1,
+				0, 8, 12, 4, -1,
+				7, 15, 11, 3, -1,
+			]
+		}
+	}
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 -1220 1
+	}
+	DEF tubs_CUTubsL_16 Separator {
+		ShapeHints {
+			vertexOrdering COUNTERCLOCKWISE
+			shapeType SOLID
+			faceType CONVEX
+		}
+		Material {
+			diffuseColor 1 1 1
+		}
+		Coordinate3 {
+			point [
+				1.30972e-13 2139 305,
+				-553.614 2066.12 305,
+				-1069.5 1852.43 305,
+				-1512.5 1512.5 305,
+				1.30972e-13 2139 -305,
+				-553.614 2066.12 -305,
+				-1069.5 1852.43 -305,
+				-1512.5 1512.5 -305,
+				1.0693e-13 1746.36 305,
+				-451.991 1686.85 305,
+				-873.18 1512.39 305,
+				-1234.86 1234.86 305,
+				1.0693e-13 1746.36 -305,
+				-451.991 1686.85 -305,
+				-873.18 1512.39 -305,
+				-1234.86 1234.86 -305,
+			]
+		}
+		IndexedFaceSet {
+			coordIndex [
+				0, 4, 5, 1, -1,
+				1, 5, 6, 2, -1,
+				2, 6, 7, 3, -1,
+				12, 8, 9, 13, -1,
+				13, 9, 10, 14, -1,
+				14, 10, 11, 15, -1,
+				8, 0, 1, 9, -1,
+				9, 1, 2, 10, -1,
+				10, 2, 3, 11, -1,
+				4, 12, 13, 5, -1,
+				5, 13, 14, 6, -1,
+				6, 14, 15, 7, -1,
+				0, 8, 12, 4, -1,
+				7, 15, 11, 3, -1,
+			]
+		}
+	}
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 -1220 1
+	}
+	DEF tubs_CRTubsL_17 Separator {
+		ShapeHints {
+			vertexOrdering COUNTERCLOCKWISE
+			shapeType SOLID
+			faceType CONVEX
+		}
+		Material {
+			diffuseColor 1 1 1
+		}
+		Coordinate3 {
+			point [
+				1.30359e-13 2129 305,
+				-551.026 2056.46 305,
+				-1064.5 1843.77 305,
+				-1505.43 1505.43 305,
+				1.30359e-13 2129 -305,
+				-551.026 2056.46 -305,
+				-1064.5 1843.77 -305,
+				-1505.43 1505.43 -305,
+				1.0693e-13 1746.36 305,
+				-451.991 1686.85 305,
+				-873.18 1512.39 305,
+				-1234.86 1234.86 305,
+				1.0693e-13 1746.36 -305,
+				-451.991 1686.85 -305,
+				-873.18 1512.39 -305,
+				-1234.86 1234.86 -305,
+			]
+		}
+		IndexedFaceSet {
+			coordIndex [
+				0, 4, 5, 1, -1,
+				1, 5, 6, 2, -1,
+				2, 6, 7, 3, -1,
+				12, 8, 9, 13, -1,
+				13, 9, 10, 14, -1,
+				14, 10, 11, 15, -1,
+				8, 0, 1, 9, -1,
+				9, 1, 2, 10, -1,
+				10, 2, 3, 11, -1,
+				4, 12, 13, 5, -1,
+				5, 13, 14, 6, -1,
+				6, 14, 15, 7, -1,
+				0, 8, 12, 4, -1,
+				7, 15, 11, 3, -1,
+			]
+		}
+	}
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 -610 1
+	}
+	USE tubs_CUTubsR_14
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 -610 1
+	}
+	USE tubs_CRTubsR_15
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 -610 1
+	}
+	USE tubs_CUTubsL_16
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 -610 1
+	}
+	USE tubs_CRTubsL_17
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 0 1
+	}
+	USE tubs_CUTubsR_14
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 0 1
+	}
+	USE tubs_CRTubsR_15
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 0 1
+	}
+	USE tubs_CUTubsL_16
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 0 1
+	}
+	USE tubs_CRTubsL_17
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 610 1
+	}
+	USE tubs_CUTubsR_14
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 610 1
+	}
+	USE tubs_CRTubsR_15
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 610 1
+	}
+	USE tubs_CUTubsL_16
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 610 1
+	}
+	USE tubs_CRTubsL_17
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 1220 1
+	}
+	USE tubs_CUTubsR_14
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 1220 1
+	}
+	USE tubs_CRTubsR_15
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 1220 1
+	}
+	USE tubs_CUTubsL_16
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 1220 1
+	}
+	USE tubs_CRTubsL_17
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 4100 0 1
+	}
+	DEF box_muCh_18 Separator {
+		Material {
+			diffuseColor 1 1 1
+		}
+		Cube {
+			width 8000
+			height 200
+			depth 8000
+		}
+	}
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 4250 0 1
+	}
+	DEF box_muFe_19 Separator {
+		Material {
+			diffuseColor 1 1 1
+		}
+		Cube {
+			width 8000
+			height 100
+			depth 8000
+		}
+	}
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 4400 0 1
+	}
+	USE box_muCh_18
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 4550 0 1
+	}
+	USE box_muFe_19
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 4700 0 1
+	}
+	USE box_muCh_18
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 4850 0 1
+	}
+	USE box_muFe_19
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 5000 0 1
+	}
+	USE box_muCh_18
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 5150 0 1
+	}
+	USE box_muFe_19
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 5300 0 1
+	}
+	USE box_muCh_18
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 5450 0 1
+	}
+	USE box_muFe_19
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 5550 0 1
+	}
+	USE box_muFe_19
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 5700 0 1
+	}
+	USE box_muCh_18
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 5850 0 1
+	}
+	USE box_muFe_19
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 5950 0 1
+	}
+	USE box_muFe_19
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 6100 0 1
+	}
+	USE box_muCh_18
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 6250 0 1
+	}
+	USE box_muFe_19
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 6350 0 1
+	}
+	USE box_muFe_19
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 6500 0 1
+	}
+	USE box_muCh_18
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 6650 0 1
+	}
+	USE box_muFe_19
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 6750 0 1
+	}
+	USE box_muFe_19
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 6900 0 1
+	}
+	USE box_muCh_18
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 7050 0 1
+	}
+	USE box_muFe_19
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 7150 0 1
+	}
+	USE box_muFe_19
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 7300 0 1
+	}
+	USE box_muCh_18
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 7450 0 1
+	}
+	USE box_muFe_19
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 7550 0 1
+	}
+	USE box_muFe_19
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 7700 0 1
+	}
+	USE box_muCh_18
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 7850 0 1
+	}
+	USE box_muFe_19
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 7950 0 1
+	}
+	USE box_muFe_19
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 8100 0 1
+	}
+	USE box_muCh_18
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 8250 0 1
+	}
+	USE box_muFe_19
+}
+Separator {
+	MatrixTransform {
+		matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 8350 0 1
+	}
+	USE box_muFe_19
+}
+#End of file.
Index: tags/visualization-10.5-before-10.6_test/VRML/include/FRClient.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/VRML/include/FRClient.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/VRML/include/FRClient.h	(revision 1102)
@@ -0,0 +1,64 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: FRClient.h,v 1.6 2006/06/29 21:25:19 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// FRClient.h
+// FukuiRenderer Client
+// Yasuhide Sawada & Satoshi Tanaka
+
+
+#ifndef WIN32
+
+#ifdef  G4VIS_BUILD_VRML_DRIVER
+
+#ifndef FR_CLIENT_H
+#define FR_CLIENT_H
+
+#define FRSendLength 256
+
+class FRClient {
+public:
+	FRClient();
+	virtual ~FRClient();
+
+	int create();
+	int connect(const char *hostname, int port);
+
+	int send(const char *sendbuf);
+	int receive(char *recvbuf);
+
+	int close();
+protected:
+	int fd;
+	int port;
+};
+
+#endif //FR_CLIENT_H
+#endif //G4VIS_BUILD_VRML_DRIVER
+#endif //WIN32
+
Index: tags/visualization-10.5-before-10.6_test/VRML/include/G4FRClient.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/VRML/include/G4FRClient.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/VRML/include/G4FRClient.hh	(revision 1102)
@@ -0,0 +1,73 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4FRClient.hh,v 1.8 2006/06/29 21:25:21 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// G4FRClient.hh
+// Yasuhide Sawada and Satoshi Tanaka
+
+#ifndef WIN32
+
+#ifdef  G4VIS_BUILD_VRML_DRIVER
+
+#ifndef G4_FR_CLIENT_HH
+#define G4_FR_CLIENT_HH
+
+#include "globals.hh"
+
+class FRClient;
+
+class G4FRClient {
+	// G4FRClient can SEND only! 
+public:
+	G4FRClient();
+	virtual ~G4FRClient();
+
+	G4bool connect(const char *hostname, G4int port);
+	void close();
+
+	G4int getPort() const;
+
+	G4bool isConnected() const { return connected; }
+	G4bool is_open    () const { return connected; }
+
+	G4FRClient& operator << (G4int);
+	G4FRClient& operator << (G4double);
+	G4FRClient& operator << (const char *);
+	G4FRClient& operator << (G4FRClient& (*)(G4FRClient&));
+private:
+	FRClient *fFRClient;
+	G4bool connected;
+	G4int fPort;
+};
+
+//manipulator
+//G4FRClient& endl(G4FRClient&);
+
+#endif //G4_FR_CLIENT_HH
+#endif //G4VIS_BUILD_VRML_DRIVER
+#endif //WIN32
Index: tags/visualization-10.5-before-10.6_test/VRML/include/G4VRML1.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/VRML/include/G4VRML1.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/VRML/include/G4VRML1.hh	(revision 1102)
@@ -0,0 +1,70 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VRML1.hh,v 1.10 2006/06/29 21:25:23 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// G4VRML1.hh
+// Yasuhide Sawada and Satoshi Tanaka
+
+#ifndef WIN32
+
+#if defined (G4VIS_BUILD_VRML_DRIVER) || defined (G4VIS_USE_VRML)
+
+#ifndef G4VRML1_HH
+#define G4VRML1_HH
+
+#include "G4VGraphicsSystem.hh"
+#include "FRClient.h"
+
+class G4VSceneHandler;
+
+//#define FR_VRML_DEFAULT_PORT	40801
+//#define FR_VRML_PORT_ENV	"FR_VRML_PORT"
+//#define FR_VRML_HOST_NAME_ENV	"FR_VRML_HOST_NAME"
+
+#include "G4VRMLNetConfig.hh"
+
+class G4VRML1: public G4VGraphicsSystem {
+public:
+	G4VRML1(); 
+	virtual ~G4VRML1();
+	G4VSceneHandler* CreateSceneHandler(const G4String& name = "");
+	G4VViewer*  CreateViewer(G4VSceneHandler&, const G4String& name = "");
+
+public:
+	const G4String& getHostName() { return fHostName; }
+	G4int getPort() { return fPort; }
+
+private:
+	G4String	fHostName;
+	G4int		fPort;
+
+};
+
+#endif //G4VRML1_HH
+#endif //G4VIS_BUILD_VRML_DRIVER
+#endif //WIN32
Index: tags/visualization-10.5-before-10.6_test/VRML/include/G4VRML1File.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/VRML/include/G4VRML1File.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/VRML/include/G4VRML1File.hh	(revision 1102)
@@ -0,0 +1,49 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VRML1File.hh,v 1.10 2006/06/29 21:25:25 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// G4VRML1File.hh
+// Satoshi Tanaka & Yasuhide Sawada
+
+#ifndef G4VRML1FILE_HH
+#define G4VRML1FILE_HH
+
+#include "G4VGraphicsSystem.hh"
+
+class G4VSceneHandler;
+
+class G4VRML1File: public G4VGraphicsSystem {
+public:
+	G4VRML1File(); 
+	virtual ~G4VRML1File();
+	G4VSceneHandler* CreateSceneHandler(const G4String& name = "");
+	G4VViewer*  CreateViewer(G4VSceneHandler&, const G4String& name = "");
+
+};
+
+#endif //G4VRML1File_HH
Index: tags/visualization-10.5-before-10.6_test/VRML/include/G4VRML1FileSceneHandler.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/VRML/include/G4VRML1FileSceneHandler.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/VRML/include/G4VRML1FileSceneHandler.hh	(revision 1102)
@@ -0,0 +1,135 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VRML1FileSceneHandler.hh,v 1.17 2006/06/29 21:25:27 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// G4VRML1FileSceneHandler.hh
+// Satoshi Tanaka & Yasuhide Sawada
+
+#ifndef G4VRML1FILE_SCENE_HANDLER_HH
+#define G4VRML1FILE_SCENE_HANDLER_HH
+
+#include <fstream>
+
+#include "globals.hh"
+#include "G4LogicalVolume.hh"
+#include "G4VSceneHandler.hh"
+
+
+class G4VRML1File;
+class G4VisAttributes;
+
+class G4VRML1FileSceneHandler: public G4VSceneHandler {
+
+  friend class G4VRML1FileViewer;
+
+// methods (public) 
+public:
+	G4VRML1FileSceneHandler(G4VRML1File& system, const G4String& name = "");
+	virtual ~G4VRML1FileSceneHandler();
+	void AddSolid(const G4Box&);
+	void AddSolid(const G4Cons&);
+	void AddSolid(const G4Tubs&);
+	void AddSolid(const G4Trd&);
+	void AddSolid(const G4Trap&);
+	void AddSolid(const G4Sphere&);
+        void AddSolid(const G4Para&);
+	void AddSolid(const G4Torus&);
+        void AddSolid ( const G4Polycone& polycone ) {
+          G4VSceneHandler::AddSolid (polycone);
+        }
+        void AddSolid ( const G4Polyhedra& polyhedra) {
+          G4VSceneHandler::AddSolid (polyhedra);
+        }
+        void AddSolid(const G4VSolid&);
+        void AddCompound ( const G4VTrajectory& traj) {
+          G4VSceneHandler::AddCompound(traj);
+        }
+        void AddCompound ( const G4VHit& hit) {
+          G4VSceneHandler::AddCompound(hit);
+        }
+
+	void BeginPrimitives(const G4Transform3D& objectTransformation);
+	void EndPrimitives();
+
+	void AddPrimitive(const G4Polyline&);
+	void AddPrimitive(const G4Polyhedron&);
+	void AddPrimitive(const G4NURBS&); 
+	void AddPrimitive(const G4Text&); 
+	void AddPrimitive(const G4Circle&);
+	void AddPrimitive(const G4Square&);
+	void AddPrimitive (const G4Polymarker& polymarker)
+		{ G4VSceneHandler::AddPrimitive (polymarker); }
+        void AddPrimitive (const G4Scale& scale) 
+                { G4VSceneHandler::AddPrimitive (scale); }
+
+	void ClearTransientStore();  // Used for triggering detector re-drawing.
+
+	void BeginModeling();
+	void EndModeling();
+
+	void VRMLBeginModeling();
+	void VRMLEndModeling();
+
+	void connectPort();
+	void closePort();
+
+// methods (private) 
+private:
+
+	void SendMaterialNode( const G4VisAttributes*  pAV ); // NEW NEW NEW
+	void SendMaterialNode();
+	void SendMatrixTransformNode(const G4Transform3D *);
+	void SendCubeNode(G4double, G4double, G4double);
+	void SendCylinderNode(G4double, G4double);
+	void SendSphereNode(G4double);
+
+	void      SendMarkerColor         ( const G4VMarker&  mark ) ;
+	void      SendMarkerWorldPosition ( const G4VMarker&  mark ) ;
+	G4double  GetMarkerHalfSize       ( const G4VMarker&  mark ) ;
+
+	G4bool    isConnected      () { return fFlagDestOpen ; }
+
+// data 
+private:
+	char fVRMLFileDestDir[256] ; 
+	char fVRMLFileName[256]    ; 
+
+	G4String fCurrentDEF;
+
+	G4VRML1File& fSystem;	// Graphics system for this scene.
+	std::ofstream     fDest ;
+	G4bool       fFlagDestOpen ;
+
+	G4int        fMaxFileNum   ;	
+
+	static G4int fSceneIdCount;
+
+};
+
+#endif //G4VRML1FILE_SCENE_HANDLER_HH
+
Index: tags/visualization-10.5-before-10.6_test/VRML/include/G4VRML1FileViewer.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/VRML/include/G4VRML1FileViewer.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/VRML/include/G4VRML1FileViewer.hh	(revision 1102)
@@ -0,0 +1,56 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VRML1FileViewer.hh,v 1.8 2006/06/29 21:25:29 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// G4VRML1FileViewer.hh
+// Satoshi Tanaka and Yasuhide Sawada
+
+#ifndef G4VRML1FILE_VIEWER_HH
+#define G4VRML1FILE_VIEWER_HH
+
+#include "G4VViewer.hh"
+#include "globals.hh"
+
+class G4VRML1FileSceneHandler;
+
+class G4VRML1FileViewer: public G4VViewer {
+public:
+	G4VRML1FileViewer(G4VRML1FileSceneHandler& scene, const G4String& name = "");
+	virtual ~G4VRML1FileViewer();
+	void ClearView();
+	void DrawView();
+	void ShowView();
+	void FinishView();
+private:
+	void SetView();
+
+private:
+	G4VRML1FileSceneHandler& fSceneHandler; // Reference to Graphics Scene for this view.
+};
+
+#endif //G4VRML1File_VIEW_HH
Index: tags/visualization-10.5-before-10.6_test/VRML/include/G4VRML1SceneHandler.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/VRML/include/G4VRML1SceneHandler.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/VRML/include/G4VRML1SceneHandler.hh	(revision 1102)
@@ -0,0 +1,132 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VRML1SceneHandler.hh,v 1.14 2006/06/29 21:25:31 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// G4VRML1SceneHandler.hh
+// Yasuhide Sawada & Satoshi Tanaka
+
+#ifndef WIN32
+
+
+#ifdef  G4VIS_BUILD_VRML_DRIVER
+
+#ifndef G4VRML1_SCENE_HANDLER_HH
+#define G4VRML1_SCENE_HANDLER_HH
+
+
+#include "globals.hh"
+#include "G4LogicalVolume.hh"
+#include "G4VSceneHandler.hh"
+
+#include "G4FRClient.hh"
+
+class G4VRML1;
+class G4VisAttributes;
+
+class G4VRML1SceneHandler: public G4VSceneHandler {
+
+	enum { MAX_CONNECTION_TRIAL = 10 } ;
+
+// methods (public) 
+public:
+	G4VRML1SceneHandler(G4VRML1& system, const G4String& name = "");
+	virtual ~G4VRML1SceneHandler();
+	void AddSolid(const G4Box&);
+	void AddSolid(const G4Cons&);
+	void AddSolid(const G4Tubs&);
+	void AddSolid(const G4Trd&);
+	void AddSolid(const G4Trap&);
+	void AddSolid(const G4Sphere&);
+	void AddSolid(const G4Para&);
+	void AddSolid(const G4Torus&);
+        void AddSolid ( const G4Polycone& polycone ) {
+          G4VSceneHandler::AddSolid (polycone);
+        }
+        void AddSolid ( const G4Polyhedra& polyhedra) {
+          G4VSceneHandler::AddSolid (polyhedra);
+        }
+	void AddSolid(const G4VSolid&);
+        void AddCompound ( const G4VTrajectory& traj) {
+          G4VSceneHandler::AddCompound(traj);
+        }
+        void AddCompound ( const G4VHit& hit) {
+          G4VSceneHandler::AddCompound(hit);
+        }
+
+	void BeginPrimitives(const G4Transform3D& objectTransformation);
+	void EndPrimitives();
+
+	void AddPrimitive(const G4Polyline&);
+	void AddPrimitive(const G4Polyhedron&);
+	void AddPrimitive(const G4NURBS&); 
+	void AddPrimitive(const G4Text&); 
+	void AddPrimitive(const G4Circle&);
+	void AddPrimitive(const G4Square&);
+	void AddPrimitive (const G4Polymarker& polymarker)
+		{ G4VSceneHandler::AddPrimitive (polymarker); }
+        void AddPrimitive (const G4Scale& scale) 
+                { G4VSceneHandler::AddPrimitive (scale); }
+
+	void ClearTransientStore();  // Used for triggering detector re-drawing.
+
+	void BeginModeling();
+	void EndModeling();
+
+	void VRMLBeginModeling();
+	void VRMLEndModeling();
+
+	void connectPort(int max_trial = MAX_CONNECTION_TRIAL );
+	void closePort();
+
+// methods (private) 
+private:
+	void SendMaterialNode( const G4VisAttributes*  pAV ); 
+	void SendMaterialNode();
+	void SendMatrixTransformNode(const G4Transform3D *);
+	void SendCubeNode(G4double, G4double, G4double);
+	void SendCylinderNode(G4double, G4double);
+	void SendSphereNode(G4double);
+
+	void      SendMarkerColor         ( const G4VMarker&  mark ) ;
+	void      SendMarkerWorldPosition ( const G4VMarker&  mark ) ;
+	G4double  GetMarkerHalfSize       ( const G4VMarker&  mark ) ;
+
+// data 
+private:
+	G4String fCurrentDEF;
+
+	G4VRML1& fSystem;	// Graphics system for this scene.
+	G4FRClient fDest ;
+
+	static G4int fSceneIdCount;
+
+};
+
+#endif //G4VRML1_SCENE_HH
+#endif //G4VIS_BUILD_VRML_DRIVER
+#endif //WIN32
Index: tags/visualization-10.5-before-10.6_test/VRML/include/G4VRML1Viewer.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/VRML/include/G4VRML1Viewer.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/VRML/include/G4VRML1Viewer.hh	(revision 1102)
@@ -0,0 +1,62 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VRML1Viewer.hh,v 1.8 2006/06/29 21:25:33 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// G4VRML1Viewer.hh
+// Satoshi Tanaka & Yasuhide Sawada
+
+#ifndef WIN32
+
+#ifdef  G4VIS_BUILD_VRML_DRIVER
+
+#ifndef G4VRML1_VIEWER_HH
+#define G4VRML1_VIEWER_HH
+
+#include "G4VViewer.hh"
+#include "globals.hh"
+
+class G4VRML1SceneHandler;
+
+class G4VRML1Viewer: public G4VViewer {
+public:
+	G4VRML1Viewer(G4VRML1SceneHandler& scene, const G4String& name = "");
+	virtual ~G4VRML1Viewer();
+	void ClearView();
+	void DrawView();
+	void ShowView();
+	void FinishView();
+private:
+	void SetView();
+
+private:
+	G4VRML1SceneHandler& fSceneHandler; // Reference to Graphics Scene for this view.
+};
+
+#endif //G4VRML1_VIEW_HH
+#endif //G4VIS_BUILD_VRML_DRIVER
+#endif //WIN32
Index: tags/visualization-10.5-before-10.6_test/VRML/include/G4VRML2.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/VRML/include/G4VRML2.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/VRML/include/G4VRML2.hh	(revision 1102)
@@ -0,0 +1,69 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VRML2.hh,v 1.10 2006/06/29 21:25:35 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// G4VRML2.hh
+// Satoshi Tanaka and Yasuhide Sawada
+
+#ifndef WIN32
+
+#if defined (G4VIS_BUILD_VRML_DRIVER) || defined (G4VIS_USE_VRML)
+
+#ifndef G4VRML2_HH
+#define G4VRML2_HH
+
+#include "G4VGraphicsSystem.hh"
+#include "FRClient.h"
+
+class G4VSceneHandler;
+
+#include "G4VRMLNetConfig.hh"
+	//#define FR_VRML_DEFAULT_PORT	40801
+	//#define FR_VRML_PORT_ENV	"FR_VRML_PORT"
+	//#define FR_VRML_HOST_NAME_ENV	"FR_VRML_HOST_NAME"
+
+class G4VRML2: public G4VGraphicsSystem {
+public:
+	G4VRML2(); 
+	virtual ~G4VRML2();
+	G4VSceneHandler* CreateSceneHandler(const G4String& name = "");
+	G4VViewer*  CreateViewer(G4VSceneHandler&, const G4String& name = "");
+
+public:
+	const G4String& getHostName() { return fHostName; }
+	G4int getPort() { return fPort; }
+
+private:
+	G4String	fHostName;
+	G4int		fPort;
+
+};
+
+#endif //G4VRML2_HH
+#endif //G4VIS_BUILD_VRML_DRIVER
+#endif //WIN32
Index: tags/visualization-10.5-before-10.6_test/VRML/include/G4VRML2File.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/VRML/include/G4VRML2File.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/VRML/include/G4VRML2File.hh	(revision 1102)
@@ -0,0 +1,49 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VRML2File.hh,v 1.11 2006/06/29 21:25:37 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// G4VRML2File.hh
+// Satoshi Tanaka & Yasuhide Sawada
+
+#ifndef G4VRML2FILE_HH
+#define G4VRML2FILE_HH
+
+#include "G4VGraphicsSystem.hh"
+
+class G4VSceneHandler;
+
+class G4VRML2File: public G4VGraphicsSystem {
+public:
+	G4VRML2File(); 
+	virtual ~G4VRML2File();
+	G4VSceneHandler* CreateSceneHandler(const G4String& name = "");
+	G4VViewer*  CreateViewer(G4VSceneHandler&, const G4String& name = "");
+
+};
+
+#endif //G4VRML2FILE_HH
Index: tags/visualization-10.5-before-10.6_test/VRML/include/G4VRML2FileSceneHandler.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/VRML/include/G4VRML2FileSceneHandler.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/VRML/include/G4VRML2FileSceneHandler.hh	(revision 1102)
@@ -0,0 +1,144 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VRML2FileSceneHandler.hh,v 1.16 2006/06/29 21:25:39 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// G4VRML2FileSceneHandler.hh
+// Satoshi Tanaka & Yasuhide Sawada
+
+#ifndef G4VRML2FILE_SCENE_HANDLER_HH
+#define G4VRML2FILE_SCENE_HANDLER_HH
+
+#include <fstream>
+
+#include "globals.hh"
+#include "G4LogicalVolume.hh"
+#include "G4VSceneHandler.hh"
+
+
+class G4VRML2File;
+class G4VisAttributes;
+
+class G4VRML2FileSceneHandler: public G4VSceneHandler {
+
+  friend class G4VRML2FileViewer;
+
+// methods (public) 
+public:
+	G4VRML2FileSceneHandler(G4VRML2File& system, const G4String& name = "");
+	virtual ~G4VRML2FileSceneHandler();
+	void AddSolid(const G4Box&);
+	void AddSolid(const G4Cons&);
+	void AddSolid(const G4Tubs&);
+	void AddSolid(const G4Trd&);
+	void AddSolid(const G4Trap&);
+	void AddSolid(const G4Sphere&);
+        void AddSolid(const G4Para&);
+	void AddSolid(const G4Torus&);
+        void AddSolid ( const G4Polycone& polycone ) {
+          G4VSceneHandler::AddSolid (polycone);
+        }
+        void AddSolid ( const G4Polyhedra& polyhedra) {
+          G4VSceneHandler::AddSolid (polyhedra);
+        }
+        void AddSolid(const G4VSolid&);
+        void AddCompound ( const G4VTrajectory& traj) {
+          G4VSceneHandler::AddCompound(traj);
+        }
+        void AddCompound ( const G4VHit& hit) {
+          G4VSceneHandler::AddCompound(hit);
+        }
+
+	void BeginPrimitives(const G4Transform3D& objectTransformation);
+	void EndPrimitives();
+
+	void AddPrimitive(const G4Polyline&);
+	void AddPrimitive(const G4Polyhedron&);
+	void AddPrimitive(const G4NURBS&); 
+	void AddPrimitive(const G4Text&); 
+	void AddPrimitive(const G4Circle&);
+	void AddPrimitive(const G4Square&);
+	void AddPrimitive (const G4Polymarker& polymarker)
+		{ G4VSceneHandler::AddPrimitive (polymarker); }
+        void AddPrimitive (const G4Scale& scale) 
+                { G4VSceneHandler::AddPrimitive (scale); }
+
+	void ClearTransientStore();  // Used for triggering detector re-drawing.
+
+	void BeginModeling();
+	void EndModeling();
+
+	void VRMLBeginModeling();
+	void VRMLEndModeling();
+
+	void connectPort();
+	void closePort();
+
+// methods (private) 
+private:
+
+	void      SendMaterialNode          ( const G4VisAttributes*  pAV ); 
+	void      SendMaterialNode          ();
+
+	void      SendLineColor             ( const G4VisAttributes*  pAV ); 
+	void      SendMarkerColor           ( const G4VMarker&  mark ) ;
+	void      SendMarkerWorldPosition   ( const G4VMarker&  mark ) ;
+
+	G4double  GetMarkerHalfSize         ( const G4VMarker&  mark ) ;
+	void      GetMarkerWorldPosition    (	const G4VMarker&  mark , 
+						double* pX             ,
+						double* pY             ,
+						double* pZ              ) ;
+
+	G4bool    isConnected      () { return fFlagDestOpen ; }
+
+	G4bool    IsPVPickable     ()                { return fPVPickable   ;}  
+	void      SetPVPickability ( G4bool on_off ) { fPVPickable = on_off ;}  
+	G4double  SetPVTransparency ()  ; 
+	G4double  GetPVTransparency () { return fPVTransparency ; } 
+
+// data 
+private:
+	char fVRMLFileDestDir[256] ; 
+	char fVRMLFileName[256]    ; 
+
+	G4VRML2File& fSystem;	// Graphics system for this scene.
+	G4bool       fFlagDestOpen ;
+
+	G4int        fMaxFileNum   ;	
+
+	G4bool       fPVPickable ;
+	G4double     fPVTransparency ;
+
+	static G4int fSceneIdCount;
+
+public: 
+	std::ofstream     fDest ;
+
+};
+
+#endif //G4VRML2FILE_SCENE_HANDLER_HH
Index: tags/visualization-10.5-before-10.6_test/VRML/include/G4VRML2FileViewer.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/VRML/include/G4VRML2FileViewer.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/VRML/include/G4VRML2FileViewer.hh	(revision 1102)
@@ -0,0 +1,63 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VRML2FileViewer.hh,v 1.10 2006/06/29 21:25:41 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// G4VRML2FileViewer.hh
+// Satoshi Tanaka and Yasuhide Sawada
+
+#ifndef G4VRML2FILE_VIEWER_HH
+#define G4VRML2FILE_VIEWER_HH
+
+#include <fstream>
+#include "G4VViewer.hh"
+#include "globals.hh"
+
+class G4VRML2FileSceneHandler;
+
+class G4VRML2FileViewer: public G4VViewer {
+public:
+	G4VRML2FileViewer(G4VRML2FileSceneHandler& scene, const G4String& name = "");
+	virtual ~G4VRML2FileViewer();
+	void ClearView();
+	void DrawView();
+	void ShowView();
+	void FinishView();
+private:
+	void SetView(); // Do nothing. SendViewParameters will do its job.
+	void SendViewParameters ()  ;
+
+private:
+	G4VRML2FileSceneHandler& fSceneHandler; // Reference to Graphics Scene for this view.
+	std::ofstream&         fDest ;
+
+	G4double      fViewHalfAngle ;	
+	G4double      fsin_VHA       ;	
+
+};
+
+#endif //G4VRML2FILE_VIEWER_HH
Index: tags/visualization-10.5-before-10.6_test/VRML/include/G4VRML2SceneHandler.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/VRML/include/G4VRML2SceneHandler.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/VRML/include/G4VRML2SceneHandler.hh	(revision 1102)
@@ -0,0 +1,141 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VRML2SceneHandler.hh,v 1.13 2006/06/29 21:25:43 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// G4VRML2SceneHandler.hh
+// Satoshi Tanaka & Yasuhide Sawada
+
+#ifndef WIN32
+
+#ifdef  G4VIS_BUILD_VRML_DRIVER
+
+#ifndef G4VRML2_SCENE_HANDLER_HH
+#define G4VRML2_SCENE_HANDLER_HH
+
+#include "globals.hh"
+#include "G4LogicalVolume.hh"
+#include "G4VSceneHandler.hh"
+
+#include "G4FRClient.hh"
+
+class G4VRML2;
+class G4VisAttributes;
+
+class G4VRML2SceneHandler: public G4VSceneHandler {
+
+	enum { MAX_CONNECTION_TRIAL = 10 } ;
+
+// methods (public) 
+public:
+	G4VRML2SceneHandler(G4VRML2& system, const G4String& name = "");
+	virtual ~G4VRML2SceneHandler();
+	void AddSolid(const G4Box&);
+	void AddSolid(const G4Cons&);
+	void AddSolid(const G4Tubs&);
+	void AddSolid(const G4Trd&);
+	void AddSolid(const G4Trap&);
+	void AddSolid(const G4Sphere&);
+	void AddSolid(const G4Para&);
+	void AddSolid(const G4Torus&);
+        void AddSolid ( const G4Polycone& polycone ) {
+          G4VSceneHandler::AddSolid (polycone);
+        }
+        void AddSolid ( const G4Polyhedra& polyhedra) {
+          G4VSceneHandler::AddSolid (polyhedra);
+        }
+	void AddSolid(const G4VSolid&);
+        void AddCompound ( const G4VTrajectory& traj) {
+          G4VSceneHandler::AddCompound(traj);
+        }
+        void AddCompound ( const G4VHit& hit) {
+          G4VSceneHandler::AddCompound(hit);
+        }
+
+	void BeginPrimitives(const G4Transform3D& objectTransformation);
+	void EndPrimitives();
+
+	void AddPrimitive(const G4Polyline&);
+	void AddPrimitive(const G4Polyhedron&);
+	void AddPrimitive(const G4NURBS&); 
+	void AddPrimitive(const G4Text&); 
+	void AddPrimitive(const G4Circle&);
+	void AddPrimitive(const G4Square&);
+	void AddPrimitive (const G4Polymarker& polymarker)
+		{ G4VSceneHandler::AddPrimitive (polymarker); }
+        void AddPrimitive (const G4Scale& scale) 
+                { G4VSceneHandler::AddPrimitive (scale); }
+
+	void ClearTransientStore();  // Used for triggering detector re-drawing.
+
+	void BeginModeling();
+	void EndModeling();
+
+	void VRMLBeginModeling();
+	void VRMLEndModeling();
+
+	void connectPort(int max_trial = MAX_CONNECTION_TRIAL );
+	void closePort();
+
+// methods (private) 
+private:
+	void      SendMaterialNode        ( const G4VisAttributes*  pAV ); 
+	void      SendMaterialNode        ();
+
+	void      SendLineColor           ( const G4VisAttributes*  pAV ); 
+	void      SendMarkerColor         ( const G4VMarker&  mark ) ;
+	void      SendMarkerWorldPosition ( const G4VMarker&  mark ) ;
+
+	G4double  GetMarkerHalfSize       ( const G4VMarker&  mark ) ;
+	void      GetMarkerWorldPosition  (	const G4VMarker&  mark , 
+						double* pX             ,
+						double* pY             ,
+						double* pZ              ) ;
+
+	G4bool    IsPVPickable     ()                { return fPVPickable   ;}  
+	void      SetPVPickability  ( G4bool on_off ) { fPVPickable = on_off ;}  
+	G4double  SetPVTransparency ()  ; 
+	G4double  GetPVTransparency () { return fPVTransparency ; } 
+
+// data 
+private:
+
+	G4VRML2& fSystem;	// Graphics system for this scene.
+
+	G4bool   fPVPickable     ;
+	G4double fPVTransparency ;
+
+	static G4int fSceneIdCount;
+
+public: 
+	G4FRClient fDest ;
+
+};
+
+#endif //G4VRML2_SCENE_HH
+#endif //G4VIS_BUILD_VRML_DRIVER
+#endif //WIN32
Index: tags/visualization-10.5-before-10.6_test/VRML/include/G4VRML2Viewer.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/VRML/include/G4VRML2Viewer.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/VRML/include/G4VRML2Viewer.hh	(revision 1102)
@@ -0,0 +1,69 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VRML2Viewer.hh,v 1.8 2006/06/29 21:25:45 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// G4VRML2Viewer.hh
+// Satoshi Tanaka & Yasuhide Sawada
+
+#ifndef WIN32
+
+#ifdef  G4VIS_BUILD_VRML_DRIVER
+
+#ifndef G4VRML2_VIEWER_HH
+#define G4VRML2_VIEWER_HH
+
+#include "G4VViewer.hh"
+#include "globals.hh"
+
+#include "G4FRClient.hh"
+
+class G4VRML2SceneHandler;
+
+class G4VRML2Viewer: public G4VViewer {
+public:
+	G4VRML2Viewer(G4VRML2SceneHandler& scene, const G4String& name = "");
+	virtual ~G4VRML2Viewer();
+	void ClearView();
+	void DrawView();
+	void ShowView();
+	void FinishView();
+private:
+	void SetView(); // Do nothing. SendViewParameters will do its job.
+	void SendViewParameters ()  ;
+
+private:
+	G4VRML2SceneHandler& fSceneHandler; // Reference to Graphics Scene for this view.
+	G4FRClient&   fDest ;	
+
+	G4double      fViewHalfAngle ;	
+	G4double      fsin_VHA       ;	
+};
+
+#endif //G4VRML2_VIEW_HH
+#endif //G4VIS_BUILD_VRML_DRIVER
+#endif //WIN32
Index: tags/visualization-10.5-before-10.6_test/VRML/include/G4VRMLNetConfig.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/VRML/include/G4VRMLNetConfig.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/VRML/include/G4VRMLNetConfig.hh	(revision 1102)
@@ -0,0 +1,46 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VRMLNetConfig.hh,v 1.7 2006/06/29 21:25:47 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// G4VRMLNetConfig.hh
+// Satoshi Tanaka
+
+#ifndef WIN32
+
+#ifdef  G4VIS_BUILD_VRML_DRIVER
+
+#ifndef G4VRML_NET_CONFIG_HH
+#define G4VRML_NET_CONFIG_HH
+
+const int   FR_VRML_DEFAULT_PORT     = 40801              ;
+const char  FR_VRML_PORT_ENV     []  = "G4VRML_PORT"      ;
+const char  FR_VRML_HOST_NAME_ENV[]  = "G4VRML_HOST_NAME" ;
+
+#endif // G4VRML_NET_CONFIG_HH
+#endif // G4VIS_BUILD_VRML_DRIVER
+#endif //WIN32
Index: tags/visualization-10.5-before-10.6_test/VRML/src/FRClient.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/VRML/src/FRClient.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/VRML/src/FRClient.cc	(revision 1102)
@@ -0,0 +1,158 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: FRClient.cc,v 1.7 2006/06/29 21:25:49 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// FRClient.cc
+// FukuiRenderer Client
+// Yasuhide Sawada & Satoshi Tanaka
+
+
+//=================//
+#ifndef WIN32
+//=================//
+
+
+//=================//
+#ifdef G4VIS_BUILD_VRML_DRIVER
+//=================//
+
+
+#include "G4ios.hh"
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+#include <fcntl.h>
+
+#include <unistd.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "FRClient.h"
+
+FRClient::FRClient()
+{
+	fd = -1;
+	create();
+}
+
+FRClient::~FRClient()
+{
+	close();
+}
+
+int FRClient::create()
+{
+	/* stream socket */
+	fd = socket(AF_INET, SOCK_STREAM, 0);
+	if (fd < 0)
+		fputs("error: socket.\n", stderr);
+	return fd;
+}
+
+
+
+int FRClient::connect(const char *hostname, int port_)
+{
+	// local variables
+	struct sockaddr_in sa;
+	struct hostent *hp;
+
+	// set port ( sa.sin_family,  sa.sin_port )
+	port = port_;  // Store port number to data member
+	memset( (char *)&sa, '\0', sizeof(sa)) ;
+	sa.sin_family = AF_INET;
+	sa.sin_port = htons(port);
+
+	// set server host ( sa.sin_addr )
+	if (hostname == NULL) {
+		hostname = "localhost"; 
+			// reset arg 
+	}
+	hp = gethostbyname(hostname) ;
+	if ( !hp ) {
+		G4cerr << "ERROR: gethostbyname() failed" << G4endl;
+		return -1; 
+	}
+
+	memcpy( (char * )&sa.sin_addr, (char * )hp->h_addr, hp->h_length );
+
+	// make connection to server
+	if (::connect(fd, (struct sockaddr *)&sa, sizeof(sa)) == -1) {
+		fputs("error: connect\n", stderr);
+		return -1;
+	}
+
+	// return file descripter (data member)
+	return fd;
+}
+
+
+
+int FRClient::send(const char *sendbuf)
+{
+	int len = strlen(sendbuf);
+
+	if (::send(fd, sendbuf, len, 0) < 0) {
+		fputs("error: Send()\n", stderr);
+		len = -1;
+	}
+	return len;
+}
+
+int FRClient::receive(char *recvbuf)
+{
+	int len;
+
+	memset(recvbuf, '\0', FRSendLength + 1);
+	len = ::recv(fd, recvbuf, FRSendLength, 0);
+	if(len < 0) {
+		fputs("error: Receive()\n", stderr);
+		len = -1;
+	}
+	return len;
+}
+
+int FRClient::close()
+{
+	/*
+		shutdown :argument '2' means shutdown both send and receive.
+	*/
+	if (::shutdown(fd, 2) < 0) {
+		fputs("error: shutdown\n", stderr);
+		return -1;
+	}
+	::close(fd);
+	return 0;
+}
+
+#endif //G4VIS_BUILD_VRML_DRIVER
+
+#endif // WIN32
Index: tags/visualization-10.5-before-10.6_test/VRML/src/G4FRClient.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/VRML/src/G4FRClient.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/VRML/src/G4FRClient.cc	(revision 1102)
@@ -0,0 +1,125 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4FRClient.cc,v 1.8 2006/06/29 21:25:51 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// G4FRClient.cc
+// Yasuhide Sawada & Satoshi Tanaka
+
+
+//=================//
+#ifndef WIN32
+//=================//
+
+
+//=================//
+#ifdef G4VIS_BUILD_VRML_DRIVER
+//=================//
+
+
+#include <stdio.h>
+#include "G4FRClient.hh"
+#include "FRClient.h"
+
+G4FRClient::G4FRClient()
+{
+	fFRClient = NULL;
+	fPort = -1;
+	connected = false;
+}
+
+G4FRClient::~G4FRClient()
+{
+	if (connected)
+		this->close();
+}
+
+G4bool G4FRClient::connect(const char *hostname, G4int port)
+{
+	if (connected)
+		return false;
+
+	delete fFRClient;
+	fFRClient = new FRClient();
+
+	fPort = port;
+	connected = (fFRClient->connect(hostname, port) < 0) ? false : true ;
+
+	return connected;
+}
+
+void G4FRClient::close()
+{
+	delete fFRClient;
+	fFRClient = NULL;
+	connected = false;
+}
+
+G4int G4FRClient::getPort() const
+{
+	return fPort;
+}
+
+G4FRClient& G4FRClient::operator << (G4int val)
+{
+	char buf[64];
+	sprintf(buf, "%d", val);
+	fFRClient->send(buf);
+	return *this;
+}
+
+G4FRClient& G4FRClient::operator << (G4double val)
+{
+	char buf[64];
+	sprintf(buf, "%g", val);
+	fFRClient->send(buf);
+	return *this;
+}
+
+G4FRClient& G4FRClient::operator << (const char *pval)
+{
+	fFRClient->send(pval);
+	return *this;
+}
+
+G4FRClient& G4FRClient::operator << (G4FRClient& (*func)(G4FRClient&))
+{
+	return func(*this);
+}
+
+////////////////////////////////////////
+////manipulator
+//G4FRClient& endl(G4FRClient& c)
+//{
+//	return c << "\n";
+//}
+///////////////////////////////////////
+
+#endif //G4VIS_BUILD_VRML_DRIVER
+
+#endif //WIN32
+
Index: tags/visualization-10.5-before-10.6_test/VRML/src/G4VRML1.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/VRML/src/G4VRML1.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/VRML/src/G4VRML1.cc	(revision 1102)
@@ -0,0 +1,96 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VRML1.cc,v 1.10 2006/06/29 21:25:53 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// G4VRML1.cc
+// Yasuhide Sawada & Satoshi Tanaka
+
+#ifndef WIN32
+
+//=================//
+#ifdef G4VIS_BUILD_VRML_DRIVER
+//=================//
+
+
+#include <stdio.h> // sscanf
+#include <stdlib.h> // getenv
+
+#include "G4VSceneHandler.hh"
+
+#include "G4VRML1.hh"
+#include "G4VRML1SceneHandler.hh"
+#include "G4VRML1Viewer.hh"
+
+#include "G4FRClient.hh"
+
+
+G4VRML1::G4VRML1() :
+	G4VGraphicsSystem("VRML1", "VRML1", G4VGraphicsSystem::threeD)
+{
+	// port number
+	fPort = FR_VRML_DEFAULT_PORT;
+	char *pport = getenv(FR_VRML_PORT_ENV);
+	if (pport) {
+		sscanf(pport, "%d", &fPort);
+	}
+
+	// host name
+	fHostName = "localhost" ; // G4String::operator = ( const char* cs )
+	char *phostname =  getenv(FR_VRML_HOST_NAME_ENV); 
+	if (phostname) {
+		fHostName = phostname;
+	}
+}
+
+G4VRML1::~G4VRML1()
+{
+}
+
+
+G4VSceneHandler* G4VRML1::CreateSceneHandler(const G4String& name) 
+{
+	G4VSceneHandler *p = NULL;
+
+	p = new G4VRML1SceneHandler(*this, name);
+
+	return p;
+}
+
+G4VViewer* G4VRML1::CreateViewer(G4VSceneHandler& scene, const G4String& name)
+{
+	G4VViewer* pView = NULL;
+
+	G4VRML1SceneHandler* pScene = (G4VRML1SceneHandler*)&scene;
+	pView = new G4VRML1Viewer(*pScene, name);
+
+	return pView;
+}
+
+#endif
+#endif
+
Index: tags/visualization-10.5-before-10.6_test/VRML/src/G4VRML1File.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/VRML/src/G4VRML1File.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/VRML/src/G4VRML1File.cc	(revision 1102)
@@ -0,0 +1,72 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VRML1File.cc,v 1.10 2006/06/29 21:25:55 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// G4VRML1File.cc
+// Satoshi Tanaka & Yasuhide Sawada
+
+#include <stdio.h> // sscanf
+#include <stdlib.h> // getenv
+
+#include "G4VSceneHandler.hh"
+
+#include "G4VRML1File.hh"
+#include "G4VRML1FileSceneHandler.hh"
+#include "G4VRML1FileViewer.hh"
+
+#include "G4FRClient.hh"
+
+
+G4VRML1File::G4VRML1File() :
+	G4VGraphicsSystem("VRML1FILE", "VRML1FILE", G4VGraphicsSystem::threeD)
+{
+}
+
+G4VRML1File::~G4VRML1File()
+{
+}
+
+
+G4VSceneHandler* G4VRML1File::CreateSceneHandler(const G4String& name) 
+{
+	G4VSceneHandler *p = NULL;
+
+	p = new G4VRML1FileSceneHandler(*this, name);
+
+	return p;
+}
+
+G4VViewer* G4VRML1File::CreateViewer(G4VSceneHandler& scene, const G4String& name)
+{
+	G4VViewer* pView = NULL;
+
+	G4VRML1FileSceneHandler* pScene = (G4VRML1FileSceneHandler*)&scene;
+	pView = new G4VRML1FileViewer(*pScene, name);
+
+	return pView;
+}
Index: tags/visualization-10.5-before-10.6_test/VRML/src/G4VRML1FileSceneHandler.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/VRML/src/G4VRML1FileSceneHandler.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/VRML/src/G4VRML1FileSceneHandler.cc	(revision 1102)
@@ -0,0 +1,207 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VRML1FileSceneHandler.cc,v 1.12 2006/06/29 21:25:57 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// G4VRML1FileSceneHandler.cc
+// Satoshi Tanaka & Yasuhide Sawada
+
+
+//#define DEBUG_FR_SCENE
+
+#include <fstream>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "globals.hh"
+#include "G4Scene.hh"
+#include "G4VPhysicalVolume.hh"
+#include "G4LogicalVolume.hh"
+#include "G4Point3D.hh"
+#include "G4VisAttributes.hh"
+#include "G4Polyhedron.hh"
+#include "G4Box.hh"
+#include "G4Cons.hh"
+#include "G4Polyline.hh"
+#include "G4Trd.hh"
+#include "G4Tubs.hh"
+#include "G4Trap.hh"
+#include "G4Para.hh"
+#include "G4Torus.hh"
+#include "G4Sphere.hh"
+#include "G4Text.hh"
+#include "G4Circle.hh"
+#include "G4Square.hh"
+
+#include "G4VRML1FileSceneHandler.hh"
+#include "G4VRML1FileViewer.hh"
+#include "G4VRML1File.hh"
+
+// CONST
+
+const char  WRL_FILE_HEADER      [] = "g4_";
+const char  DEFAULT_WRL_FILE_NAME[] = "g4.wrl";
+const char  ENV_VRML_VIEWER      [] = "G4VRMLFILE_VIEWER";
+const char  NO_VRML_VIEWER       [] = "NONE";
+const char  VRMLFILE_DEST_DIR    [] = "G4VRMLFILE_DEST_DIR";
+const int   DEFAULT_MAX_WRL_FILE_NUM = 100 ;
+
+G4VRML1FileSceneHandler::G4VRML1FileSceneHandler(G4VRML1File& system, const G4String& name) :
+	G4VSceneHandler(system, fSceneIdCount++, name),
+	fSystem(system),
+	fDest()   ,
+	fFlagDestOpen( false ) 
+{
+	fCurrentDEF = "";
+	strcpy(fVRMLFileName, "");
+
+	if ( getenv( VRMLFILE_DEST_DIR ) == NULL ) {
+		strcpy( fVRMLFileDestDir, "" );
+	} else {
+		strcpy( fVRMLFileDestDir, getenv( VRMLFILE_DEST_DIR ) );
+	}
+
+	// maximum number of g4.wrl files in the dest directory
+	fMaxFileNum = DEFAULT_MAX_WRL_FILE_NUM ; // initialization
+	if ( getenv( "G4VRMLFILE_MAX_FILE_NUM" ) != NULL ) {	
+		
+		sscanf( getenv("G4VRMLFILE_MAX_FILE_NUM"), "%d", &fMaxFileNum ) ;
+
+	} else {
+		fMaxFileNum = DEFAULT_MAX_WRL_FILE_NUM ;
+	}
+	if( fMaxFileNum < 1 ) { fMaxFileNum = 1; }
+
+}
+
+
+G4VRML1FileSceneHandler::~G4VRML1FileSceneHandler()
+{
+#if defined DEBUG_FR_SCENE
+	G4cerr << "***** ~G4VRML1FileSceneHandler" << G4endl;
+#endif 
+	VRMLEndModeling();
+}
+
+
+#define  G4VRML1SCENEHANDLER   G4VRML1FileSceneHandler
+#define  IS_CONNECTED   this->isConnected() 
+#include "G4VRML1SceneHandlerFunc.icc"
+#undef   IS_CONNECTED
+#undef   G4VRML1SCENEHANDLER
+
+
+void G4VRML1FileSceneHandler::connectPort()
+{
+	// g4_00.wrl, g4_01.wrl, ..., g4_MAX_FILE_INDEX.wrl
+	const int MAX_FILE_INDEX = fMaxFileNum - 1 ;
+
+	// dest directory (null if no environmental variables is set)
+	strcpy ( fVRMLFileName, fVRMLFileDestDir) ; 
+
+	// create (full) path name (default)
+	strcat ( fVRMLFileName, DEFAULT_WRL_FILE_NAME );
+
+	// Determine VRML file name
+	for( int i = 0 ; i < fMaxFileNum ; i++) { 
+
+		// Message in the final execution
+		if( i == MAX_FILE_INDEX ) 
+		{
+		  G4cerr << "==========================================="   << G4endl; 
+		  G4cerr << "WARNING MESSAGE from VRML1FILE driver:     "   << G4endl;
+		  G4cerr << "  This file name is the final one in the   "   << G4endl;
+		  G4cerr << "  automatic updation of the output file name." << G4endl; 
+		  G4cerr << "  You may overwrite existing files, i.e.   "   << G4endl; 
+                  G4cerr << "  g4_XX.wrl.                               "   << G4endl;
+		  G4cerr << "==========================================="   << G4endl; 
+		}
+
+		// re-determine file name as G4VRMLFILE_DEST_DIR/g4_XX.wrl 
+		if( i >=  0 && i <= 9 ) { 
+			sprintf( fVRMLFileName, "%s%s%s%d.wrl" , fVRMLFileDestDir,  WRL_FILE_HEADER, "0", i );
+		} else {
+			sprintf( fVRMLFileName, "%s%s%d.wrl"   , fVRMLFileDestDir,  WRL_FILE_HEADER, i );
+		}
+
+		// check validity of the file name
+		std::ifstream  fin ; 
+		fin.open(fVRMLFileName) ;
+		if(!fin) { 
+			// new file	
+			fin.close();  
+			break; 
+		} else { 
+			// already exists (try next) 
+			fin.close(); 
+		} 
+
+
+	} // for 
+
+	// open a VRML 1.0 file with determined file name
+	G4cerr << "==========================================="  << G4endl; 
+	G4cerr << "Output VRML 1.0 file: " << fVRMLFileName << G4endl; 
+	G4cerr << "Maximum number of files in the destination directory: " << fMaxFileNum << G4endl; 
+	G4cerr << "  (Customizable with the environment variable: G4VRMLFILE_MAX_FILE_NUM) " << G4endl;
+	G4cerr << "===========================================" << G4endl; 
+
+	fDest.open(fVRMLFileName) ;  fFlagDestOpen =  true ;
+}
+
+
+void G4VRML1FileSceneHandler::closePort()
+{
+	char command[256] ;
+	char viewer [256] ; 
+	strcpy( viewer, NO_VRML_VIEWER ); // initialization
+	if( getenv( ENV_VRML_VIEWER ) ) {
+		strcpy( viewer, getenv( ENV_VRML_VIEWER ) ) ;
+	}
+
+	// close VRML file	
+	fDest.close();  fFlagDestOpen = false ;
+	G4cerr << "*** VRML 1.0 File  " << fVRMLFileName << "  is generated." << G4endl;
+
+	
+	// Invoke viewer 
+
+	if ( !strcmp(viewer, NO_VRML_VIEWER )) {
+		G4cerr << "MESSAGE from VRML1FILE driver:"     << G4endl;
+		G4cerr << "    Set an environmental variable  " ;
+		G4cerr <<      ENV_VRML_VIEWER << G4endl;
+		G4cerr << "    if you want to visualize the generated VRML file" << G4endl; 
+		G4cerr << "    automatically.  For example, " << G4endl;
+		G4cerr << "    setenv  " << ENV_VRML_VIEWER << "  vrweb " << G4endl;
+	} else {
+		sprintf( command, "%s %s", viewer, fVRMLFileName  );   
+		system( command );
+	}
+}
+
+G4int G4VRML1FileSceneHandler::fSceneIdCount = 0;
Index: tags/visualization-10.5-before-10.6_test/VRML/src/G4VRML1FileViewer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/VRML/src/G4VRML1FileViewer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/VRML/src/G4VRML1FileViewer.cc	(revision 1102)
@@ -0,0 +1,101 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VRML1FileViewer.cc,v 1.11 2006/06/29 21:25:59 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// G4VRMLView.cc
+// Satoshi Tanaka & Yasuhide Sawada
+
+
+//#define DEBUG_FR_VIEW
+
+#include "G4Scene.hh"
+#include "G4VRML1FileViewer.hh"
+#include "G4VRML1FileSceneHandler.hh"
+#include "G4VRML1File.hh"
+#include "G4ios.hh"
+
+G4VRML1FileViewer::G4VRML1FileViewer(G4VRML1FileSceneHandler& sceneHandler,
+				 const G4String& name) :
+  G4VViewer(sceneHandler,
+	    sceneHandler.IncrementViewCount(),
+	    name),
+  fSceneHandler(sceneHandler)
+{}
+
+G4VRML1FileViewer::~G4VRML1FileViewer()
+{}
+
+void G4VRML1FileViewer::SetView()
+{
+#if defined DEBUG_FR_VIEW
+  G4cerr << "***** G4VRML1FileViewer::SetView(): No effects" << G4endl;
+#endif
+}
+
+void G4VRML1FileViewer::DrawView()
+{
+#if defined DEBUG_FR_VIEW
+	G4cerr << "***** G4VRML1FileViewer::DrawView()" << G4endl;
+#endif
+
+	fSceneHandler.VRMLBeginModeling();
+
+	// Here is a minimal DrawView() function.
+	NeedKernelVisit();
+	ProcessView();
+	FinishView();
+}
+
+void G4VRML1FileViewer::ClearView(void)
+{
+  //#if defined DEBUG_FR_VIEW
+  G4cerr << "***** G4VRML1File1View::ClearView()" << G4endl;
+  //#endif
+  if(fSceneHandler.fFlagDestOpen) {
+    fSceneHandler.fDest.close();
+    // Re-open with same filename...
+    fSceneHandler.fDest.open(fSceneHandler.fVRMLFileName);
+    fSceneHandler.fDest << "#VRML V1.0 ascii" << "\n";
+    fSceneHandler.fDest << "# Generated by VRML 1.0 driver of GEANT4\n" << "\n";
+  }
+}
+
+void G4VRML1FileViewer::ShowView(void)
+{
+#if defined DEBUG_FR_VIEW
+  G4cerr << "***** G4VRML1FileViewer::ShowView()" << G4endl;
+#endif
+	fSceneHandler.VRMLEndModeling();
+}
+
+void G4VRML1FileViewer::FinishView(void)
+{
+#if defined DEBUG_FR_VIEW
+  G4cerr << "***** G4VRML1FileViewer::FinishView(): No effects" << G4endl;
+#endif
+}
Index: tags/visualization-10.5-before-10.6_test/VRML/src/G4VRML1SceneHandler.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/VRML/src/G4VRML1SceneHandler.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/VRML/src/G4VRML1SceneHandler.cc	(revision 1102)
@@ -0,0 +1,135 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VRML1SceneHandler.cc,v 1.10 2006/06/29 21:26:01 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// G4VRML1SceneHandler.cc
+// Yasuhide Sawada and Satoshi Tanaka
+
+#ifndef WIN32
+
+//=================//
+#ifdef G4VIS_BUILD_VRML_DRIVER
+//=================//
+
+
+//#define DEBUG_FR_SCENE
+
+#include <unistd.h>
+#include <fstream>
+
+#include "globals.hh"
+#include "G4VPhysicalVolume.hh"
+#include "G4LogicalVolume.hh"
+#include "G4Point3D.hh"
+#include "G4Scene.hh"
+#include "G4VisAttributes.hh"
+#include "G4Polyhedron.hh"
+#include "G4Box.hh"
+#include "G4Cons.hh"
+#include "G4Polyline.hh"
+#include "G4Trd.hh"
+#include "G4Tubs.hh"
+#include "G4Trap.hh"
+#include "G4Para.hh"
+#include "G4Torus.hh"
+#include "G4Sphere.hh"
+#include "G4Text.hh"
+#include "G4Circle.hh"
+#include "G4Square.hh"
+
+#include "G4VRML1SceneHandler.hh"
+#include "G4VRML1Viewer.hh"
+#include "G4VRML1.hh"
+
+
+
+G4VRML1SceneHandler::G4VRML1SceneHandler(G4VRML1& system, const G4String& name) :
+	G4VSceneHandler(system, fSceneIdCount++, name),
+	fSystem(system),
+	fDest()
+{
+	fCurrentDEF = "";
+}
+
+
+G4VRML1SceneHandler::~G4VRML1SceneHandler()
+{
+#if defined DEBUG_FR_SCENE
+	G4cerr << "***** ~G4VRML1SceneHandler" << G4endl;
+#endif 
+}
+
+
+
+#define  G4VRML1SCENEHANDLER  G4VRML1SceneHandler
+#define  IS_CONNECTED  fDest.isConnected() 
+#include "G4VRML1SceneHandlerFunc.icc"
+#undef   IS_CONNECTED
+#undef   G4VRML1SCENEHANDLER
+
+
+void G4VRML1SceneHandler::connectPort(G4int max_trial)
+{
+	G4int trial = 0 ;
+	int port = fSystem.getPort();
+	for (trial = 0; !fDest.isConnected()&& trial < max_trial; trial++, port++ ) {
+		if (fDest.connect( (const char * )fSystem.getHostName(), port)) {
+		    // INET domain connection is established
+			G4cerr << "*** GEANT4 is connected to port  ";
+			G4cerr << fDest.getPort(); 
+			G4cerr << " of server  " << fSystem.getHostName() << G4endl;
+			break; 
+		} else { 
+			// Connection failed. Try the next port.
+			G4cerr << "*** GEANT4 incremented targeting port to ";
+			G4cerr << port << G4endl;
+		}
+
+		sleep (1);
+
+	} // for
+
+	if (!fDest.isConnected()) {
+		G4cerr << "*** INET Connection failed. " << G4endl;
+		G4cerr << "    Maybe, you have not invoked viewer  g4vrmlview  yet, " << G4endl;
+		G4cerr << "    or too many viewers are already running in the " << G4endl;
+		G4cerr << "    server host(" << fSystem.getHostName() << "). " << G4endl;
+	}
+}
+
+void G4VRML1SceneHandler::closePort()
+{
+	fDest.close();
+	G4cerr << "*** INET Connection closed. " << G4endl;
+}
+
+
+G4int G4VRML1SceneHandler::fSceneIdCount = 0;
+
+#endif
+#endif
Index: tags/visualization-10.5-before-10.6_test/VRML/src/G4VRML1SceneHandlerFunc.icc
===================================================================
--- tags/visualization-10.5-before-10.6_test/VRML/src/G4VRML1SceneHandlerFunc.icc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/VRML/src/G4VRML1SceneHandlerFunc.icc	(revision 1102)
@@ -0,0 +1,674 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VRML1SceneHandlerFunc.icc,v 1.16 2006/06/29 21:26:03 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// G4VRML1SceneHandlerFunc.icc
+// Satoshi Tanaka & Yasuhide Sawada
+
+//#define DEBUG_SCENE_FUNC
+
+// MACRO
+#define ADDTHIS_WITH_NAME(Solid)	\
+	fCurrentDEF = #Solid "_" + Solid.GetName(); \
+	RequestPrimitives(Solid); \
+	fCurrentDEF = "";
+
+// End of MACRO
+
+void G4VRML1SCENEHANDLER::AddSolid(const G4Trd& trd)
+{
+#if defined DEBUG_SCENE_FUNC
+	G4cerr << "***** AddSolid trd" << "\n" ;
+#endif
+	VRMLBeginModeling () ;
+	ADDTHIS_WITH_NAME(trd)
+}
+
+void G4VRML1SCENEHANDLER::AddSolid(const G4Trap& trap)
+{
+#if defined DEBUG_SCENE_FUNC
+	G4cerr << "***** AddSolid trap" << "\n" ;
+#endif
+	VRMLBeginModeling () ;
+	ADDTHIS_WITH_NAME(trap)
+}
+
+void G4VRML1SCENEHANDLER::AddSolid(const G4Para& para)
+{
+#if defined DEBUG_SCENE_FUNC
+	G4cerr << "***** AddSolid para" << "\n" ;
+#endif
+	VRMLBeginModeling () ;
+	ADDTHIS_WITH_NAME(para)
+}
+
+void G4VRML1SCENEHANDLER::AddSolid(const G4Torus& torus )
+{
+#if defined DEBUG_SCENE_FUNC
+	G4cerr << "***** AddSolid torus" << "\n" ;
+#endif
+	VRMLBeginModeling () ;
+	ADDTHIS_WITH_NAME(torus)
+}
+
+
+void G4VRML1SCENEHANDLER::AddSolid(const G4VSolid& vsolid)
+{
+#if defined DEBUG_SCENE_FUNC
+	G4cerr << "***** AddSolid vsolid" << "\n" ;
+#endif
+	VRMLBeginModeling () ;
+	ADDTHIS_WITH_NAME(vsolid)
+}
+
+void G4VRML1SCENEHANDLER::AddSolid(const G4Tubs& tubs)
+{
+#if defined DEBUG_SCENE_FUNC
+	G4cerr << "***** AddSolid tubs" << "\n" ;
+#endif
+	VRMLBeginModeling () ;
+
+	// set current name
+	fCurrentDEF = "tubs_" + tubs.GetName();
+
+	// Get data
+	const G4double R  = tubs.GetRMax(); // outside radius
+	const G4double r  = tubs.GetRMin(); // inside radius
+	const G4double dz = tubs.GetDz();   // half length in z
+	const G4double dp = tubs.GetDPhi(); // angle interval
+
+	// Send data
+	if ( r == 0.0 && dp >= 360. * deg ) {
+		// Send a built-in VRML node (Cylinder)
+		fDest << "Separator {" << "\n";
+		SendMatrixTransformNode( fpObjectTransformation );
+
+		fDest << "\t" << "DEF " << fCurrentDEF << " Separator {" << "\n";
+		SendMaterialNode();
+		SendCylinderNode(R, dz * 2);
+		fDest << "\t" << "}" << "\n"; // DEF Separator
+		fDest << "}" << "\n"; // Separator
+	} else {
+		// call AddPrimitive(Polyhedron)
+		RequestPrimitives(tubs); 
+	}
+
+	// reset current name to null
+	fCurrentDEF = "";
+}
+
+
+void G4VRML1SCENEHANDLER::AddSolid(const G4Cons& cons)
+{
+#if defined DEBUG_SCENE_FUNC
+    G4cerr << "***** AddSolid cons" << "\n" ;
+#endif
+	VRMLBeginModeling () ;
+
+	// set current name
+	fCurrentDEF = "cons_" + cons.GetName();
+
+	// Get data
+	const G4double r1 = cons.GetRmin1(); // inside radius  at -dz
+	const G4double R1 = cons.GetRmax1(); // outside radius at -dz
+	const G4double r2 = cons.GetRmin2(); // inside radius  at +dz
+	const G4double R2 = cons.GetRmax2(); // outside radius at +dz
+	const G4double dz = cons.GetDz();    // half length in z
+	//const G4double sp = cons.GetSPhi();  // starting angle
+	const G4double dp = cons.GetDPhi();  // angle width
+
+	// Send data
+	if ( r1 == 0.0 && r2 == 0.0 && R1 == R2 && dp >= 360. * deg) {
+		// Send a built-in VRML node (Cylinder)
+		fDest << "Separator {" << "\n";
+		SendMatrixTransformNode( fpObjectTransformation );
+
+		fDest << "\t" << "DEF " << fCurrentDEF << " Separator {" << "\n";
+		SendMaterialNode();
+		SendCylinderNode(R1, dz * 2);
+		fDest << "\t" << "}" << "\n"; // DEF Separator
+		fDest << "}" << "\n"; // Separator
+	} else {
+		// call AddPrimitive(Polyhedron)
+		RequestPrimitives(cons); 
+	}
+
+	// reset current name to null
+	fCurrentDEF = "";
+}
+
+void G4VRML1SCENEHANDLER::AddSolid(const G4Box& box)
+{
+#if defined DEBUG_SCENE_FUNC
+	G4cerr << "***** AddSolid box" << "\n" ;
+#endif
+	VRMLBeginModeling () ;
+
+	// set current name
+	fCurrentDEF = "box_" + box.GetName();
+
+	// Send a built-in VRML node (Cube)
+	fDest << "Separator {" << "\n";
+
+	//fDest << "\t" << "renderCulling ON" << "\n";
+	SendMatrixTransformNode( fpObjectTransformation );
+
+	fDest << "\t" << "DEF " << fCurrentDEF << " Separator {" << "\n";
+	SendMaterialNode();
+	SendCubeNode(box.GetXHalfLength() * 2, box.GetYHalfLength() * 2, box.GetZHalfLength() * 2);
+	fDest << "\t" << "}" << "\n"; // DEF Separator
+
+	fDest << "}" << "\n"; // Separator
+
+	// reset current name to null
+	fCurrentDEF = "";
+}
+
+
+void G4VRML1SCENEHANDLER::AddSolid(const G4Sphere& sphere)
+{
+#if defined DEBUG_SCENE_FUNC
+	G4cerr << "***** AddSolid sphere" << "\n" ;
+#endif
+	VRMLBeginModeling () ;
+
+	// set current name
+	fCurrentDEF = "sphere_" + sphere.GetName();
+
+	// Get data
+	G4double  dphi   = sphere.GetDPhi  () ;
+	G4double  dtheta = sphere.GetDTheta() ;
+	G4double  rmax   = sphere.GetRmax  () ;
+	G4double  rmin   = sphere.GetRmin  () ;
+
+	// Send data
+	if ( (dphi >= 360. * deg) && (dtheta >= 180. * deg) && (rmin == 0.0)  ) {
+		// Send a built-in VRML node (Sphere)
+		fDest << "Separator {" << "\n";
+		SendMatrixTransformNode( fpObjectTransformation );
+
+		fDest << "\t" << "DEF " << fCurrentDEF << " Separator {" << "\n";
+		SendMaterialNode();
+		SendSphereNode( rmax );
+		fDest << "\t" << "}" << "\n"; // DEF Separator
+		fDest << "}" << "\n"; // Separator
+	} else {
+			// call AddPrimitive(Polyhedron)
+			RequestPrimitives( sphere ); 
+	}
+
+	// reset current name to null
+	fCurrentDEF = "";
+}
+
+void G4VRML1SCENEHANDLER::AddPrimitive(const G4Polyline& polyline)
+{
+#if defined DEBUG_SCENE_FUNC
+	G4cerr << "***** AddPrimitive polyline" << "\n" ;
+#endif 
+	VRMLBeginModeling () ;	
+
+	fDest << "Separator {" << "\n";
+
+	SendMatrixTransformNode (fpObjectTransformation );
+
+	SendMaterialNode( polyline.GetVisAttributes() );
+
+	fDest << "\t" << "Coordinate3 {" << "\n";
+	fDest << "\t\t" << "point [" << "\n";
+	G4int e, i;
+	for (i = 0, e = polyline.size(); e; i++, e--) {
+		fDest << "\t\t\t";
+		fDest << polyline[i].x() << " ";
+		fDest << polyline[i].y() << " ";
+		fDest << polyline[i].z() << "," << "\n";
+	}
+	fDest << "\t\t" << "]" << "\n";
+	fDest << "\t" << "}" << "\n"; // Coordinate3
+
+	fDest << "\t" << "IndexedLineSet {" << "\n";
+	fDest << "\t\t" << "coordIndex [";
+	for (i = 0, e = polyline.size(); e; i++, e--) {
+		if (i % 10 == 0)
+			fDest << "\n" << "\t\t\t";
+		fDest << i << ", ";
+	}
+	fDest << "-1" << "\n";
+	fDest << "\t\t" << "]" << "\n";
+	fDest << "\t" << "}" << "\n"; // IndexedLineSet
+
+	fDest << "}" << "\n"; // Separator
+}
+
+void G4VRML1SCENEHANDLER::AddPrimitive(const G4Polyhedron& polyhedron)
+{
+#if defined DEBUG_SCENE_FUNC
+	G4cerr << "***** AddPrimitive(G4Polyhedron)" << "\n";
+#endif
+
+	if (polyhedron.GetNoFacets() == 0) return;
+
+	VRMLBeginModeling () ;
+
+	fDest << "Separator {" << "\n";
+
+	SendMatrixTransformNode( fpObjectTransformation );
+
+	fDest << "\t";
+	if (fCurrentDEF != "")
+		fDest << "DEF " << fCurrentDEF << " ";
+
+	fDest << "Separator {" << "\n";
+
+	//fDest << "\t\t" << "renderCulling ON" << "\n";
+
+	fDest << "\t\t" << "ShapeHints {" << "\n";
+	fDest << "\t\t\t" << "vertexOrdering COUNTERCLOCKWISE" << "\n";
+	fDest << "\t\t\t" << "shapeType SOLID" << "\n";
+	fDest << "\t\t\t" << "faceType CONVEX" << "\n";
+	fDest << "\t\t" << "}" << "\n";
+
+	SendMaterialNode();
+
+	fDest << "\t\t" << "Coordinate3 {" << "\n";
+	fDest << "\t\t\t" << "point [" << "\n";
+	G4int i, j;
+	for (i = 1, j = polyhedron.GetNoVertices(); j; j--, i++) {
+		G4Point3D point = polyhedron.GetVertex(i);
+		fDest << "\t\t\t\t";
+		fDest << point.x() << " ";
+		fDest << point.y() << " ";
+		fDest << point.z() << "," << "\n";
+	}
+	fDest << "\t\t\t" << "]" << "\n";
+	fDest << "\t\t" << "}" << "\n"; // Coordinate3
+
+	fDest << "\t\t" << "IndexedFaceSet {" << "\n";
+	fDest << "\t\t\t" << "coordIndex [" << "\n";
+
+	// facet loop
+	G4int f;
+	for (f = polyhedron.GetNoFacets(); f; f--) {
+
+		// edge loop  
+		G4bool notLastEdge;
+		G4int index = -1, edgeFlag = 1;
+		fDest << "\t\t\t\t";
+		do {
+			notLastEdge = polyhedron.GetNextVertexIndex(index, edgeFlag);
+			fDest << index - 1 << ", ";
+		} while (notLastEdge);
+		fDest << "-1," << "\n";
+	}
+	fDest << "\t\t\t" << "]" << "\n";
+	fDest << "\t\t" << "}" << "\n"; // IndexFaceSet
+
+	fDest << "\t" << "}" << "\n"; // (DEF) Separator
+	fDest << "}" << "\n"; // Separator
+
+}
+
+
+void G4VRML1SCENEHANDLER::AddPrimitive(const G4NURBS&)
+{
+#if defined DEBUG_SCENE_FUNC
+	G4cerr << "***** AddPrimitive nurbs" << "\n" ;
+#endif 
+	G4cerr << "G4VRML1File::AddPrimitive(G4NURBS&): not implemented. " << "\n" ;
+	VRMLBeginModeling () ;
+
+}
+
+void G4VRML1SCENEHANDLER::AddPrimitive( const G4Text& ) 
+{
+#if defined DEBUG_SCENE_FUNC
+	G4cerr << "***** AddPrimitive text" << "\n" ;
+#endif
+	G4cerr <<
+          "***** void G4VRML1SCENEHANDLER::AddPrimitive( const G4Text& text )"
+          " not implemented yet."
+             << "\n";
+
+	VRMLBeginModeling () ;
+}
+
+void G4VRML1SCENEHANDLER::AddPrimitive( const G4Circle& circle ) 
+{
+#if defined DEBUG_SCENE_FUNC
+	G4cerr << "***** AddPrimitive circle" << "\n" ;
+#endif
+
+	VRMLBeginModeling () ;
+
+	// begin sending a mark
+	fDest << "Separator {" << "\n";
+
+	// send color 
+	SendMarkerColor    ( circle ) ;
+
+	// position 
+	SendMarkerWorldPosition ( circle ) ;
+
+	// Calc size 
+	G4double size = GetMarkerHalfSize ( circle );
+
+	// send shape with size 
+	fDest << "\t" << "Sphere {" << "\n";
+	fDest << "\t\t" << "radius " << size << "\n";
+	fDest << "\t" << "}" << "\n";
+
+	// end sending a mark
+	fDest << "}" << "\n"; // Separator
+}
+
+
+void G4VRML1SCENEHANDLER::AddPrimitive(const G4Square& square)
+{
+#if defined DEBUG_SCENE_FUNC
+	G4cerr << "***** AddPrimitive square" << "\n" ;
+#endif
+
+	VRMLBeginModeling () ;
+
+	// begin sending a mark
+	fDest << "Separator {" << "\n";
+
+	// send color 
+	SendMarkerColor    ( square );
+
+	// position 
+	SendMarkerWorldPosition ( square );
+
+	// Calc size 
+	G4double size = GetMarkerHalfSize ( square );
+	size *= 2.;
+
+	// send shape with size 
+	fDest << "\t" << "Cube {" << "\n";
+	fDest << "\t\t" << "width "  << size << "\n";
+	fDest << "\t\t" << "height " << size << "\n";
+	fDest << "\t\t" << "depth "  << size << "\n";
+	fDest << "\t" << "}" << "\n";
+
+	// end sending a mark
+	fDest << "}" << "\n"; // Separator
+}
+
+void G4VRML1SCENEHANDLER::BeginModeling()
+{
+#if defined DEBUG_SCENE_FUNC
+	G4cerr << "***** BeginModeling " << "\n" ;
+#endif
+	G4VSceneHandler::BeginModeling();
+}
+
+void G4VRML1SCENEHANDLER::EndModeling()
+{
+#if defined DEBUG_SCENE_FUNC
+	G4cerr << "***** EndModeling " << "\n" ;
+#endif
+	G4VSceneHandler::EndModeling();
+}
+
+void G4VRML1SCENEHANDLER::BeginPrimitives(const G4Transform3D& objectTransformation)
+{
+  G4VSceneHandler::BeginPrimitives (objectTransformation);
+  fpObjectTransformation = &objectTransformation;
+#if defined DEBUG_SCENE_FUNC
+	G4cerr << "***** BeginPrimitives " << "\n" ;
+#endif
+	VRMLBeginModeling();
+}
+
+void G4VRML1SCENEHANDLER::EndPrimitives()
+{
+#if defined DEBUG_SCENE_FUNC
+	G4cerr << "***** EndPrimitives " << "\n" ;
+#endif
+  G4VSceneHandler::EndPrimitives();
+}
+
+void G4VRML1SCENEHANDLER::SendMaterialNode( const G4VisAttributes*  pVA )
+{
+//	const double TRANSPARENCY = 0.9 ; 
+	const double TRANSPARENCY = 0.5 ; 
+
+	if (!pVA)
+		return;
+
+	const G4Color& color = pVA->GetColor();
+
+	fDest << "\t\t" << "Material {" << "\n";
+
+	if (pVA->IsForceDrawingStyle() &&
+	   (pVA->GetForcedDrawingStyle() == G4VisAttributes::wireframe)) {
+		fDest << "\t\t\t" << "transparency " << TRANSPARENCY << "\n";
+	}
+
+	fDest << "\t\t\t" << "diffuseColor";
+	fDest << " " << color.GetRed();
+	fDest << " " << color.GetGreen();
+	fDest << " " << color.GetBlue();
+	fDest << "\n";
+	fDest << "\t\t" << "}" << "\n";
+}
+
+
+void G4VRML1SCENEHANDLER::SendMaterialNode()
+{
+	SendMaterialNode
+	( fpViewer->GetApplicableVisAttributes (fpVisAttribs) );
+}
+
+
+void G4VRML1SCENEHANDLER::SendMatrixTransformNode(const G4Transform3D *trans)
+{
+	G4Point3D  B  (0.0, 0.0, 0.0);
+
+	G4Point3D  x1 (1.0, 0.0, 0.0);
+	G4Point3D  y1 (0.0, 1.0, 0.0);
+
+	G4Vector3D e1 (1.0, 0.0, 0.0);
+	G4Vector3D e2 (0.0, 1.0, 0.0);
+	G4Vector3D e3 (0.0, 0.0, 1.0);
+
+		//----- transformed origin of body coord
+	B.transform(*trans);
+
+		//----- transformed base vectors of body coord
+	x1.transform(*trans);
+	e1 = x1 - B;
+
+	y1.transform(*trans);
+ 	e2 = y1 - B;
+
+	e3 = e1.cross(e2);
+
+	e1 = e1.unit(); // normalize again for accuracy
+	e2 = e2.unit(); //
+	e3 = e3.unit(); //
+
+	fDest << "\t" << "MatrixTransform {" << "\n";
+	fDest << "\t\t" << "matrix ";
+	fDest << e1.x() << " " << e1.y() << " " << e1.z() << " 0 ";
+	fDest << e2.x() << " " << e2.y() << " " << e2.z() << " 0 ";
+	fDest << e3.x() << " " << e3.y() << " " << e3.z() << " 0 ";
+	fDest << B.x()  << " " << B.y()  << " " << B.z()  << " 1" << "\n";
+	fDest << "\t" << "}" << "\n";
+}
+
+void G4VRML1SCENEHANDLER::SendCubeNode(G4double w, G4double h, G4double d)
+{
+	fDest << "\t\t" << "Cube {" << "\n";
+	fDest << "\t\t\t" << "width "  << w << "\n";
+	fDest << "\t\t\t" << "height " << h << "\n";
+	fDest << "\t\t\t" << "depth "  << d << "\n";
+	fDest << "\t\t" << "}" << "\n";
+}
+
+void G4VRML1SCENEHANDLER::SendCylinderNode(G4double R, G4double h)
+{
+	fDest << "\t\t" << "Transform {" << "\n";
+	fDest << "\t\t\t" << "rotation 1 0 0 " << (90. * deg) << "\n";
+	fDest << "\t\t" << "}" << "\n";
+
+	fDest << "\t\t" << "Cylinder {" << "\n";
+	fDest << "\t\t\t" << "radius " << R << "\n";
+	fDest << "\t\t\t" << "height " << h << "\n";
+	fDest << "\t\t" << "}" << "\n";
+}
+
+void G4VRML1SCENEHANDLER::SendSphereNode(G4double R)
+{
+	fDest << "\t\t" << "Sphere {" << "\n";
+	fDest << "\t\t\t" << "radius " << R << "\n";
+	fDest << "\t\t" << "}" << "\n";
+}
+
+void G4VRML1SCENEHANDLER::VRMLBeginModeling()
+{
+	if (!IS_CONNECTED ) {
+#if defined DEBUG_SCENE_FUNC
+	G4cerr << "***** VRMLBeginModeling() (started)" << "\n" ;
+#endif
+		this->connectPort();
+		fDest << "#VRML V1.0 ascii" << "\n";
+		fDest << "# Generated by VRML 1.0 driver of GEANT4\n" << "\n";
+	}
+}
+
+void G4VRML1SCENEHANDLER::VRMLEndModeling()
+{
+	if ( IS_CONNECTED ) {
+#if defined DEBUG_SCENE_FUNC
+	G4cerr << "***** VRMLEndModeling() (started)" << "\n" ;
+#endif
+
+		fDest << "#End of file." << "\n";
+		this->closePort();
+	}
+}
+
+void      G4VRML1SCENEHANDLER::SendMarkerColor ( const G4VMarker& mark ) 
+{
+	const G4Color& color = GetColor( mark );
+
+	fDest << "\t" << "Material {" << "\n";
+	fDest << "\t\t";
+	fDest << "ambientColor [] ";
+	fDest << "specularColor [] ";
+	fDest << "\t\t" << "diffuseColor";
+	fDest << " " << color.GetRed();
+	fDest << " " << color.GetGreen();
+	fDest << " " << color.GetBlue();
+	fDest << "\n";
+	fDest << "\t\t" << "emissiveColor";
+	fDest << " " << color.GetRed();
+	fDest << " " << color.GetGreen();
+	fDest << " " << color.GetBlue();
+	fDest << "\n";
+	fDest << "\t" << "}" << "\n";
+}
+
+void      
+G4VRML1SCENEHANDLER::SendMarkerWorldPosition ( const G4VMarker& mark )
+{
+	G4Point3D point = mark.GetPosition();
+
+	SendMatrixTransformNode( fpObjectTransformation );
+
+	fDest << "\t\t" << "Transform {" << "\n";
+	fDest << "\t\t\t" << "translation ";
+	fDest << point.x() << " " << point.y() << " " << point.z() << "\n";
+	fDest << "\t\t" << "}" << "\n" ;
+}
+
+
+G4double  G4VRML1SCENEHANDLER::GetMarkerHalfSize ( const G4VMarker& mark ) 
+{
+	//----- return value ( marker radius in 3d units) 
+	G4double size       = 1.0 ; // initialization
+
+	//----- parameters to calculate 3d size from 2d size
+	const double HALF_SCREEN_SIZE_2D = 300.0 ; // pixels
+	double zoom_factor  = fpViewer->GetViewParameters().GetZoomFactor() ;
+	if ( zoom_factor <=  0.0 ) { zoom_factor = 1.0 ; }
+	double extent_radius_3d = GetScene()->GetExtent().GetExtentRadius() ;
+	if ( extent_radius_3d <= 0.0 ) { extent_radius_3d = 1.0 ; } 
+
+	//----- get marker radius in 3D units
+	if        ( mark.GetWorldSize() > 0.0 ) {
+		// get mark radius in 3D units
+		size = 0.5 * mark.GetWorldSize()  ; 
+
+	} else if ( mark.GetScreenSize() > 0.0 ) {
+		// local
+		double mark_radius_2d   = 0.5 * mark.GetScreenSize() ;
+
+		// get mark radius in 3D units
+		size \
+		 = extent_radius_3d * ( mark_radius_2d / HALF_SCREEN_SIZE_2D );
+		size *= zoom_factor ;
+
+	} else {
+		// local
+		double mark_radius_2d \
+		 = fpViewer->GetViewParameters().GetDefaultMarker().GetScreenSize();
+		mark_radius_2d *= 0.1 ; // Magic number?
+
+		// get mark radius in 3D units
+		size \
+		 = extent_radius_3d * ( mark_radius_2d / HALF_SCREEN_SIZE_2D );
+		size *= zoom_factor ;
+	}
+
+		//----- global rescaling
+	size *= fpViewer->GetViewParameters().GetGlobalMarkerScale(); 
+
+		//----- return size
+	return size ;
+
+} 
+
+void G4VRML1SCENEHANDLER::ClearTransientStore() 
+{
+  G4VSceneHandler::ClearTransientStore ();
+  // This is typically called after an update and before drawing hits
+  // of the next event.  To simulate the clearing of "transients"
+  // (hits, etc.) the detector is redrawn...
+  if (fpViewer) {
+    fpViewer -> SetView ();
+    fpViewer -> ClearView ();
+    fpViewer -> DrawView ();
+  }
+}
+
+
+// #undef ADDTHIS_WITH_NAME(Solid)
+// #undef MAKE_NAME(Solid)
+// End of file.
Index: tags/visualization-10.5-before-10.6_test/VRML/src/G4VRML1Viewer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/VRML/src/G4VRML1Viewer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/VRML/src/G4VRML1Viewer.cc	(revision 1102)
@@ -0,0 +1,99 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VRML1Viewer.cc,v 1.8 2006/06/29 21:26:05 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// G4VRMLView.cc
+// Yasuhide Sawada & Satoshi Tanaka
+
+#ifndef WIN32
+
+//=================//
+#ifdef G4VIS_BUILD_VRML_DRIVER
+//=================//
+
+
+//#define DEBUG_FR_VIEW
+
+#include "G4Scene.hh"
+#include "G4VRML1Viewer.hh"
+#include "G4VRML1SceneHandler.hh"
+#include "G4VRML1.hh"
+#include "G4ios.hh"
+
+G4VRML1Viewer::G4VRML1Viewer(G4VRML1SceneHandler& scene, const G4String& name) :
+   G4VViewer(scene, scene.IncrementViewCount(), name), fSceneHandler(scene)
+{}
+
+G4VRML1Viewer::~G4VRML1Viewer()
+{}
+
+void G4VRML1Viewer::SetView()
+{
+#if defined DEBUG_FR_VIEW
+  G4cerr << "***** G4VRML1Viewer::SetView(): No effects" << G4endl;
+#endif
+}
+
+void G4VRML1Viewer::DrawView()
+{
+#if defined DEBUG_FR_VIEW
+	G4cerr << "***** G4VRML1Viewer::DrawView()" << G4endl;
+#endif
+
+	fSceneHandler.VRMLBeginModeling();
+
+	// Here is a minimal DrawView() function.
+	NeedKernelVisit();
+	ProcessView();
+	FinishView();
+}
+
+void G4VRML1Viewer::ClearView(void)
+{
+#if defined DEBUG_FR_VIEW
+  G4cerr << "***** G4VRML1Viewer::ClearView(): No effects" << G4endl;
+#endif
+}
+
+void G4VRML1Viewer::ShowView(void)
+{
+#if defined DEBUG_FR_VIEW
+  G4cerr << "***** G4VRML1Viewer::ShowView()" << G4endl;
+#endif
+	fSceneHandler.VRMLEndModeling();
+}
+
+void G4VRML1Viewer::FinishView(void)
+{
+#if defined DEBUG_FR_VIEW
+  G4cerr << "***** G4VRML1Viewer::FinishView(): No effects" << G4endl;
+#endif
+}
+
+#endif
+#endif //WIN32
Index: tags/visualization-10.5-before-10.6_test/VRML/src/G4VRML2.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/VRML/src/G4VRML2.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/VRML/src/G4VRML2.cc	(revision 1102)
@@ -0,0 +1,95 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VRML2.cc,v 1.10 2006/06/29 21:26:07 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// G4VRML2.cc
+// Satoshi Tanaka & Yasuhide Sawada
+
+#ifndef WIN32
+
+//=================//
+#ifdef G4VIS_BUILD_VRML_DRIVER
+//=================//
+
+
+#include <stdio.h> // sscanf
+#include <stdlib.h> // getenv
+
+#include "G4VSceneHandler.hh"
+
+#include "G4VRML2.hh"
+#include "G4VRML2SceneHandler.hh"
+#include "G4VRML2Viewer.hh"
+
+#include "G4FRClient.hh"
+
+
+G4VRML2::G4VRML2() :
+	G4VGraphicsSystem("VRML2", "VRML2", G4VGraphicsSystem::threeD)
+{
+	// port number
+	fPort = FR_VRML_DEFAULT_PORT;
+	char *pport = getenv(FR_VRML_PORT_ENV);
+	if (pport) {
+		sscanf(pport, "%d", &fPort);
+	}
+
+	// host name
+	fHostName = "localhost" ; // G4String::operator = ( const char* cs )
+	char *phostname =  getenv(FR_VRML_HOST_NAME_ENV); 
+	if (phostname) {
+		fHostName = phostname;
+	}
+}
+
+G4VRML2::~G4VRML2()
+{
+}
+
+
+G4VSceneHandler* G4VRML2::CreateSceneHandler(const G4String& name) 
+{
+	G4VSceneHandler *p = NULL;
+
+	p = new G4VRML2SceneHandler(*this, name);
+
+	return p;
+}
+
+G4VViewer* G4VRML2::CreateViewer(G4VSceneHandler& scene, const G4String& name)
+{
+	G4VViewer* pView = NULL;
+
+	G4VRML2SceneHandler* pScene = (G4VRML2SceneHandler*)&scene;
+	pView = new G4VRML2Viewer(*pScene, name);
+
+	return pView;
+}
+
+#endif
+#endif //WIN32
Index: tags/visualization-10.5-before-10.6_test/VRML/src/G4VRML2File.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/VRML/src/G4VRML2File.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/VRML/src/G4VRML2File.cc	(revision 1102)
@@ -0,0 +1,72 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VRML2File.cc,v 1.10 2006/06/29 21:26:09 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// G4VRML2File.cc
+// Satoshi Tanaka & Yasuhide Sawada
+
+#include <stdio.h> // sscanf
+#include <stdlib.h> // getenv
+
+#include "G4VSceneHandler.hh"
+
+#include "G4VRML2File.hh"
+#include "G4VRML2FileSceneHandler.hh"
+#include "G4VRML2FileViewer.hh"
+
+#include "G4FRClient.hh"
+
+
+G4VRML2File::G4VRML2File() :
+	G4VGraphicsSystem("VRML2FILE", "VRML2FILE", G4VGraphicsSystem::threeD)
+{
+}
+
+G4VRML2File::~G4VRML2File()
+{
+}
+
+
+G4VSceneHandler* G4VRML2File::CreateSceneHandler(const G4String& name) 
+{
+	G4VSceneHandler *p = NULL;
+
+	p = new G4VRML2FileSceneHandler(*this, name);
+
+	return p;
+}
+
+G4VViewer* G4VRML2File::CreateViewer(G4VSceneHandler& scene, const G4String& name)
+{
+	G4VViewer* pView = NULL;
+
+	G4VRML2FileSceneHandler* pScene = (G4VRML2FileSceneHandler*)&scene;
+	pView = new G4VRML2FileViewer(*pScene, name);
+
+	return pView;
+}
Index: tags/visualization-10.5-before-10.6_test/VRML/src/G4VRML2FileSceneHandler.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/VRML/src/G4VRML2FileSceneHandler.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/VRML/src/G4VRML2FileSceneHandler.cc	(revision 1102)
@@ -0,0 +1,221 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VRML2FileSceneHandler.cc,v 1.14 2006/06/29 21:26:11 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// G4VRML2FileSceneHandler.cc
+// Satoshi Tanaka & Yasuhide Sawada
+
+
+//#define DEBUG_FR_SCENE
+
+#include <fstream>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <cmath>
+
+#include "globals.hh"
+#include "G4VPhysicalVolume.hh"
+#include "G4LogicalVolume.hh"
+#include "G4Point3D.hh"
+#include "G4VisAttributes.hh"
+#include "G4VModel.hh"
+#include "G4Scene.hh"
+#include "G4Polyhedron.hh"
+#include "G4Box.hh"
+#include "G4Cons.hh"
+#include "G4Polyline.hh"
+#include "G4Trd.hh"
+#include "G4Tubs.hh"
+#include "G4Text.hh"
+#include "G4Circle.hh"
+#include "G4Square.hh"
+
+#include "G4VRML2FileSceneHandler.hh"
+#include "G4VRML2FileViewer.hh"
+#include "G4VRML2File.hh"
+
+// CONST
+
+const char  WRL_FILE_HEADER      [] = "g4_";
+const char  DEFAULT_WRL_FILE_NAME[] = "g4.wrl";
+const char  ENV_VRML_VIEWER      [] = "G4VRMLFILE_VIEWER";
+const char  NO_VRML_VIEWER       [] = "NONE";
+const char  VRMLFILE_DEST_DIR    [] = "G4VRMLFILE_DEST_DIR";
+const int   DEFAULT_MAX_WRL_FILE_NUM = 100 ;
+
+
+G4VRML2FileSceneHandler::G4VRML2FileSceneHandler(G4VRML2File& system, const G4String& name) :
+	G4VSceneHandler(system, fSceneIdCount++, name),
+	fSystem(system),
+	fFlagDestOpen( false ),
+	fPVPickable  ( false ),
+        fDest()
+{
+	// output file name
+	strcpy(fVRMLFileName, "");
+
+	// destination directory
+	if ( getenv( VRMLFILE_DEST_DIR ) == NULL ) {
+		strcpy( fVRMLFileDestDir, "" );
+	} else {
+		strcpy( fVRMLFileDestDir, getenv( VRMLFILE_DEST_DIR ) );
+	}
+
+
+	// maximum number of g4.prim files in the dest directory
+	fMaxFileNum = DEFAULT_MAX_WRL_FILE_NUM ; // initialization
+	if ( getenv( "G4VRMLFILE_MAX_FILE_NUM" ) != NULL ) {	
+		
+		sscanf( getenv("G4VRMLFILE_MAX_FILE_NUM"), "%d", &fMaxFileNum ) ;
+
+	} else {
+		fMaxFileNum = DEFAULT_MAX_WRL_FILE_NUM ;
+	}
+	if( fMaxFileNum < 1 ) { fMaxFileNum = 1; }
+
+
+	// PV name pickability 	
+	if( getenv( "G4VRML_PV_PICKABLE" ) != NULL ) {
+
+		int is_pickable ;
+		sscanf( getenv("G4VRML_PV_PICKABLE"), "%d", &is_pickable ) ;
+
+		if ( is_pickable ) { SetPVPickability ( true ) ; }
+	} 
+
+	// PV Transparency
+	SetPVTransparency ();
+
+}
+
+
+G4VRML2FileSceneHandler::~G4VRML2FileSceneHandler()
+{
+#if defined DEBUG_FR_SCENE
+	G4cerr << "***** ~G4VRML2FileSceneHandler" << G4endl;
+#endif 
+	VRMLEndModeling();
+}
+
+
+#define  G4VRML2SCENEHANDLER   G4VRML2FileSceneHandler
+#define  IS_CONNECTED   this->isConnected() 
+#include "G4VRML2SceneHandlerFunc.icc"
+#undef   IS_CONNECTED
+#undef   G4VRML2SCENEHANDLER
+
+
+void G4VRML2FileSceneHandler::connectPort()
+{
+	// g4_00.wrl, g4_01.wrl, ..., g4_MAX_FILE_INDEX.wrl
+	const int MAX_FILE_INDEX = fMaxFileNum - 1 ;
+
+	// dest directory (null if no environmental variables is set)
+	strcpy ( fVRMLFileName, fVRMLFileDestDir) ; 
+
+	// create full path name (default)
+	strcat ( fVRMLFileName, DEFAULT_WRL_FILE_NAME );
+
+	// Determine VRML file name
+	for( int i = 0 ; i < fMaxFileNum ; i++) { 
+
+		// Message in the final execution
+		if( i == MAX_FILE_INDEX ) 
+		{
+		  G4cerr << "==========================================="   << G4endl; 
+		  G4cerr << "WARNING MESSAGE from VRML2FILE driver:     "   << G4endl;
+		  G4cerr << "  This file name is the final one in the   "   << G4endl;
+		  G4cerr << "  automatic updation of the output file name." << G4endl; 
+		  G4cerr << "  You may overwrite existing files, i.e.   "   << G4endl; 
+                  G4cerr << "  g4_XX.wrl.                               "   << G4endl;
+		  G4cerr << "==========================================="   << G4endl; 
+		}
+
+		// re-determine file name as G4VRMLFILE_DEST_DIR/g4_XX.wrl 
+		if( i >=  0 && i <= 9 ) { 
+			sprintf( fVRMLFileName, "%s%s%s%d.wrl" , fVRMLFileDestDir,  WRL_FILE_HEADER, "0", i );
+		} else {
+			sprintf( fVRMLFileName, "%s%s%d.wrl"   , fVRMLFileDestDir,  WRL_FILE_HEADER, i );
+		}
+
+		// check validity of the file name
+		std::ifstream  fin ; 
+		fin.open(fVRMLFileName) ;
+		if(!fin) { 
+			// new file	
+			fin.close();  
+			break; 
+		} else { 
+			// already exists (try next) 
+			fin.close(); 
+		} 
+
+	} // for 
+
+	// open a VRML 2.0 file with determined file name
+	G4cerr << "==========================================="  << G4endl; 
+	G4cerr << "Output VRML 2.0 file: " <<    fVRMLFileName << G4endl; 
+	G4cerr << "Maximum number of files in the destination directory: " << fMaxFileNum << G4endl; 
+	G4cerr << "  (Customizable with the environment variable: G4VRMLFILE_MAX_FILE_NUM) " << G4endl;
+	G4cerr << "===========================================" << G4endl; 
+
+	fDest.open(fVRMLFileName) ;  fFlagDestOpen =  true ;
+}
+
+
+void G4VRML2FileSceneHandler::closePort()
+{
+	char command[256] ;
+	char viewer [256] ; 
+	strcpy( viewer, NO_VRML_VIEWER ); // initialization
+	if( getenv( ENV_VRML_VIEWER ) ) {
+		strcpy( viewer, getenv( ENV_VRML_VIEWER ) ) ;
+	}
+
+	// close VRML file	
+	fDest.close();  fFlagDestOpen = false ;
+	G4cerr << "*** VRML 2.0 File  " << fVRMLFileName << "  is generated." << G4endl;
+
+	
+	// Invoke viewer 
+
+	if ( !strcmp(viewer, NO_VRML_VIEWER )) {
+		G4cerr << "MESSAGE from VRML2FILE driver:"     << G4endl;
+		G4cerr << "    Set an environmental variable  " ;
+		G4cerr <<      ENV_VRML_VIEWER << G4endl;
+		G4cerr << "    if you want to visualize the generated VRML file" << G4endl; 
+		G4cerr << "    automatically.  For example, " << G4endl;
+		G4cerr << "    setenv  " << ENV_VRML_VIEWER << "  vrwave " << G4endl;
+	} else {
+		sprintf( command, "%s %s", viewer, fVRMLFileName  );   
+		system( command );
+	}
+}
+
+G4int G4VRML2FileSceneHandler::fSceneIdCount = 0;
Index: tags/visualization-10.5-before-10.6_test/VRML/src/G4VRML2FileViewer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/VRML/src/G4VRML2FileViewer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/VRML/src/G4VRML2FileViewer.cc	(revision 1102)
@@ -0,0 +1,151 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VRML2FileViewer.cc,v 1.13 2006/06/29 21:26:13 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// G4VRML2FileViewer.cc
+// Satoshi Tanaka & Yasuhide Sawada
+
+
+//#define DEBUG_FR_VIEW
+
+#include <cmath>
+
+#include "G4Scene.hh"
+#include "G4VRML2FileViewer.hh"
+#include "G4VRML2FileSceneHandler.hh"
+#include "G4VRML2File.hh"
+#include "G4ios.hh"
+
+G4VRML2FileViewer::G4VRML2FileViewer(G4VRML2FileSceneHandler& sceneHandler,
+				 const G4String& name) :
+ G4VViewer(sceneHandler,
+	   sceneHandler.IncrementViewCount(),
+	   name),
+ fSceneHandler(sceneHandler),
+ fDest(sceneHandler.fDest)
+{
+	fViewHalfAngle = 0.5 * 0.785398 ; // 0.5 * 45*deg
+	fsin_VHA       = std::sin ( fViewHalfAngle ) ;	
+}
+
+G4VRML2FileViewer::~G4VRML2FileViewer()
+{}
+
+void G4VRML2FileViewer::SetView()
+{
+#if defined DEBUG_FR_VIEW
+  G4cerr << "***** G4VRML2FileViewer::SetView(): No effects" << G4endl;
+#endif
+
+// Do nothing, since VRML a browser is running as a different process.
+// SendViewParameters () will do this job instead.
+
+}
+
+void G4VRML2FileViewer::DrawView()
+{
+#if defined DEBUG_FR_VIEW
+	G4cerr << "***** G4VRML2FileViewer::DrawView()" << G4endl;
+#endif
+
+	fSceneHandler.VRMLBeginModeling() ; 
+
+        // Viewpoint node
+        SendViewParameters(); 
+
+	// Here is a minimal DrawView() function.
+	NeedKernelVisit();
+	ProcessView();
+	FinishView();
+}
+
+void G4VRML2FileViewer::ClearView(void)
+{
+#if defined DEBUG_FR_VIEW
+  G4cerr << "***** G4VRML2File1View::ClearView()" << G4endl;
+#endif
+  if(fSceneHandler.fFlagDestOpen) {
+    fSceneHandler.fDest.close();
+    // Re-open with same filename...
+    fSceneHandler.fDest.open(fSceneHandler.fVRMLFileName);
+    fSceneHandler.fDest << "#VRML V2.0 utf8" << "\n";
+    fSceneHandler.fDest << "# Generated by VRML 2.0 driver of GEANT4\n" << "\n";
+  }
+}
+
+void G4VRML2FileViewer::ShowView(void)
+{
+#if defined DEBUG_FR_VIEW
+  G4cerr << "***** G4VRML2FileViewer::ShowView()" << G4endl;
+#endif
+	fSceneHandler.VRMLEndModeling();
+}
+
+void G4VRML2FileViewer::FinishView(void)
+{
+#if defined DEBUG_FR_VIEW
+  G4cerr << "***** G4VRML2FileViewer::FinishView(): No effects" << G4endl;
+#endif
+}
+
+void G4VRML2FileViewer::SendViewParameters () 
+{
+  // Calculates view representation based on extent of object being
+  // viewed and (initial) direction of camera.  (Note: it can change
+  // later due to user interaction via visualization system's GUI.)
+
+#if defined DEBUG_FR_VIEW
+      G4cerr << "***** G4VRML2FileViewer::SendViewParameters()\n";
+#endif 
+
+	// error recovery
+	if ( fsin_VHA < 1.0e-6 ) { return ; } 
+
+	// camera distance
+	G4double extent_radius = fSceneHandler.GetScene()->GetExtent().GetExtentRadius();
+	G4double camera_distance = extent_radius / fsin_VHA ;
+
+	// camera position on Z axis
+	const G4Point3D&	target_point
+	  = fSceneHandler.GetScene()->GetStandardTargetPoint()
+	  + fVP.GetCurrentTargetPoint();
+	G4double		E_z = target_point.z() + camera_distance;
+	G4Point3D		E(0.0, 0.0, E_z );
+
+	// VRML codes are generated below	
+	fDest << G4endl;
+	fDest << "#---------- CAMERA" << G4endl;
+	fDest << "Viewpoint {"         << G4endl;
+	fDest << "\t" << "position "           ;
+	fDest                 << E.x() << " "  ;
+	fDest                 << E.y() << " "  ;
+	fDest                 << E.z() << G4endl ;
+	fDest << "}" << G4endl;
+	fDest << G4endl;
+
+}
Index: tags/visualization-10.5-before-10.6_test/VRML/src/G4VRML2SceneHandler.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/VRML/src/G4VRML2SceneHandler.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/VRML/src/G4VRML2SceneHandler.cc	(revision 1102)
@@ -0,0 +1,147 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VRML2SceneHandler.cc,v 1.12 2006/06/29 21:26:15 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// G4VRML2SceneHandler.cc
+// Satoshi Tanaka & Yasuhide Sawada
+
+#ifndef WIN32
+
+
+//=================//
+#ifdef G4VIS_BUILD_VRML_DRIVER
+//=================//
+
+
+//#define DEBUG_FR_SCENE
+
+#include <unistd.h>
+#include <fstream>
+#include <cmath>
+
+#include "globals.hh"
+#include "G4VPhysicalVolume.hh"
+#include "G4LogicalVolume.hh"
+#include "G4Point3D.hh"
+#include "G4VModel.hh"
+#include "G4Scene.hh"
+#include "G4VisAttributes.hh"
+#include "G4Polyhedron.hh"
+#include "G4Box.hh"
+#include "G4Cons.hh"
+#include "G4Polyline.hh"
+#include "G4Trd.hh"
+#include "G4Tubs.hh"
+#include "G4Text.hh"
+#include "G4Circle.hh"
+#include "G4Square.hh"
+
+#include "G4VRML2SceneHandler.hh"
+#include "G4VRML2Viewer.hh"
+#include "G4VRML2.hh"
+
+
+
+G4VRML2SceneHandler::G4VRML2SceneHandler(G4VRML2& system, const G4String& name) :
+	G4VSceneHandler(system, fSceneIdCount++, name),
+	fSystem(system),
+	fPVPickable ( false ), 
+        fDest()
+{
+	
+	// PV name pickability 	
+	if( getenv( "G4VRML_PV_PICKABLE" ) != NULL ) {
+
+		int is_pickable ;
+		sscanf( getenv("G4VRML_PV_PICKABLE"), "%d", &is_pickable ) ;
+
+		if ( is_pickable ) { SetPVPickability ( true ) ; }
+	} 
+	
+	// PV Transparency
+	SetPVTransparency ();
+
+}
+
+
+G4VRML2SceneHandler::~G4VRML2SceneHandler()
+{
+#if defined DEBUG_FR_SCENE
+	G4cerr << "***** ~G4VRML2SceneHandler" << G4endl;
+#endif 
+}
+
+
+
+#define  G4VRML2SCENEHANDLER   G4VRML2SceneHandler
+#define  IS_CONNECTED  fDest.isConnected() 
+#include "G4VRML2SceneHandlerFunc.icc"
+#undef   IS_CONNECTED
+#undef   G4VRML2SCENEHANDLER
+
+
+void G4VRML2SceneHandler::connectPort(G4int max_trial)
+{
+	G4int trial = 0 ;
+	int port = fSystem.getPort();
+	for (trial = 0; !fDest.isConnected()&& trial < max_trial; trial++, port++ ) {
+		if (fDest.connect( (const char * )fSystem.getHostName(), port)) {
+		    // INET domain connection is established
+			G4cerr << "*** GEANT4 is connected to port  ";
+			G4cerr << fDest.getPort(); 
+			G4cerr << " of server  " << fSystem.getHostName() << G4endl;
+			break; 
+		} else { 
+			// Connection failed. Try the next port.
+			G4cerr << "*** GEANT4 incremented targeting port to ";
+			G4cerr << port << G4endl;
+		}
+
+		sleep (1);
+
+	} // for
+
+	if (!fDest.isConnected()) {
+		G4cerr << "*** INET Connection failed. " << G4endl;
+		G4cerr << "    Maybe, you have not invoked viewer  g4vrmlview  yet, " << G4endl;
+		G4cerr << "    or too many viewers are already running in the " << G4endl;
+		G4cerr << "    server host(" << fSystem.getHostName() << "). " << G4endl;
+	}
+}
+
+void G4VRML2SceneHandler::closePort()
+{
+	fDest.close();
+	G4cerr << "*** INET Connection closed. " << G4endl;
+}
+
+
+G4int G4VRML2SceneHandler::fSceneIdCount = 0;
+
+#endif
+#endif //WIN32
Index: tags/visualization-10.5-before-10.6_test/VRML/src/G4VRML2SceneHandlerFunc.icc
===================================================================
--- tags/visualization-10.5-before-10.6_test/VRML/src/G4VRML2SceneHandlerFunc.icc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/VRML/src/G4VRML2SceneHandlerFunc.icc	(revision 1102)
@@ -0,0 +1,668 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VRML2SceneHandlerFunc.icc,v 1.20 2006/06/29 21:26:17 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// G4VRML2SceneHandlerFunc.icc
+// Satoshi Tanaka & Yasuhide Sawada
+
+//#define DEBUG_SCENE_FUNC
+
+void G4VRML2SCENEHANDLER::AddSolid(const G4Trd& trd)
+{
+#if defined DEBUG_SCENE_FUNC
+	G4cerr << "***** AddSolid trd" << "\n" ;
+#endif
+	VRMLBeginModeling () ;
+	G4VSceneHandler::AddSolid(trd);
+}
+
+void G4VRML2SCENEHANDLER::AddSolid(const G4Trap& trap)
+{
+#if defined DEBUG_SCENE_FUNC
+	G4cerr << "***** AddSolid trap" << "\n" ;
+#endif
+	VRMLBeginModeling () ;
+	G4VSceneHandler::AddSolid(trap);
+}
+
+void G4VRML2SCENEHANDLER::AddSolid(const G4Para& para)
+{
+#if defined DEBUG_SCENE_FUNC
+	G4cerr << "***** AddSolid para" << "\n" ;
+#endif
+	VRMLBeginModeling () ;
+	G4VSceneHandler::AddSolid(para);
+}
+
+void G4VRML2SCENEHANDLER::AddSolid(const G4Torus& torus )
+{
+#if defined DEBUG_SCENE_FUNC
+	G4cerr << "***** AddSolid torus" << "\n" ;
+#endif
+	VRMLBeginModeling () ;
+	G4VSceneHandler::AddSolid(torus);
+}
+
+
+void G4VRML2SCENEHANDLER::AddSolid(const G4VSolid& vsolid)
+{
+#if defined DEBUG_SCENE_FUNC
+	G4cerr << "***** AddSolid vsolid" << "\n" ;
+#endif
+	VRMLBeginModeling () ;
+	G4VSceneHandler::AddSolid(vsolid);
+}
+
+void G4VRML2SCENEHANDLER::AddSolid(const G4Tubs& tubs)
+{
+#if defined DEBUG_SCENE_FUNC
+	G4cerr << "***** AddSolid tubs" << "\n" ;
+#endif
+	VRMLBeginModeling () ;
+	G4VSceneHandler::AddSolid(tubs) ;
+
+}
+
+
+void G4VRML2SCENEHANDLER::AddSolid(const G4Cons& cons)
+{
+#if defined DEBUG_SCENE_FUNC
+    G4cerr << "***** AddSolid cons" << "\n" ;
+#endif
+	VRMLBeginModeling () ;
+	G4VSceneHandler::AddSolid(cons) ;
+}
+
+void G4VRML2SCENEHANDLER::AddSolid(const G4Box& box)
+{
+#if defined DEBUG_SCENE_FUNC
+	G4cerr << "***** AddSolid box" << "\n" ;
+#endif
+	VRMLBeginModeling () ;
+	G4VSceneHandler::AddSolid(box) ;
+}
+
+
+void G4VRML2SCENEHANDLER::AddSolid(const G4Sphere& sphere)
+{
+#if defined DEBUG_SCENE_FUNC
+	G4cerr << "***** AddSolid sphere" << "\n" ;
+#endif
+	VRMLBeginModeling () ;
+	G4VSceneHandler::AddSolid(sphere) ;
+}
+
+void G4VRML2SCENEHANDLER::AddPrimitive(const G4Polyline& polyline)
+{
+#if defined DEBUG_SCENE_FUNC
+	G4cerr << "***** AddPrimitive polyline" << "\n" ;
+#endif 
+
+	VRMLBeginModeling () ;
+
+	// VRML codes are generated below
+
+	fDest << "#---------- POLYLINE" << "\n";
+	fDest << "Shape {" << "\n";
+
+	SendLineColor   ( polyline.GetVisAttributes() );
+
+	fDest << "\t" << "geometry IndexedLineSet {" << "\n";
+
+	fDest << "\t\t"   << "coord Coordinate {" << "\n";
+	fDest << "\t\t\t" <<      "point [" << "\n";
+	G4int e, i;
+	for (i = 0, e = polyline.size(); e; i++, e--) {
+
+		G4Point3D point = polyline[i];
+		point.transform( *fpObjectTransformation );
+
+		fDest << "\t\t\t\t";
+		fDest <<                  point.x() << " ";
+		fDest <<                  point.y() << " ";
+		fDest <<                  point.z() << "," << "\n";
+
+	} // for
+
+	fDest << "\t\t\t" <<      "]" << "\n"; // point
+	fDest << "\t\t"   << "}"      << "\n"; // coord
+
+	fDest << "\t\t" << "coordIndex [";
+	for (i = 0, e = polyline.size(); e; i++, e--) {
+		if (i % 10 == 0)
+			fDest << "\n" << "\t\t\t";
+		fDest << i << ", ";
+	}
+	fDest << "-1" << "\n";
+	fDest << "\t\t" << "]"        << "\n"; // coordIndex
+	fDest << "\t" << "}" << "\n"; // geometry IndexedLineSet
+
+	fDest << "}" << "\n"; // Shape
+}
+
+
+void G4VRML2SCENEHANDLER::AddPrimitive(const G4Polyhedron& polyhedron)
+{
+#if defined DEBUG_SCENE_FUNC
+	G4cerr << "***** AddPrimitive(G4Polyhedron)" << "\n";
+#endif
+
+	if (polyhedron.GetNoFacets() == 0) return;
+
+	VRMLBeginModeling () ;
+
+	// Transparency checking: If completely transparent, skip drawing 
+	if ( GetPVTransparency() > 0.99 ) { return ; }
+
+	// Current Model
+	const G4VModel* pv_model  = GetModel();
+	G4String pv_name = "No model";
+        if (pv_model) pv_name = pv_model->GetCurrentTag() ;
+
+	// VRML codes are generated below
+
+	fDest << "#---------- SOLID: " << pv_name << "\n";
+
+	if ( IsPVPickable() ) {
+
+	 fDest << "Anchor {" << "\n";
+	 fDest << " description " << "\"" << pv_name << "\"" << "\n";
+	 fDest << " url \"\" " << "\n";
+	 fDest << " children [" << "\n";
+	}
+
+	fDest << "\t"; fDest << "Shape {" << "\n";
+
+	SendMaterialNode();
+
+	fDest << "\t\t" << "geometry IndexedFaceSet {" << "\n";
+
+	fDest << "\t\t\t"   << "coord Coordinate {" << "\n";
+	fDest << "\t\t\t\t" <<      "point [" << "\n";
+	G4int i, j;
+	for (i = 1, j = polyhedron.GetNoVertices(); j; j--, i++) {
+		G4Point3D point = polyhedron.GetVertex(i);
+
+		point.transform( *fpObjectTransformation );
+
+		fDest << "\t\t\t\t\t";
+		fDest <<                   point.x() << " ";
+		fDest <<                   point.y() << " ";
+		fDest <<                   point.z() << "," << "\n";
+	}
+	fDest << "\t\t\t\t" <<      "]" << "\n"; // point
+	fDest << "\t\t\t"   << "}"      << "\n"; // coord
+
+	fDest << "\t\t\t"   << "coordIndex [" << "\n";
+
+	// facet loop
+	G4int f;
+	for (f = polyhedron.GetNoFacets(); f; f--) {
+
+		// edge loop  
+		G4bool notLastEdge;
+		G4int index = -1, edgeFlag = 1;
+		fDest << "\t\t\t\t";
+		do {
+			notLastEdge = polyhedron.GetNextVertexIndex(index, edgeFlag);
+			fDest << index - 1 << ", ";
+		} while (notLastEdge);
+		fDest << "-1," << "\n";
+	}
+	fDest << "\t\t\t"   << "]" << "\n"; // coordIndex
+
+	fDest << "\t\t\t"   << "solid FALSE" << "\n"; // draw backfaces
+
+	fDest << "\t\t" << "}"     << "\n"; // IndexFaceSet
+	fDest << "\t" << "}"       << "\n"; // Shape
+
+	if ( IsPVPickable() ) {
+	 fDest << " ]"              << "\n"; // children
+	 fDest << "}"               << "\n"; // Anchor
+	}
+
+} 
+
+
+void G4VRML2SCENEHANDLER::AddPrimitive(const G4NURBS&)
+{
+#if defined DEBUG_SCENE_FUNC
+	G4cerr << "***** AddPrimitive nurbs" << "\n" ;
+#endif 
+	G4cerr << "G4VRML2File::AddPrimitive(G4NURBS&): not implemented. " << "\n" ;
+
+	VRMLBeginModeling () ;
+}
+
+void G4VRML2SCENEHANDLER::AddPrimitive( const G4Text& ) 
+{
+#if defined DEBUG_SCENE_FUNC
+	G4cerr << "***** AddPrimitive text" << "\n" ;
+#endif
+	G4cerr <<
+          "***** void G4VRML2SCENEHANDLER::AddPrimitive( const G4Text& text )"
+          " not implemented yet."
+             << "\n";
+
+	VRMLBeginModeling () ;
+
+}
+
+void G4VRML2SCENEHANDLER::AddPrimitive( const G4Circle& circle ) 
+{
+#if defined DEBUG_SCENE_FUNC
+	G4cerr << "***** AddPrimitive circle" << "\n" ;
+#endif
+	VRMLBeginModeling () ;
+
+	// Information 
+//	const char* info = NULL ;
+	const char* info = circle.GetInfo() ;
+
+	// Position and half size of circle
+	G4double X, Y, Z ; GetMarkerWorldPosition( circle, &X, &Y, &Z ) ;
+	G4double radius = GetMarkerHalfSize ( circle );
+
+	// VRML codes are generated below
+	fDest << "#---------- 3D MARKER (Circle)" << "\n";
+	fDest << "Anchor {" << "\n";
+
+	if( circle.GetInfo().isNull() ) {
+		fDest << " description " << "\"(" <<  X <<  "  " ;
+		fDest <<                              Y <<  "  " ;
+		fDest <<                              Z <<  ")\"" << "\n";
+	} else {
+		fDest << " description " << "\"" <<  info << "\"" << "\n";
+	}
+
+
+	fDest << " url \"\" " << "\n";
+
+	fDest << " children [" << "\n";
+
+	fDest << "  Transform {" << "\n";
+
+	fDest << "   translation ";
+	fDest <<      X << " " << Y << " " << Z << "\n";
+
+	fDest << "   children ["   << "\n";
+
+	fDest << "\t" << "Shape {" << "\n";
+
+	SendMarkerColor( circle );
+
+	// send shape with size 
+	fDest << "\t\t"   << "geometry Sphere {" << "\n";
+	fDest << "\t\t\t" <<      "radius " << radius << "\n";
+	fDest << "\t\t"   << "}" << "\n";
+
+	fDest << "\t" << "}"       << "\n"; // Shape
+
+	fDest << "   ]"            << "\n"; //  children 
+	fDest << "  }"             << "\n"; //  Transform
+	
+	fDest << " ]"              << "\n"; //  children
+	fDest << "}"               << "\n"; //  Anchor
+
+}
+
+void G4VRML2SCENEHANDLER::AddPrimitive(const G4Square& square)
+{
+#if defined DEBUG_SCENE_FUNC
+	G4cerr << "***** AddPrimitive square" << "\n" ;
+#endif
+
+	VRMLBeginModeling () ;
+
+	// Information 
+//	const char* info = NULL ;
+	const char* info = square.GetInfo() ;
+
+	// Position and size of square 
+	G4double X, Y, Z ; GetMarkerWorldPosition  ( square, &X, &Y, &Z ) ;
+	G4double radius   = GetMarkerHalfSize ( square );
+	G4double diameter = 2.0 * radius ;
+
+	// VRML codes are generated below
+	fDest << "#---------- 3D MARKER (Square)" << "\n";
+	fDest << "Anchor {" << "\n";
+
+	if( square.GetInfo().isNull() ) {
+		fDest << " description " << "\"(" <<  X <<  "  " ;
+		fDest <<                              Y <<  "  " ;
+		fDest <<                              Z <<  ")\"" << "\n";
+	} else {
+		fDest << " description " << "\"" <<  info << "\"" << "\n";
+	}
+
+	fDest << " url \"\" " << "\n";
+
+	fDest << " children [" << "\n";
+
+	fDest << "  Transform {" << "\n";
+
+	fDest << "   translation ";
+	fDest <<      X << " " << Y << " " << Z << "\n";
+
+	fDest << "   children ["   << "\n";
+
+	fDest << "\t" << "Shape {" << "\n";
+
+	SendMarkerColor( square );
+
+	// send shape with size 
+	fDest << "\t\t"   << "geometry Box {" << "\n";
+	fDest << "\t\t\t" <<      "size "   << diameter << " "  ;
+	fDest                               << diameter << " "  ;
+	fDest                               << diameter << "\n" ;
+	fDest << "\t\t"   << "}"                        << "\n";
+
+	fDest << "\t" << "}"       << "\n"; //  Shape
+
+	fDest << "   ]"            << "\n"; //  children 
+	fDest << "  }"             << "\n"; //  Transform
+	
+	fDest << " ]"              << "\n"; //  children
+	fDest << "}"               << "\n"; //  Anchor
+
+}
+
+void G4VRML2SCENEHANDLER::BeginModeling()
+{
+#if defined DEBUG_SCENE_FUNC
+	G4cerr << "***** BeginModeling" << "\n" ;
+#endif
+	G4VSceneHandler::BeginModeling();
+
+}
+
+void G4VRML2SCENEHANDLER::EndModeling()
+{
+#if defined DEBUG_SCENE_FUNC
+	G4cerr << "***** EndModeling " << "\n" ;
+#endif
+	G4VSceneHandler::EndModeling();
+}
+
+void G4VRML2SCENEHANDLER::BeginPrimitives(const G4Transform3D& objectTransformation)
+{
+  G4VSceneHandler::BeginPrimitives (objectTransformation);
+  fpObjectTransformation = &objectTransformation;
+#if defined DEBUG_SCENE_FUNC
+	G4cerr << "***** BeginPrimitives " << "\n" ;
+#endif
+	VRMLBeginModeling(); 
+}
+
+void G4VRML2SCENEHANDLER::EndPrimitives()
+{
+#if defined DEBUG_SCENE_FUNC
+	G4cerr << "***** EndPrimitives " << "\n" ;
+#endif
+  G4VSceneHandler::EndPrimitives();
+}
+
+void G4VRML2SCENEHANDLER::SendMaterialNode( const G4VisAttributes*  pVA )
+{
+	// Initialization of drawing parameters 	
+	G4bool		flagWF       = false ; 
+	G4double	TRANSPARENCY = GetPVTransparency() ;
+
+	//  Wireframe or not
+	const	G4ViewParameters& cur_view_param = fpViewer -> GetViewParameters ();
+	if (pVA->IsForceDrawingStyle() &&
+	   (pVA->GetForcedDrawingStyle() == G4VisAttributes::wireframe)) 
+	{
+		// wireframe style is assigned to this object
+		flagWF = true ;
+
+	} else if ( cur_view_param.GetDrawingStyle() == G4ViewParameters::wireframe )   
+	{
+		// current viewing style is  wireframe 
+		flagWF = true  ;
+	} 
+
+	// VRML codes are generated below
+	if (!pVA) { 
+		
+		// Error recovery: Use default values of VRML browser
+		fDest << "\t\t" ;
+		fDest << "appearance Appearance { material Material {} }";
+		fDest << "\n";
+		
+	} else {
+
+		const G4Color& color = pVA->GetColor();
+
+		fDest << "\t\t"   << "appearance Appearance {" << "\n";
+		fDest << "\t\t\t" <<      "material Material {" << "\n";
+
+		// diffuse color 	
+		fDest << "\t\t\t\t" << "diffuseColor ";
+		fDest <<                   color.GetRed()   << " " ;
+		fDest <<                   color.GetGreen() << " " ;
+		fDest <<                   color.GetBlue()  << "\n"; 
+
+		// emmisive color 	
+		// fDest << "\t\t\t\t" << "emissiveColor ";
+		// fDest <<                   color.GetRed()   << " " ;
+		// fDest <<                   color.GetGreen() << " " ;
+		//fDest <<                   color.GetBlue()  << "\n"; 
+		//
+
+		// wireframe is expressed as transparency
+		if ( flagWF ) 
+		{
+			fDest << "\t\t\t\t" << "transparency " << TRANSPARENCY << "\n";
+		}
+
+		fDest << "\t\t\t" <<      "}" << "\n"; // material
+		fDest << "\t\t"   << "}"      << "\n"; // appearance
+	}
+
+}
+
+
+void G4VRML2SCENEHANDLER::SendMaterialNode()
+{
+	SendMaterialNode
+	( fpViewer->GetApplicableVisAttributes (fpVisAttribs) );
+}
+
+
+void G4VRML2SCENEHANDLER::VRMLBeginModeling()
+{
+	if (!IS_CONNECTED ) {
+#if defined DEBUG_SCENE_FUNC
+	G4cerr << "***** VRMLBeginModeling (started)" << "\n" ;
+#endif
+		this->connectPort();
+		fDest << "#VRML V2.0 utf8" << "\n";
+		fDest << "# Generated by VRML 2.0 driver of GEANT4\n" << "\n";
+	}
+}
+
+void G4VRML2SCENEHANDLER::VRMLEndModeling()
+{
+	if ( IS_CONNECTED ) {
+#if defined DEBUG_SCENE_FUNC
+	G4cerr << "***** VRMLEndModeling (started)" << "\n" ;
+#endif
+		fDest << "#End of file." << "\n";
+		this->closePort();
+	}
+}
+
+void      G4VRML2SCENEHANDLER::SendMarkerColor ( const G4VMarker& mark ) 
+{
+	const G4Color& color = GetColor( mark );
+
+	fDest << "\t\t"     << "appearance Appearance {" << "\n";
+	fDest << "\t\t\t"   <<      "material Material {" << "\n";
+	fDest << "\t\t\t\t" <<      "diffuseColor ";
+	fDest <<                   color.GetRed()    << " " ;
+	fDest <<                   color.GetGreen()  << " " ;
+	fDest <<                   color.GetBlue()   << "\n";
+	fDest << "\t\t\t\t" <<    "emissiveColor ";
+	fDest <<                   color.GetRed()    << " " ;
+	fDest <<                   color.GetGreen()  << " " ;
+	fDest <<                   color.GetBlue()   << "\n";
+	fDest << "\t\t\t"   <<      "}"              << "\n"; // material
+	fDest << "\t\t"     << "}"                   << "\n"; // appearance
+
+}
+
+void      
+G4VRML2SCENEHANDLER::SendMarkerWorldPosition ( const G4VMarker& mark )
+{
+	G4Point3D point = mark.GetPosition();
+
+	point.transform( *fpObjectTransformation );
+
+	fDest << "   translation ";
+	fDest <<      point.x() << " " << point.y() << " " << point.z() << "\n";
+
+}
+
+void  G4VRML2SCENEHANDLER::GetMarkerWorldPosition    (	const G4VMarker&  mark , 
+						double* pX             ,
+						double* pY             ,
+						double* pZ              ) 
+{
+	G4Point3D point = mark.GetPosition();
+
+	point.transform( *fpObjectTransformation );
+
+	*pX = point.x() ;
+	*pY = point.y() ;
+	*pZ = point.z() ;
+}
+
+G4double  G4VRML2SCENEHANDLER::GetMarkerHalfSize ( const G4VMarker& mark ) 
+{
+	//----- return value ( marker radius in 3d units) 
+	G4double size       = 1.0 ; // initialization
+
+	//----- parameters to calculate 3d size from 2d size
+	const double HALF_SCREEN_SIZE_2D = 300.0 ; // pixels
+	double zoom_factor  = fpViewer->GetViewParameters().GetZoomFactor() ;
+	if ( zoom_factor <=  0.0 ) { zoom_factor = 1.0 ; }
+	double extent_radius_3d = GetScene()->GetExtent().GetExtentRadius() ;
+	if ( extent_radius_3d <= 0.0 ) { extent_radius_3d = 1.0 ; } 
+
+	//----- get marker radius in 3D units
+	if        ( mark.GetWorldSize() > 0.0 ) {
+
+		// get mark radius in 3D units
+		size = 0.5 * mark.GetWorldSize()  ; 
+
+	} else if ( mark.GetScreenSize() > 0.0 ) {
+
+		// local
+		double mark_radius_2d   = 0.5 * mark.GetScreenSize() ;
+
+		// get mark radius in 3D units
+		size \
+		 = extent_radius_3d * ( mark_radius_2d / HALF_SCREEN_SIZE_2D );
+		size *= zoom_factor ;
+
+	} else {
+		// local
+		double mark_radius_2d \
+		 = fpViewer->GetViewParameters().GetDefaultMarker().GetScreenSize();
+		mark_radius_2d *= 0.1 ; // Magic number?
+
+		// get mark radius in 3D units
+		size \
+		 = extent_radius_3d * ( mark_radius_2d / HALF_SCREEN_SIZE_2D );
+		size *= zoom_factor ;
+	}
+
+		//----- global rescaling
+	size *= fpViewer->GetViewParameters().GetGlobalMarkerScale(); 
+
+		//----- return size
+	return size ;
+
+} 
+
+void G4VRML2SCENEHANDLER::SendLineColor ( const G4VisAttributes*  pVA )
+{
+	const G4Color& color = pVA->GetColor();
+
+
+	fDest << "\t"   << "appearance Appearance {" << "\n";
+	fDest << "\t\t" <<      "material Material {" << "\n";
+	fDest << "\t\t\t" <<      "diffuseColor ";
+	fDest <<                   color.GetRed()    << " " ;
+	fDest <<                   color.GetGreen()  << " " ;
+	fDest <<                   color.GetBlue()   << "\n";
+	fDest << "\t\t\t" <<    "emissiveColor ";
+	fDest <<                   color.GetRed()    << " " ;
+	fDest <<                   color.GetGreen()  << " " ;
+	fDest <<                   color.GetBlue()   << "\n";
+	fDest << "\t\t" <<      "}"                  << "\n"; // material
+	fDest << "\t"   << "}"                       << "\n"; // appearance
+}
+
+G4double      G4VRML2SCENEHANDLER::SetPVTransparency ()
+{
+
+	G4double	TRANSPARENCY = 0.7   ;	// initialization
+						
+	if( getenv( "G4VRML_TRANSPARENCY" ) != NULL ) {
+
+		// get a value from the env value
+		sscanf( getenv("G4VRML_TRANSPARENCY"), "%lg", &TRANSPARENCY ) ;
+
+		// truncation 
+		TRANSPARENCY = std::fabs ( TRANSPARENCY ) ; 
+		if ( TRANSPARENCY > 1.0 ) { TRANSPARENCY = 1.0 ; }
+	} 
+
+	fPVTransparency = TRANSPARENCY ;
+
+	return fPVTransparency ;
+}
+
+
+void G4VRML2SCENEHANDLER::ClearTransientStore() 
+{
+  G4VSceneHandler::ClearTransientStore ();
+  // This is typically called after an update and before drawing hits
+  // of the next event.  To simulate the clearing of "transients"
+  // (hits, etc.) the detector is redrawn...
+  if (fpViewer) {
+    fpViewer -> SetView ();
+    fpViewer -> ClearView ();
+    fpViewer -> DrawView ();
+  }
+}
+
+
+// End of file.
Index: tags/visualization-10.5-before-10.6_test/VRML/src/G4VRML2Viewer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/VRML/src/G4VRML2Viewer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/VRML/src/G4VRML2Viewer.cc	(revision 1102)
@@ -0,0 +1,153 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VRML2Viewer.cc,v 1.12 2006/06/29 21:26:35 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// G4VRML2Viewer.cc
+// Satoshi Tanaka & Yasuhide Sawada
+
+#ifndef WIN32
+
+//=================//
+#ifdef G4VIS_BUILD_VRML_DRIVER
+//=================//
+
+
+//#define DEBUG_FR_VIEW
+
+#include <cmath>
+
+#include "G4Scene.hh"
+#include "G4VRML2Viewer.hh"
+#include "G4VRML2SceneHandler.hh"
+#include "G4VRML2.hh"
+#include "G4ios.hh"
+
+G4VRML2Viewer::G4VRML2Viewer(G4VRML2SceneHandler& sceneHandler, const G4String& name) :
+ G4VViewer(sceneHandler,
+	   sceneHandler.IncrementViewCount(),
+	   name),
+ fSceneHandler(sceneHandler),
+ fDest(sceneHandler.fDest)
+{
+	fViewHalfAngle = 0.5 * 0.785398 ; // 0.5 * 45*deg
+	fsin_VHA       = std::sin ( fViewHalfAngle ) ;	
+}
+
+G4VRML2Viewer::~G4VRML2Viewer()
+{}
+
+void G4VRML2Viewer::SetView()
+{
+#if defined DEBUG_FR_VIEW
+  G4cerr << "***** G4VRML2Viewer::SetView(): No effects" << G4endl;
+#endif
+
+// Do nothing, since VRML a browser is running as a different process.
+// SendViewParameters () will do this job instead.
+
+}
+
+
+void G4VRML2Viewer::DrawView()
+{
+#if defined DEBUG_FR_VIEW
+	G4cerr << "***** G4VRML2Viewer::DrawView()" << G4endl;
+#endif
+	fSceneHandler.VRMLBeginModeling() ;
+
+        // Viewpoint node
+        SendViewParameters(); 
+
+	// Here is a minimal DrawView() function.
+	NeedKernelVisit();
+	ProcessView();
+	FinishView();
+}
+
+void G4VRML2Viewer::ClearView(void)
+{
+#if defined DEBUG_FR_VIEW
+  G4cerr << "***** G4VRML2Viewer::ClearView(): No effects" << G4endl;
+#endif
+}
+
+void G4VRML2Viewer::ShowView(void)
+{
+#if defined DEBUG_FR_VIEW
+  G4cerr << "***** G4VRML2Viewer::ShowView()" << G4endl;
+#endif
+	fSceneHandler.VRMLEndModeling();
+}
+
+void G4VRML2Viewer::FinishView(void)
+{
+#if defined DEBUG_FR_VIEW
+  G4cerr << "***** G4VRML2Viewer::FinishView(): No effects" << G4endl;
+#endif
+}
+
+void G4VRML2Viewer::SendViewParameters () 
+{
+  // Calculates view representation based on extent of object being
+  // viewed and (initial) direction of camera.  (Note: it can change
+  // later due to user interaction via visualization system's GUI.)
+
+#if defined DEBUG_FR_VIEW
+      G4cerr << "***** G4VRML2Viewer::SendViewParameters()\n";
+#endif 
+	// error recovery
+	if ( fsin_VHA < 1.0e-6 ) { return ; } 
+
+	// camera distance
+	G4double extent_radius = fSceneHandler.GetScene()->GetExtent().GetExtentRadius();
+	G4double camera_distance = extent_radius / fsin_VHA ;
+
+	// camera position on Z axis
+	const G4Point3D&	target_point
+	  = fSceneHandler.GetScene()->GetStandardTargetPoint()
+	  + fVP.GetCurrentTargetPoint();
+	G4double		E_z = target_point.z() + camera_distance;
+	G4Point3D		E(0.0, 0.0, E_z );
+
+	// VRML codes are generated below	
+	fDest << "\n";
+	fDest << "#---------- CAMERA" << "\n";
+	fDest << "Viewpoint {"         << "\n";
+	fDest << "\t" << "position "           ;
+	fDest                 << E.x() << " "  ;
+	fDest                 << E.y() << " "  ;
+	fDest                 << E.z() << "\n" ;
+	fDest << "}" << "\n";
+	fDest << "\n";
+
+} 
+
+
+
+#endif
+#endif //WIN32
Index: tags/visualization-10.5-before-10.6_test/XXX/GNUmakefile
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/GNUmakefile	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/GNUmakefile	(revision 1102)
@@ -0,0 +1,35 @@
+# $Id: GNUmakefile,v 1.7 2006/03/28 17:16:41 allison Exp $
+
+name := G4visXXX
+
+ifndef G4INSTALL
+  G4INSTALL = ../../..
+endif
+
+GLOBLIBS  = libG4vis_management.lib libG4modeling.lib
+GLOBLIBS += libG4run.lib libG4event.lib
+GLOBLIBS += libG4tracking.lib libG4processes.lib libG4digits_hits.lib
+GLOBLIBS += libG4track.lib libG4particles.lib libG4geometry.lib
+GLOBLIBS += libG4materials.lib libG4graphics_reps.lib
+GLOBLIBS += libG4intercoms.lib libG4global.lib
+
+include $(G4INSTALL)/config/architecture.gmk
+include $(G4INSTALL)/config/G4VIS_BUILD.gmk
+include $(G4INSTALL)/config/interactivity.gmk
+
+CPPFLAGS += -I$(G4BASE)/visualization/management/include
+CPPFLAGS += -I$(G4BASE)/visualization/modeling/include
+CPPFLAGS += -I$(G4BASE)/global/management/include
+CPPFLAGS += -I$(G4BASE)/global/HEPGeometry/include
+CPPFLAGS += -I$(G4BASE)/graphics_reps/include
+CPPFLAGS += -I$(G4BASE)/intercoms/include
+CPPFLAGS += -I$(G4BASE)/geometry/management/include
+CPPFLAGS += -I$(G4BASE)/geometry/solids/CSG/include
+CPPFLAGS += -I$(G4BASE)/geometry/solids/specific/include
+CPPFLAGS += -I$(G4BASE)/tracking/include
+
+ifdef G4VIS_BUILD_XXXSG_DRIVER
+  CPPFLAGS += -DG4VIS_BUILD_XXXSG_DRIVER
+endif
+
+include $(G4INSTALL)/config/common.gmk
Index: tags/visualization-10.5-before-10.6_test/XXX/History
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/History	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/History	(revision 1102)
@@ -0,0 +1,102 @@
+$Id: History,v 1.27 2006/11/05 20:41:55 allison Exp $
+-------------------------------------------------------------------
+
+     =========================================================
+     Geant4 - an Object-Oriented Toolkit for Simulation in HEP
+     =========================================================
+
+                      Category History file
+                      ---------------------
+This file should be used by G4 developers and category coordinators
+to briefly summarize all major modifications introduced in the code
+and keep track of all category-tags.
+It DOES NOT substitute the  CVS log-message one should put at every
+committal in the CVS repository !
+
+     ----------------------------------------------------------
+     * Reverse chronological order (last date on top), please *
+     ----------------------------------------------------------
+
+History file for visualization/XXX sub-category (a template graphics system)
+---------------------------------------------------------------------------
+
+5th November 2006  John Allison  (visXXX-V08-01-06)
+- Protect against zero materials pointer.
+
+26th October 2006  John Allison  (visXXX-V08-01-05)
+- Improved print out.
+- Followed modeling-V08-01-08.
+
+24th October 2006  John Allison  (visXXX-V08-01-04; co-works greps-V08-01-08)
+- G4XXXStoredSceneHandler.cc: Followed change to G4VisAttributes in
+  greps-V08-01-08 (change GetAttValues to CreateAttValues).
+
+13th September 2006  John Allison  (visXXX-V08-01-03)
+- G4XXXStoredSceneHandler.cc: Improved G4Att printing and checking.
+
+29th August 2006  John Allison  (visXXX-V08-01-02)
+- G4XXXSG/StoredViewer::CompareForKernelVisit: Minor tidying.
+
+10th July 2006  John Allison  (visXXX-V08-01-01)
+- G4XXXStoredSceneHandler.cc: Gets solid's G4Atts created by
+  G4PhysicalVolumeModel.
+
+3rd July 2006  John Allison  (visXXX-V08-01-00)
+- General tidy and improvement to XXXFile.
+
+4th May 2006  John Allison  (visXXX-V08-00-04)
+- Improved protection for null models and parameters.
+
+19th April 2006  John Allison  (visXXX-V08-00-03)
+- Cosmetic improvement of legibility.
+
+8th March 2006  John Allison (visXXX-V08-00-02)
+- Added G4XXXFile, G4XXXStored, G4XXXSG.
+
+8th February 2006  John Allison (visXXX-V08-00-01)
+- Improved handling of DrawnPVPath:
+  o Added G4XXXSceneHandler::Begin/EndModeling().
+  o G4XXXSceneHandler::EndModeling: Cleared stores.
+  o G4XXXSceneHandler::PreAddSolid: Tidied.
+
+26th January 2006  John Allison (visXXX-V08-00-00)
+- Added code to use volume hierarchy path.  Needs modeling-V08-00-01.
+
+22nd November 2005  John Allison (visXXX-V07-01-02)
+- Simplified guidance.
+
+13th October 2005  John Allison (visXXX-V07-01-01)
+- Migrated to <sstream>.
+
+2nd September 2005  John Allison (visXXX-V07-01-00)
+- Improved guidance fro rendering polyhedron objects.
+
+7th June 2005  John Allison (visXXX-V07-00-00)
+- Fixed unused parameter warnings.
+
+1st June 2005  John Allison
+- Removed scene count and included some ongoing developments to do
+  with making a consistent geometry hierarchy in presence of culled
+  volumes.
+
+12th November 2003  John Allison
+- Added G4XXXSceneHandler::ClearTransientStore.
+
+6th November 2003  John Allison  (vis-V05-02-03)
+- G4XXXViewer: improved comments.
+
+4th October 2003  Gabriele Cosmo (vis-V05-02-01)
+- Simplified GNUmakefile.
+
+11th November 2002  John Allison
+- Moved header inclusions from .hh to .cc.
+- Tidied AddThis(traj) and improved (square) and (circle).
+
+16th November 2001  John Allison
+- Added G4XXXDEBUG.
+
+24th August 2001  John Allison  (vis-V03-02-13)
+- Added example unpacking code for G4Polyhedron objects.
+
+17th August 2001  John Allison  (vis-V03-02-12)
+- Added template graphics system XXX.
Index: tags/visualization-10.5-before-10.6_test/XXX/include/G4XXX.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/include/G4XXX.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/include/G4XXX.hh	(revision 1102)
@@ -0,0 +1,48 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4XXX.hh,v 1.5 2006/06/29 21:26:37 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  5th April 2001
+// A template for a simplest possible graphics driver.
+//?? Lines beginning like this require specialisation for your driver.
+
+#ifndef G4XXX_HH
+#define G4XXX_HH
+
+#include "G4VGraphicsSystem.hh"
+
+class G4XXX: public G4VGraphicsSystem {
+public:
+  G4XXX();
+  virtual ~G4XXX();
+  G4VSceneHandler* CreateSceneHandler(const G4String& name = "");
+  G4VViewer* CreateViewer (G4VSceneHandler&, const G4String& name = "");
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/XXX/include/G4XXXFile.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/include/G4XXXFile.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/include/G4XXXFile.hh	(revision 1102)
@@ -0,0 +1,48 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4XXXFile.hh,v 1.2 2006/06/29 21:26:39 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  7th March 2006
+// A template for a file-writing graphics driver.
+//?? Lines beginning like this require specialisation for your driver.
+
+#ifndef G4XXXFile_HH
+#define G4XXXFile_HH
+
+#include "G4VGraphicsSystem.hh"
+
+class G4XXXFile: public G4VGraphicsSystem {
+public:
+  G4XXXFile();
+  virtual ~G4XXXFile();
+  G4VSceneHandler* CreateSceneHandler(const G4String& name = "");
+  G4VViewer* CreateViewer (G4VSceneHandler&, const G4String& name = "");
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/XXX/include/G4XXXFileSceneHandler.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/include/G4XXXFileSceneHandler.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/include/G4XXXFileSceneHandler.hh	(revision 1102)
@@ -0,0 +1,126 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4XXXFileSceneHandler.hh,v 1.3 2006/06/29 21:26:42 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  7th March 2006
+// A template for a file-writing graphics driver.
+//?? Lines beginning like this require specialisation for your driver.
+
+#ifndef G4XXXFileSCENEHANDLER_HH
+#define G4XXXFileSCENEHANDLER_HH
+
+#include "G4VSceneHandler.hh"
+
+class G4XXXFileSceneHandler: public G4VSceneHandler {
+
+  friend class G4XXXFileViewer;
+
+public:
+  G4XXXFileSceneHandler(G4VGraphicsSystem& system,
+			const G4String& name);
+  virtual ~G4XXXFileSceneHandler();
+
+  ////////////////////////////////////////////////////////////////
+  // Optional virtual functions...
+  void AddSolid(const G4Box&);
+  // Further optional AddSolid functions.  Explicitly invoke base
+  // class methods if not otherwise defined to avoid warnings about
+  // hiding of base class methods.
+  void AddSolid(const G4Cons& cons)
+  {G4VSceneHandler::AddSolid(cons);}
+  void AddSolid(const G4Tubs& tubs)
+  {G4VSceneHandler::AddSolid(tubs);}
+  void AddSolid(const G4Trd& trd)
+  {G4VSceneHandler::AddSolid(trd);}
+  void AddSolid(const G4Trap& trap)
+  {G4VSceneHandler::AddSolid(trap);}
+  void AddSolid(const G4Sphere& sphere)
+  {G4VSceneHandler::AddSolid(sphere);}
+  void AddSolid(const G4Para& para)
+  {G4VSceneHandler::AddSolid(para);}
+  void AddSolid(const G4Torus& torus)
+  {G4VSceneHandler::AddSolid(torus);}
+  void AddSolid(const G4Polycone& polycone)
+  {G4VSceneHandler::AddSolid(polycone);}
+  void AddSolid(const G4Polyhedra& polyhedra)
+  {G4VSceneHandler::AddSolid(polyhedra);}
+  void AddSolid(const G4VSolid& solid)
+  {G4VSceneHandler::AddSolid(solid);}
+  // More optional functions...
+  // void AddCompound(const G4VTrajectory&);
+  // void AddCompound(const G4VHit&);
+  // void PreAddSolid(const G4Transform3D& objectTransformation,
+  //	   const G4VisAttributes&);
+  // void PostAddSolid();
+
+  ////////////////////////////////////////////////////////////////
+  // Required implementation of pure virtual functions...
+
+  void AddPrimitive(const G4Polyline&);
+  void AddPrimitive(const G4Text&);
+  void AddPrimitive(const G4Circle&);
+  void AddPrimitive(const G4Square&);
+  void AddPrimitive(const G4Polyhedron&);
+  void AddPrimitive(const G4NURBS&);
+  // Further optional AddPrimitive methods.  Explicitly invoke base
+  // class methods if not otherwise defined to avoid warnings about
+  // hiding of base class methods.
+  void AddPrimitive(const G4Polymarker& polymarker)
+  {G4VSceneHandler::AddPrimitive (polymarker);}
+  void AddPrimitive(const G4Scale& scale)
+  {G4VSceneHandler::AddPrimitive (scale);}
+  // Further related optional virtual functions...
+  // void BeginPrimitives(const G4Transform3D& objectTransformation);
+  // void EndPrimitives();
+
+  ////////////////////////////////////////////////////////////////
+  // Further optional virtual functions...
+
+  // void BeginModeling();
+  // void EndModeling();
+
+  //////////////////////////////////////////////////////////////
+  // Administration functions.
+
+  // void ClearStore ();
+  // void ClearTransientStore ();
+
+protected:
+
+  static G4int fSceneIdCount;  // Counter for XXXFile scene handlers.
+
+private:
+
+#ifdef G4XXXFileDEBUG
+  void PrintThings();
+#endif
+
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/XXX/include/G4XXXFileViewer.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/include/G4XXXFileViewer.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/include/G4XXXFileViewer.hh	(revision 1102)
@@ -0,0 +1,71 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4XXXFileViewer.hh,v 1.3 2006/07/03 16:52:48 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  7th March 2006
+// A template for a file-writing graphics driver.
+//?? Lines beginning like this require specialisation for your driver.
+
+#ifndef G4XXXFileVIEWER_HH
+#define G4XXXFileVIEWER_HH
+
+#include "G4VViewer.hh"
+
+#include <fstream>
+
+class G4XXXFileViewer: public G4VViewer {
+public:
+  G4XXXFileViewer(G4VSceneHandler&,const G4String& name);
+  virtual ~G4XXXFileViewer();
+  void SetView();
+  void ClearView();
+  void DrawView();
+  void ShowView();
+  // A simple class to handle delayed opening, etc.  There are various
+  // degrees of sophistication in, for example, the allocation of
+  // filenames -- see FukuiRenderer or HepRepFile.
+  class FileWriter {
+  public:
+    FileWriter(): fOpen(false) {}
+    G4bool IsOpen() {return fOpen;}
+    void WriteItem(const G4String& item);
+    void Close();
+    // Implement rewind as close and re-open...
+    void Rewind() {if (fOpen) {fFile.close(); fFile.open(fFileName.c_str());}}
+  private:
+    G4String fFileName;
+    G4bool fOpen;
+    std::ofstream fFile;
+  };
+  FileWriter& GetFileWriter() {return fFileWriter;}
+private:
+  FileWriter fFileWriter;
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/XXX/include/G4XXXSG.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/include/G4XXXSG.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/include/G4XXXSG.hh	(revision 1102)
@@ -0,0 +1,52 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4XXXSG.hh,v 1.2 2006/06/29 21:26:54 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  10th March 2005
+// A template for a sophisticated graphics driver with a scene graph.
+//?? Lines or sections marked like this require specialisation for your driver.
+
+#if defined (G4VIS_BUILD_XXXSG_DRIVER) || (G4VIS_USE_XXXSG)
+
+#ifndef G4XXXSG_HH
+#define G4XXXSG_HH
+
+#include "G4VGraphicsSystem.hh"
+
+class G4XXXSG: public G4VGraphicsSystem {
+public:
+  G4XXXSG();
+  virtual ~G4XXXSG();
+  G4VSceneHandler* CreateSceneHandler(const G4String& name = "");
+  G4VViewer* CreateViewer (G4VSceneHandler&, const G4String& name = "");
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/XXX/include/G4XXXSGSceneHandler.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/include/G4XXXSGSceneHandler.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/include/G4XXXSGSceneHandler.hh	(revision 1102)
@@ -0,0 +1,148 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4XXXSGSceneHandler.hh,v 1.3 2006/06/29 21:26:56 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  10th March 2006
+// A template for a sophisticated graphics driver with a scene graph.
+//?? Lines beginning like this require specialisation for your driver.
+
+#ifdef G4VIS_BUILD_XXXSG_DRIVER
+
+#ifndef G4XXXSGSCENEHANDLER_HH
+#define G4XXXSGSCENEHANDLER_HH
+
+#include "G4VSceneHandler.hh"
+
+#include "tree/tree.h"
+
+class G4XXXSGSceneHandler: public G4VSceneHandler {
+
+  friend class G4XXXSGViewer;
+
+public:
+  G4XXXSGSceneHandler(G4VGraphicsSystem& system,
+			const G4String& name);
+  virtual ~G4XXXSGSceneHandler();
+
+  ////////////////////////////////////////////////////////////////
+  // Optional virtual functions...
+  void AddSolid(const G4Box&);
+  // Further optional AddSolid functions.  Explicitly invoke base
+  // class methods if not otherwise defined to avoid warnings about
+  // hiding of base class methods.
+  void AddSolid(const G4Cons& cons)
+  {G4VSceneHandler::AddSolid(cons);}
+  void AddSolid(const G4Tubs& tubs)
+  {G4VSceneHandler::AddSolid(tubs);}
+  void AddSolid(const G4Trd& trd)
+  {G4VSceneHandler::AddSolid(trd);}
+  void AddSolid(const G4Trap& trap)
+  {G4VSceneHandler::AddSolid(trap);}
+  void AddSolid(const G4Sphere& sphere)
+  {G4VSceneHandler::AddSolid(sphere);}
+  void AddSolid(const G4Para& para)
+  {G4VSceneHandler::AddSolid(para);}
+  void AddSolid(const G4Torus& torus)
+  {G4VSceneHandler::AddSolid(torus);}
+  void AddSolid(const G4Polycone& polycone)
+  {G4VSceneHandler::AddSolid(polycone);}
+  void AddSolid(const G4Polyhedra& polyhedra)
+  {G4VSceneHandler::AddSolid(polyhedra);}
+  void AddSolid(const G4VSolid& solid)
+  {G4VSceneHandler::AddSolid(solid);}
+  // More optional functions...
+  // void AddCompound(const G4VTrajectory&);
+  // void AddCompound(const G4VHit&);
+  void PreAddSolid(const G4Transform3D& objectTransformation,
+		   const G4VisAttributes&);
+  void PostAddSolid();
+
+  ////////////////////////////////////////////////////////////////
+  // Required implementation of pure virtual functions...
+
+  void AddPrimitive(const G4Polyline&);
+  void AddPrimitive(const G4Text&);
+  void AddPrimitive(const G4Circle&);
+  void AddPrimitive(const G4Square&);
+  void AddPrimitive(const G4Polyhedron&);
+  void AddPrimitive(const G4NURBS&);
+  // Further optional AddPrimitive methods.  Explicitly invoke base
+  // class methods if not otherwise defined to avoid warnings about
+  // hiding of base class methods.
+  void AddPrimitive(const G4Polymarker& polymarker)
+  {G4VSceneHandler::AddPrimitive (polymarker);}
+  void AddPrimitive(const G4Scale& scale)
+  {G4VSceneHandler::AddPrimitive (scale);}
+  // Further related optional virtual functions...
+  void BeginPrimitives(const G4Transform3D& objectTransformation);
+  void EndPrimitives();
+
+  ////////////////////////////////////////////////////////////////
+  // Further optional virtual functions...
+
+  // void BeginModeling();
+  // void EndModeling();
+
+  //////////////////////////////////////////////////////////////
+  // Administration functions.
+
+  void ClearStore ();
+  void ClearTransientStore ();
+
+protected:
+
+  static G4int fSceneIdCount;  // Counter for XXXSG scene handlers.
+
+  // Utility for PreAddSolid and BeginPrimitives.
+  void CreateCurrentItem(const G4String&);
+
+  //?? Define the scene graph.  (For emulation, a tree class by Troy
+  //?? A. Johnson, tajohnson@ieee.orglist.  Unfortunately, it does
+  //?? not compile with SUN CC, hence #ifdef G4VIS_BUILD_XXXSG_DRIVER.)
+  typedef taj::tree<G4String> SceneGraph;
+  typedef taj::tree<G4String>::iterator SceneGraphIterator;
+  SceneGraph fSceneGraph;
+  SceneGraphIterator fRoot, fPermanentsRoot, fTransientsRoot, fCurrentItem;
+
+  // Keep track of mothers...
+  std::map<const G4LogicalVolume*,SceneGraphIterator> fLVMap;
+  typedef std::map<const G4LogicalVolume*,SceneGraphIterator>::iterator
+  LVMapIterator;
+
+private:
+
+#ifdef G4XXXFileDEBUG
+  void PrintThings();
+#endif
+
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/XXX/include/G4XXXSGViewer.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/include/G4XXXSGViewer.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/include/G4XXXSGViewer.hh	(revision 1102)
@@ -0,0 +1,59 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4XXXSGViewer.hh,v 1.2 2006/06/29 21:26:58 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  10th March 2006
+// A template for a sophisticated graphics driver with a scene graph.
+//?? Lines beginning like this require specialisation for your driver.
+
+#ifdef G4VIS_BUILD_XXXSG_DRIVER
+
+#ifndef G4XXXSGVIEWER_HH
+#define G4XXXSGVIEWER_HH
+
+#include "G4VViewer.hh"
+
+class G4XXXSGViewer: public G4VViewer {
+public:
+  G4XXXSGViewer(G4VSceneHandler&,const G4String& name);
+  virtual ~G4XXXSGViewer();
+  void SetView();
+  void ClearView();
+  void DrawView();
+  void ShowView();
+protected:
+  void KernelVisitDecision ();
+  G4bool CompareForKernelVisit(G4ViewParameters&);
+  void DrawFromStore(const G4String& source);
+  G4ViewParameters fLastVP;  // Memory for making kernel visit decisions.
+};
+
+#endif
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/XXX/include/G4XXXSceneHandler.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/include/G4XXXSceneHandler.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/include/G4XXXSceneHandler.hh	(revision 1102)
@@ -0,0 +1,80 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4XXXSceneHandler.hh,v 1.21 2006/06/29 21:27:00 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  5th April 2001
+// A template for a simplest possible graphics driver.
+//?? Lines or sections marked like this require specialisation for your driver.
+
+#ifndef G4XXXSCENEHANDLER_HH
+#define G4XXXSCENEHANDLER_HH
+
+//#define G4XXXDEBUG  // Comment this out to suppress debug code.
+
+#include "G4VSceneHandler.hh"
+
+class G4XXXSceneHandler: public G4VSceneHandler {
+
+  friend class G4XXXViewer;
+
+public:
+  G4XXXSceneHandler(G4VGraphicsSystem& system,
+		      const G4String& name);
+  virtual ~G4XXXSceneHandler();
+
+  ////////////////////////////////////////////////////////////////
+  // Required implementation of pure virtual functions...
+
+  void AddPrimitive(const G4Polyline&);
+  void AddPrimitive(const G4Text&);
+  void AddPrimitive(const G4Circle&);
+  void AddPrimitive(const G4Square&);
+  void AddPrimitive(const G4Polyhedron&);
+  void AddPrimitive(const G4NURBS&);
+  // Further optional AddPrimitive methods.  Explicitly invoke base
+  // class methods if not otherwise defined to avoid warnings about
+  // hiding of base class methods.
+  void AddPrimitive(const G4Polymarker& polymarker)
+  {G4VSceneHandler::AddPrimitive (polymarker);}
+  void AddPrimitive(const G4Scale& scale)
+  {G4VSceneHandler::AddPrimitive (scale);}
+
+protected:
+
+  static G4int         fSceneIdCount;  // Counter for XXX scene handlers.
+
+private:
+
+#ifdef G4XXXDEBUG
+  void PrintThings();
+#endif
+
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/XXX/include/G4XXXStored.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/include/G4XXXStored.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/include/G4XXXStored.hh	(revision 1102)
@@ -0,0 +1,48 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4XXXStored.hh,v 1.2 2006/06/29 21:27:02 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  7th March 2006
+// A template for a graphics driver with a store/database.
+//?? Lines beginning like this require specialisation for your driver.
+
+#ifndef G4XXXStored_HH
+#define G4XXXStored_HH
+
+#include "G4VGraphicsSystem.hh"
+
+class G4XXXStored: public G4VGraphicsSystem {
+public:
+  G4XXXStored();
+  virtual ~G4XXXStored();
+  G4VSceneHandler* CreateSceneHandler(const G4String& name = "");
+  G4VViewer* CreateViewer (G4VSceneHandler&, const G4String& name = "");
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/XXX/include/G4XXXStoredSceneHandler.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/include/G4XXXStoredSceneHandler.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/include/G4XXXStoredSceneHandler.hh	(revision 1102)
@@ -0,0 +1,140 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4XXXStoredSceneHandler.hh,v 1.3 2006/06/29 21:27:06 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  7th March 2006
+// A template for a graphics driver with a store/database.
+//?? Lines beginning like this require specialisation for your driver.
+
+#ifndef G4XXXStoredSCENEHANDLER_HH
+#define G4XXXStoredSCENEHANDLER_HH
+
+#include "G4VSceneHandler.hh"
+
+#include <list>
+
+class G4XXXStoredSceneHandler: public G4VSceneHandler {
+
+  friend class G4XXXStoredViewer;
+
+public:
+  G4XXXStoredSceneHandler(G4VGraphicsSystem& system,
+			const G4String& name);
+  virtual ~G4XXXStoredSceneHandler();
+
+  ////////////////////////////////////////////////////////////////
+  // Optional virtual functions...
+  void AddSolid(const G4Box&);
+  // Further optional AddSolid functions.  Explicitly invoke base
+  // class methods if not otherwise defined to avoid warnings about
+  // hiding of base class methods.
+  void AddSolid(const G4Cons& cons)
+  {G4VSceneHandler::AddSolid(cons);}
+  void AddSolid(const G4Tubs& tubs)
+  {G4VSceneHandler::AddSolid(tubs);}
+  void AddSolid(const G4Trd& trd)
+  {G4VSceneHandler::AddSolid(trd);}
+  void AddSolid(const G4Trap& trap)
+  {G4VSceneHandler::AddSolid(trap);}
+  void AddSolid(const G4Sphere& sphere)
+  {G4VSceneHandler::AddSolid(sphere);}
+  void AddSolid(const G4Para& para)
+  {G4VSceneHandler::AddSolid(para);}
+  void AddSolid(const G4Torus& torus)
+  {G4VSceneHandler::AddSolid(torus);}
+  void AddSolid(const G4Polycone& polycone)
+  {G4VSceneHandler::AddSolid(polycone);}
+  void AddSolid(const G4Polyhedra& polyhedra)
+  {G4VSceneHandler::AddSolid(polyhedra);}
+  void AddSolid(const G4VSolid& solid)
+  {G4VSceneHandler::AddSolid(solid);}
+  // More optional functions...
+  // void AddCompound(const G4VTrajectory&);
+  // void AddCompound(const G4VHit&);
+  void PreAddSolid(const G4Transform3D& objectTransformation,
+		   const G4VisAttributes&);
+  void PostAddSolid();
+
+  ////////////////////////////////////////////////////////////////
+  // Required implementation of pure virtual functions...
+
+  void AddPrimitive(const G4Polyline&);
+  void AddPrimitive(const G4Text&);
+  void AddPrimitive(const G4Circle&);
+  void AddPrimitive(const G4Square&);
+  void AddPrimitive(const G4Polyhedron&);
+  void AddPrimitive(const G4NURBS&);
+  // Further optional AddPrimitive methods.  Explicitly invoke base
+  // class methods if not otherwise defined to avoid warnings about
+  // hiding of base class methods.
+  void AddPrimitive(const G4Polymarker& polymarker)
+  {G4VSceneHandler::AddPrimitive (polymarker);}
+  void AddPrimitive(const G4Scale& scale)
+  {G4VSceneHandler::AddPrimitive (scale);}
+  // Further related optional virtual functions...
+  void BeginPrimitives(const G4Transform3D& objectTransformation);
+  void EndPrimitives();
+
+  ////////////////////////////////////////////////////////////////
+  // Further optional virtual functions...
+
+  // void BeginModeling();
+  // void EndModeling();
+
+  //////////////////////////////////////////////////////////////
+  // Administration functions.
+
+  void ClearStore ();
+  void ClearTransientStore ();
+
+protected:
+
+  static G4int fSceneIdCount;  // Counter for XXXStored scene handlers.
+
+  //?? Define a store for your graphics system.  (For emulation, list
+  //?? has good properties - removal of items is fast and does not
+  //?? invalidate iterators to other elements.)
+  typedef std::list<G4String> Store;
+  typedef std::list<G4String>::iterator StoreIterator;
+  Store fStore;
+  StoreIterator fCurrentItem;
+
+  // Keep track of which items are permanent, which transient...
+  std::vector<StoreIterator> fPermanents;
+  std::vector<StoreIterator> fTransients;
+
+private:
+
+#ifdef G4XXXFileDEBUG
+  void PrintThings();
+#endif
+
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/XXX/include/G4XXXStoredViewer.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/include/G4XXXStoredViewer.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/include/G4XXXStoredViewer.hh	(revision 1102)
@@ -0,0 +1,55 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4XXXStoredViewer.hh,v 1.2 2006/06/29 21:27:17 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  7th March 2006
+// A template for a graphics driver with a store/database.
+//?? Lines beginning like this require specialisation for your driver.
+
+#ifndef G4XXXStoredVIEWER_HH
+#define G4XXXStoredVIEWER_HH
+
+#include "G4VViewer.hh"
+
+class G4XXXStoredViewer: public G4VViewer {
+public:
+  G4XXXStoredViewer(G4VSceneHandler&,const G4String& name);
+  virtual ~G4XXXStoredViewer();
+  void SetView();
+  void ClearView();
+  void DrawView();
+  void ShowView();
+protected:
+  void KernelVisitDecision ();
+  G4bool CompareForKernelVisit(G4ViewParameters&);
+  void DrawFromStore();
+  G4ViewParameters fLastVP;  // Memory for making kernel visit decisions.
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/XXX/include/G4XXXViewer.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/include/G4XXXViewer.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/include/G4XXXViewer.hh	(revision 1102)
@@ -0,0 +1,52 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4XXXViewer.hh,v 1.8 2006/06/29 21:27:20 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  5th April 2001
+// A template for a simplest possible graphics driver.
+//?? Lines or sections marked like this require specialisation for your driver.
+
+#ifndef G4XXXVIEWER_HH
+#define G4XXXVIEWER_HH
+
+//#define G4XXXDEBUG  // Comment this out to suppress debug code.
+
+#include "G4VViewer.hh"
+
+class G4XXXViewer: public G4VViewer {
+public:
+  G4XXXViewer(G4VSceneHandler&,const G4String& name);
+  virtual ~G4XXXViewer();
+  void SetView();
+  void ClearView();
+  void DrawView();
+  void ShowView();
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/XXX/include/tree/AUTHORS
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/include/tree/AUTHORS	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/include/tree/AUTHORS	(revision 1102)
@@ -0,0 +1,1 @@
+Troy A. Johnson, tajohnson@ieee.org
Index: tags/visualization-10.5-before-10.6_test/XXX/include/tree/COPYING
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/include/tree/COPYING	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/include/tree/COPYING	(revision 1102)
@@ -0,0 +1,27 @@
+Copyright (c) 2003-2006, Troy Aaron Johnson
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+  * Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+  * Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+  * Neither the name of Troy Aaron Johnson nor the names of any
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
Index: tags/visualization-10.5-before-10.6_test/XXX/include/tree/Changelog
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/include/tree/Changelog	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/include/tree/Changelog	(revision 1102)
@@ -0,0 +1,37 @@
+Version 0.5.0, 1/2/2006
+  - Realized that assignment to *i for const_iterators was
+    being allowed.  Fixed.
+  - Forced instantiation of whole template and caught
+    several typos (iterator in place of const_iterator, etc.)
+  - Can now find the size of subtrees using a size() method
+    of iterator or const_iterator
+  - i += n for sibling_iterators
+  - Added range constructor to build n-ary trees
+  - Allow conversion from iterator to const_iterator
+  - Added height() and height_leftmost() tree methods
+  - First serious attempt at pointer specialization.  It is
+    disabled by default because it is incomplete and programs
+    with only a few types of pointer trees will get larger.
+    If you have many different types of trees, then the program
+    size should increase less with specialization enabled.
+    Suggestions on the best way to implement specialization
+    are welcome.
+
+Version 0.2.1, 12/17/2005
+  - Compatible with gcc 4.0
+  - Pruning for const_preorder_iterator
+  - Added depth counter for iterators
+  - Added addition operator to sibling_iterators so that you can
+    do stuff like j = i + 1.
+
+Version 0.2.0, 04/05/2005
+  - Now compatible with gcc 3.4
+  - In between 0.1.0 and 0.2.0, the tree class saw
+    extensive use representing parse trees and various
+    other tree structures in my own programs.  Remaining
+    bugs are likely in methods I don't use very often
+    but provided because they seemed useful.
+
+Version 0.1.0, 07/18/2003
+  - very general tree template
+  - STL compatible
Index: tags/visualization-10.5-before-10.6_test/XXX/include/tree/bfs_iterator.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/include/tree/bfs_iterator.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/include/tree/bfs_iterator.h	(revision 1102)
@@ -0,0 +1,89 @@
+/*
+Copyright (c) 2003-2006, Troy Aaron Johnson
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+  * Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+  * Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+  * Neither the name of Troy Aaron Johnson nor the names of any
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+*/
+
+class bfs_iterator : public virtual iterator
+{
+  friend class tree;
+
+  private:
+
+    std::list<tree_node<N>*> queue;
+
+    typedef bool (*PruningPredicate)(const iterator& iter);
+    PruningPredicate prune_pred;
+
+    explicit bfs_iterator(tree_node<N>* current) : iterator(current), prune_pred(NULL) { }
+
+  public:
+
+    bfs_iterator(void) : prune_pred(NULL) { }
+    bfs_iterator(const iterator& iter) : iterator(iter), prune_pred(NULL) { }
+
+    bfs_iterator endBfs(void) { return bfs_iterator(NULL); }
+
+    bfs_iterator& operator ++ (void)
+    {
+      /* this line necessary for g++ 3.4 onward */
+      tree_node<N>*& current = this->current;
+
+      assert(current != NULL);
+
+      if (prune_pred == NULL || !prune_pred(*this))
+      {
+        for (tree_node<N>* p = current->first_child;
+             p != NULL; p = p->next_sibling)
+        {
+          queue.push_front(p);
+        }
+      }
+
+      if (queue.empty())
+      {
+        current = NULL;
+      }
+      else
+      {
+        current = queue.back();
+        queue.pop_back();
+      }
+
+      return *this;
+    }
+
+    /** When the iterator points to a node, and the pruning predicate
+     * returns true, the children of the node are not added to the BFS
+     * queue.  True means prune everything beneath the node passed
+     * to the predicate.  A NULL predicate disables pruning. */
+    void pruneOn(PruningPredicate prune_pred)
+    {
+      this->prune_pred = prune_pred;
+    }
+};
+
Index: tags/visualization-10.5-before-10.6_test/XXX/include/tree/const_bfs_iterator.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/include/tree/const_bfs_iterator.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/include/tree/const_bfs_iterator.h	(revision 1102)
@@ -0,0 +1,74 @@
+/*
+Copyright (c) 2003-2006, Troy Aaron Johnson
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+  * Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+  * Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+  * Neither the name of Troy Aaron Johnson nor the names of any
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+*/
+
+class const_bfs_iterator : public virtual const_iterator
+{
+  friend class tree;
+
+  private:
+
+    std::list<tree_node<N>*> queue;
+
+    explicit const_bfs_iterator(tree_node<N>* current) : const_iterator(current) { }
+
+  public:
+
+    const_bfs_iterator(void) { }
+    const_bfs_iterator(const const_iterator& iter) : const_iterator(iter) { }
+
+    const_bfs_iterator endBfs(void) const { return const_bfs_iterator(NULL); }
+
+    const_bfs_iterator& operator ++ (void)
+    {
+      /* this line necessary for g++ 3.4 onward */
+      tree_node<N>*& current = this->current;
+
+      assert(current != NULL);
+
+      for (tree_node<N>* p = current->first_child;
+           p != NULL; p = p->next_sibling)
+      {
+        queue.push_front(p);
+      }
+
+      if (queue.empty())
+      {
+        current = NULL;
+      }
+      else
+      {
+        current = queue.back();
+        queue.pop_back();
+      }
+
+      return *this;
+    }
+};
+
Index: tags/visualization-10.5-before-10.6_test/XXX/include/tree/const_iterator.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/include/tree/const_iterator.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/include/tree/const_iterator.cc	(revision 1102)
@@ -0,0 +1,43 @@
+/*
+Copyright (c) 2003-2006, Troy Aaron Johnson
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+  * Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+  * Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+  * Neither the name of Troy Aaron Johnson nor the names of any
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+*/
+
+template<class N>
+size_t tree<N>::const_iterator::size(void) const
+{
+  size_t s = 1;
+
+  for (typename tree<N>::const_sibling_iterator i(beginChildren());
+       i != endChildren(); ++i)
+  {
+    s += i.size();
+  }
+
+  return s;
+}
Index: tags/visualization-10.5-before-10.6_test/XXX/include/tree/const_iterator.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/include/tree/const_iterator.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/include/tree/const_iterator.h	(revision 1102)
@@ -0,0 +1,74 @@
+/*
+Copyright (c) 2003-2006, Troy Aaron Johnson
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+  * Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+  * Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+  * Neither the name of Troy Aaron Johnson nor the names of any
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/** An iterator that can be used to inspect the tree but not modify it.
+ */
+class const_iterator : public tree_iterator<N, const N&, const N*>
+{
+  friend class tree;
+
+  /* allows iterator to call the protected constructor below */
+  friend tree<N>::iterator::operator const_iterator() const;
+
+  private:
+
+    /* this typedef is very convenient and allows Java-like code */
+    typedef tree_iterator<N, const N&, const N*> super;
+
+  protected:
+
+    const_iterator(tree_node<N>* current) : super(current) { }
+
+  public:
+
+    const_iterator(void) { }
+    const_iterator(const const_iterator& iter) : super(iter) { }
+
+    typename super::reference
+    operator * (void) const { return this->current->data; }
+
+    typename super::pointer
+    operator -> (void) const { return &(this->current->data); }
+
+    const_sibling_iterator beginChildren(void) const
+    { return const_sibling_iterator(const_iterator(this->current->first_child)); }
+
+    const_sibling_iterator endChildren(void) const
+    { return const_sibling_iterator(const_iterator(NULL)); }
+
+    const_iterator parent(void) const
+    { return this->current->parent; }
+
+    /** Determines the size of the subtree below and including this position.
+     *
+     * @return The size of this subtree.
+     */
+    size_t size(void) const;
+};
Index: tags/visualization-10.5-before-10.6_test/XXX/include/tree/const_postorder_iterator.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/include/tree/const_postorder_iterator.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/include/tree/const_postorder_iterator.h	(revision 1102)
@@ -0,0 +1,58 @@
+/*
+Copyright (c) 2003-2006, Troy Aaron Johnson
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+  * Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+  * Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+  * Neither the name of Troy Aaron Johnson nor the names of any
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/** Iterates through the graph visiting parents after children and does not allow changes.
+ */
+class const_postorder_iterator : public virtual const_iterator
+{
+  friend class tree;
+
+  private:
+
+    explicit const_postorder_iterator(tree_node<N>* current) : const_iterator(current) { }
+
+  public:
+
+    const_postorder_iterator(void) { }
+    const_postorder_iterator(const const_iterator& iter) : const_iterator(iter) { }
+
+    const_postorder_iterator& operator++(void)
+    {
+      post_inc(this->current, this->iter_depth);
+      return *this;
+    }
+
+    const_postorder_iterator& operator--(void)
+    {
+      post_dec(this->current, this->iter_depth);
+      return *this;
+    }
+};
+
Index: tags/visualization-10.5-before-10.6_test/XXX/include/tree/const_preorder_iterator.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/include/tree/const_preorder_iterator.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/include/tree/const_preorder_iterator.h	(revision 1102)
@@ -0,0 +1,74 @@
+/*
+Copyright (c) 2003-2006, Troy Aaron Johnson
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+  * Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+  * Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+  * Neither the name of Troy Aaron Johnson nor the names of any
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/** Iterates through the graph visiting parents before children and does not allow changes.
+ */
+class const_preorder_iterator : public virtual const_iterator
+{
+  friend class tree;
+
+  private:
+
+    explicit const_preorder_iterator(tree_node<N>* current) : const_iterator(current) { }
+
+  public:
+
+    const_preorder_iterator(void) { }
+    const_preorder_iterator(const const_iterator& iter) : const_iterator(iter)    { }
+
+    const_preorder_iterator& operator++(void)
+    {
+      pre_inc(this->current, this->iter_depth);
+      return *this;
+    }
+
+    const_preorder_iterator& operator--(void)
+    {
+      pre_dec(this->current, this->iter_depth);
+      return *this;
+    }
+
+    /** Skips the children of this node and moves
+     * to what would normally be the next node
+     * had the children actually been visited. */
+    const_preorder_iterator& prune(void)
+    {
+      while (this->current->next_sibling == NULL)
+      {
+        this->current = this->current->parent;
+        this->iter_depth--;
+        if (this->current == NULL)
+          return *this;
+      }
+      this->current = this->current->next_sibling;
+
+      return *this;
+    }
+};
Index: tags/visualization-10.5-before-10.6_test/XXX/include/tree/const_sibling_iterator.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/include/tree/const_sibling_iterator.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/include/tree/const_sibling_iterator.h	(revision 1102)
@@ -0,0 +1,92 @@
+/*
+Copyright (c) 2003-2006, Troy Aaron Johnson
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+  * Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+  * Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+  * Neither the name of Troy Aaron Johnson nor the names of any
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/** Iterates through nodes that have the same parent and does not
+ * allow changes.
+ */
+class const_sibling_iterator : public virtual const_iterator
+{
+  friend class tree;
+
+  private:
+
+    explicit const_sibling_iterator(tree_node<N>* current) : const_iterator(current) { }
+
+  public:
+
+    const_sibling_iterator(void) { }
+    const_sibling_iterator(const const_iterator& iter) : const_iterator(iter) { }
+
+    const_sibling_iterator& operator++(void)
+    {
+      sib_inc(this->current);
+      return *this;
+    }
+
+    const_sibling_iterator operator ++ (int)
+    {
+      const_sibling_iterator tmp(*this);
+      sib_inc(this->current);
+      return tmp;
+    }
+
+    const_sibling_iterator& operator--(void)
+    {
+      sib_dec(this->current);
+      return *this;
+    }
+
+    const_sibling_iterator operator -- (int)
+    {
+      const_sibling_iterator tmp(*this);
+      sib_dec(this->current);
+      return tmp;
+    }
+
+    const_sibling_iterator operator + (unsigned int n) const
+    {
+      const_sibling_iterator i(*this);
+
+      while (n-- > 0)
+        ++i;
+
+      return i;
+    }
+
+    const_sibling_iterator operator - (unsigned int n) const
+    {
+      const_sibling_iterator i(*this);
+
+      while (n-- > 0)
+        --i;
+
+      return i;
+    }
+};
Index: tags/visualization-10.5-before-10.6_test/XXX/include/tree/iterator.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/include/tree/iterator.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/include/tree/iterator.cc	(revision 1102)
@@ -0,0 +1,361 @@
+/*
+Copyright (c) 2003-2006, Troy Aaron Johnson
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+  * Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+  * Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+  * Neither the name of Troy Aaron Johnson nor the names of any
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+*/
+
+template<class N>
+void tree<N>::iterator::clear(void)
+{
+  /* this line necessary for g++ 3.4 onward */
+  tree_node<N>*& current = this->current;
+
+  assert(current != NULL);
+
+  for (sibling_iterator i(beginChildren());
+       i != endChildren(); )
+  {
+    i.clear();
+    ++i;
+    (i - 1).destroy();
+  }
+
+  current->first_child = NULL;
+  current->last_child = NULL;
+}
+
+template<class N>
+typename tree<N>::iterator tree<N>::iterator::erase(void)
+{
+  tree_node<N>*& current = this->current;
+
+  assert(current != NULL);
+
+  /* remove all children and grandchildren */
+  clear();
+
+  /* make copies because there is an ordering
+     problem updating the previous and next links */
+  tree_node<N>* old_prev = current->prev_sibling;
+  tree_node<N>* old_next = current->next_sibling;
+
+  if (old_prev != NULL)
+    old_prev->next_sibling = old_next;
+
+  if (old_next != NULL)
+    old_next->prev_sibling = old_prev;
+
+  if (current->parent->first_child == current)
+    current->parent->first_child = old_next;
+
+  if (current->parent->last_child == current)
+    current->parent->last_child = old_prev;
+
+  /* destroy has no parameters, so gcc complains that it
+     can't find the method unless this is made explicit */
+  super::destroy();
+
+  return iterator(old_next);
+}
+
+template<class N>
+typename tree<N>::iterator tree<N>::iterator::insert(const N& data)
+{
+  tree_node<N>*& current = this->current;
+
+  assert(current != NULL);
+
+  tree_node<N>* p = new tree_node<N>(data);
+  p->parent = current->parent;
+  p->first_child = p->last_child = NULL;
+
+  p->prev_sibling = current->prev_sibling;
+  p->next_sibling = current;
+
+  if (current->prev_sibling != NULL)
+    current->prev_sibling->next_sibling = p;
+  else
+    current->parent->first_child = p;
+
+  current->prev_sibling = p;
+
+  return p;
+}
+
+template<class N>
+typename tree<N>::iterator tree<N>::iterator::insert(const tree<N>& t)
+{
+  assert(this->current != NULL);
+
+  return absorb_before(new tree<N>(t));
+}
+
+template<class N>
+typename tree<N>::iterator tree<N>::iterator::insert_after(const N& data)
+{
+  /* this line necessary for g++ 3.4 onward */
+  tree_node<N>*& current = this->current;
+
+  assert(current != NULL);
+
+  tree_node<N>* p = new tree_node<N>(data);
+  p->parent = current->parent;
+  p->first_child = p->last_child = NULL;
+
+  p->prev_sibling = current;
+  p->next_sibling = current->next_sibling;
+
+  if (current->next_sibling != NULL)
+    current->next_sibling->prev_sibling = p;
+  else
+    current->parent->last_child = p;
+
+  current->next_sibling = p;
+
+  return p;
+}
+
+template<class N>
+typename tree<N>::iterator tree<N>::iterator::insert_after(const tree<N>& t)
+{
+  assert(this->current != NULL);
+
+  return absorb_after(new tree<N>(t));
+}
+
+template<class N>
+void tree<N>::iterator::pop_back(void)
+{
+  /* this line necessary for g++ 3.4 onward */
+  tree_node<N>*& current = this->current;
+
+  assert(current != NULL);
+  assert(current->last_child != NULL);
+  assert(current->last_child->next_sibling == NULL);
+  
+  tree_node<N>* p = current->last_child;
+  current->last_child = p->prev_sibling;
+
+  if (p->prev_sibling != NULL)
+    p->prev_sibling->next_sibling = NULL;
+  else
+    current->first_child = NULL;
+
+  delete p;
+}
+
+template<class N>
+void tree<N>::iterator::pop_front(void)
+{
+  /* this line necessary for g++ 3.4 onward */
+  tree_node<N>*& current = this->current;
+
+  assert(current != NULL);
+  assert(current->first_child != NULL);
+  assert(current->first_child->prev_sibling == NULL);
+
+  tree_node<N>* p = current->first_child;
+  current->first_child = p->next_sibling;
+
+  if (p->next_sibling != NULL)
+    p->next_sibling->prev_sibling = NULL;
+  else
+    current->last_child = NULL;
+
+  delete p;
+}
+
+template<class N>
+typename tree<N>::iterator tree<N>::iterator::push_back(const N& data)
+{
+  /* this line necessary for g++ 3.4 onward */
+  tree_node<N>*& current = this->current;
+
+  assert(current != NULL);
+
+  tree_node<N>* p = new tree_node<N>(data);
+  p->parent = current;
+  p->first_child = p->last_child = NULL;
+
+  if (current->last_child == NULL)
+  {
+    current->first_child = current->last_child = p;
+    p->prev_sibling = p->next_sibling = NULL;
+  }
+  else
+  {
+    p->prev_sibling = current->last_child;
+    p->next_sibling = NULL;
+    current->last_child->next_sibling = p;
+    current->last_child = p;
+  }
+
+  return iterator(p);
+}
+
+template<class N>
+typename tree<N>::iterator tree<N>::iterator::push_back(const tree<N>& t)
+{
+  assert(this->current != NULL);
+
+  return absorb_back(new tree<N>(t));
+}
+
+template<class N>
+typename tree<N>::iterator tree<N>::iterator::push_front(const N& data)
+{
+  /* this line necessary for g++ 3.4 onward */
+  tree_node<N>*& current = this->current;
+
+  assert(current != NULL);
+
+  tree_node<N>* p = new tree_node<N>(data);
+  p->parent = current;
+  p->first_child = p->last_child = NULL;
+
+  if (current->first_child == NULL)
+  {
+    current->first_child = current->last_child = p;
+    p->prev_sibling = p->next_sibling = NULL;
+  }
+  else
+  {
+    p->prev_sibling = NULL;
+    p->next_sibling = current->first_child;
+    current->first_child->prev_sibling = p;
+    current->first_child = p; 
+  }
+
+  return iterator(p);
+}
+
+template<class N>
+typename tree<N>::iterator tree<N>::iterator::push_front(const tree<N>& t)
+{
+  assert(this->current != NULL);
+
+  return absorb_front(new tree<N>(t));
+}
+
+template<class N>
+N tree<N>::iterator::replace(const N& data)
+{
+  N ret(this->current->data);
+  this->current->data = data;
+  return ret;
+}
+
+template<class N>
+size_t tree<N>::iterator::size(void) const
+{
+  assert(this->current != NULL);
+
+  size_t s = 1;
+
+  for (typename tree<N>::sibling_iterator i(beginChildren());
+       i != endChildren(); ++i)
+  {
+    s += i.size();
+  }
+
+  return s;
+}
+
+template<class N>
+typename tree<N>::iterator tree<N>::iterator::splice_after(tree<N>& t)
+{
+  /* this line necessary for g++ 3.4 onward */
+  tree_node<N>*& current = this->current;
+
+  assert(current != NULL);
+
+  tree_node<N>* p = t.master->next_sibling;
+  t.master->next_sibling = t.master;
+  t.master->prev_sibling = t.master;
+
+  p->parent = current->parent;
+
+  p->prev_sibling = current;
+  p->next_sibling = current->next_sibling;
+
+  if (current->next_sibling != NULL)
+    current->next_sibling->prev_sibling = p;
+  else
+    current->parent->last_child = p;
+
+  current->next_sibling = p;
+
+  return p;
+}
+
+template<class N>
+typename tree<N>::iterator tree<N>::iterator::splice_back(tree<N>& t)
+{
+  /* this line necessary for g++ 3.4 onward */
+  tree_node<N>*& current = this->current;
+
+  assert(current != NULL);
+  assert(!t.empty());
+
+  tree_node<N>* p = t.master->next_sibling;
+  t.master->next_sibling = t.master;
+  t.master->prev_sibling = t.master;
+
+  p->parent = current;
+
+  if (current->last_child == NULL)
+  {
+    current->first_child = current->last_child = p;
+    p->prev_sibling = p->next_sibling = NULL;
+  }
+  else
+  {
+    p->prev_sibling = current->last_child;
+    p->next_sibling = NULL;
+    current->last_child->next_sibling = p;
+    current->last_child = p;
+  }
+
+  return p;
+}
+
+template<class N>
+typename tree<N>::iterator tree<N>::iterator::splice_before(tree<N>& t)
+{
+  /* TODO */
+  assert(false);
+  return NULL;
+}
+
+template<class N>
+typename tree<N>::iterator tree<N>::iterator::splice_front(tree<N>& t)
+{
+  /* TODO */
+  assert(false);
+  return NULL;
+}
+
Index: tags/visualization-10.5-before-10.6_test/XXX/include/tree/iterator.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/include/tree/iterator.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/include/tree/iterator.h	(revision 1102)
@@ -0,0 +1,251 @@
+/*
+Copyright (c) 2003-2006, Troy Aaron Johnson
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+  * Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+  * Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+  * Neither the name of Troy Aaron Johnson nor the names of any
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/** An iterator that can be used to modify the tree. Most of the methods
+ * provided by this class perform actions relative to the current position
+ * of the iterator.
+ */
+class iterator : public tree_iterator<N, N&, N*>
+{
+  friend class tree;
+
+  private:
+
+    /* this typedef is very convenient and allows Java-like code */
+    typedef tree_iterator<N, N&, N*> super;
+
+  protected:
+
+    iterator(tree_node<N>* current) : super(current) { }
+
+  public:
+
+    /** Creates an iterator that doesn't point to anything yet. */
+    iterator(void) { }
+
+    /** Copy constructor */
+    iterator(const iterator& iter) : super(iter) { }
+
+    /** Converts an iterator to a const_iterator.  This conversion
+     * is one-way; const_iterator does not have a corresponding
+     * conversion function to iterator.
+     */
+    operator const_iterator() const
+    { return const_iterator(this->current); }
+
+    typename super::reference
+    operator * (void) const { return this->current->data; }
+
+    typename super::pointer
+    operator -> (void) const { return &(this->current->data); }
+
+    /** Identical to the splice_after method except deletes the tree
+     * after performing the splice.
+     *
+     * @return An iterator pointing to the root of the absorbed tree.
+     */
+    iterator absorb_after(tree<N>* t)
+    {
+      assert(t != NULL);
+      assert(!t->empty());
+
+      iterator i = splice_after(*t);
+      delete t;
+      return i;
+    }
+
+    /** Identical to the splice_back method except deletes the tree
+     * after performing the splice.
+     *
+     * @return An iterator pointing to the root of the absorbed tree.
+     */
+    iterator absorb_back(tree<N>* t)
+    {
+#if !defined(TREE_NO_ERROR_CHECKING) && defined(TREE_EXCEPTIONS)
+      if (t == NULL || t->empty())
+      {
+        throw typename tree<N>::null_tree_exception("in absorb_back");
+      }
+#else
+      assert(t != NULL);
+      assert(!t->empty());
+#endif
+ 
+      iterator i = splice_back(*t);
+      delete t;
+      return i;
+    }
+
+    /** Identical to the splice_before method except deletes the tree
+     * after performing the splice.
+     *
+     * @return An iterator pointing to the root of the absorbed tree.
+     */
+    iterator absorb_before(tree<N>* t)
+    {
+      assert(t != NULL);
+      assert(!t->empty());
+
+      iterator i = splice_before(*t);
+      delete t;
+      return i;
+    }
+
+    /** Identical to the splice_front method except deletes the tree
+     * after performing the splice.
+     *
+     * @return An iterator pointing to the root of the absorbed tree.
+     */
+    iterator absorb_front(tree<N>* t)
+    {
+      assert(t != NULL);
+      assert(!t->empty());
+
+      iterator i = splice_front(*t);
+      delete t;
+      return i;
+    }
+
+    sibling_iterator beginChildren(void) const
+    { return sibling_iterator(iterator(this->current->first_child)); }
+
+    /** Removes all children and grandchildren of this node
+     */
+    void clear(void);
+
+    sibling_iterator endChildren(void) const
+    { return sibling_iterator(iterator(NULL)); } 
+
+    /** Removes this node and returns an iterator pointing
+     * to the next node. */
+    iterator erase(void);
+
+    /** Inserts a new node before this node and returns an
+     * iterator pointing to the new node. */
+    iterator insert(const N& data);
+
+    iterator insert(const tree<N>& t);
+
+    /** Inserts a new node after this node and returns an
+     * iterator pointing to the new node. */
+    iterator insert_after(const N& data);
+
+    iterator insert_after(const tree<N>& t); 
+
+    iterator parent(void) const
+    { return this->current->parent; }
+
+    /** Removes the last child of this node.
+     */
+    void pop_back(void);
+
+    /** Removes the first child of this node.
+     */
+    void pop_front(void);
+
+    /** Adds a node to the end of this position's child list.
+     *
+     * @param data Data for the new node.
+     *
+     * @return An iterator pointing to the new node. 
+     */
+    iterator push_back (const N& data);
+
+    /** Adds a copy of a tree to the end of this position's child list.
+     *
+     * @param t The tree to copy.
+     *
+     * @return An iterator pointing to the root of the inserted subtree.
+     */
+    iterator push_back (const tree<N>& t);
+
+    /** Adds a node to the beginning of this position's child list.
+     *
+     * @param data Data for the new node.
+     *
+     * @return An iterator pointing to the new node. 
+     */
+    iterator push_front(const N& data);
+
+    /** Adds a copy of a tree to the beginning of this position's child list.
+     *
+     * @param t The tree to copy.
+     *
+     * @return An iterator pointing to the root of the inserted subtree.
+     */
+    iterator push_front(const tree<N>& t);
+
+    /** Replaces the data at this position.
+     *
+     * @param data The new data.
+     *
+     * @return The old data.
+     */
+    N replace(const N& data);
+
+    /** Determines the size of the subtree below and including this position.
+     *
+     * @return The size of this subtree.
+     */
+    size_t size(void) const;
+
+    /** Moves nodes from a tree (without copying) such that
+     * the tree becomes the next sibling of this node.
+     *
+     * @param t The tree to move. It will be empty after this method returns.
+     *
+     * @return An iterator pointing to the root of the spliced tree.
+     */
+    iterator splice_after(tree<N>& t);
+
+    /** Moves nodes from a tree (without copying) such that the tree becomes the last child of this node.
+     *
+     * @param t The tree to move. It will be empty after this method returns.
+     *
+     * @return An iterator pointing to the root of the spliced tree.
+     */ 
+    iterator splice_back(tree<N>& t);
+
+    /** Moves nodes from a tree (without copying) such that the tree becomes the previous child of this node.
+     *
+     * @param t The tree to move. It will be empty after this method returns.
+     *
+     * @return An iterator pointing to the root of the spliced tree.
+     */
+    iterator splice_before(tree<N>& t);
+
+    /** Moves nodes from a tree (without copying) such that the tree becomes the first child of this node.
+     *
+     * @param t The tree to move. It will be empty after this method returns.
+     *
+     * @return An iterator pointing to the root of the spliced tree.
+     */
+    iterator splice_front(tree<N>& t);
+};
Index: tags/visualization-10.5-before-10.6_test/XXX/include/tree/postorder_iterator.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/include/tree/postorder_iterator.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/include/tree/postorder_iterator.h	(revision 1102)
@@ -0,0 +1,58 @@
+/*
+Copyright (c) 2003-2006, Troy Aaron Johnson
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+  * Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+  * Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+  * Neither the name of Troy Aaron Johnson nor the names of any
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/** Iterates through the graph visiting parents after children and allows changes.
+ */
+class postorder_iterator : public virtual iterator
+{
+  friend class tree;
+
+  private:
+
+    explicit postorder_iterator(tree_node<N>* current) : iterator(current) { }
+
+  public:
+
+    postorder_iterator(void) { }
+    postorder_iterator(const iterator& iter) : iterator(iter) { }
+
+    postorder_iterator& operator++(void)
+    {
+      post_inc(this->current, this->iter_depth);
+      return *this;
+    }
+
+    postorder_iterator& operator--(void)
+    {
+      post_dec(this->current, this->iter_depth);
+      return *this;
+    }
+};
+
Index: tags/visualization-10.5-before-10.6_test/XXX/include/tree/preorder_iterator.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/include/tree/preorder_iterator.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/include/tree/preorder_iterator.h	(revision 1102)
@@ -0,0 +1,58 @@
+/*
+Copyright (c) 2003-2006, Troy Aaron Johnson
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+  * Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+  * Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+  * Neither the name of Troy Aaron Johnson nor the names of any
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/** Iterates through the graph visiting parents before children and allows changes. 
+ */
+class preorder_iterator : public virtual iterator
+{
+  friend class tree;
+
+  private:
+
+    explicit preorder_iterator(tree_node<N>* current) : iterator(current) { }
+
+  public:
+
+    preorder_iterator(void) { }
+    preorder_iterator(const iterator& iter) : iterator(iter) { }
+
+    preorder_iterator& operator++(void)
+    {
+      pre_inc(this->current, this->iter_depth);
+      return *this;
+    }
+
+    preorder_iterator& operator--(void)
+    {
+      pre_dec(this->current, this->iter_depth);
+      return *this;
+    }
+};
+
Index: tags/visualization-10.5-before-10.6_test/XXX/include/tree/sibling_iterator.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/include/tree/sibling_iterator.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/include/tree/sibling_iterator.h	(revision 1102)
@@ -0,0 +1,108 @@
+/*
+Copyright (c) 2003-2006, Troy Aaron Johnson
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+  * Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+  * Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+  * Neither the name of Troy Aaron Johnson nor the names of any
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/** Iterates through nodes that have the same parent and allows changes.
+ */
+class sibling_iterator : public virtual iterator
+{
+  friend class tree;
+
+  private:
+
+    explicit sibling_iterator(tree_node<N>* current) : iterator(current) { }
+
+  public:
+
+    sibling_iterator(void) { }
+
+    sibling_iterator(const iterator& iter) : iterator(iter) { }
+
+    sibling_iterator& operator ++ (void)
+    {
+      sib_inc(this->current);
+      return *this;
+    }
+
+    sibling_iterator operator ++ (int)
+    {
+      sibling_iterator tmp(*this);
+      sib_inc(this->current);
+      return tmp;
+    }
+
+    sibling_iterator& operator -- (void)
+    {
+      sib_dec(this->current);
+      return *this;
+    }
+
+    sibling_iterator operator -- (int)
+    {
+      sibling_iterator tmp(*this);
+      sib_dec(this->current);
+      return tmp;
+    }
+
+    sibling_iterator operator + (unsigned int n) const
+    {
+      sibling_iterator i(*this);
+
+      while (n-- > 0)
+        ++i;
+
+      return i;
+    }
+
+    sibling_iterator& operator += (unsigned int n)
+    {
+      while (n-- > 0)
+        sib_inc(this->current);
+
+      return *this;
+    }
+
+    sibling_iterator operator - (unsigned int n) const
+    {
+      sibling_iterator i(*this);
+
+      while (n-- > 0)
+        --i;
+
+      return i;
+    }
+
+    sibling_iterator& operator -= (unsigned int n)
+    {
+      while (n-- > 0)
+        sib_dec(this->current);
+
+      return *this;
+    }
+};
Index: tags/visualization-10.5-before-10.6_test/XXX/include/tree/tree.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/include/tree/tree.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/include/tree/tree.cc	(revision 1102)
@@ -0,0 +1,156 @@
+/*
+Copyright (c) 2003-2006, Troy Aaron Johnson
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+  * Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+  * Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+  * Neither the name of Troy Aaron Johnson nor the names of any
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+*/
+
+template <class N>
+template <class InputIterator>
+tree<N>::tree(InputIterator first, InputIterator last, unsigned int n)
+{
+  assert(n != 0);
+
+  createMaster();
+
+  if (first == last)
+    return;
+
+  setRoot(*first);
+
+  /* don't directly initialize i to first + 1 because not all STL
+     iterators support addition */
+  InputIterator i(first);
+  
+  if (++i == last)
+    return;
+
+  /* Make a list of leaves. Initially the list contains only the
+     root.  Pick a leaf and add items to it until it is full.
+     Added items become new leaves.  Continue until there
+     are no more items */
+
+  std::list<typename tree<N>::iterator> leaves;
+  leaves.push_back(getRoot());
+
+  for (;;)
+  {
+    typename tree<N>::iterator leaf(leaves.front());
+
+    for (unsigned int k = 0; k < n; ++k)
+    {
+      leaves.push_back(leaf.push_back(*i));
+
+      if (++i == last)
+        return; 
+    }
+
+    leaves.pop_front();
+  }
+}
+
+template <class N>
+void tree<N>::copy_subtree(tree<N>::const_iterator subtree)
+{
+  /* Copying replaces this tree. */
+  clear();
+
+  /* Original is empty, so leave it empty. */
+  if (subtree == NULL)
+    return;
+
+  /* Copy the root data. */
+  sibling_iterator root(setRoot(*subtree));
+
+  /* Recursively copy the children. */ 
+  for (const_sibling_iterator i(subtree.beginChildren());
+       i != subtree.endChildren(); ++i)
+    root.absorb_back(new tree<N>(i));
+}
+
+template <class N>
+void tree<N>::clear(void)
+{
+  if (empty())
+    return;
+
+  /* delete all nodes bottom-up */
+  for (postorder_iterator i(beginPost()); i != endPost(); )
+  {
+    postorder_iterator tmp(i);
+    ++i;
+    tmp.destroy();
+  }
+
+  /* Preserve master invariant. */
+  master->first_child  = master->last_child   = NULL;
+  master->prev_sibling = master->next_sibling = master; 
+
+  /* Leave the master for the destructor. */
+}
+
+template <class N>
+size_t tree<N>::height(void) const
+{
+  size_t h = 0;
+
+  for (const_preorder_iterator i(beginPre()); i != endPre(); ++i)
+  {
+    if (static_cast<size_t>(i.depth() + 1) > h)
+      h = i.depth() + 1;
+  }
+
+  return h;
+}
+
+template <class N>
+size_t tree<N>::height_leftmost(void) const
+{
+  size_t h = 0;
+
+  tree_node<N>* p = master->next_sibling;
+
+  if (p != master)
+  {
+    do {
+      ++h;
+      p = p->first_child;
+    } while (p != NULL);
+  }  
+
+  return h;
+}
+
+template<class N>
+size_t tree<N>::size(void) const
+{
+  size_t s = 0;
+
+  for (const_preorder_iterator i(beginPre()); i != endPre(); ++i)
+    ++s;  
+
+  return s;
+} 
Index: tags/visualization-10.5-before-10.6_test/XXX/include/tree/tree.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/include/tree/tree.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/include/tree/tree.h	(revision 1102)
@@ -0,0 +1,871 @@
+/*
+Copyright (c) 2003-2006, Troy Aaron Johnson
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+  * Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+  * Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+  * Neither the name of Troy Aaron Johnson nor the names of any
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef TREE_H
+#define TREE_H
+
+#include <cassert>
+#include <list>
+#include <stdexcept>
+#include <string>
+
+/* master invariant checks are sprinkled throughout to check
+   for catastrophic errors */
+#if defined(TREE_NO_ERROR_CHECKING)
+#define TREE_MASTER_INVARIANT
+#else
+#if defined(TREE_EXCEPTIONS)
+#define TREE_MASTER_INVARIANT check_master_invariant()
+#else
+#define TREE_MASTER_INVARIANT assert(master != NULL); \
+  assert(master->next_sibling != NULL)
+#endif
+#endif
+
+/* experimental */
+// #define TREE_POINTER_SPECIALIZATION
+
+namespace taj  /* my initials */
+{
+
+/** Provides a generic n-ary acyclic tree container that behaves similarly
+ * to and is mostly compatible with other standard C++ templates.  Various
+ * iterators are provided, with pruning options.  Iterators are also used
+ * to represent subtrees. 
+ *
+ * In the spirit of the standard template library, the BSD license makes
+ * my tree class available for all to use.  I would appreciate receiving
+ * patches to fix any bugs you may discover or suggestions on how to
+ * improve the template.
+ *
+ * The STL list template was my initial inspiration for how to implement
+ * the tree class, but I determined there was little benefit from
+ * starting with that code.  This template class does not use any code
+ * from the STL classes, but is designed to be compatible and have similar
+ * method names for consistency.  I intend for this class to be very
+ * efficient in terms of size and speed, just like the STL classes.
+ * 
+ * The std::list template uses many supporting classes that are found in
+ * the std namespace or public in the std::list namespace.  This tree
+ * template does not pollute the global namespace as much by keeping all
+ * the supporting classes inside the main class.  If the user includes
+ * the taj namespace, the only name that gets sucked into the enclosing
+ * namespace is tree.  I feel this is a better design.  The following were
+ * some motivating factors:
+ *
+ * 1) The tree_node class should be invisible to the user. The user wants to
+ *    think of the N in tree<N> as the node type of the tree. In the standard
+ *    list template, struct _List_node is similarly irrelevant to the user
+ *    but unnecessarily appears in the std namespace.
+ *
+ * 2) The base template for the iterators should be a true class instead of a
+ *    wide-open struct.  Furthermore, it should not be accessible to the user.
+ *    A consequence of nesting the iterators inside the tree class is needing
+ *    to make the tree their friend, but this is an example of how to use
+ *    friends correctly.
+ *
+ * There is a lot of code here, so I have divided it into several header
+ * files and code files.  The only header the user needs to include is tree.h.
+ *
+ *   tree.h                       - the main header file for the tree class
+ *   tree_node.h                  - class that represents tree nodes
+ *   tree_iterator.h              - base class for ALL iterators
+ *   iterator.h                   - base class for ONLY non-const iterators
+ *   const_iterator.h             - base class for ONLY const_iterators
+ *   (const_)preorder_iterator.h  - iterators for preorder traversal
+ *   (const_)postorder_iterator.h - iterators for postorder traversal
+ *   (const_)bfs_iterator.h       - iterators for breadth-first traversal
+ *   (const_)sibling_iterator.h   - iterators for a single tree level
+ *
+ * There is no "in-order" traversal because the tree is not necessarily
+ * binary.  There are also .cc files which get included by this file, because
+ * all the code for the template needs to be in tree.h.
+ *
+ * Note concerning GCC 3.4: Template code checks are much stricter in 3.4.
+ * It is possible to have a template that compiles with GCC 3.3 but that does
+ * not compile with 3.4.  The following GCC "bug" reports explain the
+ * workarounds, which have been incorporated into this template class.
+ *
+ *   http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15552
+ *   http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17649
+ *
+ * The same issue has found its way into the C++ FAQ
+ *
+ *  http://www.parashift.com/c++-faq-lite/templates.html#faq-35.12
+ *  http://www.parashift.com/c++-faq-lite/templates.html#faq-35.13
+ *
+ * A final note: C++ template code is weird and classes as complicated as
+ * this one will give your compiler good exercise.  I have tested this
+ * class with the Debian releases of GCC 3.3.5, GCC 3.4.4, GCC 4.0.3 and
+ * I expect to use it with later versions.  I have no idea if it works
+ * under other C++ compilers.  If there are changes that will allow it to
+ * work under more compilers while still allowing it to work under GCC,
+ * then you are encouraged to suggest them.
+ *
+ * @author Troy A. Johnson
+ */
+template <class N>
+class tree
+{
+  private:
+
+    #include "tree_node.h"
+    #include "tree_iterator.h"
+
+    /** The real root of the tree as opposed to the first node inserted by
+     * the user. Also used as the end for preorder and postorder iterators
+     * since they finish by "falling off" the root of the tree.  (The
+     * breadth-first iterator uses NULL for its end because it falls off
+     * the leaves.)  As far as the user is concerned, the first node is
+     * master->next_sibling.  This corresponds to the _M_node in
+     * _List_alloc_base for the standard list template.
+     */
+    tree_node<N>* master;
+
+  public:
+
+    /* avoid annoying forward reference problems */
+
+    class iterator;
+    class const_iterator;
+
+    class sibling_iterator;
+    class const_sibling_iterator;
+
+    class preorder_iterator;
+    class const_preorder_iterator;
+
+    class postorder_iterator;
+    class const_postorder_iterator;
+
+    class bfs_iterator;
+    class const_bfs_iterator;
+
+    #include "iterator.h"
+    #include "const_iterator.h"
+
+    #include "sibling_iterator.h"
+    #include "const_sibling_iterator.h"
+
+    #include "preorder_iterator.h"
+    #include "const_preorder_iterator.h"
+
+    #include "postorder_iterator.h"
+    #include "const_postorder_iterator.h"
+
+    #include "bfs_iterator.h"
+    #include "const_bfs_iterator.h"
+
+    /* no dfs_iterator - use preorder_iterator instead */
+
+    /** Thrown if tree exceptions are turned on and a NULL is encountered
+     * in an incorrect place. */
+    class null_tree_exception : public std::runtime_error
+    {
+      public:
+        null_tree_exception(const std::string& s)
+          : std::runtime_error("null_tree_exception " + s) { }
+    };
+
+  private:
+
+#if !defined(TREE_NO_ERROR_CHECKING) && defined(TREE_EXCEPTIONS)
+    void check_master_invariant(void)
+    {
+      if (master == NULL)
+        throw new null_tree_exception("tree master is null");
+
+      if (master->next_sibling == NULL)
+        throw new null_tree_exception("tree master->next_sibling is null");
+    }
+#endif
+
+    /** Initializes the master node.  Every tree constructor needs to
+     * do this so it's a separate method.
+     */
+    void createMaster(void)
+    {
+      master = new tree_node<N>;
+      master->parent = NULL;
+      master->first_child  = master->last_child   = NULL;
+      master->prev_sibling = master->next_sibling = master;
+    }
+
+    /** Replaces this tree with copies of all nodes below (and including)
+     * the node pointed to by subtree.  Used by multiple constructors.
+     *
+     * @param subtree Location from which to begin copying.
+     */
+    void copy_subtree(const_iterator subtree);
+
+    /** Determines the leftmost child of this tree.
+     * Used as a starting point for postorder traversals.
+     *
+     * @return A pointer to the leftmost node or master if
+     *    the tree is empty.
+     */
+    tree_node<N>* leftmostChild(void) const
+    {
+      TREE_MASTER_INVARIANT;
+
+      tree_node<N>* p = master->next_sibling;
+
+      while (p->first_child != NULL)
+        p = p->first_child;
+
+      return p;
+    }
+
+  public:
+
+    /** Provides access to an iterator suitable for postorder traversal,
+     * initially pointing to the leftmost child of this tree.
+     *
+     * @return An iterator for postorder traversal.
+     */
+    postorder_iterator       beginPost(void)
+    { return postorder_iterator(leftmostChild()); }
+
+    /** Provides access to an iterator suitable for postorder traversal,
+     * initially pointing to the leftmost child of this tree.
+     *
+     * @return A constant iterator for postorder traversal.
+     */
+    const_postorder_iterator beginPost(void) const
+    { return const_postorder_iterator(leftmostChild()); }
+    
+    /** Provides access to an iterator representing the end of a 
+     * postorder traversal.
+     *
+     * @return The end of a postorder traversal.
+     */
+    postorder_iterator       endPost(void)
+    { return postorder_iterator(master); }
+
+    /** Provides access to an iterator representing the end of a 
+     * constant postorder traversal.
+     *
+     * @return The end of a constant postorder traversal.
+     */
+    const_postorder_iterator endPost(void) const
+    { return const_postorder_iterator(master); }
+
+    /** Provides access to an iterator suitable for preorder traversal,
+     * initially pointing to the root of this tree.
+     *
+     * @return An iterator for preorder traversal.
+     */
+    preorder_iterator        beginPre(void)
+    { return preorder_iterator(master->next_sibling); }
+
+    /** Provides access to an iterator suitable for preorder traversal,
+     * initially pointing to the root of this tree.
+     *
+     * @return A constant iterator for preorder traversal.
+     */
+    const_preorder_iterator  beginPre(void) const
+    { return const_preorder_iterator(master->next_sibling); }
+
+    /** Provides access to an iterator representing the end of a 
+     * preorder traversal.
+     *
+     * @return The end of a preorder traversal.
+     */
+    preorder_iterator        endPre(void)
+    { return preorder_iterator(master); }
+
+    /** Provides access to an iterator representing the end of a 
+     * constant preorder traversal.
+     *
+     * @return The end of a constant preorder traversal.
+     */
+    const_preorder_iterator  endPre(void) const
+    { return const_preorder_iterator(master); }
+
+    /** Provides access to an iterator suitable for breadth-first traversal,
+     * initially pointing to the root of this tree.
+     *
+     * @return An iterator for breadth-first traversal.
+     */
+    bfs_iterator             beginBfs(void)
+    { return bfs_iterator(master->next_sibling); }
+
+    /** Provides access to an iterator suitable for breadth-first traversal,
+     * initially pointing to the root of this tree.
+     *
+     * @return A constant iterator for breadth-first traversal.
+     */
+    const_bfs_iterator       beginBfs(void) const
+    { return const_bfs_iterator(master->next_sibling); }
+
+    /** Provides access to an iterator representing the end of a
+     * breadth-first traversal.
+     *
+     * @return The end of a breadth-first traversal.
+     */
+    bfs_iterator             endBfs(void)
+    { return bfs_iterator(NULL); }
+
+    /** Provides access to an iterator representing the end of a
+     * constant breadth-first traversal.
+     *
+     * @return The end of a constant breadth-first traversal.
+     */
+    const_bfs_iterator       endBfs(void) const
+    { return const_bfs_iterator(NULL); }
+    
+    /** Creates an empty tree.  A root node can be created with setRoot later.
+     */
+    tree(void)
+    {
+      createMaster();
+    }
+
+    /** Creates a single-node tree.
+     *
+     * @param root_data The data to use for the root of the tree.
+     */
+    explicit tree(const N& root_data)
+    {
+      createMaster();
+      setRoot(root_data); 
+    } 
+
+    /** Copies an existing subtree.
+     *
+     * @param subtree The root of the original subtree
+     *    from which to make the copy.
+     */
+    explicit tree(const_iterator subtree)
+    {
+      createMaster();
+      copy_subtree(subtree);
+    }
+    
+    /** Copies an existing tree.
+     *
+     * @param orig The original tree from which to make the copy.
+     */
+    tree(const tree<N>& orig)
+    {
+      createMaster();
+      copy_subtree(orig.getRoot());
+    }
+
+    /** Creates a tree using copies of items of another container.
+     * The range copied is [first, last).
+     *
+     * @param first First item to put in the tree.
+     * @param last The item after the final item to put in the tree.
+     * @param n Creates a n-ary tree.  Must be greater than zero.
+     */
+    template <class InputIterator>
+    tree(InputIterator first, InputIterator last, unsigned int n);
+
+    /** Copies an existing tree.
+     *
+     * @param orig The original tree from which to make the copy.
+     *
+     * @return A reference to this tree to be used in chained assignments.
+     */ 
+    const tree<N>& operator = (const tree<N>& orig)
+    {
+      copy_subtree(orig.getRoot());
+      return *this;
+    }
+
+    /** Empties and destroys the tree.
+     */
+    virtual ~tree(void)
+    {
+      TREE_MASTER_INVARIANT;
+      clear();
+      delete master;
+    }
+
+    /** Empties the tree.  All nodes are deleted.  If the node type
+     * is a pointer, it is the user's responsibility to delete
+     * the data to which they point before clearing the tree.
+     */
+    void clear(void);
+
+    /** Checks if the tree is empty.
+     *
+     * @return true if the tree is empty, false otherwise.
+     */
+    bool empty(void) const
+    {
+      TREE_MASTER_INVARIANT;
+      return (master->next_sibling == master);
+    }
+
+    /** Provides access to the root of the tree.
+     *
+     * @return An iterator pointing at the root node.
+     */
+    iterator getRoot(void)
+    {
+      TREE_MASTER_INVARIANT;
+      return iterator(master->next_sibling);
+    }
+
+    /** Provides access to the root of an unmodifiable tree.
+     *
+     * @return An iterator pointing at the root node.
+     */
+    const_iterator getRoot(void) const
+    {
+      TREE_MASTER_INVARIANT;
+      return const_iterator(master->next_sibling);
+    }
+
+    /** Determines the height of the tree. This operation is
+     * general and is linear in the size of the tree, not
+     * the height.
+     *
+     * @return The height of the tree.
+     */
+    size_t height(void) const;
+
+    /** Determines the height of the tree using
+     * the leftmost grandchild of the root. This operation is
+     * guaranteed to be linear in the height of the tree, but
+     * may not be the true height for some trees.
+     *
+     * @return The height of the leftmost grandchild of the root.
+     */
+    size_t height_leftmost(void) const;
+
+    /** Sets the data of the root node, or creates one if it was not set
+     * when the tree was created.
+     *
+     * @return An iterator pointing to the root node.
+     */
+    iterator setRoot(const N& root_data)
+    {
+      if (empty())
+      {
+        tree_node<N>* root = new tree_node<N>(root_data);
+        root->parent = NULL; 
+        root->first_child = root->last_child = NULL;
+        root->next_sibling = root->prev_sibling = master;
+
+        master->prev_sibling = master->next_sibling = root;
+      }
+      else
+        *getRoot() = root_data;
+
+      return getRoot(); 
+    }
+
+    /** Determines the number of nodes in the tree.
+     * Unfortunately this requires a full tree traversal.
+     * This could be expensive, but it's far simpler than
+     * making iterators aware of what tree they are modifying
+     * and updating the current size of that tree. For simple
+     * insertion and deletion that might not be difficult,
+     * but for more complex operations it very well might be.
+     * Doing it this way makes size a known expensive operation
+     * instead of adding overhead to a large number of other calls.
+     * If the user knows how many nodes they have added or deleted
+     * since their last size call, then they can compute the current
+     * size without calling size. It should be noted that the
+     * standard library list template works the same way.
+     *
+     * @return The number of nodes in the tree.
+     */
+    size_t size(void) const;
+};
+
+#include "tree_iterator.cc"
+
+#include "iterator.cc"
+
+#include "const_iterator.cc"
+
+/* keep this include last */
+#include "tree.cc"
+
+/* TODO - Pointer specialization
+
+   This is experimental and may not work at all.
+*/
+
+#if defined(TREE_POINTER_SPECIALIZATION)
+template class tree<void*>;
+
+template <class N>
+class tree<N*> : private tree<void*>
+{
+  public:
+
+    /* do not prefix these forward declarations with tree<N*>:: */
+
+    class iterator;
+    class const_iterator;
+
+    class sibling_iterator;
+    class const_sibling_iterator;
+
+    class preorder_iterator;
+    class const_preorder_iterator;
+
+    class postorder_iterator;
+    class const_postorder_iterator;
+
+    class bfs_iterator;
+    class const_bfs_iterator;
+
+    class iterator : private virtual tree<void*>::iterator
+    {
+      friend class tree<N*>;
+
+      typedef class tree<N*>::iterator self;
+      typedef class tree<void*>::iterator super;
+
+      protected:
+
+        iterator(const super& iter) : super(iter) { }
+
+      public:
+
+        iterator(void) { }
+
+        iterator(const self& iter) : super(iter) { }
+
+//        operator const_iterator()
+//        { return static_cast<typename tree<void*>::const_iterator>(*this); }
+
+        bool operator == (const self& iter) const
+        { return super(*this) == super(iter); }
+
+        bool operator != (const self& iter) const
+        { return super(*this) != super(iter); }
+
+        using super::clear;
+
+        using super::depth;
+
+        typename tree<N*>::sibling_iterator beginChildren(void) const
+        { return self(super::beginChildren()); }
+
+        typename tree<N*>::sibling_iterator endChildren(void) const
+        { return self(super::endChildren()); }
+
+        N*&
+        operator * (void) const { return reinterpret_cast<N*&>(this->current->data); }
+
+        N**
+        operator -> (void) const { return reinterpret_cast<N**>(&(this->current->data)); }
+
+        self absorb_back(tree<N*>* t)
+        { return super::absorb_back(t); }
+
+        self push_back(N* data)
+        { return super::push_back(data); }
+
+        N* replace(N* data)
+        { return reinterpret_cast<N*>(super::replace(data)); }
+    };
+
+    class const_iterator : private virtual tree<void*>::const_iterator
+    {
+      friend class tree<N*>;
+
+      typedef class tree<N*>::const_iterator self;
+      typedef class tree<void*>::const_iterator super;
+
+      protected:
+
+        const_iterator(const super& iter) : super(iter) { }
+
+      public:
+
+        const_iterator(void) { }
+
+        const_iterator(const self& iter) : super(iter) { }
+
+        bool operator == (const self& iter) const
+        { return super(*this) == super(iter); }
+
+        bool operator != (const self& iter) const
+        { return super(*this) != super(iter); }
+
+        using super::depth;
+
+        N* const &
+        operator * (void) const { return reinterpret_cast<N* const &>(this->current->data); }
+
+        N* const *
+        operator -> (void) const { return reinterpret_cast<N* const *>(&(this->current->data)); }
+    };
+
+    class sibling_iterator : public tree<N*>::iterator, private tree<void*>::sibling_iterator
+    {
+      friend class tree<N*>;
+
+      private:
+
+        sibling_iterator(const tree<void*>::sibling_iterator& iter) : tree<N*>::iterator(iter) { }
+
+      public:
+
+        sibling_iterator(void) { }
+
+        sibling_iterator(const tree<N*>::iterator& iter) : tree<N*>::iterator(iter) { }
+
+        using tree<N*>::iterator::operator *;
+
+        typename tree<N*>::sibling_iterator& operator ++ (void)
+        { ++static_cast<tree<void*>::sibling_iterator>(*this); return *this; }
+    };
+#if 0
+    class const_sibling_iterator : public const_iterator
+    {
+      friend class tree<N*>;
+
+      private:
+
+//        const_sibling_iterator(const tree<void*>::const_sibling_iterator& iter) : const_iterator(iter) { }
+
+      public:
+
+        const_sibling_iterator(const const_iterator& iter) : const_iterator(iter) { }
+    };
+#endif
+    class preorder_iterator : public tree<N*>::iterator, private tree<void*>::preorder_iterator 
+    {
+      friend class tree<N*>;
+
+      private:
+
+        preorder_iterator(const tree<void*>::preorder_iterator& iter) : tree<N*>::iterator(iter) { }
+
+      public:
+
+        preorder_iterator(const tree<N*>::iterator& iter) : tree<N*>::iterator(iter) { }
+
+        using tree<N*>::iterator::operator ==;
+        using tree<N*>::iterator::operator !=;
+        using tree<N*>::iterator::operator *;
+
+        typename tree<N*>::preorder_iterator& operator ++ (void)
+        { ++static_cast<tree<void*>::preorder_iterator>(*this); return *this; }
+
+        using tree<N*>::iterator::replace;
+    };
+
+    class const_preorder_iterator : public tree<N*>::const_iterator, private tree<void*>::const_preorder_iterator
+    {
+      friend class tree<N*>;
+
+      private:
+
+        const_preorder_iterator(const tree<void*>::const_preorder_iterator& iter) : tree<void*>::const_preorder_iterator(iter) { }
+
+      public:
+
+        const_preorder_iterator(const tree<N*>::const_iterator& iter) : tree<N*>::const_iterator(iter) { }
+
+        using tree<N*>::const_iterator::operator *;
+
+        typename tree<N*>::const_preorder_iterator& operator ++ (void)
+        { ++static_cast<tree<void*>::const_preorder_iterator>(*this); return *this; }
+    };
+#if 0
+    class postorder_iterator : private tree<void*>::postorder_iterator
+    {
+      friend class tree<N*>;
+
+      private:
+
+//        postorder_iterator(const tree<void*>::postorder_iterator& iter) : iterator(iter) { }
+
+      public:
+
+        postorder_iterator(const iterator& iter) : tree<void*>::postorder_iterator(iter) { }
+    };
+
+    class const_postorder_iterator : private tree<void*>::const_postorder_iterator
+    {
+      friend class tree<N*>;
+
+      private:
+
+//        const_postorder_iterator(const tree<void*>::const_postorder_iterator& iter) : const_iterator(iter) { }
+
+      public:
+
+        const_postorder_iterator(const const_iterator& iter) : tree<void*>::const_postorder_iterator(iter) { }
+    };
+
+    class bfs_iterator : private tree<void*>::bfs_iterator
+    {
+      friend class tree<N*>;
+
+      private:
+
+//        bfs_iterator(const tree<void*>::bfs_iterator& iter) : iterator(iter) { }
+
+      public:
+
+        bfs_iterator(const iterator& iter) : tree<void*>::bfs_iterator(iter) { }
+    };
+
+    class const_bfs_iterator : private tree<void*>::const_bfs_iterator
+    {
+      friend class tree<N*>;
+
+      private:
+
+//        const_bfs_iterator(const tree<void*>::const_bfs_iterator& iter) : const_iterator(iter) { }
+
+      public:
+
+        const_bfs_iterator(const const_iterator& iter) : tree<void*>::const_bfs_iterator(iter) { }
+    };
+#endif
+    tree(void) : tree<void*>::tree()
+    {
+    }
+
+    /** Creates a single-node tree.
+     *
+     * @param root_data The data to use for the root of the tree.
+     */
+    explicit tree(N* root_data) : tree<void*>::tree(root_data)
+    {
+    }
+
+    explicit tree(const_iterator subtree) : tree<void*>::tree(subtree)
+    {
+    }
+
+    tree(const tree<N*>& orig) : tree<void*>::tree(orig)
+    {
+    }
+
+    preorder_iterator        beginPre(void)
+    { return tree<void*>::beginPre(); }
+
+    const_preorder_iterator  beginPre(void) const
+    { return tree<void*>::beginPre(); }
+
+    preorder_iterator        endPre(void)
+    { return tree<void*>::endPre(); }
+
+    const_preorder_iterator  endPre(void) const
+    { return tree<void*>::endPre(); }
+
+    iterator getRoot(void)
+    { return tree<void*>::getRoot(); }
+
+    const_iterator getRoot(void) const
+    { return tree<void*>::getRoot(); }
+
+    iterator setRoot(N* root_data)
+    { return tree<void*>::setRoot(root_data); }
+};
+
+#if 0
+template class tree<void*>;
+template class tree<void*>::tree_node<void*>;
+
+template <class N>
+class tree<N*> : public tree<void*>
+{
+  public:
+
+//    class const_iterator;
+
+  private:
+
+    template <class T>
+    class tree_node<T*> : public tree_node<void*>
+    {
+      public:
+
+        tree_node(void) : tree_node<void*>() { }
+
+        tree_node(T* data) : tree_node<void*>(data) { }
+    }; 
+/*
+    template <class T, class R, class P>
+    class tree_iterator<T*, R*, P*> : public tree_iterator<void*, void*&, void**>
+    {
+
+    };
+*/
+  public:
+
+    tree(void) : tree<void*>()
+    {
+      std::cout << "specialized tree default constructor" << std::endl;
+    }
+
+    explicit tree(N* root_data) : tree<void*>(root_data)
+    {
+    }
+};
+/*
+template<class N>
+class tree<N*>::iterator : public tree<N>::template tree_iterator<N*, N&, N*>
+{
+
+};
+*/
+
+template <class N>
+class tree<N*>::const_iterator : public tree<void*>::iterator
+{
+  private:
+
+    /* this typedef is very convenient and allows Java-like code */
+    typedef typename tree<N*>::template tree_iterator<N*, const N*&, const N**> super;
+
+  public:
+
+    typename super::reference
+    operator * (void) const { return this->current->data; }
+};
+
+//template <class N*>
+//typename tree<N*>::template tree_iterator<N*, const N*&, const N**>::reference
+//tree<N*>::template const_iterator::operator * (void) const
+//{ return this->current->data; }
+
+#endif
+#endif
+
+} /* namespace taj */
+
+#undef TREE_MASTER_INVARIANT
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/XXX/include/tree/tree_iterator.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/include/tree/tree_iterator.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/include/tree/tree_iterator.cc	(revision 1102)
@@ -0,0 +1,136 @@
+/*
+Copyright (c) 2003-2006, Troy Aaron Johnson
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+  * Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+  * Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+  * Neither the name of Troy Aaron Johnson nor the names of any
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+*/
+
+template<class N>
+template<class T, class R, class P>
+void tree<N>::tree_iterator<T, R, P>::post_inc(tree_node<N>*& current, long& depth)
+{
+  assert(current != NULL);
+
+  if (current->next_sibling == NULL)
+  {
+    current = current->parent;
+    depth--;
+  }
+  else
+  {
+    current = current->next_sibling;
+    while (current->first_child != NULL)
+    {
+      current = current->first_child;
+      depth++;
+    }
+  }
+}
+
+template<class N>
+template<class T, class R, class P>
+void tree<N>::tree_iterator<T, R, P>::post_dec(tree_node<N>*& current, long& depth)
+{
+  assert(current != NULL);
+
+  if(current->last_child == NULL)
+  {
+    while (current->prev_sibling == NULL)
+    {
+      current = current->parent;
+      depth--;
+    }
+
+    current = current->prev_sibling;
+  }
+  else
+  {
+    current = current->last_child;
+    depth++;
+  }
+}
+
+template<class N>
+template<class T, class R, class P>
+void tree<N>::tree_iterator<T, R, P>::pre_inc(tree_node<N>*& current, long& depth)
+{
+  assert(current != NULL);
+
+  if (current->first_child != NULL)
+  {
+    current = current->first_child;
+    depth++;
+  }
+  else
+  {
+    while (current->next_sibling == NULL)
+    {
+      current = current->parent;
+      depth--;
+      if (current == NULL)
+        return;
+    }
+    current = current->next_sibling; 
+  }
+}
+
+template<class N>
+template<class T, class R, class P>
+void tree<N>::tree_iterator<T, R, P>::pre_dec(tree_node<N>*& current, long& depth)
+{
+  assert(current != NULL);
+
+  if (current->prev_sibling)
+  {
+    current = current->prev_sibling;
+    while (current->last_child != NULL)
+    {
+      current = current->last_child;
+      depth++;
+    }
+  }
+  else
+  {
+    current = current->parent;
+    depth--;
+  }
+}
+
+template<class N>
+template<class T, class R, class P>
+inline void tree<N>::tree_iterator<T, R, P>::sib_inc(tree_node<N>*& current)
+{
+  if (current != NULL)
+    current = current->next_sibling;
+}
+
+template<class N>
+template<class T, class R, class P>
+inline void tree<N>::tree_iterator<T, R, P>::sib_dec(tree_node<N>*& current)
+{
+  if (current != NULL)
+    current = current->prev_sibling;
+}
Index: tags/visualization-10.5-before-10.6_test/XXX/include/tree/tree_iterator.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/include/tree/tree_iterator.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/include/tree/tree_iterator.h	(revision 1102)
@@ -0,0 +1,110 @@
+/*
+Copyright (c) 2003-2006, Troy Aaron Johnson
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+  * Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+  * Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+  * Neither the name of Troy Aaron Johnson nor the names of any
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/** The base template for all iterators.
+ */
+template <class T, class R, class P>
+class tree_iterator
+{
+  friend class tree;
+
+  protected:
+
+    /* The node pointed to by this iterator. */
+    tree_node<N>* current; 
+
+    /* This is the depth of an iterator relative to its starting position.
+       The starting depth is 0, the depth of the parent is -1, the depth
+       of any child is 1, the depth of any grandchild is 2, etc. */
+    long iter_depth;
+
+    /** Allows derived classes to create an iterator
+     * from a pointer to a node.  This constructor
+     * is not explicit because the tree_iterator class
+     * contains the == and != operators, which are used
+     * throughout the template to compare iterators
+     * to NULL.  The tree_iterator class is not visible
+     * to the user, so this implicit constructor is
+     * entirely for my convenience when coding the template.
+     *
+     * @param current Position for the new iterator
+     */ 
+    tree_iterator(tree_node<N>* current) : current(current), iter_depth(0L) { }
+
+    /** Destroys the node pointed to by this iterator.
+     */
+    void destroy(void)
+    {
+      delete current;
+      current = NULL;
+      iter_depth = 0L;
+    }
+
+    /* increment and decrement methods used by both the iterator
+       and the const_iterator versions of various iterators */
+  
+    static inline void post_inc(tree_node<N>*& current, long& depth);
+    static inline void post_dec(tree_node<N>*& current, long& depth);
+
+    static inline void pre_inc(tree_node<N>*& current, long& depth);
+    static inline void pre_dec(tree_node<N>*& current, long& depth);
+ 
+    static inline void sib_inc(tree_node<N>*& current);
+    static inline void sib_dec(tree_node<N>*& current);
+ 
+  public:
+
+    /* The following typedefs are required for compatibility
+     * with standard containers. */
+    
+    typedef std::bidirectional_iterator_tag iterator_category;
+    typedef T                               value_type;
+    typedef R                               reference;
+    typedef P                               pointer;
+    typedef size_t                          size_type;
+    typedef ptrdiff_t                       difference_type;
+
+    tree_iterator(void) : current(NULL), iter_depth(0L) { }
+
+    tree_iterator(const tree_iterator& iter)
+      : current(iter.current), iter_depth(iter.iter_depth) { }
+
+    /* note that depth is not relevant when comparing iterators */
+
+    bool operator == (const tree_iterator& iter) const
+    { return this->current == iter.current; }
+
+    bool operator != (const tree_iterator& iter) const
+    { return this->current != iter.current; }
+
+    long depth(void) const { return iter_depth; }
+
+    bool leaf(void) const { return this->first_child == NULL; }
+};
Index: tags/visualization-10.5-before-10.6_test/XXX/include/tree/tree_node.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/include/tree/tree_node.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/include/tree/tree_node.h	(revision 1102)
@@ -0,0 +1,49 @@
+/*
+Copyright (c) 2003-2006, Troy Aaron Johnson
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+  * Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+  * Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+  * Neither the name of Troy Aaron Johnson nor the names of any
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/** Provides a tree node used internally by the tree template. Overhead added
+ * to the user's node type is only five pointers, so 20 additional bytes on a
+ * 32-bit machine.
+ */
+template <class T>
+class tree_node
+{
+  public:
+
+    T data;
+
+    tree_node *parent;
+    tree_node *first_child,  *last_child; 
+    tree_node *prev_sibling, *next_sibling;
+
+    tree_node(void) { }
+
+    tree_node(const T& data) : data(data) { }
+};
Index: tags/visualization-10.5-before-10.6_test/XXX/include/tree/tree_test.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/include/tree/tree_test.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/include/tree/tree_test.cc	(revision 1102)
@@ -0,0 +1,146 @@
+/*
+Copyright (c) 2003-2006, Troy Aaron Johnson
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+  * Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+  * Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+  * Neither the name of Troy Aaron Johnson nor the names of any
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <algorithm>
+#include <cassert>
+#include <iostream>
+#include <list>
+#include <string>
+
+#include "tree.h"
+
+using namespace taj;
+
+bool pruning_predicate(const tree<std::string>::iterator& node)
+{
+  return (*node == "B");
+}
+
+template <class TreeType>
+void print(const tree<TreeType>& t)
+{
+  std::cout << "preorder traversal: " << std::endl;
+  for (typename tree<TreeType>::const_preorder_iterator i = t.beginPre(); i != t.endPre(); ++i)
+  {
+    std::cout << *i << std::endl;
+  }
+  std::cout << std::endl;
+
+  std::cout << "postorder traversal: " << std::endl;
+  for (typename tree<TreeType>::const_postorder_iterator i = t.beginPost(); i != t.endPost(); ++i)
+  {
+    std::cout << *i << std::endl;
+  }
+  std::cout << std::endl;
+
+  std::cout << "bfs traversal: " << std::endl;
+  for (typename tree<TreeType>::const_bfs_iterator i = t.beginBfs(); i != i.endBfs(); ++i)
+  {
+    std::cout << *i << std::endl;
+  }
+  std::cout << std::endl;
+}
+
+void pointer_specialization_test(void)
+{
+  tree<int*> pint_tree;
+
+  int x = 1, y = 2, z = 3;
+
+  tree<int*>::iterator i(pint_tree.setRoot(&x));
+
+  i.push_back(&y);
+  i.push_back(&z);
+
+  std::cout << "int* tree root is " << **i << std::endl;
+
+  tree<int*>::sibling_iterator si(i.beginChildren());
+
+  tree<char*> t1;
+  tree<long*> t2;
+  tree<float*> t3;
+  tree<double*> t4;
+  tree<std::string*> t5;
+  tree<unsigned char*> t6;
+  tree<unsigned long*> t7;
+}
+
+int main(int argc, char* argv[])
+{
+  tree<std::string> t;
+
+  assert(t.empty());
+  assert(t.size() == 0);
+
+  tree<std::string>::sibling_iterator i(t.setRoot("root"));
+
+  assert(!t.empty());
+  assert(t.size() == 1);
+  assert(*i == "root");
+
+  *i = "new root";
+
+  assert(*i == "new root");
+
+  tree<std::string>::sibling_iterator j(i.push_back("left"));
+  assert(t.size() == 2);
+  tree<std::string>::sibling_iterator k(i.push_back("right"));
+  assert(t.size() == 3);
+
+  assert(*j == "left");
+  assert(*k == "right");
+
+  j.push_back("A");
+  j.push_back("B");
+
+  k.push_back("C");
+  k.push_back("D");
+
+  assert(find(t.beginPre(), t.endPre(), "C") != t.endPre());
+  assert(find(t.beginPre(), t.endPre(), "Z") == t.endPre());
+
+  std::cout << "tree height is " << t.height() << std::endl;
+
+  print(t);
+
+  tree<std::string> copy_of_t(t);
+
+  print(copy_of_t);
+
+  std::list<int> int_list;
+  for (int i = 1; i < 20; ++i)
+    int_list.push_back(i);
+
+  tree<int> int_tree(int_list.begin(), int_list.end(), 2);
+
+  print(int_tree);
+
+  pointer_specialization_test();
+}
Index: tags/visualization-10.5-before-10.6_test/XXX/src/G4XXX.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/src/G4XXX.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/src/G4XXX.cc	(revision 1102)
@@ -0,0 +1,75 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4XXX.cc,v 1.6 2006/06/29 21:27:22 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  5th April 2001
+// A template for a simplest possible graphics driver.
+//?? Lines or sections marked like this require specialisation for your driver.
+
+#include "G4XXX.hh"
+#include "G4XXXSceneHandler.hh"
+#include "G4XXXViewer.hh"
+
+G4XXX::G4XXX():
+  G4VGraphicsSystem("G4XXX",
+		    "XXX",
+		    "Simplest possible graphics driver",
+		    G4VGraphicsSystem::noFunctionality  //?? Your functionality
+		    )
+{}
+
+G4XXX::~G4XXX() {}
+
+G4VSceneHandler* G4XXX::CreateSceneHandler(const G4String& name) {
+  G4VSceneHandler* pScene = new G4XXXSceneHandler(*this, name);
+  return pScene;
+}
+
+G4VViewer* G4XXX::CreateViewer(G4VSceneHandler& scene,
+			       const G4String& name) {
+  G4VViewer* pView =
+    new G4XXXViewer((G4XXXSceneHandler&) scene, name);
+  if (pView) {
+    if (pView->GetViewId() < 0) {
+      G4cout <<
+	"G4XXX::CreateViewer: ERROR flagged by negative"
+        " view id in G4XXXViewer creation."
+        "\n Destroying view and returning null pointer."
+	     << G4endl;
+      delete pView;
+      pView = 0;
+    }
+  }
+  else {
+    G4cout <<
+      "G4XXX::CreateViewer: ERROR: null pointer on new G4XXXViewer."
+	   << G4endl;
+  }
+  return pView;
+}
Index: tags/visualization-10.5-before-10.6_test/XXX/src/G4XXXFile.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/src/G4XXXFile.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/src/G4XXXFile.cc	(revision 1102)
@@ -0,0 +1,75 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4XXXFile.cc,v 1.2 2006/06/29 21:27:24 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  7th March 2006
+// A template for a file-writing graphics driver.
+//?? Lines beginning like this require specialisation for your driver.
+
+#include "G4XXXFile.hh"
+#include "G4XXXFileSceneHandler.hh"
+#include "G4XXXFileViewer.hh"
+
+G4XXXFile::G4XXXFile():
+  G4VGraphicsSystem("G4XXXFile",
+		    "XXXFile",
+		    "File-writing graphics driver",
+		    G4VGraphicsSystem::threeD  //?? Your functionality
+		    )
+{}
+
+G4XXXFile::~G4XXXFile() {}
+
+G4VSceneHandler* G4XXXFile::CreateSceneHandler(const G4String& name) {
+  G4VSceneHandler* pScene = new G4XXXFileSceneHandler(*this, name);
+  return pScene;
+}
+
+G4VViewer* G4XXXFile::CreateViewer(G4VSceneHandler& scene,
+			       const G4String& name) {
+  G4VViewer* pView =
+    new G4XXXFileViewer((G4XXXFileSceneHandler&) scene, name);
+  if (pView) {
+    if (pView->GetViewId() < 0) {
+      G4cout <<
+	"G4XXXFile::CreateViewer: ERROR flagged by negative"
+        " view id in G4XXXFileViewer creation."
+        "\n Destroying view and returning null pointer."
+	     << G4endl;
+      delete pView;
+      pView = 0;
+    }
+  }
+  else {
+    G4cout <<
+      "G4XXXFile::CreateViewer: ERROR: null pointer on new G4XXXFileViewer."
+	   << G4endl;
+  }
+  return pView;
+}
Index: tags/visualization-10.5-before-10.6_test/XXX/src/G4XXXFileSceneHandler.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/src/G4XXXFileSceneHandler.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/src/G4XXXFileSceneHandler.cc	(revision 1102)
@@ -0,0 +1,280 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4XXXFileSceneHandler.cc,v 1.5 2006/07/03 16:52:49 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  7th March 2006
+// A template for a file-writing graphics driver.
+//?? Lines beginning like this require specialisation for your driver.
+
+#include "G4XXXFileSceneHandler.hh"
+
+#include "G4XXXFileViewer.hh"
+#include "G4PhysicalVolumeModel.hh"
+#include "G4VPhysicalVolume.hh"
+#include "G4LogicalVolume.hh"
+#include "G4Box.hh"
+#include "G4Polyline.hh"
+#include "G4Text.hh"
+#include "G4Circle.hh"
+#include "G4Square.hh"
+#include "G4Polyhedron.hh"
+#include "G4UnitsTable.hh"
+
+#include <sstream>
+
+G4int G4XXXFileSceneHandler::fSceneIdCount = 0;
+// Counter for XXX scene handlers.
+
+G4XXXFileSceneHandler::G4XXXFileSceneHandler(G4VGraphicsSystem& system,
+					     const G4String& name):
+  G4VSceneHandler(system, fSceneIdCount++, name)
+{}
+
+G4XXXFileSceneHandler::~G4XXXFileSceneHandler() {}
+
+#ifdef G4XXXFileDEBUG
+// Useful function...
+void G4XXXFileSceneHandler::PrintThings() {
+  G4cout <<
+    "  with transformation "
+         << (void*)fpObjectTransformation;
+  if (fpModel) {
+    G4cout << " from " << fpModel->GetCurrentDescription()
+	   << " (tag " << fpModel->GetCurrentTag()
+	   << ')';
+  } else {
+    G4cout << "(not from a model)";
+  }
+  G4PhysicalVolumeModel* pPVModel =
+    dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
+  if (pPVModel) {
+    G4cout <<
+      "\n  current physical volume: "
+           << pPVModel->GetCurrentPV()->GetName() <<
+      "\n  current logical volume: "
+           << pPVModel->GetCurrentLV()->GetName() <<
+      "\n  current depth of geometry tree: "
+           << pPVModel->GetCurrentDepth();
+  }
+  G4cout << G4endl;
+}
+#endif
+
+// Note: This function overrides G4VSceneHandler::AddSolid(const
+// G4Box&).  You may not want to do this, but this is how it's done if
+// you do.  Certain other specific solids may be treated this way -
+// see G4VSceneHandler.hh.  The simplest possible driver would *not*
+// implement these polymorphic functions, with the effect that the
+// default versions in G4VSceneHandler are used, which simply call
+// G4VSceneHandler::RequestPrimitives to turn the solid into a
+// G4Polyhedron usually.
+void G4XXXFileSceneHandler::AddSolid(const G4Box& box) {
+#ifdef G4XXXFileDEBUG
+  G4cout <<
+    "G4XXXFileSceneHandler::AddSolid(const G4Box& box) called for "
+	 << box.GetName()
+	 << G4endl;
+#endif
+  //?? Process your box...
+  std::ostringstream oss;
+  oss << "G4Box(" <<
+    G4String
+    (G4BestUnit
+     (G4ThreeVector
+      (box.GetXHalfLength(), box.GetYHalfLength(), box.GetZHalfLength()),
+      "Length")).strip() << ')';
+  dynamic_cast<G4XXXFileViewer*>(fpViewer)->
+    GetFileWriter().WriteItem(oss.str());
+}
+
+void G4XXXFileSceneHandler::AddPrimitive(const G4Polyline& polyline) {
+#ifdef G4XXXFileDEBUG
+  G4cout <<
+    "G4XXXFileSceneHandler::AddPrimitive(const G4Polyline& polyline) called.\n"
+	 << polyline
+	 << G4endl;
+#endif
+  // Get vis attributes - pick up defaults if none.
+  //const G4VisAttributes* pVA =
+  //  fpViewer -> GetApplicableVisAttributes (polyline.GetVisAttributes ());
+  //?? Process polyline.
+  std::ostringstream oss;
+  oss << polyline;
+  dynamic_cast<G4XXXFileViewer*>(fpViewer)->
+    GetFileWriter().WriteItem(oss.str());
+}
+
+void G4XXXFileSceneHandler::AddPrimitive(const G4Text& text) {
+#ifdef G4XXXFileDEBUG
+  G4cout <<
+    "G4XXXFileSceneHandler::AddPrimitive(const G4Text& text) called.\n"
+	 << text
+	 << G4endl;
+#endif
+  // Get text colour - special method since default text colour is
+  // determined by the default text vis attributes, which may be
+  // specified independent of default vis attributes of other types of
+  // visible objects.
+  //const G4Colour& c = GetTextColour (text);  // Picks up default if none.
+  //?? Process text.
+  std::ostringstream oss;
+  oss << text;
+  dynamic_cast<G4XXXFileViewer*>(fpViewer)->
+    GetFileWriter().WriteItem(oss.str());
+}
+
+void G4XXXFileSceneHandler::AddPrimitive(const G4Circle& circle) {
+#ifdef G4XXXFileDEBUG
+  G4cout <<
+    "G4XXXFileSceneHandler::AddPrimitive(const G4Circle& circle) called.\n  "
+	 << circle
+	 << G4endl;
+  MarkerSizeType sizeType;
+  G4double size = GetMarkerSize (circle, sizeType);
+  switch (sizeType) {
+  default:
+  case screen:
+    // Draw in screen coordinates.
+    G4cout << "screen";
+    break;
+  case world:
+    // Draw in world coordinates.
+    G4cout << "world";
+    break;
+  }
+  G4cout << " size: " << size << G4endl;
+#endif
+  // Get vis attributes - pick up defaults if none.
+  //const G4VisAttributes* pVA =
+  //  fpViewer -> GetApplicableVisAttributes (circle.GetVisAttributes ());
+  //?? Process circle.
+  std::ostringstream oss;
+  oss << circle;
+  dynamic_cast<G4XXXFileViewer*>(fpViewer)->
+    GetFileWriter().WriteItem(oss.str());
+}
+
+void G4XXXFileSceneHandler::AddPrimitive(const G4Square& square) {
+#ifdef G4XXXFileDEBUG
+  G4cout <<
+    "G4XXXFileSceneHandler::AddPrimitive(const G4Square& square) called.\n"
+	 << square
+	 << G4endl;
+  MarkerSizeType sizeType;
+  G4double size = GetMarkerSize (square, sizeType);
+  switch (sizeType) {
+  default:
+  case screen:
+    // Draw in screen coordinates.
+    G4cout << "screen";
+    break;
+  case world:
+    // Draw in world coordinates.
+    G4cout << "world";
+    break;
+  }
+  G4cout << " size: " << size << G4endl;
+#endif
+  // Get vis attributes - pick up defaults if none.
+  //const G4VisAttributes* pVA =
+  //  fpViewer -> GetApplicableVisAttributes (square.GetVisAttributes ());
+  //?? Process square.
+  std::ostringstream oss;
+  oss << square;
+  dynamic_cast<G4XXXFileViewer*>(fpViewer)->
+    GetFileWriter().WriteItem(oss.str());
+}
+
+void G4XXXFileSceneHandler::AddPrimitive(const G4Polyhedron& polyhedron) {
+#ifdef G4XXXFileDEBUG
+  G4cout <<
+"G4XXXFileSceneHandler::AddPrimitive(const G4Polyhedron& polyhedron) called.\n"
+	 << polyhedron
+	 << G4endl;
+#endif
+  //?? Process polyhedron.
+  std::ostringstream oss;
+  oss << polyhedron;
+  dynamic_cast<G4XXXFileViewer*>(fpViewer)->
+    GetFileWriter().WriteItem(oss.str());
+
+  //?? Or... here are some ideas for decomposing into polygons...
+  //Assume all facets are convex quadrilaterals.
+  //Draw each G4Facet individually
+  
+  //Get colour, etc..
+  if (polyhedron.GetNoFacets() == 0) return;
+
+  // Get vis attributes - pick up defaults if none.
+  const G4VisAttributes* pVA =
+    fpViewer -> GetApplicableVisAttributes (polyhedron.GetVisAttributes ());
+
+  // Get view parameters that the user can force through the vis
+  // attributes, thereby over-riding the current view parameter.
+  G4ViewParameters::DrawingStyle drawing_style = GetDrawingStyle (pVA);
+  //G4bool isAuxEdgeVisible = GetAuxEdgeVisible (pVA);
+  
+  //Get colour, etc..
+  //const G4Colour& c = pVA -> GetColour ();
+  
+  // Initial action depending on drawing style.
+  switch (drawing_style) {
+  case (G4ViewParameters::hsr):
+    {
+      break;
+    }
+  case (G4ViewParameters::hlr):
+    {
+      break;
+    }
+  case (G4ViewParameters::wireframe):
+    {
+      break;
+    }
+  default:
+    {
+      break;
+    }     
+  }
+
+  // Loop through all the facets...
+
+  // Look at G4OpenGLSceneHandler::AddPrimitive(const G4Polyhedron&)
+  // for an example of how to get facets out of a G4Polyhedron,
+  // including how to cope with triangles if that's a problem.
+}
+
+void G4XXXFileSceneHandler::AddPrimitive(const G4NURBS&) {
+#ifdef G4XXXFileDEBUG
+  G4cout <<
+    "G4XXXFileSceneHandler::AddPrimitive(const G4NURBS& nurbs) called."
+	 << G4endl;
+#endif
+  //?? Don't bother implementing this.  NURBS are not functional.
+}
Index: tags/visualization-10.5-before-10.6_test/XXX/src/G4XXXFileViewer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/src/G4XXXFileViewer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/src/G4XXXFileViewer.cc	(revision 1102)
@@ -0,0 +1,126 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4XXXFileViewer.cc,v 1.3 2006/07/03 16:52:49 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  7th March 2006
+// A template for a file-writing graphics driver.
+//?? Lines beginning like this require specialisation for your driver.
+
+#include "G4XXXFileViewer.hh"
+
+#include "G4VSceneHandler.hh"
+#include "G4XXXFileSceneHandler.hh"
+#include <sstream>
+
+void G4XXXFileViewer::FileWriter::Close()
+{
+  if (fOpen) {
+    G4cout << "Closing file " << fFileName << G4endl;
+    fFile.close();
+    fOpen = false;
+  }
+}
+
+void G4XXXFileViewer::FileWriter::WriteItem(const G4String& item)
+{
+  if (!fOpen)
+    {
+      std::ifstream ifs;
+      std::ostringstream oss;
+      G4int i = 0;
+      do {
+	oss.str("");
+	oss << "g4_" << i << ".XXXFile";
+	ifs.open(oss.str().c_str());
+	if (!ifs) break;  // Doesn't exist, so can open a new file.
+	else ifs.close();
+	++i;
+      } while(true);
+      fFileName = oss.str();
+      G4cout << "Opening file " << fFileName << G4endl;
+      fFile.open(fFileName.c_str());
+      fOpen = true;
+    }
+  if (fFile.good()) fFile << item << std::endl;
+  else G4cout << "G4XXXFileViewer::FileWriter::WriteItem: ERROR" << G4endl;
+}
+
+G4XXXFileViewer::G4XXXFileViewer
+(G4VSceneHandler& sceneHandler, const G4String& name):
+  G4VViewer(sceneHandler, sceneHandler.IncrementViewCount(), name)
+{}
+
+G4XXXFileViewer::~G4XXXFileViewer()
+{
+  fFileWriter.Close();
+}
+
+void G4XXXFileViewer::SetView() {
+#ifdef G4XXXFileDEBUG
+  G4cout << "G4XXXFileViewer::SetView() called." << G4endl;
+#endif
+}
+
+void G4XXXFileViewer::ClearView() {
+#ifdef G4XXXFileDEBUG
+  G4cout << "G4XXXFileViewer::ClearView() called." << G4endl;
+#endif
+  fFileWriter.Rewind();
+}
+
+void G4XXXFileViewer::DrawView() {
+#ifdef G4XXXFileDEBUG
+  G4cout << "G4XXXFileViewer::DrawView() called." << G4endl;
+#endif
+
+  // First, a view should decide when to re-visit the G4 kernel.
+  // Sometimes it might not be necessary, e.g., if the scene is stored
+  // in a graphical database (e.g., OpenGL's display lists) and only
+  // the viewing angle has changed.  But graphics systems without a
+  // graphical database will always need to visit the G4 kernel.
+
+  NeedKernelVisit ();  // Default is - always visit G4 kernel.
+  // Note: this routine sets the fNeedKernelVisit flag of *all* the
+  // views of the scene.
+
+  ProcessView ();      // The basic logic is here.
+
+  // Then a view may have more to do, e.g., display the graphical
+  // database.  That code should come here...
+
+  // ...before finally...
+  FinishView ();       // Flush streams and/or swap buffers.
+}
+
+void G4XXXFileViewer::ShowView() {
+#ifdef G4XXXFileDEBUG
+  G4cout << "G4XXXFileViewer::ShowView() called." << G4endl;
+#endif
+  fFileWriter.Close();
+}
Index: tags/visualization-10.5-before-10.6_test/XXX/src/G4XXXSG.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/src/G4XXXSG.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/src/G4XXXSG.cc	(revision 1102)
@@ -0,0 +1,77 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4XXXSG.cc,v 1.2 2006/06/29 21:27:33 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  10th March 2005
+// A template for a sophisticated graphics driver with a scene graph.
+//?? Lines or sections marked like this require specialisation for your driver.
+
+#ifdef G4VIS_BUILD_XXXSG_DRIVER
+
+#include "G4XXXSG.hh"
+#include "G4XXXSGSceneHandler.hh"
+#include "G4XXXSGViewer.hh"
+
+G4XXXSG::G4XXXSG():
+  G4VGraphicsSystem("G4XXXSG",
+		    "XXXSG",
+		    "Graphics driver with scene graph",
+		    G4VGraphicsSystem::threeD) {}  //?? Your functionality.
+
+G4XXXSG::~G4XXXSG() {}
+
+G4VSceneHandler* G4XXXSG::CreateSceneHandler(const G4String& name) {
+  G4VSceneHandler* pScene = new G4XXXSGSceneHandler(*this, name);
+  return pScene;
+}
+
+G4VViewer* G4XXXSG::CreateViewer(G4VSceneHandler& scene,
+			       const G4String& name) {
+  G4VViewer* pView =
+    new G4XXXSGViewer((G4XXXSGSceneHandler&) scene, name);
+  if (pView) {
+    if (pView->GetViewId() < 0) {
+      G4cout <<
+	"G4XXXSG::CreateViewer: ERROR flagged by negative"
+        " view id in G4XXXSGViewer creation."
+        "\n Destroying view and returning null pointer."
+	     << G4endl;
+      delete pView;
+      pView = 0;
+    }
+  }
+  else {
+    G4cout <<
+      "G4XXXSG::CreateViewer: ERROR: null pointer on new G4XXXSGViewer."
+	   << G4endl;
+  }
+  return pView;
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/XXX/src/G4XXXSGSceneHandler.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/src/G4XXXSGSceneHandler.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/src/G4XXXSGSceneHandler.cc	(revision 1102)
@@ -0,0 +1,420 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4XXXSGSceneHandler.cc,v 1.6 2006/11/05 20:41:36 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  10th March 2006
+// A template for a sophisticated graphics driver with a scene graph.
+//?? Lines beginning like this require specialisation for your driver.
+
+#ifdef G4VIS_BUILD_XXXSG_DRIVER
+
+#include "G4XXXSGSceneHandler.hh"
+
+#include "G4XXXSGViewer.hh"
+#include "G4PhysicalVolumeModel.hh"
+#include "G4VPhysicalVolume.hh"
+#include "G4LogicalVolume.hh"
+#include "G4Box.hh"
+#include "G4Polyline.hh"
+#include "G4Text.hh"
+#include "G4Circle.hh"
+#include "G4Square.hh"
+#include "G4Polyhedron.hh"
+#include "G4UnitsTable.hh"
+
+#include <sstream>
+
+G4int G4XXXSGSceneHandler::fSceneIdCount = 0;
+// Counter for XXX scene handlers.
+
+G4XXXSGSceneHandler::G4XXXSGSceneHandler(G4VGraphicsSystem& system,
+					     const G4String& name):
+  G4VSceneHandler(system, fSceneIdCount++, name)
+{
+  fRoot = fSceneGraph.setRoot("\nroot\n");
+  fPermanentsRoot = fRoot.push_back("\npermanentsRoot\n");
+  fTransientsRoot = fRoot.push_back("\ntransientsRoot\n");
+}
+
+G4XXXSGSceneHandler::~G4XXXSGSceneHandler() {}
+
+#ifdef G4XXXSGDEBUG
+// Useful function...
+void G4XXXSGSceneHandler::PrintThings() {
+  G4cout <<
+    "  with transformation "
+         << (void*)fpObjectTransformation;
+  if (fpModel) {
+    G4cout << " from " << fpModel->GetCurrentDescription()
+	   << " (tag " << fpModel->GetCurrentTag()
+	   << ')';
+  } else {
+    G4cout << "(not from a model)";
+  }
+  G4PhysicalVolumeModel* pPVModel =
+    dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
+  if (pPVModel) {
+    G4cout <<
+      "\n  current physical volume: "
+           << pPVModel->GetCurrentPV()->GetName() <<
+      "\n  current logical volume: "
+           << pPVModel->GetCurrentLV()->GetName() <<
+      "\n  current depth of geometry tree: "
+           << pPVModel->GetCurrentDepth();
+  }
+  G4cout << G4endl;
+}
+#endif
+
+void G4XXXSGSceneHandler::CreateCurrentItem(const G4String& header) {
+  // Utility for PreAddSolid and BeginPrimitives.
+  
+  G4PhysicalVolumeModel* pPVModel =
+    dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
+  
+  if (pPVModel) {
+
+    // This call comes from a G4PhysicalVolumeModel.  drawnPVPath is
+    // the path of the current drawn (non-culled) volume in terms of
+    // drawn (non-culled) ancesters.  Each node is identified by a
+    // PVNodeID object, which is a physical volume and copy number.  It
+    // is a vector of PVNodeIDs corresponding to the geometry hierarchy
+    // actually selected, i.e., not culled.
+    typedef G4PhysicalVolumeModel::G4PhysicalVolumeNodeID PVNodeID;
+    typedef std::vector<PVNodeID> PVPath;
+    const PVPath& drawnPVPath = pPVModel->GetDrawnPVPath();
+    //G4int currentDepth = pPVModel->GetCurrentDepth();
+    //G4VPhysicalVolume* pCurrentPV = pPVModel->GetCurrentPV();
+    G4LogicalVolume* pCurrentLV = pPVModel->GetCurrentLV();
+    //G4Material* pCurrentMaterial = pPVModel->GetCurrentMaterial();
+    // Note: pCurrentMaterial may be zero (parallel world).
+
+    // The simplest algorithm, used by the Open Inventor Driver
+    // developers, is to rely on the fact the G4PhysicalVolumeModel
+    // traverses the geometry hierarchy in an orderly manner.  The last
+    // mother, if any, will be the node to which the volume should be
+    // added.  So it is enough to keep a map of scene graph nodes keyed
+    // on the volume path ID.  Actually, it is enough to use the logical
+    // volume as the key.  (An alternative would be to keep the PVNodeID
+    // in the tree and match the PVPath from the root down.)
+
+    // Find mother.  ri points to drawn mother, if any.
+    PVPath::const_reverse_iterator ri = ++drawnPVPath.rbegin();
+    if (ri != drawnPVPath.rend()) {
+      // This volume has a mother.
+      G4LogicalVolume* drawnMotherLV =
+	ri->GetPhysicalVolume()->GetLogicalVolume();
+      LVMapIterator mother = fLVMap.find(drawnMotherLV);
+      if (mother != fLVMap.end()) {
+	// This adds a child in Troy's tree...
+	fCurrentItem = mother->second.push_back(header);
+      } else {
+	// Mother not previously encountered.  Shouldn't happen, since
+	// G4PhysicalVolumeModel sends volumes as it encounters them,
+	// i.e., mothers before daughters, in its descent of the
+	// geometry tree.  Error!
+	G4cout << "ERROR: G4XXXSGSceneHandler::PreAddSolid: Mother "
+	       << ri->GetPhysicalVolume()->GetName()
+	       << ':' << ri->GetCopyNo()
+	       << " not previously encountered."
+	  "\nShouldn't happen!  Please report to visualization coordinator."
+	       << G4endl;
+	// Continue anyway.  Add to root of scene graph tree...
+	fCurrentItem = fPermanentsRoot.push_back(header);
+      }
+    } else {
+      // This volume has no mother.  Must be a top level un-culled
+      // volume.  Add to root of scene graph tree...
+      fCurrentItem = fPermanentsRoot.push_back(header);
+    }
+
+    std::ostringstream oss;
+    oss << "Path of drawn PVs: ";
+    for (PVPath::const_iterator i = drawnPVPath.begin();
+	 i != drawnPVPath.end(); ++i) {
+      oss << '/' << i->GetPhysicalVolume()->GetName()
+	  << ':' << i->GetCopyNo();
+    }
+    oss << std::endl;
+    *fCurrentItem += oss.str();
+
+    // Store for future searches.  Overwrites previous entries for this
+    // LV, so entry is always the *last* LV.
+    fLVMap[pCurrentLV] = fCurrentItem;
+
+  } else {  // Not from a G4PhysicalVolumeModel.
+
+    // Create a place for current solid in root...
+    if (fReadyForTransients) {
+      fCurrentItem = fTransientsRoot.push_back(header);
+    } else {
+      fCurrentItem = fPermanentsRoot.push_back(header);
+    }
+  }
+}
+
+void G4XXXSGSceneHandler::PreAddSolid
+(const G4Transform3D& objectTransformation,
+ const G4VisAttributes& visAttribs)
+{  
+  G4VSceneHandler::PreAddSolid(objectTransformation, visAttribs);
+  CreateCurrentItem(G4String("\nPreAddSolid:\n"));
+}
+
+void G4XXXSGSceneHandler::PostAddSolid()
+{
+  *fCurrentItem += "EndSolid\n";
+  G4VSceneHandler::PostAddSolid();
+}
+
+void G4XXXSGSceneHandler::BeginPrimitives
+(const G4Transform3D& objectTransformation)
+{
+  G4VSceneHandler::BeginPrimitives(objectTransformation);
+
+  // If thread of control has already passed through PreAddSolid,
+  // avoid opening a graphical data base component again.
+  if (!fProcessingSolid) {
+    CreateCurrentItem(G4String("\nBeginPrimitives:\n"));
+  }
+}
+
+void G4XXXSGSceneHandler::EndPrimitives ()
+{
+  if (!fProcessingSolid) {  // Already done if so.
+    *fCurrentItem += "EndPrimitives\n";
+  }
+  G4VSceneHandler::EndPrimitives ();
+}
+
+// Note: This function overrides G4VSceneHandler::AddSolid(const
+// G4Box&).  You may not want to do this, but this is how it's done if
+// you do.  Certain other specific solids may be treated this way -
+// see G4VSceneHandler.hh.  The simplest possible driver would *not*
+// implement these polymorphic functions, with the effect that the
+// default versions in G4VSceneHandler are used, which simply call
+// G4VSceneHandler::RequestPrimitives to turn the solid into a
+// G4Polyhedron usually.
+// Don't forget, solids can be transients too (e.g., representing a hit).
+void G4XXXSGSceneHandler::AddSolid(const G4Box& box) {
+#ifdef G4XXXSGDEBUG
+  G4cout <<
+    "G4XXXSGSceneHandler::AddSolid(const G4Box& box) called for "
+	 << box.GetName()
+	 << G4endl;
+#endif
+  //?? Process your box...
+  std::ostringstream oss;
+  oss << "G4Box(" <<
+    G4String
+    (G4BestUnit
+     (G4ThreeVector
+      (box.GetXHalfLength(), box.GetYHalfLength(), box.GetZHalfLength()),
+      "Length")).strip() << ')' << std::endl;
+  *fCurrentItem += oss.str();
+}
+
+void G4XXXSGSceneHandler::AddPrimitive(const G4Polyline& polyline) {
+#ifdef G4XXXSGDEBUG
+  G4cout <<
+    "G4XXXSGSceneHandler::AddPrimitive(const G4Polyline& polyline) called.\n"
+	 << polyline
+	 << G4endl;
+#endif
+  // Get vis attributes - pick up defaults if none.
+  //const G4VisAttributes* pVA =
+  //  fpViewer -> GetApplicableVisAttributes (polyline.GetVisAttributes ());
+  //?? Process polyline.
+  std::ostringstream oss;
+  oss << polyline << std::endl;
+  *fCurrentItem += oss.str();
+}
+
+void G4XXXSGSceneHandler::AddPrimitive(const G4Text& text) {
+#ifdef G4XXXSGDEBUG
+  G4cout <<
+    "G4XXXSGSceneHandler::AddPrimitive(const G4Text& text) called.\n"
+	 << text
+	 << G4endl;
+#endif
+  // Get text colour - special method since default text colour is
+  // determined by the default text vis attributes, which may be
+  // specified independent of default vis attributes of other types of
+  // visible objects.
+  //const G4Colour& c = GetTextColour (text);  // Picks up default if none.
+  //?? Process text.
+  std::ostringstream oss;
+  oss << text << std::endl;
+  *fCurrentItem += oss.str();
+}
+
+void G4XXXSGSceneHandler::AddPrimitive(const G4Circle& circle) {
+#ifdef G4XXXSGDEBUG
+  G4cout <<
+    "G4XXXSGSceneHandler::AddPrimitive(const G4Circle& circle) called.\n"
+	 << circle
+	 << G4endl; 
+  MarkerSizeType sizeType;
+  G4double size = GetMarkerSize (circle, sizeType);
+  switch (sizeType) {
+  default:
+  case screen:
+    // Draw in screen coordinates.
+    G4cout << "screen";
+    break;
+  case world:
+    // Draw in world coordinates.
+    G4cout << "world";
+    break;
+  }
+  G4cout << " size: " << size << G4endl;
+#endif
+  // Get vis attributes - pick up defaults if none.
+  //const G4VisAttributes* pVA =
+  //  fpViewer -> GetApplicableVisAttributes (circle.GetVisAttributes ());
+  //?? Process circle.
+  std::ostringstream oss;
+  oss << circle << std::endl;
+  *fCurrentItem += oss.str();
+}
+
+void G4XXXSGSceneHandler::AddPrimitive(const G4Square& square) {
+#ifdef G4XXXSGDEBUG
+  G4cout <<
+    "G4XXXSGSceneHandler::AddPrimitive(const G4Square& square) called.\n"
+	 << square
+	 << G4endl;
+  MarkerSizeType sizeType;
+  G4double size = GetMarkerSize (square, sizeType);
+  switch (sizeType) {
+  default:
+  case screen:
+    // Draw in screen coordinates.
+    G4cout << "screen";
+    break;
+  case world:
+    // Draw in world coordinates.
+    G4cout << "world";
+    break;
+  }
+  G4cout << " size: " << size << G4endl;
+#endif
+  // Get vis attributes - pick up defaults if none.
+  //const G4VisAttributes* pVA =
+  //  fpViewer -> GetApplicableVisAttributes (square.GetVisAttributes ());
+  //?? Process square.
+  std::ostringstream oss;
+  oss << square << std::endl;
+  *fCurrentItem += oss.str();
+}
+
+void G4XXXSGSceneHandler::AddPrimitive(const G4Polyhedron& polyhedron) {
+#ifdef G4XXXSGDEBUG
+  G4cout <<
+ "G4XXXSGSceneHandler::AddPrimitive(const G4Polyhedron& polyhedron) called.\n"
+	 << polyhedron
+	 << G4endl;
+#endif
+  //?? Process polyhedron.
+  std::ostringstream oss;
+  oss << polyhedron;
+  *fCurrentItem += oss.str();
+
+  //?? Or... here are some ideas for decomposing into polygons...
+  //Assume all facets are convex quadrilaterals.
+  //Draw each G4Facet individually
+  
+  //Get colour, etc..
+  if (polyhedron.GetNoFacets() == 0) return;
+
+  // Get vis attributes - pick up defaults if none.
+  const G4VisAttributes* pVA =
+    fpViewer -> GetApplicableVisAttributes (polyhedron.GetVisAttributes ());
+
+  // Get view parameters that the user can force through the vis
+  // attributes, thereby over-riding the current view parameter.
+  G4ViewParameters::DrawingStyle drawing_style = GetDrawingStyle (pVA);
+  //G4bool isAuxEdgeVisible = GetAuxEdgeVisible (pVA);
+  
+  //Get colour, etc..
+  //const G4Colour& c = pVA -> GetColour ();
+  
+  // Initial action depending on drawing style.
+  switch (drawing_style) {
+  case (G4ViewParameters::hsr):
+    {
+      break;
+    }
+  case (G4ViewParameters::hlr):
+    {
+      break;
+    }
+  case (G4ViewParameters::wireframe):
+    {
+      break;
+    }
+  default:
+    {
+      break;
+    }     
+  }
+
+  // Loop through all the facets...
+
+  // Look at G4OpenGLSceneHandler::AddPrimitive(const G4Polyhedron&)
+  // for an example of how to get facets out of a G4Polyhedron,
+  // including how to cope with triangles if that's a problem.
+}
+
+void G4XXXSGSceneHandler::AddPrimitive(const G4NURBS& nurbs) {
+#ifdef G4XXXSGDEBUG
+  G4cout <<
+    "G4XXXSGSceneHandler::AddPrimitive(const G4NURBS& nurbs) called."
+	 << G4endl;
+#endif
+  //?? Don't bother implementing this.  NURBS are not functional.
+}
+
+void G4XXXSGSceneHandler::ClearStore () {
+
+  G4VSceneHandler::ClearStore ();  // Sets need kernel visit, etc.
+
+  fPermanentsRoot.clear();
+  fTransientsRoot.clear();
+  fLVMap.clear();
+}
+
+void G4XXXSGSceneHandler::ClearTransientStore () {
+
+  G4VSceneHandler::ClearTransientStore ();
+
+  fTransientsRoot.clear();
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/XXX/src/G4XXXSGViewer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/src/G4XXXSGViewer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/src/G4XXXSGViewer.cc	(revision 1102)
@@ -0,0 +1,173 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4XXXSGViewer.cc,v 1.4 2006/08/29 16:11:25 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  10th March 2006
+// A template for a sophisticated graphics driver with a scene graph.
+//?? Lines beginning like this require specialisation for your driver.
+
+#ifdef G4VIS_BUILD_XXXSG_DRIVER
+
+#include "G4XXXSGViewer.hh"
+
+#include "G4VSceneHandler.hh"
+#include "G4XXXSGSceneHandler.hh"
+
+#include <fstream>
+
+G4XXXSGViewer::G4XXXSGViewer
+(G4VSceneHandler& sceneHandler, const G4String& name):
+  G4VViewer(sceneHandler, sceneHandler.IncrementViewCount(), name)
+{}
+
+G4XXXSGViewer::~G4XXXSGViewer() {}
+
+void G4XXXSGViewer::SetView() {
+  //#ifdef G4XXXSGDEBUG
+  G4cout << "G4XXXSGViewer::SetView() called." << G4endl;
+  //#endif
+}
+
+void G4XXXSGViewer::ClearView() {
+  //#ifdef G4XXXSGDEBUG
+  G4cout << "G4XXXSGViewer::ClearView() called." << G4endl;
+  //#endif
+}
+
+void G4XXXSGViewer::DrawView() {
+  //#ifdef G4XXXSGDEBUG
+  G4cout << "G4XXXSGViewer::DrawView() called." << G4endl;
+  //#endif
+
+  // First, a view should decide when to re-visit the G4 kernel.
+  // Sometimes it might not be necessary, e.g., if the scene is stored
+  // in a graphical database (e.g., OpenGL's display lists) and only
+  // the viewing angle has changed.  But graphics systems without a
+  // graphical database will always need to visit the G4 kernel.
+
+  // The fNeedKernelVisit flag might have been set by the user in
+  // /vis/viewer/rebuild, but if not, make decision and set flag only
+  // if necessary...
+  if (!fNeedKernelVisit) KernelVisitDecision();
+  G4bool kernelVisitWasNeeded = fNeedKernelVisit; // Keep (ProcessView resets).
+
+  ProcessView ();  // Clears store and processes scene only if necessary.
+
+  if (kernelVisitWasNeeded) {
+    // Some systems, notably OpenGL, can draw while re-building, so
+    // there might not be a need to draw from store again here.  But
+    // in this case...
+    DrawFromStore("G4XXXSGViewer::DrawView");
+  } else {
+    DrawFromStore("G4XXXSGViewer::DrawView");
+  }
+
+  // ...before finally...
+  FinishView ();       // Flush streams and/or swap buffers.
+}
+
+void G4XXXSGViewer::ShowView() {
+  //#ifdef G4XXXSGDEBUG
+  G4cout << "G4XXXSGViewer::ShowView() called." << G4endl;
+  //#endif
+  // This is what you should see...
+  DrawFromStore("G4XXXSGViewer::ShowView");
+}
+
+void G4XXXSGViewer::KernelVisitDecision () {
+  
+  // If there's a significant difference with the last view parameters
+  // of either the scene handler or this viewer, trigger a rebuild.
+
+  typedef taj::tree<G4String> SceneGraph;
+  typedef taj::tree<G4String>::iterator SceneGraphIterator;
+  SceneGraph& sceneGraph =
+    static_cast<G4XXXSGSceneHandler&>(fSceneHandler).fSceneGraph;
+  if (sceneGraph.size() == 3  // I.e., only the root nodes.
+      || CompareForKernelVisit(fLastVP)) {
+    NeedKernelVisit ();  // Sets fNeedKernelVisit.
+  }      
+  fLastVP = fVP;
+}
+
+G4bool G4XXXSGViewer::CompareForKernelVisit(G4ViewParameters& lastVP)
+{
+  // Typical comparison.  Taken from OpenGL.
+  if (
+      (lastVP.GetDrawingStyle ()    != fVP.GetDrawingStyle ())    ||
+      (lastVP.IsAuxEdgeVisible ()   != fVP.IsAuxEdgeVisible ())   ||
+      (lastVP.GetRepStyle ()        != fVP.GetRepStyle ())        ||
+      (lastVP.IsCulling ()          != fVP.IsCulling ())          ||
+      (lastVP.IsCullingInvisible () != fVP.IsCullingInvisible ()) ||
+      (lastVP.IsDensityCulling ()   != fVP.IsDensityCulling ())   ||
+      (lastVP.IsCullingCovered ()   != fVP.IsCullingCovered ())   ||
+      // No need to visit kernel if section plane changes.
+      // No need to visit kernel if cutaway planes change.
+      (lastVP.IsExplode ()          != fVP.IsExplode ())          ||
+      (lastVP.GetNoOfSides ()       != fVP.GetNoOfSides ())       ||
+      (lastVP.IsMarkerNotHidden ()  != fVP.IsMarkerNotHidden ())  ||
+      (lastVP.GetBackgroundColour ()!= fVP.GetBackgroundColour ())
+      ) {
+    return true;
+  }
+
+  if (lastVP.IsDensityCulling () &&
+      (lastVP.GetVisibleDensity () != fVP.GetVisibleDensity ()))
+    return true;
+
+  if (lastVP.IsExplode () &&
+      (lastVP.GetExplodeFactor () != fVP.GetExplodeFactor ()))
+    return true;
+
+  return false;
+}
+
+void G4XXXSGViewer::DrawFromStore(const G4String& source) {
+  typedef taj::tree<G4String> SceneGraph;
+  typedef taj::tree<G4String>::preorder_iterator SceneGraphPreIterator;
+  SceneGraph& sceneGraph =
+    static_cast<G4XXXSGSceneHandler&>(fSceneHandler).fSceneGraph;
+  // Write to a file for testing...
+  static G4int iCount = 0;
+  std::ostringstream oss;
+  oss << source << '.' << fName << '.' << iCount++ << ".out";
+  G4cout << "Writing " << oss.str() << G4endl;
+  std::ofstream ofs(oss.str().c_str());
+  for (SceneGraphPreIterator i = sceneGraph.beginPre();
+       i != sceneGraph.endPre(); ++i) {
+    G4int depth = 0;
+    SceneGraphPreIterator j = i;
+    while (j != sceneGraph.getRoot()) {j = j.parent(); ++depth;}
+    ofs << "\nDepth: " << depth;
+    ofs << *i;
+  }
+  ofs.close();
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/XXX/src/G4XXXSceneHandler.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/src/G4XXXSceneHandler.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/src/G4XXXSceneHandler.cc	(revision 1102)
@@ -0,0 +1,248 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4XXXSceneHandler.cc,v 1.32 2006/07/03 16:52:49 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  5th April 2001
+// A template for a simplest possible graphics driver.
+//?? Lines or sections marked like this require specialisation for your driver.
+
+#include "G4XXXSceneHandler.hh"
+
+#include "G4PhysicalVolumeModel.hh"
+#include "G4VPhysicalVolume.hh"
+#include "G4LogicalVolume.hh"
+#include "G4Polyline.hh"
+#include "G4Text.hh"
+#include "G4Circle.hh"
+#include "G4Square.hh"
+#include "G4Polyhedron.hh"
+#include "G4UnitsTable.hh"
+
+G4int G4XXXSceneHandler::fSceneIdCount = 0;
+// Counter for XXX scene handlers.
+
+G4XXXSceneHandler::G4XXXSceneHandler(G4VGraphicsSystem& system,
+					 const G4String& name):
+  G4VSceneHandler(system, fSceneIdCount++, name)
+{}
+
+G4XXXSceneHandler::~G4XXXSceneHandler() {}
+
+#ifdef G4XXXDEBUG
+void G4XXXSceneHandler::PrintThings() {
+  G4cout <<
+    "  with transformation "
+         << (void*)fpObjectTransformation;
+  if (fpModel) {
+    G4cout << " from " << fpModel->GetCurrentDescription()
+	   << " (tag " << fpModel->GetCurrentTag()
+	   << ')';
+  } else {
+    G4cout << "(not from a model)";
+  }
+  G4PhysicalVolumeModel* pPVModel =
+    dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
+  if (pPVModel) {
+    G4cout <<
+      "\n  current physical volume: "
+           << pPVModel->GetCurrentPV()->GetName() <<
+      "\n  current logical volume: "
+           << pPVModel->GetCurrentLV()->GetName() <<
+      "\n  current depth of geometry tree: "
+           << pPVModel->GetCurrentDepth();
+  }
+  G4cout << G4endl;
+}
+#endif
+
+void G4XXXSceneHandler::AddPrimitive(const G4Polyline&
+#ifdef G4XXXDEBUG
+ polyline
+#endif
+) {
+#ifdef G4XXXDEBUG
+  G4cout <<
+    "G4XXXSceneHandler::AddPrimitive(const G4Polyline& polyline) called.\n"
+	 << polyline
+	 << G4endl;
+  PrintThings();
+#endif
+  // Get vis attributes - pick up defaults if none.
+  //const G4VisAttributes* pVA =
+  //  fpViewer -> GetApplicableVisAttributes (polyline.GetVisAttributes ());
+  //?? Process polyline.
+}
+
+void G4XXXSceneHandler::AddPrimitive(const G4Text&
+#ifdef G4XXXDEBUG
+ text
+#endif
+) {
+#ifdef G4XXXDEBUG
+  G4cout <<
+    "G4XXXSceneHandler::AddPrimitive(const G4Text& text) called.\n"
+	 << text
+	 << G4endl;
+  PrintThings();
+#endif
+  // Get text colour - special method since default text colour is
+  // determined by the default text vis attributes, which may be
+  // specified independent of default vis attributes of other types of
+  // visible objects.
+  //const G4Colour& c = GetTextColour (text);  // Picks up default if none.
+  //?? Process text.
+}
+
+void G4XXXSceneHandler::AddPrimitive(const G4Circle&
+#ifdef G4XXXDEBUG
+ circle
+#endif
+) {
+#ifdef G4XXXDEBUG
+  G4cout <<
+    "G4XXXSceneHandler::AddPrimitive(const G4Circle& circle) called.\n"
+	 << circle
+	 << G4endl;
+  MarkerSizeType sizeType;
+  G4double size = GetMarkerSize (circle, sizeType);
+  switch (sizeType) {
+  default:
+  case screen:
+    // Draw in screen coordinates.
+    G4cout << "screen";
+    break;
+  case world:
+    // Draw in world coordinates.
+    G4cout << "world";
+    break;
+  }
+  G4cout << " size: " << size << G4endl;
+  PrintThings();
+#endif
+  // Get vis attributes - pick up defaults if none.
+  //const G4VisAttributes* pVA =
+  //  fpViewer -> GetApplicableVisAttributes (circle.GetVisAttributes ());
+  //?? Process circle.
+}
+
+void G4XXXSceneHandler::AddPrimitive(const G4Square&
+#ifdef G4XXXDEBUG
+ square
+#endif
+) {
+#ifdef G4XXXDEBUG
+  G4cout <<
+    "G4XXXSceneHandler::AddPrimitive(const G4Square& square) called.\n"
+	 << square
+	 << G4endl;
+  MarkerSizeType sizeType;
+  G4double size = GetMarkerSize (square, sizeType);
+  switch (sizeType) {
+  default:
+  case screen:
+    // Draw in screen coordinates.
+    G4cout << "screen";
+    break;
+  case world:
+    // Draw in world coordinates.
+    G4cout << "world";
+    break;
+  }
+  G4cout << " size: " << size << G4endl;
+  PrintThings();
+#endif
+  // Get vis attributes - pick up defaults if none.
+  //const G4VisAttributes* pVA =
+  //  fpViewer -> GetApplicableVisAttributes (square.GetVisAttributes ());
+  //?? Process square.
+}
+
+void G4XXXSceneHandler::AddPrimitive(const G4Polyhedron& polyhedron) {
+#ifdef G4XXXDEBUG
+  G4cout <<
+    "G4XXXSceneHandler::AddPrimitive(const G4Polyhedron& polyhedron) called.\n"
+	 << polyhedron
+	 << G4endl;
+  PrintThings();
+#endif
+  //?? Process polyhedron.  Here are some ideas...
+  //Assume all facets are convex quadrilaterals.
+  //Draw each G4Facet individually
+  
+  //Get colour, etc..
+  if (polyhedron.GetNoFacets() == 0) return;
+
+  // Get vis attributes - pick up defaults if none.
+  const G4VisAttributes* pVA =
+    fpViewer -> GetApplicableVisAttributes (polyhedron.GetVisAttributes ());
+
+  // Get view parameters that the user can force through the vis
+  // attributes, thereby over-riding the current view parameter.
+  G4ViewParameters::DrawingStyle drawing_style = GetDrawingStyle (pVA);
+  //G4bool isAuxEdgeVisible = GetAuxEdgeVisible (pVA);
+  
+  //Get colour, etc..
+  //const G4Colour& c = pVA -> GetColour ();
+  
+  // Initial action depending on drawing style.
+  switch (drawing_style) {
+  case (G4ViewParameters::hsr):
+    {
+      break;
+    }
+  case (G4ViewParameters::hlr):
+    {
+      break;
+    }
+  case (G4ViewParameters::wireframe):
+    {
+      break;
+    }
+  default:
+    {
+      break;
+    }     
+  }
+
+  // Loop through all the facets...
+
+  // Look at G4OpenGLSceneHandler::AddPrimitive(const G4Polyhedron&)
+  // for an example of how to get facets out of a G4Polyhedron,
+  // including how to cope with triangles if that's a problem.
+}
+
+void G4XXXSceneHandler::AddPrimitive(const G4NURBS&) {
+#ifdef G4XXXDEBUG
+  G4cout <<
+    "G4XXXSceneHandler::AddPrimitive(const G4NURBS& nurbs) called."
+	 << G4endl;
+  PrintThings();
+#endif
+  //?? Don't bother implementing this.  NURBS are not functional.
+}
Index: tags/visualization-10.5-before-10.6_test/XXX/src/G4XXXStored.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/src/G4XXXStored.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/src/G4XXXStored.cc	(revision 1102)
@@ -0,0 +1,75 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4XXXStored.cc,v 1.2 2006/06/29 21:27:46 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  7th March 2006
+// A template for a graphics driver with a store/database.
+//?? Lines beginning like this require specialisation for your driver.
+
+#include "G4XXXStored.hh"
+#include "G4XXXStoredSceneHandler.hh"
+#include "G4XXXStoredViewer.hh"
+
+G4XXXStored::G4XXXStored():
+  G4VGraphicsSystem("G4XXXStored",
+		    "XXXStored",
+		    "Graphics driver with a store/database",
+		    G4VGraphicsSystem::threeD  //?? Your functionality
+		    )
+{}
+
+G4XXXStored::~G4XXXStored() {}
+
+G4VSceneHandler* G4XXXStored::CreateSceneHandler(const G4String& name) {
+  G4VSceneHandler* pScene = new G4XXXStoredSceneHandler(*this, name);
+  return pScene;
+}
+
+G4VViewer* G4XXXStored::CreateViewer(G4VSceneHandler& scene,
+			       const G4String& name) {
+  G4VViewer* pView =
+    new G4XXXStoredViewer((G4XXXStoredSceneHandler&) scene, name);
+  if (pView) {
+    if (pView->GetViewId() < 0) {
+      G4cout <<
+	"G4XXXStored::CreateViewer: ERROR flagged by negative"
+        " view id in G4XXXStoredViewer creation."
+        "\n Destroying view and returning null pointer."
+	     << G4endl;
+      delete pView;
+      pView = 0;
+    }
+  }
+  else {
+    G4cout <<
+      "G4XXXStored::CreateViewer: ERROR: null pointer on new G4XXXStoredViewer."
+	   << G4endl;
+  }
+  return pView;
+}
Index: tags/visualization-10.5-before-10.6_test/XXX/src/G4XXXStoredSceneHandler.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/src/G4XXXStoredSceneHandler.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/src/G4XXXStoredSceneHandler.cc	(revision 1102)
@@ -0,0 +1,406 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4XXXStoredSceneHandler.cc,v 1.9 2006/10/26 11:30:10 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  7th March 2006
+// A template for a graphics driver with a store/database.
+//?? Lines beginning like this require specialisation for your driver.
+
+#include "G4XXXStoredSceneHandler.hh"
+
+#include "G4XXXStoredViewer.hh"
+#include "G4PhysicalVolumeModel.hh"
+#include "G4VPhysicalVolume.hh"
+#include "G4LogicalVolume.hh"
+#include "G4Box.hh"
+#include "G4Polyline.hh"
+#include "G4Text.hh"
+#include "G4Circle.hh"
+#include "G4Square.hh"
+#include "G4Polyhedron.hh"
+#include "G4UnitsTable.hh"
+#include "G4AttDef.hh"
+#include "G4AttValue.hh"
+#include "G4AttCheck.hh"
+
+#include <sstream>
+
+G4int G4XXXStoredSceneHandler::fSceneIdCount = 0;
+// Counter for XXX scene handlers.
+
+G4XXXStoredSceneHandler::G4XXXStoredSceneHandler(G4VGraphicsSystem& system,
+					     const G4String& name):
+  G4VSceneHandler(system, fSceneIdCount++, name)
+{}
+
+G4XXXStoredSceneHandler::~G4XXXStoredSceneHandler() {}
+
+#ifdef G4XXXStoredDEBUG
+// Useful function...
+void G4XXXStoredSceneHandler::PrintThings() {
+  G4cout <<
+    "  with transformation "
+         << (void*)fpObjectTransformation;
+  if (fpModel) {
+    G4cout << " from " << fpModel->GetCurrentDescription()
+	   << " (tag " << fpModel->GetCurrentTag()
+	   << ')';
+  } else {
+    G4cout << "(not from a model)";
+  }
+  G4PhysicalVolumeModel* pPVModel =
+    dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
+  if (pPVModel) {
+    G4cout <<
+      "\n  current physical volume: "
+           << pPVModel->GetCurrentPV()->GetName() <<
+      "\n  current logical volume: "
+           << pPVModel->GetCurrentLV()->GetName() <<
+      "\n  current depth of geometry tree: "
+           << pPVModel->GetCurrentDepth();
+  }
+  G4cout << G4endl;
+}
+#endif
+
+void G4XXXStoredSceneHandler::PreAddSolid
+(const G4Transform3D& objectTransformation,
+ const G4VisAttributes& visAttribs)
+{
+  G4VSceneHandler::PreAddSolid(objectTransformation, visAttribs);
+
+  // Get user G4Atts...
+  const std::map<G4String,G4AttDef>* userAttDefs = visAttribs.GetAttDefs();
+  if (userAttDefs) {
+#ifdef G4XXXStoredDEBUG
+    const std::vector<G4AttValue>* userAttValues =
+      visAttribs.CreateAttValues();
+    G4cout << "\nProvided G4Atts:\n"
+	   << G4AttCheck(userAttValues, userAttDefs);
+    // Extra checks...
+    G4AttCheck attCheck(userAttValues, userAttDefs);
+    if (attCheck.Check()) G4cout << "Error" << G4endl;
+    else {
+      std::vector<G4AttValue> standardValues;
+      std::map<G4String,G4AttDef> standardDefinitions;
+      attCheck.Standard(&standardValues, &standardDefinitions);
+      G4cout << "\nStandard G4Atts:\n"
+             << G4AttCheck(&standardValues, &standardDefinitions);
+    }
+    // End of extra checks.
+    delete userAttValues;  // (Must be deleted after use.)
+#endif
+  }
+
+  // Get solid's G4Atts created by G4PhysicalVolumeModel...
+  G4PhysicalVolumeModel* pPVModel =
+    dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
+  if (pPVModel) {
+    const std::map<G4String,G4AttDef>* solidAttDefs = pPVModel->GetAttDefs();
+    if (solidAttDefs) {
+#ifdef G4XXXStoredDEBUG
+      std::vector<G4AttValue>* solidAttValues =
+	pPVModel->CreateCurrentAttValues();
+      G4cout << "\nProvided G4Atts:\n"
+	     << G4AttCheck(solidAttValues, solidAttDefs);
+      // Extra checks...
+      G4AttCheck attCheck(solidAttValues,solidAttDefs);
+      if (attCheck.Check()) G4cout << "Error" << G4endl;
+      else {
+	std::vector<G4AttValue> standardValues;
+	std::map<G4String,G4AttDef> standardDefinitions;
+	attCheck.Standard(&standardValues, &standardDefinitions);
+	G4cout << "\nStandard G4Atts:\n"
+	       << G4AttCheck(&standardValues, &standardDefinitions);
+      }
+      // End of extra checks.
+      delete solidAttValues;  // (Must be deleted after use.)
+#endif
+    }
+  }
+
+  // Create a place for current solid...
+  fCurrentItem = fStore.insert(fStore.end(), G4String("\nPreAddSolid:\n"));
+  if (fReadyForTransients) {
+    fTransients.push_back(fCurrentItem);
+  } else {
+    fPermanents.push_back(fCurrentItem);
+  }
+}
+
+void G4XXXStoredSceneHandler::PostAddSolid()
+{
+  *fCurrentItem += "\nEndSolid\n";
+  G4VSceneHandler::PostAddSolid();
+}
+
+void G4XXXStoredSceneHandler::BeginPrimitives
+(const G4Transform3D& objectTransformation)
+{
+  G4VSceneHandler::BeginPrimitives(objectTransformation);
+
+  // If thread of control has already passed through PreAddSolid,
+  // avoid opening a graphical data base component again.
+  if (!fProcessingSolid) {
+    // Create a place for current primitive...
+    fCurrentItem = fStore.insert(fStore.end(),
+				 G4String("\nBeginPrimitives:\n"));
+    if (fReadyForTransients) {
+      fTransients.push_back(fCurrentItem);
+    } else {
+      fPermanents.push_back(fCurrentItem);
+    }
+  }
+}
+
+void G4XXXStoredSceneHandler::EndPrimitives ()
+{
+  if (!fProcessingSolid) {  // Already done if so.
+    *fCurrentItem += "\nEndPrimitives\n";
+  }
+  G4VSceneHandler::EndPrimitives ();
+}
+
+// Note: This function overrides G4VSceneHandler::AddSolid(const
+// G4Box&).  You may not want to do this, but this is how it's done if
+// you do.  Certain other specific solids may be treated this way -
+// see G4VSceneHandler.hh.  The simplest possible driver would *not*
+// implement these polymorphic functions, with the effect that the
+// default versions in G4VSceneHandler are used, which simply call
+// G4VSceneHandler::RequestPrimitives to turn the solid into a
+// G4Polyhedron usually.
+// Don't forget, solids can be transients too (e.g., representing a hit).
+void G4XXXStoredSceneHandler::AddSolid(const G4Box& box) {
+#ifdef G4XXXStoredDEBUG
+  G4cout <<
+    "G4XXXStoredSceneHandler::AddSolid(const G4Box& box) called for "
+	 << box.GetName()
+	 << G4endl;
+#endif
+  //?? Process your box...
+  std::ostringstream oss;
+  oss << "G4Box(" <<
+    G4String
+    (G4BestUnit
+     (G4ThreeVector
+      (box.GetXHalfLength(), box.GetYHalfLength(), box.GetZHalfLength()),
+      "Length")).strip() << ')';
+  *fCurrentItem += oss.str();
+}
+
+void G4XXXStoredSceneHandler::AddPrimitive(const G4Polyline& polyline) {
+#ifdef G4XXXStoredDEBUG
+  G4cout <<
+ "G4XXXStoredSceneHandler::AddPrimitive(const G4Polyline& polyline) called.\n"
+	 << polyline
+	 << G4endl;
+#endif
+  // Get vis attributes - pick up defaults if none.
+  //const G4VisAttributes* pVA =
+  //  fpViewer -> GetApplicableVisAttributes (polyline.GetVisAttributes ());
+  //?? Process polyline.
+  std::ostringstream oss;
+  oss << polyline;
+  *fCurrentItem += oss.str();
+}
+
+void G4XXXStoredSceneHandler::AddPrimitive(const G4Text& text) {
+#ifdef G4XXXStoredDEBUG
+  G4cout <<
+    "G4XXXStoredSceneHandler::AddPrimitive(const G4Text& text) called.|n"
+	 << text
+	 << G4endl;
+#endif
+  // Get text colour - special method since default text colour is
+  // determined by the default text vis attributes, which may be
+  // specified independent of default vis attributes of other types of
+  // visible objects.
+  //const G4Colour& c = GetTextColour (text);  // Picks up default if none.
+  //?? Process text.
+  std::ostringstream oss;
+  oss << text;
+  *fCurrentItem += oss.str();
+}
+
+void G4XXXStoredSceneHandler::AddPrimitive(const G4Circle& circle) {
+#ifdef G4XXXStoredDEBUG
+  G4cout <<
+    "G4XXXStoredSceneHandler::AddPrimitive(const G4Circle& circle) called.\n"
+	 << circle
+	 << G4endl;
+  MarkerSizeType sizeType;
+  G4double size = GetMarkerSize (circle, sizeType);
+  switch (sizeType) {
+  default:
+  case screen:
+    // Draw in screen coordinates.
+    G4cout << "screen";
+    break;
+  case world:
+    // Draw in world coordinates.
+    G4cout << "world";
+    break;
+  }
+  G4cout << " size: " << size << G4endl;
+#endif
+  // Get vis attributes - pick up defaults if none.
+  //const G4VisAttributes* pVA =
+  //  fpViewer -> GetApplicableVisAttributes (circle.GetVisAttributes ());
+  //?? Process circle.
+  std::ostringstream oss;
+  oss << circle;
+  *fCurrentItem += oss.str();
+}
+
+void G4XXXStoredSceneHandler::AddPrimitive(const G4Square& square) {
+#ifdef G4XXXStoredDEBUG
+  G4cout <<
+    "G4XXXStoredSceneHandler::AddPrimitive(const G4Square& square) called.\n"
+	 << square
+	 << G4endl;
+  MarkerSizeType sizeType;
+  G4double size = GetMarkerSize (square, sizeType);
+  switch (sizeType) {
+  default:
+  case screen:
+    // Draw in screen coordinates.
+    G4cout << "screen";
+    break;
+  case world:
+    // Draw in world coordinates.
+    G4cout << "world";
+    break;
+  }
+  G4cout << " size: " << size << G4endl;
+#endif
+  // Get vis attributes - pick up defaults if none.
+  //const G4VisAttributes* pVA =
+  //  fpViewer -> GetApplicableVisAttributes (square.GetVisAttributes ());
+  //?? Process square.
+  std::ostringstream oss;
+  oss << square;
+  *fCurrentItem += oss.str();
+}
+
+void G4XXXStoredSceneHandler::AddPrimitive(const G4Polyhedron& polyhedron) {
+#ifdef G4XXXStoredDEBUG
+  G4cout <<
+    "G4XXXStoredSceneHandler::AddPrimitive(const G4Polyhedron&) called.\n"
+	 << polyhedron
+	 << G4endl;
+#endif
+  //?? Process polyhedron.
+  std::ostringstream oss;
+  oss << polyhedron;
+  *fCurrentItem += oss.str();
+
+  //?? Or... here are some ideas for decomposing into polygons...
+  //Assume all facets are convex quadrilaterals.
+  //Draw each G4Facet individually
+  
+  //Get colour, etc..
+  if (polyhedron.GetNoFacets() == 0) return;
+
+  // Get vis attributes - pick up defaults if none.
+  const G4VisAttributes* pVA =
+    fpViewer -> GetApplicableVisAttributes (polyhedron.GetVisAttributes ());
+
+  // Get view parameters that the user can force through the vis
+  // attributes, thereby over-riding the current view parameter.
+  G4ViewParameters::DrawingStyle drawing_style = GetDrawingStyle (pVA);
+  //G4bool isAuxEdgeVisible = GetAuxEdgeVisible (pVA);
+  
+  //Get colour, etc..
+  //const G4Colour& c = pVA -> GetColour ();
+  
+  // Initial action depending on drawing style.
+  switch (drawing_style) {
+  case (G4ViewParameters::hsr):
+    {
+      break;
+    }
+  case (G4ViewParameters::hlr):
+    {
+      break;
+    }
+  case (G4ViewParameters::wireframe):
+    {
+      break;
+    }
+  default:
+    {
+      break;
+    }     
+  }
+
+  // Loop through all the facets...
+
+  // Look at G4OpenGLSceneHandler::AddPrimitive(const G4Polyhedron&)
+  // for an example of how to get facets out of a G4Polyhedron,
+  // including how to cope with triangles if that's a problem.
+}
+
+void G4XXXStoredSceneHandler::AddPrimitive(const G4NURBS&) {
+#ifdef G4XXXStoredDEBUG
+  G4cout <<
+    "G4XXXStoredSceneHandler::AddPrimitive(const G4NURBS& nurbs) called."
+	 << G4endl;
+#endif
+  //?? Don't bother implementing this.  NURBS are not functional.
+}
+
+void G4XXXStoredSceneHandler::ClearStore () {
+
+  G4VSceneHandler::ClearStore ();  // Sets need kernel visit, etc.
+
+  fStore.clear();
+  fPermanents.clear();
+  fTransients.clear();
+}
+
+void G4XXXStoredSceneHandler::ClearTransientStore () {
+
+  G4VSceneHandler::ClearTransientStore ();
+
+  typedef std::list<G4String> Store;
+  typedef std::list<G4String>::iterator StoreIterator;
+  typedef std::vector<StoreIterator>::iterator StoreIteratorIterator;
+  for (StoreIteratorIterator i = fTransients.begin();
+       i != fTransients.end(); ++i) {
+    fStore.erase(*i);
+  }
+  fTransients.clear();
+
+  // Make sure screen corresponds to graphical database...
+  if (fpViewer) {
+    fpViewer -> SetView ();
+    fpViewer -> ClearView ();
+    fpViewer -> DrawView ();
+  }
+}
Index: tags/visualization-10.5-before-10.6_test/XXX/src/G4XXXStoredViewer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/src/G4XXXStoredViewer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/src/G4XXXStoredViewer.cc	(revision 1102)
@@ -0,0 +1,161 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4XXXStoredViewer.cc,v 1.5 2006/08/29 16:11:25 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  7th March 2006
+// A template for a graphics driver with a store/database.
+//?? Lines beginning like this require specialisation for your driver.
+
+#include "G4XXXStoredViewer.hh"
+
+#include "G4VSceneHandler.hh"
+#include "G4XXXStoredSceneHandler.hh"
+
+#include <fstream>
+#include <sstream>
+
+G4XXXStoredViewer::G4XXXStoredViewer
+(G4VSceneHandler& sceneHandler, const G4String& name):
+  G4VViewer(sceneHandler, sceneHandler.IncrementViewCount(), name)
+{}
+
+G4XXXStoredViewer::~G4XXXStoredViewer() {}
+
+void G4XXXStoredViewer::SetView() {
+#ifdef G4XXXStoredDEBUG
+  G4cout << "G4XXXStoredViewer::SetView() called." << G4endl;
+#endif
+}
+
+void G4XXXStoredViewer::ClearView() {
+#ifdef G4XXXStoredDEBUG
+  G4cout << "G4XXXStoredViewer::ClearView() called." << G4endl;
+#endif
+}
+
+void G4XXXStoredViewer::DrawView() {
+#ifdef G4XXXStoredDEBUG
+  G4cout << "G4XXXStoredViewer::DrawView() called." << G4endl;
+#endif
+
+  // First, a view should decide when to re-visit the G4 kernel.
+  // Sometimes it might not be necessary, e.g., if the scene is stored
+  // in a graphical database (e.g., OpenGL's display lists) and only
+  // the viewing angle has changed.  But graphics systems without a
+  // graphical database will always need to visit the G4 kernel.
+
+  // The fNeedKernelVisit flag might have been set by the user in
+  // /vis/viewer/rebuild, but if not, make decision and set flag only
+  // if necessary...
+  if (!fNeedKernelVisit) KernelVisitDecision();
+  G4bool kernelVisitWasNeeded = fNeedKernelVisit; // Keep (ProcessView resets).
+
+  ProcessView ();  // Clears store and processes scene only if necessary.
+
+  if (kernelVisitWasNeeded) {
+    // Some systems, notably OpenGL, can draw while re-building, so
+    // there might not be a need to draw from store again here.  But
+    // in this case...
+    DrawFromStore();
+  } else {
+    DrawFromStore();
+  }
+
+  // ...before finally...
+  FinishView ();       // Flush streams and/or swap buffers.
+}
+
+void G4XXXStoredViewer::ShowView() {
+#ifdef G4XXXStoredDEBUG
+  G4cout << "G4XXXStoredViewer::ShowView() called." << G4endl;
+#endif
+}
+
+void G4XXXStoredViewer::KernelVisitDecision () {
+  
+  // If there's a significant difference with the last view parameters
+  // of either the scene handler or this viewer, trigger a rebuild.
+
+  typedef std::list<G4String> Store;
+  typedef std::list<G4String>::iterator StoreIterator;
+  Store& store =
+    static_cast<G4XXXStoredSceneHandler&>(fSceneHandler).fStore;
+  if (store.empty() || CompareForKernelVisit(fLastVP)) {
+    NeedKernelVisit ();  // Sets fNeedKernelVisit.
+  }      
+  fLastVP = fVP;
+}
+
+G4bool G4XXXStoredViewer::CompareForKernelVisit(G4ViewParameters& lastVP)
+{
+  // Typical comparison.  Taken from OpenGL.
+  if (
+      (lastVP.GetDrawingStyle ()    != fVP.GetDrawingStyle ())    ||
+      (lastVP.IsAuxEdgeVisible ()   != fVP.IsAuxEdgeVisible ())   ||
+      (lastVP.GetRepStyle ()        != fVP.GetRepStyle ())        ||
+      (lastVP.IsCulling ()          != fVP.IsCulling ())          ||
+      (lastVP.IsCullingInvisible () != fVP.IsCullingInvisible ()) ||
+      (lastVP.IsDensityCulling ()   != fVP.IsDensityCulling ())   ||
+      (lastVP.IsCullingCovered ()   != fVP.IsCullingCovered ())   ||
+      // No need to visit kernel if section plane changes.
+      // No need to visit kernel if cutaway planes change.
+      (lastVP.IsExplode ()          != fVP.IsExplode ())          ||
+      (lastVP.GetNoOfSides ()       != fVP.GetNoOfSides ())       ||
+      (lastVP.IsMarkerNotHidden ()  != fVP.IsMarkerNotHidden ())  ||
+      (lastVP.GetBackgroundColour ()!= fVP.GetBackgroundColour ())
+      ) {
+    return true;
+  }
+
+  if (lastVP.IsDensityCulling () &&
+      (lastVP.GetVisibleDensity () != fVP.GetVisibleDensity ()))
+    return true;
+
+  if (lastVP.IsExplode () &&
+      (lastVP.GetExplodeFactor () != fVP.GetExplodeFactor ()))
+    return true;
+
+  return false;
+}
+
+void G4XXXStoredViewer::DrawFromStore() {
+  typedef std::list<G4String> Store;
+  typedef std::list<G4String>::iterator StoreIterator;
+  Store& store =
+    static_cast<G4XXXStoredSceneHandler&>(fSceneHandler).fStore;
+  // Write to a file for testing...
+  static G4int iCount = 0;
+  std::ostringstream oss;
+  oss << fName << '.' << iCount++ << ".out";
+  std::ofstream ofs(oss.str().c_str());
+  for (StoreIterator i = store.begin(); i != store.end(); ++i) {
+    ofs << *i;
+  }
+  ofs.close();
+}
Index: tags/visualization-10.5-before-10.6_test/XXX/src/G4XXXViewer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/XXX/src/G4XXXViewer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/XXX/src/G4XXXViewer.cc	(revision 1102)
@@ -0,0 +1,87 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4XXXViewer.cc,v 1.9 2006/06/29 21:27:52 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  5th April 2001
+// A template for a simplest possible graphics driver.
+//?? Lines or sections marked like this require specialisation for your driver.
+
+#include "G4XXXViewer.hh"
+
+#include "G4VSceneHandler.hh"
+#include "G4XXXSceneHandler.hh"
+
+G4XXXViewer::G4XXXViewer
+(G4VSceneHandler& sceneHandler, const G4String& name):
+  G4VViewer(sceneHandler, sceneHandler.IncrementViewCount(), name) {}
+
+G4XXXViewer::~G4XXXViewer() {}
+
+void G4XXXViewer::SetView() {
+#ifdef G4XXXDEBUG
+  G4cout << "G4XXXViewer::SetView() called." << G4endl;
+#endif
+}
+
+void G4XXXViewer::ClearView() {
+#ifdef G4XXXDEBUG
+  G4cout << "G4XXXViewer::ClearView() called." << G4endl;
+#endif
+}
+
+void G4XXXViewer::DrawView() {
+#ifdef G4XXXDEBUG
+  G4cout << "G4XXXViewer::DrawView() called." << G4endl;
+#endif
+
+  // First, a view should decide when to re-visit the G4 kernel.
+  // Sometimes it might not be necessary, e.g., if the scene is stored
+  // in a graphical database (e.g., OpenGL's display lists) and only
+  // the viewing angle has changed.  But graphics systems without a
+  // graphical database will always need to visit the G4 kernel.
+
+  NeedKernelVisit ();  // Default is - always visit G4 kernel.
+  // Note: this routine sets the fNeedKernelVisit flag of *all* the
+  // views of the scene.
+
+  ProcessView ();      // The basic logic is here.
+
+  // Then a view may have more to do, e.g., display the graphical
+  // database.  That code should come here...
+
+  // ...before finally...
+  FinishView ();       // Flush streams and/or swap buffers.
+}
+
+void G4XXXViewer::ShowView() {
+#ifdef G4XXXDEBUG
+  G4cout << "G4XXXViewer::ShowView() called." << G4endl;
+  static_cast<G4XXXSceneHandler&>(fSceneHandler).PrintStores();
+#endif
+}
Index: tags/visualization-10.5-before-10.6_test/currentEvent.rndm
===================================================================
--- tags/visualization-10.5-before-10.6_test/currentEvent.rndm	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/currentEvent.rndm	(revision 1102)
@@ -0,0 +1,5 @@
+Uvec
+1878463799
+0
+9876
+54321
Index: tags/visualization-10.5-before-10.6_test/currentRun.rndm
===================================================================
--- tags/visualization-10.5-before-10.6_test/currentRun.rndm	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/currentRun.rndm	(revision 1102)
@@ -0,0 +1,5 @@
+Uvec
+1878463799
+0
+1180857998
+122938492
Index: tags/visualization-10.5-before-10.6_test/externals/gl2ps/GNUmakefile
===================================================================
--- tags/visualization-10.5-before-10.6_test/externals/gl2ps/GNUmakefile	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/externals/gl2ps/GNUmakefile	(revision 1102)
@@ -0,0 +1,18 @@
+# $Id: GNUmakefile,v 1.1 2009/02/18 09:54:12 lgarnier Exp $
+# -------------------------------------------------------------
+# GNUmakefile for gl2ps.  Laurent Garnier, 6/2/09.
+
+name := G4gl2ps
+
+# For debug mode
+CPPFLAGS += -DG4DEBUG_VIS_GL2PS
+
+ifndef G4INSTALL
+  G4INSTALL = ../../../..
+endif
+
+include $(G4INSTALL)/config/architecture.gmk
+include $(G4INSTALL)/config/G4VIS_BUILD.gmk
+include $(G4INSTALL)/config/interactivity.gmk
+
+include $(G4INSTALL)/config/common.gmk
Index: tags/visualization-10.5-before-10.6_test/externals/gl2ps/History
===================================================================
--- tags/visualization-10.5-before-10.6_test/externals/gl2ps/History	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/externals/gl2ps/History	(revision 1102)
@@ -0,0 +1,45 @@
+$Id: History,v 1.9 2009/04/29 19:23:10 allison Exp $
+-------------------------------------------------------------------
+
+     =========================================================
+     Geant4 - an Object-Oriented Toolkit for Simulation in HEP
+     =========================================================
+
+                      Category History file
+                      ---------------------
+This file should be used by G4 developers and category coordinators
+to briefly summarize all major modifications introduced in the code
+and keep track of all category-tags.
+It DOES NOT substitute the  CVS log-message one should put at every
+committal in the CVS repository !
+
+     ----------------------------------------------------------
+     * Reverse chronological order (last date on top), please *
+     ----------------------------------------------------------
+
+29 April 2009, Laurent Garnier (visexternal-V09-02-04)
+ - G4OpenGL2PSAction : Fix a circular dependency to G4OpenGL on Linux
+
+27 April 2009, Laurent Garnier (visexternal-V09-02-03)
+ - gl2ps/src/gl2ps.cc : Fix some warnings on Linux
+
+8 April 2009, Laurent Garnier
+ - gl2ps/include/G4OpenGL2PSAction.hh : Add missing header methods(forgot
+   in visexternal-V09-02-02 tag
+ - gl2ps/include/G4OpenGL2PSAction.hh : Add cvsID at head of file
+
+6 April 2009, Laurent Garnier (visexternal-V09-02-02)
+ - Adjustments to point and line size
+
+19 March 2009, Laurent Garnier (visexternal-V09-02-01)
+ - Add methods to change GL_Point and GL_Line size
+
+4 March 2009, Laurent Garnier
+ - Update gl2ps to 1.3.3 version (before it was 0.8)
+
+16 February 2009, Laurent Garnier
+ - Creation of this library in order to have a gl2ps for all viewers.
+ - Copying gl2ps.cc and gl2ps.h files form OpenInventor/src
+ - Add a new file G4OpenGL2PSAction.cc to be on the top of gl2ps 
+   external package. This file will be heritate/used by viewers
+   in order to have gl2ps render.
Index: tags/visualization-10.5-before-10.6_test/externals/gl2ps/include/G4OpenGL2PSAction.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/externals/gl2ps/include/G4OpenGL2PSAction.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/externals/gl2ps/include/G4OpenGL2PSAction.hh	(revision 1102)
@@ -0,0 +1,60 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4OpenGL2PSAction.hh,v 1.3 2009/04/29 09:37:55 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+
+#ifndef G4OpenGL2PSAction_h
+#define G4OpenGL2PSAction_h 
+
+
+#include <string>
+#include "Geant4_gl2ps.h"
+
+class G4OpenGL2PSAction {
+
+public:
+ G4OpenGL2PSAction();
+ 
+ void setFileName(const char*);
+ bool enableFileWriting();
+  // return true if ok, false is an error occured
+
+ void disableFileWriting();
+
+ bool fileWritingEnabled() const;
+ void setLineWidth(int);
+ void setPointSize(int);
+
+protected:
+ void G4gl2psBegin();
+ const char * fFileName;
+ FILE* fFile;
+ GLint fViewport[4];
+};
+
+#endif
+
Index: tags/visualization-10.5-before-10.6_test/externals/gl2ps/include/Geant4_gl2ps.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/externals/gl2ps/include/Geant4_gl2ps.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/externals/gl2ps/include/Geant4_gl2ps.h	(revision 1102)
@@ -0,0 +1,234 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+#ifndef Geant4_gl2ps_h
+#define Geant4_gl2ps_h
+
+// gl2ps-1.3.3
+// The gl2ps code is prefixed by Geant4_ in order
+// to avoid clashes with other gl2ps code that may come at link
+// time from other channels.
+
+#define gl2psBeginPage Geant4_gl2psBeginPage
+#define gl2psEndPage Geant4_gl2psEndPage
+#define gl2psText Geant4_gl2psText
+#define gl2psEnable Geant4_gl2psEnable
+#define gl2psDisable Geant4_gl2psDisable
+#define gl2psPointSize Geant4_gl2psPointSize
+#define gl2psLineWidth Geant4_gl2psLineWidth
+#define gl2psDrawPixels Geant4_gl2psDrawPixels
+#define gl2psBeginViewport Geant4_gl2psBeginViewport
+#define gl2psEndViewport Geant4_gl2psEndViewport
+#define gl2psTextOpt Geant4_gl2psTextOpt
+#define gl2psSetOptions Geant4_gl2psSetOptions
+#define gl2psGetOptions Geant4_gl2psGetOptions
+#define gl2psSpecial Geant4_gl2psSpecial
+#define gl2psBlendFunc Geant4_gl2psBlendFunc
+#define gl2psDrawImageMap Geant4_gl2psDrawImageMap
+#define gl2psGetFileExtension Geant4_gl2psGetFileExtension
+#define gl2psGetFormatDescription Geant4_gl2psGetFormatDescription
+
+#define gl2psMsg Geant4_gl2psMsg
+#define gl2psMalloc Geant4_gl2psMalloc
+#define gl2psRealloc Geant4_gl2psRealloc
+#define gl2psFree Geant4_gl2psFree
+#define gl2psWriteBigEndian Geant4_gl2psWriteBigEndian
+#define gl2psSetupCompress Geant4_gl2psSetupCompress
+#define gl2psFreeCompress Geant4_gl2psFreeCompress
+#define gl2psAllocCompress Geant4_gl2psAllocCompress
+#define gl2psReallocCompress Geant4_gl2psReallocCompress
+#define gl2psWriteBigEndianCompress Geant4_gl2psWriteBigEndianCompress
+#define gl2psDeflate Geant4_gl2psDeflate
+#define gl2psPrintf Geant4_gl2psPrintf
+#define gl2psPrintGzipHeader Geant4_gl2psPrintGzipHeader
+#define gl2psPrintGzipFooter Geant4_gl2psPrintGzipFooter
+#define gl2psListReset Geant4_gl2psListReset
+#define gl2psListRealloc Geant4_gl2psListRealloc
+#define gl2psListCreate Geant4_gl2psListCreate
+#define gl2psListDelete Geant4_gl2psListDelete
+#define gl2psListAdd Geant4_gl2psListAdd
+#define gl2psListNbr Geant4_gl2psListNbr
+#define gl2psListPointer Geant4_gl2psListPointer
+#define gl2psListSort Geant4_gl2psListSort
+#define gl2psListAction Geant4_gl2psListAction
+#define gl2psListActionInverse Geant4_gl2psListActionInverse
+#define gl2psListRead Geant4_gl2psListRead
+#define gl2psEncodeBase64Block Geant4_gl2psEncodeBase64Block
+#define gl2psListEncodeBase64 Geant4_gl2psListEncodeBase64
+#define gl2psSameColor Geant4_gl2psSameColor
+#define gl2psVertsSameColor Geant4_gl2psVertsSameColor
+#define gl2psSameColorThreshold Geant4_gl2psSameColorThreshold
+#define gl2psSetLastColor Geant4_gl2psSetLastColor
+#define gl2psGetRGB Geant4_gl2psGetRGB
+#define gl2psCopyPixmap Geant4_gl2psCopyPixmap
+#define gl2psFreePixmap Geant4_gl2psFreePixmap
+#define gl2psUserWritePNG Geant4_gl2psUserWritePNG
+#define gl2psUserFlushPNG Geant4_gl2psUserFlushPNG
+#define gl2psConvertPixmapToPNG Geant4_gl2psConvertPixmapToPNG
+#define gl2psAddText Geant4_gl2psAddText
+#define gl2psCopyText Geant4_gl2psCopyText
+#define gl2psFreeText Geant4_gl2psFreeText
+#define gl2psSupportedBlendMode Geant4_gl2psSupportedBlendMode
+#define gl2psAdaptVertexForBlending Geant4_gl2psAdaptVertexForBlending
+#define gl2psAssignTriangleProperties Geant4_gl2psAssignTriangleProperties
+#define gl2psFillTriangleFromPrimitive Geant4_gl2psFillTriangleFromPrimitive
+#define gl2psInitTriangle Geant4_gl2psInitTriangle
+#define gl2psCopyPrimitive Geant4_gl2psCopyPrimitive
+#define gl2psSamePosition Geant4_gl2psSamePosition
+#define gl2psComparePointPlane Geant4_gl2psComparePointPlane
+#define gl2psPsca Geant4_gl2psPsca
+#define gl2psPvec Geant4_gl2psPvec
+#define gl2psNorm Geant4_gl2psNorm
+#define gl2psGetNormal Geant4_gl2psGetNormal
+#define gl2psGetPlane Geant4_gl2psGetPlane
+#define gl2psCutEdge Geant4_gl2psCutEdge
+#define gl2psCreateSplitPrimitive Geant4_gl2psCreateSplitPrimitive
+#define gl2psAddIndex Geant4_gl2psAddIndex
+#define gl2psGetIndex Geant4_gl2psGetIndex
+#define gl2psTestSplitPrimitive Geant4_gl2psTestSplitPrimitive
+#define gl2psSplitPrimitive Geant4_gl2psSplitPrimitive
+#define gl2psDivideQuad Geant4_gl2psDivideQuad
+#define gl2psCompareDepth Geant4_gl2psCompareDepth
+#define gl2psTrianglesFirst Geant4_gl2psTrianglesFirst
+#define gl2psFindRoot Geant4_gl2psFindRoot
+#define gl2psFreeImagemap Geant4_gl2psFreeImagemap
+#define gl2psFreePrimitive Geant4_gl2psFreePrimitive
+#define gl2psAddPrimitiveInList Geant4_gl2psAddPrimitiveInList
+#define gl2psFreeBspTree Geant4_gl2psFreeBspTree
+#define gl2psGreater Geant4_gl2psGreater
+#define gl2psLess Geant4_gl2psLess
+#define gl2psBuildBspTree Geant4_gl2psBuildBspTree
+#define gl2psTraverseBspTree Geant4_gl2psTraverseBspTree
+#define gl2psRescaleAndOffset Geant4_gl2psRescaleAndOffset
+#define gl2psGetPlaneFromPoints Geant4_gl2psGetPlaneFromPoints
+#define gl2psFreeBspImageTree Geant4_gl2psFreeBspImageTree
+#define gl2psCheckPoint Geant4_gl2psCheckPoint
+#define gl2psAddPlanesInBspTreeImage Geant4_gl2psAddPlanesInBspTreeImage
+#define gl2psCheckPrimitive Geant4_gl2psCheckPrimitive
+#define gl2psCreateSplitPrimitive2D Geant4_gl2psCreateSplitPrimitive2D
+#define gl2psSplitPrimitive2D Geant4_gl2psSplitPrimitive2D
+#define gl2psAddInImageTree Geant4_gl2psAddInImageTree
+#define gl2psAddInBspImageTree Geant4_gl2psAddInBspImageTree
+#define gl2psAddBoundaryInList Geant4_gl2psAddBoundaryInList
+#define gl2psBuildPolygonBoundary Geant4_gl2psBuildPolygonBoundary
+#define gl2psAddPolyPrimitive Geant4_gl2psAddPolyPrimitive
+#define gl2psGetVertex Geant4_gl2psGetVertex
+#define gl2psParseFeedbackBuffer Geant4_gl2psParseFeedbackBuffer
+#define gl2psWriteByte Geant4_gl2psWriteByte
+#define gl2psPrintPostScriptPixmap Geant4_gl2psPrintPostScriptPixmap
+#define gl2psPrintPostScriptImagemap Geant4_gl2psPrintPostScriptImagemap
+#define gl2psPrintPostScriptHeader Geant4_gl2psPrintPostScriptHeader
+#define gl2psPrintPostScriptColor Geant4_gl2psPrintPostScriptColor
+#define gl2psResetPostScriptColor Geant4_gl2psResetPostScriptColor
+#define gl2psEndPostScriptLine Geant4_gl2psEndPostScriptLine
+#define gl2psParseStipplePattern Geant4_gl2psParseStipplePattern
+#define gl2psPrintPostScriptDash Geant4_gl2psPrintPostScriptDash
+#define gl2psPrintPostScriptPrimitive Geant4_gl2psPrintPostScriptPrimitive
+#define gl2psPrintPostScriptFooter Geant4_gl2psPrintPostScriptFooter
+#define gl2psPrintTeXHeader Geant4_gl2psPrintTeXHeader
+#define gl2psPrintTeXPrimitive Geant4_gl2psPrintTeXPrimitive
+#define gl2psPrintTeXFooter Geant4_gl2psPrintTeXFooter
+
+#define gl2psPrintPostScriptBeginViewport Geant4_gl2psPrintPostScriptBeginViewport
+#define gl2psPrintPostScriptEndViewport Geant4_gl2psPrintPostScriptEndViewport
+
+#define gl2psPrintPostScriptFinalPrimitive Geant4_gl2psPrintPostScriptFinalPrimitive
+#define gl2psPrintPrimitives Geant4_gl2psPrintPrimitives
+#define gl2psPrintTeXBeginViewport Geant4_gl2psPrintTeXBeginViewport
+#define gl2psPrintTeXEndViewport Geant4_gl2psPrintTeXEndViewport
+#define gl2psPrintTeXFinalPrimitive Geant4_gl2psPrintTeXFinalPrimitive
+#define gl2psPrintPDFCompressorType Geant4_gl2psPrintPDFCompressorType
+#define gl2psPrintPDFStrokeColor Geant4_gl2psPrintPDFStrokeColor
+#define gl2psPrintPDFFillColor Geant4_gl2psPrintPDFFillColor
+#define gl2psPrintPDFLineWidth Geant4_gl2psPrintPDFLineWidth
+#define gl2psPutPDFText Geant4_gl2psPutPDFText
+#define gl2psPutPDFImage Geant4_gl2psPutPDFImage
+#define gl2psPDFstacksInit Geant4_gl2psPDFstacksInit
+#define gl2psPDFgroupObjectInit Geant4_gl2psPDFgroupObjectInit
+#define gl2psPDFgroupListInit Geant4_gl2psPDFgroupListInit
+#define gl2psSortOutTrianglePDFgroup Geant4_gl2psSortOutTrianglePDFgroup
+#define gl2psPDFgroupListWriteMainStream Geant4_gl2psPDFgroupListWriteMainStream
+#define gl2psPDFgroupListWriteGStateResources Geant4_gl2psPDFgroupListWriteGStateResources
+#define gl2psPDFgroupListWriteShaderResources Geant4_gl2psPDFgroupListWriteShaderResources
+#define gl2psPDFgroupListWriteXObjectResources Geant4_gl2psPDFgroupListWriteXObjectResources
+#define gl2psPDFgroupListWriteFontResources Geant4_gl2psPDFgroupListWriteFontResources
+#define gl2psPDFgroupListDelete Geant4_gl2psPDFgroupListDelete
+#define gl2psPrintPDFInfo Geant4_gl2psPrintPDFInfo
+#define gl2psPrintPDFCatalog Geant4_gl2psPrintPDFCatalog
+#define gl2psPrintPDFPages Geant4_gl2psPrintPDFPages
+#define gl2psOpenPDFDataStream Geant4_gl2psOpenPDFDataStream
+#define gl2psOpenPDFDataStreamWritePreface Geant4_gl2psOpenPDFDataStreamWritePreface
+#define gl2psPrintPDFHeader Geant4_gl2psPrintPDFHeader
+#define gl2psPrintPDFPrimitive Geant4_gl2psPrintPDFPrimitive
+#define gl2psClosePDFDataStream Geant4_gl2psClosePDFDataStream
+#define gl2psPrintPDFDataStreamLength Geant4_gl2psPrintPDFDataStreamLength
+#define gl2psPrintPDFOpenPage Geant4_gl2psPrintPDFOpenPage
+#define gl2psPDFgroupListWriteVariableResources Geant4_gl2psPDFgroupListWriteVariableResources
+#define gl2psPrintPDFGSObject Geant4_gl2psPrintPDFGSObject
+#define gl2psPrintPDFShaderStreamDataCoord Geant4_gl2psPrintPDFShaderStreamDataCoord
+#define gl2psPrintPDFShaderStreamDataRGB Geant4_gl2psPrintPDFShaderStreamDataRGB
+#define gl2psPrintPDFShaderStreamDataAlpha Geant4_gl2psPrintPDFShaderStreamDataAlpha
+#define gl2psPrintPDFShaderStreamData Geant4_gl2psPrintPDFShaderStreamData
+#define gl2psPDFRectHull Geant4_gl2psPDFRectHull
+#define gl2psPrintPDFShader Geant4_gl2psPrintPDFShader
+#define gl2psPrintPDFShaderMask Geant4_gl2psPrintPDFShaderMask
+#define gl2psPrintPDFShaderExtGS Geant4_gl2psPrintPDFShaderExtGS
+#define gl2psPrintPDFShaderSimpleExtGS Geant4_gl2psPrintPDFShaderSimpleExtGS
+#define gl2psPrintPDFPixmapStreamData Geant4_gl2psPrintPDFPixmapStreamData
+#define gl2psPrintPDFPixmap Geant4_gl2psPrintPDFPixmap
+#define gl2psPrintPDFText Geant4_gl2psPrintPDFText
+#define gl2psPDFgroupListWriteObjects Geant4_gl2psPDFgroupListWriteObjects
+#define gl2psPrintPDFFooter Geant4_gl2psPrintPDFFooter
+#define gl2psPrintPDFBeginViewport Geant4_gl2psPrintPDFBeginViewport
+#define gl2psPrintPDFEndViewport Geant4_gl2psPrintPDFEndViewport
+#define gl2psPrintPDFFinalPrimitive Geant4_gl2psPrintPDFFinalPrimitive
+#define gl2psSVGGetCoordsAndColors Geant4_gl2psSVGGetCoordsAndColors
+#define gl2psSVGGetColorString Geant4_gl2psSVGGetColorString
+#define gl2psPrintSVGHeader Geant4_gl2psPrintSVGHeader
+#define gl2psPrintSVGSmoothTriangle Geant4_gl2psPrintSVGSmoothTriangle
+#define gl2psPrintSVGDash Geant4_gl2psPrintSVGDash
+#define gl2psEndSVGLine Geant4_gl2psEndSVGLine
+#define gl2psPrintSVGPixmap Geant4_gl2psPrintSVGPixmap
+#define gl2psPrintSVGPrimitive Geant4_gl2psPrintSVGPrimitive
+#define gl2psPrintSVGFooter Geant4_gl2psPrintSVGFooter
+#define gl2psPrintSVGBeginViewport Geant4_gl2psPrintSVGBeginViewport
+#define gl2psPrintSVGEndViewport Geant4_gl2psPrintSVGEndViewport
+#define gl2psPrintSVGFinalPrimitive Geant4_gl2psPrintSVGFinalPrimitive
+#define gl2psPrintPGFColor Geant4_gl2psPrintPGFColor
+#define gl2psPrintPGFHeader Geant4_gl2psPrintPGFHeader
+#define gl2psPrintPGFDash Geant4_gl2psPrintPGFDash
+#define gl2psPGFTextAlignment Geant4_gl2psPGFTextAlignment
+#define gl2psPrintPGFPrimitive Geant4_gl2psPrintPGFPrimitive
+#define gl2psPrintPGFFooter Geant4_gl2psPrintPGFFooter
+#define gl2psPrintPGFBeginViewport Geant4_gl2psPrintPGFBeginViewport
+#define gl2psPrintPGFEndViewport Geant4_gl2psPrintPGFEndViewport
+#define gl2psPrintPGFFinalPrimitive Geant4_gl2psPrintPGFFinalPrimitive
+#define gl2psComputeTightBoundingBox Geant4_gl2psComputeTightBoundingBox
+
+#define gl2ps Geant4_gl2ps
+
+#include "gl2ps.h"
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/externals/gl2ps/include/gl2ps.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/externals/gl2ps/include/gl2ps.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/externals/gl2ps/include/gl2ps.h	(revision 1102)
@@ -0,0 +1,221 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+/*
+ * GL2PS, an OpenGL to PostScript Printing Library
+ * Copyright (C) 1999-2009 C. Geuzaine
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of either:
+ *
+ * a) the GNU Library General Public License as published by the Free
+ * Software Foundation, either version 2 of the License, or (at your
+ * option) any later version; or
+ *
+ * b) the GL2PS License as published by Christophe Geuzaine, either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See either
+ * the GNU Library General Public License or the GL2PS License for
+ * more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library in the file named "COPYING.LGPL";
+ * if not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+ * Cambridge, MA 02139, USA.
+ *
+ * You should have received a copy of the GL2PS License with this
+ * library in the file named "COPYING.GL2PS"; if not, I will be glad
+ * to provide one.
+ *
+ * For the latest info about gl2ps, see http://www.geuz.org/gl2ps/.
+ * Please report all bugs and problems to <gl2ps@geuz.org>.
+ */
+
+#ifndef __GL2PS_H__
+#define __GL2PS_H__
+
+#include <stdio.h>
+#include <stdlib.h>
+
+/* Define GL2PSDLL at compile time to build a Windows DLL */
+
+#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
+#  if defined(_MSC_VER)
+#    pragma warning(disable:4115)
+#  endif
+#  include <windows.h>
+#  if defined(GL2PSDLL)
+#    if defined(GL2PSDLL_EXPORTS)
+#      define GL2PSDLL_API __declspec(dllexport)
+#    else
+#      define GL2PSDLL_API __declspec(dllimport)
+#    endif
+#  else
+#    define GL2PSDLL_API
+#  endif
+#else
+#  define GL2PSDLL_API
+#endif
+
+#if defined(__APPLE__) || defined(HAVE_OPENGL_GL_H)
+#  include <OpenGL/gl.h>
+#else
+#  include <GL/gl.h>
+#endif
+
+/* Support for compressed PostScript/PDF/SVG and for embedded PNG
+   images in SVG */
+
+#if defined(HAVE_ZLIB) || defined(HAVE_LIBZ)
+#  define GL2PS_HAVE_ZLIB
+#  if defined(HAVE_LIBPNG) || defined(HAVE_PNG)
+#    define GL2PS_HAVE_LIBPNG
+#  endif
+#endif
+
+/* Version number */
+
+#define GL2PS_MAJOR_VERSION 1
+#define GL2PS_MINOR_VERSION 3
+#define GL2PS_PATCH_VERSION 3
+#define GL2PS_EXTRA_VERSION ""
+
+#define GL2PS_VERSION (GL2PS_MAJOR_VERSION + \
+                       0.01 * GL2PS_MINOR_VERSION + \
+                       0.0001 * GL2PS_PATCH_VERSION)
+
+#define GL2PS_COPYRIGHT "(C) 1999-2009 C. Geuzaine"
+
+/* Output file formats (the values and the ordering are important!) */
+
+#define GL2PS_PS  0
+#define GL2PS_EPS 1
+#define GL2PS_TEX 2
+#define GL2PS_PDF 3
+#define GL2PS_SVG 4
+#define GL2PS_PGF 5
+
+/* Sorting algorithms */
+
+#define GL2PS_NO_SORT     1
+#define GL2PS_SIMPLE_SORT 2
+#define GL2PS_BSP_SORT    3
+
+/* Message levels and error codes */
+
+#define GL2PS_SUCCESS       0
+#define GL2PS_INFO          1
+#define GL2PS_WARNING       2
+#define GL2PS_ERROR         3
+#define GL2PS_NO_FEEDBACK   4
+#define GL2PS_OVERFLOW      5
+#define GL2PS_UNINITIALIZED 6
+
+/* Options for gl2psBeginPage */
+
+#define GL2PS_NONE                 0
+#define GL2PS_DRAW_BACKGROUND      (1<<0)
+#define GL2PS_SIMPLE_LINE_OFFSET   (1<<1)
+#define GL2PS_SILENT               (1<<2)
+#define GL2PS_BEST_ROOT            (1<<3)
+#define GL2PS_OCCLUSION_CULL       (1<<4)
+#define GL2PS_NO_TEXT              (1<<5)
+#define GL2PS_LANDSCAPE            (1<<6)
+#define GL2PS_NO_PS3_SHADING       (1<<7)
+#define GL2PS_NO_PIXMAP            (1<<8)
+#define GL2PS_USE_CURRENT_VIEWPORT (1<<9)
+#define GL2PS_COMPRESS             (1<<10)
+#define GL2PS_NO_BLENDING          (1<<11)
+#define GL2PS_TIGHT_BOUNDING_BOX   (1<<12)
+
+/* Arguments for gl2psEnable/gl2psDisable */
+
+#define GL2PS_POLYGON_OFFSET_FILL 1
+#define GL2PS_POLYGON_BOUNDARY    2
+#define GL2PS_LINE_STIPPLE        3
+#define GL2PS_BLEND               4
+
+/* Text alignment (o=raster position; default mode is BL):
+   +---+ +---+ +---+ +---+ +---+ +---+ +-o-+ o---+ +---o 
+   | o | o   | |   o |   | |   | |   | |   | |   | |   | 
+   +---+ +---+ +---+ +-o-+ o---+ +---o +---+ +---+ +---+ 
+    C     CL    CR    B     BL    BR    T     TL    TR */
+
+#define GL2PS_TEXT_C  1
+#define GL2PS_TEXT_CL 2
+#define GL2PS_TEXT_CR 3
+#define GL2PS_TEXT_B  4
+#define GL2PS_TEXT_BL 5
+#define GL2PS_TEXT_BR 6
+#define GL2PS_TEXT_T  7
+#define GL2PS_TEXT_TL 8
+#define GL2PS_TEXT_TR 9
+
+typedef GLfloat GL2PSrgba[4];
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+GL2PSDLL_API GLint gl2psBeginPage(const char *title, const char *producer, 
+                                  GLint viewport[4], GLint format, GLint sort,
+                                  GLint options, GLint colormode,
+                                  GLint colorsize, GL2PSrgba *colormap, 
+                                  GLint nr, GLint ng, GLint nb, GLint buffersize,
+                                  FILE *stream, const char *filename);
+GL2PSDLL_API GLint gl2psEndPage(void);
+GL2PSDLL_API GLint gl2psSetOptions(GLint options);
+GL2PSDLL_API GLint gl2psGetOptions(GLint *options);
+GL2PSDLL_API GLint gl2psBeginViewport(GLint viewport[4]);
+GL2PSDLL_API GLint gl2psEndViewport(void);
+GL2PSDLL_API GLint gl2psText(const char *str, const char *fontname, 
+                             GLshort fontsize);
+GL2PSDLL_API GLint gl2psTextOpt(const char *str, const char *fontname, 
+                                GLshort fontsize, GLint align, GLfloat angle);
+GL2PSDLL_API GLint gl2psSpecial(GLint format, const char *str);
+GL2PSDLL_API GLint gl2psDrawPixels(GLsizei width, GLsizei height,
+                                   GLint xorig, GLint yorig,
+                                   GLenum format, GLenum type, const void *pixels);
+GL2PSDLL_API GLint gl2psEnable(GLint mode);
+GL2PSDLL_API GLint gl2psDisable(GLint mode);
+GL2PSDLL_API GLint gl2psPointSize(GLfloat value);
+GL2PSDLL_API GLint gl2psLineWidth(GLfloat value);
+GL2PSDLL_API GLint gl2psBlendFunc(GLenum sfactor, GLenum dfactor);
+
+/* undocumented */
+GL2PSDLL_API GLint gl2psDrawImageMap(GLsizei width, GLsizei height,
+                                     const GLfloat position[3],
+                                     const unsigned char *imagemap);
+GL2PSDLL_API const char *gl2psGetFileExtension(GLint format);
+GL2PSDLL_API const char *gl2psGetFormatDescription(GLint format);
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __GL2PS_H__ */
Index: tags/visualization-10.5-before-10.6_test/externals/gl2ps/src/G4OpenGL2PSAction.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/externals/gl2ps/src/G4OpenGL2PSAction.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/externals/gl2ps/src/G4OpenGL2PSAction.cc	(revision 1102)
@@ -0,0 +1,146 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGL2PSAction.cc,v 1.4 2009/04/29 09:37:55 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+
+#ifdef G4VIS_BUILD_OPENGL_DRIVER
+ #define G4VIS_BUILD_OPENGL_GL2PS 
+#endif
+#ifdef G4VIS_BUILD_OI_DRIVER
+ #define G4VIS_BUILD_OPENGL_GL2PS 
+#endif
+
+#ifdef G4VIS_BUILD_OPENGL_GL2PS
+
+#include "G4OpenGL2PSAction.hh"
+
+
+G4OpenGL2PSAction::G4OpenGL2PSAction(
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  fFileName = "";
+  fFile = 0;
+  fViewport[0] = 0;
+  fViewport[1] = 0;
+  fViewport[2] = 0;
+  fViewport[3] = 0;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+void G4OpenGL2PSAction::setLineWidth(
+ int width
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  gl2psLineWidth( width );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+void G4OpenGL2PSAction::setPointSize(
+ int size
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  gl2psPointSize( size );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+void G4OpenGL2PSAction::setFileName(
+ const char* aFileName
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  fFileName = aFileName;
+}
+//////////////////////////////////////////////////////////////////////////////
+bool G4OpenGL2PSAction::enableFileWriting(
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  fFile = ::fopen(fFileName,"w");
+  if(!fFile) {
+    return false;
+  }
+  G4gl2psBegin();
+  return true;
+}
+//////////////////////////////////////////////////////////////////////////////
+void G4OpenGL2PSAction::disableFileWriting(
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  gl2psEndPage();        
+  ::fclose(fFile);
+  fFile = 0;
+}
+//////////////////////////////////////////////////////////////////////////////
+bool G4OpenGL2PSAction::fileWritingEnabled(
+) const
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  return (fFile?true:false);
+}
+//////////////////////////////////////////////////////////////////////////////
+void G4OpenGL2PSAction::G4gl2psBegin(
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  if(!fFile) return;
+  int options = GL2PS_OCCLUSION_CULL | 
+     GL2PS_BEST_ROOT | GL2PS_SILENT | GL2PS_DRAW_BACKGROUND;
+  int sort = GL2PS_BSP_SORT;
+  //int sort = GL2PS_SIMPLE_SORT;
+  GLint buffsize = 0;
+  buffsize += 1024*1024;
+  
+  glGetIntegerv(GL_VIEWPORT,fViewport);
+
+  gl2psBeginPage("title","HEPVis::G4OpenGL2PSAction", 
+                 fViewport,
+                 GL2PS_EPS, 
+                 sort, 
+                 options, 
+                 GL_RGBA,0, NULL,0,0,0,
+                 buffsize, 
+                 fFile,fFileName);    
+}
+
+
+
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/externals/gl2ps/src/gl2ps.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/externals/gl2ps/src/gl2ps.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/externals/gl2ps/src/gl2ps.cc	(revision 1102)
@@ -0,0 +1,6071 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+#ifdef G4VIS_BUILD_OPENGL_DRIVER
+ #define G4VIS_BUILD_OPENGL_GL2PS 
+#endif
+#ifdef G4VIS_BUILD_OI_DRIVER
+ #define G4VIS_BUILD_OPENGL_GL2PS 
+#endif
+
+#ifdef G4VIS_BUILD_OPENGL_GL2PS
+
+/*
+ * GL2PS, an OpenGL to PostScript Printing Library
+ * Copyright (C) 1999-2009 C. Geuzaine
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of either:
+ *
+ * a) the GNU Library General Public License as published by the Free
+ * Software Foundation, either version 2 of the License, or (at your
+ * option) any later version; or
+ *
+ * b) the GL2PS License as published by Christophe Geuzaine, either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See either
+ * the GNU Library General Public License or the GL2PS License for
+ * more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library in the file named "COPYING.LGPL";
+ * if not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+ * Cambridge, MA 02139, USA.
+ *
+ * You should have received a copy of the GL2PS License with this
+ * library in the file named "COPYING.GL2PS"; if not, I will be glad
+ * to provide one.
+ *
+ * Contributors:
+ *   Michael Sweet <mike@easysw.com>
+ *   Marc Ume <marc.ume@digitalgraphics.be>
+ *   Jean-Francois Remacle <remacle@gce.ucl.ac.be>
+ *   Bart Kaptein <B.L.Kaptein@lumc.nl>
+ *   Quy Nguyen-Dai <quy@nguyendai.org>
+ *   Sam Buss <sbuss@ucsd.edu>
+ *   Shane Hill <Shane.Hill@dsto.defence.gov.au>
+ *   Romain Boman <r_boman@yahoo.fr>
+ *   Rouben Rostamian <rostamian@umbc.edu>
+ *   Diego Santa Cruz <Diego.SantaCruz@epfl.ch>
+ *   Shahzad Muzaffar <Shahzad.Muzaffar@cern.ch>
+ *   Lassi Tuura <lassi.tuura@cern.ch>
+ *   Guy Barrand <barrand@lal.in2p3.fr>
+ *   Prabhu Ramachandran <prabhu@aero.iitm.ernet.in>
+ *   Micha Bieber <bieber@traits.de>
+ *   Olivier Couet <couet@mail.cern.ch>
+ *   Shai Ayal <shaiay@gmail.com>
+ *   Fabian Wenzel <wenzel@tu-harburg.de>
+ *   Ian D. Gay <gay@sfu.ca>
+ *   Cosmin Truta <cosmin@cs.toronto.edu>
+ *   Baiju Devani <b.devani@gmail.com>
+ *   Alexander Danilov <danilov@lanl.gov>
+ *
+ * For the latest info about gl2ps, see http://www.geuz.org/gl2ps/.
+ * Please report all bugs and problems to <gl2ps@geuz.org>.
+ */
+
+#include "Geant4_gl2ps.h"
+
+#include <math.h>
+#include <string.h>
+#include <sys/types.h>
+#include <stdarg.h>
+#include <time.h>
+#include <float.h>
+
+#if defined(G4LIB_USE_ZLIB)
+#define GL2PS_HAVE_ZLIB
+#include <zlib.h>
+#endif
+
+#if defined(GL2PS_HAVE_LIBPNG)
+#include <png.h>
+#endif
+
+/********************************************************************* 
+ *
+ * Private definitions, data structures and prototypes
+ *
+ *********************************************************************/
+
+/* Magic numbers (assuming that the order of magnitude of window
+   coordinates is 10^3) */
+
+#define GL2PS_EPSILON       5.0e-3F
+#define GL2PS_ZSCALE        1000.0F
+#define GL2PS_ZOFFSET       5.0e-2F
+#define GL2PS_ZOFFSET_LARGE 20.0F
+#define GL2PS_ZERO(arg)     (fabs(arg) < 1.e-20)
+
+/* Primitive types */
+
+#define GL2PS_NO_TYPE          -1
+#define GL2PS_TEXT             1
+#define GL2PS_POINT            2
+#define GL2PS_LINE             3
+#define GL2PS_QUADRANGLE       4
+#define GL2PS_TRIANGLE         5
+#define GL2PS_PIXMAP           6
+#define GL2PS_IMAGEMAP         7
+#define GL2PS_IMAGEMAP_WRITTEN 8
+#define GL2PS_IMAGEMAP_VISIBLE 9
+#define GL2PS_SPECIAL          10
+
+/* BSP tree primitive comparison */
+
+#define GL2PS_COINCIDENT  1
+#define GL2PS_IN_FRONT_OF 2
+#define GL2PS_IN_BACK_OF  3
+#define GL2PS_SPANNING    4
+
+/* 2D BSP tree primitive comparison */
+
+#define GL2PS_POINT_COINCIDENT 0
+#define GL2PS_POINT_INFRONT    1
+#define GL2PS_POINT_BACK       2
+
+/* Internal feedback buffer pass-through tokens */
+
+#define GL2PS_BEGIN_OFFSET_TOKEN   1
+#define GL2PS_END_OFFSET_TOKEN     2
+#define GL2PS_BEGIN_BOUNDARY_TOKEN 3
+#define GL2PS_END_BOUNDARY_TOKEN   4
+#define GL2PS_BEGIN_STIPPLE_TOKEN  5
+#define GL2PS_END_STIPPLE_TOKEN    6
+#define GL2PS_POINT_SIZE_TOKEN     7
+#define GL2PS_LINE_WIDTH_TOKEN     8
+#define GL2PS_BEGIN_BLEND_TOKEN    9
+#define GL2PS_END_BLEND_TOKEN      10
+#define GL2PS_SRC_BLEND_TOKEN      11
+#define GL2PS_DST_BLEND_TOKEN      12
+#define GL2PS_IMAGEMAP_TOKEN       13
+#define GL2PS_DRAW_PIXELS_TOKEN    14
+#define GL2PS_TEXT_TOKEN           15
+
+typedef enum {
+  T_UNDEFINED    = -1,
+  T_CONST_COLOR  = 1,
+  T_VAR_COLOR    = 1<<1,
+  T_ALPHA_1      = 1<<2,
+  T_ALPHA_LESS_1 = 1<<3,
+  T_VAR_ALPHA    = 1<<4
+} GL2PS_TRIANGLE_PROPERTY;
+
+typedef GLfloat GL2PSxyz[3];
+typedef GLfloat GL2PSplane[4];
+
+typedef struct _GL2PSbsptree2d GL2PSbsptree2d;
+
+struct _GL2PSbsptree2d {
+  GL2PSplane plane;
+  GL2PSbsptree2d *front, *back;
+};
+
+typedef struct {
+  GLint nmax, size, incr, n;
+  char *array;
+} GL2PSlist;
+
+typedef struct _GL2PSbsptree GL2PSbsptree;
+
+struct _GL2PSbsptree {
+  GL2PSplane plane;
+  GL2PSlist *primitives;
+  GL2PSbsptree *front, *back;
+};
+
+typedef struct {
+  GL2PSxyz xyz;
+  GL2PSrgba rgba;
+} GL2PSvertex;
+
+typedef struct {
+  GL2PSvertex vertex[3];
+  int prop;
+} GL2PStriangle;
+
+typedef struct {
+  GLshort fontsize;
+  char *str, *fontname;
+  /* Note: for a 'special' string, 'alignment' holds the format
+     (PostScript, PDF, etc.) of the special string */
+  GLint alignment;
+  GLfloat angle;
+} GL2PSstring;
+
+typedef struct {
+  GLsizei width, height;
+  /* Note: for an imagemap, 'type' indicates if it has already been
+     written to the file or not, and 'format' indicates if it is
+     visible or not */
+  GLenum format, type;
+  GLfloat *pixels;
+} GL2PSimage;
+
+typedef struct _GL2PSimagemap GL2PSimagemap;
+
+struct _GL2PSimagemap {
+  GL2PSimage *image;
+  GL2PSimagemap *next;
+};
+
+typedef struct {
+  GLshort type, numverts;
+  GLushort pattern;
+  char boundary, offset, culled;
+  GLint factor;
+  GLfloat width;
+  GL2PSvertex *verts;
+  union {
+    GL2PSstring *text;
+    GL2PSimage *image;
+  } data;
+} GL2PSprimitive;
+
+typedef struct {
+#if defined(GL2PS_HAVE_ZLIB)
+  Bytef *dest, *src, *start;
+  uLongf destLen, srcLen;
+#else
+  int dummy;
+#endif
+} GL2PScompress;
+
+typedef struct{
+  GL2PSlist* ptrlist;
+  int gsno, fontno, imno, shno, maskshno, trgroupno;
+  int gsobjno, fontobjno, imobjno, shobjno, maskshobjno, trgroupobjno;
+} GL2PSpdfgroup;
+
+typedef struct {
+  /* General */
+  GLint format, sort, options, colorsize, colormode, buffersize;
+  char *title, *producer, *filename;
+  GLboolean boundary, blending;
+  GLfloat *feedback, offset[2], lastlinewidth;
+  GLint viewport[4], blendfunc[2], lastfactor;
+  GL2PSrgba *colormap, lastrgba, threshold, bgcolor;
+  GLushort lastpattern;
+  GL2PSvertex lastvertex;
+  GL2PSlist *primitives, *auxprimitives;
+  FILE *stream;
+  GL2PScompress *compress;
+  GLboolean header;
+
+  /* BSP-specific */
+  GLint maxbestroot;
+
+  /* Occlusion culling-specific */
+  GLboolean zerosurfacearea;
+  GL2PSbsptree2d *imagetree;
+  GL2PSprimitive *primitivetoadd;
+  
+  /* PDF-specific */
+  int streamlength;
+  GL2PSlist *pdfprimlist, *pdfgrouplist;
+  int *xreflist;
+  int objects_stack; /* available objects */
+  int extgs_stack; /* graphics state object number */
+  int font_stack; /* font object number */
+  int im_stack; /* image object number */
+  int trgroupobjects_stack; /* xobject numbers */
+  int shader_stack; /* shader object numbers */
+  int mshader_stack; /* mask shader object numbers */
+
+  /* for image map list */
+  GL2PSimagemap *imagemap_head;
+  GL2PSimagemap *imagemap_tail;
+} GL2PScontext;
+
+typedef struct {
+  void  (*printHeader)(void);
+  void  (*printFooter)(void);
+  void  (*beginViewport)(GLint viewport[4]);
+  GLint (*endViewport)(void);
+  void  (*printPrimitive)(void *data);
+  void  (*printFinalPrimitive)(void);
+  const char *file_extension;
+  const char *description;
+} GL2PSbackend;
+
+/* The gl2ps context. gl2ps is not thread safe (we should create a
+   local GL2PScontext during gl2psBeginPage) */
+
+static GL2PScontext *gl2ps = NULL;
+
+/* Need to forward-declare this one */
+
+static GLint gl2psPrintPrimitives(void);
+
+/********************************************************************* 
+ *
+ * Utility routines
+ *
+ *********************************************************************/
+
+static void gl2psMsg(GLint level, const char *fmt, ...)
+{
+  va_list args;
+
+  if(!(gl2ps->options & GL2PS_SILENT)){
+    switch(level){
+    case GL2PS_INFO : fprintf(stderr, "GL2PS info: "); break;
+    case GL2PS_WARNING : fprintf(stderr, "GL2PS warning: "); break;
+    case GL2PS_ERROR : fprintf(stderr, "GL2PS error: "); break;
+    }
+    va_start(args, fmt);
+    vfprintf(stderr, fmt, args); 
+    va_end(args);
+    fprintf(stderr, "\n");
+  }
+  /* if(level == GL2PS_ERROR) exit(1); */
+}
+
+static void *gl2psMalloc(size_t size)
+{
+  void *ptr;
+
+  if(!size) return(NULL);
+  ptr = malloc(size);
+  if(!ptr){
+    gl2psMsg(GL2PS_ERROR, "Couldn't allocate requested memory");
+    exit(1);
+  }
+  return(ptr);
+}
+
+static void *gl2psRealloc(void *ptr, size_t size)
+{
+  if(!size) return(NULL);
+  ptr = realloc(ptr, size);
+  if(!ptr){
+    gl2psMsg(GL2PS_ERROR, "Couldn't reallocate requested memory");
+    exit(1);
+  }
+  return(ptr);
+}
+
+static void gl2psFree(void *ptr)
+{
+  if(!ptr) return;
+  free(ptr);
+}
+
+static size_t gl2psWriteBigEndian(unsigned long data, size_t bytes)
+{
+  size_t i;
+  size_t size = sizeof(unsigned long);
+  for(i = 1; i <= bytes; ++i){
+    fputc(0xff & (data >> (size-i) * 8), gl2ps->stream);
+  }
+  return bytes;
+}
+
+/* zlib compression helper routines */
+
+#if defined(GL2PS_HAVE_ZLIB)
+
+static void gl2psSetupCompress(void)
+{
+  gl2ps->compress = (GL2PScompress*)gl2psMalloc(sizeof(GL2PScompress));
+  gl2ps->compress->src = NULL;
+  gl2ps->compress->start = NULL;
+  gl2ps->compress->dest = NULL;
+  gl2ps->compress->srcLen = 0;
+  gl2ps->compress->destLen = 0;
+}
+
+static void gl2psFreeCompress(void)
+{
+  if(!gl2ps->compress)
+    return;
+  gl2psFree(gl2ps->compress->start);
+  gl2psFree(gl2ps->compress->dest);
+  gl2ps->compress->src = NULL;
+  gl2ps->compress->start = NULL;
+  gl2ps->compress->dest = NULL;
+  gl2ps->compress->srcLen = 0;
+  gl2ps->compress->destLen = 0;
+}
+
+static int gl2psAllocCompress(unsigned int srcsize)
+{
+  gl2psFreeCompress();
+  
+  if(!gl2ps->compress || !srcsize)
+    return GL2PS_ERROR;
+  
+  gl2ps->compress->srcLen = srcsize;
+  gl2ps->compress->destLen = (int)ceil(1.001 * gl2ps->compress->srcLen + 12);
+  gl2ps->compress->src = (Bytef*)gl2psMalloc(gl2ps->compress->srcLen);
+  gl2ps->compress->start = gl2ps->compress->src;
+  gl2ps->compress->dest = (Bytef*)gl2psMalloc(gl2ps->compress->destLen);
+  
+  return GL2PS_SUCCESS;
+}
+
+static void *gl2psReallocCompress(unsigned int srcsize)
+{
+  if(!gl2ps->compress || !srcsize)
+    return NULL;
+  
+  if(srcsize < gl2ps->compress->srcLen)
+    return gl2ps->compress->start;
+  
+  gl2ps->compress->srcLen = srcsize;
+  gl2ps->compress->destLen = (int)ceil(1.001 * gl2ps->compress->srcLen + 12);
+  gl2ps->compress->src = (Bytef*)gl2psRealloc(gl2ps->compress->src, 
+                                              gl2ps->compress->srcLen);
+  gl2ps->compress->start = gl2ps->compress->src;
+  gl2ps->compress->dest = (Bytef*)gl2psRealloc(gl2ps->compress->dest, 
+                                               gl2ps->compress->destLen);
+  
+  return gl2ps->compress->start;
+}
+
+static size_t gl2psWriteBigEndianCompress(unsigned long data, size_t bytes)
+{
+  size_t i;
+  size_t size = sizeof(unsigned long);
+  for(i = 1; i <= bytes; ++i){
+    *gl2ps->compress->src = (Bytef)(0xff & (data >> (size-i) * 8));
+    ++gl2ps->compress->src;
+  }
+  return bytes;
+}
+
+static int gl2psDeflate(void)
+{
+  /* For compatibility with older zlib versions, we use compress(...)
+     instead of compress2(..., Z_BEST_COMPRESSION) */
+  return compress(gl2ps->compress->dest, &gl2ps->compress->destLen, 
+                  gl2ps->compress->start, gl2ps->compress->srcLen);  
+}
+
+#endif
+
+static int gl2psPrintf(const char* fmt, ...)
+{
+  int ret;
+  va_list args;
+
+#if defined(GL2PS_HAVE_ZLIB)
+  unsigned int oldsize = 0;
+  static char buf[1000];
+  if(gl2ps->options & GL2PS_COMPRESS){
+    va_start(args, fmt);
+    ret = vsprintf(buf, fmt, args);
+    va_end(args);
+    oldsize = gl2ps->compress->srcLen;
+    gl2ps->compress->start = (Bytef*)gl2psReallocCompress(oldsize + ret);
+    memcpy(gl2ps->compress->start+oldsize, buf, ret);
+    ret = 0;
+  }
+  else{
+#endif
+    va_start(args, fmt);
+    ret = vfprintf(gl2ps->stream, fmt, args);
+    va_end(args);
+#if defined(GL2PS_HAVE_ZLIB)
+  }
+#endif
+  return ret;
+}
+
+static void gl2psPrintGzipHeader()
+{
+#if defined(GL2PS_HAVE_ZLIB)
+  char tmp[10] = {'\x1f', '\x8b', /* magic numbers: 0x1f, 0x8b */
+                  8, /* compression method: Z_DEFLATED */
+                  0, /* flags */
+                  0, 0, 0, 0, /* time */
+                  2, /* extra flags: max compression */
+                  '\x03'}; /* OS code: 0x03 (Unix) */
+
+  if(gl2ps->options & GL2PS_COMPRESS){
+    gl2psSetupCompress();
+    /* add the gzip file header */
+    fwrite(tmp, 10, 1, gl2ps->stream);
+  }
+#endif  
+}
+
+static void gl2psPrintGzipFooter()
+{
+#if defined(GL2PS_HAVE_ZLIB)
+  int n;
+  uLong crc, len;
+  char tmp[8];
+
+  if(gl2ps->options & GL2PS_COMPRESS){
+    if(Z_OK != gl2psDeflate()){
+      gl2psMsg(GL2PS_ERROR, "Zlib deflate error");
+    }
+    else{
+      /* determine the length of the header in the zlib stream */
+      n = 2; /* CMF+FLG */
+      if(gl2ps->compress->dest[1] & (1<<5)){
+        n += 4; /* DICTID */
+      }
+      /* write the data, without the zlib header and footer */
+      fwrite(gl2ps->compress->dest+n, gl2ps->compress->destLen-(n+4), 
+             1, gl2ps->stream);
+      /* add the gzip file footer */
+      crc = crc32(0L, gl2ps->compress->start, gl2ps->compress->srcLen);
+      for(n = 0; n < 4; ++n){
+        tmp[n] = (char)(crc & 0xff);
+        crc >>= 8;
+      }
+      len = gl2ps->compress->srcLen;
+      for(n = 4; n < 8; ++n){
+        tmp[n] = (char)(len & 0xff);
+        len >>= 8;
+      }
+      fwrite(tmp, 8, 1, gl2ps->stream);
+    }
+    gl2psFreeCompress();
+    gl2psFree(gl2ps->compress);
+    gl2ps->compress = NULL;
+  }
+#endif 
+}
+
+/* The list handling routines */
+
+static void gl2psListRealloc(GL2PSlist *list, GLint n)
+{
+  if(!list){
+    gl2psMsg(GL2PS_ERROR, "Cannot reallocate NULL list");
+    return;
+  }
+  if(n <= 0) return;
+  if(!list->array){
+    list->nmax = n;
+    list->array = (char*)gl2psMalloc(list->nmax * list->size);
+  }
+  else{
+    if(n > list->nmax){
+      list->nmax = ((n - 1) / list->incr + 1) * list->incr;
+      list->array = (char*)gl2psRealloc(list->array,
+                                        list->nmax * list->size);
+    }
+  }
+}
+
+static GL2PSlist *gl2psListCreate(GLint n, GLint incr, GLint size)
+{
+  GL2PSlist *list;
+
+  if(n < 0) n = 0;
+  if(incr <= 0) incr = 1;
+  list = (GL2PSlist*)gl2psMalloc(sizeof(GL2PSlist));
+  list->nmax = 0;
+  list->incr = incr;
+  list->size = size;
+  list->n = 0;
+  list->array = NULL;
+  gl2psListRealloc(list, n);
+  return(list);
+}
+
+static void gl2psListReset(GL2PSlist *list)
+{
+  if(!list) return;
+  list->n = 0;
+}
+
+static void gl2psListDelete(GL2PSlist *list)
+{
+  if(!list) return;  
+  gl2psFree(list->array);
+  gl2psFree(list);
+}
+
+static void gl2psListAdd(GL2PSlist *list, void *data)
+{
+  if(!list){
+    gl2psMsg(GL2PS_ERROR, "Cannot add into unallocated list");
+    return;
+  }
+  list->n++;
+  gl2psListRealloc(list, list->n);
+  memcpy(&list->array[(list->n - 1) * list->size], data, list->size);
+}
+
+static int gl2psListNbr(GL2PSlist *list)
+{
+  if(!list)
+    return 0;
+  return(list->n);
+}
+
+static void *gl2psListPointer(GL2PSlist *list, GLint index)
+{
+  if(!list){
+    gl2psMsg(GL2PS_ERROR, "Cannot point into unallocated list");
+    return NULL;
+  }
+  if((index < 0) || (index >= list->n)){
+    gl2psMsg(GL2PS_ERROR, "Wrong list index in gl2psListPointer");
+    return NULL;
+  }
+  return(&list->array[index * list->size]);
+}
+
+static void gl2psListSort(GL2PSlist *list,
+                          int (*fcmp)(const void *a, const void *b))
+{
+  if(!list)
+    return;
+  qsort(list->array, list->n, list->size, fcmp);
+}
+
+static void gl2psListAction(GL2PSlist *list, void (*action)(void *data))
+{
+  GLint i;
+
+  for(i = 0; i < gl2psListNbr(list); i++){
+    (*action)(gl2psListPointer(list, i));
+  }
+}
+
+static void gl2psListActionInverse(GL2PSlist *list, void (*action)(void *data))
+{
+  GLint i;
+
+  for(i = gl2psListNbr(list); i > 0; i--){
+    (*action)(gl2psListPointer(list, i-1));
+  }
+}
+
+#if defined(GL2PS_HAVE_LIBPNG)
+
+static void gl2psListRead(GL2PSlist *list, int index, void *data)
+{
+  if((index < 0) || (index >= list->n))
+    gl2psMsg(GL2PS_ERROR, "Wrong list index in gl2psListRead");
+  memcpy(data, &list->array[index * list->size], list->size);
+}
+
+static void gl2psEncodeBase64Block(unsigned char in[3], unsigned char out[4], int len)
+{
+  static const char cb64[] = 
+    "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+
+  out[0] = cb64[ in[0] >> 2 ];
+  out[1] = cb64[ ((in[0] & 0x03) << 4) | ((in[1] & 0xf0) >> 4) ];
+  out[2] = (len > 1) ? cb64[ ((in[1] & 0x0f) << 2) | ((in[2] & 0xc0) >> 6) ] : '=';
+  out[3] = (len > 2) ? cb64[ in[2] & 0x3f ] : '=';
+}
+
+static void gl2psListEncodeBase64(GL2PSlist *list)
+{
+  unsigned char *buffer, in[3], out[4];
+  int i, n, index, len;
+
+  n = list->n * list->size;
+  buffer = (unsigned char*)gl2psMalloc(n * sizeof(unsigned char));
+  memcpy(buffer, list->array, n * sizeof(unsigned char));
+  gl2psListReset(list);
+
+  index = 0;
+  while(index < n) {
+    len = 0;
+    for(i = 0; i < 3; i++) {
+      if(index < n){
+        in[i] = buffer[index];
+        len++;
+      }
+      else{
+        in[i] = 0;
+      }
+      index++;
+    }
+    if(len) {
+      gl2psEncodeBase64Block(in, out, len);
+      for(i = 0; i < 4; i++)
+        gl2psListAdd(list, &out[i]);
+    }
+  }
+  gl2psFree(buffer);
+}
+
+#endif
+
+/* Helpers for rgba colors */
+
+static GLboolean gl2psSameColor(GL2PSrgba rgba1, GL2PSrgba rgba2)
+{
+  if(!GL2PS_ZERO(rgba1[0] - rgba2[0]) ||
+     !GL2PS_ZERO(rgba1[1] - rgba2[1]) ||
+     !GL2PS_ZERO(rgba1[2] - rgba2[2]))
+    return GL_FALSE;
+  return GL_TRUE;
+}
+  
+static GLboolean gl2psVertsSameColor(const GL2PSprimitive *prim)
+{
+  int i;
+
+  for(i = 1; i < prim->numverts; i++){
+    if(!gl2psSameColor(prim->verts[0].rgba, prim->verts[i].rgba)){
+      return GL_FALSE;
+    }
+  }
+  return GL_TRUE;
+}
+
+static GLboolean gl2psSameColorThreshold(int n, GL2PSrgba rgba[],
+                                         GL2PSrgba threshold)
+{
+  int i;
+
+  if(n < 2) return GL_TRUE;
+  
+  for(i = 1; i < n; i++){
+    if(fabs(rgba[0][0] - rgba[i][0]) > threshold[0] ||
+       fabs(rgba[0][1] - rgba[i][1]) > threshold[1] ||
+       fabs(rgba[0][2] - rgba[i][2]) > threshold[2])
+      return GL_FALSE;
+  }
+  
+  return GL_TRUE;
+}
+
+static void gl2psSetLastColor(GL2PSrgba rgba)
+{
+  int i;        
+  for(i = 0; i < 3; ++i){
+    gl2ps->lastrgba[i] = rgba[i];
+  }
+}
+
+static GLfloat gl2psGetRGB(GL2PSimage *im, GLuint x, GLuint y,
+                           GLfloat *red, GLfloat *green, GLfloat *blue)
+{
+  
+  GLsizei width = im->width;
+  GLsizei height = im->height;
+  GLfloat *pixels = im->pixels;
+  GLfloat *pimag;
+
+  /* OpenGL image is from down to up, PS image is up to down */  
+  switch(im->format){
+  case GL_RGBA:
+    pimag = pixels + 4 * (width * (height - 1 - y) + x);
+    break;
+  case GL_RGB:
+  default:
+    pimag = pixels + 3 * (width * (height - 1 - y) + x);
+    break;
+  }
+  *red = *pimag; pimag++;
+  *green = *pimag; pimag++;
+  *blue = *pimag; pimag++;
+
+  return (im->format == GL_RGBA) ? *pimag : 1.0F;
+}
+
+/* Helper routines for pixmaps */
+
+static GL2PSimage *gl2psCopyPixmap(GL2PSimage *im)
+{
+  int size;
+  GL2PSimage *image = (GL2PSimage*)gl2psMalloc(sizeof(GL2PSimage));
+  
+  image->width = im->width;
+  image->height = im->height;
+  image->format = im->format;
+  image->type = im->type;
+
+  switch(image->format){
+  case GL_RGBA:
+    size = image->height * image->width * 4 * sizeof(GLfloat);
+    break;
+  case GL_RGB:
+  default:
+    size = image->height * image->width * 3 * sizeof(GLfloat);
+    break;
+  }
+
+  image->pixels = (GLfloat*)gl2psMalloc(size);
+  memcpy(image->pixels, im->pixels, size);
+  
+  return image;
+}
+
+static void gl2psFreePixmap(GL2PSimage *im)
+{
+  if(!im)
+    return;
+  gl2psFree(im->pixels);
+  gl2psFree(im);
+}
+
+#if defined(GL2PS_HAVE_LIBPNG)
+
+#if !defined(png_jmpbuf)
+#  define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf)
+#endif
+
+static void gl2psUserWritePNG(png_structp png_ptr, png_bytep data, png_size_t length)
+{
+  unsigned int i;
+  GL2PSlist *png = (GL2PSlist*)png_get_io_ptr(png_ptr);
+  for(i = 0; i < length; i++) 
+    gl2psListAdd(png, &data[i]);
+}
+
+static void gl2psUserFlushPNG(png_structp png_ptr)
+{
+}
+
+static void gl2psConvertPixmapToPNG(GL2PSimage *pixmap, GL2PSlist *png)
+{
+  png_structp png_ptr;
+  png_infop info_ptr;
+  unsigned char *row_data;
+  GLfloat dr, dg, db;
+  int row, col;
+
+  if(!(png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL)))
+    return;
+  
+  if(!(info_ptr = png_create_info_struct(png_ptr))){
+    png_destroy_write_struct(&png_ptr, NULL);
+    return;
+  }
+  
+  if(setjmp(png_jmpbuf(png_ptr))) {
+    png_destroy_write_struct(&png_ptr, &info_ptr);
+    return;
+  }
+  
+  png_set_write_fn(png_ptr, (void *)png, gl2psUserWritePNG, gl2psUserFlushPNG);
+  png_set_compression_level(png_ptr, Z_DEFAULT_COMPRESSION);
+  png_set_IHDR(png_ptr, info_ptr, pixmap->width, pixmap->height, 8, 
+               PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, 
+               PNG_FILTER_TYPE_BASE);
+  png_write_info(png_ptr, info_ptr);
+
+  row_data = (unsigned char*)gl2psMalloc(3 * pixmap->width * sizeof(unsigned char));
+  for(row = 0; row < pixmap->height; row++){
+    for(col = 0; col < pixmap->width; col++){
+      gl2psGetRGB(pixmap, col, row, &dr, &dg, &db);
+      row_data[3*col] = (unsigned char)(255. * dr);
+      row_data[3*col+1] = (unsigned char)(255. * dg);
+      row_data[3*col+2] = (unsigned char)(255. * db);
+    }
+    png_write_row(png_ptr, (png_bytep)row_data);
+  }
+  gl2psFree(row_data);
+
+  png_write_end(png_ptr, info_ptr);
+  png_destroy_write_struct(&png_ptr, &info_ptr);
+}
+
+#endif
+
+/* Helper routines for text strings */
+
+static GLint gl2psAddText(GLint type, const char *str, const char *fontname, 
+                          GLshort fontsize, GLint alignment, GLfloat angle)
+{
+  GLfloat pos[4];
+  GL2PSprimitive *prim;
+  GLboolean valid;
+
+  if(!gl2ps || !str || !fontname) return GL2PS_UNINITIALIZED;
+
+  if(gl2ps->options & GL2PS_NO_TEXT) return GL2PS_SUCCESS;
+
+  glGetBooleanv(GL_CURRENT_RASTER_POSITION_VALID, &valid);
+  if(GL_FALSE == valid) return GL2PS_SUCCESS; /* the primitive is culled */
+
+  glGetFloatv(GL_CURRENT_RASTER_POSITION, pos);
+
+  prim = (GL2PSprimitive*)gl2psMalloc(sizeof(GL2PSprimitive));
+  prim->type = type;
+  prim->boundary = 0;
+  prim->numverts = 1;
+  prim->verts = (GL2PSvertex*)gl2psMalloc(sizeof(GL2PSvertex));
+  prim->verts[0].xyz[0] = pos[0];
+  prim->verts[0].xyz[1] = pos[1];
+  prim->verts[0].xyz[2] = pos[2];
+  prim->culled = 0;
+  prim->offset = 0;
+  prim->pattern = 0;
+  prim->factor = 0;
+  prim->width = 1;
+  glGetFloatv(GL_CURRENT_RASTER_COLOR, prim->verts[0].rgba);
+  prim->data.text = (GL2PSstring*)gl2psMalloc(sizeof(GL2PSstring));
+  prim->data.text->str = (char*)gl2psMalloc((strlen(str)+1)*sizeof(char));
+  strcpy(prim->data.text->str, str); 
+  prim->data.text->fontname = (char*)gl2psMalloc((strlen(fontname)+1)*sizeof(char));
+  strcpy(prim->data.text->fontname, fontname);
+  prim->data.text->fontsize = fontsize;
+  prim->data.text->alignment = alignment;
+  prim->data.text->angle = angle;
+
+  gl2psListAdd(gl2ps->auxprimitives, &prim);
+  glPassThrough(GL2PS_TEXT_TOKEN);
+    
+  return GL2PS_SUCCESS;
+}
+
+static GL2PSstring *gl2psCopyText(GL2PSstring *t)
+{
+  GL2PSstring *text = (GL2PSstring*)gl2psMalloc(sizeof(GL2PSstring));
+  text->str = (char*)gl2psMalloc((strlen(t->str)+1)*sizeof(char));
+  strcpy(text->str, t->str); 
+  text->fontname = (char*)gl2psMalloc((strlen(t->fontname)+1)*sizeof(char));
+  strcpy(text->fontname, t->fontname);
+  text->fontsize = t->fontsize;
+  text->alignment = t->alignment;
+  text->angle = t->angle;
+  
+  return text;
+}
+
+static void gl2psFreeText(GL2PSstring *text)
+{
+  if(!text)
+    return;
+  gl2psFree(text->str);
+  gl2psFree(text->fontname);
+  gl2psFree(text);
+}
+
+/* Helpers for blending modes */
+
+static GLboolean gl2psSupportedBlendMode(GLenum sfactor, GLenum dfactor)
+{
+  /* returns TRUE if gl2ps supports the argument combination: only two
+     blending modes have been implemented so far */
+
+  if( (sfactor == GL_SRC_ALPHA && dfactor == GL_ONE_MINUS_SRC_ALPHA) || 
+      (sfactor == GL_ONE && dfactor == GL_ZERO) )
+    return GL_TRUE;
+  return GL_FALSE;
+}
+
+static void gl2psAdaptVertexForBlending(GL2PSvertex *v)
+{
+  /* Transforms vertex depending on the actual blending function -
+     currently the vertex v is considered as source vertex and his
+     alpha value is changed to 1.0 if source blending GL_ONE is
+     active. This might be extended in the future */
+
+  if(!v || !gl2ps)
+    return;
+
+  if(gl2ps->options & GL2PS_NO_BLENDING || !gl2ps->blending){
+    v->rgba[3] = 1.0F;
+    return;
+  }
+  
+  switch(gl2ps->blendfunc[0]){
+  case GL_ONE:
+    v->rgba[3] = 1.0F;
+    break;
+  default:
+    break;
+  }
+}
+
+static void gl2psAssignTriangleProperties(GL2PStriangle *t)
+{
+  /* int i; */
+
+  t->prop = T_VAR_COLOR;
+
+  /* Uncommenting the following lines activates an even more fine
+     grained distinction between triangle types - please don't delete,
+     a remarkable amount of PDF handling code inside this file depends
+     on it if activated */
+  /*
+  t->prop = T_CONST_COLOR;    
+  for(i = 0; i < 3; ++i){
+    if(!GL2PS_ZERO(t->vertex[0].rgba[i] - t->vertex[1].rgba[i]) || 
+       !GL2PS_ZERO(t->vertex[1].rgba[i] - t->vertex[2].rgba[i])){
+      t->prop = T_VAR_COLOR;
+      break;
+    }
+  }
+  */
+
+  if(!GL2PS_ZERO(t->vertex[0].rgba[3] - t->vertex[1].rgba[3]) || 
+     !GL2PS_ZERO(t->vertex[1].rgba[3] - t->vertex[2].rgba[3])){
+    t->prop |= T_VAR_ALPHA;
+  }
+  else{
+    if(t->vertex[0].rgba[3] < 1)
+      t->prop |= T_ALPHA_LESS_1;
+    else
+      t->prop |= T_ALPHA_1;
+  }
+}
+
+static void gl2psFillTriangleFromPrimitive(GL2PStriangle *t, GL2PSprimitive *p,
+                                           GLboolean assignprops)
+{
+  t->vertex[0] = p->verts[0];
+  t->vertex[1] = p->verts[1];
+  t->vertex[2] = p->verts[2];
+  if(GL_TRUE == assignprops)
+    gl2psAssignTriangleProperties(t);
+}
+
+static void gl2psInitTriangle(GL2PStriangle *t)
+{
+  int i;
+  GL2PSvertex vertex = { {-1.0F, -1.0F, -1.0F}, {-1.0F, -1.0F, -1.0F, -1.0F} };
+  for(i = 0; i < 3; i++)
+    t->vertex[i] = vertex;
+  t->prop = T_UNDEFINED;
+}
+
+/* Miscellaneous helper routines */
+
+static GL2PSprimitive *gl2psCopyPrimitive(GL2PSprimitive *p)
+{
+  GL2PSprimitive *prim;
+
+  if(!p){
+    gl2psMsg(GL2PS_ERROR, "Trying to copy an empty primitive");
+    return NULL;
+  }
+
+  prim = (GL2PSprimitive*)gl2psMalloc(sizeof(GL2PSprimitive));
+  
+  prim->type = p->type;
+  prim->numverts = p->numverts;
+  prim->boundary = p->boundary;
+  prim->offset = p->offset;
+  prim->pattern = p->pattern;
+  prim->factor = p->factor;
+  prim->culled = p->culled;
+  prim->width = p->width;
+  prim->verts = (GL2PSvertex*)gl2psMalloc(p->numverts*sizeof(GL2PSvertex));
+  memcpy(prim->verts, p->verts, p->numverts * sizeof(GL2PSvertex));
+
+  switch(prim->type){
+  case GL2PS_PIXMAP :
+    prim->data.image = gl2psCopyPixmap(p->data.image);
+    break;
+  case GL2PS_TEXT :
+  case GL2PS_SPECIAL :
+    prim->data.text = gl2psCopyText(p->data.text);
+    break;
+  default:
+    break;
+  }
+
+  return prim;
+}
+
+static GLboolean gl2psSamePosition(GL2PSxyz p1, GL2PSxyz p2)
+{
+  if(!GL2PS_ZERO(p1[0] - p2[0]) ||
+     !GL2PS_ZERO(p1[1] - p2[1]) ||
+     !GL2PS_ZERO(p1[2] - p2[2]))
+    return GL_FALSE;
+  return GL_TRUE;
+}
+
+/********************************************************************* 
+ *
+ * 3D sorting routines 
+ *
+ *********************************************************************/
+
+static GLfloat gl2psComparePointPlane(GL2PSxyz point, GL2PSplane plane)
+{
+  return(plane[0] * point[0] + 
+         plane[1] * point[1] + 
+         plane[2] * point[2] + 
+         plane[3]);
+}
+
+static GLfloat gl2psPsca(GLfloat *a, GLfloat *b)
+{
+  return(a[0]*b[0] + a[1]*b[1] + a[2]*b[2]);
+}
+
+static void gl2psPvec(GLfloat *a, GLfloat *b, GLfloat *c)
+{
+  c[0] = a[1]*b[2] - a[2]*b[1];
+  c[1] = a[2]*b[0] - a[0]*b[2];
+  c[2] = a[0]*b[1] - a[1]*b[0];
+}
+
+static GLfloat gl2psNorm(GLfloat *a)
+{
+  return (GLfloat)sqrt(a[0]*a[0] + a[1]*a[1] + a[2]*a[2]);
+}
+
+static void gl2psGetNormal(GLfloat *a, GLfloat *b, GLfloat *c)
+{
+  GLfloat norm;
+
+  gl2psPvec(a, b, c);
+  if(!GL2PS_ZERO(norm = gl2psNorm(c))){
+    c[0] = c[0] / norm;
+    c[1] = c[1] / norm;
+    c[2] = c[2] / norm;
+  }
+  else{
+    /* The plane is still wrong despite our tests in gl2psGetPlane.
+       Let's return a dummy value for now (this is a hack: we should
+       do more intelligent tests in GetPlane) */
+    c[0] = c[1] = 0.0F;
+    c[2] = 1.0F;
+  }
+}
+
+static void gl2psGetPlane(GL2PSprimitive *prim, GL2PSplane plane)
+{
+  GL2PSxyz v = {0.0F, 0.0F, 0.0F}, w = {0.0F, 0.0F, 0.0F};
+
+  switch(prim->type){
+  case GL2PS_TRIANGLE :
+  case GL2PS_QUADRANGLE :
+    v[0] = prim->verts[1].xyz[0] - prim->verts[0].xyz[0]; 
+    v[1] = prim->verts[1].xyz[1] - prim->verts[0].xyz[1]; 
+    v[2] = prim->verts[1].xyz[2] - prim->verts[0].xyz[2]; 
+    w[0] = prim->verts[2].xyz[0] - prim->verts[0].xyz[0]; 
+    w[1] = prim->verts[2].xyz[1] - prim->verts[0].xyz[1]; 
+    w[2] = prim->verts[2].xyz[2] - prim->verts[0].xyz[2]; 
+    if((GL2PS_ZERO(v[0]) && GL2PS_ZERO(v[1]) && GL2PS_ZERO(v[2])) || 
+       (GL2PS_ZERO(w[0]) && GL2PS_ZERO(w[1]) && GL2PS_ZERO(w[2]))){
+      plane[0] = plane[1] = 0.0F;
+      plane[2] = 1.0F;
+      plane[3] = -prim->verts[0].xyz[2];
+    }
+    else{
+      gl2psGetNormal(v, w, plane);
+      plane[3] = 
+        - plane[0] * prim->verts[0].xyz[0] 
+        - plane[1] * prim->verts[0].xyz[1] 
+        - plane[2] * prim->verts[0].xyz[2];
+    }
+    break;
+  case GL2PS_LINE :
+    v[0] = prim->verts[1].xyz[0] - prim->verts[0].xyz[0]; 
+    v[1] = prim->verts[1].xyz[1] - prim->verts[0].xyz[1]; 
+    v[2] = prim->verts[1].xyz[2] - prim->verts[0].xyz[2]; 
+    if(GL2PS_ZERO(v[0]) && GL2PS_ZERO(v[1]) && GL2PS_ZERO(v[2])){
+      plane[0] = plane[1] = 0.0F;
+      plane[2] = 1.0F;
+      plane[3] = -prim->verts[0].xyz[2];
+    }
+    else{
+      if(GL2PS_ZERO(v[0]))      w[0] = 1.0F;
+      else if(GL2PS_ZERO(v[1])) w[1] = 1.0F;
+      else                      w[2] = 1.0F;
+      gl2psGetNormal(v, w, plane);
+      plane[3] = 
+        - plane[0] * prim->verts[0].xyz[0] 
+        - plane[1] * prim->verts[0].xyz[1] 
+        - plane[2] * prim->verts[0].xyz[2];
+    }
+    break;
+  case GL2PS_POINT :
+  case GL2PS_PIXMAP :
+  case GL2PS_TEXT :
+  case GL2PS_SPECIAL :
+  case GL2PS_IMAGEMAP:
+    plane[0] = plane[1] = 0.0F;
+    plane[2] = 1.0F;
+    plane[3] = -prim->verts[0].xyz[2];
+    break;
+  default :
+    gl2psMsg(GL2PS_ERROR, "Unknown primitive type in BSP tree");
+    plane[0] = plane[1] = plane[3] = 0.0F;
+    plane[2] = 1.0F;
+    break;
+  }
+}
+
+static void gl2psCutEdge(GL2PSvertex *a, GL2PSvertex *b, GL2PSplane plane,
+                         GL2PSvertex *c)
+{
+  GL2PSxyz v;
+  GLfloat sect, psca;
+
+  v[0] = b->xyz[0] - a->xyz[0];
+  v[1] = b->xyz[1] - a->xyz[1];
+  v[2] = b->xyz[2] - a->xyz[2];
+
+  if(!GL2PS_ZERO(psca = gl2psPsca(plane, v)))
+    sect = -gl2psComparePointPlane(a->xyz, plane) / psca;
+  else
+    sect = 0.0F;
+  
+  c->xyz[0] = a->xyz[0] + v[0] * sect;
+  c->xyz[1] = a->xyz[1] + v[1] * sect;
+  c->xyz[2] = a->xyz[2] + v[2] * sect;
+  
+  c->rgba[0] = (1 - sect) * a->rgba[0] + sect * b->rgba[0];
+  c->rgba[1] = (1 - sect) * a->rgba[1] + sect * b->rgba[1];
+  c->rgba[2] = (1 - sect) * a->rgba[2] + sect * b->rgba[2];
+  c->rgba[3] = (1 - sect) * a->rgba[3] + sect * b->rgba[3];
+}
+
+static void gl2psCreateSplitPrimitive(GL2PSprimitive *parent, GL2PSplane plane,
+                                      GL2PSprimitive *child, GLshort numverts,
+                                      GLshort *index0, GLshort *index1)
+{
+  GLshort i;
+
+  if(parent->type == GL2PS_IMAGEMAP){
+    child->type = GL2PS_IMAGEMAP;
+    child->data.image = parent->data.image;
+  }
+  else{
+    if(numverts > 4){
+      gl2psMsg(GL2PS_WARNING, "%d vertices in polygon", numverts);
+      numverts = 4;
+    }
+    switch(numverts){
+    case 1 : child->type = GL2PS_POINT; break; 
+    case 2 : child->type = GL2PS_LINE; break; 
+    case 3 : child->type = GL2PS_TRIANGLE; break; 
+    case 4 : child->type = GL2PS_QUADRANGLE; break;    
+    default: child->type = GL2PS_NO_TYPE; break;
+    }
+  }
+
+  child->boundary = 0; /* FIXME: not done! */
+  child->culled = parent->culled;
+  child->offset = parent->offset;
+  child->pattern = parent->pattern;
+  child->factor = parent->factor;
+  child->width = parent->width;
+  child->numverts = numverts;
+  child->verts = (GL2PSvertex*)gl2psMalloc(numverts * sizeof(GL2PSvertex));
+
+  for(i = 0; i < numverts; i++){
+    if(index1[i] < 0){
+      child->verts[i] = parent->verts[index0[i]];
+    }
+    else{
+      gl2psCutEdge(&parent->verts[index0[i]], &parent->verts[index1[i]], 
+                   plane, &child->verts[i]);
+    }
+  }
+}
+
+static void gl2psAddIndex(GLshort *index0, GLshort *index1, GLshort *nb, 
+                          GLshort i, GLshort j)
+{
+  GLint k;
+
+  for(k = 0; k < *nb; k++){
+    if((index0[k] == i && index1[k] == j) ||
+       (index1[k] == i && index0[k] == j)) return;
+  }
+  index0[*nb] = i;
+  index1[*nb] = j;
+  (*nb)++;
+}
+
+static GLshort gl2psGetIndex(GLshort i, GLshort num)
+{
+  return (i < num - 1) ? i + 1 : 0;
+}
+
+static GLint gl2psTestSplitPrimitive(GL2PSprimitive *prim, GL2PSplane plane)
+{
+  GLint type = GL2PS_COINCIDENT;
+  GLshort i, j;
+  GLfloat d[5]; 
+
+  for(i = 0; i < prim->numverts; i++){  
+    d[i] = gl2psComparePointPlane(prim->verts[i].xyz, plane);
+  }
+
+  if(prim->numverts < 2){
+    return 0;
+  }
+  else{
+    for(i = 0; i < prim->numverts; i++){
+      j = gl2psGetIndex(i, prim->numverts);
+      if(d[j] > GL2PS_EPSILON){
+        if(type == GL2PS_COINCIDENT)      type = GL2PS_IN_BACK_OF;
+        else if(type != GL2PS_IN_BACK_OF) return 1; 
+        if(d[i] < -GL2PS_EPSILON)         return 1;
+      }
+      else if(d[j] < -GL2PS_EPSILON){
+        if(type == GL2PS_COINCIDENT)       type = GL2PS_IN_FRONT_OF;   
+        else if(type != GL2PS_IN_FRONT_OF) return 1;
+        if(d[i] > GL2PS_EPSILON)           return 1;
+      }
+    }
+  }
+  return 0;
+}
+
+static GLint gl2psSplitPrimitive(GL2PSprimitive *prim, GL2PSplane plane, 
+                                 GL2PSprimitive **front, GL2PSprimitive **back)
+{
+  GLshort i, j, in = 0, out = 0, in0[5], in1[5], out0[5], out1[5];
+  GLint type;
+  GLfloat d[5]; 
+
+  type = GL2PS_COINCIDENT;
+
+  for(i = 0; i < prim->numverts; i++){  
+    d[i] = gl2psComparePointPlane(prim->verts[i].xyz, plane);
+  }
+
+  switch(prim->type){
+  case GL2PS_POINT :
+    if(d[0] > GL2PS_EPSILON)       type = GL2PS_IN_BACK_OF;
+    else if(d[0] < -GL2PS_EPSILON) type = GL2PS_IN_FRONT_OF;
+    else                           type = GL2PS_COINCIDENT;
+    break;
+  default :
+    for(i = 0; i < prim->numverts; i++){
+      j = gl2psGetIndex(i, prim->numverts);
+      if(d[j] > GL2PS_EPSILON){
+        if(type == GL2PS_COINCIDENT)      type = GL2PS_IN_BACK_OF;
+        else if(type != GL2PS_IN_BACK_OF) type = GL2PS_SPANNING; 
+        if(d[i] < -GL2PS_EPSILON){
+          gl2psAddIndex(in0, in1, &in, i, j);
+          gl2psAddIndex(out0, out1, &out, i, j);
+          type = GL2PS_SPANNING;
+        }
+        gl2psAddIndex(out0, out1, &out, j, -1);
+      }
+      else if(d[j] < -GL2PS_EPSILON){
+        if(type == GL2PS_COINCIDENT)       type = GL2PS_IN_FRONT_OF;   
+        else if(type != GL2PS_IN_FRONT_OF) type = GL2PS_SPANNING;
+        if(d[i] > GL2PS_EPSILON){
+          gl2psAddIndex(in0, in1, &in, i, j);
+          gl2psAddIndex(out0, out1, &out, i, j);
+          type = GL2PS_SPANNING;
+        }
+        gl2psAddIndex(in0, in1, &in, j, -1);
+      }
+      else{
+        gl2psAddIndex(in0, in1, &in, j, -1);
+        gl2psAddIndex(out0, out1, &out, j, -1);
+      }
+    }
+    break;
+  }
+
+  if(type == GL2PS_SPANNING){
+    *back = (GL2PSprimitive*)gl2psMalloc(sizeof(GL2PSprimitive));
+    *front = (GL2PSprimitive*)gl2psMalloc(sizeof(GL2PSprimitive));
+    gl2psCreateSplitPrimitive(prim, plane, *back, out, out0, out1);
+    gl2psCreateSplitPrimitive(prim, plane, *front, in, in0, in1);
+  }
+
+  return type;
+}
+
+static void gl2psDivideQuad(GL2PSprimitive *quad, 
+                            GL2PSprimitive **t1, GL2PSprimitive **t2)
+{
+  *t1 = (GL2PSprimitive*)gl2psMalloc(sizeof(GL2PSprimitive));
+  *t2 = (GL2PSprimitive*)gl2psMalloc(sizeof(GL2PSprimitive));
+  (*t1)->type = (*t2)->type = GL2PS_TRIANGLE;
+  (*t1)->numverts = (*t2)->numverts = 3;
+  (*t1)->culled = (*t2)->culled = quad->culled;
+  (*t1)->offset = (*t2)->offset = quad->offset;
+  (*t1)->pattern = (*t2)->pattern = quad->pattern;
+  (*t1)->factor = (*t2)->factor = quad->factor;
+  (*t1)->width = (*t2)->width = quad->width;
+  (*t1)->verts = (GL2PSvertex*)gl2psMalloc(3 * sizeof(GL2PSvertex));
+  (*t2)->verts = (GL2PSvertex*)gl2psMalloc(3 * sizeof(GL2PSvertex));
+  (*t1)->verts[0] = quad->verts[0];
+  (*t1)->verts[1] = quad->verts[1];
+  (*t1)->verts[2] = quad->verts[2];
+  (*t1)->boundary = ((quad->boundary & 1) ? 1 : 0) | ((quad->boundary & 2) ? 2 : 0);
+  (*t2)->verts[0] = quad->verts[0];
+  (*t2)->verts[1] = quad->verts[2];
+  (*t2)->verts[2] = quad->verts[3];
+  (*t2)->boundary = ((quad->boundary & 4) ? 2 : 0) | ((quad->boundary & 4) ? 2 : 0);
+}
+
+static int gl2psCompareDepth(const void *a, const void *b)
+{
+  GL2PSprimitive *q, *w;
+  GLfloat dq = 0.0F, dw = 0.0F, diff;
+  int i;
+  
+  q = *(GL2PSprimitive**)a;
+  w = *(GL2PSprimitive**)b;
+
+  for(i = 0; i < q->numverts; i++){
+    dq += q->verts[i].xyz[2]; 
+  }
+  dq /= (GLfloat)q->numverts;
+
+  for(i = 0; i < w->numverts; i++){
+    dw += w->verts[i].xyz[2]; 
+  }
+  dw /= (GLfloat)w->numverts;
+
+  diff = dq - dw;
+  if(diff > 0.){
+    return -1;
+  }
+  else if(diff < 0.){
+    return 1;
+  }
+  else{
+    return 0;
+  }
+}
+
+static int gl2psTrianglesFirst(const void *a, const void *b)
+{
+  GL2PSprimitive *q, *w;
+
+  q = *(GL2PSprimitive**)a;
+  w = *(GL2PSprimitive**)b;
+  return(q->type < w->type ? 1 : -1);
+}
+
+static GLint gl2psFindRoot(GL2PSlist *primitives, GL2PSprimitive **root)
+{
+  GLint i, j, count, best = 1000000, index = 0;
+  GL2PSprimitive *prim1, *prim2;
+  GL2PSplane plane;
+  GLint maxp;
+
+  if(!gl2psListNbr(primitives)){
+    gl2psMsg(GL2PS_ERROR, "Cannot fint root in empty primitive list");
+    return 0;
+  }
+
+  *root = *(GL2PSprimitive**)gl2psListPointer(primitives, 0);
+
+  if(gl2ps->options & GL2PS_BEST_ROOT){
+    maxp = gl2psListNbr(primitives);
+    if(maxp > gl2ps->maxbestroot){
+      maxp = gl2ps->maxbestroot;
+    }
+    for(i = 0; i < maxp; i++){
+      prim1 = *(GL2PSprimitive**)gl2psListPointer(primitives, i);
+      gl2psGetPlane(prim1, plane);
+      count = 0;
+      for(j = 0; j < gl2psListNbr(primitives); j++){
+        if(j != i){
+          prim2 = *(GL2PSprimitive**)gl2psListPointer(primitives, j);
+          count += gl2psTestSplitPrimitive(prim2, plane); 
+        }
+        if(count > best) break;
+      }
+      if(count < best){
+        best = count;
+        index = i;
+        *root = prim1;
+        if(!count) return index;
+      }
+    }
+    /* if(index) gl2psMsg(GL2PS_INFO, "GL2PS_BEST_ROOT was worth it: %d", index); */
+    return index;
+  }
+  else{
+    return 0;
+  }
+}
+
+static void gl2psFreeImagemap(GL2PSimagemap *list){
+  GL2PSimagemap *next;
+  while(list != NULL){
+    next = list->next;
+    gl2psFree(list->image->pixels);
+    gl2psFree(list->image);
+    gl2psFree(list);
+    list = next;
+  }
+}
+
+static void gl2psFreePrimitive(void *data)
+{
+  GL2PSprimitive *q;
+  
+  q = *(GL2PSprimitive**)data;
+  gl2psFree(q->verts);
+  if(q->type == GL2PS_TEXT || q->type == GL2PS_SPECIAL){
+    gl2psFreeText(q->data.text);
+  }
+  else if(q->type == GL2PS_PIXMAP){
+    gl2psFreePixmap(q->data.image);
+  }
+  gl2psFree(q);
+}
+
+static void gl2psAddPrimitiveInList(GL2PSprimitive *prim, GL2PSlist *list)
+{
+  GL2PSprimitive *t1, *t2;
+
+  if(prim->type != GL2PS_QUADRANGLE){
+    gl2psListAdd(list, &prim);
+  }
+  else{
+    gl2psDivideQuad(prim, &t1, &t2);
+    gl2psListAdd(list, &t1);
+    gl2psListAdd(list, &t2);
+    gl2psFreePrimitive(&prim);
+  }
+  
+}
+
+static void gl2psFreeBspTree(GL2PSbsptree **tree)
+{
+  if(*tree){
+    if((*tree)->back) gl2psFreeBspTree(&(*tree)->back);
+    if((*tree)->primitives){
+      gl2psListAction((*tree)->primitives, gl2psFreePrimitive);
+      gl2psListDelete((*tree)->primitives);
+    }
+    if((*tree)->front) gl2psFreeBspTree(&(*tree)->front);
+    gl2psFree(*tree);
+    *tree = NULL;
+  }
+}
+
+static GLboolean gl2psGreater(GLfloat f1, GLfloat f2)
+{
+  if(f1 > f2) return GL_TRUE;
+  else return GL_FALSE;
+}
+
+static GLboolean gl2psLess(GLfloat f1, GLfloat f2)
+{
+  if(f1 < f2) return GL_TRUE;
+  else return GL_FALSE;
+}
+
+static void gl2psBuildBspTree(GL2PSbsptree *tree, GL2PSlist *primitives)
+{
+  GL2PSprimitive *prim, *frontprim = NULL, *backprim = NULL;
+  GL2PSlist *frontlist, *backlist;
+  GLint i, index;
+
+  tree->front = NULL;
+  tree->back = NULL;
+  tree->primitives = gl2psListCreate(1, 2, sizeof(GL2PSprimitive*));
+  index = gl2psFindRoot(primitives, &prim);
+  gl2psGetPlane(prim, tree->plane);
+  gl2psAddPrimitiveInList(prim, tree->primitives);
+
+  frontlist = gl2psListCreate(1, 2, sizeof(GL2PSprimitive*));
+  backlist = gl2psListCreate(1, 2, sizeof(GL2PSprimitive*));
+
+  for(i = 0; i < gl2psListNbr(primitives); i++){
+    if(i != index){
+      prim = *(GL2PSprimitive**)gl2psListPointer(primitives,i);
+      switch(gl2psSplitPrimitive(prim, tree->plane, &frontprim, &backprim)){
+      case GL2PS_COINCIDENT:
+        gl2psAddPrimitiveInList(prim, tree->primitives);
+        break;
+      case GL2PS_IN_BACK_OF:
+        gl2psAddPrimitiveInList(prim, backlist);
+        break;
+      case GL2PS_IN_FRONT_OF:
+        gl2psAddPrimitiveInList(prim, frontlist);
+        break;
+      case GL2PS_SPANNING:
+        gl2psAddPrimitiveInList(backprim, backlist);
+        gl2psAddPrimitiveInList(frontprim, frontlist);
+        gl2psFreePrimitive(&prim);
+        break;
+      }
+    }
+  }
+
+  if(gl2psListNbr(tree->primitives)){
+    gl2psListSort(tree->primitives, gl2psTrianglesFirst);
+  }
+
+  if(gl2psListNbr(frontlist)){
+    gl2psListSort(frontlist, gl2psTrianglesFirst);
+    tree->front = (GL2PSbsptree*)gl2psMalloc(sizeof(GL2PSbsptree));
+    gl2psBuildBspTree(tree->front, frontlist);
+  }
+  else{
+    gl2psListDelete(frontlist);
+  }
+
+  if(gl2psListNbr(backlist)){
+    gl2psListSort(backlist, gl2psTrianglesFirst);
+    tree->back = (GL2PSbsptree*)gl2psMalloc(sizeof(GL2PSbsptree));
+    gl2psBuildBspTree(tree->back, backlist);
+  }
+  else{
+    gl2psListDelete(backlist);
+  }
+
+  gl2psListDelete(primitives);
+}
+
+static void gl2psTraverseBspTree(GL2PSbsptree *tree, GL2PSxyz eye, GLfloat epsilon,
+                                 GLboolean (*compare)(GLfloat f1, GLfloat f2),
+                                 void (*action)(void *data), int inverse)
+{
+  GLfloat result;
+
+  if(!tree) return;
+
+  result = gl2psComparePointPlane(eye, tree->plane);
+
+  if(GL_TRUE == compare(result, epsilon)){
+    gl2psTraverseBspTree(tree->back, eye, epsilon, compare, action, inverse);
+    if(inverse){
+      gl2psListActionInverse(tree->primitives, action);
+    }
+    else{
+      gl2psListAction(tree->primitives, action);
+    }
+    gl2psTraverseBspTree(tree->front, eye, epsilon, compare, action, inverse);
+  }
+  else if(GL_TRUE == compare(-epsilon, result)){ 
+    gl2psTraverseBspTree(tree->front, eye, epsilon, compare, action, inverse);
+    if(inverse){
+      gl2psListActionInverse(tree->primitives, action);
+    }
+    else{
+      gl2psListAction(tree->primitives, action);
+    }
+    gl2psTraverseBspTree(tree->back, eye, epsilon, compare, action, inverse);
+  }
+  else{
+    gl2psTraverseBspTree(tree->front, eye, epsilon, compare, action, inverse);
+    gl2psTraverseBspTree(tree->back, eye, epsilon, compare, action, inverse);
+  }
+}
+
+static void gl2psRescaleAndOffset()
+{
+  GL2PSprimitive *prim;
+  GLfloat minZ, maxZ, rangeZ, scaleZ;
+  GLfloat factor, units, area, dZ, dZdX, dZdY, maxdZ;
+  int i, j;
+
+  if(!gl2psListNbr(gl2ps->primitives))
+    return;
+
+  /* get z-buffer range */
+  prim = *(GL2PSprimitive**)gl2psListPointer(gl2ps->primitives, 0);
+  minZ = maxZ = prim->verts[0].xyz[2];
+  for(i = 1; i < prim->numverts; i++){
+    if(prim->verts[i].xyz[2] < minZ) minZ = prim->verts[i].xyz[2];
+    if(prim->verts[i].xyz[2] > maxZ) maxZ = prim->verts[i].xyz[2];
+  }
+  for(i = 1; i < gl2psListNbr(gl2ps->primitives); i++){
+    prim = *(GL2PSprimitive**)gl2psListPointer(gl2ps->primitives, i);
+    for(j = 0; j < prim->numverts; j++){
+      if(prim->verts[j].xyz[2] < minZ) minZ = prim->verts[j].xyz[2];
+      if(prim->verts[j].xyz[2] > maxZ) maxZ = prim->verts[j].xyz[2];
+    }
+  }
+  rangeZ = (maxZ - minZ);
+
+  /* rescale z-buffer coordinate in [0,GL2PS_ZSCALE], to make it of
+     the same order of magnitude as the x and y coordinates */
+  scaleZ = GL2PS_ZERO(rangeZ) ? GL2PS_ZSCALE : (GL2PS_ZSCALE / rangeZ);
+  /* avoid precision loss (we use floats!) */
+  if(scaleZ > 100000.F) scaleZ = 100000.F;
+
+  /* apply offsets */
+  for(i = 0; i < gl2psListNbr(gl2ps->primitives); i++){
+    prim = *(GL2PSprimitive**)gl2psListPointer(gl2ps->primitives, i);
+    for(j = 0; j < prim->numverts; j++){
+      prim->verts[j].xyz[2] = (prim->verts[j].xyz[2] - minZ) * scaleZ;
+    }
+    if((gl2ps->options & GL2PS_SIMPLE_LINE_OFFSET) &&
+       (prim->type == GL2PS_LINE)){
+      if(gl2ps->sort == GL2PS_SIMPLE_SORT){
+        prim->verts[0].xyz[2] -= GL2PS_ZOFFSET_LARGE;
+        prim->verts[1].xyz[2] -= GL2PS_ZOFFSET_LARGE;
+      }
+      else{
+        prim->verts[0].xyz[2] -= GL2PS_ZOFFSET;
+        prim->verts[1].xyz[2] -= GL2PS_ZOFFSET;
+      }
+    }
+    else if(prim->offset && (prim->type == GL2PS_TRIANGLE)){
+      factor = gl2ps->offset[0];
+      units = gl2ps->offset[1];
+      area = 
+        (prim->verts[1].xyz[0] - prim->verts[0].xyz[0]) * 
+        (prim->verts[2].xyz[1] - prim->verts[1].xyz[1]) - 
+        (prim->verts[2].xyz[0] - prim->verts[1].xyz[0]) * 
+        (prim->verts[1].xyz[1] - prim->verts[0].xyz[1]);
+      if(!GL2PS_ZERO(area)){
+        dZdX = 
+          ((prim->verts[2].xyz[1] - prim->verts[1].xyz[1]) *
+           (prim->verts[1].xyz[2] - prim->verts[0].xyz[2]) -
+           (prim->verts[1].xyz[1] - prim->verts[0].xyz[1]) *
+           (prim->verts[2].xyz[2] - prim->verts[1].xyz[2])) / area;
+        dZdY = 
+          ((prim->verts[1].xyz[0] - prim->verts[0].xyz[0]) *
+           (prim->verts[2].xyz[2] - prim->verts[1].xyz[2]) -
+           (prim->verts[2].xyz[0] - prim->verts[1].xyz[0]) *
+           (prim->verts[1].xyz[2] - prim->verts[0].xyz[2])) / area;
+        maxdZ = (GLfloat)sqrt(dZdX * dZdX + dZdY * dZdY);
+      }
+      else{
+        maxdZ = 0.0F;
+      }
+      dZ = factor * maxdZ + units;
+      prim->verts[0].xyz[2] += dZ;
+      prim->verts[1].xyz[2] += dZ;
+      prim->verts[2].xyz[2] += dZ;
+    }
+  }
+}
+
+/********************************************************************* 
+ *
+ * 2D sorting routines (for occlusion culling) 
+ *
+ *********************************************************************/
+
+static GLint gl2psGetPlaneFromPoints(GL2PSxyz a, GL2PSxyz b, GL2PSplane plane)
+{
+  GLfloat n; 
+
+  plane[0] = b[1] - a[1];
+  plane[1] = a[0] - b[0];
+  n = (GLfloat)sqrt(plane[0]*plane[0] + plane[1]*plane[1]);
+  plane[2] = 0.0F;
+  if(!GL2PS_ZERO(n)){
+    plane[0] /= n;
+    plane[1] /= n;
+    plane[3] = -plane[0]*a[0]-plane[1]*a[1]; 
+    return 1;
+  }
+  else{
+    plane[0] = -1.0F;
+    plane[1] = 0.0F;
+    plane[3] = a[0];
+    return 0;
+  }
+}
+
+static void gl2psFreeBspImageTree(GL2PSbsptree2d **tree)
+{
+  if(*tree){
+    if((*tree)->back)  gl2psFreeBspImageTree(&(*tree)->back);
+    if((*tree)->front) gl2psFreeBspImageTree(&(*tree)->front);
+    gl2psFree(*tree);
+    *tree = NULL;
+  }
+}
+
+static GLint gl2psCheckPoint(GL2PSxyz point, GL2PSplane plane)
+{
+  GLfloat pt_dis;
+
+  pt_dis = gl2psComparePointPlane(point, plane);
+  if(pt_dis > GL2PS_EPSILON)        return GL2PS_POINT_INFRONT;
+  else if(pt_dis < -GL2PS_EPSILON)  return GL2PS_POINT_BACK;
+  else                              return GL2PS_POINT_COINCIDENT;
+}
+
+static void gl2psAddPlanesInBspTreeImage(GL2PSprimitive *prim,
+                                         GL2PSbsptree2d **tree)
+{
+  GLint ret = 0;
+  GLint i;
+  GLint offset = 0;
+  GL2PSbsptree2d *head = NULL, *cur = NULL;
+
+  if((*tree == NULL) && (prim->numverts > 2)){
+    /* don't cull if transparent
+    for(i = 0; i < prim->numverts - 1; i++)
+      if(prim->verts[i].rgba[3] < 1.0F) return;
+    */
+    head = (GL2PSbsptree2d*)gl2psMalloc(sizeof(GL2PSbsptree2d));
+    for(i = 0; i < prim->numverts-1; i++){
+      if(!gl2psGetPlaneFromPoints(prim->verts[i].xyz,
+                                  prim->verts[i+1].xyz,
+                                  head->plane)){
+        if(prim->numverts-i > 3){
+          offset++;
+        }
+        else{
+          gl2psFree(head);
+          return;
+        }
+      }
+      else{
+        break;
+      }
+    }
+    head->back = NULL;
+    head->front = NULL;
+    for(i = 2+offset; i < prim->numverts; i++){
+      ret = gl2psCheckPoint(prim->verts[i].xyz, head->plane);
+      if(ret != GL2PS_POINT_COINCIDENT) break;
+    }
+    switch(ret){
+    case GL2PS_POINT_INFRONT :
+      cur = head;
+      for(i = 1+offset; i < prim->numverts-1; i++){
+        if(cur->front == NULL){
+          cur->front = (GL2PSbsptree2d*)gl2psMalloc(sizeof(GL2PSbsptree2d));
+        }
+        if(gl2psGetPlaneFromPoints(prim->verts[i].xyz,
+                                   prim->verts[i+1].xyz,
+                                   cur->front->plane)){
+          cur = cur->front;
+          cur->front = NULL;
+          cur->back = NULL;
+        }
+      }
+      if(cur->front == NULL){
+        cur->front = (GL2PSbsptree2d*)gl2psMalloc(sizeof(GL2PSbsptree2d));
+      }
+      if(gl2psGetPlaneFromPoints(prim->verts[i].xyz,
+                                 prim->verts[offset].xyz,
+                                 cur->front->plane)){
+        cur->front->front = NULL;
+        cur->front->back = NULL;
+      }
+      else{
+        gl2psFree(cur->front);
+        cur->front = NULL;
+      }
+      break;
+    case GL2PS_POINT_BACK :
+      for(i = 0; i < 4; i++){
+        head->plane[i] = -head->plane[i];
+      }
+      cur = head;
+      for(i = 1+offset; i < prim->numverts-1; i++){
+        if(cur->front == NULL){
+          cur->front = (GL2PSbsptree2d*)gl2psMalloc(sizeof(GL2PSbsptree2d));
+        }
+        if(gl2psGetPlaneFromPoints(prim->verts[i+1].xyz,
+                                   prim->verts[i].xyz,
+                                   cur->front->plane)){
+          cur = cur->front;
+          cur->front = NULL;
+          cur->back = NULL;
+        }
+      }
+      if(cur->front == NULL){
+        cur->front = (GL2PSbsptree2d*)gl2psMalloc(sizeof(GL2PSbsptree2d));
+      }
+      if(gl2psGetPlaneFromPoints(prim->verts[offset].xyz,
+                                 prim->verts[i].xyz,
+                                 cur->front->plane)){
+        cur->front->front = NULL;
+        cur->front->back = NULL;
+      }
+      else{
+        gl2psFree(cur->front);
+        cur->front = NULL;
+      }
+      break;
+    default:
+      gl2psFree(head);
+      return;
+    }
+    (*tree) = head;
+  }
+}
+
+static GLint gl2psCheckPrimitive(GL2PSprimitive *prim, GL2PSplane plane)
+{
+  GLint i;
+  GLint pos;
+
+  pos = gl2psCheckPoint(prim->verts[0].xyz, plane);
+  for(i = 1; i < prim->numverts; i++){
+    pos |= gl2psCheckPoint(prim->verts[i].xyz, plane);
+    if(pos == (GL2PS_POINT_INFRONT | GL2PS_POINT_BACK)) return GL2PS_SPANNING;
+  }
+  if(pos & GL2PS_POINT_INFRONT)   return GL2PS_IN_FRONT_OF;
+  else if(pos & GL2PS_POINT_BACK) return GL2PS_IN_BACK_OF;
+  else                            return GL2PS_COINCIDENT;
+}
+
+static GL2PSprimitive *gl2psCreateSplitPrimitive2D(GL2PSprimitive *parent,
+                                                   GLshort numverts,
+                                                   GL2PSvertex *vertx)
+{
+  GLint i;
+  GL2PSprimitive *child = (GL2PSprimitive*)gl2psMalloc(sizeof(GL2PSprimitive));
+
+  if(parent->type == GL2PS_IMAGEMAP){
+    child->type = GL2PS_IMAGEMAP;
+    child->data.image = parent->data.image;
+  }
+  else {
+    switch(numverts){
+    case 1 : child->type = GL2PS_POINT; break;
+    case 2 : child->type = GL2PS_LINE; break;
+    case 3 : child->type = GL2PS_TRIANGLE; break;
+    case 4 : child->type = GL2PS_QUADRANGLE; break;
+    default: child->type = GL2PS_NO_TYPE; break; /* FIXME */
+    }
+  }
+  child->boundary = 0; /* FIXME: not done! */
+  child->culled = parent->culled;
+  child->offset = parent->offset;
+  child->pattern = parent->pattern;
+  child->factor = parent->factor;
+  child->width = parent->width;
+  child->numverts = numverts;
+  child->verts = (GL2PSvertex*)gl2psMalloc(numverts * sizeof(GL2PSvertex));
+  for(i = 0; i < numverts; i++){
+    child->verts[i] = vertx[i];
+  }
+  return child;
+}
+
+static void gl2psSplitPrimitive2D(GL2PSprimitive *prim,
+                                  GL2PSplane plane, 
+                                  GL2PSprimitive **front, 
+                                  GL2PSprimitive **back)
+{
+  /* cur will hold the position of the current vertex
+     prev will hold the position of the previous vertex
+     prev0 will hold the position of the vertex number 0
+     v1 and v2 represent the current and previous vertices, respectively
+     flag is set if the current vertex should be checked against the plane */
+  GLint cur = -1, prev = -1, i, v1 = 0, v2 = 0, flag = 1, prev0 = -1;
+  
+  /* list of vertices that will go in front and back primitive */
+  GL2PSvertex *front_list = NULL, *back_list = NULL;
+  
+  /* number of vertices in front and back list */
+  GLshort front_count = 0, back_count = 0;
+
+  for(i = 0; i <= prim->numverts; i++){
+    v1 = i;
+    if(v1 == prim->numverts){
+      if(prim->numverts < 3) break;
+      v1 = 0;
+      v2 = prim->numverts - 1;
+      cur = prev0;
+    }
+    else if(flag){
+      cur = gl2psCheckPoint(prim->verts[v1].xyz, plane);
+      if(i == 0){
+        prev0 = cur;
+      }
+    } 
+    if(((prev == -1) || (prev == cur) || (prev == 0) || (cur == 0)) &&
+       (i < prim->numverts)){
+      if(cur == GL2PS_POINT_INFRONT){
+        front_count++;
+        front_list = (GL2PSvertex*)gl2psRealloc(front_list,
+                                                sizeof(GL2PSvertex)*front_count);
+        front_list[front_count-1] = prim->verts[v1];
+      }
+      else if(cur == GL2PS_POINT_BACK){
+        back_count++;
+        back_list = (GL2PSvertex*)gl2psRealloc(back_list,
+                                               sizeof(GL2PSvertex)*back_count);
+        back_list[back_count-1] = prim->verts[v1];
+      }
+      else{
+        front_count++;
+        front_list = (GL2PSvertex*)gl2psRealloc(front_list,
+                                                sizeof(GL2PSvertex)*front_count);
+        front_list[front_count-1] = prim->verts[v1];
+        back_count++;
+        back_list = (GL2PSvertex*)gl2psRealloc(back_list,
+                                               sizeof(GL2PSvertex)*back_count);
+        back_list[back_count-1] = prim->verts[v1];
+      }
+      flag = 1;
+    }
+    else if((prev != cur) && (cur != 0) && (prev != 0)){
+      if(v1 != 0){
+        v2 = v1-1;
+        i--;
+      }
+      front_count++;
+      front_list = (GL2PSvertex*)gl2psRealloc(front_list,
+                                              sizeof(GL2PSvertex)*front_count);
+      gl2psCutEdge(&prim->verts[v2], &prim->verts[v1],
+                   plane, &front_list[front_count-1]);
+      back_count++;
+      back_list = (GL2PSvertex*)gl2psRealloc(back_list,
+                                             sizeof(GL2PSvertex)*back_count);
+      back_list[back_count-1] = front_list[front_count-1];
+      flag = 0;
+    }
+    prev = cur;
+  }
+  *front = gl2psCreateSplitPrimitive2D(prim, front_count, front_list);
+  *back = gl2psCreateSplitPrimitive2D(prim, back_count, back_list);
+  gl2psFree(front_list);
+  gl2psFree(back_list);
+}
+
+static GLint gl2psAddInBspImageTree(GL2PSprimitive *prim, GL2PSbsptree2d **tree)
+{
+  GLint ret = 0;
+  GL2PSprimitive *frontprim = NULL, *backprim = NULL;
+  
+  /* FIXME: until we consider the actual extent of text strings and
+     pixmaps, never cull them. Otherwise the whole string/pixmap gets
+     culled as soon as the reference point is hidden */
+  if(prim->type == GL2PS_PIXMAP || 
+     prim->type == GL2PS_TEXT || 
+     prim->type == GL2PS_SPECIAL){
+    return 1;
+  }
+
+  if(*tree == NULL){
+    if((prim->type != GL2PS_IMAGEMAP) && (GL_FALSE == gl2ps->zerosurfacearea)){
+      gl2psAddPlanesInBspTreeImage(gl2ps->primitivetoadd, tree);
+    }
+    return 1;
+  }
+  else{
+    switch(gl2psCheckPrimitive(prim, (*tree)->plane)){
+    case GL2PS_IN_BACK_OF: return gl2psAddInBspImageTree(prim, &(*tree)->back);
+    case GL2PS_IN_FRONT_OF: 
+      if((*tree)->front != NULL) return gl2psAddInBspImageTree(prim, &(*tree)->front);
+      else                       return 0;
+    case GL2PS_SPANNING:
+      gl2psSplitPrimitive2D(prim, (*tree)->plane, &frontprim, &backprim);
+      ret = gl2psAddInBspImageTree(backprim, &(*tree)->back);
+      if((*tree)->front != NULL){
+        if(gl2psAddInBspImageTree(frontprim, &(*tree)->front)){
+          ret = 1;
+        }
+      }
+      gl2psFree(frontprim->verts);
+      gl2psFree(frontprim);
+      gl2psFree(backprim->verts);
+      gl2psFree(backprim);
+      return ret;
+    case GL2PS_COINCIDENT:
+      if((*tree)->back != NULL){
+        gl2ps->zerosurfacearea = GL_TRUE;
+        ret = gl2psAddInBspImageTree(prim, &(*tree)->back);
+        gl2ps->zerosurfacearea = GL_FALSE;
+        if(ret) return ret;
+      }
+      if((*tree)->front != NULL){
+        gl2ps->zerosurfacearea = GL_TRUE;
+        ret = gl2psAddInBspImageTree(prim, &(*tree)->front);
+        gl2ps->zerosurfacearea = GL_FALSE;
+        if(ret) return ret;
+      }
+      if(prim->type == GL2PS_LINE) return 1;
+      else                         return 0;
+    }
+  }
+  return 0;
+}
+
+static void gl2psAddInImageTree(void *data)
+{
+  GL2PSprimitive *prim = *(GL2PSprimitive **)data;
+  gl2ps->primitivetoadd = prim;
+  if(prim->type == GL2PS_IMAGEMAP && prim->data.image->format == GL2PS_IMAGEMAP_VISIBLE){
+    prim->culled = 1;
+  }
+  else if(!gl2psAddInBspImageTree(prim, &gl2ps->imagetree)){
+    prim->culled = 1;
+  }
+  else if(prim->type == GL2PS_IMAGEMAP){
+    prim->data.image->format = GL2PS_IMAGEMAP_VISIBLE;
+  }
+}
+
+/* Boundary construction */
+
+static void gl2psAddBoundaryInList(GL2PSprimitive *prim, GL2PSlist *list)
+{
+  GL2PSprimitive *b;
+  GLshort i;
+  GL2PSxyz c;
+
+  c[0] = c[1] = c[2] = 0.0F;
+  for(i = 0; i < prim->numverts; i++){
+    c[0] += prim->verts[i].xyz[0];
+    c[1] += prim->verts[i].xyz[1];
+  }
+  c[0] /= prim->numverts;
+  c[1] /= prim->numverts;
+
+  for(i = 0; i < prim->numverts; i++){
+    if(prim->boundary & (GLint)pow(2., i)){
+      b = (GL2PSprimitive*)gl2psMalloc(sizeof(GL2PSprimitive));
+      b->type = GL2PS_LINE;
+      b->offset = prim->offset;
+      b->pattern = prim->pattern;
+      b->factor = prim->factor;
+      b->culled = prim->culled;
+      b->width = prim->width;
+      b->boundary = 0;
+      b->numverts = 2;
+      b->verts = (GL2PSvertex*)gl2psMalloc(2 * sizeof(GL2PSvertex));
+
+#if 0 /* FIXME: need to work on boundary offset... */
+      v[0] = c[0] - prim->verts[i].xyz[0];
+      v[1] = c[1] - prim->verts[i].xyz[1];
+      v[2] = 0.0F;
+      norm = gl2psNorm(v);
+      v[0] /= norm;
+      v[1] /= norm;
+      b->verts[0].xyz[0] = prim->verts[i].xyz[0] +0.1*v[0];
+      b->verts[0].xyz[1] = prim->verts[i].xyz[1] +0.1*v[1];
+      b->verts[0].xyz[2] = prim->verts[i].xyz[2];
+      v[0] = c[0] - prim->verts[gl2psGetIndex(i, prim->numverts)].xyz[0];
+      v[1] = c[1] - prim->verts[gl2psGetIndex(i, prim->numverts)].xyz[1];
+      norm = gl2psNorm(v);
+      v[0] /= norm;
+      v[1] /= norm;
+      b->verts[1].xyz[0] = prim->verts[gl2psGetIndex(i, prim->numverts)].xyz[0] +0.1*v[0];
+      b->verts[1].xyz[1] = prim->verts[gl2psGetIndex(i, prim->numverts)].xyz[1] +0.1*v[1];
+      b->verts[1].xyz[2] = prim->verts[gl2psGetIndex(i, prim->numverts)].xyz[2];
+#else
+      b->verts[0].xyz[0] = prim->verts[i].xyz[0];
+      b->verts[0].xyz[1] = prim->verts[i].xyz[1];
+      b->verts[0].xyz[2] = prim->verts[i].xyz[2];
+      b->verts[1].xyz[0] = prim->verts[gl2psGetIndex(i, prim->numverts)].xyz[0];
+      b->verts[1].xyz[1] = prim->verts[gl2psGetIndex(i, prim->numverts)].xyz[1];
+      b->verts[1].xyz[2] = prim->verts[gl2psGetIndex(i, prim->numverts)].xyz[2];
+#endif
+
+      b->verts[0].rgba[0] = 0.0F;
+      b->verts[0].rgba[1] = 0.0F;
+      b->verts[0].rgba[2] = 0.0F;
+      b->verts[0].rgba[3] = 0.0F;
+      b->verts[1].rgba[0] = 0.0F;
+      b->verts[1].rgba[1] = 0.0F;
+      b->verts[1].rgba[2] = 0.0F;
+      b->verts[1].rgba[3] = 0.0F;
+      gl2psListAdd(list, &b);
+    }
+  }
+
+}
+
+static void gl2psBuildPolygonBoundary(GL2PSbsptree *tree)
+{
+  GLint i;
+  GL2PSprimitive *prim;
+
+  if(!tree) return;
+  gl2psBuildPolygonBoundary(tree->back);
+  for(i = 0; i < gl2psListNbr(tree->primitives); i++){
+    prim = *(GL2PSprimitive**)gl2psListPointer(tree->primitives, i);
+    if(prim->boundary) gl2psAddBoundaryInList(prim, tree->primitives);
+  }
+  gl2psBuildPolygonBoundary(tree->front);
+}
+
+/********************************************************************* 
+ *
+ * Feedback buffer parser
+ *
+ *********************************************************************/
+
+static void gl2psAddPolyPrimitive(GLshort type, GLshort numverts, 
+                                  GL2PSvertex *verts, GLint offset, 
+                                  GLushort pattern, GLint factor,
+                                  GLfloat width, char boundary)
+{
+  GL2PSprimitive *prim;
+
+  prim = (GL2PSprimitive*)gl2psMalloc(sizeof(GL2PSprimitive));
+  prim->type = type;
+  prim->numverts = numverts;
+  prim->verts = (GL2PSvertex*)gl2psMalloc(numverts * sizeof(GL2PSvertex));
+  memcpy(prim->verts, verts, numverts * sizeof(GL2PSvertex));
+  prim->boundary = boundary;
+  prim->offset = offset;
+  prim->pattern = pattern;
+  prim->factor = factor;
+  prim->width = width;
+  prim->culled = 0;
+
+  /* FIXME: here we should have an option to split stretched
+     tris/quads to enhance SIMPLE_SORT */
+
+  gl2psListAdd(gl2ps->primitives, &prim);
+}
+
+static GLint gl2psGetVertex(GL2PSvertex *v, GLfloat *p)
+{
+  GLint i;
+
+  v->xyz[0] = p[0];
+  v->xyz[1] = p[1];
+  v->xyz[2] = p[2];
+
+  if(gl2ps->colormode == GL_COLOR_INDEX && gl2ps->colorsize > 0){
+    i = (GLint)(p[3] + 0.5);
+    v->rgba[0] = gl2ps->colormap[i][0];
+    v->rgba[1] = gl2ps->colormap[i][1];
+    v->rgba[2] = gl2ps->colormap[i][2];
+    v->rgba[3] = gl2ps->colormap[i][3];
+    return 4;
+  }
+  else{
+    v->rgba[0] = p[3];
+    v->rgba[1] = p[4];
+    v->rgba[2] = p[5];
+    v->rgba[3] = p[6];
+    return 7;
+  }
+}
+
+static void gl2psParseFeedbackBuffer(GLint used)
+{
+  char flag;
+  GLushort pattern = 0;
+  GLboolean boundary;
+  GLint i, sizeoffloat, count, v, vtot, offset = 0, factor = 0, auxindex = 0;
+  GLfloat lwidth = 1.0F, psize = 1.0F;
+  GLfloat *current;
+  GL2PSvertex vertices[3];
+  GL2PSprimitive *prim;
+  GL2PSimagemap *node;
+
+  current = gl2ps->feedback;
+  boundary = gl2ps->boundary = GL_FALSE;
+
+  while(used > 0){
+
+    if(GL_TRUE == boundary) gl2ps->boundary = GL_TRUE;
+    
+    switch((GLint)*current){
+    case GL_POINT_TOKEN :
+      current ++;
+      used --;
+      i = gl2psGetVertex(&vertices[0], current);
+      current += i;
+      used    -= i;
+      gl2psAddPolyPrimitive(GL2PS_POINT, 1, vertices, 0, 
+                            pattern, factor, psize, 0);
+      break;
+    case GL_LINE_TOKEN :
+    case GL_LINE_RESET_TOKEN :
+      current ++;
+      used --;
+      i = gl2psGetVertex(&vertices[0], current);
+      current += i;
+      used    -= i;
+      i = gl2psGetVertex(&vertices[1], current);
+      current += i;
+      used    -= i;
+      gl2psAddPolyPrimitive(GL2PS_LINE, 2, vertices, 0, 
+                            pattern, factor, lwidth, 0);
+      break;
+    case GL_POLYGON_TOKEN :
+      count = (GLint)current[1];
+      current += 2;
+      used -= 2;
+      v = vtot = 0;
+      while(count > 0 && used > 0){
+        i = gl2psGetVertex(&vertices[v], current);
+        gl2psAdaptVertexForBlending(&vertices[v]);
+        current += i;
+        used    -= i;
+        count --;
+        vtot++;
+        if(v == 2){
+          if(GL_TRUE == boundary){
+            if(!count && vtot == 2) flag = 1|2|4;
+            else if(!count) flag = 2|4;
+            else if(vtot == 2) flag = 1|2;
+            else flag = 2;
+          }
+          else
+            flag = 0;
+          gl2psAddPolyPrimitive(GL2PS_TRIANGLE, 3, vertices, offset,
+                                pattern, factor, 1, flag);
+          vertices[1] = vertices[2];
+        }
+        else
+          v ++;
+      }
+      break;      
+    case GL_BITMAP_TOKEN :
+    case GL_DRAW_PIXEL_TOKEN :
+    case GL_COPY_PIXEL_TOKEN :
+      current ++;
+      used --;
+      i = gl2psGetVertex(&vertices[0], current);
+      current += i;
+      used    -= i;
+      break;      
+    case GL_PASS_THROUGH_TOKEN :
+      switch((GLint)current[1]){
+      case GL2PS_BEGIN_OFFSET_TOKEN : offset = 1; break;
+      case GL2PS_END_OFFSET_TOKEN : offset = 0; break;
+      case GL2PS_BEGIN_BOUNDARY_TOKEN : boundary = GL_TRUE; break;
+      case GL2PS_END_BOUNDARY_TOKEN : boundary = GL_FALSE; break;
+      case GL2PS_END_STIPPLE_TOKEN : pattern = factor = 0; break;
+      case GL2PS_BEGIN_BLEND_TOKEN : gl2ps->blending = GL_TRUE; break;
+      case GL2PS_END_BLEND_TOKEN : gl2ps->blending = GL_FALSE; break;
+      case GL2PS_BEGIN_STIPPLE_TOKEN : 
+        current += 2;
+        used -= 2; 
+        pattern = (GLushort)current[1]; 
+        current += 2;
+        used -= 2; 
+        factor = (GLint)current[1]; 
+        break;
+      case GL2PS_SRC_BLEND_TOKEN : 
+        current += 2; 
+        used -= 2; 
+        gl2ps->blendfunc[0] = (GLint)current[1];
+        break;
+      case GL2PS_DST_BLEND_TOKEN : 
+        current += 2; 
+        used -= 2; 
+        gl2ps->blendfunc[1] = (GLint)current[1];
+        break;
+      case GL2PS_POINT_SIZE_TOKEN : 
+        current += 2; 
+        used -= 2; 
+        psize = current[1];
+        break;
+      case GL2PS_LINE_WIDTH_TOKEN : 
+        current += 2; 
+        used -= 2; 
+        lwidth = current[1];
+        break;
+      case GL2PS_IMAGEMAP_TOKEN :
+        prim = (GL2PSprimitive *)gl2psMalloc(sizeof(GL2PSprimitive));
+        prim->type = GL2PS_IMAGEMAP;
+        prim->boundary = 0;
+        prim->numverts = 4;
+        prim->verts = (GL2PSvertex *)gl2psMalloc(4 * sizeof(GL2PSvertex));
+        prim->culled = 0;
+        prim->offset = 0;
+        prim->pattern = 0;
+        prim->factor = 0;
+        prim->width = 1;
+        
+        node = (GL2PSimagemap*)gl2psMalloc(sizeof(GL2PSimagemap));
+        node->image = (GL2PSimage*)gl2psMalloc(sizeof(GL2PSimage));
+        node->image->type = 0;
+        node->image->format = 0;
+        node->next = NULL;
+        
+        if(gl2ps->imagemap_head == NULL)
+          gl2ps->imagemap_head = node;
+        else
+          gl2ps->imagemap_tail->next = node;
+        gl2ps->imagemap_tail = node;
+        prim->data.image = node->image;
+        
+        current += 2; used -= 2;
+        i = gl2psGetVertex(&prim->verts[0], &current[1]);
+        current += i; used -= i;
+        
+        node->image->width = (GLint)current[2];
+        current += 2; used -= 2;
+        node->image->height = (GLint)current[2];
+        prim->verts[0].xyz[0] = prim->verts[0].xyz[0] - (int)(node->image->width / 2) + 0.5;
+        prim->verts[0].xyz[1] = prim->verts[0].xyz[1] - (int)(node->image->height / 2) + 0.5;
+        for(i = 1; i < 4; i++){
+          for(v = 0; v < 3; v++){
+            prim->verts[i].xyz[v] = prim->verts[0].xyz[v];
+            prim->verts[i].rgba[v] = prim->verts[0].rgba[v];
+          }
+          prim->verts[i].rgba[v] = prim->verts[0].rgba[v];
+        }
+        prim->verts[1].xyz[0] = prim->verts[1].xyz[0] + node->image->width;
+        prim->verts[2].xyz[0] = prim->verts[1].xyz[0];
+        prim->verts[2].xyz[1] = prim->verts[2].xyz[1] + node->image->height;
+        prim->verts[3].xyz[1] = prim->verts[2].xyz[1];
+
+        sizeoffloat = sizeof(GLfloat);
+        v = 2 * sizeoffloat;
+        vtot = node->image->height + node->image->height * 
+          ((node->image->width - 1) / 8);
+        node->image->pixels = (GLfloat*)gl2psMalloc(v + vtot);
+        node->image->pixels[0] = prim->verts[0].xyz[0];
+        node->image->pixels[1] = prim->verts[0].xyz[1];
+        
+        for(i = 0; i < vtot; i += sizeoffloat){
+          current += 2; used -= 2;
+          if((vtot - i) >= 4)
+            memcpy(&(((char*)(node->image->pixels))[i + v]), &(current[2]), sizeoffloat);
+          else
+            memcpy(&(((char*)(node->image->pixels))[i + v]), &(current[2]), vtot - i);
+        }
+        current++; used--;
+        gl2psListAdd(gl2ps->primitives, &prim);
+        break;
+      case GL2PS_DRAW_PIXELS_TOKEN :
+      case GL2PS_TEXT_TOKEN :
+        if(auxindex < gl2psListNbr(gl2ps->auxprimitives))
+          gl2psListAdd(gl2ps->primitives, 
+                       gl2psListPointer(gl2ps->auxprimitives, auxindex++));
+        else
+          gl2psMsg(GL2PS_ERROR, "Wrong number of auxiliary tokens in buffer");
+        break;
+      }
+      current += 2; 
+      used -= 2; 
+      break;      
+    default :
+      gl2psMsg(GL2PS_WARNING, "Unknown token in buffer");
+      current ++;
+      used --;
+      break;
+    }
+  }
+
+  gl2psListReset(gl2ps->auxprimitives);
+}
+
+/********************************************************************* 
+ *
+ * PostScript routines
+ *
+ *********************************************************************/
+
+static void gl2psWriteByte(unsigned char byte)
+{
+  unsigned char h = byte / 16;
+  unsigned char l = byte % 16;
+  gl2psPrintf("%x%x", h, l);
+}
+
+static void gl2psPrintPostScriptPixmap(GLfloat x, GLfloat y, GL2PSimage *im)
+{
+  GLuint nbhex, nbyte, nrgb, nbits;
+  GLuint row, col, ibyte, icase;
+  GLfloat dr, dg, db, fgrey;
+  unsigned char red = 0, green = 0, blue = 0, b, grey;
+  GLuint width = (GLuint)im->width;
+  GLuint height = (GLuint)im->height;
+
+  /* FIXME: should we define an option for these? Or just keep the
+     8-bit per component case? */
+  int greyscale = 0; /* set to 1 to output greyscale image */
+  int nbit = 8; /* number of bits per color compoment (2, 4 or 8) */
+
+  if((width <= 0) || (height <= 0)) return;
+
+  gl2psPrintf("gsave\n");
+  gl2psPrintf("%.2f %.2f translate\n", x, y); 
+  gl2psPrintf("%d %d scale\n", width, height); 
+
+  if(greyscale){ /* greyscale */
+    gl2psPrintf("/picstr %d string def\n", width); 
+    gl2psPrintf("%d %d %d\n", width, height, 8); 
+    gl2psPrintf("[ %d 0 0 -%d 0 %d ]\n", width, height, height); 
+    gl2psPrintf("{ currentfile picstr readhexstring pop }\n");
+    gl2psPrintf("image\n");
+    for(row = 0; row < height; row++){
+      for(col = 0; col < width; col++){ 
+        gl2psGetRGB(im, col, row, &dr, &dg, &db);
+        fgrey = (0.30 * dr + 0.59 * dg + 0.11 * db);
+        grey = (unsigned char)(255. * fgrey);
+        gl2psWriteByte(grey);
+      }
+      gl2psPrintf("\n");
+    }
+    nbhex = width * height * 2; 
+    gl2psPrintf("%%%% nbhex digit          :%d\n", nbhex); 
+  }
+  else if(nbit == 2){ /* color, 2 bits for r and g and b; rgbs following each other */
+    nrgb = width  * 3;
+    nbits = nrgb * nbit;
+    nbyte = nbits / 8;
+    if((nbyte * 8) != nbits) nbyte++;
+    gl2psPrintf("/rgbstr %d string def\n", nbyte);
+    gl2psPrintf("%d %d %d\n", width, height, nbit);
+    gl2psPrintf("[ %d 0 0 -%d 0 %d ]\n", width, height, height);
+    gl2psPrintf("{ currentfile rgbstr readhexstring pop }\n");
+    gl2psPrintf("false 3\n");
+    gl2psPrintf("colorimage\n");
+    for(row = 0; row < height; row++){
+      icase = 1;
+      col = 0;
+      b = 0;
+      for(ibyte = 0; ibyte < nbyte; ibyte++){
+        if(icase == 1) {
+          if(col < width) {
+            gl2psGetRGB(im, col, row, &dr, &dg, &db);
+          } 
+          else {
+            dr = dg = db = 0;
+          }
+          col++;
+          red = (unsigned char)(3. * dr);
+          green = (unsigned char)(3. * dg);
+          blue = (unsigned char)(3. * db);
+          b = red;
+          b = (b<<2) + green;
+          b = (b<<2) + blue;
+          if(col < width) {
+            gl2psGetRGB(im, col, row, &dr, &dg, &db);
+          } 
+          else {
+            dr = dg = db = 0;
+          }
+          col++;
+          red = (unsigned char)(3. * dr);
+          green = (unsigned char)(3. * dg);
+          blue = (unsigned char)(3. * db);
+          b = (b<<2) + red;
+          gl2psWriteByte(b);
+          b = 0;
+          icase++;
+        } 
+        else if(icase == 2) {
+          b = green;
+          b = (b<<2) + blue;
+          if(col < width) {
+            gl2psGetRGB(im, col, row, &dr, &dg, &db);
+          }
+          else {
+            dr = dg = db = 0;
+          }
+          col++;
+          red = (unsigned char)(3. * dr);
+          green = (unsigned char)(3. * dg);
+          blue = (unsigned char)(3. * db);
+          b = (b<<2) + red;
+          b = (b<<2) + green;
+          gl2psWriteByte(b);
+          b = 0;
+          icase++;
+        } 
+        else if(icase == 3) {
+          b = blue;
+          if(col < width) {
+            gl2psGetRGB(im, col, row, &dr, &dg, &db);
+          }
+          else {
+            dr = dg = db = 0;
+          }
+          col++;
+          red = (unsigned char)(3. * dr);
+          green = (unsigned char)(3. * dg);
+          blue = (unsigned char)(3. * db);
+          b = (b<<2) + red;
+          b = (b<<2) + green;
+          b = (b<<2) + blue;
+          gl2psWriteByte(b);
+          b = 0;
+          icase = 1;
+        }
+      }
+      gl2psPrintf("\n");
+    }
+  }
+  else if(nbit == 4){ /* color, 4 bits for r and g and b; rgbs following each other */
+    nrgb = width  * 3;
+    nbits = nrgb * nbit;
+    nbyte = nbits / 8;
+    if((nbyte * 8) != nbits) nbyte++; 
+    gl2psPrintf("/rgbstr %d string def\n", nbyte);
+    gl2psPrintf("%d %d %d\n", width, height, nbit);
+    gl2psPrintf("[ %d 0 0 -%d 0 %d ]\n", width, height, height);
+    gl2psPrintf("{ currentfile rgbstr readhexstring pop }\n");
+    gl2psPrintf("false 3\n");
+    gl2psPrintf("colorimage\n");
+    for(row = 0; row < height; row++){
+      col = 0;
+      icase = 1;
+      for(ibyte = 0; ibyte < nbyte; ibyte++){
+        if(icase == 1) {
+          if(col < width) {
+            gl2psGetRGB(im, col, row, &dr, &dg, &db);
+          } 
+          else {
+            dr = dg = db = 0;
+          }
+          col++;
+          red = (unsigned char)(15. * dr);
+          green = (unsigned char)(15. * dg);
+          gl2psPrintf("%x%x", red, green);
+          icase++;
+        } 
+        else if(icase == 2) {
+          blue = (unsigned char)(15. * db);
+          if(col < width) {
+            gl2psGetRGB(im, col, row, &dr, &dg, &db);
+          } 
+          else {
+            dr = dg = db = 0;
+          }
+          col++;
+          red = (unsigned char)(15. * dr);
+          gl2psPrintf("%x%x", blue, red);
+          icase++;
+        }
+        else if(icase == 3) {
+          green = (unsigned char)(15. * dg);
+          blue = (unsigned char)(15. * db);
+          gl2psPrintf("%x%x", green, blue);
+          icase = 1;
+        }
+      }
+      gl2psPrintf("\n");
+    }
+  }
+  else{ /* 8 bit for r and g and b */
+    nbyte = width * 3;
+    gl2psPrintf("/rgbstr %d string def\n", nbyte);
+    gl2psPrintf("%d %d %d\n", width, height, 8);
+    gl2psPrintf("[ %d 0 0 -%d 0 %d ]\n", width, height, height); 
+    gl2psPrintf("{ currentfile rgbstr readhexstring pop }\n");
+    gl2psPrintf("false 3\n");
+    gl2psPrintf("colorimage\n");
+    for(row = 0; row < height; row++){
+      for(col = 0; col < width; col++){
+        gl2psGetRGB(im, col, row, &dr, &dg, &db);
+        red = (unsigned char)(255. * dr);
+        gl2psWriteByte(red);
+        green = (unsigned char)(255. * dg);
+        gl2psWriteByte(green);
+        blue = (unsigned char)(255. * db);
+        gl2psWriteByte(blue);
+      }
+      gl2psPrintf("\n");
+    }
+  }
+  
+  gl2psPrintf("grestore\n");
+}
+
+static void gl2psPrintPostScriptImagemap(GLfloat x, GLfloat y,
+                                         GLsizei width, GLsizei height,
+                                         const unsigned char *imagemap){
+  int i, size;
+  
+  if((width <= 0) || (height <= 0)) return;
+  
+  size = height + height * (width - 1) / 8;
+  
+  gl2psPrintf("gsave\n");
+  gl2psPrintf("%.2f %.2f translate\n", x, y);
+  gl2psPrintf("%d %d scale\n%d %d\ntrue\n", width, height,width, height); 
+  gl2psPrintf("[ %d 0 0 -%d 0 %d ] {<", width, height);
+  for(i = 0; i < size; i++){
+    gl2psWriteByte(*imagemap);
+    imagemap++;
+  }
+  gl2psPrintf(">} imagemask\ngrestore\n");
+}
+
+static void gl2psPrintPostScriptHeader(void)
+{
+  time_t now;
+
+  /* Since compression is not part of the PostScript standard,
+     compressed PostScript files are just gzipped PostScript files
+     ("ps.gz" or "eps.gz") */
+  gl2psPrintGzipHeader();
+
+  time(&now);
+
+  if(gl2ps->format == GL2PS_PS){
+    gl2psPrintf("%%!PS-Adobe-3.0\n");
+  }
+  else{
+    gl2psPrintf("%%!PS-Adobe-3.0 EPSF-3.0\n");
+  }
+
+  gl2psPrintf("%%%%Title: %s\n"
+              "%%%%Creator: GL2PS %d.%d.%d%s, %s\n"
+              "%%%%For: %s\n"
+              "%%%%CreationDate: %s"
+              "%%%%LanguageLevel: 3\n"
+              "%%%%DocumentData: Clean7Bit\n"
+              "%%%%Pages: 1\n",
+              gl2ps->title, GL2PS_MAJOR_VERSION, GL2PS_MINOR_VERSION, 
+              GL2PS_PATCH_VERSION, GL2PS_EXTRA_VERSION, GL2PS_COPYRIGHT,
+              gl2ps->producer, ctime(&now));
+
+  if(gl2ps->format == GL2PS_PS){
+    gl2psPrintf("%%%%Orientation: %s\n"
+                "%%%%DocumentMedia: Default %d %d 0 () ()\n",
+                (gl2ps->options & GL2PS_LANDSCAPE) ? "Landscape" : "Portrait",
+                (gl2ps->options & GL2PS_LANDSCAPE) ? (int)gl2ps->viewport[3] :
+                (int)gl2ps->viewport[2], 
+                (gl2ps->options & GL2PS_LANDSCAPE) ? (int)gl2ps->viewport[2] : 
+                (int)gl2ps->viewport[3]);
+  }
+
+  gl2psPrintf("%%%%BoundingBox: %d %d %d %d\n"
+              "%%%%EndComments\n",
+              (gl2ps->options & GL2PS_LANDSCAPE) ? (int)gl2ps->viewport[1] : 
+              (int)gl2ps->viewport[0],
+              (gl2ps->options & GL2PS_LANDSCAPE) ? (int)gl2ps->viewport[0] :
+              (int)gl2ps->viewport[1],
+              (gl2ps->options & GL2PS_LANDSCAPE) ? (int)gl2ps->viewport[3] : 
+              (int)gl2ps->viewport[2],
+              (gl2ps->options & GL2PS_LANDSCAPE) ? (int)gl2ps->viewport[2] :
+              (int)gl2ps->viewport[3]);
+
+  /* RGB color: r g b C (replace C by G in output to change from rgb to gray)
+     Grayscale: r g b G
+     Font choose: size fontname FC
+     Text string: (string) x y size fontname S??
+     Rotated text string: (string) angle x y size fontname S??R
+     Point primitive: x y size P
+     Line width: width W
+     Line start: x y LS
+     Line joining last point: x y L
+     Line end: x y LE
+     Flat-shaded triangle: x3 y3 x2 y2 x1 y1 T
+     Smooth-shaded triangle: x3 y3 r3 g3 b3 x2 y2 r2 g2 b2 x1 y1 r1 g1 b1 ST */
+
+  gl2psPrintf("%%%%BeginProlog\n"
+              "/gl2psdict 64 dict def gl2psdict begin\n"
+              "0 setlinecap 0 setlinejoin\n"
+              "/tryPS3shading %s def %% set to false to force subdivision\n"
+              "/rThreshold %g def %% red component subdivision threshold\n"
+              "/gThreshold %g def %% green component subdivision threshold\n"
+              "/bThreshold %g def %% blue component subdivision threshold\n",
+              (gl2ps->options & GL2PS_NO_PS3_SHADING) ? "false" : "true",
+              gl2ps->threshold[0], gl2ps->threshold[1], gl2ps->threshold[2]);
+
+  gl2psPrintf("/BD { bind def } bind def\n"
+              "/C  { setrgbcolor } BD\n"
+              "/G  { 0.082 mul exch 0.6094 mul add exch 0.3086 mul add neg 1.0 add setgray } BD\n"
+              "/W  { setlinewidth } BD\n");
+
+  gl2psPrintf("/FC { findfont exch /SH exch def SH scalefont setfont } BD\n"
+              "/SW { dup stringwidth pop } BD\n"
+              "/S  { FC moveto show } BD\n"
+              "/SBC{ FC moveto SW -2 div 0 rmoveto show } BD\n"
+              "/SBR{ FC moveto SW neg 0 rmoveto show } BD\n"
+              "/SCL{ FC moveto 0 SH -2 div rmoveto show } BD\n"
+              "/SCC{ FC moveto SW -2 div SH -2 div rmoveto show } BD\n"
+              "/SCR{ FC moveto SW neg SH -2 div rmoveto show } BD\n"
+              "/STL{ FC moveto 0 SH neg rmoveto show } BD\n"
+              "/STC{ FC moveto SW -2 div SH neg rmoveto show } BD\n"
+              "/STR{ FC moveto SW neg SH neg rmoveto show } BD\n");
+
+  /* rotated text routines: same nameanem with R appended */
+
+  gl2psPrintf("/FCT { FC translate 0 0 } BD\n"
+              "/SR  { gsave FCT moveto rotate show grestore } BD\n"  
+              "/SBCR{ gsave FCT moveto rotate SW -2 div 0 rmoveto show grestore } BD\n"
+              "/SBRR{ gsave FCT moveto rotate SW neg 0 rmoveto show grestore } BD\n"
+              "/SCLR{ gsave FCT moveto rotate 0 SH -2 div rmoveto show grestore} BD\n");
+  gl2psPrintf("/SCCR{ gsave FCT moveto rotate SW -2 div SH -2 div rmoveto show grestore} BD\n"
+              "/SCRR{ gsave FCT moveto rotate SW neg SH -2 div rmoveto show grestore} BD\n"
+              "/STLR{ gsave FCT moveto rotate 0 SH neg rmoveto show grestore } BD\n"
+              "/STCR{ gsave FCT moveto rotate SW -2 div SH neg rmoveto show grestore } BD\n"
+              "/STRR{ gsave FCT moveto rotate SW neg SH neg rmoveto show grestore } BD\n");
+
+  gl2psPrintf("/P  { newpath 0.0 360.0 arc closepath fill } BD\n"
+              "/LS { newpath moveto } BD\n"
+              "/L  { lineto } BD\n"
+              "/LE { lineto stroke } BD\n"
+              "/T  { newpath moveto lineto lineto closepath fill } BD\n");
+  
+  /* Smooth-shaded triangle with PostScript level 3 shfill operator:
+        x3 y3 r3 g3 b3 x2 y2 r2 g2 b2 x1 y1 r1 g1 b1 STshfill */
+
+  gl2psPrintf("/STshfill {\n"
+              "      /b1 exch def /g1 exch def /r1 exch def /y1 exch def /x1 exch def\n"
+              "      /b2 exch def /g2 exch def /r2 exch def /y2 exch def /x2 exch def\n"
+              "      /b3 exch def /g3 exch def /r3 exch def /y3 exch def /x3 exch def\n"
+              "      gsave << /ShadingType 4 /ColorSpace [/DeviceRGB]\n"
+              "      /DataSource [ 0 x1 y1 r1 g1 b1 0 x2 y2 r2 g2 b2 0 x3 y3 r3 g3 b3 ] >>\n"
+              "      shfill grestore } BD\n");
+
+  /* Flat-shaded triangle with middle color:
+        x3 y3 r3 g3 b3 x2 y2 r2 g2 b2 x1 y1 r1 g1 b1 Tm */
+
+  gl2psPrintf(/* stack : x3 y3 r3 g3 b3 x2 y2 r2 g2 b2 x1 y1 r1 g1 b1 */
+              "/Tm { 3 -1 roll 8 -1 roll 13 -1 roll add add 3 div\n" /* r = (r1+r2+r3)/3 */
+              /* stack : x3 y3 g3 b3 x2 y2 g2 b2 x1 y1 g1 b1 r */
+              "      3 -1 roll 7 -1 roll 11 -1 roll add add 3 div\n" /* g = (g1+g2+g3)/3 */
+              /* stack : x3 y3 b3 x2 y2 b2 x1 y1 b1 r g b */
+              "      3 -1 roll 6 -1 roll 9 -1 roll add add 3 div" /* b = (b1+b2+b3)/3 */
+              /* stack : x3 y3 x2 y2 x1 y1 r g b */
+              " C T } BD\n");
+
+  /* Split triangle in four sub-triangles (at sides middle points) and call the
+     STnoshfill procedure on each, interpolating the colors in RGB space:
+        x3 y3 r3 g3 b3 x2 y2 r2 g2 b2 x1 y1 r1 g1 b1 STsplit
+     (in procedure comments key: (Vi) = xi yi ri gi bi) */
+
+  gl2psPrintf("/STsplit {\n"
+              "      4 index 15 index add 0.5 mul\n" /* x13 = (x1+x3)/2 */
+              "      4 index 15 index add 0.5 mul\n" /* y13 = (y1+y3)/2 */
+              "      4 index 15 index add 0.5 mul\n" /* r13 = (r1+r3)/2 */
+              "      4 index 15 index add 0.5 mul\n" /* g13 = (g1+g3)/2 */
+              "      4 index 15 index add 0.5 mul\n" /* b13 = (b1+b3)/2 */
+              "      5 copy 5 copy 25 15 roll\n");
+
+  /* at his point, stack = (V3) (V13) (V13) (V13) (V2) (V1) */
+
+  gl2psPrintf("      9 index 30 index add 0.5 mul\n" /* x23 = (x2+x3)/2 */
+              "      9 index 30 index add 0.5 mul\n" /* y23 = (y2+y3)/2 */
+              "      9 index 30 index add 0.5 mul\n" /* r23 = (r2+r3)/2 */
+              "      9 index 30 index add 0.5 mul\n" /* g23 = (g2+g3)/2 */
+              "      9 index 30 index add 0.5 mul\n" /* b23 = (b2+b3)/2 */
+              "      5 copy 5 copy 35 5 roll 25 5 roll 15 5 roll\n");
+
+  /* stack = (V3) (V13) (V23) (V13) (V23) (V13) (V23) (V2) (V1) */
+
+  gl2psPrintf("      4 index 10 index add 0.5 mul\n" /* x12 = (x1+x2)/2 */
+              "      4 index 10 index add 0.5 mul\n" /* y12 = (y1+y2)/2 */
+              "      4 index 10 index add 0.5 mul\n" /* r12 = (r1+r2)/2 */
+              "      4 index 10 index add 0.5 mul\n" /* g12 = (g1+g2)/2 */
+              "      4 index 10 index add 0.5 mul\n" /* b12 = (b1+b2)/2 */
+              "      5 copy 5 copy 40 5 roll 25 5 roll 15 5 roll 25 5 roll\n");
+  
+  /* stack = (V3) (V13) (V23) (V13) (V12) (V23) (V13) (V1) (V12) (V23) (V12) (V2) */
+
+  gl2psPrintf("      STnoshfill STnoshfill STnoshfill STnoshfill } BD\n");
+  
+  /* Gouraud shaded triangle using recursive subdivision until the difference
+     between corner colors does not exceed the thresholds:
+        x3 y3 r3 g3 b3 x2 y2 r2 g2 b2 x1 y1 r1 g1 b1 STnoshfill  */
+
+  gl2psPrintf("/STnoshfill {\n"
+              "      2 index 8 index sub abs rThreshold gt\n" /* |r1-r2|>rth */
+              "      { STsplit }\n"
+              "      { 1 index 7 index sub abs gThreshold gt\n" /* |g1-g2|>gth */
+              "        { STsplit }\n"
+              "        { dup 6 index sub abs bThreshold gt\n" /* |b1-b2|>bth */
+              "          { STsplit }\n"
+              "          { 2 index 13 index sub abs rThreshold gt\n" /* |r1-r3|>rht */
+              "            { STsplit }\n"
+              "            { 1 index 12 index sub abs gThreshold gt\n" /* |g1-g3|>gth */
+              "              { STsplit }\n"
+              "              { dup 11 index sub abs bThreshold gt\n" /* |b1-b3|>bth */
+              "                { STsplit }\n"
+              "                { 7 index 13 index sub abs rThreshold gt\n"); /* |r2-r3|>rht */
+  gl2psPrintf("                  { STsplit }\n"
+              "                  { 6 index 12 index sub abs gThreshold gt\n" /* |g2-g3|>gth */
+              "                    { STsplit }\n"
+              "                    { 5 index 11 index sub abs bThreshold gt\n" /* |b2-b3|>bth */
+              "                      { STsplit }\n"
+              "                      { Tm }\n" /* all colors sufficiently similar */
+              "                      ifelse }\n"
+              "                    ifelse }\n"
+              "                  ifelse }\n"
+              "                ifelse }\n"
+              "              ifelse }\n"
+              "            ifelse }\n"
+              "          ifelse }\n"
+              "        ifelse }\n"
+              "      ifelse } BD\n");
+  
+  gl2psPrintf("tryPS3shading\n"
+              "{ /shfill where\n"
+              "  { /ST { STshfill } BD }\n"
+              "  { /ST { STnoshfill } BD }\n"
+              "  ifelse }\n"
+              "{ /ST { STnoshfill } BD }\n"
+              "ifelse\n");
+
+  gl2psPrintf("end\n"
+              "%%%%EndProlog\n"
+              "%%%%BeginSetup\n"
+              "/DeviceRGB setcolorspace\n"
+              "gl2psdict begin\n"
+              "%%%%EndSetup\n"
+              "%%%%Page: 1 1\n"
+              "%%%%BeginPageSetup\n");
+  
+  if(gl2ps->options & GL2PS_LANDSCAPE){
+    gl2psPrintf("%d 0 translate 90 rotate\n",
+                (int)gl2ps->viewport[3]);
+  }
+
+  gl2psPrintf("%%%%EndPageSetup\n"
+              "mark\n"
+              "gsave\n"
+              "1.0 1.0 scale\n");
+          
+  if(gl2ps->options & GL2PS_DRAW_BACKGROUND){
+    gl2psPrintf("%g %g %g C\n"
+                "newpath %d %d moveto %d %d lineto %d %d lineto %d %d lineto\n"
+                "closepath fill\n",
+                gl2ps->bgcolor[0], gl2ps->bgcolor[1], gl2ps->bgcolor[2], 
+                (int)gl2ps->viewport[0], (int)gl2ps->viewport[1], (int)gl2ps->viewport[2], 
+                (int)gl2ps->viewport[1], (int)gl2ps->viewport[2], (int)gl2ps->viewport[3], 
+                (int)gl2ps->viewport[0], (int)gl2ps->viewport[3]);
+  }
+}
+
+static void gl2psPrintPostScriptColor(GL2PSrgba rgba)
+{
+  if(!gl2psSameColor(gl2ps->lastrgba, rgba)){
+    gl2psSetLastColor(rgba);
+    gl2psPrintf("%g %g %g C\n", rgba[0], rgba[1], rgba[2]);
+  }
+}
+
+static void gl2psResetPostScriptColor(void)
+{
+  gl2ps->lastrgba[0] = gl2ps->lastrgba[1] = gl2ps->lastrgba[2] = -1.;
+}
+
+static void gl2psEndPostScriptLine(void)
+{
+  int i;
+  if(gl2ps->lastvertex.rgba[0] >= 0.){
+    gl2psPrintf("%g %g LE\n", gl2ps->lastvertex.xyz[0], gl2ps->lastvertex.xyz[1]);
+    for(i = 0; i < 3; i++)
+      gl2ps->lastvertex.xyz[i] = -1.;
+    for(i = 0; i < 4; i++)
+      gl2ps->lastvertex.rgba[i] = -1.;
+  }
+}
+
+static void gl2psParseStipplePattern(GLushort pattern, GLint factor, 
+                                     int *nb, int array[10])
+{
+  int i, n;
+  int on[8] = {0, 0, 0, 0, 0, 0, 0, 0};
+  int off[8] = {0, 0, 0, 0, 0, 0, 0, 0};
+  char tmp[16];
+
+  /* extract the 16 bits from the OpenGL stipple pattern */
+  for(n = 15; n >= 0; n--){
+    tmp[n] = (char)(pattern & 0x01);
+    pattern >>= 1;
+  }
+  /* compute the on/off pixel sequence */
+  n = 0;
+  for(i = 0; i < 8; i++){
+    while(n < 16 && !tmp[n]){ off[i]++; n++; }
+    while(n < 16 && tmp[n]){ on[i]++; n++; }
+    if(n >= 15){ i++; break; }
+  }
+
+  /* store the on/off array from right to left, starting with off
+     pixels. The PostScript specification allows for at most 11
+     elements in the on/off array, so we limit ourselves to 5 on/off
+     couples (our longest possible array is thus [on4 off4 on3 off3
+     on2 off2 on1 off1 on0 off0]) */
+  *nb = 0;
+  for(n = i - 1; n >= 0; n--){
+    array[(*nb)++] = factor * on[n];
+    array[(*nb)++] = factor * off[n];
+    if(*nb == 10) break;
+  }
+}
+
+static int gl2psPrintPostScriptDash(GLushort pattern, GLint factor, const char *str)
+{
+  int len = 0, i, n, array[10];
+
+  if(pattern == gl2ps->lastpattern && factor == gl2ps->lastfactor)
+    return 0;
+  
+  gl2ps->lastpattern = pattern;
+  gl2ps->lastfactor = factor;
+  
+  if(!pattern || !factor){
+    /* solid line */
+    len += gl2psPrintf("[] 0 %s\n", str);
+  }
+  else{
+    gl2psParseStipplePattern(pattern, factor, &n, array);
+    len += gl2psPrintf("[");
+    for(i = 0; i < n; i++){
+      if(i) len += gl2psPrintf(" ");
+      len += gl2psPrintf("%d", array[i]);
+    }
+    len += gl2psPrintf("] 0 %s\n", str);
+  }
+  
+  return len;
+}
+
+static void gl2psPrintPostScriptPrimitive(void *data)
+{
+  int newline;
+  GL2PSprimitive *prim;
+
+  prim = *(GL2PSprimitive**)data;
+
+  if((gl2ps->options & GL2PS_OCCLUSION_CULL) && prim->culled) return;
+
+  /* Every effort is made to draw lines as connected segments (i.e.,
+     using a single PostScript path): this is the only way to get nice
+     line joins and to not restart the stippling for every line
+     segment. So if the primitive to print is not a line we must first
+     finish the current line (if any): */
+  if(prim->type != GL2PS_LINE) gl2psEndPostScriptLine();
+
+  switch(prim->type){
+  case GL2PS_POINT :
+    gl2psPrintPostScriptColor(prim->verts[0].rgba);
+    gl2psPrintf("%g %g %g P\n", 
+                prim->verts[0].xyz[0], prim->verts[0].xyz[1], 0.5 * prim->width);
+    break;
+  case GL2PS_LINE :
+    if(!gl2psSamePosition(gl2ps->lastvertex.xyz, prim->verts[0].xyz) ||
+       !gl2psSameColor(gl2ps->lastrgba, prim->verts[0].rgba) ||
+       gl2ps->lastlinewidth != prim->width ||
+       gl2ps->lastpattern != prim->pattern ||
+       gl2ps->lastfactor != prim->factor){
+      /* End the current line if the new segment does not start where
+         the last one ended, or if the color, the width or the
+         stippling have changed (multi-stroking lines with changing
+         colors is necessary until we use /shfill for lines;
+         unfortunately this means that at the moment we can screw up
+         line stippling for smooth-shaded lines) */
+      gl2psEndPostScriptLine();
+      newline = 1;
+    }
+    else{
+      newline = 0;
+    }
+    if(gl2ps->lastlinewidth != prim->width){
+      gl2ps->lastlinewidth = prim->width;
+      gl2psPrintf("%g W\n", gl2ps->lastlinewidth);
+    }
+    gl2psPrintPostScriptDash(prim->pattern, prim->factor, "setdash");
+    gl2psPrintPostScriptColor(prim->verts[0].rgba);
+    gl2psPrintf("%g %g %s\n", prim->verts[0].xyz[0], prim->verts[0].xyz[1],
+                newline ? "LS" : "L");
+    gl2ps->lastvertex = prim->verts[1];
+    break;
+  case GL2PS_TRIANGLE :
+    if(!gl2psVertsSameColor(prim)){
+      gl2psResetPostScriptColor();
+      gl2psPrintf("%g %g %g %g %g %g %g %g %g %g %g %g %g %g %g ST\n",
+                  prim->verts[2].xyz[0], prim->verts[2].xyz[1],
+                  prim->verts[2].rgba[0], prim->verts[2].rgba[1],
+                  prim->verts[2].rgba[2], prim->verts[1].xyz[0],
+                  prim->verts[1].xyz[1], prim->verts[1].rgba[0],
+                  prim->verts[1].rgba[1], prim->verts[1].rgba[2],
+                  prim->verts[0].xyz[0], prim->verts[0].xyz[1],
+                  prim->verts[0].rgba[0], prim->verts[0].rgba[1],
+                  prim->verts[0].rgba[2]);
+    }
+    else{
+      gl2psPrintPostScriptColor(prim->verts[0].rgba);
+      gl2psPrintf("%g %g %g %g %g %g T\n",
+                  prim->verts[2].xyz[0], prim->verts[2].xyz[1],
+                  prim->verts[1].xyz[0], prim->verts[1].xyz[1],
+                  prim->verts[0].xyz[0], prim->verts[0].xyz[1]);
+    }
+    break;
+  case GL2PS_QUADRANGLE :
+    gl2psMsg(GL2PS_WARNING, "There should not be any quad left to print");
+    break;
+  case GL2PS_PIXMAP :
+    gl2psPrintPostScriptPixmap(prim->verts[0].xyz[0], prim->verts[0].xyz[1],
+                               prim->data.image);
+    break;
+  case GL2PS_IMAGEMAP :
+    if(prim->data.image->type != GL2PS_IMAGEMAP_WRITTEN){
+      gl2psPrintPostScriptColor(prim->verts[0].rgba);
+      gl2psPrintPostScriptImagemap(prim->data.image->pixels[0],
+                                   prim->data.image->pixels[1],
+                                   prim->data.image->width, prim->data.image->height,
+                                   (const unsigned char*)(&(prim->data.image->pixels[2])));
+      prim->data.image->type = GL2PS_IMAGEMAP_WRITTEN;
+    }
+    break;
+  case GL2PS_TEXT :
+    gl2psPrintPostScriptColor(prim->verts[0].rgba);
+    gl2psPrintf("(%s) ", prim->data.text->str);
+    if(prim->data.text->angle)
+      gl2psPrintf("%g ", prim->data.text->angle);
+    gl2psPrintf("%g %g %d /%s ",
+                prim->verts[0].xyz[0], prim->verts[0].xyz[1],
+                prim->data.text->fontsize, prim->data.text->fontname);
+    switch(prim->data.text->alignment){
+    case GL2PS_TEXT_C:
+      gl2psPrintf(prim->data.text->angle ? "SCCR\n" : "SCC\n");
+      break;
+    case GL2PS_TEXT_CL:
+      gl2psPrintf(prim->data.text->angle ? "SCLR\n" : "SCL\n");
+      break;
+    case GL2PS_TEXT_CR:
+      gl2psPrintf(prim->data.text->angle ? "SCRR\n" : "SCR\n");
+      break;
+    case GL2PS_TEXT_B:
+      gl2psPrintf(prim->data.text->angle ? "SBCR\n" : "SBC\n");
+      break;
+    case GL2PS_TEXT_BR:
+      gl2psPrintf(prim->data.text->angle ? "SBRR\n" : "SBR\n");
+      break;
+    case GL2PS_TEXT_T:
+      gl2psPrintf(prim->data.text->angle ? "STCR\n" : "STC\n");
+      break;
+    case GL2PS_TEXT_TL:
+      gl2psPrintf(prim->data.text->angle ? "STLR\n" : "STL\n");
+      break;
+    case GL2PS_TEXT_TR:
+      gl2psPrintf(prim->data.text->angle ? "STRR\n" : "STR\n");
+      break;
+    case GL2PS_TEXT_BL:
+    default:
+      gl2psPrintf(prim->data.text->angle ? "SR\n" : "S\n");
+      break;
+    }
+    break;
+  case GL2PS_SPECIAL :
+    /* alignment contains the format for which the special output text
+       is intended */
+    if(prim->data.text->alignment == GL2PS_PS ||
+       prim->data.text->alignment == GL2PS_EPS)
+      gl2psPrintf("%s\n", prim->data.text->str);
+    break;
+  default :
+    break;
+  }
+}
+
+static void gl2psPrintPostScriptFooter(void)
+{
+  gl2psPrintf("grestore\n"
+              "showpage\n"
+              "cleartomark\n"
+              "%%%%PageTrailer\n"
+              "%%%%Trailer\n"
+              "end\n"
+              "%%%%EOF\n");
+
+  gl2psPrintGzipFooter();
+}
+
+static void gl2psPrintPostScriptBeginViewport(GLint viewport[4])
+{
+  GLint index;
+  GLfloat rgba[4];
+  int x = viewport[0], y = viewport[1], w = viewport[2], h = viewport[3];
+
+  glRenderMode(GL_FEEDBACK);
+
+  if(gl2ps->header){
+    gl2psPrintPostScriptHeader();
+    gl2ps->header = GL_FALSE;
+  }
+
+  gl2psPrintf("gsave\n"
+              "1.0 1.0 scale\n");
+
+  if(gl2ps->options & GL2PS_DRAW_BACKGROUND){
+    if(gl2ps->colormode == GL_RGBA || gl2ps->colorsize == 0){
+      glGetFloatv(GL_COLOR_CLEAR_VALUE, rgba);
+    }
+    else{
+      glGetIntegerv(GL_INDEX_CLEAR_VALUE, &index);
+      rgba[0] = gl2ps->colormap[index][0];
+      rgba[1] = gl2ps->colormap[index][1];
+      rgba[2] = gl2ps->colormap[index][2];
+      rgba[3] = 1.0F;
+    }
+    gl2psPrintf("%g %g %g C\n"
+                "newpath %d %d moveto %d %d lineto %d %d lineto %d %d lineto\n"
+                "closepath fill\n",
+                rgba[0], rgba[1], rgba[2], 
+                x, y, x+w, y, x+w, y+h, x, y+h);
+  }
+    
+  gl2psPrintf("newpath %d %d moveto %d %d lineto %d %d lineto %d %d lineto\n"
+              "closepath clip\n",
+              x, y, x+w, y, x+w, y+h, x, y+h);
+  
+}
+
+static GLint gl2psPrintPostScriptEndViewport(void)
+{
+  GLint res;
+
+  res = gl2psPrintPrimitives();
+  gl2psPrintf("grestore\n");
+  return res;
+}
+
+static void gl2psPrintPostScriptFinalPrimitive(void)
+{
+  /* End any remaining line, if any */
+  gl2psEndPostScriptLine();
+}
+
+/* definition of the PostScript and Encapsulated PostScript backends */
+
+static GL2PSbackend gl2psPS = {
+  gl2psPrintPostScriptHeader,
+  gl2psPrintPostScriptFooter,
+  gl2psPrintPostScriptBeginViewport,
+  gl2psPrintPostScriptEndViewport,
+  gl2psPrintPostScriptPrimitive,
+  gl2psPrintPostScriptFinalPrimitive,
+  "ps",
+  "Postscript"
+};
+
+static GL2PSbackend gl2psEPS = {
+  gl2psPrintPostScriptHeader,
+  gl2psPrintPostScriptFooter,
+  gl2psPrintPostScriptBeginViewport,
+  gl2psPrintPostScriptEndViewport,
+  gl2psPrintPostScriptPrimitive,
+  gl2psPrintPostScriptFinalPrimitive,
+  "eps",
+  "Encapsulated Postscript"
+};
+
+/********************************************************************* 
+ *
+ * LaTeX routines
+ *
+ *********************************************************************/
+
+static void gl2psPrintTeXHeader(void)
+{
+  char name[256];
+  time_t now;
+  int i;
+
+  if(gl2ps->filename && strlen(gl2ps->filename) < 256){
+    for(i = strlen(gl2ps->filename)-1; i >= 0; i--){
+      if(gl2ps->filename[i] == '.'){
+        strncpy(name, gl2ps->filename, i);
+        name[i] = '\0';
+        break;
+      }
+    }
+    if(i <= 0) strcpy(name, gl2ps->filename);
+  }
+  else{
+    strcpy(name, "untitled");
+  }
+
+  time(&now);
+
+  fprintf(gl2ps->stream, 
+          "%% Title: %s\n"
+          "%% Creator: GL2PS %d.%d.%d%s, %s\n"
+          "%% For: %s\n"
+          "%% CreationDate: %s",
+          gl2ps->title, GL2PS_MAJOR_VERSION, GL2PS_MINOR_VERSION,
+          GL2PS_PATCH_VERSION, GL2PS_EXTRA_VERSION, GL2PS_COPYRIGHT,
+          gl2ps->producer, ctime(&now));
+
+  fprintf(gl2ps->stream, 
+          "\\setlength{\\unitlength}{1pt}\n"
+          "\\begin{picture}(0,0)\n"
+          "\\includegraphics{%s}\n"
+          "\\end{picture}%%\n"
+          "%s\\begin{picture}(%d,%d)(0,0)\n",
+          name, (gl2ps->options & GL2PS_LANDSCAPE) ? "\\rotatebox{90}{" : "",
+          (int)gl2ps->viewport[2], (int)gl2ps->viewport[3]);
+}
+
+static void gl2psPrintTeXPrimitive(void *data)
+{
+  GL2PSprimitive *prim;
+
+  prim = *(GL2PSprimitive**)data;
+
+  switch(prim->type){
+  case GL2PS_TEXT :
+    fprintf(gl2ps->stream, "\\fontsize{%d}{0}\n\\selectfont", 
+            prim->data.text->fontsize);
+    fprintf(gl2ps->stream, "\\put(%g,%g){\\makebox(0,0)",
+            prim->verts[0].xyz[0], prim->verts[0].xyz[1]);
+    switch(prim->data.text->alignment){
+    case GL2PS_TEXT_C:
+      fprintf(gl2ps->stream, "{");
+      break;
+    case GL2PS_TEXT_CL:
+      fprintf(gl2ps->stream, "[l]{");
+      break;
+    case GL2PS_TEXT_CR:
+      fprintf(gl2ps->stream, "[r]{");
+      break;
+    case GL2PS_TEXT_B:
+      fprintf(gl2ps->stream, "[b]{");
+      break;
+    case GL2PS_TEXT_BR:
+      fprintf(gl2ps->stream, "[br]{");
+      break;
+    case GL2PS_TEXT_T:
+      fprintf(gl2ps->stream, "[t]{");
+      break;
+    case GL2PS_TEXT_TL:
+      fprintf(gl2ps->stream, "[tl]{");
+      break;
+    case GL2PS_TEXT_TR:
+      fprintf(gl2ps->stream, "[tr]{");
+      break;
+    case GL2PS_TEXT_BL:
+    default:
+      fprintf(gl2ps->stream, "[bl]{");
+      break;
+    }
+    if(prim->data.text->angle)
+      fprintf(gl2ps->stream, "\\rotatebox{%g}{", prim->data.text->angle);
+    fprintf(gl2ps->stream, "\\textcolor[rgb]{%g,%g,%g}{{%s}}",
+            prim->verts[0].rgba[0], prim->verts[0].rgba[1], prim->verts[0].rgba[2],
+            prim->data.text->str);
+    if(prim->data.text->angle)
+      fprintf(gl2ps->stream, "}");
+    fprintf(gl2ps->stream, "}}\n");
+    break;
+  case GL2PS_SPECIAL :
+    /* alignment contains the format for which the special output text
+       is intended */
+    if (prim->data.text->alignment == GL2PS_TEX)
+      fprintf(gl2ps->stream, "%s\n", prim->data.text->str);
+    break;
+  default :
+    break;
+  }
+}
+
+static void gl2psPrintTeXFooter(void)
+{
+  fprintf(gl2ps->stream, "\\end{picture}%s\n",
+          (gl2ps->options & GL2PS_LANDSCAPE) ? "}" : "");
+}
+
+static void gl2psPrintTeXBeginViewport(GLint [4])
+{
+  glRenderMode(GL_FEEDBACK);
+  
+  if(gl2ps->header){
+    gl2psPrintTeXHeader();
+    gl2ps->header = GL_FALSE;
+  }
+}
+
+static GLint gl2psPrintTeXEndViewport(void)
+{
+  return gl2psPrintPrimitives();
+}
+
+static void gl2psPrintTeXFinalPrimitive(void)
+{
+}
+
+/* definition of the LaTeX backend */
+
+static GL2PSbackend gl2psTEX = {
+  gl2psPrintTeXHeader,
+  gl2psPrintTeXFooter,
+  gl2psPrintTeXBeginViewport,
+  gl2psPrintTeXEndViewport,
+  gl2psPrintTeXPrimitive,
+  gl2psPrintTeXFinalPrimitive,
+  "tex",
+  "LaTeX text"
+};
+
+/********************************************************************* 
+ *
+ * PDF routines
+ *
+ *********************************************************************/
+
+static int gl2psPrintPDFCompressorType(void)
+{
+#if defined(GL2PS_HAVE_ZLIB)
+  if(gl2ps->options & GL2PS_COMPRESS){
+    return fprintf(gl2ps->stream, "/Filter [/FlateDecode]\n");
+  }
+#endif
+  return 0;
+}
+
+static int gl2psPrintPDFStrokeColor(GL2PSrgba rgba)
+{
+  int i, offs = 0;
+
+  gl2psSetLastColor(rgba);
+  for(i = 0; i < 3; ++i){
+    if(GL2PS_ZERO(rgba[i]))
+      offs += gl2psPrintf("%.0f ", 0.);
+    else if(rgba[i] < 1e-4 || rgba[i] > 1e6) /* avoid %e formatting */
+      offs += gl2psPrintf("%f ", rgba[i]);
+    else
+      offs += gl2psPrintf("%g ", rgba[i]);
+  }
+  offs += gl2psPrintf("RG\n");
+  return offs;
+}
+
+static int gl2psPrintPDFFillColor(GL2PSrgba rgba)
+{
+  int i, offs = 0;
+  
+  for(i = 0; i < 3; ++i){
+    if(GL2PS_ZERO(rgba[i]))
+      offs += gl2psPrintf("%.0f ", 0.);
+    else if(rgba[i] < 1e-4 || rgba[i] > 1e6) /* avoid %e formatting */
+      offs += gl2psPrintf("%f ", rgba[i]);
+    else
+      offs += gl2psPrintf("%g ", rgba[i]);
+  }
+  offs += gl2psPrintf("rg\n");
+  return offs;
+}
+
+static int gl2psPrintPDFLineWidth(GLfloat lw)
+{
+  if(GL2PS_ZERO(lw))
+    return gl2psPrintf("%.0f w\n", 0.);
+  else if(lw < 1e-4 || lw > 1e6) /* avoid %e formatting */
+    return gl2psPrintf("%f w\n", lw);
+  else
+    return gl2psPrintf("%g w\n", lw);
+}
+
+static void gl2psPutPDFText(GL2PSstring *text, int cnt, GLfloat x, GLfloat y)
+{
+  gl2ps->streamlength += 
+    gl2psPrintf("BT\n"
+                "/F%d %d Tf\n"
+                "%f %f Td\n"
+                "(%s) Tj\n"
+                "ET\n", 
+                cnt, text->fontsize, x, y, text->str);  
+}
+
+static void gl2psPutPDFImage(GL2PSimage *image, int cnt, GLfloat x, GLfloat y)
+{
+  gl2ps->streamlength += 
+    gl2psPrintf("q\n"
+                "%d 0 0 %d %f %f cm\n"
+                "/Im%d Do\n"
+                "Q\n",
+                (int)image->width, (int)image->height, x, y, cnt);
+}
+
+static void gl2psPDFstacksInit(void)
+{
+  gl2ps->objects_stack = 7 /* FIXED_XREF_ENTRIES */ + 1; 
+  gl2ps->extgs_stack = 0;   
+  gl2ps->font_stack = 0;    
+  gl2ps->im_stack = 0;      
+  gl2ps->trgroupobjects_stack = 0;    
+  gl2ps->shader_stack = 0;  
+  gl2ps->mshader_stack = 0; 
+}
+
+static void gl2psPDFgroupObjectInit(GL2PSpdfgroup *gro)
+{
+  if(!gro)
+    return;
+  
+  gro->ptrlist = NULL;
+  gro->fontno = gro->gsno = gro->imno = gro->maskshno = gro->shno 
+    = gro->trgroupno = gro->fontobjno = gro->imobjno = gro->shobjno 
+    = gro->maskshobjno = gro->gsobjno = gro->trgroupobjno = -1;
+}
+
+/* Build up group objects and assign name and object numbers */
+
+static void gl2psPDFgroupListInit(void)
+{
+  int i;
+  GL2PSprimitive *p = NULL;
+  GL2PSpdfgroup gro;
+  int lasttype = GL2PS_NO_TYPE;
+  GL2PSrgba lastrgba = {-1.0F, -1.0F, -1.0F, -1.0F};
+  GLushort lastpattern = 0;
+  GLint lastfactor = 0;
+  GLfloat lastwidth = 1;
+  GL2PStriangle lastt, tmpt;
+  int lastTriangleWasNotSimpleWithSameColor = 0;
+
+  if(!gl2ps->pdfprimlist)
+    return;
+
+  gl2ps->pdfgrouplist = gl2psListCreate(500, 500, sizeof(GL2PSpdfgroup));
+  gl2psInitTriangle(&lastt);
+
+  for(i = 0; i < gl2psListNbr(gl2ps->pdfprimlist); ++i){  
+    p = *(GL2PSprimitive**)gl2psListPointer(gl2ps->pdfprimlist, i);
+    switch(p->type){
+    case GL2PS_PIXMAP:
+      gl2psPDFgroupObjectInit(&gro);
+      gro.ptrlist = gl2psListCreate(1, 2, sizeof(GL2PSprimitive*));
+      gro.imno = gl2ps->im_stack++;
+      gl2psListAdd(gro.ptrlist, &p);
+      gl2psListAdd(gl2ps->pdfgrouplist, &gro);
+      break;
+    case GL2PS_TEXT:
+      gl2psPDFgroupObjectInit(&gro);
+      gro.ptrlist = gl2psListCreate(1, 2, sizeof(GL2PSprimitive*));
+      gro.fontno = gl2ps->font_stack++;
+      gl2psListAdd(gro.ptrlist, &p);
+      gl2psListAdd(gl2ps->pdfgrouplist, &gro);
+      break;
+    case GL2PS_LINE:
+      if(lasttype != p->type || lastwidth != p->width || 
+         lastpattern != p->pattern || lastfactor != p->factor ||
+         !gl2psSameColor(p->verts[0].rgba, lastrgba)){
+        gl2psPDFgroupObjectInit(&gro);
+        gro.ptrlist = gl2psListCreate(1, 2, sizeof(GL2PSprimitive*));
+        gl2psListAdd(gro.ptrlist, &p);
+        gl2psListAdd(gl2ps->pdfgrouplist, &gro);
+      }
+      else{
+        gl2psListAdd(gro.ptrlist, &p);
+      }
+      lastpattern = p->pattern;
+      lastfactor = p->factor;
+      lastwidth = p->width;
+      lastrgba[0] = p->verts[0].rgba[0];
+      lastrgba[1] = p->verts[0].rgba[1];
+      lastrgba[2] = p->verts[0].rgba[2];
+      break;
+    case GL2PS_POINT:
+      if(lasttype != p->type || lastwidth != p->width || 
+         !gl2psSameColor(p->verts[0].rgba, lastrgba)){
+        gl2psPDFgroupObjectInit(&gro);
+        gro.ptrlist = gl2psListCreate(1,2,sizeof(GL2PSprimitive*));
+        gl2psListAdd(gro.ptrlist, &p);
+        gl2psListAdd(gl2ps->pdfgrouplist, &gro);
+      }
+      else{
+        gl2psListAdd(gro.ptrlist, &p);
+      }
+      lastwidth = p->width;
+      lastrgba[0] = p->verts[0].rgba[0];
+      lastrgba[1] = p->verts[0].rgba[1];
+      lastrgba[2] = p->verts[0].rgba[2];
+      break;
+    case GL2PS_TRIANGLE:
+      gl2psFillTriangleFromPrimitive(&tmpt, p, GL_TRUE);
+      lastTriangleWasNotSimpleWithSameColor = 
+        !(tmpt.prop & T_CONST_COLOR && tmpt.prop & T_ALPHA_1) ||
+        !gl2psSameColor(tmpt.vertex[0].rgba, lastt.vertex[0].rgba);
+      if(lasttype == p->type && tmpt.prop == lastt.prop && 
+         lastTriangleWasNotSimpleWithSameColor){
+        /* TODO Check here for last alpha */
+        gl2psListAdd(gro.ptrlist, &p);
+      }
+      else{
+        gl2psPDFgroupObjectInit(&gro);
+        gro.ptrlist = gl2psListCreate(1, 2, sizeof(GL2PSprimitive*));
+        gl2psListAdd(gro.ptrlist, &p);
+        gl2psListAdd(gl2ps->pdfgrouplist, &gro);
+      }
+      lastt = tmpt;
+      break;
+    default:
+      break;
+    } 
+    lasttype = p->type;
+  }
+}
+
+static void gl2psSortOutTrianglePDFgroup(GL2PSpdfgroup *gro)
+{
+  GL2PStriangle t;
+  GL2PSprimitive *prim = NULL;
+  
+  if(!gro)
+    return;
+
+  if(!gl2psListNbr(gro->ptrlist))
+    return;
+
+  prim = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, 0);
+
+  if(prim->type != GL2PS_TRIANGLE)
+    return;
+
+  gl2psFillTriangleFromPrimitive(&t, prim, GL_TRUE);
+  
+  if(t.prop & T_CONST_COLOR && t.prop & T_ALPHA_LESS_1){        
+    gro->gsno = gl2ps->extgs_stack++; 
+    gro->gsobjno = gl2ps->objects_stack ++;
+  }
+  else if(t.prop & T_CONST_COLOR && t.prop & T_VAR_ALPHA){              
+    gro->gsno = gl2ps->extgs_stack++;
+    gro->gsobjno = gl2ps->objects_stack++;
+    gro->trgroupno = gl2ps->trgroupobjects_stack++; 
+    gro->trgroupobjno = gl2ps->objects_stack++;
+    gro->maskshno = gl2ps->mshader_stack++;
+    gro->maskshobjno = gl2ps->objects_stack++;
+  }
+  else if(t.prop & T_VAR_COLOR && t.prop & T_ALPHA_1){          
+    gro->shno = gl2ps->shader_stack++;
+    gro->shobjno = gl2ps->objects_stack++;
+  }
+  else if(t.prop & T_VAR_COLOR && t.prop & T_ALPHA_LESS_1){             
+    gro->gsno = gl2ps->extgs_stack++;
+    gro->gsobjno = gl2ps->objects_stack++;
+    gro->shno = gl2ps->shader_stack++; 
+    gro->shobjno = gl2ps->objects_stack++;
+  }
+  else if(t.prop & T_VAR_COLOR && t.prop & T_VAR_ALPHA){                
+    gro->gsno = gl2ps->extgs_stack++;
+    gro->gsobjno = gl2ps->objects_stack++;
+    gro->shno = gl2ps->shader_stack++; 
+    gro->shobjno = gl2ps->objects_stack++;
+    gro->trgroupno = gl2ps->trgroupobjects_stack++; 
+    gro->trgroupobjno = gl2ps->objects_stack++;
+    gro->maskshno = gl2ps->mshader_stack++;
+    gro->maskshobjno = gl2ps->objects_stack++;
+  }
+}
+
+/* Main stream data */
+
+static void gl2psPDFgroupListWriteMainStream(void)
+{
+  int i, j, lastel;
+  GL2PSprimitive *prim = NULL, *prev = NULL;
+  GL2PSpdfgroup *gro;
+  GL2PStriangle t;
+
+  if(!gl2ps->pdfgrouplist)
+    return;
+
+  for(i = 0; i < gl2psListNbr(gl2ps->pdfgrouplist); ++i){
+    gro = (GL2PSpdfgroup*)gl2psListPointer(gl2ps->pdfgrouplist, i);
+
+    lastel = gl2psListNbr(gro->ptrlist) - 1;
+    if(lastel < 0)
+      continue;
+
+    prim = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, 0);
+
+    switch(prim->type){
+    case GL2PS_POINT:
+      gl2ps->streamlength += gl2psPrintf("1 J\n");
+      gl2ps->streamlength += gl2psPrintPDFLineWidth(prim->width);
+      gl2ps->streamlength += gl2psPrintPDFStrokeColor(prim->verts[0].rgba);
+      for(j = 0; j <= lastel; ++j){  
+        prim = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, j);
+        gl2ps->streamlength +=
+          gl2psPrintf("%f %f m %f %f l\n",
+                      prim->verts[0].xyz[0], prim->verts[0].xyz[1],
+                      prim->verts[0].xyz[0], prim->verts[0].xyz[1]);
+      }
+      gl2ps->streamlength += gl2psPrintf("S\n"); 
+      gl2ps->streamlength += gl2psPrintf("0 J\n");
+      break;
+    case GL2PS_LINE:
+      /* We try to use as few paths as possible to draw lines, in
+         order to get nice stippling even when the individual segments
+         are smaller than the stipple */
+      gl2ps->streamlength += gl2psPrintPDFLineWidth(prim->width);
+      gl2ps->streamlength += gl2psPrintPDFStrokeColor(prim->verts[0].rgba);
+      gl2ps->streamlength += gl2psPrintPostScriptDash(prim->pattern, prim->factor, "d");
+      /* start new path */
+      gl2ps->streamlength += 
+        gl2psPrintf("%f %f m\n", 
+                    prim->verts[0].xyz[0], prim->verts[0].xyz[1]);
+      
+      for(j = 1; j <= lastel; ++j){
+        prev = prim;
+        prim = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, j);
+        if(!gl2psSamePosition(prim->verts[0].xyz, prev->verts[1].xyz)){
+          /* the starting point of the new segment does not match the
+             end point of the previous line, so we end the current
+             path and start a new one */
+          gl2ps->streamlength += 
+            gl2psPrintf("%f %f l\n", 
+                        prev->verts[1].xyz[0], prev->verts[1].xyz[1]);
+          gl2ps->streamlength += 
+            gl2psPrintf("%f %f m\n", 
+                        prim->verts[0].xyz[0], prim->verts[0].xyz[1]);
+        }
+        else{
+          /* the two segements are connected, so we just append to the
+             current path */
+          gl2ps->streamlength += 
+            gl2psPrintf("%f %f l\n",
+                        prim->verts[0].xyz[0], prim->verts[0].xyz[1]);
+        }
+      }
+      /* end last path */
+      gl2ps->streamlength += 
+        gl2psPrintf("%f %f l\n", 
+                    prim->verts[1].xyz[0], prim->verts[1].xyz[1]);
+      gl2ps->streamlength += gl2psPrintf("S\n");
+      break;
+    case GL2PS_TRIANGLE:
+      gl2psFillTriangleFromPrimitive(&t, prim, GL_TRUE);
+      gl2psSortOutTrianglePDFgroup(gro);
+      
+      /* No alpha and const color: Simple PDF draw orders  */
+      if(t.prop & T_CONST_COLOR && t.prop & T_ALPHA_1){         
+        gl2ps->streamlength += gl2psPrintPDFFillColor(t.vertex[0].rgba);        
+        for(j = 0; j <= lastel; ++j){  
+          prim = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, j);
+          gl2psFillTriangleFromPrimitive(&t, prim, GL_FALSE);
+          gl2ps->streamlength 
+            += gl2psPrintf("%f %f m\n"
+                           "%f %f l\n"
+                           "%f %f l\n"
+                           "h f\n",
+                           t.vertex[0].xyz[0], t.vertex[0].xyz[1],
+                           t.vertex[1].xyz[0], t.vertex[1].xyz[1],
+                           t.vertex[2].xyz[0], t.vertex[2].xyz[1]);
+        }
+      }
+      /* Const alpha < 1 and const color: Simple PDF draw orders 
+         and an extra extended Graphics State for the alpha const */
+      else if(t.prop & T_CONST_COLOR && t.prop & T_ALPHA_LESS_1){               
+        gl2ps->streamlength += gl2psPrintf("q\n"
+                                           "/GS%d gs\n",
+                                           gro->gsno);
+        gl2ps->streamlength += gl2psPrintPDFFillColor(prim->verts[0].rgba);
+        for(j = 0; j <= lastel; ++j){  
+          prim = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, j);
+          gl2psFillTriangleFromPrimitive(&t, prim, GL_FALSE);
+          gl2ps->streamlength 
+            += gl2psPrintf("%f %f m\n"
+                           "%f %f l\n"
+                           "%f %f l\n"
+                           "h f\n",
+                           t.vertex[0].xyz[0], t.vertex[0].xyz[1],
+                           t.vertex[1].xyz[0], t.vertex[1].xyz[1],
+                           t.vertex[2].xyz[0], t.vertex[2].xyz[1]);
+        }
+        gl2ps->streamlength += gl2psPrintf("Q\n");
+      }
+      /* Variable alpha and const color: Simple PDF draw orders 
+         and an extra extended Graphics State + Xobject + Shader 
+         object for the alpha mask */
+      else if(t.prop & T_CONST_COLOR && t.prop & T_VAR_ALPHA){          
+        gl2ps->streamlength += gl2psPrintf("q\n"
+                                           "/GS%d gs\n"
+                                           "/TrG%d Do\n",
+                                           gro->gsno, gro->trgroupno);
+        gl2ps->streamlength += gl2psPrintPDFFillColor(prim->verts[0].rgba);
+        for(j = 0; j <= lastel; ++j){  
+          prim = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, j);
+          gl2psFillTriangleFromPrimitive(&t, prim, GL_FALSE);
+          gl2ps->streamlength 
+            += gl2psPrintf("%f %f m\n"
+                           "%f %f l\n"
+                           "%f %f l\n"
+                           "h f\n",
+                           t.vertex[0].xyz[0], t.vertex[0].xyz[1],
+                           t.vertex[1].xyz[0], t.vertex[1].xyz[1],
+                           t.vertex[2].xyz[0], t.vertex[2].xyz[1]);
+        }
+        gl2ps->streamlength += gl2psPrintf("Q\n");
+      }
+      /* Variable color and no alpha: Shader Object for the colored
+         triangle(s) */
+      else if(t.prop & T_VAR_COLOR && t.prop & T_ALPHA_1){              
+        gl2ps->streamlength += gl2psPrintf("/Sh%d sh\n", gro->shno);
+      }
+      /* Variable color and const alpha < 1: Shader Object for the 
+         colored triangle(s) and an extra extended Graphics State 
+         for the alpha const */
+      else if(t.prop & T_VAR_COLOR && t.prop & T_ALPHA_LESS_1){         
+        gl2ps->streamlength += gl2psPrintf("q\n"
+                                           "/GS%d gs\n"
+                                           "/Sh%d sh\n"
+                                           "Q\n",
+                                           gro->gsno, gro->shno);
+      }
+      /* Variable alpha and color: Shader Object for the colored 
+         triangle(s) and an extra extended Graphics State 
+         + Xobject + Shader object for the alpha mask */
+      else if(t.prop & T_VAR_COLOR && t.prop & T_VAR_ALPHA){            
+        gl2ps->streamlength += gl2psPrintf("q\n"
+                                           "/GS%d gs\n"
+                                           "/TrG%d Do\n"
+                                           "/Sh%d sh\n"
+                                           "Q\n",
+                                           gro->gsno, gro->trgroupno, gro->shno);
+      }
+      break;
+    case GL2PS_PIXMAP:
+      for(j = 0; j <= lastel; ++j){
+        prim = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, j);
+        gl2psPutPDFImage(prim->data.image, gro->imno, prim->verts[0].xyz[0], 
+                         prim->verts[0].xyz[1]);
+      }
+      break;
+    case GL2PS_TEXT:
+      for(j = 0; j <= lastel; ++j){  
+        prim = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, j);
+        gl2ps->streamlength += gl2psPrintPDFFillColor(prim->verts[0].rgba);
+        gl2psPutPDFText(prim->data.text, gro->fontno, prim->verts[0].xyz[0],
+                        prim->verts[0].xyz[1]);
+      }
+      break;
+    default:
+      break;
+    } 
+  }
+}
+
+/* Graphics State names */
+
+static int gl2psPDFgroupListWriteGStateResources(void)
+{
+  GL2PSpdfgroup *gro;
+  int offs = 0;
+  int i;
+
+  offs += fprintf(gl2ps->stream,
+                  "/ExtGState\n" 
+                  "<<\n"
+                  "/GSa 7 0 R\n");
+  for(i = 0; i < gl2psListNbr(gl2ps->pdfgrouplist); ++i){  
+    gro = (GL2PSpdfgroup*)gl2psListPointer(gl2ps->pdfgrouplist, i); 
+    if(gro->gsno >= 0)
+      offs += fprintf(gl2ps->stream, "/GS%d %d 0 R\n", gro->gsno, gro->gsobjno);
+  }
+  offs += fprintf(gl2ps->stream, ">>\n"); 
+  return offs;
+}
+
+/* Main Shader names */
+
+static int gl2psPDFgroupListWriteShaderResources(void)
+{
+  GL2PSpdfgroup *gro;
+  int offs = 0;
+  int i;
+
+  offs += fprintf(gl2ps->stream,
+                  "/Shading\n"
+                  "<<\n");
+  for(i = 0; i < gl2psListNbr(gl2ps->pdfgrouplist); ++i){  
+    gro = (GL2PSpdfgroup*)gl2psListPointer(gl2ps->pdfgrouplist, i); 
+    if(gro->shno >= 0)
+      offs += fprintf(gl2ps->stream, "/Sh%d %d 0 R\n", gro->shno, gro->shobjno);
+    if(gro->maskshno >= 0)
+      offs += fprintf(gl2ps->stream, "/TrSh%d %d 0 R\n", gro->maskshno, gro->maskshobjno);
+  }
+  offs += fprintf(gl2ps->stream,">>\n");  
+  return offs;
+}
+
+/* Images & Mask Shader XObject names */
+
+static int gl2psPDFgroupListWriteXObjectResources(void)
+{
+  int i;
+  GL2PSprimitive *p = NULL;
+  GL2PSpdfgroup *gro;
+  int offs = 0;
+
+  offs += fprintf(gl2ps->stream,
+                  "/XObject\n"
+                  "<<\n");
+
+  for(i = 0; i < gl2psListNbr(gl2ps->pdfgrouplist); ++i){  
+    gro = (GL2PSpdfgroup*)gl2psListPointer(gl2ps->pdfgrouplist, i); 
+    if(!gl2psListNbr(gro->ptrlist))
+      continue;
+    p = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, 0);
+    switch(p->type){
+    case GL2PS_PIXMAP:
+      gro->imobjno = gl2ps->objects_stack++;
+      if(GL_RGBA == p->data.image->format)  /* reserve one object for image mask */
+        gl2ps->objects_stack++;
+      offs += fprintf(gl2ps->stream, "/Im%d %d 0 R\n", gro->imno, gro->imobjno);
+    case GL2PS_TRIANGLE:
+      if(gro->trgroupno >=0)
+        offs += fprintf(gl2ps->stream, "/TrG%d %d 0 R\n", gro->trgroupno, gro->trgroupobjno);
+      break;
+    default:
+      break;
+    }
+  }
+  offs += fprintf(gl2ps->stream,">>\n");
+  return offs;
+}
+
+/* Font names */
+
+static int gl2psPDFgroupListWriteFontResources(void)
+{
+  int i;
+  GL2PSpdfgroup *gro;
+  int offs = 0;
+
+  offs += fprintf(gl2ps->stream, "/Font\n<<\n");
+
+  for(i = 0; i < gl2psListNbr(gl2ps->pdfgrouplist); ++i){  
+    gro = (GL2PSpdfgroup*)gl2psListPointer(gl2ps->pdfgrouplist, i); 
+    if(gro->fontno < 0)
+      continue;
+    gro->fontobjno = gl2ps->objects_stack++;
+    offs += fprintf(gl2ps->stream, "/F%d %d 0 R\n", gro->fontno, gro->fontobjno);
+  }
+  offs += fprintf(gl2ps->stream, ">>\n");
+
+  return offs;
+}
+
+static void gl2psPDFgroupListDelete(void)
+{
+  int i;
+  GL2PSpdfgroup *gro = NULL;
+  
+  if(!gl2ps->pdfgrouplist)
+    return;
+
+  for(i = 0; i < gl2psListNbr(gl2ps->pdfgrouplist); ++i){ 
+    gro = (GL2PSpdfgroup*)gl2psListPointer(gl2ps->pdfgrouplist,i);
+    gl2psListDelete(gro->ptrlist);
+  }
+
+  gl2psListDelete(gl2ps->pdfgrouplist);
+  gl2ps->pdfgrouplist = NULL;
+}
+
+/* Print 1st PDF object - file info */
+
+static int gl2psPrintPDFInfo(void)
+{
+  int offs;
+  time_t now;
+  struct tm *newtime;
+  
+  time(&now);
+  newtime = gmtime(&now);
+  
+  offs = fprintf(gl2ps->stream,
+                 "1 0 obj\n"
+                 "<<\n"
+                 "/Title (%s)\n"
+                 "/Creator (GL2PS %d.%d.%d%s, %s)\n"
+                 "/Producer (%s)\n",
+                 gl2ps->title, GL2PS_MAJOR_VERSION, GL2PS_MINOR_VERSION,
+                 GL2PS_PATCH_VERSION, GL2PS_EXTRA_VERSION, GL2PS_COPYRIGHT,
+                 gl2ps->producer);
+  
+  if(!newtime){
+    offs += fprintf(gl2ps->stream, 
+                    ">>\n"
+                    "endobj\n");
+    return offs;
+  }
+  
+  offs += fprintf(gl2ps->stream, 
+                  "/CreationDate (D:%d%02d%02d%02d%02d%02d)\n"
+                  ">>\n"
+                  "endobj\n",
+                  newtime->tm_year+1900, 
+                  newtime->tm_mon+1, 
+                  newtime->tm_mday,
+                  newtime->tm_hour,
+                  newtime->tm_min,
+                  newtime->tm_sec);
+  return offs;
+}
+
+/* Create catalog and page structure - 2nd and 3th PDF object */
+
+static int gl2psPrintPDFCatalog(void)
+{
+  return fprintf(gl2ps->stream, 
+                 "2 0 obj\n"
+                 "<<\n"
+                 "/Type /Catalog\n"
+                 "/Pages 3 0 R\n"
+                 ">>\n"
+                 "endobj\n");
+}
+
+static int gl2psPrintPDFPages(void)
+{
+  return fprintf(gl2ps->stream, 
+                 "3 0 obj\n"
+                 "<<\n" 
+                 "/Type /Pages\n"
+                 "/Kids [6 0 R]\n"
+                 "/Count 1\n"
+                 ">>\n"
+                 "endobj\n");
+}
+
+/* Open stream for data - graphical objects, fonts etc. PDF object 4 */
+
+static int gl2psOpenPDFDataStream(void)
+{
+  int offs = 0;
+  
+  offs += fprintf(gl2ps->stream, 
+                  "4 0 obj\n"
+                  "<<\n" 
+                  "/Length 5 0 R\n" );
+  offs += gl2psPrintPDFCompressorType();
+  offs += fprintf(gl2ps->stream, 
+                  ">>\n"
+                  "stream\n");
+  return offs;
+}
+
+/* Stream setup - Graphics state, fill background if allowed */
+
+static int gl2psOpenPDFDataStreamWritePreface(void)
+{
+  int offs;
+
+  offs = gl2psPrintf("/GSa gs\n");
+  
+  if(gl2ps->options & GL2PS_DRAW_BACKGROUND){
+    offs += gl2psPrintPDFFillColor(gl2ps->bgcolor);
+    offs += gl2psPrintf("%d %d %d %d re\n",
+                        (int)gl2ps->viewport[0], (int)gl2ps->viewport[1],
+                        (int)gl2ps->viewport[2], (int)gl2ps->viewport[3]);
+    offs += gl2psPrintf("f\n");  
+  }
+  return offs;
+}
+
+/* Use the functions above to create the first part of the PDF*/
+
+static void gl2psPrintPDFHeader(void)
+{
+  int offs = 0;
+  gl2ps->pdfprimlist = gl2psListCreate(500, 500, sizeof(GL2PSprimitive*));
+  gl2psPDFstacksInit();
+
+  gl2ps->xreflist = (int*)gl2psMalloc(sizeof(int) * gl2ps->objects_stack); 
+
+#if defined(GL2PS_HAVE_ZLIB)
+  if(gl2ps->options & GL2PS_COMPRESS){
+    gl2psSetupCompress();
+  }
+#endif    
+  gl2ps->xreflist[0] = 0;
+  offs += fprintf(gl2ps->stream, "%%PDF-1.4\n");
+  gl2ps->xreflist[1] = offs;
+  
+  offs += gl2psPrintPDFInfo();
+  gl2ps->xreflist[2] = offs;
+  
+  offs += gl2psPrintPDFCatalog();
+  gl2ps->xreflist[3] = offs;
+  
+  offs += gl2psPrintPDFPages();
+  gl2ps->xreflist[4] = offs;
+  
+  offs += gl2psOpenPDFDataStream();
+  gl2ps->xreflist[5] = offs; /* finished in gl2psPrintPDFFooter */
+  gl2ps->streamlength = gl2psOpenPDFDataStreamWritePreface();
+}
+
+/* The central primitive drawing */
+
+static void gl2psPrintPDFPrimitive(void *data)
+{
+  GL2PSprimitive *prim = *(GL2PSprimitive**)data;
+
+  if((gl2ps->options & GL2PS_OCCLUSION_CULL) && prim->culled) 
+    return;
+
+  prim = gl2psCopyPrimitive(prim); /* deep copy */
+  gl2psListAdd(gl2ps->pdfprimlist, &prim);
+}
+
+/* close stream and ... */
+
+static int gl2psClosePDFDataStream(void)
+{
+  int offs = 0;
+ 
+#if defined(GL2PS_HAVE_ZLIB)
+  if(gl2ps->options & GL2PS_COMPRESS){
+    if(Z_OK != gl2psDeflate())
+      gl2psMsg(GL2PS_ERROR, "Zlib deflate error");
+    else
+      fwrite(gl2ps->compress->dest, gl2ps->compress->destLen, 1, gl2ps->stream);
+    gl2ps->streamlength += gl2ps->compress->destLen;
+    
+    offs += gl2ps->streamlength;
+    gl2psFreeCompress();
+  }
+#endif 
+  
+  offs += fprintf(gl2ps->stream, 
+                  "endstream\n"
+                  "endobj\n");
+  return offs;
+}
+
+/* ... write the now known length object */
+
+static int gl2psPrintPDFDataStreamLength(int val)
+{
+  return fprintf(gl2ps->stream,
+                 "5 0 obj\n"
+                 "%d\n"
+                 "endobj\n", val);
+}
+
+/* Put the info created before in PDF objects */
+
+static int gl2psPrintPDFOpenPage(void)
+{
+  int offs;
+  
+  /* Write fixed part */
+  
+  offs = fprintf(gl2ps->stream, 
+                 "6 0 obj\n"
+                 "<<\n" 
+                 "/Type /Page\n"
+                 "/Parent 3 0 R\n"
+                 "/MediaBox [%d %d %d %d]\n",
+                 (int)gl2ps->viewport[0], (int)gl2ps->viewport[1],
+                 (int)gl2ps->viewport[2], (int)gl2ps->viewport[3]);
+  
+  if(gl2ps->options & GL2PS_LANDSCAPE)
+    offs += fprintf(gl2ps->stream, "/Rotate -90\n");
+  
+  offs += fprintf(gl2ps->stream,
+                  "/Contents 4 0 R\n"
+                  "/Resources\n" 
+                  "<<\n" 
+                  "/ProcSet [/PDF /Text /ImageB /ImageC]  %%/ImageI\n");
+  
+  return offs;
+
+  /* End fixed part, proceeds in gl2psPDFgroupListWriteVariableResources() */
+}
+
+static int gl2psPDFgroupListWriteVariableResources(void)
+{
+  int offs = 0;
+  
+  /* a) Graphics States for shader alpha masks*/
+  offs += gl2psPDFgroupListWriteGStateResources();  
+  
+  /* b) Shader and shader masks */ 
+  offs += gl2psPDFgroupListWriteShaderResources();  
+ 
+  /* c) XObjects (Images & Shader Masks) */
+  offs += gl2psPDFgroupListWriteXObjectResources();
+  
+  /* d) Fonts */
+  offs += gl2psPDFgroupListWriteFontResources();
+  
+  /* End resources and page */
+  offs += fprintf(gl2ps->stream,
+                  ">>\n"
+                  ">>\n"
+                  "endobj\n");
+  return offs;
+}
+
+/* Standard Graphics State */
+
+static int gl2psPrintPDFGSObject(void)
+{
+  return fprintf(gl2ps->stream,
+                 "7 0 obj\n"
+                 "<<\n"
+                 "/Type /ExtGState\n"
+                 "/SA false\n"
+                 "/SM 0.02\n"
+                 "/OP false\n"
+                 "/op false\n"
+                 "/OPM 0\n"
+                 "/BG2 /Default\n"
+                 "/UCR2 /Default\n"
+                 "/TR2 /Default\n"
+                 ">>\n"
+                 "endobj\n");
+}
+
+/* Put vertex' edge flag (8bit) and coordinates (32bit) in shader stream */
+
+static int gl2psPrintPDFShaderStreamDataCoord(GL2PSvertex *vertex, 
+                                              size_t (*action)(unsigned long data, 
+                                                               size_t size), 
+                                              GLfloat dx, GLfloat dy, 
+                                              GLfloat xmin, GLfloat ymin)
+{
+  int offs = 0;
+  unsigned long imap;
+  GLfloat diff;
+  double dmax = ~1UL;
+  char edgeflag = 0;
+
+  /* FIXME: temp bux fix for 64 bit archs: */
+  if(sizeof(unsigned long) == 8) dmax = dmax - 2048.;
+
+  offs += (*action)(edgeflag, 1);
+
+  /* The Shader stream in PDF requires to be in a 'big-endian'
+     order */
+    
+  if(GL2PS_ZERO(dx * dy)){
+    offs += (*action)(0, 4);
+    offs += (*action)(0, 4);
+  }
+  else{
+    diff = (vertex->xyz[0] - xmin) / dx;
+    if(diff > 1)
+      diff = 1.0F;
+    else if(diff < 0)
+      diff = 0.0F;
+    imap = (unsigned long)(diff * dmax);
+    offs += (*action)(imap, 4);
+      
+    diff = (vertex->xyz[1] - ymin) / dy;
+    if(diff > 1)
+      diff = 1.0F;
+    else if(diff < 0)
+      diff = 0.0F;
+    imap = (unsigned long)(diff * dmax);
+    offs += (*action)(imap, 4);
+  }
+  
+  return offs;
+}
+
+/* Put vertex' rgb value (8bit for every component) in shader stream */
+
+static int gl2psPrintPDFShaderStreamDataRGB(GL2PSvertex *vertex,
+                                            size_t (*action)(unsigned long data, 
+                                                             size_t size))
+{
+  int offs = 0;
+  unsigned long imap;
+  double dmax = ~1UL;
+
+  /* FIXME: temp bux fix for 64 bit archs: */
+  if(sizeof(unsigned long) == 8) dmax = dmax - 2048.;
+
+  imap = (unsigned long)((vertex->rgba[0]) * dmax);
+  offs += (*action)(imap, 1);
+    
+  imap = (unsigned long)((vertex->rgba[1]) * dmax);
+  offs += (*action)(imap, 1);
+    
+  imap = (unsigned long)((vertex->rgba[2]) * dmax);
+  offs += (*action)(imap, 1);
+  
+  return offs;
+}
+
+/* Put vertex' alpha (8/16bit) in shader stream */
+
+static int gl2psPrintPDFShaderStreamDataAlpha(GL2PSvertex *vertex, 
+                                              size_t (*action)(unsigned long data, 
+                                                               size_t size),
+                                              int sigbyte)
+{
+  int offs = 0;
+  unsigned long imap;
+  double dmax = ~1UL;
+
+  /* FIXME: temp bux fix for 64 bit archs: */
+  if(sizeof(unsigned long) == 8) dmax = dmax - 2048.;
+
+  if(sigbyte != 8 && sigbyte != 16)
+    sigbyte = 8;
+        
+  sigbyte /= 8;
+  
+  imap = (unsigned long)((vertex->rgba[3]) * dmax);
+  
+  offs += (*action)(imap, sigbyte);
+  
+  return offs;
+}
+
+/* Put a triangles raw data in shader stream */
+
+static int gl2psPrintPDFShaderStreamData(GL2PStriangle *triangle, 
+                                         GLfloat dx, GLfloat dy, 
+                                         GLfloat xmin, GLfloat ymin,
+                                         size_t (*action)(unsigned long data, 
+                                                          size_t size),
+                                         int gray)
+{
+  int i, offs = 0;
+  GL2PSvertex v;
+  
+  if(gray && gray != 8 && gray != 16)
+    gray = 8;
+  
+  for(i = 0; i < 3; ++i){
+    offs += gl2psPrintPDFShaderStreamDataCoord(&triangle->vertex[i], action,
+                                               dx, dy, xmin, ymin);
+    if(gray){ 
+      v = triangle->vertex[i];
+      offs += gl2psPrintPDFShaderStreamDataAlpha(&v, action, gray); 
+    }
+    else{
+      offs += gl2psPrintPDFShaderStreamDataRGB(&triangle->vertex[i], action);
+    }
+  }
+  
+  return offs;
+}
+
+static void gl2psPDFRectHull(GLfloat *xmin, GLfloat *xmax, 
+                             GLfloat *ymin, GLfloat *ymax, 
+                             GL2PStriangle *triangles, int cnt)
+{
+  int i, j;
+
+  *xmin = triangles[0].vertex[0].xyz[0];
+  *xmax = triangles[0].vertex[0].xyz[0];
+  *ymin = triangles[0].vertex[0].xyz[1];
+  *ymax = triangles[0].vertex[0].xyz[1];
+  
+  for(i = 0; i < cnt; ++i){
+    for(j = 0; j < 3; ++j){
+      if(*xmin > triangles[i].vertex[j].xyz[0])
+        *xmin = triangles[i].vertex[j].xyz[0];
+      if(*xmax < triangles[i].vertex[j].xyz[0])
+        *xmax = triangles[i].vertex[j].xyz[0];
+      if(*ymin > triangles[i].vertex[j].xyz[1])
+        *ymin = triangles[i].vertex[j].xyz[1];
+      if(*ymax < triangles[i].vertex[j].xyz[1])
+        *ymax = triangles[i].vertex[j].xyz[1];
+    }
+  }
+}
+
+/* Writes shaded triangle 
+   gray == 0 means write RGB triangles
+   gray == 8             8bit-grayscale (for alpha masks)
+   gray == 16            16bit-grayscale (for alpha masks) */
+
+static int gl2psPrintPDFShader(int obj, GL2PStriangle *triangles, 
+                               int size, int gray)
+{
+  int i, offs = 0, vertexbytes, done = 0;
+  GLfloat xmin, xmax, ymin, ymax;
+        
+  switch(gray){
+  case 0:
+    vertexbytes = 1+4+4+1+1+1;
+    break;
+  case 8:
+    vertexbytes = 1+4+4+1;
+    break;
+  case 16:
+    vertexbytes = 1+4+4+2;
+    break;
+  default:
+    gray = 8;
+    vertexbytes = 1+4+4+1;
+    break;
+  }
+  
+  gl2psPDFRectHull(&xmin, &xmax, &ymin, &ymax, triangles, size);
+  
+  offs += fprintf(gl2ps->stream,
+                  "%d 0 obj\n"
+                  "<< "
+                  "/ShadingType 4 "
+                  "/ColorSpace %s "
+                  "/BitsPerCoordinate 32 "
+                  "/BitsPerComponent %d "
+                  "/BitsPerFlag 8 "
+                  "/Decode [%f %f %f %f 0 1 %s] ",
+                  obj,
+                  (gray) ? "/DeviceGray" : "/DeviceRGB", 
+                  (gray) ? gray : 8,
+                  xmin, xmax, ymin, ymax,
+                  (gray) ? "" : "0 1 0 1");
+  
+#if defined(GL2PS_HAVE_ZLIB)
+  if(gl2ps->options & GL2PS_COMPRESS){
+    gl2psAllocCompress(vertexbytes * size * 3);
+
+    for(i = 0; i < size; ++i)
+      gl2psPrintPDFShaderStreamData(&triangles[i],
+                                    xmax-xmin, ymax-ymin, xmin, ymin, 
+                                    gl2psWriteBigEndianCompress, gray);
+
+    if(Z_OK == gl2psDeflate() && 23 + gl2ps->compress->destLen < gl2ps->compress->srcLen){
+      offs += gl2psPrintPDFCompressorType();
+      offs += fprintf(gl2ps->stream,
+                      "/Length %d "
+                      ">>\n"
+                      "stream\n",
+                      (int)gl2ps->compress->destLen);
+      offs += gl2ps->compress->destLen * fwrite(gl2ps->compress->dest, 
+                                                gl2ps->compress->destLen, 
+                                                1, gl2ps->stream);
+      done = 1;
+    }
+    gl2psFreeCompress();
+  }
+#endif
+
+  if(!done){
+    /* no compression, or too long after compression, or compress error
+       -> write non-compressed entry */
+    offs += fprintf(gl2ps->stream,
+                    "/Length %d "
+                    ">>\n"
+                    "stream\n",
+                    vertexbytes * 3 * size);
+    for(i = 0; i < size; ++i)
+      offs += gl2psPrintPDFShaderStreamData(&triangles[i],
+                                            xmax-xmin, ymax-ymin, xmin, ymin,
+                                            gl2psWriteBigEndian, gray);
+  }
+  
+  offs += fprintf(gl2ps->stream,
+                  "\nendstream\n"
+                  "endobj\n");
+  
+  return offs;
+}
+
+/* Writes a XObject for a shaded triangle mask */
+
+static int gl2psPrintPDFShaderMask(int obj, int childobj)
+{
+  int offs = 0, len;
+  
+  offs += fprintf(gl2ps->stream,
+                  "%d 0 obj\n"
+                  "<<\n"
+                  "/Type /XObject\n"
+                  "/Subtype /Form\n"
+                  "/BBox [ %d %d %d %d ]\n"
+                  "/Group \n<<\n/S /Transparency /CS /DeviceRGB\n"
+                  ">>\n",
+                  obj,
+                  (int)gl2ps->viewport[0], (int)gl2ps->viewport[1],
+                  (int)gl2ps->viewport[2], (int)gl2ps->viewport[3]);
+  
+  len = (childobj>0) 
+    ? strlen("/TrSh sh\n") + (int)log10((double)childobj)+1
+    : strlen("/TrSh0 sh\n"); 
+  
+  offs += fprintf(gl2ps->stream,
+                  "/Length %d\n"
+                  ">>\n"
+                  "stream\n",
+                  len);
+  offs += fprintf(gl2ps->stream,
+                  "/TrSh%d sh\n",
+                  childobj);
+  offs += fprintf(gl2ps->stream,
+                  "endstream\n"
+                  "endobj\n");
+  
+  return offs;
+}
+
+/* Writes a Extended graphics state for a shaded triangle mask if
+   simplealpha ist true the childobj argument is ignored and a /ca
+   statement will be written instead */
+
+static int gl2psPrintPDFShaderExtGS(int obj, int childobj)
+{
+  int offs = 0;
+  
+  offs += fprintf(gl2ps->stream,
+                  "%d 0 obj\n"
+                  "<<\n",
+                  obj);
+  
+  offs += fprintf(gl2ps->stream,
+                  "/SMask << /S /Alpha /G %d 0 R >> ",
+                  childobj);
+  
+  offs += fprintf(gl2ps->stream,
+                  ">>\n"
+                  "endobj\n");
+  return offs;
+}
+
+/* a simple graphics state */
+
+static int gl2psPrintPDFShaderSimpleExtGS(int obj, GLfloat alpha)
+{
+  int offs = 0;
+  
+  offs += fprintf(gl2ps->stream,
+                  "%d 0 obj\n"
+                  "<<\n"
+                  "/ca %g"
+                  ">>\n"
+                  "endobj\n",
+                  obj, alpha);
+  return offs;
+}
+
+/* Similar groups of functions for pixmaps and text */
+
+static int gl2psPrintPDFPixmapStreamData(GL2PSimage *im,
+                                         size_t (*action)(unsigned long data, 
+                                                          size_t size), 
+                                         int gray)
+{
+  int x, y;
+  GLfloat r, g, b, a;
+
+  if(im->format != GL_RGBA && gray)
+    return 0;
+
+  if(gray && gray !=8 && gray != 16)
+    gray = 8;
+
+  gray /= 8;
+  
+  for(y = 0; y < im->height; ++y){
+    for(x = 0; x < im->width; ++x){
+      a = gl2psGetRGB(im, x, y, &r, &g, &b);
+      if(im->format == GL_RGBA && gray){
+        (*action)((unsigned long)(a*255) << 24, gray);
+      }
+      else{
+        (*action)((unsigned long)(r*255) << 24, 1);
+        (*action)((unsigned long)(g*255) << 24, 1);
+        (*action)((unsigned long)(b*255) << 24, 1);
+      }
+    }
+  }
+
+  switch(gray){
+  case 0: return 3 * im->width * im->height;
+  case 1: return im->width * im->height;
+  case 2: return 2 * im->width * im->height;
+  default: return 3 * im->width * im->height;
+  }
+}
+
+static int gl2psPrintPDFPixmap(int obj, int childobj, GL2PSimage *im, int gray)
+{
+  int offs = 0, done = 0, sigbytes = 3;
+
+  if(gray && gray !=8 && gray != 16)
+    gray = 8;
+  
+  if(gray)
+    sigbytes = gray / 8; 
+  
+  offs += fprintf(gl2ps->stream,
+                  "%d 0 obj\n"
+                  "<<\n"
+                  "/Type /XObject\n"
+                  "/Subtype /Image\n"
+                  "/Width %d\n"
+                  "/Height %d\n"
+                  "/ColorSpace %s \n"
+                  "/BitsPerComponent 8\n",
+                  obj,
+                  (int)im->width, (int)im->height,
+                  (gray) ? "/DeviceGray" : "/DeviceRGB" );
+  if(GL_RGBA == im->format && gray == 0){
+    offs += fprintf(gl2ps->stream,
+                    "/SMask %d 0 R\n",
+                    childobj);
+  }
+  
+#if defined(GL2PS_HAVE_ZLIB)
+  if(gl2ps->options & GL2PS_COMPRESS){
+    gl2psAllocCompress((int)(im->width * im->height * sigbytes));
+    
+    gl2psPrintPDFPixmapStreamData(im, gl2psWriteBigEndianCompress, gray);
+    
+    if(Z_OK == gl2psDeflate() && 23 + gl2ps->compress->destLen < gl2ps->compress->srcLen){
+      offs += gl2psPrintPDFCompressorType();
+      offs += fprintf(gl2ps->stream,
+                      "/Length %d "
+                      ">>\n"
+                      "stream\n",
+                      (int)gl2ps->compress->destLen);
+      offs += gl2ps->compress->destLen * fwrite(gl2ps->compress->dest, gl2ps->compress->destLen,
+                                                1, gl2ps->stream);
+      done = 1;
+    }
+    gl2psFreeCompress();
+  }
+#endif
+  
+  if(!done){
+    /* no compression, or too long after compression, or compress error
+       -> write non-compressed entry */
+    offs += fprintf(gl2ps->stream,
+                    "/Length %d "
+                    ">>\n"
+                    "stream\n",
+                    (int)(im->width * im->height * sigbytes));
+    offs += gl2psPrintPDFPixmapStreamData(im, gl2psWriteBigEndian, gray);
+  }
+  
+  offs += fprintf(gl2ps->stream,
+                  "\nendstream\n"
+                  "endobj\n");
+  
+  return offs;
+}
+
+static int gl2psPrintPDFText(int obj, GL2PSstring *s, int fontnumber)
+{
+  int offs = 0;
+  
+  offs += fprintf(gl2ps->stream,
+                  "%d 0 obj\n"
+                  "<<\n"
+                  "/Type /Font\n"
+                  "/Subtype /Type1\n"
+                  "/Name /F%d\n"
+                  "/BaseFont /%s\n"
+                  "/Encoding /MacRomanEncoding\n"
+                  ">>\n"
+                  "endobj\n",
+                  obj, fontnumber, s->fontname);
+  return offs;
+}
+
+/* Write the physical objects */
+
+static int gl2psPDFgroupListWriteObjects(int entryoffs)
+{
+  int i,j;
+  GL2PSprimitive *p = NULL;
+  GL2PSpdfgroup *gro;
+  int offs = entryoffs;
+  GL2PStriangle *triangles;
+  int size = 0;
+
+  if(!gl2ps->pdfgrouplist)
+    return offs;
+  
+  for(i = 0; i < gl2psListNbr(gl2ps->pdfgrouplist); ++i){  
+    gro = (GL2PSpdfgroup*)gl2psListPointer(gl2ps->pdfgrouplist, i); 
+    if(!gl2psListNbr(gro->ptrlist))
+      continue;
+    p = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, 0);
+    switch(p->type){
+    case GL2PS_POINT:
+      break;
+    case GL2PS_LINE:
+      break;
+    case GL2PS_TRIANGLE:
+      size = gl2psListNbr(gro->ptrlist);
+      triangles = (GL2PStriangle*)gl2psMalloc(sizeof(GL2PStriangle) * size);
+      for(j = 0; j < size; ++j){  
+        p = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, j);
+        gl2psFillTriangleFromPrimitive(&triangles[j], p, GL_TRUE);
+      }
+      if(triangles[0].prop & T_VAR_COLOR){
+        gl2ps->xreflist[gro->shobjno] = offs;
+        offs += gl2psPrintPDFShader(gro->shobjno, triangles, size, 0);
+      }
+      if(triangles[0].prop & T_ALPHA_LESS_1){
+        gl2ps->xreflist[gro->gsobjno] = offs;
+        offs += gl2psPrintPDFShaderSimpleExtGS(gro->gsobjno, triangles[0].vertex[0].rgba[3]);
+      }
+      if(triangles[0].prop & T_VAR_ALPHA){
+        gl2ps->xreflist[gro->gsobjno] = offs;
+        offs += gl2psPrintPDFShaderExtGS(gro->gsobjno, gro->trgroupobjno);
+        gl2ps->xreflist[gro->trgroupobjno] = offs;
+        offs += gl2psPrintPDFShaderMask(gro->trgroupobjno, gro->maskshno);
+        gl2ps->xreflist[gro->maskshobjno] = offs;
+        offs += gl2psPrintPDFShader(gro->maskshobjno, triangles, size, 8);
+      }
+      gl2psFree(triangles);
+      break;
+    case GL2PS_PIXMAP:
+      gl2ps->xreflist[gro->imobjno] = offs;
+      offs += gl2psPrintPDFPixmap(gro->imobjno, gro->imobjno+1, p->data.image, 0);
+      if(p->data.image->format == GL_RGBA){
+        gl2ps->xreflist[gro->imobjno+1] = offs;
+        offs += gl2psPrintPDFPixmap(gro->imobjno+1, -1, p->data.image, 8);
+      }
+      break;
+    case GL2PS_TEXT:
+      gl2ps->xreflist[gro->fontobjno] = offs;
+      offs += gl2psPrintPDFText(gro->fontobjno,p->data.text,gro->fontno);
+      break;
+    case GL2PS_SPECIAL :
+      /* alignment contains the format for which the special output text
+         is intended */
+      if(p->data.text->alignment == GL2PS_PDF)
+        offs += fprintf(gl2ps->stream, "%s\n", p->data.text->str);
+      break;
+    default:
+      break;
+    } 
+  }
+  return offs;
+}
+
+/* All variable data has been written at this point and all required
+   functioninality has been gathered, so we can write now file footer
+   with cross reference table and trailer */
+
+static void gl2psPrintPDFFooter(void)
+{
+  int i, offs;  
+
+  gl2psPDFgroupListInit();
+  gl2psPDFgroupListWriteMainStream();
+ 
+  offs = gl2ps->xreflist[5] + gl2ps->streamlength; 
+  offs += gl2psClosePDFDataStream();
+  gl2ps->xreflist[5] = offs;
+  
+  offs += gl2psPrintPDFDataStreamLength(gl2ps->streamlength);
+  gl2ps->xreflist[6] = offs;
+  gl2ps->streamlength = 0;
+  
+  offs += gl2psPrintPDFOpenPage();
+  offs += gl2psPDFgroupListWriteVariableResources();
+  gl2ps->xreflist = (int*)gl2psRealloc(gl2ps->xreflist,
+                                       sizeof(int) * (gl2ps->objects_stack + 1));
+  gl2ps->xreflist[7] = offs;
+  
+  offs += gl2psPrintPDFGSObject();
+  gl2ps->xreflist[8] = offs;
+  
+  gl2ps->xreflist[gl2ps->objects_stack] = 
+    gl2psPDFgroupListWriteObjects(gl2ps->xreflist[8]);
+
+  /* Start cross reference table. The file has to been opened in
+     binary mode to preserve the 20 digit string length! */
+  fprintf(gl2ps->stream,
+          "xref\n"
+          "0 %d\n"
+          "%010d 65535 f \n", gl2ps->objects_stack, 0);
+  
+  for(i = 1; i < gl2ps->objects_stack; ++i)
+    fprintf(gl2ps->stream, "%010d 00000 n \n", gl2ps->xreflist[i]);
+  
+  fprintf(gl2ps->stream,
+          "trailer\n"
+          "<<\n" 
+          "/Size %d\n"
+          "/Info 1 0 R\n"
+          "/Root 2 0 R\n"
+          ">>\n"
+          "startxref\n%d\n"
+          "%%%%EOF\n",
+          gl2ps->objects_stack, gl2ps->xreflist[gl2ps->objects_stack]);
+  
+  /* Free auxiliary lists and arrays */    
+  gl2psFree(gl2ps->xreflist);
+  gl2psListAction(gl2ps->pdfprimlist, gl2psFreePrimitive);
+  gl2psListDelete(gl2ps->pdfprimlist);
+  gl2psPDFgroupListDelete();
+  
+#if defined(GL2PS_HAVE_ZLIB)
+  if(gl2ps->options & GL2PS_COMPRESS){
+    gl2psFreeCompress();
+    gl2psFree(gl2ps->compress);
+    gl2ps->compress = NULL;
+  }
+#endif
+}
+
+/* PDF begin viewport */
+
+static void gl2psPrintPDFBeginViewport(GLint viewport[4])
+{
+  int offs = 0;
+  GLint index;
+  GLfloat rgba[4];
+  int x = viewport[0], y = viewport[1], w = viewport[2], h = viewport[3];
+  
+  glRenderMode(GL_FEEDBACK);
+  
+  if(gl2ps->header){
+    gl2psPrintPDFHeader();
+    gl2ps->header = GL_FALSE;
+  }
+
+  offs += gl2psPrintf("q\n");
+  
+  if(gl2ps->options & GL2PS_DRAW_BACKGROUND){
+    if(gl2ps->colormode == GL_RGBA || gl2ps->colorsize == 0){
+      glGetFloatv(GL_COLOR_CLEAR_VALUE, rgba);
+    }
+    else{
+      glGetIntegerv(GL_INDEX_CLEAR_VALUE, &index);
+      rgba[0] = gl2ps->colormap[index][0];
+      rgba[1] = gl2ps->colormap[index][1];
+      rgba[2] = gl2ps->colormap[index][2];
+      rgba[3] = 1.0F;
+    }
+    offs += gl2psPrintPDFFillColor(rgba);
+    offs += gl2psPrintf("%d %d %d %d re\n"
+                        "W\n"
+                        "f\n",
+                        x, y, w, h);
+  }
+  else{
+    offs += gl2psPrintf("%d %d %d %d re\n"
+                        "W\n"   
+                        "n\n",
+                        x, y, w, h);            
+  }
+  
+  gl2ps->streamlength += offs;
+}
+
+static GLint gl2psPrintPDFEndViewport(void)
+{
+  GLint res;
+  
+  res = gl2psPrintPrimitives();
+  gl2ps->streamlength += gl2psPrintf("Q\n");
+  return res;
+}
+
+static void gl2psPrintPDFFinalPrimitive(void)
+{
+}
+
+/* definition of the PDF backend */
+
+static GL2PSbackend gl2psPDF = {
+  gl2psPrintPDFHeader,
+  gl2psPrintPDFFooter,
+  gl2psPrintPDFBeginViewport,
+  gl2psPrintPDFEndViewport,
+  gl2psPrintPDFPrimitive,
+  gl2psPrintPDFFinalPrimitive,
+  "pdf",
+  "Portable Document Format"
+};
+
+/********************************************************************* 
+ *
+ * SVG routines
+ *
+ *********************************************************************/
+
+static void gl2psSVGGetCoordsAndColors(int n, GL2PSvertex *verts, 
+                                       GL2PSxyz *xyz, GL2PSrgba *rgba)
+{
+  int i, j;
+
+  for(i = 0; i < n; i++){
+    xyz[i][0] = verts[i].xyz[0];
+    xyz[i][1] = gl2ps->viewport[3] - verts[i].xyz[1];
+    xyz[i][2] = 0.0F;
+    for(j = 0; j < 4; j++)
+      rgba[i][j] = verts[i].rgba[j];
+  }
+}
+
+static void gl2psSVGGetColorString(GL2PSrgba rgba, char str[32])
+{
+  int r = (int)(255. * rgba[0]);
+  int g = (int)(255. * rgba[1]);
+  int b = (int)(255. * rgba[2]);
+  int rc = (r < 0) ? 0 : (r > 255) ? 255 : r;
+  int gc = (g < 0) ? 0 : (g > 255) ? 255 : g;
+  int bc = (b < 0) ? 0 : (b > 255) ? 255 : b;
+  sprintf(str, "#%2.2x%2.2x%2.2x", rc, gc, bc);
+}
+
+static void gl2psPrintSVGHeader(void)
+{
+  int x, y, width, height;
+  char col[32];
+  time_t now;
+  
+  time(&now);
+  
+  if (gl2ps->options & GL2PS_LANDSCAPE){
+    x = (int)gl2ps->viewport[1];
+    y = (int)gl2ps->viewport[0];
+    width = (int)gl2ps->viewport[3];
+    height = (int)gl2ps->viewport[2];
+  }
+  else{
+    x = (int)gl2ps->viewport[0];
+    y = (int)gl2ps->viewport[1];
+    width = (int)gl2ps->viewport[2];
+    height = (int)gl2ps->viewport[3];
+  }
+  
+  /* Compressed SVG files (.svgz) are simply gzipped SVG files */
+  gl2psPrintGzipHeader();
+  
+  gl2psPrintf("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n");
+  gl2psPrintf("<svg xmlns=\"http://www.w3.org/2000/svg\"\n");
+  gl2psPrintf("     xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n"
+              "     width=\"%dpx\" height=\"%dpx\" viewBox=\"%d %d %d %d\">\n",
+              width, height, x, y, width, height);
+  gl2psPrintf("<title>%s</title>\n", gl2ps->title);
+  gl2psPrintf("<desc>\n");
+  gl2psPrintf("Creator: GL2PS %d.%d.%d%s, %s\n"
+              "For: %s\n"
+              "CreationDate: %s",
+              GL2PS_MAJOR_VERSION, GL2PS_MINOR_VERSION, GL2PS_PATCH_VERSION,
+              GL2PS_EXTRA_VERSION, GL2PS_COPYRIGHT, gl2ps->producer, ctime(&now));
+  gl2psPrintf("</desc>\n");
+  gl2psPrintf("<defs>\n");
+  gl2psPrintf("</defs>\n");
+
+  if(gl2ps->options & GL2PS_DRAW_BACKGROUND){
+    gl2psSVGGetColorString(gl2ps->bgcolor, col);
+    gl2psPrintf("<polygon fill=\"%s\" points=\"%d,%d %d,%d %d,%d %d,%d\"/>\n", col,
+                (int)gl2ps->viewport[0], (int)gl2ps->viewport[1], 
+                (int)gl2ps->viewport[2], (int)gl2ps->viewport[1], 
+                (int)gl2ps->viewport[2], (int)gl2ps->viewport[3], 
+                (int)gl2ps->viewport[0], (int)gl2ps->viewport[3]);
+  }
+
+  /* group all the primitives and disable antialiasing */
+  gl2psPrintf("<g shape-rendering=\"crispEdges\">\n");
+}
+
+static void gl2psPrintSVGSmoothTriangle(GL2PSxyz xyz[3], GL2PSrgba rgba[3])
+{
+  int i;
+  GL2PSxyz xyz2[3];
+  GL2PSrgba rgba2[3];
+  char col[32];
+
+  /* Apparently there is no easy way to do Gouraud shading in SVG
+     without explicitly pre-defining gradients, so for now we just do
+     recursive subdivision */
+
+  if(gl2psSameColorThreshold(3, rgba, gl2ps->threshold)){
+    gl2psSVGGetColorString(rgba[0], col);
+    gl2psPrintf("<polygon fill=\"%s\" ", col);
+    if(rgba[0][3] < 1.0F) gl2psPrintf("fill-opacity=\"%g\" ", rgba[0][3]);
+    gl2psPrintf("points=\"%g,%g %g,%g %g,%g\"/>\n", xyz[0][0], xyz[0][1], 
+                xyz[1][0], xyz[1][1], xyz[2][0], xyz[2][1]);
+  }
+  else{
+    /* subdivide into 4 subtriangles */
+    for(i = 0; i < 3; i++){
+      xyz2[0][i] = xyz[0][i]; 
+      xyz2[1][i] = 0.5 * (xyz[0][i] + xyz[1][i]);
+      xyz2[2][i] = 0.5 * (xyz[0][i] + xyz[2][i]);
+    }
+    for(i = 0; i < 4; i++){
+      rgba2[0][i] = rgba[0][i]; 
+      rgba2[1][i] = 0.5 * (rgba[0][i] + rgba[1][i]);
+      rgba2[2][i] = 0.5 * (rgba[0][i] + rgba[2][i]);
+    }
+    gl2psPrintSVGSmoothTriangle(xyz2, rgba2);
+    for(i = 0; i < 3; i++){
+      xyz2[0][i] = 0.5 * (xyz[0][i] + xyz[1][i]);
+      xyz2[1][i] = xyz[1][i]; 
+      xyz2[2][i] = 0.5 * (xyz[1][i] + xyz[2][i]);
+    }
+    for(i = 0; i < 4; i++){
+      rgba2[0][i] = 0.5 * (rgba[0][i] + rgba[1][i]);
+      rgba2[1][i] = rgba[1][i]; 
+      rgba2[2][i] = 0.5 * (rgba[1][i] + rgba[2][i]);
+    }
+    gl2psPrintSVGSmoothTriangle(xyz2, rgba2);
+    for(i = 0; i < 3; i++){
+      xyz2[0][i] = 0.5 * (xyz[0][i] + xyz[2][i]);
+      xyz2[1][i] = xyz[2][i]; 
+      xyz2[2][i] = 0.5 * (xyz[1][i] + xyz[2][i]);
+    }
+    for(i = 0; i < 4; i++){
+      rgba2[0][i] = 0.5 * (rgba[0][i] + rgba[2][i]);
+      rgba2[1][i] = rgba[2][i]; 
+      rgba2[2][i] = 0.5 * (rgba[1][i] + rgba[2][i]);
+    }
+    gl2psPrintSVGSmoothTriangle(xyz2, rgba2);
+    for(i = 0; i < 3; i++){
+      xyz2[0][i] = 0.5 * (xyz[0][i] + xyz[1][i]);
+      xyz2[1][i] = 0.5 * (xyz[1][i] + xyz[2][i]); 
+      xyz2[2][i] = 0.5 * (xyz[0][i] + xyz[2][i]);
+    }
+    for(i = 0; i < 4; i++){
+      rgba2[0][i] = 0.5 * (rgba[0][i] + rgba[1][i]);
+      rgba2[1][i] = 0.5 * (rgba[1][i] + rgba[2][i]); 
+      rgba2[2][i] = 0.5 * (rgba[0][i] + rgba[2][i]);
+    }
+    gl2psPrintSVGSmoothTriangle(xyz2, rgba2);
+  }
+}
+
+static void gl2psPrintSVGDash(GLushort pattern, GLint factor)
+{
+  int i, n, array[10];
+
+  if(!pattern || !factor) return; /* solid line */
+
+  gl2psParseStipplePattern(pattern, factor, &n, array);
+  gl2psPrintf("stroke-dasharray=\"");
+  for(i = 0; i < n; i++){
+    if(i) gl2psPrintf(",");
+    gl2psPrintf("%d", array[i]);
+  }
+  gl2psPrintf("\" ");
+}
+
+static void gl2psEndSVGLine(void)
+{
+  int i;
+  if(gl2ps->lastvertex.rgba[0] >= 0.){
+    gl2psPrintf("%g,%g\"/>\n", gl2ps->lastvertex.xyz[0], 
+                gl2ps->viewport[3] - gl2ps->lastvertex.xyz[1]);
+    for(i = 0; i < 3; i++)
+      gl2ps->lastvertex.xyz[i] = -1.;
+    for(i = 0; i < 4; i++)
+      gl2ps->lastvertex.rgba[i] = -1.;
+  }
+}
+
+#if defined(GL2PS_HAVE_LIBPNG)
+static void gl2psPrintSVGPixmap(GLfloat x, GLfloat y, GL2PSimage *pixmap)
+#else
+static void gl2psPrintSVGPixmap(GLfloat, GLfloat, GL2PSimage *)
+#endif
+{
+#if defined(GL2PS_HAVE_LIBPNG)
+  GL2PSlist *png;
+  unsigned char c;
+  int i;
+
+  /* The only image types supported by the SVG standard are JPEG, PNG
+     and SVG. Here we choose PNG, and since we want to embed the image
+     directly in the SVG stream (and not link to an external image
+     file), we need to encode the pixmap into PNG in memory, then
+     encode it into base64. */
+
+  png = gl2psListCreate(pixmap->width * pixmap->height * 3, 1000, 
+                        sizeof(unsigned char));
+  gl2psConvertPixmapToPNG(pixmap, png);
+  gl2psListEncodeBase64(png);
+  gl2psPrintf("<image x=\"%g\" y=\"%g\" width=\"%d\" height=\"%d\"\n",
+              x, y - pixmap->height, pixmap->width, pixmap->height);
+  gl2psPrintf("xlink:href=\"data:image/png;base64,");
+  for(i = 0; i < gl2psListNbr(png); i++){
+    gl2psListRead(png, i, &c);
+    gl2psPrintf("%c", c);
+  }
+  gl2psPrintf("\"/>\n");
+  gl2psListDelete(png);
+#else
+  gl2psMsg(GL2PS_WARNING, "GL2PS has to be compiled with PNG support in "
+           "order to embed images in SVG streams");
+#endif
+}
+
+static void gl2psPrintSVGPrimitive(void *data)
+{
+  GL2PSprimitive *prim;
+  GL2PSxyz xyz[4];
+  GL2PSrgba rgba[4];
+  char col[32];
+  int newline;
+
+  prim = *(GL2PSprimitive**)data;
+
+  if((gl2ps->options & GL2PS_OCCLUSION_CULL) && prim->culled) return;
+
+  /* We try to draw connected lines as a single path to get nice line
+     joins and correct stippling. So if the primitive to print is not
+     a line we must first finish the current line (if any): */
+  if(prim->type != GL2PS_LINE) gl2psEndSVGLine();
+
+  gl2psSVGGetCoordsAndColors(prim->numverts, prim->verts, xyz, rgba);
+
+  switch(prim->type){
+  case GL2PS_POINT :
+    gl2psSVGGetColorString(rgba[0], col);
+    gl2psPrintf("<circle fill=\"%s\" ", col);
+    if(rgba[0][3] < 1.0F) gl2psPrintf("fill-opacity=\"%g\" ", rgba[0][3]);
+    gl2psPrintf("cx=\"%g\" cy=\"%g\" r=\"%g\"/>\n",
+                xyz[0][0], xyz[0][1], 0.5 * prim->width);
+    break;
+  case GL2PS_LINE :
+    if(!gl2psSamePosition(gl2ps->lastvertex.xyz, prim->verts[0].xyz) ||
+       !gl2psSameColor(gl2ps->lastrgba, prim->verts[0].rgba) ||
+       gl2ps->lastlinewidth != prim->width ||
+       gl2ps->lastpattern != prim->pattern ||
+       gl2ps->lastfactor != prim->factor){
+      /* End the current line if the new segment does not start where
+         the last one ended, or if the color, the width or the
+         stippling have changed (we will need to use multi-point
+         gradients for smooth-shaded lines) */
+      gl2psEndSVGLine();
+      newline = 1;
+    }
+    else{
+      newline = 0;
+    }
+    gl2ps->lastvertex = prim->verts[1];
+    gl2psSetLastColor(prim->verts[0].rgba);
+    gl2ps->lastlinewidth = prim->width;
+    gl2ps->lastpattern = prim->pattern;
+    gl2ps->lastfactor = prim->factor;
+    if(newline){
+      gl2psSVGGetColorString(rgba[0], col);
+      gl2psPrintf("<polyline fill=\"none\" stroke=\"%s\" stroke-width=\"%g\" ", 
+                  col, prim->width);
+      if(rgba[0][3] < 1.0F) gl2psPrintf("stroke-opacity=\"%g\" ", rgba[0][3]);
+      gl2psPrintSVGDash(prim->pattern, prim->factor);
+      gl2psPrintf("points=\"%g,%g ", xyz[0][0], xyz[0][1]);
+    }
+    else{
+      gl2psPrintf("%g,%g ", xyz[0][0], xyz[0][1]);
+    }
+    break;
+  case GL2PS_TRIANGLE :
+    gl2psPrintSVGSmoothTriangle(xyz, rgba);
+    break;
+  case GL2PS_QUADRANGLE :
+    gl2psMsg(GL2PS_WARNING, "There should not be any quad left to print");
+    break;
+  case GL2PS_PIXMAP :
+    gl2psPrintSVGPixmap(xyz[0][0], xyz[0][1], prim->data.image);
+    break;
+  case GL2PS_TEXT :
+    gl2psSVGGetColorString(prim->verts[0].rgba, col);
+    gl2psPrintf("<text fill=\"%s\" x=\"%g\" y=\"%g\" font-size=\"%d\" ",
+                col, xyz[0][0], xyz[0][1], prim->data.text->fontsize);
+    if(!strcmp(prim->data.text->fontname, "Times-Roman"))
+      gl2psPrintf("font-family=\"Times\">");
+    else if(!strcmp(prim->data.text->fontname, "Times-Bold"))
+      gl2psPrintf("font-family=\"Times\" font-weight=\"bold\">");
+    else if(!strcmp(prim->data.text->fontname, "Times-Italic"))
+      gl2psPrintf("font-family=\"Times\" font-style=\"italic\">");
+    else if(!strcmp(prim->data.text->fontname, "Times-BoldItalic"))
+      gl2psPrintf("font-family=\"Times\" font-style=\"italic\" font-weight=\"bold\">");
+    else if(!strcmp(prim->data.text->fontname, "Helvetica-Bold"))
+      gl2psPrintf("font-family=\"Helvetica\" font-weight=\"bold\">");
+    else if(!strcmp(prim->data.text->fontname, "Helvetica-Oblique"))
+      gl2psPrintf("font-family=\"Helvetica\" font-style=\"oblique\">");
+    else if(!strcmp(prim->data.text->fontname, "Helvetica-BoldOblique"))
+      gl2psPrintf("font-family=\"Helvetica\" font-style=\"oblique\" font-weight=\"bold\">");
+    else if(!strcmp(prim->data.text->fontname, "Courier-Bold"))
+      gl2psPrintf("font-family=\"Courier\" font-weight=\"bold\">");
+    else if(!strcmp(prim->data.text->fontname, "Courier-Oblique"))
+      gl2psPrintf("font-family=\"Courier\" font-style=\"oblique\">");
+    else if(!strcmp(prim->data.text->fontname, "Courier-BoldOblique"))
+      gl2psPrintf("font-family=\"Courier\" font-style=\"oblique\" font-weight=\"bold\">");
+    else
+      gl2psPrintf("font-family=\"%s\">", prim->data.text->fontname);
+    gl2psPrintf("%s</text>\n", prim->data.text->str);
+    break;
+  case GL2PS_SPECIAL :
+    /* alignment contains the format for which the special output text
+       is intended */
+    if(prim->data.text->alignment == GL2PS_SVG)
+      gl2psPrintf("%s\n", prim->data.text->str);
+    break;
+  default :
+    break;
+  }
+}
+
+static void gl2psPrintSVGFooter(void)
+{
+  gl2psPrintf("</g>\n");
+  gl2psPrintf("</svg>\n");  
+  
+  gl2psPrintGzipFooter();
+}
+
+static void gl2psPrintSVGBeginViewport(GLint viewport[4])
+{
+  GLint index;
+  char col[32];
+  GLfloat rgba[4];
+  int x = viewport[0], y = viewport[1], w = viewport[2], h = viewport[3];
+
+  glRenderMode(GL_FEEDBACK);
+  
+  if(gl2ps->header){
+    gl2psPrintSVGHeader();
+    gl2ps->header = GL_FALSE;
+  }
+
+  if(gl2ps->options & GL2PS_DRAW_BACKGROUND){
+    if(gl2ps->colormode == GL_RGBA || gl2ps->colorsize == 0){
+      glGetFloatv(GL_COLOR_CLEAR_VALUE, rgba);
+    }
+    else{
+      glGetIntegerv(GL_INDEX_CLEAR_VALUE, &index);
+      rgba[0] = gl2ps->colormap[index][0];
+      rgba[1] = gl2ps->colormap[index][1];
+      rgba[2] = gl2ps->colormap[index][2];
+      rgba[3] = 1.0F;
+    }
+    gl2psSVGGetColorString(rgba, col);
+    gl2psPrintf("<polygon fill=\"%s\" points=\"%d,%d %d,%d %d,%d %d,%d\"/>\n", col, 
+                x, gl2ps->viewport[3] - y, 
+                x + w, gl2ps->viewport[3] - y, 
+                x + w, gl2ps->viewport[3] - (y + h), 
+                x, gl2ps->viewport[3] - (y + h));
+  }
+
+  gl2psPrintf("<clipPath id=\"cp%d%d%d%d\">\n", x, y, w, h);
+  gl2psPrintf("  <polygon points=\"%d,%d %d,%d %d,%d %d,%d\"/>\n", 
+              x, gl2ps->viewport[3] - y, 
+              x + w, gl2ps->viewport[3] - y, 
+              x + w, gl2ps->viewport[3] - (y + h), 
+              x, gl2ps->viewport[3] - (y + h));
+  gl2psPrintf("</clipPath>\n");
+  gl2psPrintf("<g clip-path=\"url(#cp%d%d%d%d)\">\n", x, y, w, h);
+}
+
+static GLint gl2psPrintSVGEndViewport(void)
+{
+  GLint res;
+
+  res = gl2psPrintPrimitives();
+  gl2psPrintf("</g>\n");
+  return res;
+}
+
+static void gl2psPrintSVGFinalPrimitive(void)
+{
+  /* End any remaining line, if any */
+  gl2psEndSVGLine();
+}
+
+/* definition of the SVG backend */
+
+static GL2PSbackend gl2psSVG = {
+  gl2psPrintSVGHeader,
+  gl2psPrintSVGFooter,
+  gl2psPrintSVGBeginViewport,
+  gl2psPrintSVGEndViewport,
+  gl2psPrintSVGPrimitive,
+  gl2psPrintSVGFinalPrimitive,
+  "svg",
+  "Scalable Vector Graphics"
+};
+
+/*********************************************************************
+ *
+ * PGF routines
+ *
+ *********************************************************************/
+
+static void gl2psPrintPGFColor(GL2PSrgba rgba)
+{
+  if(!gl2psSameColor(gl2ps->lastrgba, rgba)){
+    gl2psSetLastColor(rgba);
+    fprintf(gl2ps->stream, "\\color[rgb]{%f,%f,%f}\n", rgba[0], rgba[1], rgba[2]);
+  }
+}
+
+static void gl2psPrintPGFHeader(void)
+{
+  time_t now;
+
+  time(&now);
+
+  fprintf(gl2ps->stream, 
+          "%% Title: %s\n"
+          "%% Creator: GL2PS %d.%d.%d%s, %s\n"
+          "%% For: %s\n"
+          "%% CreationDate: %s",
+          gl2ps->title, GL2PS_MAJOR_VERSION, GL2PS_MINOR_VERSION,
+          GL2PS_PATCH_VERSION, GL2PS_EXTRA_VERSION, GL2PS_COPYRIGHT,
+          gl2ps->producer, ctime(&now));
+
+  fprintf(gl2ps->stream, "\\begin{pgfpicture}\n");
+  if(gl2ps->options & GL2PS_DRAW_BACKGROUND){
+    gl2psPrintPGFColor(gl2ps->bgcolor);
+    fprintf(gl2ps->stream,
+            "\\pgfpathrectanglecorners{"
+            "\\pgfpoint{%dpt}{%dpt}}{\\pgfpoint{%dpt}{%dpt}}\n"
+            "\\pgfusepath{fill}\n",
+            (int)gl2ps->viewport[0], (int)gl2ps->viewport[1],
+            (int)gl2ps->viewport[2], (int)gl2ps->viewport[3]);
+  }
+}
+
+static void gl2psPrintPGFDash(GLushort pattern, GLint factor)
+{
+  int i, n, array[10];
+
+  if(pattern == gl2ps->lastpattern && factor == gl2ps->lastfactor)
+    return;
+
+  gl2ps->lastpattern = pattern;
+  gl2ps->lastfactor = factor;
+
+  if(!pattern || !factor){
+    /* solid line */
+    fprintf(gl2ps->stream, "\\pgfsetdash{}{0pt}\n");
+  }
+  else{
+    gl2psParseStipplePattern(pattern, factor, &n, array);
+    fprintf(gl2ps->stream, "\\pgfsetdash{");
+    for(i = 0; i < n; i++) fprintf(gl2ps->stream, "{%dpt}", array[i]);
+    fprintf(gl2ps->stream, "}{0pt}\n");
+  }
+}
+
+static const char *gl2psPGFTextAlignment(int align)
+{
+  switch(align){
+  case GL2PS_TEXT_C  : return "center";
+  case GL2PS_TEXT_CL : return "west";
+  case GL2PS_TEXT_CR : return "east";
+  case GL2PS_TEXT_B  : return "south";
+  case GL2PS_TEXT_BR : return "south east";
+  case GL2PS_TEXT_T  : return "north";
+  case GL2PS_TEXT_TL : return "north west";
+  case GL2PS_TEXT_TR : return "north east";
+  case GL2PS_TEXT_BL : 
+  default            : return "south west";
+  }
+}
+
+static void gl2psPrintPGFPrimitive(void *data)
+{
+  GL2PSprimitive *prim;
+
+  prim = *(GL2PSprimitive**)data;
+
+  switch(prim->type){
+  case GL2PS_POINT :
+    /* Points in openGL are rectangular */
+    gl2psPrintPGFColor(prim->verts[0].rgba);
+    fprintf(gl2ps->stream, 
+            "\\pgfpathrectangle{\\pgfpoint{%fpt}{%fpt}}"
+            "{\\pgfpoint{%fpt}{%fpt}}\n\\pgfusepath{fill}\n",
+            prim->verts[0].xyz[0]-0.5*prim->width,
+            prim->verts[0].xyz[1]-0.5*prim->width,
+            prim->width,prim->width);
+    break;
+  case GL2PS_LINE :
+    gl2psPrintPGFColor(prim->verts[0].rgba);
+    if(gl2ps->lastlinewidth != prim->width){
+      gl2ps->lastlinewidth = prim->width;
+      fprintf(gl2ps->stream, "\\pgfsetlinewidth{%fpt}\n", gl2ps->lastlinewidth);
+    }
+    gl2psPrintPGFDash(prim->pattern, prim->factor);
+    fprintf(gl2ps->stream, 
+            "\\pgfpathmoveto{\\pgfpoint{%fpt}{%fpt}}\n"
+            "\\pgflineto{\\pgfpoint{%fpt}{%fpt}}\n"
+            "\\pgfusepath{stroke}\n",
+            prim->verts[1].xyz[0], prim->verts[1].xyz[1],
+            prim->verts[0].xyz[0], prim->verts[0].xyz[1]);
+    break;
+  case GL2PS_TRIANGLE :
+    if(gl2ps->lastlinewidth != 0){
+      gl2ps->lastlinewidth = 0;
+      fprintf(gl2ps->stream, "\\pgfsetlinewidth{0.01pt}\n");
+    }
+    gl2psPrintPGFColor(prim->verts[0].rgba);
+    fprintf(gl2ps->stream, 
+            "\\pgfpathmoveto{\\pgfpoint{%fpt}{%fpt}}\n"
+            "\\pgflineto{\\pgfpoint{%fpt}{%fpt}}\n"
+            "\\pgflineto{\\pgfpoint{%fpt}{%fpt}}\n"
+            "\\pgfpathclose\n"
+            "\\pgfusepath{fill,stroke}\n",
+            prim->verts[2].xyz[0], prim->verts[2].xyz[1],
+            prim->verts[1].xyz[0], prim->verts[1].xyz[1],
+            prim->verts[0].xyz[0], prim->verts[0].xyz[1]);
+    break;
+  case GL2PS_TEXT :
+    fprintf(gl2ps->stream, "{\n\\pgftransformshift{\\pgfpoint{%fpt}{%fpt}}\n",
+            prim->verts[0].xyz[0], prim->verts[0].xyz[1]);
+
+    if(prim->data.text->angle)
+      fprintf(gl2ps->stream, "\\pgftransformrotate{%f}{", prim->data.text->angle);
+
+    fprintf(gl2ps->stream, "\\pgfnode{rectangle}{%s}{\\fontsize{%d}{0}\\selectfont",
+            gl2psPGFTextAlignment(prim->data.text->alignment),
+            prim->data.text->fontsize);
+
+    fprintf(gl2ps->stream, "\\textcolor[rgb]{%g,%g,%g}{{%s}}",
+            prim->verts[0].rgba[0], prim->verts[0].rgba[1],
+            prim->verts[0].rgba[2], prim->data.text->str);
+
+    fprintf(gl2ps->stream, "}{}{\\pgfusepath{discard}}}\n");
+    break;
+  case GL2PS_SPECIAL :
+    /* alignment contains the format for which the special output text
+       is intended */
+    if (prim->data.text->alignment == GL2PS_PGF)
+      fprintf(gl2ps->stream, "%s\n", prim->data.text->str);
+    break;
+  default :
+    break;
+  }
+}
+
+static void gl2psPrintPGFFooter(void)
+{
+  fprintf(gl2ps->stream, "\\end{pgfpicture}\n");
+}
+
+static void gl2psPrintPGFBeginViewport(GLint viewport[4])
+{
+  GLint index;
+  GLfloat rgba[4];
+  int x = viewport[0], y = viewport[1], w = viewport[2], h = viewport[3];
+
+  glRenderMode(GL_FEEDBACK);
+
+  if(gl2ps->header){
+    gl2psPrintPGFHeader();
+    gl2ps->header = GL_FALSE;
+  }
+
+  fprintf(gl2ps->stream, "\\begin{pgfscope}\n");
+  if(gl2ps->options & GL2PS_DRAW_BACKGROUND){
+    if(gl2ps->colormode == GL_RGBA || gl2ps->colorsize == 0){
+      glGetFloatv(GL_COLOR_CLEAR_VALUE, rgba);
+    }
+    else{
+      glGetIntegerv(GL_INDEX_CLEAR_VALUE, &index);
+      rgba[0] = gl2ps->colormap[index][0];
+      rgba[1] = gl2ps->colormap[index][1];
+      rgba[2] = gl2ps->colormap[index][2];
+      rgba[3] = 1.0F;
+    }
+    gl2psPrintPGFColor(rgba);
+    fprintf(gl2ps->stream, 
+            "\\pgfpathrectangle{\\pgfpoint{%dpt}{%dpt}}"
+            "{\\pgfpoint{%dpt}{%dpt}}\n"
+            "\\pgfusepath{fill}\n",
+            x, y, w, h);
+  }
+  
+  fprintf(gl2ps->stream, 
+          "\\pgfpathrectangle{\\pgfpoint{%dpt}{%dpt}}"
+          "{\\pgfpoint{%dpt}{%dpt}}\n"
+          "\\pgfusepath{clip}\n",
+          x, y, w, h);
+}
+
+static GLint gl2psPrintPGFEndViewport(void)
+{
+  GLint res;
+  res = gl2psPrintPrimitives();
+  fprintf(gl2ps->stream, "\\end{pgfscope}\n");
+  return res;
+}
+
+static void gl2psPrintPGFFinalPrimitive(void)
+{
+}
+
+/* definition of the PGF backend */
+
+static GL2PSbackend gl2psPGF = {
+  gl2psPrintPGFHeader,
+  gl2psPrintPGFFooter,
+  gl2psPrintPGFBeginViewport,
+  gl2psPrintPGFEndViewport,
+  gl2psPrintPGFPrimitive,
+  gl2psPrintPGFFinalPrimitive,
+  "tex",
+  "PGF Latex Graphics"
+};
+
+/********************************************************************* 
+ *
+ * General primitive printing routine
+ *
+ *********************************************************************/
+
+/* Warning: the ordering of the backends must match the format
+   #defines in gl2ps.h */
+
+static GL2PSbackend *gl2psbackends[] = {
+  &gl2psPS,  /* 0 */
+  &gl2psEPS, /* 1 */
+  &gl2psTEX, /* 2 */
+  &gl2psPDF, /* 3 */
+  &gl2psSVG, /* 4 */
+  &gl2psPGF  /* 5 */
+};
+
+static void gl2psComputeTightBoundingBox(void *data)
+{
+  GL2PSprimitive *prim;
+  int i;
+
+  prim = *(GL2PSprimitive**)data;
+
+  for(i = 0; i < prim->numverts; i++){
+    if(prim->verts[i].xyz[0] < gl2ps->viewport[0])
+      gl2ps->viewport[0] = (GLint)prim->verts[i].xyz[0];
+    if(prim->verts[i].xyz[0] > gl2ps->viewport[2])
+      gl2ps->viewport[2] = (GLint)(prim->verts[i].xyz[0] + 0.5F);
+    if(prim->verts[i].xyz[1] < gl2ps->viewport[1])
+      gl2ps->viewport[1] = (GLint)prim->verts[i].xyz[1];
+    if(prim->verts[i].xyz[1] > gl2ps->viewport[3])
+      gl2ps->viewport[3] = (GLint)(prim->verts[i].xyz[1] + 0.5F);
+  }
+}  
+
+static GLint gl2psPrintPrimitives(void)
+{
+  GL2PSbsptree *root;
+  GL2PSxyz eye = {0.0F, 0.0F, 100.0F * GL2PS_ZSCALE};
+  GLint used;
+
+  used = glRenderMode(GL_RENDER);
+
+  if(used < 0){
+    gl2psMsg(GL2PS_INFO, "OpenGL feedback buffer overflow");
+    return GL2PS_OVERFLOW;
+  }
+
+  if(used > 0)
+    gl2psParseFeedbackBuffer(used);
+
+  gl2psRescaleAndOffset();
+
+  if(gl2ps->header){
+    if(gl2psListNbr(gl2ps->primitives) && 
+       (gl2ps->options & GL2PS_TIGHT_BOUNDING_BOX)){
+      gl2ps->viewport[0] = gl2ps->viewport[1] = 100000;
+      gl2ps->viewport[2] = gl2ps->viewport[3] = -100000;
+      gl2psListAction(gl2ps->primitives, gl2psComputeTightBoundingBox);
+    }
+    (gl2psbackends[gl2ps->format]->printHeader)();
+    gl2ps->header = GL_FALSE;
+  }
+
+  if(!gl2psListNbr(gl2ps->primitives)){
+    /* empty feedback buffer and/or nothing else to print */
+    return GL2PS_NO_FEEDBACK;
+  }
+
+  switch(gl2ps->sort){
+  case GL2PS_NO_SORT :
+    gl2psListAction(gl2ps->primitives, gl2psbackends[gl2ps->format]->printPrimitive);
+    gl2psListAction(gl2ps->primitives, gl2psFreePrimitive);
+    /* reset the primitive list, waiting for the next viewport */
+    gl2psListReset(gl2ps->primitives);
+    break;
+  case GL2PS_SIMPLE_SORT :
+    gl2psListSort(gl2ps->primitives, gl2psCompareDepth);
+    if(gl2ps->options & GL2PS_OCCLUSION_CULL){
+      gl2psListActionInverse(gl2ps->primitives, gl2psAddInImageTree);
+      gl2psFreeBspImageTree(&gl2ps->imagetree);
+    }
+    gl2psListAction(gl2ps->primitives, gl2psbackends[gl2ps->format]->printPrimitive);
+    gl2psListAction(gl2ps->primitives, gl2psFreePrimitive);
+    /* reset the primitive list, waiting for the next viewport */
+    gl2psListReset(gl2ps->primitives);
+    break;
+  case GL2PS_BSP_SORT :
+    root = (GL2PSbsptree*)gl2psMalloc(sizeof(GL2PSbsptree));
+    gl2psBuildBspTree(root, gl2ps->primitives);
+    if(GL_TRUE == gl2ps->boundary) gl2psBuildPolygonBoundary(root);
+    if(gl2ps->options & GL2PS_OCCLUSION_CULL){
+      gl2psTraverseBspTree(root, eye, -GL2PS_EPSILON, gl2psLess,
+                           gl2psAddInImageTree, 1);
+      gl2psFreeBspImageTree(&gl2ps->imagetree);
+    }
+    gl2psTraverseBspTree(root, eye, GL2PS_EPSILON, gl2psGreater, 
+                         gl2psbackends[gl2ps->format]->printPrimitive, 0);
+    gl2psFreeBspTree(&root);
+    /* reallocate the primitive list (it's been deleted by
+       gl2psBuildBspTree) in case there is another viewport */
+    gl2ps->primitives = gl2psListCreate(500, 500, sizeof(GL2PSprimitive*));
+    break;
+  }
+  gl2psbackends[gl2ps->format]->printFinalPrimitive();
+
+  return GL2PS_SUCCESS;
+}
+
+/********************************************************************* 
+ *
+ * Public routines
+ *
+ *********************************************************************/
+
+GL2PSDLL_API GLint gl2psBeginPage(const char *title, const char *producer, 
+                                  GLint viewport[4], GLint format, GLint sort,
+                                  GLint options, GLint colormode,
+                                  GLint colorsize, GL2PSrgba *colormap,
+                                  GLint nr, GLint ng, GLint nb, GLint buffersize,
+                                  FILE *stream, const char *filename)
+{
+  GLint index;
+  int i;
+
+  if(gl2ps){
+    gl2psMsg(GL2PS_ERROR, "gl2psBeginPage called in wrong program state");
+    return GL2PS_ERROR;
+  }
+
+  gl2ps = (GL2PScontext*)gl2psMalloc(sizeof(GL2PScontext));
+
+  if(format >= 0 && format < (GLint)(sizeof(gl2psbackends) / sizeof(gl2psbackends[0]))){
+    gl2ps->format = format;
+  }
+  else {
+    gl2psMsg(GL2PS_ERROR, "Unknown output format: %d", format);
+    gl2psFree(gl2ps);
+    gl2ps = NULL;
+    return GL2PS_ERROR;
+  }
+
+  switch(sort){
+  case GL2PS_NO_SORT :
+  case GL2PS_SIMPLE_SORT :
+  case GL2PS_BSP_SORT :
+    gl2ps->sort = sort;
+    break;
+  default :
+    gl2psMsg(GL2PS_ERROR, "Unknown sorting algorithm: %d", sort);
+    gl2psFree(gl2ps);
+    gl2ps = NULL;
+    return GL2PS_ERROR;
+  }
+
+  if(stream){
+    gl2ps->stream = stream;
+  }
+  else{
+    gl2psMsg(GL2PS_ERROR, "Bad file pointer");
+    gl2psFree(gl2ps);
+    gl2ps = NULL;
+    return GL2PS_ERROR;
+  }
+
+  gl2ps->header = GL_TRUE;
+  gl2ps->maxbestroot = 10;
+  gl2ps->options = options;
+  gl2ps->compress = NULL;
+  gl2ps->imagemap_head = NULL;
+  gl2ps->imagemap_tail = NULL;
+
+  if(gl2ps->options & GL2PS_USE_CURRENT_VIEWPORT){
+    glGetIntegerv(GL_VIEWPORT, gl2ps->viewport);
+  }
+  else{
+    for(i = 0; i < 4; i++){
+      gl2ps->viewport[i] = viewport[i];
+    }
+  }
+
+  if(!gl2ps->viewport[2] || !gl2ps->viewport[3]){
+    gl2psMsg(GL2PS_ERROR, "Incorrect viewport (x=%d, y=%d, width=%d, height=%d)",
+             gl2ps->viewport[0], gl2ps->viewport[1], 
+             gl2ps->viewport[2], gl2ps->viewport[3]);
+    gl2psFree(gl2ps);
+    gl2ps = NULL;
+    return GL2PS_ERROR;
+  }
+
+  gl2ps->threshold[0] = nr ? 1.0F / (GLfloat)nr : 0.064F;
+  gl2ps->threshold[1] = ng ? 1.0F / (GLfloat)ng : 0.034F;
+  gl2ps->threshold[2] = nb ? 1.0F / (GLfloat)nb : 0.100F;
+  gl2ps->colormode = colormode;
+  gl2ps->buffersize = buffersize > 0 ? buffersize : 2048 * 2048;
+  for(i = 0; i < 3; i++){
+    gl2ps->lastvertex.xyz[i] = -1.0F;
+  }
+  for(i = 0; i < 4; i++){
+    gl2ps->lastvertex.rgba[i] = -1.0F;
+    gl2ps->lastrgba[i] = -1.0F;
+  }
+  gl2ps->lastlinewidth = -1.0F;
+  gl2ps->lastpattern = 0;
+  gl2ps->lastfactor = 0;
+  gl2ps->imagetree = NULL;
+  gl2ps->primitivetoadd = NULL;
+  gl2ps->zerosurfacearea = GL_FALSE;  
+  gl2ps->pdfprimlist = NULL;
+  gl2ps->pdfgrouplist = NULL;
+  gl2ps->xreflist = NULL;
+  
+  /* get default blending mode from current OpenGL state (enabled by
+     default for SVG) */
+  gl2ps->blending = (gl2ps->format == GL2PS_SVG) ? GL_TRUE : glIsEnabled(GL_BLEND);
+  glGetIntegerv(GL_BLEND_SRC, &gl2ps->blendfunc[0]);
+  glGetIntegerv(GL_BLEND_DST, &gl2ps->blendfunc[1]);
+
+  if(gl2ps->colormode == GL_RGBA){
+    gl2ps->colorsize = 0;
+    gl2ps->colormap = NULL;
+    glGetFloatv(GL_COLOR_CLEAR_VALUE, gl2ps->bgcolor);
+  }
+  else if(gl2ps->colormode == GL_COLOR_INDEX){
+    if(!colorsize || !colormap){
+      gl2psMsg(GL2PS_ERROR, "Missing colormap for GL_COLOR_INDEX rendering");
+      gl2psFree(gl2ps);
+      gl2ps = NULL;
+      return GL2PS_ERROR;
+    }
+    gl2ps->colorsize = colorsize;
+    gl2ps->colormap = (GL2PSrgba*)gl2psMalloc(gl2ps->colorsize * sizeof(GL2PSrgba));
+    memcpy(gl2ps->colormap, colormap, gl2ps->colorsize * sizeof(GL2PSrgba));
+    glGetIntegerv(GL_INDEX_CLEAR_VALUE, &index);
+    gl2ps->bgcolor[0] = gl2ps->colormap[index][0];
+    gl2ps->bgcolor[1] = gl2ps->colormap[index][1];
+    gl2ps->bgcolor[2] = gl2ps->colormap[index][2];
+    gl2ps->bgcolor[3] = 1.0F;
+  }
+  else{
+    gl2psMsg(GL2PS_ERROR, "Unknown color mode in gl2psBeginPage");
+    gl2psFree(gl2ps);
+    gl2ps = NULL;
+    return GL2PS_ERROR;
+  }
+
+  if(!title){
+    gl2ps->title = (char*)gl2psMalloc(sizeof(char));
+    gl2ps->title[0] = '\0';
+  }
+  else{
+    gl2ps->title = (char*)gl2psMalloc((strlen(title)+1)*sizeof(char));
+    strcpy(gl2ps->title, title);
+  }
+    
+  if(!producer){
+    gl2ps->producer = (char*)gl2psMalloc(sizeof(char));
+    gl2ps->producer[0] = '\0';
+  }
+  else{
+    gl2ps->producer = (char*)gl2psMalloc((strlen(producer)+1)*sizeof(char));
+    strcpy(gl2ps->producer, producer);
+  }
+  
+  if(!filename){
+    gl2ps->filename = (char*)gl2psMalloc(sizeof(char));
+    gl2ps->filename[0] = '\0';
+  }
+  else{
+    gl2ps->filename = (char*)gl2psMalloc((strlen(filename)+1)*sizeof(char));
+    strcpy(gl2ps->filename, filename);
+  }
+
+  gl2ps->primitives = gl2psListCreate(500, 500, sizeof(GL2PSprimitive*));
+  gl2ps->auxprimitives = gl2psListCreate(100, 100, sizeof(GL2PSprimitive*));
+  gl2ps->feedback = (GLfloat*)gl2psMalloc(gl2ps->buffersize * sizeof(GLfloat));
+  glFeedbackBuffer(gl2ps->buffersize, GL_3D_COLOR, gl2ps->feedback);
+  glRenderMode(GL_FEEDBACK);  
+
+  return GL2PS_SUCCESS;
+}
+
+GL2PSDLL_API GLint gl2psEndPage(void)
+{
+  GLint res;
+
+  if(!gl2ps) return GL2PS_UNINITIALIZED;
+
+  res = gl2psPrintPrimitives();
+
+  if(res != GL2PS_OVERFLOW)
+    (gl2psbackends[gl2ps->format]->printFooter)();
+  
+  fflush(gl2ps->stream);
+
+  gl2psListDelete(gl2ps->primitives);
+  gl2psListDelete(gl2ps->auxprimitives);
+  gl2psFreeImagemap(gl2ps->imagemap_head);
+  gl2psFree(gl2ps->colormap);
+  gl2psFree(gl2ps->title);
+  gl2psFree(gl2ps->producer);
+  gl2psFree(gl2ps->filename);
+  gl2psFree(gl2ps->feedback);
+  gl2psFree(gl2ps);
+  gl2ps = NULL;
+
+  return res;
+}
+
+GL2PSDLL_API GLint gl2psBeginViewport(GLint viewport[4])
+{
+  if(!gl2ps) return GL2PS_UNINITIALIZED;
+
+  (gl2psbackends[gl2ps->format]->beginViewport)(viewport);
+  
+  return GL2PS_SUCCESS;
+}
+
+GL2PSDLL_API GLint gl2psEndViewport(void)
+{
+  GLint res;
+
+  if(!gl2ps) return GL2PS_UNINITIALIZED;
+
+  res = (gl2psbackends[gl2ps->format]->endViewport)();
+
+  /* reset last used colors, line widths */
+  gl2ps->lastlinewidth = -1.0F;
+
+  return res;
+}
+
+GL2PSDLL_API GLint gl2psTextOpt(const char *str, const char *fontname, 
+                                GLshort fontsize, GLint alignment, GLfloat angle)
+{
+  return gl2psAddText(GL2PS_TEXT, str, fontname, fontsize, alignment, angle);
+}
+
+GL2PSDLL_API GLint gl2psText(const char *str, const char *fontname, GLshort fontsize)
+{
+  return gl2psAddText(GL2PS_TEXT, str, fontname, fontsize, GL2PS_TEXT_BL, 0.0F);
+}
+
+GL2PSDLL_API GLint gl2psSpecial(GLint format, const char *str)
+{
+  return gl2psAddText(GL2PS_SPECIAL, str, "", 0, format, 0.0F);
+}
+
+GL2PSDLL_API GLint gl2psDrawPixels(GLsizei width, GLsizei height,
+                                   GLint xorig, GLint yorig,
+                                   GLenum format, GLenum type, 
+                                   const void *pixels)
+{
+  int size, i;
+  GLfloat pos[4], *piv;
+  GL2PSprimitive *prim;
+  GLboolean valid;
+
+  if(!gl2ps || !pixels) return GL2PS_UNINITIALIZED;
+
+  if((width <= 0) || (height <= 0)) return GL2PS_ERROR;
+
+  if(gl2ps->options & GL2PS_NO_PIXMAP) return GL2PS_SUCCESS;
+
+  if((format != GL_RGB && format != GL_RGBA) || type != GL_FLOAT){
+    gl2psMsg(GL2PS_ERROR, "gl2psDrawPixels only implemented for "
+             "GL_RGB/GL_RGBA, GL_FLOAT pixels");
+    return GL2PS_ERROR;
+  }
+
+  glGetBooleanv(GL_CURRENT_RASTER_POSITION_VALID, &valid);
+  if(GL_FALSE == valid) return GL2PS_SUCCESS; /* the primitive is culled */
+
+  glGetFloatv(GL_CURRENT_RASTER_POSITION, pos);
+
+  prim = (GL2PSprimitive*)gl2psMalloc(sizeof(GL2PSprimitive));
+  prim->type = GL2PS_PIXMAP;
+  prim->boundary = 0;
+  prim->numverts = 1;
+  prim->verts = (GL2PSvertex*)gl2psMalloc(sizeof(GL2PSvertex));
+  prim->verts[0].xyz[0] = pos[0] + xorig;
+  prim->verts[0].xyz[1] = pos[1] + yorig;
+  prim->verts[0].xyz[2] = pos[2];
+  prim->culled = 0;
+  prim->offset = 0;
+  prim->pattern = 0;
+  prim->factor = 0;
+  prim->width = 1;
+  glGetFloatv(GL_CURRENT_RASTER_COLOR, prim->verts[0].rgba);
+  prim->data.image = (GL2PSimage*)gl2psMalloc(sizeof(GL2PSimage));
+  prim->data.image->width = width;
+  prim->data.image->height = height;
+  prim->data.image->format = format;
+  prim->data.image->type = type;
+
+  switch(format){
+  case GL_RGBA:
+    if(gl2ps->options & GL2PS_NO_BLENDING || !gl2ps->blending){
+      /* special case: blending turned off */
+      prim->data.image->format = GL_RGB;
+      size = height * width * 3;
+      prim->data.image->pixels = (GLfloat*)gl2psMalloc(size * sizeof(GLfloat));
+      piv = (GLfloat*)pixels;
+      for(i = 0; i < size; ++i, ++piv){
+        prim->data.image->pixels[i] = *piv;
+        if(!((i+1)%3))
+          ++piv;
+      }   
+    }
+    else{
+      size = height * width * 4;
+      prim->data.image->pixels = (GLfloat*)gl2psMalloc(size * sizeof(GLfloat));
+      memcpy(prim->data.image->pixels, pixels, size * sizeof(GLfloat));
+    }
+    break;
+  case GL_RGB:
+  default:
+    size = height * width * 3;
+    prim->data.image->pixels = (GLfloat*)gl2psMalloc(size * sizeof(GLfloat));
+    memcpy(prim->data.image->pixels, pixels, size * sizeof(GLfloat));
+    break;
+  }
+
+  gl2psListAdd(gl2ps->auxprimitives, &prim);
+  glPassThrough(GL2PS_DRAW_PIXELS_TOKEN);
+
+  return GL2PS_SUCCESS;
+}
+
+GL2PSDLL_API GLint gl2psDrawImageMap(GLsizei width, GLsizei height,
+                                     const GLfloat position[3],
+                                     const unsigned char *imagemap){
+  int size, i;
+  int sizeoffloat = sizeof(GLfloat);
+  
+  if(!gl2ps || !imagemap) return GL2PS_UNINITIALIZED;
+
+  if((width <= 0) || (height <= 0)) return GL2PS_ERROR;
+  
+  size = height + height * ((width - 1) / 8);
+  glPassThrough(GL2PS_IMAGEMAP_TOKEN);
+  glBegin(GL_POINTS);
+  glVertex3f(position[0], position[1],position[2]);
+  glEnd();
+  glPassThrough((GLfloat)width);
+  glPassThrough((GLfloat)height);
+  for(i = 0; i < size; i += sizeoffloat){
+    float *value = (float*)imagemap;
+    glPassThrough(*value);
+    imagemap += sizeoffloat;
+  }
+  return GL2PS_SUCCESS;
+}
+
+GL2PSDLL_API GLint gl2psEnable(GLint mode)
+{
+  GLint tmp;
+
+  if(!gl2ps) return GL2PS_UNINITIALIZED;
+
+  switch(mode){
+  case GL2PS_POLYGON_OFFSET_FILL :
+    glPassThrough(GL2PS_BEGIN_OFFSET_TOKEN);
+    glGetFloatv(GL_POLYGON_OFFSET_FACTOR, &gl2ps->offset[0]);
+    glGetFloatv(GL_POLYGON_OFFSET_UNITS, &gl2ps->offset[1]);
+    break;
+  case GL2PS_POLYGON_BOUNDARY :
+    glPassThrough(GL2PS_BEGIN_BOUNDARY_TOKEN);
+    break;
+  case GL2PS_LINE_STIPPLE :
+    glPassThrough(GL2PS_BEGIN_STIPPLE_TOKEN);
+    glGetIntegerv(GL_LINE_STIPPLE_PATTERN, &tmp);
+    glPassThrough((GLfloat)tmp);
+    glGetIntegerv(GL_LINE_STIPPLE_REPEAT, &tmp);
+    glPassThrough((GLfloat)tmp);
+    break;
+  case GL2PS_BLEND :
+    glPassThrough(GL2PS_BEGIN_BLEND_TOKEN);
+    break;
+  default :
+    gl2psMsg(GL2PS_WARNING, "Unknown mode in gl2psEnable: %d", mode);
+    return GL2PS_WARNING;
+  }
+
+  return GL2PS_SUCCESS;
+}
+
+GL2PSDLL_API GLint gl2psDisable(GLint mode)
+{
+  if(!gl2ps) return GL2PS_UNINITIALIZED;
+
+  switch(mode){
+  case GL2PS_POLYGON_OFFSET_FILL :
+    glPassThrough(GL2PS_END_OFFSET_TOKEN);
+    break;
+  case GL2PS_POLYGON_BOUNDARY :
+    glPassThrough(GL2PS_END_BOUNDARY_TOKEN);
+    break;
+  case GL2PS_LINE_STIPPLE :
+    glPassThrough(GL2PS_END_STIPPLE_TOKEN);
+    break;
+  case GL2PS_BLEND :
+    glPassThrough(GL2PS_END_BLEND_TOKEN);
+    break;
+  default :
+    gl2psMsg(GL2PS_WARNING, "Unknown mode in gl2psDisable: %d", mode);
+    return GL2PS_WARNING;
+  }
+
+  return GL2PS_SUCCESS;
+}
+
+GL2PSDLL_API GLint gl2psPointSize(GLfloat value)
+{
+  if(!gl2ps) return GL2PS_UNINITIALIZED;
+
+  glPassThrough(GL2PS_POINT_SIZE_TOKEN);
+  glPassThrough(value);
+  
+  return GL2PS_SUCCESS;
+}
+
+GL2PSDLL_API GLint gl2psLineWidth(GLfloat value)
+{
+  if(!gl2ps) return GL2PS_UNINITIALIZED;
+
+  glPassThrough(GL2PS_LINE_WIDTH_TOKEN);
+  glPassThrough(value);
+
+  return GL2PS_SUCCESS;
+}
+
+GL2PSDLL_API GLint gl2psBlendFunc(GLenum sfactor, GLenum dfactor)
+{
+  if(!gl2ps) return GL2PS_UNINITIALIZED;
+
+  if(GL_FALSE == gl2psSupportedBlendMode(sfactor, dfactor))
+    return GL2PS_WARNING;
+
+  glPassThrough(GL2PS_SRC_BLEND_TOKEN);
+  glPassThrough((GLfloat)sfactor);
+  glPassThrough(GL2PS_DST_BLEND_TOKEN);
+  glPassThrough((GLfloat)dfactor);
+
+  return GL2PS_SUCCESS;
+}
+
+GL2PSDLL_API GLint gl2psSetOptions(GLint options)
+{
+  if(!gl2ps) return GL2PS_UNINITIALIZED;
+
+  gl2ps->options = options;
+
+  return GL2PS_SUCCESS;
+}
+
+GL2PSDLL_API GLint gl2psGetOptions(GLint *options)
+{
+  if(!gl2ps) {
+    *options = 0;
+    return GL2PS_UNINITIALIZED;
+  }
+
+  *options = gl2ps->options;
+
+  return GL2PS_SUCCESS;
+}
+
+GL2PSDLL_API const char *gl2psGetFileExtension(GLint format)
+{
+  if(format >= 0 && format < (GLint)(sizeof(gl2psbackends) / sizeof(gl2psbackends[0])))
+    return gl2psbackends[format]->file_extension;
+  else
+    return "Unknown format";
+}
+
+GL2PSDLL_API const char *gl2psGetFormatDescription(GLint format)
+{
+  if(format >= 0 && format < (GLint)(sizeof(gl2psbackends) / sizeof(gl2psbackends[0])))
+    return gl2psbackends[format]->description;
+  else
+    return "Unknown format";
+}
+#endif
Index: tags/visualization-10.5-before-10.6_test/externals/zlib/GNUmakefile
===================================================================
--- tags/visualization-10.5-before-10.6_test/externals/zlib/GNUmakefile	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/externals/zlib/GNUmakefile	(revision 1102)
@@ -0,0 +1,12 @@
+# $Id: GNUmakefile,v 1.1 2005/05/12 19:39:31 allison Exp $
+# -------------------------------------------------------------
+# GNUmakefile for zlib.  John Allison, 5/5/05.
+
+name := G4zlib
+
+ifndef G4INSTALL
+  G4INSTALL = ../../../..
+endif
+
+include $(G4INSTALL)/config/architecture.gmk
+include $(G4INSTALL)/config/common.gmk
Index: tags/visualization-10.5-before-10.6_test/externals/zlib/History
===================================================================
--- tags/visualization-10.5-before-10.6_test/externals/zlib/History	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/externals/zlib/History	(revision 1102)
@@ -0,0 +1,24 @@
+.$Id: History,v 1.1 2005/05/25 23:18:52 duns Exp $
+-------------------------------------------------------------------
+
+     =========================================================
+     Geant4 - an Object-Oriented Toolkit for Simulation in HEP
+     =========================================================
+
+                      Category History file
+                      ---------------------
+This file should be used by G4 developers and category coordinators
+to briefly summarize all major modifications introduced in the code
+and keep track of all category-tags.
+It DOES NOT substitute the  CVS log-message one should put at every
+committal in the CVS repository !
+
+     ----------------------------------------------------------
+     * Reverse chronological order (last date on top), please *
+     ----------------------------------------------------------
+
+History file for visualization/HepRep sub-category
+--------------------------------------------------
+25 May 2005 Mark Donszelmann (vis-zlib-V07-00-00 against geant4-07-00-ref-03)
+- zlib version 1.2.2
+
Index: tags/visualization-10.5-before-10.6_test/externals/zlib/README
===================================================================
--- tags/visualization-10.5-before-10.6_test/externals/zlib/README	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/externals/zlib/README	(revision 1102)
@@ -0,0 +1,138 @@
+Mark Donszelmann - 4 May 2005
+=============================
+Files renamed to .cc
+Removed all files for reading zlib format.
+Functions were modified to compile with C++ compiler, "type-name" rather than 
+"name { type", in:
+
+adler32.cc, compress.cc, crc32.cc, deflate.cc, trees.cc
+
+In: deflate.cc and trees.cc all strings are casted to (char*) to avoid warnings.
+=============================================================
+
+ZLIB DATA COMPRESSION LIBRARY
+
+zlib 1.2.1 is a general purpose data compression library.  All the code is
+thread safe.  The data format used by the zlib library is described by RFCs
+(Request for Comments) 1950 to 1952 in the files
+http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format)
+and rfc1952.txt (gzip format). These documents are also available in other
+formats from ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html
+
+All functions of the compression library are documented in the file zlib.h
+(volunteer to write man pages welcome, contact zlib@gzip.org). A usage example
+of the library is given in the file example.c which also tests that the library
+is working correctly. Another example is given in the file minigzip.c. The
+compression library itself is composed of all source files except example.c and
+minigzip.c.
+
+To compile all files and run the test program, follow the instructions given at
+the top of Makefile. In short "make test; make install" should work for most
+machines. For Unix: "./configure; make test; make install" For MSDOS, use one
+of the special makefiles such as Makefile.msc. For VMS, use Make_vms.com or
+descrip.mms.
+
+Questions about zlib should be sent to <zlib@gzip.org>, or to Gilles Vollant
+<info@winimage.com> for the Windows DLL version. The zlib home page is
+http://www.zlib.org or http://www.gzip.org/zlib/ Before reporting a problem,
+please check this site to verify that you have the latest version of zlib;
+otherwise get the latest version and check whether the problem still exists or
+not.
+
+PLEASE read the zlib FAQ http://www.gzip.org/zlib/zlib_faq.html before asking
+for help.
+
+Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997
+issue of  Dr. Dobb's Journal; a copy of the article is available in
+http://dogma.net/markn/articles/zlibtool/zlibtool.htm
+
+The changes made in version 1.2.1 are documented in the file ChangeLog.
+
+Unsupported third party contributions are provided in directory "contrib".
+
+A Java implementation of zlib is available in the Java Development Kit
+http://java.sun.com/j2se/1.4.2/docs/api/java/util/zip/package-summary.html
+See the zlib home page http://www.zlib.org for details.
+
+A Perl interface to zlib written by Paul Marquess <pmqs@cpan.org> is in the
+CPAN (Comprehensive Perl Archive Network) sites
+http://www.cpan.org/modules/by-module/Compress/
+
+A Python interface to zlib written by A.M. Kuchling <amk@magnet.com> is
+available in Python 1.5 and later versions, see
+http://www.python.org/doc/lib/module-zlib.html
+
+A zlib binding for TCL written by Andreas Kupries <a.kupries@westend.com> is
+availlable at http://www.oche.de/~akupries/soft/trf/trf_zip.html
+
+An experimental package to read and write files in .zip format, written on top
+of zlib by Gilles Vollant <info@winimage.com>, is available in the
+contrib/minizip directory of zlib.
+
+
+Notes for some targets:
+
+- For Windows DLL versions, please see win32/DLL_FAQ.txt
+
+- For 64-bit Irix, deflate.c must be compiled without any optimization. With
+  -O, one libpng test fails. The test works in 32 bit mode (with the -n32
+  compiler flag). The compiler bug has been reported to SGI.
+
+- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works
+  when compiled with cc.
+
+- On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is
+  necessary to get gzprintf working correctly. This is done by configure.
+
+- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with
+  other compilers. Use "make test" to check your compiler.
+
+- gzdopen is not supported on RISCOS, BEOS and by some Mac compilers.
+
+- For PalmOs, see http://palmzlib.sourceforge.net/
+
+- When building a shared, i.e. dynamic library on Mac OS X, the library must be
+  installed before testing (do "make install" before "make test"), since the
+  library location is specified in the library.
+
+
+Acknowledgments:
+
+  The deflate format used by zlib was defined by Phil Katz. The deflate
+  and zlib specifications were written by L. Peter Deutsch. Thanks to all the
+  people who reported problems and suggested various improvements in zlib;
+  they are too numerous to cite here.
+
+Copyright notice:
+
+ (C) 1995-2003 Jean-loup Gailly and Mark Adler
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+
+  Jean-loup Gailly        Mark Adler
+  jloup@gzip.org          madler@alumni.caltech.edu
+
+If you use the zlib library in a product, we would appreciate *not*
+receiving lengthy legal documents to sign. The sources are provided
+for free but without warranty of any kind.  The library has been
+entirely written by Jean-loup Gailly and Mark Adler; it does not
+include third-party code.
+
+If you redistribute modified sources, we would appreciate that you include
+in the file ChangeLog history information documenting your changes. Please
+read the FAQ for more information on the distribution of modified source
+versions.
Index: tags/visualization-10.5-before-10.6_test/externals/zlib/include/crc32.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/externals/zlib/include/crc32.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/externals/zlib/include/crc32.h	(revision 1102)
@@ -0,0 +1,441 @@
+/* crc32.h -- tables for rapid CRC calculation
+ * Generated automatically by crc32.c
+ */
+
+local const unsigned long FAR crc_table[TBLS][256] =
+{
+  {
+    0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL,
+    0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL,
+    0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL,
+    0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL,
+    0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL,
+    0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL,
+    0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL,
+    0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL,
+    0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL,
+    0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL,
+    0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL,
+    0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL,
+    0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL,
+    0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL,
+    0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL,
+    0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL,
+    0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL,
+    0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL,
+    0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL,
+    0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL,
+    0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL,
+    0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL,
+    0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL,
+    0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL,
+    0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL,
+    0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL,
+    0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL,
+    0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL,
+    0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL,
+    0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL,
+    0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL,
+    0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL,
+    0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL,
+    0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL,
+    0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL,
+    0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL,
+    0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL,
+    0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL,
+    0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL,
+    0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL,
+    0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL,
+    0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL,
+    0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL,
+    0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL,
+    0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL,
+    0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL,
+    0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL,
+    0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL,
+    0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL,
+    0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL,
+    0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL,
+    0x2d02ef8dUL
+#ifdef BYFOUR
+  },
+  {
+    0x00000000UL, 0x191b3141UL, 0x32366282UL, 0x2b2d53c3UL, 0x646cc504UL,
+    0x7d77f445UL, 0x565aa786UL, 0x4f4196c7UL, 0xc8d98a08UL, 0xd1c2bb49UL,
+    0xfaefe88aUL, 0xe3f4d9cbUL, 0xacb54f0cUL, 0xb5ae7e4dUL, 0x9e832d8eUL,
+    0x87981ccfUL, 0x4ac21251UL, 0x53d92310UL, 0x78f470d3UL, 0x61ef4192UL,
+    0x2eaed755UL, 0x37b5e614UL, 0x1c98b5d7UL, 0x05838496UL, 0x821b9859UL,
+    0x9b00a918UL, 0xb02dfadbUL, 0xa936cb9aUL, 0xe6775d5dUL, 0xff6c6c1cUL,
+    0xd4413fdfUL, 0xcd5a0e9eUL, 0x958424a2UL, 0x8c9f15e3UL, 0xa7b24620UL,
+    0xbea97761UL, 0xf1e8e1a6UL, 0xe8f3d0e7UL, 0xc3de8324UL, 0xdac5b265UL,
+    0x5d5daeaaUL, 0x44469febUL, 0x6f6bcc28UL, 0x7670fd69UL, 0x39316baeUL,
+    0x202a5aefUL, 0x0b07092cUL, 0x121c386dUL, 0xdf4636f3UL, 0xc65d07b2UL,
+    0xed705471UL, 0xf46b6530UL, 0xbb2af3f7UL, 0xa231c2b6UL, 0x891c9175UL,
+    0x9007a034UL, 0x179fbcfbUL, 0x0e848dbaUL, 0x25a9de79UL, 0x3cb2ef38UL,
+    0x73f379ffUL, 0x6ae848beUL, 0x41c51b7dUL, 0x58de2a3cUL, 0xf0794f05UL,
+    0xe9627e44UL, 0xc24f2d87UL, 0xdb541cc6UL, 0x94158a01UL, 0x8d0ebb40UL,
+    0xa623e883UL, 0xbf38d9c2UL, 0x38a0c50dUL, 0x21bbf44cUL, 0x0a96a78fUL,
+    0x138d96ceUL, 0x5ccc0009UL, 0x45d73148UL, 0x6efa628bUL, 0x77e153caUL,
+    0xbabb5d54UL, 0xa3a06c15UL, 0x888d3fd6UL, 0x91960e97UL, 0xded79850UL,
+    0xc7cca911UL, 0xece1fad2UL, 0xf5facb93UL, 0x7262d75cUL, 0x6b79e61dUL,
+    0x4054b5deUL, 0x594f849fUL, 0x160e1258UL, 0x0f152319UL, 0x243870daUL,
+    0x3d23419bUL, 0x65fd6ba7UL, 0x7ce65ae6UL, 0x57cb0925UL, 0x4ed03864UL,
+    0x0191aea3UL, 0x188a9fe2UL, 0x33a7cc21UL, 0x2abcfd60UL, 0xad24e1afUL,
+    0xb43fd0eeUL, 0x9f12832dUL, 0x8609b26cUL, 0xc94824abUL, 0xd05315eaUL,
+    0xfb7e4629UL, 0xe2657768UL, 0x2f3f79f6UL, 0x362448b7UL, 0x1d091b74UL,
+    0x04122a35UL, 0x4b53bcf2UL, 0x52488db3UL, 0x7965de70UL, 0x607eef31UL,
+    0xe7e6f3feUL, 0xfefdc2bfUL, 0xd5d0917cUL, 0xcccba03dUL, 0x838a36faUL,
+    0x9a9107bbUL, 0xb1bc5478UL, 0xa8a76539UL, 0x3b83984bUL, 0x2298a90aUL,
+    0x09b5fac9UL, 0x10aecb88UL, 0x5fef5d4fUL, 0x46f46c0eUL, 0x6dd93fcdUL,
+    0x74c20e8cUL, 0xf35a1243UL, 0xea412302UL, 0xc16c70c1UL, 0xd8774180UL,
+    0x9736d747UL, 0x8e2de606UL, 0xa500b5c5UL, 0xbc1b8484UL, 0x71418a1aUL,
+    0x685abb5bUL, 0x4377e898UL, 0x5a6cd9d9UL, 0x152d4f1eUL, 0x0c367e5fUL,
+    0x271b2d9cUL, 0x3e001cddUL, 0xb9980012UL, 0xa0833153UL, 0x8bae6290UL,
+    0x92b553d1UL, 0xddf4c516UL, 0xc4eff457UL, 0xefc2a794UL, 0xf6d996d5UL,
+    0xae07bce9UL, 0xb71c8da8UL, 0x9c31de6bUL, 0x852aef2aUL, 0xca6b79edUL,
+    0xd37048acUL, 0xf85d1b6fUL, 0xe1462a2eUL, 0x66de36e1UL, 0x7fc507a0UL,
+    0x54e85463UL, 0x4df36522UL, 0x02b2f3e5UL, 0x1ba9c2a4UL, 0x30849167UL,
+    0x299fa026UL, 0xe4c5aeb8UL, 0xfdde9ff9UL, 0xd6f3cc3aUL, 0xcfe8fd7bUL,
+    0x80a96bbcUL, 0x99b25afdUL, 0xb29f093eUL, 0xab84387fUL, 0x2c1c24b0UL,
+    0x350715f1UL, 0x1e2a4632UL, 0x07317773UL, 0x4870e1b4UL, 0x516bd0f5UL,
+    0x7a468336UL, 0x635db277UL, 0xcbfad74eUL, 0xd2e1e60fUL, 0xf9ccb5ccUL,
+    0xe0d7848dUL, 0xaf96124aUL, 0xb68d230bUL, 0x9da070c8UL, 0x84bb4189UL,
+    0x03235d46UL, 0x1a386c07UL, 0x31153fc4UL, 0x280e0e85UL, 0x674f9842UL,
+    0x7e54a903UL, 0x5579fac0UL, 0x4c62cb81UL, 0x8138c51fUL, 0x9823f45eUL,
+    0xb30ea79dUL, 0xaa1596dcUL, 0xe554001bUL, 0xfc4f315aUL, 0xd7626299UL,
+    0xce7953d8UL, 0x49e14f17UL, 0x50fa7e56UL, 0x7bd72d95UL, 0x62cc1cd4UL,
+    0x2d8d8a13UL, 0x3496bb52UL, 0x1fbbe891UL, 0x06a0d9d0UL, 0x5e7ef3ecUL,
+    0x4765c2adUL, 0x6c48916eUL, 0x7553a02fUL, 0x3a1236e8UL, 0x230907a9UL,
+    0x0824546aUL, 0x113f652bUL, 0x96a779e4UL, 0x8fbc48a5UL, 0xa4911b66UL,
+    0xbd8a2a27UL, 0xf2cbbce0UL, 0xebd08da1UL, 0xc0fdde62UL, 0xd9e6ef23UL,
+    0x14bce1bdUL, 0x0da7d0fcUL, 0x268a833fUL, 0x3f91b27eUL, 0x70d024b9UL,
+    0x69cb15f8UL, 0x42e6463bUL, 0x5bfd777aUL, 0xdc656bb5UL, 0xc57e5af4UL,
+    0xee530937UL, 0xf7483876UL, 0xb809aeb1UL, 0xa1129ff0UL, 0x8a3fcc33UL,
+    0x9324fd72UL
+  },
+  {
+    0x00000000UL, 0x01c26a37UL, 0x0384d46eUL, 0x0246be59UL, 0x0709a8dcUL,
+    0x06cbc2ebUL, 0x048d7cb2UL, 0x054f1685UL, 0x0e1351b8UL, 0x0fd13b8fUL,
+    0x0d9785d6UL, 0x0c55efe1UL, 0x091af964UL, 0x08d89353UL, 0x0a9e2d0aUL,
+    0x0b5c473dUL, 0x1c26a370UL, 0x1de4c947UL, 0x1fa2771eUL, 0x1e601d29UL,
+    0x1b2f0bacUL, 0x1aed619bUL, 0x18abdfc2UL, 0x1969b5f5UL, 0x1235f2c8UL,
+    0x13f798ffUL, 0x11b126a6UL, 0x10734c91UL, 0x153c5a14UL, 0x14fe3023UL,
+    0x16b88e7aUL, 0x177ae44dUL, 0x384d46e0UL, 0x398f2cd7UL, 0x3bc9928eUL,
+    0x3a0bf8b9UL, 0x3f44ee3cUL, 0x3e86840bUL, 0x3cc03a52UL, 0x3d025065UL,
+    0x365e1758UL, 0x379c7d6fUL, 0x35dac336UL, 0x3418a901UL, 0x3157bf84UL,
+    0x3095d5b3UL, 0x32d36beaUL, 0x331101ddUL, 0x246be590UL, 0x25a98fa7UL,
+    0x27ef31feUL, 0x262d5bc9UL, 0x23624d4cUL, 0x22a0277bUL, 0x20e69922UL,
+    0x2124f315UL, 0x2a78b428UL, 0x2bbade1fUL, 0x29fc6046UL, 0x283e0a71UL,
+    0x2d711cf4UL, 0x2cb376c3UL, 0x2ef5c89aUL, 0x2f37a2adUL, 0x709a8dc0UL,
+    0x7158e7f7UL, 0x731e59aeUL, 0x72dc3399UL, 0x7793251cUL, 0x76514f2bUL,
+    0x7417f172UL, 0x75d59b45UL, 0x7e89dc78UL, 0x7f4bb64fUL, 0x7d0d0816UL,
+    0x7ccf6221UL, 0x798074a4UL, 0x78421e93UL, 0x7a04a0caUL, 0x7bc6cafdUL,
+    0x6cbc2eb0UL, 0x6d7e4487UL, 0x6f38fadeUL, 0x6efa90e9UL, 0x6bb5866cUL,
+    0x6a77ec5bUL, 0x68315202UL, 0x69f33835UL, 0x62af7f08UL, 0x636d153fUL,
+    0x612bab66UL, 0x60e9c151UL, 0x65a6d7d4UL, 0x6464bde3UL, 0x662203baUL,
+    0x67e0698dUL, 0x48d7cb20UL, 0x4915a117UL, 0x4b531f4eUL, 0x4a917579UL,
+    0x4fde63fcUL, 0x4e1c09cbUL, 0x4c5ab792UL, 0x4d98dda5UL, 0x46c49a98UL,
+    0x4706f0afUL, 0x45404ef6UL, 0x448224c1UL, 0x41cd3244UL, 0x400f5873UL,
+    0x4249e62aUL, 0x438b8c1dUL, 0x54f16850UL, 0x55330267UL, 0x5775bc3eUL,
+    0x56b7d609UL, 0x53f8c08cUL, 0x523aaabbUL, 0x507c14e2UL, 0x51be7ed5UL,
+    0x5ae239e8UL, 0x5b2053dfUL, 0x5966ed86UL, 0x58a487b1UL, 0x5deb9134UL,
+    0x5c29fb03UL, 0x5e6f455aUL, 0x5fad2f6dUL, 0xe1351b80UL, 0xe0f771b7UL,
+    0xe2b1cfeeUL, 0xe373a5d9UL, 0xe63cb35cUL, 0xe7fed96bUL, 0xe5b86732UL,
+    0xe47a0d05UL, 0xef264a38UL, 0xeee4200fUL, 0xeca29e56UL, 0xed60f461UL,
+    0xe82fe2e4UL, 0xe9ed88d3UL, 0xebab368aUL, 0xea695cbdUL, 0xfd13b8f0UL,
+    0xfcd1d2c7UL, 0xfe976c9eUL, 0xff5506a9UL, 0xfa1a102cUL, 0xfbd87a1bUL,
+    0xf99ec442UL, 0xf85cae75UL, 0xf300e948UL, 0xf2c2837fUL, 0xf0843d26UL,
+    0xf1465711UL, 0xf4094194UL, 0xf5cb2ba3UL, 0xf78d95faUL, 0xf64fffcdUL,
+    0xd9785d60UL, 0xd8ba3757UL, 0xdafc890eUL, 0xdb3ee339UL, 0xde71f5bcUL,
+    0xdfb39f8bUL, 0xddf521d2UL, 0xdc374be5UL, 0xd76b0cd8UL, 0xd6a966efUL,
+    0xd4efd8b6UL, 0xd52db281UL, 0xd062a404UL, 0xd1a0ce33UL, 0xd3e6706aUL,
+    0xd2241a5dUL, 0xc55efe10UL, 0xc49c9427UL, 0xc6da2a7eUL, 0xc7184049UL,
+    0xc25756ccUL, 0xc3953cfbUL, 0xc1d382a2UL, 0xc011e895UL, 0xcb4dafa8UL,
+    0xca8fc59fUL, 0xc8c97bc6UL, 0xc90b11f1UL, 0xcc440774UL, 0xcd866d43UL,
+    0xcfc0d31aUL, 0xce02b92dUL, 0x91af9640UL, 0x906dfc77UL, 0x922b422eUL,
+    0x93e92819UL, 0x96a63e9cUL, 0x976454abUL, 0x9522eaf2UL, 0x94e080c5UL,
+    0x9fbcc7f8UL, 0x9e7eadcfUL, 0x9c381396UL, 0x9dfa79a1UL, 0x98b56f24UL,
+    0x99770513UL, 0x9b31bb4aUL, 0x9af3d17dUL, 0x8d893530UL, 0x8c4b5f07UL,
+    0x8e0de15eUL, 0x8fcf8b69UL, 0x8a809decUL, 0x8b42f7dbUL, 0x89044982UL,
+    0x88c623b5UL, 0x839a6488UL, 0x82580ebfUL, 0x801eb0e6UL, 0x81dcdad1UL,
+    0x8493cc54UL, 0x8551a663UL, 0x8717183aUL, 0x86d5720dUL, 0xa9e2d0a0UL,
+    0xa820ba97UL, 0xaa6604ceUL, 0xaba46ef9UL, 0xaeeb787cUL, 0xaf29124bUL,
+    0xad6fac12UL, 0xacadc625UL, 0xa7f18118UL, 0xa633eb2fUL, 0xa4755576UL,
+    0xa5b73f41UL, 0xa0f829c4UL, 0xa13a43f3UL, 0xa37cfdaaUL, 0xa2be979dUL,
+    0xb5c473d0UL, 0xb40619e7UL, 0xb640a7beUL, 0xb782cd89UL, 0xb2cddb0cUL,
+    0xb30fb13bUL, 0xb1490f62UL, 0xb08b6555UL, 0xbbd72268UL, 0xba15485fUL,
+    0xb853f606UL, 0xb9919c31UL, 0xbcde8ab4UL, 0xbd1ce083UL, 0xbf5a5edaUL,
+    0xbe9834edUL
+  },
+  {
+    0x00000000UL, 0xb8bc6765UL, 0xaa09c88bUL, 0x12b5afeeUL, 0x8f629757UL,
+    0x37def032UL, 0x256b5fdcUL, 0x9dd738b9UL, 0xc5b428efUL, 0x7d084f8aUL,
+    0x6fbde064UL, 0xd7018701UL, 0x4ad6bfb8UL, 0xf26ad8ddUL, 0xe0df7733UL,
+    0x58631056UL, 0x5019579fUL, 0xe8a530faUL, 0xfa109f14UL, 0x42acf871UL,
+    0xdf7bc0c8UL, 0x67c7a7adUL, 0x75720843UL, 0xcdce6f26UL, 0x95ad7f70UL,
+    0x2d111815UL, 0x3fa4b7fbUL, 0x8718d09eUL, 0x1acfe827UL, 0xa2738f42UL,
+    0xb0c620acUL, 0x087a47c9UL, 0xa032af3eUL, 0x188ec85bUL, 0x0a3b67b5UL,
+    0xb28700d0UL, 0x2f503869UL, 0x97ec5f0cUL, 0x8559f0e2UL, 0x3de59787UL,
+    0x658687d1UL, 0xdd3ae0b4UL, 0xcf8f4f5aUL, 0x7733283fUL, 0xeae41086UL,
+    0x525877e3UL, 0x40edd80dUL, 0xf851bf68UL, 0xf02bf8a1UL, 0x48979fc4UL,
+    0x5a22302aUL, 0xe29e574fUL, 0x7f496ff6UL, 0xc7f50893UL, 0xd540a77dUL,
+    0x6dfcc018UL, 0x359fd04eUL, 0x8d23b72bUL, 0x9f9618c5UL, 0x272a7fa0UL,
+    0xbafd4719UL, 0x0241207cUL, 0x10f48f92UL, 0xa848e8f7UL, 0x9b14583dUL,
+    0x23a83f58UL, 0x311d90b6UL, 0x89a1f7d3UL, 0x1476cf6aUL, 0xaccaa80fUL,
+    0xbe7f07e1UL, 0x06c36084UL, 0x5ea070d2UL, 0xe61c17b7UL, 0xf4a9b859UL,
+    0x4c15df3cUL, 0xd1c2e785UL, 0x697e80e0UL, 0x7bcb2f0eUL, 0xc377486bUL,
+    0xcb0d0fa2UL, 0x73b168c7UL, 0x6104c729UL, 0xd9b8a04cUL, 0x446f98f5UL,
+    0xfcd3ff90UL, 0xee66507eUL, 0x56da371bUL, 0x0eb9274dUL, 0xb6054028UL,
+    0xa4b0efc6UL, 0x1c0c88a3UL, 0x81dbb01aUL, 0x3967d77fUL, 0x2bd27891UL,
+    0x936e1ff4UL, 0x3b26f703UL, 0x839a9066UL, 0x912f3f88UL, 0x299358edUL,
+    0xb4446054UL, 0x0cf80731UL, 0x1e4da8dfUL, 0xa6f1cfbaUL, 0xfe92dfecUL,
+    0x462eb889UL, 0x549b1767UL, 0xec277002UL, 0x71f048bbUL, 0xc94c2fdeUL,
+    0xdbf98030UL, 0x6345e755UL, 0x6b3fa09cUL, 0xd383c7f9UL, 0xc1366817UL,
+    0x798a0f72UL, 0xe45d37cbUL, 0x5ce150aeUL, 0x4e54ff40UL, 0xf6e89825UL,
+    0xae8b8873UL, 0x1637ef16UL, 0x048240f8UL, 0xbc3e279dUL, 0x21e91f24UL,
+    0x99557841UL, 0x8be0d7afUL, 0x335cb0caUL, 0xed59b63bUL, 0x55e5d15eUL,
+    0x47507eb0UL, 0xffec19d5UL, 0x623b216cUL, 0xda874609UL, 0xc832e9e7UL,
+    0x708e8e82UL, 0x28ed9ed4UL, 0x9051f9b1UL, 0x82e4565fUL, 0x3a58313aUL,
+    0xa78f0983UL, 0x1f336ee6UL, 0x0d86c108UL, 0xb53aa66dUL, 0xbd40e1a4UL,
+    0x05fc86c1UL, 0x1749292fUL, 0xaff54e4aUL, 0x322276f3UL, 0x8a9e1196UL,
+    0x982bbe78UL, 0x2097d91dUL, 0x78f4c94bUL, 0xc048ae2eUL, 0xd2fd01c0UL,
+    0x6a4166a5UL, 0xf7965e1cUL, 0x4f2a3979UL, 0x5d9f9697UL, 0xe523f1f2UL,
+    0x4d6b1905UL, 0xf5d77e60UL, 0xe762d18eUL, 0x5fdeb6ebUL, 0xc2098e52UL,
+    0x7ab5e937UL, 0x680046d9UL, 0xd0bc21bcUL, 0x88df31eaUL, 0x3063568fUL,
+    0x22d6f961UL, 0x9a6a9e04UL, 0x07bda6bdUL, 0xbf01c1d8UL, 0xadb46e36UL,
+    0x15080953UL, 0x1d724e9aUL, 0xa5ce29ffUL, 0xb77b8611UL, 0x0fc7e174UL,
+    0x9210d9cdUL, 0x2aacbea8UL, 0x38191146UL, 0x80a57623UL, 0xd8c66675UL,
+    0x607a0110UL, 0x72cfaefeUL, 0xca73c99bUL, 0x57a4f122UL, 0xef189647UL,
+    0xfdad39a9UL, 0x45115eccUL, 0x764dee06UL, 0xcef18963UL, 0xdc44268dUL,
+    0x64f841e8UL, 0xf92f7951UL, 0x41931e34UL, 0x5326b1daUL, 0xeb9ad6bfUL,
+    0xb3f9c6e9UL, 0x0b45a18cUL, 0x19f00e62UL, 0xa14c6907UL, 0x3c9b51beUL,
+    0x842736dbUL, 0x96929935UL, 0x2e2efe50UL, 0x2654b999UL, 0x9ee8defcUL,
+    0x8c5d7112UL, 0x34e11677UL, 0xa9362eceUL, 0x118a49abUL, 0x033fe645UL,
+    0xbb838120UL, 0xe3e09176UL, 0x5b5cf613UL, 0x49e959fdUL, 0xf1553e98UL,
+    0x6c820621UL, 0xd43e6144UL, 0xc68bceaaUL, 0x7e37a9cfUL, 0xd67f4138UL,
+    0x6ec3265dUL, 0x7c7689b3UL, 0xc4caeed6UL, 0x591dd66fUL, 0xe1a1b10aUL,
+    0xf3141ee4UL, 0x4ba87981UL, 0x13cb69d7UL, 0xab770eb2UL, 0xb9c2a15cUL,
+    0x017ec639UL, 0x9ca9fe80UL, 0x241599e5UL, 0x36a0360bUL, 0x8e1c516eUL,
+    0x866616a7UL, 0x3eda71c2UL, 0x2c6fde2cUL, 0x94d3b949UL, 0x090481f0UL,
+    0xb1b8e695UL, 0xa30d497bUL, 0x1bb12e1eUL, 0x43d23e48UL, 0xfb6e592dUL,
+    0xe9dbf6c3UL, 0x516791a6UL, 0xccb0a91fUL, 0x740cce7aUL, 0x66b96194UL,
+    0xde0506f1UL
+  },
+  {
+    0x00000000UL, 0x96300777UL, 0x2c610eeeUL, 0xba510999UL, 0x19c46d07UL,
+    0x8ff46a70UL, 0x35a563e9UL, 0xa395649eUL, 0x3288db0eUL, 0xa4b8dc79UL,
+    0x1ee9d5e0UL, 0x88d9d297UL, 0x2b4cb609UL, 0xbd7cb17eUL, 0x072db8e7UL,
+    0x911dbf90UL, 0x6410b71dUL, 0xf220b06aUL, 0x4871b9f3UL, 0xde41be84UL,
+    0x7dd4da1aUL, 0xebe4dd6dUL, 0x51b5d4f4UL, 0xc785d383UL, 0x56986c13UL,
+    0xc0a86b64UL, 0x7af962fdUL, 0xecc9658aUL, 0x4f5c0114UL, 0xd96c0663UL,
+    0x633d0ffaUL, 0xf50d088dUL, 0xc8206e3bUL, 0x5e10694cUL, 0xe44160d5UL,
+    0x727167a2UL, 0xd1e4033cUL, 0x47d4044bUL, 0xfd850dd2UL, 0x6bb50aa5UL,
+    0xfaa8b535UL, 0x6c98b242UL, 0xd6c9bbdbUL, 0x40f9bcacUL, 0xe36cd832UL,
+    0x755cdf45UL, 0xcf0dd6dcUL, 0x593dd1abUL, 0xac30d926UL, 0x3a00de51UL,
+    0x8051d7c8UL, 0x1661d0bfUL, 0xb5f4b421UL, 0x23c4b356UL, 0x9995bacfUL,
+    0x0fa5bdb8UL, 0x9eb80228UL, 0x0888055fUL, 0xb2d90cc6UL, 0x24e90bb1UL,
+    0x877c6f2fUL, 0x114c6858UL, 0xab1d61c1UL, 0x3d2d66b6UL, 0x9041dc76UL,
+    0x0671db01UL, 0xbc20d298UL, 0x2a10d5efUL, 0x8985b171UL, 0x1fb5b606UL,
+    0xa5e4bf9fUL, 0x33d4b8e8UL, 0xa2c90778UL, 0x34f9000fUL, 0x8ea80996UL,
+    0x18980ee1UL, 0xbb0d6a7fUL, 0x2d3d6d08UL, 0x976c6491UL, 0x015c63e6UL,
+    0xf4516b6bUL, 0x62616c1cUL, 0xd8306585UL, 0x4e0062f2UL, 0xed95066cUL,
+    0x7ba5011bUL, 0xc1f40882UL, 0x57c40ff5UL, 0xc6d9b065UL, 0x50e9b712UL,
+    0xeab8be8bUL, 0x7c88b9fcUL, 0xdf1ddd62UL, 0x492dda15UL, 0xf37cd38cUL,
+    0x654cd4fbUL, 0x5861b24dUL, 0xce51b53aUL, 0x7400bca3UL, 0xe230bbd4UL,
+    0x41a5df4aUL, 0xd795d83dUL, 0x6dc4d1a4UL, 0xfbf4d6d3UL, 0x6ae96943UL,
+    0xfcd96e34UL, 0x468867adUL, 0xd0b860daUL, 0x732d0444UL, 0xe51d0333UL,
+    0x5f4c0aaaUL, 0xc97c0dddUL, 0x3c710550UL, 0xaa410227UL, 0x10100bbeUL,
+    0x86200cc9UL, 0x25b56857UL, 0xb3856f20UL, 0x09d466b9UL, 0x9fe461ceUL,
+    0x0ef9de5eUL, 0x98c9d929UL, 0x2298d0b0UL, 0xb4a8d7c7UL, 0x173db359UL,
+    0x810db42eUL, 0x3b5cbdb7UL, 0xad6cbac0UL, 0x2083b8edUL, 0xb6b3bf9aUL,
+    0x0ce2b603UL, 0x9ad2b174UL, 0x3947d5eaUL, 0xaf77d29dUL, 0x1526db04UL,
+    0x8316dc73UL, 0x120b63e3UL, 0x843b6494UL, 0x3e6a6d0dUL, 0xa85a6a7aUL,
+    0x0bcf0ee4UL, 0x9dff0993UL, 0x27ae000aUL, 0xb19e077dUL, 0x44930ff0UL,
+    0xd2a30887UL, 0x68f2011eUL, 0xfec20669UL, 0x5d5762f7UL, 0xcb676580UL,
+    0x71366c19UL, 0xe7066b6eUL, 0x761bd4feUL, 0xe02bd389UL, 0x5a7ada10UL,
+    0xcc4add67UL, 0x6fdfb9f9UL, 0xf9efbe8eUL, 0x43beb717UL, 0xd58eb060UL,
+    0xe8a3d6d6UL, 0x7e93d1a1UL, 0xc4c2d838UL, 0x52f2df4fUL, 0xf167bbd1UL,
+    0x6757bca6UL, 0xdd06b53fUL, 0x4b36b248UL, 0xda2b0dd8UL, 0x4c1b0aafUL,
+    0xf64a0336UL, 0x607a0441UL, 0xc3ef60dfUL, 0x55df67a8UL, 0xef8e6e31UL,
+    0x79be6946UL, 0x8cb361cbUL, 0x1a8366bcUL, 0xa0d26f25UL, 0x36e26852UL,
+    0x95770cccUL, 0x03470bbbUL, 0xb9160222UL, 0x2f260555UL, 0xbe3bbac5UL,
+    0x280bbdb2UL, 0x925ab42bUL, 0x046ab35cUL, 0xa7ffd7c2UL, 0x31cfd0b5UL,
+    0x8b9ed92cUL, 0x1daede5bUL, 0xb0c2649bUL, 0x26f263ecUL, 0x9ca36a75UL,
+    0x0a936d02UL, 0xa906099cUL, 0x3f360eebUL, 0x85670772UL, 0x13570005UL,
+    0x824abf95UL, 0x147ab8e2UL, 0xae2bb17bUL, 0x381bb60cUL, 0x9b8ed292UL,
+    0x0dbed5e5UL, 0xb7efdc7cUL, 0x21dfdb0bUL, 0xd4d2d386UL, 0x42e2d4f1UL,
+    0xf8b3dd68UL, 0x6e83da1fUL, 0xcd16be81UL, 0x5b26b9f6UL, 0xe177b06fUL,
+    0x7747b718UL, 0xe65a0888UL, 0x706a0fffUL, 0xca3b0666UL, 0x5c0b0111UL,
+    0xff9e658fUL, 0x69ae62f8UL, 0xd3ff6b61UL, 0x45cf6c16UL, 0x78e20aa0UL,
+    0xeed20dd7UL, 0x5483044eUL, 0xc2b30339UL, 0x612667a7UL, 0xf71660d0UL,
+    0x4d476949UL, 0xdb776e3eUL, 0x4a6ad1aeUL, 0xdc5ad6d9UL, 0x660bdf40UL,
+    0xf03bd837UL, 0x53aebca9UL, 0xc59ebbdeUL, 0x7fcfb247UL, 0xe9ffb530UL,
+    0x1cf2bdbdUL, 0x8ac2bacaUL, 0x3093b353UL, 0xa6a3b424UL, 0x0536d0baUL,
+    0x9306d7cdUL, 0x2957de54UL, 0xbf67d923UL, 0x2e7a66b3UL, 0xb84a61c4UL,
+    0x021b685dUL, 0x942b6f2aUL, 0x37be0bb4UL, 0xa18e0cc3UL, 0x1bdf055aUL,
+    0x8def022dUL
+  },
+  {
+    0x00000000UL, 0x41311b19UL, 0x82623632UL, 0xc3532d2bUL, 0x04c56c64UL,
+    0x45f4777dUL, 0x86a75a56UL, 0xc796414fUL, 0x088ad9c8UL, 0x49bbc2d1UL,
+    0x8ae8effaUL, 0xcbd9f4e3UL, 0x0c4fb5acUL, 0x4d7eaeb5UL, 0x8e2d839eUL,
+    0xcf1c9887UL, 0x5112c24aUL, 0x1023d953UL, 0xd370f478UL, 0x9241ef61UL,
+    0x55d7ae2eUL, 0x14e6b537UL, 0xd7b5981cUL, 0x96848305UL, 0x59981b82UL,
+    0x18a9009bUL, 0xdbfa2db0UL, 0x9acb36a9UL, 0x5d5d77e6UL, 0x1c6c6cffUL,
+    0xdf3f41d4UL, 0x9e0e5acdUL, 0xa2248495UL, 0xe3159f8cUL, 0x2046b2a7UL,
+    0x6177a9beUL, 0xa6e1e8f1UL, 0xe7d0f3e8UL, 0x2483dec3UL, 0x65b2c5daUL,
+    0xaaae5d5dUL, 0xeb9f4644UL, 0x28cc6b6fUL, 0x69fd7076UL, 0xae6b3139UL,
+    0xef5a2a20UL, 0x2c09070bUL, 0x6d381c12UL, 0xf33646dfUL, 0xb2075dc6UL,
+    0x715470edUL, 0x30656bf4UL, 0xf7f32abbUL, 0xb6c231a2UL, 0x75911c89UL,
+    0x34a00790UL, 0xfbbc9f17UL, 0xba8d840eUL, 0x79dea925UL, 0x38efb23cUL,
+    0xff79f373UL, 0xbe48e86aUL, 0x7d1bc541UL, 0x3c2ade58UL, 0x054f79f0UL,
+    0x447e62e9UL, 0x872d4fc2UL, 0xc61c54dbUL, 0x018a1594UL, 0x40bb0e8dUL,
+    0x83e823a6UL, 0xc2d938bfUL, 0x0dc5a038UL, 0x4cf4bb21UL, 0x8fa7960aUL,
+    0xce968d13UL, 0x0900cc5cUL, 0x4831d745UL, 0x8b62fa6eUL, 0xca53e177UL,
+    0x545dbbbaUL, 0x156ca0a3UL, 0xd63f8d88UL, 0x970e9691UL, 0x5098d7deUL,
+    0x11a9ccc7UL, 0xd2fae1ecUL, 0x93cbfaf5UL, 0x5cd76272UL, 0x1de6796bUL,
+    0xdeb55440UL, 0x9f844f59UL, 0x58120e16UL, 0x1923150fUL, 0xda703824UL,
+    0x9b41233dUL, 0xa76bfd65UL, 0xe65ae67cUL, 0x2509cb57UL, 0x6438d04eUL,
+    0xa3ae9101UL, 0xe29f8a18UL, 0x21cca733UL, 0x60fdbc2aUL, 0xafe124adUL,
+    0xeed03fb4UL, 0x2d83129fUL, 0x6cb20986UL, 0xab2448c9UL, 0xea1553d0UL,
+    0x29467efbUL, 0x687765e2UL, 0xf6793f2fUL, 0xb7482436UL, 0x741b091dUL,
+    0x352a1204UL, 0xf2bc534bUL, 0xb38d4852UL, 0x70de6579UL, 0x31ef7e60UL,
+    0xfef3e6e7UL, 0xbfc2fdfeUL, 0x7c91d0d5UL, 0x3da0cbccUL, 0xfa368a83UL,
+    0xbb07919aUL, 0x7854bcb1UL, 0x3965a7a8UL, 0x4b98833bUL, 0x0aa99822UL,
+    0xc9fab509UL, 0x88cbae10UL, 0x4f5def5fUL, 0x0e6cf446UL, 0xcd3fd96dUL,
+    0x8c0ec274UL, 0x43125af3UL, 0x022341eaUL, 0xc1706cc1UL, 0x804177d8UL,
+    0x47d73697UL, 0x06e62d8eUL, 0xc5b500a5UL, 0x84841bbcUL, 0x1a8a4171UL,
+    0x5bbb5a68UL, 0x98e87743UL, 0xd9d96c5aUL, 0x1e4f2d15UL, 0x5f7e360cUL,
+    0x9c2d1b27UL, 0xdd1c003eUL, 0x120098b9UL, 0x533183a0UL, 0x9062ae8bUL,
+    0xd153b592UL, 0x16c5f4ddUL, 0x57f4efc4UL, 0x94a7c2efUL, 0xd596d9f6UL,
+    0xe9bc07aeUL, 0xa88d1cb7UL, 0x6bde319cUL, 0x2aef2a85UL, 0xed796bcaUL,
+    0xac4870d3UL, 0x6f1b5df8UL, 0x2e2a46e1UL, 0xe136de66UL, 0xa007c57fUL,
+    0x6354e854UL, 0x2265f34dUL, 0xe5f3b202UL, 0xa4c2a91bUL, 0x67918430UL,
+    0x26a09f29UL, 0xb8aec5e4UL, 0xf99fdefdUL, 0x3accf3d6UL, 0x7bfde8cfUL,
+    0xbc6ba980UL, 0xfd5ab299UL, 0x3e099fb2UL, 0x7f3884abUL, 0xb0241c2cUL,
+    0xf1150735UL, 0x32462a1eUL, 0x73773107UL, 0xb4e17048UL, 0xf5d06b51UL,
+    0x3683467aUL, 0x77b25d63UL, 0x4ed7facbUL, 0x0fe6e1d2UL, 0xccb5ccf9UL,
+    0x8d84d7e0UL, 0x4a1296afUL, 0x0b238db6UL, 0xc870a09dUL, 0x8941bb84UL,
+    0x465d2303UL, 0x076c381aUL, 0xc43f1531UL, 0x850e0e28UL, 0x42984f67UL,
+    0x03a9547eUL, 0xc0fa7955UL, 0x81cb624cUL, 0x1fc53881UL, 0x5ef42398UL,
+    0x9da70eb3UL, 0xdc9615aaUL, 0x1b0054e5UL, 0x5a314ffcUL, 0x996262d7UL,
+    0xd85379ceUL, 0x174fe149UL, 0x567efa50UL, 0x952dd77bUL, 0xd41ccc62UL,
+    0x138a8d2dUL, 0x52bb9634UL, 0x91e8bb1fUL, 0xd0d9a006UL, 0xecf37e5eUL,
+    0xadc26547UL, 0x6e91486cUL, 0x2fa05375UL, 0xe836123aUL, 0xa9070923UL,
+    0x6a542408UL, 0x2b653f11UL, 0xe479a796UL, 0xa548bc8fUL, 0x661b91a4UL,
+    0x272a8abdUL, 0xe0bccbf2UL, 0xa18dd0ebUL, 0x62defdc0UL, 0x23efe6d9UL,
+    0xbde1bc14UL, 0xfcd0a70dUL, 0x3f838a26UL, 0x7eb2913fUL, 0xb924d070UL,
+    0xf815cb69UL, 0x3b46e642UL, 0x7a77fd5bUL, 0xb56b65dcUL, 0xf45a7ec5UL,
+    0x370953eeUL, 0x763848f7UL, 0xb1ae09b8UL, 0xf09f12a1UL, 0x33cc3f8aUL,
+    0x72fd2493UL
+  },
+  {
+    0x00000000UL, 0x376ac201UL, 0x6ed48403UL, 0x59be4602UL, 0xdca80907UL,
+    0xebc2cb06UL, 0xb27c8d04UL, 0x85164f05UL, 0xb851130eUL, 0x8f3bd10fUL,
+    0xd685970dUL, 0xe1ef550cUL, 0x64f91a09UL, 0x5393d808UL, 0x0a2d9e0aUL,
+    0x3d475c0bUL, 0x70a3261cUL, 0x47c9e41dUL, 0x1e77a21fUL, 0x291d601eUL,
+    0xac0b2f1bUL, 0x9b61ed1aUL, 0xc2dfab18UL, 0xf5b56919UL, 0xc8f23512UL,
+    0xff98f713UL, 0xa626b111UL, 0x914c7310UL, 0x145a3c15UL, 0x2330fe14UL,
+    0x7a8eb816UL, 0x4de47a17UL, 0xe0464d38UL, 0xd72c8f39UL, 0x8e92c93bUL,
+    0xb9f80b3aUL, 0x3cee443fUL, 0x0b84863eUL, 0x523ac03cUL, 0x6550023dUL,
+    0x58175e36UL, 0x6f7d9c37UL, 0x36c3da35UL, 0x01a91834UL, 0x84bf5731UL,
+    0xb3d59530UL, 0xea6bd332UL, 0xdd011133UL, 0x90e56b24UL, 0xa78fa925UL,
+    0xfe31ef27UL, 0xc95b2d26UL, 0x4c4d6223UL, 0x7b27a022UL, 0x2299e620UL,
+    0x15f32421UL, 0x28b4782aUL, 0x1fdeba2bUL, 0x4660fc29UL, 0x710a3e28UL,
+    0xf41c712dUL, 0xc376b32cUL, 0x9ac8f52eUL, 0xada2372fUL, 0xc08d9a70UL,
+    0xf7e75871UL, 0xae591e73UL, 0x9933dc72UL, 0x1c259377UL, 0x2b4f5176UL,
+    0x72f11774UL, 0x459bd575UL, 0x78dc897eUL, 0x4fb64b7fUL, 0x16080d7dUL,
+    0x2162cf7cUL, 0xa4748079UL, 0x931e4278UL, 0xcaa0047aUL, 0xfdcac67bUL,
+    0xb02ebc6cUL, 0x87447e6dUL, 0xdefa386fUL, 0xe990fa6eUL, 0x6c86b56bUL,
+    0x5bec776aUL, 0x02523168UL, 0x3538f369UL, 0x087faf62UL, 0x3f156d63UL,
+    0x66ab2b61UL, 0x51c1e960UL, 0xd4d7a665UL, 0xe3bd6464UL, 0xba032266UL,
+    0x8d69e067UL, 0x20cbd748UL, 0x17a11549UL, 0x4e1f534bUL, 0x7975914aUL,
+    0xfc63de4fUL, 0xcb091c4eUL, 0x92b75a4cUL, 0xa5dd984dUL, 0x989ac446UL,
+    0xaff00647UL, 0xf64e4045UL, 0xc1248244UL, 0x4432cd41UL, 0x73580f40UL,
+    0x2ae64942UL, 0x1d8c8b43UL, 0x5068f154UL, 0x67023355UL, 0x3ebc7557UL,
+    0x09d6b756UL, 0x8cc0f853UL, 0xbbaa3a52UL, 0xe2147c50UL, 0xd57ebe51UL,
+    0xe839e25aUL, 0xdf53205bUL, 0x86ed6659UL, 0xb187a458UL, 0x3491eb5dUL,
+    0x03fb295cUL, 0x5a456f5eUL, 0x6d2fad5fUL, 0x801b35e1UL, 0xb771f7e0UL,
+    0xeecfb1e2UL, 0xd9a573e3UL, 0x5cb33ce6UL, 0x6bd9fee7UL, 0x3267b8e5UL,
+    0x050d7ae4UL, 0x384a26efUL, 0x0f20e4eeUL, 0x569ea2ecUL, 0x61f460edUL,
+    0xe4e22fe8UL, 0xd388ede9UL, 0x8a36abebUL, 0xbd5c69eaUL, 0xf0b813fdUL,
+    0xc7d2d1fcUL, 0x9e6c97feUL, 0xa90655ffUL, 0x2c101afaUL, 0x1b7ad8fbUL,
+    0x42c49ef9UL, 0x75ae5cf8UL, 0x48e900f3UL, 0x7f83c2f2UL, 0x263d84f0UL,
+    0x115746f1UL, 0x944109f4UL, 0xa32bcbf5UL, 0xfa958df7UL, 0xcdff4ff6UL,
+    0x605d78d9UL, 0x5737bad8UL, 0x0e89fcdaUL, 0x39e33edbUL, 0xbcf571deUL,
+    0x8b9fb3dfUL, 0xd221f5ddUL, 0xe54b37dcUL, 0xd80c6bd7UL, 0xef66a9d6UL,
+    0xb6d8efd4UL, 0x81b22dd5UL, 0x04a462d0UL, 0x33cea0d1UL, 0x6a70e6d3UL,
+    0x5d1a24d2UL, 0x10fe5ec5UL, 0x27949cc4UL, 0x7e2adac6UL, 0x494018c7UL,
+    0xcc5657c2UL, 0xfb3c95c3UL, 0xa282d3c1UL, 0x95e811c0UL, 0xa8af4dcbUL,
+    0x9fc58fcaUL, 0xc67bc9c8UL, 0xf1110bc9UL, 0x740744ccUL, 0x436d86cdUL,
+    0x1ad3c0cfUL, 0x2db902ceUL, 0x4096af91UL, 0x77fc6d90UL, 0x2e422b92UL,
+    0x1928e993UL, 0x9c3ea696UL, 0xab546497UL, 0xf2ea2295UL, 0xc580e094UL,
+    0xf8c7bc9fUL, 0xcfad7e9eUL, 0x9613389cUL, 0xa179fa9dUL, 0x246fb598UL,
+    0x13057799UL, 0x4abb319bUL, 0x7dd1f39aUL, 0x3035898dUL, 0x075f4b8cUL,
+    0x5ee10d8eUL, 0x698bcf8fUL, 0xec9d808aUL, 0xdbf7428bUL, 0x82490489UL,
+    0xb523c688UL, 0x88649a83UL, 0xbf0e5882UL, 0xe6b01e80UL, 0xd1dadc81UL,
+    0x54cc9384UL, 0x63a65185UL, 0x3a181787UL, 0x0d72d586UL, 0xa0d0e2a9UL,
+    0x97ba20a8UL, 0xce0466aaUL, 0xf96ea4abUL, 0x7c78ebaeUL, 0x4b1229afUL,
+    0x12ac6fadUL, 0x25c6adacUL, 0x1881f1a7UL, 0x2feb33a6UL, 0x765575a4UL,
+    0x413fb7a5UL, 0xc429f8a0UL, 0xf3433aa1UL, 0xaafd7ca3UL, 0x9d97bea2UL,
+    0xd073c4b5UL, 0xe71906b4UL, 0xbea740b6UL, 0x89cd82b7UL, 0x0cdbcdb2UL,
+    0x3bb10fb3UL, 0x620f49b1UL, 0x55658bb0UL, 0x6822d7bbUL, 0x5f4815baUL,
+    0x06f653b8UL, 0x319c91b9UL, 0xb48adebcUL, 0x83e01cbdUL, 0xda5e5abfUL,
+    0xed3498beUL
+  },
+  {
+    0x00000000UL, 0x6567bcb8UL, 0x8bc809aaUL, 0xeeafb512UL, 0x5797628fUL,
+    0x32f0de37UL, 0xdc5f6b25UL, 0xb938d79dUL, 0xef28b4c5UL, 0x8a4f087dUL,
+    0x64e0bd6fUL, 0x018701d7UL, 0xb8bfd64aUL, 0xddd86af2UL, 0x3377dfe0UL,
+    0x56106358UL, 0x9f571950UL, 0xfa30a5e8UL, 0x149f10faUL, 0x71f8ac42UL,
+    0xc8c07bdfUL, 0xada7c767UL, 0x43087275UL, 0x266fcecdUL, 0x707fad95UL,
+    0x1518112dUL, 0xfbb7a43fUL, 0x9ed01887UL, 0x27e8cf1aUL, 0x428f73a2UL,
+    0xac20c6b0UL, 0xc9477a08UL, 0x3eaf32a0UL, 0x5bc88e18UL, 0xb5673b0aUL,
+    0xd00087b2UL, 0x6938502fUL, 0x0c5fec97UL, 0xe2f05985UL, 0x8797e53dUL,
+    0xd1878665UL, 0xb4e03addUL, 0x5a4f8fcfUL, 0x3f283377UL, 0x8610e4eaUL,
+    0xe3775852UL, 0x0dd8ed40UL, 0x68bf51f8UL, 0xa1f82bf0UL, 0xc49f9748UL,
+    0x2a30225aUL, 0x4f579ee2UL, 0xf66f497fUL, 0x9308f5c7UL, 0x7da740d5UL,
+    0x18c0fc6dUL, 0x4ed09f35UL, 0x2bb7238dUL, 0xc518969fUL, 0xa07f2a27UL,
+    0x1947fdbaUL, 0x7c204102UL, 0x928ff410UL, 0xf7e848a8UL, 0x3d58149bUL,
+    0x583fa823UL, 0xb6901d31UL, 0xd3f7a189UL, 0x6acf7614UL, 0x0fa8caacUL,
+    0xe1077fbeUL, 0x8460c306UL, 0xd270a05eUL, 0xb7171ce6UL, 0x59b8a9f4UL,
+    0x3cdf154cUL, 0x85e7c2d1UL, 0xe0807e69UL, 0x0e2fcb7bUL, 0x6b4877c3UL,
+    0xa20f0dcbUL, 0xc768b173UL, 0x29c70461UL, 0x4ca0b8d9UL, 0xf5986f44UL,
+    0x90ffd3fcUL, 0x7e5066eeUL, 0x1b37da56UL, 0x4d27b90eUL, 0x284005b6UL,
+    0xc6efb0a4UL, 0xa3880c1cUL, 0x1ab0db81UL, 0x7fd76739UL, 0x9178d22bUL,
+    0xf41f6e93UL, 0x03f7263bUL, 0x66909a83UL, 0x883f2f91UL, 0xed589329UL,
+    0x546044b4UL, 0x3107f80cUL, 0xdfa84d1eUL, 0xbacff1a6UL, 0xecdf92feUL,
+    0x89b82e46UL, 0x67179b54UL, 0x027027ecUL, 0xbb48f071UL, 0xde2f4cc9UL,
+    0x3080f9dbUL, 0x55e74563UL, 0x9ca03f6bUL, 0xf9c783d3UL, 0x176836c1UL,
+    0x720f8a79UL, 0xcb375de4UL, 0xae50e15cUL, 0x40ff544eUL, 0x2598e8f6UL,
+    0x73888baeUL, 0x16ef3716UL, 0xf8408204UL, 0x9d273ebcUL, 0x241fe921UL,
+    0x41785599UL, 0xafd7e08bUL, 0xcab05c33UL, 0x3bb659edUL, 0x5ed1e555UL,
+    0xb07e5047UL, 0xd519ecffUL, 0x6c213b62UL, 0x094687daUL, 0xe7e932c8UL,
+    0x828e8e70UL, 0xd49eed28UL, 0xb1f95190UL, 0x5f56e482UL, 0x3a31583aUL,
+    0x83098fa7UL, 0xe66e331fUL, 0x08c1860dUL, 0x6da63ab5UL, 0xa4e140bdUL,
+    0xc186fc05UL, 0x2f294917UL, 0x4a4ef5afUL, 0xf3762232UL, 0x96119e8aUL,
+    0x78be2b98UL, 0x1dd99720UL, 0x4bc9f478UL, 0x2eae48c0UL, 0xc001fdd2UL,
+    0xa566416aUL, 0x1c5e96f7UL, 0x79392a4fUL, 0x97969f5dUL, 0xf2f123e5UL,
+    0x05196b4dUL, 0x607ed7f5UL, 0x8ed162e7UL, 0xebb6de5fUL, 0x528e09c2UL,
+    0x37e9b57aUL, 0xd9460068UL, 0xbc21bcd0UL, 0xea31df88UL, 0x8f566330UL,
+    0x61f9d622UL, 0x049e6a9aUL, 0xbda6bd07UL, 0xd8c101bfUL, 0x366eb4adUL,
+    0x53090815UL, 0x9a4e721dUL, 0xff29cea5UL, 0x11867bb7UL, 0x74e1c70fUL,
+    0xcdd91092UL, 0xa8beac2aUL, 0x46111938UL, 0x2376a580UL, 0x7566c6d8UL,
+    0x10017a60UL, 0xfeaecf72UL, 0x9bc973caUL, 0x22f1a457UL, 0x479618efUL,
+    0xa939adfdUL, 0xcc5e1145UL, 0x06ee4d76UL, 0x6389f1ceUL, 0x8d2644dcUL,
+    0xe841f864UL, 0x51792ff9UL, 0x341e9341UL, 0xdab12653UL, 0xbfd69aebUL,
+    0xe9c6f9b3UL, 0x8ca1450bUL, 0x620ef019UL, 0x07694ca1UL, 0xbe519b3cUL,
+    0xdb362784UL, 0x35999296UL, 0x50fe2e2eUL, 0x99b95426UL, 0xfcdee89eUL,
+    0x12715d8cUL, 0x7716e134UL, 0xce2e36a9UL, 0xab498a11UL, 0x45e63f03UL,
+    0x208183bbUL, 0x7691e0e3UL, 0x13f65c5bUL, 0xfd59e949UL, 0x983e55f1UL,
+    0x2106826cUL, 0x44613ed4UL, 0xaace8bc6UL, 0xcfa9377eUL, 0x38417fd6UL,
+    0x5d26c36eUL, 0xb389767cUL, 0xd6eecac4UL, 0x6fd61d59UL, 0x0ab1a1e1UL,
+    0xe41e14f3UL, 0x8179a84bUL, 0xd769cb13UL, 0xb20e77abUL, 0x5ca1c2b9UL,
+    0x39c67e01UL, 0x80fea99cUL, 0xe5991524UL, 0x0b36a036UL, 0x6e511c8eUL,
+    0xa7166686UL, 0xc271da3eUL, 0x2cde6f2cUL, 0x49b9d394UL, 0xf0810409UL,
+    0x95e6b8b1UL, 0x7b490da3UL, 0x1e2eb11bUL, 0x483ed243UL, 0x2d596efbUL,
+    0xc3f6dbe9UL, 0xa6916751UL, 0x1fa9b0ccUL, 0x7ace0c74UL, 0x9461b966UL,
+    0xf10605deUL
+#endif
+  }
+};
Index: tags/visualization-10.5-before-10.6_test/externals/zlib/include/deflate.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/externals/zlib/include/deflate.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/externals/zlib/include/deflate.h	(revision 1102)
@@ -0,0 +1,325 @@
+/* deflate.h -- internal compression state
+ * Copyright (C) 1995-2002 Jean-loup Gailly
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* WARNING: this file should *not* be used by applications. It is
+   part of the implementation of the compression library and is
+   subject to change. Applications should only use zlib.h.
+ */
+
+/* @(#) $Id: deflate.h,v 1.1 2005/05/12 21:04:53 duns Exp $ */
+
+#ifndef DEFLATE_H
+#define DEFLATE_H
+
+#include "zutil.h"
+
+/* define NO_GZIP when compiling if you want to disable gzip header and
+   trailer creation by deflate().  NO_GZIP would be used to avoid linking in
+   the crc code when it is not needed.  For shared libraries, gzip encoding
+   should be left enabled. */
+#ifndef NO_GZIP
+#  define GZIP
+#endif
+
+/* ===========================================================================
+ * Internal compression state.
+ */
+
+#define LENGTH_CODES 29
+/* number of length codes, not counting the special END_BLOCK code */
+
+#define LITERALS  256
+/* number of literal bytes 0..255 */
+
+#define L_CODES (LITERALS+1+LENGTH_CODES)
+/* number of Literal or Length codes, including the END_BLOCK code */
+
+#define D_CODES   30
+/* number of distance codes */
+
+#define BL_CODES  19
+/* number of codes used to transfer the bit lengths */
+
+#define HEAP_SIZE (2*L_CODES+1)
+/* maximum heap size */
+
+#define MAX_BITS 15
+/* All codes must not exceed MAX_BITS bits */
+
+#define INIT_STATE    42
+#define BUSY_STATE   113
+#define FINISH_STATE 666
+/* Stream status */
+
+
+/* Data structure describing a single value and its code string. */
+typedef struct ct_data_s {
+    union {
+        ush  freq;       /* frequency count */
+        ush  code;       /* bit string */
+    } fc;
+    union {
+        ush  dad;        /* father node in Huffman tree */
+        ush  len;        /* length of bit string */
+    } dl;
+} FAR ct_data;
+
+#define Freq fc.freq
+#define Code fc.code
+#define Dad  dl.dad
+#define Len  dl.len
+
+typedef struct static_tree_desc_s  static_tree_desc;
+
+typedef struct tree_desc_s {
+    ct_data *dyn_tree;           /* the dynamic tree */
+    int     max_code;            /* largest code with non zero frequency */
+    static_tree_desc *stat_desc; /* the corresponding static tree */
+} FAR tree_desc;
+
+typedef ush Pos;
+typedef Pos FAR Posf;
+typedef unsigned IPos;
+
+/* A Pos is an index in the character window. We use short instead of int to
+ * save space in the various tables. IPos is used only for parameter passing.
+ */
+
+typedef struct internal_state {
+    z_streamp strm;      /* pointer back to this zlib stream */
+    int   status;        /* as the name implies */
+    Bytef *pending_buf;  /* output still pending */
+    ulg   pending_buf_size; /* size of pending_buf */
+    Bytef *pending_out;  /* next pending byte to output to the stream */
+    int   pending;       /* nb of bytes in the pending buffer */
+    int   wrap;          /* bit 0 true for zlib, bit 1 true for gzip */
+    Byte  method;        /* STORED (for zip only) or DEFLATED */
+    int   last_flush;    /* value of flush param for previous deflate call */
+
+                /* used by deflate.c: */
+
+    uInt  w_size;        /* LZ77 window size (32K by default) */
+    uInt  w_bits;        /* log2(w_size)  (8..16) */
+    uInt  w_mask;        /* w_size - 1 */
+
+    Bytef *window;
+    /* Sliding window. Input bytes are read into the second half of the window,
+     * and move to the first half later to keep a dictionary of at least wSize
+     * bytes. With this organization, matches are limited to a distance of
+     * wSize-MAX_MATCH bytes, but this ensures that IO is always
+     * performed with a length multiple of the block size. Also, it limits
+     * the window size to 64K, which is quite useful on MSDOS.
+     * To do: use the user input buffer as sliding window.
+     */
+
+    ulg window_size;
+    /* Actual size of window: 2*wSize, except when the user input buffer
+     * is directly used as sliding window.
+     */
+
+    Posf *prev;
+    /* Link to older string with same hash index. To limit the size of this
+     * array to 64K, this link is maintained only for the last 32K strings.
+     * An index in this array is thus a window index modulo 32K.
+     */
+
+    Posf *head; /* Heads of the hash chains or NIL. */
+
+    uInt  ins_h;          /* hash index of string to be inserted */
+    uInt  hash_size;      /* number of elements in hash table */
+    uInt  hash_bits;      /* log2(hash_size) */
+    uInt  hash_mask;      /* hash_size-1 */
+
+    uInt  hash_shift;
+    /* Number of bits by which ins_h must be shifted at each input
+     * step. It must be such that after MIN_MATCH steps, the oldest
+     * byte no longer takes part in the hash key, that is:
+     *   hash_shift * MIN_MATCH >= hash_bits
+     */
+
+    long block_start;
+    /* Window position at the beginning of the current output block. Gets
+     * negative when the window is moved backwards.
+     */
+
+    uInt match_length;           /* length of best match */
+    IPos prev_match;             /* previous match */
+    int match_available;         /* set if previous match exists */
+    uInt strstart;               /* start of string to insert */
+    uInt match_start;            /* start of matching string */
+    uInt lookahead;              /* number of valid bytes ahead in window */
+
+    uInt prev_length;
+    /* Length of the best match at previous step. Matches not greater than this
+     * are discarded. This is used in the lazy match evaluation.
+     */
+
+    uInt max_chain_length;
+    /* To speed up deflation, hash chains are never searched beyond this
+     * length.  A higher limit improves compression ratio but degrades the
+     * speed.
+     */
+
+    uInt max_lazy_match;
+    /* Attempt to find a better match only when the current match is strictly
+     * smaller than this value. This mechanism is used only for compression
+     * levels >= 4.
+     */
+#   define max_insert_length  max_lazy_match
+    /* Insert new strings in the hash table only if the match length is not
+     * greater than this length. This saves time but degrades compression.
+     * max_insert_length is used only for compression levels <= 3.
+     */
+
+    int level;    /* compression level (1..9) */
+    int strategy; /* favor or force Huffman coding*/
+
+    uInt good_match;
+    /* Use a faster search when the previous match is longer than this */
+
+    int nice_match; /* Stop searching when current match exceeds this */
+
+                /* used by trees.c: */
+    /* Didn't use ct_data typedef below to supress compiler warning */
+    struct ct_data_s dyn_ltree[HEAP_SIZE];   /* literal and length tree */
+    struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */
+    struct ct_data_s bl_tree[2*BL_CODES+1];  /* Huffman tree for bit lengths */
+
+    struct tree_desc_s l_desc;               /* desc. for literal tree */
+    struct tree_desc_s d_desc;               /* desc. for distance tree */
+    struct tree_desc_s bl_desc;              /* desc. for bit length tree */
+
+    ush bl_count[MAX_BITS+1];
+    /* number of codes at each bit length for an optimal tree */
+
+    int heap[2*L_CODES+1];      /* heap used to build the Huffman trees */
+    int heap_len;               /* number of elements in the heap */
+    int heap_max;               /* element of largest frequency */
+    /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.
+     * The same heap array is used to build all trees.
+     */
+
+    uch depth[2*L_CODES+1];
+    /* Depth of each subtree used as tie breaker for trees of equal frequency
+     */
+
+    uchf *l_buf;          /* buffer for literals or lengths */
+
+    uInt  lit_bufsize;
+    /* Size of match buffer for literals/lengths.  There are 4 reasons for
+     * limiting lit_bufsize to 64K:
+     *   - frequencies can be kept in 16 bit counters
+     *   - if compression is not successful for the first block, all input
+     *     data is still in the window so we can still emit a stored block even
+     *     when input comes from standard input.  (This can also be done for
+     *     all blocks if lit_bufsize is not greater than 32K.)
+     *   - if compression is not successful for a file smaller than 64K, we can
+     *     even emit a stored file instead of a stored block (saving 5 bytes).
+     *     This is applicable only for zip (not gzip or zlib).
+     *   - creating new Huffman trees less frequently may not provide fast
+     *     adaptation to changes in the input data statistics. (Take for
+     *     example a binary file with poorly compressible code followed by
+     *     a highly compressible string table.) Smaller buffer sizes give
+     *     fast adaptation but have of course the overhead of transmitting
+     *     trees more frequently.
+     *   - I can't count above 4
+     */
+
+    uInt last_lit;      /* running index in l_buf */
+
+    ushf *d_buf;
+    /* Buffer for distances. To simplify the code, d_buf and l_buf have
+     * the same number of elements. To use different lengths, an extra flag
+     * array would be necessary.
+     */
+
+    ulg opt_len;        /* bit length of current block with optimal trees */
+    ulg static_len;     /* bit length of current block with static trees */
+    uInt matches;       /* number of string matches in current block */
+    int last_eob_len;   /* bit length of EOB code for last block */
+
+#ifdef DEBUG
+    ulg compressed_len; /* total bit length of compressed file mod 2^32 */
+    ulg bits_sent;      /* bit length of compressed data sent mod 2^32 */
+#endif
+
+    ush bi_buf;
+    /* Output buffer. bits are inserted starting at the bottom (least
+     * significant bits).
+     */
+    int bi_valid;
+    /* Number of valid bits in bi_buf.  All bits above the last valid bit
+     * are always zero.
+     */
+
+} FAR deflate_state;
+
+/* Output a byte on the stream.
+ * IN assertion: there is enough room in pending_buf.
+ */
+#define put_byte(s, c) {s->pending_buf[s->pending++] = (c);}
+
+
+#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
+/* Minimum amount of lookahead, except at the end of the input file.
+ * See deflate.c for comments about the MIN_MATCH+1.
+ */
+
+#define MAX_DIST(s)  ((s)->w_size-MIN_LOOKAHEAD)
+/* In order to simplify the code, particularly on 16 bit machines, match
+ * distances are limited to MAX_DIST instead of WSIZE.
+ */
+
+        /* in trees.c */
+void _tr_init         OF((deflate_state *s));
+int  _tr_tally        OF((deflate_state *s, unsigned dist, unsigned lc));
+void _tr_flush_block  OF((deflate_state *s, charf *buf, ulg stored_len,
+                          int eof));
+void _tr_align        OF((deflate_state *s));
+void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len,
+                          int eof));
+
+#define d_code(dist) \
+   ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
+/* Mapping from a distance to a distance code. dist is the distance - 1 and
+ * must not have side effects. _dist_code[256] and _dist_code[257] are never
+ * used.
+ */
+
+#ifndef DEBUG
+/* Inline versions of _tr_tally for speed: */
+
+#if defined(GEN_TREES_H) || !defined(STDC)
+  extern uch _length_code[];
+  extern uch _dist_code[];
+#else
+  extern const uch _length_code[];
+  extern const uch _dist_code[];
+#endif
+
+# define _tr_tally_lit(s, c, flush) \
+  { uch cc = (c); \
+    s->d_buf[s->last_lit] = 0; \
+    s->l_buf[s->last_lit++] = cc; \
+    s->dyn_ltree[cc].Freq++; \
+    flush = (s->last_lit == s->lit_bufsize-1); \
+   }
+# define _tr_tally_dist(s, distance, length, flush) \
+  { uch len = (length); \
+    ush dist = (distance); \
+    s->d_buf[s->last_lit] = dist; \
+    s->l_buf[s->last_lit++] = len; \
+    dist--; \
+    s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
+    s->dyn_dtree[d_code(dist)].Freq++; \
+    flush = (s->last_lit == s->lit_bufsize-1); \
+  }
+#else
+# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)
+# define _tr_tally_dist(s, distance, length, flush) \
+              flush = _tr_tally(s, distance, length)
+#endif
+
+#endif /* DEFLATE_H */
Index: tags/visualization-10.5-before-10.6_test/externals/zlib/include/trees.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/externals/zlib/include/trees.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/externals/zlib/include/trees.h	(revision 1102)
@@ -0,0 +1,128 @@
+/* header created automatically with -DGEN_TREES_H */
+
+local const ct_data static_ltree[L_CODES+2] = {
+{{ 12},{  8}}, {{140},{  8}}, {{ 76},{  8}}, {{204},{  8}}, {{ 44},{  8}},
+{{172},{  8}}, {{108},{  8}}, {{236},{  8}}, {{ 28},{  8}}, {{156},{  8}},
+{{ 92},{  8}}, {{220},{  8}}, {{ 60},{  8}}, {{188},{  8}}, {{124},{  8}},
+{{252},{  8}}, {{  2},{  8}}, {{130},{  8}}, {{ 66},{  8}}, {{194},{  8}},
+{{ 34},{  8}}, {{162},{  8}}, {{ 98},{  8}}, {{226},{  8}}, {{ 18},{  8}},
+{{146},{  8}}, {{ 82},{  8}}, {{210},{  8}}, {{ 50},{  8}}, {{178},{  8}},
+{{114},{  8}}, {{242},{  8}}, {{ 10},{  8}}, {{138},{  8}}, {{ 74},{  8}},
+{{202},{  8}}, {{ 42},{  8}}, {{170},{  8}}, {{106},{  8}}, {{234},{  8}},
+{{ 26},{  8}}, {{154},{  8}}, {{ 90},{  8}}, {{218},{  8}}, {{ 58},{  8}},
+{{186},{  8}}, {{122},{  8}}, {{250},{  8}}, {{  6},{  8}}, {{134},{  8}},
+{{ 70},{  8}}, {{198},{  8}}, {{ 38},{  8}}, {{166},{  8}}, {{102},{  8}},
+{{230},{  8}}, {{ 22},{  8}}, {{150},{  8}}, {{ 86},{  8}}, {{214},{  8}},
+{{ 54},{  8}}, {{182},{  8}}, {{118},{  8}}, {{246},{  8}}, {{ 14},{  8}},
+{{142},{  8}}, {{ 78},{  8}}, {{206},{  8}}, {{ 46},{  8}}, {{174},{  8}},
+{{110},{  8}}, {{238},{  8}}, {{ 30},{  8}}, {{158},{  8}}, {{ 94},{  8}},
+{{222},{  8}}, {{ 62},{  8}}, {{190},{  8}}, {{126},{  8}}, {{254},{  8}},
+{{  1},{  8}}, {{129},{  8}}, {{ 65},{  8}}, {{193},{  8}}, {{ 33},{  8}},
+{{161},{  8}}, {{ 97},{  8}}, {{225},{  8}}, {{ 17},{  8}}, {{145},{  8}},
+{{ 81},{  8}}, {{209},{  8}}, {{ 49},{  8}}, {{177},{  8}}, {{113},{  8}},
+{{241},{  8}}, {{  9},{  8}}, {{137},{  8}}, {{ 73},{  8}}, {{201},{  8}},
+{{ 41},{  8}}, {{169},{  8}}, {{105},{  8}}, {{233},{  8}}, {{ 25},{  8}},
+{{153},{  8}}, {{ 89},{  8}}, {{217},{  8}}, {{ 57},{  8}}, {{185},{  8}},
+{{121},{  8}}, {{249},{  8}}, {{  5},{  8}}, {{133},{  8}}, {{ 69},{  8}},
+{{197},{  8}}, {{ 37},{  8}}, {{165},{  8}}, {{101},{  8}}, {{229},{  8}},
+{{ 21},{  8}}, {{149},{  8}}, {{ 85},{  8}}, {{213},{  8}}, {{ 53},{  8}},
+{{181},{  8}}, {{117},{  8}}, {{245},{  8}}, {{ 13},{  8}}, {{141},{  8}},
+{{ 77},{  8}}, {{205},{  8}}, {{ 45},{  8}}, {{173},{  8}}, {{109},{  8}},
+{{237},{  8}}, {{ 29},{  8}}, {{157},{  8}}, {{ 93},{  8}}, {{221},{  8}},
+{{ 61},{  8}}, {{189},{  8}}, {{125},{  8}}, {{253},{  8}}, {{ 19},{  9}},
+{{275},{  9}}, {{147},{  9}}, {{403},{  9}}, {{ 83},{  9}}, {{339},{  9}},
+{{211},{  9}}, {{467},{  9}}, {{ 51},{  9}}, {{307},{  9}}, {{179},{  9}},
+{{435},{  9}}, {{115},{  9}}, {{371},{  9}}, {{243},{  9}}, {{499},{  9}},
+{{ 11},{  9}}, {{267},{  9}}, {{139},{  9}}, {{395},{  9}}, {{ 75},{  9}},
+{{331},{  9}}, {{203},{  9}}, {{459},{  9}}, {{ 43},{  9}}, {{299},{  9}},
+{{171},{  9}}, {{427},{  9}}, {{107},{  9}}, {{363},{  9}}, {{235},{  9}},
+{{491},{  9}}, {{ 27},{  9}}, {{283},{  9}}, {{155},{  9}}, {{411},{  9}},
+{{ 91},{  9}}, {{347},{  9}}, {{219},{  9}}, {{475},{  9}}, {{ 59},{  9}},
+{{315},{  9}}, {{187},{  9}}, {{443},{  9}}, {{123},{  9}}, {{379},{  9}},
+{{251},{  9}}, {{507},{  9}}, {{  7},{  9}}, {{263},{  9}}, {{135},{  9}},
+{{391},{  9}}, {{ 71},{  9}}, {{327},{  9}}, {{199},{  9}}, {{455},{  9}},
+{{ 39},{  9}}, {{295},{  9}}, {{167},{  9}}, {{423},{  9}}, {{103},{  9}},
+{{359},{  9}}, {{231},{  9}}, {{487},{  9}}, {{ 23},{  9}}, {{279},{  9}},
+{{151},{  9}}, {{407},{  9}}, {{ 87},{  9}}, {{343},{  9}}, {{215},{  9}},
+{{471},{  9}}, {{ 55},{  9}}, {{311},{  9}}, {{183},{  9}}, {{439},{  9}},
+{{119},{  9}}, {{375},{  9}}, {{247},{  9}}, {{503},{  9}}, {{ 15},{  9}},
+{{271},{  9}}, {{143},{  9}}, {{399},{  9}}, {{ 79},{  9}}, {{335},{  9}},
+{{207},{  9}}, {{463},{  9}}, {{ 47},{  9}}, {{303},{  9}}, {{175},{  9}},
+{{431},{  9}}, {{111},{  9}}, {{367},{  9}}, {{239},{  9}}, {{495},{  9}},
+{{ 31},{  9}}, {{287},{  9}}, {{159},{  9}}, {{415},{  9}}, {{ 95},{  9}},
+{{351},{  9}}, {{223},{  9}}, {{479},{  9}}, {{ 63},{  9}}, {{319},{  9}},
+{{191},{  9}}, {{447},{  9}}, {{127},{  9}}, {{383},{  9}}, {{255},{  9}},
+{{511},{  9}}, {{  0},{  7}}, {{ 64},{  7}}, {{ 32},{  7}}, {{ 96},{  7}},
+{{ 16},{  7}}, {{ 80},{  7}}, {{ 48},{  7}}, {{112},{  7}}, {{  8},{  7}},
+{{ 72},{  7}}, {{ 40},{  7}}, {{104},{  7}}, {{ 24},{  7}}, {{ 88},{  7}},
+{{ 56},{  7}}, {{120},{  7}}, {{  4},{  7}}, {{ 68},{  7}}, {{ 36},{  7}},
+{{100},{  7}}, {{ 20},{  7}}, {{ 84},{  7}}, {{ 52},{  7}}, {{116},{  7}},
+{{  3},{  8}}, {{131},{  8}}, {{ 67},{  8}}, {{195},{  8}}, {{ 35},{  8}},
+{{163},{  8}}, {{ 99},{  8}}, {{227},{  8}}
+};
+
+local const ct_data static_dtree[D_CODES] = {
+{{ 0},{ 5}}, {{16},{ 5}}, {{ 8},{ 5}}, {{24},{ 5}}, {{ 4},{ 5}},
+{{20},{ 5}}, {{12},{ 5}}, {{28},{ 5}}, {{ 2},{ 5}}, {{18},{ 5}},
+{{10},{ 5}}, {{26},{ 5}}, {{ 6},{ 5}}, {{22},{ 5}}, {{14},{ 5}},
+{{30},{ 5}}, {{ 1},{ 5}}, {{17},{ 5}}, {{ 9},{ 5}}, {{25},{ 5}},
+{{ 5},{ 5}}, {{21},{ 5}}, {{13},{ 5}}, {{29},{ 5}}, {{ 3},{ 5}},
+{{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}}
+};
+
+const uch _dist_code[DIST_CODE_LEN] = {
+ 0,  1,  2,  3,  4,  4,  5,  5,  6,  6,  6,  6,  7,  7,  7,  7,  8,  8,  8,  8,
+ 8,  8,  8,  8,  9,  9,  9,  9,  9,  9,  9,  9, 10, 10, 10, 10, 10, 10, 10, 10,
+10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
+12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13,
+13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15,
+15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,  0,  0, 16, 17,
+18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22,
+23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27,
+27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
+28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
+28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
+28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
+29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
+29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
+29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29
+};
+
+const uch _length_code[MAX_MATCH-MIN_MATCH+1]= {
+ 0,  1,  2,  3,  4,  5,  6,  7,  8,  8,  9,  9, 10, 10, 11, 11, 12, 12, 12, 12,
+13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16,
+17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19,
+19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22,
+22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23,
+23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26,
+26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28
+};
+
+local const int base_length[LENGTH_CODES] = {
+0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56,
+64, 80, 96, 112, 128, 160, 192, 224, 0
+};
+
+local const int base_dist[D_CODES] = {
+    0,     1,     2,     3,     4,     6,     8,    12,    16,    24,
+   32,    48,    64,    96,   128,   192,   256,   384,   512,   768,
+ 1024,  1536,  2048,  3072,  4096,  6144,  8192, 12288, 16384, 24576
+};
+
Index: tags/visualization-10.5-before-10.6_test/externals/zlib/include/zconf.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/externals/zlib/include/zconf.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/externals/zlib/include/zconf.h	(revision 1102)
@@ -0,0 +1,326 @@
+/* zconf.h -- configuration of the zlib compression library
+ * Copyright (C) 1995-2004 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* @(#) $Id: zconf.h,v 1.1 2005/05/12 21:04:53 duns Exp $ */
+
+#ifndef _ZCONF_H
+#define _ZCONF_H
+
+/*
+ * If you *really* need a unique prefix for all types and library functions,
+ * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
+ */
+#ifdef Z_PREFIX
+#  define deflateInit_          z_deflateInit_
+#  define deflate               z_deflate
+#  define deflateEnd            z_deflateEnd
+#  define inflateInit_          z_inflateInit_
+#  define inflate               z_inflate
+#  define inflateEnd            z_inflateEnd
+#  define deflateInit2_         z_deflateInit2_
+#  define deflateSetDictionary  z_deflateSetDictionary
+#  define deflateCopy           z_deflateCopy
+#  define deflateReset          z_deflateReset
+#  define deflateParams         z_deflateParams
+#  define deflateBound          z_deflateBound
+#  define deflatePrime          z_deflatePrime
+#  define inflateInit2_         z_inflateInit2_
+#  define inflateSetDictionary  z_inflateSetDictionary
+#  define inflateSync           z_inflateSync
+#  define inflateSyncPoint      z_inflateSyncPoint
+#  define inflateCopy           z_inflateCopy
+#  define inflateReset          z_inflateReset
+#  define inflateBack           z_inflateBack
+#  define inflateBackEnd        z_inflateBackEnd
+#  define compress              z_compress
+#  define compress2             z_compress2
+#  define compressBound         z_compressBound
+#  define uncompress            z_uncompress
+#  define adler32               z_adler32
+#  define crc32                 z_crc32
+#  define get_crc_table         z_get_crc_table
+#  define zError               	z_zError
+
+#  define Byte                  z_Byte
+#  define uInt                  z_uInt
+#  define uLong                 z_uLong
+#  define Bytef                 z_Bytef
+#  define charf                 z_charf
+#  define intf                  z_intf
+#  define uIntf                 z_uIntf
+#  define uLongf                z_uLongf
+#  define voidpf                z_voidpf
+#  define voidp                 z_voidp
+#endif
+
+#if defined(__MSDOS__) && !defined(MSDOS)
+#  define MSDOS
+#endif
+#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
+#  define OS2
+#endif
+#if defined(_WINDOWS) && !defined(WINDOWS)
+#  define WINDOWS
+#endif
+#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
+#  define WIN32
+#endif
+#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
+#  if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
+#    ifndef SYS16BIT
+#      define SYS16BIT
+#    endif
+#  endif
+#endif
+
+/*
+ * Compile with -DMAXSEG_64K if the alloc function cannot allocate more
+ * than 64k bytes at a time (needed on systems with 16-bit int).
+ */
+#ifdef SYS16BIT
+#  define MAXSEG_64K
+#endif
+#ifdef MSDOS
+#  define UNALIGNED_OK
+#endif
+
+#ifdef __STDC_VERSION__
+#  ifndef STDC
+#    define STDC
+#  endif
+#  if __STDC_VERSION__ >= 199901L
+#    ifndef STDC99
+#      define STDC99
+#    endif
+#  endif
+#endif
+#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
+#  define STDC
+#endif
+#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
+#  define STDC
+#endif
+#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
+#  define STDC
+#endif
+#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
+#  define STDC
+#endif
+
+#if defined(__OS400__) && !defined(STDC)    /* iSeries (formerly AS/400). */
+#  define STDC
+#endif
+
+#ifndef STDC
+#  ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
+#    define const       /* note: need a more gentle solution here */
+#  endif
+#endif
+
+/* Some Mac compilers merge all .h files incorrectly: */
+#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
+#  define NO_DUMMY_DECL
+#endif
+
+/* Maximum value for memLevel in deflateInit2 */
+#ifndef MAX_MEM_LEVEL
+#  ifdef MAXSEG_64K
+#    define MAX_MEM_LEVEL 8
+#  else
+#    define MAX_MEM_LEVEL 9
+#  endif
+#endif
+
+/* Maximum value for windowBits in deflateInit2 and inflateInit2.
+ * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
+ * created by gzip. (Files created by minigzip can still be extracted by
+ * gzip.)
+ */
+#ifndef MAX_WBITS
+#  define MAX_WBITS   15 /* 32K LZ77 window */
+#endif
+
+/* The memory requirements for deflate are (in bytes):
+            (1 << (windowBits+2)) +  (1 << (memLevel+9))
+ that is: 128K for windowBits=15  +  128K for memLevel = 8  (default values)
+ plus a few kilobytes for small objects. For example, if you want to reduce
+ the default memory requirements from 256K to 128K, compile with
+     make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
+ Of course this will generally degrade compression (there's no free lunch).
+
+   The memory requirements for inflate are (in bytes) 1 << windowBits
+ that is, 32K for windowBits=15 (default value) plus a few kilobytes
+ for small objects.
+*/
+
+                        /* Type declarations */
+
+#ifndef OF /* function prototypes */
+#  ifdef STDC
+#    define OF(args)  args
+#  else
+#    define OF(args)  ()
+#  endif
+#endif
+
+/* The following definitions for FAR are needed only for MSDOS mixed
+ * model programming (small or medium model with some far allocations).
+ * This was tested only with MSC; for other MSDOS compilers you may have
+ * to define NO_MEMCPY in zutil.h.  If you don't need the mixed model,
+ * just define FAR to be empty.
+ */
+#ifdef SYS16BIT
+#  if defined(M_I86SM) || defined(M_I86MM)
+     /* MSC small or medium model */
+#    define SMALL_MEDIUM
+#    ifdef _MSC_VER
+#      define FAR _far
+#    else
+#      define FAR far
+#    endif
+#  endif
+#  if (defined(__SMALL__) || defined(__MEDIUM__))
+     /* Turbo C small or medium model */
+#    define SMALL_MEDIUM
+#    ifdef __BORLANDC__
+#      define FAR _far
+#    else
+#      define FAR far
+#    endif
+#  endif
+#endif
+
+#if defined(WINDOWS) || defined(WIN32)
+   /* If building or using zlib as a DLL, define ZLIB_DLL.
+    * This is not mandatory, but it offers a little performance increase.
+    */
+#  ifdef ZLIB_DLL
+#    if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
+#      ifdef ZLIB_INTERNAL
+#        define ZEXTERN extern __declspec(dllexport)
+#      else
+#        define ZEXTERN extern __declspec(dllimport)
+#      endif
+#    endif
+#  endif  /* ZLIB_DLL */
+   /* If building or using zlib with the WINAPI/WINAPIV calling convention,
+    * define ZLIB_WINAPI.
+    * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
+    */
+#  ifdef ZLIB_WINAPI
+#    ifdef FAR
+#      undef FAR
+#    endif
+#    include <windows.h>
+     /* No need for _export, use ZLIB.DEF instead. */
+     /* For complete Windows compatibility, use WINAPI, not __stdcall. */
+#    define ZEXPORT WINAPI
+#    ifdef WIN32
+#      define ZEXPORTVA WINAPIV
+#    else
+#      define ZEXPORTVA FAR CDECL
+#    endif
+#  endif
+#endif
+
+#if defined (__BEOS__)
+#  ifdef ZLIB_DLL
+#    ifdef ZLIB_INTERNAL
+#      define ZEXPORT   __declspec(dllexport)
+#      define ZEXPORTVA __declspec(dllexport)
+#    else
+#      define ZEXPORT   __declspec(dllimport)
+#      define ZEXPORTVA __declspec(dllimport)
+#    endif
+#  endif
+#endif
+
+#ifndef ZEXTERN
+#  define ZEXTERN extern
+#endif
+#ifndef ZEXPORT
+#  define ZEXPORT
+#endif
+#ifndef ZEXPORTVA
+#  define ZEXPORTVA
+#endif
+
+#ifndef FAR
+#  define FAR
+#endif
+
+#if !defined(__MACTYPES__)
+typedef unsigned char  Byte;  /* 8 bits */
+#endif
+typedef unsigned int   uInt;  /* 16 bits or more */
+typedef unsigned long  uLong; /* 32 bits or more */
+
+#ifdef SMALL_MEDIUM
+   /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
+#  define Bytef Byte FAR
+#else
+   typedef Byte  FAR Bytef;
+#endif
+typedef char  FAR charf;
+typedef int   FAR intf;
+typedef uInt  FAR uIntf;
+typedef uLong FAR uLongf;
+
+#ifdef STDC
+   typedef void const *voidpc;
+   typedef void FAR   *voidpf;
+   typedef void       *voidp;
+#else
+   typedef Byte const *voidpc;
+   typedef Byte FAR   *voidpf;
+   typedef Byte       *voidp;
+#endif
+
+#if 0           /* HAVE_UNISTD_H -- this line is updated by ./configure */
+#  include <sys/types.h> /* for off_t */
+#  include <unistd.h>    /* for SEEK_* and off_t */
+#  ifdef VMS
+#    include <unixio.h>   /* for off_t */
+#  endif
+#  define z_off_t off_t
+#endif
+#ifndef SEEK_SET
+#  define SEEK_SET        0       /* Seek from beginning of file.  */
+#  define SEEK_CUR        1       /* Seek from current position.  */
+#  define SEEK_END        2       /* Set file pointer to EOF plus "offset" */
+#endif
+#ifndef z_off_t
+#  define z_off_t long
+#endif
+
+#if defined(__OS400__)
+#  define NO_vsnprintf
+#endif
+
+#if defined(__MVS__)
+#  define NO_vsnprintf
+#  ifdef FAR
+#    undef FAR
+#  endif
+#endif
+
+/* MVS linker does not support external names larger than 8 bytes */
+#if defined(__MVS__)
+#   pragma map(deflateInit_,"DEIN")
+#   pragma map(deflateInit2_,"DEIN2")
+#   pragma map(deflateEnd,"DEEND")
+#   pragma map(deflateBound,"DEBND")
+#   pragma map(inflateInit_,"ININ")
+#   pragma map(inflateInit2_,"ININ2")
+#   pragma map(inflateEnd,"INEND")
+#   pragma map(inflateSync,"INSY")
+#   pragma map(inflateSetDictionary,"INSEDI")
+#   pragma map(compressBound,"CMBND")
+#   pragma map(inflate_table,"INTABL")
+#   pragma map(inflate_fast,"INFA")
+#   pragma map(inflate_copyright,"INCOPY")
+#endif
+
+#endif /* _ZCONF_H */
Index: tags/visualization-10.5-before-10.6_test/externals/zlib/include/zlib.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/externals/zlib/include/zlib.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/externals/zlib/include/zlib.h	(revision 1102)
@@ -0,0 +1,1199 @@
+/* zlib.h -- interface of the 'zlib' general purpose compression library
+  version 1.2.2, October 3rd, 2004
+
+  Copyright (C) 1995-2004 Jean-loup Gailly and Mark Adler
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+
+  Jean-loup Gailly        Mark Adler
+  jloup@gzip.org          madler@alumni.caltech.edu
+
+
+  The data format used by the zlib library is described by RFCs (Request for
+  Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt
+  (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
+*/
+
+#ifndef _ZLIB_H
+#define _ZLIB_H
+
+#include "zconf.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define ZLIB_VERSION "1.2.2"
+#define ZLIB_VERNUM 0x1220
+
+/*
+     The 'zlib' compression library provides in-memory compression and
+  decompression functions, including integrity checks of the uncompressed
+  data.  This version of the library supports only one compression method
+  (deflation) but other algorithms will be added later and will have the same
+  stream interface.
+
+     Compression can be done in a single step if the buffers are large
+  enough (for example if an input file is mmap'ed), or can be done by
+  repeated calls of the compression function.  In the latter case, the
+  application must provide more input and/or consume the output
+  (providing more output space) before each call.
+
+     The compressed data format used by default by the in-memory functions is
+  the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped
+  around a deflate stream, which is itself documented in RFC 1951.
+
+     The library also supports reading and writing files in gzip (.gz) format
+  with an interface similar to that of stdio using the functions that start
+  with "gz".  The gzip format is different from the zlib format.  gzip is a
+  gzip wrapper, documented in RFC 1952, wrapped around a deflate stream.
+
+     This library can optionally read and write gzip streams in memory as well.
+
+     The zlib format was designed to be compact and fast for use in memory
+  and on communications channels.  The gzip format was designed for single-
+  file compression on file systems, has a larger header than zlib to maintain
+  directory information, and uses a different, slower check method than zlib.
+
+     The library does not install any signal handler. The decoder checks
+  the consistency of the compressed data, so the library should never
+  crash even in case of corrupted input.
+*/
+
+typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
+typedef void   (*free_func)  OF((voidpf opaque, voidpf address));
+
+struct internal_state;
+
+typedef struct z_stream_s {
+    Bytef    *next_in;  /* next input byte */
+    uInt     avail_in;  /* number of bytes available at next_in */
+    uLong    total_in;  /* total nb of input bytes read so far */
+
+    Bytef    *next_out; /* next output byte should be put there */
+    uInt     avail_out; /* remaining free space at next_out */
+    uLong    total_out; /* total nb of bytes output so far */
+
+    char     *msg;      /* last error message, NULL if no error */
+    struct internal_state FAR *state; /* not visible by applications */
+
+    alloc_func zalloc;  /* used to allocate the internal state */
+    free_func  zfree;   /* used to free the internal state */
+    voidpf     opaque;  /* private data object passed to zalloc and zfree */
+
+    int     data_type;  /* best guess about the data type: ascii or binary */
+    uLong   adler;      /* adler32 value of the uncompressed data */
+    uLong   reserved;   /* reserved for future use */
+} z_stream;
+
+typedef z_stream FAR *z_streamp;
+
+/*
+   The application must update next_in and avail_in when avail_in has
+   dropped to zero. It must update next_out and avail_out when avail_out
+   has dropped to zero. The application must initialize zalloc, zfree and
+   opaque before calling the init function. All other fields are set by the
+   compression library and must not be updated by the application.
+
+   The opaque value provided by the application will be passed as the first
+   parameter for calls of zalloc and zfree. This can be useful for custom
+   memory management. The compression library attaches no meaning to the
+   opaque value.
+
+   zalloc must return Z_NULL if there is not enough memory for the object.
+   If zlib is used in a multi-threaded application, zalloc and zfree must be
+   thread safe.
+
+   On 16-bit systems, the functions zalloc and zfree must be able to allocate
+   exactly 65536 bytes, but will not be required to allocate more than this
+   if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS,
+   pointers returned by zalloc for objects of exactly 65536 bytes *must*
+   have their offset normalized to zero. The default allocation function
+   provided by this library ensures this (see zutil.c). To reduce memory
+   requirements and avoid any allocation of 64K objects, at the expense of
+   compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h).
+
+   The fields total_in and total_out can be used for statistics or
+   progress reports. After compression, total_in holds the total size of
+   the uncompressed data and may be saved for use in the decompressor
+   (particularly if the decompressor wants to decompress everything in
+   a single step).
+*/
+
+                        /* constants */
+
+#define Z_NO_FLUSH      0
+#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */
+#define Z_SYNC_FLUSH    2
+#define Z_FULL_FLUSH    3
+#define Z_FINISH        4
+#define Z_BLOCK         5
+/* Allowed flush values; see deflate() and inflate() below for details */
+
+#define Z_OK            0
+#define Z_STREAM_END    1
+#define Z_NEED_DICT     2
+#define Z_ERRNO        (-1)
+#define Z_STREAM_ERROR (-2)
+#define Z_DATA_ERROR   (-3)
+#define Z_MEM_ERROR    (-4)
+#define Z_BUF_ERROR    (-5)
+#define Z_VERSION_ERROR (-6)
+/* Return codes for the compression/decompression functions. Negative
+ * values are errors, positive values are used for special but normal events.
+ */
+
+#define Z_NO_COMPRESSION         0
+#define Z_BEST_SPEED             1
+#define Z_BEST_COMPRESSION       9
+#define Z_DEFAULT_COMPRESSION  (-1)
+/* compression levels */
+
+#define Z_FILTERED            1
+#define Z_HUFFMAN_ONLY        2
+#define Z_RLE                 3
+#define Z_DEFAULT_STRATEGY    0
+/* compression strategy; see deflateInit2() below for details */
+
+#define Z_BINARY   0
+#define Z_ASCII    1
+#define Z_UNKNOWN  2
+/* Possible values of the data_type field (though see inflate()) */
+
+#define Z_DEFLATED   8
+/* The deflate compression method (the only one supported in this version) */
+
+#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
+
+#define zlib_version zlibVersion()
+/* for compatibility with versions < 1.0.2 */
+
+                        /* basic functions */
+
+ZEXTERN const char * ZEXPORT zlibVersion OF((void));
+/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
+   If the first character differs, the library code actually used is
+   not compatible with the zlib.h header file used by the application.
+   This check is automatically made by deflateInit and inflateInit.
+ */
+
+/*
+ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
+
+     Initializes the internal stream state for compression. The fields
+   zalloc, zfree and opaque must be initialized before by the caller.
+   If zalloc and zfree are set to Z_NULL, deflateInit updates them to
+   use default allocation functions.
+
+     The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
+   1 gives best speed, 9 gives best compression, 0 gives no compression at
+   all (the input data is simply copied a block at a time).
+   Z_DEFAULT_COMPRESSION requests a default compromise between speed and
+   compression (currently equivalent to level 6).
+
+     deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not
+   enough memory, Z_STREAM_ERROR if level is not a valid compression level,
+   Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible
+   with the version assumed by the caller (ZLIB_VERSION).
+   msg is set to null if there is no error message.  deflateInit does not
+   perform any compression: this will be done by deflate().
+*/
+
+
+ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
+/*
+    deflate compresses as much data as possible, and stops when the input
+  buffer becomes empty or the output buffer becomes full. It may introduce some
+  output latency (reading input without producing any output) except when
+  forced to flush.
+
+    The detailed semantics are as follows. deflate performs one or both of the
+  following actions:
+
+  - Compress more input starting at next_in and update next_in and avail_in
+    accordingly. If not all input can be processed (because there is not
+    enough room in the output buffer), next_in and avail_in are updated and
+    processing will resume at this point for the next call of deflate().
+
+  - Provide more output starting at next_out and update next_out and avail_out
+    accordingly. This action is forced if the parameter flush is non zero.
+    Forcing flush frequently degrades the compression ratio, so this parameter
+    should be set only when necessary (in interactive applications).
+    Some output may be provided even if flush is not set.
+
+  Before the call of deflate(), the application should ensure that at least
+  one of the actions is possible, by providing more input and/or consuming
+  more output, and updating avail_in or avail_out accordingly; avail_out
+  should never be zero before the call. The application can consume the
+  compressed output when it wants, for example when the output buffer is full
+  (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK
+  and with zero avail_out, it must be called again after making room in the
+  output buffer because there might be more output pending.
+
+    If the parameter flush is set to Z_SYNC_FLUSH, all pending output is
+  flushed to the output buffer and the output is aligned on a byte boundary, so
+  that the decompressor can get all input data available so far. (In particular
+  avail_in is zero after the call if enough output space has been provided
+  before the call.)  Flushing may degrade compression for some compression
+  algorithms and so it should be used only when necessary.
+
+    If flush is set to Z_FULL_FLUSH, all output is flushed as with
+  Z_SYNC_FLUSH, and the compression state is reset so that decompression can
+  restart from this point if previous compressed data has been damaged or if
+  random access is desired. Using Z_FULL_FLUSH too often can seriously degrade
+  the compression.
+
+    If deflate returns with avail_out == 0, this function must be called again
+  with the same value of the flush parameter and more output space (updated
+  avail_out), until the flush is complete (deflate returns with non-zero
+  avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that
+  avail_out is greater than six to avoid repeated flush markers due to
+  avail_out == 0 on return.
+
+    If the parameter flush is set to Z_FINISH, pending input is processed,
+  pending output is flushed and deflate returns with Z_STREAM_END if there
+  was enough output space; if deflate returns with Z_OK, this function must be
+  called again with Z_FINISH and more output space (updated avail_out) but no
+  more input data, until it returns with Z_STREAM_END or an error. After
+  deflate has returned Z_STREAM_END, the only possible operations on the
+  stream are deflateReset or deflateEnd.
+
+    Z_FINISH can be used immediately after deflateInit if all the compression
+  is to be done in a single step. In this case, avail_out must be at least
+  the value returned by deflateBound (see below). If deflate does not return
+  Z_STREAM_END, then it must be called again as described above.
+
+    deflate() sets strm->adler to the adler32 checksum of all input read
+  so far (that is, total_in bytes).
+
+    deflate() may update data_type if it can make a good guess about
+  the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered
+  binary. This field is only for information purposes and does not affect
+  the compression algorithm in any manner.
+
+    deflate() returns Z_OK if some progress has been made (more input
+  processed or more output produced), Z_STREAM_END if all input has been
+  consumed and all output has been produced (only when flush is set to
+  Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
+  if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible
+  (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not
+  fatal, and deflate() can be called again with more input and more output
+  space to continue compressing.
+*/
+
+
+ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
+/*
+     All dynamically allocated data structures for this stream are freed.
+   This function discards any unprocessed input and does not flush any
+   pending output.
+
+     deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the
+   stream state was inconsistent, Z_DATA_ERROR if the stream was freed
+   prematurely (some input or output was discarded). In the error case,
+   msg may be set but then points to a static string (which must not be
+   deallocated).
+*/
+
+
+/*
+ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
+
+     Initializes the internal stream state for decompression. The fields
+   next_in, avail_in, zalloc, zfree and opaque must be initialized before by
+   the caller. If next_in is not Z_NULL and avail_in is large enough (the exact
+   value depends on the compression method), inflateInit determines the
+   compression method from the zlib header and allocates all data structures
+   accordingly; otherwise the allocation will be deferred to the first call of
+   inflate.  If zalloc and zfree are set to Z_NULL, inflateInit updates them to
+   use default allocation functions.
+
+     inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
+   memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
+   version assumed by the caller.  msg is set to null if there is no error
+   message. inflateInit does not perform any decompression apart from reading
+   the zlib header if present: this will be done by inflate().  (So next_in and
+   avail_in may be modified, but next_out and avail_out are unchanged.)
+*/
+
+
+ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
+/*
+    inflate decompresses as much data as possible, and stops when the input
+  buffer becomes empty or the output buffer becomes full. It may introduce
+  some output latency (reading input without producing any output) except when
+  forced to flush.
+
+  The detailed semantics are as follows. inflate performs one or both of the
+  following actions:
+
+  - Decompress more input starting at next_in and update next_in and avail_in
+    accordingly. If not all input can be processed (because there is not
+    enough room in the output buffer), next_in is updated and processing
+    will resume at this point for the next call of inflate().
+
+  - Provide more output starting at next_out and update next_out and avail_out
+    accordingly.  inflate() provides as much output as possible, until there
+    is no more input data or no more space in the output buffer (see below
+    about the flush parameter).
+
+  Before the call of inflate(), the application should ensure that at least
+  one of the actions is possible, by providing more input and/or consuming
+  more output, and updating the next_* and avail_* values accordingly.
+  The application can consume the uncompressed output when it wants, for
+  example when the output buffer is full (avail_out == 0), or after each
+  call of inflate(). If inflate returns Z_OK and with zero avail_out, it
+  must be called again after making room in the output buffer because there
+  might be more output pending.
+
+    The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH,
+  Z_FINISH, or Z_BLOCK. Z_SYNC_FLUSH requests that inflate() flush as much
+  output as possible to the output buffer. Z_BLOCK requests that inflate() stop
+  if and when it get to the next deflate block boundary. When decoding the zlib
+  or gzip format, this will cause inflate() to return immediately after the
+  header and before the first block. When doing a raw inflate, inflate() will
+  go ahead and process the first block, and will return when it gets to the end
+  of that block, or when it runs out of data.
+
+    The Z_BLOCK option assists in appending to or combining deflate streams.
+  Also to assist in this, on return inflate() will set strm->data_type to the
+  number of unused bits in the last byte taken from strm->next_in, plus 64
+  if inflate() is currently decoding the last block in the deflate stream,
+  plus 128 if inflate() returned immediately after decoding an end-of-block
+  code or decoding the complete header up to just before the first byte of the
+  deflate stream. The end-of-block will not be indicated until all of the
+  uncompressed data from that block has been written to strm->next_out.  The
+  number of unused bits may in general be greater than seven, except when
+  bit 7 of data_type is set, in which case the number of unused bits will be
+  less than eight.
+
+    inflate() should normally be called until it returns Z_STREAM_END or an
+  error. However if all decompression is to be performed in a single step
+  (a single call of inflate), the parameter flush should be set to
+  Z_FINISH. In this case all pending input is processed and all pending
+  output is flushed; avail_out must be large enough to hold all the
+  uncompressed data. (The size of the uncompressed data may have been saved
+  by the compressor for this purpose.) The next operation on this stream must
+  be inflateEnd to deallocate the decompression state. The use of Z_FINISH
+  is never required, but can be used to inform inflate that a faster approach
+  may be used for the single inflate() call.
+
+     In this implementation, inflate() always flushes as much output as
+  possible to the output buffer, and always uses the faster approach on the
+  first call. So the only effect of the flush parameter in this implementation
+  is on the return value of inflate(), as noted below, or when it returns early
+  because Z_BLOCK is used.
+
+     If a preset dictionary is needed after this call (see inflateSetDictionary
+  below), inflate sets strm->adler to the adler32 checksum of the dictionary
+  chosen by the compressor and returns Z_NEED_DICT; otherwise it sets
+  strm->adler to the adler32 checksum of all output produced so far (that is,
+  total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described
+  below. At the end of the stream, inflate() checks that its computed adler32
+  checksum is equal to that saved by the compressor and returns Z_STREAM_END
+  only if the checksum is correct.
+
+    inflate() will decompress and check either zlib-wrapped or gzip-wrapped
+  deflate data.  The header type is detected automatically.  Any information
+  contained in the gzip header is not retained, so applications that need that
+  information should instead use raw inflate, see inflateInit2() below, or
+  inflateBack() and perform their own processing of the gzip header and
+  trailer.
+
+    inflate() returns Z_OK if some progress has been made (more input processed
+  or more output produced), Z_STREAM_END if the end of the compressed data has
+  been reached and all uncompressed output has been produced, Z_NEED_DICT if a
+  preset dictionary is needed at this point, Z_DATA_ERROR if the input data was
+  corrupted (input stream not conforming to the zlib format or incorrect check
+  value), Z_STREAM_ERROR if the stream structure was inconsistent (for example
+  if next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory,
+  Z_BUF_ERROR if no progress is possible or if there was not enough room in the
+  output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and
+  inflate() can be called again with more input and more output space to
+  continue decompressing. If Z_DATA_ERROR is returned, the application may then
+  call inflateSync() to look for a good compression block if a partial recovery
+  of the data is desired.
+*/
+
+
+ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
+/*
+     All dynamically allocated data structures for this stream are freed.
+   This function discards any unprocessed input and does not flush any
+   pending output.
+
+     inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state
+   was inconsistent. In the error case, msg may be set but then points to a
+   static string (which must not be deallocated).
+*/
+
+                        /* Advanced functions */
+
+/*
+    The following functions are needed only in some special applications.
+*/
+
+/*
+ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
+                                     int  level,
+                                     int  method,
+                                     int  windowBits,
+                                     int  memLevel,
+                                     int  strategy));
+
+     This is another version of deflateInit with more compression options. The
+   fields next_in, zalloc, zfree and opaque must be initialized before by
+   the caller.
+
+     The method parameter is the compression method. It must be Z_DEFLATED in
+   this version of the library.
+
+     The windowBits parameter is the base two logarithm of the window size
+   (the size of the history buffer). It should be in the range 8..15 for this
+   version of the library. Larger values of this parameter result in better
+   compression at the expense of memory usage. The default value is 15 if
+   deflateInit is used instead.
+
+     windowBits can also be -8..-15 for raw deflate. In this case, -windowBits
+   determines the window size. deflate() will then generate raw deflate data
+   with no zlib header or trailer, and will not compute an adler32 check value.
+
+     windowBits can also be greater than 15 for optional gzip encoding. Add
+   16 to windowBits to write a simple gzip header and trailer around the
+   compressed data instead of a zlib wrapper. The gzip header will have no
+   file name, no extra data, no comment, no modification time (set to zero),
+   no header crc, and the operating system will be set to 255 (unknown).  If a
+   gzip stream is being written, strm->adler is a crc32 instead of an adler32.
+
+     The memLevel parameter specifies how much memory should be allocated
+   for the internal compression state. memLevel=1 uses minimum memory but
+   is slow and reduces compression ratio; memLevel=9 uses maximum memory
+   for optimal speed. The default value is 8. See zconf.h for total memory
+   usage as a function of windowBits and memLevel.
+
+     The strategy parameter is used to tune the compression algorithm. Use the
+   value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a
+   filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no
+   string match), or Z_RLE to limit match distances to one (run-length
+   encoding). Filtered data consists mostly of small values with a somewhat
+   random distribution. In this case, the compression algorithm is tuned to
+   compress them better. The effect of Z_FILTERED is to force more Huffman
+   coding and less string matching; it is somewhat intermediate between
+   Z_DEFAULT and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as fast as
+   Z_HUFFMAN_ONLY, but give better compression for PNG image data. The strategy
+   parameter only affects the compression ratio but not the correctness of the
+   compressed output even if it is not set appropriately.
+
+      deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+   memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid
+   method). msg is set to null if there is no error message.  deflateInit2 does
+   not perform any compression: this will be done by deflate().
+*/
+
+ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
+                                             const Bytef *dictionary,
+                                             uInt  dictLength));
+/*
+     Initializes the compression dictionary from the given byte sequence
+   without producing any compressed output. This function must be called
+   immediately after deflateInit, deflateInit2 or deflateReset, before any
+   call of deflate. The compressor and decompressor must use exactly the same
+   dictionary (see inflateSetDictionary).
+
+     The dictionary should consist of strings (byte sequences) that are likely
+   to be encountered later in the data to be compressed, with the most commonly
+   used strings preferably put towards the end of the dictionary. Using a
+   dictionary is most useful when the data to be compressed is short and can be
+   predicted with good accuracy; the data can then be compressed better than
+   with the default empty dictionary.
+
+     Depending on the size of the compression data structures selected by
+   deflateInit or deflateInit2, a part of the dictionary may in effect be
+   discarded, for example if the dictionary is larger than the window size in
+   deflate or deflate2. Thus the strings most likely to be useful should be
+   put at the end of the dictionary, not at the front.
+
+     Upon return of this function, strm->adler is set to the adler32 value
+   of the dictionary; the decompressor may later use this value to determine
+   which dictionary has been used by the compressor. (The adler32 value
+   applies to the whole dictionary even if only a subset of the dictionary is
+   actually used by the compressor.) If a raw deflate was requested, then the
+   adler32 value is not computed and strm->adler is not set.
+
+     deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
+   parameter is invalid (such as NULL dictionary) or the stream state is
+   inconsistent (for example if deflate has already been called for this stream
+   or if the compression method is bsort). deflateSetDictionary does not
+   perform any compression: this will be done by deflate().
+*/
+
+ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
+                                    z_streamp source));
+/*
+     Sets the destination stream as a complete copy of the source stream.
+
+     This function can be useful when several compression strategies will be
+   tried, for example when there are several ways of pre-processing the input
+   data with a filter. The streams that will be discarded should then be freed
+   by calling deflateEnd.  Note that deflateCopy duplicates the internal
+   compression state which can be quite large, so this strategy is slow and
+   can consume lots of memory.
+
+     deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
+   enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
+   (such as zalloc being NULL). msg is left unchanged in both source and
+   destination.
+*/
+
+ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
+/*
+     This function is equivalent to deflateEnd followed by deflateInit,
+   but does not free and reallocate all the internal compression state.
+   The stream will keep the same compression level and any other attributes
+   that may have been set by deflateInit2.
+
+      deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
+   stream state was inconsistent (such as zalloc or state being NULL).
+*/
+
+ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
+                                      int level,
+                                      int strategy));
+/*
+     Dynamically update the compression level and compression strategy.  The
+   interpretation of level and strategy is as in deflateInit2.  This can be
+   used to switch between compression and straight copy of the input data, or
+   to switch to a different kind of input data requiring a different
+   strategy. If the compression level is changed, the input available so far
+   is compressed with the old level (and may be flushed); the new level will
+   take effect only at the next call of deflate().
+
+     Before the call of deflateParams, the stream state must be set as for
+   a call of deflate(), since the currently available input may have to
+   be compressed and flushed. In particular, strm->avail_out must be non-zero.
+
+     deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
+   stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR
+   if strm->avail_out was zero.
+*/
+
+ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,
+                                       uLong sourceLen));
+/*
+     deflateBound() returns an upper bound on the compressed size after
+   deflation of sourceLen bytes.  It must be called after deflateInit()
+   or deflateInit2().  This would be used to allocate an output buffer
+   for deflation in a single pass, and so would be called before deflate().
+*/
+
+ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,
+                                     int bits,
+                                     int value));
+/*
+     deflatePrime() inserts bits in the deflate output stream.  The intent
+  is that this function is used to start off the deflate output with the
+  bits leftover from a previous deflate stream when appending to it.  As such,
+  this function can only be used for raw deflate, and must be used before the
+  first deflate() call after a deflateInit2() or deflateReset().  bits must be
+  less than or equal to 16, and that many of the least significant bits of
+  value will be inserted in the output.
+
+      deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
+   stream state was inconsistent.
+*/
+
+/*
+ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
+                                     int  windowBits));
+
+     This is another version of inflateInit with an extra parameter. The
+   fields next_in, avail_in, zalloc, zfree and opaque must be initialized
+   before by the caller.
+
+     The windowBits parameter is the base two logarithm of the maximum window
+   size (the size of the history buffer).  It should be in the range 8..15 for
+   this version of the library. The default value is 15 if inflateInit is used
+   instead. windowBits must be greater than or equal to the windowBits value
+   provided to deflateInit2() while compressing, or it must be equal to 15 if
+   deflateInit2() was not used. If a compressed stream with a larger window
+   size is given as input, inflate() will return with the error code
+   Z_DATA_ERROR instead of trying to allocate a larger window.
+
+     windowBits can also be -8..-15 for raw inflate. In this case, -windowBits
+   determines the window size. inflate() will then process raw deflate data,
+   not looking for a zlib or gzip header, not generating a check value, and not
+   looking for any check values for comparison at the end of the stream. This
+   is for use with other formats that use the deflate compressed data format
+   such as zip.  Those formats provide their own check values. If a custom
+   format is developed using the raw deflate format for compressed data, it is
+   recommended that a check value such as an adler32 or a crc32 be applied to
+   the uncompressed data as is done in the zlib, gzip, and zip formats.  For
+   most applications, the zlib format should be used as is. Note that comments
+   above on the use in deflateInit2() applies to the magnitude of windowBits.
+
+     windowBits can also be greater than 15 for optional gzip decoding. Add
+   32 to windowBits to enable zlib and gzip decoding with automatic header
+   detection, or add 16 to decode only the gzip format (the zlib format will
+   return a Z_DATA_ERROR.  If a gzip stream is being decoded, strm->adler is
+   a crc32 instead of an adler32.
+
+     inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+   memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative
+   memLevel). msg is set to null if there is no error message.  inflateInit2
+   does not perform any decompression apart from reading the zlib header if
+   present: this will be done by inflate(). (So next_in and avail_in may be
+   modified, but next_out and avail_out are unchanged.)
+*/
+
+ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
+                                             const Bytef *dictionary,
+                                             uInt  dictLength));
+/*
+     Initializes the decompression dictionary from the given uncompressed byte
+   sequence. This function must be called immediately after a call of inflate
+   if this call returned Z_NEED_DICT. The dictionary chosen by the compressor
+   can be determined from the adler32 value returned by this call of
+   inflate. The compressor and decompressor must use exactly the same
+   dictionary (see deflateSetDictionary).
+
+     inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
+   parameter is invalid (such as NULL dictionary) or the stream state is
+   inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
+   expected one (incorrect adler32 value). inflateSetDictionary does not
+   perform any decompression: this will be done by subsequent calls of
+   inflate().
+*/
+
+ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
+/*
+    Skips invalid compressed data until a full flush point (see above the
+  description of deflate with Z_FULL_FLUSH) can be found, or until all
+  available input is skipped. No output is provided.
+
+    inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR
+  if no more input was provided, Z_DATA_ERROR if no flush point has been found,
+  or Z_STREAM_ERROR if the stream structure was inconsistent. In the success
+  case, the application may save the current current value of total_in which
+  indicates where valid compressed data was found. In the error case, the
+  application may repeatedly call inflateSync, providing more input each time,
+  until success or end of the input data.
+*/
+
+ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
+                                    z_streamp source));
+/*
+     Sets the destination stream as a complete copy of the source stream.
+
+     This function can be useful when randomly accessing a large stream.  The
+   first pass through the stream can periodically record the inflate state,
+   allowing restarting inflate at those points when randomly accessing the
+   stream.
+
+     inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
+   enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
+   (such as zalloc being NULL). msg is left unchanged in both source and
+   destination.
+*/
+
+ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
+/*
+     This function is equivalent to inflateEnd followed by inflateInit,
+   but does not free and reallocate all the internal decompression state.
+   The stream will keep attributes that may have been set by inflateInit2.
+
+      inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
+   stream state was inconsistent (such as zalloc or state being NULL).
+*/
+
+/*
+ZEXTERN int ZEXPORT inflateBackInit OF((z_stream FAR *strm, int windowBits,
+                                        unsigned char FAR *window));
+
+     Initialize the internal stream state for decompression using inflateBack()
+   calls.  The fields zalloc, zfree and opaque in strm must be initialized
+   before the call.  If zalloc and zfree are Z_NULL, then the default library-
+   derived memory allocation routines are used.  windowBits is the base two
+   logarithm of the window size, in the range 8..15.  window is a caller
+   supplied buffer of that size.  Except for special applications where it is
+   assured that deflate was used with small window sizes, windowBits must be 15
+   and a 32K byte window must be supplied to be able to decompress general
+   deflate streams.
+
+     See inflateBack() for the usage of these routines.
+
+     inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of
+   the paramaters are invalid, Z_MEM_ERROR if the internal state could not
+   be allocated, or Z_VERSION_ERROR if the version of the library does not
+   match the version of the header file.
+*/
+
+typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *));
+typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned));
+
+ZEXTERN int ZEXPORT inflateBack OF((z_stream FAR *strm,
+                                    in_func in, void FAR *in_desc,
+                                    out_func out, void FAR *out_desc));
+/*
+     inflateBack() does a raw inflate with a single call using a call-back
+   interface for input and output.  This is more efficient than inflate() for
+   file i/o applications in that it avoids copying between the output and the
+   sliding window by simply making the window itself the output buffer.  This
+   function trusts the application to not change the output buffer passed by
+   the output function, at least until inflateBack() returns.
+
+     inflateBackInit() must be called first to allocate the internal state
+   and to initialize the state with the user-provided window buffer.
+   inflateBack() may then be used multiple times to inflate a complete, raw
+   deflate stream with each call.  inflateBackEnd() is then called to free
+   the allocated state.
+
+     A raw deflate stream is one with no zlib or gzip header or trailer.
+   This routine would normally be used in a utility that reads zip or gzip
+   files and writes out uncompressed files.  The utility would decode the
+   header and process the trailer on its own, hence this routine expects
+   only the raw deflate stream to decompress.  This is different from the
+   normal behavior of inflate(), which expects either a zlib or gzip header and
+   trailer around the deflate stream.
+
+     inflateBack() uses two subroutines supplied by the caller that are then
+   called by inflateBack() for input and output.  inflateBack() calls those
+   routines until it reads a complete deflate stream and writes out all of the
+   uncompressed data, or until it encounters an error.  The function's
+   parameters and return types are defined above in the in_func and out_func
+   typedefs.  inflateBack() will call in(in_desc, &buf) which should return the
+   number of bytes of provided input, and a pointer to that input in buf.  If
+   there is no input available, in() must return zero--buf is ignored in that
+   case--and inflateBack() will return a buffer error.  inflateBack() will call
+   out(out_desc, buf, len) to write the uncompressed data buf[0..len-1].  out()
+   should return zero on success, or non-zero on failure.  If out() returns
+   non-zero, inflateBack() will return with an error.  Neither in() nor out()
+   are permitted to change the contents of the window provided to
+   inflateBackInit(), which is also the buffer that out() uses to write from.
+   The length written by out() will be at most the window size.  Any non-zero
+   amount of input may be provided by in().
+
+     For convenience, inflateBack() can be provided input on the first call by
+   setting strm->next_in and strm->avail_in.  If that input is exhausted, then
+   in() will be called.  Therefore strm->next_in must be initialized before
+   calling inflateBack().  If strm->next_in is Z_NULL, then in() will be called
+   immediately for input.  If strm->next_in is not Z_NULL, then strm->avail_in
+   must also be initialized, and then if strm->avail_in is not zero, input will
+   initially be taken from strm->next_in[0 .. strm->avail_in - 1].
+
+     The in_desc and out_desc parameters of inflateBack() is passed as the
+   first parameter of in() and out() respectively when they are called.  These
+   descriptors can be optionally used to pass any information that the caller-
+   supplied in() and out() functions need to do their job.
+
+     On return, inflateBack() will set strm->next_in and strm->avail_in to
+   pass back any unused input that was provided by the last in() call.  The
+   return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR
+   if in() or out() returned an error, Z_DATA_ERROR if there was a format
+   error in the deflate stream (in which case strm->msg is set to indicate the
+   nature of the error), or Z_STREAM_ERROR if the stream was not properly
+   initialized.  In the case of Z_BUF_ERROR, an input or output error can be
+   distinguished using strm->next_in which will be Z_NULL only if in() returned
+   an error.  If strm->next is not Z_NULL, then the Z_BUF_ERROR was due to
+   out() returning non-zero.  (in() will always be called before out(), so
+   strm->next_in is assured to be defined if out() returns non-zero.)  Note
+   that inflateBack() cannot return Z_OK.
+*/
+
+ZEXTERN int ZEXPORT inflateBackEnd OF((z_stream FAR *strm));
+/*
+     All memory allocated by inflateBackInit() is freed.
+
+     inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream
+   state was inconsistent.
+*/
+
+ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));
+/* Return flags indicating compile-time options.
+
+    Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other:
+     1.0: size of uInt
+     3.2: size of uLong
+     5.4: size of voidpf (pointer)
+     7.6: size of z_off_t
+
+    Compiler, assembler, and debug options:
+     8: DEBUG
+     9: ASMV or ASMINF -- use ASM code
+     10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention
+     11: 0 (reserved)
+
+    One-time table building (smaller code, but not thread-safe if true):
+     12: BUILDFIXED -- build static block decoding tables when needed
+     13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed
+     14,15: 0 (reserved)
+
+    Library content (indicates missing functionality):
+     16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking
+                          deflate code when not needed)
+     17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect
+                    and decode gzip streams (to avoid linking crc code)
+     18-19: 0 (reserved)
+
+    Operation variations (changes in library functionality):
+     20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate
+     21: FASTEST -- deflate algorithm with only one, lowest compression level
+     22,23: 0 (reserved)
+
+    The sprintf variant used by gzprintf (zero is best):
+     24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format
+     25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure!
+     26: 0 = returns value, 1 = void -- 1 means inferred string length returned
+
+    Remainder:
+     27-31: 0 (reserved)
+ */
+
+
+                        /* utility functions */
+
+/*
+     The following utility functions are implemented on top of the
+   basic stream-oriented functions. To simplify the interface, some
+   default options are assumed (compression level and memory usage,
+   standard memory allocation functions). The source code of these
+   utility functions can easily be modified if you need special options.
+*/
+
+ZEXTERN int ZEXPORT compress OF((Bytef *dest,   uLongf *destLen,
+                                 const Bytef *source, uLong sourceLen));
+/*
+     Compresses the source buffer into the destination buffer.  sourceLen is
+   the byte length of the source buffer. Upon entry, destLen is the total
+   size of the destination buffer, which must be at least the value returned
+   by compressBound(sourceLen). Upon exit, destLen is the actual size of the
+   compressed buffer.
+     This function can be used to compress a whole file at once if the
+   input file is mmap'ed.
+     compress returns Z_OK if success, Z_MEM_ERROR if there was not
+   enough memory, Z_BUF_ERROR if there was not enough room in the output
+   buffer.
+*/
+
+ZEXTERN int ZEXPORT compress2 OF((Bytef *dest,   uLongf *destLen,
+                                  const Bytef *source, uLong sourceLen,
+                                  int level));
+/*
+     Compresses the source buffer into the destination buffer. The level
+   parameter has the same meaning as in deflateInit.  sourceLen is the byte
+   length of the source buffer. Upon entry, destLen is the total size of the
+   destination buffer, which must be at least the value returned by
+   compressBound(sourceLen). Upon exit, destLen is the actual size of the
+   compressed buffer.
+
+     compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+   memory, Z_BUF_ERROR if there was not enough room in the output buffer,
+   Z_STREAM_ERROR if the level parameter is invalid.
+*/
+
+ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen));
+/*
+     compressBound() returns an upper bound on the compressed size after
+   compress() or compress2() on sourceLen bytes.  It would be used before
+   a compress() or compress2() call to allocate the destination buffer.
+*/
+
+ZEXTERN int ZEXPORT uncompress OF((Bytef *dest,   uLongf *destLen,
+                                   const Bytef *source, uLong sourceLen));
+/*
+     Decompresses the source buffer into the destination buffer.  sourceLen is
+   the byte length of the source buffer. Upon entry, destLen is the total
+   size of the destination buffer, which must be large enough to hold the
+   entire uncompressed data. (The size of the uncompressed data must have
+   been saved previously by the compressor and transmitted to the decompressor
+   by some mechanism outside the scope of this compression library.)
+   Upon exit, destLen is the actual size of the compressed buffer.
+     This function can be used to decompress a whole file at once if the
+   input file is mmap'ed.
+
+     uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
+   enough memory, Z_BUF_ERROR if there was not enough room in the output
+   buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete.
+*/
+
+
+typedef voidp gzFile;
+
+ZEXTERN gzFile ZEXPORT gzopen  OF((const char *path, const char *mode));
+/*
+     Opens a gzip (.gz) file for reading or writing. The mode parameter
+   is as in fopen ("rb" or "wb") but can also include a compression level
+   ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for
+   Huffman only compression as in "wb1h", or 'R' for run-length encoding
+   as in "wb1R". (See the description of deflateInit2 for more information
+   about the strategy parameter.)
+
+     gzopen can be used to read a file which is not in gzip format; in this
+   case gzread will directly read from the file without decompression.
+
+     gzopen returns NULL if the file could not be opened or if there was
+   insufficient memory to allocate the (de)compression state; errno
+   can be checked to distinguish the two cases (if errno is zero, the
+   zlib error is Z_MEM_ERROR).  */
+
+ZEXTERN gzFile ZEXPORT gzdopen  OF((int fd, const char *mode));
+/*
+     gzdopen() associates a gzFile with the file descriptor fd.  File
+   descriptors are obtained from calls like open, dup, creat, pipe or
+   fileno (in the file has been previously opened with fopen).
+   The mode parameter is as in gzopen.
+     The next call of gzclose on the returned gzFile will also close the
+   file descriptor fd, just like fclose(fdopen(fd), mode) closes the file
+   descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode).
+     gzdopen returns NULL if there was insufficient memory to allocate
+   the (de)compression state.
+*/
+
+ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
+/*
+     Dynamically update the compression level or strategy. See the description
+   of deflateInit2 for the meaning of these parameters.
+     gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not
+   opened for writing.
+*/
+
+ZEXTERN int ZEXPORT    gzread  OF((gzFile file, voidp buf, unsigned len));
+/*
+     Reads the given number of uncompressed bytes from the compressed file.
+   If the input file was not in gzip format, gzread copies the given number
+   of bytes into the buffer.
+     gzread returns the number of uncompressed bytes actually read (0 for
+   end of file, -1 for error). */
+
+ZEXTERN int ZEXPORT    gzwrite OF((gzFile file,
+                                   voidpc buf, unsigned len));
+/*
+     Writes the given number of uncompressed bytes into the compressed file.
+   gzwrite returns the number of uncompressed bytes actually written
+   (0 in case of error).
+*/
+
+ZEXTERN int ZEXPORTVA   gzprintf OF((gzFile file, const char *format, ...));
+/*
+     Converts, formats, and writes the args to the compressed file under
+   control of the format string, as in fprintf. gzprintf returns the number of
+   uncompressed bytes actually written (0 in case of error).  The number of
+   uncompressed bytes written is limited to 4095. The caller should assure that
+   this limit is not exceeded. If it is exceeded, then gzprintf() will return
+   return an error (0) with nothing written. In this case, there may also be a
+   buffer overflow with unpredictable consequences, which is possible only if
+   zlib was compiled with the insecure functions sprintf() or vsprintf()
+   because the secure snprintf() or vsnprintf() functions were not available.
+*/
+
+ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
+/*
+      Writes the given null-terminated string to the compressed file, excluding
+   the terminating null character.
+      gzputs returns the number of characters written, or -1 in case of error.
+*/
+
+ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
+/*
+      Reads bytes from the compressed file until len-1 characters are read, or
+   a newline character is read and transferred to buf, or an end-of-file
+   condition is encountered.  The string is then terminated with a null
+   character.
+      gzgets returns buf, or Z_NULL in case of error.
+*/
+
+ZEXTERN int ZEXPORT    gzputc OF((gzFile file, int c));
+/*
+      Writes c, converted to an unsigned char, into the compressed file.
+   gzputc returns the value that was written, or -1 in case of error.
+*/
+
+ZEXTERN int ZEXPORT    gzgetc OF((gzFile file));
+/*
+      Reads one byte from the compressed file. gzgetc returns this byte
+   or -1 in case of end of file or error.
+*/
+
+ZEXTERN int ZEXPORT    gzungetc OF((int c, gzFile file));
+/*
+      Push one character back onto the stream to be read again later.
+   Only one character of push-back is allowed.  gzungetc() returns the
+   character pushed, or -1 on failure.  gzungetc() will fail if a
+   character has been pushed but not read yet, or if c is -1. The pushed
+   character will be discarded if the stream is repositioned with gzseek()
+   or gzrewind().
+*/
+
+ZEXTERN int ZEXPORT    gzflush OF((gzFile file, int flush));
+/*
+     Flushes all pending output into the compressed file. The parameter
+   flush is as in the deflate() function. The return value is the zlib
+   error number (see function gzerror below). gzflush returns Z_OK if
+   the flush parameter is Z_FINISH and all output could be flushed.
+     gzflush should be called only when strictly necessary because it can
+   degrade compression.
+*/
+
+ZEXTERN z_off_t ZEXPORT    gzseek OF((gzFile file,
+                                      z_off_t offset, int whence));
+/*
+      Sets the starting position for the next gzread or gzwrite on the
+   given compressed file. The offset represents a number of bytes in the
+   uncompressed data stream. The whence parameter is defined as in lseek(2);
+   the value SEEK_END is not supported.
+     If the file is opened for reading, this function is emulated but can be
+   extremely slow. If the file is opened for writing, only forward seeks are
+   supported; gzseek then compresses a sequence of zeroes up to the new
+   starting position.
+
+      gzseek returns the resulting offset location as measured in bytes from
+   the beginning of the uncompressed stream, or -1 in case of error, in
+   particular if the file is opened for writing and the new starting position
+   would be before the current position.
+*/
+
+ZEXTERN int ZEXPORT    gzrewind OF((gzFile file));
+/*
+     Rewinds the given file. This function is supported only for reading.
+
+   gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
+*/
+
+ZEXTERN z_off_t ZEXPORT    gztell OF((gzFile file));
+/*
+     Returns the starting position for the next gzread or gzwrite on the
+   given compressed file. This position represents a number of bytes in the
+   uncompressed data stream.
+
+   gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
+*/
+
+ZEXTERN int ZEXPORT gzeof OF((gzFile file));
+/*
+     Returns 1 when EOF has previously been detected reading the given
+   input stream, otherwise zero.
+*/
+
+ZEXTERN int ZEXPORT    gzclose OF((gzFile file));
+/*
+     Flushes all pending output if necessary, closes the compressed file
+   and deallocates all the (de)compression state. The return value is the zlib
+   error number (see function gzerror below).
+*/
+
+ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
+/*
+     Returns the error message for the last error which occurred on the
+   given compressed file. errnum is set to zlib error number. If an
+   error occurred in the file system and not in the compression library,
+   errnum is set to Z_ERRNO and the application may consult errno
+   to get the exact error code.
+*/
+
+ZEXTERN void ZEXPORT gzclearerr OF((gzFile file));
+/*
+     Clears the error and end-of-file flags for file. This is analogous to the
+   clearerr() function in stdio. This is useful for continuing to read a gzip
+   file that is being written concurrently.
+*/
+
+                        /* checksum functions */
+
+/*
+     These functions are not related to compression but are exported
+   anyway because they might be useful in applications using the
+   compression library.
+*/
+
+ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
+
+/*
+     Update a running Adler-32 checksum with the bytes buf[0..len-1] and
+   return the updated checksum. If buf is NULL, this function returns
+   the required initial value for the checksum.
+   An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
+   much faster. Usage example:
+
+     uLong adler = adler32(0L, Z_NULL, 0);
+
+     while (read_buffer(buffer, length) != EOF) {
+       adler = adler32(adler, buffer, length);
+     }
+     if (adler != original_adler) error();
+*/
+
+ZEXTERN uLong ZEXPORT crc32   OF((uLong crc, const Bytef *buf, uInt len));
+/*
+     Update a running crc with the bytes buf[0..len-1] and return the updated
+   crc. If buf is NULL, this function returns the required initial value
+   for the crc. Pre- and post-conditioning (one's complement) is performed
+   within this function so it shouldn't be done by the application.
+   Usage example:
+
+     uLong crc = crc32(0L, Z_NULL, 0);
+
+     while (read_buffer(buffer, length) != EOF) {
+       crc = crc32(crc, buffer, length);
+     }
+     if (crc != original_crc) error();
+*/
+
+
+                        /* various hacks, don't look :) */
+
+/* deflateInit and inflateInit are macros to allow checking the zlib version
+ * and the compiler's view of z_stream:
+ */
+ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
+                                     const char *version, int stream_size));
+ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,
+                                     const char *version, int stream_size));
+ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int  level, int  method,
+                                      int windowBits, int memLevel,
+                                      int strategy, const char *version,
+                                      int stream_size));
+ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int  windowBits,
+                                      const char *version, int stream_size));
+ZEXTERN int ZEXPORT inflateBackInit_ OF((z_stream FAR *strm, int windowBits,
+                                         unsigned char FAR *window,
+                                         const char *version,
+                                         int stream_size));
+#define deflateInit(strm, level) \
+        deflateInit_((strm), (level),       ZLIB_VERSION, sizeof(z_stream))
+#define inflateInit(strm) \
+        inflateInit_((strm),                ZLIB_VERSION, sizeof(z_stream))
+#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
+        deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
+                      (strategy),           ZLIB_VERSION, sizeof(z_stream))
+#define inflateInit2(strm, windowBits) \
+        inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))
+#define inflateBackInit(strm, windowBits, window) \
+        inflateBackInit_((strm), (windowBits), (window), \
+        ZLIB_VERSION, sizeof(z_stream))
+
+#if !defined(_ZUTIL_H) && !defined(NO_DUMMY_DECL)
+    struct internal_state {int dummy;}; /* hack for buggy compilers */
+#endif
+
+ZEXTERN const char   * ZEXPORT zError           OF((int));
+ZEXTERN int            ZEXPORT inflateSyncPoint OF((z_streamp z));
+ZEXTERN const uLongf * ZEXPORT get_crc_table    OF((void));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ZLIB_H */
Index: tags/visualization-10.5-before-10.6_test/externals/zlib/include/zutil.h
===================================================================
--- tags/visualization-10.5-before-10.6_test/externals/zlib/include/zutil.h	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/externals/zlib/include/zutil.h	(revision 1102)
@@ -0,0 +1,263 @@
+/* zutil.h -- internal interface and configuration of the compression library
+ * Copyright (C) 1995-2003 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* WARNING: this file should *not* be used by applications. It is
+   part of the implementation of the compression library and is
+   subject to change. Applications should only use zlib.h.
+ */
+
+/* @(#) $Id: zutil.h,v 1.1 2005/05/12 21:04:53 duns Exp $ */
+
+#ifndef _ZUTIL_H
+#define _ZUTIL_H
+
+#define ZLIB_INTERNAL
+#include "zlib.h"
+
+#ifdef STDC
+#  include <stddef.h>
+#  include <string.h>
+#  include <stdlib.h>
+#endif
+#ifdef NO_ERRNO_H
+    extern int errno;
+#else
+#   include <errno.h>
+#endif
+
+#ifndef local
+#  define local static
+#endif
+/* compile with -Dlocal if your debugger can't find static symbols */
+
+typedef unsigned char  uch;
+typedef uch FAR uchf;
+typedef unsigned short ush;
+typedef ush FAR ushf;
+typedef unsigned long  ulg;
+
+extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
+/* (size given to avoid silly warnings with Visual C++) */
+
+#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
+
+#define ERR_RETURN(strm,err) \
+  return (strm->msg = (char*)ERR_MSG(err), (err))
+/* To be used only when the state is known to be valid */
+
+        /* common constants */
+
+#ifndef DEF_WBITS
+#  define DEF_WBITS MAX_WBITS
+#endif
+/* default windowBits for decompression. MAX_WBITS is for compression only */
+
+#if MAX_MEM_LEVEL >= 8
+#  define DEF_MEM_LEVEL 8
+#else
+#  define DEF_MEM_LEVEL  MAX_MEM_LEVEL
+#endif
+/* default memLevel */
+
+#define STORED_BLOCK 0
+#define STATIC_TREES 1
+#define DYN_TREES    2
+/* The three kinds of block type */
+
+#define MIN_MATCH  3
+#define MAX_MATCH  258
+/* The minimum and maximum match lengths */
+
+#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
+
+        /* target dependencies */
+
+#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32))
+#  define OS_CODE  0x00
+#  if defined(__TURBOC__) || defined(__BORLANDC__)
+#    if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
+       /* Allow compilation with ANSI keywords only enabled */
+       void _Cdecl farfree( void *block );
+       void *_Cdecl farmalloc( unsigned long nbytes );
+#    else
+#      include <alloc.h>
+#    endif
+#  else /* MSC or DJGPP */
+#    include <malloc.h>
+#  endif
+#endif
+
+#ifdef AMIGA
+#  define OS_CODE  0x01
+#endif
+
+#if defined(VAXC) || defined(VMS)
+#  define OS_CODE  0x02
+#  define F_OPEN(name, mode) \
+     fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
+#endif
+
+#if defined(ATARI) || defined(atarist)
+#  define OS_CODE  0x05
+#endif
+
+#ifdef OS2
+#  define OS_CODE  0x06
+#endif
+
+#if defined(MACOS) || defined(TARGET_OS_MAC)
+#  define OS_CODE  0x07
+#  if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
+#    include <unix.h> /* for fdopen */
+#  else
+#    ifndef fdopen
+#      define fdopen(fd,mode) NULL /* No fdopen() */
+#    endif
+#  endif
+#endif
+
+#ifdef TOPS20
+#  define OS_CODE  0x0a
+#endif
+
+#ifdef WIN32
+#  ifndef __CYGWIN__  /* Cygwin is Unix, not Win32 */
+#    define OS_CODE  0x0b
+#  endif
+#endif
+
+#ifdef __50SERIES /* Prime/PRIMOS */
+#  define OS_CODE  0x0f
+#endif
+
+#if defined(_BEOS_) || defined(RISCOS)
+#  define fdopen(fd,mode) NULL /* No fdopen() */
+#endif
+
+#if (defined(_MSC_VER) && (_MSC_VER > 600))
+#  if defined(_WIN32_WCE)
+#    define fdopen(fd,mode) NULL /* No fdopen() */
+#    ifndef _PTRDIFF_T_DEFINED
+       typedef int ptrdiff_t;
+#      define _PTRDIFF_T_DEFINED
+#    endif
+#  else
+#    define fdopen(fd,type)  _fdopen(fd,type)
+#  endif
+#endif
+
+        /* common defaults */
+
+#ifndef OS_CODE
+#  define OS_CODE  0x03  /* assume Unix */
+#endif
+
+#ifndef F_OPEN
+#  define F_OPEN(name, mode) fopen((name), (mode))
+#endif
+
+         /* functions */
+
+#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550)
+#  ifndef HAVE_VSNPRINTF
+#    define HAVE_VSNPRINTF
+#  endif
+#endif
+#if defined(__CYGWIN__)
+#  ifndef HAVE_VSNPRINTF
+#    define HAVE_VSNPRINTF
+#  endif
+#endif
+#ifndef HAVE_VSNPRINTF
+#  ifdef MSDOS
+     /* vsnprintf may exist on some MS-DOS compilers (DJGPP?),
+        but for now we just assume it doesn't. */
+#    define NO_vsnprintf
+#  endif
+#  ifdef __TURBOC__
+#    define NO_vsnprintf
+#  endif
+#  ifdef WIN32
+     /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */
+#    if !defined(vsnprintf) && !defined(NO_vsnprintf)
+#      define vsnprintf _vsnprintf
+#    endif
+#  endif
+#  ifdef __SASC
+#    define NO_vsnprintf
+#  endif
+#endif
+#ifdef VMS
+#  define NO_vsnprintf
+#endif
+
+#ifdef HAVE_STRERROR
+#  ifndef VMS
+     extern char *strerror OF((int));
+#  endif
+#  define zstrerror(errnum) strerror(errnum)
+#else
+#  define zstrerror(errnum) ""
+#endif
+
+#if defined(pyr)
+#  define NO_MEMCPY
+#endif
+#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
+ /* Use our own functions for small and medium model with MSC <= 5.0.
+  * You may have to use the same strategy for Borland C (untested).
+  * The __SC__ check is for Symantec.
+  */
+#  define NO_MEMCPY
+#endif
+#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
+#  define HAVE_MEMCPY
+#endif
+#ifdef HAVE_MEMCPY
+#  ifdef SMALL_MEDIUM /* MSDOS small or medium model */
+#    define zmemcpy _fmemcpy
+#    define zmemcmp _fmemcmp
+#    define zmemzero(dest, len) _fmemset(dest, 0, len)
+#  else
+#    define zmemcpy memcpy
+#    define zmemcmp memcmp
+#    define zmemzero(dest, len) memset(dest, 0, len)
+#  endif
+#else
+   extern void zmemcpy  OF((Bytef* dest, const Bytef* source, uInt len));
+   extern int  zmemcmp  OF((const Bytef* s1, const Bytef* s2, uInt len));
+   extern void zmemzero OF((Bytef* dest, uInt len));
+#endif
+
+/* Diagnostic functions */
+#ifdef DEBUG
+#  include <stdio.h>
+   extern int z_verbose;
+   extern void z_error    OF((char *m));
+#  define Assert(cond,msg) {if(!(cond)) z_error(msg);}
+#  define Trace(x) {if (z_verbose>=0) fprintf x ;}
+#  define Tracev(x) {if (z_verbose>0) fprintf x ;}
+#  define Tracevv(x) {if (z_verbose>1) fprintf x ;}
+#  define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}
+#  define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}
+#else
+#  define Assert(cond,msg)
+#  define Trace(x)
+#  define Tracev(x)
+#  define Tracevv(x)
+#  define Tracec(c,x)
+#  define Tracecv(c,x)
+#endif
+
+
+voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size));
+void   zcfree  OF((voidpf opaque, voidpf ptr));
+
+#define ZALLOC(strm, items, size) \
+           (*((strm)->zalloc))((strm)->opaque, (items), (size))
+#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
+#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
+
+#endif /* _ZUTIL_H */
Index: tags/visualization-10.5-before-10.6_test/externals/zlib/src/adler32.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/externals/zlib/src/adler32.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/externals/zlib/src/adler32.cc	(revision 1102)
@@ -0,0 +1,71 @@
+/* adler32.c -- compute the Adler-32 checksum of a data stream
+ * Copyright (C) 1995-2003 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* @(#) $Id: adler32.cc,v 1.1 2005/05/12 21:04:53 duns Exp $ */
+
+#define ZLIB_INTERNAL
+#include "zlib.h"
+
+#define BASE 65521UL    /* largest prime smaller than 65536 */
+#define NMAX 5552
+/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
+
+#define DO1(buf,i)  {s1 += buf[i]; s2 += s1;}
+#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
+#define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
+#define DO8(buf,i)  DO4(buf,i); DO4(buf,i+4);
+#define DO16(buf)   DO8(buf,0); DO8(buf,8);
+
+#ifdef NO_DIVIDE
+#  define MOD(a) \
+    do { \
+        if (a >= (BASE << 16)) a -= (BASE << 16); \
+        if (a >= (BASE << 15)) a -= (BASE << 15); \
+        if (a >= (BASE << 14)) a -= (BASE << 14); \
+        if (a >= (BASE << 13)) a -= (BASE << 13); \
+        if (a >= (BASE << 12)) a -= (BASE << 12); \
+        if (a >= (BASE << 11)) a -= (BASE << 11); \
+        if (a >= (BASE << 10)) a -= (BASE << 10); \
+        if (a >= (BASE << 9)) a -= (BASE << 9); \
+        if (a >= (BASE << 8)) a -= (BASE << 8); \
+        if (a >= (BASE << 7)) a -= (BASE << 7); \
+        if (a >= (BASE << 6)) a -= (BASE << 6); \
+        if (a >= (BASE << 5)) a -= (BASE << 5); \
+        if (a >= (BASE << 4)) a -= (BASE << 4); \
+        if (a >= (BASE << 3)) a -= (BASE << 3); \
+        if (a >= (BASE << 2)) a -= (BASE << 2); \
+        if (a >= (BASE << 1)) a -= (BASE << 1); \
+        if (a >= BASE) a -= BASE; \
+    } while (0)
+#else
+#  define MOD(a) a %= BASE
+#endif
+
+/* ========================================================================= */
+uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len)
+{
+    unsigned long s1 = adler & 0xffff;
+    unsigned long s2 = (adler >> 16) & 0xffff;
+    int k;
+
+    if (buf == Z_NULL) return 1L;
+
+    while (len > 0) {
+        k = len < NMAX ? (int)len : NMAX;
+        len -= k;
+        while (k >= 16) {
+            DO16(buf);
+            buf += 16;
+            k -= 16;
+        }
+        if (k != 0) do {
+            s1 += *buf++;
+            s2 += s1;
+        } while (--k);
+        MOD(s1);
+        MOD(s2);
+    }
+    return (s2 << 16) | s1;
+}
Index: tags/visualization-10.5-before-10.6_test/externals/zlib/src/compress.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/externals/zlib/src/compress.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/externals/zlib/src/compress.cc	(revision 1102)
@@ -0,0 +1,69 @@
+/* compress.c -- compress a memory buffer
+ * Copyright (C) 1995-2002 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* @(#) $Id: compress.cc,v 1.1 2005/05/12 21:04:53 duns Exp $ */
+
+#define ZLIB_INTERNAL
+#include "zlib.h"
+
+/* ===========================================================================
+     Compresses the source buffer into the destination buffer. The level
+   parameter has the same meaning as in deflateInit.  sourceLen is the byte
+   length of the source buffer. Upon entry, destLen is the total size of the
+   destination buffer, which must be at least 0.1% larger than sourceLen plus
+   12 bytes. Upon exit, destLen is the actual size of the compressed buffer.
+
+     compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+   memory, Z_BUF_ERROR if there was not enough room in the output buffer,
+   Z_STREAM_ERROR if the level parameter is invalid.
+*/
+int ZEXPORT compress2 (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen, int level)
+{
+    z_stream stream;
+    int err;
+
+    stream.next_in = (Bytef*)source;
+    stream.avail_in = (uInt)sourceLen;
+#ifdef MAXSEG_64K
+    /* Check for source > 64K on 16-bit machine: */
+    if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
+#endif
+    stream.next_out = dest;
+    stream.avail_out = (uInt)*destLen;
+    if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
+
+    stream.zalloc = (alloc_func)0;
+    stream.zfree = (free_func)0;
+    stream.opaque = (voidpf)0;
+
+    err = deflateInit(&stream, level);
+    if (err != Z_OK) return err;
+
+    err = deflate(&stream, Z_FINISH);
+    if (err != Z_STREAM_END) {
+        deflateEnd(&stream);
+        return err == Z_OK ? Z_BUF_ERROR : err;
+    }
+    *destLen = stream.total_out;
+
+    err = deflateEnd(&stream);
+    return err;
+}
+
+/* ===========================================================================
+ */
+int ZEXPORT compress (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)
+{
+    return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
+}
+
+/* ===========================================================================
+     If the default memLevel or windowBits for deflateInit() is changed, then
+   this function needs to be updated.
+ */
+uLong ZEXPORT compressBound (uLong sourceLen)
+{
+    return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + 11;
+}
Index: tags/visualization-10.5-before-10.6_test/externals/zlib/src/crc32.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/externals/zlib/src/crc32.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/externals/zlib/src/crc32.cc	(revision 1102)
@@ -0,0 +1,322 @@
+/* crc32.c -- compute the CRC-32 of a data stream
+ * Copyright (C) 1995-2003 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ *
+ * Thanks to Rodney Brown <rbrown64@csc.com.au> for his contribution of faster
+ * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing
+ * tables for updating the shift register in one step with three exclusive-ors
+ * instead of four steps with four exclusive-ors.  This results about a factor
+ * of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3.
+ */
+
+/* @(#) $Id: crc32.cc,v 1.1 2005/05/12 21:04:53 duns Exp $ */
+
+/*
+  Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore
+  protection on the static variables used to control the first-use generation
+  of the crc tables.  Therefore, if you #define DYNAMIC_CRC_TABLE, you should
+  first call get_crc_table() to initialize the tables before allowing more than
+  one thread to use crc32().
+ */
+
+#ifdef MAKECRCH
+#  include <stdio.h>
+#  ifndef DYNAMIC_CRC_TABLE
+#    define DYNAMIC_CRC_TABLE
+#  endif /* !DYNAMIC_CRC_TABLE */
+#endif /* MAKECRCH */
+
+#include "zutil.h"      /* for STDC and FAR definitions */
+
+#define local static
+
+/* Find a four-byte integer type for crc32_little() and crc32_big(). */
+#ifndef NOBYFOUR
+#  ifdef STDC           /* need ANSI C limits.h to determine sizes */
+#    include <limits.h>
+#    define BYFOUR
+#    if (UINT_MAX == 0xffffffffUL)
+       typedef unsigned int u4;
+#    else
+#      if (ULONG_MAX == 0xffffffffUL)
+         typedef unsigned long u4;
+#      else
+#        if (USHRT_MAX == 0xffffffffUL)
+           typedef unsigned short u4;
+#        else
+#          undef BYFOUR     /* can't find a four-byte integer type! */
+#        endif
+#      endif
+#    endif
+#  endif /* STDC */
+#endif /* !NOBYFOUR */
+
+/* Definitions for doing the crc four data bytes at a time. */
+#ifdef BYFOUR
+#  define REV(w) (((w)>>24)+(((w)>>8)&0xff00)+ \
+                (((w)&0xff00)<<8)+(((w)&0xff)<<24))
+   local unsigned long crc32_little OF((unsigned long,
+                        const unsigned char FAR *, unsigned));
+   local unsigned long crc32_big OF((unsigned long,
+                        const unsigned char FAR *, unsigned));
+#  define TBLS 8
+#else
+#  define TBLS 1
+#endif /* BYFOUR */
+
+#ifdef DYNAMIC_CRC_TABLE
+
+local volatile int crc_table_empty = 1;
+local unsigned long FAR crc_table[TBLS][256];
+local void make_crc_table OF((void));
+#ifdef MAKECRCH
+   local void write_table OF((FILE *, const unsigned long FAR *));
+#endif /* MAKECRCH */
+
+/*
+  Generate tables for a byte-wise 32-bit CRC calculation on the polynomial:
+  x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1.
+
+  Polynomials over GF(2) are represented in binary, one bit per coefficient,
+  with the lowest powers in the most significant bit.  Then adding polynomials
+  is just exclusive-or, and multiplying a polynomial by x is a right shift by
+  one.  If we call the above polynomial p, and represent a byte as the
+  polynomial q, also with the lowest power in the most significant bit (so the
+  byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p,
+  where a mod b means the remainder after dividing a by b.
+
+  This calculation is done using the shift-register method of multiplying and
+  taking the remainder.  The register is initialized to zero, and for each
+  incoming bit, x^32 is added mod p to the register if the bit is a one (where
+  x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by
+  x (which is shifting right by one and adding x^32 mod p if the bit shifted
+  out is a one).  We start with the highest power (least significant bit) of
+  q and repeat for all eight bits of q.
+
+  The first table is simply the CRC of all possible eight bit values.  This is
+  all the information needed to generate CRCs on data a byte at a time for all
+  combinations of CRC register values and incoming bytes.  The remaining tables
+  allow for word-at-a-time CRC calculation for both big-endian and little-
+  endian machines, where a word is four bytes.
+*/
+local void make_crc_table()
+{
+    unsigned long c;
+    int n, k;
+    unsigned long poly;                 /* polynomial exclusive-or pattern */
+    /* terms of polynomial defining this crc (except x^32): */
+    static volatile int first = 1;      /* flag to limit concurrent making */
+    static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26};
+
+    /* See if another task is already doing this (not thread-safe, but better
+       than nothing -- significantly reduces duration of vulnerability in
+       case the advice about DYNAMIC_CRC_TABLE is ignored) */
+    if (first) {
+        first = 0;
+
+        /* make exclusive-or pattern from polynomial (0xedb88320UL) */
+        poly = 0UL;
+        for (n = 0; n < sizeof(p)/sizeof(unsigned char); n++)
+            poly |= 1UL << (31 - p[n]);
+
+        /* generate a crc for every 8-bit value */
+        for (n = 0; n < 256; n++) {
+            c = (unsigned long)n;
+            for (k = 0; k < 8; k++)
+                c = c & 1 ? poly ^ (c >> 1) : c >> 1;
+            crc_table[0][n] = c;
+        }
+
+#ifdef BYFOUR
+        /* generate crc for each value followed by one, two, and three zeros,
+           and then the byte reversal of those as well as the first table */
+        for (n = 0; n < 256; n++) {
+            c = crc_table[0][n];
+            crc_table[4][n] = REV(c);
+            for (k = 1; k < 4; k++) {
+                c = crc_table[0][c & 0xff] ^ (c >> 8);
+                crc_table[k][n] = c;
+                crc_table[k + 4][n] = REV(c);
+            }
+        }
+#endif /* BYFOUR */
+
+        crc_table_empty = 0;
+    }
+    else {      /* not first */
+        /* wait for the other guy to finish (not efficient, but rare) */
+        while (crc_table_empty)
+            ;
+    }
+
+#ifdef MAKECRCH
+    /* write out CRC tables to crc32.h */
+    {
+        FILE *out;
+
+        out = fopen("crc32.h", "w");
+        if (out == NULL) return;
+        fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n");
+        fprintf(out, " * Generated automatically by crc32.c\n */\n\n");
+        fprintf(out, "local const unsigned long FAR ");
+        fprintf(out, "crc_table[TBLS][256] =\n{\n  {\n");
+        write_table(out, crc_table[0]);
+#  ifdef BYFOUR
+        fprintf(out, "#ifdef BYFOUR\n");
+        for (k = 1; k < 8; k++) {
+            fprintf(out, "  },\n  {\n");
+            write_table(out, crc_table[k]);
+        }
+        fprintf(out, "#endif\n");
+#  endif /* BYFOUR */
+        fprintf(out, "  }\n};\n");
+        fclose(out);
+    }
+#endif /* MAKECRCH */
+}
+
+#ifdef MAKECRCH
+local void write_table(FILE *out, const unsigned long FAR *table)
+{
+    int n;
+
+    for (n = 0; n < 256; n++)
+        fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : "    ", table[n],
+                n == 255 ? "\n" : (n % 5 == 4 ? ",\n" : ", "));
+}
+#endif /* MAKECRCH */
+
+#else /* !DYNAMIC_CRC_TABLE */
+/* ========================================================================
+ * Tables of CRC-32s of all single-byte values, made by make_crc_table().
+ */
+#include "crc32.h"
+#endif /* DYNAMIC_CRC_TABLE */
+
+/* =========================================================================
+ * This function can be used by asm versions of crc32()
+ */
+const unsigned long FAR * ZEXPORT get_crc_table()
+{
+#ifdef DYNAMIC_CRC_TABLE
+    if (crc_table_empty)
+        make_crc_table();
+#endif /* DYNAMIC_CRC_TABLE */
+    return (const unsigned long FAR *)crc_table;
+}
+
+/* ========================================================================= */
+#define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8)
+#define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1
+
+/* ========================================================================= */
+unsigned long ZEXPORT crc32(unsigned long crc, const unsigned char FAR *buf, unsigned len)
+{
+    if (buf == Z_NULL) return 0UL;
+
+#ifdef DYNAMIC_CRC_TABLE
+    if (crc_table_empty)
+        make_crc_table();
+#endif /* DYNAMIC_CRC_TABLE */
+
+#ifdef BYFOUR
+    if (sizeof(void *) == sizeof(ptrdiff_t)) {
+        u4 endian;
+
+        endian = 1;
+        if (*((unsigned char *)(&endian)))
+            return crc32_little(crc, buf, len);
+        else
+            return crc32_big(crc, buf, len);
+    }
+#endif /* BYFOUR */
+    crc = crc ^ 0xffffffffUL;
+    while (len >= 8) {
+        DO8;
+        len -= 8;
+    }
+    if (len) do {
+        DO1;
+    } while (--len);
+    return crc ^ 0xffffffffUL;
+}
+
+#ifdef BYFOUR
+
+/* ========================================================================= */
+#define DOLIT4 c ^= *buf4++; \
+        c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \
+            crc_table[1][(c >> 16) & 0xff] ^ crc_table[0][c >> 24]
+#define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4
+
+/* ========================================================================= */
+local unsigned long crc32_little(unsigned long crc, const unsigned char FAR *buf, unsigned len)
+{
+    register u4 c;
+    register const u4 FAR *buf4;
+
+    c = (u4)crc;
+    c = ~c;
+    while (len && ((ptrdiff_t)buf & 3)) {
+        c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8);
+        len--;
+    }
+
+    buf4 = (const u4 FAR *)buf;
+    while (len >= 32) {
+        DOLIT32;
+        len -= 32;
+    }
+    while (len >= 4) {
+        DOLIT4;
+        len -= 4;
+    }
+    buf = (const unsigned char FAR *)buf4;
+
+    if (len) do {
+        c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8);
+    } while (--len);
+    c = ~c;
+    return (unsigned long)c;
+}
+
+/* ========================================================================= */
+#define DOBIG4 c ^= *++buf4; \
+        c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \
+            crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24]
+#define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4
+
+/* ========================================================================= */
+local unsigned long crc32_big(unsigned long crc, const unsigned char FAR *buf, unsigned len)
+{
+    register u4 c;
+    register const u4 FAR *buf4;
+
+    c = REV((u4)crc);
+    c = ~c;
+    while (len && ((ptrdiff_t)buf & 3)) {
+        c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8);
+        len--;
+    }
+
+    buf4 = (const u4 FAR *)buf;
+    buf4--;
+    while (len >= 32) {
+        DOBIG32;
+        len -= 32;
+    }
+    while (len >= 4) {
+        DOBIG4;
+        len -= 4;
+    }
+    buf4++;
+    buf = (const unsigned char FAR *)buf4;
+
+    if (len) do {
+        c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8);
+    } while (--len);
+    c = ~c;
+    return (unsigned long)(REV(c));
+}
+
+#endif /* BYFOUR */
Index: tags/visualization-10.5-before-10.6_test/externals/zlib/src/deflate.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/externals/zlib/src/deflate.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/externals/zlib/src/deflate.cc	(revision 1102)
@@ -0,0 +1,1452 @@
+/* deflate.c -- compress data using the deflation algorithm
+ * Copyright (C) 1995-2004 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/*
+ *  ALGORITHM
+ *
+ *      The "deflation" process depends on being able to identify portions
+ *      of the input text which are identical to earlier input (within a
+ *      sliding window trailing behind the input currently being processed).
+ *
+ *      The most straightforward technique turns out to be the fastest for
+ *      most input files: try all possible matches and select the longest.
+ *      The key feature of this algorithm is that insertions into the string
+ *      dictionary are very simple and thus fast, and deletions are avoided
+ *      completely. Insertions are performed at each input character, whereas
+ *      string matches are performed only when the previous match ends. So it
+ *      is preferable to spend more time in matches to allow very fast string
+ *      insertions and avoid deletions. The matching algorithm for small
+ *      strings is inspired from that of Rabin & Karp. A brute force approach
+ *      is used to find longer strings when a small match has been found.
+ *      A similar algorithm is used in comic (by Jan-Mark Wams) and freeze
+ *      (by Leonid Broukhis).
+ *         A previous version of this file used a more sophisticated algorithm
+ *      (by Fiala and Greene) which is guaranteed to run in linear amortized
+ *      time, but has a larger average cost, uses more memory and is patented.
+ *      However the F&G algorithm may be faster for some highly redundant
+ *      files if the parameter max_chain_length (described below) is too large.
+ *
+ *  ACKNOWLEDGEMENTS
+ *
+ *      The idea of lazy evaluation of matches is due to Jan-Mark Wams, and
+ *      I found it in 'freeze' written by Leonid Broukhis.
+ *      Thanks to many people for bug reports and testing.
+ *
+ *  REFERENCES
+ *
+ *      Deutsch, L.P.,"DEFLATE Compressed Data Format Specification".
+ *      Available in http://www.ietf.org/rfc/rfc1951.txt
+ *
+ *      A description of the Rabin and Karp algorithm is given in the book
+ *         "Algorithms" by R. Sedgewick, Addison-Wesley, p252.
+ *
+ *      Fiala,E.R., and Greene,D.H.
+ *         Data Compression with Finite Windows, Comm.ACM, 32,4 (1989) 490-595
+ *
+ */
+
+/* @(#) $Id: deflate.cc,v 1.1 2005/05/12 21:04:53 duns Exp $ */
+
+#include "deflate.h"
+
+const char deflate_copyright[] =
+   " deflate 1.2.2 Copyright 1995-2004 Jean-loup Gailly ";
+/*
+  If you use the zlib library in a product, an acknowledgment is welcome
+  in the documentation of your product. If for some reason you cannot
+  include such an acknowledgment, I would appreciate that you keep this
+  copyright string in the executable of your product.
+ */
+
+/* ===========================================================================
+ *  Function prototypes.
+ */
+typedef enum {
+    need_more,      /* block not completed, need more input or more output */
+    block_done,     /* block flush performed */
+    finish_started, /* finish started, need only more output at next deflate */
+    finish_done     /* finish done, accept no more input or output */
+} block_state;
+
+typedef block_state (*compress_func) OF((deflate_state *s, int flush));
+/* Compression function. Returns the block state after the call. */
+
+local void fill_window    OF((deflate_state *s));
+local block_state deflate_stored OF((deflate_state *s, int flush));
+local block_state deflate_fast   OF((deflate_state *s, int flush));
+#ifndef FASTEST
+local block_state deflate_slow   OF((deflate_state *s, int flush));
+#endif
+local void lm_init        OF((deflate_state *s));
+local void putShortMSB    OF((deflate_state *s, uInt b));
+local void flush_pending  OF((z_streamp strm));
+local int read_buf        OF((z_streamp strm, Bytef *buf, unsigned size));
+#ifndef FASTEST
+#ifdef ASMV
+      void match_init OF((void)); /* asm code initialization */
+      uInt longest_match  OF((deflate_state *s, IPos cur_match));
+#else
+local uInt longest_match  OF((deflate_state *s, IPos cur_match));
+#endif
+#endif
+local uInt longest_match_fast OF((deflate_state *s, IPos cur_match));
+
+#ifdef DEBUG
+local  void check_match OF((deflate_state *s, IPos start, IPos match,
+                            int length));
+#endif
+
+/* ===========================================================================
+ * Local data
+ */
+
+#define NIL 0
+/* Tail of hash chains */
+
+#ifndef TOO_FAR
+#  define TOO_FAR 4096
+#endif
+/* Matches of length 3 are discarded if their distance exceeds TOO_FAR */
+
+#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
+/* Minimum amount of lookahead, except at the end of the input file.
+ * See deflate.c for comments about the MIN_MATCH+1.
+ */
+
+/* Values for max_lazy_match, good_match and max_chain_length, depending on
+ * the desired pack level (0..9). The values given below have been tuned to
+ * exclude worst case performance for pathological files. Better values may be
+ * found for specific files.
+ */
+typedef struct config_s {
+   ush good_length; /* reduce lazy search above this match length */
+   ush max_lazy;    /* do not perform lazy search above this match length */
+   ush nice_length; /* quit search above this match length */
+   ush max_chain;
+   compress_func func;
+} config;
+
+#ifdef FASTEST
+local const config configuration_table[2] = {
+/*      good lazy nice chain */
+/* 0 */ {0,    0,  0,    0, deflate_stored},  /* store only */
+/* 1 */ {4,    4,  8,    4, deflate_fast}}; /* max speed, no lazy matches */
+#else
+local const config configuration_table[10] = {
+/*      good lazy nice chain */
+/* 0 */ {0,    0,  0,    0, deflate_stored},  /* store only */
+/* 1 */ {4,    4,  8,    4, deflate_fast}, /* max speed, no lazy matches */
+/* 2 */ {4,    5, 16,    8, deflate_fast},
+/* 3 */ {4,    6, 32,   32, deflate_fast},
+
+/* 4 */ {4,    4, 16,   16, deflate_slow},  /* lazy matches */
+/* 5 */ {8,   16, 32,   32, deflate_slow},
+/* 6 */ {8,   16, 128, 128, deflate_slow},
+/* 7 */ {8,   32, 128, 256, deflate_slow},
+/* 8 */ {32, 128, 258, 1024, deflate_slow},
+/* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* max compression */
+#endif
+
+/* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4
+ * For deflate_fast() (levels <= 3) good is ignored and lazy has a different
+ * meaning.
+ */
+
+#define EQUAL 0
+/* result of memcmp for equal strings */
+
+#ifndef NO_DUMMY_DECL
+struct static_tree_desc_s {int dummy;}; /* for buggy compilers */
+#endif
+
+/* ===========================================================================
+ * Update a hash value with the given input byte
+ * IN  assertion: all calls to to UPDATE_HASH are made with consecutive
+ *    input characters, so that a running hash key can be computed from the
+ *    previous key instead of complete recalculation each time.
+ */
+#define UPDATE_HASH(s,h,c) (h = (((h)<<s->hash_shift) ^ (c)) & s->hash_mask)
+
+
+/* ===========================================================================
+ * Insert string str in the dictionary and set match_head to the previous head
+ * of the hash chain (the most recent string with same hash key). Return
+ * the previous length of the hash chain.
+ * If this file is compiled with -DFASTEST, the compression level is forced
+ * to 1, and no hash chains are maintained.
+ * IN  assertion: all calls to to INSERT_STRING are made with consecutive
+ *    input characters and the first MIN_MATCH bytes of str are valid
+ *    (except for the last MIN_MATCH-1 bytes of the input file).
+ */
+#ifdef FASTEST
+#define INSERT_STRING(s, str, match_head) \
+   (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
+    match_head = s->head[s->ins_h], \
+    s->head[s->ins_h] = (Pos)(str))
+#else
+#define INSERT_STRING(s, str, match_head) \
+   (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
+    match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \
+    s->head[s->ins_h] = (Pos)(str))
+#endif
+
+/* ===========================================================================
+ * Initialize the hash table (avoiding 64K overflow for 16 bit systems).
+ * prev[] will be initialized on the fly.
+ */
+#define CLEAR_HASH(s) \
+    s->head[s->hash_size-1] = NIL; \
+    zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head));
+
+/* ========================================================================= */
+int ZEXPORT deflateInit_(z_streamp strm, int level, const char *version, int stream_size)
+{
+    return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL,
+                         Z_DEFAULT_STRATEGY, version, stream_size);
+    /* To do: ignore strm->next_in if we use it as window */
+}
+
+/* ========================================================================= */
+int ZEXPORT deflateInit2_(z_streamp strm, int level, int method, int windowBits, int memLevel, int strategy,
+                  const char *version, int stream_size)
+{
+    deflate_state *s;
+    int wrap = 1;
+    static const char my_version[] = ZLIB_VERSION;
+
+    ushf *overlay;
+    /* We overlay pending_buf and d_buf+l_buf. This works since the average
+     * output size for (length,distance) codes is <= 24 bits.
+     */
+
+    if (version == Z_NULL || version[0] != my_version[0] ||
+        stream_size != sizeof(z_stream)) {
+        return Z_VERSION_ERROR;
+    }
+    if (strm == Z_NULL) return Z_STREAM_ERROR;
+
+    strm->msg = Z_NULL;
+    if (strm->zalloc == (alloc_func)0) {
+        strm->zalloc = zcalloc;
+        strm->opaque = (voidpf)0;
+    }
+    if (strm->zfree == (free_func)0) strm->zfree = zcfree;
+
+#ifdef FASTEST
+    if (level != 0) level = 1;
+#else
+    if (level == Z_DEFAULT_COMPRESSION) level = 6;
+#endif
+
+    if (windowBits < 0) { /* suppress zlib wrapper */
+        wrap = 0;
+        windowBits = -windowBits;
+    }
+#ifdef GZIP
+    else if (windowBits > 15) {
+        wrap = 2;       /* write gzip wrapper instead */
+        windowBits -= 16;
+    }
+#endif
+    if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED ||
+        windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||
+        strategy < 0 || strategy > Z_RLE) {
+        return Z_STREAM_ERROR;
+    }
+    if (windowBits == 8) windowBits = 9;  /* until 256-byte window bug fixed */
+    s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state));
+    if (s == Z_NULL) return Z_MEM_ERROR;
+    strm->state = (struct internal_state FAR *)s;
+    s->strm = strm;
+
+    s->wrap = wrap;
+    s->w_bits = windowBits;
+    s->w_size = 1 << s->w_bits;
+    s->w_mask = s->w_size - 1;
+
+    s->hash_bits = memLevel + 7;
+    s->hash_size = 1 << s->hash_bits;
+    s->hash_mask = s->hash_size - 1;
+    s->hash_shift =  ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH);
+
+    s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte));
+    s->prev   = (Posf *)  ZALLOC(strm, s->w_size, sizeof(Pos));
+    s->head   = (Posf *)  ZALLOC(strm, s->hash_size, sizeof(Pos));
+
+    s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */
+
+    overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);
+    s->pending_buf = (uchf *) overlay;
+    s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L);
+
+    if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
+        s->pending_buf == Z_NULL) {
+        s->status = FINISH_STATE;
+        strm->msg = (char*)ERR_MSG(Z_MEM_ERROR);
+        deflateEnd (strm);
+        return Z_MEM_ERROR;
+    }
+    s->d_buf = overlay + s->lit_bufsize/sizeof(ush);
+    s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;
+
+    s->level = level;
+    s->strategy = strategy;
+    s->method = (Byte)method;
+
+    return deflateReset(strm);
+}
+
+/* ========================================================================= */
+int ZEXPORT deflateSetDictionary (z_streamp strm, const Bytef *dictionary, uInt dictLength)
+{
+    deflate_state *s;
+    uInt length = dictLength;
+    uInt n;
+    IPos hash_head = 0;
+
+    if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL ||
+        strm->state->wrap == 2 ||
+        (strm->state->wrap == 1 && strm->state->status != INIT_STATE))
+        return Z_STREAM_ERROR;
+
+    s = strm->state;
+    if (s->wrap)
+        strm->adler = adler32(strm->adler, dictionary, dictLength);
+
+    if (length < MIN_MATCH) return Z_OK;
+    if (length > MAX_DIST(s)) {
+        length = MAX_DIST(s);
+#ifndef USE_DICT_HEAD
+        dictionary += dictLength - length; /* use the tail of the dictionary */
+#endif
+    }
+    zmemcpy(s->window, dictionary, length);
+    s->strstart = length;
+    s->block_start = (long)length;
+
+    /* Insert all strings in the hash table (except for the last two bytes).
+     * s->lookahead stays null, so s->ins_h will be recomputed at the next
+     * call of fill_window.
+     */
+    s->ins_h = s->window[0];
+    UPDATE_HASH(s, s->ins_h, s->window[1]);
+    for (n = 0; n <= length - MIN_MATCH; n++) {
+        INSERT_STRING(s, n, hash_head);
+    }
+    if (hash_head) hash_head = 0;  /* to make compiler happy */
+    return Z_OK;
+}
+
+/* ========================================================================= */
+int ZEXPORT deflateReset (z_streamp strm)
+{
+    deflate_state *s;
+
+    if (strm == Z_NULL || strm->state == Z_NULL ||
+        strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) {
+        return Z_STREAM_ERROR;
+    }
+
+    strm->total_in = strm->total_out = 0;
+    strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */
+    strm->data_type = Z_UNKNOWN;
+
+    s = (deflate_state *)strm->state;
+    s->pending = 0;
+    s->pending_out = s->pending_buf;
+
+    if (s->wrap < 0) {
+        s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */
+    }
+    s->status = s->wrap ? INIT_STATE : BUSY_STATE;
+    strm->adler =
+#ifdef GZIP
+        s->wrap == 2 ? crc32(0L, Z_NULL, 0) :
+#endif
+        adler32(0L, Z_NULL, 0);
+    s->last_flush = Z_NO_FLUSH;
+
+    _tr_init(s);
+    lm_init(s);
+
+    return Z_OK;
+}
+
+/* ========================================================================= */
+int ZEXPORT deflatePrime (z_streamp strm, int bits, int value)
+{
+    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+    strm->state->bi_valid = bits;
+    strm->state->bi_buf = (ush)(value & ((1 << bits) - 1));
+    return Z_OK;
+}
+
+/* ========================================================================= */
+int ZEXPORT deflateParams(z_streamp strm, int level, int strategy)
+{
+    deflate_state *s;
+    compress_func func;
+    int err = Z_OK;
+
+    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+    s = strm->state;
+
+#ifdef FASTEST
+    if (level != 0) level = 1;
+#else
+    if (level == Z_DEFAULT_COMPRESSION) level = 6;
+#endif
+    if (level < 0 || level > 9 || strategy < 0 || strategy > Z_RLE) {
+        return Z_STREAM_ERROR;
+    }
+    func = configuration_table[s->level].func;
+
+    if (func != configuration_table[level].func && strm->total_in != 0) {
+        /* Flush the last buffer: */
+        err = deflate(strm, Z_PARTIAL_FLUSH);
+    }
+    if (s->level != level) {
+        s->level = level;
+        s->max_lazy_match   = configuration_table[level].max_lazy;
+        s->good_match       = configuration_table[level].good_length;
+        s->nice_match       = configuration_table[level].nice_length;
+        s->max_chain_length = configuration_table[level].max_chain;
+    }
+    s->strategy = strategy;
+    return err;
+}
+
+/* =========================================================================
+ * For the default windowBits of 15 and memLevel of 8, this function returns
+ * a close to exact, as well as small, upper bound on the compressed size.
+ * They are coded as constants here for a reason--if the #define's are
+ * changed, then this function needs to be changed as well.  The return
+ * value for 15 and 8 only works for those exact settings.
+ *
+ * For any setting other than those defaults for windowBits and memLevel,
+ * the value returned is a conservative worst case for the maximum expansion
+ * resulting from using fixed blocks instead of stored blocks, which deflate
+ * can emit on compressed data for some combinations of the parameters.
+ *
+ * This function could be more sophisticated to provide closer upper bounds
+ * for every combination of windowBits and memLevel, as well as wrap.
+ * But even the conservative upper bound of about 14% expansion does not
+ * seem onerous for output buffer allocation.
+ */
+uLong ZEXPORT deflateBound(z_streamp strm, uLong sourceLen)
+{
+    deflate_state *s;
+    uLong destLen;
+
+    /* conservative upper bound */
+    destLen = sourceLen +
+              ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 11;
+
+    /* if can't get parameters, return conservative bound */
+    if (strm == Z_NULL || strm->state == Z_NULL)
+        return destLen;
+
+    /* if not default parameters, return conservative bound */
+    s = strm->state;
+    if (s->w_bits != 15 || s->hash_bits != 8 + 7)
+        return destLen;
+
+    /* default settings: return tight bound for that case */
+    return compressBound(sourceLen);
+}
+
+/* =========================================================================
+ * Put a short in the pending buffer. The 16-bit value is put in MSB order.
+ * IN assertion: the stream state is correct and there is enough room in
+ * pending_buf.
+ */
+local void putShortMSB (deflate_state *s, uInt b)
+{
+    put_byte(s, (Byte)(b >> 8));
+    put_byte(s, (Byte)(b & 0xff));
+}
+
+/* =========================================================================
+ * Flush as much pending output as possible. All deflate() output goes
+ * through this function so some applications may wish to modify it
+ * to avoid allocating a large strm->next_out buffer and copying into it.
+ * (See also read_buf()).
+ */
+local void flush_pending(z_streamp strm)
+{
+    unsigned len = strm->state->pending;
+
+    if (len > strm->avail_out) len = strm->avail_out;
+    if (len == 0) return;
+
+    zmemcpy(strm->next_out, strm->state->pending_out, len);
+    strm->next_out  += len;
+    strm->state->pending_out  += len;
+    strm->total_out += len;
+    strm->avail_out  -= len;
+    strm->state->pending -= len;
+    if (strm->state->pending == 0) {
+        strm->state->pending_out = strm->state->pending_buf;
+    }
+}
+
+/* ========================================================================= */
+int ZEXPORT deflate (z_streamp strm, int flush)
+{
+    int old_flush; /* value of flush param for previous deflate call */
+    deflate_state *s;
+
+    if (strm == Z_NULL || strm->state == Z_NULL ||
+        flush > Z_FINISH || flush < 0) {
+        return Z_STREAM_ERROR;
+    }
+    s = strm->state;
+
+    if (strm->next_out == Z_NULL ||
+        (strm->next_in == Z_NULL && strm->avail_in != 0) ||
+        (s->status == FINISH_STATE && flush != Z_FINISH)) {
+        ERR_RETURN(strm, Z_STREAM_ERROR);
+    }
+    if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR);
+
+    s->strm = strm; /* just in case */
+    old_flush = s->last_flush;
+    s->last_flush = flush;
+
+    /* Write the header */
+    if (s->status == INIT_STATE) {
+#ifdef GZIP
+        if (s->wrap == 2) {
+            put_byte(s, 31);
+            put_byte(s, 139);
+            put_byte(s, 8);
+            put_byte(s, 0);
+            put_byte(s, 0);
+            put_byte(s, 0);
+            put_byte(s, 0);
+            put_byte(s, 0);
+            put_byte(s, s->level == 9 ? 2 :
+                        (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ?
+                         4 : 0));
+            put_byte(s, 255);
+            s->status = BUSY_STATE;
+            strm->adler = crc32(0L, Z_NULL, 0);
+        }
+        else
+#endif
+        {
+            uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8;
+            uInt level_flags;
+
+            if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2)
+                level_flags = 0;
+            else if (s->level < 6)
+                level_flags = 1;
+            else if (s->level == 6)
+                level_flags = 2;
+            else
+                level_flags = 3;
+            header |= (level_flags << 6);
+            if (s->strstart != 0) header |= PRESET_DICT;
+            header += 31 - (header % 31);
+
+            s->status = BUSY_STATE;
+            putShortMSB(s, header);
+
+            /* Save the adler32 of the preset dictionary: */
+            if (s->strstart != 0) {
+                putShortMSB(s, (uInt)(strm->adler >> 16));
+                putShortMSB(s, (uInt)(strm->adler & 0xffff));
+            }
+            strm->adler = adler32(0L, Z_NULL, 0);
+        }
+    }
+
+    /* Flush as much pending output as possible */
+    if (s->pending != 0) {
+        flush_pending(strm);
+        if (strm->avail_out == 0) {
+            /* Since avail_out is 0, deflate will be called again with
+             * more output space, but possibly with both pending and
+             * avail_in equal to zero. There won't be anything to do,
+             * but this is not an error situation so make sure we
+             * return OK instead of BUF_ERROR at next call of deflate:
+             */
+            s->last_flush = -1;
+            return Z_OK;
+        }
+
+    /* Make sure there is something to do and avoid duplicate consecutive
+     * flushes. For repeated and useless calls with Z_FINISH, we keep
+     * returning Z_STREAM_END instead of Z_BUF_ERROR.
+     */
+    } else if (strm->avail_in == 0 && flush <= old_flush &&
+               flush != Z_FINISH) {
+        ERR_RETURN(strm, Z_BUF_ERROR);
+    }
+
+    /* User must not provide more input after the first FINISH: */
+    if (s->status == FINISH_STATE && strm->avail_in != 0) {
+        ERR_RETURN(strm, Z_BUF_ERROR);
+    }
+
+    /* Start a new block or continue the current one.
+     */
+    if (strm->avail_in != 0 || s->lookahead != 0 ||
+        (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) {
+        block_state bstate;
+
+        bstate = (*(configuration_table[s->level].func))(s, flush);
+
+        if (bstate == finish_started || bstate == finish_done) {
+            s->status = FINISH_STATE;
+        }
+        if (bstate == need_more || bstate == finish_started) {
+            if (strm->avail_out == 0) {
+                s->last_flush = -1; /* avoid BUF_ERROR next call, see above */
+            }
+            return Z_OK;
+            /* If flush != Z_NO_FLUSH && avail_out == 0, the next call
+             * of deflate should use the same flush parameter to make sure
+             * that the flush is complete. So we don't have to output an
+             * empty block here, this will be done at next call. This also
+             * ensures that for a very small output buffer, we emit at most
+             * one empty block.
+             */
+        }
+        if (bstate == block_done) {
+            if (flush == Z_PARTIAL_FLUSH) {
+                _tr_align(s);
+            } else { /* FULL_FLUSH or SYNC_FLUSH */
+                _tr_stored_block(s, (char*)0, 0L, 0);
+                /* For a full flush, this empty block will be recognized
+                 * as a special marker by inflate_sync().
+                 */
+                if (flush == Z_FULL_FLUSH) {
+                    CLEAR_HASH(s);             /* forget history */
+                }
+            }
+            flush_pending(strm);
+            if (strm->avail_out == 0) {
+              s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */
+              return Z_OK;
+            }
+        }
+    }
+    Assert(strm->avail_out > 0, (char*)"bug2");
+
+    if (flush != Z_FINISH) return Z_OK;
+    if (s->wrap <= 0) return Z_STREAM_END;
+
+    /* Write the trailer */
+#ifdef GZIP
+    if (s->wrap == 2) {
+        put_byte(s, (Byte)(strm->adler & 0xff));
+        put_byte(s, (Byte)((strm->adler >> 8) & 0xff));
+        put_byte(s, (Byte)((strm->adler >> 16) & 0xff));
+        put_byte(s, (Byte)((strm->adler >> 24) & 0xff));
+        put_byte(s, (Byte)(strm->total_in & 0xff));
+        put_byte(s, (Byte)((strm->total_in >> 8) & 0xff));
+        put_byte(s, (Byte)((strm->total_in >> 16) & 0xff));
+        put_byte(s, (Byte)((strm->total_in >> 24) & 0xff));
+    }
+    else
+#endif
+    {
+        putShortMSB(s, (uInt)(strm->adler >> 16));
+        putShortMSB(s, (uInt)(strm->adler & 0xffff));
+    }
+    flush_pending(strm);
+    /* If avail_out is zero, the application will call deflate again
+     * to flush the rest.
+     */
+    if (s->wrap > 0) s->wrap = -s->wrap; /* write the trailer only once! */
+    return s->pending != 0 ? Z_OK : Z_STREAM_END;
+}
+
+/* ========================================================================= */
+int ZEXPORT deflateEnd (z_streamp strm)
+{
+    int status;
+
+    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+
+    status = strm->state->status;
+    if (status != INIT_STATE && status != BUSY_STATE &&
+        status != FINISH_STATE) {
+      return Z_STREAM_ERROR;
+    }
+
+    /* Deallocate in reverse order of allocations: */
+    TRY_FREE(strm, strm->state->pending_buf);
+    TRY_FREE(strm, strm->state->head);
+    TRY_FREE(strm, strm->state->prev);
+    TRY_FREE(strm, strm->state->window);
+
+    ZFREE(strm, strm->state);
+    strm->state = Z_NULL;
+
+    return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK;
+}
+
+/* =========================================================================
+ * Copy the source state to the destination state.
+ * To simplify the source, this is not supported for 16-bit MSDOS (which
+ * doesn't have enough memory anyway to duplicate compression states).
+ */
+int ZEXPORT deflateCopy (z_streamp dest, z_streamp source)
+{
+#ifdef MAXSEG_64K
+    return Z_STREAM_ERROR;
+#else
+    deflate_state *ds;
+    deflate_state *ss;
+    ushf *overlay;
+
+
+    if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) {
+        return Z_STREAM_ERROR;
+    }
+
+    ss = source->state;
+
+    *dest = *source;
+
+    ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state));
+    if (ds == Z_NULL) return Z_MEM_ERROR;
+    dest->state = (struct internal_state FAR *) ds;
+    *ds = *ss;
+    ds->strm = dest;
+
+    ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte));
+    ds->prev   = (Posf *)  ZALLOC(dest, ds->w_size, sizeof(Pos));
+    ds->head   = (Posf *)  ZALLOC(dest, ds->hash_size, sizeof(Pos));
+    overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2);
+    ds->pending_buf = (uchf *) overlay;
+
+    if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL ||
+        ds->pending_buf == Z_NULL) {
+        deflateEnd (dest);
+        return Z_MEM_ERROR;
+    }
+    /* following zmemcpy do not work for 16-bit MSDOS */
+    zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte));
+    zmemcpy(ds->prev, ss->prev, ds->w_size * sizeof(Pos));
+    zmemcpy(ds->head, ss->head, ds->hash_size * sizeof(Pos));
+    zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size);
+
+    ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf);
+    ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush);
+    ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize;
+
+    ds->l_desc.dyn_tree = ds->dyn_ltree;
+    ds->d_desc.dyn_tree = ds->dyn_dtree;
+    ds->bl_desc.dyn_tree = ds->bl_tree;
+
+    return Z_OK;
+#endif /* MAXSEG_64K */
+}
+
+/* ===========================================================================
+ * Read a new buffer from the current input stream, update the adler32
+ * and total number of bytes read.  All deflate() input goes through
+ * this function so some applications may wish to modify it to avoid
+ * allocating a large strm->next_in buffer and copying from it.
+ * (See also flush_pending()).
+ */
+local int read_buf(z_streamp strm, Bytef *buf, unsigned size)
+{
+    unsigned len = strm->avail_in;
+
+    if (len > size) len = size;
+    if (len == 0) return 0;
+
+    strm->avail_in  -= len;
+
+    if (strm->state->wrap == 1) {
+        strm->adler = adler32(strm->adler, strm->next_in, len);
+    }
+#ifdef GZIP
+    else if (strm->state->wrap == 2) {
+        strm->adler = crc32(strm->adler, strm->next_in, len);
+    }
+#endif
+    zmemcpy(buf, strm->next_in, len);
+    strm->next_in  += len;
+    strm->total_in += len;
+
+    return (int)len;
+}
+
+/* ===========================================================================
+ * Initialize the "longest match" routines for a new zlib stream
+ */
+local void lm_init (deflate_state *s)
+{
+    s->window_size = (ulg)2L*s->w_size;
+
+    CLEAR_HASH(s);
+
+    /* Set the default configuration parameters:
+     */
+    s->max_lazy_match   = configuration_table[s->level].max_lazy;
+    s->good_match       = configuration_table[s->level].good_length;
+    s->nice_match       = configuration_table[s->level].nice_length;
+    s->max_chain_length = configuration_table[s->level].max_chain;
+
+    s->strstart = 0;
+    s->block_start = 0L;
+    s->lookahead = 0;
+    s->match_length = s->prev_length = MIN_MATCH-1;
+    s->match_available = 0;
+    s->ins_h = 0;
+#ifdef ASMV
+    match_init(); /* initialize the asm code */
+#endif
+}
+
+#ifndef FASTEST
+/* ===========================================================================
+ * Set match_start to the longest match starting at the given string and
+ * return its length. Matches shorter or equal to prev_length are discarded,
+ * in which case the result is equal to prev_length and match_start is
+ * garbage.
+ * IN assertions: cur_match is the head of the hash chain for the current
+ *   string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1
+ * OUT assertion: the match length is not greater than s->lookahead.
+ */
+#ifndef ASMV
+/* For 80x86 and 680x0, an optimized version will be provided in match.asm or
+ * match.S. The code will be functionally equivalent.
+ */
+local uInt longest_match(deflate_state *s, IPos cur_match)
+{
+    unsigned chain_length = s->max_chain_length;/* max hash chain length */
+    register Bytef *scan = s->window + s->strstart; /* current string */
+    register Bytef *match;                       /* matched string */
+    register int len;                           /* length of current match */
+    int best_len = s->prev_length;              /* best match length so far */
+    int nice_match = s->nice_match;             /* stop if match long enough */
+    IPos limit = s->strstart > (IPos)MAX_DIST(s) ?
+        s->strstart - (IPos)MAX_DIST(s) : NIL;
+    /* Stop when cur_match becomes <= limit. To simplify the code,
+     * we prevent matches with the string of window index 0.
+     */
+    Posf *prev = s->prev;
+    uInt wmask = s->w_mask;
+
+#ifdef UNALIGNED_OK
+    /* Compare two bytes at a time. Note: this is not always beneficial.
+     * Try with and without -DUNALIGNED_OK to check.
+     */
+    register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1;
+    register ush scan_start = *(ushf*)scan;
+    register ush scan_end   = *(ushf*)(scan+best_len-1);
+#else
+    register Bytef *strend = s->window + s->strstart + MAX_MATCH;
+    register Byte scan_end1  = scan[best_len-1];
+    register Byte scan_end   = scan[best_len];
+#endif
+
+    /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
+     * It is easy to get rid of this optimization if necessary.
+     */
+    Assert(s->hash_bits >= 8 && MAX_MATCH == 258, (char*)"Code too clever");
+
+    /* Do not waste too much time if we already have a good match: */
+    if (s->prev_length >= s->good_match) {
+        chain_length >>= 2;
+    }
+    /* Do not look for matches beyond the end of the input. This is necessary
+     * to make deflate deterministic.
+     */
+    if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead;
+
+    Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, (char*)"need lookahead");
+
+    do {
+        Assert(cur_match < s->strstart, (char*)"no future");
+        match = s->window + cur_match;
+
+        /* Skip to next match if the match length cannot increase
+         * or if the match length is less than 2:
+         */
+#if (defined(UNALIGNED_OK) && MAX_MATCH == 258)
+        /* This code assumes sizeof(unsigned short) == 2. Do not use
+         * UNALIGNED_OK if your compiler uses a different size.
+         */
+        if (*(ushf*)(match+best_len-1) != scan_end ||
+            *(ushf*)match != scan_start) continue;
+
+        /* It is not necessary to compare scan[2] and match[2] since they are
+         * always equal when the other bytes match, given that the hash keys
+         * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at
+         * strstart+3, +5, ... up to strstart+257. We check for insufficient
+         * lookahead only every 4th comparison; the 128th check will be made
+         * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is
+         * necessary to put more guard bytes at the end of the window, or
+         * to check more often for insufficient lookahead.
+         */
+        Assert(scan[2] == match[2], (char*)"scan[2]?");
+        scan++, match++;
+        do {
+        } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
+                 *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
+                 *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
+                 *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
+                 scan < strend);
+        /* The funny "do {}" generates better code on most compilers */
+
+        /* Here, scan <= window+strstart+257 */
+        Assert(scan <= s->window+(unsigned)(s->window_size-1), (char*)"wild scan");
+        if (*scan == *match) scan++;
+
+        len = (MAX_MATCH - 1) - (int)(strend-scan);
+        scan = strend - (MAX_MATCH-1);
+
+#else /* UNALIGNED_OK */
+
+        if (match[best_len]   != scan_end  ||
+            match[best_len-1] != scan_end1 ||
+            *match            != *scan     ||
+            *++match          != scan[1])      continue;
+
+        /* The check at best_len-1 can be removed because it will be made
+         * again later. (This heuristic is not always a win.)
+         * It is not necessary to compare scan[2] and match[2] since they
+         * are always equal when the other bytes match, given that
+         * the hash keys are equal and that HASH_BITS >= 8.
+         */
+        scan += 2, match++;
+        Assert(*scan == *match, (char*)"match[2]?");
+
+        /* We check for insufficient lookahead only every 8th comparison;
+         * the 256th check will be made at strstart+258.
+         */
+        do {
+        } while (*++scan == *++match && *++scan == *++match &&
+                 *++scan == *++match && *++scan == *++match &&
+                 *++scan == *++match && *++scan == *++match &&
+                 *++scan == *++match && *++scan == *++match &&
+                 scan < strend);
+
+        Assert(scan <= s->window+(unsigned)(s->window_size-1), (char*)"wild scan");
+
+        len = MAX_MATCH - (int)(strend - scan);
+        scan = strend - MAX_MATCH;
+
+#endif /* UNALIGNED_OK */
+
+        if (len > best_len) {
+            s->match_start = cur_match;
+            best_len = len;
+            if (len >= nice_match) break;
+#ifdef UNALIGNED_OK
+            scan_end = *(ushf*)(scan+best_len-1);
+#else
+            scan_end1  = scan[best_len-1];
+            scan_end   = scan[best_len];
+#endif
+        }
+    } while ((cur_match = prev[cur_match & wmask]) > limit
+             && --chain_length != 0);
+
+    if ((uInt)best_len <= s->lookahead) return (uInt)best_len;
+    return s->lookahead;
+}
+#endif /* ASMV */
+#endif /* FASTEST */
+
+/* ---------------------------------------------------------------------------
+ * Optimized version for level == 1 or strategy == Z_RLE only
+ */
+local uInt longest_match_fast(deflate_state *s, IPos cur_match)
+{
+    register Bytef *scan = s->window + s->strstart; /* current string */
+    register Bytef *match;                       /* matched string */
+    register int len;                           /* length of current match */
+    register Bytef *strend = s->window + s->strstart + MAX_MATCH;
+
+    /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
+     * It is easy to get rid of this optimization if necessary.
+     */
+    Assert(s->hash_bits >= 8 && MAX_MATCH == 258, (char*)"Code too clever");
+
+    Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, (char*)"need lookahead");
+
+    Assert(cur_match < s->strstart, (char*)"no future");
+
+    match = s->window + cur_match;
+
+    /* Return failure if the match length is less than 2:
+     */
+    if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1;
+
+    /* The check at best_len-1 can be removed because it will be made
+     * again later. (This heuristic is not always a win.)
+     * It is not necessary to compare scan[2] and match[2] since they
+     * are always equal when the other bytes match, given that
+     * the hash keys are equal and that HASH_BITS >= 8.
+     */
+    scan += 2, match += 2;
+    Assert(*scan == *match, (char*)"match[2]?");
+
+    /* We check for insufficient lookahead only every 8th comparison;
+     * the 256th check will be made at strstart+258.
+     */
+    do {
+    } while (*++scan == *++match && *++scan == *++match &&
+             *++scan == *++match && *++scan == *++match &&
+             *++scan == *++match && *++scan == *++match &&
+             *++scan == *++match && *++scan == *++match &&
+             scan < strend);
+
+    Assert(scan <= s->window+(unsigned)(s->window_size-1), (char*)"wild scan");
+
+    len = MAX_MATCH - (int)(strend - scan);
+
+    if (len < MIN_MATCH) return MIN_MATCH - 1;
+
+    s->match_start = cur_match;
+    return (uInt)len <= s->lookahead ? (uInt)len : s->lookahead;
+}
+
+#ifdef DEBUG
+/* ===========================================================================
+ * Check that the match at match_start is indeed a match.
+ */
+local void check_match(deflate_state *s, IPos start, IPos match, int length)
+{
+    /* check that the match is indeed a match */
+    if (zmemcmp(s->window + match,
+                s->window + start, length) != EQUAL) {
+        fprintf(stderr, (char*)" start %u, match %u, length %d\n",
+                start, match, length);
+        do {
+            fprintf(stderr, (char*)"%c%c", s->window[match++], s->window[start++]);
+        } while (--length != 0);
+        z_error((char*)"invalid match");
+    }
+    if (z_verbose > 1) {
+        fprintf(stderr,(char*)"\\[%d,%d]", start-match, length);
+        do { putc(s->window[start++], stderr); } while (--length != 0);
+    }
+}
+#else
+#  define check_match(s, start, match, length)
+#endif /* DEBUG */
+
+/* ===========================================================================
+ * Fill the window when the lookahead becomes insufficient.
+ * Updates strstart and lookahead.
+ *
+ * IN assertion: lookahead < MIN_LOOKAHEAD
+ * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD
+ *    At least one byte has been read, or avail_in == 0; reads are
+ *    performed for at least two bytes (required for the zip translate_eol
+ *    option -- not supported here).
+ */
+local void fill_window(deflate_state *s)
+{
+    register unsigned n, m;
+    register Posf *p;
+    unsigned more;    /* Amount of free space at the end of the window. */
+    uInt wsize = s->w_size;
+
+    do {
+        more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart);
+
+        /* Deal with !@#$% 64K limit: */
+        if (sizeof(int) <= 2) {
+            if (more == 0 && s->strstart == 0 && s->lookahead == 0) {
+                more = wsize;
+
+            } else if (more == (unsigned)(-1)) {
+                /* Very unlikely, but possible on 16 bit machine if
+                 * strstart == 0 && lookahead == 1 (input done a byte at time)
+                 */
+                more--;
+            }
+        }
+
+        /* If the window is almost full and there is insufficient lookahead,
+         * move the upper half to the lower one to make room in the upper half.
+         */
+        if (s->strstart >= wsize+MAX_DIST(s)) {
+
+            zmemcpy(s->window, s->window+wsize, (unsigned)wsize);
+            s->match_start -= wsize;
+            s->strstart    -= wsize; /* we now have strstart >= MAX_DIST */
+            s->block_start -= (long) wsize;
+
+            /* Slide the hash table (could be avoided with 32 bit values
+               at the expense of memory usage). We slide even when level == 0
+               to keep the hash table consistent if we switch back to level > 0
+               later. (Using level 0 permanently is not an optimal usage of
+               zlib, so we don't care about this pathological case.)
+             */
+            n = s->hash_size;
+            p = &s->head[n];
+            do {
+                m = *--p;
+                *p = (Pos)(m >= wsize ? m-wsize : NIL);
+            } while (--n);
+
+            n = wsize;
+#ifndef FASTEST
+            p = &s->prev[n];
+            do {
+                m = *--p;
+                *p = (Pos)(m >= wsize ? m-wsize : NIL);
+                /* If n is not on any hash chain, prev[n] is garbage but
+                 * its value will never be used.
+                 */
+            } while (--n);
+#endif
+            more += wsize;
+        }
+        if (s->strm->avail_in == 0) return;
+
+        /* If there was no sliding:
+         *    strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&
+         *    more == window_size - lookahead - strstart
+         * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)
+         * => more >= window_size - 2*WSIZE + 2
+         * In the BIG_MEM or MMAP case (not yet supported),
+         *   window_size == input_size + MIN_LOOKAHEAD  &&
+         *   strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.
+         * Otherwise, window_size == 2*WSIZE so more >= 2.
+         * If there was sliding, more >= WSIZE. So in all cases, more >= 2.
+         */
+        Assert(more >= 2, (char*)"more < 2");
+
+        n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more);
+        s->lookahead += n;
+
+        /* Initialize the hash value now that we have some input: */
+        if (s->lookahead >= MIN_MATCH) {
+            s->ins_h = s->window[s->strstart];
+            UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]);
+#if MIN_MATCH != 3
+            Call UPDATE_HASH() MIN_MATCH-3 more times
+#endif
+        }
+        /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,
+         * but this is not important since only literal bytes will be emitted.
+         */
+
+    } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0);
+}
+
+/* ===========================================================================
+ * Flush the current block, with given end-of-file flag.
+ * IN assertion: strstart is set to the end of the current match.
+ */
+#define FLUSH_BLOCK_ONLY(s, eof) { \
+   _tr_flush_block(s, (s->block_start >= 0L ? \
+                   (charf *)&s->window[(unsigned)s->block_start] : \
+                   (charf *)Z_NULL), \
+                (ulg)((long)s->strstart - s->block_start), \
+                (eof)); \
+   s->block_start = s->strstart; \
+   flush_pending(s->strm); \
+   Tracev((stderr,(char*)"[FLUSH]")); \
+}
+
+/* Same but force premature exit if necessary. */
+#define FLUSH_BLOCK(s, eof) { \
+   FLUSH_BLOCK_ONLY(s, eof); \
+   if (s->strm->avail_out == 0) return (eof) ? finish_started : need_more; \
+}
+
+/* ===========================================================================
+ * Copy without compression as much as possible from the input stream, return
+ * the current block state.
+ * This function does not insert new strings in the dictionary since
+ * uncompressible data is probably not useful. This function is used
+ * only for the level=0 compression option.
+ * NOTE: this function should be optimized to avoid extra copying from
+ * window to pending_buf.
+ */
+local block_state deflate_stored(deflate_state *s, int flush)
+{
+    /* Stored blocks are limited to 0xffff bytes, pending_buf is limited
+     * to pending_buf_size, and each stored block has a 5 byte header:
+     */
+    ulg max_block_size = 0xffff;
+    ulg max_start;
+
+    if (max_block_size > s->pending_buf_size - 5) {
+        max_block_size = s->pending_buf_size - 5;
+    }
+
+    /* Copy as much as possible from input to output: */
+    for (;;) {
+        /* Fill the window as much as possible: */
+        if (s->lookahead <= 1) {
+
+            Assert(s->strstart < s->w_size+MAX_DIST(s) ||
+                   s->block_start >= (long)s->w_size, (char*)"slide too late");
+
+            fill_window(s);
+            if (s->lookahead == 0 && flush == Z_NO_FLUSH) return need_more;
+
+            if (s->lookahead == 0) break; /* flush the current block */
+        }
+        Assert(s->block_start >= 0L, (char*)"block gone");
+
+        s->strstart += s->lookahead;
+        s->lookahead = 0;
+
+        /* Emit a stored block if pending_buf will be full: */
+        max_start = s->block_start + max_block_size;
+        if (s->strstart == 0 || (ulg)s->strstart >= max_start) {
+            /* strstart == 0 is possible when wraparound on 16-bit machine */
+            s->lookahead = (uInt)(s->strstart - max_start);
+            s->strstart = (uInt)max_start;
+            FLUSH_BLOCK(s, 0);
+        }
+        /* Flush if we may have to slide, otherwise block_start may become
+         * negative and the data will be gone:
+         */
+        if (s->strstart - (uInt)s->block_start >= MAX_DIST(s)) {
+            FLUSH_BLOCK(s, 0);
+        }
+    }
+    FLUSH_BLOCK(s, flush == Z_FINISH);
+    return flush == Z_FINISH ? finish_done : block_done;
+}
+
+/* ===========================================================================
+ * Compress as much as possible from the input stream, return the current
+ * block state.
+ * This function does not perform lazy evaluation of matches and inserts
+ * new strings in the dictionary only for unmatched strings or for short
+ * matches. It is used only for the fast compression options.
+ */
+local block_state deflate_fast(deflate_state *s, int flush)
+{
+    IPos hash_head = NIL; /* head of the hash chain */
+    int bflush;           /* set if current block must be flushed */
+
+    for (;;) {
+        /* Make sure that we always have enough lookahead, except
+         * at the end of the input file. We need MAX_MATCH bytes
+         * for the next match, plus MIN_MATCH bytes to insert the
+         * string following the next match.
+         */
+        if (s->lookahead < MIN_LOOKAHEAD) {
+            fill_window(s);
+            if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
+                return need_more;
+            }
+            if (s->lookahead == 0) break; /* flush the current block */
+        }
+
+        /* Insert the string window[strstart .. strstart+2] in the
+         * dictionary, and set hash_head to the head of the hash chain:
+         */
+        if (s->lookahead >= MIN_MATCH) {
+            INSERT_STRING(s, s->strstart, hash_head);
+        }
+
+        /* Find the longest match, discarding those <= prev_length.
+         * At this point we have always match_length < MIN_MATCH
+         */
+        if (hash_head != NIL && s->strstart - hash_head <= MAX_DIST(s)) {
+            /* To simplify the code, we prevent matches with the string
+             * of window index 0 (in particular we have to avoid a match
+             * of the string with itself at the start of the input file).
+             */
+#ifdef FASTEST
+            if ((s->strategy < Z_HUFFMAN_ONLY) ||
+                (s->strategy == Z_RLE && s->strstart - hash_head == 1)) {
+                s->match_length = longest_match_fast (s, hash_head);
+            }
+#else
+            if (s->strategy < Z_HUFFMAN_ONLY) {
+                s->match_length = longest_match (s, hash_head);
+            } else if (s->strategy == Z_RLE && s->strstart - hash_head == 1) {
+                s->match_length = longest_match_fast (s, hash_head);
+            }
+#endif
+            /* longest_match() or longest_match_fast() sets match_start */
+        }
+        if (s->match_length >= MIN_MATCH) {
+            check_match(s, s->strstart, s->match_start, s->match_length);
+
+            _tr_tally_dist(s, s->strstart - s->match_start,
+                           s->match_length - MIN_MATCH, bflush);
+
+            s->lookahead -= s->match_length;
+
+            /* Insert new strings in the hash table only if the match length
+             * is not too large. This saves time but degrades compression.
+             */
+#ifndef FASTEST
+            if (s->match_length <= s->max_insert_length &&
+                s->lookahead >= MIN_MATCH) {
+                s->match_length--; /* string at strstart already in table */
+                do {
+                    s->strstart++;
+                    INSERT_STRING(s, s->strstart, hash_head);
+                    /* strstart never exceeds WSIZE-MAX_MATCH, so there are
+                     * always MIN_MATCH bytes ahead.
+                     */
+                } while (--s->match_length != 0);
+                s->strstart++;
+            } else
+#endif
+            {
+                s->strstart += s->match_length;
+                s->match_length = 0;
+                s->ins_h = s->window[s->strstart];
+                UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]);
+#if MIN_MATCH != 3
+                Call UPDATE_HASH() MIN_MATCH-3 more times
+#endif
+                /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not
+                 * matter since it will be recomputed at next deflate call.
+                 */
+            }
+        } else {
+            /* No match, output a literal byte */
+            Tracevv((stderr,"%c", s->window[s->strstart]));
+            _tr_tally_lit (s, s->window[s->strstart], bflush);
+            s->lookahead--;
+            s->strstart++;
+        }
+        if (bflush) FLUSH_BLOCK(s, 0);
+    }
+    FLUSH_BLOCK(s, flush == Z_FINISH);
+    return flush == Z_FINISH ? finish_done : block_done;
+}
+
+#ifndef FASTEST
+/* ===========================================================================
+ * Same as above, but achieves better compression. We use a lazy
+ * evaluation for matches: a match is finally adopted only if there is
+ * no better match at the next window position.
+ */
+local block_state deflate_slow(deflate_state *s, int flush)
+{
+    IPos hash_head = NIL;    /* head of hash chain */
+    int bflush;              /* set if current block must be flushed */
+
+    /* Process the input block. */
+    for (;;) {
+        /* Make sure that we always have enough lookahead, except
+         * at the end of the input file. We need MAX_MATCH bytes
+         * for the next match, plus MIN_MATCH bytes to insert the
+         * string following the next match.
+         */
+        if (s->lookahead < MIN_LOOKAHEAD) {
+            fill_window(s);
+            if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
+                return need_more;
+            }
+            if (s->lookahead == 0) break; /* flush the current block */
+        }
+
+        /* Insert the string window[strstart .. strstart+2] in the
+         * dictionary, and set hash_head to the head of the hash chain:
+         */
+        if (s->lookahead >= MIN_MATCH) {
+            INSERT_STRING(s, s->strstart, hash_head);
+        }
+
+        /* Find the longest match, discarding those <= prev_length.
+         */
+        s->prev_length = s->match_length, s->prev_match = s->match_start;
+        s->match_length = MIN_MATCH-1;
+
+        if (hash_head != NIL && s->prev_length < s->max_lazy_match &&
+            s->strstart - hash_head <= MAX_DIST(s)) {
+            /* To simplify the code, we prevent matches with the string
+             * of window index 0 (in particular we have to avoid a match
+             * of the string with itself at the start of the input file).
+             */
+            if (s->strategy < Z_HUFFMAN_ONLY) {
+                s->match_length = longest_match (s, hash_head);
+            } else if (s->strategy == Z_RLE && s->strstart - hash_head == 1) {
+                s->match_length = longest_match_fast (s, hash_head);
+            }
+            /* longest_match() or longest_match_fast() sets match_start */
+
+            if (s->match_length <= 5 && (s->strategy == Z_FILTERED
+#if TOO_FAR <= 32767
+                || (s->match_length == MIN_MATCH &&
+                    s->strstart - s->match_start > TOO_FAR)
+#endif
+                )) {
+
+                /* If prev_match is also MIN_MATCH, match_start is garbage
+                 * but we will ignore the current match anyway.
+                 */
+                s->match_length = MIN_MATCH-1;
+            }
+        }
+        /* If there was a match at the previous step and the current
+         * match is not better, output the previous match:
+         */
+        if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) {
+            uInt max_insert = s->strstart + s->lookahead - MIN_MATCH;
+            /* Do not insert strings in hash table beyond this. */
+
+            check_match(s, s->strstart-1, s->prev_match, s->prev_length);
+
+            _tr_tally_dist(s, s->strstart -1 - s->prev_match,
+                           s->prev_length - MIN_MATCH, bflush);
+
+            /* Insert in hash table all strings up to the end of the match.
+             * strstart-1 and strstart are already inserted. If there is not
+             * enough lookahead, the last two strings are not inserted in
+             * the hash table.
+             */
+            s->lookahead -= s->prev_length-1;
+            s->prev_length -= 2;
+            do {
+                if (++s->strstart <= max_insert) {
+                    INSERT_STRING(s, s->strstart, hash_head);
+                }
+            } while (--s->prev_length != 0);
+            s->match_available = 0;
+            s->match_length = MIN_MATCH-1;
+            s->strstart++;
+
+            if (bflush) FLUSH_BLOCK(s, 0);
+
+        } else if (s->match_available) {
+            /* If there was no match at the previous position, output a
+             * single literal. If there was a match but the current match
+             * is longer, truncate the previous match to a single literal.
+             */
+            Tracevv((stderr,(char*)"%c", s->window[s->strstart-1]));
+            _tr_tally_lit(s, s->window[s->strstart-1], bflush);
+            if (bflush) {
+                FLUSH_BLOCK_ONLY(s, 0);
+            }
+            s->strstart++;
+            s->lookahead--;
+            if (s->strm->avail_out == 0) return need_more;
+        } else {
+            /* There is no previous match to compare with, wait for
+             * the next step to decide.
+             */
+            s->match_available = 1;
+            s->strstart++;
+            s->lookahead--;
+        }
+    }
+    Assert (flush != Z_NO_FLUSH, (char*)"no flush?");
+    if (s->match_available) {
+        Tracevv((stderr,(char*)"%c", s->window[s->strstart-1]));
+        _tr_tally_lit(s, s->window[s->strstart-1], bflush);
+        s->match_available = 0;
+    }
+    FLUSH_BLOCK(s, flush == Z_FINISH);
+    return flush == Z_FINISH ? finish_done : block_done;
+}
+#endif /* FASTEST */
Index: tags/visualization-10.5-before-10.6_test/externals/zlib/src/trees.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/externals/zlib/src/trees.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/externals/zlib/src/trees.cc	(revision 1102)
@@ -0,0 +1,1167 @@
+/* trees.c -- output deflated data using Huffman coding
+ * Copyright (C) 1995-2003 Jean-loup Gailly
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/*
+ *  ALGORITHM
+ *
+ *      The "deflation" process uses several Huffman trees. The more
+ *      common source values are represented by shorter bit sequences.
+ *
+ *      Each code tree is stored in a compressed form which is itself
+ * a Huffman encoding of the lengths of all the code strings (in
+ * ascending order by source values).  The actual code strings are
+ * reconstructed from the lengths in the inflate process, as described
+ * in the deflate specification.
+ *
+ *  REFERENCES
+ *
+ *      Deutsch, L.P.,"'Deflate' Compressed Data Format Specification".
+ *      Available in ftp.uu.net:/pub/archiving/zip/doc/deflate-1.1.doc
+ *
+ *      Storer, James A.
+ *          Data Compression:  Methods and Theory, pp. 49-50.
+ *          Computer Science Press, 1988.  ISBN 0-7167-8156-5.
+ *
+ *      Sedgewick, R.
+ *          Algorithms, p290.
+ *          Addison-Wesley, 1983. ISBN 0-201-06672-6.
+ */
+
+/* @(#) $Id: trees.cc,v 1.1 2005/05/12 21:04:53 duns Exp $ */
+
+/* #define GEN_TREES_H */
+
+#include "deflate.h"
+
+#ifdef DEBUG
+#  include <ctype.h>
+#endif
+
+/* ===========================================================================
+ * Constants
+ */
+
+#define MAX_BL_BITS 7
+/* Bit length codes must not exceed MAX_BL_BITS bits */
+
+#define END_BLOCK 256
+/* end of block literal code */
+
+#define REP_3_6      16
+/* repeat previous bit length 3-6 times (2 bits of repeat count) */
+
+#define REPZ_3_10    17
+/* repeat a zero length 3-10 times  (3 bits of repeat count) */
+
+#define REPZ_11_138  18
+/* repeat a zero length 11-138 times  (7 bits of repeat count) */
+
+local const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */
+   = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0};
+
+local const int extra_dbits[D_CODES] /* extra bits for each distance code */
+   = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13};
+
+local const int extra_blbits[BL_CODES]/* extra bits for each bit length code */
+   = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7};
+
+local const uch bl_order[BL_CODES]
+   = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15};
+/* The lengths of the bit length codes are sent in order of decreasing
+ * probability, to avoid transmitting the lengths for unused bit length codes.
+ */
+
+#define Buf_size (8 * 2*sizeof(char))
+/* Number of bits used within bi_buf. (bi_buf might be implemented on
+ * more than 16 bits on some systems.)
+ */
+
+/* ===========================================================================
+ * Local data. These are initialized only once.
+ */
+
+#define DIST_CODE_LEN  512 /* see definition of array dist_code below */
+
+#if defined(GEN_TREES_H) || !defined(STDC)
+/* non ANSI compilers may not accept trees.h */
+
+local ct_data static_ltree[L_CODES+2];
+/* The static literal tree. Since the bit lengths are imposed, there is no
+ * need for the L_CODES extra codes used during heap construction. However
+ * The codes 286 and 287 are needed to build a canonical tree (see _tr_init
+ * below).
+ */
+
+local ct_data static_dtree[D_CODES];
+/* The static distance tree. (Actually a trivial tree since all codes use
+ * 5 bits.)
+ */
+
+uch _dist_code[DIST_CODE_LEN];
+/* Distance codes. The first 256 values correspond to the distances
+ * 3 .. 258, the last 256 values correspond to the top 8 bits of
+ * the 15 bit distances.
+ */
+
+uch _length_code[MAX_MATCH-MIN_MATCH+1];
+/* length code for each normalized match length (0 == MIN_MATCH) */
+
+local int base_length[LENGTH_CODES];
+/* First normalized length for each code (0 = MIN_MATCH) */
+
+local int base_dist[D_CODES];
+/* First normalized distance for each code (0 = distance of 1) */
+
+#else
+#  include "trees.h"
+#endif /* GEN_TREES_H */
+
+struct static_tree_desc_s {
+    const ct_data *static_tree;  /* static tree or NULL */
+    const intf *extra_bits;      /* extra bits for each code or NULL */
+    int     extra_base;          /* base index for extra_bits */
+    int     elems;               /* max number of elements in the tree */
+    int     max_length;          /* max bit length for the codes */
+};
+
+local static_tree_desc  static_l_desc =
+{static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS};
+
+local static_tree_desc  static_d_desc =
+{static_dtree, extra_dbits, 0,          D_CODES, MAX_BITS};
+
+local static_tree_desc  static_bl_desc =
+{(const ct_data *)0, extra_blbits, 0,   BL_CODES, MAX_BL_BITS};
+
+/* ===========================================================================
+ * Local (static) routines in this file.
+ */
+
+local void tr_static_init OF((void));
+local void init_block     OF((deflate_state *s));
+local void pqdownheap     OF((deflate_state *s, ct_data *tree, int k));
+local void gen_bitlen     OF((deflate_state *s, tree_desc *desc));
+local void gen_codes      OF((ct_data *tree, int max_code, ushf *bl_count));
+local void build_tree     OF((deflate_state *s, tree_desc *desc));
+local void scan_tree      OF((deflate_state *s, ct_data *tree, int max_code));
+local void send_tree      OF((deflate_state *s, ct_data *tree, int max_code));
+local int  build_bl_tree  OF((deflate_state *s));
+local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes,
+                              int blcodes));
+local void compress_block OF((deflate_state *s, ct_data *ltree,
+                              ct_data *dtree));
+local void set_data_type  OF((deflate_state *s));
+local unsigned bi_reverse OF((unsigned value, int length));
+local void bi_windup      OF((deflate_state *s));
+local void bi_flush       OF((deflate_state *s));
+local void copy_block     OF((deflate_state *s, charf *buf, unsigned len,
+                              int header));
+
+#ifdef GEN_TREES_H
+local void gen_trees_header OF((void));
+#endif
+
+#ifndef DEBUG
+#  define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len)
+   /* Send a code of the given tree. c and tree must not have side effects */
+
+#else /* DEBUG */
+#  define send_code(s, c, tree) \
+     { if (z_verbose>2) fprintf(stderr,(char*)"\ncd %3d ",(c)); \
+       send_bits(s, tree[c].Code, tree[c].Len); }
+#endif
+
+/* ===========================================================================
+ * Output a short LSB first on the stream.
+ * IN assertion: there is enough room in pendingBuf.
+ */
+#define put_short(s, w) { \
+    put_byte(s, (uch)((w) & 0xff)); \
+    put_byte(s, (uch)((ush)(w) >> 8)); \
+}
+
+/* ===========================================================================
+ * Send a value on a given number of bits.
+ * IN assertion: length <= 16 and value fits in length bits.
+ */
+#ifdef DEBUG
+local void send_bits      OF((deflate_state *s, int value, int length));
+
+local void send_bits(deflate_state *s, int value, int length)
+{
+    Tracevv((stderr,(char*)" l %2d v %4x ", length, value));
+    Assert(length > 0 && length <= 15, (char*)"invalid length");
+    s->bits_sent += (ulg)length;
+
+    /* If not enough room in bi_buf, use (valid) bits from bi_buf and
+     * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid))
+     * unused bits in value.
+     */
+    if (s->bi_valid > (int)Buf_size - length) {
+        s->bi_buf |= (value << s->bi_valid);
+        put_short(s, s->bi_buf);
+        s->bi_buf = (ush)value >> (Buf_size - s->bi_valid);
+        s->bi_valid += length - Buf_size;
+    } else {
+        s->bi_buf |= value << s->bi_valid;
+        s->bi_valid += length;
+    }
+}
+#else /* !DEBUG */
+
+#define send_bits(s, value, length) \
+{ int len = length;\
+  if (s->bi_valid > (int)Buf_size - len) {\
+    int val = value;\
+    s->bi_buf |= (val << s->bi_valid);\
+    put_short(s, s->bi_buf);\
+    s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
+    s->bi_valid += len - Buf_size;\
+  } else {\
+    s->bi_buf |= (value) << s->bi_valid;\
+    s->bi_valid += len;\
+  }\
+}
+#endif /* DEBUG */
+
+
+/* the arguments must not have side effects */
+
+/* ===========================================================================
+ * Initialize the various 'constant' tables.
+ */
+local void tr_static_init()
+{
+#if defined(GEN_TREES_H) || !defined(STDC)
+    static int static_init_done = 0;
+    int n;        /* iterates over tree elements */
+    int bits;     /* bit counter */
+    int length;   /* length value */
+    int code;     /* code value */
+    int dist;     /* distance index */
+    ush bl_count[MAX_BITS+1];
+    /* number of codes at each bit length for an optimal tree */
+
+    if (static_init_done) return;
+
+    /* For some embedded targets, global variables are not initialized: */
+    static_l_desc.static_tree = static_ltree;
+    static_l_desc.extra_bits = extra_lbits;
+    static_d_desc.static_tree = static_dtree;
+    static_d_desc.extra_bits = extra_dbits;
+    static_bl_desc.extra_bits = extra_blbits;
+
+    /* Initialize the mapping length (0..255) -> length code (0..28) */
+    length = 0;
+    for (code = 0; code < LENGTH_CODES-1; code++) {
+        base_length[code] = length;
+        for (n = 0; n < (1<<extra_lbits[code]); n++) {
+            _length_code[length++] = (uch)code;
+        }
+    }
+    Assert (length == 256, (char*)"tr_static_init: length != 256");
+    /* Note that the length 255 (match length 258) can be represented
+     * in two different ways: code 284 + 5 bits or code 285, so we
+     * overwrite length_code[255] to use the best encoding:
+     */
+    _length_code[length-1] = (uch)code;
+
+    /* Initialize the mapping dist (0..32K) -> dist code (0..29) */
+    dist = 0;
+    for (code = 0 ; code < 16; code++) {
+        base_dist[code] = dist;
+        for (n = 0; n < (1<<extra_dbits[code]); n++) {
+            _dist_code[dist++] = (uch)code;
+        }
+    }
+    Assert (dist == 256, (char*)"tr_static_init: dist != 256");
+    dist >>= 7; /* from now on, all distances are divided by 128 */
+    for ( ; code < D_CODES; code++) {
+        base_dist[code] = dist << 7;
+        for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) {
+            _dist_code[256 + dist++] = (uch)code;
+        }
+    }
+    Assert (dist == 256, (char*)"tr_static_init: 256+dist != 512");
+
+    /* Construct the codes of the static literal tree */
+    for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0;
+    n = 0;
+    while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++;
+    while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++;
+    while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++;
+    while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++;
+    /* Codes 286 and 287 do not exist, but we must include them in the
+     * tree construction to get a canonical Huffman tree (longest code
+     * all ones)
+     */
+    gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count);
+
+    /* The static distance tree is trivial: */
+    for (n = 0; n < D_CODES; n++) {
+        static_dtree[n].Len = 5;
+        static_dtree[n].Code = bi_reverse((unsigned)n, 5);
+    }
+    static_init_done = 1;
+
+#  ifdef GEN_TREES_H
+    gen_trees_header();
+#  endif
+#endif /* defined(GEN_TREES_H) || !defined(STDC) */
+}
+
+/* ===========================================================================
+ * Genererate the file trees.h describing the static trees.
+ */
+#ifdef GEN_TREES_H
+#  ifndef DEBUG
+#    include <stdio.h>
+#  endif
+
+#  define SEPARATOR(i, last, width) \
+      ((i) == (last)? (char*)"\n};\n\n" :    \
+       ((i) % (width) == (width)-1 ? (char*)",\n" : ", "))
+
+void gen_trees_header()
+{
+    FILE *header = fopen((char*)"trees.h", (char*)"w");
+    int i;
+
+    Assert (header != NULL, (char*)"Can't open trees.h");
+    fprintf(header,
+            (char*)"/* header created automatically with -DGEN_TREES_H */\n\n");
+
+    fprintf(header, (char*)"local const ct_data static_ltree[L_CODES+2] = {\n");
+    for (i = 0; i < L_CODES+2; i++) {
+        fprintf(header, (char*)"{{%3u},{%3u}}%s", static_ltree[i].Code,
+                static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5));
+    }
+
+    fprintf(header, (char*)"local const ct_data static_dtree[D_CODES] = {\n");
+    for (i = 0; i < D_CODES; i++) {
+        fprintf(header, (char*)"{{%2u},{%2u}}%s", static_dtree[i].Code,
+                static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5));
+    }
+
+    fprintf(header, (char*)"const uch _dist_code[DIST_CODE_LEN] = {\n");
+    for (i = 0; i < DIST_CODE_LEN; i++) {
+        fprintf(header, (char*)"%2u%s", _dist_code[i],
+                SEPARATOR(i, DIST_CODE_LEN-1, 20));
+    }
+
+    fprintf(header, (char*)"const uch _length_code[MAX_MATCH-MIN_MATCH+1]= {\n");
+    for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) {
+        fprintf(header, (char*)"%2u%s", _length_code[i],
+                SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20));
+    }
+
+    fprintf(header, (char*)"local const int base_length[LENGTH_CODES] = {\n");
+    for (i = 0; i < LENGTH_CODES; i++) {
+        fprintf(header, (char*)"%1u%s", base_length[i],
+                SEPARATOR(i, LENGTH_CODES-1, 20));
+    }
+
+    fprintf(header, (char*)"local const int base_dist[D_CODES] = {\n");
+    for (i = 0; i < D_CODES; i++) {
+        fprintf(header, (char*)"%5u%s", base_dist[i],
+                SEPARATOR(i, D_CODES-1, 10));
+    }
+
+    fclose(header);
+}
+#endif /* GEN_TREES_H */
+
+/* ===========================================================================
+ * Initialize the tree data structures for a new zlib stream.
+ */
+void _tr_init(deflate_state *s)
+{
+    tr_static_init();
+
+    s->l_desc.dyn_tree = s->dyn_ltree;
+    s->l_desc.stat_desc = &static_l_desc;
+
+    s->d_desc.dyn_tree = s->dyn_dtree;
+    s->d_desc.stat_desc = &static_d_desc;
+
+    s->bl_desc.dyn_tree = s->bl_tree;
+    s->bl_desc.stat_desc = &static_bl_desc;
+
+    s->bi_buf = 0;
+    s->bi_valid = 0;
+    s->last_eob_len = 8; /* enough lookahead for inflate */
+#ifdef DEBUG
+    s->compressed_len = 0L;
+    s->bits_sent = 0L;
+#endif
+
+    /* Initialize the first block of the first file: */
+    init_block(s);
+}
+
+/* ===========================================================================
+ * Initialize a new block.
+ */
+local void init_block(deflate_state *s)
+{
+    int n; /* iterates over tree elements */
+
+    /* Initialize the trees. */
+    for (n = 0; n < L_CODES;  n++) s->dyn_ltree[n].Freq = 0;
+    for (n = 0; n < D_CODES;  n++) s->dyn_dtree[n].Freq = 0;
+    for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0;
+
+    s->dyn_ltree[END_BLOCK].Freq = 1;
+    s->opt_len = s->static_len = 0L;
+    s->last_lit = s->matches = 0;
+}
+
+#define SMALLEST 1
+/* Index within the heap array of least frequent node in the Huffman tree */
+
+
+/* ===========================================================================
+ * Remove the smallest element from the heap and recreate the heap with
+ * one less element. Updates heap and heap_len.
+ */
+#define pqremove(s, tree, top) \
+{\
+    top = s->heap[SMALLEST]; \
+    s->heap[SMALLEST] = s->heap[s->heap_len--]; \
+    pqdownheap(s, tree, SMALLEST); \
+}
+
+/* ===========================================================================
+ * Compares to subtrees, using the tree depth as tie breaker when
+ * the subtrees have equal frequency. This minimizes the worst case length.
+ */
+#define smaller(tree, n, m, depth) \
+   (tree[n].Freq < tree[m].Freq || \
+   (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m]))
+
+/* ===========================================================================
+ * Restore the heap property by moving down the tree starting at node k,
+ * exchanging a node with the smallest of its two sons if necessary, stopping
+ * when the heap property is re-established (each father smaller than its
+ * two sons).
+ */
+local void pqdownheap(deflate_state *s, ct_data *tree, int k)
+{
+    int v = s->heap[k];
+    int j = k << 1;  /* left son of k */
+    while (j <= s->heap_len) {
+        /* Set j to the smallest of the two sons: */
+        if (j < s->heap_len &&
+            smaller(tree, s->heap[j+1], s->heap[j], s->depth)) {
+            j++;
+        }
+        /* Exit if v is smaller than both sons */
+        if (smaller(tree, v, s->heap[j], s->depth)) break;
+
+        /* Exchange v with the smallest son */
+        s->heap[k] = s->heap[j];  k = j;
+
+        /* And continue down the tree, setting j to the left son of k */
+        j <<= 1;
+    }
+    s->heap[k] = v;
+}
+
+/* ===========================================================================
+ * Compute the optimal bit lengths for a tree and update the total bit length
+ * for the current block.
+ * IN assertion: the fields freq and dad are set, heap[heap_max] and
+ *    above are the tree nodes sorted by increasing frequency.
+ * OUT assertions: the field len is set to the optimal bit length, the
+ *     array bl_count contains the frequencies for each bit length.
+ *     The length opt_len is updated; static_len is also updated if stree is
+ *     not null.
+ */
+local void gen_bitlen(deflate_state *s, tree_desc *desc)
+{
+    ct_data *tree        = desc->dyn_tree;
+    int max_code         = desc->max_code;
+    const ct_data *stree = desc->stat_desc->static_tree;
+    const intf *extra    = desc->stat_desc->extra_bits;
+    int base             = desc->stat_desc->extra_base;
+    int max_length       = desc->stat_desc->max_length;
+    int h;              /* heap index */
+    int n, m;           /* iterate over the tree elements */
+    int bits;           /* bit length */
+    int xbits;          /* extra bits */
+    ush f;              /* frequency */
+    int overflow = 0;   /* number of elements with bit length too large */
+
+    for (bits = 0; bits <= MAX_BITS; bits++) s->bl_count[bits] = 0;
+
+    /* In a first pass, compute the optimal bit lengths (which may
+     * overflow in the case of the bit length tree).
+     */
+    tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */
+
+    for (h = s->heap_max+1; h < HEAP_SIZE; h++) {
+        n = s->heap[h];
+        bits = tree[tree[n].Dad].Len + 1;
+        if (bits > max_length) bits = max_length, overflow++;
+        tree[n].Len = (ush)bits;
+        /* We overwrite tree[n].Dad which is no longer needed */
+
+        if (n > max_code) continue; /* not a leaf node */
+
+        s->bl_count[bits]++;
+        xbits = 0;
+        if (n >= base) xbits = extra[n-base];
+        f = tree[n].Freq;
+        s->opt_len += (ulg)f * (bits + xbits);
+        if (stree) s->static_len += (ulg)f * (stree[n].Len + xbits);
+    }
+    if (overflow == 0) return;
+
+    Trace((stderr,(char*)"\nbit length overflow\n"));
+    /* This happens for example on obj2 and pic of the Calgary corpus */
+
+    /* Find the first bit length which could increase: */
+    do {
+        bits = max_length-1;
+        while (s->bl_count[bits] == 0) bits--;
+        s->bl_count[bits]--;      /* move one leaf down the tree */
+        s->bl_count[bits+1] += 2; /* move one overflow item as its brother */
+        s->bl_count[max_length]--;
+        /* The brother of the overflow item also moves one step up,
+         * but this does not affect bl_count[max_length]
+         */
+        overflow -= 2;
+    } while (overflow > 0);
+
+    /* Now recompute all bit lengths, scanning in increasing frequency.
+     * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all
+     * lengths instead of fixing only the wrong ones. This idea is taken
+     * from 'ar' written by Haruhiko Okumura.)
+     */
+    for (bits = max_length; bits != 0; bits--) {
+        n = s->bl_count[bits];
+        while (n != 0) {
+            m = s->heap[--h];
+            if (m > max_code) continue;
+            if (tree[m].Len != (unsigned) bits) {
+                Trace((stderr,(char*)"code %d bits %d->%d\n", m, tree[m].Len, bits));
+                s->opt_len += ((long)bits - (long)tree[m].Len)
+                              *(long)tree[m].Freq;
+                tree[m].Len = (ush)bits;
+            }
+            n--;
+        }
+    }
+}
+
+/* ===========================================================================
+ * Generate the codes for a given tree and bit counts (which need not be
+ * optimal).
+ * IN assertion: the array bl_count contains the bit length statistics for
+ * the given tree and the field len is set for all tree elements.
+ * OUT assertion: the field code is set for all tree elements of non
+ *     zero code length.
+ */
+local void gen_codes (ct_data *tree, int max_code, ushf *bl_count)
+{
+    ush next_code[MAX_BITS+1]; /* next code value for each bit length */
+    ush code = 0;              /* running code value */
+    int bits;                  /* bit index */
+    int n;                     /* code index */
+
+    /* The distribution counts are first used to generate the code values
+     * without bit reversal.
+     */
+    for (bits = 1; bits <= MAX_BITS; bits++) {
+        next_code[bits] = code = (code + bl_count[bits-1]) << 1;
+    }
+    /* Check that the bit counts in bl_count are consistent. The last code
+     * must be all ones.
+     */
+    Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,
+            (char*)"inconsistent bit counts");
+    Tracev((stderr,(char*)"\ngen_codes: max_code %d ", max_code));
+
+    for (n = 0;  n <= max_code; n++) {
+        int len = tree[n].Len;
+        if (len == 0) continue;
+        /* Now reverse the bits */
+        tree[n].Code = bi_reverse(next_code[len]++, len);
+
+        Tracecv(tree != static_ltree, (stderr,(char*)"\nn %3d %c l %2d c %4x (%x) ",
+             n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1));
+    }
+}
+
+/* ===========================================================================
+ * Construct one Huffman tree and assigns the code bit strings and lengths.
+ * Update the total bit length for the current block.
+ * IN assertion: the field freq is set for all tree elements.
+ * OUT assertions: the fields len and code are set to the optimal bit length
+ *     and corresponding code. The length opt_len is updated; static_len is
+ *     also updated if stree is not null. The field max_code is set.
+ */
+local void build_tree(deflate_state *s, tree_desc *desc)
+{
+    ct_data *tree         = desc->dyn_tree;
+    const ct_data *stree  = desc->stat_desc->static_tree;
+    int elems             = desc->stat_desc->elems;
+    int n, m;          /* iterate over heap elements */
+    int max_code = -1; /* largest code with non zero frequency */
+    int node;          /* new node being created */
+
+    /* Construct the initial heap, with least frequent element in
+     * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].
+     * heap[0] is not used.
+     */
+    s->heap_len = 0, s->heap_max = HEAP_SIZE;
+
+    for (n = 0; n < elems; n++) {
+        if (tree[n].Freq != 0) {
+            s->heap[++(s->heap_len)] = max_code = n;
+            s->depth[n] = 0;
+        } else {
+            tree[n].Len = 0;
+        }
+    }
+
+    /* The pkzip format requires that at least one distance code exists,
+     * and that at least one bit should be sent even if there is only one
+     * possible code. So to avoid special checks later on we force at least
+     * two codes of non zero frequency.
+     */
+    while (s->heap_len < 2) {
+        node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0);
+        tree[node].Freq = 1;
+        s->depth[node] = 0;
+        s->opt_len--; if (stree) s->static_len -= stree[node].Len;
+        /* node is 0 or 1 so it does not have extra bits */
+    }
+    desc->max_code = max_code;
+
+    /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,
+     * establish sub-heaps of increasing lengths:
+     */
+    for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n);
+
+    /* Construct the Huffman tree by repeatedly combining the least two
+     * frequent nodes.
+     */
+    node = elems;              /* next internal node of the tree */
+    do {
+        pqremove(s, tree, n);  /* n = node of least frequency */
+        m = s->heap[SMALLEST]; /* m = node of next least frequency */
+
+        s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */
+        s->heap[--(s->heap_max)] = m;
+
+        /* Create a new node father of n and m */
+        tree[node].Freq = tree[n].Freq + tree[m].Freq;
+        s->depth[node] = (uch)((s->depth[n] >= s->depth[m] ?
+                                s->depth[n] : s->depth[m]) + 1);
+        tree[n].Dad = tree[m].Dad = (ush)node;
+#ifdef DUMP_BL_TREE
+        if (tree == s->bl_tree) {
+            fprintf(stderr,(char*)"\nnode %d(%d), sons %d(%d) %d(%d)",
+                    node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq);
+        }
+#endif
+        /* and insert the new node in the heap */
+        s->heap[SMALLEST] = node++;
+        pqdownheap(s, tree, SMALLEST);
+
+    } while (s->heap_len >= 2);
+
+    s->heap[--(s->heap_max)] = s->heap[SMALLEST];
+
+    /* At this point, the fields freq and dad are set. We can now
+     * generate the bit lengths.
+     */
+    gen_bitlen(s, (tree_desc *)desc);
+
+    /* The field len is now set, we can generate the bit codes */
+    gen_codes ((ct_data *)tree, max_code, s->bl_count);
+}
+
+/* ===========================================================================
+ * Scan a literal or distance tree to determine the frequencies of the codes
+ * in the bit length tree.
+ */
+local void scan_tree (deflate_state *s, ct_data *tree, int max_code)
+{
+    int n;                     /* iterates over all tree elements */
+    int prevlen = -1;          /* last emitted length */
+    int curlen;                /* length of current code */
+    int nextlen = tree[0].Len; /* length of next code */
+    int count = 0;             /* repeat count of the current code */
+    int max_count = 7;         /* max repeat count */
+    int min_count = 4;         /* min repeat count */
+
+    if (nextlen == 0) max_count = 138, min_count = 3;
+    tree[max_code+1].Len = (ush)0xffff; /* guard */
+
+    for (n = 0; n <= max_code; n++) {
+        curlen = nextlen; nextlen = tree[n+1].Len;
+        if (++count < max_count && curlen == nextlen) {
+            continue;
+        } else if (count < min_count) {
+            s->bl_tree[curlen].Freq += count;
+        } else if (curlen != 0) {
+            if (curlen != prevlen) s->bl_tree[curlen].Freq++;
+            s->bl_tree[REP_3_6].Freq++;
+        } else if (count <= 10) {
+            s->bl_tree[REPZ_3_10].Freq++;
+        } else {
+            s->bl_tree[REPZ_11_138].Freq++;
+        }
+        count = 0; prevlen = curlen;
+        if (nextlen == 0) {
+            max_count = 138, min_count = 3;
+        } else if (curlen == nextlen) {
+            max_count = 6, min_count = 3;
+        } else {
+            max_count = 7, min_count = 4;
+        }
+    }
+}
+
+/* ===========================================================================
+ * Send a literal or distance tree in compressed form, using the codes in
+ * bl_tree.
+ */
+local void send_tree (deflate_state *s, ct_data *tree, int max_code)
+{
+    int n;                     /* iterates over all tree elements */
+    int prevlen = -1;          /* last emitted length */
+    int curlen;                /* length of current code */
+    int nextlen = tree[0].Len; /* length of next code */
+    int count = 0;             /* repeat count of the current code */
+    int max_count = 7;         /* max repeat count */
+    int min_count = 4;         /* min repeat count */
+
+    /* tree[max_code+1].Len = -1; */  /* guard already set */
+    if (nextlen == 0) max_count = 138, min_count = 3;
+
+    for (n = 0; n <= max_code; n++) {
+        curlen = nextlen; nextlen = tree[n+1].Len;
+        if (++count < max_count && curlen == nextlen) {
+            continue;
+        } else if (count < min_count) {
+            do { send_code(s, curlen, s->bl_tree); } while (--count != 0);
+
+        } else if (curlen != 0) {
+            if (curlen != prevlen) {
+                send_code(s, curlen, s->bl_tree); count--;
+            }
+            Assert(count >= 3 && count <= 6, (char*)" 3_6?");
+            send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2);
+
+        } else if (count <= 10) {
+            send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3);
+
+        } else {
+            send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7);
+        }
+        count = 0; prevlen = curlen;
+        if (nextlen == 0) {
+            max_count = 138, min_count = 3;
+        } else if (curlen == nextlen) {
+            max_count = 6, min_count = 3;
+        } else {
+            max_count = 7, min_count = 4;
+        }
+    }
+}
+
+/* ===========================================================================
+ * Construct the Huffman tree for the bit lengths and return the index in
+ * bl_order of the last bit length code to send.
+ */
+local int build_bl_tree(deflate_state *s)
+{
+    int max_blindex;  /* index of last bit length code of non zero freq */
+
+    /* Determine the bit length frequencies for literal and distance trees */
+    scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code);
+    scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code);
+
+    /* Build the bit length tree: */
+    build_tree(s, (tree_desc *)(&(s->bl_desc)));
+    /* opt_len now includes the length of the tree representations, except
+     * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.
+     */
+
+    /* Determine the number of bit length codes to send. The pkzip format
+     * requires that at least 4 bit length codes be sent. (appnote.txt says
+     * 3 but the actual value used is 4.)
+     */
+    for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) {
+        if (s->bl_tree[bl_order[max_blindex]].Len != 0) break;
+    }
+    /* Update opt_len to include the bit length tree and counts */
+    s->opt_len += 3*(max_blindex+1) + 5+5+4;
+    Tracev((stderr, (char*)"\ndyn trees: dyn %ld, stat %ld",
+            s->opt_len, s->static_len));
+
+    return max_blindex;
+}
+
+/* ===========================================================================
+ * Send the header for a block using dynamic Huffman trees: the counts, the
+ * lengths of the bit length codes, the literal tree and the distance tree.
+ * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.
+ */
+local void send_all_trees(deflate_state *s, int lcodes, int dcodes, int blcodes)
+{
+    int rank;                    /* index in bl_order */
+
+    Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, (char*)"not enough codes");
+    Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,
+            (char*)"too many codes");
+    Tracev((stderr, (char*)"\nbl counts: "));
+    send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */
+    send_bits(s, dcodes-1,   5);
+    send_bits(s, blcodes-4,  4); /* not -3 as stated in appnote.txt */
+    for (rank = 0; rank < blcodes; rank++) {
+        Tracev((stderr, (char*)"\nbl code %2d ", bl_order[rank]));
+        send_bits(s, s->bl_tree[bl_order[rank]].Len, 3);
+    }
+    Tracev((stderr, (char*)"\nbl tree: sent %ld", s->bits_sent));
+
+    send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */
+    Tracev((stderr, (char*)"\nlit tree: sent %ld", s->bits_sent));
+
+    send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */
+    Tracev((stderr, (char*)"\ndist tree: sent %ld", s->bits_sent));
+}
+
+/* ===========================================================================
+ * Send a stored block
+ */
+void _tr_stored_block(deflate_state *s, charf *buf, ulg stored_len, int eof)
+{
+    send_bits(s, (STORED_BLOCK<<1)+eof, 3);  /* send block type */
+#ifdef DEBUG
+    s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L;
+    s->compressed_len += (stored_len + 4) << 3;
+#endif
+    copy_block(s, buf, (unsigned)stored_len, 1); /* with header */
+}
+
+/* ===========================================================================
+ * Send one empty static block to give enough lookahead for inflate.
+ * This takes 10 bits, of which 7 may remain in the bit buffer.
+ * The current inflate code requires 9 bits of lookahead. If the
+ * last two codes for the previous block (real code plus EOB) were coded
+ * on 5 bits or less, inflate may have only 5+3 bits of lookahead to decode
+ * the last real code. In this case we send two empty static blocks instead
+ * of one. (There are no problems if the previous block is stored or fixed.)
+ * To simplify the code, we assume the worst case of last real code encoded
+ * on one bit only.
+ */
+void _tr_align(deflate_state *s)
+{
+    send_bits(s, STATIC_TREES<<1, 3);
+    send_code(s, END_BLOCK, static_ltree);
+#ifdef DEBUG
+    s->compressed_len += 10L; /* 3 for block type, 7 for EOB */
+#endif
+    bi_flush(s);
+    /* Of the 10 bits for the empty block, we have already sent
+     * (10 - bi_valid) bits. The lookahead for the last real code (before
+     * the EOB of the previous block) was thus at least one plus the length
+     * of the EOB plus what we have just sent of the empty static block.
+     */
+    if (1 + s->last_eob_len + 10 - s->bi_valid < 9) {
+        send_bits(s, STATIC_TREES<<1, 3);
+        send_code(s, END_BLOCK, static_ltree);
+#ifdef DEBUG
+        s->compressed_len += 10L;
+#endif
+        bi_flush(s);
+    }
+    s->last_eob_len = 7;
+}
+
+/* ===========================================================================
+ * Determine the best encoding for the current block: dynamic trees, static
+ * trees or store, and output the encoded block to the zip file.
+ */
+void _tr_flush_block(deflate_state *s, charf *buf, ulg stored_len, int eof)
+{
+    ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */
+    int max_blindex = 0;  /* index of last bit length code of non zero freq */
+
+    /* Build the Huffman trees unless a stored block is forced */
+    if (s->level > 0) {
+
+         /* Check if the file is ascii or binary */
+        if (s->strm->data_type == Z_UNKNOWN) set_data_type(s);
+
+        /* Construct the literal and distance trees */
+        build_tree(s, (tree_desc *)(&(s->l_desc)));
+        Tracev((stderr, (char*)"\nlit data: dyn %ld, stat %ld", s->opt_len,
+                s->static_len));
+
+        build_tree(s, (tree_desc *)(&(s->d_desc)));
+        Tracev((stderr, (char*)"\ndist data: dyn %ld, stat %ld", s->opt_len,
+                s->static_len));
+        /* At this point, opt_len and static_len are the total bit lengths of
+         * the compressed block data, excluding the tree representations.
+         */
+
+        /* Build the bit length tree for the above two trees, and get the index
+         * in bl_order of the last bit length code to send.
+         */
+        max_blindex = build_bl_tree(s);
+
+        /* Determine the best encoding. Compute the block lengths in bytes. */
+        opt_lenb = (s->opt_len+3+7)>>3;
+        static_lenb = (s->static_len+3+7)>>3;
+
+        Tracev((stderr, (char*)"\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ",
+                opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
+                s->last_lit));
+
+        if (static_lenb <= opt_lenb) opt_lenb = static_lenb;
+
+    } else {
+        Assert(buf != (char*)0, (char*)"lost buf");
+        opt_lenb = static_lenb = stored_len + 5; /* force a stored block */
+    }
+
+#ifdef FORCE_STORED
+    if (buf != (char*)0) { /* force stored block */
+#else
+    if (stored_len+4 <= opt_lenb && buf != (char*)0) {
+                       /* 4: two words for the lengths */
+#endif
+        /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.
+         * Otherwise we can't have processed more than WSIZE input bytes since
+         * the last block flush, because compression would have been
+         * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to
+         * transform a block into a stored block.
+         */
+        _tr_stored_block(s, buf, stored_len, eof);
+
+#ifdef FORCE_STATIC
+    } else if (static_lenb >= 0) { /* force static trees */
+#else
+    } else if (static_lenb == opt_lenb) {
+#endif
+        send_bits(s, (STATIC_TREES<<1)+eof, 3);
+        compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree);
+#ifdef DEBUG
+        s->compressed_len += 3 + s->static_len;
+#endif
+    } else {
+        send_bits(s, (DYN_TREES<<1)+eof, 3);
+        send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1,
+                       max_blindex+1);
+        compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree);
+#ifdef DEBUG
+        s->compressed_len += 3 + s->opt_len;
+#endif
+    }
+    Assert (s->compressed_len == s->bits_sent, (char*)"bad compressed size");
+    /* The above check is made mod 2^32, for files larger than 512 MB
+     * and uLong implemented on 32 bits.
+     */
+    init_block(s);
+
+    if (eof) {
+        bi_windup(s);
+#ifdef DEBUG
+        s->compressed_len += 7;  /* align on byte boundary */
+#endif
+    }
+    Tracev((stderr,(char*)"\ncomprlen %lu(%lu) ", s->compressed_len>>3,
+           s->compressed_len-7*eof));
+}
+
+/* ===========================================================================
+ * Save the match info and tally the frequency counts. Return true if
+ * the current block must be flushed.
+ */
+int _tr_tally (deflate_state *s, unsigned dist, unsigned lc)
+{
+    s->d_buf[s->last_lit] = (ush)dist;
+    s->l_buf[s->last_lit++] = (uch)lc;
+    if (dist == 0) {
+        /* lc is the unmatched char */
+        s->dyn_ltree[lc].Freq++;
+    } else {
+        s->matches++;
+        /* Here, lc is the match length - MIN_MATCH */
+        dist--;             /* dist = match distance - 1 */
+        Assert((ush)dist < (ush)MAX_DIST(s) &&
+               (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&
+               (ush)d_code(dist) < (ush)D_CODES,  (char*)"_tr_tally: bad match");
+
+        s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++;
+        s->dyn_dtree[d_code(dist)].Freq++;
+    }
+
+#ifdef TRUNCATE_BLOCK
+    /* Try to guess if it is profitable to stop the current block here */
+    if ((s->last_lit & 0x1fff) == 0 && s->level > 2) {
+        /* Compute an upper bound for the compressed length */
+        ulg out_length = (ulg)s->last_lit*8L;
+        ulg in_length = (ulg)((long)s->strstart - s->block_start);
+        int dcode;
+        for (dcode = 0; dcode < D_CODES; dcode++) {
+            out_length += (ulg)s->dyn_dtree[dcode].Freq *
+                (5L+extra_dbits[dcode]);
+        }
+        out_length >>= 3;
+        Tracev((stderr,(char*)"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ",
+               s->last_lit, in_length, out_length,
+               100L - out_length*100L/in_length));
+        if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1;
+    }
+#endif
+    return (s->last_lit == s->lit_bufsize-1);
+    /* We avoid equality with lit_bufsize because of wraparound at 64K
+     * on 16 bit machines and because stored blocks are restricted to
+     * 64K-1 bytes.
+     */
+}
+
+/* ===========================================================================
+ * Send the block data compressed using the given Huffman trees
+ */
+local void compress_block(deflate_state *s, ct_data *ltree, ct_data *dtree)
+{
+    unsigned dist;      /* distance of matched string */
+    int lc;             /* match length or unmatched char (if dist == 0) */
+    unsigned lx = 0;    /* running index in l_buf */
+    unsigned code;      /* the code to send */
+    int extra;          /* number of extra bits to send */
+
+    if (s->last_lit != 0) do {
+        dist = s->d_buf[lx];
+        lc = s->l_buf[lx++];
+        if (dist == 0) {
+            send_code(s, lc, ltree); /* send a literal byte */
+            Tracecv(isgraph(lc), (stderr," '%c' ", lc));
+        } else {
+            /* Here, lc is the match length - MIN_MATCH */
+            code = _length_code[lc];
+            send_code(s, code+LITERALS+1, ltree); /* send the length code */
+            extra = extra_lbits[code];
+            if (extra != 0) {
+                lc -= base_length[code];
+                send_bits(s, lc, extra);       /* send the extra length bits */
+            }
+            dist--; /* dist is now the match distance - 1 */
+            code = d_code(dist);
+            Assert (code < D_CODES, (char*)"bad d_code");
+
+            send_code(s, code, dtree);       /* send the distance code */
+            extra = extra_dbits[code];
+            if (extra != 0) {
+                dist -= base_dist[code];
+                send_bits(s, dist, extra);   /* send the extra distance bits */
+            }
+        } /* literal or match pair ? */
+
+        /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */
+        Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,
+               (char*)"pendingBuf overflow");
+
+    } while (lx < s->last_lit);
+
+    send_code(s, END_BLOCK, ltree);
+    s->last_eob_len = ltree[END_BLOCK].Len;
+}
+
+/* ===========================================================================
+ * Set the data type to ASCII or BINARY, using a crude approximation:
+ * binary if more than 20% of the bytes are <= 6 or >= 128, ascii otherwise.
+ * IN assertion: the fields freq of dyn_ltree are set and the total of all
+ * frequencies does not exceed 64K (to fit in an int on 16 bit machines).
+ */
+local void set_data_type(deflate_state *s)
+{
+    int n = 0;
+    unsigned ascii_freq = 0;
+    unsigned bin_freq = 0;
+    while (n < 7)        bin_freq += s->dyn_ltree[n++].Freq;
+    while (n < 128)    ascii_freq += s->dyn_ltree[n++].Freq;
+    while (n < LITERALS) bin_freq += s->dyn_ltree[n++].Freq;
+    s->strm->data_type = bin_freq > (ascii_freq >> 2) ? Z_BINARY : Z_ASCII;
+}
+
+/* ===========================================================================
+ * Reverse the first len bits of a code, using straightforward code (a faster
+ * method would use a table)
+ * IN assertion: 1 <= len <= 15
+ */
+local unsigned bi_reverse(unsigned code, int len)
+{
+    register unsigned res = 0;
+    do {
+        res |= code & 1;
+        code >>= 1, res <<= 1;
+    } while (--len > 0);
+    return res >> 1;
+}
+
+/* ===========================================================================
+ * Flush the bit buffer, keeping at most 7 bits in it.
+ */
+local void bi_flush(deflate_state *s)
+{
+    if (s->bi_valid == 16) {
+        put_short(s, s->bi_buf);
+        s->bi_buf = 0;
+        s->bi_valid = 0;
+    } else if (s->bi_valid >= 8) {
+        put_byte(s, (Byte)s->bi_buf);
+        s->bi_buf >>= 8;
+        s->bi_valid -= 8;
+    }
+}
+
+/* ===========================================================================
+ * Flush the bit buffer and align the output on a byte boundary
+ */
+local void bi_windup(deflate_state *s)
+{
+    if (s->bi_valid > 8) {
+        put_short(s, s->bi_buf);
+    } else if (s->bi_valid > 0) {
+        put_byte(s, (Byte)s->bi_buf);
+    }
+    s->bi_buf = 0;
+    s->bi_valid = 0;
+#ifdef DEBUG
+    s->bits_sent = (s->bits_sent+7) & ~7;
+#endif
+}
+
+/* ===========================================================================
+ * Copy a stored block, storing first the length and its
+ * one's complement if requested.
+ */
+local void copy_block(deflate_state *s, charf    *buf, unsigned len, int header)
+{
+    bi_windup(s);        /* align on byte boundary */
+    s->last_eob_len = 8; /* enough lookahead for inflate */
+
+    if (header) {
+        put_short(s, (ush)len);
+        put_short(s, (ush)~len);
+#ifdef DEBUG
+        s->bits_sent += 2*16;
+#endif
+    }
+#ifdef DEBUG
+    s->bits_sent += (ulg)len<<3;
+#endif
+    while (len--) {
+        put_byte(s, *buf++);
+    }
+}
Index: tags/visualization-10.5-before-10.6_test/externals/zlib/src/zutil.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/externals/zlib/src/zutil.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/externals/zlib/src/zutil.cc	(revision 1102)
@@ -0,0 +1,304 @@
+/* zutil.c -- target dependent utility functions for the compression library
+ * Copyright (C) 1995-2003 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* @(#) $Id: zutil.cc,v 1.1 2005/05/12 21:04:53 duns Exp $ */
+
+#include "zutil.h"
+
+#ifndef NO_DUMMY_DECL
+struct internal_state      {int dummy;}; /* for buggy compilers */
+#endif
+
+#ifndef STDC
+extern void exit OF((int));
+#endif
+
+const char * const z_errmsg[10] = {
+"need dictionary",     /* Z_NEED_DICT       2  */
+"stream end",          /* Z_STREAM_END      1  */
+"",                    /* Z_OK              0  */
+"file error",          /* Z_ERRNO         (-1) */
+"stream error",        /* Z_STREAM_ERROR  (-2) */
+"data error",          /* Z_DATA_ERROR    (-3) */
+"insufficient memory", /* Z_MEM_ERROR     (-4) */
+"buffer error",        /* Z_BUF_ERROR     (-5) */
+"incompatible version",/* Z_VERSION_ERROR (-6) */
+""};
+
+
+const char * ZEXPORT zlibVersion()
+{
+    return ZLIB_VERSION;
+}
+
+uLong ZEXPORT zlibCompileFlags()
+{
+    uLong flags;
+
+    flags = 0;
+    switch (sizeof(uInt)) {
+    case 2:     break;
+    case 4:     flags += 1;     break;
+    case 8:     flags += 2;     break;
+    default:    flags += 3;
+    }
+    switch (sizeof(uLong)) {
+    case 2:     break;
+    case 4:     flags += 1 << 2;        break;
+    case 8:     flags += 2 << 2;        break;
+    default:    flags += 3 << 2;
+    }
+    switch (sizeof(voidpf)) {
+    case 2:     break;
+    case 4:     flags += 1 << 4;        break;
+    case 8:     flags += 2 << 4;        break;
+    default:    flags += 3 << 4;
+    }
+    switch (sizeof(z_off_t)) {
+    case 2:     break;
+    case 4:     flags += 1 << 6;        break;
+    case 8:     flags += 2 << 6;        break;
+    default:    flags += 3 << 6;
+    }
+#ifdef DEBUG
+    flags += 1 << 8;
+#endif
+#if defined(ASMV) || defined(ASMINF)
+    flags += 1 << 9;
+#endif
+#ifdef ZLIB_WINAPI
+    flags += 1 << 10;
+#endif
+#ifdef BUILDFIXED
+    flags += 1 << 12;
+#endif
+#ifdef DYNAMIC_CRC_TABLE
+    flags += 1 << 13;
+#endif
+#ifdef NO_GZCOMPRESS
+    flags += 1 << 16;
+#endif
+#ifdef NO_GZIP
+    flags += 1 << 17;
+#endif
+#ifdef PKZIP_BUG_WORKAROUND
+    flags += 1 << 20;
+#endif
+#ifdef FASTEST
+    flags += 1 << 21;
+#endif
+#ifdef STDC
+#  ifdef NO_vsnprintf
+        flags += 1 << 25;
+#    ifdef HAS_vsprintf_void
+        flags += 1 << 26;
+#    endif
+#  else
+#    ifdef HAS_vsnprintf_void
+        flags += 1 << 26;
+#    endif
+#  endif
+#else
+        flags += 1 << 24;
+#  ifdef NO_snprintf
+        flags += 1 << 25;
+#    ifdef HAS_sprintf_void
+        flags += 1 << 26;
+#    endif
+#  else
+#    ifdef HAS_snprintf_void
+        flags += 1 << 26;
+#    endif
+#  endif
+#endif
+    return flags;
+}
+
+#ifdef DEBUG
+
+#  ifndef verbose
+#    define verbose 0
+#  endif
+int z_verbose = verbose;
+
+void z_error (char *m)
+{
+    fprintf(stderr, "%s\n", m);
+    exit(1);
+}
+#endif
+
+/* exported to allow conversion of error code to string for compress() and
+ * uncompress()
+ */
+const char * ZEXPORT zError(int err)
+{
+    return ERR_MSG(err);
+}
+
+#if defined(_WIN32_WCE)
+    /* does not exist on WCE */
+    int errno = 0;
+#endif
+
+#ifndef HAVE_MEMCPY
+
+void zmemcpy(Bytef *dest, const Bytef *source, uInt len)
+{
+    if (len == 0) return;
+    do {
+        *dest++ = *source++; /* ??? to be unrolled */
+    } while (--len != 0);
+}
+
+int zmemcmp(const Bytef* s1, const Bytef* s2, uInt len)
+{
+    uInt j;
+
+    for (j = 0; j < len; j++) {
+        if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1;
+    }
+    return 0;
+}
+
+void zmemzero(Bytef *dest, uInt len)
+{
+    if (len == 0) return;
+    do {
+        *dest++ = 0;  /* ??? to be unrolled */
+    } while (--len != 0);
+}
+#endif
+
+
+#ifdef SYS16BIT
+
+#ifdef __TURBOC__
+/* Turbo C in 16-bit mode */
+
+#  define MY_ZCALLOC
+
+/* Turbo C malloc() does not allow dynamic allocation of 64K bytes
+ * and farmalloc(64K) returns a pointer with an offset of 8, so we
+ * must fix the pointer. Warning: the pointer must be put back to its
+ * original form in order to free it, use zcfree().
+ */
+
+#define MAX_PTR 10
+/* 10*64K = 640K */
+
+local int next_ptr = 0;
+
+typedef struct ptr_table_s {
+    voidpf org_ptr;
+    voidpf new_ptr;
+} ptr_table;
+
+local ptr_table table[MAX_PTR];
+/* This table is used to remember the original form of pointers
+ * to large buffers (64K). Such pointers are normalized with a zero offset.
+ * Since MSDOS is not a preemptive multitasking OS, this table is not
+ * protected from concurrent access. This hack doesn't work anyway on
+ * a protected system like OS/2. Use Microsoft C instead.
+ */
+
+voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
+{
+    voidpf buf = opaque; /* just to make some compilers happy */
+    ulg bsize = (ulg)items*size;
+
+    /* If we allocate less than 65520 bytes, we assume that farmalloc
+     * will return a usable pointer which doesn't have to be normalized.
+     */
+    if (bsize < 65520L) {
+        buf = farmalloc(bsize);
+        if (*(ush*)&buf != 0) return buf;
+    } else {
+        buf = farmalloc(bsize + 16L);
+    }
+    if (buf == NULL || next_ptr >= MAX_PTR) return NULL;
+    table[next_ptr].org_ptr = buf;
+
+    /* Normalize the pointer to seg:0 */
+    *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4;
+    *(ush*)&buf = 0;
+    table[next_ptr++].new_ptr = buf;
+    return buf;
+}
+
+void  zcfree (voidpf opaque, voidpf ptr)
+{
+    int n;
+    if (*(ush*)&ptr != 0) { /* object < 64K */
+        farfree(ptr);
+        return;
+    }
+    /* Find the original pointer */
+    for (n = 0; n < next_ptr; n++) {
+        if (ptr != table[n].new_ptr) continue;
+
+        farfree(table[n].org_ptr);
+        while (++n < next_ptr) {
+            table[n-1] = table[n];
+        }
+        next_ptr--;
+        return;
+    }
+    ptr = opaque; /* just to make some compilers happy */
+    Assert(0, "zcfree: ptr not found");
+}
+
+#endif /* __TURBOC__ */
+
+
+#ifdef M_I86
+/* Microsoft C in 16-bit mode */
+
+#  define MY_ZCALLOC
+
+#if (!defined(_MSC_VER) || (_MSC_VER <= 600))
+#  define _halloc  halloc
+#  define _hfree   hfree
+#endif
+
+voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
+{
+    if (opaque) opaque = 0; /* to make compiler happy */
+    return _halloc((long)items, size);
+}
+
+void  zcfree (voidpf opaque, voidpf ptr)
+{
+    if (opaque) opaque = 0; /* to make compiler happy */
+    _hfree(ptr);
+}
+
+#endif /* M_I86 */
+
+#endif /* SYS16BIT */
+
+
+#ifndef MY_ZCALLOC /* Any system without a special alloc function */
+
+#ifndef STDC
+extern voidp  malloc OF((uInt size));
+extern voidp  calloc OF((uInt items, uInt size));
+extern void   free   OF((voidpf ptr));
+#endif
+
+voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
+{
+    if (opaque) items += size - size; /* make compiler happy */
+    return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
+                              (voidpf)calloc(items, size);
+}
+
+void  zcfree (voidpf opaque, voidpf ptr)
+{
+    free(ptr);
+    if (opaque) return; /* make compiler happy */
+}
+
+#endif /* MY_ZCALLOC */
Index: tags/visualization-10.5-before-10.6_test/management/Doxyfile
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/Doxyfile	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/Doxyfile	(revision 1102)
@@ -0,0 +1,1084 @@
+# Doxyfile 1.3.4
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+#       TAG = value [value, ...]
+# For lists items can also be appended using:
+#       TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded 
+# by quotes) that should identify the project.
+
+PROJECT_NAME           = G4vis_management
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. 
+# This could be handy for archiving the generated documentation or 
+# if some version control system is used.
+
+PROJECT_NUMBER         = 
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
+# base path where the generated documentation will be put. 
+# If a relative path is entered, it will be relative to the location 
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY       = $(G4WORKDIR)/tmp/$(G4SYSTEM)/G4vis_management
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all 
+# documentation generated by doxygen is written. Doxygen will use this 
+# information to generate all constant output in the proper language. 
+# The default language is English, other supported languages are: 
+# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, Dutch, 
+# Finnish, French, German, Greek, Hungarian, Italian, Japanese, Japanese-en 
+# (Japanese with English messages), Korean, Norwegian, Polish, Portuguese, 
+# Romanian, Russian, Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian.
+
+OUTPUT_LANGUAGE        = English
+
+# This tag can be used to specify the encoding used in the generated output. 
+# The encoding is not always determined by the language that is chosen, 
+# but also whether or not the output is meant for Windows or non-Windows users. 
+# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES 
+# forces the Windows encoding (this is the default for the Windows binary), 
+# whereas setting the tag to NO uses a Unix-style encoding (the default for 
+# all platforms other than Windows).
+
+USE_WINDOWS_ENCODING   = NO
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will 
+# include brief member descriptions after the members that are listed in 
+# the file and class documentation (similar to JavaDoc). 
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend 
+# the brief description of a member or function before the detailed description. 
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the 
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF           = YES
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then 
+# Doxygen will generate a detailed section even if there is only a brief 
+# description.
+
+ALWAYS_DETAILED_SEC    = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all inherited 
+# members of a class in the documentation of that class as if those members were 
+# ordinary class members. Constructors, destructors and assignment operators of 
+# the base classes will not be shown.
+
+INLINE_INHERITED_MEMB  = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full 
+# path before files name in the file list and in the header files. If set 
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES        = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag 
+# can be used to strip a user-defined part of the path. Stripping is 
+# only done if one of the specified strings matches the left-hand part of 
+# the path. It is allowed to use relative paths in the argument list.
+
+STRIP_FROM_PATH        = 
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter 
+# (but less readable) file names. This can be useful is your file systems 
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES            = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen 
+# will interpret the first line (until the first dot) of a JavaDoc-style 
+# comment as the brief description. If set to NO, the JavaDoc 
+# comments will behave just like the Qt-style comments (thus requiring an 
+# explict @brief command for a brief description.
+
+JAVADOC_AUTOBRIEF      = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen 
+# treat a multi-line C++ special comment block (i.e. a block of //! or /// 
+# comments) as a brief description. This used to be the default behaviour. 
+# The new default is to treat a multi-line C++ comment block as a detailed 
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the DETAILS_AT_TOP tag is set to YES then Doxygen 
+# will output the detailed description near the top, like JavaDoc.
+# If set to NO, the detailed description appears after the member 
+# documentation.
+
+DETAILS_AT_TOP         = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented 
+# member inherits the documentation from any documented member that it 
+# reimplements.
+
+INHERIT_DOCS           = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC 
+# tag is set to YES, then doxygen will reuse the documentation of the first 
+# member in the group (if any) for the other members of the group. By default 
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC   = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. 
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE               = 8
+
+# This tag can be used to specify a number of aliases that acts 
+# as commands in the documentation. An alias has the form "name=value". 
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to 
+# put the command \sideeffect (or @sideeffect) in the documentation, which 
+# will result in a user-defined paragraph with heading "Side Effects:". 
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES                = 
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources 
+# only. Doxygen will then generate output that is more tailored for C. 
+# For instance, some of the names that are used will be different. The list 
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C  = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources 
+# only. Doxygen will then generate output that is more tailored for Java. 
+# For instance, namespaces will be presented as packages, qualified scopes 
+# will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA   = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of 
+# the same type (for instance a group of public functions) to be put as a 
+# subgroup of that type (e.g. under the Public Functions section). Set it to 
+# NO to prevent subgrouping. Alternatively, this can be done per class using 
+# the \nosubgrouping command.
+
+SUBGROUPING            = YES
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in 
+# documentation are documented, even if no documentation was available. 
+# Private class members and static file members will be hidden unless 
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL            = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class 
+# will be included in the documentation.
+
+EXTRACT_PRIVATE        = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file 
+# will be included in the documentation.
+
+EXTRACT_STATIC         = NO
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) 
+# defined locally in source files will be included in the documentation. 
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES  = YES
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all 
+# undocumented members of documented classes, files or namespaces. 
+# If set to NO (the default) these members will be included in the 
+# various overviews, but no documentation section is generated. 
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS     = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all 
+# undocumented classes that are normally visible in the class hierarchy. 
+# If set to NO (the default) these classes will be included in the various 
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES     = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all 
+# friend (class|struct|union) declarations. 
+# If set to NO (the default) these declarations will be included in the 
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS  = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any 
+# documentation blocks found inside the body of a function. 
+# If set to NO (the default) these blocks will be appended to the 
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS      = NO
+
+# The INTERNAL_DOCS tag determines if documentation 
+# that is typed after a \internal command is included. If the tag is set 
+# to NO (the default) then the documentation will be excluded. 
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS          = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate 
+# file names in lower-case letters. If set to YES upper-case letters are also 
+# allowed. This is useful if you have classes or files whose names only differ 
+# in case and if your file system supports case sensitive file names. Windows 
+# users are advised to set this option to NO.
+
+CASE_SENSE_NAMES       = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen 
+# will show members with their full class and namespace scopes in the 
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES       = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen 
+# will put a list of the files that are included by a file in the documentation 
+# of that file.
+
+SHOW_INCLUDE_FILES     = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] 
+# is inserted in the documentation for inline members.
+
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen 
+# will sort the (detailed) documentation of file and class members 
+# alphabetically by member name. If set to NO the members will appear in 
+# declaration order.
+
+SORT_MEMBER_DOCS       = YES
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or 
+# disable (NO) the todo list. This list is created by putting \todo 
+# commands in the documentation.
+
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or 
+# disable (NO) the test list. This list is created by putting \test 
+# commands in the documentation.
+
+GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or 
+# disable (NO) the bug list. This list is created by putting \bug 
+# commands in the documentation.
+
+GENERATE_BUGLIST       = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or 
+# disable (NO) the deprecated list. This list is created by putting 
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional 
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS       = 
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines 
+# the initial value of a variable or define consists of for it to appear in 
+# the documentation. If the initializer consists of more lines than specified 
+# here it will be hidden. Use a value of 0 to hide initializers completely. 
+# The appearance of the initializer of individual variables and defines in the 
+# documentation can be controlled using \showinitializer or \hideinitializer 
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES  = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated 
+# at the bottom of the documentation of classes and structs. If set to YES the 
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES        = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated 
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET                  = YES
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are 
+# generated by doxygen. Possible values are YES and NO. If left blank 
+# NO is used.
+
+WARNINGS               = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings 
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will 
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED   = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for 
+# potential errors in the documentation, such as not documenting some 
+# parameters in a documented function, or documenting parameters that 
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR      = YES
+
+# The WARN_FORMAT tag determines the format of the warning messages that 
+# doxygen can produce. The string should contain the $file, $line, and $text 
+# tags, which will be replaced by the file and line number from which the 
+# warning originated and the warning text.
+
+WARN_FORMAT            = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning 
+# and error messages should be written. If left blank the output is written 
+# to stderr.
+
+WARN_LOGFILE           = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain 
+# documented source files. You may enter file names like "myfile.cpp" or 
+# directories like "/usr/src/myproject". Separate the files or directories 
+# with spaces.
+
+INPUT                  = include \
+                         src \
+                         ../modeling/include \
+                         ../modeling/src \
+                         ../../graphics_reps/include/G4VGraphicsScene.hh \
+                         ../../graphics_reps/include/G4VVisManager.hh \
+                         ../../graphics_reps/src/G4VVisManager.cc
+
+# If the value of the INPUT tag contains directories, you can use the 
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank the following patterns are tested: 
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp 
+# *.h++ *.idl *.odl *.cs *.php *.php3 *.inc
+
+FILE_PATTERNS          = 
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories 
+# should be searched for input files as well. Possible values are YES and NO. 
+# If left blank NO is used.
+
+RECURSIVE              = NO
+
+# The EXCLUDE tag can be used to specify files and/or directories that should 
+# excluded from the INPUT source files. This way you can easily exclude a 
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE                = 
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories 
+# that are symbolic links (a Unix filesystem feature) are excluded from the input.
+
+EXCLUDE_SYMLINKS       = NO
+
+# If the value of the INPUT tag contains directories, you can use the 
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude 
+# certain files from those directories.
+
+EXCLUDE_PATTERNS       = 
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or 
+# directories that contain example code fragments that are included (see 
+# the \include command).
+
+EXAMPLE_PATH           = 
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the 
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank all files are included.
+
+EXAMPLE_PATTERNS       = 
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be 
+# searched for input files to be used with the \include or \dontinclude 
+# commands irrespective of the value of the RECURSIVE tag. 
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE      = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or 
+# directories that contain image that are included in the documentation (see 
+# the \image command).
+
+IMAGE_PATH             = 
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should 
+# invoke to filter for each input file. Doxygen will invoke the filter program 
+# by executing (via popen()) the command <filter> <input-file>, where <filter> 
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an 
+# input file. Doxygen will then use the output that the filter program writes 
+# to standard output.
+
+INPUT_FILTER           = 
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using 
+# INPUT_FILTER) will be used to filter the input files when producing source 
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES    = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will 
+# be generated. Documented entities will be cross-referenced with these sources.
+
+SOURCE_BROWSER         = YES
+
+# Setting the INLINE_SOURCES tag to YES will include the body 
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES         = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct 
+# doxygen to hide any special comment blocks from generated source code 
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS    = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES (the default) 
+# then for each documented function all documented 
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = YES
+
+# If the REFERENCES_RELATION tag is set to YES (the default) 
+# then for each documented function all documented entities 
+# called/used by that function will be listed.
+
+REFERENCES_RELATION    = YES
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen 
+# will generate a verbatim copy of the header file for each class for 
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS       = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index 
+# of all compounds will be generated. Enable this if the project 
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX     = NO
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then 
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns 
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX    = 5
+
+# In case all classes in a project start with a common prefix, all 
+# classes will be put under the same header in the alphabetical index. 
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that 
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX          = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will 
+# generate HTML output.
+
+GENERATE_HTML          = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT            = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for 
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank 
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION    = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard header.
+
+HTML_HEADER            = 
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard footer.
+
+HTML_FOOTER            = 
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading 
+# style sheet that is used by each HTML page. It can be used to 
+# fine-tune the look of the HTML output. If the tag is left blank doxygen 
+# will generate a default style sheet
+
+HTML_STYLESHEET        = 
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, 
+# files or namespaces will be aligned in HTML using tables. If set to 
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS     = YES
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files 
+# will be generated that can be used as input for tools like the 
+# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) 
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP      = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can 
+# be used to specify the file name of the resulting .chm file. You 
+# can add a path in front of the file if the result should not be 
+# written to the html output dir.
+
+CHM_FILE               = 
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can 
+# be used to specify the location (absolute path including file name) of 
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run 
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION           = 
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag 
+# controls if a separate .chi index file is generated (YES) or that 
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI           = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag 
+# controls whether a binary table of contents is generated (YES) or a 
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members 
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND             = NO
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at 
+# top of each HTML page. The value NO (the default) enables the index and 
+# the value YES disables it.
+
+DISABLE_INDEX          = NO
+
+# This tag can be used to set the number of enum values (range [1..20]) 
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE   = 4
+
+# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
+# generated containing a tree-like index structure (just like the one that 
+# is generated for HTML Help). For this to work a browser that supports 
+# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, 
+# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are 
+# probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW      = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be 
+# used to set the initial width (in pixels) of the frame in which the tree 
+# is shown.
+
+TREEVIEW_WIDTH         = 250
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will 
+# generate Latex output.
+
+GENERATE_LATEX         = YES
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT           = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be 
+# invoked. If left blank `latex' will be used as the default command name.
+
+LATEX_CMD_NAME         = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to 
+# generate index for LaTeX. If left blank `makeindex' will be used as the 
+# default command name.
+
+MAKEINDEX_CMD_NAME     = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact 
+# LaTeX documents. This may be useful for small projects and may help to 
+# save some trees in general.
+
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used 
+# by the printer. Possible values are: a4, a4wide, letter, legal and 
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE             = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX 
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES         = 
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for 
+# the generated latex document. The header should contain everything until 
+# the first chapter. If it is left blank doxygen will generate a 
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER           = 
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated 
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will 
+# contain links (just like the HTML output) instead of page references 
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS         = NO
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of 
+# plain latex in the generated Makefile. Set this option to YES to get a 
+# higher quality PDF documentation.
+
+USE_PDFLATEX           = NO
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. 
+# command to the generated LaTeX files. This will instruct LaTeX to keep 
+# running if errors occur, instead of asking the user for help. 
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE        = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not 
+# include the index chapters (such as File Index, Compound Index, etc.) 
+# in the output.
+
+LATEX_HIDE_INDICES     = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output 
+# The RTF output is optimised for Word 97 and may not look very pretty with 
+# other RTF readers or editors.
+
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact 
+# RTF documents. This may be useful for small projects and may help to 
+# save some trees in general.
+
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated 
+# will contain hyperlink fields. The RTF file will 
+# contain links (just like the HTML output) instead of page references. 
+# This makes the output suitable for online browsing using WORD or other 
+# programs which support those fields. 
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS         = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's 
+# config file, i.e. a series of assigments. You only have to provide 
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE    = 
+
+# Set optional variables used in the generation of an rtf document. 
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE    = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will 
+# generate man pages
+
+GENERATE_MAN           = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT             = man
+
+# The MAN_EXTENSION tag determines the extension that is added to 
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION          = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output, 
+# then it will generate one additional man file for each entity 
+# documented in the real man page(s). These additional files 
+# only source the real man page, but without them the man command 
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will 
+# generate an XML file that captures the structure of 
+# the code including all documentation. Note that this 
+# feature is still experimental and incomplete at the 
+# moment.
+
+GENERATE_XML           = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT             = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema, 
+# which can be used by a validating XML parser to check the 
+# syntax of the XML files.
+
+XML_SCHEMA             = 
+
+# The XML_DTD tag can be used to specify an XML DTD, 
+# which can be used by a validating XML parser to check the 
+# syntax of the XML files.
+
+XML_DTD                = 
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will 
+# generate an AutoGen Definitions (see autogen.sf.net) file 
+# that captures the structure of the code including all 
+# documentation. Note that this feature is still experimental 
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF   = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will 
+# generate a Perl module file that captures the structure of 
+# the code including all documentation. Note that this 
+# feature is still experimental and incomplete at the 
+# moment.
+
+GENERATE_PERLMOD       = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate 
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able 
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX          = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be 
+# nicely formatted so it can be parsed by a human reader.  This is useful 
+# if you want to understand what is going on.  On the other hand, if this 
+# tag is set to NO the size of the Perl module output will be much smaller 
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY         = YES
+
+# The names of the make variables in the generated doxyrules.make file 
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. 
+# This is useful so different doxyrules.make files included by the same 
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX = 
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will 
+# evaluate all C-preprocessor directives found in the sources and include 
+# files.
+
+ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro 
+# names in the source code. If set to NO (the default) only conditional 
+# compilation will be performed. Macro expansion can be done in a controlled 
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION        = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES 
+# then the macro expansion is limited to the macros specified with the 
+# PREDEFINED and EXPAND_AS_PREDEFINED tags.
+
+EXPAND_ONLY_PREDEF     = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files 
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that 
+# contain include files that are not input files but should be processed by 
+# the preprocessor.
+
+INCLUDE_PATH           = 
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard 
+# patterns (like *.h and *.hpp) to filter out the header-files in the 
+# directories. If left blank, the patterns specified with FILE_PATTERNS will 
+# be used.
+
+INCLUDE_FILE_PATTERNS  = 
+
+# The PREDEFINED tag can be used to specify one or more macro names that 
+# are defined before the preprocessor is started (similar to the -D option of 
+# gcc). The argument of the tag is a list of macros of the form: name 
+# or name=definition (no spaces). If the definition and the = are 
+# omitted =1 is assumed.
+
+PREDEFINED             = 
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then 
+# this tag can be used to specify a list of macro names that should be expanded. 
+# The macro definition that is found in the sources will be used. 
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED      = 
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then 
+# doxygen's preprocessor will remove all function-like macros that are alone 
+# on a line, have an all uppercase name, and do not end with a semicolon. Such 
+# function macros are typically used for boiler-plate code, and will confuse the 
+# parser if not removed.
+
+SKIP_FUNCTION_MACROS   = YES
+
+#---------------------------------------------------------------------------
+# Configuration::addtions related to external references   
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles. 
+# Optionally an initial location of the external documentation 
+# can be added for each tagfile. The format of a tag file without 
+# this location is as follows: 
+#   TAGFILES = file1 file2 ... 
+# Adding location for the tag files is done as follows: 
+#   TAGFILES = file1=loc1 "file2 = loc2" ... 
+# where "loc1" and "loc2" can be relative or absolute paths or 
+# URLs. If a location is present for each tag, the installdox tool 
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen 
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES               = 
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create 
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE       = 
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed 
+# in the class index. If set to NO only the inherited external classes 
+# will be listed.
+
+ALLEXTERNALS           = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed 
+# in the modules index. If set to NO, only the current project's groups will 
+# be listed.
+
+EXTERNAL_GROUPS        = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script 
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH              = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will 
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base or 
+# super classes. Setting the tag to NO turns the diagrams off. Note that this 
+# option is superceded by the HAVE_DOT option below. This is only a fallback. It is 
+# recommended to install and use dot, since it yields more powerful graphs.
+
+CLASS_DIAGRAMS         = YES
+
+# If set to YES, the inheritance and collaboration graphs will hide 
+# inheritance and usage relations if the target is undocumented 
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS   = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is 
+# available from the path. This tool is part of Graphviz, a graph visualization 
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section 
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT               = NO
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect inheritance relations. Setting this tag to YES will force the 
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect implementation dependencies (inheritance, containment, and 
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH    = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and 
+# collaboration diagrams in a style similiar to the OMG's Unified Modeling 
+# Language.
+
+UML_LOOK               = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the 
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS     = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT 
+# tags are set to YES then doxygen will generate a graph for each documented 
+# file showing the direct and indirect include dependencies of the file with 
+# other documented files.
+
+INCLUDE_GRAPH          = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and 
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each 
+# documented header file showing the documented files that directly or 
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH      = YES
+
+# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will 
+# generate a call dependency graph for every global function or class method. 
+# Note that enabling this option will significantly increase the time of a run. 
+# So in most cases it will be better to enable call graphs for selected 
+# functions only using the \callgraph command.
+
+CALL_GRAPH             = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen 
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY    = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images 
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT       = gif
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be 
+# found. If left blank, it is assumed the dot tool can be found on the path.
+
+DOT_PATH               = 
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that 
+# contain dot files that are included in the documentation (see the 
+# \dotfile command).
+
+DOTFILE_DIRS           = 
+
+# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width 
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than 
+# this value, doxygen will try to truncate the graph, so that it fits within 
+# the specified constraint. Beware that most browsers cannot cope with very 
+# large images.
+
+MAX_DOT_GRAPH_WIDTH    = 1024
+
+# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height 
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than 
+# this value, doxygen will try to truncate the graph, so that it fits within 
+# the specified constraint. Beware that most browsers cannot cope with very 
+# large images.
+
+MAX_DOT_GRAPH_HEIGHT   = 1024
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the 
+# graphs generated by dot. A depth value of 3 means that only nodes reachable 
+# from the root by following a path via at most 3 edges will be shown. Nodes that 
+# lay further from the root node will be omitted. Note that setting this option to 
+# 1 or 2 may greatly reduce the computation time needed for large code bases. Also 
+# note that a graph may be further truncated if the graph's image dimensions are 
+# not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH and MAX_DOT_GRAPH_HEIGHT). 
+# If 0 is used for the depth value (the default), the graph is not depth-constrained.
+
+MAX_DOT_GRAPH_DEPTH    = 0
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will 
+# generate a legend page explaining the meaning of the various boxes and 
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will 
+# remove the intermediate dot files that are used to generate 
+# the various graphs.
+
+DOT_CLEANUP            = YES
+
+#---------------------------------------------------------------------------
+# Configuration::addtions related to the search engine   
+#---------------------------------------------------------------------------
+
+# The SEARCHENGINE tag specifies whether or not a search engine should be 
+# used. If set to NO the values of all tags below this one will be ignored.
+
+SEARCHENGINE           = NO
Index: tags/visualization-10.5-before-10.6_test/management/GNUmakefile
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/GNUmakefile	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/GNUmakefile	(revision 1102)
@@ -0,0 +1,48 @@
+# $Id: GNUmakefile,v 1.15 2006/11/01 10:56:04 allison Exp $
+# -------------------------------------------------------------
+# GNUmakefile for visualization library.  John Allison, 5/7/95.
+
+name := G4vis_management
+
+ifndef G4INSTALL
+  G4INSTALL = ../../..
+endif
+
+# For debug mode
+CPPFLAGS += -DG4DEBUG_VIS_MANAGEMENT
+
+GLOBLIBS  = libG4modeling.lib
+GLOBLIBS += libG4run.lib libG4event.lib
+GLOBLIBS += libG4tracking.lib libG4processes.lib libG4digits_hits.lib
+GLOBLIBS += libG4track.lib libG4particles.lib libG4geometry.lib
+GLOBLIBS += libG4materials.lib libG4graphics_reps.lib
+GLOBLIBS += libG4intercoms.lib libG4global.lib
+
+include $(G4INSTALL)/config/architecture.gmk
+include $(G4INSTALL)/config/G4VIS_BUILD.gmk
+
+CPPFLAGS += -I$(G4BASE)/visualization/management/include
+CPPFLAGS += -I$(G4BASE)/visualization/modeling/include
+CPPFLAGS += -I$(G4BASE)/graphics_reps/include
+CPPFLAGS += -I$(G4BASE)/global/management/include
+CPPFLAGS += -I$(G4BASE)/global/HEPGeometry/include
+CPPFLAGS += -I$(G4BASE)/global/HEPRandom/include
+CPPFLAGS += -I$(G4BASE)/geometry/solids/CSG/include
+CPPFLAGS += -I$(G4BASE)/geometry/solids/specific/include
+CPPFLAGS += -I$(G4BASE)/geometry/solids/Boolean/include
+CPPFLAGS += -I$(G4BASE)/geometry/management/include
+CPPFLAGS += -I$(G4BASE)/geometry/volumes/include
+CPPFLAGS += -I$(G4BASE)/geometry/navigation/include
+CPPFLAGS += -I$(G4BASE)/geometry/magneticfield/include
+CPPFLAGS += -I$(G4BASE)/intercoms/include
+CPPFLAGS += -I$(G4BASE)/tracking/include
+CPPFLAGS += -I$(G4BASE)/digits_hits/hits/include
+CPPFLAGS += -I$(G4BASE)/particles/management/include
+CPPFLAGS += -I$(G4BASE)/materials/include
+CPPFLAGS += -I$(G4BASE)/run/include
+CPPFLAGS += -I$(G4BASE)/event/include
+CPPFLAGS += -I$(G4BASE)/track/include
+CPPFLAGS += -I$(G4BASE)/processes/management/include
+CPPFLAGS += -I$(G4BASE)/digits_hits/digits/include
+
+include $(G4INSTALL)/config/common.gmk
Index: tags/visualization-10.5-before-10.6_test/management/History
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/History	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/History	(revision 1102)
@@ -0,0 +1,606 @@
+$Id: History,v 1.122 2009/07/24 09:20:52 lgarnier Exp $
+
+-------------------------------------------------------------------
+
+     =========================================================
+     Geant4 - an Object-Oriented Toolkit for Simulation in HEP
+     =========================================================
+
+                      Category History file
+                      ---------------------
+This file should be used by G4 developers and category coordinators
+to briefly summarize all major modifications introduced in the code
+and keep track of all category-tags.
+It DOES NOT substitute the  CVS log-message one should put at every
+committal in the CVS repository !
+
+     ----------------------------------------------------------
+     * Reverse chronological order (last date on top), please *
+     ----------------------------------------------------------
+
+      --------------------------------------------------------
+      * Started 31st May 2005.  Hitherto, management history *
+      * has been in the top visualization history file.      *
+      --------------------------------------------------------
+
+History file for visualization management sub-category
+------------------------------------------------------
+
+24th July 2009  Laurent Garnier
+- G4VisCommandsSceneAdd::EventID::operator() : Add a protection if
+  CurrentSceneHandler has no model
+
+13th May 2009  John Allison  (visman-V09-02-02)
+- G4VisCommandsViewerSet.hh/cc: Added /vis/viewer/set/targetPoint.
+- G4VisManager.cc: End of run event keeping information improved.
+
+14th March 2009  John Allison  (visman-V09-02-01)
+- G4VisCommands.hh/.cc: Introduced /vis/initialize.
+- G4VisManager.cc: /vis/verbose and /vis/initialize instantiated in
+    constructor.
+- G4VisExecutive.icc: made methods inline.
+
+25th February 2009  Laurent Garnier  (visman-V09-02-00)
+- Notify handler send by G4VVisManager is implemented in G4VisManager
+
+22th January 2009  Laurent Garnier
+- Fix bug in ratio and geometry on X/Xm/Qt/Win32 viewers. Now Could pass XString like 400x600-0+0 to viewers and set position and location.
+
+12th January 2009  John Allison
+- /vis/viewer/create: Pass both X and Y window size hints to viewer.
+  (To get a non-rectangular viewer give a X-windows-style geometry
+  argument, such as "800x400" or "800x400-0+0".)
+
+2nd December, Laurent Garnier
+ - G4ViewParameters.hh G4ViewParameters.icc G4VisManager.hh G4VisManager.icc 
+   G4ViewParameters.cc G4VisManager.cc G4VViewer.cc G4VisCommandsViewer.cc,
+   do a lot of change to be able to pass XString like 400x600-0+0 to viewers 
+   and set position and location. It will work for Qt, X, Win32 for the moment.
+
+27th July 2008  John Allison (visman-V09-01-05)
+- G4VisCommands.cc: Trap recursive use of /vis/reviewKeptEvents.
+
+30th April 2008  John Allison  (visman-V09-01-04)
+- Fixes more gcc-4.3.0 compiler warnings.
+
+28th April 2008  John Allison  (visman-V09-01-03)
+- G4VisCommandsScene.cc: Improve warning message.
+- G4ViewParameters.hh: Improve commenting for Software Ref. Man.
+
+4th April 2008  John Allison  (visman-V09-01-02)
+ - Fixed gcc-4.3.0 compiler warnings.
+
+5th February 2008, Laurent Garnier
+ - Implemented a function in order to IncrementPan with X,Y,Z values 
+
+29th January 2008  John Allison  (visman-V09-01-01)
+ - G4VisExecutive.icc: Re-instated G4DAWNFILE (somehow got lost!!)
+
+4th January 2008  John Allison  (visman-V09-01-00)
+- Implemented extended 2D interface.
+
+30th November 2007  Laurent Garnier
+- G4VisExecutive.icc : Add a #ifdef G4VIS_USE_DAWN directive in order
+ not to add a 'new G4DAWNFILE' if G4VIS_USE_DAWN is not set
+#endif
+
+16th November 2007  Joseph Perl  (visman-V09-00-02)
+- G4VisCommandsCompound.cc: Replace references to Wired3.
+- G4VisCommandsSceneAdd.cc: Replace references to Wired3.
+
+10th November 2007  John Allison  (visman-V09-00-01)
+- G4VisManager.cc: Minor improvement in messaging.
+- G4VisCommandsScene.cc: Improvements in /vis/scene/endOfEventAction messaging.
+
+10th July 2007  John Allison  (visman-V09-00-00)
+- Remove redundant method declarations in G4VisManager.hh.
+- Reinstate refesh after "/vis/viewer/set/autoRefresh true".
+
+-25th May 2007  John Allison  (visman-V08-03-01)
+ Improved error trapping in viewer initialisation.
+- Bug fix in /vis/scene/notifyHandlers for case of no current viewer.
+
+16th May 2007  John Allison  (visman-V08-03-00)
+- G4VSceneHandler.cc: Added #include "G4AttDef.hh" to help buggy
+  Windows compiler(!).
+
+4th April 2007  John Allison  (visman-V08-02-04)
+- G4VSceneHandler.cc: Bug fix for zero vis atts in LoadAtts.
+
+3rd April 2007  John Allison  (visman-V08-02-03)
+- Added /vis/viewer/set/picking.  Picking is false by default, except
+  for OpenInventor.
+
+25th March 2007  John Allison  (visman-V08-02-02)
+- G4VisExecutive.icc: Removed G4GAGTree.
+- G4VisCommandsCompound.cc: Removed /vis/scene/add/eventID, once
+  again, from /vis/drawVolume.
+- G4VisCommands.cc: Improved messages for /vis/abortReviewKeptEvents.
+- G4VisManager.cc, G4VSceneHandler.cc: Cosmetic.
+
+11th January 2007  John Allison  (visman-V08-02-01)
+- Added /vis/abortReviewKeptEvents.
+- /vis/reviewKeptEvents: Improved guidance.
+- Bug fix: /vis/open in /vis/reviewKeptEvents loop.
+  o Moved fpRequestedEvent from G4VSceneHandler to G4VisManager.
+- Reduced WARNING noise.
+
+5th January 2007  John Allison  (visman-V08-02-00)
+- G4VSceneHandler:
+  o Introduced LoadAtts (from G4OpenInventorSceneHandler, but now
+    available to all scene handlers).  Loads G4AttValues and G4AttDefs
+    onto any object that inherits G4AttHolder.
+  o Change signature of GetLineWidth from G4Visible& to
+    G4VisAttributes* for consistency with similar utility functions.
+    (Only used by OpenGL at present; requires opengl-V08-02-00.)
+  o GetLineSegmentsPerCircle: protected against null vis atts pointer.
+- G4VisCommandsGeometrySet and G4VisManager.cc:
+  o Introduced /vis/geometry/set/forceLineSegmentsPerCircle
+    (inadvertently omitted in previous release).
+  o Improved guidance.
+- G4VisCommandsGeometry.cc: Invoke /vis/viewer/rebuild only if viewer current.
+- G4VViewer.cc: Improved comment.
+- G4VisCommandsCompound.cc:
+  o Re-introduced /vis/scene/add/eventID into /vis/drawVolume.
+- G4VisCommandsViewer.cc: Improve guidance for /vis/viewer/addCutawayPlane.
+
+12th December 2006  Gabriele Cosmo  (visman-V08-01-16)
+- Commented command "vis/scene/add/eventID" forcing event ID to scene in
+  G4VisCommandsCompound.cc.
+
+25th November 2006  John Allison  (visman-V08-01-15)
+- G4VisCommandsSceneAdd.cc: Follow change of behaviour of G4StateManager.
+  Supresses eventID message when state == G4State_EventProc unless last event.
+- G4VisCommands.cc: /vis/reviewKeptEvents:
+  o An improvement in the information printed.
+  o Temporarily set endOfEventAction refresh so that eventID for each event.
+- G4VisCommandsScene.cc: /vis/scene/endOfEventAction:
+  o Restrict warning message so that the warning about the number of
+    kept events only happens for "accumulate".  Improve printing.
+- G4VisCommandsViewer.cc: Spelling correction in warning message.
+- G4VisManager.cc: Correct for 0 requested kept events.
+- G4Scene.cc: Initialise no. of kept events to 0.
+
+22nd November 2006  John Allison  (visman-V08-01-14)
+- Fixed /vis/reviewKeptEvents for "stored" viewers.
+
+21st November 2006  John Allison  (visman-V08-01-13)
+- Fixed double drawing of event.
+- Restored old verbosity and printing interface (for obsolete user vis
+  managers).
+
+16th November 2006  John Allison  (visman-V08-01-12)
+- /vis/scene/notifyHandlers: Refreshes only auto-refresh viewers.
+  Warning of scene change issued for other viewers.
+
+15th November 2006  John Allison  (visman-V08-01-11)
+- First implementation of /vis/reviewKeptEvents.
+
+14th November 2006  John Allison  (visman-V08-01-10)
+- Merged visman-V08-01-08-branch onto main branch.
+
+14th November 2006  John Allison  (visman-V08-01-08-08)
+- Partial implementation of /vis/reviewKeptEvents.
+
+14th November 2006  John Allison  (visman-V08-01-08-07)
+- Minor improvements:
+  o G4VisManager: Removed event count (not used).
+  o G4VSceneHandler: Inhibited drawing when vis disabled.
+  o Various /vis/scene commands: Added update statement so that
+    handlers are notified after change of scene.  Forces rebuild and
+    refresh of all viewers using current scene.
+
+12th November 2006  John Allison  (visman-V08-01-08-06)
+- Further iteration of event refreshing:
+  o G4VisManager:
+    ~ Introduced DrawEvent private method for vis manager and G4VSceneHandler.
+    ~ Removed unused methods from previous attempts.
+  o G4VSceneHandler: Used vis manager DrawEvent.
+  o /vis/scene/add/eventID: improved so it picks up event ids of refreshed
+    events.
+
+11th November 2006  John Allison  (visman-V08-01-08-05)
+- Removed /vis/scene/transientsAction.  Now event keeping by the vis
+  manager is automatic if there is a valid scene.  If the user issues
+  "/vis/scene/endOfEventAction accumulate [<N>]", events are kept up
+  to a maximum N in number (N<0 means unlimited, the default value is
+  100).  Otherwise just the last event is kept.
+- Tidied up.
+
+9th November 2006  John Allison  (visman-V08-01-08-04)
+- G4VisManager: Removed data memebers associated with previous attempts
+  at event refreshing.
+- G4VSceneHandler.cc: Removed previous attempts at event refreshing.
+- /vis/drawVolume and /vis/scene/add/volume: Improved guidance for parallel
+  worlds.
+- /vis/viewer/select: Ensure refresh for auto-refreshing viewers.
+- /vis/viewer/set/autoRefresh: Inhibit refresh for auto-refreshing viewers.
+
+8th November 2006  John Allison  (visman-V08-01-08-03)
+- First attempt at using event keeping to refresh views.
+
+6th November 2006  John Allison  (visman-V08-01-08-02)
+- Merged visman-V08-01-09.
+
+6th November 2006  John Allison  (visman-V08-01-09)
+- /vis/drawVolume and /vis/specify: Suppress all but first warning about
+  needing to refresh for viewers that are not auto refresh.
+- G4VScenehandler.cc: Remove warning about emepty scene.  (Subsequent action
+  is to add a world, if empty - reasonable behaviour.)
+
+5th November 2006  John Allison  (visman-V08-01-08-01)
+- G4VisCommandsSceneAdd.cc: Improved implementation of parallel worlds.  Gets
+  material world = *(transportationManager->GetWorldsIterator()) in all cases
+  following fixes run-V08-01-ref04-01 and geomnav-V08-01-ref04-01.
+
+3rd November 2006  John Allison  (visman-V08-01-08-00)
+- On visman-V08-01-08-branch.
+- G4VisCommandsSceneAdd.cc: First implementation of parallel worlds
+  visualisation: /vis/scene/add/volume worlds
+- G4VisCommandsCompound.cc: Minor re-ordering of commands in /vis/drawVolume
+  to avoid warning messages about empty scene.
+
+3rd November 2006  John Allison  (visman-V08-01-08 with tracking-V08-01-05)
+- Activated /vis/scene/add/trajectories with "rich" and "smooth" - see below.
+  Needs tracking-V08-01-05.
+
+1st November 2006  John Allison  (visman-V08-01-07)
+- /vis/scene/add/trajectories:
+  o Allow string parameters "rich" and "smooth".  Not yet activated
+    (awaiting tags in tracking).
+  o Deprecate use of integer parameter (i_mode).
+- GNUmakefile: Add geometry/magneticfield/include (for new
+  /vis/scene/add/trajectories command above).
+- G4VisManager.cc: Remove unnecessary comment line.
+
+----------------------------------------------------
+19th September 2006  John Allison  (visman-V08-01-06)
+- G4ViewParameters: Added ExplodeCentre.
+- G4VisCommandsGeometrySet.cc: Bug fix in /vis/geometry/set/colour.
+
+----------------------------------------------------
+13th September 2006  John Allison  (visman-V08-01-05)
+- G4ViewParameters: Improved setting and access to explode factor.
+- G4VisCommandsViewer: Added /vis/viewer/clone.
+- G4VisCommandsViewerSet: Added /vis/viewer/set/explodeFactor.
+- G4VisManager.cc: Registered /vis/viewer/clone.
+- G4VSceneHandler.cc: Pass explode factor to modeling parameters.
+
+12th September 2006 Jane Tinslay
+- Add attribute based trajectory drawing & filtering, and attribute based
+  hit filtering
+
+---------------------------------------------------
+4th September 2006  John Allison  (visman-V08-01-04)
+- G4ViewParameters: Added CutawayMode and ChangeCutawayPlane.
+- Added /vis/viewer/addCutawayPlane, changeCutawayPlane, clearCutawayPlanes
+  and /vis/viewer/set/cutawayMode.
+
+30th August 2006  John Allison  (visman-V08-01-03 - needs modeling-V08-01-05)
+- Added /vis/viewer/set/globalLineWidthScale.
+- Augmented /vis/scene/add/volume to include intersection of clipping volume
+  (only box -box *box at present).
+- G4VSceneHandler:
+  o Added GetLineWidth to take account of GlobalLineWidthScale.
+  o Added CreateSection/CutawayPolyhedron to exploit generic sectioning
+    (DCUT) and cutaways.  Currently not activated due to instabilities in
+    BooleanProcessor.
+- G4ViewParameters:
+  o Added GlobalLineWidthScale.
+  o Removed IsViewGeom/Hits/Digis (functionality available in G4Scene).
+
+14th August 2006  John Allison  (visman-V08-01-02)
+- G4VisManager.hh: Added some OpenGL friends.
+- G4VisCommandsCompound.cc: /vis/drawVolume: re-ordered "attach"
+  before "add/volume".  Catches non-existing handlers better.  Overall
+  effect of compound command unchanged.
+- G4VSceneHandler.cc: Added (commented out) code for "event refreshing".
+
+10th July 2006  John Allison (visman-V08-01-01)
+- Co-works with greps-V08-01-01.
+- G4VSceneHandler:
+  o Removed Establish/DecommissionSpecials.
+  o Respect rationalised G4ModelingParameters.
+  o Added GetNoOfSides that respects forced line segments per circle.
+- G4VisCommandsScene.cc: Spelling correction.
+
+3rd July 2006  John Allison (visman-V08-01-00)
+- /vis/scene/transientsAction: Added max number of events parameter.
+- Added /vis/viewer/clearTransients.
+- Improved /vis/list.
+- G4VisManager.hh/icc: Added data members and acces for event copying.
+- G4VisManager.cc:
+  o Verbosity control of model printing.
+  o (Commented out) code for event copying.
+ - G4VSceneHandler.cc:
+  o (Commented out) code for event copying.
+
+8th June 2006 John Allison  (visman-V08-00-23)
+- Fixed bug in /vis/scene/endOfRunAction introduced in visman-V08-00-14
+  that made it ineffective.
+
+7th June 2006 John Allison  (visman-V08-00-22)
+- G4VSceneHandler.cc: Zeroed modeling parameters pointer after use.
+
+6th June 2006 John Allison  (visman-V08-00-21)
+- G4VisCommandsViewer: /vis/viewer/create: Fixed view params copy to self.
+
+4th June 2006 Joseph Perl (visman-V08-00-20)
+- This tag includes all the changes below.
+
+2nd June 2006 Jane Tinslay
+- Add accessor for current trajectory drawing model
+- Make G4HepRepFileSceneHandler a friend of G4VisManager
+
+1st June 2006 Jane Tinslay
+- Add accessor in G4VisListManager
+
+30th May 2006 Jane Tinslay
+- Add G4TrajectoryChargeFilterFactory and G4TrajectoryOriginVolumeFilterFactory
+  to G4VisExecutive
+
+25th May 2006 John Allison  (visman-V08-00-19)
+- G4Scene.cc: Changed default fRecomputeTransients to false.
+- G4VisCommandsViewerSet.cc: /vis/viewer/set/style - remove candidates.
+  Use first letter only (so "/vis/viewer/set/style wire" works, for example.)
+- G4VisFilter/List/ModelManager.hh: Indent printing of models.
+- G4VUserVisAction.hh: Add forward declaration of class G4VGraphicsScene.
+
+22nd May 2006 John Allison  (visman-V08-00-18)
+- G4VisManager:
+  o Added SetReprocessing (for transients).
+  o Reduce dependency on Run (get event from event manager).
+  o (Includes some event copying stuff - commented out.)
+- G4VSceneHandler.cc: Require Idle state for transient re-computation.
+- G4Scene:
+  o Remove Clear().  (Not used.)
+  o Add printing and testing for fRecomputeTransients.  (Forgot in
+    visman-V08-00-08.)
+- /vis/.../list commands: Default verbosity "warnings".
+
+13th May 2006 John Allison  (visman-V08-00-17)
+- Provided identity transformation for 2D drawing.  A temporary
+  expedient until all drivers can implement 2D drawing.
+
+12th May 2006  John Allison  (visman-V08-00-16)
+- Added /vis/list.
+- Added /vis/scene/add/eventID.
+- Final refinements for event/run reprocessing (re-computation of
+  transients):
+  o Pick up random number status from run manager.
+  o Run and event numbers reset.
+  o Protect against non-instantiation of run manager.
+- Followed G4CallbackModel change (see modeling-V08-00-09).
+- G4VisCommandsScene.cc, G4VisCommandsSceneHandler.cc, G4VisCommandsViewer.cc:
+  Corrected SetDefaultValue for verbosity string parameter (changed 0 to "0").
+
+4th May 2006  John Allison  (visman-V08-00-15)
+- Improved protection for null models and parameters.
+
+2nd May 2006 Jane Tinslay 
+- Add G4TrajectoryGenericDrawerFactory to G4VisExecutive
+- Add FilterTrajectory method to G4VisManager
+
+28th April 2006  John Allison (visman-V08-00-14)
+- G4VSceneHandler.cc: Added call to FinishView after run-duration
+  model computation and before end-of-event and transients
+  re-computation to get good buffer swapping behaviour for double
+  buffer drivers.
+- G4VisCommandsScene.cc: Added protection in
+  /vis/scene/endOfRunAction.  Error for accumulate if end of event
+  action is not also accumulate.
+- G4VisManager: To get good refresh bahaviour when re-computing
+  transients in OpenGL*Xm and similar drivers, postpone ShowView to
+  end of run for last event in a run.  This ensures G4 is in Idle
+  state.
+- GNUmakefile: Added includes for access to run manager for above.
+
+22nd April 2006  John Allison (visman-V08-00-13)
+- Bug fix (workaround) for memory leak in CheckModel (bug #861).
+- Implement PrintAvailableModels using improvement below.
+
+21st April 2006 Jane Tinslay
+- Improve printout for trajectory drawing and filtering
+
+19th April 2006  John Allison (visman-V08-00-12 - needs greps-V08-00-02)
+- G4VisManager:
+  o Implemented Draw2D(const G4Text&).
+  o Added PrintAvailableModels (but awaiting implementation).
+  o Fixed directory names (trailing '/').
+- G4VSceneHandler:
+  o Implemented Begin/EndPrimitives2D.
+  o Migrated to direct access to G4PhysicalVolumeModel.
+
+28th March 2006 Jane Tinslay (jst28032006)
+- Introduce G4VisFilterManager.hh to manager filtering
+- Additions to G4VisCommandsListManager, G4VisExecutive, G4VisManager
+  to support filtering
+
+28th March 2006  John Allison  (visman-V08-00-11)
+- Corrects logic of transients re-computation:
+  o G4VisManager and G4VSceneHandler: Improved logic of TransientsDrawn flags.
+  o G4VSceneHandler: Improved logic of transients re-computation.
+  o G4VViewer: Improved logic of fNeedKernelVisit.
+- Unified treatment of bools in commands.
+
+24th March 2006 Jane Tinslay (jst24032006)
+- Introduce trajectory drawing manager which is used by
+  G4VisManager. No change in overall functionality.
+
+16th March 2006 Jane Tinslay (jst16032006)
+- Add G4TrajectoryDrawByOriginVolumeFactory to G4VisExecutive
+
+13th March 2006  John Allison  (visman-V08-00-10)
+- Fixes recomputation of transients when changing drivers.
+- G4VisManager: Added fTransientsDrawnThisEvent/Run.
+- G4VSceneHandler:
+  o Removed fTransientsDrawn (now in G4VisManager).
+  o Added fProcessingSolid.
+  o Fixed recomputation of transients.
+
+8th March 2006  John Allison  (visman-V08-00-09)
+- G4VisManager.cc: Fix bug that causes crash when no current scene handler.
+
+6th March 2006  John Allison  (visman-V08-00-08)
+- Added /vis/scene/transientsAction, a feature for recomputing
+  transients (trajectories, hits, user drawing, etc.) when needed by
+  the viewer.  Thus, transients are "remembered" and may be copied
+  between graphics systems.
+
+9th February 2006  John Allison  (visman-V08-00-07)
+- First implementation of refresh end-of-event models (trajectories, etc.).
+
+8th February 2006  John Allison  (visman-V08-00-06)
+- Needs modeling-V08-00-02.
+- G4VSceneHandler.cc: Made use of G4ModelingParameters::DrawingStyle.
+- G4VisCommandsSceneAdd.cc: Removed unnecessary #include.
+
+3rd February 2006  John Allison  (visman-V08-00-05)
+- Introduced /vis/geometry/... for editing vis attributes of geometry volumes.
+- Very minor printing and comments improvements.
+
+26th January 2006  John Allison  (visman-V08-00-04)
+- G4VViewer: Removed fModified.  It was used to flag a change of view
+  parameters but it was only ever used negatively, i.e., to *prevent*
+  its effect of invoking SetView.  So it has been removed and the
+  responsibility for calling SetView after a change of view parameters
+  rests with the user (e.g., the vis commands).  Only used by OpenGL
+  and OpenInventor; now works with opengl-V08-00-01 and
+  openinventor-V08-00-00.
+- G4VSceneHandler.hh: Improved comments.
+- G4VisListManager.hh: Prevent crash on attempt to Print when nothing
+  registered.
+- G4VisManager.hh: Extended friendship to G4XXXSceneHandler.
+
+25th January 2006  John Allison  (visman-V08-00-03)
+- Retro tag: visman-V08-00-00 + friend status for Ray Tracer.
+
+11th January 2006  John Allison  (visman-V08-00-02)
+- G4VisExecutive.icc: protected with G4VISEXECUTIVE_ICC.
+- G4VisManager.hh: prepared for RayTracer reorganisation (friend status).
+- G4VisCommandsScene.cc: /vis/scene/create: simplified registration of
+  scene to avoid recursive invocation of /vis/scene/notifyHandlers/.
+- G4VisCommandsSceneAdd.cc: Improved message when world not available.
+- G4VisCommandsViewer.cc: /vis/viewer/refresh: When world added, delegate
+  to /vis/scene/notifyHandlers.  Avoids double refresh.
+- G4VisManager.cc: Changed ERROR to WARNING when user calls Draw with
+  invalid view.
+
+9th January 2006  John Allison  (visman-V08-00-01)
+- This tag includes all the changes below.
+
+9th January 2006  John Allison  (visman-V08-00-00)
+- This tag is geant4-08-00-ref-00 + change of 5th January only.
+
+5th January 2006  John Allison
+- G4VSceneHandler.cc: Reversed change of 22nd November 2005:
+  fMarkForClearingTransientStore(true) initially now.  This is so that
+  at end of event or run, the view is refreshed and the scene
+  (detector geometry, etc.) is drawn or written to file.
+
+14th December 2005  John Allison
+- Improved /vis/scene/notifyHandlers so that it forces a rebuild of the
+  graphical database, if any.  Particularly relevant for Open Inventor.
+- G4Scene.cc, G4VSceneHandler.cc: Improved warning messages.
+- G4VisManager.cc: Apply "/vis/scene/notifyHandlers" if world has been added
+  to an empty scene.
+- G4VisCommandsViewer.cc: "/vis/viewer/refresh": if world is added to
+  an empty scene, invoke UpdateVisManagerScene, which applies
+  "/vis/scene/notifyHandlers", which now forces a rebuild.
+- G4VisCommandsViewer.cc: Fix bug in "/vis/viewer/rebuild".
+
+4th December  John Allison (visman-V07-01-10)
+- G4Vismanager.cc: Prevent ERROR messages at end of event and run when
+  user has not instantiated a scene handler, e.g., in batch mode.
+
+29th November 2005  Jane Tinslay
+- Make G4VisManager::RegisterModelFactories() non-pure for 
+  backwards compatibility.
+- Add information message to G4VisManager::DispatchToModel when default trajectory
+  model is used.
+
+23rd November 2005  Joseph Perl  (visman-V07-01-09)
+- Tagged in preparation for Geant4 8.0
+
+23rd November 2005  Jane Tinslay
+- Enhanced trajectory implementation
+
+22nd November 2005  John Allison
+- Added /vis/viewer/rebuild (forces visit of kernel).
+- Changed G4Transform3D::Identity to G4Transform3D().
+- Tidied initial printing.
+- Removed MyVisManager (was deprecated in previous major release).
+- G4VSceneHandler.cc: fMarkForClearingTransientStore(false) initially.
+- G4VVisCommand.cc: Improved UpdateVisManagerScene.
+- Refined guidance of issue "/tracking/storeTrajectory 1" on
+  "/vis/scene/add/trajectories".
+- Improved /vis/sceneHandler/attach.
+- G4VisManager.cc: Improved comments.
+
+13th October 2005  John Allison  (visman-V07-01-08)
+- G4ViewParameters: Added XGeometryString.
+- G4VViewer.cc: Pick up XGeometryString.
+- /vis/open and /vis/viewer/create: Allow X-Windows-type geometry string
+  in window size hints.
+- /vis/viewer/set/background: Add opacity parameter.
+
+20th October 2005  John Allison  (visman-V07-01-07)
+- G4VisManager:
+  o Added methods for managing trajectory models.
+  o Implemented first version of DispatchToCurrentModel(const G4VTrajectory&,
+    G4int i_mode).
+  o Created /vis/modeling/trajectories/ for trajectory model messengers.
+  o Added XGeometryString for some future viewer enhancements.
+- G4VisExecutive: Added RegisterTrajectoryModelMakers.
+
+20th October 2005  John Allison (visman-V07-01-06)
+- Get standard colours with "/vis/viewer/set/background red", for example.
+- G4VisCommandsViewer.cc: Fixed G4ThreeVector/G4Vector3D problem with
+  CLHEP-1.9.2.1.
+
+13th October 2005  John Allison (visman-V07-01-05)
+- Background colour - /vis/viewer/set/background.
+- Non-uniform scaling - /vis/viewer/scale and scaleTo.
+- Migrated to <sstream>.
+
+12th October 2005  John Allison (vis-V07-01-03)
+- G4VisCommandsViewer.cc: Trapped zero viewer pointer in /vis/viewer/update
+  (bug found by system test of vis-V07-01-02).
+
+16th September 2005  John Allison (visman-V07-01-04)
+- Simplified use of ConcreteInstance.  It is now always non-zero for
+  an instantiated vis manager; invalid views are reported by the vis
+  manager.  The exception is /vis/disable which zeros it; /vis/enable
+  or any valid command resets it.
+
+16th September 2005  John Allison (visman-V07-01-03)
+- Issue "/tracking/storeTrajectory 1" on /vis/scene/add/trajectories.
+- Added warning:
+  o Attempt to add volume to a scene already containing the world.
+- Added error message:
+  o Logical volume model must be only volume model in scene.
+- G4Scene.cc: Improvement - no functional change.
+
+13th September 2005  John Allison (visman-V07-01-02)
+- Added WhiteBackground to G4ViewParameters.
+- Added /vis/viewer/set/whiteBackground.
+- G4VSceneHandler::GetColour and GetTextColour: white and opaque
+  objects on a white background are changed to black.
+- Added RayTracerX to G4VisExecutive under control of G4VIS_USE_RAYTRACERX.
+- Re-instated invocation of SetView and ClearView in /vis/viewer/refresh.
+
+2nd September 2005  John Allison (visman-V07-01-01)
+- Introduced optional second pass over run-duration models in
+  G4VSceneHandler::ProcessScene.
+
+20th July 2005  John Allison (visman-V07-01-00)
+- G4VisCommandsViewer.cc: Protected new viewer pointer.
+
+7th June 2005  John Allison (visman-V07-00-02)
+- /vis/scene/notifyHandlers: Fixed case of scene handler with no viewer.
+
+31st May 2005  John Allison  (visman-V07-00-01)
+- G4VisCommandsSceneAdd.cc: Fixed /vis/scene/add/text to accept text
+  with spaces.
+- G4ViewParameters.cc: Printed WARNING: Viewpoint direction is very
+  close to the up vector direction.
Index: tags/visualization-10.5-before-10.6_test/management/include/G4GraphicsSystemList.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/include/G4GraphicsSystemList.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/include/G4GraphicsSystemList.hh	(revision 1102)
@@ -0,0 +1,49 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4GraphicsSystemList.hh,v 1.9 2006/06/29 21:27:54 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  2nd April 1996
+
+#ifndef G4GRAPHICSSYSTEMLIST_HH
+#define G4GRAPHICSSYSTEMLIST_HH
+
+#include <vector>
+#include "G4VGraphicsSystem.hh"
+
+class G4GraphicsSystemList: public std::vector<G4VGraphicsSystem*> {
+public:
+  void remove(G4VGraphicsSystem*);
+};
+
+typedef std::vector<G4VGraphicsSystem*>::iterator
+        G4GraphicsSystemListIterator;
+typedef std::vector<G4VGraphicsSystem*>::const_iterator
+        G4GraphicsSystemListConstIterator;
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/management/include/G4Scene.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/include/G4Scene.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/include/G4Scene.hh	(revision 1102)
@@ -0,0 +1,169 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4Scene.hh,v 1.18 2006/11/14 14:59:54 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Scene  John Allison  19th July 1996.
+//
+// Class Description:
+//
+// Defines the viewable scene.
+
+#ifndef G4SCENE_HH
+#define G4SCENE_HH
+
+#include "globals.hh"
+#include "G4ios.hh"
+
+class G4VPhysicalVolume;
+
+#include "G4VisExtent.hh"
+#include "G4Point3D.hh"
+#include "G4VModel.hh"
+#include <vector>
+
+class G4Scene {
+
+public: // With description
+
+  friend std::ostream& operator << (std::ostream& os, const G4Scene& d);
+
+  enum {UNLIMITED = -1};
+
+  G4Scene (const G4String& name = "scene-with-unspecified-name");
+  ~G4Scene ();
+
+  // Makes use of default (compiler generated) copy constructor and
+  // assignment operator.
+
+  G4bool operator == (const G4Scene&) const;
+  G4bool operator != (const G4Scene&) const;
+
+  //////////////////////////////////////////////////////
+  // Get functions...
+
+  const G4String& GetName () const;
+
+  G4bool IsEmpty () const;
+
+  const std::vector<G4VModel*>& GetRunDurationModelList () const;
+  // Contains models which are expected to last for the duration of
+  // the run, for example geometry volumes.
+
+  const std::vector<G4VModel*>& GetEndOfEventModelList () const;
+  // Contains models which are described at the end of event when the
+  // scene is current.
+
+  const G4VisExtent& GetExtent () const;
+  // Overall extent of all objects in the scene.
+
+  const G4Point3D& GetStandardTargetPoint () const;
+  // Usually centre of extent.  See G4ViewParameters for definition.
+
+  G4bool GetRefreshAtEndOfEvent () const;
+  // If true, the visualization manager will request viewer to refresh
+  // "transient" objects, such as hits, at end of event.  Otherwise
+  // they will be accumulated.
+
+  G4int GetMaxNumberOfKeptEvents() const;
+  // If RefreshAtEndOfEvent is false, events of the current run are
+  // kept up to this maximum number.  A negative value means all
+  // events of current run are kept.  The events are available for
+  // viewing at the end of run, but are deleted just before the start
+  // of the next run.
+
+  G4bool GetRefreshAtEndOfRun () const;
+  // If true, the visualization manager will request viewer to refresh
+  // "transient" objects, such as hits, at end of run.  Otherwise
+  // they will be accumulated.
+
+  //////////////////////////////////////////////
+  // Add and Set functions...
+
+  G4bool AddRunDurationModel (G4VModel*, G4bool warn = false);
+  // Adds models of type which are expected to last for the duration
+  // of the run, for example geometry volumes.
+  // Returns false if model is already in the list.
+  // Prints warnings if warn is true.
+
+  G4bool AddWorldIfEmpty (G4bool warn = false);
+  // In some situations, if the user asks for a drawing and has not
+  // yet set any run duration models it makes sense to put the "world"
+  // in there by default.
+  // Returns false if model is already in the list.
+  // Prints warnings if warn is true.
+
+  G4bool AddEndOfEventModel (G4VModel*, G4bool warn = false);
+  // Adds models of type which are described at the end of event when
+  // the scene is current.
+  // Returns false if model is already in the list.
+  // Prints warnings if warn is true.
+
+  std::vector<G4VModel*>& SetRunDurationModelList ();
+  // Allows you to change the model list - do with care!
+
+  std::vector<G4VModel*>& SetEndOfEventModelList ();
+  // Allows you to change the model list - do with care!
+
+  void SetRefreshAtEndOfEvent(G4bool);
+  // If set true, the visualization manager will request viewer to
+  // refresh "transient" objects, such as hits, at end of event.
+  // Otherwise they will be accumulated.
+
+  void SetMaxNumberOfKeptEvents(G4int);
+  // If RefreshAtEndOfEvent is false, events of the current run are
+  // kept up to this maximum number.  A negative value means all
+  // events of current run are kept.  The events are available for
+  // viewing at the end of run, but are deleted just before the start
+  // of the next run.
+
+  void SetRefreshAtEndOfRun(G4bool);
+  // If set true, the visualization manager will request viewer to
+  // refresh "transient" objects, such as hits, at end of run.
+  // Otherwise they will be accumulated.
+
+  //////////////////////////////////////////////
+  // Other functions...
+
+  void CalculateExtent();
+  // (Re-)calculates the extent from the extents of its models.
+
+private:
+  G4String fName;
+  std::vector<G4VModel*> fRunDurationModelList;
+  std::vector<G4VModel*> fEndOfEventModelList;
+  G4VisExtent fExtent;
+  G4Point3D   fStandardTargetPoint;
+  G4bool      fRefreshAtEndOfEvent;
+  G4bool      fRefreshAtEndOfRun;
+  G4int       fMaxNumberOfKeptEvents;
+};
+
+#include "G4Scene.icc"
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/management/include/G4Scene.icc
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/include/G4Scene.icc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/include/G4Scene.icc	(revision 1102)
@@ -0,0 +1,95 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4Scene.icc,v 1.14 2006/11/14 14:59:54 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Scene data  John Allison  19th July 1996.
+
+inline G4bool G4Scene::operator == (const G4Scene& s) const {
+  return !(G4Scene::operator != (s));
+}
+
+inline const G4String& G4Scene::GetName () const {
+  return fName;
+}
+
+inline G4bool G4Scene::IsEmpty () const {
+  return fRunDurationModelList.size () == 0;
+}
+
+inline const std::vector<G4VModel*>&
+G4Scene::GetRunDurationModelList () const {
+  return fRunDurationModelList;
+}
+
+inline const std::vector<G4VModel*>&
+G4Scene::GetEndOfEventModelList () const {
+  return fEndOfEventModelList;
+}
+
+inline const G4VisExtent& G4Scene::GetExtent () const {
+  return fExtent;
+}
+
+inline const G4Point3D& G4Scene::GetStandardTargetPoint () const {
+  return fStandardTargetPoint;
+}
+
+inline G4bool G4Scene::GetRefreshAtEndOfEvent () const {
+  return fRefreshAtEndOfEvent;
+}
+
+inline G4int G4Scene::GetMaxNumberOfKeptEvents() const {
+  return fMaxNumberOfKeptEvents;
+}
+
+inline G4bool G4Scene::GetRefreshAtEndOfRun () const {
+  return fRefreshAtEndOfRun;
+}
+
+inline std::vector<G4VModel*>& G4Scene::SetRunDurationModelList ()
+{
+  return fRunDurationModelList;
+}
+
+inline std::vector<G4VModel*>& G4Scene::SetEndOfEventModelList ()
+{
+  return fRunDurationModelList;
+}
+
+inline void G4Scene::SetRefreshAtEndOfEvent(G4bool refresh) {
+  fRefreshAtEndOfEvent = refresh;
+}
+
+inline void G4Scene::SetMaxNumberOfKeptEvents(G4int max) {
+  fMaxNumberOfKeptEvents = max;
+}
+
+inline void G4Scene::SetRefreshAtEndOfRun(G4bool refresh) {
+  fRefreshAtEndOfRun = refresh;
+}
Index: tags/visualization-10.5-before-10.6_test/management/include/G4SceneHandlerList.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/include/G4SceneHandlerList.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/include/G4SceneHandlerList.hh	(revision 1102)
@@ -0,0 +1,48 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4SceneHandlerList.hh,v 1.8 2006/06/29 21:28:00 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  May 1996
+
+#ifndef G4SCENEHANDLERLIST_HH
+#define G4SCENEHANDLERLIST_HH
+
+#include <vector>
+#include "G4VSceneHandler.hh"
+
+class G4SceneHandlerList: public std::vector<G4VSceneHandler*> {
+public:
+  void remove(G4VSceneHandler*);
+};
+
+typedef std::vector<G4VSceneHandler*>::iterator G4SceneHandlerListIterator;
+typedef std::vector<G4VSceneHandler*>::const_iterator
+        G4SceneHandlerListConstIterator;
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/management/include/G4SceneList.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/include/G4SceneList.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/include/G4SceneList.hh	(revision 1102)
@@ -0,0 +1,47 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4SceneList.hh,v 1.10 2006/06/29 21:28:02 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  9th August 1998
+
+#ifndef G4SCENELIST_HH
+#define G4SCENELIST_HH
+
+#include "G4Scene.hh"
+#include <vector>
+
+class G4SceneList: public std::vector <G4Scene*> {
+public:
+  void remove(G4Scene*);
+};
+
+typedef std::vector<G4Scene*>::iterator G4SceneListIterator;
+typedef std::vector<G4Scene*>::const_iterator G4SceneListConstIterator;
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/management/include/G4VGraphicsSystem.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/include/G4VGraphicsSystem.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/include/G4VGraphicsSystem.hh	(revision 1102)
@@ -0,0 +1,94 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VGraphicsSystem.hh,v 1.11 2006/06/29 21:28:04 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  27th March 1996
+//
+// Class description
+//
+// Abstract interface class for graphics systems.
+
+#ifndef G4VGRAPHICSSYSTEM_HH
+#define G4VGRAPHICSSYSTEM_HH
+
+#include "globals.hh"
+
+class G4VSceneHandler;
+class G4VViewer;
+
+class G4VGraphicsSystem {
+
+public: // With description
+
+  enum Functionality {
+    noFunctionality,
+    nonEuclidian,       // e.g., tree representation of geometry hierarchy.
+    twoD,               // Simple 2D, e.g., X (no stored structures).
+    twoDStore,          // 2D with stored structures.
+    threeD,             // Passive 3D (with stored structures).
+    threeDInteractive,  // 3D with "pick" functionality.
+    virtualReality      // Virtual Reality functionality.
+  };
+
+  G4VGraphicsSystem (const G4String& name,
+		     Functionality f);
+
+  G4VGraphicsSystem (const G4String& name,
+		     const G4String& nickname,
+		     Functionality f);
+
+  G4VGraphicsSystem (const G4String& name,
+		     const G4String& nickname,
+		     const G4String& description,
+		     Functionality f);
+
+  virtual ~G4VGraphicsSystem ();
+
+  virtual G4VSceneHandler* CreateSceneHandler (const G4String& name) = 0;
+
+  virtual G4VViewer* CreateViewer (G4VSceneHandler&, const G4String& name) = 0;
+
+  // Access functions.
+  const G4String& GetName          () const;
+  const G4String& GetNickname      () const;
+  const G4String& GetDescription   () const;
+  Functionality   GetFunctionality () const;
+
+protected:
+  const G4String fName;
+  const G4String fNickname;
+  const G4String fDescription;
+  Functionality  fFunctionality;
+};
+
+std::ostream& operator << (std::ostream& os, const G4VGraphicsSystem& gs);
+
+#include "G4VGraphicsSystem.icc"
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/management/include/G4VGraphicsSystem.icc
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/include/G4VGraphicsSystem.icc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/include/G4VGraphicsSystem.icc	(revision 1102)
@@ -0,0 +1,49 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VGraphicsSystem.icc,v 1.7 2006/06/29 21:28:06 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  27th March 1996
+// Abstract interface class for graphics systems.
+
+inline const G4String& G4VGraphicsSystem::GetName () const {
+  return fName;
+}
+
+inline const G4String& G4VGraphicsSystem::GetNickname () const {
+  return fNickname;
+}
+
+inline const G4String& G4VGraphicsSystem::GetDescription () const {
+  return fDescription;
+}
+
+inline G4VGraphicsSystem::Functionality
+G4VGraphicsSystem::GetFunctionality () const {
+  return fFunctionality;
+}
Index: tags/visualization-10.5-before-10.6_test/management/include/G4VSceneHandler.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/include/G4VSceneHandler.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/include/G4VSceneHandler.hh	(revision 1102)
@@ -0,0 +1,368 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VSceneHandler.hh,v 1.40 2008/01/04 22:03:45 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  19th July 1996.
+//
+// Class description
+//
+// Abstract interface class for graphics scene handlers.
+// Inherits from G4VGraphicsScene, in the intercoms category, which is
+// a minimal abstract interface for the GEANT4 kernel.
+
+#ifndef G4VSCENEHANDLER_HH
+#define G4VSCENEHANDLER_HH
+
+#include "globals.hh"
+
+#include <stack>
+
+#include "G4VGraphicsScene.hh"
+#include "G4ViewerList.hh"
+#include "G4ViewParameters.hh"
+
+class G4Scene;
+class G4VViewer;
+class G4Colour;
+class G4Visible;
+class G4ModelingParameters;
+class G4VModel;
+class G4VGraphicsSystem;
+class G4LogicalVolume;
+class G4VPhysicalVolume;
+class G4Material;
+class G4Event;
+class G4AttHolder;
+
+class G4VSceneHandler: public G4VGraphicsScene {
+
+public: // With description
+
+  friend std::ostream& operator << (std::ostream& os, const G4VSceneHandler& s);
+
+  enum MarkerSizeType {world, screen};
+
+  G4VSceneHandler (G4VGraphicsSystem& system,
+		   G4int id,
+		   const G4String& name = "");
+
+  virtual ~G4VSceneHandler ();
+
+  ///////////////////////////////////////////////////////////////////
+  // Methods for adding raw GEANT4 objects to the scene handler.  They
+  // must always be called in the triplet PreAddSolid, AddSolid and
+  // PostAddSolid.  The transformation and visualization attributes
+  // must be set by the call to PreAddSolid.  If your graphics system
+  // is sophisticated enough to handle a particular solid shape as a
+  // primitive, in your derived class write a function to override one
+  // or more of the following.  See the implementation of
+  // G4VSceneHandler::AddSolid (const G4Box& box) for more
+  // suggestions.  If not, please implement the base class invocation.
+
+  virtual void PreAddSolid (const G4Transform3D& objectTransformation,
+			   const G4VisAttributes& visAttribs);
+  // objectTransformation is the transformation in the world
+  // coordinate system of the object about to be added, and visAttribs
+  // is its visualization attributes.
+  // IMPORTANT: invoke this from your polymorphic versions, e.g.:
+  // void MyXXXSceneHandler::PreAddSolid
+  //  (const G4Transform3D& objectTransformation,
+  //   const G4VisAttributes& visAttribs) {
+  //   G4VSceneHandler::PreAddSolid (objectTransformation, visAttribs);
+  //   ...
+  // }
+
+  virtual void PostAddSolid ();
+  // IMPORTANT: invoke this from your polymorphic versions, e.g.:
+  // void MyXXXSceneHandler::PostAddSolid () {
+  //   ...
+  //   G4VSceneHandler::PostAddSolid ();
+  // }
+
+  virtual void AddSolid (const G4Box&);
+  virtual void AddSolid (const G4Cons&);
+  virtual void AddSolid (const G4Tubs&);
+  virtual void AddSolid (const G4Trd&);
+  virtual void AddSolid (const G4Trap&);
+  virtual void AddSolid (const G4Sphere&);
+  virtual void AddSolid (const G4Para&);
+  virtual void AddSolid (const G4Torus&);
+  virtual void AddSolid (const G4Polycone&);
+  virtual void AddSolid (const G4Polyhedra&);
+  virtual void AddSolid (const G4VSolid&);  // For solids not above.
+
+  ///////////////////////////////////////////////////////////////////
+  // Methods for adding "compound" GEANT4 objects to the scene
+  // handler.  These methods may either (a) invoke "user code" that
+  // uses the "user interface", G4VVisManager (see, for example,
+  // G4VSceneHandler, which for trajectories uses
+  // G4VTrajectory::DrawTrajectory, via G4TrajectoriesModel in the
+  // Modeling Category) or (b) invoke AddPrimitives below (between
+  // calls to Begin/EndPrimitives) or (c) use graphics-system-specific
+  // code or (d) any combination of the above.
+
+  virtual void AddCompound (const G4VTrajectory&);
+  virtual void AddCompound (const G4VHit&);
+
+  //////////////////////////////////////////////////////////////
+  // Functions for adding primitives.
+
+  virtual void BeginModeling ();
+  // IMPORTANT: invoke this from your polymorphic versions, e.g.:
+  // void MyXXXSceneHandler::BeginModeling () {
+  //   G4VSceneHandler::BeginModeling ();
+  //   ...
+  // }
+
+  virtual void EndModeling ();
+  // IMPORTANT: invoke this from your polymorphic versions, e.g.:
+  // void MyXXXSceneHandler::EndModeling () {
+  //   ...
+  //   G4VSceneHandler::EndModeling ();
+  // }
+
+  virtual void BeginPrimitives
+  (const G4Transform3D& objectTransformation);
+  // IMPORTANT: invoke this from your polymorphic versions, e.g.:
+  // void MyXXXSceneHandler::BeginPrimitives
+  // (const G4Transform3D& objectTransformation) {
+  //   G4VSceneHandler::BeginPrimitives (objectTransformation);
+  //   ...
+  // }
+
+  virtual void EndPrimitives ();
+  // IMPORTANT: invoke this from your polymorphic versions, e.g.:
+  // void MyXXXSceneHandler::EndPrimitives () {
+  //   ...
+  //   G4VSceneHandler::EndPrimitives ();
+  // }
+
+  virtual void BeginPrimitives2D
+  (const G4Transform3D& objectTransformation);
+  // The x,y coordinates of the primitives passed to AddPrimitive are
+  // intrepreted as screen coordinates, -1 < x,y < 1.  The
+  // z-coordinate is ignored.
+  // IMPORTANT: invoke this from your polymorphic versions, e.g.:
+  // void MyXXXSceneHandler::BeginPrimitives2D
+  // (const G4Transform3D& objectTransformation) {
+  //   G4VSceneHandler::BeginPrimitives2D ();
+  //   ...
+  // }
+
+  virtual void EndPrimitives2D ();
+  // IMPORTANT: invoke this from your polymorphic versions, e.g.:
+  // void MyXXXSceneHandler::EndPrimitives2D () {
+  //   ...
+  //   G4VSceneHandler::EndPrimitives2D ();
+  // }
+
+  virtual void AddPrimitive (const G4Polyline&)   = 0;
+  virtual void AddPrimitive (const G4Scale&);
+  // Default implementation in this class but can be over-ridden.
+  virtual void AddPrimitive (const G4Text&)       = 0;
+  virtual void AddPrimitive (const G4Circle&)     = 0;      
+  virtual void AddPrimitive (const G4Square&)     = 0;      
+  virtual void AddPrimitive (const G4Polymarker&);
+  // Default implementation in this class but can be over-ridden.
+  virtual void AddPrimitive (const G4Polyhedron&) = 0;  
+  virtual void AddPrimitive (const G4NURBS&)      = 0;       
+
+  //////////////////////////////////////////////////////////////
+  // Access functions.
+  const G4String&     GetName           () const;
+  G4int               GetSceneHandlerId () const;
+  G4int               GetViewCount      () const;
+  G4VGraphicsSystem*  GetGraphicsSystem () const;
+  G4Scene*            GetScene          () const;
+  const G4ViewerList& GetViewerList     () const;
+  G4VModel*           GetModel          () const;
+  G4VViewer*          GetCurrentViewer  () const;
+  G4bool              GetMarkForClearingTransientStore () const;
+  G4bool              IsReadyForTransients () const;
+  G4bool              GetTransientsDrawnThisEvent () const;
+  G4bool              GetTransientsDrawnThisRun   () const;
+  void          SetName          (const G4String&);
+  void          SetCurrentViewer (G4VViewer*);
+  void          SetScene         (G4Scene*);
+  G4ViewerList& SetViewerList    ();  // Non-const so you can change.
+  void          SetModel         (G4VModel*);
+  void          SetMarkForClearingTransientStore (G4bool);
+  // Sets flag which will cause transient store to be cleared at the
+  // next call to BeginPrimitives().  Maintained by vis manager.
+  void          SetTransientsDrawnThisEvent      (G4bool);
+  void          SetTransientsDrawnThisRun        (G4bool);
+  // Maintained by vis manager.
+
+  //////////////////////////////////////////////////////////////
+  // Public utility functions.
+
+  const G4Colour& GetColour (const G4Visible&);
+  const G4Colour& GetColor  (const G4Visible&);
+  // Returns colour of G4Visible object, or default global colour.
+
+  const G4Colour& GetTextColour (const G4Text&);
+  const G4Colour& GetTextColor  (const G4Text&);
+  // Returns colour of G4Text object, or default text colour.
+
+  G4double GetLineWidth(const G4VisAttributes*);
+  // Returns line width of G4VisAttributes multiplied by GlobalLineWidthScale.
+
+  G4ViewParameters::DrawingStyle GetDrawingStyle (const G4VisAttributes*);
+  // Returns drawing style from current view parameters, unless the user
+  // has forced through the vis attributes, thereby over-riding the
+  // current view parameter.
+
+  G4bool GetAuxEdgeVisible (const G4VisAttributes*);
+  // Returns auxiliary edge visibility from current view parameters,
+  // unless the user has forced through the vis attributes, thereby
+  // over-riding the current view parameter.
+
+  G4int GetNoOfSides(const G4VisAttributes*);
+  // Returns no. of sides (lines segments per circle) from current
+  // view parameters, unless the user has forced through the vis
+  // attributes, thereby over-riding the current view parameter.
+
+  G4double GetMarkerSize (const G4VMarker&, MarkerSizeType&);
+  // Returns applicable marker size (diameter) and type (in second
+  // argument).  Uses global default marker if marker sizes are not
+  // set.  Multiplies by GlobalMarkerScale.
+
+  G4double GetMarkerDiameter (const G4VMarker&, MarkerSizeType&);
+  // Alias for GetMarkerSize.
+
+  G4double GetMarkerRadius (const G4VMarker&, MarkerSizeType&);
+  // GetMarkerSize / 2.
+
+  G4ModelingParameters* CreateModelingParameters ();
+  // Only the scene handler and view know what the Modeling Parameters should
+  // be.  For historical reasons, the GEANT4 Visualization Environment
+  // maintains its own Scene Data and View Parameters, which must be
+  // converted, when needed, to Modeling Parameters.
+
+  void DrawEvent(const G4Event*);
+  // Checks scene's end-of-event model list and draws trajectories,
+  // hits, etc.
+
+  //////////////////////////////////////////////////////////////
+  // Administration functions.
+
+  G4int IncrementViewCount ();
+
+  virtual void ClearStore ();
+  // Clears graphics database (display lists) if any.  This base class
+  // implements some common functionality so...
+  // IMPORTANT: invoke this from your polymorphic versions, e.g.:
+  // void MyXXXSceneHandler::ClearStore () {
+  //   G4VSceneHandler::ClearStore ();
+  //   ...
+  // }
+
+  virtual void ClearTransientStore ();
+  // Clears transient part of graphics database (display lists) if any.
+  // This base class implements some common functionality so...
+  // IMPORTANT: invoke this from your polymorphic versions, e.g.:
+  // void MyXXXSceneHandler::ClearTransientStore () {
+  //   G4VSceneHandler::ClearTransientStore ();
+  //   ...
+  // }
+
+  void AddViewerToList      (G4VViewer* pView);  // Add view to view List.
+  void RemoveViewerFromList (G4VViewer* pView);  // Remove view from view List.
+
+protected:
+
+  //////////////////////////////////////////////////////////////
+  // Default routine used by default AddSolid ().
+
+  virtual void RequestPrimitives (const G4VSolid& solid);
+
+  //////////////////////////////////////////////////////////////
+  // Other internal routines...
+
+  virtual const G4Polyhedron* CreateSectionPolyhedron ();
+  virtual const G4Polyhedron* CreateCutawayPolyhedron ();
+  // Generic clipping using the BooleanProcessor in graphics_reps is
+  // implemented in this class.  Subclasses that implement their own
+  // clipping should provide an override that returns zero.
+  void LoadAtts(const G4Visible&, G4AttHolder*);
+  // Load G4AttValues and G4AttDefs associated with the G4Visible
+  // object onto the G4AttHolder object.  It checks fpModel, and also
+  // loads the G4AttValues and G4AttDefs from G4PhysicalVolumeModel,
+  // G4VTrajectory, G4VTrajectoryPoint, or G4VHits, as appropriate.
+  // The G4AttHolder object is an object of a class that publicly
+  // inherits G4AttHolder - see, e.g., SoG4Polyhedron in the Open
+  // Inventor driver.  G4AttHolder deletes G4AttValues in its
+  // destructor to ensure proper clean-up of G4AttValues.
+
+  //////////////////////////////////////////////////////////////
+  // Data members
+
+  G4VGraphicsSystem& fSystem;          // Graphics system.
+  const G4int        fSceneHandlerId;  // Id of this instance.
+  G4String           fName;
+  G4int              fViewCount;       // To determine view ids.
+  G4ViewerList       fViewerList;      // Viewers.
+  G4VViewer*         fpViewer;         // Current viewer.
+  G4Scene*           fpScene;          // Scene for this scene handler.
+  G4bool             fMarkForClearingTransientStore;
+  G4bool             fReadyForTransients;  // I.e., not processing the
+			                   // run-duration part of scene.
+  G4bool             fTransientsDrawnThisEvent;  // Maintained by vis
+  G4bool             fTransientsDrawnThisRun;    // manager.
+  G4bool             fProcessingSolid; // True if within Pre/PostAddSolid.
+  G4bool             fSecondPassRequested;
+  G4bool             fSecondPass;    // ...in process.
+  G4VModel*          fpModel;        // Current model.
+  const G4Transform3D* fpObjectTransformation; // Current accumulated
+					       // object transformation.
+  G4int              fNestingDepth; // For Begin/EndPrimitives.
+  const G4VisAttributes* fpVisAttribs;  // Working vis attributes.
+  const G4Transform3D fIdentityTransformation;
+
+private:
+
+  G4VSceneHandler (const G4VSceneHandler&);
+  G4VSceneHandler& operator = (const G4VSceneHandler&);
+
+  //////////////////////////////////////////////////////////////
+  // Friend function accessed only by views of this scene.
+
+  friend void G4VViewer::ProcessView ();
+
+  //////////////////////////////////////////////////////////////
+  // Private functions, etc..
+
+  void   ProcessScene     (G4VViewer& view);
+  // Accessed by G4VViewer::ProcessView ().
+
+};
+
+#include "G4VSceneHandler.icc"
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/management/include/G4VSceneHandler.icc
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/include/G4VSceneHandler.icc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/include/G4VSceneHandler.icc	(revision 1102)
@@ -0,0 +1,132 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VSceneHandler.icc,v 1.20 2007/01/11 16:38:14 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  19th July 1996.
+
+inline G4VGraphicsSystem* G4VSceneHandler::GetGraphicsSystem () const {
+  return &fSystem;
+}
+
+inline G4int G4VSceneHandler::GetSceneHandlerId () const {
+  return fSceneHandlerId;
+}
+
+inline G4int G4VSceneHandler::GetViewCount () const {
+  return fViewCount;
+}
+
+inline
+G4double G4VSceneHandler::GetMarkerDiameter
+(const G4VMarker& marker, G4VSceneHandler::MarkerSizeType& sizeType) {
+  return GetMarkerSize (marker, sizeType);
+}
+
+inline
+G4double G4VSceneHandler::GetMarkerRadius
+(const G4VMarker& marker, G4VSceneHandler::MarkerSizeType& sizeType) {
+  return GetMarkerSize (marker, sizeType) / 2.;
+}
+
+inline G4int G4VSceneHandler::IncrementViewCount () {
+  return fViewCount++;
+}
+
+inline const G4String& G4VSceneHandler::GetName () const {
+  return fName;
+}
+
+inline void G4VSceneHandler::SetName (const G4String& name) {
+  fName = name;
+}
+
+inline G4Scene* G4VSceneHandler::GetScene () const {
+  return fpScene;
+}
+
+inline const G4ViewerList& G4VSceneHandler::GetViewerList () const {
+  return fViewerList;
+}
+
+inline G4VModel* G4VSceneHandler::GetModel () const {
+  return fpModel;
+}
+
+inline G4VViewer* G4VSceneHandler::GetCurrentViewer () const {
+  return fpViewer;
+}
+
+inline G4bool G4VSceneHandler::GetMarkForClearingTransientStore () const {
+  return fMarkForClearingTransientStore;
+}
+
+inline G4bool G4VSceneHandler::IsReadyForTransients () const {
+  return fReadyForTransients;
+}
+
+inline G4bool G4VSceneHandler::GetTransientsDrawnThisEvent () const {
+  return fTransientsDrawnThisEvent;
+}
+
+inline G4bool G4VSceneHandler::GetTransientsDrawnThisRun () const {
+  return fTransientsDrawnThisRun;
+}
+
+inline void G4VSceneHandler::SetCurrentViewer (G4VViewer* pViewer) {
+  fpViewer = pViewer;
+}
+
+inline G4ViewerList& G4VSceneHandler::SetViewerList () {
+  return fViewerList;
+}
+
+inline void
+G4VSceneHandler::SetModel (G4VModel* pModel) {
+  fpModel = pModel;
+}
+
+inline void G4VSceneHandler::SetMarkForClearingTransientStore (G4bool mark) {
+  fMarkForClearingTransientStore = mark;
+}
+
+inline void G4VSceneHandler::SetTransientsDrawnThisEvent (G4bool drawn) {
+  fTransientsDrawnThisEvent = drawn;
+}
+
+inline void G4VSceneHandler::SetTransientsDrawnThisRun (G4bool drawn) {
+  fTransientsDrawnThisRun = drawn;
+}
+
+inline const G4Colour& G4VSceneHandler::GetColor (const G4Visible& visible) {
+  return GetColour (visible);
+}
+
+inline const G4Colour& G4VSceneHandler::GetTextColor (const G4Text& text) {
+  return GetTextColour (text);
+}
Index: tags/visualization-10.5-before-10.6_test/management/include/G4VUserVisAction.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/include/G4VUserVisAction.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/include/G4VUserVisAction.hh	(revision 1102)
@@ -0,0 +1,63 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VUserVisAction.hh,v 1.8 2006/06/29 21:28:12 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+
+// Class Description:
+//
+// G4VUserVisAction is added to the scene by the command
+// /vis/scene/add/userAction, which instantiates a G4CallbackModel to
+// add to the RunDurationModels.  Thus the pure virtual Draw() method
+// is invoked whenever the viewer needs to "visit the kernel", e.g.,
+// to remake its graphical database, if any, or simply to refresh the
+// screen.  operator() is defined to satisfy the template
+// G4CallbackModel<G4VUserVisAction>.
+//
+// See the User Guide for Application Developers, Section 8.8.7 and 8.8.8.
+
+
+#ifndef G4VUSERVISACTION_HH
+#define G4VUSERVISACTION_HH
+
+#include "G4Transform3D.hh"
+
+class G4VGraphicsScene;
+
+class G4VUserVisAction
+{
+public: // With description
+  G4VUserVisAction() {}
+  virtual ~G4VUserVisAction() {}
+  virtual void Draw() = 0;
+  void operator()(G4VGraphicsScene&, const G4Transform3D&) {
+    Draw();
+  }
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/management/include/G4VViewer.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/include/G4VViewer.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/include/G4VViewer.hh	(revision 1102)
@@ -0,0 +1,164 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VViewer.hh,v 1.18 2006/06/29 21:28:14 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  27th March 1996
+//
+// Class description
+//
+// Abstract interface class for graphics viewers.
+
+#ifndef G4VVIEWER_HH
+#define G4VVIEWER_HH
+
+#include "globals.hh"
+
+#include "G4ViewParameters.hh"
+
+class G4VSceneHandler;
+
+class G4VViewer {
+
+public: // With description
+
+  friend std::ostream& operator << (std::ostream& os, const G4VViewer& v);
+
+  G4VViewer (G4VSceneHandler&, G4int id, const G4String& name = "");
+  virtual ~G4VViewer ();
+
+  virtual void Initialise ();
+  // Called immediately after construction for those operations that
+  // must await complete contruction of viewer and all its bases.  For
+  // example, if this class (G4VViewer) is inherited virtually, as in
+  // the OpenGL sub-category, it will not be fully constructed until
+  // *after* the the derived viewer (this is the rule about order of
+  // construction for virtual inheritance), so the derived viewer may
+  // not use information in G4VViewer in its contructor.  Hence such
+  // code must be in Initialise().
+
+  //////////////////////////////////////////////////////////////
+  // View manipulation functions.
+
+  virtual void SetView () = 0;
+  // Take view parameters and work out model/view transformation,
+  // projection transformation, lighting, etc.
+
+  virtual void ClearView () = 0;
+  // Clear screen/viewing buffers.
+
+  virtual void DrawView () = 0;
+  // Draw view of the scene currently attached to the scene handler -
+  // see example of a minimal function at end of this file.
+
+  virtual void ShowView ();
+  // Show view (for graphics systems which require to process
+  // all drawn objects before finalising the view).
+
+  virtual void FinishView ();
+  // Called at the end of drawing scene.  Used to flush streams, or
+  // swap buffers.  (Perhaps it is inappropriately named, perhaps its
+  // function could be incorporated into EndModeling ().  It marks the
+  // end of scene drawing; be aware hits and digi drawing may Follow.
+  // It is not yet the end of all drawing; that is signalled by
+  // ShowView ().)
+
+  //////////////////////////////////////////////////////////////
+  // Access functions.
+  const G4String&         GetName           () const;
+  const G4String&         GetShortName      () const;
+  void                    SetName           (const G4String&);
+  G4int                   GetViewId         () const;
+  G4VSceneHandler*        GetSceneHandler   () const;
+  const G4ViewParameters& GetViewParameters        () const;
+  const G4ViewParameters& GetDefaultViewParameters () const;
+  void SetViewParameters         (const G4ViewParameters& vp);
+  void SetDefaultViewParameters  (const G4ViewParameters& vp);
+
+  //////////////////////////////////////////////////////////////
+  // Public utility functions.
+
+  const G4VisAttributes*  GetApplicableVisAttributes
+                                            (const G4VisAttributes*) const;
+
+  void SetNeedKernelVisit (G4bool need);
+  // Sets individual need-visit flag.
+
+  void NeedKernelVisit ();
+  // Flags all views the need to re-visit the GEANT4 kernel to refresh
+  // the scene.
+
+  void ProcessView ();
+  // Used by DrawView ().  Invokes SetView ().  The basic logic is here.
+
+protected:
+
+  //////////////////////////////////////////////////////////////
+  // Data members
+  G4VSceneHandler&        fSceneHandler;     // Abstract scene for this view.
+  G4int            fViewId;    // Id of this instance.
+  G4String         fName;
+  G4String         fShortName; // Up to first ' ' character, if any.
+  G4ViewParameters fVP;        // View parameters.
+  G4ViewParameters fDefaultVP; // Default view parameters.
+
+  //////////////////////////////////////////////////////////////
+  // Other parameters.
+  G4bool           fNeedKernelVisit;  // See DrawView() for comments.
+};
+
+#include "G4VViewer.icc"
+
+/*********************************************
+
+Here is a minimal DrawView () as it might be implemented in the
+concrete viewer.
+
+void G4VViewer::DrawView () {  // Default - concrete view usually overrides.
+
+  // First, a view should decide when to re-visit the G4 kernel.
+  // Sometimes it might not be necessary, e.g., if the scene is stored
+  // in a graphical database (e.g., OpenGL's display lists) and only
+  // the viewing angle has changed.  But graphics systems without a
+  // graphical database will always need to visit the G4 kernel.
+
+  NeedKernelVisit ();  // Default is - always visit G4 kernel.
+  // Note: this routine sets the fNeedKernelVisit flag of *all* the views of
+  // the scene.
+
+  ProcessView ();             // The basic logic is here.
+
+  // Then a view may have more to do, e.g., display the graphical
+  // database.  That code should come here before finally...
+
+  FinishView ();              // Flush streams and/or swap buffers.
+}
+
+*********************************************/
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/management/include/G4VViewer.icc
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/include/G4VViewer.icc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/include/G4VViewer.icc	(revision 1102)
@@ -0,0 +1,65 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VViewer.icc,v 1.11 2006/06/29 21:28:16 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  30th December 1996
+
+inline void G4VViewer::Initialise () {}
+
+inline G4int G4VViewer::GetViewId () const {
+  return fViewId;
+}
+
+inline const G4String& G4VViewer::GetName () const {
+  return fName;
+}
+
+inline const G4String& G4VViewer::GetShortName () const {
+  return fShortName;
+}
+
+inline G4VSceneHandler* G4VViewer::GetSceneHandler () const {
+  return &fSceneHandler;
+}
+
+inline const G4ViewParameters& G4VViewer::GetViewParameters () const {
+  return fVP;
+}
+
+inline const G4ViewParameters& G4VViewer::GetDefaultViewParameters () const {
+  return fDefaultVP;
+}
+
+inline void G4VViewer::SetDefaultViewParameters (const G4ViewParameters& vp) {
+  fDefaultVP = vp;
+}
+
+inline void G4VViewer::SetNeedKernelVisit (G4bool need) {
+  fNeedKernelVisit = need;
+}
Index: tags/visualization-10.5-before-10.6_test/management/include/G4VVisCommand.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/include/G4VVisCommand.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/include/G4VVisCommand.hh	(revision 1102)
@@ -0,0 +1,69 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VVisCommand.hh,v 1.18 2006/06/29 21:28:18 gunter Exp $
+// GEANT4 tag $Name:  $
+
+// Base class for visualization commands - John Allison  9th August 1998
+// It is really a messenger - we have one command per messenger.
+
+#ifndef G4VVISCOMMAND_HH
+#define G4VVISCOMMAND_HH
+
+#include "G4VisManager.hh"
+#include "G4UImessenger.hh"
+#include "G4ThreeVector.hh"
+#include <vector>
+
+class G4UIcommand;
+class G4UIcmdWithAString;
+
+class G4VVisCommand: public G4UImessenger {
+public:
+  // Uses compiler defaults for copy constructor and assignment.
+  G4VVisCommand ();
+  virtual ~G4VVisCommand ();
+  static void SetVisManager (G4VisManager*);
+
+protected:
+
+  // Conversion routines augmenting those in G4UIcommand.
+  static G4String ConvertToString(G4double x, G4double y,
+				  const char * unitName);
+  static void  ConvertToDoublePair(const G4String& paramString,
+				   G4double& xval,
+				   G4double& yval);
+
+  // Other utilities.
+  void UpdateVisManagerScene (const G4String& sceneName = "");
+
+  // Data members.
+  static G4VisManager* fpVisManager;
+};
+
+#include "G4VVisCommand.icc"
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/management/include/G4VVisCommand.icc
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/include/G4VVisCommand.icc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/include/G4VVisCommand.icc	(revision 1102)
@@ -0,0 +1,37 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VVisCommand.icc,v 1.5 2006/06/29 21:28:20 gunter Exp $
+// GEANT4 tag $Name:  $
+
+// Base class for visualization commands - John Allison  9th August 1998
+// It is really a messenger - we have one command per messenger.
+
+inline G4VVisCommand::G4VVisCommand () {}
+
+inline void G4VVisCommand::SetVisManager (G4VisManager* pVisManager) {
+  fpVisManager = pVisManager;
+}
Index: tags/visualization-10.5-before-10.6_test/management/include/G4ViewParameters.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/include/G4ViewParameters.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/include/G4ViewParameters.hh	(revision 1102)
@@ -0,0 +1,311 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4ViewParameters.hh,v 1.30 2009/01/21 16:59:22 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  19th July 1996
+//
+// Class description
+//
+// View parameters and options.
+//
+// THE STANDARD VIEW AND ALL THAT.
+//
+// In GEANT4 visualization, we have the concept of a "Standard
+// View".  This is the view when the complete set of objects being
+// viewed is comfortably in view from any viewpoint.  It is defined by
+// the "Bounding Sphere" of "visible" objects when initially
+// registered in the scene, and by the View Parameters.
+//
+// There is also the "Standard Target Point", which is the centre of
+// the Bounding Sphere (note that this belongs to the scene and is
+// stored in the G4Scene object).  The "Current Target Point", defined
+// relative to the Standard Target Point, is changed by the
+// "dolly" and "zoom" commands, and can be reset to the Standard
+// Target Point with the "/vis/viewer/reset" command.
+//
+// Also, the "Standard Camera Position" is the "Standard Camera
+// Distance" along the Viewpoint Direction vector from the Standard
+// Target Point.  The Standard Camera Distance is the radius of the
+// Bounding Sphere divided by fFieldHalfAngle.  It is not stored
+// explicitly because of the singularity at fFieldHalfAngle = 0,
+// which implies parallel projection.
+//
+// Similarly, the "Current Camera Position" is the "Current Camera
+// Distance" along the Viewpoint Direction vector from the Current
+// Target Point.  The Current Camera Distance is given by the formulae
+// below, but note that it can be negative, meaning that the camera
+// has moved *beyond* the Current Target Point, which is
+// conceptually possible, but which might give some problems when
+// setting up the view matrix - see, for example, G4OpenGLView::SetView ().
+//
+// All viewers are expected to keep the "Up Vector" vertical.
+//
+// Finally, the view is magnified by the "Zoom Factor" which is
+// reset to 1 by the "/vis/viewer/reset" command.
+//
+// The algorithms for calculating various useful quantities from the
+// View Parameters, such as GetCameraDistance, are described below.
+
+#ifndef G4VIEWPARAMETERS_HH
+#define G4VIEWPARAMETERS_HH
+
+#include <vector>
+#include "G4Vector3D.hh"
+#include "G4Point3D.hh"
+#include "G4Plane3D.hh"
+#include "G4VisAttributes.hh"
+#include "G4VMarker.hh"
+
+typedef std::vector<G4Plane3D> G4Planes;
+
+class G4ViewParameters {
+
+public: // With description
+
+  enum DrawingStyle {
+    wireframe,  // Draw edges    - no hidden line removal.
+    hlr,        // Draw edges    - hidden lines removed.
+    hsr,        // Draw surfaces - hidden surfaces removed.
+    hlhsr       // Draw surfaces and edges - hidden removed.
+  };
+
+  enum RepStyle {
+    polyhedron, // Use G4Polyhedron.
+    nurbs       // Use G4NURBS.
+  };
+
+  enum CutawayMode {
+    cutawayUnion,       // Union (addition) of result of each cutaway plane.
+    cutawayIntersection // Intersection (multiplication) " .
+  };
+
+  friend std::ostream& operator << (std::ostream&,
+				      const DrawingStyle&);
+
+  friend std::ostream& operator << (std::ostream&,
+				      const G4ViewParameters&);
+
+  G4ViewParameters ();
+  ~G4ViewParameters ();
+
+  // Note: uses default assignment operator and copy constructor.
+
+  G4bool operator != (const G4ViewParameters&) const;
+
+  // Get and Is functions.
+        DrawingStyle     GetDrawingStyle         () const;
+        G4bool           IsAuxEdgeVisible        () const;
+        RepStyle         GetRepStyle             () const;
+        G4bool           IsCulling               () const;
+        G4bool           IsCullingInvisible      () const;
+        G4bool           IsDensityCulling        () const;
+        G4double         GetVisibleDensity       () const;
+        G4bool           IsCullingCovered        () const;
+        G4bool           IsSection               () const;
+  const G4Plane3D&       GetSectionPlane         () const;
+        G4bool           IsCutaway               () const;
+        CutawayMode      GetCutawayMode          () const;
+  const G4Planes&        GetCutawayPlanes        () const;
+        G4bool           IsExplode               () const;
+        G4double         GetExplodeFactor        () const;
+  const G4Point3D&       GetExplodeCentre        () const;
+        G4int            GetNoOfSides            () const;
+  const G4Vector3D&      GetViewpointDirection   () const;
+  const G4Vector3D&      GetUpVector             () const;
+        G4double         GetFieldHalfAngle       () const;
+        G4double         GetZoomFactor           () const;
+  const G4Vector3D&      GetScaleFactor          () const;
+  const G4Point3D&       GetCurrentTargetPoint   () const;
+        G4double         GetDolly                () const;
+        G4bool           GetLightsMoveWithCamera () const;
+  const G4Vector3D&      GetLightpointDirection  () const;  // Relative...
+        G4Vector3D&      GetActualLightpointDirection  ();  // Actual...
+  // ... depending on GetLightsMoveWithCamera.
+  const G4VisAttributes* GetDefaultVisAttributes () const;
+  const G4VisAttributes* GetDefaultTextVisAttributes () const;
+  const G4VMarker&       GetDefaultMarker        () const;
+        G4double         GetGlobalMarkerScale    () const;
+        G4double         GetGlobalLineWidthScale () const;
+        G4bool           IsMarkerNotHidden       () const;
+        unsigned int     GetWindowSizeHintX      () const;
+        unsigned int     GetWindowSizeHintY      () const;
+        G4int            GetWindowAbsoluteLocationHintX (G4int) const;
+        G4int            GetWindowAbsoluteLocationHintY (G4int) const;
+        G4int            GetWindowLocationHintX  () const;
+        G4int            GetWindowLocationHintY  () const;
+  const G4String&        GetXGeometryString      () const;
+  // GetXGeometryString is intended to be parsed by XParseGeometry.
+  // It contains the size information, as in GetWindowSizeHint, but
+  // may also contain the window position, e.g., "600x600-0+200.  The
+  // viewer should use this in preference to GetWindowSizeHint, since
+  // it contains more information.  (The size information in
+  // GetXGeometryString and GetWindowSizeHint is guaranteed to be
+  // identical.)
+  bool IsWindowSizeHintX () const;
+  bool IsWindowSizeHintY () const;
+  bool IsWindowLocationHintX () const;
+  bool IsWindowLocationHintY () const;
+
+        G4bool           IsAutoRefresh           () const;
+  const G4Colour&        GetBackgroundColour     () const;
+        G4bool           IsPicking               () const;
+
+  // Here Follow functions to evaluate the above algorithms as a
+  // function of the radius of the Bounding Sphere of the object being
+  // viewed.  Call them in the order given - for efficiency, later
+  // functions depend on the results of earlier ones (Store the
+  // results of earlier functions in your own temporary variables -
+  // see, for example, G4OpenGLView::SetView ().)
+  G4double GetCameraDistance  (G4double radius) const;
+  G4double GetNearDistance    (G4double cameraDistance, G4double radius) const;
+  G4double GetFarDistance     (G4double cameraDistance,
+			       G4double nearDistance, G4double radius) const;
+  G4double GetFrontHalfHeight (G4double nearDistance, G4double radius) const;
+
+  // Set, Add, Multiply, Increment, Unset and Clear functions.
+  void SetDrawingStyle         (G4ViewParameters::DrawingStyle style);
+  void SetAuxEdgeVisible       (G4bool);
+  void SetRepStyle             (G4ViewParameters::RepStyle style);
+  void SetCulling              (G4bool);
+  void SetCullingInvisible     (G4bool);
+  void SetDensityCulling       (G4bool);
+  void SetVisibleDensity       (G4double visibleDensity);
+  void SetCullingCovered       (G4bool);
+  void SetSectionPlane         (const G4Plane3D& sectionPlane);
+  void UnsetSectionPlane       ();
+  void SetCutawayMode          (CutawayMode);
+  void AddCutawayPlane         (const G4Plane3D& cutawayPlane);
+  void ChangeCutawayPlane      (size_t index, const G4Plane3D& cutawayPlane);
+  void ClearCutawayPlanes      ();
+  void SetExplodeFactor        (G4double explodeFactor);
+  void UnsetExplodeFactor      ();
+  void SetExplodeCentre        (const G4Point3D& explodeCentre);
+  G4int SetNoOfSides           (G4int nSides);  // Returns actual number set.
+  void SetViewpointDirection   (const G4Vector3D& viewpointDirection);
+  // Calls the following to get lightpoint direction right too.
+  void SetViewAndLights        (const G4Vector3D& viewpointDirection);
+  // Also sets lightpoint direction according to G4bool fLightsMoveWithCamera.
+  void SetUpVector             (const G4Vector3D& upVector);
+  void SetFieldHalfAngle       (G4double fieldHalfAngle);
+  void SetZoomFactor           (G4double zoomFactor);
+  void MultiplyZoomFactor      (G4double zoomFactorMultiplier);
+  void SetScaleFactor          (const G4Vector3D& scaleFactor);
+  void MultiplyScaleFactor     (const G4Vector3D& scaleFactorMultiplier);
+  void SetCurrentTargetPoint   (const G4Point3D& currentTargetPoint);
+  void SetDolly                (G4double dolly);
+  void IncrementDolly          (G4double dollyIncrement);
+  void SetLightpointDirection  (const G4Vector3D& lightpointDirection);
+  void SetLightsMoveWithCamera (G4bool moves);
+  void SetPan                  (G4double right, G4double up);
+  void IncrementPan            (G4double right, G4double up);
+  // Increment currentTarget point perpendicular to viewpoint direction.
+  void IncrementPan            (G4double right, G4double up, G4double forward);
+  // Increment currentTarget point also along viewpoint direction.
+  void SetDefaultVisAttributes (const G4VisAttributes&);
+  void SetDefaultTextVisAttributes (const G4VisAttributes&);
+  void SetDefaultMarker        (const G4VMarker& defaultMarker);
+  void SetGlobalMarkerScale    (G4double globalMarkerScale);
+  void SetGlobalLineWidthScale (G4double globalLineWidthScale);
+  void SetMarkerHidden         ();
+  void SetMarkerNotHidden      ();
+  void SetWindowSizeHint       (G4int xHint, G4int yHint);
+  void SetWindowLocationHint   (G4int xHint, G4int yHint);
+  void SetXGeometryString      (const G4String&);
+  void SetAutoRefresh          (G4bool);
+  void SetBackgroundColour     (const G4Colour&);
+  void SetPicking              (G4bool);
+
+  void PrintDifferences (const G4ViewParameters& v) const;
+
+private:
+  G4int ParseGeometry ( const char *string, G4int *x, G4int *y, unsigned int *width, unsigned int *height);
+  G4int ReadInteger(char *string, char **NextString);
+
+  G4int fNoValue;
+  G4int fXValue; // XValue set for XGeometry
+  G4int fYValue; // YValue set for XGeometry
+  G4int fWidthValue; // WidthValue set for XGeometry
+  G4int fHeightValue; // HeightValue set for XGeometry
+  G4int fAllValues; // AllValues are set for XGeometry
+  G4int fXNegative; // XValue is from left for XGeometry
+  G4int fYNegative; // YValue is from top for XGeometry
+  G4int fGeometryMask; // Mask for ParseGeometry
+
+  DrawingStyle fDrawingStyle;    // Drawing style.
+  G4bool       fAuxEdgeVisible;  // Auxiliary edge visibility.
+  RepStyle     fRepStyle;        // Representation style.
+  G4bool       fCulling;         // Culling requested.
+  G4bool       fCullInvisible;   // Cull (don't Draw) invisible objects.
+  G4bool       fDensityCulling;  // Density culling requested.  If so...
+  G4double     fVisibleDensity;  // ...density lower than this not drawn.
+  G4bool       fCullCovered;     // Cull daughters covered by opaque mothers.
+  G4bool       fSection;         // Section drawing requested (DCUT in GEANT3).
+  G4Plane3D    fSectionPlane;    // Cut plane for section drawing (DCUT).
+  CutawayMode  fCutawayMode;     // Cutaway mode.
+  G4Planes     fCutawayPlanes;   // Set of planes used for cutaway.
+  G4double     fExplodeFactor;   // Explode along radius by this factor...
+  G4Point3D    fExplodeCentre;   // ...about this centre.
+  G4int        fNoOfSides;       // ...if polygon approximates circle.
+  G4Vector3D   fViewpointDirection;
+  G4Vector3D   fUpVector;        // Up vector.  (Warning: MUST NOT be parallel
+                                 // to fViewpointDirection!)
+  G4double     fFieldHalfAngle;  // Radius / camara distance, 0 for parallel.
+  G4double     fZoomFactor;      // Magnification relative to Standard View.
+  G4Vector3D   fScaleFactor;     // (Non-uniform) scale/magnification factor.
+  G4Point3D    fCurrentTargetPoint;  // Relative to standard target point.
+  G4double     fDolly;           // Distance towards current target point.
+  G4bool       fLightsMoveWithCamera;
+  G4Vector3D   fRelativeLightpointDirection;
+  // i.e., rel. to object or camera accoding to G4bool fLightsMoveWithCamera.
+  G4Vector3D   fActualLightpointDirection;
+  G4VisAttributes fDefaultVisAttributes;
+  G4VisAttributes fDefaultTextVisAttributes;
+  G4VMarker    fDefaultMarker;
+  G4double     fGlobalMarkerScale;
+  G4double     fGlobalLineWidthScale;
+  G4bool       fMarkerNotHidden;
+  // True if transients are to be drawn and not hidden by
+  // hidden-line-hidden-surface removal algorithms, e.g., z-buffer
+  // testing; false if they are to be hidden-line-hidden-surface
+  // removed.
+  G4int        fWindowSizeHintX; // Size hints for pixel-based window systems.
+  G4int        fWindowSizeHintY;
+  G4int        fWindowLocationHintX; // Location hints for pixel-based window systems.
+  G4int        fWindowLocationHintY;
+  G4bool       fWindowLocationHintXNegative; //  Reference of location hints for pixel-based window systems.
+  G4bool       fWindowLocationHintYNegative;
+  G4String     fXGeometryString; // If non-null, geometry string for X Windows.
+  G4bool       fAutoRefresh;     // ...after change of view parameters.
+  G4Colour     fBackgroundColour;
+  G4bool       fPicking;         // Request picking.
+};
+
+#include "G4ViewParameters.icc"
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/management/include/G4ViewParameters.icc
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/include/G4ViewParameters.icc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/include/G4ViewParameters.icc	(revision 1102)
@@ -0,0 +1,369 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4ViewParameters.icc,v 1.18 2009/01/21 16:59:22 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  20th October 1996
+// View parameters and options.
+
+inline G4ViewParameters::DrawingStyle
+G4ViewParameters::GetDrawingStyle () const {
+  return fDrawingStyle;
+}
+
+inline G4bool G4ViewParameters::IsAuxEdgeVisible () const {
+  return fAuxEdgeVisible;
+}
+
+inline G4ViewParameters::RepStyle G4ViewParameters::GetRepStyle () const {
+  return fRepStyle;
+}
+
+inline G4bool G4ViewParameters::IsCulling () const {
+  return fCulling;
+}
+
+inline G4bool G4ViewParameters::IsCullingInvisible () const {
+  return fCullInvisible;
+}
+
+inline G4bool G4ViewParameters::IsDensityCulling () const {
+  return fDensityCulling;
+}
+
+inline G4double G4ViewParameters::GetVisibleDensity () const {
+  return fVisibleDensity;
+}
+
+inline G4bool G4ViewParameters::IsCullingCovered () const {
+  return fCullCovered;
+}
+
+inline G4bool G4ViewParameters::IsSection () const {
+  return fSection;
+}
+
+inline const G4Plane3D& G4ViewParameters::GetSectionPlane () const {
+  return fSectionPlane;
+}
+
+inline G4bool G4ViewParameters::IsCutaway () const {
+  return fCutawayPlanes.size() > 0;
+}
+
+inline G4ViewParameters::CutawayMode G4ViewParameters::GetCutawayMode () const
+{ return fCutawayMode;}
+
+inline const G4Planes& G4ViewParameters::GetCutawayPlanes () const {
+  return fCutawayPlanes;
+}
+
+inline G4bool G4ViewParameters::IsExplode () const {
+  return fExplodeFactor > 1.;
+}
+
+inline G4double G4ViewParameters::GetExplodeFactor () const {
+  return fExplodeFactor;
+}
+
+inline const G4Point3D& G4ViewParameters::GetExplodeCentre () const {
+  return fExplodeCentre;
+}
+
+inline G4int G4ViewParameters::GetNoOfSides () const {
+  return fNoOfSides;
+}
+
+inline const G4Vector3D& G4ViewParameters::GetViewpointDirection () const {
+  return fViewpointDirection;
+}
+
+inline const G4Vector3D& G4ViewParameters::GetUpVector () const {
+  return fUpVector;
+}
+
+inline G4double G4ViewParameters::GetFieldHalfAngle () const {
+  return fFieldHalfAngle;
+}
+
+inline G4double G4ViewParameters::GetZoomFactor () const {
+  return fZoomFactor;
+}
+
+inline const G4Vector3D& G4ViewParameters::GetScaleFactor () const {
+  return fScaleFactor;
+}
+
+inline const G4Point3D& G4ViewParameters::GetCurrentTargetPoint () const {
+  return fCurrentTargetPoint;
+}
+
+inline G4double G4ViewParameters::GetDolly () const {
+  return fDolly;
+}
+
+inline const G4Vector3D& G4ViewParameters::GetLightpointDirection () const {
+  return fRelativeLightpointDirection;
+}
+
+inline G4bool G4ViewParameters::GetLightsMoveWithCamera () const {
+  return fLightsMoveWithCamera;
+}
+
+inline const G4VisAttributes*
+G4ViewParameters::GetDefaultVisAttributes () const {
+  return &fDefaultVisAttributes;
+}
+
+inline const G4VisAttributes*
+G4ViewParameters::GetDefaultTextVisAttributes () const {
+  return &fDefaultTextVisAttributes;
+}
+
+inline const G4VMarker& G4ViewParameters::GetDefaultMarker () const {
+  return fDefaultMarker;
+}
+
+inline G4double G4ViewParameters::GetGlobalMarkerScale () const {
+  return fGlobalMarkerScale;
+}
+
+inline G4double G4ViewParameters::GetGlobalLineWidthScale () const {
+  return fGlobalLineWidthScale;
+}
+
+inline G4bool G4ViewParameters::IsMarkerNotHidden () const {
+  return fMarkerNotHidden;
+}
+
+inline bool G4ViewParameters::IsWindowSizeHintX () const {
+  return (fGeometryMask & fWidthValue);
+}
+
+inline bool G4ViewParameters::IsWindowSizeHintY () const {
+  return (fGeometryMask & fHeightValue);
+}
+
+inline bool G4ViewParameters::IsWindowLocationHintX () const {
+  return (fGeometryMask & fXValue);
+}
+
+inline bool G4ViewParameters::IsWindowLocationHintY () const {
+  return (fGeometryMask & fYValue);
+}
+
+inline unsigned int G4ViewParameters::GetWindowSizeHintX () const {
+  return fWindowSizeHintX;
+}
+
+inline unsigned int G4ViewParameters::GetWindowSizeHintY () const {
+  return fWindowSizeHintY;
+}
+
+inline G4int G4ViewParameters::GetWindowLocationHintX () const {
+  return fWindowLocationHintX;
+}
+
+inline G4int G4ViewParameters::GetWindowLocationHintY () const {
+  return fWindowLocationHintY;
+}
+
+inline const G4String& G4ViewParameters::GetXGeometryString () const {
+  return fXGeometryString;
+}
+
+inline G4bool G4ViewParameters::IsAutoRefresh () const {
+  return fAutoRefresh;
+}
+
+inline const G4Colour& G4ViewParameters::GetBackgroundColour () const {
+  return fBackgroundColour;
+}
+
+inline G4bool G4ViewParameters::IsPicking () const {
+  return fPicking;
+}
+
+inline void
+G4ViewParameters::SetDrawingStyle (G4ViewParameters::DrawingStyle style) {
+  fDrawingStyle = style;
+}
+
+inline void G4ViewParameters::SetAuxEdgeVisible (G4bool vis) {
+  fAuxEdgeVisible = vis;
+}
+
+inline void
+G4ViewParameters::SetRepStyle (G4ViewParameters::RepStyle style) {
+  fRepStyle = style;
+}
+
+inline void G4ViewParameters::SetCulling (G4bool value) {
+  fCulling = value;
+}
+
+inline void G4ViewParameters::SetCullingInvisible (G4bool value) {
+  fCullInvisible = value;
+}
+
+inline void G4ViewParameters::SetDensityCulling (G4bool value) {
+  fDensityCulling = value;
+}
+
+inline void G4ViewParameters::SetCullingCovered (G4bool value) {
+  fCullCovered = value;
+}
+
+inline void G4ViewParameters::SetSectionPlane (const G4Plane3D& sectionPlane) {
+  fSection = true;
+  fSectionPlane = sectionPlane;
+}
+
+inline void G4ViewParameters::UnsetSectionPlane () {
+  fSection = false;
+}
+
+inline void G4ViewParameters::SetCutawayMode
+(G4ViewParameters::CutawayMode cutawayMode) {
+  fCutawayMode = cutawayMode;
+}
+
+inline void G4ViewParameters::ClearCutawayPlanes () {
+  fCutawayPlanes.clear ();
+}
+
+inline void G4ViewParameters::SetViewpointDirection
+(const G4Vector3D& viewpointDirection) {
+  SetViewAndLights (viewpointDirection);
+}
+
+inline void G4ViewParameters::SetExplodeFactor (G4double explodeFactor) {
+  fExplodeFactor = explodeFactor;
+  if (fExplodeFactor < 1.) fExplodeFactor = 1.;
+}
+
+inline void G4ViewParameters::UnsetExplodeFactor () {
+  fExplodeFactor = 1.;
+}
+
+inline void G4ViewParameters::SetExplodeCentre
+(const G4Point3D& explodeCentre) {
+  fExplodeCentre = explodeCentre;
+}
+inline void G4ViewParameters::SetUpVector (const G4Vector3D& upVector) {
+  fUpVector = upVector;
+}
+
+inline void G4ViewParameters::SetFieldHalfAngle (G4double fieldHalfAngle) {
+  fFieldHalfAngle = fieldHalfAngle;
+}
+
+inline void G4ViewParameters::SetZoomFactor (G4double zoomFactor) {
+  fZoomFactor = zoomFactor;
+}
+
+inline void
+G4ViewParameters::MultiplyZoomFactor (G4double zoomFactorMultiplier) {
+  fZoomFactor *= zoomFactorMultiplier;
+}
+
+inline void G4ViewParameters::SetScaleFactor (const G4Vector3D& scaleFactor) {
+  fScaleFactor = scaleFactor;
+}
+
+inline void
+G4ViewParameters::SetCurrentTargetPoint (const G4Point3D& currentTargetPoint) {
+  fCurrentTargetPoint = currentTargetPoint;
+}
+
+inline void G4ViewParameters::SetDolly (G4double dolly) {
+  fDolly = dolly;
+}
+
+inline void G4ViewParameters::IncrementDolly (G4double dollyIncrement) {
+  fDolly += dollyIncrement;
+}
+
+inline void G4ViewParameters::SetLightsMoveWithCamera (G4bool moves) {
+  fLightsMoveWithCamera = moves;
+}
+
+inline void G4ViewParameters::SetDefaultVisAttributes
+(const G4VisAttributes& defaultVisAttributes) {
+  fDefaultVisAttributes = defaultVisAttributes;
+}
+
+inline void G4ViewParameters::SetDefaultTextVisAttributes
+(const G4VisAttributes& defaultTextVisAttributes) {
+  fDefaultTextVisAttributes = defaultTextVisAttributes;
+}
+
+inline void
+G4ViewParameters::SetDefaultMarker (const G4VMarker& defaultMarker) {
+  fDefaultMarker = defaultMarker;
+}
+
+inline void
+G4ViewParameters::SetGlobalMarkerScale (G4double globalMarkerScale) {
+  fGlobalMarkerScale = globalMarkerScale;
+}
+
+inline void
+G4ViewParameters::SetGlobalLineWidthScale (G4double globalLineWidthScale) {
+  fGlobalLineWidthScale = globalLineWidthScale;
+}
+
+inline void G4ViewParameters::SetMarkerHidden () {
+  fMarkerNotHidden = false;
+}
+
+inline void G4ViewParameters::SetMarkerNotHidden () {
+  fMarkerNotHidden = true;
+}
+
+inline void G4ViewParameters::SetWindowSizeHint (G4int xHint, G4int yHint) {
+  fWindowSizeHintX = xHint;
+  fWindowSizeHintY = yHint;
+}
+
+inline void G4ViewParameters::SetWindowLocationHint (G4int xHint, G4int yHint) {
+  fWindowLocationHintX = xHint;
+  fWindowLocationHintY = yHint;
+}
+
+inline void G4ViewParameters::SetAutoRefresh (G4bool state) {
+  fAutoRefresh = state;
+}
+
+inline void G4ViewParameters::SetBackgroundColour (const G4Colour& colour) {
+  fBackgroundColour = colour;
+}
+
+inline void G4ViewParameters::SetPicking (G4bool picking) {
+  fPicking = picking;
+}
Index: tags/visualization-10.5-before-10.6_test/management/include/G4ViewerList.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/include/G4ViewerList.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/include/G4ViewerList.hh	(revision 1102)
@@ -0,0 +1,47 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4ViewerList.hh,v 1.8 2006/06/29 21:28:26 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  May 1996
+
+#ifndef G4VIEWERLIST_HH
+#define G4VIEWERLIST_HH
+
+#include <vector>
+#include "G4VViewer.hh"
+
+class G4ViewerList: public std::vector<G4VViewer*> {
+public:
+  void remove(G4VViewer*);
+};
+
+typedef std::vector<G4VViewer*>::iterator G4ViewerListIterator;
+typedef std::vector<G4VViewer*>::const_iterator G4ViewerListConstIterator;
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/management/include/G4VisCommandModelCreate.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/include/G4VisCommandModelCreate.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/include/G4VisCommandModelCreate.hh	(revision 1102)
@@ -0,0 +1,155 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4VisCommandModelCreate.hh,v 1.3 2006/06/29 21:28:28 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// Jane Tinslay, John Allison, Joseph Perl October 2005
+//
+// Class Description:
+// Templated create command for model factories. Factory generates new models
+// and associated messengers. 
+// Class Description - End:
+
+#ifndef G4VISCOMMANDSMODELCREATE_HH
+#define G4VISCOMMANDSMODELCREATE_HH
+
+#include "G4VVisCommand.hh"
+#include "G4String.hh"
+#include "G4UIcmdWithAString.hh"
+#include "G4UIcommand.hh"
+#include "G4UIdirectory.hh"
+#include <vector>
+
+template <typename Factory>
+class G4VisCommandModelCreate : public G4VVisCommand {
+
+public: // With description
+
+  G4VisCommandModelCreate(Factory*, const G4String& placement);
+  // Input factory and command placement
+
+  virtual ~G4VisCommandModelCreate();
+
+  G4String GetCurrentValue(G4UIcommand*);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+
+  G4String Placement() const;
+
+private:
+
+  G4String NextName();
+
+  // Data members
+  Factory* fpFactory;
+  G4String fPlacement;
+  G4int fId;
+  G4UIcmdWithAString* fpCommand;
+  std::vector<G4UIcommand*>   fDirectoryList;
+
+};
+
+template <typename Factory>
+G4VisCommandModelCreate<Factory>::G4VisCommandModelCreate(Factory* factory, const G4String& placement)
+  :fpFactory(factory)
+  ,fPlacement(placement)
+  ,fId(0)
+{  
+  G4String factoryName = factory->Name();
+
+  G4String command = Placement()+"/create/"+factoryName; 
+  G4String guidance = "Create a "+factoryName+" model and associated messengers.";
+
+  fpCommand = new G4UIcmdWithAString(command, this);      
+  fpCommand->SetGuidance(guidance);
+  fpCommand->SetGuidance("Generated model becomes current.");  
+  fpCommand->SetParameterName("model-name", true);    
+}
+
+template <typename Factory>
+G4VisCommandModelCreate<Factory>::~G4VisCommandModelCreate()
+{
+  delete fpCommand;
+  
+  unsigned i(0);
+  for (i=0; i<fDirectoryList.size(); ++i) {
+    delete fDirectoryList[i];
+  }
+}
+
+template <typename Factory>
+G4String
+G4VisCommandModelCreate<Factory>::Placement() const
+{
+  return fPlacement;
+}
+
+template <typename Factory>
+G4String
+G4VisCommandModelCreate<Factory>::NextName()
+{
+  std::ostringstream oss;
+  oss <<fpFactory->Name()<<"-" << fId++;
+  return oss.str();
+}
+
+template <typename Factory>
+G4String 
+G4VisCommandModelCreate<Factory>::GetCurrentValue(G4UIcommand*) 
+{
+  return "";
+}
+
+template <typename Factory>
+void G4VisCommandModelCreate<Factory>::SetNewValue(G4UIcommand*, G4String newName) 
+{
+  if (newName.isNull()) newName = NextName();
+
+  assert (0 != fpFactory);
+
+  // Create directory for new model commands
+  G4String title = Placement()+"/"+newName+"/";
+  G4String guidance = "Commands for "+newName+" model.";
+
+  G4UIcommand* directory = new G4UIdirectory(title);
+  directory->SetGuidance(guidance);
+  fDirectoryList.push_back(directory);   
+
+  // Create the model.
+  typename Factory::ModelAndMessengers creation = fpFactory->Create(Placement(), newName);
+
+  // Register model with vis manager
+  fpVisManager->RegisterModel(creation.first);
+
+  // Register associated messengers with vis manager
+  typename Factory::Messengers::iterator iter = creation.second.begin();
+
+  while (iter != creation.second.end()) {
+    fpVisManager->RegisterMessenger(*iter);
+    iter++;
+  }
+}    
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/management/include/G4VisCommands.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/include/G4VisCommands.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/include/G4VisCommands.hh	(revision 1102)
@@ -0,0 +1,113 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VisCommands.hh,v 1.8 2009/03/09 12:42:00 allison Exp $
+// GEANT4 tag $Name:  $
+
+// /vis/ top level commands - John Allison  5th February 2001
+
+#ifndef G4VISCOMMANDS_HH
+#define G4VISCOMMANDS_HH
+
+#include "G4VVisCommand.hh"
+
+class G4UIcmdWithABool;
+class G4UIcmdWithAString;
+class G4UIcmdWithoutParameter;
+
+class G4VisCommandAbortReviewKeptEvents: public G4VVisCommand {
+public:
+  G4VisCommandAbortReviewKeptEvents ();
+  virtual ~G4VisCommandAbortReviewKeptEvents ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandAbortReviewKeptEvents (const G4VisCommandAbortReviewKeptEvents&);
+  G4VisCommandAbortReviewKeptEvents& operator = (const G4VisCommandAbortReviewKeptEvents&);
+  G4UIcmdWithABool* fpCommand;
+};
+
+class G4VisCommandEnable: public G4VVisCommand {
+public:
+  G4VisCommandEnable ();
+  virtual ~G4VisCommandEnable ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandEnable (const G4VisCommandEnable&);
+  G4VisCommandEnable& operator = (const G4VisCommandEnable&);
+  G4UIcmdWithABool* fpCommand;
+  G4UIcmdWithoutParameter* fpCommand1;
+};
+
+class G4VisCommandInitialize: public G4VVisCommand {
+public:
+  G4VisCommandInitialize ();
+  virtual ~G4VisCommandInitialize ();
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandInitialize (const G4VisCommandInitialize&);
+  G4VisCommandInitialize& operator = (const G4VisCommandInitialize&);
+  G4UIcmdWithoutParameter* fpCommand;
+};
+
+class G4VisCommandList: public G4VVisCommand {
+public:
+  G4VisCommandList ();
+  virtual ~G4VisCommandList ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandList (const G4VisCommandList&);
+  G4VisCommandList& operator = (const G4VisCommandList&);
+  G4UIcmdWithAString* fpCommand;
+};
+
+class G4VisCommandReviewKeptEvents: public G4VVisCommand {
+public:
+  G4VisCommandReviewKeptEvents ();
+  virtual ~G4VisCommandReviewKeptEvents ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandReviewKeptEvents (const G4VisCommandReviewKeptEvents&);
+  G4VisCommandReviewKeptEvents& operator = (const G4VisCommandReviewKeptEvents&);
+  G4UIcmdWithAString* fpCommand;
+};
+
+class G4VisCommandVerbose: public G4VVisCommand {
+public:
+  G4VisCommandVerbose ();
+  virtual ~G4VisCommandVerbose ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandVerbose (const G4VisCommandVerbose&);
+  G4VisCommandVerbose& operator = (const G4VisCommandVerbose&);
+  G4UIcmdWithAString* fpCommand;
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/management/include/G4VisCommandsCompound.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/include/G4VisCommandsCompound.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/include/G4VisCommandsCompound.hh	(revision 1102)
@@ -0,0 +1,92 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VisCommandsCompound.hh,v 1.9 2006/06/29 21:28:32 gunter Exp $
+// GEANT4 tag $Name:  $
+
+// Compound /vis/ commands - John Allison  15th May 2000
+
+#ifndef G4VISCOMMANDSCOMPOUND_HH
+#define G4VISCOMMANDSCOMPOUND_HH
+
+#include "G4VVisCommand.hh"
+
+class G4VisCommandDrawTree: public G4VVisCommand {
+public:
+  G4VisCommandDrawTree ();
+  virtual ~G4VisCommandDrawTree ();
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandDrawTree (const G4VisCommandDrawTree&);
+  G4VisCommandDrawTree& operator = (const G4VisCommandDrawTree&);
+  G4UIcommand* fpCommand;
+};
+
+class G4VisCommandDrawView: public G4VVisCommand {
+public:
+  G4VisCommandDrawView ();
+  virtual ~G4VisCommandDrawView ();
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandDrawView (const G4VisCommandDrawView&);
+  G4VisCommandDrawView& operator = (const G4VisCommandDrawView&);
+  G4UIcommand* fpCommand;
+};
+
+class G4VisCommandDrawVolume: public G4VVisCommand {
+public:
+  G4VisCommandDrawVolume ();
+  virtual ~G4VisCommandDrawVolume ();
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandDrawVolume (const G4VisCommandDrawVolume&);
+  G4VisCommandDrawVolume& operator = (const G4VisCommandDrawVolume&);
+  G4UIcmdWithAString* fpCommand;
+};
+
+class G4VisCommandOpen: public G4VVisCommand {
+public:
+  G4VisCommandOpen ();
+  virtual ~G4VisCommandOpen ();
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandOpen (const G4VisCommandOpen&);
+  G4VisCommandOpen& operator = (const G4VisCommandOpen&);
+  G4UIcommand* fpCommand;
+};
+
+class G4VisCommandSpecify: public G4VVisCommand {
+public:
+  G4VisCommandSpecify ();
+  virtual ~G4VisCommandSpecify ();
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandSpecify (const G4VisCommandSpecify&);
+  G4VisCommandSpecify& operator = (const G4VisCommandSpecify&);
+  G4UIcommand* fpCommand;
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/management/include/G4VisCommandsGeometry.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/include/G4VisCommandsGeometry.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/include/G4VisCommandsGeometry.hh	(revision 1102)
@@ -0,0 +1,77 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VisCommandsGeometry.hh,v 1.3 2006/06/29 21:28:34 gunter Exp $
+// GEANT4 tag $Name:  $
+
+// /vis/geometry commands - John Allison  31st January 2006
+
+#ifndef G4VISCOMMANDSGEOMETRY_HH
+#define G4VISCOMMANDSGEOMETRY_HH
+
+#include "G4VVisCommand.hh"
+
+class G4UIcmdWithAString;
+class G4LogicalVolume;
+class G4VisAttributes;
+
+#include <map>
+
+class G4VVisCommandGeometry: public G4VVisCommand {
+public:
+  virtual ~G4VVisCommandGeometry();
+protected:
+  static std::map<G4LogicalVolume*, const G4VisAttributes*>
+  fVisAttsMap;
+  typedef std::map<G4LogicalVolume*, const G4VisAttributes*>::const_iterator
+  VisAttsMapIterator;
+};
+
+class G4VisCommandGeometryList: public G4VVisCommandGeometry {
+public:
+  G4VisCommandGeometryList();
+  virtual ~G4VisCommandGeometryList();
+  G4String GetCurrentValue(G4UIcommand* command);
+  void SetNewValue(G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandGeometryList(const G4VisCommandGeometryList&);
+  G4VisCommandGeometryList& operator=(const G4VisCommandGeometryList&);
+  G4UIcmdWithAString* fpCommand;
+};
+
+class G4VisCommandGeometryRestore: public G4VVisCommandGeometry {
+public:
+  G4VisCommandGeometryRestore();
+  virtual ~G4VisCommandGeometryRestore();
+  G4String GetCurrentValue(G4UIcommand* command);
+  void SetNewValue(G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandGeometryRestore(const G4VisCommandGeometryRestore&);
+  G4VisCommandGeometryRestore& operator=(const G4VisCommandGeometryRestore&);
+  G4UIcmdWithAString* fpCommand;
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/management/include/G4VisCommandsGeometrySet.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/include/G4VisCommandsGeometrySet.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/include/G4VisCommandsGeometrySet.hh	(revision 1102)
@@ -0,0 +1,299 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VisCommandsGeometrySet.hh,v 1.3 2007/01/05 16:24:19 allison Exp $
+// GEANT4 tag $Name:  $
+
+// /vis/geometry commands - John Allison  31st January 2006
+
+#ifndef G4VISCOMMANDSGEOMETRYSET_HH
+#define G4VISCOMMANDSGEOMETRYSET_HH
+
+#include "G4VisCommandsGeometry.hh"
+
+class G4UIcommand;
+class G4VisAttributes;
+
+class G4VVisCommandGeometrySetFunction {
+public:
+  virtual void operator()(G4VisAttributes*) const = 0;
+};
+
+class G4VisCommandGeometrySetColourFunction:
+  public G4VVisCommandGeometrySetFunction {
+public:
+  G4VisCommandGeometrySetColourFunction
+  (const G4Colour& colour):
+    fColour(colour) {}
+  void operator()
+    (G4VisAttributes* visAtts) const
+  {visAtts->SetColour(fColour);}
+private:
+  const G4Colour& fColour;
+};
+
+class G4VisCommandGeometrySetDaughtersInvisibleFunction:
+  public G4VVisCommandGeometrySetFunction {
+public:
+  G4VisCommandGeometrySetDaughtersInvisibleFunction
+  (G4bool daughtersInvisible):
+    fDaughtersInvisible(daughtersInvisible) {}
+  void operator()
+    (G4VisAttributes* visAtts) const
+  {visAtts->SetDaughtersInvisible(fDaughtersInvisible);}
+private:
+  G4bool fDaughtersInvisible;
+};
+
+class G4VisCommandGeometrySetForceAuxEdgeVisibleFunction:
+  public G4VVisCommandGeometrySetFunction {
+public:
+  G4VisCommandGeometrySetForceAuxEdgeVisibleFunction
+  (G4bool forceAuxEdgeVisible):
+    fForceAuxEdgeVisible(forceAuxEdgeVisible) {}
+  void operator()
+    (G4VisAttributes* visAtts) const
+  {visAtts->SetForceAuxEdgeVisible(fForceAuxEdgeVisible);}
+private:
+  G4bool fForceAuxEdgeVisible;
+};
+
+class G4VisCommandGeometrySetForceLineSegmentsPerCircleFunction:
+  public G4VVisCommandGeometrySetFunction {
+public:
+  G4VisCommandGeometrySetForceLineSegmentsPerCircleFunction
+  (G4int lineSegmentsPerCircle):
+    fLineSegmentsPerCircle(lineSegmentsPerCircle) {}
+  void operator()
+    (G4VisAttributes* visAtts) const
+  {visAtts->SetForceLineSegmentsPerCircle(fLineSegmentsPerCircle);}
+private:
+  G4int fLineSegmentsPerCircle;
+};
+
+class G4VisCommandGeometrySetForceSolidFunction:
+  public G4VVisCommandGeometrySetFunction {
+public:
+  G4VisCommandGeometrySetForceSolidFunction
+  (G4bool forceSolid):
+    fForceSolid(forceSolid) {}
+  void operator()
+    (G4VisAttributes* visAtts) const
+  {visAtts->SetForceSolid(fForceSolid);}
+private:
+  G4bool fForceSolid;
+};
+
+class G4VisCommandGeometrySetForceWireframeFunction:
+  public G4VVisCommandGeometrySetFunction {
+public:
+  G4VisCommandGeometrySetForceWireframeFunction
+  (G4bool forceWireframe):
+    fForceWireframe(forceWireframe) {}
+  void operator()
+    (G4VisAttributes* visAtts) const
+  {visAtts->SetForceWireframe(fForceWireframe);}
+private:
+  G4bool fForceWireframe;
+};
+
+class G4VisCommandGeometrySetLineStyleFunction:
+  public G4VVisCommandGeometrySetFunction {
+public:
+  G4VisCommandGeometrySetLineStyleFunction
+  (G4VisAttributes::LineStyle lineStyle):
+    fLineStyle(lineStyle) {}
+  void operator()
+    (G4VisAttributes* visAtts) const
+  {visAtts->SetLineStyle(fLineStyle);}
+private:
+  G4VisAttributes::LineStyle fLineStyle;
+};
+
+class G4VisCommandGeometrySetLineWidthFunction:
+  public G4VVisCommandGeometrySetFunction {
+public:
+  G4VisCommandGeometrySetLineWidthFunction
+  (G4double lineWidth):
+    fLineWidth(lineWidth) {}
+  void operator()
+    (G4VisAttributes* visAtts) const
+  {visAtts->SetLineWidth(fLineWidth);}
+private:
+  G4double fLineWidth;
+};
+
+class G4VisCommandGeometrySetVisibilityFunction:
+  public G4VVisCommandGeometrySetFunction {
+public:
+  G4VisCommandGeometrySetVisibilityFunction
+  (G4bool visibility):
+    fVisibility(visibility) {}
+  void operator()
+    (G4VisAttributes* visAtts) const
+  {visAtts->SetVisibility(fVisibility);}
+private:
+  G4bool fVisibility;
+};
+
+class G4VVisCommandGeometrySet: public G4VVisCommandGeometry {
+protected:
+  void Set(G4String logVolName, const G4VVisCommandGeometrySetFunction&,
+	   G4int requestedDepth);
+  void SetLVVisAtts(G4LogicalVolume*, const G4VVisCommandGeometrySetFunction&,
+		    G4int depth, G4int requestedDepth);
+};
+
+class G4VisCommandGeometrySetColour: public G4VVisCommandGeometrySet {
+public:
+  G4VisCommandGeometrySetColour ();
+  virtual ~G4VisCommandGeometrySetColour ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandGeometrySetColour (const G4VisCommandGeometrySetColour&);
+  G4VisCommandGeometrySetColour& operator = (const G4VisCommandGeometrySetColour&);
+  G4UIcommand* fpCommand;
+};
+
+class G4VisCommandGeometrySetDaughtersInvisible:
+  public G4VVisCommandGeometrySet {
+public:
+  G4VisCommandGeometrySetDaughtersInvisible ();
+  virtual ~G4VisCommandGeometrySetDaughtersInvisible ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandGeometrySetDaughtersInvisible
+  (const G4VisCommandGeometrySetDaughtersInvisible&);
+  G4VisCommandGeometrySetDaughtersInvisible& operator=
+  (const G4VisCommandGeometrySetDaughtersInvisible&);
+  G4UIcommand* fpCommand;
+};
+
+class G4VisCommandGeometrySetForceAuxEdgeVisible:
+  public G4VVisCommandGeometrySet {
+public:
+  G4VisCommandGeometrySetForceAuxEdgeVisible ();
+  virtual ~G4VisCommandGeometrySetForceAuxEdgeVisible ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandGeometrySetForceAuxEdgeVisible
+  (const G4VisCommandGeometrySetForceAuxEdgeVisible&);
+  G4VisCommandGeometrySetForceAuxEdgeVisible& operator=
+  (const G4VisCommandGeometrySetForceAuxEdgeVisible&);
+  G4UIcommand* fpCommand;
+};
+
+class G4VisCommandGeometrySetForceSolid:
+  public G4VVisCommandGeometrySet {
+public:
+  G4VisCommandGeometrySetForceSolid ();
+  virtual ~G4VisCommandGeometrySetForceSolid ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandGeometrySetForceSolid
+  (const G4VisCommandGeometrySetForceSolid&);
+  G4VisCommandGeometrySetForceSolid& operator=
+  (const G4VisCommandGeometrySetForceSolid&);
+  G4UIcommand* fpCommand;
+};
+
+class G4VisCommandGeometrySetForceLineSegmentsPerCircle:
+  public G4VVisCommandGeometrySet {
+public:
+  G4VisCommandGeometrySetForceLineSegmentsPerCircle ();
+  virtual ~G4VisCommandGeometrySetForceLineSegmentsPerCircle ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandGeometrySetForceLineSegmentsPerCircle
+  (const G4VisCommandGeometrySetForceLineSegmentsPerCircle&);
+  G4VisCommandGeometrySetForceLineSegmentsPerCircle& operator=
+  (const G4VisCommandGeometrySetForceLineSegmentsPerCircle&);
+  G4UIcommand* fpCommand;
+};
+
+class G4VisCommandGeometrySetForceWireframe:
+  public G4VVisCommandGeometrySet {
+public:
+  G4VisCommandGeometrySetForceWireframe ();
+  virtual ~G4VisCommandGeometrySetForceWireframe ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandGeometrySetForceWireframe
+  (const G4VisCommandGeometrySetForceWireframe&);
+  G4VisCommandGeometrySetForceWireframe& operator=
+  (const G4VisCommandGeometrySetForceWireframe&);
+  G4UIcommand* fpCommand;
+};
+
+class G4VisCommandGeometrySetLineStyle:
+  public G4VVisCommandGeometrySet {
+public:
+  G4VisCommandGeometrySetLineStyle ();
+  virtual ~G4VisCommandGeometrySetLineStyle ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandGeometrySetLineStyle
+  (const G4VisCommandGeometrySetLineStyle&);
+  G4VisCommandGeometrySetLineStyle& operator=
+  (const G4VisCommandGeometrySetLineStyle&);
+  G4UIcommand* fpCommand;
+};
+
+class G4VisCommandGeometrySetLineWidth:
+  public G4VVisCommandGeometrySet {
+public:
+  G4VisCommandGeometrySetLineWidth ();
+  virtual ~G4VisCommandGeometrySetLineWidth ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandGeometrySetLineWidth
+  (const G4VisCommandGeometrySetLineWidth&);
+  G4VisCommandGeometrySetLineWidth& operator=
+  (const G4VisCommandGeometrySetLineWidth&);
+  G4UIcommand* fpCommand;
+};
+
+class G4VisCommandGeometrySetVisibility: public G4VVisCommandGeometrySet {
+public:
+  G4VisCommandGeometrySetVisibility ();
+  virtual ~G4VisCommandGeometrySetVisibility ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandGeometrySetVisibility (const G4VisCommandGeometrySetVisibility&);
+  G4VisCommandGeometrySetVisibility& operator = (const G4VisCommandGeometrySetVisibility&);
+  G4UIcommand* fpCommand;
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/management/include/G4VisCommandsListManager.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/include/G4VisCommandsListManager.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/include/G4VisCommandsListManager.hh	(revision 1102)
@@ -0,0 +1,221 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4VisCommandsListManager.hh,v 1.3 2006/06/29 21:28:38 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// Jane Tinslay, John Allison, Joseph Perl October 2005
+//
+// Class Description:
+// Templated list manager commands which control list manager listing and
+// selection.
+// Class Description - End:
+
+#ifndef G4VISCOMMANDLISTMANAGER_HH
+#define G4VISCOMMANDLISTMANAGER_HH
+
+#include "G4UImessenger.hh"
+#include "G4String.hh"
+#include "G4UIcmdWithAString.hh"
+#include "G4UIcommand.hh"
+
+template <typename Manager>
+class G4VisCommandListManagerList : public G4UImessenger {
+
+public: // With description
+
+  G4VisCommandListManagerList(Manager*, const G4String& placement);
+  // Input list manager and command placement
+
+  virtual ~G4VisCommandListManagerList();
+
+  G4String GetCurrentValue(G4UIcommand*);
+  void SetNewValue(G4UIcommand* command, G4String newValue);
+
+  G4String Placement() const;
+
+private:
+
+  // Data members
+  Manager* fpManager;
+  G4String fPlacement;
+
+  G4UIcmdWithAString* fpCommand;
+
+};
+
+// List command
+template <typename Manager>
+G4VisCommandListManagerList<Manager>::G4VisCommandListManagerList(Manager* manager, const G4String& placement)
+  :fpManager(manager)
+  ,fPlacement(placement)
+{  
+  G4String command = Placement()+"/list";
+  
+  fpCommand = new G4UIcmdWithAString(command, this);      
+  fpCommand->SetGuidance("List objects registered with list manager");
+  fpCommand->SetParameterName("name", true);       
+}
+
+template <typename Manager>
+G4VisCommandListManagerList<Manager>::~G4VisCommandListManagerList()
+{
+  delete fpCommand;
+}
+
+template <typename Manager>
+G4String
+G4VisCommandListManagerList<Manager>::Placement() const
+{
+  return fPlacement;
+}
+
+template <typename Manager>
+G4String 
+G4VisCommandListManagerList<Manager>::GetCurrentValue(G4UIcommand*) 
+{
+  return "";
+}
+
+template <typename Manager>
+void G4VisCommandListManagerList<Manager>::SetNewValue(G4UIcommand*, G4String name) 
+{
+  G4cout<<"Listing models available in "<<Placement()<<G4endl;
+
+  assert (0 != fpManager);
+  fpManager->Print(G4cout, name);
+}    
+
+//Select command
+template <typename Manager>
+class G4VisCommandListManagerSelect : public G4UImessenger {
+
+public: // With description
+
+  G4VisCommandListManagerSelect(Manager*, const G4String& placement);
+  // Input list manager and command placement
+
+  virtual ~G4VisCommandListManagerSelect();
+
+  G4String GetCurrentValue(G4UIcommand*);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+
+private:
+
+  Manager* fpManager;
+  G4String fPlacement;
+
+  G4UIcmdWithAString* fpCommand;
+
+};
+
+template <typename Manager>
+G4VisCommandListManagerSelect<Manager>::G4VisCommandListManagerSelect(Manager* manager, const G4String& placement)
+  :fpManager(manager)
+  ,fPlacement(placement)
+{  
+  G4String command = placement+"/select";
+  G4String guidance = "Select created object";
+ 
+  fpCommand = new G4UIcmdWithAString(command, this);      
+  fpCommand->SetGuidance(guidance);
+  fpCommand->SetParameterName("name", false);       
+}
+
+template <typename Manager>
+G4VisCommandListManagerSelect<Manager>::~G4VisCommandListManagerSelect()
+{
+  delete fpCommand;
+}
+
+template <typename Manager>
+G4String 
+G4VisCommandListManagerSelect<Manager>::GetCurrentValue(G4UIcommand*) 
+{
+  return "";
+}
+
+template <typename Manager>
+void G4VisCommandListManagerSelect<Manager>::SetNewValue(G4UIcommand*, G4String name) 
+{
+  assert (0 != fpManager);
+  fpManager->SetCurrent(name);
+}    
+
+// Mode command
+template <typename Manager>
+class G4VisCommandManagerMode : public G4UImessenger {
+
+public: // With description
+
+  G4VisCommandManagerMode(Manager*, const G4String& placement);
+
+  virtual ~G4VisCommandManagerMode();
+
+  G4String GetCurrentValue(G4UIcommand*);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+
+private:
+
+  Manager* fpManager;
+  G4String fPlacement;
+
+  G4UIcmdWithAString* fpCommand;
+
+};
+template <typename Manager>
+G4VisCommandManagerMode<Manager>::G4VisCommandManagerMode(Manager* manager, const G4String& placement)
+  :fpManager(manager)
+  ,fPlacement(placement)
+{  
+  G4String command = fPlacement+"/mode";
+  
+  fpCommand = new G4UIcmdWithAString(command, this);      
+  fpCommand->SetGuidance("Set mode of operation");
+  fpCommand->SetParameterName("mode", false);       
+  fpCommand->SetCandidates("soft hard");       
+}
+
+template <typename Manager>
+G4VisCommandManagerMode<Manager>::~G4VisCommandManagerMode()
+{
+  delete fpCommand;
+}
+
+template <typename Manager>
+G4String 
+G4VisCommandManagerMode<Manager>::GetCurrentValue(G4UIcommand*) 
+{
+  return "";
+}
+
+template <typename Manager>
+void G4VisCommandManagerMode<Manager>::SetNewValue(G4UIcommand*, G4String name) 
+{
+  assert (0 != fpManager);
+  fpManager->SetMode(name);
+}    
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/management/include/G4VisCommandsScene.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/include/G4VisCommandsScene.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/include/G4VisCommandsScene.hh	(revision 1102)
@@ -0,0 +1,129 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VisCommandsScene.hh,v 1.19 2006/11/14 14:59:54 allison Exp $
+// GEANT4 tag $Name:  $
+
+// /vis/scene commands - John Allison  9th August 1998
+
+#ifndef G4VISCOMMANDSSCENE_HH
+#define G4VISCOMMANDSSCENE_HH
+
+#include "G4VVisCommand.hh"
+
+class G4UIcommand;
+class G4UIcmdWithAString;
+class G4UIcmdWithoutParameter;
+
+class G4VVisCommandScene: public G4VVisCommand {
+public:
+  G4VVisCommandScene ();
+  virtual ~G4VVisCommandScene ();
+protected:
+  G4String CurrentSceneName ();
+private:
+  G4VVisCommandScene (const G4VVisCommandScene&);
+  G4VVisCommandScene& operator = (const G4VVisCommandScene&);
+};
+
+class G4VisCommandSceneCreate: public G4VVisCommandScene {
+public:
+  G4VisCommandSceneCreate ();
+  virtual ~G4VisCommandSceneCreate ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandSceneCreate (const G4VisCommandSceneCreate&);
+  G4VisCommandSceneCreate& operator = (const G4VisCommandSceneCreate&);
+  G4String NextName ();
+  G4UIcmdWithAString* fpCommand;
+  G4int fId;
+};
+
+class G4VisCommandSceneEndOfEventAction: public G4VVisCommandScene {
+public:
+  G4VisCommandSceneEndOfEventAction ();
+  virtual ~G4VisCommandSceneEndOfEventAction ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandSceneEndOfEventAction (const G4VisCommandSceneEndOfEventAction&);
+  G4VisCommandSceneEndOfEventAction& operator =
+  (const G4VisCommandSceneEndOfEventAction&);
+  G4UIcommand* fpCommand;
+};
+
+class G4VisCommandSceneEndOfRunAction: public G4VVisCommandScene {
+public:
+  G4VisCommandSceneEndOfRunAction ();
+  virtual ~G4VisCommandSceneEndOfRunAction ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandSceneEndOfRunAction (const G4VisCommandSceneEndOfRunAction&);
+  G4VisCommandSceneEndOfRunAction& operator =
+  (const G4VisCommandSceneEndOfRunAction&);
+  G4UIcmdWithAString* fpCommand;
+};
+
+class G4VisCommandSceneList: public G4VVisCommandScene {
+public:
+  G4VisCommandSceneList ();
+  virtual ~G4VisCommandSceneList ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandSceneList (const G4VisCommandSceneList&);
+  G4VisCommandSceneList& operator = (const G4VisCommandSceneList&);
+  G4UIcommand* fpCommand;
+};
+
+class G4VisCommandSceneNotifyHandlers: public G4VVisCommandScene {
+public:
+  G4VisCommandSceneNotifyHandlers ();
+  virtual ~G4VisCommandSceneNotifyHandlers ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandSceneNotifyHandlers (const G4VisCommandSceneNotifyHandlers&);
+  G4VisCommandSceneNotifyHandlers& operator =
+  (const G4VisCommandSceneNotifyHandlers&);
+  G4UIcommand* fpCommand;
+};
+
+class G4VisCommandSceneSelect: public G4VVisCommandScene {
+public:
+  G4VisCommandSceneSelect ();
+  virtual ~G4VisCommandSceneSelect ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandSceneSelect (const G4VisCommandSceneSelect&);
+  G4VisCommandSceneSelect& operator = (const G4VisCommandSceneSelect&);
+  G4UIcmdWithAString* fpCommand;
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/management/include/G4VisCommandsSceneAdd.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/include/G4VisCommandsSceneAdd.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/include/G4VisCommandsSceneAdd.hh	(revision 1102)
@@ -0,0 +1,196 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VisCommandsSceneAdd.hh,v 1.17 2006/11/01 10:50:28 allison Exp $
+// GEANT4 tag $Name:  $
+
+// /vis/scene commands - John Allison  9th August 1998
+
+#ifndef G4VISCOMMANDSSCENEADD_HH
+#define G4VISCOMMANDSSCENEADD_HH
+
+#include "G4VisCommandsScene.hh"
+
+class G4UIcmdWithoutParameter;
+class G4UIcmdWithAString;
+
+#include "G4Transform3D.hh"
+#include "G4VisAttributes.hh"
+
+class G4VisCommandSceneAddAxes: public G4VVisCommandScene {
+public:
+  G4VisCommandSceneAddAxes ();
+  virtual ~G4VisCommandSceneAddAxes ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandSceneAddAxes (const G4VisCommandSceneAddAxes&);
+  G4VisCommandSceneAddAxes& operator = (const G4VisCommandSceneAddAxes&);
+  G4UIcommand* fpCommand;
+};
+
+class G4VisCommandSceneAddEventID: public G4VVisCommandScene {
+public:
+  G4VisCommandSceneAddEventID ();
+  virtual ~G4VisCommandSceneAddEventID ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandSceneAddEventID (const G4VisCommandSceneAddEventID&);
+  G4VisCommandSceneAddEventID& operator = (const G4VisCommandSceneAddEventID&);
+  struct EventID {
+    EventID(G4VisManager* vm, G4int size, G4double x, G4double y):
+      fpVisManager(vm), fSize(size), fX(x), fY(y) {}
+    void operator()(G4VGraphicsScene&, const G4Transform3D&);
+    G4VisManager* fpVisManager;
+    G4int fSize;
+    G4double fX, fY;
+  };
+  G4UIcommand* fpCommand;
+};
+
+class G4VisCommandSceneAddGhosts: public G4VVisCommandScene {
+public:
+  G4VisCommandSceneAddGhosts ();
+  virtual ~G4VisCommandSceneAddGhosts ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandSceneAddGhosts (const G4VisCommandSceneAddGhosts&);
+  G4VisCommandSceneAddGhosts& operator =
+  (const G4VisCommandSceneAddGhosts&);
+  G4UIcmdWithAString* fpCommand;
+};
+
+class G4VisCommandSceneAddHits: public G4VVisCommandScene {
+public:
+  G4VisCommandSceneAddHits ();
+  virtual ~G4VisCommandSceneAddHits ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandSceneAddHits (const G4VisCommandSceneAddHits&);
+  G4VisCommandSceneAddHits& operator = (const G4VisCommandSceneAddHits&);
+  G4UIcmdWithoutParameter* fpCommand;
+};
+
+class G4VisCommandSceneAddLogicalVolume: public G4VVisCommandScene {
+public:
+  G4VisCommandSceneAddLogicalVolume ();
+  virtual ~G4VisCommandSceneAddLogicalVolume ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandSceneAddLogicalVolume (const G4VisCommandSceneAddLogicalVolume&);
+  G4VisCommandSceneAddLogicalVolume& operator =
+  (const G4VisCommandSceneAddLogicalVolume&);
+  G4UIcommand* fpCommand;
+};
+
+class G4VisCommandSceneAddLogo: public G4VVisCommandScene {
+public:
+  G4VisCommandSceneAddLogo ();
+  virtual ~G4VisCommandSceneAddLogo ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandSceneAddLogo (const G4VisCommandSceneAddLogo&);
+  G4VisCommandSceneAddLogo& operator = (const G4VisCommandSceneAddLogo&);
+  class G4Logo {
+  public:
+    G4Logo(G4double height, const G4VisAttributes&);
+    ~G4Logo();
+    void operator()(G4VGraphicsScene&, const G4Transform3D&);
+  private:
+    G4double fHeight;
+    G4VisAttributes fVisAtts;
+    G4Polyhedron *fpG, *fp4;
+  };
+  G4UIcommand* fpCommand;
+};
+
+class G4VisCommandSceneAddScale: public G4VVisCommandScene {
+public:
+  G4VisCommandSceneAddScale ();
+  virtual ~G4VisCommandSceneAddScale ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandSceneAddScale (const G4VisCommandSceneAddScale&);
+  G4VisCommandSceneAddScale& operator = (const G4VisCommandSceneAddScale&);
+  G4UIcommand* fpCommand;
+};
+
+class G4VisCommandSceneAddText: public G4VVisCommandScene {
+public:
+  G4VisCommandSceneAddText ();
+  virtual ~G4VisCommandSceneAddText ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandSceneAddText (const G4VisCommandSceneAddText&);
+  G4VisCommandSceneAddText& operator = (const G4VisCommandSceneAddText&);
+  G4UIcommand* fpCommand;
+};
+
+class G4VisCommandSceneAddTrajectories: public G4VVisCommandScene {
+public:
+  G4VisCommandSceneAddTrajectories ();
+  virtual ~G4VisCommandSceneAddTrajectories ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandSceneAddTrajectories (const G4VisCommandSceneAddTrajectories&);
+  G4VisCommandSceneAddTrajectories& operator =
+  (const G4VisCommandSceneAddTrajectories&);
+  G4UIcmdWithAString* fpCommand;
+};
+
+class G4VisCommandSceneAddUserAction: public G4VVisCommandScene {
+public:
+  G4VisCommandSceneAddUserAction ();
+  virtual ~G4VisCommandSceneAddUserAction ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandSceneAddUserAction (const G4VisCommandSceneAddUserAction&);
+  G4VisCommandSceneAddUserAction& operator = (const G4VisCommandSceneAddUserAction&);
+  G4UIcommand* fpCommand;
+};
+
+class G4VisCommandSceneAddVolume: public G4VVisCommandScene {
+public:
+  G4VisCommandSceneAddVolume ();
+  virtual ~G4VisCommandSceneAddVolume ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandSceneAddVolume (const G4VisCommandSceneAddVolume&);
+  G4VisCommandSceneAddVolume& operator = (const G4VisCommandSceneAddVolume&);
+  G4UIcommand* fpCommand;
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/management/include/G4VisCommandsSceneHandler.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/include/G4VisCommandsSceneHandler.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/include/G4VisCommandsSceneHandler.hh	(revision 1102)
@@ -0,0 +1,86 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VisCommandsSceneHandler.hh,v 1.8 2006/06/29 21:28:44 gunter Exp $
+// GEANT4 tag $Name:  $
+
+// /vis/sceneHandler commands - John Allison  10th October 1998
+
+#ifndef G4VISCOMMANDSSCENEHANDLER_HH
+#define G4VISCOMMANDSSCENEHANDLER_HH
+
+#include "G4VVisCommand.hh"
+
+class G4UIcommand;
+class G4UIcmdWithAString;
+
+class G4VisCommandSceneHandlerAttach: public G4VVisCommand {
+public:
+  // Uses compiler defaults for copy constructor and assignment.
+  G4VisCommandSceneHandlerAttach ();
+  ~G4VisCommandSceneHandlerAttach ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4UIcmdWithAString* fpCommand;
+};
+
+class G4VisCommandSceneHandlerCreate: public G4VVisCommand {
+public:
+  // Uses compiler defaults for copy constructor and assignment.
+  G4VisCommandSceneHandlerCreate ();
+  ~G4VisCommandSceneHandlerCreate ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4String NextName ();
+  G4UIcommand* fpCommand;
+  G4int fId;
+};
+
+class G4VisCommandSceneHandlerList: public G4VVisCommand {
+public:
+  // Uses compiler defaults for copy constructor and assignment.
+  G4VisCommandSceneHandlerList ();
+  ~G4VisCommandSceneHandlerList ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4UIcommand* fpCommand;
+};
+
+class G4VisCommandSceneHandlerSelect: public G4VVisCommand {
+public:
+  // Uses compiler defaults for copy constructor and assignment.
+  G4VisCommandSceneHandlerSelect ();
+  ~G4VisCommandSceneHandlerSelect ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4UIcmdWithAString* fpCommand;
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/management/include/G4VisCommandsViewer.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/include/G4VisCommandsViewer.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/include/G4VisCommandsViewer.hh	(revision 1102)
@@ -0,0 +1,289 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VisCommandsViewer.hh,v 1.23 2006/09/13 13:17:29 allison Exp $
+// GEANT4 tag $Name:  $
+
+// /vis/viewer commands - John Allison  25th October 1998
+
+#ifndef G4VISCOMMANDSVIEWER_HH
+#define G4VISCOMMANDSVIEWER_HH
+
+#include "G4VVisCommand.hh"
+
+class G4VViewer;
+class G4ViewParameters;
+class G4UIcommand;
+class G4UIcmdWithoutParameter;
+class G4UIcmdWithAString;
+class G4UIcmdWithADouble;
+class G4UIcmdWithADoubleAndUnit;
+class G4UIcmdWith3Vector;
+
+class G4VVisCommandViewer: public G4VVisCommand {
+public:
+  G4VVisCommandViewer ();
+  virtual ~G4VVisCommandViewer ();
+protected:
+  void SetViewParameters(G4VViewer*, const G4ViewParameters&);
+private:
+  G4VVisCommandViewer (const G4VVisCommandViewer&);
+  G4VVisCommandViewer& operator = (const G4VVisCommandViewer&);
+};
+
+class G4VisCommandViewerAddCutawayPlane: public G4VVisCommandViewer {
+public:
+  G4VisCommandViewerAddCutawayPlane ();
+  virtual ~G4VisCommandViewerAddCutawayPlane ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandViewerAddCutawayPlane (const G4VisCommandViewerAddCutawayPlane&);
+  G4VisCommandViewerAddCutawayPlane& operator = (const G4VisCommandViewerAddCutawayPlane&);
+  G4UIcommand* fpCommand;
+};
+
+class G4VisCommandViewerChangeCutawayPlane: public G4VVisCommandViewer {
+public:
+  G4VisCommandViewerChangeCutawayPlane ();
+  virtual ~G4VisCommandViewerChangeCutawayPlane ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandViewerChangeCutawayPlane (const G4VisCommandViewerChangeCutawayPlane&);
+  G4VisCommandViewerChangeCutawayPlane& operator = (const G4VisCommandViewerChangeCutawayPlane&);
+  G4UIcommand* fpCommand;
+};
+
+class G4VisCommandViewerClear: public G4VVisCommandViewer {
+public:
+  G4VisCommandViewerClear ();
+  virtual ~G4VisCommandViewerClear ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandViewerClear (const G4VisCommandViewerClear&);
+  G4VisCommandViewerClear& operator = (const G4VisCommandViewerClear&);
+  G4UIcmdWithAString* fpCommand;
+};
+
+class G4VisCommandViewerClearCutawayPlanes: public G4VVisCommandViewer {
+public:
+  G4VisCommandViewerClearCutawayPlanes ();
+  virtual ~G4VisCommandViewerClearCutawayPlanes ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandViewerClearCutawayPlanes (const G4VisCommandViewerClearCutawayPlanes&);
+  G4VisCommandViewerClearCutawayPlanes& operator = (const G4VisCommandViewerClearCutawayPlanes&);
+  G4UIcmdWithoutParameter* fpCommand;
+};
+
+class G4VisCommandViewerClearTransients: public G4VVisCommandViewer {
+public:
+  G4VisCommandViewerClearTransients ();
+  virtual ~G4VisCommandViewerClearTransients ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandViewerClearTransients (const G4VisCommandViewerClearTransients&);
+  G4VisCommandViewerClearTransients& operator =
+  (const G4VisCommandViewerClearTransients&);
+  G4UIcmdWithAString* fpCommand;
+};
+
+class G4VisCommandViewerClone: public G4VVisCommandViewer {
+public:
+  G4VisCommandViewerClone ();
+  virtual ~G4VisCommandViewerClone ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandViewerClone (const G4VisCommandViewerClone&);
+  G4VisCommandViewerClone& operator =
+  (const G4VisCommandViewerClone&);
+  G4UIcommand* fpCommand;
+};
+
+class G4VisCommandViewerCreate: public G4VVisCommandViewer {
+public:
+  G4VisCommandViewerCreate ();
+  virtual ~G4VisCommandViewerCreate ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandViewerCreate (const G4VisCommandViewerCreate&);
+  G4VisCommandViewerCreate& operator = (const G4VisCommandViewerCreate&);
+  G4String NextName ();
+  G4UIcommand* fpCommand;
+  G4int fId;
+};
+
+class G4VisCommandViewerDolly: public G4VVisCommandViewer {
+public:
+  G4VisCommandViewerDolly ();
+  virtual ~G4VisCommandViewerDolly ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandViewerDolly (const G4VisCommandViewerDolly&);
+  G4VisCommandViewerDolly& operator = (const G4VisCommandViewerDolly&);
+  G4UIcmdWithADoubleAndUnit* fpCommandDolly;
+  G4UIcmdWithADoubleAndUnit* fpCommandDollyTo;
+  G4double fDollyIncrement;
+  G4double fDollyTo;
+};
+
+class G4VisCommandViewerFlush: public G4VVisCommandViewer {
+public:
+  G4VisCommandViewerFlush ();
+  virtual ~G4VisCommandViewerFlush ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandViewerFlush (const G4VisCommandViewerFlush&);
+  G4VisCommandViewerFlush& operator = (const G4VisCommandViewerFlush&);
+  G4UIcmdWithAString* fpCommand;
+};
+
+class G4VisCommandViewerList: public G4VVisCommandViewer {
+public:
+  G4VisCommandViewerList ();
+  virtual ~G4VisCommandViewerList ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandViewerList (const G4VisCommandViewerList&);
+  G4VisCommandViewerList& operator = (const G4VisCommandViewerList&);
+  G4UIcommand* fpCommand;
+};
+
+class G4VisCommandViewerPan: public G4VVisCommandViewer {
+public:
+  G4VisCommandViewerPan ();
+  virtual ~G4VisCommandViewerPan ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandViewerPan (const G4VisCommandViewerPan&);
+  G4VisCommandViewerPan& operator = (const G4VisCommandViewerPan&);
+  G4UIcommand* fpCommandPan;
+  G4UIcommand* fpCommandPanTo;
+  G4double fPanIncrementRight, fPanIncrementUp;
+  G4double fPanToRight, fPanToUp;
+};
+
+class G4VisCommandViewerReset: public G4VVisCommandViewer {
+public:
+  G4VisCommandViewerReset ();
+  virtual ~G4VisCommandViewerReset ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandViewerReset (const G4VisCommandViewerReset&);
+  G4VisCommandViewerReset& operator = (const G4VisCommandViewerReset&);
+  G4UIcmdWithAString* fpCommand;
+};
+
+class G4VisCommandViewerRefresh: public G4VVisCommandViewer {
+public:
+  G4VisCommandViewerRefresh ();
+  virtual ~G4VisCommandViewerRefresh ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandViewerRefresh (const G4VisCommandViewerRefresh&);
+  G4VisCommandViewerRefresh& operator = (const G4VisCommandViewerRefresh&);
+  G4UIcmdWithAString* fpCommand;
+};
+
+class G4VisCommandViewerRebuild: public G4VVisCommandViewer {
+public:
+  G4VisCommandViewerRebuild ();
+  virtual ~G4VisCommandViewerRebuild ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandViewerRebuild (const G4VisCommandViewerRebuild&);
+  G4VisCommandViewerRebuild& operator = (const G4VisCommandViewerRebuild&);
+  G4UIcmdWithAString* fpCommand;
+};
+
+class G4VisCommandViewerScale: public G4VVisCommandViewer {
+public:
+  G4VisCommandViewerScale ();
+  virtual ~G4VisCommandViewerScale ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandViewerScale (const G4VisCommandViewerScale&);
+  G4VisCommandViewerScale& operator = (const G4VisCommandViewerScale&);
+  G4UIcmdWith3Vector* fpCommandScale;
+  G4UIcmdWith3Vector* fpCommandScaleTo;
+  G4Vector3D fScaleMultiplier;
+  G4Vector3D fScaleTo;
+};
+
+class G4VisCommandViewerSelect: public G4VVisCommandViewer {
+public:
+  G4VisCommandViewerSelect ();
+  virtual ~G4VisCommandViewerSelect ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandViewerSelect (const G4VisCommandViewerSelect&);
+  G4VisCommandViewerSelect& operator = (const G4VisCommandViewerSelect&);
+  G4UIcmdWithAString* fpCommand;
+};
+
+class G4VisCommandViewerUpdate: public G4VVisCommandViewer {
+public:
+  G4VisCommandViewerUpdate ();
+  virtual ~G4VisCommandViewerUpdate ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandViewerUpdate (const G4VisCommandViewerUpdate&);
+  G4VisCommandViewerUpdate& operator = (const G4VisCommandViewerUpdate&);
+  G4UIcmdWithAString* fpCommand;
+};
+
+class G4VisCommandViewerZoom: public G4VVisCommandViewer {
+public:
+  G4VisCommandViewerZoom ();
+  virtual ~G4VisCommandViewerZoom ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandViewerZoom (const G4VisCommandViewerZoom&);
+  G4VisCommandViewerZoom& operator = (const G4VisCommandViewerZoom&);
+  G4UIcmdWithADouble* fpCommandZoom;
+  G4UIcmdWithADouble* fpCommandZoomTo;
+  G4double fZoomMultiplier;
+  G4double fZoomTo;
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/management/include/G4VisCommandsViewerSet.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/include/G4VisCommandsViewerSet.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/include/G4VisCommandsViewerSet.hh	(revision 1102)
@@ -0,0 +1,85 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VisCommandsViewerSet.hh,v 1.23 2009/05/13 18:17:25 allison Exp $
+// GEANT4 tag $Name: HEAD $
+
+// /vis/viewer/set commands - John Allison  16th May 2000
+
+#ifndef G4VISCOMMANDSVIEWERSET_HH
+#define G4VISCOMMANDSVIEWERSET_HH
+
+#include "G4VisCommandsViewer.hh"
+
+#include <vector>
+
+class G4UIcommand;
+class G4UIcmdWithAString;
+class G4UIcmdWithABool;
+class G4UIcmdWithAnInteger;
+class G4UIcmdWithADouble;
+class G4UIcmdWith3VectorAndUnit;
+
+class G4VisCommandsViewerSet: public G4VVisCommandViewer {
+public:
+  G4VisCommandsViewerSet ();
+  virtual ~G4VisCommandsViewerSet ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandsViewerSet (const G4VisCommandsViewerSet&);
+  G4VisCommandsViewerSet& operator = (const G4VisCommandsViewerSet&);
+  G4UIcmdWithAString*   fpCommandAll;
+  G4UIcmdWithABool*     fpCommandAutoRefresh;
+  G4UIcmdWithABool*     fpCommandAuxEdge;
+  G4UIcommand*          fpCommandBackground;
+  G4UIcommand*          fpCommandCulling;
+  G4UIcmdWithAString*   fpCommandCutawayMode;
+  G4UIcmdWithABool*     fpCommandEdge;
+  G4UIcommand*          fpCommandExplodeFactor;
+  G4UIcmdWithADouble*   fpCommandGlobalMarkerScale;
+  G4UIcmdWithADouble*   fpCommandGlobalLineWidthScale;
+  G4UIcmdWithABool*     fpCommandHiddenEdge;
+  G4UIcmdWithABool*     fpCommandHiddenMarker;
+  G4UIcmdWithAnInteger* fpCommandLineSegments;
+  G4UIcmdWithAString*   fpCommandLightsMove;
+  G4UIcommand*          fpCommandLightsThetaPhi;
+  G4UIcommand*          fpCommandLightsVector;
+  G4ThreeVector         fLightsVector;
+  G4UIcmdWithABool*     fpCommandPicking;
+  G4UIcommand*          fpCommandProjection;
+  G4UIcommand*          fpCommandSectionPlane;
+  G4UIcmdWithAString*   fpCommandStyle;
+  G4UIcmdWith3VectorAndUnit* fpCommandTargetPoint;
+  G4UIcommand*          fpCommandUpThetaPhi;
+  G4UIcommand*          fpCommandUpVector;
+  G4ThreeVector         fUpVector;
+  G4UIcommand*          fpCommandViewpointThetaPhi;
+  G4UIcommand*          fpCommandViewpointVector;
+  G4ThreeVector         fViewpointVector;
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/management/include/G4VisExecutive.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/include/G4VisExecutive.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/include/G4VisExecutive.hh	(revision 1102)
@@ -0,0 +1,135 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VisExecutive.hh,v 1.8 2009/03/14 11:43:42 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison 2nd February 2005 (based on MyVisManager, 24th January 1998).
+//
+// Class description
+//
+// Concrete Visualization Manager that implements the virtual
+// functions RegisterGraphicsSystems and RegisterModelFactories.  This
+// is executed when you Initialise() or Initialize() the vis manager.
+// It exploits C-pre-processor variables G4VIS_USE_DAWN, etc., which
+// are set by the GNUmakefiles if environment variables of the same
+// name are set.
+//
+// Include this file and write code to instantiate G4VisExecutive just
+// once at beginning of operations.  Before you compile, set
+// appropriate environment variables (usually using "./Configure").
+// If you change your environment you must force recompilation (the
+// make files will not detect the need to do this).
+//
+// Typically, your main program file will contain:
+//
+// #ifdef G4VIS_USE
+// #include "G4VisExecutive.hh"
+// #endif
+// ...
+// int main() {
+//   ...
+// #ifdef G4VIS_USE
+//   // Instantiate and initialise Visualization Manager.
+//   G4VisManager* visManager = new G4VisExecutive;    // See Nore (a).
+//   visManager -> SetVerboseLevel (verbosityString);  // See Note (b).
+//   visManager -> RegisterGraphicsSystem (new myGS);  // See Note (c).
+//   visManager -> Initialize ();                      // See Note (d).
+// #endif
+//   ...
+// #ifdef G4VIS_USE
+//   G4cout << "Deleting vis manager..." << G4endl;
+//   delete visManager;
+//   G4cout << "Vis manager deleted." << G4endl;
+// #endif
+//
+// Notes:
+
+// (a) After instantiation, all references to this object should be as
+//     a G4VisManager.  The functions RegisterGraphicsSystems and
+//     RegisterModelFactories defined in G4VisExecutive.icc are
+//     virtual functions of G4VisManager.  They are invoked by
+//     G4VisManager::Initialise.  If you need to initialise in a
+//     separate file, see advice below.
+// (b) The verbosityString ("quiet", "errors", "warnings",
+//     "confirmations", etc. - "help /vis/verbose" to see options) can be
+//     set here or with /vis/verbose.
+// (c) You can register your own graphics system like this.
+// (d) Your can intialise like this with C++ code or use /vis/initialize.
+//
+// If you need to perform the instantiation and the initialisation in
+// separate files, e.g., to establish the verbosity before
+// initialisation, then the code that initialises must have access, of
+// course, to the G4VisExecutive object, but this should be as a
+// G4VisManager object, i.e., #include "G4VisManager.hh".
+// RegisterGraphicsSystems and RegisterModelFactories are (pure)
+// virtual methods of G4VisManager called from G4VisManager::Initialize.
+// First file:
+// #include "G4VisExecutive.hh"
+// ...
+//   fpVisManager = new G4VisExecutive;
+// where fpVisManager is a G4VisManager*.
+// Second file:
+// #include "G4VisManager.hh"
+// ...
+//   fpVisManager -> Initialize ();
+// where there is some mechanism for getting access to the pointer
+// fpVisManager.
+//
+// The implementation is included as an .icc file because - for those
+// graphics systems that need external libraries - only those systems
+// that have been selected by the flags may be instantiated without
+// causing unresolved references (only the user knows which libraries
+// are available on his/her computer).  It also ensures that libraries
+// can be linked in the right order, without circular dependencies.
+// (Note that some graphics systems, notable those that write files
+// for off-line viewing, do not suffer these restrictions and are
+// always registered.)
+//
+// See class description of G4VisManager for more details.
+
+#ifndef G4VISEXECUTIVE_HH
+#define G4VISEXECUTIVE_HH
+
+#include "G4VisManager.hh"
+
+class G4VisExecutive: public G4VisManager {
+
+public: // With description
+
+  G4VisExecutive () {}
+
+private:
+
+  void RegisterGraphicsSystems();
+  void RegisterModelFactories();
+
+};
+
+#include "G4VisExecutive.icc"
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/management/include/G4VisExecutive.icc
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/include/G4VisExecutive.icc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/include/G4VisExecutive.icc	(revision 1102)
@@ -0,0 +1,178 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VisExecutive.icc,v 1.21 2009/03/14 11:43:42 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison 24th January 1998.
+
+#ifndef G4VISEXECUTIVE_ICC
+#define G4VISEXECUTIVE_ICC
+
+// Supported drivers...
+
+// Not needing external packages or libraries...
+#include "G4ASCIITree.hh"
+#include "G4DAWNFILE.hh"
+#include "G4HepRep.hh"
+#include "G4HepRepFile.hh"
+#include "G4RayTracer.hh"
+#include "G4HitFilterFactories.hh"
+#include "G4TrajectoryFilterFactories.hh"
+#include "G4TrajectoryModelFactories.hh"
+#include "G4VRML1File.hh"
+#include "G4VRML2File.hh"
+
+// Needing external packages or libraries...
+
+#ifdef G4VIS_USE_DAWN
+#include "G4FukuiRenderer.hh"
+#endif
+
+#ifdef G4VIS_USE_OPENGLX
+#include "G4OpenGLImmediateX.hh"
+#include "G4OpenGLStoredX.hh"
+#endif
+
+#ifdef G4VIS_USE_OPENGLWIN32
+#include "G4OpenGLImmediateWin32.hh"
+#include "G4OpenGLStoredWin32.hh"
+#endif
+
+#ifdef G4VIS_USE_OPENGLXM
+#include "G4OpenGLImmediateXm.hh"
+#include "G4OpenGLStoredXm.hh"
+#endif
+
+#ifdef G4VIS_USE_OPENGLQT
+#include "G4OpenGLImmediateQt.hh"
+#include "G4OpenGLStoredQt.hh"
+#endif
+
+#ifdef G4VIS_USE_OIX
+#include "G4OpenInventorX.hh"
+#endif
+
+#ifdef G4VIS_USE_OIWIN32
+#include "G4OpenInventorWin32.hh"
+#endif
+
+#ifdef G4VIS_USE_RAYTRACERX
+#include "G4RayTracerX.hh"
+#endif
+
+#ifdef G4VIS_USE_VRML
+#include "G4VRML1.hh"
+#include "G4VRML2.hh"
+#endif
+
+// The inline keyword prevents the compiler making an external
+// reference even though they cannot actually be inlined since they
+// are virtual functions.  This prevents a "multiple definition" error
+// if it is included in more than one file.  However, as explained in
+// the class description in G4VisExecutive.hh, it should never be
+// necessary to #include "G4VisExecutive.hh" in more than one file
+// since after instantiation the object can be treated as a
+// G4VisManager.
+inline void
+G4VisExecutive::RegisterGraphicsSystems () {
+
+  // Graphics Systems not needing external packages or libraries...
+  RegisterGraphicsSystem (new G4ASCIITree);
+  RegisterGraphicsSystem (new G4DAWNFILE);
+  RegisterGraphicsSystem (new G4HepRep);
+  RegisterGraphicsSystem (new G4HepRepFile);
+  RegisterGraphicsSystem (new G4RayTracer);
+  RegisterGraphicsSystem (new G4VRML1File);
+  RegisterGraphicsSystem (new G4VRML2File);
+  // Graphics systems needing external packages or libraries...
+
+#ifdef G4VIS_USE_DAWN
+  RegisterGraphicsSystem (new G4FukuiRenderer);
+#endif
+
+#ifdef G4VIS_USE_OPENGLX
+  RegisterGraphicsSystem (new G4OpenGLImmediateX);
+  RegisterGraphicsSystem (new G4OpenGLStoredX);
+#endif
+
+#ifdef G4VIS_USE_OPENGLWIN32
+  RegisterGraphicsSystem (new G4OpenGLImmediateWin32);
+  RegisterGraphicsSystem (new G4OpenGLStoredWin32);
+#endif
+
+#ifdef G4VIS_USE_OPENGLXM
+  RegisterGraphicsSystem (new G4OpenGLImmediateXm);
+  RegisterGraphicsSystem (new G4OpenGLStoredXm);
+#endif
+
+#ifdef G4VIS_USE_OPENGLQT
+  RegisterGraphicsSystem (new G4OpenGLImmediateQt);
+  RegisterGraphicsSystem (new G4OpenGLStoredQt);
+#endif
+
+#ifdef G4VIS_USE_OIX
+  RegisterGraphicsSystem (new G4OpenInventorX);
+#endif
+
+#ifdef G4VIS_USE_OIWIN32
+  RegisterGraphicsSystem (new G4OpenInventorWin32);
+#endif
+
+#ifdef G4VIS_USE_RAYTRACERX
+  RegisterGraphicsSystem (new G4RayTracerX);
+#endif
+
+#ifdef G4VIS_USE_VRML
+  RegisterGraphicsSystem (new G4VRML1);
+  RegisterGraphicsSystem (new G4VRML2);
+#endif
+
+}
+
+// See comments about inlining above.
+inline void 
+G4VisExecutive::RegisterModelFactories()
+{
+   // Trajectory draw models
+   RegisterModelFactory(new G4TrajectoryGenericDrawerFactory());       
+   RegisterModelFactory(new G4TrajectoryDrawByChargeFactory());
+   RegisterModelFactory(new G4TrajectoryDrawByParticleIDFactory());
+   RegisterModelFactory(new G4TrajectoryDrawByOriginVolumeFactory());  
+   RegisterModelFactory(new G4TrajectoryDrawByAttributeFactory());  
+
+   // Trajectory filter models
+   RegisterModelFactory(new G4TrajectoryChargeFilterFactory());
+   RegisterModelFactory(new G4TrajectoryParticleFilterFactory());
+   RegisterModelFactory(new G4TrajectoryOriginVolumeFilterFactory());
+   RegisterModelFactory(new G4TrajectoryAttributeFilterFactory());
+
+   // Hit filter models
+   RegisterModelFactory(new G4HitAttributeFilterFactory());
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/management/include/G4VisFeaturesOfDAWNFILE.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/include/G4VisFeaturesOfDAWNFILE.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/include/G4VisFeaturesOfDAWNFILE.hh	(revision 1102)
@@ -0,0 +1,37 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VisFeaturesOfDAWNFILE.hh,v 1.5 2006/06/29 21:28:54 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+#ifndef G4VISFEATURESOFDAWNFILE_HH
+#define G4VISFEATURESOFDAWNFILE_HH
+
+#include "globals.hh"
+
+G4String G4VisFeaturesOfDAWNFILE ();
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/management/include/G4VisFeaturesOfFukuiRenderer.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/include/G4VisFeaturesOfFukuiRenderer.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/include/G4VisFeaturesOfFukuiRenderer.hh	(revision 1102)
@@ -0,0 +1,39 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VisFeaturesOfFukuiRenderer.hh,v 1.5 2006/06/29 21:28:56 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+
+#ifndef G4VISFEATURESOFFUKUIRENDERER_HH
+#define G4VISFEATURESOFFUKUIRENDERER_HH
+
+#include "globals.hh"
+
+G4String G4VisFeaturesOfFukuiRenderer ();
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/management/include/G4VisFeaturesOfOpenGL.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/include/G4VisFeaturesOfOpenGL.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/include/G4VisFeaturesOfOpenGL.hh	(revision 1102)
@@ -0,0 +1,46 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VisFeaturesOfOpenGL.hh,v 1.6 2007/10/03 14:20:23 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+
+#ifndef G4VISFEATURESOFOPENGL_HH
+#define G4VISFEATURESOFOPENGL_HH
+
+#include "globals.hh"
+
+G4String G4VisFeaturesOfOpenGLIX ();
+G4String G4VisFeaturesOfOpenGLSX ();
+G4String G4VisFeaturesOfOpenGLIXm ();
+G4String G4VisFeaturesOfOpenGLSXm ();
+G4String G4VisFeaturesOfOpenGLIWin32 ();
+G4String G4VisFeaturesOfOpenGLSWin32 ();
+G4String G4VisFeaturesOfOpenGLIQt ();
+G4String G4VisFeaturesOfOpenGLSQt ();
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/management/include/G4VisFeaturesOfOpenInventor.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/include/G4VisFeaturesOfOpenInventor.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/include/G4VisFeaturesOfOpenInventor.hh	(revision 1102)
@@ -0,0 +1,39 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VisFeaturesOfOpenInventor.hh,v 1.5 2006/06/29 21:29:00 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+
+#ifndef G4VISFEATURESOFOPENINVENTOR_HH
+#define G4VISFEATURESOFOPENINVENTOR_HH
+
+#include "globals.hh"
+
+G4String G4VisFeaturesOfOpenInventor ();
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/management/include/G4VisFilterManager.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/include/G4VisFilterManager.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/include/G4VisFilterManager.hh	(revision 1102)
@@ -0,0 +1,246 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4VisFilterManager.hh,v 1.4 2006/06/29 21:29:02 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// Filter manager. Manages filter models, factories, messengers, 
+// command placement, filter mode etc
+//
+// Jane Tinslay, March 2006
+//
+#ifndef G4VISFILTERMANAGER_HH
+#define G4VISFILTERMANAGER_HH
+
+#include "G4String.hh"
+#include "G4UImessenger.hh"
+#include "G4VFilter.hh"
+#include "G4VModelFactory.hh"
+#include <sstream>
+#include <vector>
+
+namespace FilterMode {
+  enum Mode {Soft, Hard};
+}
+
+template <typename T>
+class G4VisFilterManager {
+
+public:
+
+  // Construct with command placement
+  G4VisFilterManager(const G4String&);
+
+  virtual ~G4VisFilterManager();
+
+  // Useful typedef's
+  typedef G4VFilter<T> Filter;
+  typedef G4VModelFactory<Filter> Factory;
+
+  // Registration methods
+  void Register(Filter*);
+  void Register(Factory*); 
+
+  // Do filtering
+  bool Accept(const T&);
+
+  // Command placement
+  G4String Placement() const;
+
+  // Filter mode operations
+  void SetMode(const FilterMode::Mode&);
+  void SetMode(const G4String&);
+  FilterMode::Mode GetMode() const;
+
+  // Print configuration
+  void Print(std::ostream& ostr, const G4String& name="") const;
+
+  // Accessors
+  const std::vector<Filter*>& FilterList() const;
+  const std::vector<Factory*>& FactoryList() const;
+
+private:
+
+  // Data members
+  G4String fPlacement; // Placement 
+  FilterMode::Mode fMode;
+  std::vector<Factory*> fFactoryList;
+  std::vector<Filter*> fFilterList;
+  std::vector<G4UImessenger*> fMessengerList;
+
+};
+
+template <typename T>
+G4VisFilterManager<T>::G4VisFilterManager(const G4String& placement)
+  :fPlacement(placement)
+{
+  fMode = FilterMode::Hard;
+}
+
+template <typename T>
+G4VisFilterManager<T>::~G4VisFilterManager() 
+{
+  // Cleanup
+  std::vector<G4UImessenger*>::iterator iterMsgr = fMessengerList.begin();
+  
+  while (iterMsgr != fMessengerList.end()) {
+    delete *iterMsgr;
+    iterMsgr++;
+  }
+  
+  typename std::vector<Factory*>::iterator iterFactory = fFactoryList.begin();
+  
+  while (iterFactory != fFactoryList.end()) {
+    delete *iterFactory;       
+    iterFactory++;
+  }
+
+  typename std::vector<Filter*>::iterator iterFilter = fFilterList.begin();
+  
+  while (iterFilter != fFilterList.end()) {
+    delete *iterFilter;       
+    iterFilter++;
+  }
+}
+
+template <typename T>
+void
+G4VisFilterManager<T>::Register(Filter* filter)
+{
+  fFilterList.push_back(filter);
+}
+
+template <typename T>
+void
+G4VisFilterManager<T>::Register(Factory* factory)
+{
+  fFactoryList.push_back(factory);
+
+  fMessengerList.push_back(new G4VisCommandModelCreate<Factory>(factory, fPlacement));
+}
+
+template <typename T>
+bool
+G4VisFilterManager<T>::Accept(const T& obj)
+{
+  typename std::vector<Filter*>::const_iterator iter = fFilterList.begin();
+  bool passed(true);
+  
+  while (passed && (iter != fFilterList.end())) {
+    passed = (*iter)->Accept(obj);
+    iter++;
+  }
+
+  return passed;
+}
+
+template <typename T>
+G4String
+G4VisFilterManager<T>::Placement() const
+{
+  return fPlacement;
+}
+
+template <typename T>
+void
+G4VisFilterManager<T>::SetMode(const G4String& mode) 
+{
+  bool result(false);
+  
+  G4String myMode(mode);
+  myMode.toLower();
+
+  if (myMode == "soft") {result = true; SetMode(FilterMode::Soft);}
+  else if (myMode == "hard") {result = true; SetMode(FilterMode::Hard);}
+
+  if (!result) {
+    std::ostringstream o;
+    o << "Invalid Filter mode."<<mode;
+    G4Exception
+      ("G4VisFilterManager::SetMode(const G4String& mode)", "InvalidMode", JustWarning, o.str().c_str());
+  }
+}
+
+template <typename T>
+void
+G4VisFilterManager<T>::SetMode(const FilterMode::Mode& mode) 
+{
+  fMode = mode;
+}
+
+template <typename T>
+FilterMode::Mode
+G4VisFilterManager<T>::GetMode() const
+{
+  return fMode;
+}
+
+template <typename T>
+void
+G4VisFilterManager<T>::Print(std::ostream& ostr, const G4String& name) const
+{ 
+  ostr<<"Registered filter factories:"<<std::endl;
+  typename std::vector<Factory*>::const_iterator iterFactory = fFactoryList.begin();
+
+  while (iterFactory != fFactoryList.end()) {
+    (*iterFactory)->Print(ostr);
+    iterFactory++;
+  }
+
+  if (0 == fFactoryList.size()) ostr<<"  None"<<std::endl;
+
+  ostr<<std::endl;
+  ostr<<"Registered filters:"<<std::endl;
+
+  typename std::vector<Filter*>::const_iterator iterFilter = fFilterList.begin();
+
+  while (iterFilter != fFilterList.end()) {
+    if (!name.isNull()) {
+      if ((*iterFilter)->Name() == name) (*iterFilter)->PrintAll(ostr);
+    }
+    else {
+      (*iterFilter)->PrintAll(ostr);
+    }
+    iterFilter++;
+  }
+
+  if (0 == fFilterList.size()) ostr<<"  None"<<std::endl;
+}
+
+template <typename T>
+const std::vector< G4VFilter<T>* >&
+G4VisFilterManager<T>::FilterList() const
+{ 
+  return fFilterList;
+}
+
+template <typename T>
+const std::vector< G4VModelFactory< G4VFilter<T> >* >&
+G4VisFilterManager<T>::FactoryList() const
+{ 
+  return fFactoryList;
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/management/include/G4VisListManager.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/include/G4VisListManager.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/include/G4VisListManager.hh	(revision 1102)
@@ -0,0 +1,166 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4VisListManager.hh,v 1.8 2006/06/29 21:29:04 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// Jane Tinslay, John Allison, Joseph Perl October 2005
+//
+// Class Description:
+// Templated class to manage a set of objects, with one named
+// as current. Owns registered objects.
+// Class Description - End:
+
+#ifndef G4VISLISTMANAGER_HH
+#define G4VISLISTMANAGER_HH
+
+#include "G4String.hh"
+#include <map>
+#include <ostream>
+#include <sstream>
+
+template <typename T>
+class G4VisListManager {
+
+public: // With description
+  
+  G4VisListManager();
+
+  virtual ~G4VisListManager();
+
+  // Register ptr. Manager assumes ownership and
+  // ptr becomes current
+  void Register(T* ptr);
+
+  void SetCurrent(const G4String& name);
+
+  // Accessors
+  const T* Current() const {return fpCurrent;}
+  const std::map<G4String, T*>& Map() const;
+
+  // Print configuration
+  void Print(std::ostream& ostr, const G4String& name="") const;
+
+private:
+
+  // Data members
+  std::map<G4String, T*> fMap;
+  T* fpCurrent;
+
+};
+
+template <typename T>
+G4VisListManager<T>::G4VisListManager()
+  :fpCurrent(0) 
+{}
+
+template <typename T>
+G4VisListManager<T>::~G4VisListManager() 
+{
+  typename std::map<G4String, T*>::iterator iter = fMap.begin();
+
+  while (iter != fMap.end()) {
+    delete iter->second;    
+    iter++;
+  }
+}
+
+template <typename T>
+void
+G4VisListManager<T>::Register(T* ptr) 
+{
+  assert (0 != ptr);
+
+  typename std::map<G4String, T*>::const_iterator iter = fMap.find(ptr->Name());
+ 
+  if (iter == fMap.end()) {
+    fMap[ptr->Name()] = ptr;
+    fpCurrent = ptr;    
+  }
+  else {
+    std::ostringstream o;
+    o << "Key "<<ptr->Name()<<" already registered";
+    G4Exception
+      ("G4VisListManager<T>::Register(T* ptr) ",
+       "KeyExists", FatalErrorInArgument, o.str().c_str());
+  }
+}
+
+template <typename T>
+void
+G4VisListManager<T>::SetCurrent(const G4String& name)
+{
+  typename std::map<G4String, T*>::const_iterator iter = fMap.find(name);
+
+  if (iter != fMap.end()) fpCurrent = fMap[name];
+  else {
+    std::ostringstream o;
+    o << "Key "<<name<<" has not been registered";
+    G4Exception
+      ("G4VisListManager<T>::SetCurrent(T* ptr) ",
+       "NonExistentName", FatalErrorInArgument, o.str().c_str());
+  }
+}
+
+template <typename T>
+void
+G4VisListManager<T>::Print(std::ostream& ostr, const G4String& name) const
+{
+  if (0 == fMap.size()) {
+    G4cout<<"  None"<<std::endl;
+    return;
+  }
+    
+  ostr<<"  Current: "<<fpCurrent->Name()<<std::endl;
+
+  if (!name.isNull()) {
+    // Print out specified object
+    typename std::map<G4String, T*>::const_iterator iter = fMap.find(name);
+
+    if (iter != fMap.end()) {
+      iter->second->Print(ostr);
+    }
+    else {
+      ostr<<name<<" not found "<<std::endl;
+    }
+  }
+  else {
+    typename std::map<G4String, T*>::const_iterator iter = fMap.begin();
+    while (iter != fMap.end()) {
+      iter->second->Print(ostr);
+      ostr<<std::endl;
+      iter++;
+    }
+  }
+}
+
+template <typename T>
+const std::map<G4String, T*>&
+G4VisListManager<T>::Map() const
+{
+  return fMap;
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/management/include/G4VisManager.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/include/G4VisManager.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/include/G4VisManager.hh	(revision 1102)
@@ -0,0 +1,473 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VisManager.hh,v 1.70 2009/02/25 18:28:00 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+
+// Class Description:
+//
+// The GEANT4 Visualization Manager - John Allison 02/Jan/1996.
+//
+// G4VisManager is a "Singleton", i.e., only one instance of it or any
+// derived class may exist.  A G4Exception is thrown if an attempt is
+// made to instantiate more than one.
+//
+// It is also an abstract class, so the user must derive his/her own
+// class from G4VisManager, implement the pure virtual function
+// RegisterGraphicsSystems, and instantiate an object of the derived
+// class - for an example see
+// visualization/include/G4VisExecutive.hh/icc.
+//
+// The recommended way for users to obtain a pointer to the vis
+// manager is with G4VVisManager::GetConcreteInstance (), being always
+// careful to test for non-zero.  This pointer is non-zero only when
+// (a) an object of the derived class exists and (b) when there is a
+// valid viewer available.
+//
+// Graphics system registration is normally done through the protected
+// pure virtual function RegisterGraphicsSystems called from
+// Initialise ().  You can also use the public function
+// RegisterGraphicsSystem (new MyGraphicsSystem) if you have your own
+// graphics system. A graphics system is, in effect, a factory for
+// scene handlers and viewers.
+//
+// The VisManager creates and manages graphics systems, scenes, scene
+// handlers, viewers and some models and model makers.  You can have
+// any number.  It has the concept of a "current viewer", and the
+// "current scene handler", the "current scene" and the "current
+// graphics system" which go with it.  You can select the current
+// viewer.  Most of the the operations of the VisManager take place
+// with the current viewer, in particular, the Draw operations.
+//
+// Each scene comprises drawable objects such as detector components
+// and hits when appropriate.  A scene handler translates a scene into
+// graphics-system-specific function calls and, possibly, a
+// graphics-system-dependent database - display lists, scene graphs,
+// etc.  Each viewer has its "view parameters" (see class description
+// of G4ViewParameters for available parameters and also for a
+// description of the concept of a "standard view" and all that).
+//
+// A friend class G4VisStateDependent is "state dependent", i.e., it
+// is notified on change of state (G4ApplicationState).  This is used
+// to message the G4VisManager to draw hits and trajectories in the
+// current scene at the end of event, as required.
+
+#ifndef G4VISMANAGER_HH
+#define G4VISMANAGER_HH
+
+#include "G4VVisManager.hh"
+
+#include "globals.hh"
+#include "G4GraphicsSystemList.hh"
+#include "G4ModelingParameters.hh"
+#include "G4NullModel.hh"
+#include "G4SceneHandlerList.hh"
+#include "G4SceneList.hh"
+#include "G4TrajectoriesModel.hh"
+#include "G4Transform3D.hh"
+#include "G4UImessenger.hh"
+
+#include <iostream>
+#include <vector>
+
+class G4Scene;
+class G4UIcommand;
+class G4UImessenger;
+class G4VisStateDependent;
+class G4VTrajectoryModel;
+class G4VUserVisAction;
+template <typename T> class G4VFilter;
+template <typename T> class G4VisFilterManager;
+template <typename T> class G4VisModelManager;
+template <typename T> class G4VModelFactory;
+class G4Event;
+
+namespace {
+  // Useful typedef's
+  typedef G4VModelFactory<G4VTrajectoryModel> G4TrajDrawModelFactory;
+  typedef G4VModelFactory< G4VFilter<G4VTrajectory> > G4TrajFilterFactory;
+  typedef G4VModelFactory< G4VFilter<G4VHit> > G4HitFilterFactory;
+}
+
+class G4VisManager: public G4VVisManager {
+
+  // Friends - classes and functions which need access to private
+  // members of G4VisManager.  This is mainly to obtain access to
+  // GetInstance (), which is private.  The correct way for normal
+  // users to obtain a pointer to the vis manager is with
+  // G4VVisManager::GetConcreteInstance (), always testing for
+  // non-zero.
+
+  // Odd friends that need access to the G4VisManager...
+  friend class G4RTSteppingAction;
+  friend class G4RayTrajectory;
+  friend class G4RayTracerSceneHandler;
+  friend class G4RTMessenger;
+  friend class G4OpenGLStoredSceneHandler;
+  friend class G4OpenGLViewerMessenger;
+  friend class G4OpenGLXViewerMessenger;
+  friend class G4OpenGLXmViewerMessenger;
+  friend class G4XXXSceneHandler;
+  friend class G4HepRepFileSceneHandler;
+
+  // Management friends...
+  friend class G4VSceneHandler;
+  friend class G4VViewer;
+
+  friend std::ostream & operator <<
+  (std::ostream &, const G4VGraphicsSystem &);
+
+  friend std::ostream & operator <<
+  (std::ostream &, const G4VSceneHandler &);
+
+  friend class G4VisStateDependent;
+
+  friend class G4VisCommandList;
+
+public: // With description
+
+  enum Verbosity {
+    quiet,         // Nothing is printed.
+    startup,       // Startup and endup messages are printed...
+    errors,        // ...and errors...
+    warnings,      // ...and warnings...
+    confirmations, // ...and confirming messages...
+    parameters,    // ...and parameters of scenes and views...
+    all            // ...and everything available.
+  };
+  // Simple graded message scheme.
+
+protected: // With description
+
+  G4VisManager ();
+  // The constructor is protected so that an object of the derived
+  // class may be constructed.
+
+public: // With description
+
+  virtual ~G4VisManager ();
+
+private:
+
+  // Private copy constructor and assigment operator - copying and
+  // assignment not allowed.  Keeps CodeWizard happy.
+  G4VisManager (const G4VisManager&);
+  G4VisManager& operator = (const G4VisManager&);
+
+  static G4VisManager* GetInstance ();
+  // Returns pointer to itself.  Throws a G4Exception if called before
+  // instantiation.  Private so that only friends can use; the normal
+  // user should instead use G4VVisManager::GetConcreteInstance () to
+  // get a "higher level" pointer for general use - but always test
+  // for non-zero.
+
+public: // With description
+
+  void Initialise ();
+  void Initialize ();  // Alias Initialise ().
+
+  G4bool RegisterGraphicsSystem (G4VGraphicsSystem*);
+  // Register an individual graphics system.  Normally this is done in
+  // a sub-class implementation of the protected virtual function,
+  // RegisterGraphicsSystems.  See, e.g., G4VisExecutive.icc.
+
+  void RegisterModelFactory(G4TrajDrawModelFactory* factory);
+  // Register trajectory draw model factory. Assumes ownership of factory.
+
+  void RegisterModel(G4VTrajectoryModel* model);
+  // Register trajectory model. Assumes ownership of model.
+
+  void RegisterModelFactory(G4TrajFilterFactory* factory);
+  // Register trajectory filter model factory. Assumes ownership of factory.
+
+  void RegisterModel(G4VFilter<G4VTrajectory>* filter);
+  // Register trajectory filter model. Assumes ownership of model.
+
+  void RegisterModelFactory(G4HitFilterFactory* factory);
+  // Register trajectory hit model factory. Assumes ownership of factory.
+
+  void RegisterModel(G4VFilter<G4VHit>* filter);
+  // Register trajectory hit model. Assumes ownership of model.
+
+  void SelectTrajectoryModel(const G4String& model);
+  // Set default trajectory model. Useful for use in compiled code
+
+  void RegisterMessenger(G4UImessenger* messenger);
+  // Register messenger. Assumes ownership of messenger.
+
+  /////////////////////////////////////////////////////////////////
+  // Now functions that implement the pure virtual functions of
+  // G4VVisManager for drawing various visualization primitives, useful
+  // for representing hits, digis, etc.
+
+  void Draw (const G4Circle&,
+    const G4Transform3D& objectTransformation = G4Transform3D());
+
+  void Draw (const G4NURBS&,
+    const G4Transform3D& objectTransformation = G4Transform3D());
+
+  void Draw (const G4Polyhedron&,
+    const G4Transform3D& objectTransformation = G4Transform3D());
+
+  void Draw (const G4Polyline&,
+    const G4Transform3D& objectTransformation = G4Transform3D());
+
+  void Draw (const G4Polymarker&,
+    const G4Transform3D& objectTransformation = G4Transform3D());
+
+  void Draw (const G4Scale&,
+    const G4Transform3D& objectTransformation = G4Transform3D());
+
+  void Draw (const G4Square&,
+    const G4Transform3D& objectTransformation = G4Transform3D());
+
+  void Draw (const G4Text&,
+    const G4Transform3D& objectTransformation = G4Transform3D());
+
+  virtual void Draw2D (const G4Circle&,
+    const G4Transform3D& objectTransformation = G4Transform3D());
+
+  virtual void Draw2D (const G4NURBS&,
+    const G4Transform3D& objectTransformation = G4Transform3D());
+
+  virtual void Draw2D (const G4Polyhedron&,
+    const G4Transform3D& objectTransformation = G4Transform3D());
+
+  virtual void Draw2D (const G4Polyline&,
+    const G4Transform3D& objectTransformation = G4Transform3D());
+
+  virtual void Draw2D (const G4Polymarker&,
+    const G4Transform3D& objectTransformation = G4Transform3D());
+
+  virtual void Draw2D (const G4Square&,
+    const G4Transform3D& objectTransformation = G4Transform3D());
+
+  virtual void Draw2D (const G4Text&,
+    const G4Transform3D& objectTransformation = G4Transform3D());
+
+  ////////////////////////////////////////////////////////////////////
+  // Now functions that implement the pure virtual functions of
+  // G4VVisManager for drawing a GEANT4 object.  Note that the
+  // visualization attributes needed in some cases override any
+  // visualization attributes that are associated with the object
+  // itself - thus you can, for example, change the colour of a
+  // physical volume.
+
+  void Draw (const G4VHit&);
+
+  void Draw (const G4VTrajectory&, G4int i_mode);
+  // i_mode is a parameter that can be used to control the drawing of
+  // the trajectory.  See, e.g., G4VTrajectory::DrawTrajectory.
+  // i_mode defaults to 0 by inheritance from G4VVisManager.
+
+  void Draw (const G4LogicalVolume&, const G4VisAttributes&,
+    const G4Transform3D& objectTransformation = G4Transform3D());
+
+  void Draw (const G4VPhysicalVolume&, const G4VisAttributes&,
+    const G4Transform3D& objectTransformation = G4Transform3D());
+
+  void Draw (const G4VSolid&, const G4VisAttributes&,
+    const G4Transform3D& objectTransformation = G4Transform3D());
+
+  ////////////////////////////////////////////////////////////////////////
+  // Now other pure virtual functions of G4VVisManager...
+
+  void GeometryHasChanged ();
+  // Used by run manager to notify change.
+
+  void NotifyHandlers();
+  // Notify scene handlers (G4VGraphicsScene objects) that the scene
+  // has changed so that they may rebuild their graphics database, if
+  // any, and redraw all views.
+
+  void DispatchToModel(const G4VTrajectory&, G4int i_mode);
+  // Draw the trajectory.
+
+  G4bool FilterTrajectory(const G4VTrajectory&);
+  G4bool FilterHit(const G4VHit&);
+
+  ////////////////////////////////////////////////////////////////////////
+  // Administration routines.
+
+  void CreateSceneHandler (G4String name = "");
+  // Creates scene handler for the current system.
+
+  void CreateViewer  (G4String name = "",G4String XGeometry = "");
+  // Creates viewer for the current scene handler.
+
+private:
+
+  void BeginOfRun ();
+
+  void BeginOfEvent ();
+
+  void EndOfEvent ();
+  // This is called on change of state (G4ApplicationState).  It is
+  // used to draw hits and trajectories if included in the current
+  // scene at the end of event, as required.
+
+  void EndOfRun ();
+
+public: // With description
+
+  /////////////////////////////////////////////////////////////////////
+  // Access functions.
+
+  void Enable();
+  void Disable();
+  // Global enable/disable functions.
+
+  const G4VTrajectoryModel* CurrentTrajDrawModel() const;
+
+  G4VUserVisAction*            GetUserAction               () const;
+  G4VisExtent                  GetUserActionExtent         () const;
+  G4VGraphicsSystem*           GetCurrentGraphicsSystem    () const;
+  G4Scene*                     GetCurrentScene             () const;
+  G4VSceneHandler*             GetCurrentSceneHandler      () const;
+  G4VViewer*                   GetCurrentViewer            () const;
+  const G4GraphicsSystemList&  GetAvailableGraphicsSystems ();
+  // The above is non-const because it checks and updates the List by
+  // calling RegisterGraphicsSystems() if no graphics systems are
+  // already registered.
+  const G4SceneHandlerList&    GetAvailableSceneHandlers   () const;
+  const G4SceneList&           GetSceneList                () const;
+  Verbosity                    GetVerbosity                () const;
+  G4bool                       GetTransientsDrawnThisRun       () const;
+  G4bool                       GetTransientsDrawnThisEvent     () const;
+  const G4Event*               GetRequestedEvent               () const;
+  G4bool                       GetAbortReviewKeptEvents        () const;
+
+  void SetUserAction (G4VUserVisAction* pVisAction,
+		      const G4VisExtent& = G4VisExtent::NullExtent);
+  void SetUserActionExtent (const G4VisExtent&);
+  void              SetCurrentGraphicsSystem    (G4VGraphicsSystem* pSystem);
+  void              SetCurrentScene             (G4Scene*);
+  void              SetCurrentSceneHandler      (G4VSceneHandler* pScene);
+  void              SetCurrentViewer            (G4VViewer* pView);
+  G4SceneHandlerList& SetAvailableSceneHandlers ();  // Returns lvalue.
+  G4SceneList&      SetSceneList                ();  // Returns lvalue.
+  void              SetVerboseLevel             (G4int);
+  void              SetVerboseLevel             (const G4String&);
+  void              SetVerboseLevel             (Verbosity);
+  void              SetEventRefreshing          (G4bool);
+  void              ResetTransientsDrawnFlags   ();
+  // If non-zero, requested event is used in G4VSceneHandler::ProcessScene.
+  void              SetRequestedEvent           (const G4Event*);
+  void              SetAbortReviewKeptEvents    (G4bool);
+
+  /////////////////////////////////////////////////////////////////////
+  // Utility functions.
+
+  G4String ViewerShortName (const G4String& viewerName) const;
+  // Returns shortened version of viewer name, i.e., up to first space,
+  // if any.
+
+  G4VViewer* GetViewer (const G4String& viewerName) const;
+  // Returns zero if not found.  Can use long or short name, but find
+  // is done on short name.
+
+  static Verbosity GetVerbosityValue(const G4String&);
+  // Returns verbosity given a string.  (Uses first character only.)
+
+  static Verbosity GetVerbosityValue(G4int);
+  // Returns verbosity given an integer.  If integer is out of range,
+  // selects verbosity at extreme of range.
+
+  static G4String VerbosityString(Verbosity);
+  // Converts the verbosity into a string for suitable for printing.
+  
+  static std::vector<G4String> VerbosityGuidanceStrings;
+  // Guidance on the use of visualization verbosity.
+
+protected:
+
+  virtual void RegisterGraphicsSystems () = 0;
+  // The sub-class must implement and make successive calls to
+  // RegisterGraphicsSystem.
+
+  virtual void RegisterModelFactories();
+  // Sub-class must register desired models
+
+  void RegisterMessengers              ();   // Command messengers.
+
+  const G4int           fVerbose;
+  // fVerbose is kept for backwards compatibility for some user
+  // examples.  (It is used in the derived user vis managers to print
+  // available graphics systems.)  It is initialised to 1 in the
+  // constructor and cannot be changed.
+
+  void PrintAvailableGraphicsSystems   () const;
+
+private:
+
+  void PrintAvailableModels            (Verbosity) const;
+  void PrintInvalidPointers            () const;
+  G4bool IsValidView ();
+  // True if view is valid.  Prints messages and sanitises various data.
+  void ClearTransientStoreIfMarked();
+  // Clears transient store of current scene handler if it is marked
+  // for clearing.  Assumes view is valid.
+
+  static G4VisManager*  fpInstance;         // Pointer to single instance. 
+  G4bool                fInitialised;
+  G4VUserVisAction*     fpUserVisAction;    // User vis action callback.
+  G4VisExtent           fUserVisActionExtent;
+  G4VGraphicsSystem*    fpGraphicsSystem;   // Current graphics system.
+  G4Scene*              fpScene;            // Current scene.
+  G4VSceneHandler*      fpSceneHandler;     // Current scene handler.
+  G4VViewer*            fpViewer;           // Current viewer.
+  G4GraphicsSystemList  fAvailableGraphicsSystems;
+  G4SceneList           fSceneList;
+  G4SceneHandlerList    fAvailableSceneHandlers;
+  Verbosity             fVerbosity;
+  std::vector<G4UImessenger*> fMessengerList;
+  std::vector<G4UIcommand*>   fDirectoryList;
+  G4VisStateDependent*  fpStateDependent;   // Friend state dependent class.
+  G4TrajectoriesModel   dummyTrajectoriesModel;  // For passing drawing mode.
+  G4bool                fEventRefreshing;
+  G4bool                fTransientsDrawnThisRun;
+  G4bool                fTransientsDrawnThisEvent;
+  G4bool                fEventKeepingSuspended;
+  G4bool                fKeptLastEvent;
+  const G4Event*        fpRequestedEvent; // If non-zero, scene handler uses.
+  G4bool                fAbortReviewKeptEvents;
+
+  // Trajectory draw model manager
+  G4VisModelManager<G4VTrajectoryModel>* fpTrajDrawModelMgr;
+  
+  // Trajectory filter model manager
+  G4VisFilterManager<G4VTrajectory>* fpTrajFilterMgr;
+
+  // Hit filter model manager
+  G4VisFilterManager<G4VHit>* fpHitFilterMgr;
+
+};
+
+#include "G4VisManager.icc"
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/management/include/G4VisManager.icc
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/include/G4VisManager.icc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/include/G4VisManager.icc	(revision 1102)
@@ -0,0 +1,123 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VisManager.icc,v 1.21 2009/01/13 09:55:15 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// GEANT4 Visualization Manager - John Allison 02/Jan/1996.
+
+inline void G4VisManager::Initialize () {
+  Initialise ();
+}
+
+inline G4VisExtent G4VisManager::GetUserActionExtent () const {
+  return fUserVisActionExtent;
+}
+
+inline G4VUserVisAction* G4VisManager::GetUserAction () const {
+  return fpUserVisAction;
+}
+
+inline G4VSceneHandler* G4VisManager::GetCurrentSceneHandler () const {
+  return fpSceneHandler;
+}
+
+inline G4VViewer* G4VisManager::GetCurrentViewer () const {
+  return fpViewer;
+}
+
+inline G4Scene* G4VisManager::GetCurrentScene () const {
+  return fpScene;
+}
+
+inline const G4SceneHandlerList&
+G4VisManager::GetAvailableSceneHandlers () const {
+  return fAvailableSceneHandlers;
+}
+
+inline const G4SceneList& G4VisManager::GetSceneList () const {
+  return fSceneList;
+}
+
+inline G4VGraphicsSystem*
+G4VisManager::GetCurrentGraphicsSystem () const {
+  return fpGraphicsSystem;
+}
+
+inline G4VisManager::Verbosity G4VisManager::GetVerbosity () const {
+  return fVerbosity;
+}
+
+
+inline G4bool G4VisManager::GetTransientsDrawnThisEvent() const {
+  return fTransientsDrawnThisEvent;
+}
+
+inline G4bool G4VisManager::GetTransientsDrawnThisRun() const {
+  return fTransientsDrawnThisRun;
+}
+
+inline const G4Event* G4VisManager::GetRequestedEvent() const {
+  return fpRequestedEvent;
+}
+
+inline G4bool G4VisManager::GetAbortReviewKeptEvents() const {
+  return fAbortReviewKeptEvents;
+}
+
+inline void G4VisManager::SetUserActionExtent (const G4VisExtent& extent) {
+  fUserVisActionExtent = extent;
+}
+
+inline G4SceneList& G4VisManager::SetSceneList () {
+  return fSceneList;
+}
+
+inline G4SceneHandlerList& G4VisManager::SetAvailableSceneHandlers () {
+  return fAvailableSceneHandlers;
+}
+
+inline void G4VisManager::SetVerboseLevel (G4VisManager::Verbosity verbosity) {
+  fVerbosity = verbosity;
+}
+
+inline void G4VisManager::SetEventRefreshing (G4bool eventRefreshing) {
+  fEventRefreshing = eventRefreshing;
+}
+
+inline void G4VisManager::RegisterMessenger(G4UImessenger* msgr)
+{
+  fMessengerList.push_back(msgr);
+}
+
+inline void G4VisManager::SetRequestedEvent (const G4Event* event) {
+  fpRequestedEvent = event;
+}
+
+inline void G4VisManager::SetAbortReviewKeptEvents (G4bool abort) {
+  fAbortReviewKeptEvents = abort;
+}
Index: tags/visualization-10.5-before-10.6_test/management/include/G4VisModelManager.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/include/G4VisModelManager.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/include/G4VisModelManager.hh	(revision 1102)
@@ -0,0 +1,184 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4VisModelManager.hh,v 1.4 2006/06/29 21:29:10 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// Generic model manager. Manages models, associated
+// factories, messengers, command placement etc
+//
+// Jane Tinslay, March 2006
+//
+#ifndef G4VISMODELMANAGER_HH
+#define G4VISMODELMANAGER_HH
+
+#include "G4UImessenger.hh"
+#include "G4VisCommandModelCreate.hh"
+#include "G4VisListManager.hh"
+#include "G4VModelFactory.hh"
+#include <vector>
+
+template <typename Model>
+class G4VisModelManager {
+
+public: // With description
+
+  // Useful typedef's
+  typedef G4VisListManager<Model> List;
+  typedef G4VModelFactory<Model> Factory;
+
+  G4VisModelManager(const G4String&);
+  virtual ~G4VisModelManager();
+
+  // Registration methods
+  void Register(Model*);
+  void Register(Factory*); 
+
+  // Change/Retrieve "Current" object
+  void SetCurrent(const G4String&);
+  const Model* Current() const;
+
+  // Command placement
+  G4String Placement() const;
+
+  // Print factory and model data
+  void Print(std::ostream& ostr, const G4String& name="") const;
+
+  // Accessors
+  const List* ListManager() const;
+  const std::vector<Factory*>& FactoryList() const;
+
+private:
+
+  // Data members
+  G4String fPlacement;
+  List* fpModelList;  
+  std::vector<Factory*> fFactoryList;
+  std::vector<G4UImessenger*> fMessengerList;
+
+};
+
+template <typename Model>
+G4VisModelManager<Model>::G4VisModelManager(const G4String& placement)
+  :fPlacement(placement)
+  ,fpModelList(new List)
+{}
+
+template <typename Model>
+G4VisModelManager<Model>::~G4VisModelManager() 
+{
+  // Cleanup
+  std::vector<G4UImessenger*>::iterator iterMsgr = fMessengerList.begin();
+  
+  while (iterMsgr != fMessengerList.end()) {
+    delete *iterMsgr;
+    iterMsgr++;
+  }
+
+  typename std::vector<Factory*>::iterator iterFactory = fFactoryList.begin();
+  
+  while (iterFactory != fFactoryList.end()) {
+    delete *iterFactory;
+    iterFactory++;
+  }
+
+  delete fpModelList;
+}
+
+template <typename Model>
+void
+G4VisModelManager<Model>::Register(Model* model)
+{
+  fpModelList->Register(model);
+}
+
+template <typename Model>
+void
+G4VisModelManager<Model>::Register(Factory* factory)
+{
+  // Assume ownership
+  fFactoryList.push_back(factory);
+
+  // Generate "create" command for this factory
+  fMessengerList.push_back(new G4VisCommandModelCreate<Factory>(factory, fPlacement));
+}
+
+template <typename Model>
+void
+G4VisModelManager<Model>::SetCurrent(const G4String& model) 
+{
+  fpModelList->SetCurrent(model);
+}
+
+template <typename Model>
+const Model*
+G4VisModelManager<Model>::Current() const
+{
+  return fpModelList->Current();
+}
+
+template <typename Model>
+G4String
+G4VisModelManager<Model>::Placement() const
+{
+  return fPlacement;
+}
+
+template <typename Model>
+void
+G4VisModelManager<Model>::Print(std::ostream& ostr, const G4String& name) const
+{
+  ostr<<"Registered model factories:"<<std::endl;
+
+  typename std::vector<Factory*>::const_iterator iter = fFactoryList.begin();
+
+  while (iter != fFactoryList.end()) {
+    (*iter)->Print(ostr);
+    iter++;
+  }
+
+  if (0 == fFactoryList.size()) ostr<<"  None"<<std::endl;
+
+  ostr<<std::endl;
+  ostr<<"Registered models: "<<std::endl;
+
+  fpModelList->Print(ostr, name);
+}
+
+template <typename Model>
+const G4VisListManager<Model>*
+G4VisModelManager<Model>::ListManager() const
+{
+  return fpModelList;
+}
+
+template <typename Model>
+const std::vector<G4VModelFactory<Model>*>&
+G4VisModelManager<Model>::FactoryList() const
+{
+  return fFactoryList;
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/management/include/G4VisStateDependent.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/include/G4VisStateDependent.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/include/G4VisStateDependent.hh	(revision 1102)
@@ -0,0 +1,53 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VisStateDependent.hh,v 1.5 2006/06/29 21:29:12 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// A "state dependent" service class for G4VisManager.
+// John Allison  29th November 1999
+
+// G4VisStateDependent is "state dependent", i.e., it is notified on
+// change of state (G4ApplicationState).  This is used to message the
+// G4VisManager to draw hits and trajectories in the current scene at the
+// end of event, as required.
+
+#ifndef G4VISSTATEDEPENDENT_HH
+#define G4VISSTATEDEPENDENT_HH
+
+#include "G4VStateDependent.hh"
+
+class G4VisManager;
+
+class G4VisStateDependent: public G4VStateDependent {
+  friend class G4VisManager;
+private:
+  G4VisStateDependent (G4VisManager *);
+  G4bool Notify (G4ApplicationState requestedState);
+  G4VisManager* fpVisManager;
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/management/src/G4GraphicsSystemList.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/src/G4GraphicsSystemList.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/src/G4GraphicsSystemList.cc	(revision 1102)
@@ -0,0 +1,38 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4GraphicsSystemList.cc,v 1.4 2006/06/29 21:29:14 gunter Exp $
+// GEANT4 tag $Name:  $
+
+#include "G4GraphicsSystemList.hh"
+
+void G4GraphicsSystemList::remove(G4VGraphicsSystem* graphicsSystem) {
+  G4GraphicsSystemListIterator iGS;
+  for (iGS = begin(); iGS != end(); ++iGS) {
+    if (*iGS == graphicsSystem) break;
+  }
+  if (iGS != end()) erase(iGS);
+}
Index: tags/visualization-10.5-before-10.6_test/management/src/G4Scene.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/src/G4Scene.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/src/G4Scene.cc	(revision 1102)
@@ -0,0 +1,201 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4Scene.cc,v 1.23 2006/11/26 15:51:12 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Scene data  John Allison  19th July 1996.
+
+#include "G4Scene.hh"
+
+#include "G4Vector3D.hh"
+#include "G4BoundingSphereScene.hh"
+#include "G4VisAttributes.hh"
+#include "G4PhysicalVolumeModel.hh"
+#include "G4TransportationManager.hh"
+
+G4Scene::G4Scene (const G4String& name):
+  fName (name),
+  fRefreshAtEndOfEvent(true),
+  fRefreshAtEndOfRun(true),
+  fMaxNumberOfKeptEvents(0)
+{} // Note all other data members have default initial values.
+
+G4Scene::~G4Scene () {}
+
+G4bool G4Scene::AddRunDurationModel (G4VModel* pModel, G4bool warn) {
+  std::vector<G4VModel*>::const_iterator i;
+  for (i = fRunDurationModelList.begin ();
+       i != fRunDurationModelList.end (); ++i) {
+    if (pModel -> GetGlobalDescription () ==
+	(*i) -> GetGlobalDescription ()) break;
+  }
+  if (i != fRunDurationModelList.end ()) {
+    if (warn) {
+      G4cout << "G4Scene::AddRunDurationModel: model \""
+	     << pModel -> GetGlobalDescription ()
+	     << "\"\n  is already in the run-duration list of scene \""
+	     << fName
+	     << "\"."
+	     << G4endl;
+    }
+    return false;
+  }
+  fRunDurationModelList.push_back (pModel);
+  CalculateExtent ();
+  return true;
+}
+
+void G4Scene::CalculateExtent () {
+  G4int nModels = fRunDurationModelList.size ();
+  G4BoundingSphereScene boundingSphereScene;
+  for (G4int i = 0; i < nModels; i++) {
+    const G4VisExtent& thisExtent =
+      fRunDurationModelList[i] -> GetExtent ();
+    G4Point3D thisCentre = thisExtent.GetExtentCentre ();
+    G4double thisRadius = thisExtent.GetExtentRadius ();
+    thisCentre.transform (fRunDurationModelList[i] -> GetTransformation ());
+    boundingSphereScene.AccrueBoundingSphere (thisCentre, thisRadius);
+  }
+  fExtent = boundingSphereScene.GetBoundingSphereExtent ();
+  fStandardTargetPoint = fExtent.GetExtentCentre ();
+}
+
+G4bool G4Scene::AddWorldIfEmpty (G4bool warn) {
+  G4bool successful = true;
+  if (IsEmpty ()) {
+    successful = false;
+    G4VPhysicalVolume* pWorld =
+      G4TransportationManager::GetTransportationManager ()
+      -> GetNavigatorForTracking () -> GetWorldVolume ();
+    if (pWorld) {
+      const G4VisAttributes* pVisAttribs =
+	pWorld -> GetLogicalVolume () -> GetVisAttributes ();
+      if (!pVisAttribs || pVisAttribs -> IsVisible ()) {
+	if (warn) {
+	  G4cout << 
+	    "Your \"world\" has no vis attributes or is marked as visible."
+	    "\n  For a better view of the contents, mark the world as"
+	    " invisible, e.g.,"
+	    "\n  myWorldLogicalVol ->"
+	    " SetVisAttributes (G4VisAttributes::Invisible);"
+		 << G4endl;
+	}
+      }
+      successful = AddRunDurationModel (new G4PhysicalVolumeModel (pWorld));
+      // Note: default depth and no modeling parameters.
+      if (successful) {
+	if (warn) {
+	  G4cout <<
+    "G4Scene::AddWorldIfEmpty: The scene was empty of run-duration models."
+    "\n  \"world\" has been added.";
+	  G4cout << G4endl;
+	}
+      }
+    }
+  }
+  return successful;
+}
+
+G4bool G4Scene::AddEndOfEventModel (G4VModel* pModel, G4bool warn) {
+  G4int i, nModels = fEndOfEventModelList.size ();
+  for (i = 0; i < nModels; i++) {
+    if (pModel -> GetGlobalDescription () ==
+	fEndOfEventModelList [i] -> GetGlobalDescription ()) break;
+  }
+  if (i < nModels) {
+    delete fEndOfEventModelList[i];
+    fEndOfEventModelList[i] = pModel;
+    if (warn) {
+      G4cout << "G4Scene::AddEndOfEventModel: a model \""
+	     << pModel -> GetGlobalDescription ()
+	     << "\"\n  is already in the end-of-event list of scene \""
+	     << fName <<
+	"\".\n  The old model has been deleted; this new model replaces it."
+	     << G4endl;
+    }
+    return true;  // Model replaced sucessfully.
+  }
+  fEndOfEventModelList.push_back (pModel);
+  return true;
+}
+
+std::ostream& operator << (std::ostream& os, const G4Scene& s) {
+
+  size_t i;
+
+  os << "Scene data:";
+
+  os << "\n  Run-duration model list:";
+  for (i = 0; i < s.fRunDurationModelList.size (); i++) {
+    os << "\n  " << *(s.fRunDurationModelList[i]);
+  }
+
+  os << "\n  End-of-event model list:";
+  for (i = 0; i < s.fEndOfEventModelList.size (); i++) {
+    os << "\n  " << *(s.fEndOfEventModelList[i]);
+  }
+
+  os << "\n  Extent or bounding box: " << s.fExtent;
+
+  os << "\n  Standard target point:  " << s.fStandardTargetPoint;
+
+  os << "\n  End of event action set to \"";
+  if (s.fRefreshAtEndOfEvent) os << "refresh\"";
+  else {
+    os << "accumulate (maximum number of kept events: ";
+    if (s.fMaxNumberOfKeptEvents >= 0) os << s.fMaxNumberOfKeptEvents;
+    else os << "unlimited";
+    os << ")";
+  }
+
+  os << "\n  End of run action set to \"";
+  if (s.fRefreshAtEndOfRun) os << "refresh";
+  else os << "accumulate";
+  os << "\"";
+
+  return os;
+}
+
+G4bool G4Scene::operator != (const G4Scene& s) const {
+  if (
+      (fRunDurationModelList.size () !=
+       s.fRunDurationModelList.size ())                 ||
+      (fExtent               != s.fExtent)              ||
+      !(fStandardTargetPoint == s.fStandardTargetPoint) ||
+      fRefreshAtEndOfEvent   != s.fRefreshAtEndOfEvent  ||
+      fRefreshAtEndOfRun     != s.fRefreshAtEndOfRun    ||
+      fMaxNumberOfKeptEvents != s.fMaxNumberOfKeptEvents
+      ) return true;
+
+  for (size_t i = 0; i < fRunDurationModelList.size (); i++) {
+    if (fRunDurationModelList[i] != s.fRunDurationModelList[i])
+      return true;
+  }
+
+  return false;
+}
Index: tags/visualization-10.5-before-10.6_test/management/src/G4SceneHandlerList.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/src/G4SceneHandlerList.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/src/G4SceneHandlerList.cc	(revision 1102)
@@ -0,0 +1,38 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4SceneHandlerList.cc,v 1.4 2006/06/29 21:29:18 gunter Exp $
+// GEANT4 tag $Name:  $
+
+#include "G4SceneHandlerList.hh"
+
+void G4SceneHandlerList::remove(G4VSceneHandler* sceneHandler) {
+  G4SceneHandlerListIterator iSceneHandler;
+  for (iSceneHandler = begin(); iSceneHandler != end(); ++iSceneHandler) {
+    if (*iSceneHandler == sceneHandler) break;
+  }
+  if (iSceneHandler != end()) erase(iSceneHandler);
+}
Index: tags/visualization-10.5-before-10.6_test/management/src/G4SceneList.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/src/G4SceneList.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/src/G4SceneList.cc	(revision 1102)
@@ -0,0 +1,38 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4SceneList.cc,v 1.6 2006/06/29 21:29:20 gunter Exp $
+// GEANT4 tag $Name:  $
+
+#include "G4SceneList.hh"
+
+void G4SceneList::remove(G4Scene* scene) {
+  G4SceneListIterator iScene;
+  for (iScene = begin(); iScene != end(); ++iScene) {
+    if (*iScene == scene) break;
+  }
+  if (iScene != end()) erase(iScene);
+}
Index: tags/visualization-10.5-before-10.6_test/management/src/G4VGraphicsSystem.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/src/G4VGraphicsSystem.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/src/G4VGraphicsSystem.cc	(revision 1102)
@@ -0,0 +1,101 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VGraphicsSystem.cc,v 1.11 2006/06/29 21:29:22 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  27th March 1996
+// Abstract interface class for graphics systems.
+
+#include "G4VGraphicsSystem.hh"
+
+#include "G4VisManager.hh"
+
+G4VGraphicsSystem::~G4VGraphicsSystem () {}
+
+G4VGraphicsSystem::G4VGraphicsSystem (const G4String& name,
+				      Functionality f):
+  fName (name),
+  fNickname (""),
+  fDescription (""),
+  fFunctionality (f) {}
+
+G4VGraphicsSystem::G4VGraphicsSystem (const G4String& name,
+				      const G4String& nickname,
+				      Functionality f):
+  fName (name),
+  fNickname (nickname),
+  fDescription (""),
+  fFunctionality (f) {}
+
+G4VGraphicsSystem::G4VGraphicsSystem (const G4String& name,
+				      const G4String& nickname,
+				      const G4String& description,
+				      Functionality f):
+  fName (name),
+  fNickname (nickname),
+  fDescription (description),
+  fFunctionality (f) {}
+
+std::ostream& operator << (std::ostream& os, const G4VGraphicsSystem& gs) {
+  G4VisManager* pVMan = G4VisManager::GetInstance ();
+  const G4SceneHandlerList& scenes = pVMan -> GetAvailableSceneHandlers ();
+  os << "Graphics System: " << gs.GetName ();
+  if (gs.GetNickname () != "") {
+    os << ", nickname: " << gs.GetNickname ();
+  }
+  if (gs.GetDescription () != "") {
+    os << "\n  Description: " << gs.GetDescription ();
+  }
+  os << "\n  Functionality: " << G4int(gs.GetFunctionality());
+  if (pVMan -> GetVerbosity() >= G4VisManager::parameters) {
+    size_t nScenes = scenes.size ();
+    if (nScenes) {
+      G4int nScenesOfThisSystem = 0;
+      for (size_t i = 0; i < nScenes; i++) {
+	if (scenes [i] -> GetGraphicsSystem () == &gs) {
+	  nScenesOfThisSystem++;
+	}
+      }
+      if (nScenesOfThisSystem) {
+	os << "\n  Its scenes are: ";
+	for (size_t i = 0; i < nScenes; i++) {
+	  if (scenes [i] -> GetGraphicsSystem () == &gs) {
+	    os << "\n  " << *(scenes [i]);
+	  }
+	}
+      }
+      else {
+	os << "\n  It has no scenes at present.";
+      }
+    }
+    else {
+      os << "\n  There are no scenes instantiated at present.";
+    }
+  }
+  return os;
+}
Index: tags/visualization-10.5-before-10.6_test/management/src/G4VSceneHandler.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/src/G4VSceneHandler.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/src/G4VSceneHandler.cc	(revision 1102)
@@ -0,0 +1,939 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VSceneHandler.cc,v 1.83 2008/01/04 22:03:46 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  19th July 1996
+// Abstract interface class for graphics scenes.
+
+#include "G4VSceneHandler.hh"
+
+#include "G4ios.hh"
+#include <sstream>
+
+#include "G4VisManager.hh"
+#include "G4VGraphicsSystem.hh"
+#include "G4VViewer.hh"
+#include "G4VSolid.hh"
+#include "G4RotationMatrix.hh"
+#include "G4ThreeVector.hh"
+#include "G4VPhysicalVolume.hh"
+#include "G4Material.hh"
+#include "G4Polyline.hh"
+#include "G4Scale.hh"
+#include "G4Text.hh"
+#include "G4Circle.hh"
+#include "G4Square.hh"
+#include "G4Polymarker.hh"
+#include "G4Polyhedron.hh"
+#include "G4NURBS.hh"
+#include "G4Visible.hh"
+#include "G4VisAttributes.hh"
+#include "G4VModel.hh"
+#include "G4TrajectoriesModel.hh"
+#include "G4Box.hh"
+#include "G4Cons.hh"
+#include "G4Tubs.hh"
+#include "G4Trd.hh"
+#include "G4Trap.hh"
+#include "G4Sphere.hh"
+#include "G4Para.hh"
+#include "G4Torus.hh"
+#include "G4Polycone.hh"
+#include "G4Polyhedra.hh"
+#include "G4LogicalVolume.hh"
+#include "G4PhysicalVolumeModel.hh"
+#include "G4ModelingParameters.hh"
+#include "G4VTrajectory.hh"
+#include "G4VTrajectoryPoint.hh"
+#include "G4HitsModel.hh"
+#include "G4VHit.hh"
+#include "Randomize.hh"
+#include "G4StateManager.hh"
+#include "G4RunManager.hh"
+#include "G4Run.hh"
+#include "G4Transform3D.hh"
+#include "G4AttHolder.hh"
+#include "G4AttDef.hh"
+
+G4VSceneHandler::G4VSceneHandler (G4VGraphicsSystem& system, G4int id, const G4String& name):
+  fSystem                (system),
+  fSceneHandlerId        (id),
+  fViewCount             (0),
+  fpViewer               (0),
+  fpScene                (0),
+  fMarkForClearingTransientStore (true),  // Ready for first
+					  // ClearTransientStoreIfMarked(),
+					  // e.g., at end of run (see
+					  // G4VisManager.cc).
+  fReadyForTransients    (true),  // Only false while processing scene.
+  fProcessingSolid       (false),
+  fSecondPassRequested   (false),
+  fSecondPass            (false),
+  fpModel                (0),
+  fpObjectTransformation (0),
+  fNestingDepth          (0),
+  fpVisAttribs           (0)
+{
+  G4VisManager* pVMan = G4VisManager::GetInstance ();
+  fpScene = pVMan -> GetCurrentScene ();
+  if (name == "") {
+    std::ostringstream ost;
+    ost << fSystem.GetName () << '-' << fSceneHandlerId;
+    fName = ost.str();
+  }
+  else {
+    fName = name;
+  }
+  fTransientsDrawnThisEvent = pVMan->GetTransientsDrawnThisEvent();
+  fTransientsDrawnThisRun = pVMan->GetTransientsDrawnThisRun();
+}
+
+G4VSceneHandler::~G4VSceneHandler () {
+  G4ViewerListIterator i;
+  for (i = fViewerList.begin(); i != fViewerList.end(); ++i) {
+    delete *i;
+  }
+}
+
+void G4VSceneHandler::PreAddSolid (const G4Transform3D& objectTransformation,
+                                  const G4VisAttributes& visAttribs) {
+  fpObjectTransformation = &objectTransformation;
+  fpVisAttribs = &visAttribs;
+  fProcessingSolid = true;
+}
+
+void G4VSceneHandler::PostAddSolid () {
+  fpObjectTransformation = 0;
+  fpVisAttribs = 0;
+  fProcessingSolid = false;
+  if (fReadyForTransients) {
+    fTransientsDrawnThisEvent = true;
+    fTransientsDrawnThisRun = true;
+  }
+}
+
+void G4VSceneHandler::BeginPrimitives
+(const G4Transform3D& objectTransformation) {
+  fNestingDepth++;
+  if (fNestingDepth > 1)
+    G4Exception("G4VSceneHandler::BeginPrimitives: Nesting detected."
+		"\n  It is illegal to nest Begin/EndPrimitives.");
+  fpObjectTransformation = &objectTransformation;
+}
+
+void G4VSceneHandler::EndPrimitives () {
+  if (fNestingDepth <= 0)
+    G4Exception("G4VSceneHandler::EndPrimitives: Nesting error");
+  fNestingDepth--;
+  fpObjectTransformation = 0;
+  if (fReadyForTransients) {
+    fTransientsDrawnThisEvent = true;
+    fTransientsDrawnThisRun = true;
+  }
+}
+
+void G4VSceneHandler::BeginPrimitives2D
+(const G4Transform3D& objectTransformation) {
+  fNestingDepth++;
+  if (fNestingDepth > 1)
+    G4Exception("G4VSceneHandler::BeginPrimitives2D: Nesting detected."
+		"\n  It is illegal to nest Begin/EndPrimitives.");
+  fpObjectTransformation = &objectTransformation;
+}
+
+void G4VSceneHandler::EndPrimitives2D () {
+  if (fNestingDepth <= 0)
+    G4Exception("G4VSceneHandler::EndPrimitives2D: Nesting error");
+  fNestingDepth--;
+  fpObjectTransformation = 0;
+  if (fReadyForTransients) {
+    fTransientsDrawnThisEvent = true;
+    fTransientsDrawnThisRun = true;
+  }
+}
+
+void G4VSceneHandler::BeginModeling () {
+}
+
+void G4VSceneHandler::EndModeling ()
+{
+  fpModel = 0;
+}
+
+void G4VSceneHandler::ClearStore () {
+  // if (fpViewer) fpViewer -> NeedKernelVisit (true);
+  // ?? Viewer is supposed to be smart enough to know when to visit
+  // kernel, but a problem in OpenGL Stored seems to require a forced
+  // kernel visit triggered by the above code.  John Allison Aug 2001
+  // Feb 2005 - commented out.  Let's fix OpenGL if necessary.
+}
+
+void G4VSceneHandler::ClearTransientStore () {
+}
+
+void G4VSceneHandler::AddSolid (const G4Box& box) {
+  RequestPrimitives (box);
+// If your graphics system is sophisticated enough to handle a
+//  particular solid shape as a primitive, in your derived class write a
+//  function to override this.  (Note: some compilers warn that your
+//  function "hides" this one.  That's OK.)
+// Your function might look like this...
+// void G4MyScene::AddSolid (const G4Box& box) {
+// Get parameters of appropriate object, e.g.:
+//   G4double dx = box.GetXHalfLength ();
+//   G4double dy = box.GetYHalfLength ();
+//   G4double dz = box.GetZHalfLength ();
+// and Draw or Store in your display List.
+}
+
+void G4VSceneHandler::AddSolid (const G4Tubs& tubs) {
+  RequestPrimitives (tubs);
+}
+
+void G4VSceneHandler::AddSolid (const G4Cons& cons) {
+  RequestPrimitives (cons);
+}
+
+void G4VSceneHandler::AddSolid (const G4Trd& trd) {
+  RequestPrimitives (trd);
+}
+
+void G4VSceneHandler::AddSolid (const G4Trap& trap) {
+  RequestPrimitives (trap);
+}
+
+void G4VSceneHandler::AddSolid (const G4Sphere& sphere) {
+  RequestPrimitives (sphere );
+}
+
+void G4VSceneHandler::AddSolid (const G4Para& para) {
+  RequestPrimitives (para);
+}
+
+void G4VSceneHandler::AddSolid (const G4Torus& torus) {
+  RequestPrimitives (torus);
+}
+
+void G4VSceneHandler::AddSolid (const G4Polycone& polycone) {
+  RequestPrimitives (polycone);
+}
+
+void G4VSceneHandler::AddSolid (const G4Polyhedra& polyhedra) {
+  RequestPrimitives (polyhedra);
+}
+
+void G4VSceneHandler::AddSolid (const G4VSolid& solid) {
+  RequestPrimitives (solid);
+}
+
+void G4VSceneHandler::AddCompound (const G4VTrajectory& traj) {
+  G4TrajectoriesModel* pTrModel =
+    dynamic_cast<G4TrajectoriesModel*>(fpModel);
+  if (!pTrModel) G4Exception
+    ("G4VSceneHandler::AddCompound(const G4VTrajectory&): Not a G4TrajectoriesModel.");
+  traj.DrawTrajectory(pTrModel->GetDrawingMode());
+}
+
+void G4VSceneHandler::AddCompound (const G4VHit& hit) {
+  ((G4VHit&)hit).Draw(); // Cast to non-const because Draw is non-const!!!!
+}
+
+void G4VSceneHandler::AddViewerToList (G4VViewer* pViewer) {
+  fViewerList.push_back (pViewer);
+}
+
+void G4VSceneHandler::AddPrimitive (const G4Scale& scale) {
+
+  const G4double margin(0.01);
+  // Fractional margin - ensures scale is comfortably inside viewing
+  // volume.
+  const G4double oneMinusMargin (1. - margin);
+
+  const G4VisExtent& sceneExtent = fpScene->GetExtent();
+
+  // Useful constants...
+  const G4double length(scale.GetLength());
+  const G4double halfLength(length / 2.);
+  const G4double tickLength(length / 20.);
+  const G4double piBy2(halfpi);
+
+  // Get size of scene...
+  const G4double xmin = sceneExtent.GetXmin();
+  const G4double xmax = sceneExtent.GetXmax();
+  const G4double ymin = sceneExtent.GetYmin();
+  const G4double ymax = sceneExtent.GetYmax();
+  const G4double zmin = sceneExtent.GetZmin();
+  const G4double zmax = sceneExtent.GetZmax();
+
+  // Create (empty) polylines having the same vis attributes...
+  G4Polyline scaleLine, tick11, tick12, tick21, tick22;
+  G4VisAttributes visAtts(*scale.GetVisAttributes());  // Long enough life.
+  scaleLine.SetVisAttributes(&visAtts);
+  tick11.SetVisAttributes(&visAtts);
+  tick12.SetVisAttributes(&visAtts);
+  tick21.SetVisAttributes(&visAtts);
+  tick22.SetVisAttributes(&visAtts);
+
+  // Add points to the polylines to represent an scale parallel to the
+  // x-axis centred on the origin...
+  G4Point3D r1(G4Point3D(-halfLength, 0., 0.));
+  G4Point3D r2(G4Point3D( halfLength, 0., 0.));
+  scaleLine.push_back(r1);
+  scaleLine.push_back(r2);
+  G4Point3D ticky(0., tickLength, 0.);
+  G4Point3D tickz(0., 0., tickLength);
+  tick11.push_back(r1 + ticky);
+  tick11.push_back(r1 - ticky);
+  tick12.push_back(r1 + tickz);
+  tick12.push_back(r1 - tickz);
+  tick21.push_back(r2 + ticky);
+  tick21.push_back(r2 - ticky);
+  tick22.push_back(r2 + tickz);
+  tick22.push_back(r2 - tickz);
+  G4Point3D textPosition(0., tickLength, 0.);
+
+  // Transform appropriately...
+
+  G4Transform3D transformation;
+  if (scale.GetAutoPlacing()) {
+    G4Transform3D rotation;
+    switch (scale.GetDirection()) {
+    case G4Scale::x:
+      break;
+    case G4Scale::y:
+      rotation = G4RotateZ3D(piBy2);
+      break;
+    case G4Scale::z:
+      rotation = G4RotateY3D(piBy2);
+      break;
+    }
+    G4double sxmid(scale.GetXmid());
+    G4double symid(scale.GetYmid());
+    G4double szmid(scale.GetZmid());
+    sxmid = xmin + oneMinusMargin * (xmax - xmin);
+    symid = ymin + margin * (ymax - ymin);
+    szmid = zmin + oneMinusMargin * (zmax - zmin);
+    switch (scale.GetDirection()) {
+    case G4Scale::x:
+      sxmid -= halfLength;
+      break;
+    case G4Scale::y:
+      symid += halfLength;
+      break;
+    case G4Scale::z:
+      szmid -= halfLength;
+      break;
+    }
+    G4Translate3D translation(sxmid, symid, szmid);
+    transformation = translation * rotation;
+  } else {
+    if (fpModel) transformation = fpModel->GetTransformation();
+  }
+
+  // Draw...
+  // We would like to call BeginPrimitives(transformation) here but
+  // calling BeginPrimitives from within an AddPrimitive is not
+  // allowed!  So we have to do our own transformation...
+  AddPrimitive(scaleLine.transform(transformation));
+  AddPrimitive(tick11.transform(transformation));
+  AddPrimitive(tick12.transform(transformation));
+  AddPrimitive(tick21.transform(transformation));
+  AddPrimitive(tick22.transform(transformation));
+  G4Text text(scale.GetAnnotation(),textPosition.transform(transformation));
+  text.SetScreenSize(12.);
+  AddPrimitive(text);
+}
+
+void G4VSceneHandler::AddPrimitive (const G4Polymarker& polymarker) {
+  switch (polymarker.GetMarkerType()) {
+  default:
+  case G4Polymarker::dots:
+    {
+      for (size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
+	G4Circle dot (polymarker);
+        dot.SetPosition (polymarker[iPoint]);
+	dot.SetWorldSize  (0.);
+	dot.SetScreenSize (0.1);  // Very small circle.
+	AddPrimitive (dot);
+      }
+    }
+    break;
+  case G4Polymarker::circles:
+    {
+      for (size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
+	G4Circle circle (polymarker);
+	circle.SetPosition (polymarker[iPoint]);
+	AddPrimitive (circle);
+      }
+    }
+    break;
+  case G4Polymarker::squares:
+    {
+      for (size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
+	G4Square square (polymarker);
+	square.SetPosition (polymarker[iPoint]);
+	AddPrimitive (square);
+      }
+    }
+    break;
+  }
+}
+
+void G4VSceneHandler::RemoveViewerFromList (G4VViewer* pViewer) {
+  fViewerList.remove(pViewer);
+}
+
+void G4VSceneHandler::SetScene (G4Scene* pScene) {
+  fpScene = pScene;
+  // Notify all viewers that a kernel visit is required.
+  G4ViewerListIterator i;
+  for (i = fViewerList.begin(); i != fViewerList.end(); i++) {
+    (*i) -> SetNeedKernelVisit (true);
+  }
+}
+
+void G4VSceneHandler::RequestPrimitives (const G4VSolid& solid) {
+  BeginPrimitives (*fpObjectTransformation);
+  G4NURBS* pNURBS = 0;
+  G4Polyhedron* pPolyhedron = 0;
+  switch (fpViewer -> GetViewParameters () . GetRepStyle ()) {
+  case G4ViewParameters::nurbs:
+    pNURBS = solid.CreateNURBS ();
+    if (pNURBS) {
+      pNURBS -> SetVisAttributes (fpVisAttribs);
+      AddPrimitive (*pNURBS);
+      delete pNURBS;
+      break;
+    }
+    else {
+      G4VisManager::Verbosity verbosity =
+	G4VisManager::GetInstance()->GetVerbosity();
+      if (verbosity >= G4VisManager::errors) {
+	G4cout <<
+	  "ERROR: G4VSceneHandler::RequestPrimitives"
+	  "\n  NURBS not available for "
+	       << solid.GetName () << G4endl;
+	G4cout << "Trying polyhedron." << G4endl;
+      }
+    }
+    // Dropping through to polyhedron...
+  case G4ViewParameters::polyhedron:
+  default:
+    G4Polyhedron::SetNumberOfRotationSteps (GetNoOfSides (fpVisAttribs));
+    pPolyhedron = solid.GetPolyhedron ();
+    G4Polyhedron::ResetNumberOfRotationSteps ();
+    if (pPolyhedron) {
+      pPolyhedron -> SetVisAttributes (fpVisAttribs);
+      printf("G4VSceneHandler::RequestPrimitives VSolid: %d\n",pPolyhedron);
+      G4cout <<
+        "G4VSceneHandler::RequestPrimitives VSolid " << solid.GetName () <<G4endl;
+      AddPrimitive (*pPolyhedron);
+    }
+    else {
+      G4VisManager::Verbosity verbosity =
+	G4VisManager::GetInstance()->GetVerbosity();
+      if (verbosity >= G4VisManager::errors) {
+	G4cout <<
+	  "ERROR: G4VSceneHandler::RequestPrimitives"
+	  "\n  Polyhedron not available for " << solid.GetName () <<
+	  ".\n  This means it cannot be visualized on most systems."
+	  "\n  Contact the Visualization Coordinator." << G4endl;
+      }
+    }
+    break;
+  }
+  EndPrimitives ();
+}
+
+void G4VSceneHandler::ProcessScene (G4VViewer&) {
+
+#ifdef G4DEBUG_VIS_MANAGEMENT
+  printf("G4VSceneHandler::ProcessScene : BEGIN\n");
+#endif
+
+  if (!fpScene) return;
+
+  G4VisManager* visManager = G4VisManager::GetInstance();
+
+  if (!visManager->GetConcreteInstance()) return;
+
+  G4VisManager::Verbosity verbosity = visManager->GetVerbosity();
+
+  fReadyForTransients = false;
+
+#ifdef G4DEBUG_VIS_MANAGEMENT
+  printf("G4VSceneHandler::ProcessScene : Before clear store \n");
+#endif
+  // Clear stored scene, if any, i.e., display lists, scene graphs.
+  ClearStore ();
+
+  // Reset fMarkForClearingTransientStore.  No need to clear transient
+  // store since it has just been cleared above.  (Leaving
+  // fMarkForClearingTransientStore true causes problems with
+  // recomputing transients below.)  Restore it again at end...
+  G4bool tmpMarkForClearingTransientStore = fMarkForClearingTransientStore;
+  fMarkForClearingTransientStore = false;
+
+  // Traverse geometry tree and send drawing primitives to window(s).
+
+  const std::vector<G4VModel*>& runDurationModelList =
+    fpScene -> GetRunDurationModelList ();
+
+  if (runDurationModelList.size ()) {
+    if (verbosity >= G4VisManager::confirmations) {
+      G4cout << "Traversing scene data..." << G4endl;
+    }
+
+#ifdef G4DEBUG_VIS_MANAGEMENT
+    printf("G4VSceneHandler::ProcessScene : begin model\n");
+#endif
+    BeginModeling ();
+
+    // Create modeling parameters from view parameters...
+    G4ModelingParameters* pMP = CreateModelingParameters ();
+
+    for (size_t i = 0; i < runDurationModelList.size (); i++) {
+      G4VModel* pModel = runDurationModelList[i];
+      // Note: this is not the place to take action on
+      // pModel->GetTransformation().  The model must take care of
+      // this in pModel->DescribeYourselfTo(*this).  See, for example,
+      // G4PhysicalVolumeModel and /vis/scene/add/logo.
+      pModel -> SetModelingParameters (pMP);
+      SetModel (pModel);  // Store for use by derived class.
+      pModel -> DescribeYourselfTo (*this);
+      pModel -> SetModelingParameters (0);
+    }
+
+    // Repeat if required...
+    if (fSecondPassRequested) {
+      fSecondPass = true;
+      for (size_t i = 0; i < runDurationModelList.size (); i++) {
+	G4VModel* pModel = runDurationModelList[i];
+	pModel -> SetModelingParameters (pMP);
+	SetModel (pModel);  // Store for use by derived class.
+	pModel -> DescribeYourselfTo (*this);
+	pModel -> SetModelingParameters (0);
+      }
+      fSecondPass = false;
+      fSecondPassRequested = false;
+    }
+
+    delete pMP;
+    EndModeling ();
+
+  }
+
+  fpViewer->FinishView();  // Flush streams and/or swap buffers.
+
+  fReadyForTransients = true;
+
+#ifdef G4DEBUG_VIS_MANAGEMENT
+  printf("G4VSceneHandler::ProcessScene : Idle ?\n");
+#endif
+  // Refresh event from end-of-event model list.  Allow only in Idle state...
+  G4StateManager* stateManager = G4StateManager::GetStateManager();
+  G4ApplicationState state = stateManager->GetCurrentState();
+  if (state == G4State_Idle) {
+#ifdef G4DEBUG_VIS_MANAGEMENT
+    printf("G4VSceneHandler::ProcessScene : IDLE\n");
+#endif
+
+    visManager->SetEventRefreshing(true);
+
+    if (visManager->GetRequestedEvent()) {
+#ifdef G4DEBUG_VIS_MANAGEMENT
+      printf("G4VSceneHandler::ProcessScene : DrawEvent\n");
+#endif
+      DrawEvent(visManager->GetRequestedEvent());
+
+    } else {
+
+#ifdef G4DEBUG_VIS_MANAGEMENT
+      printf("G4VSceneHandler::ProcessScene : no event\n");
+#endif
+      G4RunManager* runManager = G4RunManager::GetRunManager();
+      if (runManager) {
+#ifdef G4DEBUG_VIS_MANAGEMENT
+        printf("G4VSceneHandler::ProcessScene : runManager\n");
+#endif
+	const G4Run* run = runManager->GetCurrentRun();
+	const std::vector<const G4Event*>* events =
+	  run? run->GetEventVector(): 0;
+	size_t nKeptEvents = 0;
+	if (events) nKeptEvents = events->size();
+	if (nKeptEvents) {
+
+#ifdef G4DEBUG_VIS_MANAGEMENT
+        printf("G4VSceneHandler::ProcessScene : 1\n");
+#endif
+	  if (fpScene->GetRefreshAtEndOfEvent()) {
+#ifdef G4DEBUG_VIS_MANAGEMENT
+        printf("G4VSceneHandler::ProcessScene : 2\n");
+#endif
+
+	    if (verbosity >= G4VisManager::confirmations) {
+	      G4cout << "Refreshing event..." << G4endl;
+	    }
+	    const G4Event* event = 0;
+	    if (events && events->size()) event = events->back();
+	    if (event) DrawEvent(event);
+
+	  } else {  // Accumulating events.
+#ifdef G4DEBUG_VIS_MANAGEMENT
+        printf("G4VSceneHandler::ProcessScene : 3\n");
+#endif
+
+	    if (verbosity >= G4VisManager::confirmations) {
+	      G4cout << "Refreshing events in run..." << G4endl;
+	    }
+	    for (size_t i = 0; i < nKeptEvents; ++i) {
+#ifdef G4DEBUG_VIS_MANAGEMENT
+        printf("G4VSceneHandler::ProcessScene : 4\n");
+#endif
+	      const G4Event* event = (*events)[i];
+	      if (event) DrawEvent(event);
+	    }
+
+	    if (!fpScene->GetRefreshAtEndOfRun()) {
+#ifdef G4DEBUG_VIS_MANAGEMENT
+        printf("G4VSceneHandler::ProcessScene : 5\n");
+#endif
+	      if (verbosity >= G4VisManager::warnings) {
+		G4cout <<
+		  "WARNING: Cannot refresh events accumulated over more"
+		  "\n  than one runs.  Refreshed just the last run."
+		       << G4endl;
+	      }
+	    }
+	  }
+	}
+      }
+    }
+    visManager->SetEventRefreshing(false);
+  }
+
+  fMarkForClearingTransientStore = tmpMarkForClearingTransientStore;
+}
+
+void G4VSceneHandler::DrawEvent(const G4Event* event)
+{
+  const std::vector<G4VModel*>& EOEModelList =
+    fpScene -> GetEndOfEventModelList ();
+  size_t nModels = EOEModelList.size();
+  if (nModels) {
+    G4ModelingParameters* pMP = CreateModelingParameters();
+    pMP->SetEvent(event);
+    for (size_t i = 0; i < nModels; i++) {
+      G4VModel* pModel = EOEModelList [i];
+      pModel -> SetModelingParameters(pMP);
+      SetModel (pModel);
+      pModel -> DescribeYourselfTo (*this);
+      pModel -> SetModelingParameters(0);
+    }
+    delete pMP;
+    SetModel (0);
+  }
+}
+
+G4ModelingParameters* G4VSceneHandler::CreateModelingParameters ()
+{
+  // Create modeling parameters from View Parameters...
+  const G4ViewParameters& vp = fpViewer -> GetViewParameters ();
+
+  // Convert drawing styles...
+  G4ModelingParameters::DrawingStyle modelDrawingStyle =
+    G4ModelingParameters::wf;
+  switch (vp.GetDrawingStyle ()) {
+  default:
+  case G4ViewParameters::wireframe:
+    modelDrawingStyle = G4ModelingParameters::wf;
+    break;
+  case G4ViewParameters::hlr:
+    modelDrawingStyle = G4ModelingParameters::hlr;
+    break;
+  case G4ViewParameters::hsr:
+    modelDrawingStyle = G4ModelingParameters::hsr;
+    break;
+  case G4ViewParameters::hlhsr:
+    modelDrawingStyle = G4ModelingParameters::hlhsr;
+    break;
+  }
+
+  // Decide if covered daughters are really to be culled...
+  G4bool reallyCullCovered =
+    vp.IsCullingCovered()   // Culling daughters depends also on...
+    && !vp.IsSection ()     // Sections (DCUT) not requested.
+    && !vp.IsCutaway ()     // Cutaways not requested.
+    ;
+
+  G4ModelingParameters* pModelingParams = new G4ModelingParameters
+    (vp.GetDefaultVisAttributes (),
+     modelDrawingStyle,
+     vp.IsCulling (),
+     vp.IsCullingInvisible (),
+     vp.IsDensityCulling (),
+     vp.GetVisibleDensity (),
+     reallyCullCovered,
+     vp.GetNoOfSides ()
+     );
+
+  pModelingParams->SetWarning
+    (G4VisManager::GetInstance()->GetVerbosity() >= G4VisManager::warnings);
+
+  pModelingParams->SetExplodeFactor(vp.GetExplodeFactor());
+  pModelingParams->SetExplodeCentre(vp.GetExplodeCentre());
+
+  pModelingParams->SetSectionPolyhedron(CreateSectionPolyhedron());
+  pModelingParams->SetCutawayPolyhedron(CreateCutawayPolyhedron());
+  // The polyhedron objects are deleted in the modeling parameters destructor.
+
+  return pModelingParams;
+}
+
+const G4Polyhedron* G4VSceneHandler::CreateSectionPolyhedron()
+{
+  /* Disable for now.  Boolean processor not up to it.
+  const G4ViewParameters& vp = fpViewer->GetViewParameters();
+  if (vp.IsSection () ) {
+    G4double radius = fpScene->GetExtent().GetExtentRadius();
+    G4double safe = radius + fpScene->GetExtent().GetExtentCentre().mag();
+    G4Box sectionBox("clipper",
+		     safe, safe, 1.e-5 * radius);  // Thin in z-plane.
+    G4Polyhedron* sectioner = sectionBox.CreatePolyhedron();
+    const G4Plane3D& s = vp.GetSectionPlane ();
+    G4double a = s.a();
+    G4double b = s.b();
+    G4double c = s.c();
+    G4double d = s.d();
+    G4Transform3D transform = G4TranslateZ3D(-d);
+    const G4Normal3D normal(a,b,c);
+    if (normal != G4Normal3D(0,0,1)) {
+      const G4double angle = std::acos(normal.dot(G4Normal3D(0,0,1)));
+      const G4Vector3D axis = G4Normal3D(0,0,1).cross(normal);
+      transform = G4Rotate3D(angle, axis) * transform;
+    }
+    sectioner->Transform(transform);
+    return sectioner;
+  } else {
+    return 0;
+  }
+  */
+  return 0;
+}
+
+const G4Polyhedron* G4VSceneHandler::CreateCutawayPolyhedron()
+{
+  return 0;
+}
+
+void G4VSceneHandler::LoadAtts(const G4Visible& visible, G4AttHolder* holder)
+{
+  // Load G4Atts from G4VisAttributes, if any...
+  const G4VisAttributes* va = visible.GetVisAttributes();
+  if (va) {
+    const std::map<G4String,G4AttDef>* vaDefs =
+      va->GetAttDefs();
+    if (vaDefs) {
+      holder->AddAtts(visible.GetVisAttributes()->CreateAttValues(), vaDefs);
+    }
+  }
+
+  G4PhysicalVolumeModel* pPVModel =
+    dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
+  if (pPVModel) {
+    // Load G4Atts from G4PhysicalVolumeModel...
+    const std::map<G4String,G4AttDef>* defs = pPVModel->GetAttDefs();
+    if (defs) {
+      holder->AddAtts(pPVModel->CreateCurrentAttValues(), defs);
+    }
+  }
+
+  G4TrajectoriesModel* trajModel = dynamic_cast<G4TrajectoriesModel*>(fpModel);
+  if (trajModel) {
+    // Load G4Atts from trajectory...
+    const G4VTrajectory* traj = trajModel->GetCurrentTrajectory();
+    const std::map<G4String,G4AttDef>* defs = traj->GetAttDefs();
+    if (defs) {
+      holder->AddAtts(traj->CreateAttValues(), defs);
+    }
+    G4int nPoints = traj->GetPointEntries();
+    for (G4int i = 0; i < nPoints; ++i) {
+      G4VTrajectoryPoint* trajPoint = traj->GetPoint(i);
+      const std::map<G4String,G4AttDef>* defs = trajPoint->GetAttDefs();
+      if (defs) {
+	holder->AddAtts(trajPoint->CreateAttValues(), defs);
+      }
+    }
+  }
+
+  G4HitsModel* hitsModel = dynamic_cast<G4HitsModel*>(fpModel);
+  if (hitsModel) {
+    // Load G4Atts from hit...
+    const G4VHit* hit = hitsModel->GetCurrentHit();
+    const std::map<G4String,G4AttDef>* defs = hit->GetAttDefs();
+    if (defs) {
+      holder->AddAtts(hit->CreateAttValues(), defs);
+    }
+  }
+}
+
+const G4Colour& G4VSceneHandler::GetColour (const G4Visible& visible) {
+  // Colour is determined by the applicable vis attributes.
+  const G4Colour& colour = fpViewer ->
+    GetApplicableVisAttributes (visible.GetVisAttributes ()) -> GetColour ();
+  return colour;
+}
+
+const G4Colour& G4VSceneHandler::GetTextColour (const G4Text& text) {
+  const G4VisAttributes* pVA = text.GetVisAttributes ();
+  if (!pVA) {
+    pVA = fpViewer -> GetViewParameters (). GetDefaultTextVisAttributes ();
+  }
+  const G4Colour& colour = pVA -> GetColour ();
+  return colour;
+}
+
+G4double G4VSceneHandler::GetLineWidth(const G4VisAttributes* pVisAttribs)
+{
+  G4double lineWidth = pVisAttribs->GetLineWidth();
+  if (lineWidth < 1.) lineWidth = 1.;
+  lineWidth *= fpViewer -> GetViewParameters().GetGlobalLineWidthScale();
+  if (lineWidth < 1.) lineWidth = 1.;
+  return lineWidth;
+}
+
+G4ViewParameters::DrawingStyle G4VSceneHandler::GetDrawingStyle
+(const G4VisAttributes* pVisAttribs) {
+  // Drawing style is normally determined by the view parameters, but
+  // it can be overriddden by the ForceDrawingStyle flag in the vis
+  // attributes.
+  G4ViewParameters::DrawingStyle style = 
+    fpViewer->GetViewParameters().GetDrawingStyle();
+  if (pVisAttribs -> IsForceDrawingStyle ()) {
+    G4VisAttributes::ForcedDrawingStyle forcedStyle =
+      pVisAttribs -> GetForcedDrawingStyle ();
+    // This is complicated because if hidden line and surface removal
+    // has been requested we wish to preserve this sometimes.
+    switch (forcedStyle) {
+    case (G4VisAttributes::solid):
+      switch (style) {
+      case (G4ViewParameters::hlr):
+	style = G4ViewParameters::hlhsr;
+	break;
+      case (G4ViewParameters::wireframe):
+	style = G4ViewParameters::hsr;
+	break;
+      case (G4ViewParameters::hlhsr):
+      case (G4ViewParameters::hsr):
+      default:
+	break;
+      }	
+      break;
+    case (G4VisAttributes::wireframe):
+    default:
+      // But if forced style is wireframe, do it, because one of its
+      // main uses is in displaying the consituent solids of a Boolean
+      // solid and their surfaces overlap with the resulting Booean
+      // solid, making a mess if hlr is specified.
+      style = G4ViewParameters::wireframe;
+      break;
+    }
+  }
+  return style;
+}
+
+G4bool G4VSceneHandler::GetAuxEdgeVisible (const G4VisAttributes* pVisAttribs) {
+  G4bool isAuxEdgeVisible = fpViewer->GetViewParameters().IsAuxEdgeVisible ();
+  if (pVisAttribs -> IsForceAuxEdgeVisible()) isAuxEdgeVisible = true;
+  return isAuxEdgeVisible;
+}
+
+G4double G4VSceneHandler::GetMarkerSize
+(const G4VMarker& marker, 
+ G4VSceneHandler::MarkerSizeType& markerSizeType)
+{
+  G4bool userSpecified = marker.GetWorldSize() || marker.GetScreenSize();
+  const G4VMarker& defaultMarker =
+    fpViewer -> GetViewParameters().GetDefaultMarker();
+  G4double size = userSpecified ?
+    marker.GetWorldSize() : defaultMarker.GetWorldSize();
+  if (size) {
+    // Draw in world coordinates.
+    markerSizeType = world;
+  }
+  else {
+    size = userSpecified ?
+      marker.GetScreenSize() : defaultMarker.GetScreenSize();
+    // Draw in screen coordinates.
+    markerSizeType = screen;
+  }
+  if (size <= 1.) size = 1.;
+  size *= fpViewer -> GetViewParameters().GetGlobalMarkerScale();
+  if (size <= 1.) size = 1.;
+  return size;
+}
+
+G4int G4VSceneHandler::GetNoOfSides(const G4VisAttributes* pVisAttribs)
+{
+  // No. of sides (lines segments per circle) is normally determined
+  // by the view parameters, but it can be overriddden by the
+  // ForceLineSegmentsPerCircle in the vis attributes.
+  G4int lineSegmentsPerCircle = fpViewer->GetViewParameters().GetNoOfSides();
+  if (pVisAttribs) {
+    if (pVisAttribs->IsForceLineSegmentsPerCircle())
+      lineSegmentsPerCircle = pVisAttribs->GetForcedLineSegmentsPerCircle();
+    const G4int nSegmentsMin = 12;
+    if (lineSegmentsPerCircle < nSegmentsMin) {
+      lineSegmentsPerCircle = nSegmentsMin;
+      G4cout <<
+	"G4VSceneHandler::GetNoOfSides: attempt to set the"
+	"\nnumber of line segements per circle < " << nSegmentsMin
+	     << "; forced to " << lineSegmentsPerCircle << G4endl;
+    }
+  }
+  return lineSegmentsPerCircle;
+}
+
+std::ostream& operator << (std::ostream& os, const G4VSceneHandler& s) {
+
+  os << "Scene handler " << s.fName << " has "
+     << s.fViewerList.size () << " viewer(s):";
+  for (size_t i = 0; i < s.fViewerList.size (); i++) {
+    os << "\n  " << *(s.fViewerList [i]);
+  }
+
+  if (s.fpScene) {
+    os << "\n  " << *s.fpScene;
+  }
+  else {
+    os << "\n  This scene handler currently has no scene.";
+  }
+
+  return os;
+}
Index: tags/visualization-10.5-before-10.6_test/management/src/G4VViewer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/src/G4VViewer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/src/G4VViewer.cc	(revision 1102)
@@ -0,0 +1,141 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VViewer.cc,v 1.25 2009/01/13 09:55:15 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  27th March 1996
+// Abstract interface class for graphics views.
+
+#include "G4VViewer.hh"
+
+#include "G4ios.hh"
+#include <sstream>
+
+#include "G4VisManager.hh"
+#include "G4VGraphicsSystem.hh"
+#include "G4VSceneHandler.hh"
+#include "G4Scene.hh"
+#include "G4VPhysicalVolume.hh"
+#include "G4Transform3D.hh"
+
+G4VViewer::G4VViewer (G4VSceneHandler& sceneHandler,
+		      G4int id, const G4String& name):
+fSceneHandler (sceneHandler),
+fViewId (id),
+//fModified (true),
+fNeedKernelVisit (true)
+{
+  if (name == "") {
+    std::ostringstream ost;
+    ost << fSceneHandler.GetName () << '-' << fViewId;
+    fName = ost.str();
+  }
+  else {
+    fName = name;
+  }
+  fShortName = fName (0, fName.find (' '));
+  fShortName.strip ();
+}
+
+G4VViewer::~G4VViewer () {}
+
+void G4VViewer::SetName (const G4String& name) {
+  fName = name;
+  fShortName = fName (0, fName.find (' '));
+  fShortName.strip ();
+}
+
+const G4VisAttributes* G4VViewer::GetApplicableVisAttributes
+(const G4VisAttributes* pVisAttribs) const {
+  // If pVisAttribs is zero, pick up the default vis attributes from
+  // the view parameters.
+  if (!pVisAttribs)
+    pVisAttribs = GetViewParameters ().GetDefaultVisAttributes ();
+  return pVisAttribs;
+}
+
+void G4VViewer::NeedKernelVisit () {
+
+  fNeedKernelVisit = true;
+
+  // At one time I thought we'd better notify all viewers.  But I guess
+  // each viewer can take care of itself, so the following code is
+  // redundant (but keep it commented out for now).   (John Allison)
+  // Notify all viewers that a kernel visit is required.
+  // const G4ViewerList& viewerList = fSceneHandler.GetViewerList ();
+  // G4ViewerListConstIterator i;
+  // for (i = viewerList.begin(); i != viewerList.end(); i++) {
+  //   (*i) -> SetNeedKernelVisit ();
+  // }
+  // ??...but, there's a problem in OpenGL Stored which seems to
+  // require *all* viewers to revisit the kernel, so...
+  /*
+  const G4ViewerList& viewerList = fSceneHandler.GetViewerList ();
+  G4ViewerListConstIterator i;
+  for (i = viewerList.begin(); i != viewerList.end(); i++) {
+    (*i) -> SetNeedKernelVisit (true);
+  }
+  */
+  // Feb 2005 - commented out.  Let's fix OpenGL if necessary.
+}
+
+void G4VViewer::FinishView () {}
+
+void G4VViewer::ShowView () {}
+
+void G4VViewer::ProcessView ()
+{
+#ifdef G4DEBUG_VIS_MANAGEMENT
+  printf("G4VViewer::ProcessView\n");
+#endif
+
+  // If ClearStore has been requested, e.g., if the scene has changed,
+  // or if the concrete viewer has decided that it necessary to visit
+  // the kernel, perhaps because the view parameters have changed
+  // significantly (this should be done in the concrete viewer's
+  // DrawView)...
+  if (fNeedKernelVisit) {
+#ifdef G4DEBUG_VIS_MANAGEMENT
+    printf("G4VViewer::ProcessView : NeedKernelVisit\n");
+#endif
+    // Reset flag.  This must be done before ProcessScene to prevent
+    // recursive calls when recomputing transients...
+    fNeedKernelVisit = false;
+    fSceneHandler.ProcessScene (*this);
+  }
+}
+
+void G4VViewer::SetViewParameters (const G4ViewParameters& vp) {
+  fVP = vp;
+}
+
+std::ostream& operator << (std::ostream& os, const G4VViewer& v) {
+  os << "View " << v.fName << ":\n";
+  os << v.fVP;
+  return os;
+}
Index: tags/visualization-10.5-before-10.6_test/management/src/G4VVisCommand.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/src/G4VVisCommand.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/src/G4VVisCommand.cc	(revision 1102)
@@ -0,0 +1,108 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VVisCommand.cc,v 1.18 2006/06/29 21:29:28 gunter Exp $
+// GEANT4 tag $Name:  $
+
+// Base class for visualization commands - John Allison  9th August 1998
+// It is really a messenger - we have one command per messenger.
+
+#include "G4VVisCommand.hh"
+
+#include "G4UIcommand.hh"
+#include "G4UImanager.hh"
+#include "G4UnitsTable.hh"
+#include <sstream>
+
+G4VVisCommand::~G4VVisCommand () {}
+
+G4VisManager* G4VVisCommand::fpVisManager = 0;
+
+G4String G4VVisCommand::ConvertToString
+(G4double x, G4double y, const char * unitName)
+{
+  G4double uv = G4UIcommand::ValueOf(unitName);
+  
+  std::ostringstream oss;
+  oss << x/uv << " " << y/uv << " " << unitName;
+  return oss.str();
+}
+
+void G4VVisCommand::ConvertToDoublePair(const G4String& paramString,
+					G4double& xval,
+					G4double& yval)
+{
+  G4double x, y;
+  char unts[30];
+  
+  std::istringstream is(paramString);
+  is >> x >> y >> unts;
+  G4String unt = unts;
+
+  xval = x*G4UIcommand::ValueOf(unt);
+  yval = y*G4UIcommand::ValueOf(unt);
+
+  return;
+}
+
+void G4VVisCommand::UpdateVisManagerScene
+(const G4String& sceneName) {
+
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+
+  const G4SceneList& sceneList = fpVisManager -> GetSceneList ();
+
+  G4int iScene, nScenes = sceneList.size ();
+  for (iScene = 0; iScene < nScenes; iScene++) {
+    if (sceneList [iScene] -> GetName () == sceneName) break;
+  }
+
+  G4Scene* pScene = 0;  // Zero unless scene has been found...
+  if (iScene < nScenes) {
+    pScene = sceneList [iScene];
+  }
+
+  if (!pScene) {
+    if (verbosity >= G4VisManager::warnings) {
+      G4cout << "WARNING: Scene \"" << sceneName << "\" not found."
+	     << G4endl;
+    }
+    return;
+  }
+
+  fpVisManager -> SetCurrentScene (pScene);
+
+  // Scene has changed.  Refresh viewers of all sceneHandlers using
+  // this scene...
+  G4VViewer* pViewer = fpVisManager -> GetCurrentViewer();
+  G4VSceneHandler* sceneHandler = fpVisManager -> GetCurrentSceneHandler();
+  if (sceneHandler && sceneHandler -> GetScene ()) {
+    if (pViewer) {
+      G4UImanager::GetUIpointer () ->
+	ApplyCommand ("/vis/scene/notifyHandlers");
+    }
+  }
+}
Index: tags/visualization-10.5-before-10.6_test/management/src/G4ViewParameters.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/src/G4ViewParameters.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/src/G4ViewParameters.cc	(revision 1102)
@@ -0,0 +1,762 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4ViewParameters.cc,v 1.36 2009/01/21 17:05:12 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  19th July 1996
+// View parameters and options.
+
+#include "G4ViewParameters.hh"
+
+#include "G4VisManager.hh"
+#include "G4UnitsTable.hh"
+#include "G4ios.hh"
+
+G4ViewParameters::G4ViewParameters ():
+  fNoValue(0x0000),
+  fXValue(0x0001),
+  fYValue(0x0002),
+  fWidthValue(0x0004),
+  fHeightValue(0x0008),
+  fAllValues(0x000F),
+  fXNegative(0x0010),
+  fYNegative(0x0020),
+  fDrawingStyle (wireframe),
+  fAuxEdgeVisible (false),
+  fRepStyle (polyhedron),
+  fCulling (true),
+  fCullInvisible (true),
+  fDensityCulling (false),
+  fVisibleDensity (0.01 * g / cm3),
+  fCullCovered (false),
+  fSection (false),
+  fSectionPlane (),
+  fCutawayMode (cutawayUnion),
+  fCutawayPlanes (),
+  fExplodeFactor (1.),
+  fNoOfSides (24),
+  fViewpointDirection (G4Vector3D (0., 0., 1.)),  // On z-axis.
+  fUpVector (G4Vector3D (0., 1., 0.)),            // y-axis up.
+  fFieldHalfAngle (0.),                           // Orthogonal projection.
+  fZoomFactor (1.),
+  fScaleFactor (G4Vector3D (1., 1., 1.)),
+  fCurrentTargetPoint (),
+  fDolly (0.),
+  fLightsMoveWithCamera (false),
+  fRelativeLightpointDirection (G4Vector3D (1., 1., 1.)),
+  fActualLightpointDirection (G4Vector3D (1., 1., 1.)),
+  fDefaultVisAttributes (),
+  fDefaultTextVisAttributes (G4Colour (0., 0., 1.)),
+  fDefaultMarker (),
+  fGlobalMarkerScale (1.),
+  fGlobalLineWidthScale (1.),
+  fMarkerNotHidden (true),
+  fWindowSizeHintX (600),
+  fWindowSizeHintY (600),
+  fWindowLocationHintX(0),
+  fWindowLocationHintY(0),
+  fWindowLocationHintXNegative(true),
+  fWindowLocationHintYNegative(false),
+  fXGeometryString("600x600-0+0"),
+  fAutoRefresh (false),
+  fBackgroundColour (G4Colour(0.,0.,0.)),         // Black
+  fPicking (false)
+{
+  fDefaultMarker.SetScreenSize (5.);
+  // Markers are 5 pixels "overall" size, i.e., diameter.
+}
+
+G4ViewParameters::~G4ViewParameters () {}
+
+void G4ViewParameters::MultiplyScaleFactor
+(const G4Vector3D& scaleFactorMultiplier) {
+  fScaleFactor.setX(fScaleFactor.x() * scaleFactorMultiplier.x());
+  fScaleFactor.setY(fScaleFactor.y() * scaleFactorMultiplier.y());
+  fScaleFactor.setZ(fScaleFactor.z() * scaleFactorMultiplier.z());
+}
+
+G4Vector3D& G4ViewParameters::GetActualLightpointDirection () {
+  SetViewAndLights (fViewpointDirection);
+  return fActualLightpointDirection;
+}
+
+// Useful quantities - begin snippet.
+// Here Follow functions to evaluate the above algorithms as a
+// function of the radius of the Bounding Sphere of the object being
+// viewed.  Call them in the order given - for efficiency, later
+// functions depend on the results of earlier ones (Store the
+// results of earlier functions in your own temporary variables -
+// see, for example, G4OpenGLView::SetView ().)
+
+G4double G4ViewParameters::GetCameraDistance (G4double radius) const {
+  G4double cameraDistance;
+  if (fFieldHalfAngle == 0.) {
+    cameraDistance = radius;
+  }
+  else {
+    cameraDistance = radius / std::sin (fFieldHalfAngle) - fDolly;
+  }
+  return cameraDistance;
+}
+
+G4double G4ViewParameters::GetNearDistance (G4double cameraDistance,
+					    G4double radius) const {
+  const G4double small = 1.e-6 * radius;
+  G4double nearDistance = cameraDistance - radius;
+  if (nearDistance < small) nearDistance = small;
+  return nearDistance;
+}
+
+G4double G4ViewParameters::GetFarDistance (G4double cameraDistance,
+					   G4double nearDistance,
+					   G4double radius) const {
+  G4double farDistance = cameraDistance + radius;
+  if (farDistance < nearDistance) farDistance = nearDistance;
+  return farDistance;
+}
+
+G4double G4ViewParameters::GetFrontHalfHeight (G4double nearDistance,
+					       G4double radius) const {
+  G4double frontHalfHeight;
+  if (fFieldHalfAngle == 0.) {
+    frontHalfHeight = radius / fZoomFactor;
+  }
+  else {
+    frontHalfHeight = nearDistance * std::tan (fFieldHalfAngle) / fZoomFactor;
+  }
+  return frontHalfHeight;
+}
+// Useful quantities - end snippet.
+
+void G4ViewParameters::AddCutawayPlane (const G4Plane3D& cutawayPlane) {
+  if (fCutawayPlanes.size () < 3 ) {
+    fCutawayPlanes.push_back (cutawayPlane);
+  }
+  else {
+    G4cout <<
+      "ERROR: G4ViewParameters::AddCutawayPlane:"
+      "\n  A maximum of 3 cutaway planes supported." << G4endl;
+  }
+}
+
+void G4ViewParameters::ChangeCutawayPlane
+(size_t index, const G4Plane3D& cutawayPlane) {
+  if (index >= fCutawayPlanes.size()) {
+    G4cout <<
+      "ERROR: G4ViewParameters::ChangeCutawayPlane:"
+      "\n  Plane " << index << " does not exist." << G4endl;
+  } else {
+    fCutawayPlanes[index] = cutawayPlane;
+  }
+}
+
+void G4ViewParameters::SetVisibleDensity (G4double visibleDensity) {
+  const G4double reasonableMaximum = 10.0 * g / cm3;
+  if (visibleDensity < 0) {
+    G4cout << "G4ViewParameters::SetVisibleDensity: attempt to set negative "
+      "density - ignored." << G4endl;
+  }
+  else {
+    if (visibleDensity > reasonableMaximum) {
+      G4cout << "G4ViewParameters::SetVisibleDensity: density > "
+	     << G4BestUnit (reasonableMaximum, "Volumic Mass")
+	     << " - did you mean this?"
+	     << G4endl;
+    }
+    fVisibleDensity = visibleDensity;
+  }
+}
+
+G4int G4ViewParameters::SetNoOfSides (G4int nSides) {
+  const G4int  nSidesMin = 12;
+  if (nSides < nSidesMin) {
+    nSides = nSidesMin;
+    G4cout << "G4ViewParameters::SetNoOfSides: attempt to set the"
+      "\nnumber of sides per circle < " << nSidesMin
+	 << "; forced to " << nSides << G4endl;
+  }
+  fNoOfSides = nSides;
+  return fNoOfSides;
+}
+
+void G4ViewParameters::SetViewAndLights
+(const G4Vector3D& viewpointDirection) {
+
+  fViewpointDirection = viewpointDirection;
+
+  // If the requested viewpoint direction is parallel to the up
+  // vector, the orientation of the view is undefined...
+  if (fViewpointDirection.unit() * fUpVector.unit() > .9999) {
+    G4cout <<
+      "WARNING: Viewpoint direction is very close to the up vector direction."
+      "\n  Consider setting the up vector to obtain definable behaviour."
+	   << G4endl;
+  }
+
+  // Move the lights too if requested...
+  if (fLightsMoveWithCamera) {
+    G4Vector3D zprime = fViewpointDirection.unit ();
+    G4Vector3D xprime = (fUpVector.cross (zprime)).unit ();
+    G4Vector3D yprime = zprime.cross (xprime);
+    fActualLightpointDirection =
+      fRelativeLightpointDirection.x () * xprime +
+      fRelativeLightpointDirection.y () * yprime +
+      fRelativeLightpointDirection.x () * zprime;     
+  } else {
+    fActualLightpointDirection = fRelativeLightpointDirection;
+  }
+}
+
+void G4ViewParameters::SetLightpointDirection
+(const G4Vector3D& lightpointDirection) {
+  fRelativeLightpointDirection = lightpointDirection;
+  SetViewAndLights (fViewpointDirection);
+}
+
+void G4ViewParameters::SetPan (G4double right, G4double up) {
+  G4Vector3D unitRight = (fUpVector.cross (fViewpointDirection)).unit();
+  G4Vector3D unitUp    = (fViewpointDirection.cross (unitRight)).unit();
+  fCurrentTargetPoint  = right * unitRight + up * unitUp;
+}
+
+void G4ViewParameters::IncrementPan (G4double right, G4double up) {
+  IncrementPan (right,up, 0);
+}
+
+void G4ViewParameters::IncrementPan (G4double right, G4double up, G4double distance) {
+  G4Vector3D unitRight = (fUpVector.cross (fViewpointDirection)).unit();
+  G4Vector3D unitUp    = (fViewpointDirection.cross (unitRight)).unit();
+  fCurrentTargetPoint += right * unitRight + up * unitUp + distance * fViewpointDirection;
+}
+
+void G4ViewParameters::PrintDifferences (const G4ViewParameters& v) const {
+
+  // Put performance-sensitive parameters first.
+  if (
+      // This first to optimise spin, etc.
+      (fViewpointDirection   != v.fViewpointDirection)   ||
+
+      // No particular order from here on.
+      (fDrawingStyle         != v.fDrawingStyle)         ||
+      (fAuxEdgeVisible       != v.fAuxEdgeVisible)       ||
+      (fRepStyle             != v.fRepStyle)             ||
+      (fCulling              != v.fCulling)              ||
+      (fCullInvisible        != v.fCullInvisible)        ||
+      (fDensityCulling       != v.fDensityCulling)       ||
+      (fVisibleDensity       != v.fVisibleDensity)       ||
+      (fCullCovered          != v.fCullCovered)          ||
+      (fSection              != v.fSection)              ||
+      (fNoOfSides            != v.fNoOfSides)            ||
+      (fUpVector             != v.fUpVector)             ||
+      (fFieldHalfAngle       != v.fFieldHalfAngle)       ||
+      (fZoomFactor           != v.fZoomFactor)           ||
+      (fScaleFactor          != v.fScaleFactor)          ||
+      (fCurrentTargetPoint   != v.fCurrentTargetPoint)   ||
+      (fDolly                != v.fDolly)                ||
+      (fRelativeLightpointDirection != v.fRelativeLightpointDirection)  ||
+      (fLightsMoveWithCamera != v.fLightsMoveWithCamera) ||
+      (fDefaultVisAttributes != v.fDefaultVisAttributes) ||
+      (fDefaultTextVisAttributes != v.fDefaultTextVisAttributes) ||
+      (fDefaultMarker        != v.fDefaultMarker)        ||
+      (fGlobalMarkerScale    != v.fGlobalMarkerScale)    ||
+      (fGlobalLineWidthScale != v.fGlobalLineWidthScale) ||
+      (fMarkerNotHidden      != v.fMarkerNotHidden)      ||
+      (fWindowSizeHintX      != v.fWindowSizeHintX)      ||
+      (fWindowSizeHintY      != v.fWindowSizeHintY)      ||
+      (fXGeometryString      != v.fXGeometryString)      ||
+      (fAutoRefresh          != v.fAutoRefresh)          ||
+      (fBackgroundColour     != v.fBackgroundColour)     || 
+      (fPicking              != v.fPicking)
+      )
+    G4cout << "Difference in 1st batch." << G4endl;
+
+  if (fSection) {
+    if (!(fSectionPlane == v.fSectionPlane))
+      G4cout << "Difference in section planes batch." << G4endl;
+  }
+
+  if (IsCutaway()) {
+    if (fCutawayPlanes.size () != v.fCutawayPlanes.size ()) {
+      G4cout << "Difference in no of cutaway planes." << G4endl;
+    }
+    else {
+      for (size_t i = 0; i < fCutawayPlanes.size (); i++) {
+	if (!(fCutawayPlanes[i] == v.fCutawayPlanes[i]))
+	  G4cout << "Difference in cutaway plane no. " << i << G4endl;
+      }
+    }
+  }
+
+  if (IsExplode()) {
+    if (fExplodeFactor != v.fExplodeFactor)
+      G4cout << "Difference in explode factor." << G4endl;
+    if (fExplodeCentre != v.fExplodeCentre)
+      G4cout << "Difference in explode centre." << G4endl;
+  }
+}
+
+std::ostream& operator << (std::ostream& os,
+			     const G4ViewParameters::DrawingStyle& style) {
+  switch (style) {
+  case G4ViewParameters::wireframe:
+    os << "wireframe"; break;
+  case G4ViewParameters::hlr:
+    os << "hlr - hidden lines removed"; break;
+  case G4ViewParameters::hsr:
+    os << "hsr - hidden surfaces removed"; break;
+  case G4ViewParameters::hlhsr:
+    os << "hlhsr - hidden line, hidden surface removed"; break;
+  default: os << "unrecognised"; break;
+  }
+  return os;
+}
+
+std::ostream& operator << (std::ostream& os, const G4ViewParameters& v) {
+  os << "View parameters and options:";
+
+  os << "\n  Drawing style: " << v.fDrawingStyle;
+
+  os << "\n  Auxiliary edges: ";
+  if (!v.fAuxEdgeVisible) os << "in";
+  os << "visible";
+
+  os << "\n  Representation style: ";
+  switch (v.fRepStyle) {
+  case G4ViewParameters::polyhedron:
+    os << "polyhedron"; break;
+  case G4ViewParameters::nurbs:
+    os << "nurbs"; break;
+  default: os << "unrecognised"; break;
+  }
+
+  os << "\n  Culling: ";
+  if (v.fCulling) os << "on";
+  else            os << "off";
+
+  os << "\n  Culling invisible objects: ";
+  if (v.fCullInvisible) os << "on";
+  else                  os << "off";
+
+  os << "\n  Density culling: ";
+  if (v.fDensityCulling) {
+    os << "on - invisible if density less than "
+       << v.fVisibleDensity / (1. * g / cm3) << " g cm^-3";
+  }
+  else os << "off";
+
+  os << "\n  Culling daughters covered by opaque mothers: ";
+  if (v.fCullCovered) os << "on";
+  else                os << "off";
+
+  os << "\n  Section flag: ";
+  if (v.fSection) os << "true, section/cut plane: " << v.fSectionPlane;
+  else            os << "false";
+
+  if (v.IsCutaway()) {
+    os << "\n  Cutaway planes: ";
+    for (size_t i = 0; i < v.fCutawayPlanes.size (); i++) {
+      os << ' ' << v.fCutawayPlanes[i];
+    }
+  }
+  else {
+    os << "\n  No cutaway planes";
+  }
+
+  os << "\n  Explode factor: " << v.fExplodeFactor
+     << " about centre: " << v.fExplodeCentre;
+
+  os << "\n  No. of sides used in circle polygon approximation: "
+     << v.fNoOfSides;
+
+  os << "\n  Viewpoint direction:  " << v.fViewpointDirection;
+
+  os << "\n  Up vector:            " << v.fUpVector;
+
+  os << "\n  Field half angle:     " << v.fFieldHalfAngle;
+
+  os << "\n  Zoom factor:          " << v.fZoomFactor;
+
+  os << "\n  Scale factor:         " << v.fScaleFactor;
+
+  os << "\n  Current target point: " << v.fCurrentTargetPoint;
+
+  os << "\n  Dolly distance:       " << v.fDolly;
+
+  os << "\n  Light ";
+  if (v.fLightsMoveWithCamera) os << "moves";
+  else                         os << "does not move";
+  os << " with camera";
+
+  os << "\n  Relative lightpoint direction: "
+     << v.fRelativeLightpointDirection;
+
+  os << "\n  Actual lightpoint direction: "
+     << v.fActualLightpointDirection;
+
+  os << "\n  Derived parameters for standard view of object of unit radius:";
+  G4ViewParameters tempVP = v;
+  tempVP.fDolly = 0.;
+  tempVP.fZoomFactor = 1.;
+  const G4double radius = 1.;
+  const G4double cameraDistance = tempVP.GetCameraDistance (radius);
+  const G4double nearDistance =
+    tempVP.GetNearDistance (cameraDistance, radius);
+  const G4double farDistance =
+    tempVP.GetFarDistance  (cameraDistance, nearDistance, radius);
+  const G4double right  = tempVP.GetFrontHalfHeight (nearDistance, radius);
+  os << "\n    Camera distance:   " << cameraDistance;
+  os << "\n    Near distance:     " << nearDistance;
+  os << "\n    Far distance:      " << farDistance;
+  os << "\n    Front half height: " << right;
+
+  os << "\n  Default VisAttributes:\n  " << v.fDefaultVisAttributes;
+
+  os << "\n  Default TextVisAttributes:\n  " << v.fDefaultTextVisAttributes;
+
+  os << "\n  Default marker: " << v.fDefaultMarker;
+
+  os << "\n  Global marker scale: " << v.fGlobalMarkerScale;
+
+  os << "\n  Global lineWidth scale: " << v.fGlobalLineWidthScale;
+
+  os << "\n  Marker ";
+  if (v.fMarkerNotHidden) os << "not ";
+  os << "hidden by surfaces.";
+
+  os << "\n  Window size hint: "
+     << v.fWindowSizeHintX << 'x'<< v.fWindowSizeHintX;
+
+  os << "\n  X geometry string: " << v.fXGeometryString;
+
+  os << "\n  Auto refresh: ";
+  if (v.fAutoRefresh) os << "true";
+  else os << "false";
+
+  os << "\n  Background colour: " << v.fBackgroundColour;
+
+  os << "\n  Picking requested: ";
+  if (v.fPicking) os << "true";
+  else os << "false";
+
+  return os;
+}
+
+G4bool G4ViewParameters::operator != (const G4ViewParameters& v) const {
+
+  // Put performance-sensitive parameters first.
+  if (
+      // This first to optimise spin, etc.
+      (fViewpointDirection   != v.fViewpointDirection)   ||
+
+      // No particular order from here on.
+      (fDrawingStyle         != v.fDrawingStyle)         ||
+      (fAuxEdgeVisible       != v.fAuxEdgeVisible)       ||
+      (fRepStyle             != v.fRepStyle)             ||
+      (fCulling              != v.fCulling)              ||
+      (fCullInvisible        != v.fCullInvisible)        ||
+      (fDensityCulling       != v.fDensityCulling)       ||
+      (fCullCovered          != v.fCullCovered)          ||
+      (fSection              != v.fSection)              ||
+      (IsCutaway()           != v.IsCutaway())           ||
+      (IsExplode()           != v.IsExplode())           ||
+      (fNoOfSides            != v.fNoOfSides)            ||
+      (fUpVector             != v.fUpVector)             ||
+      (fFieldHalfAngle       != v.fFieldHalfAngle)       ||
+      (fZoomFactor           != v.fZoomFactor)           ||
+      (fScaleFactor          != v.fScaleFactor)          ||
+      (fCurrentTargetPoint   != v.fCurrentTargetPoint)   ||
+      (fDolly                != v.fDolly)                ||
+      (fRelativeLightpointDirection != v.fRelativeLightpointDirection)  ||
+      (fLightsMoveWithCamera != v.fLightsMoveWithCamera) ||
+      (fDefaultVisAttributes != v.fDefaultVisAttributes) ||
+      (fDefaultTextVisAttributes != v.fDefaultTextVisAttributes) ||
+      (fDefaultMarker        != v.fDefaultMarker)        ||
+      (fGlobalMarkerScale    != v.fGlobalMarkerScale)    ||
+      (fGlobalLineWidthScale != v.fGlobalLineWidthScale) ||
+      (fMarkerNotHidden      != v.fMarkerNotHidden)      ||
+      (fWindowSizeHintX      != v.fWindowSizeHintX)      ||
+      (fWindowSizeHintY      != v.fWindowSizeHintY)      ||
+      (fXGeometryString      != v.fXGeometryString)      ||
+      (fAutoRefresh          != v.fAutoRefresh)          ||
+      (fBackgroundColour     != v.fBackgroundColour)     ||
+      (fPicking              != v.fPicking)
+      )
+    return true;
+
+  if (fDensityCulling &&
+      (fVisibleDensity != v.fVisibleDensity)) return true;
+
+  if (fSection &&
+      (!(fSectionPlane == v.fSectionPlane))) return true;
+
+  if (IsCutaway()) {
+    if (fCutawayPlanes.size () != v.fCutawayPlanes.size ())
+      return true;
+    else {
+      for (size_t i = 0; i < fCutawayPlanes.size (); i++) {
+	if (!(fCutawayPlanes[i] == v.fCutawayPlanes[i])) return true;
+      }
+    }
+  }
+
+  if (IsExplode() &&
+      ((fExplodeFactor != v.fExplodeFactor) ||
+       (fExplodeCentre != v.fExplodeCentre))) return true;
+
+  return false;
+}
+
+
+void G4ViewParameters::SetXGeometryString (const G4String& geomStringArg) {
+
+
+  G4int x,y = 0;
+  unsigned int w,h = 0;
+  G4String geomString = geomStringArg;
+  // Parse windowSizeHintString for backwards compatibility...
+  const G4String delimiters("xX+-");
+  G4String::size_type i = geomString.find_first_of(delimiters);
+  if (i == G4String::npos) {  // Does not contain "xX+-".  Assume single number
+    std::istringstream iss(geomString);
+    G4int size;
+    iss >> size;
+    if (!iss) {
+      size = 600;
+      G4cout << "Unrecognised windowSizeHint string: \""
+	     << geomString
+	     << "\".  Asuuming " << size << G4endl;
+    }
+    std::ostringstream oss;
+    oss << size << 'x' << size;
+    geomString = oss.str();
+  }
+ 
+  fGeometryMask = ParseGeometry( geomString, &x, &y, &w, &h );
+
+  // Handle special case :
+  if ((fGeometryMask & fYValue) == 0)
+    {  // Using default
+      y =  fWindowLocationHintY;
+    }
+  if ((fGeometryMask & fXValue) == 0)
+    {  // Using default
+      x =  fWindowLocationHintX;
+    }
+
+  // Check errors
+  // if there is no Width and Height
+  if ( ((fGeometryMask & fHeightValue) == 0 ) &&
+       ((fGeometryMask & fWidthValue)  == 0 )) {
+    h = fWindowSizeHintY;
+    w = fWindowSizeHintX;
+  } else  if ((fGeometryMask & fHeightValue) == 0 ) {
+
+    // if there is only Width. Special case to be backward compatible
+    // We set Width and Height the same to obtain a square windows.
+    
+    G4cout << "Unrecognised geometry string \""
+           << geomString
+           << "\".  No Height found. Using Width value instead"
+           << G4endl;
+    h = w;
+  }
+  if ( ((fGeometryMask & fXValue) == 0 ) ||
+       ((fGeometryMask & fYValue)  == 0 )) {
+    //Using defaults
+    x = fWindowLocationHintX;
+    y = fWindowLocationHintY;
+  }
+  // Set the string
+  fXGeometryString = geomString;
+  
+  // Set values
+  fWindowSizeHintX = w;
+  fWindowSizeHintY = h;
+  fWindowLocationHintX = x;
+  fWindowLocationHintY = y;
+
+  if ( ((fGeometryMask & fXValue)) &&
+       ((fGeometryMask & fYValue))) {
+
+    if ( (fGeometryMask & fXNegative) ) {
+      fWindowLocationHintXNegative = true;
+    } else {
+      fWindowLocationHintXNegative = false;
+    }
+    if ( (fGeometryMask & fYNegative) ) {
+    fWindowLocationHintYNegative = true;
+    } else {
+      fWindowLocationHintYNegative = false;
+    }
+  }
+}
+
+G4int G4ViewParameters::GetWindowAbsoluteLocationHintX (G4int sizeX ) const {
+  if ( fWindowLocationHintXNegative ) {
+    return  sizeX  + fWindowLocationHintX - fWindowSizeHintX;
+  }
+  return fWindowLocationHintX;
+}
+
+G4int G4ViewParameters::GetWindowAbsoluteLocationHintY (G4int sizeY ) const {
+  if (  fWindowLocationHintYNegative ) {
+    return  sizeY  + fWindowLocationHintY - fWindowSizeHintY;
+  }
+  return fWindowLocationHintY;
+}
+
+/* Keep from :
+ * ftp://ftp.trolltech.com/qt/source/qt-embedded-free-3.0.6.tar.gz/qt-embedded-free-3.0.6/src/kernel/qapplication_qws.cpp
+ *
+ *    ParseGeometry parses strings of the form
+ *   "=<width>x<height>{+-}<xoffset>{+-}<yoffset>", where
+ *   width, height, xoffset, and yoffset are unsigned integers.
+ *   Example:  "=80x24+300-49"
+ *   The equal sign is optional.
+ *   It returns a bitmask that indicates which of the four values
+ *   were actually found in the string. For each value found,
+ *   the corresponding argument is updated;  for each value
+ *   not found, the corresponding argument is left unchanged.
+ */
+
+int G4ViewParameters::ParseGeometry (
+ const char *string,
+ G4int *x,
+ G4int *y,
+ unsigned int *width,
+ unsigned int *height)
+{
+
+  G4int mask = fNoValue;
+  register char *strind;
+  unsigned int tempWidth  = 0;
+  unsigned int tempHeight = 0;
+  G4int tempX = 0;
+  G4int tempY = 0;
+  char *nextCharacter;
+  if ( (string == NULL) || (*string == '\0')) {
+    return(mask);
+  }
+  if (*string == '=')
+    string++;  /* ignore possible '=' at beg of geometry spec */
+  strind = (char *)string;
+  if (*strind != '+' && *strind != '-' && *strind != 'x') {
+    tempWidth = ReadInteger(strind, &nextCharacter);
+    if (strind == nextCharacter)
+      return (0);
+    strind = nextCharacter;
+    mask |= fWidthValue;
+  }
+  if (*strind == 'x' || *strind == 'X') {
+    strind++;
+    tempHeight = ReadInteger(strind, &nextCharacter);
+    if (strind == nextCharacter)
+      return (0);
+    strind = nextCharacter;
+    mask |= fHeightValue;
+  }
+
+  if ((*strind == '+') || (*strind == '-')) {
+    if (*strind == '-') {
+      strind++;
+      tempX = -ReadInteger(strind, &nextCharacter);
+      if (strind == nextCharacter)
+        return (0);
+      strind = nextCharacter;
+      mask |= fXNegative;
+
+    }
+    else
+      {	strind++;
+        tempX = ReadInteger(strind, &nextCharacter);
+        if (strind == nextCharacter)
+          return(0);
+        strind = nextCharacter;
+      }
+    mask |= fXValue;
+    if ((*strind == '+') || (*strind == '-')) {
+      if (*strind == '-') {
+        strind++;
+        tempY = -ReadInteger(strind, &nextCharacter);
+        if (strind == nextCharacter)
+          return(0);
+        strind = nextCharacter;
+        mask |= fYNegative;
+      }
+      else
+        {
+          strind++;
+          tempY = ReadInteger(strind, &nextCharacter);
+          if (strind == nextCharacter)
+            return(0);
+          strind = nextCharacter;
+        }
+      mask |= fYValue;
+    }
+  }
+  /* If strind isn't at the end of the string the it's an invalid
+     geometry specification. */
+  if (*strind != '\0') return (0);
+  if (mask & fXValue)
+    *x = tempX;
+  if (mask & fYValue)
+    *y = tempY;
+  if (mask & fWidthValue)
+    *width = tempWidth;
+  if (mask & fHeightValue)
+    *height = tempHeight;
+  return (mask);
+}
+
+/* Keep from :
+ * ftp://ftp.trolltech.com/qt/source/qt-embedded-free-3.0.6.tar.gz/qt-embedded-free-3.0.6/src/kernel/qapplication_qws.cpp
+ *
+ */
+G4int G4ViewParameters::ReadInteger(char *string, char **NextString)
+{
+    register G4int Result = 0;
+    G4int Sign = 1;
+
+    if (*string == '+')
+	string++;
+    else if (*string == '-')
+    {
+	string++;
+	Sign = -1;
+    }
+    for (; (*string >= '0') && (*string <= '9'); string++)
+    {
+	Result = (Result * 10) + (*string - '0');
+    }
+    *NextString = string;
+    if (Sign >= 0)
+	return (Result);
+    else
+ 	return (-Result);
+}
+   
Index: tags/visualization-10.5-before-10.6_test/management/src/G4ViewerList.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/src/G4ViewerList.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/src/G4ViewerList.cc	(revision 1102)
@@ -0,0 +1,38 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4ViewerList.cc,v 1.4 2006/06/29 21:29:32 gunter Exp $
+// GEANT4 tag $Name:  $
+
+#include "G4ViewerList.hh"
+
+void G4ViewerList::remove(G4VViewer* viewer) {
+  G4ViewerListIterator iViewer;
+  for (iViewer = begin(); iViewer != end(); ++iViewer) {
+    if (*iViewer == viewer) break;
+  }
+  if (iViewer != end()) erase(iViewer);
+}
Index: tags/visualization-10.5-before-10.6_test/management/src/G4VisCommands.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/src/G4VisCommands.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/src/G4VisCommands.cc	(revision 1102)
@@ -0,0 +1,349 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VisCommands.cc,v 1.24 2009/03/09 12:42:00 allison Exp $
+// GEANT4 tag $Name:  $
+
+// /vis/ top level commands - John Allison  5th February 2001
+
+#include "G4VisCommands.hh"
+
+#include "G4VisManager.hh"
+#include "G4UImanager.hh"
+#include "G4UIcmdWithABool.hh"
+#include "G4UIcmdWithAString.hh"
+#include "G4UIcmdWithoutParameter.hh"
+#include "G4RunManager.hh"
+#include "G4Run.hh"
+#include "G4UIsession.hh"
+
+////////////// /vis/abortReviewKeptEvents /////////////////////////////
+
+G4VisCommandAbortReviewKeptEvents::G4VisCommandAbortReviewKeptEvents () {
+  G4bool omitable;
+
+  fpCommand = new G4UIcmdWithABool("/vis/abortReviewKeptEvents", this);
+  fpCommand -> SetGuidance("Abort review of kept events.");
+  fpCommand -> SetParameterName("abort", omitable=true);
+  fpCommand -> SetDefaultValue(true);
+}
+
+G4VisCommandAbortReviewKeptEvents::~G4VisCommandAbortReviewKeptEvents () {
+  delete fpCommand;
+}
+
+G4String G4VisCommandAbortReviewKeptEvents::GetCurrentValue (G4UIcommand*) {
+  return G4String();
+}
+
+void G4VisCommandAbortReviewKeptEvents::SetNewValue (G4UIcommand*,
+						     G4String newValue) {
+  fpVisManager->SetAbortReviewKeptEvents(G4UIcommand::ConvertToBool(newValue));
+  G4cout << "Type \"continue\" to complete the abort." << G4endl;
+}
+
+////////////// /vis/enable ///////////////////////////////////////
+
+G4VisCommandEnable::G4VisCommandEnable () {
+  G4bool omitable;
+
+  fpCommand = new G4UIcmdWithABool("/vis/enable", this);
+  fpCommand -> SetGuidance("Enables/disables visualization system.");
+  fpCommand -> SetParameterName("enabled", omitable=true);
+  fpCommand -> SetDefaultValue(true);
+
+  fpCommand1 = new G4UIcmdWithoutParameter("/vis/disable", this);
+  fpCommand1 -> SetGuidance("Disables visualization system.");
+}
+
+G4VisCommandEnable::~G4VisCommandEnable () {
+  delete fpCommand;
+  delete fpCommand1;
+}
+
+G4String G4VisCommandEnable::GetCurrentValue (G4UIcommand*) {
+  return G4String();
+}
+
+void G4VisCommandEnable::SetNewValue (G4UIcommand* command,
+				      G4String newValue) {
+  if (command == fpCommand) {
+    G4bool enable = G4UIcommand::ConvertToBool(newValue);
+    if (enable) fpVisManager->Enable();  // Printing is in vis manager.
+    else fpVisManager->Disable();        // Printing is in vis manager.
+  } else fpVisManager->Disable();        // Printing is in vis manager.
+  // Note: Printing is in vis manager.
+}
+
+////////////// /vis/initialize ///////////////////////////////////////
+
+G4VisCommandInitialize::G4VisCommandInitialize ()
+{
+  fpCommand = new G4UIcmdWithoutParameter("/vis/initialize", this);
+  fpCommand -> SetGuidance("Initialise visualisation manager.");
+}
+
+G4VisCommandInitialize::~G4VisCommandInitialize () {
+  delete fpCommand;
+}
+
+void G4VisCommandInitialize::SetNewValue (G4UIcommand*,
+					  G4String) {
+  fpVisManager->Initialize();
+}
+
+////////////// /vis/list ///////////////////////////////////////
+
+G4VisCommandList::G4VisCommandList ()
+{
+  G4bool omitable;
+
+  fpCommand = new G4UIcmdWithAString("/vis/list", this);
+  fpCommand -> SetGuidance("Lists visualization parameters.");
+  fpCommand -> SetParameterName("verbosity", omitable=true);
+  fpCommand -> SetDefaultValue("warnings");
+}
+
+G4VisCommandList::~G4VisCommandList ()
+{
+  delete fpCommand;
+}
+
+G4String G4VisCommandList::GetCurrentValue (G4UIcommand*)
+{
+  return "";
+}
+
+void G4VisCommandList::SetNewValue (G4UIcommand*, G4String newValue)
+{
+  G4String& verbosityString = newValue;
+  G4VisManager::Verbosity verbosity =
+    fpVisManager->GetVerbosityValue(verbosityString);
+
+  fpVisManager->PrintAvailableGraphicsSystems();
+  G4cout << G4endl;
+  fpVisManager->PrintAvailableModels(verbosity);
+  G4cout << G4endl;
+  G4UImanager* UImanager = G4UImanager::GetUIpointer();
+  UImanager->ApplyCommand(G4String("/vis/viewer/list ! ") + verbosityString);
+  if (verbosity < G4VisManager::parameters)
+    G4cout <<
+  "\nTo get more information, \"/vis/list all all\" or use individual commands"
+  "\n  such as (use \"ls\" or \"help\"):"
+  "\n    /vis/viewer/list"
+  "\n    /vis/modeling/trajectories/list"
+  "\n    /vis/filtering/trajectories/list"
+	   << G4endl;
+}
+
+////////////// /vis/reviewKeptEvents ///////////////////////////////////////
+
+G4VisCommandReviewKeptEvents::G4VisCommandReviewKeptEvents ()
+{
+  G4bool omitable;
+
+  fpCommand = new G4UIcmdWithAString("/vis/reviewKeptEvents", this);
+  fpCommand -> SetGuidance("Review kept events.");
+  fpCommand -> SetGuidance
+    ("If a macro file is specified, it is executed for each event.");
+  fpCommand -> SetGuidance(
+  "If a macro file is not specified, each event is drawn to the current"
+  "\nviewer.  After each event, the session is paused.  The user may issue"
+  "\nany allowed command.  Then enter \"cont[inue]\" to continue to the next"
+  "\nevent."
+  "\nUseful commands might be:"
+  "\n  \"/vis/viewer/...\" to change the view (zoom, set/viewpoint,...)."
+  "\n  \"/vis/oglx/printEPS\" to get hard copy."
+  "\n  \"/vis/open\" to get alternative viewer."
+  "\n  \"/vis/abortReviewKeptEvents\", then \"cont[inue]\", to abort.");
+  fpCommand -> SetParameterName("macro-file-name", omitable=true);
+  fpCommand -> SetDefaultValue("");
+}
+
+G4VisCommandReviewKeptEvents::~G4VisCommandReviewKeptEvents ()
+{
+  delete fpCommand;
+}
+
+G4String G4VisCommandReviewKeptEvents::GetCurrentValue (G4UIcommand*)
+{
+  return "";
+}
+
+void G4VisCommandReviewKeptEvents::SetNewValue (G4UIcommand*, G4String newValue)
+{
+  static bool reviewing = false;
+  if (reviewing) {
+    G4cout <<
+      "\"/vis/reviewKeptEvents\" not allowed within an already started review."
+      "\n  No action taken."
+	   << G4endl;
+    return;
+  }
+
+  G4String& macroFileName = newValue;
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+
+  G4RunManager* runManager = G4RunManager::GetRunManager();
+  const G4Run* run = runManager? runManager->GetCurrentRun(): 0;
+  const std::vector<const G4Event*>* events = run? run->GetEventVector(): 0;
+  size_t nKeptEvents = events? events->size(): 0;
+
+  if (!nKeptEvents) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout <<
+	"ERROR: G4VisCommandReviewKeptEvents::SetNewValue: No kept events,"
+	"\n  or kept events not accessible."
+	     << G4endl;
+    }
+    return;
+  }
+
+  G4VViewer* viewer = fpVisManager->GetCurrentViewer();
+  if (!viewer) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout <<
+  "ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
+             << G4endl;
+    }
+    return;
+  }
+
+  G4Scene* pScene = fpVisManager->GetCurrentScene();
+  if (!pScene) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout << "ERROR: No current scene.  Please create one." << G4endl;
+    }
+    return;
+  }
+
+  G4UImanager* UImanager = G4UImanager::GetUIpointer();
+  G4int keepVerbose = UImanager->GetVerboseLevel();
+  G4int newVerbose(0);
+  if (keepVerbose >= 2 || verbosity >= G4VisManager::confirmations)
+    newVerbose = 2;
+  UImanager->SetVerboseLevel(newVerbose);
+
+  // Event by event refreshing...
+  reviewing  = true;
+  G4bool currentRefreshAtEndOfEvent = pScene->GetRefreshAtEndOfEvent();
+  pScene->SetRefreshAtEndOfEvent(true);
+  if (macroFileName.empty()) {
+
+    // Draw to viewer and pause session...
+    G4UIsession* session = UImanager->GetSession();
+    for (size_t i = 0; i < nKeptEvents; ++i) {
+      const G4Event* event = (*events)[i];
+      if (verbosity >= G4VisManager::warnings) {
+	G4cout << "Drawing event : " << event->GetEventID() <<
+	  ".  At EndOfEvent, enter any command, then \"cont[inue]\"..."
+	       << G4endl;
+	static G4bool first = true;
+	if (first) {
+	  first = false;
+	  G4cout <<
+  "  Useful commands might be:"
+  "\n    \"/vis/viewer/...\" to change the view (zoom, set/viewpoint,...)."
+  "\n    \"/vis/oglx/printEPS\" to get hard copy."
+  "\n    \"/vis/open\" to get alternative viewer."
+  "\n    \"/vis/abortReviewKeptEvents\", then \"cont[inue]\", to abort."
+		 << G4endl;
+	}
+      }
+      fpVisManager->SetRequestedEvent(event);
+      UImanager->ApplyCommand("/vis/viewer/rebuild");
+      /* The above command forces a rebuild of the scene, including
+	 the detector.  This is fine for "immediate" viewers - a
+	 refresh requires a rebuild anyway.  But for "stored mode"
+	 viewers, you could, in principle, avoid a rebuild of the
+	 detector with something like the following:
+      sceneHandler->ClearTransientStore();
+      viewer->DrawView();
+      sceneHandler->DrawEvent(event);
+         but this causes mayhem for "immediate" viewers because
+         ClearTransientStore issues a DrawView and some curious sort
+         of recursion takes place.  For "stored" viewers, the event
+         gets drawn but not the eventID, so something odd is happening
+         there too.  This needs further investigation - enhanced
+         features or a complete re-think.
+      */
+      UImanager->ApplyCommand("/vis/viewer/flush");
+      session->PauseSessionStart("EndOfEvent");
+      fpVisManager->SetRequestedEvent(0);
+      if (fpVisManager->GetAbortReviewKeptEvents()) break;
+    }
+    fpVisManager->SetAbortReviewKeptEvents(false);
+
+  } else {
+
+    // Execute macro file...
+    for (size_t i = 0; i < nKeptEvents; ++i) {
+      const G4Event* event = (*events)[i];
+      if (verbosity >= G4VisManager::warnings) {
+	G4cout << "Drawing event : " << event->GetEventID()
+	       << " with macro file \"" << macroFileName << G4endl;
+      }
+      fpVisManager->SetRequestedEvent(event);
+      UImanager->ApplyCommand("/control/execute " + macroFileName);
+      fpVisManager->SetRequestedEvent(0);
+    }
+  }
+  pScene->SetRefreshAtEndOfEvent(currentRefreshAtEndOfEvent);
+  reviewing  = false;
+
+  UImanager->SetVerboseLevel(keepVerbose);
+}
+
+////////////// /vis/verbose ///////////////////////////////////////
+
+G4VisCommandVerbose::G4VisCommandVerbose () {
+  G4bool omitable;
+
+  fpCommand = new G4UIcmdWithAString("/vis/verbose", this);
+  for (size_t i = 0; i < G4VisManager::VerbosityGuidanceStrings.size(); ++i) {
+    fpCommand -> SetGuidance(G4VisManager::VerbosityGuidanceStrings[i]);
+  }
+  fpCommand -> SetParameterName("verbosity", omitable=true);
+  fpCommand -> SetDefaultValue("warnings");
+}
+
+G4VisCommandVerbose::~G4VisCommandVerbose () {
+  delete fpCommand;
+}
+
+G4String G4VisCommandVerbose::GetCurrentValue (G4UIcommand*) {
+  return G4String();
+}
+
+void G4VisCommandVerbose::SetNewValue (G4UIcommand*,
+				       G4String newValue) {
+  G4VisManager::Verbosity verbosity =
+    fpVisManager->GetVerbosityValue(newValue);
+  fpVisManager->SetVerboseLevel(verbosity);
+  // Always prints whatever the verbosity...
+  G4cout << "Visualization verbosity changed to "
+	 << G4VisManager::VerbosityString(verbosity) << G4endl;
+}
Index: tags/visualization-10.5-before-10.6_test/management/src/G4VisCommandsCompound.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/src/G4VisCommandsCompound.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/src/G4VisCommandsCompound.cc	(revision 1102)
@@ -0,0 +1,329 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VisCommandsCompound.cc,v 1.39 2007/11/16 20:29:04 perl Exp $
+// GEANT4 tag $Name:  $
+
+// Compound /vis/ commands - John Allison  15th May 2000
+
+#include "G4VisCommandsCompound.hh"
+
+#include "G4VisManager.hh"
+#include "G4UImanager.hh"
+#include "G4UIcmdWithAString.hh"
+
+#include <sstream>
+
+////////////// /vis/drawTree ///////////////////////////////////////
+
+G4VisCommandDrawTree::G4VisCommandDrawTree() {
+  G4bool omitable;
+  fpCommand = new G4UIcommand("/vis/drawTree", this);
+  fpCommand->SetGuidance
+    ("(DTREE) Creates a scene consisting of this physical volume and"
+     "\n  produces a representation of the geometry hieracrhy.");
+  fpCommand->SetGuidance("The scene becomes current.");
+  G4UIparameter* parameter;
+  parameter = new G4UIparameter("physical-volume-name", 's', omitable = true);
+  parameter -> SetDefaultValue("world");
+  fpCommand -> SetParameter (parameter);
+  parameter = new G4UIparameter("system", 's', omitable = true);
+  parameter -> SetDefaultValue("ATree");
+  fpCommand -> SetParameter (parameter);
+}
+
+G4VisCommandDrawTree::~G4VisCommandDrawTree() {
+  delete fpCommand;
+}
+
+void G4VisCommandDrawTree::SetNewValue(G4UIcommand*, G4String newValue) {
+
+  G4String pvname, system;
+  std::istringstream is(newValue);
+  is >> pvname >> system;
+
+  G4UImanager* UImanager = G4UImanager::GetUIpointer();
+  G4int keepVerbose = UImanager->GetVerboseLevel();
+  G4int newVerbose(0);
+  if (keepVerbose >= 2 ||
+      fpVisManager->GetVerbosity() >= G4VisManager::confirmations)
+    newVerbose = 2;
+  UImanager->SetVerboseLevel(newVerbose);
+  UImanager->ApplyCommand(G4String("/vis/open " + system));
+  UImanager->ApplyCommand(G4String("/vis/drawVolume " + pvname));
+  UImanager->ApplyCommand("/vis/viewer/flush");
+  UImanager->SetVerboseLevel(keepVerbose);
+}
+
+////////////// /vis/drawView ///////////////////////////////////////
+
+G4VisCommandDrawView::G4VisCommandDrawView() {
+  G4bool omitable;
+  fpCommand = new G4UIcommand("/vis/drawView", this);
+  fpCommand->SetGuidance
+    ("Draw view from this angle, etc.");
+  G4UIparameter* parameter;
+  parameter = new G4UIparameter("theta-degrees", 'd', omitable = true);
+  parameter -> SetDefaultValue(0.);
+  fpCommand -> SetParameter (parameter);
+  parameter = new G4UIparameter("phi-degrees", 'd', omitable = true);
+  parameter -> SetDefaultValue(0.);
+  fpCommand -> SetParameter (parameter);
+  parameter = new G4UIparameter("pan-right", 'd', omitable = true);
+  parameter -> SetDefaultValue(0.);
+  fpCommand -> SetParameter (parameter);
+  parameter = new G4UIparameter("pan-up", 'd', omitable = true);
+  parameter -> SetDefaultValue(0.);
+  fpCommand -> SetParameter (parameter);
+  parameter = new G4UIparameter("pan-unit", 's', omitable = true);
+  parameter -> SetDefaultValue("cm");
+  fpCommand -> SetParameter (parameter);
+  parameter = new G4UIparameter("zoom-factor", 'd', omitable = true);
+  parameter -> SetDefaultValue(1.);
+  fpCommand -> SetParameter (parameter);
+  parameter = new G4UIparameter("dolly", 'd', omitable = true);
+  parameter -> SetDefaultValue(0.);
+  fpCommand -> SetParameter (parameter);
+  parameter = new G4UIparameter("dolly-unit", 's', omitable = true);
+  parameter -> SetDefaultValue("cm");
+  fpCommand -> SetParameter (parameter);
+}
+
+G4VisCommandDrawView::~G4VisCommandDrawView() {
+  delete fpCommand;
+}
+
+void G4VisCommandDrawView::SetNewValue(G4UIcommand*, G4String newValue) {
+
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+
+  G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
+  if (!currentViewer) {
+    if (verbosity >= G4VisManager::warnings) {
+      G4cout <<
+	"WARNING: G4VisCommandsDrawView::SetNewValue: no current viewer."
+	     << G4endl;
+    }
+    return;
+  }
+
+  G4String thetaDeg;
+  G4String phiDeg;
+  G4String panRight;
+  G4String panUp;
+  G4String panUnit;
+  G4String zoomFactor;
+  G4String dolly;
+  G4String dollyUnit;
+  std::istringstream is(newValue);
+  is >> thetaDeg >> phiDeg >> panRight >> panUp >> panUnit
+     >> zoomFactor >> dolly >> dollyUnit;
+  
+  G4UImanager* UImanager = G4UImanager::GetUIpointer();
+  G4int keepVerbose = UImanager->GetVerboseLevel();
+  G4int newVerbose(0);
+  if (keepVerbose >= 2 ||
+      fpVisManager->GetVerbosity() >= G4VisManager::confirmations)
+    newVerbose = 2;
+  UImanager->SetVerboseLevel(newVerbose);
+  G4ViewParameters vp = currentViewer->GetViewParameters();
+  G4bool keepAutoRefresh = vp.IsAutoRefresh();
+  vp.SetAutoRefresh(false);
+  currentViewer->SetViewParameters(vp);
+  UImanager->ApplyCommand(
+    G4String("/vis/viewer/set/viewpointThetaPhi " + thetaDeg + " " + phiDeg + " deg"));
+  UImanager->ApplyCommand(
+    G4String("/vis/viewer/panTo " + panRight + " " + panUp + " " + panUnit));
+  UImanager->ApplyCommand(
+    G4String("/vis/viewer/zoomTo " + zoomFactor));
+  vp = currentViewer->GetViewParameters();
+  vp.SetAutoRefresh(keepAutoRefresh);
+  currentViewer->SetViewParameters(vp);
+  UImanager->ApplyCommand(
+    G4String("/vis/viewer/dollyTo " + dolly + " " + dollyUnit));
+  UImanager->SetVerboseLevel(keepVerbose);
+}
+
+////////////// /vis/drawVolume ///////////////////////////////////////
+
+G4VisCommandDrawVolume::G4VisCommandDrawVolume() {
+  G4bool omitable;
+  fpCommand = new G4UIcmdWithAString("/vis/drawVolume", this);
+  fpCommand->SetGuidance
+    ("Creates a scene containing this physical volume and asks the"
+     "\ncurrent viewer to draw it.  The scene becomes current.");
+  fpCommand -> SetGuidance 
+    ("If physical-volume-name is \"world\" (the default), the main geometry"
+     "\ntree (material world) is drawn.  If \"worlds\", all worlds - material"
+     "\nworld and parallel worlds, if any - are drawn.  Otherwise a search of"
+     "\nall worlds is made, taking the first matching occurence only.  To see"
+     "\na representation of the geometry hierarchy of the worlds, try"
+     "\n\"/vis/drawTree [worlds]\" or one of the driver/browser combinations"
+     "\nthat have the required functionality, e.g., HepRep");
+  fpCommand->SetParameterName("physical-volume-name", omitable = true);
+  fpCommand->SetDefaultValue("world");
+}
+
+G4VisCommandDrawVolume::~G4VisCommandDrawVolume() {
+  delete fpCommand;
+}
+
+void G4VisCommandDrawVolume::SetNewValue(G4UIcommand*, G4String newValue) {
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+  G4UImanager* UImanager = G4UImanager::GetUIpointer();
+  G4int keepVerbose = UImanager->GetVerboseLevel();
+  G4int newVerbose(0);
+  if (keepVerbose >= 2 || verbosity >= G4VisManager::confirmations)
+    newVerbose = 2;
+  UImanager->SetVerboseLevel(newVerbose);
+  UImanager->ApplyCommand("/vis/scene/create");
+  UImanager->ApplyCommand(G4String("/vis/scene/add/volume " + newValue));
+  UImanager->ApplyCommand("/vis/sceneHandler/attach");
+  UImanager->SetVerboseLevel(keepVerbose);
+  static G4bool warned = false;
+  if (verbosity >= G4VisManager::confirmations && !warned) {
+    G4cout <<
+      "NOTE: For systems which are not \"auto-refresh\" you will need to"
+      "\n  issue \"/vis/viewer/refresh\" or \"/vis/viewer/flush\"."
+	   << G4endl;
+    warned = true;
+  }
+}
+
+////////////// /vis/open ///////////////////////////////////////
+
+G4VisCommandOpen::G4VisCommandOpen() {
+  G4bool omitable;
+  fpCommand = new G4UIcommand("/vis/open", this);
+  fpCommand->SetGuidance
+    ("Creates a scene handler ready for drawing.");
+  fpCommand->SetGuidance
+    ("The scene handler becomes current (the name is auto-generated).");
+  G4UIparameter* parameter;
+  parameter = new G4UIparameter("graphics-system-name", 's', omitable = false);
+   const G4GraphicsSystemList& gslist =
+    fpVisManager->GetAvailableGraphicsSystems();
+  G4String candidates;
+  for (size_t igslist = 0; igslist < gslist.size(); igslist++) {
+    const G4String& name = gslist[igslist]->GetName();
+    const G4String& nickname = gslist[igslist]->GetNickname();
+    if (nickname.isNull()) {
+      candidates += name;
+    }
+    else {
+      candidates += nickname;
+    }
+    candidates += " ";
+  }
+  candidates = candidates.strip();
+  parameter->SetParameterCandidates(candidates);
+  fpCommand->SetParameter(parameter);
+  parameter = new G4UIparameter("window-size-hint", 's', omitable = true);
+  parameter->SetGuidance
+    ("integer (pixels) for square window placed by window manager or"
+     " X-Windows-type geometry string, e.g. 600x600-100+100");
+  parameter->SetDefaultValue("600");
+  fpCommand->SetParameter(parameter);
+}
+
+G4VisCommandOpen::~G4VisCommandOpen() {
+  delete fpCommand;
+}
+
+void G4VisCommandOpen::SetNewValue (G4UIcommand*, G4String newValue) {
+  G4String systemName, windowSizeHint;
+  std::istringstream is(newValue);
+  is >> systemName >> windowSizeHint;
+  G4UImanager* UImanager = G4UImanager::GetUIpointer();
+  G4int keepVerbose = UImanager->GetVerboseLevel();
+  G4int newVerbose(0);
+  if (keepVerbose >= 2 ||
+      fpVisManager->GetVerbosity() >= G4VisManager::confirmations)
+    newVerbose = 2;
+  UImanager->SetVerboseLevel(newVerbose);
+  UImanager->ApplyCommand(G4String("/vis/sceneHandler/create " + systemName));
+  UImanager->ApplyCommand(G4String("/vis/viewer/create ! ! " + windowSizeHint));
+  UImanager->SetVerboseLevel(keepVerbose);
+}
+
+////////////// /vis/specify ///////////////////////////////////////
+
+G4VisCommandSpecify::G4VisCommandSpecify() {
+  G4bool omitable;
+  fpCommand = new G4UIcommand("/vis/specify", this);
+  fpCommand->SetGuidance
+    ("Draws logical volume with Boolean components, voxels and readout geometry.");
+  fpCommand->SetGuidance
+    ("Creates a scene consisting of this logical volume and asks the"
+     "\n  current viewer to draw it to the specified depth of descent"
+     "\n  showing boolean components (if any), voxels (if any)"
+     "\n  and readout geometry (if any), under control of the appropriate flag.");
+  fpCommand->SetGuidance
+    ("Note: voxels are not constructed until start of run - /run/beamOn.");
+  fpCommand->SetGuidance("The scene becomes current.");
+  G4UIparameter* parameter;
+  parameter = new G4UIparameter("logical-volume-name", 's', omitable = false);
+  fpCommand->SetParameter(parameter);
+  parameter = new G4UIparameter("depth-of-descent", 'i', omitable = true);
+  parameter->SetDefaultValue(1);
+  fpCommand->SetParameter(parameter);
+  parameter = new G4UIparameter("booleans-flag", 'b', omitable = true);
+  parameter->SetDefaultValue(true);
+  fpCommand->SetParameter(parameter);
+  parameter = new G4UIparameter("voxels-flag", 'b', omitable = true);
+  parameter->SetDefaultValue(true);
+  fpCommand->SetParameter(parameter);
+  parameter = new G4UIparameter("readout-flag", 'b', omitable = true);
+  parameter->SetDefaultValue(true);
+  fpCommand->SetParameter(parameter);
+}
+
+G4VisCommandSpecify::~G4VisCommandSpecify() {
+  delete fpCommand;
+}
+
+void G4VisCommandSpecify::SetNewValue(G4UIcommand*, G4String newValue) {
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+  G4UImanager* UImanager = G4UImanager::GetUIpointer();
+  G4int keepVerbose = UImanager->GetVerboseLevel();
+  G4int newVerbose(0);
+  if (keepVerbose >= 2 || verbosity >= G4VisManager::confirmations)
+    newVerbose = 2;
+  UImanager->SetVerboseLevel(newVerbose);
+  // UImanager->ApplyCommand(G4String("/geometry/print " + newValue));
+  UImanager->ApplyCommand("/vis/scene/create");
+  UImanager->ApplyCommand(G4String("/vis/scene/add/logicalVolume " + newValue));
+  UImanager->ApplyCommand("/vis/sceneHandler/attach");
+  UImanager->SetVerboseLevel(keepVerbose);
+  static G4bool warned = false;
+  if (verbosity >= G4VisManager::confirmations && !warned) {
+    G4cout <<
+      "NOTE: For systems which are not \"auto-refresh\" you will need to"
+      "\n  issue \"/vis/viewer/refresh\" or \"/vis/viewer/flush\"."
+	   << G4endl;
+    warned = true;
+  }
+}
Index: tags/visualization-10.5-before-10.6_test/management/src/G4VisCommandsGeometry.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/src/G4VisCommandsGeometry.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/src/G4VisCommandsGeometry.cc	(revision 1102)
@@ -0,0 +1,152 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VisCommandsGeometry.cc,v 1.4 2007/01/05 16:29:38 allison Exp $
+// GEANT4 tag $Name:  $
+
+// /vis/geometry commands - John Allison  31st January 2006
+
+#include "G4VisCommandsGeometry.hh"
+
+#include "G4UIcmdWithAString.hh"
+#include "G4VisManager.hh"
+#include "G4LogicalVolumeStore.hh"
+#include "G4UImanager.hh"
+
+std::map<G4LogicalVolume*, const G4VisAttributes*>
+G4VVisCommandGeometry::fVisAttsMap;
+
+G4VVisCommandGeometry::~G4VVisCommandGeometry()
+{
+  // Delete all vis atts that were "new".  Do something like "restore"
+  // without the "rebuild".
+}
+
+////////////// /vis/geometry/list ///////////////////////////////////////
+
+G4VisCommandGeometryList::G4VisCommandGeometryList()
+{
+  G4bool omitable;
+  fpCommand = new G4UIcmdWithAString("/vis/geometry/list", this);
+  fpCommand -> SetGuidance("Lists vis attributes of logical volume(s).");
+  fpCommand -> SetGuidance("\"all\" lists all logical volumes.");
+  fpCommand -> SetParameterName("logical-volume-name", omitable = true);
+  fpCommand -> SetDefaultValue("all");
+}
+
+G4VisCommandGeometryList::~G4VisCommandGeometryList()
+{
+  delete fpCommand;
+}
+
+G4String G4VisCommandGeometryList::GetCurrentValue(G4UIcommand*)
+{
+  return "";
+}
+
+void G4VisCommandGeometryList::SetNewValue(G4UIcommand*, G4String newValue)
+{
+  G4LogicalVolumeStore *pLVStore = G4LogicalVolumeStore::GetInstance();
+  G4bool found = false;
+  for (size_t iLV = 0; iLV < pLVStore->size(); iLV++ ) {
+    G4LogicalVolume*pLV = (*pLVStore)[iLV];
+    const G4String& logVolName = pLV->GetName();
+    if (newValue == "all" || logVolName == newValue) {
+      const G4VisAttributes* visAtts = pLV->GetVisAttributes();
+      G4cout << "\nLogical Volume \"" << pLV->GetName()
+	     << "\": vis attributes:\n" << *visAtts
+	     << G4endl;
+    }
+    if (logVolName == newValue) found = true;
+  }
+  if (newValue != "all" && !found) {
+    if (fpVisManager->GetVerbosity() >= G4VisManager::errors) {
+      G4cout << "ERROR: Logical volume \"" << newValue
+	     << "\" not found in logical volume store." << G4endl;
+    }
+    return;
+  }
+}
+
+////////////// /vis/geometry/restore ///////////////////////////////////////
+
+G4VisCommandGeometryRestore::G4VisCommandGeometryRestore()
+{
+  G4bool omitable;
+  fpCommand = new G4UIcmdWithAString("/vis/geometry/restore", this);
+  fpCommand -> SetGuidance("Restores vis attributes of logical volume(s).");
+  fpCommand -> SetParameterName("logical-volume-name", omitable = true);
+  fpCommand -> SetDefaultValue("all");
+}
+
+G4VisCommandGeometryRestore::~G4VisCommandGeometryRestore()
+{
+  delete fpCommand;
+}
+
+G4String G4VisCommandGeometryRestore::GetCurrentValue(G4UIcommand*)
+{
+  return "";
+}
+
+void G4VisCommandGeometryRestore::SetNewValue(G4UIcommand*, G4String newValue)
+{
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+  G4LogicalVolumeStore *pLVStore = G4LogicalVolumeStore::GetInstance();
+  size_t nLV = pLVStore->size();
+  size_t iLV;
+  G4LogicalVolume* pLV = 0;
+  G4bool found = false;
+  for (iLV = 0; iLV < nLV; iLV++ ) {
+    pLV = (*pLVStore)[iLV];
+    const G4String& logVolName = pLV->GetName();
+    if (logVolName == newValue) found = true;
+    if (newValue == "all" || logVolName == newValue) {
+      VisAttsMapIterator i = fVisAttsMap.find(pLV);
+      if (i != fVisAttsMap.end()) {
+	const G4VisAttributes* newVisAtts = pLV->GetVisAttributes();
+	const G4VisAttributes* oldVisAtts = i->second;
+	pLV->SetVisAttributes(oldVisAtts);
+	if (verbosity >= G4VisManager::confirmations) {
+	  G4cout << "\nLogical Volume \"" << pLV->GetName()
+		 << "\": re-setting vis attributes:\nwas: " << *newVisAtts
+		 << "\nnow: " << *oldVisAtts
+		 << G4endl;
+	}
+      }
+    }
+  }
+  if (newValue != "all" && !found) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout << "ERROR: Logical volume \"" << newValue
+	     << "\" not found in logical volume store." << G4endl;
+    }
+    return;
+  }
+  if (fpVisManager->GetCurrentViewer()) {
+    G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/rebuild");
+  }
+}
Index: tags/visualization-10.5-before-10.6_test/management/src/G4VisCommandsGeometrySet.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/src/G4VisCommandsGeometrySet.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/src/G4VisCommandsGeometrySet.cc	(revision 1102)
@@ -0,0 +1,607 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VisCommandsGeometrySet.cc,v 1.7 2007/01/05 16:24:19 allison Exp $
+// GEANT4 tag $Name:  $
+
+// /vis/geometry commands - John Allison  31st January 2006
+
+#include "G4VisCommandsGeometrySet.hh"
+
+#include "G4UIcommand.hh"
+#include "G4VisManager.hh"
+#include "G4LogicalVolumeStore.hh"
+#include "G4UImanager.hh"
+
+#include <sstream>
+#include <cctype>
+
+void G4VVisCommandGeometrySet::Set
+(G4String requestedName,
+ const G4VVisCommandGeometrySetFunction& setFunction,
+ G4int requestedDepth)
+{
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+  G4LogicalVolumeStore* pLVStore = G4LogicalVolumeStore::GetInstance();
+  G4bool found = false;
+  for (size_t iLV = 0; iLV < pLVStore->size(); iLV++ ) {
+    G4LogicalVolume* pLV = (*pLVStore)[iLV];
+    const G4String& logVolName = pLV->GetName();
+    if (logVolName == requestedName) found = true;
+    if (requestedName == "all" || logVolName == requestedName) {
+      SetLVVisAtts(pLV, setFunction, 0, requestedDepth);
+    }
+  }
+  if (requestedName != "all" && !found) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout << "ERROR: Logical volume \"" << requestedName
+	     << "\" not found in logical volume store." << G4endl;
+    }
+    return;
+  }
+  if (fpVisManager->GetCurrentViewer()) {
+    G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/rebuild");
+  }
+}
+
+void G4VVisCommandGeometrySet::SetLVVisAtts
+(G4LogicalVolume* pLV,
+ const G4VVisCommandGeometrySetFunction& setFunction,
+ G4int depth, G4int requestedDepth)
+{
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+  const G4VisAttributes* oldVisAtts = pLV->GetVisAttributes();
+  fVisAttsMap.insert(std::make_pair(pLV,oldVisAtts));  // Store old vis atts.
+  G4VisAttributes* newVisAtts = new G4VisAttributes;   // Memory leak!
+  if (oldVisAtts) {
+    *newVisAtts = *oldVisAtts;
+  }
+  setFunction(newVisAtts);  // Sets whatever attribute determined by
+			    // function object.
+  pLV->SetVisAttributes(newVisAtts);
+  if (verbosity >= G4VisManager::confirmations) {
+    G4cout << "\nLogical Volume \"" << pLV->GetName()
+	   << "\": setting vis attributes:\nwas: " << *oldVisAtts
+	   << "\nnow: " << *newVisAtts
+	   << G4endl;
+  }
+  if (requestedDepth < 0 || depth++ < requestedDepth) {
+    G4int nDaughters = pLV->GetNoDaughters();
+    for (G4int i = 0; i < nDaughters; ++i) {
+      SetLVVisAtts(pLV->GetDaughter(i)->GetLogicalVolume(),
+		   setFunction, depth, requestedDepth);
+    }
+  }
+}
+
+////////////// /vis/geometry/set/colour ///////////////////////////////////////
+
+G4VisCommandGeometrySetColour::G4VisCommandGeometrySetColour()
+{
+  G4bool omitable;
+  fpCommand = new G4UIcommand("/vis/geometry/set/colour", this);
+  fpCommand->SetGuidance("Sets colour of logical volume(s).");
+  fpCommand->SetGuidance("\"all\" sets all logical volumes.");
+  fpCommand->SetGuidance
+    ("Optionally propagates down hierarchy to given depth.");
+  G4UIparameter* parameter;
+  parameter = new G4UIparameter ("logical-volume-name", 's', omitable = true);
+  parameter->SetDefaultValue("all");
+  fpCommand->SetParameter(parameter);
+  parameter = new G4UIparameter("depth", 'd', omitable = true);
+  parameter->SetDefaultValue(0);
+  parameter->SetGuidance
+    ("Depth of propagation (-1 means unlimited depth).");
+  fpCommand->SetParameter(parameter);
+  parameter = new G4UIparameter("red", 's', omitable = true);
+  parameter->SetDefaultValue("1.");
+  parameter->SetGuidance
+    ("Red component or a string, e.g., \"blue\", in which case succeeding colour components are ignored.");
+  fpCommand->SetParameter(parameter);
+  parameter = new G4UIparameter("green", 'd', omitable = true);
+  parameter->SetDefaultValue(1.);
+  fpCommand->SetParameter(parameter);
+  parameter = new G4UIparameter("blue", 'd', omitable = true);
+  parameter->SetDefaultValue(1.);
+  fpCommand->SetParameter(parameter);
+  parameter = new G4UIparameter("opacity", 'd', omitable = true);
+  parameter->SetDefaultValue(1.);
+  fpCommand->SetParameter(parameter);
+}
+
+G4VisCommandGeometrySetColour::~G4VisCommandGeometrySetColour()
+{
+  delete fpCommand;
+}
+
+G4String G4VisCommandGeometrySetColour::GetCurrentValue(G4UIcommand*)
+{
+  return "";
+}
+
+void G4VisCommandGeometrySetColour::SetNewValue
+(G4UIcommand*, G4String newValue)
+{
+  G4String name, redOrString;
+  G4int requestedDepth;
+  G4double green, blue, opacity;
+  std::istringstream iss(newValue);
+  iss >> name >> requestedDepth >> redOrString >> green >> blue >> opacity;
+  G4Colour colour(1,1,1,1);  // Default white and opaque.
+  const size_t iPos0 = 0;
+  if (std::isalpha(redOrString[iPos0])) {
+    G4Colour::GetColour(redOrString, colour); // Remains if not found.
+  } else {
+    colour = G4Colour(G4UIcommand::ConvertToDouble(redOrString), green, blue);
+  }
+  colour = G4Colour
+    (colour.GetRed(), colour.GetGreen(), colour.GetBlue(), opacity);
+
+  G4VisCommandGeometrySetColourFunction setColour(colour);
+  Set(name, setColour, requestedDepth);
+}
+
+////////////// /vis/geometry/set/daughtersInvisible //////////////////////
+
+G4VisCommandGeometrySetDaughtersInvisible::G4VisCommandGeometrySetDaughtersInvisible()
+{
+  G4bool omitable;
+  fpCommand = new G4UIcommand("/vis/geometry/set/daughtersInvisible", this);
+  fpCommand->SetGuidance("Makes daughters of logical volume(s) invisible.");
+  fpCommand->SetGuidance("\"all\" sets all logical volumes.");
+  fpCommand->SetGuidance
+    ("Optionally propagates down hierarchy to given depth.");
+  G4UIparameter* parameter;
+  parameter = new G4UIparameter ("logical-volume-name", 's', omitable = true);
+  parameter->SetDefaultValue("all");
+  fpCommand->SetParameter(parameter);
+  parameter = new G4UIparameter("depth", 'd', omitable = true);
+  parameter->SetDefaultValue(0);
+  parameter->SetGuidance
+    ("Depth of propagation (-1 means unlimited depth).");
+  fpCommand->SetParameter(parameter);
+  parameter = new G4UIparameter("daughtersInvisible", 'b', omitable = true);
+  parameter->SetDefaultValue(false);
+  fpCommand->SetParameter(parameter);
+}
+
+G4VisCommandGeometrySetDaughtersInvisible::~G4VisCommandGeometrySetDaughtersInvisible()
+{
+  delete fpCommand;
+}
+
+G4String
+G4VisCommandGeometrySetDaughtersInvisible::GetCurrentValue(G4UIcommand*)
+{
+  return "";
+}
+
+void G4VisCommandGeometrySetDaughtersInvisible::SetNewValue
+(G4UIcommand*, G4String newValue)
+{
+  G4String name;
+  G4int requestedDepth;
+  G4String daughtersInvisibleString;
+  std::istringstream iss(newValue);
+  iss >> name >> requestedDepth >> daughtersInvisibleString;
+  G4bool daughtersInvisible =
+    G4UIcommand::ConvertToBool(daughtersInvisibleString);
+
+  if (requestedDepth !=0) {
+    requestedDepth = 0;
+    if (fpVisManager->GetVerbosity() >= G4VisManager::warnings) {
+      G4cout << "Recursive application suppressed for this attribute."
+	     << G4endl;
+    }
+  }
+
+  G4VisCommandGeometrySetDaughtersInvisibleFunction
+    setDaughtersInvisible(daughtersInvisible);
+  Set(name, setDaughtersInvisible, requestedDepth);
+
+  G4VViewer* pViewer = fpVisManager->GetCurrentViewer();
+  if (pViewer) {
+    const G4ViewParameters& viewParams = pViewer->GetViewParameters();
+    if (fpVisManager->GetVerbosity() >= G4VisManager::warnings) {
+      if (!viewParams.IsCulling()) {
+	G4cout <<
+	  "Culling must be on - \"/vis/viewer/set/culling global true\" - to see effect."
+	       << G4endl;
+      }
+    }
+  }
+}
+
+////////////// /vis/geometry/set/forceAuxEdgeVisible /////////////////////////
+
+G4VisCommandGeometrySetForceAuxEdgeVisible::G4VisCommandGeometrySetForceAuxEdgeVisible()
+{
+  G4bool omitable;
+  fpCommand = new G4UIcommand("/vis/geometry/set/forceAuxEdgeVisible", this);
+  fpCommand->SetGuidance
+    ("Forces auxiliary (soft) edges of logical volume(s) to be visible,"
+    "\nregardless of the view parameters.");
+  fpCommand->SetGuidance("\"all\" sets all logical volumes.");
+  fpCommand->SetGuidance
+    ("Optionally propagates down hierarchy to given depth.");
+  G4UIparameter* parameter;
+  parameter = new G4UIparameter ("logical-volume-name", 's', omitable = true);
+  parameter->SetDefaultValue("all");
+  fpCommand->SetParameter(parameter);
+  parameter = new G4UIparameter("depth", 'd', omitable = true);
+  parameter->SetDefaultValue(0);
+  parameter->SetGuidance
+    ("Depth of propagation (-1 means unlimited depth).");
+  fpCommand->SetParameter(parameter);
+  parameter = new G4UIparameter("forceAuxEdgeVisible", 'b', omitable = true);
+  parameter->SetDefaultValue(false);
+  fpCommand->SetParameter(parameter);
+}
+
+G4VisCommandGeometrySetForceAuxEdgeVisible::~G4VisCommandGeometrySetForceAuxEdgeVisible()
+{
+  delete fpCommand;
+}
+
+G4String
+G4VisCommandGeometrySetForceAuxEdgeVisible::GetCurrentValue(G4UIcommand*)
+{
+  return "";
+}
+
+void G4VisCommandGeometrySetForceAuxEdgeVisible::SetNewValue
+(G4UIcommand*, G4String newValue)
+{
+  G4String name;
+  G4int requestedDepth;
+  G4String forceAuxEdgeVisibleString;
+  std::istringstream iss(newValue);
+  iss >> name >> requestedDepth >> forceAuxEdgeVisibleString;
+  G4bool forceAuxEdgeVisible =
+    G4UIcommand::ConvertToBool(forceAuxEdgeVisibleString);;
+
+  G4VisCommandGeometrySetForceAuxEdgeVisibleFunction
+    setForceAuxEdgeVisible(forceAuxEdgeVisible);
+  Set(name, setForceAuxEdgeVisible, requestedDepth);
+}
+
+////////////// /vis/geometry/set/forceLineSegmentsPerCircle /////////////////////////
+
+G4VisCommandGeometrySetForceLineSegmentsPerCircle::G4VisCommandGeometrySetForceLineSegmentsPerCircle()
+{
+  G4bool omitable;
+  fpCommand = new G4UIcommand("/vis/geometry/set/forceLineSegmentsPerCircle", this);
+  fpCommand->SetGuidance
+    ("Forces number of line segments per circle, the precision with which a"
+     "\ncurved line or surface is represented by a polygon or polyhedron,"
+     "\nregardless of the view parameters.");
+  fpCommand->SetGuidance("\"all\" sets all logical volumes.");
+  fpCommand->SetGuidance
+    ("Optionally propagates down hierarchy to given depth.");
+  G4UIparameter* parameter;
+  parameter = new G4UIparameter ("logical-volume-name", 's', omitable = true);
+  parameter->SetDefaultValue("all");
+  fpCommand->SetParameter(parameter);
+  parameter = new G4UIparameter("depth", 'd', omitable = true);
+  parameter->SetDefaultValue(0);
+  parameter->SetGuidance
+    ("Depth of propagation (-1 means unlimited depth).");
+  fpCommand->SetParameter(parameter);
+  parameter = new G4UIparameter("lineSegmentsPerCircle", 'd', omitable = true);
+  parameter->SetGuidance
+    ("< 0 means not forced, i.e., under control of viewer.");
+  parameter->SetDefaultValue(-1);
+  fpCommand->SetParameter(parameter);
+}
+
+G4VisCommandGeometrySetForceLineSegmentsPerCircle::~G4VisCommandGeometrySetForceLineSegmentsPerCircle()
+{
+  delete fpCommand;
+}
+
+G4String
+G4VisCommandGeometrySetForceLineSegmentsPerCircle::GetCurrentValue(G4UIcommand*)
+{
+  return "";
+}
+
+void G4VisCommandGeometrySetForceLineSegmentsPerCircle::SetNewValue
+(G4UIcommand*, G4String newValue)
+{
+  G4String name;
+  G4int requestedDepth;
+  G4int lineSegmentsPerCircle;
+  std::istringstream iss(newValue);
+  iss >> name >> requestedDepth >> lineSegmentsPerCircle;
+
+  G4VisCommandGeometrySetForceLineSegmentsPerCircleFunction setForceLineSegmentsPerCircle(lineSegmentsPerCircle);
+  Set(name, setForceLineSegmentsPerCircle, requestedDepth);
+}
+
+////////////// /vis/geometry/set/forceSolid /////////////////////////
+
+G4VisCommandGeometrySetForceSolid::G4VisCommandGeometrySetForceSolid()
+{
+  G4bool omitable;
+  fpCommand = new G4UIcommand("/vis/geometry/set/forceSolid", this);
+  fpCommand->SetGuidance
+   ("Forces logical volume(s) always to be drawn solid (surface drawing),"
+    "\nregardless of the view parameters.");
+  fpCommand->SetGuidance("\"all\" sets all logical volumes.");
+  fpCommand->SetGuidance
+    ("Optionally propagates down hierarchy to given depth.");
+  G4UIparameter* parameter;
+  parameter = new G4UIparameter ("logical-volume-name", 's', omitable = true);
+  parameter->SetDefaultValue("all");
+  fpCommand->SetParameter(parameter);
+  parameter = new G4UIparameter("depth", 'd', omitable = true);
+  parameter->SetDefaultValue(0);
+  parameter->SetGuidance
+    ("Depth of propagation (-1 means unlimited depth).");
+  fpCommand->SetParameter(parameter);
+  parameter = new G4UIparameter("forceSolid", 'b', omitable = true);
+  parameter->SetDefaultValue(false);
+  fpCommand->SetParameter(parameter);
+}
+
+G4VisCommandGeometrySetForceSolid::~G4VisCommandGeometrySetForceSolid()
+{
+  delete fpCommand;
+}
+
+G4String
+G4VisCommandGeometrySetForceSolid::GetCurrentValue(G4UIcommand*)
+{
+  return "";
+}
+
+void G4VisCommandGeometrySetForceSolid::SetNewValue
+(G4UIcommand*, G4String newValue)
+{
+  G4String name;
+  G4int requestedDepth;
+  G4String forceSolidString;
+  std::istringstream iss(newValue);
+  iss >> name >> requestedDepth >> forceSolidString;
+  G4bool forceSolid = G4UIcommand::ConvertToBool(forceSolidString);
+
+  G4VisCommandGeometrySetForceSolidFunction setForceSolid(forceSolid);
+  Set(name, setForceSolid, requestedDepth);
+}
+
+////////////// /vis/geometry/set/forceWireframe /////////////////////////
+
+G4VisCommandGeometrySetForceWireframe::G4VisCommandGeometrySetForceWireframe()
+{
+  G4bool omitable;
+  fpCommand = new G4UIcommand("/vis/geometry/set/forceWireframe", this);
+  fpCommand->SetGuidance
+   ("Forces logical volume(s) always to be drawn as wireframe,"
+    "\nregardless of the view parameters.");
+  fpCommand->SetGuidance("\"all\" sets all logical volumes.");
+  fpCommand->SetGuidance
+    ("Optionally propagates down hierarchy to given depth.");
+  G4UIparameter* parameter;
+  parameter = new G4UIparameter ("logical-volume-name", 's', omitable = true);
+  parameter->SetDefaultValue("all");
+  fpCommand->SetParameter(parameter);
+  parameter = new G4UIparameter("depth", 'd', omitable = true);
+  parameter->SetDefaultValue(0);
+  parameter->SetGuidance
+    ("Depth of propagation (-1 means unlimited depth).");
+  fpCommand->SetParameter(parameter);
+  parameter = new G4UIparameter("forceWireframe", 'b', omitable = true);
+  parameter->SetDefaultValue(false);
+  fpCommand->SetParameter(parameter);
+}
+
+G4VisCommandGeometrySetForceWireframe::~G4VisCommandGeometrySetForceWireframe()
+{
+  delete fpCommand;
+}
+
+G4String
+G4VisCommandGeometrySetForceWireframe::GetCurrentValue(G4UIcommand*)
+{
+  return "";
+}
+
+void G4VisCommandGeometrySetForceWireframe::SetNewValue
+(G4UIcommand*, G4String newValue)
+{
+  G4String name;
+  G4int requestedDepth;
+  G4String forceWireframeString;
+  std::istringstream iss(newValue);
+  iss >> name >> requestedDepth >> forceWireframeString;
+  G4bool forceWireframe = G4UIcommand::ConvertToBool(forceWireframeString);
+
+  G4VisCommandGeometrySetForceWireframeFunction
+    setForceWireframe(forceWireframe);
+  Set(name, setForceWireframe, requestedDepth);
+}
+
+////////////// /vis/geometry/set/lineStyle /////////////////////////////////
+
+G4VisCommandGeometrySetLineStyle::G4VisCommandGeometrySetLineStyle()
+{
+  G4bool omitable;
+  fpCommand = new G4UIcommand("/vis/geometry/set/lineStyle", this);
+  fpCommand->SetGuidance("Sets line style of logical volume(s) drawing.");
+  fpCommand->SetGuidance("\"all\" sets all logical volumes.");
+  fpCommand->SetGuidance
+    ("Optionally propagates down hierarchy to given depth.");
+  G4UIparameter* parameter;
+  parameter = new G4UIparameter ("logical-volume-name", 's', omitable = true);
+  parameter->SetDefaultValue("all");
+  fpCommand->SetParameter(parameter);
+  parameter = new G4UIparameter("depth", 'd', omitable = true);
+  parameter->SetDefaultValue(0);
+  parameter->SetGuidance
+    ("Depth of propagation (-1 means unlimited depth).");
+  fpCommand->SetParameter(parameter);
+  parameter = new G4UIparameter("lineStyle", 's', omitable = true);
+  parameter->SetParameterCandidates("unbroken dashed dotted");
+  parameter->SetDefaultValue("unbroken");
+  fpCommand->SetParameter(parameter);
+}
+
+G4VisCommandGeometrySetLineStyle::~G4VisCommandGeometrySetLineStyle()
+{
+  delete fpCommand;
+}
+
+G4String
+G4VisCommandGeometrySetLineStyle::GetCurrentValue(G4UIcommand*)
+{
+  return "";
+}
+
+void G4VisCommandGeometrySetLineStyle::SetNewValue
+(G4UIcommand*, G4String newValue)
+{
+  G4String name, lineStyleString;
+  G4int requestedDepth;
+  std::istringstream iss(newValue);
+  iss >> name >> requestedDepth >> lineStyleString;
+  G4VisAttributes::LineStyle lineStyle = G4VisAttributes::unbroken;
+  if (lineStyleString == "unbroken") lineStyle = G4VisAttributes::unbroken;
+  if (lineStyleString == "dashed") lineStyle = G4VisAttributes::dashed;
+  if (lineStyleString == "dotted") lineStyle = G4VisAttributes::dotted;
+
+  G4VisCommandGeometrySetLineStyleFunction setLineStyle(lineStyle);
+  Set(name, setLineStyle, requestedDepth);
+}
+
+////////////// /vis/geometry/set/lineWidth /////////////////////////////////
+
+G4VisCommandGeometrySetLineWidth::G4VisCommandGeometrySetLineWidth()
+{
+  G4bool omitable;
+  fpCommand = new G4UIcommand("/vis/geometry/set/lineWidth", this);
+  fpCommand->SetGuidance("Sets line width of logical volume(s) drawing.");
+  fpCommand->SetGuidance("\"all\" sets all logical volumes.");
+  fpCommand->SetGuidance
+    ("Optionally propagates down hierarchy to given depth.");
+  G4UIparameter* parameter;
+  parameter = new G4UIparameter ("logical-volume-name", 's', omitable = true);
+  parameter->SetDefaultValue("all");
+  fpCommand->SetParameter(parameter);
+  parameter = new G4UIparameter("depth", 'd', omitable = true);
+  parameter->SetDefaultValue(0);
+  parameter->SetGuidance
+    ("Depth of propagation (-1 means unlimited depth).");
+  fpCommand->SetParameter(parameter);
+  parameter = new G4UIparameter("lineWidth", 'd', omitable = true);
+  parameter->SetDefaultValue(1.);
+  fpCommand->SetParameter(parameter);
+}
+
+G4VisCommandGeometrySetLineWidth::~G4VisCommandGeometrySetLineWidth()
+{
+  delete fpCommand;
+}
+
+G4String
+G4VisCommandGeometrySetLineWidth::GetCurrentValue(G4UIcommand*)
+{
+  return "";
+}
+
+void G4VisCommandGeometrySetLineWidth::SetNewValue
+(G4UIcommand*, G4String newValue)
+{
+  G4String name;
+  G4int requestedDepth;
+  G4double lineWidth;
+  std::istringstream iss(newValue);
+  iss >> name >> requestedDepth >> lineWidth;
+
+  G4VisCommandGeometrySetLineWidthFunction setLineWidth(lineWidth);
+  Set(name, setLineWidth, requestedDepth);
+}
+
+////////////// /vis/geometry/set/visibility ///////////////////////////////////////
+
+G4VisCommandGeometrySetVisibility::G4VisCommandGeometrySetVisibility()
+{
+  G4bool omitable;
+  fpCommand = new G4UIcommand("/vis/geometry/set/visibility", this);
+  fpCommand->SetGuidance("Sets visibility of logical volume(s).");
+  fpCommand->SetGuidance("\"all\" sets all logical volumes.");
+  fpCommand->SetGuidance
+    ("Optionally propagates down hierarchy to given depth.");
+  G4UIparameter* parameter;
+  parameter = new G4UIparameter ("logical-volume-name", 's', omitable = true);
+  parameter->SetDefaultValue("all");
+  fpCommand->SetParameter(parameter);
+  parameter = new G4UIparameter("depth", 'd', omitable = true);
+  parameter->SetDefaultValue(0);
+  parameter->SetGuidance
+    ("Depth of propagation (-1 means unlimited depth).");
+  fpCommand->SetParameter(parameter);
+  parameter = new G4UIparameter("visibility", 'b', omitable = true);
+  parameter->SetDefaultValue(true);
+  fpCommand->SetParameter(parameter);
+}
+
+G4VisCommandGeometrySetVisibility::~G4VisCommandGeometrySetVisibility()
+{
+  delete fpCommand;
+}
+
+G4String G4VisCommandGeometrySetVisibility::GetCurrentValue(G4UIcommand*)
+{
+  return "";
+}
+
+void G4VisCommandGeometrySetVisibility::SetNewValue
+(G4UIcommand*, G4String newValue)
+{
+  G4String name;
+  G4int requestedDepth;
+  G4String visibilityString;
+  std::istringstream iss(newValue);
+  iss >> name >> requestedDepth >> visibilityString;
+  G4bool visibility = G4UIcommand::ConvertToBool(visibilityString);
+
+  G4VisCommandGeometrySetVisibilityFunction setVisibility(visibility);
+  Set(name, setVisibility, requestedDepth);
+
+  G4VViewer* pViewer = fpVisManager->GetCurrentViewer();
+  if (pViewer) {
+    const G4ViewParameters& viewParams = pViewer->GetViewParameters();
+    if (fpVisManager->GetVerbosity() >= G4VisManager::warnings) {
+      if (!viewParams.IsCulling() ||
+	  !viewParams.IsCullingInvisible()) {
+	G4cout <<
+	  "Culling must be on - \"/vis/viewer/set/culling global true\" and"
+	  "\n  \"/vis/viewer/set/culling invisible true\" - to see effect."
+	       << G4endl;
+      }
+    }
+  }
+}
Index: tags/visualization-10.5-before-10.6_test/management/src/G4VisCommandsScene.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/src/G4VisCommandsScene.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/src/G4VisCommandsScene.cc	(revision 1102)
@@ -0,0 +1,691 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VisCommandsScene.cc,v 1.68 2008/04/28 16:12:38 allison Exp $
+// GEANT4 tag $Name:  $
+
+// /vis/scene commands - John Allison  9th August 1998
+
+#include "G4VisCommandsScene.hh"
+
+#include "G4VisManager.hh"
+#include "G4TransportationManager.hh"
+#include "G4RunManager.hh"
+#include "G4Run.hh"
+#include "G4PhysicalVolumeModel.hh"
+#include "G4ApplicationState.hh"
+#include "G4UImanager.hh"
+#include "G4UIcommand.hh"
+#include "G4UIcmdWithAString.hh"
+#include "G4ios.hh"
+#include <sstream>
+
+G4VVisCommandScene::G4VVisCommandScene () {}
+
+G4VVisCommandScene::~G4VVisCommandScene () {}
+
+G4String G4VVisCommandScene::CurrentSceneName () {
+  const G4Scene* pScene = fpVisManager -> GetCurrentScene ();
+  G4String currentSceneName;
+  if (pScene) currentSceneName = pScene -> GetName ();
+  return currentSceneName;
+}
+
+////////////// /vis/scene/create ///////////////////////////////////////
+
+G4VisCommandSceneCreate::G4VisCommandSceneCreate (): fId (0) {
+  G4bool omitable;
+  fpCommand = new G4UIcmdWithAString ("/vis/scene/create", this);
+  fpCommand -> SetGuidance
+    ("Creates an empty scene.");
+  fpCommand -> SetGuidance
+    ("Invents a name if not supplied.  This scene becomes current.");
+  fpCommand -> SetParameterName ("scene-name", omitable = true);
+}
+
+G4VisCommandSceneCreate::~G4VisCommandSceneCreate () {
+  delete fpCommand;
+}
+
+G4String G4VisCommandSceneCreate::NextName () {
+  std::ostringstream oss;
+  oss << "scene-" << fId;
+  return oss.str();
+}
+
+G4String G4VisCommandSceneCreate::GetCurrentValue (G4UIcommand*) {
+  return "";
+}
+
+void G4VisCommandSceneCreate::SetNewValue (G4UIcommand*, G4String newValue) {
+
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+
+  G4String& newName = newValue;
+  G4String nextName = NextName ();
+
+  if (newName == "") {
+    newName = nextName;
+  }
+  if (newName == nextName) fId++;
+
+  G4SceneList& sceneList = fpVisManager -> SetSceneList ();
+  G4int iScene, nScenes = sceneList.size ();
+  for (iScene = 0; iScene < nScenes; iScene++) {
+    if (sceneList [iScene] -> GetName () == newName) break;
+  }
+  if (iScene < nScenes) {
+    if (verbosity >= G4VisManager::warnings) {
+      G4cout << "WARNING: Scene \"" << newName << "\" already exists."
+	     << "\n  New scene not created."
+	     << G4endl;
+    }
+  } else {
+
+    // Add empty scene data object to list...
+    G4Scene* pScene = new G4Scene (newName);
+    sceneList.push_back (pScene);
+    fpVisManager -> SetCurrentScene (pScene);
+
+    if (verbosity >= G4VisManager::confirmations) {
+      G4cout << "New empty scene \"" << newName << "\" created." << G4endl;
+    }
+  }
+}
+
+////////////// /vis/scene/endOfEventAction ////////////////////////////
+
+G4VisCommandSceneEndOfEventAction::G4VisCommandSceneEndOfEventAction () {
+  G4bool omitable;
+  fpCommand = new G4UIcommand ("/vis/scene/endOfEventAction", this);
+  fpCommand -> SetGuidance
+    ("Accumulate or refresh the viewer for each new event.");
+  fpCommand -> SetGuidance
+    ("\"accumulate\": viewer accumulates hits, etc., event by event, or");
+  fpCommand -> SetGuidance
+    ("\"refresh\": viewer shows them at end of event or, for direct-screen"
+     "\n  viewers, refreshes the screen just before drawing the next event.");
+  G4UIparameter* parameter;
+  parameter = new G4UIparameter ("action", 's', omitable = true);
+  parameter -> SetParameterCandidates ("accumulate refresh");
+  parameter -> SetDefaultValue ("refresh");
+  fpCommand -> SetParameter (parameter);
+  parameter = new G4UIparameter ("maxNumber", 'i', omitable = true);
+  parameter -> SetDefaultValue (100);
+  parameter -> SetGuidance
+  ("Maximum number of events kept.  Unlimited if negative.");
+  fpCommand -> SetParameter (parameter);
+}
+
+G4VisCommandSceneEndOfEventAction::~G4VisCommandSceneEndOfEventAction () {
+  delete fpCommand;
+}
+
+G4String G4VisCommandSceneEndOfEventAction::GetCurrentValue(G4UIcommand*) {
+  return "";
+}
+
+void G4VisCommandSceneEndOfEventAction::SetNewValue (G4UIcommand*,
+						     G4String newValue) {
+
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+
+  G4String action;
+  G4int maxNumberOfKeptEvents;
+  std::istringstream is (newValue);
+  is >> action >> maxNumberOfKeptEvents;
+
+  G4Scene* pScene = fpVisManager->GetCurrentScene();
+  if (!pScene) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout <<	"ERROR: No current scene.  Please create one." << G4endl;
+    }
+    return;
+  }
+
+  G4VSceneHandler* pSceneHandler = fpVisManager->GetCurrentSceneHandler();
+  if (!pSceneHandler) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout <<	"ERROR: No current sceneHandler.  Please create one." << G4endl;
+    }
+    return;
+  }
+
+  if (action == "accumulate") {
+    pScene->SetRefreshAtEndOfEvent(false);
+    pScene->SetMaxNumberOfKeptEvents(maxNumberOfKeptEvents);
+  }
+  else if (action == "refresh") {
+    if (!pScene->GetRefreshAtEndOfRun()) {
+      if (verbosity >= G4VisManager::errors) {
+	G4cout <<
+	  "ERROR: Cannot refresh events unless runs refresh too."
+	  "\n  Use \"/vis/scene/endOfRun refresh\"."
+	       << G4endl;
+      }
+    } else {
+      pScene->SetRefreshAtEndOfEvent(true);
+      pSceneHandler->SetMarkForClearingTransientStore(true);
+    }
+  }
+  else {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout <<
+	"ERROR: unrecognised parameter \"" << action << "\"."
+             << G4endl;
+    }
+    return;
+  }
+
+  // Change of transients behaviour, so...
+  fpVisManager->ResetTransientsDrawnFlags();
+
+  // Are there any events currently kept...
+  size_t nCurrentlyKept = 0;
+  G4RunManager* runManager = G4RunManager::GetRunManager();
+  if (runManager) {
+    const G4Run* currentRun = runManager->GetCurrentRun();
+    if (currentRun) {
+      const std::vector<const G4Event*>* events =
+	currentRun->GetEventVector();
+      if (events) nCurrentlyKept = events->size();
+    }
+  }
+
+  if (verbosity >= G4VisManager::confirmations) {
+    G4cout << "End of event action set to ";
+    if (pScene->GetRefreshAtEndOfEvent()) G4cout << "\"refresh\".";
+    else {
+      G4cout << "\"accumulate\"."
+	"\n  Maximum number of events to be kept: "
+	     << maxNumberOfKeptEvents
+	     << " (unlimited if negative)."
+	"\n  This may be changed with, e.g., "
+	"\"/vis/scene/endOfEventAction accumulate 1000\".";
+    }
+    G4cout << G4endl;
+  }
+
+  if (!pScene->GetRefreshAtEndOfEvent() &&
+      maxNumberOfKeptEvents != 0 &&
+      verbosity >= G4VisManager::warnings) {
+    G4cout << "WARNING: ";
+    if (nCurrentlyKept) {
+      G4cout <<
+	"\n  There are currently " << nCurrentlyKept
+	     << " events kept for refreshing and/or reviewing.";
+    } else {
+      G4cout << "The vis manager will keep ";
+      if (maxNumberOfKeptEvents < 0) G4cout << "an unlimited number of";
+      else G4cout << "up to " << maxNumberOfKeptEvents;
+      G4cout << " events.";
+      if (maxNumberOfKeptEvents > 1 || maxNumberOfKeptEvents < 0)
+	G4cout <<
+	  "\n  This may use a lot of memory."
+	  "\n  It may be changed with, e.g., "
+	  "\"/vis/scene/endOfEventAction accumulate 10\".";
+    }
+    G4cout << G4endl;
+  }
+}
+
+////////////// /vis/scene/endOfRunAction ////////////////////////////
+
+G4VisCommandSceneEndOfRunAction::G4VisCommandSceneEndOfRunAction () {
+  G4bool omitable;
+  fpCommand = new G4UIcmdWithAString ("/vis/scene/endOfRunAction", this);
+  fpCommand -> SetGuidance
+    ("Accumulate or refresh the viewer for each new run.");
+  fpCommand -> SetGuidance
+    ("\"accumulate\": viewer accumulates hits, etc., run by run, or");
+  fpCommand -> SetGuidance
+    ("\"refresh\": viewer shows them at end of run or, for direct-screen"
+     "\n  viewers, refreshes the screen just before drawing the first"
+     "\n  event of the next run.");
+  fpCommand -> SetGuidance ("The detector remains or is redrawn.");
+  fpCommand -> SetParameterName ("action", omitable = true);
+  fpCommand -> SetCandidates ("accumulate refresh");
+  fpCommand -> SetDefaultValue ("refresh");
+}
+
+G4VisCommandSceneEndOfRunAction::~G4VisCommandSceneEndOfRunAction () {
+  delete fpCommand;
+}
+
+G4String G4VisCommandSceneEndOfRunAction::GetCurrentValue(G4UIcommand*) {
+  return "";
+}
+
+void G4VisCommandSceneEndOfRunAction::SetNewValue (G4UIcommand*,
+						     G4String newValue) {
+
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+
+  G4String action;
+  std::istringstream is (newValue);
+  is >> action;
+
+  G4Scene* pScene = fpVisManager->GetCurrentScene();
+  if (!pScene) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout <<	"ERROR: No current scene.  Please create one." << G4endl;
+    }
+    return;
+  }
+
+  G4VSceneHandler* pSceneHandler = fpVisManager->GetCurrentSceneHandler();
+  if (!pSceneHandler) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout <<	"ERROR: No current sceneHandler.  Please create one." << G4endl;
+    }
+    return;
+  }
+
+  if (action == "accumulate") {
+    if (pScene->GetRefreshAtEndOfEvent()) {
+      if (verbosity >= G4VisManager::errors) {
+	G4cout <<
+	  "ERROR: Cannot accumulate runs unless events accumulate too."
+	  "\n  Use \"/vis/scene/endOfEventAction accumulate\"."
+	       << G4endl;
+      }
+    }
+    else {
+      pScene->SetRefreshAtEndOfRun(false);
+    }
+  }
+  else if (action == "refresh") {
+    pScene->SetRefreshAtEndOfRun(true);
+    pSceneHandler->SetMarkForClearingTransientStore(true);
+  }
+  else {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout <<
+	"ERROR: unrecognised parameter \"" << action << "\"."
+             << G4endl;
+    }
+    return;
+  }
+
+  // Change of transients behaviour, so...
+  fpVisManager->ResetTransientsDrawnFlags();
+
+  if (verbosity >= G4VisManager::confirmations) {
+    G4cout << "End of run action set to \"";
+    if (pScene->GetRefreshAtEndOfRun()) G4cout << "refresh";
+    else G4cout << "accumulate";
+    G4cout << "\"" << G4endl;
+  }
+}
+
+////////////// /vis/scene/list ///////////////////////////////////////
+
+G4VisCommandSceneList::G4VisCommandSceneList () {
+  G4bool omitable;
+  fpCommand = new G4UIcommand ("/vis/scene/list", this);
+  fpCommand -> SetGuidance ("Lists scene(s).");
+  fpCommand -> SetGuidance
+    ("\"help /vis/verbose\" for definition of verbosity.");
+  G4UIparameter* parameter;
+  parameter = new G4UIparameter ("scene-name", 's', omitable = true);
+  parameter -> SetDefaultValue ("all");
+  fpCommand -> SetParameter (parameter);
+  parameter = new G4UIparameter ("verbosity", 's', omitable = true);
+  parameter -> SetDefaultValue ("warnings");
+  fpCommand -> SetParameter (parameter);
+}
+
+G4VisCommandSceneList::~G4VisCommandSceneList () {
+  delete fpCommand;
+}
+
+G4String G4VisCommandSceneList::GetCurrentValue (G4UIcommand*) {
+  return "";
+}
+
+void G4VisCommandSceneList::SetNewValue (G4UIcommand*, G4String newValue) {
+  G4String name, verbosityString;
+  std::istringstream is (newValue);
+  is >> name >> verbosityString;
+  G4VisManager::Verbosity verbosity =
+    fpVisManager->GetVerbosityValue(verbosityString);
+  const G4Scene* currentScene = fpVisManager -> GetCurrentScene ();
+  G4String currentName;
+  if (currentScene) currentName = currentScene->GetName();
+
+  G4SceneList& sceneList = fpVisManager -> SetSceneList ();
+  G4int iScene, nScenes = sceneList.size ();
+  G4bool found = false;
+  for (iScene = 0; iScene < nScenes; iScene++) {
+    G4Scene* pScene = sceneList [iScene];
+    const G4String& iName = pScene -> GetName ();
+    if (name != "all") {
+      if (name != iName) continue;
+    }
+    found = true;
+    if (iName == currentName) {
+      G4cout << "  (current)";
+    }
+    else {
+      G4cout << "           ";
+    }
+    G4cout << " scene \"" << iName << "\"";
+    if (verbosity >= G4VisManager::confirmations) {
+      G4int i;
+      G4cout << "\n  Run-duration models:";
+      G4int nRunModels = pScene -> GetRunDurationModelList ().size ();
+      if (nRunModels == 0) {
+	G4cout << " none.";
+      }
+      for (i = 0; i < nRunModels; i++) {
+	G4VModel* pModel = pScene -> GetRunDurationModelList () [i];
+	G4cout << "\n    " << pModel -> GetGlobalDescription ();
+      }
+      G4cout << "\n  End-of-event models:";
+      G4int nEOEModels = pScene -> GetEndOfEventModelList ().size ();
+      if (nEOEModels == 0) {
+	G4cout << " none.";
+      }
+      for (i = 0; i < nEOEModels; i++) {
+	G4VModel* pModel = pScene -> GetEndOfEventModelList () [i];
+	G4cout << "\n    " << pModel -> GetGlobalDescription ();
+      }
+    }
+    if (verbosity >= G4VisManager::parameters) {
+      G4cout << "\n  " << *sceneList [iScene];
+    }
+    G4cout << G4endl;
+  }
+  if (!found) {
+    G4cout << "No scenes found";
+    if (name != "all") {
+      G4cout << " of name \"" << name << "\"";
+    }
+    G4cout << "." << G4endl;
+  }
+}
+
+////////////// /vis/scene/notifyHandlers /////////////////////////
+
+G4VisCommandSceneNotifyHandlers::G4VisCommandSceneNotifyHandlers () {
+  G4bool omitable;
+  fpCommand = new G4UIcommand ("/vis/scene/notifyHandlers", this);
+  fpCommand -> SetGuidance
+    ("Notifies scene handlers and forces re-rendering.");
+  fpCommand -> SetGuidance
+    ("Notifies the handler(s) of the specified scene and forces a"
+     "\nreconstruction of any graphical databases."
+     "\nClears and refreshes all viewers of current scene."
+     "\n  The default action \"refresh\" does not issue \"update\" (see"
+     "\n    /vis/viewer/update)."
+     "\nIf \"flush\" is specified, it issues an \"update\" as well as"
+     "\n  \"refresh\" - \"update\" and initiates post-processing"
+     "\n  for graphics systems which need it.");
+  fpCommand -> SetGuidance 
+    ("The default for <scene-name> is the current scene name.");
+  fpCommand -> SetGuidance
+    ("This command does not change current scene, scene handler or viewer.");
+  G4UIparameter* parameter;
+  parameter = new G4UIparameter ("scene-name", 's',
+				 omitable = true);
+  parameter -> SetCurrentAsDefault(true);
+  fpCommand -> SetParameter (parameter);
+  parameter = new G4UIparameter ("refresh-flush", 's',
+				 omitable = true);
+  parameter -> SetDefaultValue("refresh");
+  parameter -> SetParameterCandidates("r refresh f flush");
+  fpCommand -> SetParameter (parameter);
+}
+
+G4VisCommandSceneNotifyHandlers::~G4VisCommandSceneNotifyHandlers () {
+  delete fpCommand;
+}
+
+G4String G4VisCommandSceneNotifyHandlers::GetCurrentValue(G4UIcommand*) {
+  return CurrentSceneName ();
+}
+
+void G4VisCommandSceneNotifyHandlers::SetNewValue (G4UIcommand*,
+						   G4String newValue) {
+
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+
+  G4String sceneName, refresh_flush;
+  std::istringstream is (newValue);
+  is >> sceneName >> refresh_flush;
+  G4bool flush = false;
+  if (refresh_flush(0) == 'f') flush = true;
+
+  const G4SceneList& sceneList = fpVisManager -> GetSceneList ();
+  G4SceneHandlerList& sceneHandlerList =
+    fpVisManager -> SetAvailableSceneHandlers ();
+
+  // Check scene name.
+  const G4int nScenes = sceneList.size ();
+  G4int iScene;
+  for (iScene = 0; iScene < nScenes; iScene++) {
+    G4Scene* scene = sceneList [iScene];
+    if (sceneName == scene -> GetName ()) break;
+  }
+  if (iScene >= nScenes ) {
+    if (verbosity >= G4VisManager::warnings) {
+      G4cout << "WARNING: Scene \"" << sceneName << "\" not found."
+	"\n  /vis/scene/list to see scenes."
+	     << G4endl;
+    }
+    return;
+  }
+
+  // Store current context...
+  G4VSceneHandler* pCurrentSceneHandler =
+    fpVisManager -> GetCurrentSceneHandler();
+  if (!pCurrentSceneHandler) {
+    if (verbosity >= G4VisManager::warnings) {
+      G4cout << "WARNING: No current scene handler."
+	     << G4endl;
+    }
+    return;
+  }
+  G4VViewer* pCurrentViewer = fpVisManager -> GetCurrentViewer();
+  if (!pCurrentViewer) {
+    if (verbosity >= G4VisManager::warnings) {
+      G4cout << "WARNING: No current viewer."
+	     << G4endl;
+    }
+    return;
+  }
+  G4Scene* pCurrentScene = fpVisManager -> GetCurrentScene();
+  if (!pCurrentScene) {
+    if (verbosity >= G4VisManager::warnings) {
+      G4cout << "WARNING: No current scene."
+	     << G4endl;
+    }
+    return;
+  }
+  G4VisManager::Verbosity currentVerbosity = fpVisManager -> GetVerbosity();
+
+  // Suppress messages during this process (only print errors)...
+  //fpVisManager -> SetVerboseLevel(G4VisManager::errors);
+
+  // For each scene handler, if it contains the scene, clear and
+  // rebuild the graphical database, then for each viewer set (make
+  // current), clear, (re)draw, and show.
+  const G4int nSceneHandlers = sceneHandlerList.size ();
+  for (G4int iSH = 0; iSH < nSceneHandlers; iSH++) {
+    G4VSceneHandler* aSceneHandler = sceneHandlerList [iSH];
+    G4Scene* aScene = aSceneHandler -> GetScene ();
+    if (aScene) {
+      const G4String& aSceneName = aScene -> GetName ();
+      if (sceneName == aSceneName) {
+	// Clear store and force a rebuild of graphical database...
+	//aSceneHandler -> ClearStore (); // Not nec??  Done below
+	//with NeedKernelVisit and DrawView.  JA.
+	G4ViewerList& viewerList = aSceneHandler -> SetViewerList ();
+	const G4int nViewers = viewerList.size ();
+	for (G4int iV = 0; iV < nViewers; iV++) {
+	  G4VViewer* aViewer = viewerList [iV];
+	  if (aViewer->GetViewParameters().IsAutoRefresh()) {
+	    aSceneHandler -> SetCurrentViewer (aViewer);
+	    // Ensure consistency of vis manager...
+	    fpVisManager -> SetCurrentViewer(aViewer);
+	    fpVisManager -> SetCurrentSceneHandler(aSceneHandler);
+	    fpVisManager -> SetCurrentScene(aScene);
+	    // Re-draw, forcing rebuild of graphics database, if any...
+	    aViewer -> NeedKernelVisit();
+#ifdef G4DEBUG_VIS_MANAGEMENT
+            G4cout << "G4VisCommandSceneNotifyHandlers::SetNewValue."	     << G4endl;
+            printf("\n\nG4VisCommandSceneNotifyHandlers::SetNewValue ---%s--- Call SetView() 1\n",newValue.data());
+#endif
+	    aViewer -> SetView ();
+#ifdef G4DEBUG_VIS_MANAGEMENT
+            printf("G4VisCommandSceneNotifyHandlers::SetNewValue Call SetView() END 2\n");
+            printf("G4VisCommandSceneNotifyHandlers::SetNewValue Call ClearView() 3\n");
+#endif
+	    aViewer -> ClearView ();
+#ifdef G4DEBUG_VIS_MANAGEMENT
+            printf("G4VisCommandSceneNotifyHandlers::SetNewValue Call ClearView() END 4\n");
+            printf("G4VisCommandSceneNotifyHandlers::SetNewValue Call DrawView() 5\n");
+#endif
+	    aViewer -> DrawView ();
+#ifdef G4DEBUG_VIS_MANAGEMENT
+            printf("G4VisCommandSceneNotifyHandlers::SetNewValue Call DrawView() END 6\n");
+#endif
+	    if (flush) aViewer -> ShowView ();
+	    if (verbosity >= G4VisManager::confirmations) {
+	      G4cout << "Viewer \"" << aViewer -> GetName ()
+		     << "\" of scene handler \"" << aSceneHandler -> GetName ()
+		     << "\"\n  ";
+	      if (flush) G4cout << "flushed";
+	      else G4cout << "refreshed";
+	      G4cout << " at request of scene \"" << sceneName
+		     << "\"." << G4endl;
+	    }
+	  } else {
+	    if (verbosity >= G4VisManager::warnings) {
+	      G4cout << "WARNING: The scene, \""
+		     << sceneName
+		     << "\", of viewer \""
+		     << aViewer -> GetName ()
+		     << "\"\n  of scene handler \""
+		     << aSceneHandler -> GetName ()
+		     << "\"  has changed.  To see effect,"
+		     << "\n  \"/vis/viewer/select "
+		     << aViewer -> GetShortName ()
+		     << "\" and \"/vis/viewer/rebuild\"."
+		     << G4endl;
+	    }
+	  }
+	}
+      }
+    }
+    else {
+      if (verbosity >= G4VisManager::warnings) {
+	G4cout << "WARNING: G4VisCommandSceneNotifyHandlers: scene handler \""
+	       << aSceneHandler->GetName()
+	       << "\" has a null scene."
+	       << G4endl;
+      }
+    }
+  }
+
+  // Reclaim original context - but set viewer first, then scene
+  // handler, because the latter might have been created very recently
+  // and, not yet having a viewer, the current viewer will,
+  // temporarily, refer to another scene handler.  SetCurrentViewer
+  // actually resets the scene handler, which is what we don't want,
+  // so we set it again on the next line...
+  fpVisManager -> SetCurrentViewer(pCurrentViewer);
+  fpVisManager -> SetCurrentSceneHandler(pCurrentSceneHandler);
+  fpVisManager -> SetCurrentScene(pCurrentScene);
+  fpVisManager -> SetVerboseLevel(currentVerbosity);
+  // Take care of special case of scene handler with no viewer yet.  
+  if (pCurrentSceneHandler) {
+    G4ViewerList& viewerList = pCurrentSceneHandler -> SetViewerList ();
+    const G4int nViewers = viewerList.size ();
+    if (nViewers) {
+      pCurrentSceneHandler -> SetCurrentViewer (pCurrentViewer);
+      if (pCurrentViewer && pCurrentSceneHandler->GetScene()) {
+#ifdef G4DEBUG_VIS_MANAGEMENT
+            printf("G4VisCommandSceneNotifyHandlers::SetNewValue Call SetView() 7\n");
+#endif
+	pCurrentViewer -> SetView ();
+#ifdef G4DEBUG_VIS_MANAGEMENT
+            printf("G4VisCommandSceneNotifyHandlers::SetNewValue Call SetView() END 8\n");
+#endif
+      }
+    }
+  }
+#ifdef G4DEBUG_VIS_MANAGEMENT
+            G4cout << "G4VisCommandSceneNotifyHandlers::SetNewValue.  END"	     << G4endl;
+            printf("G4VisCommandSceneNotifyHandlers::SetNewValue END 99\n\n\n");
+#endif
+}
+
+////////////// /vis/scene/select ///////////////////////////////////////
+
+G4VisCommandSceneSelect::G4VisCommandSceneSelect () {
+  G4bool omitable;
+  fpCommand = new G4UIcmdWithAString ("/vis/scene/select", this);
+  fpCommand -> SetGuidance ("Selects a scene");
+  fpCommand -> SetGuidance 
+    ("Makes the scene current.  \"/vis/scene/list\" to see"
+     "\n possible scene names.");
+  fpCommand -> SetParameterName ("scene-name", omitable = false);
+}
+
+G4VisCommandSceneSelect::~G4VisCommandSceneSelect () {
+  delete fpCommand;
+}
+
+G4String G4VisCommandSceneSelect::GetCurrentValue (G4UIcommand*) {
+  return "";
+}
+
+void G4VisCommandSceneSelect::SetNewValue (G4UIcommand*, G4String newValue) {
+
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+
+  G4String& selectName = newValue;
+  G4SceneList& sceneList = fpVisManager -> SetSceneList ();
+  G4int iScene, nScenes = sceneList.size ();
+  for (iScene = 0; iScene < nScenes; iScene++) {
+    if (sceneList [iScene] -> GetName () == selectName) break;
+  }
+  if (iScene >= nScenes) {
+    if (verbosity >= G4VisManager::warnings) {
+      G4cout << "WARNING: Scene \"" << selectName
+	     << "\" not found - \"/vis/scene/list\" to see possibilities."
+	     << G4endl;
+    }
+    return;
+  }
+
+  if (verbosity >= G4VisManager::confirmations) {
+    G4cout << "Scene \"" << selectName
+	   << "\" selected." << G4endl;
+  }
+  UpdateVisManagerScene (selectName);
+}
Index: tags/visualization-10.5-before-10.6_test/management/src/G4VisCommandsSceneAdd.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/src/G4VisCommandsSceneAdd.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/src/G4VisCommandsSceneAdd.cc	(revision 1102)
@@ -0,0 +1,1790 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VisCommandsSceneAdd.cc,v 1.74 2009/07/24 09:20:52 lgarnier Exp $
+// GEANT4 tag $Name:  $
+// /vis/scene commands - John Allison  9th August 1998
+
+#include "G4VisCommandsSceneAdd.hh"
+
+#include "G4TransportationManager.hh"
+#include "G4LogicalVolumeStore.hh"
+#include "G4PhysicalVolumeModel.hh"
+#include "G4LogicalVolumeModel.hh"
+#include "G4ModelingParameters.hh"
+#include "G4HitsModel.hh"
+#include "G4TrajectoriesModel.hh"
+#include "G4ScaleModel.hh"
+#include "G4TextModel.hh"
+#include "G4AxesModel.hh"
+#include "G4PhysicalVolumeSearchScene.hh"
+#include "G4VGlobalFastSimulationManager.hh"
+#include "G4ParticleTable.hh"
+#include "G4ParticleDefinition.hh"
+#include "G4FlavoredParallelWorldModel.hh"
+#include "G4ApplicationState.hh"
+#include "G4VUserVisAction.hh"
+#include "G4CallbackModel.hh"
+#include "G4UnionSolid.hh"
+#include "G4SubtractionSolid.hh"
+#include "G4Polyhedron.hh"
+#include "G4UImanager.hh"
+#include "G4UIcommand.hh"
+#include "G4UIcmdWithAString.hh"
+#include "G4UIcmdWithoutParameter.hh"
+#include "G4Tokenizer.hh"
+#include "G4RunManager.hh"
+#include "G4StateManager.hh"
+#include "G4Run.hh"
+#include "G4Event.hh"
+#include "G4IdentityTrajectoryFilter.hh"
+#include "G4TransportationManager.hh"
+#include "G4PropagatorInField.hh"
+#include "G4RichTrajectory.hh"
+#include "G4AttDef.hh"
+#include "G4ios.hh"
+#include <sstream>
+
+// Local function with some frequently used error printing...
+static void G4VisCommandsSceneAddUnsuccessful
+(G4VisManager::Verbosity verbosity) {
+  if (verbosity >= G4VisManager::warnings) {
+    G4cout <<
+      "WARNING: For some reason, possibly mentioned above, it has not been"
+      "\n  possible to add to the scene."
+	   << G4endl;
+  }
+}
+
+////////////// /vis/scene/add/axes //////////////////////////////////
+
+G4VisCommandSceneAddAxes::G4VisCommandSceneAddAxes () {
+  G4bool omitable;
+  fpCommand = new G4UIcommand ("/vis/scene/add/axes", this);
+  fpCommand -> SetGuidance ("Add axes.");
+  fpCommand -> SetGuidance
+    ("Draws axes at (x0, y0, z0) of given length.");
+  G4UIparameter* parameter;
+  parameter =  new G4UIparameter ("x0", 'd', omitable = true);
+  parameter->SetDefaultValue (0.);
+  fpCommand->SetParameter (parameter);
+  parameter =  new G4UIparameter ("y0", 'd', omitable = true);
+  parameter->SetDefaultValue (0.);
+  fpCommand->SetParameter (parameter);
+  parameter =  new G4UIparameter ("z0", 'd', omitable = true);
+  parameter->SetDefaultValue (0.);
+  fpCommand->SetParameter (parameter);
+  parameter =  new G4UIparameter ("length", 'd', omitable = true);
+  parameter->SetDefaultValue (1.);
+  fpCommand->SetParameter (parameter);
+  parameter =  new G4UIparameter ("unit", 's', omitable = true);
+  parameter->SetDefaultValue  ("m");
+  fpCommand->SetParameter     (parameter);
+}
+
+G4VisCommandSceneAddAxes::~G4VisCommandSceneAddAxes () {
+  delete fpCommand;
+}
+
+G4String G4VisCommandSceneAddAxes::GetCurrentValue (G4UIcommand*) {
+  return "";
+}
+
+void G4VisCommandSceneAddAxes::SetNewValue (G4UIcommand*, G4String newValue) {
+
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+  G4bool warn(verbosity >= G4VisManager::warnings);
+
+  G4Scene* pScene = fpVisManager->GetCurrentScene();
+  if (!pScene) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout <<	"ERROR: No current scene.  Please create one." << G4endl;
+    }
+    return;
+  }
+
+  G4String unitString;
+  G4double x0, y0, z0, length;
+  std::istringstream is (newValue);
+  is >> x0 >> y0 >> z0 >> length >> unitString;
+
+  G4double unit = G4UIcommand::ValueOf(unitString);
+  x0 *= unit; y0 *= unit; z0 *= unit; length *= unit;
+
+  G4VModel* model = new G4AxesModel(x0, y0, z0, length);
+
+  model->SetExtent(G4VisExtent(x0 - length, x0 + length,
+			       y0 - length, y0 + length,
+			       z0 - length, z0 + length));
+  // This extent gets "added" to existing scene extent in
+  // AddRunDurationModel below.
+
+  const G4String& currentSceneName = pScene -> GetName ();
+  G4bool successful = pScene -> AddRunDurationModel (model, warn);
+  if (successful) {
+    if (verbosity >= G4VisManager::confirmations) {
+      G4cout << "Axes have been added to scene \"" << currentSceneName << "\"."
+	     << G4endl;
+    }
+  }
+  else G4VisCommandsSceneAddUnsuccessful(verbosity);
+  UpdateVisManagerScene (currentSceneName);
+}
+
+
+////////////// /vis/scene/add/eventID ///////////////////////////////////////
+
+G4VisCommandSceneAddEventID::G4VisCommandSceneAddEventID () {
+  G4bool omitable;
+  fpCommand = new G4UIcommand ("/vis/scene/add/eventID", this);
+  fpCommand -> SetGuidance ("Adds eventID to current scene.");
+  fpCommand -> SetGuidance
+    ("Run and event numbers are drawn at end of event or run when"
+     "\n the scene in which they are added is current.");
+  G4UIparameter* parameter;
+  parameter = new G4UIparameter ("size", 'i', omitable = true);
+  parameter -> SetGuidance ("Screen size of text in pixels.");
+  parameter -> SetDefaultValue (18);
+  fpCommand -> SetParameter (parameter);
+  parameter = new G4UIparameter ("x-position", 'd', omitable = true);
+  parameter -> SetGuidance ("x screen position in range -1 < x < 1.");
+  parameter -> SetDefaultValue (-0.95);
+  fpCommand -> SetParameter (parameter);
+  parameter = new G4UIparameter ("y-position", 'd', omitable = true);
+  parameter -> SetGuidance ("y screen position in range -1 < y < 1.");
+  parameter -> SetDefaultValue (0.9);
+  fpCommand -> SetParameter (parameter);
+}
+
+G4VisCommandSceneAddEventID::~G4VisCommandSceneAddEventID () {
+  delete fpCommand;
+}
+
+G4String G4VisCommandSceneAddEventID::GetCurrentValue (G4UIcommand*) {
+  return "";
+}
+
+void G4VisCommandSceneAddEventID::SetNewValue (G4UIcommand*, G4String newValue)
+{
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+  G4bool warn(verbosity >= G4VisManager::warnings);
+
+  G4Scene* pScene = fpVisManager->GetCurrentScene();
+  if (!pScene) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout <<	"ERROR: No current scene.  Please create one." << G4endl;
+    }
+    return;
+  }
+
+  G4int size;
+  G4double x, y;
+  std::istringstream is(newValue);
+  is >> size >> x >> y;
+
+  EventID* eventID = new EventID(fpVisManager, size, x, y);
+  G4VModel* model =
+    new G4CallbackModel<G4VisCommandSceneAddEventID::EventID>(eventID);
+  model->SetGlobalDescription("EventID");
+  model->SetGlobalTag("EventID");
+  const G4String& currentSceneName = pScene -> GetName ();
+  G4bool successful = pScene -> AddEndOfEventModel (model, warn);
+  if (successful) {
+    if (verbosity >= G4VisManager::confirmations) {
+      G4cout << "EventID will be drawn in scene \""
+	     << currentSceneName << "\"."
+	     << G4endl;
+    }
+  }
+  else G4VisCommandsSceneAddUnsuccessful(verbosity);
+  UpdateVisManagerScene (currentSceneName);
+}
+
+void G4VisCommandSceneAddEventID::EventID::operator()
+  (G4VGraphicsScene& sceneHandler, const G4Transform3D&)
+{
+  const G4Run* currentRun = 0;
+  G4RunManager* runManager = G4RunManager::GetRunManager();
+  if (runManager)  currentRun = runManager->GetCurrentRun();
+
+  G4VModel* model = fpVisManager->GetCurrentSceneHandler()->GetModel();
+  const G4ModelingParameters* mp;
+  const G4Event* currentEvent;
+  if (model) {
+   mp = model->GetModelingParameters();
+   currentEvent = mp->GetEvent();
+  } else {
+    G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+    if (verbosity >= G4VisManager::errors) {
+      G4cout <<	"ERROR: No model defined for this SceneHandler : "<< fpVisManager->GetCurrentSceneHandler()->GetName() << G4endl;
+    }
+  }
+  if (currentRun && currentEvent) {
+    G4int runID = currentRun->GetRunID();
+    G4int eventID = currentEvent->GetEventID();
+    std::ostringstream oss;
+    if (fpVisManager->GetCurrentScene()->GetRefreshAtEndOfEvent()) {
+      oss << "Run " << runID << " Event " << eventID;
+    } else {
+      G4int nEvents = 0;
+      G4StateManager* stateManager = G4StateManager::GetStateManager();
+      G4ApplicationState state = stateManager->GetCurrentState();
+      if (state == G4State_EventProc) {
+	nEvents = currentRun->GetNumberOfEventToBeProcessed();
+      } else {
+	const std::vector<const G4Event*>* events =
+	  currentRun? currentRun->GetEventVector(): 0;
+	if (events) nEvents = events->size();
+      }
+      if (eventID < nEvents - 1) return;  // Not last event.
+      else {
+	oss << "Run " << runID << " (" << nEvents << " accumulated events)";
+      }
+    }
+    G4Text text(oss.str(), G4Point3D(fX, fY, 0.));
+    text.SetScreenSize(fSize);
+    G4VisAttributes textAtts(G4Colour(0.,1.,1));
+    text.SetVisAttributes(textAtts);
+    sceneHandler.BeginPrimitives2D();
+    sceneHandler.AddPrimitive(text);
+    sceneHandler.EndPrimitives2D();
+  }
+}
+
+////////////// /vis/scene/add/ghosts ///////////////////////////////////////
+
+G4VisCommandSceneAddGhosts::G4VisCommandSceneAddGhosts () {
+  G4bool omitable;
+  fpCommand = new G4UIcmdWithAString ("/vis/scene/add/ghosts", this);
+  fpCommand -> SetGuidance
+    ("Adds ghost volumes (G4FlavoredParallelWorld) to the current scene.");
+  fpCommand -> SetGuidance ("Selects by particle.");
+  fpCommand -> SetParameterName ("particle", omitable = true);
+  fpCommand -> SetDefaultValue ("all");
+}
+
+G4VisCommandSceneAddGhosts::~G4VisCommandSceneAddGhosts () {
+  delete fpCommand;
+}
+
+G4String G4VisCommandSceneAddGhosts::GetCurrentValue (G4UIcommand*) {
+  return "";
+}
+
+void G4VisCommandSceneAddGhosts::SetNewValue(G4UIcommand*, G4String newValue) {
+
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+  G4bool warn(verbosity >= G4VisManager::warnings);
+
+  G4Scene* pScene = fpVisManager->GetCurrentScene();
+  if (!pScene) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout <<	"ERROR: No current scene.  Please create one." << G4endl;
+    }
+    return;
+  }
+  const G4String& currentSceneName = pScene -> GetName ();
+
+  // Gets the G4GlobalFastSimulationManager pointer if any.
+  G4VGlobalFastSimulationManager* theGlobalFastSimulationManager;
+  if(!(theGlobalFastSimulationManager = 
+       G4VGlobalFastSimulationManager::GetConcreteInstance ())){
+    if (verbosity >= G4VisManager::errors) {
+      G4cout << "ERROR: no G4GlobalFastSimulationManager" << G4endl;
+    }
+    return;
+  }
+  
+  // Gets the G4ParticleTable pointer.
+  G4ParticleTable* theParticleTable=G4ParticleTable::GetParticleTable();
+  
+  // If "all" (the default) loops on all known particles
+  if(newValue=="all") 
+    {
+      G4VFlavoredParallelWorld* CurrentFlavoredWorld = 0;
+      G4bool successful = false;
+      for (G4int iParticle=0; iParticle<theParticleTable->entries(); 
+	   iParticle++)
+	{
+	  CurrentFlavoredWorld = theGlobalFastSimulationManager->
+	    GetFlavoredWorldForThis(theParticleTable->GetParticle(iParticle));
+	  
+	  if(CurrentFlavoredWorld)
+	    successful = successful || pScene -> 
+	      AddRunDurationModel(new G4FlavoredParallelWorldModel 
+				  (CurrentFlavoredWorld), warn);
+	}
+      if (successful) 
+	{
+	  if (verbosity >= G4VisManager::confirmations) 
+	    G4cout << "Ghosts have been added to scene \""
+		   << currentSceneName << "\"."
+		   << G4endl;
+	  UpdateVisManagerScene (currentSceneName);
+	}
+      else 
+	{
+	  G4cout << "ERROR: There are no ghosts."<<G4endl;
+	  G4VisCommandsSceneAddUnsuccessful(verbosity);
+	}
+      return;
+    }
+  
+  // Given a particle name looks just for the concerned Ghosts, if any.
+  G4ParticleDefinition* currentParticle = 
+    theParticleTable->FindParticle(newValue);
+  
+  if (currentParticle == NULL) 
+    {
+      if (verbosity >= G4VisManager::errors) 
+	G4cout << "ERROR: \"" << newValue
+	       << "\": not found this particle name!" << G4endl;
+      return;
+    }
+  
+  G4VFlavoredParallelWorld* worldForThis =
+    theGlobalFastSimulationManager->GetFlavoredWorldForThis(currentParticle);
+  if(worldForThis) 
+    {
+      G4bool successful = pScene -> AddRunDurationModel
+	(new G4FlavoredParallelWorldModel (worldForThis), warn);
+      if (successful) {
+	if (verbosity >= G4VisManager::confirmations) 
+	  G4cout << "Ghosts have been added to scene \""
+		 << currentSceneName << "\"."
+		 << G4endl;
+	UpdateVisManagerScene (currentSceneName);
+      }
+    }
+  else 
+    if (verbosity >= G4VisManager::errors) 
+      {
+	G4cout << "ERROR: There are no ghosts for \""<<newValue<<"\""<<G4endl;
+	G4VisCommandsSceneAddUnsuccessful(verbosity);
+      }
+}
+
+
+////////////// /vis/scene/add/hits ///////////////////////////////////////
+
+G4VisCommandSceneAddHits::G4VisCommandSceneAddHits () {
+  fpCommand = new G4UIcmdWithoutParameter ("/vis/scene/add/hits", this);
+  fpCommand -> SetGuidance ("Adds hits to current scene.");
+  fpCommand -> SetGuidance
+    ("Hits are drawn at end of event when the scene in which"
+     "\nthey are added is current.");
+}
+
+G4VisCommandSceneAddHits::~G4VisCommandSceneAddHits () {
+  delete fpCommand;
+}
+
+G4String G4VisCommandSceneAddHits::GetCurrentValue (G4UIcommand*) {
+  return "";
+}
+
+void G4VisCommandSceneAddHits::SetNewValue (G4UIcommand*, G4String) {
+
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+  G4bool warn(verbosity >= G4VisManager::warnings);
+
+  G4Scene* pScene = fpVisManager->GetCurrentScene();
+  if (!pScene) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout <<	"ERROR: No current scene.  Please create one." << G4endl;
+    }
+    return;
+  }
+
+  G4HitsModel* model = new G4HitsModel;
+  const G4String& currentSceneName = pScene -> GetName ();
+  G4bool successful = pScene -> AddEndOfEventModel (model, warn);
+  if (successful) {
+    if (verbosity >= G4VisManager::confirmations) {
+      G4cout << "Hits will be drawn in scene \""
+	     << currentSceneName << "\"."
+	     << G4endl;
+    }
+  }
+  else G4VisCommandsSceneAddUnsuccessful(verbosity);
+  UpdateVisManagerScene (currentSceneName);
+}
+
+////////////// /vis/scene/add/logicalVolume //////////////////////////////////
+
+G4VisCommandSceneAddLogicalVolume::G4VisCommandSceneAddLogicalVolume () {
+  G4bool omitable;
+  fpCommand = new G4UIcommand ("/vis/scene/add/logicalVolume", this);
+  fpCommand -> SetGuidance ("Adds a logical volume to the current scene,");
+  fpCommand -> SetGuidance
+    ("Shows boolean components (if any), voxels (if any) and readout geometry"
+     "\n(if any).  Note: voxels are not constructed until start of run -"
+     "\n \"/run/beamOn\".");
+  G4UIparameter* parameter;
+  parameter = new G4UIparameter ("logical-volume-name", 's', omitable = false);
+  fpCommand -> SetParameter (parameter);
+  parameter = new G4UIparameter ("depth-of-descent", 'i', omitable = true);
+  parameter -> SetGuidance ("Depth of descent of geometry hierarchy.");
+  parameter -> SetDefaultValue (1);
+  fpCommand -> SetParameter (parameter);
+  parameter = new G4UIparameter ("booleans-flag", 'b', omitable = true);
+  parameter -> SetDefaultValue (true);
+  fpCommand -> SetParameter (parameter);
+  parameter = new G4UIparameter ("voxels-flag", 'b', omitable = true);
+  parameter -> SetDefaultValue (true);
+  fpCommand -> SetParameter (parameter);
+  parameter = new G4UIparameter ("readout-flag", 'b', omitable = true);
+  parameter -> SetDefaultValue (true);
+  fpCommand -> SetParameter (parameter);
+}
+
+G4VisCommandSceneAddLogicalVolume::~G4VisCommandSceneAddLogicalVolume () {
+  delete fpCommand;
+}
+
+G4String G4VisCommandSceneAddLogicalVolume::GetCurrentValue (G4UIcommand*) {
+  return "";
+}
+
+void G4VisCommandSceneAddLogicalVolume::SetNewValue (G4UIcommand*,
+						     G4String newValue) {
+
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+  G4bool warn(verbosity >= G4VisManager::warnings);
+
+  G4Scene* pScene = fpVisManager->GetCurrentScene();
+  if (!pScene) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout <<	"ERROR: No current scene.  Please create one." << G4endl;
+    }
+    return;
+  }
+
+  G4String name;
+  G4int requestedDepthOfDescent;
+  G4String booleansString, voxelsString, readoutString;
+  std::istringstream is (newValue);
+  is >> name >> requestedDepthOfDescent
+     >>  booleansString >> voxelsString >> readoutString;
+  G4bool booleans = G4UIcommand::ConvertToBool(booleansString);
+  G4bool voxels = G4UIcommand::ConvertToBool(voxelsString);
+  G4bool readout = G4UIcommand::ConvertToBool(readoutString);
+
+  G4LogicalVolumeStore *pLVStore = G4LogicalVolumeStore::GetInstance();
+  int nLV = pLVStore -> size ();
+  int iLV;
+  G4LogicalVolume* pLV = 0;
+  for (iLV = 0; iLV < nLV; iLV++ ) {
+    pLV = (*pLVStore) [iLV];
+    if (pLV -> GetName () == name) break;
+  }
+  if (iLV == nLV) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout << "ERROR: Logical volume " << name
+	     << " not found in logical volume store." << G4endl;
+    }
+    return;
+  }
+
+  const std::vector<G4VModel*>& rdModelList = pScene -> GetRunDurationModelList();
+  std::vector<G4VModel*>::const_iterator i;
+  for (i = rdModelList.begin(); i != rdModelList.end(); ++i) {
+    if ((*i) -> GetGlobalDescription().find("Volume") != std::string::npos) break;
+  }
+  if (i != rdModelList.end()) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout << "There is already a volume, \""
+             << (*i) -> GetGlobalDescription()
+             << "\",\n in the run-duration model list of scene \""
+             << pScene -> GetName()
+             << "\".\n Your logical volume must be the only volume in the scene."
+	     << "\n Create a new scene and try again:"
+	     << "\n  /vis/specify " << name
+	     << "\n or"
+	     << "\n  /vis/scene/create"
+	     << "\n  /vis/scene/add/logicalVolume " << name
+	     << "\n  /vis/sceneHandler/attach"
+	     << "\n (and also, if necessary, /vis/viewer/flush)"
+             << G4endl;
+    }
+  }
+
+  G4VModel* model = new G4LogicalVolumeModel
+    (pLV, requestedDepthOfDescent, booleans, voxels, readout);
+  const G4String& currentSceneName = pScene -> GetName ();
+  G4bool successful = pScene -> AddRunDurationModel (model, warn);
+  if (successful) {
+    if (verbosity >= G4VisManager::confirmations) {
+      G4cout << "Logical volume \"" << pLV -> GetName ()
+	     << " with requested depth of descent "
+	     << requestedDepthOfDescent
+	     << ",\n with";
+      if (!booleans) G4cout << "out";
+      G4cout << " boolean components, with";
+      if (!voxels) G4cout << "out";
+      G4cout << " voxels and with";
+      if (!readout) G4cout << "out";
+      G4cout << " readout geometry,"
+	     << "\n  has been added to scene \"" << currentSceneName << "\"."
+	     << G4endl;
+    }
+  }
+  else {
+    G4VisCommandsSceneAddUnsuccessful(verbosity);
+    return;
+  }
+
+  UpdateVisManagerScene (currentSceneName);
+}
+
+
+////////////// /vis/scene/add/logo //////////////////////////////////
+
+G4VisCommandSceneAddLogo::G4VisCommandSceneAddLogo () {
+  G4bool omitable;
+  fpCommand = new G4UIcommand ("/vis/scene/add/logo", this);
+  fpCommand -> SetGuidance 
+    ("Adds a G4 logo to the current scene.");
+  fpCommand -> SetGuidance 
+    ("The placement, if automatic, is similar to that of scale -"
+     "\n\"help /vis/scene/add/scale\" for more information.");
+  G4UIparameter* parameter;
+  parameter = new G4UIparameter ("height", 'd', omitable = true);
+  parameter->SetDefaultValue (1.);
+  fpCommand->SetParameter (parameter);
+  parameter =  new G4UIparameter ("unit", 's', omitable = true);
+  parameter->SetDefaultValue ("m");
+  fpCommand->SetParameter (parameter);
+  parameter =  new G4UIparameter ("direction", 's', omitable = true);
+  parameter->SetGuidance ("'x', 'y' or 'z' - otherwise defaults to 'x'.");
+  parameter->SetDefaultValue ("x");
+  fpCommand->SetParameter (parameter);
+  parameter =  new G4UIparameter ("red", 'd', omitable = true);
+  parameter->SetDefaultValue (0.);
+  fpCommand->SetParameter (parameter);
+  parameter =  new G4UIparameter ("green", 'd', omitable = true);
+  parameter->SetDefaultValue (1.);
+  fpCommand->SetParameter (parameter);
+  parameter =  new G4UIparameter ("blue", 'd', omitable = true);
+  parameter->SetDefaultValue (0.);
+  fpCommand->SetParameter (parameter);
+  parameter =  new G4UIparameter ("auto|manual", 's', omitable = true);
+  parameter->SetGuidance
+    ("Automatic placement or manual placement at (xmid,ymid,zmid).");
+  parameter -> SetParameterCandidates("auto manual");
+  parameter->SetDefaultValue  ("auto");
+  fpCommand->SetParameter     (parameter);
+  parameter =  new G4UIparameter ("xmid", 'd', omitable = true);
+  parameter->SetDefaultValue (0.);
+  fpCommand->SetParameter (parameter);
+  parameter =  new G4UIparameter ("ymid", 'd', omitable = true);
+  parameter->SetDefaultValue (0.);
+  fpCommand->SetParameter (parameter);
+  parameter =  new G4UIparameter ("zmid", 'd', omitable = true);
+  parameter->SetDefaultValue (0.);
+  fpCommand->SetParameter (parameter);
+  parameter =  new G4UIparameter ("unit", 's', omitable = true);
+  parameter->SetDefaultValue ("m");
+  fpCommand->SetParameter (parameter);
+}
+
+G4VisCommandSceneAddLogo::~G4VisCommandSceneAddLogo () {
+  delete fpCommand;
+}
+
+G4String G4VisCommandSceneAddLogo::GetCurrentValue (G4UIcommand*) {
+  return "";
+}
+
+void G4VisCommandSceneAddLogo::SetNewValue (G4UIcommand*, G4String newValue) {
+
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+  G4bool warn = verbosity >= G4VisManager::warnings;
+
+  G4Scene* pScene = fpVisManager->GetCurrentScene();
+  if (!pScene) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout <<	"ERROR: No current scene.  Please create one." << G4endl;
+    }
+    return;
+  }
+
+  G4double userHeight, red, green, blue, xmid, ymid, zmid;
+  G4String userHeightUnit, direction, auto_manual, positionUnit;
+  std::istringstream is (newValue);
+  is >> userHeight >> userHeightUnit >> direction
+     >> red >> green >> blue
+     >> auto_manual
+     >> xmid >> ymid >> zmid >> positionUnit;
+
+  G4double height = userHeight * G4UIcommand::ValueOf(userHeightUnit);
+  G4double unit = G4UIcommand::ValueOf(positionUnit);
+  xmid *= unit; ymid *= unit; zmid *= unit;
+
+  G4Scale::Direction logoDirection (G4Scale::x);
+  if (direction(0) == 'y') logoDirection = G4Scale::y;
+  if (direction(0) == 'z') logoDirection = G4Scale::z;
+
+  G4bool autoPlacing = false; if (auto_manual == "auto") autoPlacing = true;
+  // Parameters read and interpreted.
+
+  // Useful constants, etc...
+  const G4double halfHeight(height / 2.);
+  const G4double comfort(0.01);  // 0.15 seems too big.  0.05 might be better.
+  const G4double onePlusComfort(1. + comfort);
+  const G4double freeHeightFraction (1. + 2. * comfort);
+
+  const G4VisExtent& sceneExtent = pScene->GetExtent();  // Existing extent.
+  const G4double xmin = sceneExtent.GetXmin();
+  const G4double xmax = sceneExtent.GetXmax();
+  const G4double ymin = sceneExtent.GetYmin();
+  const G4double ymax = sceneExtent.GetYmax();
+  const G4double zmin = sceneExtent.GetZmin();
+  const G4double zmax = sceneExtent.GetZmax();
+
+  // Test existing extent and issue warnings...
+  G4bool worried = false;
+  if (sceneExtent.GetExtentRadius() == 0) {
+    worried = true;
+    if (verbosity >= G4VisManager::warnings) {
+      G4cout <<
+	"WARNING: Existing scene does not yet have any extent."
+	"\n  Maybe you have not yet added any geometrical object."
+	     << G4endl;
+    }
+  }
+  // Test existing scene for room...
+  G4bool room = true;
+  switch (logoDirection) {
+  case G4Scale::x:
+    if (freeHeightFraction * (xmax - xmin) < height) room = false; break;
+  case G4Scale::y:
+    if (freeHeightFraction * (ymax - ymin) < height) room = false; break;
+  case G4Scale::z:
+    if (freeHeightFraction * (zmax - zmin) < height) room = false; break;
+  }
+  if (!room) {
+    worried = true;
+    if (verbosity >= G4VisManager::warnings) {
+      G4cout <<
+	"WARNING: Not enough room in existing scene.  Maybe logo is too large."
+	     << G4endl;
+    }
+  }
+  if (worried) {
+    if (verbosity >= G4VisManager::warnings) {
+      G4cout <<
+	"WARNING: The logo you have asked for is bigger than the existing"
+	"\n  scene.  Maybe you have added it too soon.  It is recommended that"
+	"\n  you add the logo last so that it can be correctly auto-positioned"
+	"\n  so as not to be obscured by any existing object and so that the"
+	"\n  view parameters can be correctly recalculated."
+	     << G4endl;
+    }
+  }
+
+  // Now figure out the extent...
+  //
+  // From the G4Scale.hh:
+  //
+  // This creates a representation of annotated line in the specified
+  // direction with tick marks at the end.  If autoPlacing is true it
+  // is required to be centred at the front, right, bottom corner of
+  // the world space, comfortably outside the existing bounding
+  // box/sphere so that existing objects do not obscure it.  Otherwise
+  // it is required to be drawn with mid-point at (xmid, ymid, zmid).
+  //
+  // The auto placing algorithm might be:
+  //   x = xmin + (1 + comfort) * (xmax - xmin)
+  //   y = ymin - comfort * (ymax - ymin)
+  //   z = zmin + (1 + comfort) * (zmax - zmin)
+  //   if direction == x then (x - length,y,z) to (x,y,z)
+  //   if direction == y then (x,y,z) to (x,y + length,z)
+  //   if direction == z then (x,y,z - length) to (x,y,z)
+  //
+  // End of clip from G4Scale.hh:
+
+  G4double sxmid(xmid), symid(ymid), szmid(zmid);
+  if (autoPlacing) {
+    sxmid = xmin + onePlusComfort * (xmax - xmin);
+    symid = ymin - comfort * (ymax - ymin);
+    szmid = zmin + onePlusComfort * (zmax - zmin);
+    switch (logoDirection) {
+    case G4Scale::x:
+      sxmid -= halfHeight;
+      break;
+    case G4Scale::y:
+      symid += halfHeight;
+      break;
+    case G4Scale::z:
+      szmid -= halfHeight;
+      break;
+    }
+  }
+  G4double sxmin(sxmid), sxmax(sxmid);
+  G4double symin(symid), symax(symid);
+  G4double szmin(szmid), szmax(szmid);
+  G4Transform3D transform;
+  switch (logoDirection) {
+  case G4Scale::x:
+    sxmin = sxmid - halfHeight;
+    sxmax = sxmid + halfHeight;
+    break;
+  case G4Scale::y:
+    symin = symid - halfHeight;
+    symax = symid + halfHeight;
+    transform = G4RotateZ3D(halfpi);
+    break;
+  case G4Scale::z:
+    szmin = szmid - halfHeight;
+    szmax = szmid + halfHeight;
+    transform = G4RotateY3D(halfpi);
+    break;
+  }
+  transform = G4Translate3D(sxmid,symid,szmid) * transform;
+
+  G4VisAttributes visAtts(G4Colour(red, green, blue));
+  visAtts.SetForceSolid(true);         // Always solid.
+
+  G4Logo* logo = new G4Logo(height,visAtts);
+  G4VModel* model =
+    new G4CallbackModel<G4VisCommandSceneAddLogo::G4Logo>(logo);
+  model->SetGlobalDescription("G4Logo");
+  model->SetGlobalTag("G4Logo");
+  model->SetTransformation(transform);
+  // Note: it is the responsibility of the model to act upon this, but
+  // the extent is in local coordinates...
+  G4double& h = height;
+  G4double h2 = h/2.;
+  G4VisExtent extent(-h,h,-h2,h2,-h2,h2);
+  model->SetExtent(extent);
+  // This extent gets "added" to existing scene extent in
+  // AddRunDurationModel below.
+  const G4String& currentSceneName = pScene -> GetName ();
+  G4bool successful = pScene -> AddRunDurationModel (model, warn);
+  if (successful) {
+    if (verbosity >= G4VisManager::confirmations) {
+      G4cout << "G4 Logo of height " << userHeight << ' ' << userHeightUnit
+	     << ", ";
+      switch (logoDirection) {
+      case G4Scale::x:
+	G4cout << 'x';
+	break;
+      case G4Scale::y:
+	G4cout << 'y';
+	break;
+      case G4Scale::z:
+	G4cout << 'z';
+	break;
+      }
+      G4cout << "-direction, added to scene \"" << currentSceneName << "\"";
+      if (verbosity >= G4VisManager::parameters) {
+	G4cout << "\n  with extent " << extent
+	       << "\n  at " << transform.getRotation()
+	       << transform.getTranslation();
+      }
+      G4cout << G4endl;
+    }
+  }
+  else G4VisCommandsSceneAddUnsuccessful(verbosity);
+  UpdateVisManagerScene (currentSceneName);
+}
+
+G4VisCommandSceneAddLogo::G4Logo::G4Logo
+(G4double height, const G4VisAttributes& visAtts):
+  fHeight(height),
+  fVisAtts(visAtts)
+ {
+  const G4double& h =  height;
+  const G4double h2  = 0.5 * h;   // Half height.
+  const G4double ri  = 0.25 * h;  // Inner radius.
+  const G4double ro  = 0.5 * h;   // Outer radius.
+  const G4double ro2 = 0.5 * ro;  // Half outer radius.
+  const G4double w   = ro - ri;   // Width.
+  const G4double w2  = 0.5 * w;   // Half width.
+  const G4double d2  = 0.2 * h;   // Half depth.
+  const G4double f1  = 0.05 * h;  // left edge of stem of "4".
+  const G4double f2  = -0.3 * h;  // bottom edge of cross of "4".
+  const G4double e = 1.e-4 * h;   // epsilon.
+  const G4double xt = f1, yt = h2;      // Top of slope.
+  const G4double xb = -h2, yb = f2 + w; // Bottom of slope.
+  const G4double dx = xt - xb, dy = yt - yb;
+  const G4double angle = std::atan2(dy,dx);
+  G4RotationMatrix rm;
+  rm.rotateZ(angle*rad);
+  const G4double d = std::sqrt(dx * dx + dy * dy);
+  const G4double s = h;  // Half height of square subtractor
+  const G4double y8 = s; // Choose y of subtractor for outer slope.
+  const G4double x8 = ((-s * d - dx * (yt - y8)) / dy) + xt;
+  G4double y9 = s; // Choose y of subtractor for inner slope.
+  G4double x9 = ((-(s - w) * d - dx * (yt - y8)) / dy) + xt;
+  // But to get inner, we make a triangle translated by...
+  const G4double xtr = s - f1, ytr = -s - f2 -w;
+  x9 += xtr; y9 += ytr;
+
+  // G...
+  G4Tubs tG("tG",ri,ro,d2,0.15*pi,1.85*pi);
+  G4Box bG("bG",w2,ro2,d2);
+  G4UnionSolid logoG("logoG",&tG,&bG,G4Translate3D(ri+w2,-ro2,0.));
+  fpG = logoG.CreatePolyhedron();
+  fpG->SetVisAttributes(&fVisAtts);
+  fpG->Transform(G4Translate3D(-0.55*h,0.,0.));
+
+  // 4...
+  G4Box b1("b1",h2,h2,d2);
+  G4Box bS("bS",s,s,d2+e);  // Subtractor.
+  G4Box bS2("bS2",s,s,d2+2.*e);  // 2nd Subtractor.
+  G4SubtractionSolid s1("s1",&b1,&bS,G4Translate3D(f1-s,f2-s,0.));
+  G4SubtractionSolid s2("s2",&s1,&bS,G4Translate3D(f1+s+w,f2-s,0.));
+  G4SubtractionSolid s3("s3",&s2,&bS,G4Translate3D(f1+s+w,f2+s+w,0.));
+  G4SubtractionSolid s4
+    ("s4",&s3,&bS,G4Transform3D(rm,G4ThreeVector(x8,y8,0.)));
+  G4SubtractionSolid s5    // Triangular hole.
+    ("s5",&bS,&bS2,G4Transform3D(rm,G4ThreeVector(x9,y9,0.)));
+  G4SubtractionSolid logo4("logo4",&s4,&s5,G4Translate3D(-xtr,-ytr,0.));
+  fp4 = logo4.CreatePolyhedron();
+  /* Experiment with creating own polyhedron...
+  int nNodes = 4;
+  int nFaces = 4;
+  double xyz[][3] = {{0,0,0},{1*m,0,0},{0,1*m,0},{0,0,1*m}};
+  int faces[][4] = {{1,3,2,0},{1,2,4,0},{1,4,3,0},{2,3,4,0}};
+  fp4 = new G4Polyhedron();
+  fp4->createPolyhedron(nNodes,nFaces,xyz,faces);
+  */
+  fp4->SetVisAttributes(&fVisAtts);
+  fp4->Transform(G4Translate3D(0.55*h,0.,0.));
+}
+
+G4VisCommandSceneAddLogo::G4Logo::~G4Logo() {
+  delete fpG;
+  delete fp4;
+}
+
+void G4VisCommandSceneAddLogo::G4Logo::operator()
+  (G4VGraphicsScene& sceneHandler, const G4Transform3D& transform) {
+  sceneHandler.BeginPrimitives(transform);
+  sceneHandler.AddPrimitive(*fpG);
+  sceneHandler.AddPrimitive(*fp4);
+  sceneHandler.EndPrimitives();
+}
+
+////////////// /vis/scene/add/scale //////////////////////////////////
+
+G4VisCommandSceneAddScale::G4VisCommandSceneAddScale () {
+  G4bool omitable;
+  fpCommand = new G4UIcommand ("/vis/scene/add/scale", this);
+  fpCommand -> SetGuidance 
+    ("Adds an annotated scale line to the current scene.");
+  fpCommand -> SetGuidance (G4Scale::GetGuidanceString());
+  G4UIparameter* parameter;
+  parameter = new G4UIparameter ("length", 'd', omitable = true);
+  parameter->SetDefaultValue (1.);
+  fpCommand->SetParameter (parameter);
+  parameter =  new G4UIparameter ("unit", 's', omitable = true);
+  parameter->SetDefaultValue ("m");
+  fpCommand->SetParameter (parameter);
+  parameter =  new G4UIparameter ("direction", 's', omitable = true);
+  parameter->SetGuidance ("'x', 'y' or 'z' - otherwise defaults to 'x'.");
+  parameter->SetDefaultValue ("x");
+  fpCommand->SetParameter (parameter);
+  parameter =  new G4UIparameter ("red", 'd', omitable = true);
+  parameter->SetDefaultValue (1.);
+  fpCommand->SetParameter (parameter);
+  parameter =  new G4UIparameter ("green", 'd', omitable = true);
+  parameter->SetDefaultValue (0.);
+  fpCommand->SetParameter (parameter);
+  parameter =  new G4UIparameter ("blue", 'd', omitable = true);
+  parameter->SetDefaultValue (0.);
+  fpCommand->SetParameter (parameter);
+  parameter =  new G4UIparameter ("auto|manual", 's', omitable = true);
+  parameter->SetGuidance
+    ("Automatic placement or manual placement at (xmid,ymid,zmid).");
+  parameter -> SetParameterCandidates("auto manual");
+  parameter->SetDefaultValue  ("auto");
+  fpCommand->SetParameter     (parameter);
+  parameter =  new G4UIparameter ("xmid", 'd', omitable = true);
+  parameter->SetDefaultValue (0.);
+  fpCommand->SetParameter (parameter);
+  parameter =  new G4UIparameter ("ymid", 'd', omitable = true);
+  parameter->SetDefaultValue (0.);
+  fpCommand->SetParameter (parameter);
+  parameter =  new G4UIparameter ("zmid", 'd', omitable = true);
+  parameter->SetDefaultValue (0.);
+  fpCommand->SetParameter (parameter);
+  parameter =  new G4UIparameter ("unit", 's', omitable = true);
+  parameter->SetDefaultValue ("m");
+  fpCommand->SetParameter (parameter);
+}
+
+G4VisCommandSceneAddScale::~G4VisCommandSceneAddScale () {
+  delete fpCommand;
+}
+
+G4String G4VisCommandSceneAddScale::GetCurrentValue (G4UIcommand*) {
+  return "";
+}
+
+void G4VisCommandSceneAddScale::SetNewValue (G4UIcommand*, G4String newValue) {
+
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+  G4bool warn = verbosity >= G4VisManager::warnings;
+
+  G4Scene* pScene = fpVisManager->GetCurrentScene();
+  if (!pScene) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout <<	"ERROR: No current scene.  Please create one." << G4endl;
+    }
+    return;
+  }
+
+  G4double userLength, red, green, blue, xmid, ymid, zmid;
+  G4String userLengthUnit, direction, auto_manual, positionUnit;
+  std::istringstream is (newValue);
+  is >> userLength >> userLengthUnit >> direction
+     >> red >> green >> blue
+     >> auto_manual
+     >> xmid >> ymid >> zmid >> positionUnit;
+
+  G4double length = userLength * G4UIcommand::ValueOf(userLengthUnit);
+  G4double unit = G4UIcommand::ValueOf(positionUnit);
+  xmid *= unit; ymid *= unit; zmid *= unit;
+
+  std::ostringstream oss;
+  oss << userLength << ' ' << userLengthUnit;
+  G4String annotation(oss.str());
+
+  G4Scale::Direction scaleDirection (G4Scale::x);
+  if (direction(0) == 'y') scaleDirection = G4Scale::y;
+  if (direction(0) == 'z') scaleDirection = G4Scale::z;
+
+  G4bool autoPlacing = false; if (auto_manual == "auto") autoPlacing = true;
+  // Parameters read and interpreted.
+
+  // Useful constants, etc...
+  const G4double halfLength(length / 2.);
+  const G4double comfort(0.01);  // 0.15 seems too big.  0.05 might be better.
+  const G4double onePlusComfort(1. + comfort);
+  const G4double freeLengthFraction (1. + 2. * comfort);
+
+  const G4VisExtent& sceneExtent = pScene->GetExtent();  // Existing extent.
+  const G4double xmin = sceneExtent.GetXmin();
+  const G4double xmax = sceneExtent.GetXmax();
+  const G4double ymin = sceneExtent.GetYmin();
+  const G4double ymax = sceneExtent.GetYmax();
+  const G4double zmin = sceneExtent.GetZmin();
+  const G4double zmax = sceneExtent.GetZmax();
+
+  // Test existing extent and issue warnings...
+  G4bool worried = false;
+  if (sceneExtent.GetExtentRadius() == 0) {
+    worried = true;
+    if (verbosity >= G4VisManager::warnings) {
+      G4cout <<
+	"WARNING: Existing scene does not yet have any extent."
+	"\n  Maybe you have not yet added any geometrical object."
+	     << G4endl;
+    }
+  }
+  // Test existing scene for room...
+  G4bool room  = true;
+  switch (scaleDirection) {
+  case G4Scale::x:
+    if (freeLengthFraction * (xmax - xmin) < length) room = false; break;
+  case G4Scale::y:
+    if (freeLengthFraction * (ymax - ymin) < length) room = false; break;
+  case G4Scale::z:
+    if (freeLengthFraction * (zmax - zmin) < length) room = false; break;
+  }
+  if (!room) {
+    worried = true;
+    if (verbosity >= G4VisManager::warnings) {
+      G4cout <<
+	"WARNING: Not enough room in existing scene.  Maybe scale is too long."
+	     << G4endl;
+    }
+  }
+  if (worried) {
+    if (verbosity >= G4VisManager::warnings) {
+      G4cout <<
+	"WARNING: The scale you have asked for is bigger than the existing"
+	"\n  scene.  Maybe you have added it too soon.  It is recommended that"
+	"\n  you add the scale last so that it can be correctly auto-positioned"
+	"\n  so as not to be obscured by any existing object and so that the"
+	"\n  view parameters can be correctly recalculated."
+	     << G4endl;
+    }
+  }
+
+  // Let's go ahead a construct a scale and a scale model.  Since the
+  // placing is done here, this G4Scale is *not* auto-placed...
+  G4Scale scale(length, annotation, scaleDirection,
+		false, xmid, ymid, zmid);
+  G4VisAttributes* pVisAttr = new G4VisAttributes(G4Colour(red, green, blue));
+  // Created of the heap because it needs a long lifetime.  This is a
+  // mess.  The model determines the life but the vis atttributes are
+  // associated with the scale.  There's no way of knowing when to
+  // delete the vis atttributes!!!
+  scale.SetVisAttributes(pVisAttr);
+  G4VModel* model = new G4ScaleModel(scale);
+
+  // Now figure out the extent...
+  //
+  // From the G4Scale.hh:
+  //
+  // This creates a representation of annotated line in the specified
+  // direction with tick marks at the end.  If autoPlacing is true it
+  // is required to be centred at the front, right, bottom corner of
+  // the world space, comfortably outside the existing bounding
+  // box/sphere so that existing objects do not obscure it.  Otherwise
+  // it is required to be drawn with mid-point at (xmid, ymid, zmid).
+  //
+  // The auto placing algorithm might be:
+  //   x = xmin + (1 + comfort) * (xmax - xmin)
+  //   y = ymin - comfort * (ymax - ymin)
+  //   z = zmin + (1 + comfort) * (zmax - zmin)
+  //   if direction == x then (x - length,y,z) to (x,y,z)
+  //   if direction == y then (x,y,z) to (x,y + length,z)
+  //   if direction == z then (x,y,z - length) to (x,y,z)
+  //
+  // End of clip from G4Scale.hh:
+  //
+  // Implement this in two parts.  Here, use the scale's extent to
+  // "expand" the scene's extent.  Then rendering - in
+  // G4VSceneHandler::AddPrimitive(const G4Scale&) - simply has to
+  // ensure it's within the new extent.
+  //
+
+  G4double sxmid(xmid), symid(ymid), szmid(zmid);
+  if (autoPlacing) {
+    sxmid = xmin + onePlusComfort * (xmax - xmin);
+    symid = ymin - comfort * (ymax - ymin);
+    szmid = zmin + onePlusComfort * (zmax - zmin);
+    switch (scaleDirection) {
+    case G4Scale::x:
+      sxmid -= halfLength;
+      break;
+    case G4Scale::y:
+      symid += halfLength;
+      break;
+    case G4Scale::z:
+      szmid -= halfLength;
+      break;
+    }
+  }
+  G4double sxmin(sxmid), sxmax(sxmid);
+  G4double symin(symid), symax(symid);
+  G4double szmin(szmid), szmax(szmid);
+  G4Transform3D transform;
+  G4VisExtent scaleExtent;
+  switch (scaleDirection) {
+  case G4Scale::x:
+    sxmin = sxmid - halfLength;
+    sxmax = sxmid + halfLength;
+    scaleExtent = G4VisExtent(-halfLength,halfLength,0,0,0,0);
+    break;
+  case G4Scale::y:
+    symin = symid - halfLength;
+    symax = symid + halfLength;
+    transform = G4RotateZ3D(halfpi);
+    scaleExtent = G4VisExtent(0,0,-halfLength,halfLength,0,0);
+    break;
+  case G4Scale::z:
+    szmin = szmid - halfLength;
+    szmax = szmid + halfLength;
+    transform = G4RotateY3D(halfpi);
+    scaleExtent = G4VisExtent(0,0,0,0,-halfLength,halfLength);
+    break;
+  }
+  transform = G4Translate3D(sxmid,symid,szmid) * transform;
+  //////////  G4VisExtent scaleExtent(sxmin, sxmax, symin, symax, szmin, szmax);
+
+
+  model->SetTransformation(transform);
+  // Note: it is the responsibility of the model to act upon this, but
+  // the extent is in local coordinates...
+  model->SetExtent(scaleExtent);
+  // This extent gets "added" to existing scene extent in
+  // AddRunDurationModel below.
+
+  const G4String& currentSceneName = pScene -> GetName ();
+  G4bool successful = pScene -> AddRunDurationModel (model, warn);
+  if (successful) {
+    if (verbosity >= G4VisManager::confirmations) {
+      G4cout << "Scale of " << annotation
+	     << " added to scene \"" << currentSceneName << "\".";
+      if (verbosity >= G4VisManager::parameters) {
+	G4cout << "\n  with extent " << scaleExtent
+	       << "\n  at " << transform.getRotation()
+	       << transform.getTranslation();
+      }
+      G4cout << G4endl;
+    }
+  }
+  else G4VisCommandsSceneAddUnsuccessful(verbosity);
+  UpdateVisManagerScene (currentSceneName);
+}
+
+
+////////////// /vis/scene/add/text //////////////////////////////////
+
+G4VisCommandSceneAddText::G4VisCommandSceneAddText () {
+  G4bool omitable;
+  fpCommand = new G4UIcommand ("/vis/scene/add/text", this);
+  fpCommand -> SetGuidance
+    ("Adds text to current scene.");
+  G4UIparameter* parameter;
+  parameter = new G4UIparameter ("x", 'd', omitable = true);
+  parameter->SetDefaultValue (0);
+  parameter->SetGuidance ("x");
+  fpCommand->SetParameter (parameter);
+  parameter =  new G4UIparameter ("y", 'd', omitable = true);
+  parameter->SetDefaultValue (0);
+  parameter->SetGuidance ("y");
+  fpCommand->SetParameter (parameter);
+  parameter =  new G4UIparameter ("z", 'd', omitable = true);
+  parameter->SetDefaultValue (0);
+  parameter->SetGuidance ("z");
+  fpCommand->SetParameter (parameter);
+  parameter =  new G4UIparameter ("unit", 's', omitable = true);
+  parameter->SetDefaultValue ("m");
+  fpCommand->SetParameter     (parameter);
+  parameter =  new G4UIparameter ("font_size", 'd', omitable = true);
+  parameter->SetDefaultValue (12);
+  parameter->SetGuidance ("pixels");
+  fpCommand->SetParameter (parameter);
+  parameter =  new G4UIparameter ("x_offset", 'd', omitable = true);
+  parameter->SetDefaultValue (0);
+  parameter->SetGuidance ("pixels");
+  fpCommand->SetParameter (parameter);
+  parameter =  new G4UIparameter ("y_offset", 'd', omitable = true);
+  parameter->SetDefaultValue (0);
+  parameter->SetGuidance ("pixels");
+  fpCommand->SetParameter (parameter);
+  parameter =  new G4UIparameter ("text", 's', omitable = true);
+  parameter->SetGuidance ("The rest of the line is text.");
+  parameter->SetDefaultValue ("Hello G4");
+  fpCommand->SetParameter (parameter);
+}
+
+G4VisCommandSceneAddText::~G4VisCommandSceneAddText () {
+  delete fpCommand;
+}
+
+G4String G4VisCommandSceneAddText::GetCurrentValue (G4UIcommand*) {
+  return "";
+}
+
+void G4VisCommandSceneAddText::SetNewValue (G4UIcommand*, G4String newValue) {
+
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+  G4bool warn = verbosity >= G4VisManager::warnings;
+
+  G4Scene* pScene = fpVisManager->GetCurrentScene();
+  if (!pScene) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout <<	"ERROR: No current scene.  Please create one." << G4endl;
+    }
+    return;
+  }
+
+  G4Tokenizer next(newValue);
+  G4double x = StoD(next());
+  G4double y = StoD(next());
+  G4double z = StoD(next());
+  G4String unitString = next();
+  G4double font_size = StoD(next());
+  G4double x_offset = StoD(next());
+  G4double y_offset = StoD(next());
+  G4String text = next("\n");
+
+  G4double unit = G4UIcommand::ValueOf(unitString);
+  x *= unit; y *= unit; z *= unit;
+
+  G4Text g4text(text, G4Point3D(x,y,z));
+  g4text.SetScreenSize(font_size);
+  g4text.SetOffset(x_offset,y_offset);
+  G4VModel* model = new G4TextModel(g4text);
+  const G4String& currentSceneName = pScene -> GetName ();
+  G4bool successful = pScene -> AddRunDurationModel (model, warn);
+  if (successful) {
+    if (verbosity >= G4VisManager::confirmations) {
+      G4cout << "Text \"" << text
+	     << "\" has been added to scene \"" << currentSceneName << "\"."
+	     << G4endl;
+    }
+  }
+  else G4VisCommandsSceneAddUnsuccessful(verbosity);
+  UpdateVisManagerScene (currentSceneName);
+}
+
+
+////////////// /vis/scene/add/trajectories ///////////////////////////////////
+
+G4VisCommandSceneAddTrajectories::G4VisCommandSceneAddTrajectories () {
+  G4bool omitable;
+  fpCommand = new G4UIcmdWithAString
+    ("/vis/scene/add/trajectories", this);
+  fpCommand -> SetGuidance
+    ("Adds trajectories to current scene.");
+  fpCommand -> SetGuidance
+    ("Causes trajectories, if any, to be drawn at the end of processing an"
+     "\nevent.  Switches on trajectory storing and sets the"
+     "\ndefault trajectory type.");
+  fpCommand -> SetGuidance
+    ("The command line parameter list determines the default trajectory type."
+     "\nIf it contains the string \"smooth\", auxiliary inter-step points will"
+     "\nbe inserted to improve the smoothness of the drawing of a curved"
+     "\ntrajectory."
+     "\nIf it contains the string \"rich\", significant extra information will"
+     "\nbe stored in the trajectory (G4RichTrajectory) amenable to modeling"
+     "\nand filtering with \"/vis/modeling/trajectories/create/drawByAttribute\""
+     "\nand \"/vis/filtering/trajectories/create/attributeFilter\" commands."
+     "\nIt may contain both strings in any order.");
+  fpCommand -> SetGuidance
+    ("\nTo switch off trajectory storing: \"/tracking/storeTrajectory 0\"."
+     "\nSee also \"/vis/scene/endOfEventAction\".");
+  fpCommand -> SetGuidance
+    ("Note:  This only sets the default.  Independently of the result of this"
+     "\ncommand, a user may instantiate a trajectory that overrides this default"
+     "\nin PreUserTrackingAction.");
+  fpCommand -> SetParameterName ("default-trajectory-type", omitable = true);
+  fpCommand -> SetDefaultValue ("");
+}
+
+G4VisCommandSceneAddTrajectories::~G4VisCommandSceneAddTrajectories () {
+  delete fpCommand;
+}
+
+G4String G4VisCommandSceneAddTrajectories::GetCurrentValue (G4UIcommand*) {
+  return "";
+}
+
+void G4VisCommandSceneAddTrajectories::SetNewValue (G4UIcommand*,
+						    G4String newValue) {
+
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+  G4bool warn = verbosity >= G4VisManager::warnings;
+
+  G4Scene* pScene = fpVisManager->GetCurrentScene();
+  if (!pScene) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout <<	"ERROR: No current scene.  Please create one." << G4endl;
+    }
+    return;
+  }
+
+  G4bool smooth = false, rich = false;
+  if (newValue.find("smooth") != std::string::npos) smooth = true;
+  if (newValue.find("rich") != std::string::npos) rich = true;
+
+  G4UImanager* UImanager = G4UImanager::GetUIpointer();
+  G4int keepVerbose = UImanager->GetVerboseLevel();
+  G4int newVerbose = 2;
+  UImanager->SetVerboseLevel(newVerbose);
+  G4PropagatorInField* propagatorInField =
+    G4TransportationManager::GetTransportationManager()->
+    GetPropagatorInField();
+  propagatorInField->SetTrajectoryFilter(0); // Switch off smooth trajectories.
+  static G4IdentityTrajectoryFilter auxiliaryPointsFilter;
+  G4String defaultTrajectoryType;
+  G4int i_mode = 0;
+  if (smooth && rich) {
+    UImanager->ApplyCommand("/tracking/storeTrajectory 3");
+    propagatorInField->SetTrajectoryFilter(&auxiliaryPointsFilter);
+    defaultTrajectoryType = "G4RichTrajectory configured for smooth steps";
+  } else if (smooth) {
+    UImanager->ApplyCommand("/tracking/storeTrajectory 2");
+    propagatorInField->SetTrajectoryFilter(&auxiliaryPointsFilter);
+    defaultTrajectoryType = "G4SmoothTrajectory";
+  } else if (rich) {
+    UImanager->ApplyCommand("/tracking/storeTrajectory 3");
+    defaultTrajectoryType = "G4RichTrajectory";
+  } else {
+    if (!newValue.empty()) {
+      std::istringstream iss(newValue);
+      iss >> i_mode;
+      if (iss) {
+	if (verbosity >= G4VisManager::warnings) {
+	  G4cout << "WARNING: Integer parameter " << i_mode << " found."
+	    "\n  DEPRECATED - will be removed at next major release."
+	    "\n  Use \"/vis/modeling/trajectories\" commands."
+		 << G4endl;
+	}
+      } else {
+	if (verbosity >= G4VisManager::errors) {
+	  G4cout << "ERROR: Unrecognised parameter \"" << newValue << "\""
+	    "\n  No action taken."
+		 << G4endl;
+	}
+	return;
+      }
+    }
+    UImanager->ApplyCommand("/tracking/storeTrajectory 1");
+    defaultTrajectoryType = "G4Trajectory";
+  }
+  UImanager->SetVerboseLevel(keepVerbose);
+
+  if (rich) {
+    if (verbosity >= G4VisManager::warnings) {
+      G4cout <<
+	"Attributes available for modeling and filtering with"
+	"\n\"/vis/modeling/trajectories/create/drawByAttribute\" and"
+	"\n\"/vis/filtering/trajectories/create/attributeFilter\" commands:\n"
+	     << G4RichTrajectory().GetAttDefs();
+    }
+  }
+
+  G4TrajectoriesModel* model = new G4TrajectoriesModel(i_mode);
+  const G4String& currentSceneName = pScene -> GetName ();
+  pScene -> AddEndOfEventModel (model, warn);
+
+  if (verbosity >= G4VisManager::confirmations) {
+    G4cout << "Default trajectory type " << defaultTrajectoryType
+	   << "\n  will be used to store trajectories for scene \""
+	   << currentSceneName << "\"."
+	   << G4endl;
+  }
+
+  if (verbosity >= G4VisManager::warnings) {
+    G4cout <<
+      "WARNING: Trajectory storing has been requested.  This action may be"
+      "\n  reversed with \"/tracking/storeTrajectory 0\"."
+	   << G4endl;
+  }
+  UpdateVisManagerScene (currentSceneName);
+}
+
+////////////// /vis/scene/add/userAction ///////////////////////////////////
+
+G4VisCommandSceneAddUserAction::G4VisCommandSceneAddUserAction () {
+  G4bool omitable;
+  fpCommand = new G4UIcommand("/vis/scene/add/userAction",this);
+  fpCommand -> SetGuidance
+    ("Add Vis User Action, if any, to current scene.");
+  fpCommand -> SetGuidance
+    ("Optional arguments define the extent of the callback drawing.  You may"
+     "\nnot need this if the extent has been defined in the original"
+     "\nSetUserAction or is defined by other components of the scene.  But if"
+     "\nthe user action is the only component of the scene, you will certainly"
+     "\nneed to set the extent either in SetUserAction or here.  A scene must"
+     "\nhave an extent one way or another so that the viewer can calculate"
+     "\nhow to point the camera.");
+  G4UIparameter* parameter;
+  parameter = new G4UIparameter ("xmin", 'd', omitable = true);
+  parameter->SetDefaultValue (0.);
+  fpCommand->SetParameter (parameter);
+  parameter =  new G4UIparameter ("xmax", 'd', omitable = true);
+  parameter->SetDefaultValue (0.);
+  fpCommand->SetParameter (parameter);
+  parameter =  new G4UIparameter ("ymin", 'd', omitable = true);
+  parameter->SetDefaultValue (0.);
+  fpCommand->SetParameter (parameter);
+  parameter =  new G4UIparameter ("ymax", 'd', omitable = true);
+  parameter->SetDefaultValue (0.);
+  fpCommand->SetParameter (parameter);
+  parameter =  new G4UIparameter ("zmin", 'd', omitable = true);
+  parameter->SetDefaultValue (0.);
+  fpCommand->SetParameter (parameter);
+  parameter =  new G4UIparameter ("zmax", 'd', omitable = true);
+  parameter->SetDefaultValue (0.);
+  fpCommand->SetParameter (parameter);
+  parameter =  new G4UIparameter ("unit", 's', omitable = true);
+  parameter->SetDefaultValue ("cm");
+  fpCommand->SetParameter (parameter);
+}
+
+G4VisCommandSceneAddUserAction::~G4VisCommandSceneAddUserAction () {
+  delete fpCommand;
+}
+
+G4String G4VisCommandSceneAddUserAction::GetCurrentValue (G4UIcommand*) {
+  return "";
+}
+
+void G4VisCommandSceneAddUserAction::SetNewValue (G4UIcommand*,
+						    G4String newValue) {
+
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+  G4bool warn = verbosity >= G4VisManager::warnings;
+
+  G4VUserVisAction* visAction = fpVisManager->GetUserAction();
+  if (!visAction) {
+    if (warn) {
+      G4cout <<	"WARNING: No User Vis Action registered." << G4endl;
+    }
+    return;
+  }
+
+  G4Scene* pScene = fpVisManager->GetCurrentScene();
+  if (!pScene) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout <<	"ERROR: No current scene.  Please create one." << G4endl;
+    }
+    return;
+  }
+
+  G4String unitString;
+  G4double xmin, xmax, ymin, ymax, zmin, zmax;
+  std::istringstream is (newValue);
+  is >> xmin >> xmax >> ymin >> ymax >> zmin >> zmax >> unitString;
+  G4double unit = G4UIcommand::ValueOf(unitString);
+  xmin *= unit; xmax *= unit;
+  ymin *= unit; ymax *= unit;
+  zmin *= unit; zmax *= unit;
+  G4VisExtent commandExtent(xmin,xmax,ymin,ymax,zmin,zmax);
+
+  G4VisExtent extent;
+  if (commandExtent.GetExtentRadius() > 0.) {
+    extent = commandExtent;
+  } else if (fpVisManager->GetUserActionExtent().GetExtentRadius() > 0.) {
+    extent = fpVisManager->GetUserActionExtent();
+  } else {
+    if (warn) {
+      G4cout <<	"WARNING: User Vis Action extent is null." << G4endl;
+    }
+  }
+
+  G4VModel* model = new G4CallbackModel<G4VUserVisAction>(visAction);
+  model->SetGlobalDescription("Vis User Action");
+  model->SetGlobalTag("Vis User Action");
+  model->SetExtent(extent);
+  const G4String& currentSceneName = pScene -> GetName ();
+  pScene -> AddRunDurationModel (model, warn);
+  if (verbosity >= G4VisManager::confirmations) {
+    G4cout << "User Vis Action added to scene \""
+	   << currentSceneName << "\"";
+    if (verbosity >= G4VisManager::parameters) {
+      G4cout << "\n  with extent " << extent;
+    }
+    G4cout << G4endl;
+  }
+  UpdateVisManagerScene (currentSceneName);
+}
+
+////////////// /vis/scene/add/volume ///////////////////////////////////////
+
+G4VisCommandSceneAddVolume::G4VisCommandSceneAddVolume () {
+  G4bool omitable;
+  fpCommand = new G4UIcommand ("/vis/scene/add/volume", this);
+  fpCommand -> SetGuidance 
+   ("Adds a physical volume to current scene, with optional clipping volume.");
+  fpCommand -> SetGuidance 
+    ("If physical-volume-name is \"world\" (the default), the top of the"
+     "\nmain geometry tree (material world) is added.  If \"worlds\", the"
+     "\ntop of all worlds - material world and parallel worlds, if any - are"
+     "\nadded.  Otherwise a search of all worlds is made, taking the first"
+     "\nmatching occurence only.  To see a representation of the geometry"
+     "\nhierarchy of the worlds, try \"/vis/drawTree [worlds]\" or one of the"
+     "\ndriver/browser combinations that have the required functionality, e.g., HepRep.");
+  fpCommand -> SetGuidance
+    ("If clip-volume-type is specified, the subsequent parameters are used to"
+     "\nto define a clipping volume.  For example,"
+     "\n\"vis/scene/add/volume ! ! ! -box km 0 1 0 1 0 1\" will draw the world"
+     "\nwith the positive octant cut away."); 
+  fpCommand -> SetGuidance
+    ("If clip-volume-type is prepended with '-', the clip-volume is subtracted"
+     "\n(cutaway). (This is the default if there is no prepended character.)"
+     "\nIf '*' is prepended, the intersection of the physical-volume and the"
+     "\nclip-volume is made. (You can make a section/DCUT with a thin box, for"
+     "\nexample).");
+  fpCommand -> SetGuidance
+    ("For \"box\", the parameters are xmin,xmax,ymin,ymax,zmin,zmax."
+     "\nOnly \"box\" is programmed at present.");
+  G4UIparameter* parameter;
+  parameter = new G4UIparameter ("physical-volume-name", 's', omitable = true);
+  parameter -> SetDefaultValue ("world");
+  fpCommand -> SetParameter (parameter);
+  parameter = new G4UIparameter ("copy-no", 'i', omitable = true);
+  parameter -> SetGuidance
+    ("If negative, matches any copy no.  First name match is taken.");
+  parameter -> SetDefaultValue (-1);
+  fpCommand -> SetParameter (parameter);
+  parameter = new G4UIparameter ("depth-of-descent", 'i', omitable = true);
+  parameter -> SetGuidance
+    ("Depth of descent of geometry hierarchy. Default = unlimited depth.");
+  parameter -> SetDefaultValue (G4Scene::UNLIMITED);
+  fpCommand -> SetParameter (parameter);
+  parameter = new G4UIparameter ("clip-volume-type", 's', omitable = true);
+  parameter -> SetParameterCandidates("none box -box *box");
+  parameter -> SetDefaultValue ("none");
+  parameter -> SetGuidance("[-|*]type.  See general guidance.");
+  fpCommand -> SetParameter (parameter);
+  parameter = new G4UIparameter ("parameter-unit", 's', omitable = true);
+  parameter -> SetDefaultValue ("m");
+  fpCommand -> SetParameter (parameter);
+  parameter = new G4UIparameter ("parameter-1", 'd', omitable = true);
+  parameter -> SetDefaultValue (0.);
+  fpCommand -> SetParameter (parameter);
+  parameter = new G4UIparameter ("parameter-2", 'd', omitable = true);
+  parameter -> SetDefaultValue (0.);
+  fpCommand -> SetParameter (parameter);
+  parameter = new G4UIparameter ("parameter-3", 'd', omitable = true);
+  parameter -> SetDefaultValue (0.);
+  fpCommand -> SetParameter (parameter);
+  parameter = new G4UIparameter ("parameter-4", 'd', omitable = true);
+  parameter -> SetDefaultValue (0.);
+  fpCommand -> SetParameter (parameter);
+  parameter = new G4UIparameter ("parameter-5", 'd', omitable = true);
+  parameter -> SetDefaultValue (0.);
+  fpCommand -> SetParameter (parameter);
+  parameter = new G4UIparameter ("parameter-6", 'd', omitable = true);
+  parameter -> SetDefaultValue (0.);
+  fpCommand -> SetParameter (parameter);
+}
+
+G4VisCommandSceneAddVolume::~G4VisCommandSceneAddVolume () {
+  delete fpCommand;
+}
+
+G4String G4VisCommandSceneAddVolume::GetCurrentValue (G4UIcommand*) {
+  return "world 0 -1";
+}
+
+void G4VisCommandSceneAddVolume::SetNewValue (G4UIcommand*,
+					      G4String newValue) {
+
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+  G4bool warn = verbosity >= G4VisManager::warnings;
+
+  G4Scene* pScene = fpVisManager->GetCurrentScene();
+  if (!pScene) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout <<	"ERROR: No current scene.  Please create one." << G4endl;
+    }
+    return;
+  }
+
+  G4String name, clipVolumeType, parameterUnit;
+  G4int copyNo, requestedDepthOfDescent;
+  G4double param1, param2, param3, param4, param5, param6;
+  std::istringstream is (newValue);
+  is >> name >> copyNo >> requestedDepthOfDescent
+     >> clipVolumeType >> parameterUnit
+     >> param1 >> param2 >> param3 >> param4 >> param5 >> param6;
+  G4PhysicalVolumeModel::ClippingMode clippingMode =
+    G4PhysicalVolumeModel::subtraction;  // Default subtraction mode.
+  if (clipVolumeType[size_t(0)] == '-') {
+    clipVolumeType = clipVolumeType.substr(1);  // Remove first character.
+  } else if (clipVolumeType[size_t(0)] == '*') {
+    clippingMode = G4PhysicalVolumeModel::intersection;
+    clipVolumeType = clipVolumeType.substr(1);
+  }
+  G4double unit = G4UIcommand::ValueOf(parameterUnit);
+  param1 *= unit; param2 *= unit; param3 *= unit;
+  param4 *= unit; param5 *= unit; param6 *= unit;
+
+  G4TransportationManager* transportationManager =
+    G4TransportationManager::GetTransportationManager ();
+
+  size_t nWorlds = transportationManager->GetNoWorlds();
+  if (nWorlds > 1) {  // Parallel worlds in operation...
+    if (verbosity >= G4VisManager::warnings) {
+      static G4bool warned = false;
+      if (!warned && name != "worlds") {
+	G4cout <<
+	  "WARNING: Parallel worlds in operation.  To visualise, specify"
+	  "\n  \"worlds\" or the parallel world volume or sub-volume name"
+	  "\n   and control visibility with /vis/geometry."
+	       << G4endl;
+	std::vector<G4VPhysicalVolume*>::iterator iterWorld =
+	  transportationManager->GetWorldsIterator();
+	for (size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
+	  G4cout << "  World " << i << ": " << (*iterWorld)->GetName()
+		 << G4endl;
+	  warned = true;
+	}
+      }
+    }
+  }
+
+  G4VPhysicalVolume* world = *(transportationManager->GetWorldsIterator());
+
+  if (!world) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout <<
+	"ERROR: G4VisCommandSceneAddVolume::SetNewValue:"
+	"\n  No world.  Maybe the geometry has not yet been defined."
+	"\n  Try \"/run/initialize\""
+	     << G4endl;
+    }
+    return;
+  }
+
+  const std::vector<G4VModel*>& rdModelList = pScene -> GetRunDurationModelList();
+  std::vector<G4VModel*>::const_iterator i;
+  for (i = rdModelList.begin(); i != rdModelList.end(); ++i) {
+    if ((*i) -> GetGlobalDescription().find("G4PhysicalVolumeModel")
+	!= std::string::npos) {
+      if (((G4PhysicalVolumeModel*)(*i)) -> GetTopPhysicalVolume () == world) break;
+    }
+  }
+  if (i != rdModelList.end()) {
+    if (verbosity >= G4VisManager::warnings) {
+      G4cout << "WARNING: There is already a volume, \""
+             << (*i) -> GetGlobalDescription()
+             << "\",\n in the run-duration model list of scene \""
+             << pScene -> GetName()
+             << "\".\n To get a clean scene:"
+	     << "\n  /vis/drawVolume " << name
+	     << "\n or"
+	     << "\n  /vis/scene/create"
+	     << "\n  /vis/scene/add/volume " << name
+	     << "\n  /vis/sceneHandler/attach"
+	     << "\n (and also, if necessary, /vis/viewer/flush)"
+             << G4endl;
+    }
+    return;
+  }
+
+  std::vector<G4PhysicalVolumeModel*> models;
+  std::vector<G4VPhysicalVolume*> foundVolumes;
+  G4VPhysicalVolume* foundWorld = 0;
+  std::vector<G4int> foundDepths;
+  std::vector<G4Transform3D> transformations;
+
+  if (name == "world") {
+
+    models.push_back
+      (new G4PhysicalVolumeModel (world, requestedDepthOfDescent));
+    foundVolumes.push_back(world);
+    foundDepths.push_back(0);
+    transformations.push_back(G4Transform3D());
+
+  } else if (name == "worlds") {
+
+    size_t nWorlds = transportationManager->GetNoWorlds();
+    if (nWorlds == 0) {
+      if (verbosity >= G4VisManager::warnings) {
+	G4cout <<
+	  "WARNING: G4VisCommandSceneAddVolume::SetNewValue:"
+	  "\n  Parallel worlds requested but none exist."
+	  "\n  Just adding material world."
+	       << G4endl;
+      }
+    }
+    std::vector<G4VPhysicalVolume*>::iterator iterWorld =
+      transportationManager->GetWorldsIterator();
+    for (size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
+      models.push_back
+	(new G4PhysicalVolumeModel (*iterWorld, requestedDepthOfDescent));
+      foundVolumes.push_back(*iterWorld);
+      foundDepths.push_back(0);
+      transformations.push_back(G4Transform3D());
+    }
+
+  } else {  // Search all worlds...
+    
+    size_t nWorlds = transportationManager->GetNoWorlds();
+    std::vector<G4VPhysicalVolume*>::iterator iterWorld =
+      transportationManager->GetWorldsIterator();
+    for (size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
+      G4PhysicalVolumeModel searchModel (*iterWorld);  // Unlimited depth.
+      G4ModelingParameters mp;  // Default - no culling.
+      searchModel.SetModelingParameters (&mp);
+      G4PhysicalVolumeSearchScene searchScene (&searchModel, name, copyNo);
+      searchModel.DescribeYourselfTo (searchScene);  // Initiate search.
+      G4VPhysicalVolume* foundVolume = searchScene.GetFoundVolume ();
+      if (foundVolume) {
+	foundWorld = *iterWorld;
+	foundVolumes.push_back(foundVolume);
+	foundDepths.push_back(searchScene.GetFoundDepth());
+	transformations.push_back(searchScene.GetFoundTransformation());
+	break;
+      }
+    }
+
+    if (foundVolumes.size()) {
+      for (size_t i = 0; i < foundVolumes.size(); ++i) {
+	models.push_back
+	  (new G4PhysicalVolumeModel
+	   (foundVolumes[i], requestedDepthOfDescent, transformations[i]));
+      }
+    } else {
+      if (verbosity >= G4VisManager::errors) {
+	G4cout << "ERROR: Volume \"" << name << "\"";
+	if (copyNo >= 0) {
+	  G4cout << ", copy no. " << copyNo << ",";
+	}
+	G4cout << " not found." << G4endl;
+      }
+      return;
+    }
+  }
+
+  if (clipVolumeType == "box") {
+    const G4double dX = (param2 - param1) / 2.;
+    const G4double dY = (param4 - param3) / 2.;
+    const G4double dZ = (param6 - param5) / 2.;
+    const G4double x0 = (param2 + param1) / 2.;
+    const G4double y0 = (param4 + param3) / 2.;
+    const G4double z0 = (param6 + param5) / 2.;
+    G4Box clippingBox("_clipping_box",dX,dY,dZ);
+    G4Polyhedron* clippingPolyhedron =
+      new G4PolyhedronBox(dX,dY,dZ);  // The model deletes.
+    clippingPolyhedron->Transform(G4Translate3D(x0,y0,z0));
+    for (size_t i = 0; i < foundVolumes.size(); ++i) {
+      models[i]->SetClippingPolyhedron(clippingPolyhedron);
+      models[i]->SetClippingMode(clippingMode);
+    }
+  }  // If any other shape consider NumberOfRotationSides!!!!!!!!!!!
+
+  const G4String& currentSceneName = pScene -> GetName ();
+  G4bool failure = true;
+  for (size_t i = 0; i < foundVolumes.size(); ++i) {
+    G4bool successful = pScene -> AddRunDurationModel (models[i], warn);
+    if (successful) {
+      failure = false;
+      if (verbosity >= G4VisManager::confirmations) {
+	G4cout << "First occurrence of \""
+	       << foundVolumes[i] -> GetName ()
+	       << "\"";
+	if (copyNo >= 0) {
+	  G4cout << ", copy no. " << copyNo << ",";
+	}
+	G4cout << "\n  found ";
+	if (foundWorld)
+	  G4cout << "in world \"" << foundWorld->GetName() << "\" ";
+	G4cout << "at depth " << foundDepths[i]
+	       << ",\n  with a requested depth of further descent of ";
+	if (requestedDepthOfDescent < 0) {
+	  G4cout << "<0 (unlimited)";
+	}
+	else {
+	  G4cout << requestedDepthOfDescent;
+	}
+	G4cout << ",\n  has been added to scene \"" << currentSceneName << "\"."
+	       << G4endl;
+      }
+    }
+  }
+
+  if (failure) {
+    G4VisCommandsSceneAddUnsuccessful(verbosity);
+    return;
+  }
+
+  UpdateVisManagerScene (currentSceneName);
+}
Index: tags/visualization-10.5-before-10.6_test/management/src/G4VisCommandsSceneHandler.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/src/G4VisCommandsSceneHandler.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/src/G4VisCommandsSceneHandler.cc	(revision 1102)
@@ -0,0 +1,438 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VisCommandsSceneHandler.cc,v 1.32 2006/06/29 21:29:46 gunter Exp $
+// GEANT4 tag $Name:  $
+
+// /vis/sceneHandler commands - John Allison  10th October 1998
+
+#include "G4VisCommandsSceneHandler.hh"
+
+#include "G4VisManager.hh"
+#include "G4GraphicsSystemList.hh"
+#include "G4VisCommandsScene.hh"
+#include "G4UImanager.hh"
+#include "G4UIcommand.hh"
+#include "G4UIcmdWithAString.hh"
+#include "G4ios.hh"
+#include <sstream>
+
+////////////// /vis/sceneHandler/attach ///////////////////////////////////////
+
+G4VisCommandSceneHandlerAttach::G4VisCommandSceneHandlerAttach () {
+  G4bool omitable, currentAsDefault;
+  fpCommand = new G4UIcmdWithAString ("/vis/sceneHandler/attach", this);
+  fpCommand -> SetGuidance ("Attaches scene to current scene handler.");
+  fpCommand -> SetGuidance
+    ("If scene-name is omitted, current scene is attached.  To see scenes and"
+  "\nscene handlers, use \"/vis/scene/list\" and \"/vis/sceneHandler/list\"");
+  fpCommand -> SetParameterName ("scene-name",
+				 omitable = true,
+				 currentAsDefault = true);
+}
+
+G4VisCommandSceneHandlerAttach::~G4VisCommandSceneHandlerAttach () {
+  delete fpCommand;
+}
+
+G4String G4VisCommandSceneHandlerAttach::GetCurrentValue (G4UIcommand*) {
+  G4Scene* pScene = fpVisManager -> GetCurrentScene ();
+  return pScene ? pScene -> GetName () : G4String("");
+}
+
+void G4VisCommandSceneHandlerAttach::SetNewValue (G4UIcommand*,
+						  G4String newValue) {
+
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+
+  G4String& sceneName = newValue;
+
+  if (sceneName.length () == 0) {
+    if (verbosity >= G4VisManager::warnings) {
+      G4cout <<
+	"WARNING: No scene specified.  Maybe there are no scenes available"
+	"\n  yet.  Please create one." << G4endl;
+    }
+    return;
+  }
+
+  G4VSceneHandler* pSceneHandler = fpVisManager -> GetCurrentSceneHandler ();
+  if (!pSceneHandler) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout <<
+      "ERROR: Current scene handler not defined.  Please select or create one."
+	     << G4endl;
+    }
+    return;
+  }
+
+  G4SceneList& sceneList = fpVisManager -> SetSceneList ();
+
+  if (sceneList.empty ()) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout <<
+      "ERROR: No valid scenes available yet.  Please create one."
+	     << G4endl;
+    }
+    return;
+  }
+
+  G4int iScene, nScenes = sceneList.size ();
+  for (iScene = 0; iScene < nScenes; iScene++) {
+    if (sceneList [iScene] -> GetName () == sceneName) break;
+  }
+  if (iScene < nScenes) {
+    G4Scene* pScene = sceneList [iScene];
+    pSceneHandler -> SetScene (pScene);
+    // Make sure scene is current...
+    fpVisManager -> SetCurrentScene (pScene);
+    // Refresh viewer, if any (only if auto-refresh)...
+    G4VViewer* pViewer = pSceneHandler -> GetCurrentViewer();
+    if (pViewer && pViewer -> GetViewParameters().IsAutoRefresh()) {
+#ifdef G4DEBUG_VIS_MANAGEMENT
+            printf("G4VisCommandSceneHandlerAttach::SetNewValue Call SetView()\n");
+#endif
+	    pViewer -> SetView ();
+#ifdef G4DEBUG_VIS_MANAGEMENT
+            printf("G4VisCommandSceneHandlerAttach::SetNewValue Call SetView() END\n");
+            printf("G4VisCommandSceneHandlerAttach::SetNewValue Call ClearView()\n");
+#endif
+	    pViewer -> ClearView ();
+#ifdef G4DEBUG_VIS_MANAGEMENT
+            printf("G4VisCommandSceneHandlerAttach::SetNewValue Call ClearView() END\n");
+            printf("G4VisCommandSceneHandlerAttach::SetNewValue Call DrawView()\n");
+#endif
+	    pViewer -> DrawView ();
+#ifdef G4DEBUG_VIS_MANAGEMENT
+            printf("G4VisCommandSceneHandlerAttach::SetNewValue Call DrawView() END\n");
+#endif
+    }
+    if (verbosity >= G4VisManager::confirmations) {
+      G4cout << "Scene \"" << sceneName
+	     << "\" attached to scene handler \""
+	     << pSceneHandler -> GetName () <<
+	".\n  (You may have to refresh with \"/vis/viewer/flush\" if view"
+	" is not \"auto-refresh\".)"
+	     << G4endl;
+    }
+  }
+  else {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout << "ERROR: Scene \"" << sceneName
+	     << "\" not found.  Use \"/vis/scene/list\" to see possibilities."
+	     << G4endl;
+    }
+  }
+}
+
+////////////// /vis/sceneHandler/create ///////////////////////////////////////
+
+G4VisCommandSceneHandlerCreate::G4VisCommandSceneHandlerCreate (): fId (0) {
+  G4bool omitable;
+  fpCommand = new G4UIcommand ("/vis/sceneHandler/create", this);
+  fpCommand -> SetGuidance
+    ("Creates an scene handler for a specific graphics system.");
+  fpCommand -> SetGuidance
+    ("Attaches current scene, if any.  (You can change attached scenes with"
+     "\n\"/vis/sceneHandler/attach\".)  Invents a scene handler name if not"
+     "\nsupplied.  This scene handler becomes current.");
+  G4UIparameter* parameter;
+  parameter = new G4UIparameter ("graphics-system-name",
+				 's', omitable = false);
+  const G4GraphicsSystemList& gslist =
+    fpVisManager -> GetAvailableGraphicsSystems ();
+  G4String candidates;
+  for (size_t igslist = 0; igslist < gslist.size (); igslist++) {
+    const G4String& name = gslist [igslist] -> GetName ();
+    const G4String& nickname = gslist [igslist] -> GetNickname ();
+    if (nickname.isNull ()) {
+      candidates += name;
+    }
+    else {
+      candidates += nickname;
+    }
+    candidates += " ";
+  }
+  candidates = candidates.strip ();
+  parameter -> SetParameterCandidates(candidates);
+  fpCommand -> SetParameter (parameter);
+  parameter = new G4UIparameter
+    ("scene-handler-name", 's', omitable = true);
+  parameter -> SetCurrentAsDefault (true);
+  fpCommand -> SetParameter (parameter);
+}
+
+G4VisCommandSceneHandlerCreate::~G4VisCommandSceneHandlerCreate () {
+  delete fpCommand;
+}
+
+G4String G4VisCommandSceneHandlerCreate::NextName () {
+  std::ostringstream oss;
+  oss << "scene-handler-" << fId;
+  return oss.str();
+}
+
+G4String G4VisCommandSceneHandlerCreate::GetCurrentValue(G4UIcommand*) {
+
+  G4String graphicsSystemName;
+  const G4VGraphicsSystem* graphicsSystem =
+    fpVisManager -> GetCurrentGraphicsSystem ();
+  if (graphicsSystem) {
+    graphicsSystemName = graphicsSystem -> GetName ();
+  }
+  else {
+    const G4GraphicsSystemList& gslist =
+      fpVisManager -> GetAvailableGraphicsSystems ();
+    if (gslist.size ()) {
+      graphicsSystemName = gslist [0] -> GetName ();
+    }
+    else {
+      graphicsSystemName = "none";
+    }
+  }
+
+  return graphicsSystemName + " " + NextName ();
+}
+
+void G4VisCommandSceneHandlerCreate::SetNewValue (G4UIcommand*,
+						  G4String newValue) {
+
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+
+  G4String graphicsSystem, newName;
+  std::istringstream is (newValue);
+  is >> graphicsSystem >> newName;
+
+  const G4GraphicsSystemList& gsl =
+    fpVisManager -> GetAvailableGraphicsSystems ();
+  int nSystems = gsl.size ();
+  if (nSystems <= 0) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout << "ERROR: G4VisCommandSceneHandlerCreate::SetNewValue:"
+	" no graphics systems available."
+	"\n  Did you instantiate any in"
+	" YourVisManager::RegisterGraphicsSystems()?"
+	     << G4endl;
+    }
+    return;
+  }
+  int iGS;  // Selector index.
+  for (iGS = 0; iGS < nSystems; iGS++) {
+    if (graphicsSystem.compareTo (gsl [iGS] -> GetName (),
+				  G4String::ignoreCase) == 0 ||
+	graphicsSystem.compareTo (gsl [iGS] -> GetNickname (),
+				  G4String::ignoreCase) == 0) {
+      break;  // Match found.
+    }
+  }
+  if (iGS < 0 || iGS >= nSystems) {
+    // Invalid command line argument or non.
+    // This shouldn't happen!!!!!!
+    if (verbosity >= G4VisManager::errors) {
+      G4cout << "ERROR: G4VisCommandSceneHandlerCreate::SetNewValue:"
+	" invalid graphics system specified."
+	     << G4endl;
+    }
+    return;
+  }
+  // Valid index.  Set current graphics system in preparation for
+  // creating scene handler.
+  G4VGraphicsSystem* pSystem = gsl [iGS];
+  fpVisManager -> SetCurrentGraphicsSystem (pSystem);
+  if (verbosity >= G4VisManager::confirmations) {
+    G4cout << "Graphics system set to " << pSystem -> GetName () << G4endl;
+  }
+
+  // Now deal with name of scene handler.
+  G4String nextName = NextName ();
+  if (newName == "") {
+    newName = nextName;
+  }
+  if (newName == nextName) fId++;
+
+  const G4SceneHandlerList& list = fpVisManager -> GetAvailableSceneHandlers ();
+  size_t iScene;
+  for (iScene = 0; iScene < list.size (); iScene++) {
+    G4VSceneHandler* sceneHandler = list [iScene];
+    if (sceneHandler -> GetName () == newName) {
+      if (verbosity >= G4VisManager::errors) {
+	G4cout << "ERROR: Scene handler \"" << newName
+	       << "\" already exists." << G4endl;
+      }
+      return;
+    }
+  }
+
+  //Create scene handler.
+  fpVisManager -> CreateSceneHandler (newName);
+  if (fpVisManager -> GetCurrentSceneHandler () -> GetName () != newName) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout << "ERROR: G4VisCommandSceneHandlerCreate::SetNewValue:"
+	" Curious name mismatch."
+	"\n Current name \""
+	     << fpVisManager -> GetCurrentSceneHandler () -> GetName ()
+	     << "\" is not the new name \""
+	     << newName
+	     << "\".\n  Please report to vis coordinator."
+	     << G4endl;
+    }
+    return;
+  }
+
+  if (verbosity >= G4VisManager::confirmations) {
+    G4cout << "New scene handler \"" << newName << "\" created." << G4endl;
+  }
+
+  // Attach scene.
+  if (fpVisManager -> GetCurrentScene ())
+    G4UImanager::GetUIpointer () -> ApplyCommand ("/vis/sceneHandler/attach");
+}
+
+////////////// /vis/sceneHandler/list ///////////////////////////////////////
+
+G4VisCommandSceneHandlerList::G4VisCommandSceneHandlerList () {
+  G4bool omitable;
+  fpCommand = new G4UIcommand ("/vis/sceneHandler/list", this);
+  fpCommand -> SetGuidance ("Lists scene handler(s).");
+  fpCommand -> SetGuidance
+    ("\"help /vis/verbose\" for definition of verbosity.");
+  G4UIparameter* parameter;
+  parameter = new G4UIparameter("scene-handler-name", 's', omitable = true);
+  parameter -> SetDefaultValue ("all");
+  fpCommand -> SetParameter (parameter);
+  parameter = new G4UIparameter ("verbosity", 's', omitable = true);
+  parameter -> SetDefaultValue ("warnings");
+  fpCommand -> SetParameter (parameter);
+}
+
+G4VisCommandSceneHandlerList::~G4VisCommandSceneHandlerList () {
+  delete fpCommand;
+}
+
+G4String G4VisCommandSceneHandlerList::GetCurrentValue (G4UIcommand*) {
+  return "";
+}
+
+void G4VisCommandSceneHandlerList::SetNewValue (G4UIcommand*,
+						G4String newValue) {
+  G4String name, verbosityString;
+  std::istringstream is (newValue);
+  is >> name >> verbosityString;
+  G4VisManager::Verbosity verbosity =
+    fpVisManager->GetVerbosityValue(verbosityString);
+  const G4VSceneHandler* currentSceneHandler =
+    fpVisManager -> GetCurrentSceneHandler ();
+  G4String currentName;
+  if (currentSceneHandler) currentName = currentSceneHandler->GetName();
+
+  const G4SceneHandlerList& list = fpVisManager -> GetAvailableSceneHandlers ();
+  G4bool found = false;
+  for (size_t iSH = 0; iSH < list.size (); iSH++) {
+    const G4String& iName = list [iSH] -> GetName ();
+    if (name != "all") {
+      if (name != iName) continue;
+    }
+    found = true;
+    if (iName == currentName) {
+      G4cout << "  (current)";
+    }
+    else {
+      G4cout << "           ";
+    }
+    G4cout << " scene handler \"" << list [iSH] -> GetName () << "\""
+	   << " (" << list [iSH] -> GetGraphicsSystem () -> GetName () << ")";
+    if (verbosity >= G4VisManager::parameters) {
+      G4cout << "\n  " << *(list [iSH]);
+    }
+    G4cout << G4endl;
+  }
+  if (!found) {
+    G4cout << "No scene handlers found";
+    if (name != "all") {
+      G4cout << " of name \"" << name << "\"";
+    }
+    G4cout << "." << G4endl;
+  }
+}
+
+////////////// /vis/sceneHandler/select ///////////////////////////////////////
+
+G4VisCommandSceneHandlerSelect::G4VisCommandSceneHandlerSelect () {
+  G4bool omitable;
+  fpCommand = new G4UIcmdWithAString ("/vis/sceneHandler/select", this);
+  fpCommand -> SetGuidance ("Selects a scene handler.");
+  fpCommand -> SetGuidance 
+    ("Makes the scene handler current.  \"/vis/sceneHandler/list\" to see"
+     "\n possible scene handler names.");
+  fpCommand -> SetParameterName ("scene-handler-name",
+				 omitable = false);
+}
+
+G4VisCommandSceneHandlerSelect::~G4VisCommandSceneHandlerSelect () {
+  delete fpCommand;
+}
+
+G4String G4VisCommandSceneHandlerSelect::GetCurrentValue (G4UIcommand*) {
+  return "";
+}
+
+void G4VisCommandSceneHandlerSelect::SetNewValue (G4UIcommand*,
+						  G4String newValue) {
+
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+
+  G4String& selectName = newValue;
+  const G4SceneHandlerList& list = fpVisManager -> GetAvailableSceneHandlers ();
+
+  size_t iSH;
+  for (iSH = 0; iSH < list.size (); iSH++) {
+    if (list [iSH] -> GetName () == selectName) break;
+  }
+  if (iSH < list.size ()) {
+    if (fpVisManager -> GetCurrentSceneHandler () -> GetName ()
+	== selectName) {
+      if (verbosity >= G4VisManager::confirmations) {
+	G4cout << "Scene handler \"" << selectName << "\""
+	       << " already selected." << G4endl;
+      }
+    }
+    else {
+      if (verbosity >= G4VisManager::confirmations) {
+	G4cout << "Scene handler \"" << selectName << "\""
+	       << " being selected." << G4endl;
+      }
+      fpVisManager -> SetCurrentSceneHandler (list [iSH]);
+    }
+  }
+  else {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout << "ERROR: Scene handler \"" << selectName << "\""
+	     << " not found - \"/vis/sceneHandler/list\""
+	"\n  to see possibilities."
+	     << G4endl;
+    }
+  }
+}
Index: tags/visualization-10.5-before-10.6_test/management/src/G4VisCommandsViewer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/src/G4VisCommandsViewer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/src/G4VisCommandsViewer.cc	(revision 1102)
@@ -0,0 +1,1511 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VisCommandsViewer.cc,v 1.75 2009/01/19 15:47:49 lgarnier Exp $
+// GEANT4 tag $Name:  $
+
+// /vis/viewer commands - John Allison  25th October 1998
+
+#include "G4VisCommandsViewer.hh"
+
+#include "G4VisManager.hh"
+#include "G4GraphicsSystemList.hh"
+#include "G4VisCommandsScene.hh"
+#include "G4UImanager.hh"
+#include "G4UIcommand.hh"
+#include "G4UIcmdWithoutParameter.hh"
+#include "G4UIcmdWithAString.hh"
+#include "G4UIcmdWithADouble.hh"
+#include "G4UIcmdWithADoubleAndUnit.hh"
+#include "G4UIcmdWith3Vector.hh"
+#include "G4UnitsTable.hh"
+#include "G4ios.hh"
+#include <sstream>
+
+G4VVisCommandViewer::G4VVisCommandViewer () {}
+
+G4VVisCommandViewer::~G4VVisCommandViewer () {}
+
+void G4VVisCommandViewer::SetViewParameters
+(G4VViewer* viewer, const G4ViewParameters& viewParams) {
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+  viewer->SetViewParameters(viewParams);
+  G4VSceneHandler* sceneHandler = viewer->GetSceneHandler();
+  if (sceneHandler && sceneHandler->GetScene()) {
+    if (viewParams.IsAutoRefresh()) {
+      G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/refresh");
+    }
+    else {
+      if (verbosity >= G4VisManager::confirmations) {
+	G4cout << "Issue /vis/viewer/refresh to see effect." << G4endl;
+      }
+    }
+  }
+}
+
+////////////// /vis/viewer/addCutawayPlane ///////////////////////////////////////
+
+G4VisCommandViewerAddCutawayPlane::G4VisCommandViewerAddCutawayPlane () {
+  G4bool omitable;
+  fpCommand = new G4UIcommand ("/vis/viewer/addCutawayPlane", this);
+  fpCommand -> SetGuidance
+    ("Add cutaway plane to current viewer.");
+  G4UIparameter* parameter;
+  parameter  =  new G4UIparameter("x",'d',omitable = true);
+  parameter  -> SetDefaultValue  (0);
+  parameter  -> SetGuidance      ("Coordinate of point on the plane.");
+  fpCommand->SetParameter(parameter);
+  parameter  =  new G4UIparameter("y",'d',omitable = true);
+  parameter  -> SetDefaultValue  (0);
+  parameter  -> SetGuidance      ("Coordinate of point on the plane.");
+  fpCommand->SetParameter(parameter);
+  parameter  =  new G4UIparameter("z",'d',omitable = true);
+  parameter  -> SetDefaultValue  (0);
+  parameter  -> SetGuidance      ("Coordinate of point on the plane.");
+  fpCommand->SetParameter(parameter);
+  parameter  =  new G4UIparameter("unit",'s',omitable = true);
+  parameter  -> SetDefaultValue  ("m");
+  parameter  -> SetGuidance      ("Unit of point on the plane.");
+  fpCommand->SetParameter(parameter);
+  parameter  =  new G4UIparameter("nx",'d',omitable = true);
+  parameter  -> SetDefaultValue  (1);
+  parameter  -> SetGuidance      ("Component of plane normal.");
+  fpCommand->SetParameter(parameter);
+  parameter  =  new G4UIparameter("ny",'d',omitable = true);
+  parameter  -> SetDefaultValue  (0);
+  parameter  -> SetGuidance      ("Component of plane normal.");
+  fpCommand->SetParameter(parameter);
+  parameter  =  new G4UIparameter("nz",'d',omitable = true);
+  parameter  -> SetDefaultValue  (0);
+  parameter  -> SetGuidance      ("Component of plane normal.");
+  fpCommand->SetParameter(parameter);
+}
+
+G4VisCommandViewerAddCutawayPlane::~G4VisCommandViewerAddCutawayPlane () {
+  delete fpCommand;
+}
+
+G4String G4VisCommandViewerAddCutawayPlane::GetCurrentValue (G4UIcommand*) {
+  return "";
+}
+
+void G4VisCommandViewerAddCutawayPlane::SetNewValue (G4UIcommand*, G4String newValue) {
+
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+
+  G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
+  if (!viewer) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout <<
+  "ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
+	     << G4endl;
+    }
+    return;
+  }
+
+  G4double x, y, z, nx, ny, nz;
+  G4String unit;
+  std::istringstream is (newValue);
+  is >> x >> y >> z >> unit >> nx >> ny >> nz;
+  G4double F = G4UIcommand::ValueOf(unit);
+  x *= F; y *= F; z *= F;
+
+  G4ViewParameters vp = viewer->GetViewParameters();
+  vp.AddCutawayPlane(G4Plane3D(G4Normal3D(nx,ny,nz), G4Point3D(x,y,z)));
+  if (verbosity >= G4VisManager::confirmations) {
+    G4cout << "Cutaway planes for viewer \"" << viewer->GetName() << "\" now:";
+    const G4Planes& cutaways = vp.GetCutawayPlanes();
+    for (size_t i = 0; i < cutaways.size(); ++i)
+      G4cout << "\n  " << i << ": " << cutaways[i];
+    G4cout << G4endl;
+  }
+
+  SetViewParameters(viewer, vp);
+}
+
+////////////// /vis/viewer/changeCutawayPlane ///////////////////////////////////////
+
+G4VisCommandViewerChangeCutawayPlane::G4VisCommandViewerChangeCutawayPlane () {
+  G4bool omitable;
+  fpCommand = new G4UIcommand ("/vis/viewer/changeCutawayPlane", this);
+  fpCommand -> SetGuidance("Change cutaway plane.");
+  G4UIparameter* parameter;
+  parameter  =  new G4UIparameter("index",'i',omitable = false);
+  parameter  -> SetGuidance      ("Index of plane: 0, 1, 2.");
+  fpCommand->SetParameter(parameter);
+  parameter  =  new G4UIparameter("x",'d',omitable = true);
+  parameter  -> SetDefaultValue  (0);
+  parameter  -> SetGuidance      ("Coordinate of point on the plane.");
+  fpCommand->SetParameter(parameter);
+  parameter  =  new G4UIparameter("y",'d',omitable = true);
+  parameter  -> SetDefaultValue  (0);
+  parameter  -> SetGuidance      ("Coordinate of point on the plane.");
+  fpCommand->SetParameter(parameter);
+  parameter  =  new G4UIparameter("z",'d',omitable = true);
+  parameter  -> SetDefaultValue  (0);
+  parameter  -> SetGuidance      ("Coordinate of point on the plane.");
+  fpCommand->SetParameter(parameter);
+  parameter  =  new G4UIparameter("unit",'s',omitable = true);
+  parameter  -> SetDefaultValue  ("m");
+  parameter  -> SetGuidance      ("Unit of point on the plane.");
+  fpCommand->SetParameter(parameter);
+  parameter  =  new G4UIparameter("nx",'d',omitable = true);
+  parameter  -> SetDefaultValue  (1);
+  parameter  -> SetGuidance      ("Component of plane normal.");
+  fpCommand->SetParameter(parameter);
+  parameter  =  new G4UIparameter("ny",'d',omitable = true);
+  parameter  -> SetDefaultValue  (0);
+  parameter  -> SetGuidance      ("Component of plane normal.");
+  fpCommand->SetParameter(parameter);
+  parameter  =  new G4UIparameter("nz",'d',omitable = true);
+  parameter  -> SetDefaultValue  (0);
+  parameter  -> SetGuidance      ("Component of plane normal.");
+  fpCommand->SetParameter(parameter);
+}
+
+G4VisCommandViewerChangeCutawayPlane::~G4VisCommandViewerChangeCutawayPlane () {
+  delete fpCommand;
+}
+
+G4String G4VisCommandViewerChangeCutawayPlane::GetCurrentValue (G4UIcommand*) {
+  return "";
+}
+
+void G4VisCommandViewerChangeCutawayPlane::SetNewValue (G4UIcommand*, G4String newValue) {
+
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+
+  G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
+  if (!viewer) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout <<
+  "ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
+	     << G4endl;
+    }
+    return;
+  }
+
+  size_t index;
+  G4double x, y, z, nx, ny, nz;
+  G4String unit;
+  std::istringstream is (newValue);
+  is >> index >> x >> y >> z >> unit >> nx >> ny >> nz;
+  G4double F = G4UIcommand::ValueOf(unit);
+  x *= F; y *= F; z *= F;
+
+  G4ViewParameters vp = viewer->GetViewParameters();
+  vp.ChangeCutawayPlane(index,
+			G4Plane3D(G4Normal3D(nx,ny,nz), G4Point3D(x,y,z)));
+  if (verbosity >= G4VisManager::confirmations) {
+    G4cout << "Cutaway planes for viewer \"" << viewer->GetName() << "\" now:";
+    const G4Planes& cutaways = vp.GetCutawayPlanes();
+    for (size_t i = 0; i < cutaways.size(); ++i)
+      G4cout << "\n  " << i << ": " << cutaways[i];
+    G4cout << G4endl;
+  }
+
+  SetViewParameters(viewer, vp);
+}
+
+////////////// /vis/viewer/clear ///////////////////////////////////////
+
+G4VisCommandViewerClear::G4VisCommandViewerClear () {
+  G4bool omitable, currentAsDefault;
+  fpCommand = new G4UIcmdWithAString ("/vis/viewer/clear", this);
+  fpCommand -> SetGuidance ("Clears viewer.");
+  fpCommand -> SetGuidance 
+    ("By default, clears current viewer.  Specified viewer becomes current."
+     "\n\"/vis/viewer/list\" to see  possible viewer names.");
+  fpCommand -> SetParameterName ("viewer-name",
+				 omitable = true,
+				 currentAsDefault = true);
+}
+
+G4VisCommandViewerClear::~G4VisCommandViewerClear () {
+  delete fpCommand;
+}
+
+G4String G4VisCommandViewerClear::GetCurrentValue (G4UIcommand*) {
+  G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
+  return viewer ? viewer -> GetName () : G4String("none");
+}
+
+void G4VisCommandViewerClear::SetNewValue (G4UIcommand*, G4String newValue) {
+
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+
+  G4String& clearName = newValue;
+  G4VViewer* viewer = fpVisManager -> GetViewer (clearName);
+  if (!viewer) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout << "ERROR: Viewer \"" << clearName
+	     << "\" not found - \"/vis/viewer/list\" to see possibilities."
+	     << G4endl;
+    }
+    return;
+  }
+
+#ifdef G4DEBUG_VIS_MANAGEMENT
+  printf("G4VisCommandViewerClear::SetNewValue Call ClearView()\n");
+#endif
+  viewer->ClearView();
+#ifdef G4DEBUG_VIS_MANAGEMENT
+  printf("G4VisCommandViewerClear::SetNewValue Call ClearView() END\n");
+  printf("G4VisCommandViewerClear::SetNewValue Call FinishView()\n");
+#endif
+  viewer->FinishView();
+#ifdef G4DEBUG_VIS_MANAGEMENT
+  printf("G4VisCommandViewerClear::SetNewValue Call FinishView() END\n");
+#endif
+  if (verbosity >= G4VisManager::confirmations) {
+    G4cout << "Viewer \"" << clearName << "\" cleared." << G4endl;
+  }
+
+}
+
+////////////// /vis/viewer/clearCutawayPlanes ///////////////////////////////////////
+
+G4VisCommandViewerClearCutawayPlanes::G4VisCommandViewerClearCutawayPlanes () {
+  fpCommand = new G4UIcmdWithoutParameter
+    ("/vis/viewer/clearCutawayPlanes", this);
+  fpCommand -> SetGuidance ("Clear cutaway planes of current viewer.");
+}
+
+G4VisCommandViewerClearCutawayPlanes::~G4VisCommandViewerClearCutawayPlanes () {
+  delete fpCommand;
+}
+
+G4String G4VisCommandViewerClearCutawayPlanes::GetCurrentValue (G4UIcommand*) {
+  return "";
+}
+
+void G4VisCommandViewerClearCutawayPlanes::SetNewValue (G4UIcommand*, G4String) {
+
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+
+  G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
+  if (!viewer) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout <<
+  "ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
+	     << G4endl;
+    }
+    return;
+  }
+
+  G4ViewParameters vp = viewer->GetViewParameters();
+  vp.ClearCutawayPlanes();
+  if (verbosity >= G4VisManager::confirmations) {
+    G4cout << "Cutaway planes for viewer \"" << viewer->GetName()
+	   << "\" now cleared." << G4endl;
+  }
+
+  SetViewParameters(viewer, vp);
+}
+
+////////////// /vis/viewer/clearTransients //////////////////////////
+
+G4VisCommandViewerClearTransients::G4VisCommandViewerClearTransients () {
+  G4bool omitable, currentAsDefault;
+  fpCommand = new G4UIcmdWithAString ("/vis/viewer/clearTransients", this);
+  fpCommand -> SetGuidance ("Clears transients from viewer.");
+  fpCommand -> SetGuidance 
+  ("By default, operates on current viewer.  Specified viewer becomes current."
+     "\n\"/vis/viewer/list\" to see  possible viewer names.");
+  fpCommand -> SetParameterName ("viewer-name",
+				 omitable = true,
+				 currentAsDefault = true);
+}
+
+G4VisCommandViewerClearTransients::~G4VisCommandViewerClearTransients () {
+  delete fpCommand;
+}
+
+G4String G4VisCommandViewerClearTransients::GetCurrentValue (G4UIcommand*) {
+  G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
+  return viewer ? viewer -> GetName () : G4String("none");
+}
+
+void G4VisCommandViewerClearTransients::SetNewValue (G4UIcommand*, G4String newValue) {
+
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+
+  G4String& clearName = newValue;
+  G4VViewer* viewer = fpVisManager -> GetViewer (clearName);
+  if (!viewer) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout << "ERROR: Viewer \"" << clearName
+	     << "\" not found - \"/vis/viewer/list\" to see possibilities."
+	     << G4endl;
+    }
+    return;
+  }
+
+  G4VSceneHandler* sceneHandler = viewer->GetSceneHandler();
+  sceneHandler->SetMarkForClearingTransientStore(false);
+  fpVisManager->ResetTransientsDrawnFlags();
+  sceneHandler->ClearTransientStore();
+  if (verbosity >= G4VisManager::confirmations) {
+    G4cout << "Viewer \"" << clearName << "\" cleared of transients."
+	   << G4endl;
+  }
+
+}
+
+////////////// /vis/viewer/clone ///////////////////////////////////////
+
+G4VisCommandViewerClone::G4VisCommandViewerClone () {
+  G4bool omitable;
+  fpCommand = new G4UIcommand ("/vis/viewer/clone", this);
+  fpCommand -> SetGuidance ("Clones viewer.");
+  fpCommand -> SetGuidance 
+    ("By default, clones current viewer.  Clone becomes current."
+     "\nClone name, if not provided, is derived from the original name."
+     "\n\"/vis/viewer/list\" to see  possible viewer names.");
+  G4UIparameter* parameter;
+  parameter = new G4UIparameter ("original-viewer-name", 's', omitable = true);
+  parameter -> SetCurrentAsDefault (true);
+  fpCommand -> SetParameter (parameter);
+  parameter = new G4UIparameter ("clone-name", 's', omitable = true);
+  parameter -> SetDefaultValue ("none");
+  fpCommand -> SetParameter (parameter);
+}
+
+G4VisCommandViewerClone::~G4VisCommandViewerClone () {
+  delete fpCommand;
+}
+
+G4String G4VisCommandViewerClone::GetCurrentValue (G4UIcommand*) {
+  G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
+  G4String originalName = viewer ? viewer -> GetName () : G4String("none");
+  return "\"" + originalName + "\"";
+}
+
+void G4VisCommandViewerClone::SetNewValue (G4UIcommand*, G4String newValue) {
+
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+
+  G4String originalName, cloneName;
+  std::istringstream is (newValue);
+
+  // Need to handle the possibility that the names contain embedded
+  // blanks within quotation marks...
+  char c;
+  while (is.get(c) && c == ' '){}
+  if (c == '"') {
+    while (is.get(c) && c != '"') {originalName += c;}
+  }
+  else {
+    originalName += c;
+    while (is.get(c) && c != ' ') {originalName += c;}
+  }
+  originalName = originalName.strip (G4String::both, ' ');
+  originalName = originalName.strip (G4String::both, '"');
+
+  G4VViewer* originalViewer = fpVisManager -> GetViewer (originalName);
+  if (!originalViewer) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout << "ERROR: Viewer \"" << originalName
+	     << "\" not found - \"/vis/viewer/list\" to see possibilities."
+	     << G4endl;
+    }
+    return;
+  }
+  originalName = originalViewer->GetName();  // Ensures long name.
+
+  while (is.get(c) && c == ' '){}
+  if (c == '"') {
+    while (is.get(c) && c != '"') {cloneName += c;}
+  }
+  else {
+    cloneName += c;
+    while (is.get(c) && c != ' ') {cloneName += c;}
+  }
+  cloneName = cloneName.strip (G4String::both, ' ');
+  cloneName = cloneName.strip (G4String::both, '"');
+
+  if (cloneName == "none") {
+    G4int subID = 0;
+    do {
+      cloneName = originalName;
+      std::ostringstream oss;
+      oss << '-' << subID++;
+      G4String::size_type lastDashPosition, nextSpacePosition;
+      if ((lastDashPosition = cloneName.rfind('-')) !=  G4String::npos &&
+	  (nextSpacePosition = cloneName.find(" ", lastDashPosition)) !=
+	  G4String::npos) {
+	cloneName.insert(nextSpacePosition, oss.str());
+      } else {
+	cloneName.insert(cloneName.find(' '), oss.str());
+      }
+    } while (fpVisManager -> GetViewer (cloneName));
+  }
+
+  if (fpVisManager -> GetViewer (cloneName)) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout << "ERROR: Putative clone viewer \"" << cloneName
+	     << "\" already exists."
+	     << G4endl;
+    }
+    return;
+  }
+
+  G4String windowSizeHint =
+    originalViewer->GetViewParameters().GetXGeometryString();
+
+  G4UImanager* UImanager = G4UImanager::GetUIpointer();
+  G4int keepVerbose = UImanager->GetVerboseLevel();
+  G4int newVerbose(0);
+  if (keepVerbose >= 2 ||
+      fpVisManager->GetVerbosity() >= G4VisManager::confirmations)
+    newVerbose = 2;
+  UImanager->SetVerboseLevel(newVerbose);
+  UImanager->ApplyCommand(G4String("/vis/viewer/select " + originalName));
+  UImanager->ApplyCommand
+    (G4String("/vis/viewer/create ! \"" + cloneName + "\" " + windowSizeHint));
+  UImanager->ApplyCommand(G4String("/vis/viewer/set/all " + originalName));
+  UImanager->SetVerboseLevel(keepVerbose);
+
+  if (verbosity >= G4VisManager::confirmations) {
+    G4cout << "Viewer \"" << originalName << "\" cloned." << G4endl;
+    G4cout << "Clone \"" << cloneName << "\" now current." << G4endl;
+  }
+}
+
+////////////// /vis/viewer/create ///////////////////////////////////////
+
+G4VisCommandViewerCreate::G4VisCommandViewerCreate (): fId (0) {
+  G4bool omitable;
+  fpCommand = new G4UIcommand ("/vis/viewer/create", this);
+  fpCommand -> SetGuidance
+    ("Creates a viewer for the specified scene handler.");
+  fpCommand -> SetGuidance
+    ("Default scene handler is the current scene handler.  Invents a name"
+     "\nif not supplied.  (Note: the system adds information to the name"
+     "\nfor identification - only the characters up to the first blank are"
+     "\nused for removing, selecting, etc.)  This scene handler and viewer"
+     "\nbecome current.");
+  G4UIparameter* parameter;
+  parameter = new G4UIparameter ("scene-handler", 's', omitable = true);
+  parameter -> SetCurrentAsDefault (true);
+  fpCommand -> SetParameter (parameter);
+  parameter = new G4UIparameter ("viewer-name", 's', omitable = true);
+  parameter -> SetCurrentAsDefault (true);
+  fpCommand -> SetParameter (parameter);
+  parameter = new G4UIparameter ("window-size-hint", 's', omitable = true);
+  parameter->SetGuidance
+    ("integer (pixels) for square window placed by window manager or"
+     " X-Windows-type geometry string, e.g. 600x600-100+100");
+  parameter->SetDefaultValue("600");
+  fpCommand -> SetParameter (parameter);
+}
+
+G4VisCommandViewerCreate::~G4VisCommandViewerCreate () {
+  delete fpCommand;
+}
+
+G4String G4VisCommandViewerCreate::NextName () {
+  std::ostringstream oss;
+  G4VSceneHandler* sceneHandler = fpVisManager -> GetCurrentSceneHandler ();
+  oss << "viewer-" << fId << " (";
+  if (sceneHandler) {
+    oss << sceneHandler -> GetGraphicsSystem () -> GetName ();
+  }
+  else {
+    oss << "no_scene_handlers";
+  }
+  oss << ")";
+  return oss.str();
+}
+
+G4String G4VisCommandViewerCreate::GetCurrentValue (G4UIcommand*) {
+  G4String currentValue;
+  G4VSceneHandler* currentSceneHandler =
+    fpVisManager -> GetCurrentSceneHandler ();
+  if (currentSceneHandler) {
+    currentValue = currentSceneHandler -> GetName ();
+  }
+  else {
+    currentValue = "none";
+  }
+  currentValue += ' ';
+  currentValue += '"';
+  currentValue += NextName ();
+  currentValue += '"';
+
+  currentValue += " 600";  // Default number of pixels for window size hint.
+
+  return currentValue;
+}
+
+void G4VisCommandViewerCreate::SetNewValue (G4UIcommand*, G4String newValue) {
+
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+
+  G4String sceneHandlerName, newName;
+  G4String windowSizeHintString;
+  std::istringstream is (newValue);
+  is >> sceneHandlerName;
+
+  // Now need to handle the possibility that the second string
+  // contains embedded blanks within quotation marks...
+  char c;
+  while (is.get(c) && c == ' '){}
+  if (c == '"') {
+    while (is.get(c) && c != '"') {newName += c;}
+  }
+  else {
+    newName += c;
+    while (is.get(c) && c != ' ') {newName += c;}
+  }
+  newName = newName.strip (G4String::both, ' ');
+  newName = newName.strip (G4String::both, '"');
+
+  // Now get window size hint...
+  is >> windowSizeHintString;
+
+  const G4SceneHandlerList& sceneHandlerList =
+    fpVisManager -> GetAvailableSceneHandlers ();
+  G4int nHandlers = sceneHandlerList.size ();
+  if (nHandlers <= 0) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout <<
+	"ERROR: G4VisCommandViewerCreate::SetNewValue: no scene handlers."
+	"\n  Create a scene handler with \"/vis/sceneHandler/create\""
+	     << G4endl;
+    }
+    return;
+  }
+
+  G4int iHandler;
+  for (iHandler = 0; iHandler < nHandlers; iHandler++) {
+    if (sceneHandlerList [iHandler] -> GetName () == sceneHandlerName) break;
+  }
+
+  if (iHandler < 0 || iHandler >= nHandlers) {
+    // Invalid command line argument or none.
+    // This shouldn't happen!!!!!!
+    if (verbosity >= G4VisManager::errors) {
+      G4cout << "G4VisCommandViewerCreate::SetNewValue:"
+	" invalid scene handler specified."
+	    << G4endl;
+    }
+    return;
+  }
+
+  // Valid index.  Set current scene handler and graphics system in
+  // preparation for creating viewer.
+  G4VSceneHandler* sceneHandler = sceneHandlerList [iHandler];
+  if (sceneHandler != fpVisManager -> GetCurrentSceneHandler ()) {
+    fpVisManager -> SetCurrentSceneHandler (sceneHandler);
+  }
+
+  // Now deal with name of viewer.
+  G4String nextName = NextName ();
+  if (newName == "") {
+    newName = nextName;
+  }
+  if (newName == nextName) fId++;
+  G4String newShortName = fpVisManager -> ViewerShortName (newName);
+
+  for (iHandler = 0; iHandler < nHandlers; iHandler++) {
+    G4VSceneHandler* sceneHandler = sceneHandlerList [iHandler];
+    const G4ViewerList& viewerList = sceneHandler -> GetViewerList ();
+    for (size_t iViewer = 0; iViewer < viewerList.size (); iViewer++) {
+      if (viewerList [iViewer] -> GetShortName () == newShortName ) {
+	if (verbosity >= G4VisManager::errors) {
+	  G4cout << "ERROR: Viewer \"" << newShortName << "\" already exists."
+		 << G4endl;
+	}
+	return;
+      }
+    }
+  }
+
+  // WindowSizeHint and XGeometryString are picked up from the vis
+  // manager in the G4VViewer constructor. In G4VisManager, after Viewer
+  // creation, we will store theses parameters in G4ViewParameters.
+
+  fpVisManager -> CreateViewer (newName,windowSizeHintString);
+
+  G4VViewer* newViewer = fpVisManager -> GetCurrentViewer ();
+  if (newViewer && newViewer -> GetName () == newName) {
+    if (verbosity >= G4VisManager::confirmations) {
+      G4cout << "New viewer \"" << newName << "\" created." << G4endl;
+    }
+  }
+  else {
+    if (verbosity >= G4VisManager::errors) {
+      if (newViewer) {
+	G4cout << "ERROR: New viewer doesn\'t match!!!  Curious!!" << G4endl;
+      } else {
+	G4cout << "WARNING: No viewer created." << G4endl;
+      }
+    }
+  }
+  // Refresh if appropriate...
+  if (newViewer) {
+    if (newViewer->GetViewParameters().IsAutoRefresh()) {
+      G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/refresh");
+    }
+    else {
+      if (verbosity >= G4VisManager::confirmations) {
+	G4cout << "Issue /vis/viewer/refresh to see effect." << G4endl;
+      }
+    }
+  }
+}
+
+////////////// /vis/viewer/dolly and dollyTo ////////////////////////////
+
+G4VisCommandViewerDolly::G4VisCommandViewerDolly ():
+  fDollyIncrement  (0.),
+  fDollyTo (0.)
+{
+  G4bool omitable, currentAsDefault;
+
+  fpCommandDolly = new G4UIcmdWithADoubleAndUnit
+    ("/vis/viewer/dolly", this);
+  fpCommandDolly -> SetGuidance
+    ("Incremental dolly.");
+  fpCommandDolly -> SetGuidance
+    ("Moves the camera incrementally towards target point.");
+  fpCommandDolly -> SetParameterName("increment",
+				     omitable=true,
+				     currentAsDefault=true);
+  fpCommandDolly -> SetDefaultUnit("m");
+
+  fpCommandDollyTo = new G4UIcmdWithADoubleAndUnit
+    ("/vis/viewer/dollyTo", this);
+  fpCommandDollyTo -> SetGuidance
+    ("Dolly to specific coordinate.");
+  fpCommandDollyTo -> SetGuidance
+ ("Places the camera towards target point relative to standard camera point.");
+  fpCommandDollyTo -> SetParameterName("distance",
+				       omitable=true,
+				       currentAsDefault=true);
+  fpCommandDollyTo -> SetDefaultUnit("m");
+}
+
+G4VisCommandViewerDolly::~G4VisCommandViewerDolly () {
+  delete fpCommandDolly;
+  delete fpCommandDollyTo;
+}
+
+G4String G4VisCommandViewerDolly::GetCurrentValue (G4UIcommand* command) {
+  G4String currentValue;
+  if (command == fpCommandDolly) {
+    currentValue = fpCommandDolly->ConvertToString(fDollyIncrement, "m");
+  }
+  else if (command == fpCommandDollyTo) {
+    currentValue = fpCommandDollyTo->ConvertToString(fDollyTo, "m");
+  }
+  return currentValue;
+}
+
+void G4VisCommandViewerDolly::SetNewValue (G4UIcommand* command,
+					   G4String newValue) {
+
+
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+
+  G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
+  if (!currentViewer) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout <<
+	"ERROR: G4VisCommandsViewerDolly::SetNewValue: no current viewer."
+	     << G4endl;
+    }
+    return;
+  }
+
+  G4ViewParameters vp = currentViewer->GetViewParameters();
+
+  if (command == fpCommandDolly) {
+    fDollyIncrement = fpCommandDolly->GetNewDoubleValue(newValue);
+    vp.IncrementDolly(fDollyIncrement);
+  }
+  else if (command == fpCommandDollyTo) {
+    fDollyTo = fpCommandDolly->GetNewDoubleValue(newValue);
+    vp.SetDolly(fDollyTo);
+  }
+
+  if (verbosity >= G4VisManager::confirmations) {
+    G4cout << "Dolly distance changed to " << vp.GetDolly() << G4endl;
+  }
+
+  SetViewParameters(currentViewer, vp);
+}
+
+////////////// /vis/viewer/flush ///////////////////////////////////////
+
+G4VisCommandViewerFlush::G4VisCommandViewerFlush () {
+  G4bool omitable, currentAsDefault;
+  fpCommand = new G4UIcmdWithAString ("/vis/viewer/flush", this);
+  fpCommand -> SetGuidance
+    ("Compound command: \"/vis/viewer/refresh\" + \"/vis/viewer/update\".");
+  fpCommand -> SetGuidance
+    ("Useful for refreshing and initiating post-processing for graphics"
+     "\nsystems which need post-processing.  By default, acts on current"
+     "\nviewer.  \"/vis/viewer/list\" to see possible viewers.  Viewer"
+     "\nbecomes current.");
+  fpCommand -> SetParameterName ("viewer-name",
+				 omitable = true,
+				 currentAsDefault = true);
+}
+
+G4VisCommandViewerFlush::~G4VisCommandViewerFlush () {
+  delete fpCommand;
+}
+
+G4String G4VisCommandViewerFlush::GetCurrentValue 
+(G4UIcommand*) {
+  G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
+  return viewer ? viewer -> GetName () : G4String("none");
+}
+
+void G4VisCommandViewerFlush::SetNewValue (G4UIcommand*, G4String newValue) {
+
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+
+  G4String& flushName = newValue;
+  G4VViewer* viewer = fpVisManager -> GetViewer (flushName);
+  if (!viewer) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout << "ERROR: Viewer \"" << flushName << "\"" <<
+	" not found - \"/vis/viewer/list\"\n  to see possibilities."
+	     << G4endl;
+    }
+    return;
+  }
+
+  G4UImanager* ui = G4UImanager::GetUIpointer();
+  G4int keepVerbose = ui->GetVerboseLevel();
+  G4int newVerbose(0);
+  if (keepVerbose >= 2 || verbosity >= G4VisManager::confirmations)
+    newVerbose = 2;
+  ui->SetVerboseLevel(newVerbose);
+  ui->ApplyCommand(G4String("/vis/viewer/refresh " + flushName));
+  ui->ApplyCommand(G4String("/vis/viewer/update " + flushName));
+  ui->SetVerboseLevel(keepVerbose);
+  if (verbosity >= G4VisManager::confirmations) {
+    G4cout << "Viewer \"" << viewer -> GetName () << "\""
+	   << " flushed." << G4endl;
+  }
+}
+
+////////////// /vis/viewer/list ///////////////////////////////////////
+
+G4VisCommandViewerList::G4VisCommandViewerList () {
+  G4bool omitable;
+  fpCommand = new G4UIcommand ("/vis/viewer/list", this);
+  fpCommand -> SetGuidance ("Lists viewers(s).");
+  fpCommand -> SetGuidance
+    ("See \"/vis/verbose\" for definition of verbosity.");
+  G4UIparameter* parameter;
+  parameter = new G4UIparameter("viewer-name", 's',
+				omitable = true);
+  parameter -> SetDefaultValue ("all");
+  fpCommand -> SetParameter (parameter);
+  parameter = new G4UIparameter ("verbosity", 's',
+				 omitable = true);
+  parameter -> SetDefaultValue ("warnings");
+  fpCommand -> SetParameter (parameter);
+}
+
+G4VisCommandViewerList::~G4VisCommandViewerList () {
+  delete fpCommand;
+}
+
+G4String G4VisCommandViewerList::GetCurrentValue (G4UIcommand*) {
+  return "";
+}
+
+void G4VisCommandViewerList::SetNewValue (G4UIcommand*, G4String newValue) {
+  G4String name, verbosityString;
+  std::istringstream is (newValue);
+  is >> name >> verbosityString;
+  G4String shortName = fpVisManager -> ViewerShortName (name);
+  G4VisManager::Verbosity verbosity =
+    fpVisManager->GetVerbosityValue(verbosityString);
+
+  const G4VViewer* currentViewer = fpVisManager -> GetCurrentViewer ();
+  G4String currentViewerShortName;
+  if (currentViewer) {
+    currentViewerShortName = currentViewer -> GetShortName ();
+  }
+  else {
+    currentViewerShortName = "none";
+  }
+
+  const G4SceneHandlerList& sceneHandlerList = fpVisManager -> GetAvailableSceneHandlers ();
+  G4int nHandlers = sceneHandlerList.size ();
+  G4bool found = false;
+  G4bool foundCurrent = false;
+  for (int iHandler = 0; iHandler < nHandlers; iHandler++) {
+    G4VSceneHandler* sceneHandler = sceneHandlerList [iHandler];
+    const G4ViewerList& viewerList = sceneHandler -> GetViewerList ();
+    G4cout << "Scene handler \"" << sceneHandler -> GetName ();
+    const G4Scene* pScene = sceneHandler -> GetScene ();
+    if (pScene) {
+      G4cout << "\", scene \"" << pScene -> GetName () << "\":";
+    }
+    G4int nViewers = viewerList.size ();
+    if (nViewers == 0) {
+      G4cout << "\n            No viewers for this scene handler." << G4endl;
+    }
+    else {
+      for (int iViewer = 0; iViewer < nViewers; iViewer++) {
+	const G4VViewer* thisViewer = viewerList [iViewer];
+	G4String thisName = thisViewer -> GetName ();
+	G4String thisShortName = thisViewer -> GetShortName ();
+	if (name != "all") {
+	  if (thisShortName != shortName) continue;
+	}
+	found = true;
+	G4cout << "\n  ";
+	if (thisShortName == currentViewerShortName) {
+	  foundCurrent = true;
+	  G4cout << "(current)";
+	}
+	else {
+	  G4cout << "         ";
+	}
+	G4cout << " viewer \"" << thisName << "\"";
+	if (verbosity >= G4VisManager::parameters) {
+	  G4cout << "\n  " << *thisViewer;
+	}
+      }
+    }
+    G4cout << G4endl;
+  }
+
+  if (!foundCurrent) {
+    G4cout << "No valid current viewer - please create or select one."
+	   << G4endl;
+  }
+
+  if (!found) {
+    G4cout << "No viewers";
+    if (name != "all") {
+      G4cout << " of name \"" << name << "\"";
+    }
+    G4cout << " found." << G4endl;
+  }
+}
+
+////////////// /vis/viewer/pan and panTo ////////////////////////////
+
+G4VisCommandViewerPan::G4VisCommandViewerPan ():
+  fPanIncrementRight  (0.),
+  fPanIncrementUp  (0.),
+  fPanToRight (0.),
+  fPanToUp (0.)
+{
+  G4bool omitable;
+
+  fpCommandPan = new G4UIcommand
+    ("/vis/viewer/pan", this);
+  fpCommandPan -> SetGuidance
+    ("Incremental pan.");
+  fpCommandPan -> SetGuidance
+    ("Moves the camera incrementally right and up by these amounts (as seen"
+     "\nfrom viewpoint direction).");
+  G4UIparameter* parameter;
+  parameter = new G4UIparameter("right-increment", 'd', omitable = true);
+  parameter -> SetCurrentAsDefault (true);
+  fpCommandPan -> SetParameter (parameter);
+  parameter = new G4UIparameter("up-increment", 'd', omitable = true);
+  parameter -> SetCurrentAsDefault (true);
+  fpCommandPan -> SetParameter (parameter);
+  parameter = new G4UIparameter ("unit", 's', omitable = true);
+  parameter -> SetDefaultValue ("m");
+  fpCommandPan -> SetParameter (parameter);
+
+  fpCommandPanTo = new G4UIcommand
+    ("/vis/viewer/panTo", this);
+  fpCommandPanTo -> SetGuidance
+    ("Pan to specific coordinate.");
+  fpCommandPanTo -> SetGuidance
+    ("Places the camera in this position right and up relative to standard"
+     "\ntarget point (as seen from viewpoint direction).");
+  parameter = new G4UIparameter("right", 'd', omitable = true);
+  parameter -> SetCurrentAsDefault (true);
+  fpCommandPanTo -> SetParameter (parameter);
+  parameter = new G4UIparameter("up", 'd', omitable = true);
+  parameter -> SetCurrentAsDefault (true);
+  fpCommandPanTo -> SetParameter (parameter);
+  parameter = new G4UIparameter ("unit", 's', omitable = true);
+  parameter -> SetDefaultValue ("m");
+  fpCommandPanTo -> SetParameter (parameter);
+}
+
+G4VisCommandViewerPan::~G4VisCommandViewerPan () {
+  delete fpCommandPan;
+  delete fpCommandPanTo;
+}
+
+G4String G4VisCommandViewerPan::GetCurrentValue (G4UIcommand* command) {
+  G4String currentValue;
+  if (command == fpCommandPan) {
+    currentValue = ConvertToString(fPanIncrementRight, fPanIncrementUp, "m");
+  }
+  else if (command == fpCommandPanTo) {
+    currentValue = ConvertToString(fPanToRight, fPanToUp, "m");
+  }
+  return currentValue;
+}
+
+void G4VisCommandViewerPan::SetNewValue (G4UIcommand* command,
+					 G4String newValue) {
+
+
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+
+  G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
+  if (!currentViewer) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout <<
+	"ERROR: G4VisCommandsViewerPan::SetNewValue: no current viewer."
+	     << G4endl;
+    }
+    return;
+  }
+
+  G4ViewParameters vp = currentViewer->GetViewParameters();
+
+  if (command == fpCommandPan) {
+    ConvertToDoublePair(newValue, fPanIncrementRight, fPanIncrementUp);
+    vp.IncrementPan(fPanIncrementRight, fPanIncrementUp);
+  }
+  else if (command == fpCommandPanTo) {
+    ConvertToDoublePair(newValue, fPanToRight, fPanToUp);
+    vp.SetPan(fPanToRight, fPanToUp);
+  }
+
+  if (verbosity >= G4VisManager::confirmations) {
+    G4cout << "Current target point now " << vp.GetCurrentTargetPoint()
+	   << G4endl;
+  }
+
+  SetViewParameters(currentViewer, vp);
+}
+
+////////////// /vis/viewer/rebuild ///////////////////////////////////////
+
+G4VisCommandViewerRebuild::G4VisCommandViewerRebuild () {
+  G4bool omitable, currentAsDefault;
+  fpCommand = new G4UIcmdWithAString ("/vis/viewer/rebuild", this);
+  fpCommand -> SetGuidance ("Forces rebuild of graphical database.");
+  fpCommand -> SetGuidance 
+    ("By default, acts on current viewer.  \"/vis/viewer/list\""
+     "\nto see possible viewers.  Viewer becomes current.");
+  fpCommand -> SetParameterName ("viewer-name",
+				 omitable = true,
+				 currentAsDefault = true);
+}
+
+G4VisCommandViewerRebuild::~G4VisCommandViewerRebuild () {
+  delete fpCommand;
+}
+
+G4String G4VisCommandViewerRebuild::GetCurrentValue (G4UIcommand*) {
+  G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
+  if (viewer) {
+    return viewer -> GetName ();
+  }
+  else {
+    return "none";
+  }
+}
+
+void G4VisCommandViewerRebuild::SetNewValue (G4UIcommand*, G4String newValue) {
+
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+
+  G4String& rebuildName = newValue;
+  G4VViewer* viewer = fpVisManager -> GetViewer (rebuildName);
+  if (!viewer) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout << "ERROR: Viewer \"" << rebuildName
+	     << "\" not found - \"/vis/viewer/list\" to see possibilities."
+	     << G4endl;
+    }
+    return;
+  }
+
+  viewer->NeedKernelVisit();
+
+  // Check auto-refresh and print confirmations, but without changing
+  // view paramters...
+  SetViewParameters(viewer, viewer->GetViewParameters());
+}
+
+////////////// /vis/viewer/refresh ///////////////////////////////////////
+
+G4VisCommandViewerRefresh::G4VisCommandViewerRefresh () {
+  G4bool omitable, currentAsDefault;
+  fpCommand = new G4UIcmdWithAString ("/vis/viewer/refresh", this);
+  fpCommand -> SetGuidance
+    ("Refreshes viewer.");
+  fpCommand -> SetGuidance 
+    ("By default, acts on current viewer.  \"/vis/viewer/list\""
+     "\nto see possible viewers.  Viewer becomes current.");
+  fpCommand -> SetParameterName ("viewer-name",
+				 omitable = true,
+				 currentAsDefault = true);
+}
+
+G4VisCommandViewerRefresh::~G4VisCommandViewerRefresh () {
+  delete fpCommand;
+}
+
+G4String G4VisCommandViewerRefresh::GetCurrentValue (G4UIcommand*) {
+  G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
+  return viewer ? viewer -> GetName () : G4String("none");
+}
+
+void G4VisCommandViewerRefresh::SetNewValue (G4UIcommand*, G4String newValue) {
+
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+  G4bool warn(verbosity >= G4VisManager::warnings);
+
+  G4String& refreshName = newValue;
+  G4VViewer* viewer = fpVisManager -> GetViewer (refreshName);
+  if (!viewer) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout << "ERROR: Viewer \"" << refreshName << "\"" <<
+	" not found - \"/vis/viewer/list\"\n  to see possibilities."
+	     << G4endl;
+    }
+    return;
+  }
+
+  G4VSceneHandler* sceneHandler = viewer->GetSceneHandler();
+  if (!sceneHandler) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout << "ERROR: Viewer \"" << refreshName << "\"" <<
+	" has no scene handler - report serious bug."
+	     << G4endl;
+    }
+    return;
+  }
+
+  G4Scene* scene = sceneHandler->GetScene();
+  if (!scene) {
+    if (verbosity >= G4VisManager::confirmations) {
+      G4cout << "NOTE: SceneHandler \"" << sceneHandler->GetName()
+	     << "\", to which viewer \"" << refreshName << "\"" <<
+	"\n  is attached, has no scene - \"/vis/scene/create\" and"
+	" \"/vis/sceneHandler/attach\""
+	"\n  (or use compound command \"/vis/drawVolume\")."
+	     << G4endl;
+    }
+    return;
+  }
+  if (scene->GetRunDurationModelList().empty()) {
+    G4bool successful = scene -> AddWorldIfEmpty (warn);
+    if (!successful) {
+      if (verbosity >= G4VisManager::warnings) {
+	G4cout <<
+	  "WARNING: Scene is empty.  Perhaps no geometry exists."
+	  "\n  Try /run/initialize."
+	       << G4endl;
+      }
+      return;
+    }
+    // Scene has changed.  UpdateVisManagerScene issues
+    // /vis/scene/notifyHandlers, which does a refresh anyway, so the
+    // ordinary refresh becomes part of the else phrase...
+    UpdateVisManagerScene(scene->GetName());
+  } else {
+    if (verbosity >= G4VisManager::confirmations) {
+      G4cout << "Refreshing viewer \"" << viewer -> GetName () << "\"..."
+	     << G4endl;
+    }
+#ifdef G4DEBUG_VIS_MANAGEMENT
+    printf("G4VisCommandViewerRefresh::SetNewValue Call SetView()\n");
+#endif
+    viewer -> SetView ();
+#ifdef G4DEBUG_VIS_MANAGEMENT
+    printf("G4VisCommandViewerRefresh::SetNewValue Call SetView() END\n");
+    printf("G4VisCommandViewerRefresh::SetNewValue Call ClearView()\n");
+#endif
+    viewer -> ClearView ();
+#ifdef G4DEBUG_VIS_MANAGEMENT
+    printf("G4VisCommandViewerRefresh::SetNewValue Call ClearView() END\n");
+    printf("G4VisCommandViewerRefresh::SetNewValue Call DrawView()\n");
+#endif
+    viewer -> DrawView ();
+#ifdef G4DEBUG_VIS_MANAGEMENT
+    printf("G4VisCommandViewerRefresh::SetNewValue Call DrawView() END\n");
+#endif
+    if (verbosity >= G4VisManager::confirmations) {
+      G4cout << "Viewer \"" << viewer -> GetName () << "\"" << " refreshed."
+	"\n  (You might also need \"/vis/viewer/update\".)" << G4endl;
+    }
+  }
+}
+
+////////////// /vis/viewer/reset ///////////////////////////////////////
+
+G4VisCommandViewerReset::G4VisCommandViewerReset () {
+  G4bool omitable, currentAsDefault;
+  fpCommand = new G4UIcmdWithAString ("/vis/viewer/reset", this);
+  fpCommand -> SetGuidance ("Resets viewer.");
+  fpCommand -> SetGuidance 
+    ("By default, acts on current viewer.  \"/vis/viewer/list\""
+     "\nto see possible viewers.  Viewer becomes current.");
+  fpCommand -> SetParameterName ("viewer-name",
+				 omitable = true,
+				 currentAsDefault = true);
+}
+
+G4VisCommandViewerReset::~G4VisCommandViewerReset () {
+  delete fpCommand;
+}
+
+G4String G4VisCommandViewerReset::GetCurrentValue (G4UIcommand*) {
+  G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
+  if (viewer) {
+    return viewer -> GetName ();
+  }
+  else {
+    return "none";
+  }
+}
+
+void G4VisCommandViewerReset::SetNewValue (G4UIcommand*, G4String newValue) {
+
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+
+  G4String& resetName = newValue;
+  G4VViewer* viewer = fpVisManager -> GetViewer (resetName);
+  if (!viewer) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout << "ERROR: Viewer \"" << resetName
+	     << "\" not found - \"/vis/viewer/list\" to see possibilities."
+	     << G4endl;
+    }
+    return;
+  }
+
+  SetViewParameters(viewer, viewer->GetDefaultViewParameters());
+}
+
+////////////// /vis/viewer/scale and scaleTo ////////////////////////////
+
+G4VisCommandViewerScale::G4VisCommandViewerScale ():
+  fScaleMultiplier (G4Vector3D (1., 1., 1.)),
+  fScaleTo         (G4Vector3D (1., 1., 1.))
+{
+  G4bool omitable, currentAsDefault;
+
+  fpCommandScale = new G4UIcmdWith3Vector
+    ("/vis/viewer/scale", this);
+  fpCommandScale -> SetGuidance ("Incremental (non-uniform) scaling.");
+  fpCommandScale -> SetGuidance
+    ("Multiplies components of current scaling by components of this factor."
+     "\n Scales (x,y,z) by corresponding components of the resulting factor.");
+  fpCommandScale -> SetGuidance
+    ("");
+  fpCommandScale -> SetParameterName
+    ("x-scale-multiplier","y-scale-multiplier","z-scale-multiplier",
+     omitable=true, currentAsDefault=true);
+
+  fpCommandScaleTo = new G4UIcmdWith3Vector
+    ("/vis/viewer/scaleTo", this);
+  fpCommandScaleTo -> SetGuidance ("Absolute (non-uniform) scaling.");
+  fpCommandScaleTo -> SetGuidance
+    ("Scales (x,y,z) by corresponding components of this factor.");
+  fpCommandScaleTo -> SetParameterName
+    ("x-scale-factor","y-scale-factor","z-scale-factor",
+     omitable=true, currentAsDefault=true);
+}
+
+G4VisCommandViewerScale::~G4VisCommandViewerScale () {
+  delete fpCommandScale;
+  delete fpCommandScaleTo;
+}
+
+G4String G4VisCommandViewerScale::GetCurrentValue (G4UIcommand* command) {
+  G4String currentValue;
+  if (command == fpCommandScale) {
+    currentValue = fpCommandScale->ConvertToString(G4ThreeVector(fScaleMultiplier));
+  }
+  else if (command == fpCommandScaleTo) {
+    currentValue = fpCommandScaleTo->ConvertToString(G4ThreeVector(fScaleTo));
+  }
+  return currentValue;
+}
+
+void G4VisCommandViewerScale::SetNewValue (G4UIcommand* command,
+					   G4String newValue) {
+
+
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+
+  G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
+  if (!currentViewer) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout <<
+	"ERROR: G4VisCommandsViewerScale::SetNewValue: no current viewer."
+	     << G4endl;
+    }
+    return;
+  }
+
+  G4ViewParameters vp = currentViewer->GetViewParameters();
+
+  if (command == fpCommandScale) {
+    fScaleMultiplier = fpCommandScale->GetNew3VectorValue(newValue);
+    vp.MultiplyScaleFactor(fScaleMultiplier);
+  }
+  else if (command == fpCommandScaleTo) {
+    fScaleTo = fpCommandScale->GetNew3VectorValue(newValue);
+    vp.SetScaleFactor(fScaleTo);
+  }
+
+  if (verbosity >= G4VisManager::confirmations) {
+    G4cout << "Scale factor changed to " << vp.GetScaleFactor() << G4endl;
+  }
+
+  SetViewParameters(currentViewer, vp);
+}
+
+////////////// /vis/viewer/select ///////////////////////////////////////
+
+G4VisCommandViewerSelect::G4VisCommandViewerSelect () {
+  G4bool omitable;
+  fpCommand = new G4UIcmdWithAString ("/vis/viewer/select", this);
+  fpCommand -> SetGuidance ("Selects viewer.");
+  fpCommand -> SetGuidance
+    ("Specify viewer by name.  \"/vis/viewer/list\" to see possible viewers.");
+  fpCommand -> SetParameterName ("viewer-name", omitable = false);
+}
+
+G4VisCommandViewerSelect::~G4VisCommandViewerSelect () {
+  delete fpCommand;
+}
+
+G4String G4VisCommandViewerSelect::GetCurrentValue (G4UIcommand*) {
+  return "";
+}
+
+void G4VisCommandViewerSelect::SetNewValue (G4UIcommand*, G4String newValue) {
+
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+
+  G4String& selectName = newValue;
+  G4VViewer* viewer = fpVisManager -> GetViewer (selectName);
+
+  if (!viewer) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout << "ERROR: Viewer \"" << selectName << "\"";
+      G4cout << " not found - \"/vis/viewer/list\""
+	"\n  to see possibilities."
+	     << G4endl;
+    }
+    return;
+  }
+
+  if (viewer == fpVisManager -> GetCurrentViewer ()) {
+    if (verbosity >= G4VisManager::warnings) {
+      G4cout << "WARNING: Viewer \"" << viewer -> GetName () << "\""
+	     << " already selected." << G4endl;
+    }
+    return;
+  }
+
+  fpVisManager -> SetCurrentViewer (viewer);  // Prints confirmation.
+
+  SetViewParameters(viewer, viewer->GetViewParameters());
+}
+
+////////////// /vis/viewer/update ///////////////////////////////////////
+
+G4VisCommandViewerUpdate::G4VisCommandViewerUpdate () {
+  G4bool omitable, currentAsDefault;
+  fpCommand = new G4UIcmdWithAString ("/vis/viewer/update", this);
+  fpCommand -> SetGuidance
+    ("Triggers graphical database post-processing for viewers"
+     "\nusing that technique.");
+  fpCommand -> SetGuidance
+    ("For such viewers the view only becomes visible with this command."
+     "\nBy default, acts on current viewer.  \"/vis/viewer/list\""
+     "\nto see possible viewers.  Viewer becomes current.");
+  fpCommand -> SetParameterName ("viewer-name",
+				 omitable = true,
+				 currentAsDefault = true);
+}
+
+G4VisCommandViewerUpdate::~G4VisCommandViewerUpdate () {
+  delete fpCommand;
+}
+
+G4String G4VisCommandViewerUpdate::GetCurrentValue (G4UIcommand*) {
+  G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
+  if (viewer) {
+    return viewer -> GetName ();
+  }
+  else {
+    return "none";
+  }
+}
+
+void G4VisCommandViewerUpdate::SetNewValue (G4UIcommand*, G4String newValue) {
+
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+
+  G4String& updateName = newValue;
+
+  G4VViewer* viewer = fpVisManager -> GetViewer (updateName);
+  if (!viewer) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout <<
+	"ERROR: G4VisCommandsViewerUpdate::SetNewValue: no current viewer."
+	     << G4endl;
+    }
+    return;
+  }
+
+  G4VSceneHandler* sceneHandler = viewer->GetSceneHandler();
+  if (!sceneHandler) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout << "ERROR: Viewer \"" << updateName << "\"" <<
+	" has no scene handler - report serious bug."
+	     << G4endl;
+    }
+    return;
+  }
+
+  G4Scene* scene = sceneHandler->GetScene();
+  if (!scene) {
+    if (verbosity >= G4VisManager::confirmations) {
+      G4cout << "NOTE: SceneHandler \"" << sceneHandler->GetName()
+	     << "\", to which viewer \"" << updateName << "\"" <<
+	"\n  is attached, has no scene - \"/vis/scene/create\" and"
+	" \"/vis/sceneHandler/attach\""
+	"\n  (or use compound command \"/vis/drawVolume\")."
+	     << G4endl;
+    }
+    return;
+  }
+
+  if (viewer) {
+    if (verbosity >= G4VisManager::confirmations) {
+      G4cout << "Viewer \"" << viewer -> GetName () << "\"";
+      G4cout << " post-processing triggered." << G4endl;
+    }
+    viewer -> ShowView ();
+    // Assume future need to "refresh" transients...
+    sceneHandler -> SetMarkForClearingTransientStore(true);
+  }
+  else {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout << "ERROR: Viewer \"" << updateName << "\"";
+      G4cout << " not found - \"/vis/viewer/list\""
+	"\n  to see possibilities." << G4endl;
+    }
+  }
+}
+
+////////////// /vis/viewer/zoom and zoomTo ////////////////////////////
+
+G4VisCommandViewerZoom::G4VisCommandViewerZoom ():
+  fZoomMultiplier (1.),
+  fZoomTo         (1.)
+{
+  G4bool omitable, currentAsDefault;
+
+  fpCommandZoom = new G4UIcmdWithADouble
+    ("/vis/viewer/zoom", this);
+  fpCommandZoom -> SetGuidance ("Incremental zoom.");
+  fpCommandZoom -> SetGuidance
+    ("Multiplies current magnification by this factor.");
+  fpCommandZoom -> SetParameterName("multiplier",
+				     omitable=true,
+				     currentAsDefault=true);
+
+  fpCommandZoomTo = new G4UIcmdWithADouble
+    ("/vis/viewer/zoomTo", this);
+  fpCommandZoomTo -> SetGuidance ("Absolute zoom.");
+  fpCommandZoomTo -> SetGuidance
+    ("Magnifies standard magnification by this factor.");
+  fpCommandZoomTo -> SetParameterName("factor",
+				       omitable=true,
+				       currentAsDefault=true);
+}
+
+G4VisCommandViewerZoom::~G4VisCommandViewerZoom () {
+  delete fpCommandZoom;
+  delete fpCommandZoomTo;
+}
+
+G4String G4VisCommandViewerZoom::GetCurrentValue (G4UIcommand* command) {
+  G4String currentValue;
+  if (command == fpCommandZoom) {
+    currentValue = fpCommandZoom->ConvertToString(fZoomMultiplier);
+  }
+  else if (command == fpCommandZoomTo) {
+    currentValue = fpCommandZoomTo->ConvertToString(fZoomTo);
+  }
+  return currentValue;
+}
+
+void G4VisCommandViewerZoom::SetNewValue (G4UIcommand* command,
+					  G4String newValue) {
+
+
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+
+  G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
+  if (!currentViewer) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout <<
+	"ERROR: G4VisCommandsViewerZoom::SetNewValue: no current viewer."
+	     << G4endl;
+    }
+    return;
+  }
+
+  G4ViewParameters vp = currentViewer->GetViewParameters();
+
+  if (command == fpCommandZoom) {
+    fZoomMultiplier = fpCommandZoom->GetNewDoubleValue(newValue);
+    vp.MultiplyZoomFactor(fZoomMultiplier);
+  }
+  else if (command == fpCommandZoomTo) {
+    fZoomTo = fpCommandZoom->GetNewDoubleValue(newValue);
+    vp.SetZoomFactor(fZoomTo);
+  }
+
+  if (verbosity >= G4VisManager::confirmations) {
+    G4cout << "Zoom factor changed to " << vp.GetZoomFactor() << G4endl;
+  }
+
+  SetViewParameters(currentViewer, vp);
+}
Index: tags/visualization-10.5-before-10.6_test/management/src/G4VisCommandsViewerSet.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/src/G4VisCommandsViewerSet.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/src/G4VisCommandsViewerSet.cc	(revision 1102)
@@ -0,0 +1,1011 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VisCommandsViewerSet.cc,v 1.50 2009/05/13 18:17:25 allison Exp $
+// GEANT4 tag $Name: HEAD $
+
+// /vis/viewer/set commands - John Allison  16th May 2000
+
+#include "G4VisCommandsViewerSet.hh"
+
+#include "G4UIcommand.hh"
+#include "G4UIcmdWithAString.hh"
+#include "G4UIcmdWithABool.hh"
+#include "G4UIcmdWithAnInteger.hh"
+#include "G4UIcmdWithADouble.hh"
+#include "G4UIcmdWith3VectorAndUnit.hh"
+#include "G4UnitsTable.hh"
+#include "G4VisManager.hh"
+#include "G4Polyhedron.hh"
+
+#include <sstream>
+#include <cctype>
+
+G4VisCommandsViewerSet::G4VisCommandsViewerSet ():
+  fLightsVector    (G4ThreeVector(1.,1.,1.)),
+  fUpVector        (G4ThreeVector(0.,1.,0.)),
+  fViewpointVector (G4ThreeVector(0.,0.,1.))
+{
+  G4bool omitable;
+  G4UIparameter* parameter;
+
+  fpCommandAll = new G4UIcmdWithAString ("/vis/viewer/set/all",this);
+  fpCommandAll->SetGuidance
+    ("Copies view parameters.");
+  fpCommandAll->SetGuidance
+    ("Copies view parameters (except the autoRefresh status) from"
+     "\nfrom-viewer to current viewer.");
+  fpCommandAll->SetParameterName ("from-viewer-name",omitable = false);
+
+  fpCommandAutoRefresh = new G4UIcmdWithABool
+    ("/vis/viewer/set/autoRefresh",this);
+  fpCommandAutoRefresh->SetGuidance("Sets auto-refresh.");
+  fpCommandAutoRefresh->SetGuidance
+    ("If true, view is automatically refreshed after a change of"
+     "\nview parameters.");
+  fpCommandAutoRefresh->SetParameterName("auto-refresh",omitable = true);
+  fpCommandAutoRefresh->SetDefaultValue(true);
+
+  fpCommandAuxEdge = new G4UIcmdWithABool
+    ("/vis/viewer/set/auxiliaryEdge",this);
+  fpCommandAuxEdge->SetGuidance("Sets visibility of auxiliary edges");
+  fpCommandAuxEdge->SetGuidance
+    ("Auxiliary edges, i.e., those that are part of a curved surface,"
+     "\nsometimes called soft edges, become visible/invisible.");
+  fpCommandAuxEdge->SetParameterName("edge",omitable = true);
+  fpCommandAuxEdge->SetDefaultValue(true);
+
+  fpCommandBackground = new G4UIcommand
+    ("/vis/viewer/set/background",this);
+  fpCommandBackground->SetGuidance
+    ("Set background colour and transparency (default black and opaque).");
+  fpCommandBackground->SetGuidance
+    ("Accepts (a) RGB triplet. e.g., \".3 .4 .5\", or"
+     "\n(b) string such as \"white\", \"black\", \"grey\", \"red\"..."
+     "\n(c) an additional number for opacity, e.g., \".3 .4 .5 .6\""
+     "\n    or \"grey ! ! .6\" (note \"!\"'s for unused green and blue parameters),"
+     "\n    e.g. \"! ! ! 0.\" for a transparent background.");
+  parameter = new G4UIparameter("red_or_string", 's', omitable = true);
+  parameter -> SetDefaultValue ("0.");
+  fpCommandBackground -> SetParameter (parameter);
+  parameter = new G4UIparameter("green", 'd', omitable = true);
+  parameter -> SetDefaultValue (0.);
+  fpCommandBackground -> SetParameter (parameter);
+  parameter = new G4UIparameter ("blue", 'd', omitable = true);
+  parameter -> SetDefaultValue (0.);
+  fpCommandBackground -> SetParameter (parameter);
+  parameter = new G4UIparameter ("opacity", 'd', omitable = true);
+  parameter -> SetDefaultValue (1.);
+  fpCommandBackground -> SetParameter (parameter);
+
+  fpCommandCulling = new G4UIcommand("/vis/viewer/set/culling",this);
+  fpCommandCulling->SetGuidance ("Set culling options.");
+  fpCommandCulling->SetGuidance
+    ("\"global\": enables/disables all other culling options.");
+  fpCommandCulling->SetGuidance
+    ("\"coveredDaughters\": culls, i.e., eliminates, volumes that would not"
+     "\nbe seen because covered by ancester volumes in surface drawing mode,"
+     "\nand then only if the ancesters are visible and opaque, and then only"
+     "\nif no sections or cutaways are in operation.  Intended solely to"
+     "\nimprove the speed of rendering visible volumes.");
+  fpCommandCulling->SetGuidance
+    ("\"invisible\": culls objects with the invisible attribute set.");
+  fpCommandCulling->SetGuidance
+    ("\"density\": culls volumes with density lower than threshold.  Useful"
+     "\nfor eliminating \"container volumes\" with no physical correspondence,"
+     "\nwhose material is usually air.  If this is selected, provide threshold"
+     "\ndensity and unit (g/cm3 mg/cm3 or kg/m3)."
+     );
+  parameter = new G4UIparameter("culling-option",'s',omitable = false);
+  parameter->SetParameterCandidates
+    ("global coveredDaughters invisible density");
+  fpCommandCulling->SetParameter(parameter);
+  parameter = new G4UIparameter("action",'b',omitable = true);
+  parameter->SetDefaultValue(1);
+  fpCommandCulling->SetParameter(parameter);
+  parameter = new G4UIparameter("density-threshold",'d',omitable = true);
+  parameter->SetDefaultValue("0.01");
+  fpCommandCulling->SetParameter(parameter);
+  parameter = new G4UIparameter("unit",'s',omitable = true);
+  parameter->SetParameterCandidates ("g/cm3, mg/cm3 kg/m3");
+  parameter->SetDefaultValue("g/cm3");
+  fpCommandCulling->SetParameter(parameter);
+
+  fpCommandCutawayMode =
+    new G4UIcmdWithAString ("/vis/viewer/set/cutawayMode", this);
+  fpCommandCutawayMode->SetGuidance
+    ("Sets cutaway mode - add (union) or multiply (intersection).");
+  fpCommandCutawayMode->SetParameterName ("cutaway-mode",omitable = false);
+  fpCommandCutawayMode->SetCandidates ("add union multiply intersection");
+  fpCommandCutawayMode->SetDefaultValue("union");
+
+  fpCommandEdge = new G4UIcmdWithABool("/vis/viewer/set/edge",this);
+  fpCommandEdge->SetGuidance
+    ("Edges become visible/invisible in surface mode.");
+  fpCommandEdge->SetParameterName("edge",omitable = true);
+  fpCommandEdge->SetDefaultValue(true);
+
+  fpCommandExplodeFactor = new G4UIcommand
+    ("/vis/viewer/set/explodeFactor", this);
+  fpCommandExplodeFactor->SetGuidance
+    ("Moves top-level drawn volumes by this factor from this centre.");
+  parameter = new G4UIparameter("explodeFactor", 'd', omitable=true);
+  parameter->SetParameterRange("explodeFactor>=1.");
+  parameter->SetDefaultValue(1.);
+  fpCommandExplodeFactor->SetParameter(parameter);
+  parameter = new G4UIparameter("x",'d',omitable = true);
+  parameter->SetDefaultValue  (0);
+  parameter->SetGuidance      ("Coordinate of explode centre.");
+  fpCommandExplodeFactor->SetParameter(parameter);
+  parameter = new G4UIparameter("y",'d',omitable = true);
+  parameter->SetDefaultValue  (0);
+  parameter->SetGuidance      ("Coordinate of explode centre.");
+  fpCommandExplodeFactor->SetParameter(parameter);
+  parameter = new G4UIparameter("z",'d',omitable = true);
+  parameter->SetDefaultValue  (0);
+  parameter->SetGuidance      ("Coordinate of explode centre.");
+  fpCommandExplodeFactor->SetParameter(parameter);
+  parameter = new G4UIparameter("unit",'s',omitable = true);
+  parameter->SetDefaultValue  ("m");
+  parameter->SetGuidance      ("Unit of explode centre.");
+  fpCommandExplodeFactor->SetParameter(parameter);
+
+  fpCommandGlobalLineWidthScale = new G4UIcmdWithADouble
+    ("/vis/viewer/set/globalLineWidthScale", this);
+  fpCommandGlobalLineWidthScale->SetGuidance
+    ("Multiplies line widths by this factor.");
+  fpCommandGlobalLineWidthScale->
+    SetParameterName("scale-factor", omitable=true);
+  fpCommandGlobalLineWidthScale->SetDefaultValue(1.);
+
+  fpCommandGlobalMarkerScale = new G4UIcmdWithADouble
+    ("/vis/viewer/set/globalMarkerScale", this);
+  fpCommandGlobalMarkerScale->SetGuidance
+    ("Multiplies marker sizes by this factor.");
+  fpCommandGlobalMarkerScale->
+    SetParameterName("scale-factor", omitable=true);
+  fpCommandGlobalMarkerScale->SetDefaultValue(1.);
+
+  fpCommandHiddenEdge =
+    new G4UIcmdWithABool("/vis/viewer/set/hiddenEdge",this);
+  fpCommandHiddenEdge->SetGuidance
+    ("Edges become hidden/seen in wireframe or surface mode.");
+  fpCommandHiddenEdge->SetParameterName("hidden-edge",omitable = true);
+  fpCommandHiddenEdge->SetDefaultValue(true);
+
+  fpCommandHiddenMarker =
+    new G4UIcmdWithABool("/vis/viewer/set/hiddenMarker",this);
+  fpCommandHiddenMarker->SetGuidance
+    ("If true, closer objects hide markers. Otherwise, markers always show.");
+  fpCommandHiddenMarker->SetParameterName("hidden-marker",omitable = true);
+  fpCommandHiddenMarker->SetDefaultValue(true);
+
+  fpCommandLightsMove = new G4UIcmdWithAString
+    ("/vis/viewer/set/lightsMove",this);
+  fpCommandLightsMove->SetGuidance
+    ("Lights move with camera or with object");
+  fpCommandLightsMove->SetParameterName("lightsMove",omitable = false);
+  fpCommandLightsMove->SetCandidates
+    ("cam camera with-camera obj object with-object");
+
+  fpCommandLightsThetaPhi = new G4UIcommand
+    ("/vis/viewer/set/lightsThetaPhi", this);
+  fpCommandLightsThetaPhi->SetGuidance
+    ("Set direction from target to lights.");
+  parameter = new G4UIparameter("theta", 'd', omitable = true);
+  parameter -> SetDefaultValue(60.);
+  fpCommandLightsThetaPhi -> SetParameter (parameter);
+  parameter = new G4UIparameter("phi", 'd', omitable = true);
+  parameter -> SetDefaultValue(45.);
+  fpCommandLightsThetaPhi -> SetParameter (parameter);
+  parameter = new G4UIparameter ("unit", 's', omitable = true);
+  parameter -> SetDefaultValue ("deg");
+  fpCommandLightsThetaPhi -> SetParameter (parameter);
+
+  fpCommandLightsVector = new G4UIcommand
+    ("/vis/viewer/set/lightsVector", this);
+  fpCommandLightsVector->SetGuidance
+    ("Set direction from target to lights.");
+  parameter = new G4UIparameter("x", 'd', omitable = true);
+  parameter -> SetDefaultValue (1);
+  fpCommandLightsVector -> SetParameter (parameter);
+  parameter = new G4UIparameter("y", 'd', omitable = true);
+  parameter -> SetDefaultValue (1);
+  fpCommandLightsVector -> SetParameter (parameter);
+  parameter = new G4UIparameter ("z", 'd', omitable = true);
+  parameter -> SetDefaultValue (1);
+  fpCommandLightsVector -> SetParameter (parameter);
+
+  fpCommandLineSegments = new G4UIcmdWithAnInteger
+    ("/vis/viewer/set/lineSegmentsPerCircle",this);
+  fpCommandLineSegments->SetGuidance
+    ("Set number of sides per circle for polygon/polyhedron drawing.");
+  fpCommandLineSegments->SetGuidance
+ ("Refers to graphical representation of objects with curved lines/surfaces.");
+  fpCommandLineSegments->SetParameterName("line-segments",omitable = true);
+  fpCommandLineSegments->SetDefaultValue(24);
+
+  fpCommandPicking = new G4UIcmdWithABool
+    ("/vis/viewer/set/picking",this);
+  fpCommandPicking->SetGuidance("Sets picking, if available.");
+  fpCommandPicking->SetGuidance
+    ("If true, view is set up for picking, if available."
+     "\nFor required actions, watch for instructions for viewer.");
+  fpCommandPicking->SetParameterName("picking",omitable = true);
+  fpCommandPicking->SetDefaultValue(true);
+
+  fpCommandProjection = new G4UIcommand("/vis/viewer/set/projection",this);
+  fpCommandProjection->SetGuidance
+    ("Orthogonal or perspective projection.");
+  parameter = new G4UIparameter("projection",'s',omitable = true);
+  parameter->SetParameterCandidates("o orthogonal p perspective");
+  parameter->SetDefaultValue("orthogonal");
+  fpCommandProjection->SetParameter(parameter);
+  parameter = new G4UIparameter("field-half-angle",'d',omitable = true);
+  parameter->SetDefaultValue(30.);
+  fpCommandProjection->SetParameter(parameter);
+  parameter = new G4UIparameter("unit",'s',omitable = true);
+  parameter->SetDefaultValue("deg");
+  fpCommandProjection->SetParameter(parameter);
+
+  fpCommandSectionPlane = new G4UIcommand("/vis/viewer/set/sectionPlane",this);
+  fpCommandSectionPlane -> SetGuidance
+    ("Set plane for drawing section (DCUT).");
+  fpCommandSectionPlane -> SetGuidance
+    ("E.g., for a y-z plane at x = 1 cm:"
+     "\n\"/vis/viewer/set/sectionPlane on 1 0 0 cm 1 0 0\"."
+     "\nTo turn off: /vis/viewer/set/sectionPlane off");
+  parameter  =  new G4UIparameter("Selector",'c',true);
+  parameter  -> SetDefaultValue  ("on");
+  fpCommandSectionPlane->SetParameter(parameter);
+  parameter  =  new G4UIparameter("x",'d',omitable = true);
+  parameter  -> SetDefaultValue  (0);
+  parameter  -> SetGuidance      ("Coordinate of point on the plane.");
+  fpCommandSectionPlane->SetParameter(parameter);
+  parameter  =  new G4UIparameter("y",'d',omitable = true);
+  parameter  -> SetDefaultValue  (0);
+  parameter  -> SetGuidance      ("Coordinate of point on the plane.");
+  fpCommandSectionPlane->SetParameter(parameter);
+  parameter  =  new G4UIparameter("z",'d',omitable = true);
+  parameter  -> SetDefaultValue  (0);
+  parameter  -> SetGuidance      ("Coordinate of point on the plane.");
+  fpCommandSectionPlane->SetParameter(parameter);
+  parameter  =  new G4UIparameter("unit",'s',omitable = true);
+  parameter  -> SetDefaultValue  ("m");
+  parameter  -> SetGuidance      ("Unit of point on the plane.");
+  fpCommandSectionPlane->SetParameter(parameter);
+  parameter  =  new G4UIparameter("nx",'d',omitable = true);
+  parameter  -> SetDefaultValue  (1);
+  parameter  -> SetGuidance      ("Component of plane normal.");
+  fpCommandSectionPlane->SetParameter(parameter);
+  parameter  =  new G4UIparameter("ny",'d',omitable = true);
+  parameter  -> SetDefaultValue  (0);
+  parameter  -> SetGuidance      ("Component of plane normal.");
+  fpCommandSectionPlane->SetParameter(parameter);
+  parameter  =  new G4UIparameter("nz",'d',omitable = true);
+  parameter  -> SetDefaultValue  (0);
+  parameter  -> SetGuidance      ("Component of plane normal.");
+  fpCommandSectionPlane->SetParameter(parameter);
+
+  fpCommandStyle = new G4UIcmdWithAString ("/vis/viewer/set/style",this);
+  fpCommandStyle->SetGuidance
+    ("Set style of drawing - w[ireframe] or s[urface].");
+  fpCommandStyle->SetGuidance 
+    ("(Hidden line drawing is controlled by \"/vis/viewer/set/hiddenEdge\".)");
+  fpCommandStyle->SetParameterName ("style",omitable = false);
+
+  fpCommandTargetPoint = new G4UIcmdWith3VectorAndUnit
+    ("/vis/viewer/set/targetPoint", this);
+  fpCommandTargetPoint->SetGuidance
+    ("Set target point.");
+  fpCommandTargetPoint->SetGuidance
+    ("This sets the \"Current Target Point\" relative to the \"Standard");
+  fpCommandTargetPoint->SetGuidance
+    ("Target Point\" so that the actual target point is as requested.");
+  fpCommandTargetPoint->SetGuidance
+    ("(See G4ViewParameters.hh for an explanation of target points.)");
+  fpCommandTargetPoint->SetParameterName("x", "y", "z", omitable = false);
+  fpCommandTargetPoint->SetUnitCategory("Length");
+
+  fpCommandUpThetaPhi = new G4UIcommand
+    ("/vis/viewer/set/upThetaPhi", this);
+  fpCommandUpThetaPhi -> SetGuidance ("Set up vector.");
+  fpCommandUpThetaPhi -> SetGuidance
+    ("Viewer will attempt always to show this direction upwards.");
+  parameter = new G4UIparameter("theta", 'd', omitable = true);
+  parameter -> SetDefaultValue (90.);
+  fpCommandUpThetaPhi -> SetParameter (parameter);
+  parameter = new G4UIparameter("phi", 'd', omitable = true);
+  parameter -> SetDefaultValue (90.);
+  fpCommandUpThetaPhi -> SetParameter (parameter);
+  parameter = new G4UIparameter ("unit", 's', omitable = true);
+  parameter -> SetDefaultValue ("deg");
+  fpCommandUpThetaPhi -> SetParameter (parameter);
+
+  fpCommandUpVector = new G4UIcommand
+    ("/vis/viewer/set/upVector", this);
+  fpCommandUpVector -> SetGuidance ("Set up vector.");
+  fpCommandUpVector -> SetGuidance
+    ("Viewer will attempt always to show this direction upwards.");
+  parameter = new G4UIparameter("x", 'd', omitable = true);
+  parameter -> SetDefaultValue (0.);
+  fpCommandUpVector -> SetParameter (parameter);
+  parameter = new G4UIparameter("y", 'd', omitable = true);
+  parameter -> SetDefaultValue (1.);
+  fpCommandUpVector -> SetParameter (parameter);
+  parameter = new G4UIparameter ("z", 'd', omitable = true);
+  parameter -> SetDefaultValue (0.);
+  fpCommandUpVector -> SetParameter (parameter);
+
+  fpCommandViewpointThetaPhi = new G4UIcommand
+    ("/vis/viewer/set/viewpointThetaPhi", this);
+  fpCommandViewpointThetaPhi -> SetGuidance
+    ("Set direction from target to camera.");
+  fpCommandViewpointThetaPhi -> SetGuidance
+  ("Also changes lightpoint direction if lights are set to move with camera.");
+  parameter = new G4UIparameter("theta", 'd', omitable = true);
+  parameter -> SetDefaultValue (60.);
+  fpCommandViewpointThetaPhi -> SetParameter (parameter);
+  parameter = new G4UIparameter("phi", 'd', omitable = true);
+  parameter -> SetDefaultValue (45.);
+  fpCommandViewpointThetaPhi -> SetParameter (parameter);
+  parameter = new G4UIparameter ("unit", 's', omitable = true);
+  parameter -> SetDefaultValue ("deg");
+  fpCommandViewpointThetaPhi -> SetParameter (parameter);
+
+  fpCommandViewpointVector = new G4UIcommand
+    ("/vis/viewer/set/viewpointVector", this);
+  fpCommandViewpointVector -> SetGuidance
+    ("Set direction from target to camera.");
+  fpCommandViewpointVector -> SetGuidance
+  ("Also changes lightpoint direction if lights are set to move with camera.");
+  parameter = new G4UIparameter("x", 'd', omitable = true);
+  parameter -> SetDefaultValue (1.);
+  fpCommandViewpointVector -> SetParameter (parameter);
+  parameter = new G4UIparameter("y", 'd', omitable = true);
+  parameter -> SetDefaultValue (1.);
+  fpCommandViewpointVector -> SetParameter (parameter);
+  parameter = new G4UIparameter ("z", 'd', omitable = true);
+  parameter -> SetDefaultValue (1.);
+  fpCommandViewpointVector -> SetParameter (parameter);
+}
+
+G4VisCommandsViewerSet::~G4VisCommandsViewerSet() {
+  delete fpCommandAll;
+  delete fpCommandAuxEdge;
+  delete fpCommandAutoRefresh;
+  delete fpCommandBackground;
+  delete fpCommandCulling;
+  delete fpCommandCutawayMode;
+  delete fpCommandEdge;
+  delete fpCommandExplodeFactor;
+  delete fpCommandGlobalLineWidthScale;
+  delete fpCommandGlobalMarkerScale;
+  delete fpCommandHiddenEdge;
+  delete fpCommandHiddenMarker;
+  delete fpCommandLineSegments;
+  delete fpCommandLightsMove;
+  delete fpCommandLightsThetaPhi;
+  delete fpCommandLightsVector;
+  delete fpCommandPicking;
+  delete fpCommandProjection;
+  delete fpCommandSectionPlane;
+  delete fpCommandStyle;
+  delete fpCommandTargetPoint;
+  delete fpCommandUpThetaPhi;
+  delete fpCommandUpVector;
+  delete fpCommandViewpointThetaPhi;
+  delete fpCommandViewpointVector;
+}
+
+G4String G4VisCommandsViewerSet::GetCurrentValue(G4UIcommand*) {
+  return "";
+}
+
+void G4VisCommandsViewerSet::SetNewValue
+(G4UIcommand* command,G4String newValue) {
+
+  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
+
+  G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
+  if (!currentViewer) {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout << 
+	"ERROR: G4VisCommandsViewerSet::SetNewValue: no current viewer."
+	     << G4endl;
+    }
+    return;
+  }
+
+  G4ViewParameters vp = currentViewer->GetViewParameters();
+
+  if (command == fpCommandAll) {
+    G4VViewer* fromViewer = fpVisManager->GetViewer(newValue);
+    if (!fromViewer) {
+      if (verbosity >= G4VisManager::errors) {
+	G4cout <<
+	  "ERROR: G4VisCommandsViewerSet::SetNewValue: all:"
+	  "\n  unrecognised from-viewer."
+	       << G4endl;
+      }
+      return;
+    }
+    if (fromViewer == currentViewer) {
+      if (verbosity >= G4VisManager::warnings) {
+      G4cout <<
+	"WARNING: G4VisCommandsViewerSet::SetNewValue: all:"
+	"\n  from-viewer and current viewer are identical."
+	     << G4endl;
+      }
+      return;
+    }
+    // Copy view parameters except for autoRefresh...
+    G4bool currentAutoRefresh =
+      currentViewer->GetViewParameters().IsAutoRefresh();
+    vp = fromViewer->GetViewParameters();
+    vp.SetAutoRefresh(currentAutoRefresh);
+    if (verbosity >= G4VisManager::confirmations) {
+      G4cout << "View parameters of viewer \"" << currentViewer->GetName()
+	     << "\"\n  set to those of viewer \"" << fromViewer->GetName()
+	     << "\"."
+	     << G4endl;
+    }
+  }
+
+  else if (command == fpCommandAutoRefresh) {
+    G4bool autoRefresh = G4UIcommand::ConvertToBool(newValue);
+    vp.SetAutoRefresh(autoRefresh);
+    if (verbosity >= G4VisManager::confirmations) {
+      G4cout << "Views will ";
+      if (!vp.IsAutoRefresh()) G4cout << "not ";
+      G4cout << "be automatically refreshed after a change of view parameters."
+	     << G4endl;
+    }
+    if (!vp.IsAutoRefresh()) {
+      currentViewer->SetViewParameters(vp);
+      return;  // Avoid a refresh id auto-refresh has been set to off...
+    }  // ...otherwise take normal action.
+  }
+
+  else if (command == fpCommandAuxEdge) {
+    vp.SetAuxEdgeVisible(G4UIcommand::ConvertToBool(newValue));
+    if (verbosity >= G4VisManager::confirmations) {
+      G4cout << "Auxiliary edges will ";
+      if (!vp.IsAuxEdgeVisible()) G4cout << "not ";
+      G4cout << "be visible." << G4endl;
+    }
+  }
+
+  else if (command == fpCommandBackground) {
+    G4String redOrString;
+    G4double green, blue, opacity;
+    std::istringstream iss(newValue);
+    iss >> redOrString >> green >> blue >> opacity;
+    G4Colour colour(0.,0.,0.);  // Default black and opaque.
+    const size_t iPos0 = 0;
+    if (std::isalpha(redOrString[iPos0])) {
+      G4Colour::GetColour(redOrString, colour); // Remains default (black) if
+						// not found.
+    } else {
+      colour = G4Colour(G4UIcommand::ConvertTo3Vector(newValue));
+    }
+    colour = G4Colour(colour.GetRed(), colour.GetGreen(), colour.GetBlue(), opacity);
+    vp.SetBackgroundColour(colour);
+    if (verbosity >= G4VisManager::confirmations) {
+      G4cout << "Background colour "
+	     << vp.GetBackgroundColour()
+	     << " requested."
+	     << G4endl;
+    }
+  }
+
+  else if (command == fpCommandCulling) {
+    G4String cullingOption, stringFlag, unit;
+    G4double density;
+    std::istringstream is (newValue);
+    is >> cullingOption >> stringFlag >> density >> unit;
+    G4bool boolFlag = G4UIcommand::ConvertToBool(stringFlag);
+    if (cullingOption == "global") {
+      vp.SetCulling(boolFlag);
+      if (verbosity >= G4VisManager::confirmations) {
+	G4cout <<
+	  "G4VisCommandsViewerSet::SetNewValue: culling: global culling flag"
+	  " set to " << G4UIcommand::ConvertToString(boolFlag) <<
+	  ".\n  Does not change specific culling flags."
+	       << G4endl;
+      }
+    }
+    else if (cullingOption == "coveredDaughters") {
+      vp.SetCullingCovered(boolFlag);
+      if (verbosity >= G4VisManager::confirmations) {
+	G4cout <<
+	  "G4VisCommandsViewerSet::SetNewValue: culling: culling covered"
+	  "\n  daughters flag set to "
+	       << G4UIcommand::ConvertToString(boolFlag) <<
+	  ".  Daughters covered by opaque mothers"
+	  "\n  will be culled, i.e., not drawn, if this flag is true."
+	  "\n  Note: this is only effective in surface drawing style,"
+	  "\n  and then only if the volumes are visible and opaque, and then"
+	  "\n  only if no sections or cutaways are in operation."
+	       << G4endl;
+      }
+    }
+    else if (cullingOption == "invisible") {
+      vp.SetCullingInvisible(boolFlag);
+      if (verbosity >= G4VisManager::confirmations) {
+	G4cout <<
+	  "G4VisCommandsViewerSet::SetNewValue: culling: culling invisible"
+	  "\n  flag set to "
+	       << boolFlag << G4UIcommand::ConvertToString(boolFlag) <<
+	  ".  Volumes marked invisible will be culled,"
+	  "\n  i.e., not drawn, if this flag is true."
+	       << G4endl;
+      }
+    }
+    else if (cullingOption == "density") {
+      vp.SetDensityCulling(boolFlag);
+      if (boolFlag) {
+	density *= G4UnitDefinition::GetValueOf(unit);
+	vp.SetVisibleDensity(density);
+      }
+      else {
+	density = vp.GetVisibleDensity();
+      }
+      if (verbosity >= G4VisManager::confirmations) {
+	G4cout <<
+	  "G4VisCommandsViewerSet::SetNewValue: culling: culling by density"
+	  "\n  flag set to " << G4UIcommand::ConvertToString(boolFlag) <<
+	  ".  Volumes with density less than " <<
+	  G4BestUnit(density,"Volumic Mass") <<
+	  "\n  will be culled, i.e., not drawn, if this flag is true."
+	       << G4endl;
+      }
+    }
+    else {
+      if (verbosity >= G4VisManager::errors) {
+	G4cout <<
+	  "ERROR: G4VisCommandsViewerSet::SetNewValue: culling:"
+	  "\n  option not recognised."
+	       << G4endl;
+      }
+    }
+  }
+
+  else if (command == fpCommandCutawayMode) {
+    if (newValue == "add" || newValue == "union")
+      vp.SetCutawayMode(G4ViewParameters::cutawayUnion);
+    if (newValue == "multiply" || newValue == "intersection")
+      vp.SetCutawayMode(G4ViewParameters::cutawayIntersection);
+ 
+    if (verbosity >= G4VisManager::confirmations) {
+      G4cout << "Cutaway mode set to ";
+      if (vp.GetCutawayMode() == G4ViewParameters::cutawayUnion)
+	G4cout << "cutawayUnion";
+      if (vp.GetCutawayMode() == G4ViewParameters::cutawayIntersection)
+	G4cout << "cutawayIntersection";
+      G4cout << G4endl;
+    }
+  }
+
+  else if (command == fpCommandEdge) {
+    G4ViewParameters::DrawingStyle existingStyle = vp.GetDrawingStyle();
+    if (G4UIcommand::ConvertToBool(newValue)) {
+      switch (existingStyle) {
+      case G4ViewParameters::wireframe:
+	break;
+      case G4ViewParameters::hlr:
+	break;
+      case G4ViewParameters::hsr:
+	vp.SetDrawingStyle(G4ViewParameters::hlhsr);
+        break;
+      case G4ViewParameters::hlhsr:
+        break;
+      }
+    }
+    else {
+      switch (existingStyle) {
+      case G4ViewParameters::wireframe:
+	break;
+      case G4ViewParameters::hlr:
+	break;
+      case G4ViewParameters::hsr:
+	break;
+      case G4ViewParameters::hlhsr:
+	vp.SetDrawingStyle(G4ViewParameters::hsr);
+	break;
+      }
+    }
+    if (verbosity >= G4VisManager::confirmations) {
+      G4cout << "Drawing style of viewer \"" << currentViewer->GetName()
+	     << "\" set to " << vp.GetDrawingStyle()
+	     << G4endl;
+    }
+  }
+
+  else if (command == fpCommandExplodeFactor) {
+    G4double explodeFactor, x, y, z;
+    G4String unitString;
+    std::istringstream is (newValue);
+    is >> explodeFactor >> x >> y >> z >> unitString;
+    G4double unit = G4UIcommand::ValueOf(unitString);
+    vp.SetExplodeFactor(explodeFactor);
+    vp.SetExplodeCentre(G4Point3D(x * unit, y * unit, z * unit));
+    if (verbosity >= G4VisManager::confirmations) {
+      G4cout << "Explode factor changed to " << vp.GetExplodeFactor()
+	     << " from centre " << vp.GetExplodeCentre()
+	     << G4endl;
+    }
+  }
+
+  else if (command == fpCommandGlobalLineWidthScale) {
+    G4double globalLineWidthScale
+      = fpCommandGlobalLineWidthScale->GetNewDoubleValue(newValue);
+    vp.SetGlobalLineWidthScale(globalLineWidthScale);
+    if (verbosity >= G4VisManager::confirmations) {
+      G4cout << "Global Line Width Scale changed to "
+	     << vp.GetGlobalLineWidthScale() << G4endl;
+    }
+  }
+
+  else if (command == fpCommandGlobalMarkerScale) {
+    G4double globalMarkerScale
+      = fpCommandGlobalMarkerScale->GetNewDoubleValue(newValue);
+    vp.SetGlobalMarkerScale(globalMarkerScale);
+    if (verbosity >= G4VisManager::confirmations) {
+      G4cout << "Global Marker Scale changed to "
+	     << vp.GetGlobalMarkerScale() << G4endl;
+    }
+  }
+
+  else if (command == fpCommandHiddenEdge) {
+    G4ViewParameters::DrawingStyle existingStyle = vp.GetDrawingStyle();
+    if (G4UIcommand::ConvertToBool(newValue)) {
+      switch (existingStyle) {
+      case G4ViewParameters::wireframe:
+	vp.SetDrawingStyle(G4ViewParameters::hlr);
+	break;
+      case G4ViewParameters::hlr:
+	break;
+      case G4ViewParameters::hsr:
+	vp.SetDrawingStyle(G4ViewParameters::hlhsr);
+        break;
+      case G4ViewParameters::hlhsr:
+        break;
+      }
+    }
+    else {
+      switch (existingStyle) {
+      case G4ViewParameters::wireframe:
+	break;
+      case G4ViewParameters::hlr:
+	vp.SetDrawingStyle(G4ViewParameters::wireframe);
+	break;
+      case G4ViewParameters::hsr:
+	break;
+      case G4ViewParameters::hlhsr:
+	vp.SetDrawingStyle(G4ViewParameters::hsr);
+	break;
+      }
+    }
+    if (verbosity >= G4VisManager::confirmations) {
+      G4cout << "Drawing style of viewer \"" << currentViewer->GetName()
+	     << "\" set to " << vp.GetDrawingStyle()
+	     << G4endl;
+    }
+  }
+
+  else if (command == fpCommandHiddenMarker) {
+    G4bool hidden = G4UIcommand::ConvertToBool(newValue);
+    if (hidden) vp.SetMarkerHidden();
+    else vp.SetMarkerNotHidden();
+    if (verbosity >= G4VisManager::confirmations) {
+      G4cout << "Markers will ";
+      if (vp.IsMarkerNotHidden()) G4cout << "not ";
+      G4cout << "be hidden under solid objects." << G4endl;
+    }
+  }
+
+  else if (command == fpCommandLightsMove) {
+    G4String s (newValue);
+    if (s.find("cam") != G4String::npos) vp.SetLightsMoveWithCamera(true);
+    else if(s.find("obj") != G4String::npos) vp.SetLightsMoveWithCamera(false);
+    else {
+      if (verbosity >= G4VisManager::errors) {
+	G4cout << "ERROR: \"" << newValue << "\" not recognised."
+	"  Looking for \"cam\" or \"obj\" in string." << G4endl;
+      }
+    }
+    if (verbosity >= G4VisManager::confirmations) {
+      G4cout << "Lights move with ";
+      if (vp.GetLightsMoveWithCamera())
+	G4cout << "camera (object appears to rotate).";
+      else G4cout << "object (the viewer appears to be moving).";
+      G4cout << G4endl;
+    }
+  }
+
+  else if (command == fpCommandLightsThetaPhi) {
+    G4double theta, phi;
+    ConvertToDoublePair(newValue, theta, phi);
+    G4double x = std::sin (theta) * std::cos (phi);
+    G4double y = std::sin (theta) * std::sin (phi);
+    G4double z = std::cos (theta);
+    fLightsVector = G4ThreeVector (x, y, z);
+    vp.SetLightpointDirection(fLightsVector);
+    if (verbosity >= G4VisManager::confirmations) {
+      G4cout << "Lights direction set to "
+	     << vp.GetLightpointDirection() << G4endl;
+    }
+  }
+
+  else if (command == fpCommandLightsVector) {
+    fLightsVector = G4UIcommand::ConvertTo3Vector(newValue);
+    vp.SetLightpointDirection(fLightsVector);
+    if (verbosity >= G4VisManager::confirmations) {
+      G4cout << "Lights direction set to "
+	     << vp.GetLightpointDirection() << G4endl;
+    }
+  }
+
+  else if (command == fpCommandLineSegments) {
+    G4int nSides = G4UIcommand::ConvertToInt(newValue);
+    nSides = vp.SetNoOfSides(nSides);
+    if (verbosity >= G4VisManager::confirmations) {
+      G4cout <<
+	"Number of line segements per circle in polygon approximation is "
+	     << nSides << G4endl;
+    }
+  }
+
+  else if (command == fpCommandPicking) {
+    vp.SetPicking(G4UIcommand::ConvertToBool(newValue));
+    if (verbosity >= G4VisManager::confirmations) {
+      G4cout << "Picking ";
+      if (vp.IsPicking()) G4cout << "requested.";
+      else G4cout << "inhibited.";
+      G4cout << G4endl;
+    }
+  }
+
+  else if (command == fpCommandProjection) {
+    G4double fieldHalfAngle;
+    const size_t iPos0 = 0;
+    if (newValue[iPos0] == 'o') {  // "orthogonal"
+      fieldHalfAngle = 0.;
+    }
+    else if (newValue[iPos0] == 'p') {  // "perspective"
+      G4String dummy;
+      G4String unit;
+      std::istringstream is (newValue);
+      is >> dummy >> fieldHalfAngle >> unit;
+      fieldHalfAngle *= G4UIcommand::ValueOf(unit);
+      if (fieldHalfAngle > 89.5 * deg || fieldHalfAngle <= 0.0) {
+	if (verbosity >= G4VisManager::errors) {
+	  G4cout <<
+	    "ERROR: Field half angle should be 0 < angle <= 89.5 degrees.";
+	  G4cout << G4endl;
+	}
+	return;
+      }
+    }
+    else {
+      if (verbosity >= G4VisManager::errors) {
+	G4cout << "ERROR: \"" << newValue << "\" not recognised."
+	  "  Looking for 'o' or 'p' first character." << G4endl;
+      }
+      return;
+    }
+    vp.SetFieldHalfAngle(fieldHalfAngle);
+    if (verbosity >= G4VisManager::confirmations) {
+      G4cout << "Projection style of viewer \"" << currentViewer->GetName()
+	     << "\" set to ";
+      if (fieldHalfAngle == 0.) {
+	G4cout << "orthogonal.";
+      }
+      else {
+	G4cout << "perspective\n  with half angle " << fieldHalfAngle / deg
+	       << " degrees.";
+      }
+      G4cout << G4endl;
+    }
+  }
+
+  else if (command == fpCommandSectionPlane) {
+    G4String choice, unit;
+    G4double x, y, z, nx, ny, nz;
+    std::istringstream is (newValue);
+    is >> choice >> x >> y >> z >> unit >> nx >> ny >> nz;
+
+    G4int iSelector = -1;
+    if (choice.compareTo("off",G4String::ignoreCase) == 0 ||
+	!G4UIcommand::ConvertToBool(choice)) iSelector = 0;
+    if (choice.compareTo("on",G4String::ignoreCase) == 0 ||
+	G4UIcommand::ConvertToBool(choice)) iSelector = 1;
+    if (iSelector < 0) {
+      if (verbosity >= G4VisManager::errors) {
+	G4cout << "Choice not recognised (on/true or off/false)." << G4endl;
+	G4cout << "Section drawing is currently: ";
+	if (vp.IsSection ()) G4cout << "on";
+	else                    G4cout << "off";
+	G4cout << ".\nSection plane is currently: "
+	       << vp.GetSectionPlane ();
+	G4cout << G4endl;
+      }
+      return;
+    }
+
+    G4double F = 1.;
+    switch (iSelector) {
+    default:
+    case 0:
+      vp.UnsetSectionPlane();
+      break;
+    case 1:
+      F = G4UIcommand::ValueOf(unit);
+      x *= F; y *= F; z *= F;
+      vp.SetSectionPlane(G4Plane3D(G4Normal3D(nx,ny,nz), G4Point3D(x,y,z)));
+      vp.SetViewpointDirection(G4Normal3D(nx,ny,nz));
+      break;
+    }
+
+    if (verbosity >= G4VisManager::confirmations) {
+      G4cout << "Section drawing is now: ";
+      if (vp.IsSection ()) G4cout << "on";
+      else                    G4cout << "off";
+      G4cout << ".\nSection plane is now: "
+	     << vp.GetSectionPlane ();
+      G4cout << G4endl;
+    }
+  }
+
+  else if (command == fpCommandStyle) {
+    G4ViewParameters::DrawingStyle existingStyle = vp.GetDrawingStyle();
+    const size_t iPos0 = 0;
+    if (newValue[iPos0] == 'w') {  // "wireframe"
+      switch (existingStyle) {
+      case G4ViewParameters::wireframe:
+	break;
+      case G4ViewParameters::hlr:
+	break;
+      case G4ViewParameters::hsr:
+	vp.SetDrawingStyle(G4ViewParameters::wireframe);
+        break;
+      case G4ViewParameters::hlhsr:
+	vp.SetDrawingStyle(G4ViewParameters::hlr);
+        break;
+      }
+    }
+    else if (newValue[iPos0] == 's') {  // "surface"
+      switch (existingStyle) {
+      case G4ViewParameters::wireframe:
+	vp.SetDrawingStyle(G4ViewParameters::hsr);
+	break;
+      case G4ViewParameters::hlr:
+	vp.SetDrawingStyle(G4ViewParameters::hlhsr);
+	break;
+      case G4ViewParameters::hsr:
+	break;
+      case G4ViewParameters::hlhsr:
+	break;
+      }
+    }
+    else {
+      if (verbosity >= G4VisManager::errors) {
+	G4cout << "ERROR: \"" << newValue << "\" not recognised."
+	  "  Looking for 'w' or 's' first character." << G4endl;
+      }
+      return;
+    }
+    if (verbosity >= G4VisManager::confirmations) {
+      G4cout << "Drawing style of viewer \"" << currentViewer->GetName()
+	     << "\" set to " << vp.GetDrawingStyle()
+	     << G4endl;
+    }
+  }
+
+  else if (command == fpCommandTargetPoint) {
+    G4ThreeVector targetPoint =
+      fpCommandTargetPoint->GetNew3VectorValue(newValue);
+    const G4Point3D& standardTargetPoint =
+      currentViewer->GetSceneHandler()->GetScene()->GetStandardTargetPoint();
+    vp.SetCurrentTargetPoint(targetPoint - standardTargetPoint);
+    if (verbosity >= G4VisManager::confirmations) {
+      G4cout << "Target point set to "
+	     << fpCommandTargetPoint->ConvertToStringWithBestUnit
+	(targetPoint)
+	     << "\n\"Current Target Point\" set to  "
+	     << fpCommandTargetPoint->ConvertToStringWithBestUnit
+	(vp.GetCurrentTargetPoint())
+	     << "\n\"Standard Target Point\" is "
+	     << fpCommandTargetPoint->ConvertToStringWithBestUnit
+	(standardTargetPoint)
+	     << G4endl;
+    }
+  }
+
+  else if (command == fpCommandUpThetaPhi) {
+    G4double theta, phi;
+    ConvertToDoublePair(newValue, theta, phi);
+    G4double x = std::sin (theta) * std::cos (phi);
+    G4double y = std::sin (theta) * std::sin (phi);
+    G4double z = std::cos (theta);
+    fUpVector = G4ThreeVector (x, y, z);
+    vp.SetUpVector(fUpVector);
+    if (verbosity >= G4VisManager::confirmations) {
+      G4cout << "Up direction set to " << vp.GetUpVector() << G4endl;
+    }
+  }
+
+  else if (command == fpCommandUpVector) {
+    fUpVector = G4UIcommand::ConvertTo3Vector(newValue).unit();
+    vp.SetUpVector(fUpVector);
+    if (verbosity >= G4VisManager::confirmations) {
+      G4cout << "Up direction set to " << vp.GetUpVector() << G4endl;
+    }
+  }
+
+  else if (command == fpCommandViewpointThetaPhi) {
+    G4double theta, phi;
+    ConvertToDoublePair(newValue, theta, phi);
+    G4double x = std::sin (theta) * std::cos (phi);
+    G4double y = std::sin (theta) * std::sin (phi);
+    G4double z = std::cos (theta);
+    fViewpointVector = G4ThreeVector (x, y, z);
+    vp.SetViewAndLights(fViewpointVector);
+    if (verbosity >= G4VisManager::confirmations) {
+      G4cout << "Viewpoint direction set to "
+	     << vp.GetViewpointDirection() << G4endl;
+      if (vp.GetLightsMoveWithCamera ()) {
+	G4cout << "Lightpoint direction set to "
+	       << vp.GetActualLightpointDirection () << G4endl;
+      }
+    }
+  }
+
+  else if (command == fpCommandViewpointVector) {
+    fViewpointVector = G4UIcommand::ConvertTo3Vector(newValue).unit();
+    vp.SetViewAndLights(fViewpointVector);
+    if (verbosity >= G4VisManager::confirmations) {
+      G4cout << "Viewpoint direction set to "
+	     << vp.GetViewpointDirection() << G4endl;
+      if (vp.GetLightsMoveWithCamera ()) {
+	G4cout << "Lightpoint direction set to "
+	       << vp.GetActualLightpointDirection () << G4endl;
+      }
+    }
+  }
+
+  else {
+    if (verbosity >= G4VisManager::errors) {
+      G4cout <<
+	"ERROR: G4VisCommandsViewerSet::SetNewValue: unrecognised command."
+	     << G4endl;
+    }
+    return;
+  }
+
+  SetViewParameters(currentViewer,vp);
+}
Index: tags/visualization-10.5-before-10.6_test/management/src/G4VisFeaturesOfDAWNFILE.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/src/G4VisFeaturesOfDAWNFILE.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/src/G4VisFeaturesOfDAWNFILE.cc	(revision 1102)
@@ -0,0 +1,46 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VisFeaturesOfDAWNFILE.cc,v 1.6 2006/06/29 21:29:52 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+#include "G4VisFeaturesOfDAWNFILE.hh"
+
+G4String G4VisFeaturesOfDAWNFILE () {
+  return
+    "High quality technical renderer."
+    "\n    Features:      exact hidden line, hidden surface algorithms."
+    "\n                   high (unlimited) resolution."
+    "\n                   renders to PostScript for viewing and/or hardcopy."
+    "\n                   remote rendering."
+    "\n                   off-line rendering."
+    "\n                   graphical user interface."
+    "\n                   connection via g4.prim file to Fukui Renderer DAWN etc."
+    "\n    Disadvantages: compute intensive, takes time (use a fast graphics"
+    "\n                   system, such as OpenGL, to select view, then copy"
+    "\n                   view parameters to this renderer:"
+    "\n                   \"/vis/viewer/set/all <OpenGL-view>\".";
+}
Index: tags/visualization-10.5-before-10.6_test/management/src/G4VisFeaturesOfFukuiRenderer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/src/G4VisFeaturesOfFukuiRenderer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/src/G4VisFeaturesOfFukuiRenderer.cc	(revision 1102)
@@ -0,0 +1,46 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VisFeaturesOfFukuiRenderer.cc,v 1.5 2006/06/29 21:29:54 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+
+#include "G4VisFeaturesOfFukuiRenderer.hh"
+
+G4String G4VisFeaturesOfFukuiRenderer () {
+  return
+    "High quality technical renderer."
+    "\n    Features:      exact hidden line, hidden surface algorithms."
+    "\n                   high (unlimited) resolution."
+    "\n                   renders to PostScript for viewing and/or hardcopy."
+    "\n                   remote rendering."
+    "\n                   off-line rendering."
+    "\n                   graphical user interface."
+    "\n    Disadvantages: compute intensive, takes time (use a fast graphics"
+    "\n                   system, such as OpenGL, to select view, then copy"
+    "\n                   to this renderer - /vis~/copy/view, /vis~/set/view).";
+}
Index: tags/visualization-10.5-before-10.6_test/management/src/G4VisFeaturesOfOpenGL.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/src/G4VisFeaturesOfOpenGL.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/src/G4VisFeaturesOfOpenGL.cc	(revision 1102)
@@ -0,0 +1,102 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VisFeaturesOfOpenGL.cc,v 1.6 2007/10/03 14:21:55 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+
+#include "G4VisFeaturesOfOpenGL.hh"
+
+G4String G4VisFeaturesOfOpenGLIX () {
+  return
+    "    Dumb single buffered X Window, No Graphics Database."
+    "\n    Advantages:    does not gobble server memory."
+    "\n                   good for drawing steps and hits."
+    "\n    Disadvantages: needs G4 kernel for re-Draw."
+    "\n                   cannot take advantage of graphics accelerators.";
+}
+
+G4String G4VisFeaturesOfOpenGLSX () {
+  return
+    "    Dumb double buffered X Window with Graphics Database."
+    "\n    Advantages:    uses display lists as graphics database."
+    "\n                   fastest possible redraw, e.g., on simple change"
+    "\n                     of viewpoint."
+    "\n                   uses client-server model for remote viewing"
+    "\n                     (but only if you have a full client-server"
+    "\n                     implementation of OpenGL, i.e., not Mesa)."
+    "\n    Disadvantages: not advised for viewing large numbers of steps"
+    "\n                     and/or hits, because it gobbles memory for"
+    " database.";
+}
+
+G4String G4VisFeaturesOfOpenGLIXm () {
+  return
+    "    Smart single buffered X Window, No Graphics Database."
+    "\n    Advantages:    resizeable, and has Motif-based view-control panel."
+    "\n                   does not gobble server memory."
+    "\n                   good for drawing steps and hits."
+    "\n    Disadvantages: currently locks out GEANT4 commands, until \"exit\"."
+    "\n                   needs G4 kernel for re-Draw."
+    "\n                   cannot take advantage of graphics accelerators.";
+}
+
+G4String G4VisFeaturesOfOpenGLSXm () {
+  return
+    "    Smart double buffered X Window with Graphics Database."
+    "\n    Advantages:    resizeable, and has Motif-based view-control panel."
+    "\n                   uses display lists as graphics database."
+    "\n                   fastest possible redraw, e.g., on simple change"
+    "\n                     of viewpoint."
+    "\n                   uses client-server model for remote viewing"
+    "\n                     (but only if you have a full client-server"
+    "\n                     implementation of OpenGL, i.e., not Mesa)."
+    "\n    Disadvantages: currently locks out GEANT4 commands, until \"exit\"."
+    "\n                   not advised for viewing large numbers of steps"
+    "\n                     and/or hits, because it gobbles memory for"
+    " database.";
+}
+
+G4String G4VisFeaturesOfOpenGLIWin32 () {
+  return
+    "\n It runs on WindowsNT ";
+}
+
+G4String G4VisFeaturesOfOpenGLSWin32 () {
+  return
+    "\n It runs on WindowsNT ";
+}
+
+G4String G4VisFeaturesOfOpenGLIQt () {
+  return
+    "\n It runs everywhere";
+}
+
+G4String G4VisFeaturesOfOpenGLSQt () {
+  return
+    "\n It runs everywhere ";
+}
Index: tags/visualization-10.5-before-10.6_test/management/src/G4VisFeaturesOfOpenInventor.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/src/G4VisFeaturesOfOpenInventor.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/src/G4VisFeaturesOfOpenInventor.cc	(revision 1102)
@@ -0,0 +1,40 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VisFeaturesOfOpenInventor.cc,v 1.5 2006/06/29 21:29:58 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+
+#include "G4VisFeaturesOfOpenInventor.hh"
+
+G4String G4VisFeaturesOfOpenInventor () {
+  return
+    "    Open Inventor Window/View/Scene."
+    "\n    Advantages:    Open Inventor feature set (interactivity, scene control)."
+    "\n    Disadvantages: Requires Open Inventor license ($$), Hepvis library (Free).";
+}
+
Index: tags/visualization-10.5-before-10.6_test/management/src/G4VisManager.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/src/G4VisManager.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/src/G4VisManager.cc	(revision 1102)
@@ -0,0 +1,1639 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4VisManager.cc,v 1.118 2009/03/09 12:42:00 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// GEANT4 Visualization Manager - John Allison 02/Jan/1996.
+
+#include "G4VisManager.hh"
+
+#include "G4VisCommands.hh"
+#include "G4VisCommandsCompound.hh"
+#include "G4VisCommandsGeometry.hh"
+#include "G4VisCommandsGeometrySet.hh"
+#include "G4VisCommandsScene.hh"
+#include "G4VisCommandsSceneAdd.hh"
+#include "G4VisCommandsSceneHandler.hh"
+#include "G4VisCommandsViewer.hh"
+#include "G4VisCommandsViewerSet.hh"
+#include "G4UImanager.hh"
+#include "G4VisStateDependent.hh"
+#include "G4UIdirectory.hh"
+#include "G4VisFeaturesOfFukuiRenderer.hh"
+#include "G4VisFeaturesOfDAWNFILE.hh"
+#include "G4VisFeaturesOfOpenGL.hh"
+#include "G4VisFeaturesOfOpenInventor.hh"
+#include "G4VGraphicsSystem.hh"
+#include "G4VSceneHandler.hh"
+#include "G4VViewer.hh"
+#include "G4VPhysicalVolume.hh"
+#include "G4LogicalVolume.hh"
+#include "G4VSolid.hh"
+#include "G4Vector3D.hh"
+#include "G4Point3D.hh"
+#include "G4RotationMatrix.hh"
+#include "G4Polyline.hh"
+#include "G4Polyhedron.hh"
+#include "G4NURBS.hh"
+#include "G4NullModel.hh"
+#include "G4ModelingParameters.hh"
+#include "G4TransportationManager.hh"
+#include "G4VisCommandModelCreate.hh"
+#include "G4VisCommandsListManager.hh"
+#include "G4VisModelManager.hh"
+#include "G4VModelFactory.hh"
+#include "G4VisFilterManager.hh"
+#include "G4VTrajectoryModel.hh"
+#include "G4TrajectoryDrawByCharge.hh"
+#include "Randomize.hh"
+#include "G4RunManager.hh"
+#include "G4EventManager.hh"
+#include "G4Run.hh"
+#include "G4Event.hh"
+#include <sstream>
+
+G4VisManager* G4VisManager::fpInstance = 0;
+
+G4VisManager::G4VisManager ():
+  fVerbose         (1),
+  fInitialised     (false),
+  fpUserVisAction  (0),
+  fpGraphicsSystem (0),
+  fpScene          (0),
+  fpSceneHandler   (0),
+  fpViewer         (0),
+  fVerbosity       (all),//warnings),
+  fpStateDependent (0),
+  fEventRefreshing          (false),
+  fTransientsDrawnThisRun   (false),
+  fTransientsDrawnThisEvent (false),
+  fEventKeepingSuspended    (false),
+  fKeptLastEvent            (false),
+  fpRequestedEvent (0),
+  fAbortReviewKeptEvents    (false)
+  // All other objects use default constructors.
+{
+  fpTrajDrawModelMgr = new G4VisModelManager<G4VTrajectoryModel>("/vis/modeling/trajectories");
+  fpTrajFilterMgr = new G4VisFilterManager<G4VTrajectory>("/vis/filtering/trajectories");
+  fpHitFilterMgr = new G4VisFilterManager<G4VHit>("/vis/filtering/hits");
+
+  VerbosityGuidanceStrings.push_back
+    ("Simple graded message scheme - digit or string (1st character defines):");
+  VerbosityGuidanceStrings.push_back
+    ("  0) quiet,         // Nothing is printed.");
+  VerbosityGuidanceStrings.push_back
+    ("  1) startup,       // Startup and endup messages are printed...");
+  VerbosityGuidanceStrings.push_back
+    ("  2) errors,        // ...and errors...");
+  VerbosityGuidanceStrings.push_back
+    ("  3) warnings,      // ...and warnings...");
+  VerbosityGuidanceStrings.push_back
+    ("  4) confirmations, // ...and confirming messages...");
+  VerbosityGuidanceStrings.push_back
+    ("  5) parameters,    // ...and parameters of scenes and views...");
+  VerbosityGuidanceStrings.push_back
+    ("  6) all            // ...and everything available.");
+
+  if (fpInstance) {
+    G4Exception
+      ("G4VisManager: attempt to Construct more than one VisManager.");
+  }
+  else {
+
+    fpInstance = this;
+    SetConcreteInstance(this);
+
+    fpStateDependent = new G4VisStateDependent (this);
+    // No need to delete this; G4StateManager does this.
+
+    if (fVerbosity >= startup) {
+      G4cout << "Visualization Manager instantiating..." << G4endl;
+    }
+
+    // Note: The specific graphics systems must be instantiated in a
+    // higher level library to avoid circular dependencies.  Also,
+    // some specifically need additional external libararies that the
+    // user must supply.  Therefore we ask the user to implement
+    // RegisterGraphicsSystems() and RegisterModelFactories()
+    // in a subclass.  We have to wait for the subclass to instantiate
+    // so RegisterGraphicsSystems() cannot be called from this
+    // constructor; it is called from Initialise().  So we ask the
+    // user:
+    //   (a) to write a subclass and implement  RegisterGraphicsSystems()
+    //       and RegisterModelFactories().  See
+    //       visualization/include/G4VisExecutive.hh/icc as an example.
+    //   (b) instantiate the subclass.
+    //   (c) invoke the Initialise() method of the subclass.
+    // For example:
+    //   ...
+    // #ifdef G4VIS_USE
+    //   // Instantiate and initialise Visualization Manager.
+    //   G4VisManager* visManager = new G4VisExecutive;
+    //   visManager -> SetVerboseLevel (Verbose);
+    //   visManager -> Initialise ();
+    // #endif
+    //   // (Don't forget to delete visManager;)
+    //   ...
+
+    // Make top level command directory...
+    G4UIcommand* directory;
+    directory = new G4UIdirectory ("/vis/");
+    directory -> SetGuidance ("Visualization commands.");
+    fDirectoryList.push_back (directory);
+
+    // Instantiate top level basic commands
+    G4VVisCommand::SetVisManager (this);  // Sets shared pointer
+    RegisterMessenger(new G4VisCommandVerbose);
+    RegisterMessenger(new G4VisCommandInitialize);
+  }
+}
+
+G4VisManager::~G4VisManager () {
+  fpInstance = 0;
+  size_t i;
+  for (i = 0; i < fSceneList.size (); ++i) {
+    delete fSceneList[i];
+  }
+  for (i = 0; i < fAvailableSceneHandlers.size (); ++i) {
+    delete fAvailableSceneHandlers[i];
+  }
+  for (i = 0; i < fAvailableGraphicsSystems.size (); ++i) {
+    delete fAvailableGraphicsSystems[i];
+  }
+  if (fVerbosity >= startup) {
+    G4cout << "Graphics systems deleted." << G4endl;
+    G4cout << "Visualization Manager deleting..." << G4endl;
+  }
+  for (i = 0; i < fMessengerList.size (); ++i) {
+    delete fMessengerList[i];
+  }
+  for (i = 0; i < fDirectoryList.size (); ++i) {
+    delete fDirectoryList[i];
+  }
+
+  delete fpTrajDrawModelMgr;
+  delete fpTrajFilterMgr;
+  delete fpHitFilterMgr;
+}
+
+G4VisManager* G4VisManager::GetInstance () {
+  if (!fpInstance) {
+    G4Exception
+      ("G4VisManager::GetInstance: VisManager not yet instantiated!");
+  }
+  return fpInstance;
+}
+
+void G4VisManager::Initialise () {
+
+  if (fInitialised && fVerbosity >= warnings) {
+    G4cout << "WARNING: G4VisManager::Initialise: already initialised."
+	   << G4endl;
+    return;
+  }
+
+  if (fVerbosity >= startup) {
+    G4cout << "Visualization Manager initialising..." << G4endl;
+  }
+
+  if (fVerbosity >= parameters) {
+    G4cout <<
+      "\nYou have instantiated your own Visualization Manager, inheriting"
+      "\n  G4VisManager and implementing RegisterGraphicsSystems(), in which"
+      "\n  you should, normally, instantiate drivers which do not need"
+      "\n  external packages or libraries, and, optionally, drivers under"
+      "\n  control of environment variables."
+      "\n  Also you should implement RegisterModelFactories()."
+      "\n  See visualization/include/G4VisExecutive.hh/icc, for example."
+      "\n  In your main() you will have something like:"
+      "\n  #ifdef G4VIS_USE"
+      "\n    G4VisManager* visManager = new G4VisExecutive;"
+      "\n    visManager -> SetVerboseLevel (Verbose);"
+      "\n    visManager -> Initialize ();"
+      "\n  #endif"
+      "\n  (Don't forget to delete visManager;)"
+      "\n"
+	 << G4endl;
+  }
+
+  if (fVerbosity >= startup) {
+    G4cout << "Registering graphics systems..." << G4endl;
+  }
+
+  RegisterGraphicsSystems ();
+
+  if (fVerbosity >= startup) {
+    G4cout <<
+      "\nYou have successfully registered the following graphics systems."
+	 << G4endl;
+    PrintAvailableGraphicsSystems ();
+    G4cout << G4endl;
+  }
+
+  // Make command directories for commands instantiated in the
+  // modeling subcategory...
+  G4UIcommand* directory;
+  directory = new G4UIdirectory ("/vis/modeling/");
+  directory -> SetGuidance ("Modeling commands.");
+  fDirectoryList.push_back (directory);
+  directory = new G4UIdirectory ("/vis/modeling/trajectories/");
+  directory -> SetGuidance ("Trajectory model commands.");
+  fDirectoryList.push_back (directory);
+  directory = new G4UIdirectory ("/vis/modeling/trajectories/create/");
+  directory -> SetGuidance ("Create trajectory models and messengers.");
+  fDirectoryList.push_back (directory);
+
+  // Filtering command directory
+  directory = new G4UIdirectory ("/vis/filtering/");
+  directory -> SetGuidance ("Filtering commands.");
+  fDirectoryList.push_back (directory);
+  directory = new G4UIdirectory ("/vis/filtering/trajectories/");
+  directory -> SetGuidance ("Trajectory filtering commands.");
+  fDirectoryList.push_back (directory);
+  directory = new G4UIdirectory ("/vis/filtering/trajectories/create/");
+  directory -> SetGuidance ("Create trajectory filters and messengers.");
+  fDirectoryList.push_back (directory);
+  directory = new G4UIdirectory ("/vis/filtering/hits/");
+  directory -> SetGuidance ("Hit filtering commands.");
+  fDirectoryList.push_back (directory);
+  directory = new G4UIdirectory ("/vis/filtering/hits/create/");
+  directory -> SetGuidance ("Create hit filters and messengers.");
+  fDirectoryList.push_back (directory);
+
+  RegisterMessengers ();
+
+  if (fVerbosity >= startup) {
+    G4cout << "Registering model factories..." << G4endl;
+  }
+
+  RegisterModelFactories();
+
+  if (fVerbosity >= startup) {
+    G4cout <<
+      "\nYou have successfully registered the following model factories."
+	 << G4endl;
+    PrintAvailableModels (fVerbosity);
+    G4cout << G4endl;
+  }
+
+  fInitialised = true;
+}
+
+void G4VisManager::Enable() {
+  if (IsValidView ()) {
+    if (fVerbosity >= confirmations) {
+      G4cout << "G4VisManager::Enable: visualization enabled." << G4endl;
+    }
+  }
+  else {
+    if (fVerbosity >= warnings) {
+      G4cout <<
+	"G4VisManager::Enable: WARNING: visualization remains disabled for"
+	"\n  above reasons.  Rectifying with valid vis commands will"
+	"\n  automatically enable."
+	     << G4endl;
+    }
+  }
+}
+
+void G4VisManager::Disable() {
+  SetConcreteInstance(0);
+  if (fVerbosity >= confirmations) {
+    G4cout <<
+      "G4VisManager::Disable: visualization disabled."
+      "\n  The pointer returned by GetConcreteInstance will be zero."
+      "\n  Note that it will become enabled after some valid vis commands."
+	   << G4endl;
+  }
+}
+
+const G4GraphicsSystemList& G4VisManager::GetAvailableGraphicsSystems () {
+  G4int nSystems = fAvailableGraphicsSystems.size ();
+  if (nSystems == 0) {
+    if (fVerbosity >= warnings) {
+      G4cout << "G4VisManager::GetAvailableGraphicsSystems: WARNING: no"
+	"\n graphics system available!"
+	"\n  1) Did you have environment variables G4VIS_BUILD_xxxx_DRIVER set"
+	"\n     when you compiled/built the visualization code?"
+	"\n  2) Did you instantiate your own Visualization Manager and forget"
+	"\n     to implement RegisterGraphicsSystems correctly?"
+	"\n  3) You can register your own graphics system, e.g.,"
+	"\n     visManager->RegisterGraphicsSystem(new MyGraphicsSystem);)"
+	"\n     after instantiating your vis manager and before"
+	"\n     visManager->Initialize()."
+	     << G4endl;
+    }
+  }
+  return fAvailableGraphicsSystems;
+}
+
+G4bool G4VisManager::RegisterGraphicsSystem (G4VGraphicsSystem* pSystem) {
+  G4bool happy = true;
+  if (pSystem) {
+    fAvailableGraphicsSystems.push_back (pSystem);
+    if (fVerbosity >= confirmations) {
+      G4cout << "G4VisManager::RegisterGraphicsSystem: "
+	     << pSystem -> GetName ();
+      if (pSystem -> GetNickname () != "") {
+	G4cout << " (" << pSystem -> GetNickname () << ")";
+      }
+      G4cout << " registered." << G4endl;
+    }
+  }
+  else {
+    if (fVerbosity >= errors) {
+      G4cout << "G4VisManager::RegisterGraphicsSystem: null pointer!"
+	     << G4endl;
+    }
+    happy=false;
+  }
+  return happy;
+}
+
+const G4VTrajectoryModel*
+G4VisManager::CurrentTrajDrawModel() const
+{
+  assert (0 != fpTrajDrawModelMgr);
+
+  const G4VTrajectoryModel* model = fpTrajDrawModelMgr->Current();
+
+  if (0 == model) {
+    // No model was registered with the trajectory model manager.
+    // Use G4TrajectoryDrawByCharge as a default.
+    fpTrajDrawModelMgr->Register(new G4TrajectoryDrawByCharge("AutoGenerated"));
+
+    if (fVerbosity >= warnings) {
+      G4cout<<"G4VisManager: Using G4TrajectoryDrawByCharge as default trajectory model."<<G4endl;
+      G4cout<<"See commands in /vis/modeling/trajectories/ for other options."<<G4endl;
+    }
+  }
+
+  model = fpTrajDrawModelMgr->Current();
+  assert (0 != model); // Should definitely exist now
+
+  return model;
+}
+
+void G4VisManager::RegisterModel(G4VTrajectoryModel* model) 
+{
+  fpTrajDrawModelMgr->Register(model);
+}
+
+void
+G4VisManager::RegisterModelFactory(G4TrajDrawModelFactory* factory) 
+{
+  fpTrajDrawModelMgr->Register(factory);
+}
+
+void G4VisManager::RegisterModel(G4VFilter<G4VTrajectory>* model)
+{
+  fpTrajFilterMgr->Register(model);
+}
+
+void
+G4VisManager::RegisterModelFactory(G4TrajFilterFactory* factory)
+{
+  fpTrajFilterMgr->Register(factory);
+}
+
+void G4VisManager::RegisterModel(G4VFilter<G4VHit>* model)
+{
+  fpHitFilterMgr->Register(model);
+}
+
+void
+G4VisManager::RegisterModelFactory(G4HitFilterFactory* factory)
+{
+  fpHitFilterMgr->Register(factory);
+}
+
+void G4VisManager::SelectTrajectoryModel(const G4String& model) 
+{
+   fpTrajDrawModelMgr->SetCurrent(model);
+}
+
+void G4VisManager::Draw (const G4Circle& circle,
+			 const G4Transform3D& objectTransform) {
+  if (IsValidView ()) {
+    ClearTransientStoreIfMarked();
+    fpSceneHandler -> BeginPrimitives (objectTransform);
+    fpSceneHandler -> AddPrimitive (circle);
+    fpSceneHandler -> EndPrimitives ();
+  }
+}
+
+void G4VisManager::Draw (const G4NURBS& nurbs,
+			 const G4Transform3D& objectTransform) {
+  if (IsValidView ()) {
+    ClearTransientStoreIfMarked();
+    fpSceneHandler -> BeginPrimitives (objectTransform);
+    fpSceneHandler -> AddPrimitive (nurbs);
+    fpSceneHandler -> EndPrimitives ();
+  }
+}
+
+void G4VisManager::Draw (const G4Polyhedron& polyhedron,
+			 const G4Transform3D& objectTransform) {
+  if (IsValidView ()) {
+    ClearTransientStoreIfMarked();
+    fpSceneHandler -> BeginPrimitives (objectTransform);
+    fpSceneHandler -> AddPrimitive (polyhedron);
+    fpSceneHandler -> EndPrimitives ();
+  }
+}
+
+void G4VisManager::Draw (const G4Polyline& line,
+			 const G4Transform3D& objectTransform) {
+  if (IsValidView ()) {
+    ClearTransientStoreIfMarked();
+    fpSceneHandler -> BeginPrimitives (objectTransform);
+    fpSceneHandler -> AddPrimitive (line);
+    fpSceneHandler -> EndPrimitives ();
+  }
+}
+
+void G4VisManager::Draw (const G4Polymarker& polymarker,
+			 const G4Transform3D& objectTransform) {
+  if (IsValidView ()) {
+    ClearTransientStoreIfMarked();
+    fpSceneHandler -> BeginPrimitives (objectTransform);
+    fpSceneHandler -> AddPrimitive (polymarker);
+    fpSceneHandler -> EndPrimitives ();
+  }
+}
+
+void G4VisManager::Draw (const G4Scale& scale,
+			 const G4Transform3D& objectTransform) {
+  if (IsValidView ()) {
+    ClearTransientStoreIfMarked();
+    fpSceneHandler -> BeginPrimitives (objectTransform);
+    fpSceneHandler -> AddPrimitive (scale);
+    fpSceneHandler -> EndPrimitives ();
+  }
+}
+
+void G4VisManager::Draw (const G4Square& square,
+			 const G4Transform3D& objectTransform) {
+  if (IsValidView ()) {
+    ClearTransientStoreIfMarked();
+    fpSceneHandler -> BeginPrimitives (objectTransform);
+    fpSceneHandler -> AddPrimitive (square);
+    fpSceneHandler -> EndPrimitives ();
+  }
+}
+
+void G4VisManager::Draw (const G4Text& text,
+			 const G4Transform3D& objectTransform) {
+  if (IsValidView ()) {
+    ClearTransientStoreIfMarked();
+    fpSceneHandler -> BeginPrimitives (objectTransform);
+    fpSceneHandler -> AddPrimitive (text);
+    fpSceneHandler -> EndPrimitives ();
+  }
+}
+
+void G4VisManager::Draw2D (const G4Circle& circle,
+			   const G4Transform3D& objectTransform)
+{
+  if (IsValidView()) {
+    ClearTransientStoreIfMarked();
+    fpSceneHandler -> BeginPrimitives2D(objectTransform);
+    fpSceneHandler -> AddPrimitive(circle);
+    fpSceneHandler -> EndPrimitives2D();
+  }
+}
+
+void G4VisManager::Draw2D (const G4NURBS& nurbs,
+			   const G4Transform3D& objectTransform)
+{
+  if (IsValidView()) {
+    ClearTransientStoreIfMarked();
+    fpSceneHandler -> BeginPrimitives2D(objectTransform);
+    fpSceneHandler -> AddPrimitive(nurbs);
+    fpSceneHandler -> EndPrimitives2D();
+  }
+}
+
+void G4VisManager::Draw2D (const G4Polyhedron& polyhedron,
+			   const G4Transform3D& objectTransform)
+{
+  if (IsValidView()) {
+    ClearTransientStoreIfMarked();
+    fpSceneHandler -> BeginPrimitives2D(objectTransform);
+    fpSceneHandler -> AddPrimitive(polyhedron);
+    fpSceneHandler -> EndPrimitives2D();
+  }
+}
+
+void G4VisManager::Draw2D (const G4Polyline& line,
+			   const G4Transform3D& objectTransform)
+{
+  if (IsValidView()) {
+    ClearTransientStoreIfMarked();
+    fpSceneHandler -> BeginPrimitives2D(objectTransform);
+    fpSceneHandler -> AddPrimitive(line);
+    fpSceneHandler -> EndPrimitives2D();
+  }
+}
+
+void G4VisManager::Draw2D (const G4Polymarker& polymarker,
+			   const G4Transform3D& objectTransform)
+{
+  if (IsValidView()) {
+    ClearTransientStoreIfMarked();
+    fpSceneHandler -> BeginPrimitives2D(objectTransform);
+    fpSceneHandler -> AddPrimitive(polymarker);
+    fpSceneHandler -> EndPrimitives2D();
+  }
+}
+
+void G4VisManager::Draw2D (const G4Square& square,
+			   const G4Transform3D& objectTransform)
+{
+  if (IsValidView()) {
+    ClearTransientStoreIfMarked();
+    fpSceneHandler -> BeginPrimitives2D(objectTransform);
+    fpSceneHandler -> AddPrimitive(square);
+    fpSceneHandler -> EndPrimitives2D();
+  }
+}
+
+void G4VisManager::Draw2D (const G4Text& text,
+			   const G4Transform3D& objectTransform)
+{
+  if (IsValidView()) {
+    ClearTransientStoreIfMarked();
+    fpSceneHandler -> BeginPrimitives2D(objectTransform);
+    fpSceneHandler -> AddPrimitive(text);
+    fpSceneHandler -> EndPrimitives2D();
+  }
+}
+
+void G4VisManager::Draw (const G4VHit& hit) {
+  if (IsValidView ()) {
+    ClearTransientStoreIfMarked();
+    fpSceneHandler -> AddCompound (hit);
+  }
+}
+
+void G4VisManager::Draw (const G4VTrajectory& traj,
+			 G4int i_mode) {
+  if (IsValidView ()) {
+    ClearTransientStoreIfMarked();
+    fpSceneHandler -> SetModel (&dummyTrajectoriesModel);
+    dummyTrajectoriesModel.SetDrawingMode(i_mode);
+    fpSceneHandler -> AddCompound (traj);
+  }
+}
+
+void G4VisManager::Draw (const G4LogicalVolume& logicalVol,
+			 const G4VisAttributes& attribs,
+			 const G4Transform3D& objectTransform) {
+  // Find corresponding solid.
+  G4VSolid* pSol = logicalVol.GetSolid ();
+  Draw (*pSol, attribs, objectTransform);
+}
+
+void G4VisManager::Draw (const G4VSolid& solid,
+			 const G4VisAttributes& attribs,
+			 const G4Transform3D& objectTransform) {
+  if (IsValidView ()) {
+    ClearTransientStoreIfMarked();
+    fpSceneHandler -> PreAddSolid (objectTransform, attribs);
+    solid.DescribeYourselfTo (*fpSceneHandler);
+    fpSceneHandler -> PostAddSolid ();
+  }
+}
+
+void G4VisManager::Draw (const G4VPhysicalVolume& physicalVol,
+			 const G4VisAttributes& attribs,
+			 const G4Transform3D& objectTransform) {
+  // Find corresponding logical volume and solid.
+  G4LogicalVolume* pLV  = physicalVol.GetLogicalVolume ();
+  G4VSolid*        pSol = pLV -> GetSolid ();
+  Draw (*pSol, attribs, objectTransform);
+}
+
+void G4VisManager::CreateSceneHandler (G4String name) {
+  if (!fInitialised) Initialise ();
+  if (fpGraphicsSystem) {
+    G4VSceneHandler* pSceneHandler =
+      fpGraphicsSystem -> CreateSceneHandler (name);
+    if (pSceneHandler) {
+      fAvailableSceneHandlers.push_back (pSceneHandler);
+      fpSceneHandler = pSceneHandler;                         // Make current.
+    }
+    else {
+      if(fVerbosity >= errors) {
+	G4cout << "ERROR in G4VisManager::CreateSceneHandler during "
+	       << fpGraphicsSystem -> GetName ()
+	       << " scene creation.\n  No action taken."
+	       << G4endl;
+      }
+    }
+  }
+  else PrintInvalidPointers ();
+}
+
+void G4VisManager::CreateViewer (G4String name,G4String XGeometry) {
+
+  if (!fInitialised) Initialise ();
+
+  if (fpSceneHandler) {
+    G4VViewer* p = fpGraphicsSystem -> CreateViewer (*fpSceneHandler, name);
+
+    // Viewer is created, now we can set geometry parameters
+    // Before 12/2008, it was done in G4VViewer.cc but it did not have to be there!
+    
+    G4ViewParameters vp = p->GetViewParameters();
+    vp.SetXGeometryString(XGeometry);
+    p->SetViewParameters(vp); //parse string and store parameters
+    
+    if (!p) {
+      if (fVerbosity >= errors) {
+	G4cout << "ERROR in G4VisManager::CreateViewer during "
+	       << fpGraphicsSystem -> GetName ()
+	       << " viewer creation.\n  No action taken."
+	       << G4endl;
+      }
+    } else {
+      p -> Initialise ();
+      if (p -> GetViewId() < 0) {
+	if (fVerbosity >= errors) {
+	G4cout << "ERROR in G4VisManager::CreateViewer during "
+	       << fpGraphicsSystem -> GetName ()
+	       << " viewer initialisation.\n  No action taken."
+	       << G4endl;
+	}
+      } else {
+	fpViewer = p;                             // Make current.
+	fpSceneHandler -> AddViewerToList (fpViewer);
+	fpSceneHandler -> SetCurrentViewer (fpViewer);
+
+	if (fVerbosity >= confirmations) {
+	  G4cout << "G4VisManager::CreateViewer: new viewer created."
+		 << G4endl;
+	}
+
+	const G4ViewParameters& vp = fpViewer->GetViewParameters();
+	if (fVerbosity >= parameters) {
+	  G4cout << " view parameters are:\n  " << vp << G4endl;
+	}
+
+	if (vp.IsCulling () && vp.IsCullingInvisible ()) {
+	  static G4bool warned = false;
+	  if (fVerbosity >= confirmations) {
+	    if (!warned) {
+	      G4cout <<
+  "NOTE: objects with visibility flag set to \"false\""
+  " will not be drawn!"
+  "\n  \"/vis/viewer/set/culling global false\" to Draw such objects."
+  "\n  Also see other \"/vis/viewer/set\" commands."
+		     << G4endl;
+	      warned = true;
+	    }
+	  }
+	}
+	if (vp.IsCullingCovered ()) {
+	  static G4bool warned = false;
+	  if (fVerbosity >= warnings) {
+	    if (!warned) {
+	      G4cout <<
+  "WARNING: covered objects in solid mode will not be rendered!"
+  "\n  \"/vis/viewer/set/culling coveredDaughters false\" to reverse this."
+  "\n  Also see other \"/vis/viewer/set\" commands."
+		     << G4endl;
+	      warned = true;
+	    }
+	  }
+	}
+      }
+    }
+  }
+  else PrintInvalidPointers ();
+}
+
+void G4VisManager::GeometryHasChanged () {
+  if (fVerbosity >= confirmations) {
+    G4cout << "G4VisManager::GeometryHasChanged() called." << G4endl;
+  }
+
+  // Change the world...
+  G4VPhysicalVolume* pWorld =
+    G4TransportationManager::GetTransportationManager ()
+    -> GetNavigatorForTracking () -> GetWorldVolume ();
+  if (!pWorld) {
+    if (fVerbosity >= warnings) {
+      G4cout << "WARNING: There is no world volume!" << G4endl;
+    }
+  }
+
+  // Check scenes.
+  G4SceneList& sceneList = fSceneList;
+  G4int iScene, nScenes = sceneList.size ();
+  for (iScene = 0; iScene < nScenes; iScene++) {
+    G4Scene* pScene = sceneList [iScene];
+    std::vector<G4VModel*>& modelList = pScene -> SetRunDurationModelList ();
+
+    if (modelList.size ()) {
+      G4bool modelInvalid;
+      do {  // Remove, if required, one at a time.
+	modelInvalid = false;
+	std::vector<G4VModel*>::iterator iterModel;
+	for (iterModel = modelList.begin();
+	     iterModel != modelList.end();
+	     ++iterModel) {
+	  modelInvalid = !((*iterModel) -> Validate (fVerbosity >= warnings));
+	  if (modelInvalid) {
+	    // Model invalid - remove and break.
+	    if (fVerbosity >= warnings) {
+	      G4cout << "WARNING: Model \""
+		     << (*iterModel) -> GetGlobalDescription ()
+		     <<
+		"\" is no longer valid - being removed\n  from scene \""
+		     << pScene -> GetName () << "\""
+		     << G4endl;
+	    }
+	    modelList.erase (iterModel);
+	    break;
+	  }
+	}
+      } while (modelInvalid);
+
+      if (modelList.size () == 0) {
+	if (fVerbosity >= warnings) {
+	  G4cout << "WARNING: No models left in this scene \""
+		 << pScene -> GetName ()
+		 << "\"."
+		 << G4endl;
+	}
+      }
+      else {
+	pScene->CalculateExtent();
+	G4UImanager::GetUIpointer () ->
+	  ApplyCommand (G4String("/vis/scene/notifyHandlers " + pScene->GetName()));
+      }
+    }
+  }
+
+  // Check the manager's current scene...
+  if (fpScene && fpScene -> GetRunDurationModelList ().size () == 0) {
+    if (fVerbosity >= warnings) {
+      G4cout << "WARNING: The current scene \""
+	     << fpScene -> GetName ()
+	     << "\" has no models."
+	     << G4endl;
+    }
+  }
+
+}
+void G4VisManager::NotifyHandlers () {
+
+#ifdef G4DEBUG_VIS_MANAGEMENT
+  printf("G4VisManager::NotifyHandlers \n");
+#endif
+  if (fVerbosity >= confirmations) {
+    G4cout << "G4VisManager::NotifyHandler() called." << G4endl;
+  }
+
+  // Check scenes.
+  G4SceneList& sceneList = fSceneList;
+  G4int iScene, nScenes = sceneList.size ();
+  for (iScene = 0; iScene < nScenes; iScene++) {
+    G4Scene* pScene = sceneList [iScene];
+    std::vector<G4VModel*>& modelList = pScene -> SetRunDurationModelList ();
+    
+    if (modelList.size ()) {
+      pScene->CalculateExtent();
+      G4UImanager::GetUIpointer () ->
+        ApplyCommand (G4String("/vis/scene/notifyHandlers " + pScene->GetName()));
+    }
+  }
+
+  // Check the manager's current scene...
+  if (fpScene && fpScene -> GetRunDurationModelList ().size () == 0) {
+    if (fVerbosity >= warnings) {
+      G4cout << "WARNING: The current scene \""
+	     << fpScene -> GetName ()
+	     << "\" has no models."
+	     << G4endl;
+    }
+  }
+
+#ifdef G4DEBUG_VIS_MANAGEMENT
+  printf("G4VisManager::NotifyHandlers END\n");
+#endif
+}
+
+G4bool G4VisManager::FilterTrajectory(const G4VTrajectory& trajectory)
+{
+  return fpTrajFilterMgr->Accept(trajectory);
+}   
+
+G4bool G4VisManager::FilterHit(const G4VHit& hit)
+{
+  return fpHitFilterMgr->Accept(hit);
+}   
+
+void G4VisManager::DispatchToModel(const G4VTrajectory& trajectory, G4int i_mode)
+{
+  G4bool visible(true);
+
+  // See if trajectory passes filter
+  G4bool passed = FilterTrajectory(trajectory);
+
+  if (!passed) {
+    // Draw invisible trajectory if trajectory failed filter and
+    // are filtering in soft mode
+    if (fpTrajFilterMgr->GetMode() == FilterMode::Soft) visible = false;
+    else {return;}
+  }
+
+  // Go on to draw trajectory
+  assert (0 != fpTrajDrawModelMgr);
+
+  const G4VTrajectoryModel* model = CurrentTrajDrawModel();
+
+  assert (0 != model); // Should exist
+
+  model->Draw(trajectory, i_mode, visible);
+} 
+
+void G4VisManager::SetUserAction
+(G4VUserVisAction* pVisAction,
+ const G4VisExtent& extent) {
+  fpUserVisAction = pVisAction;
+  fUserVisActionExtent = extent;
+  if (extent.GetExtentRadius() <= 0.) {
+    if (fVerbosity >= warnings) {
+      G4cout << 
+	"WARNING: No extent set for user vis action.  (You may"
+	"\n  set it later when adding with /vis/scene/add/userAction.)"
+	     << G4endl;
+    }
+  }
+}
+
+void G4VisManager::SetCurrentScene (G4Scene* pScene) {
+  if (pScene != fpScene) {
+    // A change of scene.  Therefore reset transients drawn flags.  All
+    // memory of previous transient proceessing thereby erased...
+    ResetTransientsDrawnFlags();
+  }
+  fpScene = pScene;
+}
+
+void G4VisManager::SetCurrentGraphicsSystem (G4VGraphicsSystem* pSystem) {
+  fpGraphicsSystem = pSystem;
+  if (fVerbosity >= confirmations) {
+    G4cout << "G4VisManager::SetCurrentGraphicsSystem: system now "
+	   << pSystem -> GetName () << G4endl;
+  }
+  // If current scene handler is of same graphics system, leave unchanged.
+  // Else find the most recent scene handler of same graphics system.
+  // Or clear pointers.
+  if (!(fpSceneHandler && fpSceneHandler -> GetGraphicsSystem () == pSystem)) {
+    const G4SceneHandlerList& sceneHandlerList = fAvailableSceneHandlers;
+    G4int nSH = sceneHandlerList.size ();  // No. of scene handlers.
+    G4int iSH;
+    for (iSH = nSH - 1; iSH >= 0; iSH--) {
+      if (sceneHandlerList [iSH] -> GetGraphicsSystem () == pSystem) break;
+    }
+    if (iSH >= 0) {
+      fpSceneHandler = sceneHandlerList [iSH];
+      if (fVerbosity >= confirmations) {
+	G4cout << "  Scene Handler now "
+	       << fpSceneHandler -> GetName () << G4endl;
+      }
+      if (fpScene != fpSceneHandler -> GetScene ()) {
+	fpScene = fpSceneHandler -> GetScene ();
+	if (fVerbosity >= confirmations) {
+	  G4cout << "  Scene now \""
+		 << fpScene -> GetName () << "\"" << G4endl;
+	}
+      }
+      const G4ViewerList& viewerList = fpSceneHandler -> GetViewerList ();
+      if (viewerList.size ()) {
+	fpViewer = viewerList [0];
+	if (fVerbosity >= confirmations) {
+	  G4cout << "  Viewer now " << fpViewer -> GetName () << G4endl;
+	}
+      }
+      else {
+	fpViewer = 0;
+      }
+    }
+    else {
+      fpSceneHandler = 0;
+      fpViewer = 0;
+    }
+  }
+}
+
+void G4VisManager::SetCurrentSceneHandler (G4VSceneHandler* pSceneHandler) {
+  fpSceneHandler = pSceneHandler;
+  if (fVerbosity >= confirmations) {
+    G4cout << "G4VisManager::SetCurrentSceneHandler: scene handler now \""
+	   << pSceneHandler -> GetName () << "\"" << G4endl;
+  }
+  if (fpScene != fpSceneHandler -> GetScene ()) {
+    fpScene = fpSceneHandler -> GetScene ();
+    if (fVerbosity >= confirmations) {
+      G4cout << "  Scene now \""
+	     << fpScene -> GetName () << "\"" << G4endl;
+    }
+  }
+  if (fpGraphicsSystem != pSceneHandler -> GetGraphicsSystem ()) {
+    fpGraphicsSystem = pSceneHandler -> GetGraphicsSystem ();
+    if (fVerbosity >= confirmations) {
+      G4cout << "  Graphics system now \""
+	     << fpGraphicsSystem -> GetName () << "\"" << G4endl;
+    }
+  }
+  const G4ViewerList& viewerList = fpSceneHandler -> GetViewerList ();
+  G4int nViewers = viewerList.size ();
+  if (nViewers) {
+    G4int iViewer;
+    for (iViewer = 0; iViewer < nViewers; iViewer++) {
+      if (fpViewer == viewerList [iViewer]) break;
+    }
+    if (iViewer >= nViewers) {
+      fpViewer = viewerList [0];
+      if (fVerbosity >= confirmations) {
+	G4cout << "  Viewer now \"" << fpViewer -> GetName () << "\""
+	       << G4endl;
+      }
+    }
+    IsValidView ();  // Checks.
+  }
+  else {
+    fpViewer = 0;
+    if (fVerbosity >= warnings) {
+      G4cout <<
+	"WARNING: No viewers for this scene handler - please create one."
+	     << G4endl;
+    }
+  }
+}
+
+void G4VisManager::SetCurrentViewer (G4VViewer* pViewer) {
+  fpViewer  = pViewer;
+  if (fVerbosity >= confirmations) {
+    G4cout << "G4VisManager::SetCurrentViewer: viewer now "
+	   << pViewer -> GetName ()
+	   << G4endl;
+  }
+  fpSceneHandler = fpViewer -> GetSceneHandler ();
+  fpSceneHandler -> SetCurrentViewer (pViewer);
+  fpScene = fpSceneHandler -> GetScene ();
+  fpGraphicsSystem = fpSceneHandler -> GetGraphicsSystem ();
+  IsValidView ();  // Checks.
+}
+
+void G4VisManager::RegisterMessengers () {
+
+  // Instantiate individual messengers/commands (often - but not
+  // always - one command per messenger).
+
+  G4UIcommand* directory;
+
+  // Top level commands...
+  RegisterMessenger(new G4VisCommandAbortReviewKeptEvents);
+  RegisterMessenger(new G4VisCommandEnable);
+  RegisterMessenger(new G4VisCommandList);
+  RegisterMessenger(new G4VisCommandReviewKeptEvents);
+
+  // Compound commands...
+  RegisterMessenger(new G4VisCommandDrawTree);
+  RegisterMessenger(new G4VisCommandDrawView);
+  RegisterMessenger(new G4VisCommandDrawVolume);
+  RegisterMessenger(new G4VisCommandOpen);
+  RegisterMessenger(new G4VisCommandSpecify);
+
+  directory = new G4UIdirectory ("/vis/geometry/");
+  directory -> SetGuidance("Operations on vis attributes of Geant4 geometry.");
+  fDirectoryList.push_back (directory);
+  RegisterMessenger(new G4VisCommandGeometryList);
+  RegisterMessenger(new G4VisCommandGeometryRestore);
+
+  directory = new G4UIdirectory ("/vis/geometry/set/");
+  directory -> SetGuidance("Set vis attributes of Geant4 geometry.");
+  fDirectoryList.push_back (directory);
+  RegisterMessenger(new G4VisCommandGeometrySetColour);
+  RegisterMessenger(new G4VisCommandGeometrySetDaughtersInvisible);
+  RegisterMessenger(new G4VisCommandGeometrySetLineStyle);
+  RegisterMessenger(new G4VisCommandGeometrySetLineWidth);
+  RegisterMessenger(new G4VisCommandGeometrySetForceAuxEdgeVisible);
+  RegisterMessenger(new G4VisCommandGeometrySetForceLineSegmentsPerCircle);
+  RegisterMessenger(new G4VisCommandGeometrySetForceSolid);
+  RegisterMessenger(new G4VisCommandGeometrySetForceWireframe);
+  RegisterMessenger(new G4VisCommandGeometrySetVisibility);
+
+  directory = new G4UIdirectory ("/vis/scene/");
+  directory -> SetGuidance ("Operations on Geant4 scenes.");
+  fDirectoryList.push_back (directory);
+  RegisterMessenger(new G4VisCommandSceneCreate);
+  RegisterMessenger(new G4VisCommandSceneEndOfEventAction);
+  RegisterMessenger(new G4VisCommandSceneEndOfRunAction);
+  RegisterMessenger(new G4VisCommandSceneList);
+  RegisterMessenger(new G4VisCommandSceneNotifyHandlers);
+  RegisterMessenger(new G4VisCommandSceneSelect);
+
+  directory = new G4UIdirectory ("/vis/scene/add/");
+  directory -> SetGuidance ("Add model to current scene.");
+  fDirectoryList.push_back (directory);
+  RegisterMessenger(new G4VisCommandSceneAddAxes);
+  RegisterMessenger(new G4VisCommandSceneAddEventID);
+  RegisterMessenger(new G4VisCommandSceneAddGhosts);
+  RegisterMessenger(new G4VisCommandSceneAddHits);
+  RegisterMessenger(new G4VisCommandSceneAddLogicalVolume);
+  RegisterMessenger(new G4VisCommandSceneAddLogo);
+  RegisterMessenger(new G4VisCommandSceneAddScale);
+  RegisterMessenger(new G4VisCommandSceneAddText);
+  RegisterMessenger(new G4VisCommandSceneAddTrajectories);
+  RegisterMessenger(new G4VisCommandSceneAddUserAction);
+  RegisterMessenger(new G4VisCommandSceneAddVolume);
+
+  directory = new G4UIdirectory ("/vis/sceneHandler/");
+  directory -> SetGuidance ("Operations on Geant4 scene handlers.");
+  fDirectoryList.push_back (directory);
+  RegisterMessenger(new G4VisCommandSceneHandlerAttach);
+  RegisterMessenger(new G4VisCommandSceneHandlerCreate);
+  RegisterMessenger(new G4VisCommandSceneHandlerList);
+  RegisterMessenger(new G4VisCommandSceneHandlerSelect);
+
+  directory = new G4UIdirectory ("/vis/viewer/");
+  directory -> SetGuidance ("Operations on Geant4 viewers.");
+  fDirectoryList.push_back (directory);
+  RegisterMessenger(new G4VisCommandViewerAddCutawayPlane);
+  RegisterMessenger(new G4VisCommandViewerChangeCutawayPlane);
+  RegisterMessenger(new G4VisCommandViewerClear);
+  RegisterMessenger(new G4VisCommandViewerClearCutawayPlanes);
+  RegisterMessenger(new G4VisCommandViewerClearTransients);
+  RegisterMessenger(new G4VisCommandViewerClone);
+  RegisterMessenger(new G4VisCommandViewerCreate);
+  RegisterMessenger(new G4VisCommandViewerDolly);
+  RegisterMessenger(new G4VisCommandViewerFlush);
+  RegisterMessenger(new G4VisCommandViewerList);
+  RegisterMessenger(new G4VisCommandViewerPan);
+  RegisterMessenger(new G4VisCommandViewerRebuild);
+  RegisterMessenger(new G4VisCommandViewerRefresh);
+  RegisterMessenger(new G4VisCommandViewerReset);
+  RegisterMessenger(new G4VisCommandViewerScale);
+  RegisterMessenger(new G4VisCommandViewerSelect);
+  RegisterMessenger(new G4VisCommandViewerUpdate);
+  RegisterMessenger(new G4VisCommandViewerZoom);
+
+  directory = new G4UIdirectory ("/vis/viewer/set/");
+  directory -> SetGuidance ("Set view parameters of current viewer.");
+  fDirectoryList.push_back (directory);
+  RegisterMessenger(new G4VisCommandsViewerSet);
+
+  // List manager commands
+  RegisterMessenger(new G4VisCommandListManagerList< G4VisModelManager<G4VTrajectoryModel> >
+		    (fpTrajDrawModelMgr, fpTrajDrawModelMgr->Placement()));
+  RegisterMessenger(new G4VisCommandListManagerSelect< G4VisModelManager<G4VTrajectoryModel> >
+		    (fpTrajDrawModelMgr, fpTrajDrawModelMgr->Placement()));  
+
+  // Trajectory filter manager commands
+  RegisterMessenger(new G4VisCommandListManagerList< G4VisFilterManager<G4VTrajectory> >
+                    (fpTrajFilterMgr, fpTrajFilterMgr->Placement()));
+  RegisterMessenger(new G4VisCommandManagerMode< G4VisFilterManager<G4VTrajectory> >
+                    (fpTrajFilterMgr, fpTrajFilterMgr->Placement()));
+
+  // Hit filter manager commands
+  RegisterMessenger(new G4VisCommandListManagerList< G4VisFilterManager<G4VHit> >
+                    (fpHitFilterMgr, fpHitFilterMgr->Placement()));
+  RegisterMessenger(new G4VisCommandManagerMode< G4VisFilterManager<G4VHit> >
+                    (fpHitFilterMgr, fpHitFilterMgr->Placement()));
+}
+
+void G4VisManager::PrintAvailableGraphicsSystems () const {
+  G4int nSystems = fAvailableGraphicsSystems.size ();
+  G4cout << "Current available graphics systems are:";
+  if (nSystems) {
+    for (int i = 0; i < nSystems; i++) {
+      const G4VGraphicsSystem* pSystem = fAvailableGraphicsSystems [i];
+      G4cout << "\n  " << pSystem -> GetName ();
+      if (pSystem -> GetNickname () != "") {
+	G4cout << " (" << pSystem -> GetNickname () << ")";
+      }
+    }
+  }
+  else {
+    G4cout << "\n  NONE!!!  None registered - yet!  Mmmmm!";
+  }
+  G4cout << G4endl;
+}
+
+void G4VisManager::PrintAvailableModels (Verbosity verbosity) const
+{
+  {
+    //fpTrajDrawModelMgr->Print(G4cout);
+    G4cout << "Registered model factories:" << G4endl;
+    const std::vector<G4VModelFactory<G4VTrajectoryModel>*>& factoryList =
+      fpTrajDrawModelMgr->FactoryList();
+    if (factoryList.empty()) G4cout << "  None" << G4endl;
+    else {
+      std::vector<G4VModelFactory<G4VTrajectoryModel>*>::const_iterator i;
+      for (i = factoryList.begin(); i != factoryList.end(); ++i)
+	(*i)->Print(G4cout);
+    }
+    const G4VisListManager<G4VTrajectoryModel>* listManager =
+      fpTrajDrawModelMgr->ListManager();
+    const std::map<G4String, G4VTrajectoryModel*>& modelMap =
+      listManager->Map();
+    if (!modelMap.empty()) {
+      G4cout << "\nRegistered models:" << G4endl;
+      std::map<G4String, G4VTrajectoryModel*>::const_iterator i;
+      for (i = modelMap.begin(); i != modelMap.end(); ++i) {
+	G4cout << "  " << i->second->Name();
+	if (i->second == listManager->Current()) G4cout << " (Current)";
+	G4cout << G4endl;
+	if (verbosity >= parameters) i->second->Print(G4cout);
+      }
+    }
+  }
+
+  G4cout << G4endl;
+
+  {
+    //fpTrajFilterMgr->Print(G4cout);
+    G4cout << "Registered filter factories:" << G4endl;
+    const std::vector<G4VModelFactory<G4VFilter<G4VTrajectory> >*>&
+      factoryList = fpTrajFilterMgr->FactoryList();
+    if (factoryList.empty()) G4cout << "  None" << G4endl;
+    else {
+      std::vector<G4VModelFactory<G4VFilter<G4VTrajectory> >*>::const_iterator i;
+      for (i = factoryList.begin(); i != factoryList.end(); ++i)
+	(*i)->Print(G4cout);
+    }
+    const std::vector<G4VFilter<G4VTrajectory>*>&
+      filterList = fpTrajFilterMgr->FilterList();
+    if (!filterList.empty()) {
+      G4cout << "\nRegistered filters:" << G4endl;
+      std::vector<G4VFilter<G4VTrajectory>*>::const_iterator i;
+      for (i = filterList.begin(); i != filterList.end(); ++i) {
+	G4cout << "  " << (*i)->GetName() << G4endl;
+	if (verbosity >= parameters) (*i)->PrintAll(G4cout);
+      }
+    }
+  }
+}
+
+void G4VisManager::PrintInvalidPointers () const {
+  if (fVerbosity >= errors) {
+    G4cout << "ERROR: G4VisManager::PrintInvalidPointers:";
+    if (!fpGraphicsSystem) {
+      G4cout << "\n null graphics system pointer.";
+    }
+    else {
+      G4cout << "\n  Graphics system is " << fpGraphicsSystem -> GetName ()
+	     << " but:";
+      if (!fpScene)
+	G4cout <<
+	  "\n  Null scene pointer. Use \"/vis/drawVolume\" or"
+	  " \"/vis/scene/create\".";
+      if (!fpSceneHandler)
+	G4cout <<
+	  "\n  Null scene handler pointer. Use \"/vis/open\" or"
+	  " \"/vis/sceneHandler/create\".";
+      if (!fpViewer )
+	G4cout <<
+	  "\n  Null viewer pointer. Use \"/vis/viewer/create\".";
+    }
+    G4cout << G4endl;
+  }
+}
+
+void G4VisManager::BeginOfRun ()
+{
+  //G4cout << "G4VisManager::BeginOfRun" << G4endl;
+  fKeptLastEvent = false;
+  fEventKeepingSuspended = false;
+  fTransientsDrawnThisRun = false;
+  if (fpSceneHandler) fpSceneHandler->SetTransientsDrawnThisRun(false);
+}
+
+void G4VisManager::BeginOfEvent ()
+{
+  //G4cout << "G4VisManager::BeginOfEvent" << G4endl;
+  fTransientsDrawnThisEvent = false;
+  if (fpSceneHandler) fpSceneHandler->SetTransientsDrawnThisEvent(false);
+}
+
+void G4VisManager::EndOfEvent ()
+{
+  printf("G4VisManager::EndOfEvent \n");
+
+  //G4cout << "G4VisManager::EndOfEvent" << G4endl;
+
+  // Don't call IsValidView unless there is a scene handler.  This
+  // avoids WARNING message at end of event and run when the user has
+  // not instantiated a scene handler, e.g., in batch mode.
+  G4bool valid = GetConcreteInstance() && fpSceneHandler && IsValidView();
+  if (!valid) return;
+
+  G4RunManager* runManager = G4RunManager::GetRunManager();
+  const G4Run* currentRun = runManager->GetCurrentRun();
+
+  G4EventManager* eventManager = G4EventManager::GetEventManager();
+  const G4Event* currentEvent = eventManager->GetConstCurrentEvent();
+  if (!currentEvent) return;
+
+  // FIXME : OK
+  printf("G4VisManager::EndOfEvent 0\n");
+  ClearTransientStoreIfMarked();
+  printf("G4VisManager::EndOfEvent 1\n");
+  // FIXME : OK
+  fpSceneHandler->DrawEvent(currentEvent);
+
+  G4int nEventsToBeProcessed = 0;
+  G4int nKeptEvents = 0;
+  G4int eventID = -2;  // (If no run manager, triggers ShowView as normal.)
+  printf("G4VisManager::EndOfEvent 2\n");
+  if (currentRun) {
+    printf("G4VisManager::EndOfEvent currentRun?\n");
+    nEventsToBeProcessed = currentRun->GetNumberOfEventToBeProcessed();
+    eventID = currentEvent->GetEventID();
+    const std::vector<const G4Event*>* events =
+      currentRun->GetEventVector();
+    if (events) nKeptEvents = events->size();
+  }
+  
+  if (fpScene->GetRefreshAtEndOfEvent()) {
+    printf("G4VisManager::EndOfEvent GetRefreshAtEndOfEvent()\n");
+
+    // Unless last event (in which case wait end of run)...
+    if (eventID < nEventsToBeProcessed - 1) {
+      printf("G4VisManager::EndOfEvent 3 \n");
+      fpViewer->ShowView();
+      fpSceneHandler->SetMarkForClearingTransientStore(true);
+    } else {  // Last event...
+      printf("G4VisManager::EndOfEvent 4 \n");
+      // Keep, but only if user has not kept any...
+      if (!nKeptEvents) {
+	eventManager->KeepTheCurrentEvent();
+	fKeptLastEvent = true;
+      }
+    }
+
+  } else {  //  Accumulating events...
+  printf("G4VisManager::EndOfEvent NOT GetRefreshAtEndOfEvent()\n");
+
+    G4int maxNumberOfKeptEvents = fpScene->GetMaxNumberOfKeptEvents();
+    if (maxNumberOfKeptEvents > 0 && nKeptEvents >= maxNumberOfKeptEvents) {
+      printf("G4VisManager::EndOfEvent 5 \n");
+      fEventKeepingSuspended = true;
+      static G4bool warned = false;
+      if (!warned) {
+        printf("G4VisManager::EndOfEvent 6 \n");
+	if (fVerbosity >= warnings) {
+          printf("G4VisManager::EndOfEvent 7 \n");
+	  G4cout <<
+	    "WARNING: G4VisManager::EndOfEvent: Event keeping suspended."
+	    "\n  The number of events exceeds the maximum that may be kept, "
+		 << maxNumberOfKeptEvents << '.'
+		 << G4endl;
+	}
+	warned = true;
+      }
+    } else if (maxNumberOfKeptEvents != 0) {
+      printf("G4VisManager::EndOfEvent 8 \n");
+      eventManager->KeepTheCurrentEvent();
+    }
+  }
+  printf("G4VisManager::EndOfEvent 9 \n");
+}
+
+void G4VisManager::EndOfRun ()
+{
+  //G4cout << "G4VisManager::EndOfRun" << G4endl;
+  printf("G4VisManager::EndOfRun 1\n");
+  // Don't call IsValidView unless there is a scene handler.  This
+  // avoids WARNING message at end of event and run when the user has
+  // not instantiated a scene handler, e.g., in batch mode.
+  G4bool valid = GetConcreteInstance() && fpSceneHandler && IsValidView();
+  printf("G4VisManager::EndOfRun 2\n");
+  if (valid) {
+  printf("G4VisManager::EndOfRun 3\n");
+    if (!fpSceneHandler->GetMarkForClearingTransientStore()) {
+  printf("G4VisManager::EndOfRun 4\n");
+      if (fpScene->GetRefreshAtEndOfRun()) {
+  printf("G4VisManager::EndOfRun 5\n");
+	fpViewer->ShowView();
+  printf("G4VisManager::EndOfRun 6\n");
+	fpSceneHandler->SetMarkForClearingTransientStore(true);
+  printf("G4VisManager::EndOfRun 7\n");
+      }
+    }
+
+  printf("G4VisManager::EndOfRun 8\n");
+    if (fEventKeepingSuspended && fVerbosity >= warnings) {
+      G4cout <<
+	"WARNING: G4VisManager::EndOfRun: Event keeping was suspended."
+	"\n  The number of events in the run exceeded the maximum to be kept, "
+	     << fpScene->GetMaxNumberOfKeptEvents() << '.' <<
+	"\n  The number of events to be kept can be changed with"
+	"\n  \"/vis/scene/endOfEventAction accumulate <N>\", where N is the"
+	"\n  maximum number you wish to allow.  N < 0 means \"unlimited\"."
+	     << G4endl;
+    }
+  }
+  fEventRefreshing = false;
+
+  printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
+  G4RunManager* runManager = G4RunManager::GetRunManager();
+  const G4Run* currentRun = runManager->GetCurrentRun();
+  
+  G4int nKeptEvents = 0;
+  const std::vector<const G4Event*>* events =
+    currentRun? currentRun->GetEventVector(): 0;
+  if (events) nKeptEvents = events->size();
+
+  if (nKeptEvents && !fKeptLastEvent) {
+    if (!valid && fVerbosity >= warnings) G4cout << "WARNING: ";
+    if (fVerbosity >= warnings) {
+      G4cout << nKeptEvents;
+      if (nKeptEvents == 1) G4cout << " event has";
+      else G4cout << " events have";
+      G4cout << " been kept for refreshing and/or reviewing." << G4endl;
+    }
+    static G4bool warned = false;
+    if (!valid && fVerbosity >= warnings && !warned) {
+      G4cout <<
+	"  Only useful if before starting the run:"
+	"\n    a) trajectories are stored (\"/vis/scene/add/trajectories [smooth|rich]\"), or"
+	"\n    b) the Draw method of any hits is implemented."
+	"\n  To view trajectories and hits:"
+	"\n    open a viewer, draw a volume, \"/vis/scene/add/trajectories\""
+	"\n    \"/vis/scene/add/hits\" and, possibly, \"/vis/viewer/flush\"."
+	"\n  To see all events: \"/vis/scene/endOfEventAction accumulate\"."
+	"\n  To see events individually: \"/vis/reviewKeptEvents\"."
+	     << G4endl;
+      warned = true;
+    }
+  }
+}
+
+void G4VisManager::ClearTransientStoreIfMarked(){
+  // Assumes valid view.
+  if (fpSceneHandler->GetMarkForClearingTransientStore()) {
+    fpSceneHandler->SetMarkForClearingTransientStore(false);
+    fpSceneHandler->ClearTransientStore();
+  }
+  // Record if transients drawn.  These local flags are only set
+  // *after* ClearTransientStore.  In the code in G4VSceneHandler
+  // triggered by ClearTransientStore, use these flags so that
+  // event refreshing is not done too early.
+  fTransientsDrawnThisEvent = fpSceneHandler->GetTransientsDrawnThisEvent();
+  fTransientsDrawnThisRun = fpSceneHandler->GetTransientsDrawnThisRun();
+}
+
+void G4VisManager::ResetTransientsDrawnFlags()
+{
+  fTransientsDrawnThisRun = false;
+  fTransientsDrawnThisEvent = false;
+  G4SceneHandlerListConstIterator i;
+  for (i = fAvailableSceneHandlers.begin();
+       i != fAvailableSceneHandlers.end(); ++i) {
+    (*i)->SetTransientsDrawnThisEvent(false);
+    (*i)->SetTransientsDrawnThisRun(false);
+  }
+}
+
+G4String G4VisManager::ViewerShortName (const G4String& viewerName) const {
+  G4String viewerShortName (viewerName);
+  viewerShortName = viewerShortName (0, viewerShortName.find (' '));
+  return viewerShortName.strip ();
+}
+
+G4VViewer* G4VisManager::GetViewer (const G4String& viewerName) const {
+  G4String viewerShortName = ViewerShortName (viewerName);
+  size_t nHandlers = fAvailableSceneHandlers.size ();
+  size_t iHandler, iViewer;
+  G4VViewer* viewer = 0;
+  G4bool found = false;
+  for (iHandler = 0; iHandler < nHandlers; iHandler++) {
+    G4VSceneHandler* sceneHandler = fAvailableSceneHandlers [iHandler];
+    const G4ViewerList& viewerList = sceneHandler -> GetViewerList ();
+    for (iViewer = 0; iViewer < viewerList.size (); iViewer++) {
+      viewer = viewerList [iViewer];
+      if (viewerShortName == viewer -> GetShortName ()) {
+	found = true;
+	break;
+      }
+    }
+    if (found) break;
+  }
+  if (found) return viewer;
+  else return 0;
+}
+
+std::vector<G4String> G4VisManager::VerbosityGuidanceStrings;
+
+G4String G4VisManager::VerbosityString(Verbosity verbosity) {
+  G4String s;
+  switch (verbosity) {
+  case         quiet: s = "quiet (0)"; break;
+  case       startup: s = "startup (1)"; break;
+  case        errors: s = "errors (2)"; break;
+  case      warnings: s = "warnings (3)"; break;
+  case confirmations: s = "confirmations (4)"; break;
+  case    parameters: s = "parameters (5)"; break;
+  case           all: s = "all (6)"; break;
+  }
+  return s;
+}
+
+G4VisManager::Verbosity
+G4VisManager::GetVerbosityValue(const G4String& verbosityString) {
+  G4String s(verbosityString); s.toLower();
+  Verbosity verbosity;
+  if      (s(0) == 'q') verbosity = quiet;
+  else if (s(0) == 's') verbosity = startup;
+  else if (s(0) == 'e') verbosity = errors;
+  else if (s(0) == 'w') verbosity = warnings;
+  else if (s(0) == 'c') verbosity = confirmations;
+  else if (s(0) == 'p') verbosity = parameters;
+  else if (s(0) == 'a') verbosity = all;
+  else {
+    G4int intVerbosity;
+    std::istringstream is(s);
+    is >> intVerbosity;
+    if (!is) {
+      G4cout << "ERROR: G4VisManager::GetVerbosityValue: invalid verbosity \""
+	     << verbosityString << "\"";
+      for (size_t i = 0; i < VerbosityGuidanceStrings.size(); ++i) {
+	G4cout << '\n' << VerbosityGuidanceStrings[i];
+      }
+      verbosity = warnings;
+      G4cout << "\n  Returning " << VerbosityString(verbosity)
+	     << G4endl;
+    }
+    else {
+      verbosity = GetVerbosityValue(intVerbosity);
+    }
+  }
+  return verbosity;
+}
+
+G4VisManager::Verbosity G4VisManager::GetVerbosityValue(G4int intVerbosity) {
+  Verbosity verbosity;
+  if      (intVerbosity < quiet) verbosity = quiet;
+  else if (intVerbosity > all)   verbosity = all;
+  else                           verbosity = Verbosity(intVerbosity);
+  return verbosity;
+}
+
+void G4VisManager::SetVerboseLevel (G4int intVerbosity) {
+  fVerbosity = GetVerbosityValue(intVerbosity);
+}
+
+void G4VisManager::SetVerboseLevel (const G4String& verbosityString) {
+  fVerbosity = GetVerbosityValue(verbosityString);
+}
+
+G4bool G4VisManager::IsValidView () {
+
+  if (!fInitialised) Initialise ();
+
+  static G4bool noGSPrinting = true;
+  if (!fpGraphicsSystem) {
+    // Limit printing - we do not want printing if the user simply does
+    // not want to use graphics, e.g., in batch mode.
+    if (noGSPrinting) {
+      noGSPrinting = false;
+      if (fVerbosity >= warnings) {
+	G4cout <<
+  "WARNING: G4VisManager::IsValidView(): Attempt to draw when no graphics system"
+  "\n  has been instantiated.  Use \"/vis/open\" or \"/vis/sceneHandler/create\"."
+  "\n  Alternatively, to avoid this message, suppress instantiation of vis"
+  "\n  manager (G4VisExecutive), possibly by setting G4VIS_NONE, and ensure"
+  "\n  drawing code is executed only if G4VVisManager::GetConcreteInstance()"
+  "\n  is non-zero."
+	       << G4endl;
+      }
+    }
+    return false;
+  }
+
+  if ((!fpScene) || (!fpSceneHandler) || (!fpViewer)) {
+    if (fVerbosity >= errors) {
+      G4cout <<
+	"ERROR: G4VisManager::IsValidView(): Current view is not valid."
+	     << G4endl;
+      PrintInvalidPointers ();
+    }
+    return false;
+  }
+
+  if (fpScene != fpSceneHandler -> GetScene ()) {
+    if (fVerbosity >= errors) {
+      G4cout << "ERROR: G4VisManager::IsValidView ():";
+      if (fpSceneHandler -> GetScene ()) {
+	G4cout <<
+	  "\n  The current scene \""
+	       << fpScene -> GetName ()
+	       << "\" is not handled by"
+	  "\n  the current scene handler \""
+	       << fpSceneHandler -> GetName ()
+	       << "\""
+	  "\n  (it currently handles scene \""
+	       << fpSceneHandler -> GetScene () -> GetName ()
+	       << "\")."
+	  "\n  Either:"
+	  "\n  (a) attach it to the scene handler with"
+	  "\n      /vis/sceneHandler/attach "
+	       << fpScene -> GetName ()
+	       <<	", or"
+	  "\n  (b) create a new scene handler with "
+	  "\n      /vis/sceneHandler/create <graphics-system>,"
+	  "\n      in which case it should pick up the the new scene."
+	       << G4endl;
+      }
+      else {
+	G4cout << "\n  Scene handler \""
+	       << fpSceneHandler -> GetName ()
+	       << "\" has null scene pointer."
+	  "\n  Attach a scene with /vis/sceneHandler/attach [<scene-name>]"
+	       << G4endl;
+      }
+    }
+    return false;
+  }
+
+  const G4ViewerList& viewerList = fpSceneHandler -> GetViewerList ();
+  if (viewerList.size () == 0) {
+    if (fVerbosity >= errors) {
+      G4cout <<
+	"ERROR: G4VisManager::IsValidView (): the current scene handler\n  \""
+	     << fpSceneHandler -> GetName ()
+	     << "\" has no viewers.  Do /vis/viewer/create."
+	     << G4endl;
+    }
+    return false;
+  }
+
+  G4bool isValid = true;
+  if (fpScene -> IsEmpty ()) {  // Add world by default if possible...
+    G4bool warn(fVerbosity >= warnings);
+    G4bool successful = fpScene -> AddWorldIfEmpty (warn);
+    if (!successful || fpScene -> IsEmpty ()) {        // If still empty...
+      if (fVerbosity >= errors) {
+	G4cout << "ERROR: G4VisManager::IsViewValid ():";
+	G4cout <<
+	  "\n  Attempt at some drawing operation when scene is empty."
+	  "\n  Maybe the geometry has not yet been defined."
+	  "  Try /run/initialize."
+	       << G4endl;
+      }
+      isValid = false;
+    }
+    else {
+      G4UImanager::GetUIpointer()->ApplyCommand ("/vis/scene/notifyHandlers");
+      if (fVerbosity >= warnings) {
+	G4cout <<
+	  "WARNING: G4VisManager: the scene was empty, \"world\" has been"
+	  "\n  added and the scene handlers notified.";
+	G4cout << G4endl;
+      }
+    }
+  }
+  if (isValid) SetConcreteInstance(this);
+  return isValid;
+}
+
+void
+G4VisManager::RegisterModelFactories() 
+{
+  if (fVerbosity >= warnings) {
+    G4cout<<"G4VisManager: No model factories registered with G4VisManager."<<G4endl;
+    G4cout<<"G4VisManager::RegisterModelFactories() should be overridden in derived"<<G4endl;
+    G4cout<<"class. See G4VisExecutive for an example."<<G4endl;
+  }
+}
Index: tags/visualization-10.5-before-10.6_test/management/src/G4VisStateDependent.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/management/src/G4VisStateDependent.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/management/src/G4VisStateDependent.cc	(revision 1102)
@@ -0,0 +1,75 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VisStateDependent.cc,v 1.6 2006/06/29 21:30:02 gunter Exp $
+// GEANT4 tag $Name:  $
+
+#include "G4VisStateDependent.hh"
+
+#include "G4VisManager.hh"
+#include "G4StateManager.hh"
+
+G4VisStateDependent::G4VisStateDependent (G4VisManager* pVisManager):
+  fpVisManager (pVisManager) {}
+
+G4bool G4VisStateDependent::Notify (G4ApplicationState requestedState) {
+#ifdef G4DEBUG_VIS_MANAGEMENT
+    printf("G4VisStateDependent::Notify  vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv\n");
+#endif
+  G4StateManager* stateManager = G4StateManager::GetStateManager();
+  G4ApplicationState previousState = stateManager->GetPreviousState();
+  if (previousState == G4State_Idle  &&  requestedState == G4State_GeomClosed) {
+#ifdef G4DEBUG_VIS_MANAGEMENT
+    printf("G4VisStateDependent::Notify BeginOfRun \n");
+#endif
+    fpVisManager -> BeginOfRun ();
+  }
+  else if (previousState == G4State_GeomClosed &&  requestedState == G4State_EventProc) {
+#ifdef G4DEBUG_VIS_MANAGEMENT
+    printf("G4VisStateDependent::Notify BeginOfEvent \n");
+#endif
+    fpVisManager -> BeginOfEvent ();
+  }
+  else if (previousState == G4State_EventProc &&  requestedState == G4State_GeomClosed) {
+#ifdef G4DEBUG_VIS_MANAGEMENT
+    printf("G4VisStateDependent::Notify EndOfEvent \n");
+#endif
+    fpVisManager -> EndOfEvent ();
+  }
+  else if (previousState == G4State_GeomClosed &&  requestedState == G4State_Idle) {
+#ifdef G4DEBUG_VIS_MANAGEMENT
+    printf("G4VisStateDependent::Notify EndOfRun -----------------------------------------------------------------------------\n");
+#endif
+    fpVisManager -> EndOfRun ();
+#ifdef G4DEBUG_VIS_MANAGEMENT
+    printf("G4VisStateDependent::Notify EndOfRun -----------------------------------------XXXXXXXXXXXXXXXXXXXX-----------------\n");
+#endif
+  }
+#ifdef G4DEBUG_VIS_MANAGEMENT
+    printf("G4VisStateDependent::Notify G4VisStateDependent::Notify END ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");
+#endif
+  return true;
+}
Index: tags/visualization-10.5-before-10.6_test/modeling/GNUmakefile
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/GNUmakefile	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/GNUmakefile	(revision 1102)
@@ -0,0 +1,41 @@
+# $Id: GNUmakefile,v 1.11 2006/05/22 08:49:27 allison Exp $
+# --------------------------------------------------------------
+# GNUmakefile for modeling library.  John Allison, 31/12/1997.
+# --------------------------------------------------------------
+
+name := G4modeling
+
+ifndef G4INSTALL
+  G4INSTALL = ../../..
+endif
+
+GLOBLIBS  = libG4event.lib
+GLOBLIBS += libG4tracking.lib libG4processes.lib libG4digits_hits.lib
+GLOBLIBS += libG4track.lib libG4particles.lib libG4geometry.lib
+GLOBLIBS += libG4materials.lib libG4graphics_reps.lib
+GLOBLIBS += libG4intercoms.lib libG4global.lib
+
+include $(G4INSTALL)/config/architecture.gmk
+
+CPPFLAGS += -I$(G4BASE)/global/management/include
+CPPFLAGS += -I$(G4BASE)/graphics_reps/include
+CPPFLAGS += -I$(G4BASE)/global/HEPGeometry/include
+CPPFLAGS += -I$(G4BASE)/geometry/management/include
+CPPFLAGS += -I$(G4BASE)/geometry/volumes/include
+CPPFLAGS += -I$(G4BASE)/geometry/navigation/include
+CPPFLAGS += -I$(G4BASE)/geometry/solids/CSG/include
+CPPFLAGS += -I$(G4BASE)/geometry/solids/specific/include
+CPPFLAGS += -I$(G4BASE)/geometry/solids/Boolean/include
+CPPFLAGS += -I$(G4BASE)/materials/include
+CPPFLAGS += -I$(G4BASE)/global/HEPRandom/include
+CPPFLAGS += -I$(G4BASE)/processes/management/include
+CPPFLAGS += -I$(G4BASE)/particles/management/include
+CPPFLAGS += -I$(G4BASE)/event/include
+CPPFLAGS += -I$(G4BASE)/digits_hits/hits/include
+CPPFLAGS += -I$(G4BASE)/digits_hits/digits/include
+CPPFLAGS += -I$(G4BASE)/digits_hits/detector/include
+CPPFLAGS += -I$(G4BASE)/tracking/include
+CPPFLAGS += -I$(G4BASE)/track/include
+CPPFLAGS += -I$(G4BASE)/intercoms/include
+
+include $(G4INSTALL)/config/common.gmk
Index: tags/visualization-10.5-before-10.6_test/modeling/History
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/History	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/History	(revision 1102)
@@ -0,0 +1,496 @@
+$Id: History,v 1.109 2009/02/25 14:21:45 allison Exp $
+-------------------------------------------------------------------
+
+     =========================================================
+     Geant4 - an Object-Oriented Toolkit for Simulation in HEP
+     =========================================================
+
+                      Category History file
+                      ---------------------
+This file should be used by G4 developers and category coordinators
+to briefly summarize all major modifications introduced in the code
+and keep track of all category-tags.
+It DOES NOT substitute the  CVS log-message one should put at every
+committal in the CVS repository !
+
+     ----------------------------------------------------------
+     * Reverse chronological order (last date on top), please *
+     ----------------------------------------------------------
+
+History file for visualization/modeling
+---------------------------------------
+
+25th February 2009  John Allison  (modeling-V09-02-01 - needs greps-V09-02-01)
+- G4ModelApplyCommandsT: Added visManager->NotifyHandlers() after
+  application (Apply) of all commands.  Forces update of all viewers
+  after a change of model, e.g., trajectory colour, point size, etc.
+
+24th February 2009  John Allison  (modeling-V09-02-00 - needs greps-V09-02-00)
+- Added setAux/StepPtsSizeType commands (candidates: "none world screen").
+- Added unit to setAux/StepPtsSize for SizeType == world.
+
+27th July 2008  John Allison  (modeling-V09-01-01)
+- G4PhysicalVolumeSearchScene.cc: Cosmetic improvement to a message.
+
+4th January 2008  John Allison  (modeling-V09-01-00)
+- Adapted to new BeginPrimitives2D signature.
+
+10th November 2007  John Allison  (modeling-V09-00-00)
+- Minor improvement in warning message after change of geometry.
+
+30th May 2007  John Allison  (modeling-V08-03-02)
+- Removed warnedAboutIMode from G4TrajectoryDrawerUtils.hh.  It was
+  used only in G4TrajectoryDrawerUtils.cc and gave warnings about
+  being unused in other .cc files that inculded
+  G4TrajectoryDrawerUtils.hh.  warnedAboutIMode is now a static in
+  G4TrajectoryDrawerUtils.cc.
+
+30th May 2007  John Allison  (modeling-V08-03-01)
+- Fix for SUN.
+
+22nd May 2007  John Allison  (modeling-V08-03-00)
+- Simplified G4Atts for Physical Volume Path.
+
+3rd April 2007  John Allison  (modeling-V08-02-02)
+- G4PhysicalVolumeModel: Added full volume path information and
+  transformed axes to G4Atts.
+
+25th March 2007  John Allison  (modeling-V08-02-01)
+- G4PhysicalVolumeModel: Added solid dump and volume transformation to G4Atts.
+
+5th January 2007  John Allison  (modeling-V08-02-00 - needs greps-V08-02-00)
+- G4PhysicalVolumeModel.cc: Bug fix:
+  o Correct treatment of ForcedLineSegmentsPerCircle when clipping.
+
+16th November 2006  John Allison  (modeling-V08-01-15)
+- Added protection for parallel worlds (zero region pointer).
+
+14th November 2006  John Allison  (modeling-V08-01-14)
+- Merged modeling-V08-01-13-branch onto main branch.
+
+8th November 2006  John Allison  (modeling-V08-01-13-00)
+- On modeling-V08-01-13-branch.
+- Added G4Event pointer to modeling parameters.
+- G4TrajectoriesModel and G4HitsModel: use the above (G4VSceneHandler
+  supplies).
+
+5th November 2006  John Allison  (modeling-V08-01-13)
+- Further, hopefully, complete, protection against zero materials pointer.
+
+3rd November 2006  John Allison  (modeling-V08-01-12)
+- G4PhysicalVolumeModel.cc: Protected against zero material pointer.
+
+3rd November 2006  John Allison  (modeling-V08-01-11)
+- G4Trajectories/HitsModel.cc: Protected against zero pointers from
+  collections.
+
+2nd November 2006  John Allison  (modeling-V08-01-10)
+- G4HitsModel: Added GetCurrentHit.
+
+1st November 2006  John Allison  (modeling-V08-01-09)
+- G4VModel: Removed warning messages from the virtual functions
+  GetCurrentDescription and GetCurrentTag so that there is no longer
+  a message if the concrete class does not implement.  The implementation
+  in G4VModel, which is used by default, is simply to return the global
+  description and tag.
+- Removed GetCurrentDescription and GetCurrentTag from models for which the
+  concept of "current" makes no sense or is not used:
+    G4AxesModel, G4HitsModel, G4LogicalVolumeModel, G4ScaleModel, G4TextModel.
+- G4ModelCommandsT: Minor corrections to guidance.
+
+26th October 2006  John Allison  (modeling-V08-01-08)
+- G4PhysicalVolumeModel: Changed CreateAttValues to CreateCurrentAttValues.
+- G4TrajectoriesModel: Added GetCurrentTrajectory.
+
+------------------------------------------------------
+19th September 2006  John Allison  (modeling-V08-01-07)
+- G4ModelingParameters: Added ExplodeCentre
+- G4PhysicalVolumeModel.cc: Programmed ExplodeCentre.
+
+17th September 2006 Jane Tinslay
+- Shift an assert from G4AttributeFilterT to G4AttFilterUtils - was
+  causing problems with XCode 2.0
+
+------------------------------------------------------
+15th September 2006  John Allison  (modeling-V08-01-06)
+- G4PhysicalVolumeModel.ccChanged "Bookkeeping" to "Physics
+
+14th September 2006 Jane Tinslay
+- Fixes for sun
+
+13th September 2006  John Allison
+- G4ModelingParameters: Improved setting and access to explode factor.
+- G4PhysicalVolumeModel.cc: 
+  o Implemented explode factor(radial move) feature for top level drawn
+    volumes.
+- G4TrajectoriesModel.cc: Improved debug checking and printing of G4Atts.
+- G4ModelCommandUtils.hh, G4ModelCommandsT.hh:
+  o  Re-instate setTimeSliceInterval command.
+
+12th September 2006 Jane Tinslay
+- Add attribute based trajectory drawing & filtering, and attribute based
+  hit filtering
+
+---------------------------------------------------
+27th August 2006  John Allison  (modeling-V08-01-05)
+- G4ModelingParameters: Added warning flag and section/cutaway polyhedron.
+- G4PhysicalVolumeModel:
+  o Acts on warning flag from G4ModelingParameters.
+  o Added enum ClippingMode {subtraction, intersection};
+  o Equipped for generic sectioning (DCUT) and cutaways.
+- G4TrajectoryDrawerUtils::DrawWithTime:
+  o Made use of G4VisAttributes time range.
+  o Tidied.
+
+26th August 2006  John Allison  (modeling-V08-01-04 - requires greps-V08-01-03)
+- G4TrajectoryDrawerUtils.cc: Fixed compilation warning.
+
+25th August 2006 Jane Tinslay
+- Follow G4VFilter const change (requires greps-V08-01-03).
+
+16th August 2006  John Allison  (modeling-V08-01-03)
+- G4TrajectoryDrawerUtils.cc: Improved robustness of time slicing.
+- G4ModelCommandsT.hh: In class G4ModelCmdSetTimeSliceInterval: 
+  cmd->SetUnitCategory("Time").
+- G4TrajectoriesModel.cc: Improved debug statement.
+
+14th August 2006  John Allison  (modeling-V08-01-02)
+- G4ModelApplyCommandsT.hh: Added G4ModelCmdApplyDoubleAndUnit.
+- G4ModelCommandsT.hh: Added G4ModelCmdSetTimeSliceInterval.
+- G4VisTrajContext: Added TimeSliceInterval.
+- G4TrajectoryModelFactories: Instantiated G4ModelCmdSetTimeSliceInterval.
+- G4TrajectoryDrawerUtils.cc: Added time slicing.
+
+10th July 2006  John Allison  (modeling-V08-01-01)
+- Co-works with greps-V08-01-01.
+- G4VModel: Removed GetG4PhysicalVolumeModel.
+- G4ModelingParameters:
+  o Removed RepStyle, ViewGeom, ViewHits and ViewDigis (not used).
+  o Reduced number of constructors.
+- G4PhysicalVolumeModel:
+  o Removed Establish/DecommissionSpecials to conform with greps-V08-01-01.
+  o Rationalised G4Atts: Added GetAttDefs/CreateAttValues.
+
+3rd July 2006  John Allison  (modeling-V08-01-00)
+- Needs greps-V08-01-00.
+- G4PhysicalVolumeModel::G4PhysicalVolumeNodeID: Added GetNonCulledDepth.
+- G4PhysicalVolumeModel.cc: Also added G4Atts for solids.
+- G4TrajectoriesModel.cc: Added debug code.
+
+7th June 2006  John Allison (modeling-V08-00-14)
+- G4PhysicalVolumeModel.cc: Added protection for zero vis atts.
+
+6th June 2006  John Allison (modeling-V08-00-13)
+- G4TrajectoryChargeFilter.cc: Added #include <sstream> for Sun compiler.
+- G4PhysicalVolumeModel::Validate: Relaxed requirement for modeling parameters.
+  (Caused crash after change of geometry.)
+
+2nd June 2006 Joseph Perl (modeling-V08-00-12)
+- G4VisTrajContext: change default of point sizes from 0 to 2
+
+30th May 2006 Jane Tinslay
+- Add G4TrajectoryChargeFilter and G4TrajectoryOriginVolumeFilter
+
+25th May 2006  John Allison  (modeling-V08-00-11)
+- G4VModelFactory.hh: Indent printing of models.
+- G4ModelApplyCommandsT.hh: Fix trivial compiler warnings.
+
+22nd May 2006  John Allison  (modeling-V08-00-10)
+- Remove dependency on Run.
+- G4ModelingParameters.cc: Protect operator<< for zero fpDefaultVisAttributes.
+
+12th May 2006  John Allison  (modeling-V08-00-09)
+- G4TrajectoriesModel and G4HitsModel: Removed dependency on G4RunManager.
+  Uses G4RunManagerKernel.  Needs event-V08-00-01.
+- G4CallbackModel: Added G4VGraphicsScene argument to operator().
+
+4th May 2006  Joseph Perl  (modeling-V08-00-08)
+- Add missing assert to G4VTrajectoryModel needed by Windows.
+
+4th May 2006  John Allison
+- Improved protection for null models and parameters.
+
+2nd May 2006 Jane Tinslay
+- Add context to trajectory drawers. Intended to replace imode. 
+  Allows to configure default drawing style for lines, step and 
+  auxiliary points. For example, colours, visibility, point sizes, 
+  fill styles..
+- Add generic drawer, G4TrajectoryGenericDrawer. Draws all trajectories 
+  in the same style, based on its default context.
+- Update generic commands
+- Add verbose to drawers
+
+21st April 2006 Jane Tinslay  (modeling-V08-00-07)
+- Get rid of some warning messages from G4ModelCommandsT 
+  when compiling on Linux
+- Add Print method to G4VModelFactory
+
+19th April 2006  John Allison  (modeling-V08-00-06 - needs greps-V08-00-02)
+- G4BoundingSphereScene.hh, G4PhysicalVolumeMassScene.hh and
+  G4PhysicalVolumeSearchScene.hh;  Added dummy Begin/EndPrimitives2D
+  for greps-V08-00-02.
+- G4PhysicalVolumeModel.cc: Improved legibility and efficiency of
+  culling algorithm.
+
+28th March 2006 Jane Tinslay (jst28032006)
+- Add G4TrajectoryFilterFactories and G4TrajectoryParticleFilter
+  for trajectory filtering. 
+- Add more generic commands to G4ModelCommandsT
+
+28th March 2006  John Allison (modeling-V08-00-05)
+- G4PhysicalVolumeMassScene and G4PhysicalVolumeSearchScene:
+  o Removed EstablishSpecials.
+- G4PhysicalVolumeModel:
+  o GetTopPhysicalVolume, GetCurrentPV, GetCurrentLV,
+    GetCurrentMaterial: return non-const pointers.  (It has proved
+    impossibly difficult to deal with const pointers.)
+  o Modified for new G4PhysicalVolumeSearchScene constructor.
+- G4BoundingSphereScene: Removed use of GetG4PhysicalVolumeModel (uses
+  dynamic cast instead).
+
+24th March 2006 Jane Tinslay (jst24032006)
+- Add G4bool visibility parameter to trajectory draw 
+  models "Draw" method.
+ 
+16th March 2006 Jane Tinslay (jst16032006)
+- Template commands and colour map used in trajectory models
+- Introduce G4TrajectoryDrawByOriginVolume
+
+14th March 2006  John Allison (modeling-V08-00-04)
+- G4PhysicalVolumeModel::G4PhysicalVolumeNodeID: Added output operator<<.
+
+16th February 2006  John Allison (modeling-V08-00-03)
+- G4PhysicalVolumeModel: Minor enhancements to facilitate future
+  removal of Establish/DecommisionSpecials.
+
+8th February 2006  John Allison (modeling-V08-00-02)
+- Added DrawingStyle to G4ModelingParameters.
+- G4PhysicalVolumeModel: Fixed bug in culling of covered daughters and
+  improved readability of culling algorithm.
+
+26th January 2006  John Allison (modeling-V08-00-01)
+- G4PhysicalVolumeModel: Added capability of maintaining path of the
+  current drawn (non-culled) volume in terms of drawn (non-culled)
+  ancesters.  See G4PhysicalVolumeModel.hh for detailed description.
+- Removed some unnecessary data members and other small tidying.
+
+11th January 2006  John Allison (modeling-V08-00-00)
+- G4NullModel.cc: Changed G4Transform3D::Identity to G4Transform3D().
+
+2nd December 2005  Joseph Perl (modeling-V07-01-07)
+- Change "G4String inline" to "inline G4String" to correct compiler
+  warning in G4VTrajectoryModel.hh.
+
+30th November 2005  Gabriele Cosmo (modeling-V07-01-06)
+- Trivial fix to G4VModel for support of CLHEP-2.0.X series.
+
+28th November 2005  Jane Tinslay
+- Remove names of unused parameters to stop compiler warnings
+
+24th November 2005  John Allison (modeling-V07-01-05)
+- Set initial values for originalRMin, originalRMax to satisfy compiler
+
+23rd November 2005  Joseph Perl  (modeling-V07-01-04)
+- Tagged in preparation for Geant4 8.0
+
+23rd November 2005 Jane Tinslay
+- Enhanced trajectory implementation
+
+22nd November 2005  John Allison (modeling-V07-01-03)
+- Implemented radial replicas for G4Tubs.
+- Changed G4Transform3D::Identity to G4Transform3D().
+
+24th October 2005  John Allison (modeling-V07-01-02)
+- Added: G4VTrajectoryModel, G4VTrajectoryModelMaker, G4TrajectoryModelMaker
+  and G4TrajectoryTestModel.
+- G4VModel: cosmetic changes.
+
+13th October 2005  John Allison (modeling-V07-01-01)
+- Migrated to <sstream>.
+
+13th September 2005  John Allison (modeling-V07-01-00)
+- Fixed (non-)culling of transparent volumes.
+
+7th June 2005  John Allison (modeling-V07-00-02)
+- G4PhysicalVolumeModel: fixed case of off-origin volume.
+- G4TextModel: Further small improvement.
+
+31st May 2005  John Allison  (modeling-V07-00-01)
+- G4TextModel: Improved global tag for better identification.
+
+6th May 2005  John Allison  (modeling-V07-00-00)
+- G4PhysicalVolumeModel: SetCopyNo of replicas and paramaterised volumes.
+
+3rd March 2005  John Allison  (vis-V07-00-08)
+- Added Set methods to G4VModel.
+- Added argument to G4CallbackModel::operator()(const G4Transform3D&) so that
+  the model could implement a given transformation.  Provided default for
+  G4VUserVisAction::(const G4Transform3D& = G4Transform3D::Identity).
+
+11th November 2004  John Allison  (vis-V06-02-05)
+- Made use use of smart method GetPolyhedron for solids.  This greatly
+  speeds 2nd and subsequent drawings when kernel access is required.
+
+22nd September 2004  John Allison  (modeling-V06-02-01)
+- Changed use of deprecated G4VPhysicalVolume::GetRotation to GetRotationValue.
+- Fixed memory leak in G4PhysicalVolumeMassScene.
+
+13th September 2004  John Allison  (modeling-V06-02-00)
+- Added G4PhysicalVolumeMassScene.  From the header file:
+// Calculates the mass of a geometry tree taking into account daughters
+// up to the depth specified in the G4PhysicalVolumeModel.  Culling is
+// ignored so that all volumes are seen.
+//
+// The calculation is quite tricky, since it involves subtracting the
+// mass of that part of the mother that is occupied by each daughter and
+// then adding the mass of the daughter, and so on down the heirarchy.
+//
+// Usage for a given G4PhysicalVolumeModel* pvModel:
+//   G4PhysicalVolumeMassScene massScene;
+//   massScene.EstablishSpecials (*pvModel);
+//   pvModel->DescribeYourselfTo (massScene);
+//   G4double volume = massScene.GetVolume();
+//   G4double mass = massScene.GetMass();
+//   massScene.Reset();
+// See, for example, G4ASCIITreeSceneHandler::EndModeling().
+- Added some access functions to G4PhysicalVolumeModel:
+    GetTopPhysicalVolume, GetRequestedDepth, SetRequestedDepth.
+- Protected GetPhysicalVolumeModel when all volumes "invisible".
+
+12th November 2003  John Allison  (modeling-V05-02-02)
+- CalculateExtent always searches complete hierarchy.
+
+6th November 2003  John Allison  (modeling-V05-02-01, vis-V05-02-03)
+- GNUmakefile: rationalised.
+
+3rd November 2003  Gabriele Cosmo  (modeling-V05-02-00, vis-V05-02-02)
+- Added inclusion of G4VSolid.hh in G4LogicalVolumeModel.cc to make it self
+  consistent after header review in geometry category.
+
+4th October 2003  Gabriele Cosmo  (vis-V05-02-01)
+- GNUmakefile:
+  o added dependency to new module "geometry/navigation".
+  o replaced "digits+hits" with "digits_hits".
+- Coworks with "geometry-V05-02-00" and "digits_hits-V05-02-00".
+
+22nd September 2003  John Allison  (vis-V05-02-00, greps-V05-02-00)
+- Removed a redundant comment.
+
+20th November 2002  Gabriele Cosmo  (modeling-V04-01-00)
+- Fixed access to static data (requires "greps-V04-01-04") in
+  G4FlavoredParallelWorldModel.cc, to allow porting on Windows DLLs.
+
+11th November 2002  John Allison  (modeling-V04-00-00)
+- Added fDrawingMode data member to G4TrajectoriesModel.
+
+24th October 2002  John Allison (vis-V04-01-03)
+- Changes for AddThis(const G4VTrajectory&) and (const G4VHit&).
+
+23rd February 2002  John Allison (vis-V04-00-02)
+- Removed Begin/EndPrimitives from G4HitsModel and
+  G4TrajectoriesModel.  This was causing nested calls to
+  Begin/EndPrimitives (and thus to glNewList/EndList in OpenGL stored
+  mode), since the trajectories and hits Draw methods themselves have
+  Begin/EndPrimitives.
+
+24th August 2001  John Allison  (vis-V03-02-13)
+- Intoduced argument for printing in G4VModel::Validate(G4bool warn).
+- Changed default return value in G4VModel::Validate(G4bool) to true.
+- Invoke CalculateExtent after successful geometry change in
+  G4PhysicalVolumeModel::Validate, and other bug fixes..
+
+14th August 2001  John Allison  (vis-V03-02-11)
+- Added sceneHandler.Begin/EndPrimitives messages to models (long
+  standing bug!).
+
+9th August 2001  John Allison  (vis-V03-02-10-00)
+- Removed G4ModelingParameters::hierarchy.  It is no longer used.  The
+  textual or graphical representation of the geometry hierarchy is now
+  done in G4xxxTree classes in visua;ization/Tree.
+
+25th July 2001  John Allison  (modeling-V03-02-03)
+- Added G4VModel::GetG4PhysicalVolumeModel().
+- Added G4VModel* argument to G4BoundingSphereScene constructor.
+  Both the above are to facilitate access to a model, if it exists, and
+  to invoke methods of G4PhysicalVolumeModel if it is one.
+- Added code to curtail G4PhysicalVolumeModel search in G4BoundingSphereScene.
+
+24th July 2001  John Allison  (modeling-V03-02-02)
+- Added G4VModel::SetExtent(const G4VisExtent&).
+- Cosmetic improvements to G4BoundingSphereScene.
+- Augmented G4ScaleModel::fGlobalTag.
+
+21st July 2001  John Allison  (modeling-V03-02-01)
+- Added G4ScaleModel.
+- Fixed bug in G4BoundingSphereScene::::Accrue().
+- Also a few cosmetic changes.
+
+18th July 2001  John Allison  (modeling-V03-02-00)
+- Ensured rotation and translation of replica is restored.
+
+3rd February 2001  John Allison  (vis-V03-00-02)
+- Tidied for CodeWizard.
+
+29th May 2000  John Allison
+- Moved code for maintaining depth, physical and logical volume
+  pointers from VisitGeometryAndGetVisReps to DescribeAndDescend to
+  handle daughters of replicas correctly (Guy Barrand).
+
+22nd May 2000  John Allison  (modeling-V01-01-00)
+- Added G4VTreeGraphicsScene (DTREE).
+- Commented out pVPV->SetCopyNo(n) on Makoto's advice in
+  G4PhysicalVolumeModel.cc.
+
+vis-V01-01-01  12th April 2000  John Allison
+- Made G4PhysicalVolumeModel::DescribeSolid virtual.
+- G4PhysicalVolumeModel::DescribeSolid no longer deals with composite
+  solids - now programmed into CompositeSolid::CreatePolyhedron, where
+  CompositeSolid means G4IntersectionSolid, G4SubtractionSolid and
+  G4UnionSolid.
+- G4PhysicalVolumeModel::DescribeSolid no longer deals with displaced
+  solids - now programmed into G4DisplacedSolid::CreatePolyhedron.
+- Added G4LogicalVolumeModel::DescribeSolid, which explicitly adds
+  components of composite solids as white forced-wireframe objects.
+
+vis-V00-01-10  25th November 1999  John Allison
+- Adapted header files of modeling for Software Reference Manual.
+
+vis-01-00-05  7th February 1999  John Allison
+
+vis-01-00-05  7th February 1999  John Allison
+- Added list facility to G4PhysicalVolumeSearchScene.
+- Added virtual functions AddThis (const G4Polycone and G4Polyhedra to
+  G4BoundingSphereScene and G4PhysicalVolumeSearchScene.
+
+vis-00-04-01  25th November 1998  John Allison.
+- Added const G4VisAttributes* fpDefaultVisAttributes and access
+  functions to G4ModelingParameters.
+- Reverted to default assignment operator and copy constructor for
+  G4ModelingParameters.
+- G4PhysicalVolumeModel can now handle invisible daughters.
+
+31st August 1998  John Allison
+- Added G4VModel::Validate() and in subclasses.
+
+vis-00-02-05  27th August 1998  John Allison
+- Added G4HitsModel and G4TrajectoriesModel.
+
+vis-00-02-04  22nd August 1998  John Allison
+- Made G4Transform3D fTransform a member of G4VModel (instead of pointer).
+- Reversed order of parameters in G4VModel constructor.
+- Much bug fixing.
+
+vis-00-06-06  11th June 1998  John Allison
+- G4PhysicalVolumeModel handles parametrised solids and materials.
+
+vis-00-06-04  10th June 1998  John Allison
+- Moved G4BoundingSphereScene from management to modeling.
+- Added G4Transform3D data member.
+
+modeling-00-04-01  4th March 1998  John Allison
+- Last tag before moving to visualization.
+- Removed G4ModelingParameters:: from G4ModelingParameters.hh constructor.
+
+27th January 1998  John Allison
+- New (temporay?) category.
+- Incorporates modeling code which was in G4VScene.
Index: tags/visualization-10.5-before-10.6_test/modeling/README
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/README	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/README	(revision 1102)
@@ -0,0 +1,6 @@
+Modeling
+=======
+
+The idea is to put GEANT4-aware but user-enviroment-independent code
+here.  It introduces the concept of a G4VModel.
+
Index: tags/visualization-10.5-before-10.6_test/modeling/include/G4AttFilterUtils.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/include/G4AttFilterUtils.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/include/G4AttFilterUtils.hh	(revision 1102)
@@ -0,0 +1,52 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4AttFilterUtils.hh,v 1.2 2006/12/13 15:49:58 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// Visualisation attribute filter utility functions.
+//
+// Jane Tinslay, September 2006
+//
+#ifndef G4ATTFILTERUTILS_HH
+#define G4ATTFILTERUTILS_HH
+
+class G4AttDef;
+class G4TypeKey;
+class G4VAttValueFilter;
+template <typename A, typename B, typename C> class G4CreatorFactoryT;
+
+namespace G4AttFilterUtils {
+    
+  typedef G4CreatorFactoryT<G4VAttValueFilter, G4TypeKey, G4VAttValueFilter*(*)()> G4AttValueFilterFactory;
+
+  // G4AttValue filter factory  
+  G4AttValueFilterFactory* GetAttValueFilterFactory();
+  
+  // Create new G4AttValue filter 
+  G4VAttValueFilter* GetNewFilter(const G4AttDef& def);
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/modeling/include/G4AttValueFilterT.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/include/G4AttValueFilterT.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/include/G4AttValueFilterT.hh	(revision 1102)
@@ -0,0 +1,220 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4AttValueFilterT.hh,v 1.3 2006/12/13 15:50:00 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// Templated class for G4AttValue filters.
+//
+// Jane Tinslay, September 2006
+//
+#ifndef G4ATTVALUEFILTERT_HH
+#define G4ATTVALUEFILTERT_HH
+
+#include "G4VAttValueFilter.hh"
+#include "G4ConversionFatalError.hh"
+#include "G4ConversionUtils.hh"
+
+namespace {
+  
+  // Helper classes
+  template <typename T>
+  class IsEqual{
+  public:
+    IsEqual(const T& value): fValue(value) {};
+    bool operator()(const std::pair<const G4String, T>& myPair) const
+    {
+      return myPair.second == fValue;
+    }
+  private:
+    T fValue;
+  };
+  
+  template <typename T>
+  class InInterval{
+  public:
+    InInterval(const T& value): fValue(value) {};
+    bool operator()(const std::pair<const G4String, std::pair<T, T> >& myPair) const
+    {
+      T min = myPair.second.first;
+      T max = myPair.second.second;
+      return ((fValue > min || fValue == min) && (fValue < max));
+    }
+  private:
+    T fValue;
+  };
+
+}
+
+template <typename T, typename ConversionErrorPolicy = G4ConversionFatalError>
+class G4AttValueFilterT : public ConversionErrorPolicy, public G4VAttValueFilter {
+public:
+
+  // Constructor
+  G4AttValueFilterT();
+
+  // Destructor
+  virtual ~G4AttValueFilterT();
+
+  // Filter methods
+  G4bool Accept(const G4AttValue& attVal) const;
+  G4bool GetValidElement(const G4AttValue& input, G4String& interval) const;
+
+  // Print configuration
+  virtual void PrintAll(std::ostream& ostr) const;
+  
+  // Reset 
+  virtual void Reset();
+
+  void LoadIntervalElement(const G4String& input);
+  void LoadSingleValueElement(const G4String& input);
+
+private:
+
+  typedef std::pair<T, T> Pair;
+  typedef typename std::map<G4String, Pair> IntervalMap;
+  typedef std::map<G4String, T> SingleValueMap;
+
+
+  // Data members  
+  IntervalMap fIntervalMap;
+  SingleValueMap fSingleValueMap;
+  
+};
+
+template <typename T, typename ConversionErrorPolicy> 
+G4AttValueFilterT<T, ConversionErrorPolicy>::G4AttValueFilterT() {}
+
+template <typename T, typename ConversionErrorPolicy> 
+G4AttValueFilterT<T, ConversionErrorPolicy>::~G4AttValueFilterT() {}
+
+template <typename T, typename ConversionErrorPolicy>
+G4bool 
+G4AttValueFilterT<T, ConversionErrorPolicy>::GetValidElement(const G4AttValue& attValue, G4String& element) const 
+{
+  T value;
+  
+  G4String input = attValue.GetValue();
+  if (!G4ConversionUtils::Convert(input, value)) ConversionErrorPolicy::ReportError(input, "Invalid format. Was the input data formatted correctly ?");	
+  
+  typename SingleValueMap::const_iterator iterValues = 
+    std::find_if(fSingleValueMap.begin(), fSingleValueMap.end(), IsEqual<T>(value));
+
+  if (iterValues != fSingleValueMap.end()) {
+    element = iterValues->first;
+    return true;
+  }
+  
+  typename IntervalMap::const_iterator iterIntervals = 
+    std::find_if(fIntervalMap.begin(), fIntervalMap.end(), InInterval<T>(value));
+
+  if (iterIntervals != fIntervalMap.end()) {
+    element = iterIntervals->first;
+    return true;
+  }
+
+  return false;
+}
+
+template <typename T, typename ConversionErrorPolicy>
+G4bool 
+G4AttValueFilterT<T, ConversionErrorPolicy>::Accept(const G4AttValue& attValue) const 
+{
+  T value;
+
+  G4String input = attValue.GetValue();
+  if (!G4ConversionUtils::Convert(input, value)) ConversionErrorPolicy::ReportError(input, "Invalid format. Was the input data formatted correctly ?");	
+  
+  typename SingleValueMap::const_iterator iterValues = 
+    std::find_if(fSingleValueMap.begin(), fSingleValueMap.end(), IsEqual<T>(value));
+
+  if (iterValues != fSingleValueMap.end()) return true;
+  
+  typename IntervalMap::const_iterator iterIntervals = 
+    std::find_if(fIntervalMap.begin(), fIntervalMap.end(), InInterval<T>(value));
+
+  if (iterIntervals != fIntervalMap.end()) return true;
+
+  return false;
+}
+
+template <typename T, typename ConversionErrorPolicy>
+void 
+G4AttValueFilterT<T, ConversionErrorPolicy>::LoadIntervalElement(const G4String& input) 
+{
+  T min;
+  T max;
+
+  if (!G4ConversionUtils::Convert(input, min, max)) ConversionErrorPolicy::ReportError(input, "Invalid format. Was the input data formatted correctly ?");
+
+  std::pair<T, T> myPair(min, max);
+  fIntervalMap[input] = myPair;
+}
+
+template <typename T, typename ConversionErrorPolicy>
+void 
+G4AttValueFilterT<T, ConversionErrorPolicy>::LoadSingleValueElement(const G4String& input) 
+{
+  T output;
+  
+  if (!G4ConversionUtils::Convert(input, output)) ConversionErrorPolicy::ReportError(input, "Invalid format. Was the input data formatted correctly ?");
+
+  fSingleValueMap[input] = output;
+}
+
+template <typename T, typename ConversionErrorPolicy>
+void 
+G4AttValueFilterT<T, ConversionErrorPolicy>::PrintAll(std::ostream& ostr) const
+{
+  ostr<<"Printing data for filter: "<<Name()<<std::endl;
+
+  ostr<<"Interval data:"<<std::endl;
+
+  typename IntervalMap::const_iterator iterIntervals = fIntervalMap.begin();
+ 
+  while (iterIntervals != fIntervalMap.end()) {
+    ostr<<iterIntervals->second.first<<" : "<<iterIntervals->second.second<<std::endl;
+    iterIntervals++;
+  }
+
+  ostr<<"Single value data:"<<std::endl;
+
+  typename SingleValueMap::const_iterator iterValues = fSingleValueMap.begin();
+ 
+  while (iterValues != fSingleValueMap.end()) {
+    ostr<<iterValues->second<<std::endl;
+    iterValues++;
+  }
+}
+
+template <typename T, typename ConversionErrorPolicy>
+void 
+G4AttValueFilterT<T, ConversionErrorPolicy>::Reset() 
+{
+  fIntervalMap.clear();
+  fSingleValueMap.clear();
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/modeling/include/G4AttributeFilterT.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/include/G4AttributeFilterT.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/include/G4AttributeFilterT.hh	(revision 1102)
@@ -0,0 +1,229 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4AttributeFilterT.hh,v 1.6 2006/12/13 15:50:02 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// Generic attribute filter.
+//
+// Jane Tinslay, May 2006
+//
+#ifndef G4ATTRIBUTEFILTERT_HH
+#define G4ATTRIBUTEFILTERT_HH
+
+#include "G4AttDef.hh"
+#include "G4AttFilterUtils.hh"
+#include "G4AttUtils.hh"
+#include "G4AttValue.hh"
+#include "G4SmartFilter.hh"
+#include "G4VAttValueFilter.hh"
+#include <sstream>
+#include <vector>
+
+template <typename T>
+class G4AttributeFilterT : public G4SmartFilter<T> {
+
+public:
+ 
+  // Construct with filter name
+  G4AttributeFilterT(const G4String& name = "Unspecified");
+  
+  // Destructor
+  virtual ~G4AttributeFilterT();
+
+  // Evaluate
+  virtual bool Evaluate(const T&) const;
+
+  // Print configuration
+  virtual void Print(std::ostream& ostr) const;
+
+  // Clear filter
+  virtual void Clear();
+
+  // Configuration functions
+  void Set(const G4String& name);
+  void AddInterval(const G4String&);
+  void AddValue(const G4String&);
+
+private:
+
+  enum Config {Interval, SingleValue};
+
+  typedef std::pair<G4String, Config> Pair;
+  typedef std::vector<Pair> ConfigVect;
+
+  // Data members
+  G4String fAttName;
+  ConfigVect fConfigVect;
+
+  // Caching
+  mutable G4bool fFirst;
+  mutable G4bool fWarnedMissingAttribute;
+  mutable G4VAttValueFilter* filter;
+
+};
+
+template <typename T>
+G4AttributeFilterT<T>::G4AttributeFilterT(const G4String& name)
+  :G4SmartFilter<T>(name)
+  ,fAttName("")
+  ,fFirst(true)
+  ,fWarnedMissingAttribute(false)
+  ,filter(0)
+{}
+
+template <typename T>
+G4AttributeFilterT<T>::~G4AttributeFilterT() 
+{
+  delete filter;
+}
+
+template <typename T>
+G4bool
+G4AttributeFilterT<T>::Evaluate(const T& object) const
+{
+  // Return false if attribute name has not been set. Just print one warning.
+  if (fAttName.isNull()) {
+
+    if (!fWarnedMissingAttribute) {
+      std::ostringstream o;
+      o<<"Null attribute name";
+      G4Exception("G4AttributeFilterT::Evaluate", "NullAttributeName", JustWarning, o.str().c_str());
+      
+      fWarnedMissingAttribute = true;
+    }
+    
+    return false;
+  }
+  
+  if (fFirst) {
+
+    fFirst = false;
+
+    // Get attribute definition
+    G4AttDef attDef;
+    
+    // Expect definition to exist    
+    if (!G4AttUtils::ExtractAttDef(object, fAttName, attDef)) {
+      std::ostringstream o;
+      o <<"Unable to extract attribute definition named "<<fAttName;
+      G4Exception
+	("G4AttributeFilterT::Evaluate", "InvalidAttributeDefinition", FatalErrorInArgument, o.str().c_str());
+    }
+    
+    // Get new G4AttValue filter
+    filter = G4AttFilterUtils::GetNewFilter(attDef);
+
+    // Load both interval and single valued data.
+    typename ConfigVect::const_iterator iter = fConfigVect.begin();
+    
+    while (iter != fConfigVect.end()) {
+      if (iter->second == G4AttributeFilterT<T>::Interval) {filter->LoadIntervalElement(iter->first);}
+      else if (iter->second == G4AttributeFilterT<T>::SingleValue) {filter->LoadSingleValueElement(iter->first);}
+      iter++;
+    }
+  }
+
+  // Get attribute value
+  G4AttValue attVal;
+
+  // Expect value to exist
+  if (!G4AttUtils::ExtractAttValue(object, fAttName, attVal)) {
+    std::ostringstream o;
+    o <<"Unable to extract attribute value named "<<fAttName;
+    G4Exception
+      ("G4AttributeFilterT::Evaluate", "InvalidAttributeValue", FatalErrorInArgument, o.str().c_str());
+  }
+
+  if (G4SmartFilter<T>::GetVerbose()) {
+    G4cout<<"G4AttributeFilterT processing attribute named "<<fAttName;
+    G4cout<<" with value "<<attVal.GetValue()<<G4endl;
+  }
+
+  // Pass subfilter
+  return (filter->Accept(attVal));
+}
+
+template <typename T>
+void
+G4AttributeFilterT<T>::Clear()
+{
+  fConfigVect.clear();
+  if (0 != filter) filter->Reset();
+}
+
+template <typename T>
+void
+G4AttributeFilterT<T>::Print(std::ostream& ostr) const
+{
+  ostr<<"Printing data for G4Attribute filter named: "<<G4VFilter<T>::Name()<<std::endl;
+  ostr<<"Filtered attribute name: "<<fAttName<<std::endl;
+  ostr<<"Printing sub filter data:"<<std::endl;
+  if (0 != filter) filter->PrintAll(ostr);
+}
+
+template <typename T>
+void
+G4AttributeFilterT<T>::Set(const G4String& name)
+{
+  fAttName = name;
+}
+
+template <typename T>
+void
+G4AttributeFilterT<T>::AddInterval(const G4String& interval)
+{
+  std::pair<G4String, Config> myPair(interval, G4AttributeFilterT<T>::Interval);
+
+  typename ConfigVect::iterator iter = std::find(fConfigVect.begin(), fConfigVect.end(), myPair);
+  
+  if (iter != fConfigVect.end()) {
+    std::ostringstream o;
+    o <<"Interval "<< interval <<" already exists"<<std::endl;
+    G4Exception
+      ("G4AttributeFilterT::AddInterval", "InvalidInterval", FatalErrorInArgument, o.str().c_str());
+  }
+
+  fConfigVect.push_back(myPair);
+}
+
+template <typename T>
+void
+G4AttributeFilterT<T>::AddValue(const G4String& value)
+{
+  std::pair<G4String, Config> myPair(value, G4AttributeFilterT<T>::SingleValue);
+
+  typename ConfigVect::iterator iter = std::find(fConfigVect.begin(), fConfigVect.end(), myPair);
+  
+  if (iter != fConfigVect.end()) {
+    std::ostringstream o;
+    o <<"Single value "<< value <<" already exists"<<std::endl;
+    G4Exception
+      ("G4AttributeFilterT::AddValue", "InvalidValue", FatalErrorInArgument, o.str().c_str());
+  }
+  fConfigVect.push_back(myPair);
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/modeling/include/G4AxesModel.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/include/G4AxesModel.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/include/G4AxesModel.hh	(revision 1102)
@@ -0,0 +1,67 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4AxesModel.hh,v 1.6 2006/11/01 10:28:42 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  3rd April 2001
+//
+// Class Description:
+//
+// Model which knows how to draw axes.
+//
+// For access to base class information, e.g., modeling parameters,
+// use GetModelingParameters() inherited from G4VModel.  See Class
+// Description of the base class G4VModel.
+
+#ifndef G4AXESMODEL_HH
+#define G4AXESMODEL_HH
+
+#include "G4VModel.hh"
+
+class G4AxesModel: public G4VModel {
+
+public: // With description
+
+  G4AxesModel (G4double, G4double, G4double, G4double);
+   
+  virtual ~G4AxesModel ();
+
+  virtual void DescribeYourselfTo (G4VGraphicsScene&);
+  // The main task of a model is to describe itself to the graphics scene.
+
+private:
+
+  // Private copy contructor and assignment to forbid use...
+  G4AxesModel (const G4AxesModel&);
+  G4AxesModel& operator = (const G4AxesModel&);
+
+  G4double fX0, fY0, fZ0, fLength;
+
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/modeling/include/G4BoundingSphereScene.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/include/G4BoundingSphereScene.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/include/G4BoundingSphereScene.hh	(revision 1102)
@@ -0,0 +1,112 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4BoundingSphereScene.hh,v 1.18 2008/01/04 21:59:15 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  7th June 1997
+// An artificial scene to reuse G4VScene code to calculate a bounding sphere.
+
+#ifndef G4BOUNDINGSPHERESCENE_HH
+#define G4BOUNDINGSPHERESCENE_HH
+
+#include "G4VGraphicsScene.hh"
+#include "G4VisExtent.hh"
+#include "G4Box.hh"
+#include "G4Cons.hh"
+#include "G4Tubs.hh"
+#include "G4Trd.hh"
+#include "G4Trap.hh"
+#include "G4Sphere.hh"
+#include "G4Para.hh"
+#include "G4Torus.hh"
+#include "G4Polycone.hh"
+#include "G4Polyhedra.hh"
+
+class G4VModel;
+
+class G4BoundingSphereScene: public G4VGraphicsScene {
+
+public:
+  G4BoundingSphereScene (G4VModel* pModel = 0);
+  virtual ~G4BoundingSphereScene ();
+  void PreAddSolid (const G4Transform3D& objectTransformation,
+		    const G4VisAttributes&);
+  void PostAddSolid () {}
+  void AddSolid (const G4Box& s) {Accrue (s);}
+  void AddSolid (const G4Cons& s) {Accrue (s);}
+  void AddSolid (const G4Tubs& s) {Accrue (s);}
+  void AddSolid (const G4Trd& s) {Accrue (s);}
+  void AddSolid (const G4Trap& s) {Accrue (s);}
+  void AddSolid (const G4Sphere& s) {Accrue (s);}
+  void AddSolid (const G4Para& s) {Accrue (s);}
+  void AddSolid (const G4Torus& s) {Accrue (s);}
+  void AddSolid (const G4Polycone& s) {Accrue (s);}
+  void AddSolid (const G4Polyhedra& s) {Accrue (s);}
+  void AddSolid (const G4VSolid& s) {Accrue (s);}
+  void AddCompound (const G4VTrajectory&) {}
+  void AddCompound (const G4VHit&) {}
+  G4VisExtent GetBoundingSphereExtent ();
+  const G4Point3D& GetCentre() const {return fCentre;}
+  G4double GetRadius() const {return fRadius;}
+
+  void SetCentre(const G4Point3D& centre) {fCentre = centre;}
+
+  ////////////////////////////////////////////////////////////////
+  // The following 2 functions can be used by any code which wishes to
+  // accrue a bounding sphere.  Just instantiate a
+  // G4BoundingSphereScene and use AccrueBoundingSphere.
+
+  void ResetBoundingSphere ();
+  void AccrueBoundingSphere (const G4Point3D& centre,
+			     G4double radius);
+
+  ////////////////////////////////////////////////////////////////
+  // Functions not used by required by the abstract interface.
+
+  virtual void BeginPrimitives (const G4Transform3D&) {}
+  virtual void EndPrimitives () {}
+  virtual void BeginPrimitives2D (const G4Transform3D&) {}
+  virtual void EndPrimitives2D () {}
+  virtual void AddPrimitive (const G4Polyline&)   {}
+  virtual void AddPrimitive (const G4Scale&)      {}
+  virtual void AddPrimitive (const G4Text&)       {}
+  virtual void AddPrimitive (const G4Circle&)     {}
+  virtual void AddPrimitive (const G4Square&)     {}
+  virtual void AddPrimitive (const G4Polymarker&) {}
+  virtual void AddPrimitive (const G4Polyhedron&) {}
+  virtual void AddPrimitive (const G4NURBS&)      {}
+
+private:
+  void Accrue (const G4VSolid& solid);
+  G4VModel* fpModel;  // Instantiating code may optionally set this.
+  G4Point3D fCentre;
+  G4double fRadius;
+  const G4Transform3D* fpObjectTransformation;
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/modeling/include/G4CallbackModel.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/include/G4CallbackModel.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/include/G4CallbackModel.hh	(revision 1102)
@@ -0,0 +1,79 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4CallbackModel.hh,v 1.5 2006/06/29 21:30:10 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  31st December 1997.
+//
+// Class Description:
+//
+// G4CallbackModel calls a user-defined function containing, for
+// example, calls to the Draw methods of G4VVisManager or the
+// *Primitive* methods of G4VGraphicsScene.  This allows the user to
+// add his own graphical objects to a scene.  The idea is that the
+// callback function is invoked by the vis system to refresh the
+// screen or remake a graphical database whenever required.  The
+// function class must contain:
+//
+//   void operator()(G4VGraphicsScene&, const G4Transform3D&)
+//
+// A base class G4VUserVisAction is provided in the visualisation
+// category.  A G4CallbackModel is made by instantiating this template
+// with a pointer to the function object.  The G4VisManager does this
+// for the user if he/she registers it (SetUserAction) and issues the
+// command /vis/scene/add/userAction.  See the User Guide for
+// Application Developers, Section 8.8.7 and 8.8.8.
+
+#ifndef G4CALLBACKMODEL_HH
+#define G4CALLBACKMODEL_HH
+
+#include "G4VModel.hh"
+
+template <class F> class G4CallbackModel: public G4VModel {
+
+ public:
+  G4CallbackModel(F* function):
+    fFunction(function) {}
+  ~G4CallbackModel() {}
+  void DescribeYourselfTo(G4VGraphicsScene& sceneHandler) {
+    (*fFunction)(sceneHandler, fTransform);
+  }
+
+protected:
+
+  F* fFunction;
+
+private:
+
+  // Private copy constructor and assigment operator - copying and
+  // assignment not allowed.  Keeps CodeWizard happy.
+  G4CallbackModel (const G4CallbackModel&);
+  G4CallbackModel& operator = (const G4CallbackModel&);
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/modeling/include/G4FlavoredParallelWorldModel.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/include/G4FlavoredParallelWorldModel.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/include/G4FlavoredParallelWorldModel.hh	(revision 1102)
@@ -0,0 +1,63 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4FlavoredParallelWorldModel.hh,v 1.8 2006/06/29 21:30:12 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// P. Mora de Freitas et M.Verderi - 19 June 1998.
+//
+// Class Description:
+//
+// Model for flavored parallel world volumes.  Inherits from
+// G4PhysicalVolumeModel; for more information see that class
+// description.
+
+#ifndef G4FLAVOREDPARALLELWORLDMODEL_HH
+#define G4FLAVOREDPARALLELWORLDMODEL_HH
+
+#include "G4PhysicalVolumeModel.hh"
+
+class G4VFlavoredParallelWorld;
+
+class G4FlavoredParallelWorldModel : public G4PhysicalVolumeModel {
+  
+public: // With description
+  
+  G4FlavoredParallelWorldModel
+  (G4VFlavoredParallelWorld* FPW,
+   G4int soughtDepth = G4PhysicalVolumeModel::UNLIMITED,
+   const G4Transform3D& modelTransformation = G4Transform3D(),
+   const G4ModelingParameters* mp = 0);
+
+  ~G4FlavoredParallelWorldModel ();
+  
+private:
+
+  G4VFlavoredParallelWorld* theFlavoredParallelWorld;
+
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/modeling/include/G4HitFilterFactories.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/include/G4HitFilterFactories.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/include/G4HitFilterFactories.hh	(revision 1102)
@@ -0,0 +1,59 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+/// $Id: G4HitFilterFactories.hh,v 1.1 2006/09/12 18:53:03 tinslay Exp $
+// GEANT4 tag $Name:  $
+//
+//
+// Hit filter model factories creating filters
+// and associated messengers.
+//
+// Jane Tinslay March 2006
+//
+#ifndef G4HITFILTERFACTORIES_HH
+#define G4HITFILTERFACTORIES_HH
+
+#include "G4VFilter.hh"
+#include "G4VModelFactory.hh"
+#include "G4VHit.hh"
+
+// Attribute filter
+class G4HitAttributeFilterFactory : public G4VModelFactory< G4VFilter<G4VHit>  > {
+
+public: // With description
+
+  typedef std::vector<G4UImessenger*> Messengers;
+  typedef std::pair< G4VFilter<G4VHit> *, Messengers > ModelAndMessengers;
+
+  G4HitAttributeFilterFactory();
+
+  virtual ~G4HitAttributeFilterFactory();
+  
+  ModelAndMessengers Create(const G4String& placement, const G4String& name);
+    
+};
+
+#endif
+
Index: tags/visualization-10.5-before-10.6_test/modeling/include/G4HitsModel.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/include/G4HitsModel.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/include/G4HitsModel.hh	(revision 1102)
@@ -0,0 +1,67 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4HitsModel.hh,v 1.10 2006/11/02 11:57:31 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  26th August 1998.
+//
+// Class Description:
+//
+// Model which knows how to draw GEANT4 hits.
+//
+// For access to base class information, e.g., modeling parameters,
+// use GetModelingParameters() inherited from G4VModel.  See Class
+// Description of the base class G4VModel.
+
+#ifndef G4HITSMODEL_HH
+#define G4HITSMODEL_HH
+
+#include "G4VModel.hh"
+
+class G4VHit;
+
+class G4HitsModel: public G4VModel {
+
+public: // With description
+
+  G4HitsModel ();
+   
+  virtual ~G4HitsModel ();
+
+  virtual void DescribeYourselfTo (G4VGraphicsScene&);
+  // The main task of a model is to describe itself to the graphics scene.
+
+  const G4VHit* GetCurrentHit() const
+  {return fpCurrentHit;}
+
+private:
+
+  const G4VHit* fpCurrentHit;
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/modeling/include/G4LogicalVolumeModel.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/include/G4LogicalVolumeModel.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/include/G4LogicalVolumeModel.hh	(revision 1102)
@@ -0,0 +1,89 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4LogicalVolumeModel.hh,v 1.9 2006/11/01 10:28:42 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  26th July 1999.
+//
+// Class Description:
+//
+// Model for logical volumes.  It describes a logical volume and its
+// daughters to any depth - usually only the first by default.
+//
+// Inherits from G4PhysicalVolumeModel; for more information see that
+// class description.
+
+#ifndef G4LOGICALVOLUMEMODEL_HH
+#define G4LOGICALVOLUMEMODEL_HH
+
+#include "G4PhysicalVolumeModel.hh"
+
+#include "globals.hh"
+#include "G4Transform3D.hh"
+
+class G4LogicalVolume;
+class G4ModelingParameters;
+
+class G4LogicalVolumeModel: public G4PhysicalVolumeModel {
+
+public: // With description
+
+  G4LogicalVolumeModel
+  (G4LogicalVolume*,
+   G4int soughtDepth = 1,
+   G4bool booleans = true,
+   G4bool voxels = true,
+   G4bool readout = true,
+   const G4Transform3D& modelTransformation = G4Transform3D(),
+   const G4ModelingParameters* = 0);
+
+  virtual ~G4LogicalVolumeModel ();
+
+  void DescribeYourselfTo (G4VGraphicsScene&);
+
+protected:
+
+  // This called from G4PhysicalVolumeModel::DescribeAndDescend by the
+  // virtual function mechanism.
+  void DescribeSolid
+  (const G4Transform3D& theAT,
+   G4VSolid* pSol,
+   const G4VisAttributes* pVisAttribs,
+   G4VGraphicsScene& sceneHandler);
+
+  /////////////////////////////////////////////////////////
+  // Data members...
+
+  G4LogicalVolume* fpLV;
+  G4bool fBooleans;  // Flag for drawing boolean components.
+  G4bool fVoxels;    // Flag for drawing voxels.
+  G4bool fReadout;   // Flag for drawing readout geometry.
+
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/modeling/include/G4ModelApplyCommandsT.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/include/G4ModelApplyCommandsT.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/include/G4ModelApplyCommandsT.hh	(revision 1102)
@@ -0,0 +1,557 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4ModelApplyCommandsT.hh,v 1.6 2009/02/25 14:17:11 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// Abstract model messenges. Derived classes should implement
+// the "Apply" method
+//
+// Jane Tinslay April 2006
+//
+#ifndef G4APPLYCOMMANDST_HH
+#define G4APPLYCOMMANDST_HH
+
+#include "G4Colour.hh"
+#include "G4String.hh"
+#include "G4UIcmdWithABool.hh"
+#include "G4UIcmdWithADouble.hh"
+#include "G4UIcmdWithADoubleAndUnit.hh"
+#include "G4UIcmdWithAnInteger.hh"
+#include "G4UIcmdWithAString.hh"
+#include "G4UIcommand.hh"
+#include "G4VModelCommand.hh"
+#include "G4VVisManager.hh"
+#include <sstream>
+
+///////////////////////////////////////////////////////////////////////////
+// ApplyStringColour command
+template <typename M>
+class G4ModelCmdApplyStringColour : public G4VModelCommand<M> {
+
+public: // With description
+
+  G4ModelCmdApplyStringColour(M* model, const G4String& placement, const G4String& cmdName);
+
+  virtual ~G4ModelCmdApplyStringColour();
+
+  void SetNewValue(G4UIcommand* command, G4String newValue);
+
+protected:
+
+  // Implement in derived class
+  virtual void Apply(const G4String&, const G4Colour&) = 0;
+
+  G4UIcommand* StringCommand() {return fpStringCmd;}
+  G4UIcommand* ComponentCommand() {return fpComponentCmd;}
+
+private:
+
+  G4UIcommand* fpStringCmd;
+  G4UIcommand* fpComponentCmd;
+
+};
+
+template <typename M>
+G4ModelCmdApplyStringColour<M>::G4ModelCmdApplyStringColour(M* model, const G4String& placement, const G4String& cmdName)
+  :G4VModelCommand<M>(model, placement)
+{
+  //Set variable colour through a string
+  G4String dir = placement+"/"+model->Name()+"/"+cmdName;
+  G4UIparameter* param(0);
+
+  fpStringCmd = new G4UIcommand(dir, this);
+  fpStringCmd->SetGuidance("Set variable colour through a string");   
+  
+  param = new G4UIparameter("Variable", 's', false);
+  fpStringCmd->SetParameter(param);
+
+  param = new G4UIparameter("Value", 's', false);
+  fpStringCmd->SetParameter(param);
+
+  //Set variable colour through RGBA components
+  G4String componentDir = dir+"RGBA";
+  
+  fpComponentCmd = new G4UIcommand(componentDir, this);
+  fpComponentCmd->SetGuidance("Set variable colour through red, green, blue and alpha components");   
+  param = new G4UIparameter("Variable", 's', false);
+  fpComponentCmd->SetParameter(param);
+
+  param = new G4UIparameter("Red component", 'd', false);
+  fpComponentCmd->SetParameter(param);
+
+  param = new G4UIparameter("Green component", 'd', false);
+  fpComponentCmd->SetParameter(param);
+
+  param = new G4UIparameter("Blue component", 'd', false);
+  fpComponentCmd->SetParameter(param);
+
+  param = new G4UIparameter("Alpha component", 'd', false);
+  fpComponentCmd->SetParameter(param);
+} 
+
+template <typename M>
+G4ModelCmdApplyStringColour<M>::~G4ModelCmdApplyStringColour()
+{ 
+  delete fpStringCmd;
+  delete fpComponentCmd;
+}
+
+template <typename M>
+void G4ModelCmdApplyStringColour<M>::SetNewValue(G4UIcommand* cmd, G4String newValue)
+{
+  G4Colour myColour;
+  G4String parameter;
+  
+  if (cmd == fpStringCmd) {
+    G4String colour;
+    std::istringstream is (newValue);
+    is >> parameter >> colour;
+    
+    // Colour key should exist
+    if (!G4Colour::GetColour(colour, myColour)) {
+      std::ostringstream o;
+      o << "G4Colour with key "<<colour<<" does not exist ";
+      G4Exception
+	("G4ModelCmdApplyStringColour<M>::SetNewValue",
+	 "NonExistentColour", JustWarning, o.str().c_str());
+      return;
+    }
+  }
+  
+  if (cmd == fpComponentCmd) {
+    G4double red(0), green(0), blue(0), alpha(0);
+    std::istringstream is (newValue);
+    is >> parameter >> red >> green >> blue >> alpha;
+    
+    G4Colour colour(red, green, blue, alpha);
+    myColour = colour;
+  }
+
+  Apply(parameter, myColour);
+  G4VVisManager* visManager = G4VVisManager::GetConcreteInstance();
+  if (visManager) visManager->NotifyHandlers();
+}
+
+///////////////////////////////////////////////////////////////////////////
+//ApplyColour command
+template <typename M>
+class G4ModelCmdApplyColour : public G4VModelCommand<M> {
+
+public: // With description
+
+  G4ModelCmdApplyColour(M* model, const G4String& placement, const G4String& cmdName);
+
+  virtual ~G4ModelCmdApplyColour();
+
+  void SetNewValue(G4UIcommand* command, G4String newValue);
+
+protected:
+
+  // Implement in derived class
+  virtual void Apply(const G4Colour&) = 0;
+
+  G4UIcommand* StringCommand() {return fpStringCmd;}
+  G4UIcommand* ComponentCommand() {return fpComponentCmd;}
+
+private:
+
+  G4UIcommand* fpStringCmd;
+  G4UIcommand* fpComponentCmd;
+
+};
+
+template <typename M>
+G4ModelCmdApplyColour<M>::G4ModelCmdApplyColour(M* model, const G4String& placement, const G4String& cmdName)
+  :G4VModelCommand<M>(model, placement)
+{
+  //Set colour through a string
+  G4String dir = placement+"/"+model->Name()+"/"+cmdName;
+  G4UIparameter* param(0);
+
+  fpStringCmd = new G4UIcommand(dir, this);
+  fpStringCmd->SetGuidance("Set colour through a string");   
+  
+  param = new G4UIparameter("Variable", 's', false);
+  fpStringCmd->SetParameter(param);
+
+  //Set colour through RGBA components
+  G4String componentDir = dir+"RGBA";
+  
+  fpComponentCmd = new G4UIcommand(componentDir, this);
+  fpComponentCmd->SetGuidance("Set colour through red, green, blue and alpha components");   
+  fpComponentCmd->SetGuidance("Four inputs are expected.");
+
+  param = new G4UIparameter("Red component", 'd', false);
+  fpComponentCmd->SetParameter(param);
+
+  param = new G4UIparameter("Green component", 'd', false);
+  fpComponentCmd->SetParameter(param);
+
+  param = new G4UIparameter("Blue component", 'd', false);
+  fpComponentCmd->SetParameter(param);
+
+  param = new G4UIparameter("Alpha component", 'd', false);
+  fpComponentCmd->SetParameter(param);
+} 
+
+template <typename M>
+G4ModelCmdApplyColour<M>::~G4ModelCmdApplyColour()
+{ 
+  delete fpStringCmd;
+  delete fpComponentCmd;
+}
+
+template <typename M>
+void G4ModelCmdApplyColour<M>::SetNewValue(G4UIcommand* cmd, G4String newValue)
+{
+  G4Colour myColour;
+
+  if (cmd == fpStringCmd) {
+    G4String colour;
+    std::istringstream is (newValue);
+    is >> colour;
+    
+    // Colour key should exist
+    if (!G4Colour::GetColour(colour, myColour)) {
+      std::ostringstream o;
+      o << "G4Colour with key "<<colour<<" does not exist ";
+      G4Exception
+	("G4ModelCmdApplyColour<M>::SetNewValue",
+	 "NonExistentColour", JustWarning, o.str().c_str());
+      return;
+    }
+  }
+
+  if (cmd == fpComponentCmd) {
+    G4double red(0), green(0), blue(0), alpha(0);
+    std::istringstream is (newValue);
+    is >> red >> green >> blue >> alpha;
+    
+    G4Colour colour(red, green, blue, alpha);
+    myColour = colour;
+  }
+
+  Apply(myColour);
+  G4VVisManager* visManager = G4VVisManager::GetConcreteInstance();
+  if (visManager) visManager->NotifyHandlers();
+}
+
+///////////////////////////////////////////////////////////////////////////
+//ApplyBool command
+template <typename M>
+class G4ModelCmdApplyBool : public G4VModelCommand<M> {
+
+public: // With description
+
+  G4ModelCmdApplyBool(M* model, const G4String& placement, const G4String& cmdName);
+  virtual ~G4ModelCmdApplyBool();
+
+  void SetNewValue(G4UIcommand* command, G4String newValue);
+
+protected:
+
+  // Implement in derived class
+  virtual void Apply(const G4bool&) = 0;
+
+  G4UIcmdWithABool* Command() {return fpCmd;}
+
+private:
+
+  G4UIcmdWithABool* fpCmd;
+
+};
+
+template <typename M>
+G4ModelCmdApplyBool<M>::G4ModelCmdApplyBool(M* model, const G4String& placement, const G4String& cmdName)
+  :G4VModelCommand<M>(model, placement)
+{
+  G4String dir = placement+"/"+model->Name()+"/"+cmdName;
+  fpCmd = new G4UIcmdWithABool(dir, this);
+
+  fpCmd->SetParameterName("Bool", false);
+}
+ 
+template <typename M>
+G4ModelCmdApplyBool<M>::~G4ModelCmdApplyBool()
+{  
+  delete fpCmd;
+}
+
+template <typename M>
+void G4ModelCmdApplyBool<M>::SetNewValue(G4UIcommand*, G4String newValue)
+{
+  Apply(fpCmd->GetNewBoolValue(newValue));
+  G4VVisManager* visManager = G4VVisManager::GetConcreteInstance();
+  if (visManager) visManager->NotifyHandlers();
+}
+
+///////////////////////////////////////////////////////////////////////////
+//ApplyNull command
+template <typename M>
+class G4ModelCmdApplyNull : public G4VModelCommand<M> {
+
+public: // With description
+
+  G4ModelCmdApplyNull(M* model, const G4String& placement, const G4String& cmdName);
+
+  virtual ~G4ModelCmdApplyNull();
+
+  void SetNewValue(G4UIcommand* command, G4String newValue);
+
+protected:
+
+  // Implement in derived class
+  virtual void Apply() = 0;
+
+  G4UIcommand* Command() {return fpCmd;}
+  
+private:
+
+  G4UIcommand* fpCmd;
+
+};
+
+template <typename M>
+G4ModelCmdApplyNull<M>::G4ModelCmdApplyNull(M* model, const G4String& placement, const G4String& cmdName)
+  :G4VModelCommand<M>(model, placement)
+{
+  G4String dir = placement+"/"+model->Name()+"/"+cmdName;
+  fpCmd = new G4UIcommand(dir, this);
+}
+
+template <typename M>
+G4ModelCmdApplyNull<M>::~G4ModelCmdApplyNull() 
+{
+  delete fpCmd;
+}
+
+template <typename M>
+void G4ModelCmdApplyNull<M>::SetNewValue(G4UIcommand*, G4String)
+{
+  Apply();
+  G4VVisManager* visManager = G4VVisManager::GetConcreteInstance();
+  if (visManager) visManager->NotifyHandlers();
+}
+
+///////////////////////////////////////////////////////////////////////////
+//ApplyDouble command
+template <typename M>
+class G4ModelCmdApplyDouble : public G4VModelCommand<M> {
+
+public: // With description
+
+  G4ModelCmdApplyDouble(M* model, const G4String& placement, const G4String& cmdName);
+
+  virtual ~G4ModelCmdApplyDouble();
+
+  void SetNewValue(G4UIcommand* command, G4String newValue);
+
+protected:
+
+  // Implement in derived class
+  virtual void Apply(const G4double&) = 0;
+
+  G4UIcmdWithADouble* Command() {return fpCmd;}
+
+private:
+
+  G4UIcmdWithADouble* fpCmd;
+
+};
+
+template <typename M>
+G4ModelCmdApplyDouble<M>::G4ModelCmdApplyDouble(M* model, const G4String& placement, const G4String& cmdName)
+  :G4VModelCommand<M>(model, placement)
+{
+  G4String dir = placement+"/"+model->Name()+"/"+cmdName;
+
+  fpCmd = new G4UIcmdWithADouble(dir, this);
+  fpCmd->SetParameterName("Double", false);
+}
+
+template <typename M>
+G4ModelCmdApplyDouble<M>::~G4ModelCmdApplyDouble()
+{  
+  delete fpCmd;
+}
+
+template <typename M>
+void G4ModelCmdApplyDouble<M>::SetNewValue(G4UIcommand*, G4String newValue)
+{
+  Apply(fpCmd->GetNewDoubleValue(newValue));
+  G4VVisManager* visManager = G4VVisManager::GetConcreteInstance();
+  if (visManager) visManager->NotifyHandlers();
+}
+
+///////////////////////////////////////////////////////////////////////////
+//ApplyDoubleAndUnit command
+template <typename M>
+class G4ModelCmdApplyDoubleAndUnit : public G4VModelCommand<M> {
+
+public: // With description
+
+  G4ModelCmdApplyDoubleAndUnit(M* model, const G4String& placement, const G4String& cmdName);
+
+  virtual ~G4ModelCmdApplyDoubleAndUnit();
+
+  void SetNewValue(G4UIcommand* command, G4String newValue);
+
+protected:
+
+  // Implement in derived class
+  virtual void Apply(const G4double&) = 0;
+
+  G4UIcmdWithADoubleAndUnit* Command() {return fpCmd;}
+
+private:
+
+  G4UIcmdWithADoubleAndUnit* fpCmd;
+
+};
+
+template <typename M>
+G4ModelCmdApplyDoubleAndUnit<M>::G4ModelCmdApplyDoubleAndUnit(M* model, const G4String& placement, const G4String& cmdName)
+  :G4VModelCommand<M>(model, placement)
+{
+  G4String dir = placement+"/"+model->Name()+"/"+cmdName;
+
+  fpCmd = new G4UIcmdWithADoubleAndUnit(dir, this);
+  fpCmd->SetParameterName("DoubleAndUnit", false);
+}
+
+template <typename M>
+G4ModelCmdApplyDoubleAndUnit<M>::~G4ModelCmdApplyDoubleAndUnit()
+{  
+  delete fpCmd;
+}
+
+template <typename M>
+void G4ModelCmdApplyDoubleAndUnit<M>::SetNewValue(G4UIcommand*, G4String newValue)
+{
+  Apply(fpCmd->GetNewDoubleValue(newValue));
+  G4VVisManager* visManager = G4VVisManager::GetConcreteInstance();
+  if (visManager) visManager->NotifyHandlers();
+}
+
+///////////////////////////////////////////////////////////////////////////
+// ApplyInteger command
+template <typename M>
+class G4ModelCmdApplyInteger : public G4VModelCommand<M> {
+
+public: // With description
+
+  G4ModelCmdApplyInteger(M* model, const G4String& placement, const G4String& cmdName);
+
+  virtual ~G4ModelCmdApplyInteger();
+
+  void SetNewValue(G4UIcommand* command, G4String newValue);
+
+protected:
+
+  // Implement in derived class
+  virtual void Apply(const G4int&) = 0;
+
+  G4UIcmdWithAnInteger* Command() {return fpCmd;}
+
+private:
+
+  G4UIcmdWithAnInteger* fpCmd;
+};
+
+template <typename M>
+G4ModelCmdApplyInteger<M>::G4ModelCmdApplyInteger(M* model, const G4String& placement, const G4String& cmdName)
+  :G4VModelCommand<M>(model, placement)
+{
+  G4String dir = placement+"/"+model->Name()+"/"+cmdName;
+
+  fpCmd = new G4UIcmdWithAnInteger(dir, this);
+  fpCmd->SetParameterName("Integer", false);
+}
+
+template <typename M>
+G4ModelCmdApplyInteger<M>::~G4ModelCmdApplyInteger()
+{  
+  delete fpCmd;
+}
+
+template <typename M>
+void G4ModelCmdApplyInteger<M>::SetNewValue(G4UIcommand* cmd, G4String newValue)
+{
+  Apply(fpCmd->GetNewIntValue(newValue));
+  G4VVisManager* visManager = G4VVisManager::GetConcreteInstance();
+  if (visManager) visManager->NotifyHandlers();
+}
+
+///////////////////////////////////////////////////////////////////////////
+// ApplyString command
+template <typename M>
+class G4ModelCmdApplyString : public G4VModelCommand<M> {
+
+public: // With description
+
+  G4ModelCmdApplyString(M* model, const G4String& placement, const G4String& cmdName);
+
+  virtual ~G4ModelCmdApplyString();
+
+  void SetNewValue(G4UIcommand* command, G4String newValue);
+
+protected:
+
+  // Implement in derived class
+  virtual void Apply(const G4String&) = 0;
+
+  G4UIcmdWithAString* Command() {return fpCmd;}
+
+private:
+
+  G4UIcmdWithAString* fpCmd;
+
+};
+
+template <typename M>
+G4ModelCmdApplyString<M>::G4ModelCmdApplyString(M* model, const G4String& placement, const G4String& cmdName)
+  :G4VModelCommand<M>(model, placement)
+{
+  G4String dir = placement+"/"+model->Name()+"/"+cmdName;
+
+  fpCmd = new G4UIcmdWithAString(dir, this);
+}
+
+template <typename M>
+G4ModelCmdApplyString<M>::~G4ModelCmdApplyString()
+{  
+  delete fpCmd;
+}
+
+template <typename M>
+void G4ModelCmdApplyString<M>::SetNewValue(G4UIcommand*, G4String newValue)
+{
+  Apply(newValue);
+  G4VVisManager* visManager = G4VVisManager::GetConcreteInstance();
+  if (visManager) visManager->NotifyHandlers();
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/modeling/include/G4ModelColourMap.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/include/G4ModelColourMap.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/include/G4ModelColourMap.hh	(revision 1102)
@@ -0,0 +1,129 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4ModelColourMap.hh,v 1.2 2006/06/29 21:30:22 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// Generic variable->G4Colour map, where "variable" is the template
+// parameter.
+//
+// Jane Tinslay March 2006
+
+#ifndef G4MODELCOLOURMAP_HH
+#define G4MODELCOLOURMAP_HH
+
+#include "G4Colour.hh"
+#include "G4String.hh"
+#include <map>
+
+template <typename T>
+class G4ModelColourMap {
+
+public: // With description
+
+  G4ModelColourMap();
+
+  virtual ~G4ModelColourMap();
+
+  // Configuration functions
+  void Set(const T&, const G4Colour&);
+  void Set(const T&, const G4String&);
+  G4Colour& operator[](const T& quantity);
+
+  // Access functions
+  bool GetColour(const T&, G4Colour&) const;
+  void Print(std::ostream& ostr) const;
+
+private:
+
+  // Data member
+  std::map<T, G4Colour> fMap;
+
+};
+
+template <typename T>
+G4Colour& 
+G4ModelColourMap<T>::operator[](const T& quantity) {return fMap[quantity];}
+
+template <typename T>
+G4ModelColourMap<T>::G4ModelColourMap() {}
+
+template <typename T>
+G4ModelColourMap<T>::~G4ModelColourMap() {}
+
+template <typename T>
+void
+G4ModelColourMap<T>::Set(const T& quantity, const G4String& colour) 
+{
+  G4Colour myColour;
+  
+  // Will not setup the map if colour key does not exist
+  if (!G4Colour::GetColour(colour, myColour)) {
+    std::ostringstream o;
+    o << "G4Colour with key "<<colour<<" does not exist ";
+    G4Exception
+      ("G4ColourMap::Set(Charge charge, const G4String& colour)",
+       "NonExistentColour", JustWarning, o.str().c_str());
+    return;
+  }
+  
+  
+  // Will not modify myColour if colour key does not exist
+  Set(quantity, myColour);
+}
+
+template <typename T>
+void
+G4ModelColourMap<T>::Set(const T& quantity, const G4Colour& colour) 
+{
+  fMap[quantity] = colour;
+}   
+
+template <typename T>
+bool
+G4ModelColourMap<T>::GetColour(const T& quantity, G4Colour& colour) const
+{
+  typename std::map<T, G4Colour>::const_iterator iter = fMap.find(quantity);
+
+  if (iter != fMap.end()) {
+    colour = iter->second;
+    return true;
+  }
+  
+  return false;
+}
+
+template <typename T>
+void
+G4ModelColourMap<T>::Print(std::ostream& ostr) const
+{
+  typename std::map<T, G4Colour>::const_iterator iter = fMap.begin();
+  
+  while (iter != fMap.end()) {
+    ostr<< iter->first <<" : "<< iter->second <<G4endl;
+    iter++;
+  }
+}
+#endif
Index: tags/visualization-10.5-before-10.6_test/modeling/include/G4ModelCommandUtils.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/include/G4ModelCommandUtils.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/include/G4ModelCommandUtils.hh	(revision 1102)
@@ -0,0 +1,71 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4ModelCommandUtils.hh,v 1.3 2009/02/24 12:00:56 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// Jane Tinslay September 2006
+//
+// Command utilities
+//
+#ifndef G4MODELCOMMANDUTILS_HH
+#define G4MODELCOMMANDUTILS_HH
+
+#include "G4String.hh"
+#include "G4ModelCommandsT.hh"
+#include "G4UImessenger.hh"
+#include "G4VisTrajContext.hh"
+
+namespace G4ModelCommandUtils {
+
+  void AddContextMsgrs(G4VisTrajContext* context, std::vector<G4UImessenger*>& messengers,
+		       const G4String& placement)
+  {
+    messengers.push_back(new G4ModelCmdCreateContextDir<G4VisTrajContext>(context, placement));
+    messengers.push_back(new G4ModelCmdSetDrawLine<G4VisTrajContext>(context, placement));
+    messengers.push_back(new G4ModelCmdSetLineVisible<G4VisTrajContext>(context, placement));
+    messengers.push_back(new G4ModelCmdSetLineColour<G4VisTrajContext>(context, placement));
+    
+    messengers.push_back(new G4ModelCmdSetDrawStepPts<G4VisTrajContext>(context, placement));
+    messengers.push_back(new G4ModelCmdSetStepPtsVisible<G4VisTrajContext>(context, placement));
+    messengers.push_back(new G4ModelCmdSetStepPtsColour<G4VisTrajContext>(context, placement));
+    messengers.push_back(new G4ModelCmdSetStepPtsSize<G4VisTrajContext>(context, placement));
+    messengers.push_back(new G4ModelCmdSetStepPtsSizeType<G4VisTrajContext>(context, placement));
+    messengers.push_back(new G4ModelCmdSetStepPtsType<G4VisTrajContext>(context, placement));
+    messengers.push_back(new G4ModelCmdSetStepPtsFillStyle<G4VisTrajContext>(context, placement));
+    
+    messengers.push_back(new G4ModelCmdSetDrawAuxPts<G4VisTrajContext>(context, placement));
+    messengers.push_back(new G4ModelCmdSetAuxPtsVisible<G4VisTrajContext>(context, placement));
+    messengers.push_back(new G4ModelCmdSetAuxPtsColour<G4VisTrajContext>(context, placement));
+    messengers.push_back(new G4ModelCmdSetAuxPtsSize<G4VisTrajContext>(context, placement));
+    messengers.push_back(new G4ModelCmdSetAuxPtsSizeType<G4VisTrajContext>(context, placement));
+    messengers.push_back(new G4ModelCmdSetAuxPtsType<G4VisTrajContext>(context, placement));
+    messengers.push_back(new G4ModelCmdSetAuxPtsFillStyle<G4VisTrajContext>(context, placement));
+
+    messengers.push_back(new G4ModelCmdSetTimeSliceInterval<G4VisTrajContext>(context, placement));
+  }  
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/modeling/include/G4ModelCommandsT.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/include/G4ModelCommandsT.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/include/G4ModelCommandsT.hh	(revision 1102)
@@ -0,0 +1,855 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4ModelCommandsT.hh,v 1.13 2009/02/24 12:00:56 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// Generic model messenges. 
+//
+// Jane Tinslay March 2006
+//
+#ifndef G4MODELCOMMANDST_HH
+#define G4MODELCOMMANDST_HH
+
+#include "G4ModelApplyCommandsT.hh"
+#include "G4Polymarker.hh"
+#include "G4UIdirectory.hh"
+#include <sstream>
+
+////////////////////////////////////////////////////////////////////////
+// Set parameter colour
+template <typename M>
+class G4ModelCmdSetStringColour : public G4ModelCmdApplyStringColour<M> {
+
+public: // With description
+
+  G4ModelCmdSetStringColour(M* model, const G4String& placement, 
+			    const G4String& cmdName="set")
+    :G4ModelCmdApplyStringColour<M>(model, placement, cmdName) {}
+  
+  virtual ~G4ModelCmdSetStringColour() {}
+
+protected:
+
+  virtual void Apply(const G4String& param, const G4Colour& colour) {
+    G4VModelCommand<M>::Model()->Set(param, colour);
+  }
+
+};
+
+////////////////////////////////////////////////////////////////////////
+// Set default colour
+template <typename M>
+class G4ModelCmdSetDefaultColour : public G4ModelCmdApplyColour<M> {
+
+public: // With description
+
+  G4ModelCmdSetDefaultColour(M* model, const G4String& placement, 
+			     const G4String& cmdName="setDefault")
+    :G4ModelCmdApplyColour<M>(model, placement, cmdName) {}
+  
+  virtual ~G4ModelCmdSetDefaultColour() {}
+
+protected:
+
+  virtual void Apply(const G4Colour& colour) {
+    G4VModelCommand<M>::Model()->SetDefault(colour);
+  }
+  
+};
+
+////////////////////////////////////////////////////////////////////////
+// Add string command
+template <typename M>
+class G4ModelCmdAddString : public G4ModelCmdApplyString<M> {
+
+public: // With description
+
+  G4ModelCmdAddString(M* model, const G4String& placement,
+		      const G4String& cmdName="add")
+    :G4ModelCmdApplyString<M>(model, placement, cmdName) 
+  {
+    G4ModelCmdApplyString<M>::Command()->SetGuidance("Add command");
+  }
+
+  virtual ~G4ModelCmdAddString() {}
+
+protected:
+  
+  virtual void Apply(const G4String& newValue) {
+    G4VModelCommand<M>::Model()->Add(newValue);
+  }
+  
+};
+
+////////////////////////////////////////////////////////////////////////
+//Add integer command
+template <typename M>
+class G4ModelCmdAddInt : public G4ModelCmdApplyInteger<M> {
+
+public: // With description
+
+  G4ModelCmdAddInt(M* model, const G4String& placement,
+		   const G4String& cmdName="add")
+  :G4ModelCmdApplyInteger<M>(model, placement, cmdName)
+  {
+    G4ModelCmdApplyInteger<M>::Command()->SetGuidance("Add command");    
+  }
+  
+  virtual ~G4ModelCmdAddInt() {}
+
+protected:
+
+  virtual void Apply(const G4int& newValue) {
+    G4VModelCommand<M>::Model()->Add(newValue);
+  }
+  
+};
+
+////////////////////////////////////////////////////////////////////////
+// Invert command
+template <typename M>
+class G4ModelCmdInvert : public G4ModelCmdApplyBool<M> {
+  
+public: // With description
+  
+  G4ModelCmdInvert(M* model, const G4String& placement,
+		   const G4String& cmdName="invert")
+    :G4ModelCmdApplyBool<M>(model, placement, cmdName)
+  {
+    G4ModelCmdApplyBool<M>::Command()->SetGuidance("Invert command");
+  }
+
+  virtual ~G4ModelCmdInvert() {}
+
+protected:
+
+  virtual void Apply(const G4bool& newValue) {
+    G4VModelCommand<M>::Model()->SetInvert(newValue);
+  }
+
+};
+
+////////////////////////////////////////////////////////////////////////
+// Active command
+template <typename M>
+class G4ModelCmdActive : public G4ModelCmdApplyBool<M> {
+
+public: // With description
+
+  G4ModelCmdActive(M* model, const G4String& placement,
+		   const G4String& cmdName="active")
+    :G4ModelCmdApplyBool<M>(model, placement, cmdName)
+  {
+    G4ModelCmdApplyBool<M>::Command()->SetGuidance("Active command");
+  }
+  
+  virtual ~G4ModelCmdActive() {}
+
+protected:
+
+  virtual void Apply(const G4bool& newValue) {
+    G4VModelCommand<M>::Model()->SetActive(newValue);
+  }
+
+};
+
+////////////////////////////////////////////////////////////////////////
+// Verbose command
+template <typename M>
+class G4ModelCmdVerbose : public G4ModelCmdApplyBool<M> {
+
+public: // With description
+
+  G4ModelCmdVerbose(M* model, const G4String& placement,
+		    const G4String& cmdName="verbose")
+    :G4ModelCmdApplyBool<M>(model, placement, cmdName)
+  {
+    G4ModelCmdApplyBool<M>::Command()->SetGuidance("Verbose command");
+  }
+
+  virtual ~G4ModelCmdVerbose() {}
+
+protected:
+
+  virtual void Apply(const G4bool& newValue) {
+    G4VModelCommand<M>::Model()->SetVerbose(newValue);
+  }
+
+};
+
+////////////////////////////////////////////////////////////////////////
+// Reset command
+template <typename M>
+class G4ModelCmdReset : public G4ModelCmdApplyNull<M> {
+
+public: // With description
+
+  G4ModelCmdReset(M* model, const G4String& placement,
+			    const G4String& cmdName="reset") 
+    :G4ModelCmdApplyNull<M>(model, placement, cmdName)
+  {
+    G4ModelCmdApplyNull<M>::Command()->SetGuidance("Reset command");    
+  }
+  
+  virtual ~G4ModelCmdReset() {}
+  
+protected:
+
+  virtual void Apply() {
+    G4VModelCommand<M>::Model()->Reset();
+  }
+ 
+};
+
+////////////////////////////////////////////////////////////////////////
+// Set auxiliary points colour command
+template <typename M>
+class G4ModelCmdSetAuxPtsColour : public G4ModelCmdApplyColour<M> {
+  
+public:
+
+  G4ModelCmdSetAuxPtsColour(M* model, const G4String& placement,
+			    const G4String& cmdName="setAuxPtsColour") 
+    :G4ModelCmdApplyColour<M>(model, placement, cmdName) {}
+
+protected:
+
+  void Apply(const G4Colour& colour) {
+    G4VModelCommand<M>::Model()->SetAuxPtsColour(colour);
+  }
+  
+};
+
+////////////////////////////////////////////////////////////////////////
+// Set set points colour command
+template <typename M>
+class G4ModelCmdSetStepPtsColour : public G4ModelCmdApplyColour<M> {
+  
+public:
+
+  G4ModelCmdSetStepPtsColour(M* model, const G4String& placement,
+			     const G4String& cmdName="setStepPtsColour")
+    :G4ModelCmdApplyColour<M>(model, placement, cmdName) {}
+
+protected:
+  
+  void Apply(const G4Colour& colour) {
+    G4VModelCommand<M>::Model()->SetStepPtsColour(colour);
+  }
+  
+};
+
+////////////////////////////////////////////////////////////////////////
+// Set draw line command
+template <typename M>
+class G4ModelCmdSetDrawLine : public G4ModelCmdApplyBool<M> {
+  
+public:
+
+  G4ModelCmdSetDrawLine(M* model, const G4String& placement,
+			const G4String& cmdName="setDrawLine")    
+    :G4ModelCmdApplyBool<M>(model, placement, cmdName)
+  {
+    G4ModelCmdApplyBool<M>::Command()->SetGuidance("Set draw line command");
+  }
+  
+protected:
+
+  void Apply(const G4bool& myBool) {
+    G4VModelCommand<M>::Model()->SetDrawLine(myBool);
+  }
+  
+};
+
+////////////////////////////////////////////////////////////////////////
+// Set line visibility command
+template <typename M>
+class G4ModelCmdSetLineVisible : public G4ModelCmdApplyBool<M> {
+  
+public:
+
+  G4ModelCmdSetLineVisible(M* model, const G4String& placement,
+			   const G4String& cmdName="setLineVisible") 
+    :G4ModelCmdApplyBool<M>(model, placement, cmdName)
+  {
+    G4ModelCmdApplyBool<M>::Command()->SetGuidance("Set line visibility command");
+  }
+  
+protected:
+
+   void Apply(const G4bool& myBool) {
+     G4VModelCommand<M>::Model()->SetLineVisible(myBool);
+  }
+  
+};
+
+////////////////////////////////////////////////////////////////////////
+// Set draw auxiliary points command
+template <typename M>
+class G4ModelCmdSetDrawAuxPts : public G4ModelCmdApplyBool<M> {
+  
+public:
+
+  G4ModelCmdSetDrawAuxPts(M* model, const G4String& placement,
+			  const G4String& cmdName="setDrawAuxPts")
+    :G4ModelCmdApplyBool<M>(model, placement, cmdName)
+  {
+    G4ModelCmdApplyBool<M>::Command()->SetGuidance("Set draw auxiliary points command");
+  }
+  
+protected:
+
+   void Apply(const G4bool& myBool) {
+     G4VModelCommand<M>::Model()->SetDrawAuxPts(myBool);
+  }
+  
+};
+
+////////////////////////////////////////////////////////////////////////
+// Set auxiliary points visibility
+template <typename M>
+class G4ModelCmdSetAuxPtsVisible : public G4ModelCmdApplyBool<M> {
+  
+public:
+
+  G4ModelCmdSetAuxPtsVisible(M* model, const G4String& placement,
+			     const G4String& cmdName="setAuxPtsVisible")
+    :G4ModelCmdApplyBool<M>(model, placement, cmdName)
+  {
+    G4ModelCmdApplyBool<M>::Command()->SetGuidance("Set auxiliary points visibility command");
+  }
+  
+protected:
+
+   void Apply(const G4bool& myBool) {
+     G4VModelCommand<M>::Model()->SetAuxPtsVisible(myBool);
+  }
+  
+};
+
+////////////////////////////////////////////////////////////////////////
+// Set draw step points command
+template <typename M>
+class G4ModelCmdSetDrawStepPts : public G4ModelCmdApplyBool<M> {
+  
+public:
+
+  G4ModelCmdSetDrawStepPts(M* model, const G4String& placement,
+			   const G4String& cmdName="setDrawStepPts")
+    :G4ModelCmdApplyBool<M>(model, placement, cmdName)
+  {
+    G4ModelCmdApplyBool<M>::Command()->SetGuidance("Set draw step points command");
+  }
+  
+protected:
+  
+   void Apply(const G4bool& myBool) {
+     G4VModelCommand<M>::Model()->SetDrawStepPts(myBool);
+  }
+  
+};
+
+////////////////////////////////////////////////////////////////////////
+// Set step points visible command
+template <typename M>
+class G4ModelCmdSetStepPtsVisible : public G4ModelCmdApplyBool<M> {
+  
+public:
+
+  G4ModelCmdSetStepPtsVisible(M* model, const G4String& placement,
+			      const G4String& cmdName="setStepPtsVisible")
+    :G4ModelCmdApplyBool<M>(model, placement, cmdName)
+  {
+    G4ModelCmdApplyBool<M>::Command()->SetGuidance("Set step points visible command");
+  }
+  
+protected:
+
+   void Apply(const G4bool& myBool) {
+     G4VModelCommand<M>::Model()->SetStepPtsVisible(myBool);
+  }
+  
+};
+
+////////////////////////////////////////////////////////////////////////
+// Set auxiliary points size command
+template <typename M>
+class G4ModelCmdSetAuxPtsSize : public G4ModelCmdApplyString<M> {
+  
+public:
+
+  G4ModelCmdSetAuxPtsSize(M* model, const G4String& placement,
+			   const G4String& cmdName="setAuxPtsSize")
+    :G4ModelCmdApplyString<M>(model, placement, cmdName)
+  {
+    G4ModelCmdApplyString<M>::Command()->SetGuidance("Set auxiliary points size command");
+  }
+  
+protected:
+
+   void Apply(const G4String& sizeString) {
+     std::istringstream iss(sizeString);
+     G4double size;
+     G4String unit;
+     iss >> size >> unit;
+     if (G4VModelCommand<M>::Model()->GetAuxPtsSizeType() == G4VMarker::world)
+       {
+	 G4double myDouble = G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(sizeString);
+	 G4VModelCommand<M>::Model()->SetAuxPtsSize(myDouble);
+       }
+     else  // none or screen
+       {
+	 G4VModelCommand<M>::Model()->SetAuxPtsSize(size);
+       }
+   }
+  
+};
+
+////////////////////////////////////////////////////////////////////////
+// Set step points size command
+template <typename M>
+class G4ModelCmdSetStepPtsSize : public G4ModelCmdApplyString<M> {
+  
+public:
+
+  G4ModelCmdSetStepPtsSize(M* model, const G4String& placement,
+			   const G4String& cmdName="setStepPtsSize")
+    :G4ModelCmdApplyString<M>(model, placement, cmdName)
+  {
+    G4ModelCmdApplyString<M>::Command()->SetGuidance("Set step points size command");
+  }
+  
+protected:
+
+   void Apply(const G4String& sizeString) {
+     std::istringstream iss(sizeString);
+     G4double size;
+     G4String unit;
+     iss >> size >> unit;
+     if (G4VModelCommand<M>::Model()->GetStepPtsSizeType() == G4VMarker::world)
+       {
+	 G4double myDouble = G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(sizeString);
+	 G4VModelCommand<M>::Model()->SetStepPtsSize(myDouble);
+       }
+     else  // none or screen
+       {
+	 G4VModelCommand<M>::Model()->SetStepPtsSize(size);
+       }
+   }
+  
+};
+
+////////////////////////////////////////////////////////////////////////
+// Set step points type command
+template <typename M>
+class G4ModelCmdSetStepPtsType : public G4ModelCmdApplyString<M> {
+  
+public:
+
+  G4ModelCmdSetStepPtsType(M* model, const G4String& placement,
+			   const G4String& cmdName="setStepPtsType")
+    :G4ModelCmdApplyString<M>(model, placement, cmdName)
+  {
+    G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command();
+    cmd->SetGuidance("Set step points type.");
+    cmd->SetCandidates("dots circles squares");
+  }
+  
+protected:
+
+  void Apply(const G4String& type) {
+    G4Polymarker::MarkerType myType;
+    
+    if (type == "dots") {myType = G4Polymarker::dots;}
+    else if (type == "circles") {myType = G4Polymarker::circles;}
+    else if (type == "squares") {myType = G4Polymarker::squares;}
+    else {
+      std::ostringstream o;
+      o << "Invalid argument. See command guidance for options.";
+      G4Exception
+	("G4ModelCmdSetStepPtsType::Apply",
+	 "InvalidArgument", JustWarning, o.str().c_str());
+      return;
+    }
+    G4VModelCommand<M>::Model()->SetStepPtsType(myType);
+  }
+  
+};
+
+////////////////////////////////////////////////////////////////////////
+// Set auxiliary points type command
+template <typename M>
+class G4ModelCmdSetAuxPtsType : public G4ModelCmdApplyString<M> {
+  
+public:
+  
+  G4ModelCmdSetAuxPtsType(M* model, const G4String& placement,
+			  const G4String& cmdName="setAuxPtsType")
+    :G4ModelCmdApplyString<M>(model, placement, cmdName)
+  {
+    G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command();
+
+    cmd->SetGuidance("Set auxiliary points type.");
+    cmd->SetCandidates("dots circles squares");
+  }
+  
+protected:
+  
+  void Apply(const G4String& type) {
+    G4Polymarker::MarkerType myType;
+    
+    if (type == "dots") {myType = G4Polymarker::dots;}
+    else if (type == "circles") {myType = G4Polymarker::circles;}
+    else if (type == "squares") {myType = G4Polymarker::squares;}
+    else {
+      std::ostringstream o;
+      o << "Invalid argument. See command guidance for options.";
+      G4Exception
+	("G4ModelCmdSetAuxPtsType::Apply",
+	 "InvalidArgument", JustWarning, o.str().c_str());
+      return;
+    }
+    
+    G4VModelCommand<M>::Model()->SetAuxPtsType(myType);
+  }
+  
+};
+
+////////////////////////////////////////////////////////////////////////
+// Set step points size type command
+template <typename M>
+class G4ModelCmdSetStepPtsSizeType : public G4ModelCmdApplyString<M> {
+  
+public:
+
+  G4ModelCmdSetStepPtsSizeType(M* model, const G4String& placement,
+				const G4String& cmdName="setStepPtsSizeType")
+    :G4ModelCmdApplyString<M>(model, placement, cmdName)
+  {
+    G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command();
+    cmd->SetGuidance("Set step size type.");
+    cmd->SetCandidates("none world screen");
+  }
+  
+protected:
+
+  void Apply(const G4String& type) {
+    G4VMarker::SizeType mySizeType;
+    
+    if (type == "none") {mySizeType = G4VMarker::none;}
+    else if (type == "world") {mySizeType = G4VMarker::world;}
+    else if (type == "screen") {mySizeType = G4VMarker::screen;}
+    else {
+      std::ostringstream o;
+      o << "Invalid argument. See command guidance for options.";
+      G4Exception
+	("G4ModelCmdSetStepPtsSizeType::Apply",
+	 "InvalidArgument", JustWarning, o.str().c_str());
+      return;
+    }
+    G4VModelCommand<M>::Model()->SetStepPtsSizeType(mySizeType);
+  }
+  
+};
+
+////////////////////////////////////////////////////////////////////////
+// Set auxiliary points size type command
+template <typename M>
+class G4ModelCmdSetAuxPtsSizeType : public G4ModelCmdApplyString<M> {
+  
+public:
+
+  G4ModelCmdSetAuxPtsSizeType(M* model, const G4String& placement,
+			       const G4String& cmdName="setAuxPtsSizeType")
+    :G4ModelCmdApplyString<M>(model, placement, cmdName)
+  {
+    G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command();
+    cmd->SetGuidance("Set auxiliary size type.");
+    cmd->SetCandidates("none world screen");
+  }
+  
+protected:
+
+  void Apply(const G4String& type) {
+    G4VMarker::SizeType mySizeType;
+    
+    if (type == "none") {mySizeType = G4VMarker::none;}
+    else if (type == "world") {mySizeType = G4VMarker::world;}
+    else if (type == "screen") {mySizeType = G4VMarker::screen;}
+    else {
+      std::ostringstream o;
+      o << "Invalid argument. See command guidance for options.";
+      G4Exception
+	("G4ModelCmdSetAuxPtsSizeType::Apply",
+	 "InvalidArgument", JustWarning, o.str().c_str());
+      return;
+    }
+    G4VModelCommand<M>::Model()->SetAuxPtsSizeType(mySizeType);
+  }
+  
+};
+
+////////////////////////////////////////////////////////////////////////
+// Set step points fill style command
+template <typename M>
+class G4ModelCmdSetStepPtsFillStyle : public G4ModelCmdApplyString<M> {
+  
+public:
+
+  G4ModelCmdSetStepPtsFillStyle(M* model, const G4String& placement,
+				const G4String& cmdName="setStepPtsFillStyle")
+    :G4ModelCmdApplyString<M>(model, placement, cmdName)
+  {
+    G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command();
+    cmd->SetGuidance("Set step fill style type.");
+    cmd->SetCandidates("noFill hashed filled");
+  }
+  
+protected:
+
+  void Apply(const G4String& type) {
+    G4VMarker::FillStyle myFillStyle;
+    
+    if (type == "noFill") {myFillStyle = G4VMarker::noFill;}
+    else if (type == "hashed") {myFillStyle = G4VMarker::hashed;}
+    else if (type == "filled") {myFillStyle = G4VMarker::filled;}
+    else {
+      std::ostringstream o;
+      o << "Invalid argument. See command guidance for options.";
+      G4Exception
+	("G4ModelCmdSetStepPtsFillStyle::Apply",
+	 "InvalidArgument", JustWarning, o.str().c_str());
+      return;
+    }
+    G4VModelCommand<M>::Model()->SetStepPtsFillStyle(myFillStyle);
+  }
+  
+};
+
+////////////////////////////////////////////////////////////////////////
+// Set auxiliary points fill style command
+template <typename M>
+class G4ModelCmdSetAuxPtsFillStyle : public G4ModelCmdApplyString<M> {
+  
+public:
+
+  G4ModelCmdSetAuxPtsFillStyle(M* model, const G4String& placement,
+			       const G4String& cmdName="setAuxPtsFillStyle")
+    :G4ModelCmdApplyString<M>(model, placement, cmdName)
+  {
+    G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command();
+    cmd->SetGuidance("Set auxiliary fill style.");
+    cmd->SetCandidates("noFill hashed filled");
+  }
+  
+protected:
+
+  void Apply(const G4String& type) {
+    G4VMarker::FillStyle myFillStyle;
+    
+    if (type == "noFill") {myFillStyle = G4VMarker::noFill;}
+    else if (type == "hashed") {myFillStyle = G4VMarker::hashed;}
+    else if (type == "filled") {myFillStyle = G4VMarker::filled;}
+    else {
+      std::ostringstream o;
+      o << "Invalid argument. See command guidance for options.";
+      G4Exception
+	("G4ModelCmdSetAuxPtsFillStyle::Apply",
+	 "InvalidArgument", JustWarning, o.str().c_str());
+      return;
+    }
+    G4VModelCommand<M>::Model()->SetAuxPtsFillStyle(myFillStyle);
+  }
+  
+};
+
+////////////////////////////////////////////////////////////////////////
+// SetLineColour command
+template <typename M>
+class G4ModelCmdSetLineColour : public G4ModelCmdApplyColour<M> {
+  
+public:
+
+  G4ModelCmdSetLineColour(M* model, const G4String& placement,
+			  const G4String& cmdName="""setLineColour")
+    :G4ModelCmdApplyColour<M>(model, placement, cmdName){}
+  
+protected:
+
+  void Apply(const G4Colour& colour) {
+    G4VModelCommand<M>::Model()->SetLineColour(colour);
+  }
+  
+};
+
+////////////////////////////////////////////////////////////////////////
+// Set time slice interval command
+template <typename M>
+class G4ModelCmdSetTimeSliceInterval : public G4ModelCmdApplyDoubleAndUnit<M> {
+
+public:
+
+  G4ModelCmdSetTimeSliceInterval(M* model, const G4String& placement,
+				 const G4String& cmdName = "setTimeSliceInterval")
+    :G4ModelCmdApplyDoubleAndUnit<M>(model, placement, cmdName)
+  {
+    G4UIcmdWithADoubleAndUnit* cmd = G4ModelCmdApplyDoubleAndUnit<M>::Command();
+    cmd->SetGuidance
+      ("Set time slice interval.  Give unit, e.g., \"0.1 ns\"");
+    cmd->SetUnitCategory("Time");
+  }
+
+protected:
+
+   void Apply(const G4double& myDouble) {
+     G4VModelCommand<M>::Model()->SetTimeSliceInterval(myDouble);
+  }
+
+};
+
+////////////////////////////////////////////////////////////////////////
+// Create context directory command
+template <typename M>
+class G4ModelCmdCreateContextDir : public G4UImessenger {
+  
+public:
+
+  G4ModelCmdCreateContextDir(M* model, const G4String& placement) 
+  {
+    G4String title = placement+"/"+model->Name()+"/";
+    cmd = new G4UIdirectory(title);
+    
+    cmd->SetGuidance("Commands for default configuration");
+  }
+
+  virtual ~G4ModelCmdCreateContextDir() {
+    delete cmd;
+  }
+
+protected:
+
+  G4UIdirectory* cmd;
+  
+};
+
+////////////////////////////////////////////////////////////////////////
+// Draw command
+template <typename M>
+class G4ModelCmdDraw : public G4ModelCmdApplyBool<M> {
+
+public: // With description
+
+  G4ModelCmdDraw(M* model, const G4String& placement,
+		 const G4String& cmdName="draw")
+    :G4ModelCmdApplyBool<M>(model, placement, cmdName)
+  {
+    G4ModelCmdApplyBool<M>::Command()->SetGuidance("Draw command");
+  }
+
+  virtual ~G4ModelCmdDraw() {}
+
+protected:
+
+  virtual void Apply(const G4bool& newValue) {
+    if (newValue) G4VModelCommand<M>::Model()->Draw();
+  }
+
+};
+
+////////////////////////////////////////////////////////////////////////
+// Set interval
+template <typename M>
+class G4ModelCmdAddInterval : public G4ModelCmdApplyString<M> {
+
+public: // With description
+
+  G4ModelCmdAddInterval(M* model, const G4String& placement, 
+			const G4String& cmdName="addInterval")
+    :G4ModelCmdApplyString<M>(model, placement, cmdName) 
+  {
+    G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command();
+    cmd->SetGuidance("Set interval.");
+  }
+  
+  virtual ~G4ModelCmdAddInterval() {}
+
+protected:
+
+  virtual void Apply(const G4String& param) {
+    G4VModelCommand<M>::Model()->AddInterval(param);
+
+  }
+};
+
+////////////////////////////////////////////////////////////////////////
+// Set value
+template <typename M>
+class G4ModelCmdAddValue : public G4ModelCmdApplyString<M> {
+
+public: // With description
+
+  G4ModelCmdAddValue(M* model, const G4String& placement, 
+		     const G4String& cmdName="addValue")
+    :G4ModelCmdApplyString<M>(model, placement, cmdName) 
+  {
+    G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command();
+    cmd->SetGuidance("Set value.");
+  }
+  
+  virtual ~G4ModelCmdAddValue() {}
+protected:
+
+  virtual void Apply(const G4String& param) {
+    G4VModelCommand<M>::Model()->AddValue(param);
+
+  }
+};
+
+////////////////////////////////////////////////////////////////////////
+// Set string command
+template <typename M>
+class G4ModelCmdSetString : public G4ModelCmdApplyString<M> {
+
+public: // With description
+
+  G4ModelCmdSetString(M* model, const G4String& placement, 
+		      const G4String& cmdName="set")
+    :G4ModelCmdApplyString<M>(model, placement, cmdName) 
+  {
+    G4ModelCmdApplyString<M>::Command()->SetGuidance("Set command");
+  }
+
+  virtual ~G4ModelCmdSetString() {}
+
+protected:
+  
+  virtual void Apply(const G4String& newValue) {
+    G4VModelCommand<M>::Model()->Set(newValue);
+  }
+  
+};
+
+#endif      
Index: tags/visualization-10.5-before-10.6_test/modeling/include/G4ModelCompoundCommandsT.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/include/G4ModelCompoundCommandsT.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/include/G4ModelCompoundCommandsT.hh	(revision 1102)
@@ -0,0 +1,141 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4ModelCompoundCommandsT.hh,v 1.1 2006/09/11 21:52:18 tinslay Exp $
+// GEANT4 tag $Name:  $
+//
+// Jane Tinslay September 2006
+//
+// Compound model commands.
+//
+#ifndef G4MODELCOMPOUNDCOMMANDST_HH
+#define G4MODELCOMPOUNDCOMMANDST_HH
+
+#include "G4ModelApplyCommandsT.hh"
+#include "G4ModelCommandUtils.hh"
+#include "G4ModelCommandsT.hh"
+#include "G4String.hh"
+
+////////////////////////////////////////////////////////////////////////
+// Set interval context
+template <typename M>
+class G4ModelCmdAddIntervalContext: public G4ModelCmdApplyString<M> {
+
+public: // With description
+
+  G4ModelCmdAddIntervalContext(M* model, const G4String& placement, 
+			    const G4String& cmdName="addInterval")
+    :G4ModelCmdApplyString<M>(model, placement, cmdName) 
+  {
+    G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command();
+    cmd->SetGuidance("Add interval.");
+  }
+  
+  virtual ~G4ModelCmdAddIntervalContext() {
+    std::vector<G4UImessenger*>::iterator iter = fMessengers.begin();
+    
+    while (iter != fMessengers.end()) {
+      delete *iter;
+      iter++;
+    }
+  }
+  
+protected:
+  
+  virtual void Apply(const G4String& param) {
+    G4String myString(param);
+
+    G4String name;
+    std::istringstream is(param);
+    
+    is >> name;
+
+    myString.erase(0, name.size());
+
+    G4String dir = G4VModelCommand<M>::Placement()+"/"+G4VModelCommand<M>::Model()->Name();
+    
+    G4VisTrajContext* context = new G4VisTrajContext(name);
+    
+    G4ModelCommandUtils::AddContextMsgrs(context, fMessengers, dir);
+    G4VModelCommand<M>::Model()->AddIntervalContext(myString, context);
+  }
+
+private:
+  
+  std::vector<G4UImessenger*> fMessengers;
+
+};
+
+////////////////////////////////////////////////////////////////////////
+// Set value context
+template <typename M>
+class G4ModelCmdAddValueContext: public G4ModelCmdApplyString<M> {
+
+public: // With description
+
+  G4ModelCmdAddValueContext(M* model, const G4String& placement, 
+			    const G4String& cmdName="addValue")
+    :G4ModelCmdApplyString<M>(model, placement, cmdName) 
+  {
+    G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command();
+    cmd->SetGuidance("Add value.");
+  }
+  
+  virtual ~G4ModelCmdAddValueContext() {
+    std::vector<G4UImessenger*>::iterator iter = fMessengers.begin();
+    
+    while (iter != fMessengers.end()) {
+      delete *iter;
+      iter++;
+    }
+  }
+
+protected:
+
+  virtual void Apply(const G4String& param) {
+    G4String myString(param);
+
+    G4String name;
+    std::istringstream is(param);
+    
+    is >> name;
+
+    myString.erase(0, name.size());
+
+    G4String dir = G4VModelCommand<M>::Placement()+"/"+G4VModelCommand<M>::Model()->Name();
+    
+    G4VisTrajContext* context = new G4VisTrajContext(name);
+    
+    G4ModelCommandUtils::AddContextMsgrs(context, fMessengers, dir);
+    G4VModelCommand<M>::Model()->AddValueContext(myString, context);
+  }
+
+private:
+  
+  std::vector<G4UImessenger*> fMessengers;
+
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/modeling/include/G4ModelingParameters.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/include/G4ModelingParameters.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/include/G4ModelingParameters.hh	(revision 1102)
@@ -0,0 +1,135 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4ModelingParameters.hh,v 1.17 2006/11/14 14:42:08 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  31st December 1997.
+//
+// Class Description:
+//
+// Parameters associated with the modeling of GEANT4 objects.
+
+#ifndef G4MODELINGPARAMETERS_HH
+#define G4MODELINGPARAMETERS_HH
+
+#include "globals.hh"
+#include "G4VisExtent.hh"
+
+class G4LogicalVolume;
+class G4VPhysicalVolume;
+class G4VisAttributes;
+class G4Polyhedron;
+class G4Event;
+
+class G4ModelingParameters {
+
+public: // With description
+
+  friend std::ostream& operator << (std::ostream& os, const G4ModelingParameters&);
+
+  enum DrawingStyle {
+    wf,         // Draw edges    - no hidden line removal (wireframe).
+    hlr,        // Draw edges    - hidden lines removed.
+    hsr,        // Draw surfaces - hidden surfaces removed.
+    hlhsr       // Draw surfaces and edges - hidden removed.
+  };
+  // Currently requested drawing style.
+
+  G4ModelingParameters ();
+
+  G4ModelingParameters (const G4VisAttributes* pDefaultVisAttributes,
+                        DrawingStyle drawingStyle,
+			G4bool isCulling,
+			G4bool isCullingInvisible,
+			G4bool isDensityCulling,
+			G4double visibleDensity,
+			G4bool isCullingCovered,
+			G4int noOfSides);
+  // Culling and clipping policy for G4PhysicalVolumeModel.
+
+  ~G4ModelingParameters ();
+
+  // Note: uses default assignment operator and copy constructor.
+
+  G4bool operator != (const G4ModelingParameters&) const;
+
+  // Get and Is functions...
+  G4bool           IsWarning                     () const;
+  const G4VisAttributes* GetDefaultVisAttributes () const;
+  DrawingStyle     GetDrawingStyle               () const;
+  G4bool           IsCulling                     () const;
+  G4bool           IsCullingInvisible            () const;
+  G4bool           IsDensityCulling              () const;
+  G4double         GetVisibleDensity             () const;
+  G4bool           IsCullingCovered              () const;
+  G4bool           IsExplode                     () const;
+  G4double         GetExplodeFactor              () const;
+  const G4Point3D& GetExplodeCentre              () const;
+  G4int            GetNoOfSides                  () const;
+  const G4Polyhedron* GetSectionPolyhedron       () const;
+  const G4Polyhedron* GetCutawayPolyhedron       () const;
+  const G4Event*   GetEvent                      () const;
+
+  // Set functions...
+  void SetWarning              (G4bool);
+  void SetDefaultVisAttributes (const G4VisAttributes* pDefaultVisAttributes);
+  void SetDrawingStyle         (DrawingStyle);
+  void SetCulling              (G4bool);
+  void SetCullingInvisible     (G4bool);
+  void SetDensityCulling       (G4bool);
+  void SetVisibleDensity       (G4double);
+  void SetCullingCovered       (G4bool);
+  void SetExplodeFactor        (G4double explodeFactor);
+  void SetExplodeCentre        (const G4Point3D& explodeCentre);
+  G4int SetNoOfSides           (G4int);  // Returns actual number set.
+  void SetSectionPolyhedron    (const G4Polyhedron* pSectionPolyhedron);
+  void SetCutawayPolyhedron    (const G4Polyhedron* pCutawayPolyhedron);
+  void SetEvent                (const G4Event* pEvent);
+
+private:
+
+  // Data members...
+  G4bool       fWarning;         // Print warnings if true.
+  const G4VisAttributes* fpDefaultVisAttributes;
+  DrawingStyle fDrawingStyle;    // Drawing style.
+  G4bool       fCulling;         // Culling requested.
+  G4bool       fCullInvisible;   // Cull (don't Draw) invisible objects.
+  G4bool       fDensityCulling;  // Density culling requested.  If so...
+  G4double     fVisibleDensity;  // ...density lower than this not drawn.
+  G4bool       fCullCovered;     // Cull daughters covered by opaque mothers.
+  G4double     fExplodeFactor;   // Explode along radius by this factor...
+  G4Point3D    fExplodeCentre;   // ...about this centre.
+  G4int        fNoOfSides;       // ...if polygon approximates circle.
+  const G4Polyhedron* fpSectionPolyhedron;  // For generic section (DCUT).
+  const G4Polyhedron* fpCutawayPolyhedron;  // For generic cutaways.
+  const G4Event* fpEvent;        // Event being processed.
+};
+
+#include "G4ModelingParameters.icc"
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/modeling/include/G4ModelingParameters.icc
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/include/G4ModelingParameters.icc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/include/G4ModelingParameters.icc	(revision 1102)
@@ -0,0 +1,145 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4ModelingParameters.icc,v 1.11 2006/11/14 14:42:08 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  31st December 1997.
+// Parameters associated with the modeling of GEANT4 objects.
+
+inline G4bool G4ModelingParameters::IsWarning () const {
+  return fWarning;
+}
+
+inline const G4VisAttributes*
+G4ModelingParameters::GetDefaultVisAttributes () const {
+  return fpDefaultVisAttributes;
+}
+
+inline G4ModelingParameters::DrawingStyle
+G4ModelingParameters::GetDrawingStyle () const {
+  return fDrawingStyle;
+}
+
+inline G4bool G4ModelingParameters::IsCulling () const {
+  return fCulling;
+}
+
+inline G4bool G4ModelingParameters::IsCullingInvisible () const {
+  return fCullInvisible;
+}
+
+inline G4bool G4ModelingParameters::IsDensityCulling () const {
+  return fDensityCulling;
+}
+
+inline G4double G4ModelingParameters::GetVisibleDensity () const {
+  return fVisibleDensity;
+}
+
+inline G4bool G4ModelingParameters::IsCullingCovered () const {
+  return fCullCovered;
+}
+
+inline G4bool G4ModelingParameters::IsExplode () const {
+  return fExplodeFactor > 1.;
+}
+
+inline G4double G4ModelingParameters::GetExplodeFactor () const {
+  return fExplodeFactor;
+}
+
+inline const G4Point3D& G4ModelingParameters::GetExplodeCentre () const {
+  return fExplodeCentre;
+}
+
+inline G4int G4ModelingParameters::GetNoOfSides () const {
+  return fNoOfSides;
+}
+
+inline const G4Polyhedron* G4ModelingParameters::GetSectionPolyhedron () const
+{return fpSectionPolyhedron;}
+
+inline const G4Polyhedron* G4ModelingParameters::GetCutawayPolyhedron () const
+{return fpCutawayPolyhedron;}
+
+inline const G4Event* G4ModelingParameters::GetEvent () const
+{return fpEvent;}
+
+inline void G4ModelingParameters::SetWarning (G4bool value) {
+  fWarning = value;
+}
+
+inline void G4ModelingParameters::SetDefaultVisAttributes
+(const G4VisAttributes* pDefaultVisAttributes) {
+  fpDefaultVisAttributes = pDefaultVisAttributes;
+}
+
+inline void
+G4ModelingParameters::SetDrawingStyle
+(G4ModelingParameters::DrawingStyle style) {
+  fDrawingStyle = style;
+}
+
+inline void G4ModelingParameters::SetCulling (G4bool value) {
+  fCulling = value;
+}
+
+inline void G4ModelingParameters::SetCullingInvisible (G4bool value) {
+  fCullInvisible = value;
+}
+
+inline void G4ModelingParameters::SetDensityCulling (G4bool value) {
+  fDensityCulling = value;
+}
+
+inline void G4ModelingParameters::SetCullingCovered (G4bool value) {
+  fCullCovered = value;
+}
+
+inline void G4ModelingParameters::SetExplodeFactor (G4double explodeFactor) {
+  fExplodeFactor = explodeFactor;
+}
+
+inline void G4ModelingParameters::SetExplodeCentre
+(const G4Point3D& explodeCentre) {
+  fExplodeCentre = explodeCentre;
+}
+
+inline void G4ModelingParameters::SetSectionPolyhedron
+(const G4Polyhedron* pSectionPolyhedron) {
+  fpSectionPolyhedron = pSectionPolyhedron;
+}
+
+inline void G4ModelingParameters::SetCutawayPolyhedron
+(const G4Polyhedron* pCutawayPolyhedron) {
+  fpCutawayPolyhedron = pCutawayPolyhedron;
+}
+
+inline void G4ModelingParameters::SetEvent(const G4Event* pEvent) {
+  fpEvent = pEvent;
+}
Index: tags/visualization-10.5-before-10.6_test/modeling/include/G4NullModel.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/include/G4NullModel.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/include/G4NullModel.hh	(revision 1102)
@@ -0,0 +1,58 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4NullModel.hh,v 1.7 2006/06/29 21:30:30 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  4th April 1998.
+// Null model - simply a holder for modeling parameter.
+// DO NOT INVOKE DescribeYourself.
+
+#ifndef G4NULLMODEL_HH
+#define G4NULLMODEL_HH
+
+#include "G4VModel.hh"
+
+class G4NullModel: public G4VModel {
+
+public:
+
+  G4NullModel (const G4ModelingParameters* = 0);
+
+  virtual ~G4NullModel ();
+
+  void DescribeYourselfTo (G4VGraphicsScene&);
+  // An exception is thrown if this is called!!!!!!!!!!!!!!!!!!!!
+
+  /////////////////////////////////////////////////
+  // Access to other information: use GetModelingParameters()
+  // (inherited from G4VModel) and the access functions of
+  // G4ModelingParameters.
+
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/modeling/include/G4PhysicalVolumeMassScene.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/include/G4PhysicalVolumeMassScene.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/include/G4PhysicalVolumeMassScene.hh	(revision 1102)
@@ -0,0 +1,140 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4PhysicalVolumeMassScene.hh,v 1.9 2008/01/04 21:59:15 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  12th September 2004
+
+// Class Description:
+//
+// Calculates the mass of a geometry tree taking into account daughters
+// up to the depth specified in the G4PhysicalVolumeModel.  Culling is
+// ignored so that all volumes are seen.
+//
+// Do not use this for a "parallel world" for which materials are not
+// defined.  Use only for the material world.
+//
+// The calculation is quite tricky, since it involves subtracting the
+// mass of that part of the mother that is occupied by each daughter and
+// then adding the mass of the daughter, and so on down the heirarchy.
+//
+// Usage for a given G4PhysicalVolumeModel* pvModel:
+//   G4PhysicalVolumeMassScene massScene(pvModel);
+//   pvModel->DescribeYourselfTo (massScene);
+//   G4double volume = massScene.GetVolume();
+//   G4double mass = massScene.GetMass();
+//   massScene.Reset();
+// See, for example, G4ASCIITreeSceneHandler::EndModeling().
+
+#ifndef G4PHYSICALVOLUMEMASSSCENE_HH
+#define G4PHYSICALVOLUMEMASSSCENE_HH
+
+#include "G4VGraphicsScene.hh"
+
+#include "G4Box.hh"
+#include "G4Cons.hh"
+#include "G4Tubs.hh"
+#include "G4Trd.hh"
+#include "G4Trap.hh"
+#include "G4Sphere.hh"
+#include "G4Para.hh"
+#include "G4Torus.hh"
+#include "G4Polycone.hh"
+#include "G4Polyhedra.hh"
+#include <deque>
+
+class G4VPhysicalVolume;
+class G4LogicalVolume;
+class G4PhysicalVolumeModel;
+class G4Material;
+
+class G4PhysicalVolumeMassScene: public G4VGraphicsScene {
+
+public:
+  G4PhysicalVolumeMassScene (G4PhysicalVolumeModel*);
+  virtual ~G4PhysicalVolumeMassScene ();
+
+public: // With description
+
+  G4double GetVolume () const {return fVolume;}
+  // Overall volume.
+
+  G4double GetMass () const {return fMass;}
+  // Mass of whole tree, i.e., accounting for all daughters.
+
+  void Reset ();
+  // Reset for subsequent re-use.
+
+public:
+
+  // Force execution of AccrueMass for all solids...
+  void PreAddSolid (const G4Transform3D&, const G4VisAttributes&) {}
+  void PostAddSolid () {}
+  void AddSolid (const G4Box& s) {AccrueMass (s);}
+  void AddSolid (const G4Cons & s) {AccrueMass (s);}
+  void AddSolid (const G4Tubs& s) {AccrueMass (s);}
+  void AddSolid (const G4Trd& s) {AccrueMass (s);}
+  void AddSolid (const G4Trap& s) {AccrueMass (s);}
+  void AddSolid (const G4Sphere& s) {AccrueMass (s);}
+  void AddSolid (const G4Para& s) {AccrueMass (s);}
+  void AddSolid (const G4Torus& s) {AccrueMass (s);}
+  void AddSolid (const G4Polycone& s) {AccrueMass (s);}
+  void AddSolid (const G4Polyhedra& s) {AccrueMass (s);}
+  void AddSolid (const G4VSolid& s) {AccrueMass (s);}
+  void AddCompound (const G4VTrajectory&) {}
+  void AddCompound (const G4VHit&) {}
+
+  ////////////////////////////////////////////////////////////////
+  // Functions not used but required by the abstract interface.
+
+  virtual void BeginPrimitives (const G4Transform3D&) {}
+  virtual void EndPrimitives () {}
+  virtual void BeginPrimitives2D (const G4Transform3D&) {}
+  virtual void EndPrimitives2D () {}
+  virtual void AddPrimitive (const G4Polyline&)   {}
+  virtual void AddPrimitive (const G4Scale&)      {}
+  virtual void AddPrimitive (const G4Text&)       {}
+  virtual void AddPrimitive (const G4Circle&)     {}
+  virtual void AddPrimitive (const G4Square&)     {}
+  virtual void AddPrimitive (const G4Polymarker&) {}
+  virtual void AddPrimitive (const G4Polyhedron&) {}
+  virtual void AddPrimitive (const G4NURBS&)      {}
+
+private:
+  void AccrueMass (const G4VSolid&);
+  G4PhysicalVolumeModel* fpPVModel;
+  G4double fVolume;
+  G4double fMass;
+  G4VPhysicalVolume* fpLastPV;
+  G4int fPVPCount;
+  G4int fLastDepth;
+  G4double fLastDensity;
+  std::deque<G4double> fDensityStack;
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/modeling/include/G4PhysicalVolumeModel.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/include/G4PhysicalVolumeModel.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/include/G4PhysicalVolumeModel.hh	(revision 1102)
@@ -0,0 +1,226 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4PhysicalVolumeModel.hh,v 1.34 2007/04/03 13:46:49 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  31st December 1997.
+//
+// Class Description:
+//
+// Model for physical volumes.  It describes a physical volume and its
+// daughters to any desired depth.  Note: the "requested depth" is
+// specified in the modeling parameters; enum {UNLIMITED = -1}.
+//
+// For access to base class information, e.g., modeling parameters,
+// use GetModelingParameters() inherited from G4VModel.  See Class
+// Description of the base class G4VModel.
+//
+// G4PhysicalVolumeModel assumes the modeling parameters have been set
+// up with meaningful information - default vis attributes and culling
+// policy in particular.
+
+#ifndef G4PHYSICALVOLUMEMODEL_HH
+#define G4PHYSICALVOLUMEMODEL_HH
+
+#include "G4VModel.hh"
+
+#include "G4Transform3D.hh"
+#include "G4Plane3D.hh"
+#include <iostream>
+#include <vector>
+#include <map>
+
+class G4VPhysicalVolume;
+class G4LogicalVolume;
+class G4VSolid;
+class G4Material;
+class G4VisAttributes;
+class G4Polyhedron;
+class G4AttDef;
+class G4AttValue;
+
+class G4PhysicalVolumeModel: public G4VModel {
+
+public: // With description
+
+  enum {UNLIMITED = -1};
+
+  enum ClippingMode {subtraction, intersection};
+
+  class G4PhysicalVolumeNodeID {
+  public:
+    G4PhysicalVolumeNodeID
+    (G4VPhysicalVolume* pPV = 0, G4int iCopyNo = 0, G4int depth = 0):
+      fpPV(pPV), fCopyNo(iCopyNo), fNonCulledDepth(depth) {}
+    G4VPhysicalVolume* GetPhysicalVolume() const {return fpPV;}
+    G4int GetCopyNo() const {return fCopyNo;}
+    G4int GetNonCulledDepth() const {return fNonCulledDepth;}
+    G4bool operator< (const G4PhysicalVolumeNodeID& right) const;
+  private:
+    G4VPhysicalVolume* fpPV;
+    G4int fCopyNo;
+    G4int fNonCulledDepth;
+  };
+  // Nested class for identifying physical volume nodes.
+
+  G4PhysicalVolumeModel
+  (G4VPhysicalVolume*,
+   G4int requestedDepth = UNLIMITED,
+   const G4Transform3D& modelTransformation = G4Transform3D(),
+   const G4ModelingParameters* = 0,
+   G4bool useFullExtent = false);
+
+  virtual ~G4PhysicalVolumeModel ();
+
+  void DescribeYourselfTo (G4VGraphicsScene&);
+  // The main task of a model is to describe itself to the graphics scene
+  // handler (a object which inherits G4VSceneHandler, which inherits
+  // G4VGraphicsScene).
+
+  G4String GetCurrentDescription () const;
+  // A description which depends on the current state of the model.
+
+  G4String GetCurrentTag () const;
+  // A tag which depends on the current state of the model.
+
+  G4VPhysicalVolume* GetTopPhysicalVolume () const {return fpTopPV;}
+
+  G4int GetRequestedDepth () const {return fRequestedDepth;}
+
+  const G4Polyhedron* GetClippingPolyhedron () const
+  {return fpClippingPolyhedron;}
+
+  G4int GetCurrentDepth() const {return fCurrentDepth;}
+  // Current depth of geom. hierarchy.
+
+  G4VPhysicalVolume* GetCurrentPV() const {return fpCurrentPV;}
+  // Current physical volume.
+
+  G4LogicalVolume* GetCurrentLV() const {return fpCurrentLV;}
+  // Current logical volume.
+
+  G4Material* GetCurrentMaterial() const {return fpCurrentMaterial;}
+  // Current material.
+
+  const std::vector<G4PhysicalVolumeNodeID>& GetDrawnPVPath() const
+  {return fDrawnPVPath;}
+  // Path of the current drawn (non-culled) volume in terms of drawn
+  // (non-culled) ancesters.  It is a vector of physical volume node
+  // identifiers corresponding to the geometry hierarchy actually
+  // selected, i.e., not culled.  It is guaranteed that volumes are
+  // presented to the scene handlers in top-down hierarchy order,
+  // i.e., ancesters first, mothers before daughters, so the scene
+  // handler can be assured that, if it is building its own scene
+  // graph tree, a mother, if any, will have already been encountered
+  // and there will already be a node in place on which to hang the
+  // current volume.
+
+  const std::map<G4String,G4AttDef>* GetAttDefs() const;
+  // Attribute definitions for current solid.
+
+  std::vector<G4AttValue>* CreateCurrentAttValues() const;
+  // Attribute values for current solid.  Each must refer to an
+  // attribute definition in the above map; its name is the key.  The
+  // user must test the validity of this pointer (it must be non-zero
+  // and conform to the G4AttDefs, which may be checked with
+  // G4AttCheck) and delete the list after use.  See
+  // G4XXXStoredSceneHandler::PreAddSolid for how to access and
+  // G4VTrajectory::ShowTrajectory for an example of the use of
+  // G4Atts.
+
+  void SetRequestedDepth (G4int requestedDepth) {
+    fRequestedDepth = requestedDepth;
+  }
+
+  void SetClippingPolyhedron (const G4Polyhedron* pClippingPolyhedron) {
+    fpClippingPolyhedron = pClippingPolyhedron;
+  }
+
+  void SetClippingMode (ClippingMode mode) {
+    fClippingMode = mode;
+  }
+
+  G4bool Validate (G4bool warn);
+  // Validate, but allow internal changes (hence non-const function).
+
+  void CurtailDescent() {fCurtailDescent = true;}
+
+protected:
+
+  void VisitGeometryAndGetVisReps (G4VPhysicalVolume*,
+				   G4int requestedDepth,
+				   const G4Transform3D&,
+				   G4VGraphicsScene&);
+
+  void DescribeAndDescend (G4VPhysicalVolume*,
+			   G4int requestedDepth,
+			   G4LogicalVolume*,
+			   G4VSolid*,
+			   G4Material*,
+			   const G4Transform3D&,
+			   G4VGraphicsScene&);
+
+  virtual void DescribeSolid (const G4Transform3D& theAT,
+			      G4VSolid* pSol,
+			      const G4VisAttributes* pVisAttribs,
+			      G4VGraphicsScene& sceneHandler);
+
+  void CalculateExtent ();
+
+  /////////////////////////////////////////////////////////
+  // Data members...
+
+  G4VPhysicalVolume* fpTopPV;        // The physical volume.
+  G4String           fTopPVName;     // ...of the physical volume.
+  G4int              fTopPVCopyNo;   // ...of the physical volume.
+  G4int              fRequestedDepth;
+                     // Requested depth of geom. hierarchy search.
+  G4bool             fUseFullExtent; // ...if requested.
+  G4int              fCurrentDepth;  // Current depth of geom. hierarchy.
+  G4VPhysicalVolume* fpCurrentPV;    // Current physical volume.
+  G4LogicalVolume*   fpCurrentLV;    // Current logical volume.
+  G4Material*    fpCurrentMaterial;  // Current material.
+  G4Transform3D* fpCurrentTransform; // Current transform.
+  std::vector<G4PhysicalVolumeNodeID> fFullPVPath;
+  std::vector<G4PhysicalVolumeNodeID> fDrawnPVPath;
+  G4bool             fCurtailDescent;// Can be set to curtail descent.
+  const G4Polyhedron*fpClippingPolyhedron;
+  ClippingMode       fClippingMode;
+
+private:
+
+  // Private copy constructor and assigment operator - copying and
+  // assignment not allowed.  Keeps CodeWizard happy.
+  G4PhysicalVolumeModel (const G4PhysicalVolumeModel&);
+  G4PhysicalVolumeModel& operator = (const G4PhysicalVolumeModel&);
+};
+
+std::ostream& operator<<
+  (std::ostream& os, const G4PhysicalVolumeModel::G4PhysicalVolumeNodeID);
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/modeling/include/G4PhysicalVolumeSearchScene.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/include/G4PhysicalVolumeSearchScene.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/include/G4PhysicalVolumeSearchScene.hh	(revision 1102)
@@ -0,0 +1,111 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4PhysicalVolumeSearchScene.hh,v 1.18 2008/01/04 21:59:15 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  10th August 1998.
+// An artificial scene to find physical volumes.
+
+#ifndef G4PHYSICALVOLUMESEARCHSCENE_HH
+#define G4PHYSICALVOLUMESEARCHSCENE_HH
+
+#include "G4VGraphicsScene.hh"
+#include "G4VisExtent.hh"
+#include "G4Box.hh"
+#include "G4Cons.hh"
+#include "G4Tubs.hh"
+#include "G4Trd.hh"
+#include "G4Trap.hh"
+#include "G4Sphere.hh"
+#include "G4Para.hh"
+#include "G4Torus.hh"
+#include "G4Polycone.hh"
+#include "G4Polyhedra.hh"
+#include "G4VPhysicalVolume.hh"
+#include "G4LogicalVolume.hh"
+
+class G4PhysicalVolumeSearchScene: public G4VGraphicsScene {
+
+public:
+  G4PhysicalVolumeSearchScene
+  (G4PhysicalVolumeModel*,
+   const G4String& requiredPhysicalVolumeName,
+   G4int requiredCopyNo);
+  virtual ~G4PhysicalVolumeSearchScene ();
+  void PreAddSolid (const G4Transform3D& objectTransformation,
+		    const G4VisAttributes&);
+  void PostAddSolid ();
+  void AddSolid (const G4Box& s) {FindVolume (s);}
+  void AddSolid (const G4Cons & s) {FindVolume (s);}
+  void AddSolid (const G4Tubs& s) {FindVolume (s);}
+  void AddSolid (const G4Trd& s) {FindVolume (s);}
+  void AddSolid (const G4Trap& s) {FindVolume (s);}
+  void AddSolid (const G4Sphere& s) {FindVolume (s);}
+  void AddSolid (const G4Para& s) {FindVolume (s);}
+  void AddSolid (const G4Torus& s) {FindVolume (s);}
+  void AddSolid (const G4Polycone& s) {FindVolume (s);}
+  void AddSolid (const G4Polyhedra& s) {FindVolume (s);}
+  void AddSolid (const G4VSolid& s) {FindVolume (s);}
+  void AddCompound (const G4VTrajectory&) {}
+  void AddCompound (const G4VHit&) {}
+  G4int                GetFoundDepth          () const;
+  G4VPhysicalVolume*   GetFoundVolume         () const;
+  const G4Transform3D& GetFoundTransformation () const;
+
+  ////////////////////////////////////////////////////////////////
+  // Functions not used but required by the abstract interface.
+
+  virtual void BeginPrimitives (const G4Transform3D&) {}
+  virtual void EndPrimitives () {}
+  virtual void BeginPrimitives2D (const G4Transform3D&) {}
+  virtual void EndPrimitives2D () {}
+  virtual void AddPrimitive (const G4Polyline&)   {}
+  virtual void AddPrimitive (const G4Scale&)       {}
+  virtual void AddPrimitive (const G4Text&)       {}
+  virtual void AddPrimitive (const G4Circle&)     {}
+  virtual void AddPrimitive (const G4Square&)     {}
+  virtual void AddPrimitive (const G4Polymarker&) {}
+  virtual void AddPrimitive (const G4Polyhedron&) {}
+  virtual void AddPrimitive (const G4NURBS&)      {}
+
+private:
+  void FindVolume (const G4VSolid&);
+  const G4PhysicalVolumeModel* fpPVModel;
+  G4String             fRequiredPhysicalVolumeName;
+  G4int                fRequiredCopyNo;
+  const G4Transform3D* fpCurrentObjectTransformation;
+  G4int                fFoundDepth;                  // Found depth.
+  G4VPhysicalVolume*   fpFoundPV;                    // Found physical volume.
+  G4LogicalVolume*     fpFoundLV;                    // Found logical volume.
+  G4Transform3D        fFoundObjectTransformation;   // Found transformation.
+  G4bool               fMultipleOccurrence;
+};
+
+#include "G4PhysicalVolumeSearchScene.icc"
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/modeling/include/G4PhysicalVolumeSearchScene.icc
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/include/G4PhysicalVolumeSearchScene.icc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/include/G4PhysicalVolumeSearchScene.icc	(revision 1102)
@@ -0,0 +1,54 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4PhysicalVolumeSearchScene.icc,v 1.6 2006/06/29 21:30:38 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  10th August 1998.
+// An artificial scene to find physical volumes.
+
+inline void G4PhysicalVolumeSearchScene::PreAddSolid
+(const G4Transform3D& objectTransformation,
+ const G4VisAttributes&) {
+  fpCurrentObjectTransformation = &objectTransformation;
+}
+
+inline void G4PhysicalVolumeSearchScene::PostAddSolid () {}
+
+inline G4int G4PhysicalVolumeSearchScene::GetFoundDepth () const {
+  return fFoundDepth;
+}
+
+inline G4VPhysicalVolume*
+G4PhysicalVolumeSearchScene::GetFoundVolume () const {
+  return fpFoundPV;
+}
+
+inline const G4Transform3D&
+G4PhysicalVolumeSearchScene::GetFoundTransformation () const {
+  return fFoundObjectTransformation;
+}
Index: tags/visualization-10.5-before-10.6_test/modeling/include/G4ScaleModel.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/include/G4ScaleModel.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/include/G4ScaleModel.hh	(revision 1102)
@@ -0,0 +1,67 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4ScaleModel.hh,v 1.4 2006/11/01 10:28:42 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  21st July 2001.
+//
+// Class Description:
+//
+// Model which knows how to draw a scale.
+//
+// For access to base class information, e.g., modeling parameters,
+// use GetModelingParameters() inherited from G4VModel.  See Class
+// Description of the base class G4VModel.
+
+#ifndef G4SCALEMODEL_HH
+#define G4SCALEMODEL_HH
+
+#include "G4VModel.hh"
+#include "G4Scale.hh"
+
+class G4ScaleModel: public G4VModel {
+
+public: // With description
+
+  G4ScaleModel (const G4Scale&);
+   
+  virtual ~G4ScaleModel ();
+
+  virtual void DescribeYourselfTo (G4VGraphicsScene&);
+  // The main task of a model is to describe itself to the graphics scene.
+
+private:
+
+  // Private copy contructor and assignment to forbid use...
+  G4ScaleModel (const G4ScaleModel&);
+  G4ScaleModel& operator = (const G4ScaleModel&);
+
+  G4Scale fScale;
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/modeling/include/G4TextModel.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/include/G4TextModel.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/include/G4TextModel.hh	(revision 1102)
@@ -0,0 +1,68 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4TextModel.hh,v 1.7 2006/11/01 10:28:42 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  3rd April 2001
+//
+// Class Description:
+//
+// Model which knows how to draw text.
+//
+// For access to base class information, e.g., modeling parameters,
+// use GetModelingParameters() inherited from G4VModel.  See Class
+// Description of the base class G4VModel.
+
+#ifndef G4TEXTMODEL_HH
+#define G4TEXTMODEL_HH
+
+#include "G4VModel.hh"
+#include "G4Text.hh"
+
+class G4TextModel: public G4VModel {
+
+public: // With description
+
+  G4TextModel (const G4Text&);
+   
+  virtual ~G4TextModel ();
+
+  virtual void DescribeYourselfTo (G4VGraphicsScene&);
+  // The main task of a model is to describe itself to the graphics scene.
+
+private:
+
+  // Private copy contructor and assignment to forbid use...
+  G4TextModel (const G4TextModel&);
+  G4TextModel& operator = (const G4TextModel&);
+
+  G4Text fG4Text;
+
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/modeling/include/G4TrajectoriesModel.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/include/G4TrajectoriesModel.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/include/G4TrajectoriesModel.hh	(revision 1102)
@@ -0,0 +1,72 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4TrajectoriesModel.hh,v 1.10 2006/10/26 11:10:23 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  26th August 1998.
+//
+// Class Description:
+//
+// Model which knows how to draw GEANT4 trajectories.
+//
+// For access to base class information, e.g., modeling parameters,
+// use GetModelingParameters() inherited from G4VModel.  See Class
+// Description of the base class G4VModel.
+
+#ifndef G4TRAJECTORIESMODEL_HH
+#define G4TRAJECTORIESMODEL_HH
+
+#include "G4VModel.hh"
+
+class G4VTrajectory;
+
+class G4TrajectoriesModel: public G4VModel {
+
+public: // With description
+
+  G4TrajectoriesModel (G4int drawingMode = 0);
+   
+  virtual ~G4TrajectoriesModel ();
+
+  virtual void DescribeYourselfTo (G4VGraphicsScene&);
+  // The main task of a model is to describe itself to the graphics scene.
+
+  G4int GetDrawingMode() const { return fDrawingMode;}
+  void SetDrawingMode(G4int drawingMode) {fDrawingMode = drawingMode;}
+
+  const G4VTrajectory* GetCurrentTrajectory() const
+  {return fpCurrentTrajectory;}
+
+private:
+
+  G4int fDrawingMode;
+  const G4VTrajectory* fpCurrentTrajectory;
+
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/modeling/include/G4TrajectoryChargeFilter.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/include/G4TrajectoryChargeFilter.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/include/G4TrajectoryChargeFilter.hh	(revision 1102)
@@ -0,0 +1,75 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4TrajectoryChargeFilter.hh,v 1.3 2006/08/25 19:44:14 tinslay Exp $
+// GEANT4 tag $Name:  $
+//
+// Filter trajectories according to charge. Only registered 
+// charges will pass the filter.
+//
+// Jane Tinslay, May 2006
+//
+#ifndef G4TRAJECTORYCHARGEFILTER_HH
+#define G4TRAJECTORYCHARGEFILTER_HH
+
+#include "G4SmartFilter.hh"
+#include "G4VTrajectory.hh"
+#include <vector>
+
+class G4TrajectoryChargeFilter : public G4SmartFilter<G4VTrajectory> {
+
+public: // With description
+ 
+  // Construct with filter name
+  G4TrajectoryChargeFilter(const G4String& name = "Unspecified");
+  
+  virtual ~G4TrajectoryChargeFilter();
+
+  // Evaluate this trajectory
+  virtual bool Evaluate(const G4VTrajectory&) const;
+
+  // Print configuration
+  virtual void Print(std::ostream& ostr) const;
+
+  // Clear filter
+  virtual void Clear();
+
+  // Configuration function
+  void Add(const G4String& particle);
+
+private:
+
+  enum MyCharge {Negative=-1, Neutral=0, Positive=1}; 
+
+  G4bool ConvertToCharge(const G4String&, MyCharge&);
+
+  void Add(const MyCharge& chgear);  
+
+  // Data member
+  std::vector<MyCharge> fCharges;
+
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/modeling/include/G4TrajectoryDrawByAttribute.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/include/G4TrajectoryDrawByAttribute.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/include/G4TrajectoryDrawByAttribute.hh	(revision 1102)
@@ -0,0 +1,83 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4TrajectoryDrawByAttribute.hh,v 1.1 2006/09/11 21:52:18 tinslay Exp $
+// GEANT4 tag $Name:  $
+//
+// Jane Tinslay September 2006
+//
+// Draw trajectories according to attribute.
+//
+#ifndef G4TRAJECTORYDRAWBYATTRIBUTE_HH
+#define G4TRAJECTORYDRAWBYATTRIBUTE_HH
+
+#include "globals.hh"
+#include "G4VTrajectoryModel.hh"
+#include <map>
+
+class G4VAttValueFilter;
+class G4VisTrajContext;
+
+class G4TrajectoryDrawByAttribute : public G4VTrajectoryModel {
+
+public:
+
+  // Constructor
+  G4TrajectoryDrawByAttribute(const G4String& name = "Unspecified", G4VisTrajContext* context=0);
+
+  // Destructor
+  virtual ~G4TrajectoryDrawByAttribute();
+
+  // Draw the trajectory with optional i_mode parameter
+  virtual void Draw(const G4VTrajectory& trajectory, const G4int& i_mode = 0, 
+		    const G4bool& visible = true) const;
+
+  // Print configuration
+  virtual void Print(std::ostream& ostr) const;
+
+  // Configuration methods
+  void Set(const G4String& attribute);
+  void AddIntervalContext(const G4String& name, G4VisTrajContext* context);
+  void AddValueContext(const G4String& name, G4VisTrajContext* context);
+
+private:
+
+  enum Config {Interval, SingleValue};
+
+  typedef std::pair<G4String, Config> Pair;
+  typedef std::map<Pair, G4VisTrajContext*> ContextMap;
+
+  // Data members
+  G4String fAttName;
+  ContextMap fContextMap;
+
+  // Caching
+  mutable G4bool fFirst;
+  mutable G4bool fWarnedMissingAttribute;
+  mutable G4VAttValueFilter* filter;
+
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/modeling/include/G4TrajectoryDrawByCharge.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/include/G4TrajectoryDrawByCharge.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/include/G4TrajectoryDrawByCharge.hh	(revision 1102)
@@ -0,0 +1,82 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4TrajectoryDrawByCharge.hh,v 1.7 2006/06/29 21:31:49 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// Jane Tinslay, John Allison, Joseph Perl November 2005
+//
+// Class Description:
+// Trajectory model which colours a trajectory according to  
+// charge. 
+// Class Description - End:
+
+#ifndef G4TRAJECTORYDRAWBYCHARGE_HH
+#define G4TRAJECTORYDRAWBYCHARGE_HH
+
+#include "G4Colour.hh"
+#include "G4ModelColourMap.hh"
+#include "G4VTrajectoryModel.hh"
+#include <map>
+
+class G4TrajectoryDrawByCharge : public G4VTrajectoryModel {
+
+public: // With description
+ 
+  enum Charge {Negative=-1, Neutral=0, Positive=1}; 
+
+  G4TrajectoryDrawByCharge(const G4String& name = "Unspecified", G4VisTrajContext* context=0);
+
+  G4TrajectoryDrawByCharge(const G4String& name,
+			   const G4Colour& positive,
+			   const G4Colour& negative,
+			   const G4Colour& neutral);
+  
+  virtual ~G4TrajectoryDrawByCharge();
+
+  // Draw the trajectory with optional i_mode parameter
+  virtual void Draw(const G4VTrajectory& trajectory, const G4int& i_mode = 0, 
+		    const G4bool& visible = true) const;
+
+  // Print configuration
+  virtual void Print(std::ostream& ostr) const;
+
+  void Set(const Charge& charge, const G4Colour& colour);
+  void Set(const Charge& charge, const G4String& colour);
+
+  void Set(const G4String& charge, const G4Colour& colour);
+  void Set(const G4String& charge, const G4String& colour);
+  // Configuration functions 
+
+private:
+  
+  G4bool ConvertToCharge(const G4String&, Charge&);
+
+  // Data member
+  G4ModelColourMap<Charge> fMap;
+  
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/modeling/include/G4TrajectoryDrawByOriginVolume.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/include/G4TrajectoryDrawByOriginVolume.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/include/G4TrajectoryDrawByOriginVolume.hh	(revision 1102)
@@ -0,0 +1,74 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4TrajectoryDrawByOriginVolume.hh,v 1.4 2006/06/29 21:31:51 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// Class Description:
+// Trajectory model which colours a trajectory according to
+// the origin volume
+// Class Description - End:
+// Jane Tinslay March 2006
+
+#ifndef G4TRAJECTORYDRAWBYORIGINVOLUME
+#define G4TRAJECTORYDRAWBYORIGINVOLUME
+
+#include "G4VTrajectoryModel.hh"
+#include "G4Colour.hh"
+#include "G4ModelColourMap.hh"
+#include "G4String.hh"
+#include <map>
+
+class G4TrajectoryDrawByOriginVolume : public G4VTrajectoryModel {
+
+public: // With description
+ 
+  G4TrajectoryDrawByOriginVolume(const G4String& name = "Unspecified", G4VisTrajContext* context=0);
+  
+  virtual ~G4TrajectoryDrawByOriginVolume();
+
+  virtual void Draw(const G4VTrajectory&, const G4int& i_mode = 0, 
+		    const G4bool& visible = true) const;
+  // Draw the trajectory with optional i_mode parameter
+
+  virtual void Print(std::ostream& ostr) const;
+  // Print configuration
+
+  void SetDefault(const G4String&);
+  void SetDefault(const G4Colour&);
+
+  void Set(const G4String& particle, const G4String& colour);
+  void Set(const G4String& particle, const G4Colour& colour);
+  // Configuration functions
+
+private:
+
+  // Data members
+  G4ModelColourMap<G4String> fMap;
+  G4Colour fDefault;
+
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/modeling/include/G4TrajectoryDrawByParticleID.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/include/G4TrajectoryDrawByParticleID.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/include/G4TrajectoryDrawByParticleID.hh	(revision 1102)
@@ -0,0 +1,75 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4TrajectoryDrawByParticleID.hh,v 1.7 2006/06/29 21:31:53 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// Jane Tinslay, John Allison, Joseph Perl November 2005
+//
+// Class Description:
+// Trajectory model which colours a trajectory according to
+// particle type.
+// Class Description - End:
+
+#ifndef G4TRAJECTORYDRAWBYPARTICLEID
+#define G4TRAJECTORYDRAWBYPARTICLEID
+
+#include "G4VTrajectoryModel.hh"
+#include "G4Colour.hh"
+#include "G4ModelColourMap.hh"
+#include "G4String.hh"
+#include <map>
+
+class G4TrajectoryDrawByParticleID : public G4VTrajectoryModel {
+
+public: // With description
+ 
+  G4TrajectoryDrawByParticleID(const G4String& name = "Unspecified", G4VisTrajContext* context=0);
+  
+  virtual ~G4TrajectoryDrawByParticleID();
+
+  virtual void Draw(const G4VTrajectory&, const G4int&i_mode = 0, 
+		    const G4bool& visible = true) const;
+  // Draw the trajectory with optional i_mode parameter
+
+  virtual void Print(std::ostream& ostr) const;
+  // Print configuration
+
+  void SetDefault(const G4String&);
+  void SetDefault(const G4Colour&);
+
+  void Set(const G4String& particle, const G4String& colour);
+  void Set(const G4String& particle, const G4Colour& colour);
+  // Configuration functions
+
+private:
+
+  // Data members
+  G4ModelColourMap<G4String> fMap;
+  G4Colour fDefault;
+
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/modeling/include/G4TrajectoryDrawerUtils.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/include/G4TrajectoryDrawerUtils.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/include/G4TrajectoryDrawerUtils.hh	(revision 1102)
@@ -0,0 +1,60 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4TrajectoryDrawerUtils.hh,v 1.7 2007/05/30 08:56:55 allison Exp $
+// GEANT4 tag $Name:  $
+// 
+// Jane Tinslay, John Allison, Joseph Perl November 2005
+//
+// Class Description
+// Simple trajectory model drawing utility functions
+// Class Description - End:
+
+#ifndef G4TRAJECTORYDRAWERUTILS
+#define G4TRAJECTORYDRAWERUTILS
+
+#include "globals.hh"
+
+class G4Colour;
+class G4Polyline;
+class G4Polymarker;
+class G4VisTrajContext;
+class G4VTrajectory;
+
+namespace G4TrajectoryDrawerUtils {
+
+  void GetPoints(const G4VTrajectory& traj, G4Polyline& trajectoryLine,
+		 G4Polymarker& auxiliaryPoints, G4Polymarker& stepPoints);
+
+  // Draw trajectory line and points
+  void DrawLineAndPoints(const G4VTrajectory& traj, const G4int& i_mode, 
+			 const G4Colour& cfg, const G4bool& visible);
+
+  // Draw trajectory line and points using G4VisTrajContext object information
+  void DrawLineAndPoints(const G4VTrajectory& traj, const G4VisTrajContext&, const G4int& i_mode=0);
+
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/modeling/include/G4TrajectoryFilterFactories.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/include/G4TrajectoryFilterFactories.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/include/G4TrajectoryFilterFactories.hh	(revision 1102)
@@ -0,0 +1,108 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+/// $Id: G4TrajectoryFilterFactories.hh,v 1.4 2006/09/12 18:53:03 tinslay Exp $
+// GEANT4 tag $Name:  $
+//
+//
+// Trajectory filter model factories creating filters
+// and associated messengers.
+//
+// Jane Tinslay March 2006
+//
+#ifndef G4TRAJECTORYFILTERFACTORIES_HH
+#define G4TRAJECTORYFILTERFACTORIES_HH
+
+#include "G4VFilter.hh"
+#include "G4VModelFactory.hh"
+#include "G4VTrajectory.hh"
+
+// Attribute filter
+class G4TrajectoryAttributeFilterFactory : public G4VModelFactory< G4VFilter<G4VTrajectory>  > {
+
+public: // With description
+
+  typedef std::vector<G4UImessenger*> Messengers;
+  typedef std::pair< G4VFilter<G4VTrajectory> *, Messengers > ModelAndMessengers;
+
+  G4TrajectoryAttributeFilterFactory();
+
+  virtual ~G4TrajectoryAttributeFilterFactory();
+  
+  ModelAndMessengers Create(const G4String& placement, const G4String& name);
+    
+};
+
+// Charge filter
+class G4TrajectoryChargeFilterFactory : public G4VModelFactory< G4VFilter<G4VTrajectory>  > {
+
+public: // With description
+
+  typedef std::vector<G4UImessenger*> Messengers;
+  typedef std::pair< G4VFilter<G4VTrajectory> *, Messengers > ModelAndMessengers;
+
+  G4TrajectoryChargeFilterFactory();
+
+  virtual ~G4TrajectoryChargeFilterFactory();
+  
+  ModelAndMessengers Create(const G4String& placement, const G4String& name);
+    
+};
+
+// Particle filter
+class G4TrajectoryParticleFilterFactory : public G4VModelFactory< G4VFilter<G4VTrajectory>  > {
+
+public: // With description
+
+  typedef std::vector<G4UImessenger*> Messengers;
+  typedef std::pair< G4VFilter<G4VTrajectory> *, Messengers > ModelAndMessengers;
+
+  G4TrajectoryParticleFilterFactory();
+
+  virtual ~G4TrajectoryParticleFilterFactory();
+  
+  ModelAndMessengers Create(const G4String& placement, const G4String& name);
+    
+};
+
+// Origin volume filter
+class G4TrajectoryOriginVolumeFilterFactory : public G4VModelFactory< G4VFilter<G4VTrajectory>  > {
+
+public: // With description
+
+  typedef std::vector<G4UImessenger*> Messengers;
+  typedef std::pair< G4VFilter<G4VTrajectory> *, Messengers > ModelAndMessengers;
+
+  G4TrajectoryOriginVolumeFilterFactory();
+
+  virtual ~G4TrajectoryOriginVolumeFilterFactory();
+  
+  ModelAndMessengers Create(const G4String& placement, const G4String& name);
+    
+};
+
+
+#endif
+
Index: tags/visualization-10.5-before-10.6_test/modeling/include/G4TrajectoryGenericDrawer.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/include/G4TrajectoryGenericDrawer.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/include/G4TrajectoryGenericDrawer.hh	(revision 1102)
@@ -0,0 +1,61 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4TrajectoryGenericDrawer.hh,v 1.2 2006/06/29 21:31:59 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// Jane Tinslay, John Allison, Joseph Perl November 2005
+//
+// Class Description:
+// Trajectory model which colours a trajectory according to  
+// charge. Guts taken from G4VTrajectory::DrawTrajectory method.
+// Class Description - End:
+
+#ifndef G4TRAJECTORYGENERICDRAWER_HH
+#define G4TRAJECTORYGENERICDRAWER_HH
+
+#include "G4Colour.hh"
+#include "G4VTrajectoryModel.hh"
+
+class G4TrajectoryGenericDrawer : public G4VTrajectoryModel {
+
+public: // With description
+
+  G4TrajectoryGenericDrawer(const G4String& name = "Unspecified", G4VisTrajContext* context=0);
+
+  virtual ~G4TrajectoryGenericDrawer();
+
+  virtual void Draw(const G4VTrajectory& trajectory, const G4int& i_mode = 0, 
+		    const G4bool& visible = true) const;
+  // Draw the trajectory with optional i_mode parameter
+
+  virtual void Print(std::ostream& ostr) const;
+  // Print configuration
+
+private:
+  
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/modeling/include/G4TrajectoryModelFactories.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/include/G4TrajectoryModelFactories.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/include/G4TrajectoryModelFactories.hh	(revision 1102)
@@ -0,0 +1,109 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4TrajectoryModelFactories.hh,v 1.6 2006/09/12 18:53:03 tinslay Exp $
+// GEANT4 tag $Name:  $
+//
+// Jane Tinslay, John Allison, Joseph Perl October 2005
+//
+// Class Description:
+// Trajectory model factories creating trajectory models
+// and associated messengers
+// Class Description - End:
+
+#ifndef G4TRAJECTORYMODELFACTORIES_HH
+#define G4TRAJECTORYMODELFACTORIES_HH
+
+#include "G4VModelFactory.hh"
+#include "G4VTrajectoryModel.hh"
+
+namespace {
+  typedef std::vector<G4UImessenger*> Messengers;
+  typedef std::pair<G4VTrajectoryModel*, Messengers > ModelAndMessengers;
+}
+
+class G4TrajectoryDrawByAttributeFactory : public G4VModelFactory<G4VTrajectoryModel> {
+
+public: // With description
+
+  G4TrajectoryDrawByAttributeFactory();
+
+  virtual ~G4TrajectoryDrawByAttributeFactory();
+  
+  ModelAndMessengers Create(const G4String& placement, const G4String& name);
+    
+};
+
+class G4TrajectoryDrawByChargeFactory : public G4VModelFactory<G4VTrajectoryModel> {
+
+public: // With description
+
+  G4TrajectoryDrawByChargeFactory();
+
+  virtual ~G4TrajectoryDrawByChargeFactory();
+  
+  ModelAndMessengers Create(const G4String& placement, const G4String& name);
+    
+};
+
+class G4TrajectoryGenericDrawerFactory : public G4VModelFactory<G4VTrajectoryModel> {
+
+public: // With description
+
+  G4TrajectoryGenericDrawerFactory();
+
+  virtual ~G4TrajectoryGenericDrawerFactory();
+  
+  ModelAndMessengers Create(const G4String& placement, const G4String& name);
+    
+};
+
+class G4TrajectoryDrawByParticleIDFactory : public G4VModelFactory<G4VTrajectoryModel> {
+
+public: // With description
+
+  G4TrajectoryDrawByParticleIDFactory();
+
+  virtual ~G4TrajectoryDrawByParticleIDFactory();
+  
+  ModelAndMessengers Create(const G4String& placement, const G4String& name);
+    
+};
+
+class G4TrajectoryDrawByOriginVolumeFactory : public G4VModelFactory<G4VTrajectoryModel> {
+
+public: // With description
+
+  G4TrajectoryDrawByOriginVolumeFactory();
+
+  virtual ~G4TrajectoryDrawByOriginVolumeFactory();
+  
+  ModelAndMessengers Create(const G4String& placement, const G4String& name);
+    
+};
+
+#endif
+
+
Index: tags/visualization-10.5-before-10.6_test/modeling/include/G4TrajectoryOriginVolumeFilter.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/include/G4TrajectoryOriginVolumeFilter.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/include/G4TrajectoryOriginVolumeFilter.hh	(revision 1102)
@@ -0,0 +1,69 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4TrajectoryOriginVolumeFilter.hh,v 1.3 2006/08/25 19:44:14 tinslay Exp $
+// GEANT4 tag $Name:  $
+//
+// Filter trajectories according to volume name. Only registered 
+// volumes will pass the filter.
+//
+// Jane Tinslay, May 2006
+//
+#ifndef G4TRAJECTORYORIGINVOLUMEFILTER_HH
+#define G4TRAJECTORYORIGINVOLUMEFILTER_HH
+
+#include "G4SmartFilter.hh"
+#include "G4VTrajectory.hh"
+#include <vector>
+
+class G4TrajectoryOriginVolumeFilter : public G4SmartFilter<G4VTrajectory> {
+
+public: // With description
+ 
+  // Construct with filter name
+  G4TrajectoryOriginVolumeFilter(const G4String& name = "Unspecified");
+  
+  virtual ~G4TrajectoryOriginVolumeFilter();
+
+  // Evaluate this trajectory
+  virtual bool Evaluate(const G4VTrajectory&) const;
+
+  // Print configuration
+  virtual void Print(std::ostream& ostr) const;
+
+  // Clear filter
+  virtual void Clear();
+
+  // Configuration function
+  void Add(const G4String& volume);
+
+private:
+
+  // Data member
+  std::vector<G4String> fVolumes;
+
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/modeling/include/G4TrajectoryParticleFilter.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/include/G4TrajectoryParticleFilter.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/include/G4TrajectoryParticleFilter.hh	(revision 1102)
@@ -0,0 +1,69 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4TrajectoryParticleFilter.hh,v 1.3 2006/08/25 19:44:14 tinslay Exp $
+// GEANT4 tag $Name:  $
+//
+// Filter trajectories according to particle type. Only registered 
+// particle types will pass the filter.
+//
+// Jane Tinslay, March 2006
+//
+#ifndef G4TRAJECTORYPARTICLEFILTER_HH
+#define G4TRAJECTORYPARTICLEFILTER_HH
+
+#include "G4SmartFilter.hh"
+#include "G4VTrajectory.hh"
+#include <vector>
+
+class G4TrajectoryParticleFilter : public G4SmartFilter<G4VTrajectory> {
+
+public: // With description
+ 
+  // Construct with filter name
+  G4TrajectoryParticleFilter(const G4String& name = "Unspecified");
+  
+  virtual ~G4TrajectoryParticleFilter();
+
+  // Evaluate this trajectory
+  virtual bool Evaluate(const G4VTrajectory&) const;
+
+  // Print configuration
+  virtual void Print(std::ostream& ostr) const;
+
+  // Clear filter
+  virtual void Clear();
+
+  // Configuration function
+  void Add(const G4String& particle);
+
+private:
+
+  // Data member
+  std::vector<G4String> fParticles;
+
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/modeling/include/G4VAttValueFilter.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/include/G4VAttValueFilter.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/include/G4VAttValueFilter.hh	(revision 1102)
@@ -0,0 +1,69 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4VAttValueFilter.hh,v 1.2 2006/12/13 15:50:04 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// Abstract base class for G4AttValue filters
+//
+// Jane Tinslay, September 2006
+//
+#ifndef G4VATTVALUEFILTER_HH
+#define G4VATTVALUEFILTER_HH
+
+#include "globals.hh"
+#include "G4String.hh"
+#include "G4VFilter.hh"
+
+class G4AttValue;
+
+class G4VAttValueFilter : public G4VFilter<G4AttValue> {
+
+public:
+
+  // Constructor
+  G4VAttValueFilter(const G4String& name = "G4AttValueFilter")
+    :G4VFilter<G4AttValue>(name){}
+
+  // Destructor
+  virtual ~G4VAttValueFilter() {}
+  
+  // Filter methods
+  virtual G4bool Accept(const G4AttValue&) const = 0;
+  virtual G4bool GetValidElement(const G4AttValue&, G4String&) const = 0;
+
+  // Print configuration
+  virtual void PrintAll(std::ostream& ostr) const = 0;
+  
+  // Reset 
+  virtual void Reset() = 0;
+
+  // Load filter data
+  virtual void LoadIntervalElement(const G4String&) = 0;
+  virtual void LoadSingleValueElement(const G4String&) = 0;
+
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/modeling/include/G4VModel.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/include/G4VModel.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/include/G4VModel.hh	(revision 1102)
@@ -0,0 +1,119 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VModel.hh,v 1.19 2006/07/10 16:09:30 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  31st December 1997.
+//
+// Class Description:
+//
+// G4VModel is a base class for visualization models.  A model is a
+// graphics-system-indepedent description of a Geant4 component.
+// The key fuctionality of a model is to know how to describe itself
+// to a scene handler.  A scene is a collection of models.
+// A special case is made for G4PhysicalVolumeModel - a non-null pointer
+// is to be returned by G4PhysicalVolumeModel::GetG4PhysicalVolumeModel().
+
+#ifndef G4VMODEL_HH
+#define G4VMODEL_HH
+
+#include "globals.hh"
+#include "G4VisExtent.hh"
+#include "G4Transform3D.hh"
+
+class G4VGraphicsScene;
+class G4ModelingParameters;
+
+class G4PhysicalVolumeModel;  // Special case - see above.
+
+class G4VModel {
+
+public: // With description
+
+  friend std::ostream& operator << (std::ostream& os, const G4VModel&);
+
+  G4VModel
+  (const G4Transform3D& modelTransformation = G4Transform3D(),
+   const G4ModelingParameters* = 0);
+   
+  virtual ~G4VModel ();
+
+  virtual void DescribeYourselfTo (G4VGraphicsScene&) = 0;
+  // The main task of a model is to describe itself to the graphics scene.
+
+  const G4ModelingParameters* GetModelingParameters () const;
+
+  virtual G4String GetCurrentDescription () const;
+  // A description which depends on the current state of the model.
+
+  virtual G4String GetCurrentTag () const;
+  // A tag which depends on the current state of the model.
+
+  const G4VisExtent& GetExtent () const;
+  // Extent of visible objects in local coordinate system.
+
+  const G4String& GetGlobalDescription () const;
+  // A description which does not change and lasts the life of the model.
+
+  const G4String& GetGlobalTag () const;
+  // A tag which does not change and lasts the life of the model.
+
+  const G4Transform3D& GetTransformation () const;
+  // Model transformation, i.e., position and orientation of model in
+  // world.  It is the responsibility of the model to apply this
+  // transformation before passing items to the graphics scene.
+
+  // Set methods for above...
+  void SetModelingParameters (const G4ModelingParameters*);
+  void SetExtent (const G4VisExtent&);
+  void SetGlobalDescription (const G4String&);
+  void SetGlobalTag (const G4String&);
+  void SetTransformation (const G4Transform3D&);
+
+  virtual G4bool Validate (G4bool warn = true);
+  // Validate, but allow internal changes (hence non-const function).
+
+protected:
+
+  G4String                    fGlobalTag;
+  G4String                    fGlobalDescription;
+  G4VisExtent                 fExtent;
+  G4Transform3D               fTransform;           
+  const G4ModelingParameters* fpMP;
+
+private:
+
+  // Private copy constructor and assigment operator - copying and
+  // assignment not allowed.  Keeps CodeWizard happy.
+  G4VModel (const G4VModel&);
+  G4VModel& operator = (const G4VModel&);
+};
+
+#include "G4VModel.icc"
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/modeling/include/G4VModel.icc
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/include/G4VModel.icc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/include/G4VModel.icc	(revision 1102)
@@ -0,0 +1,72 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VModel.icc,v 1.12 2006/07/10 16:09:30 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  31st December 1997.
+// Base class for models.
+
+inline const G4ModelingParameters* G4VModel::GetModelingParameters () const {
+  return fpMP;
+}
+
+inline const G4String& G4VModel::GetGlobalTag () const {
+  return fGlobalTag;
+}
+
+inline const G4String& G4VModel::GetGlobalDescription () const {
+  return fGlobalDescription;
+}
+
+inline const G4VisExtent& G4VModel::GetExtent () const {
+  return fExtent;
+}
+
+inline const G4Transform3D& G4VModel::GetTransformation () const {
+  return fTransform;
+}
+
+inline void G4VModel::SetModelingParameters (const G4ModelingParameters* pMP) {
+  fpMP = pMP;
+}
+
+inline void G4VModel::SetExtent (const G4VisExtent& extent) {
+  fExtent = extent;
+}
+
+inline void G4VModel::SetGlobalDescription (const G4String& desc) {
+  fGlobalDescription = desc;
+}
+
+inline void G4VModel::SetGlobalTag (const G4String& tag) {
+  fGlobalTag = tag;
+}
+
+inline void G4VModel::SetTransformation (const G4Transform3D& transform) {
+  fTransform = transform;
+}
Index: tags/visualization-10.5-before-10.6_test/modeling/include/G4VModelCommand.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/include/G4VModelCommand.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/include/G4VModelCommand.hh	(revision 1102)
@@ -0,0 +1,105 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4VModelCommand.hh,v 1.4 2006/09/11 21:22:02 tinslay Exp $
+// GEANT4 tag $Name:  $
+// 
+// Jane Tinslay, John Allison, Joseph Perl November 2005
+//
+// Class Description
+// Templated base class for model messengers. Commands specific to a particular
+// concrete model should inherit from G4VModelCommand, with the concrete model
+// type as the template parameter.
+// Class Description - End:
+
+#ifndef G4VMODELCOMMAND_HH
+#define G4VMODELCOMMAND_HH
+
+#include "G4UImessenger.hh"
+#include "G4String.hh"
+
+class G4UIcommand;
+
+template <typename T>
+class G4VModelCommand : public G4UImessenger {
+
+public: 
+
+  // Constructor
+  G4VModelCommand(T* model, const G4String& placement="");
+
+  // Destructor
+  virtual ~G4VModelCommand();
+
+  // Methods
+  G4String GetCurrentValue(G4UIcommand* command);
+  G4String Placement();
+
+protected:
+
+  // Access to model
+  T* Model();
+
+private:
+
+  // Data members
+  T* fpModel;
+  G4String fPlacement;
+};
+
+template <typename T>
+G4VModelCommand<T>::G4VModelCommand(T* model, const G4String& placement)
+  :fpModel(model)
+  ,fPlacement(placement)
+{}
+
+template <typename T>
+G4VModelCommand<T>::~G4VModelCommand() {}
+
+template <typename T>
+G4String 
+G4VModelCommand<T>::GetCurrentValue(G4UIcommand*) 
+{
+  return "";
+}
+
+template <typename T>
+T*
+G4VModelCommand<T>::Model() 
+{
+  return fpModel;
+}
+
+template <typename T>
+G4String
+G4VModelCommand<T>::Placement() 
+{
+  return fPlacement;
+}
+
+#endif
+
+
+
Index: tags/visualization-10.5-before-10.6_test/modeling/include/G4VModelFactory.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/include/G4VModelFactory.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/include/G4VModelFactory.hh	(revision 1102)
@@ -0,0 +1,94 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4VModelFactory.hh,v 1.6 2006/06/29 21:32:30 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// Jane Tinslay, John Allison, Joseph Perl October 2005
+//
+// Class Description:
+// Abstract base class for model factories. Derived classes
+// must implement the Create method, creating a new model
+// and associated messengers.
+// Class Description - End:
+
+#ifndef G4VMODELFACTORY
+#define G4VMODELFACTORY
+
+#include "G4String.hh"
+#include <iostream>
+#include <utility>
+#include <vector>
+
+class G4UImessenger;
+
+template <class T>
+class G4VModelFactory {
+
+public: // With description
+
+  typedef std::vector<G4UImessenger*> Messengers;
+  typedef std::pair<T*, Messengers> ModelAndMessengers;
+  
+  G4VModelFactory(const G4String& name);
+
+  virtual ~G4VModelFactory();
+
+  G4String Name();
+
+  virtual ModelAndMessengers Create(const G4String& placement, const G4String& modelName) = 0;
+
+  void Print(std::ostream& ostr) const;
+
+private:
+
+  G4String fName;
+
+};
+
+template <typename T>
+G4VModelFactory<T>::G4VModelFactory(const G4String& name)
+  :fName(name) 
+{}
+
+template <typename T>
+G4VModelFactory<T>::~G4VModelFactory() {}
+
+template <typename T>
+G4String 
+G4VModelFactory<T>::Name() 
+{
+  return fName;
+}
+
+template <typename T>
+void 
+G4VModelFactory<T>::Print(std::ostream& ostr) const
+{
+  ostr<<"  "<<fName<<std::endl; 
+} 
+
+#endif
+
Index: tags/visualization-10.5-before-10.6_test/modeling/include/G4VTrajectoryModel.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/include/G4VTrajectoryModel.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/include/G4VTrajectoryModel.hh	(revision 1102)
@@ -0,0 +1,79 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4VTrajectoryModel.hh,v 1.7 2006/08/14 11:43:34 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// Jane Tinslay, John Allison, Joseph Perl October 2005
+//
+// Class Description:
+// Abstract base class for trajectory drawing models. Trajectory drawing
+// models are responsible for drawing individual trajectories according 
+// to a particular style.
+// Class Description - End:
+
+#ifndef G4VTRAJECTORYMODEL_HH
+#define G4VTRAJECTORYMODEL_HH
+
+#include "G4String.hh"
+#include "G4VTrajectory.hh"
+
+class G4VisTrajContext;
+
+class G4VTrajectoryModel {
+
+public:
+
+  // Construct with context object
+  G4VTrajectoryModel(const G4String& name, G4VisTrajContext* fpContext=0);
+
+  // Destructor
+  virtual ~G4VTrajectoryModel();
+  
+  // Draw method
+  virtual void Draw(const G4VTrajectory& trajectory, const G4int& i_mode = 0, 
+		    const G4bool& visible = true) const = 0;
+  
+  // Print configuration
+  virtual void Print(std::ostream& ostr) const = 0;
+  
+  // Accessors
+  G4String Name() const ;
+  const G4VisTrajContext& GetContext() const;
+  
+  // Set verbosity
+  void SetVerbose(const G4bool&);
+  G4bool GetVerbose() const;
+
+private:
+
+  G4String fName;
+  G4bool fVerbose;
+  G4VisTrajContext* fpContext;
+  
+};
+
+#endif
+
Index: tags/visualization-10.5-before-10.6_test/modeling/include/G4VisTrajContext.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/include/G4VisTrajContext.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/include/G4VisTrajContext.hh	(revision 1102)
@@ -0,0 +1,147 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4VisTrajContext.hh,v 1.4 2009/02/24 12:00:56 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// Jane Tinslay May 2006
+//
+#ifndef G4VISTRAJCONTEXT_HH
+#define G4VISTRAJCONTEXT_HH
+
+#include "G4Colour.hh"
+#include "G4Polymarker.hh"
+
+class G4VisTrajContext {
+
+public:
+
+  // Default configuration
+  G4VisTrajContext(const G4String& name = "Unspecified");
+
+  // Destructor
+  virtual ~G4VisTrajContext();
+
+  G4String Name() const;
+  
+  void SetVisible(const G4bool& visible); 
+
+  // Print configuration
+  void Print(std::ostream& ostr) const;
+
+  // Line
+  void SetLineColour(const G4Colour& colour);
+  G4Colour GetLineColour() const;
+
+  void SetDrawLine(const G4bool& draw); 
+  G4bool GetDrawLine() const;
+
+  void SetLineVisible(const G4bool& visible);
+  G4bool GetLineVisible() const;
+
+  // Auxiliary points
+  void SetDrawAuxPts(const G4bool& draw);
+  G4bool GetDrawAuxPts() const;
+
+  void SetAuxPtsType(const G4Polymarker::MarkerType& marker);
+  G4Polymarker::MarkerType GetAuxPtsType() const;
+
+  void SetAuxPtsSize(const G4double& size);
+  G4double GetAuxPtsSize() const;
+
+  void SetAuxPtsSizeType(const G4VMarker::SizeType& sizeType);
+  G4VMarker::SizeType GetAuxPtsSizeType() const;
+
+  void SetAuxPtsFillStyle(const G4VMarker::FillStyle& style);
+  G4VMarker::FillStyle GetAuxPtsFillStyle() const;
+
+  void SetAuxPtsColour(const G4Colour& colour);
+  G4Colour GetAuxPtsColour() const;
+
+  void SetAuxPtsVisible(const G4bool& visible);
+  G4bool GetAuxPtsVisible() const;
+
+  // Step points
+  void SetDrawStepPts(const G4bool& draw);
+  G4bool GetDrawStepPts() const;
+
+  void SetStepPtsType(const G4Polymarker::MarkerType& marker);
+  G4Polymarker::MarkerType GetStepPtsType() const;
+
+  void SetStepPtsSize(const G4double& size);
+  G4double GetStepPtsSize() const;
+
+  void SetStepPtsSizeType(const G4VMarker::SizeType& sizeType);
+  G4VMarker::SizeType GetStepPtsSizeType() const;
+
+  void SetStepPtsFillStyle(const G4VMarker::FillStyle& style);
+  G4VMarker::FillStyle GetStepPtsFillStyle() const;
+
+  void SetStepPtsColour(const G4Colour& colour);
+  G4Colour GetStepPtsColour() const;
+
+  void SetStepPtsVisible(const G4bool& visible);
+  G4bool GetStepPtsVisible() const;
+
+  void SetTimeSliceInterval(const G4double& interval);
+  G4double GetTimeSliceInterval() const;
+
+private:
+  
+  // Data members
+  G4String fName;
+
+  // Line data
+  G4Colour fLineColour;
+  G4bool fLineVisible;
+  G4bool fDrawLine;
+
+  // Auxiliary point data
+  G4bool fDrawAuxPts;
+  G4Polymarker::MarkerType fAuxPtsType;
+  G4double fAuxPtsSize;
+  G4VMarker::SizeType fAuxPtsSizeType;
+  G4VMarker::FillStyle fAuxPtsFillStyle;
+  G4Colour fAuxPtsColour;
+  G4bool fAuxPtsVisible;
+
+  // Step point data
+  G4bool fDrawStepPts;
+  G4Polymarker::MarkerType fStepPtsType;
+  G4double fStepPtsSize;
+  G4VMarker::SizeType fStepPtsSizeType;
+  G4VMarker::FillStyle fStepPtsFillStyle;
+  G4Colour fStepPtsColour;
+  G4bool fStepPtsVisible;
+
+  // Time slicing
+  G4double fTimeSliceInterval;
+
+};
+
+#include "G4VisTrajContext.icc"
+
+#endif
+
Index: tags/visualization-10.5-before-10.6_test/modeling/include/G4VisTrajContext.icc
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/include/G4VisTrajContext.icc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/include/G4VisTrajContext.icc	(revision 1102)
@@ -0,0 +1,123 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4VisTrajContext.icc,v 1.4 2009/02/24 12:00:56 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// Jane Tinslay May 2006
+//
+#ifndef G4VISTRAJ_CONTEXT_ICC
+#define G4VISTRAJ_CONTEXT_ICC
+
+inline G4String G4VisTrajContext::Name() const {return fName;}
+
+inline void G4VisTrajContext::SetVisible(const G4bool& visible) 
+{
+  SetLineVisible(visible);
+  SetAuxPtsVisible(visible);
+  SetStepPtsVisible(visible);
+}
+
+// Line
+inline void G4VisTrajContext::SetLineColour(const G4Colour& colour) {fLineColour = colour;}
+inline G4Colour G4VisTrajContext::GetLineColour() const {return fLineColour;}
+
+inline void G4VisTrajContext::SetDrawLine(const G4bool& draw) {fDrawLine = draw;}
+inline G4bool G4VisTrajContext::GetDrawLine() const {return fDrawLine;}
+
+inline void G4VisTrajContext::SetLineVisible(const G4bool& visible) {fLineVisible = visible;}
+inline G4bool G4VisTrajContext::GetLineVisible() const {return fLineVisible;}
+
+// Auxiliary points
+inline void G4VisTrajContext::SetDrawAuxPts(const G4bool& draw) {fDrawAuxPts = draw;}
+inline G4bool G4VisTrajContext::GetDrawAuxPts() const {return fDrawAuxPts;}
+
+inline void G4VisTrajContext::SetAuxPtsType(const G4Polymarker::MarkerType& marker) {fAuxPtsType = marker;}
+inline G4Polymarker::MarkerType G4VisTrajContext::GetAuxPtsType() const {return fAuxPtsType;}
+
+inline void G4VisTrajContext::SetAuxPtsSize(const G4double& size) {fAuxPtsSize = size;}
+inline G4double G4VisTrajContext::GetAuxPtsSize() const {return fAuxPtsSize;}
+
+inline void G4VisTrajContext::SetAuxPtsSizeType(const G4VMarker::SizeType& sizeType) {fAuxPtsSizeType = sizeType;}
+inline G4VMarker::SizeType G4VisTrajContext::GetAuxPtsSizeType() const {return fAuxPtsSizeType;}
+
+inline void G4VisTrajContext::SetAuxPtsFillStyle(const G4VMarker::FillStyle& style) {fAuxPtsFillStyle = style;}
+inline G4VMarker::FillStyle G4VisTrajContext::GetAuxPtsFillStyle() const {return fAuxPtsFillStyle;}
+
+inline void G4VisTrajContext::SetAuxPtsColour(const G4Colour& colour) {fAuxPtsColour = colour;}
+inline G4Colour G4VisTrajContext::GetAuxPtsColour() const {return fAuxPtsColour;}
+
+inline void G4VisTrajContext::SetAuxPtsVisible(const G4bool& visible) {fAuxPtsVisible = visible;}
+inline G4bool G4VisTrajContext::GetAuxPtsVisible() const {return fAuxPtsVisible;}
+
+// Step points
+inline void G4VisTrajContext::SetDrawStepPts(const G4bool& draw) {fDrawStepPts = draw;}
+inline G4bool G4VisTrajContext::GetDrawStepPts() const {return fDrawStepPts;}
+
+inline void G4VisTrajContext::SetStepPtsType(const G4Polymarker::MarkerType& marker) {fStepPtsType = marker;}
+inline G4Polymarker::MarkerType G4VisTrajContext::GetStepPtsType() const {return fStepPtsType;}
+
+inline void G4VisTrajContext::SetStepPtsSize(const G4double& size) {fStepPtsSize = size;}
+inline G4double G4VisTrajContext::GetStepPtsSize() const {return fStepPtsSize;}
+
+inline void G4VisTrajContext::SetStepPtsSizeType(const G4VMarker::SizeType& sizeType) {fStepPtsSizeType = sizeType;}
+inline G4VMarker::SizeType G4VisTrajContext::GetStepPtsSizeType() const {return fStepPtsSizeType;}
+
+inline void G4VisTrajContext::SetStepPtsFillStyle(const G4VMarker::FillStyle& style) {fStepPtsFillStyle = style;}
+inline G4VMarker::FillStyle G4VisTrajContext::GetStepPtsFillStyle() const {return fStepPtsFillStyle;}
+
+inline void G4VisTrajContext::SetStepPtsColour(const G4Colour& colour) {fStepPtsColour = colour;}
+inline G4Colour G4VisTrajContext::GetStepPtsColour() const {return fStepPtsColour;}
+
+inline void G4VisTrajContext::SetStepPtsVisible(const G4bool& visible) {fStepPtsVisible = visible;}
+inline G4bool G4VisTrajContext::GetStepPtsVisible() const {return fStepPtsVisible;}
+
+inline void G4VisTrajContext::SetTimeSliceInterval(const G4double& interval) {fTimeSliceInterval = interval;}
+inline G4double G4VisTrajContext::GetTimeSliceInterval() const {return fTimeSliceInterval;}
+
+#include "G4UnitsTable.hh"
+
+inline void G4VisTrajContext::Print(std::ostream& ostr) const 
+{
+  ostr<<"Name:                       "<<Name()<<G4endl;
+  ostr<<"Line colour                 "<<GetLineColour()<<G4endl;
+  ostr<<"Draw line ?                 "<<GetDrawLine()<<G4endl;
+  ostr<<"Line visibile ?             "<<GetLineVisible()<<G4endl;
+  ostr<<"Draw auxiliary points ?     "<<GetDrawAuxPts()<<G4endl;
+  ostr<<"Auxiliary points type       "<<GetAuxPtsType()<<G4endl;
+  ostr<<"Auxiliary points size       "<<GetAuxPtsSize()<<G4endl;
+  ostr<<"Auxiliary points fill style "<<GetAuxPtsFillStyle()<<G4endl;
+  ostr<<"Auxiliary points colour     "<<GetAuxPtsColour()<<G4endl;
+  ostr<<"Auxiliary points visible ?  "<<GetAuxPtsVisible()<<G4endl;
+  ostr<<"Draw step points ?          "<<GetDrawStepPts()<<G4endl;
+  ostr<<"Step points type            "<<GetStepPtsType()<<G4endl;
+  ostr<<"Step points size            "<<GetStepPtsSize()<<G4endl;
+  ostr<<"Step points fill style      "<<GetStepPtsFillStyle()<<G4endl;
+  ostr<<"Step points colour          "<<GetStepPtsColour()<<G4endl;
+  ostr<<"Step points visible ?       "<<GetStepPtsVisible()<<G4endl;
+  ostr<<"Time slice interval         "<<G4BestUnit(GetTimeSliceInterval(),"Time")<<G4endl;
+}
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/modeling/src/G4AttFilterUtils.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/src/G4AttFilterUtils.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/src/G4AttFilterUtils.cc	(revision 1102)
@@ -0,0 +1,95 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4AttFilterUtils.cc,v 1.4 2006/12/13 15:50:06 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// Visualisation attribute filter utility functions.
+//
+// Jane Tinslay, September 2006
+//
+#include "G4AttFilterUtils.hh"
+#include "G4AttDef.hh"
+#include "G4AttUtils.hh"
+#include "G4AttValueFilterT.hh"
+#include "G4CreatorFactoryT.hh"
+#include "G4DimensionedDouble.hh"
+#include "G4DimensionedThreeVector.hh"
+#include "G4String.hh"
+#include "G4ThreeVector.hh"
+#include "G4TypeKey.hh"
+#include "G4TypeKeyT.hh"
+#include <assert.h>
+
+namespace G4AttFilterUtils {
+  
+  namespace {
+    template <typename T>
+    G4VAttValueFilter* newFilter() {
+      return new G4AttValueFilterT<T>;
+    }
+  }
+  
+  // Create new G4AttValue filter factory
+  G4AttValueFilterFactory* GetAttValueFilterFactory() {
+    static G4AttValueFilterFactory* factory = new G4AttValueFilterFactory;
+    static G4bool init(false);
+    
+    if (!init) {
+      // Register typekey<->creator pairs
+      factory->Register(G4TypeKeyT<G4String>(), newFilter<G4String>);
+      factory->Register(G4TypeKeyT<G4int>(), newFilter<G4int>);
+      factory->Register(G4TypeKeyT<G4double>(), newFilter<G4double>);
+      factory->Register(G4TypeKeyT<G4ThreeVector>(), newFilter<G4ThreeVector>);
+      factory->Register(G4TypeKeyT<G4bool>(), newFilter<G4bool>);
+      factory->Register(G4TypeKeyT<G4DimensionedDouble>(), newFilter<G4DimensionedDouble>);
+      factory->Register(G4TypeKeyT<G4DimensionedThreeVector>(), newFilter<G4DimensionedThreeVector>);
+      init = true;
+    }
+    
+    return factory;
+  }
+  
+  G4VAttValueFilter* GetNewFilter(const G4AttDef& def) {
+    
+    G4TypeKey myKey = def.GetTypeKey();
+    
+    // Get correct type key if original G4AttDef's being used
+    if (!myKey.IsValid()) {
+      myKey = G4AttUtils::GetKey(def);
+    }
+    
+    // Should be valid now
+    assert(myKey.IsValid());
+
+    G4AttValueFilterFactory* factory = GetAttValueFilterFactory();
+ 
+    G4VAttValueFilter*  filter = factory->Create(myKey);
+    assert (0 != filter);
+
+    return filter;
+  }
+  
+}
Index: tags/visualization-10.5-before-10.6_test/modeling/src/G4AxesModel.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/src/G4AxesModel.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/src/G4AxesModel.cc	(revision 1102)
@@ -0,0 +1,84 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4AxesModel.cc,v 1.6 2006/06/29 21:32:38 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  3rd April 2001
+// Model which knows how to draw axes.
+
+#include "G4AxesModel.hh"
+
+#include "G4ModelingParameters.hh"
+#include "G4VGraphicsScene.hh"
+#include "G4VisAttributes.hh"
+#include "G4Polyline.hh"
+#include "G4Colour.hh"
+
+G4AxesModel::~G4AxesModel () {}
+
+G4AxesModel::G4AxesModel
+(G4double x0, G4double y0, G4double z0, G4double length):
+  fX0(x0), fY0(y0), fZ0(z0), fLength(length) {
+  fGlobalTag = "G4AxesModel";
+  fGlobalDescription = fGlobalTag;
+}
+
+void G4AxesModel::DescribeYourselfTo (G4VGraphicsScene& sceneHandler) {
+
+  G4Polyline x_axis, y_axis, z_axis;
+
+  G4Colour cx(1.0, 0.0, 0.0); // color for x-axis
+  G4Colour cy(0.0, 1.0, 0.0); // color for y-axis
+  G4Colour cz(0.0, 0.0, 1.0); // color for z-axis
+
+  G4VisAttributes ax(cx);     // VA for x-axis
+  G4VisAttributes ay(cy);     // VA for y-axis
+  G4VisAttributes az(cz);     // VA for z-axis
+
+  sceneHandler.BeginPrimitives();
+
+  //----- Draw x-axis
+  x_axis.SetVisAttributes(&ax);
+  x_axis.push_back(G4Point3D(fX0,fY0,fZ0));
+  x_axis.push_back(G4Point3D((fX0 + fLength),fY0,fZ0));
+  sceneHandler.AddPrimitive(x_axis);
+
+  //----- Draw y-axis
+  y_axis.SetVisAttributes(&ay);
+  y_axis.push_back(G4Point3D(fX0,fY0,fZ0));
+  y_axis.push_back(G4Point3D(fX0,(fY0 + fLength),fZ0));
+  sceneHandler.AddPrimitive(y_axis);
+
+  //----- Draw z-axis
+  z_axis.SetVisAttributes(&az);
+  z_axis.push_back(G4Point3D(fX0,fY0,fZ0));
+  z_axis.push_back(G4Point3D(fX0,fY0,(fZ0 + fLength)));
+  sceneHandler.AddPrimitive(z_axis);
+
+  sceneHandler.EndPrimitives();
+}
Index: tags/visualization-10.5-before-10.6_test/modeling/src/G4BoundingSphereScene.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/src/G4BoundingSphereScene.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/src/G4BoundingSphereScene.cc	(revision 1102)
@@ -0,0 +1,119 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4BoundingSphereScene.cc,v 1.11 2006/06/29 21:32:40 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  7th June 1997
+// An artificial scene to reuse G4VScene code to calculate a bounding sphere.
+
+#include "G4BoundingSphereScene.hh"
+
+#include "G4VSolid.hh"
+#include "G4PhysicalVolumeModel.hh"
+#include "G4Vector3D.hh"
+
+G4BoundingSphereScene::G4BoundingSphereScene (G4VModel* pModel):
+  fpModel (pModel),
+  fRadius (-1.),
+  fpObjectTransformation (0)
+{}
+
+G4BoundingSphereScene::~G4BoundingSphereScene () {}
+
+void G4BoundingSphereScene::PreAddSolid
+(const G4Transform3D& objectTransformation,
+ const G4VisAttributes&) {
+  fpObjectTransformation = &objectTransformation;
+}
+
+G4VisExtent G4BoundingSphereScene::GetBoundingSphereExtent () {
+  return G4VisExtent (fCentre, fRadius);
+}
+
+void G4BoundingSphereScene::Accrue (const G4VSolid& solid) {
+
+  const G4VisExtent& newExtent = solid.GetExtent ();
+  G4Point3D newCentre = newExtent.GetExtentCentre ();
+  if (fpObjectTransformation) {
+    newCentre.transform (*fpObjectTransformation);
+  }
+  const G4double newRadius = newExtent.GetExtentRadius ();
+  AccrueBoundingSphere (newCentre, newRadius);
+
+  // Curtail descent - can assume daughters are contained within mother...
+  G4PhysicalVolumeModel* pPVM = dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
+  if (pPVM) pPVM->CurtailDescent();
+}
+
+void G4BoundingSphereScene::ResetBoundingSphere () {
+  fCentre = G4Point3D ();
+  fRadius = -1.;
+  fpObjectTransformation = 0;
+}
+
+void G4BoundingSphereScene::AccrueBoundingSphere
+(const G4Point3D& newCentre,
+ G4double newRadius) {
+
+  if (fRadius < 0 ) {  // First time.
+    fCentre = newCentre;
+    fRadius = newRadius;
+  }
+  else {
+    G4Vector3D join = newCentre - fCentre;
+    if (join == G4Vector3D (0., 0., 0.)) {             // Centres coincide.
+      if (fRadius < newRadius) fRadius = newRadius;
+    }
+    else if (join.mag () + newRadius <= fRadius) {  // Inside accrued sphere.
+      // Do nothing.
+    }
+    else {
+      G4Vector3D unitJoin = join.unit ();
+      G4Point3D oldExtremity1 = fCentre - fRadius * unitJoin;
+      G4Point3D newExtremity1 = newCentre - newRadius * unitJoin;
+      G4Point3D oldExtremity2 = fCentre + fRadius * unitJoin;
+      G4Point3D newExtremity2 = newCentre + newRadius * unitJoin;
+      G4Point3D extremity1;
+      if (oldExtremity1 * unitJoin < newExtremity1 * unitJoin) {
+	extremity1 = oldExtremity1;
+      }
+      else {
+	extremity1 = newExtremity1;
+      }
+      G4Point3D extremity2;
+      if (oldExtremity2 * unitJoin > newExtremity2 * unitJoin) {
+	extremity2 = oldExtremity2;
+      }
+      else {
+	extremity2 = newExtremity2;
+      }
+      fCentre = 0.5 * (extremity2 + extremity1);
+      fRadius = 0.5 * (extremity2 - extremity1).mag ();
+    }
+  }
+}
Index: tags/visualization-10.5-before-10.6_test/modeling/src/G4FlavoredParallelWorldModel.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/src/G4FlavoredParallelWorldModel.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/src/G4FlavoredParallelWorldModel.cc	(revision 1102)
@@ -0,0 +1,55 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4FlavoredParallelWorldModel.cc,v 1.7 2006/06/29 21:32:42 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// P. Mora de Freitas et M.Verderi - 19 June 1998.
+// Model for flavored parallel world volumes.
+
+#include "G4FlavoredParallelWorldModel.hh"
+
+#include "G4VFlavoredParallelWorld.hh"
+#include "G4VisAttributes.hh"
+#include "G4VPhysicalVolume.hh"
+#include "G4LogicalVolume.hh"
+
+G4FlavoredParallelWorldModel::G4FlavoredParallelWorldModel
+(G4VFlavoredParallelWorld* FPW,
+ G4int soughtDepth,
+ const G4Transform3D& modelTransformation,
+ const G4ModelingParameters* mp)
+  : G4PhysicalVolumeModel (FPW -> GetThePhysicalVolumeWorld (),
+			   soughtDepth,
+			   modelTransformation,
+			   mp),
+    theFlavoredParallelWorld (FPW) 
+{
+  FPW -> GetThePhysicalVolumeWorld () ->
+    GetLogicalVolume () -> SetVisAttributes (G4VisAttributes::GetInvisible());
+}
+
+G4FlavoredParallelWorldModel::~G4FlavoredParallelWorldModel () {}
Index: tags/visualization-10.5-before-10.6_test/modeling/src/G4HitFilterFactories.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/src/G4HitFilterFactories.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/src/G4HitFilterFactories.cc	(revision 1102)
@@ -0,0 +1,66 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+/// $Id: G4HitFilterFactories.cc,v 1.1 2006/09/12 18:53:03 tinslay Exp $
+// GEANT4 tag $Name:  $
+//
+//
+// Trajectory filter model factories creating filters
+// and associated messengers.
+//
+// Jane Tinslay March 2006
+//
+#include "G4ModelCommandsT.hh"
+#include "G4HitFilterFactories.hh"
+#include "G4AttributeFilterT.hh"
+
+// Attribute filter
+G4HitAttributeFilterFactory::G4HitAttributeFilterFactory()
+  :G4VModelFactory< G4VFilter<G4VHit> >("attributeFilter") 
+{}
+
+G4HitAttributeFilterFactory::~G4HitAttributeFilterFactory() {}
+
+G4HitAttributeFilterFactory::ModelAndMessengers
+G4HitAttributeFilterFactory::Create(const G4String& placement, const G4String& name)
+{
+  typedef G4AttributeFilterT<G4VHit> G4HitAttributeFilter;
+  // Create model
+  G4HitAttributeFilter* model = new G4HitAttributeFilter(name);
+  
+  // Create associated messengers
+  Messengers messengers;
+  
+  messengers.push_back(new G4ModelCmdSetString<G4HitAttributeFilter>(model, placement, "setAttribute"));
+  messengers.push_back(new G4ModelCmdInvert<G4HitAttributeFilter>(model, placement));
+  messengers.push_back(new G4ModelCmdActive<G4HitAttributeFilter>(model, placement));
+  messengers.push_back(new G4ModelCmdVerbose<G4HitAttributeFilter>(model, placement));
+  messengers.push_back(new G4ModelCmdReset<G4HitAttributeFilter>(model, placement));
+  messengers.push_back(new G4ModelCmdAddInterval<G4HitAttributeFilter>(model, placement, "addInterval"));
+  messengers.push_back(new G4ModelCmdAddValue<G4HitAttributeFilter>(model, placement, "addValue"));
+  
+  return ModelAndMessengers(model, messengers);
+}
+
Index: tags/visualization-10.5-before-10.6_test/modeling/src/G4HitsModel.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/src/G4HitsModel.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/src/G4HitsModel.cc	(revision 1102)
@@ -0,0 +1,67 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4HitsModel.cc,v 1.18 2006/11/14 14:42:08 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  26th August 1998.
+// Model which knows how to draw GEANT4 hits.
+
+#include "G4HitsModel.hh"
+
+#include "G4ModelingParameters.hh"
+#include "G4VGraphicsScene.hh"
+#include "G4Event.hh"
+
+G4HitsModel::~G4HitsModel () {}
+
+G4HitsModel::G4HitsModel ():
+  fpCurrentHit(0)
+{
+  fGlobalTag = "G4HitsModel for all hits.";
+  fGlobalDescription = fGlobalTag;
+}
+
+void G4HitsModel::DescribeYourselfTo (G4VGraphicsScene& sceneHandler)
+{
+  const G4Event* event = fpMP->GetEvent();
+  if (event) {
+    G4HCofThisEvent* HCE = event -> GetHCofThisEvent ();
+    if (HCE) {
+      G4int nHC = HCE -> GetCapacity ();
+      for (int iHC = 0; iHC < nHC; iHC++) {
+	G4VHitsCollection* HC = HCE -> GetHC (iHC);
+	if (HC) {
+	  for(size_t iHit = 0; iHit < HC->GetSize(); ++iHit) {
+	    fpCurrentHit = HC -> GetHit (iHit);
+	    if (fpCurrentHit) sceneHandler.AddCompound (*fpCurrentHit);
+	  }
+	}
+      }
+    }
+  }
+}
Index: tags/visualization-10.5-before-10.6_test/modeling/src/G4LogicalVolumeModel.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/src/G4LogicalVolumeModel.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/src/G4LogicalVolumeModel.cc	(revision 1102)
@@ -0,0 +1,169 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4LogicalVolumeModel.cc,v 1.14 2006/11/01 10:28:42 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  26th July 1999.
+// Model for logical volumes.
+
+#include "G4LogicalVolumeModel.hh"
+
+#include "G4VSolid.hh"
+#include "G4LogicalVolume.hh"
+#include "G4PVPlacement.hh"
+#include "G4ModelingParameters.hh"
+#include "G4VGraphicsScene.hh"
+#include "G4DrawVoxels.hh"
+#include "G4VSensitiveDetector.hh"
+#include "G4VReadOutGeometry.hh"
+
+G4LogicalVolumeModel::G4LogicalVolumeModel
+(G4LogicalVolume*            pLV,
+ G4int                       soughtDepth,
+ G4bool                      booleans,
+ G4bool                      voxels,
+ G4bool                      readout,
+ const G4Transform3D&        modelTransformation,
+ const G4ModelingParameters* pMP):
+  // Instantiate a G4PhysicalVolumeModel with a G4PVPlacement to
+  // represent this logical volume.  It has no rotation and a null
+  // translation so that the logical volume will be seen in its own
+  // reference system.  It will be added to the physical volume store
+  // but it will not be part of the normal geometry heirarchy so it
+  // has no mother.
+  G4PhysicalVolumeModel
+(new G4PVPlacement (0,                   // No rotation.
+		    G4ThreeVector(),     // Null traslation.
+		    "PhysVol representaion of LogVol " + pLV -> GetName (),
+		    pLV,
+		    0,                   // No mother.
+		    false,               // Not "MANY".
+		    0),                  // Copy number.
+ soughtDepth,
+ modelTransformation,
+ pMP,
+ true),                                  // Use full extent.
+  fpLV (pLV),
+  fBooleans (booleans),
+  fVoxels (voxels),
+  fReadout (readout)
+{
+  fGlobalTag = fpLV -> GetName ();
+  fGlobalDescription = "G4LogicalVolumeModel " + fGlobalTag;
+}
+
+G4LogicalVolumeModel::~G4LogicalVolumeModel () {}
+
+void G4LogicalVolumeModel::DescribeYourselfTo
+(G4VGraphicsScene& sceneHandler) {
+
+  // Store current modeling parameters and ensure nothing is culled.
+  const G4ModelingParameters* tmpMP = fpMP;
+  G4ModelingParameters nonCulledMP;
+  if (fpMP) nonCulledMP = *fpMP;
+  nonCulledMP.SetCulling (false);
+  fpMP = &nonCulledMP;    
+  G4PhysicalVolumeModel::DescribeYourselfTo (sceneHandler);
+  fpMP = tmpMP;
+
+  if (fVoxels) {
+    if (fpTopPV->GetLogicalVolume()->GetVoxelHeader()) {
+      // Add Voxels.
+      G4DrawVoxels dv;
+
+      // FIXME : LG 1 May 2009 : return a pointer...should be destroy by the compiler
+      G4PlacedPolyhedronList* pPPL =
+	dv.CreatePlacedPolyhedra (fpTopPV -> GetLogicalVolume ());
+      for (size_t i = 0; i < pPPL -> size (); i++) {
+	const G4Transform3D& transform = (*pPPL)[i].GetTransform ();
+	const G4Polyhedron& polyhedron = (*pPPL)[i].GetPolyhedron ();
+	sceneHandler.BeginPrimitives (transform);
+        printf("G4LogicalVolumeModel::DescribeYourselfTo BEFORE ADD %d\n",fpTopPV -> GetLogicalVolume ());
+        if (&polyhedron) {
+          printf("G4LogicalVolumeModel::DescribeYourselfTo  poly FAILED\n");
+        } else {
+          printf("G4LogicalVolumeModel::DescribeYourselfTo  poly OK\n");
+        }
+        sceneHandler.AddPrimitive (polyhedron);
+        printf("G4LogicalVolumeModel::DescribeYourselfTo AFTER ADD\n");
+	sceneHandler.EndPrimitives ();
+      }
+      delete pPPL;
+    }
+  }
+
+  if (fReadout) {
+    // Draw readout geometry...
+    G4VSensitiveDetector* sd = fpLV->GetSensitiveDetector();
+    if (sd) {
+      G4VReadOutGeometry* roGeom = sd->GetROgeometry();
+      if (roGeom) {
+	G4VPhysicalVolume* roWorld = roGeom->GetROWorld();
+	G4cout << "Readout geometry \"" << roGeom->GetName()
+	       << "\" with top physical volume \""
+	       << roWorld->GetName()
+	       << "\"" << G4endl;
+	G4PhysicalVolumeModel pvModel(roWorld);
+	pvModel.SetModelingParameters(fpMP);
+	pvModel.DescribeYourselfTo(sceneHandler);
+      }
+    }
+  }
+}
+
+// This called from G4PhysicalVolumeModel::DescribeAndDescend by the
+// virtual function mechanism.
+void G4LogicalVolumeModel::DescribeSolid
+(const G4Transform3D& theAT,
+ G4VSolid* pSol,
+ const G4VisAttributes* pVisAttribs,
+ G4VGraphicsScene& sceneHandler) {
+
+  if (fBooleans) {
+    // Look for "constituents".  Could be a Boolean solid.
+    G4VSolid* pSol0 = pSol -> GetConstituentSolid (0);
+    if (pSol0) {  // Composite solid...
+      G4VSolid* pSol1 = pSol -> GetConstituentSolid (1);
+      if (!pSol1) {
+	G4Exception
+	  ("G4PhysicalVolumeModel::DescribeSolid:"
+	   " 2nd component solid is missing.");
+      }
+      // Draw these constituents white and "forced wireframe"...
+      G4VisAttributes constituentAttributes;
+      constituentAttributes.SetForceWireframe(true);
+      DescribeSolid (theAT, pSol0, &constituentAttributes, sceneHandler);
+      DescribeSolid (theAT, pSol1, &constituentAttributes, sceneHandler);
+    }
+  }
+
+  // In any case draw the original/resultant solid...
+  sceneHandler.PreAddSolid (theAT, *pVisAttribs);
+  pSol -> DescribeYourselfTo (sceneHandler);
+  sceneHandler.PostAddSolid ();
+}
Index: tags/visualization-10.5-before-10.6_test/modeling/src/G4ModelingParameters.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/src/G4ModelingParameters.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/src/G4ModelingParameters.cc	(revision 1102)
@@ -0,0 +1,204 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4ModelingParameters.cc,v 1.15 2006/11/14 14:42:08 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  31st December 1997.
+// Parameters associated with the modeling of GEANT4 objects.
+
+#include "G4ModelingParameters.hh"
+
+#include "G4ios.hh"
+#include "G4VisAttributes.hh"
+#include "G4ExceptionSeverity.hh"
+#include "G4Polyhedron.hh"
+
+G4ModelingParameters::G4ModelingParameters ():
+  fWarning               (true),
+  fpDefaultVisAttributes (0),
+  fDrawingStyle          (wf),
+  fCulling               (false),
+  fCullInvisible         (false),
+  fDensityCulling        (false),
+  fVisibleDensity        (0.01 * g / cm3),
+  fCullCovered           (false),
+  fExplodeFactor         (1.),
+  fNoOfSides             (24),
+  fpSectionPolyhedron    (0),
+  fpCutawayPolyhedron    (0),
+  fpEvent                (0)
+{}
+
+G4ModelingParameters::G4ModelingParameters
+(const G4VisAttributes* pDefaultVisAttributes,
+ G4ModelingParameters::DrawingStyle drawingStyle,
+ G4bool isCulling,
+ G4bool isCullingInvisible,
+ G4bool isDensityCulling,
+ G4double visibleDensity,
+ G4bool isCullingCovered,
+ G4int noOfSides
+ ):
+  fWarning        (true),
+  fpDefaultVisAttributes (pDefaultVisAttributes),
+  fDrawingStyle   (drawingStyle),
+  fCulling        (isCulling),
+  fCullInvisible  (isCullingInvisible),
+  fDensityCulling (isDensityCulling),
+  fVisibleDensity (visibleDensity),
+  fCullCovered    (isCullingCovered),
+  fExplodeFactor  (1.),
+  fNoOfSides      (noOfSides),
+  fpSectionPolyhedron (0),
+  fpCutawayPolyhedron (0),
+  fpEvent             (0)
+{}
+
+G4ModelingParameters::~G4ModelingParameters ()
+{
+  delete fpSectionPolyhedron;
+  delete fpCutawayPolyhedron;
+}
+
+void G4ModelingParameters::SetVisibleDensity (G4double visibleDensity) {
+  const G4double reasonableMaximum = 10.0 * g / cm3;
+  if (visibleDensity < 0 && fWarning) {
+    G4cout << "G4ModelingParameters::SetVisibleDensity: attempt to set negative "
+      "density - ignored." << G4endl;
+  }
+  else {
+    if (fVisibleDensity > reasonableMaximum && fWarning) {
+      G4cout << "G4ModelingParameters::SetVisibleDensity: density > "
+	   << reasonableMaximum
+	   << " g / cm3 - did you mean this?"
+	   << G4endl;
+    }
+    fVisibleDensity = visibleDensity;
+  }
+}
+
+G4int G4ModelingParameters::SetNoOfSides (G4int nSides) {
+  const G4int  nSidesMin = 12;
+  if (nSides < nSidesMin) {
+    nSides = nSidesMin;
+    if (fWarning)
+      G4cout << "G4ModelingParameters::SetNoOfSides: attempt to set the"
+	"\nnumber of sides per circle < " << nSidesMin
+	     << "; forced to" << nSides << G4endl;
+  }
+  fNoOfSides = nSides;
+  return fNoOfSides;
+}
+
+std::ostream& operator << (std::ostream& os, const G4ModelingParameters& mp)
+{
+  os << "Modeling parameters (warning ";
+  if (mp.fWarning) os << "true";
+  else os << "false";
+  os << "):";
+
+  const G4VisAttributes* va = mp.fpDefaultVisAttributes;
+  os << "\n  Default vis. attributes: ";
+  if (va) os << *va;
+  else os << "none";
+
+  os << "\n  Current requested drawing style: ";
+  switch (mp.fDrawingStyle) {
+  case G4ModelingParameters::wf:
+    os << "wireframe"; break;
+  case G4ModelingParameters::hlr:
+    os << "hidden line removal (hlr)"; break;
+  case G4ModelingParameters::hsr:
+    os << "surface (hsr)"; break;
+  case G4ModelingParameters::hlhsr:
+    os << "surface and edges (hlhsr)"; break;
+  default: os << "unrecognised"; break;
+  }
+
+  os << "\n  Culling: ";
+  if (mp.fCulling) os << "on";
+  else            os << "off";
+
+  os << "\n  Culling invisible objects: ";
+  if (mp.fCullInvisible) os << "on";
+  else                  os << "off";
+
+  os << "\n  Density culling: ";
+  if (mp.fDensityCulling) {
+    os << "on - invisible if density less than "
+       << mp.fVisibleDensity / (1. * g / cm3) << " g cm^-3";
+  }
+  else os << "off";
+
+  os << "\n  Culling daughters covered by opaque mothers: ";
+  if (mp.fCullCovered) os << "on";
+  else                os << "off";
+
+  os << "\n  Explode factor: " << mp.fExplodeFactor
+     << " about centre: " << mp.fExplodeCentre;
+
+  os << "\n  No. of sides used in circle polygon approximation: "
+     << mp.fNoOfSides;
+
+  os << "\n  Section (DCUT) polyhedron pointer: ";
+  if (!mp.fpSectionPolyhedron) os << "non-";
+  os << "null";
+
+  os << "\n  Cutaway (DCUT) polyhedron pointer: ";
+  if (!mp.fpCutawayPolyhedron) os << "non-";
+  os << "null";
+
+  os << "\n  Event pointer: " << mp.fpEvent;
+
+  return os;
+}
+
+G4bool G4ModelingParameters::operator !=
+(const G4ModelingParameters& mp) const {
+
+  if (
+      (fWarning                != mp.fWarning)                ||
+      (*fpDefaultVisAttributes != *mp.fpDefaultVisAttributes) ||
+      (fCulling                != mp.fCulling)                ||
+      (fCullInvisible          != mp.fCullInvisible)          ||
+      (fDensityCulling         != mp.fDensityCulling)         ||
+      (fCullCovered            != mp.fCullCovered)            ||
+      (fExplodeFactor          != mp.fExplodeFactor)          ||
+      (fExplodeCentre          != mp.fExplodeCentre)          ||
+      (fNoOfSides              != mp.fNoOfSides)              ||
+      (fpSectionPolyhedron     != mp.fpSectionPolyhedron)     ||
+      (fpCutawayPolyhedron     != mp.fpCutawayPolyhedron)     ||
+      (fpEvent                 != mp.fpEvent)
+      )
+    return true;
+
+  if (fDensityCulling &&
+      (fVisibleDensity != mp.fVisibleDensity)) return true;
+
+  return false;
+}
Index: tags/visualization-10.5-before-10.6_test/modeling/src/G4NullModel.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/src/G4NullModel.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/src/G4NullModel.cc	(revision 1102)
@@ -0,0 +1,44 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4NullModel.cc,v 1.9 2006/06/29 21:32:50 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  4th April 1998.
+// Null model - simply a holder for modeling parameter.
+// DO NOT INVOKE DescribeYourself.
+
+#include "G4NullModel.hh"
+
+G4NullModel::G4NullModel (const G4ModelingParameters* pMP):
+  G4VModel (G4Transform3D(), pMP) {}
+
+G4NullModel::~G4NullModel () {}
+
+void G4NullModel::DescribeYourselfTo (G4VGraphicsScene&) {
+  G4Exception ("G4NullModel::DescribeYourselfTo called.");
+}
Index: tags/visualization-10.5-before-10.6_test/modeling/src/G4PhysicalVolumeMassScene.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/src/G4PhysicalVolumeMassScene.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/src/G4PhysicalVolumeMassScene.cc	(revision 1102)
@@ -0,0 +1,137 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4PhysicalVolumeMassScene.cc,v 1.7 2006/11/06 09:24:13 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  10th August 1998.
+// An artificial scene to find physical volumes.
+
+#include "G4PhysicalVolumeMassScene.hh"
+
+#include "G4VSolid.hh"
+#include "G4Vector3D.hh"
+#include "G4PhysicalVolumeModel.hh"
+#include "G4LogicalVolume.hh"
+#include "G4Polyhedron.hh"
+#include "G4Material.hh"
+#include "G4VPVParameterisation.hh"
+#include "G4UnitsTable.hh"
+
+G4PhysicalVolumeMassScene::G4PhysicalVolumeMassScene
+(G4PhysicalVolumeModel* pPVModel):
+  fpPVModel (pPVModel),
+  fVolume (0.),
+  fMass (0.),
+  fpLastPV (0),
+  fPVPCount (0),
+  fLastDepth (0),
+  fLastDensity (0.)
+{}
+
+G4PhysicalVolumeMassScene::~G4PhysicalVolumeMassScene () {}
+
+void G4PhysicalVolumeMassScene::Reset ()
+{
+  fVolume = 0.;
+  fMass = 0.;
+  fpLastPV = 0;
+  fPVPCount = 0;
+  fLastDepth = 0;
+  fLastDensity = 0.;
+  fDensityStack.clear();
+}
+
+void G4PhysicalVolumeMassScene::AccrueMass (const G4VSolid& solid)
+{
+  G4int currentDepth = fpPVModel->GetCurrentDepth();
+  G4VPhysicalVolume* pCurrentPV = fpPVModel->GetCurrentPV();
+  //G4LogicalVolume* pCurrentLV = fpPVModel->GetCurrentLV();
+  G4Material* pCurrentMaterial = fpPVModel->GetCurrentMaterial();
+
+  if (pCurrentPV != fpLastPV) {
+    fpLastPV = pCurrentPV;
+    fPVPCount = 0;
+  }
+
+  G4double currentVolume = ((G4VSolid&)solid).GetCubicVolume();
+  G4double currentDensity = pCurrentMaterial->GetDensity();
+  /* Using G4Polyhedron... (gives slightly different answers on Tubs, e.g.).
+  G4Polyhedron* pPolyhedron = solid.GetPolyhedron();
+  if (!pPolyhedron) {
+    G4cout << 
+      "G4PhysicalVolumeMassScene::AccrueMass: WARNING:"
+      "\n  No G4Polyhedron for" << solid.GetEntityType() <<
+      ".  \"" << solid.GetName() << "\" will not be accounted."
+      "\n  It will be as though not there, i.e., the density as its mother."
+      "\n  Its daughters will still be found and accounted."
+	   << G4endl;
+    currentVolume = 0.;
+    currentDensity = 0.;
+  }
+  */
+
+  if (currentDepth == 0) fVolume = currentVolume;
+
+  if (currentDepth > fLastDepth) {
+    fDensityStack.push_back (fLastDensity);
+  } else if (currentDepth < fLastDepth) {
+    fDensityStack.pop_back();
+  }
+  fLastDepth = currentDepth;
+  fLastDensity = currentDensity;
+  G4double motherDensity = 0.;
+  if (currentDepth > 0) motherDensity = fDensityStack.back();
+
+  G4double subtractedMass = currentVolume * motherDensity;
+  G4double addedMass = currentVolume * currentDensity;
+  fMass -= subtractedMass;
+  fMass += addedMass;
+  /* Debug
+  G4cout << "current vol = "
+	 << G4BestUnit (currentVolume,"Volume")
+	 << ", current density = "
+	 << G4BestUnit (currentDensity, "Volumic Mass")
+	 << ", mother density = "
+	 << G4BestUnit (motherDensity, "Volumic Mass")
+	 << G4endl;
+  G4cout << "Subtracted mass = " << G4BestUnit (subtractedMass, "Mass")
+	 << ", added mass = " << G4BestUnit (addedMass, "Mass")
+	 << ", new mass = " << G4BestUnit (fMass, "Mass")
+	 << G4endl;
+  */
+  if (fMass < 0.) {
+    G4cout <<
+      "G4PhysicalVolumeMassScene::AccrueMass: WARNING:"
+      "\n  Mass going negative for \""
+	   << pCurrentPV->GetName() <<
+      "\", copy "
+	   << pCurrentPV->GetCopyNo() <<
+      ".  Larger than mother?"
+	   << G4endl;
+  }
+}
Index: tags/visualization-10.5-before-10.6_test/modeling/src/G4PhysicalVolumeModel.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/src/G4PhysicalVolumeModel.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/src/G4PhysicalVolumeModel.cc	(revision 1102)
@@ -0,0 +1,788 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4PhysicalVolumeModel.cc,v 1.63 2007/11/10 14:56:36 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  31st December 1997.
+// Model for physical volumes.
+
+#include "G4PhysicalVolumeModel.hh"
+
+#include "G4ModelingParameters.hh"
+#include "G4VGraphicsScene.hh"
+#include "G4VPhysicalVolume.hh"
+#include "G4VPVParameterisation.hh"
+#include "G4LogicalVolume.hh"
+#include "G4VSolid.hh"
+#include "G4Material.hh"
+#include "G4VisAttributes.hh"
+#include "G4BoundingSphereScene.hh"
+#include "G4PhysicalVolumeSearchScene.hh"
+#include "G4TransportationManager.hh"
+#include "G4Polyhedron.hh"
+#include "G4AttDefStore.hh"
+#include "G4AttDef.hh"
+#include "G4AttValue.hh"
+#include "G4UnitsTable.hh"
+#include "G4Vector3D.hh"
+
+#include <sstream>
+
+G4bool G4PhysicalVolumeModel::G4PhysicalVolumeNodeID::operator<
+  (const G4PhysicalVolumeModel::G4PhysicalVolumeNodeID& right) const
+{
+  if (fpPV < right.fpPV) return true;
+  if (fpPV == right.fpPV) {
+    if (fCopyNo < right.fCopyNo) return true;
+    if (fCopyNo == right.fCopyNo)
+      return fNonCulledDepth < right.fNonCulledDepth;
+  }
+  return false;
+}
+
+std::ostream& operator<<
+  (std::ostream& os, const G4PhysicalVolumeModel::G4PhysicalVolumeNodeID node)
+{
+  G4VPhysicalVolume* pPV = node.GetPhysicalVolume();
+  if (pPV) {
+    os << pPV->GetName()
+       << ':' << node.GetCopyNo()
+       << '[' << node.GetNonCulledDepth() << ']';
+  } else {
+    os << "Null node";
+  }
+  return os;
+}
+
+G4PhysicalVolumeModel::G4PhysicalVolumeModel
+(G4VPhysicalVolume*          pVPV,
+ G4int                       requestedDepth,
+ const G4Transform3D& modelTransformation,
+ const G4ModelingParameters* pMP,
+ G4bool useFullExtent):
+  G4VModel        (modelTransformation, pMP),
+  fpTopPV         (pVPV),
+  fTopPVName      (pVPV -> GetName ()),
+  fTopPVCopyNo    (pVPV -> GetCopyNo ()),
+  fRequestedDepth (requestedDepth),
+  fUseFullExtent  (useFullExtent),
+  fCurrentDepth   (0),
+  fpCurrentPV     (0),
+  fpCurrentLV     (0),
+  fpCurrentMaterial (0),
+  fpCurrentTransform (0),
+  fCurtailDescent (false),
+  fpClippingPolyhedron (0),
+  fClippingMode   (subtraction)
+{
+  std::ostringstream o;
+  o << fpTopPV -> GetCopyNo ();
+  fGlobalTag = fpTopPV -> GetName () + "." + o.str();
+  fGlobalDescription = "G4PhysicalVolumeModel " + fGlobalTag;
+
+  CalculateExtent ();
+}
+
+G4PhysicalVolumeModel::~G4PhysicalVolumeModel ()
+{
+  delete fpClippingPolyhedron;
+}
+
+void G4PhysicalVolumeModel::CalculateExtent ()
+{
+  if (fUseFullExtent) {
+    fExtent = fpTopPV -> GetLogicalVolume () -> GetSolid () -> GetExtent ();
+  }
+  else {
+    G4BoundingSphereScene bsScene(this);
+    const G4int tempRequestedDepth = fRequestedDepth;
+    fRequestedDepth = -1;  // Always search to all depths to define extent.
+    const G4ModelingParameters* tempMP = fpMP;
+    G4ModelingParameters mParams
+      (0,      // No default vis attributes needed.
+       G4ModelingParameters::wf,  // wireframe (not relevant for this).
+       true,   // Global culling.
+       true,   // Cull invisible volumes.
+       false,  // Density culling.
+       0.,     // Density (not relevant if density culling false).
+       true,   // Cull daughters of opaque mothers.
+       24);    // No of sides (not relevant for this operation).
+    fpMP = &mParams;
+    DescribeYourselfTo (bsScene);
+    G4double radius = bsScene.GetRadius();
+    if (radius < 0.) {  // Nothing in the scene.
+      fExtent = fpTopPV -> GetLogicalVolume () -> GetSolid () -> GetExtent ();
+    } else {
+      // Transform back to coordinates relative to the top
+      // transformation, which is in G4VModel::fTransform.  This makes
+      // it conform to all models, which are defined by a
+      // transformation and an extent relative to that
+      // transformation...
+      G4Point3D centre = bsScene.GetCentre();
+      centre.transform(fTransform.inverse());
+      fExtent = G4VisExtent(centre, radius);
+    }
+    fpMP = tempMP;
+    fRequestedDepth = tempRequestedDepth;
+  }
+}
+
+void G4PhysicalVolumeModel::DescribeYourselfTo
+(G4VGraphicsScene& sceneHandler)
+{
+  if (!fpMP) G4Exception
+    ("G4PhysicalVolumeModel::DescribeYourselfTo: No modeling parameters.");
+
+  // For safety...
+  fCurrentDepth = 0;
+
+  G4Transform3D startingTransformation = fTransform;
+
+  VisitGeometryAndGetVisReps
+    (fpTopPV,
+     fRequestedDepth,
+     startingTransformation,
+     sceneHandler);
+
+  // Clear data...
+  fCurrentDepth     = 0;
+  fpCurrentPV       = 0;
+  fpCurrentLV       = 0;
+  fpCurrentMaterial = 0;
+  fFullPVPath.clear();
+  fDrawnPVPath.clear();
+}
+
+G4String G4PhysicalVolumeModel::GetCurrentTag () const
+{
+  if (fpCurrentPV) {
+    std::ostringstream o;
+    o << fpCurrentPV -> GetCopyNo ();
+    return fpCurrentPV -> GetName () + "." + o.str();
+  }
+  else {
+    return "WARNING: NO CURRENT VOLUME - global tag is " + fGlobalTag;
+  }
+}
+
+G4String G4PhysicalVolumeModel::GetCurrentDescription () const
+{
+  return "G4PhysicalVolumeModel " + GetCurrentTag ();
+}
+
+void G4PhysicalVolumeModel::VisitGeometryAndGetVisReps
+(G4VPhysicalVolume* pVPV,
+ G4int requestedDepth,
+ const G4Transform3D& theAT,
+ G4VGraphicsScene& sceneHandler)
+{
+  // Visits geometry structure to a given depth (requestedDepth), starting
+  //   at given physical volume with given starting transformation and
+  //   describes volumes to the scene handler.
+  // requestedDepth < 0 (default) implies full visit.
+  // theAT is the Accumulated Transformation.
+
+  // Find corresponding logical volume and (later) solid, storing in
+  // local variables to preserve re-entrancy.
+  G4LogicalVolume* pLV  = pVPV -> GetLogicalVolume ();
+
+  G4VSolid* pSol;
+  G4Material* pMaterial;
+
+  if (!(pVPV -> IsReplicated ())) {
+    // Non-replicated physical volume.
+    pSol = pLV -> GetSolid ();
+    pMaterial = pLV -> GetMaterial ();
+    DescribeAndDescend (pVPV, requestedDepth, pLV, pSol, pMaterial,
+			theAT, sceneHandler);
+  }
+  else {
+    // Replicated or parametrised physical volume.
+    EAxis axis;
+    G4int nReplicas;
+    G4double width;
+    G4double offset;
+    G4bool consuming;
+    pVPV -> GetReplicationData (axis, nReplicas, width,  offset, consuming);
+    G4VPVParameterisation* pP = pVPV -> GetParameterisation ();
+    if (pP) {  // Parametrised volume.
+      for (int n = 0; n < nReplicas; n++) {
+	pSol = pP -> ComputeSolid (n, pVPV);
+	pMaterial = pP -> ComputeMaterial (n, pVPV);
+	pP -> ComputeTransformation (n, pVPV);
+	pSol -> ComputeDimensions (pP, n, pVPV);
+	pVPV -> SetCopyNo (n);
+	DescribeAndDescend (pVPV, requestedDepth, pLV, pSol, pMaterial,
+			    theAT, sceneHandler);
+      }
+    }
+    else {  // Plain replicated volume.  From geometry_guide.txt...
+      // The replica's positions are claculated by means of a linear formula.
+      // Replication may occur along:
+      // 
+      // o Cartesian axes (kXAxis,kYAxis,kZAxis)
+      // 
+      //   The replications, of specified width have coordinates of
+      //   form (-width*(nReplicas-1)*0.5+n*width,0,0) where n=0.. nReplicas-1
+      //   for the case of kXAxis, and are unrotated.
+      // 
+      // o Radial axis (cylindrical polar) (kRho)
+      // 
+      //   The replications are cons/tubs sections, centred on the origin
+      //   and are unrotated.
+      //   They have radii of width*n+offset to width*(n+1)+offset
+      //                      where n=0..nReplicas-1
+      // 
+      // o Phi axis (cylindrical polar) (kPhi)
+      //   The replications are `phi sections' or wedges, and of cons/tubs form
+      //   They have phi of offset+n*width to offset+(n+1)*width where
+      //   n=0..nReplicas-1
+      // 
+      pSol = pLV -> GetSolid ();
+      pMaterial = pLV -> GetMaterial ();
+      G4ThreeVector originalTranslation = pVPV -> GetTranslation ();
+      G4RotationMatrix* pOriginalRotation = pVPV -> GetRotation ();
+      G4double originalRMin = 0., originalRMax = 0.;
+      if (axis == kRho && pSol->GetEntityType() == "G4Tubs") {
+	originalRMin = ((G4Tubs*)pSol)->GetInnerRadius();
+	originalRMax = ((G4Tubs*)pSol)->GetOuterRadius();
+      }
+      G4bool visualisable = true;
+      for (int n = 0; n < nReplicas; n++) {
+	G4ThreeVector translation;  // Null.
+	G4RotationMatrix rotation;  // Null - life long enough for visualizing.
+	G4RotationMatrix* pRotation = 0;
+	switch (axis) {
+	default:
+	case kXAxis:
+	  translation = G4ThreeVector (-width*(nReplicas-1)*0.5+n*width,0,0);
+	  break;
+	case kYAxis:
+	  translation = G4ThreeVector (0,-width*(nReplicas-1)*0.5+n*width,0);
+	  break;
+	case kZAxis:
+	  translation = G4ThreeVector (0,0,-width*(nReplicas-1)*0.5+n*width);
+	  break;
+	case kRho:
+	  if (pSol->GetEntityType() == "G4Tubs") {
+	    ((G4Tubs*)pSol)->SetInnerRadius(width*n+offset);
+	    ((G4Tubs*)pSol)->SetOuterRadius(width*(n+1)+offset);
+	  } else {
+	    if (fpMP->IsWarning())
+	      G4cout <<
+		"G4PhysicalVolumeModel::VisitGeometryAndGetVisReps: WARNING:"
+		"\n  built-in replicated volumes replicated in radius for "
+		     << pSol->GetEntityType() <<
+		"-type\n  solids (your solid \""
+		     << pSol->GetName() <<
+		"\") are not visualisable."
+		     << G4endl;
+	    visualisable = false;
+	  }
+	  break;
+	case kPhi:
+	  rotation.rotateZ (-(offset+(n+0.5)*width));
+	  // Minus Sign because for the physical volume we need the
+	  // coordinate system rotation.
+	  pRotation = &rotation;
+	  break;
+	} 
+	pVPV -> SetTranslation (translation);
+	pVPV -> SetRotation    (pRotation);
+	pVPV -> SetCopyNo (n);
+	if (visualisable) {
+	  DescribeAndDescend (pVPV, requestedDepth, pLV, pSol, pMaterial,
+			    theAT, sceneHandler);
+	}
+      }
+      // Restore originals...
+      pVPV -> SetTranslation (originalTranslation);
+      pVPV -> SetRotation    (pOriginalRotation);
+      if (axis == kRho && pSol->GetEntityType() == "G4Tubs") {
+	((G4Tubs*)pSol)->SetInnerRadius(originalRMin);
+	((G4Tubs*)pSol)->SetOuterRadius(originalRMax);
+      }
+    }
+  }
+
+  return;
+}
+
+void G4PhysicalVolumeModel::DescribeAndDescend
+(G4VPhysicalVolume* pVPV,
+ G4int requestedDepth,
+ G4LogicalVolume* pLV,
+ G4VSolid* pSol,
+ G4Material* pMaterial,
+ const G4Transform3D& theAT,
+ G4VGraphicsScene& sceneHandler)
+{
+  // Maintain useful data members...
+  fpCurrentPV = pVPV;
+  fpCurrentLV = pLV;
+  fpCurrentMaterial = pMaterial;
+
+  const G4RotationMatrix objectRotation = pVPV -> GetObjectRotationValue ();
+  const G4ThreeVector&  translation     = pVPV -> GetTranslation ();
+  G4Transform3D theLT (G4Transform3D (objectRotation, translation));
+
+  // Compute the accumulated transformation...
+  // Note that top volume's transformation relative to the world
+  // coordinate system is specified in theAT == startingTransformation
+  // = fTransform (see DescribeYourselfTo), so first time through the
+  // volume's own transformation, which is only relative to its
+  // mother, i.e., not relative to the world coordinate system, should
+  // not be accumulated.
+  G4Transform3D theNewAT (theAT);
+  if (fCurrentDepth != 0) theNewAT = theAT * theLT;
+  fpCurrentTransform = &theNewAT;
+
+  /********************************************************
+  G4cout << "G4PhysicalVolumeModel::DescribeAndDescend: "
+	 << pVPV -> GetName () << "." << pVPV -> GetCopyNo ();
+  G4cout << "\n  theAT: ";
+  G4cout << "\n    Rotation: ";
+  G4RotationMatrix rotation = theAT.getRotation ();
+  G4cout << rotation.thetaX() << ", "
+	 << rotation.phiX() << ", "
+	 << rotation.thetaY() << ", "
+	 << rotation.phiY() << ", "
+	 << rotation.thetaZ() << ", "
+	 << rotation.phiZ();
+  G4cout << "\n    Translation: " << theAT.getTranslation();
+  G4cout << "\n  theNewAT: ";
+  G4cout << "\n    Rotation: ";
+  rotation = theNewAT.getRotation ();
+  G4cout << rotation.thetaX() << ", "
+	 << rotation.phiX() << ", "
+	 << rotation.thetaY() << ", "
+	 << rotation.phiY() << ", "
+	 << rotation.thetaZ() << ", "
+	 << rotation.phiZ();
+  G4cout << "\n    Translation: " << theNewAT.getTranslation();
+  G4cout << G4endl;
+  **********************************************************/
+
+  // Make decision to draw...
+  const G4VisAttributes* pVisAttribs = pLV->GetVisAttributes();
+  if (!pVisAttribs) pVisAttribs = fpMP->GetDefaultVisAttributes();
+  // Beware - pVisAttribs might still be zero - create a temporary default one...
+  G4bool visAttsCreated = false;
+  if (!pVisAttribs) {
+    pVisAttribs = new G4VisAttributes;
+    visAttsCreated = true;
+  }
+
+  // From here, can assume pVisAttribs is a valid pointer.
+
+  G4bool thisToBeDrawn = true;
+
+  // There are various reasons why this volume
+  // might not be drawn...
+  G4bool culling = fpMP->IsCulling();
+  G4bool cullingInvisible = fpMP->IsCullingInvisible();
+  G4bool markedVisible = pVisAttribs->IsVisible();
+  G4bool cullingLowDensity = fpMP->IsDensityCulling();
+  G4double density = pMaterial? pMaterial->GetDensity(): 0;
+  G4double densityCut = fpMP -> GetVisibleDensity ();
+
+  // 1) Global culling is on....
+  if (culling) {
+    // 2) Culling of invisible volumes is on...
+    if (cullingInvisible) {
+      // 3) ...and the volume is marked not visible...
+      if (!markedVisible) thisToBeDrawn = false;
+    }
+    // 4) Or culling of low density volumes is on...
+    if (cullingLowDensity) {
+      // 5) ...and density is less than cut value...
+      if (density < densityCut) thisToBeDrawn = false;
+    }
+  }
+
+  // Update full path of physical volumes...
+  G4int copyNo = fpCurrentPV->GetCopyNo();
+  fFullPVPath.push_back
+    (G4PhysicalVolumeNodeID(fpCurrentPV,copyNo,fCurrentDepth));
+
+  if (thisToBeDrawn) {
+
+    // Update path of drawn physical volumes...
+    G4int copyNo = fpCurrentPV->GetCopyNo();
+    fDrawnPVPath.push_back
+      (G4PhysicalVolumeNodeID(fpCurrentPV,copyNo,fCurrentDepth));
+
+    if (fpMP->IsExplode() && fDrawnPVPath.size() == 1) {
+      // For top-level drawn volumes, explode along radius...
+      G4Transform3D centering = G4Translate3D(fpMP->GetExplodeCentre());
+      G4Transform3D centred = centering.inverse() * theNewAT;
+      G4Scale3D scale;
+      G4Rotate3D rotation;
+      G4Translate3D translation;
+      centred.getDecomposition(scale, rotation, translation);
+      G4double explodeFactor = fpMP->GetExplodeFactor();
+      G4Translate3D newTranslation =
+	G4Translate3D(explodeFactor * translation.dx(),
+		      explodeFactor * translation.dy(),
+		      explodeFactor * translation.dz());
+      theNewAT = centering * newTranslation * rotation * scale;
+    }
+
+    DescribeSolid (theNewAT, pSol, pVisAttribs, sceneHandler);
+
+  }
+
+  // Make decision to draw daughters, if any.  There are various
+  // reasons why daughters might not be drawn...
+
+  // First, reasons that do not depend on culling policy...
+  G4int nDaughters = pLV->GetNoDaughters();
+  G4bool daughtersToBeDrawn = true;
+  // 1) There are no daughters...
+  if (!nDaughters) daughtersToBeDrawn = false;
+  // 2) We are at the limit if requested depth...
+  else if (requestedDepth == 0) daughtersToBeDrawn = false;
+  // 3) The user has asked that the descent be curtailed...
+  else if (fCurtailDescent) daughtersToBeDrawn = false;
+
+  // Now, reasons that depend on culling policy...
+  else {
+    G4bool culling = fpMP->IsCulling();
+    G4bool cullingInvisible = fpMP->IsCullingInvisible();
+    G4bool daughtersInvisible = pVisAttribs->IsDaughtersInvisible();
+    // Culling of covered daughters request.  This is computed in
+    // G4VSceneHandler::CreateModelingParameters() depending on view
+    // parameters...
+    G4bool cullingCovered = fpMP->IsCullingCovered();
+    G4bool surfaceDrawing =
+      fpMP->GetDrawingStyle() == G4ModelingParameters::hsr ||
+      fpMP->GetDrawingStyle() == G4ModelingParameters::hlhsr;    
+    if (pVisAttribs->IsForceDrawingStyle()) {
+      switch (pVisAttribs->GetForcedDrawingStyle()) {
+      default:
+      case G4VisAttributes::wireframe: surfaceDrawing = false; break;
+      case G4VisAttributes::solid: surfaceDrawing = true; break;
+      }
+    }
+    G4bool opaque = pVisAttribs->GetColour().GetAlpha() >= 1.;
+    // 4) Global culling is on....
+    if (culling) {
+      // 5) ..and culling of invisible volumes is on...
+      if (cullingInvisible) {
+	// 6) ...and the mother requests daughters invisible
+	if (daughtersInvisible) daughtersToBeDrawn = false;
+      }
+      // 7) Or culling of covered daughters is requested...
+      if (cullingCovered) {
+	// 8) ...and surface drawing is operating...
+	if (surfaceDrawing) {
+	  // 9) ...but only if mother is visible...
+	  if (thisToBeDrawn) {
+	    // 10) ...and opaque...
+	      if (opaque) daughtersToBeDrawn = false;
+	  }
+	}
+      }
+    }
+  }
+
+  // Vis atts for this volume no longer needed if created...
+  if (visAttsCreated) delete pVisAttribs;
+
+  if (daughtersToBeDrawn) {
+    for (G4int iDaughter = 0; iDaughter < nDaughters; iDaughter++) {
+      G4VPhysicalVolume* pVPV = pLV -> GetDaughter (iDaughter);
+      // Descend the geometry structure recursively...
+      fCurrentDepth++;
+      VisitGeometryAndGetVisReps
+	(pVPV, requestedDepth - 1, theNewAT, sceneHandler);
+      fCurrentDepth--;
+    }
+  }
+
+  // Reset for normal descending of next volume at this level...
+  fCurtailDescent = false;
+
+  // Pop item from paths physical volumes...
+  fFullPVPath.pop_back();
+  if (thisToBeDrawn) {
+    fDrawnPVPath.pop_back();
+  }
+}
+
+void G4PhysicalVolumeModel::DescribeSolid
+(const G4Transform3D& theAT,
+ G4VSolid* pSol,
+ const G4VisAttributes* pVisAttribs,
+ G4VGraphicsScene& sceneHandler)
+{
+  sceneHandler.PreAddSolid (theAT, *pVisAttribs);
+
+  const G4Polyhedron* pSectionPolyhedron = fpMP->GetSectionPolyhedron();
+  const G4Polyhedron* pCutawayPolyhedron = fpMP->GetCutawayPolyhedron();
+
+  if (!fpClippingPolyhedron && !pSectionPolyhedron && !pCutawayPolyhedron) {
+
+    pSol -> DescribeYourselfTo (sceneHandler);  // Standard treatment.
+
+  } else {
+
+    // Clipping, etc., performed by Boolean operations on polyhedron objects.
+
+    // First, get polyhedron for current solid...
+    if (pVisAttribs->IsForceLineSegmentsPerCircle())
+      G4Polyhedron::SetNumberOfRotationSteps
+	(pVisAttribs->GetForcedLineSegmentsPerCircle());
+    else
+      G4Polyhedron::SetNumberOfRotationSteps(fpMP->GetNoOfSides());
+    G4Polyhedron* pOriginal = pSol->GetPolyhedron();
+    G4Polyhedron::ResetNumberOfRotationSteps();
+    if (!pOriginal) {
+	if (fpMP->IsWarning())
+	  G4cout <<
+ "WARNING: G4PhysicalVolumeModel::DescribeSolid: solid\n  \""
+		 << pSol->GetName() <<
+ "\" has no polyhedron.  Cannot by clipped."
+		 << G4endl;
+	pSol -> DescribeYourselfTo (sceneHandler);  // Standard treatment.
+    } else {
+
+      G4Polyhedron resultant = *pOriginal;
+
+      if (fpClippingPolyhedron) {
+	G4Polyhedron clipper = *fpClippingPolyhedron;  // Local copy.
+	clipper.Transform(theAT.inverse());
+	switch (fClippingMode) {
+	default:
+	case subtraction: resultant = resultant.subtract(clipper); break;
+	case intersection: resultant = resultant.intersect(clipper); break;
+	}
+	if(resultant.IsErrorBooleanProcess()) {
+	  if (fpMP->IsWarning())
+	    G4cout <<
+ "WARNING: G4PhysicalVolumeModel::DescribeSolid: clipped polyhedron for"
+ "\n  solid \"" << pSol->GetName() <<
+ "\" not defined due to error during Boolean processing."
+		   << G4endl;
+	  // Nevertheless, keep resultant.
+	}
+      }
+
+      if (pSectionPolyhedron) {
+	G4Polyhedron sectioner = *pSectionPolyhedron;  // Local copy.
+	sectioner.Transform(theAT.inverse());
+	resultant = resultant.intersect(sectioner);
+	if(resultant.IsErrorBooleanProcess()) {
+	  if (fpMP->IsWarning())
+	    G4cout <<
+ "WARNING: G4PhysicalVolumeModel::DescribeSolid: sectioned polyhedron for"
+ "\n  solid \"" << pSol->GetName() <<
+ "\" not defined due to error during Boolean processing."
+		   << G4endl;
+	  // Nevertheless, keep resultant.
+	}
+      }
+
+      if (pCutawayPolyhedron) {
+	G4Polyhedron cutter = *pCutawayPolyhedron;  // Local copy.
+	cutter.Transform(theAT.inverse());
+	resultant = resultant.subtract(cutter);
+	if(resultant.IsErrorBooleanProcess()) {
+	  if (fpMP->IsWarning())
+	    G4cout <<
+ "WARNING: G4PhysicalVolumeModel::DescribeSolid: cutaway polyhedron for"
+ "\n  solid \"" << pSol->GetName() <<
+ "\" not defined due to error during Boolean processing."
+		   << G4endl;
+	  // Nevertheless, keep resultant.
+	}
+      }
+
+      // Finally, force polyhedron drawing...
+      resultant.SetVisAttributes(pVisAttribs);
+      sceneHandler.BeginPrimitives(theAT);
+      sceneHandler.AddPrimitive(resultant);
+      sceneHandler.EndPrimitives();
+    }
+  }
+  sceneHandler.PostAddSolid ();
+}
+
+G4bool G4PhysicalVolumeModel::Validate (G4bool warn)
+{
+  G4VPhysicalVolume* world =
+    G4TransportationManager::GetTransportationManager ()
+    -> GetNavigatorForTracking () -> GetWorldVolume ();
+  // The idea now is to seek a PV with the same name and copy no
+  // in the hope it's the same one!!
+  if (warn) {
+    G4cout << "G4PhysicalVolumeModel::Validate() called." << G4endl;
+  }
+  G4PhysicalVolumeModel searchModel (world);
+  G4PhysicalVolumeSearchScene searchScene
+    (&searchModel, fTopPVName, fTopPVCopyNo);
+  G4ModelingParameters mp;  // Default modeling parameters for this search.
+  mp.SetDefaultVisAttributes(fpMP? fpMP->GetDefaultVisAttributes(): 0);
+  searchModel.SetModelingParameters (&mp);
+  searchModel.DescribeYourselfTo (searchScene);
+  G4VPhysicalVolume* foundVolume = searchScene.GetFoundVolume ();
+  if (foundVolume) {
+    if (warn) {
+      G4cout << "  Volume of the same name and copy number (\""
+	     << fTopPVName << "\", copy " << fTopPVCopyNo
+	     << ") still exists and is being used."
+	"\n  WARNING: This does not necessarily guarantee it's the same"
+	"\n  volume you originally specified in /vis/scene/add/."
+	     << G4endl;
+    }
+    fpTopPV = foundVolume;
+    CalculateExtent ();
+    return true;
+  }
+  else {
+    if (warn) {
+      G4cout << "  A volume of the same name and copy number (\""
+	     << fTopPVName << "\", copy " << fTopPVCopyNo
+	     << ") no longer exists."
+	     << G4endl;
+    }
+    return false;
+  }
+}
+
+const std::map<G4String,G4AttDef>* G4PhysicalVolumeModel::GetAttDefs() const
+{
+    G4bool isNew;
+    std::map<G4String,G4AttDef>* store
+      = G4AttDefStore::GetInstance("G4PhysicalVolumeModel", isNew);
+    if (isNew) {
+      (*store)["PVPath"] =
+	G4AttDef("PVPath","Physical Volume Path","Physics","","G4String");
+      (*store)["LVol"] =
+	G4AttDef("LVol","Logical Volume","Physics","","G4String");
+      (*store)["Solid"] =
+	G4AttDef("Solid","Solid Name","Physics","","G4String");
+      (*store)["EType"] =
+	G4AttDef("EType","Entity Type","Physics","","G4String");
+      (*store)["DmpSol"] =
+	G4AttDef("DmpSol","Dump of Solid properties","Physics","","G4String");
+      (*store)["Trans"] =
+	G4AttDef("Trans","Transformation of volume","Physics","","G4String");
+      (*store)["Material"] =
+	G4AttDef("Material","Material Name","Physics","","G4String");
+      (*store)["Density"] =
+	G4AttDef("Density","Material Density","Physics","G4BestUnit","G4double");
+      (*store)["State"] =
+	G4AttDef("State","Material State (enum undefined,solid,liquid,gas)","Physics","","G4String");
+      (*store)["Radlen"] =
+	G4AttDef("Radlen","Material Radiation Length","Physics","G4BestUnit","G4double");
+    }
+      (*store)["Region"] =
+	G4AttDef("Region","Cuts Region","Physics","","G4String");
+      (*store)["RootRegion"] =
+	G4AttDef("RootRegion","Root Region (0/1 = false/true)","Physics","","G4bool");
+    return store;
+}
+
+#include <iomanip>
+
+static std::ostream& operator<< (std::ostream& o, const G4Transform3D t)
+{
+  using namespace std;
+
+  G4Scale3D s;
+  G4Rotate3D r;
+  G4Translate3D tl;
+  t.getDecomposition(s, r, tl);
+
+  const int w = 10;
+
+  // Transformation itself
+  o << setw(w) << t.xx() << setw(w) << t.xy() << setw(w) << t.xz() << setw(w) << t.dx() << endl;
+  o << setw(w) << t.yx() << setw(w) << t.yy() << setw(w) << t.yz() << setw(w) << t.dy() << endl;
+  o << setw(w) << t.zx() << setw(w) << t.zy() << setw(w) << t.zz() << setw(w) << t.dz() << endl;
+
+  // Translation
+  o << "= translation:" << endl;
+  o << setw(w) << tl.dx() << setw(w) << tl.dy() << setw(w) << tl.dz() << endl;
+
+  // Rotation
+  o << "* rotation:" << endl;
+  o << setw(w) << r.xx() << setw(w) << r.xy() << setw(w) << r.xz() << endl;
+  o << setw(w) << r.yx() << setw(w) << r.yy() << setw(w) << r.yz() << endl;
+  o << setw(w) << r.zx() << setw(w) << r.zy() << setw(w) << r.zz() << endl;
+
+  // Scale
+  o << "* scale:" << endl;
+  o << setw(w) << s.xx() << setw(w) << s.yy() << setw(w) << s.zz() << endl;
+
+  // Transformed axes
+  o << "Transformed axes:" << endl;
+  o << "x': " << r * G4Vector3D(1., 0., 0.) << endl;
+  o << "y': " << r * G4Vector3D(0., 1., 0.) << endl;
+  o << "z': " << r * G4Vector3D(0., 0., 1.) << endl;
+
+  return o;
+}
+
+std::vector<G4AttValue>* G4PhysicalVolumeModel::CreateCurrentAttValues() const
+{
+  std::vector<G4AttValue>* values = new std::vector<G4AttValue>;
+  std::ostringstream oss;
+  for (size_t i = 0; i < fFullPVPath.size(); ++i) {
+    oss << fFullPVPath[i].GetPhysicalVolume()->GetName()
+	<< ':' << fFullPVPath[i].GetCopyNo();
+    if (i != fFullPVPath.size() - 1) oss << '/';
+  }
+  values->push_back(G4AttValue("PVPath", oss.str(),""));
+  if (fpCurrentLV) {
+    values->push_back(G4AttValue("LVol", fpCurrentLV->GetName(),""));
+    G4VSolid* pSol = fpCurrentLV->GetSolid();
+    values->push_back(G4AttValue("Solid", pSol->GetName(),""));
+    values->push_back(G4AttValue("EType", pSol->GetEntityType(),""));
+    oss.str(""); oss << '\n' << *pSol;
+    values->push_back(G4AttValue("DmpSol", oss.str(),""));
+    oss.str(""); oss << '\n' << *fpCurrentTransform;
+    values->push_back(G4AttValue("Trans", oss.str(),""));
+    G4String matName = fpCurrentMaterial? fpCurrentMaterial->GetName(): G4String("No material");
+    values->push_back(G4AttValue("Material", matName,""));
+    G4double matDensity = fpCurrentMaterial? fpCurrentMaterial->GetDensity(): 0.;
+    values->push_back(G4AttValue("Density", G4BestUnit(matDensity,"Volumic Mass"),""));
+    G4State matState = fpCurrentMaterial? fpCurrentMaterial->GetState(): kStateUndefined;
+    oss.str(""); oss << matState;
+    values->push_back(G4AttValue("State", oss.str(),""));
+    G4double matRadlen = fpCurrentMaterial? fpCurrentMaterial->GetRadlen(): 0.;
+    values->push_back(G4AttValue("Radlen", G4BestUnit(matRadlen,"Length"),""));
+    G4Region* region = fpCurrentLV->GetRegion();
+    G4String regionName = region? region->GetName(): G4String("No region");
+    values->push_back(G4AttValue("Region", regionName,""));
+    oss.str(""); oss << fpCurrentLV->IsRootRegion();
+    values->push_back(G4AttValue("RootRegion", oss.str(),""));
+  }
+  return values;
+}
Index: tags/visualization-10.5-before-10.6_test/modeling/src/G4PhysicalVolumeSearchScene.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/src/G4PhysicalVolumeSearchScene.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/src/G4PhysicalVolumeSearchScene.cc	(revision 1102)
@@ -0,0 +1,100 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4PhysicalVolumeSearchScene.cc,v 1.14 2008/07/27 10:49:24 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  10th August 1998.
+// An artificial scene to find physical volumes.
+
+#include "G4PhysicalVolumeSearchScene.hh"
+
+#include "G4VSolid.hh"
+#include "G4Vector3D.hh"
+#include "G4PhysicalVolumeModel.hh"
+
+G4PhysicalVolumeSearchScene::G4PhysicalVolumeSearchScene
+(G4PhysicalVolumeModel* pPVModel,
+ const G4String& requiredPhysicalVolumeName,
+ G4int requiredCopyNo):
+  fpPVModel                     (pPVModel),
+  fRequiredPhysicalVolumeName   (requiredPhysicalVolumeName),
+  fRequiredCopyNo               (requiredCopyNo),
+  fpCurrentObjectTransformation (0),
+  fFoundDepth                   (0),
+  fpFoundPV                     (0),
+  fpFoundLV                     (0),
+  fMultipleOccurrence           (false)
+{}
+
+G4PhysicalVolumeSearchScene::~G4PhysicalVolumeSearchScene () {}
+
+void G4PhysicalVolumeSearchScene::FindVolume (const G4VSolid&) {
+
+  G4int currentDepth = fpPVModel->GetCurrentDepth();
+  G4VPhysicalVolume* pCurrentPV = fpPVModel->GetCurrentPV();
+  G4LogicalVolume* pCurrentLV = fpPVModel->GetCurrentLV();
+  //G4Material* pCurrentMaterial = fpPVModel->GetCurrentMaterial();
+  // Note: pCurrentMaterial may be zero (parallel world).
+
+  /**************************************************
+  G4cout << "Required volume: \"" << fRequiredPhysicalVolumeName
+	 << "\", copy no. " << fRequiredCopyNo << G4endl;
+  G4cout << "PhysicalVolume:  \"" << pCurrentPV -> GetName ()
+	 << "\", copy no. " << pCurrentPV -> GetCopyNo () << G4endl;
+  *******************************************/
+
+  if (fRequiredPhysicalVolumeName == pCurrentPV -> GetName () &&
+      (fRequiredCopyNo             < 0 ||  // I.e., ignore negative request.
+       fRequiredCopyNo             == pCurrentPV -> GetCopyNo ())) {
+    // Current policy - take first one found!!
+    if (!fpFoundPV) {  // i.e., if not already found.
+      fFoundDepth                = currentDepth;
+      fpFoundPV                  = pCurrentPV;
+      fpFoundLV                  = pCurrentLV;
+      fFoundObjectTransformation = *fpCurrentObjectTransformation;
+    }
+    else {
+      if (!fMultipleOccurrence) {
+	fMultipleOccurrence = true;
+	G4cout << "G4PhysicalVolumeSearchScene::FindVolume:"
+	       << "\n  Required volume \""
+	       << fRequiredPhysicalVolumeName
+	       << "\"";
+	if (fRequiredCopyNo >= 0) {
+	  G4cout << ", copy no. " << fRequiredCopyNo << ",";
+	}
+	G4cout << " found more than once."
+	  "\n  This function is not smart enough to distinguish identical"
+	  "\n  physical volumes which have different parentage.  It is"
+	  "\n  tricky to specify in general.  This function gives you access"
+	  "\n  to the first occurrence only."
+	       << G4endl;
+      }
+    }
+  }      
+}
Index: tags/visualization-10.5-before-10.6_test/modeling/src/G4ScaleModel.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/src/G4ScaleModel.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/src/G4ScaleModel.cc	(revision 1102)
@@ -0,0 +1,61 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4ScaleModel.cc,v 1.4 2006/06/29 21:32:58 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  21st July 2001.
+// Model which knows how to draw scale.
+
+#include "G4ScaleModel.hh"
+
+#include "G4ModelingParameters.hh"
+#include "G4VGraphicsScene.hh"
+
+G4ScaleModel::~G4ScaleModel () {}
+
+G4ScaleModel::G4ScaleModel (const G4Scale& scale): fScale(scale) {
+  fGlobalTag = "G4ScaleModel: " + fScale.GetAnnotation();
+  switch (fScale.GetDirection()) {
+  case G4Scale::x:
+    fGlobalTag += " x";
+    break;
+  case G4Scale::y:
+    fGlobalTag += " y";
+    break;
+  case G4Scale::z:
+    fGlobalTag += " z";
+    break;
+  }
+  fGlobalDescription = fGlobalTag;
+}
+
+void G4ScaleModel::DescribeYourselfTo (G4VGraphicsScene& sceneHandler) {
+  sceneHandler.BeginPrimitives ();
+  sceneHandler.AddPrimitive (fScale);
+  sceneHandler.EndPrimitives ();
+}
Index: tags/visualization-10.5-before-10.6_test/modeling/src/G4TextModel.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/src/G4TextModel.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/src/G4TextModel.cc	(revision 1102)
@@ -0,0 +1,58 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4TextModel.cc,v 1.7 2006/06/29 21:33:00 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  3rd April 2001
+// Model which knows how to draw text.
+
+#include "G4TextModel.hh"
+
+#include "G4ModelingParameters.hh"
+#include "G4VGraphicsScene.hh"
+
+#include "G4UnitsTable.hh"
+#include <sstream>
+
+G4TextModel::~G4TextModel () {}
+
+G4TextModel::G4TextModel (const G4Text& g4Text): fG4Text(g4Text) {
+  std::ostringstream oss;
+  oss << "G4TextModel: \"" << fG4Text.GetText()
+      << "\" at " << G4BestUnit(g4Text.GetPosition(),"Length")
+      << "with size " << g4Text.GetScreenSize()
+      << " with offsets " << g4Text.GetXOffset() << ',' << g4Text.GetYOffset();
+  fGlobalTag = oss.str();
+  fGlobalDescription = fGlobalTag;
+}
+
+void G4TextModel::DescribeYourselfTo (G4VGraphicsScene& sceneHandler) {
+  sceneHandler.BeginPrimitives ();
+  sceneHandler.AddPrimitive (fG4Text);
+  sceneHandler.EndPrimitives ();
+}
Index: tags/visualization-10.5-before-10.6_test/modeling/src/G4TrajectoriesModel.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/src/G4TrajectoriesModel.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/src/G4TrajectoriesModel.cc	(revision 1102)
@@ -0,0 +1,108 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4TrajectoriesModel.cc,v 1.24 2006/11/14 14:42:08 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  26th August 1998.
+// Model which knows how to draw GEANT4 trajectories.
+
+#include "G4TrajectoriesModel.hh"
+
+#include "G4ModelingParameters.hh"
+#include "G4VGraphicsScene.hh"
+#include "G4Event.hh"
+#include "G4AttValue.hh"
+#include "G4AttDef.hh"
+#include "G4AttCheck.hh"
+
+G4TrajectoriesModel::G4TrajectoriesModel (G4int drawingMode):
+fDrawingMode(drawingMode), fpCurrentTrajectory(0) {
+  fGlobalTag = "G4TrajectoriesModel for all trajectories.";
+  fGlobalDescription = fGlobalTag;
+}
+
+G4TrajectoriesModel::~G4TrajectoriesModel () {}
+
+void G4TrajectoriesModelDebugG4AttValues(const G4VTrajectory*);
+
+void G4TrajectoriesModel::DescribeYourselfTo (G4VGraphicsScene& sceneHandler) {
+  const G4Event* event = fpMP->GetEvent();
+  if (event) {
+    G4TrajectoryContainer* TC = event -> GetTrajectoryContainer ();
+    if (TC) {
+      for (G4int iT = 0; iT < TC->entries(); iT++) {
+	fpCurrentTrajectory = (*TC) [iT];
+	// Debug trajectory:
+	// fpCurrentTrajectory->ShowTrajectory(); G4cout << G4endl;
+	// Debug G4AttValues:
+	// G4TrajectoriesModelDebugG4AttValues(fpCurrentTrajectory);
+	if (fpCurrentTrajectory)
+	  sceneHandler.AddCompound (*fpCurrentTrajectory);
+      }
+    }
+  }
+}
+
+// Debug material...
+
+#include "G4VTrajectoryPoint.hh"
+
+void G4TrajectoriesModelDebugG4AttValues(const G4VTrajectory* pTraj)
+{
+  std::vector<G4AttValue>* attValues = pTraj->CreateAttValues();
+  if (attValues) {
+    G4AttCheck attCheck(attValues, pTraj->GetAttDefs());
+    G4cout << "\nProvided G4Atts:\n" << attCheck;
+    if (attCheck.Check()) G4cout << "Error" << G4endl;
+    else {
+      std::vector<G4AttValue> standardValues;
+      std::map<G4String,G4AttDef> standardDefinitions;
+      attCheck.Standard(&standardValues, &standardDefinitions);
+      G4cout << "\nStandard G4Atts:\n"
+	     << G4AttCheck(&standardValues, &standardDefinitions);
+    }
+    delete attValues;
+  }
+  for (G4int i = 0; i < pTraj->GetPointEntries(); i++) {
+    G4VTrajectoryPoint* aPoint = pTraj->GetPoint(i);
+    std::vector<G4AttValue>* attValues = aPoint->CreateAttValues();
+    if (attValues) {
+      G4AttCheck attCheck(attValues, aPoint->GetAttDefs());
+      G4cout << "\nProvided G4Atts:\n" << attCheck;
+      if (attCheck.Check()) G4cout << "Error" << G4endl;
+      else {
+	std::vector<G4AttValue> standardValues;
+	std::map<G4String,G4AttDef> standardDefinitions;
+	attCheck.Standard(&standardValues, &standardDefinitions);
+	G4cout << "\nStandard G4Atts:\n"
+	       << G4AttCheck(&standardValues, &standardDefinitions);
+      }
+      delete attValues;
+    }
+  }	  
+}
Index: tags/visualization-10.5-before-10.6_test/modeling/src/G4TrajectoryChargeFilter.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/src/G4TrajectoryChargeFilter.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/src/G4TrajectoryChargeFilter.cc	(revision 1102)
@@ -0,0 +1,129 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4TrajectoryChargeFilter.cc,v 1.4 2006/08/25 19:44:14 tinslay Exp $
+// GEANT4 tag $Name:  $
+//
+// Filter trajectories according to charge. Only registered 
+// charges will pass the filter.
+//
+// Jane Tinslay May 2006
+//
+#include "G4TrajectoryChargeFilter.hh"
+#include <sstream>
+
+G4TrajectoryChargeFilter::G4TrajectoryChargeFilter(const G4String& name)
+  :G4SmartFilter<G4VTrajectory>(name)
+{}
+
+G4TrajectoryChargeFilter::~G4TrajectoryChargeFilter() {}
+
+bool
+G4TrajectoryChargeFilter::Evaluate(const G4VTrajectory& traj) const
+{
+  G4double charge = traj.GetCharge();
+
+  if (GetVerbose()) G4cout<<"G4TrajectoryChargeFilter processing trajectory with charge: "<<charge<<G4endl;
+
+  MyCharge myCharge;
+
+  if(charge>0.)      myCharge = Positive; 
+  else if(charge<0.) myCharge = Negative; 
+  else               myCharge = Neutral; 
+
+  std::vector<MyCharge>::const_iterator iter = std::find(fCharges.begin(), fCharges.end(), myCharge);
+
+  // Fail if charge not registered 
+  if (iter == fCharges.end()) return false;
+
+  return true;
+}
+
+void
+G4TrajectoryChargeFilter::Add(const G4String& charge) 
+{
+  MyCharge myCharge;
+  
+  if (!ConvertToCharge(charge, myCharge)) {
+    std::ostringstream o;
+    o << "Invalid charge "<<charge;
+    G4Exception   
+      ("G4TrajectoryChargeFilter::Add(const G4String& charge)", "InvalidCharge", JustWarning, o.str().c_str());
+    return;
+  }
+  
+  return Add(myCharge);
+}
+
+void
+G4TrajectoryChargeFilter::Add(const MyCharge& charge)
+{
+  fCharges.push_back(charge);
+}
+
+void
+G4TrajectoryChargeFilter::Print(std::ostream& ostr) const
+{
+  ostr<<"Charges registered: "<<G4endl;
+  std::vector<MyCharge>::const_iterator iter = fCharges.begin();
+  
+  while (iter != fCharges.end()) {
+    ostr<<*iter<<G4endl;    
+    iter++;
+  }
+}
+
+void 
+G4TrajectoryChargeFilter::Clear()
+{
+  // Clear registered charge vector
+  fCharges.clear();
+}
+
+G4bool
+G4TrajectoryChargeFilter::ConvertToCharge(const G4String& string, MyCharge& myCharge)
+{
+  bool result(true);
+ 
+  G4int charge;
+  std::istringstream is(string.c_str());
+  is >> charge;
+
+  switch (charge) {
+  case 1:
+    myCharge = G4TrajectoryChargeFilter::Positive;
+    break;
+  case 0:
+    myCharge = G4TrajectoryChargeFilter::Neutral;  
+    break;
+  case -1:
+    myCharge = G4TrajectoryChargeFilter::Negative;   
+    break;
+  default:
+    result = false;
+  }
+  
+  return result;
+}
Index: tags/visualization-10.5-before-10.6_test/modeling/src/G4TrajectoryDrawByAttribute.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/src/G4TrajectoryDrawByAttribute.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/src/G4TrajectoryDrawByAttribute.cc	(revision 1102)
@@ -0,0 +1,225 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4TrajectoryDrawByAttribute.cc,v 1.3 2006/09/14 15:41:42 tinslay Exp $
+// GEANT4 tag $Name:  $
+//
+// Jane Tinslay August 2006
+//
+#include "G4TrajectoryDrawByAttribute.hh"
+#include "G4AttDef.hh"
+#include "G4AttFilterUtils.hh"
+#include "G4AttUtils.hh"
+#include "G4AttValue.hh"
+#include "G4TrajectoryDrawerUtils.hh"
+#include "G4VAttValueFilter.hh"
+#include "G4VisTrajContext.hh"
+#include "G4VTrajectory.hh"
+#include <assert.h>
+#include <sstream>
+
+G4TrajectoryDrawByAttribute::G4TrajectoryDrawByAttribute(const G4String& name, G4VisTrajContext* context)
+  :G4VTrajectoryModel(name, context)
+  ,fAttName("")
+  ,fFirst(true)
+  ,fWarnedMissingAttribute(false)
+  ,filter(0)
+{}
+
+G4TrajectoryDrawByAttribute::~G4TrajectoryDrawByAttribute() 
+{
+  ContextMap::iterator iter = fContextMap.begin();
+  
+  while (iter != fContextMap.end()) {
+    delete iter->second;
+    iter++;
+  }
+  
+  delete filter;
+}
+
+void
+G4TrajectoryDrawByAttribute::Draw(const G4VTrajectory& object, const G4int&, 
+				  const G4bool& visible) const
+{
+  // Return if attribute name has not been set. Just print one warning
+  if (fAttName.isNull()) {
+
+    if (!fWarnedMissingAttribute) {
+      std::ostringstream o;
+      o<<"Null attribute name";
+      G4Exception("G4TrajectoryDrawByAttribute::Draw", "NullAttributeName", JustWarning, o.str().c_str());
+      
+      fWarnedMissingAttribute = true;
+    }
+    
+    return;
+  }
+  
+  // Basically cache data loaded filter for efficiency
+  if (fFirst) {
+    
+    fFirst = false;
+    
+    // Get attribute definition
+    G4AttDef attDef;
+    
+    // Expect definition to exist    
+    if (!G4AttUtils::ExtractAttDef(object, fAttName, attDef)) {
+      std::ostringstream o;
+      o <<"Unable to extract attribute definition named "<<fAttName;
+      G4Exception
+	("G4TrajectoryDrawByAttribute::Draw", "InvalidAttributeDefinition", FatalErrorInArgument, o.str().c_str());
+    }
+    
+    // Get new G4AttValue filter
+    filter = G4AttFilterUtils::GetNewFilter(attDef);
+    assert (0 != filter);
+    
+    // Load both interval and single valued data. Single valued data should
+    // override interval data.
+    ContextMap::const_iterator iter = fContextMap.begin();
+    
+    while (iter != fContextMap.end()) {
+      if (iter->first.second == G4TrajectoryDrawByAttribute::Interval) {
+	filter->LoadIntervalElement(iter->first.first);
+      }
+      else if (iter->first.second == G4TrajectoryDrawByAttribute::SingleValue) {
+	filter->LoadSingleValueElement(iter->first.first);
+      }
+      iter++;
+    }
+  }
+ 
+  // Get attribute value
+  G4AttValue attVal;
+
+  // Expect value to exist
+  if (!G4AttUtils::ExtractAttValue(object, fAttName, attVal)) {
+      std::ostringstream o;
+      o <<"Unable to extract attribute value named "<<fAttName;
+      G4Exception
+	("G4TrajectoryDrawByAttribute::Draw", "InvalidAttributeValue", FatalErrorInArgument, o.str().c_str());
+  }
+  
+  G4VisTrajContext myContext(GetContext());
+  G4String key;
+
+  // If attribute value passes filter, get corresponding interval/single value 
+  // key loaded into G4AttValue filter.
+  if (filter->GetValidElement(attVal, key)) {
+
+    // Extract context corresponding to valid key.
+    // Single value match should have overriden interval match.
+    ContextMap::const_iterator iter = fContextMap.begin();
+
+    G4bool gotContext(false);
+
+    while (!gotContext && (iter != fContextMap.end())) {
+      if (iter->first.first == key) {
+	myContext = *(iter->second);
+	gotContext = true;
+      }
+      iter++;
+    }
+
+    assert (gotContext);
+  }
+
+  myContext.SetVisible(visible);
+  
+  if (GetVerbose()) {
+    G4cout<<"G4TrajectoryDrawByAttribute drawer named "<<Name();
+    G4cout<<", drawing style selected according to value of attribute "<<fAttName;
+    G4cout<<" : "<<attVal.GetValue()<<".  Selected context:"<<G4endl;
+    myContext.Print(G4cout);
+  }
+
+  // Draw the trajectory
+  G4TrajectoryDrawerUtils::DrawLineAndPoints(object, myContext);
+}
+
+void
+G4TrajectoryDrawByAttribute::Print(std::ostream& ostr) const
+{
+  ostr<<"G4TrajectoryDrawByAttribute, dumping configuration for model named "<< Name() <<":"<<std::endl;;
+
+  ostr<<"Default configuration:"<<G4endl;
+  GetContext().Print(ostr);
+
+  ostr<<"\nAttribute name "<<fAttName<<std::endl;
+  ostr<<"\nKey<->Context map dump:"<<std::endl;
+
+  ContextMap::const_iterator iter = fContextMap.begin();
+
+  while (iter != fContextMap.end()) {
+    ostr<<"Context for key "<<iter->first.first<<":"<<std::endl;
+    iter->second->Print(ostr);
+    
+    iter++;
+  }
+}
+
+void
+G4TrajectoryDrawByAttribute::Set(const G4String& name)
+{
+  fAttName = name;
+}
+
+void
+G4TrajectoryDrawByAttribute::AddIntervalContext(const G4String& name, G4VisTrajContext* context)
+{
+  // Takes ownership of context
+  std::pair<G4String, Config> myPair(name, G4TrajectoryDrawByAttribute::Interval);
+
+  ContextMap::iterator iter = fContextMap.find(myPair);
+  
+  if (iter != fContextMap.end()) {
+    std::ostringstream o;
+    o <<"Interval "<< name <<" already exists"<<std::endl;
+    G4Exception
+      ("G4TrajectoryDrawByAttribute::AddIntervalContext", "InvalidInterval", FatalErrorInArgument, o.str().c_str());
+  }
+
+  fContextMap[myPair] = context;
+}
+
+void
+G4TrajectoryDrawByAttribute::AddValueContext(const G4String& name, G4VisTrajContext* context)
+{
+  // Takes ownership of context
+  std::pair<G4String, Config> myPair(name, G4TrajectoryDrawByAttribute::SingleValue);
+
+  ContextMap::iterator iter = fContextMap.find(myPair);
+  
+  if (iter != fContextMap.end()) {
+    std::ostringstream o;
+    o <<"Single value "<< name <<" already exists"<<std::endl;
+    G4Exception
+      ("G4TrajectoryDrawByAttribute::AddSingleValueContext", "InvalidInterval", FatalErrorInArgument, o.str().c_str());
+  }
+
+  fContextMap[myPair] = context;
+}
Index: tags/visualization-10.5-before-10.6_test/modeling/src/G4TrajectoryDrawByCharge.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/src/G4TrajectoryDrawByCharge.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/src/G4TrajectoryDrawByCharge.cc	(revision 1102)
@@ -0,0 +1,160 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4TrajectoryDrawByCharge.cc,v 1.8 2006/06/29 21:33:06 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// Jane Tinslay, John Allison, Joseph Perl November 2005
+#include "G4TrajectoryDrawByCharge.hh"
+#include "G4TrajectoryDrawerUtils.hh"
+#include "G4VisTrajContext.hh"
+#include "G4VTrajectory.hh"
+#include <sstream>
+
+G4TrajectoryDrawByCharge::G4TrajectoryDrawByCharge(const G4String& name, G4VisTrajContext* context)
+  :G4VTrajectoryModel(name, context)
+{
+  // Default configuration
+  fMap[Positive] = G4Colour::Blue();
+  fMap[Negative] = G4Colour::Red();
+  fMap[Neutral] = G4Colour::Green();
+}
+
+G4TrajectoryDrawByCharge::G4TrajectoryDrawByCharge(const G4String& name,
+						   const G4Colour& positive,
+						   const G4Colour& negative,
+						   const G4Colour& neutral)
+  :G4VTrajectoryModel(name)
+{
+  fMap[Positive] = positive;
+  fMap[Negative] = negative;
+  fMap[Neutral] = neutral;
+}
+
+G4TrajectoryDrawByCharge::~G4TrajectoryDrawByCharge() {}
+
+void
+G4TrajectoryDrawByCharge::Draw(const G4VTrajectory& traj, const G4int& i_mode, const G4bool& visible) const
+{
+  G4Colour colour;
+
+  const G4double charge = traj.GetCharge();
+
+  if(charge>0.)      fMap.GetColour(Positive, colour); 
+  else if(charge<0.) fMap.GetColour(Negative, colour); 
+  else               fMap.GetColour(Neutral, colour); 
+
+  G4VisTrajContext myContext(GetContext());
+  
+  myContext.SetLineColour(colour);
+  myContext.SetVisible(visible);
+  
+  if (GetVerbose()) {
+    G4cout<<"G4TrajectoryDrawByCharge drawer named "<<Name();
+    G4cout<<", drawing trajectory with charge, "<<charge<<G4endl;
+    G4cout<<", with configuration:"<<G4endl;
+    myContext.Print(G4cout);
+  }
+
+  G4TrajectoryDrawerUtils::DrawLineAndPoints(traj, myContext, i_mode);
+}
+
+void
+G4TrajectoryDrawByCharge::Print(std::ostream& ostr) const
+{
+  ostr<<"G4TrajectoryDrawByCharge model "<< Name() <<" colour scheme: "<<std::endl;
+  fMap.Print(ostr);
+  ostr<<"Default configuration:"<<G4endl;
+  GetContext().Print(G4cout);
+}
+
+void
+G4TrajectoryDrawByCharge::Set(const Charge& charge, const G4String& colour)
+{
+  fMap.Set(charge, colour);
+}
+
+void
+G4TrajectoryDrawByCharge::Set(const Charge& charge, const G4Colour& colour)
+{
+  fMap[charge] = colour;
+}
+
+void
+G4TrajectoryDrawByCharge::Set(const G4String& charge, const G4String& colour)
+{  
+  Charge myCharge;
+  
+  if (!ConvertToCharge(charge, myCharge)) {
+    std::ostringstream o;
+    o << "Invalid charge "<<charge;
+    G4Exception   
+      ("G4TrajectoryDrawByCharge::Set(const G4int& charge, const G4String& colour)", "InvalidCharge", JustWarning, o.str().c_str());
+    return;
+  }
+
+  return Set(myCharge, colour);
+}
+
+void
+G4TrajectoryDrawByCharge::Set(const G4String& charge, const G4Colour& colour)
+{  
+  Charge myCharge;
+  
+  if (!ConvertToCharge(charge, myCharge)) {
+    std::ostringstream o;
+    o << "Invalid charge "<<charge;
+    G4Exception   
+      ("G4TrajectoryDrawByCharge::Set(const G4int& charge, const G4Colour& colour)", "InvalidCharge", JustWarning, o.str().c_str());
+  }
+
+  return Set(myCharge, colour);
+}
+
+G4bool
+G4TrajectoryDrawByCharge::ConvertToCharge(const G4String& string, Charge& myCharge)
+{
+  bool result(true);
+ 
+  G4int charge;
+  std::istringstream is(string.c_str());
+  is >> charge;
+
+  switch (charge) {
+  case 1:
+    myCharge = G4TrajectoryDrawByCharge::Positive;
+    break;
+  case 0:
+    myCharge = G4TrajectoryDrawByCharge::Neutral;  
+    break;
+  case -1:
+    myCharge = G4TrajectoryDrawByCharge::Negative;   
+    break;
+  default:
+    result = false;
+  }
+  
+  return result;
+}
Index: tags/visualization-10.5-before-10.6_test/modeling/src/G4TrajectoryDrawByOriginVolume.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/src/G4TrajectoryDrawByOriginVolume.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/src/G4TrajectoryDrawByOriginVolume.cc	(revision 1102)
@@ -0,0 +1,130 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4TrajectoryDrawByOriginVolume.cc,v 1.4 2006/06/29 21:33:08 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// Jane Tinslay March 2006
+
+#include "G4TrajectoryDrawByOriginVolume.hh"
+#include "G4TrajectoryDrawerUtils.hh"
+#include "G4VTrajectory.hh"
+#include "G4TransportationManager.hh"
+#include "G4VisTrajContext.hh"
+#include "G4VTrajectoryPoint.hh"
+#include <sstream>
+
+G4TrajectoryDrawByOriginVolume::G4TrajectoryDrawByOriginVolume(const G4String& name, G4VisTrajContext* context)
+  :G4VTrajectoryModel(name, context)
+  ,fDefault(G4Colour::Grey())
+{}
+
+G4TrajectoryDrawByOriginVolume::~G4TrajectoryDrawByOriginVolume() {}
+
+void
+G4TrajectoryDrawByOriginVolume::Draw(const G4VTrajectory& traj, const G4int& i_mode, const G4bool& visible) const
+{
+  G4Colour colour(fDefault);
+  
+  G4Navigator* navigator = G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking();
+  
+  G4VTrajectoryPoint* aTrajectoryPoint = traj.GetPoint(0);
+  assert (0 != aTrajectoryPoint);
+  
+  G4VPhysicalVolume* volume = navigator->LocateGlobalPointAndSetup(aTrajectoryPoint->GetPosition());
+
+  // Logical volumes form basis.
+  G4LogicalVolume* logicalVolume = volume->GetLogicalVolume();
+  assert (0 != logicalVolume);
+
+  G4String logicalName = logicalVolume->GetName();
+  fMap.GetColour(logicalName, colour);
+
+  // Override with physical volume colouring if it exists
+  G4String physicalName = volume->GetName();
+  fMap.GetColour(physicalName, colour);
+   
+  G4VisTrajContext myContext(GetContext());
+  
+  myContext.SetLineColour(colour);
+  myContext.SetVisible(visible);
+  
+  if (GetVerbose()) {
+    G4cout<<"G4TrajectoryDrawByOriginVolume drawer named "<<Name();
+    G4cout<<", drawing trajectory originating in logical volume, "<<logicalName;
+    G4cout<<", physical volumed "<<physicalName<<", with configuration:"<<G4endl;
+    myContext.Print(G4cout);
+  }
+
+  G4TrajectoryDrawerUtils::DrawLineAndPoints(traj, myContext, i_mode);
+}
+
+void
+G4TrajectoryDrawByOriginVolume::SetDefault(const G4String& colour)
+{
+  G4Colour myColour;      
+
+  // Will not modify default colour if colour key does not exist  
+  if (!G4Colour::GetColour(colour, myColour)) {
+    std::ostringstream o;
+    o << "G4Colour with key "<<colour<<" does not exist ";
+    G4Exception
+      ("G4TrajectoryDrawByOriginParticleID::SetDefault(const G4String& colour)",
+       "NonExistentColour", JustWarning, o.str().c_str());
+    return;
+  }
+
+  SetDefault(myColour);
+}
+
+void
+G4TrajectoryDrawByOriginVolume::SetDefault(const G4Colour& colour)
+{
+  fDefault = colour;
+}
+
+void
+G4TrajectoryDrawByOriginVolume::Set(const G4String& particle, const G4String& colour)
+{
+  fMap.Set(particle, colour);
+}
+
+void
+G4TrajectoryDrawByOriginVolume::Set(const G4String& particle, const G4Colour& colour)
+{
+  fMap[particle] = colour;
+}
+
+void
+G4TrajectoryDrawByOriginVolume::Print(std::ostream& ostr) const
+{
+  ostr<<"G4TrajectoryDrawByOriginVolume model "<< Name() <<" colour scheme: "<<std::endl;
+  ostr<<"Default : "<<fDefault<<G4endl;
+
+  fMap.Print(ostr);
+
+  ostr<<"Default configuration:"<<G4endl;
+  GetContext().Print(G4cout);
+}
Index: tags/visualization-10.5-before-10.6_test/modeling/src/G4TrajectoryDrawByParticleID.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/src/G4TrajectoryDrawByParticleID.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/src/G4TrajectoryDrawByParticleID.cc	(revision 1102)
@@ -0,0 +1,113 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4TrajectoryDrawByParticleID.cc,v 1.8 2006/06/29 21:33:10 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// Jane Tinslay, John Allison, Joseph Perl November 2005
+
+#include "G4TrajectoryDrawByParticleID.hh"
+#include "G4TrajectoryDrawerUtils.hh"
+#include "G4VisTrajContext.hh"
+#include "G4VTrajectory.hh"
+#include <sstream>
+
+G4TrajectoryDrawByParticleID::G4TrajectoryDrawByParticleID(const G4String& name, G4VisTrajContext* context)
+  :G4VTrajectoryModel(name, context)
+  ,fDefault(G4Colour::Grey())
+{}
+
+G4TrajectoryDrawByParticleID::~G4TrajectoryDrawByParticleID() {}
+
+void
+G4TrajectoryDrawByParticleID::Draw(const G4VTrajectory& traj, const G4int& i_mode, const G4bool& visible) const
+{
+  G4Colour colour(fDefault);
+  G4String particle = traj.GetParticleName();
+
+  fMap.GetColour(particle, colour);
+
+  G4VisTrajContext myContext(GetContext());
+  
+  myContext.SetLineColour(colour);
+  myContext.SetVisible(visible);
+  
+  if (GetVerbose()) {
+    G4cout<<"G4TrajectoryDrawByParticleID drawer named "<<Name();
+    G4cout<<", drawing trajectory with particle type, "<<particle<<G4endl;
+    G4cout<<", with configuration:"<<G4endl;
+    myContext.Print(G4cout);
+  }
+
+  G4TrajectoryDrawerUtils::DrawLineAndPoints(traj, myContext, i_mode);
+}
+
+void
+G4TrajectoryDrawByParticleID::SetDefault(const G4String& colour)
+{
+  G4Colour myColour(G4Colour::White());      
+
+  // Will not modify myColour if colour key does not exist  
+  if (!G4Colour::GetColour(colour, myColour)) {
+    std::ostringstream o;
+    o << "G4Colour with key "<<colour<<" does not exist ";
+    G4Exception
+      ("G4TrajectoryDrawByParticleID::SetDefault(const G4String& colour)",
+       "NonExistentColour", JustWarning, o.str().c_str());
+  }
+
+  SetDefault(myColour);
+}
+
+void
+G4TrajectoryDrawByParticleID::SetDefault(const G4Colour& colour)
+{
+  fDefault = colour;
+}
+
+void
+G4TrajectoryDrawByParticleID::Set(const G4String& particle, const G4String& colour)
+{
+  fMap.Set(particle, colour);
+}
+
+void
+G4TrajectoryDrawByParticleID::Set(const G4String& particle, const G4Colour& colour)
+{
+  fMap[particle] = colour;
+}
+
+void
+G4TrajectoryDrawByParticleID::Print(std::ostream& ostr) const
+{
+  ostr<<"G4TrajectoryDrawByParticleID model "<< Name() <<" colour scheme: "<<std::endl;
+  
+  ostr<<"Default colour: "<<fDefault<<G4endl;
+
+  fMap.Print(ostr);
+
+  ostr<<"Default configuration:"<<G4endl;
+  GetContext().Print(G4cout);
+}
Index: tags/visualization-10.5-before-10.6_test/modeling/src/G4TrajectoryDrawerUtils.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/src/G4TrajectoryDrawerUtils.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/src/G4TrajectoryDrawerUtils.cc	(revision 1102)
@@ -0,0 +1,420 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4TrajectoryDrawerUtils.cc,v 1.12 2009/02/24 12:00:56 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// Jane Tinslay, John Allison, Joseph Perl November 2005
+//
+#include "G4TrajectoryDrawerUtils.hh"
+#include "G4Colour.hh"
+#include "G4Polyline.hh"
+#include "G4Polymarker.hh"
+#include "G4VTrajectory.hh"
+#include "G4VTrajectoryPoint.hh"
+#include "G4VisAttributes.hh"
+#include "G4VisTrajContext.hh"
+#include "G4VVisManager.hh"
+#include "G4UIcommand.hh"
+#include "G4AttValue.hh"
+
+namespace G4TrajectoryDrawerUtils {
+
+
+  void GetPoints(const G4VTrajectory& traj, G4Polyline& trajectoryLine,
+		 G4Polymarker& auxiliaryPoints, G4Polymarker& stepPoints) 
+  {
+    for (G4int i=0; i<traj.GetPointEntries(); i++) {
+      G4VTrajectoryPoint* aTrajectoryPoint = traj.GetPoint(i);
+      
+      const std::vector<G4ThreeVector>* auxiliaries
+	= aTrajectoryPoint->GetAuxiliaryPoints();
+      
+      if (0 != auxiliaries) {
+	for (size_t iAux=0; iAux<auxiliaries->size(); ++iAux) {
+	  const G4ThreeVector pos((*auxiliaries)[iAux]);
+	  trajectoryLine.push_back(pos);
+	  auxiliaryPoints.push_back(pos);
+	}
+      }
+      const G4ThreeVector pos(aTrajectoryPoint->GetPosition());
+      trajectoryLine.push_back(pos);
+      stepPoints.push_back(pos);
+    }    
+  }
+
+  void DrawLineAndPoints(const G4VTrajectory& traj, const G4int& i_mode, const G4Colour& colour, const G4bool& visible) {
+    // If i_mode>=0, draws a trajectory as a polyline (default is blue for
+    // positive, red for negative, green for neutral) and, if i_mode!=0,
+    // adds markers - yellow circles for step points and magenta squares
+    // for auxiliary points, if any - whose screen size in pixels is     
+    // given by std::abs(i_mode)/1000.  E.g: i_mode = 5000 gives easily 
+    // visible markers.
+    
+    G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
+    if (0 == pVVisManager) return;
+    
+    const G4double markerSize = std::abs(i_mode)/1000;
+    G4bool lineRequired (i_mode >= 0);
+    G4bool markersRequired (markerSize > 0.);   
+    
+    // Return if don't need to do anything
+    if (!lineRequired && !markersRequired) return;
+    
+    // Get points to draw
+    G4Polyline trajectoryLine;
+    G4Polymarker stepPoints;
+    G4Polymarker auxiliaryPoints;
+    
+    GetPoints(traj, trajectoryLine, auxiliaryPoints, stepPoints);
+    
+    if (lineRequired) {
+      G4VisAttributes trajectoryLineAttribs(colour);
+      trajectoryLineAttribs.SetVisibility(visible);
+      trajectoryLine.SetVisAttributes(&trajectoryLineAttribs);
+      pVVisManager->Draw(trajectoryLine);
+    }
+    
+    if (markersRequired) {
+      auxiliaryPoints.SetMarkerType(G4Polymarker::squares);
+      auxiliaryPoints.SetScreenSize(markerSize);
+      auxiliaryPoints.SetFillStyle(G4VMarker::filled);
+      G4VisAttributes auxiliaryPointsAttribs(G4Colour(0.,1.,1.));  // Magenta
+      auxiliaryPointsAttribs.SetVisibility(visible);
+      auxiliaryPoints.SetVisAttributes(&auxiliaryPointsAttribs);
+      pVVisManager->Draw(auxiliaryPoints);
+      
+      stepPoints.SetMarkerType(G4Polymarker::circles);
+      stepPoints.SetScreenSize(markerSize);
+      stepPoints.SetFillStyle(G4VMarker::filled);  
+      G4VisAttributes stepPointsAttribs(G4Colour(1.,1.,0.));  // Yellow.
+      stepPoints.SetVisAttributes(&stepPointsAttribs);
+      pVVisManager->Draw(stepPoints);
+    }
+    
+  }
+  
+  static void GetTimes(const G4VTrajectory& traj,
+		       std::vector<G4double>& trajectoryLineTimes,
+		       std::vector<G4double>& auxiliaryPointTimes,
+		       std::vector<G4double>& stepPointTimes)
+  {
+    // It is important check that the sizes of times vectors produced
+    // by this function matches those of points vectors from
+    // GetPoints.  If not, assume that the time information is
+    // invalid.
+
+    G4ThreeVector lastTrajectoryPointPosition;
+    for (G4int i=0; i<traj.GetPointEntries(); i++) {
+      G4VTrajectoryPoint* aTrajectoryPoint = traj.GetPoint(i);
+
+      // Pre- and Post-Point times from the trajectory point...
+      G4double trajectoryPointPreTime = -DBL_MAX;
+      G4double trajectoryPointPostTime = DBL_MAX;
+      std::vector<G4AttValue>* trajectoryPointAttValues =
+        aTrajectoryPoint->CreateAttValues();
+      if (!trajectoryPointAttValues) {
+	G4cout << "G4TrajectoryDrawerUtils::GetTimes: no att values."
+	       << G4endl;
+	return;
+      } else {
+	G4bool foundPreTime = false, foundPostTime = false;
+        for (std::vector<G4AttValue>::iterator i =
+               trajectoryPointAttValues->begin();
+             i != trajectoryPointAttValues->end(); ++i) {
+          if (i->GetName() == "PreT") {
+            trajectoryPointPreTime =
+              G4UIcommand::ConvertToDimensionedDouble(i->GetValue());
+	    foundPreTime = true;
+          }
+          if (i->GetName() == "PostT") {
+            trajectoryPointPostTime =
+	      G4UIcommand::ConvertToDimensionedDouble(i->GetValue());
+	    foundPostTime = true;
+          }
+        }
+	if (!foundPreTime || !foundPostTime) {
+	  static G4bool warnedTimesNotFound = false;
+	  if (!warnedTimesNotFound) {
+	    G4cout <<
+	      "WARNING: G4TrajectoryDrawerUtils::GetTimes: times not found."
+		   << G4endl;
+	    warnedTimesNotFound = true;
+	  }
+	  return;
+	}
+      }
+      
+      const G4ThreeVector& trajectoryPointPosition =
+	aTrajectoryPoint->GetPosition();
+
+      const std::vector<G4ThreeVector>* auxiliaries
+	= aTrajectoryPoint->GetAuxiliaryPoints();
+      
+      if (0 != auxiliaries) {
+	for (size_t iAux=0; iAux<auxiliaries->size(); ++iAux) {
+	  // Interpolate time for auxiliary points...
+	  const G4ThreeVector pos((*auxiliaries)[iAux]);
+	  G4double s1 = (pos - lastTrajectoryPointPosition).mag();
+	  G4double s2 = (trajectoryPointPosition - pos).mag();
+	  G4double t = trajectoryPointPreTime +
+	    (trajectoryPointPostTime - trajectoryPointPreTime) *
+	    (s1 / (s1 + s2));
+	  trajectoryLineTimes.push_back(t);
+	  auxiliaryPointTimes.push_back(t);
+	}
+      }
+
+      trajectoryLineTimes.push_back(trajectoryPointPostTime);
+      stepPointTimes.push_back(trajectoryPointPostTime);
+
+      lastTrajectoryPointPosition = trajectoryPointPosition;
+    }    
+  }
+
+  static void SliceLine(G4double timeIncrement,
+			G4Polyline& trajectoryLine,
+			std::vector<G4double>& trajectoryLineTimes)
+  {
+    // Assumes valid arguments from GetPoints and GetTimes.
+
+    G4Polyline newTrajectoryLine;
+    std::vector<G4double> newTrajectoryLineTimes;
+
+    newTrajectoryLine.push_back(trajectoryLine[0]);
+    newTrajectoryLineTimes.push_back(trajectoryLineTimes[0]);
+    size_t lineSize = trajectoryLine.size();
+    if (lineSize > 1) {
+      for (size_t i = 1; i < trajectoryLine.size(); ++i) {
+	G4double deltaT = trajectoryLineTimes[i] - trajectoryLineTimes[i - 1];
+	if (deltaT > 0.) {
+	  G4double practicalTimeIncrement = 
+	    std::max(timeIncrement, deltaT / 100.);
+	  for (G4double t =
+		 (int(trajectoryLineTimes[i - 1]/practicalTimeIncrement) + 1) *
+		 practicalTimeIncrement;
+	       t <= trajectoryLineTimes[i];
+	       t += practicalTimeIncrement) {
+	    G4ThreeVector pos = trajectoryLine[i - 1] +
+	      (trajectoryLine[i] - trajectoryLine[i - 1]) *
+	      ((t - trajectoryLineTimes[i - 1]) / deltaT);
+	    newTrajectoryLine.push_back(pos);
+	    newTrajectoryLineTimes.push_back(t);
+	  }
+	}
+	newTrajectoryLine.push_back(trajectoryLine[i]);
+	newTrajectoryLineTimes.push_back(trajectoryLineTimes[i]);
+      }
+    }
+
+    trajectoryLine = newTrajectoryLine;
+    trajectoryLineTimes = newTrajectoryLineTimes;
+  }
+
+  static void DrawWithoutTime(const G4VisTrajContext& myContext,
+			      G4Polyline& trajectoryLine,
+			      G4Polymarker& auxiliaryPoints,
+			      G4Polymarker& stepPoints)
+  {
+    // Draw without time slice information
+
+    //
+//     for (size_t iPoint = 0; iPoint < trajectoryLine.size (); iPoint++) {
+//       printf("DrawLineAndPoints trajectory i:%d/%d center:%f,%f,%f\n",iPoint,trajectoryLine.size (),trajectoryLine[iPoint].x(),trajectoryLine[iPoint].y(),trajectoryLine[iPoint].z());
+//     }
+//     for (size_t iPoint = 0; iPoint < auxiliaryPoints.size (); iPoint++) {
+//       printf("DrawLineAndPoints aux i:%d/%d center:%f,%f,%f\n",iPoint,auxiliaryPoints.size (),auxiliaryPoints[iPoint].x(),auxiliaryPoints[iPoint].y(),auxiliaryPoints[iPoint].z());
+//     }
+//     for (size_t iPoint = 0; iPoint < stepPoints.size (); iPoint++) {
+//       printf("DrawLineAndPoints step i:%d/%d center:%f,%f,%f\n",iPoint,stepPoints.size (),stepPoints[iPoint].x(),stepPoints[iPoint].y(),stepPoints[iPoint].z());
+//     }
+    //    
+    G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
+    if (0 == pVVisManager) return;
+    
+    if (myContext.GetDrawLine()) {
+      G4VisAttributes trajectoryLineAttribs(myContext.GetLineColour());
+      trajectoryLineAttribs.SetVisibility(myContext.GetLineVisible());
+      trajectoryLine.SetVisAttributes(&trajectoryLineAttribs);
+
+      pVVisManager->Draw(trajectoryLine);
+    }
+  
+    if (myContext.GetDrawAuxPts() && (auxiliaryPoints.size() > 0)) {
+      auxiliaryPoints.SetMarkerType(myContext.GetAuxPtsType());
+      auxiliaryPoints.SetSize(myContext.GetAuxPtsSizeType(), myContext.GetAuxPtsSize());
+      auxiliaryPoints.SetFillStyle(myContext.GetAuxPtsFillStyle());
+
+      G4VisAttributes auxiliaryPointsAttribs(myContext.GetAuxPtsColour());  
+      auxiliaryPointsAttribs.SetVisibility(myContext.GetAuxPtsVisible());
+      auxiliaryPoints.SetVisAttributes(&auxiliaryPointsAttribs);
+
+      pVVisManager->Draw(auxiliaryPoints);
+    }
+  
+    if (myContext.GetDrawStepPts() && (stepPoints.size() > 0)) {
+      stepPoints.SetMarkerType(myContext.GetStepPtsType());
+      stepPoints.SetSize(myContext.GetStepPtsSizeType(), myContext.GetStepPtsSize());
+      stepPoints.SetFillStyle(myContext.GetStepPtsFillStyle());
+
+      G4VisAttributes stepPointsAttribs(myContext.GetStepPtsColour()); 
+      stepPointsAttribs.SetVisibility(myContext.GetStepPtsVisible());
+      stepPoints.SetVisAttributes(&stepPointsAttribs);
+
+      pVVisManager->Draw(stepPoints);
+    }
+  }
+
+  static void DrawWithTime(const G4VisTrajContext& myContext,
+			   G4Polyline& trajectoryLine,
+			   G4Polymarker& auxiliaryPoints,
+			   G4Polymarker& stepPoints,
+			   std::vector<G4double>& trajectoryLineTimes,
+			   std::vector<G4double>& auxiliaryPointTimes,
+			   std::vector<G4double>& stepPointTimes)
+  {
+    // Draw with time slice information
+
+    G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
+    if (0 == pVVisManager) return;
+
+    if (myContext.GetDrawLine()) {
+      G4VisAttributes trajectoryLineAttribs(myContext.GetLineColour());
+      trajectoryLineAttribs.SetVisibility(myContext.GetLineVisible());
+
+      for (size_t i = 1; i < trajectoryLine.size(); ++i ) {
+	G4Polyline slice;
+	slice.push_back(trajectoryLine[i -1]);
+	slice.push_back(trajectoryLine[i]);
+	trajectoryLineAttribs.SetStartTime(trajectoryLineTimes[i - 1]);
+	trajectoryLineAttribs.SetEndTime(trajectoryLineTimes[i]);
+	slice.SetVisAttributes(&trajectoryLineAttribs);
+	pVVisManager->Draw(slice);
+      }
+    }
+
+    if (myContext.GetDrawAuxPts() && (auxiliaryPoints.size() > 0)) {
+      G4VisAttributes auxiliaryPointsAttribs(myContext.GetAuxPtsColour());  
+      auxiliaryPointsAttribs.SetVisibility(myContext.GetAuxPtsVisible());
+
+      for (size_t i = 0; i < auxiliaryPoints.size(); ++i ) {
+	G4Polymarker point;
+	point.push_back(auxiliaryPoints[i]);
+	point.SetMarkerType(myContext.GetAuxPtsType());
+	point.SetSize(myContext.GetAuxPtsSizeType(), myContext.GetAuxPtsSize());
+	point.SetFillStyle(myContext.GetAuxPtsFillStyle());
+	auxiliaryPointsAttribs.SetStartTime(auxiliaryPointTimes[i]);
+	auxiliaryPointsAttribs.SetEndTime(auxiliaryPointTimes[i]);
+	point.SetVisAttributes(&auxiliaryPointsAttribs);
+	pVVisManager->Draw(point);
+      }
+    }
+
+    if (myContext.GetDrawStepPts() && (stepPoints.size() > 0)) {
+      G4VisAttributes stepPointsAttribs(myContext.GetStepPtsColour()); 
+      stepPointsAttribs.SetVisibility(myContext.GetStepPtsVisible());
+
+      for (size_t i = 0; i < stepPoints.size(); ++i ) {
+	G4Polymarker point;
+	point.push_back(stepPoints[i]);
+	point.SetMarkerType(myContext.GetStepPtsType());
+	point.SetSize(myContext.GetStepPtsSizeType(), myContext.GetStepPtsSize());
+	point.SetFillStyle(myContext.GetStepPtsFillStyle());
+	stepPointsAttribs.SetStartTime(stepPointTimes[i]);
+	stepPointsAttribs.SetEndTime(stepPointTimes[i]);
+	point.SetVisAttributes(&stepPointsAttribs);
+	pVVisManager->Draw(point);
+      }
+    }
+  }
+
+  void DrawLineAndPoints(const G4VTrajectory& traj, const G4VisTrajContext& context, const G4int& i_mode) 
+  {
+    // Extra copy while i_mode is still around
+    G4VisTrajContext myContext(context);
+    
+    if (i_mode != 0) {
+      const G4double markerSize = std::abs(i_mode)/1000;
+      G4bool lineRequired (i_mode >= 0);
+      G4bool markersRequired (markerSize > 0.);        
+      
+      myContext.SetDrawLine(lineRequired);
+      myContext.SetDrawAuxPts(markersRequired);
+      myContext.SetDrawStepPts(markersRequired);
+
+      myContext.SetAuxPtsSize(markerSize);
+      myContext.SetStepPtsSize(markerSize);
+
+      static G4bool warnedAboutIMode = false;
+
+      if (!warnedAboutIMode) {
+	G4cout<<"Trajectory drawing configuration will be based on imode value of "<<i_mode<<G4endl;
+	warnedAboutIMode = true;
+      }
+    }
+
+    // Return if don't need to do anything
+    if (!myContext.GetDrawLine() && !myContext.GetDrawAuxPts() && !myContext.GetDrawStepPts()) return;
+    
+    // Get points to draw
+    G4Polyline trajectoryLine;
+    G4Polymarker stepPoints;
+    G4Polymarker auxiliaryPoints;
+    
+    GetPoints(traj, trajectoryLine, auxiliaryPoints, stepPoints);
+    
+    if (myContext.GetTimeSliceInterval()) {
+
+      // Get corresponding track time information, if any
+      std::vector<G4double> trajectoryLineTimes;
+      std::vector<G4double> stepPointTimes;
+      std::vector<G4double> auxiliaryPointTimes;
+  
+      GetTimes(traj, trajectoryLineTimes, auxiliaryPointTimes, stepPointTimes);
+
+      // Check validity
+      if (trajectoryLineTimes.size() != trajectoryLine.size() ||
+	  stepPointTimes.size() != stepPoints.size() ||
+	  auxiliaryPointTimes.size() != auxiliaryPoints.size()) {
+
+	// Revert to drawing without time information...
+	DrawWithoutTime(myContext, trajectoryLine, auxiliaryPoints, stepPoints);
+      } else {
+
+	SliceLine(myContext.GetTimeSliceInterval(),
+		  trajectoryLine, trajectoryLineTimes);
+
+	DrawWithTime(myContext,
+		     trajectoryLine, auxiliaryPoints, stepPoints,
+		     trajectoryLineTimes, auxiliaryPointTimes, stepPointTimes);
+      }
+
+    } else {
+
+      DrawWithoutTime(myContext, trajectoryLine, auxiliaryPoints, stepPoints);
+
+    }
+  }
+}
Index: tags/visualization-10.5-before-10.6_test/modeling/src/G4TrajectoryFilterFactories.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/src/G4TrajectoryFilterFactories.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/src/G4TrajectoryFilterFactories.cc	(revision 1102)
@@ -0,0 +1,146 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+/// $Id: G4TrajectoryFilterFactories.cc,v 1.5 2006/09/12 18:53:03 tinslay Exp $
+// GEANT4 tag $Name:  $
+//
+//
+// Trajectory filter model factories creating filters
+// and associated messengers.
+//
+// Jane Tinslay March 2006
+//
+#include "G4AttributeFilterT.hh"
+#include "G4ModelCommandsT.hh"
+#include "G4TrajectoryFilterFactories.hh"
+#include "G4TrajectoryChargeFilter.hh"
+#include "G4TrajectoryParticleFilter.hh"
+#include "G4TrajectoryOriginVolumeFilter.hh"
+
+// Attribute filter
+G4TrajectoryAttributeFilterFactory::G4TrajectoryAttributeFilterFactory()
+  :G4VModelFactory< G4VFilter<G4VTrajectory> >("attributeFilter") 
+{}
+
+G4TrajectoryAttributeFilterFactory::~G4TrajectoryAttributeFilterFactory() {}
+
+G4TrajectoryAttributeFilterFactory::ModelAndMessengers
+G4TrajectoryAttributeFilterFactory::Create(const G4String& placement, const G4String& name)
+{
+  typedef G4AttributeFilterT<G4VTrajectory> G4TrajectoryAttributeFilter;
+  // Create model
+  G4TrajectoryAttributeFilter* model = new G4TrajectoryAttributeFilter(name);
+  
+  // Create associated messengers
+  Messengers messengers;
+  
+  messengers.push_back(new G4ModelCmdSetString<G4TrajectoryAttributeFilter>(model, placement, "setAttribute"));
+  messengers.push_back(new G4ModelCmdInvert<G4TrajectoryAttributeFilter>(model, placement));
+  messengers.push_back(new G4ModelCmdActive<G4TrajectoryAttributeFilter>(model, placement));
+  messengers.push_back(new G4ModelCmdVerbose<G4TrajectoryAttributeFilter>(model, placement));
+  messengers.push_back(new G4ModelCmdReset<G4TrajectoryAttributeFilter>(model, placement));
+  messengers.push_back(new G4ModelCmdAddInterval<G4TrajectoryAttributeFilter>(model, placement, "addInterval"));
+  messengers.push_back(new G4ModelCmdAddValue<G4TrajectoryAttributeFilter>(model, placement, "addValue"));
+ 
+  return ModelAndMessengers(model, messengers);
+}
+
+// Charge filter
+G4TrajectoryChargeFilterFactory::G4TrajectoryChargeFilterFactory()
+  :G4VModelFactory< G4VFilter<G4VTrajectory> >("chargeFilter") 
+{}
+
+G4TrajectoryChargeFilterFactory::~G4TrajectoryChargeFilterFactory() {}
+
+G4TrajectoryChargeFilterFactory::ModelAndMessengers
+G4TrajectoryChargeFilterFactory::Create(const G4String& placement, const G4String& name)
+{
+  // Create model
+  G4TrajectoryChargeFilter* model = new G4TrajectoryChargeFilter(name);
+  
+  // Create associated messengers
+  Messengers messengers;
+  
+  messengers.push_back(new G4ModelCmdAddString<G4TrajectoryChargeFilter>(model, placement));
+  messengers.push_back(new G4ModelCmdInvert<G4TrajectoryChargeFilter>(model, placement));
+  messengers.push_back(new G4ModelCmdActive<G4TrajectoryChargeFilter>(model, placement));
+  messengers.push_back(new G4ModelCmdVerbose<G4TrajectoryChargeFilter>(model, placement));
+  messengers.push_back(new G4ModelCmdReset<G4TrajectoryChargeFilter>(model, placement));
+  
+  return ModelAndMessengers(model, messengers);
+}
+
+// Particle type filter
+G4TrajectoryParticleFilterFactory::G4TrajectoryParticleFilterFactory()
+  :G4VModelFactory< G4VFilter<G4VTrajectory> >("particleFilter") 
+{}
+
+G4TrajectoryParticleFilterFactory::~G4TrajectoryParticleFilterFactory() {}
+
+G4TrajectoryParticleFilterFactory::ModelAndMessengers
+G4TrajectoryParticleFilterFactory::Create(const G4String& placement, const G4String& name)
+{
+  // Create model
+  G4TrajectoryParticleFilter* model = new G4TrajectoryParticleFilter(name);
+  
+  // Create associated messengers
+  Messengers messengers;
+  
+  messengers.push_back(new G4ModelCmdAddString<G4TrajectoryParticleFilter>(model, placement));
+  messengers.push_back(new G4ModelCmdInvert<G4TrajectoryParticleFilter>(model, placement));
+  messengers.push_back(new G4ModelCmdActive<G4TrajectoryParticleFilter>(model, placement));
+  messengers.push_back(new G4ModelCmdVerbose<G4TrajectoryParticleFilter>(model, placement));
+  messengers.push_back(new G4ModelCmdReset<G4TrajectoryParticleFilter>(model, placement));
+  
+  return ModelAndMessengers(model, messengers);
+}
+
+
+// Origin volume filter
+G4TrajectoryOriginVolumeFilterFactory::G4TrajectoryOriginVolumeFilterFactory()
+  :G4VModelFactory< G4VFilter<G4VTrajectory> >("originVolumeFilter") 
+{}
+
+G4TrajectoryOriginVolumeFilterFactory::~G4TrajectoryOriginVolumeFilterFactory() {}
+
+G4TrajectoryOriginVolumeFilterFactory::ModelAndMessengers
+G4TrajectoryOriginVolumeFilterFactory::Create(const G4String& placement, const G4String& name)
+{
+  // Create model
+  G4TrajectoryOriginVolumeFilter* model = new G4TrajectoryOriginVolumeFilter(name);
+  
+  // Create associated messengers
+  Messengers messengers;
+  
+  messengers.push_back(new G4ModelCmdAddString<G4TrajectoryOriginVolumeFilter>(model, placement));
+  messengers.push_back(new G4ModelCmdInvert<G4TrajectoryOriginVolumeFilter>(model, placement));
+  messengers.push_back(new G4ModelCmdActive<G4TrajectoryOriginVolumeFilter>(model, placement));
+  messengers.push_back(new G4ModelCmdVerbose<G4TrajectoryOriginVolumeFilter>(model, placement));
+  messengers.push_back(new G4ModelCmdReset<G4TrajectoryOriginVolumeFilter>(model, placement));
+  
+  return ModelAndMessengers(model, messengers);
+}
+
+
Index: tags/visualization-10.5-before-10.6_test/modeling/src/G4TrajectoryGenericDrawer.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/src/G4TrajectoryGenericDrawer.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/src/G4TrajectoryGenericDrawer.cc	(revision 1102)
@@ -0,0 +1,63 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4TrajectoryGenericDrawer.cc,v 1.2 2006/06/29 21:33:16 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// Jane Tinslay May 2006
+//
+#include "G4TrajectoryGenericDrawer.hh"
+#include "G4TrajectoryDrawerUtils.hh"
+#include "G4VisTrajContext.hh"
+#include "G4VTrajectory.hh"
+#include <sstream>
+
+G4TrajectoryGenericDrawer::G4TrajectoryGenericDrawer(const G4String& name, G4VisTrajContext* context)
+  :G4VTrajectoryModel(name, context)
+{}
+
+G4TrajectoryGenericDrawer::~G4TrajectoryGenericDrawer() {}
+
+void
+G4TrajectoryGenericDrawer::Draw(const G4VTrajectory& traj, const G4int& i_mode, const G4bool& visible) const
+{
+  G4VisTrajContext myContext(GetContext());
+  myContext.SetVisible(visible);
+
+  if (GetVerbose()) {
+    G4cout<<"G4TrajectoryGenericDrawer named "<<Name();
+    G4cout<<", drawing trajectory with configuration: "<<G4endl;
+    myContext.Print(G4cout);
+  }
+  
+  G4TrajectoryDrawerUtils::DrawLineAndPoints(traj, myContext, i_mode);
+}
+
+void
+G4TrajectoryGenericDrawer::Print(std::ostream& ostr) const
+{
+  ostr<<"G4TrajectoryGenericDrawer model "<< Name()<< ", default configuration :"<<G4endl;
+  GetContext().Print(G4cout);
+}
Index: tags/visualization-10.5-before-10.6_test/modeling/src/G4TrajectoryModelFactories.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/src/G4TrajectoryModelFactories.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/src/G4TrajectoryModelFactories.cc	(revision 1102)
@@ -0,0 +1,172 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4TrajectoryModelFactories.cc,v 1.7 2006/09/12 18:53:03 tinslay Exp $
+// GEANT4 tag $Name:  $
+//
+// Jane Tinslay, John Allison, Joseph Perl October 2005
+
+#include "G4ModelCompoundCommandsT.hh"
+#include "G4ModelCommandsT.hh"
+#include "G4ModelCommandUtils.hh"
+#include "G4TrajectoryDrawByAttribute.hh"
+#include "G4TrajectoryDrawByCharge.hh"
+#include "G4TrajectoryDrawByOriginVolume.hh"
+#include "G4TrajectoryDrawByParticleID.hh"
+#include "G4TrajectoryGenericDrawer.hh"
+#include "G4TrajectoryModelFactories.hh"
+#include "G4VisTrajContext.hh"
+
+// Draw by attribute
+G4TrajectoryDrawByAttributeFactory::G4TrajectoryDrawByAttributeFactory()
+  :G4VModelFactory<G4VTrajectoryModel>("drawByAttribute") 
+{}
+
+G4TrajectoryDrawByAttributeFactory::~G4TrajectoryDrawByAttributeFactory() {}
+
+ModelAndMessengers
+G4TrajectoryDrawByAttributeFactory::Create(const G4String& placement, const G4String& name)
+{
+  Messengers messengers;
+  
+  // Create default context and model 
+  G4VisTrajContext* context = new G4VisTrajContext("default");
+
+  G4TrajectoryDrawByAttribute* model = new G4TrajectoryDrawByAttribute(name, context);
+
+  // Create messengers for default context configuration
+  G4ModelCommandUtils::AddContextMsgrs(context, messengers, placement+"/"+name);
+
+  messengers.push_back(new G4ModelCmdVerbose<G4TrajectoryDrawByAttribute>(model, placement));
+  messengers.push_back(new G4ModelCmdSetString<G4TrajectoryDrawByAttribute>(model, placement, "setAttribute"));
+  messengers.push_back(new G4ModelCmdAddIntervalContext<G4TrajectoryDrawByAttribute>(model, placement, "addInterval"));
+  messengers.push_back(new G4ModelCmdAddValueContext<G4TrajectoryDrawByAttribute>(model, placement, "addValue"));
+
+  return ModelAndMessengers(model, messengers);
+}
+
+G4TrajectoryGenericDrawerFactory::G4TrajectoryGenericDrawerFactory()
+  :G4VModelFactory<G4VTrajectoryModel>("generic") 
+{}
+
+G4TrajectoryGenericDrawerFactory::~G4TrajectoryGenericDrawerFactory() {}
+
+ModelAndMessengers
+G4TrajectoryGenericDrawerFactory::Create(const G4String& placement, const G4String& name)
+{
+  Messengers messengers;
+  
+  // Create default context and model 
+  G4VisTrajContext* context = new G4VisTrajContext("default");
+  G4TrajectoryGenericDrawer* model = new G4TrajectoryGenericDrawer(name, context);
+
+  // Create messengers for default context configuration
+  G4ModelCommandUtils::AddContextMsgrs(context, messengers, placement+"/"+name);
+  
+  // Verbose command
+  messengers.push_back(new G4ModelCmdVerbose<G4TrajectoryGenericDrawer>(model, placement));
+
+  return ModelAndMessengers(model, messengers);
+}
+
+// drawByCharge
+G4TrajectoryDrawByChargeFactory::G4TrajectoryDrawByChargeFactory()
+  :G4VModelFactory<G4VTrajectoryModel>("drawByCharge") 
+{}
+
+G4TrajectoryDrawByChargeFactory::~G4TrajectoryDrawByChargeFactory() {}
+
+ModelAndMessengers
+G4TrajectoryDrawByChargeFactory::Create(const G4String& placement, const G4String& name)
+{
+  Messengers messengers;
+  
+  // Create default context and model 
+  G4VisTrajContext* context = new G4VisTrajContext("default");
+  G4TrajectoryDrawByCharge* model = new G4TrajectoryDrawByCharge(name, context);
+
+  // Create messengers for default context configuration
+  G4ModelCommandUtils::AddContextMsgrs(context, messengers, placement+"/"+name);
+  
+  // Create messengers for drawer
+  messengers.push_back(new G4ModelCmdSetStringColour<G4TrajectoryDrawByCharge>(model, placement));
+  messengers.push_back(new G4ModelCmdVerbose<G4TrajectoryDrawByCharge>(model, placement));
+
+  return ModelAndMessengers(model, messengers);
+}
+
+//Draw by particle ID
+G4TrajectoryDrawByParticleIDFactory::G4TrajectoryDrawByParticleIDFactory()
+  :G4VModelFactory<G4VTrajectoryModel>("drawByParticleID") 
+{}
+
+G4TrajectoryDrawByParticleIDFactory::~G4TrajectoryDrawByParticleIDFactory() {}
+
+ModelAndMessengers
+G4TrajectoryDrawByParticleIDFactory::Create(const G4String& placement, const G4String& name)
+{
+  Messengers messengers;
+
+  // Create default context and model
+  G4VisTrajContext* context = new G4VisTrajContext("default");
+  G4TrajectoryDrawByParticleID* model = new G4TrajectoryDrawByParticleID(name, context);
+
+  // Create messengers for default context configuration
+  G4ModelCommandUtils::AddContextMsgrs(context, messengers, placement+"/"+name);
+
+  // Create messengers for drawer
+  messengers.push_back(new G4ModelCmdSetStringColour<G4TrajectoryDrawByParticleID>(model, placement));
+  messengers.push_back(new G4ModelCmdSetDefaultColour<G4TrajectoryDrawByParticleID>(model, placement));
+  messengers.push_back(new G4ModelCmdVerbose<G4TrajectoryDrawByParticleID>(model, placement));
+
+  return ModelAndMessengers(model, messengers);
+}
+
+//Draw by origin volume
+G4TrajectoryDrawByOriginVolumeFactory::G4TrajectoryDrawByOriginVolumeFactory()
+  :G4VModelFactory<G4VTrajectoryModel>("drawByOriginVolume") 
+{}
+
+G4TrajectoryDrawByOriginVolumeFactory::~G4TrajectoryDrawByOriginVolumeFactory() {}
+
+ModelAndMessengers
+G4TrajectoryDrawByOriginVolumeFactory::Create(const G4String& placement, const G4String& name)
+{
+  Messengers messengers;
+
+  // Create default context and model
+  G4VisTrajContext* context = new G4VisTrajContext("default"); 
+  G4TrajectoryDrawByOriginVolume* model = new G4TrajectoryDrawByOriginVolume(name, context);
+  
+  // Create messengers for default context configuration
+  G4ModelCommandUtils::AddContextMsgrs(context, messengers, placement+"/"+name);
+
+  // Create messengers for drawer
+  messengers.push_back(new G4ModelCmdSetStringColour<G4TrajectoryDrawByOriginVolume>(model, placement));
+  messengers.push_back(new G4ModelCmdSetDefaultColour<G4TrajectoryDrawByOriginVolume>(model, placement));
+  messengers.push_back(new G4ModelCmdVerbose<G4TrajectoryDrawByOriginVolume>(model, placement));
+
+  return ModelAndMessengers(model, messengers);
+}
Index: tags/visualization-10.5-before-10.6_test/modeling/src/G4TrajectoryOriginVolumeFilter.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/src/G4TrajectoryOriginVolumeFilter.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/src/G4TrajectoryOriginVolumeFilter.cc	(revision 1102)
@@ -0,0 +1,103 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4TrajectoryOriginVolumeFilter.cc,v 1.3 2006/08/25 19:44:14 tinslay Exp $
+// GEANT4 tag $Name:  $
+//
+// Filter trajectories according to volume name. Only registered 
+// volumes will pass the filter.
+//
+// Jane Tinslay May 2006
+//
+#include "G4TrajectoryOriginVolumeFilter.hh"
+#include "G4TransportationManager.hh"
+#include "G4VTrajectoryPoint.hh"
+
+G4TrajectoryOriginVolumeFilter::G4TrajectoryOriginVolumeFilter(const G4String& name)
+  :G4SmartFilter<G4VTrajectory>(name)
+{}
+
+G4TrajectoryOriginVolumeFilter::~G4TrajectoryOriginVolumeFilter() {}
+
+bool
+G4TrajectoryOriginVolumeFilter::Evaluate(const G4VTrajectory& traj) const
+{
+  G4Navigator* navigator = G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking();
+  
+  G4VTrajectoryPoint* aTrajectoryPoint = traj.GetPoint(0);
+  assert (0 != aTrajectoryPoint);
+  
+  G4VPhysicalVolume* volume = navigator->LocateGlobalPointAndSetup(aTrajectoryPoint->GetPosition());
+
+  // Logical volume
+  G4LogicalVolume* logicalVolume = volume->GetLogicalVolume();
+  assert (0 != logicalVolume);
+
+  // Get volume names
+  G4String logicalName = logicalVolume->GetName();
+  G4String physicalName = volume->GetName();
+
+  if (GetVerbose()) G4cout<<"G4TrajectoryOriginVolumeFilter processing trajectory with originating volume "<<G4endl;
+  G4cout<<"logical and physical names:  "<<logicalName<<" "<<physicalName<<G4endl;
+
+  // Search for logical volume name
+  std::vector<G4String>::const_iterator iterLogical = std::find(fVolumes.begin(), fVolumes.end(), logicalName);
+
+  // Keep if logical volume registered
+  if (iterLogical != fVolumes.end()) return true;
+
+  // Repeat for physical volume name
+  std::vector<G4String>::const_iterator iterPhysical = std::find(fVolumes.begin(), fVolumes.end(), physicalName);
+
+  if (iterPhysical != fVolumes.end()) return true;
+
+  // Volume names not registered
+  return false;
+}
+
+void
+G4TrajectoryOriginVolumeFilter::Add(const G4String& volume)
+{
+  fVolumes.push_back(volume);
+}
+
+void
+G4TrajectoryOriginVolumeFilter::Print(std::ostream& ostr) const
+{
+  ostr<<"Volume names registered: "<<G4endl;
+  std::vector<G4String>::const_iterator iter = fVolumes.begin();
+  
+  while (iter != fVolumes.end()) {
+    ostr<<*iter<<G4endl;    
+    iter++;
+  }
+}
+
+void 
+G4TrajectoryOriginVolumeFilter::Clear()
+{
+  // Clear volume vector
+  fVolumes.clear();
+}
Index: tags/visualization-10.5-before-10.6_test/modeling/src/G4TrajectoryParticleFilter.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/src/G4TrajectoryParticleFilter.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/src/G4TrajectoryParticleFilter.cc	(revision 1102)
@@ -0,0 +1,81 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4TrajectoryParticleFilter.cc,v 1.3 2006/08/25 19:44:14 tinslay Exp $
+// GEANT4 tag $Name:  $
+//
+// Filter trajectories according to particle type. Only registered 
+// particle types will pass the filter.
+//
+// Jane Tinslay March 2006
+//
+#include "G4TrajectoryParticleFilter.hh"
+
+G4TrajectoryParticleFilter::G4TrajectoryParticleFilter(const G4String& name)
+  :G4SmartFilter<G4VTrajectory>(name)
+{}
+
+G4TrajectoryParticleFilter::~G4TrajectoryParticleFilter() {}
+
+bool
+G4TrajectoryParticleFilter::Evaluate(const G4VTrajectory& traj) const
+{
+  G4String particle = traj.GetParticleName();
+
+  if (GetVerbose()) G4cout<<"G4TrajectoryParticleFilter processing trajectory with particle type: "<<particle<<G4endl;
+
+  std::vector<G4String>::const_iterator iter = std::find(fParticles.begin(), fParticles.end(), particle);
+
+  // Fail if particle type not found in particle list
+  if (iter == fParticles.end()) return false;
+
+  return true;
+}
+
+
+void
+G4TrajectoryParticleFilter::Add(const G4String& particle)
+{
+  fParticles.push_back(particle);
+}
+
+void
+G4TrajectoryParticleFilter::Print(std::ostream& ostr) const
+{
+  ostr<<"Particle types registered: "<<G4endl;
+  std::vector<G4String>::const_iterator iter = fParticles.begin();
+  
+  while (iter != fParticles.end()) {
+    ostr<<*iter<<G4endl;    
+    iter++;
+  }
+}
+
+void 
+G4TrajectoryParticleFilter::Clear()
+{
+  // Clear particle type vector
+  fParticles.clear();
+}
Index: tags/visualization-10.5-before-10.6_test/modeling/src/G4VModel.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/src/G4VModel.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/src/G4VModel.cc	(revision 1102)
@@ -0,0 +1,81 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VModel.cc,v 1.14 2006/11/01 10:33:00 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  31st December 1997.
+// Base class for models.
+
+#include "G4VModel.hh"
+
+#include "G4RotationMatrix.hh"
+#include "G4ModelingParameters.hh"
+
+G4VModel::G4VModel (const G4Transform3D& modelTransformation,
+		    const G4ModelingParameters* pMP):
+  fGlobalTag ("Empty"),
+  fGlobalDescription ("Empty"),
+  fTransform (modelTransformation),
+  fpMP (pMP)
+{}
+
+G4VModel::~G4VModel () {}
+
+G4String G4VModel::GetCurrentTag () const {
+  // Override in concrete class if concept of "current" is meaningful.
+  return fGlobalTag;
+}
+
+G4String G4VModel::GetCurrentDescription () const {
+  // Override in concrete class if concept of "current" is meaningful.
+  return fGlobalDescription;
+}
+
+G4bool G4VModel::Validate (G4bool) {
+  return true;
+}
+
+std::ostream& operator << (std::ostream& os, const G4VModel& m) {
+  os << m.fGlobalDescription;
+  os << "\n  Modeling parameters:";
+  const G4ModelingParameters* mp = m.fpMP;
+  if (mp) os << "\n  " << *mp;
+  else os << " none.";
+  os << "\n  Extent: " << m.fExtent;
+  os << "\n  Transformation: ";
+  os << "\n    Rotation: ";
+  G4RotationMatrix rotation = m.fTransform.getRotation ();
+  os << rotation.thetaX() << ", "
+     << rotation.phiX() << ", "
+     << rotation.thetaY() << ", "
+     << rotation.phiY() << ", "
+     << rotation.thetaZ() << ", "
+     << rotation.phiZ();
+  os << "\n    Translation: " << m.fTransform.getTranslation ();
+  return os;
+}
Index: tags/visualization-10.5-before-10.6_test/modeling/src/G4VTrajectoryModel.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/src/G4VTrajectoryModel.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/src/G4VTrajectoryModel.cc	(revision 1102)
@@ -0,0 +1,78 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4VTrajectoryModel.cc,v 1.3 2006/06/29 21:33:26 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// Jane Tinslay May 2006
+//
+// See header for details
+//
+#include "G4VTrajectoryModel.hh"
+#include "G4VisTrajContext.hh"
+
+#include <assert.h>
+
+G4VTrajectoryModel::G4VTrajectoryModel(const G4String& name, 
+				       G4VisTrajContext* context)
+  :fName(name)
+  ,fVerbose(false)
+  ,fpContext(context) 
+{
+  // Create context object if none is provided. Model will
+  // then use default G4VisTrajContext configuration
+  if (0 == fpContext) fpContext = new G4VisTrajContext();
+}
+
+G4VTrajectoryModel::~G4VTrajectoryModel()
+{
+  delete fpContext;
+}
+
+const G4VisTrajContext&
+G4VTrajectoryModel::GetContext() const 
+{
+  // Expect context to exist
+  assert (0 != fpContext);
+  return *fpContext;
+}
+
+G4String 
+G4VTrajectoryModel::Name() const 
+{
+  return fName;
+}
+
+void
+G4VTrajectoryModel::SetVerbose(const G4bool& verbose)
+{
+  fVerbose = verbose;
+}
+
+G4bool
+G4VTrajectoryModel::GetVerbose() const
+{
+  return fVerbose;
+}
Index: tags/visualization-10.5-before-10.6_test/modeling/src/G4VisTrajContext.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/modeling/src/G4VisTrajContext.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/modeling/src/G4VisTrajContext.cc	(revision 1102)
@@ -0,0 +1,52 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+#include "G4VisTrajContext.hh"
+
+// Default configuration
+G4VisTrajContext::G4VisTrajContext(const G4String& name)
+  :fName(name)
+  ,fLineColour(G4Colour::Grey())
+  ,fLineVisible(true)
+  ,fDrawLine(true)
+  ,fDrawAuxPts(false)
+  ,fAuxPtsType(G4Polymarker::squares)
+  ,fAuxPtsSize(2)
+  ,fAuxPtsSizeType(G4VMarker::screen)
+  ,fAuxPtsFillStyle(G4VMarker::filled)
+  ,fAuxPtsColour(G4Colour::Magenta())
+  ,fAuxPtsVisible(true)
+  ,fDrawStepPts(false)
+  ,fStepPtsType(G4Polymarker::circles)
+  ,fStepPtsSize(2)
+  ,fStepPtsSizeType(G4VMarker::screen)
+  ,fStepPtsFillStyle(G4VMarker::filled)
+  ,fStepPtsColour(G4Colour::Yellow())
+  ,fStepPtsVisible(true)
+  ,fTimeSliceInterval(0.)
+{}
+
+// Destructor
+G4VisTrajContext::~G4VisTrajContext() {}
Index: tags/visualization-10.5-before-10.6_test/run1.mac
===================================================================
--- tags/visualization-10.5-before-10.6_test/run1.mac	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/run1.mac	(revision 1102)
@@ -0,0 +1,20 @@
+# $Id: run1.mac,v 1.2 2000/11/21 10:59:42 maire Exp $
+#
+# Macro file for "exampleN03.cc"
+# 
+# can be run in batch, without graphic
+# or interactively: Idle> /control/execute run1.mac
+#
+/control/verbose 2
+/control/saveHistory
+#
+/run/verbose 2
+/event/verbose 0
+/tracking/verbose 1
+# 
+# muon 300 MeV to the direction (1.,0.,0.)
+# 3 events
+#
+/gun/particle mu+
+/gun/energy 300 MeV
+/run/beamOn 3
Index: tags/visualization-10.5-before-10.6_test/run2.mac
===================================================================
--- tags/visualization-10.5-before-10.6_test/run2.mac	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/run2.mac	(revision 1102)
@@ -0,0 +1,28 @@
+# $Id: run2.mac,v 1.6 2002/12/16 16:37:25 maire Exp $
+#
+# Macro file of "exampleN03.cc"
+#
+# can be run in batch, without graphic
+# or interactively: Idle> /control/execute run2.mac
+#
+/control/verbose 2
+# 
+# electron 30 MeV to the direction (1.,0.,0.)
+# 1 event
+#
+/run/beamOn 1
+#
+# shoot randomly 20 events
+#
+/N03/event/printModulo 5
+/N03/gun/rndm on
+/run/beamOn 20
+#
+# activate/inactivate physic processes
+#
+/process/list
+/process/inactivate eBrem
+#
+/run/beamOn 20
+#
+
Index: tags/visualization-10.5-before-10.6_test/test/.cvsignore
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/.cvsignore	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/.cvsignore	(revision 1102)
@@ -0,0 +1,1 @@
+*.d
Index: tags/visualization-10.5-before-10.6_test/test/Doxyfile
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/Doxyfile	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/Doxyfile	(revision 1102)
@@ -0,0 +1,921 @@
+# Doxyfile 1.2.14
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+#       TAG = value [value, ...]
+# For lists items can also be appended using:
+#       TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# General configuration options
+#---------------------------------------------------------------------------
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded 
+# by quotes) that should identify the project.
+
+PROJECT_NAME           = vis-test
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. 
+# This could be handy for archiving the generated documentation or 
+# if some version control system is used.
+
+PROJECT_NUMBER         = vis-V05-01-01
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
+# base path where the generated documentation will be put. 
+# If a relative path is entered, it will be relative to the location 
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY       = 
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all 
+# documentation generated by doxygen is written. Doxygen will use this 
+# information to generate all constant output in the proper language. 
+# The default language is English, other supported languages are: 
+# Brazilian, Chinese, Croatian, Czech, Danish, Dutch, Finnish, French, 
+# German, Greek, Hungarian, Italian, Japanese, Korean, Norwegian, Polish, 
+# Portuguese, Romanian, Russian, Slovak, Slovene, Spanish and Swedish.
+
+OUTPUT_LANGUAGE        = English
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in 
+# documentation are documented, even if no documentation was available. 
+# Private class members and static file members will be hidden unless 
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL            = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class 
+# will be included in the documentation.
+
+EXTRACT_PRIVATE        = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file 
+# will be included in the documentation.
+
+EXTRACT_STATIC         = NO
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) 
+# defined locally in source files will be included in the documentation. 
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES  = YES
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all 
+# undocumented members of documented classes, files or namespaces. 
+# If set to NO (the default) these members will be included in the 
+# various overviews, but no documentation section is generated. 
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS     = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all 
+# undocumented classes that are normally visible in the class hierarchy. 
+# If set to NO (the default) these class will be included in the various 
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES     = NO
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will 
+# include brief member descriptions after the members that are listed in 
+# the file and class documentation (similar to JavaDoc). 
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend 
+# the brief description of a member or function before the detailed description. 
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the 
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF           = YES
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then 
+# Doxygen will generate a detailed section even if there is only a brief 
+# description.
+
+ALWAYS_DETAILED_SEC    = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all inherited 
+# members of a class in the documentation of that class as if those members were 
+# ordinary class members. Constructors, destructors and assignment operators of 
+# the base classes will not be shown.
+
+INLINE_INHERITED_MEMB  = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full 
+# path before files name in the file list and in the header files. If set 
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES        = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag 
+# can be used to strip a user defined part of the path. Stripping is 
+# only done if one of the specified strings matches the left-hand part of 
+# the path. It is allowed to use relative paths in the argument list.
+
+STRIP_FROM_PATH        = 
+
+# The INTERNAL_DOCS tag determines if documentation 
+# that is typed after a \internal command is included. If the tag is set 
+# to NO (the default) then the documentation will be excluded. 
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS          = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct 
+# doxygen to hide any special comment blocks from generated source code 
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS    = YES
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate 
+# file names in lower case letters. If set to YES upper case letters are also 
+# allowed. This is useful if you have classes or files whose names only differ 
+# in case and if your file system supports case sensitive file names. Windows 
+# users are adviced to set this option to NO.
+
+CASE_SENSE_NAMES       = YES
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter 
+# (but less readable) file names. This can be useful is your file systems 
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES            = NO
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen 
+# will show members with their full class and namespace scopes in the 
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES       = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen 
+# will generate a verbatim copy of the header file for each class for 
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS       = YES
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen 
+# will put list of the files that are included by a file in the documentation 
+# of that file.
+
+SHOW_INCLUDE_FILES     = YES
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen 
+# will interpret the first line (until the first dot) of a JavaDoc-style 
+# comment as the brief description. If set to NO, the JavaDoc 
+# comments  will behave just like the Qt-style comments (thus requiring an 
+# explict @brief command for a brief description.
+
+JAVADOC_AUTOBRIEF      = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented 
+# member inherits the documentation from any documented member that it 
+# reimplements.
+
+INHERIT_DOCS           = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] 
+# is inserted in the documentation for inline members.
+
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen 
+# will sort the (detailed) documentation of file and class members 
+# alphabetically by member name. If set to NO the members will appear in 
+# declaration order.
+
+SORT_MEMBER_DOCS       = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC 
+# tag is set to YES, then doxygen will reuse the documentation of the first 
+# member in the group (if any) for the other members of the group. By default 
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC   = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. 
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE               = 8
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or 
+# disable (NO) the todo list. This list is created by putting \todo 
+# commands in the documentation.
+
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or 
+# disable (NO) the test list. This list is created by putting \test 
+# commands in the documentation.
+
+GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or 
+# disable (NO) the bug list. This list is created by putting \bug 
+# commands in the documentation.
+
+GENERATE_BUGLIST       = YES
+
+# This tag can be used to specify a number of aliases that acts 
+# as commands in the documentation. An alias has the form "name=value". 
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to 
+# put the command \sideeffect (or @sideeffect) in the documentation, which 
+# will result in a user defined paragraph with heading "Side Effects:". 
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES                = 
+
+# The ENABLED_SECTIONS tag can be used to enable conditional 
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS       = 
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines 
+# the initial value of a variable or define consist of for it to appear in 
+# the documentation. If the initializer consists of more lines than specified 
+# here it will be hidden. Use a value of 0 to hide initializers completely. 
+# The appearance of the initializer of individual variables and defines in the 
+# documentation can be controlled using \showinitializer or \hideinitializer 
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES  = 30
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources 
+# only. Doxygen will then generate output that is more tailored for C. 
+# For instance some of the names that are used will be different. The list 
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C  = NO
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated 
+# at the bottom of the documentation of classes and structs. If set to YES the 
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES        = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated 
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET                  = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are 
+# generated by doxygen. Possible values are YES and NO. If left blank 
+# NO is used.
+
+WARNINGS               = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings 
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will 
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED   = YES
+
+# The WARN_FORMAT tag determines the format of the warning messages that 
+# doxygen can produce. The string should contain the $file, $line, and $text 
+# tags, which will be replaced by the file and line number from which the 
+# warning originated and the warning text.
+
+WARN_FORMAT            = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning 
+# and error messages should be written. If left blank the output is written 
+# to stderr.
+
+WARN_LOGFILE           = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain 
+# documented source files. You may enter file names like "myfile.cpp" or 
+# directories like "/usr/src/myproject". Separate the files or directories 
+# with spaces.
+
+INPUT                  = include src
+
+# If the value of the INPUT tag contains directories, you can use the 
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank the following patterns are tested: 
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp 
+# *.h++ *.idl *.odl
+
+FILE_PATTERNS          = 
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories 
+# should be searched for input files as well. Possible values are YES and NO. 
+# If left blank NO is used.
+
+RECURSIVE              = NO
+
+# The EXCLUDE tag can be used to specify files and/or directories that should 
+# excluded from the INPUT source files. This way you can easily exclude a 
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE                = 
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories 
+# that are symbolic links (a Unix filesystem feature) are excluded from the input.
+
+EXCLUDE_SYMLINKS       = NO
+
+# If the value of the INPUT tag contains directories, you can use the 
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude 
+# certain files from those directories.
+
+EXCLUDE_PATTERNS       = 
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or 
+# directories that contain example code fragments that are included (see 
+# the \include command).
+
+EXAMPLE_PATH           = 
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the 
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank all files are included.
+
+EXAMPLE_PATTERNS       = 
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be 
+# searched for input files to be used with the \include or \dontinclude 
+# commands irrespective of the value of the RECURSIVE tag. 
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE      = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or 
+# directories that contain image that are included in the documentation (see 
+# the \image command).
+
+IMAGE_PATH             = 
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should 
+# invoke to filter for each input file. Doxygen will invoke the filter program 
+# by executing (via popen()) the command <filter> <input-file>, where <filter> 
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an 
+# input file. Doxygen will then use the output that the filter program writes 
+# to standard output.
+
+INPUT_FILTER           = 
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using 
+# INPUT_FILTER) will be used to filter the input files when producing source 
+# files to browse.
+
+FILTER_SOURCE_FILES    = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will 
+# be generated. Documented entities will be cross-referenced with these sources.
+
+SOURCE_BROWSER         = YES
+
+# Setting the INLINE_SOURCES tag to YES will include the body 
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES         = NO
+
+# If the REFERENCED_BY_RELATION tag is set to YES (the default) 
+# then for each documented function all documented 
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = YES
+
+# If the REFERENCES_RELATION tag is set to YES (the default) 
+# then for each documented function all documented entities 
+# called/used by that function will be listed.
+
+REFERENCES_RELATION    = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index 
+# of all compounds will be generated. Enable this if the project 
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX     = NO
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then 
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns 
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX    = 5
+
+# In case all classes in a project start with a common prefix, all 
+# classes will be put under the same header in the alphabetical index. 
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that 
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX          = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will 
+# generate HTML output.
+
+GENERATE_HTML          = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT            = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for 
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank 
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION    = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard header.
+
+HTML_HEADER            = 
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard footer.
+
+HTML_FOOTER            = 
+
+# The HTML_STYLESHEET tag can be used to specify a user defined cascading 
+# style sheet that is used by each HTML page. It can be used to 
+# fine-tune the look of the HTML output. If the tag is left blank doxygen 
+# will generate a default style sheet
+
+HTML_STYLESHEET        = 
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, 
+# files or namespaces will be aligned in HTML using tables. If set to 
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS     = YES
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files 
+# will be generated that can be used as input for tools like the 
+# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) 
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP      = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag 
+# controls if a separate .chi index file is generated (YES) or that 
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI           = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag 
+# controls whether a binary table of contents is generated (YES) or a 
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members 
+# to the contents of the Html help documentation and to the tree view.
+
+TOC_EXPAND             = NO
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at 
+# top of each HTML page. The value NO (the default) enables the index and 
+# the value YES disables it.
+
+DISABLE_INDEX          = NO
+
+# This tag can be used to set the number of enum values (range [1..20]) 
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE   = 4
+
+# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
+# generated containing a tree-like index structure (just like the one that 
+# is generated for HTML Help). For this to work a browser that supports 
+# JavaScript and frames is required (for instance Mozilla, Netscape 4.0+, 
+# or Internet explorer 4.0+). Note that for large projects the tree generation 
+# can take a very long time. In such cases it is better to disable this feature. 
+# Windows users are probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW      = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be 
+# used to set the initial width (in pixels) of the frame in which the tree 
+# is shown.
+
+TREEVIEW_WIDTH         = 250
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will 
+# generate Latex output.
+
+GENERATE_LATEX         = YES
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT           = latex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact 
+# LaTeX documents. This may be useful for small projects and may help to 
+# save some trees in general.
+
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used 
+# by the printer. Possible values are: a4, a4wide, letter, legal and 
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE             = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX 
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES         = 
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for 
+# the generated latex document. The header should contain everything until 
+# the first chapter. If it is left blank doxygen will generate a 
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER           = 
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated 
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will 
+# contain links (just like the HTML output) instead of page references 
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS         = NO
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of 
+# plain latex in the generated Makefile. Set this option to YES to get a 
+# higher quality PDF documentation.
+
+USE_PDFLATEX           = NO
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. 
+# command to the generated LaTeX files. This will instruct LaTeX to keep 
+# running if errors occur, instead of asking the user for help. 
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE        = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output 
+# The RTF output is optimised for Word 97 and may not look very pretty with 
+# other RTF readers or editors.
+
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact 
+# RTF documents. This may be useful for small projects and may help to 
+# save some trees in general.
+
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated 
+# will contain hyperlink fields. The RTF file will 
+# contain links (just like the HTML output) instead of page references. 
+# This makes the output suitable for online browsing using WORD or other 
+# programs which support those fields. 
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS         = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's 
+# config file, i.e. a series of assigments. You only have to provide 
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE    = 
+
+# Set optional variables used in the generation of an rtf document. 
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE    = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will 
+# generate man pages
+
+GENERATE_MAN           = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT             = man
+
+# The MAN_EXTENSION tag determines the extension that is added to 
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION          = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output, 
+# then it will generate one additional man file for each entity 
+# documented in the real man page(s). These additional files 
+# only source the real man page, but without them the man command 
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will 
+# generate an XML file that captures the structure of 
+# the code including all documentation. Note that this 
+# feature is still experimental and incomplete at the 
+# moment.
+
+GENERATE_XML           = NO
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will 
+# generate an AutoGen Definitions (see autogen.sf.net) file 
+# that captures the structure of the code including all 
+# documentation. Note that this feature is still experimental 
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF   = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will 
+# evaluate all C-preprocessor directives found in the sources and include 
+# files.
+
+ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro 
+# names in the source code. If set to NO (the default) only conditional 
+# compilation will be performed. Macro expansion can be done in a controlled 
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION        = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES 
+# then the macro expansion is limited to the macros specified with the 
+# PREDEFINED and EXPAND_AS_PREDEFINED tags.
+
+EXPAND_ONLY_PREDEF     = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files 
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that 
+# contain include files that are not input files but should be processed by 
+# the preprocessor.
+
+INCLUDE_PATH           = 
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard 
+# patterns (like *.h and *.hpp) to filter out the header-files in the 
+# directories. If left blank, the patterns specified with FILE_PATTERNS will 
+# be used.
+
+INCLUDE_FILE_PATTERNS  = 
+
+# The PREDEFINED tag can be used to specify one or more macro names that 
+# are defined before the preprocessor is started (similar to the -D option of 
+# gcc). The argument of the tag is a list of macros of the form: name 
+# or name=definition (no spaces). If the definition and the = are 
+# omitted =1 is assumed.
+
+PREDEFINED             = 
+
+# If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then 
+# this tag can be used to specify a list of macro names that should be expanded. 
+# The macro definition that is found in the sources will be used. 
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED      = 
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then 
+# doxygen's preprocessor will remove all function-like macros that are alone 
+# on a line and do not end with a semicolon. Such function macros are typically 
+# used for boiler-plate code, and will confuse the parser if not removed.
+
+SKIP_FUNCTION_MACROS   = YES
+
+#---------------------------------------------------------------------------
+# Configuration::addtions related to external references   
+#---------------------------------------------------------------------------
+
+# The TAGFILES tag can be used to specify one or more tagfiles.
+
+TAGFILES               = 
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create 
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE       = 
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed 
+# in the class index. If set to NO only the inherited external classes 
+# will be listed.
+
+ALLEXTERNALS           = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed 
+# in the modules index. If set to NO, only the current project's groups will 
+# be listed.
+
+EXTERNAL_GROUPS        = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script 
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH              = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will 
+# generate a inheritance diagram (in Html, RTF and LaTeX) for classes with base or 
+# super classes. Setting the tag to NO turns the diagrams off. Note that this 
+# option is superceded by the HAVE_DOT option below. This is only a fallback. It is 
+# recommended to install and use dot, since it yield more powerful graphs.
+
+CLASS_DIAGRAMS         = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is 
+# available from the path. This tool is part of Graphviz, a graph visualization 
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section 
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT               = NO
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect inheritance relations. Setting this tag to YES will force the 
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect implementation dependencies (inheritance, containment, and 
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH    = YES
+
+# If set to YES, the inheritance and collaboration graphs will show the 
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS     = YES
+
+# If set to YES, the inheritance and collaboration graphs will hide 
+# inheritance and usage relations if the target is undocumented 
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS   = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT 
+# tags are set to YES then doxygen will generate a graph for each documented 
+# file showing the direct and indirect include dependencies of the file with 
+# other documented files.
+
+INCLUDE_GRAPH          = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and 
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each 
+# documented header file showing the documented files that directly or 
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH      = YES
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen 
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY    = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images 
+# generated by dot. Possible values are gif, jpg, and png
+# If left blank gif will be used.
+
+DOT_IMAGE_FORMAT       = gif
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be 
+# found. If left blank, it is assumed the dot tool can be found on the path.
+
+DOT_PATH               = 
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that 
+# contain dot files that are included in the documentation (see the 
+# \dotfile command).
+
+DOTFILE_DIRS           = 
+
+# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width 
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than 
+# this value, doxygen will try to truncate the graph, so that it fits within 
+# the specified constraint. Beware that most browsers cannot cope with very 
+# large images.
+
+MAX_DOT_GRAPH_WIDTH    = 1024
+
+# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height 
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than 
+# this value, doxygen will try to truncate the graph, so that it fits within 
+# the specified constraint. Beware that most browsers cannot cope with very 
+# large images.
+
+MAX_DOT_GRAPH_HEIGHT   = 1024
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will 
+# generate a legend page explaining the meaning of the various boxes and 
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will 
+# remove the intermedate dot files that are used to generate 
+# the various graphs.
+
+DOT_CLEANUP            = YES
+
+#---------------------------------------------------------------------------
+# Configuration::addtions related to the search engine   
+#---------------------------------------------------------------------------
+
+# The SEARCHENGINE tag specifies whether or not a search engine should be 
+# used. If set to NO the values of all tags below this one will be ignored.
+
+SEARCHENGINE           = NO
+
+# The CGI_NAME tag should be the name of the CGI script that 
+# starts the search engine (doxysearch) with the correct parameters. 
+# A script with this name will be generated by doxygen.
+
+CGI_NAME               = search.cgi
+
+# The CGI_URL tag should be the absolute URL to the directory where the 
+# cgi binaries are located. See the documentation of your http daemon for 
+# details.
+
+CGI_URL                = 
+
+# The DOC_URL tag should be the absolute URL to the directory where the 
+# documentation is located. If left blank the absolute path to the 
+# documentation, with file:// prepended to it, will be used.
+
+DOC_URL                = 
+
+# The DOC_ABSPATH tag should be the absolute path to the directory where the 
+# documentation is located. If left blank the directory on the local machine 
+# will be used.
+
+DOC_ABSPATH            = 
+
+# The BIN_ABSPATH tag must point to the directory where the doxysearch binary 
+# is installed.
+
+BIN_ABSPATH            = /usr/local/bin/
+
+# The EXT_DOC_PATHS tag can be used to specify one or more paths to 
+# documentation generated for other projects. This allows doxysearch to search 
+# the documentation for these projects as well.
+
+EXT_DOC_PATHS          = 
Index: tags/visualization-10.5-before-10.6_test/test/GNUmakefile
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/GNUmakefile	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/GNUmakefile	(revision 1102)
@@ -0,0 +1,26 @@
+# $Id: GNUmakefile,v 1.8 2006/05/12 12:39:16 allison Exp $
+# --------------------------------------------------------------
+# GNUmakefile for examples module.  Gabriele Cosmo, 06/04/98.
+# --------------------------------------------------------------
+
+name := test19
+G4TARGET := $(name)
+G4EXLIB := true
+
+ifndef G4INSTALL
+  G4INSTALL = ../../..
+endif
+
+.PHONY: all
+all: lib bin
+
+include $(G4INSTALL)/config/binmake.gmk
+
+ifdef G4VIS_USE
+CPPFLAGS += -I$(G4BASE)/visualization/XXX/include
+EXTRALIBS += -lG4visXXX
+endif
+
+ifdef G4VIS_USE_XXXSG
+  CPPFLAGS += -DG4VIS_USE_XXXSG
+endif
Index: tags/visualization-10.5-before-10.6_test/test/History
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/History	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/History	(revision 1102)
@@ -0,0 +1,410 @@
+$Id: History,v 1.117 2009/07/28 12:50:51 lgarnier Exp $
+
+History file for visualization/test subdirectory
+------------------------------------------------
+
+$Log: History,v $
+Revision 1.117  2009/07/28 12:50:51  lgarnier
+Adding Qt support for test19
+
+Revision 1.117  2009/07/28 14:49:14  garnier
+Adding Qt support for test19
+
+Revision 1.116  2008/04/04 14:02:04  allison
+vistest-V09-01-01
+
+Revision 1.115  2008/04/04 14:01:14  allison
+Changed to thickness of box for 2D drawing to zero.
+
+Revision 1.114  2008/01/04 21:54:37  allison
+vistest-V09-01-00
+
+Revision 1.113  2008/01/04 21:53:51  allison
+MyEventAction: Added 2D polyhedron.
+
+Revision 1.112  2007/01/05 16:01:43  allison
+vistest-V08-02-00
+
+Revision 1.111  2007/01/05 16:00:48  allison
+Refines usage:
+// Usage: test19 [<session>] [<verbosity>]
+// Without verbosity, verbosity=warnings.
+// Without session, session=new G4UIterminal(), or if G4UI_USE_TCSH is set
+//                  session=new G4UIterminal(new G4UItcsh),
+
+Revision 1.110  2006/11/14 16:04:33  allison
+vistest-V08-01-05
+
+Revision 1.109  2006/11/14 16:03:56  allison
+Added G4EllipticalCone.
+
+Revision 1.108  2006/11/03 14:18:34  allison
+vistest-V08-01-04
+
+Revision 1.107  2006/11/03 14:18:21  allison
+Removed MyTrackingAction.
+
+Revision 1.106  2006/11/01 11:17:04  allison
+vistest-V08-01-03
+
+Revision 1.105  2006/11/01 11:15:27  allison
+Added a G4Polycone.
+
+Revision 1.104  2006/11/01 11:14:05  allison
+Added some G4Atts to magenta box.
+
+Revision 1.103  2006/08/14 11:26:49  allison
+vistest-V08-01-02
+
+Revision 1.102  2006/08/14 11:26:12  allison
+Added MyTrackingAction - uses G4RichTrajectory and triggers auxiliary points.
+
+Revision 1.101  2006/07/10 16:18:33  allison
+vistest-V08-01-01
+
+Revision 1.100  2006/07/10 16:18:05  allison
+Moved G4Cons and SetForceLineSegmentsPerCircle(100) for G4Sphere.
+
+Revision 1.99  2006/07/03 16:57:20  allison
+vistest-V08-01-00
+
+Revision 1.98  2006/07/03 16:56:42  allison
+Protect against zero run manager pointer.
+
+Revision 1.97  2006/06/05 08:13:38  perl
+Update history
+
+Revision 1.96  2006/05/25 09:15:38  perl
+Added G4Cons example.
+vistest-V08-00-08
+
+Revision 1.95  2006/05/25 09:15:38  allison
+vistest-V08-00-07
+
+Revision 1.94  2006/05/25 09:14:30  allison
+Restored test19.g4m.
+
+Revision 1.93  2006/05/25 09:12:37  allison
+Removed standalone - moved to examples/extended/visualization.
+
+Revision 1.92  2006/05/12 12:41:21  allison
+vistest-V08-00-06
+
+Revision 1.91  2006/05/12 12:39:16  allison
+Protected inclusion of G4visXXX library with G4VIS_USE.
+
+Revision 1.90  2006/05/12 12:37:46  allison
+Added /vis/scene/add/eventID.
+
+Revision 1.89  2006/05/12 12:36:45  allison
+Moved text to bottom right so as not to interfere with /vis/scene/add/eventID.
+
+Revision 1.88  2006/05/12 12:35:55  allison
+Commented out SetRunID.  Interferes with run number set in re-computation of transients.
+
+Revision 1.87  2006/05/04 14:44:02  allison
+vistest-V08-00-05
+
+Revision 1.86  2006/05/04 14:43:27  allison
+Remove UI->ApplyCommand("/tracking/storeTrajectory 1")
+
+Revision 1.85  2006/04/19 14:46:42  allison
+vistest-V08-00-04
+
+Revision 1.84  2006/04/19 14:44:57  allison
+Added drawing of 2D text.
+
+Revision 1.83  2006/03/28 15:41:54  allison
+vistest-V08-00-03
+
+Revision 1.82  2006/03/28 15:41:01  allison
+MyEventAction.cc:
+- Printed genuine Run and Event numbers.
+- Added transientTube.
+
+Revision 1.81  2006/03/28 15:38:10  allison
+test19.g4m: Modernised.
+
+Revision 1.80  2006/03/28 15:37:36  allison
+test19.cc: Added G4XXXFile, G4XXXStored and G4XXXSG.
+
+Revision 1.79  2006/03/28 15:36:27  allison
+Added CPPFLAGS += -DG4VIS_USE_XXXSG.
+
+Revision 1.78  2006/03/03 17:42:12  allison
+vistest-V08-00-02
+
+Revision 1.77  2006/03/03 17:39:44  allison
+MyEventAction.cc: Added transient drawing of box to test transient handling.
+
+Revision 1.76  2006/02/08 21:51:10  allison
+Added extra placements as a test of drawn volume path and corected duplicate naming of aTwistedTrd.
+
+Revision 1.75  2006/01/26 11:30:29  allison
+vistest-V08-00-01 - needs the head of geometry/solids/specific.
+
+Revision 1.74  2006/01/26 11:28:52  allison
+Restored MyDetectorConstruction.cc but added comments about voxelisation crash.
+
+Revision 1.73  2006/01/26 11:27:41  allison
+Changed OGLSX to OGLSXm for logical volume to allow inspection of voxels.
+Augmented RayTracer test.
+
+Revision 1.72  2006/01/26 10:45:59  allison
+Moved orb to avoid overlap.
+
+Revision 1.71  2006/01/13 12:19:19  allison
+test19.g4m: Added /tracking/verbose 2 for problem trajectory.  Reduced
+size of ray tracer windows for speed and added /vis/rayTracer/trace.
+
+Revision 1.70  2006/01/11 17:07:08  allison
+vistest-V08-00-00 - needs the head of geometry/solids/specific.
+
+Revision 1.69  2006/01/11 17:04:29  allison
+Improved Perspective example.
+
+Revision 1.68  2006/01/11 16:59:38  allison
+Added twisted solids.
+
+Revision 1.67  2006/01/09 17:23:22  allison
+Added CLHEP:: scope name.
+
+Revision 1.66  2005/11/22 15:53:47  allison
+vistest-V07-01-04
+
+Revision 1.65  2005/11/22 15:52:07  allison
+Added PerspectiveVisAction.
+
+Revision 1.64  2005/11/22 15:47:21  allison
+vistest-V07-01-04 (bum)
+
+Revision 1.63  2005/11/22 15:45:04  allison
+test19.g4m: Changed RayTracer to RayTracerX.
+
+Revision 1.62  2005/11/22 15:43:54  allison
+MyDetectorConstruction.cc: Added G4Tet.  Refined G4Polyhedra (generic
+constructor).
+
+Revision 1.61  2005/10/13 17:15:25  allison
+vistest-V07-01-03
+
+Revision 1.60  2005/10/13 17:14:04  allison
+Migrated to <sstream>.
+
+Revision 1.59  2005/10/13 17:13:08  allison
+Changed transparent atts to alpha=0.1.
+
+Revision 1.58  2005/10/13 17:11:32  allison
+Removed temporary CPPFLAGS += -DG4VIS_USE_RAYTRACERX.
+
+Revision 1.57  2005/09/16 01:10:40  allison
+vistest-V07-01-02
+
+Revision 1.56  2005/09/16 01:10:11  allison
+Added a G4AttValue with time.
+
+Revision 1.55  2005/09/13 16:55:26  allison
+vistest-V07-01-01
+
+Revision 1.54  2005/09/13 16:54:48  allison
+Removed RayTracerX from test19.cc - now in G4VisExecutive.
+
+Revision 1.53  2005/09/13 16:53:34  allison
+Set replica mothers invisible.
+
+Revision 1.52  2005/07/20 16:24:32  allison
+vistest-V07-01-00
+
+Revision 1.51  2005/07/20 16:23:39  allison
+test19.g4m: Commented out help (gives error in a macro).
+
+Revision 1.49  2005/07/20 16:20:15  allison
+G4LogoVisAction.cc: Experiment with creating tetrahedron with a missing face.
+
+Revision 1.48  2005/07/20 16:15:57  allison
+test19.cc: Added #include "G4RayTracerX.hh" and acted on command line argument, tcsh.
+
+Revision 1.47  2005/05/27 13:43:57  allison
+Passed vis attribs by reference to test SetVisAttributes.
+
+Revision 1.46  2005/05/06 08:30:45  allison
+VisActionWithAttDefs: updated for latest AttCheck.
+
+Revision 1.45  2005/05/06 08:27:56  allison
+MyEventAction: Added event no., draw with text.
+
+Revision 1.44  2005/03/23 17:44:05  allison
+First version of standalone/visActionWithAttDefs.
+
+Revision 1.43  2005/03/09 16:06:53  allison
+Added test of /vis/scene/add/logo.
+
+Revision 1.42  2005/03/09 16:05:48  allison
+Added G4Polyhedra.
+
+Revision 1.41  2005/03/03 16:46:20  allison
+Added G4Logo.
+
+Revision 1.40  2005/02/19 21:51:03  allison
+Added standalone.
+
+Revision 1.39  2005/02/04 16:28:53  johna
+Introduced General Particle Source under control of GPS macro.
+
+Revision 1.38  2005/02/04 16:26:38  johna
+Introduced G4VisExecutive.
+
+Revision 1.37  2005/01/26 17:17:02  johna
+Increased hall size for some new volumes and tested General Particle Source (commented out).
+
+Revision 1.36  2004/11/11 16:10:07  johna
+Added test of G4Orb.
+
+Revision 1.35  2004/09/22 20:17:40  johna
+vistest-V06-02-02: refined rotated tube test.
+
+Revision 1.34  2004/09/22 20:17:12  johna
+vistest-V06-02-02: refined rotated tube test.
+
+Revision 1.33  2004/09/13 21:13:48  johna
+Augmented ParameterisedBox and rotated a tracker tube for a test.
+
+Revision 1.32  2004/09/13 21:11:44  johna
+Added test of rotated tracker tube in test19.g4m.
+
+Revision 1.31  2004/07/14 10:41:10  johna
+vistest-V06-02-01
+
+Revision 1.30  2004/07/13 12:56:05  johna
+Added BuildHouse.hh.
+
+Revision 1.29  2004/07/13 12:53:57  johna
+Added /vis/viewer/set/hiddenEdge to test19.g4m.
+
+Revision 1.28  2004/07/01 15:53:20  johna
+vistest-V06-02-00
+
+Revision 1.27  2004/07/01 15:52:24  johna
+Added first version of BuildHouse.
+
+Revision 1.26  2004/07/01 15:51:38  johna
+Removed runManager->Initialize() - do with /run/initialize.
+
+Revision 1.25  2004/07/01 15:50:01  johna
+Corrected add/trajectories in test19.g4m.
+
+Revision 1.24  2004/07/01 15:47:59  johna
+Removed call_list.dat - taking space.
+
+Revision 1.23  2003/11/06 15:18:30  johna
+vis-V05-02-03: changed MyPhysicsList to follow kernel changes.
+
+Revision 1.22  2003/09/22 10:43:12  johna
+- Introduced Doxygen documentation for management, OpenGL and test.
+- Refined raytracer test.
+
+Revision 1.21  2003/09/02 14:20:12  johna
+Added Ray Tracer bug comment.
+
+Revision 1.20  2003/09/02 14:19:32  johna
+Changed to const G4Run*.
+
+Revision 1.19  2003/09/02 14:18:46  johna
+Fixed pedantic warnings.
+
+Revision 1.18  2002/08/12 10:16:54  johna
+Forced commit (-f) test of dollar Log.
+
+Revision 1.17  2002/08/12 10:14:23  johna
+Further test of dollar Log.
+
+Revision 1.16  2002/08/12 10:12:27  johna
+Added dollar Log for fun.
+
+22nd April 2002  John Allison
+- Added SharedSolidDetectorConstruction.
+
+27th September 2001  John Allison (vis-test-V03-02-00)
+- Removed hits and hit collection code to avoid dependence on STLinterface.
+
+24th August 2001  John Allison  (vis-V03-02-13)
+- Moved drawing of scale from stepping action to event action.
+
+17th August 2001  John Allison  (vis-V03-02-12)
+- test19.cc registers graphics system XXX.
+- MySteppingAction draws a scale.
+
+29th May 2001  John Allison
+- Cleaned up Linux pedantic warnings (unused variables, comparisons, etc.)
+
+15th March 2001  John Allison  (vis-V03-00-08)
+- Major re-work of replica instantiation in MyDetectorConstruction.cc
+  to ensure correspondence with rule that phi=0 bisects the replicated
+  sub-volume.  Note: replicas still cause crash on Linux in Ray Tracer.
+- Suppressed multiple scattereing lateral displacement in MyPhysicsList.cc
+  (can't remember why!).
+
+21st February 2001  John Allison
+- Changed test14.g4m to new commands.
+
+1st February 2001  John Allison (vis-V03-00-01)
+- Added /vis/set/sides 100 to test19.g4m and changed rayTracer to 400x400.
+
+16th January 2001  John Allison
+- Changed screen units to pixels in MySteppingAction.cc.
+
+3rd July 2000  John Allison
+- Switched to replicas in MyDetectorConstruction.
+
+22nd May 2000  John Allison
+- Invoke G4UItcsh in G4UIterminal in test19.cc (needs interfaces-V01-01-00).
+- Evgeni's node positions to avoid shared faces/edges in
+  MyDetectorConstruction.cc.
+- Changed colour of intercepts in MySteppingAction.cc.
+- Demonstrated G4VTreeGraphicsScene in test19.cc.
+
+12th April 2000  John Allison  vis-V01-01-01
+- Added more boolean shapes and window to test.
+
+11th January 2000  John Allison
+- Added Sphere and test of displaced solids.
+
+16th December 1999  John Allison
+- MyDetectorConstruction.cc: added replica volumes.
+- test19.cc: added more printing to check destruction of managers.
+- test19.g4m: added commands for viewing replicas.
+
+12th August  Guy Barrand
+- introduce the X11 resource file test19.xrm
+  to control appearance of things. It is used
+  as usual with : setenv XENVIRONMENT test19.xrm
+
+10th August  Guy Barrand
+- test19.cc : execute win32.g4m on NT.
+- correct Initialize method in test_utils/SD files.
+- GNUmakefiles : use G4ATLAS variable to say where is ATLAS
+                 and test is it is installed.
+
+vis-00-02-02  9th August  John Allison
+- Commented out old commands in test19.g4m.
+
+vis-00-07-01  3rd July 1998  John Allison
+- Added CPPFLAGS += -I$(G4BASE)/digits+hits/digits/include to GNUmakefile.
+
+vis-00-06-06  11th June 1998  John Allison
+- GNUmakefile handles new digits+hits.
+- GNUmakefile uses default vis library creation (separate libraries).
+- test_utils/GNUmakefile and babar_utils/GNUmakefile use G4VIS_USE.gmk.
+- test_utils - various hacking to get it to work with alpha07!
+
+vis-00-06-01 29th April 1998  John Allison
+- Made template instantiations exclusive to GNU_GCC in
+  test_utils/src/MyTrackerHit.cc and MyCalorimeterHit.cc.
+
+27th April 1998 Guy Barrand
+- test19.odb : remove the Xo button so that user,
+               by default create, through "Wo" gs,
+               an XoCamera seen handled by Wo.
+
+vis-test-00-05-01  18th March  John Allison
+- Changes to accomodate MyPhysicsList.
Index: tags/visualization-10.5-before-10.6_test/test/include/BuildCalorimeter.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/include/BuildCalorimeter.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/include/BuildCalorimeter.hh	(revision 1102)
@@ -0,0 +1,39 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: BuildCalorimeter.hh,v 1.4 2006/06/29 21:33:34 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+
+#ifndef BUILDCALORIMETER_HH
+#define BUILDCALORIMETER_HH
+
+class G4VPhysicalVolume;
+
+G4VPhysicalVolume* BuildCalorimeter();
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/test/include/BuildGeom_Example1.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/include/BuildGeom_Example1.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/include/BuildGeom_Example1.hh	(revision 1102)
@@ -0,0 +1,39 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: BuildGeom_Example1.hh,v 1.4 2006/06/29 21:33:36 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+
+#ifndef BUILDGEOM_EXAMPLE1_HH
+#define BUILDGEOM_EXAMPLE1_HH
+
+class G4VPhysicalVolume;
+
+G4VPhysicalVolume* BuildGeom_Example1 ();
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/test/include/BuildGeom_Example2.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/include/BuildGeom_Example2.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/include/BuildGeom_Example2.hh	(revision 1102)
@@ -0,0 +1,39 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: BuildGeom_Example2.hh,v 1.4 2006/06/29 21:33:38 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+
+#ifndef BUILDGEOM_EXAMPLE2_HH
+#define BUILDGEOM_EXAMPLE2_HH
+
+class G4VPhysicalVolume;
+
+G4VPhysicalVolume* BuildGeom_Example2 ();
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/test/include/BuildHouse.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/include/BuildHouse.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/include/BuildHouse.hh	(revision 1102)
@@ -0,0 +1,39 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: BuildHouse.hh,v 1.2 2006/06/29 21:33:40 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+
+#ifndef BUILDHOUSE_HH
+#define BUILDHOUSE_HH
+
+class G4VPhysicalVolume;
+
+G4VPhysicalVolume* BuildHouse();
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/test/include/BuildParametrised.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/include/BuildParametrised.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/include/BuildParametrised.hh	(revision 1102)
@@ -0,0 +1,39 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: BuildParametrised.hh,v 1.4 2006/06/29 21:33:42 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+
+#ifndef BUILDPARAMETRISED_HH
+#define BUILDPARAMETRISED_HH
+
+class G4VPhysicalVolume;
+
+G4VPhysicalVolume* BuildParametrised ();
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/test/include/BuildShapes.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/include/BuildShapes.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/include/BuildShapes.hh	(revision 1102)
@@ -0,0 +1,66 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: BuildShapes.hh,v 1.4 2006/06/29 21:33:44 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+
+#ifndef BUILDSHAPES_HH
+#define BUILDSHAPES_HH
+
+#include "G4VUserDetectorConstruction.hh"
+
+class G4VPhysicalVolume;
+
+G4VPhysicalVolume* BuildBox();
+G4VPhysicalVolume* BuildCylinder();
+G4VPhysicalVolume* BuildTubs();
+G4VPhysicalVolume* BuildCons();
+G4VPhysicalVolume* BuildTrd();
+G4VPhysicalVolume* BuildTrap();
+G4VPhysicalVolume* BuildSphereFull();
+G4VPhysicalVolume* BuildSphereSeg();
+G4VPhysicalVolume* BuildPara();
+G4VPhysicalVolume* BuildPCon();
+G4VPhysicalVolume* BuildPGon();
+G4VPhysicalVolume* BuildForcedWireframeBox();
+
+class testshapesDetectorConstruction : public G4VUserDetectorConstruction
+{
+public:
+  testshapesDetectorConstruction(): fpDetector (0) {}
+  ~testshapesDetectorConstruction() {}
+
+public:
+  G4VPhysicalVolume* Construct() {return fpDetector;}
+  void SetDetector (G4VPhysicalVolume* pDetector) {fpDetector = pDetector;}
+
+private:
+  G4VPhysicalVolume* fpDetector;
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/test/include/G4ParametrizedBox.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/include/G4ParametrizedBox.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/include/G4ParametrizedBox.hh	(revision 1102)
@@ -0,0 +1,50 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4ParametrizedBox.hh,v 1.4 2006/06/29 21:33:46 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Original class written by Hans-Peter Wellisch.
+
+#include "G4VPVParameterisation.hh"
+ class G4ParametrizedBox: public G4VPVParameterisation
+ {
+  virtual void ComputeTransformation(const G4int n,
+                                     G4VPhysicalVolume* pRep) const
+  {
+    pRep->SetTranslation(G4ThreeVector(0,(n-1)*15*m,0));
+  }
+
+  virtual void ComputeDimensions(G4Box &pBox,
+                                 const G4int n,
+                                 const G4VPhysicalVolume* pRep) const
+  {
+    pBox.SetXHalfLength(10*m*n);
+    pBox.SetYHalfLength(5*m*n);
+    pBox.SetZHalfLength(5*m*n);
+  }
+ };
Index: tags/visualization-10.5-before-10.6_test/test/include/MyDetectorConstruction.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/include/MyDetectorConstruction.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/include/MyDetectorConstruction.hh	(revision 1102)
@@ -0,0 +1,72 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: MyDetectorConstruction.hh,v 1.6 2006/06/29 21:33:48 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+
+#ifndef MyDetectorConstruction_h
+#define MyDetectorConstruction_h 1
+
+#include "G4VUserDetectorConstruction.hh"
+#include "globals.hh"
+#include "G4Material.hh"
+#include <vector>
+
+class MyDetectorConstruction : public G4VUserDetectorConstruction
+{
+  public:
+    MyDetectorConstruction();
+    ~MyDetectorConstruction();
+
+  public:
+     G4VPhysicalVolume* Construct();
+
+  private:
+     G4double expHall_x;
+     G4double expHall_y;
+     G4double expHall_z;
+
+     G4double calBox_x;
+     G4double calBox_y;
+     G4double calBox_z;
+     G4double rotAngle;
+     G4double calPos;
+     G4String calMaterialName;
+
+     G4double trackerRadius;
+     G4double trackerHight;
+     G4double trackerPos;
+
+     std::vector<G4Material*> materialPointerStore;
+
+  public:
+     inline void SetCalMaterial(G4String name)
+     { calMaterialName = name; };
+};
+
+#endif
+
Index: tags/visualization-10.5-before-10.6_test/test/include/MyDetectorMessenger.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/include/MyDetectorMessenger.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/include/MyDetectorMessenger.hh	(revision 1102)
@@ -0,0 +1,53 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: MyDetectorMessenger.hh,v 1.4 2006/06/29 21:33:50 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+
+#ifndef MyDetectorMessenger_h
+#define MyDetectorMessenger_h 1
+
+#include "globals.hh"
+#include "G4UImessenger.hh"
+#include "G4UIcommand.hh"
+
+class MyDetectorConstruction;
+
+class MyDetectorMessenger: public G4UImessenger
+{
+public:
+  MyDetectorMessenger(MyDetectorConstruction * myDet);
+  ~MyDetectorMessenger ();
+  void SetNewValue(G4UIcommand * command,G4String newValues);
+private:
+  MyDetectorConstruction * myDetector;
+  G4UIcommand* fpMyDetCommandDirectory;
+  G4UIcommand* fpCalMaterialCommand;
+};
+
+#endif
+
Index: tags/visualization-10.5-before-10.6_test/test/include/MyEventAction.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/include/MyEventAction.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/include/MyEventAction.hh	(revision 1102)
@@ -0,0 +1,57 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: MyEventAction.hh,v 1.6 2006/11/01 11:16:23 allison Exp $
+// GEANT4 tag $Name:  $
+//
+
+#ifndef MyEventAction_h
+#define MyEventAction_h 1
+
+#include "G4UserEventAction.hh"
+#include "G4AttDef.hh"
+#include <map>
+
+class G4Event;
+
+class MyEventAction : public G4UserEventAction
+{
+  public:
+    MyEventAction();
+    ~MyEventAction();
+
+  public:
+    void BeginOfEventAction(const G4Event* anEvent);
+    void EndOfEventAction(const G4Event* anEvent);
+
+  private:
+    std::map<G4String,G4AttDef> fTransientBoxDefs;
+
+};
+
+#endif
+
+    
Index: tags/visualization-10.5-before-10.6_test/test/include/MyPhysicsList.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/include/MyPhysicsList.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/include/MyPhysicsList.hh	(revision 1102)
@@ -0,0 +1,80 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: MyPhysicsList.hh,v 1.5 2006/06/29 21:33:54 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// ------------------------------------------------------------
+//	GEANT 4 class header file 
+//
+//      This class is a class derived from G4VUserPhysicsList
+//      for constructing all particles and processes.
+//
+//	History
+//        first version              10  Jan. 1998 by H.Kurashige
+// ------------------------------------------------------------
+#ifndef MyPhysicsList_h
+#define MyPhysicsList_h 1
+
+#include "G4VUserPhysicsList.hh"
+#include "globals.hh"
+
+class MyPhysicsList: public G4VUserPhysicsList
+{
+  public:
+    MyPhysicsList();
+    virtual ~MyPhysicsList();
+
+  protected:
+    // Construct particle and physics
+    virtual void ConstructParticle();
+    virtual void ConstructProcess();
+
+    // 
+    virtual void SetCuts();
+    
+  protected:
+    // these methods Construct particles 
+    virtual void ConstructBosons();
+    virtual void ConstructLeptons();
+    virtual void ConstructMesons();
+    virtual void ConstructBarions();
+    virtual void ConstructIons();
+
+  protected:
+  // these methods Construct physics processes and register them
+    virtual void ConstructGeneral();
+    virtual void ConstructEM();
+    virtual void ConstructHad();
+    virtual void ConstructLeptHad();
+
+};
+
+#endif
+
+
+
Index: tags/visualization-10.5-before-10.6_test/test/include/MyPrimaryGeneratorAction.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/include/MyPrimaryGeneratorAction.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/include/MyPrimaryGeneratorAction.hh	(revision 1102)
@@ -0,0 +1,69 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: MyPrimaryGeneratorAction.hh,v 1.6 2006/06/29 21:33:56 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+
+#ifndef MyPrimaryGeneratorAction_h
+#define MyPrimaryGeneratorAction_h 1
+
+#include "G4VUserPrimaryGeneratorAction.hh"
+
+// #define GPS // For General Particle Source.
+
+#ifdef GPS
+class G4GeneralParticleSource;
+#else
+class G4ParticleGun;
+#endif
+class G4Event;
+
+class MyPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
+{
+  public:
+    MyPrimaryGeneratorAction();
+    ~MyPrimaryGeneratorAction();
+
+  public:
+    void GeneratePrimaries(G4Event* anEvent);
+#ifdef GPS
+    G4GeneralParticleSource* GetGeneralParticleSource();
+#else
+    G4ParticleGun* GetParticleGun();
+#endif
+
+  private:
+#ifdef GPS
+    G4GeneralParticleSource* particleGun;
+#else
+    G4ParticleGun* particleGun;
+#endif
+};
+
+#endif
+
+
Index: tags/visualization-10.5-before-10.6_test/test/include/MyRunAction.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/include/MyRunAction.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/include/MyRunAction.hh	(revision 1102)
@@ -0,0 +1,56 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: MyRunAction.hh,v 1.6 2006/06/29 21:33:58 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+
+#ifndef MyRunAction_h
+#define MyRunAction_h 1
+
+#include "G4UserRunAction.hh"
+#include "G4Timer.hh"
+#include "globals.hh"
+
+class G4Run;
+
+class MyRunAction : public G4UserRunAction
+{
+  public:
+    MyRunAction();
+    ~MyRunAction();
+
+  public:
+    void BeginOfRunAction(const G4Run* aRun);
+    void EndOfRunAction(const G4Run* aRun);
+
+  private:
+    G4Timer* timer;
+    G4int runIDcounter;
+};
+
+#endif
+
Index: tags/visualization-10.5-before-10.6_test/test/include/MySteppingAction.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/include/MySteppingAction.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/include/MySteppingAction.hh	(revision 1102)
@@ -0,0 +1,47 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: MySteppingAction.hh,v 1.6 2006/06/29 21:34:00 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// 16/Apr/1997  J. Allison:  For visualization/test/test19.
+
+#ifndef MYSTEPPINGACTION_HH
+#define MYSTEPPINGACTION_HH
+
+#include "G4UserSteppingAction.hh"
+
+#include "Randomize.hh"
+
+class MySteppingAction: public G4UserSteppingAction {
+  void UserSteppingAction(const G4Step*);
+  private:
+    CLHEP::HepJamesRandom theJamesEngine;
+    CLHEP::DRand48Engine theDRand48Engine;
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/test/include/ParametrisedBox.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/include/ParametrisedBox.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/include/ParametrisedBox.hh	(revision 1102)
@@ -0,0 +1,99 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: ParametrisedBox.hh,v 1.5 2006/06/29 21:34:02 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Original class written by Hans-Peter Wellisch.
+
+#ifndef PARAMETRISEDBOX_HH
+#define PARAMETRISEDBOX_HH
+
+#include "G4VPVParameterisation.hh"
+
+#include "globals.hh"
+
+class G4VPhysicalVolume;
+class G4Box;
+class G4Material;
+
+class ParametrisedBox: public G4VPVParameterisation
+{
+public:
+  ParametrisedBox (G4Material* a, G4Material* b);
+  void ComputeTransformation(const G4int n,
+			     G4VPhysicalVolume* pRep) const;
+  G4Material* ComputeMaterial(const G4int n, G4VPhysicalVolume*);
+  void ComputeDimensions(G4Box& box,
+			 const G4int n,
+			 const G4VPhysicalVolume* pRep) const;
+  void ComputeDimensions(G4Tubs& shape,
+			 const G4int n,
+			 const G4VPhysicalVolume* pV) const {
+    G4VPVParameterisation::ComputeDimensions(shape,n,pV);
+  }
+  void ComputeDimensions(G4Trd& shape,
+			 const G4int n,
+			 const G4VPhysicalVolume* pV) const {
+    G4VPVParameterisation::ComputeDimensions(shape,n,pV);
+  }
+  void ComputeDimensions(G4Trap& shape,
+			 const G4int n,
+			 const G4VPhysicalVolume* pV) const {
+    G4VPVParameterisation::ComputeDimensions(shape,n,pV);
+  }
+  void ComputeDimensions(G4Cons& shape,
+			 const G4int n,
+			 const G4VPhysicalVolume* pV) const {
+    G4VPVParameterisation::ComputeDimensions(shape,n,pV);
+  }
+  void ComputeDimensions(G4Sphere& shape,
+				 const G4int n,
+				 const G4VPhysicalVolume* pV) const {
+    G4VPVParameterisation::ComputeDimensions(shape,n,pV);
+  }
+  void ComputeDimensions(G4Torus& shape,
+			 const G4int n,
+			 const G4VPhysicalVolume* pV) const {
+    G4VPVParameterisation::ComputeDimensions(shape,n,pV);
+  }
+  void ComputeDimensions(G4Para& shape,
+			 const G4int n,
+			 const G4VPhysicalVolume* pV) const {
+    G4VPVParameterisation::ComputeDimensions(shape,n,pV);
+  }
+  void ComputeDimensions(G4Hype& shape,
+			 const G4int n,
+			 const G4VPhysicalVolume* pV) const {
+    G4VPVParameterisation::ComputeDimensions(shape,n,pV);
+  }
+private:
+  G4Material* fpMaterialA;
+  G4Material* fpMaterialB;
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/test/include/SharedSolidDetectorConstruction.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/include/SharedSolidDetectorConstruction.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/include/SharedSolidDetectorConstruction.hh	(revision 1102)
@@ -0,0 +1,42 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+#ifndef SharedSolidDetectorConstruction_h
+#define SharedSolidDetectorConstruction_h 1
+
+#include "G4VUserDetectorConstruction.hh"
+
+class SharedSolidDetectorConstruction : public G4VUserDetectorConstruction
+{
+  public:
+    SharedSolidDetectorConstruction();
+    ~SharedSolidDetectorConstruction();
+
+  public:
+     G4VPhysicalVolume* Construct();
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/test/include/test19DetectorConstruction.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/include/test19DetectorConstruction.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/include/test19DetectorConstruction.hh	(revision 1102)
@@ -0,0 +1,53 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: test19DetectorConstruction.hh,v 1.4 2006/06/29 21:34:06 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Detector Construction for visualization testing.
+// John Allison 24th April 1997
+
+#ifndef test19DetectorConstruction_hh
+#define test19DetectorConstruction_hh
+
+#include "G4VUserDetectorConstruction.hh"
+
+class test19DetectorConstruction : public G4VUserDetectorConstruction
+{
+public:
+  test19DetectorConstruction();
+  ~test19DetectorConstruction();
+
+public:
+  G4VPhysicalVolume* Construct();
+  void SetDetector (G4VPhysicalVolume* pDetector) {fpDetector = pDetector;}
+
+private:
+  G4VPhysicalVolume* fpDetector;
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/test/include/test19DetectorMessenger.hh
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/include/test19DetectorMessenger.hh	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/include/test19DetectorMessenger.hh	(revision 1102)
@@ -0,0 +1,56 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: test19DetectorMessenger.hh,v 1.4 2006/06/29 21:34:08 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Detector Construction Messenger for visualization testing.
+// John Allison 25th April 1997
+
+#ifndef test19DetectorMessenger_hh
+#define test19DetectorMessenger_hh
+
+#include "globals.hh"
+#include "G4UImessenger.hh"
+#include "G4VUserDetectorConstruction.hh"
+
+class G4UIcommand;
+class test19DetectorConstruction;
+
+class test19DetectorMessenger: public G4UImessenger
+{
+public:
+  test19DetectorMessenger (test19DetectorConstruction* test19Det);
+  ~test19DetectorMessenger ();
+  void SetNewValue (G4UIcommand* command, G4String newValues);
+private:
+  test19DetectorConstruction* test19Detector;
+  G4UIcommand* fpTest19DetCommandDirectory;
+  G4UIcommand* fpDetectorCommand;
+};
+
+#endif
Index: tags/visualization-10.5-before-10.6_test/test/src/BuildCalorimeter.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/src/BuildCalorimeter.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/src/BuildCalorimeter.cc	(revision 1102)
@@ -0,0 +1,121 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: BuildCalorimeter.cc,v 1.5 2006/06/29 21:34:10 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+
+#include "BuildCalorimeter.hh"
+
+#include "G4PVPlacement.hh"
+#include "G4LogicalVolume.hh"
+#include "G4Box.hh"
+#include "G4Tubs.hh"
+#include "G4Material.hh"
+#include "G4VisAttributes.hh"
+
+G4VPhysicalVolume* BuildCalorimeter()
+{
+    G4double offset=22.5,xTlate,yTlate;
+    G4int i,j,copyNo;
+    G4double z = 13.;
+    G4double a = 26.98*g/mole;
+    G4double density = 2.7*g/cm3;
+    G4Material myMaterial("Aluminium", z, a, density);
+
+    //G4VisAttributes* red   = new G4VisAttributes (G4Colour(1,0,0));
+    G4VisAttributes* green = new G4VisAttributes (G4Colour(0,1,0));
+    G4VisAttributes* blue  = new G4VisAttributes (G4Colour(0,0,1));
+
+    G4Box *myWorldBox= new G4Box ("WBox",10000,10000,10000);
+    G4Box *myCalBox = new G4Box ("CBox",1500,1500,1000);
+//    G4Tubs *myTargetTube = new G4Tubs ("TTube",0,22.5,1000,0,360);
+    G4Tubs *myTargetTube = new G4Tubs ("TTube",0,22.5,100,0,360);
+
+    G4LogicalVolume *myWorldLog=new G4LogicalVolume(myWorldBox,&myMaterial,
+						    "WLog",0,0,0);
+    G4LogicalVolume *myCalLog=new G4LogicalVolume(myCalBox,&myMaterial,
+						  "CLog",0,0,0);
+    myCalLog -> SetVisAttributes (green);
+    G4LogicalVolume *myTargetLog=new G4LogicalVolume(myTargetTube,&myMaterial,
+						     "TLog",0,0,0);
+    myTargetLog -> SetVisAttributes (blue);
+
+    G4PVPlacement *myWorldPhys=new G4PVPlacement(0,G4ThreeVector(),
+						 "WPhys",
+						 myWorldLog,
+						 0,false,0);
+    G4PVPlacement *myCalPhys=new G4PVPlacement(0,G4ThreeVector(),
+					       "CalPhys",
+					       myCalLog,
+					       myWorldPhys,false,0);
+
+    G4String tName1("TPhys1");	// Allow all target physicals to share
+    // same name (delayed copy)
+    copyNo=0;
+    //for (j=1;j<=25;j++)
+    for (j=1;j<=3;j++)
+      {
+	yTlate=-1000.0-40.0+j*80.0;
+	
+	//for (i=1;i<=50;i++)
+	for (i=1;i<=5;i++)
+	  {
+	    copyNo++;
+	    xTlate=-1000.0-20.0+i*45.0-offset;
+	    new G4PVPlacement(0,G4ThreeVector(xTlate,yTlate,0),
+			      tName1,
+			      myTargetLog,
+			      myCalPhys,
+			      false,
+			      copyNo);
+	  }
+      }
+
+    G4String tName2("TPhys2");	// Allow all target physicals to share
+				// same name (delayed copy)
+    copyNo=0;
+    //for (j=1;j<=26;j++)
+    for (j=1;j<=4;j++)
+      {
+	yTlate=-1000.0-80.0+j*80.0;
+	//for (i=1;i<=50;i++)
+	for (i=1;i<=5;i++)
+	  {
+	    copyNo++;
+	    xTlate=-1000.0-20.0+i*45.0;
+	    new G4PVPlacement(0,G4ThreeVector(xTlate,yTlate,0),
+			      tName2,
+			      myTargetLog,
+			      myCalPhys,
+			      false,
+			      copyNo);
+	  }
+      }
+
+    return myWorldPhys;
+}
Index: tags/visualization-10.5-before-10.6_test/test/src/BuildGeom_Example1.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/src/BuildGeom_Example1.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/src/BuildGeom_Example1.cc	(revision 1102)
@@ -0,0 +1,246 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: BuildGeom_Example1.cc,v 1.6 2006/06/29 21:34:12 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Makoto Asai - based on Long Baseline Neutrino Observatory experiment.
+// "Complete" detector but no rotated volumes.
+
+#include "BuildGeom_Example1.hh"
+
+#include <cmath>
+
+#include "globals.hh"
+#include "G4ThreeVector.hh"
+#include "G4Navigator.hh"
+#include "G4GeometryManager.hh"
+#include "G4Element.hh"
+#include "G4Material.hh"
+#include "G4PVPlacement.hh"
+#include "G4LogicalVolume.hh"
+#include "G4VisAttributes.hh"
+#include "G4Box.hh"
+#include "G4Tubs.hh"
+#include "G4Trd.hh"
+
+
+G4VPhysicalVolume* BuildGeom_Example1()
+{
+
+//--------- Material definition ---------
+
+  G4double a, iz, z, density;
+  G4String name, symbol;
+  G4int nel;
+
+  a = 1.01*g/mole;
+  G4Element* elH = new G4Element(name="Hydrogen", symbol="H", iz=1., a);
+  a = 12.01*g/mole;
+  G4Element* elC = new G4Element(name="Carbon", symbol="C", iz=6., a);
+  a = 14.01*g/mole;
+  G4Element* elN = new G4Element(name="Nitrogen", symbol="N", iz=7., a);
+  a = 16.00*g/mole;
+  G4Element* elO = new G4Element(name="Oxigen", symbol="O", iz=8., a);
+  a = 28.09*g/mole;
+  G4Element* elSi = new G4Element(name="Silicon", symbol="Si", iz=14., a);
+  a = 207.19*g/mole;
+  G4Element* elPb = new G4Element(name="Lead", symbol="Pb", iz=82., a);
+
+  a = 26.98*g/mole;
+  density = 2.7*g/cm3;
+  G4Material* Al = new G4Material(name="Aluminium", z=13., a, density);
+  a = 55.85*g/mole;
+  density = 7.87*g/cm3;
+  G4Material* Fe = new G4Material(name="Iron", z=26., a, density);
+  a = 207.19*g/mole;
+  density = 11.35*g/cm3;
+  //G4Material* Pb = new G4Material(name="Lead", z=82., a, density);
+  density = 1.29e-03*g/cm3;
+  G4Material* Air = new G4Material(name="Air", density, nel=2);
+  Air->AddElement(elN, .7);
+  Air->AddElement(elO, .3);
+  density = 5.2*g/cm3;
+  G4Material* LeadGlass = new G4Material(name="LeadGlass", density, nel=3);
+  LeadGlass->AddElement(elO, .199);
+  LeadGlass->AddElement(elSi, .127);
+  LeadGlass->AddElement(elPb, .674);
+  density = 1.0*g/cm3;
+  G4Material* Water = new G4Material(name="water",density,nel=2);
+  Water->AddElement(elH, (G4int)2);
+  Water->AddElement(elO, (G4int)1);
+  density = 1.032*g/cm3;
+  G4Material* Scinti = new G4Material(name="Scinti",density,nel=2);
+  Scinti->AddElement(elH, (G4int)1);
+  Scinti->AddElement(elC, (G4int)1);
+
+
+// Experimental hall (world volume)
+
+  G4Box *myWorldBox= new G4Box("WBox",600.*cm,1200.*cm,1000.*cm);
+  G4LogicalVolume *myWorldLog=new G4LogicalVolume(myWorldBox,Air,
+						    "WLog", 0, 0, 0);
+  myWorldLog -> SetVisAttributes (&G4VisAttributes::Invisible);
+  G4PVPlacement *myWorldPhys=new G4PVPlacement(0,G4ThreeVector(),
+						 "WPhys",
+						 myWorldLog,
+						 0,false,0);
+
+
+  G4double waterSciFiYpos = 100.*cm;
+
+  G4VisAttributes* red   = new G4VisAttributes (G4Colour (1,0,0));
+  G4VisAttributes* green = new G4VisAttributes (G4Colour (0,1,0));
+  G4VisAttributes* blue  = new G4VisAttributes (G4Colour (0,0,1));
+
+// WaterSciFi overall
+
+  G4Box* watSFBox = new G4Box("WSBox",160.*cm,65.*cm,160.*cm);
+  G4LogicalVolume* watSFLog = new G4LogicalVolume(watSFBox,Al,"WSLog",0,0,0);
+  watSFLog -> SetVisAttributes (red);
+  G4PVPlacement* watSFPhys = new G4PVPlacement(0,
+    G4ThreeVector(0.*cm,waterSciFiYpos,0.*cm),
+    "watSFPhys",watSFLog,myWorldPhys,false,0);
+
+// WaterSciFi water box
+
+  G4Box* watSFWBox = new G4Box("WSWBox",159.*cm,64.*cm,159.*cm);
+  G4LogicalVolume* watSFWLog = 
+    new G4LogicalVolume(watSFWBox,Water,"WSWLog",0,0,0);
+  watSFWLog -> SetVisAttributes (green);
+  G4PVPlacement* watSFWPhys = new G4PVPlacement(0,
+	  G4ThreeVector(0.*cm,0.*cm,0.*cm),
+	  "watSFWPhys",watSFWLog,watSFPhys,false,0);
+
+// Scinti plate (XXYY are merged into one plane)
+
+  G4Box* watSFSBox = new G4Box("WSSBox",159.*cm,0.1*cm,159.*cm);
+  G4LogicalVolume* watSFSLog = new G4LogicalVolume(watSFSBox,Scinti,"WSSLog",0,0,0);
+  watSFSLog -> SetVisAttributes (blue);
+  G4PVPlacement* watSFSPhys;
+  for(int iSFS=-10; iSFS<=10; iSFS++)
+  {
+    G4double SFSypos = iSFS*6.0*cm;
+    watSFSPhys = new G4PVPlacement(0,
+	G4ThreeVector(0.*cm,SFSypos,0.*cm),
+	"watSFSPhys",watSFSLog,watSFWPhys,false,iSFS+10);
+  }
+
+// LeadGlass support unit
+
+  G4Tubs* calUnitTubsR 
+    = new G4Tubs("CUTubsR",174.636*cm,213.9*cm,30.5*cm,45.0*deg,45.0*deg);
+  G4LogicalVolume* calUnitLogR
+    = new G4LogicalVolume(calUnitTubsR,Fe,"CUlogR",0,0,0);
+  G4Tubs* calUnitTubsL 
+    = new G4Tubs("CUTubsL",174.636*cm,213.9*cm,30.5*cm,90.0*deg,45.0*deg);
+  G4LogicalVolume* calUnitLogL
+    = new G4LogicalVolume(calUnitTubsL,Fe,"CUlogL",0,0,0);
+
+  G4PVPlacement* calUnitPhysR;
+  G4PVPlacement* calUnitPhysL;
+  for(int iCalUnit=-2; iCalUnit<=2; iCalUnit++)
+  {
+    G4double zCalRow = iCalUnit*61.0*cm;
+    calUnitPhysR = new G4PVPlacement(0,
+               G4ThreeVector(0.*cm,waterSciFiYpos,zCalRow),
+               "calUnitPhysR",calUnitLogR,myWorldPhys,false,iCalUnit+2);
+    calUnitPhysL = new G4PVPlacement(0,
+               G4ThreeVector(0.*cm,waterSciFiYpos,zCalRow),
+               "calUnitPhysL",calUnitLogL,myWorldPhys,false,iCalUnit+2);
+  }
+
+// LeadGlass body
+
+  G4Tubs* calRowTubsR 
+    = new G4Tubs("CRTubsR",174.636*cm,212.9*cm,30.5*cm,45.0*deg,45.0*deg);
+  G4LogicalVolume* calRowLogR
+    = new G4LogicalVolume(calRowTubsR,LeadGlass,"CRlogR",0,0,0);
+  new G4PVPlacement(0,
+		    G4ThreeVector(0.*cm,0.*cm,0.*cm),
+		    "calRowPhysR",calRowLogR,calUnitPhysR,false,0);
+  G4Tubs* calRowTubsL 
+    = new G4Tubs("CRTubsL",174.636*cm,212.9*cm,30.5*cm,90.0*deg,45.0*deg);
+  G4LogicalVolume* calRowLogL
+    = new G4LogicalVolume(calRowTubsL,LeadGlass,"CRlogL",0,0,0);
+  new G4PVPlacement(0,
+		    G4ThreeVector(0.*cm,0.*cm,0.*cm),
+		    "calRowPhysL",calRowLogL,calUnitPhysL,false,0);
+
+// Muon filter Iron
+
+  G4Box* muFeBox = new G4Box("muFe",400.*cm,5.0*cm,400.*cm);
+  G4LogicalVolume* muFeLog = new G4LogicalVolume(muFeBox,Fe,"MFLog",0,0,0);
+  G4Box* muChBox = new G4Box("muCh",400.*cm,10.0*cm,400.*cm);
+  G4LogicalVolume* muChLog = new G4LogicalVolume(muChBox,Air,"MCLog",0,0,0);
+
+  G4double muonChamberYPos = 300.*cm+waterSciFiYpos;
+
+  G4int muFeNo = 0;
+  G4int muChNo = 0;
+  G4PVPlacement* muFePhys;
+  G4PVPlacement* muChPhys;
+
+  for(G4int iMC1=0; iMC1<4; iMC1++)
+  {
+    muonChamberYPos += 10.*cm;
+    muChPhys = new G4PVPlacement(0,
+     G4ThreeVector(0.*cm,muonChamberYPos,0.*cm),
+     "muChPhys",muChLog,myWorldPhys,false,muChNo++);
+    muonChamberYPos += 10.*cm;
+
+    muonChamberYPos += 5.*cm;
+    muFePhys = new G4PVPlacement(0,
+     G4ThreeVector(0.*cm,muonChamberYPos,0.*cm),
+     "muFePhys",muFeLog,myWorldPhys,false,muFeNo++);
+    muonChamberYPos += 5.*cm;
+  }
+
+  for(G4int iMC2=0; iMC2<8; iMC2++)
+  {
+    muonChamberYPos += 10.*cm;
+    muChPhys = new G4PVPlacement(0,
+     G4ThreeVector(0.*cm,muonChamberYPos,0.*cm),
+     "muChPhys",muChLog,myWorldPhys,false,muChNo++);
+    muonChamberYPos += 10.*cm;
+
+    muonChamberYPos += 5.*cm;
+    muFePhys = new G4PVPlacement(0,
+     G4ThreeVector(0.*cm,muonChamberYPos,0.*cm),
+     "muFePhys",muFeLog,myWorldPhys,false,muFeNo++);
+    muonChamberYPos += 5.*cm;
+
+    muonChamberYPos += 5.*cm;
+    muFePhys = new G4PVPlacement(0,
+     G4ThreeVector(0.*cm,muonChamberYPos,0.*cm),
+     "muFePhys",muFeLog,myWorldPhys,false,muFeNo++);
+    muonChamberYPos += 5.*cm;
+  }
+
+  return myWorldPhys;
+}
+
Index: tags/visualization-10.5-before-10.6_test/test/src/BuildGeom_Example2.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/src/BuildGeom_Example2.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/src/BuildGeom_Example2.cc	(revision 1102)
@@ -0,0 +1,210 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: BuildGeom_Example2.cc,v 1.6 2006/06/29 21:34:14 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Makoto Asai - based on Long Baseline Neutrino Observatory experiment.
+// Embryo detector with rotated volumes
+
+#include "BuildGeom_Example2.hh"
+
+#include <cmath>
+
+#include "globals.hh"
+#include "G4ThreeVector.hh"
+#include "G4Navigator.hh"
+#include "G4GeometryManager.hh"
+#include "G4Element.hh"
+#include "G4Material.hh"
+#include "G4PVPlacement.hh"
+#include "G4LogicalVolume.hh"
+#include "G4Box.hh"
+#include "G4Tubs.hh"
+#include "G4Trd.hh"
+
+
+G4PVPlacement* calUnitPhys; 
+G4PVPlacement* calRowPhys;
+G4PVPlacement* calCellPhys;
+
+G4VPhysicalVolume* BuildGeom_Example2()
+{
+
+//--------- Material definition ---------
+
+  G4double a, iz, density;
+  G4String name, symbol;
+  G4int nel;
+
+  a = 1.01*g/mole;
+  G4Element* elH = new G4Element(name="Hydrogen", symbol="H", iz=1., a);
+  a = 14.01*g/mole;
+  G4Element* elN = new G4Element(name="Nitrogen", symbol="N", iz=7., a);
+  a = 16.00*g/mole;
+  G4Element* elO = new G4Element(name="Oxigen", symbol="O", iz=8., a);
+  a = 28.09*g/mole;
+  G4Element* elSi = new G4Element(name="Silicon", symbol="Si", iz=14., a);
+  a = 207.19*g/mole;
+  G4Element* elPb = new G4Element(name="Lead", symbol="Pb", iz=82., a);
+
+  //a = 26.98*g/mole;
+  //density = 2.7*g/cm3;
+  //G4Material* Al = new G4Material(name="Aluminium", z=13., a, density);
+  //a = 55.85*g/mole;
+  //density = 7.87*g/cm3;
+  //G4Material* Fe = new G4Material(name="Iron", z=26., a, density);
+  //a = 207.19*g/mole;
+  //density = 11.35*g/cm3;
+  //G4Material* Pb = new G4Material(name="Lead", z=82., a, density);
+  density = 1.29e-03*g/cm3;
+  G4Material* Air = new G4Material(name="Air", density, nel=2);
+  Air->AddElement(elN, .7);
+  Air->AddElement(elO, .3);
+  density = 5.2*g/cm3;
+  G4Material* LeadGlass = new G4Material(name="LeadGlass", density, nel=3);
+  LeadGlass->AddElement(elO, .199);
+  LeadGlass->AddElement(elSi, .127);
+  LeadGlass->AddElement(elPb, .674);
+  density = 1.0*g/cm3;
+  G4Material* Water = new G4Material(name="water",density,nel=2);
+  Water->AddElement(elH, (G4int)2);
+  Water->AddElement(elO, (G4int)1);
+
+
+// Experimental hall (world volume)
+
+  G4Box *myWorldBox= new G4Box("WBox",750*cm,1000*cm,1200*cm);
+  G4LogicalVolume *myWorldLog=new G4LogicalVolume(myWorldBox,Air,
+						    "WLog", 0, 0, 0);
+  G4PVPlacement *myWorldPhys=new G4PVPlacement(0,G4ThreeVector(),
+						 "WPhys",
+						 myWorldLog,
+						 0,false,0);
+
+  G4double waterCherenkovZpos = 100.*cm;
+
+
+// LeadGlass unit
+
+  G4Tubs* calUnitTubs 
+    = new G4Tubs("CUTubs",170*cm,240*cm,30.5*cm,-22.5*deg,45.0*deg);
+  G4LogicalVolume* calUnitLog
+    = new G4LogicalVolume(calUnitTubs,Air,"CUlog",0,0,0);
+
+  G4RotationMatrix* calUnitRotR = new G4RotationMatrix();
+  calUnitRotR->rotateX(-90.0*deg);
+  calUnitRotR->rotateY(-112.5*deg);
+  G4RotationMatrix* calUnitRotL = new G4RotationMatrix();
+  calUnitRotL->rotateX(-90.0*deg);
+  calUnitRotL->rotateY(-67.5*deg);
+
+  G4int calUnitCopyNo = 0;
+  //G4PVPlacement *calUnitPhys; 
+  //for(int iCalUnit=2; iCalUnit>=-2; iCalUnit--)
+  for(int iCalUnit=2; iCalUnit>=2; iCalUnit--)
+  {
+    G4double yCalRow = iCalUnit*61.0*cm;
+    //calUnitPhys = new G4PVPlacement(calUnitRotL,
+    //           G4ThreeVector(0.*cm,yCalRow,waterCherenkovZpos),
+    //           "calUnitPhys",calUnitLog,myWorldPhys,false,calUnitCopyNo++);
+    calUnitPhys = new G4PVPlacement(calUnitRotR,
+               G4ThreeVector(0.*cm,yCalRow,waterCherenkovZpos),
+               "calUnitPhys",calUnitLog,myWorldPhys,false,calUnitCopyNo++);
+  }
+
+
+// LeadGlass row
+
+  G4Tubs* calRowTubs 
+    = new G4Tubs("CRTubs",170*cm,212.9*cm,6.1*cm,-22.5*deg,45.0*deg);
+  G4LogicalVolume* calRowLog
+    = new G4LogicalVolume(calRowTubs,Air,"CRlog",0,0,0);
+
+  G4int calRowCopyNo = 0;
+  //G4PVPlacement *calRowPhys;
+  //for(int iCalRow=-2; iCalRow<=2; iCalRow++)
+  for(int iCalRow=-2; iCalRow<=-2; iCalRow++)
+  {
+    G4double zCalRow = iCalRow*12.2*cm;
+    calRowPhys = new G4PVPlacement(0,
+               G4ThreeVector(0.*cm,0.*cm,zCalRow),
+               "calRowPhys",calRowLog,calUnitPhys,false,calRowCopyNo++);
+  }
+
+
+// LeadGlass cell
+
+  G4Trd* calCellTrd  
+    = new G4Trd("CCtrd",5.65*cm,6.75*cm,6.1*cm,6.1*cm,17.0*cm);
+  G4LogicalVolume* calCellLog
+    = new G4LogicalVolume(calCellTrd,LeadGlass,"CCtrd",0,0,0);
+
+  G4double calCellOpeningAngle = 3.702*deg;
+  G4double calCellZpos = 191.636*cm;
+  //G4PVPlacement* calCellPhys;
+  for(int iCalCell=0; iCalCell<=11; iCalCell++)
+  {
+    G4RotationMatrix* calCellRot = new G4RotationMatrix();
+    calCellRot->rotateX(90.0*deg);
+    G4double cellRotAngle = (5.5-iCalCell)*calCellOpeningAngle;
+    calCellRot->rotateZ(cellRotAngle+90.0*deg);
+/*
+    G4cout << calCellRot << G4endl;
+    G4cout << calCellRot->xx() << " "
+         << calCellRot->xy() << " "
+         << calCellRot->xz() << " " << G4endl;
+    G4cout << calCellRot->yx() << " "
+         << calCellRot->yy() << " "
+         << calCellRot->yz() << " " << G4endl;
+    G4cout << calCellRot->zx() << " "
+         << calCellRot->zy() << " "
+         << calCellRot->zz() << " " << G4endl;
+*/
+    G4double calCellX = calCellZpos * std::cos(cellRotAngle/rad);
+    G4double calCellY = calCellZpos * std::sin(cellRotAngle/rad);
+    calCellPhys = new G4PVPlacement(calCellRot,
+	       G4ThreeVector(calCellX,calCellY,0.*cm),
+	       "calRowPhys",calCellLog,calRowPhys,false,iCalCell);
+/*
+    G4RotationMatrix* tmpRot = calCellPhys->GetRotation();
+    G4cout << "saved : " << tmpRot << G4endl;
+    G4cout << tmpRot->xx() << " "
+         << tmpRot->xy() << " "
+         << tmpRot->xz() << " " << G4endl;
+    G4cout << tmpRot->yx() << " "
+         << tmpRot->yy() << " "
+         << tmpRot->yz() << " " << G4endl;
+    G4cout << tmpRot->zx() << " "
+         << tmpRot->zy() << " "
+         << tmpRot->zz() << " " << G4endl;
+*/
+  }
+
+  return myWorldPhys;
+}
+
Index: tags/visualization-10.5-before-10.6_test/test/src/BuildHouse.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/src/BuildHouse.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/src/BuildHouse.cc	(revision 1102)
@@ -0,0 +1,251 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: BuildHouse.cc,v 1.3 2006/06/29 21:34:16 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+
+#include "BuildHouse.hh"
+
+#include "G4Material.hh"
+#include "G4Box.hh"
+#include "G4SubtractionSolid.hh"
+#include "G4UnionSolid.hh"
+#include "G4PVPlacement.hh"
+#include "G4LogicalVolume.hh"
+#include "G4VisAttributes.hh"
+
+G4VPhysicalVolume* BuildHouse()
+{
+  // Let's have x = east, y = up and z = south.
+  const double worldx = 5 * m;         // World half-length east-west.
+  const double worldy = 5 * m;         // World half-length vertical.
+  const double worldz = 5 * m;         // World half-length north-south.
+  const double roomx = 2 * m;          // Inner room half-length east-west.
+  const double roomy = 1 * m;          // Inner room half-length vertical.
+  const double roomz = 2 * m;          // Inner room half-length north-south.
+  const double wall = 10 * cm;         // Wall thickness.
+
+  // For other things, lengths, widths and/or depths are horizontal,
+  // heights are vertical.
+  const double wx = 1 * m;          // Window half-length.
+  const double wy = 50 * cm;        // Window half-height.
+  const double wz = wall + 1 * mm;  // Window half-depth, larger than
+				    // wall for safe subtraction.
+  const double ledgeProtrusion = 5 * cm;
+  const double lx = 1.1 * m;        // Window ledge half-length.
+  const double ly = 2.5 * cm;       // Window ledge half-height.
+  const double lz = wall + ledgeProtrusion;  // Window ledge
+				             // half-depth (protrudes
+				             // into room and out into
+				             // world).
+  //const double ttx;  // Table top half-length.
+  //const double tty;  // Table top half-height.
+  //const double ttz;  // Table top half-width.
+  //const double tlx;  // Table leg half-width.
+  //const double tly;  // Table leg half-height (normally "length" of leg).
+  //const double tlz;  // Table leg half-width.
+
+  const G4ThreeVector nullVector;
+
+  G4Material* air =
+    new G4Material
+    ("Air", 7., 14.4 * g/mole, 0.001 * g/cm3);
+  G4Material* wallMaterial =
+    new G4Material
+    ("Brick", 20., 40. * g/mole, 3 * g/cm3);
+  G4Material* tableMaterial =
+    new G4Material
+    ("Wood", 7., 14. * g/mole, 0.9 * g/cm3);
+  
+  // World...
+  G4Box * world =
+    new G4Box
+    ("World", worldx, worldy, worldz);
+  G4LogicalVolume * world_log =
+    new G4LogicalVolume
+    (world, air, "World", 0, 0, 0);
+  world_log -> SetVisAttributes (G4VisAttributes::Invisible);
+  G4VPhysicalVolume * world_phys =
+    new G4PVPlacement
+    (0, G4ThreeVector(), "worldP", world_log, 0, false, 0);
+
+  // Window hole...
+  G4VSolid* windowHole =
+    new G4Box
+    ("Window hole", wx, wy, wz);
+
+  // Make a house out of walls...
+
+  // North/south wall...
+  G4VSolid* wallNS =
+    new G4Box
+    ("North/south wall", roomx + wall, roomy, wall / 2.);
+  G4VSolid* wallNSWithWindowHole =
+    new G4SubtractionSolid
+    ("North/south wall with window hole", wallNS, windowHole,
+     0, G4ThreeVector());
+
+  // East/west wall...
+  G4VSolid* wallEW =
+    new G4Box
+    ("North/south wall", roomx, roomy, wall / 2.);
+  G4VSolid* wallEWWithWindowHole =
+    new G4SubtractionSolid
+    ("North/south wall with window hole", wallEW, windowHole,
+     0, G4ThreeVector());
+
+  // North wall...
+  G4LogicalVolume * northWall_log =
+    new G4LogicalVolume
+    (wallNSWithWindowHole,
+     //(wallNS,  // if window not required.
+     wallMaterial, "North wall", 0, 0, 0);
+  // G4VPhysicalVolume* northWall_phys =
+    new G4PVPlacement
+    (0, G4ThreeVector(0., 0., -(roomz + wall / 2.)),
+     northWall_log, "North wall",
+     world_log, false, 0);
+
+  // South wall...
+  G4LogicalVolume * southWall_log =
+    new G4LogicalVolume
+    (wallNSWithWindowHole,
+     //(wallNS,  // if window not required.
+     wallMaterial, "South wall", 0, 0, 0);
+  G4RotationMatrix* rmS = new G4RotationMatrix;
+  rmS->rotateY(180*deg);
+  // G4VPhysicalVolume* southWall_phys =
+    new G4PVPlacement
+    (rmS, G4ThreeVector(0., 0., roomz + wall / 2.),
+     southWall_log, "South wall",
+     world_log, false, 0);
+
+  // East wall...
+  G4LogicalVolume * eastWall_log =
+    new G4LogicalVolume
+    (wallEWWithWindowHole,
+     //(wallEW,  // if window not required.
+     wallMaterial, "East wall", 0, 0, 0);
+  G4RotationMatrix* rmE = new G4RotationMatrix;
+  rmE->rotateY(-90*deg);
+  // G4VPhysicalVolume* eastWall_phys =
+    new G4PVPlacement
+    (rmE, G4ThreeVector(roomz + wall / 2., 0., 0.),
+     eastWall_log, "East wall",
+     world_log, false, 0);
+
+  // West wall...
+  G4LogicalVolume * westWall_log =
+    new G4LogicalVolume
+    (wallEWWithWindowHole,
+     //(wallEW,  // if window not required.
+     wallMaterial, "West wall", 0, 0, 0);
+  G4RotationMatrix* rmW = new G4RotationMatrix;
+  rmW->rotateY(90*deg);
+  // G4VPhysicalVolume* westWall_phys =
+    new G4PVPlacement
+    (rmW, G4ThreeVector(-(roomz + wall / 2.), 0., 0.),
+     westWall_log, "West wall",
+     world_log, false, 0);
+
+  /*
+  // House with holes for windows
+  G4VSolid* houseOuter =
+    new G4Box
+    ("House outer", roomx + wall, roomy + wall, roomz + wall);
+  G4VSolid* windowHole =
+    new G4Box
+    ("Window hole", wx, wy, wz);
+  // East window...
+  G4RotationMatrix* rm1 = new G4RotationMatrix;
+  rm1->rotateY(-90*deg);
+  G4VSolid* houseOuterWithWindowHoleE =
+    new G4SubtractionSolid
+    ("House with window E", houseOuter, windowHole,
+     rm1, G4ThreeVector(roomx + wall / 2., 0., 0.));
+  // North window...
+  G4VSolid* houseOuterWithWindowHoleEN =
+    new G4SubtractionSolid
+    ("House with windows E and N", houseOuterWithWindowHoleE, windowHole,
+     0, G4ThreeVector(0., 0., -(roomz + wall / 2.)));
+  // Other windows...
+  // Solid house...
+  G4LogicalVolume * houseOuterWithWindowHoles_log =
+    new G4LogicalVolume
+    (houseOuterWithWindowHoleEN,
+     wallMaterial, "House with window holes", 0, 0, 0);
+  // G4VPhysicalVolume*  houseOuterWithWindowHoles_phys =
+    new G4PVPlacement
+    (0, G4ThreeVector(), houseOuterWithWindowHoles_log, "House",
+     world_log, false, 0);
+  // Inner...
+  G4VSolid* houseInner =
+    new G4Box
+    ("House inner", roomx, roomy, roomz);
+  // Room...
+  G4LogicalVolume * room_log =
+    new G4LogicalVolume
+    (houseInner, air, "Room", 0, 0, 0);
+  room_log -> SetVisAttributes (G4VisAttributes::Invisible);
+  // G4VPhysicalVolume*  room_phys =
+    new G4PVPlacement
+    (0, G4ThreeVector(), room_log, "Room",
+     houseOuterWithWindowHoles_log, false, 0);
+  */
+
+  /*
+  G4VSolid* houseInner =
+    new G4Box
+    ("House inner", roomx, roomy, roomz);
+  
+  G4VSolid* walls
+    new G4SubtractionSolid
+    ("Walls", houseOuter, houseInner, 0, nullVector);
+  
+  G4VSolid* windowHole =
+    new G4Box
+    ("Window hole", wx, wy, wz);
+  
+  G4RotationMatrix* rm1 = new G4RotationMatrix;
+  rm1->rotateZ(90*deg);
+  G4VSolid* wallsWithWindowHole1 =
+    new G4SubtractionSolid
+    ("Walls with windows", walls, windowHole, rm1, roomx + wall / 2.);
+
+  G4LogicalVolume * wallsWithWindowHole1_log =
+    new G4LogicalVolume
+    //(wallsWithWindowHole1, wallMaterial, "Walls with windows", 0, 0, 0);
+    (walls, wallMaterial, "Walls", 0, 0, 0);
+
+  G4VPhysicalVolume*  house =
+    new G4PVPlacement
+    (0, G4ThreeVector(), "House", wallsWithWindowHole1_log, world, false, 0);
+  */
+
+  return world_phys;
+}
Index: tags/visualization-10.5-before-10.6_test/test/src/BuildParametrised.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/src/BuildParametrised.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/src/BuildParametrised.cc	(revision 1102)
@@ -0,0 +1,198 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: BuildParametrised.cc,v 1.7 2006/06/29 21:34:18 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Based on test code from Hans-Peter Wellisch
+
+#include "BuildParametrised.hh"
+
+#include "G4PVPlacement.hh"
+#include "G4LogicalVolume.hh"
+#include "G4Box.hh"
+#include "G4Tubs.hh"
+#include "G4Material.hh"
+#include "G4VisAttributes.hh"
+
+#include "G4PVParameterised.hh"
+#include "ParametrisedBox.hh"
+
+G4VPhysicalVolume* BuildParametrised ()
+{
+  G4Material* theAir=new G4Material("N2-air", 14.0, 28.0 * g / mole,
+				     0.0001 *g/cm3);
+  G4Material * theCopper =
+    new G4Material("Quaterhard-Cu",25.0, 63.0 * g / mole,
+		   6.8*g/cm3);
+
+  G4RotationMatrix* theNull = new G4RotationMatrix ();
+  G4ThreeVector* theCenter = new G4ThreeVector(0,0,0);
+
+  // The Pit.
+  G4Box* aBox = new G4Box("aBox",10*m, 10*m, 10*m);
+  G4LogicalVolume*  theLogicalPit =
+    new G4LogicalVolume(aBox, theAir,
+			"thePit", 0, 0, 0);
+  theLogicalPit->SetVisAttributes (G4VisAttributes::Invisible);
+  G4PVPlacement* thePit =
+    new G4PVPlacement(    theNull,
+			  *theCenter,
+			  "thePit",
+			  theLogicalPit,    
+			  0, 0, 0);
+
+  // The Mother of Parametrised.
+  G4VSolid * anotherBox = new G4Box("aBox",5*m, 5*m, 5*m);
+  G4LogicalVolume*  theLogicalMother1 =
+    new G4LogicalVolume(anotherBox, theAir,
+			"aTest1", 0, 0,
+			0);
+  G4PVPlacement* theMother1 =
+    new G4PVPlacement(    0, G4ThreeVector (-4 * m, 0 , 0),
+			  "theMother1",
+			  theLogicalMother1,    
+			  thePit, 0, 0);
+
+  // Parametrized volume.
+  G4Box * theBox = new G4Box("aBox",1,1,1);
+  G4LogicalVolume*  theLogicalBox1 =
+    new G4LogicalVolume(theBox, theCopper,
+			"aTest1", 0, 0,
+			0);
+  G4VisAttributes * logicalPAttributes1;
+  logicalPAttributes1 = new G4VisAttributes(G4Colour(1.,0.,0.));
+  theLogicalBox1->SetVisAttributes(logicalPAttributes1);
+  ParametrisedBox* thePar1 = new ParametrisedBox(theCopper,theAir);
+  new G4PVParameterised("theParametrizedtest1",
+			theLogicalBox1,
+			theMother1,
+			kYAxis,
+			2,
+			thePar1);
+  //  A second parameterised volume for test purposes...
+  G4LogicalVolume*  theLogicalMother2 =
+    new G4LogicalVolume(anotherBox, theAir,
+			"aTest2", 0, 0,
+			0);
+  G4PVPlacement* theMother2 =
+    new G4PVPlacement(    0, G4ThreeVector (0, -4 * m, 0),
+			  "theMother2",
+			  theLogicalMother2,    
+			  thePit, 0, 0);
+  G4LogicalVolume*  theLogicalBox2 =
+    new G4LogicalVolume(theBox, theCopper,
+			"aTest2", 0, 0,
+			0);
+  G4VisAttributes * logicalPAttributes2;
+  logicalPAttributes2 = new G4VisAttributes(G4Colour(0.,1.,0.));
+  theLogicalBox2->SetVisAttributes(logicalPAttributes2);
+  ParametrisedBox* thePar2 = new ParametrisedBox(theAir,theCopper);
+  new G4PVParameterised("theParametrizedtest2",
+			theLogicalBox2,
+			theMother2,
+			kYAxis,
+			5,
+			thePar2);
+
+  // The Mother of Replica.
+  G4VSolid * box3 = new G4Box("aBox", 1 * m, 2 * m, 3 * m);
+  G4LogicalVolume*  theLogicalRMother =
+    new G4LogicalVolume(box3, theAir,
+			"aTest", 0, 0,
+			0);
+  G4PVPlacement* theRMother =
+    new G4PVPlacement(    0, G4ThreeVector (4 * m, 0, 0),
+			  "theRMother",
+			  theLogicalRMother,    
+			  thePit, 0, 0);
+
+  // Replicated volume.
+  G4VSolid * RBox = new G4Box("aBox", 0.2 * m, 2 * m, 3 * m);
+  G4LogicalVolume*  theLogicalRBox =
+    new G4LogicalVolume(RBox, theCopper,
+			"aTest", 0, 0,
+			0);
+  G4VisAttributes * logicalRAttributes;
+  logicalRAttributes = new G4VisAttributes(G4Colour(0.,1.,0.));
+  theLogicalRBox->SetVisAttributes(logicalRAttributes);
+  new G4PVReplica("theReplicatest",
+		  theLogicalRBox,
+		  theRMother,
+		  kXAxis,
+		  5, 0.4 * m, 0);
+
+  // The Mother of Tubs Replica.
+  G4VSolid * tubs = new G4Tubs ("aTubsBox", 0.5 * m, 1 * m, 2 * m,
+				90. * deg, 180. * deg);
+  G4LogicalVolume*  theLogicalTMother =
+    new G4LogicalVolume(tubs, theAir,
+			"aTest", 0, 0,
+			0);
+  G4PVPlacement* theTMother =
+    new G4PVPlacement(    0, G4ThreeVector (4 * m, 4 * m, 0),
+			  "theTMother",
+			  theLogicalTMother,    
+			  thePit, 0, 0);
+
+  // Replicated volume.
+  G4VSolid * tubsPart = new G4Tubs ("aTubsPart", 0.5 * m, 1 * m, 2 * m,
+				    0., 36. * deg);
+  G4LogicalVolume*  theLogicalTubsPart =
+    new G4LogicalVolume(tubsPart, theCopper,
+			"aTest", 0, 0,
+			0);
+  G4VisAttributes * logicalTAttributes;
+  logicalTAttributes = new G4VisAttributes(G4Colour(0.,0.,1.));
+  theLogicalTubsPart->SetVisAttributes(logicalTAttributes);
+  new G4PVReplica("theTReplicatest",
+		  theLogicalTubsPart,
+		  theTMother,
+		  kPhi,
+		  5, 36. * deg, 90. * deg);
+
+  /*************** Bloggs's box to workaround bug in G4SmartVoxelHeader.
+
+  G4Box * thebloggsBox = new G4Box("aBox",5*m, 4*m, 2*m);
+  G4LogicalVolume*  theLogicalbloggs =
+    new G4LogicalVolume(thebloggsBox, theCopper,
+			"aTest", 0, 0,
+			0);
+  G4VisAttributes * bloggsAttributes = 
+    new G4VisAttributes(G4Colour(0.,1.,0.));
+  theLogicalbloggs->SetVisAttributes(bloggsAttributes);
+  G4PVPlacement* bloggs =
+    new G4PVPlacement(    theNull,
+			  G4ThreeVector (10*m, -30*m, -40*m),
+			  "bloggs",
+			  theLogicalbloggs,
+			  thePitPosition,    
+			  0, 0);
+			  ***************/
+
+  return thePit;
+}
Index: tags/visualization-10.5-before-10.6_test/test/src/BuildShapes.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/src/BuildShapes.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/src/BuildShapes.cc	(revision 1102)
@@ -0,0 +1,519 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: BuildShapes.cc,v 1.6 2006/06/29 21:34:20 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+
+#include "BuildShapes.hh"
+
+#include "G4PVPlacement.hh"
+#include "G4LogicalVolume.hh"
+
+#include "G4Material.hh"
+#include "G4VisAttributes.hh"
+
+#include "G4Box.hh"
+#include "G4Cons.hh"
+#include "G4Tubs.hh"
+#include "G4Trd.hh"
+#include "G4Trap.hh"
+#include "G4Sphere.hh"
+#include "G4Para.hh"
+
+// #define USE_BREP_SOLID
+
+#if defined USE_BREP_SOLID
+
+#include"G4BREPSolidPCone.h"
+#include"G4BREPSolidPolyhedra.h"
+
+#endif
+
+G4VPhysicalVolume* TheWorld ()
+{
+  G4double a, iz, density;
+  G4String name, symbol;
+  G4int nel;
+  a = 14.01*g/mole;
+  G4Element* elN = new G4Element(name="Nitrogen", symbol="N", iz=7., a);
+  a = 16.00*g/mole;
+  G4Element* elO = new G4Element(name="Oxigen", symbol="O", iz=8., a);
+  density = 1.29e-03*g/cm3;
+  G4Material* Air = new G4Material(name="Air", density, nel=2);
+  Air->AddElement(elN, .7);
+  Air->AddElement(elO, .3);
+
+  G4Box *myWorldBox= new G4Box("WBox",10.0, 10.0, 10.0);  // Big enough!
+  G4LogicalVolume *myWorldLog=new G4LogicalVolume(myWorldBox,Air,
+                                                    "WLog", 0, 0, 0);
+  myWorldLog -> SetVisAttributes (&G4VisAttributes::Invisible);
+  G4PVPlacement *myWorldPhys=new G4PVPlacement(0,G4ThreeVector(),
+                                                 "WPhys",
+                                                 myWorldLog,
+                                                 0,false,0);
+  return myWorldPhys;
+}
+
+G4VPhysicalVolume* BuildBox()
+{
+        G4VPhysicalVolume* theWorld = TheWorld ();
+
+		//----- material
+	G4double z = 13.;
+	G4double a = 26.98*g/mole;
+	G4double density = 2.7*g/cm3;
+	G4Material myMaterial("Aluminium", z, a, density);
+	
+		//----- Vis Attributes
+	G4VisAttributes* pVA  = new G4VisAttributes (G4Colour(1,0,0));
+
+		//----- Solid
+	G4Box *box = new G4Box ("Box", 1 ,4, 9 );
+
+		//----- Logical Volume
+	G4LogicalVolume *boxLog=new G4LogicalVolume( box, &myMaterial,
+						    "BoxLog",0,0,0);
+	boxLog -> SetVisAttributes ( pVA );
+
+		//----- physical volume
+	new G4PVPlacement( 0,G4ThreeVector(),
+			   "BoxPhys",
+			   boxLog,
+			   theWorld,
+			   false,0);
+
+	return theWorld;
+
+} // BuildBox
+
+
+G4VPhysicalVolume* BuildCylinder()
+{
+        G4VPhysicalVolume* theWorld = TheWorld ();
+
+		//----- material
+	G4double z = 13.;
+	G4double a = 26.98*g/mole;
+	G4double density = 2.7*g/cm3;
+	G4Material myMaterial("Aluminium", z, a, density);
+
+		//----- Vis Attributes
+	G4VisAttributes* pVA  = new G4VisAttributes (G4Colour(0,1,0));
+
+		//----- Solid
+	G4Tubs *tubs = new G4Tubs ("Tubs", 0. , 1.5, 2.0 , 0., twopi);
+
+		//----- Logical Volume
+	G4LogicalVolume *tubsLog=new G4LogicalVolume( tubs, &myMaterial,
+						    "tubsLog",0,0,0);
+	tubsLog -> SetVisAttributes ( pVA );
+
+		//----- physical volume
+	new G4PVPlacement( 0,G4ThreeVector(),
+			   "tubsPhys",
+			   tubsLog,
+			   theWorld,
+			   false,0);
+
+	return theWorld;
+
+}// BuildCyllinder
+
+
+
+G4VPhysicalVolume* BuildTubs()
+{
+        G4VPhysicalVolume* theWorld = TheWorld ();
+
+		//----- material
+	G4double z = 13.;
+	G4double a = 26.98*g/mole;
+	G4double density = 2.7*g/cm3;
+	G4Material myMaterial("Aluminium", z, a, density);
+
+		//----- Vis Attributes
+	G4VisAttributes* pVA  = new G4VisAttributes (G4Colour(0,1,0));
+
+		//----- Solid
+	G4Tubs *tubs = new G4Tubs ("Tubs", 1.0 , 1.5, 2.0 , 1.5, 4.5 );
+
+		//----- Logical Volume
+	G4LogicalVolume *tubsLog=new G4LogicalVolume( tubs, &myMaterial,
+						    "tubsLog",0,0,0);
+	tubsLog -> SetVisAttributes ( pVA );
+
+		//----- physical volume
+	new G4PVPlacement( 0,G4ThreeVector(),
+			   "tubsPhys",
+			   tubsLog,
+			   theWorld,
+			   false,0);
+
+	return theWorld;
+
+}// BuildTubs
+
+
+
+G4VPhysicalVolume* BuildCons()
+{
+        G4VPhysicalVolume* theWorld = TheWorld ();
+
+		//----- material
+	G4double z = 13.;
+	G4double a = 26.98*g/mole;
+	G4double density = 2.7*g/cm3;
+	G4Material myMaterial("Aluminium", z, a, density);
+
+		//----- Vis Attributes
+	G4VisAttributes* pVA  = new G4VisAttributes (G4Colour(0,0,1));
+
+		//----- Solid
+	G4Cons *cons = new G4Cons ("Cons", 1.0 , 1.5, 0.5, 1.0 ,2.0, 1.5, 4.5 );
+
+		//----- Logical Volume
+	G4LogicalVolume *consLog=new G4LogicalVolume( cons, &myMaterial,
+						    "consLog",0,0,0);
+	consLog -> SetVisAttributes ( pVA );
+
+		//----- physical volume
+	new G4PVPlacement( 0,G4ThreeVector(),
+			   "consPhys",
+			   consLog,
+			   theWorld,
+			   false,0);
+
+	return theWorld;
+
+}// BuildCons
+
+
+G4VPhysicalVolume* BuildTrd()
+{
+        G4VPhysicalVolume* theWorld = TheWorld ();
+
+		//----- material
+	G4double z = 13.;
+	G4double a = 26.98*g/mole;
+	G4double density = 2.7*g/cm3;
+	G4Material myMaterial("Aluminium", z, a, density);
+
+		//----- Vis Attributes
+	G4VisAttributes* pVA  = new G4VisAttributes (G4Colour(0,1,1));
+
+		//----- Solid
+	G4Trd *trd = new G4Trd ("Trd", 1.0 , 0.5, 1.0, 0.5, 4.0 );
+
+		//----- Logical Volume
+	G4LogicalVolume *trdLog=new G4LogicalVolume( trd, &myMaterial,
+						    "trdLog",0,0,0);
+	trdLog -> SetVisAttributes ( pVA );
+
+		//----- physical volume
+	new G4PVPlacement( 0,G4ThreeVector(),
+			   "trdPhys",
+			   trdLog,
+			   theWorld,
+			   false,0);
+
+	return theWorld;
+
+}// BuildTrd
+
+
+
+G4VPhysicalVolume* BuildTrap()
+{
+        G4VPhysicalVolume* theWorld = TheWorld ();
+
+		//----- material
+	G4double z = 13.;
+	G4double a = 26.98*g/mole;
+	G4double density = 2.7*g/cm3;
+	G4Material myMaterial("Aluminium", z, a, density);
+
+		//----- Vis Attributes
+	G4VisAttributes* pVA  = new G4VisAttributes (G4Colour(1,0,1));
+
+		//----- Solid
+	G4Trap *trap = new G4Trap ("Trap", 2.0, 0.26, 0.0, 1.0, \
+				   0.7, 1.2, 0.0, 0.5, 0.35, 0.6, 0.0 );
+
+		//----- Logical Volume
+	G4LogicalVolume *trapLog=new G4LogicalVolume( trap, &myMaterial,
+						    "trapLog",0,0,0);
+	trapLog -> SetVisAttributes ( pVA );
+
+		//----- physical volume
+	new G4PVPlacement( 0,G4ThreeVector(),
+			   "trapPhys",
+			   trapLog,
+			   theWorld,
+			   false,0);
+
+	return theWorld;
+
+}// BuildTrap
+
+
+G4VPhysicalVolume* BuildSphereFull()
+{
+        G4VPhysicalVolume* theWorld = TheWorld ();
+
+		//----- material
+	G4double z = 13.;
+	G4double a = 26.98*g/mole;
+	G4double density = 2.7*g/cm3;
+	G4Material myMaterial("Aluminium", z, a, density);
+	
+		//----- Vis Attributes
+	G4VisAttributes* pVA  = new G4VisAttributes (G4Colour(1,1,0));
+
+		//----- Solid
+	G4Sphere *Sphere = new G4Sphere ("Sphere", 1.6, 1.8, 0.0, (twopi), 0.0, (twopi) );
+
+		//----- Logical Volume
+	G4LogicalVolume *SphereLog=new G4LogicalVolume( Sphere, &myMaterial,
+						    "SphereLog",0,0,0);
+	SphereLog -> SetVisAttributes ( pVA );
+
+		//----- physical volume
+	new G4PVPlacement( 0,G4ThreeVector(),
+			   "SpherePhys",
+			   SphereLog,
+			   theWorld,
+			   false,0);
+
+	return theWorld;
+
+} // BuildSphereFull
+
+
+G4VPhysicalVolume* BuildSphereSeg()
+{
+        G4VPhysicalVolume* theWorld = TheWorld ();
+
+		//----- material
+	G4double z = 13.;
+	G4double a = 26.98*g/mole;
+	G4double density = 2.7*g/cm3;
+	G4Material myMaterial("Aluminium", z, a, density);
+	
+		//----- Vis Attributes
+	G4VisAttributes* pVA  = new G4VisAttributes (G4Colour(1,1,0));
+
+		//----- Solid
+	G4Sphere *Sphere = new G4Sphere ("Sphere", 1.6, 1.8, 0.0, 6.0, 0.5, 2.5 );
+
+		//----- Logical Volume
+	G4LogicalVolume *SphereLog=new G4LogicalVolume( Sphere, &myMaterial,
+						    "SphereLog",0,0,0);
+	SphereLog -> SetVisAttributes ( pVA );
+
+		//----- physical volume
+	new G4PVPlacement( 0,G4ThreeVector(),
+			   "SpherePhys",
+			   SphereLog,
+			   theWorld,
+			   false,0);
+
+	return theWorld;
+
+} // BuildSphereSeg
+
+
+
+G4VPhysicalVolume* BuildPara()
+{
+        G4VPhysicalVolume* theWorld = TheWorld ();
+
+		//----- material
+	G4double z = 13.;
+	G4double a = 26.98*g/mole;
+	G4double density = 2.7*g/cm3;
+	G4Material myMaterial("Aluminium", z, a, density);
+	
+		//----- Vis Attributes
+	G4VisAttributes* pVA  = new G4VisAttributes (G4Colour(1,0,0));
+
+		//----- Solid
+//	G4Para *para = new G4Para ("Para", 1.0 ,1.0, 3.0, 0.0, 0.0, 0.0 );
+	G4Para *para = new G4Para ("Para", 1.0 ,1.0, 3.0, pi/6.0, pi/12.0, pi/12.0 );
+
+		//----- Logical Volume
+	G4LogicalVolume *paraLog=new G4LogicalVolume( para, &myMaterial,
+						    "ParaLog",0,0,0);
+	paraLog -> SetVisAttributes ( pVA );
+
+		//----- physical volume
+	new G4PVPlacement( 0,G4ThreeVector(),
+			   "ParaPhys",
+			   paraLog,
+			   theWorld,
+			   false,0);
+
+	return theWorld;
+
+} // BuildPara
+
+
+
+
+G4VPhysicalVolume* BuildPCon()
+{
+#if defined USE_BREP_SOLID
+        G4VPhysicalVolume* theWorld = TheWorld ();
+
+		//----- material
+	G4double z = 13.;
+	G4double a = 26.98*g/mole;
+	G4double density = 2.7*g/cm3;
+	G4Material myMaterial("Aluminium", z, a, density);
+	
+		//----- shape
+	G4double sphi = 1.8 ;
+	G4double dphi = 4.71 ;
+	G4int    nz   = 4    ;
+	G4double DzArray   [] = { -3.0, 1.0, 1.0, 3.0 };
+	G4double RminArray [] = {  1.0, 0.5, 1.5, 1.0 };
+	G4double RmaxArray [] = {  1.5, 1.0, 2.0, 1.5 };
+
+		//----- Vis Attributes
+	G4VisAttributes* pVA  = new G4VisAttributes (G4Colour(0,1,0));
+
+		//----- Solid
+	G4BREPSolidPCone *pcon = new G4BREPSolidPCone ("Pcon", sphi , dphi, nz, DzArray[0], \
+						     DzArray, RminArray, RmaxArray     );
+
+		//----- Logical Volume
+	G4LogicalVolume *pconLog=new G4LogicalVolume( pcon, &myMaterial,
+						    "PconLog",0,0,0);
+	pconLog -> SetVisAttributes ( pVA );
+
+		//----- physical volume
+	new G4PVPlacement( 0,G4ThreeVector(),
+			   "PconPhys",
+			   pconLog,
+			   theWorld,
+			   false,0);
+
+	return theWorld;
+
+#else 
+	return NULL ;
+#endif
+
+} // BuildPCon
+
+
+G4VPhysicalVolume* BuildPGon()
+{
+#if defined USE_BREP_SOLID
+        G4VPhysicalVolume* theWorld = TheWorld ();
+
+		//----- material
+	G4double z = 13.;
+	G4double a = 26.98*g/mole;
+	G4double density = 2.7*g/cm3;
+	G4Material myMaterial("Aluminium", z, a, density);
+	
+		//----- shape
+	G4double sphi = 1.8 ;
+	G4double dphi = 4.71 ;
+	G4int    nside   = 5    ;
+	G4int    nz   = 4    ;
+	G4double DzArray   [] = { -3.0, 1.0, 1.0, 3.0 };
+	G4double RminArray [] = {  1.0, 0.5, 1.5, 1.0 };
+	G4double RmaxArray [] = {  1.5, 1.0, 2.0, 1.5 };
+
+		//----- Vis Attributes
+	G4VisAttributes* pVA  = new G4VisAttributes (G4Colour(1,0,0));
+
+		//----- Solid
+	G4BREPSolidPolyhedra *pgon = new G4BREPSolidPolyhedra ("Pcon", sphi , dphi, nside, nz, \
+	                                                       DzArray[0], \
+						               DzArray, RminArray, RmaxArray     );
+
+		//----- Logical Volume
+	G4LogicalVolume *pgonLog=new G4LogicalVolume( pgon, &myMaterial,
+						    "PgonLog",0,0,0);
+	pgonLog -> SetVisAttributes ( pVA );
+
+		//----- physical volume
+	new G4PVPlacement( 0,G4ThreeVector(),
+			   "PgonPhys",
+			   pgonLog,
+			   theWorld,
+			   false,0);
+	
+	return theWorld;
+#else
+	return NULL ;
+#endif
+} // BuildPGon
+
+G4VPhysicalVolume* BuildForcedWireframeBox()
+{
+        G4VPhysicalVolume* theWorld = TheWorld ();
+
+		//----- material
+	G4double z = 13.;
+	G4double a = 26.98*g/mole;
+	G4double density = 2.7*g/cm3;
+	G4Material myMaterial("Aluminium", z, a, density);
+	
+		//----- Vis Attributes
+	G4VisAttributes* pVA   = new G4VisAttributes (G4Colour(1,0,0)); // for box
+	pVA->SetForceWireframe( true );
+	G4VisAttributes* pVA2  = new G4VisAttributes (G4Colour(0,1,1)); // for tubs
+
+		//----- Solid
+	G4Box *box   = new G4Box  ("Box", 2 ,4, 6 );
+	G4Tubs *tubs = new G4Tubs ("Tubs", 1.0 , 1.5, 2.0 , 1.5, 4.5 );
+
+		//----- Logical Volume
+	G4LogicalVolume *boxLog=new G4LogicalVolume( box, &myMaterial,
+						    "BoxLog",0,0,0);
+	boxLog -> SetVisAttributes ( pVA );
+	G4LogicalVolume *tubsLog=new G4LogicalVolume( tubs, &myMaterial,
+						    "tubsLog",0,0,0);
+	tubsLog -> SetVisAttributes ( pVA2 );
+
+		//----- physical volume
+	G4PVPlacement *boxPhys=new G4PVPlacement( 0,G4ThreeVector(),
+						  "BoxPhys",
+						  boxLog,
+						  theWorld,
+						  false,0);
+	new G4PVPlacement( 0,G4ThreeVector(),
+			   "tubsPhys",
+			   tubsLog,
+			   boxPhys ,false,0);
+	return theWorld;
+
+} // G4VPhysicalVolume* BuidlForcedWireFrameBox()
Index: tags/visualization-10.5-before-10.6_test/test/src/MyDetectorConstruction.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/src/MyDetectorConstruction.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/src/MyDetectorConstruction.cc	(revision 1102)
@@ -0,0 +1,762 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: MyDetectorConstruction.cc,v 1.39 2006/11/14 16:03:55 allison Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+#include "MyDetectorConstruction.hh"
+
+#include "MyDetectorMessenger.hh"
+//#include "MyCalorimeterSD.hh"
+//#include "MyTrackerSD.hh"
+//#include "MyCalorimeterHit.hh"
+//#include "MyTrackerHit.hh"
+
+#include "G4Material.hh"
+#include "G4MaterialTable.hh"
+#include "G4Element.hh"
+#include "G4ElementTable.hh"
+#include "G4Box.hh"
+#include "G4Tubs.hh"
+#include "G4Cons.hh"
+#include "G4Sphere.hh"
+#include "G4Orb.hh"
+#include "G4Trap.hh"
+#include "G4EllipticalTube.hh"
+#include "G4EllipticalCone.hh"
+#include "G4Polyhedra.hh"
+#include "G4Polycone.hh"
+#include "G4Tet.hh"
+#include "G4TwistedTubs.hh"
+#include "G4TwistedBox.hh"
+#include "G4TwistedTrd.hh"
+#include "G4TwistedTrap.hh"
+#include "G4IntersectionSolid.hh"
+#include "G4SubtractionSolid.hh"
+#include "G4UnionSolid.hh"
+#include "G4DisplacedSolid.hh"
+#include "G4LogicalVolume.hh"
+#include "G4RotationMatrix.hh"
+#include "G4ThreeVector.hh"
+#include "G4Transform3D.hh"
+#include "G4PVPlacement.hh"
+#include "G4PVReplica.hh"
+#include "G4SDManager.hh"
+#include "G4VisAttributes.hh"
+#include "G4Colour.hh"
+#include "G4VisExtent.hh"
+
+#include "G4Polyhedron.hh"
+
+MyDetectorConstruction::MyDetectorConstruction()
+{
+  new MyDetectorMessenger(this);
+
+  expHall_x = 10. * m;
+  expHall_y = 10. * m;
+  expHall_z = 10. * m;
+
+  calBox_x = 100.*cm;
+  calBox_y = 50.*cm;
+  calBox_z = 50.*cm;
+  rotAngle = 30.*deg;
+  calPos = 200.*cm;
+  calMaterialName = "Pb";
+
+  trackerRadius = 50.*cm;
+  trackerHight = 100.*cm;
+  trackerPos = -200.*cm;
+}
+
+MyDetectorConstruction::~MyDetectorConstruction()
+{
+  for (size_t i = 0; i < materialPointerStore.size(); i++) {
+    delete materialPointerStore[i];
+  }
+}
+
+G4VPhysicalVolume* MyDetectorConstruction::Construct()
+{
+
+  //------------------------------------------------------ materials
+
+  G4double a, iz, z, density;
+  G4String name, symbol;
+  G4int nel;
+
+  a = 14.01*g/mole;
+  G4Element* elN = new G4Element(name="Nitrogen", symbol="N", iz=7., a);
+  a = 16.00*g/mole;
+  G4Element* elO = new G4Element(name="Oxygen", symbol="O", iz=8., a);
+
+  density = 1.29e-03*g/cm3;
+  G4Material* Air = new G4Material(name="Air", density, nel=2);
+  materialPointerStore.push_back(Air);
+  Air->AddElement(elN, .7);
+  Air->AddElement(elO, .3);
+
+  a = 207.19*g/mole;
+  density = 11.35*g/cm3;
+  G4Material* Pb = new G4Material(name="Lead", z=82., a, density);
+  materialPointerStore.push_back(Pb);
+
+  a = 39.95*g/mole;
+  density = 1.782e-03*g/cm3;
+  G4Material* Ar = new G4Material(name="ArgonGas", z=18., a, density);
+  materialPointerStore.push_back(Ar);
+
+  a = 26.98*g/mole;
+  density = 2.7*g/cm3;
+  G4Material* Al = new G4Material(name="Aluminum", z=13., a, density);
+  materialPointerStore.push_back(Al);
+
+  a = 55.85*g/mole;
+  density = 7.87*g/cm3;
+  G4Material* Fe = new G4Material(name="Iron", z=26., a, density);
+  materialPointerStore.push_back(Fe);
+
+  //------------------------------------------------------ volumes
+
+  //------------------------------ experimental hall
+  G4Box * experimentalHall_box
+    = new G4Box("expHall_b",expHall_x,expHall_y,expHall_z);
+  G4LogicalVolume * experimentalHall_log
+    = new G4LogicalVolume(experimentalHall_box,Air,"expHall_L",0,0,0);
+  //  G4VisAttributes * experimentalHallVisAtt
+  //      = new G4VisAttributes(G4Colour(1.0,1.0,1.0));
+  //  experimentalHallVisAtt->SetForceWireframe(true);
+  //  experimentalHall_log->SetVisAttributes(experimentalHallVisAtt);
+  experimentalHall_log -> SetVisAttributes (&G4VisAttributes::GetInvisible());
+  G4VPhysicalVolume * experimentalHall_phys
+    = new G4PVPlacement(0,G4ThreeVector(),"expHall_P",
+                        experimentalHall_log,0,false,0);
+
+  //------------------------------ calorimeter boxes
+  G4Box * calorimeter_box
+    = new G4Box("calorimeter_b",calBox_x,calBox_y,calBox_z);
+  G4Material* calMat;
+  if(calMaterialName=="Pb")
+  { calMat = Pb; }
+  else if(calMaterialName=="Al")
+  { calMat = Al; }
+  else if(calMaterialName=="Fe")
+  { calMat = Fe; }
+  else
+  { calMat = Air; }
+  G4LogicalVolume * calorimeter_log
+    = new G4LogicalVolume(calorimeter_box,calMat,"calo_L",0,0,0);
+  G4VisAttributes * calorimeterVisAtt
+      = new G4VisAttributes(G4Colour(0.,0.,1.));
+  //  calorimeterVisAtt->SetForceWireframe(true);
+  calorimeter_log->SetVisAttributes(calorimeterVisAtt);
+  G4VPhysicalVolume* calo_phys;
+  for(G4int i=0;i<3;i++)
+  {
+    G4RotationMatrix rm;
+    rm.rotateZ(i*rotAngle);
+    rm.print(G4cout);
+    calo_phys =
+    new G4PVPlacement(G4Transform3D(rm,G4ThreeVector(0.*cm,i*calPos,0.*cm)),
+                      "calo_phys",calorimeter_log,experimentalHall_phys,
+                      false,i);
+    calo_phys->GetObjectRotationValue().print(G4cout);
+  }
+
+  //------------------------------ tracker tube
+  G4Tubs * tracker_tube
+    = new G4Tubs("tracker_tube",0.*cm,trackerRadius,trackerHight,
+                 0.*deg,360.*deg);
+  /*
+  G4cout << "Tracker tube polyhedron:\n"
+	 << (HepPolyhedron)(*(tracker_tube->GetPolyhedron())) << G4endl;
+  */
+  G4LogicalVolume * tracker_log
+    = new G4LogicalVolume(tracker_tube,Ar,"tracker_L",0,0,0);
+  G4VisAttributes * trackerVisAtt
+    = new G4VisAttributes(G4Colour(0.,0.,1.));
+  //  trackerVisAtt->SetForceWireframe(true);
+  tracker_log->SetVisAttributes(trackerVisAtt);
+  //////////////............
+  G4RotationMatrix* tracker_rm = new G4RotationMatrix;
+  tracker_rm->rotateY(-30.*deg);
+  tracker_rm->print(G4cout);
+  G4VPhysicalVolume* tracker_phys =
+  //new G4PVPlacement(tracker_rm,G4ThreeVector(0.*cm,trackerPos,200.*cm),
+  new G4PVPlacement(G4Transform3D(*tracker_rm,G4ThreeVector(0.*cm,trackerPos,200.*cm)),
+  //////////////............
+  //new G4PVPlacement(0,G4ThreeVector(0.*cm,trackerPos,0.*cm),
+                    "tracker_phys",tracker_log,experimentalHall_phys,
+                    false,0);
+  tracker_phys->GetObjectRotationValue().print(G4cout);
+
+  //------------------------------ displaced box
+  G4Box * undisplaced_box = new G4Box("undisplaced_box",30.*cm,50.*cm,70.*cm);
+  G4RotationMatrix rm_db;
+  rm_db.rotateZ(20.*deg);
+  G4DisplacedSolid* displaced_box = new G4DisplacedSolid
+    ("displaced_box",undisplaced_box,
+     G4Transform3D(rm_db,G4ThreeVector(200.*cm,0.,0.)));
+  G4cout << "Displaced box extent:\n" << displaced_box->GetExtent() << G4endl;
+  G4LogicalVolume * displaced_box_log
+    = new G4LogicalVolume(displaced_box,Ar,"displaced_box_L",0,0,0);
+  new G4PVPlacement(0,G4ThreeVector(0.*cm,-200.*cm,0.*cm),
+                    "displaced_box_phys",displaced_box_log,
+		    experimentalHall_phys,
+                    false,0);
+
+  //-------------------------------------------- Boolean solids
+
+  G4Tubs* cylinder1 = new G4Tubs("Cylinder #1",20*cm,50*cm,30*cm,0,2*pi);
+  G4Box* box1 = new G4Box("Box #1",20*cm,30*cm,40*cm);
+  G4Box* box2 = new G4Box("Box #2",10*cm,20*cm,35*cm);
+  G4RotationMatrix* rm1 = new G4RotationMatrix;
+  rm1->rotateZ(20*deg);
+  G4RotationMatrix* rm2 = new G4RotationMatrix;
+  rm2->rotateZ(60*deg);
+
+  G4IntersectionSolid* cyl1Ibox1 =
+    new G4IntersectionSolid("cylinder1-intersection-box1", cylinder1, box1,
+		     rm1,G4ThreeVector(30.01*cm,30.01*cm,0.01*cm));
+  G4cout << "cylinder1-intersection-box1 extent:\n"
+	 << cyl1Ibox1->GetExtent() << G4endl;
+  G4IntersectionSolid* cyl1Ibox1Ibox2 =
+    new G4IntersectionSolid("cylinder1-intersection-box1-intersection-box2", cyl1Ibox1, box2,
+		     rm2,G4ThreeVector(0.01,40.01*cm,0.01*cm));
+  G4cout << "cylinder1-intersection-box1-intersection-box2 extent:\n"
+	 << cyl1Ibox1Ibox2->GetExtent() << G4endl;
+  G4LogicalVolume * intersection_log
+    = new G4LogicalVolume(cyl1Ibox1Ibox2,Ar,"intersection_L",0,0,0);
+  const G4VisAttributes* bool_red =
+    new G4VisAttributes(G4Colour(1.,0.,0.));
+  intersection_log->SetVisAttributes(bool_red);
+  new G4PVPlacement(0,G4ThreeVector(100.*cm,-50*cm,0.*cm),
+                    "intersection_phys",intersection_log,experimentalHall_phys,
+                    true,0);
+
+  G4SubtractionSolid* cyl1Sbox1 =
+    new G4SubtractionSolid("cylinder1-subtraction-box1", cylinder1, box1,
+		     rm1,G4ThreeVector(30.*cm,30.*cm,1.*cm));
+  G4SubtractionSolid* cyl1Sbox1Sbox2 =
+    new G4SubtractionSolid("cylinder1-subtraction-box1-subtraction-box2", cyl1Sbox1, box2,
+		     rm2,G4ThreeVector(0.,40*cm,2.*cm));
+  G4LogicalVolume * subtraction_log
+    = new G4LogicalVolume(cyl1Sbox1Sbox2,Ar,"subtraction_L",0,0,0);
+  const G4VisAttributes* bool_green =
+    new G4VisAttributes(G4Colour(0.,1.,0.));
+  subtraction_log->SetVisAttributes(bool_green);
+  new G4PVPlacement(0,G4ThreeVector(200.*cm,-50*cm,0.*cm),
+                    "subtraction_phys",subtraction_log,experimentalHall_phys,
+                    true,0);
+
+  G4UnionSolid* cyl1Ubox1 =
+    new G4UnionSolid("cylinder1-union-box1", cylinder1, box1,
+		     rm1,G4ThreeVector(30.*cm,30.*cm,1.*cm));
+  G4UnionSolid* cyl1Ubox1Ubox2 =
+    new G4UnionSolid("cylinder1-union-box1-union-box2", cyl1Ubox1, box2,
+		     rm2,G4ThreeVector(0.,40*cm,2.*cm));
+  G4LogicalVolume * union_log
+    = new G4LogicalVolume(cyl1Ubox1Ubox2,Ar,"union_L",0,0,0);
+  const G4VisAttributes* bool_blue =
+    new G4VisAttributes(G4Colour(0.,0.,1.));
+  union_log->SetVisAttributes(bool_blue);
+  new G4PVPlacement(0,G4ThreeVector(350.*cm,-50*cm,0.*cm),
+                    "union_phys",union_log,experimentalHall_phys,
+                    true,0);
+
+  //----------- Tubes, replicas(!?) and daughter boxes
+
+  const G4double eps = 10 * mm;
+  const G4double alp = 10 * mrad;
+
+  G4VisAttributes * grey
+    = new G4VisAttributes(G4Colour(0.5,0.5,0.5,0.1));
+
+
+  G4double tube_dPhi = twopi;
+  G4Tubs* tube = new G4Tubs("tube",20*cm,50*cm,30*cm,0.,tube_dPhi);
+  G4LogicalVolume * tube_log
+    = new G4LogicalVolume(tube,Ar,"tube_L",0,0,0);
+  G4VisAttributes * tube_VisAtt
+    = new G4VisAttributes(G4Colour(0.,1.,0.,0.1));
+  //  tube_log->SetVisAttributes(tube_VisAtt);
+  tube_log->SetVisAttributes(G4VisAttributes::GetInvisible());
+  new G4PVPlacement(0,G4ThreeVector(-200.*cm,0.,0.*cm),
+                    "tube_phys",tube_log,experimentalHall_phys,
+                    false,0);
+
+  G4double divided_tube_dPhi = tube_dPhi / 6.;
+  G4Tubs* divided_tube = new G4Tubs
+    ("divided_tube",
+     20*cm,50*cm,30*cm,-divided_tube_dPhi/2.,divided_tube_dPhi);
+  G4LogicalVolume * divided_tube_log
+    = new G4LogicalVolume(divided_tube,Ar,"divided_tube_L",0,0,0);
+  divided_tube_log->SetVisAttributes(grey);
+  new G4PVReplica("divided_tube_phys",divided_tube_log,tube_log,
+  		  kPhi,6,divided_tube_dPhi);
+  /************ 
+  G4int iCopy;
+  for (iCopy = 0; iCopy < 6; iCopy++) {
+    new G4PVPlacement
+      (G4Transform3D
+       (G4RotationMatrix().rotateZ(divided_tube_dPhi/2.+iCopy*pi/3.),
+	G4ThreeVector()),
+       divided_tube_log,"divided_tube_phys",tube_log,
+       false,iCopy);
+  }
+  *********/
+
+  G4double divided_tube_inset_dPhi = divided_tube_dPhi - 2. * alp;
+  G4Tubs* divided_tube_inset = new G4Tubs
+    ("divided_tube_inset",
+     20*cm+eps,50*cm-eps,30*cm-eps,
+     -divided_tube_inset_dPhi/2.,
+     divided_tube_inset_dPhi);
+  G4LogicalVolume * divided_tube_inset_log
+    = new G4LogicalVolume(divided_tube_inset,Ar,"divided_tube_inset_L",0,0,0);
+  G4VisAttributes * divided_tube_inset_VisAtt
+    = new G4VisAttributes(G4Colour(1.,0.,0.,0.2));
+  //  divided_tube_inset_log->SetVisAttributes(divided_tube_inset_VisAtt);
+  divided_tube_inset_log->SetVisAttributes(G4VisAttributes::Invisible);
+  new G4PVPlacement(0,G4ThreeVector(),
+                    divided_tube_inset_log,"divided_tube_inset_phys",
+		    divided_tube_log,false,0);
+
+  G4double sub_divided_tube_dPhi = divided_tube_inset_dPhi / 4.;
+  G4Tubs* sub_divided_tube = new G4Tubs
+    ("sub_divided_tube",
+     20*cm+eps,50*cm-eps,30*cm-eps,
+     -sub_divided_tube_dPhi/2.,sub_divided_tube_dPhi);
+  G4LogicalVolume * sub_divided_tube_log
+    = new G4LogicalVolume(sub_divided_tube,Ar,"sub_divided_tube_L",0,0,0);
+  sub_divided_tube_log->SetVisAttributes(grey);
+  new G4PVReplica("sub_divided_tube_phys",
+  		  sub_divided_tube_log,divided_tube_inset_log,
+		  kPhi,4,sub_divided_tube_dPhi,-divided_tube_inset_dPhi/2.);
+  /************ 
+  for (iCopy = 0; iCopy < 4; iCopy++) {
+    new G4PVPlacement
+      (G4Transform3D
+       (G4RotationMatrix().rotateZ
+	(-divided_tube_inset_dPhi/2.
+	 +(iCopy+0.5)*sub_divided_tube_dPhi),
+        G4ThreeVector()),
+       sub_divided_tube_log,"sub_divided_tube_phys",divided_tube_inset_log,
+       false,iCopy);
+  }
+  ************/
+  
+  G4Box* daughter_box = new G4Box("daughter_box",4.*cm,3.*cm,25.*cm);
+  G4LogicalVolume * daughter_box_log
+    = new G4LogicalVolume(daughter_box,Ar,"daughter_box_L",0,0,0);
+  G4VisAttributes * daughter_box_VisAtt
+    = new G4VisAttributes(G4Colour(0.,0.,1.,0.3));
+  daughter_box_log->SetVisAttributes(daughter_box_VisAtt);
+  G4Box* grand_daughter_box = new G4Box("grand_daughter_box",1*cm,2*cm,5*cm);
+  G4LogicalVolume * grand_daughter_box_log
+    = new G4LogicalVolume(grand_daughter_box,Ar,"grand_daughter_box_L",0,0,0);
+  G4VisAttributes * grand_daughter_box_VisAtt
+    = new G4VisAttributes(G4Colour(1.,1.,0.));
+  grand_daughter_box_log->SetVisAttributes(grand_daughter_box_VisAtt);
+  G4Box* grand_daughter_box2 = new G4Box("grand_daughter_box2",1*cm,2*cm,5*cm);
+  G4LogicalVolume * grand_daughter_box2_log
+    = new G4LogicalVolume
+    (grand_daughter_box2,Ar,"grand_daughter_box2_L",0,0,0);
+  G4VisAttributes * grand_daughter_box2_VisAtt
+    = new G4VisAttributes(G4Colour(1.,0.,1.));
+  grand_daughter_box2_log->SetVisAttributes(grand_daughter_box2_VisAtt);
+  new G4PVPlacement(0,G4ThreeVector(-2*cm,0.,0.),
+                    grand_daughter_box_log,"grand_daughter_box_phys",
+		    daughter_box_log,false,0);
+  new G4PVPlacement(0,G4ThreeVector(2*cm,0.,0.),
+                    grand_daughter_box2_log,"grand_daughter_box2_phys",
+		    daughter_box_log,false,0);
+  new G4PVPlacement(0,G4ThreeVector(40*cm,0.,0.),
+                    daughter_box_log,"daughter_box_phys",
+		    sub_divided_tube_log,false,0);
+
+  //------------------------------------------------ Extra placements
+  // For good measure, as a test of drawn volume path, place in one of
+  // the earlier volumes...
+  new G4PVPlacement(0,G4ThreeVector(),
+                    "divided_tube_inset_phys",divided_tube_inset_log,
+		    calo_phys,false,0);  // Place in PV.
+  new G4PVPlacement(0,G4ThreeVector(),
+                    grand_daughter_box2_log,"grand_daughter_box2_phys",
+		    calorimeter_log,false,0);  // Place in LV.  Same effect.
+
+  //------------------------------------------------ sensitive detectors
+  /****************
+  G4SDManager* SDman = G4SDManager::GetSDMpointer();
+
+  G4String calorimeterSDname = "example2/calorimeter";
+  MyCalorimeterSD * myCalorimeterSD = new MyCalorimeterSD( calorimeterSDname );
+  SDman->AddNewDetector( myCalorimeterSD );
+  calorimeter_log->SetSensitiveDetector( myCalorimeterSD );
+
+  G4String trackerSDname = "example2/tracker";
+  MyTrackerSD * myTrackerSD = new MyTrackerSD( trackerSDname );
+  SDman->AddNewDetector( myTrackerSD );
+  tracker_log->SetSensitiveDetector( myTrackerSD );
+  ******************/
+
+  //-------------------------------------------- Sphere
+
+  G4Sphere* PD_vol_crystal
+      = new G4Sphere("Test_Sphere",
+                     100.*cm,           // inner radius
+                     200.*cm,           // outer radius
+                     0.,                // start phi
+                     90.*degree,         // delta phi
+                     0.,                // start theta
+                     90.*degree          // delta theta
+                     );
+
+
+  G4LogicalVolume* PD_log_crystal
+    = new G4LogicalVolume(PD_vol_crystal,Ar,"Test_Sphere");
+
+  G4VisAttributes * PD_att_crystal
+    = new G4VisAttributes(G4Colour(1.,0.,1.));
+  PD_att_crystal->SetForceAuxEdgeVisible(true);
+  PD_att_crystal->SetForceLineSegmentsPerCircle(100);
+  PD_log_crystal->SetVisAttributes(PD_att_crystal);
+
+  G4RotationMatrix rm;
+
+  new G4PVPlacement(G4Transform3D(rm,G4ThreeVector(200.*cm,300.*cm,0)),
+		    "PD_physical", PD_log_crystal,
+		    experimentalHall_phys,false,0);
+
+//-------------------------------------------- Polyhedra and Polycone
+
+  const G4int numRZ = 10;
+  G4double polyhedra_r[] = {0,5,3,4,9,9,3,3,2,0};
+  G4double polyhedra_z[] = {0,1,2,3,0,5,4,3,2,1};
+  for (int i = 0; i < numRZ; ++i) {
+    polyhedra_r[i] *= 10*cm;
+    polyhedra_z[i] *= 10.*cm;
+  }
+
+  G4Polyhedra* polyhedra_solid
+      = new G4Polyhedra("Polyhedra_Test",
+			0.,270.*deg,6,numRZ,polyhedra_r,polyhedra_z);
+                        //0.,twopi,6,numRZ,polyhedra_r,polyhedra_z);
+  G4cout << polyhedra_solid->StreamInfo(G4cout) << G4endl;
+
+  G4LogicalVolume* polyhedra_log
+    = new G4LogicalVolume(polyhedra_solid,Ar,"Polyhedra_Test");
+
+  G4VisAttributes * polyhedra_atts
+    = new G4VisAttributes(G4Colour(0.,1.,1.));
+  polyhedra_log->SetVisAttributes(polyhedra_atts);
+
+  new G4PVPlacement(G4Transform3D(rm,G4ThreeVector(200.*cm,100.*cm,0)),
+		    "Polyhedra_Test", polyhedra_log,
+		    experimentalHall_phys,false,0);
+
+  const G4int numRZ1 = 10;
+  G4double polycone_r[] = {1,5,3,4,9,9,3,3,2,1};
+  G4double polycone_z[] = {0,1,2,3,0,5,4,3,2,1};
+  for (int i = 0; i < numRZ1; ++i) {
+    polycone_r[i] *= 10*cm;
+    polycone_z[i] *= 10.*cm;
+  }
+
+  G4Polycone* polycone_solid
+      = new G4Polycone("Polycone_Test",
+		       0.*deg,270.*deg,numRZ1,polycone_r,polycone_z);
+                       //0.,twopi,numRZ,polycone_r,polycone_z);
+  G4cout << polycone_solid->StreamInfo(G4cout) << G4endl;
+
+  G4LogicalVolume* polycone_log
+    = new G4LogicalVolume(polycone_solid,Ar,"Polycone_Test");
+
+  G4VisAttributes * polycone_atts
+    = new G4VisAttributes(G4Colour(1.,0.5,0.5));
+  polycone_log->SetVisAttributes(polycone_atts);
+
+  new G4PVPlacement(G4Transform3D(rm,G4ThreeVector(400.*cm,120.*cm,0)),
+		    "Polycone_Test", polycone_log,
+		    experimentalHall_phys,false,0);
+
+  //-------------------------------------------- Orb
+
+  G4Orb* orb 
+    = new G4Orb("Test orb", 100.*cm);
+
+  G4LogicalVolume* orb_log
+    = new G4LogicalVolume(orb, Ar,"Test_orb");
+
+  G4VisAttributes * orb_att
+    = new G4VisAttributes(G4Colour(1.,0.,1.));
+  orb_att->SetForceAuxEdgeVisible(true);
+  orb_log->SetVisAttributes(orb_att);
+
+  new G4PVPlacement(G4Translate3D(-300.*cm,200.*cm,0),
+		    "Test orb", orb_log, 
+		    experimentalHall_phys,false,0);
+
+  //-------------------------------------------- Trapezoid
+
+  G4Trap* trap1_solid = new G4Trap
+    ("trap1_solid",
+     50.*cm,  //      pDz     Half-length along the z-axis
+     0.,      //      pTheta  Polar angle of the line joining the centres of the faces
+              //              at -/+pDz
+     0.,      //      pPhi    Azimuthal angle of the line joing the centre of the face at
+              //              -pDz to the centre of the face at +pDz
+     40.*cm,  //      pDy1     Half-length along y of the face at -pDz
+     30.*cm,  //      pDx1    Half-length along x of the side at y=-pDy1 of the face at -pDz
+     30.*cm,  //      pDx2    Half-length along x of the side at y=+pDy1 of the face at -pDz
+     20.*deg, //      pAlp1   Angle with respect to the y axis from the centre of the side
+              //              at y=-pDy1 to the centre at y=+pDy1 of the face at -pDz
+     40.*cm,  //      pDy2     Half-length along y of the face at +pDz
+     30.*cm,  //      pDx3    Half-length along x of the side at y=-pDy2 of the face at +pDz
+     30.*cm,  //      pDx4    Half-length along x of the side at y=+pDy2 of the face at +pDz
+     20.*deg  //      pAlp2   Angle with respect to the y axis from the centre of the side
+              //              at y=-pDy2 to the centre at y=+pDy2 of the face at +pDz
+     );
+  G4LogicalVolume* trap1_log = new G4LogicalVolume (trap1_solid,Ar,"trap1_log");
+  new G4PVPlacement
+    (G4Transform3D(rm,G4ThreeVector(-200.*cm,200.*cm,-200.*cm)),
+     "trap1_phys", trap1_log,
+     experimentalHall_phys,false,0);
+
+  G4Trap* trap2_solid = new G4Trap
+    ("trap2_solid",
+     50.*cm,  //      pDz     Half-length along the z-axis
+     20.*deg, //      pTheta  Polar angle of the line joining the centres of the faces
+              //              at -/+pDz
+     90.*deg, //      pPhi    Azimuthal angle of the line joing the centre of the face at
+              //              -pDz to the centre of the face at +pDz
+     40.*cm,  //      pDy1     Half-length along y of the face at -pDz
+     30.*cm,  //      pDx1    Half-length along x of the side at y=-pDy1 of the face at -pDz
+     30.*cm,  //      pDx2    Half-length along x of the side at y=+pDy1 of the face at -pDz
+     0.,      //      pAlp1   Angle with respect to the y axis from the centre of the side
+              //              at y=-pDy1 to the centre at y=+pDy1 of the face at -pDz
+     40.*cm,  //      pDy2     Half-length along y of the face at +pDz
+     30.*cm,  //      pDx3    Half-length along x of the side at y=-pDy2 of the face at +pDz
+     30.*cm,  //      pDx4    Half-length along x of the side at y=+pDy2 of the face at +pDz
+     0.       //      pAlp2   Angle with respect to the y axis from the centre of the side
+              //              at y=-pDy2 to the centre at y=+pDy2 of the face at +pDz
+     );
+  G4LogicalVolume* trap2_log = new G4LogicalVolume (trap2_solid,Ar,"trap2_log");
+  new G4PVPlacement
+    (G4Transform3D(rm,G4ThreeVector(-200.*cm,400.*cm,-200.*cm)),
+     "trap2_phys", trap2_log,
+     experimentalHall_phys,false,0);
+
+  //-------------------------------------------- Elliptical Tube
+  G4VSolid* eTube = new G4EllipticalTube("e-tube",100.*cm,50.*cm,100.*cm);
+  G4LogicalVolume* eTubeLog = new G4LogicalVolume(eTube,Ar,"e-tube-log");
+  new G4PVPlacement(G4Translate3D(G4ThreeVector(-400.*cm,0.,0)),
+		    "e-tube-phys", eTubeLog,
+		    experimentalHall_phys,false,0);
+
+  //-------------------------------------------- Elliptical Cone
+  G4VSolid* eCone = new G4EllipticalCone("e-cone",50.*cm,100.*cm,100.*cm,50.*cm);
+  //G4VSolid* eCone = new G4EllipticalCone("e-cone",1.*mm,0.5*mm,40.*mm,20.*mm);
+  G4LogicalVolume* eConeLog = new G4LogicalVolume(eCone,Ar,"e-cone-log");
+  new G4PVPlacement(G4Translate3D(G4ThreeVector(-500.*cm,400.*cm,0)),
+		    "e-cone-phys", eConeLog,
+		    experimentalHall_phys,false,0);
+
+  //-------------------------------------------- G4Cons
+  G4VSolid* eCons = new G4Cons("e-cons",50.*cm,70.*cm,100.*cm,140.*cm,200.*cm,0,twopi);
+  G4LogicalVolume* eConsLog = new G4LogicalVolume(eCons,Ar,"e-cons-log");
+  new G4PVPlacement(G4Translate3D(G4ThreeVector(-300.*cm,-200.*cm,60*cm)),
+		    "e-cons-phys", eConsLog,
+		    experimentalHall_phys,false,0);
+
+  /*
+  //--------------------------- Simple shared logical volume tree
+
+  G4VSolid* boxTwo = new G4Box("Box2", 100.*cm, 100.*cm, 100.*cm);
+  G4LogicalVolume* log2 = new G4LogicalVolume(boxTwo,Ar,"Log2");
+  new G4PVPlacement(G4Translate3D(G4ThreeVector(600.*cm,0.,0.)),
+		    "B",log2,
+		    experimentalHall_phys,false,0);
+  new G4PVPlacement(G4Translate3D(G4ThreeVector(900.*cm,0.,0.)),
+		    "C",log2,
+		    experimentalHall_phys,false,0);
+  G4VSolid* boxThree = new G4Box("Box3", 50.*cm, 50.*cm, 50.*cm);
+  G4LogicalVolume* log3 = new G4LogicalVolume(boxThree,Ar,"Log3");
+  new G4PVPlacement(G4Translate3D(),
+		    log3,"D",
+		    log2,false,0);
+  G4VSolid* boxFour = new G4Box("Box3", 30.*cm, 30.*cm, 30.*cm);
+  G4LogicalVolume* log4 = new G4LogicalVolume(boxFour,Ar,"Log4");
+  new G4PVPlacement(G4Translate3D(),
+		    log4,"E",
+		    log3,false,0);
+  */
+
+  /*
+  //--------------------------- Boolean for logical volume test
+
+  G4double alSLayer_x = 30.*cm;
+  G4double alSLayer_y = 50.*cm;
+  G4double alSLayer_z = 2.5*cm;
+
+  G4Box* box1B = new
+    G4Box("alSLayer_box",alSLayer_x/2.,alSLayer_y/2.,alSLayer_z/2.);
+
+  G4Tubs* Cylinder1 = new G4Tubs("Cylinder#1",0.*mm,alSLayer_x/2.,alSLayer_x/2.,0.,2.*M_PI); 
+
+  G4UnionSolid* b1UnionC1 = new G4UnionSolid("Box+Cylinder", box1B,
+			 Cylinder1); 
+
+  G4LogicalVolume* alSpaceCraft_log = new
+    G4LogicalVolume(b1UnionC1,Al,"alLayer_log",0,0,0);  
+
+  new G4PVPlacement(0,G4ThreeVector(900.*cm, 200.*cm, 0.),alSpaceCraft_log,"alLayer_phys",experimentalHall_log,false,0);
+  // new G4PVPlacement(G4Translate3D(G4ThreeVector(900.*cm, 200.*cm, 0.)),"alLayer_phys",alSpaceCraft_log,experimentalHall_log,false,0);
+  */
+
+  //----------- Radially replicated tube sector
+
+  G4double rMin = 50.*cm;
+  G4double DeltaR = 50.*cm;
+  G4VSolid* rrTubs = new G4Tubs
+    ("rrTubs",rMin,rMin + DeltaR,200*cm,180*deg,90*deg);
+  G4LogicalVolume* rrTubsLog = new G4LogicalVolume
+    (rrTubs,Ar,"rrTubs-log");
+  rrTubsLog->SetVisAttributes(G4VisAttributes::Invisible);
+  new G4PVPlacement(G4Translate3D(G4ThreeVector(400.*cm,-200.*cm,0)),
+		    "rrTubs-phys", rrTubsLog,
+		    experimentalHall_phys,false,0);
+  G4double deltaR = DeltaR / 6.;
+  G4Tubs* drrTubs = new G4Tubs
+    ("drrTubs",rMin,rMin + deltaR,200*cm,180*deg,90*deg);
+  G4LogicalVolume * drrTubsLog = new G4LogicalVolume
+    (drrTubs,Ar,"drrTubs-log");
+  drrTubsLog->SetVisAttributes(G4Colour::Red());
+  new G4PVReplica("drrTubs-phys",drrTubsLog,rrTubsLog,
+  		  kRho,6,deltaR,rMin);
+
+
+  //----------- tetrahedron
+
+  G4VSolid* tet = new G4Tet
+    ("tet",
+     G4ThreeVector(),
+     G4ThreeVector(0.,100.*cm,0.),
+     G4ThreeVector(0.,0.,100.*cm),
+     G4ThreeVector(100*cm,0.,0.));
+  G4LogicalVolume* tet_log = new G4LogicalVolume
+    (tet,Ar,"tet-log");
+  tet_log->SetVisAttributes(G4VisAttributes(G4Colour(0.,1.,0.)));
+  new G4PVPlacement
+    (G4Translate3D(G4ThreeVector(300.*cm,-400.*cm,0.)),
+     "tet-phys", tet_log,
+     experimentalHall_phys,false,0);
+
+  //----------- Twisted solids
+
+  G4VSolid* aVolume;
+  G4LogicalVolume* aLog;
+  G4double fTrackerR1 ;   // r1
+  G4double fTrackerR2 ;   // r2
+  G4double fTrackerpDz  ;  // Full length of Tracker (pDz)
+  G4double fTrackerpDx1 ;  // twisted Trapezoid
+  G4double fTrackerpDx2 ;
+  G4double fTrackerpDy1 ;
+  G4double fTrackerpDy2 ;
+  G4double fTwistAngle ;
+  G4double fPhi ;
+
+  G4double myScale = 5.;
+
+  fTwistAngle = 90*deg ;
+  fTrackerpDz = myScale*20*cm ;
+  fTrackerR1  = myScale*7*cm ;
+  fTrackerR2  = myScale*10*cm ;
+  fPhi        = 180*deg ;
+
+  aVolume = new G4TwistedTubs
+    ("aTwistedTubs", fTwistAngle, fTrackerR1, fTrackerR2, fTrackerpDz, fPhi ) ;
+  //G4cout << "aTwistedTubs: volume: " << aVolume->GetCubicVolume() << G4endl;
+  aLog = new G4LogicalVolume
+    (aVolume,Ar,"aTwistedTubs-log");
+  aLog->SetVisAttributes(G4VisAttributes(G4Colour(1.,1.,0.)));
+  //  Comment out this G4PVPlacement to get voxelisation crash...
+  new G4PVPlacement
+    (G4Translate3D(G4ThreeVector(200.*cm,-400.*cm,0.)),
+     "aTwistedTubs-phys", aLog, experimentalHall_phys,false,0);
+
+  fTwistAngle = 50*deg ;
+  fTrackerpDx1 = myScale*4*cm ;
+  fTrackerpDy1 = myScale*6*cm ;
+  fTrackerpDz  = myScale*15*cm ;
+
+  aVolume = new G4TwistedBox
+    ("aTwistedBox",fTwistAngle,fTrackerpDx1,fTrackerpDy1,fTrackerpDz) ;
+  aLog = new G4LogicalVolume
+    (aVolume,Ar,"aTwistedBox-log");
+  aLog->SetVisAttributes(G4VisAttributes(G4Colour(1.,1.,0.)));
+  //  Comment out this G4PVPlacement to get voxelisation crash...
+  new G4PVPlacement
+    (G4Translate3D(G4ThreeVector(100.*cm,-400.*cm,0.)),
+     "aTwistedBox-phys", aLog, experimentalHall_phys,false,0);
+
+  fTrackerpDx1 = myScale*4*cm ;
+  fTrackerpDx2 = myScale*7*cm ;
+  fTrackerpDy1 = myScale*2*cm ;
+  fTrackerpDy2 = myScale*4*cm ;
+  fTrackerpDz  = myScale*15*cm ;
+  fTwistAngle = 50*deg ;
+
+  aVolume = new G4TwistedTrd
+    ("aTwistedTrd",fTrackerpDx1,fTrackerpDx2,fTrackerpDy1,fTrackerpDy2,
+     fTrackerpDz,fTwistAngle);
+  aLog = new G4LogicalVolume
+    (aVolume,Ar,"aTwistedTrd-log");
+  aLog->SetVisAttributes(G4VisAttributes(G4Colour(1.,1.,0.)));
+  new G4PVPlacement
+    (G4Translate3D(G4ThreeVector(000.*cm,-400.*cm,0.)),
+     "aTwistedTrd-phys", aLog, experimentalHall_phys,false,0);
+
+  fTrackerpDx1 = myScale*4*cm ;
+  fTrackerpDx2 = myScale*7*cm ;
+  fTrackerpDy1 = myScale*2*cm ;
+  fTrackerpDy2 = myScale*4*cm ;
+  fTrackerpDz  = myScale*15*cm ;
+  fTwistAngle = 50*deg ;
+
+  aVolume = new G4TwistedTrd
+    ("anotherTwistedTrd",fTrackerpDx1,fTrackerpDx2,fTrackerpDy1,fTrackerpDy2,
+     fTrackerpDz,fTwistAngle);
+  aLog = new G4LogicalVolume
+    (aVolume,Ar,"anotherTwistedTrd-log");
+  aLog->SetVisAttributes(G4VisAttributes(G4Colour(1.,1.,0.)));
+  new G4PVPlacement
+    (G4Translate3D(G4ThreeVector(-100.*cm,-400.*cm,0.)),
+     "anotherTwistedTrd-phys", aLog, experimentalHall_phys,false,0);
+
+  //-------------------------------------------- return
+  return experimentalHall_phys;
+}
Index: tags/visualization-10.5-before-10.6_test/test/src/MyDetectorMessenger.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/src/MyDetectorMessenger.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/src/MyDetectorMessenger.cc	(revision 1102)
@@ -0,0 +1,69 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: MyDetectorMessenger.cc,v 1.4 2006/06/29 21:34:24 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+
+#include "MyDetectorMessenger.hh"
+
+#include "MyDetectorConstruction.hh"
+#include "G4UIparameter.hh"
+#include "globals.hh"
+
+MyDetectorMessenger::MyDetectorMessenger(MyDetectorConstruction * myDet)
+:myDetector(myDet)
+{
+  G4UIcommand * command;
+  G4UIparameter * param;
+
+  command = new G4UIcommand("/mydet/",this);
+  command->SetGuidance("My detector control.");
+  fpMyDetCommandDirectory = command;
+
+  command = new G4UIcommand("/mydet/calMaterial",this);
+  command->SetGuidance("Define material of the calorimeter.");
+  command->SetGuidance(" Available materials :");
+  command->SetGuidance("   Air (defaust), Al, Fe, Pb");
+  param = new G4UIparameter("material",'c',true);
+  param->SetDefaultValue("Air");
+  command->SetParameter(param);
+  fpCalMaterialCommand = command;
+}
+
+MyDetectorMessenger::~MyDetectorMessenger () {
+  delete fpCalMaterialCommand;
+  delete fpMyDetCommandDirectory;
+}
+
+void MyDetectorMessenger::SetNewValue(G4UIcommand * command,G4String newValues)
+{
+  if (command == fpCalMaterialCommand)
+  {
+    myDetector->SetCalMaterial(newValues);
+  }
+}
+
Index: tags/visualization-10.5-before-10.6_test/test/src/MyEventAction.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/src/MyEventAction.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/src/MyEventAction.cc	(revision 1102)
@@ -0,0 +1,174 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: MyEventAction.cc,v 1.18 2008/04/04 14:01:14 allison Exp $
+// GEANT4 tag $Name:  $
+//
+
+#include "MyEventAction.hh"
+
+//#define DRAWTRAJHIT
+
+#ifdef DRAWTRAJHIT
+
+#include "MyTrackerHit.hh"
+#include "MyCalorimeterHit.hh"
+
+#endif
+
+#include "G4Event.hh"
+#include "G4EventManager.hh"
+#include "G4Run.hh"
+#include "G4RunManager.hh"
+#include "G4HCofThisEvent.hh"
+#include "G4VHitsCollection.hh"
+#include "G4TrajectoryContainer.hh"
+#include "G4Trajectory.hh"
+#include "G4VVisManager.hh"
+#include "G4VisAttributes.hh"
+#include "G4AttValue.hh"
+#include "G4AttDef.hh"
+#include "G4Scale.hh"
+#include "G4Text.hh"
+#include "G4Box.hh"
+#include "G4Tubs.hh"
+#include "G4Polyhedron.hh"
+#include "G4SDManager.hh"
+#include "G4UImanager.hh"
+#include "G4ios.hh"
+
+#include <sstream>
+
+MyEventAction::MyEventAction()
+{
+  // G4AttDefs have to be long life...
+  fTransientBoxDefs["TrBox"] =
+      G4AttDef("TrBox","Transient Box","Physics","","G4String");
+}
+
+MyEventAction::~MyEventAction()
+{;}
+
+void MyEventAction::BeginOfEventAction(const G4Event*)
+{;}
+
+void MyEventAction::EndOfEventAction(const G4Event* anEvent)
+{
+  static int coutCount = 0;
+  if (coutCount < 10) {
+    coutCount++;
+    G4cout << "MyEventAction::EndOfEventActionAction called." << G4endl;
+  }
+
+  const G4Event* evt = anEvent;
+
+#ifdef DRAWTRAJHIT
+
+  G4SDManager * SDman = G4SDManager::GetSDMpointer();
+  G4String colNam;
+  G4int trackerCollID = SDman->GetCollectionID(colNam="TrackerCollection");
+  G4int calorimeterCollID = SDman->GetCollectionID(colNam="CalCollection");
+
+#endif
+
+  if (coutCount < 10) {
+    G4RunManager* runManager = G4RunManager::GetRunManager();
+    const G4Run* currentRun = runManager? runManager->GetCurrentRun(): 0;
+    if (currentRun) G4cout << ">>> Run " << currentRun->GetRunID();
+    G4cout << " Event " << anEvent->GetEventID() << G4endl;
+  }
+
+#ifdef DRAWTRAJHIT
+
+  G4TrajectoryContainer * trajectoryContainer = evt->GetTrajectoryContainer();
+  G4int n_trajectories = 0;
+  if(trajectoryContainer)
+  { n_trajectories = trajectoryContainer->entries(); }
+  if (coutCount < 10) {
+    G4cout << "    " << n_trajectories 
+	   << " trajectories stored in this event." << G4endl;
+  }
+
+  G4HCofThisEvent * HCE = evt->GetHCofThisEvent();
+  G4int n_hitCollection = 0;
+  if(HCE)
+  { n_hitCollection = HCE->GetCapacity(); }
+  if (coutCount < 10) {
+    G4cout << "    " << n_hitCollection
+	   << " hitsCollections stored in this event." << G4endl;
+  }
+
+#endif
+
+  G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
+
+  if(pVVisManager)
+  {
+    G4Scale scale(1. * m, "Test Scale");
+    G4VisAttributes va (G4Colour(1.,0.,0.));
+    scale.SetVisAttributes(va);
+    pVVisManager->Draw(scale);
+
+    G4RunManager* runManager = G4RunManager::GetRunManager();
+    const G4Run* currentRun = runManager? runManager->GetCurrentRun(): 0;
+    std::ostringstream oss;
+    if (currentRun) oss << "Run " << currentRun->GetRunID();
+    oss << " Event " << anEvent->GetEventID();
+    //G4Text text(oss.str(), G4Point3D(400.*cm, 400.*cm, -400.*cm));
+    G4Text text(oss.str(), G4Point3D(0., -0.9, 0.));
+    text.SetScreenSize(18);
+    G4VisAttributes textAtts(G4Colour(0.,1.,1));
+    text.SetVisAttributes(textAtts);
+    pVVisManager->Draw2D(text);
+
+    G4Box transientBox("transientBox",100*cm,100*cm,100*cm);
+    G4VisAttributes transientBoxVisAtts(G4Colour(1.,0.,1));
+    transientBoxVisAtts.SetForceWireframe(true);
+    // Create G4AttsValues...
+    std::vector<G4AttValue> transientBoxAtts;
+    std::ostringstream attoss;
+    attoss << "A magenta box of event " << anEvent->GetEventID();
+    transientBoxAtts.push_back(G4AttValue("TrBox",attoss.str(),""));
+    transientBoxVisAtts.SetAttValues(&transientBoxAtts);
+    // G4AttDefs have to be long life (see constructor)...
+    transientBoxVisAtts.SetAttDefs(&fTransientBoxDefs);
+    pVVisManager->Draw(transientBox, transientBoxVisAtts,
+		       G4Translate3D(500.*cm, 500.*cm, -500.*cm));
+
+    G4Tubs transientTube("transientTube",0.,100*cm,100*cm,0.,360.*deg);
+    G4VisAttributes transientTubeAtts(G4Colour(1.,1.,0));
+    transientTubeAtts.SetForceWireframe(true);
+    pVVisManager->Draw(transientTube, transientTubeAtts,
+		       G4Translate3D(500.*cm, 300.*cm, -500.*cm));
+
+    // A blue rectangle in fixed position on the screen
+    G4PolyhedronBox rectangle(0.1, 0.2, 0.);
+    G4VisAttributes rectangleAtts(G4Colour(0., 0., 1.));
+    rectangleAtts.SetForceSolid(true);
+    rectangle.SetVisAttributes(rectangleAtts);
+    pVVisManager->Draw2D(rectangle, G4Translate3D(0.7, 0.5, 0.));
+  }
+}
Index: tags/visualization-10.5-before-10.6_test/test/src/MyPhysicsList.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/src/MyPhysicsList.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/src/MyPhysicsList.cc	(revision 1102)
@@ -0,0 +1,294 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: MyPhysicsList.cc,v 1.8 2006/06/29 21:34:28 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// ------------------------------------------------------------
+//	GEANT 4 class header file 
+//
+//      This is a version for maximum particle set
+//	History
+//        first version              10  Jan. 1998 by H.Kurashige
+//        add decay at rest          26  Feb. 1998 by H.Kurashige
+// ------------------------------------------------------------
+
+#include "globals.hh"
+#include "MyPhysicsList.hh"
+#include "G4ParticleDefinition.hh"
+#include "G4ParticleWithCuts.hh"
+#include "G4ProcessManager.hh"
+#include "G4ProcessVector.hh"
+#include "G4ParticleTypes.hh"
+#include "G4ParticleTable.hh"
+#include "G4Material.hh"
+#include "G4MaterialTable.hh"
+#include "G4ios.hh"
+#include <iomanip>                
+
+
+MyPhysicsList::MyPhysicsList():  G4VUserPhysicsList()
+{
+  SetVerboseLevel(1);
+}
+
+MyPhysicsList::~MyPhysicsList()
+{
+}
+
+void MyPhysicsList::ConstructParticle()
+{
+  // In this method, static member functions should be called
+  // for all particles which you want to use.
+  // This ensures that objects of these particle types will be
+  // created in the program. 
+
+  ConstructBosons();
+  ConstructLeptons();
+  ConstructMesons();
+  ConstructBarions();
+
+}
+
+void MyPhysicsList::ConstructBosons()
+{
+  // pseudo-particles
+  G4Geantino::GeantinoDefinition();
+  G4ChargedGeantino::ChargedGeantinoDefinition();
+
+  // gamma
+  G4Gamma::GammaDefinition();
+
+  // optical photon
+  G4OpticalPhoton::OpticalPhotonDefinition();
+}
+
+void MyPhysicsList::ConstructLeptons()
+{
+  // leptons
+  G4MuonPlus::MuonPlusDefinition();
+  G4MuonMinus::MuonMinusDefinition();
+  G4TauMinus::TauMinusDefinition();
+  G4TauPlus::TauPlusDefinition();
+  G4Electron::ElectronDefinition();
+  G4Positron::PositronDefinition();
+  G4NeutrinoTau::NeutrinoTauDefinition();
+  G4AntiNeutrinoTau::AntiNeutrinoTauDefinition();
+  G4NeutrinoMu::NeutrinoMuDefinition();
+  G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
+  G4NeutrinoE::NeutrinoEDefinition();
+  G4AntiNeutrinoE::AntiNeutrinoEDefinition();
+}
+
+void MyPhysicsList::ConstructMesons()
+{
+ //  mesons
+  G4PionPlus::PionPlusDefinition();
+  G4PionMinus::PionMinusDefinition();
+  G4PionZero::PionZeroDefinition();
+  G4Eta::EtaDefinition();
+  G4KaonPlus::KaonPlusDefinition();
+  G4KaonMinus::KaonMinusDefinition();
+  G4KaonZero::KaonZeroDefinition();
+  G4AntiKaonZero::AntiKaonZeroDefinition();
+  G4KaonZeroLong::KaonZeroLongDefinition();
+  G4KaonZeroShort::KaonZeroShortDefinition();
+
+  G4DMesonPlus::DMesonPlusDefinition();
+  G4DMesonMinus::DMesonMinusDefinition();
+  G4DMesonZero::DMesonZeroDefinition();
+  G4AntiDMesonZero::AntiDMesonZeroDefinition();
+  G4DsMesonPlus::DsMesonPlusDefinition();
+  G4DsMesonMinus::DsMesonMinusDefinition();
+  G4JPsi::JPsiDefinition();
+
+  G4BMesonPlus::BMesonPlusDefinition();
+  G4BMesonMinus::BMesonMinusDefinition();
+  G4BMesonZero::BMesonZeroDefinition();
+  G4AntiBMesonZero::AntiBMesonZeroDefinition();
+  G4BsMesonZero::BsMesonZeroDefinition();
+  G4AntiBsMesonZero::AntiBsMesonZeroDefinition();
+}
+
+void MyPhysicsList::ConstructBarions()
+{
+//  barions
+  G4Proton::ProtonDefinition();
+  G4AntiProton::AntiProtonDefinition();
+  G4Neutron::NeutronDefinition();
+  G4AntiNeutron::AntiNeutronDefinition();
+  G4Lambda::LambdaDefinition();
+  G4AntiLambda::AntiLambdaDefinition();
+  G4SigmaZero::SigmaZeroDefinition();
+  G4AntiSigmaZero::AntiSigmaZeroDefinition();
+  G4SigmaPlus::SigmaPlusDefinition();
+  G4AntiSigmaPlus::AntiSigmaPlusDefinition();
+  G4SigmaMinus::SigmaMinusDefinition();
+  G4AntiSigmaMinus::AntiSigmaMinusDefinition();
+  G4XiZero::XiZeroDefinition();
+  G4AntiXiZero::AntiXiZeroDefinition();
+  G4XiMinus::XiMinusDefinition();
+  G4AntiXiMinus::AntiXiMinusDefinition();
+  G4OmegaMinus::OmegaMinusDefinition();
+  G4AntiOmegaMinus::AntiOmegaMinusDefinition();
+
+  G4LambdacPlus::LambdacPlusDefinition();
+  G4SigmacPlusPlus::SigmacPlusPlusDefinition();
+  G4SigmacPlus::SigmacPlusDefinition();
+  G4SigmacZero::SigmacZeroDefinition();
+  G4XicPlus::XicPlusDefinition();
+  G4XicZero::XicZeroDefinition();
+  G4OmegacZero::OmegacZeroDefinition();
+  G4AntiLambdacPlus::AntiLambdacPlusDefinition();
+  G4AntiSigmacPlusPlus::AntiSigmacPlusPlusDefinition();
+  G4AntiSigmacPlus::AntiSigmacPlusDefinition();
+  G4AntiSigmacZero::AntiSigmacZeroDefinition();
+  G4AntiXicPlus::AntiXicPlusDefinition();
+  G4AntiXicZero::AntiXicZeroDefinition();
+  G4AntiOmegacZero::AntiOmegacZeroDefinition();
+}
+
+void MyPhysicsList::ConstructIons()
+{
+  //  nuclei
+  G4Alpha::AlphaDefinition();
+  G4Deuteron::DeuteronDefinition();
+  G4Triton::TritonDefinition();
+}
+
+void MyPhysicsList::ConstructProcess()
+{
+  AddTransportation();
+  ConstructEM();
+  ConstructLeptHad();
+  ConstructHad();
+  ConstructGeneral();
+}
+
+#include "G4ComptonScattering.hh"
+#include "G4GammaConversion.hh"
+#include "G4PhotoElectricEffect.hh"
+
+#include "G4MultipleScattering.hh"
+
+#include "G4eIonisation.hh"
+#include "G4eBremsstrahlung.hh"
+#include "G4eplusAnnihilation.hh"
+
+#include "G4MuIonisation.hh"
+#include "G4MuBremsstrahlung.hh"
+#include "G4MuPairProduction.hh"
+
+#include "G4hIonisation.hh"
+void MyPhysicsList::ConstructEM()
+{
+  theParticleIterator->reset();
+  while( (*theParticleIterator)() ){
+    G4ParticleDefinition* particle = theParticleIterator->value();
+    G4ProcessManager* pmanager = particle->GetProcessManager();
+    G4String particleName = particle->GetParticleName();
+     
+    if (particleName == "gamma") {
+    // gamma
+      // Construct processes for gamma
+      pmanager->AddDiscreteProcess(new G4GammaConversion());
+      pmanager->AddDiscreteProcess(new G4ComptonScattering());      
+      pmanager->AddDiscreteProcess(new G4PhotoElectricEffect());
+
+    } else if (particleName == "e-") {
+    //electron
+      // Construct processes for electron
+      G4MultipleScattering *ms = new G4MultipleScattering();
+      pmanager->AddProcess(ms,-1,1,1);
+      pmanager->AddProcess(new G4eIonisation(),-1,2,2);
+      pmanager->AddProcess(new G4eBremsstrahlung(),-1,-1,3);
+  
+    } else if (particleName == "e+") {
+      //positron
+      // Construct processes for positron
+      G4MultipleScattering *ms = new G4MultipleScattering();
+      pmanager->AddProcess(ms,-1,1,1);
+      pmanager->AddProcess(new G4eIonisation(),-1,2,2);
+      pmanager->AddProcess(new G4eBremsstrahlung(),-1,-1,3);      
+      pmanager->AddProcess(new G4eplusAnnihilation(),0,-1,4);
+  
+    } else if( particleName == "mu+" || 
+               particleName == "mu-"    ) {
+    //muon  
+     // Construct processes for muon+
+      G4MultipleScattering *ms = new G4MultipleScattering();
+      pmanager->AddProcess(ms,-1,1,1);
+      pmanager->AddProcess(new G4MuIonisation(),-1,2,2);
+     pmanager->AddProcess(new G4MuBremsstrahlung(),-1,-1,3);
+     pmanager->AddProcess(new G4MuPairProduction(),-1,-1,4);       
+     
+    } else { 
+      if ((particle->GetPDGCharge() != 0.0) && 
+          (particle->GetParticleName() != "chargedgeantino")) {
+	// all others charged particles except geantino
+	G4MultipleScattering *ms = new G4MultipleScattering();
+	pmanager->AddProcess(ms,-1,1,1);
+	pmanager->AddProcess(new G4hIonisation(),-1,2,2);       
+     }
+    }
+  }
+}
+
+void MyPhysicsList::ConstructHad()
+{;}
+
+void MyPhysicsList::ConstructLeptHad()
+{;}
+
+#include "G4Decay.hh"
+void MyPhysicsList::ConstructGeneral()
+{
+  G4Decay* theDecayProcess = new G4Decay();
+  theParticleIterator->reset();
+  while( (*theParticleIterator)() ){
+    G4ParticleDefinition* particle = theParticleIterator->value();
+    G4ProcessManager* pmanager = particle->GetProcessManager();
+    if (theDecayProcess->IsApplicable(*particle)) { 
+      pmanager->AddProcess(theDecayProcess, INT_MAX, -1, INT_MAX); 
+    }
+  }
+}
+
+void MyPhysicsList::SetCuts()
+{
+  if (verboseLevel >0){
+    G4cout << "MyPhysicsList::SetCuts:";
+  }  
+
+  SetCutsWithDefault();
+
+  if (verboseLevel>1) {
+    DumpCutValuesTable();
+  }
+}
+
+
Index: tags/visualization-10.5-before-10.6_test/test/src/MyPrimaryGeneratorAction.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/src/MyPrimaryGeneratorAction.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/src/MyPrimaryGeneratorAction.cc	(revision 1102)
@@ -0,0 +1,86 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: MyPrimaryGeneratorAction.cc,v 1.6 2006/06/29 21:34:30 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+
+#include "MyPrimaryGeneratorAction.hh"
+
+#include "G4Event.hh"
+
+#ifdef GPS
+#include "G4GeneralParticleSource.hh"
+#else
+#include "G4ParticleGun.hh"
+#endif
+
+#include "G4ParticleTable.hh"
+#include "G4ParticleDefinition.hh"
+#include "globals.hh"
+
+MyPrimaryGeneratorAction::MyPrimaryGeneratorAction()
+{
+  G4int n_particle = 1;
+#ifdef GPS
+  particleGun = new G4GeneralParticleSource;
+#else
+  particleGun = new G4ParticleGun(n_particle);
+#endif
+  G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
+  G4String particleName;
+  G4ParticleDefinition* particle 
+    = particleTable->FindParticle(particleName="geantino");
+  particleGun->SetParticleDefinition(particle);
+
+#ifndef GPS
+  particleGun->SetParticleMomentumDirection(G4ThreeVector(0.,1.,0.));
+  particleGun->SetParticleEnergy(100.*GeV);
+  particleGun->SetParticlePosition(G4ThreeVector(0.*cm,-300.*cm,0.*cm));
+#endif
+}
+
+MyPrimaryGeneratorAction::~MyPrimaryGeneratorAction()
+{
+  delete particleGun;
+}
+
+void MyPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
+{
+  particleGun->GeneratePrimaryVertex(anEvent);
+}
+
+#ifdef GPS
+G4GeneralParticleSource* MyPrimaryGeneratorAction::GetGeneralParticleSource()
+{
+  return particleGun;
+} 
+#else
+G4ParticleGun* MyPrimaryGeneratorAction::GetParticleGun()
+{
+  return particleGun;
+} 
+#endif
Index: tags/visualization-10.5-before-10.6_test/test/src/MyRunAction.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/src/MyRunAction.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/src/MyRunAction.cc	(revision 1102)
@@ -0,0 +1,64 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: MyRunAction.cc,v 1.8 2006/06/29 21:34:32 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+
+#include "MyRunAction.hh"
+
+#include "G4Run.hh"
+#include "G4UImanager.hh"
+#include "G4ios.hh"
+
+MyRunAction::MyRunAction()
+{
+  timer = new G4Timer;
+  runIDcounter = 0;
+}
+
+MyRunAction::~MyRunAction()
+{
+  delete timer;
+}
+
+void MyRunAction::BeginOfRunAction(const G4Run* aRun)
+{
+  //G4Run* aModifiableRun = const_cast<G4Run*>(aRun);
+  //aModifiableRun->SetRunID(runIDcounter++);
+  //aRun->transient(true);
+
+  G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
+  timer->Start();
+}
+
+void MyRunAction::EndOfRunAction(const G4Run* aRun)
+{
+  timer->Stop();
+  G4cout << "number of event = " << aRun->GetNumberOfEvent() 
+       << " " << *timer << G4endl;
+}
+
Index: tags/visualization-10.5-before-10.6_test/test/src/MySteppingAction.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/src/MySteppingAction.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/src/MySteppingAction.cc	(revision 1102)
@@ -0,0 +1,120 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: MySteppingAction.cc,v 1.16 2006/06/29 21:34:34 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// 16/Apr/1997  J. Allison:  For visualization/test/test19.
+
+#include "MySteppingAction.hh"
+
+#include "G4SteppingManager.hh"
+#include "G4ParticleDefinition.hh"
+#include "G4VVisManager.hh"
+#include "G4VisAttributes.hh"
+#include "G4Colour.hh"
+#include "G4Polyline.hh"
+#include "G4Circle.hh"
+#include "G4Square.hh"
+
+void MySteppingAction::UserSteppingAction(const G4Step*) {
+  // User Action Example - begin snippet.
+  static int coutCount = 0;
+  if (coutCount < 10) {
+    coutCount++;
+    G4cout << "MySteppingAction::UserSteppingAction called." << G4endl;
+  }
+  /*
+  G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
+  if(pVVisManager) {
+    G4Polyline pl;
+    G4Colour c;
+    G4double chg =
+      pStep -> GetTrack () -> GetDefinition () -> GetPDGCharge ();
+    if (chg != 0.) c = G4Colour (1., 0., 0.);
+    else           c = G4Colour (0., 1., 0.);
+    G4VisAttributes va (c);
+    pl.SetVisAttributes (&va);
+    pl.push_back (pStep -> GetPreStepPoint () -> GetPosition ());
+    pl.push_back (pStep -> GetPostStepPoint () -> GetPosition ());
+    static int coutCount = 0;
+    if (coutCount < 10) {
+      coutCount++;
+      G4cout << "MySteppingAction::UserSteppingAction: drawing "
+	   <<  pl << G4endl;
+    }
+    pVVisManager -> Draw (pl);
+    G4Circle intercept (pStep -> GetPostStepPoint () -> GetPosition ());
+    G4VisAttributes iva (G4Colour(1.,0.,1));
+    intercept.SetVisAttributes (&iva);
+    pVVisManager -> Draw (intercept);
+
+    const G4double pixels = 1.;
+
+    G4Circle circle22(G4Point3D(100.*cm,100.*cm,0.));
+    circle22.SetScreenDiameter(50.*pixels);
+    circle22.SetFillStyle(G4Circle::noFill);
+    G4Colour colour22;
+    G4VisAttributes attribs22;
+    colour22=G4Colour(0.,1.,0.);
+    attribs22=G4VisAttributes(colour22);
+    circle22.SetVisAttributes(attribs22);
+    pVVisManager->Draw(circle22);
+    
+    G4Square square222(G4Point3D(200.*cm,100.*cm,0.));
+    square222.SetWorldDiameter(100.*cm);
+    //square222.SetFillStyle(G4Square::filled);
+    G4Colour colour222;
+    G4VisAttributes attribs222;
+    colour222=G4Colour(0.,1.,0.);
+    attribs222=G4VisAttributes(colour222);
+    square222.SetVisAttributes(attribs222);
+    pVVisManager->Draw(square222);
+    
+    G4Square square33(G4Point3D(-100.*cm,100.*cm,0.));
+    square33.SetScreenDiameter(50.*pixels);
+    square33.SetFillStyle(G4Square::hashed);
+    G4Colour colour33;
+    G4VisAttributes attribs33;
+    colour33=G4Colour(1.,0.,0.);
+    attribs33=G4VisAttributes(colour33);
+    square33.SetVisAttributes(attribs33);
+    pVVisManager->Draw(square33);
+
+    G4Circle circle333(G4Point3D(-200.*cm,100.*cm,0.));
+    circle333.SetWorldDiameter(100.*cm);
+    circle333.SetFillStyle(G4Circle::filled);
+    G4Colour colour333;
+    G4VisAttributes attribs333;
+    colour333=G4Colour(1.,0.,0.);
+    attribs333=G4VisAttributes(colour333);
+    circle333.SetVisAttributes(attribs333);
+    pVVisManager->Draw(circle333);
+  }
+  // User Action Example - end snippet.
+  */
+}
Index: tags/visualization-10.5-before-10.6_test/test/src/ParametrisedBox.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/src/ParametrisedBox.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/src/ParametrisedBox.cc	(revision 1102)
@@ -0,0 +1,64 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: ParametrisedBox.cc,v 1.6 2006/06/29 21:34:36 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Test of parametrisation.  Based on Hans-Peter Wellisch's test.
+
+#include "ParametrisedBox.hh"
+#include "G4VPhysicalVolume.hh"
+#include "G4Box.hh"
+
+ParametrisedBox::ParametrisedBox (G4Material* a, G4Material* b):
+  fpMaterialA (a),
+  fpMaterialB (b) {}
+
+void ParametrisedBox::ComputeTransformation
+(const G4int n,
+ G4VPhysicalVolume* pRep) const
+{
+  pRep->SetTranslation (G4ThreeVector (0, n * 2 * m, 0));
+}
+
+G4Material* ParametrisedBox::ComputeMaterial
+(const G4int n,
+ G4VPhysicalVolume* pVPV)
+{
+  if (n % 2) return fpMaterialB;
+  else return fpMaterialA;
+}
+
+void ParametrisedBox::ComputeDimensions
+(G4Box& box,
+ const G4int n,
+ const G4VPhysicalVolume*) const
+{
+  box.SetXHalfLength ( 0.5 * m * (n + 1));
+  box.SetYHalfLength ( 1 * m * (n + 1));
+  box.SetZHalfLength ( 1.5 * m * (n + 1));
+}
Index: tags/visualization-10.5-before-10.6_test/test/src/SharedSolidDetectorConstruction.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/src/SharedSolidDetectorConstruction.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/src/SharedSolidDetectorConstruction.cc	(revision 1102)
@@ -0,0 +1,82 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+#include "SharedSolidDetectorConstruction.hh"
+
+#include "G4Box.hh"
+#include "G4LogicalVolume.hh"
+#include "G4PVPlacement.hh"
+#include "G4VisAttributes.hh"
+
+SharedSolidDetectorConstruction::SharedSolidDetectorConstruction() {}
+
+SharedSolidDetectorConstruction::~SharedSolidDetectorConstruction() {}
+
+G4VPhysicalVolume* SharedSolidDetectorConstruction::Construct()
+{
+  //------------------------------ experimental hall
+  G4Box * experimentalHall_box
+    = new G4Box("expHall_b",10.*m,10.*m,10.*m);
+  G4LogicalVolume * experimentalHall_log
+    = new G4LogicalVolume(experimentalHall_box,0,"expHall_L",0,0,0);
+  G4VPhysicalVolume * experimentalHall_phys
+    = new G4PVPlacement(0,G4ThreeVector(),"expHall_P",
+                        experimentalHall_log,0,false,0);
+  experimentalHall_log -> SetVisAttributes (G4VisAttributes::Invisible);
+
+  G4Box* solidVoxel = new G4Box("Voxel",
+                                3.6*mm/2,
+                                3.6*mm/2,
+                                3.6*mm/2);
+
+  G4LogicalVolume* logicLung = new G4LogicalVolume(solidVoxel,
+                                                     0,
+                                                     "Lung");
+  G4LogicalVolume* logicHeart = new G4LogicalVolume(solidVoxel,
+                                                     0,
+                                                     "Heart");
+
+  new G4PVPlacement(0,
+		    G4ThreeVector(0.,0.,-100.*mm),
+		    logicLung,
+		    "Lung",
+		    experimentalHall_log,
+		    false,
+		    0);
+  new G4PVPlacement(0,
+		    G4ThreeVector(0.,0.,+100.*mm),
+		    logicHeart,
+		    "Heart",
+		    experimentalHall_log,
+		    false,
+		    0);
+  logicLung->SetVisAttributes(new
+			      G4VisAttributes(G4Colour(0.0,0.0,1.0)));
+  logicHeart->SetVisAttributes(new
+			       G4VisAttributes(G4Colour(1.0,0.0,0.0)));
+
+  return experimentalHall_phys;
+}
Index: tags/visualization-10.5-before-10.6_test/test/src/test19DetectorConstruction.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/src/test19DetectorConstruction.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/src/test19DetectorConstruction.cc	(revision 1102)
@@ -0,0 +1,55 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: test19DetectorConstruction.cc,v 1.4 2006/06/29 21:34:40 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Detector Construction for visualization testing.
+// John Allison 24th April 1997
+
+#include "test19DetectorConstruction.hh"
+
+#include "test19DetectorMessenger.hh"
+#include "G4UImanager.hh"
+
+test19DetectorConstruction::test19DetectorConstruction ():
+fpDetector (0) {
+  new test19DetectorMessenger (this);
+}
+
+test19DetectorConstruction::~test19DetectorConstruction () {}
+
+G4VPhysicalVolume* test19DetectorConstruction::Construct () {
+
+  if (!fpDetector) {
+    G4cout << "Detector not established - constructing default detector."
+         << G4endl;
+    G4UImanager* UI = G4UImanager::GetUIpointer ();
+    UI -> ApplyCommand("/test19det/detector 4");  // Sets fpDetector.
+  }
+  return fpDetector;
+}
Index: tags/visualization-10.5-before-10.6_test/test/src/test19DetectorMessenger.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/src/test19DetectorMessenger.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/src/test19DetectorMessenger.cc	(revision 1102)
@@ -0,0 +1,159 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: test19DetectorMessenger.cc,v 1.8 2006/06/29 21:34:42 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Detector Construction Messenger for visualization testing.
+// John Allison 25th April 1997
+
+#include "test19DetectorMessenger.hh"
+
+#include "test19DetectorConstruction.hh"
+#include "MyDetectorConstruction.hh"
+
+#include "G4StateManager.hh"
+#include "G4UImanager.hh"
+#include "G4UIcommand.hh"
+#include "G4UIparameter.hh"
+#include "G4VPhysicalVolume.hh"
+
+#include "BuildCalorimeter.hh"
+#include "BuildGeom_Example1.hh"
+#include "BuildGeom_Example2.hh"
+#include "BuildParametrised.hh"
+#include "BuildHouse.hh"
+
+#include <sstream>
+
+#ifdef ATLAS
+#include "ATLASdetector.hh"
+#endif
+
+test19DetectorMessenger::test19DetectorMessenger
+(test19DetectorConstruction * test19Det)
+:test19Detector (test19Det)
+{
+  G4UIcommand * command;
+  G4UIparameter * param;
+
+  command = new G4UIcommand ("/test19det/", this);
+  command -> SetGuidance ("test19 detector choice.");
+  fpTest19DetCommandDirectory = command;
+
+  command = new G4UIcommand ("/test19det/detector",this);
+  command -> SetGuidance ("test19 detector choice.  Give integer.");
+  command -> SetGuidance
+    (
+     "0) Part of original test calorimeter"
+     "\n1) Example1 (LBNO, no rotation)"
+     "\n2) Example2 (embryo LBNO, rotated volumes)"
+     "\n3) A parametrised volume"
+     "\n4) MyDetector"
+     "\n5) House"
+#ifdef ATLAS
+     "\n6) ATLAS (selected part)"
+#endif
+     );
+  param = new G4UIparameter ("detector id", 'i', true);
+  param -> SetDefaultValue (-1);
+  command -> SetParameter (param);
+  fpDetectorCommand = command;
+}
+
+test19DetectorMessenger::~test19DetectorMessenger () {
+  delete fpDetectorCommand;
+  delete fpTest19DetCommandDirectory;
+}
+
+void test19DetectorMessenger::SetNewValue
+(G4UIcommand * command, G4String newValues)
+{
+  if (command == fpDetectorCommand) {
+    G4int id;
+    std::istringstream is(newValues) ; is >> id;
+#ifdef ATLAS
+    const G4int idMax = 6;
+#else
+    const G4int idMax = 5;
+#endif
+    if (id < 0 || id > idMax) {
+      G4cout << "Available detectors:"
+	   << "\n0) Part of original test calorimeter"
+	   << "\n1) Example1 (LBNO, no rotation)"
+	   << "\n2) Example2 (embryo LBNO, rotated volumes)"
+	   << "\n3) A parametrised volume"
+	   << "\n4) MyDetector"
+#ifdef ATLAS
+	   << "\n5) ATLAS (selected part)"
+#endif
+	   << "\nChoose by specifying integer parameter."
+	   << G4endl;
+    }
+    else {
+      G4VPhysicalVolume* pGeom;
+      G4VUserDetectorConstruction* detector;
+#ifdef ATLAS
+      ATLASdetector* atlas;
+#endif
+      switch (id) {
+      default:
+      case 0: pGeom = BuildCalorimeter (); break;
+      case 1: pGeom = BuildGeom_Example1(); break;
+      case 2: pGeom = BuildGeom_Example2(); break;
+      case 3: pGeom = BuildParametrised(); break;
+      case 4:
+	detector = new MyDetectorConstruction;
+	//G4cout << 
+	//  "Now further commands before constructing MyDetector."
+	//  "\nType continue to Construct MyDetector..."
+	//     << G4endl;
+	//G4StateManager::GetStateManager () -> Pause ();
+	pGeom = detector -> Construct ();
+	break;
+      case 5: pGeom = BuildHouse(); break;
+#ifdef ATLAS
+      case 6:
+	atlas = new ATLASdetector();
+	//    G4UImanager* UI = G4UImanager::GetUIpointer ();
+	//    UI -> ApplyCommand ("/atlas/innerDetector/barrelSilicon 1");
+	//    UI -> ApplyCommand ("/atlas/innerDetector/pixel 1");
+	// Build ATLAS detector geometry
+	G4cout << 
+	  "Now further ATLAS commands before constructing."
+	  "\nType continue to Construct ATLAS..."
+	     << G4endl;
+	G4StateManager::GetStateManager () -> Pause ();
+	pGeom = atlas -> buildATLAS ();
+	G4cout << "ATLAS geometrical definition Done." << G4endl;
+	break;
+#endif
+      }
+      test19Detector -> SetDetector (pGeom);
+    }
+  }
+}
Index: tags/visualization-10.5-before-10.6_test/test/test19.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/test19.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/test19.cc	(revision 1102)
@@ -0,0 +1,191 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: test19.cc,v 1.30 2009/07/28 12:50:51 lgarnier Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+
+// Usage: test19 [<session>] [<verbosity>]
+// Without verbosity, verbosity=warnings.
+// Without session, session=new G4UIterminal(), or if G4UI_USE_TCSH is set
+//                  session=new G4UIterminal(new G4UItcsh),
+
+#include <stdio.h>
+#include <ctype.h>
+#include <stdlib.h>
+
+#include "globals.hh"
+//#include "SharedSolidDetectorConstruction.hh"
+#include "test19DetectorConstruction.hh"
+#include "MyPhysicsList.hh"
+#include "MyRunAction.hh"
+#include "MyPrimaryGeneratorAction.hh"
+#include "MyEventAction.hh"
+#include "MySteppingAction.hh"
+
+#include "G4UIterminal.hh"
+#if defined(G4UI_USE_GAG)
+  #include "G4UIGAG.hh"
+#elif defined(G4UI_USE_TCSH)
+  #include "G4UItcsh.hh"
+#elif defined(G4UI_USE_WO)
+  #include "G4UIWo.hh"
+#elif defined(G4UI_USE_XM)
+  #include "G4UIXm.hh"
+#elif defined(G4UI_USE_XAW)
+  #include "G4UIXaw.hh"
+#elif defined(G4UI_USE_WIN32)
+  #include "G4UIWin32.hh"
+#elif defined(G4UI_USE_QT)
+  #include "G4UIQt.hh"
+#endif
+
+#include "G4RunManager.hh"
+
+#ifdef G4VIS_USE
+#include "G4VisExecutive.hh"
+// G4VisExecutive is a G4VisManager that implements graphics system
+// registration in the user domain.
+#include "G4XXX.hh"
+#include "G4XXXFile.hh"
+#include "G4XXXStored.hh"
+#ifdef G4VIS_USE_XXXSG
+#include "G4XXXSG.hh"
+#endif
+#endif
+
+
+#ifdef G4UI_USE_WIN32
+#include <windows.h>
+int WINAPI WinMain (
+HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpszCmdLine,int nCmdShow) {
+#else
+int main (int argc, char** argv) {
+#endif
+
+  G4String verbosityString("warnings");
+#ifndef G4UI_USE_WIN32
+  if ((argc >= 3)) verbosityString = argv[2];
+#endif
+
+  // Choose (G)UI.
+  G4UIsession* session;
+#ifdef G4UI_USE_WIN32
+  session = new G4UIWin32 (hInstance,hPrevInstance,lpszCmdLine,nCmdShow);
+#else
+  if (argc >= 2) {
+  #if defined(G4UI_USE_TCSH)
+    if (strcmp (argv[1], "tcsh")==0)     session =
+      new G4UIterminal(new G4UItcsh);
+  #elif defined(G4UI_USE_WO)
+    if (strcmp (argv[1], "Wo")==0)  session = new G4UIWo (argc, argv);
+  #elif defined(G4UI_USE_XM)
+    if (strcmp (argv[1], "Xm")==0)  session = new G4UIXm (argc, argv);
+  #elif defined(G4UI_USE_XAW)
+    if (strcmp (argv[1], "Xaw")==0) session = new G4UIXaw (argc, argv);
+  #elif defined(G4UI_USE_GAG)
+    if (strcmp (argv[1], "gag")==0) session = new G4UIGAG ;
+  #elif defined(G4UI_USE_QT)
+    if (strcmp (argv[1], "Qt")==0)  session = new G4UIQt (argc, argv);
+  #else
+    session = new G4UIterminal();
+  #endif
+    else  session = new G4UIterminal();
+  }
+  else                                   
+  {
+    G4cerr << "You should define a UI in order to interact with test" << G4endl;
+    return 0;
+  }
+#endif
+  G4UImanager::GetUIpointer()->SetSession(session);  //So that Pause works..
+
+  // Run manager
+  G4cout << "RunManager is constructing...." << G4endl;
+  G4RunManager * runManager = new G4RunManager;
+
+  // User initialization classes
+  runManager -> SetUserInitialization (new test19DetectorConstruction);
+  //runManager -> SetUserInitialization (new SharedSolidDetectorConstruction);
+  runManager -> SetUserInitialization (new MyPhysicsList);
+
+  // UserAction classes.
+  runManager -> SetUserAction (new MyRunAction);
+  runManager -> SetUserAction (new MyPrimaryGeneratorAction);
+  runManager -> SetUserAction (new MyEventAction);
+  runManager -> SetUserAction (new MySteppingAction);
+
+  //Initialize G4 kernel
+  //runManager->Initialize();  // Do this with /run/initialize so that
+			       // you can, optionally, choose detector
+			       // (/test19det/detector N) first.
+
+#ifdef G4VIS_USE
+  // Instantiate and initialise Visualization Manager.
+  G4VisManager* visManager = new G4VisExecutive;
+  visManager -> SetVerboseLevel (verbosityString);
+  visManager -> RegisterGraphicsSystem(new G4XXX);
+  visManager -> RegisterGraphicsSystem(new G4XXXFile);
+  visManager -> RegisterGraphicsSystem(new G4XXXStored);
+#ifdef G4VIS_USE_XXXSG
+  visManager -> RegisterGraphicsSystem(new G4XXXSG);
+#endif
+  visManager -> Initialize ();
+#endif
+
+  G4UImanager* UI = G4UImanager::GetUIpointer ();
+
+#ifdef G4UI_USE_WIN32
+  G4cout << "Reading win32.g4m file...." << G4endl;
+  UI -> ApplyCommand ("/control/execute win32.g4m");
+#else
+  G4cout << "Reading test19.g4m file...." << G4endl;
+  UI -> ApplyCommand ("/control/execute test19.g4m");
+#endif
+
+  G4cout << 
+    "Choose a detector with /test19det/detector (or let default be"
+    " constructed)."
+       << G4endl;
+
+  // Start an interactive session.
+  session -> SessionStart();
+
+#ifdef G4VIS_USE
+  G4cout << "vis_test19: Deleting vis manager..." << G4endl;
+  delete visManager;
+  G4cout << "vis_test19: Vis manager deleted." << G4endl;
+#endif
+  G4cout << "vis_test19: Deleting run manager..." << G4endl;
+  delete runManager;
+  G4cout << "vis_test19: Run manager deleted." << G4endl;
+  G4cout << "vis_test19: Deleting session..." << G4endl;
+  delete session;
+  G4cout << "vis_test19: Session deleted." << G4endl;
+
+  return 0;
+}
Index: tags/visualization-10.5-before-10.6_test/test/test19.g4m
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/test19.g4m	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/test19.g4m	(revision 1102)
@@ -0,0 +1,381 @@
+# This is test19.g4m
+#
+# Switch on echoing of commands and history mechanism.
+#
+/control/verbose 2
+/control/saveHistory
+/vis/verbose confirmations
+#
+# See list of detector possibilities.
+/test19det/detector
+# Select detector.
+#/test19det/detector 1
+#/test19det/detector 4
+#
+# Initialise run, i.e., create geometry, set cuts, etc.
+/run/initialize
+#
+# Set gun for demo (detector 1)
+#/gun/particle e+
+#/gun/position 0 -100 0 cm
+#/gun/direction 0 1 0
+#
+# for drawing the tracks
+/tracking/storeTrajectory 1
+# if too many tracks cause core dump =storeTrajectory 0
+#
+# Create empty scene.
+/vis/scene/create
+#
+# Add volume to scene - "world" is default.
+/vis/scene/add/volume
+#
+# See list of graphics systems possibilities.
+# help /vis/sceneHandler/create
+#
+# Create a scene handler for a specific graphics system.
+# Edit the next line(s) to choose another graphic system
+#/vis/sceneHandler/create DAWNFILE
+#/vis/sceneHandler/create DAWN
+#/vis/sceneHandler/create OGLIXm
+#/vis/sceneHandler/create OGLSXm
+#/vis/sceneHandler/create OGLIX
+/vis/sceneHandler/create OGLSQt
+#/vis/sceneHandler/create VRML1
+#/vis/sceneHandler/create VRML1FILE
+#
+# Add world volume.
+/vis/scene/add/volume
+/vis/scene/add/axes 0 0 0 2 m
+/vis/scene/add/text 0 0 0 mm 50 -120 -200 test19 example text
+#
+# Add logo
+/vis/scene/add/logo
+#
+# Add scale
+/vis/scene/add/scale
+#
+# Add event id
+/vis/scene/add/eventID
+#
+# Create a viewer.
+/vis/viewer/create
+#
+# John's personal preferences
+/vis/viewer/set/lightsMove camera
+/vis/viewer/set/hiddenMarker true
+#
+/vis/viewer/set/lineSegmentsPerCircle 100
+# flush not necessary for auto-refresh drivers like OGL abd OI, but leave
+# (all that happens is an extra refresh).
+/vis/viewer/flush
+#
+# Create another viewer.
+/vis/viewer/create
+#
+/vis/viewer/set/viewpointThetaPhi 35 35
+/vis/viewer/set/style surface
+/vis/viewer/set/projection perspective 30
+#
+/vis/viewer/flush
+#
+# Now hidden line removal.
+/vis/viewer/create
+#
+/vis/viewer/set/viewpointThetaPhi 35 35
+/vis/viewer/set/style wireframe
+/vis/viewer/set/hiddenEdge
+/vis/viewer/set/projection perspective 30
+#
+/vis/viewer/flush
+#
+# Now hidden line *and* hidden surface removal.
+/vis/viewer/create
+#
+/vis/viewer/set/viewpointThetaPhi 35 35
+/vis/viewer/set/style surface
+/vis/viewer/set/hiddenEdge
+/vis/viewer/set/projection perspective 30
+#
+/vis/viewer/flush
+#
+# Start a run to initialise/optimise geometry and draw user-drawn transients.
+/run/beamOn
+#
+# Test logical volume model...
+/vis/scene/create
+/vis/scene/add/logicalVolume expHall_L
+/vis/sceneHandler/create OGLSQt
+/vis/viewer/create
+/vis/viewer/set/viewpointThetaPhi 35 35
+/vis/scene/notifyHandlers
+/vis/viewer/flush
+#
+# Logical volume of Boolean solids...
+/vis/scene/create
+/vis/scene/add/logicalVolume intersection_L
+/vis/sceneHandler/create OGLSQt
+/vis/viewer/create
+/vis/viewer/reset
+/vis/viewer/set/viewpointThetaPhi 35 35
+/vis/scene/notifyHandlers
+/vis/viewer/flush
+#
+/vis/scene/create
+/vis/scene/add/logicalVolume subtraction_L
+/vis/sceneHandler/attach
+/vis/viewer/reset
+/vis/viewer/set/viewpointThetaPhi 35 35
+/vis/viewer/flush
+#
+/vis/scene/create
+/vis/scene/add/logicalVolume union_L
+/vis/sceneHandler/attach
+/vis/viewer/reset
+/vis/viewer/set/viewpointThetaPhi 35 35
+/vis/viewer/flush
+#
+# Send geantino through...
+/vis/scene/create
+/vis/scene/endOfEventAction accumulate
+/vis/scene/endOfRunAction accumulate
+/vis/scene/add/volume
+/vis/scene/add/trajectories 5000
+#/vis/sceneHandler/create OGLSX
+/vis/sceneHandler/create OGLSQt
+/vis/viewer/create
+/vis/viewer/reset
+/vis/viewer/set/viewpointThetaPhi 35 35
+/vis/scene/notifyHandlers
+/tracking/verbose 2
+/run/beamOn 1
+/tracking/verbose 0
+/vis/viewer/flush
+#
+# Rotated tracker tube
+/vis/viewer/reset
+#/vis/viewer/panTo 0 -200 cm
+/vis/viewer/set/upVector 1 0 0
+/vis/viewer/set/viewpointVector 0 1 0
+#/vis/viewer/zoom 5
+/vis/viewer/set/auxiliaryEdge true
+/vis/viewer/refresh
+/gun/direction 1 0 0
+/gun/position -200 -200 150 cm
+/run/beamOn
+/gun/position -200 -200 200 cm
+/run/beamOn
+/gun/position -200 -200 250 cm
+/run/beamOn
+/gun/position -200 -200 300 cm
+/run/beamOn
+/vis/viewer/flush
+#
+# G4Trap1
+/vis/viewer/reset
+#/vis/viewer/panTo -200 200 cm  # Originally intended to be absolute coords.
+/vis/viewer/pan -275 75 cm
+/vis/viewer/zoom 5
+/vis/viewer/refresh
+/gun/direction -1 0 0
+/gun/position -20 120 -200 cm
+/run/beamOn
+/gun/position -20 130 -200 cm
+/run/beamOn
+/gun/position -20 140 -200 cm
+/run/beamOn
+/gun/position -20 150 -200 cm
+/run/beamOn
+/gun/position -20 160 -200 cm
+/run/beamOn
+/gun/position -20 170 -200 cm
+/run/beamOn
+/gun/position -20 180 -200 cm
+/run/beamOn
+/gun/position -20 190 -200 cm
+/run/beamOn
+/gun/position -20 200 -200 cm
+/run/beamOn
+/gun/position -20 210 -200 cm
+/run/beamOn
+/gun/position -20 220 -200 cm
+/run/beamOn
+/gun/position -20 230 -200 cm
+/run/beamOn
+/gun/position -20 240 -200 cm
+/run/beamOn
+/gun/position -20 250 -200 cm
+/run/beamOn
+/gun/position -20 260 -200 cm
+/run/beamOn
+/gun/position -20 270 -200 cm
+/run/beamOn
+/gun/position -20 280 -200 cm
+/run/beamOn
+/vis/viewer/flush
+#
+# G4Trap2
+/vis/viewer/reset
+#/vis/viewer/panTo -200 400 cm
+/vis/viewer/pan -275 275 cm
+/vis/viewer/set/viewpointThetaPhi 90 180
+#/vis/viewer/panTo -200 0 cm
+/vis/viewer/pan -200 0 cm
+/vis/viewer/zoom 5
+/vis/viewer/refresh
+/gun/direction 0 0 -1
+/gun/position -200 400 -20 cm
+/run/beamOn
+/gun/position -200 380 -20 cm
+/run/beamOn
+/gun/position -200 420 -20 cm
+/run/beamOn
+/gun/position -200 360 -20 cm
+/run/beamOn
+/gun/position -200 440 -20 cm
+/run/beamOn
+/gun/position -200 340 -20 cm
+/run/beamOn
+/gun/position -200 460 -20 cm
+/run/beamOn
+/vis/viewer/flush
+#
+# Displaced solid.
+/vis/viewer/reset
+#/vis/viewer/panTo 200 -200 cm
+/vis/viewer/pan 125 -325 cm
+/vis/viewer/zoom 5
+/vis/viewer/refresh
+/gun/position 100 -180 0 cm
+/gun/direction 1 0 0
+/run/beamOn
+/vis/viewer/flush
+#
+# Boolean solid.
+/vis/viewer/reset
+#/vis/viewer/panTo 250 -50 cm
+/vis/viewer/pan 175 -175 cm
+/vis/viewer/zoom 3
+/vis/viewer/refresh
+/gun/direction 1 0 0
+/gun/position 50 -105 0 cm
+/run/beamOn
+/gun/position 50 -100 0 cm
+/run/beamOn
+/gun/position 50 -95 0 cm
+/run/beamOn
+/gun/position 50 -90 0 cm
+/run/beamOn
+/gun/position 50 -85 0 cm
+/run/beamOn
+/gun/position 50 -80 0 cm
+/run/beamOn
+/gun/position 50 -75 0 cm
+/run/beamOn
+/gun/position 50 -70 0 cm
+/run/beamOn
+/gun/position 50 -65 0 cm
+/run/beamOn
+/gun/position 50 -60 0 cm
+/run/beamOn
+/gun/position 50 -55 0 cm
+/run/beamOn
+/gun/position 50 -50 0 cm
+/run/beamOn
+/gun/position 50 -45 0 cm
+/run/beamOn
+/gun/position 50 -40 0 cm
+/run/beamOn
+/gun/position 50 -35 0 cm
+/run/beamOn
+/gun/position 50 -30 0 cm
+/run/beamOn
+/gun/position 50 -25 0 cm
+/run/beamOn
+/gun/position 50 -20 0 cm
+/run/beamOn
+/gun/position 50 -15 0 cm
+/run/beamOn
+/gun/position 50 -10 0 cm
+/run/beamOn
+/gun/position 50 -5 0 cm
+/run/beamOn
+/gun/position 50 0 0 cm
+/run/beamOn
+/gun/position 50 5 0 cm
+/run/beamOn
+/gun/position 50 10 0 cm
+/run/beamOn
+/gun/position 50 15 0 cm
+/run/beamOn
+/gun/position 50 20 0 cm
+/run/beamOn
+/vis/viewer/flush
+#
+# To view replicas...
+# Investigating BaBar problem...
+# G4SmartVoxelHeader::BuildNodes - PANIC! Daughter physical volume
+# name = EB20 is entirely outside mother logical volume name = EBMX
+/vis/viewer/reset
+#/vis/viewer/panTo -200 0 cm
+/vis/viewer/pan -275 -125 cm
+/vis/viewer/zoom 7
+/vis/viewer/refresh
+/gun/direction 0 1 0
+# The following just crash with replicas...
+/gun/position -200 -100 0 cm
+/run/beamOn
+/gun/position -195 -100 0 cm
+/run/beamOn
+/gun/position -190 -100 0 cm
+/run/beamOn
+/gun/position -185 -100 0 cm
+/run/beamOn
+/gun/position -180 -100 0 cm
+/run/beamOn
+/gun/position -160 -100 0 cm
+/run/beamOn
+#...end
+/gun/position -200 0 0 cm
+# The following just crash with replicas...
+/gun/direction 1 1 0
+/run/beamOn
+/gun/direction 0 1 0
+/run/beamOn
+/gun/direction 1 .2 0
+/run/beamOn
+/gun/direction -1 1 0
+/run/beamOn
+/gun/direction -1 -1 0
+/run/beamOn
+/gun/direction 0 -1 0
+/run/beamOn
+/gun/direction 1 -1 0
+/run/beamOn
+/vis/viewer/flush
+#...end
+#
+/vis/viewer/set/viewpointThetaPhi 30 30
+/vis/viewer/set/projection perspective 30
+/vis/viewer/flush
+#
+/vis/sceneHandler/create RayTracerX
+#/vis/viewer/create
+/vis/viewer/create ! ! 200
+/vis/viewer/set/viewpointThetaPhi 30 30
+/vis/viewer/flush
+#
+# You can use /vis/rayTracer/... commands
+/vis/rayTracer/column 150
+/vis/rayTracer/row 100
+/vis/rayTracer/backgroundColour .3 .2 .1
+/vis/rayTracer/trace
+#
+/vis/viewer/create ! ! 200x300
+/vis/viewer/set/projection perspective  30
+/vis/viewer/set/viewpointThetaPhi 45 45
+/vis/viewer/flush
+#
+# Odd!!?  JPEG image seems upside down for default view direction...
+/vis/viewer/create ! ! 200
+/vis/viewer/flush
Index: tags/visualization-10.5-before-10.6_test/test/test19.new_commands.in
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/test19.new_commands.in	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/test19.new_commands.in	(revision 1102)
@@ -0,0 +1,20 @@
+/vis/scene/create
+/vis/scene/add/volume calo_phys 2
+/vis/scene/add/volume tracker_phys
+/vis/sceneHandler/create OGLIX
+/vis/viewer/create
+/vis~/refresh/view
+/vis/scene/add/volume calo_phys 1
+/vis/scene/notifyHandlers
+/vis/scene/list
+/vis/viewer/list
+/vis/sceneHandler/list
+/vis/scene/select scene-0
+/vis/scene/remove scene-0
+/vis/scene/list
+/vis/sceneHandler/select scene-handler-0
+/vis/sceneHandler/remove scene-handler-0
+/vis/sceneHandler/list
+/vis/viewer/select viewer-0
+/vis/viewer/remove viewer-0
+/vis/viewer/list
Index: tags/visualization-10.5-before-10.6_test/test/test19.xrm
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/test19.xrm	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/test19.xrm	(revision 1102)
@@ -0,0 +1,341 @@
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!! Extracted from Wo/usr/Xm.xrm (without Wo* prefix ) !!!!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+*topShadowColor    :white
+*bottomShadowColor :black
+*foreground        :black
+*background        :lightgrey
+*borderColor       :lightgrey
+*fontList          :-*-helvetica-bold-r-*-*-*-120-*-*-*-*-iso8859-1
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! OpenInventor resources, copied from file :
+!  OpenInventor2.4.1/app-defaults/Inventor
+!
+!#################################################
+!	RESSOURCE FILE FOR OPEN INVENTOR         !
+!#################################################
+!
+! You must put this file in
+! /usr/lib/X11/app-defaults
+! or set up XAPPLRESDIR (see X window documentation)
+!
+!#################################################
+!!################################################
+!!                 POPUP MENU
+!!------------------------------------------------
+!!               FUNCTIONS MENU
+!!------------------------------------------------
+*IvMenu.IvFunctions1.labelString: Functions
+*IvFunctions2.IvHelp.labelString: Help
+*IvFunctions2.IvHome.labelString: Home
+*IvFunctions2.IvSetHome.labelString: Set Home
+*IvFunctions2.IvViewAll.labelString: View All
+*IvFunctions2.IvSeek.labelString: Seek
+*IvFunctions2.IvCopyView.labelString: Copy View
+*IvFunctions2.IvPasteView.labelString: Paste View
+!!------------------------------------------------
+!!               DRAW STYLE MENU
+!!------------------------------------------------
+*IvMenu.IvDrawStyle1.labelString: Draw Style
+*IvDrawStyle2.IvAsIs.labelString: as is
+*IvDrawStyle2.IvHiddenLine.labelString: hidden line
+*IvDrawStyle2.IvNoTexture.labelString: no texture
+*IvDrawStyle2.IvLowResolution.labelString: low resolution
+*IvDrawStyle2.IvWireFrame.labelString: wireframe
+*IvDrawStyle2.IvPoints.labelString: points
+*IvDrawStyle2.IvBoundingBoxNoDepth.labelString: bounding box ( no depth )
+*IvDrawStyle2.IvMoveSameAsStill.labelString: move same as still
+*IvDrawStyle2.IvMoveNoTexture.labelString:  move no texture.
+*IvDrawStyle2.IvMoveLowRes.labelString: move low res
+*IvDrawStyle2.IvMoveWireFrame.labelString: move wireframe
+*IvDrawStyle2.IvMoveLowResWireFrameNoDepth.labelString: move low res wire frame ( no depth )
+*IvDrawStyle2.IvMovePoints.labelString: move points
+*IvDrawStyle2.IvMoveLowResPointsNoDepth.labelString: move low res points ( no depth )
+*IvDrawStyle2.IvMoveBoundingBoxNoDepth.labelString: move bounding box ( no depth )
+*IvDrawStyle2.IvSingleBuffer.labelString: single buffer
+*IvDrawStyle2.IvDoubleBuffer.labelString: Double buffer
+*IvDrawStyle2.IvInteractiveBuffer.labelString: interactive buffer
+!!------------------------------------------------
+*IvMenu.IvViewing.labelString: Viewing
+!!------------------------------------------------
+*IvMenu.IvDecoration.labelString: Decoration
+!!------------------------------------------------
+*IvMenu.IvHeadlight.labelString: Headlight
+!!------------------------------------------------
+*IvMenu.IvPreferences.labelString: Preferences ...
+
+!!------------------------------------------------
+!!		   PREFERENCES
+!!------------------------------------------------
+*IvFormPreference1.IvSeekAnimationTime.labelString: Seek animation time
+*IvFormPreference1.IvSeconds.labelString: seconds
+*IvFormPreference1.IvSeekTo.labelString: Seek to:
+*IvFormPreference1.IvPoint.labelString: point
+*IvFormPreference1.IvObject.labelString: object
+*IvFormPreference2.IvSeekDistance.labelString: Seek distance:
+*IvFormPreference2.IvPercentage.labelString: percentage
+*IvFormPreference2.IvAbsolute.labelString: absolute
+*IvZoomForm.IvCameraZoom.labelString: Camera zoom
+*IvZoomForm.IvZoomSliderRangesFrom.labelString: Zoom slider ranges from:
+*IvZoomForm.IvTo.labelString: to:
+*IvZoomForm.IvZoomSlider.labelString: Zoom slider
+*IvZoomForm.IvZoomField.labelString: Zoom field
+*IvZoomForm.IvZoomFrom.labelString: Zoom from
+*IvZoomForm.IvZoomTo.labelString: Zoom to
+*IvFormPreference3.IvAutoClippingPlanes.labelString: Auto clipping planes 
+*IvFormPreference4.IvStereoViewing.labelString: Stereo Viewing
+*IvFormPreference6.IvNearPlane.labelString: near plane
+*IvFormPreference6.IvFarPlane.labelString: far plane
+*IvStereoThumbForm.IvCameraRotation.labelString: Camera rotation
+
+!!------------------------------------------------
+!! Preferences for Examiner Viewer
+!!------------------------------------------------
+*IvFormExaminer1.IvEnableSpinAnimation.labelString: Enable spin animation
+*IvFormExaminer1.IvShowPointOfRotationAxes.labelString: Show point of rotation axes
+*IvFormExaminer1.IvAxesSize.labelString: axes size
+*IvFormExaminer1.IvPixels.labelString: pixels
+!!------------------------------------------------
+!! Decorations for Examiner Viewer !!
+!!------------------------------------------------
+*IvExamTitle.labelString: Examiner Viewer
+*IvExamPrefTitle.labelString: Examiner Viewer Preference Sheet
+*IvExamPopupTitle.labelString: Examiner Viewer
+*IvExamIconTitle.labelString: Examiner Viewer
+*IvExamRotx.labelString: Rotx
+*IvExamRoty.labelString: Roty
+*IvExamZoom.labelString: Zoom
+*IvExamDolly.labelString: Dolly
+!!------------------------------------------------
+!! Decorations for Plane Viewer !!
+!!------------------------------------------------
+*IvPlaneTitle.labelString: Plane Viewer
+*IvPlanePrefTitle.labelString: Plane Viewer Preference Sheet
+*IvPlanePopupTitle.labelString: Plane Viewer
+*IvPlaneIconTitle.labelString: Plane Viewer
+*IvPlaneTransx.labelString: transX
+*IvPlaneTransy.labelString: transY
+*IvPlaneZoom.labelString: Zoom
+*IvPlaneDolly.labelString: Dolly
+!!------------------------------------------------
+!! Decorations for Fly Viewer !!
+!!------------------------------------------------
+*IvFlyTitle.labelString: Fly Viewer
+*IvFlyPrefTitle.labelString: Fly Viewer Preference Sheet
+*IvFlyPopupTitle.labelString: Fly Viewer
+*IvFlyIconTitle.labelString: Fly Viewer
+!! Same for Walk Viewer !!
+*IvFlyWalkRotate.labelString: Rotate
+!! Same for Walk Viewer !!
+*IvFlyWalkTilt.labelString: Tilt
+!! Same for Walk Viewer !!
+*IvFlyWalkDolly.labelString: Dolly
+!!------------------------------------------------
+!! Preferences for Fly Viewer !!
+!!------------------------------------------------
+*FlyPreference.FlyingSpeed.labelString: Flying speed:
+*FlyPreference.Increase.labelString: increase
+*FlyPreference.Decrease.labelString: decrease 
+!!------------------------------------------------
+!! Decorations for Walk Viewer !!
+!!------------------------------------------------
+*IvWalkTitle.labelString: Walk Viewer
+*IvWalkPrefTitle.labelString: Walk Viewer Preference Sheet
+*IvWalkPopupTitle.labelString: Walk Viewer
+*IvWalkIconTitle.labelString: Walk Viewer
+*IvLeftTrimForm.IvH.labelString: H
+!!------------------------------------------------
+!! Preferences for Walk Viewer !!
+!!------------------------------------------------
+*IvFormPreference5.IvViewerSpeed.labelString: Viewer speed
+*IvFormPreference5.IvIncrease.labelString: increase
+*IvFormPreference5.IvDecrease.labelString: decrease
+!!------------------------------------------------
+!!		EDITORS
+!!------------------------------------------------
+!! Drectional Light Editor !!
+!!------------------------------------------------	
+*IvDirectLightTitle.labelString: Dir Light Editor
+*IvDirectLightIconTitle.labelString: Dir Light Ed
+*IvDirectLightInten.labelString: Inten
+*IvDirectLightColorEditor.labelString: Directional Light Color
+*IvDLMenuBar.IvEdit.labelString: Edit
+*IvDLMenuBar*IvControlPullDown*IvColorEditor.labelString: Color Editor
+*IvDLMenuBar*IvControlPullDown*IvCopy.labelString: Copy
+*IvDLMenuBar*IvControlPullDown*IvPaste.labelString: Paste
+*IvDLMenuBar*IvControlPullDown*IvHelp.labelString: Help
+!!------------------------------------------------
+!! Color Editor !!
+!!------------------------------------------------
+*IvColorEditorTitle.labelString: Color Editor
+*IvColorEditorIconTitle.labelString: Color Editor
+*IvColorEditorR.labelString: R
+*IvColorEditorG.labelString: G
+*IvColorEditorB.labelString: B
+*IvColorEditorH.labelString: H
+*IvColorEditorS.labelString: S
+*IvColorEditorV.labelString: V
+*IvColorEditorRight.labelString: Right
+*IvColorEditorSwitch.labelString: Switch
+*IvColorEditorCont.labelString: Continuous
+*IvColorEditorManu.labelString: Manual
+*IvColorEditorWysi.labelString: WYSIWYG
+*IvColorEditorCopy.labelString: Copy
+*IvColorEditorPaste.labelString: Paste
+*IvColorEditorHelp.labelString: Help
+*IvColorEditorNone.labelString: None
+*IvColorEditorValue.labelString: Value
+*IvColorEditorRGB.labelString: RGB
+*IvColorEditorHSV.labelString: HSV
+*IvColorEditorRGBV.labelString: RGB V
+*IvColorEditorRGBHSV.labelString: RGB HSV
+
+*IvCEMenuBar.IvEdit.labelString: Edit
+*IvCEMenuBar.IvSliders.labelString: Sliders
+*IvButtonsForm.IvAccept.labelString: Accept
+!!------------------------------------------------
+!! Material Editor !!
+!!------------------------------------------------
+*IvMaterialEditorTitle.labelString: Material Editor
+*IvMaterialEditorIconTitle.labelString: Mat Editor
+*IvMaterialAmbientTitle.labelString: Material Ambient Color
+*IvMaterialDiffuseTitle.labelString: Material Diffuse Color
+*IvMaterialSpecularTitle.labelString: Material Specular Color
+*IvMaterialEmissiveTitle.labelString: -Material Emissive Color
+*IvMaterialEditorMaterial.labelString: Material / 
+*IvMaterialEditorAmb.labelString: Amb / 
+*IvMaterialEditorDiff.labelString: Diff /  
+*IvMaterialEditorSpec.labelString: Spec / 
+*IvMaterialEditorEmis.labelString: Emis / 
+*IvMaterialEditorColor.labelString: Color
+*IvMEMenuBar.IvEdit.labelString: Edit
+*IvMEMenuBar*IvEditPullDown.IvMaterialList.labelString: Material List
+*IvMEMenuBar*IvEditPullDown.IvContinuous.labelString: Continuous
+*IvMEMenuBar*IvEditPullDown.IvManual.labelString: Manual
+*IvMEMenuBar*IvEditPullDown.IvCopy.labelString: Copy
+*IvMEMenuBar*IvEditPullDown.IvPaste.labelString: Paste
+*IvMEMenuBar*IvEditPullDown.IvHelp.labelString: Help
+*IvControls.IvEditColor.labelString: Edit Color
+*IvsliderForm.IvtextForm.IvAmb.labelString: Amb:
+*IvsliderForm.IvtextForm.IvDiff.labelString: Diff
+*IvsliderForm.IvtextForm.IvSpec.labelString: Spec
+*IvsliderForm.IvtextForm.IvEmis.labelString: Emis
+*IvsliderForm.IvtextForm.IvShininess.labelString: Shininess
+*IvsliderForm.IvtextForm.IvTransp.labelString: Transp:
+*IvMETop.IvAccept.labelString: Accept
+!!------------------------------------------------
+!! Material List !!
+!!------------------------------------------------
+*IvMaterialListTitle.labelString: Material List
+*IvMaterialListeIconTitle.labelString: Mat List
+*IvMLMenuBar*IvPalettes.labelString: Palettes
+!!------------------------------------------------
+!! Print Dialog
+!!------------------------------------------------
+*IvPrintDialTitle.labelString: Print Dialog 
+*IvPrintDialIconTitle.labelString: -rint Dialog
+*IvPrintDialPrinter.labelString: Printer:
+*IvPrintDialPageOut.labelString: Page Output:
+*IvPrintDialToPrinter.labelString: To Printer
+*IvPrintDialToFile.labelString: To File
+*IvPrintDialQuit.labelString: Quit
+*IvPrintDialPrint.labelString: Print
+*IvPrintDialMessage.labelString: Message:
+*IvPrintDialFileFormat.labelString: File Format:
+*IvPrintDialPostScript.labelString: PostScript
+*IvPrintDialRGB.labelString: RGB
+*IvPrintDialPrintQuality.labelString: Print Quality:
+*IvPrintDialHigh.labelString: High
+*IvPrintDialDraft.labelString: Draft
+*IvPrintDialPageFormat.labelString: Page Format
+*IvPrintDialPortrait.labelString: Portrait
+*IvPrintDialLandscape.labelString: Landscape
+*IvPrintDialPrintSize.labelString: Print Size (inches):
+*IvPrintDialFileName.labelString: File Name:
+*IvPrintDialResolution.labelString: Resolution
+*IvPrintDialBy.labelString: by
+*IvPrintDialDpi.labelString: DPI:
+*IvPrintDialMess1.labelString: Printing in progress...
+*IvPrintDialMess2.labelString: ERROR:  Empty database.
+*IvPrintDialMess3.labelString: ERROR:  Exceeds 
+*IvPrintDialMess4.labelString: ERROR:  Could not execute print.
+*IvPrintDialMess5.labelString: ERROR:  Could not execute print.
+*IvPrintDialMess6.labelString: ERROR:  No printer.
+*IvPrintDialMess7.labelString: ERROR:  Couldn't open 
+*IvPrintDialMess8.labelString: ERROR:  No file name.
+*IvPrintDialMess9.labelString: ERROR:   Could not open file.
+*IvPrintDialMess10.labelString: ERROR:  Could not get data.
+*IvPrintDialMess11.labelString: ERROR:  Could not get data.
+*IvPrintDialMess12.labelString: Printing completed.
+
+!!------------------------------------------------
+!! Xt Component ( For Light and Material Sliders Set )
+!!------------------------------------------------
+*IvXtComponentTitle.labelString: Xt Component
+*IvTGSXtComponentTitle.labelString: TGS: Xt Component
+!!------------------------------------------------
+!! For All Sliders
+!!------------------------------------------------
+*IvSlidersMin.labelString: min
+*IvSlidersMax.labelString: max
+*IvSlidersStyle.labelString: style
+!!------------------------------------------------
+!! Light Slider Set 
+!!------------------------------------------------
+*IvLightSliderColor.labelString: COLOR
+*IvLightSliderRed.labelString: Red
+*IvLightSliderGreen.labelString: Green
+*IvLightSliderBlue.labelString: Blue
+*IvLightSliderIntensity1.labelString: INTENSITY
+*IvLightSliderIntensity2.labelString: Intensity
+!!------------------------------------------------
+!! Material Slider Set
+!!------------------------------------------------
+*IvMaterialSliderAmbient.labelString: AMBIENT
+*IvMaterialSliderAmbientRed.labelString: Ambient Red
+*IvMaterialSliderAmbientGreen.labelString: Ambient Green
+*IvMaterialSliderAmbientBleu.labelString: Ambient Blue
+*IvMaterialSliderDiffuse.labelString: DIFFUSE
+*IvMaterialSliderDiffuseRed.labelString: Diffuse Red
+*IvMaterialSliderDiffuseGreen.labelString:  Diffuse Green
+*IvMaterialSliderDiffuseBleu.labelString: Diffuse Blue
+*IvMaterialSliderSpecular.labelString: SPECULAR
+*IvMaterialSliderSpecularRed.labelString: Specular Red
+*IvMaterialSliderSpecularGreen.labelString: Specular Green
+*IvMaterialSliderSpecularBleu.labelString: Specular Blue
+*IvMaterialSliderEmissive.labelString: EMISSIVE
+*IvMaterialSliderEmissiveRed.labelString: Emissive Red
+*IvMaterialSliderEmissiveGreen.labelString: Emissive Green
+*IvMaterialSliderEmissiveBlue.labelString: Emissive Blue
+*IvMaterialSliderShininess.labelString: SHININESS
+*IvMaterialSliderShininessShininess.labelString: shininess 
+*IvMaterialSliderTransparency.labelString: TRANSPARENCY
+*IvMaterialSliderTransparencyTransparency.labelString: transparency
+!!------------------------------------------------
+!! Transform Slider Set
+!!------------------------------------------------
+*IvTransformSliderTrans.labelString: TRANSLATIONS
+*IvTransformSliderTransX.labelString: X Translation
+*IvTransformSliderTransY.labelString: Y Translation
+*IvTransformSliderTransZ.labelString: Z Translation
+*IvTransformSliderScale.labelString: SCALES
+*IvTransformSliderScaleX.labelString: X Scale
+*IvTransformSliderScaleY.labelString: Y Scale
+*IvTransformSliderScaleZ.labelString: Z Scale
+*IvTransformSliderRotate.labelString: ROTATIONS
+*IvTransformSliderRotateX.labelString: X Rotate
+*IvTransformSliderRotateY.labelString: Y Rotate
+*IvTransformSliderRotateZ.labelString: Z Rotate
+*IvTransformSliderScaleOrient.labelString: SCALE ORIENTATION
+*IvTransformSliderScaleOrientX.labelString: X Rotate
+*IvTransformSliderScaleOrientY.labelString: Y Rotate
+*IvTransformSliderScaleOrientZ.labelString: Z Rotate
+*IvTransformSliderCenter.labelString: CENTER
+*IvTransformSliderCenterX.labelString: X Center
+*IvTransformSliderCenterY.labelString: Y Center
+*IvTransformSliderCenterZ.labelString: Z Center
+*IvTransformSliderTitle.labelString: Transform Editor
+*IvTransformSliderIconTitle.labelString: Xf Editor
+
+
+!!------------------- THE END --------------------
Index: tags/visualization-10.5-before-10.6_test/test/test19_detector.macro
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/test19_detector.macro	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/test19_detector.macro	(revision 1102)
@@ -0,0 +1,17 @@
+# Use this macro file to set the detector from a list.
+# Special to test19.
+#
+# See command.
+/control/verbose 2
+# See list of possibilities.
+/test19det/detector
+# Select detector.
+#/test19det/detector 1
+#/test19det/detector 4
+#
+# ATLAS...
+#/test19det/detector 5
+#/atlas/innerDetector/pixel 1
+#/atlas/innerDetector/all 1
+# Switch off the seeing of commands.
+/control/verbose 0
Index: tags/visualization-10.5-before-10.6_test/test/test19_view.macro
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/test19_view.macro	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/test19_view.macro	(revision 1102)
@@ -0,0 +1,46 @@
+# Use this macro file to open a view and draw detector.
+# In test19, this is executed, then a normal prompt appears.
+#
+# Reflect commands to output.
+/control/verbose 2
+#
+# Set gun for demo (detector 1)
+#/gun/particle e+
+#/gun/position 0 -100 0 cm
+#/gun/direction 0 1 0
+#
+# Initialise physics and geometry.
+/init/all
+#
+# John's personal preferences
+/vis~/lights/move_with_camera true
+/vis~/set/marker_choices 1
+#
+# See list of graphics systems possibilities.
+/vis~/create_view/new_graphics_system
+#
+# Select view and draw.
+#/vis~/create_view/new_graphics_system DAWN
+#/vis~/create_view/new_graphics_system RayX
+#/vis~/create_view/new_graphics_system OGLIX
+/vis~/create_view/new_graphics_system OGLSX
+#/vis~/create_view/new_graphics_system VRML1
+#/vis~/create_view/new_graphics_system VRML1File
+#/vis~/create_view/new_graphics_system Xo
+#/vis~/create_view/new_graphics_system Wo
+#
+# G4Ray demo
+#/vis~/camera/zoom 2
+#/vis~/camera/viewpoint 20 20
+#/vis~/set/drawing_style 2
+#/vis~/create_view/new_graphics_system RayX
+#/vis~/ray/resolution 1
+#/vis~/draw/current
+#
+# Draw current scene
+/vis~/draw/current
+/vis~/show/view
+#
+# Switch off the reflecting of commands.
+/control/verbose 0
+
Index: tags/visualization-10.5-before-10.6_test/test/testshapes.cc
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/testshapes.cc	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/testshapes.cc	(revision 1102)
@@ -0,0 +1,167 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: testshapes.cc,v 1.4 2006/06/29 21:33:32 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// John Allison  Jan 1996
+
+#include "BuildShapes.hh"
+
+#include "G4VisManager.hh"
+
+#include "G4UImanager.hh"
+#include "G4UIterminal.hh"
+#include "G4UIWo.hh"
+
+#include "G4Initializer.hh"
+#include "G4RunManager.hh"
+#include "G4GeometryManager.hh"
+
+// Solve templates.
+// Code in g4templates.hh controlled by the macro G4_SOLVE_TEMPLATES
+#include "g4templates.hh"
+
+main (int argc,char** argv) {
+
+  // Set up User Interface.
+  G4UImanager* UI = G4UImanager::GetUIpointer ();
+
+  // Choose (G)UI.
+#ifdef Wo
+  if(argc==2)
+    {
+      G4UIterminal* interactor = new G4UIterminal;
+      UI -> SetSession (interactor);
+    }
+  else
+    {
+      G4UIWo*       interactor = new G4UIWo (argc,argv);
+      UI -> SetSession (interactor);
+    }
+#else
+  G4UIterminal* interactor = new G4UIterminal;
+  UI -> SetSession (interactor);
+#endif
+
+  G4VPhysicalVolume* pBox  = BuildBox ();       // 0
+  G4VPhysicalVolume* pCylinder = BuildCylinder();   // 1
+  G4VPhysicalVolume* pTubs = BuildTubs();       // 2
+  G4VPhysicalVolume* pCons = BuildCons();       // 3
+  G4VPhysicalVolume* pTrd  = BuildTrd ();       // 4
+  G4VPhysicalVolume* pTrap = BuildTrap();       // 5
+  G4VPhysicalVolume* pSphereFull = BuildSphereFull(); // 6
+  G4VPhysicalVolume* pSphereSeg  = BuildSphereSeg (); // 7
+  G4VPhysicalVolume* pPara = BuildPara();       // 8
+  G4VPhysicalVolume* pPCon = BuildPCon();       // 9
+  G4VPhysicalVolume* pPGon = BuildPGon();       // 10
+  G4VPhysicalVolume* pforcedWireframeBox = BuildForcedWireframeBox(); // 11
+
+  G4VPhysicalVolume* pGeometries [20];
+  pGeometries [0] = pBox;
+  pGeometries [1] = pCylinder;
+  pGeometries [2] = pTubs;
+  pGeometries [3] = pCons;
+  pGeometries [4] = pTrd;
+  pGeometries [5] = pTrap;
+  pGeometries [6] = pSphereFull ;
+  pGeometries [7] = pSphereSeg ;
+  pGeometries [8] = pPara ;
+  pGeometries [9] = pPCon ;
+  pGeometries [10] = pPGon ;
+  pGeometries [11] = pforcedWireframeBox ;
+
+  if (!pGeometries [0]) { return 0 ; }
+
+  // Initializer, etc.
+  G4Initializer * initializer = new G4Initializer;
+  testshapesDetectorConstruction* pDetectorConstruction
+    = new testshapesDetectorConstruction;
+  pDetectorConstruction -> SetDetector (pGeometries [0]);
+  initializer -> SetUserInitialization (pDetectorConstruction);
+  initializer -> Initialize();
+
+  // Instantiate Vis Manager.
+  G4VisManager* pVMan = G4VisManager::GetInstance ();
+
+  // Tie streams together so output is flushed before any input.
+  G4cin.tie (&G4cout);
+  // Main loop.
+  G4int iGeom;
+  do {
+    // Choose a shape.
+    do {
+      G4cout << "Choose a shape ( < 0 to quit ):\n"
+	   << "0)  Box\n"
+	   << "1)  Cylinder\n"
+	   << "2)  Tubs\n"
+	   << "3)  Cons\n"
+	   << "4)  Trd\n"
+	   << "5)  Trap\n"
+	   << "6)  Sphere (full)\n"
+	   << "7)  Sphere (segment)\n"
+	   << "8)  Pararellepiped\n"
+	   << "9)  PCon (Not implemented yet)\n"
+	   << "10) PGon (Not implemented yet)\n"
+	   << "11) Forced wireframe box\n"
+	   << G4endl;
+      G4cout << "Enter choice (< 0 to exit): ";
+      G4cin >> iGeom;  // (Protect against invalid input!!!!!!!!!!!!!!!!!!!)
+      while (G4cin.get () != '\n');  // Get newline character after G4cin >> iGS;
+      
+    } while (iGeom > 11);
+    
+    if (iGeom >= 0) {
+
+      if (pGeometries [iGeom]) {
+
+	pDetectorConstruction -> SetDetector (pGeometries [iGeom]);
+	initializer -> Initialize();
+
+	pVMan -> AddToCurrentSceneData (pGeometries [iGeom]);
+
+	// These lines temporarily removed from G4RunManager, so they're here..
+	G4cout << "Start closing geometry." << G4endl;
+	G4GeometryManager::GetInstance()->CloseGeometry();
+	G4cout << "Geometry closed. Start event processing." << G4endl;
+
+	// Enter UI command interpreter.
+	UI -> Interact ("G4Vis> ");
+      }
+      else {
+	G4cout << "Null geometry pointer."
+	  "\nMaybe you selected a not-implemented shape!"
+	     << G4endl;
+      }
+    }
+  } while ( iGeom >= 0 );
+  
+  // Ensure VisManager destructor is called.
+  delete G4VisManager::GetInstance ();
+  
+  return 0;
+}
Index: tags/visualization-10.5-before-10.6_test/test/win32.g4m
===================================================================
--- tags/visualization-10.5-before-10.6_test/test/win32.g4m	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/test/win32.g4m	(revision 1102)
@@ -0,0 +1,30 @@
+# See commands :
+/control/verbose 2
+# ATLAS = detector 5 :
+#/test19det/detector 5
+/test19det/detector 4
+# Initialize :
+/run/initialize
+# Visualization setup, solid modeling,
+# needed so that G4OpenInventor works correctly :
+/vis~/set/culling off
+/vis~/set/drawing_style 2
+/vis~/create_view/new_graphics_system OIWIN32
+# Init event for detector 4 :
+/gun/position 0 -300 0 cm
+/gun/direction 0 1 0
+#/gun/particle geantino
+/gun/particle e-
+/gun/energy 1 GeV
+#
+# Type by hand in the G4UIWin32 window :
+# ------------------------------------
+#/vis~/draw/current
+#/vis~/show/view
+#
+# To shoot an event :
+#/run/beamOn 1
+# To exit type :
+#/control/exit
+
+
Index: tags/visualization-10.5-before-10.6_test/vis-mv.mac
===================================================================
--- tags/visualization-10.5-before-10.6_test/vis-mv.mac	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/vis-mv.mac	(revision 1102)
@@ -0,0 +1,66 @@
+#
+# Macro file for the initialization phase of "exampleN03.cc"
+# when running in interactive mode
+#
+# Sets some default verbose
+#
+/control/verbose 2
+/control/saveHistory
+/run/verbose 2
+#
+# create empty scene
+#
+/vis/scene/create
+#
+# Create a scene handler for a specific graphics system
+# (Edit the next line(s) to choose another graphic system)
+#
+# Use this open statement to get an .eps and .prim files
+# suitable for viewing in DAWN.
+/vis/open DAWNFILE
+#
+# Use this open statement instead for OpenGL in immediate mode.
+/vis/open OGLIQT
+#/vis/open OGLIX
+#
+# Use this open statement instead to get a HepRep version 1 file
+# suitable for viewing in WIRED.
+#/vis/open HepRepFile
+#
+# Use this open statement instead to get a HepRep version 2 file
+# suitable for viewing in WIRED.
+#/vis/open HepRepXML
+#
+# Output an empty detector
+/vis/viewer/flush
+#
+# Draw trajectories at end of event, showing trajectory points as
+# markers of size 2 pixels
+#/vis/scene/add/trajectories
+/vis/modeling/trajectories/create/drawByCharge
+/vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true
+/vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 2
+# (if too many tracks cause core dump => /tracking/storeTrajectory 0)
+#
+# To draw gammas only
+#/vis/filtering/trajectories/create/particleFilter
+#/vis/filtering/trajectories/particleFilter-0/add gamma
+#
+# To draw charged particles only
+#/vis/filtering/trajectories/particleFilter-0/invert true
+#
+# Many other options available with /vis/modeling and /vis/filtering.
+# For example, select colour by particle ID
+#/vis/modeling/trajectories/create/drawByParticleID
+#/vis/modeling/trajectories/drawByParticleID-0/set e- red
+#
+/vis/scene/endOfEventAction accumulate
+#
+# At end of each run, an automatic flush causes graphical output.
+#/run/beamOn 1
+# When you exit Geant4, you will find a file called scene-0.heprep.zip.
+# Unzipping this will give you three separate HepRep files suitable for
+# viewing in WIRED.
+# The first file will contain just detector geometry.
+# The second file will contain the detector plus one event.
+# The third file will contain the detector plus ten events.
Index: tags/visualization-10.5-before-10.6_test/vis-simple.mac
===================================================================
--- tags/visualization-10.5-before-10.6_test/vis-simple.mac	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/vis-simple.mac	(revision 1102)
@@ -0,0 +1,66 @@
+#
+# Macro file for the initialization phase of "exampleN03.cc"
+# when running in interactive mode
+#
+# Sets some default verbose
+#
+/control/verbose 2
+/control/saveHistory
+/run/verbose 2
+#
+# create empty scene
+#
+/vis/scene/create
+#
+# Create a scene handler for a specific graphics system
+# (Edit the next line(s) to choose another graphic system)
+#
+# Use this open statement to get an .eps and .prim files
+# suitable for viewing in DAWN.
+#--- /vis/open DAWNFILE
+#
+# Use this open statement instead for OpenGL in immediate mode.
+/vis/open OGLIQT
+#/vis/open OGLIX
+#
+# Use this open statement instead to get a HepRep version 1 file
+# suitable for viewing in WIRED.
+#/vis/open HepRepFile
+#
+# Use this open statement instead to get a HepRep version 2 file
+# suitable for viewing in WIRED.
+#/vis/open HepRepXML
+#
+# Output an empty detector
+#--- /vis/viewer/flush
+#
+# Draw trajectories at end of event, showing trajectory points as
+# markers of size 2 pixels
+#/vis/scene/add/trajectories
+#--- /vis/modeling/trajectories/create/drawByCharge
+#--- /vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true
+#--- /vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 2
+# (if too many tracks cause core dump => /tracking/storeTrajectory 0)
+#
+# To draw gammas only
+#/vis/filtering/trajectories/create/particleFilter
+#/vis/filtering/trajectories/particleFilter-0/add gamma
+#
+# To draw charged particles only
+#/vis/filtering/trajectories/particleFilter-0/invert true
+#
+# Many other options available with /vis/modeling and /vis/filtering.
+# For example, select colour by particle ID
+#/vis/modeling/trajectories/create/drawByParticleID
+#/vis/modeling/trajectories/drawByParticleID-0/set e- red
+#
+#--- /vis/scene/endOfEventAction accumulate
+#
+# At end of each run, an automatic flush causes graphical output.
+#/run/beamOn 1
+# When you exit Geant4, you will find a file called scene-0.heprep.zip.
+# Unzipping this will give you three separate HepRep files suitable for
+# viewing in WIRED.
+# The first file will contain just detector geometry.
+# The second file will contain the detector plus one event.
+# The third file will contain the detector plus ten events.
Index: tags/visualization-10.5-before-10.6_test/vis.mac
===================================================================
--- tags/visualization-10.5-before-10.6_test/vis.mac	(revision 1102)
+++ tags/visualization-10.5-before-10.6_test/vis.mac	(revision 1102)
@@ -0,0 +1,67 @@
+# $Id: vis.mac,v 1.6 2007/06/13 10:36:39 maire Exp $
+#
+# Macro file for the initialization phase of "exampleN03.cc"
+# when running in interactive mode
+#
+# Sets some default verbose
+#
+/control/verbose 2
+/control/saveHistory
+/run/verbose 2
+#
+# create empty scene
+#
+/vis/scene/create
+#
+# Create a scene handler for a specific graphics system
+# (Edit the next line(s) to choose another graphic system)
+#
+# Use this open statement to get an .eps and .prim files
+# suitable for viewing in DAWN.
+###/vis/open DAWNFILE
+#
+# Use this open statement instead for OpenGL in immediate mode.
+#/vis/open OGLIX
+/vis/open OGLSQT
+#
+# Use this open statement instead to get a HepRep version 1 file
+# suitable for viewing in WIRED.
+#/vis/open HepRepFile
+#
+# Use this open statement instead to get a HepRep version 2 file
+# suitable for viewing in WIRED.
+#/vis/open HepRepXML
+#
+# Output an empty detector
+/vis/viewer/flush
+#
+# Draw trajectories at end of event, showing trajectory points as
+# markers of size 2 pixels
+/vis/scene/add/trajectories
+/vis/modeling/trajectories/create/drawByCharge
+/vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true
+/vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 2
+# (if too many tracks cause core dump => /tracking/storeTrajectory 0)
+#
+# To draw gammas only
+#/vis/filtering/trajectories/create/particleFilter
+#/vis/filtering/trajectories/particleFilter-0/add gamma
+#
+# To draw charged particles only
+#/vis/filtering/trajectories/particleFilter-0/invert true
+#
+# Many other options available with /vis/modeling and /vis/filtering.
+# For example, select colour by particle ID
+#/vis/modeling/trajectories/create/drawByParticleID
+#/vis/modeling/trajectories/drawByParticleID-0/set e- red
+#
+/vis/scene/endOfEventAction accumulate
+#
+# At end of each run, an automatic flush causes graphical output.
+#/run/beamOn 1
+# When you exit Geant4, you will find a file called scene-0.heprep.zip.
+# Unzipping this will give you three separate HepRep files suitable for
+# viewing in WIRED.
+# The first file will contain just detector geometry.
+# The second file will contain the detector plus one event.
+# The third file will contain the detector plus ten events.
