GetUrlScript.txt 1.0 KiB

4 年之前
1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. var res,resx,resy:string;
  2. i:byte;
  3. osX,osY,prX,prY:integer;
  4. begin
  5. (* 1/1-1.jpg *)
  6. resx := '';
  7. resy := '';
  8. res := '';
  9. osX := round(intpower(2,GetZ-1)) div 2;
  10. osY := round(intpower(2,GetZ-1)) div 2;
  11. prX := osX;
  12. prY := osY;
  13. for i:=2 to GetZ do begin
  14. prX := prX div 2;
  15. prY := prY div 2;
  16. if GetX < osX then begin
  17. osX := osX - prX;
  18. resx := resx + '0';
  19. end
  20. else begin
  21. osX := osX + prX;
  22. resx := resx + '1';
  23. end;
  24. if GetY < osY then begin
  25. osY := osY - prY;
  26. resy := resy + '0';
  27. end
  28. else begin
  29. osY := osY + prY;
  30. resy := resy + '1';
  31. end;
  32. end;
  33. if GetZ > 7 then begin
  34. for i:=1 to GetZ-7 do begin
  35. res := res + Copy( resy, 1, i ) + '-' + Copy( resx, 1, i ) + '/';
  36. end;
  37. end;
  38. ResultURL := GetURLBase + inttostr(GetZ-1) +'/' + res + resy + '-' + resx + '.jpg';
  39. end.