uvsim::MapArea Class Reference

MapArea Class. More...

#include <MapArea.h>

Collaboration diagram for uvsim::MapArea:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 MapArea (BaseObjectType *cobject, const Glib::RefPtr< Gtk::Builder > &glade)
 Constructor.
bool on_expose_event (GdkEventExpose *event)
 Calls drawInitial() everytime the window is loaded and reloaded.
void drawInitial ()
 Loads the map and waypoints (if any).
void draw (std::vector< GeoCoord > waypoint)
 Draws all the waypoints.
void drawRedCircle (GeoCoord waypoint)
 Draws a red circle around a single waypoint.
void drawRedCircle (std::vector< GeoCoord > waypoint)
 Draws red circles around all the waypoints.

Public Attributes

Glib::RefPtr< Gdk::Pixbuf > image
 Creating object named image from Gdk::Pixbuf.
Cairo::RefPtr< Cairo::Context > cr
 Creating object named cr from Cairo Context.
double m_zoom
 Contains the zoom level of the map.
double m_panUD
 Contains how far the pan is shifted up and down.
double m_panLR
 Contains how far the pan is shifted left and right.
double relative_originX
 Contains the horizontal location of the origin (top-left corner).
double relative_originY
 Contains the vertical location of the origin (top-left corner).
double relative_endX
 Contains the horziontal location of the end (bottom-right corner).
double relative_endY
 Contains the vertical location of the end (bottom-right corner).
double scaleX
 Contains the scale between the width of image with the latitude of map.
double scaleY
 Contains the scale between the height of image with the longitude of map.
std::vector< GeoCoordwaypoint
 Creating object named waypoint from vector of GeoCoord.
FlightPlanflightPlan
 Pointer to object member named flightPlan.

Private Member Functions

virtual bool on_motion_notify_event (GdkEventMotion *event)
 Prints the coordinate of map that the mouse pointer is currently in.
virtual bool on_button_press_event (GdkEventButton *event)
 Saves the coordinate of the points that is clicked in the map to the flightPlan.

Private Attributes

const Glib::RefPtr
< Gtk::Builder > & 
m_glade
 Reference to Gtk::Builder associated with glade file.
double relative_x
 Contains the horizontal location of the image, consistent with panning and zooming, with respect to the origin (left-top corner).
double relative_y
 Contains the vertical location of the image, consistent with panning and zomming, with respect to the origin (left-top corner).
MainWindowm_pMainWindow
 Pointer to MainWindow object named m_pMainWindow.

Detailed Description

MapArea Class.

MapArea.jpg

Example of a Map.

This class loads the map to the drawing area including its ability to do zooming and panning. In this case, the user could also move the waypoints around the map and the terminal would show the coordinate, consistent with current zoom and pan level (see image below). In addition, to load the point in the map from flightPlan to the window, the coordinate has to be transformed back to the coordinate of the window to make it consistent (see image below).

Map.png

The Mathematics of Coordinate Transformation.

This class also asks the user to input the coordinate of top-left and bottom-right corners of the map. From these information, the map could be rotated such that the north is pointing up. The constraints in this code is that the north must be in increment of 90 degrees from the real north. This class is unable to rotate with custom angle.

This class also enables user to input waypoints by clicking a point in the map and modify them. The possible modifications are adding, deleting, and moving waypoints. These modifications could be done by series of keyboard pressing and mouse clicking. To achieve this, "A" or "a" is assigned to add waypoint, "M" or "m" is assigned to move waypoint, and "D" or "d" is assigned to delete waypoint. The procedure is followed:
1) Adding Waypoint
Press "A" or "a" and all the waypoints will be highlighted by a red circle around them.
Click the previous waypoint to where the new waypoint is going to be added.
Click a point in the map and the new waypoint will be added after the previously chosen waypoint.

Adding_Waypoint.png

Adding Waypoint.

2) Moving Waypoint
Press "M" or "m" and all the waypoints will be highlighted by a red circle around them.
Click the waypoint that wants to be moved.
Click a point in the map and the waypoint will move to the new location that was clicked.

Moving_Waypoint.png

Moving Waypoint.

3) Deleting Waypoint
Press "D" or "d" and all the waypoints will be highlighted by a red circle around them.
Click the waypoint that wants to be deleted and it will be deleted.

Deleting_Waypoint.png

Deleting Waypoint.

Definition at line 56 of file MapArea.h.


Constructor & Destructor Documentation

uvsim::MapArea::MapArea ( BaseObjectType *  cobject,
const Glib::RefPtr< Gtk::Builder > &  glade 
)

Constructor.

Parameters:
cobject : The base DrawingArea object.
glade : The reference to the Gtk::Builder associated with the glade file.

Definition at line 29 of file MapArea.cc.


Member Function Documentation

void uvsim::MapArea::draw ( std::vector< GeoCoord waypoint  ) 

Draws all the waypoints.

Parameters:
waypoint : The GeoCoord type vector that contains the Latitude, Longitude, and Altitude of a location.

Definition at line 147 of file MapArea.cc.

Here is the caller graph for this function:

void uvsim::MapArea::drawInitial (  ) 

Loads the map and waypoints (if any).

Definition at line 126 of file MapArea.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

void uvsim::MapArea::drawRedCircle ( std::vector< GeoCoord waypoint  ) 

Draws red circles around all the waypoints.

Parameters:
waypoint : vector of object of class type GeoCoord.

Definition at line 176 of file MapArea.cc.

void uvsim::MapArea::drawRedCircle ( GeoCoord  waypoint  ) 

Draws a red circle around a single waypoint.

Parameters:
waypoint : object of class type GeoCoord.

Definition at line 194 of file MapArea.cc.

Here is the caller graph for this function:

bool uvsim::MapArea::on_button_press_event ( GdkEventButton *  event  )  [private, virtual]

Saves the coordinate of the points that is clicked in the map to the flightPlan.

Parameters:
event : The pointer to the event that is occuring.
Returns:
true if any mouse button is pressed.

Definition at line 112 of file MapArea.cc.

Here is the call graph for this function:

bool uvsim::MapArea::on_expose_event ( GdkEventExpose *  event  ) 

Calls drawInitial() everytime the window is loaded and reloaded.

Parameters:
event : The pointer to the event that is occurring.
Returns:
true if any event is exposed/occured.

Definition at line 92 of file MapArea.cc.

Here is the call graph for this function:

bool uvsim::MapArea::on_motion_notify_event ( GdkEventMotion *  event  )  [private, virtual]

Prints the coordinate of map that the mouse pointer is currently in.

Parameters:
event : The pointer to the event that is occuring.
Returns:
true if the pointer of mouse is moved.

Definition at line 97 of file MapArea.cc.

Here is the call graph for this function:


Member Data Documentation

Cairo::RefPtr<Cairo::Context> uvsim::MapArea::cr

Creating object named cr from Cairo Context.

Definition at line 99 of file MapArea.h.

Pointer to object member named flightPlan.

Definition at line 143 of file MapArea.h.

Glib::RefPtr<Gdk::Pixbuf> uvsim::MapArea::image

Creating object named image from Gdk::Pixbuf.

Definition at line 95 of file MapArea.h.

const Glib::RefPtr<Gtk::Builder>& uvsim::MapArea::m_glade [private]

Reference to Gtk::Builder associated with glade file.

Definition at line 148 of file MapArea.h.

Contains how far the pan is shifted left and right.

Definition at line 111 of file MapArea.h.

Contains how far the pan is shifted up and down.

Definition at line 107 of file MapArea.h.

Pointer to MainWindow object named m_pMainWindow.

Definition at line 172 of file MapArea.h.

Contains the zoom level of the map.

Definition at line 103 of file MapArea.h.

Contains the horziontal location of the end (bottom-right corner).

Definition at line 123 of file MapArea.h.

Contains the vertical location of the end (bottom-right corner).

Definition at line 127 of file MapArea.h.

Contains the horizontal location of the origin (top-left corner).

Definition at line 115 of file MapArea.h.

Contains the vertical location of the origin (top-left corner).

Definition at line 119 of file MapArea.h.

double uvsim::MapArea::relative_x [private]

Contains the horizontal location of the image, consistent with panning and zooming, with respect to the origin (left-top corner).

Definition at line 164 of file MapArea.h.

double uvsim::MapArea::relative_y [private]

Contains the vertical location of the image, consistent with panning and zomming, with respect to the origin (left-top corner).

Definition at line 168 of file MapArea.h.

Contains the scale between the width of image with the latitude of map.

Definition at line 131 of file MapArea.h.

Contains the scale between the height of image with the longitude of map.

Definition at line 135 of file MapArea.h.

Creating object named waypoint from vector of GeoCoord.

Definition at line 139 of file MapArea.h.


The documentation for this class was generated from the following files:

Generated on Mon Nov 9 12:57:14 2009 for uvsim by  doxygen 1.6.1