Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TViewerX3D.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/x3d:$Id$
0002 // Author: Rene Brun   05/09/99
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TViewerX3D
0013 #define ROOT_TViewerX3D
0014 
0015 
0016 //////////////////////////////////////////////////////////////////////////
0017 //                                                                      //
0018 // TViewerX3D                                                           //
0019 //                                                                      //
0020 // C++ interface to the X3D viewer                                      //
0021 //                                                                      //
0022 //////////////////////////////////////////////////////////////////////////
0023 
0024 #include "TX3DFrame.h"
0025 #include "TVirtualViewer3D.h"
0026 
0027 class TVirtualPad;
0028 class TGCanvas;
0029 class TGMenuBar;
0030 class TGPopupMenu;
0031 class TGLayoutHints;
0032 class TX3DContainer;
0033 
0034 class TViewerX3D : public TVirtualViewer3D
0035 {
0036 
0037 friend class TX3DContainer;
0038 
0039 private:
0040    TX3DFrame      *fMainFrame;          // the main GUI frame
0041    TString         fOption;             // option string to be passed to X3D
0042    TString         fTitle;              // viewer title
0043    Window_t        fX3DWin;             // X3D window
0044    TGCanvas       *fCanvas;             // canvas widget
0045    TX3DContainer  *fContainer;          // container containing X3D window
0046    TGMenuBar      *fMenuBar;            // menubar
0047    TGPopupMenu    *fFileMenu;           // file menu
0048    TGPopupMenu    *fHelpMenu;           // help menu
0049    TGLayoutHints  *fMenuBarLayout;      // menubar layout hints
0050    TGLayoutHints  *fMenuBarItemLayout;  // layout hints for menu in menubar
0051    TGLayoutHints  *fMenuBarHelpLayout;  // layout hint for help menu in menubar
0052    TGLayoutHints  *fCanvasLayout;       // layout for canvas widget
0053    UInt_t          fWidth;              // viewer width
0054    UInt_t          fHeight;             // viewer height
0055    Int_t           fXPos;               // viewer X position
0056    Int_t           fYPos;               // viewer Y position
0057    TVirtualPad    *fPad;                // pad we are attached to
0058    Bool_t          fBuildingScene;      // Rebuilding 3D scene
0059    enum EPass { kSize, kDraw };         // Multi-pass build : size then draw
0060    EPass           fPass;
0061 
0062    void     CreateViewer(const char *name);
0063    void     InitX3DWindow();
0064    void     DeleteX3DWindow();
0065 
0066    Bool_t   HandleContainerButton(Event_t *ev);
0067 
0068    static Bool_t fgCreated;    // TViewerX3D is a singleton
0069 
0070 public:
0071    TViewerX3D(TVirtualPad *pad);
0072    TViewerX3D(TVirtualPad *pad, Option_t *option, const char *title="X3D Viewer",
0073               UInt_t width = 800, UInt_t height = 600);
0074    TViewerX3D(TVirtualPad *pad, Option_t *option, const char *title,
0075               Int_t x, Int_t y, UInt_t width, UInt_t height);
0076    ~TViewerX3D() override;
0077 
0078    Int_t    ExecCommand(Int_t px, Int_t py, char command);
0079    void     GetPosition(Float_t &longitude, Float_t &latitude, Float_t &psi);
0080    void     Iconify() { }
0081    void     Show() { fMainFrame->MapRaised(); }
0082    void     Close();
0083    void     Update();
0084 
0085    void     PaintPolyMarker(const TBuffer3D & buffer) const;
0086 
0087    // TVirtualViewer3D interface
0088    Bool_t PreferLocalFrame() const override { return kFALSE; }
0089    void   BeginScene() override;
0090    Bool_t BuildingScene()    const override { return fBuildingScene; }
0091    void   EndScene() override;
0092    Int_t  AddObject(const TBuffer3D & buffer, Bool_t * addChildren = nullptr) override;
0093    Int_t  AddObject(UInt_t placedID, const TBuffer3D & buffer, Bool_t * addChildren = nullptr) override;
0094 
0095    // Composite shapes not supported on this viewer currently - ignore.
0096    // Will result in a set of component shapes
0097    Bool_t OpenComposite(const TBuffer3D & /*buffer*/, Bool_t * = nullptr) override { return kTRUE; }
0098    void   CloseComposite() override {};
0099    void   AddCompositeOp(UInt_t /*operation*/) override {};
0100 
0101    Bool_t   ProcessFrameMessage(Long_t msg, Long_t parm1, Long_t parm2);
0102 
0103    ClassDefOverride(TViewerX3D,0)  //Interface to the X3D viewer
0104 };
0105 
0106 #endif