首先得在Supermap 的iserver(我是本地的服务器--由一个软件iserver)服务器,把制作好的工作空间发布到这个上面
然后再通过supermap对应的Js库 下载下来到自己本地的项目里 引入 以及使用对应的接口函数即可(当然使用时候有对应的关键字和路径)
大体思路是这样 具体我把我的样例 上代码 下载链接https://download.csdn.net/download/work_fly/10805277
几个关键点
加载这几个js
然后写加载三维场景的js文件
<script type="text/javascript">
function onload(Cesium) {
var infoboxContainer = document.getElementById("bubble");
//初始化viewer部件
var viewer = new Cesium.Viewer('cesiumContainer');
viewer.customInfobox = infoboxContainer;
var scene = viewer.scene;
var canvas = scene.canvas;
var widget = viewer.cesiumWidget;
$('#loadingbar').remove();
try {
//添加S3M图层服务
var promise_wushui = scene.addS3MTilesLayerByScp('http://localhost:8090/iserver/services/3D-MaSai/rest/realspace/datas/compressed/config',
{
name: 'Config_wushui'
});
Cesium.when(promise_wushui , function (layer) {
if(!scene.pickPositionSupported){
alert('不支持深度拾取,属性查询功能无法使用!');
}
//设置属性查询参数
layer.setQueryParameter({
url: 'http://localhost:8090/iserver/services/data-New/rest/data',
dataSourceName: 'vector',
dataSetName: 'vectorR',
keyWord: 'MS'
});
//设置相机视角
scene.camera.setView({
//将经度、纬度、高度的坐标转换为笛卡尔坐标
//118.55916,24.80964
destination : Cesium.Cartesian3.fromDegrees(43.29362603280226, 5.356796308442276 ,105.40531821331771),
orientation : {
heading : 5.154573786584606,
pitch : -0.14229615865957967,
roll :3.2294167340296553e-12
}
});
}, function (e) {
if (widget._showRenderLoopErrors) {
var title = '渲染时发生错误,已停止渲染。';
widget.showErrorPanel(title, undefined, e);
}
});
}
catch (e) {
if (widget._showRenderLoopErrors) {
var title = '渲染时发生错误,已停止渲染 。';
widget.showErrorPanel(title, undefined, e);
}
}
//添加自定义infobox
var title1 = document.getElementById("title");
var des = document.getElementById("des");
var myimg = document.getElementById("myimg");
//注册鼠标点击事件
viewer.pickEvent.addEventListener(function(feature){
var title = Cesium.defaultValue(feature.DATA,'');
//var description = Cesium.defaultValue(feature.DES,'');
title1.innerText = title;
myimg.src = "images/" + "134" + ".jpg";
});
//
}
function myFunction() {
//var a =new Supermap.lonLat(0,0);
//var b =new Supermap.lonLat(103,33);
//var e = SuperMap.util.distVincenty(a,b);
x = document.getElementById("claa");
x.innerHTML = "1234165";
}