MMKMapWindow

@interface MMKMapWindow : NSObject

Handles the MapWindow element.

Summary

Instance methods

- (NSInteger)width;
Window width in physical pixels

- (NSInteger)height;
Window height in physical pixels

- (nullable MMKScreenPoint *)worldToScreenWithWorldPoint:
    (nonnull MMKPoint *)worldPoint;

Transforms the position from world coordinates to screen coordinates

- (nullable MMKPoint *)screenToWorldWithScreenPoint:
    (nonnull MMKScreenPoint *)screenPoint;

Transforms coordinates from screen space to world space

- (void)addSizeChangedListenerWithSizeChangedListener:
    (nonnull id<MMKMapSizeChangedListener>)sizeChangedListener;

Adds a SizeChangedListener

- (void)removeSizeChangedListenerWithSizeChangedListener:
    (nonnull id<MMKMapSizeChangedListener>)sizeChangedListener;

Removes a SizeChangedListener

Properties

@property (nonatomic, readonly, nonnull) MMKMap *map;
Gets the map interface

@property (nonatomic, assign, unsafe_unretained, readwrite, nullable)
    MMKScreenRect *focusRect;

When using controls that overlay the map view, calculating the proper camera position can be tricky

@property (nonatomic, assign, unsafe_unretained, readwrite, nullable)
    MMKScreenPoint *focusPoint;

The point on the screen that corresponds to camera position

@property (nonatomic, assign, unsafe_unretained, readwrite, nullable)
    MMKScreenPoint *gestureFocusPoint;

Defines the focus point of gestures

@property (nonatomic, assign, unsafe_unretained, readwrite)
    MMKGestureFocusPointMode gestureFocusPointMode;

Specifies the way provided gesture focus point affects gestures

@property (nonatomic, assign, unsafe_unretained, readwrite)
    MMKPointOfView pointOfView;

Defines the position of the point of view

@property (nonatomic, readonly, nonnull) MMKVisibleRegion *focusRegion;
Gets the focused region

@property (nonatomic, readonly, getter=isValid) BOOL valid;
Tells if this object is valid or no

Instance methods

width

- (NSInteger)width;

Window width in physical pixels


height

- (NSInteger)height;

Window height in physical pixels


worldToScreenWithWorldPoint:

- (nullable MMKScreenPoint *)worldToScreenWithWorldPoint:
    (nonnull MMKPoint *)worldPoint;

Transforms the position from world coordinates to screen coordinates.

Parameters

worldPoint

Latitude and longitude information.

Returns

The point in screen space corresponding to worldPoint;
returns none if the point is behind the camera.


screenToWorldWithScreenPoint:

- (nullable MMKPoint *)screenToWorldWithScreenPoint:
    (nonnull MMKScreenPoint *)screenPoint;

Transforms coordinates from screen space to world space.

Parameters

screenPoint

The point in screen coordinates relative to the top left of the map. These coordinates are in physical pixels and not in device independent (virtual) pixels.

Returns

Latitude and longitude information.


addSizeChangedListenerWithSizeChangedListener:

- (void)addSizeChangedListenerWithSizeChangedListener:
    (nonnull id<MMKMapSizeChangedListener>)sizeChangedListener;

Adds a SizeChangedListener.

The class does not retain the object in the 'sizeChangedListener' parameter. It is your responsibility to maintain a strong reference to the target object while it is attached to a class.


removeSizeChangedListenerWithSizeChangedListener:

- (void)removeSizeChangedListenerWithSizeChangedListener:
    (nonnull id<MMKMapSizeChangedListener>)sizeChangedListener;

Removes a SizeChangedListener.


Properties

map

@property (nonatomic, readonly, nonnull) MMKMap *map;

Gets the map interface.


focusRect

@property (nonatomic, assign, unsafe_unretained, readwrite, nullable)
    MMKScreenRect *focusRect;

When using controls that overlay the map view, calculating the proper camera position can be tricky. This property simplifies the task by defining the area of interest (the focus rectangle) inside the view. Map methods that calculate the camera position based on a world bounding box ensure that this bounding box will fit into the focusRect.

For example, when using a semi-transparent control that overlays the top half of the map view, define the focus rectangle as the lower half of the view to ensure that object of interest appear in the lower half of map view. In addition, if focusPoint is null all camera movements will have the center of the lower half as their target.

If focusRect is null, the whole map view is used instead.

On iOS, if you change the focus rectangle in the viewDidLayoutSubviews callback, it's recommended to call MapView.layoutIfNeeded just before that action.

Optional property, can be nil.


focusPoint

@property (nonatomic, assign, unsafe_unretained, readwrite, nullable)
    MMKScreenPoint *focusPoint;

The point on the screen that corresponds to camera position. Changing camera position or focusPoint makes the new camera target appear exactly at the focusPoint on screen.

If focusPoint is null, the center of focusRect is used instead.

Optional property, can be nil.


gestureFocusPoint

@property (nonatomic, assign, unsafe_unretained, readwrite, nullable)
    MMKScreenPoint *gestureFocusPoint;

Defines the focus point of gestures. Actual behaviour depends on gestureFocusPointMode. If the point is not set, the source point of the gesture will be used as the focus point. Default: none.

Optional property, can be nil.


gestureFocusPointMode

@property (nonatomic, assign, unsafe_unretained, readwrite)
    MMKGestureFocusPointMode gestureFocusPointMode;

Specifies the way provided gesture focus point affects gestures. Default: TapGestures.


pointOfView

@property (nonatomic, assign, unsafe_unretained, readwrite)
    MMKPointOfView pointOfView;

Defines the position of the point of view. Cameras use perspective projection, which causes perspective deformations. Perspective projection has an axis, and points on this axis are not affected by perspective deformations. This axis is a line parallel to the view's direction, so its projection to the screen is a point - the "point of view". By default, this point is at the center of the screen, but some applications might want to set it to the center of focusRect. Use this flag to do so. Default: ScreenCenter


focusRegion

@property (nonatomic, readonly, nonnull) MMKVisibleRegion *focusRegion;

Gets the focused region.

Returns

A region that corresponds to the current focusRect or the
visible region if focusRect is not set. Region IS bounded by latitude
limits [-90, 90] and IS NOT bounded by longitude limits [-180, 180].
If longitude exceeds its limits, we see the world's edge and another
instance of the world beyond this edge.


valid

@property (nonatomic, readonly, getter=isValid) BOOL valid;

Tells if this object is valid or no. Any method called on an invalid object will throw an exception. The object becomes invalid only on UI thread, and only when its implementation depends on objects already destroyed by now. Please refer to general docs about the interface for details on its invalidation.