Skip to content

Commit 94e6de4

Browse files
committed
feat: 🔨 add API documentation 🚧
1 parent 958620f commit 94e6de4

30 files changed

+7781
-6521
lines changed

README.md

Lines changed: 19 additions & 202 deletions
Original file line numberDiff line numberDiff line change
@@ -39,188 +39,33 @@ Additionally it supports Post effects, visibility analysis tools for perspective
3939
npm install cesium_dev_kit
4040
```
4141

42-
## Import
43-
44-
```
45-
import { initCesium } from 'cesium_dev_kit'
46-
```
47-
4842
## Use
4943

5044
### 1、Import all
5145

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

54-
### 1.1 The initCesium method configuration parameter list
55-
56-
| Property | Type | Description | Default |
57-
| ---------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- |
58-
| cesiumGlobal | Object | Cesium Object | undefined |
59-
| threeGlobal | Object | THREE Object | undefined |
60-
| containerId | String | Cesium mounts dom container id | undefined |
61-
| threeContainerId | String | Three mounts dom container id | undefined |
62-
| viewerConfig | Object | viewer base configuration (same as official website) | {} |
63-
| extreaConfig | Object | Configure additional parameters, such as {logo: true, // Whether to display logo depthTest: true, // Enable depth detection AccessToken:'', // configure access_token } | {} |
64-
| MapImageryList | Array | To configure the base image, see ImageryProvider | [] |
65-
| defaultStatic | Array | Static resource configurations used by shaders (such as image urls) | undefined |
66-
67-
### 1.2 The initCesium method returns the result
68-
69-
| name | Type | Description |
70-
| ------------------ | ------ | ------------------------------------------------------------------------------ |
71-
| viewer | Object | Cesium instance object |
72-
| material | Object | Material module (Modify physical material) |
73-
| graphics | Object | Graphics modules (e.g. creating PolygonGraphics objects, etc.) |
74-
| math3d | Object | Three-dimensional mathematical tool |
75-
| primitive | Object | Primitives manipulate objects (such as creating polygon using primivite, etc.) |
76-
| draw | Object | Drawing modules (e.g. polygons, rectangles) |
77-
| passEffect | Object | Post-processing module |
78-
| customCesiumPlugin | Object | Custom sensor extensions |
79-
| control | Object | Control modules (such as model positioning, dragging, etc.) |
80-
| plugin | Object | Additional plugins (such as expanding css3 animation, terrain cropping) |
81-
| base | Object | Basic modules (e.g. coordinate conversion, layer initialization, etc.) |
82-
| analysis | Object | Analysis modules (e.g., slope, direction, visibility, visibility analysis) |
83-
| attackArrowObj | Object | Plotting (attack) |
84-
| straightArrowObj | Object | Plotting (straight hit) |
85-
| pincerArrowObj | Object | Plotting(Pincer attack) |
86-
| ThreeJs | Object | Integrate ThreeJS extension objects |
87-
88-
### 1.3 Use case
89-
9048
```javaScript
91-
// test.vue
92-
<template>
93-
<div id="cesiumContainer" class="map3d-contaner"></div>
94-
</template>
95-
<script>
96-
import { initCesium } from 'cesium_dev_kit'
97-
import { defaultStatic } from '../defaultStaticConf'
98-
export default {
99-
mounted() {
100-
this.initMap()
101-
},
102-
methods: {
103-
initMap() {
104-
const tempData = [
105-
{
106-
id: 3,
107-
name: 'gaodeMap02',
108-
type: 'UrlTemplateImageryProvider',
109-
classConfig: {
110-
url: 'https://webst02.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}',
111-
},
112-
interfaceConfig: {},
113-
offset: '0,0',
114-
invertswitch: 0,
115-
filterRGB: '#ffffff',
116-
showswitch: 1,
117-
weigh: 13,
118-
createtime: 1624346908,
119-
updatetime: 1647395260,
120-
}
121-
]
122-
const { viewer,material,graphics} =
123-
new initCesium({
124-
cesiumGlobal: Cesium,
125-
containerId: 'cesiumContainer',
126-
viewerConfig: {
127-
infoBox: false,
128-
shouldAnimate: true,
129-
},
130-
extraConfig: {
131-
depthTest: true
132-
},
133-
MapImageryList: tempData,
134-
defaultStatic
135-
})
136-
}
137-
}
138-
}
139-
</script>
140-
49+
import { initCesium } from 'cesium_dev_kit'
50+
const { viewer, material, ... } = new initCesium({ cesiumGlobal: Cesium,containerId: 'cesiumContainer',...})
14151
```
14252

14353
### 2、Import on demand
14454

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

14757
```javaScript
148-
import {Graphics, Material,Primitive,Draw,Analysis,CustomCesiumPlugin,PassEffect,Plugin,ThreeJs} from 'cesium_dev_kit'
149-
```
150-
151-
### 2.1 Extension class:
152-
153-
- Graphics:Various graphic operations
154-
- Material: Material manipulation
155-
- Primitive: Cooperate with various primitive operations of shader
156-
- Draw: Various drawing objects
157-
- Analysis: Various analysis objects
158-
- CustomCesiumPlugin: Custom sensor expansion
159-
- PassEffect: Post effect object
160-
- Plugin: Various extension functions
161-
- ThreeJs: Integrate ThreeJS extension objects
162-
163-
### 2.2 Draw Use case:
164-
165-
```javaScript
166-
// test.vue
167-
<template>
168-
<div id="cesiumContainer" class="map3d-contaner"></div>
169-
</template>
170-
<script>
171-
import { Draw } from 'cesium_dev_kit'
172-
export default {
173-
mounted() {
174-
this.initMap()
175-
},
176-
methods: {
177-
initMap() {
178-
const tempData = [
179-
{
180-
id: 3,
181-
name: 'gaodeMap02',
182-
type: 'UrlTemplateImageryProvider',
183-
classConfig: {
184-
url: 'https://webst02.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}',
185-
},
186-
interfaceConfig: {},
187-
offset: '0,0',
188-
invertswitch: 0,
189-
filterRGB: '#ffffff',
190-
showswitch: 1,
191-
weigh: 13,
192-
createtime: 1624346908,
193-
updatetime: 1647395260,
194-
}]
195-
196-
const drawObj = new Draw({
197-
cesiumGlobal: Cesium, //Global Cesium object
198-
containerId: 'cesiumContainer', // Container id
199-
viewerConfig: { // Same as the official viewer configuration
200-
infoBox: false,
201-
shouldAnimate: true,
202-
},
203-
extraConfig: {// Other configuration
204-
logo:true, // Whether to display logo
205-
depthTest:true // Whether to enable the depth test
206-
},
207-
MapImageryList: tempData // Base map configuration
208-
defaultStatic // default server address and material and other basic information configuration, please refer to src\views\example\defaultStaticConf\index.js
209-
})
210-
211-
this.c_viewer = drawObj.viewer
212-
this.draw = drawObj.draw
213-
this.draw.setDefSceneConfig()
214-
this.draw.setBloomLightScene()
215-
this.load3dTiles(drawObj.viewer)
216-
217-
this.StraightArrowObj = drawObj.straightArrowObj
218-
this.AttackArrowObj = drawObj.attackArrowObj
219-
this.PincerArrowObj = drawObj.pincerArrowObj
220-
}
221-
}
222-
}
223-
</script>
58+
import {Graphics} from 'cesium_dev_kit'
59+
const {viewer,graphics} = new Graphics({
60+
cesiumGlobal: Cesium,
61+
containerId: 'cesiumContainer'
62+
})
63+
graphics.getPointGraphics({
64+
color:Cesium.Color.GREEN,
65+
pixelSize:5,
66+
outlineColor:Cesium.Color.WHITE,
67+
outlineWidth:1
68+
})
22469
```
22570

22671
### Used in h5
@@ -237,6 +82,10 @@ export default {
23782
new cesium_dev_kit.initCesium({...})
23883
```
23984

85+
See [API documentation](https://benpaodehenji.com/cesiumDevKitDoc) for more details...
86+
87+
---
88+
24089
## Use example
24190

24291
- Vue Use case
@@ -266,8 +115,7 @@ This project includes but is not limited to the reference and reference of the a
266115
## Project deficiency and optimization
267116

268117
- 1、Extended classes not using type detection (TS)
269-
- 2、No usage documentation (please refer to the case)
270-
- 3、No exception catching and handling
118+
- 2、No exception catching and handling
271119

272120
## How to contribute
273121

@@ -279,41 +127,10 @@ This project exists thanks to all the people who contribute.<br/>
279127

280128
- If you want to contribute, you can [Raise an issue](https://github.com/dengxiaoning/cesium_dev_kit/issues/new) Or submit a Pull Request.
281129

282-
**Pull Request:**
283-
284-
- The procedure for submitting a `pull request` is as follows
285-
286-
1. Fork [cesium_dev_kit](https://github.com/dengxiaoning/cesium_dev_kit)
287-
2. Clone a new repository made with forking.
288-
3. Create your own branch: `git checkout -b feat/xxxx`
289-
4. Install modules with npm or yarn command.
290-
5. Let's develop!
291-
6. Submit your changes: `git commit -am 'feat(function): add xxxxx'`
292-
7. Push your branch: `git push origin feat/xxxx`
293-
8. Make a new `pull request` in [cesium_dev_kit](https://github.com/dengxiaoning/cesium_dev_kit) repository.
294-
295-
## Git Contribution submission specification
296-
297-
- `feat` New features
298-
- `fix` Fix bugs
299-
- `docs` document
300-
- `style` Format and style (changes that do not affect code operation)
301-
- `refactor` Refactor
302-
- `perf` Optimize related, such as improving performance and experience
303-
- `test` Add test
304-
- `build` Compilation related modifications, changes to project construction or dependencies
305-
- `ci` Continuous integration modification
306-
- `chore` Changes in the construction process or auxiliary tools
307-
- `revert` Rollback to previous version
308-
- `workflow` Workflow improvement
309-
- `mod` Uncertain modification classification
310-
- `wip` Under development
311-
- `types` type
130+
See [CONTRIBUTING](./CONTRIBUTING.md) for more details on donations...
312131

313132
---
314133

315-
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.
316-
317134
## `Star`
318135

319136
I am grateful to the generous individuals who awarded me these little stars, thank you for your support :heart:

0 commit comments

Comments
 (0)