View Class Reference

A widget that shows a view of the track. More...

#include <View.h>

Inheritance diagram for View:

DrawingArea List of all members.

Public Types

 VIEW_TOP
 Draw the map in the xy plane.
 VIEW_SIDE
 Draw the map in the yz plane.
 VIEW_FRONT
 Draw the map in the xz plane.
enum  ViewAngle { VIEW_TOP, VIEW_SIDE, VIEW_FRONT }
 The set of perspectives to draw from. More...

Public Member Functions

 View ()
 Create using a new OpenGL context.
 View (View &view)
 Create sharing OpenGL the context of an existing View.
virtual ~View ()
void set_document (Document::Document &document)
 Set the document that the area is to represent.
void set_angle (const ViewAngle angle)
 Set the perspective the view has on the stage.
ViewAngle get_angle () const
 Get the perspective of the view.
void set_scale (const float scale)
 Set the scale to display the track at.
float get_scale () const
 get the scale.
void set_centre (btVector3 centre)
 Set the centre of the view.
btVector3 get_centre () const
 Get the centre of the view.
void realize ()
sigc::signal< void, boost::shared_ptr<
Document::DocumentDelta > > 
signal_command ()
 Signal emmited when the user requests a change to the track by interacting with the view.
sigc::signal< void, boost::shared_ptr<
Document::DocumentDelta > > 
signal_preview_command ()
 Signal emmited when during user interaction with the view.
sigc::signal< void > signal_preview_cancel ()
 Get signal emmited when the previewed command should be canceled.

Protected Member Functions

virtual void on_realize ()
virtual bool on_configure_event (GdkEventConfigure *event)
virtual bool on_expose_event (GdkEventExpose *event)
virtual bool on_scroll_event (GdkEventScroll *event)
virtual bool on_button_press_event (GdkEventButton *event)
virtual bool on_button_release_event (GdkEventButton *event)
virtual bool on_motion_notify_event (GdkEventMotion *event)
void on_delete_vertex ()
void on_delete_edge ()
void on_delete_attachment ()
void on_flip_edge ()
void on_insert_vertex ()
void on_set_start_edge ()
void on_add_booster ()
void setup_ui ()
 User interface preperation common to any constructor.
void recentre_view ()
 Set the OpenGL modelview matrix so we can draw the scene with the correct orientation, scale, and centre.
void draw_path (const Track::Path &path)
 Draw the path of the track.
const Track::EditAssist::Selectableget_selectable_under_mouse ()
 Find something under the mouse pointer.
btVector3 mouse_to_scene (btScalar x, btScalar y) const
 Convert window position to scene position.
void set_relative_depth (btVector3 &position, btScalar depth)
 move a position vector so its distance into the screen is the view's centre + a given value.
void pick_segment (std::size_t index)

Protected Attributes

Document::Documentdocument
 The document to show and edit.
float scale
 The scale of the drawing. Scale is in pixels per distance unit.
btScalar handle_length
 The length of the handles used to edit rotations.
btVector3 centre
 The coordinates at the bottom left corner of the display.
ViewAngle view_angle
 Which perspective of the scene to use.
bool needs_recentre
 true if recentre_view() needs to be called during the next draw.
btVector3 new_position
 New position of object being dragged, or where the line under the mouse hits the back plane if none.
const Track::EditAssist::Dragabledrag_object
const Track::EditAssist::Selectablepopup_object
sigc::signal< void, boost::shared_ptr<
Document::DocumentDelta > > 
m_signal_command
 Signal emmited when a command is created through the user's interaction.
sigc::signal< void, boost::shared_ptr<
Document::DocumentDelta > > 
m_signal_preview_command
 Signal emmited when a command should be previewed.
sigc::signal< void > m_signal_preview_cancel
 Signal emmited when a previewed command should be canceled.
Glib::RefPtr< Gtk::ActionGroup > m_action_group
Glib::RefPtr< Gtk::UIManager > m_ui_manager
Gtk::UIManager::ui_merge_id m_menu_id
Gtk::Menu * m_popup_menu
 popup menu that contains the segments list.
Gtk::Menu * m_empty_menu
 popup menu shown when an empty space is right clicked.
Gtk::Menu * m_attachment_menu
 popup menu shown when an Track::TrackAttachment is right clicked.

Detailed Description

A widget that shows a view of the track.

Definition at line 27 of file View.h.


Member Enumeration Documentation

enum View::ViewAngle

The set of perspectives to draw from.

Enumerator:
VIEW_TOP  Draw the map in the xy plane.
VIEW_SIDE  Draw the map in the yz plane.
VIEW_FRONT  Draw the map in the xz plane.

Definition at line 48 of file View.h.


Constructor & Destructor Documentation

View::View (  ) 

Create using a new OpenGL context.

Meshes and textures loaded in this View will not be useable by an existing View.

Definition at line 36 of file View.cpp.

View::View ( View view  ) 

Create sharing OpenGL the context of an existing View.

Meshes and textures loaded into either this View or the specified View will be useable by both.

Parameters:
view The View to share contexts with. The document used by view will be set to the same in the new View.

Definition at line 54 of file View.cpp.

View::~View (  )  [virtual]

Definition at line 74 of file View.cpp.


Member Function Documentation

void View::draw_path ( const Track::Path path  )  [protected]

Draw the path of the track.

Todo:
Find bounds of visible area and set up an occlusion tester.

Todo:
use marker size to draw a square around the point regardless of hardware maximum point size. glPointSize is not guranteed to support sizes other than 1, which is too small.

Definition at line 378 of file View.cpp.

View::ViewAngle View::get_angle (  )  const

Get the perspective of the view.

See also:
set_angle()

Definition at line 180 of file View.cpp.

btVector3 View::get_centre (  )  const

Get the centre of the view.

See also:
set_centre()

Definition at line 212 of file View.cpp.

float View::get_scale (  )  const

get the scale.

See also:
set_scale()

Definition at line 194 of file View.cpp.

const Track::EditAssist::Selectable * View::get_selectable_under_mouse (  )  [protected]

Find something under the mouse pointer.

Definition at line 665 of file View.cpp.

btVector3 View::mouse_to_scene ( btScalar  x,
btScalar  y 
) const [protected]

Convert window position to scene position.

Definition at line 646 of file View.cpp.

void View::on_add_booster (  )  [protected]

Definition at line 887 of file View.cpp.

bool View::on_button_press_event ( GdkEventButton *  event  )  [protected, virtual]

Definition at line 474 of file View.cpp.

bool View::on_button_release_event ( GdkEventButton *  event  )  [protected, virtual]

Definition at line 584 of file View.cpp.

bool View::on_configure_event ( GdkEventConfigure *  event  )  [protected, virtual]

Definition at line 229 of file View.cpp.

void View::on_delete_attachment (  )  [protected]

Definition at line 823 of file View.cpp.

void View::on_delete_edge (  )  [protected]

Definition at line 812 of file View.cpp.

void View::on_delete_vertex (  )  [protected]

Definition at line 801 of file View.cpp.

bool View::on_expose_event ( GdkEventExpose *  event  )  [protected, virtual]

Definition at line 295 of file View.cpp.

void View::on_flip_edge (  )  [protected]

Definition at line 835 of file View.cpp.

void View::on_insert_vertex (  )  [protected]

Definition at line 846 of file View.cpp.

bool View::on_motion_notify_event ( GdkEventMotion *  event  )  [protected, virtual]

Definition at line 620 of file View.cpp.

void View::on_realize (  )  [protected, virtual]

Definition at line 217 of file View.cpp.

bool View::on_scroll_event ( GdkEventScroll *  event  )  [protected, virtual]

Definition at line 249 of file View.cpp.

void View::on_set_start_edge (  )  [protected]

Definition at line 876 of file View.cpp.

void View::pick_segment ( std::size_t  index  )  [protected]

Definition at line 759 of file View.cpp.

void View::realize (  )  [inline]

Definition at line 94 of file View.h.

void View::recentre_view (  )  [protected]

Set the OpenGL modelview matrix so we can draw the scene with the correct orientation, scale, and centre.

Definition at line 260 of file View.cpp.

void View::set_angle ( const ViewAngle  angle  ) 

Set the perspective the view has on the stage.

Parameters:
angle The ViewAngle to use for the perspective.

Definition at line 172 of file View.cpp.

void View::set_centre ( btVector3  centre  ) 

Set the centre of the view.

Parameters:
centre The position to have in the middle of the screen.

Definition at line 199 of file View.cpp.

void View::set_document ( Document::Document document  ) 

Set the document that the area is to represent.

The document must valid as long as the widget can be drawn. It may be switched to another one at any time, however.

This should be called before any draw events occur.

Parameters:
document The document the view should draw and try to change if manipulated.

Definition at line 88 of file View.cpp.

void View::set_relative_depth ( btVector3 &  position,
btScalar  depth 
) [protected]

move a position vector so its distance into the screen is the view's centre + a given value.

Parameters:
position vector to move
depth distance from screen centre: positive is into the screen, negative is out of it.

Definition at line 604 of file View.cpp.

void View::set_scale ( const float  scale  ) 

Set the scale to display the track at.

A scale of 1 means 1 pixel is one spatial unit.

Todo:
Multiple-view friendly handle lengths.

Definition at line 185 of file View.cpp.

void View::setup_ui (  )  [protected]

User interface preperation common to any constructor.

Definition at line 78 of file View.cpp.

sigc::signal< void, boost::shared_ptr< Document::DocumentDelta > > View::signal_command (  ) 

Signal emmited when the user requests a change to the track by interacting with the view.

The singal should be wired to a function

 void on_view_command(boost::shared_ptr<Document::DocumentDelta> delta)
where the delta paramter is the DocumentDelta describing the user requested change.
Returns:
signal that is emmited when the user performs an action to the scene by interacting with the view.

Definition at line 744 of file View.cpp.

sigc::signal< void > View::signal_preview_cancel (  ) 

Get signal emmited when the previewed command should be canceled.

This allows the document to be reset to how it was if the user did not want the command that was previewed. The signal should be connected to a function of the form:

 void on_view_preview_cancel()
Returns:
signal that is emmited when the previewed command needs to be rejected.

Definition at line 754 of file View.cpp.

sigc::signal< void, boost::shared_ptr< Document::DocumentDelta > > View::signal_preview_command (  ) 

Signal emmited when during user interaction with the view.

The singal should be wired to a function

 void on_view_preview_command(boost::shared_ptr<Document::DocumentDelta> delta)
where the delta paramter is the DocumentDelta describing the the change to preview.
Returns:
signal that is emmited when we want to preview the effects of a command.

Definition at line 749 of file View.cpp.


Member Data Documentation

btVector3 View::centre [protected]

The coordinates at the bottom left corner of the display.

Definition at line 173 of file View.h.

Document::Document* View::document [protected]

The document to show and edit.

Definition at line 164 of file View.h.

const Track::EditAssist::Dragable* View::drag_object [protected]

Definition at line 200 of file View.h.

btScalar View::handle_length [protected]

The length of the handles used to edit rotations.

Definition at line 170 of file View.h.

Glib::RefPtr<Gtk::ActionGroup> View::m_action_group [protected]

Definition at line 217 of file View.h.

Gtk::Menu* View::m_attachment_menu [protected]

popup menu shown when an Track::TrackAttachment is right clicked.

Definition at line 225 of file View.h.

Gtk::Menu* View::m_empty_menu [protected]

popup menu shown when an empty space is right clicked.

Definition at line 223 of file View.h.

Gtk::UIManager::ui_merge_id View::m_menu_id [protected]

Definition at line 219 of file View.h.

Gtk::Menu* View::m_popup_menu [protected]

popup menu that contains the segments list.

Definition at line 221 of file View.h.

sigc::signal<void, boost::shared_ptr<Document::DocumentDelta> > View::m_signal_command [protected]

Signal emmited when a command is created through the user's interaction.

Definition at line 207 of file View.h.

sigc::signal<void> View::m_signal_preview_cancel [protected]

Signal emmited when a previewed command should be canceled.

Definition at line 215 of file View.h.

sigc::signal<void, boost::shared_ptr<Document::DocumentDelta> > View::m_signal_preview_command [protected]

Signal emmited when a command should be previewed.

Definition at line 211 of file View.h.

Glib::RefPtr<Gtk::UIManager> View::m_ui_manager [protected]

Definition at line 218 of file View.h.

bool View::needs_recentre [protected]

true if recentre_view() needs to be called during the next draw.

Definition at line 179 of file View.h.

btVector3 View::new_position [protected]

New position of object being dragged, or where the line under the mouse hits the back plane if none.

Definition at line 190 of file View.h.

const Track::EditAssist::Selectable* View::popup_object [protected]

Definition at line 202 of file View.h.

float View::scale [protected]

The scale of the drawing. Scale is in pixels per distance unit.

Definition at line 167 of file View.h.

ViewAngle View::view_angle [protected]

Which perspective of the scene to use.

Definition at line 176 of file View.h.


The documentation for this class was generated from the following files:
Get Racer at SourceForge.net. Fast, secure and Free Open Source software downloads

Generated at Mon Sep 6 00:41:16 2010 by Doxygen version 1.4.7 for Racer version svn335.