[Mapserver-users] jBox applet - setimage
Richard Greenwood
rich at greenwoodmap.com
Tue Jan 27 07:14:54 PST 2004
Steve McCrone wrote:
> I've been corresponding with Richard Greenwood on this issue, but also
> thought I would throw it out and see if anyone has had any luck.
>
> I'm on Win2K adn IIS. I am trying to implement the "swap image" function
> in the jBox applet in order to avoid a full page reload. Here is my
> javascript function to test to see if it works -
>
> function setbox_handler(name, minx, miny, maxx, maxy, redraw) {
> document.mapserv.imgbox.value = minx + " " + miny + " " + maxx + " " +
> maxy;
> document.mapserv.imgxy.value = minx + " " + miny;
> var url;
> url =
> "/cgi-bin/mapserv?map=C%3A%5CInetpub%5Cwwwroot%5Cdemo.map&layer=lakespy2&layer=dlgstln2&layer=roads&zoomsize=2&program=%2Fcgi-bin%2Fmapserv.exe&map_web_imagepath=C%3A%5Cinetpub%5Cwwwroot%5Ctmp%5C&map_web_imageurl=%2Ftmp%2F";
> document.jBox.setimage(url);
> }
>
> ==========================
> Here is my applet -
>
> <applet codebase="/Java/jBox" code="jBox.class" width=[mapwidth]
> height=[mapheight] name="jBox" MAYSCRIPT>
> <param name="image" value="http://[host][img]">
> <PARAM NAME="jitter" VALUE="10">
> <PARAM NAME="thickness" VALUE="2">
> <PARAM NAME="busyimage"
> VALUE="http://localhost/graphics/making_your_map.gif">
> </applet>
> ============================
>
> The busy iamge does appear when I zoom in but then the map image does
> not get updated. In fact the mapserv.exe does not even generate the gif
> files and put them in the tmp directory. In the jBox.java code, the
> setimage() function does call the reset_handler function, but it appears
> not actualy to get called.
>
> Any help on this would be great.
>
> Steve
>
Steve,
Now that I am awake, I have tested setimage() and find that it works
correctly. A key thing with setimage() is that the mode=map. This causes
mapserv.exe to pass the image directly to the applet (jBox) without
writing a file to the server's disk. The applet is acutually calling
mapserv.exe directly, and then displaying the image that mapserv generates.
This behavior differs from the way we create pages with the template
files and saved image files, so you need to come at it a little differently.
Try pruning down your var url from above to something like this:
/cgi-bin/mapserv
?map=C:\Inetpub\wwwroot\demo.map
&mode=map
&layers=lakespy2,dlgstln2,roads
(I may have omitted something there, but the key thing is mode=map).
Regards,
--
Richard Greenwood
www.greenwoodmap.com
More information about the MapServer-users
mailing list