cesium.path
v0.0.8
Published
<!-- * @Author: MrRice * @Date: 2024-07-16 18:30:07 * @LastEditors: 米大饭 [email protected] * @LastEditTime: 2024-08-05 22:34:11 * @FilePath: /cesium-path/README.MD * @Description: * -----小舟从此逝,江海寄余生---- * Copyright (c) 2024 by 米大饭, All Rights Reser
Downloads
3
Readme
CesiumPath
一个Cesium创建路径的方法
拓展
基于DrawCommand创建了新的Primitive支持继承three的模块
来源:基于一个Three.Path库的简易傻瓜式移植。
安装
npm install
运行
npm run dev
如何使用
//引入模块
import { CesiumPathGeometry } from 'cesiumPath';
//点数据
let pathData = [
[121.34861148053537, 31.176501484821816, 40.561642015460457],
[121.44695953835536, 31.183106832223146, 41.534012018365177],
[121.47080127407735, 31.135714370305443, 53.297309271158188],
[121.42327439103151, 31.12370321270027, 50.84025524552838],
[121.4213359001137, 31.159925827084713, 47.609356226790908],
[121.36188159675834, 31.162128285124, 42.005962607369975],
[121.36298493172815, 31.11244465546675, 50.319108882265667],
[121.46179295810667, 31.102447810026, 42.467301960707738],
];
const cesiumGeo = new CesiumPathGeometry({
points: pathData,//顶点数据
width: 1000,//宽度
arrow:false,//末尾是否显示箭头
cornerRadius: 1000,//拐角半径
cornerSplit:100,//拐角细分
close: false,//是否闭合
side:'both',//挤出侧
})
const geometryInstance = new Cesium.GeometryInstance({
geometry: cesiumGeo,
});
const color = Cesium.Color.fromCssColorString("#00ff00");
const material = new Cesium.Material({
fabric: {
type: "Color",
uniforms: {
color: color,
},
},
});
const appearance = new Cesium.MaterialAppearance({
material: material,
});
const primitive = new Cesium.Primitive({
geometryInstances: [geometryInstance],
appearance: appearance,
asynchronous: false,
});
//其余用法请看examples目录下面的demo