@mapgis/webclient-leaflet-plugin
Version:
开发时需要引入MapGIS Client for JavaScript(Leaflet)开发包;其中包括必备的 CSS 文件和 JS 文件;
3,774 lines (1,181 loc) • 84.2 kB
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title> MapView</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="/static/modules/common/api/common-mapgis/index.html"
>
Common
</a>
<a
class="link user-link "
href="/static/modules/cesium/api/cesium-mapgis/index.html"
>
Cesium-Plugin
</a>
<a
class="link user-link "
href="/static/modules/mapboxgl/api/mapboxgl-mapgis/index.html"
>
MapboxGL-Plugin
</a>
<a
class="link user-link "
href="/static/modules/leaflet/api/leaflet-mapgis/index.html"
>
Leaflet-Plugin
</a>
<a
class="link user-link "
href="/static/modules/openlayers/api/openLayers-mapgis/index.html"
>
OpenLayers-Plugin
</a>
<a
class="link user-link "
href="/static/modules/video/api/video-mapgis/index.html"
>
Video-Plugin
</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 style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title="ArcGISMapImageLayer"><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地图图片图层(Leaflet)</p></span></li><li style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title="ArcGISTileLayer"><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瓦片图层(Leaflet)</p></span></li><li style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title="EchartsLayer"><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图层(Leaflet)</p></span></li><li style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title="FeatureLayer"><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>要素图层(Leaflet)</p></span></li><li style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title="IGSMapImageLayer"><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>地图图片图层(Leaflet)</p></span></li><li style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title="IGSTileLayer"><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瓦片图层(Leaflet)</p></span></li><li style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title="MapLayer"><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="MapLayer.html">MapLayer</a><span style="display: none;"><p>屏幕出一张图图层基类</p></span></li><li style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title="MapVLayer"><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图层(Leaflet)</p></span></li><li style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title="TileLayer"><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 style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title="TileLayerWMS"><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="TileLayerWMS.html">TileLayerWMS</a><span style="display: none;"><p>WMS图层基类(相比于原生的L.TileLayer.WMS, 此图层支持空间裁剪功能)</p></span></li><li style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title="VectorTileLayer"><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>矢量瓦片图层(Leaflet)</p></span></li><li style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title="WebMapServiceLayer"><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="WebMapServiceLayer.html">WebMapServiceLayer</a><span style="display: none;"><p>WMS图层(Leaflet)</p></span></li><li style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title="WebMapTileServiceLayer"><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="WebMapTileServiceLayer.html">WebMapTileServiceLayer</a><span style="display: none;"><p>WMTS图层(Leaflet)</p></span></li><li style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title="WebTileLayer"><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="WebTileLayer.html">WebTileLayer</a><span style="display: none;"><p>网络瓦片图层(Leaflet)</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 style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title="FeatureLayerUtil"><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="FeatureLayerUtil.html">FeatureLayerUtil</a><span style="display: none;"><p>要素图层工具类(Leaflet)</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 style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title="MapView"><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引擎),对地图引擎进行管理,如果要对地图图层进行管理请参考<code>Map</code>,<br/>
继承自<a href='http://webclient.smaryun.com/static/modules/common/api/common-mapgis/MapView.html' target='_blank'>zondy.MapView</a><br/>
参考示例:
<a href='#MapView'>[初始化二维场景视图]</a>
<br>[ES5引入方式]:<br/>
zondy.leaflet.MapView() <br/>
[ES6引入方式]:<br/>
import { MapView } from '@mapgis/webclient-leaflet-plugin' <br/></p></span></li><li style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title="Popup"><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><li style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title="Screenshot"><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 style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title="SketchEditor"><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>二维Leaflet引擎草图编辑类<br/>
继承自<a href='http://webclient.smaryun.com/static/modules/common/api/common-mapgis/SketchEditor.html' target='_blank'>zondy.SketchEditor</a><br/>
<br>[ES5引入方式]:<br/>
const { SketchEditor } = zondy.leaflet.tool.sketch <br/>
[ES6引入方式]:<br/>
import { SketchEditor } from "@mapgis/webclient-leaflet-plugin" <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 style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title="zondy.themelayer.GraphThemeLayer"><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>
</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">MapView</span>
</header>
<section>
<article>
<div class="container-overview">
<div class='vertical-section'>
<div class="members">
<div class="member">
<h4 class="name" id="MapView">
<a class="href-link" href="#MapView">#</a>
<span class="code-name" style="font-size:30px">
new MapView<span class="signature">(options)</span>
</span>
</h4>
<div class="description">
<p>二维场景视图(leaflet引擎),对地图引擎进行管理,如果要对地图图层进行管理请参考<code>Map</code>,<br/>
继承自<a href='http://webclient.smaryun.com/static/modules/common/api/common-mapgis/MapView.html' target='_blank'>zondy.MapView</a><br/>
参考示例:
<a href='#MapView'>[初始化二维场景视图]</a>
<br>[ES5引入方式]:<br/>
zondy.leaflet.MapView() <br/>
[ES6引入方式]:<br/>
import { MapView } from '@mapgis/webclient-leaflet-plugin' <br/></p>
</div>
<h4>参数:</h4>
<div class="table-container">
<table class="params table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th style="min-width: 100px;">默认值</th>
<th class="last">描述</th>
</tr>
</thead>
<tbody>
<tr class="deep-level-0">
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="default">
</td>
<td class="description last"><p>构造参数</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>Map</code></td>
<td class="type">
<span class="param-type">Map</span>
</td>
<td class="default">
</td>
<td class="description last"><p>图层管理容器对象</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>viewId</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="default">
</td>
<td class="description last"><p>二维场景视图的容器(html的div标签)ID</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>limitedMinZoom</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="default">
</td>
<td class="description last"><p>视图加载最小缩放级数</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>zoom</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="default">
1
</td>
<td class="description last"><p>初始化二维场景视图时显示级数</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>attributionControl</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="default">
false
</td>
<td class="description last"><p>是否显示右下角水印</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>zoomControl</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="default">
true
</td>
<td class="description last"><p>是否显示缩放控件</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>doubleClickZoom</code></td>
<td class="type">
<span class="param-type">Boolean</span>
|
<span class="param-type">String</span>
</td>
<td class="default">
true
</td>
<td class="description last"><p>是否允许双击鼠标左键缩放或者缩放至图层中心点</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>dragging</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="default">
true
</td>
<td class="description last"><p>是否允许拖拽</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>zoomSnap</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="default">
1
</td>
<td class="description last"><p>当使用flyTo缩放至中心点时,缩放级数乘以的系数,默认值为1</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>zoomDelta</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="default">
1
</td>
<td class="description last"><p>当触发zoomIn或者zoomOut操作时,缩放级数乘以的系数,默认值为1</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>trackResize</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="default">
true
</td>
<td class="description last"><p>是否允许图层大小随视窗变化</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>keyboard</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="default">
true
</td>
<td class="description last"><p>是否允使用键盘的+/-号,来缩放地图</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>keyboardPanDelta</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="default">
80
</td>
<td class="description last"><p>使用键盘来平移或缩放地图时的系数,单位px</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>scrollWheelZoom</code></td>
<td class="type">
<span class="param-type">Boolean</span>
|
<span class="param-type">String</span>
</td>
<td class="default">
true
</td>
<td class="description last"><p>使用键盘来平移或缩放地图时的系数,单位px</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>wheelDebounceTime</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="default">
40
</td>
<td class="description last"><p>滚轮事件的触发事件,单位毫秒</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>wheelPxPerZoomLevel</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="default">
60
</td>
<td class="description last"><p>滚轮缩放时,地图缩放的像素单位,单位像素</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>tapHold</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="default">
true
</td>
<td class="description last"><p>是否开启移动端,手指按压不放事件</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>tapTolerance</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="default">
15
</td>
<td class="description last"><p>手指有效触发范围,单位像素</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>touchZoom</code></td>
<td class="type">
<span class="param-type">Boolean</span>
|
<span class="param-type">String</span>
</td>
<td class="default">
true
</td>
<td class="description last"><p>是否启用手指两指缩放,当值为center,表示两只滑动,缩放至地图中心</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>bounceAtZoomLimits</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="default">
true
</td>
<td class="description last"><p>当过最大或最小级数后不再缩放</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>animation</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="default">
true
</td>
<td class="description last"><p>是否启用动画</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>center</code></td>
<td class="type">
<span class="param-type">Point</span>
</td>
<td class="default">
new Point({coordinates:[0,0]})
</td>
<td class="description last"><p>地图视图中心点</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>extent</code></td>
<td class="type">
<span class="param-type">Extent</span>
</td>
<td class="default">
</td>
<td class="description last"><p>地图视图可视范围</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>scale</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="default">
</td>
<td class="description last"><p>地图视图比例尺(比例尺的分母)</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>maxScale</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="default">
</td>
<td class="description last"><p>地图视图的最大比例尺(比例尺的分母,该值越小,比例尺越大)。视图的当前比列尺不会大于地图视图的最大比例尺。默认值为undefined,undefined表示用户未设置,视图的最大比例尺不受限制。maxScale的值应该始终小于minScale的值。</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>minScale</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="default">
</td>
<td class="description last"><p>地图视图的最小比例尺(比例尺的分母,该值越大,比例尺越小)。视图的当前比列尺不会小于地图视图的最小比例尺。默认值为undefined,undefined表示用户未设置,地图视图会根据全图范围,计算视图的最小比例尺。如果用户设置了该值,则地图将直接采用用户设置的值。minScale的值应该始终大于maxScale的值。</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>popup</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="default">
</td>
<td class="description last"><p>地图弹框</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>rotation</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="default">
0
</td>
<td class="description last"><p>地图视图旋转选项。单位为度,默认为0,表示不进行旋转</p></td>
</tr>
</tbody>
</table>
</div>
<dl class="details">
</dl>
<div class="method-parameter columns">
<div class="column is-2"><label>绑定事件:</label></div>
<div class="column is-10">
<ul>
<li>BaseView#event:地图视图加载完毕事件</li>
<li>BaseView#event:鼠标点击事件</li>
<li>BaseView#event:鼠标双击事件</li>
<li>BaseView#event:鼠标按下事件</li>
<li>BaseView#event:鼠标抬起事件</li>
<li>BaseView#event:鼠标右键点击事件</li>
<li>BaseView#event:鼠标移动事件</li>
<li>BaseView#event:鼠标移出视图事件</li>
<li>BaseView#event:鼠标移入视图事件</li>
<li>BaseView#event:zoom变化事件</li>
<li>BaseView#event:地图移动事件</li>
<li>BaseView#event:地图大小变化事件</li>
<li>BaseView#event:键盘输入事件</li>
<li>BaseView#event:键盘按下事件</li>
<li>BaseView#event:键盘抬起事件</li>
<li>BaseView#event:地图视图改变事件</li>
</ul>
</div>
</div>
<p class="summary"><h5>支持如下方法:</h5>
<a href='#flyTo'>[1、视点跳转]</a><br/>
<a href='#destroy'>[2、销毁视图对象]</a><br/>
<a href='#getCenter'>[3、获取当前视图的中心点]</a><br/>
<a href='#getPixelCenter'>[3、获取当前视图的像素中心点]</a><br/>
<a href='#getZoom'>[4、获取当前缩放级数]</a><br/>
<a href='#getExtent'>[5、获取当前视图的地理范围]</a><br/>
<a href='#getPixelWorldExtent'>[6、获取当前视图的像素范围]</a><br/>
<a href='#getMinZoom'>[7、获取最小缩放级数]</a><br/>
<a href='#getMaxZoom'>[8、获取最大缩放级数]</a><br/>
<a href='#getSize'>[9、获取当前视图容器的宽高]</a><br/>
<a href='#toJSON'>[10、导出场景视图的配置文件]</a><br/>
<a href='#clone'>[11、克隆并返回一个新的场景视图对象]</a><br/>
<a href='#fromJSON'>[12、通过json构造并返回一个新的场景视图对象]</a><br/>
<a href='#takeScreenshot'>[13、屏幕快照]</a><br/>
<code>14、注册事件</code><br/>
<code>15、移除事件</code><br/>
<a href='#toMap'>[15、屏幕像素坐标点转地理坐标点]</a><br/>
<a href='#toScreen'>[16、地理坐标点转屏幕像素坐标点]</a><br/>
<a href='#hitTest'>[17、穿透检测]</a><br/>
<a href='#getLayer'>[18、根据实际图层对象查询并返回基础图层]</a><br/>
<a href='#getScale'>[19、获取当前比例尺]</a><br/></p>
<h5>示例</h5>
<p class="code-caption"><h7 id='MapView'>初始化一个二维场景视图</h7></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Map } = zondy
const { MapView } = zondy.leaflet
// ES6引入方式
import { Map } from "@mapgis/webclient-common"
import { MapView } from "@mapgis/webclient-leaflet-plugin"
// 初始化图层管理容器
const map = new Map();
// 初始化地图视图对象
const mapView = new MapView({
// 二维场景视图的容器(html的div标签)ID
viewId: "二维场景视图的容器的id",
// 图层管理容器
map: map
});</code></pre>
</div>
</div>
</div>
</div>
<h3 class="subsection-title">继承关系</h3>
<ul>
<li>zondy.MapView</li>
</ul>
<div class='vertical-section'>
<h3 id='member'>成员变量</h3>
<div class="members">
<div class="member">
<span class="method-parameter is-pulled-right">
<label>类型:</label>
<span class="param-type">Boolean</span>
</span>
<h4 class="name" id="animation">
<a class="href-link" href="#animation">#</a>
<span class="code-name">
animation
</span>
</h4>
<div class="description">
<p>是否启用视角跳转动画</p>
</div>
<dl class="details">
</dl>
</div>
<div class="member">
<span class="method-parameter is-pulled-right">
<label>类型:</label>
<span class="param-type">Point</span>
</span>
<h4 class="name" id="center">
<a class="href-link" href="#center">#</a>
<span class="code-name">
center
</span>
</h4>
<div class="description">
<p>地图视图中心点</p>
</div>
<dl class="details">
</dl>
</div>
<div class="member">
<span class="method-parameter is-pulled-right">
<label>类型:</label>
<span class="param-type">Object</span>
</span>
<h4 class="name" id="engineType">
<a class="href-link" href="#engineType">#</a>
<span class='tag'>readonly</span>
<span class="code-name">
engineType
</span>
</h4>
<div class="description">
<p>引擎类型,为'leaflet'</p>
</div>
<dl class="details">
</dl>
</div>
<div class="member">
<span class="method-parameter is-pulled-right">
<label>类型:</label>
<span class="param-type">Extent</span>
</span>
<h4 class="name" id="extent">
<a class="href-link" href="#extent">#</a>
<span class="code-name">
extent
</span>
</h4>
<div class="description">
<p>地图视图可视范围</p>
</div>
<dl class="details">
</dl>
</div>
<div class="member">
<span class="method-parameter is-pulled-right">
<label>类型:</label>
<span class="param-type">Extent</span>
</span>
<h4 class="name" id="fullExtent">
<a class="href-link" href="#fullExtent">#</a>
<span class="code-name">
fullExtent
</span>
</h4>
<div class="description">
<p>地图视图最大显示范围。用户不设置时,将地图范围作为地图视图的最大显示范围,用户设置时采用用户设置的。地图视图初始化时,会根据此范围计算地图视图的最小比例尺,当瓦片数据的最大比例尺小于此比例尺时,无法显示。在相同视图大小下,fullExtent越大,地图视图的最小比例尺越小。</p>
</div>
<dl class="details">
</dl>
</div>
<div class="member">
<span class="method-parameter is-pulled-right">
<label>类型:</label>
<span class="param-type">Number</span>
</span>
<h4 class="name" id="height">
<a class="href-link" href="#height">#</a>
<span class='tag'>readonly</span>
<span class="code-name">
height
</span>
</h4>
<div class="description">
<p>地图视图高度</p>
</div>
<dl class="details">
</dl>
</div>
<div class="member">
<span class="method-parameter is-pulled-right">
<label>类型:</label>
<span class="param-type">Number</span>
</span>
<h4 class="name" id="maxScale">
<a class="href-link" href="#maxScale">#</a>
<span class="code-name">
maxScale
</span>
</h4>
<div class="description">
<p>地图视图的最大比例尺(比例尺的分母,该值越小,比例尺越大)。视图的当前比列尺不会大于地图视图的最大比例尺。默认值为undefined,undefined表示用户未设置,视图的最大比例尺不受限制。maxScale的值应该始终小于minScale的值。</p>
</div>
<dl class="details">
</dl>
</div>
<div class="member">
<span class="method-parameter is-pulled-right">
<label>类型:</label>
<span class="param-type">Number</span>
</span>
<h4 class="name" id="minScale">
<a class="href-link" href="#minScale">#</a>
<span class="code-name">
minScale
</span>
</h4>
<div class="description">
<p>地图视图的最小比例尺(比例尺的分母,该值越大,比例尺越小)。视图的当前比列尺不会小于地图视图的最小比例尺。默认值为undefined,undefined表示用户未设置,地图视图会根据全图范围,计算视图的最小比例尺。如果用户设置了该值,则地图将直接采用用户设置的值。minScale的值应该始终大于maxScale的值。</p>
</div>
<dl class="details">
</dl>
</div>
<div class="member">
<span class="method-parameter is-pulled-right">
<label>类型:</label>
<span class="param-type"><a href="Popup.html">Popup</a></span>
</span>
<h4 class="name" id="popup">
<a class="href-link" href="#popup">#</a>
<span class="code-name">
popup
</span>
</h4>
<div class="description">
<p>地图视图弹框popup</p>
</div>
<dl class="details">
</dl>
</div>
<div class="member">
<span class="method-parameter is-pulled-right">
<label>类型:</label>
<span class="param-type">Boolean</span>
</span>
<h4 class="name" id="preferCanvas">
<a class="href-link" href="#preferCanvas">#</a>
<span class="code-name">
preferCanvas
</span>
</h4>
<div class="description">
<p>视图渲染方式是否为canvas</p>
</div>
<dl class="details">
</dl>
</div>
<div class="member">
<span class="method-parameter is-pulled-right">
<label>类型:</label>
<span class="param-type">Boolean</span>
</span>
<h4 class="name" id="rotation">
<a class="href-link" href="#rotation">#</a>
<span class="code-name">
rotation
</span>
</h4>
<div class="description">
<p>地图视图旋转选项。单位为度,默认为0,表示不进行旋转</p>
</div>
<dl class="details">
</dl>
</div>
<div class="member">
<span class="method-parameter is-pulled-right">
<label>类型:</label>
<span class="param-type">Number</span>
</span>
<h4 class="name" id="scale">
<a class="href-link" href="#scale">#</a>
<span class="code-name">
scale
</span>
</h4>
<div class="description">
<p>地图视图比例尺(比例尺的分母)</p>
</div>
<dl class="details">
</dl>
</div>
<div class="member">
<span class="method-parameter is-pulled-right">
<label>类型:</label>
<span class="param-type">SpatialReference</span>
</span>
<h4 class="name" id="spatialReference">
<a class="href-link" href="#spatialReference">#</a>
<span class='tag'>readonly</span>
<span class="code-name">
spatialReference
</span>
</h4>
<div class="description">
<p>视图空间参考系</p>
</div>
<dl class="details">
</dl>
</div>
<div class="member">
<span class="method-parameter is-pulled-right">
<label>类型:</label>
<span class="param-type">Boolean</span>
</span>
<h4 class="name" id="spatialReferenceLocked">
<a class="href-link" href="#spatialReferenceLocked">#</a>
<span class="code-name">
spatialReferenceLocked
</span>
</h4>
<div class="description">
<p>是否锁定视图空间参考系</p>
</div>
<dl class="details">
</dl>
</div>
<div class="member">
<span class="method-parameter is-pulled-right">
<label>类型:</label>
<span class="param-type">Boolean</span>
</span>
<h4 class="name" id="stationary">
<a class="href-link" href="#stationary">#</a>
<span class='tag'>readonly</span>
<span class="code-name">
stationary
</span>
</h4>
<div class="description">
<p>试图是否静止</p>
</div>
<dl class="details">
</dl>
</div>
<div class="member">
<span class="method-parameter is-pulled-right">
<label>类型:</label>
<span class="param-type">Number</span>
</span>
<h4 class="name" id="width">
<a class="href-link" href="#width">#</a>
<span class='tag'>readonly</span>
<span class="code-name">
width
</span>
</h4>
<div class="description">
<p>地图视图宽度</p>
</div>
<dl class="details">
</dl>
</div>
<div class="member">
<span class="method-parameter is-pulled-right">
<label>类型:</label>
<span class="param-type">Number</span>
</span>
<h4 class="name" id="zoom">
<a class="href-link" href="#zoom">#</a>
<span class="code-name">
zoom
</span>
</h4>
<div class="description">
<p>视图层级</p>
</div>
<dl class="details">
</dl>
</div>
</div>
</div>
<div class='vertical-section'>
<h3 id='function'>方法</h3>
<div class="members">
<div class="member">
<h4 class="name" id=".fromJSON">
<a class="href-link" href="#.fromJSON">#</a>
<span class='tag'>static</span>
<span class="code-name" style="font-size:30px">
fromJSON<span class="signature">(json)</span>
</span>
</h4>
<div class="description">
<p>通过json构造并返回一个新的场景视图对象<a id='fromJSON'></a></p>
</div>
<h4>参数:</h4>
<div class="table-container">
<table class="params table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th class="last">描述</th>
</tr>
</thead>
<tbody>
<tr class="deep-level-0">
<td class="name"><code>json</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last"><p>json对象</p></td>
</tr>
</tbody>
</table>
</div>
<dl class="details">
</dl>
<div class='columns method-parameter'>
<div class="column is-2"><label>返回值:</label></div>
<div class="column is-10">
<div class="columns">
<div class='param-desc column is-7'><p>一个新的场景视图对象</p></div>
<div class='column is-5 has-text-left'>
<label>类型: </label>
<span class="param-type"><a href="MapView.html">MapView</a></span>
</div>
</div>
</div>
</div>
</div>
<div class="member">
<h4 class="name" id=".fromJSON">
<a class="href-link" href="#.fromJSON">#</a>
<span class='tag'>static</span>
<span class="code-name" style="font-size:30px">
fromJSON<span class="signature">(json)</span>
</span>
</h4>
<div class="description">
<p>通过一个配置生成一个场景视图对象</p>
</div>
<h4>参数:</h4>
<div class="table-container">
<table class="params table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th class="last">描述</th>
</tr>
</thead>
<tbody>
<tr class="deep-level-0">
<td class="name"><code>json</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last"><p>场景视图配置</p></td>
</tr>
</tbody>
</table>
</div>
<dl class="details">
</dl>
<div class='columns method-parameter'>
<div class="column is-2"><label>返回值:</label></div>
<div class="column is-10">
<div class="columns">
<div class='column is-5 has-text-left'>
<label>类型: </label>
<span class="param-type"><a href="MapView.html">MapView</a></span>
</div>
</div>
</div>
</div>
</div>
<div class="member">
<h4 class="name" id="clone">
<a class="href-link" href="#clone">#</a>
<span class="code-name" style="font-size:30px">
clone<span class="signature">()</span>
</span>
</h4>
<div class="description">
<p>克隆并返回一个新的视图对象<a id='clone'></a></p>
</div>
<dl class="details">
</dl>
<div class='columns method-parameter'>
<div class="column is-2"><label>返回值:</label></div>
<div class="column is-10">
<div class="columns">
<div class='param-desc column is-7'><p>一个新的场景视图对象</p></div>
<div class='column is-5 has-text-left'>
<label>类型: </label>
<span class="param-type"><a href="MapView.html">MapView</a></span>
</div>
</div>
</div>
</div>
</div>
<div class="member">
<h4 class="name" id="destroy">
<a class="href-link" href="#destroy">#</a>
<span class="code-name" style="font-size:30px">
destroy<span class="signature">()</span>
</span>
</h4>
<div class="description">
<p>销毁视图对象<a id='destroy'></a></p>
</div>
<dl class="details">
</dl>
</div>
<div class="member">
<h4 class="name" id="flyTo">
<a class="href-link" href="#flyTo">#</a>
<span class="code-name" style="font-size:30px">
flyTo<span class="signature">(options)</span>
</span>
</h4>
<div class="description">
<p>视点跳转<a id='flyTo'></a></p>
</div>
<h4>参数:</h4>
<div class="table-container">
<table class="params table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th style="min-width: 100px;">默认值</th>
<th class="last">描述</th>
</tr>
</thead>
<tbody>
<tr class="deep-level-0">
<td class="name"><code>options</code></td>
<td class="type">
</td>
<td class="default">
</td>
<td class="description last"><p>跳转参数</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>center</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="default">
</td>
<td class="description last"><p>跳转中心点</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>zoom</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="default">
1
</td>
<td class="description last"><p>地图层级</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>extent</code></td>
<td class="type">
<span class="param-type">Extent</span>
</td>
<td class="default">
</td>
<td class="description last"><p>按范围跳转</p></td>
</tr>
</tbody>
</table>
</div>
<dl class="details">
</dl>
<h5>示例</h5>
<p class="code-caption"><h7>中心点跳转示例</h7></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Map } = zondy
const { MapView } = zondy.leaflet
// ES6引入方式
import { Map } from "@mapgis/webclient-common"
import { MapView } from "@mapgis/webclient-leaflet-plugin"
// 初始化图层管理容器
map = new .Map();
// 初始化地图视图对象
mapView = new MapView({
// 视图id
viewId: "view-id",
// 图层管理容器
map: map
});
// 视点跳转
mapView.flyTo({
// 跳转中心点
center: [{x}, {y}],
// 地图层级
zoom: {zoom}
});</code></pre>
<p class="code-caption"><h7>按范围跳转示例</h7></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Map } = zondy
const { Extent } = zondy.geometry
const { MapView } = zondy.leaflet
// ES6引入方式
import { Map, Extent } from "@mapgis/webclient-common"
import { MapView } from "@mapgis/webclient-leaflet-plugin"
// 初始化图层管理容器
map = new Map();
// 初始化地图视图对象
mapView = new MapView({
// 视图id
viewId: "view-id",
// 图层管理容器
map: map
});
mapView.flyTo({
// 范围几何
extent: new Extent({
"xmin":10,
"xmax":210,
"ymin":0,
"ymax":100,
})
});</code></pre>
<p class="code-caption"><h7>按范围跳转示例-拿到图层信息后跳转</h7></p>
<pre class="prettyprint"><code>// ES5引入方式
const { IGSMapImageLayer } = zondy.layer
// ES6引入方式
import { IGSMapImageLayer } from "@mapgis/webclient-common"
const igsMapImageLayer = new IGSMapImageLayer({
url: 'http://192.168.82.89:8089/igs/rest/services/Map/Hubei4326/MapServer'
});
map.add(igsMapImageLayer);
// 图层加载完毕
igsMapImageLayer.on('layer-view-created', function (result) {
console.log("加载完毕:", result.layer)
//视点跳转
mapView.flyTo({
extent: result.layer.extent
});
})</code></pre>
</div>
<div class="member">
<h4 class="name" id="getCenter">
<a class="href-link" href="#getCenter">#</a>
<span class="code-name" style="font-size:30px">
getCenter<span class="signature">()</span>
</span>
</h4>
<div class="description">
<p>获取当前视图的中心点<a id='getCenter'></a></p>
</div>
<dl class="details">
</dl>
<div class='columns method-parameter'>
<div class="column is-2"><label>返回值:</label></div>
<div class="column is-10">
<div class="columns">
<div class='param-desc column is-7'><p>中心点对象</p></div>
<div class='column is-5 has-text-left'>
<label>类型: </label>
<span class="param-type">Object</span>
</div>
</div>
</div>
</div>
</div>
<div class="member">
<h4 class="name" id="getExtent">
<a class="href-link" href="#getExtent">#</a>
<span class="code-name" style="font-size:30px">
getExtent<span class="signature">()</span>
</span>
</h4>
<div class="description">
<p>获取当前视图的地理范围<a id='getExtent'></a></p>
</div>
<dl class="details">
</dl>
<div class='columns method-parameter'>
<div class="column is-2"><label>返回值:</label></div>
<div class="column is-10">
<div class="columns">
<div class='param-desc column is-7'><p>获取当前视图的地理范围</p></div>
<div class='column is-5 has-text-left'>
<label>类型: </label>
<span class="param-type">Extent</span>
</div>
</div>
</div>
</div>
</div>
<div class="member">
<h4 class="name" id="getMaxZoom">
<a class="href-link" href="#getMaxZoom">#</a>
<span class="code-name" style="font-size:30px">
getMaxZoom<span class="signature">()</span>
</span>
</h4>
<div class="description">
<p>获取最大缩放级数<a id='getMaxZoom'></a></p>
</div>
<dl class="details">
</dl>
<div class='columns method-parameter'>
<div class="column is-2"><label>返回值:</label></div>
<div class="column is-10">
<div class="columns">
<div class='param-desc column is-7'><p>最大缩放级数</p></div>
<div class='column is-5 has-text-left'>
<label>类型: </label>
<span class="param-type">Number</span>
</div>
</div>
</div>
</div>
</div>
<div class="member">
<h4 class="name" id="getMinZoom">
<a class="href-link" href="#getMinZoom">#</a>
<span class="code-name" style="font-size:30px">
getMinZoom<span class="signature">()</span>
</span>
</h4>
<div class="description">
<p>获取最小缩放级数<a id='getMinZoom'></a></p>
</div>
<dl class="details">
</dl>
<div class='columns method-parameter'>
<div class="column is-2"><label>返回值:</label></div>
<div class="column is-10">
<div class="columns">
<div class='param-desc column is-7'><p>最小缩放级数</p></div>
<div class='column is-5 has-text-left'>
<label>类型: </label>
<span class="param-type">Number</span>
</div>
</div>
</div>
</div>
</div>
<div class="member">
<h4 class="name" id="getPixelCenter">
<a class="href-link" href="#getPixelCenter">#</a>
<span class="code-name" style="font-size:30px">
getPixelCenter<span class="signature">()</span>
</span>
</h4>
<div class="description">
<p>获取当前视图的像素中心点<a id='getPixelCenter'></a></p>
</div>
<dl class="details">