source: trunk/source/visualization/OpenGL/src/G4OpenGLXViewerMessenger.cc@ 1218

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

en test

  • Property svn:mime-type set to text/cpp
File size: 3.6 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//
27// $Id: G4OpenGLXViewerMessenger.cc,v 1.5 2006/11/21 16:24:00 allison Exp $
28// GEANT4 tag $Name: geant4-08-02-patch-01 $
29
30#ifdef G4VIS_BUILD_OPENGLX_DRIVER
31
32#include "G4OpenGLXViewerMessenger.hh"
33
34#include "G4OpenGLXViewer.hh"
35
36#include "G4UImanager.hh"
37#include "G4UIcommand.hh"
38#include "G4UIdirectory.hh"
39#include "G4UIcmdWithoutParameter.hh"
40#include "G4UIcmdWithABool.hh"
41#include "G4VisManager.hh"
42#include <sstream>
43
44G4OpenGLXViewerMessenger* G4OpenGLXViewerMessenger::fpInstance = 0;
45
46G4OpenGLXViewerMessenger* G4OpenGLXViewerMessenger::GetInstance()
47{
48 if (!fpInstance) fpInstance = new G4OpenGLXViewerMessenger;
49 return fpInstance;
50}
51
52G4OpenGLXViewerMessenger::G4OpenGLXViewerMessenger()
53{
54 fpDirectory = new G4UIdirectory("/vis/oglx/");
55 fpDirectory->SetGuidance("G4OpenGLXViewer commands.");
56
57 fpCommandPrintEPS =
58 new G4UIcmdWithoutParameter("/vis/oglx/printEPS", this);
59 fpCommandPrintEPS->SetGuidance("Print Encapsulated PostScript file.");
60 fpCommandPrintEPS->SetGuidance
61 ("Generates files with names G4OpenGL_n.eps, where n is a sequence"
62 "\nnumber, starting at 0.");
63}
64
65G4OpenGLXViewerMessenger::~G4OpenGLXViewerMessenger ()
66{
67 delete fpCommandPrintEPS;
68 delete fpDirectory;
69}
70
71void G4OpenGLXViewerMessenger::SetNewValue
72(G4UIcommand* command, G4String)
73{
74 G4VisManager* pVisManager = G4VisManager::GetInstance();
75
76 G4VViewer* pVViewer = pVisManager->GetCurrentViewer();
77
78 if (!pVViewer) {
79 G4cout <<
80 "G4OpenGLXViewerMessenger::SetNewValue: No current viewer."
81 "\n \"/vis/open\", or similar, to get one."
82 << G4endl;
83 return;
84 }
85
86 G4OpenGLXViewer* pViewer = dynamic_cast<G4OpenGLXViewer*>(pVViewer);
87
88 if (!pViewer) {
89 G4cout <<
90 "G4OpenGLXViewerMessenger::SetNewValue: Current viewer is not of type"
91 "\n OGL*X*. This feature currently only available on X Windows."
92 << G4endl;
93 return;
94 }
95
96 if (command == fpCommandPrintEPS)
97 {
98 // Print eps file...
[948]99 pViewer->printEPS();
[529]100 }
101
102}
103
104#endif
Note: See TracBrowser for help on using the repository browser.