MapGISVectorLayer

new Cesium.MapGISVectorLayer(imageryProvider, options)

An imagery layer that displays tiled image data from a single imagery provider on a Globe.
Name Type Description
imageryProvider ImageryProvider The imagery provider to use.
options Object optional Object with the following properties:
Name Type Default Description
rectangle Rectangle imageryProvider.rectangle optional The rectangle of the layer. This rectangle can limit the visible portion of the imagery provider.
alpha Number | function 1.0 optional The alpha blending value of this layer, from 0.0 to 1.0. This can either be a simple number or a function with the signature function(frameState, layer, x, y, level). The function is passed the current frame state, this layer, and the x, y, and level coordinates of the imagery tile for which the alpha is required, and it is expected to return the alpha value to use for the tile.
nightAlpha Number | function 1.0 optional The alpha blending value of this layer on the night side of the globe, from 0.0 to 1.0. This can either be a simple number or a function with the signature function(frameState, layer, x, y, level). The function is passed the current frame state, this layer, and the x, y, and level coordinates of the imagery tile for which the alpha is required, and it is expected to return the alpha value to use for the tile. This only takes effect when enableLighting is true.
dayAlpha Number | function 1.0 optional The alpha blending value of this layer on the day side of the globe, from 0.0 to 1.0. This can either be a simple number or a function with the signature function(frameState, layer, x, y, level). The function is passed the current frame state, this layer, and the x, y, and level coordinates of the imagery tile for which the alpha is required, and it is expected to return the alpha value to use for the tile. This only takes effect when enableLighting is true.
brightness Number | function 1.0 optional The brightness of this layer. 1.0 uses the unmodified imagery color. Less than 1.0 makes the imagery darker while greater than 1.0 makes it brighter. This can either be a simple number or a function with the signature function(frameState, layer, x, y, level). The function is passed the current frame state, this layer, and the x, y, and level coordinates of the imagery tile for which the brightness is required, and it is expected to return the brightness value to use for the tile. The function is executed for every frame and for every tile, so it must be fast.
contrast Number | function 1.0 optional The contrast of this layer. 1.0 uses the unmodified imagery color. Less than 1.0 reduces the contrast while greater than 1.0 increases it. This can either be a simple number or a function with the signature function(frameState, layer, x, y, level). The function is passed the current frame state, this layer, and the x, y, and level coordinates of the imagery tile for which the contrast is required, and it is expected to return the contrast value to use for the tile. The function is executed for every frame and for every tile, so it must be fast.
hue Number | function 0.0 optional The hue of this layer. 0.0 uses the unmodified imagery color. This can either be a simple number or a function with the signature function(frameState, layer, x, y, level). The function is passed the current frame state, this layer, and the x, y, and level coordinates of the imagery tile for which the hue is required, and it is expected to return the contrast value to use for the tile. The function is executed for every frame and for every tile, so it must be fast.
saturation Number | function 1.0 optional The saturation of this layer. 1.0 uses the unmodified imagery color. Less than 1.0 reduces the saturation while greater than 1.0 increases it. This can either be a simple number or a function with the signature function(frameState, layer, x, y, level). The function is passed the current frame state, this layer, and the x, y, and level coordinates of the imagery tile for which the saturation is required, and it is expected to return the contrast value to use for the tile. The function is executed for every frame and for every tile, so it must be fast.
gamma Number | function 1.0 optional The gamma correction to apply to this layer. 1.0 uses the unmodified imagery color. This can either be a simple number or a function with the signature function(frameState, layer, x, y, level). The function is passed the current frame state, this layer, and the x, y, and level coordinates of the imagery tile for which the gamma is required, and it is expected to return the gamma value to use for the tile. The function is executed for every frame and for every tile, so it must be fast.
splitDirection ImagerySplitDirection | function ImagerySplitDirection.NONE optional The ImagerySplitDirection split to apply to this layer.
minificationFilter TextureMinificationFilter TextureMinificationFilter.LINEAR optional The texture minification filter to apply to this layer. Possible values are TextureMinificationFilter.LINEAR and TextureMinificationFilter.NEAREST.
magnificationFilter TextureMagnificationFilter TextureMagnificationFilter.LINEAR optional The texture minification filter to apply to this layer. Possible values are TextureMagnificationFilter.LINEAR and TextureMagnificationFilter.NEAREST.
show Boolean true optional True if the layer is shown; otherwise, false.
maximumAnisotropy Number maximum supported optional The maximum anisotropy level to use for texture filtering. If this parameter is not specified, the maximum anisotropy supported by the WebGL stack will be used. Larger values make the imagery look better in horizon views.
minimumTerrainLevel Number optional The minimum terrain level-of-detail at which to show this imagery layer, or undefined to show it at all levels. Level zero is the least-detailed level.
maximumTerrainLevel Number optional The maximum terrain level-of-detail at which to show this imagery layer, or undefined to show it at all levels. Level zero is the least-detailed level.
cutoutRectangle Rectangle optional Cartographic rectangle for cutting out a portion of this MapGISVectorLayer.
colorToAlpha Color optional Color to be used as alpha.
colorToAlphaThreshold Number 0.004 optional Threshold for color-to-alpha.

Members

static Cesium.MapGISVectorLayer.DEFAULT_APPLY_COLOR_TO_ALPHA_THRESHOLD : Number

This value is used as the default threshold for color-to-alpha if one is not provided during construction or by the imagery provider.
Default Value: 0.004

static Cesium.MapGISVectorLayer.DEFAULT_BRIGHTNESS : Number

This value is used as the default brightness for the imagery layer if one is not provided during construction or by the imagery provider. This value does not modify the brightness of the imagery.
Default Value: 1.0

static Cesium.MapGISVectorLayer.DEFAULT_CONTRAST : Number

This value is used as the default contrast for the imagery layer if one is not provided during construction or by the imagery provider. This value does not modify the contrast of the imagery.
Default Value: 1.0

static Cesium.MapGISVectorLayer.DEFAULT_GAMMA : Number

This value is used as the default gamma for the imagery layer if one is not provided during construction or by the imagery provider. This value does not modify the gamma of the imagery.
Default Value: 1.0

static Cesium.MapGISVectorLayer.DEFAULT_HUE : Number

This value is used as the default hue for the imagery layer if one is not provided during construction or by the imagery provider. This value does not modify the hue of the imagery.
Default Value: 0.0

static Cesium.MapGISVectorLayer.DEFAULT_MAGNIFICATION_FILTER : TextureMagnificationFilter

This value is used as the default texture magnification filter for the imagery layer if one is not provided during construction or by the imagery provider.
Default Value: TextureMagnificationFilter.LINEAR

static Cesium.MapGISVectorLayer.DEFAULT_MINIFICATION_FILTER : TextureMinificationFilter

This value is used as the default texture minification filter for the imagery layer if one is not provided during construction or by the imagery provider.
Default Value: TextureMinificationFilter.LINEAR

static Cesium.MapGISVectorLayer.DEFAULT_SATURATION : Number

This value is used as the default saturation for the imagery layer if one is not provided during construction or by the imagery provider. This value does not modify the saturation of the imagery.
Default Value: 1.0

static Cesium.MapGISVectorLayer.DEFAULT_SPLIT : ImagerySplitDirection

This value is used as the default split for the imagery layer if one is not provided during construction or by the imagery provider.
Default Value: ImagerySplitDirection.NONE
The alpha blending value of this layer, with 0.0 representing fully transparent and 1.0 representing fully opaque.
Default Value: 1.0
The brightness of this layer. 1.0 uses the unmodified imagery color. Less than 1.0 makes the imagery darker while greater than 1.0 makes it brighter.
Default Value: MapGISVectorLayer.DEFAULT_BRIGHTNESS
Color value that should be set to transparent.

colorToAlphaThreshold : Number

Normalized (0-1) threshold for color-to-alpha.
The contrast of this layer. 1.0 uses the unmodified imagery color. Less than 1.0 reduces the contrast while greater than 1.0 increases it.
Default Value: MapGISVectorLayer.DEFAULT_CONTRAST
Rectangle cutout in this layer of imagery.
The alpha blending value of this layer on the day side of the globe, with 0.0 representing fully transparent and 1.0 representing fully opaque. This only takes effect when Globe#enableLighting is true.
Default Value: 1.0
The gamma correction to apply to this layer. 1.0 uses the unmodified imagery color.
Default Value: MapGISVectorLayer.DEFAULT_GAMMA
The hue of this layer in radians. 0.0 uses the unmodified imagery color.
Default Value: MapGISVectorLayer.DEFAULT_HUE
Gets the imagery provider for this layer.
The TextureMagnificationFilter to apply to this layer. Possible values are TextureMagnificationFilter.LINEAR (the default) and TextureMagnificationFilter.NEAREST. To take effect, this property must be set immediately after adding the imagery layer. Once a texture is loaded it won't be possible to change the texture filter used.
Default Value: MapGISVectorLayer.DEFAULT_MAGNIFICATION_FILTER
The TextureMinificationFilter to apply to this layer. Possible values are TextureMinificationFilter.LINEAR (the default) and TextureMinificationFilter.NEAREST. To take effect, this property must be set immediately after adding the imagery layer. Once a texture is loaded it won't be possible to change the texture filter used.
Default Value: MapGISVectorLayer.DEFAULT_MINIFICATION_FILTER
The alpha blending value of this layer on the night side of the globe, with 0.0 representing fully transparent and 1.0 representing fully opaque. This only takes effect when Globe#enableLighting is true.
Default Value: 1.0
Gets the rectangle of this layer. If this rectangle is smaller than the rectangle of the ImageryProvider, only a portion of the imagery provider is shown.
The saturation of this layer. 1.0 uses the unmodified imagery color. Less than 1.0 reduces the saturation while greater than 1.0 increases it.
Default Value: MapGISVectorLayer.DEFAULT_SATURATION
Determines if this layer is shown.
Default Value: true
The ImagerySplitDirection to apply to this layer.
Default Value: MapGISVectorLayer.DEFAULT_SPLIT
透明度属性

Methods

_appendPrimitives(imagery)

供imagery调用的使用自身矢量数据绘制Primitive
Name Type Description
imagery Object The imagery to add Primitives.
Example:
imagery.imageryLayer._appendPrimitives(imagery);
向图层添加矢量要素,所添加的要素类型需要与图层已加载要素类型一致
Name Type Description
id Number 矢量要素的id
options Object 包含以下属性
Name Type Default Description
positions Array.<Cartesian3> 组成多边形或折线的点坐标数组,添加点要素则该参数为包含一个坐标的数组
color Color optional 矢量要素的颜色
pixelSize Number optional 矢量点的像素大小
height Number 0 optional 矢量白模的高度
width Number 0 optional 矢量线的线宽
extendAttr Object optional 拓展属性记录 eg: options.extendAttr={Name: name, Type: type}
Returns:
绘制所添加矢量要素的Primitive
Example:
var mapGisVectorLayer = webGlobe.appendMapGISVectorLayer('http://localhost:6163/igs/rest/mrms/docs/二维矢量',options);
    mapGisVectorLayer.addVector(294994, { positions: positions, color: Cesium.Color.CADETBLUE, height: 100 });;
城市生长初始化,数据准备完成后会直接开始展示
Name Type Description
options Object
Name Type Default Description
startTimeField String 数据的建筑开始时间字段名
endTimeField String optional 数据的拆除时间字段名
displayWithTile String false optional Line|Tile 根据时间线性加载或瓦片动态加载,适用不同的数据量展示,默认为线性加载
cityGrowSpeed Number 0.5 optional 城市生长速度,取值范围 0 ~ 1,速度为0不加载,速度为1时加载全部数据
buildingsGrowTime Number 10 optional 建筑建设时长,默认值为10秒
updateInerval Number 1 optional 更新间隔,默认每秒执行一次更新,间隔越短所需计算量越大,默认值为1秒
startTime Number optional 起始时间,未指定则自动请求
endTime Number optional 结束时间,未指定则自动请求
timeAsc Boolean true optional 时间是否为升序,即升序排列第一个为城市建设开始时间,用于未指定起止时间的数据请求
buildingsLimit Number Number.MAX_VALUE optional 线性加载时每一时段的建筑数量限制
colors Array.<Color> optional 建筑颜色数组
Example:
var options = {
    autoReset: true,
    //添加过滤条件,同矢量加载
    // filter: { where: 'height>3' },
    getDocLayerIndexes: function (indexs) {
        console.log(indexs);
        layerIndex = indexs[0];
        layer = viewer.scene.layers.getLayer(layerIndex);
        console.log(layer);
    },
    style: {
        type: 'cityGrow',
        styleOptions: {
            heightField: 'height',
            heightRatio: 10,
            startTimeField: 'startTime',
            endTimeField: 'endTime',
            replay: false,
            displayWithTile: false,
            cityGrowSpeed: 0.5,
            colors: colors,
            colorSampling: false,
            //buildingsLimit:线性加载时每一时段的建筑数量限制,默认无限制
            buildingsLimit: 100,
            updateInterval: 0.5
        }
   }
};
viewer.scene.layers.appendVectorLayer(url, options);
继续城市生长

cityGrowSetTime(time, isPlayTime)Boolean

跳转到给定时间进行展示
Name Type Default Description
time Number 秒数或时间戳
isPlayTime Boolean flase optional false表示传入秒数,true表示传入时间戳
Returns:
若返回false,则还在进行数据准备,或者时间超出范围

cityGrowStart()Boolean

开始城市生长
Returns:
若返回false,则还在进行数据准备
暂停城市生长
Destroys the WebGL resources held by this object. Destroying an object allows for deterministic release of WebGL resources, instead of relying on the garbage collector to destroy this object.

Once an object is destroyed, it should not be used; calling any function other than isDestroyed will result in a DeveloperError exception. Therefore, assign the return value (undefined) to the object as done in the example.
Throws:
  • DeveloperError : This object was destroyed, i.e., destroy() was called.
Example:
MapGISVectorLayer = MapGISVectorLayer && MapGISVectorLayer.destroy();
See:
根据过滤条件闪烁要素,该方法支持点,线,区的闪烁,不支持边框线样式
Name Type Description
options Object
Name Type Default Description
filter Object optional 过滤条件,不指定则全部闪烁,同 MapGISVectorprovider 初始化中options.filter参数
flashColor Color optional 闪烁颜色
flashSpeed Number 0.5 optional 闪烁速度
flashAppearance Object optional 点线面的高亮效果
获取该图层所有原始矢量数据
Example:
var MapGISVectorLayer=Cesium.viewer.imageryLayers.addVectorProvider(new MapGISVectorProvider(options));
       MapGISVectorLayer.getAllFeatures().then(function(data){
           doSomething(data);
       })

getVectorById(id)object|undefined

根据id获取绘制矢量数据的相关对象
Name Type Description
id Number 矢量数据的id
Returns:
由一个GeometryInstance和一个Primitive组成的对象,若查找不到则返回undefined
Example:
var mapGisVectorLayer = webGlobe.appendMapGISVectorLayer('http://localhost:6163/igs/rest/mrms/docs/二维矢量',options);
var vectorObject = VectorLayers[2].getVectorById(192);
var vectorPrimitive = vectorObject.primitive;
var vectorGeometryInstance = vectorObject.geometryInstance;

getVectorOutlineById(id)object

根据id获取绘制矢量数据边框线的GeometryInstance与所属的Primitive
Name Type Description
id Number 矢量数据的id
Returns:
由一个GeometryInstance和一个Primitive组成的对象,若查找不到则返回undefined
Example:
var mapGisVectorLayer = webGlobe.appendMapGISVectorLayer('http://localhost:6163/igs/rest/mrms/docs/二维矢量',options);
var vectorOutlineObject = VectorLayers[2].getVectorOutlineById(192);
var vectorOutlinePrimitive = vectorObject.primitive;
var vectorOutlineGeometryInstance = vectorObject.geometryInstance;

getViewableRectangle()Promise.<Rectangle>

Computes the intersection of this layer's rectangle with the imagery provider's availability rectangle, producing the overall bounds of imagery that can be produced by this layer.
Returns:
A promise to a rectangle which defines the overall bounds of imagery that can be produced by this layer.
Example:
// Zoom to an imagery layer.
MapGISVectorLayer.getViewableRectangle().then(function (rectangle) {
    return camera.flyTo({
        destination: rectangle
    });
});

isBaseLayer()Boolean

Gets a value indicating whether this layer is the base layer in the ImageryLayerCollection. The base layer is the one that underlies all others. It is special in that it is treated as if it has global rectangle, even if it actually does not, by stretching the texels at the edges over the entire globe.
Returns:
true if this is the base layer; otherwise, false.

isDestroyed()Boolean

Returns true if this object was destroyed; otherwise, false.

If this object was destroyed, it should not be used; calling any function other than isDestroyed will result in a DeveloperError exception.
Returns:
True if this object was destroyed; otherwise, false.
See:
原始矢量数据条件查询
Name Type Description
options Object 查询条件参数,详细参照相应的数据Provider类中queryVector方法,以下为MapGISVectorProvider参数
Name Type Default Description
mapIndex Number 0 optional 地图在文档下的序号
layerIdxs String '0' optional 图层序号,多图层间以“,”号分隔
pageCount Number 20 optional 要素结果集每页的记录数量
page Number 0 optional 返回的要素分页的页数
strusts Object {IncludeAttribute:true,IncludeGeometry:true,IncludeWebGraphic:true} optional 返回的数据结构
orderField String optional 排序字段名称,用于对输出结果进行排序
isAsc boolean false optional 按照字段进行排序时,是否升序排列
objectIds Array optional 需要查询的要素的OID值数组,当objectIds有值时,代表基于objectIds查询,Where、geometry、geometryType、orderField、isAsc等查询参数无效.
geometryType String optional 几何类型,代表空间查询时传入的几何类型
geometry Object optional 几何类型对应的图形信息,也就是构成几何类型的坐标信息
where String optional 要素过滤条件
rule String optional 指定查询规则 {CompareRectOnly:true|false,EnableDisplayCondition:true|false,MustInside:true|false,Intersect:true|false}
Example:
var options1 = {
           pageCount: 120,
           where: 'mpArea>20',
           orderField: mpArea,
           isAsc: true
       };

       var idArray = [1,4,8,36,89];
       var options2 = {
           objectIds: idArray
       };

       //参照DrawElement对应绘图返回值
       var p = Cartesian3.fromDegrees(120.9804, 31.3443, 0);
       var point = {
           position: p,
           neardistance: 100
       };
       var circle = {
           center: p,
           radius: 1
       };
       var rect = new Cesium.Rectangle(west, south, east, north);
       var polypositions = Cartesian3.fromDegreesArray([120.9804, 31.3443, 121.0682, 31.3604, 121.0682, 31.3443]);
       var polyline = {
           positions: polypositions,
           neardistance: 100
       };
       var polygon = {
           positions: polypositions
       };
       var optionsRect = {
           geometryType: 'rect',
           geometry:      rect
       };

       var mapGisVectorLayer = webGlobe.appendMapGISVectorLayer('http://localhost:6163/igs/rest/mrms/docs/二维矢量',options);
       MapGISVectorLayer.queryFeatures(options1).then(function(data){
           doSomething(data);
       })
移除要素闪烁

removeVectorById(id)Boolean

根据id移除矢量
Name Type Description
id Number 矢量要素的id
Returns:
若该id找不到对应矢量返回false,成功移除返回true
Example:
var mapGisVectorLayer = webGlobe.appendMapGISVectorLayer('http://localhost:6163/igs/rest/mrms/docs/二维矢量',options);
    mapGisVectorLayer.removeVectorById(193);
城市生长倍速调整

updatePrimitive(primitive)

更新发生更改的Primitive,供updateVectorById,removeVectorById使用
Name Type Description
primitive Primitive 进行更新的Primitive
城市生长线性展示更新

updateVectorById(id, options)Boolean

根据id更新矢量
Name Type Description
id Number 矢量要素的id
options Object 该方法可进行修改的属性如下
Name Type Description
positions Array.<Cartesian3> optional 组成多边形或折线的点坐标数组,点数据则为只有一个坐标的数组。
pixelSize Number optional 矢量点的像素大小
color Color optional 矢量的颜色
height Number optional 矢量白模的高度
width Number optional 矢量线的宽度
outlineColor Color optional 边框线的颜色,仅当存在边框线时生效
outlineWidth Number optional 边框线的宽度,仅当存在边框线时生效
Returns:
若该id找不到对应矢量返回false,成功更新返回true
Example:
var mapGisVectorLayer = webGlobe.appendMapGISVectorLayer('http://localhost:6163/igs/rest/mrms/docs/二维矢量',options);
    mapGisVectorLayer.updateVectorById(192, { color: Cesium.Color.CADETBLUE });