GMap.net 涉及标绘源码

article/2025/11/11 7:16:17
  • 下载地址

 下载地址https://download.csdn.net/download/qq_17371831/48961706icon-default.png?t=LA92https://download.csdn.net/download/qq_17371831/48961706

  •  其他类源码
public class PointLatLngComparer : IEqualityComparer<PointLatLng>{public bool Equals(PointLatLng x, PointLatLng y){return x.Lat == y.Lat && x.Lng == y.Lng;}public int GetHashCode(PointLatLng obj){return string.Format("{0},{1}", obj.Lng, obj.Lat).GetHashCode();}}

 

public class GeometryUtil{private const double EARTH_RADIUS = 6378.137;//地球半径/// <summary>/// 获取多边形几何中心点/// </summary>/// <param name="mapPolygon"></param>/// <returns></returns>public static PointLatLng GetCenterPoint(GMapPolygon mapPolygon){if (mapPolygon == null){return new PointLatLng();}List<GeoAPI.Geometries.Coordinate> coordinates = new List<GeoAPI.Geometries.Coordinate>();foreach (var value in mapPolygon.Points){GeoAPI.Geometries.Coordinate coordinate = new GeoAPI.Geometries.Coordinate(value.Lng, value.Lat);coordinates.Add(coordinate);}if (mapPolygon.Points.Count == 2){NetTopologySuite.Geometries.LineString lineString = new NetTopologySuite.Geometries.LineString(coordinates.ToArray());IPoint point = lineString.Centroid;return new PointLatLng(point.Y, point.X);}else{if (mapPolygon.Points[0].Lng != mapPolygon.Points[mapPolygon.Points.Count - 1].Lng ||mapPolygon.Points[0].Lat != mapPolygon.Points[mapPolygon.Points.Count - 1].Lat){coordinates.Add(new GeoAPI.Geometries.Coordinate(mapPolygon.Points[0].Lng, mapPolygon.Points[0].Lat));}NetTopologySuite.Geometries.LinearRing linearRing = new NetTopologySuite.Geometries.LinearRing(coordinates.ToArray());NetTopologySuite.Geometries.Polygon polygon = new NetTopologySuite.Geometries.Polygon(linearRing);IPoint point = polygon.Centroid;return new PointLatLng(point.Y, point.X);}}public static List<Coordinate> WGS84ToWebMercator(List<PointLatLng> pointLatLngs){if (pointLatLngs == null)return null;IList<Coordinate> coors = PointsToCoords(pointLatLngs);NetTopologySuite.Geometries.PrecisionModel precisionModel = new NetTopologySuite.Geometries.PrecisionModel(GeoAPI.Geometries.PrecisionModels.Floating);GeoAPI.CoordinateSystems.ICoordinateSystem wgs84 = ProjNet.CoordinateSystems.GeographicCoordinateSystem.WGS84;GeoAPI.CoordinateSystems.ICoordinateSystem webMercator = ProjNet.CoordinateSystems.ProjectedCoordinateSystem.WebMercator;int SRID_wgs84 = Convert.ToInt32(wgs84.AuthorityCode);    //WGS84 SRIDint SRID_webMercator = Convert.ToInt32(webMercator.AuthorityCode);    //WebMercator SRIDProjNet.CoordinateSystems.Transformations.CoordinateTransformationFactory ctFact = new ProjNet.CoordinateSystems.Transformations.CoordinateTransformationFactory();GeoAPI.CoordinateSystems.Transformations.ICoordinateTransformation transformation = ctFact.CreateFromCoordinateSystems(wgs84, webMercator);NetTopologySuite.Geometries.GeometryFactory factory_wgs84 = new NetTopologySuite.Geometries.GeometryFactory(precisionModel, SRID_wgs84);IList<Coordinate> coords = transformation.MathTransform.TransformList(coors);//var gcgs2000 = CreateCoordinateSystemFromWkt("GEOGCS[\"China Geodetic Coordinate System 2000\",DATUM[\"China_2000\",SPHEROID[\"CGCS2000\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"1024\"]],AUTHORITY[\"EPSG\",\"1043\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4490\"]]");//var gcgs4508 = CreateCoordinateSystemFromWkt("PROJCS[\"CGCS2000 / Gauss-Kruger CM 111E\",GEOGCS[\"China Geodetic Coordinate System 2000\",DATUM[\"China_2000\",SPHEROID[\"CGCS2000\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"1024\"]],AUTHORITY[\"EPSG\",\"1043\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4490\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",111],PARAMETER[\"scale_factor\",1],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",0],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AUTHORITY[\"EPSG\",\"4508\"]]");//IList<Coordinate> temps = ConvertCoordinates(coors.ToList(), gcgs2000,gcgs4508);//IList<Coordinate> temps1= ConvertCoordinates(temps.ToList(), gcgs4508,gcgs2000);return coords.ToList();}public static List<PointLatLng> WGS84ToWebMercator2(List<PointLatLng> pointLatLngs){List<Coordinate> temps = WGS84ToWebMercator(pointLatLngs);List<PointLatLng> points = CoordsToPoints(temps);return points;}public static List<PointLatLng> WebMercatorToWGS84(List<PointLatLng> pointLatLngs){return ConvertCoordinates(pointLatLngs, ProjNet.CoordinateSystems.ProjectedCoordinateSystem.WebMercator, ProjNet.CoordinateSystems.GeographicCoordinateSystem.WGS84);}public static List<PointLatLng> CoordsToPoints(List<Coordinate> coords){List<PointLatLng> points = new List<PointLatLng>();foreach (var entity in coords){points.Add(new PointLatLng(entity.Y, entity.X));}return points;}public static List<Coordinate> PointsToCoords(List<PointLatLng> points){List<Coordinate> coords = new List<Coordinate>();foreach(var entity in points){coords.Add(new Coordinate(entity.Lng, entity.Lat));}return coords;}/// <summary>/// 默认创建EPSG:4490 国家2000大地坐标系/// </summary>/// <param name="wkt"></param>/// <returns></returns>public static GeoAPI.CoordinateSystems.ICoordinateSystem CreateCoordinateSystemFromWkt(string wkt){if (string.IsNullOrEmpty(wkt))wkt = "GEOGCS[\"China Geodetic Coordinate System 2000\",DATUM[\"China_2000\",SPHEROID[\"CGCS2000\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"1024\"]],AUTHORITY[\"EPSG\",\"1043\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4490\"]]";try{ICoordinateSystemFactory coordinateSystemFactory = new ProjNet.CoordinateSystems.CoordinateSystemFactory();GeoAPI.CoordinateSystems.ICoordinateSystem coordinateSystem = coordinateSystemFactory.CreateFromWkt(wkt);return coordinateSystem;}catch{return null;}}public static List<Coordinate> ConvertCoordinates(List<Coordinate> coordinates, ICoordinateSystem sourceCoordinateSystem, ICoordinateSystem targetCoordinateSystem){if (coordinates == null || sourceCoordinateSystem == null || targetCoordinateSystem==null)throw new Exception("请输入正确的参数");NetTopologySuite.Geometries.PrecisionModel precisionModel = new NetTopologySuite.Geometries.PrecisionModel(GeoAPI.Geometries.PrecisionModels.Floating);int SRID_source = Convert.ToInt32(sourceCoordinateSystem.AuthorityCode);    //source SRIDint SRID_target = Convert.ToInt32(targetCoordinateSystem.AuthorityCode);    //target SRIDProjNet.CoordinateSystems.Transformations.CoordinateTransformationFactory transformationFactory = new ProjNet.CoordinateSystems.Transformations.CoordinateTransformationFactory();GeoAPI.CoordinateSystems.Transformations.ICoordinateTransformation transformation = transformationFactory.CreateFromCoordinateSystems(sourceCoordinateSystem, targetCoordinateSystem);//NetTopologySuite.Geometries.GeometryFactory factory_source = new NetTopologySuite.Geometries.GeometryFactory(precisionModel, SRID_source);IList<Coordinate> coords = transformation.MathTransform.TransformList(coordinates);return coords.ToList();}public static List<PointLatLng> ConvertCoordinates(List<PointLatLng> coordinates, ICoordinateSystem sourceCoordinateSystem, ICoordinateSystem targetCoordinateSystem){List<Coordinate> tempCoordinates = new List<Coordinate>();foreach(var entity in coordinates){tempCoordinates.Add(new Coordinate(x: entity.Lng, y: entity.Lat));}if (coordinates == null || sourceCoordinateSystem == null || targetCoordinateSystem == null)throw new Exception("请输入正确的参数");NetTopologySuite.Geometries.PrecisionModel precisionModel = new NetTopologySuite.Geometries.PrecisionModel(GeoAPI.Geometries.PrecisionModels.Floating);int SRID_source = Convert.ToInt32(sourceCoordinateSystem.AuthorityCode);    //source SRIDint SRID_target = Convert.ToInt32(targetCoordinateSystem.AuthorityCode);    //target SRIDProjNet.CoordinateSystems.Transformations.CoordinateTransformationFactory transformationFactory = new ProjNet.CoordinateSystems.Transformations.CoordinateTransformationFactory();GeoAPI.CoordinateSystems.Transformations.ICoordinateTransformation transformation = transformationFactory.CreateFromCoordinateSystems(sourceCoordinateSystem, targetCoordinateSystem);//NetTopologySuite.Geometries.GeometryFactory factory_source = new NetTopologySuite.Geometries.GeometryFactory(precisionModel, SRID_source);IList<Coordinate> coords = transformation.MathTransform.TransformList(tempCoordinates);List<PointLatLng> points = new List<PointLatLng>();foreach(var entity in coords){if (double.IsNaN(entity.X) || double.IsNaN(entity.Y))continue;points.Add(new PointLatLng(entity.Y, entity.X));}return points;}public static double GetArea(List<PointLatLng> pointLatLngs){if (pointLatLngs == null){return 0;}if (pointLatLngs.Count <= 2){return 0;}List<GeoAPI.Geometries.Coordinate> coordinates = WGS84ToWebMercator(pointLatLngs);if (coordinates[0].X != coordinates[coordinates.Count - 1].X ||coordinates[0].Y != coordinates[coordinates.Count - 1].Y){coordinates.Add(new GeoAPI.Geometries.Coordinate(coordinates[0].X, coordinates[0].Y));}NetTopologySuite.Geometries.LinearRing linearRing = new NetTopologySuite.Geometries.LinearRing(coordinates.ToArray());NetTopologySuite.Geometries.Polygon polygon = new NetTopologySuite.Geometries.Polygon(linearRing);IPoint point = polygon.Centroid;return polygon.Area;}public static double GetArea(GMapPolygon mapPolygon){if (mapPolygon == null){return 0;}return GetArea(mapPolygon.Points);}public static RectLatLng GetRegionMaxRect(GMapPolygon polygon){double latMin = 90;double latMax = -90;double lngMin = 180;double lngMax = -180;foreach (var point in polygon.Points){if (point.Lat < latMin){latMin = point.Lat;}if (point.Lat > latMax){latMax = point.Lat;}if (point.Lng < lngMin){lngMin = point.Lng;}if (point.Lng > lngMax){lngMax = point.Lng;}}return new RectLatLng(latMax, lngMin, lngMax - lngMin, latMax - latMin);}public static double GetDistance(double lat1, double lng1, double lat2, double lng2){PointLatLng first = new PointLatLng(lat2,lng1);PointLatLng second = new PointLatLng(lat2,lng2);List<PointLatLng> pointLatLngs = new List<PointLatLng>();pointLatLngs.Add(first);pointLatLngs.Add(second);var coordinates= WGS84ToWebMercator(pointLatLngs);NetTopologySuite.Geometries.LineString lineString = new NetTopologySuite.Geometries.LineString(coordinates.ToArray());return lineString.Length;}public static double GetDistance2(double lat1, double lng1, double lat2, double lng2){double radLat1 = DegreesToRadians(lat1);double radLat2 = DegreesToRadians(lat2);double a = radLat1 - radLat2;double b = DegreesToRadians(lng1) - DegreesToRadians(lng2);double s = 2 * Math.Asin(Math.Sqrt(Math.Pow(Math.Sin(a / 2), 2) +Math.Cos(radLat1) * Math.Cos(radLat2) * Math.Pow(Math.Sin(b / 2), 2)));s = s * EARTH_RADIUS;s = Math.Round(s * 10000) / 10000;return s;}/// <summary>/// 求B点经纬度/// </summary>/// <param name="A">已知点的经纬度</param>/// <param name="distance">AB两地的距离  单位km</param>/// <param name="angle">AB连线与正北方向的夹角(0~360)</param>/// <returns>B点的经纬度</returns>public static CustomLatLng GetCustomLatLng(CustomLatLng A, double distance, double angle){double dx = distance * 1000 * Math.Sin(DegreesToRadians(angle));double dy = distance * 1000 * Math.Cos(DegreesToRadians(angle));double bjd = (dx / A.Ed + A.m_RadLo) * 180 / Math.PI;double bwd = (dy / A.Ec + A.m_RadLa) * 180 / Math.PI;return new CustomLatLng(bjd, bwd);}//度 转换成 弧度public static double DegreesToRadians(double degrees){const double degToRadFactor = Math.PI / 180;return degrees * degToRadFactor;}/// <summary>/// 弧度 转换成 度/// </summary>/// <param name="radians"></param>/// <returns></returns>public static double RadiansToDegrees(double radians){const double radToDegFactor = 180 / Math.PI;return radians * radToDegFactor;}/// <summary>/// 描述:以centerP为圆心,绘制半径为radius的圆/// </summary>/// <param name="gMapControl">overlay:图层</param>/// <param name="overlay">图层</param>/// <param name="centerP">圆心点</param>/// <param name="radius">圆半径(单位: km)</param>/// <param name="name">多边形id</param>public static GMapPolygon DrawEllipse(GMapControl gMapControl, GMapOverlay overlay, PointLatLng centerP, int radius, string name){try{if (radius <= 0)return null;List<PointLatLng> latLngs = new List<PointLatLng>();CustomLatLng centerLatLng = new CustomLatLng(centerP.Lng, centerP.Lat);// 0 - 360度 寻找半径为radius,圆心为centerP的圆上点的经纬度for (int i = 0; i < 360; i++){//获取目标经纬度CustomLatLng tempLatLng = GetCustomLatLng(centerLatLng, radius, i);//将自定义的经纬度类 转换成 标准经纬度类PointLatLng p = new PointLatLng(tempLatLng.m_Latitude, tempLatLng.m_Longitude);latLngs.Add(p);}//安全性检查if (latLngs.Count < 20){return null;}//通过绘制多边形的方式绘制圆GMapPolygon gpol = new GMapPolygon(latLngs, name);gpol.Stroke = new Pen(Color.Red, 1.0f);gpol.Fill = new SolidBrush(Color.FromArgb(20, Color.Red));gpol.IsHitTestVisible = true;overlay.Polygons.Add(gpol);return gpol;}catch (Exception ex){return null;}}}//自定义经纬度类public class CustomLatLng{public double Rc = 6378137;     //赤道半径public double Rj = 6356725;     //极半径public double m_LoDeg, m_LoMin, m_LoSec;public double m_LaDeg, m_LaMin, m_LaSec;public double m_Longitude, m_Latitude;public double m_RadLo, m_RadLa;public double Ec;public double Ed;public CustomLatLng(double longitude, double latitude){m_LoDeg = (int)longitude;m_LoMin = (int)((longitude - m_LoDeg) * 60);m_LoSec = (longitude - m_LoDeg - m_LoMin / 60) * 3600;m_LaDeg = (int)latitude;m_LaMin = (int)((latitude - m_LaDeg) * 60);m_LaSec = (latitude - m_LaDeg - m_LaMin / 60) * 3600;m_Longitude = longitude;m_Latitude = latitude;m_RadLo = longitude * Math.PI / 180;m_RadLa = latitude * Math.PI / 180;Ec = Rj + (Rc - Rj) * (90 - m_Latitude) / 90;Ed = Ec * Math.Cos(m_RadLa);}}

 


http://chatgpt.dhexx.cn/article/1VOWR5vj.shtml

相关文章

c#导入地图(一)--地图Gmap的使用

目录 导入地图&#xff08;联网的话可不进行此步骤&#xff09;下载GMap及离线地图 开始开发新建winform工程添加程序包导入地图鼠标移动获取经纬度在地图上添加标记在地图上添加连线在地图上添加多边形在地图上添加图片在地图上清除图层 导入地图&#xff08;联网的话可不进行…

WPF使用GMap.net框架开发地图应用

GMap.NET有两个版本&#xff0c;分别是WinForm和WPF的版本&#xff0c;WinForm版本的教程很多。这次主要介绍的WPF版本的操作。 要下载GMap.NET请点击这里&#xff0c;这个最好下载下来&#xff0c;可以参考里面的Demo来学习。下载下来后&#xff0c;用visual studio打开Sourc…

模块测试(一)----c#控制html中的数据(GMap)

项目地址: https://github.com/SCFMVP/final_01 一. 配置GMap 我们先去官网下载GMap的工程文件: https://archive.codeplex.com/?pgreatmaps 然后我们我们编译GMap.NET.WindowsForms工程, 生成GMap.NET.Core.dll和GMap.NET.WindowsForms.dll 然后添加到我们的工程中.(PS: 这…

C# WinForm开发 GMap离线地图

一、概述 GMap.NET是一个强大、免费、跨平台、开源的.NET控件&#xff0c;它在Windows Forms和WPF环境中能够通过Google, Yahoo!, Bing, OpenStreetMap, ArcGIS, Pergo, SigPac等实现路径规划、地理编码以及地图展示功能&#xff0c;并支持缓存和运行在Mobile环境中。 二、步…

GoFrame的gmap相比Go原生的map,天然支持排序和有序遍历!?

大家好&#xff0c;我是阳哥。内容比较硬核&#xff0c;建议先收藏再观看。 我也在B站发布了这期内容的视频版&#xff0c;视频相比文章看起来确实更通俗易懂。 如果你是初学者建议先看视频&#xff1a;欢迎大家点击这个链接观看。 觉得不错&#xff0c;欢迎关注、三连一波。谢…

Gmap安装使用

最近使用c#做了一个地面站&#xff0c;需要用到地面站&#xff0c;在论文里看到好多人都是用的Gmap&#xff0c;所以今天写个博客&#xff0c;记录一下自己遇到的问题。 1.下载 下载地址&#xff1a;https://archive.codeplex.com/?pgreatmaps 2.编译 大家都看到&#xff…

WPF GMap使用高德地图

文章目录 前言一、Nuget下载Gmap二、代码1.添加类2.加载高德地图 总结 前言 近日在项目中用到了GMap&#xff0c;并且Gmap中使用了高德地图&#xff0c;特此记录一下。 一、Nuget下载Gmap 在Nuget中搜索GMap&#xff0c;选择GMap.NET.Presentatiom进行下载安装。&#xff08;…

GMap.NET使用教程

原文地址&#xff1a;GMap.NET使用教程 GMap.NET是一个强大、免费、跨平台、开源的.NET控件&#xff0c;它在Windows Forms和WPF环境中能够通过Google, Yahoo!, Bing, OpenStreetMap, ArcGIS, Pergo, SigPac等实现路径规划、地理编码以及地图展示功能&#xff0c;并支持缓存和运…

基于GMap.NET库实现的Windows桌面地图工具软件分享

0 前言 由于工作中经常和地图、GPS坐标转换、GPS轨迹查看等内容相关&#xff0c;经常要借助一些在线网站和工具来查看地图和位置等&#xff0c;在一次偶然的机会中了解到一个GMap.NET开源的桌面地图库和基于GMap.NET实现的MapDownloader地图下载工具&#xff0c;于是也想实现一…

GMap.NET入门详细教程【4】--------为控件添加事件,在鼠标单击时打点

GMap.NET入门 下载 GMap.NET&#xff0c;并在VS中添加GMap.NET控件初始化并加载一张地图添加标记点、线、多边形为控件添加事件&#xff0c;在鼠标单击时打点 快捷添加 选中窗体中的GMap控件&#xff0c;并查看内置事件 在这里&#xff0c;通过使用MouseDown和DoubleClick事…

GMap.net控件学习记录

主要参考网址 http://www.cnblogs.com/luxiaoxun/p/3802559.html http://www.cnblogs.com/luxiaoxun/p/3463250.html http://blog.csdn.net/onepiecehuiyu/article/details/19159565 GMap官方网址 http://greatmaps.codeplex.com/ WGS84&#xff0c;GCJ02&#xff0c;BD09坐标转…

Gmap使用说明,通过输入经纬度查询位置

由于本人对于Gmap的使用时间不长&#xff0c;有很多东西不是太熟悉&#xff0c;所以本人的代码有借鉴的部分&#xff0c;如有发现侵权&#xff0c;还请及时联系本人。 我目前已经基本实现了&#xff0c;地图的放大、缩小、平移的功能。完成了鼠标单击标点&#xff0c;输入经纬度…

GMap.net 自定义Marker

说明 自定义Marker部分内容来源于互联网&#xff0c;具体来源不记得了&#xff0c;若有人发现此处没注明出处&#xff0c;请海涵&#xff01; nuget包 GMapMarkerArrow using GMap.NET.WindowsForms; using System; using System.Collections.Generic; using System.Linq; usin…

C#基于开源地图GMap的开发示例

一.介绍 本示例程序是我在做项目前的探索示例。示例中测试了一些简单的功能&#xff0c;满足了我项目中的基本功能。更进一步的开发&#xff0c;有待继续研究。 二.项目源代码地址 源代码下载地址 三.项目讲解 1.引用GMap的dll文件 利用GMap开发&#xff0c;需要用到两个…

GMAP一款比对工具用于ALLHiC构建等位基因表

在ALLHiC使用过程中需要构建Allele.ctg.table&#xff0c;用于过滤多倍体基因组中因等位序列相似引起的HiC噪音的必要输入。官网提供了两种办法&#xff0c;一种是blastn&#xff0c;需要对草图基因组进行注释&#xff0c;这个过程挺麻烦的&#xff0c;在最下边看到了也可以使用…

Gmap使用心得分享C#-winform-Gmap

目录 一、Gmap库引用 1.下载Gmap引用库 2.Visual Studio添加项目引用 &#xff08;1&#xff09;打开项目后点击项目后添加引用 ​ &#xff08;2&#xff09;浏览本地库 &#xff08;3&#xff09;添加引用即可 二、Gmap使用流程 1.添加GmapControl 2.图…

基于GMap.Net的地图解决方案

一 地图的加载与显示 关于GMap的介绍与使用可以看我以前的文章: GMap.Net开发之在WinForm和WPF中使用GMap.Net地图插件 GMap.Net是.Net下一个地图控件,可以基于Http协议加载各个公司的地图,如Google,Bing,ArcGIS的,主要原理是通过解析各个公司的地图服务的URL,传入相应的…

Jersey框架常用注解3:媒体类型注解@Consumes和@Produces

Consumes 指定http请求的MIME类型&#xff0c;默认是*/*&#xff0c;表示任意的MIME类型。该注解的值是数组类型&#xff0c;支持多个MIME类型&#xff0c;可以使用MediaType来指定MIME类型。 Produces 指定http响应的MIME类型&#xff0c;默认是*/*&#xff0c;表示任意的M…

12.@RequestMapping中的consumes属性和produces属性

请求头header中很重要的两个参数:Accept:text/html只在响应中存在,表示当前请求希望服务器将来返回的数据类型是text/htmlContent-Type:application/json既可以出现在请求中,也可以出现在响应中,例如响应中代表服务器响应的是什么数据类型响应中response.setContentType("…

springmvc @RequestMapping注解中produces以及consumes属性的含义

http协议基础知识 首先需要了解什么叫MediaType&#xff08;媒体类型&#xff09;&#xff1f; 通俗来说&#xff0c;在http协议中&#xff0c;用来表示传输内容的格式就是MediaType&#xff0c;比如text/html&#xff0c;application/json等&#xff0c;其中text代表介质&am…