Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:59:28

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 //
0027 
0028 // Base class for visualization commands - John Allison  9th August 1998
0029 // It is really a messenger - we have one command per messenger.
0030 
0031 #ifndef G4VVISCOMMAND_HH
0032 #define G4VVISCOMMAND_HH
0033 
0034 #include "G4VisManager.hh"
0035 #include "G4UImessenger.hh"
0036 #include "G4ThreeVector.hh"
0037 #include "G4Text.hh"
0038 #include "G4VisAttributes.hh"
0039 #include "G4VMarker.hh"
0040 #include "G4ModelingParameters.hh"
0041 #include "G4PhysicalVolumesSearchScene.hh"
0042 #include "G4SceneTreeItem.hh"
0043 
0044 #include <vector>
0045 
0046 class G4UIcommand;
0047 class G4UIcmdWithAString;
0048 
0049 class G4VVisCommand: public G4UImessenger
0050 {
0051 public:
0052   
0053   // Uses compiler defaults for copy constructor and assignment.
0054   G4VVisCommand ();
0055   virtual ~G4VVisCommand ();
0056 
0057   static G4VisManager* GetVisManager ();
0058 
0059   static void SetVisManager (G4VisManager* pVisManager);
0060 
0061   static const G4Colour& GetCurrentTextColour();
0062 
0063 protected:
0064 
0065   // Utility functions
0066 
0067   void SetViewParameters(G4VViewer* viewer, const G4ViewParameters& viewParams);
0068 
0069   void RefreshIfRequired(G4VViewer* viewer);
0070 
0071   void InterpolateViews
0072   (G4VViewer* currentViewer,
0073    std::vector<G4ViewParameters> viewVector,
0074    const G4int nInterpolationPoints = 50,
0075    const G4int waitTimePerPointmilliseconds = 20,
0076    const G4String exportString = "");
0077 
0078   void InterpolateToNewView
0079   (G4VViewer* currentViewer,
0080    const G4ViewParameters& oldVP,
0081    const G4ViewParameters& newVP,
0082    const G4int nInterpolationPoints = 50,
0083    const G4int waitTimePerPointmilliseconds = 20,
0084    const G4String exportString = "");
0085 
0086   void Twinkle
0087   // Twinkles the touchables in paths
0088   // /vis/viewer/centreOn to see its effect
0089   (G4VViewer* currentViewer,
0090    const G4ViewParameters& baseVP,
0091    const std::vector<std::vector<G4PhysicalVolumeModel::G4PhysicalVolumeNodeID>>& paths);
0092 
0093   // Conversion routines augmenting those in G4UIcommand.
0094 
0095   static G4String ConvertToString(G4double x, G4double y,
0096                   const char * unitName);
0097 
0098   static G4bool ConvertToDoublePair(const G4String& paramString,
0099                                     G4double& xval,
0100                                     G4double& yval);
0101   // Return false if problem parsing paramString.
0102 
0103   const G4String& ConvertToColourGuidance();
0104   void ConvertToColour
0105   (G4Colour& colour,
0106    const G4String& redOrString,
0107    G4double green,
0108    G4double blue,
0109    G4double opacity);
0110   // Note: colour is supplied by the caller and becomes the default if the
0111   // remaining parameters cannot be parsed.
0112   // Note: redOrString is either a number or string.  If a string it must be
0113   // one of the recognised colours.
0114   // Thus the arguments can be, for example:
0115   // (colour,"red",...,...,0.5): will give the colour red with opacity 0.5 (the
0116   // third and fourth arguments are ignored), or
0117   // (1.,0.,0.,0.5): this also will be red with opacity 0.5.
0118 
0119   G4bool ProvideValueOfUnit
0120   (const G4String& where,
0121    const G4String& unit,
0122    const G4String& category,
0123    G4double& value);
0124   // Return false if there's a problem
0125 
0126   void CopyCameraParameters
0127   (G4ViewParameters& target, const G4ViewParameters& from);
0128   // Copy view parameters pertaining only to camera
0129 
0130   // Other utilities
0131 
0132   void CheckSceneAndNotifyHandlers (G4Scene* = nullptr);
0133 
0134   G4bool CheckView();  // False if not valid
0135 
0136   void G4VisCommandsSceneAddUnsuccessful(G4VisManager::Verbosity verbosity);
0137 
0138   void CopyGuidanceFrom
0139   (const G4UIcommand* fromCmd, G4UIcommand* toCmd, G4int startLine = 0);
0140 
0141   void CopyParametersFrom
0142   (const G4UIcommand* fromCmd, G4UIcommand* toCmd);
0143 
0144   void DrawExtent(const G4VisExtent&);
0145 
0146   // Data members
0147 
0148   static G4VisManager* fpVisManager;
0149 
0150   // Current quantities for use in appropriate commands
0151   static G4int fCurrentArrow3DLineSegmentsPerCircle;
0152   static G4Colour                   fCurrentColour;
0153   static G4double                   fCurrentLineWidth;
0154   //static G4VisAttributes::LineStyle fCurrentLineStyle;  Not yet used.
0155   //static G4VMarker::FillStyle       fCurrentFillStyle;  Not yet used.
0156   //static G4VMarker::SizeType        fCurrentSizeType;  Not yet used.
0157   static G4Colour                   fCurrentTextColour;
0158   static G4Text::Layout             fCurrentTextLayout;
0159   static G4double                   fCurrentTextSize;
0160   static G4PhysicalVolumeModel::TouchableProperties fCurrentTouchableProperties;
0161   static G4VisExtent                fCurrentExtentForField;
0162   static std::vector<G4PhysicalVolumesSearchScene::Findings> fCurrrentPVFindingsForField;
0163 
0164   // When we create a new viewer we would like to use the view parameters of
0165   // the existing viewer if there was one. This has to be checked at the
0166   // creation of a new viewer and *also* at the creation of a new scene
0167   // handler.
0168   static G4bool fThereWasAViewer;  // True if there was a viewer
0169   static G4ViewParameters fExistingVP;  // Its view parameters
0170   static G4SceneTreeItem fExistingSceneTree;  // Its scene tree
0171 };
0172 
0173 #endif