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: G4VMarker.cc,v 1.12 2009/02/24 10:58:04 allison Exp $ |
---|
28 | // GEANT4 tag $Name: $ |
---|
29 | // |
---|
30 | // |
---|
31 | |
---|
32 | #include "G4VMarker.hh" |
---|
33 | |
---|
34 | #include "G4VisAttributes.hh" |
---|
35 | |
---|
36 | G4VMarker::G4VMarker (): |
---|
37 | fPosition (G4Point3D ()), |
---|
38 | fWorldSize (0.), |
---|
39 | fScreenSize (0.), |
---|
40 | fFillStyle (noFill), |
---|
41 | fInfo (G4String()) |
---|
42 | {} |
---|
43 | |
---|
44 | G4VMarker::G4VMarker (const G4Point3D& pos): |
---|
45 | fPosition (pos), |
---|
46 | fWorldSize (0.), |
---|
47 | fScreenSize (0.), |
---|
48 | fFillStyle (noFill), |
---|
49 | fInfo (G4String()) |
---|
50 | {} |
---|
51 | |
---|
52 | G4VMarker::~G4VMarker () {} |
---|
53 | |
---|
54 | G4bool G4VMarker::operator != (const G4VMarker& m) const { |
---|
55 | if ( |
---|
56 | (G4Visible::operator != (m)) || |
---|
57 | (fWorldSize != m.fWorldSize) || |
---|
58 | (fScreenSize != m.fScreenSize) || |
---|
59 | (fFillStyle != m.fFillStyle) || |
---|
60 | !(fPosition == m.fPosition) |
---|
61 | ) |
---|
62 | return true; |
---|
63 | return false; |
---|
64 | } |
---|
65 | |
---|
66 | std::ostream& operator << (std::ostream& os, const G4VMarker& marker) { |
---|
67 | os << "G4VMarker: position: " << marker.fPosition |
---|
68 | << ", world size: " << marker.fWorldSize |
---|
69 | << ", screen size: " << marker.fScreenSize << '\n' |
---|
70 | << " fill style: "; |
---|
71 | switch (marker.fFillStyle) { |
---|
72 | case G4VMarker::noFill: |
---|
73 | os << "no fill"; |
---|
74 | break; |
---|
75 | case G4VMarker::hashed: |
---|
76 | os << "hashed"; |
---|
77 | break; |
---|
78 | case G4VMarker::filled: |
---|
79 | os << "filled"; |
---|
80 | break; |
---|
81 | default: |
---|
82 | os << "unrecognised"; break; |
---|
83 | } |
---|
84 | os << "\n " << (const G4Visible&) marker; |
---|
85 | return os; |
---|
86 | } |
---|
87 | |
---|
88 | G4VMarker::SizeType G4VMarker::GetSizeType () const { |
---|
89 | SizeType type = none; |
---|
90 | if (fWorldSize) type = world; |
---|
91 | else if (fScreenSize) type = screen; |
---|
92 | return type; |
---|
93 | } |
---|
94 | |
---|
95 | void G4VMarker::SetSize (SizeType sizeType, G4double size) { |
---|
96 | fWorldSize = fScreenSize = 0.; |
---|
97 | if (sizeType == world) fWorldSize = size; |
---|
98 | else if (sizeType == screen) fScreenSize = size; |
---|
99 | } |
---|