new ol.supermap.MapboxStyles(options)
Name | Type | Description | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
Initialization parameters.
|
Example
var mbStyle = new ol.supermap.MapboxStyles({
url: url,
source: 'California',
resolutions: [78271.51696402048,39135.75848201024, 19567.87924100512,9783.93962050256,4891.96981025128,2445.98490512564]
})
mbStyle.on('styleLoaded', function () {
var vectorLayer = new ol.layer.VectorTile({
//Set avoidance parameters
declutter: true,
source: new ol.source.VectorTileSuperMapRest({
url: url,
format: new ol.format.MVT({
featureClass: ol.Feature
}),
tileType: 'ScaleXY'
}),
style: mbStyle.featureStyleFuntion
});
map.addLayer(vectorLayer);
})
Events
-
styleloaded
MapboxStyles.js, line 200 -
Triggered after the style is loaded successfully.
Methods
-
ol.supermap.MapboxStyles.getStyleFunction(){ol.FeatureStyleFunction}
MapboxStyles.js, line 102 -
Get the ol.FeatureStyleFunction.
Returns:
Type Description ol.FeatureStyleFunction Return the ol.FeatureStyleFunction. -
ol.supermap.MapboxStyles.getStylesBySourceLayer(sourceLayer)
MapboxStyles.js, line 110 -
Get the style based on the layer name.
Name Type Description sourceLayer
string The data layer name.
-
setSelectedId(selectedId, sourceLayer)
MapboxStyles.js, line 129 -
Sets the selected feature, which will be drawn in the
selectedStyle
style.Name Type Description selectedId
number Feature ID.
sourceLayer
string The layer name of the feature.
-
setStyle(style)
MapboxStyles.js, line 170 -
Set the Mapbox style object.
Name Type Description style
Object Mapbox style object.
- Version:
- 9.1.1
-
updateStyles(layerStyles)
MapboxStyles.js, line 141 -
Update the layer style.
Name Type Description layerStyles
Object An array of layer styles or layer styles.