MMapDefaultSchemeLayer
The MMapDefaultSchemeLayer
class is a visual component that loads map scheme data from some source and adds it to the map.
Depending on the layers
parameter, a layer can display:
ground
: The whole raster map scheme and the vector ground layer.buildings
: The building vector layer.icons
: The icon vector layer.labels
: The label vector layer.
Creating a layer
For example, this code will load the data and add a raster scheme layer to the map:
const schema = new MMapDefaultSchemeLayer({type: 'ground'});
map.addChild(schema);
This code will load the data and add all scheme layers with all data sources to the map:
const schema = new MMapDefaultSchemeLayer({theme: 'light'});
map.addChild(schema);
Note
In this example, the layer constructor receives only the color theme as input, and the other parameters are taken from MMapDefaultSchemeLayer.defaultProps
by default
Creating a layer with selected schemes
The MMapDefaultSchemeLayer
class can be used only as a data loader so that the loaded data can be displayed selectively using MMapLayer
:
// Initialize invisible MMapDefaultSchemeLayer.
// It is hidden because it is only used to load data.
const schema = MMapDefaultSchemeLayer({theme: 'light', visible: false, source: 'scheme'});
// Add it to the map.
map.addChild(schema);
// Then add a couple MMapLayer's to the map, specifying for each of them
// which data from MMapDefaultSchemeLayer to display.
map.addChild(new MMapLayer({zIndex: 1, source: 'scheme', type: 'ground'}))
map.addChild(new MMapLayer({zIndex: 2, source: 'scheme', type: 'labels'}))
map.addChild(new MMapLayer({zIndex: 3, source: 'scheme', type: 'buildings'}))
map.addChild(new MMapLayer({zIndex: 4, source: 'scheme', type: 'icons'}))
Constructor
new MMapDefaultSchemeLayer(props
, options?
)
Constructor parameters
Parameter |
Type |
Description |
|
Value of input |
|
|
Optional object parameters. |
Inherited from
new MMapDefaultSchemeLayer(props
, children?
, options?
)
Constructor parameters
Parameter |
Type |
|
|
|
|
|
|
Inherited from
Props
MMapDefaultSchemeLayerProps: Object
Parameters
Name |
Type |
Description |
|
|
Allows map scale limiting. If you want the layer scale not to lock when the maximum value is reached, you can set this field to false. You may need this, for example, when your custom layers run at a zoom larger than 21.
See example https://mappable.world/docs/js-api/examples/cases/over-zoom.html
|
|
Vector tile customization. |
|
|
|
Layer parameters. |
|
|
Source name. |
|
|
Theme applied to the |
|
|
Show |
Methods
update
update(changedProps
): void
Method of updating object props.
Parameters
Parameter |
Type |
Description |
|
New |
Returns
void