예제 #1
0
파일: area_edit.cpp 프로젝트: AMDmi3/osm2go
static gboolean map_gps_update(gpointer data) {
  area_context_t *context = static_cast<area_context_t *>(data);

  pos_t pos = context->area.gps_state->get_pos();

  if(pos.valid()) {
    g_object_set(context->map.widget, "gps-track-highlight-radius", 0, nullptr);
    osm_gps_map_gps_add(context->map.widget, pos.lat, pos.lon, NAN);
  } else
    osm_gps_map_gps_clear(context->map.widget);

  return TRUE;
}
예제 #2
0
static gboolean
on_button_press_event (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
{
    OsmGpsMapPoint coord;
    float lat, lon;
    OsmGpsMap *map = OSM_GPS_MAP(widget);
    OsmGpsMapTrack *othertrack = OSM_GPS_MAP_TRACK(user_data);

    if (event->type == GDK_3BUTTON_PRESS) {
        if (event->button == 1) {
            if (g_last_image)
                osm_gps_map_image_remove (map, g_last_image);
        }
        if (event->button == 3) {
            osm_gps_map_track_remove(map, othertrack);
        }
    }

    if (event->type == GDK_2BUTTON_PRESS) {
        osm_gps_map_convert_screen_to_geographic(map, event->x, event->y, &coord);
        osm_gps_map_point_get_degrees(&coord, &lat, &lon);
        if (event->button == 1) {
            osm_gps_map_gps_add (map,
                                 lat,
                                 lon,
                                 g_random_double_range(0,360));
        }
        if (event->button == 3) {
            osm_gps_map_track_add_point(othertrack, &coord);
        }
    }

    if (event->type == GDK_BUTTON_PRESS) {
        if (event->button == 2) {
        osm_gps_map_convert_screen_to_geographic(map, event->x, event->y, &coord);
        osm_gps_map_point_get_degrees(&coord, &lat, &lon);
            g_last_image = osm_gps_map_image_add (
                                    map,
                                    lat,
                                    lon,
                                    g_star_image);
        }
    }
    return FALSE;
}
예제 #3
0
static gboolean
on_button_press_event (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
{
    OsmGpsMapPoint coord;
    float lat, lon;
    OsmGpsMap *map = OSM_GPS_MAP(widget);

double dist;
double lat1,lon1;

    if (event->type == GDK_2BUTTON_PRESS) {
        osm_gps_map_convert_screen_to_geographic(map, event->x, event->y, &coord);
        osm_gps_map_point_get_degrees(&coord, &lat, &lon);
	fprintf(stderr, "lat %f lon %f\n",lat,lon);
lat1=(double)lat;
lon1=(double)lon;
//send the function using last latitude,longitude and present latitude and longitude
if(k==0)
{
k=1;
dist=distance(0,0);
fprintf(stderr, "distance betwwn two points %f", dist);
lastlat=lat1;
lastlon=lon1;
}
else
{
dist=distance(lat1,lon1);
fprintf(stderr, "distance betwwn two points %f", dist);
//i=i+1;
}
        if (event->button == 1) {
            osm_gps_map_gps_add (map,lat,lon,g_random_double_range(0,360));
        }
    }

    	
    return FALSE;
}
예제 #4
0
/**
 * osm_gps_map_draw_gps:
 *
 * Deprecated: 0.7.0: Use osm_gps_map_gps_add() instead.
 **/
void
osm_gps_map_draw_gps (OsmGpsMap *map, float latitude, float longitude, float heading)
{
    g_warning("%s is deprecated", G_STRFUNC);
    osm_gps_map_gps_add (map, latitude, longitude, heading);
}