1 / 27

ROOT Tutorials – Session 8

ROOT Tutorials – Session 8. GUI, Signal/Slots, Image Processing, Carrot Fons Rademakers. GUI. 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.)

clark
Download Presentation

ROOT Tutorials – Session 8

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. GUI ROOT Tutorials - Session 5

  3. 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 ROOT Tutorials - Session 5

  4. 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) ROOT Tutorials - Session 5

  5. 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, ... ROOT Tutorials - Session 5

  6. 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. ROOT Tutorials - Session 5

  7. Basic Widgets ROOT Tutorials - Session 5

  8. Advanced Widgets • Color selector dialog: TGColorDialog ROOT Tutorials - Session 5

  9. GUI Examples –Histogram Browser ROOT Tutorials - Session 5

  10. More GUI Examples –Period System ROOT Tutorials - Session 5

  11. Signal and Slot Mechanism ROOT Tutorials - Session 5

  12. 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 ROOT Tutorials - Session 5

  13. Signals and Slots Example:Emitting a 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* }; class A : public TQObject{ private: Int_t fValue; public: A() { fValue = 0; } Int_t GetValue() const { return fValue; } void SetValue(Int_t); //*SIGNAL* }; ROOT Tutorials - Session 5

  14. 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()"); } ROOT Tutorials - Session 5

  15. 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()"); ROOT Tutorials - Session 5

  16. 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 ROOT Tutorials - Session 5

  17. Image Processing Classes ROOT Tutorials - Session 5

  18. 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 ROOT Tutorials - Session 5

  19. Example ROOT Tutorials - Session 5

  20. Zooming Option: always square pixels ROOT Tutorials - Session 5

  21. rotation by 90 ° vertical mirror zoom smooth ROOT Tutorials - Session 5

  22. 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 ROOT Tutorials - Session 5

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

  24. 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 ROOT Tutorials - Session 5

  25. 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 ROOT Tutorials - Session 5

  26. Carrot ROOT Tutorials - Session 5

  27. 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 ROOT Tutorials - Session 5

More Related