Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 290026 | Differences between
and this patch

Collapse All | Expand All

(-)tangogps-0.9.6/src/callbacks.c (+61 lines)
Line 478 Link Here
479
//---------horiz line grid----------
480
    char i, temp[2][25],temp_pow[4]="";
481
    float lat[5],lon[2];
482
    for (i=0;i<5;i++)
483
        lat[i]=pixel2lat(global_zoom,global_y+widget->allocation.height/4*i);
484
        //lat[0]=TOP,lat[1]=1/4, ...1/2, 3/4, BOTTOM
485
    lon[0]=pixel2lon(global_zoom,global_x);//LEFT
486
    lon[1]=pixel2lon(global_zoom,global_x+widget->allocation.width);//RIGHT
487
    float grid_dimension_h[2];
488
    grid_dimension_h[0]=get_distance(lat[0],lon[0],lat[0],lon[1])/4;
489
    grid_dimension_h[1]=get_distance(lat[4],lon[0],lat[4],lon[1])/4;
490
    if (grid_dimension_h[0]>1)
491
    {
492
        strcat(temp_pow," km");
493
    }
494
    else 
495
    {
496
        grid_dimension_h[0]=grid_dimension_h[0]*1000;
497
        grid_dimension_h[1]=grid_dimension_h[1]*1000;
498
        strcat(temp_pow," m");
499
    }
500
    for (i=0;i<2;i++)
501
    {
502
        if (grid_dimension_h[i]<10)
503
            sprintf(temp[i],"%1.1f",grid_dimension_h[i]);
504
        else    
505
            sprintf(temp[i],"%4d",(int)grid_dimension_h[i]);
506
        strcat(temp[i],temp_pow);
507
    }
508
509
    for (i=0;i<4;i++)
510
    {
511
        if (i!=0)
512
            gdk_draw_line (widget->window,
513
                      widget->style->black_gc,
514
                      widget->allocation.width/4*i,0,
515
                      widget->allocation.width/4*i,widget->allocation.height
516
                      );
517
        gtk_label_set_text(label_grid_h[0][i],temp[0]);    
518
        gtk_label_set_text(label_grid_h[1][i],temp[1]);    
519
    }
520
521
//--------vert line grid-----------
522
    for (i=0;i<4;i++)
523
    {
524
        if (i!=0)
525
            gdk_draw_line (widget->window,
526
                          widget->style->black_gc,
527
                          0,widget->allocation.height/4*i,
528
                          widget->allocation.width,widget->allocation.height/4*i
529
                          );
530
        grid_dimension_h[0]=get_distance(lat[i],lon[0],lat[i+1],lon[0]);
531
        if (strstr(temp_pow," m")!=NULL) grid_dimension_h[0]=grid_dimension_h[0]*1000;
532
        if (grid_dimension_h[0]<10)
533
            sprintf(temp,"%1.1f",grid_dimension_h[0]);
534
        else    
535
            sprintf(temp,"%4d",(int)grid_dimension_h[0]);
536
        strcat(temp,temp_pow);
537
        gtk_label_set_text(label_grid_v[i],temp);    
538
    }
539
//-------end grid draw-------------
(-)tangogps-0.9.6/src/globals.h (+10 lines)
Line 8 Link Here
9
Line 12 Link Here
14
#define YANDEX_Rn (6378137.0)
15
#define YANDEX_E (0.0818191908426)
16
#define YANDEX_A (20037508.342789)
17
#define YANDEX_F (53.5865938)
18
#define YANDEX_AB (0.00335655146887969400)
19
#define YANDEX_BB (0.00000657187271079536)
20
#define YANDEX_CB (0.00000001764564338702)
21
#define YANDEX_DB (0.00000000005328478445)
22
(-)tangogps-0.9.6/src/init.c (+21 lines)
Line 481 Link Here
482
		repo_t *repo6 = g_new0(repo_t, 1);
483
		repo_t *repo7 = g_new0(repo_t, 1);
484
		repo_t *repo8 = g_new0(repo_t, 1);
Line 513 Link Here
517
518
		repo6->name = g_strdup("Google Map");
519
		repo6->uri  = g_strdup("http://mt1.google.com/vt/v=w2.101&hl=ru&x=%d&y=%d&z=%d");
520
		repo6->dir  = g_strdup_printf("%s/Maps/googlemap",global_home_dir);
521
		repo6->inverted_zoom = 1;
522
		global_repo_list = g_slist_append(global_repo_list, repo6);
523
524
		repo7->name = g_strdup("Yandex Sat");
525
		repo7->uri  = g_strdup("http://sat01.maps.yandex.ru/tiles?l=sat&v=1.10.0&x=%d&y=%d&z=%d");
526
		repo7->dir  = g_strdup_printf("%s/Maps/yandexsat",global_home_dir);
527
		repo7->inverted_zoom = 1;
528
		global_repo_list = g_slist_append(global_repo_list, repo7);
529
530
		repo8->name = g_strdup("Yandex Map");
531
		repo8->uri  = g_strdup("http://vec01.maps.yandex.ru/tiles?l=map&v=2.7.1&x=%d&y=%d&z=%d");
532
		repo8->dir  = g_strdup_printf("%s/Maps/yandexmap",global_home_dir);
533
		repo8->inverted_zoom = 1;
534
		global_repo_list = g_slist_append(global_repo_list, repo8);
(-)tangogps-0.9.6/src/interface.c (-8 / +22 lines)
Line 45 Link Here
45
  GtkWidget *hbox1;
Lines 328-330 Link Here
328
  hbox1 = gtk_hbox_new (FALSE, 0);
327
//---------label for grid
329
  gtk_widget_show (hbox1);
328
    GtkWidget *draw_table=gtk_table_new(6,6,FALSE);
330
  gtk_box_pack_start (GTK_BOX (vbox1), hbox1, TRUE, TRUE, 0);
329
    gtk_widget_show(draw_table);
330
    gtk_container_add (GTK_CONTAINER(vbox1),draw_table);
331
    char i;
332
    for (i=1;i<5;i++)
333
        {
334
            label_grid_h[0][i-1]=gtk_label_new("");
335
            label_grid_h[1][i-1]=gtk_label_new("");
336
            label_grid_v[i-1]=gtk_label_new("");
337
            gtk_table_attach (draw_table,label_grid_h[0][i-1],i,i+1,0,1,GTK_EXPAND,0,0,0);
338
            gtk_table_attach (draw_table,label_grid_h[1][i-1],i,i+1,5,6,GTK_EXPAND,0,0,0);
339
            gtk_table_attach (draw_table,label_grid_v[i-1],0,1,i,i+1,0,GTK_EXPAND,0,0);
340
            gtk_widget_show (label_grid_h[0][i-1]);
341
            gtk_widget_show (label_grid_h[1][i-1]);
342
            gtk_widget_show (label_grid_v[i-1]);
343
        }
344
//---------label for grid
Line 332 Link Here
332
  drawingarea1 = gtk_drawing_area_new ();
346
drawingarea1 = gtk_drawing_area_new ();
Line 334 Link Here
334
  gtk_box_pack_start (GTK_BOX (hbox1), drawingarea1, TRUE, TRUE, 0);
348
  gtk_table_attach (draw_table,drawingarea1,1,5,1,5,GTK_EXPAND|GTK_FILL|GTK_SHRINK,GTK_EXPAND|GTK_FILL|GTK_SHRINK,0,0);
Line 340 Link Here
340
  gtk_box_pack_start (GTK_BOX (hbox1), vscale1, FALSE, TRUE, 0);
354
  gtk_table_attach (draw_table,vscale1,5,6,0,6,0,GTK_EXPAND|GTK_FILL,0,0);
Line 1617 Link Here
1617
  GLADE_HOOKUP_OBJECT (window1, hbox1, "hbox1");
1631
  GLADE_HOOKUP_OBJECT (window1, draw_table, "draw_table");
(-)tangogps-0.9.6/src/interface.h (+2 lines)
Line 30 Link Here
31
    GtkWidget *label_grid_h[2][4];
32
    GtkWidget *label_grid_v[4];
(-)tangogps-0.9.6/src/map_management.c (-12 / +37 lines)
Line 146 Link Here
147
    int yandex_offset_y=0;
148
    int yandex_offset_x=0;
Lines 158-161 Link Here
158
	
160
159
	
161
//--------------Yandex repository offset ------------------------
160
	offset_x = - pixel_x % TILESIZE;
162
    if (strstr(repo->name,"Yandex")!=NULL)
161
	offset_y = - pixel_y % TILESIZE;
163
	    {
164
            float lat=rad2deg(pixel2lat((float)zoom,pixel_y));
165
            float lon=rad2deg(pixel2lon((float)zoom,pixel_x));
166
//----Shmuma autor---
167
            float tmp = tan (M_PI_4 + deg2rad (lat) / 2.0);
168
            float pow_tmp = pow (tan (M_PI_4 +  asin (YANDEX_E * sin (deg2rad (lat))) / 2.0), YANDEX_E);
169
            int unitx = (int)((YANDEX_Rn * deg2rad (lon) + YANDEX_A) * YANDEX_F)>>(23-zoom);
170
            int unity = (int)((YANDEX_A - (YANDEX_Rn * log (tmp / pow_tmp))) * YANDEX_F)>>(23-zoom);
171
            yandex_offset_y = unity-pixel_y;
172
            yandex_offset_x = unitx-pixel_x;
173
            printf("\n\nYANDEX_OFFSET_Y = %d, YANDEX_OFFSET_X = %d\n\n\n",yandex_offset_y,yandex_offset_x);
174
        }
175
    else
176
        {
177
            yandex_offset_y = 0;
178
            yandex_offset_x = 0;
179
        }
180
//--------------Yandex repository offset ------------------------
181
182
	offset_x = - (pixel_x + yandex_offset_x) % TILESIZE;
183
	offset_y = - (pixel_y + yandex_offset_y) % TILESIZE;
Lines 181-182 Link Here
181
	tile_x0 =  floor((float)pixel_x / (float)TILESIZE);
203
	tile_x0 =  floor((float)(pixel_x + yandex_offset_x) / (float)TILESIZE);
182
	tile_y0 =  floor((float)pixel_y / (float)TILESIZE);
204
	tile_y0 =  floor((float)(pixel_y + yandex_offset_y) / (float)TILESIZE);
Lines 213-215 Link Here
213
			else
235
            else
214
			{
236
            {
215
				load_tile(
237
                load_tile(
Line 221 Link Here
221
			offset_yn += TILESIZE;
243
            offset_yn += TILESIZE;
244
Line 222 Link Here
246
        
Lines 256-257 Link Here
256
	printf("fill_tiles_latlon(): lat %f  %i -- lon %f  %i\n",
280
 
257
	lat,pixel_y,lon,pixel_x);
281
	printf("fill_tiles_latlon(): lat %f  %i -- lon %f  %i\n",lat,pixel_y,lon,pixel_x);
282
	

Return to bug 290026