• 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 (十四) - 小专栏

  • 相关阅读:
    Android毕业论文选题基于Uniapp+Springboot实现的校园论坛
    还在写SQL做SAP二开?通过RFC调用NetWeaver,让HANA数据库操作更可靠
    深度学习推理框架
    老卫带你学---leetcode刷题(297. 二叉树的序列化与反序列化)
    k8s实践总结
    直播间自动发言机器人的运行分享,与开发需要到的技术分析
    Linux之V4L2驱动框架
    Netty(10)协议设计与解析(IdleStateHandler:空闲检测器、心跳)
    不使用比较和条件判断实现min函数的一种方法
    防爆等级与防爆原理概述
  • 原文地址:https://blog.csdn.net/haibalai2009/article/details/127666772