Members
readonly featureLayersMap : HashMap
矢量图层管理容器
readonly geojsonLayersMap : HashMap
geojson图层管理容器
readonly imageryLayersMap : HashMap
影像图层管理容器
readonly m3dLayersMap : HashMap
M3D 图层管理容器
readonly sceneLayerMap : HashMap
SceneLayer 图层管理器
readonly terrainLayersMap : HashMap
地形图层管理容器
readonly vectorLayersMap : HashMap
矢量图层管理容器
Methods
添加 3DTileset 数据
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
url |
String | Resource | |||||||||||||||||||||||||||||||||||||||||||||||||
options |
Object |
|
Returns:
返回图层序号
加载MapGIS矢量地图文档
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
url |
String | 发布的文档地址,或Igs图层服务地址,对应的layers参数不同,使用Igs图层服务地址通过gdbp仅能加载二维矢量图层,eg:二维地图文档地址:http://[host]:[port]/igs/rest/mrfs/docs/{docName},三维地图文档地址:http://[host]:[port]/igs/rest/g3d/{docName},Igs图层服务地址:http://[host]:[port]/igs/rest/mrfs/layer | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
options |
Object |
其他附加属性包含以下属性的对象
|
Example:
var options1 = {
autoReset: true,
filter: {
where: 'OBJECTID>500'
},
renderer: {
type: 'simple',
symbol: {
type: 'point-3d',
symbolLayers: {
type: 'icon',
material: { color: new Cesium.Color(1.0, 1.0, 1.0, 1.0) },
resource: {herf: "http://localhost:8085/Apps/SampleData/icon/Hotel.png", scale: 1.5, distanceDisplayCondition: new Cesium.DistanceDisplayCondition(10, 100000), sizeInMeters: false},
size: 20.0
}
},
label: "svg点符号"
}
}
//java IGServer二维地图文档加载示例
var layerIndexs;
url = 'http://localhost:8089/igs/rest/services/二维矢量/FeatureServer/1';
options = {
getDocLayerIndexes: function (indexs) {
console.log(indexs);
layerIndexs = indexs;
},
}
viewer.scene.layers.appendFeatureLayer(url, options);
//.net IGServer二维地图文档加载示例
var layerIndexs;
url = 'http://localhost:6163/igs/rest/mrfs/docs/二维矢量/0/1';
options = {
getDocLayerIndexes: function (indexs) {
console.log(indexs);
layerIndexs = indexs;
},
}
viewer.scene.layers.appendFeatureLayer(url, options);
//gdbp地址加载示例
url_gdbp = 'http://localhost:6163/igs/rest/mrfs/layer';
option_gdbp={
layers:'gdbp1,gdbp2,gdbp3'
getDocLayerIndexes: function (indexs) {
console.log(indexs);
layerIndexs = indexs;
},
}
viewer.scene.layers.appendFeatureLayer(url_gdbp, option_gdbp);
//通过ID获取MapGISFeatureLayer图层
var layerIndexs;
for(var i = 0; i < layerIndexs; i++){
viewer.scene.layers.getFeatureLayer(layerIndexs[i]);
}
//通过ID移除MapGISFeatureLayer图层
for(var i = 0; i < layerIndexs; i++){
viewer.scene.layers.removeFeatureLayerByID(layerIndexs[i]);
}
加载GeoJSON数据
Name | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data |
String | Object | 数据类型,可选 url | GeoJSON Object | TopoJSON Object | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
options |
Object |
其他附加属性包含以下属性的对象
|
Example:
//Geojson数据加载示例
var layerIndexs;
data = 'http://localhost:8895/buildings.geojson';
var options1 = {
autoReset: true,
getDocLayerIndexes: function (indexs) {
console.log(indexs);
layerIndexs = indexs;
},
renderer: {
type: 'simple',
symbol: {
type: 'point-3d',
symbolLayers: {
type: 'icon',
material: { color: new Cesium.Color(1.0, 1.0, 1.0, 1.0) },
resource: {herf: "http://localhost:8085/Apps/SampleData/icon/Hotel.png", scale: 1.5, distanceDisplayCondition: new Cesium.DistanceDisplayCondition(10, 100000), sizeInMeters: false},
size: 20.0
}
},
label: "svg点符号"
}
}
viewer.scene.layers.appendFeatureLayer(data, options);
//通过ID获取MapGISGeojsonLayer图层
var layerIndexs;
for(var i = 0; i < layerIndexs; i++){
viewer.scene.layers.getFeatureLayer(layerIndexs[i]);
}
//通过ID移除MapGISGeojsonLayer图层
var layerIndexs;
for(var i = 0; i < layerIndexs; i++){
viewer.scene.layers.removeFeatureLayerByID(layerIndexs[i]);
}
添加标绘图层
Name | Type | Description |
---|---|---|
graphicsLayer |
GraphicsLayer | 标绘图层对象 |
添加标绘图层
Name | Type | Description |
---|---|---|
viewer |
Viewer | 视图对象 |
json |
String | json格式的字符串 |
添加影像图层
Name | Type | Description |
---|---|---|
url |
String | 服务地址 |
options |
Object | 可选参数 |
Returns:
layerIndex 返回图层序号
Example:
//添加影像图层,仅支持旧版IGS的.net服务
//返回图层序号
var layerIndex = viewer.scene.layers.appendImageryLayer("http://webclient.smaryun.com:6163/igs/rest/mrms/tile/北京市Tile");
//根据index获取图层
var layer = viewer.scene.layers.getImageryLayer(index);
//根据序号删除图层,并销毁内存
viewer.scene.layers.removeLayerByID(layerIndex , true);
添加 M3D 数据
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
url |
String | Resource | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
options |
Object |
|
Returns:
返回图层序号
Example:
var url = 'http://localhost:8086/M3D/1.0/school_all/school_all.mcj';
var options = {
autoReset: true,
duration: 2
loaded: function (layer) {
console.log(layer);
}
};
var layerIndex = viewer.scene.layers.appendM3DLayer(url, options);
添加场景图层
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
url |
String | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
options |
Object |
针对不同的图层,有不同的传入参数options。具体可参考MapGISLabelLayer MapGISM3DSet MapGISTerrainProvider 等
|
Examples:
viewer.scene.layers.appendSceneLayer('http://192.168.90.102:6163/igs/rest/g3d/1218示例', {
autoReset:false,
synchronous:true,
layers: 'show:0',
loaded:callBackfunction
});
viewer.scene.layers.appendSceneLayer('http://192.168.90.102:6163/igs/rest/g3d/1218示例', {
autoReset:false,
synchronous:true,
layers: 'hide:0',
getDocLayerIndexes: function (indexes) { console.log(indexes); }
});
// 单值专题图
var uniqueRenderer = {
// 字段名
"field": "OID",
// 专题图类型
"type": "unique-value",
// 专题图参数
"uniqueValueInfos": [
{
// 单值
"value": 1,
// 符号样式
"symbol": {
// 符号类型
"type": "mesh-3d",
// 可添加的符号图层,暂时仅支持fill类型
"symbolLayers": [
{
// 符号图层类型
"type": "fill",
// 材质信息
"material": {
// 颜色参数
"color": {
"red": 0,
"green": 0,
"blue": 1,
"alpha": 0.5
}
}
}
]
}
}
]
}
// 添加场景图层
viewer.scene.layers.appendSceneLayer('服务基地址', {
// 设置专题图参数
renderer: uniqueRenderer
});
// 分段专题图
renderer_range = {
//专题图字段
field: '体积',
//专题图类型
type: 'class-breaks',
//专题图参数
classBreakInfos: [
{
// 最大分段值
maxValue: 0.5,
// 最小分段值
minValue: 0.1,
// 符号样式
symbol: {
// 符号类型
type: 'mesh-3d',
// 可添加的符号图层,暂时仅支持fill类型
symbolLayers: [
{
// 符号图层类型
type: 'fill',
// 材质信息
material: {
// 颜色参数
color: new Cesium.Color(1.0, 0.0, 1.0, 0.7)
}
}
]
}
},
{
// 最大分段值
maxValue: 1.0,
// 最小分段值
minValue: 0.5,
// 符号样式
symbol: {
// 符号类型
type: 'mesh-3d',
// 可添加的符号图层,暂时仅支持fill类型
symbolLayers: [
{
// 符号图层类型
type: 'fill',
// 材质信息
material: {
// 颜色参数
color: new Cesium.Color(0.0, 1.0, 0.0, 0.7)
}
}
]
}
}
]
};
// 添加场景图层
viewer.scene.layers.appendSceneLayer('服务基地址', {
// 设置专题图参数
renderer: uniqueRenderer
});
// 根据M3DSet的id设置专题图
var renderer = [
{
// 根据M3DSet的id指定要生效的专题图
layerId: 'M3DSet的id,即IGS提供的layerIndex参数',
// 专题图参数
renderer: {}
}
]
// 添加场景图层
viewer.scene.layers.appendSceneLayer('服务基地址', {
// 设置专题图参数
renderer: renderer
});
appendTerrainLayer(url, optionsParam) → MapGISTerrainProvider|TerrainProvider
添加地形图层(内部)
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
url |
String | 服务地址 | ||||||||||||
optionsParam |
Object |
可选参数
|
Returns:
terrainLayer 返回图层对象
加载MapGIS矢量地图文档
Name | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
url |
String | 发布的文档地址,或Igs图层服务地址,对应的layers参数不同,使用Igs图层服务地址通过gdbp仅能加载二维矢量图层,eg:二维地图文档地址:http://[host]:[port]/igs/rest/mrfs/docs/{docName},三维地图文档地址:http://[host]:[port]/igs/rest/g3d/{docName},Igs图层服务地址:http://[host]:[port]/igs/rest/mrfs/layer | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
options |
Object |
其他附加属性包含以下属性的对象
|
Example:
var options1 = {
autoReset: false,
tileFeaturesCount: 400,
filter: {
where: 'OBJECTID>500'
},
style: {
type: 'building',
styleOptions: {
heightField: 'HEIGHT',
heightRatio: 10,
color: Cesium.Color.WHITE,
outline: true
}
}
}
//多图层style设置,多图层filter同理
var options2 = {
style: [
{
type: 'line',
styleOptions: {
color: Cesium.Color.WHITE,
width: 1.0
}
},
//空对象,即使用默认样式
{},
{
type: 'line',
styleOptions: {
color: Cesium.Color.RED,
width: 1.0
}
}
]
}
//地图文档加载示例
var layerIndexs;
url = 'http://localhost:6163/igs/rest/mrms/docs/二维矢量';
options = {
layers: 'layers=show:0,1'
getDocLayerIndexes: function (indexs) {
console.log(indexs);
layerIndexs = indexs;
},
}
viewer.scene.layers.appendVectorLayer(url, options);
//gdbp地址加载示例
url_gdbp = 'http://localhost:6163/igs/rest/mrfs/layer';
option_gdbp={
layers:'gdbp1,gdbp2,gdbp3'
getDocLayerIndexes: function (indexs) {
console.log(indexs);
layerIndexs = indexs;
},
}
viewer.scene.layers.appendVectorLayer(url_gdbp, option_gdbp);
//移除
for(var i = 0; i < layerIndexs; i++){
viewer.scene.layers.removeVectorLayerByID(layerIndexs[i]);
}
getAllCesium3DTilesetLayers() → Array.<Cesium3DTileset>
获取全部 Cesium3DTileset 图层对象
Returns:
返回所有的M3D图层对象
getAllImageryLayers() → Array.<ImageryLayer>
获取全部影像图层
Returns:
获取全部影像图层
getAllM3DLayers() → Array.<MapGISM3DSet>
获取全部 M3D 图层对象
Returns:
返回所有的M3D图层对象
getAllSceneLayers() → Array.<SceneLayer>
获取全部 SceneLayer 图层
Returns:
获取全部 SceneLayer 图层
getCesium3DTilesetLayer(layerIndex) → Cesium3DTileset
根据图层索引号,获取 Cesium3DTileset 图层对象
Name | Type | Description |
---|---|---|
layerIndex |
Number |
Returns:
返回 Cesium3DTileset 图层对象
Example:
var layer = viewer.scene.layers.getCesium3DTilesetLayer(layerIndex);
getFeatureLayer(layerIndex) → MapGISFeatureLayer
根据图层索引号,获取矢量图层对象
Name | Type | Description |
---|---|---|
layerIndex |
Number |
Returns:
featureLayer 返回矢量图层对象
Example:
var layer = viewer.scene.layers.getFeatureLayer(layerIndex);
getGeojsonLayer(layerIndex) → MapGISGeojsonLayer
根据图层索引号,获取geojson图层对象
Name | Type | Description |
---|---|---|
layerIndex |
Number |
Returns:
geojsonLayer 返回geojson图层对象
Example:
var layer = viewer.scene.layers.getGeojsonLayer(layerIndex);
getGraphicsLayer(layerIndex) → GraphicsLayer
根据图层索引号,获取 标绘图层对象
Name | Type | Description |
---|---|---|
layerIndex |
Number | 图层序号 |
Returns:
graphicsLayer返回标绘图层对象
getImageryLayer(layerIndex) → ImageryLayer
根据图层索引号,获取影像图层对象
Name | Type | Description |
---|---|---|
layerIndex |
Number |
Returns:
ImageryLayer 返回影像图层对象
Example:
var layer = viewer.scene.layers.getImageryLayer(layerIndex);
getLayer(index) → MapGISM3DSet|SceneLayer|Cesium3DTileset|ImageryLayer|TerrainProvider|MapGISVectorLayer
按照图层索引号获取图层对象
Name | Type | Description |
---|---|---|
index |
Number | 图层索引号 |
Returns:
返回图层对象
getM3DLayer(layerIndex) → MapGISM3DSet
根据图层索引号,获取 M3D 图层对象
Name | Type | Description |
---|---|---|
layerIndex |
Number |
Returns:
m3dLayer 返回 M3D 图层对象
Example:
var layer = viewer.scene.layers.getM3DLayer(layerIndex);
getSceneLayer(layerIndex) → SceneLayer
按索引号获取 SceneLayer 图层
Name | Type | Description |
---|---|---|
layerIndex |
Number | 图层索引号 |
Returns:
返回 SceneLayer 图层
getTerrainLayer(layerIndex) → TerrainProvider
根据图层索引号,获取 地形图层对象
Name | Type | Description |
---|---|---|
layerIndex |
Number | 图层序号 |
Returns:
terrainLayer返回地形对象
getVectorLayer(layerIndex) → MapGISVectorLayer
根据图层索引号,获取矢量图层对象
Name | Type | Description |
---|---|---|
layerIndex |
Number |
Returns:
vectorLayer 返回矢量图层对象
Example:
var layer = viewer.scene.layers.getVectorLayer(layerIndex);
删除全部 Cesium3DTileset 图层
Name | Type | Default | Description |
---|---|---|---|
destroy |
Boolean |
true
|
optional 销毁内存 |
Example:
viewer.scene.removeAllCesium3DTilesetLayers(true);
移除所有featureLayer矢量图层
Name | Type | Description |
---|---|---|
destroy |
Boolean | 是否销毁内存 |
移除所有geojson图层
Name | Type | Description |
---|---|---|
destroy |
Boolean | 是否销毁内存 |
移除所有标绘图层
移除所有影像图层
Name | Type | Description |
---|---|---|
destroy |
Boolean | 是否销毁内存 |
移除所有图层
Name | Type | Default | Description |
---|---|---|---|
destroy |
Boolean |
true
|
optional 是否销毁内存 |
删除全部 M3D 图层
Name | Type | Default | Description |
---|---|---|---|
destroy |
Boolean |
true
|
optional 销毁内存 |
Example:
viewer.scene.removeAllM3DLayers(true);
移除全部 SceneLayer 图层
Name | Type | Description |
---|---|---|
destroy |
Boolean | 是否清理内存 |
移除所有地形图层
移除所有矢量图层
Name | Type | Description |
---|---|---|
destroy |
Boolean | 是否销毁内存 |
按照图层号移除 Cesium3DTileset 图层
Name | Type | Default | Description |
---|---|---|---|
layerIndex |
Number | ||
destroy |
Boolean |
true
|
optional 销毁内存 |
Example:
viewer.scene.layers.removeCesium3DTilesetLayerByID(layerIndex, true);
移除featureLayer矢量图层
Name | Type | Description |
---|---|---|
layerIndex |
Number | 图层序号 |
destroy |
Boolean | 是否销毁内存 |
移除geojson图层
Name | Type | Description |
---|---|---|
layerIndex |
Number | 图层序号 |
destroy |
Boolean | 是否销毁内存 |
移除标绘图层
Name | Type | Description |
---|---|---|
layerIndex |
Number | 图层序号 |
移除影像图层
Name | Type | Description |
---|---|---|
layerIndex |
Number | 图层序号 |
destroy |
Boolean | 是否销毁内存 |
按图层索引号删除图层
Name | Type | Default | Description |
---|---|---|---|
index |
Number | 图层索引 | |
destroy |
Boolean |
true
|
optional 是否销毁内存 |
按照图层号移除图层
Name | Type | Default | Description |
---|---|---|---|
layerIndex |
Number | ||
destroy |
Boolean |
true
|
optional 销毁内存 |
Example:
viewer.scene.layers.removeM3DLayerByID(layerIndex, true);
按索引号移除 SceneLayer 图层
Name | Type | Description |
---|---|---|
layerIndex |
Number | 图层序号 |
destroy |
Boolean | 是否销毁内存 |
移除地形图层
Name | Type | Description |
---|---|---|
layerIndex |
Number | 图层序号 |
移除矢量图层
Name | Type | Description |
---|---|---|
layerIndex |
Number | 图层序号 |
destroy |
Boolean | 是否销毁内存 |
图层跳转
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
layer |
ImageryLayer | 影像图层对象 | ||||||||||||
options |
Object |
|
图层跳转
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
layer |
MapGISM3DSet | M3D 图层对象 | ||||||||||||
options |
Object |
|
图层跳转
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
layer |
SceneLayer | G3D 图层对象 | ||||||||||||
options |
Object |
|
图层跳转,地形
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
layer |
TerrainProvider | 地形 图层对象 | ||||||||||||
options |
Object |
|