%
option explicit
const cnRows= 2
const cnCols= 2
dim x : x= request("x") ' 120680
dim y : y= request("y") ' 486291
dim sc : sc= request("sc") ' my scale
dim id : id= request("id") ' geodan id [1]
dim sl : sl= request("sl") ' geodan scalelevel [4]
if x="" then
x=120680 ' 106000 .. 134000
else
x=clng(x)
end if
if y="" then
y=486291 ' 476000 .. 494000
else
y=clng(y)
end if
if sc="" then
sc=100
else
sc=clng(sc)
end if
if id="" then
id=1
end if
if sl="" then
sl=4
end if
call checkForMapClick()
dim sParams : sParams= "sc="&sc&"&id="&id&"&sl="&sl
%>
<%
function writeImages()
%><%
end function
function checkForMapClick()
dim iRow
for iRow= 0 to cnRows-1
dim iCol
for iCol= 0 to cnCols-1
if paramExists("map."&iCol&"."&iRow&".x") then
call processMapClick( _
Request("map."&iCol&"."&iRow&".x"), Request("map."&iCol&"."&iRow&".y"), _
x+3^(4-sl)*595*iCol, y-3^(4-sl)*425*iRow, _
3^(4-sl)*595, 3^(4-sl)*425)
exit function
end if
next
next
end function
function processMapClick(iclickx, iclicky, imapx, imapy, imapwidth, imapheight)
' image = 400 x 283
' !! map coordinates have origin at bottom left.
' !! click coordinates have origin at top left.
%>click at (<%=iclickx%>, <%=iclicky%>)
<%
%>center of map at (<%=imapx%>, <%=imapy%>)
<%
%>width: (<%=imapwidth%>, <%=imapheight%>)
<%
x= round(imapx+(iclickx/400-0.5)*imapwidth)
y= round(imapy-((283-iclicky)/283+0.5)*imapheight)
end function
function paramExists(sName)
paramExists= Request.queryString(sName).count<>0 or Request.form(sName).count<>0
end function
%>