|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
-
- {-----------------------------------------------
- Èç ôàéëà ImageProperties.xml
- ------------------------------------------------}
- const
- m_nWidth = 9910;
- m_nHeight = 7476;
-
- var
- i, zoom, nMaxZoom, nTileGroup :Longint;
-
- {-----------------------------------------------
- Âîçâðàùàåò floor çíà÷åíèå
- ------------------------------------------------}
- function Floor(v :Extended) :Extended;
- begin
- Result := Trunc(v);
- if v < Result then Result := Result - 1.0;
- end;
-
- {-----------------------------------------------
- Âîçâðàùàåò ceil çíà÷åíèå
- ------------------------------------------------}
- function Ceil(v :Extended) :Extended;
- begin
- Result := Trunc(v);
- if v > Result then Result := Result + 1.0;
- end;
-
- {-----------------------------------------------
- Ïîëó÷åíèå ìàêñèìàëüíî âîçìîæíîãî Zoom'à
- ------------------------------------------------}
- procedure GetMaxZoom();
- var k, i :Longint;
- begin
- 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;
-
- {-----------------------------------------------
- Ïîëó÷åíèå êîëè÷åñòâà òàéëîâ íà äàííîì 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;
-
-
- {-----------------------------------------------
- Ïîëó÷åíèå 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.
-
|