[834] | 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: G4AxesModel.cc,v 1.6 2006/06/29 21:32:38 gunter Exp $ |
---|
[850] | 28 | // GEANT4 tag $Name: HEAD $ |
---|
[834] | 29 | // |
---|
| 30 | // |
---|
| 31 | // John Allison 3rd April 2001 |
---|
| 32 | // Model which knows how to draw axes. |
---|
| 33 | |
---|
| 34 | #include "G4AxesModel.hh" |
---|
| 35 | |
---|
| 36 | #include "G4ModelingParameters.hh" |
---|
| 37 | #include "G4VGraphicsScene.hh" |
---|
| 38 | #include "G4VisAttributes.hh" |
---|
| 39 | #include "G4Polyline.hh" |
---|
| 40 | #include "G4Colour.hh" |
---|
| 41 | |
---|
| 42 | G4AxesModel::~G4AxesModel () {} |
---|
| 43 | |
---|
| 44 | G4AxesModel::G4AxesModel |
---|
| 45 | (G4double x0, G4double y0, G4double z0, G4double length): |
---|
| 46 | fX0(x0), fY0(y0), fZ0(z0), fLength(length) { |
---|
| 47 | fGlobalTag = "G4AxesModel"; |
---|
| 48 | fGlobalDescription = fGlobalTag; |
---|
| 49 | } |
---|
| 50 | |
---|
| 51 | void G4AxesModel::DescribeYourselfTo (G4VGraphicsScene& sceneHandler) { |
---|
| 52 | |
---|
| 53 | G4Polyline x_axis, y_axis, z_axis; |
---|
| 54 | |
---|
| 55 | G4Colour cx(1.0, 0.0, 0.0); // color for x-axis |
---|
| 56 | G4Colour cy(0.0, 1.0, 0.0); // color for y-axis |
---|
| 57 | G4Colour cz(0.0, 0.0, 1.0); // color for z-axis |
---|
| 58 | |
---|
| 59 | G4VisAttributes ax(cx); // VA for x-axis |
---|
| 60 | G4VisAttributes ay(cy); // VA for y-axis |
---|
| 61 | G4VisAttributes az(cz); // VA for z-axis |
---|
| 62 | |
---|
| 63 | sceneHandler.BeginPrimitives(); |
---|
| 64 | |
---|
| 65 | //----- Draw x-axis |
---|
| 66 | x_axis.SetVisAttributes(&ax); |
---|
| 67 | x_axis.push_back(G4Point3D(fX0,fY0,fZ0)); |
---|
| 68 | x_axis.push_back(G4Point3D((fX0 + fLength),fY0,fZ0)); |
---|
| 69 | sceneHandler.AddPrimitive(x_axis); |
---|
| 70 | |
---|
| 71 | //----- Draw y-axis |
---|
| 72 | y_axis.SetVisAttributes(&ay); |
---|
| 73 | y_axis.push_back(G4Point3D(fX0,fY0,fZ0)); |
---|
| 74 | y_axis.push_back(G4Point3D(fX0,(fY0 + fLength),fZ0)); |
---|
| 75 | sceneHandler.AddPrimitive(y_axis); |
---|
| 76 | |
---|
| 77 | //----- Draw z-axis |
---|
| 78 | z_axis.SetVisAttributes(&az); |
---|
| 79 | z_axis.push_back(G4Point3D(fX0,fY0,fZ0)); |
---|
| 80 | z_axis.push_back(G4Point3D(fX0,fY0,(fZ0 + fLength))); |
---|
| 81 | sceneHandler.AddPrimitive(z_axis); |
---|
| 82 | |
---|
| 83 | sceneHandler.EndPrimitives(); |
---|
| 84 | } |
---|