<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<br>
<br>
    Thanks a lot for the tips and for clearing it up the image coords
concept, that makes sense now :)<br>
<br>
    Best regards,<br>
<br>
    Rod<br>
<br>
<br>
<a class="moz-txt-link-abbreviated" href="mailto:jcaicedo@cti.espol.edu.ec">jcaicedo@cti.espol.edu.ec</a> escreveu:
<blockquote
 cite="mid24795.193.191.134.1.1165925058.squirrel@correo.cti.espol.edu.ec"
 type="cite">
  <pre wrap="">Well, I don't see anything obviously wrong with your code. I would suggest
trying another javascript library (or another browser?) and see if the
behaviour improves.  Also try setting the last parameter in zoomRectangle
to null, just to see what happens. Regarding your last question, in image
coordinates the 0,0 point is at top left, so miny is actually closer to
the top. It took me some time to grasp the concept...

      0,0____________________________________
        |
        |
        |
        |    __________________(maxx,miny)
        |   |                  |
        |   |                  |
        |   |__________________|
        |  (minx, maxy)
        |

Regards,
Javier Caicedo Espinoza
CTI - ESPOL
Ecuador

  </pre>
  <blockquote type="cite">
    <pre wrap="">    Hello Javier, thanks for the info.

    We have been struggling for some time now with the zoomRectangle and
every piece of info is appreciated.
    Concerning the swap of MinY with MaxY in your code, I gotta say this
caught me off guard.
     I couldn't get past a "miny &gt;= maxy" error while trying to  use
zoomRectangle before and went as far as changing and recompiling
mapzoom.i where there is a consistency check that looks like:

        if (poPixRect-&gt;maxy &gt;= poPixRect-&gt;miny) { -- insert nasty error here -- }


    thinking I found a bug. I got past the error after that change,
however the zoom behavior was what could best be described as "all over
the place". Like zooming to the wrong hemisphere and the like.
    So I changed mapzoom.i back to the original code and swapped the
order of arguments on my code following your example, and it worked
better than the last behavior, however the zoom isn't still quite
working in a predictable manner.
    Sometimes when zooming the map will remain at the same zoom factor,
and just pan a little to the sides or actually zooming out instead of
going zooming to the passed coordinates. I am running out of ideas as to
what could be causing this behavior.
    Here is what I am doing:

      //Current map geo extent
      String[] extents = ((String) params.get("extent")).split(" ");
       rectObj extent = new rectObj(Double.parseDouble(extents[0]),
Double.parseDouble(extents[1]),
                                     Double.parseDouble(extents[2]),
Double.parseDouble(extents[3]), mapscript.MS_FALSE);
       mapa.setExtent(extent);

        //rectangle Pic coords
        String[] pxCoordZoom = ((String)
params.get("coordenadas")).split(" ");
        Double minx = Double.parseDouble(pxCoordZoom[0]);
        Double miny = Double.parseDouble(pxCoordZoom[1]);
        Double maxy = Double.parseDouble(pxCoordZoom[2]);
        Double maxx = Double.parseDouble(pxCoordZoom[3]);

       /*We are using a cropper javascript class and the order the
rectangle coordinates where being passed was kind of unpredictable and
causing errors                while trying to create the rectangle with
the eventual minX &gt; maxX /*
        double transport;
        if(minx &gt; maxx){
            transport = minx;
            minx = maxx;
            maxx = transport;
        }
        if(miny &gt; maxy){
            transport = miny;
            miny = maxy;
            maxy = transport;
        }

        rectObj zoomArea = new rectObj(minx, maxy, maxx, miny,
mapscript.MS_TRUE);   //with MaxY and MinY swapped
        mapa.zoomRectangle(zoomArea, mapa.getWidth(), mapa.getHeight(),
extent, getMaxGeorefExtent(mapa));

    Do you see any glaring mistakes that could cause the zoom to behave
wrongly?
    What confuses me is the fact that you mentioned that the rectangle
should be constructed with bottom-left and top-right defined, but isn't
the MinX and MaxY pair actually top-left?

    Thanks in advance, any scrap of information helps immensely.

    Rod.

--


*Rodrigo Del C. Andrade*
/Estagiário Nível Superior/
/SIC - SSE - Soluções Segurança Pública/

*DÍGITRO TECNOLOGIA*
*E-mail:* <a class="moz-txt-link-abbreviated" href="mailto:rodrigo.andrade@digitro.com.br">rodrigo.andrade@digitro.com.br</a>
<a class="moz-txt-link-rfc2396E" href="mailto:rodrigo.andrade@digitro.com.br">&lt;mailto:rodrigo.andrade@digitro.com.br&gt;</a>
*Fone:* +55 48 3281- / +55 48 3281-7000
*Fax:* +55 48 3281-7299
*Site:* <a class="moz-txt-link-abbreviated" href="http://www.digitro.com">www.digitro.com</a> <a class="moz-txt-link-rfc2396E" href="http://www.digitro.com">&lt;http://www.digitro.com&gt;</a>

Javier Caicedo wrote:
    </pre>
    <blockquote type="cite">
      <pre wrap="">According to the Mapscript API mapObj.zoomRectangle first parameter must
be in  image coordinates, so you should set the last parameter of the
rectObj constructor to TRUE. Here goes an example from my current
project:

  //vMap is an instance of mapObj
  rectObj rect = vMap.getExtent(); //map coordinates
  String [] box = getCurrentRequest().getParameter("box").split(" ");
  //box is something like this: 10 10 200 200
  //0,0 is at top left, so box defines top left and bottom right corners
  double mx = Double.parseDouble(box[0]);
  double my = Double.parseDouble(box[1]);
  double mxx = Double.parseDouble(box[2]);
  double mxy = Double.parseDouble(box[3]);

  //bunch of validation code ommitted

  rectObj rbox = new rectObj(mx,mxy,mxx,my,mapscriptConstants.MS_TRUE);
  //notice the switch of mxy and my
  //rectObj constructor requires you define bottom left and top right
  //corners. rbox is in image coordinates
  vMap.zoomRectangle(rbox,w,h,rect,null);

Hopefully this will help you out a little.

Regards,
Javier Caicedo Espinoza
CTI - ESPOL
Guayaquil, Ecuador



      </pre>
    </blockquote>
    <pre wrap="">


    </pre>
  </blockquote>
  <pre wrap=""><!---->


  </pre>
</blockquote>
<br>
</body>
</html>