MSFCompositeVectorTileLayer

Objective-C


@interface MSFCompositeVectorTileLayer : MSFVectorTileLayer

Swift

class MSFCompositeVectorTileLayer : MSFVectorTileLayer

A VectorTileLayer that can weave named external data sources (raster, hillshade, merged vector / contour) into the master CartoCSS style’s layer order.

Each external source is placed at the position of a matching layer name in the style project’s “layers” array, and configured by a matching ‘#name { … }’ block in the CartoCSS (e.g. raster-opacity, hillshade-exaggeration), including zoom- and style-parameter- parameter-dependent expressions. Raster and hillshade sources are rendered as their own draped child layers interleaved between the master style layers; merged vector sources are folded into the master source and styled normally.

Sources can be added and removed at runtime.

  • Constructs a CompositeVectorTileLayer from a master vector data source and decoder.

    Declaration

    Objective-C

    - (id)initWithDataSource:(MSFTileDataSource *)dataSource
                     decoder:(MSFVectorTileDecoder *)decoder;

    Swift

    init!(dataSource: MSFTileDataSource!, decoder: MSFVectorTileDecoder!)

    Parameters

    dataSource

    The master vector tile data source.

    decoder

    The tile decoder (must be an MBVectorTileDecoder for external source configuration and placement to work).

  • Adds a named external data source. For raster and hillshade types the source is drawn as its own child layer at the style slot named ‘name’. For the vector type the source is merged into the master source (see addVectorDataSource).

    Declaration

    Objective-C

    - (void)addExternalDataSource:(NSString *)name
                       dataSource:(MSFTileDataSource *)dataSource
                             type:(enum MSFCompositeSourceType)type
                 elevationDecoder:(MSFElevationDecoder *)elevationDecoder;

    Swift

    func addExternalDataSource(_ name: String!, dataSource: MSFTileDataSource!, type: MSFCompositeSourceType, elevationDecoder: MSFElevationDecoder!)

    Parameters

    name

    The source name; must match a layer name in the style “layers” array.

    dataSource

    The external data source.

    type

    The source type.

    elevationDecoder

    Optional elevation decoder for hillshade sources. If null, it is resolved from the data source ‘encoding’ metadata (“terrarium”/“mapbox”).

  • Adds a named external data source. For raster and hillshade types the source is drawn as its own child layer at the style slot named ‘name’. For the vector type the source is merged into the master source (see addVectorDataSource).

    Declaration

    Objective-C

    - (void)addExternalDataSource:(NSString *)name
                       dataSource:(MSFTileDataSource *)dataSource
                             type:(enum MSFCompositeSourceType)type;

    Swift

    func addExternalDataSource(_ name: String!, dataSource: MSFTileDataSource!, type: MSFCompositeSourceType)

    Parameters

    name

    The source name; must match a layer name in the style “layers” array.

    dataSource

    The external data source.

    type

    The source type.

  • Adds a named MBVT/protobuf source (including ContourTileDataSource) merged into the master source and styled by the master CartoCSS. Equivalent to addExternalDataSource with COMPOSITE_SOURCE_TYPE_VECTOR.

    Declaration

    Objective-C

    - (void)addVectorDataSource:(NSString *)name
                     dataSource:(MSFTileDataSource *)dataSource;

    Swift

    func addVectorDataSource(_ name: String!, dataSource: MSFTileDataSource!)

    Parameters

    name

    The source name; its layers must be declared in the master style.

    dataSource

    The vector data source to merge.

  • Removes the named external data source (of any type). Returns true if removed.

    Declaration

    Objective-C

    - (BOOL)removeExternalDataSource:(NSString *)name;

    Swift

    func removeExternalDataSource(_ name: String!) -> Bool

    Parameters

    name

    The source name.

    Return Value

    True if a source was removed.

  • Returns the names of all registered external data sources.

    Declaration

    Objective-C

    - (MSFStringVector *)getExternalDataSourceNames;

    Swift

    func getExternalDataSourceNames() -> MSFStringVector!

    Return Value

    The registered external source names.

  • Returns the child layer a slot is drawn by - a RasterTileLayer, a HillshadeRasterTileLayer or a VectorTileLayer, depending on the source type. This is the way to reach a setting the config symbolizer does not carry: a HillshadeRasterTileLayer’s NormalMapLightingShader is generated GLSL rather than a style property, and applyConfig never writes it, so a shader set through this survives the per-frame config pass.

    The child is owned by this layer - do not add it to a map.

    Declaration

    Objective-C

    - (MSFLayer *)getExternalChildLayer:(NSString *)name;

    Swift

    func getExternalChildLayer(_ name: String!) -> MSFLayer!

    Parameters

    name

    The source name.

    Return Value

    The child layer, or null if no source is registered under that name.

  • Returns whether single-pass segmented rendering is enabled (Milestone 6, optional).

    Declaration

    Objective-C

    - (BOOL)isSinglePassRenderingEnabled;

    Swift

    func isSinglePassRenderingEnabled() -> Bool

    Return Value

    True if single-pass rendering is enabled. The default is false.

  • Sets whether to use the optional single-pass segmented renderer instead of the default one-vt-pass-per-segment path. Intended for A/B comparison; currently a no-op placeholder until the single-pass renderer lands.

    Declaration

    Objective-C

    - (void)setSinglePassRenderingEnabled:(BOOL)enabled;

    Swift

    func setSinglePassRenderingEnabled(_ enabled: Bool)

    Parameters

    enabled

    True to enable single-pass rendering.

  • Sets the zoom level bias for this layer and for every child layer it owns (external raster/hillshade/vector sources and the internal style-group layers). Sources with a per-source bias set via setExternalDataSourceZoomLevelBias keep their own value.

    Declaration

    Objective-C

    - (void)setZoomLevelBias:(float)bias;

    Swift

    func setZoomLevelBias(_ bias: Float)

    Parameters

    bias

    The new bias value, both positive and negative fractional values are supported.

  • Sets the preloading state for this layer and for every child layer it owns.

    Declaration

    Objective-C

    - (void)setPreloading:(BOOL)preloading;

    Swift

    func setPreloading(_ preloading: Bool)

    Parameters

    preloading

    The new preloading state of the layer.

  • Sets the zoom level bias of a single external data source, overriding the layer-wide value. Use this to fetch a source at a different resolution from the base map - e.g. a bias of 1.0 on a high-resolution DEM source makes the hillshade use one zoom level more detail. Note that if the style defines a ‘zoom-level-bias’ value for this source, the style value wins - the same precedence the other per-source config values have.

    Declaration

    Objective-C

    - (void)setExternalDataSourceZoomLevelBias:(NSString *)name bias:(float)bias;

    Swift

    func setExternalDataSourceZoomLevelBias(_ name: String!, bias: Float)

    Parameters

    name

    The source name.

    bias

    The new bias value, both positive and negative fractional values are supported. @throws NSException If the source does not exist.

  • Returns the effective zoom level bias of the given external data source.

    Declaration

    Objective-C

    - (float)getExternalDataSourceZoomLevelBias:(NSString *)name;

    Swift

    func getExternalDataSourceZoomLevelBias(_ name: String!) -> Float

    Parameters

    name

    The source name.

    Return Value

    The zoom level bias of the source. @throws NSException If the source does not exist.

  • Clears the per-source zoom level bias, so the source follows the layer-wide value again.

    Declaration

    Objective-C

    - (void)clearExternalDataSourceZoomLevelBias:(NSString *)name;

    Swift

    func clearExternalDataSourceZoomLevelBias(_ name: String!)

    Parameters

    name

    The source name. @throws NSException If the source does not exist.

  • Sets the maximum overzoom level of a single external data source. Overzooming reuses a coarser parent tile when the source has no tile at the target zoom level, which is how a low-resolution DEM keeps covering the map above its own max zoom.

    Declaration

    Objective-C

    - (void)setExternalDataSourceMaxOverzoomLevel:(NSString *)name level:(int)level;

    Swift

    func setExternalDataSourceMaxOverzoomLevel(_ name: String!, level: Int32)

    Parameters

    name

    The source name.

    level

    The new maximum overzoom level. @throws NSException If the source does not exist.

  • Returns the maximum overzoom level of the given external data source.

    Declaration

    Objective-C

    - (int)getExternalDataSourceMaxOverzoomLevel:(NSString *)name;

    Swift

    func getExternalDataSourceMaxOverzoomLevel(_ name: String!) -> Int32

    Parameters

    name

    The source name.

    Return Value

    The maximum overzoom level of the source. @throws NSException If the source does not exist.

  • Undocumented

    Declaration

    Objective-C

    -(void)dealloc;

    Swift

    func dealloc()