[mapserver-users] Fwd: Mapplet - Force Zoomdir with image but tons
Martin, Daniel
DMartin at erac.com
Mon Jun 10 15:44:11 PDT 2002
Below is some working code I used when I wrote my mapplet based client. It
worked for me with versions 3.5 and 3.6 of the Windows binary. I abandoned
it for a Rosa version. Most of the JavaScript I found on the Wiki, and
can't take credit for. I've only made a few minor improvements. For images
I used the ones from the Rosa distro.
Dan Martin
<html>
<head>
<title>Map Client</title>
<script language=javascript>
function mapplet_apply(name, minx, miny, maxx, maxy, redraw) {
document.mapserv.imgbox.value = minx + " " + miny + " " + maxx + "
" + maxy;
document.mapserv.imgxy.value = minx + " " + miny;
if (redraw) {
document.mapserv.submit();
}
}
function mapplet_error(message) {
alert(message);
}
function L(url) {
window.location.href = url
}
function zoom(zoomFactor) {
document.mapserv.zoom.value = zoomFactor;
document.mapserv.submit();
}
function infoClicked() {
}
if (navigator.appVersion.indexOf("2.") != -1){
check = false;
}
if ((navigator.appVersion.indexOf("3.") != -1) &&
(navigator.appName.indexOf("Explorer") != -1)){
check = false;
}
else {
check = true;
}
if (check == true){
zoomInImg = new Image();
zoomInImg.src = "/mapserver/clients/images/rosa/icon_zoomin_1.gif";
zoomInImgon = new Image();
zoomInImgon.src =
"/mapserver/clients/images/rosa/icon_zoomin_2.gif";
zoomInImgstay = new Image();
zoomInImgstay.src =
"/mapserver/clients/images/rosa/icon_zoomin.gif";
zoomOutImg = new Image();
zoomOutImg.src =
"/mapserver/clients/images/rosa/icon_zoomOut_1.gif";
zoomOutImgon = new Image();
zoomOutImgon.src =
"/mapserver/clients/images/rosa/icon_zoomOut_2.gif";
zoomOutImgstay = new Image();
zoomOutImgstay.src =
"/mapserver/clients/images/rosa/icon_zoomOut.gif";
infoImg = new Image();
infoImg.src = "/mapserver/clients/images/rosa/icon_info_1.gif";
infoImgon = new Image();
infoImgon.src = "/mapserver/clients/images/rosa/icon_info_2.gif";
infoImgstay = new Image();
infoImgstay.src = "/mapserver/clients/images/rosa/icon_info.gif";
}
imageStay = ""
function imageon(name){
if (imageStay != name){
document[name].src = eval(name + "on.src");
}
}
function imageoff(name){
if (imageStay != name){
document[name].src = eval(name + ".src");
}
}
function on(name){
if (check == true){
imageon(name);
}
}
function off(name){
if (check == true){
imageoff(name);
}
}
function stay(name){
if (check == true){
document[name].src = eval(name + "stay.src");
if (imageStay != name){
if (imageStay != ""){
document[imageStay].src = eval(imageStay + ".src");
}
}
imageStay = name
}
}
</script>
</head>
<body bgcolor=white>
<FORM METHOD=GET NAME="mapserv">
<input type="hidden" name="map" value="[map]">
<input type="hidden" name="program" value="[program]">
<input type="hidden" name="map_web_imagepath" value="[map_web_imagepath]">
<input type="hidden" name="map_web_imageurl" value="[map_web_imageurl]">
<input type="hidden" name="imgext" value="[mapext]">
<input type="hidden" name="imgxy" value="[center_x] [center_y]">
<input type="hidden" name="imgbox" value="">
<input type="hidden" name="zoom" value="">
<input type="hidden" name="title" value="[title]">
<TABLE border=0 cellpadding=0 cellspacing=1 name=TopTable bgcolor=white>
<TR>
<TD>
<table border=0 cellpadding=0 cellspacing=0
bgcolor=black>
<TR bgcolor=black height=30>
<TD bgcolor=black> </TD>
<TD colspan=2 bgcolor=black> <font
color=white><B>[title]</B></font></TD>
<TD bgcolor=black> </TD>
</TR>
<TR bgcolor=black valign=top>
<TD width=35> </TD>
<TD colspan=2>
<applet codebase="/cgi-bin/" code="mapplet.class"
width="[mapwidth]" height="[mapheight]" name="mapplet" MAYSCRIPT>
<param name="image"
value="http://etserver1[img]">
<param name="jitter" value="10">
<param name="thickness" value="1">
<param name="color" value="black">
</applet>
</TD>
<TD width=35 align=center>
<a href="javascript:zoom(1.5)"
onMouseOver="on('zoomInImg');" onMouseOut="off('zoomInImg')"
onClick="stay('zoomInImg');"><img
src="/mapserver/clients/images/rosa/icon_zoomin_1.gif" border="0"
name="zoomInImg"></a>
<a href="javascript:zoom(-2)"
onMouseOver="on('zoomOutImg');" onMouseOut="off('zoomOutImg')"
onClick="stay('zoomOutImg');"><img
src="/mapserver/clients/images/rosa/icon_zoomOut_1.gif" border="0"
name="zoomOutImg"></a>
<a href="javascript:infoClicked()"
onMouseOver="on('infoImg');" onMouseOut="off('infoImg')"
onClick="stay('infoImg');"><img
src="/mapserver/clients/images/rosa/icon_info_1.gif" border="0"
name="infoImg"></a>
</TD>
</TR>
<TR valign=top bgcolor=black>
<TD> </TD>
<TD align="left"><B><font
color="white"> © 2002 My Company</font></b></TD>
<td align="right"><img src="[scalebar]"></td>
<TD> </TD>
</TR>
</table>
</TD>
<TD bgcolor=white> </TD>
<td valign=top>
<table cellpadding="5" cellspacing="1" border="0" bgcolor=black>
<TR>
<TD bgcolor=black align=center>
<font size=+1 color=white><b>Reference Map</b></font>
</TD>
</TR>
<TR bgcolor=white>
<TD align=center>
<INPUT NAME="ref" TYPE="image" SRC="[ref]" border="0">
</TD>
</TR>
<TR height=20>
<TD bgcolor=black align=center>
<font
color=white><B>Legend<B></font>
</TD>
</TR>
<TR>
<TD bgcolor=white>
<table cellpadding=2
cellspacing=0>
[legend]
</table>
</TD>
</TR>
<TR height=20>
<TD bgcolor=black align=center>
<font
color=white><B>Query<B></font>
</TD>
</TR>
<TR>
<TD bgcolor=white>
<table cellpadding=2
cellspacing=0>
[query]
</table>
</TD>
</TR>
</table>
</td>
</tr>
</table>
</form>
</body>
</html>
> -----Original Message-----
> From: Steve Lime [mailto:steve.lime at dnr.state.mn.us]
> Sent: Monday, June 10, 2002 2:52 PM
> To: mapserver-users at lists.gis.umn.edu
> Subject: [mapserver-users] Fwd: Mapplet - Force Zoomdir with image
> buttons
>
> << Message: Mapplet - Force Zoomdir with image buttons >>
More information about the MapServer-users
mailing list