| New file |
| | |
| | | |
| | | ### Example2DDrawUpdatePage ´úÂë |
| | | |
| | | ```jsx |
| | | import React, {Component} from 'react' |
| | | import './ExampleDrawPage.css' |
| | | import {GIS} from "iclient3d-plot-diy"; |
| | | |
| | | import {Button} from "antd"; |
| | | |
| | | export default class Example2DDrawUpdatePage extends Component { |
| | | |
| | | |
| | | optionObjs = { |
| | | "Ä¿±êÐÑÄ¿": { |
| | | code: '123', |
| | | type: "2002", |
| | | xz: true, |
| | | xzColor: '#00ff00', |
| | | xx: true, |
| | | xxColor: '#ff0000', |
| | | iconColor: '#dddddd', |
| | | returnHeight: true, |
| | | useModify: false, |
| | | lon: 102.23554539488224, |
| | | lat: 31.005068100060593, |
| | | height: 0, |
| | | points: [] |
| | | }, |
| | | } |
| | | line_star |
| | | drawOps = []; |
| | | |
| | | constructor(props) { |
| | | super(props); |
| | | this.state = { |
| | | htmlString: '<h3>ÕýÔÚ¼ÓÔØÖÐ...</h3>', |
| | | plotText: '' |
| | | }; |
| | | } |
| | | |
| | | componentDidMount() { |
| | | fetch('./example/Example2DDrawUpdatePage.md') |
| | | .then(response => response.text()) |
| | | .then(mdText => { |
| | | this.setState({htmlString: window.marked.parse(mdText)}); |
| | | }); |
| | | this.showOptions(); |
| | | |
| | | let index = 0; |
| | | let f = () => { |
| | | index++; |
| | | this.mapFunction.mapApiService.updateDraw('123', { |
| | | lon: 102.23554539488224, |
| | | lat: 31.005068100060593, |
| | | height: index * 1000 |
| | | }) |
| | | let dd = this.mapFunction.mapApiService.exportDraw('123'); |
| | | this.setState({ |
| | | plotText : JSON.stringify(dd) |
| | | }); |
| | | if (index < 10) { |
| | | setTimeout(f, 1000) |
| | | } |
| | | } |
| | | f(); |
| | | } |
| | | |
| | | showOptions = () => { |
| | | if (this.mapFunction) { |
| | | let options = []; |
| | | for (let key in this.optionObjs) { |
| | | options.push(this.optionObjs[key]); |
| | | } |
| | | this.mapFunction.mapApiService.showDrawDatas(options); |
| | | } |
| | | }; |
| | | |
| | | |
| | | async draw(option) { |
| | | option = JSON.parse(JSON.stringify(option)); |
| | | option.useModify = true; |
| | | delete option.points; |
| | | delete option.lon; |
| | | delete option.lat; |
| | | delete option.height; |
| | | let p = await this.mapFunction.mapApiService.draw(option); |
| | | p.drawEnd.subscribe(value => { |
| | | // alert(p.export()); |
| | | }) |
| | | this.drawOps.push(p); |
| | | } |
| | | |
| | | export() { |
| | | let op = []; |
| | | let draws = this.mapFunction.mapApiService.getAllDraw(); |
| | | for (let d of draws) { |
| | | let dd = this.mapFunction.mapApiService.exportDraw(d.code); |
| | | if (dd) { |
| | | op.push(dd); |
| | | } |
| | | } |
| | | console.log(op); |
| | | } |
| | | |
| | | render() { |
| | | let buttons = []; |
| | | let obs = JSON.parse(JSON.stringify(this.optionObjs)); |
| | | for (let key in obs) { |
| | | let option = obs[key]; |
| | | buttons.push(<Button type="primary" onClick={this.draw.bind(this, option)} key={key}>{key}</Button>); |
| | | } |
| | | |
| | | return ( |
| | | <div className={"example_draw_container"}> |
| | | <h3>¾ü±ê»æÖÆ/չʾÒÑÓеľü±êÊý¾Ý</h3> |
| | | <div className={"map_wrapper"}> |
| | | <GIS refs={ |
| | | e => { |
| | | this.mapFunction = e |
| | | } |
| | | } |
| | | useSvgIcon={true} |
| | | iconScales={[[0, 2000], [2000, 10000], [10000, 5000000]]} |
| | | plotUrl={this.state.plotUrl} |
| | | mapRef={this} |
| | | map2D={true} |
| | | showDefaultLayer={false} |
| | | /> |
| | | </div> |
| | | {this.state.plotText} |
| | | <div className={"code_wrapper"}> |
| | | <div dangerouslySetInnerHTML={{__html: this.state.htmlString}}></div> |
| | | </div> |
| | | </div> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | ``` |
| New file |
| | |
| | | |
| | | ### ExampleBlinkPage ´úÂë |
| | | |
| | | ```jsx |
| | | import React, {Component} from 'react' |
| | | import './ExampleDrawPage.css' |
| | | import {GIS} from "iclient3d-plot-diy"; |
| | | |
| | | import {Button} from "antd"; |
| | | |
| | | export default class ExampleBlinkPage extends Component { |
| | | |
| | | |
| | | optionObjs = { |
| | | "Ä¿±êÐÑÄ¿": { |
| | | code: '123', |
| | | type: "2002", |
| | | xz: true, |
| | | xzColor: '#00ff00', |
| | | xx: true, |
| | | xxColor: '#ff0000', |
| | | iconColor: '#dddddd', |
| | | returnHeight: true, |
| | | useModify: false, |
| | | lon: 102.23554539488224, |
| | | lat: 31.005068100060593, |
| | | height: 0, |
| | | blink: true, |
| | | blinkCycle: 2000, |
| | | points: [] |
| | | }, |
| | | "ÑÚ»¤ÇøÓò": { |
| | | type: 'yhqy', |
| | | 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, |
| | | blink: true, |
| | | blinkCycle: 3000, |
| | | }, |
| | | "Ðͬ¹ØÏµ": { |
| | | type: 'xtgx', |
| | | points: [{lon: 102.642853926199, lat: 31.012509646376447, height: 0}, |
| | | {lon: 102.66192135373299, lat: 31.005988487769518, height: 0}], |
| | | useModify: false, |
| | | blink: true, |
| | | blinkCycle: 2000, |
| | | }, |
| | | "¸ÉÈÅÏß": { |
| | | type: 'grx', |
| | | points: [{lon: 102.732420985008, lat: 30.97556325857848, height: 0}, |
| | | {lon: 102.73983041603873, lat: 30.97504986175468, height: 0}], |
| | | useModify: false, |
| | | blink: true, |
| | | blinkCycle: 1000, |
| | | }, |
| | | } |
| | | line_star |
| | | drawOps = []; |
| | | |
| | | constructor(props) { |
| | | super(props); |
| | | this.state = { |
| | | htmlString: '<h3>ÕýÔÚ¼ÓÔØÖÐ...</h3>', |
| | | plotText: '' |
| | | }; |
| | | } |
| | | |
| | | componentDidMount() { |
| | | fetch('./example/ExampleBlinkPage.md') |
| | | .then(response => response.text()) |
| | | .then(mdText => { |
| | | this.setState({htmlString: window.marked.parse(mdText)}); |
| | | }); |
| | | this.showOptions(); |
| | | } |
| | | |
| | | showOptions = () => { |
| | | if (this.mapFunction) { |
| | | let options = []; |
| | | for (let key in this.optionObjs) { |
| | | options.push(this.optionObjs[key]); |
| | | } |
| | | this.mapFunction.mapApiService.showDrawDatas(options); |
| | | } |
| | | }; |
| | | |
| | | |
| | | async draw(option) { |
| | | option = JSON.parse(JSON.stringify(option)); |
| | | option.useModify = true; |
| | | delete option.points; |
| | | delete option.lon; |
| | | delete option.lat; |
| | | delete option.height; |
| | | let p = await this.mapFunction.mapApiService.draw(option); |
| | | p.drawEnd.subscribe(value => { |
| | | // alert(p.export()); |
| | | }) |
| | | this.drawOps.push(p); |
| | | } |
| | | |
| | | export() { |
| | | let op = []; |
| | | let draws = this.mapFunction.mapApiService.getAllDraw(); |
| | | for (let d of draws) { |
| | | let dd = this.mapFunction.mapApiService.exportDraw(d.code); |
| | | if (dd) { |
| | | op.push(dd); |
| | | } |
| | | } |
| | | console.log(op); |
| | | } |
| | | |
| | | render() { |
| | | let buttons = []; |
| | | let obs = JSON.parse(JSON.stringify(this.optionObjs)); |
| | | for (let key in obs) { |
| | | let option = obs[key]; |
| | | buttons.push(<Button type="primary" onClick={this.draw.bind(this, option)} key={key}>{key}</Button>); |
| | | } |
| | | |
| | | return ( |
| | | <div className={"example_draw_container"}> |
| | | <h3>¾ü±ê»æÖÆ/չʾÒÑÓеľü±êÊý¾Ý</h3> |
| | | <div className={"map_wrapper"}> |
| | | <GIS refs={ |
| | | e => { |
| | | this.mapFunction = e |
| | | } |
| | | } |
| | | useSvgIcon={true} |
| | | iconScales={[[0, 2000], [2000, 10000], [10000, 5000000]]} |
| | | plotUrl={this.state.plotUrl} |
| | | mapRef={this} |
| | | /> |
| | | </div> |
| | | {this.state.plotText} |
| | | <div className={"code_wrapper"}> |
| | | <div dangerouslySetInnerHTML={{__html: this.state.htmlString}}></div> |
| | | </div> |
| | | </div> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | ``` |