[Mapserver-users] RE: JBox Image swapping
Steve Lime
steve.lime at dnr.state.mn.us
Thu Nov 13 10:20:34 PST 2003
The landview interface I wrote does this. There is a version of the
Itasca demo that has been outfitted with that code. You can see it in
action and download it from
http://maps.dnr.state.mn.us/mapserver_demos/. Look at the workshop
files.
Steve
>>> "Palanisamy, Giri" <palanisamyg at ornl.gov> 11/11/2003 7:01:08 AM
>>>
Hi,
I am using JBox in my mapserver application, and I like to do the
image
swapping (reloading the map in the applet without refreshing the
entire
page) when the user zooms in/out or pan.
Does any one provide a code example for this? I have found a very
brief
documentation in the Mapserver's JBox how to do document, but couldn't
proceed further.
Thanks in advance
Giri
-----Original Message-----
From: Richard Greenwood [mailto:Rich at GreenwoodMap.com]
Sent: Sunday, November 09, 2003 1:04 PM
To: Palanisamy, Giri
Cc: mapserver-users at lists.gis.umn.edu
Subject: Re: Image swapping
At 10:18 AM 11/9/2003, Giri Palanisamy wrote:
>I am trying to implement image swapping (reloading the map without
>refreshing the entire page), DO you have an example javascript code
that
>does this? Can you please send the code to me?,
Giri,
I am copying the mapserver list with this email as there may be
members
of
the list who can provide a good example.
I do not use image swapping, so I do not have an example. I am pretty
sure
Steve Lime is using it in Landview:
http://www.dnr.state.mn.us/maps/landview.html
>I referred your JBox how to do, it says I need to add
>var url;
> url = "http://www.somedomain.com/cgi-bin/mapserv"+
> "?mode=map" +
> "&map=" + mapfile +
> "&mapext=" + extent.join("+") +
> "&mapsize=" + width + "+" + height +
> "&layers=" + layerlist;
> document.jBox.setimage(url);
>
>Do I need to do this in a separate javascript function or add it to
one
>of my existing function?
Add it to your existing function, but use that instead of
"document.mapserv.submit();" In other words, you do NOT want to submit
the
whole page, you want to call the setimage(url) function instead.
You may need to eval the function, something like:
eval(" document.jBox.setimage(" + url + ")" );
Rich
>Here is my javascript:
>
><SCRIPT LANGUAGE="JavaScript">
>
> function setbox_handler(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 seterror_handler(message) {
> alert(message);
> }
> var pansize = 0.80;
>
> function pan(direction) {
> var x, y;
>
> if(direction == 'n') {
> x = ([mapwidth]-1)/2.0;
> y = 0 - [mapheight]*pansize + [mapheight]/2.0;
> } else if(direction == 'nw') {
> x = 0 - [mapwidth]*pansize + [mapwidth]/2.0;
> y = 0 - [mapheight]*pansize + [mapheight]/2.0;
> } else if(direction == 'ne') {
> x = ([mapwidth]-1) + [mapwidth]*pansize - [mapwidth]/2.0;
> y = 0 - [mapheight]*pansize + [mapheight]/2.0;
> } else if(direction == 's') {
> x = ([mapwidth]-1)/2.0;
> y = ([mapheight]-1) + [mapheight]*pansize - [mapheight]/2.0;
> } else if(direction == 'sw') {
> x = 0 - [mapwidth]*pansize + [mapwidth]/2.0;
> y = ([mapheight]-1) + [mapheight]*pansize - [mapheight]/2.0;
> } else if(direction == 'se') {
> x = ([mapwidth]-1) + [mapwidth]*pansize - [mapwidth]/2.0;
> y = ([mapheight]-1) + [mapheight]*pansize - [mapheight]/2.0;
> } else if(direction == 'e') {
> x = ([mapwidth]-1) + [mapwidth]*pansize - [mapwidth]/2.0;
> y = ([mapheight]-1)/2.0;
> } else if(direction == 'w') {
> x = 0 - [mapwidth]*pansize + [mapwidth]/2.0;
> y = ([mapheight]-1)/2.0;
> }
>
> document.mapserv.zoomdir[1].checked = true; // force pan
> document.mapserv.imgxy.value = x + " " + y;
> document.mapserv.submit();
>
> }
>
> </SCRIPT>
>
>
>Thanks for the help.
>
>Giri
Richard W. Greenwood, PLS
Greenwood Mapping, Inc.
Rich <at> GreenwoodMap <dot> com
(307) 733-0203
http://www.GreenwoodMap.com
_______________________________________________
Mapserver-users mailing list
Mapserver-users at lists.gis.umn.edu
http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
More information about the MapServer-users
mailing list