sbjw
7 days ago f39e4480ffd7aa755fbed9cf405b50ed8d33342b
public/example/ExampleSimpleEventPage.md
@@ -5,6 +5,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 = [];
@@ -25,15 +26,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() {
@@ -49,6 +95,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>