Opened 20 years ago

Closed 20 years ago

Last modified 20 years ago

#835 closed defect (fixed)

cannot create rectObj in image units

Reported by: sgillies@… Owned by: sgillies@…
Priority: high Milestone:
Component: MapScript-SWIG Version: 4.3
Severity: normal Keywords:
Cc:

Description

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?

Change History (2)

comment:1 by sgillies@…, 20 years ago

Resolution: fixed
Status: newclosed
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)




comment:2 by sgillies@…, 20 years ago

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

Note: See TracTickets for help on using tickets.