library: libX3d #include "TViewerX3D.h"

# TViewerX3D

class description - source file - inheritance tree (.pdf)

## class TViewerX3D : public TVirtualViewer3D, public TGMainFrame

| Inheritance Chart:
`TVirtualViewer3D`
`TObject`
| <- | `TGObject`
| <- | `TGWindow`
`TQObject`
| <- | `TGFrame`
| <- | `TGCompositeFrame`
| <- | `TGMainFrame`
| <- | `TViewerX3D` |

        private:

            void CreateViewer(const char* name)
            void DeleteX3DWindow()
          Bool_t HandleContainerButton(Event_t* ev)
            void InitX3DWindow()

        public:

                          TViewerX3D(TVirtualPad* pad)
                          TViewerX3D(TVirtualPad* pad, Option_t* option, const char* title = "X3D Viewer", UInt_t width = 800, UInt_t height = 600)
                          TViewerX3D(TVirtualPad* pad, Option_t* option, const char* title, Int_t x, Int_t y, UInt_t width, UInt_t height)
                          TViewerX3D(const TViewerX3D&)
                  virtual ~TViewerX3D()
             virtual void AddCompositeOp(UInt_t)
            virtual Int_t AddObject(const TBuffer3D& buffer, Bool_t* addChildren = 0)
            virtual Int_t AddObject(UInt_t placedID, const TBuffer3D& buffer, Bool_t* addChildren = 0)
             virtual void BeginScene()
           virtual Bool_t BuildingScene() const
           static TClass* Class()
             virtual void CloseComposite()
             virtual void CloseWindow()
             virtual void EndScene()
                    Int_t ExecCommand(Int_t px, Int_t py, char command)
                     void GetPosition(Float_t& longitude, Float_t& latitude, Float_t& psi)
                     void Iconify()
          virtual TClass* IsA() const
           virtual Bool_t OpenComposite(const TBuffer3D&, Bool_t* = 0)
                     void PaintPolyMarker(const TBuffer3D& buffer) const
           virtual Bool_t PreferLocalFrame() const
           virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
                     void Show()
             virtual void ShowMembers(TMemberInspector& insp, char* parent)
             virtual void Streamer(TBuffer& b)
                     void StreamerNVirtual(TBuffer& b)
                     void Update()

### Data Members

        private:

                    TString fOption             option string to be passed to X3D
                    TString fTitle              viewer title
                   Window_t fX3DWin             X3D window
                  TGCanvas* fCanvas             canvas widget
             TX3DContainer* fContainer          container containing X3D window
                 TGMenuBar* fMenuBar            menubar
               TGPopupMenu* fFileMenu           file menu
               TGPopupMenu* fHelpMenu           help menu
             TGLayoutHints* fMenuBarLayout      menubar layout hints
             TGLayoutHints* fMenuBarItemLayout  layout hints for menu in menubar
             TGLayoutHints* fMenuBarHelpLayout  layout hint for help menu in menubar
             TGLayoutHints* fCanvasLayout       layout for canvas widget
                     UInt_t fWidth              viewer width
                     UInt_t fHeight             viewer height
                      Int_t fXPos               viewer X position
                      Int_t fYPos               viewer Y position
               TVirtualPad* fPad                pad we are attached to
                     Bool_t fBuildingScene      Rebuilding 3D scene
          TViewerX3D::EPass fPass
              static Bool_t fgCreated           TViewerX3D is a singleton

        public:

          static const TViewerX3D::EPass kSize
          static const TViewerX3D::EPass kDraw

## Class Description

     TViewerX3D

     C++ interface to the X3D viewer

TViewerX3D(TVirtualPad *pad) : TVirtualViewer3D(), TGMainFrame(gClient->GetRoot(), 800, 600), fCanvas(0), fContainer(0), fMenuBar(0), fFileMenu(0), fHelpMenu(0), fMenuBarLayout(0), fMenuBarItemLayout(0), fMenuBarHelpLayout(0), fCanvasLayout(0), fPad(pad), fBuildingScene(kFALSE), fPass(kSize)

     Create ROOT X3D viewer.

TViewerX3D(TVirtualPad *pad, Option_t *option, const char *title, UInt_t width, UInt_t height) : TVirtualViewer3D(), TGMainFrame(gClient->GetRoot(), width, height), fCanvas(0), fContainer(0), fMenuBar(0), fFileMenu(0), fHelpMenu(0), fMenuBarLayout(0), fMenuBarItemLayout(0), fMenuBarHelpLayout(0), fCanvasLayout(0), fPad(pad), fBuildingScene(kFALSE), fPass(kSize)

     Create ROOT X3D viewer.

TViewerX3D(TVirtualPad *pad, Option_t *option, const char *title, Int_t x, Int_t y, UInt_t width, UInt_t height) : TVirtualViewer3D(), TGMainFrame(gClient->GetRoot(), width, height), fCanvas(0), fContainer(0), fMenuBar(0), fFileMenu(0), fHelpMenu(0), fMenuBarLayout(0), fMenuBarItemLayout(0), fMenuBarHelpLayout(0), fCanvasLayout(0), fPad(pad), fBuildingScene(kFALSE), fPass(kSize)

     Create ROOT X3D viewer.

~TViewerX3D()

     Delete ROOT X3D viewer.

void CloseWindow()

void CreateViewer(const char *name)

     Create the actual canvas.

void InitX3DWindow()

     Setup geometry and initialize X3D.

void BeginScene()

     The x3d viewer cannot rebuild a scene once created

void EndScene()

     The x3d viewer cannot rebuild a scene once created

Int_t AddObject(const TBuffer3D & buffer, Bool_t * addChildren)

     The x3d viewer cannot rebuild a scene once created

Int_t AddObject(UInt_t /* placedID */, const TBuffer3D & buffer, Bool_t * addChildren)

     We don't support placed IDs - discard

void PaintPolyMarker(const TBuffer3D & buffer) const

Int_t ExecCommand(Int_t px, Int_t py, char command)

     This function may be called from a script to animate an X3D picture
     px, py  mouse position
    command = 0       --- move to px,py
            = w       --- wireframe mode
            = e       --- hidden line mode
            = r       --- hidden surface mode
            = u       --- move object down
            = i       --- move object up
            = o       --- toggle controls style
            = s       --- toggle stereo display
            = d       --- toggle blue stereo view
            = f       --- toggle double buffer
            = h       --- move object right
            = j       --- move object forward
            = k       --- move object backward
            = l       --- move object left
            = x a     --- rotate about x
            = y b     --- rotate about y
            = z c     --- rotate about z
            = 1 2 3   --- autorotate about x
            = 4 5 6   --- autorotate about y
            = 7 8 9   --- autorotate about z
            = [ ] { } --- adjust focus
     Example:

void GetPosition(Float_t &longitude, Float_t &latitude, Float_t &psi)

void DeleteX3DWindow()

     Close X3D window.

void Update()

     Update X3D viewer.

Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t)

     Handle menu and other command generated by the user.

Bool_t HandleContainerButton(Event_t * /*ev */ )

     After button release get current position and update associated pad.

### Inline Functions

                   void Iconify()
                   void Show()
                 Bool_t PreferLocalFrame() const
                 Bool_t BuildingScene() const
                 Bool_t OpenComposite(const TBuffer3D&, Bool_t* = 0)
                   void CloseComposite()
                   void AddCompositeOp(UInt_t)
                TClass* Class()
                TClass* IsA() const
                   void ShowMembers(TMemberInspector& insp, char* parent)
                   void Streamer(TBuffer& b)
                   void StreamerNVirtual(TBuffer& b)
             TViewerX3D TViewerX3D(const TViewerX3D&)

Author: Rene Brun 05/09/99
Last update: root/x3d:$Name: $:$Id: TViewerX3D.cxx,v 1.14 2005/03/16 17:18:13 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *