00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #include "G4VMarker.hh"
00032
00033 #include "G4VisAttributes.hh"
00034
00035 G4VMarker::G4VMarker ():
00036 fPosition (G4Point3D ()),
00037 fWorldSize (0.),
00038 fScreenSize (0.),
00039 fFillStyle (noFill)
00040 {
00041
00042 }
00043
00044 G4VMarker::G4VMarker (const G4VMarker& mk):
00045 G4Visible (mk),
00046 fPosition (mk.fPosition),
00047 fWorldSize (mk.fWorldSize),
00048 fScreenSize (mk.fScreenSize),
00049 fFillStyle (mk.fFillStyle),
00050 fInfo (mk.fInfo)
00051 {}
00052
00053 G4VMarker::G4VMarker (const G4Point3D& pos):
00054 fPosition (pos),
00055 fWorldSize (0.),
00056 fScreenSize (0.),
00057 fFillStyle (noFill),
00058 fInfo (G4String())
00059 {
00060
00061 }
00062
00063 G4VMarker::~G4VMarker () {}
00064
00065 G4VMarker& G4VMarker::operator = (const G4VMarker& mk) {
00066 if (&mk == this) return *this;
00067 G4Visible::operator = (mk);
00068 fPosition = mk.fPosition;
00069 fWorldSize = mk.fWorldSize;
00070 fScreenSize = mk.fScreenSize;
00071 fFillStyle = mk.fFillStyle;
00072 fInfo = mk.fInfo;
00073 return *this;
00074 }
00075
00076 G4bool G4VMarker::operator != (const G4VMarker& mk) const {
00077 if (
00078 (G4Visible::operator != (mk)) ||
00079 (fWorldSize != mk.fWorldSize) ||
00080 (fScreenSize != mk.fScreenSize) ||
00081 (fFillStyle != mk.fFillStyle) ||
00082 !(fPosition == mk.fPosition) ||
00083 (fInfo != mk.fInfo)
00084 )
00085 return true;
00086 return false;
00087 }
00088
00089 std::ostream& operator << (std::ostream& os, const G4VMarker& marker) {
00090 os << "G4VMarker: position: " << marker.fPosition
00091 << ", world size: " << marker.fWorldSize
00092 << ", screen size: " << marker.fScreenSize << '\n'
00093 << " fill style: ";
00094 switch (marker.fFillStyle) {
00095 case G4VMarker::noFill:
00096 os << "no fill";
00097 break;
00098 case G4VMarker::hashed:
00099 os << "hashed";
00100 break;
00101 case G4VMarker::filled:
00102 os << "filled";
00103 break;
00104 default:
00105 os << "unrecognised"; break;
00106 }
00107 if (!marker.fInfo.empty()) os << "\n User information: " << marker.fInfo;
00108 os << "\n " << (const G4Visible&) marker;
00109 return os;
00110 }
00111
00112 G4VMarker::SizeType G4VMarker::GetSizeType () const {
00113 SizeType type = none;
00114 if (fWorldSize) type = world;
00115 else if (fScreenSize) type = screen;
00116 return type;
00117 }
00118
00119 void G4VMarker::SetSize (SizeType sizeType, G4double size) {
00120 fWorldSize = fScreenSize = 0.;
00121 if (sizeType == world) fWorldSize = size;
00122 else if (sizeType == screen) fScreenSize = size;
00123 }