Platforms to show: All Mac Windows Linux Cross-Platform

Back to MKOverlayRendererMBS class.

MKOverlayRendererMBS.canDrawMapRect(Rect as MKMapRectMBS, zoomScale as Double) as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method MapKit MBS MacFrameworks Plugin 19.0 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Returns a Boolean value indicating whether the overlay view is ready to draw its content.

mapRect: The map rectangle that needs to be updated.
zoomScale: The current scale factor applied to the map.

Returns true if this overlay renderer is ready to draw its contents on the map or false if it is not.

Overlay renderers can override this method in situations where they may depend on the availability of other information to draw their contents. For example, a renderer showing traffic information might want to delay drawing until it has all of the traffic data it needs. In such a case, it can return NO from this method to indicate that it is not ready. An overlay renderer might also return NO if it does not draw content in the specified rectangle.

If you return NO from this method, your application is responsible for calling the setNeedsDisplayInMapRect method when the overlay renderer subsequently becomes ready to draw its contents.
The default implementation of this method returns true.

MKOverlayRendererMBS.Constructor(Handle as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method MapKit MBS MacFrameworks Plugin 21.3 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Constructor for creating an instanced based on an existing handle.

Useful if you get a MKOverlayRenderer reference from a declare.
The object is retained.

See also:

MKOverlayRendererMBS.Constructor(overlay as MKOverlayMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method MapKit MBS MacFrameworks Plugin 19.0 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Initializes and returns the overlay renderer and associates it with the specified overlay object.

overlay: The overlay object to use when drawing the overlay content on the map. This object provides the data needed to draw the overlay’s shape. The overlay renderer stores a strong reference to this object.
Return Value

Initially, the overlay renderer assumes that the overlay is fully opaque and that it has a content scale factor of 1.0. You can change these values as needed using the alpha and contentScaleFactor properties.

See also:

MKOverlayRendererMBS.drawMapRect(Rect as MKMapRectMBS, zoomScale as Double, context as CGContextMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method MapKit MBS MacFrameworks Plugin 19.0 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Draws the overlay’s contents at the specified location on the map.

mapRect: The map rectangle that needs to be updated. Your drawing code should avoid drawing outside of this rectangle.
zoomScale: The current zoom factor applied to the map content. You can use this value for configuring the stroke width of lines or other attributes that might be affected by the scale of the map’s contents.
context: The graphics context to use for drawing the overlay’s contents.

The default implementation of this method does nothing. Subclasses are expected to override this method and use it to draw the overlay’s contents.

When determining where to draw content, make your initial calculations relative to the map itself. In other words, compute the position and size of any overlay content using map points and map rectangles, convert those values to regular CGPoint and CGRect types using the methods of this class, and then pass the converted points to any drawing primitives.
It is recommended that you use Core Graphics to draw any content for your overlays.

To improve drawing performance, the map view may divide your overlay into multiple tiles and render each one on a separate thread. Your implementation of this method must therefore be capable of safely running from multiple threads simultaneously. In addition, you should avoid drawing the entire contents of the overlay each time this method is called. Instead, always take the mapRect parameter into consideration and avoid drawing content outside that rectangle.

MKOverlayRendererMBS.mapPointForPoint(point as CGPointMBS) as MKMapPointMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method MapKit MBS MacFrameworks Plugin 19.0 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Returns the point on the map that corresponds to the specified point in the overlay renderer’s drawing area.

point: The point in the overlay’s drawing area that you want to convert.
Returns the point on the two-dimensional map projection corresponding to the specified point.

MKOverlayRendererMBS.mapRectForRect(Rect as CGRectMBS) as MKMapRectMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method MapKit MBS MacFrameworks Plugin 19.0 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Returns the rectangle on the map that corresponds to the specified rectangle in the overlay renderer’s drawing area.

rect: The rectangle in the overlay’s drawing area that you want to convert.

Returns the rectangle on the two-dimensional map projection corresponding to the specified rectangle.

MKOverlayRendererMBS.pointForMapPoint(mapRect as MKMapPointMBS) as CGPointMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method MapKit MBS MacFrameworks Plugin 19.0 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Returns the point in the overlay renderer’s drawing area corresponding to the specified point on the map.

mapPoint: A point on the two-dimensional map projection. If you have a coordinate value (latitude and longitude), you can use the MKMapPointForCoordinate function to convert that coordinate to a map point.

Returns the point in the overlay’s drawing area that corresponds to the map point.

MKOverlayRendererMBS.RectForMapRect(mapRect as MKMapRectMBS) as CGRectMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method MapKit MBS MacFrameworks Plugin 19.0 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Returns the rectangle in the overlay renderer’s drawing area corresponding to the specified rectangle on the map.

mapRect: A rectangle on the two-dimensional map projection.

Returns the rectangle in the overlay’s drawing area that corresponds to the map rectangle.

Some examples using this method:

MKOverlayRendererMBS.setNeedsDisplay

Type Topic Plugin Version macOS Windows Linux iOS Targets
method MapKit MBS MacFrameworks Plugin 19.0 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Invalidates the entire contents of the overlay for all zoom scales.

This method causes the entire contents of the overlay to be redrawn during the next update cycle. This method invalidates the overlay regardless of the current zoom scale associated with the map.

MKOverlayRendererMBS.setNeedsDisplayInMapRect(mapRect as MKMapRectMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method MapKit MBS MacFrameworks Plugin 19.0 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Invalidates the specified portion of the overlay at all zoom scales.

mapRect: The portion of the overlay to update. Specify this value using a map coordinates.

Marking a rectangle as invalid causes that portion of the overlay to be redrawn during the next update cycle. This method invalidates the overlay regardless of the current zoom scale associated with the map.

See also:

MKOverlayRendererMBS.setNeedsDisplayInMapRect(mapRect as MKMapRectMBS, zoomScale as double)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method MapKit MBS MacFrameworks Plugin 19.0 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Invalidates the specified portion of the overlay but only at the specified zoom scale.

mapRect: The portion of the overlay to update. Specify this value using a map coordinates.
zoomScale: The zoom scale for which you want to invalidate the overlay.

Marking a rectangle as invalid causes that portion of the overlay to be redrawn during the next update cycle. This method invalidates the overlay only at the specified zoom scale.

See also:

The items on this page are in the following plugins: MBS MacFrameworks Plugin.


The biggest plugin in space...