Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

vgui_easy2D_tableau Class Reference

#include <vgui_easy2D_tableau.h>

Inheritance diagram for vgui_easy2D_tableau:

Inheritance graph
[legend]
List of all members.

Detailed Description

Tableau to display two-dimensional geometric objects.

Two dimensional geometric objects (see vgui_soview2D) such as lines, points, circles, etc can be added using add, or add_point, add_line, add_circle, etc.

The constructor of this tableau can accept a child tableau such as an image or clear tableau on top of which the geometric objects will be displayed (so for example, lines can be drawn on an image). To display objects on a non-black, plain coloured background use a clear_tableau and set its colour.

To remove objects call remove(vgui_soview*). The vgui_soview* is returned by add(), or you can get a list of all soviews using get_all(). To remove all objects use clear().

The geometric objects on the easy2D (and any underlying image) can be saved as PostScript by calling print_psfile. (If you just wish to save an image of your easy2D you may want to use vgui_utils::dump_colour_buffer instead).

Definition at line 62 of file vgui_easy2D_tableau.h.

Public Member Functions

 vgui_easy2D_tableau (const char *n="unnamed")
 Constructor - don't use this, use vgui_easy2D_tableau_new.
 vgui_easy2D_tableau (vgui_image_tableau_sptr const &, const char *n="unnamed")
 Constructor - don't use this, use vgui_easy2D_tableau_new.
 vgui_easy2D_tableau (vgui_tableau_sptr const &, const char *n="unnamed")
 Constructor - don't use this, use vgui_easy2D_tableau_new.
bool handle (const vgui_event &e)
 Handle all events sent to this tableau.
vcl_string name () const
 Returns the name given to this tableau in the constructor.
vcl_string file_name () const
 Returns the filename of the child image if there is one, else the name.
vcl_string pretty_name () const
 Returns a nice version of the type, including details of any image file.
vcl_string type_name () const
 Returns the type of this tableau ('vgui_easy2D_tableau').
void set_image (vcl_string const &image)
 Set the child tableau to be the given image_tableau.
void set_child (vgui_tableau_sptr const &)
 Set the child tableau to be the given tableau.
void set_foreground (float r, float g, float b, float a=1.0f)
 Set the colour of objects to the given red, green, blue, alpha values.
void set_line_width (float w)
 Set the width of lines to the given width.
void set_point_radius (float r)
 Set the radius of points to the given radius.
void add (vgui_soview2D *)
 Add the given two-dimensional object to the display.
vgui_soview2D_pointadd_point (float x, float y)
 Add a point at the given position to the display.
vgui_soview2D_linesegadd_line (float x0, float y0, float x1, float y1)
 Add a finite line with the given start and end points to the display.
vgui_soview2D_infinite_lineadd_infinite_line (float a, float b, float c)
 Add an infinite line (ax + by +c = 0) to the display.
vgui_soview2D_circleadd_circle (float x, float y, float r)
 Add a circle with the given centre and radius to the display.
vgui_soview2D_ellipseadd_ellipse (float x, float y, float w, float h, float phi)
 Add an ellipse with a given center, width, height, and angle.
vgui_soview2D_pointadd_point_3dv (double const p[3])
 Add a point with the given projective coordinates.
vgui_soview2D_linesegadd_line_3dv_3dv (double const p1[3], double const p2[3])
 Add a line with the given projective start and end points.
vgui_soview2D_infinite_lineadd_infinite_line_3dv (double const l[3])
 Add an infinite line with the given projective coordinates.
vgui_soview2D_circleadd_circle_3dv (double const point[3], float r)
 Add a circle with the given centre (in projective coords) and radius.
vgui_soview2D_linestripadd_linestrip (unsigned n, float const *x, float const *y)
 Add a linestrip with the given n vertices to the display.
vgui_soview2D_polygonadd_polygon (unsigned n, float const *x, float const *y)
 Add polygon with the given n vertices to the display.
void remove (vgui_soview *vso)
 Remove the given soview from the display.
void clear ()
 Clear all soviews from the display.
vcl_vector< vgui_soview
* > const & 
get_all () const
 Returns a list of all soviews on the display.
vgui_image_tableau_sptr get_image_tableau () const
 If the child tableau is an image_tableau, return this.
void print_psfile (vcl_string filename, int reduction_factor, bool print_geom_objs, int wd=-1, int ht=-1)
 Screen dump to postscript file.
vgui_soview2D_imageadd_image (float x, float y, vil_image_view_base const &img)
 Add an image at the given position to the display.
vgui_soview2D_imageadd_image (float x, float y, vil1_image const &img)
 Add an image at the given position to the display.
bool motion (int x, int y)
 Called by handle when it receives a mouse motion event.
bool mouse_down (int x, int y, vgui_button button, vgui_modifier modifier)
 Called by default handle when it receives a mouse down event.
void draw_soviews_render ()
void draw_soviews_select ()
bool is_selected (unsigned id)
vcl_vector< unsigned > const & get_selected () const
vcl_vector< vgui_soview * > get_selected_soviews () const
bool select (unsigned id)
bool deselect (unsigned id)
bool deselect_all ()
bool is_highlighted (unsigned id)
unsigned get_highlighted ()
vgui_soviewget_highlighted_soview ()
bool highlight (unsigned id)
virtual void add (vgui_soview *)
virtual void remove (vgui_soview *&)
void set_current_grouping (vcl_string name)
vcl_string get_current_grouping ()
vgui_displaybase_tableau_groupingget_grouping_ptr (vcl_string name)
vcl_vector< vcl_string > get_grouping_names ()
void set_selection_callback (vgui_displaybase_tableau_selection_callback *cb)
 Attach your own selection callback.
vcl_vector< unsigned > const get_all_ids () const
vgui_soviewcontains_hit (vcl_vector< unsigned > hit)
unsigned get_id () const
void get_parents (vcl_vector< vgui_tableau_sptr > *out) const
 Get the parent tableaux for this tableau.
void get_children (vcl_vector< vgui_tableau_sptr > *out) const
 Get the child tableaux for this tableau.
vgui_tableau_sptr get_child (unsigned i) const
 Get the ith child or return 0.
virtual bool add_child (vgui_tableau_sptr const &)
 Add the given tableau to the list of child tableaux.
virtual bool remove_child (vgui_tableau_sptr const &)
 Remove the given child from the list of child tableaux.
virtual bool notify_replaced_child (vgui_tableau_sptr const &old_child, vgui_tableau_sptr const &new_child)
 Called whenever a child of this tableau is about to be forcibly replaced.
virtual void add_popup (vgui_menu &)
 Add the given menu to the popup menu for the tableau.
virtual void get_popup (vgui_popup_params const &, vgui_menu &)
 Get the default popup menu for the tableau.
virtual void post_message (char const *, void const *)
 Post a message event.
virtual void post_redraw ()
 Post a draw event.
virtual void post_overlay_redraw ()
 Post a overlay-redraw event.
virtual void post_idle_request ()
 Post an idle request event.
virtual bool get_bounding_box (float low[3], float high[3]) const
 Get the bounding box of this tableau.
virtual bool draw ()
 Called by default handle when it receives a draw event.
virtual bool mouse_up (int x, int y, vgui_button, vgui_modifier)
 Called by default handle when it receives a mouse up event.
virtual bool key_press (int x, int y, vgui_key, vgui_modifier)
 Called by default handle when it receives a key-press event.
virtual bool help ()
 Called by default handle when it receives a '?' pressed event.
virtual bool idle ()
 Called when the application is otherwise idle.
void ref () const
 Increase the reference count by one (for smart pointers).
void unref () const
 Decrease the reference count by one (for smart pointers).

Static Public Member Functions

static void get_all (vcl_vector< vgui_tableau_sptr > *out)
 Push all tableaux onto the given vector.
static bool exists (vgui_tableau_sptr const &)
 Returns true if the given address points to a valid tableau.

Public Attributes

GLenum gl_mode

Protected Member Functions

 ~vgui_easy2D_tableau ()
 Destructor - called by vgui_easy2D_tableau_sptr.

Protected Attributes

vgui_parent_child_link image_slot
 Child tableau if there is one.
vgui_image_tableau_sptr image_image
 Child image tableau, if there is one.
vcl_string name_
 Name of this tableau.
vgui_style_sptr style_
 the style of the objects.
vcl_vector< vgui_soview * > objects
vcl_map< vcl_string, vgui_displaybase_tableau_groupinggroupings
vcl_string current_grouping
vcl_vector< unsigned > selections
unsigned highlighted
int gl_display_list
vgui_displaybase_tableau_selection_callbackcb_


Constructor & Destructor Documentation

vgui_easy2D_tableau::vgui_easy2D_tableau const char *  n = "unnamed"  ) 
 

Constructor - don't use this, use vgui_easy2D_tableau_new.

Create an easy2D with the given name.

Definition at line 44 of file vgui_easy2D_tableau.cxx.

vgui_easy2D_tableau::vgui_easy2D_tableau vgui_image_tableau_sptr const &  ,
const char *  n = "unnamed"
 

Constructor - don't use this, use vgui_easy2D_tableau_new.

Creates an easy2D with the given image tableau as child.

Definition at line 55 of file vgui_easy2D_tableau.cxx.

vgui_easy2D_tableau::vgui_easy2D_tableau vgui_tableau_sptr const &  ,
const char *  n = "unnamed"
 

Constructor - don't use this, use vgui_easy2D_tableau_new.

Creates an easy2D with the given child tableau.

Definition at line 67 of file vgui_easy2D_tableau.cxx.

vgui_easy2D_tableau::~vgui_easy2D_tableau  )  [inline, protected]
 

Destructor - called by vgui_easy2D_tableau_sptr.

Definition at line 191 of file vgui_easy2D_tableau.h.


Member Function Documentation

void vgui_displaybase_tableau::add vgui_soview  )  [virtual, inherited]
 

Definition at line 63 of file vgui_displaybase_tableau.cxx.

void vgui_easy2D_tableau::add vgui_soview2D  ) 
 

Add the given two-dimensional object to the display.

Definition at line 155 of file vgui_easy2D_tableau.cxx.

bool vgui_tableau::add_child vgui_tableau_sptr const &   )  [virtual, inherited]
 

Add the given tableau to the list of child tableaux.

Virtual overridden by consenting parents.

Reimplemented in vgui_composite_tableau, vgui_deck_tableau, and vgui_wrapper_tableau.

Definition at line 283 of file vgui_tableau.cxx.

vgui_soview2D_circle * vgui_easy2D_tableau::add_circle float  x,
float  y,
float  r
 

Add a circle with the given centre and radius to the display.

Definition at line 201 of file vgui_easy2D_tableau.cxx.

vgui_soview2D_circle * vgui_easy2D_tableau::add_circle_3dv double const   point[3],
float  r
 

Add a circle with the given centre (in projective coords) and radius.

Definition at line 247 of file vgui_easy2D_tableau.cxx.

vgui_soview2D_ellipse * vgui_easy2D_tableau::add_ellipse float  x,
float  y,
float  w,
float  h,
float  phi
 

Add an ellipse with a given center, width, height, and angle.

Definition at line 213 of file vgui_easy2D_tableau.cxx.

vgui_soview2D_image * vgui_easy2D_tableau::add_image float  x,
float  y,
vil1_image const &  img
 

Add an image at the given position to the display.

Alpha blending will be turned on iff the image has 4 components.

Definition at line 446 of file vgui_easy2D_tableau.cxx.

vgui_soview2D_image * vgui_easy2D_tableau::add_image float  x,
float  y,
vil_image_view_base const &  img
 

Add an image at the given position to the display.

Alpha blending will be turned on iff the view has 4 planes.

Definition at line 460 of file vgui_easy2D_tableau.cxx.

vgui_soview2D_infinite_line * vgui_easy2D_tableau::add_infinite_line float  a,
float  b,
float  c
 

Add an infinite line (ax + by +c = 0) to the display.

Definition at line 188 of file vgui_easy2D_tableau.cxx.

vgui_soview2D_infinite_line * vgui_easy2D_tableau::add_infinite_line_3dv double const   l[3]  ) 
 

Add an infinite line with the given projective coordinates.

Definition at line 241 of file vgui_easy2D_tableau.cxx.

vgui_soview2D_lineseg * vgui_easy2D_tableau::add_line float  x0,
float  y0,
float  x1,
float  y1
 

Add a finite line with the given start and end points to the display.

Note that this will be added as a vgui_lineseg (not vgui_line - which doesn't exist).

Definition at line 174 of file vgui_easy2D_tableau.cxx.

vgui_soview2D_lineseg * vgui_easy2D_tableau::add_line_3dv_3dv double const   p1[3],
double const   p2[3]
 

Add a line with the given projective start and end points.

Definition at line 234 of file vgui_easy2D_tableau.cxx.

vgui_soview2D_linestrip * vgui_easy2D_tableau::add_linestrip unsigned  n,
float const *  x,
float const *  y
 

Add a linestrip with the given n vertices to the display.

Definition at line 253 of file vgui_easy2D_tableau.cxx.

vgui_soview2D_point * vgui_easy2D_tableau::add_point float  x,
float  y
 

Add a point at the given position to the display.

Definition at line 162 of file vgui_easy2D_tableau.cxx.

vgui_soview2D_point * vgui_easy2D_tableau::add_point_3dv double const   p[3]  ) 
 

Add a point with the given projective coordinates.

Definition at line 228 of file vgui_easy2D_tableau.cxx.

vgui_soview2D_polygon * vgui_easy2D_tableau::add_polygon unsigned  n,
float const *  x,
float const *  y
 

Add polygon with the given n vertices to the display.

Definition at line 262 of file vgui_easy2D_tableau.cxx.

void vgui_tableau::add_popup vgui_menu  )  [virtual, inherited]
 

Add the given menu to the popup menu for the tableau.

This method is for tableaux to implement if they want to _add_ some items to the popup menu. They can assign to or clear 'menu', but that is not recommended as it would remove what other tableaux put there. The recommended usage is to .add() items or to .include() another menu.

** This is an interface method. it abstracts a behaviour. **

Reimplemented in vgui_active_tableau, vgui_clear_tableau, and vgui_satellite_tableau_t< object, data >.

Definition at line 315 of file vgui_tableau.cxx.

void vgui_easy2D_tableau::clear  )  [inline, virtual]
 

Clear all soviews from the display.

Reimplemented from vgui_displaybase_tableau.

Definition at line 154 of file vgui_easy2D_tableau.h.

vgui_soview * vgui_displaybase_tableau::contains_hit vcl_vector< unsigned >  hit  )  [inherited]
 

Definition at line 356 of file vgui_displaybase_tableau.cxx.

bool vgui_displaybase_tableau::deselect unsigned  id  )  [inherited]
 

Definition at line 301 of file vgui_displaybase_tableau.cxx.

bool vgui_displaybase_tableau::deselect_all  )  [inherited]
 

Definition at line 322 of file vgui_displaybase_tableau.cxx.

bool vgui_tableau::draw  )  [virtual, inherited]
 

Called by default handle when it receives a draw event.

Reimplemented in vgui_function_tableau.

Definition at line 175 of file vgui_tableau.cxx.

void vgui_displaybase_tableau::draw_soviews_render  )  [inherited]
 

Definition at line 151 of file vgui_displaybase_tableau.cxx.

void vgui_displaybase_tableau::draw_soviews_select  )  [inherited]
 

Definition at line 201 of file vgui_displaybase_tableau.cxx.

bool vgui_tableau::exists vgui_tableau_sptr const &   )  [static, inherited]
 

Returns true if the given address points to a valid tableau.

Definition at line 384 of file vgui_tableau.cxx.

vcl_string vgui_easy2D_tableau::file_name  )  const [virtual]
 

Returns the filename of the child image if there is one, else the name.

Reimplemented from vgui_tableau.

Definition at line 87 of file vgui_easy2D_tableau.cxx.

void vgui_tableau::get_all vcl_vector< vgui_tableau_sptr > *  out  )  [static, inherited]
 

Push all tableaux onto the given vector.

Definition at line 375 of file vgui_tableau.cxx.

vcl_vector<vgui_soview*> const& vgui_easy2D_tableau::get_all  )  const [inline]
 

Returns a list of all soviews on the display.

Reimplemented from vgui_displaybase_tableau.

Definition at line 157 of file vgui_easy2D_tableau.h.

vcl_vector< unsigned > const vgui_displaybase_tableau::get_all_ids  )  const [inherited]
 

Definition at line 267 of file vgui_displaybase_tableau.cxx.

bool vgui_tableau::get_bounding_box float  low[3],
float  high[3]
const [virtual, inherited]
 

Get the bounding box of this tableau.

If infinite in extent, or nothing is drawn, or you can't be bothered to implement it, return false. const. if you need to cache, cast away const.

Reimplemented in vgui_composite_tableau, vgui_image_tableau, vgui_roi_tableau, and vgui_wrapper_tableau.

Definition at line 197 of file vgui_tableau.cxx.

vgui_tableau_sptr vgui_tableau::get_child unsigned  i  )  const [inherited]
 

Get the ith child or return 0.

Definition at line 273 of file vgui_tableau.cxx.

void vgui_tableau::get_children vcl_vector< vgui_tableau_sptr > *  out  )  const [inherited]
 

Get the child tableaux for this tableau.

Definition at line 266 of file vgui_tableau.cxx.

vcl_string vgui_displaybase_tableau::get_current_grouping  )  [inline, inherited]
 

Definition at line 109 of file vgui_displaybase_tableau.h.

vcl_vector< vcl_string > vgui_displaybase_tableau::get_grouping_names  )  [inherited]
 

Definition at line 383 of file vgui_displaybase_tableau.cxx.

vgui_displaybase_tableau_grouping * vgui_displaybase_tableau::get_grouping_ptr vcl_string  name  )  [inherited]
 

Definition at line 374 of file vgui_displaybase_tableau.cxx.

unsigned vgui_displaybase_tableau::get_highlighted  )  [inline, inherited]
 

Definition at line 94 of file vgui_displaybase_tableau.h.

vgui_soview * vgui_displaybase_tableau::get_highlighted_soview  )  [inherited]
 

Definition at line 351 of file vgui_displaybase_tableau.cxx.

unsigned vgui_displaybase_tableau::get_id  )  const [inline, inherited]
 

Definition at line 122 of file vgui_displaybase_tableau.h.

vgui_image_tableau_sptr vgui_easy2D_tableau::get_image_tableau  )  const [inline]
 

If the child tableau is an image_tableau, return this.

Definition at line 161 of file vgui_easy2D_tableau.h.

void vgui_tableau::get_parents vcl_vector< vgui_tableau_sptr > *  out  )  const [inherited]
 

Get the parent tableaux for this tableau.

Definition at line 259 of file vgui_tableau.cxx.

void vgui_tableau::get_popup vgui_popup_params const &  params,
vgui_menu menu
[virtual, inherited]
 

Get the default popup menu for the tableau.

If recurse is, true, recursively add the popup menus for children and children's children etc.

** this is a mixin method. it does some work for you. **

Reimplemented in vgui_deck_tableau, vgui_image_tableau, vgui_poly_tableau, vgui_shell_tableau, vgui_tview_launcher_tableau, and vgui_tview_tableau.

Definition at line 326 of file vgui_tableau.cxx.

vcl_vector<unsigned> const& vgui_displaybase_tableau::get_selected  )  const [inline, inherited]
 

Definition at line 86 of file vgui_displaybase_tableau.h.

vcl_vector< vgui_soview * > vgui_displaybase_tableau::get_selected_soviews  )  const [inherited]
 

Definition at line 257 of file vgui_displaybase_tableau.cxx.

bool vgui_easy2D_tableau::handle const vgui_event e  )  [virtual]
 

Handle all events sent to this tableau.

In particular, use draw events to draw 2-dimensional geometric objects.

Reimplemented from vgui_displaylist2D_tableau.

Definition at line 79 of file vgui_easy2D_tableau.cxx.

bool vgui_tableau::help  )  [virtual, inherited]
 

Called by default handle when it receives a '?' pressed event.

Reimplemented in vgui_composite_tableau, vgui_deck_tableau, vgui_function_tableau, vgui_listmanager2D_tableau, vgui_viewer2D_tableau, and vgui_viewer3D_tableau.

Definition at line 165 of file vgui_tableau.cxx.

bool vgui_displaybase_tableau::highlight unsigned  id  )  [inline, inherited]
 

Definition at line 96 of file vgui_displaybase_tableau.h.

bool vgui_tableau::idle  )  [virtual, inherited]
 

Called when the application is otherwise idle.

Override if you want to do idle processing. Return false once your idle processing is complete, or if you have no need for more idle processing. Return true if you need more idle processing time.

Definition at line 184 of file vgui_tableau.cxx.

bool vgui_displaybase_tableau::is_highlighted unsigned  id  )  [inline, inherited]
 

Definition at line 93 of file vgui_displaybase_tableau.h.

bool vgui_displaybase_tableau::is_selected unsigned  id  )  [inherited]
 

Definition at line 251 of file vgui_displaybase_tableau.cxx.

bool vgui_tableau::key_press int  x,
int  y,
vgui_key  ,
vgui_modifier 
[virtual, inherited]
 

Called by default handle when it receives a key-press event.

Reimplemented in vgui_deck_tableau, vgui_function_tableau, vgui_listmanager2D_tableau, vgui_viewer2D_tableau, and vgui_viewer3D_tableau.

Definition at line 155 of file vgui_tableau.cxx.

bool vgui_displaylist2D_tableau::motion int  x,
int  y
[virtual, inherited]
 

Called by handle when it receives a mouse motion event.

Reimplemented from vgui_tableau.

Definition at line 130 of file vgui_displaylist2D_tableau.cxx.

bool vgui_displaylist2D_tableau::mouse_down int  x,
int  y,
vgui_button  button,
vgui_modifier  modifier
[virtual, inherited]
 

Called by default handle when it receives a mouse down event.

Reimplemented from vgui_tableau.

Definition at line 148 of file vgui_displaylist2D_tableau.cxx.

bool vgui_tableau::mouse_up int  x,
int  y,
vgui_button  ,
vgui_modifier 
[virtual, inherited]
 

Called by default handle when it receives a mouse up event.

Reimplemented in vgui_function_tableau, vgui_viewer2D_tableau, and vgui_viewer3D_tableau.

Definition at line 135 of file vgui_tableau.cxx.

vcl_string vgui_easy2D_tableau::name void   )  const [inline, virtual]
 

Returns the name given to this tableau in the constructor.

Reimplemented from vgui_tableau.

Definition at line 82 of file vgui_easy2D_tableau.h.

bool vgui_tableau::notify_replaced_child vgui_tableau_sptr const &  old_child,
vgui_tableau_sptr const &  new_child
[virtual, inherited]
 

Called whenever a child of this tableau is about to be forcibly replaced.

This method is called when some part of the program (typically the parent_child_link mechanism) is about to forcibly replace a child of this tableau. The canonical reason to override this is in order to invalidate caches.

Definition at line 301 of file vgui_tableau.cxx.

void vgui_tableau::post_idle_request  )  [virtual, inherited]
 

Post an idle request event.

The fact that this is virtual does not imply that you should go and override it.

Posting an idle event request means that your tableau has some idle processing that it'd like to do. This means that your tableau will continue to receive vgui_IDLE events until the event handler returns false (i.e. all idle processing is complete). The idle event handler should return false when it has no idle processing, or has completed its idle processing. It may return true if has only partially completed its idle processing; in this case, it will receive more idle event to allow it to complete processing.

Reimplemented in vgui_adaptor_tableau.

Definition at line 234 of file vgui_tableau.cxx.

void vgui_tableau::post_message char const *  ,
void const * 
[virtual, inherited]
 

Post a message event.

The fact that this is virtual does not imply that you should go and override it.

Reimplemented in vgui_adaptor_tableau.

Definition at line 204 of file vgui_tableau.cxx.

void vgui_tableau::post_overlay_redraw  )  [virtual, inher