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) BDSIM Collaboration, 2001 - 2026.
3
4This file is part of BDSIM.
5
6BDSIM is free software: you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published
8by the Free Software Foundation version 3 of the License.
9
10BDSIM is distributed in the hope that it will be useful, but
11WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with BDSIM. If not, see <http://www.gnu.org/licenses/>.
17*/
18#include "BDSColours.hh"
19#include "BDSGlobalConstants.hh"
20#include "BDSScreenFrame.hh"
21
22#include "G4LogicalVolume.hh"
23#include "G4VisAttributes.hh"
24
25BDSScreenFrame::BDSScreenFrame(G4String nameIn,
26 G4ThreeVector sizeIn,
27 G4TwoVector windowSizeIn,
28 G4TwoVector windowOffsetIn,
29 G4Material* materialIn):
30 name(nameIn),
31 size(sizeIn),
32 windowSize(windowSizeIn),
33 windowOffset(windowOffsetIn),
34 material(materialIn),
35 logVol(nullptr)
36{
37 checkOverlaps = BDSGlobalConstants::Instance()->CheckOverlaps();
38 SetDefaultVisAtts();
39}
40
41BDSScreenFrame::~BDSScreenFrame()
42{
43 delete logVol;
44 delete visAtt;
45}
46
48{
49 visAtt = new G4VisAttributes(BDSColours::Instance()->GetColour("screenframe"));
50 visAtt->SetForceWireframe(true);
51 visAtt->SetVisibility(true);
52}
53
54void BDSScreenFrame::SetVisAtts(G4LogicalVolume* logVolIn,
55 G4VisAttributes* visAttIn)
56{
57 if (logVolIn)
58 {
59 if (!visAttIn)
60 {logVolIn->SetVisAttributes(visAtt);}
61 else
62 {logVolIn->SetVisAttributes(visAttIn);}
63 }
64}
65
67{
68 SetVisAtts(logVol);
69}
static BDSColours * Instance()
singleton pattern
Definition BDSColours.cc:32
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.