Changeset 593 for trunk/geant4


Ignore:
Timestamp:
Nov 9, 2007, 3:32:25 PM (17 years ago)
Author:
garnier
Message:

r627@mac-90108: laurentgarnier | 2007-11-09 07:57:42 +0100
modif dans les includes directives

Location:
trunk/geant4
Files:
251 edited

Legend:

Unmodified
Added
Removed
  • trunk/geant4/config/G4UI_BUILD.gmk

    r561 r593  
    1 # $Id: G4UI_BUILD.gmk,v 1.4 2003/10/17 10:17:10 gbarrand Exp $
     1# $Id: G4UI_BUILD.gmk,v 1.5 2007/10/03 12:15:05 lgarnier Exp $
    22# -------------------------------------------------------------
    33# Interfaces-specific CPPFLAGS for BUILD phase.
  • trunk/geant4/config/G4UI_USE.gmk

    r486 r593  
    1 # $Id: G4UI_USE.gmk,v 1.8 2003/10/17 10:17:10 gbarrand Exp $
     1# $Id: G4UI_USE.gmk,v 1.9 2007/10/03 12:15:05 lgarnier Exp $
    22# -------------------------------------------------------------
    33# GNUmakefile for CPPFLAGS for interfaces USE phase.
  • trunk/geant4/config/G4VIS_BUILD.gmk

    r486 r593  
    1 # $Id: G4VIS_BUILD.gmk,v 1.19 2005/10/05 17:35:40 allison Exp $
     1# $Id: G4VIS_BUILD.gmk,v 1.20 2007/10/03 12:15:05 lgarnier Exp $
    22# -------------------------------------------------------------
    33# Visualization-specific CPPFLAGS for BUILD phase.
  • trunk/geant4/config/G4VIS_USE.gmk

    r574 r593  
    1 # $Id: G4VIS_USE.gmk,v 1.22 2005/10/05 17:35:40 allison Exp $
     1# $Id: G4VIS_USE.gmk,v 1.23 2007/10/03 12:15:05 lgarnier Exp $
    22# -------------------------------------------------------------
    33# GNUmakefile for CPPFLAGS for visualization USE phase.
  • trunk/geant4/config/History

    r483 r593  
    1 $Id: History,v 1.288 2006/11/30 15:47:16 gcosmo Exp $
     1$Id: History,v 1.300 2007/08/16 09:34:51 gcosmo Exp $
    22-------------------------------------------------------------------
    33
     
    1616     * Reverse chronological order (last date on top), please *
    1717     ----------------------------------------------------------
     18
     1916th August 2007  Gabriele Cosmo (config-V09-00-04)
     20- Corrected definition of OUT internal variable to allow for proper
     21  linking also of unit tests.
     22
     2315th August 2007  Gabriele Cosmo (config-V09-00-03)
     24- Added "rpg" hadronic model module to binmake.gmk.
     25
     2613th August 2007  Gabriele Cosmo (config-V09-00-02)
     27- SUN-CC.gmk: forced -xO2 as optimisation level.
     28
     2918th July 2007  Gabriele Cosmo (config-V09-00-01)
     30- liblist.c: fixed problem affecting recent CygWin installations on
     31  Windows in parsing the buffer for the generation of libname.map.
     32- binmake.gmk: defined OUT internal variable specifying the proper
     33  compilation/linking option to Unix or Windows compilers: '-o '
     34  and '/Fe' respectively.
     35
     3611th July 2007  Makoto Asai (config-V09-00-00)
     37- Added digits_hits/scorer sub-directory to binmake.gmk.
     38
     3928th June 2007  Gabriele Cosmo (config-V08-03-04)
     40- Updated Configure scripts to fix installation issue when installation
     41  path is different from source path and headers are not installed.
     42- Cleared <TAB> characters from .gmk scripts where not necessary.
     43
     4422nd June 2007  Gabriele Cosmo (config-V08-03-03)
     45- Corrected binmake.gmk for having error_propagation in INCFLAGS properly
     46  included in search path.
     47- Updated internal scripts for Configure to cope with new environment
     48  variable G4NEUTRONHPDATA.
     49
     5018th June 2007  Ben Morgan (config-V08-03-02)
     51- Fixed Configure internal script to get rid of searching old physics_list
     52  module at installation.
     53
     5427th May 2007  Gabriele Cosmo (config-V08-03-01)
     55- Added "lll_fission" hadronic model module to binmake.gmk.
     56
     5712th May 2007  Gabriele Cosmo (config-V08-03-00)
     58- Added "error_propagation" module to binmake.gmk.
     59- Removed G4LIB_BUILD_LISTS flag. Physics lists are built by default.
     60
     6121st March 2007  Gabriele Cosmo
     62- Added "biasing" module to binmake.gmk.
     63
     6428th February 2007  Gabriele Cosmo (config-V08-02-00)
     65- Protected generation of dependencies using internal 'make' variable
     66  MAKECMDGOALS in binmake.gmk and common.gmk, following suggestion made
     67  in problem report #930.
     68  This protection resolves the problem of generation of dependencies when
     69  issueing the 'clean' target.
    1870
    19713rd November 2006  Gunter Folger (config-V08-01-07)
  • trunk/geant4/config/architecture.gmk

    r483 r593  
    1 # $Id: architecture.gmk,v 1.107 2006/10/31 11:35:43 gunter Exp $
     1# $Id: architecture.gmk,v 1.110 2007/06/28 14:16:55 gcosmo Exp $
    22# ------------------------------------------------------------------------
    33#       GEANT 4 - Architecture configuration script for GNU Make
     
    1414# the environment variable G4SYSTEM:
    1515#
    16 #          Linux-g++   Linux (Red Hat Enterprise/SCL3), gcc-3.2.3 (default)
    17 #
    18 #          SUN-CC      SunOS 5.8, CC 5.4
    19 #
    20 #          WIN32-VC    Windows/XP and Microsoft Visual C++ 7.1 .NET
     16#          Linux-g++   Linux (Red Hat Enterprise/SCL4), gcc-3.4.6 (default)
     17#
     18#          SUN-CC      SunOS 5.8, CC 5.5
     19#
     20#          WIN32-VC    Windows/XP and Microsoft Visual C++ 8.0
    2121#                      Adding CYGWIN32 tools
    2222# -------------------------------------------------------------------------
     
    5252endif
    5353G4DUMMY_VARIABLE:=$(shell [ ! -d $(G4TMP) ] && mkdir -p $(G4TMP) )
    54        
     54
    5555# If not specified, the default path for G4 libraries G4LIB is
    5656# set to $G4INSTALL/lib/$G4SYSTEM ...
     
    111111  G4LIB_BUILD_ZLIB = 1
    112112  G4LIB_USE_ZLIB = 1
    113 endif
    114 
    115 # Allow to disable building of physics_lists module. Default is to build these
    116 #
    117 ifneq ($(G4LIB_BUILD_LISTS),NO)
    118   G4LIB_BUILD_LISTS = 1
    119113endif
    120114
     
    305299  OGLFLAGS:= $(filter-out -I/usr//include,$(OGLFLAGS))
    306300endif
    307        
    308        
     301
    309302# If there is no cbrt() function...
    310303#
  • trunk/geant4/config/binmake.gmk

    r483 r593  
    1 # $Id: binmake.gmk,v 1.116 2006/11/08 16:52:19 gunter Exp $
     1# $Id: binmake.gmk,v 1.129 2007/08/16 09:46:02 gcosmo Exp $
    22# ----------------------------------------------------------
    33# Script defining rules and paths for making binaries.
     
    6161              -I$(G4BASE)/particles/hadrons/mesons/include \
    6262              -I$(G4BASE)/particles/shortlived/include \
    63               -I$(G4BASE)/physics_lists/lists/include \
    64               -I$(G4BASE)/physics_lists/builders/include \
     63              -I$(G4BASE)/physics_lists/lists/include \
     64              -I$(G4BASE)/physics_lists/builders/include \
    6565              -I$(G4BASE)/processes/management/include \
    6666              -I$(G4BASE)/processes/cuts/include \
     67              -I$(G4BASE)/processes/biasing/include \
    6768              -I$(G4BASE)/processes/scoring/include \
    6869              -I$(G4BASE)/processes/decay/include \
     
    7879              -I$(G4BASE)/processes/electromagnetic/polarisation/include \
    7980              -I$(G4BASE)/processes/hadronic/cross_sections/include \
    80               -I$(G4BASE)/processes/hadronic/management/include \
    81               -I$(G4BASE)/processes/hadronic/models/abrasion/include \
     81              -I$(G4BASE)/processes/hadronic/management/include \
     82              -I$(G4BASE)/processes/hadronic/models/abrasion/include \
    8283              -I$(G4BASE)/processes/hadronic/models/binary_cascade/include \
    83               -I$(G4BASE)/processes/hadronic/models/cascade/cascade/include \
    84               -I$(G4BASE)/processes/hadronic/models/cascade/evaporation/include \
    85               -I$(G4BASE)/processes/hadronic/models/cascade/utils/include \
     84              -I$(G4BASE)/processes/hadronic/models/cascade/cascade/include \
     85              -I$(G4BASE)/processes/hadronic/models/cascade/evaporation/include \
     86              -I$(G4BASE)/processes/hadronic/models/cascade/utils/include \
    8687              -I$(G4BASE)/processes/hadronic/models/chiral_inv_phase_space/body/include \
    8788              -I$(G4BASE)/processes/hadronic/models/chiral_inv_phase_space/interface/include \
    8889              -I$(G4BASE)/processes/hadronic/models/coherent_elastic/include \
    89               -I$(G4BASE)/processes/hadronic/models/de_excitation/ablation/include \
     90              -I$(G4BASE)/processes/hadronic/models/de_excitation/ablation/include \
    9091              -I$(G4BASE)/processes/hadronic/models/de_excitation/evaporation/include \
    9192              -I$(G4BASE)/processes/hadronic/models/de_excitation/fermi_breakup/include \
    92               -I$(G4BASE)/processes/hadronic/models/de_excitation/fission/include \
     93              -I$(G4BASE)/processes/hadronic/models/de_excitation/fission/include \
    9394              -I$(G4BASE)/processes/hadronic/models/de_excitation/gem_evaporation/include \
    9495              -I$(G4BASE)/processes/hadronic/models/de_excitation/handler/include \
     
    104105              -I$(G4BASE)/processes/hadronic/models/isotope_production/include \
    105106              -I$(G4BASE)/processes/hadronic/models/leading_particle/include \
     107              -I$(G4BASE)/processes/hadronic/models/lll_fission/include \
    106108              -I$(G4BASE)/processes/hadronic/models/low_energy/include \
    107109              -I$(G4BASE)/processes/hadronic/models/management/include \
     
    118120              -I$(G4BASE)/processes/hadronic/models/relativistic_qmd/include \
    119121              -I$(G4BASE)/processes/hadronic/models/relativistic_qmd/uplusplus/include \
     122              -I$(G4BASE)/processes/hadronic/models/rpg/include \
    120123              -I$(G4BASE)/processes/hadronic/models/theo_high_energy/include \
    121124              -I$(G4BASE)/processes/hadronic/models/util/include \
     
    138141              -I$(G4BASE)/digits_hits/hits/include \
    139142              -I$(G4BASE)/digits_hits/digits/include \
     143              -I$(G4BASE)/digits_hits/scorer/include \
    140144              -I$(G4BASE)/digits_hits/utils/include \
    141145              -I$(G4BASE)/persistency/include \
    142146              -I$(G4BASE)/readout/include \
    143147              -I$(G4BASE)/event/include \
     148              -I$(G4BASE)/error_propagation/include \
    144149              -I$(G4BASE)/graphics_reps/include \
    145150              -I$(G4BASE)/intercoms/include
     
    207212  endif
    208213
    209   LDLIBS2 += -lG4readout
    210 
    211   ifeq ($(G4LIB_BUILD_LISTS),1)
    212     LDLIBS2 += -lG4physicslists
    213   endif
    214    
    215   LDLIBS2 += -lG4run \
     214  LDLIBS2 += -lG4error_propagation \
     215             -lG4readout \
     216             -lG4physicslists \
     217             -lG4run \
    216218             -lG4event \
    217219             -lG4tracking \
    218              -lG4parmodels \
     220             -lG4parmodels \
    219221             -lG4processes \
    220222             -lG4digits_hits \
     
    232234    LDLIBS2 = $(shell \
    233235        G4TMP=$(G4TMP); export G4TMP; \
    234         if [ \( -f $(G4LIB)/$(G4SYSTEM)/liblist \
    235           -a -f $(G4LIB)/$(G4SYSTEM)/libname.map \) ]; then \
    236         $(G4LIB)/$(G4SYSTEM)/liblist \
    237           -m $(G4LIB)/$(G4SYSTEM) \
    238           < $(G4LIB)/$(G4SYSTEM)/libname.map; fi)
     236        if [ \( -f $(G4LIB)/$(G4SYSTEM)/liblist \
     237          -a -f $(G4LIB)/$(G4SYSTEM)/libname.map \) ]; then \
     238        $(G4LIB)/$(G4SYSTEM)/liblist \
     239          -m $(G4LIB)/$(G4SYSTEM) \
     240          < $(G4LIB)/$(G4SYSTEM)/libname.map; fi)
    239241  else
    240242    LDLIBS2 = $(shell \
    241243        G4TMP=$(G4TMP); export G4TMP; \
    242         if [ \( -f $(G4LIB)/$(G4SYSTEM)/liblist \
    243           -a -f $(G4LIB)/$(G4SYSTEM)/libname.map \) ]; then \
    244         $(G4LIB)/$(G4SYSTEM)/liblist \
    245           -d $(G4TMPDIR) \
    246           < $(G4LIB)/$(G4SYSTEM)/libname.map; fi)
     244        if [ \( -f $(G4LIB)/$(G4SYSTEM)/liblist \
     245          -a -f $(G4LIB)/$(G4SYSTEM)/libname.map \) ]; then \
     246        $(G4LIB)/$(G4SYSTEM)/liblist \
     247          -d $(G4TMPDIR) \
     248          < $(G4LIB)/$(G4SYSTEM)/libname.map; fi)
    247249# Warning: do not add to LDLIBS2 with += because this causes it to be
    248250# expanded too soon.  Hence extra libraries must have a different name...
     
    283285
    284286ifneq (,$(findstring WIN32-VC,$(G4SYSTEM)))
     287  # Windows
    285288  WIN32TMP := $(patsubst -L%,$(LIB_PATH)%,$(LDFLAGS))
    286289  LDFLAGS  = $(patsubst /,$(PATH_DEL),$(WIN32TMP))
     
    292295        LDLIBS = $(TARGETLIB) $(patsubst -l%,lib%.a,$(WIN32TMP3)) $(patsubst -l%,lib%.lib,$(WIN32TMP4))
    293296    else
    294         LDLIBS = $(TARGETLIB) $(patsubst -l%,lib%.lib,$(WIN32TMP2))
     297        LDLIBS = $(TARGETLIB) $(patsubst -l%,lib%.lib,$(WIN32TMP2))
    295298    endif
    296299  else
    297         LDLIBS = $(TARGETLIB) $(patsubst -l%,lib%.a,$(WIN32TMP2))
    298   endif
    299 else
     300    LDLIBS = $(TARGETLIB) $(patsubst -l%,lib%.a,$(WIN32TMP2))
     301  endif
     302  OUT   := /Fe
     303else
     304  # Unix
    300305  LDLIBS = $(TARGETLIB) $(LDLIBS_PREFINAL)
     306  OUT   := -o
    301307endif
    302308
     
    305311include $(G4INSTALL)/config/sys/$(G4SYSTEM)-runpath.gmk
    306312endif
    307        
     313
    308314sources := $(wildcard $(G4TARGET).cc)
    309315objects := $(patsubst %.cc,$(G4TMPDIR)/exe/%.$(TARGOBJEXT),$(sources))
     
    340346ifdef CPPVERBOSE
    341347        $(CXX) $(CXXFLAGS) $(CPPFLAGS) \
    342           -o $(G4BINDIR)/$(G4TARGET) $(objects) $(LDFLAGS) \
     348          $(OUT)$(G4BINDIR)/$(G4TARGET) $(objects) $(LDFLAGS) \
    343349          $(LDLIBS)
    344350else
    345351        @echo Linking $(G4TARGET) ...
    346352        @$(CXX) $(CXXFLAGS) $(CPPFLAGS) \
    347           -o $(G4BINDIR)/$(G4TARGET) $(objects) $(LDFLAGS) \
     353          $(OUT)$(G4BINDIR)/$(G4TARGET) $(objects) $(LDFLAGS) \
    348354          $(LDLIBS)
    349355        @if [ \( -f $(G4BINDIR)/$(G4TARGET) \) ]; then \
     
    402408        [ -s $@ ] || rm -f $@
    403409ifneq ($(dependencies),)
     410ifneq ($(MAKECMDGOALS),clean)
    404411-include $(dependencies)
     412endif
    405413endif
    406414
  • trunk/geant4/config/common.gmk

    r472 r593  
    1 # $Id: common.gmk,v 1.41 2005/12/07 09:41:54 gcosmo Exp $
     1# $Id: common.gmk,v 1.43 2007/06/28 14:33:38 gcosmo Exp $
    22# ----------------------------------------------------------------
    33# Common part of GNUmakefile for libraries.  John Allison, 5/7/95.
     
    111111        [ -s $@ ] || rm -f $@
    112112ifneq ($(dependencies),)
     113ifneq ($(MAKECMDGOALS),clean)
    113114-include $(dependencies)
     115endif
    114116endif
    115117
     
    122124# NOTE: the double colon rule allows to add other rules for the same target
    123125#
    124 includes::      $(installed_includes)
     126includes:: $(installed_includes)
    125127
    126128# Static Pattern rules, see GNU make manual for details.
    127 #           target(s): target-pattern : dep-pattern     
     129#           target(s): target-pattern : dep-pattern
    128130#
    129131$(installed_includes): $(G4INCLUDE)/% : include/%
  • trunk/geant4/config/liblist.c

    r483 r593  
    1 /* $Id: liblist.c,v 1.18 2006/10/05 14:22:06 gcosmo Exp $ */
     1/* $Id: liblist.c,v 1.19 2007/07/18 14:21:15 gcosmo Exp $ */
    22
    33/*
     
    304304#if defined ( _WIN32 ) || defined ( __CYGWIN__ ) || defined ( __CYGWIN32__ )
    305305      ptr=strchr(ntg4tmp1,':');
    306       if ( ptr ) *(ptr+1)='\0';
    307306
    308307      while ( ptr=strchr(buffer,'\\') ) *ptr='/';
  • trunk/geant4/config/scripts/env.csh.SH

    r483 r593  
    3838unsetenv  G4LEDATA
    3939unsetenv  G4LEVELGAMMADATA
    40 unsetenv  NeutronHPCrossSections
     40unsetenv  G4NEUTRONHPDATA
    4141unsetenv  G4RADIOACTIVEDATA
    4242
     
    141141#+
    142142if ( X$g4neutronhpcrosssections != X ) then
    143 setenv NeutronHPCrossSections "$g4neutronhpcrosssections"
    144 echo "On this machine the NeutronHPCrossSections=\$NeutronHPCrossSections"
     143setenv G4NEUTRONHPDATA "$g4neutronhpcrosssections"
     144echo "On this machine the G4NEUTRONHPDATA=\$G4NEUTRONHPDATA"
    145145endif
    146146
  • trunk/geant4/config/scripts/env.sh.SH

    r483 r593  
    3838unset  G4LEDATA
    3939unset  G4LEVELGAMMADATA
    40 unset  NeutronHPCrossSections
     40unset  G4NEUTRONHPDATA
    4141unset  G4RADIOACTIVEDATA
    4242
     
    164164#+
    165165if [ X$g4neutronhpcrosssections != X ] ; then
    166 NeutronHPCrossSections="$g4neutronhpcrosssections"
    167 export NeutronHPCrossSections
    168 if [ X\$g4non_display = X ] ; then
    169 echo "On this machine the NeutronHPCrossSections=\$NeutronHPCrossSections"
     166G4NEUTRONHPDATA="$g4neutronhpcrosssections"
     167export G4NEUTRONHPDATA
     168if [ X\$g4non_display = X ] ; then
     169echo "On this machine the G4NEUTRONHPDATA=\$G4NEUTRONHPDATA"
    170170fi
    171171fi
     
    618618if [ $G4WORKDIR ] ; then
    619619
    620 if [ X$g4non_display = X ] ; then
     620if [ X\$g4non_display = X ] ; then
    621621echo "In your environment you have the G4WORKDIR=$G4WORKDIR"
    622622fi
     
    627627if test "X$G4SYSTEM" = "XWIN32-VC" -o "X$G4SYSTEM" = "XWIN32-VC7"; then
    628628
    629 if [ X$g4non_display = X ] ; then
     629if [ X\$g4non_display = X ] ; then
    630630echo "G4WORKDIR will be set to c:/geant4 (in "native" Windows syntax)"
    631631fi
     
    636636else # if Unix
    637637
    638 if [ X$g4non_display = X ] ; then
     638if [ X\$g4non_display = X ] ; then
    639639echo "G4WORKDIR will be set to HOME/geant4=$HOME/geant4"
    640640fi
     
    657657# Warning about LD_LIBRARY_PATH
    658658#
    659 if [ X$g4non_display = X ] ; then
    660659echo ''
    661660echo 'LD_LIBRARY_PATH is set to include CLHEP and Geant4 libraries. '
     
    667666echo 'present in your system !'
    668667echo ''
    669 fi
    670668
    671669if [ $LD_LIBRARY_PATH ] ; then
  • trunk/geant4/config/scripts/install.sh.SH

    r483 r593  
    3838unset  G4LEDATA
    3939unset  G4LEVELGAMMADATA
    40 unset  NeutronHPCrossSections
     40unset  G4NEUTRONHPDATA
    4141unset  G4RADIOACTIVEDATA
    4242
     
    145145#+
    146146if [ X$g4neutronhpcrosssections != X ] ; then
    147 NeutronHPCrossSections="$g4neutronhpcrosssections"
    148 export NeutronHPCrossSections
    149 echo "On this machine the NeutronHPCrossSections=\$NeutronHPCrossSections"
     147G4NEUTRONHPDATA="$g4neutronhpcrosssections"
     148export G4NEUTRONHPDATA
     149echo "On this machine the G4NEUTRONHPDATA=\$G4NEUTRONHPDATA"
    150150fi
    151151
  • trunk/geant4/config/scripts/move.sh.SH

    r483 r593  
    9090#+
    9191if [ X$g4neutronhpcrosssections != X ] ; then
    92 NeutronHPCrossSections="$g4neutronhpcrosssections"
    93 export NeutronHPCrossSections
    94 echo "On this machine the NeutronHPCrossSections=\$NeutronHPCrossSections"
     92G4NEUTRONHPDATA="$g4neutronhpcrosssections"
     93export G4NEUTRONHPDATA
     94echo "On this machine the G4NEUTRONHPDATA=\$G4NEUTRONHPDATA"
    9595fi
    9696
     
    385385echo ""
    386386mkdir -p $g4final_install/src/geant4/
    387 tar cf - Configure config/ source/ environments/ physics_lists/ examples/ |(cd $g4final_install/src/geant4/; tar xf -)
     387tar cf - Configure config/ source/ environments/ examples/ include/ |(cd $g4final_install/src/geant4/; tar xf -)
    388388fi
    389389fi
     
    399399
    400400mkdir -p $g4final_install/src/geant4/
    401 tar cf - Configure config/ source/ environments/ physics_lists/ examples/ |(cd $g4final_install/src/geant4/; tar xf -)
     401tar cf - Configure config/ source/ environments/ examples/ |(cd $g4final_install/src/geant4/; tar xf -)
    402402fi
    403403
  • trunk/geant4/config/sys/Darwin-g++.gmk

    r592 r593  
    4343#   XMFLAGS   := -I/usr/X11R6/include          ##### some installations.
    4444  endif
    45   ifndef QTFLAGS
    46     QTHOME    := /usr/local/Qt/4.2.2
    47 #    QTFLAGS   := -I$(QTHOME)/lib/QtCore.framework/Versions/Current/Headers -I$(QTHOME)/lib/QtGui.framework/Versions/Current/Headers -I$(QTHOME)/lib/QtOpenGL.framework/Versions/Current/Headers -I$(QTHOME)/lib/QtSql.framework/Versions/Current/Headers -I$(QTHOME)/lib/QtXml.framework/Versions/Current/Headers -F$(QTHOME)/lib
    48     QTFLAGS   := -I$(QTHOME)/include/Qt -F$(QTHOME)/lib
    49     MOC       := $(QTHOME)/bin/moc
    50   endif
    5145  ifndef XMLIBS
    5246    XMLIBS    := -L/sw/lib -lXm -lXpm
    5347#   XMLIBS    := -L/usr/X11R6/lib -lXm -lXpm   ##### some installations.
    5448  endif
     49  ifndef QTHOME
     50    QTHOME  := /sw
     51  endif
     52  ifndef QTFLAGS
     53    QTFLAGS   := -I$(QTHOME)/include
     54    QTFLAGS   += -I$(QTHOME)/lib/QtCore.framework/Versions/Current/Headers
     55    QTFLAFS   += -I$(QTHOME)/lib/QtGui.framework/Versions/Current/Headers
     56    QTFLAGS   += -I$(QTHOME)/lib/QtOpenGL.framework/Versions/Current/Headers
     57    QTFLAGS   += -I$(QTHOME)/lib/QtSql.framework/Versions/Current/Headers
     58    QTFLAGS   += -I$(QTHOME)/lib/QtXml.framework/Versions/Current/Headers
     59    MOC       := $(QTHOME)/bin/moc
     60  endif
    5561  ifndef QTLIBS
    56     QTHOME    := /usr/local/Qt/4.2.2
    57     QTLIBS    := -F$(QTHOME)/lib -framework QtCore -framework QtGui -framework QtOpenGL -framework QtSql -framework QtXml
     62    QTLIBS    := -F$(QTHOME)/lib -framework QtCore -framework QtGui
     63    QTLIBS    += -framework QtOpenGL -framework QtSql -framework QtXml
    5864  endif
    5965  ifndef XAWFLAGS
  • trunk/geant4/config/sys/SUN-CC.gmk

    r472 r593  
    55  CXX       := CC
    66  ifdef G4OPTIMISE
    7     CXXFLAGS  := -O
     7    CXXFLAGS  := -xO2
    88  else
    99    ifdef G4DEBUG
  • trunk/geant4/interfaces/GAG/include/G4UIGAG.hh

    r483 r593  
    2626//
    2727// $Id: G4UIGAG.hh,v 1.7 2006/06/29 19:09:18 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030// G4UIGAG.hh
  • trunk/geant4/interfaces/GAG/include/G4UIGainServer.hh

    r483 r593  
    2626//
    2727// $Id: G4UIGainServer.hh,v 1.5 2006/06/29 19:09:21 gunter Exp $
    28 // $Name: geant4-08-01-patch-01 $
     28// $Name: geant4-09-00-ref-01 $
    2929//
    3030
  • trunk/geant4/interfaces/GAG/src/G4UIGAG.cc

    r483 r593  
    2626//
    2727// $Id: G4UIGAG.cc,v 1.18 2006/06/29 19:09:23 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030// G4UIGAG.cc
  • trunk/geant4/interfaces/GAG/src/G4UIGainServer.cc

    r483 r593  
    2727// 12/06/2002 G4UIGainServer H. MInamimoto and H. Yoshida created
    2828// $Id: G4UIGainServer.cc,v 1.10 2006/06/29 19:09:25 gunter Exp $
    29 // $Name: geant4-08-01-patch-01 $
     29// $Name: geant4-09-00-ref-01 $
    3030//
    3131#ifndef WIN32
  • trunk/geant4/interfaces/History

    r476 r593  
    1 $Id: History,v 1.78 2005/11/28 18:20:20 gcosmo Exp $
     1$Id: History,v 1.82 2007/06/19 10:38:28 gcosmo Exp $
    22-------------------------------------------------------------------
    33
     
    1818     ----------------------------------------------------------
    1919
     2019 June 2007, Gabriele Cosmo (interfaces-V08-03-02)
     21- Fix compilation error on Windows ('theShell' not declared).
     22
     2314 June 2007, Koichi Murakami (interfaces-V08-03-01)
     24- fixed the problem with Ctl-C termination for bash users.
     25 * G4VUIshell   : add a virtual method ResetTerminal()
     26 * G4UItcsh     : add a method ResetTerminal()
     27 * G4UIterminal : add terminal reset when Ctl-C termination
     28
     2922 May 2007, Koichi Murakami (interface-V08-03-00)
     30- G4UIterminal.cc: implement signal handler for soft-abort
     31
    203228 November 2005, Gabriele Cosmo (interface-V07-01-02)
    2133- G4UIXm.cc migrated to sstream
  • trunk/geant4/interfaces/basic/GNUmakefile

    r494 r593  
    1 # $Id: GNUmakefile,v 1.2 2005/01/26 08:50:58 gcosmo Exp $
     1# $Id: GNUmakefile,v 1.3 2007/05/21 07:30:33 kmura Exp $
    22# -------------------------------------------------------------
    33# GNUmakefile for interfaces/basic library.  John Allison, 6/7/98.
    4 
    5 #ifdef G4UI_USE_QT
    6 # This is not  good solution, we have to 'make' twice, but it works...
    7 #moc :
    8 #       @$(MOC) -DG4UI_USE_QT include/G4UIQt.hh -o src/G4UIQt_moc.cc
    9 #endif
    104
    115name := G4UIbasic
     
    2216CPPFLAGS += -I$(G4BASE)/interfaces/common/include
    2317CPPFLAGS += -I$(G4BASE)/intercoms/include
    24 
    25 
     18CPPFLAGS += -I$(G4BASE)/global/management/include \
     19            -I$(G4BASE)/global/HEPRandom/include \
     20            -I$(G4BASE)/global/HEPGeometry/include \
     21            -I$(G4BASE)/run/include \
     22            -I$(G4BASE)/event/include \
     23            -I$(G4BASE)/track/include \
     24            -I$(G4BASE)/tracking/include \
     25            -I$(G4BASE)/particles/management/include \
     26            -I$(G4BASE)/processes/management/include \
     27            -I$(G4BASE)/processes/cuts/include \
     28            -I$(G4BASE)/processes/electromagnetic/utils/include \
     29            -I$(G4BASE)/processes/transportation/include \
     30            -I$(G4BASE)/processes/decay/include \
     31            -I$(G4BASE)/materials/include \
     32            -I$(G4BASE)/geometry/management/include \
     33            -I$(G4BASE)/geometry/volumes/include \
     34            -I$(G4BASE)/geometry/navigation/include \
     35            -I$(G4BASE)/geometry/magneticfield/include \
     36            -I$(G4BASE)/geometry/biasing/include \
     37            -I$(G4BASE)/digits_hits/detector/include \
     38            -I$(G4BASE)/digits_hits/hits/include \
     39            -I$(G4BASE)/digits_hits/digits/include \
     40            -I$(G4BASE)/interfaces/common/include \
     41            -I$(G4BASE)/interfaces/basic/include \
     42            -I$(G4BASE)/intercoms/include \
     43            -I$(G4BASE)/graphics_reps/include
    2644
    2745include $(G4INSTALL)/config/common.gmk
     46
  • trunk/geant4/interfaces/basic/include/G4UIArrayString.hh

    r483 r593  
    2626//
    2727// $Id: G4UIArrayString.hh,v 1.3 2006/06/29 19:09:27 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030
  • trunk/geant4/interfaces/basic/include/G4UIQt.hh

    r577 r593  
    2525//
    2626//
    27 // $Id: G4UIQt.hh,v 1.13 2006/06/29 19:09:33 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01 $
     27// $Id: G4UIQt.hh,v 1.2 2007/11/08 17:00:09 lgarnier Exp $
     28// GEANT4 tag $Name: $
    2929//
    3030#ifndef G4UIQt_h
     
    3838#include "G4VInteractiveSession.hh"
    3939
    40 #include <QtGui/qmainwindow.h>
    41 #include <QtGui/qlineedit.h>
    42 #include <QtGui/qlistwidget.h>
    43 #include <QtGui/qtextedit.h>
    44 #include <QtGui/qlabel.h>
    45 #include <QtGui/qtreewidget.h>
    46 #include <QSignalMapper.h>
    47 #include <QObject>
     40#include <QtCore/QObject>
    4841
     42class QMainWindow;
     43class QLineEdit;
    4944class G4UIsession;
    50 
     45class QListWidget;
     46class QTextEdit;
     47class QLabel;
     48class QDialog;
     49class QTreeWidgetItem;
     50class QTreeWidget;
    5151
    5252// Class description :
  • trunk/geant4/interfaces/basic/include/G4UIWin32.hh

    r483 r593  
    2626//
    2727// $Id: G4UIWin32.hh,v 1.14 2006/06/29 19:09:29 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030#ifndef G4UIWin32_h
  • trunk/geant4/interfaces/basic/include/G4UIXaw.hh

    r483 r593  
    2626//
    2727// $Id: G4UIXaw.hh,v 1.6 2006/06/29 19:09:31 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030#ifndef G4UIXaw_h
  • trunk/geant4/interfaces/basic/include/G4UIXm.hh

    r483 r593  
    2626//
    2727// $Id: G4UIXm.hh,v 1.13 2006/06/29 19:09:33 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030#ifndef G4UIXm_h
  • trunk/geant4/interfaces/basic/include/G4UIcsh.hh

    r483 r593  
    2626//
    2727// $Id: G4UIcsh.hh,v 1.4 2006/06/29 19:09:35 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030
  • trunk/geant4/interfaces/basic/include/G4UItcsh.hh

    r483 r593  
    2525//
    2626//
    27 // $Id: G4UItcsh.hh,v 1.7 2006/06/29 19:09:37 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     27// $Id: G4UItcsh.hh,v 1.8 2007/06/14 05:44:58 kmura Exp $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030
     
    4040#include "G4UIcommandTree.hh"
    4141
    42 //
     42// ====================================================================
    4343//   Description:
    4444//   This class gives tcsh-like shell.
     
    6868//   %h ... history# (different from G4 history#)
    6969//
     70// ====================================================================
    7071
    7172class G4UItcsh : public G4VUIshell {
     
    125126  void SetLsColor(TermColorIndex dirColor, TermColorIndex cmdColor);
    126127  virtual G4String GetCommandLine(const char* msg=0);
     128
     129  virtual void ResetTerminal();
    127130};
    128131
     132// ====================================================================
     133//   inline functions
     134// ====================================================================
    129135inline G4bool G4UItcsh::IsCursorLast() const
    130136{
  • trunk/geant4/interfaces/basic/include/G4UIterminal.hh

    r483 r593  
    2424// ********************************************************************
    2525//
     26// $Id: G4UIterminal.hh,v 1.10 2007/05/22 01:51:05 kmura Exp $
     27// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2628//
    27 // $Id: G4UIterminal.hh,v 1.9 2006/06/29 19:09:39 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
    29 //
    30 
    31 #ifndef G4UIterminal_h
    32 #define G4UIterminal_h 1
    33 
    34 #include <fstream>
    35 #include "G4UImanager.hh"
    36 #include "G4VBasicShell.hh"
    37 #include "G4VUIshell.hh"
    38 
     29// ====================================================================
     30//   G4UIterminal.cc
    3931//
    4032//   Description:
     
    6961//
    7062//   For more detail, see source codes.
    71 //
     63// ====================================================================
     64#ifndef G4UIterminal_h
     65#define G4UIterminal_h 1
     66
     67#include <fstream>
     68#include "G4UImanager.hh"
     69#include "G4VBasicShell.hh"
     70#include "G4VUIshell.hh"
    7271
    7372class G4UIterminal : public G4VBasicShell {
     
    8281
    8382public:
    84   G4UIterminal(G4VUIshell* aShell=0);
     83  G4UIterminal(G4VUIshell* aShell=0, G4bool qsig=true);
    8584  ~G4UIterminal();
    8685
  • trunk/geant4/interfaces/basic/include/G4VUIshell.hh

    r483 r593  
    2525//
    2626//
    27 // $Id: G4VUIshell.hh,v 1.6 2006/06/29 19:09:41 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     27// $Id: G4VUIshell.hh,v 1.7 2007/06/14 05:44:58 kmura Exp $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030
     
    3434#include "globals.hh"
    3535
    36 //
     36// ====================================================================
    3737//   Description:
    3838//   This class is the abstract base class for various UI shells.
     
    5050//   %/ ... current working directory
    5151//
     52// ====================================================================
    5253
    5354// terminal color index
     
    9596  // get command string from a command line
    9697  virtual G4String GetCommandLine(const char* msg=0)= 0;
     98
     99  virtual void ResetTerminal();
    97100};
    98101
    99 
    100 // inlines...
     102// ====================================================================
     103//   inline functions
     104// ====================================================================
    101105inline void G4VUIshell::SetNColumn(G4int ncol)
    102106{
  • trunk/geant4/interfaces/basic/src/G4UIArrayString.cc

    r483 r593  
    2626//
    2727// $Id: G4UIArrayString.cc,v 1.8 2006/06/29 19:09:43 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030
  • trunk/geant4/interfaces/basic/src/G4UIQt.cc

    r579 r593  
    2525//
    2626//
    27 // $Id: G4UIQt.cc,v 1.14 2007/05/29 11:09:49 $
    28 // GEANT4 tag $Name: geant4-08-01 $
     27// $Id: G4UIQt.cc,v 1.3 2007/11/08 17:00:09 lgarnier Exp $
     28// GEANT4 tag $Name: $
    2929//
    3030// L. Garnier
     
    4646#include "G4Qt.hh"
    4747
    48 #include <QtGui/qapplication.h>
    49 #include <QtGui/qwidget.h>
    50 #include <QtGui/qmenu.h>
    51 #include <QtGui/qmenubar.h>
    52 #include <QtGui/qboxlayout.h>
    53 #include <QtGui/qpushbutton.h>
    54 #include <QtGui/qlabel.h>
    55 #include <QtGui/qsplitter.h>
    56 #include <QtGui/qscrollbar.h>
    57 #include <QtGui/qdialog.h>
    58 #include <QtGui/qevent.h>
     48#include <QtGui/QApplication.h>
     49#include <QtGui/QMainWindow.h>
     50#include <QtGui/QLineEdit.h>
     51#include <QtGui/QWidget.h>
     52#include <QtGui/QMenu.h>
     53#include <QtGui/QMenuBar.h>
     54#include <QtGui/QBoxLayout.h>
     55#include <QtGui/QPushButton.h>
     56#include <QtGui/QLabel.h>
     57#include <QtGui/QSplitter.h>
     58#include <QtGui/QScrollBar.h>
     59#include <QtGui/QDialog.h>
     60#include <QtGui/QEvent.h>
     61#include <QtGui/QListWidget.h>
     62#include <QtGui/QTextEdit.h>
     63#include <QtGui/QTreeWidget.h>
     64#include <QtCore/QSignalMapper.h>
     65
    5966
    6067#include <stdlib.h>
  • trunk/geant4/interfaces/basic/src/G4UIQt_moc.cc

    r577 r593  
    22** Meta object code from reading C++ file 'G4UIQt.hh'
    33**
    4 ** Created: Mon Sep 17 14:28:15 2007
     4** Created: Mon Oct 1 10:59:35 2007
    55**      by: The Qt Meta Object Compiler version 59 (Qt 4.2.2)
    66**
    77** WARNING! All changes made in this file will be lost!
    88*****************************************************************************/
     9
     10#ifdef G4UI_BUILD_QT_SESSION
    911
    1012#include "../include/G4UIQt.hh"
     
    99101    QMetaObject::activate(this, &staticMetaObject, 0, _a);
    100102}
     103
     104#endif
  • trunk/geant4/interfaces/basic/src/G4UIWin32.cc

    r483 r593  
    2626//
    2727// $Id: G4UIWin32.cc,v 1.13 2006/06/29 19:09:45 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030// G.Barrand
  • trunk/geant4/interfaces/basic/src/G4UIXaw.cc

    r483 r593  
    2626//
    2727// $Id: G4UIXaw.cc,v 1.6 2006/06/29 19:09:47 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030// G.Barrand
  • trunk/geant4/interfaces/basic/src/G4UIXm.cc

    r483 r593  
    2626//
    2727// $Id: G4UIXm.cc,v 1.14 2006/06/29 19:09:49 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030// G.Barrand
  • trunk/geant4/interfaces/basic/src/G4UIcsh.cc

    r483 r593  
    2626//
    2727// $Id: G4UIcsh.cc,v 1.8 2006/06/29 19:09:51 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030
  • trunk/geant4/interfaces/basic/src/G4UItcsh.cc

    r483 r593  
    2525//
    2626//
    27 // $Id: G4UItcsh.cc,v 1.12 2006/06/29 19:09:54 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     27// $Id: G4UItcsh.cc,v 1.15 2007/11/06 09:36:23 kmura Exp $
     28// GEANT4 tag $Name: $
    2929//
    3030
     
    3737#include <ctype.h>
    3838#include <sstream>
     39#include <fstream>
     40#include <stdlib.h>
    3941
    4042// ASCII character code
     
    5961static const int AsciiPrintableMin = 32;
    6062
     63// history file
     64static const G4String historyFileName= "/.g4_hist";
     65
    6166/////////////////////////////////////////////////////////
    6267G4UItcsh::G4UItcsh(const G4String& prompt, G4int maxhist)
     
    6974  // get current terminal mode
    7075  tcgetattr(0, &tios);
     76
     77  // read a shell history file
     78  G4String homedir= getenv("HOME");
     79  G4String fname= homedir + historyFileName;
     80
     81  std::ifstream histfile;
     82  enum { BUFSIZE= 1024 }; char linebuf[BUFSIZE];
     83
     84  histfile.open(fname, std::ios::in);
     85  while (histfile.good()) {
     86    if(histfile.eof()) break;
     87
     88    histfile.getline(linebuf, BUFSIZE);
     89    G4String aline= linebuf;
     90    aline.strip(G4String::both);
     91    if(aline.size() !=  0) StoreHistory(linebuf);
     92  }
     93  histfile.close();
    7194}
    7295
     
    7598/////////////////////
    7699{
    77 }
     100  // store a shell history
     101  G4String homedir= getenv("HOME");
     102  G4String fname= homedir + historyFileName;
     103
     104  std::ofstream histfile;
     105  histfile.open(fname, std::ios::out);
     106
     107  G4int n0hist= 1;
     108  if( currentHistoryNo > maxHistory ) n0hist= currentHistoryNo-maxHistory+1;
     109
     110  for (G4int i=n0hist; i<= currentHistoryNo; i++) {
     111    histfile << RestoreHistory(i) << G4endl;
     112  }
    78113 
    79 ///////////////////////////
     114  histfile.close();
     115}
     116
     117//////////////////////////////////////////
    80118void G4UItcsh::MakePrompt(const char* msg)
    81 ///////////////////////////
     119//////////////////////////////////////////
    82120{
    83121  if(promptSetting.length()<=1) {
     
    130168}
    131169
     170
     171//////////////////////////////
     172void G4UItcsh::ResetTerminal()
     173//////////////////////////////
     174{
     175  RestoreTerm();
     176}
     177
     178
    132179// --------------------------------------------------------------------
    133180//      commad line operations
     
    465512
    466513  G4int jt= input.find_last_of('/');
    467   if(jt<jhead) jt=G4String::npos;
     514  if(jt<jhead) jt=G4int(G4String::npos);
    468515
    469516  if(jt==G4int(G4String::npos)) jt= jhead;
     
    472519  G4String dspstr;
    473520  G4int i;
    474   for(i=jt; i<=G4int(input.length())-1; i++) dspstr+= G4String(AsciiBS); // cleanup
     521  for(i=jt; i<=G4int(input.length())-1; i++) dspstr+= G4String(AsciiBS);
    475522  for(i=jt; i<=G4int(input.length())-1; i++) dspstr+= G4String(' ');
    476523  for(i=jt; i<=G4int(input.length())-1; i++) dspstr+= G4String(AsciiBS);
     
    592639}
    593640
    594 ///////////////////////////////////
     641//////////////////////////////////////////////////
    595642G4String G4UItcsh::GetCommandLine(const char* msg)
    596 ///////////////////////////////////
     643//////////////////////////////////////////////////
    597644{
    598645  SetTermToInputMode();
  • trunk/geant4/interfaces/basic/src/G4UIterminal.cc

    r483 r593  
    2525//
    2626//
    27 // $Id: G4UIterminal.cc,v 1.21 2006/06/29 19:09:56 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
    29 //
    30 
     27// $Id: G4UIterminal.cc,v 1.27 2007/10/29 18:49:45 asaim Exp $
     28// GEANT4 tag $Name:  $
     29//
     30// ====================================================================
     31//   G4UIterminal.cc
     32//
     33// ====================================================================
    3134#include "G4Types.hh"
    3235#include "G4StateManager.hh"
     
    3841#include <sstream>
    3942
    40 
    41 //////////////////////////////////////////////
    42 G4UIterminal::G4UIterminal(G4VUIshell* aShell)
    43 //////////////////////////////////////////////
     43#ifndef WIN32
     44#include <signal.h>
     45#endif
     46
     47// ====================================================================
     48// signal handler for soft-abort
     49// ====================================================================
     50
     51static G4VUIshell* theshell= 0;
     52
     53#ifndef WIN32
     54
     55extern "C" {
     56
     57////////////////////////////////
     58static void SignalHandler(G4int)
     59////////////////////////////////
     60{
     61  G4StateManager* stateManager= G4StateManager::GetStateManager();
     62  G4ApplicationState state= stateManager-> GetCurrentState();
     63
     64  if(state==G4State_GeomClosed || state==G4State_EventProc) {
     65    G4cout << "aborting Run ...";
     66    G4UImanager::GetUIpointer()->ApplyCommand("/run/abort");
     67    G4cout << G4endl;
     68  } else {
     69    G4cout << G4endl
     70           << "Session terminated." << G4endl;
     71    theshell-> ResetTerminal();
     72    exit(0);
     73  }
     74
     75  // for original Unix / System V
     76  signal(SIGINT, SignalHandler);
     77}
     78
     79}
     80#endif
     81
     82// ====================================================================
     83//
     84// class description
     85//
     86// ====================================================================
     87
     88///////////////////////////////////////////////////////////
     89G4UIterminal::G4UIterminal(G4VUIshell* aShell, G4bool qsig)
     90///////////////////////////////////////////////////////////
    4491{
    4592  UI= G4UImanager::GetUIpointer();
     
    5299  if(aShell) shell= aShell;
    53100  else shell= new G4UIcsh;
     101  theshell= shell; // locally stored for the signal handler
     102
     103  // add signal handler
     104  if(qsig) {
     105#ifndef WIN32
     106  signal(SIGINT, SignalHandler);
     107#endif
     108  }
    54109}
    55110
  • trunk/geant4/interfaces/basic/src/G4VUIshell.cc

    r483 r593  
    2525//
    2626//
    27 // $Id: G4VUIshell.cc,v 1.9 2006/06/29 19:09:59 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     27// $Id: G4VUIshell.cc,v 1.10 2007/06/14 05:44:58 kmura Exp $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030
     
    5959}
    6060
    61 /////////////////////////////
     61////////////////////////////////////////////
    6262void G4VUIshell::MakePrompt(const char* msg)
    63 /////////////////////////////
     63////////////////////////////////////////////
    6464{
    6565  if(promptSetting.length()<=1) {
     
    106106
    107107
     108////////////////////////////////
     109void G4VUIshell::ResetTerminal()
     110////////////////////////////////
     111{
     112
     113}
     114
    108115// --------------------------------------------------------------------
    109116//      G4command operations
     
    308315  arrayString.Show(nColumn);
    309316}
     317
  • trunk/geant4/interfaces/common/include/G4Qt.hh

    r484 r593  
    2525//
    2626//
    27 // $Id: G4Qt.hh,v 1.6 2007/05/29 11:10:14 $
    28 // GEANT4 tag $Name: geant4-08-01 $
     27// $Id: G4Qt.hh,v 1.2 2007/11/08 17:00:09 lgarnier Exp $
     28// GEANT4 tag $Name: $
    2929//
    3030//  To unify Qt event treatment between
     
    3838
    3939#include "G4VInteractorManager.hh"
    40 
    41 #include <QtGui/qapplication.h>
    42 #include <QtGui/qwidget.h>
    43 #include <QtGui/qmainwindow.h>
    4440
    4541// Class description :
  • trunk/geant4/interfaces/common/include/G4VBasicShell.hh

    r483 r593  
    2626//
    2727// $Id: G4VBasicShell.hh,v 1.7 2006/06/29 19:10:03 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030
  • trunk/geant4/interfaces/common/include/G4VInteractorManager.hh

    r483 r593  
    2626//
    2727// $Id: G4VInteractorManager.hh,v 1.9 2006/06/29 19:10:08 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030// G.Barrand
  • trunk/geant4/interfaces/common/include/G4Win32.hh

    r483 r593  
    2626//
    2727// $Id: G4Win32.hh,v 1.8 2006/06/29 19:10:11 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//  To unify Windows message treatment between
  • trunk/geant4/interfaces/common/include/G4Xt.hh

    r483 r593  
    2626//
    2727// $Id: G4Xt.hh,v 1.6 2006/06/29 19:10:14 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//  To unify X11 event treatment between
  • trunk/geant4/interfaces/common/src/G4Qt.cc

    r578 r593  
    2525//
    2626//
    27 // $Id: G4Qt.cc,v 1.11 2007/05/29 11:10:28 $
    28 // GEANT4 tag $Name: geant4-08-01 $
     27// $Id: G4Qt.cc,v 1.3 2007/11/08 17:00:09 lgarnier Exp $
     28// GEANT4 tag $Name: $
    2929//
    3030// L. Garnier
     
    3838
    3939#include "G4Qt.hh"
     40
     41#include <QtGui/QApplication.h>
     42
    4043
    4144#define NewString(str)  \
     
    135138//  return         &event;
    136139  printf("*");
     140  return 0;
    137141}
    138142/***************************************************************************/
  • trunk/geant4/interfaces/common/src/G4VBasicShell.cc

    r571 r593  
    2626//
    2727// $Id: G4VBasicShell.cc,v 1.12 2006/06/29 19:10:20 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030
     
    197197    std::vector<G4UIcommand*> commands;
    198198    G4int n_commandEntry = aTree->GetCommandEntry();
    199     for( int i_thCommand = 1; i_thCommand <= n_commandEntry; i_thCommand++ ) {
     199    for( G4int i_thCommand = 1; i_thCommand <= n_commandEntry; i_thCommand++ ) {
    200200      G4UIcommand* cmd = aTree->GetCommand(i_thCommand);
    201201      G4String ss = cmd->GetCommandName();
  • trunk/geant4/interfaces/common/src/G4VInteractorManager.cc

    r483 r593  
    2626//
    2727// $Id: G4VInteractorManager.cc,v 1.13 2006/06/29 19:10:24 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030// G.Barrand
  • trunk/geant4/interfaces/common/src/G4Win32.cc

    r483 r593  
    2626//
    2727// $Id: G4Win32.cc,v 1.9 2006/06/29 19:10:26 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030// G.Barrand
  • trunk/geant4/interfaces/common/src/G4Xt.cc

    r483 r593  
    2626//
    2727// $Id: G4Xt.cc,v 1.11 2006/06/29 19:10:28 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030// G.Barrand
  • trunk/geant4/visualization/G4History.macro

    r588 r593  
    66/vis/viewer/create ! ! 600
    77/vis/open OGLSQT
    8 /vis/sceneHandler/create OGLSQT
    9 /vis/sceneHandler/attach
    10 /vis/viewer/create ! ! 600
    11 /vis/viewer/refresh
    12 /vis/scene/notifyHandlers
    13 /vis/viewer/flush
    14 /vis/viewer/refresh viewer-1
    15 /vis/viewer/update viewer-1
    16 /vis/scene/add/trajectories
    17 /tracking/storeTrajectory 1
    18 /vis/scene/notifyHandlers
    19 /vis/modeling/trajectories/create/drawByCharge
    20 /vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true
    21 /vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 2
    22 /vis/scene/endOfEventAction accumulate
    23 /vis/scene/notifyHandlers
    248/control/execute visTutor/gui.mac
    259/gui/addMenu file File
     
    3115/gui/addButton run run2 "/control/execute run2.mac"
    3216/gui/addMenu gun Gun
    33 /gui/addButton gun "50 MeV"  "/gun/energy 50 MeV"
    34 /gui/addButton gun "1 GeV"   "/gun/energy 1 GeV"
    35 /gui/addButton gun "10 GeV"  "/gun/energy 10 GeV"
    36 /gui/addButton gun "e-"      "/gun/particle e-"
    37 /gui/addButton gun "pi0"     "/gun/particle pi0"
    38 /gui/addButton gun "pi+"     "/gun/particle pi+"
     17/gui/addButton gun "50 MeV" "/gun/energy 50 MeV"
     18/gui/addButton gun "1 GeV" "/gun/energy 1 GeV"
     19/gui/addButton gun "10 GeV" "/gun/energy 10 GeV"
     20/gui/addButton gun "e-" "/gun/particle e-"
     21/gui/addButton gun "pi0" "/gun/particle pi0"
     22/gui/addButton gun "pi+" "/gun/particle pi+"
    3923/gui/addButton gun "neutron" "/gun/particle neutron"
    40 /gui/addButton gun "proton"  "/gun/particle proton"
     24/gui/addButton gun "proton" "/gun/particle proton"
    4125/gui/addMenu vis Vis
    4226/gui/addButton vis Vis0(OGLIX) "/control/execute visTutor/exN03Vis0.mac"
     
    4529/gui/addButton vis Vis3(OGLSX) "/control/execute visTutor/exN03Vis3.mac"
    4630/gui/addButton vis Vis4(OGLIX) "/control/execute visTutor/exN03Vis4.mac"
    47 /gui/addButton vis Vis12(OGLIQT) "/control/execute visTutor/exN03Vis12.mac"
    48 /gui/addButton vis Vis14(OGLSQT) "/control/execute visTutor/exN03Vis14.mac"
    49 /gui/addButton vis Vis5(OIX)   "/control/execute visTutor/exN03Vis5.mac"
     31/gui/addButton vis Vis5(OIX) "/control/execute visTutor/exN03Vis5.mac"
    5032/gui/addButton vis Vis6(VRML2FILE) "/control/execute visTutor/exN03Vis6.mac"
    5133/gui/addButton vis Vis7(DAWNFILE) "/control/execute visTutor/exN03Vis7.mac"
     
    5941/gui/addButton viewer "Update scene" "/vis/scene/notifyHandlers"
    6042/N03/event/printModulo 100
    61 /run/beamOn 1
  • trunk/geant4/visualization/History

    r562 r593  
    1 $Id: History,v 1.398 2006/11/26 22:07:44 allison Exp $
     1$Id: History,v 1.414 2007/07/10 17:54:09 allison Exp $
    22-------------------------------------------------------------------
    33
     
    2424History file for visualization category
    2525---------------------------------------
     26
     2710th July 2007  John Allison  (vis-V09-00-00)
     28- visman-V09-00-00: Remove redundant method declarations and minor tidies.
     29
     3014th June 2007  John Allison  (vis-V08-03-07)
     31- raytracer-V08-03-01: Fixed memory leak in G4RayTracer.
     32
     3330th May 2007  John Allison  (vis-V08-03-06)
     34- modeling-V08-03-02: Fixed gcc-4.2.0 warning.
     35
     3630th May 2007  John Allison  (vis-V08-03-05)
     37- modeling-V08-03-01: Fix for SUN.
     38
     3925th May 2007  John Allison  (vis-V08-03-04)
     40- opengl-V08-03-03: Fixed gcc-4.1.2 compiler warnings.
     41
     4225th May 2007  John Allison  (vis-V08-03-03)
     43- visman-V08-03-01: Improved error trapping and big fix.
     44- opengl-V08-03-02: Improved error trapping.
     45
     4624th May 2007  John Allison  (vis-V08-03-02)
     47- opengl-V08-03-01: Fixes for SUN.
     48
     4922nd May 2007  John Allison  (vis-V08-03-01)
     50- modeling-V08-03-00: Simplified G4Atts for Physical Volume Path.
     51- vis-HepRep-V08-03-00: Fixed memory leak in G4HepRepFile.
     52- raytracer-V08-03-00: Fixed for dubious ValGrind diagnostic.
     53
     5416th May 2007  John Allison  (vis-V08-03-00)
     55- visman-V08-03-00: Fix for Windows compiler.
     56- opengl-V08-03-00: Fix compiler warnings and bug fixes in opengl-V08-02-06.
     57
     588th May 2007  John Allison
     59- opengl-V08-02-06: /vis/ogl/printEPS should work for all viewers.
     60
     614th April 2007  John Allison  (vis-V08-02-04)
     62- visman-V08-02-04: Bug fix for zero pointer in G4VscenHamdler::LoadAtts.
     63- opengl-V08-02-05: Implemented picking for OGLSX (as well as OGLIX).
     64
     653rd April 2007  John Allison  (vis-V08-02-03)
     66- modeling-V08-02-02: Added further information on volume G4Atts.
     67- visman-V08-02-03: Added /vis/viewer/set/picking.  Picking is "false"
     68  by default, except for Open Inventor.
     69- opengl-V08-02-04:
     70  o Implemented picking for OGLIX.
     71  o Some reorganisation of display list construction to fix rare bug\
     72    in Display-by-Time feature
     73- openinventor-V08-02-02: Picking is "true" by default for OI.
     74
     7525th March 2007  John Allison  (vis-V08-02-02)
     76-  modeling-V08-02-01: Added solid dump and volume transformation to G4Atts.
     77- visman-V08-02-02:
     78  o Removed G4GAGTree.
     79  o Removed /vis/scene/add/eventID (once again) from /vis/drawVolume.
     80- opengl-V08-02-03: Fix compiler warnings.
     81- vistree-V08-02-01: Removed GAGTree.
     82- openinventor-V08-02-01): Added scale factor to list of changes
     83  requiring kernel visit, and some rationalisation.
     84
     8511th January 2007  John Allison  (vis-V08-02-01)
     86- visman-V08-02-01:
     87  o Added /vis/abortReviewKeptEvents.
     88  o /vis/reviewKeptEvents: Improved guidance.
     89  o Bug fix: /vis/open in /vis/reviewKeptEvents loop.
     90  o Reduced WARNING noise.
     91
     929th January 2007  John Allison
     93- opengl-V08-02-01:
     94  o Implemented bitmap markers (for MarkerSizeType == screen).
     95  o Bug fix: Added missing break in X colormap lookup routine.
     96
     975th January 2007  John Allison  (vis-V08-02-00 - needs greps-V08-02-00)
     98- modeling-V08-02-00 (needs greps-V08-02-00):
     99  o Bug fix: Correct treatment of ForcedLineSegmentsPerCircle when clipping.
     100- visman-V08-02-00:
     101  o G4VSceneHandler:
     102    ~ Introduced utility LoadAtts for G4AttValues and G4AttDefs.
     103    ~ Improved other utilities (changed signature of GetLineWidth).
     104  o Introduced /vis/geometry/set/forceLineSegmentsPerCircle.
     105  o Re-introduced /vis/scene/add/eventID into /vis/drawVolume (removed
     106    in visman-V08-01-16 for release 8.2).
     107  o Other minor improvements.
     108- opengl-V08-02-00:
     109  o Followed change of signature of GetLineWidth in visman-V08-02-00.
     110- openinventor-V08-02-00: Moved LoadAtts to vis management.
     111- raytracer-V08-02-00: Bug fix: use of window size hints.
     112- vistree-V08-02-00: Bug fix: Format of total mass.
     113- vistest-V08-02-00: test19.cc: Refined usage.
     114
     11512th December 2006  Gabriele Cosmo
     116- visman-V08-01-16: Commented command "vis/scene/add/eventID" forcing
     117  event ID to scene in G4VisCommandsCompound.cc.
     118
     11911th December 2006  John Allison
     120- Tree: Trapped sequential G4PVPlacements.
    26121
    2712225th November 2006  John Allison  (vis-V08-01-17)
  • trunk/geant4/visualization/OpenGL/GNUmakefile

    r539 r593  
    2828CPPFLAGS += -I$(G4BASE)/intercoms/include
    2929CPPFLAGS += -I$(G4BASE)/interfaces/common/include
    30 CPPFLAGS += -I$(G4BASE)/interfaces/basic/include
    3130CPPFLAGS += -I$(G4BASE)/tracking/include
    3231CPPFLAGS += -I$(G4BASE)/digits_hits/hits/include
  • trunk/geant4/visualization/OpenGL/History

    r529 r593  
    1 $Id: History,v 1.82 2006/11/21 16:24:58 allison Exp $
     1$Id: History,v 1.94 2007/08/21 14:05:50 allison Exp $
    22-------------------------------------------------------------------
    33
     
    2020History file for visualization/OpenGL
    2121-------------------------------------
     22
     2321st August 2007  John Allison  (opengl-V09-00-00)
     24- Removed redundant G4OpenGLXViewerMessenger.
     25
     2625th May 2007  John Allison  (opengl-V08-03-03)
     27- G4OpenGLSceneHandler and G4OpenGLXViewerMessenger:
     28  Fixed gcc-4.1.2 compiler warnings.
     29
     30G4OpenGLXViewer: Trapped glXMakeCurrent in Initialise function.
     31
     3225th May 2007  John Allison  (opengl-V08-03-02)
     33- G4OpenGLXViewer: Trapped glXMakeCurrent in Initialise function.
     34
     3524th May 2007  John Allison  (opengl-V08-03-01)
     36- Fixes for SUN.
     37
     3816th May 2007  John Allison  (opengl-V08-03-00)
     39- Fix compiler warnings on SLC4.
     40- Bug fixes:
     41  o Correct path /vis/ogl/set/printMode.
     42  o Add SetView to pixmap screen dump ("/vis/ogl/set/printMode pixmap"
     43    and "/vis/ogl/printEPS").
     44
     458th May 2007  John Allison  (opengl-V08-02-06)
     46- Moved vectored PostScript printing to G4OpenGLViewer.
     47- /vis/ogl/printEPS should work for all viewers, including Win32.
     48- Introduced /vis/ogl/set/printMode vectored|pixmap, currently only
     49  effective on X windows (and still somewhat buggy).
     50
     514th April 2007  John Allison  (opengl-V08-02-05 - needs visman-V08-02-04)
     52- Implemented picking for OGLSX ( as well as OGLIX).  Hopefully works
     53  for OGL*Win32.  Still doesn't work for OGL*Xm.
     54
     553rd April 2007  John Allison  (opengl-V08-02-04 - needs visman-V08-02-03)
     56- G4OpenGLStoredSceneHandler:
     57  o Re-organised display lists on a per-primitive basis, i.e., one
     58    display list per primitive.  (This is so that, except for text,
     59    the colour - or, rather, intensity - can be brought out of the
     60    display list into the TOList (Transient Object List) and
     61    controlled for the Display-by-Time feature.  Previously, if more
     62    than one primitive were drawn between BeginPrimitives and
     63    EndPrimitives, it would finish up all in one display list, colour
     64    commands included. Rationalises and fixes a rare bug in the
     65    Display-by-Time feature - see August 2006.)
     66  o Added AddPrimitive(const G4Polymarker&) so that it is treated as
     67    one primoitive to fit with the above re-organisation.
     68- Implemented picking for OGLIX.
     69
     7025th March 2007  John Allison  (opengl-V08-02-03)
     71- Fix compiler warnings.
     72
     738th February 2007  John Allison  (opengl-V08-02-02)
     74- Fixed Windows problem with DBL_MAX.  (Introduced G4OPENGL_DBL_MAX.)
     75- G4OpenGLXViewer.cc: Small bug fix in print().  (Context was switched
     76  .but not switched back.  Not serious, because context was always set
     77  before normal drawing.)
     78
     799th January 2007  John Allison  (opengl-V08-02-01)
     80- Implemented bitmap markers for MarkerSizeType == screen.  (The old
     81  polygon implementation remains for MarkerSizeType == world.)
     82- Added G4OpenGLBitMapStore to assist the above.
     83- G4OpenGLXViewer::CreateGLXContext:
     84  o Bug fix: Added missing break in colormap lookup routine.
     85
     865th January 2007  John Allison  (opengl-V08-02-00)
     87- G4OpenGLSceneHandler.cc:
     88  o Followed change of signature of GetLineWidth in visman-V08-02-00.
     89  o Minor efficiency improvements.
    2290
    239121st November 2006  John Allison  (opengl-V08-01-09)
  • trunk/geant4/visualization/OpenGL/include/G4OpenGL.hh

    r529 r593  
    2424// ********************************************************************
    2525//
    26 // $Id: G4OpenGL.hh,v 1.4 2006/06/29 21:17:36 gunter Exp $
    27 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     26// $Id: G4OpenGL.hh,v 1.5 2007/02/08 14:01:55 allison Exp $
     27// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2828//
    2929// G.Barrand.
     
    3939#include <GL/glu.h>
    4040
     41#define G4OPENGL_DBL_MAX 1.e308
     42
    4143#endif
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLFontBaseStore.hh

    r529 r593  
    2525//
    2626// $Id: G4OpenGLFontBaseStore.hh,v 1.3 2006/06/29 21:17:38 gunter Exp $
    27 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     27// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2828//
    2929// J.Allison  Apr 2005.
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateQt.hh

    r533 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLImmediateQt.hh,v 1.7 2007/06/25 21:17:44 $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     27// $Id: G4OpenGLImmediateQt.hh,v 1.1 2007/09/28 14:44:13 lgarnier Exp $
     28// GEANT4 tag $Name: $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateQtViewer.hh

    r561 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLImmediateQtViewer.hh,v 1.9 2007/06/25 21:17:46 $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     27// $Id: G4OpenGLImmediateQtViewer.hh,v 1.2 2007/11/08 17:00:51 lgarnier Exp $
     28// GEANT4 tag $Name: $
    2929//
    3030//
     
    4040#include "G4OpenGLImmediateViewer.hh"
    4141#include "G4OpenGLQtViewer.hh"
    42 #include <QGLWidget>
     42
     43#include <QtOpenGL/QGLWidget>
    4344
    4445#include "globals.hh"
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateSceneHandler.hh

    r529 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLImmediateSceneHandler.hh,v 1.11 2006/08/16 10:34:36 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     27// $Id: G4OpenGLImmediateSceneHandler.hh,v 1.13 2007/04/04 16:50:26 allison Exp $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
     
    5959  void EndModeling ();
    6060  void AddPrimitive (const G4Polyline&);
     61  void AddPrimitive (const G4Polymarker&);
     62  void AddPrimitive (const G4Text& text);
    6163  void AddPrimitive (const G4Circle&);
    6264  void AddPrimitive (const G4Square&);
    63   // Explicitly invoke base class methods to avoid warnings about
    64   // hiding of base class methods...
    65   void AddPrimitive (const G4Text& text) {
    66     G4OpenGLSceneHandler::AddPrimitive (text);
    67   }
    68   void AddPrimitive (const G4Polyhedron& polyhedron) {
    69     G4OpenGLSceneHandler::AddPrimitive (polyhedron);
    70   }
    71   void AddPrimitive (const G4NURBS& nurbs) {
    72     G4OpenGLSceneHandler::AddPrimitive (nurbs);
    73   }
    74   void AddPrimitive(const G4Polymarker& polymarker) {
    75     G4OpenGLSceneHandler::AddPrimitive (polymarker);
    76   }
    77   void AddPrimitive (const G4Scale& scale) {
    78     G4OpenGLSceneHandler::AddPrimitive (scale);
    79   }
     65  void AddPrimitive (const G4Scale& scale);
     66  void AddPrimitive (const G4Polyhedron&);
     67  void AddPrimitive (const G4NURBS&);
    8068  void ClearTransientStore ();
    8169
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateViewer.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLImmediateViewer.hh,v 1.9 2006/09/04 12:07:59 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateWin32.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLImmediateWin32.hh,v 1.7 2006/06/29 21:17:44 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateWin32Viewer.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLImmediateWin32Viewer.hh,v 1.9 2006/06/29 21:17:46 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateX.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLImmediateX.hh,v 1.7 2006/06/29 21:17:48 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateXViewer.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLImmediateXViewer.hh,v 1.9 2006/07/03 16:38:13 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateXm.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLImmediateXm.hh,v 1.7 2006/06/29 21:17:52 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateXmViewer.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLImmediateXmViewer.hh,v 1.9 2006/07/03 16:38:13 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLQtExportDialog.hh

    r586 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLQtExportDialog.hh,v 0.1 2007/09/20 15:18:20 garnier $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     27// $Id: G4OpenGLQtExportDialog.hh,v 1.2 2007/11/08 17:00:51 lgarnier Exp $
     28// GEANT4 tag $Name:
    2929//
    3030//
     
    3535#define G4OPENGLQTEXPORTDIALOG_HH
    3636
    37 #include <qvariant.h>
    38 #include <qdialog.h>
     37#include <QtGui/QDialog.h>
    3938
    4039class QButtonGroup;
     
    4746class QLineEdit;
    4847
     48/** The G4OpenGLQtExportDialog class provide a Dialog displaying differents options
     49  for each file format
     50 */
    4951class G4OpenGLQtExportDialog : public QDialog
    5052{
     
    5254
    5355public:
    54   G4OpenGLQtExportDialog(QWidget* parent, QString name, int, int);
     56  /** Construct a G4OpenGLQtExportDialog
     57      @param parent : parent widget
     58      @param name : name of the saved file with extention
     59      @param height : height of the original file
     60      @param width : width of the original file
     61  */
     62  G4OpenGLQtExportDialog(QWidget* parent, QString name, int height =0, int width=0);
     63
     64  /** Destroys G4OpenGLQtExportDialog */
    5565  ~G4OpenGLQtExportDialog();
    5666
     67  /** @return the value of the slider if format has a slider widget, instead return -1 */
    5768  int getSliderValue();
     69
     70  /** return the new width for file if format has a width widget, instead return -1 */
    5871  int getWidth();
     72
     73  /** return the new height for file if format has a height widget, instead return -1 */
    5974  int getHeight();
    60   int getTransparency();
     75
     76  /** return the value of the transparency if format has a transparency, instead return -1 */
     77  bool getTransparency();
     78
     79  /** return the numbers of colors in the picture if format has a BW/Color widget, instead return -1 */
    6180  int getNbColor();
    6281
    6382public slots:
     83
     84/** Called by a clic on modify/original size button.This will
     85    invert buttons and hide/unhide size
     86*/
    6487  void changeSizeBox(bool); 
     88
     89  /** Called by changing value in height lineEdit. If ratio is keep, will also change the width
     90   */
    6591  void textWidthChanged(const QString &);
     92
     93  /** Called by changing value in width lineEdit. If ratio is keep, will also change the height
     94   */
    6695  void textHeightChanged(const QString &);
    67 
    68 signals:
    69   void options(const QString&, const QString&, int, bool);
    70   void exportAll(const QString&, const QString&, int, bool);
    7196
    7297private:
     
    80105  QSlider * qualitySlider;
    81106  QLabel *formatLabel;
    82   QRadioButton* color,*BW;
     107  QRadioButton* colorButton,*BWButton;
    83108  QRadioButton* original,* modify;
    84109  QLineEdit* height,*width;
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLQtViewer.hh

    r588 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLQtViewer.hh,v 1.13 2006/06/29 21:18:20 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     27// $Id: G4OpenGLQtViewer.hh,v 1.2 2007/11/08 17:00:51 lgarnier Exp $
     28// GEANT4 tag $Name: $
    2929//
    3030//
     
    4242#include "G4OpenGLSceneHandler.hh"
    4343
    44 #include <QObject>
    45 #include <QGLWidget>
    46 #include <QDialog>
    47 #include <QContextMenuEvent>
    48 #include <QMenu>
    49 #include <QPoint>
    50 #include <QImage>
     44#include <QtCore/QObject>
     45#include <QtCore/QPoint>
     46
     47class QGLWidget;
     48class QDialog;
     49class QContextMenuEvent;
     50class QMenu;
     51class QImage;
     52class QAction;
    5153
    5254class G4OpenGLSceneHandler;
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLSceneHandler.hh

    r529 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLSceneHandler.hh,v 1.20 2006/08/30 11:37:34 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     27// $Id: G4OpenGLSceneHandler.hh,v 1.23 2007/04/04 16:50:26 allison Exp $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
     
    4545#include "G4VSceneHandler.hh"
    4646#include "G4OpenGLViewer.hh"
     47#include "G4OpenGLBitMapStore.hh"
     48#include <map>
    4749
    48 // Base class for various OpenGLScene classes.
     50class G4AttHolder;
     51
     52// Base class for various OpenGLSceneHandler classes.
    4953class G4OpenGLSceneHandler: public G4VSceneHandler {
    5054
     55  friend class G4OpenGLViewer;
     56
    5157public:
     58  virtual void BeginPrimitives (const G4Transform3D& objectTransformation);
     59  virtual void EndPrimitives ();
     60  virtual void BeginPrimitives2D ();
     61  virtual void EndPrimitives2D ();
    5262  void AddPrimitive (const G4Polyline&);
     63  void AddPrimitive (const G4Polymarker&);
    5364  void AddPrimitive (const G4Text&);
    5465  void AddPrimitive (const G4Circle&);
    5566  void AddPrimitive (const G4Square&);
     67  void AddPrimitive (const G4Scale&);
    5668  void AddPrimitive (const G4Polyhedron&);
    5769  void AddPrimitive (const G4NURBS&);
    58   // Explicitly invoke base class methods to avoid warnings about
    59   // hiding of base class methods...
    60   void AddPrimitive(const G4Polymarker& polymarker) {
    61     G4VSceneHandler::AddPrimitive (polymarker);
    62   }
    63   void AddPrimitive (const G4Scale& scale) {
    64     G4VSceneHandler::AddPrimitive (scale);
    65   }
    6670
     71  void PreAddSolid (const G4Transform3D& objectTransformation,
     72                    const G4VisAttributes&);
    6773  void AddSolid (const G4Box&);
    6874  void AddSolid (const G4Cons&);
     
    8995  const G4Polyhedron* CreateCutawayPolyhedron ();
    9096
     97  GLuint fPickName;
     98  std::map<GLuint, G4AttHolder*> fPickMap;  // For picking.
     99  void ClearAndDestroyAtts();  // Destroys att holders and clears pick map.
     100
    91101private:
    92102
    93   void AddCircleSquare (const G4VMarker&, G4int nSides);
    94   /**************************************************
    95   Not needed - but see note on future development in .cc.
    96   void DrawScreenPolygon (G4double size,
    97                           const G4Point3D& centre,
    98                           G4int nSides);
    99   // Draws in screen coordinates.
    100   *********************************/
     103  void AddCircleSquare (const G4VMarker&, G4OpenGLBitMapStore::Shape);
    101104
    102   void DrawXYPolygon (G4double size,
    103                       const G4Point3D& centre,
    104                       G4int nSides);
     105  void DrawXYPolygon
     106  (G4OpenGLBitMapStore::Shape,
     107   G4double size,
     108   const G4Point3D& centre,
     109   const G4VisAttributes* pApplicableVisAtts);
    105110  // Draws in world coordinates a polygon in the screen plane knowing
    106111  // viewpoint direction and up vector.
    107112
    108113  static const GLubyte fStippleMaskHashed [128];
     114
     115  G4bool fProcessingPolymarker;
    109116};
    110117
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLSceneHandler.icc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLSceneHandler.icc,v 1.7 2006/06/29 21:17:58 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredQt.hh

    r561 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLStoredQt.hh,v 1.7 2007/06/25 21:17:44 $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     27// $Id: G4OpenGLStoredQt.hh,v 1.1 2007/09/28 14:44:13 lgarnier Exp $
     28// GEANT4 tag $Name: $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredQtViewer.hh

    r561 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLStoredQtViewer.hh,v 1.9 2007/06/25 21:17:46 $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     27// $Id: G4OpenGLStoredQtViewer.hh,v 1.2 2007/11/08 17:00:51 lgarnier Exp $
     28// GEANT4 tag $Name: $
    2929//
    3030//
     
    4040#include "G4OpenGLStoredViewer.hh"
    4141#include "G4OpenGLQtViewer.hh"
    42 #include <QGLWidget>
    43 #include <QApplication>
    44 #include <QMouseEvent>
    45 #include <QContextMenuEvent>
     42
     43#include <QtOpenGL/QGLWidget>
     44
     45class QMouseEvent;
     46class QContextMenuEvent;
    4647
    4748class G4OpenGLStoredSceneHandler;
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredSceneHandler.hh

    r529 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLStoredSceneHandler.hh,v 1.21 2006/08/30 11:43:57 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     27// $Id: G4OpenGLStoredSceneHandler.hh,v 1.24 2007/04/04 16:50:26 allison Exp $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
     
    6363  void EndModeling ();
    6464  void AddPrimitive (const G4Polyline&);
     65  void AddPrimitive (const G4Polymarker&);
    6566  void AddPrimitive (const G4Circle&);
    6667  void AddPrimitive (const G4Square&);
    67   void AddPrimitive (const G4Polymarker& polymarker);
    68   // Explicitly invoke base class methods to avoid warnings about
    69   // hiding of base class methods...
    70   void AddPrimitive (const G4Text& text) {
    71     G4OpenGLSceneHandler::AddPrimitive (text);
    72   }
    73   void AddPrimitive (const G4Polyhedron& polyhedron) {
    74     G4OpenGLSceneHandler::AddPrimitive (polyhedron);
    75   }
    76   void AddPrimitive (const G4NURBS& nurbs) {
    77     G4OpenGLSceneHandler::AddPrimitive (nurbs);
    78   }
    79   void AddPrimitive (const G4Scale& scale) {
    80     G4OpenGLSceneHandler::AddPrimitive (scale);
    81   }
     68  void AddPrimitive (const G4Text&);
     69  void AddPrimitive (const G4Scale&);
     70  void AddPrimitive (const G4Polyhedron&);
     71  void AddPrimitive (const G4NURBS&);
    8272  void ClearStore ();
    8373  void ClearTransientStore ();
     
    9888  struct PO {
    9989    PO(G4int id, const G4Transform3D& tr = G4Transform3D()):
    100       fDisplayListId(id), fTransform(tr) {}
     90      fDisplayListId(id), fTransform(tr), fPickName(0) {}
    10191    G4int fDisplayListId;
    10292    G4Transform3D fTransform;
     93    GLuint fPickName;
    10394  };
    10495  std::vector<PO> fPOList;
     
    10798  struct TO {
    10899    TO(G4int id, const G4Transform3D& tr = G4Transform3D()):
    109       fDisplayListId(id), fTransform(tr),
    110       fStartTime(-DBL_MAX), fEndTime(DBL_MAX) {}
     100      fDisplayListId(id), fTransform(tr), fPickName(0),
     101      fStartTime(-G4OPENGL_DBL_MAX), fEndTime(G4OPENGL_DBL_MAX) {}
    111102    G4int fDisplayListId;
    112103    G4Transform3D fTransform;
     104    GLuint fPickName;
    113105    G4double fStartTime, fEndTime;  // Time range (e.g., for trajectory steps).
    114106    G4Colour fColour;
     
    119111  // A proper implementation would use geometry hierarchy.
    120112  std::map <const G4VSolid*, G4int, std::less <const G4VSolid*> > fSolidMap;
     113
     114private:
     115  G4bool fProcessing2D;
    121116};
    122117
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredViewer.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLStoredViewer.hh,v 1.9 2006/06/29 21:18:02 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredWin32.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLStoredWin32.hh,v 1.7 2006/06/29 21:18:04 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredWin32Viewer.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLStoredWin32Viewer.hh,v 1.7 2006/06/29 21:18:06 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredX.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLStoredX.hh,v 1.7 2006/06/29 21:18:08 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredXViewer.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLStoredXViewer.hh,v 1.7 2006/07/03 16:38:13 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredXm.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLStoredXm.hh,v 1.6 2006/06/29 21:18:12 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredXmViewer.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLStoredXmViewer.hh,v 1.7 2006/07/03 16:38:13 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLTransform3D.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLTransform3D.hh,v 1.7 2006/06/29 21:18:16 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLViewer.hh

    r529 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLViewer.hh,v 1.18 2006/09/19 16:13:15 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     27// $Id: G4OpenGLViewer.hh,v 1.20 2007/05/08 11:04:11 allison Exp $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
     
    3838
    3939#include "G4VViewer.hh"
     40#include "G4OpenGL.hh"
    4041
    4142class G4OpenGLSceneHandler;
     
    6263  void HLRThirdPass ();
    6364  void InitializeGLView ();
     65  void Pick(GLdouble x, GLdouble y);
    6466  virtual void CreateFontLists () {}
     67  virtual void print();
     68//////////////////////////////Vectored PostScript production functions///
     69  void printBuffer(GLint, GLfloat*);
     70  GLfloat* spewPrimitiveEPS (FILE*, GLfloat*);
     71  void spewSortedFeedback (FILE*, GLint, GLfloat*);
     72  void spewWireframeEPS (FILE*, GLint, GLfloat*, const char*);
     73  void print3DcolorVertex(GLint, GLint*, GLfloat*);
     74  G4float                           pointSize;
     75  char                              print_string[50];
     76  G4bool                            print_colour;
     77  G4bool                            vectored_ps;
     78
     79  G4OpenGLSceneHandler& fOpenGLSceneHandler;
    6580  G4Colour background;      //the OpenGL clear colour
    6681  G4bool
     
    8095};
    8196
     97typedef struct G4OpenGLViewerFeedback3Dcolor {
     98  GLfloat x;
     99  GLfloat y;
     100  GLfloat z;
     101  GLfloat red;
     102  GLfloat green;
     103  GLfloat blue;
     104  GLfloat alpha;
     105} Feedback3Dcolor;
     106
    82107#endif
    83108
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLViewerMessenger.hh

    r529 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLViewerMessenger.hh,v 1.4 2006/09/19 16:14:21 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     27// $Id: G4OpenGLViewerMessenger.hh,v 1.5 2007/05/08 11:04:11 allison Exp $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929
    3030#ifndef G4OPENGLVIEWERMESSENGER_HH
     
    3737class G4UIdirectory;
    3838class G4UIcommand;
     39class G4UIcmdWithoutParameter;
    3940class G4UIcmdWithADouble;
    4041class G4UIcmdWithABool;
     42class G4UIcmdWithAString;
    4143
    4244class G4OpenGLViewerMessenger: public G4UImessenger {
     
    5052  static G4OpenGLViewerMessenger* fpInstance;
    5153  G4UIdirectory* fpDirectory;
     54  G4UIcmdWithoutParameter* fpCommandPrintEPS;
    5255  G4UIdirectory* fpDirectorySet;
    5356  G4UIcommand* fpCommandDisplayHeadTime;
     
    5558  G4UIcommand* fpCommandEndTime;
    5659  G4UIcmdWithADouble* fpCommandFade;
     60  G4UIcmdWithAString* fpCommandPrintMode;
    5761  G4UIcommand* fpCommandStartTime;
    5862  G4UIcmdWithABool* fpCommandTransparency;
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLWin32Viewer.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLWin32Viewer.hh,v 1.13 2006/06/29 21:18:20 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLXViewer.hh

    r529 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLXViewer.hh,v 1.26 2006/11/01 11:22:27 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     27// $Id: G4OpenGLXViewer.hh,v 1.27 2007/05/08 11:04:11 allison Exp $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
     
    5353
    5454  friend class G4OpenGLXViewerMessenger;
     55  friend class G4OpenGLXmViewer;
    5556
    5657public:
     
    5960  void SetView ();
    6061  void ShowView ();
    61   void print();
    6262
    6363protected:
     
    6666  virtual void CreateMainWindow ();
    6767  virtual void CreateFontLists ();
     68  void print();
    6869
    6970  static int snglBuf_RGBA[12];
    7071  static int dblBuf_RGBA[13];
    7172
    72   char                              print_string[50];
    73   G4bool                            print_colour,
    74                                     vectored_ps;
    75 
    76 //////////////////////////////Vectored PostScript production functions//////////////////////////////
    77   void printBuffer(GLint, GLfloat*);
    78   GLfloat* spewPrimitiveEPS (FILE*, GLfloat*);
    79   void spewSortedFeedback (FILE*, GLint, GLfloat*);
    80   void spewWireframeEPS (FILE*, GLint, GLfloat*, const char*);
    81   void print3DcolorVertex(GLint, GLint*, GLfloat*);
    82   G4float                           pointSize;
    83 
    84 
    85 //////////////////////////////Pixmap (screen dump) production functions//////////////////////////////
     73//////////////////////////////Pixmap (screen dump) production functions/////
    8674  GLubyte* grabPixels (int inColor,
    8775                       unsigned int width,
     
    129117};
    130118
    131 typedef struct G4OpenGLXViewerFeedback3Dcolor {
    132   GLfloat x;
    133   GLfloat y;
    134   GLfloat z;
    135   GLfloat red;
    136   GLfloat green;
    137   GLfloat blue;
    138   GLfloat alpha;
    139 } Feedback3Dcolor;
    140 
    141119#endif
    142120
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLXmBox.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmBox.hh,v 1.7 2006/06/29 21:18:24 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLXmFourArrowButtons.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmFourArrowButtons.hh,v 1.6 2006/06/29 21:18:26 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLXmFramedBox.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmFramedBox.hh,v 1.7 2006/06/29 21:18:28 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLXmPushButton.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmPushButton.hh,v 1.7 2006/06/29 21:18:30 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLXmRadioButton.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmRadioButton.hh,v 1.7 2006/06/29 21:18:32 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLXmResources.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmResources.hh,v 1.5 2006/06/29 21:18:34 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLXmSeparator.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmSeparator.hh,v 1.6 2006/06/29 21:18:36 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLXmSliderBar.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmSliderBar.hh,v 1.7 2006/06/29 21:18:38 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLXmTextField.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmTextField.hh,v 1.7 2006/06/29 21:18:40 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLXmTopLevelShell.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmTopLevelShell.hh,v 1.6 2006/06/29 21:18:42 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLXmVWidgetComponent.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmVWidgetComponent.hh,v 1.6 2006/06/29 21:18:44 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLXmVWidgetContainer.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmVWidgetContainer.hh,v 1.6 2006/06/29 21:18:46 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLXmVWidgetObject.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmVWidgetObject.hh,v 1.6 2006/06/29 21:18:48 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLXmVWidgetShell.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmVWidgetShell.hh,v 1.6 2006/06/29 21:18:50 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLXmViewer.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmViewer.hh,v 1.10 2006/06/29 21:18:52 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLXmViewerMessenger.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmViewerMessenger.hh,v 1.4 2006/06/29 21:18:54 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929
    3030#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLFontBaseStore.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLFontBaseStore.cc,v 1.3 2006/06/29 21:18:56 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateQt.cc

    r550 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLImmediateQt.cc,v 1.11 2007/06/24 12:07:19 $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     27// $Id: G4OpenGLImmediateQt.cc,v 1.1 2007/09/28 14:44:13 lgarnier Exp $
     28// GEANT4 tag $Name: $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateQtViewer.cc

    r564 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLImmediateQtViewer.cc,v 1.16 2007/06/25 16:38:13 $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     27// $Id: G4OpenGLImmediateQtViewer.cc,v 1.1 2007/09/28 14:44:13 lgarnier Exp $
     28// GEANT4 tag $Name: $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateSceneHandler.cc

    r554 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLImmediateSceneHandler.cc,v 1.24 2006/09/04 12:03:25 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     27// $Id: G4OpenGLImmediateSceneHandler.cc,v 1.27 2007/04/04 16:50:26 allison Exp $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
     
    4747#include "G4OpenGLTransform3D.hh"
    4848#include "G4Polyline.hh"
     49#include "G4Polymarker.hh"
     50#include "G4Text.hh"
    4951#include "G4Circle.hh"
    5052#include "G4Square.hh"
    51 
    52 G4OpenGLImmediateSceneHandler::G4OpenGLImmediateSceneHandler (G4VGraphicsSystem& system,
    53                                                 const G4String& name):
    54 G4OpenGLSceneHandler (system, fSceneIdCount++, name)
     53#include "G4Scale.hh"
     54#include "G4Polyhedron.hh"
     55
     56G4OpenGLImmediateSceneHandler::G4OpenGLImmediateSceneHandler
     57(G4VGraphicsSystem& system,const G4String& name):
     58  G4OpenGLSceneHandler (system, fSceneIdCount++, name)
    5559{}
    5660
     
    6266void G4OpenGLImmediateSceneHandler::AddPrimitivePreamble(const G4Visible& visible)
    6367{
     68  if (fpViewer->GetViewParameters().IsPicking()) {
     69    glLoadName(++fPickName);
     70    fPickMap[fPickName] = 0;
     71  }
     72
    6473  const G4Colour& c = GetColour (visible);
    6574  glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
     
    7281}
    7382
     83void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4Polymarker& polymarker)
     84{
     85  AddPrimitivePreamble(polymarker);
     86  G4OpenGLSceneHandler::AddPrimitive(polymarker);
     87}
     88
     89void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4Text& text)
     90{
     91  // Note: colour is still handled in
     92  // G4OpenGLSceneHandler::AddPrimitive(const G4Text&).
     93  AddPrimitivePreamble(text);
     94  G4OpenGLSceneHandler::AddPrimitive(text);
     95}
     96
    7497void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4Circle& circle)
    7598{
     
    84107}
    85108
     109void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4Scale& scale)
     110{
     111  AddPrimitivePreamble(scale);
     112  G4OpenGLSceneHandler::AddPrimitive(scale);
     113}
     114
     115void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron)
     116{
     117  // Note: colour is still handled in
     118  // G4OpenGLSceneHandler::AddPrimitive(const G4Polyhedron&).
     119  AddPrimitivePreamble(polyhedron);
     120  G4OpenGLSceneHandler::AddPrimitive(polyhedron);
     121}
     122
     123void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4NURBS& nurbs)
     124{
     125  // Note: colour is still handled in
     126  // G4OpenGLSceneHandler::AddPrimitive(const G4NURBS&).
     127  AddPrimitivePreamble(nurbs);
     128  G4OpenGLSceneHandler::AddPrimitive(nurbs);
     129}
     130
    86131void G4OpenGLImmediateSceneHandler::BeginPrimitives
    87132(const G4Transform3D& objectTransformation) {
    88   G4VSceneHandler::BeginPrimitives (objectTransformation);
     133  G4OpenGLSceneHandler::BeginPrimitives (objectTransformation);
    89134  glPushMatrix();
    90135  G4OpenGLTransform3D oglt (objectTransformation);
     
    110155  glFlush ();
    111156
    112   G4VSceneHandler::EndPrimitives ();
     157  G4OpenGLSceneHandler::EndPrimitives ();
    113158}
    114159
    115160void G4OpenGLImmediateSceneHandler::BeginPrimitives2D()
    116161{
    117   G4VSceneHandler::BeginPrimitives2D();
     162  G4OpenGLSceneHandler::BeginPrimitives2D();
    118163
    119164  // Push current 3D world matrices and load identity to define screen
     
    122167  glPushMatrix();
    123168  glLoadIdentity();
    124   glOrtho (-1., 1., -1., 1., -DBL_MAX, DBL_MAX);
     169  glOrtho (-1., 1., -1., 1., -G4OPENGL_DBL_MAX, G4OPENGL_DBL_MAX);
    125170  glMatrixMode (GL_MODELVIEW);
    126171  glPushMatrix();
     
    139184  glFlush ();
    140185
    141   G4VSceneHandler::EndPrimitives2D ();
     186  G4OpenGLSceneHandler::EndPrimitives2D ();
    142187}
    143188
     
    151196
    152197void G4OpenGLImmediateSceneHandler::ClearTransientStore () {
     198
    153199  G4VSceneHandler::ClearTransientStore ();
     200
    154201  // Make sure screen corresponds to graphical database...
    155202  if (fpViewer) {
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateViewer.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLImmediateViewer.cc,v 1.8 2006/09/04 12:07:59 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateWin32.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLImmediateWin32.cc,v 1.11 2006/08/14 12:07:19 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateWin32Viewer.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLImmediateWin32Viewer.cc,v 1.16 2006/07/03 16:38:13 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateX.cc

    r529 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLImmediateX.cc,v 1.12 2006/08/14 12:07:19 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     27// $Id: G4OpenGLImmediateX.cc,v 1.13 2007/08/21 14:05:51 allison Exp $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
     
    4141#include "G4OpenGLImmediateXViewer.hh"
    4242#include "G4OpenGLViewerMessenger.hh"
    43 #include "G4OpenGLXViewerMessenger.hh"
    4443
    4544G4OpenGLImmediateX::G4OpenGLImmediateX ():
     
    5049{
    5150  G4OpenGLViewerMessenger::GetInstance();
    52   G4OpenGLXViewerMessenger::GetInstance();
    5351}
    5452
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateXViewer.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLImmediateXViewer.cc,v 1.16 2006/07/03 16:38:13 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateXm.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLImmediateXm.cc,v 1.13 2006/08/14 12:07:19 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateXmViewer.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLImmediateXmViewer.cc,v 1.17 2006/07/03 16:38:13 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLQtExportDialog.cc

    r589 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLQtExportDialog.cc,v 0.1 2007/09/20 15:18:20 garnier $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     27// $Id: G4OpenGLQtExportDialog.cc,v 1.2 2007/11/08 17:00:51 lgarnier Exp $
     28// GEANT4 tag $Name: $
    2929//
    3030//
     
    3434#include "G4OpenGLQtExportDialog.hh"
    3535
    36 #include <qvariant.h>
    37 #include <qpushbutton.h>
    38 #include <qcheckbox.h>
    39 #include <qlabel.h>
    40 #include <qcombobox.h>
    41 #include <qslider.h>
    42 #include <qlayout.h>
    43 #include <qgroupbox.h>
    44 #include <qradiobutton.h>
    45 #include <qimage.h>
    46 #include <qlineedit.h>
     36#include <QtCore/QVariant.h>
     37#include <QtGui/QPushButton.h>
     38#include <QtGui/QCheckBox.h>
     39#include <QtGui/QLabel.h>
     40#include <QtGui/QComboBox.h>
     41#include <QtGui/QSlider.h>
     42#include <QtGui/QLayout.h>
     43#include <QtGui/QGroupBox.h>
     44#include <QtGui/QRadioButton.h>
     45#include <QtGui/QImage.h>
     46#include <QtGui/QLineEdit.h>
    4747
    4848G4OpenGLQtExportDialog::G4OpenGLQtExportDialog(
     
    5757  originalWidth = aWidth;
    5858  originalHeight = aHeight;
     59
     60  // Initializations
     61  qualitySlider = NULL;
     62  width = NULL;
     63  height = NULL;
     64  colorButton = NULL;
     65  BWButton = NULL;
    5966
    6067  // global layout
     
    95102    //    transparencyEPS->setChecked( true );
    96103
    97     color = new QRadioButton("Color");
    98     BW = new QRadioButton("Grayscale");
    99     color->setChecked( true );
    100     BW->setChecked( false );
     104    colorButton = new QRadioButton("Color");
     105    BWButton = new QRadioButton("Grayscale");
     106    colorButton->setChecked( true );
     107    BWButton->setChecked( false );
    101108
    102109
    103110    //    EPSGroupBoxLayout->addWidget(transparencyEPS);   
    104     EPSGroupBoxLayout->addWidget(color);   
    105     EPSGroupBoxLayout->addWidget(BW);   
     111    EPSGroupBoxLayout->addWidget(colorButton);   
     112    EPSGroupBoxLayout->addWidget(BWButton);   
    106113    EPSGroupBox->setLayout(EPSGroupBoxLayout);
    107114    globalVLayout->addWidget(EPSGroupBox);
     
    217224int G4OpenGLQtExportDialog::getSliderValue()
    218225{
     226  if (!qualitySlider) return -1;
    219227  return qualitySlider->value();
    220228}
     
    222230int G4OpenGLQtExportDialog::getHeight()
    223231{
     232  if (!height) return -1;
    224233  return height->text().toInt();
    225234}
     
    227236int G4OpenGLQtExportDialog::getWidth()
    228237{
     238  if (!width) return -1;
    229239  return width->text().toInt();
    230240}
    231241
    232 int G4OpenGLQtExportDialog::getTransparency()
    233 {
     242bool G4OpenGLQtExportDialog::getTransparency()
     243{
     244  if (!boxTransparency) return -1;
    234245  return boxTransparency->isChecked();
    235246}
     
    238249{
    239250  // Black and white
    240   if (!color->isChecked())
     251  if (!colorButton->isChecked())
    241252    return 1;
    242253  // rgb color
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLQtViewer.cc

    r589 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLQtViewer.cc,v 1.17 2006/06/29 21:19:36 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     27// $Id: G4OpenGLQtViewer.cc,v 1.3 2007/11/08 17:00:51 lgarnier Exp $
     28// GEANT4 tag $Name: $
    2929//
    3030//
     
    5050#include "G4UIsession.hh"
    5151#include "G4UImanager.hh"
    52 #include <QtGui/qboxlayout.h>
    53 #include <QtGui/qdialog.h>
    54 #include <QtGui/qmenu.h>
    55 #include <QImageWriter>
    56 #include <QMessageBox>
    57 #include <QFileDialog.h>
    58 #include <QPrinter.h>
    59 #include <QPainter.h>
     52#include <QtGui/QApplication.h>
     53#include <QtGui/QBoxLayout.h>
     54#include <QtGui/QDialog.h>
     55#include <QtGui/QMenu.h>
     56#include <QtGui/QImageWriter>
     57#include <QtGui/QMessageBox>
     58#include <QtGui/QFileDialog.h>
     59#include <QtGui/QPrinter.h>
     60#include <QtGui/QPainter.h>
     61#include <QtOpenGL/QGLWidget>
     62#include <QtGui/QDialog>
     63#include <QtGui/QContextMenuEvent>
     64#include <QtGui/QMenu>
     65#include <QtGui/QImage>
     66
    6067
    6168//////////////////////////////////////////////////////////////////////////////
     
    683690  G4OpenGLQtExportDialog* exportDialog= new G4OpenGLQtExportDialog(GLWindow,nomFich,fWindow->height(),fWindow->width());
    684691  if(  exportDialog->exec()) {
    685    
    686     printf("rescaling before\n");
    687     //    QPixmap * pixmap = new QPixmap(fWindow->renderPixmap (exportDialog->getWidth(),exportDialog->getHeight() )) ;
    688     QImage image = fWindow->grabFrameBuffer();
    689     printf("rescaling after\n");
     692
     693    QImage image;
     694    //    if ((exportDialog->getWidth() !=fWindow->width()) ||
     695    //        (exportDialog->getHeight() !=fWindow->height())) {
    690696     
    691    
    692     if ((exportDialog->getWidth() !=fWindow->width()) ||
    693          (exportDialog->getWidth() !=fWindow->width())) {
    694 
    695697      //      rescaleImage(exportDialog->getWidth(),exportDialog->getHeight());// re-scale image
    696698      printf("rescaling\n");
    697     }
    698    
     699      QGLWidget* glResized = fWindow;
     700      fWindow->renderPixmap (exportDialog->getWidth()*2,exportDialog->getHeight()*2 ).save("/Users/laurentgarnier/Desktop/zzz.jpg","jpg");
     701      QPixmap * pixmap = new QPixmap(fWindow->renderPixmap (exportDialog->getWidth(),exportDialog->getHeight() )) ;
     702      //      image = pixmap.toImage();
     703      //      glResized->resize(exportDialog->getWidth()*2,exportDialog->getHeight()*2);
     704      printf("rescaling after\n");
     705      //      image = glResized->grabFrameBuffer();
     706     
     707      //    } else {
     708      // image = fWindow->grabFrameBuffer();
     709      //  }   
    699710    // jpeg format
    700711    if (nomFich.endsWith(".jpg") ||
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLSceneHandler.cc

    r529 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLSceneHandler.cc,v 1.45 2006/08/30 11:37:34 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     27// $Id: G4OpenGLSceneHandler.cc,v 1.51 2007/05/25 15:41:38 allison Exp $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
     
    5252#include "G4Transform3D.hh"
    5353#include "G4Polyline.hh"
     54#include "G4Polymarker.hh"
    5455#include "G4Text.hh"
    5556#include "G4Circle.hh"
     
    6465#include "G4Scene.hh"
    6566#include "G4VisExtent.hh"
     67#include "G4AttHolder.hh"
    6668
    6769G4OpenGLSceneHandler::G4OpenGLSceneHandler (G4VGraphicsSystem& system,
    6870                              G4int id,
    6971                              const G4String& name):
    70   G4VSceneHandler (system, id, name)
     72  G4VSceneHandler (system, id, name),
     73  fPickName(0),
     74  fProcessingPolymarker(false)
    7175{}
    7276
     
    9498  0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55
    9599};
     100
     101void G4OpenGLSceneHandler::ClearAndDestroyAtts()
     102{
     103  std::map<GLuint, G4AttHolder*>::iterator i;
     104  for (i = fPickMap.begin(); i != fPickMap.end(); ++i) delete i->second;
     105  fPickMap.clear();
     106}
     107
     108void G4OpenGLSceneHandler::PreAddSolid
     109(const G4Transform3D& objectTransformation,
     110 const G4VisAttributes& visAttribs)
     111{
     112  G4VSceneHandler::PreAddSolid (objectTransformation, visAttribs);
     113}
     114
     115void G4OpenGLSceneHandler::BeginPrimitives
     116(const G4Transform3D& objectTransformation)
     117{
     118  G4VSceneHandler::BeginPrimitives (objectTransformation);
     119}
     120
     121void G4OpenGLSceneHandler::EndPrimitives ()
     122{
     123  G4VSceneHandler::EndPrimitives ();
     124}
     125
     126void G4OpenGLSceneHandler::BeginPrimitives2D ()
     127{
     128  G4VSceneHandler::BeginPrimitives2D ();
     129}
     130
     131void G4OpenGLSceneHandler::EndPrimitives2D ()
     132{
     133  G4VSceneHandler::EndPrimitives2D ();
     134}
    96135
    97136const G4Polyhedron* G4OpenGLSceneHandler::CreateSectionPolyhedron ()
     
    120159  if (nPoints <= 0) return;
    121160
     161  // Loads G4Atts for picking...
     162  if (fpViewer->GetViewParameters().IsPicking()) {
     163    G4AttHolder* holder = new G4AttHolder;
     164    LoadAtts(line, holder);
     165    fPickMap[fPickName] = holder;
     166  }
     167
    122168  // Note: colour treated in sub-class.
    123169
     
    128174  glDisable (GL_LIGHTING);
    129175
    130   G4double lineWidth = GetLineWidth(line);
     176  // Get vis attributes - pick up defaults if none.
     177  const G4VisAttributes* pVA =
     178    fpViewer -> GetApplicableVisAttributes (line.GetVisAttributes ());
     179
     180  G4double lineWidth = GetLineWidth(pVA);
    131181  glLineWidth(lineWidth);
    132182
     
    142192}
    143193
     194void G4OpenGLSceneHandler::AddPrimitive (const G4Polymarker& polymarker)
     195{
     196  G4int nPoints = polymarker.size ();
     197  if (nPoints <= 0) return;
     198
     199  fProcessingPolymarker = true;
     200
     201  // Loads G4Atts for picking...
     202  if (fpViewer->GetViewParameters().IsPicking()) {
     203    G4AttHolder* holder = new G4AttHolder;
     204    LoadAtts(polymarker, holder);
     205    fPickMap[fPickName] = holder;
     206  }
     207
     208  switch (polymarker.GetMarkerType()) {
     209  default:
     210  case G4Polymarker::dots:
     211    {
     212      for (size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
     213        G4Circle dot (polymarker);
     214        dot.SetPosition (polymarker[iPoint]);
     215        dot.SetWorldSize  (0.);
     216        dot.SetScreenSize (0.1);  // Very small circle.
     217        G4OpenGLSceneHandler::AddPrimitive (dot);
     218      }
     219    }
     220    break;
     221  case G4Polymarker::circles:
     222    {
     223      for (size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
     224        G4Circle circle (polymarker);
     225        circle.SetPosition (polymarker[iPoint]);
     226        G4OpenGLSceneHandler::AddPrimitive (circle);
     227      }
     228    }
     229    break;
     230  case G4Polymarker::squares:
     231    {
     232      for (size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
     233        G4Square square (polymarker);
     234        square.SetPosition (polymarker[iPoint]);
     235        G4OpenGLSceneHandler::AddPrimitive (square);
     236      }
     237    }
     238    break;
     239  }
     240
     241  fProcessingPolymarker = false;
     242}
     243
    144244void G4OpenGLSceneHandler::AddPrimitive (const G4Text& text) {
     245
     246  // Loads G4Atts for picking...
     247  if (fpViewer->GetViewParameters().IsPicking()) {
     248    G4AttHolder* holder = new G4AttHolder;
     249    LoadAtts(text, holder);
     250    fPickMap[fPickName] = holder;
     251  }
    145252
    146253  const G4Colour& c = GetTextColour (text);  // Picks up default if none.
     
    175282  glDisable (GL_LIGHTING);
    176283 
    177   glRasterPos3f(position.x(),position.y(),position.z());
     284  glRasterPos3d(position.x(),position.y(),position.z());
    178285  // No action on offset or layout at present.
    179286  glPushAttrib(GL_LIST_BIT);
     
    185292void G4OpenGLSceneHandler::AddPrimitive (const G4Circle& circle) {
    186293  glEnable (GL_POINT_SMOOTH);
    187   AddCircleSquare (circle, 24);
     294  AddCircleSquare (circle, G4OpenGLBitMapStore::circle);
    188295}
    189296
    190297void G4OpenGLSceneHandler::AddPrimitive (const G4Square& square) {
    191298  glDisable (GL_POINT_SMOOTH);
    192   AddCircleSquare (square, 4);
     299  AddCircleSquare (square, G4OpenGLBitMapStore::square);
    193300}
    194301
    195302void G4OpenGLSceneHandler::AddCircleSquare
    196303(const G4VMarker& marker,
    197  G4int nSides) {
     304 G4OpenGLBitMapStore::Shape shape) {
     305
     306  if (!fProcessingPolymarker) {  // Polymarker has already loaded atts.
     307    // Loads G4Atts for picking...
     308    if (fpViewer->GetViewParameters().IsPicking()) {
     309      G4AttHolder* holder = new G4AttHolder;
     310      LoadAtts(marker, holder);
     311      fPickMap[fPickName] = holder;
     312    }
     313  }
    198314
    199315  // Note: colour treated in sub-class.
     
    205321  glDisable (GL_LIGHTING);
    206322 
    207   G4double lineWidth = GetLineWidth(marker);
     323  // Get vis attributes - pick up defaults if none.
     324  const G4VisAttributes* pVA =
     325    fpViewer -> GetApplicableVisAttributes (marker.GetVisAttributes ());
     326
     327  G4double lineWidth = GetLineWidth(pVA);
    208328  glLineWidth(lineWidth);
    209329
    210330  G4VMarker::FillStyle style = marker.GetFillStyle();
     331
     332  G4bool filled = false;
     333  static G4bool hashedWarned = false;
    211334 
    212335  switch (style) {
    213336  case G4VMarker::noFill:
    214337    glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
     338    filled = false;
    215339    break;
    216340   
    217341  case G4VMarker::hashed:
    218     /*
    219     G4cout << "Hashed fill style in G4OpenGLSceneHandler."
    220            << "\n  Not implemented.  Using G4VMarker::filled."
    221            << G4endl;
    222     */
    223     glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
    224     glPolygonStipple (fStippleMaskHashed);
    225     // See also:
    226     //   if (style == G4VMarker::filled || style == G4VMarker::hashed)...
    227     // (twice) below.
    228     break;
     342    if (!hashedWarned) {
     343      G4cout << "Hashed fill style in G4OpenGLSceneHandler."
     344             << "\n  Not implemented.  Using G4VMarker::filled."
     345             << G4endl;
     346      hashedWarned = true;
     347    }
     348    // Maybe use
     349    //glPolygonStipple (fStippleMaskHashed);
     350    // Drop through to filled...
    229351   
    230352  case G4VMarker::filled:
    231353    glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
     354    filled = true;
    232355    break;
    233356   
    234   default:
    235     G4cout << "Unrecognised fill style in G4OpenGLSceneHandler."
    236            << "\n  Using G4VMarker::filled."
    237            << G4endl;
    238     glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
    239     break;
    240    
    241357  }
    242358
    243359  // A few useful quantities...
    244360  G4Point3D centre = marker.GetPosition();
    245   const G4Vector3D& viewpointDirection =
    246     fpViewer -> GetViewParameters().GetViewpointDirection();
    247   const G4Vector3D& up = fpViewer->GetViewParameters().GetUpVector();
    248361  MarkerSizeType sizeType;
    249362  G4double size = GetMarkerSize(marker, sizeType);
    250363
    251   // Find "size" of marker in world space (but see note below)...
    252   G4double worldSize;
     364  // Draw...
    253365  if (sizeType == world) {  // Size specified in world coordinates.
    254     worldSize = size;
    255   }
    256   else { // Size specified in screen (window) coordinates.
    257 
    258     // Find window coordinates of centre...
    259     GLdouble modelMatrix[16];
    260     glGetDoublev (GL_MODELVIEW_MATRIX, modelMatrix);
    261     G4double projectionMatrix[16];
    262     glGetDoublev (GL_PROJECTION_MATRIX, projectionMatrix);
    263     GLint viewport[4];
    264     glGetIntegerv(GL_VIEWPORT,viewport);
    265     GLdouble winx, winy, winz;
    266     gluProject(centre.x(), centre.y(), centre.z(),
    267                modelMatrix, projectionMatrix, viewport,
    268                &winx, &winy, &winz);
    269 
    270     // Determine ratio window:world...
    271     const G4Vector3D inScreen = (up.cross(viewpointDirection)).unit();
    272     const G4Vector3D p = centre + inScreen;
    273     GLdouble winDx, winDy, winDz;
    274     gluProject(p.x(), p.y(), p.z(),
    275                modelMatrix, projectionMatrix, viewport,
    276                &winDx, &winDy, &winDz);
    277     G4double winWorldRatio = std::sqrt(std::pow(winx - winDx, 2) +
    278                                   std::pow(winy - winDy, 2));
    279     worldSize = size / winWorldRatio;
    280   }
    281 
    282   // Draw...
    283   DrawXYPolygon (worldSize, centre, nSides);
    284 }
    285 
    286 /***************************************************
    287 Note: We have to do it this way round so that when a global
    288 transformation is applied, such as with /vis/viewer/set/viewpoint,
    289 the markers follow the world coordinates without having to
    290 recreate the display lists.  The down side is that the markers
    291 rotate.  The only way to avoid this is to play with the modelview
    292 and projection matrices of OpenGL - which I need to think about.
    293 For future reference, here is the code to draw in window
    294 coordinates; its down side is that markers do not follow global
    295 transformations.  Some clever stuff is needed.
    296 
    297   ...
    298   // Find window coordinates of centre...
    299   GLdouble modelMatrix[16];
    300   glGetDoublev (GL_MODELVIEW_MATRIX, modelMatrix);
    301   G4double projectionMatrix[16];
    302   glGetDoublev (GL_PROJECTION_MATRIX, projectionMatrix);
    303   GLint viewport[4];
    304   glGetIntegerv(GL_VIEWPORT,viewport);
    305   GLdouble winx, winy, winz;
    306   gluProject(centre.x(), centre.y(), centre.z(),
    307              modelMatrix, projectionMatrix, viewport,
    308              &winx, &winy, &winz);
    309 
    310   // Find window size...
    311   G4double winSize;
    312   if (size) {  // Size specified in world coordinates.
    313     // Determine size in window coordinates...
    314     (Note: improve this by using an inScreen vector as above.)
    315     GLdouble winx1, winy1, winz1;
    316     gluProject(centre.x() + size, centre.y() + size, centre.z() + size,
    317                modelMatrix, projectionMatrix, viewport,
    318                &winx1, &winy1, &winz1);
    319     winSize = std::sqrt((std::pow(winx - winx1, 2) +
    320                     std::pow(winy - winy1, 2) +
    321                     std::pow(winz - winz1, 2)) / 3.);
    322   }
    323   else {
    324     winSize = scale *
    325       userSpecified ? marker.GetScreenSize() : def.GetScreenSize();
    326   }
    327 
    328   // Prepare to draw in window coordinates...
    329   glMatrixMode (GL_PROJECTION);
    330   glPushMatrix();
    331   glLoadIdentity();
    332   gluOrtho2D(GLdouble(viewport[0]),
    333              GLdouble(viewport[0] + viewport[2]),
    334              GLdouble(viewport[1]),
    335              GLdouble(viewport[1] + viewport[3]));
    336   glMatrixMode (GL_MODELVIEW);
    337   glPushMatrix();
    338   glLoadIdentity();
    339 
    340   // Draw in window coordinates...
    341   DrawScreenPolygon (winSize, G4Point3D(winx, winy, winz), nSides);
    342 
    343   // Re-instate matrices...
    344   glMatrixMode (GL_PROJECTION);
    345   glPopMatrix();
    346   glMatrixMode (GL_MODELVIEW);
    347   glPopMatrix();
    348   ...
    349 }
    350 
    351 void G4OpenGLSceneHandler::DrawScreenPolygon
    352 (G4double size,
     366
     367    DrawXYPolygon (shape, size, centre, pVA);
     368
     369  } else { // Size specified in screen (window) coordinates.
     370
     371    glRasterPos3d(centre.x(),centre.y(),centre.z());
     372    const GLubyte* marker =
     373      G4OpenGLBitMapStore::GetBitMap(shape, size, filled);
     374    glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
     375    glBitmap(GLsizei(size), GLsizei(size), size/2., size/2., 0., 0., marker);
     376  }
     377}
     378
     379void G4OpenGLSceneHandler::DrawXYPolygon
     380(G4OpenGLBitMapStore::Shape shape,
     381 G4double size,
    353382 const G4Point3D& centre,
    354  G4int nSides) {
    355   glBegin (GL_POLYGON);
    356   const G4double dPhi = twopi / nSides;
    357   const G4double r = size / 2.;
    358   G4double phi;
    359   G4int i;
    360   for (i = 0, phi = -dPhi / 2.; i < nSides; i++, phi += dPhi) {
    361     G4double x, y, z;
    362     x = centre.x() + r * std::cos(phi);
    363     y = centre.y() + r * std::sin(phi);
    364     z = centre.z();
    365     glVertex3d (x, y, z);
    366   }
    367   glEnd ();
    368 }
    369 **********************************************/
    370 
    371 void G4OpenGLSceneHandler::DrawXYPolygon
    372 (G4double size,
    373  const G4Point3D& centre,
    374  G4int nSides) {
     383 const G4VisAttributes* pApplicableVisAtts)
     384{
     385  G4int nSides;
     386  G4double startPhi;
     387  if (shape == G4OpenGLBitMapStore::circle) {
     388    nSides = GetNoOfSides(pApplicableVisAtts);
     389    startPhi = 0.;
     390  } else {
     391    nSides = 4;
     392    startPhi = -pi / 4.;
     393  }
     394
    375395  const G4Vector3D& viewpointDirection =
    376396    fpViewer -> GetViewParameters().GetViewpointDirection();
     
    381401  G4double phi;
    382402  G4int i;
     403
    383404  glBegin (GL_POLYGON);
    384   for (i = 0, phi = 0.; i < nSides; i++, phi += dPhi) {
     405  for (i = 0, phi = startPhi; i < nSides; i++, phi += dPhi) {
    385406    G4Vector3D r = start; r.rotate(phi, viewpointDirection);
    386407    G4Vector3D p = centre + r;
     
    388409  }
    389410  glEnd ();
     411}
     412
     413void G4OpenGLSceneHandler::AddPrimitive (const G4Scale& scale)
     414{
     415  G4VSceneHandler::AddPrimitive(scale);
    390416}
    391417
     
    398424  if (polyhedron.GetNoFacets() == 0) return;
    399425
     426  // Loads G4Atts for picking...
     427  if (fpViewer->GetViewParameters().IsPicking()) {
     428    G4AttHolder* holder = new G4AttHolder;
     429    LoadAtts(polyhedron, holder);
     430    fPickMap[fPickName] = holder;
     431  }
     432
    400433  // Get vis attributes - pick up defaults if none.
    401434  const G4VisAttributes* pVA =
     
    410443  G4OpenGLViewer* pViewer = dynamic_cast<G4OpenGLViewer*>(fpViewer);
    411444  if (pViewer) transparency_enabled = pViewer->transparency_enabled;
    412   const G4Colour& c = GetColour (polyhedron);
     445  const G4Colour& c = pVA->GetColour();
    413446  GLfloat materialColour [4];
    414447  materialColour [0] = c.GetRed ();
     
    421454  }
    422455
    423   G4double lineWidth = GetLineWidth(polyhedron);
     456  G4double lineWidth = GetLineWidth(pVA);
    424457  glLineWidth(lineWidth);
    425458
     
    681714void G4OpenGLSceneHandler::AddPrimitive (const G4NURBS& nurb) {
    682715
     716  // Loads G4Atts for picking...
     717  if (fpViewer->GetViewParameters().IsPicking()) {
     718    G4AttHolder* holder = new G4AttHolder;
     719    LoadAtts(nurb, holder);
     720    fPickMap[fPickName] = holder;
     721  }
     722
    683723  GLUnurbsObj *gl_nurb;
    684724  gl_nurb = gluNewNurbsRenderer ();
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredQt.cc

    r564 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLStoredQt.cc,v 1.11 2007/06/24 12:07:19 $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     27// $Id: G4OpenGLStoredQt.cc,v 1.1 2007/09/28 14:44:13 lgarnier Exp $
     28// GEANT4 tag $Name: $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredQtViewer.cc

    r579 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLStoredQtViewer.cc,v 1.16 2007/06/25 16:38:13 $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     27// $Id: G4OpenGLStoredQtViewer.cc,v 1.2 2007/11/08 17:00:51 lgarnier Exp $
     28// GEANT4 tag $Name: $
    2929//
    3030//
     
    3838
    3939#include "G4ios.hh"
     40
     41#include <QtGui/QMouseEvent>
     42#include <QtGui/QContextMenuEvent>
    4043
    4144G4OpenGLStoredQtViewer::G4OpenGLStoredQtViewer
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredSceneHandler.cc

    r529 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLStoredSceneHandler.cc,v 1.31 2006/08/30 11:43:57 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     27// $Id: G4OpenGLStoredSceneHandler.cc,v 1.34 2007/04/04 16:50:27 allison Exp $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
     
    4646#include "G4PhysicalVolumeModel.hh"
    4747#include "G4VPhysicalVolume.hh"
     48#include "G4LogicalVolume.hh"
    4849#include "G4Polyline.hh"
    4950#include "G4Polymarker.hh"
     51#include "G4Text.hh"
    5052#include "G4Circle.hh"
    5153#include "G4Square.hh"
     54#include "G4Polyhedron.hh"
     55#include "G4AttHolder.hh"
    5256
    5357G4OpenGLStoredSceneHandler::G4OpenGLStoredSceneHandler (G4VGraphicsSystem& system,
     
    5660fMemoryForDisplayLists (true),
    5761fAddPrimitivePreambleNestingDepth (0),
    58 fTopPODL (0)
     62fTopPODL (0),
     63fProcessing2D (false)
    5964{}
    6065
     
    6974  if (fAddPrimitivePreambleNestingDepth > 1) return;
    7075
     76  // Because of our need to control colour of transients (display by
     77  // time fading), display lists may only cover a single primitive.
     78  // So display list setup is here.
     79
     80  if (fpViewer->GetViewParameters().IsPicking()) {
     81    fPickMap[++fPickName] = 0;
     82  }
     83
    7184  const G4Colour& c = GetColour (visible);
    72 
    73   if (fMemoryForDisplayLists && fReadyForTransients) {
    74 
    75     TO& to = fTOList.back();  // Transient object information.
    76 
    77     // Get vis attributes - pick up defaults if none.
    78     const G4VisAttributes* pVA =
    79       fpViewer->GetApplicableVisAttributes(visible.GetVisAttributes());
    80 
    81     // Get time information from vis attributes.
    82     to.fStartTime = pVA->GetStartTime();
    83     to.fEndTime = pVA->GetEndTime();
    84 
    85     // Keep colour out of (already started) display list so that it
    86     // can be applied independently.
    87     glEndList();
    88     glDeleteLists(fDisplayListId, 1);
    89     to.fColour = c;
    90     glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
    91     glNewList (fDisplayListId, GL_COMPILE_AND_EXECUTE);
    92      
    93   } else {
    94 
    95     // Make sure colour is set in other cases.
    96     glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
    97   }
    98 }
    99 
    100 void G4OpenGLStoredSceneHandler::AddPrimitivePostamble()
    101 {
    102   fAddPrimitivePreambleNestingDepth--;
    103 }
    104 
    105 void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Polyline& polyline)
    106 {
    107   AddPrimitivePreamble(polyline);
    108   G4OpenGLSceneHandler::AddPrimitive(polyline);
    109   AddPrimitivePostamble();
    110 }
    111 
    112 void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Circle& circle)
    113 {
    114   AddPrimitivePreamble(circle);
    115   G4OpenGLSceneHandler::AddPrimitive(circle);
    116   AddPrimitivePostamble();
    117 }
    118 
    119 void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Square& square)
    120 {
    121   AddPrimitivePreamble(square);
    122   G4OpenGLSceneHandler::AddPrimitive(square);
    123   AddPrimitivePostamble();
    124 }
    125 
    126 void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Polymarker& polymarker)
    127 {
    128   AddPrimitivePreamble(polymarker);
    129   G4OpenGLSceneHandler::AddPrimitive(polymarker);
    130   AddPrimitivePostamble();
    131 }
    132 
    133 void G4OpenGLStoredSceneHandler::BeginPrimitives
    134 (const G4Transform3D& objectTransformation) {
    135  
    136   G4VSceneHandler::BeginPrimitives (objectTransformation);
    13785
    13886  if (fMemoryForDisplayLists) {
    13987    fDisplayListId = glGenLists (1);
    14088    if (!fDisplayListId) {  // Could pre-allocate?
    141       G4cout << "********************* WARNING! ********************\n"
    142            <<"Unable to allocate any more display lists in OpenGL.\n "
    143            << "      Continuing drawing in IMMEDIATE MODE.\n"
    144            << "***************************************************" << G4endl;
     89      G4cout <<
     90        "********************* WARNING! ********************"
     91        "\nUnable to allocate any more display lists in OpenGL."
     92        "\n     Continuing drawing in IMMEDIATE MODE."
     93        "\n***************************************************"
     94             << G4endl;
    14595      fMemoryForDisplayLists = false;
    14696    }
     
    14898  if (fMemoryForDisplayLists) {
    14999    if (fReadyForTransients) {
    150       TO to(fDisplayListId, objectTransformation);
     100      TO to(fDisplayListId, *fpObjectTransformation);
     101      to.fPickName = fPickName;
     102      to.fColour = c;
     103      const G4VisAttributes* pVA =
     104        fpViewer->GetApplicableVisAttributes(visible.GetVisAttributes());
     105      to.fStartTime = pVA->GetStartTime();
     106      to.fEndTime = pVA->GetEndTime();
    151107      fTOList.push_back(to);
    152108      glDrawBuffer (GL_FRONT);
    153109      glPushMatrix();
    154       G4OpenGLTransform3D oglt (objectTransformation);
     110      G4OpenGLTransform3D oglt (*fpObjectTransformation);
    155111      glMultMatrixd (oglt.GetGLMatrix ());
     112      glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
    156113      glNewList (fDisplayListId, GL_COMPILE_AND_EXECUTE);
    157114    }
    158115    else {
    159       fPOList.push_back(PO(fDisplayListId, objectTransformation));
     116      PO po(fDisplayListId, *fpObjectTransformation);
     117      po.fPickName = fPickName;
     118      fPOList.push_back(po);
    160119      glNewList (fDisplayListId, GL_COMPILE);
     120      glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
    161121    }
    162122  } else {
    163123    glDrawBuffer (GL_FRONT);
    164124    glPushMatrix();
    165     G4OpenGLTransform3D oglt (objectTransformation);
     125    G4OpenGLTransform3D oglt (*fpObjectTransformation);
    166126    glMultMatrixd (oglt.GetGLMatrix ());
    167   }
    168 }
    169 
    170 void G4OpenGLStoredSceneHandler::EndPrimitives () {
     127    glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
     128  }
     129
     130  if (fProcessing2D) {
     131    // Push current 3D world matrices and load identity to define screen
     132    // coordinates...
     133    glMatrixMode (GL_PROJECTION);
     134    glPushMatrix();
     135    glLoadIdentity();
     136    glOrtho (-1., 1., -1., 1., -G4OPENGL_DBL_MAX, G4OPENGL_DBL_MAX);
     137    glMatrixMode (GL_MODELVIEW);
     138    glPushMatrix();
     139    glLoadIdentity();
     140  }
     141}
     142
     143void G4OpenGLStoredSceneHandler::AddPrimitivePostamble()
     144{
     145  if (fProcessing2D) {
     146    // Pop current 3D world matrices back again...
     147    glMatrixMode (GL_PROJECTION);
     148    glPopMatrix();
     149    glMatrixMode (GL_MODELVIEW);
     150    glPopMatrix();
     151  }
     152
    171153  if (fMemoryForDisplayLists) {
    172154    glEndList();
     
    177159    glDrawBuffer (GL_BACK);
    178160  }
    179   G4VSceneHandler::EndPrimitives ();
     161  fAddPrimitivePreambleNestingDepth--;
     162}
     163
     164void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Polyline& polyline)
     165{
     166  AddPrimitivePreamble(polyline);
     167  G4OpenGLSceneHandler::AddPrimitive(polyline);
     168  AddPrimitivePostamble();
     169}
     170
     171void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Polymarker& polymarker)
     172{
     173  AddPrimitivePreamble(polymarker);
     174  G4OpenGLSceneHandler::AddPrimitive(polymarker);
     175  AddPrimitivePostamble();
     176}
     177
     178void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Text& text)
     179{
     180  // Note: colour is still handled in
     181  // G4OpenGLSceneHandler::AddPrimitive(const G4Text&), so it still
     182  // gets into the display list
     183  AddPrimitivePreamble(text);
     184  G4OpenGLSceneHandler::AddPrimitive(text);
     185  AddPrimitivePostamble();
     186}
     187
     188void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Circle& circle)
     189{
     190  AddPrimitivePreamble(circle);
     191  G4OpenGLSceneHandler::AddPrimitive(circle);
     192  AddPrimitivePostamble();
     193}
     194
     195void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Square& square)
     196{
     197  AddPrimitivePreamble(square);
     198  G4OpenGLSceneHandler::AddPrimitive(square);
     199  AddPrimitivePostamble();
     200}
     201
     202void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Scale& scale)
     203{
     204  // Let base class split into primitives.
     205  G4OpenGLSceneHandler::AddPrimitive(scale);
     206}
     207
     208void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron)
     209{
     210  // Note: colour is still handled in
     211  // G4OpenGLSceneHandler::AddPrimitive(const G4Polyhedron&), so it still
     212  // gets into the display list
     213  AddPrimitivePreamble(polyhedron);
     214  G4OpenGLSceneHandler::AddPrimitive(polyhedron);
     215  AddPrimitivePostamble();
     216}
     217
     218void G4OpenGLStoredSceneHandler::AddPrimitive (const G4NURBS& nurbs)
     219{
     220  // Note: colour is still handled in
     221  // G4OpenGLSceneHandler::AddPrimitive(const G4NURBS&), so it still
     222  // gets into the display list
     223  AddPrimitivePreamble(nurbs);
     224  G4OpenGLSceneHandler::AddPrimitive(nurbs);
     225  AddPrimitivePostamble();
     226}
     227
     228void G4OpenGLStoredSceneHandler::BeginPrimitives
     229(const G4Transform3D& objectTransformation)
     230
     231  G4OpenGLSceneHandler::BeginPrimitives (objectTransformation);
     232
     233  // Display list setup moved to AddPrimitivePreamble.  See notes there.
     234}
     235
     236void G4OpenGLStoredSceneHandler::EndPrimitives ()
     237{
     238  G4OpenGLSceneHandler::EndPrimitives ();
    180239}
    181240
    182241void G4OpenGLStoredSceneHandler::BeginPrimitives2D()
    183242{
    184   G4VSceneHandler::BeginPrimitives2D();
    185 
    186   if (fMemoryForDisplayLists) {
    187     fDisplayListId = glGenLists (1);
    188     if (!fDisplayListId) {  // Could pre-allocate?
    189       G4cout << "********************* WARNING! ********************\n"
    190            <<"Unable to allocate any more display lists in OpenGL.\n "
    191            << "      Continuing drawing in IMMEDIATE MODE.\n"
    192            << "***************************************************" << G4endl;
    193       fMemoryForDisplayLists = false;
    194     }
    195   }
    196   if (fMemoryForDisplayLists) {
    197     if (fReadyForTransients) {
    198       fTOList.push_back(TO(fDisplayListId));
    199       glDrawBuffer (GL_FRONT);
    200       glNewList (fDisplayListId, GL_COMPILE_AND_EXECUTE);
    201     }
    202     else {
    203       fPOList.push_back(PO(fDisplayListId));
    204       glNewList (fDisplayListId, GL_COMPILE);
    205     }
    206   } else {
    207     glDrawBuffer (GL_FRONT);
    208   }
    209   // Push current 3D world matrices and load identity to define screen
    210   // coordinates...
    211   glMatrixMode (GL_PROJECTION);
    212   glPushMatrix();
    213   glLoadIdentity();
    214   glOrtho (-1., 1., -1., 1., -DBL_MAX, DBL_MAX);
    215   glMatrixMode (GL_MODELVIEW);
    216   glPushMatrix();
    217   glLoadIdentity();
     243  G4OpenGLSceneHandler::BeginPrimitives2D();
     244  fProcessing2D = true;
    218245}
    219246
    220247void G4OpenGLStoredSceneHandler::EndPrimitives2D ()
    221248{
    222   // Pop current 3D world matrices back again...
    223   glMatrixMode (GL_PROJECTION);
    224   glPopMatrix();
    225   glMatrixMode (GL_MODELVIEW);
    226   glPopMatrix();
    227 
    228   if (fMemoryForDisplayLists) {
    229     glEndList();
    230   }
    231   if (fReadyForTransients || !fMemoryForDisplayLists) {
    232     glFlush ();
    233     glDrawBuffer (GL_BACK);
    234   }
    235   G4VSceneHandler::EndPrimitives2D ();
     249  fProcessing2D = false;
     250  G4OpenGLSceneHandler::EndPrimitives2D ();
    236251}
    237252
     
    253268      "  display List for fTopPODL - try OpenGL Immediated mode."
    254269           << G4endl;
    255   }
    256   else {
     270  } else {
    257271    glNewList (fTopPODL, GL_COMPILE_AND_EXECUTE); {
    258272      for (size_t i = 0; i < fPOList.size (); i++) {
     
    260274        G4OpenGLTransform3D oglt (fPOList[i].fTransform);
    261275        glMultMatrixd (oglt.GetGLMatrix ());
     276        if (fpViewer->GetViewParameters().IsPicking())
     277          glLoadName(fPOList[i].fPickName);
    262278        glCallList (fPOList[i].fDisplayListId);
    263279        glPopMatrix();
     
    288304  fPOList.clear ();
    289305  fSolidMap.clear ();
     306  ClearAndDestroyAtts();
    290307
    291308  // ...and clear transient store...
     
    375392        (fSolidMap.find (pSolid) != fSolidMap.end ())) {
    376393      fDisplayListId = fSolidMap [pSolid];
    377       fPOList.push_back(PO(fDisplayListId,*fpObjectTransformation));
     394      PO po(fDisplayListId,*fpObjectTransformation);
     395      if (fpViewer->GetViewParameters().IsPicking()) {
     396        G4AttHolder* holder = new G4AttHolder;
     397        // Load G4Atts from G4VisAttributes, if any...
     398        const G4VisAttributes* va = pPVModel->GetCurrentLV()->GetVisAttributes();
     399        if (va) {
     400          const std::map<G4String,G4AttDef>* vaDefs = va->GetAttDefs();
     401          if (vaDefs) holder->AddAtts(va->CreateAttValues(), vaDefs);
     402        }
     403        // Load G4Atts from G4PhysicalVolumeModel...
     404        const std::map<G4String,G4AttDef>* defs = pPVModel->GetAttDefs();
     405        if (defs) holder->AddAtts(pPVModel->CreateCurrentAttValues(), defs);
     406        fPickMap[++fPickName] = holder;
     407        po.fPickName = fPickName;
     408      }
     409      fPOList.push_back(po);
    378410    }
    379411    else {
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredViewer.cc

    r564 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLStoredViewer.cc,v 1.20 2006/10/24 06:23:18 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     27// $Id: G4OpenGLStoredViewer.cc,v 1.23 2007/04/04 16:50:27 allison Exp $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
     
    8888      (lastVP.GetNoOfSides ()       != fVP.GetNoOfSides ())       ||
    8989      (lastVP.IsMarkerNotHidden ()  != fVP.IsMarkerNotHidden ())  ||
    90       (lastVP.GetBackgroundColour ()!= fVP.GetBackgroundColour ())
    91       ) {
    92     return true;
    93   }
    94 
     90      (lastVP.GetBackgroundColour ()!= fVP.GetBackgroundColour ())||
     91      (lastVP.IsPicking ()          != fVP.IsPicking ())
     92      )
     93    return true;
     94 
    9595  if (lastVP.IsDensityCulling () &&
    9696      (lastVP.GetVisibleDensity () != fVP.GetVisibleDensity ()))
     
    142142    }
    143143
    144     if (fG4OpenGLStoredSceneHandler.fTopPODL)
     144    if (fG4OpenGLStoredSceneHandler.fTopPODL) 
    145145      glCallList (fG4OpenGLStoredSceneHandler.fTopPODL);
    146     size_t tmp_size = fG4OpenGLStoredSceneHandler.fTOList.size();
    147     G4double bsf = 1.;  // Brightness scaling factor.
    148     for (size_t i = 0; i < tmp_size; ++i) {
     146
     147    for (size_t i = 0; i < fG4OpenGLStoredSceneHandler.fTOList.size(); ++i) {
    149148      G4OpenGLStoredSceneHandler::TO& to =
    150149        fG4OpenGLStoredSceneHandler.fTOList[i];
    151       if ((!(to.fEndTime < fStartTime ))&& (!(to.fStartTime > fEndTime))) {
     150      if (to.fEndTime >= fStartTime && to.fStartTime <= fEndTime) {
    152151        glPushMatrix();
    153152        G4OpenGLTransform3D oglt (to.fTransform);
    154153        glMultMatrixd (oglt.GetGLMatrix ());
     154        if (fVP.IsPicking()) glLoadName(to.fPickName);
    155155        G4Colour& c = to.fColour;
     156        G4double bsf = 1.;  // Brightness scaling factor.
    156157        if (fFadeFactor > 0. && to.fEndTime < fEndTime)
    157158          bsf = 1. - fFadeFactor *
     
    167168
    168169  // Display time at "head" of time range, which is fEndTime...
    169   if (fDisplayHeadTime && fEndTime < DBL_MAX) {
     170  if (fDisplayHeadTime && fEndTime < G4OPENGL_DBL_MAX) {
    170171    glMatrixMode (GL_PROJECTION);
    171172    glPushMatrix();
    172173    glLoadIdentity();
    173     glOrtho (-1., 1., -1., 1., -DBL_MAX, DBL_MAX);
     174    glOrtho (-1., 1., -1., 1., -G4OPENGL_DBL_MAX, G4OPENGL_DBL_MAX);
    174175    glMatrixMode (GL_MODELVIEW);
    175176    glPushMatrix();
     
    183184                              fDisplayHeadTimeBlue));
    184185    headTimeText.SetVisAttributes(&visAtts);
    185     fG4OpenGLStoredSceneHandler.AddPrimitive(headTimeText);
     186    static_cast<G4OpenGLSceneHandler&>(fSceneHandler).
     187      G4OpenGLSceneHandler::AddPrimitive(headTimeText);
    186188    glMatrixMode (GL_PROJECTION);
    187189    glPopMatrix();
     
    191193
    192194  // Display light front...
    193   if (fDisplayLightFront && fEndTime < DBL_MAX) {
     195  if (fDisplayLightFront && fEndTime < G4OPENGL_DBL_MAX) {
    194196    G4double lightFrontRadius = (fEndTime - fDisplayLightFrontT) * c_light;
    195197    if (lightFrontRadius > 0.) {
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredWin32.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLStoredWin32.cc,v 1.14 2006/08/14 12:07:19 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredWin32Viewer.cc

    r529 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLStoredWin32Viewer.cc,v 1.18 2006/09/04 12:07:59 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     27// $Id: G4OpenGLStoredWin32Viewer.cc,v 1.19 2007/04/04 16:50:27 allison Exp $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
     
    123123
    124124  glFlush ();
    125   ::SwapBuffers(fHDC);
     125  GLint renderMode;
     126  glGetIntegerv(GL_RENDER_MODE, &renderMode);
     127  if (renderMode == GL_RENDER) ::SwapBuffers(fHDC);
    126128
    127129  // Empty the Windows message queue :
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredX.cc

    r529 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLStoredX.cc,v 1.13 2006/08/14 12:07:19 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     27// $Id: G4OpenGLStoredX.cc,v 1.14 2007/08/21 14:05:51 allison Exp $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
     
    4242#include "G4OpenGLStoredXViewer.hh"
    4343#include "G4OpenGLViewerMessenger.hh"
    44 #include "G4OpenGLXViewerMessenger.hh"
    4544
    4645G4OpenGLStoredX::G4OpenGLStoredX ():
     
    5150{
    5251  G4OpenGLViewerMessenger::GetInstance();
    53   G4OpenGLXViewerMessenger::GetInstance();
    5452}
    5553
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredXViewer.cc

    r529 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLStoredXViewer.cc,v 1.21 2006/09/04 12:07:59 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     27// $Id: G4OpenGLStoredXViewer.cc,v 1.22 2007/04/04 16:50:27 allison Exp $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
     
    126126  glXWaitGL (); //Wait for effects of all previous OpenGL commands to
    127127                //be propogated before progressing.
    128   glXSwapBuffers (dpy, win); 
     128  GLint renderMode;
     129  glGetIntegerv(GL_RENDER_MODE, &renderMode);
     130  if (renderMode == GL_RENDER) glXSwapBuffers (dpy, win); 
    129131}
    130132
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredXm.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLStoredXm.cc,v 1.11 2006/08/14 12:07:19 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredXmViewer.cc

    r529 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLStoredXmViewer.cc,v 1.21 2006/09/04 12:07:59 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     27// $Id: G4OpenGLStoredXmViewer.cc,v 1.22 2007/04/04 16:50:27 allison Exp $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
     
    131131  glXWaitGL (); //Wait for effects of all previous OpenGL commands to
    132132                //be propogated before progressing.
    133   glXSwapBuffers (dpy, win); 
     133  GLint renderMode;
     134  glGetIntegerv(GL_RENDER_MODE, &renderMode);
     135  if (renderMode == GL_RENDER) glXSwapBuffers (dpy, win); 
    134136}
    135137
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLTransform3D.cc

    r564 r593  
    2626//
    2727// $Id: G4OpenGLTransform3D.cc,v 1.8 2006/06/29 21:19:32 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
     
    4949      *p++ = operator()(k,i);
    5050    }
    51     *p++ = 0.;
     51    *p++ = 0.; 
    5252  }
    5353  m[15] = 1.;
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLViewer.cc

    r543 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLViewer.cc,v 1.29 2006/09/19 16:13:15 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     27// $Id: G4OpenGLViewer.cc,v 1.34 2007/05/24 18:27:13 allison Exp $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
     
    4646#include "G4Normal3D.hh"
    4747#include "G4Plane3D.hh"
     48#include "G4AttHolder.hh"
     49#include "G4AttCheck.hh"
     50#include <sstream>
     51
     52static const char* gouraudtriangleEPS[] =
     53{
     54  "/bd{bind def}bind def /triangle { aload pop   setrgbcolor  aload pop 5 3",
     55  "roll 4 2 roll 3 2 roll exch moveto lineto lineto closepath fill } bd",
     56  "/computediff1 { 2 copy sub abs threshold ge {pop pop pop true} { exch 2",
     57  "index sub abs threshold ge { pop pop true} { sub abs threshold ge } ifelse",
     58  "} ifelse } bd /computediff3 { 3 copy 0 get 3 1 roll 0 get 3 1 roll 0 get",
     59  "computediff1 {true} { 3 copy 1 get 3 1 roll 1 get 3 1 roll 1 get",
     60  "computediff1 {true} { 3 copy 2 get 3 1 roll  2 get 3 1 roll 2 get",
     61  "computediff1 } ifelse } ifelse } bd /middlecolor { aload pop 4 -1 roll",
     62  "aload pop 4 -1 roll add 2 div 5 1 roll 3 -1 roll add 2 div 3 1 roll add 2",
     63  "div 3 1 roll exch 3 array astore } bd /gouraudtriangle { computediff3 { 4",
     64  "-1 roll aload 7 1 roll 6 -1 roll pop 3 -1 roll pop add 2 div 3 1 roll add",
     65  "2 div exch 3 -1 roll aload 7 1 roll exch pop 4 -1 roll pop add 2 div 3 1",
     66  "roll add 2 div exch 3 -1 roll aload 7 1 roll pop 3 -1 roll pop add 2 div 3",
     67  "1 roll add 2 div exch 7 3 roll 10 -3 roll dup 3 index middlecolor 4 1 roll",
     68  "2 copy middlecolor 4 1 roll 3 copy pop middlecolor 4 1 roll 13 -1 roll",
     69  "aload pop 17 index 6 index 15 index 19 index 6 index 17 index 6 array",
     70  "astore 10 index 10 index 14 index gouraudtriangle 17 index 5 index 17",
     71  "index 19 index 5 index 19 index 6 array astore 10 index 9 index 13 index",
     72  "gouraudtriangle 13 index 16 index 5 index 15 index 18 index 5 index 6",
     73  "array astore 12 index 12 index 9 index gouraudtriangle 17 index 16 index",
     74  "15 index 19 index 18 index 17 index 6 array astore 10 index 12 index 14",
     75  "index gouraudtriangle 18 {pop} repeat } { aload pop 5 3 roll aload pop 7 3",
     76  "roll aload pop 9 3 roll 4 index 6 index 4 index add add 3 div 10 1 roll 7",
     77  "index 5 index 3 index add add 3 div 10 1 roll 6 index 4 index 2 index add",
     78  "add 3 div 10 1 roll 9 {pop} repeat 3 array astore triangle } ifelse } bd",
     79  NULL
     80};
    4881
    4982G4OpenGLViewer::G4OpenGLViewer (G4OpenGLSceneHandler& scene):
    5083G4VViewer (scene, -1),
     84pointSize (0),
     85print_colour (true),
     86vectored_ps (true),
     87fOpenGLSceneHandler(scene),
    5188background (G4Colour(0.,0.,0.)),
    5289transparency_enabled (true),
    5390antialiasing_enabled (false),
    5491haloing_enabled (false),
    55 fStartTime(-DBL_MAX),
    56 fEndTime(DBL_MAX),
     92fStartTime(-G4OPENGL_DBL_MAX),
     93fEndTime(G4OPENGL_DBL_MAX),
    5794fFadeFactor(0.),
    5895fDisplayHeadTime(false),
     
    82119  //  glDisable (GL_POLYGON_SMOOTH);
    83120
     121  strcpy (print_string, "G4OpenGL.eps");
    84122}
    85123
     
    88126void G4OpenGLViewer::InitializeGLView ()
    89127{
    90   printf("G4OpenGLViewer::InitializeGLView () VVVVVVVVVVVVVVVVVVVVV \n");
    91128  glClearColor (0.0, 0.0, 0.0, 0.0);
    92129  glClearDepth (1.0);
     
    94131  glDisable (GL_LINE_SMOOTH);
    95132  glDisable (GL_POLYGON_SMOOTH);
    96   printf("G4OpenGLViewer::InitializeGLView () ^^^^^^^^^^^^^^^^^^^^ \n");
    97133
    98134
     
    275311}
    276312
     313void G4OpenGLViewer::Pick(GLdouble x, GLdouble y)
     314{
     315  //G4cout << "X: " << x << ", Y: " << y << G4endl;
     316  const G4int BUFSIZE = 512;
     317  GLuint selectBuffer[BUFSIZE];
     318  glSelectBuffer(BUFSIZE, selectBuffer);
     319  glRenderMode(GL_SELECT);
     320  glInitNames();
     321  glPushName(0);
     322  glMatrixMode(GL_PROJECTION);
     323  G4double currentProjectionMatrix[16];
     324  glGetDoublev(GL_PROJECTION_MATRIX, currentProjectionMatrix);
     325  glPushMatrix();
     326  glLoadIdentity();
     327  GLint viewport[4];
     328  glGetIntegerv(GL_VIEWPORT, viewport);
     329  // Define 5x5 pixel pick area
     330  gluPickMatrix(x, viewport[3] - y, 5., 5., viewport);
     331  glMultMatrixd(currentProjectionMatrix);
     332  glMatrixMode(GL_MODELVIEW);
     333  DrawView();
     334  GLint hits = glRenderMode(GL_RENDER);
     335  if (hits < 0)
     336    G4cout << "Too many hits.  Zoom in to reduce overlaps." << G4cout;
     337  else if (hits > 0) {
     338    //G4cout << hits << " hit(s)" << G4endl;
     339    GLuint* p = selectBuffer;
     340    for (GLint i = 0; i < hits; ++i) {
     341      GLuint nnames = *p++;
     342      *p++; //OR GLuint zmin = *p++;
     343      *p++; //OR GLuint zmax = *p++;
     344      //G4cout << "Hit " << i << ": " << nnames << " names"
     345      //     << "\nzmin: " << zmin << ", zmax: " << zmax << G4endl;
     346      for (GLuint j = 0; j < nnames; ++j) {
     347        GLuint name = *p++;
     348        //G4cout << "Name " << j << ": PickName: " << name << G4endl;
     349        std::map<GLuint, G4AttHolder*>::iterator iter =
     350          fOpenGLSceneHandler.fPickMap.find(name);
     351        if (iter != fOpenGLSceneHandler.fPickMap.end()) {
     352          G4AttHolder* attHolder = iter->second;
     353          if(attHolder && attHolder->GetAttDefs().size()) {
     354            for (size_t i = 0; i < attHolder->GetAttDefs().size(); ++i) {
     355              G4cout << G4AttCheck(attHolder->GetAttValues()[i],
     356                                   attHolder->GetAttDefs()[i]);
     357            }
     358          }
     359        }
     360      }
     361      G4cout << G4endl;
     362    }
     363  }
     364  glMatrixMode(GL_PROJECTION);
     365  glPopMatrix();
     366  glMatrixMode(GL_MODELVIEW);
     367}
     368
     369void G4OpenGLViewer::print() {
     370
     371  // Print vectored PostScript
     372 
     373  G4int size = 5000000;
     374
     375  GLfloat* feedback_buffer;
     376  GLint returned;
     377  FILE* file;
     378 
     379  feedback_buffer = new GLfloat[size];
     380  glFeedbackBuffer (size, GL_3D_COLOR, feedback_buffer);
     381  glRenderMode (GL_FEEDBACK);
     382 
     383  DrawView();
     384  returned = glRenderMode (GL_RENDER);
     385 
     386  if (print_string) {
     387    file = fopen (print_string, "w");
     388    if (file) {
     389      spewWireframeEPS (file, returned, feedback_buffer, "rendereps");
     390    } else {
     391      printf("Could not open %s\n", print_string);
     392    }
     393  } else {
     394    printBuffer (returned, feedback_buffer);
     395  }
     396
     397  delete[] feedback_buffer;
     398}
     399
     400void G4OpenGLViewer::print3DcolorVertex(GLint size, GLint * count, GLfloat * buffer)
     401{
     402  G4int i;
     403
     404  printf("  ");
     405  for (i = 0; i < 7; i++) {
     406    printf("%4.2f ", buffer[size - (*count)]);
     407    *count = *count - 1;
     408  }
     409  printf("\n");
     410}
     411
     412void G4OpenGLViewer::spewWireframeEPS (FILE* file, GLint size, GLfloat* buffer, const char* cr) {
     413
     414  GLfloat EPS_GOURAUD_THRESHOLD=0.1;
     415
     416  GLfloat clearColor[4], viewport[4];
     417  GLfloat lineWidth;
     418  G4int i;
     419
     420  glGetFloatv (GL_VIEWPORT, viewport);
     421  glGetFloatv (GL_COLOR_CLEAR_VALUE, clearColor);
     422  glGetFloatv (GL_LINE_WIDTH, &lineWidth);
     423  glGetFloatv (GL_POINT_SIZE, &pointSize);
     424
     425  fputs ("%!PS-Adobe-2.0 EPSF-2.0\n", file);
     426  fprintf (file, "%%%%Creator: %s (using OpenGL feedback)\n", cr);
     427  fprintf (file, "%%%%BoundingBox: %g %g %g %g\n", viewport[0], viewport[1], viewport[2], viewport[3]);
     428  fputs ("%%EndComments\n", file);
     429  fputs ("\n", file);
     430  fputs ("gsave\n", file);
     431  fputs ("\n", file);
     432
     433  fputs ("% the gouraudtriangle PostScript fragment below is free\n", file);
     434  fputs ("% written by Frederic Delhoume (delhoume@ilog.fr)\n", file);
     435  fprintf (file, "/threshold %g def\n", EPS_GOURAUD_THRESHOLD);
     436  for (i=0; gouraudtriangleEPS[i]; i++) {
     437    fprintf (file, "%s\n", gouraudtriangleEPS[i]);
     438  }
     439
     440  fprintf(file, "\n%g setlinewidth\n", lineWidth);
     441 
     442  fprintf (file, "%g %g %g setrgbcolor\n", clearColor[0], clearColor[1], clearColor[2]);
     443  fprintf (file, "%g %g %g %g rectfill\n\n", viewport[0], viewport[1], viewport[2], viewport[3]);
     444
     445  spewSortedFeedback (file, size, buffer);
     446
     447  fputs ("grestore\n\n", file);
     448  fputs ("showpage\n", file);
     449
     450  fclose(file);
     451}
     452
     453void G4OpenGLViewer::printBuffer (GLint size, GLfloat* buffer) {
     454
     455  GLint count;
     456  G4int token, nvertices;
     457
     458  count=size;
     459  while(count) {
     460    token=G4int (buffer[size-count]);
     461    count--;
     462    switch (token) {
     463
     464    case GL_PASS_THROUGH_TOKEN:
     465      printf ("GL_PASS_THROUGH_TOKEN\n");
     466      printf ("  %4.2f\n", buffer[size-count]);
     467      count--;
     468      break;
     469
     470    case GL_POINT_TOKEN:
     471      printf ("GL_POINT_TOKEN\n");
     472      print3DcolorVertex (size, &count, buffer);
     473      break;
     474
     475    case GL_LINE_TOKEN:
     476      printf ("GL_LINE_TOKEN\n");
     477      print3DcolorVertex (size, &count, buffer);
     478      print3DcolorVertex (size, &count, buffer);
     479      break;
     480     
     481    case GL_LINE_RESET_TOKEN:
     482      printf ("GL_LINE_RESET_TOKEN\n");
     483      print3DcolorVertex (size, &count, buffer);
     484      print3DcolorVertex (size, &count, buffer);
     485      break;
     486
     487    case GL_POLYGON_TOKEN:
     488      printf ("GL_POLYGON_TOKEN\n");
     489      nvertices=G4int (buffer[size-count]);
     490      count--;
     491      for (; nvertices>0; nvertices--) {
     492        print3DcolorVertex (size, &count, buffer);
     493      }
     494    }
     495  }
     496}
     497
     498G4float* G4OpenGLViewer::spewPrimitiveEPS (FILE* file, GLfloat* loc) {
     499 
     500  G4int token;
     501  G4int nvertices, i;
     502  GLfloat red, green, blue, intensity;
     503  G4int smooth;
     504  GLfloat dx, dy, dr, dg, db, absR, absG, absB, colormax;
     505  G4int steps;
     506  Feedback3Dcolor *vertex;
     507  GLfloat xstep(0.), ystep(0.), rstep(0.), gstep(0.), bstep(0.);
     508  GLfloat xnext(0.), ynext(0.), rnext(0.), gnext(0.), bnext(0.), distance(0.);
     509
     510  token=G4int (*loc);
     511  loc++;
     512  switch (token) {
     513  case GL_LINE_RESET_TOKEN:
     514  case GL_LINE_TOKEN:
     515    vertex=(Feedback3Dcolor*)loc;
     516    dr=vertex[1].red - vertex[0].red;
     517    dg=vertex[1].green - vertex[0].green;
     518    db=vertex[1].blue - vertex[0].blue;
     519
     520    if (!print_colour) {
     521      dr+=(dg+db);
     522      dr/=3.0;
     523      dg=dr;
     524      db=dr;
     525    }
     526
     527    if (dr!=0 || dg!=0 || db!=0) {
     528      dx=vertex[1].x - vertex[0].x;
     529      dy=vertex[1].y - vertex[0].y;
     530      distance=std::sqrt(dx*dx + dy*dy);
     531
     532      absR=std::fabs(dr);
     533      absG=std::fabs(dg);
     534      absB=std::fabs(db);
     535
     536      #define Max(a, b) (((a)>(b))?(a):(b))
     537
     538      #define EPS_SMOOTH_LINE_FACTOR 0.06
     539
     540      colormax=Max(absR, Max(absG, absB));
     541      steps=Max(1, G4int (colormax*distance*EPS_SMOOTH_LINE_FACTOR));
     542     
     543      xstep=dx/steps;
     544      ystep=dy/steps;
     545
     546      rstep=dr/steps;
     547      gstep=dg/steps;
     548      bstep=db/steps;
     549
     550      xnext=vertex[0].x;
     551      ynext=vertex[0].y;
     552      rnext=vertex[0].red;
     553      gnext=vertex[0].green;
     554      bnext=vertex[0].blue;
     555
     556      if (!print_colour) {
     557        rnext+=(gnext+bnext);
     558        rnext/=3.0;
     559        gnext=rnext;
     560        bnext=rnext;
     561      }
     562
     563      xnext -= xstep/2.0;
     564      ynext -= ystep/2.0;
     565      rnext -= rstep/2.0;
     566      gnext -= gstep/2.0;
     567      bnext -= bstep/2.0;
     568    } else {
     569      steps=0;
     570    }
     571    if (print_colour) {
     572      fprintf (file, "%g %g %g setrgbcolor\n",
     573               vertex[0].red, vertex[0].green, vertex[0].blue);
     574    } else {
     575      intensity = (vertex[0].red + vertex[0].green + vertex[0].blue) / 3.0;
     576      fprintf (file, "%g %g %g setrgbcolor\n",
     577               intensity, intensity, intensity);
     578    }     
     579    fprintf (file, "%g %g moveto\n", vertex[0].x, vertex[0].y);
     580
     581    for (i=0; i<steps; i++) {
     582
     583      xnext += xstep;
     584      ynext += ystep;
     585      rnext += rstep;
     586      gnext += gstep;
     587      bnext += bstep;
     588
     589      fprintf (file, "%g %g lineto stroke\n", xnext, ynext);
     590      fprintf (file, "%g %g %g setrgbcolor\n", rnext, gnext, bnext);
     591      fprintf (file, "%g %g moveto\n", xnext, ynext);
     592    }
     593    fprintf (file, "%g %g lineto stroke\n", vertex[1].x, vertex[1].y);
     594
     595    loc += 14;
     596    break;
     597
     598  case GL_POLYGON_TOKEN:
     599    nvertices = G4int (*loc);
     600    loc++;
     601    vertex=(Feedback3Dcolor*)loc;
     602    if (nvertices>0) {
     603      red=vertex[0].red;
     604      green=vertex[0].green;
     605      blue=vertex[0].blue;
     606      smooth=0;
     607     
     608      if (!print_colour) {
     609        red+=(green+blue);
     610        red/=3.0;
     611        green=red;
     612        blue=red;
     613      }
     614     
     615      if (print_colour) {
     616        for (i=1; i<nvertices; i++) {
     617          if (red!=vertex[i].red || green!=vertex[i].green || blue!=vertex[i].blue) {
     618            smooth=1;
     619            break;
     620          }
     621        }
     622      } else {
     623        for (i=1; i<nvertices; i++) {
     624          intensity = vertex[i].red + vertex[i].green + vertex[i].blue;
     625          intensity/=3.0;
     626          if (red!=intensity) {
     627            smooth=1;
     628            break;
     629          }
     630        }
     631      }
     632
     633      if (smooth) {
     634        G4int triOffset;
     635        for (i=0; i<nvertices-2; i++) {
     636          triOffset = i*7;
     637          fprintf (file, "[%g %g %g %g %g %g]",
     638                   vertex[0].x, vertex[i+1].x, vertex[i+2].x,
     639                   vertex[0].y, vertex[i+1].y, vertex[i+2].y);
     640          if (print_colour) {
     641            fprintf (file, " [%g %g %g] [%g %g %g] [%g %g %g] gouraudtriangle\n",
     642                     vertex[0].red, vertex[0].green, vertex[0].blue,
     643                     vertex[i+1].red, vertex[i+1].green, vertex[i+1].blue,
     644                     vertex[i+2].red, vertex[i+2].green, vertex[i+2].blue);
     645          } else {
     646
     647            intensity = vertex[0].red + vertex[0].green + vertex[0].blue;
     648            intensity/=3.0;
     649            fprintf (file, " [%g %g %g]", intensity, intensity, intensity);
     650
     651            intensity = vertex[1].red + vertex[1].green + vertex[1].blue;
     652            intensity/=3.0;
     653            fprintf (file, " [%g %g %g]", intensity, intensity, intensity);
     654
     655            intensity = vertex[2].red + vertex[2].green + vertex[2].blue;
     656            intensity/=3.0;
     657            fprintf (file, " [%g %g %g] gouraudtriangle\n", intensity, intensity, intensity);
     658          }
     659        }
     660      } else {
     661        fprintf (file, "newpath\n");
     662        fprintf (file, "%g %g %g setrgbcolor\n", red, green, blue);
     663        fprintf (file, "%g %g moveto\n", vertex[0].x, vertex[0].y);
     664        for (i=1; i<nvertices; i++) {
     665          fprintf (file, "%g %g lineto\n", vertex[i].x, vertex[i].y);
     666        }
     667        fprintf (file, "closepath fill\n\n");
     668      }
     669    }
     670    loc += nvertices*7;
     671    break;
     672
     673  case GL_POINT_TOKEN:
     674    vertex=(Feedback3Dcolor*)loc;
     675    if (print_colour) {
     676      fprintf (file, "%g %g %g setrgbcolor\n", vertex[0].red, vertex[0].green, vertex[0].blue);
     677    } else {
     678      intensity = vertex[0].red + vertex[0].green + vertex[0].blue;
     679      intensity/=3.0;
     680      fprintf (file, "%g %g %g setrgbcolor\n", intensity, intensity, intensity);
     681    }     
     682    fprintf(file, "%g %g %g 0 360 arc fill\n\n", vertex[0].x, vertex[0].y, pointSize / 2.0);
     683    loc += 7;           /* Each vertex element in the feedback
     684                           buffer is 7 GLfloats. */
     685    break;
     686  default:
     687    /* XXX Left as an excersie to the reader. */
     688    static G4bool spewPrimitiveEPSWarned = false;
     689    if (!spewPrimitiveEPSWarned) {
     690      std::ostringstream oss;
     691      oss <<
     692        "Incomplete implementation.  Unexpected token (" << token << ")."
     693        "\n  (Seems to be caused by text.)";
     694      G4Exception("G4OpenGLViewer::spewPrimitiveEPS",
     695                  "Unexpected token",
     696                  JustWarning,
     697                  oss.str().c_str());
     698      spewPrimitiveEPSWarned = true;
     699    }
     700  }
     701  return loc;
     702}
     703
     704typedef struct G4OpenGLViewerDepthIndex {
     705  GLfloat *ptr;
     706  GLfloat depth;
     707} DepthIndex;
     708
     709extern "C" {
     710  int G4OpenGLViewercompare(const void *a, const void *b)
     711  {
     712    const DepthIndex *p1 = (DepthIndex *) a;
     713    const DepthIndex *p2 = (DepthIndex *) b;
     714    GLfloat diff = p2->depth - p1->depth;
     715   
     716    if (diff > 0.0) {
     717      return 1;
     718    } else if (diff < 0.0) {
     719      return -1;
     720    } else {
     721      return 0;
     722    }
     723  }
     724}
     725
     726void G4OpenGLViewer::spewSortedFeedback(FILE * file, GLint size, GLfloat * buffer)
     727{
     728  int token;
     729  GLfloat *loc, *end;
     730  Feedback3Dcolor *vertex;
     731  GLfloat depthSum;
     732  int nprimitives, item;
     733  DepthIndex *prims;
     734  int nvertices, i;
     735
     736  end = buffer + size;
     737
     738  /* Count how many primitives there are. */
     739  nprimitives = 0;
     740  loc = buffer;
     741  while (loc < end) {
     742    token = int (*loc);
     743    loc++;
     744    switch (token) {
     745    case GL_LINE_TOKEN:
     746    case GL_LINE_RESET_TOKEN:
     747      loc += 14;
     748      nprimitives++;
     749      break;
     750    case GL_POLYGON_TOKEN:
     751      nvertices = int (*loc);
     752      loc++;
     753      loc += (7 * nvertices);
     754      nprimitives++;
     755      break;
     756    case GL_POINT_TOKEN:
     757      loc += 7;
     758      nprimitives++;
     759      break;
     760    default:
     761      /* XXX Left as an excersie to the reader. */
     762      static G4bool spewSortedFeedbackWarned = false;
     763      if (!spewSortedFeedbackWarned) {
     764        std::ostringstream oss;
     765        oss <<
     766          "Incomplete implementation.  Unexpected token (" << token << ")."
     767          "\n  (Seems to be caused by text.)";
     768        G4Exception("G4OpenGLViewer::spewSortedFeedback",
     769                    "Unexpected token",
     770                    JustWarning,
     771                    oss.str().c_str());
     772        spewSortedFeedbackWarned = true;
     773      }
     774      nprimitives++;
     775    }
     776  }
     777
     778  /* Allocate an array of pointers that will point back at
     779     primitives in the feedback buffer.  There will be one
     780     entry per primitive.  This array is also where we keep the
     781     primitive's average depth.  There is one entry per
     782     primitive  in the feedback buffer. */
     783  prims = (DepthIndex *) malloc(sizeof(DepthIndex) * nprimitives);
     784
     785  item = 0;
     786  loc = buffer;
     787  while (loc < end) {
     788    prims[item].ptr = loc;  /* Save this primitive's location. */
     789    token = int (*loc);
     790    loc++;
     791    switch (token) {
     792    case GL_LINE_TOKEN:
     793    case GL_LINE_RESET_TOKEN:
     794      vertex = (Feedback3Dcolor *) loc;
     795      depthSum = vertex[0].z + vertex[1].z;
     796      prims[item].depth = depthSum / 2.0;
     797      loc += 14;
     798      break;
     799    case GL_POLYGON_TOKEN:
     800      nvertices = int (*loc);
     801      loc++;
     802      vertex = (Feedback3Dcolor *) loc;
     803      depthSum = vertex[0].z;
     804      for (i = 1; i < nvertices; i++) {
     805        depthSum += vertex[i].z;
     806      }
     807      prims[item].depth = depthSum / nvertices;
     808      loc += (7 * nvertices);
     809      break;
     810    case GL_POINT_TOKEN:
     811      vertex = (Feedback3Dcolor *) loc;
     812      prims[item].depth = vertex[0].z;
     813      loc += 7;
     814      break;
     815    default:
     816      /* XXX Left as an excersie to the reader. */
     817      assert(1);
     818    }
     819    item++;
     820  }
     821  assert(item == nprimitives);
     822
     823  /* Sort the primitives back to front. */
     824  qsort(prims, nprimitives, sizeof(DepthIndex), G4OpenGLViewercompare);
     825
     826  /* Understand that sorting by a primitives average depth
     827     doesn't allow us to disambiguate some cases like self
     828     intersecting polygons.  Handling these cases would require
     829     breaking up the primitives.  That's too involved for this
     830     example.  Sorting by depth is good enough for lots of
     831     applications. */
     832
     833  /* Emit the Encapsulated PostScript for the primitives in
     834     back to front order. */
     835  for (item = 0; item < nprimitives; item++) {
     836    (void) spewPrimitiveEPS(file, prims[item].ptr);
     837  }
     838
     839  free(prims);
     840}
     841
    277842#endif
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLViewerMessenger.cc

    r529 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLViewerMessenger.cc,v 1.5 2006/10/24 06:20:42 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     27// $Id: G4OpenGLViewerMessenger.cc,v 1.9 2007/06/15 09:52:52 gcosmo Exp $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929
    3030#include "G4OpenGLViewerMessenger.hh"
     
    3535#include "G4UIcommand.hh"
    3636#include "G4UIdirectory.hh"
     37#include "G4UIcmdWithoutParameter.hh"
    3738#include "G4UIcmdWithADouble.hh"
    3839#include "G4UIcmdWithABool.hh"
     40#include "G4UIcmdWithAString.hh"
    3941#include "G4VisManager.hh"
    4042#include <sstream>
     
    5658  fpDirectory = new G4UIdirectory("/vis/ogl/");
    5759  fpDirectory->SetGuidance("G4OpenGLViewer commands.");
     60
     61  fpCommandPrintEPS =
     62    new G4UIcmdWithoutParameter("/vis/ogl/printEPS", this);
     63  fpCommandPrintEPS->SetGuidance("Print Encapsulated PostScript file.");
     64  fpCommandPrintEPS->SetGuidance
     65    ("Generates files with names G4OpenGL_n.eps, where n is a sequence"
     66     "\nnumber, starting at 0.");
    5867
    5968  fpDirectorySet = new G4UIdirectory ("/vis/ogl/set/");
     
    146155  fpCommandEndTime->SetGuidance("Set end and range of track time.");
    147156  parameter = new G4UIparameter ("end-time", 'd', omitable = false);
    148   parameter->SetDefaultValue(DBL_MAX);
     157  parameter->SetDefaultValue(G4OPENGL_DBL_MAX);
    149158  fpCommandEndTime->SetParameter(parameter);
    150159  parameter = new G4UIparameter ("end-time-unit", 's', omitable = false);
     
    165174  fpCommandFade->SetDefaultValue(0.);
    166175
     176  fpCommandPrintMode = new G4UIcmdWithAString
     177    ("/vis/ogl/set/printMode",this);
     178  fpCommandPrintMode->SetGuidance("Set print mode");
     179  fpCommandPrintMode->SetParameterName("print_mode",omitable = true);
     180  fpCommandPrintMode->SetCandidates("vectored pixmap");
     181  fpCommandPrintMode->SetDefaultValue("vectored");
     182
    167183  fpCommandStartTime =
    168184    new G4UIcommand("/vis/ogl/set/startTime", this);
    169185  fpCommandStartTime->SetGuidance("Set start and range of track time.");
    170186  parameter = new G4UIparameter ("start-time", 'd', omitable = false);
    171   parameter->SetDefaultValue(-DBL_MAX);
     187  parameter->SetDefaultValue(-G4OPENGL_DBL_MAX);
    172188  fpCommandStartTime->SetParameter(parameter);
    173189  parameter = new G4UIparameter ("start-time-unit", 's', omitable = false);
     
    192208G4OpenGLViewerMessenger::~G4OpenGLViewerMessenger ()
    193209{
     210  delete fpCommandPrintMode;
    194211  delete fpCommandTransparency;
    195212  delete fpCommandStartTime;
     
    199216  delete fpCommandDisplayHeadTime;
    200217  delete fpDirectorySet;
     218  delete fpCommandPrintEPS;
    201219  delete fpDirectory;
     220
     221  delete fpInstance;
    202222}
    203223
     
    226246    return;
    227247  }
     248
     249  if (command == fpCommandPrintEPS)
     250    {
     251      // Keep copy of print_string to preserve Xm behaviour...
     252      char* tmp_string = new char[50];
     253      strcpy (tmp_string, pOGLViewer->print_string);
     254      // Make new print string...
     255      static G4int file_count = 0;
     256      std::ostringstream oss;
     257      oss << "G4OpenGL_" << file_count++ << ".eps";
     258      strcpy (pOGLViewer->print_string, oss.str().c_str());
     259      // Print eps file...
     260      pOGLViewer->print();
     261      // Restore print_string for Xm...
     262      strcpy (pOGLViewer->print_string, tmp_string);
     263      delete tmp_string;
     264      return;
     265    }
    228266
    229267  G4OpenGLStoredViewer* pViewer =
     
    303341    }
    304342
     343  if (command == fpCommandPrintMode)
     344    {
     345      if (newValue == "vectored") pViewer->vectored_ps = true;
     346      if (newValue == "pixmap") {
     347        pViewer->vectored_ps = false;
     348        if (pVisManager->GetVerbosity() >= G4VisManager::warnings) {
     349          G4cout <<
     350            "WARNING: Only implemented for X Windows at present."
     351                 << G4endl;
     352        }
     353      }
     354    }
     355
    305356  if (command == fpCommandStartTime)
    306357    {
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLWin32Viewer.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLWin32Viewer.cc,v 1.17 2006/06/29 21:19:36 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLXViewer.cc

    r529 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLXViewer.cc,v 1.34 2006/11/01 11:22:26 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     27// $Id: G4OpenGLXViewer.cc,v 1.42 2007/05/25 10:47:17 allison Exp $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
     
    7777#define USE_STANDARD_COLORMAP 0
    7878
    79 static const char* gouraudtriangleEPS[] =
    80 {
    81   "/bd{bind def}bind def /triangle { aload pop   setrgbcolor  aload pop 5 3",
    82   "roll 4 2 roll 3 2 roll exch moveto lineto lineto closepath fill } bd",
    83   "/computediff1 { 2 copy sub abs threshold ge {pop pop pop true} { exch 2",
    84   "index sub abs threshold ge { pop pop true} { sub abs threshold ge } ifelse",
    85   "} ifelse } bd /computediff3 { 3 copy 0 get 3 1 roll 0 get 3 1 roll 0 get",
    86   "computediff1 {true} { 3 copy 1 get 3 1 roll 1 get 3 1 roll 1 get",
    87   "computediff1 {true} { 3 copy 2 get 3 1 roll  2 get 3 1 roll 2 get",
    88   "computediff1 } ifelse } ifelse } bd /middlecolor { aload pop 4 -1 roll",
    89   "aload pop 4 -1 roll add 2 div 5 1 roll 3 -1 roll add 2 div 3 1 roll add 2",
    90   "div 3 1 roll exch 3 array astore } bd /gouraudtriangle { computediff3 { 4",
    91   "-1 roll aload 7 1 roll 6 -1 roll pop 3 -1 roll pop add 2 div 3 1 roll add",
    92   "2 div exch 3 -1 roll aload 7 1 roll exch pop 4 -1 roll pop add 2 div 3 1",
    93   "roll add 2 div exch 3 -1 roll aload 7 1 roll pop 3 -1 roll pop add 2 div 3",
    94   "1 roll add 2 div exch 7 3 roll 10 -3 roll dup 3 index middlecolor 4 1 roll",
    95   "2 copy middlecolor 4 1 roll 3 copy pop middlecolor 4 1 roll 13 -1 roll",
    96   "aload pop 17 index 6 index 15 index 19 index 6 index 17 index 6 array",
    97   "astore 10 index 10 index 14 index gouraudtriangle 17 index 5 index 17",
    98   "index 19 index 5 index 19 index 6 array astore 10 index 9 index 13 index",
    99   "gouraudtriangle 13 index 16 index 5 index 15 index 18 index 5 index 6",
    100   "array astore 12 index 12 index 9 index gouraudtriangle 17 index 16 index",
    101   "15 index 19 index 18 index 17 index 6 array astore 10 index 12 index 14",
    102   "index gouraudtriangle 18 {pop} repeat } { aload pop 5 3 roll aload pop 7 3",
    103   "roll aload pop 9 3 roll 4 index 6 index 4 index add add 3 div 10 1 roll 7",
    104   "index 5 index 3 index add add 3 div 10 1 roll 6 index 4 index 2 index add",
    105   "add 3 div 10 1 roll 9 {pop} repeat 3 array astore triangle } ifelse } bd",
    106   NULL
    107 };
    108 
    10979XVisualInfo*  G4OpenGLXViewer::vi_single_buffer = 0;
    11080XVisualInfo*  G4OpenGLXViewer::vi_double_buffer = 0;
    11181
    11282extern "C" {
    113   Bool G4OpenGLXViewerWaitForNotify (Display*, XEvent* e, char* arg) {
     83  static Bool G4OpenGLXViewerWaitForNotify (Display*, XEvent* e, char* arg) {
    11484    return (e->type == MapNotify) && (e->xmap.window == (Window) arg);
    11585  }
     
    12595                //be propagated before progressing.
    12696  glFlush ();
     97
     98  if (fVP.IsPicking()) {
     99    G4cout <<
     100      "Window activated for picking (left-mouse), exit (middle-mouse)."
     101           << G4endl;
     102    while (true) {
     103      if (XPending(dpy)) {
     104        XNextEvent(dpy, &event);
     105        if (event.type == ButtonPress && event.xbutton.button == 1) {
     106          Pick(event.xbutton.x, event.xbutton.y);
     107        }
     108        else if (event.type == ButtonPress && event.xbutton.button == 2) break;
     109      }
     110    }
     111  }
    127112}
    128113
     
    181166 
    182167  if (status == 1) {
     168    cmap = 0;
    183169    status = XGetRGBColormaps (dpy,
    184170                               XRootWindow (dpy, vi -> screen),
     
    187173                               XA_RGB_DEFAULT_MAP);
    188174    if (status == 1)
    189       for (i = 0; i < numCmaps; i++)
     175      for (i = 0; i < numCmaps; i++) {
    190176        if (standardCmaps[i].visualid == vi -> visualid) {
    191177          cmap = standardCmaps[i].colormap;
    192178          XFree (standardCmaps);
     179          break;
    193180        }
     181      }
     182    if (!cmap) {
     183      fViewId = -1;  // This flags an error.
     184      G4cerr <<
     185   "G4OpenGLViewer::G4OpenGLViewer failed to allocate a standard colormap."
     186             << G4endl;
     187      return;
     188    }
    194189    G4cout << "Got standard cmap" << G4endl;
    195190  } else {
     
    298293
    299294// connect the context to a window
    300   glXMakeCurrent (dpy, win, cx);
     295  Bool success = glXMakeCurrent (dpy, win, cx);
     296  if (!success) {
     297    fViewId = -1;  // This flags an error.
     298    G4cerr << "G4OpenGLViewer::G4OpenGLViewer failed to attach a GLX context."
     299         << G4endl;
     300    GLint error = GL_NO_ERROR;
     301    while ((error = glGetError()) != GL_NO_ERROR) {
     302      G4cout << "GL Error: " << gluErrorString(error) << G4endl;
     303    }
     304    return;
     305  }
    301306
    302307}
     
    342347G4VViewer (scene, -1),
    343348G4OpenGLViewer (scene),
    344 print_colour (true),
    345 vectored_ps (true),
    346349vi_immediate (0),
    347 vi_stored (0)
     350vi_stored (0),
     351vi (0),
     352cmap (0)
    348353{
    349 
    350   strcpy (print_string, "G4OpenGL.eps");
    351 
    352354  GetXConnection ();
    353355  if (fViewId < 0) return;
     
    432434 
    433435  if (vectored_ps) {
    434     G4int size = 5000000;
    435    
    436     GLfloat* feedback_buffer;
    437     GLint returned;
    438     FILE* file;
    439    
    440     feedback_buffer = new GLfloat[size];
    441     glFeedbackBuffer (size, GL_3D_COLOR, feedback_buffer);
    442     glRenderMode (GL_FEEDBACK);
    443    
    444     DrawView();
    445     returned = glRenderMode (GL_RENDER);
    446    
    447     if (print_string) {
    448       file = fopen (print_string, "w");
    449       if (file) {
    450         spewWireframeEPS (file, returned, feedback_buffer, "rendereps");
    451       } else {
    452         printf("Could not open %s\n", print_string);
    453       }
    454     } else {
    455       printBuffer (returned, feedback_buffer);
    456     }
    457     //  free (feedback_buffer);
    458     delete[] feedback_buffer;
     436
     437    G4OpenGLViewer::print();
    459438
    460439  } else {
     
    462441    XVisualInfo* pvi;
    463442    GLXContext pcx = create_GL_print_context(pvi);
     443
     444    if (!pcx) {
     445      G4cout << "Unable to create print context." << G4endl;
     446      return;
     447    }
     448
    464449    GLXContext tmp_cx;
    465450    tmp_cx = cx;
     
    480465   
    481466    glXMakeCurrent (dpy,
    482                     glxpmap,
     467                    win,
    483468                    cx);
    484469   
     
    486471   
    487472    ClearView ();
     473    SetView ();
    488474    DrawView ();
    489475   
     
    496482   
    497483    glXMakeCurrent (dpy,
    498                     glxpmap,
     484                    win,
    499485                    cx);
    500486   
     
    503489}
    504490
    505 void G4OpenGLXViewer::print3DcolorVertex(GLint size, GLint * count, GLfloat * buffer)
    506 {
    507   G4int i;
    508 
    509   printf("  ");
    510   for (i = 0; i < 7; i++) {
    511     printf("%4.2f ", buffer[size - (*count)]);
    512     *count = *count - 1;
    513   }
    514   printf("\n");
    515 }
    516 
    517 void G4OpenGLXViewer::spewWireframeEPS (FILE* file, GLint size, GLfloat* buffer, const char* cr) {
    518 
    519   GLfloat EPS_GOURAUD_THRESHOLD=0.1;
    520 
    521   GLfloat clearColor[4], viewport[4];
    522   GLfloat lineWidth;
    523   G4int i;
    524 
    525   glGetFloatv (GL_VIEWPORT, viewport);
    526   glGetFloatv (GL_COLOR_CLEAR_VALUE, clearColor);
    527   glGetFloatv (GL_LINE_WIDTH, &lineWidth);
    528   glGetFloatv (GL_POINT_SIZE, &pointSize);
    529 
    530   fputs ("%!PS-Adobe-2.0 EPSF-2.0\n", file);
    531   fprintf (file, "%%%%Creator: %s (using OpenGL feedback)\n", cr);
    532   fprintf (file, "%%%%BoundingBox: %g %g %g %g\n", viewport[0], viewport[1], viewport[2], viewport[3]);
    533   fputs ("%%EndComments\n", file);
    534   fputs ("\n", file);
    535   fputs ("gsave\n", file);
    536   fputs ("\n", file);
    537 
    538   fputs ("% the gouraudtriangle PostScript fragment below is free\n", file);
    539   fputs ("% written by Frederic Delhoume (delhoume@ilog.fr)\n", file);
    540   fprintf (file, "/threshold %g def\n", EPS_GOURAUD_THRESHOLD);
    541   for (i=0; gouraudtriangleEPS[i]; i++) {
    542     fprintf (file, "%s\n", gouraudtriangleEPS[i]);
    543   }
    544 
    545   fprintf(file, "\n%g setlinewidth\n", lineWidth);
    546  
    547   fprintf (file, "%g %g %g setrgbcolor\n", clearColor[0], clearColor[1], clearColor[2]);
    548   fprintf (file, "%g %g %g %g rectfill\n\n", viewport[0], viewport[1], viewport[2], viewport[3]);
    549 
    550   spewSortedFeedback (file, size, buffer);
    551 
    552   fputs ("grestore\n\n", file);
    553   fputs ("showpage\n", file);
    554 
    555   fclose(file);
    556 }
    557 
    558 void G4OpenGLXViewer::printBuffer (GLint size, GLfloat* buffer) {
    559 
    560   GLint count;
    561   G4int token, nvertices;
    562 
    563   count=size;
    564   while(count) {
    565     token=G4int (buffer[size-count]);
    566     count--;
    567     switch (token) {
    568 
    569     case GL_PASS_THROUGH_TOKEN:
    570       printf ("GL_PASS_THROUGH_TOKEN\n");
    571       printf ("  %4.2f\n", buffer[size-count]);
    572       count--;
    573       break;
    574 
    575     case GL_POINT_TOKEN:
    576       printf ("GL_POINT_TOKEN\n");
    577       print3DcolorVertex (size, &count, buffer);
    578       break;
    579 
    580     case GL_LINE_TOKEN:
    581       printf ("GL_LINE_TOKEN\n");
    582       print3DcolorVertex (size, &count, buffer);
    583       print3DcolorVertex (size, &count, buffer);
    584       break;
    585      
    586     case GL_LINE_RESET_TOKEN:
    587       printf ("GL_LINE_RESET_TOKEN\n");
    588       print3DcolorVertex (size, &count, buffer);
    589       print3DcolorVertex (size, &count, buffer);
    590       break;
    591 
    592     case GL_POLYGON_TOKEN:
    593       printf ("GL_POLYGON_TOKEN\n");
    594       nvertices=G4int (buffer[size-count]);
    595       count--;
    596       for (; nvertices>0; nvertices--) {
    597         print3DcolorVertex (size, &count, buffer);
    598       }
    599     }
    600   }
    601 }
    602 
    603 G4float* G4OpenGLXViewer::spewPrimitiveEPS (FILE* file, GLfloat* loc) {
    604  
    605   G4int token;
    606   G4int nvertices, i;
    607   GLfloat red, green, blue, intensity;
    608   G4int smooth;
    609   GLfloat dx, dy, dr, dg, db, absR, absG, absB, colormax;
    610   G4int steps;
    611   Feedback3Dcolor *vertex;
    612   GLfloat xstep(0.), ystep(0.), rstep(0.), gstep(0.), bstep(0.);
    613   GLfloat xnext(0.), ynext(0.), rnext(0.), gnext(0.), bnext(0.), distance(0.);
    614 
    615   token=G4int (*loc);
    616   loc++;
    617   switch (token) {
    618   case GL_LINE_RESET_TOKEN:
    619   case GL_LINE_TOKEN:
    620     vertex=(Feedback3Dcolor*)loc;
    621     dr=vertex[1].red - vertex[0].red;
    622     dg=vertex[1].green - vertex[0].green;
    623     db=vertex[1].blue - vertex[0].blue;
    624 
    625     if (!print_colour) {
    626       dr+=(dg+db);
    627       dr/=3.0;
    628       dg=dr;
    629       db=dr;
    630     }
    631 
    632     if (dr!=0 || dg!=0 || db!=0) {
    633       dx=vertex[1].x - vertex[0].x;
    634       dy=vertex[1].y - vertex[0].y;
    635       distance=std::sqrt(dx*dx + dy*dy);
    636 
    637       absR=std::fabs(dr);
    638       absG=std::fabs(dg);
    639       absB=std::fabs(db);
    640 
    641       #define Max(a, b) (((a)>(b))?(a):(b))
    642 
    643       #define EPS_SMOOTH_LINE_FACTOR 0.06
    644 
    645       colormax=Max(absR, Max(absG, absB));
    646       steps=Max(1, G4int (colormax*distance*EPS_SMOOTH_LINE_FACTOR));
    647      
    648       xstep=dx/steps;
    649       ystep=dy/steps;
    650 
    651       rstep=dr/steps;
    652       gstep=dg/steps;
    653       bstep=db/steps;
    654 
    655       xnext=vertex[0].x;
    656       ynext=vertex[0].y;
    657       rnext=vertex[0].red;
    658       gnext=vertex[0].green;
    659       bnext=vertex[0].blue;
    660 
    661       if (!print_colour) {
    662         rnext+=(gnext+bnext);
    663         rnext/=3.0;
    664         gnext=rnext;
    665         bnext=rnext;
    666       }
    667 
    668       xnext -= xstep/2.0;
    669       ynext -= ystep/2.0;
    670       rnext -= rstep/2.0;
    671       gnext -= gstep/2.0;
    672       bnext -= bstep/2.0;
    673     } else {
    674       steps=0;
    675     }
    676     if (print_colour) {
    677       fprintf (file, "%g %g %g setrgbcolor\n",
    678                vertex[0].red, vertex[0].green, vertex[0].blue);
    679     } else {
    680       intensity = (vertex[0].red + vertex[0].green + vertex[0].blue) / 3.0;
    681       fprintf (file, "%g %g %g setrgbcolor\n",
    682                intensity, intensity, intensity);
    683     }     
    684     fprintf (file, "%g %g moveto\n", vertex[0].x, vertex[0].y);
    685 
    686     for (i=0; i<steps; i++) {
    687 
    688       xnext += xstep;
    689       ynext += ystep;
    690       rnext += rstep;
    691       gnext += gstep;
    692       bnext += bstep;
    693 
    694       fprintf (file, "%g %g lineto stroke\n", xnext, ynext);
    695       fprintf (file, "%g %g %g setrgbcolor\n", rnext, gnext, bnext);
    696       fprintf (file, "%g %g moveto\n", xnext, ynext);
    697     }
    698     fprintf (file, "%g %g lineto stroke\n", vertex[1].x, vertex[1].y);
    699 
    700     loc += 14;
    701     break;
    702 
    703   case GL_POLYGON_TOKEN:
    704     nvertices = G4int (*loc);
    705     loc++;
    706     vertex=(Feedback3Dcolor*)loc;
    707     if (nvertices>0) {
    708       red=vertex[0].red;
    709       green=vertex[0].green;
    710       blue=vertex[0].blue;
    711       smooth=0;
    712      
    713       if (!print_colour) {
    714         red+=(green+blue);
    715         red/=3.0;
    716         green=red;
    717         blue=red;
    718       }
    719      
    720       if (print_colour) {
    721         for (i=1; i<nvertices; i++) {
    722           if (red!=vertex[i].red || green!=vertex[i].green || blue!=vertex[i].blue) {
    723             smooth=1;
    724             break;
    725           }
    726         }
    727       } else {
    728         for (i=1; i<nvertices; i++) {
    729           intensity = vertex[i].red + vertex[i].green + vertex[i].blue;
    730           intensity/=3.0;
    731           if (red!=intensity) {
    732             smooth=1;
    733             break;
    734           }
    735         }
    736       }
    737 
    738       if (smooth) {
    739         G4int triOffset;
    740         for (i=0; i<nvertices-2; i++) {
    741           triOffset = i*7;
    742           fprintf (file, "[%g %g %g %g %g %g]",
    743                    vertex[0].x, vertex[i+1].x, vertex[i+2].x,
    744                    vertex[0].y, vertex[i+1].y, vertex[i+2].y);
    745           if (print_colour) {
    746             fprintf (file, " [%g %g %g] [%g %g %g] [%g %g %g] gouraudtriangle\n",
    747                      vertex[0].red, vertex[0].green, vertex[0].blue,
    748                      vertex[i+1].red, vertex[i+1].green, vertex[i+1].blue,
    749                      vertex[i+2].red, vertex[i+2].green, vertex[i+2].blue);
    750           } else {
    751 
    752             intensity = vertex[0].red + vertex[0].green + vertex[0].blue;
    753             intensity/=3.0;
    754             fprintf (file, " [%g %g %g]", intensity, intensity, intensity);
    755 
    756             intensity = vertex[1].red + vertex[1].green + vertex[1].blue;
    757             intensity/=3.0;
    758             fprintf (file, " [%g %g %g]", intensity, intensity, intensity);
    759 
    760             intensity = vertex[2].red + vertex[2].green + vertex[2].blue;
    761             intensity/=3.0;
    762             fprintf (file, " [%g %g %g] gouraudtriangle\n", intensity, intensity, intensity);
    763           }
    764         }
    765       } else {
    766         fprintf (file, "newpath\n");
    767         fprintf (file, "%g %g %g setrgbcolor\n", red, green, blue);
    768         fprintf (file, "%g %g moveto\n", vertex[0].x, vertex[0].y);
    769         for (i=1; i<nvertices; i++) {
    770           fprintf (file, "%g %g lineto\n", vertex[i].x, vertex[i].y);
    771         }
    772         fprintf (file, "closepath fill\n\n");
    773       }
    774     }
    775     loc += nvertices*7;
    776     break;
    777 
    778   case GL_POINT_TOKEN:
    779     vertex=(Feedback3Dcolor*)loc;
    780     if (print_colour) {
    781       fprintf (file, "%g %g %g setrgbcolor\n", vertex[0].red, vertex[0].green, vertex[0].blue);
    782     } else {
    783       intensity = vertex[0].red + vertex[0].green + vertex[0].blue;
    784       intensity/=3.0;
    785       fprintf (file, "%g %g %g setrgbcolor\n", intensity, intensity, intensity);
    786     }     
    787     fprintf(file, "%g %g %g 0 360 arc fill\n\n", vertex[0].x, vertex[0].y, pointSize / 2.0);
    788     loc += 7;           /* Each vertex element in the feedback
    789                            buffer is 7 GLfloats. */
    790     break;
    791   default:
    792     /* XXX Left as an excersie to the reader. */
    793     static G4bool spewPrimitiveEPSWarned = false;
    794     if (!spewPrimitiveEPSWarned) {
    795       std::ostringstream oss;
    796       oss <<
    797         "Incomplete implementation.  Unexpected token (" << token << ")."
    798         "\n  (Seems to be caused by text.)";
    799       G4Exception("G4OpenGLXViewer::spewPrimitiveEPS",
    800                   "Unexpected token",
    801                   JustWarning,
    802                   oss.str().c_str());
    803       spewPrimitiveEPSWarned = true;
    804     }
    805   }
    806   return loc;
    807 }
    808 
    809 typedef struct G4OpenGLXViewerDepthIndex {
    810   GLfloat *ptr;
    811   GLfloat depth;
    812 } DepthIndex;
    813 
    814 extern "C" {
    815   int G4OpenGLXViewercompare(const void *a, const void *b)
    816   {
    817     const DepthIndex *p1 = (DepthIndex *) a;
    818     const DepthIndex *p2 = (DepthIndex *) b;
    819     GLfloat diff = p2->depth - p1->depth;
    820    
    821     if (diff > 0.0) {
    822       return 1;
    823     } else if (diff < 0.0) {
    824       return -1;
    825     } else {
    826       return 0;
    827     }
    828   }
    829 }
    830 
    831 void G4OpenGLXViewer::spewSortedFeedback(FILE * file, GLint size, GLfloat * buffer)
    832 {
    833   int token;
    834   GLfloat *loc, *end;
    835   Feedback3Dcolor *vertex;
    836   GLfloat depthSum;
    837   int nprimitives, item;
    838   DepthIndex *prims;
    839   int nvertices, i;
    840 
    841   end = buffer + size;
    842 
    843   /* Count how many primitives there are. */
    844   nprimitives = 0;
    845   loc = buffer;
    846   while (loc < end) {
    847     token = int (*loc);
    848     loc++;
    849     switch (token) {
    850     case GL_LINE_TOKEN:
    851     case GL_LINE_RESET_TOKEN:
    852       loc += 14;
    853       nprimitives++;
    854       break;
    855     case GL_POLYGON_TOKEN:
    856       nvertices = int (*loc);
    857       loc++;
    858       loc += (7 * nvertices);
    859       nprimitives++;
    860       break;
    861     case GL_POINT_TOKEN:
    862       loc += 7;
    863       nprimitives++;
    864       break;
    865     default:
    866       /* XXX Left as an excersie to the reader. */
    867       static G4bool spewSortedFeedbackWarned = false;
    868       if (!spewSortedFeedbackWarned) {
    869         std::ostringstream oss;
    870         oss <<
    871           "Incomplete implementation.  Unexpected token (" << token << ")."
    872           "\n  (Seems to be caused by text.)";
    873         G4Exception("G4OpenGLXViewer::spewSortedFeedback",
    874                     "Unexpected token",
    875                     JustWarning,
    876                     oss.str().c_str());
    877         spewSortedFeedbackWarned = true;
    878       }
    879       nprimitives++;
    880     }
    881   }
    882 
    883   /* Allocate an array of pointers that will point back at
    884      primitives in the feedback buffer.  There will be one
    885      entry per primitive.  This array is also where we keep the
    886      primitive's average depth.  There is one entry per
    887      primitive  in the feedback buffer. */
    888   prims = (DepthIndex *) malloc(sizeof(DepthIndex) * nprimitives);
    889 
    890   item = 0;
    891   loc = buffer;
    892   while (loc < end) {
    893     prims[item].ptr = loc;  /* Save this primitive's location. */
    894     token = int (*loc);
    895     loc++;
    896     switch (token) {
    897     case GL_LINE_TOKEN:
    898     case GL_LINE_RESET_TOKEN:
    899       vertex = (Feedback3Dcolor *) loc;
    900       depthSum = vertex[0].z + vertex[1].z;
    901       prims[item].depth = depthSum / 2.0;
    902       loc += 14;
    903       break;
    904     case GL_POLYGON_TOKEN:
    905       nvertices = int (*loc);
    906       loc++;
    907       vertex = (Feedback3Dcolor *) loc;
    908       depthSum = vertex[0].z;
    909       for (i = 1; i < nvertices; i++) {
    910         depthSum += vertex[i].z;
    911       }
    912       prims[item].depth = depthSum / nvertices;
    913       loc += (7 * nvertices);
    914       break;
    915     case GL_POINT_TOKEN:
    916       vertex = (Feedback3Dcolor *) loc;
    917       prims[item].depth = vertex[0].z;
    918       loc += 7;
    919       break;
    920     default:
    921       /* XXX Left as an excersie to the reader. */
    922       assert(1);
    923     }
    924     item++;
    925   }
    926   assert(item == nprimitives);
    927 
    928   /* Sort the primitives back to front. */
    929   qsort(prims, nprimitives, sizeof(DepthIndex), G4OpenGLXViewercompare);
    930 
    931   /* Understand that sorting by a primitives average depth
    932      doesn't allow us to disambiguate some cases like self
    933      intersecting polygons.  Handling these cases would require
    934      breaking up the primitives.  That's too involved for this
    935      example.  Sorting by depth is good enough for lots of
    936      applications. */
    937 
    938   /* Emit the Encapsulated PostScript for the primitives in
    939      back to front order. */
    940   for (item = 0; item < nprimitives; item++) {
    941     (void) spewPrimitiveEPS(file, prims[item].ptr);
    942   }
    943 
    944   free(prims);
    945 }
    946 
    947 GLXContext G4OpenGLXViewer::create_GL_print_context(XVisualInfo*& pvi) {
    948  
    949   pvi = glXChooseVisual (dpy,
    950                          XDefaultScreen (dpy),
    951                          snglBuf_RGBA);
    952 
    953   if (!pvi) {
    954     pvi = glXChooseVisual (dpy,
    955                            XDefaultScreen (dpy),
    956                            dblBuf_RGBA);
    957   }
    958 
    959   return glXCreateContext (dpy,
    960                            pvi,
    961                            NULL,
    962                            False);
     491GLubyte* G4OpenGLXViewer::grabPixels (int inColor, unsigned int width, unsigned int height) {
     492 
     493  GLubyte* buffer;
     494  GLint swapbytes, lsbfirst, rowlength;
     495  GLint skiprows, skippixels, alignment;
     496  GLenum format;
     497  int size;
     498
     499  if (inColor) {
     500    format = GL_RGB;
     501    size = width*height*3;
     502  } else {
     503    format = GL_LUMINANCE;
     504    size = width*height*1;
     505  }
     506
     507  buffer = new GLubyte[size];
     508  if (buffer == NULL)
     509    return NULL;
     510
     511  glGetIntegerv (GL_UNPACK_SWAP_BYTES, &swapbytes);
     512  glGetIntegerv (GL_UNPACK_LSB_FIRST, &lsbfirst);
     513  glGetIntegerv (GL_UNPACK_ROW_LENGTH, &rowlength);
     514
     515  glGetIntegerv (GL_UNPACK_SKIP_ROWS, &skiprows);
     516  glGetIntegerv (GL_UNPACK_SKIP_PIXELS, &skippixels);
     517  glGetIntegerv (GL_UNPACK_ALIGNMENT, &alignment);
     518
     519  glPixelStorei (GL_UNPACK_SWAP_BYTES, GL_FALSE);
     520  glPixelStorei (GL_UNPACK_LSB_FIRST, GL_FALSE);
     521  glPixelStorei (GL_UNPACK_ROW_LENGTH, 0);
     522
     523  glPixelStorei (GL_UNPACK_SKIP_ROWS, 0);
     524  glPixelStorei (GL_UNPACK_SKIP_PIXELS, 0);
     525  glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
     526
     527  glReadPixels (0, 0, (GLsizei)width, (GLsizei)height, format, GL_UNSIGNED_BYTE, (GLvoid*) buffer);
     528
     529  glPixelStorei (GL_UNPACK_SWAP_BYTES, swapbytes);
     530  glPixelStorei (GL_UNPACK_LSB_FIRST, lsbfirst);
     531  glPixelStorei (GL_UNPACK_ROW_LENGTH, rowlength);
     532 
     533  glPixelStorei (GL_UNPACK_SKIP_ROWS, skiprows);
     534  glPixelStorei (GL_UNPACK_SKIP_PIXELS, skippixels);
     535  glPixelStorei (GL_UNPACK_ALIGNMENT, alignment);
     536 
     537  return buffer;
    963538}
    964539
     
    1040615}
    1041616
    1042 GLubyte* G4OpenGLXViewer::grabPixels (int inColor, unsigned int width, unsigned int height) {
    1043  
    1044   GLubyte* buffer;
    1045   GLint swapbytes, lsbfirst, rowlength;
    1046   GLint skiprows, skippixels, alignment;
    1047   GLenum format;
    1048   int size;
    1049 
    1050   if (inColor) {
    1051     format = GL_RGB;
    1052     size = width*height*3;
    1053   } else {
    1054     format = GL_LUMINANCE;
    1055     size = width*height*1;
    1056   }
    1057 
    1058   buffer = new GLubyte[size];
    1059   if (buffer == NULL)
    1060     return NULL;
    1061 
    1062   glGetIntegerv (GL_UNPACK_SWAP_BYTES, &swapbytes);
    1063   glGetIntegerv (GL_UNPACK_LSB_FIRST, &lsbfirst);
    1064   glGetIntegerv (GL_UNPACK_ROW_LENGTH, &rowlength);
    1065 
    1066   glGetIntegerv (GL_UNPACK_SKIP_ROWS, &skiprows);
    1067   glGetIntegerv (GL_UNPACK_SKIP_PIXELS, &skippixels);
    1068   glGetIntegerv (GL_UNPACK_ALIGNMENT, &alignment);
    1069 
    1070   glPixelStorei (GL_UNPACK_SWAP_BYTES, GL_FALSE);
    1071   glPixelStorei (GL_UNPACK_LSB_FIRST, GL_FALSE);
    1072   glPixelStorei (GL_UNPACK_ROW_LENGTH, 0);
    1073 
    1074   glPixelStorei (GL_UNPACK_SKIP_ROWS, 0);
    1075   glPixelStorei (GL_UNPACK_SKIP_PIXELS, 0);
    1076   glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
    1077 
    1078   glReadPixels (0, 0, (GLsizei)width, (GLsizei)height, format, GL_UNSIGNED_BYTE, (GLvoid*) buffer);
    1079 
    1080   glPixelStorei (GL_UNPACK_SWAP_BYTES, swapbytes);
    1081   glPixelStorei (GL_UNPACK_LSB_FIRST, lsbfirst);
    1082   glPixelStorei (GL_UNPACK_ROW_LENGTH, rowlength);
    1083  
    1084   glPixelStorei (GL_UNPACK_SKIP_ROWS, skiprows);
    1085   glPixelStorei (GL_UNPACK_SKIP_PIXELS, skippixels);
    1086   glPixelStorei (GL_UNPACK_ALIGNMENT, alignment);
    1087  
    1088   return buffer;
     617GLXContext G4OpenGLXViewer::create_GL_print_context(XVisualInfo*& pvi) {
     618 
     619  pvi = glXChooseVisual (dpy,
     620                         XDefaultScreen (dpy),
     621                         snglBuf_RGBA);
     622
     623  if (!pvi) {
     624    pvi = glXChooseVisual (dpy,
     625                           XDefaultScreen (dpy),
     626                           dblBuf_RGBA);
     627  }
     628
     629  return glXCreateContext (dpy,
     630                           pvi,
     631                           NULL,
     632                           False);
    1089633}
    1090634
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLXmBox.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmBox.cc,v 1.6 2006/06/29 21:19:40 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//Box container class
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLXmConvenienceRoutines.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmConvenienceRoutines.cc,v 1.11 2006/06/29 21:19:42 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLXmFourArrowButtons.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmFourArrowButtons.cc,v 1.5 2006/06/29 21:19:44 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//Four arrow buttons class. Inherits from G4OpenGLXmVWidgetComponent
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLXmFramedBox.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmFramedBox.cc,v 1.6 2006/06/29 21:19:46 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//Framed box container class
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLXmMainMenubarCallbacks.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmMainMenubarCallbacks.cc,v 1.13 2006/06/29 21:19:48 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLXmPanningCallbacks.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmPanningCallbacks.cc,v 1.8 2006/06/29 21:19:50 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLXmPushButton.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmPushButton.cc,v 1.6 2006/06/29 21:19:52 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//Push button class. Inherits from G4OpenGLXmVWidgetComponent
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLXmRadioButton.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmRadioButton.cc,v 1.6 2006/06/29 21:19:54 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//Radio button class. Inherits from G4OpenGLXmVWidgetComponent
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLXmRotationCallbacks.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmRotationCallbacks.cc,v 1.14 2006/06/29 21:19:56 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLXmSeparator.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmSeparator.cc,v 1.5 2006/06/29 21:19:58 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//Separator class. Inherits from G4OpenGLXmVWidgetComponent
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLXmSliderBar.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmSliderBar.cc,v 1.7 2006/06/29 21:20:00 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//Slider bar class. Inherits from G4OpenGLXmVWidgetComponent
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLXmStyleCallbacks.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmStyleCallbacks.cc,v 1.14 2006/06/29 21:20:02 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLXmTextField.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmTextField.cc,v 1.7 2006/06/29 21:20:04 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//Text field class. Inherits from G4OpenGLXmVWidgetComponent
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLXmTopLevelShell.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmTopLevelShell.cc,v 1.5 2006/06/29 21:20:06 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//Top level shell class
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLXmVWidgetComponent.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmVWidgetComponent.cc,v 1.5 2006/06/29 21:20:08 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//Base class for all Motif component widgets
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLXmVWidgetContainer.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmVWidgetContainer.cc,v 1.5 2006/06/29 21:20:10 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//Base class for all Motif container widgets
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLXmVWidgetObject.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmVWidgetObject.cc,v 1.5 2006/06/29 21:20:12 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//Virtual base class for all Motif widgets.
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLXmVWidgetShell.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmVWidgetShell.cc,v 1.5 2006/06/29 21:20:14 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//Base class for all Motif shell widgets
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLXmViewer.cc

    r529 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLXmViewer.cc,v 1.23 2006/06/29 21:20:16 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     27// $Id: G4OpenGLXmViewer.cc,v 1.24 2007/08/21 14:05:51 allison Exp $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
     
    616616rot_sens_limit (90.),
    617617pan_sens_limit (100.),
    618 rot_sens (4.),
     618rot_sens (1.),
    619619wob_sens (20.),
    620620original_vp(fVP.GetViewpointDirection()),
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLXmViewerMessenger.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmViewerMessenger.cc,v 1.4 2006/06/29 21:20:18 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929
    3030#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLXmWindowHandlingCallbacks.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmWindowHandlingCallbacks.cc,v 1.6 2006/06/29 21:20:20 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenInventor/History

    r529 r593  
    1 $Id: History,v 1.90 2006/11/05 20:49:09 allison Exp $
     1$Id: History,v 1.93 2007/04/03 13:35:48 allison Exp $
    22-------------------------------------------------------------------
    33
     
    2020History file for visualization/OpenInventor
    2121-------------------------------------------
     22
     233rd April 2007  John Allison  (openinventor-V08-02-02 - needs visman-V08-02-03)
     24- Introduced picking control.  Default is "true" for Open Inventor.
     25
     2625th March 2007  John Allison  (openinventor-V08-02-01)
     27- G4OpenInventorSceneHandler: Introduced AddProperties. Rationalises.
     28- G4OpenInventorViewer.cc: Added scale factor to list of changes
     29  requiring kernel visit.
     30
     315th January 2007  John Allison  (openinventor-V08-02-00)
     32- Moved LoadAtts to vis management.
    2233
    23345th November 2006  John Allison  (openinventor-V08-01-04)
  • trunk/geant4/visualization/OpenInventor/include/G4OpenInventor.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenInventor.hh,v 1.9 2006/06/29 21:20:22 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030// Guy Barrand 26 Mar 1998.
  • trunk/geant4/visualization/OpenInventor/include/G4OpenInventorSceneHandler.hh

    r529 r593  
    2525//
    2626//
    27 // $Id: G4OpenInventorSceneHandler.hh,v 1.31 2006/11/02 12:01:20 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     27// $Id: G4OpenInventorSceneHandler.hh,v 1.33 2007/03/27 15:24:15 allison Exp $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
     
    4848class SoSeparator;
    4949class Geant4_SoStyleCache;
    50 class G4AttHolder;
     50class G4VisAttributes;
    5151
    5252// Base class for various OpenInventorScene classes.
     
    8686private:
    8787
    88   void LoadAtts(const G4Visible&, G4AttHolder*);
    8988  static G4int fSceneIdCount;   // static counter for OpenInventor scenes.
    9089  enum G4OIMarker {G4OICircle, G4OISquare};
    9190  void AddCircleSquare (G4OIMarker markerType, const G4VMarker&);
    9291  void GeneratePrerequisites();
     92  void AddProperties(const G4VisAttributes*);
    9393  std::map <G4LogicalVolume*, SoSeparator*,
    9494    std::less <G4LogicalVolume*> > fSeparatorMap;
  • trunk/geant4/visualization/OpenInventor/include/G4OpenInventorTransform3D.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenInventorTransform3D.hh,v 1.7 2006/06/29 21:20:26 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenInventor/include/G4OpenInventorWin.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenInventorWin.hh,v 1.3 2006/06/29 21:20:30 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030// OpenInventor graphics system factory.
  • trunk/geant4/visualization/OpenInventor/include/G4OpenInventorWin32.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenInventorWin32.hh,v 1.7 2006/06/29 21:20:32 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030// OpenInventor graphics system factory.
  • trunk/geant4/visualization/OpenInventor/include/G4OpenInventorWinViewer.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenInventorWinViewer.hh,v 1.9 2006/06/29 21:20:34 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenInventor/include/G4OpenInventorX.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenInventorX.hh,v 1.7 2006/06/29 21:20:36 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenInventor/include/G4OpenInventorXt.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenInventorXt.hh,v 1.3 2006/06/29 21:20:38 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenInventor/include/G4OpenInventorXtViewer.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenInventorXtViewer.hh,v 1.14 2006/06/29 21:20:40 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenInventor/include/HEPVis/SbMath.h

    r529 r593  
    2626//
    2727// $Id: SbMath.h,v 1.4 2006/06/29 21:20:46 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030#ifndef HEPVis_SbMath_h
  • trunk/geant4/visualization/OpenInventor/include/HEPVis/nodekits/SoDetectorTreeKit.h

    r529 r593  
    2626//
    2727// $Id: SoDetectorTreeKit.h,v 1.5 2006/06/29 21:21:16 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030/*-----------------------------HEPVis----------------------------------------*/
  • trunk/geant4/visualization/OpenInventor/include/HEPVis/nodes/SoBox.h

    r529 r593  
    2626//
    2727// $Id: SoBox.h,v 1.3 2006/06/29 21:21:18 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030/*-----------------------------Hepvis----------------------------------------*/
  • trunk/geant4/visualization/OpenInventor/include/HEPVis/nodes/SoCons.h

    r529 r593  
    2626//
    2727// $Id: SoCons.h,v 1.3 2006/06/29 21:21:20 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030/*-----------------------------Hepvis----------------------------------------*/
  • trunk/geant4/visualization/OpenInventor/include/HEPVis/nodes/SoTrap.h

    r529 r593  
    2626//
    2727// $Id: SoTrap.h,v 1.4 2006/06/29 21:22:06 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030/*-----------------------------Hepvis----------------------------------------*/
  • trunk/geant4/visualization/OpenInventor/include/HEPVis/nodes/SoTrd.h

    r529 r593  
    2626//
    2727// $Id: SoTrd.h,v 1.3 2006/06/29 21:22:08 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030/*-----------------------------Hepvis----------------------------------------*/
  • trunk/geant4/visualization/OpenInventor/include/HEPVis/nodes/SoTubs.h

    r529 r593  
    2626//
    2727// $Id: SoTubs.h,v 1.3 2006/06/29 21:22:10 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030/*-----------------------------Hepvis----------------------------------------*/
  • trunk/geant4/visualization/OpenInventor/include/SoG4LineSet.h

    r529 r593  
    2525//
    2626// $Id: SoG4LineSet.h,v 1.2 2006/12/13 15:49:51 gunter Exp $
    27 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     27// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2828//
    2929// John Allison  26th October 2006
  • trunk/geant4/visualization/OpenInventor/include/SoG4MarkerSet.h

    r529 r593  
    2525//
    2626// $Id: SoG4MarkerSet.h,v 1.2 2006/12/13 15:49:53 gunter Exp $
    27 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     27// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2828//
    2929// John Allison  26th October 2006
  • trunk/geant4/visualization/OpenInventor/include/SoG4Polyhedron.h

    r529 r593  
    2626//
    2727// $Id: SoG4Polyhedron.h,v 1.2 2006/12/13 15:49:56 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030// John Allison  26th October 2006
  • trunk/geant4/visualization/OpenInventor/src/G4OpenInventor.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenInventor.cc,v 1.20 2006/06/29 21:22:12 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030#ifdef G4VIS_BUILD_OI_DRIVER
  • trunk/geant4/visualization/OpenInventor/src/G4OpenInventorSceneHandler.cc

    r529 r593  
    2525//
    2626//
    27 // $Id: G4OpenInventorSceneHandler.cc,v 1.50 2006/11/05 20:48:57 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     27// $Id: G4OpenInventorSceneHandler.cc,v 1.53 2007/04/03 13:35:48 allison Exp $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
     
    9696#include "G4Trap.hh"
    9797#include "G4Trd.hh"
    98 #include "G4PhysicalVolumeModel.hh"
    99 #include "G4TrajectoriesModel.hh"
    100 #include "G4VTrajectory.hh"
    101 #include "G4VTrajectoryPoint.hh"
    102 #include "G4HitsModel.hh"
    103 #include "G4VHit.hh"
    10498#include "G4ModelingParameters.hh"
    10599#include "G4VPhysicalVolume.hh"
     
    189183}
    190184
    191 void G4OpenInventorSceneHandler::LoadAtts
    192 (const G4Visible& visible,
    193  G4AttHolder* holder)
    194 {
    195   // Load G4Atts from G4VisAttributes, if any...
    196   const std::map<G4String,G4AttDef>* vaDefs =
    197     visible.GetVisAttributes()->GetAttDefs();
    198   if (vaDefs) {
    199     holder->AddAtts(visible.GetVisAttributes()->CreateAttValues(), vaDefs);
    200   }
    201 
    202   G4PhysicalVolumeModel* pPVModel =
    203     dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
    204   if (pPVModel) {
    205     // Load G4Atts from G4PhysicalVolumeModel...
    206     const std::map<G4String,G4AttDef>* defs = pPVModel->GetAttDefs();
    207     if (defs) {
    208       holder->AddAtts(pPVModel->CreateCurrentAttValues(), defs);
    209     }
    210   }
    211 
    212   G4TrajectoriesModel* trajModel = dynamic_cast<G4TrajectoriesModel*>(fpModel);
    213   if (trajModel) {
    214     // Load G4Atts from trajectory...
    215     const G4VTrajectory* traj = trajModel->GetCurrentTrajectory();
    216     const std::map<G4String,G4AttDef>* defs = traj->GetAttDefs();
    217     if (defs) {
    218       holder->AddAtts(traj->CreateAttValues(), defs);
    219     }
    220     G4int nPoints = traj->GetPointEntries();
    221     for (G4int i = 0; i < nPoints; ++i) {
    222       G4VTrajectoryPoint* trajPoint = traj->GetPoint(i);
    223       const std::map<G4String,G4AttDef>* defs = trajPoint->GetAttDefs();
    224       if (defs) {
    225         holder->AddAtts(trajPoint->CreateAttValues(), defs);
    226       }
    227     }
    228   }
    229 
    230   G4HitsModel* hitsModel = dynamic_cast<G4HitsModel*>(fpModel);
    231   if (hitsModel) {
    232     // Load G4Atts from hit...
    233     const G4VHit* hit = hitsModel->GetCurrentHit();
    234     const std::map<G4String,G4AttDef>* defs = hit->GetAttDefs();
    235     if (defs) {
    236       holder->AddAtts(hit->CreateAttValues(), defs);
    237     }
    238   }
    239 }
    240 
    241185//
    242186// Method for handling G4Polyline objects (from tracking).
    243187//
    244 void G4OpenInventorSceneHandler::AddPrimitive (const G4Polyline& line) {
     188void G4OpenInventorSceneHandler::AddPrimitive (const G4Polyline& line)
     189{
     190  AddProperties(line.GetVisAttributes());  // Transformation, colour, etc.
     191
    245192  G4int nPoints = line.size();
    246193  SbVec3f* pCoords = new SbVec3f[nPoints];
     
    252199  }
    253200
    254   // Don't understand why I have to do this again (done in
    255   // GeneratePrerequisites) - JA.
    256   //
    257   // Color
    258   //
    259   const G4Colour& c = GetColour (line);
    260   SoMaterial* material =
    261     fStyleCache->getMaterial((float)c.GetRed(),
    262                              (float)c.GetGreen(),
    263                              (float)c.GetBlue(),
    264                              (float)(1-c.GetAlpha()));
    265   fCurrentSeparator->addChild(material);
    266  
    267201  //
    268202  // Point Set
     
    281215
    282216  // Loads G4Atts for picking...
    283   LoadAtts(line, pLine);
     217  if (fpViewer->GetViewParameters().IsPicking()) LoadAtts(line, pLine);
    284218
    285219#ifdef INVENTOR2_0
     
    294228}
    295229
    296 void G4OpenInventorSceneHandler::AddPrimitive (const G4Polymarker& polymarker) {
     230void G4OpenInventorSceneHandler::AddPrimitive (const G4Polymarker& polymarker)
     231{
     232  AddProperties(polymarker.GetVisAttributes()); // Transformation, colour, etc.
     233
    297234  G4int pointn = polymarker.size();
    298235  if(pointn<=0) return;
     
    305242  }
    306243
    307   // Don't understand why I have to do this again (done in
    308   // GeneratePrerequisites) - JA.
    309   const G4Colour& c = GetColour (polymarker);
    310   SoMaterial* material =
    311     fStyleCache->getMaterial((float)c.GetRed(),
    312                              (float)c.GetGreen(),
    313                              (float)c.GetBlue(),
    314                              (float)(1-c.GetAlpha()));
    315   fCurrentSeparator->addChild(material);
    316  
    317244  SoCoordinate3* coordinate3 = new SoCoordinate3;
    318245  coordinate3->point.setValues(0,pointn,points);
     
    336263
    337264  // Loads G4Atts for picking...
    338   LoadAtts(polymarker, markerSet);
     265  if (fpViewer->GetViewParameters().IsPicking())
     266    LoadAtts(polymarker, markerSet);
    339267
    340268  G4VMarker::FillStyle style = polymarker.GetFillStyle();
     
    410338// Method for handling G4Text objects
    411339//
    412 void G4OpenInventorSceneHandler::AddPrimitive (const G4Text& text) {
     340void G4OpenInventorSceneHandler::AddPrimitive (const G4Text& text)
     341{
     342  AddProperties(text.GetVisAttributes());  // Transformation, colour, etc.
     343
    413344  //
    414345  // Color.  Note: text colour is worked out differently.  This
    415   // over-rides the colour added in GeneratePrerequisites...
     346  // over-rides the colour added in AddProperties...
    416347  //
    417348  const G4Colour& c = GetTextColour (text);
     
    476407
    477408void G4OpenInventorSceneHandler::AddCircleSquare
    478 (G4OIMarker markerType, const G4VMarker& marker) {
    479 
    480   // Don't understand why I have to do this again (done in
    481   // GeneratePrerequisites) - JA.
    482   //
    483   // Color
    484   //
    485   const G4Colour& c = GetColour (marker);
    486   SoMaterial* material =
    487     fStyleCache->getMaterial((float)c.GetRed(),
    488                              (float)c.GetGreen(),
    489                              (float)c.GetBlue(),
    490                              (float)(1-c.GetAlpha()));
    491   fCurrentSeparator->addChild(material);
     409(G4OIMarker markerType, const G4VMarker& marker)
     410{
     411  AddProperties(marker.GetVisAttributes());  // Transformation, colour, etc.
    492412
    493413  MarkerSizeType sizeType;
     
    519439
    520440  // Loads G4Atts for picking...
    521   LoadAtts(marker, markerSet);
     441  if (fpViewer->GetViewParameters().IsPicking()) LoadAtts(marker, markerSet);
    522442
    523443  G4VMarker::FillStyle style = marker.GetFillStyle();
     
    574494// Method for handling G4Polyhedron objects for drawing solids.
    575495//
    576 void G4OpenInventorSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron) {
     496void G4OpenInventorSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron)
     497{
    577498  if (polyhedron.GetNoFacets() == 0) return;
    578499
     500  AddProperties(polyhedron.GetVisAttributes()); // Transformation, colour, etc.
     501
    579502  SoG4Polyhedron* soPolyhedron = new SoG4Polyhedron(polyhedron);
    580503
    581504  // Loads G4Atts for picking...
    582   LoadAtts(polyhedron, soPolyhedron);
     505  if (fpViewer->GetViewParameters().IsPicking())
     506    LoadAtts(polyhedron, soPolyhedron);
    583507
    584508  SbString name = "Non-geometry";
     
    600524//
    601525void G4OpenInventorSceneHandler::AddPrimitive (const G4NURBS& nurb) {
     526
     527  AddProperties(nurb.GetVisAttributes()); // Transformation, colour, etc.
    602528
    603529  G4float *u_knot_array, *u_knot_array_ptr;
     
    618544 
    619545  SoSeparator *surfSep = new SoSeparator();
    620 
    621   //
    622   // Color
    623   // 
    624   const G4Colour& c = GetColour (nurb);
    625   SoMaterial* material =
    626     fStyleCache->getMaterial((float)c.GetRed(),
    627                              (float)c.GetGreen(),
    628                              (float)c.GetBlue(),
    629                              (float)(1-c.GetAlpha()));
    630   surfSep->addChild(material);
    631546
    632547  //
     
    686601  // location on in the scene database so that when the solid is
    687602  // actually added (in addthis), it is put in the right place.
    688 
    689   // Use the applicable vis attributes...
    690   const G4VisAttributes* pApplicableVisAttribs =
    691     fpViewer->GetApplicableVisAttributes (fpVisAttribs);
    692 
    693   // First find the color attributes...
    694   const G4Colour& g4Col =  pApplicableVisAttribs->GetColour ();
    695   const double red = g4Col.GetRed ();
    696   const double green = g4Col.GetGreen ();
    697   const double blue = g4Col.GetBlue ();
    698   double transparency = 1 - g4Col.GetAlpha();
    699 
    700   // Drawing style...
    701   G4ViewParameters::DrawingStyle drawing_style =
    702     GetDrawingStyle(pApplicableVisAttribs);
    703   switch (drawing_style) {
    704   case (G4ViewParameters::wireframe):   
    705     fModelingSolid = false;
    706     break;
    707   case (G4ViewParameters::hlr):
    708   case (G4ViewParameters::hsr):
    709   case (G4ViewParameters::hlhsr):
    710     fModelingSolid = true;
    711     break;
    712   }     
    713 
    714   // Edge visibility...
    715   G4bool isAuxEdgeVisible = GetAuxEdgeVisible (pApplicableVisAttribs);
    716   fReducedWireFrame = !isAuxEdgeVisible;
    717603
    718604  G4PhysicalVolumeModel* pPVModel =
     
    771657      if(fPreviewAndFull) detectorTreeKit->setPreviewAndFull();
    772658      else detectorTreeKit->setPreview(TRUE);
     659
     660      // Colour, etc., for SoDetectorTreeKit.  Treated differently to
     661      // othere SoNodes(?).  Use fpVisAttribs stored away in
     662      // PreAddSolid...
     663      const G4VisAttributes* pApplicableVisAttribs =
     664        fpViewer->GetApplicableVisAttributes (fpVisAttribs);
     665
     666      // First find the color attributes...
     667      const G4Colour& g4Col =  pApplicableVisAttribs->GetColour ();
     668      const double red = g4Col.GetRed ();
     669      const double green = g4Col.GetGreen ();
     670      const double blue = g4Col.GetBlue ();
     671      double transparency = 1 - g4Col.GetAlpha();
     672
     673      // Drawing style...
     674      G4ViewParameters::DrawingStyle drawing_style =
     675        GetDrawingStyle(pApplicableVisAttribs);
     676      switch (drawing_style) {
     677      case (G4ViewParameters::wireframe):   
     678        fModelingSolid = false;
     679        break;
     680      case (G4ViewParameters::hlr):
     681      case (G4ViewParameters::hsr):
     682      case (G4ViewParameters::hlhsr):
     683        fModelingSolid = true;
     684        break;
     685      }
    773686
    774687      SoMaterial* material =
     
    853766    }
    854767  }
     768}
     769
     770void G4OpenInventorSceneHandler::AddProperties(const G4VisAttributes* visAtts)
     771{
     772  // Use the applicable vis attributes...
     773  const G4VisAttributes* pApplicableVisAttribs =
     774    fpViewer->GetApplicableVisAttributes (visAtts);
     775
     776  // First find the color attributes...
     777  const G4Colour& g4Col =  pApplicableVisAttribs->GetColour ();
     778  const double red = g4Col.GetRed ();
     779  const double green = g4Col.GetGreen ();
     780  const double blue = g4Col.GetBlue ();
     781  double transparency = 1 - g4Col.GetAlpha();
     782
     783  // Drawing style...
     784  G4ViewParameters::DrawingStyle drawing_style =
     785    GetDrawingStyle(pApplicableVisAttribs);
     786  switch (drawing_style) {
     787  case (G4ViewParameters::wireframe):   
     788    fModelingSolid = false;
     789    break;
     790  case (G4ViewParameters::hlr):
     791  case (G4ViewParameters::hsr):
     792  case (G4ViewParameters::hlhsr):
     793    fModelingSolid = true;
     794    break;
     795  }
     796
     797  // Edge visibility...
     798  G4bool isAuxEdgeVisible = GetAuxEdgeVisible (pApplicableVisAttribs);
     799  fReducedWireFrame = !isAuxEdgeVisible;
    855800
    856801  SoMaterial* material =
     
    883828  fCurrentSeparator->addChild(matrixTransform);
    884829}
    885 
    886830#endif
  • trunk/geant4/visualization/OpenInventor/src/G4OpenInventorTransform3D.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenInventorTransform3D.cc,v 1.8 2006/06/29 21:22:16 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenInventor/src/G4OpenInventorViewer.cc

    r529 r593  
    2424// ********************************************************************
    2525//
    26 // $Id: G4OpenInventorViewer.cc,v 1.57 2006/11/01 11:06:07 allison Exp $
    27 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     26// $Id: G4OpenInventorViewer.cc,v 1.59 2007/04/03 13:35:48 allison Exp $
     27// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2828
    2929#ifdef G4VIS_BUILD_OI_DRIVER
     
    6969  fNeedKernelVisit = true;  //?? Temporary, until KernelVisitDecision fixed.
    7070
     71  fVP.SetAutoRefresh(true);
    7172  fDefaultVP.SetAutoRefresh(true);
    72   fVP.SetAutoRefresh(true);
     73  fVP.SetPicking(true);
     74  fDefaultVP.SetPicking(true);
    7375
    7476  //FIXME : G.Barrand : not convinced that we have to rm culling.
     
    175177      (vp.GetNoOfSides ()       != fVP.GetNoOfSides ())       ||
    176178      (vp.IsMarkerNotHidden ()  != fVP.IsMarkerNotHidden ())  ||
    177       (vp.GetBackgroundColour ()!= fVP.GetBackgroundColour ())
    178       ) {
    179       return true;;
    180   }
     179      (vp.GetBackgroundColour ()!= fVP.GetBackgroundColour ())||
     180      (vp.IsPicking ()          != fVP.IsPicking ())          ||
     181      // Scaling for Open Inventor is done by the scene handler so it
     182      // needs a kernel visit.  (In this respect, it differs from the
     183      // OpenGL drivers, where it's done in SetView.)
     184      (vp.GetScaleFactor ()     != fVP.GetScaleFactor ())
     185      )
     186    return true;
     187
    181188  if (vp.IsDensityCulling () &&
    182189      (vp.GetVisibleDensity () != fVP.GetVisibleDensity ()))
  • trunk/geant4/visualization/OpenInventor/src/G4OpenInventorWin.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenInventorWin.cc,v 1.6 2006/06/29 21:22:20 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030// OpenInventor graphics system factory.
  • trunk/geant4/visualization/OpenInventor/src/G4OpenInventorWinViewer.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenInventorWinViewer.cc,v 1.25 2006/06/29 21:22:22 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030/*
  • trunk/geant4/visualization/OpenInventor/src/G4OpenInventorXt.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenInventorXt.cc,v 1.4 2006/06/29 21:22:24 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenInventor/src/G4OpenInventorXtViewer.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenInventorXtViewer.cc,v 1.24 2006/06/29 21:22:26 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030/*
  • trunk/geant4/visualization/OpenInventor/src/SoBox.cc

    r529 r593  
    2727//
    2828// $Id: SoBox.cc,v 1.8 2006/06/29 21:22:36 gunter Exp $
    29 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     29// GEANT4 tag $Name: geant4-09-00-ref-01 $
    3030//
    3131/*----------------------------HEPVis----------------------------------------*/
  • trunk/geant4/visualization/OpenInventor/src/SoCons.cc

    r529 r593  
    2727//
    2828// $Id: SoCons.cc,v 1.8 2006/06/29 21:22:38 gunter Exp $
    29 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     29// GEANT4 tag $Name: geant4-09-00-ref-01 $
    3030//
    3131/*-----------------------------HEPVis---------------------------------------*/
  • trunk/geant4/visualization/OpenInventor/src/SoDetectorTreeKit.cc

    r529 r593  
    2727//
    2828// $Id: SoDetectorTreeKit.cc,v 1.13 2006/06/29 21:22:51 gunter Exp $
    29 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     29// GEANT4 tag $Name: geant4-09-00-ref-01 $
    3030//
    3131/*-----------------------------HEPVis----------------------------------------*/
  • trunk/geant4/visualization/OpenInventor/src/SoTrap.cc

    r529 r593  
    2727//
    2828// $Id: SoTrap.cc,v 1.8 2006/06/29 21:23:03 gunter Exp $
    29 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     29// GEANT4 tag $Name: geant4-09-00-ref-01 $
    3030//
    3131/*-----------------------------HEPVis----------------------------------------*/
  • trunk/geant4/visualization/OpenInventor/src/SoTrd.cc

    r529 r593  
    2727//
    2828// $Id: SoTrd.cc,v 1.8 2006/06/29 21:23:05 gunter Exp $
    29 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     29// GEANT4 tag $Name: geant4-09-00-ref-01 $
    3030//
    3131/*-----------------------------HEPVis---------------------------------------*/
  • trunk/geant4/visualization/OpenInventor/src/SoTubs.cc

    r529 r593  
    2727//
    2828// $Id: SoTubs.cc,v 1.8 2006/06/29 21:23:07 gunter Exp $
    29 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     29// GEANT4 tag $Name: geant4-09-00-ref-01 $
    3030//
    3131/*-----------------------------HEPVis---------------------------------------*/
  • trunk/geant4/visualization/management/History

    r531 r593  
    1 $Id: History,v 1.90 2006/12/12 11:51:13 gcosmo Exp $
     1$Id: History,v 1.101 2007/07/10 17:52:25 allison Exp $
    22
    33-------------------------------------------------------------------
     
    2626History file for visualization management sub-category
    2727------------------------------------------------------
     28
     2910th July 2007  John Allison  (visman-V09-00-00)
     30- Remove redundant method declarations in G4VisManager.hh.
     31- Reinstate refesh after "/vis/viewer/set/autoRefresh true".
     32
     33-25th May 2007  John Allison  (visman-V08-03-01)
     34 Improved error trapping in viewer initialisation.
     35- Bug fix in /vis/scene/notifyHandlers for case of no current viewer.
     36
     3716th May 2007  John Allison  (visman-V08-03-00)
     38- G4VSceneHandler.cc: Added #include "G4AttDef.hh" to help buggy
     39  Windows compiler(!).
     40
     414th April 2007  John Allison  (visman-V08-02-04)
     42- G4VSceneHandler.cc: Bug fix for zero vis atts in LoadAtts.
     43
     443rd April 2007  John Allison  (visman-V08-02-03)
     45- Added /vis/viewer/set/picking.  Picking is false by default, except
     46  for OpenInventor.
     47
     4825th March 2007  John Allison  (visman-V08-02-02)
     49- G4VisExecutive.icc: Removed G4GAGTree.
     50- G4VisCommandsCompound.cc: Removed /vis/scene/add/eventID, once
     51  again, from /vis/drawVolume.
     52- G4VisCommands.cc: Improved messages for /vis/abortReviewKeptEvents.
     53- G4VisManager.cc, G4VSceneHandler.cc: Cosmetic.
     54
     5511th January 2007  John Allison  (visman-V08-02-01)
     56- Added /vis/abortReviewKeptEvents.
     57- /vis/reviewKeptEvents: Improved guidance.
     58- Bug fix: /vis/open in /vis/reviewKeptEvents loop.
     59  o Moved fpRequestedEvent from G4VSceneHandler to G4VisManager.
     60- Reduced WARNING noise.
     61
     625th January 2007  John Allison  (visman-V08-02-00)
     63- G4VSceneHandler:
     64  o Introduced LoadAtts (from G4OpenInventorSceneHandler, but now
     65    available to all scene handlers).  Loads G4AttValues and G4AttDefs
     66    onto any object that inherits G4AttHolder.
     67  o Change signature of GetLineWidth from G4Visible& to
     68    G4VisAttributes* for consistency with similar utility functions.
     69    (Only used by OpenGL at present; requires opengl-V08-02-00.)
     70  o GetLineSegmentsPerCircle: protected against null vis atts pointer.
     71- G4VisCommandsGeometrySet and G4VisManager.cc:
     72  o Introduced /vis/geometry/set/forceLineSegmentsPerCircle
     73    (inadvertently omitted in previous release).
     74  o Improved guidance.
     75- G4VisCommandsGeometry.cc: Invoke /vis/viewer/rebuild only if viewer current.
     76- G4VViewer.cc: Improved comment.
     77- G4VisCommandsCompound.cc:
     78  o Re-introduced /vis/scene/add/eventID into /vis/drawVolume.
     79- G4VisCommandsViewer.cc: Improve guidance for /vis/viewer/addCutawayPlane.
    2880
    298112th December 2006  Gabriele Cosmo  (visman-V08-01-16)
  • trunk/geant4/visualization/management/include/G4GraphicsSystemList.hh

    r531 r593  
    2626//
    2727// $Id: G4GraphicsSystemList.hh,v 1.9 2006/06/29 21:27:54 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/management/include/G4Scene.hh

    r531 r593  
    2626//
    2727// $Id: G4Scene.hh,v 1.18 2006/11/14 14:59:54 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/management/include/G4Scene.icc

    r531 r593  
    2626//
    2727// $Id: G4Scene.icc,v 1.14 2006/11/14 14:59:54 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/management/include/G4SceneHandlerList.hh

    r531 r593  
    2626//
    2727// $Id: G4SceneHandlerList.hh,v 1.8 2006/06/29 21:28:00 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/management/include/G4SceneList.hh

    r531 r593  
    2626//
    2727// $Id: G4SceneList.hh,v 1.10 2006/06/29 21:28:02 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/management/include/G4VGraphicsSystem.hh

    r531 r593  
    2626//
    2727// $Id: G4VGraphicsSystem.hh,v 1.11 2006/06/29 21:28:04 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/management/include/G4VGraphicsSystem.icc

    r531 r593  
    2626//
    2727// $Id: G4VGraphicsSystem.icc,v 1.7 2006/06/29 21:28:06 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/management/include/G4VSceneHandler.hh

    r531 r593  
    2525//
    2626//
    27 // $Id: G4VSceneHandler.hh,v 1.37 2006/11/15 19:25:31 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     27// $Id: G4VSceneHandler.hh,v 1.39 2007/01/11 16:38:14 allison Exp $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
     
    5959class G4Material;
    6060class G4Event;
     61class G4AttHolder;
    6162
    6263class G4VSceneHandler: public G4VGraphicsScene {
     
    217218  void          SetTransientsDrawnThisRun        (G4bool);
    218219  // Maintained by vis manager.
    219   void          SetEvent         (const G4Event*);
    220   // If non-zero, this event is used in ProcessScene.  Otherwise, the
    221   // current event, or last event(s) are used.  The user must
    222   // SetEvent(0) when finished.
    223220
    224221  //////////////////////////////////////////////////////////////
     
    233230  // Returns colour of G4Text object, or default text colour.
    234231
    235   G4double GetLineWidth(const G4Visible& visible);
    236   // Returns line width of G4Visible object, or default line width.
    237   // Multiplies by GlobalLineWidthScale.
     232  G4double GetLineWidth(const G4VisAttributes*);
     233  // Returns line width of G4VisAttributes multiplied by GlobalLineWidthScale.
    238234
    239235  G4ViewParameters::DrawingStyle GetDrawingStyle (const G4VisAttributes*);
     
    247243  // over-riding the current view parameter.
    248244
    249   G4int GetNoOfSides(const G4VisAttributes* pVisAttribs);
     245  G4int GetNoOfSides(const G4VisAttributes*);
    250246  // Returns no. of sides (lines segments per circle) from current
    251247  // view parameters, unless the user has forced through the vis
     
    314310  // implemented in this class.  Subclasses that implement their own
    315311  // clipping should provide an override that returns zero.
     312  void LoadAtts(const G4Visible&, G4AttHolder*);
     313  // Load G4AttValues and G4AttDefs associated with the G4Visible
     314  // object onto the G4AttHolder object.  It checks fpModel, and also
     315  // loads the G4AttValues and G4AttDefs from G4PhysicalVolumeModel,
     316  // G4VTrajectory, G4VTrajectoryPoint, or G4VHits, as appropriate.
     317  // The G4AttHolder object is an object of a class that publicly
     318  // inherits G4AttHolder - see, e.g., SoG4Polyhedron in the Open
     319  // Inventor driver.  G4AttHolder deletes G4AttValues in its
     320  // destructor to ensure proper clean-up of G4AttValues.
    316321
    317322  //////////////////////////////////////////////////////////////
     
    338343  G4int              fNestingDepth; // For Begin/EndPrimitives.
    339344  const G4VisAttributes* fpVisAttribs;  // Working vis attributes.
    340   const G4Event* fRequestedEvent;   // If non-zero, use this event.
    341345  const G4Transform3D fIdentityTransformation;
    342346
  • trunk/geant4/visualization/management/include/G4VSceneHandler.icc

    r531 r593  
    2525//
    2626//
    27 // $Id: G4VSceneHandler.icc,v 1.18 2006/11/15 19:25:31 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     27// $Id: G4VSceneHandler.icc,v 1.20 2007/01/11 16:38:14 allison Exp $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
     
    124124}
    125125
    126 inline void G4VSceneHandler::SetEvent (const G4Event* event) {
    127   fRequestedEvent = event;
    128 }
    129126inline const G4Colour& G4VSceneHandler::GetColor (const G4Visible& visible) {
    130127  return GetColour (visible);
  • trunk/geant4/visualization/management/include/G4VUserVisAction.hh

    r531 r593  
    2626//
    2727// $Id: G4VUserVisAction.hh,v 1.8 2006/06/29 21:28:12 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/management/include/G4VViewer.hh

    r531 r593  
    2626//
    2727// $Id: G4VViewer.hh,v 1.18 2006/06/29 21:28:14 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/management/include/G4VViewer.icc

    r531 r593  
    2626//
    2727// $Id: G4VViewer.icc,v 1.11 2006/06/29 21:28:16 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/management/include/G4VVisCommand.hh

    r531 r593  
    2626//
    2727// $Id: G4VVisCommand.hh,v 1.18 2006/06/29 21:28:18 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929
    3030// Base class for visualization commands - John Allison  9th August 1998
  • trunk/geant4/visualization/management/include/G4VVisCommand.icc

    r531 r593  
    2626//
    2727// $Id: G4VVisCommand.icc,v 1.5 2006/06/29 21:28:20 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929
    3030// Base class for visualization commands - John Allison  9th August 1998
  • trunk/geant4/visualization/management/include/G4ViewParameters.hh

    r531 r593  
    2525//
    2626//
    27 // $Id: G4ViewParameters.hh,v 1.25 2006/09/19 16:02:31 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     27// $Id: G4ViewParameters.hh,v 1.26 2007/04/03 13:33:16 allison Exp $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
     
    161161        G4bool           IsAutoRefresh           () const;
    162162  const G4Colour&        GetBackgroundColour     () const;
     163        G4bool           IsPicking               () const;
    163164
    164165  // Here Follow functions to evaluate the above algorithms as a
     
    221222  void SetAutoRefresh          (G4bool);
    222223  void SetBackgroundColour     (const G4Colour&);
     224  void SetPicking              (G4bool);
    223225
    224226  void PrintDifferences (const G4ViewParameters& v) const;
     
    268270  G4bool       fAutoRefresh;     // ...after change of view parameters.
    269271  G4Colour     fBackgroundColour;
     272  G4bool       fPicking;         // Request picking.
    270273};
    271274
  • trunk/geant4/visualization/management/include/G4ViewParameters.icc

    r531 r593  
    2525//
    2626//
    27 // $Id: G4ViewParameters.icc,v 1.15 2006/09/19 16:02:31 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     27// $Id: G4ViewParameters.icc,v 1.16 2007/04/03 13:33:16 allison Exp $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
     
    182182}
    183183
     184inline G4bool G4ViewParameters::IsPicking () const {
     185  return fPicking;
     186}
     187
    184188inline void
    185189G4ViewParameters::SetDrawingStyle (G4ViewParameters::DrawingStyle style) {
     
    335339  fBackgroundColour = colour;
    336340}
     341
     342inline void G4ViewParameters::SetPicking (G4bool picking) {
     343  fPicking = picking;
     344}
  • trunk/geant4/visualization/management/include/G4ViewerList.hh

    r531 r593  
    2626//
    2727// $Id: G4ViewerList.hh,v 1.8 2006/06/29 21:28:26 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/management/include/G4VisCommandModelCreate.hh

    r531 r593  
    2525//
    2626// $Id: G4VisCommandModelCreate.hh,v 1.3 2006/06/29 21:28:28 gunter Exp $
    27 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     27// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2828//
    2929// Jane Tinslay, John Allison, Joseph Perl October 2005
  • trunk/geant4/visualization/management/include/G4VisCommands.hh

    r531 r593  
    2525//
    2626//
    27 // $Id: G4VisCommands.hh,v 1.6 2006/11/14 14:59:54 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     27// $Id: G4VisCommands.hh,v 1.7 2007/01/11 16:39:33 allison Exp $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929
    3030// /vis/ top level commands - John Allison  5th February 2001
     
    3838class G4UIcmdWithAString;
    3939class G4UIcmdWithoutParameter;
     40
     41class G4VisCommandAbortReviewKeptEvents: public G4VVisCommand {
     42public:
     43  G4VisCommandAbortReviewKeptEvents ();
     44  virtual ~G4VisCommandAbortReviewKeptEvents ();
     45  G4String GetCurrentValue (G4UIcommand* command);
     46  void SetNewValue (G4UIcommand* command, G4String newValue);
     47private:
     48  G4VisCommandAbortReviewKeptEvents (const G4VisCommandAbortReviewKeptEvents&);
     49  G4VisCommandAbortReviewKeptEvents& operator = (const G4VisCommandAbortReviewKeptEvents&);
     50  G4UIcmdWithABool* fpCommand;
     51};
    4052
    4153class G4VisCommandEnable: public G4VVisCommand {
  • trunk/geant4/visualization/management/include/G4VisCommandsCompound.hh

    r531 r593  
    2626//
    2727// $Id: G4VisCommandsCompound.hh,v 1.9 2006/06/29 21:28:32 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929
    3030// Compound /vis/ commands - John Allison  15th May 2000
  • trunk/geant4/visualization/management/include/G4VisCommandsGeometry.hh

    r531 r593  
    2626//
    2727// $Id: G4VisCommandsGeometry.hh,v 1.3 2006/06/29 21:28:34 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929
    3030// /vis/geometry commands - John Allison  31st January 2006
  • trunk/geant4/visualization/management/include/G4VisCommandsGeometrySet.hh

    r531 r593  
    2525//
    2626//
    27 // $Id: G4VisCommandsGeometrySet.hh,v 1.2 2006/06/29 21:28:36 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     27// $Id: G4VisCommandsGeometrySet.hh,v 1.3 2007/01/05 16:24:19 allison Exp $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929
    3030// /vis/geometry commands - John Allison  31st January 2006
     
    8080private:
    8181  G4bool fForceAuxEdgeVisible;
     82};
     83
     84class G4VisCommandGeometrySetForceLineSegmentsPerCircleFunction:
     85  public G4VVisCommandGeometrySetFunction {
     86public:
     87  G4VisCommandGeometrySetForceLineSegmentsPerCircleFunction
     88  (G4int lineSegmentsPerCircle):
     89    fLineSegmentsPerCircle(lineSegmentsPerCircle) {}
     90  void operator()
     91    (G4VisAttributes* visAtts) const
     92  {visAtts->SetForceLineSegmentsPerCircle(fLineSegmentsPerCircle);}
     93private:
     94  G4int fLineSegmentsPerCircle;
    8295};
    8396
     
    212225};
    213226
     227class G4VisCommandGeometrySetForceLineSegmentsPerCircle:
     228  public G4VVisCommandGeometrySet {
     229public:
     230  G4VisCommandGeometrySetForceLineSegmentsPerCircle ();
     231  virtual ~G4VisCommandGeometrySetForceLineSegmentsPerCircle ();
     232  G4String GetCurrentValue (G4UIcommand* command);
     233  void SetNewValue (G4UIcommand* command, G4String newValue);
     234private:
     235  G4VisCommandGeometrySetForceLineSegmentsPerCircle
     236  (const G4VisCommandGeometrySetForceLineSegmentsPerCircle&);
     237  G4VisCommandGeometrySetForceLineSegmentsPerCircle& operator=
     238  (const G4VisCommandGeometrySetForceLineSegmentsPerCircle&);
     239  G4UIcommand* fpCommand;
     240};
     241
    214242class G4VisCommandGeometrySetForceWireframe:
    215243  public G4VVisCommandGeometrySet {
  • trunk/geant4/visualization/management/include/G4VisCommandsListManager.hh

    r531 r593  
    2525//
    2626// $Id: G4VisCommandsListManager.hh,v 1.3 2006/06/29 21:28:38 gunter Exp $
    27 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     27// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2828//
    2929// Jane Tinslay, John Allison, Joseph Perl October 2005
  • trunk/geant4/visualization/management/include/G4VisCommandsScene.hh

    r531 r593  
    2626//
    2727// $Id: G4VisCommandsScene.hh,v 1.19 2006/11/14 14:59:54 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929
    3030// /vis/scene commands - John Allison  9th August 1998
  • trunk/geant4/visualization/management/include/G4VisCommandsSceneAdd.hh

    r531 r593  
    2626//
    2727// $Id: G4VisCommandsSceneAdd.hh,v 1.17 2006/11/01 10:50:28 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929
    3030// /vis/scene commands - John Allison  9th August 1998
  • trunk/geant4/visualization/management/include/G4VisCommandsSceneHandler.hh

    r531 r593  
    2626//
    2727// $Id: G4VisCommandsSceneHandler.hh,v 1.8 2006/06/29 21:28:44 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929
    3030// /vis/sceneHandler commands - John Allison  10th October 1998
  • trunk/geant4/visualization/management/include/G4VisCommandsViewer.hh

    r531 r593  
    2626//
    2727// $Id: G4VisCommandsViewer.hh,v 1.23 2006/09/13 13:17:29 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929
    3030// /vis/viewer commands - John Allison  25th October 1998
  • trunk/geant4/visualization/management/include/G4VisCommandsViewerSet.hh

    r531 r593  
    2525//
    2626//
    27 // $Id: G4VisCommandsViewerSet.hh,v 1.21 2006/09/19 16:03:14 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     27// $Id: G4VisCommandsViewerSet.hh,v 1.22 2007/04/03 13:33:16 allison Exp $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929
    3030// /vis/viewer/set commands - John Allison  16th May 2000
     
    6969  G4UIcommand*          fpCommandLightsVector;
    7070  G4ThreeVector         fLightsVector;
     71  G4UIcmdWithABool*     fpCommandPicking;
    7172  G4UIcommand*          fpCommandProjection;
    7273  G4UIcommand*          fpCommandSectionPlane;
  • trunk/geant4/visualization/management/include/G4VisExecutive.hh

    r531 r593  
    2626//
    2727// $Id: G4VisExecutive.hh,v 1.6 2006/06/29 21:28:50 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/management/include/G4VisExecutive.icc

    r564 r593  
    2525//
    2626//
    27 // $Id: G4VisExecutive.icc,v 1.14 2006/09/12 18:55:45 tinslay Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     27// $Id: G4VisExecutive.icc,v 1.16 2007/10/03 14:20:23 lgarnier Exp $
     28// GEANT4 tag $Name: $
    2929//
    3030//
  • trunk/geant4/visualization/management/include/G4VisFeaturesOfDAWNFILE.hh

    r531 r593  
    2626//
    2727// $Id: G4VisFeaturesOfDAWNFILE.hh,v 1.5 2006/06/29 21:28:54 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030#ifndef G4VISFEATURESOFDAWNFILE_HH
  • trunk/geant4/visualization/management/include/G4VisFeaturesOfFukuiRenderer.hh

    r531 r593  
    2626//
    2727// $Id: G4VisFeaturesOfFukuiRenderer.hh,v 1.5 2006/06/29 21:28:56 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/management/include/G4VisFeaturesOfOpenGL.hh

    r535 r593  
    2525//
    2626//
    27 // $Id: G4VisFeaturesOfOpenGL.hh,v 1.5 2006/06/29 21:28:58 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     27// $Id: G4VisFeaturesOfOpenGL.hh,v 1.6 2007/10/03 14:20:23 lgarnier Exp $
     28// GEANT4 tag $Name: $
    2929//
    3030//
  • trunk/geant4/visualization/management/include/G4VisFeaturesOfOpenInventor.hh

    r531 r593  
    2626//
    2727// $Id: G4VisFeaturesOfOpenInventor.hh,v 1.5 2006/06/29 21:29:00 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/management/include/G4VisFilterManager.hh

    r531 r593  
    2525//
    2626// $Id: G4VisFilterManager.hh,v 1.4 2006/06/29 21:29:02 gunter Exp $
    27 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     27// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2828//
    2929// Filter manager. Manages filter models, factories, messengers,
  • trunk/geant4/visualization/management/include/G4VisListManager.hh

    r531 r593  
    2525//
    2626// $Id: G4VisListManager.hh,v 1.8 2006/06/29 21:29:04 gunter Exp $
    27 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     27// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2828//
    2929// Jane Tinslay, John Allison, Joseph Perl October 2005
  • trunk/geant4/visualization/management/include/G4VisManager.hh

    r531 r593  
    2525//
    2626//
    27 // $Id: G4VisManager.hh,v 1.65 2006/11/21 14:23:20 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     27// $Id: G4VisManager.hh,v 1.67 2007/07/10 17:49:27 allison Exp $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
     
    344344  // GetXGeometryString and GetWindowSizeHint is guaranteed to be
    345345  // identical.)
    346   const G4String&              GetBeginOfLastRunRandomStatus   () const;
    347   const G4String&              GetBeginOfLastEventRandomStatus () const;
    348   G4int                        GetLastRunID                    () const;
    349346  G4bool                       GetTransientsDrawnThisRun       () const;
    350347  G4bool                       GetTransientsDrawnThisEvent     () const;
     348  const G4Event*               GetRequestedEvent               () const;
     349  G4bool                       GetAbortReviewKeptEvents        () const;
    351350
    352351  void SetUserAction (G4VUserVisAction* pVisAction,
     
    366365  void              SetEventRefreshing          (G4bool);
    367366  void              ResetTransientsDrawnFlags   ();
     367  // If non-zero, requested event is used in G4VSceneHandler::ProcessScene.
     368  void              SetRequestedEvent           (const G4Event*);
     369  void              SetAbortReviewKeptEvents    (G4bool);
    368370
    369371  /////////////////////////////////////////////////////////////////////
     
    436438  G4VisStateDependent*  fpStateDependent;   // Friend state dependent class.
    437439  G4int fWindowSizeHintX, fWindowSizeHintY; // For viewer...
    438   G4String fXGeometryString;                // ...construction.
    439   G4TrajectoriesModel dummyTrajectoriesModel;  // For passing drawing mode.
    440   G4bool fEventRefreshing;
    441   G4bool fTransientsDrawnThisRun;
    442   G4bool fTransientsDrawnThisEvent;
    443   G4bool fEventKeepingSuspended;
    444   G4bool fKeptLastEvent;
     440  G4String              fXGeometryString;   // ...construction.
     441  G4TrajectoriesModel   dummyTrajectoriesModel;  // For passing drawing mode.
     442  G4bool                fEventRefreshing;
     443  G4bool                fTransientsDrawnThisRun;
     444  G4bool                fTransientsDrawnThisEvent;
     445  G4bool                fEventKeepingSuspended;
     446  G4bool                fKeptLastEvent;
     447  const G4Event*        fpRequestedEvent; // If non-zero, scene handler uses.
     448  G4bool                fAbortReviewKeptEvents;
    445449
    446450  // Trajectory draw model manager
  • trunk/geant4/visualization/management/include/G4VisManager.icc

    r531 r593  
    2525//
    2626//
    27 // $Id: G4VisManager.icc,v 1.19 2006/11/14 14:59:55 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     27// $Id: G4VisManager.icc,v 1.20 2007/01/11 16:40:58 allison Exp $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
     
    9090}
    9191
     92inline const G4Event* G4VisManager::GetRequestedEvent() const {
     93  return fpRequestedEvent;
     94}
     95
     96inline G4bool G4VisManager::GetAbortReviewKeptEvents() const {
     97  return fAbortReviewKeptEvents;
     98}
     99
    92100inline void G4VisManager::SetUserActionExtent (const G4VisExtent& extent) {
    93101  fUserVisActionExtent = extent;
     
    122130  fMessengerList.push_back(msgr);
    123131}
     132
     133inline void G4VisManager::SetRequestedEvent (const G4Event* event) {
     134  fpRequestedEvent = event;
     135}
     136
     137inline void G4VisManager::SetAbortReviewKeptEvents (G4bool abort) {
     138  fAbortReviewKeptEvents = abort;
     139}
  • trunk/geant4/visualization/management/include/G4VisModelManager.hh

    r531 r593  
    2525//
    2626// $Id: G4VisModelManager.hh,v 1.4 2006/06/29 21:29:10 gunter Exp $
    27 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     27// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2828//
    2929// Generic model manager. Manages models, associated
  • trunk/geant4/visualization/management/include/G4VisStateDependent.hh

    r531 r593  
    2626//
    2727// $Id: G4VisStateDependent.hh,v 1.5 2006/06/29 21:29:12 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030// A "state dependent" service class for G4VisManager.
  • trunk/geant4/visualization/management/src/G4GraphicsSystemList.cc

    r531 r593  
    2626//
    2727// $Id: G4GraphicsSystemList.cc,v 1.4 2006/06/29 21:29:14 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929
    3030#include "G4GraphicsSystemList.hh"
  • trunk/geant4/visualization/management/src/G4Scene.cc

    r531 r593  
    2626//
    2727// $Id: G4Scene.cc,v 1.23 2006/11/26 15:51:12 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/management/src/G4SceneHandlerList.cc

    r531 r593  
    2626//
    2727// $Id: G4SceneHandlerList.cc,v 1.4 2006/06/29 21:29:18 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929
    3030#include "G4SceneHandlerList.hh"
  • trunk/geant4/visualization/management/src/G4SceneList.cc

    r531 r593  
    2626//
    2727// $Id: G4SceneList.cc,v 1.6 2006/06/29 21:29:20 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929
    3030#include "G4SceneList.hh"
  • trunk/geant4/visualization/management/src/G4VGraphicsSystem.cc

    r531 r593  
    2626//
    2727// $Id: G4VGraphicsSystem.cc,v 1.11 2006/06/29 21:29:22 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/management/src/G4VSceneHandler.cc

    r561 r593  
    2525//
    2626//
    27 // $Id: G4VSceneHandler.cc,v 1.77 2006/11/21 14:23:53 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     27// $Id: G4VSceneHandler.cc,v 1.82 2007/05/16 15:47:44 allison Exp $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
     
    7171#include "G4ModelingParameters.hh"
    7272#include "G4VTrajectory.hh"
     73#include "G4VTrajectoryPoint.hh"
     74#include "G4HitsModel.hh"
    7375#include "G4VHit.hh"
    7476#include "Randomize.hh"
     
    7779#include "G4Run.hh"
    7880#include "G4Transform3D.hh"
     81#include "G4AttHolder.hh"
     82#include "G4AttDef.hh"
    7983
    8084G4VSceneHandler::G4VSceneHandler (G4VGraphicsSystem& system, G4int id, const G4String& name):
     
    9599  fpObjectTransformation (0),
    96100  fNestingDepth          (0),
    97   fpVisAttribs           (0),
    98   fRequestedEvent        (0)
     101  fpVisAttribs           (0)
    99102{
    100103  G4VisManager* pVMan = G4VisManager::GetInstance ();
     
    421424  G4NURBS* pNURBS = 0;
    422425  G4Polyhedron* pPolyhedron = 0;
    423   const G4VisAttributes* pVisAttribs =
    424     fpViewer -> GetApplicableVisAttributes (fpVisAttribs);
    425426  switch (fpViewer -> GetViewParameters () . GetRepStyle ()) {
    426427  case G4ViewParameters::nurbs:
    427428    pNURBS = solid.CreateNURBS ();
    428429    if (pNURBS) {
    429       pNURBS -> SetVisAttributes
    430         (fpViewer -> GetApplicableVisAttributes (pVisAttribs));
     430      pNURBS -> SetVisAttributes (fpVisAttribs);
    431431      AddPrimitive (*pNURBS);
    432432      delete pNURBS;
     
    447447  case G4ViewParameters::polyhedron:
    448448  default:
    449     G4Polyhedron::SetNumberOfRotationSteps (GetNoOfSides (pVisAttribs));
     449    G4Polyhedron::SetNumberOfRotationSteps (GetNoOfSides (fpVisAttribs));
    450450    pPolyhedron = solid.GetPolyhedron ();
    451451    G4Polyhedron::ResetNumberOfRotationSteps ();
    452452    if (pPolyhedron) {
    453       pPolyhedron -> SetVisAttributes (pVisAttribs);
     453      pPolyhedron -> SetVisAttributes (fpVisAttribs);
    454454      AddPrimitive (*pPolyhedron);
    455455    }
     
    471471
    472472void G4VSceneHandler::ProcessScene (G4VViewer&) {
    473   printf("G4VSceneHandler::ProcessScene\n");
     473
    474474  if (!fpScene) return;
    475475
     
    545545  G4StateManager* stateManager = G4StateManager::GetStateManager();
    546546  G4ApplicationState state = stateManager->GetCurrentState();
    547 
    548   printf("G4VSceneHandler::ProcessScene 1\n");
    549547  if (state == G4State_Idle) {
    550   printf("G4VSceneHandler::ProcessScene 2 : idle\n");
    551548
    552549    visManager->SetEventRefreshing(true);
    553550
    554     if (fRequestedEvent) {
    555       DrawEvent(fRequestedEvent);
    556       printf("G4VSceneHandler::ProcessScene 3 : fRequestedEvent\n");
     551    if (visManager->GetRequestedEvent()) {
     552      DrawEvent(visManager->GetRequestedEvent());
    557553
    558554    } else {
    559       printf("G4VSceneHandler::ProcessScene 3 : not fRequestedEvent\n");
    560555
    561556      G4RunManager* runManager = G4RunManager::GetRunManager();
    562       const G4Run* run = runManager->GetCurrentRun();
    563       const std::vector<const G4Event*>* events =
    564         run? run->GetEventVector(): 0;
    565       size_t nKeptEvents = 0;
    566       if (events) nKeptEvents = events->size();
    567557      if (runManager) {
    568           printf("G4VSceneHandler::ProcessScene 4 : run manager OK\n");
    569         if (fpScene->GetRefreshAtEndOfEvent()) {
    570           printf("G4VSceneHandler::ProcessScene 5 : fpScene->GetRefreshAtEndOfEvent()\n");
    571 
    572           if (verbosity >= G4VisManager::confirmations) {
    573             G4cout << "Refreshing event..." << G4endl;
    574           }
    575           const G4Event* event = 0;
    576           if (events && events->size()) event = events->back();
    577           if (event) DrawEvent(event);
    578 
    579         } else {  // Accumulating events.
    580   printf("G4VSceneHandler::ProcessScene 7\n");
    581 
    582           if (verbosity >= G4VisManager::confirmations) {
    583             G4cout << "Refreshing events in run..." << G4endl;
    584           }
    585           for (size_t i = 0; i < nKeptEvents; ++i) {
    586             const G4Event* event = (*events)[i];
     558        const G4Run* run = runManager->GetCurrentRun();
     559        const std::vector<const G4Event*>* events =
     560          run? run->GetEventVector(): 0;
     561        size_t nKeptEvents = 0;
     562        if (events) nKeptEvents = events->size();
     563        if (nKeptEvents) {
     564
     565          if (fpScene->GetRefreshAtEndOfEvent()) {
     566
     567            if (verbosity >= G4VisManager::confirmations) {
     568              G4cout << "Refreshing event..." << G4endl;
     569            }
     570            const G4Event* event = 0;
     571            if (events && events->size()) event = events->back();
    587572            if (event) DrawEvent(event);
    588           }
    589 
    590           if (!fpScene->GetRefreshAtEndOfRun()) {
    591             if (verbosity >= G4VisManager::warnings) {
    592               G4cout <<
    593                 "WARNING: Cannot refresh events accumulated over more"
    594                 "\n  than one runs.  Refreshed just the last run..."
    595                      << G4endl;
     573
     574          } else {  // Accumulating events.
     575
     576            if (verbosity >= G4VisManager::confirmations) {
     577              G4cout << "Refreshing events in run..." << G4endl;
     578            }
     579            for (size_t i = 0; i < nKeptEvents; ++i) {
     580              const G4Event* event = (*events)[i];
     581              if (event) DrawEvent(event);
     582            }
     583
     584            if (!fpScene->GetRefreshAtEndOfRun()) {
     585              if (verbosity >= G4VisManager::warnings) {
     586                G4cout <<
     587                  "WARNING: Cannot refresh events accumulated over more"
     588                  "\n  than one runs.  Refreshed just the last run."
     589                       << G4endl;
     590              }
    596591            }
    597592          }
    598593        }
    599594      }
    600    }
    601    visManager->SetEventRefreshing(false);
    602  }
     595    }
     596    visManager->SetEventRefreshing(false);
     597  }
    603598
    604599  fMarkForClearingTransientStore = tmpMarkForClearingTransientStore;
    605   printf("G4VSceneHandler::ProcessScene terminé \n");
    606600}
    607601
    608602void G4VSceneHandler::DrawEvent(const G4Event* event)
    609603{
    610   printf("G4VSceneHandler::DrawEvent \n");
    611604  const std::vector<G4VModel*>& EOEModelList =
    612605    fpScene -> GetEndOfEventModelList ();
     
    718711}
    719712
     713void G4VSceneHandler::LoadAtts(const G4Visible& visible, G4AttHolder* holder)
     714{
     715  // Load G4Atts from G4VisAttributes, if any...
     716  const G4VisAttributes* va = visible.GetVisAttributes();
     717  if (va) {
     718    const std::map<G4String,G4AttDef>* vaDefs =
     719      va->GetAttDefs();
     720    if (vaDefs) {
     721      holder->AddAtts(visible.GetVisAttributes()->CreateAttValues(), vaDefs);
     722    }
     723  }
     724
     725  G4PhysicalVolumeModel* pPVModel =
     726    dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
     727  if (pPVModel) {
     728    // Load G4Atts from G4PhysicalVolumeModel...
     729    const std::map<G4String,G4AttDef>* defs = pPVModel->GetAttDefs();
     730    if (defs) {
     731      holder->AddAtts(pPVModel->CreateCurrentAttValues(), defs);
     732    }
     733  }
     734
     735  G4TrajectoriesModel* trajModel = dynamic_cast<G4TrajectoriesModel*>(fpModel);
     736  if (trajModel) {
     737    // Load G4Atts from trajectory...
     738    const G4VTrajectory* traj = trajModel->GetCurrentTrajectory();
     739    const std::map<G4String,G4AttDef>* defs = traj->GetAttDefs();
     740    if (defs) {
     741      holder->AddAtts(traj->CreateAttValues(), defs);
     742    }
     743    G4int nPoints = traj->GetPointEntries();
     744    for (G4int i = 0; i < nPoints; ++i) {
     745      G4VTrajectoryPoint* trajPoint = traj->GetPoint(i);
     746      const std::map<G4String,G4AttDef>* defs = trajPoint->GetAttDefs();
     747      if (defs) {
     748        holder->AddAtts(trajPoint->CreateAttValues(), defs);
     749      }
     750    }
     751  }
     752
     753  G4HitsModel* hitsModel = dynamic_cast<G4HitsModel*>(fpModel);
     754  if (hitsModel) {
     755    // Load G4Atts from hit...
     756    const G4VHit* hit = hitsModel->GetCurrentHit();
     757    const std::map<G4String,G4AttDef>* defs = hit->GetAttDefs();
     758    if (defs) {
     759      holder->AddAtts(hit->CreateAttValues(), defs);
     760    }
     761  }
     762}
     763
    720764const G4Colour& G4VSceneHandler::GetColour (const G4Visible& visible) {
    721765  // Colour is determined by the applicable vis attributes.
     
    734778}
    735779
    736 G4double G4VSceneHandler::GetLineWidth(const G4Visible& visible)
    737 {
    738   G4double lineWidth = fpViewer->
    739     GetApplicableVisAttributes(visible.GetVisAttributes())->GetLineWidth();
     780G4double G4VSceneHandler::GetLineWidth(const G4VisAttributes* pVisAttribs)
     781{
     782  G4double lineWidth = pVisAttribs->GetLineWidth();
    740783  if (lineWidth < 1.) lineWidth = 1.;
    741784  lineWidth *= fpViewer -> GetViewParameters().GetGlobalLineWidthScale();
     
    749792  // it can be overriddden by the ForceDrawingStyle flag in the vis
    750793  // attributes.
    751   G4ViewParameters::DrawingStyle style =
     794  G4ViewParameters::DrawingStyle style = 
    752795    fpViewer->GetViewParameters().GetDrawingStyle();
    753796  if (pVisAttribs -> IsForceDrawingStyle ()) {
     
    821864  // ForceLineSegmentsPerCircle in the vis attributes.
    822865  G4int lineSegmentsPerCircle = fpViewer->GetViewParameters().GetNoOfSides();
    823   if (pVisAttribs->GetForcedLineSegmentsPerCircle() > 0)
    824     lineSegmentsPerCircle = pVisAttribs->GetForcedLineSegmentsPerCircle();
    825   const G4int nSegmentsMin = 12;
    826   if (lineSegmentsPerCircle < nSegmentsMin) {
    827     lineSegmentsPerCircle = nSegmentsMin;
    828     G4cout <<
    829       "G4VSceneHandler::GetNoOfSides: attempt to set the"
    830       "\nnumber of line segements per circle < " << nSegmentsMin
    831          << "; forced to " << lineSegmentsPerCircle << G4endl;
     866  if (pVisAttribs) {
     867    if (pVisAttribs->IsForceLineSegmentsPerCircle())
     868      lineSegmentsPerCircle = pVisAttribs->GetForcedLineSegmentsPerCircle();
     869    const G4int nSegmentsMin = 12;
     870    if (lineSegmentsPerCircle < nSegmentsMin) {
     871      lineSegmentsPerCircle = nSegmentsMin;
     872      G4cout <<
     873        "G4VSceneHandler::GetNoOfSides: attempt to set the"
     874        "\nnumber of line segements per circle < " << nSegmentsMin
     875             << "; forced to " << lineSegmentsPerCircle << G4endl;
     876    }
    832877  }
    833878  return lineSegmentsPerCircle;
  • trunk/geant4/visualization/management/src/G4VViewer.cc

    r531 r593  
    2525//
    2626//
    27 // $Id: G4VViewer.cc,v 1.23 2006/06/29 21:29:26 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     27// $Id: G4VViewer.cc,v 1.24 2007/01/05 16:25:15 allison Exp $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
     
    8282const G4VisAttributes* G4VViewer::GetApplicableVisAttributes
    8383(const G4VisAttributes* pVisAttribs) const {
    84   // If the pointer is null, pick up the default vis attributes from
     84  // If pVisAttribs is zero, pick up the default vis attributes from
    8585  // the view parameters.
    8686  if (!pVisAttribs)
  • trunk/geant4/visualization/management/src/G4VVisCommand.cc

    r531 r593  
    2626//
    2727// $Id: G4VVisCommand.cc,v 1.18 2006/06/29 21:29:28 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929
    3030// Base class for visualization commands - John Allison  9th August 1998
  • trunk/geant4/visualization/management/src/G4ViewParameters.cc

    r531 r593  
    2525//
    2626//
    27 // $Id: G4ViewParameters.cc,v 1.28 2006/09/19 16:02:31 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     27// $Id: G4ViewParameters.cc,v 1.29 2007/04/03 13:33:16 allison Exp $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
     
    7272  fWindowSizeHintY (600),
    7373  fAutoRefresh (false),
    74   fBackgroundColour (G4Colour(0.,0.,0.))          // Black
     74  fBackgroundColour (G4Colour(0.,0.,0.)),         // Black
     75  fPicking (false)
    7576{
    7677  fDefaultMarker.SetScreenSize (5.);
     
    273274      (fXGeometryString      != v.fXGeometryString)      ||
    274275      (fAutoRefresh          != v.fAutoRefresh)          ||
    275       (fBackgroundColour     != v.fBackgroundColour))
     276      (fBackgroundColour     != v.fBackgroundColour)     ||
     277      (fPicking              != v.fPicking)
     278      )
    276279    G4cout << "Difference in 1st batch." << G4endl;
    277280
     
    439442
    440443  os << "\n  Background colour: " << v.fBackgroundColour;
     444
     445  os << "\n  Picking requested: ";
     446  if (v.fPicking) os << "true";
     447  else os << "false";
    441448
    442449  return os;
     
    480487      (fXGeometryString      != v.fXGeometryString)      ||
    481488      (fAutoRefresh          != v.fAutoRefresh)          ||
    482       (fBackgroundColour     != v.fBackgroundColour))
     489      (fBackgroundColour     != v.fBackgroundColour)     ||
     490      (fPicking              != v.fPicking)
     491      )
    483492    return true;
    484493
  • trunk/geant4/visualization/management/src/G4ViewerList.cc

    r531 r593  
    2626//
    2727// $Id: G4ViewerList.cc,v 1.4 2006/06/29 21:29:32 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929
    3030#include "G4ViewerList.hh"
  • trunk/geant4/visualization/management/src/G4VisCommands.cc

    r531 r593  
    2525//
    2626//
    27 // $Id: G4VisCommands.cc,v 1.20 2006/11/26 15:49:10 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     27// $Id: G4VisCommands.cc,v 1.22 2007/03/27 15:47:32 allison Exp $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929
    3030// /vis/ top level commands - John Allison  5th February 2001
     
    4040#include "G4Run.hh"
    4141#include "G4UIsession.hh"
     42
     43////////////// /vis/abortReviewKeptEvents /////////////////////////////
     44
     45G4VisCommandAbortReviewKeptEvents::G4VisCommandAbortReviewKeptEvents () {
     46  G4bool omitable;
     47
     48  fpCommand = new G4UIcmdWithABool("/vis/abortReviewKeptEvents", this);
     49  fpCommand -> SetGuidance("Abort review of kept events.");
     50  fpCommand -> SetParameterName("abort", omitable=true);
     51  fpCommand -> SetDefaultValue(true);
     52}
     53
     54G4VisCommandAbortReviewKeptEvents::~G4VisCommandAbortReviewKeptEvents () {
     55  delete fpCommand;
     56}
     57
     58G4String G4VisCommandAbortReviewKeptEvents::GetCurrentValue (G4UIcommand*) {
     59  return G4String();
     60}
     61
     62void G4VisCommandAbortReviewKeptEvents::SetNewValue (G4UIcommand*,
     63                                                     G4String newValue) {
     64  fpVisManager->SetAbortReviewKeptEvents(G4UIcommand::ConvertToBool(newValue));
     65  G4cout << "Type \"continue\" to complete the abort." << G4endl;
     66}
    4267
    4368////////////// /vis/enable ///////////////////////////////////////
     
    128153  fpCommand -> SetGuidance
    129154    ("If a macro file is specified, it is executed for each event.");
    130   fpCommand -> SetGuidance
    131     ("If a macro file is not specified, each event is drawn to the current"
    132      "\nviewer.  After each event, the session is paused.  The user may issue"
    133      "\nany allowed command.  Then enter \"continue\" to continue to the next"
    134      "\nevent.");
     155  fpCommand -> SetGuidance(
     156  "If a macro file is not specified, each event is drawn to the current"
     157  "\nviewer.  After each event, the session is paused.  The user may issue"
     158  "\nany allowed command.  Then enter \"cont[inue]\" to continue to the next"
     159  "\nevent."
     160  "\nUseful commands might be:"
     161  "\n  \"/vis/viewer/...\" to change the view (zoom, set/viewpoint,...)."
     162  "\n  \"/vis/oglx/printEPS\" to get hard copy."
     163  "\n  \"/vis/open\" to get alternative viewer."
     164  "\n  \"/vis/abortReviewKeptEvents\", then \"cont[inue]\", to abort.");
    135165  fpCommand -> SetParameterName("macro-file-name", omitable=true);
    136166  fpCommand -> SetDefaultValue("");
     
    185215  }
    186216
    187   G4VSceneHandler* sceneHandler = fpVisManager->GetCurrentSceneHandler();
    188 
    189217  G4UImanager* UImanager = G4UImanager::GetUIpointer();
    190218  G4int keepVerbose = UImanager->GetVerboseLevel();
     
    200228
    201229    // Draw to viewer and pause session...
     230    G4UIsession* session = UImanager->GetSession();
    202231    for (size_t i = 0; i < nKeptEvents; ++i) {
    203232      const G4Event* event = (*events)[i];
    204233      if (verbosity >= G4VisManager::warnings) {
    205234        G4cout << "Drawing event : " << event->GetEventID() <<
    206           ".  At EndOfEvent, enter any command, then \"continue\"..."
     235          ".  At EndOfEvent, enter any command, then \"cont[inue]\"..."
    207236               << G4endl;
     237        static G4bool first = true;
     238        if (first) {
     239          first = false;
     240          G4cout <<
     241  "  Useful commands might be:"
     242  "\n    \"/vis/viewer/...\" to change the view (zoom, set/viewpoint,...)."
     243  "\n    \"/vis/oglx/printEPS\" to get hard copy."
     244  "\n    \"/vis/open\" to get alternative viewer."
     245  "\n    \"/vis/abortReviewKeptEvents\", then \"cont[inue]\", to abort."
     246                 << G4endl;
     247        }
    208248      }
    209       sceneHandler->SetEvent(event);
     249      fpVisManager->SetRequestedEvent(event);
    210250      UImanager->ApplyCommand("/vis/viewer/rebuild");
    211251      /* The above command forces a rebuild of the scene, including
     
    224264         features or a complete re-think.
    225265      */
    226       if (!viewer->GetViewParameters().IsAutoRefresh())
    227         UImanager->ApplyCommand("/vis/viewer/flush");
    228       G4UIsession* session = UImanager->GetSession();
     266      UImanager->ApplyCommand("/vis/viewer/flush");
    229267      session->PauseSessionStart("EndOfEvent");
    230       sceneHandler->SetEvent(0);
    231     }
     268      fpVisManager->SetRequestedEvent(0);
     269      if (fpVisManager->GetAbortReviewKeptEvents()) break;
     270    }
     271    fpVisManager->SetAbortReviewKeptEvents(false);
    232272
    233273  } else {
     
    240280               << " with macro file \"" << macroFileName << G4endl;
    241281      }
    242       sceneHandler->SetEvent(event);
     282      fpVisManager->SetRequestedEvent(event);
    243283      UImanager->ApplyCommand("/control/execute " + macroFileName);
    244       sceneHandler->SetEvent(0);
     284      fpVisManager->SetRequestedEvent(0);
    245285    }
    246286  }
  • trunk/geant4/visualization/management/src/G4VisCommandsCompound.cc

    r531 r593  
    2525//
    2626//
    27 // $Id: G4VisCommandsCompound.cc,v 1.35 2006/12/12 11:48:13 gcosmo Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     27// $Id: G4VisCommandsCompound.cc,v 1.38 2007/03/27 15:41:34 allison Exp $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929
    3030// Compound /vis/ commands - John Allison  15th May 2000
     
    202202  UImanager->SetVerboseLevel(newVerbose);
    203203  UImanager->ApplyCommand("/vis/scene/create");
    204 //  UImanager->ApplyCommand("/vis/scene/add/eventID");
    205204  UImanager->ApplyCommand(G4String("/vis/scene/add/volume " + newValue));
    206205  UImanager->ApplyCommand("/vis/sceneHandler/attach");
    207206  UImanager->SetVerboseLevel(keepVerbose);
    208207  static G4bool warned = false;
    209   if (verbosity >= G4VisManager::warnings && !warned) {
     208  if (verbosity >= G4VisManager::confirmations && !warned) {
    210209    G4cout <<
    211       "WARNING: For systems which are not \"auto-refresh\" you will need to"
     210      "NOTE: For systems which are not \"auto-refresh\" you will need to"
    212211      "\n  issue \"/vis/viewer/refresh\" or \"/vis/viewer/flush\"."
    213212           << G4endl;
     
    322321  UImanager->SetVerboseLevel(keepVerbose);
    323322  static G4bool warned = false;
    324   if (verbosity >= G4VisManager::warnings && !warned) {
     323  if (verbosity >= G4VisManager::confirmations && !warned) {
    325324    G4cout <<
    326       "WARNING: For systems which are not \"auto-refresh\" you will need to"
     325      "NOTE: For systems which are not \"auto-refresh\" you will need to"
    327326      "\n  issue \"/vis/viewer/refresh\" or \"/vis/viewer/flush\"."
    328327           << G4endl;
  • trunk/geant4/visualization/management/src/G4VisCommandsGeometry.cc

    r531 r593  
    2525//
    2626//
    27 // $Id: G4VisCommandsGeometry.cc,v 1.3 2006/06/29 21:29:38 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     27// $Id: G4VisCommandsGeometry.cc,v 1.4 2007/01/05 16:29:38 allison Exp $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929
    3030// /vis/geometry commands - John Allison  31st January 2006
     
    147147    return;
    148148  }
    149   G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/rebuild");
     149  if (fpVisManager->GetCurrentViewer()) {
     150    G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/rebuild");
     151  }
    150152}
  • trunk/geant4/visualization/management/src/G4VisCommandsGeometrySet.cc

    r531 r593  
    2525//
    2626//
    27 // $Id: G4VisCommandsGeometrySet.cc,v 1.6 2006/09/19 16:05:13 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     27// $Id: G4VisCommandsGeometrySet.cc,v 1.7 2007/01/05 16:24:19 allison Exp $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929
    3030// /vis/geometry commands - John Allison  31st January 2006
     
    171171  G4bool omitable;
    172172  fpCommand = new G4UIcommand("/vis/geometry/set/daughtersInvisible", this);
    173   fpCommand->SetGuidance("Sets daughters of logical volume(s) invisible.");
     173  fpCommand->SetGuidance("Makes daughters of logical volume(s) invisible.");
    174174  fpCommand->SetGuidance("\"all\" sets all logical volumes.");
    175175  fpCommand->SetGuidance
     
    243243  fpCommand = new G4UIcommand("/vis/geometry/set/forceAuxEdgeVisible", this);
    244244  fpCommand->SetGuidance
    245     ("Sets auxiliary (soft) edges of logical volume(s) drawing visible.");
     245    ("Forces auxiliary (soft) edges of logical volume(s) to be visible,"
     246    "\nregardless of the view parameters.");
    246247  fpCommand->SetGuidance("\"all\" sets all logical volumes.");
    247248  fpCommand->SetGuidance
     
    288289}
    289290
     291////////////// /vis/geometry/set/forceLineSegmentsPerCircle /////////////////////////
     292
     293G4VisCommandGeometrySetForceLineSegmentsPerCircle::G4VisCommandGeometrySetForceLineSegmentsPerCircle()
     294{
     295  G4bool omitable;
     296  fpCommand = new G4UIcommand("/vis/geometry/set/forceLineSegmentsPerCircle", this);
     297  fpCommand->SetGuidance
     298    ("Forces number of line segments per circle, the precision with which a"
     299     "\ncurved line or surface is represented by a polygon or polyhedron,"
     300     "\nregardless of the view parameters.");
     301  fpCommand->SetGuidance("\"all\" sets all logical volumes.");
     302  fpCommand->SetGuidance
     303    ("Optionally propagates down hierarchy to given depth.");
     304  G4UIparameter* parameter;
     305  parameter = new G4UIparameter ("logical-volume-name", 's', omitable = true);
     306  parameter->SetDefaultValue("all");
     307  fpCommand->SetParameter(parameter);
     308  parameter = new G4UIparameter("depth", 'd', omitable = true);
     309  parameter->SetDefaultValue(0);
     310  parameter->SetGuidance
     311    ("Depth of propagation (-1 means unlimited depth).");
     312  fpCommand->SetParameter(parameter);
     313  parameter = new G4UIparameter("lineSegmentsPerCircle", 'd', omitable = true);
     314  parameter->SetGuidance
     315    ("< 0 means not forced, i.e., under control of viewer.");
     316  parameter->SetDefaultValue(-1);
     317  fpCommand->SetParameter(parameter);
     318}
     319
     320G4VisCommandGeometrySetForceLineSegmentsPerCircle::~G4VisCommandGeometrySetForceLineSegmentsPerCircle()
     321{
     322  delete fpCommand;
     323}
     324
     325G4String
     326G4VisCommandGeometrySetForceLineSegmentsPerCircle::GetCurrentValue(G4UIcommand*)
     327{
     328  return "";
     329}
     330
     331void G4VisCommandGeometrySetForceLineSegmentsPerCircle::SetNewValue
     332(G4UIcommand*, G4String newValue)
     333{
     334  G4String name;
     335  G4int requestedDepth;
     336  G4int lineSegmentsPerCircle;
     337  std::istringstream iss(newValue);
     338  iss >> name >> requestedDepth >> lineSegmentsPerCircle;
     339
     340  G4VisCommandGeometrySetForceLineSegmentsPerCircleFunction setForceLineSegmentsPerCircle(lineSegmentsPerCircle);
     341  Set(name, setForceLineSegmentsPerCircle, requestedDepth);
     342}
     343
    290344////////////// /vis/geometry/set/forceSolid /////////////////////////
    291345
     
    295349  fpCommand = new G4UIcommand("/vis/geometry/set/forceSolid", this);
    296350  fpCommand->SetGuidance
    297    ("Sets logical volume(s) drawing always to be as solid (surface drawing).");
     351   ("Forces logical volume(s) always to be drawn solid (surface drawing),"
     352    "\nregardless of the view parameters.");
    298353  fpCommand->SetGuidance("\"all\" sets all logical volumes.");
    299354  fpCommand->SetGuidance
     
    345400  fpCommand = new G4UIcommand("/vis/geometry/set/forceWireframe", this);
    346401  fpCommand->SetGuidance
    347    ("Sets logical volume(s) drawing always to be as wireframe.");
     402   ("Forces logical volume(s) always to be drawn as wireframe,"
     403    "\nregardless of the view parameters.");
    348404  fpCommand->SetGuidance("\"all\" sets all logical volumes.");
    349405  fpCommand->SetGuidance
  • trunk/geant4/visualization/management/src/G4VisCommandsScene.cc

    r531 r593  
    2525//
    2626//
    27 // $Id: G4VisCommandsScene.cc,v 1.65 2006/11/26 19:37:54 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     27// $Id: G4VisCommandsScene.cc,v 1.66 2007/05/25 10:49:55 allison Exp $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929
    3030// /vis/scene commands - John Allison  9th August 1998
     
    480480  G4VSceneHandler* pCurrentSceneHandler =
    481481    fpVisManager -> GetCurrentSceneHandler();
     482  if (!pCurrentSceneHandler) {
     483    if (verbosity >= G4VisManager::warnings) {
     484      G4cout << "WARNING: No current scene handler."
     485             << G4endl;
     486    }
     487    return;
     488  }
    482489  G4VViewer* pCurrentViewer = fpVisManager -> GetCurrentViewer();
     490  if (!pCurrentViewer) {
     491    if (verbosity >= G4VisManager::warnings) {
     492      G4cout << "WARNING: No current viewer."
     493             << G4endl;
     494    }
     495    return;
     496  }
    483497  G4Scene* pCurrentScene = fpVisManager -> GetCurrentScene();
     498  if (!pCurrentScene) {
     499    if (verbosity >= G4VisManager::warnings) {
     500      G4cout << "WARNING: No current scene."
     501             << G4endl;
     502    }
     503    return;
     504  }
    484505  G4VisManager::Verbosity currentVerbosity = fpVisManager -> GetVerbosity();
    485506
  • trunk/geant4/visualization/management/src/G4VisCommandsSceneAdd.cc

    r531 r593  
    2626//
    2727// $Id: G4VisCommandsSceneAdd.cc,v 1.72 2006/11/25 15:37:31 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929// /vis/scene commands - John Allison  9th August 1998
    3030
  • trunk/geant4/visualization/management/src/G4VisCommandsSceneHandler.cc

    r531 r593  
    2626//
    2727// $Id: G4VisCommandsSceneHandler.cc,v 1.32 2006/06/29 21:29:46 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929
    3030// /vis/sceneHandler commands - John Allison  10th October 1998
  • trunk/geant4/visualization/management/src/G4VisCommandsViewer.cc

    r531 r593  
    2525//
    2626//
    27 // $Id: G4VisCommandsViewer.cc,v 1.66 2006/11/25 15:38:03 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     27// $Id: G4VisCommandsViewer.cc,v 1.68 2007/01/11 16:41:30 allison Exp $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929
    3030// /vis/viewer commands - John Allison  25th October 1998
     
    7373  fpCommand = new G4UIcommand ("/vis/viewer/addCutawayPlane", this);
    7474  fpCommand -> SetGuidance
    75     ("Add cutaway plane A*x + B*y + C*z + D = 0 to current viewer.");
     75    ("Add cutaway plane to current viewer.");
    7676  G4UIparameter* parameter;
    7777  parameter  =  new G4UIparameter("x",'d',omitable = true);
     
    11391139  G4Scene* scene = sceneHandler->GetScene();
    11401140  if (!scene) {
    1141     if (verbosity >= G4VisManager::warnings) {
    1142       G4cout << "WARNING: SceneHandler \"" << sceneHandler->GetName()
     1141    if (verbosity >= G4VisManager::confirmations) {
     1142      G4cout << "NOTE: SceneHandler \"" << sceneHandler->GetName()
    11431143             << "\", to which viewer \"" << refreshName << "\"" <<
    11441144        "\n  is attached, has no scene - \"/vis/scene/create\" and"
     
    14131413  G4Scene* scene = sceneHandler->GetScene();
    14141414  if (!scene) {
    1415     if (verbosity >= G4VisManager::warnings) {
    1416       G4cout << "WARNING: SceneHandler \"" << sceneHandler->GetName()
     1415    if (verbosity >= G4VisManager::confirmations) {
     1416      G4cout << "NOTE: SceneHandler \"" << sceneHandler->GetName()
    14171417             << "\", to which viewer \"" << updateName << "\"" <<
    14181418        "\n  is attached, has no scene - \"/vis/scene/create\" and"
  • trunk/geant4/visualization/management/src/G4VisCommandsViewerSet.cc

    r531 r593  
    2525//
    2626//
    27 // $Id: G4VisCommandsViewerSet.cc,v 1.47 2006/11/14 14:59:55 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     27// $Id: G4VisCommandsViewerSet.cc,v 1.49 2007/07/10 17:51:54 allison Exp $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929
    3030// /vis/viewer/set commands - John Allison  16th May 2000
     
    6767     "\nview parameters.");
    6868  fpCommandAutoRefresh->SetParameterName("auto-refresh",omitable = true);
    69   fpCommandAutoRefresh->SetDefaultValue(false);
     69  fpCommandAutoRefresh->SetDefaultValue(true);
    7070
    7171  fpCommandAuxEdge = new G4UIcmdWithABool
     
    7676     "\nsometimes called soft edges, become visible/invisible.");
    7777  fpCommandAuxEdge->SetParameterName("edge",omitable = true);
    78   fpCommandAuxEdge->SetDefaultValue(false);
     78  fpCommandAuxEdge->SetDefaultValue(true);
    7979
    8080  fpCommandBackground = new G4UIcommand
     
    247247  fpCommandLineSegments->SetParameterName("line-segments",omitable = true);
    248248  fpCommandLineSegments->SetDefaultValue(24);
     249
     250  fpCommandPicking = new G4UIcmdWithABool
     251    ("/vis/viewer/set/picking",this);
     252  fpCommandPicking->SetGuidance("Sets picking, if available.");
     253  fpCommandPicking->SetGuidance
     254    ("If true, view is set up for picking, if available."
     255     "\nFor required actions, watch for instructions for viewer.");
     256  fpCommandPicking->SetParameterName("picking",omitable = true);
     257  fpCommandPicking->SetDefaultValue(true);
    249258
    250259  fpCommandProjection = new G4UIcommand("/vis/viewer/set/projection",this);
     
    388397  delete fpCommandLightsThetaPhi;
    389398  delete fpCommandLightsVector;
     399  delete fpCommandPicking;
    390400  delete fpCommandProjection;
    391401  delete fpCommandSectionPlane;
     
    460470             << G4endl;
    461471    }
    462     currentViewer->SetViewParameters(vp);
    463     return;  // I.e., avoid a refresh for this command.
     472    if (!vp.IsAutoRefresh()) {
     473      currentViewer->SetViewParameters(vp);
     474      return;  // Avoid a refresh id auto-refresh has been set to off...
     475    }  // ...otherwise take normal action.
    464476  }
    465477
     
    754766  }
    755767
     768  else if (command == fpCommandPicking) {
     769    vp.SetPicking(G4UIcommand::ConvertToBool(newValue));
     770    if (verbosity >= G4VisManager::confirmations) {
     771      G4cout << "Picking ";
     772      if (vp.IsPicking()) G4cout << "requested.";
     773      else G4cout << "inhibited.";
     774      G4cout << G4endl;
     775    }
     776  }
     777
    756778  else if (command == fpCommandProjection) {
    757779    G4double fieldHalfAngle;
  • trunk/geant4/visualization/management/src/G4VisFeaturesOfDAWNFILE.cc

    r531 r593  
    2626//
    2727// $Id: G4VisFeaturesOfDAWNFILE.cc,v 1.6 2006/06/29 21:29:52 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030#include "G4VisFeaturesOfDAWNFILE.hh"
  • trunk/geant4/visualization/management/src/G4VisFeaturesOfFukuiRenderer.cc

    r531 r593  
    2626//
    2727// $Id: G4VisFeaturesOfFukuiRenderer.cc,v 1.5 2006/06/29 21:29:54 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/management/src/G4VisFeaturesOfOpenGL.cc

    r534 r593  
    2525//
    2626//
    27 // $Id: G4VisFeaturesOfOpenGL.cc,v 1.5 2006/06/29 21:29:56 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     27// $Id: G4VisFeaturesOfOpenGL.cc,v 1.6 2007/10/03 14:21:55 lgarnier Exp $
     28// GEANT4 tag $Name: $
    2929//
    3030//
  • trunk/geant4/visualization/management/src/G4VisFeaturesOfOpenInventor.cc

    r531 r593  
    2626//
    2727// $Id: G4VisFeaturesOfOpenInventor.cc,v 1.5 2006/06/29 21:29:58 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/management/src/G4VisManager.cc

    r564 r593  
    2424// ********************************************************************
    2525//
    26 // $Id: G4VisManager.cc,v 1.109 2006/11/26 15:43:51 allison Exp $
    27 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     26// $Id: G4VisManager.cc,v 1.113 2007/05/25 10:50:26 allison Exp $
     27// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2828//
    2929//
     
    7272#include "Randomize.hh"
    7373#include "G4RunManager.hh"
     74#include "G4EventManager.hh"
    7475#include "G4Run.hh"
    7576#include "G4Event.hh"
     
    8687  fpSceneHandler   (0),
    8788  fpViewer         (0),
    88   fVerbosity       (confirmations),//(warnings),
     89  fVerbosity       (warnings),
    8990  fpStateDependent (0),
    9091  fEventRefreshing          (false),
     
    9293  fTransientsDrawnThisEvent (false),
    9394  fEventKeepingSuspended    (false),
    94   fKeptLastEvent            (false)
     95  fKeptLastEvent            (false),
     96  fpRequestedEvent (0),
     97  fAbortReviewKeptEvents    (false)
    9598  // All other objects use default constructors.
    9699{
     
    118121  if (fpInstance) {
    119122    G4Exception
    120       ("G4VisManager: attempt to Construct more than one VisManager. ");
     123      ("G4VisManager: attempt to Construct more than one VisManager.");
    121124  }
    122125  else {
     
    584587  if (fpSceneHandler) {
    585588    G4VViewer* p = fpGraphicsSystem -> CreateViewer (*fpSceneHandler, name);
    586     if (p) {
    587       fpViewer = p;                             // Make current.
    588       fpViewer -> Initialise ();
    589       fpSceneHandler -> AddViewerToList (fpViewer);
    590       fpSceneHandler -> SetCurrentViewer (fpViewer);
    591 
    592       const G4ViewParameters& vp = fpViewer->GetViewParameters();
    593       G4bool warn = false;
    594       if (vp.IsCulling () && vp.IsCullingInvisible ()) {
    595         warn = true;
     589    if (!p) {
     590      if (fVerbosity >= errors) {
     591        G4cout << "ERROR in G4VisManager::CreateViewer during "
     592               << fpGraphicsSystem -> GetName ()
     593               << " viewer creation.\n  No action taken."
     594               << G4endl;
     595      }
     596    } else {
     597      p -> Initialise ();
     598      if (p -> GetViewId() < 0) {
     599        if (fVerbosity >= errors) {
     600        G4cout << "ERROR in G4VisManager::CreateViewer during "
     601               << fpGraphicsSystem -> GetName ()
     602               << " viewer initialisation.\n  No action taken."
     603               << G4endl;
     604        }
     605      } else {
     606        fpViewer = p;                             // Make current.
     607        fpSceneHandler -> AddViewerToList (fpViewer);
     608        fpSceneHandler -> SetCurrentViewer (fpViewer);
     609
    596610        if (fVerbosity >= confirmations) {
    597           G4cout << "G4VisManager::CreateViewer: new viewer created:"
     611          G4cout << "G4VisManager::CreateViewer: new viewer created."
    598612                 << G4endl;
    599613        }
     614
     615        const G4ViewParameters& vp = fpViewer->GetViewParameters();
    600616        if (fVerbosity >= parameters) {
    601617          G4cout << " view parameters are:\n  " << vp << G4endl;
    602618        }
    603         if (fVerbosity >= warnings) {
    604           G4cout <<
    605             "WARNING: objects with visibility flag set to \"false\""
    606             " will not be drawn!"
    607             "\n  \"/vis/viewer/set/culling global false\" to Draw such objects."
    608                  << G4endl;
    609         }
    610       }
    611       if (vp.IsCullingCovered ()) {
    612         if (!warn) {
     619
     620        if (vp.IsCulling () && vp.IsCullingInvisible ()) {
     621          static G4bool warned = false;
    613622          if (fVerbosity >= confirmations) {
    614             G4cout << "G4VisManager::CreateViewer: new viewer created:"
    615                    << G4endl;
     623            if (!warned) {
     624              G4cout <<
     625  "NOTE: objects with visibility flag set to \"false\""
     626  " will not be drawn!"
     627  "\n  \"/vis/viewer/set/culling global false\" to Draw such objects."
     628  "\n  Also see other \"/vis/viewer/set\" commands."
     629                     << G4endl;
     630              warned = true;
     631            }
    616632          }
    617633        }
    618         warn = true;
    619         if (fVerbosity >= warnings) {
    620           G4cout <<
    621             "WARNING: covered objects in solid mode will not be rendered!"
    622             "\n  \"/vis/viewer/set/culling coveredDaughters false\" to reverse this."
    623                  << G4endl;
     634        if (vp.IsCullingCovered ()) {
     635          static G4bool warned = false;
     636          if (fVerbosity >= warnings) {
     637            if (!warned) {
     638              G4cout <<
     639  "WARNING: covered objects in solid mode will not be rendered!"
     640  "\n  \"/vis/viewer/set/culling coveredDaughters false\" to reverse this."
     641  "\n  Also see other \"/vis/viewer/set\" commands."
     642                     << G4endl;
     643              warned = true;
     644            }
     645          }
    624646        }
    625       }
    626       if (warn) {
    627         if (fVerbosity >= warnings) {
    628           G4cout << "  Also see other \"/vis/viewer/set\" commands."
    629                  << G4endl;
    630         }
    631       }
    632     }
    633     else {
    634       if (fVerbosity >= errors) {
    635         G4cout << "ERROR in G4VisManager::CreateViewer during "
    636                << fpGraphicsSystem -> GetName ()
    637                <<       " viewer creation.\n  No action taken."
    638                << G4endl;
    639647      }
    640648    }
     
    893901
    894902  // Top level basic commands...
     903  RegisterMessenger(new G4VisCommandAbortReviewKeptEvents);
    895904  RegisterMessenger(new G4VisCommandEnable);
    896905  RegisterMessenger(new G4VisCommandList);
     
    921930  RegisterMessenger(new G4VisCommandGeometrySetLineWidth);
    922931  RegisterMessenger(new G4VisCommandGeometrySetForceAuxEdgeVisible);
     932  RegisterMessenger(new G4VisCommandGeometrySetForceLineSegmentsPerCircle);
    923933  RegisterMessenger(new G4VisCommandGeometrySetForceSolid);
    924934  RegisterMessenger(new G4VisCommandGeometrySetForceWireframe);
     
    11041114void G4VisManager::BeginOfRun ()
    11051115{
    1106   G4cout << "G4VisManager::BeginOfRun" << G4endl;
     1116  //G4cout << "G4VisManager::BeginOfRun" << G4endl;
    11071117  fKeptLastEvent = false;
    11081118  fEventKeepingSuspended = false;
     
    11131123void G4VisManager::BeginOfEvent ()
    11141124{
    1115   G4cout << "G4VisManager::BeginOfEvent" << G4endl;
     1125  //G4cout << "G4VisManager::BeginOfEvent" << G4endl;
    11161126  fTransientsDrawnThisEvent = false;
    11171127  if (fpSceneHandler) fpSceneHandler->SetTransientsDrawnThisEvent(false);
     
    11201130void G4VisManager::EndOfEvent ()
    11211131{
    1122   G4cout << "G4VisManager::EndOfEvent" << G4endl;
     1132  //G4cout << "G4VisManager::EndOfEvent" << G4endl;
    11231133
    11241134  // Don't call IsValidView unless there is a scene handler.  This
     
    11311141  const G4Run* currentRun = runManager->GetCurrentRun();
    11321142
    1133   const G4Event* currentEvent =
    1134     G4EventManager::GetEventManager()->GetConstCurrentEvent();
     1143  G4EventManager* eventManager = G4EventManager::GetEventManager();
     1144  const G4Event* currentEvent = eventManager->GetConstCurrentEvent();
    11351145  if (!currentEvent) return;
    11361146
    11371147  ClearTransientStoreIfMarked();
    1138   printf("G4VisManager::DrawEvent \n");
    11391148  fpSceneHandler->DrawEvent(currentEvent);
    1140   printf("G4VisManager::DrawEvent END\n");
    11411149
    11421150  G4int nEventsToBeProcessed = 0;
     
    11601168      // Keep, but only if user has not kept any...
    11611169      if (!nKeptEvents) {
    1162         G4EventManager::GetEventManager()->KeepTheCurrentEvent();
     1170        eventManager->KeepTheCurrentEvent();
    11631171        fKeptLastEvent = true;
    11641172      }
     
    11821190      }
    11831191    } else if (maxNumberOfKeptEvents != 0) {
    1184       G4EventManager::GetEventManager()->KeepTheCurrentEvent();
     1192      eventManager->KeepTheCurrentEvent();
    11851193    }
    11861194  }
     
    11891197void G4VisManager::EndOfRun ()
    11901198{
    1191   G4cout << "G4VisManager::EndOfRun" << G4endl;
     1199  //G4cout << "G4VisManager::EndOfRun" << G4endl;
    11921200
    11931201  // Don't call IsValidView unless there is a scene handler.  This
  • trunk/geant4/visualization/management/src/G4VisStateDependent.cc

    r561 r593  
    2626//
    2727// $Id: G4VisStateDependent.cc,v 1.6 2006/06/29 21:30:02 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929
    3030#include "G4VisStateDependent.hh"
     
    4646  }
    4747  else if (previousState == G4State_EventProc &&  requestedState == G4State_GeomClosed) {
    48     printf("G4VisStateDependent::EndOfEvent \n");
    4948    fpVisManager -> EndOfEvent ();
    5049  }
Note: See TracChangeset for help on using the changeset viewer.