map=GTK_MAP(widget);
priv=GTK_MAP_GET_PRIVATE(map);
+
prev=path->head;
x1=unit2x(path->head->unitx);
y1=unit2y(path->head->unity);
break;
}
cairo_set_line_width(priv->ct, priv->draw_width);
-#if 0
cairo_rectangle(priv->ct, event->area.x, event->area.y, event->area.width, event->area.height);
cairo_clip(priv->ct);
-#endif
-cairo_move_to(priv->ct, x1, y1);
+#if 0
if (priv->rotate_view) {
- gtk_map_update_rotation_matrix(priv,unit2x(priv->center.unitx),unit2y(priv->center.unity) );
+ gtk_map_update_rotation_matrix(priv, unit2x(priv->center.unitx), unit2y(priv->center.unity));
cairo_set_matrix(priv->ct, &priv->matrix_rotate);
}
#endif
+cairo_move_to(priv->ct, x1, y1);
+#endif
for (curr=path->head, wcurr=path->whead; curr++!=path->tail;) {
+ if (!curr->unitx)
+ continue;
+
x2=unit2x(curr->unitx);
y2=unit2y(curr->unity);
cairo_line_to(priv->ct, x2, y2);
#else
gdk_draw_line(widget->window, priv->gc_track, x1, y1, x2, y2);
- x1=x2;
- y1=y2;
#endif
}
}
wcurr++;
}
prev=curr;
+ x1=x2;
+ y1=y2;
}
#if 0
if (path->type==PATH_TYPE_ROUTE)
};
static struct sql_select_stmt sql;
+/* Null point */
+Point point_null;
+
#define PATH_TABLE_PATHS "create table IF NOT EXISTS paths ( \
nid int primary key, \
name text not null, \
#define MACRO_PATH_INIT(path) { \
(path).head = (path).tail = g_new0(Point, ARRAY_CHUNK_SIZE); \
- *((path).tail) = _point_null; \
+ *((path).tail) = point_null; \
(path).cap = (path).head + ARRAY_CHUNK_SIZE; \
(path).whead = g_new0(WayPoint, ARRAY_CHUNK_SIZE); \
(path).wtail = (path).whead; \
object_class->finalize=path_finalize;
/* g_type_class_add_private (klass, sizeof(PathPrivate)); */
+memset(&point_null, 0, sizeof(point_null));
+
signals[NEW_POINT]=g_signal_new("new-point", G_OBJECT_CLASS_TYPE(object_class),
G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET(PathClass, new_point),
NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0, NULL);
latlon2unit(lat, lon, &unitx, &unity);
+/* Initial point */
+if (path->head==path->tail) {
+ MACRO_PATH_INCREMENT_TAIL(*path);
+ path->tail->unitx=unitx;
+ path->tail->unity=unity;
+ path->tail->time=ptime;
+ path->tail->altitude=altitude;
+ path->speed=speed;
+ path->points=1;
+ return TRUE;
+}
+
if (abs((gint)unitx-path->tail->unitx) > path->sensitivity || abs((gint)unity-path->tail->unity) > path->sensitivity) {
if (path->tail->unity && path->tail->unitx) {
gdouble plat, plon;
g_return_val_if_fail(path, FALSE);
g_return_val_if_fail(path->tail, FALSE);
+if (path->head==path->tail)
+ return FALSE;
+
if (path->tail->unity && path->tail->unitx) {
/* To mark a "break" in a track, we'll add a (0, 0) point and then
another instance of the most recent track point. */
MACRO_PATH_INCREMENT_TAIL(*path);
- *path->tail=_point_null;
+ *path->tail=point_null;
MACRO_PATH_INCREMENT_TAIL(*path);
*path->tail=path->tail[-2];