MapServer / MapServer-import

3 stars 2 forks source link

cannot create rectObj in image units #835

Open tbonfort opened 12 years ago

tbonfort commented 12 years ago

Reporter: sgillies@frii.com Date: 2004/08/30 - 20:14

The mapObj.zoomRect methods requires a rectangle in image units.  Now, it is
the mapserver convention that (minx, miny) is the lower left corner of a
rectangle and that (maxx, maxy) is the upper right corner regardless of
whether we are in map or image units.  Because of this, an image rectangle
will have maxy < miny.

We are currently raising an exception on the creation of a rectangle with
maxy < miny and this effectively forbids rects in image units.

A possible solution: an optional flag as fifth argument to the rectObj
constructor that indicates we are trying to creat a rect in image units.
Is there a symbol we can reuse?
tbonfort commented 12 years ago

Author: sgillies@frii.com Date: 2004/08/31 - 00:10

Rather than remove the test of valid extents, which is a good thing, I've added
an optional 5th argument, imageunits, which defaults to MS_FALSE.  This means
that the normal use case of a spatial rectangle with easting/northing units
remains exactly the same.

To create a rectangle in image or pixel/line coordinates:

    # a 100 x 100 rect with image origin (upper left) at 0,0
    (llx, lly, urx, ury) = (0, 100, 100, 0)
    rect = rectObj(llx, lly, urx, ury, MS_TRUE)
tbonfort commented 12 years ago

Author: sgillies@frii.com Date: 2004/08/31 - 18:04

Also committed changes to the 4.2 branch so that they'll get into 4.2.4