/**
 * 所有地图图层
 */
 import React, { Component } from 'react';
 // import { Icon, Input, Button,message } from "antd";

 // import styles from './index.less';
 export default class EarthMap extends Component {
   constructor(props) {
     super(props);
     this.state = {
       // loadTransition: false, //地球切换成地图时的过渡
       // keyWord: ""
     };
   }

   componentDidMount() {
     // setTimeout(() => {

     // }, 5000)
   }
   // 利用此事件来决定何时需要重新渲染组件。
   shouldComponentUpdate(nextProps, nextState) {
     if(nextProps.showEarchMap !== this.props.showEarchMap) {
       return true;
     }
     return false;
   }

   // TAG:  根据需求 394，取消搜索功能
   // getCenterMark(e){
   //   console.log(this.state.keyWord)
   //   this.props.clearRotation()
   //   var placeSearch = new AMap.PlaceSearch({city: '全国'});
   //   placeSearch.search(this.state.keyWord, (status, result)=> {
   //     // 搜索成功时，result即是对应的匹配数据
   //     console.log(result)
   //     if(status === "complete" && result.poiList.count>0){
   //       let centerPoint = result.poiList.pois[0].location;
   //       this.props.earthMap.centerAndZoom(new BMapGL.Point(centerPoint.lng, centerPoint.lat), 10);
   //       console.log('EarthMap');
   //       // this.props.markEarthSearch({lng:centerPoint.lng, lat:centerPoint.lat});
   //     }else{
   //       message.info("未搜索到该地点")
   //     }
   //   })
   // }

   render() {
     const {showEarchMap} = this.props
     return (
       <div style={{
         display: showEarchMap?"block": "none"
       }}>
         {/* 地球图层 */}
         {/* TAG:  根据需求 394，取消搜索功能*/}
         {/* <div className={styles.search}>
             <Input
               placeholder="请输入地点:"
               style={{ width: 210 }}
               onChange={(e) => {
                 this.setState({
                   keyWord: e.target.value.trim(),
                 });
               }}
               onPressEnter={() => {
                 //按下回车的事件
                 this.getCenterMark();
               }}
             />
             <Button
               type="primary"
               onClick={() => {
                 this.getCenterMark();
               }}
             >
               <Icon type="search" style={{ fontSize: "16px" }} />
             </Button>
           </div> */}
         {/* <div
           style={{
             width: innerWidth,
             height: "calc(100vh)",
             display: showEarchMap?"block":'none',
             // transition: '1s all ease-in',
           }}
           className="App"
           id="map_container6"
         ></div> */}
       </div>
     );
   }
 }
