MaplyMultiplexTileSource

@interface MaplyMultiplexTileSource : NSObject <MaplyTileSource>

The multiplex tile source is for bunging other tile sources together.

The Multiplex Tile source takes a bunch of other tiles source objects and switches between them. Strictly speaking, it doesn’t multiplex. The quad image layer asks for all of its images at once for a given tile. I just like the word ‘multiplex’. Multiplex. Multiplex. So futuristic in a 1970’s way. Multiplex.

Anyway, this is useful for animating between different tile sources.

See

MaplyTileSource

See

MaplyQuadImageTilesLayer
  • Initialize with an array of objects that conform to MaplyRemoteTileInfoProtocol

    To create one of these you need to pass in an NSArray of MaplyRemoteTileInfoProtocol objects. Where this is useful is if you want to animate between them. Check out the animation functionality in MaplyQuadImageTilesLayer. To animate effectively, that layer must grab all the images for a tile at once, hence this object.

    A simple example would be taking 6 MaplyRemoteTileInfoProtocol objects pointing to MBTiles archives, sticking them in an array and passing them in here. Each of them might represent a frame of animation in a video you want to show over the whole earth. Because wow, man. The whole earth.

    Declaration

    Objective-C

    - (nullable instancetype)initWithSources:(NSArray *_Nonnull)tileSources;

    Swift

    init?(sources tileSources: [Any])

    Return Value

    Returns a working MaplyMultiplexTileSource or nil if it can’t. That might happen if the input tile sources don’t match up to each other.

  • Coordinate system for the tile source.

    The coordinate system is derived from the first tile source passed in. They’d better all agree or the results will be odd.

    Declaration

    Objective-C

    @property (readonly, nonatomic, nonnull) MaplyCoordinateSystem *coordSys;

    Swift

    var coordSys: MaplyCoordinateSystem { get }
  • A delegate for tile loads and failures.

    If set, you’ll get callbacks when the various tiles load (or don’t). You get called in all sorts of threads. Act accordingly.

    Declaration

    Objective-C

    @property (readwrite, nonatomic, nullable)
        NSObject<MaplyMultiplexTileSourceDelegate> *delegate;

    Swift

    weak var delegate: MaplyMultiplexTileSourceDelegate? { get set }
  • If set, we’ll let failures pass through.

    If you’re fetching a very wide set of tiles, you may want to let a few failures happen and fill in the images yourself.

    To do that, the multiplex tile source needs to accept failures and store an NSNull in the appropriate entry.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) _Bool acceptFailures;

    Swift

    var acceptFailures: Bool { get set }
  • If set, we’ll track the outstanding connections across all remote tile sources

    Declaration

    Objective-C

    + (void)setTrackConnections:(_Bool)track;

    Swift

    class func setTrackConnections(_ track: Bool)
  • Number of outstanding connections across all tile sources

    Declaration

    Objective-C

    + (int)numOutstandingConnections;

    Swift

    class func numOutstandingConnections() -> Int32