Geant4-11
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes
G4OpenGL2PSAction Class Reference

#include <G4OpenGL2PSAction.hh>

Inheritance diagram for G4OpenGL2PSAction:
SoGL2PSAction

Public Member Functions

bool disableFileWriting ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// More...
 
bool enableFileWriting ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// More...
 
bool extendBufferSize ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// More...
 
bool fileWritingEnabled () const
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// More...
 
 G4OpenGL2PSAction ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// More...
 
void resetBufferSizeParameters ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// More...
 
void setBufferSize (int)
 
void setExportImageFormat (unsigned int)
 
void setFileName (const char *)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// More...
 
void setLineWidth (int)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// More...
 
void setPointSize (int)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// More...
 
void setViewport (int, int, int, int)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// More...
 

Protected Member Functions

bool G4gl2psBegin ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// More...
 

Protected Attributes

GLint fBufferSize
 
GLint fBufferSizeLimit
 
FILE * fFile
 
G4String fFileName
 
GLint fViewport [4]
 

Private Attributes

unsigned int fExportImageFormat
 

Detailed Description

Definition at line 34 of file G4OpenGL2PSAction.hh.

Constructor & Destructor Documentation

◆ G4OpenGL2PSAction()

G4OpenGL2PSAction::G4OpenGL2PSAction ( )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 36 of file G4OpenGL2PSAction.cc.

40{
41 fFile = 0;
42 fViewport[0] = 0;
43 fViewport[1] = 0;
44 fViewport[2] = 0;
45 fViewport[3] = 0;
46 fBufferSize = 2048;
50}
unsigned int fExportImageFormat
void resetBufferSizeParameters()
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
#define GL2PS_PDF
Definition: gl2ps.h:132
T max(const T t1, const T t2)
brief Return the largest of the two arguments

References fBufferSize, fBufferSizeLimit, fExportImageFormat, fFile, fViewport, GL2PS_PDF, G4INCL::Math::max(), and resetBufferSizeParameters().

Member Function Documentation

◆ disableFileWriting()

bool G4OpenGL2PSAction::disableFileWriting ( )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 122 of file G4OpenGL2PSAction.cc.

126{
127 int state = gl2psEndPage();
128 ::fclose(fFile);
129 if (state == GL2PS_OVERFLOW) {
130 return false;
131 }
132 fFile = 0;
133 return true;
134}
#define gl2psEndPage
Definition: Geant4_gl2ps.h:35
#define GL2PS_OVERFLOW
Definition: gl2ps.h:149

References fFile, GL2PS_OVERFLOW, and gl2psEndPage.

Referenced by G4OpenGLViewer::printGl2PS().

◆ enableFileWriting()

bool G4OpenGL2PSAction::enableFileWriting ( )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 107 of file G4OpenGL2PSAction.cc.

111{
112 fFile = ::fopen(fFileName,"wb");
113 if(!fFile) {
114 return false;
115 }
116
117 // No buffering for output file
118 setvbuf ( fFile , NULL , _IONBF , 2048 );
119 return G4gl2psBegin();
120}
bool G4gl2psBegin()
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

References fFile, fFileName, and G4gl2psBegin().

Referenced by G4OpenGLViewer::printGl2PS().

◆ extendBufferSize()

bool G4OpenGL2PSAction::extendBufferSize ( )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 136 of file G4OpenGL2PSAction.cc.

140{
141 // extend buffer size *2
142 if (fBufferSize < (fBufferSizeLimit/2)) {
144 return true;
145 }
146 return false;
147}

References fBufferSize, and fBufferSizeLimit.

Referenced by G4OpenGLViewer::printGl2PS().

◆ fileWritingEnabled()

bool G4OpenGL2PSAction::fileWritingEnabled ( ) const

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 158 of file G4OpenGL2PSAction.cc.

162{
163 return (fFile?true:false);
164}

References fFile.

Referenced by G4OpenGLViewer::isGl2psWriting(), and G4OpenGLViewer::printGl2PS().

◆ G4gl2psBegin()

bool G4OpenGL2PSAction::G4gl2psBegin ( )
protected

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 166 of file G4OpenGL2PSAction.cc.

170{
171 if(!fFile) return false;
172 int options =
174 int sort = GL2PS_BSP_SORT;
175
176 glGetIntegerv(GL_VIEWPORT,fViewport);
177 GLint res = gl2psBeginPage("Geant4 output","Geant4",
178 fViewport,
180 sort,
181 options,
182 GL_RGBA,0, NULL,0,0,0,
184 fFile,fFileName.c_str());
185 if (res == GL2PS_ERROR) {
186 return false;
187 }
188 // enable blending for all
190
191 return true;
192}
#define gl2psEnable
Definition: Geant4_gl2ps.h:37
#define gl2psBeginPage
Definition: Geant4_gl2ps.h:34
#define GL2PS_ERROR
Definition: gl2ps.h:147
#define GL2PS_BSP_SORT
Definition: gl2ps.h:140
#define GL2PS_BEST_ROOT
Definition: gl2ps.h:158
#define GL2PS_DRAW_BACKGROUND
Definition: gl2ps.h:155
#define GL2PS_USE_CURRENT_VIEWPORT
Definition: gl2ps.h:164
#define GL2PS_BLEND
Definition: gl2ps.h:176

References fBufferSize, fExportImageFormat, fFile, fFileName, fViewport, GL2PS_BEST_ROOT, GL2PS_BLEND, GL2PS_BSP_SORT, GL2PS_DRAW_BACKGROUND, GL2PS_ERROR, GL2PS_USE_CURRENT_VIEWPORT, gl2psBeginPage, and gl2psEnable.

Referenced by SoGL2PSAction::beginTraversal(), enableFileWriting(), and SoGL2PSAction::enableFileWriting().

◆ resetBufferSizeParameters()

void G4OpenGL2PSAction::resetBufferSizeParameters ( )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 53 of file G4OpenGL2PSAction.cc.

57{
58 fBufferSize = 2048;
59}

References fBufferSize.

Referenced by G4OpenGL2PSAction(), and G4OpenGLViewer::printGl2PS().

◆ setBufferSize()

void G4OpenGL2PSAction::setBufferSize ( int  newSize)

Definition at line 151 of file G4OpenGL2PSAction.cc.

152{
153 fBufferSize = (newSize < int(fBufferSizeLimit))
154 ? GLint(newSize) : fBufferSizeLimit;
155}

References fBufferSize, and fBufferSizeLimit.

◆ setExportImageFormat()

void G4OpenGL2PSAction::setExportImageFormat ( unsigned int  type)

Definition at line 194 of file G4OpenGL2PSAction.cc.

194 {
195 if(!fFile) {
196 fExportImageFormat = type;
197 } else {
198 // Could not change the file type at this step. Please change it before enableFileWriting()
199 }
200}

References fExportImageFormat, and fFile.

Referenced by G4OpenGLViewer::exportImage().

◆ setFileName()

void G4OpenGL2PSAction::setFileName ( const char *  aFileName)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 98 of file G4OpenGL2PSAction.cc.

103{
104 fFileName = aFileName;
105}

References fFileName.

Referenced by G4OpenGLViewer::printGl2PS(), and SoGL2PSAction::SoGL2PSAction().

◆ setLineWidth()

void G4OpenGL2PSAction::setLineWidth ( int  width)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 62 of file G4OpenGL2PSAction.cc.

67{
68 gl2psLineWidth( width );
69}
#define gl2psLineWidth
Definition: Geant4_gl2ps.h:40

References gl2psLineWidth.

Referenced by G4OpenGLViewer::ChangeLineWidth(), and G4OpenGLViewer::printGl2PS().

◆ setPointSize()

void G4OpenGL2PSAction::setPointSize ( int  size)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 72 of file G4OpenGL2PSAction.cc.

77{
78 gl2psPointSize( size );
79}
#define gl2psPointSize
Definition: Geant4_gl2ps.h:39

References gl2psPointSize.

Referenced by G4OpenGLViewer::ChangePointSize(), and G4OpenGLViewer::printGl2PS().

◆ setViewport()

void G4OpenGL2PSAction::setViewport ( int  a,
int  b,
int  winSizeX,
int  winSizeY 
)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 82 of file G4OpenGL2PSAction.cc.

90{
91 fViewport[0] = a;
92 fViewport[1] = b;
93 fViewport[2] = winSizeX;
94 fViewport[3] = winSizeY;
95}

References fViewport.

Field Documentation

◆ fBufferSize

GLint G4OpenGL2PSAction::fBufferSize
protected

◆ fBufferSizeLimit

GLint G4OpenGL2PSAction::fBufferSizeLimit
protected

Definition at line 61 of file G4OpenGL2PSAction.hh.

Referenced by extendBufferSize(), G4OpenGL2PSAction(), and setBufferSize().

◆ fExportImageFormat

unsigned int G4OpenGL2PSAction::fExportImageFormat
private

Definition at line 63 of file G4OpenGL2PSAction.hh.

Referenced by G4gl2psBegin(), G4OpenGL2PSAction(), and setExportImageFormat().

◆ fFile

FILE* G4OpenGL2PSAction::fFile
protected

◆ fFileName

G4String G4OpenGL2PSAction::fFileName
protected

◆ fViewport

GLint G4OpenGL2PSAction::fViewport[4]
protected

Definition at line 59 of file G4OpenGL2PSAction.hh.

Referenced by G4gl2psBegin(), G4OpenGL2PSAction(), and setViewport().


The documentation for this class was generated from the following files: