Browse Source

update zmp

pull/1/head
sasbot 2 years ago
parent
commit
7b2a3b3bec
2 changed files with 69 additions and 36 deletions
  1. +62
    -33
      zoomify.zmp/GetUrlScript.txt
  2. +7
    -3
      zoomify.zmp/info.txt

+ 62
- 33
zoomify.zmp/GetUrlScript.txt View File

@@ -1,50 +1,79 @@
{-----------------------------------------------
Èç ôàéëà ImageProperties.xml
------------------------------------------------}
const
width=9910;
height=7476;
m_nWidth = 9910;
m_nHeight = 7476;
var TileGroup:integer;
z:integer;
i:integer;
cur_width,cur_height:integer;
maxZoom:integer;
var
i, zoom, nMaxZoom, nTileGroup :Longint;
function TilesAtZoom(z:integer):integer;
{-----------------------------------------------
Âîçâðàùàåò floor çíà÷åíèå
------------------------------------------------}
function Floor(v :Extended) :Extended;
begin
result:=(1+trunc(width/(256*intpower(2,(MaxZoom-z)))))*(1+trunc(height/(256*intpower(2,(MaxZoom-z)))));
Result := Trunc(v);
if v < Result then Result := Result - 1.0;
end;
function getTileCount(zoom:integer):integer;
var i:integer;
{-----------------------------------------------
Âîçâðàùàåò ceil çíà÷åíèå
------------------------------------------------}
function Ceil(v :Extended) :Extended;
begin
Result:=0;
for i:=1 to zoom do Result:=Result+TilesAtZoom(i);
Result := Trunc(v);
if v > Result then Result := Result + 1.0;
end;
{-----------------------------------------------
Ïîëó÷åíèå ìàêñèìàëüíî âîçìîæíîãî Zoom'à
------------------------------------------------}
procedure GetMaxZoom();
var k, i :Longint;
begin
i:=1;cur_width:=0;
while cur_width<width do
begin
cur_width:=round(256*intpower(2,i));
i:=i+1;
end;
MaxZoom:=i;
k := m_nWidth;
if m_nHeight > m_nWidth then k := m_nHeight;
i := 0;
while k > 256 do
begin
k := Trunc(k / 2);
Inc(i);
end;
nMaxZoom := i;
end;
i:=1;cur_width:=0;
while cur_width<height do
begin
cur_width:=round(256*intpower(2,i));
i:=i+1;
end;
if i>MaxZoom then MaxZoom:=i;
{-----------------------------------------------
Ïîëó÷åíèå êîëè÷åñòâà òàéëîâ íà äàííîì Zoom'å
------------------------------------------------}
function GetTilesAtZoom(zoom: Longint) :Longint;
var k :Extended;
begin
k := 256.0 * IntPower(2, nMaxZoom - zoom);
Result := Trunc(Ceil(m_nWidth / k) * Ceil(m_nHeight / k));
end;
{-----------------------------------------------
Êîëè÷åñòâî òàéëîâ ïðåäøåñòâóþùèõ äàííîìó Zoom'ó
------------------------------------------------}
function GetTilesCount(nZoom: Longint) :Longint;
var i: Longint;
begin
Result := 0;
for i := 0 to nZoom - 1 do Result := Result + GetTilesAtZoom(i);
end;
z:=GetZ-1;
tilegroup:=(getTileCount(z) +GetX +GetY*(1+trunc(width/(256*intpower(2,(MaxZoom-z-1)))))) div 256;
ResultURL:=GetURLBase+inttostr(tilegroup)+'/'+inttostr(z)+'-'+inttostr(GetX)+'-'+inttostr(GetY)+'.jpg';
{-----------------------------------------------
Ïîëó÷åíèå URL òàéëà
------------------------------------------------}
begin
zoom := GetZ - 1;
GetMaxZoom();
nTileGroup := (GetX + GetY * Trunc(Ceil(m_nWidth / (256.0 * IntPower(2, nMaxZoom - zoom)))) + GetTilesCount(zoom)) div 256;
ResultURL := GetURLBase + IntToStr(nTileGroup) + '/' + IntToStr(zoom) + '-' + IntToStr(GetX) + '-' + IntToStr(GetY) + '.jpg';
{ RequestHead := 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' + #13#10; }
end.

+ 7
- 3
zoomify.zmp/info.txt View File

@@ -1,4 +1,4 @@
Пример использования ресурсов в формате Zoomify
<pre>Пример использования ресурсов в формате Zoomify
... отображается в левом верхнем углу с зума 1 по 7
@@ -15,8 +15,8 @@
устанавливаем
const
width=9910;
height=7476;
m_nWidth = 9910;
m_nHeight = 7476;
Рекомендации:
@@ -29,3 +29,7 @@ height=7476;
mra:Garl@mail.ru
jabber:garl@qip.ru
Исправил
TokarevVV http://sasgis.ru/mantis/view.php?id=1740
</pre>

Loading…
Cancel
Save