JG ROOT Tools libraries
version 5.0 - august 2014
|
#include <RGGetPoints.hh>
Public Member Functions | |
RGGetPoints (const TGWindow *main, TVirtualPad *pad, const char *title, UInt_t &nb, RPoint2D *&result, const string &options="", const u_int flags=0, const bool auto_start=true) | |
RGGetPoints (const TGWindow *main, TVirtualPad *pad, const char *title, const string &options="", const u_int flags=0, const bool auto_start=false) | |
virtual | ~RGGetPoints () |
virtual void | Request () |
virtual void | EventLoop () |
virtual void | Quit () |
virtual void | SetContextHelpText (const string &text) |
virtual void | SetOptions (const string &opts="") |
virtual void | SetDimMode (Int_t m) |
virtual void | PadClosed () |
virtual void | MouseSelect (const Double_t x, const Double_t y) |
virtual void | MouseMove (const Double_t x, const Double_t y) |
virtual void | MouseDelete (const Double_t x, const Double_t y) |
virtual void | MouseButton1Down (const Double_t x, const Double_t y) |
virtual void | MouseButton1Double (const Double_t x, const Double_t y) |
virtual void | MouseButton1Up (const Double_t x, const Double_t y) |
virtual void | MouseButton2Down (const Double_t x, const Double_t y) |
virtual void | MouseButton2Double (const Double_t x, const Double_t y) |
virtual void | MouseButton2Up (const Double_t x, const Double_t y) |
virtual void | MouseButton3Down (const Double_t x, const Double_t y) |
virtual void | MouseButton3Double (const Double_t x, const Double_t y) |
virtual void | MouseButton3Up (const Double_t x, const Double_t y) |
virtual void | Locate (const Double_t x, const Double_t y) |
virtual void | AnyEvent (const Double_t x, const Double_t y) |
virtual void | PointDeleted (RPointMark *p) |
virtual void | AddPoint (const Double_t x, const Double_t y, const bool select=true) |
virtual void | MovePoint (RPointMark *p, const Double_t x, const Double_t y) |
virtual void | RemovePoint (RPointMark *p) |
virtual void | UpdatePointsNumber () |
virtual void | UpdatePosition (const Double_t x, const Double_t y) |
virtual void | UpdatePointPosition (const UInt_t n) |
virtual void | PointNumberValueSet (Long_t val) |
virtual void | PointNumberTextChanged (const char *str) |
virtual void | PointSetButton () |
virtual void | HelpButton () |
virtual void | DoneButton () |
virtual void | CancelButton () |
ClassDef (RGGetPoints, 0) | |
![]() | |
RGFrameEvent (TVirtualPad *pad=gPad) | |
RGFrameEvent (const RGFrameEvent &original) | |
RGFrameEvent & | operator= (const RGFrameEvent &original) |
virtual | ~RGFrameEvent () |
virtual void | PadEvent (Int_t event, Int_t x, Int_t y, TObject *selected) |
virtual void | KeyPressed (const Int_t x, const Int_t y) |
virtual void | AltKeyPressed () |
virtual void | CtrlKeyPressed () |
virtual void | ShiftKeyPressed () |
virtual void | ReturnKeyPressed () |
virtual void | MouseButton1Locate (const Double_t x, const Double_t y) |
virtual void | MouseButton1Motion (const Double_t x, const Double_t y) |
virtual void | MouseButton2Locate (const Double_t x, const Double_t y) |
virtual void | MouseButton2Motion (const Double_t x, const Double_t y) |
virtual void | MouseButton3Locate (const Double_t x, const Double_t y) |
virtual void | MouseButton3Motion (const Double_t x, const Double_t y) |
ClassDef (RGFrameEvent, 0) | |
Protected Member Functions | |
virtual void | Construct () |
virtual void | SetWindow () |
virtual void | SetMouseFlags (const u_int flags) |
virtual void | SetDimFlags (const u_int flags) |
Double_t | ClosestPointDistance (const Double_t x, const Double_t y, RPointMark *&ptr) |
RPointMark * | ClosestPoint (const Double_t x, const Double_t y) |
virtual void | UpdatePointAttr (RPointMark *p) |
virtual void | SelectPoint (RPointMark *p) |
virtual void | SetModified (const bool status=true) |
virtual void | RedrawPoints () |
virtual void | DrawAssociatedObject () |
virtual void | DeleteAssociatedObject () |
Protected Attributes | |
bool | exit_flag |
End of request check. | |
bool | constructed |
Flag if request is constructed. | |
bool | modified |
Flag if points have been modified. | |
u_int | request_flags |
Request options: buttons choice. | |
u_int | mouse_flags |
Use of mouse buttons. | |
Int_t | dim_mode |
Display in 1D/2D mode. | |
UInt_t | req_w |
Default window size (for adjustments if size is changed) | |
bool | move_lock |
Flag for point move phase. | |
ROptionString | options |
Options. | |
UInt_t | n_points_min |
Minimum number of points to get. | |
UInt_t | n_points_max |
Maximum number of points to get. | |
bool | min_on |
Flag indicated that there is a minimum number of requested points. | |
bool | max_on |
Flag indicated that there is a maximum number of requested points. | |
bool | marker_on |
Flag indicating a marker plotting. | |
bool | line_on |
Flag indicating a line plotting. | |
bool | line_close |
Flag indicating that a line is closed. | |
TAttMarker | m_att |
Standard points marker attributes (2D mode) | |
TAttMarker | s_att |
Selected point marker attributes (2D mode) | |
TAttLine | l_att |
Line attributes (2D mode) | |
TAttLine | ml_att |
Standard line attributes (1D mode) | |
TAttLine | sl_att |
Selected line attributes (1D mode) | |
Double_t | select_distance |
Selection distance (pixels) | |
RPointMark * | select_point |
Pointer to point at selection distance. | |
UInt_t * | out_number |
Pointer to points number (output) | |
RPoint2D ** | out_points |
Pointer to points array (output) | |
string | window_title |
Request title. | |
string | help_message |
Help text message. | |
TList | draw_list |
List of ROOT objects to draw. | |
TGCompositeFrame * | w_gp_main |
Main frame for points widgets. | |
TGGroupFrame * | w_gp_point_frame |
Frame for point information. | |
TGHorizontalFrame * | w_gp_point_num_h_frame |
Points number line. | |
TGNumberEntry * | w_gp_point_number |
Current point number. | |
TGNumberEntryField * | w_gp_total_number |
Number of points defined. | |
TGNumberEntryField * | w_gp_min_number |
Minimum requested number of points. | |
TGNumberEntryField * | w_gp_max_number |
Maximum requested number of points. | |
TGHorizontalFrame * | w_gp_point_coord_h_frame |
Coordinates line. | |
TGTextButton * | w_gp_set_button |
Point update button. | |
TGHorizontalFrame * | w_gp_point_x_frame |
X coordinate frame. | |
TGNumberEntry * | w_gp_point_x_number |
X point value. | |
TGHorizontalFrame * | w_gp_point_y_frame |
X coordinate frame. | |
TGNumberEntry * | w_gp_point_y_number |
Y point value. | |
TGCompositeFrame * | w_gp_button_frame |
Buttons frame. | |
TGTextButton * | w_gp_help_button |
Help button. | |
TGTextButton * | w_gp_cancel_button |
Cancel button. | |
TGTextButton * | w_gp_done_button |
Validation button. | |
![]() | |
TVirtualPad * | pad_ptr |
Pointer to pad where events are processed. | |
Private Types | |
enum | RGFlags { noDoneButton = 0x00000001, noCancelButton = 0x00000002, noHelpButton = 0x00000004, noButton = 0x00000007, verticalFrame = 0x00000000, horizontalFrame = 0x00000010, bottomCompact = 0x00000020, mode1Dx = 0x00000040, mode1Dy = 0x00000080, mode2D = 0x000000C0, selectButton1 = 0x00000000, selectButton2 = 0x00000100, selectButton3 = 0x00000200, selectButton = 0x00000300, selectDouble = 0x00000400, deleteButton1 = 0x00001000, deleteButton2 = 0x00000000, deleteButton3 = 0x00002000, deleteButton = 0x00003000, deleteDouble = 0x00004000, mouseFlags = 0x0000FF00 } |
! Request options | |
enum | RGDimMode { dimMode2D = 0, dimMode1Dx = 1, dimMode1Dy = 2 } |
! Effective dimensions selection | |
Private Member Functions | |
GObject (RGGetPoints) | |
RGGetPoints (const RGGetPoints &obj) | |
class RGGetPoints
Class to get a list of points by interacting in a TPad.
Graphical objects can be added for drawing. In the base class, according to options, a line connecting points may be added if corresponding option is set.
Graphical options:
Request options
RGGetPoints::RGGetPoints | ( | const TGWindow * | main, |
TVirtualPad * | pad, | ||
const char * | title, | ||
UInt_t & | nb, | ||
RPoint2D *& | result, | ||
const string & | opts = "" , |
||
const u_int | flags = 0 , |
||
const bool | auto_start = true |
||
) |
Constructor with returned arguments, to get an array of points interactively in a pad. The result array of RPoint2D is allocated (it must be deleted by calling code) and the argument nb receives the number of points in the array. If initially result is not NULL and nb is not 0, their content is used for initial points definition.
main | main application window |
pad | pad pointer |
title | window title |
nb | initial and returned number of points |
result | initial points array and returned array |
opts | graphical options (see class description) |
flags | request options |
auto_start | flag for execution at construction |
References AddPoint(), constructed, n_points_max, n_points_min, options, out_number, out_points, Request(), request_flags, SetDimFlags(), SetMouseFlags(), and window_title.
RGGetPoints::RGGetPoints | ( | const TGWindow * | main, |
TVirtualPad * | pad, | ||
const char * | title, | ||
const string & | opts = "" , |
||
const u_int | flags = 0 , |
||
const bool | auto_start = false |
||
) |
Constructor without returned arguments, for use in derived classes.
main | main application window |
pad | pad pointer |
title | window title |
opts | graphical options (see class description) |
flags | request options |
auto_start | flag for execution at construction |
References constructed, n_points_max, n_points_min, options, out_number, out_points, Request(), request_flags, SetDimFlags(), SetMouseFlags(), and window_title.
|
private |
Copy constructor, not implemented.
obj | object to copy |
|
virtual |
Destructor: clean associated objects.
References DeleteAssociatedObject(), and RGFrameEvent::pad_ptr.
Referenced by Quit().
|
private |
Macro from GCpp library that defines the following functions:
|
protectedvirtual |
Request graphical interface construction and initialisation.
Reimplemented in RGContourEdit, and RGContourListEdit.
References constructed, RDico::gp_cancel, RDico::gp_cancel_tip, RDico::gp_done, RDico::gp_done_tip, RDico::gp_help, RDico::gp_help_text, RDico::gp_help_tip, RDico::gp_maximum_tip, RDico::gp_minimum_tip, RDico::gp_point_num, RDico::gp_point_set, RDico::gp_point_set_tip, RDico::gp_point_x_tip, RDico::gp_point_y_tip, RDico::gp_points, RDico::gp_total_tip, help_message, l_att, line_on, m_att, marker_on, ml_att, n_points_max, n_points_min, rDico, request_flags, s_att, select_distance, select_point, sl_att, UpdatePointPosition(), UpdatePointsNumber(), w_gp_button_frame, w_gp_cancel_button, w_gp_done_button, w_gp_help_button, w_gp_main, w_gp_max_number, w_gp_min_number, w_gp_point_coord_h_frame, w_gp_point_frame, w_gp_point_num_h_frame, w_gp_point_number, w_gp_point_x_frame, w_gp_point_x_number, w_gp_point_y_frame, w_gp_point_y_number, w_gp_set_button, and w_gp_total_number.
Referenced by RGContourEdit::Construct(), and Request().
|
protectedvirtual |
Request window position and size adjustment.
References window_title.
Referenced by RGContourListEdit::Request(), RGContourEdit::Request(), and Request().
|
virtual |
Start the request: for derived classes, this function MUST be overloaded else the derived class is not build.
Reimplemented in RGContourEdit, and RGContourListEdit.
References Construct(), dim_mode, EventLoop(), exit_flag, RGFrameEvent::pad_ptr, RedrawPoints(), req_w, SetDimMode(), SetOptions(), and SetWindow().
Referenced by RGGetPoints().
|
virtual |
Events loop.
References exit_flag.
Referenced by RGContourListEdit::Request(), RGContourEdit::Request(), and Request().
|
virtual |
|
inlinevirtual |
Modification of context help text.
References help_message.
|
virtual |
Display options setting.
opts | display options (see class description) |
Reimplemented in RGContourEdit, and RGContourListEdit.
References l_att, line_close, line_on, m_att, max_on, min_on, ml_att, n_points_max, n_points_min, options, s_att, sl_att, w_gp_max_number, and w_gp_min_number.
Referenced by Request(), and RGContourEdit::SetOptions().
|
virtual |
Used dimension mode selection:
m | selected mode |
References dim_mode, req_w, w_gp_point_x_frame, and w_gp_point_y_frame.
Referenced by RGContourEdit::GateFlipHVButton(), RGContourEdit::InfoWidgetMap(), and Request().
|
protectedvirtual |
Mouse use options: select used buttons for creation and destruction of points (see class description).
flags | options flag (bit pattern) |
References mouse_flags.
Referenced by RGGetPoints().
|
protectedvirtual |
Définition des dimensions effectivement utilisées (1D X ou Y, ou 2D).
flags | liste des options |
References dim_mode.
Referenced by RGGetPoints().
|
protected |
Compute the distance to closest point (in pixels) and a pointer to this point. If no point is found, the function returns -1 as distance, and a NULL pointer for the point.
x | point X coordinate |
y | point Y coordinate |
ptr | pointer to closest point (returned value) |
References dim_mode, and RGFrameEvent::pad_ptr.
Referenced by ClosestPoint(), and Locate().
|
protected |
Get the pointer to the closest point, if the distance is less than select_distance. If no point is close enough, the function returns NULL.
x | point X coordinate |
y | point Y coordinate |
References ClosestPointDistance(), and select_distance.
Referenced by MouseDelete().
|
protectedvirtual |
Update draw attributes of a point (depending whether it is at selection distance or not).
p | pointer to point to be updated |
Reimplemented in RGContourEdit.
References m_att, s_att, and select_point.
Referenced by RedrawPoints().
|
protectedvirtual |
Sélection d'un point.
p | pointeur sur le point à sélectionner |
References RedrawPoints(), and select_point.
Referenced by AddPoint(), and UpdatePointPosition().
|
inlineprotectedvirtual |
Set the modification flag.
Reimplemented in RGContourListEdit.
References modified.
Referenced by AddPoint(), RGContourEdit::ContourNameChanged(), RGContourEdit::MovePoint(), MovePoint(), PointDeleted(), RemovePoint(), RGContourEdit::SetContourType(), RGContourListEdit::SetModified(), and RGContourEdit::UpdateContour().
|
protectedvirtual |
Redraw all points, and associated objects if line flag is set.
References dim_mode, DrawAssociatedObject(), line_on, RGFrameEvent::pad_ptr, and UpdatePointAttr().
Referenced by RGContourEdit::GateCenterButton(), RGContourEdit::GateFlipHVButton(), Locate(), MouseSelect(), RGContourEdit::MovePoint(), MovePoint(), RemovePoint(), RGContourListEdit::Request(), RGContourEdit::Request(), Request(), SelectPoint(), RGContourEdit::UpdateContourType(), and RGContourListEdit::UpdateContourWidgets().
|
protectedvirtual |
Draw associated objects: for the base class, it is the line connecting points.
Reimplemented in RGContourEdit.
References DeleteAssociatedObject(), dim_mode, draw_list, l_att, line_close, ml_att, RGFrameEvent::pad_ptr, select_point, and sl_att.
Referenced by RedrawPoints().
|
protectedvirtual |
Delete associated objects from the drawing.
References draw_list.
Referenced by RGContourEdit::DrawAssociatedObject(), DrawAssociatedObject(), and ~RGGetPoints().
|
virtual |
Function called when the pad is closed.
Reimplemented from RGFrameEvent.
References RGFrameEvent::pad_ptr, and Quit().
|
virtual |
Create a new point (if no existing point is at selection distance).
x | X position in the pad |
y | Y position in the pad |
References AddPoint(), max_on, move_lock, n_points_max, RedrawPoints(), and select_point.
Referenced by MouseButton1Double(), MouseButton1Down(), MouseButton2Double(), MouseButton2Down(), MouseButton3Double(), and MouseButton3Down().
|
virtual |
Move selected point.
x | X position in the pad |
y | Y position in the pad |
References MovePoint(), and select_point.
Referenced by AnyEvent().
|
virtual |
Delete a point (if a point is at selection distance).
x | X position in the pad |
y | Y position in the pad |
References ClosestPoint(), Locate(), and RemovePoint().
Referenced by MouseButton1Double(), MouseButton1Down(), MouseButton2Double(), MouseButton2Down(), MouseButton3Double(), and MouseButton3Down().
|
virtual |
Function used according to mouse buttons use for point creation or destruction.
x | X position in the pad |
y | Y position in the pad |
Reimplemented from RGFrameEvent.
References mouse_flags, MouseDelete(), and MouseSelect().
|
inlinevirtual |
Function used according to mouse buttons use for point creation or destruction.
x | X position in the pad |
y | Y position in the pad |
Reimplemented from RGFrameEvent.
References mouse_flags, MouseDelete(), and MouseSelect().
|
virtual |
Function used according to mouse buttons use for move release.
x | X position in the pad |
y | Y position in the pad |
Reimplemented from RGFrameEvent.
References mouse_flags, and move_lock.
|
virtual |
Function used according to mouse buttons use for point creation or destruction.
x | X position in the pad |
y | Y position in the pad |
Reimplemented from RGFrameEvent.
References mouse_flags, MouseDelete(), and MouseSelect().
|
inlinevirtual |
Function used according to mouse buttons use for point creation or destruction.
x | X position in the pad |
y | Y position in the pad |
Reimplemented from RGFrameEvent.
References mouse_flags, MouseDelete(), and MouseSelect().
|
virtual |
Function used according to mouse buttons use for move release.
x | X position in the pad |
y | Y position in the pad |
Reimplemented from RGFrameEvent.
References mouse_flags, and move_lock.
|
virtual |
Function used according to mouse buttons use for point creation or destruction.
x | X position in the pad |
y | Y position in the pad |
Reimplemented from RGFrameEvent.
References mouse_flags, MouseDelete(), and MouseSelect().
|
inlinevirtual |
Function used according to mouse buttons use for point creation or destruction.
x | X position in the pad |
y | Y position in the pad |
Reimplemented from RGFrameEvent.
References mouse_flags, MouseDelete(), and MouseSelect().
|
virtual |
Function used according to mouse buttons use for move release.
x | X position in the pad |
y | Y position in the pad |
Reimplemented from RGFrameEvent.
References mouse_flags, and move_lock.
|
virtual |
For cursor moves, check if a point is at selection distance.
x | X position in the pad |
y | Y position in the pad |
Reimplemented from RGFrameEvent.
References ClosestPointDistance(), RedrawPoints(), select_distance, select_point, UpdatePointPosition(), and w_gp_point_number.
Referenced by MouseDelete().
|
virtual |
Function updating coordinates display. It also movies a point if it is currently selected and mouse mouving.
x | X position in the pad |
y | Y position in the pad |
Reimplemented from RGFrameEvent.
References MouseMove(), move_lock, and UpdatePosition().
|
virtual |
This is a slot called when a point is deleted: it must be removed from the list.
In principle, this function should not be of use since the contextual menu is inhibited, and points may not be deleted from this menu.
p | deleted marker pointer |
References select_point, and SetModified().
|
virtual |
Add a point to the list.
x | new point X position |
y | new point Y position |
select | set if point is selected when added |
References constructed, SelectPoint(), SetModified(), UpdatePointsNumber(), and w_gp_point_number.
Referenced by MouseSelect(), PointSetButton(), RGGetPoints(), and RGContourEdit::SetContourPoints().
|
inlinevirtual |
Move a point.
p | point pointer |
x | new X position |
y | new Y position |
Reimplemented in RGContourEdit.
References RedrawPoints(), and SetModified().
Referenced by MouseMove(), and RGContourEdit::MovePoint().
|
virtual |
Remove a point from the list.
References RedrawPoints(), select_point, SetModified(), and UpdatePointsNumber().
Referenced by MouseDelete().
|
virtual |
Update number of points in widgets.
References constructed, max_on, n_points_max, w_gp_point_number, and w_gp_total_number.
Referenced by AddPoint(), Construct(), RemovePoint(), RGContourEdit::UpdateContourType(), and RGContourListEdit::UpdateContourWidgets().
|
virtual |
Update cursor position widgets.
x | X position |
y | Y position |
References constructed, w_gp_point_x_number, and w_gp_point_y_number.
Referenced by AnyEvent(), and UpdatePointPosition().
|
virtual |
Update current position from a point in the list, and select corresponding point.
n | point number |
References SelectPoint(), and UpdatePosition().
Referenced by Construct(), Locate(), PointNumberTextChanged(), and PointSetButton().
|
virtual |
Slot called when changing current point number value.
val | widget value |
|
virtual |
Slot called when changing text of current point number.
str | widget string |
References max_on, n_points_max, UpdatePointPosition(), and w_gp_point_number.
|
virtual |
Slot for point value update.
References AddPoint(), UpdatePointPosition(), w_gp_point_number, w_gp_point_x_number, and w_gp_point_y_number.
|
virtual |
Help button slot.
References help_message.
|
virtual |
Done (= OK) button slot.
Reimplemented in RGContourEdit, and RGContourListEdit.
References dim_mode, exit_flag, min_on, n_points_min, out_number, and out_points.
|
virtual |
Cancel button slot.
References exit_flag.
RGGetPoints::ClassDef | ( | RGGetPoints | , |
0 | |||
) |
For ROOT dictionary.