Logo ROOT  
Reference Guide
TViewerX3D.h
Go to the documentation of this file.
1// @(#)root/x3d:$Id$
2// Author: Rene Brun 05/09/99
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TViewerX3D
13#define ROOT_TViewerX3D
14
15
17// //
18// TViewerX3D //
19// //
20// C++ interface to the X3D viewer //
21// //
23
24#include "TX3DFrame.h"
25#include "TVirtualViewer3D.h"
26
27class TVirtualPad;
28class TGCanvas;
29class TGMenuBar;
30class TGPopupMenu;
31class TGLayoutHints;
32class TX3DContainer;
33
35{
36
37friend class TX3DContainer;
38
39private:
40 TX3DFrame *fMainFrame; // the main GUI frame
41 TString fOption; // option string to be passed to X3D
42 TString fTitle; // viewer title
43 Window_t fX3DWin; // X3D window
44 TGCanvas *fCanvas; // canvas widget
45 TX3DContainer *fContainer; // container containing X3D window
46 TGMenuBar *fMenuBar; // menubar
47 TGPopupMenu *fFileMenu; // file menu
48 TGPopupMenu *fHelpMenu; // help menu
49 TGLayoutHints *fMenuBarLayout; // menubar layout hints
50 TGLayoutHints *fMenuBarItemLayout; // layout hints for menu in menubar
51 TGLayoutHints *fMenuBarHelpLayout; // layout hint for help menu in menubar
52 TGLayoutHints *fCanvasLayout; // layout for canvas widget
53 UInt_t fWidth; // viewer width
54 UInt_t fHeight; // viewer height
55 Int_t fXPos; // viewer X position
56 Int_t fYPos; // viewer Y position
57 TVirtualPad *fPad; // pad we are attached to
58 Bool_t fBuildingScene; // Rebuilding 3D scene
59 enum EPass {
60// clang++ <v20 (-Wshadow) complains about shadowing TStructNode.h global enum EScalingType. Let's silence warning:
61#if defined(__clang__) && __clang_major__ < 20
62#pragma clang diagnostic push
63#pragma clang diagnostic ignored "-Wshadow"
64#endif
66#if defined(__clang__) && __clang_major__ < 20
67#pragma clang diagnostic pop
68#endif
69 kDraw }; // Multi-pass build : size then draw
71
72 void CreateViewer(const char *name);
73 void InitX3DWindow();
74 void DeleteX3DWindow();
75
77
78 static Bool_t fgCreated; // TViewerX3D is a singleton
79
80public:
82 TViewerX3D(TVirtualPad *pad, Option_t *option, const char *title="X3D Viewer",
83 UInt_t width = 800, UInt_t height = 600);
84 TViewerX3D(TVirtualPad *pad, Option_t *option, const char *title,
86 ~TViewerX3D() override;
87
88 Int_t ExecCommand(Int_t px, Int_t py, char command);
89 void GetPosition(Float_t &longitude, Float_t &latitude, Float_t &psi);
90 void Iconify() { }
91 void Show() { fMainFrame->MapRaised(); }
92 void Close();
93 void Update();
94
95 void PaintPolyMarker(const TBuffer3D & buffer) const;
96
97 // TVirtualViewer3D interface
98 Bool_t PreferLocalFrame() const override { return kFALSE; }
99 void BeginScene() override;
100 Bool_t BuildingScene() const override { return fBuildingScene; }
101 void EndScene() override;
102 Int_t AddObject(const TBuffer3D & buffer, Bool_t * addChildren = nullptr) override;
103 Int_t AddObject(UInt_t placedID, const TBuffer3D & buffer, Bool_t * addChildren = nullptr) override;
104
105 // Composite shapes not supported on this viewer currently - ignore.
106 // Will result in a set of component shapes
107 Bool_t OpenComposite(const TBuffer3D & /*buffer*/, Bool_t * = nullptr) override { return kTRUE; }
108 void CloseComposite() override {};
109 void AddCompositeOp(UInt_t /*operation*/) override {};
110
111 Bool_t ProcessFrameMessage(Long_t msg, Long_t parm1, Long_t parm2);
112
113 ClassDefOverride(TViewerX3D,0) //Interface to the X3D viewer
114};
115
116#endif
Handle_t Window_t
Window handle.
Definition GuiTypes.h:29
bool Bool_t
Boolean (0=false, 1=true) (bool).
Definition RtypesCore.h:77
int Int_t
Signed integer 4 bytes (int).
Definition RtypesCore.h:59
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
Definition RtypesCore.h:68
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
Definition RtypesCore.h:60
float Float_t
Float 4 bytes (float).
Definition RtypesCore.h:71
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
const char Option_t
Option string (const char).
Definition RtypesCore.h:80
#define ClassDefOverride(name, id)
Definition Rtypes.h:348
Option_t Option_t option
Option_t Option_t width
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
char name[80]
Definition TGX11.cxx:148
Generic 3D primitive description class.
Definition TBuffer3D.h:18
A frame containing two scrollbars (a horizontal and a vertical) and a viewport.
Definition TGCanvas.h:192
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
The TGMenu.h header contains all different menu classes.
Definition TGMenu.h:282
This class creates a popup menu object.
Definition TGMenu.h:110
Basic string class.
Definition TString.h:138
Window_t fX3DWin
Definition TViewerX3D.h:43
Int_t fYPos
Definition TViewerX3D.h:56
TGCanvas * fCanvas
Definition TViewerX3D.h:44
void Update()
Update X3D viewer.
void Close()
Close X3D Viewer.
TGLayoutHints * fCanvasLayout
Definition TViewerX3D.h:52
TString fOption
Definition TViewerX3D.h:41
Bool_t BuildingScene() const override
Definition TViewerX3D.h:100
TGPopupMenu * fHelpMenu
Definition TViewerX3D.h:48
Int_t fXPos
Definition TViewerX3D.h:55
UInt_t fWidth
Definition TViewerX3D.h:53
friend class TX3DContainer
Definition TViewerX3D.h:37
TGPopupMenu * fFileMenu
Definition TViewerX3D.h:47
TString fTitle
Definition TViewerX3D.h:42
Bool_t PreferLocalFrame() const override
Definition TViewerX3D.h:98
void InitX3DWindow()
Setup geometry and initialize X3D.
UInt_t fHeight
Definition TViewerX3D.h:54
void Iconify()
Definition TViewerX3D.h:90
TGMenuBar * fMenuBar
Definition TViewerX3D.h:46
void AddCompositeOp(UInt_t) override
Definition TViewerX3D.h:109
TGLayoutHints * fMenuBarHelpLayout
Definition TViewerX3D.h:51
~TViewerX3D() override
Delete ROOT X3D viewer.
Bool_t HandleContainerButton(Event_t *ev)
After button release get current position and update associated pad.
TX3DContainer * fContainer
Definition TViewerX3D.h:45
static Bool_t fgCreated
Definition TViewerX3D.h:78
void GetPosition(Float_t &longitude, Float_t &latitude, Float_t &psi)
Get position.
TVirtualPad * fPad
Definition TViewerX3D.h:57
void CreateViewer(const char *name)
Create the actual canvas.
void EndScene() override
The x3d viewer cannot rebuild a scene once created.
EPass fPass
Definition TViewerX3D.h:70
Bool_t fBuildingScene
Definition TViewerX3D.h:58
void Show()
Definition TViewerX3D.h:91
void BeginScene() override
The x3d viewer cannot rebuild a scene once created.
TX3DFrame * fMainFrame
Definition TViewerX3D.h:40
void DeleteX3DWindow()
Close X3D window.
TGLayoutHints * fMenuBarItemLayout
Definition TViewerX3D.h:50
Int_t AddObject(const TBuffer3D &buffer, Bool_t *addChildren=nullptr) override
The x3d viewer cannot rebuild a scene once created.
Bool_t ProcessFrameMessage(Long_t msg, Long_t parm1, Long_t parm2)
Handle menu and other command generated by the user.
TGLayoutHints * fMenuBarLayout
Definition TViewerX3D.h:49
TViewerX3D(TVirtualPad *pad)
Create ROOT X3D viewer.
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...
void PaintPolyMarker(const TBuffer3D &buffer) const
Paint 3D PolyMarker.
Bool_t OpenComposite(const TBuffer3D &, Bool_t *=nullptr) override
Definition TViewerX3D.h:107
void CloseComposite() override
Definition TViewerX3D.h:108
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition TVirtualPad.h:51
Abstract 3D shapes viewer.
Event structure.
Definition GuiTypes.h:175
char title[80]
Definition x3d.c:915