import React, {Component} from 'react'
|
import './ExampleFwyPage.css'
|
import {GIS} from "iclient3d-plot-diy";
|
import {Button} from "antd";
|
|
;
|
|
export default class ExampleFwyPage extends Component {
|
drawOps = [];
|
|
constructor(props) {
|
super(props);
|
this.state = {
|
htmlString: '<h3>正在加载中...</h3>',
|
};
|
}
|
|
componentDidMount() {
|
this.showData();
|
|
fetch('./example/ExampleFwyPage.md')
|
.then(response => response.text())
|
.then(mdText => {
|
this.setState({htmlString: window.marked.parse(mdText)});
|
});
|
//监听拨盘事件
|
}
|
|
showData() {
|
|
}
|
|
async draw() {
|
let op = {
|
useModify: true,
|
type: "fwy",
|
bjs: [100, 200, 300, 400, 500, 600]
|
}
|
let draw = await this.mapFunction.mapApiService.draw(op);
|
this.drawOps.push(draw);
|
}
|
|
export() {
|
let op = [];
|
for (let d of this.drawOps) {
|
let dd = this.mapFunction.mapApiService.exportDraw(d.code);
|
op.push(dd);
|
}
|
console.log(op);
|
alert(JSON.stringify(op));
|
}
|
|
|
render() {
|
return (
|
<div className={"example_fwy_container"}>
|
<h3>方位圆</h3>
|
<div className={"map_wrapper"}>
|
<GIS refs={
|
e => {
|
this.mapFunction = e
|
}
|
}
|
plotUrl={this.state.plotUrl}
|
mapRef={this}
|
showDefaultLayer={true}
|
/>
|
</div>
|
<Button type="primary" onClick={() => this.draw()}>绘制方位圆</Button>
|
<Button type="primary" onClick={() => this.export()}>导出数据</Button>
|
<div className={"code_wrapper"}>
|
<div dangerouslySetInnerHTML={{__html: this.state.htmlString}}></div>
|
</div>
|
</div>
|
)
|
}
|
}
|