From a7d4889d3deed77d38a4415a4906d653699f6a3c Mon Sep 17 00:00:00 2001 From: ethan Date: Wed, 6 Mar 2024 17:51:03 +0800 Subject: [PATCH] add npm and cdn --- README.md | 51 +++++++++++++++++++++++++++++++++++++++++---------- package.json | 7 ++++++- 2 files changed, 47 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index c9151d4..3ae8b52 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,46 @@ # cesium-plot-js - cesium 标绘插件 -![image](https://ethan-zf.github.io/CesiumPlot/examples/plot.png) +![image](https://ethan-zf.github.io/cesium-plot-js/examples/plot.png) -[在线示例:demo](https://ethan-zf.github.io/CesiumPlot/examples/index.html) +[在线示例:demo](https://ethan-zf.github.io/cesium-plot-js/examples/index.html) -### 类 + +### CDN + +1. 引入文件 + +``` + +``` +2. 调用绘制api + +``` + new CesiumPlot.FineArrow(Cesium, viewer); +``` + +### NPM + +1. install + +``` +npm i cesium-plot-js +``` + +2. import + +``` +import CesiumPlot from 'cesium-plot-js'; +``` + +3. 调用绘制api + +``` + new CesiumPlot.FineArrow(Cesium, viewer); +``` + +### Class 每个图形为独立的类,绑定事件或其他操作通过类的实例来实现 @@ -36,9 +69,9 @@ cesium 标绘插件 所有图形的构造函数: -类名(cesium: Cesium, viewer: Cesium.Viewer, style:[PolygonStyle](#PolygonStyle) | [LineStyle](#LineStyle)) +<类名>(cesium: Cesium, viewer: Cesium.Viewer, style?: [PolygonStyle](#PolygonStyle) | [LineStyle](#LineStyle)) -

PolygonStyle

+

PolygonStyle类型

``` { @@ -48,7 +81,7 @@ cesium 标绘插件 }; ``` -

LineStyle

+

LineStyle类型

``` { @@ -64,8 +97,6 @@ cesium 标绘插件 const viewer = new Cesium.Viewer('cesiumContainer'); // 抗锯齿 viewer.scene.postProcessStages.fxaa.enabled = true; -// 创建图形实例,使用默认样式 -new CesiumPlot.Reactangle(Cesium, viewer); // 设置自定义样式 const geometry = new CesiumPlot.FineArrow(Cesium, viewer, { material: Cesium.Color.fromCssColorString('rgba(59, 178, 208, 0.5)'), @@ -98,7 +129,7 @@ geometry.on('drawEnd', (data)=>{ }); ``` -### 事件 +### Events - 'drawStart' diff --git a/package.json b/package.json index c1e71ed..0c5257c 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,17 @@ { "name": "cesium-plot-js", - "version": "0.0.2", + "version": "0.0.3", "main": "dist/CesiumPlot.umd.js", "homepage": "https://github.com/ethan-zf/CesiumPlot", "repository": { "type": "git", "url": "git@github.com:ethan-zf/CesiumPlot.git" }, + "files": [ + "dist/", + "README.md", + "package.json" + ], "keywords": [ "cesium", "draw",