UNPKG

@mapgis/webclient-leaflet-plugin

Version:

1,530 lines 98 kB

<!DOCTYPE html>
<html lang="en">

<head>
  
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title> common/sketchEditor/base/SketchSnappingTool.js</title>
  <!--[if lt IE 9]>
    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  <![endif]-->
  <link type="text/css" rel="stylesheet" href="styles/app.min.css">
  <link type="text/css" rel="stylesheet" href="styles/iframe.css">
  <link type="text/css" rel="stylesheet" href="">

  
</head>



<body class="layout small-header">
    <div id="stickyNavbarOverlay"></div>
    

<div class="top-nav">
    <div class="inner">
        <a id="hamburger" role="button" class="navbar-burger" aria-label="menu" aria-expanded="false">
            <span aria-hidden="true"></span>
            <span aria-hidden="true"></span>
            <span aria-hidden="true"></span>
        </a>
        <div class="logo">
            
                <h1> MapGIS Client for JavaScript API</h1>
            
            
        </div>
        <div class="menu">
            
            <div class="navigation">
                
                    
                        <a
                            class="link user-link "
                            href="/docs/cesium/index.html"
                        >
                            Cesium
                        </a>
                    
                        <a
                            class="link user-link "
                            href="/docs/mapboxgl/index.html"
                        >
                            MapboxGL
                        </a>
                    
                        <a
                            class="link user-link "
                            href="/docs/leaflet/index.html"
                        >
                            Leaflet
                        </a>
                    
                        <a
                            class="link user-link "
                            href="/docs/openlayers/index.html"
                        >
                            OpenLayers
                        </a>
                    
                

            </div>
        </div>
    </div>
</div>

    <div id="main">
        <div
            class="sidebar "
            id="sidebarNav"
        >
            <div>
                <span class="mapgis-api-document-span"><a href="index.html">API文档</a></span>
            </div>
            
                <div class="search-wrapper">
                    <input id="search" type="text" placeholder="搜索文档..." class="input">
                </div>
            
            <nav>
                
                    <div class="category"><div style="font-weight: bold;vertical-align: middle;padding: 0.4rem 0;" class="mapgis-menu-span"><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/m.png" alt="">服务模块</div><ul class="mapgis-sidebar-menus"><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="AddressServer.html">AddressServer</a><span style="display: none;"><p>地址服务,基地址:/igs/rest/services/{folder}/{serviceName}/AddressServer</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="ArcGISFeatureServer.html">ArcGISFeatureServer</a><span style="display: none;"><p>ArcGIS的FeatureServer服务</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="ArcGISGeometryServer.html">ArcGISGeometryServer</a><span style="display: none;"><p>ArcGIS的GeometryServer服务</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="ArcGISMapServer.html">ArcGISMapServer</a><span style="display: none;"><p>ArcGIS的MapServer服务</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="ArcGISVectorTileServer.html">ArcGISVectorTileServer</a><span style="display: none;"><p>ArcGIS的VectorTileServer服务</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="BaseServer.html">BaseServer</a><span style="display: none;"><p>服务查询基类</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="Cesium3DTilesServer.html">Cesium3DTilesServer</a><span style="display: none;"><p>3DTiles服务,基地址:/igs/rest/services/{folder}/{serviceName}/3DTilesServer</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="Config.html">Config</a><span style="display: none;"><p>全局配置信息<br/>
示例如下:<br/>
<a href='#config1'>[1、设置全局token]</a><br/>
<a href='#config2'>[2、设置全局headers]</a><br/>
<a href='#config3'>[3、设置拦截器 - 在所有链接上设置拦截器]</a><br/>
<a href='#config4'>[4、设置拦截器 - 指定拦截器应用的url]</a><br/></p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="FeatureServer.html">FeatureServer</a><span style="display: none;"><p>要素服务</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="GeometryServer.html">GeometryServer</a><span style="display: none;"><p>地理几何服务</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="ImageServer.html">ImageServer</a><span style="display: none;"><p>影像服务,服务地址:/igs/rest/services/{folder}/{serviceName}/ImageServer</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="Interceptor.html">Interceptor</a><span style="display: none;"><p>请求拦截和相应拦截器参数</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="M3DServer.html">M3DServer</a><span style="display: none;"><p>M3d服务,服务地址:/igs/rest/services/{folder}/{serviceName}/M3dServer</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="MapServer.html">MapServer</a><span style="display: none;"><p>地图服务</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="PlotServer.html">PlotServer</a><span style="display: none;"><p>标绘服务</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="PoiServer.html">PoiServer</a><span style="display: none;"><p>兴趣点服务,服务地址:/igs/rest/services/{folder}/{serviceName}/PoiServer</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="RequestConfig.html">RequestConfig</a><span style="display: none;"><p>请求配置参数</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="RequestInterceptor.html">RequestInterceptor</a><span style="display: none;"><p>请求拦截器对象</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="ResourceServer.html">ResourceServer</a><span style="display: none;"><p>资源服务,基地址为http://{ip}:{port}/igs/rest/services/system/ResourceServer</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="ResponseInterceptor.html">ResponseInterceptor</a><span style="display: none;"><p>响应拦截器对象</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="RootServer.html">RootServer</a><span style="display: none;"><p>根目录服务</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="SceneServer.html">SceneServer</a><span style="display: none;"><p>场景服务</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="SecurityServer.html">SecurityServer</a><span style="display: none;"><p>安全服务,服务地址:/igs/rest/services/SecurityServer</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="TerrainServer.html">TerrainServer</a><span style="display: none;"><p>地形缓存服务,基地址:/igs/rest/services/{folder}/{serviceName}/TerrainServer</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="ThemeServer.html">ThemeServer</a><span style="display: none;"><p>专题图服务</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="TileServer.html">TileServer</a><span style="display: none;"><p>瓦片服务,基地址:/igs/rest/services/{folder}/{serviceName}/TileServer</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="VectorTileServer.html">VectorTileServer</a><span style="display: none;"><p>矢量瓦片服务</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="WFSServer.html">WFSServer</a><span style="display: none;"><p>IGS的WFS服务</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="WMSServer.html">WMSServer</a><span style="display: none;"><p>IGS的WMS服务</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="WMTSServer.html">WMTSServer</a><span style="display: none;"><p>IGS的WMTS服务</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="WorkFlowServer.html">WorkFlowServer</a><span style="display: none;"><p>工作流服务,基地址http://{ip}:{port}/igs/rest/services/workflow/{serviceName}/WorkflowServer</p></span></li></ul><div style="font-weight: bold;vertical-align: middle;padding: 0.4rem 0;" class="mapgis-menu-span"><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/m.png" alt="">图层模块</div><ul class="mapgis-sidebar-menus"><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="ArcGISMapImageLayer.html">ArcGISMapImageLayer</a><span style="display: none;"><p>ArcGIS地图图片图层,<br/>
目前二维上支持4326(包括4490,4214以及4610),3857以及EPSG支持的自定义坐标系,三维上仅支持4326(包括4490,4214以及4610)以及3857坐标系,会自动读取元信息上的坐标系,不需要用户指定
<br><br>[ES5引入方式]:<br/>
Zondy.Layer.ArcGISMapImageLayer() <br/>
[ES6引入方式]:<br/>
import { ArcGISMapImageLayer } from &quot;@mapgis/webclient-common&quot; <br/>
<br/>
针对图层的操作请在图层加载完毕事件中进行<br/>
Layer.on('layerview-created', function (result) {<br/>
console.log(&quot;加载完毕:&quot;, result.layer)<br/>
});<br/>
如果不想在该事件中放入业务代码,则请确认图层资源已加载完毕后再进行操作<br/>
if(layer.loadStatus === 'loaded') {<br/>
// 你的业务逻辑<br/>
}</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="ArcGISMapImageSubLayer.html">ArcGISMapImageSubLayer</a><span style="display: none;"><p>ArcGIS地图图片子图层</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="ArcGISTileLayer.html">ArcGISTileLayer</a><span style="display: none;"><p>ArcGIS瓦片图层,<br>
目前二维上支持4326(包括4490,4214以及4610),3857以及EPSG支持的自定义坐标系,三维上仅支持4326(包括4490,4214以及4610)以及3857坐标系,会自动读取元信息上的坐标系,不需要用户指定,
<br><br>[ES5引入方式]:<br/>
Zondy.Layer.ArcGISTileLayer() <br/>
[ES6引入方式]:<br/>
import { ArcGISTileLayer } from &quot;@mapgis/webclient-common&quot; <br/>
<br/>
针对图层的操作请在图层加载完毕事件中进行<br/>
Layer.on('layerview-created', function (result) {<br/>
console.log(&quot;加载完毕:&quot;, result.layer)<br/>
});<br/>
如果不想在该事件中放入业务代码,则请确认图层资源已加载完毕后再进行操作<br/>
if(layer.loadStatus === 'loaded') {<br/>
// 你的业务逻辑<br/>
}</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="ArcGISVectorTileLayer.html">ArcGISVectorTileLayer</a><span style="display: none;"><p>ArcGIS矢量瓦片图层
支持通过加载矢量瓦片服务、加载矢量瓦片样式文件和设置矢量瓦片样式的方式创建矢量瓦片图层
<br><br>[ES5引入方式]:<br/>
Zondy.Layer.ArcGISVectorTileLayer() <br/>
[ES6引入方式]:<br/>
import { ArcGISVectorTileLayer } from &quot;@mapgis/webclient-common&quot; <br/>
<br/>
针对图层的操作请在图层加载完毕事件中进行<br/>
Layer.on('layerview-created', function (result) {<br/>
console.log(&quot;加载完毕:&quot;, result.layer)<br/>
});<br/>
如果不想在该事件中放入业务代码,则请确认图层资源以加载完毕后再进行操作<br/>
if(layer.loadStatus === 'loaded') {<br/>
// 你的业务逻辑<br/>
}
<br/></p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="ArcGISVectorTileSubLayer.html">ArcGISVectorTileSubLayer</a><span style="display: none;"><p>ArcGIS矢量瓦片子图层</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="Cesium3DTilesCacheLayer.html">Cesium3DTilesCacheLayer</a><span style="display: none;"><p>Cesium3DTiles图层</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="EchartsLayer.html">EchartsLayer</a><span style="display: none;"><p>Echarts图层</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="FeatureLayer.html">FeatureLayer</a><span style="display: none;"><p>要素图层基类</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="GeoJSONLayer.html">GeoJSONLayer</a><span style="display: none;"><p>geojson图层,仅支持文件服务<br/>
目前二维和三维上支持4326(包括4490,4214以及4610),3857以及EPSG支持的自定义坐标系,若是想要绘制源数据为非4326坐标系几何数据,需要在初始化时指定具体坐标系<br/>
参考示例:<br/>
<a href='#add-GeoJSONLayer'>[加载GeoJSON图层]</a>
<br><br>[ES5引入方式]:<br/>
Zondy.Layer.GraphicsLayer() <br/>
[ES6引入方式]:<br/>
import { GraphicsLayer } from &quot;@mapgis/webclient-common&quot;</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="GraphicsLayer.html">GraphicsLayer</a><span style="display: none;"><p>几何图形图层,不支持在线数据,仅支持传入多个几何对象并绘制<br/>
目前二维和三维上支持4326(包括4490,4214以及4610),3857以及EPSG支持的自定义坐标系,若是想要绘制非4326坐标系几何,需要在初始化要素对象的几何时,指定具体坐标系
<br><br>[ES5引入方式]:<br/>
Zondy.Layer.GraphicsLayer() <br/>
[ES6引入方式]:<br/>
import { GraphicsLayer } from &quot;@mapgis/webclient-common&quot; <br/>
<br/>
针对图层的操作请在图层加载完毕事件中进行<br/>
Layer.on('layerview-created', function (result) {<br/>
console.log(&quot;加载完毕:&quot;, result.layer)<br/>
});<br/>
如果不想在该事件中放入业务代码,则请确认图层资源已加载完毕后再进行操作<br/>
if(layer.loadStatus === 'loaded') {<br/>
// 你的业务逻辑<br/>
}</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="GroupLayer.html">GroupLayer</a><span style="display: none;"><p>组图层,支持的图层类型有:WMS图层、WMTS图层、地图图层、瓦片图层、cesium3DTiles图层、echarts图层、
M3D图层、场景图层、矢量瓦片图层、mapv图层、地形图层
<br><br>[ES5引入方式]:<br/>
Zondy.Layer.GroupLayer() <br/>
[ES6引入方式]:<br/>
import { GroupLayer } from &quot;@mapgis/webclient-common&quot; <br/>
<br/></p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="IGSFeatureLayer.html">IGSFeatureLayer</a><span style="display: none;"><p>IGS要素图层,<br>
目前二维和三维上支持4326(包括4490,4214以及4610),3857以及EPSG支持的自定义坐标系,要素服务会自动读取元信息上的坐标系,不需要用户指定
<br><br>[ES5引入方式]:<br/>
Zondy.Layer.IGSFeatureLayer() <br/>
[ES6引入方式]:<br/>
import { IGSFeatureLayer } from &quot;@mapgis/webclient-common&quot; <br/>
<br/>
针对图层的操作请在图层加载完毕事件中进行<br/>
Layer.on('layerview-created', function (result) {<br/>
console.log(&quot;加载完毕:&quot;, result.layer)<br/>
});<br/>
如果不想在该事件中放入业务代码,则请确认图层资源已加载完毕后再进行操作<br/>
if(layer.loadStatus === 'loaded') {<br/>
// 你的业务逻辑<br/>
}</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="IGSImageLayer.html">IGSImageLayer</a><span style="display: none;"><p>IGS影像图层</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="IGSMapImageLayer.html">IGSMapImageLayer</a><span style="display: none;"><p>IGS地图图片图层,<br/>
支持IGS1.0和2.0两个服务版本,支持自定义坐标系,当IGS版本是1.0时,需要手动设置图层坐标系,当IGS版本是2.0时,会自动读取元信息上的坐标系,不需要用户指定<br/>
<br><br>[ES5引入方式]:<br/>
Zondy.Layer.IGSMapImageLayer() <br/>
[ES6引入方式]:<br/>
import { IGSMapImageLayer } from &quot;@mapgis/webclient-common&quot; <br/>
<br/>
针对图层的操作请在图层加载完毕事件中进行<br/>
Layer.on('layerview-created', function (result) {<br/>
console.log(&quot;加载完毕:&quot;, result.layer)<br/>
});<br/>
如果不想在该事件中放入业务代码,则请确认图层资源已加载完毕后再进行操作<br/>
if(layer.loadStatus === 'loaded') {<br/>
// 你的业务逻辑<br/>
}</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="IGSMapImageSubLayer.html">IGSMapImageSubLayer</a><span style="display: none;"><p>IGS地图图片图层的子图层</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="IGSSceneLayer.html">IGSSceneLayer</a><span style="display: none;"><p>IGS的SceneLayer图层</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="IGSSceneSubLayer.html">IGSSceneSubLayer</a><span style="display: none;"><p>IGS的SceneLayer子图层</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="IGSTileLayer.html">IGSTileLayer</a><span style="display: none;"><p>IGS瓦片图层,<br>
支持IGS1.0和2.0两个服务版本,支持自定义坐标系,当IGS版本是1.0时,需要手动设置图层坐标系,当IGS版本是2.0时,会自动读取元信息上的坐标系,不需要用户指定,
<br><br>[ES5引入方式]:<br/>
Zondy.Layer.IGSTileLayer() <br/>
[ES6引入方式]:<br/>
import { IGSTileLayer } from &quot;@mapgis/webclient-common&quot; <br/>
<br/>
针对图层的操作请在图层加载完毕事件中进行<br/>
Layer.on('layerview-created', function (result) {<br/>
console.log(&quot;加载完毕:&quot;, result.layer)<br/>
});<br/>
如果不想在该事件中放入业务代码,则请确认图层资源已加载完毕后再进行操作<br/>
if(layer.loadStatus === 'loaded') {<br/>
// 你的业务逻辑<br/>
}</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="IGSVectorTileLayer.html">IGSVectorTileLayer</a><span style="display: none;"><p>IGS矢量瓦片图层
支持IGS1.0和2.0两个服务版本,目前二维和三维上支持4326(包括4490,4214以及4610),3857,会自动读取元信息上的坐标系,不需要用户指定,
<br><br>[ES5引入方式]:<br/>
Zondy.Layer.IGSVectorTileLayer() <br/>
[ES6引入方式]:<br/>
import { IGSVectorTileLayer } from &quot;@mapgis/webclient-common&quot; <br/>
<br/>
针对图层的操作请在图层加载完毕事件中进行<br/>
Layer.on('layerview-created', function (result) {<br/>
console.log(&quot;加载完毕:&quot;, result.layer)<br/>
});<br/>
如果不想在该事件中放入业务代码,则请确认图层资源以加载完毕后再进行操作<br/>
if(layer.loadStatus === 'loaded') {<br/>
// 你的业务逻辑<br/>
}
<br/>
<br/>
注意:三维上,不支持简单Marker样式设定;二维上,简单Marker的颜色,外边线样式,旋转角度无法在图层初始化和初始化后修改,须在制作数据时进行指定</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="IGSVectorTileSubLayer.html">IGSVectorTileSubLayer</a><span style="display: none;"><p>IGS矢量瓦片子图层</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="Layer.html">Layer</a><span style="display: none;"><p>图层基类</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="M3DModelCacheLayer.html">M3DModelCacheLayer</a><span style="display: none;"><p>M3D缓存图层</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="MapImageLayer.html">MapImageLayer</a><span style="display: none;"><p>影像图层基类</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="MapVLayer.html">MapVLayer</a><span style="display: none;"><p>MapV图层</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="OGCLayer.html">OGCLayer</a><span style="display: none;"><p>OGS图层基类</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="OverlayLayer.html">OverlayLayer</a><span style="display: none;"><p>覆盖物图层</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="Scene.html">Scene</a><span style="display: none;"><p>场景对象</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="SceneLayer.html">SceneLayer</a><span style="display: none;"><p>场景图层基类</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="SubLayer.html">SubLayer</a><span style="display: none;"><p>子图层基类</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="TerrainCacheLayer.html">TerrainCacheLayer</a><span style="display: none;"><p>地形图层</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="TileLayer.html">TileLayer</a><span style="display: none;"><p>瓦片图层基类</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="UnknownLayer.html">UnknownLayer</a><span style="display: none;"><p>未定义图层</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="VectorTileLayer.html">VectorTileLayer</a><span style="display: none;"><p>图层基类</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="WFSLayer.html">WFSLayer</a><span style="display: none;"><p>WFS图层,<br>
目前二维和三维上支持4326(包括4490,4214以及4610),3857以及EPSG支持的自定义坐标系,WFS服务会自动读取元信息上的坐标系,不需要用户指定
<br><br>[ES5引入方式]:<br/>
Zondy.Layer.WMTSLayer() <br/>
[ES6引入方式]:<br/>
import { WMTSLayer } from &quot;@mapgis/webclient-common&quot; <br/>
<br/>
针对图层的操作请在图层加载完毕事件中进行<br/>
Layer.on('layerview-created', function (result) {<br/>
console.log(&quot;加载完毕:&quot;, result.layer)<br/>
});<br/>
如果不想在该事件中放入业务代码,则请确认图层资源已加载完毕后再进行操作<br/>
if(layer.loadStatus === 'loaded') {<br/>
// 你的业务逻辑<br/>
}</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="WMSLayer.html">WMSLayer</a><span style="display: none;"><p>WMS图层,<br/>
目前二维上支持4326(包括4490,4214以及4610),3857以及EPSG支持的自定义坐标系,三维上仅支持4326(包括4490,4214以及4610)以及3857坐标系,会自动读取元信息上的坐标系,不需要用户指定,同时所有的WMS服务都支持动态投影,用户也可指定任意该服务支持的坐标系<br/>
<br>[ES5引入方式]:<br/>
Zondy.Layer.WMSLayer() <br/>
[ES6引入方式]:<br/>
import { WMSLayer } from &quot;@mapgis/webclient-common&quot; <br/>
<br/>
针对图层的操作请在图层加载完毕事件中进行<br/>
Layer.on('layerview-created', function (result) {<br/>
console.log(&quot;加载完毕:&quot;, result.layer)<br/>
});<br/>
如果不想在该事件中放入业务代码,则请确认图层资源已加载完毕后再进行操作<br/>
if(layer.loadStatus === 'loaded') {<br/>
// 你的业务逻辑<br/>
}</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="WMSSubLayer.html">WMSSubLayer</a><span style="display: none;"><p>WMS子图层</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="WMTSLayer.html">WMTSLayer</a><span style="display: none;"><p>WMTS图层,<br>
目前二维上支持4326(包括4490,4214以及4610),3857以及EPSG支持的自定义坐标系,三维上仅支持4326(包括4490,4214以及4610)以及3857坐标系,WMTS服务会自动读取元信息上的坐标系,不需要用户指定
<br><br>[ES5引入方式]:<br/>
Zondy.Layer.WMTSLayer() <br/>
[ES6引入方式]:<br/>
import { WMTSLayer } from &quot;@mapgis/webclient-common&quot; <br/>
<br/>
针对图层的操作请在图层加载完毕事件中进行<br/>
Layer.on('layerview-created', function (result) {<br/>
console.log(&quot;加载完毕:&quot;, result.layer)<br/>
});<br/>
如果不想在该事件中放入业务代码,则请确认图层资源已加载完毕后再进行操作<br/>
if(layer.loadStatus === 'loaded') {<br/>
// 你的业务逻辑<br/>
}</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="WMTSSubLayer.html">WMTSSubLayer</a><span style="display: none;"><p>IGS地图服务图层</p></span></li></ul><div style="font-weight: bold;vertical-align: middle;padding: 0.4rem 0;" class="mapgis-menu-span"><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/m.png" alt="">地图模块</div><ul class="mapgis-sidebar-menus"><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="Basemap.html">Basemap</a><span style="display: none;"><p>基础地图对象
<br>[ES5引入方式]:<br/>
Zondy.Basemap() <br/>
[ES6引入方式]:<br/>
import { Map } from &quot;@mapgis/webclient-common&quot; <br/></p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="Map.html">Map</a><span style="display: none;"><p>图层管理容器,和地图引擎无关,通过此对象而不是地图引擎来对图层进行管理
<br>[ES5引入方式]:<br/>
Zondy.Map() <br/>
[ES6引入方式]:<br/>
import { Map } from &quot;@mapgis/webclient-common&quot; <br/></p></span></li></ul><div style="font-weight: bold;vertical-align: middle;padding: 0.4rem 0;" class="mapgis-menu-span"><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/m.png" alt="">渲染器模块</div><ul class="mapgis-sidebar-menus"><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="BaseRenderer.html">BaseRenderer</a><span style="display: none;"><p>专题图渲染基类</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="ClassBreakInfo.html">ClassBreakInfo</a><span style="display: none;"><p>三维专题图-分段信息</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="ClassBreakRenderer.html">ClassBreakRenderer</a><span style="display: none;"><p>分段专题图渲染样式,支持的图层如下:<br/>
[IGS地图图片图层]{@link IGSMapImageLayer}、[几何图形图层]{@link GraphicsLayer}、[IGS要素图层]{@link IGSFeatureLayer}、
[geojson图层]{@link GeoJSONLayer}、[OGC-WFS图层]{@link WFSLayer}</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="ClusterInfo.html">ClusterInfo</a><span style="display: none;"><p>聚合点数量区间内的符号信息</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="ClusterRenderer.html">ClusterRenderer</a><span style="display: none;"><p>聚类渲染器,多个点聚集在一起,会形成一个点符号</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="ColorStop.html">ColorStop</a><span style="display: none;"><p>颜色分段</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="ColorVariable.html">ColorVariable</a><span style="display: none;"><p>color视觉变量</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="HeatmapColorStop.html">HeatmapColorStop</a><span style="display: none;"><p>热力图分段颜色和比率</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="HeatmapRenderer.html">HeatmapRenderer</a><span style="display: none;"><p>热力图渲染器</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="OpacityStop.html">OpacityStop</a><span style="display: none;"><p>透明度分段</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="OpacityVariable.html">OpacityVariable</a><span style="display: none;"><p>opacity视觉变量</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="RandomRenderer.html">RandomRenderer</a><span style="display: none;"><p>随机渲染器,将随机颜色赋予要素,根据zoom等级颜色也将发生变化</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="RankRenderer.html">RankRenderer</a><span style="display: none;"><p>等级符号专题图,符号尺寸随指定字段的值的变化而变化</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="SimpleRenderer.html">SimpleRenderer</a><span style="display: none;"><p>统一专题图渲染样式,支持的图层如下:<br/>
[几何图形图层]{@link GraphicsLayer}、[IGS要素图层]{@link IGSFeatureLayer}、
[geojson图层]{@link GeoJSONLayer}、[OGC-WFS图层]{@link WFSLayer}</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="SizeStop.html">SizeStop</a><span style="display: none;"><p>size视觉变量</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="SizeVariable.html">SizeVariable</a><span style="display: none;"><p>size视觉变量</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="UniqueValueInfo.html">UniqueValueInfo</a><span style="display: none;"><p>三维专题图-单值信息</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="UniqueValueRenderer.html">UniqueValueRenderer</a><span style="display: none;"><p>单值专题图渲染样式,支持的图层如下:<br/>
[IGS地图图片图层]{@link IGSMapImageLayer}、[几何图形图层]{@link GraphicsLayer}、[IGS要素图层]{@link IGSFeatureLayer}、
[geojson图层]{@link GeoJSONLayer}、[OGC-WFS图层]{@link WFSLayer}</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="VisualVariable.html">VisualVariable</a><span style="display: none;"><p>视觉变量基类</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="Zondy.ThemeLayer.GraphThemeLayer.html">GraphThemeLayer</a><span style="display: none;"><p>统计专题图通过为每个要素绘制统计图表来反映其对应的专题值的大小。它可同时表示多个字段属性信息,在区域本身与各区域之间形成横向和纵向的对比。<br>统计专题图多用于具有相关数量特征的地图上,比如表示不同地区多年的粮食产量、GDP、人口等,不同时段客运量、地铁流量等。目前提供的统计图类型有:柱状图(Bar),折线图(Line),饼图(Pie),三维柱状图(Bar3D),点状图(Point),环状图(Ring)。</p></span></li></ul><div style="font-weight: bold;vertical-align: middle;padding: 0.4rem 0;" class="mapgis-menu-span"><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/m.png" alt="">视图模块</div><ul class="mapgis-sidebar-menus"><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="BaseView.html">BaseView</a><span style="display: none;"><p>视图类</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="MapView.html">MapView</a><span style="display: none;"><p>二维场景视图(leaflet引擎),对地图引擎进行管理,如果要对地图图层进行管理请参考[Map]{@link Map},<br/>
参考示例:
<a href='#MapView'>[初始化二维场景视图]</a>
<br>[ES5引入方式]:<br/>
Zondy.MapView() <br/>
[ES6引入方式]:<br/>
import { MapView } from '@mapgis/webclient-leaflet-plugin' <br/></p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="VideoMapView.html">VideoMapView</a><span style="display: none;">undefined</span></li></ul><div style="font-weight: bold;vertical-align: middle;padding: 0.4rem 0;" class="mapgis-menu-span"><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/m.png" alt="">符号模块</div><ul class="mapgis-sidebar-menus"><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="Callout3D.html">Callout3D</a><span style="display: none;"><p>三维索引样式基类,当一个符号相对于原始位置有偏移时,该符号能显示其真实位置</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="ColorMaterial.html">ColorMaterial</a><span style="display: none;"><p>颜色材质,适用于所有三维符号</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="Edges3D.html">Edges3D</a><span style="display: none;"><p>轮廓线样式</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="ExtrudeSymbol3DLayer.html">ExtrudeSymbol3DLayer</a><span style="display: none;"><p>三维拉伸区符号图层,用来在三维场景中绘制拉伸的区几何,不支持二维地图视图<br/>
示例如下:<br/>
<a href='#ExtrudeSymbol3DLayer'>[1、创建三维拉伸区符号图层]</a><br/></p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="FillSymbol.html">FillSymbol</a><span style="display: none;"><p>填充符号基类</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="FillSymbol3DLayer.html">FillSymbol3DLayer</a><span style="display: none;"><p>三维区符号图层,用于在三维场景中绘制平面区对象,不支持二维视图<br/>
示例如下:<br/>
<a href='#FillSymbol3DLayer'>[1、创建三维区符号图层]</a><br/></p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="FillSymbol3DOutline.html">FillSymbol3DOutline</a><span style="display: none;"><p>三维区符号图层的外边线样式</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="IconResource.html">IconResource</a><span style="display: none;"><p>图标资源,如果没有设置href,则使用系统自带的图标</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="IconSymbol3DLayer.html">IconSymbol3DLayer</a><span style="display: none;"><p>三维图标符号图层,用来在三维场景中绘制图标,不支持二维地图视图<br/>
支持使用网络图片资源或者使用系统自带的图标资源<br/>
是一个始终朝向屏幕,并且立起来的图标<br/>
示例如下:<br/>
<a href='#IconSymbol3DLayer-href'>[1、使用网络资源创建一个三维图标图层对象]</a><br/>
<a href='#IconSymbol3DLayer-primitive'>[2、使用系统自带资源创建一个三维图标图层对象]</a><br/></p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="LabelSymbol3D.html">LabelSymbol3D</a><span style="display: none;"><p>三维注记符号,用于在三维场景中渲染线几何要素,不支持在二维视图中使用;<br/>
三维注记符号必须包含如下符号图层中的一个或多个,才能在三维场景中显示要素:<br/>
[三维文字符号图层]{@link TextSymbol3DLayer}<br/>
示例如下:<br/>
<a href='#LabelSymbol3D'>[1、创建一个三维注记符号对象]</a><br/></p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="LineCallout3D.html">LineCallout3D</a><span style="display: none;"><p>注记索引线样式,该线会链接注记和所属要素,当一个符号相对于原始位置有偏移时,该符号能显示其真实位置</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="LineStyleMarker3D.html">LineStyleMarker3D</a><span style="display: none;"><p>设置线的端点的Marker的样式</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="LineStylePattern3D.html">LineStylePattern3D</a><span style="display: none;"><p>三维虚线样式设置</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="LineSymbol.html">LineSymbol</a><span style="display: none;"><p>线符号基类</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="LineSymbol3D.html">LineSymbol3D</a><span style="display: none;"><p>三维线符号,用于在三维场景中渲染线几何要素,不支持在二维视图中使用;<br/>
三维线符号必须包含如下符号图层中的一个或多个,才能在三维场景中显示要素:<br/>
[三维线符号图层]{@link LineSymbol3DLayer}、[三维管道符号图层]{@link PathSymbol3DLayer}<br/>
示例如下:<br/>
<a href='#LineSymbol3D'>[1、创建线三维符号]</a><br/></p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="LineSymbol3DLayer.html">LineSymbol3DLayer</a><span style="display: none;"><p>三维线符号图层,用来在三维场景中绘制二维线,不支持二维地图视图<br/>
示例如下:<br/>
<a href='#LineSymbol3DLayer'>[1、创建三维线符号图层]</a><br/></p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="LineSymbolMarker.html">LineSymbolMarker</a><span style="display: none;"><p>标记符号</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="MapGISTextSymbol.html">MapGISTextSymbol</a><span style="display: none;"><p>文本符号,支持点几何对象,参考示例:<a href='#new-MapGISTextSymbol'>[创建文本样式]</a>
<br><br>[ES5引入方式]:<br/>
Zondy.Symbol.MapGISTextSymbol() <br/>
[ES6引入方式]:<br/>
import { MapGISTextSymbol } from &quot;@mapgis/webclient-common&quot; <br/>
<br/></p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="MarkerSymbol.html">MarkerSymbol</a><span style="display: none;"><p>Marker符号基类</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="ObjectSymbol3DLayer.html">ObjectSymbol3DLayer</a><span style="display: none;"><p>三维体对象符号图层,使用三维体符号来绘制一个点几何要素<br/>
通过设置resource的primitive属性来设置符号形状,支持如下形状:<br/>
sphere、cylinder、cube、cone、inverted-cone、diamond、tetrahedron<br/>
也可通过设置resource中的href属性,来加载gltf数据<br/>
同时通过设置material属性来设置符号的外观<br/>
示例如下:<br/>
<a href='#ObjectSymbol3DLayer-href'>[1、使用网络资源创建一个三维体对象符号图层对象]</a><br/>
<a href='#ObjectSymbol3DLayer-primitive'>[2、使用系统自带资源创建一个三维体对象符号图层对象]</a><br/></p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="PathSymbol3DLayer.html">PathSymbol3DLayer</a><span style="display: none;"><p>三维管道符号图层,定义如何在三维场景视图中绘制一个管道线<br/>
示例如下:<br/>
<a href='#PathSymbol3DLayer'>[1、创建三维管道符号图层]</a><br/></p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="PictureFillSymbol.html">PictureFillSymbol</a><span style="display: none;"><p>图片填充符号</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="PictureMarkerSymbol.html">PictureMarkerSymbol</a><span style="display: none;"><p>图片Marker符号,支持点几何对象,参考示例:<a href='#new-PictureMarkerSymbol'>[图片Marker样式]</a>
<br><br>[ES5引入方式]:<br/>
Zondy.Symbol.PictureMarkerSymbol() <br/>
[ES6引入方式]:<br/>
import { PictureMarkerSymbol } from &quot;@mapgis/webclient-common&quot; <br/>
<br/></p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="PointSymbol3D.html">PointSymbol3D</a><span style="display: none;"><p>三维点符号,在三维场景中渲染点几何要素,不支持二维视图;<br/>
三维点符号必须包含如下符号图层中的一个或多个,才能在三维场景中显示要素:<br/>
[三维图标符号图层]{@link IconSymbol3DLayer}、[三维对象符号图层]{@link ObjectSymbol3DLayer}、[三维文字符号图层]{@link TextSymbol3DLayer}<br/>
示例如下:<br/>
<a href='#PointSymbol3D'>[1、创建一个三维点符号对象]</a><br/></p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="PointSymbol3DOutline.html">PointSymbol3DOutline</a><span style="display: none;"><p>三维点符号图层的外边线样式</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="PolygonSymbol3D.html">PolygonSymbol3D</a><span style="display: none;"><p>三维体符号,用于在三维场景视图中渲染几何要素,不支持二维视图<br/>
三维体符号必须包含如下符号图层中的一个或多个,才能在三维场景中显示要素:<br/>
[三维区符号图层]{@link FillSymbol3DLayer}、[三维拉伸区符号图层]{@link ExtrudeSymbol3DLayer}、[三维线符号图层]{@link LineSymbol3DLayer}、[三维图标符号图层]{@link IconSymbol3DLayer}、[三维体对象符号图层]{@link ObjectSymbol3DLayer}、[三维注记符号图层]{@link TextSymbol3DLayer}<br/>
示例如下:<br/>
<a href='#PolygonSymbol3D'>[1、创建一个三维体符号对象]</a><br/></p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="SimpleFillSymbol.html">SimpleFillSymbol</a><span style="display: none;"><p>简单填充符号,参考示例:<a href='#new-SimpleFillSymbol'>[填充符号样式]</a>
<br><br>[ES5引入方式]:<br/>
Zondy.Symbol.SimpleFillSymbol() <br/>
[ES6引入方式]:<br/>
import { SimpleFillSymbol } from &quot;@mapgis/webclient-common&quot; <br/>
<br/></p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="SimpleLineSymbol.html">SimpleLineSymbol</a><span style="display: none;"><p>简单线符号,支持线几何对象,参考示例:<a href='#new-SimpleLineSymbol'>[线符号样式]</a>
<br><br>[ES5引入方式]:<br/>
Zondy.Symbol.SimpleLineSymbol() <br/>
[ES6引入方式]:<br/>
import { SimpleLineSymbol } from &quot;@mapgis/webclient-common&quot; <br/>
<br/></p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="SimpleMarkerSymbol.html">SimpleMarkerSymbol</a><span style="display: none;"><p>简单Marker符号,支持点几何对象,参考示例:<a href='#new-SimpleMarkerSymbol'>[简单Marker样式]</a>
<br><br>[ES5引入方式]:<br/>
Zondy.Symbol.SimpleMarkerSymbol() <br/>
[ES6引入方式]:<br/>
import { SimpleMarkerSymbol } from &quot;@mapgis/webclient-common&quot; <br/>
<br/></p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="StylePattern3D.html">StylePattern3D</a><span style="display: none;"><p>三维区间隔填充样式设置</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="Symbol.html">Symbol</a><span style="display: none;"><p>符号基类</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="Symbol3DLayer.html">Symbol3DLayer</a><span style="display: none;"><p>三维符号图层基类,用来定义在三维中展示的点、线、区几何以及gltf的样式<br/>
所有的三维符号都有一个symbolLayers属性,是一个Symbol3DLayer的集合对象,所有的符号必须至少拥有一个或多个三维符号图层,才能进行正常显示<br/>
现有如下类型的三维符号图层:<br/>
IconSymbol3DLayer、ObjectSymbol3DLayer、LineSymbol3DLayer、PathSymbol3DLayer、FillSymbol3DLayer、WaterSymbol3DLayer、ExtrudeSymbol3DLayer、TextSymbol3DLayer<br/></p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="Symbol3DVerticalOffset.html">Symbol3DVerticalOffset</a><span style="display: none;"><p>符号垂直偏移量,将一个符号在竖直世界轴的方向上进行平移</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="TextHalo.html">TextHalo</a><span style="display: none;"><p>文字光晕样式</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="TextSymbol.html">TextSymbol</a><span style="display: none;"><p>文本符号,支持点几何对象,参考示例:<a href='#new-TextSymbol'>[创建文本样式]</a>
<br><br>[ES5引入方式]:<br/>
Zondy.Symbol.TextSymbol() <br/>
[ES6引入方式]:<br/>
import { TextSymbol } from &quot;@mapgis/webclient-common&quot; <br/>
<br/></p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="TextSymbol3DLayer.html">TextSymbol3DLayer</a><span style="display: none;"><p>三维注记符号图层,定义如何在三维场景中显示文字,不支持二维视图<br/>
示例如下:<br/>
<a href='#TextSymbol3DLayer'>[1、创建一个三维注记符号图层对象]</a><br/></p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="WaterSymbol3DLayer.html">WaterSymbol3DLayer</a><span style="display: none;"><p>水面符号图层,定义如何在三维场景中沟构造水面几何,不支持二维视图</p></span></li></ul><div style="font-weight: bold;vertical-align: middle;padding: 0.4rem 0;" class="mapgis-menu-span"><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/m.png" alt="">几何模块</div><ul class="mapgis-sidebar-menus"><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="Circle.html">Circle</a><span style="display: none;"><p>几何圆,参考示例:<a href='#Circle'>[几何圆对象]</a>
<br><br>[ES5引入方式]:<br/>
Zondy.Geometry.Circle() <br/>
[ES6引入方式]:<br/>
import { Circle } from &quot;@mapgis/webclient-common&quot; <br/>
<br/></p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="Extent.html">Extent</a><span style="display: none;"><p>几何范围对象,即左下角和右上角组成的矩形范围几何对象,参考示例:<a href='#Extent'>[几何范围对象]</a>
<br><br>[ES5引入方式]:<br/>
Zondy.Geometry.Extent() <br/>
[ES6引入方式]:<br/>
import { Extent } from &quot;@mapgis/webclient-common&quot; <br/>
<br/></p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="Geometry.html">Geometry</a><span style="display: none;"><p>几何图形对象基类
<br><br>[ES5引入方式]:<br/>
Zondy.Geometry.Geometry() <br/>
[ES6引入方式]:<br/>
import { Geometry } from &quot;@mapgis/webclient-common&quot; <br/>
<br/></p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="GeometryEngine.html">GeometryEngine</a><span style="display: none;"><p>几何分析工具</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="LineString.html">LineString</a><span style="display: none;"><p>线几何对象
<br><br>[ES5引入方式]:<br/>
Zondy.Geometry.LineString() <br/>
[ES6引入方式]:<br/>
import { LineString } from &quot;@mapgis/webclient-common&quot; <br/>
<br/></p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="MultiLineString.html">MultiLineString</a><span style="display: none;"><p>多线段几何
<br><br>[ES5引入方式]:<br/>
Zondy.Geometry.MultiLineString() <br/>
[ES6引入方式]:<br/>
import { MultiLineString } from &quot;@mapgis/webclient-common&quot; <br/>
<br/></p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="MultiPoint.html">MultiPoint</a><span style="display: none;"><p>多点几何对象
<br><br>[ES5引入方式]:<br/>
Zondy.Geometry.MultiPoint() <br/>
[ES6引入方式]:<br/>
import { MultiPoint } from &quot;@mapgis/webclient-common&quot; <br/>
<br/></p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="MultiPolygon.html">MultiPolygon</a><span style="display: none;"><p>多区几何
<br><br>[ES5引入方式]:<br/>
Zondy.Geometry.MultiPolygon() <br/>
[ES6引入方式]:<br/>
import { MultiPolygon } from &quot;@mapgis/webclient-common&quot; <br/>
<br/></p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="Point.html">Point</a><span style="display: none;"><p>点几何对象
<br><br>[ES5引入方式]:<br/>
Zondy.Geometry.Point() <br/>
[ES6引入方式]:<br/>
import { Point } from &quot;@mapgis/webclient-common&quot; <br/>
<br/></p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="Polygon.html">Polygon</a><span style="display: none;"><p>区几何,由多个环(ring)构成的几何对象,仅支持带洞区和非带洞区,不支持带岛区,即三个圈重叠<br/>
多边形的第一个环(ring)即外圈,从第二个环开始为内圈,内圈可以重合、相交、自相交,但是不能超过外圈
<br><br>[ES5引入方式]:<br/>
Zondy.Geometry.Polygon() <br/>
[ES6引入方式]:<br/>
import { Polygon } from &quot;@mapgis/webclient-common&quot; <br/>
<br/></p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="Projection.html">Projection</a><span style="display: none;"><p>投影转换工具</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="SpatialReference.html">SpatialReference</a><span style="display: none;"><p>空间参考系
<br><br>[ES5引入方式]:<br/>
Zondy.SpatialReference() <br/>
[ES6引入方式]:<br/>
import { SpatialReference } from &quot;@mapgis/webclient-common&quot; <br/>
<br/></p></span></li></ul><div style="font-weight: bold;vertical-align: middle;padding: 0.4rem 0;" class="mapgis-menu-span"><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/m.png" alt="">undefined</div><ul class="mapgis-sidebar-menus"><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="DrawControl.html">DrawControl</a><span style="display: none;"><p>绘制工具</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="Screenshot.html">Screenshot</a><span style="display: none;"><p>打印工具</p></span></li></ul><div style="font-weight: bold;vertical-align: middle;padding: 0.4rem 0;" class="mapgis-menu-span"><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/m.png" alt="">基础对象模块</div><ul class="mapgis-sidebar-menus"><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="Evented.html">Evented</a><span style="display: none;"><p>事件基类,所有可接收或者发送的对象继承于此</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="UpdateContent.html">UpdateContent</a><span style="display: none;"><p>更新内容对象</p></span></li></ul><div style="font-weight: bold;vertical-align: middle;padding: 0.4rem 0;" class="mapgis-menu-span"><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/m.png" alt="">要素模块</div><ul class="mapgis-sidebar-menus"><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="Feature.html">Feature</a><span style="display: none;"><p>要素对象,示例如下:<a id='add-Feature'>[初始化要素对象]</a>
<br><br>[ES5引入方式]:<br/>
Zondy.Feature() <br/>
[ES6引入方式]:<br/>
import { Feature } from &quot;@mapgis/webclient-common&quot; <br/>
<br/></p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="FeatureSet.html">FeatureSet</a><span style="display: none;"><p>要素集合类,示例如下:<a id='add-FeatureSet'>[初始化要素集合对象]</a>
<br><br>[ES5引入方式]:<br/>
Zondy.FeatureSet() <br/>
[ES6引入方式]:<br/>
import { FeatureSet } from &quot;@mapgis/webclient-common&quot; <br/>
<br/></p></span></li></ul><div style="font-weight: bold;vertical-align: middle;padding: 0.4rem 0;" class="mapgis-menu-span"><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/m.png" alt="">undefined</div><ul class="mapgis-sidebar-menus"><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="Popup.html">Popup</a><span style="display: none;"><p>二维场景信息弹窗(leaflet引擎)
参考示例:
<a href='#MapView'>[初始化二维场景视图]</a>
[ES6引入方式]:<br/>
import { Popup } from '@mapgis/webclient-leaflet-plugin' <br/>
自定义样式说明:<br/>
zondy-popup__content 弹窗容器样式<br/>
zondy-popup__tip 弹窗对话框箭头样式<br/>
zondy-popup__header 弹窗头部样式<br/>
zondy-popup__content 弹窗主体样式<br/>
zondy-popup__footer 弹窗底部样式<br/></p></span></li></ul><div style="font-weight: bold;vertical-align: middle;padding: 0.4rem 0;" class="mapgis-menu-span"><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/m.png" alt="">草图编辑模块</div><ul class="mapgis-sidebar-menus"><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="SketchBaseDrawTool.html">SketchBaseDrawTool</a><span style="display: none;"><p>草图基础绘图工具类</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="SketchCircleDrawTool.html">SketchCircleDrawTool</a><span style="display: none;"><p>面绘图工具类</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="SketchEditor.html">SketchEditor</a><span style="display: none;"><p>草图编辑基类</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="SketchEditorLeaflet.html">SketchEditorLeaflet</a><span style="display: none;"><p>二维场景草图编辑类<br/>
<br>[ES5引入方式]:<br/>
const { SketchEditorLeaflet } = Zondy <br/>
[ES6引入方式]:<br/>
import { SketchEditorLeaflet } from &quot;@mapgis/webclient-leaflet-plugin&quot; <br/></p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="SketchEditorVideo.html">SketchEditorVideo</a><span style="display: none;">undefined</span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="SketchEditorVideoBase.html">SketchEditorVideoBase</a><span style="display: none;">undefined</span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="SketchExtentDrawTool.html">SketchExtentDrawTool</a><span style="display: none;"><p>面绘图工具类</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="SketchPointDrawTool.html">SketchPointDrawTool</a><span style="display: none;"><p>点绘图工具类</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="SketchPolygonDrawTool.html">SketchPolygonDrawTool</a><span style="display: none;"><p>面绘图工具类</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="SketchPolylineDrawTool.html">SketchPolylineDrawTool</a><span style="display: none;"><p>面绘图工具类</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="SketchStage.html">SketchStage</a><span style="display: none;"><p>草图图形集合</p></span></li><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="SketchStyle.html">SketchStyle</a><span style="display: none;"><p>草图样式管理类</p></span></li></ul></div>
                
            </nav>
        </div>
        <div class="core" id="main-content-wrapper">
            <div class="content">
                <header id="page-title" class="page-title">
                    <span class="page-title-main">类名</span>
                    <span class="page-title-sub">common/sketchEditor/base/SketchSnappingTool.js</span>
                </header>
                



    
    <section>
        <article>
            <pre class="prettyprint source linenums"><code>import * as turf from '@turf/turf'
import {
  Point,
  Polygon,
  LineString,
  MultiLineString,
  SpatialReference
} from '../../base/geometry'
import GeometryEngine from '../../base/geometry/GeometryEngine'
import { Projection } from '../../base'
import { defaultValue } from '../../util'
/**
 * 草图捕捉工具类
 * @class SketchPolygonDrawTool
 * @moduleEX SketchEditorModule
 * @param {Object} options 构造参数
 * @param {Object}  [options.pixelTolerance]  容差(像素单位)
 * @param {Object}  [options.tolerance]  容差(米单位)
 * @param {Object}  [options.isSnapVertex]  是否自动捕捉顶点
 * @param {Object}  [options.isSnapVertexInLine]  是否自动捕捉线上的点
 * @param {Object}  [options.isSnapPerpendicular]  是否自动捕捉垂点
 * @param {Object}  [options.isSnapParallel]  是否自动捕捉水平交点
 */

class SketchSnappingTool {
  constructor(options) {
    /**
     * 像素容差
     * @member {Number} SketchSnappingTool.prototype.pixelTolerance
     */
    this.pixelTolerance = 10
    /**
     * 容差(米单位)
     * @member {Number} SketchSnappingTool.prototype.tolerance
     */
    this.tolerance = 5
    /**
     *斜率容差
     * @member {Number} SketchSnappingTool.prototype.toleranceSlope
     */
    this.toleranceSlope = 0.02
    /**
     *是否自动捕捉顶点
     * @member {Boolean} SketchSnappingTool.prototype.isSnapVertex
     */
    this.isSnapVertex = false
    /**
     *是否自动捕捉顶点重合
     * @member {Boolean} SketchSnappingTool.prototype.isSnapVertexCoincident
     */
    this.isSnapVertexCoincident = defaultValue(
      options.isSnapVertexCoincident,
      false
    )
    /**
     *是否自动捕捉线上的点
     * @member {Boolean} SketchSnappingTool.prototype.isSnapVertexInLine
     */
    this.isSnapVertexInLine = defaultValue(options.isSnapVertexInLine, false)
    /**
     *是否自动捕捉垂线垂点
     * @member {Boolean} SketchSnappingTool.prototype.isSnapPerpendicular
     */
    this.isSnapPerpendicular = defaultValue(options.isSnapPerpendicular, false)
    /**
     *是否自动捕捉平行线
     * @member {Boolean} SketchSnappingTool.prototype.isSnapParallel
     */
    this.isSnapParallel = defaultValue(options.isSnapParallel, false)
    /**
     *是否捕捉正在绘制的图形的边界
     * @member {Boolean} SketchSnappingTool.prototype.snapSketchGeometry
     */
    this.snapSketchGeometry = defaultValue(options.snapSketchGeometry, false)

    this._view = defaultValue(options.view, null)
  }

  setSnapOption(snapOption) {
    this.isSnapVertexCoincident =
      snapOption.isSnapVertexCoincident !== undefined
        ? snapOption.isSnapVertexCoincident
        : this.isSnapVertexCoincident
    this.isSnapVertexInLine =
      snapOption.isSnapVertexInLine !== undefined
        ? snapOption.isSnapVertexInLine
        : this.isSnapVertexInLine
    this.isSnapParallel =
      snapOption.isSnapParallel !== undefined
        ? snapOption.isSnapParallel
        : this.isSnapParallel
    this.isSnapPerpendicular =
      snapOption.isSnapPerpendicular !== undefined
        ? snapOption.isSnapPerpendicular
        : this.isSnapPerpendicular
    this.snapSketchGeometry =
      snapOption.snapSketchGeometry !== undefined
        ? snapOption.snapSketchGeometry
        : this.snapSketchGeometry
  }

  /**
   * 绘制时捕捉
   * @param {Point} targetPoint 捕获结果
   * @param {LineString} targetLine 捕获结果
   * @param {Array} pointArray 被捕获的面端点数组
   * @param {Array} lineSlopes 被捕获的面线段斜率
   * @return {Object} 捕获结果
   */
  snapGeometries(targetPoint, moveLine, geometries, tolerance) {
    let coordinateArray
    const snapResult = {}
    const coincidentPoints = []
    let pointInLines = []
    let parallelLines = []
    let perpendicularLines = []
    geometries.forEach((geometry) => {
      if (geometry instanceof Polygon) {
        coordinateArray = geometry.coordinates[0]
      } else if (geometry instanceof LineString) {
        coordinateArray = geometry.coordinates
      } else if (geometry instanceof Point) {
        coordinateArray = [geometry.coordinates]
      }
      const result = this.drawingSnap(
        targetPoint,
        moveLine,
        coordinateArray,
        tolerance
      )
      if (result.coincidentPoint) {
        coincidentPoints.push(result.coincidentPoint)
      }
      if (result.pointInLines) {
        pointInLines = pointInLines.concat(result.pointInLines)
      }
      if (result.parallelLines) {
        parallelLines = parallelLines.concat(result.parallelLines)
      }
      if (result.perpendicularLines) {
        perpendicularLines = perpendicularLines.concat(
          result.perpendicularLines
        )
      }
    })
    snapResult.coincidentPoint = this._getBestResult(
      coincidentPoints,
      targetPoint
    )
    snapResult.pointInLine = this._getBestResult(pointInLines, targetPoint)
    snapResult.parallelLine = this._getBestResult(parallelLines, targetPoint)
    snapResult.perpendicularLine = this._getBestResult(
      perpendicularLines,
      targetPoint
    )
    // 同时满足点在线上和平行
    if (snapResult.pointInLine &amp;&amp; snapResult.parallelLine) {
      let realPoint = this.getLineCrossPoint(
        snapResult.pointInLine.line,
        new LineString({
          coordinates: [
            moveLine.coordinates[0],
            snapResult.parallelLine.realPoint.coordinates
          ],
          spatialReference: targetPoint.spatialReference
        })
      )
      if (realPoint) {
        if (targetPoint.coordinates.length === 3) {
          const hight = this._getHight()
          realPoint = new Point({
            coordinates: [...realPoint.coordinates, hight],
            spatialReference: targetPoint.spatialReference
          })
        }
        snapResult.inLineAndParallel = {
          realPoint,
          lines: [snapResult.pointInLine.line, snapResult.parallelLine.line],
          symbolGeometry: snapResult.parallelLine.symbolGeometry
        }
      }
    }
    if (snapResult.pointInLine &amp;&amp; snapResult.perpendicularLine) {
      let realPoint = this.getLineCrossPoint(
        snapResult.pointInLine.line,
        new LineString({
          coordinates: [
            moveLine.coordinates[0],
            snapResult.perpendicularLine.realPoint.coordinates
          ],
          spatialReference: targetPoint.spatialReference
        })
      )
      if (realPoint) {
        if (targetPoint.coordinates.length === 3) {
          const hight = this._getHight()
          realPoint = new Point({
            coordinates: [...realPoint.coordinates, hight],
            spatialReference: targetPoint.spatialReference
          })
        }
        snapResult.inLineAndPerpendicular = {
          realPoint,
          lines: [
            snapResult.pointInLine.line,
            snapResult.perpendicularLine.line
          ],
          symbolGeometry: snapResult.perpendicularLine.symbolGeometry
        }
      }
    }
    return snapResult
  }

  getLineCrossPoint(line1, line2) {
    const point1 = {
      x: line1.coordinates[0][0],
      y: line1.coordinates[0][1]
    }
    const point2 = {
      x: line1.coordinates[1][0],
      y: line1.coordinates[1][1]
    }
    const point3 = {
      x: line2.coordinates[0][0],
      y: line2.coordinates[0][1]
    }
    const point4 = {
      x: line2.coordinates[1][0],
      y: line2.coordinates[1][1]
    }
    const x =
      ((point3.x - point4.x) * (point2.x * point1.y - point1.x * point2.y) -
        (point1.x - point2.x) * (point4.x * point3.y - point3.x * point4.y)) /
      ((point3.x - point4.x) * (point1.y - point2.y) -
        (point1.x - point2.x) * (point3.y - point4.y))
    const y =
      ((point3.y - point4.y) * (point2.y * point1.x - point1.y * point2.x) -
        (point1.y - point2.y) * (point4.y * point3.x - point3.y * point4.x)) /
      ((point3.y - point4.y) * (point1.x - point2.x) -
        (point1.y - point2.y) * (point3.x - point4.x))
    let crossPoint = undefined
    if (
      !isNaN(x) &amp;&amp;
      !isNaN(y) &amp;&amp;
      x &lt;= Math.max(point3.x, point4.x) &amp;&amp;
      x >= Math.min(point3.x, point4.x) &amp;&amp;
      y &lt;= Math.max(point3.y, point4.y) &amp;&amp;
      y >= Math.min(point3.y, point4.y)
    ) {
      crossPoint = new Point({
        coordinates: [x, y],
        spatialReference: line1.spatialReference
      })
    }
    return crossPoint
  }

  drawingSnap(targetPoint, targetLine, pointArray, tolerance) {
    this.tolerance = tolerance
    const spatialReference = targetLine.spatialReference
    targetPoint = this._convertReference(targetPoint)
    targetLine = this._convertReference(targetLine)
    const snapGeometry = this.getSnapGeometryByPointArray(
      pointArray,
      spatialReference
    )
    const snapResult = {}
    if (this.isSnapVertexCoincident) {
      // 捕捉顶点重合
      snapResult.coincidentPoint = this.pointCoincident(
        targetPoint,
        snapGeometry.points,
        spatialReference
      )
    }
    if (this.isSnapVertexInLine) {
      // 捕捉点在线上
      if (!snapResult.coincidentPoint) {
        snapResult.pointInLines = this.getPointInLines(
          targetPoint,
          snapGeometry.lines,
          spatialReference
        )
      }
    }
    if (this.isSnapParallel) {
      // 捕捉平行线
      snapResult.parallelLines = this.getParallelLine(
        targetPoint,
        targetLine,
        snapGeometry.lines,
        spatialReference
      )
    }
    if (this.isSnapPerpendicular) {
      // 捕捉垂线垂点
      snapResult.perpendicularLines = this.getPerpendicularLine(
        targetPoint,
        targetLine,
        snapGeometry.lines,
        spatialReference
      )
    }
    return snapResult
  }

  _getBestResult(resultItem, targetPoint) {
    let bestItem = undefined
    let minDistance = 0
    resultItem.forEach((item, i) => {
      const distance = GeometryEngine.distance(item.realPoint, targetPoint)
      if (i === 0) {
        bestItem = item
        minDistance = distance
      } else {
        if (distance &lt; minDistance) {
          minDistance = distance
          bestItem = item
        }
      }
    })
    return bestItem
  }

  getSnapGeometryByPointArray(pointArray, spatialReference) {
    const points = []
    const lines = []
    pointArray.forEach((coord, index) => {
      const point = this._convertReference(
        new Point({
          coordinates: coord,
          spatialReference
        })
      )
      points.push(point)
      if (index > 0) {
        const line = this._convertReference(
          new LineString({
            coordinates: [pointArray[index - 1], pointArray[index]],
            spatialReference
          })
        )
        lines.push(line)
      }
    })
    return { points, lines }
  }

  _convertReference(geometry) {
    if (!geometry.isWSG48) {
      let newGeometry = geometry.clone()
      newGeometry = Projection.project(
        newGeometry,
        new SpatialReference('EPSG:4326')
      )
      return newGeometry
    } else {
      return geometry
    }
  }

  getDistance(point1, point2) {
    const distance = turf.distance(turf.point(point1), turf.point(point2), {
      units: 'kilometers'
    })
    return distance * 1000
  }

  /**
   * 两点是否重合
   * @param {Point} targetPoint
   * @param {Array} points
   */
  pointCoincident(targetPoint, points) {
    let containPoint = undefined
    const targetScreenPoint = this._view.toScreen(targetPoint)
    for (let i = 0; i &lt; points.length; i++) {
      const screenPoint = this._view.toScreen(points[i])
      if (
        Math.sqrt(
          Math.pow(targetScreenPoint.x - screenPoint.x, 2) +
            Math.pow(targetScreenPoint.y - screenPoint.y, 2)
        ) &lt;= this.pixelTolerance
      ) {
        if (
          targetPoint.coordinates.length === 3 &amp;&amp;
          points[i].coordinates.length &lt; 3
        ) {
          containPoint = new Point({
            coordinates: [...points[i].coordinates, this._getHight()],
            spatialReference: this._getHight().spatialReference
          })
        } else {
          containPoint = points[i]
        }
        break
      }
    }
    return containPoint ? { realPoint: containPoint } : undefined
  }

  /**
   *捕获目标点所在在多个被捕获的直线上,返回被捕获的的直线
   * @param {Point} targetPoint
   * @param {Array} lines
   * @return {Object} 被捕获的的直线对象
   */
  getPointInLines(targetPoint, lines, spatialReference) {
    const containLines = []
    lines.forEach((line) => {
      // 计算容差范围内点到线的垂点
      const inLineResult = this.getPerpendicularPoint(
        targetPoint,
        new Point({
          coordinates: line.coordinates[0],
          spatialReference
        }),
        new Point({
          coordinates: line.coordinates[1],
          spatialReference
        })
      )
      if (inLineResult) {
        line = Projection.project(line, spatialReference)
        containLines.push({
          line,
          realPoint: inLineResult.realPoint,
          deltaTolerance: inLineResult.deltaTolerance
        })
      }
    })
    return containLines
  }

  // 根据点坐标和直线,获取垂足坐标
  getPerpendicularPoint(targetPoint, targetLinePoint1, targetLinePoint2) {
    // const point = this._view.toScreen(targetPoint)
    // const linePoint1 = this._view.toScreen(targetLinePoint1)
    // const linePoint2 = this._view.toScreen(targetLinePoint2)
    const point = {
      x: targetPoint.coordinates[0],
      y: targetPoint.coordinates[1]
    }
    const linePoint1 = {
      x: targetLinePoint1.coordinates[0],
      y: targetLinePoint1.coordinates[1]
    }
    const linePoint2 = {
      x: targetLinePoint2.coordinates[0],
      y: targetLinePoint2.coordinates[1]
    }
    let perpendicularPoint
    let x
    let y
    if (linePoint2.x !== linePoint1.x) {
      const k = (linePoint2.y - linePoint1.y) / (linePoint2.x - linePoint1.x)
      x =
        (k * k * linePoint1.x + k * (point.y - linePoint1.y) + point.x) /
        (k * k + 1)
      y = k * (x - linePoint1.x) + linePoint1.y
    } else {
      x =
        (targetLinePoint1.coordinates[0] + targetLinePoint2.coordinates[0]) / 2
      y = targetPoint.coordinates[1]
    }
    if (targetPoint.coordinates.length === 3) {
      const hight = this._getHight()
      perpendicularPoint = new Point({
        coordinates: [x, y, hight],
        spatialReference: targetPoint.spatialReference
      })
    } else {
      perpendicularPoint = new Point({
        coordinates: [x, y],
        spatialReference: targetPoint.spatialReference
      })
    }
    const endScreenPoint = this._view.toScreen(perpendicularPoint)
    const startScreenPoint = this._view.toScreen(targetPoint)
    const deltaPixel = Math.sqrt(
      Math.pow(startScreenPoint.x - endScreenPoint.x, 2) +
        Math.pow(startScreenPoint.y - endScreenPoint.y, 2)
    )
    const valid = deltaPixel &lt;= this.pixelTolerance
    return valid
      ? {
          realPoint: perpendicularPoint,
          deltaTolerance: deltaPixel
        }
      : null
  }

  /**
   * 获取目标直线的平行线捕获结果。判断目标直线与被捕获的直线是否平行,返回平行线结果
   * @private
   * @param {Point} targetPoint
   * @param {LineString} targetLine 目标直线
   * @param {Array} lines 被捕获的直线对象
   * @param {Array} lineSlopes 被捕获的直线斜率
   * @return {Object} 平行线捕获结果
   */
  getParallelLine(targetPoint, targetLine, lines, spatialReference) {
    const parallelLines = []
    if (lines &amp;&amp; lines.length > 0) {
      lines.forEach((line) => {
        const linePoint1 = new Point({
          coordinates: line.coordinates[0],
          spatialReference
        })
        const linePoint2 = new Point({
          coordinates: line.coordinates[1],
          spatialReference
        })
        const parallelResult = this.getParallelPoint(
          targetPoint,
          new Point({
            coordinates: targetLine.coordinates[0],
            spatialReference
          }),
          linePoint1,
          linePoint2,
          'parallel'
        )
        if (parallelResult) {
          const realPoint = parallelResult.realPoint
          const symbolGeometry = this._getParallelSymbolGeometry(
            linePoint1,
            linePoint2
          )
          parallelLines.push({
            line,
            symbolGeometry,
            realPoint,
            deltaTolerance: parallelResult.deltaTolerance
          })
        }
      })
    }
    return parallelLines.length > 0 ? parallelLines : undefined
  }

  // 计算平行或垂直时的标准坐标
  getParallelPoint(
    targetPoint,
    targetLastPoint,
    targetLinePoint1,
    targetLinePoint2,
    type = 'parallel'
  ) {
    // const point = this._view.toScreen(targetPoint)
    // const lastPoint = this._view.toScreen(targetLastPoint)
    // const linePoint1 = this._view.toScreen(targetLinePoint1)
    // const linePoint2 = this._view.toScreen(targetLinePoint2)
    const point = {
      x: targetPoint.coordinates[0],
      y: targetPoint.coordinates[1]
    }
    const lastPoint = {
      x: targetLastPoint.coordinates[0],
      y: targetLastPoint.coordinates[1]
    }
    const linePoint1 = {
      x: targetLinePoint1.coordinates[0],
      y: targetLinePoint1.coordinates[1]
    }
    const linePoint2 = {
      x: targetLinePoint2.coordinates[0],
      y: targetLinePoint2.coordinates[1]
    }
    // 计算point,lastPoint的长度
    const distance = Math.sqrt(
      Math.pow(point.x - lastPoint.x, 2) + Math.pow(point.y - lastPoint.y, 2)
    )
    // 计算点(point)到直线(lineP1、lineP2)的距离
    const isTolerance = function (point, lineP1, lineP2, pixelTolerance) {
      const pointToLineD =
        Math.abs(
          (lineP2.x - lineP1.x) * (point.x - lineP1.x) +
            (lineP2.y - lineP1.y) * (point.y - lineP1.y)
        ) /
        Math.sqrt(
          Math.pow(lineP2.x - lineP1.x, 2) + Math.pow(lineP2.y - lineP1.y, 2)
        )
      return pointToLineD &lt;= pixelTolerance
    }

    let k
    let kValid = true
    let x
    let y
    if (type === 'parallel') {
      if (linePoint2.x === linePoint1.x) {
        kValid = false
        x = lastPoint.x
        if (point.y > lastPoint.y) {
          y = lastPoint.y + distance
        } else {
          y = lastPoint.y - distance
        }
      } else {
        k = (linePoint2.y - linePoint1.y) / (linePoint2.x - linePoint1.x)
      }
    } else if (type === 'perpendicular') {
      if (linePoint2.y === linePoint1.y) {
        kValid = false
        y = lastPoint.y
        if (point.x > lastPoint.x) {
          x = lastPoint.x + distance
        } else {
          x = lastPoint.x - distance
        }
      } else {
        k = -(linePoint2.x - linePoint1.x) / (linePoint2.y - linePoint1.y)
      }
    }
    if (kValid) {
      const b = lastPoint.y - k * lastPoint.x
      // 第二步:求得在直线y=kx+b上,距离当前坐标距离为L的某点
      const H = Math.pow(k, 2) + 1 // A=k^2+1;
      const I = 2 * ((b - lastPoint.y) * k - lastPoint.x) // B=2[(b-y0)k-x0];
      const J =
        Math.pow(b - lastPoint.y, 2) +
        Math.pow(lastPoint.x, 2) -
        Math.pow(distance, 2)
      const Dx1 = (-I + Math.sqrt(Math.pow(I, 2) - 4 * H * J)) / (2 * H)
      const Dx2 = (-I - Math.sqrt(Math.pow(I, 2) - 4 * H * J)) / (2 * H)
      x = 0 // 最后确定是在已知两点之间的某点
      if ((point.x - lastPoint.x) * (Dx1 - lastPoint.x) > 0) {
        x = Dx1
      } else {
        x = Dx2
      }
      y = k * x + b
      // parallelPoint = this._view.toMap({ x, y })
    }
    // 临时
    if (isNaN(x) || isNaN(x)) {
      return null
    }
    let parallelPoint
    if (targetPoint.coordinates.length === 3) {
      const hight = this._getHight()
      parallelPoint = new Point({
        coordinates: [x, y, hight],
        spatialReference: point.spatialReference
      })
    } else {
      parallelPoint = new Point({
        coordinates: [x, y],
        spatialReference: point.spatialReference
      })
    }

    // const deltaPixel = Math.sqrt(
    //   Math.pow(point.x - x, 2) + Math.pow(point.y - y, 2)
    // )
    const endScreenPoint = this._view.toScreen(parallelPoint)
    const startScreenPoint = this._view.toScreen(targetPoint)
    const deltaPixel = Math.sqrt(
      Math.pow(startScreenPoint.x - endScreenPoint.x, 2) +
        Math.pow(startScreenPoint.y - endScreenPoint.y, 2)
    )
    const valid = deltaPixel &lt;= this.pixelTolerance
    // isTolerance(point, lastPoint, { x, y }, this.pixelTolerance)
    return valid
      ? {
          realPoint: parallelPoint,
          deltaTolerance: deltaPixel
        }
      : null
  }

  /**
   * 获取地理点高度
   * @private
   * @param {Point} point
   * @return {Number} 高度
   */
  _getHight() {
    return 0
  }

  /**
   * 获取描述平行线的特殊符号
   * @private
   * @param {LineString} targetLine
   * @param {Array} lines 被捕获的直线对象
   * @return {Object} 平行线的特殊符号对象
   */
  _getParallelSymbolGeometry(linePoint1, linePoint2) {
    const scale = 1 / 4
    const panPixel = this.pixelTolerance / 2
    const linePointScreen1 = this._view.toScreen(linePoint1)
    const linePointScreen2 = this._view.toScreen(linePoint2)

    const lineScalePoint1 = {
      x:
        ((1 - scale) / 2) * (linePointScreen2.x - linePointScreen1.x) +
        linePointScreen1.x,
      y:
        ((1 - scale) / 2) * (linePointScreen2.y - linePointScreen1.y) +
        linePointScreen1.y
    }
    const lineScalePoint2 = {
      x:
        ((1 + scale) / 2) * (linePointScreen2.x - linePointScreen1.x) +
        linePointScreen1.x,
      y:
        ((1 + scale) / 2) * (linePointScreen2.y - linePointScreen1.y) +
        linePointScreen1.y
    }

    let symbol1ScreenPoint1
    let symbol1ScreenPoint2
    let symbol2ScreenPoint1
    let symbol2ScreenPoint2
    if (lineScalePoint2.x === lineScalePoint1.x) {
      symbol1ScreenPoint1 = {
        x: lineScalePoint1.x + panPixel,
        y: lineScalePoint1.y
      }
      symbol1ScreenPoint2 = {
        x: lineScalePoint2.x + panPixel,
        y: lineScalePoint2.y
      }
      symbol2ScreenPoint1 = {
        x: lineScalePoint1.x - panPixel,
        y: lineScalePoint1.y
      }
      symbol2ScreenPoint2 = {
        x: lineScalePoint2.x - panPixel,
        y: lineScalePoint2.y
      }
    } else if (lineScalePoint2.y === lineScalePoint1.y) {
      symbol1ScreenPoint1 = {
        x: lineScalePoint1.x,
        y: lineScalePoint1.y + panPixel
      }
      symbol1ScreenPoint2 = {
        x: lineScalePoint2.x,
        y: lineScalePoint2.y + panPixel
      }
      symbol2ScreenPoint1 = {
        x: lineScalePoint1.x,
        y: lineScalePoint1.y - panPixel
      }
      symbol2ScreenPoint2 = {
        x: lineScalePoint2.x,
        y: lineScalePoint2.y - panPixel
      }
    } else {
      const symbolK =
        -(lineScalePoint2.x - lineScalePoint1.x) /
        (lineScalePoint2.y - lineScalePoint1.y)
      // const symbolK = -1 / k
      const symbolAngle = Math.atan(symbolK)
      const translatedPoint = function (point, angle, panPixel) {
        const symbol1Center = {
          x: Math.cos(angle) * panPixel + point.x,
          y: Math.sin(angle) * panPixel + point.y
        }
        return symbol1Center
      }
      symbol1ScreenPoint1 = translatedPoint(
        lineScalePoint1,
        symbolAngle,
        panPixel
      )
      symbol1ScreenPoint2 = translatedPoint(
        lineScalePoint2,
        symbolAngle,
        panPixel
      )
      symbol2ScreenPoint1 = translatedPoint(
        lineScalePoint1,
        symbolAngle,
        -panPixel
      )
      symbol2ScreenPoint2 = translatedPoint(
        lineScalePoint2,
        symbolAngle,
        -panPixel
      )
    }
    const symbol1point1 = this._view.toMap(symbol1ScreenPoint1)
    const symbol1point2 = this._view.toMap(symbol1ScreenPoint2)
    const symbol2point1 = this._view.toMap(symbol2ScreenPoint1)
    const symbol2point2 = this._view.toMap(symbol2ScreenPoint2)
    return new MultiLineString({
      coordinates: [
        [symbol1point1.coordinates, symbol1point2.coordinates],
        [symbol2point1.coordinates, symbol2point2.coordinates]
      ]
    })
  }

  _getParallelSymbolGeometry0(targetLine, line) {
    const scale = 1 / 4
    const pan = this.tolerance / 1000
    const translatedLine = function (line, scale, pan) {
      const polyline = turf.lineString(line.coordinates)
      const translatedPolyline = turf.transformTranslate(polyline, pan, 180)
      const scaledLine = turf.transformScale(translatedPolyline, scale)
      return scaledLine.geometry.coordinates
    }
    return new MultiLineString({
      coordinates: [
        translatedLine(targetLine, scale, pan),
        translatedLine(targetLine, scale, -pan),
        translatedLine(line, scale, pan),
        translatedLine(line, scale, -pan)
      ]
    })
  }

  /**
   * 获取目标直线的垂线捕获结果
   * @private
   * @param {Point} targetPoint
   * @param {LineString} targetLine
   * @param {Array} lines 被捕获的直线对象
   * @param {Array} lineSlopes 被捕获的直线斜率
   * @return {Object} 垂线结果
   */
  getPerpendicularLine(targetPoint, targetLine, lines, spatialReference) {
    const perpendicularLines = []
    lines.forEach((line) => {
      const perpendicularResult = this.getParallelPoint(
        targetPoint,
        new Point({
          coordinates: targetLine.coordinates[0],
          spatialReference
        }),
        new Point({
          coordinates: line.coordinates[0],
          spatialReference
        }),
        new Point({
          coordinates: line.coordinates[1],
          spatialReference
        }),
        'perpendicular'
      )
      if (perpendicularResult) {
        const realPoint = perpendicularResult.realPoint
        const symbolGeometry = undefined
        // 暂时屏蔽计算垂足图形方法,方法需进一步修复
        // const symbolGeometry = this.getPerpendicularSymbolGeometry(
        //   new LineString({
        //     coordinates: [targetLine.coordinates[0], realPoint.coordinates],
        //     spatialReference
        //   }),
        //   lines[i],
        //   realPoint
        // )
        perpendicularLines.push({
          line,
          realPoint,
          symbolGeometry,
          deltaTolerance: perpendicularResult.deltaTolerance
        })
      }
    })
    return perpendicularLines.length ? perpendicularLines : undefined
  }

  /**
   * 获取目标点到目标线的垂点对象
   * @private
   * @param {Point} targetPoint 目标点
   * @param {LineString} targetLine 目标线
   * @param {Number} lineSlope 直线斜率
   * @return {Array} 垂点坐标
   */
  _getPerpendicularPoint(targetPoint, targetLine, lineSlope) {
    const delta1 =
      targetLine.coordinates[0][1] - lineSlope * targetLine.coordinates[0][0]
    const delta2 =
      targetPoint.coordinates[1] + (1 / lineSlope) * targetPoint.coordinates[0]
    const x = ((delta2 - delta1) * lineSlope) / (lineSlope * lineSlope + 1)
    const y = (-1 / lineSlope) * x + delta2
    return [x, y]
  }

  /**
   * 获取描述垂线的特殊符号
   * @private
   * @param {LineString} targetLine
   * @param {LineString} line 被捕获的直线对象
   * @param {Point} perpendicularPoint 垂足坐标点
   * @return {Object} 垂线的特殊符号对象
   */
  getPerpendicularSymbolGeometry(targetLine, line, perpendicularPoint) {
    const linePoints1 = [
      turf.point(targetLine.coordinates[0]),
      turf.point(targetLine.coordinates[1])
    ]
    const linePoints2 = [
      turf.point(line.coordinates[0]),
      turf.point(line.coordinates[1])
    ]
    const distance1 = turf.distance(linePoints1[0], linePoints1[1]) // GeometryEngine.geodesicLength(targetLine)
    const distance2 = turf.distance(linePoints2[0], linePoints2[1]) // GeometryEngine.geodesicLength(line)
    const distance = Math.min(distance1, distance2) / 8
    perpendicularPoint = turf.point(perpendicularPoint.coordinates)
    let bearing2 = 0
    if (
      linePoints2[0].geometry.coordinates[0] ===
        perpendicularPoint.geometry.coordinates[0] &amp;&amp;
      linePoints2[0].geometry.coordinates[1] ===
        perpendicularPoint.geometry.coordinates[1]
    ) {
      bearing2 = turf.rhumbBearing(perpendicularPoint, linePoints2[1])
    } else {
      bearing2 = turf.rhumbBearing(perpendicularPoint, linePoints2[0])
    }
    let bearing1 = 0
    if (
      linePoints1[0].geometry.coordinates[0] ===
        perpendicularPoint.geometry.coordinates[0] &amp;&amp;
      linePoints1[0].geometry.coordinates[1] ===
        perpendicularPoint.geometry.coordinates[1]
    ) {
      bearing1 = turf.rhumbBearing(perpendicularPoint, linePoints1[1])
    } else {
      bearing1 = turf.rhumbBearing(perpendicularPoint, linePoints1[0])
    }
    const bearing3 = (bearing1 + bearing2) / 2
    const destination1 = turf.rhumbDestination(
      perpendicularPoint,
      distance,
      bearing1
    )
    const destination2 = turf.rhumbDestination(
      perpendicularPoint,
      distance,
      bearing2
    )
    const destination3 = turf.rhumbDestination(
      perpendicularPoint,
      distance * Math.sqrt(2),
      bearing3
    )
    const point1 = destination1.geometry.coordinates
    const point2 = destination2.geometry.coordinates
    const point3 = destination3.geometry.coordinates
    return new LineString({
      coordinates: [point1, point3, point2]
    })
  }

  /**
   * 正在测试中的方法
   * @private
   */
  getPerpendicularSymbolGeometry2(targetLine, line, perpendicularPoint) {
    let p1 = turf.point(targetLine.coordinates[0])
    if (
      targetLine.coordinates[0][0] === perpendicularPoint.coordinates[0] &amp;&amp;
      targetLine.coordinates[0][1] === perpendicularPoint.coordinates[1]
    ) {
      p1 = turf.point(targetLine.coordinates[1])
    }
    const p2 = turf.point(line.coordinates[0])
    const p3 = turf.point(line.coordinates[1])
    const distance1 = turf.distance(p1, perpendicularPoint)
    const distance2 = turf.distance(p2, perpendicularPoint)
    const distance3 = turf.distance(p3, perpendicularPoint)
    let distance = Math.min(distance1, distance2, distance3) / 8
    if (distance2 === 0) {
      distance = Math.min(distance1, distance3) / 8
    } else if (distance3 === 0) {
      distance = Math.min(distance1, distance2) / 8
    }
    perpendicularPoint = turf.point(perpendicularPoint.coordinates)

    const bearing1 = turf.rhumbBearing(perpendicularPoint, p1)
    const destination1 = turf.rhumbDestination(
      perpendicularPoint,
      distance,
      bearing1
    )
    const bearing2 = turf.rhumbBearing(perpendicularPoint, p2)
    const destination2 = turf.rhumbDestination(
      perpendicularPoint,
      distance,
      bearing2
    )
    const bearing3 = (bearing1 + bearing2) / 2
    const dis = distance * Math.cos(((bearing3 - bearing2) * Math.PI) / 180) * 2
    const destination3 = turf.rhumbDestination(
      perpendicularPoint,
      dis,
      bearing3
    )

    const point1 = destination1.geometry.coordinates
    const point2 = destination2.geometry.coordinates
    const point3 = destination3.geometry.coordinates
    return new LineString({
      coordinates: [point1, point3, point2]
    })
  }

  /**
   *根据垂足获取真正终点位置
   * @private
   * @param {Feature} currentPoint 当前终点
   * @param {Feature} startPoint 线段起点
   * @param {Feature} perpendicularPoint 垂点位置
   */
  getPerpendicularRealPosition(currentPoint, startPoint, perpendicularPoint) {
    let realPosition = null
    const distance = GeometryEngine.distance(startPoint, currentPoint)
    const direction = turf.rhumbBearing(
      turf.point(startPoint.coordinates),
      turf.point(perpendicularPoint.currentPoint)
    )
    realPosition = turf.rhumbDestination(startPoint, distance, direction)
      .geometry.coordinates
    return realPosition
  }

  /**
   *面和线是否相交
   */
  isPolylineCrossPolygon() {}

  /**
   *两个面是否相交
   */
  isPolygonCross() {}
}
export default SketchSnappingTool
</code></pre>
        </article>
    </section>




            </div>
            
            <footer class="footer">
                <div class="content has-text-centered">
                    <p>文档生成<a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.11</a></p>
                    <p class="sidebar-created-by">
                        <a href="http://www.smaryun.com" target="_blank">司马云</a> <span>© 2023 云生态圈</span>
                        <a href="http://192.168.82.89:8086/#/index" target="_blank">MapGIS Client for JavaScript</a>
                    </p>
                </div>
            </footer>
            
        </div>
        <div id="side-nav" class="side-nav">
            <div style="margin-bottom: 10px;">
                <img style="vertical-align: middle;margin-right: 10px;width: 30px;" src="./styles/anchor.png"/><a href="#page-title">构造函数</a>
            </div>
            <div style="margin-bottom: 10px;">
                <img style="vertical-align: middle;margin-right: 10px;width: 30px;" src="./styles/anchor.png"/><a href="#member">成员变量</a>
            </div>
            <div style="margin-bottom: 10px;">
                <img style="vertical-align: middle;margin-right: 10px;width: 30px;" src="./styles/anchor.png"/><a href="#function">方法</a>
            </div>
            <div>
                <img style="vertical-align: middle;margin-right: 10px;width: 30px;" src="./styles/anchor.png"/><a href="#event">事件</a>
            </div>
        </div>
    </div>
<script src="scripts/linenumber.js"> </script>

<script src="scripts/search.js"> </script>

</body>
</html>