MaplyQuadImageOfflineLayer

@interface MaplyQuadImageOfflineLayer : MaplyViewControllerLayer

The quad image offline layer renders a single image at irregular intervals from a standard input tile source.

The offline renderer will fetch a tile image basemap like a normal MaplyQuadImageTilesLayer. What it does with it is completely different. It renders a stack of static images from it and calls a delegate with them.

The images produced correspond to the bbox set. Think of it as providing a window into a tiled base map. Why? Eh, it’s complicated.

  • Initialize with the coordinate system of the tile source and the tile source.

    The coordinate system needs to be either MaplyPlateCarree or MaplySphericalMercator at the moment. The tile source should provide at least one and possibly several images per tile.

    Declaration

    Objective-C

    - (nullable instancetype)
    initWithCoordSystem:(MaplyCoordinateSystem *_Nonnull)coordSys
             tileSource:(NSObject<MaplyTileSource> *_Nonnull)tileSource;

    Swift

    init?(coordSystem coordSys: MaplyCoordinateSystem, tileSource: NSObjectProtocol 

    Parameters

    coordSys

    The coordinate system the offline layer will render in.

    tileSource

    The tile source that needs to provide at least one and possibly more images per tile.

  • Set the active tile source.

    If you change this, it will force a reload of all loaded tiles and start fetching from the new tile source.

    Declaration

    Objective-C

    @property (readwrite, strong, nonatomic, nonnull)
        NSObject<MaplyTileSource> *tileSource;

    Swift

    var tileSource: NSObjectProtocol 
  • on

    Enable/Disable the whole layer.

    By default this is on. When off, the layer will stop working and calling its delegate.

    Declaration

    Objective-C

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

    Swift

    var on: Bool { get set }
  • The number of simultaneous fetches the layer will attempt at once.

    The toolkit loves its dispatch queues and threads. By default this number is set to 8 or 16, but if you need to constrain it, you can set it lower (or higher!). If your tile source can’t handle multi-thread access, set this to 1.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) int numSimultaneousFetches;

    Swift

    var numSimultaneousFetches: Int32 { get set }
  • The number of images we’re expecting to get per tile.

    This is the number of images the layer will ask for per tile. The default is 1, which is the normal case. If this is greater than one that typically means we’re going to animate between them.

    the MaplyTileSource delegate is always expected to provide this many imates.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) unsigned int imageDepth;

    Swift

    var imageDepth: UInt32 { get set }
  • Control how tiles are indexed, either from the lower left or the upper left.

    If set, we’ll use the OSM approach (also Google Maps) to y indexing. That’s that default and it’s normally what you’re run into.

    Strictly speaking, TMS addressing (the standard) is flipped the other way. So if you’re tile source looks odd, try setting this to false.

    Declaration

    Objective-C

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

    Swift

    var flipY: Bool { get set }
  • Maximum number of tiles to load in at once.

    This is the maximum number of tiles the pager will have loaded into memory at once. The default is 128 and that’s generally good enough. However, if your tile size is small, you may want to load in more.

    Tile loading can get out of control when using elevation data. The toolkit calculates potential sceen coverage for each tile so elevation data makes all tiles more important. As a result the system will happily page in way more data than you may want. The limit becomes important in elevation mode, so leave it at 128 unless you need to change it.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) int maxTiles;

    Swift

    var maxTiles: Int32 { get set }
  • Scale the calculated importance by this before using it.

    Number less than 1.0 will make tiles less important to load in.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) float importanceScale;

    Swift

    var importanceScale: Float { get set }
  • Number of levels to consider in tiles when previewing.

    When we chnage the bounds we’ll run off a quick preview render if this is set. If so, we’ll consider an tile above or at this level.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) int previewLevels;

    Swift

    var previewLevels: Int32 { get set }
  • Size of the image to produce or maximum size if autoRes is on.

    This is the size of each of the images passed to the delegate. If autoRes is on this is the maximum size.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) CGSize textureSize;

    Swift

    var textureSize: CGSize { get set }
  • If on the layer will try to match the textureSize to the maximum resolution of the tiles it sees. On by default.

    Declaration

    Objective-C

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

    Swift

    var autoRes: Bool { get set }
  • Controls whether the fetching code runs in a single thread or is spawned asyncronously.

    If set, we’ll kick off the tile fetches in their own dispatched blocks. If not set, we’ll just do it in the layer thread.

    Declaration

    Objective-C

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

    Swift

    var asyncFetching: Bool { get set }
  • How often we’ll generate a new image.

    This is the most often the layer will produce a new set of images and call the delegate.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) float period;

    Swift

    var period: Float { get set }
  • If on, we’ll try to load only a single level at a time.

    If set we’ll use the target level logic to only show a single level at a time.

    Declaration

    Objective-C

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

    Swift

    var singleLevelLoading: Bool { get set }
  • Detail the levels you want loaded in target level mode.

    The image display can work in one of two modes, quad tree where it loads everything starting from the min level or a target level mode where it just tries to load one or more target levels. This is the array that controls which levels it will try to load.

    We do this so that the user doesn’t have to wait for the target level to load. This can be distracting on large displays with small tiles. If you use this mode, the layer will load lower levels first, filling in quicker and then load the target level. This looks much better, but doesn’t take as long as the full quad tree based loading.

    The layer calculates the optimal target level (for 2D maps, if you’re in that mode). The entries in this array are relative to that level or absolute. For example [0,-4,-2] means the layer will always try to load levels 0, targetLevel-4 and targetLevel-2, but only the latter two if they make sense.

    Declaration

    Objective-C

    @property (readwrite, strong, nonatomic, nullable) NSArray *multiLevelLoads;

    Swift

    var multiLevelLoads: [Any]? { get set }
  • The bounding box for the images produced by the offline layer.

    This bounding box should be in the layer’s coordinate system.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) MaplyBoundingBox bbox;

    Swift

    var bbox: MaplyBoundingBox { get set }
  • For the case where we’re loading individual frames, this sets the order to load them in.

    When doing animation and loading frames, we have the option of loading them one by one. Normally we start from 0 and work our way up, but you can control that order here.

    Declaration

    Objective-C

    - (void)setFrameLoadingPriority:(NSArray *_Nullable)priorities;

    Swift

    func setFrameLoadingPriority(_ priorities: [Any]?)
  • The delegate called with the image stack produced at irregular intervals.

    Set this delegate to get the images out of the offline rendering layer.

    Declaration

    Objective-C

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

    Swift

    weak var delegate: MaplyQuadImageOfflineDelegate? { get set }
  • Status objects describing the state of each frame.

    Query this to find out which frames are completely loaded into memory and which are not.

    This queries the underlying control logic and there is no delegate. It’s polling only.

    Declaration

    Objective-C

    - (nullable NSArray *)loadedFrames;

    Swift

    func loadedFrames() -> [Any]?
  • Force the layer to reload its tiles and rerender.

    Declaration

    Objective-C

    - (void)reload;

    Swift

    func reload()