GLMapDrawable

Objective-C


@interface GLMapDrawable : GLMapDrawObject

Swift

class GLMapDrawable : GLMapDrawObject

GLMapDrawable is a bridge class to work with the GLMap internal representation of objects that should be rendered on the map. This can be a single image, text, or vector object. GLMapDrawable can be rendered as a separate object or injected into tile data. Check GLMapImageGroup for large groups of images or GLMapMarkerLayer to display map markers with clustering.

See

[GLMapView addDrawable:]

Normal drawable:

0, GLMapPointMax                   GLMapPointMax, GLMapPointMax
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
                                             
           ╭────────────────────T            
                                           
           │←╍╍╍╍╍╍╍╍╍╍╍╍╍P                 
                                          
                                          
                                          
           O──────────────┴─────╯            
                                             
┗━→━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
0,0                                GLMapPointMax,0

P = position (GLMapPoint) O = position - offset * scale (pt) T = O + size * scale (pt)

Drawable that uses transform:

0, GLMapPointMax                   GLMapPointMax, GLMapPointMax
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
                                              
           ╭────────────────────T             
                                            
                                            
                                            
                                            
                                            
           P────────────────────╯             
                                              
┗━━→━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
0,0                                GLMapPointMax,0

P = position (GLMapPoint) T = position + size * scale (GLMapPoint)

  • Unavailable

    GLMapDrawable is an abstract class

    Default -init is disabled.

    Declaration

    Objective-C

    - (instancetype _Nonnull)init;

Properties

  • When set to YES, the image rotates with the map. The default value is NO.

    Declaration

    Objective-C

    @property BOOL rotatesWithMap;

    Swift

    var rotatesWithMap: Bool { get set }
  • GLMapTransform mode of drawable.

    Declaration

    Objective-C

    @property GLMapTransformMode transformMode;

    Swift

    var transformMode: GLMapTransformMode { get set }
  • A position that sets the image position in map internal coordinates. For vector objects, adds translation. Animatable.

    Declaration

    Objective-C

    @property GLMapPoint position;

    Swift

    var position: GLMapPoint { get set }
  • Image offset from the position point, measured in image pixels. Can be used for both image and text. When the offset is (0, 0), the bottom-left corner of the image is displayed at the position. When the offset is (image.size.width / 2, 0), it is ideal for a pin. Animatable.

    Declaration

    Objective-C

    @property CGPoint offset;

    Swift

    var offset: CGPoint { get set }
  • The size of the image in pixels. Can be used for image and text.

    Declaration

    Objective-C

    @property (readonly) CGSize size;

    Swift

    var size: CGSize { get }
  • Scale of the object (by default is 1.0). Animatable.

    Declaration

    Objective-C

    @property double scale;

    Swift

    var scale: Double { get set }
  • A float variable that defines the image angle. Animatable.

    Declaration

    Objective-C

    @property float angle;

    Swift

    var angle: Float { get set }

Methods

  • Tests if a point is inside the image.

    Declaration

    Objective-C

    - (BOOL)hitTest:(CGPoint)point
               onMap:(GLMapView *_Nonnull)mapView
        withPaddings:(PlatformEdgeInsets)paddings;

    Swift

    func hitTest(_ point: CGPoint, onMap mapView: GLMapView, withPaddings paddings: PlatformEdgeInsets) -> Bool

    Parameters

    mapView

    The mapView where the image is displayed.

    point

    The point to check.

    paddings

    The paddings of the image.

    Return Value

    YES if the point is inside the image.