Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
SoGL2PSAction Class Reference

#include <SoGL2PSAction.h>

+ Inheritance diagram for SoGL2PSAction:

Public Member Functions

 SoGL2PSAction (const SbViewportRegion &)
 
virtual ~SoGL2PSAction ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
 
void setFileName (const std::string &)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
 
void setTitleAndProducer (const std::string &, const std::string &)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
 
void setExportImageFormat_PS ()
 
void setExportImageFormat_EPS ()
 
void setExportImageFormat_TEX ()
 
void setExportImageFormat_PDF ()
 
void setExportImageFormat_SVG ()
 
void setExportImageFormat_PGF ()
 
bool enableFileWriting ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
 
void disableFileWriting ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
 
bool addBitmap (int, int, float=0, float=0, float=0, float=0)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
 

Static Public Member Functions

static void initClass ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
 

Protected Member Functions

virtual void beginTraversal (SoNode *)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
 

Detailed Description

Definition at line 42 of file SoGL2PSAction.h.

Constructor & Destructor Documentation

◆ SoGL2PSAction()

SoGL2PSAction::SoGL2PSAction ( const SbViewportRegion & aViewPortRegion)

Definition at line 59 of file SoGL2PSAction.cc.

62:SoGLRenderAction(aViewPortRegion)
63,fContext(0)
64,fFile(0)
65,fFileName("out.pdf")
66,fTitle("title")
67,fProducer("HEPVis::SoGL2PSAction")
68,fFormat(TOOLS_GL2PS_PDF)
69//////////////////////////////////////////////////////////////////////////////
70//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
71{
72 SO_ACTION_CONSTRUCTOR(SoGL2PSAction);
73}
#define TOOLS_GL2PS_PDF
Definition gl2ps_def.h:37

Referenced by SoGL2PSAction().

◆ ~SoGL2PSAction()

SoGL2PSAction::~SoGL2PSAction ( )
virtual

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

Definition at line 76 of file SoGL2PSAction.cc.

79{
80 closeFile();
81}

Referenced by ~SoGL2PSAction().

Member Function Documentation

◆ addBitmap()

bool SoGL2PSAction::addBitmap ( int aWidth,
int aHeight,
float aXorig = 0,
float aYorig = 0,
float aXmove = 0,
float aYmove = 0 )

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

Definition at line 282 of file SoGL2PSAction.cc.

292{
293 if(!fContext) return false;
294 GLboolean valid;
295 ::glGetBooleanv(GL_CURRENT_RASTER_POSITION_VALID,&valid);
296 if(!valid) return false;
297 float pos[4];
298 ::glGetFloatv(GL_CURRENT_RASTER_POSITION,pos);
299 int xoff = -(int)(aXmove + aXorig);
300 int yoff = -(int)(aYmove + aYorig);
301 int x = (int)(pos[0] + xoff);
302 int y = (int)(pos[1] + yoff);
303 // Should clip against viewport area :
304 GLint vp[4];
305 ::glGetIntegerv(GL_VIEWPORT,vp);
306 GLsizei w = aWidth;
307 GLsizei h = aHeight;
308 if(x+w>(vp[0]+vp[2])) w = vp[0]+vp[2]-x;
309 if(y+h>(vp[1]+vp[3])) h = vp[1]+vp[3]-y;
310 int s = 3 * w * h;
311 if(s<=0) return false;
312 float* image = (float*)::malloc(s * sizeof(float));
313 if(!image) return false;
314 ::glReadPixels(x,y,w,h,GL_RGB,GL_FLOAT,image);
315 GLint status = ::tools_gl2psDrawPixels(fContext,w,h,xoff,yoff,GL_RGB,GL_FLOAT,image);
316 ::free(image);
317 return (status!=TOOLS_GL2PS_SUCCESS ? false : true);
318}
#define TOOLS_GL2PS_SUCCESS
Definition gl2ps_def.h:49

Referenced by addBitmap().

◆ beginTraversal()

void SoGL2PSAction::beginTraversal ( SoNode * aNode)
protectedvirtual

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

Definition at line 145 of file SoGL2PSAction.cc.

150{
151 if(fContext && fFile) {
152#ifdef __COIN__
153 const SbViewportRegion& vpr = getViewportRegion();
154 SoViewportRegionElement::set(getState(),vpr);
155 SbVec2s origin = vpr.getViewportOriginPixels();
156 SbVec2s size = vpr.getViewportSizePixels();
157 if(!beginPage(origin[0],origin[1],size[0],size[1])) {
158 SoDebugError::post("SoGL2PSAction::beginTraversal","beginPage() failed");
159 return;
160 }
161 traverse(aNode);
162 if(!endPage()) {
163 SoDebugError::post("SoGL2PSAction::beginTraversal","endPage() failed");
164 return;
165 }
166#else //SGI
167 SoGLRenderAction::beginTraversal(aNode);
168#endif
169 } else {
170 SoGLRenderAction::beginTraversal(aNode);
171 }
172}

Referenced by beginTraversal().

◆ disableFileWriting()

void SoGL2PSAction::disableFileWriting ( )

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

Definition at line 132 of file SoGL2PSAction.cc.

136{
137#ifdef __COIN__
138#else //SGI
139 endPage();
140#endif
141 closeFile();
142}

Referenced by disableFileWriting().

◆ enableFileWriting()

bool SoGL2PSAction::enableFileWriting ( )

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

Definition at line 108 of file SoGL2PSAction.cc.

111{
112 if(!openFile()) {
113 SoDebugError::post("SoGL2PSAction::enableFileWriting",
114 "openFile() failed for fil %s",
115 fFileName.c_str());
116 return false;
117 }
118#ifdef __COIN__
119#else //SGI
120 const SbViewportRegion& vpr = getViewportRegion();
121 SoViewportRegionElement::set(getState(),vpr);
122 SbVec2s origin = vpr.getViewportOriginPixels();
123 SbVec2s size = vpr.getViewportSizePixels();
124 if(!beginPage(origin[0],origin[1],size[0],size[1])) {
125 SoDebugError::post("SoGL2PSAction::enableFileWriting","beginPage() failed");
126 return false;
127 }
128#endif
129 return true;
130}

Referenced by enableFileWriting().

◆ initClass()

void SoGL2PSAction::initClass ( )
static

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

Definition at line 47 of file SoGL2PSAction.cc.

51{
52 static bool first = true;
53 if (first) {
54 first = false;
55 SO_ACTION_INIT_CLASS(SoGL2PSAction,SoGLRenderAction);
56 }
57}

◆ setExportImageFormat_EPS()

void SoGL2PSAction::setExportImageFormat_EPS ( )

Definition at line 101 of file SoGL2PSAction.cc.

101{fFormat = TOOLS_GL2PS_EPS;}
#define TOOLS_GL2PS_EPS
Definition gl2ps_def.h:35

Referenced by setExportImageFormat_EPS().

◆ setExportImageFormat_PDF()

void SoGL2PSAction::setExportImageFormat_PDF ( )

Definition at line 103 of file SoGL2PSAction.cc.

103{fFormat = TOOLS_GL2PS_PDF;}

Referenced by setExportImageFormat_PDF().

◆ setExportImageFormat_PGF()

void SoGL2PSAction::setExportImageFormat_PGF ( )

Definition at line 105 of file SoGL2PSAction.cc.

105{fFormat = TOOLS_GL2PS_PGF;}
#define TOOLS_GL2PS_PGF
Definition gl2ps_def.h:39

Referenced by setExportImageFormat_PGF().

◆ setExportImageFormat_PS()

void SoGL2PSAction::setExportImageFormat_PS ( )

Definition at line 100 of file SoGL2PSAction.cc.

100{fFormat = TOOLS_GL2PS_PS;}
#define TOOLS_GL2PS_PS
Definition gl2ps_def.h:34

Referenced by setExportImageFormat_PS().

◆ setExportImageFormat_SVG()

void SoGL2PSAction::setExportImageFormat_SVG ( )

Definition at line 104 of file SoGL2PSAction.cc.

104{fFormat = TOOLS_GL2PS_SVG;}
#define TOOLS_GL2PS_SVG
Definition gl2ps_def.h:38

Referenced by setExportImageFormat_SVG().

◆ setExportImageFormat_TEX()

void SoGL2PSAction::setExportImageFormat_TEX ( )

Definition at line 102 of file SoGL2PSAction.cc.

102{fFormat = TOOLS_GL2PS_TEX;}
#define TOOLS_GL2PS_TEX
Definition gl2ps_def.h:36

Referenced by setExportImageFormat_TEX().

◆ setFileName()

void SoGL2PSAction::setFileName ( const std::string & aFileName)

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

Definition at line 84 of file SoGL2PSAction.cc.

87{
88 fFileName = aFileName;
89}

Referenced by setFileName().

◆ setTitleAndProducer()

void SoGL2PSAction::setTitleAndProducer ( const std::string & aTitle,
const std::string & aProducer )

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

Definition at line 92 of file SoGL2PSAction.cc.

95{
96 fTitle = aTitle;
97 fProducer = aProducer;
98}

Referenced by setTitleAndProducer().


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