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/globals.h (+10 lines)
Lines 6-15 Link Here
6
#include <gtk/gtk.h>
6
#include <gtk/gtk.h>
7
#include <gconf/gconf-client.h>
7
#include <gconf/gconf-client.h>
8
8
9
9
#define GCONF "/apps/tangogps"
10
#define GCONF "/apps/tangogps"
10
#define TILESIZE 256
11
#define TILESIZE 256
11
#define PNAME "tangogps"
12
#define PNAME "tangogps"
12
13
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
13
typedef struct {
23
typedef struct {
14
	float lat;
24
	float lat;
15
	float lon;
25
	float lon;
(-)tangogps-0.9.6/src/init.c (+21 lines)
Lines 479-484 Link Here
479
		repo_t *repo3 = g_new0(repo_t, 1);
479
		repo_t *repo3 = g_new0(repo_t, 1);
480
		repo_t *repo4 = g_new0(repo_t, 1);
480
		repo_t *repo4 = g_new0(repo_t, 1);
481
		repo_t *repo5 = g_new0(repo_t, 1);
481
		repo_t *repo5 = g_new0(repo_t, 1);
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);
482
485
483
		
486
		
484
		printf("REPOLIST == NULL\n");
487
		printf("REPOLIST == NULL\n");
Lines 511-516 Link Here
511
		repo5->dir  = g_strdup_printf("%s/Maps/googlesat",global_home_dir);
514
		repo5->dir  = g_strdup_printf("%s/Maps/googlesat",global_home_dir);
512
		repo5->inverted_zoom = 1;
515
		repo5->inverted_zoom = 1;
513
		global_repo_list = g_slist_append(global_repo_list, repo5);
516
		global_repo_list = g_slist_append(global_repo_list, repo5);
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);
514
		
535
		
515
	}
536
	}
516
	
537
	
(-)tangogps-0.9.6/src/map_management.c (-12 / +37 lines)
Lines 144-149 Link Here
144
	int offset_yn = 0;
144
	int offset_yn = 0;
145
	int offset_x;
145
	int offset_x;
146
	int offset_y;
146
	int offset_y;
147
    int yandex_offset_y=0;
148
    int yandex_offset_x=0;
147
	gboolean success = FALSE;
149
	gboolean success = FALSE;
148
	GError **error = NULL;
150
	GError **error = NULL;
149
	repo_t *repo = g_new0(repo_t, 1);
151
	repo_t *repo = g_new0(repo_t, 1);
Lines 155-164 Link Here
155
	
157
	
156
	repo = global_curr_repo->data;
158
	repo = global_curr_repo->data;
157
	printf("---repo dir: %s \n",g_strdup(repo->dir));
159
	printf("---repo dir: %s \n",g_strdup(repo->dir));
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;
162
	if (offset_x > 0) offset_x -= 256;
184
	if (offset_x > 0) offset_x -= 256;
163
	if (offset_y > 0) offset_y -= 256;
185
	if (offset_y > 0) offset_y -= 256;
164
	
186
	
Lines 178-185 Link Here
178
	
200
	
179
201
180
	
202
	
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);
183
	
205
	
184
	
206
	
185
	
207
	
Lines 210-225 Link Here
210
					TILESIZE,TILESIZE);
232
					TILESIZE,TILESIZE);
211
				
233
				
212
			}
234
			}
213
			else
235
            else
214
			{
236
            {
215
				load_tile(
237
                load_tile(
216
					repo->dir,
238
					repo->dir,
217
					zoom,
239
					zoom,
218
					i,j,
240
					i,j,
219
					offset_xn,offset_yn);
241
					offset_xn,offset_yn);
220
			}
242
			}
221
			offset_yn += TILESIZE;
243
            offset_yn += TILESIZE;
244
222
		}
245
		}
246
        
223
		offset_xn += TILESIZE;
247
		offset_xn += TILESIZE;
224
		offset_yn = offset_y;
248
		offset_yn = offset_y;
225
	}
249
	}
Lines 253-260 Link Here
253
277
254
	pixel_y = lat2pixel(zoom, lat);
278
	pixel_y = lat2pixel(zoom, lat);
255
279
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
	
258
	
283
	
259
	fill_tiles_pixel (pixel_x, pixel_y, zoom);
284
	fill_tiles_pixel (pixel_x, pixel_y, zoom);
260
}
285
}

Return to bug 290026