TViewerX3D.h

Go to the documentation of this file.
00001 // @(#)root/x3d:$Id: TViewerX3D.h 20882 2007-11-19 11:31:26Z rdm $
00002 // Author: Rene Brun   05/09/99
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TViewerX3D
00013 #define ROOT_TViewerX3D
00014 
00015 
00016 //////////////////////////////////////////////////////////////////////////
00017 //                                                                      //
00018 // TViewerX3D                                                           //
00019 //                                                                      //
00020 // C++ interface to the X3D viewer                                      //
00021 //                                                                      //
00022 //////////////////////////////////////////////////////////////////////////
00023 
00024 #ifndef ROOT_TX3DFrame
00025 #include "TX3DFrame.h"
00026 #endif
00027 #ifndef ROOT_TVirtualViewer3D
00028 #include "TVirtualViewer3D.h"
00029 #endif
00030 
00031 class TVirtualPad;
00032 class TGCanvas;
00033 class TGMenuBar;
00034 class TGPopupMenu;
00035 class TGLayoutHints;
00036 class TX3DContainer;
00037 
00038 class TViewerX3D : public TVirtualViewer3D
00039 {
00040 
00041 friend class TX3DContainer;
00042 
00043 private:
00044    TX3DFrame      *fMainFrame;          // the main GUI frame
00045    TString         fOption;             // option string to be passed to X3D
00046    TString         fTitle;              // viewer title
00047    Window_t        fX3DWin;             // X3D window
00048    TGCanvas       *fCanvas;             // canvas widget
00049    TX3DContainer  *fContainer;          // container containing X3D window
00050    TGMenuBar      *fMenuBar;            // menubar
00051    TGPopupMenu    *fFileMenu;           // file menu
00052    TGPopupMenu    *fHelpMenu;           // help menu
00053    TGLayoutHints  *fMenuBarLayout;      // menubar layout hints
00054    TGLayoutHints  *fMenuBarItemLayout;  // layout hints for menu in menubar
00055    TGLayoutHints  *fMenuBarHelpLayout;  // layout hint for help menu in menubar
00056    TGLayoutHints  *fCanvasLayout;       // layout for canvas widget
00057    UInt_t          fWidth;              // viewer width
00058    UInt_t          fHeight;             // viewer height
00059    Int_t           fXPos;               // viewer X position
00060    Int_t           fYPos;               // viewer Y position
00061    TVirtualPad    *fPad;                // pad we are attached to
00062    Bool_t          fBuildingScene;      // Rebuilding 3D scene
00063    enum EPass { kSize, kDraw };         // Multi-pass build : size then draw
00064    EPass           fPass;
00065 
00066    void     CreateViewer(const char *name);
00067    void     InitX3DWindow();
00068    void     DeleteX3DWindow();
00069 
00070    Bool_t   HandleContainerButton(Event_t *ev);
00071 
00072    static Bool_t fgCreated;    // TViewerX3D is a singleton
00073 
00074 public:
00075    TViewerX3D(TVirtualPad *pad);
00076    TViewerX3D(TVirtualPad *pad, Option_t *option, const char *title="X3D Viewer",
00077               UInt_t width = 800, UInt_t height = 600);
00078    TViewerX3D(TVirtualPad *pad, Option_t *option, const char *title,
00079               Int_t x, Int_t y, UInt_t width, UInt_t height);
00080    virtual ~TViewerX3D();
00081 
00082    Int_t    ExecCommand(Int_t px, Int_t py, char command);
00083    void     GetPosition(Float_t &longitude, Float_t &latitude, Float_t &psi);
00084    void     Iconify() { }
00085    void     Show() { fMainFrame->MapRaised(); }
00086    void     Close();
00087    void     Update();
00088 
00089    void     PaintPolyMarker(const TBuffer3D & buffer) const;
00090 
00091    // TVirtualViewer3D interface
00092    virtual Bool_t PreferLocalFrame() const { return kFALSE; }
00093    virtual void   BeginScene();
00094    virtual Bool_t BuildingScene()    const { return fBuildingScene; }
00095    virtual void   EndScene();
00096    virtual Int_t  AddObject(const TBuffer3D & buffer, Bool_t * addChildren = 0);
00097    virtual Int_t  AddObject(UInt_t placedID, const TBuffer3D & buffer, Bool_t * addChildren = 0);
00098 
00099    // Composite shapes not supported on this viewer currently - ignore.
00100    // Will result in a set of component shapes
00101    virtual Bool_t OpenComposite(const TBuffer3D & /*buffer*/, Bool_t * =0) { return kTRUE; }
00102    virtual void   CloseComposite() {};
00103    virtual void   AddCompositeOp(UInt_t /*operation*/) {};
00104 
00105    Bool_t   ProcessFrameMessage(Long_t msg, Long_t parm1, Long_t parm2);
00106 
00107    ClassDef(TViewerX3D,0)  //Interface to the X3D viewer
00108 };
00109 
00110 #endif

Generated on Tue Jul 5 14:19:17 2011 for ROOT_528-00b_version by  doxygen 1.5.1