12.07.2015 Views

Geant4 User's Guide for Application Developers - Geant4 - CERN

Geant4 User's Guide for Application Developers - Geant4 - CERN

Geant4 User's Guide for Application Developers - Geant4 - CERN

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Visualization#include "globals.hh"#include "G4VisExecutive.hh"#include "G4VisExtent.hh"#include "G4UImanager.hh"#include "G4UIterminal.hh"#include "G4UItcsh.hh"#include "StandaloneVisAction.hh"int main() {G4VisManager* visManager = new G4VisExecutive;visManager->Initialize ();visManager->SetUserAction(new StandaloneVisAction,G4VisExtent(-5*m,5*m,-5*m,5*m,-5*m,5*m)); // 2nd argument optional.G4UImanager* UI = G4UImanager::GetUIpointer ();UI->ApplyCommand ("/control/execute standalone.g4m");G4UIsession* session = new G4UIterminal(new G4UItcsh);session->SessionStart();delete session;delete visManager;}8.6. Visualization AttributesVisualization attributes are extra pieces of in<strong>for</strong>mation associated with the visualizable objects. This in<strong>for</strong>mationis necessary only <strong>for</strong> visualization, and is not included in geometrical in<strong>for</strong>mation such as shapes, position, andorientation. Typical examples of visualization attributes are Color, Visible/Invisible, Wireframe/Solid. For example,in visualizing a box, the Visualization Manager must know its colour. If an object to be visualized has notbeen assigned a set of visualization attributes, then an appropriate default set is used automatically.A set of visualization attributes is held by an instance of class G4VisAttributes defined in the graphics_repscategory. In the following, we explain the main fields of the G4VisAttributes one by one.8.6.1. VisibilityVisibility is a boolean flag to control the visibility of objects that are passed to the Visualization Manager <strong>for</strong>visualization. Visibility is set with the following access function:void G4VisAttributes::SetVisibility (G4bool visibility);If you give false to the argument, and if culling is activated (see below), visualization is skipped <strong>for</strong> objects <strong>for</strong>which this set of visualization attributes is assigned. The default value of visibility is true.Note that whether an object is visible or not is also affected by the current culling policy, which can be tunedwith visualization commands.By default the following public static function is defined:static const G4VisAttributes& GetInvisible();which returns a reference to a const object in which visibility is set to false. It can be used as follows:experimentalHall_logical -> SetVisAttributes (G4VisAttributes::GetInvisible());Direct access to the public static const data member G4VisAttributes::Invisible is also possible butdeprecated on account of initialisation issues with dynamic libraries.252

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!