123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <!-- Use correct character set. -->
- <meta charset="utf-8"/>
- <!-- Tell IE to use the latest, best version. -->
- <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
- <!-- Make the application on mobile take up the full browser screen and disable user scaling. -->
- <meta
- name="viewport"
- content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"
- />
- <title>Hello World!</title>
- <link rel="stylesheet" href="../../dist/index.css"/>
- <script src="../../dist/index.js"></script>
- <script src="../build/cesium/Cesium.js"></script>
- <link href="../build/cesium/Widgets/widgets.css" rel="stylesheet">
- <script src="https://unpkg.com/@turf/turf/turf.min.js"></script>
- <style>
- html,
- body,
- #cesiumContainer {
- width: 100%;
- height: 100%;
- margin: 0;
- padding: 0;
- overflow: hidden;
- }
- .box {
- position: fixed;
- left: 0;
- top: 0;
- z-index: 1000;
- }
- </style>
- </head>
- <body>
- <div id="cesiumContainer"></div>
- <div class="box">
- <button id="locationById">通过id定位</button>
- <button id="restore">取消选中</button>
- <button id="getViewMarkers">获取当前可视范围内该聚合实例中非聚合点数据</button>
- <button id="close">取消聚合</button>
- <button id="open">开启聚合</button>
- </div>
- <script src="../assets/dataJson/cluster.js"></script>
- <script>
- let map = new CTMapOl.cesiumComponent.ThrdimeInitMap({
- domId: 'cesiumContainer',
- center: [-87.14045498433224, 44.604935926720024],
- zoom: 3
- })
- let viewer = map._viewer;
- let option = {
- dataOptions: [
- {
- "icon": "../assets/image/circled.png",
- "iconSize": [
- 40,
- 40
- ],
- child: {
- "icon": "../assets/image/rect.jpg",
- "iconSize": [
- 20,
- 20
- ],
- "offset": [
- 0,
- 0
- ],
- },
- "offset": [
- 17,
- 17
- ],
- // "clickIcon": "data:image/png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/5n060RxqoAAAAASUVORK5CYII=",
- "clickBig": true,
- "id": "10001",
- "lnglat": [
- -88.90153665861239, 50.745409647716
- ]
- },
- {
- "icon": "../assets/image/rect.jpg",
- "iconSize": [
- 34,
- 34
- ],
- "offset": [
- 17,
- 17
- ],
- "clickIcon": "../assets/image/rect2.jpg",
- "clickBig": false,
- "id": "2680550",
- "lnglat": [
- -88.90153665861239, 51.745409647716
- ]
- }
- ],
- MarkerClusterOptions: {
- "clusterId": "layer-camera",
- "gridSize": 80,
- // "offsetBottom": true,
- "sourceType": "layer-camera",
- // "clickBig": false,
- "maxZoom": 10,
- "zIndex": 60,
- "styles": [
- {
- "url": "../assets/image/rect2.jpg",
- "size": [
- 48,
- 48
- ],
- "textColor": "white",
- "offset": [
- 24,
- 24
- ],
- "textSize": 14,
- "textOffset": [
- 0,
- 8
- ]
- }
- ]
- }
- }
- let cluster = new CTMapOl.cesiumComponent.MarkerCluster(viewer, option) // 圆
- cluster.on('markerclick', e => {
- console.log('markerclick', e)
- })
- document.getElementById('locationById').onclick = e => {
- cluster.locationById({id: 'marker2'})
- }
- document.getElementById('getViewMarkers').onclick = e => {
- console.log('当前可视范围内该聚合实例中非聚合点数据', getViewMarkers())
- }
- document.getElementById('open').onclick = e => {
- cluster.setEnable(true)
- cluster2.setEnable(true)
- }
- document.getElementById('close').onclick = e => {
- cluster.setEnable(false)
- cluster2.setEnable(false)
- }
- document.getElementById('restore').onclick = e => {
- cluster.restore()
- }
- </script>
- </body>
- </html>
|