[mapserver-users] mapplet boxoff()

Stephen Lime steve.lime at dnr.state.mn.us
Tue Sep 4 22:39:28 EDT 2001


The call to repaint is there to clear the screen of any box currently displayed, hence the name boxoff(). With boxon() there generally nothing else painted so there's no need repaint. I really don't think repaint is the source of the loop since all painting does is draw a box or crosshair and the map and never triggers calls back to javascript. There is some thread related code in there that does end up communicating back to the browser and that's the problem. (the threading code is there to deal with issues related to browser response while waiting for the applet to do something, long story)

The error is most likely in the implementation of the mapplet_apply() method in javascript. The redraw patameter is there for just this circumstance. It signifies whether the call to mapplet_apply is worthy of action by the browser, either a form submission or a call to the applet swap method. Simply wrap your code in something like this:

  function mapplet_apply(...) {
    if(redraw) {
      ... your code here ...
    }
  }

and you shouldn't have any problems. I know this seems a tad convoluted but there are good reasons for the redraw parameter. With boxoff you want to communicate the collapsed box coordinates to the browser but that in itself doesn't warrant further action. Same goes for swapping images, you want to reset the cursor (i.e. imgxy and imgbox) but don't want to trigger another redraw.

Steve

Stephen Lime
Internet Applications Analyst

Minnesota DNR
500 Lafayette Road
St. Paul, MN 55155
651-297-2937
>>> <Stuart.Row at brs.gov.au> 09/04/01 18:45 PM >>>
Richard,

If you have a look in mapplet.java you will notice that the boxoff function includes a call to 'repaint();' whereas boxon does not. I don't understand why and personally would be happier if it wasn't there, but that is the reason you get the endless loop.

I have removed any calls to boxon and boxoff for this reason. A shame as it is a really useful function. 

Cheers,

Stuart Row
Bureau of Rural Sciences
Tel: +61 2 6272 4640       Email: stuart.row at brs.gov.au
Fax: +61 2 6272 4687      Web: http://www.affa.gov.au

-----Original Message-----
From: Richard Greenwood [mailto:Rich at GreenwoodMap.com] 
Sent: Tuesday, September 04, 2001 9:25 AM
To: mapserver-users at lists.gis.umn.edu
Subject: [mapserver-users] mapplet boxoff()

Hello Mappers;

I'm having trouble with the Java mapplet boxoff() function. If I go
     document.mapplet.boxoff();
I end up in an endless loop in which the form keeps getting submitted to

the server. boxon() seems to work fine for me.

A simple example of boxoff() would be greatly appreciated even if you
can't 
directly answer my question.

Thanks,
Rich


Richard W. Greenwood, PLS
Greenwood Mapping, Inc.
Rich at GreenwoodMap.com
(307) 733-0203
http://www.GreenwoodMap.com




More information about the mapserver-users mailing list