关于矢量切片VectorTiledLayerCtrl

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 {VectorTiledLayerCtrl, LayerManager, MapManager, MapView} from '@haibalai/react-native-arcgis';
import {connect} from 'react-redux';
import WidthDrawer from '../../../../components/WithDrawer/index';

const MapId = 'baseMap';
const VectorTiledLayerId3857 = 'BP_BADXT_SZ_20191202_VECTOR_3857';
const VectorTiledLayerId4490 = 'BP_BADXT_SZ_20191202_VECTOR_4490';

/** sideBar组件
*

@param {*} renderCb renderCb是一个函数, 每次触发并且向里面传值(对象),content组件就以sideBarData的属性去接受
@param Home
*/
const SideBar = ({renderCb, Home}:) => {
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]);
const getLayerId = () => {
let coordinate = Home.coordinate;
if (coordinate === '4490') {
return VectorTiledLayerId4490;
} else {
return VectorTiledLayerId3857;
}
};
const onSwitchVectorTiledLayerStatus = (e:) => {
if (e) {
LayerManager.showLayer(MapId, getLayerId());
} else {
LayerManager.hideLayer(MapId, getLayerId());
}
setVectorTiledLayerStatus(e);
};
const onGetRequestConfiguration = () => {
VectorTiledLayerCtrl.getRequestConfiguration(MapId, getLayerId())
.then((r:) => {
changeErrorContent('');
changeContent(r);
})
.catch((e:) => {
changeErrorContent(e);
});
};
const onGetSourceInfo = () => {
VectorTiledLayerCtrl.getSourceInfo(MapId, getLayerId())
.then((r:) => {
changeErrorContent('');
changeContent('' + r);
})
.catch((e:) => {
changeErrorContent(e);
});
};
const onGetStyle = () => {
VectorTiledLayerCtrl.getStyle(MapId, getLayerId())
.then((r:) => {
changeErrorContent('');
changeContent(r);
})
.catch((e:) => {
changeErrorContent(e);
});
};
const onGetUri = () => {
VectorTiledLayerCtrl.getUri(MapId, getLayerId())
.then((r:) => {
changeErrorContent('');
changeContent(r);
})
.catch((e:) => {
changeErrorContent(e);
});
};
const onSwitchBaseMapTDTStatus = (e:) => {
if (!e) {
MapManager.switchBaseMap(MapId, '矢量1202')
.then((r:) => {
changeErrorContent('');
changeContent('' + r);
Clipboard.setString('' + r);
})
.catch((e:) => {
changeErrorContent('' + e);
Clipboard.setString('' + e);
});
} else {
MapManager.switchBaseMap(MapId, '天地图')
.then((r:) => {
changeErrorContent('');
changeContent('' + r);
Clipboard.setString('' + r);
})
.catch((e:) => {
changeErrorContent('' + e);
Clipboard.setString('' + e);
});
}
setBaseMapTDTStatus(e);
}; return (

更多参考 "https://xiaozhuanlan.com/topic/1902345867"