Source for advanced tracks layer. More...
#include "cairo/cairo.bi"
#include "Gir/OsmGpsMap-1.0.bi"
#include "Gir/_GLibMacros-2.0.bi"
#include "Gir/_GObjectMacros-2.0.bi"
#include "track_layer.bi"
#include "track_store.bi"
#include "gui.bi"
#include "debug.bi"
#include "string.bi"
Go to the source code of this file.
Classes | |
class | _TrackLayerPrivate |
Private data. More... | |
Typedefs | |
typedef single | float |
Enumerations | |
enum | { PROP_0, PROP_TL_W, PROP_TL_H, PROP__MAP, PROP_PREF, PROP_LOAD, PROP_FSIZ, PROP_FTYP } |
Enumerators for property IDs. More... | |
Functions | |
SUB_CDECL | track_layer_interface_init (BYVAL_AS_OsmGpsMapLayerIface_PTR Iface) |
Initialise the interface functions. More... | |
SUB_CDECL | render_info (BYVAL_AS_TrackLayer_PTR Lay, BYVAL_AS_OsmGpsMap_PTR Map) |
Render the info pad. More... | |
SUB_CDECL | track_layer_render (BYVAL_AS_OsmGpsMapLayer_PTR Lay, BYVAL_AS_OsmGpsMap_PTR Map) |
Render all enabled tracks. More... | |
SUB_CDECL | track_layer_draw (BYVAL_AS_OsmGpsMapLayer_PTR Lay, BYVAL_AS_OsmGpsMap_PTR Map, BYVAL_AS_cairo_t_PTR Cr) |
Callback for drawing the layer surfaces. More... | |
FUNCTION_CDECL_AS_gboolean | track_layer_busy (BYVAL_AS_OsmGpsMapLayer_PTR Lay) |
Callback for busy layer. More... | |
FUNCTION_CDECL_AS_gboolean | track_layer_button_press (BYVAL_AS_OsmGpsMapLayer_PTR Lay, BYVAL_AS_OsmGpsMap_PTR Map, BYVAL_AS_GdkEventButton_PTR Event) |
Callback for button event. More... | |
SUB_CDECL | track_layer_get_property (BYVAL_AS_Gobject_PTR Obj, BYVAL_AS_guint Property_id, BYVAL_AS_GValue_PTR Value, BYVAL_AS_GParamSpec_PTR Pspec) |
Handling property fetching. More... | |
SUB_CDECL | track_layer_set_property (BYVAL_AS_Gobject_PTR Obj, BYVAL_AS_guint Property_id, BYVAL_AS_CONST_GValue_PTR Value, BYVAL_AS_GParamSpec_PTR Pspec) |
Handling property setting. More... | |
FUNCTION_CDECL_AS_Gobject_PTR | track_layer_constructor (BYVAL_AS_GType Typ, BYVAL_AS_guint N_prop, BYVAL_AS_GObjectConstructParam_PTR Prop) |
GObjectClass CTOR. More... | |
SUB_CDECL | track_layer_finalize (BYVAL_AS_Gobject_PTR Obj) |
GObjectClass finalisation. More... | |
SUB_CDECL | track_layer_class_init (BYVAL_AS_TrackLayerClass_PTR klass) |
GObjectClass initialization. More... | |
SUB_CDECL | track_layer_init (BYVAL_AS_TrackLayer_PTR Self) |
GObject init procedure. More... | |
FUNCTION_CDECL_AS_gboolean | on_MAP_configure_event (BYVAL_AS_GtkWidget_PTR Wid, BYVAL_AS_GdkEventConfigure_PTR Event, BYVAL_AS_GPOINTER UDat) |
Callback fetching map size. More... | |
FUNCTION_AS_TrackLayer_PTR | track_layer_new (BYVAL_AS_GObject_PTR Map) |
Creates a new instance of TrackLayer. More... | |
SUB | render_rtext (BYVAL_AS_cairo_t_PTR Cr, BYREF_AS_LONG Y, BYREF_AS_LONG W, BYREF_AS_STRING S) |
Render right alligned text, bottom up. More... | |
FUNCTION_AS_STRING | lat2str (BYVAL_AS_float V) |
Format a latitude as string. More... | |
FUNCTION_AS_STRING | lon2str (BYVAL_AS_float V) |
Format a longitude as string. More... | |
FUNCTION_CDECL_AS_gboolean | render_track (BYVAL_AS_GtkTreeModel_PTR Model, BYVAL_AS_GtkTreePath_PTR Path, BYVAL_AS_GtkTreeIter_PTR Iter, BYVAL_AS_gpointer TLPriv) |
Render an enabled track. More... | |
FUNCTION_CDECL_AS_TrackLayerDefault_PTR | track_layer_get_default (BYVAL_AS_TrackLayer_PTR Lay) |
Provide the next default setting. More... | |
FUNCTION_CDECL_AS_TrackLoader_PTR | track_layer_get_loader (BYVAL_AS_TrackLayer_PTR Lay) |
Provide pointer to the active track. More... | |
SUB_CDECL | track_layer_center_track (BYVAL_AS_TrackLayer_PTR Lay) |
Show complete track. More... | |
SUB_CDECL | track_layer_set_loader (BYVAL_AS_TrackLayer_PTR Lay, BYVAL_AS_TrackLoader_PTR Loa) |
Set active track. More... | |
SUB_CDECL | track_layer_redraw (BYVAL_AS_TrackLayer_PTR Lay) |
Redraw surface. More... | |
FUNCTION_CDECL_AS_gint | track_layer_get_point (BYVAL_AS_TrackLayer_PTR Lay) |
Get current point in active track. More... | |
SUB_CDECL | track_layer_set_point (BYVAL_AS_TrackLayer_PTR Lay, BYVAL_AS_gint N) |
Set current point in active track. More... | |
SUB_CDECL | track_layer_set_bbox (BYVAL_AS_TrackLayer_PTR Lay, BYVAL_AS_float La0, BYVAL_AS_float La1, BYVAL_AS_float Lo0, BYVAL_AS_float Lo1) |
Set map segment to the given bounding box. More... | |
SUB_CDECL | track_layer_point_move (BYVAL_AS_TrackLayer_PTR Lay, BYVAL_AS_gchar_PTR S) |
Move current point. More... | |
Variables | |
static TrackLayerDefault | DEFAULT_ENTRIES [...] |
Array of default setting for loaded tracks. More... | |
class _TrackLayerPrivate |
Private data.
This structure holds the private (internal) data for the TrackLayer GObject.
Definition at line 58 of file track_layer.bas.
typedef single float |
Definition at line 19 of file track_layer.bas.
anonymous enum |
Enumerators for property IDs.
Enumerator | |
---|---|
PROP_0 | |
PROP_TL_W | |
PROP_TL_H | |
PROP__MAP | |
PROP_PREF | |
PROP_LOAD | |
PROP_FSIZ | |
PROP_FTYP |
Definition at line 39 of file track_layer.bas.
SUB_CDECL track_layer_interface_init | ( | BYVAL_AS_OsmGpsMapLayerIface_PTR | Iface | ) |
Initialise the interface functions.
Iface | The interface to modify |
This procedure is part of the OsmGpsMapLayer implementation. It initialises the interface functions.
Definition at line 111 of file track_layer.bas.
SUB render_info | ( | BYVAL_AS_TrackLayer_PTR | Lay, |
BYVAL_AS_OsmGpsMap_PTR | Map | ||
) |
Render the info pad.
Lay | The layer instance |
Map | Map instance calling |
Procedure renders new values in to the info pad (in the right bottom corner when Layer enabled). On a transparent background either only the coordinates of the map center, or - when a track is active - additionaly the current track point details get rendered to the TrackLayerPrivate.InfoSurface, to be shown in the next call to track_layer_draw().
Definition at line 599 of file track_layer.bas.
SUB_CDECL track_layer_render | ( | BYVAL_AS_OsmGpsMapLayer_PTR | Lay, |
BYVAL_AS_OsmGpsMap_PTR | Map | ||
) |
Render all enabled tracks.
Lay | The layer we're working at |
Map | The parent map widget |
This procedure is part of the OsmGpsMapLayer implementation. It takes care that the TrackLayerPriv.Surface matches the map size (width/height) and renders all enabled tracks (line/points) to that surface. Additionaly it renders the info pad, when enabled.
Definition at line 766 of file track_layer.bas.
SUB_cdecl track_layer_draw | ( | BYVAL_AS_OsmGpsMapLayer_PTR | Lay, |
BYVAL_AS_OsmGpsMap_PTR | Map, | ||
BYVAL_AS_cairo_t_PTR | Cr | ||
) |
Callback for drawing the layer surfaces.
Lay | Layer instance |
Map | Map widget sending the signal |
Cr | Cairl contents to draw on |
This function is part of the OsmGpsMapLayer implementation. It handles the (re)drawing of the layer surface, ie when a part of the widget gets covered by another widget.
Definition at line 357 of file track_layer.bas.
FUNCTION_CDECL_AS_gboolean track_layer_busy | ( | BYVAL_AS_OsmGpsMapLayer_PTR | Lay | ) |
Callback for busy layer.
Lay | Layer instance |
This function is part of the OsmGpsMapLayer implementation. It returns if there're pending operations on the layer, ie like unfinished animations. Here it returns always FALSE.
Definition at line 388 of file track_layer.bas.
FUNCTION_CDECL_AS_gboolean track_layer_button_press | ( | BYVAL_AS_OsmGpsMapLayer_PTR | Lay, |
BYVAL_AS_OsmGpsMap_PTR | Map, | ||
BYVAL_AS_GdkEventButton_PTR | Event | ||
) |
Callback for button event.
Lay | Layer receiving the event |
Map | Map widget propagating the event |
Event | Event sended |
This function is part of the OsmGpsMapLayer implementation. It handles button events (mouse clicks) on the map, only clicks with <shift>
or <control>
keys pressed in this case.
A <shift>
click searches in the active track for the point nearest to the click poisition. If the distance is below a certain value, that nearest point gets the current point in the active track.
In case of a <shift><control>
click not only the active, but all tracks are searched for the nearest point. When that nearest point is in another track, this track gets the active track.
Definition at line 413 of file track_layer.bas.
SUB_CDECL track_layer_get_property | ( | BYVAL_AS_Gobject_PTR | Obj, |
BYVAL_AS_guint | Property_id, | ||
BYVAL_AS_GValue_PTR | Value, | ||
BYVAL_AS_GParamSpec_PTR | Pspec | ||
) |
Handling property fetching.
Obj | GObject instance |
Property_id | Registration number |
Value | The value to fetch |
Pspec | Specification (for warning message) |
This procedure is part of the GObject implementation. It gets a value from a certain property.
Definition at line 130 of file track_layer.bas.
SUB_CDECL track_layer_set_property | ( | BYVAL_AS_Gobject_PTR | Obj, |
BYVAL_AS_guint | Property_id, | ||
BYVAL_AS_CONST_GValue_PTR | Value, | ||
BYVAL_AS_GParamSpec_PTR | Pspec | ||
) |
Handling property setting.
Obj | GObject instance |
Property_id | Registration number |
Value | The new value |
Pspec | Specification (for warning message) |
This procedure is part of the GObject implementation. It sets a new value for a certain property.
Definition at line 162 of file track_layer.bas.
FUNCTION_CDECL_AS_Gobject_PTR track_layer_constructor | ( | BYVAL_AS_GType | Typ, |
BYVAL_AS_guint | N_prop, | ||
BYVAL_AS_GObjectConstructParam_PTR | Prop | ||
) |
GObjectClass CTOR.
Typ | Objects GType |
N_prop | Number of properties |
Prop | Construction parameters |
This function is part of the GObject implementation. That constructor is setting the start values in the _TrackLayerPrivate structure, after chaining up to the parents constructor.
Definition at line 198 of file track_layer.bas.
SUB_CDECL track_layer_finalize | ( | BYVAL_AS_Gobject_PTR | Obj | ) |
GObjectClass finalisation.
Obj | The instance to work on |
This procedure is part of the GObject implementation. It handles the freeing of the used surfaces in this case, chaining up to the parents finalisation.
Definition at line 231 of file track_layer.bas.
SUB_CDECL track_layer_class_init | ( | BYVAL_AS_TrackLayerClass_PTR | klass | ) |
GObjectClass initialization.
klass | Class to initiate |
This procedure is part of the GObjectClass implementation. It handles the interface setting and the properties in this case.
The width property.
The height property.
The map property.
The defaults property.
The loader property.
The font-size property.
The font-type property.
Definition at line 248 of file track_layer.bas.
SUB_CDECL track_layer_init | ( | BYVAL_AS_TrackLayer_PTR | Self | ) |
GObject init procedure.
Self | Object to initiate |
This procedure is part of the GObject implementation. It sets the pointer to the _TrackLayerPrivate structure in this case.
Definition at line 340 of file track_layer.bas.
FUNCTION_CDECL_AS_gboolean on_MAP_configure_event | ( | BYVAL_AS_GtkWidget_PTR | Wid, |
BYVAL_AS_GdkEventConfigure_PTR | Event, | ||
BYVAL_AS_GPOINTER | UDat | ||
) |
Callback fetching map size.
Wid | Widget getting configured (=MAP, unused) |
Event | The new data |
UDat | Unused here |
Callback to hook into the configure event for the map widget. When the map width or height changes due to a user action (ie. full screen), the layer needs an adapted surface.
Definition at line 474 of file track_layer.bas.
FUNCTION_AS_TrackLayer_PTR track_layer_new | ( | BYVAL_AS_GObject_PTR | Map | ) |
Creates a new instance of TrackLayer.
Map | Map object to connect to |
A new TrackLayer instance gets created and added to the osm_gps_map given as parameter. Also a callback gets connected in order to track any configure changes of the map window.
Definition at line 497 of file track_layer.bas.
SUB render_rtext | ( | BYVAL_AS_cairo_t_PTR | Cr, |
BYREF_AS_LONG | Y, | ||
BYREF_AS_LONG | W, | ||
BYREF_AS_STRING | S | ||
) |
Render right alligned text, bottom up.
Cr | Cairo context to work on |
Y | Vertical position (line) |
W | Width of the surface |
S | String to render |
Procedure to render a right alligned text in to the _TrackLayerPrivate.InfoSurface. The black text gets a white border, in order to be readable on dark backgrounds. The next line position gets returned in parameter Y.
Definition at line 527 of file track_layer.bas.
FUNCTION_AS_STRING lat2str | ( | BYVAL_AS_float | V | ) |
Format a latitude as string.
V | Value to format [degree] |
Function to format a latitude value in to a human readable string.
< signless value degrees minutes
Definition at line 560 of file track_layer.bas.
FUNCTION_AS_STRING lon2str | ( | BYVAL_AS_float | V | ) |
Format a longitude as string.
V | Value to format [degree] |
Function to format a longitude value in to a human readable string.
Definition at line 578 of file track_layer.bas.
FUNCTION_CDECL_AS_gboolean render_track | ( | BYVAL_AS_GtkTreeModel_PTR | Model, |
BYVAL_AS_GtkTreePath_PTR | Path, | ||
BYVAL_AS_GtkTreeIter_PTR | Iter, | ||
BYVAL_AS_gpointer | TLPriv | ||
) |
Render an enabled track.
Model | GtkTreeModel to work on |
Path | Line in model (unused here) |
Iter | Data Position |
TLPriv | TrackLayerPriv pointer |
Callback designed as a GtkTreeModelForeachFunc. It greps the track data from the model at iter position, doing nothing when that track is disabled. Otherwise, when enabled, it renders line and points to the TrackLayerPriv.Surface to be shown in the next call to track_layer_draw().
Definition at line 655 of file track_layer.bas.
FUNCTION_CDECL_AS_TrackLayerDefault_PTR track_layer_get_default | ( | BYVAL_AS_TrackLayer_PTR | Lay | ) |
Provide the next default setting.
Lay | Layer instance |
The TrackLayer instance holds a number of default settings for line and point color and width, used as start values when loading a new track. This function returns a pointer to the next setting, reseting to the first when all defaults were used.
Definition at line 815 of file track_layer.bas.
FUNCTION_CDECL_AS_TrackLoader_PTR track_layer_get_loader | ( | BYVAL_AS_TrackLayer_PTR | Lay | ) |
Provide pointer to the active track.
Lay | Layer instance |
In the TrackLayer instance one of the loaded tracks is the active track. This function returns the pointer to that track.
Definition at line 836 of file track_layer.bas.
SUB_CDECL track_layer_center_track | ( | BYVAL_AS_TrackLayer_PTR | Lay | ) |
Show complete track.
Lay | Layer instance |
Procedure setting map position (center) and zoom to show the active track completely on the map.
Definition at line 853 of file track_layer.bas.
SUB_CDECL track_layer_set_loader | ( | BYVAL_AS_TrackLayer_PTR | Lay, |
BYVAL_AS_TrackLoader_PTR | Loa | ||
) |
Set active track.
Lay | Layer instance |
Loa | Track to activate (or NULL) |
Procedure receiving a track to make it the active one. When Loa is NULL, no track is active.
Definition at line 875 of file track_layer.bas.
SUB_CDECL track_layer_redraw | ( | BYVAL_AS_TrackLayer_PTR | Lay | ) |
Redraw surface.
Lay | Layer instance |
Procedure forcing a redraw of the TrackLayerPriv.Surface, ie to show adapted track settings.
Definition at line 897 of file track_layer.bas.
FUNCTION_CDECL_AS_gint track_layer_get_point | ( | BYVAL_AS_TrackLayer_PTR | Lay | ) |
Get current point in active track.
Lay | Layer instance |
When the TrackLayer holds an active track, a current point in that track can get centered on the map. This function provides the point index (0 <= p# <= AZ).
Definition at line 915 of file track_layer.bas.
SUB_CDECL track_layer_set_point | ( | BYVAL_AS_TrackLayer_PTR | Lay, |
BYVAL_AS_gint | N | ||
) |
Set current point in active track.
Lay | Layer instance |
N | New current point index |
When the TrackLayer holds an active track, a current point in that track can get centered on the map. This function sets a point index to for the next current point. The N parameter gets clamped to the allowed range (0 <= N <= AZ).
Definition at line 935 of file track_layer.bas.
SUB_CDECL track_layer_set_bbox | ( | BYVAL_AS_TrackLayer_PTR | Lay, |
BYVAL_AS_float | La0, | ||
BYVAL_AS_float | La1, | ||
BYVAL_AS_float | Lo0, | ||
BYVAL_AS_float | Lo1 | ||
) |
Set map segment to the given bounding box.
Lay | Layer instance |
La0 | Top latitude [radians] |
La1 | Bottom latitude [radians] |
Lo0 | Left longitude [radians] |
Lo1 | Right longitude [radians] |
Procedure setting the map center and zoom in order to show a given rectangle.
Definition at line 964 of file track_layer.bas.
SUB_CDECL track_layer_point_move | ( | BYVAL_AS_TrackLayer_PTR | Lay, |
BYVAL_AS_gchar_PTR | S | ||
) |
Move current point.
Lay | Layer instance |
S | Movement type |
Procedure adapting the index of the current point, showing that new current point centered on the map (at current zoom level).
Definition at line 988 of file track_layer.bas.
|
static |
Array of default setting for loaded tracks.
Definition at line 25 of file track_layer.bas.