xingjiangyuan
v5.0.2
Published
The SDK is based on Cesium for secondary development of 2, 3D all-in-one WebGis application framework, the framework optimizes the use of Cesium and add some additional features, designed for developers to quickly build WebGis applications.
Downloads
15
Maintainers
Readme
xingjiangyuan-SDK
Installation
npm install xingjiangyuan
import DC from 'xingjiangyuan/dist/dc.base.min'
import DcCore from 'xingjiangyuan/dist/dc.core.min'
import 'xingjiangyuan/dist/dc.core.min.css'
配置
vue中
vue.confing.js中配置文件
const CopyPlugin = require('copy-webpack-plugin');
const dvgisDist = './node_modules/xingjiangyuan/dist'
configureWebpack: {
plugins: [
new CopyPlugin({
patterns: [
// 指定要复制的文件或文件夹
{ from: path.join(dvgisDist, 'resources'), to: 'libs/dc-sdk/resources' },
],
options: {
// 可选的配置选项
},
}),
],
},
react中
在public文件夹下创建libs/dc-sdk/resources文件目录
把./node_modules/xingjiangyuan/dist/resources下的文件放进去
一定要放进去否则无法使用
使用
DC.use(DcCore)
DC.ready(() => {
window.DC = DC
// 创建地球并添加模型和点位
let viewer = new DC.Viewer('app',tilearr,HUmodel) //tilearr是Cesium3DTileset模型,HUmodel户模型
// 点击事件
viewer._eventclick((res) => {
// res点击后拾取的模型
// 如果res是户模型,可以通过下面的方法获取户ID
id= res.getProperty("uniqueID")
})
//跳转到指定的户模型,第一个参数是户id,第二个参数是户模型的笛卡尔坐标(Cartesian3)
viewer._fltToThisResult('1458961',Cartesian3)
//初始化位置
viewer._Initialposition()
//清除线面
viewer._dataSourcesRemoveAll()
//删除点位
viewer._dataSourcesRemoveAllpoint()
//添加点位
viewer._geojsonpoint(json.data)
//添加面
viewer._geojsonpolygon(json.data)
// 添加线
viewer._geojsonpolyline(json.data)
})