React Native for Arcgis 地图开发 TileLayer 切片(八)

针对TileLayer的封装


import React, {useState, useEffect} from 'react';
import {View, Text, ScrollView, StyleSheet, Clipboard} from 'react-native';
import {Button, List, Switch} from '@ant-design/react-native';
import {TiledLayerCtrl, LayerManager, MapManager, MapView} from '@haibalai/react-native-arcgis';
import {connect} from 'react-redux';
import WidthDrawer from '../../../../components/WithDrawer/index';

const MapId = 'baseMap';
const EditLayerId3857 = 'BP_BADXT_SZ_20191202_GRID_3857';
const EditLayerId4490 = 'BP_BADXT_SZ_20191202_GRID_4490';

/** sideBar组件
*

@param {*} renderCb renderCb是一个函数, 每次触发并且向里面传值(对象),content组件就以sideBarData的属性去接受
*/
const SideBar = ({renderCb, Home}: any) => {
const [baseMapTDTStatus, setBaseMapTDTStatus] = useState(false);
const [content, changeContent] = useState('');
const [errorContent, changeErrorContent] = useState('');
const [singleTiledLayerStatus, setSingleTiledLayerStatus] = useState(false);
useEffect(() => {
renderCb({content, errorContent});
}, [content, errorContent, renderCb]);
const getLayerId = () => {
let coordinate = Home.coordinate;
if (coordinate === '4490') {
return EditLayerId4490;
} else {
return EditLayerId3857;
}
};
const onSwitchBaseMapTDTStatus = (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);
};
const onSwitchSingleTiledLayer = (e: boolean) => {
if (e) {
LayerManager.showLayer(MapId, getLayerId());
} else {
LayerManager.hideLayer(MapId, getLayerId());
}
setSingleTiledLayerStatus(e);
};
const onGetMapServiceInfo = () => {
TiledLayerCtrl.getMapServiceInfo(MapId, getLayerId())
.then((r: any) => {
changeErrorContent('');
changeContent(r);
})
.catch((e: any) => {
changeErrorContent(e);
});
};
const onGetRefreshInterval = () => {
TiledLayerCtrl.getRefreshInterval(MapId, getLayerId())
.then((r: any) => {
changeErrorContent('');
changeContent(r);
})
.catch((e: any) => {
changeErrorContent(e);
});
};
const onGetRequestConfiguration = () => {
TiledLayerCtrl.getRequestConfiguration(MapId, getLayerId())
.then((r: any) => {
changeErrorContent('');
changeContent(r);
})
.catch((e: any) => {
changeErrorContent(e);
});
};
const onGetUri = () => {
TiledLayerCtrl.getUri(MapId, getLayerId())
.then((r: any) => {
changeErrorContent('');
changeContent(r);
})
.catch((e: any) => {
changeErrorContent(e);
});
};
const onSetRefreshIn
gemgterval = () => {

更多参考 “https://xiaozhuanlan.com/topic/8560213497”

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值