flutter高德地图大头针

news2024/11/17 21:29:45

1、效果图
在这里插入图片描述
2、pub get

#地图定位
amap_flutter_map: ^3.0.0
amap_flutter_location: ^3.0.0

3、上代码

import 'dart:async';
import 'dart:io';
 
import 'package:amap_flutter_location/amap_flutter_location.dart';
import 'package:amap_flutter_location/amap_location_option.dart';
import 'package:fate_blind_box/theme/theme_color.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
 
import 'package:amap_flutter_map/amap_flutter_map.dart';
import 'package:amap_flutter_base/amap_flutter_base.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:url_launcher/url_launcher.dart';
import '../../../utils/loading.dart';
import '../../Home/map/canteen.dart';
 
class AMapPage extends StatelessWidget {
 
  final String title;
  final String iosKey;
  final String androidKey;
 
  final LatLng? latLng;
 
 
 
  final void Function(AMapController controller)? onMapCreated;
 
  AMapPage(this.title,this.iosKey, this.androidKey, {Key? key, this.latLng, this.onMapCreated}) : super(key: key);
 
 
  // 添加线段
  //lines 结构   [LatLng(26.642386, 106.65195799999998), LatLng(26.641542, 106.65062999999998), LatLng(26.641402, 106.65063499999997), LatLng(26.641411, 106.65086300000002), LatLng(26.641334, 106.65067099999999), LatLng(26.641374, 106.650688), LatLng(26.641567, 106.65078499999998), LatLng(26.641656, 106.651207), LatLng(26.641708, 106.651408), LatLng(26.641413, 106.65066100000001), LatLng(26.641484, 106.65012100000001)]
  //定义
 
 
  @override
  Widget build(BuildContext context) {
 
    List<Marker> markers = [
      Marker(position: const LatLng(39.909215, 116.41005),
        icon:BitmapDescriptor.fromIconPath("images/ic_mapIcon1.png"),
        infoWindow: const InfoWindow(
          title: '东城区',
          snippet: '',
        ),
        onTap: (marker){
          
        },
      ),
 
      Marker(position: const LatLng(39.9305, 116.36003),
        icon:BitmapDescriptor.fromIconPath("images/ic_mapIcon2.png"),
        infoWindow: const InfoWindow(
          title: '西城区',
          snippet: '',
        ),
        onTap: (marker){
          
        },
      ),
      Marker(position: const LatLng(39.9484, 116.48548),
        icon:BitmapDescriptor.fromIconPath("images/ic_mapIcon3.png"),
        infoWindow: const InfoWindow(
          title: '朝阳区',
          snippet: '',
        ),
        onTap: (marker){
          
        },
      ),
      Marker(position: const LatLng(39.8585, 116.28625),
        icon:BitmapDescriptor.fromIconPath("images/ic_mapIcon4.png"),
        infoWindow: const InfoWindow(
          title: '丰台区',
          snippet: '',
        ),
        onTap: (marker){
          
        },
      ),
      Marker(position: const LatLng(39.90564, 116.2229),
        icon:BitmapDescriptor.fromIconPath("images/ic_mapIcon5.png"),
        infoWindow: const InfoWindow(
          title: '石景山区',
          snippet: '',
        ),
        onTap: (marker){
          
        },
      ),
      Marker(position: const LatLng(39.95931, 116.29812),
        icon:BitmapDescriptor.fromIconPath("images/ic_mapIcon1.png"),
        infoWindow: const InfoWindow(
          title: '海淀区',
          snippet: '',
        ),
        onTap: (marker){
          
        },
      ),
      Marker(position: const LatLng(39.94043, 116.10137),
        icon:BitmapDescriptor.fromIconPath("images/ic_mapIcon2.png"),
        infoWindow: const InfoWindow(
          title: '门头沟区',
          snippet: '',
        ),
        onTap: (marker){
          
        },
      ),
 
      Marker(position: const LatLng(39.74786, 116.14257),
        icon:BitmapDescriptor.fromIconPath("images/ic_mapIcon3.png"),
        infoWindow: const InfoWindow(
          title: '房山区',
          snippet: '',
        ),
        onTap: (marker){
          
        },
      ),
 
      Marker(position: const LatLng(39.90564, 116.2229),
        icon:BitmapDescriptor.fromIconPath("images/ic_mapIcon4.png"),
        infoWindow: const InfoWindow(
          title: '石景山区',
          snippet: '',
        ),
        onTap: (marker){
          
        },
      ),
 
      Marker(position: const LatLng(116.65716, 39.90966),
        icon:BitmapDescriptor.fromIconPath("images/ic_mapIcon5.png"),
        infoWindow: const InfoWindow(
          title: '通州区',
          snippet: '',
        ),
        onTap: (marker){
          
        },
      ),
 
      Marker(position: const LatLng(116.65417, 40.1302),
        icon:BitmapDescriptor.fromIconPath("images/ic_mapIcon1.png"),
        infoWindow: const InfoWindow(
          title: '顺义区',
          snippet: '',
        ),
        onTap: (marker){
          
        },
      ),
 
      Marker(position: const LatLng(116.2312, 40.22072),
        icon:BitmapDescriptor.fromIconPath("images/ic_mapIcon3.png"),
        infoWindow: const InfoWindow(
          title: '昌平区',
          snippet: '',
        ),
        onTap: (marker){
          
        },
      ),
 
      Marker(position: const LatLng(116.34149, 39.72668),
        icon:BitmapDescriptor.fromIconPath("images/ic_mapIcon4.png"),
        infoWindow: const InfoWindow(
          title: '大兴区',
          snippet: '',
        ),
        onTap: (marker){
          
        },
      ),
 
      Marker(position: const LatLng(116.63168, 40.31602),
        icon:BitmapDescriptor.fromIconPath("images/ic_mapIcon5.png"),
        infoWindow: const InfoWindow(
          title: '怀柔区',
          snippet: '',
        ),
        onTap: (marker){
          
        },
      ),
 
      Marker(position: const LatLng(117.12133, 40.14056),
        icon:BitmapDescriptor.fromIconPath("images/ic_mapIcon1.png"),
        infoWindow: const InfoWindow(
          title: '平谷区',
          snippet: '',
        ),
        onTap: (marker){
          
        },
      ),
 
      Marker(position: const LatLng(116.84295, 40.37618),
        icon:BitmapDescriptor.fromIconPath("images/ic_mapIcon2.png"),
        infoWindow: const InfoWindow(
          title: '密云县',
          snippet: '',
        ),
        onTap: (marker){
         
        },
      ),
 
      Marker(position: const LatLng(115.97494, 40.45672),
        icon:BitmapDescriptor.fromIconPath("images/ic_mapIcon3.png"),
        infoWindow: const InfoWindow(
          title: '延庆县',
          snippet: '',
        ),
        onTap: (marker){
          
        },
      ),
    ];
    final size = MediaQuery.of(context).size;
    CameraPosition kInitialPosition = CameraPosition(
      target: latLng ?? const LatLng(39.909187, 116.397451),
      zoom: 10.0,
    );
 
    return Scaffold(
      appBar: title.isNotEmpty ? AppBar(
        title: Text(
          title,
          style: const TextStyle(
              color: Colors.black, fontSize: 18, fontWeight: FontWeight.bold),
        ),
        // title:title,
        elevation: 0,
        backgroundColor: Colors.white,
 
      ) :null,
 
      backgroundColor: ThemeColor.sendMsgColor,
      body: AMapWidget(
 
        initialCameraPosition: kInitialPosition,
        buildingsEnabled: false,
        onMapCreated: onCreated,
        privacyStatement: const AMapPrivacyStatement(hasShow: true, hasAgree: true, hasContains: true),
        apiKey: AMapApiKey(
          iosKey: iosKey,
          androidKey: androidKey,
 
        ),
 
        markers:Set<Marker>.of(markers),
        // Set<marker>.of(markers.values),
        onTap: (marker){
 
        },
        onPoiTouched: (marker){
 
          print('object');
        },
 
      ),
 
    );
  }
 
  /// 高德地图
  static Future<bool> gotoGaoDeMap(keywords,longitude, latitude) async {
    var url = '${Platform.isAndroid ? 'android' : 'ios'}amap://navi?sourceApplication=amap&lat=$latitude&lon=$longitude&dev=0&style=2';
 
    bool canLaunchUrl = await canLaunch(url);
 
    if (!canLaunchUrl) {
      toast('未检测到高德地图~');
 
      return false;
    }
 
    await launch(url);
 
    return true;
  }
 
 
  /// 腾讯地图
  static Future<bool> gotoTencentMap(longitude, latitude) async {
    var url = 'qqmap://map/routeplan?type=drive&fromcoord=CurrentLocation&tocoord=$latitude,$longitude&referer=IXHBZ-QIZE4-ZQ6UP-DJYEO-HC2K2-EZBXJ';
    bool canLaunchUrl = await canLaunch(url);
 
    if (!canLaunchUrl) {
      toast('未检测到腾讯地图~');
      // ToastUtil.show('未检测到腾讯地图~');
      return false;
    }
 
    await launch(url);
 
    return canLaunchUrl;
  }
 
  void onCreated(AMapController controller) {
    AMapApprovalNumber.setApprovalNumber(controller);
    if (onMapCreated != null) onMapCreated!(controller);
  }
 
}
 
 
 
 
/// 获取审图号
/// 这里设计的很奇怪,当地图创建后才知道这个号码,但是这个号码不一定要显示在地图之上,却一定要显示在app之内,主要是和上架后的合规有关
class AMapApprovalNumber {
  static String? mapContentApprovalNumber;
  static String? satelliteImageApprovalNumber;
 
  static Function(String? mapContentApprovalNumber, String? satelliteImageApprovalNumber)? _listener;
 
  static void addListener(Function(String? mapContentApprovalNumber, String? satelliteImageApprovalNumber) run) {
    _listener = run;
  }
 
  static void setApprovalNumber(AMapController? mapController) async {
    //普通地图审图号
    mapContentApprovalNumber = await mapController?.getMapContentApprovalNumber();
    //卫星地图审图号
    satelliteImageApprovalNumber = await mapController?.getSatelliteImageApprovalNumber();
 
    if (kDebugMode) {
      print('地图审图号(普通地图): $mapContentApprovalNumber');
      print('地图审图号(卫星地图): $satelliteImageApprovalNumber');
    }
 
    if (_listener != null) _listener!(mapContentApprovalNumber, satelliteImageApprovalNumber);
  }
}
 
 
 
 
///需要在程序启动时向用户展示隐私政策等
///高德地图的定位插件,可以进行连续定位,返回当前位置的经纬度以及转译过的位置信息
mixin AMapLocationStateMixin<WIDGET extends StatefulWidget> on State<WIDGET> {
 
  String get title;
  String get iosKey;
  String get androidKey;
 
 
  /// 是否拥有定位权限
  bool get hasLocationPermission => _hasLocationPermission;
 
  ///获取到的定位信息
  Map<String, Object> get locationResult => _locationResult ?? {};
  ///整理过的数据
  LocationInfo get locationInfo => LocationInfo(locationResult);
 
  ///开始定位
  void startLocation() {
    ///开始定位之前设置定位参数
    _setLocationOption();
    _locationPlugin.startLocation();
  }
 
  ///停止定位
  void stopLocation() {
    _locationPlugin.stopLocation();
  }
 
 
  Map<String, Object>? _locationResult;
 
  StreamSubscription<Map<String, Object>>? _locationListener;
  final AMapFlutterLocation _locationPlugin = AMapFlutterLocation();
  // final List<LatLng> _traackPath = [];
  late AMapController _mapController;
 
  @override
  void initState() {
    super.initState();
    setPath();
 
    AMapFlutterLocation.updatePrivacyShow(true, true);
 
    AMapFlutterLocation.updatePrivacyAgree(true);
 
    /// 动态申请定位权限
    _requestLocationPermission();
 
    AMapFlutterLocation.setApiKey(androidKey, iosKey);
 
    ///iOS 获取native精度类型
    if (Platform.isIOS) {
      _requestAccuracyAuthorization();
    }
 
    ///注册定位结果监听
    _locationListener = _locationPlugin.onLocationChanged().listen((Map<String, Object> result) {
      setState(() {
        _locationResult = result;
      });
    });
  }
 
  // AMapController _mapController;
  Map mapMakerListMap = <dynamic, Marker>{};
  Map mapPolylineListMap = <dynamic, Polyline>{};
  final List<LatLng> _trackPath = [];
  late final List trackList;
  late final List<LatLng> pointList;
 
  late final LatLng center;
  late final double zoom;
 
// 设置轨迹路径
  setPath() {
    if (trackList.isNotEmpty) {
      for (var item in trackList) {
        if (item is Map<String, dynamic>) {
          LatLng? latLng = LatLng.fromJson(item);
          if (latLng != null) {
            _trackPath.add(latLng);
          }
        }
        if (item is List && item.length == 2) {
          LatLng latLng = LatLng(item[0], item[1]);
          _trackPath.add(latLng);
        }
      }
    }
    mapClean();
  }
 
  mapClean() async {
    mapMakerListMap.clear();
    mapPolylineListMap.clear();
    setState(() => null);
  }
 
  @override
  void dispose() {
    super.dispose();
 
    ///移除定位监听
    if (null != _locationListener) {
      _locationListener?.cancel();
    }
 
    ///销毁定位
    _locationPlugin.destroy();
  }
 
  ///设置定位参数
  void _setLocationOption() {
    AMapLocationOption locationOption = AMapLocationOption();
 
    ///是否单次定位
    locationOption.onceLocation = false;
 
    ///是否需要返回逆地理信息
    locationOption.needAddress = true;
 
    ///逆地理信息的语言类型
    locationOption.geoLanguage = GeoLanguage.DEFAULT;
 
    locationOption.desiredLocationAccuracyAuthorizationMode = AMapLocationAccuracyAuthorizationMode.ReduceAccuracy;
 
    locationOption.fullAccuracyPurposeKey = "AMapLocationScene";
 
    ///设置Android端连续定位的定位间隔
    locationOption.locationInterval = 2000;
 
    ///设置Android端的定位模式<br>
    ///可选值:<br>
    ///<li>[AMapLocationMode.Battery_Saving]</li>
    ///<li>[AMapLocationMode.Device_Sensors]</li>
    ///<li>[AMapLocationMode.Hight_Accuracy]</li>
    locationOption.locationMode = AMapLocationMode.Hight_Accuracy;
 
    ///设置iOS端的定位最小更新距离<br>
    locationOption.distanceFilter = -1;
 
    ///设置iOS端期望的定位精度
    /// 可选值:<br>
    /// <li>[DesiredAccuracy.Best] 最高精度</li>
    /// <li>[DesiredAccuracy.BestForNavigation] 适用于导航场景的高精度 </li>
    /// <li>[DesiredAccuracy.NearestTenMeters] 10米 </li>
    /// <li>[DesiredAccuracy.Kilometer] 1000米</li>
    /// <li>[DesiredAccuracy.ThreeKilometers] 3000米</li>
    locationOption.desiredAccuracy = DesiredAccuracy.Best;
 
    ///设置iOS端是否允许系统暂停定位
    locationOption.pausesLocationUpdatesAutomatically = false;
 
    ///将定位参数设置给定位插件
    _locationPlugin.setLocationOption(locationOption);
  }
 
 
  ///获取iOS native的accuracyAuthorization类型
  Future<AMapAccuracyAuthorization> _requestAccuracyAuthorization() async {
    AMapAccuracyAuthorization currentAccuracyAuthorization = await _locationPlugin.getSystemAccuracyAuthorization();
    if (kDebugMode) {
      if (currentAccuracyAuthorization == AMapAccuracyAuthorization.AMapAccuracyAuthorizationFullAccuracy) {
        print("精确定位类型");
      } else if (currentAccuracyAuthorization == AMapAccuracyAuthorization.AMapAccuracyAuthorizationReducedAccuracy) {
        print("模糊定位类型");
      } else {
        print("未知定位类型");
      }
    }
 
    return currentAccuracyAuthorization;
  }
 
 
  bool _hasLocationPermission = false;
 
  /// 申请定位权限
  Future<void> _requestLocationPermission() async {
    //获取当前的权限
    var status = await Permission.location.status;
    if (status == PermissionStatus.granted) {
      //已经授权
      _hasLocationPermission = true;
    } else {
      //未授权则发起一次申请
      status = await Permission.location.request();
      if (status == PermissionStatus.granted) {
        _hasLocationPermission = true;
      } else {
        _hasLocationPermission = false;
      }
    }
 
    if (kDebugMode) {
      if (_hasLocationPermission) {
        print("定位权限申请通过");
      } else {
        print("定位权限申请不通过");
      }
    }
 
  }
}
 
 
class LocationInfo {
 
  //TODO:应当再此类对信息做转换,明确数据类型
 
  String? locTime;
  String? province;
  String? callbackTime;
  String? district;
  double? speed;
 
  double? latitude;
  double? longitude;
 
  String? country;
  String? city;
  String? cityCode;
  String? street;
  String? streetNumber;
  String? address;
  String? description;
 
  double? bearing;
  double? accuracy;
  String? adCode;
  double? altitude;
  int? locationType;
 
  LocationInfo(Map<String, Object> locationResult) {
    locTime = locationResult["locTime"] as String;
    province = locationResult["province"] as String;
    callbackTime = locationResult["callbackTime"] as String;
    district = locationResult["district"] as String;
    speed = locationResult["speed"] as double;
 
    latitude = double.parse(locationResult["latitude"] as String);
    longitude = double.parse(locationResult["longitude"] as String);
 
    country = locationResult["country"] as String;
    city = locationResult["city"] as String;
    print(city);
    cityCode = locationResult["cityCode"] as String;
    street = locationResult["street"] as String;
    streetNumber = locationResult["streetNumber"] as String;
    address = locationResult["address"] as String;
    description = locationResult["description"] as String;
 
    bearing = locationResult["bearing"] as double;
    accuracy = locationResult["accuracy"] as double;
    adCode = locationResult["adCode"] as String;
    altitude = locationResult["altitude"] as double;
    locationType = locationResult["locationType"] as int;
  }
 
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/946881.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

frp实现二级代理

kali是攻击机 &#xff08;192.168.0.106&#xff09; windows server2012是边界服务器&#xff0c;拥有两个网卡&#xff0c;作为一级代理&#xff0c; &#xff08;192.168.0.108&#xff0c;10.10.10.136&#xff09; ad01是内网机器&#xff0c;不出网 &#xff08;10.10.1…

linux中学习控制进程的要点

1. 进程创建 1.1 fork函数 #include <unistd.h> pid_t fork(void); 返回值&#xff1a;自进程中返回0&#xff0c;父进程返回子进程id&#xff0c;出错返回-1 进程调用fork&#xff0c;当控制转移到内核中的fork代码后&#xff0c;内核会做以下操作 分配新的内存块和…

从零构建深度学习推理框架-10 算子的执行流程

计算图的设计 Graph的结构 Operators: 记录所有的节点Input operator: 指定的输入节点Output operator: 指定的输出节点Global input data: 模型的外部全局输入&#xff08;用户指定的输入&#xff09; Operator的结构 Input data: 节点的输入数据Output data: 节点的输出数…

JixiPix Artista Impresso Pro for mac(油画滤镜效果软件)

JixiPix Artista Impresso pro Mac是一款专业的图像编辑软件&#xff0c;专为Mac用户设计。它提供了各种高质量的图像编辑工具&#xff0c;可以帮助您创建令人惊叹的图像。该软件具有直观的用户界面&#xff0c;使您可以轻松地浏览和使用各种工具。 它还支持多种文件格式&…

WSL Opencv with_ffmpeg conan1.60.0

我是ubuntu18. self.options[“opencv”].with_ffmpeg True 关键是gcc版本需要conan支持&#xff0c;比如我的是&#xff1a; compilergcc compiler.version7.5 此外还需要安装系统所需库&#xff1a; https://qq742971636.blog.csdn.net/article/details/132559789 甚至来…

db2迁移至oracle

1.思路 &#xff08;1&#xff09;用java连接数据库&#xff08;2&#xff09;把DB2数据导出为通用的格式如csv&#xff0c;json等&#xff08;3&#xff09;导入其他数据库&#xff0c;比如oracle&#xff0c;mongodb。这个方法自由发挥的空间比较大。朋友说他会用springboot…

Spring Cloud + Spring Boot 项目搭建结构层次示例讲解

Spring Cloud Spring Boot 项目搭建结构层次示例讲解 Spring Cloud 项目搭建结构层次示例Spring Cloud示例&#xff1a; Spring Boot 项目搭建结构层次讲解Spring Boot 项目通常按照一种常见的架构模式组织&#xff0c;可以分为以下几个主要层次&#xff1a;当构建一个 Spring…

fastjson windows主机上线

首先创建一个win类&#xff0c;作为命令执行的类 然后写一个漏洞Fastjson的执行类 将我们的win类传上vps 然后开启web服务 接下来利用ldap协议 java -cp marshalsec-0.0.3-SNAPSHOT-all.jar marshalsec.jndi.LDAPRefServer http://185.239.225.205:80/#win 6666然后我们运…

基于骑手优化算法优化的BP神经网络(预测应用) - 附代码

基于骑手优化算法优化的BP神经网络&#xff08;预测应用&#xff09; - 附代码 文章目录 基于骑手优化算法优化的BP神经网络&#xff08;预测应用&#xff09; - 附代码1.数据介绍2.骑手优化优化BP神经网络2.1 BP神经网络参数设置2.2 骑手优化算法应用 4.测试结果&#xff1a;5…

Doris数据库BE——rowset版本追踪

rowset代码位置be/src/olap/version_graph.cpp&#xff0c;字面意思行集合&#xff0c;由一行或多行组成。rowset版本简单理解为rowset编号&#xff0c;每次导入生成一个rowset&#xff0c;比如insert执行10次会生成10个rowset&#xff0c;一次streamload生成一个rowset。 版本…

Pillow:Python的图像处理库(安装与使用教程)

在Python中&#xff0c;Pillow库是一个非常强大的图像处理库。它提供了广泛的图像处理功能&#xff0c;让我们可以轻松地操作图像&#xff0c;实现图像的转换、裁剪、缩放、旋转等操作。此外&#xff0c;Pillow还支持多种图像格式的读取和保存&#xff0c;包括JPEG、PNG、BMP、…

LeetCode 热题 100(七):105. 从前序与中序遍历序列构造二叉树、14. 二叉树展开为链表

题目一&#xff1a; 105. 从前序与中序遍历序列构造二叉树https://leetcode.cn/problems/construct-binary-tree-from-preorder-and-inorder-traversal/ 思路&#xff1a;依据前序遍历的根左右和中序遍历的左根右&#xff0c; 且根左长度&#xff1d;左根 代码&#xff1a; …

直播预告:把脉2023年下半场—主动防御邮箱盗号威胁

长期以来&#xff0c;承载着大量敏感数据的企业是黑产团伙的首要攻击目标。Coremail结合多年以来的邮件防护经验发现&#xff0c;黑产团伙针对企业邮箱账号安全的两大攻击方式为暴力破解和钓鱼邮件攻击。 一、企业邮箱安全现状 01、使用弱密码 企业员工使用弱密码让黑产团伙有…

docker 学习-- 04 实践2 (lnpmr环境)

docker 学习 系列文章目录 docker 学习-- 01 基础知识 docker 学习-- 02 常用命令 docker 学习-- 03 环境安装 docker 学习-- 04 实践 1&#xff08;宝塔&#xff09; docker 学习-- 04 实践 2 &#xff08;lnpmr环境&#xff09; 文章目录 docker 学习 系列文章目录1. 配…

QSqlDatabase(2)实例,QTableView显示数据库表数据

目录 前言 1、实现的功能 2、具体的代码实现 前言 想了解QSqlDatabase基本知识的&#xff0c;以及增删改查的用法&#xff0c;可以浏览上一篇文章&#xff1a; QSqlDatabase&#xff08;1&#xff09;基本接口&#xff0c;以及(增删改除)的简单实例_Ivy_belief的博客-CSDN…

华为云云服务器评测|基于华为云云耀云服务器L实例开展性能评测,例如 MySQL、Clickhouse、Elasticsearch等等

在当今云计算时代&#xff0c;越来越多的企业和个人开始选择将应用部署在云服务器上&#xff0c;以便更好地满足高性能、可靠性和可扩展性等需求。而华为云云耀云服务器L实例不仅提供了高性能和可靠性的计算和存储资源&#xff0c;而且具有灵活和高效的成本控制&#xff0c;深受…

红黑树(AVL树的优化)上

红黑树略胜AVL树 AVL树是一颗高度平衡搜索二叉树&#xff1a; 要求左右高度差不超过1&#xff08;严格平衡&#xff09; 有的大佬认为AVL树太过严格&#xff0c;对平衡的要求越严格&#xff0c;会带来更多的旋转&#xff08;旋转也还是会有一定的消耗&#xff01;&#xff01;…

05-基础例程5

基础例程5 1、超声波测距 实验介绍 ​ HC-SR04超声波传感器是一款测量距离的传感器。其原理是利用声波在遇到障碍物反射接收结合声波在空气中传播的速度计算的得出。 外观 管脚功能的定义 VCC&#xff1a;供电电源&#xff1b;Trig&#xff1a;触发信号&#xff1b;Echo&a…

元素居中的方法总结

垂直居中 行内元素垂直居中 单行文本垂直居中 1.line-height: 200px; <!DOCTYPE html> <html lang"en"><head><meta charset"UTF-8" /><meta name"viewport" content"widthdevice-width, initial-scale1.0&…

0基础学习VR全景平台篇 第92篇:智慧景区教程

一、上传素材 1.上传全景素材 第一步&#xff1a;进入【素材管理】 第二步&#xff1a;选择【全景图智慧景区】分类 第三步&#xff1a;选择相对景区作品分组&#xff0c;上传全景素材 2.素材标注 第一步&#xff1a;选择上传成功后素材&#xff0c;点击【未标注】 第二步&…