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)[fuente]

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[fuente]

Draw rectangle into img using style defined by the classindex class of layer. The rectangle is labeled with the string text. Returns MS_SUCCESS or MS_FAILURE

fit(width: int, height: int) double[fuente]

Adjust the rect to fit the width and height. Returns cellsize of rect.

getCenter() pointObj[fuente]

Return the center point of the rectangle.

project(*args) int[fuente]

Overload 1: Reproject rectangle from proj_in to proj_out. Transformation is done in place. Returns MS_SUCCESS or MS_FAILURE


Overload 2: Reproject rectangle given a reprojection object. Transformation is done in place. Returns MS_SUCCESS or MS_FAILURE

toPolygon() shapeObj[fuente]

Convert to a polygon of five vertices.

toString() char[fuente]

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 }