• React Native for Arcgis 地图开发 LocationDisplayCtrl (十四)


    定位展示LocationDisplayCtrl 封装

    import React, {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’;
    import WidthDrawer from ‘…/…/…/…/components/WithDrawer/index’;
    const DefaultIcon = require(‘…/…/…/…/image/defaultIcon.jpeg’);
    const MapId = ‘baseMap’;
    const DefineSymbol: PictureMarkerSymbol = {
    type: ‘picture-marker’,
    width: 15,
    height: 15,
    url: DefaultIcon,
    };
    const DefineAccuracySymbol: SimpleMarkerSymbol = {
    type: ‘simple-marker’,
    style: ‘circle’,
    color: ‘rgba(8,255,4,0.7)’,
    size: 10,
    };
    /** sideBar组件
    *f

    @param {*} renderCb renderCb是一个函数, 每次触发并且向里面传值(对象),content组件就以sideBarData的属性去接受
    */
    const SideBar = ({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测试’);
    }, []);
    const onSwitchLocationDisplayStatus = (e: boolean) => {
    LocationDisplayCtrl.setVisible(MapId, e);
    setSingleMapImageLayerStatus(e);
    };
    const onGetSymbol = () => {
    LocationDisplayCtrl.getSymbol(MapId)
    .then((r: any) => {
    console.log(JSON.stringify®);
    changeErrorContent(‘’);
    changeContent(‘’ + r);
    })
    .catch((e: any) => {
    changeErrorContent(‘’ + e);
    });
    };
    const onSetSymbol = () => {
    LocationDisplayCtrl.setSymbol(MapId, DefineSymbol)
    .then((r: any) => {
    changeErrorContent(‘’);
    changeContent®;
    })
    .catch((e: any) => {
    changeErrorContent(e);
    });
    };
    const onGetAccuracySymbol = () => {
    LocationCtrl.getAccuracySymbol(MapId)
    .then((r: any) => {
    changeErrorContent(‘’);
    changeContent®;
    })
    .catch((e: any) => {
    changeErrorContent(e);
    });
    };
    const onSetAccuracySymbol = () => {
    LocationDisplayCtrl.setAccuracySymbol(MapId, DefineAccuracySymbol)
    .then((r: any) => {
    changeErrorContent(‘’);
    changeContent®;
    })
    .catch((e: any) => {
    changeErrorContent(e);
    });
    };
    const onZoomToCurrent = () => {
    LocationDisplayCtrl.zoomToCurrent(MapId)
    .then((r: any) => {
    changeErrorContent(‘’);
    changeContent®;
    })
    .catch((e: any) => {
    changeErrorContent(e);

    React Native for Arcgis 地图开发 LocationDisplayCtrl (十四) - 小专栏

  • 相关阅读:
    图像处理--平滑
    “全宇宙首个”用中文编写的操作系统,作者还自创了甲、乙、丙编程语言?
    【图像修复】论文阅读笔记 ----- 《Image inpainting based on deep learning: A review》
    彩票-股票-外汇-加密货币-概率游戏交易思维训练1
    【Linux系统化学习】开发工具——gdb(调试器)
    Python 基于PyCharm断点调试
    ActiViz中不规则网络数据体绘制技术介绍
    elastisearch开发时的发现
    【3dmax】怎么将点删除而面保留
    MySQL夺命10问,你能坚持到第几问?
  • 原文地址:https://blog.csdn.net/haibalai2009/article/details/127666772