gboolean show_location;
gboolean show_velvec;
gboolean show_markers;
+ gboolean show_speed;
+ gboolean rotate_view;
+ gfloat rotate_angle;
guint draw_width;
static void gtk_map_scale_draw(GtkWidget *widget, GdkEventExpose *event);
static void gtk_map_mark_draw(GtkWidget *widget, GdkEventExpose *event);
+static void gtk_map_speed_draw(GtkWidget *widget, GdkEventExpose *event);
+
+static void gtk_map_render_markers(GtkWidget *widget, GdkEventExpose *event);
+static void gtk_map_render_paths(GtkWidget *widget, GdkEventExpose *event);
static gboolean gtk_map_update_buffer_size(GtkWidget *widget, gint new_width, gint new_height);
static void gtk_map_update_size(GtkWidget *widget, gint width, gint height);
priv->show_markers=TRUE;
priv->show_location=TRUE;
+priv->rotate_angle=M_PI;
+priv->rotate_view=TRUE;
+
priv->gl=FALSE;
priv->buffer=NULL;
}
#endif
g_debug("GTKMAP: expose (%d, %d)-(%d, %d)", event->area.x, event->area.y, event->area.width, event->area.height);
+g_debug("GTKMAP: expose (%d, %d)", event->area.x + priv->offsetx, event->area.y + priv->offsety);
+g_debug("GTKMAP: expose (%d, %d)", unit2x(priv->center.unitx), unit2y(priv->center.unity));
-if (priv->buffer)
+if (priv->buffer) {
+#ifdef WITH_CAIRO
+ cairo_save(priv->ct);
+ cairo_rectangle(priv->ct, event->area.x, event->area.y, event->area.width, event->area.height);
+ cairo_clip(priv->ct);
+ cairo_translate(priv->ct, -(event->area.x+priv->offsetx), -(event->area.y+priv->offsety));
+#if 0
+ if (priv->rotate_view) {
+ cairo_translate(priv->ct, (gdouble)-unit2x(priv->center.unitx), (gdouble)-unit2y(priv->center.unity) );
+ cairo_rotate(priv->ct, (gdouble)priv->rotate_angle);
+ cairo_translate(priv->ct, (gdouble)unit2x(priv->center.unitx), (gdouble)unit2y(priv->center.unity) );
+ }
+#endif
+#if 0
+ if (priv->animate_zoom_change) {
+ cairo_scale(priv->ct, 0.5, 0.5);
+ }
+#endif
+ gdk_cairo_set_source_pixmap(priv->ct, priv->buffer, event->area.x, event->area.y);
+ cairo_set_operator (priv->ct, CAIRO_OPERATOR_SOURCE);
+ cairo_paint(priv->ct);
+ cairo_restore(priv->ct);
+#else
gdk_draw_drawable(widget->window, widget->style->fg_gc[GTK_STATE_NORMAL], priv->buffer,
event->area.x + priv->offsetx, event->area.y + priv->offsety,
event->area.x, event->area.y, event->area.width, event->area.height);
+#endif
+}
-#if 0
-gtk_map_paths_draw(widget, event);
+if (priv->show_paths!=0)
+ gtk_map_render_paths(widget, event);
if (priv->show_markers)
- gtk_map_markers_draw(widget, event);
+ gtk_map_render_markers(widget, event);
if (priv->show_speed)
gtk_map_speed_draw(widget, event);
-#endif
if (priv->show_location)
gtk_map_mark_draw(widget, event);
return TRUE;
}
+static void
+gtk_map_render_markers(GtkWidget *widget, GdkEventExpose *event)
+{
+
+}
+
static void
gtk_map_render_waypoint(GtkWidget *widget, guint x1, guint y1)
{
for (curr = path->head, wcurr = path->whead; curr++ != path->tail;) {
/* Draw the line from (curr - 1) to (curr). */
- gtk_map_render_segment(widget, curr[-1].unitx, curr[-1].unity, curr->unitx, curr->unity);
+ gtk_map_render_path_segment(widget, curr[-1].unitx, curr[-1].unity, curr->unitx, curr->unity);
/* Now, check if curr is a waypoint. */
if (wcurr && wcurr <= path->wtail && wcurr->point == curr) {
guint x1 = unit2bufx(wcurr->point->unitx);
wcurr++;
}
}
+#if 0
if (path->type==PATH_TYPE_ROUTE)
gtk_map_render_next_waypoint(widget, path);
+#endif
}
static void
GtkMap *map;
GtkMapPriv *priv;
-g_return_if_fail(GTK_IS_MAP(widget));
-g_return_if_fail(path);
+g_return_val_if_fail(GTK_IS_MAP(widget), FALSE);
+g_return_val_if_fail(path, FALSE);
map=GTK_MAP(widget);
priv=GTK_MAP_GET_PRIVATE(map);
GtkMap *map;
GtkMapPriv *priv;
-g_return_if_fail(GTK_IS_MAP(widget));
-g_return_if_fail(path);
+g_return_val_if_fail(GTK_IS_MAP(widget), FALSE);
+g_return_val_if_fail(path, FALSE);
map=GTK_MAP(widget);
priv=GTK_MAP_GET_PRIVATE(map);
return;
g_snprintf(buffer, sizeof(buffer), "%0.0f %s", priv->speed * priv->units_conv, priv->units_str);
-map_information_text(10, 10, priv->speed_gc, buffer);
+gtk_map_information_text(widget, 10, 10, priv->speed_gc, buffer);
}
void