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 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  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 
 28 // Base class for visualization commands - John Allison  9th August 1998
 29 // It is really a messenger - we have one command per messenger.
 30 
 31 #ifndef G4VVISCOMMAND_HH
 32 #define G4VVISCOMMAND_HH
 33 
 34 #include "G4VisManager.hh"
 35 #include "G4UImessenger.hh"
 36 #include "G4ThreeVector.hh"
 37 #include "G4Text.hh"
 38 #include "G4VisAttributes.hh"
 39 #include "G4VMarker.hh"
 40 #include "G4ModelingParameters.hh"
 41 #include "G4PhysicalVolumesSearchScene.hh"
 42 #include "G4SceneTreeItem.hh"
 43 
 44 #include <vector>
 45 
 46 class G4UIcommand;
 47 class G4UIcmdWithAString;
 48 
 49 class G4VVisCommand: public G4UImessenger
 50 {
 51 public:
 52   
 53   // Uses compiler defaults for copy constructor and assignment.
 54   G4VVisCommand ();
 55   virtual ~G4VVisCommand ();
 56 
 57   static G4VisManager* GetVisManager ();
 58 
 59   static void SetVisManager (G4VisManager* pVisManager);
 60 
 61   static const G4Colour& GetCurrentTextColour();
 62 
 63 protected:
 64 
 65   // Utility functions
 66 
 67   void SetViewParameters(G4VViewer* viewer, const G4ViewParameters& viewParams);
 68 
 69   void RefreshIfRequired(G4VViewer* viewer);
 70 
 71   void InterpolateViews
 72   (G4VViewer* currentViewer,
 73    const std::vector<G4ViewParameters>& viewVector,
 74    const G4int nInterpolationPoints = 50,
 75    const G4int waitTimePerPointmilliseconds = 20,
 76    const G4String& exportString = "");
 77 
 78   void InterpolateToNewView
 79   (G4VViewer* currentViewer,
 80    const G4ViewParameters& oldVP,
 81    const G4ViewParameters& newVP,
 82    const G4int nInterpolationPoints = 50,
 83    const G4int waitTimePerPointmilliseconds = 20,
 84    const G4String& exportString = "");
 85 
 86   void Twinkle
 87   // Twinkles the touchables in paths
 88   // /vis/viewer/centreOn to see its effect
 89   (G4VViewer* currentViewer,
 90    const G4ViewParameters& baseVP,
 91    const std::vector<std::vector<G4PhysicalVolumeModel::G4PhysicalVolumeNodeID>>& paths);
 92 
 93   // Conversion routines augmenting those in G4UIcommand.
 94 
 95   static G4String ConvertToString(G4double x, G4double y,
 96           const char * unitName);
 97 
 98   static G4bool ConvertToDoublePair(const G4String& paramString,
 99                                     G4double& xval,
100                                     G4double& yval);
101   // Return false if problem parsing paramString.
102 
103   const G4String& ConvertToColourGuidance();
104   void ConvertToColour
105   (G4Colour& colour,
106    const G4String& redOrString,
107    G4double green,
108    G4double blue,
109    G4double opacity);
110   // Note: colour is supplied by the caller and becomes the default if the
111   // remaining parameters cannot be parsed.
112   // Note: redOrString is either a number or string.  If a string it must be
113   // one of the recognised colours.
114   // Thus the arguments can be, for example:
115   // (colour,"red",...,...,0.5): will give the colour red with opacity 0.5 (the
116   // third and fourth arguments are ignored), or
117   // (1.,0.,0.,0.5): this also will be red with opacity 0.5.
118 
119   G4bool ProvideValueOfUnit
120   (const G4String& where,
121    const G4String& unit,
122    const G4String& category,
123    G4double& value);
124   // Return false if there's a problem
125 
126   void CopyCameraParameters
127   (G4ViewParameters& target, const G4ViewParameters& from);
128   // Copy view parameters pertaining only to camera
129 
130   // Other utilities
131 
132   void CheckSceneAndNotifyHandlers (G4Scene* = nullptr);
133 
134   G4bool CheckView();  // False if not valid
135 
136   void G4VisCommandsSceneAddUnsuccessful(G4VisManager::Verbosity verbosity);
137 
138   void CopyGuidanceFrom
139   (const G4UIcommand* fromCmd, G4UIcommand* toCmd, G4int startLine = 0);
140 
141   void CopyParametersFrom
142   (const G4UIcommand* fromCmd, G4UIcommand* toCmd);
143 
144   void DrawExtent(const G4VisExtent&);
145 
146   // Data members
147 
148   static G4VisManager* fpVisManager;
149 
150   // Current quantities for use in appropriate commands
151   static G4int fCurrentArrow3DLineSegmentsPerCircle;
152   static G4Colour                   fCurrentColour;
153   static G4double                   fCurrentLineWidth;
154   //static G4VisAttributes::LineStyle fCurrentLineStyle;  Not yet used.
155   //static G4VMarker::FillStyle       fCurrentFillStyle;  Not yet used.
156   //static G4VMarker::SizeType        fCurrentSizeType;  Not yet used.
157   static G4Colour                   fCurrentTextColour;
158   static G4Text::Layout             fCurrentTextLayout;
159   static G4double                   fCurrentTextSize;
160   static G4PhysicalVolumeModel::TouchableProperties fCurrentTouchableProperties;
161   static G4VisExtent                fCurrentExtentForField;
162   static std::vector<G4PhysicalVolumesSearchScene::Findings> fCurrrentPVFindingsForField;
163 
164   // When we create a new viewer we would like to use the view parameters of
165   // the existing viewer if there was one. This has to be checked at the
166   // creation of a new viewer and *also* at the creation of a new scene
167   // handler.
168   static G4bool fThereWasAViewer;  // True if there was a viewer
169   static G4ViewParameters fExistingVP;  // Its view parameters
170   static G4SceneTreeItem fExistingSceneTree;  // Its scene tree
171 };
172 
173 #endif
174