MLNImageSource class
MLNImageSource is a content source that is used for a georeferenced raster
image to be shown on the map. The georeferenced image scales and rotates as the
user zooms and rotates the map. Images may also be used as icons or patterns
in a style layer. To register an image for use as an icon or pattern,
use the MLNStyle/setImage:forName: method. To configure a point
annotation’s image, use the MLNAnnotationImage class.
The geographic location of the raster image content, supplied with
MLNCoordinateQuad, can be non-axis aligned.
MLNImageSource supports raster content from NSURL, NSImage (macOS), or
UIImage (iOS).
An image source is added to an MLNStyle object along with one or more
MLNRasterStyleLayer objects. Use a raster style layer to control the
appearance of content supplied by the image source.
Each
image
source defined by the style JSON file is represented at runtime by an
MLNImageSource object that you can use to initialize new style layers. You
can also add and remove sources dynamically using methods such as
MLNStyle/addSource: and MLNStyle/sourceWithIdentifier:.
Example
let coordinates = MLNCoordinateQuad(
topLeft: CLLocationCoordinate2D(latitude: 46.437, longitude: -80.425),
bottomLeft: CLLocationCoordinate2D(latitude: 37.936, longitude: -80.425),
bottomRight: CLLocationCoordinate2D(latitude: 37.936, longitude: -71.516),
topRight: CLLocationCoordinate2D(latitude: 46.437, longitude: -71.516))
let source = MLNImageSource(identifier: "radar", coordinateQuad: coordinates, url: URL(string:
"https://maplibre.org/maplibre-gl-js-docs/assets/radar.gif")!) mapView.style?.addSource(source)
Related examples
TODO: Add an image, learn how to add an image to your map using MLNImageSource.
Constructors
- MLNImageSource()
-
Returns a new instance of MLNImageSource constructed with the default
newmethod.factory - MLNImageSource.castFrom(ObjCObjectBase other)
-
Constructs a MLNImageSource that points to the same underlying object as
other. -
MLNImageSource.castFromPointer(Pointer<
ObjCObject> other, {bool retain = false, bool release = false}) - Constructs a MLNImageSource that wraps the given raw object pointer.
Properties
- coordinates ↔ MLNCoordinateQuad
-
The coordinates at which the corners of the source image will be placed.
getter/setter pair
- debugDescription$1 → NSString
-
debugDescription
no setterinherited
- description$1 → NSString
-
description
no setterinherited
- hash$1 → int
-
hash
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- identifier ↔ NSString
-
A string that uniquely identifies the source in the style to which it is added.
getter/setter pairinherited
- image ↔ UIImage?
-
The source image.
getter/setter pair
- isProxy → bool
-
isProxy
no setterinherited
- ref → ObjCObjectRef
-
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- superclass$1 → ObjCObjectBase
-
superclass
no setterinherited
- URL ↔ NSURL?
-
The URL to the source image.
getter/setter pair
Methods
-
autorelease(
) → MLNImageSource -
autorelease
override
-
class$1(
) → ObjCObjectBase -
class
inherited
-
conformsToProtocol$1(
Protocol aProtocol) → bool -
conformsToProtocol:
inherited
-
copy(
) → ObjCObjectBase -
copy
inherited
-
dealloc(
) → void -
dealloc
inherited
-
doesNotRecognizeSelector(
Pointer< ObjCSelector> aSelector) → void -
doesNotRecognizeSelector:
inherited
-
forwardingTargetForSelector(
Pointer< ObjCSelector> aSelector) → ObjCObjectBase -
forwardingTargetForSelector:
inherited
-
forwardInvocation(
NSInvocation anInvocation) → void -
forwardInvocation:
inherited
-
init(
) → MLNImageSource -
init
override
-
initWithIdentifier(
NSString identifier, {required MLNCoordinateQuad coordinateQuad, required NSURL URL}) → MLNImageSource - Returns a georeferenced image source with an identifier, coordinates and a URL.
-
initWithIdentifier$1(
NSString identifier, {required MLNCoordinateQuad coordinateQuad, required UIImage image}) → MLNImageSource - Returns a georeferenced image source with an identifier, coordinates and an image.
-
initWithIdentifier_(
NSString identifier) → MLNImageSource -
Returns a source initialized with an identifier.
override
-
isEqual(
ObjCObjectBase object) → bool -
isEqual:
inherited
-
isKindOfClass(
ObjCObjectBase aClass) → bool -
isKindOfClass:
inherited
-
isMemberOfClass(
ObjCObjectBase aClass) → bool -
isMemberOfClass:
inherited
-
methodForSelector(
Pointer< ObjCSelector> aSelector) → Pointer<NativeFunction< Void Function()> > -
methodForSelector:
inherited
-
methodSignatureForSelector(
Pointer< ObjCSelector> aSelector) → NSMethodSignature -
methodSignatureForSelector:
inherited
-
mutableCopy(
) → ObjCObjectBase -
mutableCopy
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
performSelector(
Pointer< ObjCSelector> aSelector) → ObjCObjectBase -
performSelector:
inherited
-
performSelector$1(
Pointer< ObjCSelector> aSelector, {required ObjCObjectBase withObject}) → ObjCObjectBase -
performSelector:withObject:
inherited
-
performSelector$2(
Pointer< ObjCSelector> aSelector, {required ObjCObjectBase withObject, required ObjCObjectBase withObject$1}) → ObjCObjectBase -
performSelector:withObject:withObject:
inherited
-
release(
) → void -
release
inherited
-
respondsToSelector(
Pointer< ObjCSelector> aSelector) → bool -
respondsToSelector:
inherited
-
retain(
) → MLNImageSource -
retain
override
-
retainCount(
) → int -
retainCount
inherited
-
self$1(
) → MLNImageSource -
self
override
-
toString(
) → String -
A string representation of this object.
inherited
-
zone(
) → Pointer< NSZone> -
zone
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
alloc(
) → MLNImageSource -
alloc
override
-
allocWithZone(
Pointer< NSZone> zone) → MLNImageSource -
allocWithZone:
override
-
isInstance(
ObjCObjectBase obj) → bool -
Returns whether
objis an instance of MLNImageSource.override -
new$(
) → MLNImageSource -
new
override