Properties

Detailed Description

The MapRectangle type displays a rectangle on a Map. Rectangles are a special case of Polygon with exactly 4 vertices and 4 "straight" edges. In this case, "straight" means that the top-left point has the same latitude as the top-right point (the top edge), and the bottom-left point has the same latitude as the bottom-right point (the bottom edge). Similarly, the points on the left side have the same longitude, and the points on the right side have the same longitude.

By default, the rectangle is displayed with transparent fill and a 1-pixel thick black border. This can be changed using the color, border.color and border.width properties.

Note: Similar to the MapPolygon type, MapRectangles are geographic items, thus dragging a MapRectangle causes its vertices to be recalculated in the geographic coordinate space. Apparent stretching of the item occurs when dragged to the a different latitude, however, its edges remain straight.

Performance

MapRectangles have a rendering cost identical to a MapPolygon with 4 vertices.

Like the other map objects, MapRectangle is normally drawn without a smooth appearance. Setting the opacity property will force the object to be blended, which decreases performance considerably depending on the hardware in use.

Example Usage

The following snippet shows a map containing a MapRectangle, spanning from (-27, 153) to (-28, 153.5), near Brisbane, Australia. The rectangle is filled in green, with a 2 pixel black border.

Property Documentation

border group

border.width : int

border.color : color

This property is part of the border property group. The border property group holds the width and color used to draw the border of the rectangle. The width is in pixels and is independent of the zoom level of the map.

The default values correspond to a black border with a width of 1 pixel. For no line, use a width of 0 or a transparent color.