vue+leaflet笔记之地图网格

news2024/10/6 9:24:22

vue+leaflet笔记之地图网格

本文介绍了Web端使用Leaflet开发库显示地图经纬网和标准图幅网格的方法 (底图来源:天地图), 地图格网是由间隔均匀的横向线和纵向线组成的网络,用于在地图上识别各个位置。 经纬网通过在地图上描绘纬度和经度格网,用于表示地图的地理坐标;标准图幅网格通过在地图上展示不同比例尺下的网格图幅号与点击查询地图范围,用于描绘地图的位置、比例尺等信息,示例效果如下图所示。


开发环境

Vue开发库:3.2.37 & Leaflet开发库:1.9.3

主要插件:turf


使用教程

实现方式

首先,获取到当前地图map,通过map.getBounds() map.getZoom()获取到当前地图范围和当前地图缩放级别 ,利用地图范围和缩放级别按照对应的规则进行计算,生成地图经纬网或标准图幅网格要素,然后添加到图层组(地图)中。

核心代码

经纬网

经纬网是由表示地球东西位置的经线和表示地球南北位置的子午线构成,由于大家日常接触较多,这里不再赘述。

效果图
核心代码
// 获取当前地图缩放级别
let zoom = map.getZoom(); 
if (zoom > 2 || zoom < 20) {
    let bounds = map.getBounds(); // 获取到当前地图范围
    let north = bounds.getNorth(); // 当前视口最北点经度
    let east = bounds.getEast(); // 当前视口最东点纬度
    // 经线网格
    for (let index = -180; index <= 360; index += degree) {
        // 判断是否在当前视野内
        if (bounds.contains([north, index])) {
            // 绘制经线
            let lonLine = L.polyline([[-90, index], [90, index],],
                                     { weight: 1, dashArray: '10, 5', color: gridLineLatLng.color } // 线样式
                                    );
            // 添加到图层组中
            gridLineLatLng.currentFeatureLayerGroup.addLayer(lonLine);
            // 文字标注
            let text = index.toFixed(1) + "°";
            // 动态计算小数位数
            if (zoom > 10) {
                text = index.toFixed((zoom - 8) / 2) + "°";
            }
            let divIcon = L.divIcon({
                html: `<span style="white-space: nowrap;color:#fff;font-size:14px;font-family:Times New Roman;font-weight:700;text-shadow: 0 0 5px #ff1200, 0 0 10px #ff1200;">${text}</span>`,
                className: 'grid-text-icon', // 取消白色的方形显示
                iconAnchor: [14, -5],
            });
            let textMarker = L.marker([north, index], { icon: divIcon });
            gridLineLatLng.currentFeatureLayerGroup.addLayer(textMarker);
        }
    }
    if (degree > 90) degree = 90;
    // 纬线网格处理代码
    
}
// 注册地图鼠标移动事件,动态生成网格
gridLineLatLng.currentMap.on('mousemove', gridLineLatLng.mousemove);

标准图幅网格

我国把 1:1 万、1:2.5 万、1:5 万、1:10 万、1:25 万、1:50 万、1:100 万 7 种比例尺作为国家基本地图的比例尺系列。根据国家标准GB/13989-92 《国家基本比例尺地形图分幅和编号》规定,我国基本比例尺地形图均1:100 万地形图为基础,按规定的经差和纬差划分图幅。下表为地形图的经纬差、行列数及图幅数。

由于南北两半球的经度相同,规定在南半球的图号前加一个 S,北半球的图号前不加任何符号。如南、北半球经纬度度数相同的情况下北半球图幅号为 F50B001001 ,而南半球则为SF50B001001。比例尺代码含义如下图所示。

效果图
核心代码

计算方法参考leaflet 叠加新标准分幅网格

let features = []; // 存储生成的面要素
let coordinates = [] // 存储生成的面要素坐标对
// 计算标准分幅网格行列范围
const millionRowCode = 'ABCDEFGHIJKLMNOPQRSTUV';
const col0 = parseInt((x0 - GridX0) / lngDiff);
const col1 = parseInt((x1 - GridX0) / lngDiff);
const row0 = parseInt((y0 - GridY0) / latDiff);
const row1 = parseInt((y1 - GridY0) / latDiff);
for (let row = row0; row <= row1; row++) {
    let gy0 = GridY0 + row * latDiff;
    let gy1 = gy0 + latDiff;
    let gcy = (gy0 + gy1) * 0.5;    // 分幅中心点 y 坐标
    let millionRow = parseInt((gy0 - 0) / 4); // 1:100分幅行号
    let Hemisphere = '';   // 北半球标志
    if (millionRow < 0) {
        millionRow = -1 - millionRow;
        Hemisphere = 'S'; // 南半球标志
    }
    for (let col = col0; col <= col1; col++) {
        let gx0 = GridX0 + col * lngDiff;
        let gx1 = gx0 + lngDiff;
        let gcx = (gx0 + gx1) * 0.5;    // 分幅中心点 x 坐标
        let millionCol = parseInt((gcx - GridX0) / 6) + 1;  // 1:100分幅列号(从1开始)
        coordinates = [[[gx0, gy0], [gx1, gy0], [gx1, gy1], [gx0, gy1], [gx0, gy0]]];
        millionCol = (millionCol < 10) ? ('0' + millionCol) : millionCol;
        let gridID = Hemisphere + millionRowCode[millionRow] + millionCol;
        if (scaleCode != '') {
            // 计算当前分幅在 1:100万 分幅内的行列号(注意,这里行列号从左向右,从北向南,从1开始编号)
            let colID = parseInt((fractional((gcx - GridX0) / 6) * 6) / lngDiff) + 1;
            let rowID = parseInt((fractional((GridY1 - gcy) / 4) * 4) / latDiff) + 1;
            gridID += scaleCode + formatInt(rowID, 3) + formatInt(colID, 3);
        }
        // 生成矢量要素(几何信息+属性信息)
        let feature = {
            type: "Feature",
            geometry: {
                type: "Polygon",
                coordinates: coordinates
            },
            properties: {
                ID: gridID,
                extend: '西:' + gx0 + ' 东:' + gx1 + ' 南:' + gy0 + ' 北:' + gy1
            }
        };
        features.push(feature);
    }
}

详细源码(Vue3)

主文件index.vue

<template>
  <div class="app-contain">
    <!-- leaflet 地图容器 -->
    <div id="myMap"></div>
    <div class="controls">
      <el-button color="#626aef" @click="mapGridLonLat">经纬网</el-button>
      <el-button color="#626aef" @click="mapGridStandard">标准图幅</el-button>
      <el-button color="#626aef" @click="clearMapGrid()">清空</el-button>
    </div>
  </div>
</template>

<script setup>
import { gridLineLatLng, gridLineStandard } from './store/mapGrids.js'
// 引入样式
import L from 'leaflet';
import 'leaflet/dist/leaflet.css'
import { onMounted } from 'vue'

let map = null;
let gridLineLayer = null;
// 天地图TK
let tdtKey = 'YOURS_TK'
const initMap = () => {
  // 天地图-矢量注记服务
  const vector_cva =
    new L.TileLayer(`http://t0.tianditu.gov.cn/cva_c/wmts?layer=cva&style=default&tilematrixset=c&Service=WMTS&Request=GetTile&Version=1.0.0&Format=tiles&TileMatrix={z}&TileCol={x}&TileRow={y}&tk=${tdtKey}`,
      {
        tileSize: 512,
        noWrap: true,
        bounds: [[-90, -180], [90, 180]]
      })
  // 天地图-矢量地图服务
  const vector_vec =
    new L.TileLayer(`http://t0.tianditu.com/vec_c/wmts?layer=vec&style=default&tilematrixset=c&Service=WMTS&Request=GetTile&Version=1.0.0&Format=tiles&TileMatrix={z}&TileCol={x}&TileRow={y}&tk=${tdtKey}`,
      {
        tileSize: 512,
        noWrap: true,
        bounds: [[-90, -180], [90, 180]]
      })

  const layers = L.layerGroup([vector_vec, vector_cva])

  map = L.map('myMap', {  //需绑定地图容器div的id
    attributionControl: false,
    zoomControl: true, // 显示缩放控件
    center: [39.56, 116.20], //初始地图中心
    crs: L.CRS.EPSG4326,
    // 最小显示等级
    minZoom: 1,
    // 最大显示等级
    maxZoom: 18,
    scrollWheelZoom: true, //默认开启鼠标滚轮缩放
    // 限制显示地理范围
    maxBounds: L.latLngBounds(L.latLng(-90, -180), L.latLng(90, 180)),
    layers: [layers],// 图层
  }).setView([28.907459, 120.003576], 6)

  /** 网格生成 */

  // 创建图层组
  gridLineLayer = L.featureGroup().addTo(map).bringToFront();
}

// 经纬网
const mapGridLonLat = () => {
  // 若存在,则移除标准图幅网格
  if (gridLineStandard.currentMap != null) {
    gridLineStandard.destory()
  }
  gridLineLatLng.currentMap = map;
  gridLineLatLng.currentFeatureLayerGroup = gridLineLayer
  // 间隔度数
  gridLineLatLng.degree = 1;
  // 网格颜色
  gridLineLatLng.color = '#6666ff'
  gridLineLatLng.init()
}
// 标准图幅网格
const mapGridStandard = () => {
  // 若存在,则移除标准图幅网格
  if (gridLineStandard.currentMap != null) {
    gridLineLatLng.destory()
  }
  gridLineStandard.currentMap = map;
  gridLineStandard.currentFeatureLayerGroup = gridLineLayer
  gridLineStandard.init()
}
// 网格清空
const clearMapGrid = () => {
  // 若存在,则移除标准图幅网格
  if (gridLineStandard.currentMap != null) {
    gridLineLatLng.destory()
  }
  // 若存在,则移除标准图幅网格
  if (gridLineStandard.currentMap != null) {
    gridLineStandard.destory()
  }
}

onMounted(() => {
  initMap()
})
</script>

<style scoped>
#myMap {
  width: 94vw;
  height: 96vh;
}
.grid-text-icon {
  font-size: 16px;
}
.controls {
  position: absolute;
  top: 0px;
  left: 200px;
  padding: 15px;
  z-index: 1000;
}
</style>

mapGrids.js

/** 
 * 地图网格工具js
 * 
 * @author fungis@163.com
 * @date 2023-05-18
 */

// 本地资源数据
import { makeStandardMapGrids } from './standardMapGrids.js'
// 引入turf
import * as turf from '@turf/turf'

export {
    gridLineLatLng, gridLineStandard
}

/** 地图经纬网格网 */
let gridLineLatLng = {
    currentMap: null,
    currentFeatureLayerGroup: null,
    color: "blue",
    degree: 2,
    init: function () {
        // 清理图层
        gridLineLatLng.currentFeatureLayerGroup.clearLayers();
        // 经纬度间隔
        let map = gridLineLatLng.currentMap;
        let degree = gridLineLatLng.degree;
        // 小于0.01时按0.01计算(数值越小,计算事件越长)
        if (degree < 0.01) {
            degree = 0.01
        }
        let zoom = map.getZoom(); // 获取当前地图缩放级别
        if (zoom > 2 || zoom < 20) {
            let bounds = map.getBounds(); // 获取到当前地图范围
            let north = bounds.getNorth(); // 当前视口最北点经度
            let east = bounds.getEast(); // 当前视口最东点纬度
            // 经线网格
            for (let index = -180; index <= 360; index += degree) {
                // 判断是否在当前视野内
                if (bounds.contains([north, index])) {
                    // 绘制经线
                    let lonLine = L.polyline([[-90, index], [90, index],],
                        { weight: 1, dashArray: '10, 5', color: gridLineLatLng.color } // 线样式
                    );
                    // 添加到图层组中
                    gridLineLatLng.currentFeatureLayerGroup.addLayer(lonLine);
                    // 文字标注
                    let text = index.toFixed(1) + "°";
                    // 动态计算小数位数
                    if (zoom > 10) {
                        text = index.toFixed((zoom - 8) / 2) + "°";
                    }
                    let divIcon = L.divIcon({
                        html: `<span style="white-space: nowrap;color:#fff;font-size:14px;font-family:Times New Roman;font-weight:700;text-shadow: 0 0 5px #ff1200, 0 0 10px #ff1200;">${text}</span>`,
                        className: 'grid-text-icon', // 取消白色的方形显示
                        iconAnchor: [14, -5],
                    });
                    let textMarker = L.marker([north, index], { icon: divIcon });
                    gridLineLatLng.currentFeatureLayerGroup.addLayer(textMarker);
                }
            }
            if (degree > 90) degree = 90;
            // 纬线网格
            for (let index = -90; index <= 90; index += degree) {
                if (bounds.contains([index, east])) {
                    let lonLine = L.polyline([[index, -180], [index, 360],],
                        { weight: 1, dashArray: '10, 5', color: gridLineLatLng.color } // 线样式
                    );
                    gridLineLatLng.currentFeatureLayerGroup.addLayer(lonLine);
                    // 标注
                    let text = index.toFixed(1) + "°";
                    if (zoom > 10) {
                        text = index.toFixed((zoom - 8) / 2) + "°";
                    }
                    let divIcon = L.divIcon({
                        html: `<span style="white-space: nowrap;color:#fff;font-size:14px;font-family:Times New Roman;font-weight:700;text-shadow: 0 0 5px #ff1200, 0 0 10px #ff1200;">${text}</span>`,
                        className: 'grid-text-icon', // 取消白色的方形显示
                        iconAnchor: [(text.length + 1) * 6, 0],
                    });
                    let textMarker = L.marker([index, east], { icon: divIcon });
                    gridLineLatLng.currentFeatureLayerGroup.addLayer(textMarker);
                }
            }
        }
        // 注册地图鼠标移动事件,动态生成网格
        gridLineLatLng.currentMap.on('mousemove', gridLineLatLng.mousemove);
    },
    mousemove: function () {
        gridLineLatLng.init();
    },
    destory: function () {
        // 移除地图事件
        gridLineLatLng.currentMap.off('mousemove', gridLineLatLng.mousemove);
        // 清理图层
        gridLineLatLng.currentFeatureLayerGroup.clearLayers();
    }
}

/** 地图标准图幅格网 */
let gridLineStandard = {
    currentMap: null,
    currentFeatureLayerGroup: null,
    color: "red",
    init: function () {
        // 清理图层
        gridLineStandard.currentFeatureLayerGroup.clearLayers();
        // 经纬度间隔
        let map = gridLineStandard.currentMap;
        // 重新添加网格图层
        let gridLineLayer = gridLineStandard.currentFeatureLayerGroup;
        // 生成网格
        let bounds = map.getBounds();
        const zoom = map.getZoom();
        let scale = 1000000;
        if (zoom > 11) {
            scale = 5000;
        } else if (zoom > 10) {
            scale = 10000;
        } else if (zoom > 9) {
            scale = 25000;
        } else if (zoom > 8) {
            scale = 50000;
        } else if (zoom > 7) {
            scale = 100000;
        } else if (zoom > 6) {
            scale = 250000;
        } else if (zoom > 4) {
            scale = 500000;
        }
        let grids = makeStandardMapGrids(bounds.getWest(), bounds.getSouth(), bounds.getEast(), bounds.getNorth(), scale);
        if (grids == null) {
            return;
        }
        let lineLayer = L.geoJSON(grids, {
            style: function (feature) {
                return {
                    color: gridLineStandard.color,
                    weight: 1,
                    fillColor: 'green',
                    dashArray: '10, 5',
                    fillOpacity: 0
                };
            }, onEachFeature(feature, layer) {
                // 显示文字
                let content = "图:" + feature.properties.ID + '<br>'
                // marker的icon文字
                let myIcon = L.divIcon({
                    html: `<div style="white-space: nowrap;color:red;">${content}</div>`,
                    iconAnchor: [50, 0],
                    className: 'my-div-icon',
                    iconSize: 120
                });
                // 中心点位
                let centerPoint = turf.center(feature);
                let featureCenter = L.latLng(centerPoint.geometry.coordinates[1], centerPoint.geometry.coordinates[0]);
                gridLineLayer.addLayer(L.marker(featureCenter, { icon: myIcon }));
            }
        }).bindPopup(function (layer) {
            return "图幅:" + layer.feature.properties.ID + '<br>' + layer.feature.properties.extend;
        });

        gridLineLayer.addLayer(lineLayer);
        gridLineStandard.currentMap.on('mousemove', gridLineStandard.mousemove);
    },
    mousemove: function () {
        gridLineStandard.init();
    },
    destory: function () {
        // 移除地图事件
        gridLineStandard.currentMap.off('mousemove', gridLineStandard.mousemove);
        // 清理图层
        gridLineStandard.currentFeatureLayerGroup.clearLayers();
    }
}

standardMapGrids.js

/** 
 * 地图标准图幅计算要素生成工具js
 * https://www.cnblogs.com/oloroso/p/14129066.html
 * 
 * @author ymwh@foxmail.com
 * @date 2020-12-13
 */
// 获取小数部分
const fractional = function (x) {
    x = Math.abs(x);
    return x - Math.floor(x);
}
const formatInt = function (x, len) {
    let result = '' + x;
    len = len - result.length;
    while (len > 0) {
        result = '0' + result;
        len--;
    }
    return result;
}

/**
 * 创建标准分幅网格
 * @param west,south,east,north 传入要创建的标准分幅网格的经纬度范围
 * @param scalem 表示比例尺的分母(例如 10000 表示 1:1万)
 * @returns 返回一个 geojson 对象
 * @author solym ymwh@foxmail.com 2020年12月13日
 */
export function makeStandardMapGrids(west, south, east, north, scalem) {
    let lngDiff = 0;
    let latDiff = 0;
    let scaleCode = '';
    switch (scalem) {
        case 1000000:
            lngDiff = 6;
            latDiff = 4;
            break;
        case 500000:
            lngDiff = 3;
            latDiff = 2;
            scaleCode = 'B';
            break;
        case 250000:
            lngDiff = 1.5;
            latDiff = 1;
            scaleCode = 'C';
            break;
        case 100000:
            lngDiff = 0.5;
            latDiff = 1 / 3;
            scaleCode = 'D';
            break;
        case 50000:
            lngDiff = 0.25;
            latDiff = 1 / 6;
            scaleCode = 'E';
            break;
        case 25000:
            lngDiff = 0.125;
            latDiff = 1 / 12;
            scaleCode = 'F';
            break;
        case 10000:
            lngDiff = 0.0625;
            latDiff = 1 / 24;
            scaleCode = 'G';
            break;
        case 5000:
            lngDiff = 0.03125;
            latDiff = 1 / 48;
            scaleCode = 'H';
            break;
        default:
            return null;
    }
    const GridX0 = -180;
    const GridX1 = 180;
    const GridY0 = -88;
    const GridY1 = 88;
    let x0 = Math.max(GridX0, west);
    let y0 = Math.max(GridY0, south);
    let x1 = Math.min(GridX1, east);
    let y1 = Math.min(GridY1, north);
    if (((x1 - x0) < lngDiff) || ((y1 - y0) < latDiff)) {
        return null;
    }

    let features = []; // 存储生成的面要素
    let coordinates = [] // 存储生成的面要素坐标对
    // 计算标准分幅网格行列范围
    const col0 = parseInt((x0 - GridX0) / lngDiff);
    const col1 = parseInt((x1 - GridX0) / lngDiff);
    const row0 = parseInt((y0 - GridY0) / latDiff);
    const row1 = parseInt((y1 - GridY0) / latDiff);
    const millionRowCode = 'ABCDEFGHIJKLMNOPQRSTUV';
    for (let row = row0; row <= row1; row++) {
        let gy0 = GridY0 + row * latDiff;
        let gy1 = gy0 + latDiff;
        let gcy = (gy0 + gy1) * 0.5;    // 分幅中心点 y 坐标
        let millionRow = parseInt((gy0 - 0) / 4); // 1:100分幅行号
        let Hemisphere = '';   // 北半球标志
        if (millionRow < 0) {
            millionRow = -1 - millionRow;
            Hemisphere = 'S'; // 南半球标志
        }
        for (let col = col0; col <= col1; col++) {
            let gx0 = GridX0 + col * lngDiff;
            let gx1 = gx0 + lngDiff;
            let gcx = (gx0 + gx1) * 0.5;    // 分幅中心点 x 坐标
            let millionCol = parseInt((gcx - GridX0) / 6) + 1;  // 1:100分幅列号(从1开始)
            coordinates = [[[gx0, gy0], [gx1, gy0], [gx1, gy1], [gx0, gy1], [gx0, gy0]]];
            millionCol = (millionCol < 10) ? ('0' + millionCol) : millionCol;
            let gridID = Hemisphere + millionRowCode[millionRow] + millionCol;
            if (scaleCode != '') {
                // 计算当前分幅在 1:100万 分幅内的行列号(注意,这里行列号从左向右,从北向南,从1开始编号)
                let colID = parseInt((fractional((gcx - GridX0) / 6) * 6) / lngDiff) + 1;
                let rowID = parseInt((fractional((GridY1 - gcy) / 4) * 4) / latDiff) + 1;
                gridID += scaleCode + formatInt(rowID, 3) + formatInt(colID, 3);
            }
            // 生成矢量要素(几何信息+属性信息)
            let feature = {
                type: "Feature",
                geometry: {
                    type: "Polygon",
                    coordinates: coordinates
                },
                properties: {
                    ID: gridID,
                    extend: '西:' + gx0 + ' 东:' + gx1 + ' 南:' + gy0 + ' 北:' + gy1
                }
            };
            features.push(feature);
        }
    }
    return {
        type: "FeatureCollection",
        features: features
    };
}

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

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

相关文章

40.Docker

目录 一、Docker。 &#xff08;1&#xff09;认识Docker。 &#xff08;1.1&#xff09;什么是Docker。 &#xff08;1.2&#xff09;Docker和虚拟机的区别。 &#xff08;2&#xff09;镜像、容器、DockerHub、Docker架构。 &#xff08;3&#xff09;安装Docker&#…

VS+QT+VTK三维曲面网格点选切割

程序示例精选 VSQTVTK三维曲面网格点选切割 如需安装运行环境或远程调试&#xff0c;见文章底部个人QQ名片&#xff0c;由专业技术人员远程协助&#xff01; 前言 这篇博客针对<<VSQTVTK三维曲面网格点选切割>>编写代码&#xff0c;代码整洁&#xff0c;规则&…

DAMA学习笔记1:概念模型-逻辑模型篇

A实体的某个字段指向 B实体的主键, 则称A实体的那个字段为该实体的外键, 一个表里可以有多个外键&#xff0c;也可以没有外键&#xff1b; 被指向的实体称为主实体(主表)&#xff0c;也叫父实体(父表)&#xff0c;负责指向的实体称为从实体(从表)&#xff0c;也叫子实体(子表)…

记录好项目D18

记录好项目 你好呀&#xff0c;这里是我专门记录一下从某些地方收集起来的项目&#xff0c;对项目修改&#xff0c;进行添砖加瓦&#xff0c;变成自己的闪亮项目。修修补补也可以成为毕设哦 本次的项目是个网上商城 一、系统介绍 前台商城系统&#xff1a;包含首页登录、商…

动态规划——下降路径最小和

题目链接 leetcode在线oj题——下降路径最小和 题目描述 给你一个 n x n 的 方形 整数数组 matrix &#xff0c;请你找出并返回通过 matrix 的下降路径 的 最小和 。 下降路径 可以从第一行中的任何元素开始&#xff0c;并从每一行中选择一个元素。在下一行选择的元素和当前…

mmpose冻结参数训练,如何添加find_unused_parameters参数

mmpose冻结参数训练&#xff0c;如何添加find_unused_parameters参数 在backbone下方添加 frozen_stages7即可冻结前7层的参数。要注意对于多卡训练来说还需要添加 find_unused_parameters True。看图片中代码的位置。

回忆雅礼朱哥二三事

少年时代的记忆是最模糊的&#xff0c;却也是最深刻的。一些瞬间在大脑里几十年&#xff0c;那一定是你曾经心动和在乎过的感受。年少求学期间&#xff0c;因对数学的痴迷&#xff0c;和数学有关的一切我都记忆犹新&#xff1a;记得一个人趴在地上解题一下午的投入&#xff0c;…

分析各种富文本框的自动填写方法

怎样自动填写表单中的富文本框&#xff1f; 什么是富文本框&#xff1f;富文本框就是在网页上可以输入带格式的文本输入框。在富文本框中&#xff0c;可以设置使用不同的字体、颜色&#xff0c;可以控制段落、边距&#xff0c;还可以插入图片、表情等。是实现在线编辑不可或缺…

c++ word简单的写文本与画表格只支持docx

简单使用的代码如下所示&#xff1a; #include "stdafx.h" #include <windows.h> #include "minidocx.hpp" using namespace docx; using namespace std; std::string GB2312ToUTF8(const std::string& gb2312) { int len MultiByteToWid…

【ESP32C3合宙ESP32C3】:ESP32C3和合宙ESP32C3的环境搭建与离线包安装

项目场景&#xff1a; 最近买了一块合宙ESP32C3的开发板&#xff0c;于是想要开发一下&#xff0c;当然开发最开始少不掉开发环境的搭建&#xff0c;在这个搭建的过程中&#xff0c;遇到了一些问题&#xff0c;解决了&#xff0c;也希望能帮助到大家。 ESP32C3 和 合宙ES…

Spring Boot 中的 Elasticsearch 的数据操作配置

Spring Boot 中的 Elasticsearch 的数据操作配置 Elasticsearch是一个基于Lucene的搜索引擎&#xff0c;可以快速地存储、搜索和分析大量的数据。Spring Boot是一个开发框架&#xff0c;提供了快速构建基于Spring的应用程序的工具和技术。在本文中&#xff0c;我们将讨论如何在…

GBASE南大通用时代亿信共筑商业秘密防护联合解决方案

当前&#xff0c;数字经济因其覆盖面广且渗透力强&#xff0c;与各行业深度融合&#xff0c;正在逐渐引领新经济发展。另一方面&#xff0c;数据安全已上升为国家战略&#xff0c;中央相继出台政策文件&#xff0c;加强数据安全、商业秘密、个人隐私保护&#xff0c;提高网络安…

聚观早报 | 美团收购光年之外;世卫:可乐中甜味剂或致癌

今日要闻&#xff1a;美团以20.65亿人民币收购光年之外&#xff1b;世卫&#xff1a;可乐中甜味剂或致癌&#xff1b;AI公司融13亿美元&#xff0c;仅次于OpenAI&#xff1b;微信支付就校园支付费率过高致歉&#xff1b;B站回应成立交易生态中心 美团以20.65亿人民币收购光年之…

C# Excel 表列序号

171 Excel 表列序号 给你一个字符串 columnTitle &#xff0c;表示 Excel 表格中的列名称。返回 该列名称对应的列序号 。 例如&#xff1a; A -> 1 B -> 2 C -> 3 … Z -> 26 AA -> 27 AB -> 28 … 示例 1: 输入: columnTitle “A” 输出: 1 示例 2: …

11-Vue的diff算法

参考回答&#xff1a;​​​​​​​ 当组件创建和更新时&#xff0c;vue均会执行内部的update函数&#xff0c;该函数使用render函数生成的虚拟dom树&#xff0c;将新旧两树进行对比&#xff0c;找到差异点&#xff0c;最终更新到真实dom对比差异的过程叫diff&#xff0c;vue在…

《移动互联网技术》第五章 界面开发: 掌握Activity的基本概念,Activity的堆栈管理和生命周期

&#x1f337;&#x1f341; 博主 libin9iOak带您 Go to New World.✨&#x1f341; &#x1f984; 个人主页——libin9iOak的博客&#x1f390; &#x1f433; 《面试题大全》 文章图文并茂&#x1f995;生动形象&#x1f996;简单易学&#xff01;欢迎大家来踩踩~&#x1f33…

chatgpt赋能python:如何升级Python包

如何升级Python包 如果你是一名有着10年Python编程经验的工程师&#xff0c;那么你一定知道如何安装和使用Python包。但是&#xff0c;有时候你需要升级一些已经安装的包&#xff0c;以获得更好的性能和新功能。在本文中&#xff0c;我们将讨论如何升级Python包。 什么是Pyth…

GDI MFC抠图贴图

文章目录 抠图贴图添加消息命中 抠图 请添加图片描述 BOOL CPokemonDlg::OnInitDialog() {CDialogEx::OnInitDialog();// 设置此对话框的图标。 当应用程序主窗口不是对话框时&#xff0c;框架将自动// 执行此操作SetIcon(m_hIcon, TRUE); // 设置大图标SetIcon(m_hIcon,…

Spring Boot 中的 RabbitMQ 是什么,如何使用

Spring Boot 中的 RabbitMQ 是什么&#xff0c;如何使用 简介 RabbitMQ 是一个开源的消息队列系统&#xff0c;它通过 AMQP&#xff08;高级消息队列协议&#xff09;来实现消息的传递。Spring Boot 是目前非常流行的 Java 开发框架&#xff0c;它提供了很多便利性的功能&…

VS Code C++迎来套件更新,注释定义方便快捷

近日微软对VS Code C进行套件的更新&#xff0c;新加入名为“Call Hierarchy”的功能&#xff0c;而这个**ERP**功能可以让用户更加直观地理解代码函数之间的引用关系&#xff0c;同时该版本还让开发者更容易复制注释与定义&#xff0c;提升此类内容编写时的自由度。 据悉&am…