1.0.75 • Published 6 days ago

cesium_dev_kit v1.0.75

Weekly downloads
-
License
MIT
Repository
github
Last release
6 days ago

cesium_dev_kit

Build Status NPM Package NPM DownloadsWeekly Build Size GitHub Repo stars license

English | 中文

Introduction

This is a Cesium development kit that includes functionalities such as layer loading, coordinate conversion, coordinate picking, camera control, measurement, plotting, model loading and manipulation (translation, rotation scaling), 3Dtiles view position adjustment, weather effects (rain, snow, fog), scene rendering with radar scan and information box display capabilities. It also provides features for flow line visualization, lighting effects including dynamic wall and other luminous materials rendering. Additionally it supports Post effects, visibility analysis tools for perspective analysis and slope analysis. Furthermore it offers Inundation analysis as well as volume analysis capabilities and terrain excavation functionality.

Features

  • materials material
  • analysis analysis
  • plotting plot
  • dragging drag
  • radar scan radar
  • First-person roaming roaming

Preview

https://benpaodehenji.com/cesiumDevKit

Install

npm install cesium_dev_kit

Import

import { initCesium } from 'cesium_dev_kit'

Use

1、Import all

The initialization of 'initCesium' allows for the acquisition of all extension modules.

1.1 The initCesium method configuration parameter list

PropertyTypeDescriptionDefault
cesiumGlobalObjectCesium Objectundefined
threeGlobalObjectTHREE Objectundefined
containerIdStringCesium mounts dom container idundefined
threeContainerIdStringThree mounts dom container idundefined
viewerConfigObjectviewer base configuration (same as official website){}
extreaConfigObjectConfigure additional parameters, such as {logo: true// Whether to display logo, depthTest: true// Enable depth detection}{}
MapImageryListArrayTo configure the base image, see ImageryProvider[]
defaultStaticArrayStatic resource configurations used by shaders (such as image urls)undefined

1.2 The initCesium method returns the result

nameTypeDescription
viewerObjectCesium instance object
materialObjectMaterial module (Modify physical material)
graphicsObjectGraphics modules (e.g. creating PolygonGraphics objects, etc.)
math3dObjectThree-dimensional mathematical tool
primitiveObjectPrimitives manipulate objects (such as creating polygon using primivite, etc.)
drawObjectDrawing modules (e.g. polygons, rectangles)
passEffectObjectPost-processing module
customCesiumPluginObjectCustom sensor extensions
controlObjectControl modules (such as model positioning, dragging, etc.)
pluginObjectAdditional plugins (such as expanding css3 animation, terrain cropping)
baseObjectBasic modules (e.g. coordinate conversion, layer initialization, etc.)
analysisObjectAnalysis modules (e.g., slope, direction, visibility, visibility analysis)
attackArrowObjObjectPlotting (attack)
straightArrowObjObjectPlotting (straight hit)
pincerArrowObjObjectPlotting(Pincer attack)
ThreeJsObjectIntegrate ThreeJS extension objects

1.3 Use case

// test.vue
<template>
  <div id="cesiumContainer" class="map3d-contaner"></div>
</template>
<script>
import { initCesium } from 'cesium_dev_kit'
import { defaultStatic } from '../defaultStaticConf'
export default {
  mounted() {
    this.initMap()
  },
  methods: {
    initMap() {
      const tempData = [
        {
          id: 3,
          name: 'gaodeMap02',
          type: 'UrlTemplateImageryProvider',
          classConfig: {
            url: 'https://webst02.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}',
          },
          interfaceConfig: {},
          offset: '0,0',
          invertswitch: 0,
          filterRGB: '#ffffff',
          showswitch: 1,
          weigh: 13,
          createtime: 1624346908,
          updatetime: 1647395260,
        }
      ]
      const { viewer,material,graphics} =
          new initCesium({
            cesiumGlobal: Cesium,
            containerId: 'cesiumContainer',
            viewerConfig: {
              infoBox: false,
              shouldAnimate: true,
            },
            extraConfig: {
              depthTest: true
            },
            MapImageryList: tempData,
            defaultStatic
          })
    }
  }
}
</script>

2、Import on demand

The import of a single extension class can be tailored to meet specific functional requirements, thereby minimizing code redundancy.

import {Graphics, Material,Primitive,Draw,Analysis,CustomCesiumPlugin,PassEffect,Plugin,ThreeJs} from 'cesium_dev_kit'

2.1 Extension class:

  • Graphics:Various graphic operations
  • Material: Material manipulation
  • Primitive: Cooperate with various primitive operations of shader
  • Draw: Various drawing objects
  • Analysis: Various analysis objects
  • CustomCesiumPlugin: Custom sensor expansion
  • PassEffect: Post effect object
  • Plugin: Various extension functions
  • ThreeJs: Integrate ThreeJS extension objects

2.2 Draw Use case:

// test.vue
<template>
  <div id="cesiumContainer" class="map3d-contaner"></div>
</template>
<script>
import { Draw } from 'cesium_dev_kit'
export default {
  mounted() {
    this.initMap()
  },
  methods: {
    initMap() {
        const tempData = [
        {
          id: 3,
          name: 'gaodeMap02',
          type: 'UrlTemplateImageryProvider',
          classConfig: {
            url: 'https://webst02.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}',
          },
          interfaceConfig: {},
          offset: '0,0',
          invertswitch: 0,
          filterRGB: '#ffffff',
          showswitch: 1,
          weigh: 13,
          createtime: 1624346908,
          updatetime: 1647395260,
        }]

      const drawObj = new Draw({
        cesiumGlobal: Cesium, //Global Cesium object
        containerId: 'cesiumContainer', // Container id
        viewerConfig: { // Same as the official viewer configuration
          infoBox: false,
          shouldAnimate: true,
        },
        extraConfig: {// Other configuration
          logo:true, // Whether to display logo
          depthTest:true // Whether to enable the depth test
        },
        MapImageryList: tempData // Base map configuration
        defaultStatic // default server address and material and other basic information configuration, please refer to src\views\example\defaultStaticConf\index.js
      })

      this.c_viewer = drawObj.viewer
      this.draw = drawObj.draw
      this.draw.setDefSceneConfig()
      this.draw.setBloomLightScene()
      this.load3dTiles(drawObj.viewer)

      this.StraightArrowObj = drawObj.straightArrowObj
      this.AttackArrowObj = drawObj.attackArrowObj
      this.PincerArrowObj = drawObj.pincerArrowObj
    }
  }
}
</script>

Used in h5

  • Import index.umd.js directly into html
<script type="text/javascript" src="index.umd.js"></script>
  • Initialize object
new cesium_dev_kit.initCesium({...})

Use example

Browser support

The 'Chrome 80+' browser is recommended for local development

Modern browsers (chrome, Firefox, Microsoft edge, etc.) are supported. Internet Explorer is not supported

Thanks

cesium-d3kit drawarrowforcesium vue3-ts-cesium-map-show

This project includes but is not limited to the reference and reference of the above materials, thank you very much for sharing

Project deficiency and optimization

  • 1、Extended classes not using type detection (TS)
  • 2、No usage documentation (please refer to the case)
  • 3、No exception catching and handling

How to contribute

You can Raise an issue Or submit a Pull Request.

Pull Request:

  1. Fork code
  2. Create your own branch: git checkout -b feat/xxxx
  3. Submit your changes: git commit -am 'feat(function): add xxxxx'
  4. Push your branch: git push origin feat/xxxx
  5. submit pull request

Git Contribution submission specification

  • feat New features
  • fix Fix bugs
  • docs document
  • style Format and style (changes that do not affect code operation)
  • refactor Refactor
  • perf Optimize related, such as improving performance and experience
  • test Add test
  • build Compilation related modifications, changes to project construction or dependencies
  • ci Continuous integration modification
  • chore Changes in the construction process or auxiliary tools
  • revert Rollback to previous version
  • workflow Workflow improvement
  • mod Uncertain modification classification
  • wip Under development
  • types type

Welcome interested friends to join together to improve the function, so that the work is more efficient, the development is simpler, and the life is more comfortable.

Star

I am grateful to the those good people who awarded me These stars, and I appreciate your ongoing support. :heart:

Stargazers repo roster for @dengxiaoning/cesium_dev_kit

Fork

@sincely、@ooil929、 @InPanda、 luyufanzhi、AllenChiangCN、Liquid-Zhangliquan Thank you for your attention. :heart:

Forkers repo roster for @dengxiaoning/cesium_dev_kit

1.0.75

6 days ago

1.0.74

8 days ago

1.0.73

11 days ago

1.0.72

15 days ago

1.0.71

20 days ago

1.0.70

22 days ago

1.0.69

3 months ago

1.0.2-webgl1.0

10 months ago

1.0.62

10 months ago

1.0.66

6 months ago

1.0.65

6 months ago

1.0.64

6 months ago

1.0.63

8 months ago

1.0.68

6 months ago

1.0.67

6 months ago

1.0.62-webgl2.0

10 months ago

1.0.61

10 months ago

1.0.60

12 months ago

1.0.59

12 months ago

1.0.58

12 months ago

1.0.57

12 months ago

1.0.56

12 months ago

1.0.55

12 months ago

1.0.54

1 year ago

1.0.53

1 year ago

1.0.52

1 year ago

1.0.51

1 year ago

1.0.50

1 year ago

1.0.49

1 year ago

1.0.48

1 year ago

1.0.47

1 year ago

1.0.46

1 year ago

1.0.45

1 year ago

1.0.44

1 year ago

1.0.43

1 year ago

1.0.42

1 year ago

1.0.41

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago