MaplyBillboard

Objective-C

@interface MaplyBillboard : NSObject

Swift

class MaplyBillboard : NSObject

A billboard is tied to a specific point, but rotates to face the user.

The billboard object represents a rectangle which is rooted at a specific point, but will rotate to face the user. These are typically used in 3D, when the globe or map has a tilt. They make little sense in 2D.

  • The point this billboard is rooted at.

    The x and y coordinates are radians. The z coordinate is in meters.

    Declaration

    Objective-C

    @property (nonatomic) MaplyCoordinate3d center;

    Swift

    var center: MaplyCoordinate3d { get set }
  • Set if you want to select these

    Declaration

    Objective-C

    @property (nonatomic) _Bool selectable;

    Swift

    var selectable: Bool { get set }
  • The 2D polygonal description of what the billboard should be

    Declaration

    Objective-C

    @property (nonatomic, strong) MaplyScreenObject *_Nullable screenObj;

    Swift

    var screenObj: MaplyScreenObject? { get set }
  • Vertex attributes to apply to this billboard.

    MaplyVertexAttribute objects are passed all the way to the shader. Read that page for details on what they do.

    The array of vertex attributes provided here will be copied onto all the vertices we create for the shader. This means you can use these to do things for a single billboard in your shader.

    Declaration

    Objective-C

    @property (nonatomic, strong) NSArray *_Nullable vertexAttributes;

    Swift

    var vertexAttributes: [Any]? { get set }
  • User data object for selection

    When the user selects a feature and the developer gets it in their delegate, this is an object they can use to figure out what the screen label means to them.

    Declaration

    Objective-C

    @property (nonatomic, strong) id _Nullable userObject;

    Swift

    var userObject: Any? { get set }
  • Initialize with a single image, a given background and a size.

    This will create a simple billboard with a single image pasted on it.

    Declaration

    Objective-C

    - (nullable instancetype)initWithImage:(id _Nonnull)texture
                                     color:(id)color
                                      size:(CGSize)size;

    Swift

    init?(image texture: Any, color: Any!, size: CGSize)

    Parameters

    texture

    This can either be a UIImage or a MaplyTexture.

    color

    Color for the polygon that makes up the billboard.

    size

    Size of the billboard in display space.