mapscript.rectObj¶
- class mapscript.rectObj(minx: double = -1.0, miny: double = -1.0, maxx: double = -1.0, maxy: double = -1.0, imageunits: int = 0)¶
A rectObj represents a rectangle or bounding box. A rectObj may be a lone object or an attribute of another object and has no other associations.
Attributes
maxx
double Maximum easting
maxy
double Maximum northing
minx
double Minimum easting
miny
double Minimum northing
thisown
The membership flag
Methods
- __init__(minx: double = -1.0, miny: double = -1.0, maxx: double = -1.0, maxy: double = -1.0, imageunits: int = 0)[burim]¶
Create new instance. The four easting and northing arguments are optional and default to -1.0. Note the new optional fifth argument which allows creation of rectangles in image (pixel/line) units which are also tested for validity.
- draw(map: mapObj, layer: layerObj, image: imageObj, classindex: int, text: char) int [burim]¶
Draw rectangle into img using style defined by the classindex class of layer. The rectangle is labeled with the string text. Returns
MS_SUCCESS
orMS_FAILURE
- fit(width: int, height: int) double [burim]¶
Adjust the rect to fit the width and height. Returns cellsize of rect.
- project(*args) int [burim]¶
Overload 1: Reproject rectangle from proj_in to proj_out. Transformation is done in place. Returns
MS_SUCCESS
orMS_FAILURE
Overload 2: Reproject rectangle given a reprojection object. Transformation is done in place. Returns
MS_SUCCESS
orMS_FAILURE
- toString() char [burim]¶
Return a string formatted like:
{ 'minx': %f , 'miny': %f , 'maxx': %f , 'maxy': %f }
with the bounding values substituted appropriately. Python users can get the same effect via the rectObj __str__ method:>>> r = mapscript.rectObj(0, 0, 1, 1)
>>> str(r) { 'minx': 0 , 'miny': 0 , 'maxx': 1 , 'maxy': 1 }