Changeset 593 for trunk/geant4
- Timestamp:
- Nov 9, 2007, 3:32:25 PM (17 years ago)
- 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 gbarrandExp $1 # $Id: G4UI_BUILD.gmk,v 1.5 2007/10/03 12:15:05 lgarnier Exp $ 2 2 # ------------------------------------------------------------- 3 3 # 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 gbarrandExp $1 # $Id: G4UI_USE.gmk,v 1.9 2007/10/03 12:15:05 lgarnier Exp $ 2 2 # ------------------------------------------------------------- 3 3 # 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 allisonExp $1 # $Id: G4VIS_BUILD.gmk,v 1.20 2007/10/03 12:15:05 lgarnier Exp $ 2 2 # ------------------------------------------------------------- 3 3 # Visualization-specific CPPFLAGS for BUILD phase. -
trunk/geant4/config/G4VIS_USE.gmk
r574 r593 1 # $Id: G4VIS_USE.gmk,v 1.2 2 2005/10/05 17:35:40 allisonExp $1 # $Id: G4VIS_USE.gmk,v 1.23 2007/10/03 12:15:05 lgarnier Exp $ 2 2 # ------------------------------------------------------------- 3 3 # GNUmakefile for CPPFLAGS for visualization USE phase. -
trunk/geant4/config/History
r483 r593 1 $Id: History,v 1. 288 2006/11/30 15:47:16gcosmo Exp $1 $Id: History,v 1.300 2007/08/16 09:34:51 gcosmo Exp $ 2 2 ------------------------------------------------------------------- 3 3 … … 16 16 * Reverse chronological order (last date on top), please * 17 17 ---------------------------------------------------------- 18 19 16th 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 23 15th August 2007 Gabriele Cosmo (config-V09-00-03) 24 - Added "rpg" hadronic model module to binmake.gmk. 25 26 13th August 2007 Gabriele Cosmo (config-V09-00-02) 27 - SUN-CC.gmk: forced -xO2 as optimisation level. 28 29 18th 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 36 11th July 2007 Makoto Asai (config-V09-00-00) 37 - Added digits_hits/scorer sub-directory to binmake.gmk. 38 39 28th 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 44 22nd 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 50 18th 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 54 27th May 2007 Gabriele Cosmo (config-V08-03-01) 55 - Added "lll_fission" hadronic model module to binmake.gmk. 56 57 12th 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 61 21st March 2007 Gabriele Cosmo 62 - Added "biasing" module to binmake.gmk. 63 64 28th 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. 18 70 19 71 3rd November 2006 Gunter Folger (config-V08-01-07) -
trunk/geant4/config/architecture.gmk
r483 r593 1 # $Id: architecture.gmk,v 1.1 07 2006/10/31 11:35:43 gunterExp $1 # $Id: architecture.gmk,v 1.110 2007/06/28 14:16:55 gcosmo Exp $ 2 2 # ------------------------------------------------------------------------ 3 3 # GEANT 4 - Architecture configuration script for GNU Make … … 14 14 # the environment variable G4SYSTEM: 15 15 # 16 # Linux-g++ Linux (Red Hat Enterprise/SCL 3), gcc-3.2.3(default)17 # 18 # SUN-CC SunOS 5.8, CC 5. 419 # 20 # WIN32-VC Windows/XP and Microsoft Visual C++ 7.1 .NET16 # 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 21 21 # Adding CYGWIN32 tools 22 22 # ------------------------------------------------------------------------- … … 52 52 endif 53 53 G4DUMMY_VARIABLE:=$(shell [ ! -d $(G4TMP) ] && mkdir -p $(G4TMP) ) 54 54 55 55 # If not specified, the default path for G4 libraries G4LIB is 56 56 # set to $G4INSTALL/lib/$G4SYSTEM ... … … 111 111 G4LIB_BUILD_ZLIB = 1 112 112 G4LIB_USE_ZLIB = 1 113 endif114 115 # Allow to disable building of physics_lists module. Default is to build these116 #117 ifneq ($(G4LIB_BUILD_LISTS),NO)118 G4LIB_BUILD_LISTS = 1119 113 endif 120 114 … … 305 299 OGLFLAGS:= $(filter-out -I/usr//include,$(OGLFLAGS)) 306 300 endif 307 308 301 309 302 # If there is no cbrt() function... 310 303 # -
trunk/geant4/config/binmake.gmk
r483 r593 1 # $Id: binmake.gmk,v 1.1 16 2006/11/08 16:52:19 gunterExp $1 # $Id: binmake.gmk,v 1.129 2007/08/16 09:46:02 gcosmo Exp $ 2 2 # ---------------------------------------------------------- 3 3 # Script defining rules and paths for making binaries. … … 61 61 -I$(G4BASE)/particles/hadrons/mesons/include \ 62 62 -I$(G4BASE)/particles/shortlived/include \ 63 64 63 -I$(G4BASE)/physics_lists/lists/include \ 64 -I$(G4BASE)/physics_lists/builders/include \ 65 65 -I$(G4BASE)/processes/management/include \ 66 66 -I$(G4BASE)/processes/cuts/include \ 67 -I$(G4BASE)/processes/biasing/include \ 67 68 -I$(G4BASE)/processes/scoring/include \ 68 69 -I$(G4BASE)/processes/decay/include \ … … 78 79 -I$(G4BASE)/processes/electromagnetic/polarisation/include \ 79 80 -I$(G4BASE)/processes/hadronic/cross_sections/include \ 80 81 81 -I$(G4BASE)/processes/hadronic/management/include \ 82 -I$(G4BASE)/processes/hadronic/models/abrasion/include \ 82 83 -I$(G4BASE)/processes/hadronic/models/binary_cascade/include \ 83 84 85 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 \ 86 87 -I$(G4BASE)/processes/hadronic/models/chiral_inv_phase_space/body/include \ 87 88 -I$(G4BASE)/processes/hadronic/models/chiral_inv_phase_space/interface/include \ 88 89 -I$(G4BASE)/processes/hadronic/models/coherent_elastic/include \ 89 90 -I$(G4BASE)/processes/hadronic/models/de_excitation/ablation/include \ 90 91 -I$(G4BASE)/processes/hadronic/models/de_excitation/evaporation/include \ 91 92 -I$(G4BASE)/processes/hadronic/models/de_excitation/fermi_breakup/include \ 92 93 -I$(G4BASE)/processes/hadronic/models/de_excitation/fission/include \ 93 94 -I$(G4BASE)/processes/hadronic/models/de_excitation/gem_evaporation/include \ 94 95 -I$(G4BASE)/processes/hadronic/models/de_excitation/handler/include \ … … 104 105 -I$(G4BASE)/processes/hadronic/models/isotope_production/include \ 105 106 -I$(G4BASE)/processes/hadronic/models/leading_particle/include \ 107 -I$(G4BASE)/processes/hadronic/models/lll_fission/include \ 106 108 -I$(G4BASE)/processes/hadronic/models/low_energy/include \ 107 109 -I$(G4BASE)/processes/hadronic/models/management/include \ … … 118 120 -I$(G4BASE)/processes/hadronic/models/relativistic_qmd/include \ 119 121 -I$(G4BASE)/processes/hadronic/models/relativistic_qmd/uplusplus/include \ 122 -I$(G4BASE)/processes/hadronic/models/rpg/include \ 120 123 -I$(G4BASE)/processes/hadronic/models/theo_high_energy/include \ 121 124 -I$(G4BASE)/processes/hadronic/models/util/include \ … … 138 141 -I$(G4BASE)/digits_hits/hits/include \ 139 142 -I$(G4BASE)/digits_hits/digits/include \ 143 -I$(G4BASE)/digits_hits/scorer/include \ 140 144 -I$(G4BASE)/digits_hits/utils/include \ 141 145 -I$(G4BASE)/persistency/include \ 142 146 -I$(G4BASE)/readout/include \ 143 147 -I$(G4BASE)/event/include \ 148 -I$(G4BASE)/error_propagation/include \ 144 149 -I$(G4BASE)/graphics_reps/include \ 145 150 -I$(G4BASE)/intercoms/include … … 207 212 endif 208 213 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 \ 216 218 -lG4event \ 217 219 -lG4tracking \ 218 220 -lG4parmodels \ 219 221 -lG4processes \ 220 222 -lG4digits_hits \ … … 232 234 LDLIBS2 = $(shell \ 233 235 G4TMP=$(G4TMP); export G4TMP; \ 234 235 236 237 238 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) 239 241 else 240 242 LDLIBS2 = $(shell \ 241 243 G4TMP=$(G4TMP); export G4TMP; \ 242 243 244 245 246 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) 247 249 # Warning: do not add to LDLIBS2 with += because this causes it to be 248 250 # expanded too soon. Hence extra libraries must have a different name... … … 283 285 284 286 ifneq (,$(findstring WIN32-VC,$(G4SYSTEM))) 287 # Windows 285 288 WIN32TMP := $(patsubst -L%,$(LIB_PATH)%,$(LDFLAGS)) 286 289 LDFLAGS = $(patsubst /,$(PATH_DEL),$(WIN32TMP)) … … 292 295 LDLIBS = $(TARGETLIB) $(patsubst -l%,lib%.a,$(WIN32TMP3)) $(patsubst -l%,lib%.lib,$(WIN32TMP4)) 293 296 else 294 297 LDLIBS = $(TARGETLIB) $(patsubst -l%,lib%.lib,$(WIN32TMP2)) 295 298 endif 296 299 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 303 else 304 # Unix 300 305 LDLIBS = $(TARGETLIB) $(LDLIBS_PREFINAL) 306 OUT := -o 301 307 endif 302 308 … … 305 311 include $(G4INSTALL)/config/sys/$(G4SYSTEM)-runpath.gmk 306 312 endif 307 313 308 314 sources := $(wildcard $(G4TARGET).cc) 309 315 objects := $(patsubst %.cc,$(G4TMPDIR)/exe/%.$(TARGOBJEXT),$(sources)) … … 340 346 ifdef CPPVERBOSE 341 347 $(CXX) $(CXXFLAGS) $(CPPFLAGS) \ 342 -o$(G4BINDIR)/$(G4TARGET) $(objects) $(LDFLAGS) \348 $(OUT)$(G4BINDIR)/$(G4TARGET) $(objects) $(LDFLAGS) \ 343 349 $(LDLIBS) 344 350 else 345 351 @echo Linking $(G4TARGET) ... 346 352 @$(CXX) $(CXXFLAGS) $(CPPFLAGS) \ 347 -o$(G4BINDIR)/$(G4TARGET) $(objects) $(LDFLAGS) \353 $(OUT)$(G4BINDIR)/$(G4TARGET) $(objects) $(LDFLAGS) \ 348 354 $(LDLIBS) 349 355 @if [ \( -f $(G4BINDIR)/$(G4TARGET) \) ]; then \ … … 402 408 [ -s $@ ] || rm -f $@ 403 409 ifneq ($(dependencies),) 410 ifneq ($(MAKECMDGOALS),clean) 404 411 -include $(dependencies) 412 endif 405 413 endif 406 414 -
trunk/geant4/config/common.gmk
r472 r593 1 # $Id: common.gmk,v 1.4 1 2005/12/07 09:41:54gcosmo Exp $1 # $Id: common.gmk,v 1.43 2007/06/28 14:33:38 gcosmo Exp $ 2 2 # ---------------------------------------------------------------- 3 3 # Common part of GNUmakefile for libraries. John Allison, 5/7/95. … … 111 111 [ -s $@ ] || rm -f $@ 112 112 ifneq ($(dependencies),) 113 ifneq ($(MAKECMDGOALS),clean) 113 114 -include $(dependencies) 115 endif 114 116 endif 115 117 … … 122 124 # NOTE: the double colon rule allows to add other rules for the same target 123 125 # 124 includes:: 126 includes:: $(installed_includes) 125 127 126 128 # Static Pattern rules, see GNU make manual for details. 127 # target(s): target-pattern : dep-pattern 129 # target(s): target-pattern : dep-pattern 128 130 # 129 131 $(installed_includes): $(G4INCLUDE)/% : include/% -
trunk/geant4/config/liblist.c
r483 r593 1 /* $Id: liblist.c,v 1.1 8 2006/10/05 14:22:06gcosmo Exp $ */1 /* $Id: liblist.c,v 1.19 2007/07/18 14:21:15 gcosmo Exp $ */ 2 2 3 3 /* … … 304 304 #if defined ( _WIN32 ) || defined ( __CYGWIN__ ) || defined ( __CYGWIN32__ ) 305 305 ptr=strchr(ntg4tmp1,':'); 306 if ( ptr ) *(ptr+1)='\0';307 306 308 307 while ( ptr=strchr(buffer,'\\') ) *ptr='/'; -
trunk/geant4/config/scripts/env.csh.SH
r483 r593 38 38 unsetenv G4LEDATA 39 39 unsetenv G4LEVELGAMMADATA 40 unsetenv NeutronHPCrossSections40 unsetenv G4NEUTRONHPDATA 41 41 unsetenv G4RADIOACTIVEDATA 42 42 … … 141 141 #+ 142 142 if ( X$g4neutronhpcrosssections != X ) then 143 setenv NeutronHPCrossSections"$g4neutronhpcrosssections"144 echo "On this machine the NeutronHPCrossSections=\$NeutronHPCrossSections"143 setenv G4NEUTRONHPDATA "$g4neutronhpcrosssections" 144 echo "On this machine the G4NEUTRONHPDATA=\$G4NEUTRONHPDATA" 145 145 endif 146 146 -
trunk/geant4/config/scripts/env.sh.SH
r483 r593 38 38 unset G4LEDATA 39 39 unset G4LEVELGAMMADATA 40 unset NeutronHPCrossSections40 unset G4NEUTRONHPDATA 41 41 unset G4RADIOACTIVEDATA 42 42 … … 164 164 #+ 165 165 if [ X$g4neutronhpcrosssections != X ] ; then 166 NeutronHPCrossSections="$g4neutronhpcrosssections"167 export NeutronHPCrossSections168 if [ X\$g4non_display = X ] ; then 169 echo "On this machine the NeutronHPCrossSections=\$NeutronHPCrossSections"166 G4NEUTRONHPDATA="$g4neutronhpcrosssections" 167 export G4NEUTRONHPDATA 168 if [ X\$g4non_display = X ] ; then 169 echo "On this machine the G4NEUTRONHPDATA=\$G4NEUTRONHPDATA" 170 170 fi 171 171 fi … … 618 618 if [ $G4WORKDIR ] ; then 619 619 620 if [ X $g4non_display = X ] ; then620 if [ X\$g4non_display = X ] ; then 621 621 echo "In your environment you have the G4WORKDIR=$G4WORKDIR" 622 622 fi … … 627 627 if test "X$G4SYSTEM" = "XWIN32-VC" -o "X$G4SYSTEM" = "XWIN32-VC7"; then 628 628 629 if [ X $g4non_display = X ] ; then629 if [ X\$g4non_display = X ] ; then 630 630 echo "G4WORKDIR will be set to c:/geant4 (in "native" Windows syntax)" 631 631 fi … … 636 636 else # if Unix 637 637 638 if [ X $g4non_display = X ] ; then638 if [ X\$g4non_display = X ] ; then 639 639 echo "G4WORKDIR will be set to HOME/geant4=$HOME/geant4" 640 640 fi … … 657 657 # Warning about LD_LIBRARY_PATH 658 658 # 659 if [ X$g4non_display = X ] ; then660 659 echo '' 661 660 echo 'LD_LIBRARY_PATH is set to include CLHEP and Geant4 libraries. ' … … 667 666 echo 'present in your system !' 668 667 echo '' 669 fi670 668 671 669 if [ $LD_LIBRARY_PATH ] ; then -
trunk/geant4/config/scripts/install.sh.SH
r483 r593 38 38 unset G4LEDATA 39 39 unset G4LEVELGAMMADATA 40 unset NeutronHPCrossSections40 unset G4NEUTRONHPDATA 41 41 unset G4RADIOACTIVEDATA 42 42 … … 145 145 #+ 146 146 if [ X$g4neutronhpcrosssections != X ] ; then 147 NeutronHPCrossSections="$g4neutronhpcrosssections"148 export NeutronHPCrossSections149 echo "On this machine the NeutronHPCrossSections=\$NeutronHPCrossSections"147 G4NEUTRONHPDATA="$g4neutronhpcrosssections" 148 export G4NEUTRONHPDATA 149 echo "On this machine the G4NEUTRONHPDATA=\$G4NEUTRONHPDATA" 150 150 fi 151 151 -
trunk/geant4/config/scripts/move.sh.SH
r483 r593 90 90 #+ 91 91 if [ X$g4neutronhpcrosssections != X ] ; then 92 NeutronHPCrossSections="$g4neutronhpcrosssections"93 export NeutronHPCrossSections94 echo "On this machine the NeutronHPCrossSections=\$NeutronHPCrossSections"92 G4NEUTRONHPDATA="$g4neutronhpcrosssections" 93 export G4NEUTRONHPDATA 94 echo "On this machine the G4NEUTRONHPDATA=\$G4NEUTRONHPDATA" 95 95 fi 96 96 … … 385 385 echo "" 386 386 mkdir -p $g4final_install/src/geant4/ 387 tar cf - Configure config/ source/ environments/ physics_lists/ examples/ |(cd $g4final_install/src/geant4/; tar xf -)387 tar cf - Configure config/ source/ environments/ examples/ include/ |(cd $g4final_install/src/geant4/; tar xf -) 388 388 fi 389 389 fi … … 399 399 400 400 mkdir -p $g4final_install/src/geant4/ 401 tar cf - Configure config/ source/ environments/ physics_lists/examples/ |(cd $g4final_install/src/geant4/; tar xf -)401 tar cf - Configure config/ source/ environments/ examples/ |(cd $g4final_install/src/geant4/; tar xf -) 402 402 fi 403 403 -
trunk/geant4/config/sys/Darwin-g++.gmk
r592 r593 43 43 # XMFLAGS := -I/usr/X11R6/include ##### some installations. 44 44 endif 45 ifndef QTFLAGS46 QTHOME := /usr/local/Qt/4.2.247 # 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)/lib48 QTFLAGS := -I$(QTHOME)/include/Qt -F$(QTHOME)/lib49 MOC := $(QTHOME)/bin/moc50 endif51 45 ifndef XMLIBS 52 46 XMLIBS := -L/sw/lib -lXm -lXpm 53 47 # XMLIBS := -L/usr/X11R6/lib -lXm -lXpm ##### some installations. 54 48 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 55 61 ifndef QTLIBS 56 QT HOME := /usr/local/Qt/4.2.257 QTLIBS := -F$(QTHOME)/lib -framework QtCore -framework QtGui-framework QtOpenGL -framework QtSql -framework QtXml62 QTLIBS := -F$(QTHOME)/lib -framework QtCore -framework QtGui 63 QTLIBS += -framework QtOpenGL -framework QtSql -framework QtXml 58 64 endif 59 65 ifndef XAWFLAGS -
trunk/geant4/config/sys/SUN-CC.gmk
r472 r593 5 5 CXX := CC 6 6 ifdef G4OPTIMISE 7 CXXFLAGS := - O7 CXXFLAGS := -xO2 8 8 else 9 9 ifdef G4DEBUG -
trunk/geant4/interfaces/GAG/include/G4UIGAG.hh
r483 r593 26 26 // 27 27 // $Id: G4UIGAG.hh,v 1.7 2006/06/29 19:09:18 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // G4UIGAG.hh -
trunk/geant4/interfaces/GAG/include/G4UIGainServer.hh
r483 r593 26 26 // 27 27 // $Id: G4UIGainServer.hh,v 1.5 2006/06/29 19:09:21 gunter Exp $ 28 // $Name: geant4-0 8-01-patch-01 $28 // $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 -
trunk/geant4/interfaces/GAG/src/G4UIGAG.cc
r483 r593 26 26 // 27 27 // $Id: G4UIGAG.cc,v 1.18 2006/06/29 19:09:23 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // G4UIGAG.cc -
trunk/geant4/interfaces/GAG/src/G4UIGainServer.cc
r483 r593 27 27 // 12/06/2002 G4UIGainServer H. MInamimoto and H. Yoshida created 28 28 // $Id: G4UIGainServer.cc,v 1.10 2006/06/29 19:09:25 gunter Exp $ 29 // $Name: geant4-0 8-01-patch-01 $29 // $Name: geant4-09-00-ref-01 $ 30 30 // 31 31 #ifndef WIN32 -
trunk/geant4/interfaces/History
r476 r593 1 $Id: History,v 1. 78 2005/11/28 18:20:20gcosmo Exp $1 $Id: History,v 1.82 2007/06/19 10:38:28 gcosmo Exp $ 2 2 ------------------------------------------------------------------- 3 3 … … 18 18 ---------------------------------------------------------- 19 19 20 19 June 2007, Gabriele Cosmo (interfaces-V08-03-02) 21 - Fix compilation error on Windows ('theShell' not declared). 22 23 14 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 29 22 May 2007, Koichi Murakami (interface-V08-03-00) 30 - G4UIterminal.cc: implement signal handler for soft-abort 31 20 32 28 November 2005, Gabriele Cosmo (interface-V07-01-02) 21 33 - G4UIXm.cc migrated to sstream -
trunk/geant4/interfaces/basic/GNUmakefile
r494 r593 1 # $Id: GNUmakefile,v 1. 2 2005/01/26 08:50:58 gcosmoExp $1 # $Id: GNUmakefile,v 1.3 2007/05/21 07:30:33 kmura Exp $ 2 2 # ------------------------------------------------------------- 3 3 # GNUmakefile for interfaces/basic library. John Allison, 6/7/98. 4 5 #ifdef G4UI_USE_QT6 # 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.cc9 #endif10 4 11 5 name := G4UIbasic … … 22 16 CPPFLAGS += -I$(G4BASE)/interfaces/common/include 23 17 CPPFLAGS += -I$(G4BASE)/intercoms/include 24 25 18 CPPFLAGS += -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 26 44 27 45 include $(G4INSTALL)/config/common.gmk 46 -
trunk/geant4/interfaces/basic/include/G4UIArrayString.hh
r483 r593 26 26 // 27 27 // $Id: G4UIArrayString.hh,v 1.3 2006/06/29 19:09:27 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 -
trunk/geant4/interfaces/basic/include/G4UIQt.hh
r577 r593 25 25 // 26 26 // 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: $ 29 29 // 30 30 #ifndef G4UIQt_h … … 38 38 #include "G4VInteractiveSession.hh" 39 39 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> 48 41 42 class QMainWindow; 43 class QLineEdit; 49 44 class G4UIsession; 50 45 class QListWidget; 46 class QTextEdit; 47 class QLabel; 48 class QDialog; 49 class QTreeWidgetItem; 50 class QTreeWidget; 51 51 52 52 // Class description : -
trunk/geant4/interfaces/basic/include/G4UIWin32.hh
r483 r593 26 26 // 27 27 // $Id: G4UIWin32.hh,v 1.14 2006/06/29 19:09:29 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 #ifndef G4UIWin32_h -
trunk/geant4/interfaces/basic/include/G4UIXaw.hh
r483 r593 26 26 // 27 27 // $Id: G4UIXaw.hh,v 1.6 2006/06/29 19:09:31 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 #ifndef G4UIXaw_h -
trunk/geant4/interfaces/basic/include/G4UIXm.hh
r483 r593 26 26 // 27 27 // $Id: G4UIXm.hh,v 1.13 2006/06/29 19:09:33 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 #ifndef G4UIXm_h -
trunk/geant4/interfaces/basic/include/G4UIcsh.hh
r483 r593 26 26 // 27 27 // $Id: G4UIcsh.hh,v 1.4 2006/06/29 19:09:35 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 -
trunk/geant4/interfaces/basic/include/G4UItcsh.hh
r483 r593 25 25 // 26 26 // 27 // $Id: G4UItcsh.hh,v 1. 7 2006/06/29 19:09:37 gunterExp $28 // GEANT4 tag $Name: geant4-0 8-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 $ 29 29 // 30 30 … … 40 40 #include "G4UIcommandTree.hh" 41 41 42 // 42 // ==================================================================== 43 43 // Description: 44 44 // This class gives tcsh-like shell. … … 68 68 // %h ... history# (different from G4 history#) 69 69 // 70 // ==================================================================== 70 71 71 72 class G4UItcsh : public G4VUIshell { … … 125 126 void SetLsColor(TermColorIndex dirColor, TermColorIndex cmdColor); 126 127 virtual G4String GetCommandLine(const char* msg=0); 128 129 virtual void ResetTerminal(); 127 130 }; 128 131 132 // ==================================================================== 133 // inline functions 134 // ==================================================================== 129 135 inline G4bool G4UItcsh::IsCursorLast() const 130 136 { -
trunk/geant4/interfaces/basic/include/G4UIterminal.hh
r483 r593 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4UIterminal.hh,v 1.10 2007/05/22 01:51:05 kmura Exp $ 27 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 26 28 // 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 39 31 // 40 32 // Description: … … 69 61 // 70 62 // 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" 72 71 73 72 class G4UIterminal : public G4VBasicShell { … … 82 81 83 82 public: 84 G4UIterminal(G4VUIshell* aShell=0 );83 G4UIterminal(G4VUIshell* aShell=0, G4bool qsig=true); 85 84 ~G4UIterminal(); 86 85 -
trunk/geant4/interfaces/basic/include/G4VUIshell.hh
r483 r593 25 25 // 26 26 // 27 // $Id: G4VUIshell.hh,v 1. 6 2006/06/29 19:09:41 gunterExp $28 // GEANT4 tag $Name: geant4-0 8-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 $ 29 29 // 30 30 … … 34 34 #include "globals.hh" 35 35 36 // 36 // ==================================================================== 37 37 // Description: 38 38 // This class is the abstract base class for various UI shells. … … 50 50 // %/ ... current working directory 51 51 // 52 // ==================================================================== 52 53 53 54 // terminal color index … … 95 96 // get command string from a command line 96 97 virtual G4String GetCommandLine(const char* msg=0)= 0; 98 99 virtual void ResetTerminal(); 97 100 }; 98 101 99 100 // inlines... 102 // ==================================================================== 103 // inline functions 104 // ==================================================================== 101 105 inline void G4VUIshell::SetNColumn(G4int ncol) 102 106 { -
trunk/geant4/interfaces/basic/src/G4UIArrayString.cc
r483 r593 26 26 // 27 27 // $Id: G4UIArrayString.cc,v 1.8 2006/06/29 19:09:43 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 -
trunk/geant4/interfaces/basic/src/G4UIQt.cc
r579 r593 25 25 // 26 26 // 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: $ 29 29 // 30 30 // L. Garnier … … 46 46 #include "G4Qt.hh" 47 47 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 59 66 60 67 #include <stdlib.h> -
trunk/geant4/interfaces/basic/src/G4UIQt_moc.cc
r577 r593 2 2 ** Meta object code from reading C++ file 'G4UIQt.hh' 3 3 ** 4 ** Created: Mon Sep 17 14:28:15 20074 ** Created: Mon Oct 1 10:59:35 2007 5 5 ** by: The Qt Meta Object Compiler version 59 (Qt 4.2.2) 6 6 ** 7 7 ** WARNING! All changes made in this file will be lost! 8 8 *****************************************************************************/ 9 10 #ifdef G4UI_BUILD_QT_SESSION 9 11 10 12 #include "../include/G4UIQt.hh" … … 99 101 QMetaObject::activate(this, &staticMetaObject, 0, _a); 100 102 } 103 104 #endif -
trunk/geant4/interfaces/basic/src/G4UIWin32.cc
r483 r593 26 26 // 27 27 // $Id: G4UIWin32.cc,v 1.13 2006/06/29 19:09:45 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // G.Barrand -
trunk/geant4/interfaces/basic/src/G4UIXaw.cc
r483 r593 26 26 // 27 27 // $Id: G4UIXaw.cc,v 1.6 2006/06/29 19:09:47 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // G.Barrand -
trunk/geant4/interfaces/basic/src/G4UIXm.cc
r483 r593 26 26 // 27 27 // $Id: G4UIXm.cc,v 1.14 2006/06/29 19:09:49 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // G.Barrand -
trunk/geant4/interfaces/basic/src/G4UIcsh.cc
r483 r593 26 26 // 27 27 // $Id: G4UIcsh.cc,v 1.8 2006/06/29 19:09:51 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 -
trunk/geant4/interfaces/basic/src/G4UItcsh.cc
r483 r593 25 25 // 26 26 // 27 // $Id: G4UItcsh.cc,v 1.1 2 2006/06/29 19:09:54 gunterExp $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: $ 29 29 // 30 30 … … 37 37 #include <ctype.h> 38 38 #include <sstream> 39 #include <fstream> 40 #include <stdlib.h> 39 41 40 42 // ASCII character code … … 59 61 static const int AsciiPrintableMin = 32; 60 62 63 // history file 64 static const G4String historyFileName= "/.g4_hist"; 65 61 66 ///////////////////////////////////////////////////////// 62 67 G4UItcsh::G4UItcsh(const G4String& prompt, G4int maxhist) … … 69 74 // get current terminal mode 70 75 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(); 71 94 } 72 95 … … 75 98 ///////////////////// 76 99 { 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 } 78 113 79 /////////////////////////// 114 histfile.close(); 115 } 116 117 ////////////////////////////////////////// 80 118 void G4UItcsh::MakePrompt(const char* msg) 81 /////////////////////////// 119 ////////////////////////////////////////// 82 120 { 83 121 if(promptSetting.length()<=1) { … … 130 168 } 131 169 170 171 ////////////////////////////// 172 void G4UItcsh::ResetTerminal() 173 ////////////////////////////// 174 { 175 RestoreTerm(); 176 } 177 178 132 179 // -------------------------------------------------------------------- 133 180 // commad line operations … … 465 512 466 513 G4int jt= input.find_last_of('/'); 467 if(jt<jhead) jt=G4 String::npos;514 if(jt<jhead) jt=G4int(G4String::npos); 468 515 469 516 if(jt==G4int(G4String::npos)) jt= jhead; … … 472 519 G4String dspstr; 473 520 G4int i; 474 for(i=jt; i<=G4int(input.length())-1; i++) dspstr+= G4String(AsciiBS); // cleanup521 for(i=jt; i<=G4int(input.length())-1; i++) dspstr+= G4String(AsciiBS); 475 522 for(i=jt; i<=G4int(input.length())-1; i++) dspstr+= G4String(' '); 476 523 for(i=jt; i<=G4int(input.length())-1; i++) dspstr+= G4String(AsciiBS); … … 592 639 } 593 640 594 /////////////////////////////////// 641 ////////////////////////////////////////////////// 595 642 G4String G4UItcsh::GetCommandLine(const char* msg) 596 /////////////////////////////////// 643 ////////////////////////////////////////////////// 597 644 { 598 645 SetTermToInputMode(); -
trunk/geant4/interfaces/basic/src/G4UIterminal.cc
r483 r593 25 25 // 26 26 // 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 // ==================================================================== 31 34 #include "G4Types.hh" 32 35 #include "G4StateManager.hh" … … 38 41 #include <sstream> 39 42 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 51 static G4VUIshell* theshell= 0; 52 53 #ifndef WIN32 54 55 extern "C" { 56 57 //////////////////////////////// 58 static 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 /////////////////////////////////////////////////////////// 89 G4UIterminal::G4UIterminal(G4VUIshell* aShell, G4bool qsig) 90 /////////////////////////////////////////////////////////// 44 91 { 45 92 UI= G4UImanager::GetUIpointer(); … … 52 99 if(aShell) shell= aShell; 53 100 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 } 54 109 } 55 110 -
trunk/geant4/interfaces/basic/src/G4VUIshell.cc
r483 r593 25 25 // 26 26 // 27 // $Id: G4VUIshell.cc,v 1. 9 2006/06/29 19:09:59 gunterExp $28 // GEANT4 tag $Name: geant4-0 8-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 $ 29 29 // 30 30 … … 59 59 } 60 60 61 ///////////////////////////// 61 //////////////////////////////////////////// 62 62 void G4VUIshell::MakePrompt(const char* msg) 63 ///////////////////////////// 63 //////////////////////////////////////////// 64 64 { 65 65 if(promptSetting.length()<=1) { … … 106 106 107 107 108 //////////////////////////////// 109 void G4VUIshell::ResetTerminal() 110 //////////////////////////////// 111 { 112 113 } 114 108 115 // -------------------------------------------------------------------- 109 116 // G4command operations … … 308 315 arrayString.Show(nColumn); 309 316 } 317 -
trunk/geant4/interfaces/common/include/G4Qt.hh
r484 r593 25 25 // 26 26 // 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: $ 29 29 // 30 30 // To unify Qt event treatment between … … 38 38 39 39 #include "G4VInteractorManager.hh" 40 41 #include <QtGui/qapplication.h>42 #include <QtGui/qwidget.h>43 #include <QtGui/qmainwindow.h>44 40 45 41 // Class description : -
trunk/geant4/interfaces/common/include/G4VBasicShell.hh
r483 r593 26 26 // 27 27 // $Id: G4VBasicShell.hh,v 1.7 2006/06/29 19:10:03 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 -
trunk/geant4/interfaces/common/include/G4VInteractorManager.hh
r483 r593 26 26 // 27 27 // $Id: G4VInteractorManager.hh,v 1.9 2006/06/29 19:10:08 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // G.Barrand -
trunk/geant4/interfaces/common/include/G4Win32.hh
r483 r593 26 26 // 27 27 // $Id: G4Win32.hh,v 1.8 2006/06/29 19:10:11 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // To unify Windows message treatment between -
trunk/geant4/interfaces/common/include/G4Xt.hh
r483 r593 26 26 // 27 27 // $Id: G4Xt.hh,v 1.6 2006/06/29 19:10:14 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // To unify X11 event treatment between -
trunk/geant4/interfaces/common/src/G4Qt.cc
r578 r593 25 25 // 26 26 // 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: $ 29 29 // 30 30 // L. Garnier … … 38 38 39 39 #include "G4Qt.hh" 40 41 #include <QtGui/QApplication.h> 42 40 43 41 44 #define NewString(str) \ … … 135 138 // return &event; 136 139 printf("*"); 140 return 0; 137 141 } 138 142 /***************************************************************************/ -
trunk/geant4/interfaces/common/src/G4VBasicShell.cc
r571 r593 26 26 // 27 27 // $Id: G4VBasicShell.cc,v 1.12 2006/06/29 19:10:20 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 … … 197 197 std::vector<G4UIcommand*> commands; 198 198 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++ ) { 200 200 G4UIcommand* cmd = aTree->GetCommand(i_thCommand); 201 201 G4String ss = cmd->GetCommandName(); -
trunk/geant4/interfaces/common/src/G4VInteractorManager.cc
r483 r593 26 26 // 27 27 // $Id: G4VInteractorManager.cc,v 1.13 2006/06/29 19:10:24 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // G.Barrand -
trunk/geant4/interfaces/common/src/G4Win32.cc
r483 r593 26 26 // 27 27 // $Id: G4Win32.cc,v 1.9 2006/06/29 19:10:26 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // G.Barrand -
trunk/geant4/interfaces/common/src/G4Xt.cc
r483 r593 26 26 // 27 27 // $Id: G4Xt.cc,v 1.11 2006/06/29 19:10:28 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // G.Barrand -
trunk/geant4/visualization/G4History.macro
r588 r593 6 6 /vis/viewer/create ! ! 600 7 7 /vis/open OGLSQT 8 /vis/sceneHandler/create OGLSQT9 /vis/sceneHandler/attach10 /vis/viewer/create ! ! 60011 /vis/viewer/refresh12 /vis/scene/notifyHandlers13 /vis/viewer/flush14 /vis/viewer/refresh viewer-115 /vis/viewer/update viewer-116 /vis/scene/add/trajectories17 /tracking/storeTrajectory 118 /vis/scene/notifyHandlers19 /vis/modeling/trajectories/create/drawByCharge20 /vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true21 /vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 222 /vis/scene/endOfEventAction accumulate23 /vis/scene/notifyHandlers24 8 /control/execute visTutor/gui.mac 25 9 /gui/addMenu file File … … 31 15 /gui/addButton run run2 "/control/execute run2.mac" 32 16 /gui/addMenu gun Gun 33 /gui/addButton gun "50 MeV" 34 /gui/addButton gun "1 GeV" 35 /gui/addButton gun "10 GeV" 36 /gui/addButton gun "e-" 37 /gui/addButton gun "pi0" 38 /gui/addButton gun "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+" 39 23 /gui/addButton gun "neutron" "/gun/particle neutron" 40 /gui/addButton gun "proton" 24 /gui/addButton gun "proton" "/gun/particle proton" 41 25 /gui/addMenu vis Vis 42 26 /gui/addButton vis Vis0(OGLIX) "/control/execute visTutor/exN03Vis0.mac" … … 45 29 /gui/addButton vis Vis3(OGLSX) "/control/execute visTutor/exN03Vis3.mac" 46 30 /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" 50 32 /gui/addButton vis Vis6(VRML2FILE) "/control/execute visTutor/exN03Vis6.mac" 51 33 /gui/addButton vis Vis7(DAWNFILE) "/control/execute visTutor/exN03Vis7.mac" … … 59 41 /gui/addButton viewer "Update scene" "/vis/scene/notifyHandlers" 60 42 /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:44allison Exp $1 $Id: History,v 1.414 2007/07/10 17:54:09 allison Exp $ 2 2 ------------------------------------------------------------------- 3 3 … … 24 24 History file for visualization category 25 25 --------------------------------------- 26 27 10th July 2007 John Allison (vis-V09-00-00) 28 - visman-V09-00-00: Remove redundant method declarations and minor tidies. 29 30 14th June 2007 John Allison (vis-V08-03-07) 31 - raytracer-V08-03-01: Fixed memory leak in G4RayTracer. 32 33 30th May 2007 John Allison (vis-V08-03-06) 34 - modeling-V08-03-02: Fixed gcc-4.2.0 warning. 35 36 30th May 2007 John Allison (vis-V08-03-05) 37 - modeling-V08-03-01: Fix for SUN. 38 39 25th May 2007 John Allison (vis-V08-03-04) 40 - opengl-V08-03-03: Fixed gcc-4.1.2 compiler warnings. 41 42 25th 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 46 24th May 2007 John Allison (vis-V08-03-02) 47 - opengl-V08-03-01: Fixes for SUN. 48 49 22nd 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 54 16th 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 58 8th May 2007 John Allison 59 - opengl-V08-02-06: /vis/ogl/printEPS should work for all viewers. 60 61 4th 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 65 3rd 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 75 25th 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 85 11th 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 92 9th 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 97 5th 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 115 12th 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 119 11th December 2006 John Allison 120 - Tree: Trapped sequential G4PVPlacements. 26 121 27 122 25th November 2006 John Allison (vis-V08-01-17) -
trunk/geant4/visualization/OpenGL/GNUmakefile
r539 r593 28 28 CPPFLAGS += -I$(G4BASE)/intercoms/include 29 29 CPPFLAGS += -I$(G4BASE)/interfaces/common/include 30 CPPFLAGS += -I$(G4BASE)/interfaces/basic/include31 30 CPPFLAGS += -I$(G4BASE)/tracking/include 32 31 CPPFLAGS += -I$(G4BASE)/digits_hits/hits/include -
trunk/geant4/visualization/OpenGL/History
r529 r593 1 $Id: History,v 1. 82 2006/11/21 16:24:58allison Exp $1 $Id: History,v 1.94 2007/08/21 14:05:50 allison Exp $ 2 2 ------------------------------------------------------------------- 3 3 … … 20 20 History file for visualization/OpenGL 21 21 ------------------------------------- 22 23 21st August 2007 John Allison (opengl-V09-00-00) 24 - Removed redundant G4OpenGLXViewerMessenger. 25 26 25th May 2007 John Allison (opengl-V08-03-03) 27 - G4OpenGLSceneHandler and G4OpenGLXViewerMessenger: 28 Fixed gcc-4.1.2 compiler warnings. 29 30 G4OpenGLXViewer: Trapped glXMakeCurrent in Initialise function. 31 32 25th May 2007 John Allison (opengl-V08-03-02) 33 - G4OpenGLXViewer: Trapped glXMakeCurrent in Initialise function. 34 35 24th May 2007 John Allison (opengl-V08-03-01) 36 - Fixes for SUN. 37 38 16th 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 45 8th 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 51 4th 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 55 3rd 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 70 25th March 2007 John Allison (opengl-V08-02-03) 71 - Fix compiler warnings. 72 73 8th 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 79 9th 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 86 5th 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. 22 90 23 91 21st November 2006 John Allison (opengl-V08-01-09) -
trunk/geant4/visualization/OpenGL/include/G4OpenGL.hh
r529 r593 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4OpenGL.hh,v 1. 4 2006/06/29 21:17:36 gunterExp $27 // GEANT4 tag $Name: geant4-0 8-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 $ 28 28 // 29 29 // G.Barrand. … … 39 39 #include <GL/glu.h> 40 40 41 #define G4OPENGL_DBL_MAX 1.e308 42 41 43 #endif -
trunk/geant4/visualization/OpenGL/include/G4OpenGLFontBaseStore.hh
r529 r593 25 25 // 26 26 // $Id: G4OpenGLFontBaseStore.hh,v 1.3 2006/06/29 21:17:38 gunter Exp $ 27 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $27 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 28 28 // 29 29 // J.Allison Apr 2005. -
trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateQt.hh
r533 r593 25 25 // 26 26 // 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: $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateQtViewer.hh
r561 r593 25 25 // 26 26 // 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: $ 29 29 // 30 30 // … … 40 40 #include "G4OpenGLImmediateViewer.hh" 41 41 #include "G4OpenGLQtViewer.hh" 42 #include <QGLWidget> 42 43 #include <QtOpenGL/QGLWidget> 43 44 44 45 #include "globals.hh" -
trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateSceneHandler.hh
r529 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLImmediateSceneHandler.hh,v 1.1 1 2006/08/16 10:34:36 allison Exp $28 // GEANT4 tag $Name: geant4-0 8-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 $ 29 29 // 30 30 // … … 59 59 void EndModeling (); 60 60 void AddPrimitive (const G4Polyline&); 61 void AddPrimitive (const G4Polymarker&); 62 void AddPrimitive (const G4Text& text); 61 63 void AddPrimitive (const G4Circle&); 62 64 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&); 80 68 void ClearTransientStore (); 81 69 -
trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateViewer.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLImmediateViewer.hh,v 1.9 2006/09/04 12:07:59 allison Exp $ 28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateWin32.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLImmediateWin32.hh,v 1.7 2006/06/29 21:17:44 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateWin32Viewer.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLImmediateWin32Viewer.hh,v 1.9 2006/06/29 21:17:46 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateX.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLImmediateX.hh,v 1.7 2006/06/29 21:17:48 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateXViewer.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLImmediateXViewer.hh,v 1.9 2006/07/03 16:38:13 allison Exp $ 28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateXm.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLImmediateXm.hh,v 1.7 2006/06/29 21:17:52 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateXmViewer.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLImmediateXmViewer.hh,v 1.9 2006/07/03 16:38:13 allison Exp $ 28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLQtExportDialog.hh
r586 r593 25 25 // 26 26 // 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: 29 29 // 30 30 // … … 35 35 #define G4OPENGLQTEXPORTDIALOG_HH 36 36 37 #include <qvariant.h> 38 #include <qdialog.h> 37 #include <QtGui/QDialog.h> 39 38 40 39 class QButtonGroup; … … 47 46 class QLineEdit; 48 47 48 /** The G4OpenGLQtExportDialog class provide a Dialog displaying differents options 49 for each file format 50 */ 49 51 class G4OpenGLQtExportDialog : public QDialog 50 52 { … … 52 54 53 55 public: 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 */ 55 65 ~G4OpenGLQtExportDialog(); 56 66 67 /** @return the value of the slider if format has a slider widget, instead return -1 */ 57 68 int getSliderValue(); 69 70 /** return the new width for file if format has a width widget, instead return -1 */ 58 71 int getWidth(); 72 73 /** return the new height for file if format has a height widget, instead return -1 */ 59 74 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 */ 61 80 int getNbColor(); 62 81 63 82 public slots: 83 84 /** Called by a clic on modify/original size button.This will 85 invert buttons and hide/unhide size 86 */ 64 87 void changeSizeBox(bool); 88 89 /** Called by changing value in height lineEdit. If ratio is keep, will also change the width 90 */ 65 91 void textWidthChanged(const QString &); 92 93 /** Called by changing value in width lineEdit. If ratio is keep, will also change the height 94 */ 66 95 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);71 96 72 97 private: … … 80 105 QSlider * qualitySlider; 81 106 QLabel *formatLabel; 82 QRadioButton* color ,*BW;107 QRadioButton* colorButton,*BWButton; 83 108 QRadioButton* original,* modify; 84 109 QLineEdit* height,*width; -
trunk/geant4/visualization/OpenGL/include/G4OpenGLQtViewer.hh
r588 r593 25 25 // 26 26 // 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: $ 29 29 // 30 30 // … … 42 42 #include "G4OpenGLSceneHandler.hh" 43 43 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 47 class QGLWidget; 48 class QDialog; 49 class QContextMenuEvent; 50 class QMenu; 51 class QImage; 52 class QAction; 51 53 52 54 class G4OpenGLSceneHandler; -
trunk/geant4/visualization/OpenGL/include/G4OpenGLSceneHandler.hh
r529 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLSceneHandler.hh,v 1.2 0 2006/08/30 11:37:34allison Exp $28 // GEANT4 tag $Name: geant4-0 8-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 $ 29 29 // 30 30 // … … 45 45 #include "G4VSceneHandler.hh" 46 46 #include "G4OpenGLViewer.hh" 47 #include "G4OpenGLBitMapStore.hh" 48 #include <map> 47 49 48 // Base class for various OpenGLScene classes. 50 class G4AttHolder; 51 52 // Base class for various OpenGLSceneHandler classes. 49 53 class G4OpenGLSceneHandler: public G4VSceneHandler { 50 54 55 friend class G4OpenGLViewer; 56 51 57 public: 58 virtual void BeginPrimitives (const G4Transform3D& objectTransformation); 59 virtual void EndPrimitives (); 60 virtual void BeginPrimitives2D (); 61 virtual void EndPrimitives2D (); 52 62 void AddPrimitive (const G4Polyline&); 63 void AddPrimitive (const G4Polymarker&); 53 64 void AddPrimitive (const G4Text&); 54 65 void AddPrimitive (const G4Circle&); 55 66 void AddPrimitive (const G4Square&); 67 void AddPrimitive (const G4Scale&); 56 68 void AddPrimitive (const G4Polyhedron&); 57 69 void AddPrimitive (const G4NURBS&); 58 // Explicitly invoke base class methods to avoid warnings about59 // 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 }66 70 71 void PreAddSolid (const G4Transform3D& objectTransformation, 72 const G4VisAttributes&); 67 73 void AddSolid (const G4Box&); 68 74 void AddSolid (const G4Cons&); … … 89 95 const G4Polyhedron* CreateCutawayPolyhedron (); 90 96 97 GLuint fPickName; 98 std::map<GLuint, G4AttHolder*> fPickMap; // For picking. 99 void ClearAndDestroyAtts(); // Destroys att holders and clears pick map. 100 91 101 private: 92 102 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); 101 104 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); 105 110 // Draws in world coordinates a polygon in the screen plane knowing 106 111 // viewpoint direction and up vector. 107 112 108 113 static const GLubyte fStippleMaskHashed [128]; 114 115 G4bool fProcessingPolymarker; 109 116 }; 110 117 -
trunk/geant4/visualization/OpenGL/include/G4OpenGLSceneHandler.icc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLSceneHandler.icc,v 1.7 2006/06/29 21:17:58 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredQt.hh
r561 r593 25 25 // 26 26 // 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: $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredQtViewer.hh
r561 r593 25 25 // 26 26 // 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: $ 29 29 // 30 30 // … … 40 40 #include "G4OpenGLStoredViewer.hh" 41 41 #include "G4OpenGLQtViewer.hh" 42 #include <QGLWidget> 43 #include <QApplication> 44 #include <QMouseEvent> 45 #include <QContextMenuEvent> 42 43 #include <QtOpenGL/QGLWidget> 44 45 class QMouseEvent; 46 class QContextMenuEvent; 46 47 47 48 class G4OpenGLStoredSceneHandler; -
trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredSceneHandler.hh
r529 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLStoredSceneHandler.hh,v 1.2 1 2006/08/30 11:43:57allison Exp $28 // GEANT4 tag $Name: geant4-0 8-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 $ 29 29 // 30 30 // … … 63 63 void EndModeling (); 64 64 void AddPrimitive (const G4Polyline&); 65 void AddPrimitive (const G4Polymarker&); 65 66 void AddPrimitive (const G4Circle&); 66 67 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&); 82 72 void ClearStore (); 83 73 void ClearTransientStore (); … … 98 88 struct PO { 99 89 PO(G4int id, const G4Transform3D& tr = G4Transform3D()): 100 fDisplayListId(id), fTransform(tr) {}90 fDisplayListId(id), fTransform(tr), fPickName(0) {} 101 91 G4int fDisplayListId; 102 92 G4Transform3D fTransform; 93 GLuint fPickName; 103 94 }; 104 95 std::vector<PO> fPOList; … … 107 98 struct TO { 108 99 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) {} 111 102 G4int fDisplayListId; 112 103 G4Transform3D fTransform; 104 GLuint fPickName; 113 105 G4double fStartTime, fEndTime; // Time range (e.g., for trajectory steps). 114 106 G4Colour fColour; … … 119 111 // A proper implementation would use geometry hierarchy. 120 112 std::map <const G4VSolid*, G4int, std::less <const G4VSolid*> > fSolidMap; 113 114 private: 115 G4bool fProcessing2D; 121 116 }; 122 117 -
trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredViewer.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLStoredViewer.hh,v 1.9 2006/06/29 21:18:02 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredWin32.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLStoredWin32.hh,v 1.7 2006/06/29 21:18:04 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredWin32Viewer.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLStoredWin32Viewer.hh,v 1.7 2006/06/29 21:18:06 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredX.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLStoredX.hh,v 1.7 2006/06/29 21:18:08 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredXViewer.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLStoredXViewer.hh,v 1.7 2006/07/03 16:38:13 allison Exp $ 28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredXm.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLStoredXm.hh,v 1.6 2006/06/29 21:18:12 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredXmViewer.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLStoredXmViewer.hh,v 1.7 2006/07/03 16:38:13 allison Exp $ 28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLTransform3D.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLTransform3D.hh,v 1.7 2006/06/29 21:18:16 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLViewer.hh
r529 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLViewer.hh,v 1. 18 2006/09/19 16:13:15allison Exp $28 // GEANT4 tag $Name: geant4-0 8-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 $ 29 29 // 30 30 // … … 38 38 39 39 #include "G4VViewer.hh" 40 #include "G4OpenGL.hh" 40 41 41 42 class G4OpenGLSceneHandler; … … 62 63 void HLRThirdPass (); 63 64 void InitializeGLView (); 65 void Pick(GLdouble x, GLdouble y); 64 66 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; 65 80 G4Colour background; //the OpenGL clear colour 66 81 G4bool … … 80 95 }; 81 96 97 typedef 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 82 107 #endif 83 108 -
trunk/geant4/visualization/OpenGL/include/G4OpenGLViewerMessenger.hh
r529 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLViewerMessenger.hh,v 1. 4 2006/09/19 16:14:21 allison Exp $28 // GEANT4 tag $Name: geant4-0 8-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 $ 29 29 30 30 #ifndef G4OPENGLVIEWERMESSENGER_HH … … 37 37 class G4UIdirectory; 38 38 class G4UIcommand; 39 class G4UIcmdWithoutParameter; 39 40 class G4UIcmdWithADouble; 40 41 class G4UIcmdWithABool; 42 class G4UIcmdWithAString; 41 43 42 44 class G4OpenGLViewerMessenger: public G4UImessenger { … … 50 52 static G4OpenGLViewerMessenger* fpInstance; 51 53 G4UIdirectory* fpDirectory; 54 G4UIcmdWithoutParameter* fpCommandPrintEPS; 52 55 G4UIdirectory* fpDirectorySet; 53 56 G4UIcommand* fpCommandDisplayHeadTime; … … 55 58 G4UIcommand* fpCommandEndTime; 56 59 G4UIcmdWithADouble* fpCommandFade; 60 G4UIcmdWithAString* fpCommandPrintMode; 57 61 G4UIcommand* fpCommandStartTime; 58 62 G4UIcmdWithABool* fpCommandTransparency; -
trunk/geant4/visualization/OpenGL/include/G4OpenGLWin32Viewer.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLWin32Viewer.hh,v 1.13 2006/06/29 21:18:20 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLXViewer.hh
r529 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLXViewer.hh,v 1.2 6 2006/11/01 11:22:27allison Exp $28 // GEANT4 tag $Name: geant4-0 8-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 $ 29 29 // 30 30 // … … 53 53 54 54 friend class G4OpenGLXViewerMessenger; 55 friend class G4OpenGLXmViewer; 55 56 56 57 public: … … 59 60 void SetView (); 60 61 void ShowView (); 61 void print();62 62 63 63 protected: … … 66 66 virtual void CreateMainWindow (); 67 67 virtual void CreateFontLists (); 68 void print(); 68 69 69 70 static int snglBuf_RGBA[12]; 70 71 static int dblBuf_RGBA[13]; 71 72 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///// 86 74 GLubyte* grabPixels (int inColor, 87 75 unsigned int width, … … 129 117 }; 130 118 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 141 119 #endif 142 120 -
trunk/geant4/visualization/OpenGL/include/G4OpenGLXmBox.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmBox.hh,v 1.7 2006/06/29 21:18:24 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLXmFourArrowButtons.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmFourArrowButtons.hh,v 1.6 2006/06/29 21:18:26 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLXmFramedBox.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmFramedBox.hh,v 1.7 2006/06/29 21:18:28 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLXmPushButton.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmPushButton.hh,v 1.7 2006/06/29 21:18:30 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLXmRadioButton.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmRadioButton.hh,v 1.7 2006/06/29 21:18:32 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLXmResources.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmResources.hh,v 1.5 2006/06/29 21:18:34 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLXmSeparator.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmSeparator.hh,v 1.6 2006/06/29 21:18:36 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLXmSliderBar.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmSliderBar.hh,v 1.7 2006/06/29 21:18:38 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLXmTextField.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmTextField.hh,v 1.7 2006/06/29 21:18:40 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLXmTopLevelShell.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmTopLevelShell.hh,v 1.6 2006/06/29 21:18:42 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLXmVWidgetComponent.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmVWidgetComponent.hh,v 1.6 2006/06/29 21:18:44 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLXmVWidgetContainer.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmVWidgetContainer.hh,v 1.6 2006/06/29 21:18:46 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLXmVWidgetObject.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmVWidgetObject.hh,v 1.6 2006/06/29 21:18:48 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLXmVWidgetShell.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmVWidgetShell.hh,v 1.6 2006/06/29 21:18:50 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLXmViewer.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmViewer.hh,v 1.10 2006/06/29 21:18:52 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLXmViewerMessenger.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmViewerMessenger.hh,v 1.4 2006/06/29 21:18:54 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 30 30 #ifdef G4VIS_BUILD_OPENGLXM_DRIVER -
trunk/geant4/visualization/OpenGL/src/G4OpenGLFontBaseStore.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLFontBaseStore.cc,v 1.3 2006/06/29 21:18:56 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 -
trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateQt.cc
r550 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLImmediateQt.cc,v 1.1 1 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: $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateQtViewer.cc
r564 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLImmediateQtViewer.cc,v 1.1 6 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: $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateSceneHandler.cc
r554 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLImmediateSceneHandler.cc,v 1.2 4 2006/09/04 12:03:25allison Exp $28 // GEANT4 tag $Name: geant4-0 8-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 $ 29 29 // 30 30 // … … 47 47 #include "G4OpenGLTransform3D.hh" 48 48 #include "G4Polyline.hh" 49 #include "G4Polymarker.hh" 50 #include "G4Text.hh" 49 51 #include "G4Circle.hh" 50 52 #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 56 G4OpenGLImmediateSceneHandler::G4OpenGLImmediateSceneHandler 57 (G4VGraphicsSystem& system,const G4String& name): 58 G4OpenGLSceneHandler (system, fSceneIdCount++, name) 55 59 {} 56 60 … … 62 66 void G4OpenGLImmediateSceneHandler::AddPrimitivePreamble(const G4Visible& visible) 63 67 { 68 if (fpViewer->GetViewParameters().IsPicking()) { 69 glLoadName(++fPickName); 70 fPickMap[fPickName] = 0; 71 } 72 64 73 const G4Colour& c = GetColour (visible); 65 74 glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ()); … … 72 81 } 73 82 83 void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4Polymarker& polymarker) 84 { 85 AddPrimitivePreamble(polymarker); 86 G4OpenGLSceneHandler::AddPrimitive(polymarker); 87 } 88 89 void 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 74 97 void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4Circle& circle) 75 98 { … … 84 107 } 85 108 109 void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4Scale& scale) 110 { 111 AddPrimitivePreamble(scale); 112 G4OpenGLSceneHandler::AddPrimitive(scale); 113 } 114 115 void 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 123 void 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 86 131 void G4OpenGLImmediateSceneHandler::BeginPrimitives 87 132 (const G4Transform3D& objectTransformation) { 88 G4 VSceneHandler::BeginPrimitives (objectTransformation);133 G4OpenGLSceneHandler::BeginPrimitives (objectTransformation); 89 134 glPushMatrix(); 90 135 G4OpenGLTransform3D oglt (objectTransformation); … … 110 155 glFlush (); 111 156 112 G4 VSceneHandler::EndPrimitives ();157 G4OpenGLSceneHandler::EndPrimitives (); 113 158 } 114 159 115 160 void G4OpenGLImmediateSceneHandler::BeginPrimitives2D() 116 161 { 117 G4 VSceneHandler::BeginPrimitives2D();162 G4OpenGLSceneHandler::BeginPrimitives2D(); 118 163 119 164 // Push current 3D world matrices and load identity to define screen … … 122 167 glPushMatrix(); 123 168 glLoadIdentity(); 124 glOrtho (-1., 1., -1., 1., - DBL_MAX,DBL_MAX);169 glOrtho (-1., 1., -1., 1., -G4OPENGL_DBL_MAX, G4OPENGL_DBL_MAX); 125 170 glMatrixMode (GL_MODELVIEW); 126 171 glPushMatrix(); … … 139 184 glFlush (); 140 185 141 G4 VSceneHandler::EndPrimitives2D ();186 G4OpenGLSceneHandler::EndPrimitives2D (); 142 187 } 143 188 … … 151 196 152 197 void G4OpenGLImmediateSceneHandler::ClearTransientStore () { 198 153 199 G4VSceneHandler::ClearTransientStore (); 200 154 201 // Make sure screen corresponds to graphical database... 155 202 if (fpViewer) { -
trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateViewer.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLImmediateViewer.cc,v 1.8 2006/09/04 12:07:59 allison Exp $ 28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateWin32.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLImmediateWin32.cc,v 1.11 2006/08/14 12:07:19 allison Exp $ 28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateWin32Viewer.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLImmediateWin32Viewer.cc,v 1.16 2006/07/03 16:38:13 allison Exp $ 28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateX.cc
r529 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLImmediateX.cc,v 1.1 2 2006/08/14 12:07:19allison Exp $28 // GEANT4 tag $Name: geant4-0 8-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 $ 29 29 // 30 30 // … … 41 41 #include "G4OpenGLImmediateXViewer.hh" 42 42 #include "G4OpenGLViewerMessenger.hh" 43 #include "G4OpenGLXViewerMessenger.hh"44 43 45 44 G4OpenGLImmediateX::G4OpenGLImmediateX (): … … 50 49 { 51 50 G4OpenGLViewerMessenger::GetInstance(); 52 G4OpenGLXViewerMessenger::GetInstance();53 51 } 54 52 -
trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateXViewer.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLImmediateXViewer.cc,v 1.16 2006/07/03 16:38:13 allison Exp $ 28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateXm.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLImmediateXm.cc,v 1.13 2006/08/14 12:07:19 allison Exp $ 28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateXmViewer.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLImmediateXmViewer.cc,v 1.17 2006/07/03 16:38:13 allison Exp $ 28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/src/G4OpenGLQtExportDialog.cc
r589 r593 25 25 // 26 26 // 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: $ 29 29 // 30 30 // … … 34 34 #include "G4OpenGLQtExportDialog.hh" 35 35 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> 47 47 48 48 G4OpenGLQtExportDialog::G4OpenGLQtExportDialog( … … 57 57 originalWidth = aWidth; 58 58 originalHeight = aHeight; 59 60 // Initializations 61 qualitySlider = NULL; 62 width = NULL; 63 height = NULL; 64 colorButton = NULL; 65 BWButton = NULL; 59 66 60 67 // global layout … … 95 102 // transparencyEPS->setChecked( true ); 96 103 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 ); 101 108 102 109 103 110 // EPSGroupBoxLayout->addWidget(transparencyEPS); 104 EPSGroupBoxLayout->addWidget(color );105 EPSGroupBoxLayout->addWidget(BW );111 EPSGroupBoxLayout->addWidget(colorButton); 112 EPSGroupBoxLayout->addWidget(BWButton); 106 113 EPSGroupBox->setLayout(EPSGroupBoxLayout); 107 114 globalVLayout->addWidget(EPSGroupBox); … … 217 224 int G4OpenGLQtExportDialog::getSliderValue() 218 225 { 226 if (!qualitySlider) return -1; 219 227 return qualitySlider->value(); 220 228 } … … 222 230 int G4OpenGLQtExportDialog::getHeight() 223 231 { 232 if (!height) return -1; 224 233 return height->text().toInt(); 225 234 } … … 227 236 int G4OpenGLQtExportDialog::getWidth() 228 237 { 238 if (!width) return -1; 229 239 return width->text().toInt(); 230 240 } 231 241 232 int G4OpenGLQtExportDialog::getTransparency() 233 { 242 bool G4OpenGLQtExportDialog::getTransparency() 243 { 244 if (!boxTransparency) return -1; 234 245 return boxTransparency->isChecked(); 235 246 } … … 238 249 { 239 250 // Black and white 240 if (!color ->isChecked())251 if (!colorButton->isChecked()) 241 252 return 1; 242 253 // rgb color -
trunk/geant4/visualization/OpenGL/src/G4OpenGLQtViewer.cc
r589 r593 25 25 // 26 26 // 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: $ 29 29 // 30 30 // … … 50 50 #include "G4UIsession.hh" 51 51 #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 60 67 61 68 ////////////////////////////////////////////////////////////////////////////// … … 683 690 G4OpenGLQtExportDialog* exportDialog= new G4OpenGLQtExportDialog(GLWindow,nomFich,fWindow->height(),fWindow->width()); 684 691 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())) { 690 696 691 692 if ((exportDialog->getWidth() !=fWindow->width()) ||693 (exportDialog->getWidth() !=fWindow->width())) {694 695 697 // rescaleImage(exportDialog->getWidth(),exportDialog->getHeight());// re-scale image 696 698 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 // } 699 710 // jpeg format 700 711 if (nomFich.endsWith(".jpg") || -
trunk/geant4/visualization/OpenGL/src/G4OpenGLSceneHandler.cc
r529 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLSceneHandler.cc,v 1. 45 2006/08/30 11:37:34allison Exp $28 // GEANT4 tag $Name: geant4-0 8-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 $ 29 29 // 30 30 // … … 52 52 #include "G4Transform3D.hh" 53 53 #include "G4Polyline.hh" 54 #include "G4Polymarker.hh" 54 55 #include "G4Text.hh" 55 56 #include "G4Circle.hh" … … 64 65 #include "G4Scene.hh" 65 66 #include "G4VisExtent.hh" 67 #include "G4AttHolder.hh" 66 68 67 69 G4OpenGLSceneHandler::G4OpenGLSceneHandler (G4VGraphicsSystem& system, 68 70 G4int id, 69 71 const G4String& name): 70 G4VSceneHandler (system, id, name) 72 G4VSceneHandler (system, id, name), 73 fPickName(0), 74 fProcessingPolymarker(false) 71 75 {} 72 76 … … 94 98 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55 95 99 }; 100 101 void 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 108 void G4OpenGLSceneHandler::PreAddSolid 109 (const G4Transform3D& objectTransformation, 110 const G4VisAttributes& visAttribs) 111 { 112 G4VSceneHandler::PreAddSolid (objectTransformation, visAttribs); 113 } 114 115 void G4OpenGLSceneHandler::BeginPrimitives 116 (const G4Transform3D& objectTransformation) 117 { 118 G4VSceneHandler::BeginPrimitives (objectTransformation); 119 } 120 121 void G4OpenGLSceneHandler::EndPrimitives () 122 { 123 G4VSceneHandler::EndPrimitives (); 124 } 125 126 void G4OpenGLSceneHandler::BeginPrimitives2D () 127 { 128 G4VSceneHandler::BeginPrimitives2D (); 129 } 130 131 void G4OpenGLSceneHandler::EndPrimitives2D () 132 { 133 G4VSceneHandler::EndPrimitives2D (); 134 } 96 135 97 136 const G4Polyhedron* G4OpenGLSceneHandler::CreateSectionPolyhedron () … … 120 159 if (nPoints <= 0) return; 121 160 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 122 168 // Note: colour treated in sub-class. 123 169 … … 128 174 glDisable (GL_LIGHTING); 129 175 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); 131 181 glLineWidth(lineWidth); 132 182 … … 142 192 } 143 193 194 void 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 144 244 void 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 } 145 252 146 253 const G4Colour& c = GetTextColour (text); // Picks up default if none. … … 175 282 glDisable (GL_LIGHTING); 176 283 177 glRasterPos3 f(position.x(),position.y(),position.z());284 glRasterPos3d(position.x(),position.y(),position.z()); 178 285 // No action on offset or layout at present. 179 286 glPushAttrib(GL_LIST_BIT); … … 185 292 void G4OpenGLSceneHandler::AddPrimitive (const G4Circle& circle) { 186 293 glEnable (GL_POINT_SMOOTH); 187 AddCircleSquare (circle, 24);294 AddCircleSquare (circle, G4OpenGLBitMapStore::circle); 188 295 } 189 296 190 297 void G4OpenGLSceneHandler::AddPrimitive (const G4Square& square) { 191 298 glDisable (GL_POINT_SMOOTH); 192 AddCircleSquare (square, 4);299 AddCircleSquare (square, G4OpenGLBitMapStore::square); 193 300 } 194 301 195 302 void G4OpenGLSceneHandler::AddCircleSquare 196 303 (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 } 198 314 199 315 // Note: colour treated in sub-class. … … 205 321 glDisable (GL_LIGHTING); 206 322 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); 208 328 glLineWidth(lineWidth); 209 329 210 330 G4VMarker::FillStyle style = marker.GetFillStyle(); 331 332 G4bool filled = false; 333 static G4bool hashedWarned = false; 211 334 212 335 switch (style) { 213 336 case G4VMarker::noFill: 214 337 glPolygonMode (GL_FRONT_AND_BACK, GL_LINE); 338 filled = false; 215 339 break; 216 340 217 341 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... 229 351 230 352 case G4VMarker::filled: 231 353 glPolygonMode (GL_FRONT_AND_BACK, GL_FILL); 354 filled = true; 232 355 break; 233 356 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 241 357 } 242 358 243 359 // A few useful quantities... 244 360 G4Point3D centre = marker.GetPosition(); 245 const G4Vector3D& viewpointDirection =246 fpViewer -> GetViewParameters().GetViewpointDirection();247 const G4Vector3D& up = fpViewer->GetViewParameters().GetUpVector();248 361 MarkerSizeType sizeType; 249 362 G4double size = GetMarkerSize(marker, sizeType); 250 363 251 // Find "size" of marker in world space (but see note below)... 252 G4double worldSize; 364 // Draw... 253 365 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 379 void G4OpenGLSceneHandler::DrawXYPolygon 380 (G4OpenGLBitMapStore::Shape shape, 381 G4double size, 353 382 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 375 395 const G4Vector3D& viewpointDirection = 376 396 fpViewer -> GetViewParameters().GetViewpointDirection(); … … 381 401 G4double phi; 382 402 G4int i; 403 383 404 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) { 385 406 G4Vector3D r = start; r.rotate(phi, viewpointDirection); 386 407 G4Vector3D p = centre + r; … … 388 409 } 389 410 glEnd (); 411 } 412 413 void G4OpenGLSceneHandler::AddPrimitive (const G4Scale& scale) 414 { 415 G4VSceneHandler::AddPrimitive(scale); 390 416 } 391 417 … … 398 424 if (polyhedron.GetNoFacets() == 0) return; 399 425 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 400 433 // Get vis attributes - pick up defaults if none. 401 434 const G4VisAttributes* pVA = … … 410 443 G4OpenGLViewer* pViewer = dynamic_cast<G4OpenGLViewer*>(fpViewer); 411 444 if (pViewer) transparency_enabled = pViewer->transparency_enabled; 412 const G4Colour& c = GetColour (polyhedron);445 const G4Colour& c = pVA->GetColour(); 413 446 GLfloat materialColour [4]; 414 447 materialColour [0] = c.GetRed (); … … 421 454 } 422 455 423 G4double lineWidth = GetLineWidth(p olyhedron);456 G4double lineWidth = GetLineWidth(pVA); 424 457 glLineWidth(lineWidth); 425 458 … … 681 714 void G4OpenGLSceneHandler::AddPrimitive (const G4NURBS& nurb) { 682 715 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 683 723 GLUnurbsObj *gl_nurb; 684 724 gl_nurb = gluNewNurbsRenderer (); -
trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredQt.cc
r564 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLStoredQt.cc,v 1.1 1 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: $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredQtViewer.cc
r579 r593 25 25 // 26 26 // 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: $ 29 29 // 30 30 // … … 38 38 39 39 #include "G4ios.hh" 40 41 #include <QtGui/QMouseEvent> 42 #include <QtGui/QContextMenuEvent> 40 43 41 44 G4OpenGLStoredQtViewer::G4OpenGLStoredQtViewer -
trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredSceneHandler.cc
r529 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLStoredSceneHandler.cc,v 1.3 1 2006/08/30 11:43:57 allison Exp $28 // GEANT4 tag $Name: geant4-0 8-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 $ 29 29 // 30 30 // … … 46 46 #include "G4PhysicalVolumeModel.hh" 47 47 #include "G4VPhysicalVolume.hh" 48 #include "G4LogicalVolume.hh" 48 49 #include "G4Polyline.hh" 49 50 #include "G4Polymarker.hh" 51 #include "G4Text.hh" 50 52 #include "G4Circle.hh" 51 53 #include "G4Square.hh" 54 #include "G4Polyhedron.hh" 55 #include "G4AttHolder.hh" 52 56 53 57 G4OpenGLStoredSceneHandler::G4OpenGLStoredSceneHandler (G4VGraphicsSystem& system, … … 56 60 fMemoryForDisplayLists (true), 57 61 fAddPrimitivePreambleNestingDepth (0), 58 fTopPODL (0) 62 fTopPODL (0), 63 fProcessing2D (false) 59 64 {} 60 65 … … 69 74 if (fAddPrimitivePreambleNestingDepth > 1) return; 70 75 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 71 84 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 it86 // 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::BeginPrimitives134 (const G4Transform3D& objectTransformation) {135 136 G4VSceneHandler::BeginPrimitives (objectTransformation);137 85 138 86 if (fMemoryForDisplayLists) { 139 87 fDisplayListId = glGenLists (1); 140 88 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; 145 95 fMemoryForDisplayLists = false; 146 96 } … … 148 98 if (fMemoryForDisplayLists) { 149 99 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(); 151 107 fTOList.push_back(to); 152 108 glDrawBuffer (GL_FRONT); 153 109 glPushMatrix(); 154 G4OpenGLTransform3D oglt ( objectTransformation);110 G4OpenGLTransform3D oglt (*fpObjectTransformation); 155 111 glMultMatrixd (oglt.GetGLMatrix ()); 112 glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ()); 156 113 glNewList (fDisplayListId, GL_COMPILE_AND_EXECUTE); 157 114 } 158 115 else { 159 fPOList.push_back(PO(fDisplayListId, objectTransformation)); 116 PO po(fDisplayListId, *fpObjectTransformation); 117 po.fPickName = fPickName; 118 fPOList.push_back(po); 160 119 glNewList (fDisplayListId, GL_COMPILE); 120 glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ()); 161 121 } 162 122 } else { 163 123 glDrawBuffer (GL_FRONT); 164 124 glPushMatrix(); 165 G4OpenGLTransform3D oglt ( objectTransformation);125 G4OpenGLTransform3D oglt (*fpObjectTransformation); 166 126 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 143 void 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 171 153 if (fMemoryForDisplayLists) { 172 154 glEndList(); … … 177 159 glDrawBuffer (GL_BACK); 178 160 } 179 G4VSceneHandler::EndPrimitives (); 161 fAddPrimitivePreambleNestingDepth--; 162 } 163 164 void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Polyline& polyline) 165 { 166 AddPrimitivePreamble(polyline); 167 G4OpenGLSceneHandler::AddPrimitive(polyline); 168 AddPrimitivePostamble(); 169 } 170 171 void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Polymarker& polymarker) 172 { 173 AddPrimitivePreamble(polymarker); 174 G4OpenGLSceneHandler::AddPrimitive(polymarker); 175 AddPrimitivePostamble(); 176 } 177 178 void 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 188 void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Circle& circle) 189 { 190 AddPrimitivePreamble(circle); 191 G4OpenGLSceneHandler::AddPrimitive(circle); 192 AddPrimitivePostamble(); 193 } 194 195 void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Square& square) 196 { 197 AddPrimitivePreamble(square); 198 G4OpenGLSceneHandler::AddPrimitive(square); 199 AddPrimitivePostamble(); 200 } 201 202 void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Scale& scale) 203 { 204 // Let base class split into primitives. 205 G4OpenGLSceneHandler::AddPrimitive(scale); 206 } 207 208 void 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 218 void 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 228 void G4OpenGLStoredSceneHandler::BeginPrimitives 229 (const G4Transform3D& objectTransformation) 230 { 231 G4OpenGLSceneHandler::BeginPrimitives (objectTransformation); 232 233 // Display list setup moved to AddPrimitivePreamble. See notes there. 234 } 235 236 void G4OpenGLStoredSceneHandler::EndPrimitives () 237 { 238 G4OpenGLSceneHandler::EndPrimitives (); 180 239 } 181 240 182 241 void G4OpenGLStoredSceneHandler::BeginPrimitives2D() 183 242 { 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; 218 245 } 219 246 220 247 void G4OpenGLStoredSceneHandler::EndPrimitives2D () 221 248 { 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 (); 236 251 } 237 252 … … 253 268 " display List for fTopPODL - try OpenGL Immediated mode." 254 269 << G4endl; 255 } 256 else { 270 } else { 257 271 glNewList (fTopPODL, GL_COMPILE_AND_EXECUTE); { 258 272 for (size_t i = 0; i < fPOList.size (); i++) { … … 260 274 G4OpenGLTransform3D oglt (fPOList[i].fTransform); 261 275 glMultMatrixd (oglt.GetGLMatrix ()); 276 if (fpViewer->GetViewParameters().IsPicking()) 277 glLoadName(fPOList[i].fPickName); 262 278 glCallList (fPOList[i].fDisplayListId); 263 279 glPopMatrix(); … … 288 304 fPOList.clear (); 289 305 fSolidMap.clear (); 306 ClearAndDestroyAtts(); 290 307 291 308 // ...and clear transient store... … … 375 392 (fSolidMap.find (pSolid) != fSolidMap.end ())) { 376 393 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); 378 410 } 379 411 else { -
trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredViewer.cc
r564 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLStoredViewer.cc,v 1.2 0 2006/10/24 06:23:18allison Exp $28 // GEANT4 tag $Name: geant4-0 8-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 $ 29 29 // 30 30 // … … 88 88 (lastVP.GetNoOfSides () != fVP.GetNoOfSides ()) || 89 89 (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 95 95 if (lastVP.IsDensityCulling () && 96 96 (lastVP.GetVisibleDensity () != fVP.GetVisibleDensity ())) … … 142 142 } 143 143 144 if (fG4OpenGLStoredSceneHandler.fTopPODL) 144 if (fG4OpenGLStoredSceneHandler.fTopPODL) 145 145 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) { 149 148 G4OpenGLStoredSceneHandler::TO& to = 150 149 fG4OpenGLStoredSceneHandler.fTOList[i]; 151 if ( (!(to.fEndTime < fStartTime ))&& (!(to.fStartTime > fEndTime))) {150 if (to.fEndTime >= fStartTime && to.fStartTime <= fEndTime) { 152 151 glPushMatrix(); 153 152 G4OpenGLTransform3D oglt (to.fTransform); 154 153 glMultMatrixd (oglt.GetGLMatrix ()); 154 if (fVP.IsPicking()) glLoadName(to.fPickName); 155 155 G4Colour& c = to.fColour; 156 G4double bsf = 1.; // Brightness scaling factor. 156 157 if (fFadeFactor > 0. && to.fEndTime < fEndTime) 157 158 bsf = 1. - fFadeFactor * … … 167 168 168 169 // Display time at "head" of time range, which is fEndTime... 169 if (fDisplayHeadTime && fEndTime < DBL_MAX) {170 if (fDisplayHeadTime && fEndTime < G4OPENGL_DBL_MAX) { 170 171 glMatrixMode (GL_PROJECTION); 171 172 glPushMatrix(); 172 173 glLoadIdentity(); 173 glOrtho (-1., 1., -1., 1., - DBL_MAX,DBL_MAX);174 glOrtho (-1., 1., -1., 1., -G4OPENGL_DBL_MAX, G4OPENGL_DBL_MAX); 174 175 glMatrixMode (GL_MODELVIEW); 175 176 glPushMatrix(); … … 183 184 fDisplayHeadTimeBlue)); 184 185 headTimeText.SetVisAttributes(&visAtts); 185 fG4OpenGLStoredSceneHandler.AddPrimitive(headTimeText); 186 static_cast<G4OpenGLSceneHandler&>(fSceneHandler). 187 G4OpenGLSceneHandler::AddPrimitive(headTimeText); 186 188 glMatrixMode (GL_PROJECTION); 187 189 glPopMatrix(); … … 191 193 192 194 // Display light front... 193 if (fDisplayLightFront && fEndTime < DBL_MAX) {195 if (fDisplayLightFront && fEndTime < G4OPENGL_DBL_MAX) { 194 196 G4double lightFrontRadius = (fEndTime - fDisplayLightFrontT) * c_light; 195 197 if (lightFrontRadius > 0.) { -
trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredWin32.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLStoredWin32.cc,v 1.14 2006/08/14 12:07:19 allison Exp $ 28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredWin32Viewer.cc
r529 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLStoredWin32Viewer.cc,v 1.1 8 2006/09/04 12:07:59allison Exp $28 // GEANT4 tag $Name: geant4-0 8-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 $ 29 29 // 30 30 // … … 123 123 124 124 glFlush (); 125 ::SwapBuffers(fHDC); 125 GLint renderMode; 126 glGetIntegerv(GL_RENDER_MODE, &renderMode); 127 if (renderMode == GL_RENDER) ::SwapBuffers(fHDC); 126 128 127 129 // Empty the Windows message queue : -
trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredX.cc
r529 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLStoredX.cc,v 1.1 3 2006/08/14 12:07:19allison Exp $28 // GEANT4 tag $Name: geant4-0 8-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 $ 29 29 // 30 30 // … … 42 42 #include "G4OpenGLStoredXViewer.hh" 43 43 #include "G4OpenGLViewerMessenger.hh" 44 #include "G4OpenGLXViewerMessenger.hh"45 44 46 45 G4OpenGLStoredX::G4OpenGLStoredX (): … … 51 50 { 52 51 G4OpenGLViewerMessenger::GetInstance(); 53 G4OpenGLXViewerMessenger::GetInstance();54 52 } 55 53 -
trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredXViewer.cc
r529 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLStoredXViewer.cc,v 1.2 1 2006/09/04 12:07:59allison Exp $28 // GEANT4 tag $Name: geant4-0 8-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 $ 29 29 // 30 30 // … … 126 126 glXWaitGL (); //Wait for effects of all previous OpenGL commands to 127 127 //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); 129 131 } 130 132 -
trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredXm.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLStoredXm.cc,v 1.11 2006/08/14 12:07:19 allison Exp $ 28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredXmViewer.cc
r529 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLStoredXmViewer.cc,v 1.2 1 2006/09/04 12:07:59allison Exp $28 // GEANT4 tag $Name: geant4-0 8-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 $ 29 29 // 30 30 // … … 131 131 glXWaitGL (); //Wait for effects of all previous OpenGL commands to 132 132 //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); 134 136 } 135 137 -
trunk/geant4/visualization/OpenGL/src/G4OpenGLTransform3D.cc
r564 r593 26 26 // 27 27 // $Id: G4OpenGLTransform3D.cc,v 1.8 2006/06/29 21:19:32 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // … … 49 49 *p++ = operator()(k,i); 50 50 } 51 *p++ = 0.; 51 *p++ = 0.; 52 52 } 53 53 m[15] = 1.; -
trunk/geant4/visualization/OpenGL/src/G4OpenGLViewer.cc
r543 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLViewer.cc,v 1. 29 2006/09/19 16:13:15allison Exp $28 // GEANT4 tag $Name: geant4-0 8-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 $ 29 29 // 30 30 // … … 46 46 #include "G4Normal3D.hh" 47 47 #include "G4Plane3D.hh" 48 #include "G4AttHolder.hh" 49 #include "G4AttCheck.hh" 50 #include <sstream> 51 52 static 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 }; 48 81 49 82 G4OpenGLViewer::G4OpenGLViewer (G4OpenGLSceneHandler& scene): 50 83 G4VViewer (scene, -1), 84 pointSize (0), 85 print_colour (true), 86 vectored_ps (true), 87 fOpenGLSceneHandler(scene), 51 88 background (G4Colour(0.,0.,0.)), 52 89 transparency_enabled (true), 53 90 antialiasing_enabled (false), 54 91 haloing_enabled (false), 55 fStartTime(- DBL_MAX),56 fEndTime( DBL_MAX),92 fStartTime(-G4OPENGL_DBL_MAX), 93 fEndTime(G4OPENGL_DBL_MAX), 57 94 fFadeFactor(0.), 58 95 fDisplayHeadTime(false), … … 82 119 // glDisable (GL_POLYGON_SMOOTH); 83 120 121 strcpy (print_string, "G4OpenGL.eps"); 84 122 } 85 123 … … 88 126 void G4OpenGLViewer::InitializeGLView () 89 127 { 90 printf("G4OpenGLViewer::InitializeGLView () VVVVVVVVVVVVVVVVVVVVV \n");91 128 glClearColor (0.0, 0.0, 0.0, 0.0); 92 129 glClearDepth (1.0); … … 94 131 glDisable (GL_LINE_SMOOTH); 95 132 glDisable (GL_POLYGON_SMOOTH); 96 printf("G4OpenGLViewer::InitializeGLView () ^^^^^^^^^^^^^^^^^^^^ \n");97 133 } 98 134 … … 275 311 } 276 312 313 void 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 369 void 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 400 void 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 412 void 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 453 void 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 498 G4float* 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 704 typedef struct G4OpenGLViewerDepthIndex { 705 GLfloat *ptr; 706 GLfloat depth; 707 } DepthIndex; 708 709 extern "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 726 void 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 277 842 #endif -
trunk/geant4/visualization/OpenGL/src/G4OpenGLViewerMessenger.cc
r529 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLViewerMessenger.cc,v 1. 5 2006/10/24 06:20:42 allisonExp $28 // GEANT4 tag $Name: geant4-0 8-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 $ 29 29 30 30 #include "G4OpenGLViewerMessenger.hh" … … 35 35 #include "G4UIcommand.hh" 36 36 #include "G4UIdirectory.hh" 37 #include "G4UIcmdWithoutParameter.hh" 37 38 #include "G4UIcmdWithADouble.hh" 38 39 #include "G4UIcmdWithABool.hh" 40 #include "G4UIcmdWithAString.hh" 39 41 #include "G4VisManager.hh" 40 42 #include <sstream> … … 56 58 fpDirectory = new G4UIdirectory("/vis/ogl/"); 57 59 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."); 58 67 59 68 fpDirectorySet = new G4UIdirectory ("/vis/ogl/set/"); … … 146 155 fpCommandEndTime->SetGuidance("Set end and range of track time."); 147 156 parameter = new G4UIparameter ("end-time", 'd', omitable = false); 148 parameter->SetDefaultValue( DBL_MAX);157 parameter->SetDefaultValue(G4OPENGL_DBL_MAX); 149 158 fpCommandEndTime->SetParameter(parameter); 150 159 parameter = new G4UIparameter ("end-time-unit", 's', omitable = false); … … 165 174 fpCommandFade->SetDefaultValue(0.); 166 175 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 167 183 fpCommandStartTime = 168 184 new G4UIcommand("/vis/ogl/set/startTime", this); 169 185 fpCommandStartTime->SetGuidance("Set start and range of track time."); 170 186 parameter = new G4UIparameter ("start-time", 'd', omitable = false); 171 parameter->SetDefaultValue(- DBL_MAX);187 parameter->SetDefaultValue(-G4OPENGL_DBL_MAX); 172 188 fpCommandStartTime->SetParameter(parameter); 173 189 parameter = new G4UIparameter ("start-time-unit", 's', omitable = false); … … 192 208 G4OpenGLViewerMessenger::~G4OpenGLViewerMessenger () 193 209 { 210 delete fpCommandPrintMode; 194 211 delete fpCommandTransparency; 195 212 delete fpCommandStartTime; … … 199 216 delete fpCommandDisplayHeadTime; 200 217 delete fpDirectorySet; 218 delete fpCommandPrintEPS; 201 219 delete fpDirectory; 220 221 delete fpInstance; 202 222 } 203 223 … … 226 246 return; 227 247 } 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 } 228 266 229 267 G4OpenGLStoredViewer* pViewer = … … 303 341 } 304 342 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 305 356 if (command == fpCommandStartTime) 306 357 { -
trunk/geant4/visualization/OpenGL/src/G4OpenGLWin32Viewer.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLWin32Viewer.cc,v 1.17 2006/06/29 21:19:36 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/src/G4OpenGLXViewer.cc
r529 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLXViewer.cc,v 1. 34 2006/11/01 11:22:26allison Exp $28 // GEANT4 tag $Name: geant4-0 8-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 $ 29 29 // 30 30 // … … 77 77 #define USE_STANDARD_COLORMAP 0 78 78 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 NULL107 };108 109 79 XVisualInfo* G4OpenGLXViewer::vi_single_buffer = 0; 110 80 XVisualInfo* G4OpenGLXViewer::vi_double_buffer = 0; 111 81 112 82 extern "C" { 113 Bool G4OpenGLXViewerWaitForNotify (Display*, XEvent* e, char* arg) {83 static Bool G4OpenGLXViewerWaitForNotify (Display*, XEvent* e, char* arg) { 114 84 return (e->type == MapNotify) && (e->xmap.window == (Window) arg); 115 85 } … … 125 95 //be propagated before progressing. 126 96 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 } 127 112 } 128 113 … … 181 166 182 167 if (status == 1) { 168 cmap = 0; 183 169 status = XGetRGBColormaps (dpy, 184 170 XRootWindow (dpy, vi -> screen), … … 187 173 XA_RGB_DEFAULT_MAP); 188 174 if (status == 1) 189 for (i = 0; i < numCmaps; i++) 175 for (i = 0; i < numCmaps; i++) { 190 176 if (standardCmaps[i].visualid == vi -> visualid) { 191 177 cmap = standardCmaps[i].colormap; 192 178 XFree (standardCmaps); 179 break; 193 180 } 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 } 194 189 G4cout << "Got standard cmap" << G4endl; 195 190 } else { … … 298 293 299 294 // 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 } 301 306 302 307 } … … 342 347 G4VViewer (scene, -1), 343 348 G4OpenGLViewer (scene), 344 print_colour (true),345 vectored_ps (true),346 349 vi_immediate (0), 347 vi_stored (0) 350 vi_stored (0), 351 vi (0), 352 cmap (0) 348 353 { 349 350 strcpy (print_string, "G4OpenGL.eps");351 352 354 GetXConnection (); 353 355 if (fViewId < 0) return; … … 432 434 433 435 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(); 459 438 460 439 } else { … … 462 441 XVisualInfo* pvi; 463 442 GLXContext pcx = create_GL_print_context(pvi); 443 444 if (!pcx) { 445 G4cout << "Unable to create print context." << G4endl; 446 return; 447 } 448 464 449 GLXContext tmp_cx; 465 450 tmp_cx = cx; … … 480 465 481 466 glXMakeCurrent (dpy, 482 glxpmap,467 win, 483 468 cx); 484 469 … … 486 471 487 472 ClearView (); 473 SetView (); 488 474 DrawView (); 489 475 … … 496 482 497 483 glXMakeCurrent (dpy, 498 glxpmap,484 win, 499 485 cx); 500 486 … … 503 489 } 504 490 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); 491 GLubyte* 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; 963 538 } 964 539 … … 1040 615 } 1041 616 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; 617 GLXContext 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); 1089 633 } 1090 634 -
trunk/geant4/visualization/OpenGL/src/G4OpenGLXmBox.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmBox.cc,v 1.6 2006/06/29 21:19:40 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 //Box container class -
trunk/geant4/visualization/OpenGL/src/G4OpenGLXmConvenienceRoutines.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmConvenienceRoutines.cc,v 1.11 2006/06/29 21:19:42 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/src/G4OpenGLXmFourArrowButtons.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmFourArrowButtons.cc,v 1.5 2006/06/29 21:19:44 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 //Four arrow buttons class. Inherits from G4OpenGLXmVWidgetComponent -
trunk/geant4/visualization/OpenGL/src/G4OpenGLXmFramedBox.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmFramedBox.cc,v 1.6 2006/06/29 21:19:46 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 //Framed box container class -
trunk/geant4/visualization/OpenGL/src/G4OpenGLXmMainMenubarCallbacks.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmMainMenubarCallbacks.cc,v 1.13 2006/06/29 21:19:48 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/src/G4OpenGLXmPanningCallbacks.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmPanningCallbacks.cc,v 1.8 2006/06/29 21:19:50 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/src/G4OpenGLXmPushButton.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmPushButton.cc,v 1.6 2006/06/29 21:19:52 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 //Push button class. Inherits from G4OpenGLXmVWidgetComponent -
trunk/geant4/visualization/OpenGL/src/G4OpenGLXmRadioButton.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmRadioButton.cc,v 1.6 2006/06/29 21:19:54 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 //Radio button class. Inherits from G4OpenGLXmVWidgetComponent -
trunk/geant4/visualization/OpenGL/src/G4OpenGLXmRotationCallbacks.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmRotationCallbacks.cc,v 1.14 2006/06/29 21:19:56 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/src/G4OpenGLXmSeparator.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmSeparator.cc,v 1.5 2006/06/29 21:19:58 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 //Separator class. Inherits from G4OpenGLXmVWidgetComponent -
trunk/geant4/visualization/OpenGL/src/G4OpenGLXmSliderBar.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmSliderBar.cc,v 1.7 2006/06/29 21:20:00 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 //Slider bar class. Inherits from G4OpenGLXmVWidgetComponent -
trunk/geant4/visualization/OpenGL/src/G4OpenGLXmStyleCallbacks.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmStyleCallbacks.cc,v 1.14 2006/06/29 21:20:02 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/src/G4OpenGLXmTextField.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmTextField.cc,v 1.7 2006/06/29 21:20:04 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 //Text field class. Inherits from G4OpenGLXmVWidgetComponent -
trunk/geant4/visualization/OpenGL/src/G4OpenGLXmTopLevelShell.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmTopLevelShell.cc,v 1.5 2006/06/29 21:20:06 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 //Top level shell class -
trunk/geant4/visualization/OpenGL/src/G4OpenGLXmVWidgetComponent.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmVWidgetComponent.cc,v 1.5 2006/06/29 21:20:08 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 //Base class for all Motif component widgets -
trunk/geant4/visualization/OpenGL/src/G4OpenGLXmVWidgetContainer.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmVWidgetContainer.cc,v 1.5 2006/06/29 21:20:10 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 //Base class for all Motif container widgets -
trunk/geant4/visualization/OpenGL/src/G4OpenGLXmVWidgetObject.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmVWidgetObject.cc,v 1.5 2006/06/29 21:20:12 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 //Virtual base class for all Motif widgets. -
trunk/geant4/visualization/OpenGL/src/G4OpenGLXmVWidgetShell.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmVWidgetShell.cc,v 1.5 2006/06/29 21:20:14 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 //Base class for all Motif shell widgets -
trunk/geant4/visualization/OpenGL/src/G4OpenGLXmViewer.cc
r529 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLXmViewer.cc,v 1.2 3 2006/06/29 21:20:16 gunterExp $28 // GEANT4 tag $Name: geant4-0 8-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 $ 29 29 // 30 30 // … … 616 616 rot_sens_limit (90.), 617 617 pan_sens_limit (100.), 618 rot_sens ( 4.),618 rot_sens (1.), 619 619 wob_sens (20.), 620 620 original_vp(fVP.GetViewpointDirection()), -
trunk/geant4/visualization/OpenGL/src/G4OpenGLXmViewerMessenger.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmViewerMessenger.cc,v 1.4 2006/06/29 21:20:18 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 30 30 #ifdef G4VIS_BUILD_OPENGLXM_DRIVER -
trunk/geant4/visualization/OpenGL/src/G4OpenGLXmWindowHandlingCallbacks.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmWindowHandlingCallbacks.cc,v 1.6 2006/06/29 21:20:20 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenInventor/History
r529 r593 1 $Id: History,v 1.9 0 2006/11/05 20:49:09allison Exp $1 $Id: History,v 1.93 2007/04/03 13:35:48 allison Exp $ 2 2 ------------------------------------------------------------------- 3 3 … … 20 20 History file for visualization/OpenInventor 21 21 ------------------------------------------- 22 23 3rd April 2007 John Allison (openinventor-V08-02-02 - needs visman-V08-02-03) 24 - Introduced picking control. Default is "true" for Open Inventor. 25 26 25th 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 31 5th January 2007 John Allison (openinventor-V08-02-00) 32 - Moved LoadAtts to vis management. 22 33 23 34 5th November 2006 John Allison (openinventor-V08-01-04) -
trunk/geant4/visualization/OpenInventor/include/G4OpenInventor.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenInventor.hh,v 1.9 2006/06/29 21:20:22 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // Guy Barrand 26 Mar 1998. -
trunk/geant4/visualization/OpenInventor/include/G4OpenInventorSceneHandler.hh
r529 r593 25 25 // 26 26 // 27 // $Id: G4OpenInventorSceneHandler.hh,v 1.3 1 2006/11/02 12:01:20allison Exp $28 // GEANT4 tag $Name: geant4-0 8-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 $ 29 29 // 30 30 // … … 48 48 class SoSeparator; 49 49 class Geant4_SoStyleCache; 50 class G4 AttHolder;50 class G4VisAttributes; 51 51 52 52 // Base class for various OpenInventorScene classes. … … 86 86 private: 87 87 88 void LoadAtts(const G4Visible&, G4AttHolder*);89 88 static G4int fSceneIdCount; // static counter for OpenInventor scenes. 90 89 enum G4OIMarker {G4OICircle, G4OISquare}; 91 90 void AddCircleSquare (G4OIMarker markerType, const G4VMarker&); 92 91 void GeneratePrerequisites(); 92 void AddProperties(const G4VisAttributes*); 93 93 std::map <G4LogicalVolume*, SoSeparator*, 94 94 std::less <G4LogicalVolume*> > fSeparatorMap; -
trunk/geant4/visualization/OpenInventor/include/G4OpenInventorTransform3D.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenInventorTransform3D.hh,v 1.7 2006/06/29 21:20:26 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenInventor/include/G4OpenInventorWin.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenInventorWin.hh,v 1.3 2006/06/29 21:20:30 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // OpenInventor graphics system factory. -
trunk/geant4/visualization/OpenInventor/include/G4OpenInventorWin32.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenInventorWin32.hh,v 1.7 2006/06/29 21:20:32 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // OpenInventor graphics system factory. -
trunk/geant4/visualization/OpenInventor/include/G4OpenInventorWinViewer.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenInventorWinViewer.hh,v 1.9 2006/06/29 21:20:34 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenInventor/include/G4OpenInventorX.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenInventorX.hh,v 1.7 2006/06/29 21:20:36 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenInventor/include/G4OpenInventorXt.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenInventorXt.hh,v 1.3 2006/06/29 21:20:38 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenInventor/include/G4OpenInventorXtViewer.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenInventorXtViewer.hh,v 1.14 2006/06/29 21:20:40 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenInventor/include/HEPVis/SbMath.h
r529 r593 26 26 // 27 27 // $Id: SbMath.h,v 1.4 2006/06/29 21:20:46 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 #ifndef HEPVis_SbMath_h -
trunk/geant4/visualization/OpenInventor/include/HEPVis/nodekits/SoDetectorTreeKit.h
r529 r593 26 26 // 27 27 // $Id: SoDetectorTreeKit.h,v 1.5 2006/06/29 21:21:16 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 /*-----------------------------HEPVis----------------------------------------*/ -
trunk/geant4/visualization/OpenInventor/include/HEPVis/nodes/SoBox.h
r529 r593 26 26 // 27 27 // $Id: SoBox.h,v 1.3 2006/06/29 21:21:18 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 /*-----------------------------Hepvis----------------------------------------*/ -
trunk/geant4/visualization/OpenInventor/include/HEPVis/nodes/SoCons.h
r529 r593 26 26 // 27 27 // $Id: SoCons.h,v 1.3 2006/06/29 21:21:20 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 /*-----------------------------Hepvis----------------------------------------*/ -
trunk/geant4/visualization/OpenInventor/include/HEPVis/nodes/SoTrap.h
r529 r593 26 26 // 27 27 // $Id: SoTrap.h,v 1.4 2006/06/29 21:22:06 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 /*-----------------------------Hepvis----------------------------------------*/ -
trunk/geant4/visualization/OpenInventor/include/HEPVis/nodes/SoTrd.h
r529 r593 26 26 // 27 27 // $Id: SoTrd.h,v 1.3 2006/06/29 21:22:08 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 /*-----------------------------Hepvis----------------------------------------*/ -
trunk/geant4/visualization/OpenInventor/include/HEPVis/nodes/SoTubs.h
r529 r593 26 26 // 27 27 // $Id: SoTubs.h,v 1.3 2006/06/29 21:22:10 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 /*-----------------------------Hepvis----------------------------------------*/ -
trunk/geant4/visualization/OpenInventor/include/SoG4LineSet.h
r529 r593 25 25 // 26 26 // $Id: SoG4LineSet.h,v 1.2 2006/12/13 15:49:51 gunter Exp $ 27 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $27 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 28 28 // 29 29 // John Allison 26th October 2006 -
trunk/geant4/visualization/OpenInventor/include/SoG4MarkerSet.h
r529 r593 25 25 // 26 26 // $Id: SoG4MarkerSet.h,v 1.2 2006/12/13 15:49:53 gunter Exp $ 27 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $27 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 28 28 // 29 29 // John Allison 26th October 2006 -
trunk/geant4/visualization/OpenInventor/include/SoG4Polyhedron.h
r529 r593 26 26 // 27 27 // $Id: SoG4Polyhedron.h,v 1.2 2006/12/13 15:49:56 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // John Allison 26th October 2006 -
trunk/geant4/visualization/OpenInventor/src/G4OpenInventor.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenInventor.cc,v 1.20 2006/06/29 21:22:12 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 #ifdef G4VIS_BUILD_OI_DRIVER -
trunk/geant4/visualization/OpenInventor/src/G4OpenInventorSceneHandler.cc
r529 r593 25 25 // 26 26 // 27 // $Id: G4OpenInventorSceneHandler.cc,v 1.5 0 2006/11/05 20:48:57allison Exp $28 // GEANT4 tag $Name: geant4-0 8-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 $ 29 29 // 30 30 // … … 96 96 #include "G4Trap.hh" 97 97 #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"104 98 #include "G4ModelingParameters.hh" 105 99 #include "G4VPhysicalVolume.hh" … … 189 183 } 190 184 191 void G4OpenInventorSceneHandler::LoadAtts192 (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 241 185 // 242 186 // Method for handling G4Polyline objects (from tracking). 243 187 // 244 void G4OpenInventorSceneHandler::AddPrimitive (const G4Polyline& line) { 188 void G4OpenInventorSceneHandler::AddPrimitive (const G4Polyline& line) 189 { 190 AddProperties(line.GetVisAttributes()); // Transformation, colour, etc. 191 245 192 G4int nPoints = line.size(); 246 193 SbVec3f* pCoords = new SbVec3f[nPoints]; … … 252 199 } 253 200 254 // Don't understand why I have to do this again (done in255 // GeneratePrerequisites) - JA.256 //257 // Color258 //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 267 201 // 268 202 // Point Set … … 281 215 282 216 // Loads G4Atts for picking... 283 LoadAtts(line, pLine);217 if (fpViewer->GetViewParameters().IsPicking()) LoadAtts(line, pLine); 284 218 285 219 #ifdef INVENTOR2_0 … … 294 228 } 295 229 296 void G4OpenInventorSceneHandler::AddPrimitive (const G4Polymarker& polymarker) { 230 void G4OpenInventorSceneHandler::AddPrimitive (const G4Polymarker& polymarker) 231 { 232 AddProperties(polymarker.GetVisAttributes()); // Transformation, colour, etc. 233 297 234 G4int pointn = polymarker.size(); 298 235 if(pointn<=0) return; … … 305 242 } 306 243 307 // Don't understand why I have to do this again (done in308 // 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 317 244 SoCoordinate3* coordinate3 = new SoCoordinate3; 318 245 coordinate3->point.setValues(0,pointn,points); … … 336 263 337 264 // Loads G4Atts for picking... 338 LoadAtts(polymarker, markerSet); 265 if (fpViewer->GetViewParameters().IsPicking()) 266 LoadAtts(polymarker, markerSet); 339 267 340 268 G4VMarker::FillStyle style = polymarker.GetFillStyle(); … … 410 338 // Method for handling G4Text objects 411 339 // 412 void G4OpenInventorSceneHandler::AddPrimitive (const G4Text& text) { 340 void G4OpenInventorSceneHandler::AddPrimitive (const G4Text& text) 341 { 342 AddProperties(text.GetVisAttributes()); // Transformation, colour, etc. 343 413 344 // 414 345 // 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... 416 347 // 417 348 const G4Colour& c = GetTextColour (text); … … 476 407 477 408 void 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. 492 412 493 413 MarkerSizeType sizeType; … … 519 439 520 440 // Loads G4Atts for picking... 521 LoadAtts(marker, markerSet);441 if (fpViewer->GetViewParameters().IsPicking()) LoadAtts(marker, markerSet); 522 442 523 443 G4VMarker::FillStyle style = marker.GetFillStyle(); … … 574 494 // Method for handling G4Polyhedron objects for drawing solids. 575 495 // 576 void G4OpenInventorSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron) { 496 void G4OpenInventorSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron) 497 { 577 498 if (polyhedron.GetNoFacets() == 0) return; 578 499 500 AddProperties(polyhedron.GetVisAttributes()); // Transformation, colour, etc. 501 579 502 SoG4Polyhedron* soPolyhedron = new SoG4Polyhedron(polyhedron); 580 503 581 504 // Loads G4Atts for picking... 582 LoadAtts(polyhedron, soPolyhedron); 505 if (fpViewer->GetViewParameters().IsPicking()) 506 LoadAtts(polyhedron, soPolyhedron); 583 507 584 508 SbString name = "Non-geometry"; … … 600 524 // 601 525 void G4OpenInventorSceneHandler::AddPrimitive (const G4NURBS& nurb) { 526 527 AddProperties(nurb.GetVisAttributes()); // Transformation, colour, etc. 602 528 603 529 G4float *u_knot_array, *u_knot_array_ptr; … … 618 544 619 545 SoSeparator *surfSep = new SoSeparator(); 620 621 //622 // Color623 //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);631 546 632 547 // … … 686 601 // location on in the scene database so that when the solid is 687 602 // 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;717 603 718 604 G4PhysicalVolumeModel* pPVModel = … … 771 657 if(fPreviewAndFull) detectorTreeKit->setPreviewAndFull(); 772 658 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 } 773 686 774 687 SoMaterial* material = … … 853 766 } 854 767 } 768 } 769 770 void 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; 855 800 856 801 SoMaterial* material = … … 883 828 fCurrentSeparator->addChild(matrixTransform); 884 829 } 885 886 830 #endif -
trunk/geant4/visualization/OpenInventor/src/G4OpenInventorTransform3D.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenInventorTransform3D.cc,v 1.8 2006/06/29 21:22:16 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenInventor/src/G4OpenInventorViewer.cc
r529 r593 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4OpenInventorViewer.cc,v 1.5 7 2006/11/01 11:06:07allison Exp $27 // GEANT4 tag $Name: geant4-0 8-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 $ 28 28 29 29 #ifdef G4VIS_BUILD_OI_DRIVER … … 69 69 fNeedKernelVisit = true; //?? Temporary, until KernelVisitDecision fixed. 70 70 71 fVP.SetAutoRefresh(true); 71 72 fDefaultVP.SetAutoRefresh(true); 72 fVP.SetAutoRefresh(true); 73 fVP.SetPicking(true); 74 fDefaultVP.SetPicking(true); 73 75 74 76 //FIXME : G.Barrand : not convinced that we have to rm culling. … … 175 177 (vp.GetNoOfSides () != fVP.GetNoOfSides ()) || 176 178 (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 181 188 if (vp.IsDensityCulling () && 182 189 (vp.GetVisibleDensity () != fVP.GetVisibleDensity ())) -
trunk/geant4/visualization/OpenInventor/src/G4OpenInventorWin.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenInventorWin.cc,v 1.6 2006/06/29 21:22:20 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // OpenInventor graphics system factory. -
trunk/geant4/visualization/OpenInventor/src/G4OpenInventorWinViewer.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenInventorWinViewer.cc,v 1.25 2006/06/29 21:22:22 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 /* -
trunk/geant4/visualization/OpenInventor/src/G4OpenInventorXt.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenInventorXt.cc,v 1.4 2006/06/29 21:22:24 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenInventor/src/G4OpenInventorXtViewer.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenInventorXtViewer.cc,v 1.24 2006/06/29 21:22:26 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 /* -
trunk/geant4/visualization/OpenInventor/src/SoBox.cc
r529 r593 27 27 // 28 28 // $Id: SoBox.cc,v 1.8 2006/06/29 21:22:36 gunter Exp $ 29 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $29 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 30 30 // 31 31 /*----------------------------HEPVis----------------------------------------*/ -
trunk/geant4/visualization/OpenInventor/src/SoCons.cc
r529 r593 27 27 // 28 28 // $Id: SoCons.cc,v 1.8 2006/06/29 21:22:38 gunter Exp $ 29 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $29 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 30 30 // 31 31 /*-----------------------------HEPVis---------------------------------------*/ -
trunk/geant4/visualization/OpenInventor/src/SoDetectorTreeKit.cc
r529 r593 27 27 // 28 28 // $Id: SoDetectorTreeKit.cc,v 1.13 2006/06/29 21:22:51 gunter Exp $ 29 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $29 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 30 30 // 31 31 /*-----------------------------HEPVis----------------------------------------*/ -
trunk/geant4/visualization/OpenInventor/src/SoTrap.cc
r529 r593 27 27 // 28 28 // $Id: SoTrap.cc,v 1.8 2006/06/29 21:23:03 gunter Exp $ 29 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $29 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 30 30 // 31 31 /*-----------------------------HEPVis----------------------------------------*/ -
trunk/geant4/visualization/OpenInventor/src/SoTrd.cc
r529 r593 27 27 // 28 28 // $Id: SoTrd.cc,v 1.8 2006/06/29 21:23:05 gunter Exp $ 29 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $29 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 30 30 // 31 31 /*-----------------------------HEPVis---------------------------------------*/ -
trunk/geant4/visualization/OpenInventor/src/SoTubs.cc
r529 r593 27 27 // 28 28 // $Id: SoTubs.cc,v 1.8 2006/06/29 21:23:07 gunter Exp $ 29 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $29 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 30 30 // 31 31 /*-----------------------------HEPVis---------------------------------------*/ -
trunk/geant4/visualization/management/History
r531 r593 1 $Id: History,v 1. 90 2006/12/12 11:51:13 gcosmoExp $1 $Id: History,v 1.101 2007/07/10 17:52:25 allison Exp $ 2 2 3 3 ------------------------------------------------------------------- … … 26 26 History file for visualization management sub-category 27 27 ------------------------------------------------------ 28 29 10th 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 37 16th May 2007 John Allison (visman-V08-03-00) 38 - G4VSceneHandler.cc: Added #include "G4AttDef.hh" to help buggy 39 Windows compiler(!). 40 41 4th April 2007 John Allison (visman-V08-02-04) 42 - G4VSceneHandler.cc: Bug fix for zero vis atts in LoadAtts. 43 44 3rd April 2007 John Allison (visman-V08-02-03) 45 - Added /vis/viewer/set/picking. Picking is false by default, except 46 for OpenInventor. 47 48 25th 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 55 11th 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 62 5th 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. 28 80 29 81 12th December 2006 Gabriele Cosmo (visman-V08-01-16) -
trunk/geant4/visualization/management/include/G4GraphicsSystemList.hh
r531 r593 26 26 // 27 27 // $Id: G4GraphicsSystemList.hh,v 1.9 2006/06/29 21:27:54 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/management/include/G4Scene.hh
r531 r593 26 26 // 27 27 // $Id: G4Scene.hh,v 1.18 2006/11/14 14:59:54 allison Exp $ 28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/management/include/G4Scene.icc
r531 r593 26 26 // 27 27 // $Id: G4Scene.icc,v 1.14 2006/11/14 14:59:54 allison Exp $ 28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/management/include/G4SceneHandlerList.hh
r531 r593 26 26 // 27 27 // $Id: G4SceneHandlerList.hh,v 1.8 2006/06/29 21:28:00 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/management/include/G4SceneList.hh
r531 r593 26 26 // 27 27 // $Id: G4SceneList.hh,v 1.10 2006/06/29 21:28:02 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/management/include/G4VGraphicsSystem.hh
r531 r593 26 26 // 27 27 // $Id: G4VGraphicsSystem.hh,v 1.11 2006/06/29 21:28:04 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/management/include/G4VGraphicsSystem.icc
r531 r593 26 26 // 27 27 // $Id: G4VGraphicsSystem.icc,v 1.7 2006/06/29 21:28:06 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/management/include/G4VSceneHandler.hh
r531 r593 25 25 // 26 26 // 27 // $Id: G4VSceneHandler.hh,v 1.3 7 2006/11/15 19:25:31allison Exp $28 // GEANT4 tag $Name: geant4-0 8-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 $ 29 29 // 30 30 // … … 59 59 class G4Material; 60 60 class G4Event; 61 class G4AttHolder; 61 62 62 63 class G4VSceneHandler: public G4VGraphicsScene { … … 217 218 void SetTransientsDrawnThisRun (G4bool); 218 219 // Maintained by vis manager. 219 void SetEvent (const G4Event*);220 // If non-zero, this event is used in ProcessScene. Otherwise, the221 // current event, or last event(s) are used. The user must222 // SetEvent(0) when finished.223 220 224 221 ////////////////////////////////////////////////////////////// … … 233 230 // Returns colour of G4Text object, or default text colour. 234 231 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. 238 234 239 235 G4ViewParameters::DrawingStyle GetDrawingStyle (const G4VisAttributes*); … … 247 243 // over-riding the current view parameter. 248 244 249 G4int GetNoOfSides(const G4VisAttributes* pVisAttribs);245 G4int GetNoOfSides(const G4VisAttributes*); 250 246 // Returns no. of sides (lines segments per circle) from current 251 247 // view parameters, unless the user has forced through the vis … … 314 310 // implemented in this class. Subclasses that implement their own 315 311 // 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. 316 321 317 322 ////////////////////////////////////////////////////////////// … … 338 343 G4int fNestingDepth; // For Begin/EndPrimitives. 339 344 const G4VisAttributes* fpVisAttribs; // Working vis attributes. 340 const G4Event* fRequestedEvent; // If non-zero, use this event.341 345 const G4Transform3D fIdentityTransformation; 342 346 -
trunk/geant4/visualization/management/include/G4VSceneHandler.icc
r531 r593 25 25 // 26 26 // 27 // $Id: G4VSceneHandler.icc,v 1. 18 2006/11/15 19:25:31allison Exp $28 // GEANT4 tag $Name: geant4-0 8-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 $ 29 29 // 30 30 // … … 124 124 } 125 125 126 inline void G4VSceneHandler::SetEvent (const G4Event* event) {127 fRequestedEvent = event;128 }129 126 inline const G4Colour& G4VSceneHandler::GetColor (const G4Visible& visible) { 130 127 return GetColour (visible); -
trunk/geant4/visualization/management/include/G4VUserVisAction.hh
r531 r593 26 26 // 27 27 // $Id: G4VUserVisAction.hh,v 1.8 2006/06/29 21:28:12 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/management/include/G4VViewer.hh
r531 r593 26 26 // 27 27 // $Id: G4VViewer.hh,v 1.18 2006/06/29 21:28:14 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/management/include/G4VViewer.icc
r531 r593 26 26 // 27 27 // $Id: G4VViewer.icc,v 1.11 2006/06/29 21:28:16 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/management/include/G4VVisCommand.hh
r531 r593 26 26 // 27 27 // $Id: G4VVisCommand.hh,v 1.18 2006/06/29 21:28:18 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 30 30 // Base class for visualization commands - John Allison 9th August 1998 -
trunk/geant4/visualization/management/include/G4VVisCommand.icc
r531 r593 26 26 // 27 27 // $Id: G4VVisCommand.icc,v 1.5 2006/06/29 21:28:20 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 30 30 // Base class for visualization commands - John Allison 9th August 1998 -
trunk/geant4/visualization/management/include/G4ViewParameters.hh
r531 r593 25 25 // 26 26 // 27 // $Id: G4ViewParameters.hh,v 1.2 5 2006/09/19 16:02:31allison Exp $28 // GEANT4 tag $Name: geant4-0 8-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 $ 29 29 // 30 30 // … … 161 161 G4bool IsAutoRefresh () const; 162 162 const G4Colour& GetBackgroundColour () const; 163 G4bool IsPicking () const; 163 164 164 165 // Here Follow functions to evaluate the above algorithms as a … … 221 222 void SetAutoRefresh (G4bool); 222 223 void SetBackgroundColour (const G4Colour&); 224 void SetPicking (G4bool); 223 225 224 226 void PrintDifferences (const G4ViewParameters& v) const; … … 268 270 G4bool fAutoRefresh; // ...after change of view parameters. 269 271 G4Colour fBackgroundColour; 272 G4bool fPicking; // Request picking. 270 273 }; 271 274 -
trunk/geant4/visualization/management/include/G4ViewParameters.icc
r531 r593 25 25 // 26 26 // 27 // $Id: G4ViewParameters.icc,v 1.1 5 2006/09/19 16:02:31allison Exp $28 // GEANT4 tag $Name: geant4-0 8-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 $ 29 29 // 30 30 // … … 182 182 } 183 183 184 inline G4bool G4ViewParameters::IsPicking () const { 185 return fPicking; 186 } 187 184 188 inline void 185 189 G4ViewParameters::SetDrawingStyle (G4ViewParameters::DrawingStyle style) { … … 335 339 fBackgroundColour = colour; 336 340 } 341 342 inline void G4ViewParameters::SetPicking (G4bool picking) { 343 fPicking = picking; 344 } -
trunk/geant4/visualization/management/include/G4ViewerList.hh
r531 r593 26 26 // 27 27 // $Id: G4ViewerList.hh,v 1.8 2006/06/29 21:28:26 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/management/include/G4VisCommandModelCreate.hh
r531 r593 25 25 // 26 26 // $Id: G4VisCommandModelCreate.hh,v 1.3 2006/06/29 21:28:28 gunter Exp $ 27 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $27 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 28 28 // 29 29 // Jane Tinslay, John Allison, Joseph Perl October 2005 -
trunk/geant4/visualization/management/include/G4VisCommands.hh
r531 r593 25 25 // 26 26 // 27 // $Id: G4VisCommands.hh,v 1. 6 2006/11/14 14:59:54allison Exp $28 // GEANT4 tag $Name: geant4-0 8-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 $ 29 29 30 30 // /vis/ top level commands - John Allison 5th February 2001 … … 38 38 class G4UIcmdWithAString; 39 39 class G4UIcmdWithoutParameter; 40 41 class G4VisCommandAbortReviewKeptEvents: public G4VVisCommand { 42 public: 43 G4VisCommandAbortReviewKeptEvents (); 44 virtual ~G4VisCommandAbortReviewKeptEvents (); 45 G4String GetCurrentValue (G4UIcommand* command); 46 void SetNewValue (G4UIcommand* command, G4String newValue); 47 private: 48 G4VisCommandAbortReviewKeptEvents (const G4VisCommandAbortReviewKeptEvents&); 49 G4VisCommandAbortReviewKeptEvents& operator = (const G4VisCommandAbortReviewKeptEvents&); 50 G4UIcmdWithABool* fpCommand; 51 }; 40 52 41 53 class G4VisCommandEnable: public G4VVisCommand { -
trunk/geant4/visualization/management/include/G4VisCommandsCompound.hh
r531 r593 26 26 // 27 27 // $Id: G4VisCommandsCompound.hh,v 1.9 2006/06/29 21:28:32 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 30 30 // Compound /vis/ commands - John Allison 15th May 2000 -
trunk/geant4/visualization/management/include/G4VisCommandsGeometry.hh
r531 r593 26 26 // 27 27 // $Id: G4VisCommandsGeometry.hh,v 1.3 2006/06/29 21:28:34 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 30 30 // /vis/geometry commands - John Allison 31st January 2006 -
trunk/geant4/visualization/management/include/G4VisCommandsGeometrySet.hh
r531 r593 25 25 // 26 26 // 27 // $Id: G4VisCommandsGeometrySet.hh,v 1. 2 2006/06/29 21:28:36 gunterExp $28 // GEANT4 tag $Name: geant4-0 8-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 $ 29 29 30 30 // /vis/geometry commands - John Allison 31st January 2006 … … 80 80 private: 81 81 G4bool fForceAuxEdgeVisible; 82 }; 83 84 class G4VisCommandGeometrySetForceLineSegmentsPerCircleFunction: 85 public G4VVisCommandGeometrySetFunction { 86 public: 87 G4VisCommandGeometrySetForceLineSegmentsPerCircleFunction 88 (G4int lineSegmentsPerCircle): 89 fLineSegmentsPerCircle(lineSegmentsPerCircle) {} 90 void operator() 91 (G4VisAttributes* visAtts) const 92 {visAtts->SetForceLineSegmentsPerCircle(fLineSegmentsPerCircle);} 93 private: 94 G4int fLineSegmentsPerCircle; 82 95 }; 83 96 … … 212 225 }; 213 226 227 class G4VisCommandGeometrySetForceLineSegmentsPerCircle: 228 public G4VVisCommandGeometrySet { 229 public: 230 G4VisCommandGeometrySetForceLineSegmentsPerCircle (); 231 virtual ~G4VisCommandGeometrySetForceLineSegmentsPerCircle (); 232 G4String GetCurrentValue (G4UIcommand* command); 233 void SetNewValue (G4UIcommand* command, G4String newValue); 234 private: 235 G4VisCommandGeometrySetForceLineSegmentsPerCircle 236 (const G4VisCommandGeometrySetForceLineSegmentsPerCircle&); 237 G4VisCommandGeometrySetForceLineSegmentsPerCircle& operator= 238 (const G4VisCommandGeometrySetForceLineSegmentsPerCircle&); 239 G4UIcommand* fpCommand; 240 }; 241 214 242 class G4VisCommandGeometrySetForceWireframe: 215 243 public G4VVisCommandGeometrySet { -
trunk/geant4/visualization/management/include/G4VisCommandsListManager.hh
r531 r593 25 25 // 26 26 // $Id: G4VisCommandsListManager.hh,v 1.3 2006/06/29 21:28:38 gunter Exp $ 27 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $27 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 28 28 // 29 29 // Jane Tinslay, John Allison, Joseph Perl October 2005 -
trunk/geant4/visualization/management/include/G4VisCommandsScene.hh
r531 r593 26 26 // 27 27 // $Id: G4VisCommandsScene.hh,v 1.19 2006/11/14 14:59:54 allison Exp $ 28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 30 30 // /vis/scene commands - John Allison 9th August 1998 -
trunk/geant4/visualization/management/include/G4VisCommandsSceneAdd.hh
r531 r593 26 26 // 27 27 // $Id: G4VisCommandsSceneAdd.hh,v 1.17 2006/11/01 10:50:28 allison Exp $ 28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 30 30 // /vis/scene commands - John Allison 9th August 1998 -
trunk/geant4/visualization/management/include/G4VisCommandsSceneHandler.hh
r531 r593 26 26 // 27 27 // $Id: G4VisCommandsSceneHandler.hh,v 1.8 2006/06/29 21:28:44 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 30 30 // /vis/sceneHandler commands - John Allison 10th October 1998 -
trunk/geant4/visualization/management/include/G4VisCommandsViewer.hh
r531 r593 26 26 // 27 27 // $Id: G4VisCommandsViewer.hh,v 1.23 2006/09/13 13:17:29 allison Exp $ 28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 30 30 // /vis/viewer commands - John Allison 25th October 1998 -
trunk/geant4/visualization/management/include/G4VisCommandsViewerSet.hh
r531 r593 25 25 // 26 26 // 27 // $Id: G4VisCommandsViewerSet.hh,v 1.2 1 2006/09/19 16:03:14allison Exp $28 // GEANT4 tag $Name: geant4-0 8-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 $ 29 29 30 30 // /vis/viewer/set commands - John Allison 16th May 2000 … … 69 69 G4UIcommand* fpCommandLightsVector; 70 70 G4ThreeVector fLightsVector; 71 G4UIcmdWithABool* fpCommandPicking; 71 72 G4UIcommand* fpCommandProjection; 72 73 G4UIcommand* fpCommandSectionPlane; -
trunk/geant4/visualization/management/include/G4VisExecutive.hh
r531 r593 26 26 // 27 27 // $Id: G4VisExecutive.hh,v 1.6 2006/06/29 21:28:50 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/management/include/G4VisExecutive.icc
r564 r593 25 25 // 26 26 // 27 // $Id: G4VisExecutive.icc,v 1.1 4 2006/09/12 18:55:45 tinslayExp $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: $ 29 29 // 30 30 // -
trunk/geant4/visualization/management/include/G4VisFeaturesOfDAWNFILE.hh
r531 r593 26 26 // 27 27 // $Id: G4VisFeaturesOfDAWNFILE.hh,v 1.5 2006/06/29 21:28:54 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 #ifndef G4VISFEATURESOFDAWNFILE_HH -
trunk/geant4/visualization/management/include/G4VisFeaturesOfFukuiRenderer.hh
r531 r593 26 26 // 27 27 // $Id: G4VisFeaturesOfFukuiRenderer.hh,v 1.5 2006/06/29 21:28:56 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/management/include/G4VisFeaturesOfOpenGL.hh
r535 r593 25 25 // 26 26 // 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: $ 29 29 // 30 30 // -
trunk/geant4/visualization/management/include/G4VisFeaturesOfOpenInventor.hh
r531 r593 26 26 // 27 27 // $Id: G4VisFeaturesOfOpenInventor.hh,v 1.5 2006/06/29 21:29:00 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/management/include/G4VisFilterManager.hh
r531 r593 25 25 // 26 26 // $Id: G4VisFilterManager.hh,v 1.4 2006/06/29 21:29:02 gunter Exp $ 27 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $27 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 28 28 // 29 29 // Filter manager. Manages filter models, factories, messengers, -
trunk/geant4/visualization/management/include/G4VisListManager.hh
r531 r593 25 25 // 26 26 // $Id: G4VisListManager.hh,v 1.8 2006/06/29 21:29:04 gunter Exp $ 27 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $27 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 28 28 // 29 29 // Jane Tinslay, John Allison, Joseph Perl October 2005 -
trunk/geant4/visualization/management/include/G4VisManager.hh
r531 r593 25 25 // 26 26 // 27 // $Id: G4VisManager.hh,v 1.6 5 2006/11/21 14:23:20allison Exp $28 // GEANT4 tag $Name: geant4-0 8-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 $ 29 29 // 30 30 // … … 344 344 // GetXGeometryString and GetWindowSizeHint is guaranteed to be 345 345 // identical.) 346 const G4String& GetBeginOfLastRunRandomStatus () const;347 const G4String& GetBeginOfLastEventRandomStatus () const;348 G4int GetLastRunID () const;349 346 G4bool GetTransientsDrawnThisRun () const; 350 347 G4bool GetTransientsDrawnThisEvent () const; 348 const G4Event* GetRequestedEvent () const; 349 G4bool GetAbortReviewKeptEvents () const; 351 350 352 351 void SetUserAction (G4VUserVisAction* pVisAction, … … 366 365 void SetEventRefreshing (G4bool); 367 366 void ResetTransientsDrawnFlags (); 367 // If non-zero, requested event is used in G4VSceneHandler::ProcessScene. 368 void SetRequestedEvent (const G4Event*); 369 void SetAbortReviewKeptEvents (G4bool); 368 370 369 371 ///////////////////////////////////////////////////////////////////// … … 436 438 G4VisStateDependent* fpStateDependent; // Friend state dependent class. 437 439 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; 445 449 446 450 // Trajectory draw model manager -
trunk/geant4/visualization/management/include/G4VisManager.icc
r531 r593 25 25 // 26 26 // 27 // $Id: G4VisManager.icc,v 1. 19 2006/11/14 14:59:55allison Exp $28 // GEANT4 tag $Name: geant4-0 8-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 $ 29 29 // 30 30 // … … 90 90 } 91 91 92 inline const G4Event* G4VisManager::GetRequestedEvent() const { 93 return fpRequestedEvent; 94 } 95 96 inline G4bool G4VisManager::GetAbortReviewKeptEvents() const { 97 return fAbortReviewKeptEvents; 98 } 99 92 100 inline void G4VisManager::SetUserActionExtent (const G4VisExtent& extent) { 93 101 fUserVisActionExtent = extent; … … 122 130 fMessengerList.push_back(msgr); 123 131 } 132 133 inline void G4VisManager::SetRequestedEvent (const G4Event* event) { 134 fpRequestedEvent = event; 135 } 136 137 inline void G4VisManager::SetAbortReviewKeptEvents (G4bool abort) { 138 fAbortReviewKeptEvents = abort; 139 } -
trunk/geant4/visualization/management/include/G4VisModelManager.hh
r531 r593 25 25 // 26 26 // $Id: G4VisModelManager.hh,v 1.4 2006/06/29 21:29:10 gunter Exp $ 27 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $27 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 28 28 // 29 29 // Generic model manager. Manages models, associated -
trunk/geant4/visualization/management/include/G4VisStateDependent.hh
r531 r593 26 26 // 27 27 // $Id: G4VisStateDependent.hh,v 1.5 2006/06/29 21:29:12 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // A "state dependent" service class for G4VisManager. -
trunk/geant4/visualization/management/src/G4GraphicsSystemList.cc
r531 r593 26 26 // 27 27 // $Id: G4GraphicsSystemList.cc,v 1.4 2006/06/29 21:29:14 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 30 30 #include "G4GraphicsSystemList.hh" -
trunk/geant4/visualization/management/src/G4Scene.cc
r531 r593 26 26 // 27 27 // $Id: G4Scene.cc,v 1.23 2006/11/26 15:51:12 allison Exp $ 28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/management/src/G4SceneHandlerList.cc
r531 r593 26 26 // 27 27 // $Id: G4SceneHandlerList.cc,v 1.4 2006/06/29 21:29:18 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 30 30 #include "G4SceneHandlerList.hh" -
trunk/geant4/visualization/management/src/G4SceneList.cc
r531 r593 26 26 // 27 27 // $Id: G4SceneList.cc,v 1.6 2006/06/29 21:29:20 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 30 30 #include "G4SceneList.hh" -
trunk/geant4/visualization/management/src/G4VGraphicsSystem.cc
r531 r593 26 26 // 27 27 // $Id: G4VGraphicsSystem.cc,v 1.11 2006/06/29 21:29:22 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/management/src/G4VSceneHandler.cc
r561 r593 25 25 // 26 26 // 27 // $Id: G4VSceneHandler.cc,v 1. 77 2006/11/21 14:23:53allison Exp $28 // GEANT4 tag $Name: geant4-0 8-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 $ 29 29 // 30 30 // … … 71 71 #include "G4ModelingParameters.hh" 72 72 #include "G4VTrajectory.hh" 73 #include "G4VTrajectoryPoint.hh" 74 #include "G4HitsModel.hh" 73 75 #include "G4VHit.hh" 74 76 #include "Randomize.hh" … … 77 79 #include "G4Run.hh" 78 80 #include "G4Transform3D.hh" 81 #include "G4AttHolder.hh" 82 #include "G4AttDef.hh" 79 83 80 84 G4VSceneHandler::G4VSceneHandler (G4VGraphicsSystem& system, G4int id, const G4String& name): … … 95 99 fpObjectTransformation (0), 96 100 fNestingDepth (0), 97 fpVisAttribs (0), 98 fRequestedEvent (0) 101 fpVisAttribs (0) 99 102 { 100 103 G4VisManager* pVMan = G4VisManager::GetInstance (); … … 421 424 G4NURBS* pNURBS = 0; 422 425 G4Polyhedron* pPolyhedron = 0; 423 const G4VisAttributes* pVisAttribs =424 fpViewer -> GetApplicableVisAttributes (fpVisAttribs);425 426 switch (fpViewer -> GetViewParameters () . GetRepStyle ()) { 426 427 case G4ViewParameters::nurbs: 427 428 pNURBS = solid.CreateNURBS (); 428 429 if (pNURBS) { 429 pNURBS -> SetVisAttributes 430 (fpViewer -> GetApplicableVisAttributes (pVisAttribs)); 430 pNURBS -> SetVisAttributes (fpVisAttribs); 431 431 AddPrimitive (*pNURBS); 432 432 delete pNURBS; … … 447 447 case G4ViewParameters::polyhedron: 448 448 default: 449 G4Polyhedron::SetNumberOfRotationSteps (GetNoOfSides ( pVisAttribs));449 G4Polyhedron::SetNumberOfRotationSteps (GetNoOfSides (fpVisAttribs)); 450 450 pPolyhedron = solid.GetPolyhedron (); 451 451 G4Polyhedron::ResetNumberOfRotationSteps (); 452 452 if (pPolyhedron) { 453 pPolyhedron -> SetVisAttributes ( pVisAttribs);453 pPolyhedron -> SetVisAttributes (fpVisAttribs); 454 454 AddPrimitive (*pPolyhedron); 455 455 } … … 471 471 472 472 void G4VSceneHandler::ProcessScene (G4VViewer&) { 473 printf("G4VSceneHandler::ProcessScene\n"); 473 474 474 if (!fpScene) return; 475 475 … … 545 545 G4StateManager* stateManager = G4StateManager::GetStateManager(); 546 546 G4ApplicationState state = stateManager->GetCurrentState(); 547 548 printf("G4VSceneHandler::ProcessScene 1\n");549 547 if (state == G4State_Idle) { 550 printf("G4VSceneHandler::ProcessScene 2 : idle\n");551 548 552 549 visManager->SetEventRefreshing(true); 553 550 554 if (fRequestedEvent) { 555 DrawEvent(fRequestedEvent); 556 printf("G4VSceneHandler::ProcessScene 3 : fRequestedEvent\n"); 551 if (visManager->GetRequestedEvent()) { 552 DrawEvent(visManager->GetRequestedEvent()); 557 553 558 554 } else { 559 printf("G4VSceneHandler::ProcessScene 3 : not fRequestedEvent\n");560 555 561 556 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();567 557 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(); 587 572 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 } 596 591 } 597 592 } 598 593 } 599 594 } 600 }601 visManager->SetEventRefreshing(false);602 }595 } 596 visManager->SetEventRefreshing(false); 597 } 603 598 604 599 fMarkForClearingTransientStore = tmpMarkForClearingTransientStore; 605 printf("G4VSceneHandler::ProcessScene terminé \n");606 600 } 607 601 608 602 void G4VSceneHandler::DrawEvent(const G4Event* event) 609 603 { 610 printf("G4VSceneHandler::DrawEvent \n");611 604 const std::vector<G4VModel*>& EOEModelList = 612 605 fpScene -> GetEndOfEventModelList (); … … 718 711 } 719 712 713 void 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 720 764 const G4Colour& G4VSceneHandler::GetColour (const G4Visible& visible) { 721 765 // Colour is determined by the applicable vis attributes. … … 734 778 } 735 779 736 G4double G4VSceneHandler::GetLineWidth(const G4Visible& visible) 737 { 738 G4double lineWidth = fpViewer-> 739 GetApplicableVisAttributes(visible.GetVisAttributes())->GetLineWidth(); 780 G4double G4VSceneHandler::GetLineWidth(const G4VisAttributes* pVisAttribs) 781 { 782 G4double lineWidth = pVisAttribs->GetLineWidth(); 740 783 if (lineWidth < 1.) lineWidth = 1.; 741 784 lineWidth *= fpViewer -> GetViewParameters().GetGlobalLineWidthScale(); … … 749 792 // it can be overriddden by the ForceDrawingStyle flag in the vis 750 793 // attributes. 751 G4ViewParameters::DrawingStyle style = 794 G4ViewParameters::DrawingStyle style = 752 795 fpViewer->GetViewParameters().GetDrawingStyle(); 753 796 if (pVisAttribs -> IsForceDrawingStyle ()) { … … 821 864 // ForceLineSegmentsPerCircle in the vis attributes. 822 865 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 } 832 877 } 833 878 return lineSegmentsPerCircle; -
trunk/geant4/visualization/management/src/G4VViewer.cc
r531 r593 25 25 // 26 26 // 27 // $Id: G4VViewer.cc,v 1.2 3 2006/06/29 21:29:26 gunterExp $28 // GEANT4 tag $Name: geant4-0 8-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 $ 29 29 // 30 30 // … … 82 82 const G4VisAttributes* G4VViewer::GetApplicableVisAttributes 83 83 (const G4VisAttributes* pVisAttribs) const { 84 // If the pointer is null, pick up the default vis attributes from84 // If pVisAttribs is zero, pick up the default vis attributes from 85 85 // the view parameters. 86 86 if (!pVisAttribs) -
trunk/geant4/visualization/management/src/G4VVisCommand.cc
r531 r593 26 26 // 27 27 // $Id: G4VVisCommand.cc,v 1.18 2006/06/29 21:29:28 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 30 30 // Base class for visualization commands - John Allison 9th August 1998 -
trunk/geant4/visualization/management/src/G4ViewParameters.cc
r531 r593 25 25 // 26 26 // 27 // $Id: G4ViewParameters.cc,v 1.2 8 2006/09/19 16:02:31allison Exp $28 // GEANT4 tag $Name: geant4-0 8-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 $ 29 29 // 30 30 // … … 72 72 fWindowSizeHintY (600), 73 73 fAutoRefresh (false), 74 fBackgroundColour (G4Colour(0.,0.,0.)) // Black 74 fBackgroundColour (G4Colour(0.,0.,0.)), // Black 75 fPicking (false) 75 76 { 76 77 fDefaultMarker.SetScreenSize (5.); … … 273 274 (fXGeometryString != v.fXGeometryString) || 274 275 (fAutoRefresh != v.fAutoRefresh) || 275 (fBackgroundColour != v.fBackgroundColour)) 276 (fBackgroundColour != v.fBackgroundColour) || 277 (fPicking != v.fPicking) 278 ) 276 279 G4cout << "Difference in 1st batch." << G4endl; 277 280 … … 439 442 440 443 os << "\n Background colour: " << v.fBackgroundColour; 444 445 os << "\n Picking requested: "; 446 if (v.fPicking) os << "true"; 447 else os << "false"; 441 448 442 449 return os; … … 480 487 (fXGeometryString != v.fXGeometryString) || 481 488 (fAutoRefresh != v.fAutoRefresh) || 482 (fBackgroundColour != v.fBackgroundColour)) 489 (fBackgroundColour != v.fBackgroundColour) || 490 (fPicking != v.fPicking) 491 ) 483 492 return true; 484 493 -
trunk/geant4/visualization/management/src/G4ViewerList.cc
r531 r593 26 26 // 27 27 // $Id: G4ViewerList.cc,v 1.4 2006/06/29 21:29:32 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 30 30 #include "G4ViewerList.hh" -
trunk/geant4/visualization/management/src/G4VisCommands.cc
r531 r593 25 25 // 26 26 // 27 // $Id: G4VisCommands.cc,v 1.2 0 2006/11/26 15:49:10allison Exp $28 // GEANT4 tag $Name: geant4-0 8-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 $ 29 29 30 30 // /vis/ top level commands - John Allison 5th February 2001 … … 40 40 #include "G4Run.hh" 41 41 #include "G4UIsession.hh" 42 43 ////////////// /vis/abortReviewKeptEvents ///////////////////////////// 44 45 G4VisCommandAbortReviewKeptEvents::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 54 G4VisCommandAbortReviewKeptEvents::~G4VisCommandAbortReviewKeptEvents () { 55 delete fpCommand; 56 } 57 58 G4String G4VisCommandAbortReviewKeptEvents::GetCurrentValue (G4UIcommand*) { 59 return G4String(); 60 } 61 62 void G4VisCommandAbortReviewKeptEvents::SetNewValue (G4UIcommand*, 63 G4String newValue) { 64 fpVisManager->SetAbortReviewKeptEvents(G4UIcommand::ConvertToBool(newValue)); 65 G4cout << "Type \"continue\" to complete the abort." << G4endl; 66 } 42 67 43 68 ////////////// /vis/enable /////////////////////////////////////// … … 128 153 fpCommand -> SetGuidance 129 154 ("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."); 135 165 fpCommand -> SetParameterName("macro-file-name", omitable=true); 136 166 fpCommand -> SetDefaultValue(""); … … 185 215 } 186 216 187 G4VSceneHandler* sceneHandler = fpVisManager->GetCurrentSceneHandler();188 189 217 G4UImanager* UImanager = G4UImanager::GetUIpointer(); 190 218 G4int keepVerbose = UImanager->GetVerboseLevel(); … … 200 228 201 229 // Draw to viewer and pause session... 230 G4UIsession* session = UImanager->GetSession(); 202 231 for (size_t i = 0; i < nKeptEvents; ++i) { 203 232 const G4Event* event = (*events)[i]; 204 233 if (verbosity >= G4VisManager::warnings) { 205 234 G4cout << "Drawing event : " << event->GetEventID() << 206 ". At EndOfEvent, enter any command, then \"cont inue\"..."235 ". At EndOfEvent, enter any command, then \"cont[inue]\"..." 207 236 << 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 } 208 248 } 209 sceneHandler->SetEvent(event);249 fpVisManager->SetRequestedEvent(event); 210 250 UImanager->ApplyCommand("/vis/viewer/rebuild"); 211 251 /* The above command forces a rebuild of the scene, including … … 224 264 features or a complete re-think. 225 265 */ 226 if (!viewer->GetViewParameters().IsAutoRefresh()) 227 UImanager->ApplyCommand("/vis/viewer/flush"); 228 G4UIsession* session = UImanager->GetSession(); 266 UImanager->ApplyCommand("/vis/viewer/flush"); 229 267 session->PauseSessionStart("EndOfEvent"); 230 sceneHandler->SetEvent(0); 231 } 268 fpVisManager->SetRequestedEvent(0); 269 if (fpVisManager->GetAbortReviewKeptEvents()) break; 270 } 271 fpVisManager->SetAbortReviewKeptEvents(false); 232 272 233 273 } else { … … 240 280 << " with macro file \"" << macroFileName << G4endl; 241 281 } 242 sceneHandler->SetEvent(event);282 fpVisManager->SetRequestedEvent(event); 243 283 UImanager->ApplyCommand("/control/execute " + macroFileName); 244 sceneHandler->SetEvent(0);284 fpVisManager->SetRequestedEvent(0); 245 285 } 246 286 } -
trunk/geant4/visualization/management/src/G4VisCommandsCompound.cc
r531 r593 25 25 // 26 26 // 27 // $Id: G4VisCommandsCompound.cc,v 1.3 5 2006/12/12 11:48:13 gcosmoExp $28 // GEANT4 tag $Name: geant4-0 8-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 $ 29 29 30 30 // Compound /vis/ commands - John Allison 15th May 2000 … … 202 202 UImanager->SetVerboseLevel(newVerbose); 203 203 UImanager->ApplyCommand("/vis/scene/create"); 204 // UImanager->ApplyCommand("/vis/scene/add/eventID");205 204 UImanager->ApplyCommand(G4String("/vis/scene/add/volume " + newValue)); 206 205 UImanager->ApplyCommand("/vis/sceneHandler/attach"); 207 206 UImanager->SetVerboseLevel(keepVerbose); 208 207 static G4bool warned = false; 209 if (verbosity >= G4VisManager:: warnings && !warned) {208 if (verbosity >= G4VisManager::confirmations && !warned) { 210 209 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" 212 211 "\n issue \"/vis/viewer/refresh\" or \"/vis/viewer/flush\"." 213 212 << G4endl; … … 322 321 UImanager->SetVerboseLevel(keepVerbose); 323 322 static G4bool warned = false; 324 if (verbosity >= G4VisManager:: warnings && !warned) {323 if (verbosity >= G4VisManager::confirmations && !warned) { 325 324 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" 327 326 "\n issue \"/vis/viewer/refresh\" or \"/vis/viewer/flush\"." 328 327 << G4endl; -
trunk/geant4/visualization/management/src/G4VisCommandsGeometry.cc
r531 r593 25 25 // 26 26 // 27 // $Id: G4VisCommandsGeometry.cc,v 1. 3 2006/06/29 21:29:38 gunterExp $28 // GEANT4 tag $Name: geant4-0 8-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 $ 29 29 30 30 // /vis/geometry commands - John Allison 31st January 2006 … … 147 147 return; 148 148 } 149 G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/rebuild"); 149 if (fpVisManager->GetCurrentViewer()) { 150 G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/rebuild"); 151 } 150 152 } -
trunk/geant4/visualization/management/src/G4VisCommandsGeometrySet.cc
r531 r593 25 25 // 26 26 // 27 // $Id: G4VisCommandsGeometrySet.cc,v 1. 6 2006/09/19 16:05:13allison Exp $28 // GEANT4 tag $Name: geant4-0 8-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 $ 29 29 30 30 // /vis/geometry commands - John Allison 31st January 2006 … … 171 171 G4bool omitable; 172 172 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."); 174 174 fpCommand->SetGuidance("\"all\" sets all logical volumes."); 175 175 fpCommand->SetGuidance … … 243 243 fpCommand = new G4UIcommand("/vis/geometry/set/forceAuxEdgeVisible", this); 244 244 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."); 246 247 fpCommand->SetGuidance("\"all\" sets all logical volumes."); 247 248 fpCommand->SetGuidance … … 288 289 } 289 290 291 ////////////// /vis/geometry/set/forceLineSegmentsPerCircle ///////////////////////// 292 293 G4VisCommandGeometrySetForceLineSegmentsPerCircle::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 320 G4VisCommandGeometrySetForceLineSegmentsPerCircle::~G4VisCommandGeometrySetForceLineSegmentsPerCircle() 321 { 322 delete fpCommand; 323 } 324 325 G4String 326 G4VisCommandGeometrySetForceLineSegmentsPerCircle::GetCurrentValue(G4UIcommand*) 327 { 328 return ""; 329 } 330 331 void 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 290 344 ////////////// /vis/geometry/set/forceSolid ///////////////////////// 291 345 … … 295 349 fpCommand = new G4UIcommand("/vis/geometry/set/forceSolid", this); 296 350 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."); 298 353 fpCommand->SetGuidance("\"all\" sets all logical volumes."); 299 354 fpCommand->SetGuidance … … 345 400 fpCommand = new G4UIcommand("/vis/geometry/set/forceWireframe", this); 346 401 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."); 348 404 fpCommand->SetGuidance("\"all\" sets all logical volumes."); 349 405 fpCommand->SetGuidance -
trunk/geant4/visualization/management/src/G4VisCommandsScene.cc
r531 r593 25 25 // 26 26 // 27 // $Id: G4VisCommandsScene.cc,v 1.6 5 2006/11/26 19:37:54allison Exp $28 // GEANT4 tag $Name: geant4-0 8-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 $ 29 29 30 30 // /vis/scene commands - John Allison 9th August 1998 … … 480 480 G4VSceneHandler* pCurrentSceneHandler = 481 481 fpVisManager -> GetCurrentSceneHandler(); 482 if (!pCurrentSceneHandler) { 483 if (verbosity >= G4VisManager::warnings) { 484 G4cout << "WARNING: No current scene handler." 485 << G4endl; 486 } 487 return; 488 } 482 489 G4VViewer* pCurrentViewer = fpVisManager -> GetCurrentViewer(); 490 if (!pCurrentViewer) { 491 if (verbosity >= G4VisManager::warnings) { 492 G4cout << "WARNING: No current viewer." 493 << G4endl; 494 } 495 return; 496 } 483 497 G4Scene* pCurrentScene = fpVisManager -> GetCurrentScene(); 498 if (!pCurrentScene) { 499 if (verbosity >= G4VisManager::warnings) { 500 G4cout << "WARNING: No current scene." 501 << G4endl; 502 } 503 return; 504 } 484 505 G4VisManager::Verbosity currentVerbosity = fpVisManager -> GetVerbosity(); 485 506 -
trunk/geant4/visualization/management/src/G4VisCommandsSceneAdd.cc
r531 r593 26 26 // 27 27 // $Id: G4VisCommandsSceneAdd.cc,v 1.72 2006/11/25 15:37:31 allison Exp $ 28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // /vis/scene commands - John Allison 9th August 1998 30 30 -
trunk/geant4/visualization/management/src/G4VisCommandsSceneHandler.cc
r531 r593 26 26 // 27 27 // $Id: G4VisCommandsSceneHandler.cc,v 1.32 2006/06/29 21:29:46 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 30 30 // /vis/sceneHandler commands - John Allison 10th October 1998 -
trunk/geant4/visualization/management/src/G4VisCommandsViewer.cc
r531 r593 25 25 // 26 26 // 27 // $Id: G4VisCommandsViewer.cc,v 1.6 6 2006/11/25 15:38:03allison Exp $28 // GEANT4 tag $Name: geant4-0 8-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 $ 29 29 30 30 // /vis/viewer commands - John Allison 25th October 1998 … … 73 73 fpCommand = new G4UIcommand ("/vis/viewer/addCutawayPlane", this); 74 74 fpCommand -> SetGuidance 75 ("Add cutaway plane A*x + B*y + C*z + D = 0to current viewer.");75 ("Add cutaway plane to current viewer."); 76 76 G4UIparameter* parameter; 77 77 parameter = new G4UIparameter("x",'d',omitable = true); … … 1139 1139 G4Scene* scene = sceneHandler->GetScene(); 1140 1140 if (!scene) { 1141 if (verbosity >= G4VisManager:: warnings) {1142 G4cout << " WARNING: SceneHandler \"" << sceneHandler->GetName()1141 if (verbosity >= G4VisManager::confirmations) { 1142 G4cout << "NOTE: SceneHandler \"" << sceneHandler->GetName() 1143 1143 << "\", to which viewer \"" << refreshName << "\"" << 1144 1144 "\n is attached, has no scene - \"/vis/scene/create\" and" … … 1413 1413 G4Scene* scene = sceneHandler->GetScene(); 1414 1414 if (!scene) { 1415 if (verbosity >= G4VisManager:: warnings) {1416 G4cout << " WARNING: SceneHandler \"" << sceneHandler->GetName()1415 if (verbosity >= G4VisManager::confirmations) { 1416 G4cout << "NOTE: SceneHandler \"" << sceneHandler->GetName() 1417 1417 << "\", to which viewer \"" << updateName << "\"" << 1418 1418 "\n is attached, has no scene - \"/vis/scene/create\" and" -
trunk/geant4/visualization/management/src/G4VisCommandsViewerSet.cc
r531 r593 25 25 // 26 26 // 27 // $Id: G4VisCommandsViewerSet.cc,v 1.4 7 2006/11/14 14:59:55allison Exp $28 // GEANT4 tag $Name: geant4-0 8-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 $ 29 29 30 30 // /vis/viewer/set commands - John Allison 16th May 2000 … … 67 67 "\nview parameters."); 68 68 fpCommandAutoRefresh->SetParameterName("auto-refresh",omitable = true); 69 fpCommandAutoRefresh->SetDefaultValue( false);69 fpCommandAutoRefresh->SetDefaultValue(true); 70 70 71 71 fpCommandAuxEdge = new G4UIcmdWithABool … … 76 76 "\nsometimes called soft edges, become visible/invisible."); 77 77 fpCommandAuxEdge->SetParameterName("edge",omitable = true); 78 fpCommandAuxEdge->SetDefaultValue( false);78 fpCommandAuxEdge->SetDefaultValue(true); 79 79 80 80 fpCommandBackground = new G4UIcommand … … 247 247 fpCommandLineSegments->SetParameterName("line-segments",omitable = true); 248 248 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); 249 258 250 259 fpCommandProjection = new G4UIcommand("/vis/viewer/set/projection",this); … … 388 397 delete fpCommandLightsThetaPhi; 389 398 delete fpCommandLightsVector; 399 delete fpCommandPicking; 390 400 delete fpCommandProjection; 391 401 delete fpCommandSectionPlane; … … 460 470 << G4endl; 461 471 } 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. 464 476 } 465 477 … … 754 766 } 755 767 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 756 778 else if (command == fpCommandProjection) { 757 779 G4double fieldHalfAngle; -
trunk/geant4/visualization/management/src/G4VisFeaturesOfDAWNFILE.cc
r531 r593 26 26 // 27 27 // $Id: G4VisFeaturesOfDAWNFILE.cc,v 1.6 2006/06/29 21:29:52 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 #include "G4VisFeaturesOfDAWNFILE.hh" -
trunk/geant4/visualization/management/src/G4VisFeaturesOfFukuiRenderer.cc
r531 r593 26 26 // 27 27 // $Id: G4VisFeaturesOfFukuiRenderer.cc,v 1.5 2006/06/29 21:29:54 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/management/src/G4VisFeaturesOfOpenGL.cc
r534 r593 25 25 // 26 26 // 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: $ 29 29 // 30 30 // -
trunk/geant4/visualization/management/src/G4VisFeaturesOfOpenInventor.cc
r531 r593 26 26 // 27 27 // $Id: G4VisFeaturesOfOpenInventor.cc,v 1.5 2006/06/29 21:29:58 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/management/src/G4VisManager.cc
r564 r593 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4VisManager.cc,v 1.1 09 2006/11/26 15:43:51allison Exp $27 // GEANT4 tag $Name: geant4-0 8-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 $ 28 28 // 29 29 // … … 72 72 #include "Randomize.hh" 73 73 #include "G4RunManager.hh" 74 #include "G4EventManager.hh" 74 75 #include "G4Run.hh" 75 76 #include "G4Event.hh" … … 86 87 fpSceneHandler (0), 87 88 fpViewer (0), 88 fVerbosity ( confirmations),//(warnings),89 fVerbosity (warnings), 89 90 fpStateDependent (0), 90 91 fEventRefreshing (false), … … 92 93 fTransientsDrawnThisEvent (false), 93 94 fEventKeepingSuspended (false), 94 fKeptLastEvent (false) 95 fKeptLastEvent (false), 96 fpRequestedEvent (0), 97 fAbortReviewKeptEvents (false) 95 98 // All other objects use default constructors. 96 99 { … … 118 121 if (fpInstance) { 119 122 G4Exception 120 ("G4VisManager: attempt to Construct more than one VisManager. 123 ("G4VisManager: attempt to Construct more than one VisManager."); 121 124 } 122 125 else { … … 584 587 if (fpSceneHandler) { 585 588 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 596 610 if (fVerbosity >= confirmations) { 597 G4cout << "G4VisManager::CreateViewer: new viewer created :"611 G4cout << "G4VisManager::CreateViewer: new viewer created." 598 612 << G4endl; 599 613 } 614 615 const G4ViewParameters& vp = fpViewer->GetViewParameters(); 600 616 if (fVerbosity >= parameters) { 601 617 G4cout << " view parameters are:\n " << vp << G4endl; 602 618 } 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; 613 622 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 } 616 632 } 617 633 } 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 } 624 646 } 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;639 647 } 640 648 } … … 893 901 894 902 // Top level basic commands... 903 RegisterMessenger(new G4VisCommandAbortReviewKeptEvents); 895 904 RegisterMessenger(new G4VisCommandEnable); 896 905 RegisterMessenger(new G4VisCommandList); … … 921 930 RegisterMessenger(new G4VisCommandGeometrySetLineWidth); 922 931 RegisterMessenger(new G4VisCommandGeometrySetForceAuxEdgeVisible); 932 RegisterMessenger(new G4VisCommandGeometrySetForceLineSegmentsPerCircle); 923 933 RegisterMessenger(new G4VisCommandGeometrySetForceSolid); 924 934 RegisterMessenger(new G4VisCommandGeometrySetForceWireframe); … … 1104 1114 void G4VisManager::BeginOfRun () 1105 1115 { 1106 G4cout << "G4VisManager::BeginOfRun" << G4endl;1116 //G4cout << "G4VisManager::BeginOfRun" << G4endl; 1107 1117 fKeptLastEvent = false; 1108 1118 fEventKeepingSuspended = false; … … 1113 1123 void G4VisManager::BeginOfEvent () 1114 1124 { 1115 G4cout << "G4VisManager::BeginOfEvent" << G4endl;1125 //G4cout << "G4VisManager::BeginOfEvent" << G4endl; 1116 1126 fTransientsDrawnThisEvent = false; 1117 1127 if (fpSceneHandler) fpSceneHandler->SetTransientsDrawnThisEvent(false); … … 1120 1130 void G4VisManager::EndOfEvent () 1121 1131 { 1122 G4cout << "G4VisManager::EndOfEvent" << G4endl;1132 //G4cout << "G4VisManager::EndOfEvent" << G4endl; 1123 1133 1124 1134 // Don't call IsValidView unless there is a scene handler. This … … 1131 1141 const G4Run* currentRun = runManager->GetCurrentRun(); 1132 1142 1133 const G4Event* currentEvent =1134 G4EventManager::GetEventManager()->GetConstCurrentEvent();1143 G4EventManager* eventManager = G4EventManager::GetEventManager(); 1144 const G4Event* currentEvent = eventManager->GetConstCurrentEvent(); 1135 1145 if (!currentEvent) return; 1136 1146 1137 1147 ClearTransientStoreIfMarked(); 1138 printf("G4VisManager::DrawEvent \n");1139 1148 fpSceneHandler->DrawEvent(currentEvent); 1140 printf("G4VisManager::DrawEvent END\n");1141 1149 1142 1150 G4int nEventsToBeProcessed = 0; … … 1160 1168 // Keep, but only if user has not kept any... 1161 1169 if (!nKeptEvents) { 1162 G4EventManager::GetEventManager()->KeepTheCurrentEvent();1170 eventManager->KeepTheCurrentEvent(); 1163 1171 fKeptLastEvent = true; 1164 1172 } … … 1182 1190 } 1183 1191 } else if (maxNumberOfKeptEvents != 0) { 1184 G4EventManager::GetEventManager()->KeepTheCurrentEvent();1192 eventManager->KeepTheCurrentEvent(); 1185 1193 } 1186 1194 } … … 1189 1197 void G4VisManager::EndOfRun () 1190 1198 { 1191 G4cout << "G4VisManager::EndOfRun" << G4endl;1199 //G4cout << "G4VisManager::EndOfRun" << G4endl; 1192 1200 1193 1201 // Don't call IsValidView unless there is a scene handler. This -
trunk/geant4/visualization/management/src/G4VisStateDependent.cc
r561 r593 26 26 // 27 27 // $Id: G4VisStateDependent.cc,v 1.6 2006/06/29 21:30:02 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 30 30 #include "G4VisStateDependent.hh" … … 46 46 } 47 47 else if (previousState == G4State_EventProc && requestedState == G4State_GeomClosed) { 48 printf("G4VisStateDependent::EndOfEvent \n");49 48 fpVisManager -> EndOfEvent (); 50 49 }
Note: See TracChangeset
for help on using the changeset viewer.