procedure sdvig; //реализация подгрузки тайлов
var x,y,sdv:word;
begin
sdv:=512; //число = количество сдвинутых тайлов*256
//******* смещаем карту по оси Х ********
if X_sdvig+Form1.left<2*256 then
begin
//смещаем карту на тайл
BitBlt(buf2.Canvas.Handle, sdv, 0, buf2.Width,buf2.Height,
buf.Canvas.Handle,0, 0, SRCCOPY);
//заполняем новыми тайлами
Title_X:=Title_X-2;
for x:=0 to 1 do
for y:=0 to buf_y do
begin
fileName:=pyt_k_kartam+'\maps.yandex.com.Map\z'+inttostr(z)+'\'+ inttostr((Title_X+x) div 1024)+'\x'+inttostr(Title_X+x)+'\'+ inttostr((Title_y+y) div 1024)+'\y'+inttostr(Title_Y+y)+'.png';
if FileExists(fileName)
then IMG.Picture.LoadFromFile(fileName)
else IMG.Picture.LoadFromFile(GetCurrentDir+'\404.png');
buf2.Canvas.Draw(x*256,256*(y),IMG.Picture.Graphic);
end;
buf.picture.bitmap.Assign(buf2.Picture);
X_sdvig:=X_sdvig+sdv;
if marker_flag=true then marker;
if svasy_marker_flag=true then svasy_marker;
exit;
end;
if X_sdvig+Form1.Width>(buf_x-2)*256 then
begin
//смещаем карту на тайл
BitBlt(buf2.Canvas.Handle, 0, 0, buf2.Width,buf2.Height,
buf.Canvas.Handle,sdv, 0, SRCCOPY);
//заполняем новыми тайлами
Title_X:=Title_X+2;
for x:=buf_x-2 to buf_x-1 do
for y:=0 to buf_y do
begin
fileName:=pyt_k_kartam+'\maps.yandex.com.Map\z'+inttostr(z)+'\'+ inttostr((Title_X+x) div 1024)+'\x'+inttostr(Title_X+x)+'\'+ inttostr((Title_y+y) div 1024)+'\y'+inttostr(Title_Y+y)+'.png';
if FileExists(fileName)
then IMG.Picture.LoadFromFile(fileName)
else IMG.Picture.LoadFromFile(GetCurrentDir+'\404.png');
buf2.Canvas.Draw(x*256,256*(y),IMG.Picture.Graphic);
end;
buf.picture.bitmap.Assign(buf2.Picture);
X_sdvig:=X_sdvig-sdv;
if marker_flag=true then marker;
if svasy_marker_flag=true then svasy_marker;
exit;
end;
//******* смещаем карту по оси Y ********
if Y_sdvig+Form1.top<2*256 then
begin
//смещаем карту на тайл
BitBlt(buf2.Canvas.Handle, 0, sdv, buf2.Width,buf2.Height,
buf.Canvas.Handle,0, 0, SRCCOPY);
//заполняем новыми тайлами
Title_Y:=Title_Y-2;
for y:=0 to 1 do
for x:=0 to buf_x do
begin
fileName:=pyt_k_kartam+'\maps.yandex.com.Map\z'+inttostr(z)+'\'+ inttostr((Title_X+x) div 1024)+'\x'+inttostr(Title_X+x)+'\'+ inttostr((Title_y+y) div 1024)+'\y'+inttostr(Title_Y+y)+'.png';
if FileExists(fileName)
then IMG.Picture.LoadFromFile(fileName)
else IMG.Picture.LoadFromFile(GetCurrentDir+'\404.png');
buf2.Canvas.Draw(x*256,256*(y),IMG.Picture.Graphic);
end;
buf.picture.bitmap.Assign(buf2.Picture);
Y_sdvig:=Y_sdvig+sdv;
if marker_flag=true then marker;
if svasy_marker_flag=true then svasy_marker;
exit;
end;
if Y_sdvig+Form1.Height>(buf_Y-2)*256 then
begin
BitBlt(buf2.Canvas.Handle, 0, 0, buf2.Width,buf2.Height,
buf.Canvas.Handle,0, sdv, SRCCOPY);
Title_Y:=Title_Y+2;
for Y:=buf_Y-2 to buf_Y-1 do
for X:=0 to buf_X do
begin
fileName:=pyt_k_kartam+'\maps.yandex.com.Map\z'+inttostr(z)+'\'+ inttostr((Title_X+x) div 1024)+'\x'+inttostr(Title_X+x)+'\'+ inttostr((Title_y+y) div 1024)+'\y'+inttostr(Title_Y+y)+'.png';
if FileExists(fileName)
then IMG.Picture.LoadFromFile(fileName)
else IMG.Picture.LoadFromFile(GetCurrentDir+'\404.png');
buf2.Canvas.Draw(x*256,256*(y),IMG.Picture.Graphic);
end;
buf.picture.bitmap.Assign(buf2.Picture);
Y_sdvig:=Y_sdvig-sdv;
if marker_flag=true then marker;
if svasy_marker_flag=true then svasy_marker;
exit;
end;
end;