定位展示LocationDisplayCtrl封装importReact, {useState, useEffect}from'react';import{View,Text,ScrollView,StyleSheet,DeviceEventEmitter}from'react-native';import{Button,List,Switch}from'@ant-design/react-native';import{LocationCtrl,MapManager,MapView,LocationDisplayCtrl,PictureMarkerSymbol,SimpleMarkerSymbol,}from'@haibalai/react-native-arcgis';import{connect}from'react-redux';importWidthDrawerfrom'../../../../components/WithDrawer/index';constDefaultIcon=require('../../../../image/defaultIcon.jpeg');constMapId='baseMap';constDefineSymbol:PictureMarkerSymbol= {type:'picture-marker',width:15,height:15,url:DefaultIcon,};constDefineAccuracySymbol:SimpleMarkerSymbol= {type:'simple-marker',style:'circle',color:'rgba(8,255,4,0.7)',size:10,};/** sideBar组件*f@param{*} renderCb renderCb是一个函数, 每次触发并且向里面传值(对象),content组件就以sideBarData的属性去接受*/constSideBar= ({renderCb, Home}: any) => {const[content, changeContent] =useState('');const[errorContent, changeErrorContent] =useState('');const[locationDisplayVisible, setSingleMapImageLayerStatus] =useState(false);useEffect(() =>{renderCb({content, errorContent});}, [content, errorContent, renderCb]);useEffect(() =>{console.log(''+DefaultIcon,'symbol测试');}, []);constonSwitchLocationDisplayStatus= (e: boolean) => {LocationDisplayCtrl.setVisible(MapId, e);setSingleMapImageLayerStatus(e);};constonGetSymbol= () => {LocationDisplayCtrl.getSymbol(MapId).then((r: any) =>{console.log(JSON.stringify(r));changeErrorContent('');changeContent(''+ r);}).catch((e: any) =>{changeErrorContent(''+ e);});};constonSetSymbol= () => {LocationDisplayCtrl.setSymbol(MapId,DefineSymbol).then((r: any) =>{changeErrorContent('');changeContent(r);}).catch((e: any) =>{changeErrorContent(e);});};constonGetAccuracySymbol= () => {LocationCtrl.getAccuracySymbol(MapId).then((r: any) =>{changeErrorContent('');changeContent(r);}).catch((e: any) =>{changeErrorContent(e);});};constonSetAccuracySymbol= () => {LocationDisplayCtrl.setAccuracySymbol(MapId,DefineAccuracySymbol).then((r: any) =>{changeErrorContent('');changeContent(r);}).catch((e: any) =>{changeErrorContent(e);});};constonZoomToCurrent= () => {LocationDisplayCtrl.zoomToCurrent(MapId).then((r: any) =>{changeErrorContent('');changeContent(r);}).catch((e: any) =>{changeErrorContent(e);
React Native for Arcgis 地图开发 LocationDisplayCtrl (十四)
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- //针对arcgis的featurelayer 封装FeatureLayerCtrl和案例 importReact...
- ClusterLayerCtrl聚合图层调用封装 importReact, {useEffect, useStat...
- GraphicCtrl的使用importReact, {useState, useEffect}from'reac...
- 针对TileLayer的封装 importReact,{useState,useEffect}from'react...
- 关于矢量切片VectorTiledLayerCtrl importReact,{useState,useEffec...