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 // Class Description:
0029 //
0030 // G4VUserVisAction is brought into effect by the command
0031 // /vis/scene/add/userAction. The vis manager instantiates a
0032 // G4CallbackModel when the vis action is registered, and adds
0033 // it to the scene. The pure virtual Draw() method
0034 // is invoked whenever the viewer needs to "visit the kernel", e.g.,
0035 // to remake its graphical database, if any, or simply to refresh the
0036 // screen. It is not intended to be called directly. It is called
0037 // via the operator() which is defined to satisfy the template
0038 // G4CallbackModel<G4VUserVisAction>.
0039 //
0040 // A concrete Draw() method would normally make use of the Draw() methods
0041 // of the vis manager, e.g:
0042 //   G4VVisManager* pVisManager = G4VVisManager::GetConcreteInstance();
0043 //   if (pVisManager) {
0044 //     pVisManager->Draw(G4Box("box",2*cm,2*cm,2*cm),
0045 //                       G4VisAttributes(G4Colour(1,1,0)));
0046 //   ...
0047 // but it can also use pointers fpSceneHandler and pMP that give it
0048 // direct access to the current scene handler and modeling parameters
0049 // for more advanced use.
0050 //
0051 // See the User Guide for Application Developers.
0052 
0053 #ifndef G4VUSERVISACTION_HH
0054 #define G4VUSERVISACTION_HH
0055 
0056 class G4VGraphicsScene;
0057 class G4ModelingParameters;
0058 
0059 class G4VUserVisAction
0060 {
0061 public: // With description
0062   G4VUserVisAction(): fpSceneHandler(nullptr), fpMP(nullptr) {}
0063   virtual ~G4VUserVisAction() {}
0064   void operator()(G4VGraphicsScene& scene, const G4ModelingParameters* pMP) {
0065     fpSceneHandler = &scene;
0066     fpMP           = pMP;
0067     Draw();
0068   }
0069 protected:
0070   virtual void Draw() = 0;
0071   G4VGraphicsScene* fpSceneHandler;
0072   const G4ModelingParameters* fpMP;
0073 };
0074 
0075 #endif