Ticket #508 (closed enhancement: fixed)
Enhancements to rectObj
| Reported by: | sgillies@… | Owned by: | sgillies@… |
|---|---|---|---|
| Priority: | high | Milestone: | |
| Component: | MapScript | Version: | 4.1 |
| Severity: | minor | Keywords: | |
| Cc: |
Description
Extending rectObj with a 4-arg constructor so that we can initialize a rectObj
r = rectObj(-110.0, 37.0, -105.0, 40.0)
and also a toPolygon method which uses msRectToPolygon and allows
s = r.toPolygon() # new shapeobj instance from the rectObj
For completeness, it would be nice to have a method that returns the four
principle values as a tuple, allowing
minx, miny, maxx, maxy = r.toTuple()
or
mapobj.setExtent(r.toTuple()) # setExtents takes the same arguments as
# the rectObj constructor
Also nice to have would be toWKT and toWKB methods for use with PostGIS
and GEOS, although these might be better implemented for the shapeObj class.
Am also considering a toString method with a single separator argument
allowing
bbox = r.toString(',') # returns '-110.0,37.0,-105.0,40.0'
This is functionality that I require all the time.
These enhancements are part of a project that I am tentatively calling the
Primitive Mapscript Classes project. Have made a Wiki page:
http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?PrimitiveMapScriptClassesProject
and from this Wiki page will link back to Bugzilla. Maybe this can serve as
a template for other such projects.
Change History
Note: See
TracTickets for help on using
tickets.
