123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
- <title>三维-海量点标记</title>
- <link rel="stylesheet" href="../../dist/index.css" />
- <script src="../../dist/index.js"></script>
- <link href="../../cesium/Source/Widgets/widgets.css" rel="stylesheet">
- <script src="../../cesium/Build/Cesium/Cesium.js"></script>
- </head>
- <body style="margin: 0; padding: 0;">
- <div id="map" style="height: 100vh; width: 100vw;"></div>
- <div class="input-card">
- <div class="input-item">
- <button class="btn" id="lightPoint">根据id高亮点</button>
- </div>
- <div class="input-item">
- <button class="btn" id="origin" onclick="origin()">还原</button>
- </div>
- <div class="input-item">
- <button class="btn" id="remove">移除</button>
- </div>
- <div class="input-item">
- <button class="btn" id="restore" onclick="restore()">还原状态</button>
- </div>
- </div>
- </body>
- <script>
- function origin() {
- points.repeatSize();
- }
- function lightPoint() {
- points.locationById({ id: "12332" });
- }
- function remove() {
- points.remove();
- }
- function restore() {
- points.restore();
- }
- let map = new CTMapOl.cesiumComponent.ThrdimeInitMap({
- domId: 'map',
- center: [103.230695,35.624892],
- zoom: 15
- })
- let viewer = map._viewer;
- var points;
- function initData() {
- let options = {
- viewer,
- layerId: 'DataSourceLayer',
- points: [
- ['103.230695,35.624892', 'aaa', '../assets/monitor-online.png', '25,25', 1],
- // ['120.12,31.21', 'bbb', '../assets/image/rect.jpg', '0,0', 1]
- ],
- // clickOption: [
- // {big: true, icon: '../assets/image/rect2.jpg'},
- // {big: true}
- // ],
- width: 50,
- height: 50,
- clickIcon: '../assets/image/rect2.jpg',
- clickBig: false,
- // zoom: 2, // 超过2级就显示
- // maxZoom: 5,
- // remark: {
- // fontSize: 24,
- // color: 'green',
- // offset: [0, 0],
- // },
- zIndex: 9
- }
- points = new CTMapOl.cesiumComponent.Points(options);
- points.addTo({ viewer: viewer })
- points.on('click', e => {
- console.log(e)
- })
- points.on('mousemove', e => {
- console.log(e)
- })
- document.getElementById('remove').onclick = () => {
- points.remove();
- }
- document.getElementById('lightPoint').onclick = () => {
- points.locationById({id: '12332'});
- }
- }
- initData();
- function initData2() {
- let options = {
- viewer,
- layerId: 'DataSourceLayer',
- points: [
- ['120.12,31.21', '12332', '../assets/image/rect.jpg', '15,15', 2],
- ['120.12,31.21', 'bb23424b', '../assets/image/rect.jpg', '0,0', 2]
- ],
- // clickOption: [
- // {big: false, icon: '../assets/image/rect2.jpg'},
- // {big: false}
- // ],
- width: 30,
- height: 30,
- clickIcon: '../assets/image/rect2.jpg',
- clickBig: false,
- // zoom: 2, // 超过2级就显示
- // maxZoom: 5,
- remark: {
- fontSize: 24,
- color: 'green',
- offset: [0, 0],
- },
- zIndex: 2
- }
- points = new CTMapOl.cesiumComponent.Points(options);
- points.addTo({ viewer: viewer })
- }
- // initData2()
- </script>
- <style>
- /*地图*/
- .mapDIV {
- height: 100vh;
- width: 100vw;
- z-index: 1;
- }
- .add-switch {
- position: absolute;
- right: 30px;
- height: 68px;
- width: 30px;
- bottom: 112px;
- background: #FFFFFF 100%;
- color: #172537;
- border-radius: 4px;
- display: flex;
- flex-direction: column;
- align-items: center;
- z-index: 2;
- }
- .add-s-block {
- height: 20px;
- display: flex;
- align-items: center;
- justify-content: center;
- width: 100%;
- line-height: 20px;
- font-size: 12px;
- margin-bottom: 2px;
- color: #172537;
- }
- .add-zoom {
- width: 20px;
- height: 20px;
- background-image: url('../../dist/assets/image/ar/switch/add-zoom.svg');
- background-size: 100% 100%;
- cursor: pointer;
- }
- .sub-zoom {
- width: 20px;
- height: 20px;
- background-image: url('../../dist/assets/image/ar/switch/sub-zoom.svg');
- background-size: 100% 100%;
- cursor: pointer;
- }
- .add-zoom-out {
- width: 20px;
- height: 20px;
- background-image: url('../../dist/assets/image/ar/switch/add-zoom-out.svg');
- background-size: 100% 100%;
- }
- .sub-zoom-out {
- width: 20px;
- height: 20px;
- background-image: url('../../dist/assets/image/ar/switch/sub-zoom-out.svg');
- background-size: 100% 100%;
- }
- .add-s-block.btn-click {
- cursor: pointer;
- }
- .input-card {
- position: absolute;
- right: 15px;
- bottom: 15px;
- z-index: 999;
- }
- </style>
- </html>
|