• React Native for Arcgis 地图开发 影像RasterLayer(十)


    RasterLayerCtrl的封装调用

    import React, {useState, useEffect} from ‘react’;
    import {View, Text, ScrollView, StyleSheet} from ‘react-native’;
    import {Button, List, Switch} from ‘@ant-design/react-native’;
    import {RasterLayerCtrl, LayerManager, MapManager, MapView} from ‘@haibalai/react-native-arcgis’;
    import {connect} from ‘react-redux’;
    import WidthDrawer from ‘…/…/…/…/components/WithDrawer/index’;
    const MapId = ‘baseMap’;
    const EditFeatureLayerId3857 = ‘DEM_3857’;
    const EditFeatureLayerId4490 = ‘DEM_2000’;
    /** sideBar组件
    *

    @param {*} renderCb renderCb是一个函数, 每次触发并且向里面传值(对象),content组件就以sideBarData的属性去接受
    */
    const SideBar = ({renderCb, Home}: any) => {
    const [content, changeContent] = useState(‘’);
    const [errorContent, changeErrorContent] = useState(‘’);
    const [singleRasterLayerStatus, setSingleRasterLayerStatus] = useState(false);
    useEffect(() => {
    renderCb({content, errorContent});
    }, [content, errorContent, renderCb]);
    const getRender = () => {
    let coordinate = Home.coordinate;
    if (coordinate === ‘4490’) {
    return ‘’;
    } else {
    return ‘’;
    }
    };
    const getLayerId = () => {
    let coordinate = Home.coordinate;
    if (coordinate === ‘4490’) {
    return EditFeatureLayerId4490;
    } else {
    return EditFeatureLayerId3857;
    }
    };
    const onSwitchRasterLayer = (e: boolean) => {
    if (e) {
    LayerManager.showLayer(MapId, getLayerId());
    } else {
    LayerManager.hideLayer(MapId, getLayerId());
    }
    setSingleRasterLayerStatus(e);
    };
    const onGetRasterRenderer = () => {
    RasterLayerCtrl.getRasterRenderer(MapId, getLayerId())
    .then((r: any) => {
    changeErrorContent(‘’);
    changeContent®;
    })
    .catch((e: any) => {
    changeErrorContent(e);
    });
    };
    const onSetRasterRenderer = () => {
    RasterLayerCtrl.setRasterRenderer(MapId, getLayerId(), getRender())
    .then((r: any) => {
    changeErrorContent(‘’);
    changeContent®;
    })
    .catch((e: any) => {
    changeErrorContent(e);
    });
    };
    return (

    }>
    单个RasterLayer

    React Native for Arcgis 地图开发 影像RasterLayer(十) - 小专栏

  • 相关阅读:
    《 Python List 列表全实例详解系列(六)》__查找元素
    npm 打包后自动压缩成zip文件
    竖曲线全线计算
    Go基础学习【2】
    ARM官方汇编与ARM GNU汇编中的伪操作
    GPT提示语格式——个人自用
    Linux启动流程描述
    一个react前端项目中的配置文件作用解析
    [Ext JS]图片显示方式
    六、互联网技术——数据存储
  • 原文地址:https://blog.csdn.net/haibalai2009/article/details/127645756