G4VMarker.cc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id$
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   // fInfo: default initialisation.
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   // fInfo: default initialisation.
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 }

Generated on Mon May 27 17:50:17 2013 for Geant4 by  doxygen 1.4.7