REsize window question

Stéphane RIFF stephane.riff at CERENE.FR
Tue Mar 29 04:48:16 PST 2005


Thanks for answered....

I realize that my question was not really clear :)

In fact, i want to keep the scale not the extent because
when the map is resized and (if i keep the extent) of course scale
change, then
the active layer may change regards to scale and it's not very intuitive
for the
user to understand why.
So how can i calculate the new extent to keep same scale with different
map size ?
I use phpmapscript 4.2.5.

Voila, thanks all

Martin Weinelt wrote:

>On Friday 18 March 2005 09:35, Stéphane RIFF wrote:
>
>
>>My mapserver application need to redraw the map when the window is resized.
>>My problem is that i don't know how to keep the same extent
>>in two map with different size !!!
>>
>>
>
>Using mapserver CGI you just send MAPEXTENT and MAPSIZE
>to the CGI (together with layers, etc.) and that's it.
>
>
>
>>in fact i don't want the map
>>to change its scale when i resize the window.
>>
>>
>
>Keeping mapextent at different mapsize yields another scale, no?
>
>
>
>>How can i calculate the newExtent to do that ???
>>Is it possible ???
>>
>>
>
>You  do not calculate it, you just reuse the image extent from the previous
>map (which can be sent by the CGI together with the image).
>
>
>
>>How do you handle that kind of function ? example ?
>>
>>
>
>I do it on the client side with js:
>
> function setMapSize() {
>  // mimg is a div in the doc with the map as background image
>  mimg.style.backgroundImage='url(images/waiting.gif)';
>  // a 'wait indicator' is shown until the new image arrives
>  // w is the browser window
>  var mh = (w.innerHeight) ? w.innerHeight : d.body.clientHeight;
>  var mw = (w.innerWidth) ? w.innerWidth : d.body.clientWidth;
>  mh-=60; mw-=230;             // correct for other elements which also need a bit of screen real estate
>  mimg.style.width=mw; mimg.style.height=mh;  // set the div to the new size
>  myMap.mode='browse';            //  myMap is an object which holds some map parameters
>  myMap.mapsize=[mw,mh];       // ... mapsize for instance
>  myMap.mapext.set(myMap.imgext.get());        // or map extent - here copied from the last image recieved
>  var s=myMap.getReqStr('mapsize','mapext');  // this  glues a GET-string for the new map request
>  getMap(s);                                 // invokes the new map
>}
>
>this is just an example, the same purpose can be served in a more traditional way.
>
>Cheers, Martin
>
>
>
>
>



More information about the MapServer-users mailing list