[UMN_MAPSERVER-USERS] zooming problem continues

Sandeep Bashyal gis at UNDPHAIS.ORG.NP
Tue Oct 26 21:01:25 PDT 2004


On Wed, 20 Oct 2004 11:15:52 +0300, temiz <temiz at DEPREM.GOV.TR> wrote:

> hello again
>
> I am sorry to extend the question.
>
> I think I can get pixel coord of the rectangle drawn with rubberband
> (for example $zoom_rect gives [minx] => 171 [miny] => 223 [maxx] => 231
> [maxy] => 175).
>
> here is the current extent:
> [minx] => 414562.225 [miny] => 4510820 [maxx] => 521317.775 [maxy] =>
> 4617510
>
> $map->zoomrectangle($zoom_rect,$map->width,$map->height,$my_extent);
>
> this command doesn't bring about any change. I get same image.
>
> I hesitate on:
> - $zoom_rect is in image(pixel) coord (or geographic coord).
>
>
> What might be the problem ?
>
> regards
>
>
>
> Skweda O'Bomsawin wrote:
>
>> Temiz,

Sorry I must have sent you the wrong javascript code. What you're doing
appears fine to me ($zoom_rect is in pixels). Here is the (i hope) correct
javascript:

function startRubber (evt) {
         if (document.all) {
      var r = document.all.rubberBand;
      r.style.width = 0;
      r.style.height = 0;
      r.style.pixelLeft = event.clientX - 2 ;
      r.style.pixelTop  = event.clientY - 2 ;
    }

    else if (document.layers) {
      var r = document.rubberBand;
      r.clip.width = 0; r.clip.height = 0;
      r.left = evt.x - 2 + 'px';
      r.top = evt.y - 2 + 'px';
      document.captureEvents(Event.MOUSEMOVE);
    }

   else if (document.getElementById) {
         var r = document.getElementById('rubberBand');
      r.style.width = 0;
      r.style.height = 0;
      r.style.left = evt.clientX - 2 + 'px';
      r.style.top = evt.clientY - 2 + 'px';
    }
    document.onmousemove = moveRubber;
}

function moveRubber (evt) {
   if (document.all) {
         var r = document.all.rubberBand;
         r.style.visibility = 'visible';
      r.style.width = event.clientX - r.style.pixelLeft -2 + 'px';
      r.style.height = event.clientY - r.style.pixelTop -2 + 'px';
      var f = document.forms['viewmap'];
      f.w.value = r.style.width;
      f.h.value = r.style.height;
    }

    else if (document.layers) {
      var r = document.rubberBand;
      r.visibility = 'show';
      r.clip.width = evt.x - r.left - 2 + 'px';
      r.clip.height = evt.y - r.top - 2 + 'px';
      r.document.open();
      r.document.write('<table width="' + r.clip.width + '" height="'
+ r.clip.height + '" border="1px solid
red"><tr><td><\/td><\/tr><\/table>');
      r.document.close();
      var f = document.forms('viewmap');
      f.w.value = r.clip.width;
      f.h.value = r.clip.height;
    }

   else if (document.getElementById) {
      var r = document.getElementById('rubberBand');
      r.style.visibility = 'visible'
      r.style.width = evt.clientX - parseInt(r.style.left) - 2 + 'px';
      r.style.height = evt.clientY - parseInt(r.style.top) - 2 + 'px';
      var ht = document.getElementById('h');
      var wt = document.getElementById('w');
      wt.value = r.style.width;
      ht.value = r.style.height;
    }
  }

function stopRubber (evt) {
    if (document.layers){document.releaseEvents(Event.MOUSEMOVE);}
    document.onmousemove = null;
  }

Regards.



--
Sandeep Bashyal
--
   National GIS Officer
   Humanitarian Assistance Information System (HAIS)
   United Nations (NEP/01/008)
   UN House, Pulchowk
   G.P.O. Box 107
   Kathmandu, Nepal
   Tel: (+977) 01 5543957
        (+977) 01 5554304
   Cell:(+977) 9841270854
   Fax: (+977) 01 5528059
--------------------------------------------------
mailto:gis at undphais.org.np
mailto:sandeep at earthmapping.com
http://www.undp.org.np



More information about the MapServer-users mailing list