From b77b72497a90d9073dbdcc0f7e4fec4fca31585c Mon Sep 17 00:00:00 2001
From: sbjw <sbjw.happy@163.com>
Date: Wed, 11 Mar 2026 02:26:47 +0000
Subject: [PATCH] 细节整理
---
src/example/ExampleSimpleEventPage.js | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 50 insertions(+), 3 deletions(-)
diff --git a/src/example/ExampleSimpleEventPage.js b/src/example/ExampleSimpleEventPage.js
index d3cfc3d..20b86fb 100644
--- a/src/example/ExampleSimpleEventPage.js
+++ b/src/example/ExampleSimpleEventPage.js
@@ -1,6 +1,7 @@
import React, {Component} from 'react'
import './CommonExample.css'
import {GIS} from "iclient3d-plot-diy";
+import {Button} from "antd";
export default class ExampleSimpleEventPage extends Component {
drawOps = [];
@@ -21,15 +22,60 @@
this.setState({htmlString: window.marked.parse(mdText)});
});
//监听拨盘事件
+ this.mapFunction.mapApiService.showDrawDatas([{
+ code: 'asdladjakl',
+ bz: true,
+ bzColor: '#e000ff',
+ bzLineColor: '#ff0000',
+ bzlx: 'simple',
+ jbwb: 'R:00017',
+ type: "2002",
+ returnHeight: true,
+ useModify: false,
+ lon: 102.33054539488224,
+ lat: 31.005468100060593,
+ height: 0,
+ points: [],
+ iconSize: [[20, 20], [30, 30], [40, 40]]
+ }, {
+ type: 'yhqy',
+ code: 'xxcxvawda',
+ points: [{lon: 102.642853926199, lat: 31.012509646376447, height: 0},
+ {lon: 102.65927322610115, lat: 31.01540811637356, height: 0},
+ {lon: 102.66192135373299, lat: 31.005988487769518, height: 0},
+ {lon: 102.64755620178961, lat: 31.00246196283815, height: 0},
+ {lon: 102.642853926199, lat: 31.012509646376447, height: 0}],
+ useModify: false,
+
+ }])
}
showData() {
- this.mapFunction.mapApiService.mapClickEvent.addEventListener((id, primitive, isPoint) => {
- alert(id);
+ // 左击 如果需要dom时的监听
+ this.mapFunction.addEventListener((id, overlay, primitive, data) => {
+ alert('gis组件的左击事件:' + id);
}, this);
+
+ // 左击如果需要底层对象的监听
+ this.mapFunction.mapClickEvent.addEventListener((id, primitive, isPoint) => {
+ console.log(id, primitive, isPoint);
+ alert('左击事件:' + id);
+ }, this);
+
+ // 右键监听
this.mapFunction.mapApiService.mapRightClickEvent.addEventListener((id, primitive, isPoint) => {
- alert(id);
+ console.log(id, primitive, isPoint);
+ alert('右击事件' + id);
}, this);
+ }
+
+ drawPolygon() {
+ //监听拨盘事件
+ this.mapFunction.mapApiService.draw({
+ code: 'xxcx_new_',
+ type: 'yhqy',
+ useModify: true,
+ });
}
render() {
@@ -45,6 +91,7 @@
showDefaultLayer={true}
/>
</div>
+ <Button type="primary" onClick={this.drawPolygon.bind(this)}>新画一个面</Button>
<div className={"code_wrapper"}>
<div dangerouslySetInnerHTML={{__html: this.state.htmlString}}></div>
</div>
--
Gitblit v1.9.3