Presentation is loading. Please wait.

Presentation is loading. Please wait.

ROOT Tutorials - Session 51 ROOT Tutorials – Session 8 GUI, Signal/Slots, Image Processing, Carrot Fons Rademakers.

Similar presentations


Presentation on theme: "ROOT Tutorials - Session 51 ROOT Tutorials – Session 8 GUI, Signal/Slots, Image Processing, Carrot Fons Rademakers."— Presentation transcript:

1 ROOT Tutorials - Session 51 ROOT Tutorials – Session 8 GUI, Signal/Slots, Image Processing, Carrot Fons Rademakers

2 ROOT Tutorials - Session 52 GUI

3 ROOT Tutorials - Session 53 The ROOT GUI Classes Originally based on the XClass’95 widget library from Hector Peraza A rich and complete set of widgets Uses only X11 and Xpm (no Motif, Xaw, Xt, etc.) Object oriented class library, no wrapper around a C library. Can be extended via inheritance Small (12000 lines of C++) Win95 look and feel

4 ROOT Tutorials - Session 54 XClass’95 Integration in ROOT All X11 calls abstracted via the TVirtualX abstract graphics interface Use ROOT container classes, notably hash tables for fast lookup of frame and picture objects Added TObject inheritance to the few base classes to get I/O and extended RTTI capabilities Added many new widgets (now 35K lines)

5 ROOT Tutorials - Session 55 Available Widgets Complete set of widgets: label, icon, button, check button, radio button, picture button, button box, list box, combo box, list view, icon view, number entry, text entry, text view, text edit, tree view, tab view, scrollbar, slider, menubar, popup menu, cascading menu, statusbar, toolbar, message dialogs, file selection dialog, progress bars, tooltips,...

6 ROOT Tutorials - Session 56 Creating a GUI The widgets are laid out in frames TGFrame, TGCompositeFrame, TGMainFrame, TGTransientFrame, TGroupFrame And arranged by layout managers TGHorizontalLayout, TGVerticalLayout, TGRowLayout, TGListLayout, TGTileLayout, TGMatrixLayout,... Using a combination of layout hints TGLayoutHints (left, center x, right, top, center y, bottom, expand x, expand y and fixed offsets) Event handling by messaging (as opposed to callbacks). Like Win32. And by signals and slots. Like Qt.

7 ROOT Tutorials - Session 57 Basic Widgets

8 ROOT Tutorials - Session 58 Advanced Widgets Color selector dialog: TGColorDialog

9 ROOT Tutorials - Session 59 GUI Examples – Histogram Browser

10 ROOT Tutorials - Session 510 More GUI Examples – Period System

11 ROOT Tutorials - Session 511 Signal and Slot Mechanism

12 ROOT Tutorials - Session 512 Signals and Slots Integration of signal and slot mechanism into the ROOT core TQObject, TQConnection, TQClass, … Signal and slots were pioneered by Trolltech in their Qt GUI toolkit This mechanism facilitates component programming since it allows a total decoupling of the interacting classes

13 ROOT Tutorials - Session 513 Signals and Slots Example: Emitting a Signal class A : public TQObject{ private: Int_t fValue; public: A() { fValue = 0; } Int_t GetValue() const { return fValue; } void SetValue(Int_t); //*SIGNAL* }; class A { RQ_OBJECT(“A”) private: Int_t fValue; public: A() { fValue = 0; } Int_t GetValue() const { return fValue; } void SetValue(Int_t); //*SIGNAL* };

14 ROOT Tutorials - Session 514 Signals and Slots Example: Emitting a Signal void A::SetValue(Int_t v) { if (v != fValue) { fValue = v; Emit("SetValue(Int_t)", v); } void TGButton::Clicked() { Emit(“Clicked()"); }

15 ROOT Tutorials - Session 515 Signals and Slots Example: Connecting a Signal to a Slot A *a = new A(); A *b = new A(); a->Connect("SetValue(Int_t)", "A", b, "SetValue(Int_t)"); a->SetValue(79); b->GetValue(); // this is now 79 fButton->Connect("Clicked()", "MyFrame", this, "DoButton()");

16 ROOT Tutorials - Session 516 Signals and Slots The ROOT signal and slot system uses the dictionary information and interpreter to connect signals to slots Many different signals are emitted by: TVirtualPad (TCanvas and TPad) TSysEvtHandler (TTimer, TFileHandler) All GUI widgets Let your classes emit signals whenever they change a significant state that others might be interested in

17 ROOT Tutorials - Session 517 Image Processing Classes

18 ROOT Tutorials - Session 518 Requirements Developed by Reiner Rohlfs of ISDC User requirements coming from the astrophysics community Main requirements: Fast display Color editor Base class for astronomical display

19 ROOT Tutorials - Session 519 Example

20 ROOT Tutorials - Session 520 Zooming Option: always square pixels

21 ROOT Tutorials - Session 521 rotation by 90 °vertical mirror zoomsmooth

22 ROOT Tutorials - Session 522 Basics It is available since ROOT 3.03.08 The ROOT image class is build on top of a lower level C - library: libAfterImage (Sasha Vasko) Read and write several image file formats (GIF,TIFF, JPEG,...) Zoom New: convert a 2 – D data array into color pixels FOR MORE INFO... http://afterstep.sourceforge.net/afterimage

23 ROOT Tutorials - Session 523 Class Hierarchy TNamed TImage TASImage TGMainFrame TPaletteEditor TASPaletteEditor TImagePalette TObject TAttImage

24 ROOT Tutorials - Session 524 How to use TASImage Build the libAfterImage library Download ftp://root.cern.ch/root/libAfterImage.tar.gz Create a shared library ( ${ROOTSYS}/lib ) There are two example macros: galaxy_image.C rose_image.C

25 ROOT Tutorials - Session 525 Foreseen Improvements To simplify the build process of a libRootASImage.tar.gz Interface TASimage to the 2 – D histogram classes A text editor of the palette

26 ROOT Tutorials - Session 526 Carrot

27 ROOT Tutorials - Session 527 What is Carrot? Carrot is a module for Apache web server which enables the use of C++ as an HTML-embedded scripting language as well as executing C++ macros. It is similar to PHP, in functionality: http://carrot.cern.ch/index_C.so?about


Download ppt "ROOT Tutorials - Session 51 ROOT Tutorials – Session 8 GUI, Signal/Slots, Image Processing, Carrot Fons Rademakers."

Similar presentations


Ads by Google