Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:zouyaoji/vue-cesium into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
zouyaoji committed Apr 12, 2024
2 parents 82a1022 + 9d33ff8 commit 80ea788
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"@zouyaoji/heatmap.js": "^2.0.8",
"compare-versions": "^6.1.0",
"echarts": "^5.4.3",
"kdbush": "^3.0.0",
"kdbush": "^4.0.2",
"lodash": "^4.17.21",
"lodash-es": "^4.17.21",
"lodash-unified": "^1.0.3",
Expand Down
10 changes: 7 additions & 3 deletions packages/shared/src/PrimitiveCluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* @Date: 2023-05-26 13:30:22
* @Description: Do not edit
* @LastEditors: zouyaoji [email protected]
* @LastEditTime: 2023-07-28 14:58:36
* @FilePath: \vue-cesium@next\packages\shared\src\PrimitiveCluster.ts
* @LastEditTime: 2024-04-02 00:43:38
* @FilePath: \vue-cesium\packages\shared\src\PrimitiveCluster.ts
*/
import { defaultValue } from '@vue-cesium/utils/util'
import KDBush from 'kdbush'
Expand Down Expand Up @@ -633,7 +633,11 @@ function createDeclutterCallback(entityCluster) {
let collection
let collectionIndex

const index = new KDBush(points, getX, getY, 64, Int32Array)
const index = new KDBush(points.length, 64, Int32Array)
for (let i = 0; i < points.length; i++) {
index.add(points[i].coord.x, points[i].coord.y)
}
index.finish()

if (currentHeight < previousHeight) {
length = clusters.length
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-cesium/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"@zouyaoji/heatmap.js": "^2.0.8",
"compare-versions": "^6.1.0",
"echarts": "^5.4.3",
"kdbush": "^3.0.0",
"kdbush": "^4.0.2",
"lodash": "^4.17.21",
"lodash-es": "^4.17.21",
"lodash-unified": "^1.0.3",
Expand Down
9 changes: 7 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 20 additions & 2 deletions website/docs/zh-CN/primitives/vc-primitive-cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
:enabled="enabled"
v-if="billboards.length"
:billboards="billboards"
:labels="labels"
:minimum-cluster-size="minimumClusterSize"
@cluster-event="onClusterEvent"
@click="onClicked"
Expand All @@ -26,7 +27,7 @@
</vc-collection-primitive>

<vc-selection-indicator ref="indicatorRef" @pickEvt="pickEvt"></vc-selection-indicator>
<!-- 注记层 -->
<!-- 注记层 -->
<vc-layer-imagery :sort-order="20">
<vc-imagery-provider-tianditu map-style="cva_c" token="436ce7e50d27eede2f2929307e6b33c0"></vc-imagery-provider-tianditu>
</vc-layer-imagery>
Expand All @@ -53,6 +54,7 @@
const show = ref(true)
const enabled = ref(true)
const billboards = ref([])
const labels = ref([])
const primitiveClusterRef = ref(null)
const indicatorRef = ref(null)
const minimumClusterSize = ref(3)
Expand Down Expand Up @@ -80,12 +82,27 @@
const feature = features[i]
const coordinates = feature.geometry.coordinates
labels.value.push({
show: true,
scale: 1,
showBackground: true,
backgroundColor: Cesium.Color.fromCssColorString('#000000').withAlpha(0.8),
verticalOrigin: 1,
horizontalOrigin: 0,
pixelOffset: new Cesium.Cartesian2(0, -10),
font: '16px sans-serif',
position: [coordinates[0], coordinates[1]],
disableDepthTestDistance: Number.POSITIVE_INFINITY,
distanceDisplayCondition: [0, Number.POSITIVE_INFINITY],
text: 'label'
})
billboards.value.push({
image: 'https://zouyaoji.top/vue-cesium/images/mark-icon.png',
width: 32,
height: 32,
position: [coordinates[0], coordinates[1]],
onClick: (e) => {
onClick: e => {
console.log(e)
}
})
Expand Down Expand Up @@ -166,6 +183,7 @@
onClicked,
onMouseOver,
onViewerReady,
labels,
billboards,
pickEvt,
indicatorRef,
Expand Down

0 comments on commit 80ea788

Please sign in to comment.