Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 207837 Details for
Bug 290026
sci-geosciences/tangogps: improving application (add kilometer grid and WGS-84 Merkator projection)
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
This patch improves the tangogps
tangogps_grid_yandex.patch (text/plain), 8.44 KB, created by
Alexey Kharikovsky
on 2009-10-21 15:59:31 UTC
(
hide
)
Description:
This patch improves the tangogps
Filename:
MIME Type:
Creator:
Alexey Kharikovsky
Created:
2009-10-21 15:59:31 UTC
Size:
8.44 KB
patch
obsolete
>diff -r -U 0 tangogps-0.9.6/src/callbacks.c tango_my/src/callbacks.c >--- tangogps-0.9.6/src/callbacks.c 2009-02-05 02:54:26.000000000 +0300 >+++ tango_my/src/callbacks.c 2009-10-20 16:15:18.000000000 +0400 >@@ -478,0 +479,61 @@ >+//---------horiz line grid---------- >+ char i, temp[2][25],temp_pow[4]=""; >+ float lat[5],lon[2]; >+ for (i=0;i<5;i++) >+ lat[i]=pixel2lat(global_zoom,global_y+widget->allocation.height/4*i); >+ //lat[0]=TOP,lat[1]=1/4, ...1/2, 3/4, BOTTOM >+ lon[0]=pixel2lon(global_zoom,global_x);//LEFT >+ lon[1]=pixel2lon(global_zoom,global_x+widget->allocation.width);//RIGHT >+ float grid_dimension_h[2]; >+ grid_dimension_h[0]=get_distance(lat[0],lon[0],lat[0],lon[1])/4; >+ grid_dimension_h[1]=get_distance(lat[4],lon[0],lat[4],lon[1])/4; >+ if (grid_dimension_h[0]>1) >+ { >+ strcat(temp_pow," km"); >+ } >+ else >+ { >+ grid_dimension_h[0]=grid_dimension_h[0]*1000; >+ grid_dimension_h[1]=grid_dimension_h[1]*1000; >+ strcat(temp_pow," m"); >+ } >+ for (i=0;i<2;i++) >+ { >+ if (grid_dimension_h[i]<10) >+ sprintf(temp[i],"%1.1f",grid_dimension_h[i]); >+ else >+ sprintf(temp[i],"%4d",(int)grid_dimension_h[i]); >+ strcat(temp[i],temp_pow); >+ } >+ >+ for (i=0;i<4;i++) >+ { >+ if (i!=0) >+ gdk_draw_line (widget->window, >+ widget->style->black_gc, >+ widget->allocation.width/4*i,0, >+ widget->allocation.width/4*i,widget->allocation.height >+ ); >+ gtk_label_set_text(label_grid_h[0][i],temp[0]); >+ gtk_label_set_text(label_grid_h[1][i],temp[1]); >+ } >+ >+//--------vert line grid----------- >+ for (i=0;i<4;i++) >+ { >+ if (i!=0) >+ gdk_draw_line (widget->window, >+ widget->style->black_gc, >+ 0,widget->allocation.height/4*i, >+ widget->allocation.width,widget->allocation.height/4*i >+ ); >+ grid_dimension_h[0]=get_distance(lat[i],lon[0],lat[i+1],lon[0]); >+ if (strstr(temp_pow," m")!=NULL) grid_dimension_h[0]=grid_dimension_h[0]*1000; >+ if (grid_dimension_h[0]<10) >+ sprintf(temp,"%1.1f",grid_dimension_h[0]); >+ else >+ sprintf(temp,"%4d",(int)grid_dimension_h[0]); >+ strcat(temp,temp_pow); >+ gtk_label_set_text(label_grid_v[i],temp); >+ } >+//-------end grid draw------------- >diff -r -U 0 tangogps-0.9.6/src/globals.h tango_my/src/globals.h >--- tangogps-0.9.6/src/globals.h 2009-02-01 18:34:06.000000000 +0300 >+++ tango_my/src/globals.h 2009-09-07 14:16:52.000000000 +0400 >@@ -8,0 +9 @@ >+ >@@ -12,0 +14,9 @@ >+#define YANDEX_Rn (6378137.0) >+#define YANDEX_E (0.0818191908426) >+#define YANDEX_A (20037508.342789) >+#define YANDEX_F (53.5865938) >+#define YANDEX_AB (0.00335655146887969400) >+#define YANDEX_BB (0.00000657187271079536) >+#define YANDEX_CB (0.00000001764564338702) >+#define YANDEX_DB (0.00000000005328478445) >+ >diff -r -U 0 tangogps-0.9.6/src/init.c tango_my/src/init.c >--- tangogps-0.9.6/src/init.c 2009-02-05 02:54:26.000000000 +0300 >+++ tango_my/src/init.c 2009-09-11 13:49:27.000000000 +0400 >@@ -481,0 +482,3 @@ >+ repo_t *repo6 = g_new0(repo_t, 1); >+ repo_t *repo7 = g_new0(repo_t, 1); >+ repo_t *repo8 = g_new0(repo_t, 1); >@@ -513,0 +517,18 @@ >+ >+ repo6->name = g_strdup("Google Map"); >+ repo6->uri = g_strdup("http://mt1.google.com/vt/v=w2.101&hl=ru&x=%d&y=%d&z=%d"); >+ repo6->dir = g_strdup_printf("%s/Maps/googlemap",global_home_dir); >+ repo6->inverted_zoom = 1; >+ global_repo_list = g_slist_append(global_repo_list, repo6); >+ >+ repo7->name = g_strdup("Yandex Sat"); >+ repo7->uri = g_strdup("http://sat01.maps.yandex.ru/tiles?l=sat&v=1.10.0&x=%d&y=%d&z=%d"); >+ repo7->dir = g_strdup_printf("%s/Maps/yandexsat",global_home_dir); >+ repo7->inverted_zoom = 1; >+ global_repo_list = g_slist_append(global_repo_list, repo7); >+ >+ repo8->name = g_strdup("Yandex Map"); >+ repo8->uri = g_strdup("http://vec01.maps.yandex.ru/tiles?l=map&v=2.7.1&x=%d&y=%d&z=%d"); >+ repo8->dir = g_strdup_printf("%s/Maps/yandexmap",global_home_dir); >+ repo8->inverted_zoom = 1; >+ global_repo_list = g_slist_append(global_repo_list, repo8); >diff -r -U 0 tangogps-0.9.6/src/interface.c tango_my/src/interface.c >--- tangogps-0.9.6/src/interface.c 2009-02-05 02:54:27.000000000 +0300 >+++ tango_my/src/interface.c 2009-10-20 18:46:12.349655992 +0400 >@@ -45 +44,0 @@ >- GtkWidget *hbox1; >@@ -328,3 +327,18 @@ >- hbox1 = gtk_hbox_new (FALSE, 0); >- gtk_widget_show (hbox1); >- gtk_box_pack_start (GTK_BOX (vbox1), hbox1, TRUE, TRUE, 0); >+//---------label for grid >+ GtkWidget *draw_table=gtk_table_new(6,6,FALSE); >+ gtk_widget_show(draw_table); >+ gtk_container_add (GTK_CONTAINER(vbox1),draw_table); >+ char i; >+ for (i=1;i<5;i++) >+ { >+ label_grid_h[0][i-1]=gtk_label_new(""); >+ label_grid_h[1][i-1]=gtk_label_new(""); >+ label_grid_v[i-1]=gtk_label_new(""); >+ gtk_table_attach (draw_table,label_grid_h[0][i-1],i,i+1,0,1,GTK_EXPAND,0,0,0); >+ gtk_table_attach (draw_table,label_grid_h[1][i-1],i,i+1,5,6,GTK_EXPAND,0,0,0); >+ gtk_table_attach (draw_table,label_grid_v[i-1],0,1,i,i+1,0,GTK_EXPAND,0,0); >+ gtk_widget_show (label_grid_h[0][i-1]); >+ gtk_widget_show (label_grid_h[1][i-1]); >+ gtk_widget_show (label_grid_v[i-1]); >+ } >+//---------label for grid >@@ -332 +346 @@ >- drawingarea1 = gtk_drawing_area_new (); >+drawingarea1 = gtk_drawing_area_new (); >@@ -334 +348 @@ >- gtk_box_pack_start (GTK_BOX (hbox1), drawingarea1, TRUE, TRUE, 0); >+ gtk_table_attach (draw_table,drawingarea1,1,5,1,5,GTK_EXPAND|GTK_FILL|GTK_SHRINK,GTK_EXPAND|GTK_FILL|GTK_SHRINK,0,0); >@@ -340 +354 @@ >- gtk_box_pack_start (GTK_BOX (hbox1), vscale1, FALSE, TRUE, 0); >+ gtk_table_attach (draw_table,vscale1,5,6,0,6,0,GTK_EXPAND|GTK_FILL,0,0); >@@ -1617 +1631 @@ >- GLADE_HOOKUP_OBJECT (window1, hbox1, "hbox1"); >+ GLADE_HOOKUP_OBJECT (window1, draw_table, "draw_table"); >diff -r -U 0 tangogps-0.9.6/src/interface.h tango_my/src/interface.h >--- tangogps-0.9.6/src/interface.h 2009-02-04 23:55:07.000000000 +0300 >+++ tango_my/src/interface.h 2009-10-16 20:50:28.000000000 +0400 >@@ -30,0 +31,2 @@ >+ GtkWidget *label_grid_h[2][4]; >+ GtkWidget *label_grid_v[4]; >diff -r -U 0 tangogps-0.9.6/src/map_management.c tango_my/src/map_management.c >--- tangogps-0.9.6/src/map_management.c 2009-02-05 02:54:27.000000000 +0300 >+++ tango_my/src/map_management.c 2009-09-11 17:46:33.000000000 +0400 >@@ -146,0 +147,2 @@ >+ int yandex_offset_y=0; >+ int yandex_offset_x=0; >@@ -158,4 +160,24 @@ >- >- >- offset_x = - pixel_x % TILESIZE; >- offset_y = - pixel_y % TILESIZE; >+ >+//--------------Yandex repository offset ------------------------ >+ if (strstr(repo->name,"Yandex")!=NULL) >+ { >+ float lat=rad2deg(pixel2lat((float)zoom,pixel_y)); >+ float lon=rad2deg(pixel2lon((float)zoom,pixel_x)); >+//----Shmuma autor--- >+ float tmp = tan (M_PI_4 + deg2rad (lat) / 2.0); >+ float pow_tmp = pow (tan (M_PI_4 + asin (YANDEX_E * sin (deg2rad (lat))) / 2.0), YANDEX_E); >+ int unitx = (int)((YANDEX_Rn * deg2rad (lon) + YANDEX_A) * YANDEX_F)>>(23-zoom); >+ int unity = (int)((YANDEX_A - (YANDEX_Rn * log (tmp / pow_tmp))) * YANDEX_F)>>(23-zoom); >+ yandex_offset_y = unity-pixel_y; >+ yandex_offset_x = unitx-pixel_x; >+ printf("\n\nYANDEX_OFFSET_Y = %d, YANDEX_OFFSET_X = %d\n\n\n",yandex_offset_y,yandex_offset_x); >+ } >+ else >+ { >+ yandex_offset_y = 0; >+ yandex_offset_x = 0; >+ } >+//--------------Yandex repository offset ------------------------ >+ >+ offset_x = - (pixel_x + yandex_offset_x) % TILESIZE; >+ offset_y = - (pixel_y + yandex_offset_y) % TILESIZE; >@@ -181,2 +203,2 @@ >- tile_x0 = floor((float)pixel_x / (float)TILESIZE); >- tile_y0 = floor((float)pixel_y / (float)TILESIZE); >+ tile_x0 = floor((float)(pixel_x + yandex_offset_x) / (float)TILESIZE); >+ tile_y0 = floor((float)(pixel_y + yandex_offset_y) / (float)TILESIZE); >@@ -213,3 +235,3 @@ >- else >- { >- load_tile( >+ else >+ { >+ load_tile( >@@ -221 +243,2 @@ >- offset_yn += TILESIZE; >+ offset_yn += TILESIZE; >+ >@@ -222,0 +246 @@ >+ >@@ -256,2 +280,3 @@ >- printf("fill_tiles_latlon(): lat %f %i -- lon %f %i\n", >- lat,pixel_y,lon,pixel_x); >+ >+ printf("fill_tiles_latlon(): lat %f %i -- lon %f %i\n",lat,pixel_y,lon,pixel_x); >+
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 290026
: 207837 |
211704
|
211706