source: trunk/source/visualization/OpenInventor/src/SoGL2PSAction.cc@ 928

Last change on this file since 928 was 928, checked in by garnier, 17 years ago

ok for OI

  • Property svn:mime-type set to text/cpp
File size: 4.9 KB
RevLine 
[529]1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26#ifdef G4VIS_BUILD_OI_DRIVER
27
28/*----------------------------HEPVis----------------------------------------*/
29/* */
30/* Node: SoGL2PSAction */
31/* Author: Guy Barrand */
32/* */
33/*--------------------------------------------------------------------------*/
34
[925]35#define G4DEBUG_VIS_OGL 1
36
[529]37// this :
38#include <HEPVis/actions/SoGL2PSAction.h>
39
40// Inventor :
41#include <Inventor/elements/SoViewportRegionElement.h>
42#include <Inventor/errors/SoDebugError.h>
43
[923]44#include "Geant4_gl2ps.h"
[529]45
46#include <stdio.h>
47
48SO_ACTION_SOURCE(SoGL2PSAction)
49//////////////////////////////////////////////////////////////////////////////
50void SoGL2PSAction::initClass(
51)
52//////////////////////////////////////////////////////////////////////////////
53//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
54{
[925]55#ifdef G4DEBUG_VIS_OGL
56 printf("SoGL2PSAction::initClass\n");
57#endif
[529]58 SO_ACTION_INIT_CLASS(SoGL2PSAction,SoGLRenderAction);
59}
60//////////////////////////////////////////////////////////////////////////////
61SoGL2PSAction::SoGL2PSAction(
62 const SbViewportRegion& aViewPortRegion
63)
64:SoGLRenderAction(aViewPortRegion)
[921]65,G4OpenGL2PSAction()
[529]66//////////////////////////////////////////////////////////////////////////////
67//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
68{
[925]69#ifdef G4DEBUG_VIS_OGL
70 printf("SoGL2PSAction::SoGL2PSAction\n");
71#endif
72 setFileName("out.ps");
[529]73 SO_ACTION_CONSTRUCTOR(SoGL2PSAction);
74}
[926]75
[927]76bool SoGL2PSAction::enableFileWriting(
[926]77)
[529]78//////////////////////////////////////////////////////////////////////////////
[926]79//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
80{
81 fFile = ::fopen(fFileName,"w");
82 if(!fFile) {
83 SoDebugError::post("SoGL2PSAction::enableFileWriting",
84 "Cannot open file %s",fFileName);
[927]85 return false;
[926]86 }
87#ifdef __COIN__
88#else //SGI
89 const SbViewportRegion& vpr = getViewportRegion();
90 SoViewportRegionElement::set(getState(),vpr);
[928]91 G4gl2psBegin();
[926]92#endif
[927]93 return true;
[926]94}
95//////////////////////////////////////////////////////////////////////////////
[928]96void SoGL2PSAction::disableFileWriting(
[529]97)
98//////////////////////////////////////////////////////////////////////////////
99//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
100{
101#ifdef __COIN__
102#else //SGI
[928]103 gl2psEndPage();
[529]104#endif
[928]105 ::fclose(fFile);
106 fFile = 0;
[529]107}
[928]108
[529]109//////////////////////////////////////////////////////////////////////////////
110void SoGL2PSAction::beginTraversal(
111 SoNode* aNode
112)
113//////////////////////////////////////////////////////////////////////////////
114//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
115{
116 if(fFile) {
117#ifdef __COIN__
118 const SbViewportRegion& vpr = getViewportRegion();
119 SoViewportRegionElement::set(getState(),vpr);
[923]120 G4gl2psBegin();
[529]121 traverse(aNode);
[928]122 gl2psEndPage();
[529]123#else //SGI
[928]124 // Should have already do G4gl2psBegin() before
[529]125 SoGLRenderAction::beginTraversal(aNode);
[928]126 // Should do gl2psEndPage() after
[529]127#endif
128 } else {
129 SoGLRenderAction::beginTraversal(aNode);
130 }
131}
132
133#endif
Note: See TracBrowser for help on using the repository browser.