BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSScreenFrame.cc
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) Royal Holloway,
3University of London 2001 - 2023.
4
5This file is part of BDSIM.
6
7BDSIM is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published
9by the Free Software Foundation version 3 of the License.
10
11BDSIM is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with BDSIM. If not, see <http://www.gnu.org/licenses/>.
18*/
19#include "BDSColours.hh"
20#include "BDSGlobalConstants.hh"
21#include "BDSScreenFrame.hh"
22
23#include "G4LogicalVolume.hh"
24#include "G4VisAttributes.hh"
25
26BDSScreenFrame::BDSScreenFrame(G4String nameIn,
27 G4ThreeVector sizeIn,
28 G4TwoVector windowSizeIn,
29 G4TwoVector windowOffsetIn,
30 G4Material* materialIn):
31 name(nameIn),
32 size(sizeIn),
33 windowSize(windowSizeIn),
34 windowOffset(windowOffsetIn),
35 material(materialIn),
36 logVol(nullptr)
37{
38 checkOverlaps = BDSGlobalConstants::Instance()->CheckOverlaps();
39 SetDefaultVisAtts();
40}
41
42BDSScreenFrame::~BDSScreenFrame()
43{
44 delete logVol;
45 delete visAtt;
46}
47
49{
50 visAtt = new G4VisAttributes(BDSColours::Instance()->GetColour("screenframe"));
51 visAtt->SetForceWireframe(true);
52 visAtt->SetVisibility(true);
53}
54
55void BDSScreenFrame::SetVisAtts(G4LogicalVolume* logVolIn,
56 G4VisAttributes* visAttIn)
57{
58 if (logVolIn)
59 {
60 if (!visAttIn)
61 {logVolIn->SetVisAttributes(visAtt);}
62 else
63 {logVolIn->SetVisAttributes(visAttIn);}
64 }
65}
66
68{
69 SetVisAtts(logVol);
70}
static BDSColours * Instance()
singleton pattern
Definition: BDSColours.cc:33
static BDSGlobalConstants * Instance()
Access method.
void SetDefaultVisAtts()
Construct default visualisation attribute for light transparent grey.
virtual void SetVisAtts()
Set the visual attributes to member logVol.