![]() ![]() The image below shows the context menus for some of the objects on the canvas. On a ROOT canvas, you can right-click on any object and see the context menu for it. When designing a class, the programmer can add methods to the context menu of the object by making minor changes to the header file. The context menus are a way to interactively call certain methods of an object. root c1->cd() 11.2.3 Context Menus: the Right Mouse Button To activate a canvas you can use the TPad::cd() method. By default, the objects are drawn in the active canvas. 11.2.2.2 With C++ Statements (Programmatically)įrequently we want to draw in different canvases or pads. In case of canvases or pads, the border becomes highlighted when it is active. To interactively make an object “active”, you can use the middle mouse button. Some objects may become “active” objects, which mean they are reordered to be on top of the others. Objects in a canvas, as well as in a pad, are stacked on top of each other in the order they were drawn. 11.2.2 Selecting Objects 11.2.2.1 The Middle Mouse Button Why is that? In short, the canvas is not updated with each change for performance reasons. This should change one of the coordinates of our line, but nothing happens on the screen. For example, try to do: root a.SetX1( 0.9) How would one move an object in a script? Since there is a tight correspondence between what is seen on the screen and the object in memory, changing the object changes it on the screen. Rotating: 11.2.1.2 With C++ Statements (Programmatically) Resize (exists also for the other directions): The cursor changes its shape to indicate what may be done: 11.2.1.1 The Left Mouse ButtonĪs was just seen moving or resizing an object is done with the left mouse button. First, let’s see how it is done in the GUI. 11.2.1 Moving, Resizing and Modifying ObjectsĬhanging the graphic objects attributes can be done with the GUI or programmatically. As said, interacting with an object on the screen changes the object in memory. You do not obtain the same result as before, the coordinates of ‘ a’ have changed. Now move it interactively by clicking with the left mouse button in the line’s middle and try to do again: root a.GetX1() X1 is the x value of the starting coordinate given in the definition above. You can try for instance to look at the starting X coordinate of the line: root a.GetX1() One actually interacts with the real object, not with a copy of it on the screen. One very important characteristic of ROOT is that transforming an object on the screen will also transform it in memory. For example, the line drawn in the previous paragraph may be moved or transformed. When an object is drawn, one can interact with it. A default canvas is drawn since there was no opened one. ![]() The first statement defines a line and the second one draws it. If no canvas is opened, a default one (named “ c1”) is instantiated and is drawn. This instructs the object “ object” to draw itself. One draws an object in the active canvas by using the statement: object.Draw() If several canvases are defined, there is only one active at a time. The basic whiteboard on which an object is drawn is called a canvas (defined by the class TCanvas). This class has a virtual method Draw() so all objects are supposed to be able to be “drawn”. In ROOT, most objects derive from a base class TObject. Plots and histograms are discussed in a chapter of their own. In this chapter, we are going to focus on principals of graphics and 2D objects. Graphical capabilities of ROOT range from 2D objects (lines, polygons, arrows) to various plots, histograms, and 3D graphical objects. 11.10.2 Writing Several Canvases to the Same PostScript Fileġ1 Graphics and the Graphical User Interface.11.5.6 Orientation of Tick Marks on Axis.11.5.5 Drawing Axis Independently of Graphs or Histograms.11.5.2 Axis Options and Characteristics.11.4.6 Text and Latex Mathematical Expressions.11.4.5 Curly and Wavy Lines for Feynman Diagrams.11.3.3 Converting between Coordinate Systems.11.3 Graphical Containers: Canvas and Pad.11.2.4 Executing Events when a Cursor Passes on Top of an Object.11.2.3 Context Menus: the Right Mouse Button.11.2.1 Moving, Resizing and Modifying Objects.11.2 Interacting with Graphical Objects.11 Graphics and the Graphical User Interface. ![]()
0 Comments
Leave a Reply. |