Geant4-11
G4PlotterModel.cc
Go to the documentation of this file.
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// Guy Barrand 25th September 2021
27
28#include "G4PlotterModel.hh"
29
30#include "G4VGraphicsScene.hh"
31
32G4PlotterModel::G4PlotterModel(G4Plotter& a_plotter,const G4String& description,const G4Transform3D& a_transform)
33:fPlotter(a_plotter),fTransform(a_transform)
34{
35 fType = "G4PlotterModel";
37 fGlobalDescription = fType + ": " + description;
38 // Have the extent so that the viewer will have an ortho camera
39 // with a height of 1 in order to map the tools::sg::plots height of 1:
40 // radius = sqrt(half_x*half_x+half_y*half_y+half_z*half_z);
41 // radius = sqrt(3*half*half)
42 // half = sqrt(radius*radius/3)
43 double radius = 0.5;
44 double half = ::sqrt(radius*radius/3.0);
45 fExtent = G4VisExtent(-half,half,-half,half,-half,half); //x,y,z min/max.
46}
47
49{
50 sceneHandler.BeginPrimitives(fTransform);
51 sceneHandler.AddPrimitive(fPlotter);
52 sceneHandler.EndPrimitives();
53}
void DescribeYourselfTo(G4VGraphicsScene &) override
G4Plotter & fPlotter
G4PlotterModel(G4Plotter &plotter, const G4String &global_description="", const G4Transform3D &transform=G4Transform3D())
G4Transform3D fTransform
virtual void BeginPrimitives(const G4Transform3D &objectTransformation=G4Transform3D())=0
virtual void AddPrimitive(const G4Polyline &)=0
virtual void EndPrimitives()=0
G4VisExtent fExtent
Definition: G4VModel.hh:101
G4String fGlobalDescription
Definition: G4VModel.hh:100
G4String fType
Definition: G4VModel.hh:98
G4String fGlobalTag
Definition: G4VModel.hh:99