npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cesium-draw-hnx

v1.1.5

Published

解决2D.3D模式切换情况下,2D模式下编辑拖动与地图拖动冲突问题

Downloads

20

Readme

Cesium-Draw-hnx

基于Vue开发的Cesium基础标绘插件,支持交互式添加BillBoard、Polyline、Polygon、Label和Model

核心功能:

  • 鼠标交互绘图
  • 对于Billboard、Label、Model支持图标,名称的编辑,图标可以任意扩展.
  • 对于Polyline和Polygon支持顶点、颜色等常见图形属性的编辑.
  • 支持导入、导出功能
  • 可以通过图层管理器管理通过该插件添加的所有图形.

安装

npm i cesium-draw-hnx

自定义新改动的地方

 增加了加点图标(1-10,还有默认图标)
 增加了折线或者多边形的的 绘制点个数限制
 增加了编辑删除逻辑优化
 移除了del删除的逻辑,删除不能重启绘制的状态,把删除的逻辑交给整体的删除

使用

<template>
    <div>
     <div id='map'></div>
     <cesium-draw ref='drwaManager' :drawOptions="drawOptions"></cesium-draw>
    </div>
</template>
<script>
import cesiumDraw from 'cesium-draw-hnx'
import 'cesium-draw-hnx/dist/theme/default.css'
//import 'cesium-draw/dist/theme/dark.css'
export default{
    name:'your-component',
    data(){
        return {
            viewer:null,
            drawOptions: {
                //折线最多点个数 0代表不限制
                polylineMaxPointNum: 0,
                //多边形最多点的个数 0代表不限制
                polygonMaxPointNum: 0,
            },
        }
    }
    components:{cesiumDraw},
    mounted(){
        this.viewer=new Cesium.Viewer('map')
    }
}
</script>

如果你没有将Cesium Viewer对象保存到Vue data中,你必须显式调用init函数初始化组件。

const viewer=new Cesium.Viewer('map')
this.$refs.drawManager.init(viewer)

怎么扩展标记图标

<cesium-draw ref='drwaManager' :extendMarkerImage="images"></cesium-draw>
data(){
    return{
        images:["./static/images/markers/1.png",
                "./static/images/markers/2.png",
                "./static/images/markers/3.png",
                "./static/images/markers/4.png",
                "./static/images/markers/5.png"
      ]
    }
}

Methods

  • getById(mid) 根据id返回图形要素

Events

事件|说明|回调 ---|---|--- deleteEvent|要素删除事件|参数为删除要素的id locateEvent|要素定位事件|定位要素的id editEvent|要素编辑事件|要素的id renameEvent|要素重命名事件|两个参数,依次为要素id,要素更新前的名称 selectEvent|checkbox点击事件|两个参数,依次为要素id,checkbox状态 closeEvent|标绘面板关闭事件|无

开发&打包

npm install
npm run build

打包成组件

npm run lib

效果

avatar avatar