# Class: SkyLayer
创建天空图层.
# Hierarchy
-
↳ SkyLayer
# Table of contents
# Constructors
# Properties
# Methods
- addTo
- clickLayer
- clickPopup
- getData
- getLayerId
- getLayerStyle
- getSkyAtmosphereColor
- getSkyAtmosphereHaloColor
- getSkyAtmosphereSun
- getSkyAtmosphereSunIntensity
- getSkyGradient
- getSkyGradientCenter
- getSkyGradientRadius
- getSkyOpacity
- getSkyType
- getSourceId
- hide
- hoverFeatureState
- hoverLayer
- hoverPointer
- hoverPopup
- remove
- setFilter
- setLayerStyle
- setProperty
- setSkyAtmosphereColor
- setSkyAtmosphereHaloColor
- setSkyAtmosphereSun
- setSkyAtmosphereSunIntensity
- setSkyGradient
- setSkyGradientCenter
- setSkyGradientRadius
- setSkyOpacity
- setSkyType
- show
- toggle
# Constructors
# constructor
+ new SkyLayer(options
: SkyLayerOptions): SkyLayer
# Parameters
Name | Type |
---|---|
options | SkyLayerOptions |
Returns: SkyLayer
Overrides: OverlayLayerBase
# Properties
# _map
• Optional
_map: Map
Inherited from: OverlayLayerBase._map
# layerId
• Optional
layerId: string
Inherited from: OverlayLayerBase.layerId
# options
• options: SkyLayerOptions
# sourceId
• Optional
sourceId: string
Inherited from: OverlayLayerBase.sourceId
# Methods
# addTo
▸ addTo(map
: Map, beforeId?
: string): void
# Parameters
Name | Type |
---|---|
map | Map |
beforeId? | string |
Returns: void
Overrides: OverlayLayerBase
# clickLayer
▸ clickLayer(cb
: any): any
每当单击这些图层中的要素时都会触发回调。
# Parameters
Name | Type | Description |
---|---|---|
cb | any | Callback that receives event with .features property |
Returns: any
A function that removes the handler.
Inherited from: OverlayLayerBase
# clickPopup
▸ clickPopup(htmlFunc
: (arg0
: {}) => void, popupOptions?
: PopupOptions): any
每当单击这些图层中的要素时都会显示一个弹出窗口。
example
clickPopup(f => <h3>${f.properties.Name}</h3> ${f.properties.Description}
, { maxWidth: 500 });
# Parameters
Name | Type | Description |
---|---|---|
htmlFunc | (arg0 : {}) => void | Function that receives feature and popup, returns HTML. |
popupOptions? | PopupOptions | Options passed to Popup() to customise popup. |
Returns: any
A function that removes the handler.
Inherited from: OverlayLayerBase
# getData
▸ getData(): undefined | Feature<Geometry | GeometryCollection, Properties> | FeatureCollection<Geometry | GeometryCollection, Properties> | Geometry | GeometryCollection
获取数据源的数据
Returns: undefined | Feature<Geometry | GeometryCollection, Properties> | FeatureCollection<Geometry | GeometryCollection, Properties> | Geometry | GeometryCollection
Inherited from: OverlayLayerBase
# getLayerId
▸ getLayerId(): undefined | string
获取图层ID
Returns: undefined | string
Inherited from: OverlayLayerBase
# getLayerStyle
▸ getLayerStyle(): LayerSpecification
根据样式规范,获取给定图层 ID 的图层定义。
Returns: LayerSpecification
Inherited from: OverlayLayerBase
# getSkyAtmosphereColor
▸ getSkyAtmosphereColor(): string
Returns: string
# getSkyAtmosphereHaloColor
▸ getSkyAtmosphereHaloColor(): string
Returns: string
# getSkyAtmosphereSun
▸ getSkyAtmosphereSun(): PropertyValueSpecificationEx<[number, number]>
Returns: PropertyValueSpecificationEx<[number, number]>
# getSkyAtmosphereSunIntensity
▸ getSkyAtmosphereSunIntensity(): number
Returns: number
# getSkyGradient
▸ getSkyGradient(): ExpressionSpecificationEx
Returns: ExpressionSpecificationEx
# getSkyGradientCenter
▸ getSkyGradientCenter(): PropertyValueSpecificationEx<[number, number]>
Returns: PropertyValueSpecificationEx<[number, number]>
# getSkyGradientRadius
▸ getSkyGradientRadius(): PropertyValueSpecificationEx<number>
Returns: PropertyValueSpecificationEx<number>
# getSkyOpacity
▸ getSkyOpacity(): PropertyValueSpecificationEx<number>
Returns: PropertyValueSpecificationEx<number>
# getSkyType
▸ getSkyType(): PropertyValueSpecificationEx<"gradient"
| "atmosphere"
>
Returns: PropertyValueSpecificationEx<"gradient"
| "atmosphere"
>
# getSourceId
▸ getSourceId(): undefined | string
获取数据源ID
Returns: undefined | string
Inherited from: OverlayLayerBase
# hide
▸ hide(): void
使给定的图层不可见。
Returns: void
Inherited from: OverlayLayerBase
# hoverFeatureState
▸ hoverFeatureState(enterCb?
: (arg0
: {}) => void, leaveCb?
: (arg0
: {}) => void): void
每当将鼠标悬停在这些图层中的某个特征上时,更新连接源 [s] 中特征的特征状态。
# Parameters
Name | Type |
---|---|
enterCb? | (arg0 : {}) => void |
leaveCb? | (arg0 : {}) => void |
Returns: void
Inherited from: OverlayLayerBase
# hoverLayer
▸ hoverLayer(cb
: any): any
当鼠标悬停在这些图层中的要素上时触发回调。
# Parameters
Name | Type |
---|---|
cb | any |
Returns: any
A function to remove the handler.
Inherited from: OverlayLayerBase
# hoverPointer
▸ hoverPointer(): void
每当鼠标悬停在这些图层上时,将地图的光标设置为“指针”。
Returns: void
A function to remove the handler.
Inherited from: OverlayLayerBase
# hoverPopup
▸ hoverPopup(htmlFunc
: any, popupOptions?
: PopupOptions): any
将鼠标悬停在这些图层中的某个要素上时,会显示一个弹出窗口。
example
hoverPopup(f => <h3>${f.properties.Name}</h3> ${f.properties.Description}
, { anchor: 'left' });
# Parameters
Name | Type | Description |
---|---|---|
htmlFunc | any | Function that receives feature and popup, returns HTML. |
popupOptions? | PopupOptions | Options passed to Popup() to customise popup. |
Returns: any
Inherited from: OverlayLayerBase
# remove
▸ remove(): void
Returns: void
Inherited from: OverlayLayerBase
# setFilter
▸ setFilter(filter
: FilterSpecification): void
替换一个图层的过滤器。
example
setFilter(['==','level','0']]);
# Parameters
Name | Type | Description |
---|---|---|
filter | FilterSpecification | New filter to set. |
Returns: void
Inherited from: OverlayLayerBase
# setLayerStyle
▸ setLayerStyle(style
: any): void
设置图层样式
# Parameters
Name | Type |
---|---|
style | any |
Returns: void
Inherited from: OverlayLayerBase
# setProperty
▸ setProperty(prop
: string | object, value?
: any): void
在一个或多个图层上设置绘制或布局属性。
example
setProperty('fillOpacity', 0.5)
# Parameters
Name | Type |
---|---|
prop | string | object |
value? | any |
Returns: void
Inherited from: OverlayLayerBase
# setSkyAtmosphereColor
▸ setSkyAtmosphereColor(value
: string): SkyLayer
# Parameters
Name | Type |
---|---|
value | string |
Returns: SkyLayer
# setSkyAtmosphereHaloColor
▸ setSkyAtmosphereHaloColor(value
: string): SkyLayer
# Parameters
Name | Type |
---|---|
value | string |
Returns: SkyLayer
# setSkyAtmosphereSun
▸ setSkyAtmosphereSun(value
: PropertyValueSpecificationEx<[number, number]>): SkyLayer
# Parameters
Name | Type |
---|---|
value | PropertyValueSpecificationEx<[number, number]> |
Returns: SkyLayer
# setSkyAtmosphereSunIntensity
▸ setSkyAtmosphereSunIntensity(value
: number): SkyLayer
# Parameters
Name | Type |
---|---|
value | number |
Returns: SkyLayer
# setSkyGradient
▸ setSkyGradient(value
: ExpressionSpecificationEx): SkyLayer
# Parameters
Name | Type |
---|---|
value | ExpressionSpecificationEx |
Returns: SkyLayer
# setSkyGradientCenter
▸ setSkyGradientCenter(value
: PropertyValueSpecificationEx<[number, number]>): SkyLayer
# Parameters
Name | Type |
---|---|
value | PropertyValueSpecificationEx<[number, number]> |
Returns: SkyLayer
# setSkyGradientRadius
▸ setSkyGradientRadius(value
: PropertyValueSpecificationEx<number>): SkyLayer
# Parameters
Name | Type |
---|---|
value | PropertyValueSpecificationEx<number> |
Returns: SkyLayer
# setSkyOpacity
▸ setSkyOpacity(value
: PropertyValueSpecificationEx<number>): SkyLayer
# Parameters
Name | Type |
---|---|
value | PropertyValueSpecificationEx<number> |
Returns: SkyLayer
# setSkyType
▸ setSkyType(value
: PropertyValueSpecificationEx<"gradient"
| "atmosphere"
>): SkyLayer
# Parameters
Name | Type |
---|---|
value | PropertyValueSpecificationEx<"gradient" | "atmosphere" > |
Returns: SkyLayer
# show
▸ show(): void
使给定的图层可见。
Returns: void
Inherited from: OverlayLayerBase
# toggle
▸ toggle(state
: boolean): boolean
根据参数使给定的图层隐藏或可见。
# Parameters
Name | Type | Description |
---|---|---|
state | boolean | True for visible, false for hidden. |
Returns: boolean
Inherited from: OverlayLayerBase