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 |
} |