Example #1
0
static void
popup_set_destination(struct navit *nav, struct pcoord *pc)
{
	struct coord c;
	struct coord_geo g;
	char buffer[1024];
	char buffer_geo[1024];
	c.x = pc->x;
	c.y = pc->y;
	transform_to_geo(transform_get_projection(navit_get_trans(nav)), &c, &g);
	coord_format(g.lat,g.lng,DEGREES_MINUTES_SECONDS,buffer_geo,sizeof(buffer_geo));
	sprintf(buffer,"Map Point %s", buffer_geo);
	navit_set_destination(nav, pc, buffer, 1);
}
Example #2
0
static void
popup_set_bookmark(struct navit *nav, struct pcoord *pc)
{
	struct coord c;
	struct coord_geo g;
	char buffer[1024];
	char buffer_geo[1024];
	c.x = pc->x;
	c.y = pc->y;
	transform_to_geo(pc->pro, &c, &g);
	coord_format(g.lat,g.lng,DEGREES_MINUTES_SECONDS,buffer_geo,sizeof(buffer_geo));
	sprintf(buffer,"Map Point %s", buffer_geo);
	if (!gui_add_bookmark(navit_get_gui(nav), pc, buffer)) 
		navit_add_bookmark(nav, pc, buffer);
}
Example #3
0
static void
dump_region_item(struct subdivision *sub, struct file *rgn, struct map_rect_priv *mr)
{
	int offset,item_offset,i,j;
	unsigned short count=0;
	unsigned short *offsets[4];
	unsigned short *file_offsets;
	struct rgn_point *pnt;

	offset=triple_u(&sub->rgn_offset)+mr->rgn_hdr->offset_len.offset;
	file_offsets=file_read(rgn, offset, 90*sizeof(unsigned short));
	printf("0x%x ", offset); dump_hex(file_offsets, 90);
	for (i=0 ; i < 4 ; i++) {
		printf("i=%d\n", i);
		if (sub->types & (0x10 << i)) {
			if (count) {	
				offsets[i]=&file_offsets[count-1];
			} else
				offsets[i]=&count;
			count++;
		} else
			offsets[i]=NULL;
		
	}
	count--;
	count*=2;
	for (i=0 ; i < 4 ; i++) {
		printf("i=%d\n", i);
		if (offsets[i]) {
			printf("offset[%d]=0x%x(%d)\n", i, *offsets[i], *offsets[i]);
			switch (i) {
			case 0:
				printf("point\n");
				break;
			case 1:
				printf("indexed point\n");
				break;
			case 2:
				printf("polyline\n");
				break;
			case 3:
				printf("polygon\n");
				break;
			}
			item_offset=offset+*offsets[i];
			switch (i) {
			case 0:
			case 1:
				for (j = 0 ; j < 10 ; j++) {
					struct coord_geo g;
					char buffer[1024];
					double conv=180.0/(1UL<<23);
					pnt=file_read(rgn, item_offset, sizeof(*pnt)*20);
					// printf("0x%x ", item_offset); dump_hex(pnt, 32);
					dump_point(pnt);
					g.lng=(triple(&sub->center.lng)+(pnt->lng_delta << shift))*conv;
					g.lat=(triple(&sub->center.lat)+(pnt->lat_delta << shift))*conv;
					printf("%f %f\n", g.lng, g.lat);
					coord_format(g.lat,g.lng,DEGREES_MINUTES_SECONDS,
						     buffer,sizeof(buffer));
					printf("%s\n", buffer);
					dump_label_offset(mr, triple_u(&pnt->lbl_offset));
					if (pnt->info & 0x80) 
						item_offset+=sizeof(*pnt);
					else
						item_offset+=sizeof(*pnt)-1;
				}
			}
		} else {
			printf("offset[%d] doesn't exist\n", i);
		}
	}
	file_free(file_offsets);
}