React Native for Arcgis 地图开发 VectorTiled 矢量切片(九)

关于矢量切片VectorTiledLayerCtrl

importReact,{useState,useEffect}from'react';import{View,Text,ScrollView,StyleSheet,Clipboard}from'react-native';import{Button,List,Switch}from'@ant-design/react-native';import{VectorTiledLayerCtrl,LayerManager,MapManager,MapView}from'@haibalai/react-native-arcgis';import{connect}from'react-redux';importWidthDrawerfrom'../../../../components/WithDrawer/index';constMapId='baseMap';constVectorTiledLayerId3857='BP_BADXT_SZ_20191202_VECTOR_3857';constVectorTiledLayerId4490='BP_BADXT_SZ_20191202_VECTOR_4490';/** sideBar组件*@param {*} renderCb renderCb是一个函数, 每次触发并且向里面传值(对象),content组件就以sideBarData的属性去接受@param Home*/constSideBar=({renderCb,Home}:any)=>{const[baseMapTDTStatus,setBaseMapTDTStatus]=useState(false);const[content,changeContent]=useState('');const[errorContent,changeErrorContent]=useState('');const[singleVectorTiledLayerStatus,setVectorTiledLayerStatus]=useState(false);useEffect(()=>{renderCb({content,errorContent,changeContent,changeErrorContent});},[content,errorContent,renderCb]);constgetLayerId=()=>{letcoordinate=Home.coordinate;if(coordinate==='4490'){returnVectorTiledLayerId4490;}else{returnVectorTiledLayerId3857;}};constonSwitchVectorTiledLayerStatus=(e:boolean)=>{if(e){LayerManager.showLayer(MapId,getLayerId());}else{LayerManager.hideLayer(MapId,getLayerId());}setVectorTiledLayerStatus(e);};constonGetRequestConfiguration=()=>{VectorTiledLayerCtrl.getRequestConfiguration(MapId,getLayerId()).then((r:any)=>{changeErrorContent('');changeContent(r);}).catch((e:any)=>{changeErrorContent(e);});};constonGetSourceInfo=()=>{VectorTiledLayerCtrl.getSourceInfo(MapId,getLayerId()).then((r:any)=>{changeErrorContent('');changeContent(''+r);}).catch((e:any)=>{changeErrorContent(e);});};constonGetStyle=()=>{VectorTiledLayerCtrl.getStyle(MapId,getLayerId()).then((r:any)=>{changeErrorContent('');changeContent(r);}).catch((e:any)=>{changeErrorContent(e);});};constonGetUri=()=>{VectorTiledLayerCtrl.getUri(MapId,getLayerId()).then((r:any)=>{changeErrorContent('');changeContent(r);}).catch((e:any)=>{changeErrorContent(e);});};constonSwitchBaseMapTDTStatus=(e:any)=>{if(!e){MapManager.switchBaseMap(MapId,'矢量1202').then((r:any)=>{changeErrorContent('');changeContent(''+r);Clipboard.setString(''+r);}).catch((e:any)=>{changeErrorContent(''+e);Clipboard.setString(''+e);});}else{MapManager.switchBaseMap(MapId,'天地图').then((r:any)=>{changeErrorContent('');changeContent(''+r);Clipboard.setString(''+r);}).catch((e:any)=>{changeErrorContent(''+e);Clipboard.setString(''+e);});}setBaseMapTDTStatus(e);};return(

React Native for Arcgis 地图开发 VectorTiled 矢量切片(九) - 小专栏

你可能感兴趣的:(React Native for Arcgis 地图开发 VectorTiled 矢量切片(九))