类: VectorTileImageryProvider

Cesium. VectorTileImageryProvider

new VectorTileImageryProvider(options)

动态矢量切片提供程序,支持esri shapefile、geojson文件,也可以直接加载geojson对象和Polygon,PolyLine
Parameters:
Name Type Description
options Object 参数如下:
Properties
Name Type Attributes Default Description
source String | turf.FeatureCollection | Object | Array.<(MeteoLib.Util.Contour.PolyLine|MeteoLib.Util.Contour.Polygon|File)> MeteoLib.Util.Contour.PolyLine及MeteoLib.Util.Contour.Polygon数组、矢量文件url、矢量文件列表或者geojson对象
defaultStyle MeteoLib.Render.VectorStyle <optional>
MeteoLib.Render.VectorStyle.Default 默认样式
simplify Boolean <optional>
false true则简化,默认不简化
simplifyTolerance Boolean <optional>
0.01 简化公差
minimumLevel Boolean <optional>
3 最小级别
maximumLevel Boolean <optional>
22 最大级别
styleFilter Cesium.VectorTileImageryProvider~StyleFilterCallback <optional>
样式函数
Source:
Example
//1.面数据
            viewer.imageryLayers.addImageryProvider(new VectorTileImageryProvider({
                source: appConfig.BaseURL + "Assets/VectorData/中国数据/陕西/榆林/county_sshanxi_yulin.shp",
                defaultStyle:{ outlineColor: Cesium.Color.WHITE, 
                    fill: true
                },
                maximumLevel: 22,
                minimumLevel: 0
            }))
            //2.点数据
            viewer.imageryLayers.addImageryProvider(new VectorTileImageryProvider({
                source: appConfig.BaseURL + "Assets/VectorData/中国数据/陕西/榆林/town_sshanxi_yulin.shp"
                ,defaultStyle:{ 
                    fontColor: Cesium.Color.WHITE
                    , fontSize: 20
                    , fontFamily: '微软雅黑'
                    , makerImage: appConfig.BaseURL + "Assets/Images/Stations/autonew.png"
                     , labelOffsetY: 5
                    , labelOffsetX: 10
                }
                    , maximumLevel: 22
                    , minimumLevel: 9
            }))
            //3.线数据
              viewer.imageryLayers.addImageryProvider(new VectorTileImageryProvider({
                source: appConfig.BaseURL + "Assets/VectorData/中国数据/中国边界.shp" 
            }))
    
            //4.geojson
            viewer.imageryLayers.addImageryProvider(new VectorTileImageryProvider({
                source: appConfig.BaseURL + "Assets/SampleData/simplestyles.geojson",//VectorData/中国数据/中国边界.shp",
                defaultStyle:{
                    fill: true
                },
                    minimumLevel: 0
            }))
    
            5.使用样式函数(styleFilter)设置样式
             viewer.imageryLayers.addImageryProvider(new Cesium.VectorTileImageryProvider({
                source: appConfig.BaseURL + "Assets/VectorData/世界数据/Countries.shp",
                defaultStyle: {
                    outlineColor: Cesium.Color.YELLOW,
                    lineWidth: 2,
                    fillColor: Cesium.Color.fromBytes(2, 24, 47, 200),
                    fill: false,
                    tileCacheSize: 200,
                    showMaker: false,
                    showCenterLabel: true,
                    fontColor: "rgba(255,0,0,1)",
                    labelOffsetX: -10,
                    labelOffsetY: -5,
                    fontSize: 13,
                    fontFamily: "黑体",
                    centerLabelPropertyName: "NAME"
                },
                maximumLevel: 20,
                minimumLevel: 1,
                simplify: false ,
                styleFilter: function (feature, style) {
                    if (feature.properties.hasOwnProperty("NAME") && feature.properties["NAME"].toLocaleLowerCase().indexOf("china") >= 0) {
                        style.outlineColor = Cesium.Color.RED;
                        style.fill = true;
                        style.fillColor = Cesium.Color.AZURE.withAlpha(0.5);
                    }
                }
            }))

Extends

  • Cesium.ImageryProvider

Members

(readonly) credit :Credit

Gets the credit to display when this imagery provider is active. Typically this is used to credit the source of the imagery. This function should not be called before Cesium.VectorTileImageryProvider#ready returns true.
Type:
  • Credit
Source:

(readonly) errorEvent :Event

Gets an event that is raised when the imagery provider encounters an asynchronous error. By subscribing to the event, you will be notified of the error and can potentially recover from it. Event listeners are passed an instance of TileProviderError.
Type:
  • Event
Source:

(readonly) hasAlphaChannel :Boolean

Gets a value indicating whether or not the images provided by this imagery provider include an alpha channel. If this property is false, an alpha channel, if present, will be ignored. If this property is true, any images without an alpha channel will be treated as if their alpha is 1.0 everywhere. When this property is false, memory usage and texture upload time are reduced.
Type:
  • Boolean
Source:

(readonly) maximumLevel :Number

Gets the maximum level-of-detail that can be requested. This function should not be called before Cesium.VectorTileImageryProvider#ready returns true.
Type:
  • Number
Source:

(readonly) minimumLevel :Number

Gets the minimum level-of-detail that can be requested. This function should not be called before Cesium.VectorTileImageryProvider#ready returns true.
Type:
  • Number
Source:

(readonly) proxy :Proxy

Gets the proxy used by this provider.
Type:
  • Proxy
Source:

(readonly) ready :Boolean

Gets a value indicating whether or not the provider is ready for use.
Type:
  • Boolean
Source:

(readonly) readyPromise :Promise.<Boolean>

Gets a promise that resolves to true when the provider is ready for use.
Type:
  • Promise.<Boolean>
Source:

(readonly) rectangle :Rectangle

Gets the rectangle, in radians, of the imagery provided by this instance. This function should not be called before Cesium.VectorTileImageryProvider#ready returns true.
Type:
  • Rectangle
Source:

(readonly) tileDiscardPolicy :TileDiscardPolicy

Gets the tile discard policy. If not undefined, the discard policy is responsible for filtering out "missing" tiles via its shouldDiscardImage function. If this function returns undefined, no tiles are filtered. This function should not be called before Cesium.VectorTileImageryProvider#ready returns true.
Type:
  • TileDiscardPolicy
Source:

(readonly) tileHeight :Number

Gets the height of each tile, in pixels. This function should not be called before Cesium.VectorTileImageryProvider#ready returns true.
Type:
  • Number
Source:

(readonly) tileWidth :Number

Gets the width of each tile, in pixels. This function should not be called before Cesium.VectorTileImageryProvider#ready returns true.
Type:
  • Number
Source:

(readonly) tilingScheme :TilingScheme

Gets the tiling scheme used by this provider. This function should not be called before Cesium.VectorTileImageryProvider#ready returns true.
Type:
  • TilingScheme
Source:

Type Definitions

StyleFilterCallback(feature, style)

样式设置函数
Parameters:
Name Type Description
feature Geojson.Feature 当前要素(用Geojson.Feature存储)
style MeteoLib.Render.VectorStyle 即将应用与当前要素的样式,可以通过修改该参数中的各样式设置选项来针对当前要素进行特殊的样式设置。 修改后只对当前要素有效,不会修改Cesium.VectorTileImageryProvider的默认样式
Source:
Example
undefined