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

ux-cesium

v0.0.3

Published

<!-- * @Descripttion: * @version: * @Author: houqiangxie * @Date: 2022-11-24 17:13:54 * @LastEditors: houqiangxie * @LastEditTime: 2023-12-05 10:23:23 --> # cesium promitive加载点位,动态追踪label,点位弹窗(支持传入标签,component),标会plot

Downloads

2

Readme

cesium promitive加载点位,动态追踪label,点位弹窗(支持传入标签,component),标会plot

##点位操作

import { map, mapConfig, AddMarker,DragPoint }  from 'ux-cesium'

AddMarker.add 添加, params: ({ list = [], type = 'billbord', name = 'default', icon = '', config = {}, nodetail = false })  type:billboard,label,text,polygon,polyline,clusterPoint,modal
AddMarker.selected 当前选中, params: (data = {}, config = {})
AddMarker.get 获取, params: (names = '', isData = false)
AddMarker.del 删除, params: (names = '')
AddMarker.show 显隐, params: (names = '', isShow)
AddMarker.textFn({list:[],html:'html字符串或者render函数',config,name})  自定义追踪label 或者AddMarker.add type:text
AddMarker.modalFn({item:{},html:'html字符串或者render函数',config,name}) 点位弹窗 或者AddMarker.add type:modal
AddMarker.clusterPointFn({list:[{ lng:114.1135659351782, lat:22.602362676248773}],name:'',config:{},nodetail:false,clusterIcon:'',icon:''}) primitive点位聚合 clusterIcon 聚合icon

增加拖动点位方法
new DragPoint({callback:(p)=>{
      console.log('p: ', p);
  
}})

PLOT标会使用方法

import {Plot, plotConfig , AddMarker } from 'ux-cesium'
const defaultConfig = {
  // 设置默认参数
  // imgUrl: '', // 图标
  pointSize: 1, //点位大小
  textColor: '#fff', //标注颜色
  textSize: 16, //标注大小
  style: 'solid', //样式
  color: '#BCA00D', //填充
  borderColor: 'red', //边框,线条颜色
  borderSize: 4, //粗细
  labelShow: true,
  styleImg: '0',
  alpha: 0.2,
};
const tabsActive = ref(0)
const curPlot = ref({}) // 当前标绘
const plotData = ref([]) // 标绘数据
function plotClick(item){
  curPlot.value = item;
  let newConfig = {
    type:item.type, // type (必传)
    customConfig:{ // 使用自定义配置参数如 (案例:billboard 属性)
      image:'/favicon.jpg',
      with:20,
      height:30,
      horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
      verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
      disableDepthTestDistance: Number.MAX_VALUE,
    }
  }
  let config = {...defaultConfig,...item} // 方式1:变量式新增
  // config = newConfig // 方式2:自定义属性新增
  const plot = new Plot(config,e=>{
    plotData.value.unshift(e.getData())
    // console.error("🚀 ~ file: index.vue:40 ~ plot ~ e:", JSON.stringify(plotData.value))
  })
}
// 删除标绘
function clear(id,i) {
  Plot.clear(id);
  plotData.value.splice(i,1)
}
// 默认载入数据
function showData() {
  // const parent =  window.viewer.entities.getOrCreateEntity('父实体-可有可无');
  plotData.value.forEach(async (item: any) => {
    const plot = await Plot.toData(item, null);
    const parent =  window.viewer.entities.getOrCreateEntity('父实体-可有可无');
    plot.addDraw.parent = parent;
  });
}
let handler = null
function init(){
  handler = new Cesium.ScreenSpaceEventHandler(window.viewer.scene.canvas);
  handler.setInputAction((evt) => {
    const pick = window.viewer.scene.pick(evt.position);
    if (pick?.id?.objId || pick?.id.startsWith("plot")) {
      const row = plotData.value.find(o=>o.config.objId == pick.id?.objId || pick.id == o.config.objId)
      if(!row) return;
      // Plot.edit({ curData:row , allData:plotData}) // 或
      Plot.edit({ curData:row, moveMultiple:true  },(callback)=>{ 
        //allData:用来处理删除当前实体;或传入 callback:删除实体后回调, moveMultiple: 启用整体移动; hide:不显示编辑
        plotData.value = plotData.value.filter(o=> o.config.objId != row.config.objId)
      })
    }else{
      Plot.edit({ hide:true}) // 隐藏编辑点位
    }
  }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
}
onMounted(() => {
  plotData.value =[{"positions":[{"x":-2389410.806483038,"y":5387079.825678937,"z":2431229.991352521}],"config":{"pointSize":0.5,"textColor":"#fff","textSize":16,"style":"solid","color":"#BCA00D","borderColor":"red","borderSize":4,"labelShow":true,"styleImg":"0","alpha":0.2,"label":"已灭火点","type":"drawPoint","imgUrl":"/images/plot/allPlots.png","isPrimitives":true,"imageSubRegion":[200,65,64,64],"showType":[3,4],"objId":"plot-1678895315394"}},{"positions":[{"x":-2370599.1889191885,"y":5397758.915520606,"z":2425989.03947019}],"config":{"pointSize":0.5,"textColor":"#fff","textSize":16,"style":"solid","color":"#BCA00D","borderColor":"red","borderSize":4,"labelShow":true,"styleImg":"0","alpha":0.2,"label":"烟点","type":"drawPoint","imgUrl":"/images/plot/allPlots.png","imageSubRegion":[68,65,64,64],"showType":[3,4],"objId":"plot-1678895313072"}}]
  nextTick(()=>{
      showData()
      init()
  })
});