GLMapScaleRuler

Objective-C


@interface GLMapScaleRuler : GLMapDrawObject

Swift

class GLMapScaleRuler : GLMapDrawObject

GLMapScaleRuler draws a scale ruler on the screen.

  • Initializes an empty scale ruler that will be displayed with the given drawOrder.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithDrawOrder:(int32_t)drawOrder;

    Swift

    init(drawOrder: Int32)

    Parameters

    drawOrder

    The drawOrder of the object.

  • Sets the text at the bottom of the ruler. It’s used to display map center coordinates or any other useful information.

    Declaration

    Objective-C

    - (void)setBottomText:(NSString *_Nullable)text;

    Swift

    func setBottomText(_ text: String?)
  • Sets the style of the text at the bottom of the ruler. The default is “{font-size:11; text-color:black; fill-color:#000000B2; font-stroke-width:2pt; font-stroke-color:#FFFFFF99;}

    Declaration

    Objective-C

    - (void)setBottomTextStyle:(nonnull GLMapVectorStyle *)style;

    Swift

    func setBottomTextStyle(_ style: GLMapVectorStyle)
  • Sets the scale ruler position to the bottom center part of the screen, and width to half of the screen width. [_mapView setScalePlacement:GLMapPlacement_BottomLeft paddings:CGPointMake(5, 5) maxWidth:300];

    Declaration

    Objective-C

    - (void)setPlacement:(GLMapPlacement)placement
                paddings:(CGPoint)paddings
                maxWidth:(float)maxWidth;

    Swift

    func setPlacement(_ placement: GLMapPlacement, paddings: CGPoint, maxWidth: Float)

    Parameters

    placement

    The placement of the text.

    paddings

    The paddings of the scale ruler.

    maxWidth

    The maxWidth of the scale in points.

  • Sets a block that is called when the ruler value is updated. The block allows translating units and using a custom digit format inside the ruler.

    Declaration

    Objective-C

    - (void)setTextFormatterBlock:(nonnull GLMapScaleRulerTextFormatterBlock)block;

    Swift

    func setTextFormatterBlock(_ block: @escaping GLMapScaleRulerTextFormatterBlock)

    Parameters

    block

    The new text formatter block.