# 目录

# Map

扩展事件

Map对象代表您页面上的地图。它公开了使您能够以编程方式更改地图的方法和属性,并在用户与其交互时触发事件。

您可以Map通过指定 container和其他选项来创建。然后初始化页面上的地图并返回您的Map 对象。

# Parameters

  • options Object
    • options.container ( HTMLElement| string) 将在其中呈现地图的 HTML 元素,或元素的 string id。指定的元素必须没有子元素。
    • options.minZoom **number**地图的最小缩放级别 (0-24)。(可选,默认0
    • options.maxZoom **number**地图的最大缩放级别 (0-24)。(可选,默认22
    • options.minPitch **number**地图的最小倾斜角度 (0-85)。(可选,默认0
    • options.maxPitch **number**地图的最大倾斜角度(0-85)。(可选,默认85
    • options.style **( Object| string)?**地图的样式。
    • options.hash **( boolean| string)**如果true,则地图的位置(缩放、中心纬度、中心经度、方位角和俯仰角)将与页面 URL 的哈希片段同步。例如,http://path/to/my/page.html#2.59/39.26/53.07/-24.1/60。可以选择提供附加字符串来指示参数样式的哈希,例如http://path/to/my/page.html#map=2.59/39.26/53.07/-24.1/60&foo=bar,其中 foo 是自定义参数, bar 是与地图哈希不同的任意哈希。(可选,默认false
    • options.interactive **boolean**如果false,则不会将鼠标、触摸或键盘侦听器附加到地图,因此它不会响应交互。(可选,默认true
    • options.bearingSnap **number**阈值(以度为单位),用于确定地图的方位何时向北对齐。例如,当 bearingSnap为 7 时,如果用户在北纬 7 度范围内旋转地图,地图将自动对齐到正北。(可选,默认7
    • options.pitchWithRotate **boolean**如果false,地图的俯仰(倾斜)控制与“拖动旋转”交互将被禁用。(可选,默认true
    • options.clickTolerance **number**用户可以在单击期间移动鼠标指针以将其视为有效单击(与鼠标拖动相反)的最大像素数。(可选,默认3
    • options.attributionControl **boolean**如果true,一个AttributionControl将被添加到地图中。(可选,默认true
    • options.customAttribution **( string| Array< string>)?**在AttributionControl 中显示的一个或多个字符串。仅适用于采用options.attributionControltrue
    • options.logoPosition **string**一个字符串,表示文字标记在地图上的位置。有效选项为top-lefttop-rightbottom-leftbottom-right。(可选,默认'bottom-left'
    • options.failIfMajorPerformanceCaveat **boolean**如果true,如果性能比预期的差很多(即使用软件渲染器),地图创建将失败。(可选,默认false
    • options.preserveDrawingBuffer **boolean**如果true,则可以使用 将地图的画布导出为 PNG map.getCanvas().toDataURL()。这是false默认的性能优化。(可选,默认false
    • options.antialias boolean? 如果true,将使用 MSAA 抗锯齿创建上下文,这对于抗锯齿自定义图层很有用。这是false默认的性能优化。
    • options.refreshExpiredTiles **boolean**如果false,地图将不会尝试重新请求图块,一旦它们根据其 HTTP cacheControl/expires标头过期。(可选,默认true
    • options.maxBounds LngLatBoundsLike ? 如果设置,地图将被限制在给定的范围内。
    • options.scrollZoom **( boolean| Object)**如果true,则启用“滚动缩放”交互。一个Object值作为选项传递给ScrollZoomHandler#enable。(可选,默认true
    • options.boxZoom **boolean**如果true,则启用“框缩放”交互(请参阅BoxZoomHandler)。(可选,默认true
    • options.dragRotate **boolean**如果true,则启用“拖动旋转”交互(请参阅DragRotateHandler)。(可选,默认true
    • options.dragPan **( boolean| Object)**如果true,则启用“拖动平移”交互。一个Object值作为选项传递给DragPanHandler#enable。(可选,默认true
    • options.keyboard **boolean**如果true,则启用键盘快捷键(请参阅KeyboardHandler)。(可选,默认true
    • options.doubleClickZoom **boolean**如果true,则启用“双击缩放”交互(请参阅DoubleClickZoomHandler)。(可选,默认true
    • options.touchZoomRotate **( boolean| Object)**如果true,则启用“捏合旋转和缩放”交互。一个Object值作为选项传递给TouchZoomRotateHandler#enable。(可选,默认true
    • options.touchPitch **( boolean| Object)**如果true,则启用“拖动到音调”交互。一个Object值作为选项传递给TouchPitchHandler#enable。(可选,默认true
    • options.trackResize **boolean**如果true,则当浏览器窗口调整大小时,地图将自动调整大小。(可选,默认true
    • options.center **LngLatLike**地图的初始地理中心点。如果center未在构造函数选项中指定, 将在地图的样式对象中查找它。如果样式中也没有指定,则默认为[0, 0]注意:地图使用经度、纬度坐标顺序(相对于纬度、经度)来匹配 GeoJSON。(可选,默认[0,0]
    • options.zoom **number**地图的初始缩放级别。如果zoom未在构造函数选项中指定,将在地图的样式对象中查找它。如果样式中也没有指定,则默认为0. (可选,默认0
    • options.bearing **number**地图的初始方位(旋转),以北为逆时针方向测量的度数。如果bearing未在构造函数选项中指定,将在地图的样式对象中查找它。如果样式中也没有指定,则默认为0. (可选,默认0
    • options.pitch **number**地图的初始倾斜度(倾斜度),以距屏幕平面 (0-85) 的度数为单位。如果pitch未在构造函数选项中指定,将在地图的样式对象中查找它。如果样式中也没有指定,则默认为0. (可选,默认0
    • options.bounds LngLatBoundsLike ? 地图的初始边界。如果bounds指定,它将覆盖centerzoom构造函数选项。
    • options.fitBoundsOptions Object?地图#fitBounds选项对象使用_仅_拟合初始时bounds的上方。
    • options.optimizeForTerrain **boolean**启用地形时,如果true,地图将呈现性能优先级,这可能会导致图层重新排序以最大化性能(将首先绘制覆盖在地形上的图层,包括填充、线条、背景、山体阴影和栅格)。否则,如果设置为false,地图将始终按图层顺序优先级绘制。(可选,默认true
    • options.renderWorldCopies **boolean**如果true,世界的多个副本将在超过 -180 度和 180 度经度的范围内并排呈现。如果设置为false:- 当地图缩小到足以使世界的单个表示无法填满地图的整个容器时,超过 180 度和 -180 度经度将出现空白。
      • 在每个缩放级别,跨越 180 度和 -180 度经度的要素将被切成两部分(一部分位于地图的右边缘,另一部分位于地图的左边缘)。(可选,默认true
    • options.maxTileCacheSize **number**存储在给定源的切片缓存中的最大切片数。如果省略,缓存将根据当前视口动态调整大小。(可选,默认null
    • options.localIdeographFontFamily **string**定义一个 CSS 字体系列,用于在“CJK 统一表意文字”、“平假名”、“片假名”和“韩文音节”范围内本地覆盖生成字形。在这些范围内,地图样式的字体设置将被忽略,除了字体粗细关键字(light/regular/medium/bold)。设置为false, 以针对这些字形范围启用地图样式的字体设置。此选项的目的是避免带宽密集型字形服务器请求。(请参阅使用本地生成的表意文字.)(可选,默认'sans-serif'
    • options.localFontFamily **string**定义一个 CSS 字体系列,用于本地覆盖所有字形的生成。除了字体粗细关键字(light/regular/medium/bold)之外,地图样式中的字体设置将被忽略。如果设置,此选项将覆盖 localIdeographFontFamily 中的设置(可选,默认false
    • options.transformRequest RequestTransformFunction在 Map 请求外部 URL 之前运行的回调。回调可用于修改 url、设置标头或设置跨域请求的凭据属性。预计返回requestParameters的对象与url属性和可选headerscredentials性能。(可选,默认null
    • options.collectResourceTiming **boolean**如果true,将为 GeoJSON 和 Vector Tile Web Worker 发出的请求收集资源计时 API 信息(此信息通常无法从主 Javascript 线程访问)。信息将在resourceTiming相关data事件的属性中返回。(可选,默认false
    • options.fadeDuration **number**控制标签碰撞的淡入/淡出动画的持续时间,以毫秒为单位。此设置会影响所有符号图层。此设置不会影响运行时样式转换或光栅图块淡入淡出的持续时间。(可选,默认300
    • options.crossSourceCollisions **boolean**如果true,来自多个源的符号可以在碰撞检测期间相互碰撞。如果false,则对每个源中的符号单独运行碰撞检测。(可选,默认true
    • options.locale **Object**应用于 UI 字符串的默认本地化表的补丁,例如控件工具提示。该locale对象将命名空间的 UI 字符串 ID 映射到目标语言的翻译字符串;src/ui/default_locale.js有关所有支持的字符串 ID 的示例,请参见。该对象可以指定所有 UI 字符串(从而添加对新翻译的支持)或仅字符串的子集(从而修补默认翻译表)。(可选,默认null
    • options.testMode **boolean**静默由于无效的访问令牌而生成的错误和警告,这在使用库编写单元测试时很有用。(可选,默认false

# Examples

var map = new vjmap.Map({
  container: 'map', // container ID
  center: [-122.420679, 37.772537], // starting position [lng, lat]
  zoom: 13, // starting zoom
  style: 'your style', // style URL or style object
  hash: true, // sync `center`, `zoom`, `pitch`, and `bearing` with URL
  // Use `transformRequest` to modify requests that begin with `http://myHost`.
  transformRequest: (url, resourceType)=> {
    if(resourceType === 'Source' && url.startsWith('http://myHost')) {
      return {
       url: url.replace('http', 'https'),
       headers: { 'my-custom-header': true},
       credentials: 'include'  // Include cookies for cross-origin requests
     }
    }
  }
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

# scrollZoom

地图的ScrollZoomHandler,它使用滚轮或触控板实现放大和缩小。scrollZoomScrollZoomHandler部分中查找更多详细信息和示例。

类型:ScrollZoomHandler

# boxZoom

地图的BoxZoomHandler,它使用按住 Shift 键的拖动手势实现缩放。boxZoomBoxZoomHandler部分中查找更多详细信息和示例。

类型:BoxZoomHandler

# dragRotate

地图的DragRotateHandler,它实现了在使用鼠标右键或按下 Control 键拖动时旋转地图。dragRotateDragRotateHandler部分中查找更多详细信息和示例。

类型:DragRotateHandler

# dragPan

地图的DragPanHandler,它实现了使用鼠标或触摸手势拖动地图。dragPanDragPanHandler部分中查找更多详细信息和示例。

类型:DragPanHandler

# keyboard

地图的KeyboardHandler,它允许用户使用键盘快捷键缩放、旋转和平移地图。keyboardKeyboardHandler部分中查找更多详细信息和示例。

类型:KeyboardHandler

# doubleClickZoom

地图的DoubleClickZoomHandler,允许用户通过双击进行缩放。doubleClickZoomDoubleClickZoomHandler部分中查找更多详细信息和示例。

类型:DoubleClickZoomHandler

# touchZoomRotate

地图的TouchZoomRotateHandler,它允许用户使用触摸手势缩放或旋转地图。touchZoomRotateTouchZoomRotateHandler部分中查找更多详细信息和示例。

类型:TouchZoomRotateHandler

# touchPitch

地图的TouchPitchHandler,它允许用户通过触摸手势来调整地图。touchPitchTouchPitchHandler部分中查找更多详细信息和示例。

类型:TouchPitchHandler

# addControl

IControl添加到地图,调用control.onAdd(this).

# Parameters

  • control **ICONTROL**的ICONTROL补充。
  • position string? 控件将添加到的地图上的位置。有效值是'top-left''top-right''bottom-left',和'bottom-right'。默认为'top-right'.

# Examples

// Add zoom and rotation controls to the map.
map.addControl(new vjmap.NavigationControl());
1
2

返回**地图** this

# removeControl

从地图中删除控件。

# Parameters

# Examples

// Define a new navigation control.
var navigation = new vjmap.NavigationControl();
// Add zoom and rotation controls to the map.
map.addControl(navigation);
// Remove zoom and rotation controls from the map.
map.removeControl(navigation);
1
2
3
4
5
6

返回**地图** this

# hasControl

检查控件是否在地图上。

# Parameters

# Examples

// Define a new navigation control.
var navigation = new vjmap.NavigationControl();
// Add zoom and rotation controls to the map.
map.addControl(navigation);
// Check that the navigation control exists on the map.
const added = map.hasControl(navigation);
// added === true
1
2
3
4
5
6
7

**boolean**如果地图包含控件,则返回True。

# resize

根据其container元素的尺寸调整地图的大小 。

检查地图容器大小是否改变,如果改变则更新地图。必须在以container编程方式调整地图大小后或在最初使用 CSS 隐藏地图后显示地图时调用此方法。

# Parameters

  • eventData Object? 要传递给movestartmoveresizemoveend 因调整大小而触发的事件的其他属性。这对于区分事件源(例如,用户启动或以编程方式触发的事件)非常有用。

# Examples

// Resize the map when the map container is shown
// after being initially hidden with CSS.
var mapDiv = document.getElementById('map');
if (mapDiv.style.visibility === true) map.resize();
1
2
3
4

返回**地图** this

# getBounds

返回地图的地理边界。当方位角或螺距不为零时,可见区域不是轴对齐的矩形,结果是包含可见区域的最小边界。如果在地图上设置了填充,则返回的边界适用于插图。

# Examples

var bounds = map.getBounds();
1

返回**LngLatBounds**地图的地理边界作为LngLatBounds

# getMaxBounds

返回地图被限制到的最大地理边界,或者null如果没有设置。

# Examples

var maxBounds = map.getMaxBounds();
1

返回**( LngLatBounds | null)**地图对象。

# setMaxBounds

设置或清除地图的地理边界。

平移和缩放操作被限制在这些范围内。如果执行平移或缩放会显示这些边界之外的区域,则地图将改为显示尽可能接近操作请求的位置和缩放级别,同时仍保持在边界内。

# Parameters

  • bounds **( LngLatBoundsLike | null | undefined)**要设置的最大边界。如果提供nullundefined,该函数将删除地图的最大边界。

# Examples

// Define bounds that conform to the `LngLatBoundsLike` object.
var bounds = [
  [-74.04728, 40.68392], // [west, south]
  [-73.91058, 40.87764]  // [east, north]
];
// Set the map's max bounds.
map.setMaxBounds(bounds);
1
2
3
4
5
6
7

返回**地图** this

# setMinZoom

设置或清除地图的最小缩放级别。如果地图的当前缩放级别低于新的最小值,则地图将缩放到新的最小值。

并非总是可以缩小并到达集合minZoom。其他因素(例如地图高度)可能会限制缩放。例如,如果地图的高度为 512 像素,则无论minZoom设置为什么,都无法在缩放 0 以下进行缩放。

# Parameters

  • minZoom **( number| null | undefined)**要设置的最小缩放级别 (-2 - 24)。如果提供nullundefined,该函数将删除当前的最小缩放(即将其设置为 -2)。

# Examples

map.setMinZoom(12.25);
1

返回**地图** this

# getMinZoom

返回地图的最小允许缩放级别。

# Examples

var minZoom = map.getMinZoom();
1

返回**number**minZoom

# setMaxZoom

设置或清除地图的最大缩放级别。如果地图的当前缩放级别高于新的最大值,则地图将缩放到新的最大值。

# Parameters

  • maxZoom **( number| null | undefined)**要设置的最大缩放级别。如果提供nullundefined,该函数将删除当前最大缩放(将其设置为 22)。

# Examples

map.setMaxZoom(18.75);
1

返回**地图** this

# getMaxZoom

返回地图的最大允许缩放级别。

# Examples

var maxZoom = map.getMaxZoom();
1

返回**number**最大缩放

# setMinPitch

设置或清除地图的最小间距。如果地图的当前俯仰低于新的最小值,则地图将俯仰到新的最小值。

# Parameters

  • minPitch **( number| null | undefined)**要设置的最小间距 (0-85)。如果提供nullundefined,则该函数会删除当前的最小音高(即,将其设置为 0)。

返回**地图** this

# getMinPitch

返回地图的最小允许间距。

返回**number**minPitch

# setMaxPitch

设置或清除地图的最大间距。如果地图的当前俯仰高于新的最大值,则地图将俯仰到新的最大值。

# Parameters

  • maxPitch **( number| null | undefined)**要设置的最大间距。如果提供nullundefined,则该函数会删除当前的最大音高(将其设置为 85)。

返回**地图** this

# getMaxPitch

返回地图的最大允许间距。

返回**number**最大间距

# getRenderWorldCopies

返回 的状态renderWorldCopies。如果true,世界的多个副本将在超过 -180 度和 180 度经度的范围内并排呈现。如果设置为false

  • 当地图缩小到足以让世界的单一表示无法填满地图的整个容器时,超过 180 度和 -180 度经度将出现空白。
  • 在每个缩放级别,跨越 180 度和 -180 度经度的要素将被切成两部分(一部分位于地图的右边缘,另一部分位于地图的左边缘)。

# Examples

var worldCopiesRendered = map.getRenderWorldCopies();
1

返回**boolean**renderWorldCopies

# setRenderWorldCopies

设置 的状态renderWorldCopies

# Parameters

  • renderWorldCopies **boolean**如果true,世界的多个副本将在超过 -180 度和 180 度经度的范围内并排呈现。如果设置为false:- 当地图缩小到足以使世界的单个表示无法填满地图的整个容器时,超过 180 度和 -180 度经度将出现空白。
    • 在每个缩放级别,跨越 180 度和 -180 度经度的要素将被切成两部分(一部分位于地图的右边缘,另一部分位于地图的左边缘)。undefined被视为truenull被视为false

# Examples

map.setRenderWorldCopies(true);
1

返回**地图** this

# project

返回一个Point表示像素坐标,相对于地图的container,对应于指定的地理位置。

当地图倾斜并lnglat完全在相机后面时,没有对应于该位置的像素坐标。在这种情况下,返回的Point][165]的xy组件设置为 Number.MAX\_VALUE。[

# Parameters

  • lnglat **LngLatLike 要投影**的地理位置。

# Examples

var coordinate = [-122.420679, 37.772537];
var point = map.project(coordinate);
1
2

返回**Point**对应于的点``lnglat,相对于地图的container

# unproject

返回表示与指定像素坐标对应的地理坐标的LngLat。如果地平线可见,并且指定像素高于地平线,则返回与地平线上的点相对应的LngLat,距离该点最近。

# Parameters

  • point **PointLike 要取消投影**的像素坐标。

# Examples

map.on('click', function(e) {
  // When the map is clicked, get the geographic coordinate.
  var coordinate = map.unproject(e.point);
});
1
2
3
4

返回**LngLat**对应的LngLatpoint

# isMoving

如果地图由于相机动画或用户手势而平移、缩放、旋转或俯仰,则返回 true。

# Examples

var isMoving = map.isMoving();
1

**boolean**如果地图正在移动,则返回True。

# isZooming

如果地图由于相机动画或用户手势而缩放,则返回 true。

# Examples

var isZooming = map.isZooming();
1

**boolean**如果地图正在缩放,则返回True。

# isRotating

如果地图由于相机动画或用户手势而旋转,则返回 true。

# Examples

map.isRotating();
1

**boolean**如果地图正在旋转,则返回True。

# on

为指定类型的事件添加侦听器,可选择限制为指定样式层中的功能。

# Parameters

  • type **string**要侦听的事件类型。layerId当光标从该图层外部或地图画布外部进入指定图层的可见部分时,将触发与可选参数兼容的事件。

# Parameters

  • type **string**要侦听的事件类型。layerId当光标从该图层外部或地图画布外部进入指定图层的可见部分时,将触发与可选参数兼容的事件。
事件 兼容layerId
mousedown
mouseup
mouseover
mouseout
mousemove
mouseenter 是(必填)
mouseleave 是(必填)
click
dblclick
contextmenu
contextMenuPreOpen
contextMenuOpened
contextMenuNoContent
contextMenuCancel
touchstart
touchend
touchcancel
wheel
resize
remove
touchmove
movestart
move
moveend
dragstart
drag
dragend
zoomstart
zoom
zoomend
rotatestart
rotate
rotateend
pitchstart
pitch
pitchend
boxzoomstart
boxzoomend
boxzoomcancel
webglcontextlost
webglcontextrestored
load
render
idle
error
data
styledata
sourcedata
dataloading
styledataloading
sourcedataloading
styleimagemissing
  • layerId string(可选)样式层的 ID。如果您提供layerId,则仅当侦听器的位置位于该图层中的可见要素内时才会触发侦听器,并且该事件将具有features包含匹配要素数组的属性。如果您不提供layerId,则侦听器将由地图上任何位置发生的相应事件触发,并且该事件将没有features属性。请注意,许多事件类型与可选layerId参数不兼容。
  • listener Function触发事件时要调用的函数。

# Examples

// Set an event listener that will fire
// when the map has finished loading.
map.on('load', function() {
  // Add a new layer.
  map.addLayer({
    id: 'points-of-interest',
    source: {
      type: 'vector',
      url: 'your url'
    },
    'source-layer': 'poi_label',
    type: 'circle',
    paint: {
      // Style Specification paint properties
    },
    layout: {
      // Style Specification layout properties
    }
  });
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Set an event listener that will fire
// when a feature on the countries layer of the map is clicked.
map.on('click', 'countries', function(e) {
  new vjmap.Popup()
    .setLngLat(e.lngLat)
    .setHTML(`Country name: ${e.features[0].properties.name}`)
    .addTo(map);
});
1
2
3
4
5
6
7
8

返回**地图** this

# once

添加一个仅对指定事件类型调用一次的侦听器,可选择仅限于在指定样式图层中的要素上发生的事件。

# Parameters

  • type **string**要侦听的事件类型;之一'mousedown''mouseup''click''dblclick''mousemove''mouseenter''mouseleave''mouseover''mouseout''contextmenu''touchstart''touchend',或'touchcancel'mouseentermouseover当光标从外部进入指定的层的可见部分事件被触发该层或地图帆布外。mouseleavemouseout事件被触发时光标离开指定的层,或叶地图画布的可见部分。
  • layerId string(可选)样式层的 ID。如果您提供layerId,则仅当侦听器的位置位于该图层中的可见要素内时才会触发侦听器,并且该事件将具有features包含匹配要素数组的属性。如果您不提供layerId,则侦听器将由地图上任何位置发生的相应事件触发,并且该事件将没有features属性。请注意,许多事件类型与可选layerId参数不兼容。
  • listener Function触发事件时要调用的函数。

# Examples

// Log the coordinates of a user's first map touch.
map.once('touchstart', function (e) {
  console.log('The first map touch was at: ' + e.lnglat)
});
1
2
3
4
// Log the coordinates of a user's first map touch
// on a specific layer.
map.once('touchstart', 'my-point-layer', function (e) {
  console.log('The first map touch on the point layer was at: ' + e.lnglat)
});
1
2
3
4
5

返回**地图** this

# off

删除先前使用Map#on添加的事件侦听器,可选择限制为特定于图层的事件。

# Parameters

  • type string 以前用于安装侦听器的事件类型。
  • layerId string (可选)先前用于安装侦听器的层 ID。
  • listener 功能以前安装的监听功能。

# Examples

// Create a function to print coordinates while a mouse is moving.
function onMove(e) {
  console.log('The mouse is moving: ' + e.lngLat)
}
// Create a function to unbind the `mousemove` event.
function onUp(e) {
  console.log('The final coordinates are: ' + e.lngLat)
  map.off('mousemove', onMove);
}
// When a click occurs, bind both functions to mouse events.
map.on('mousedown', function (e) {
  map.on('mousemove', onMove);
  map.once('mouseup', onUp);
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14

返回**地图** this

# queryRenderedFeatures

返回一个GeoJSON数组 `` 特征对象 表示满足查询参数的可见特征。

# Parameters

  • geometry **( PointLike | Array< PointLike >)?**以像素为单位的查询区域的几何形状:描述边界框的单个点或左下角和右上角的点,其中原点位于左上角。省略此参数(即使用零参数或仅使用参数调用Map#queryRenderedFeatures``options)等效于传递包含整个地图视口的边界框。仅支持现有视口内的值。
  • options Object? 选项对象。
    • options.layers **Array< string>?**一组样式层 ID用于要检查的查询。仅返回这些图层内的要素。如果未定义此参数,则将检查所有图层。
    • options.filter Array? 一个过滤器 限制查询结果。
    • options.validate **boolean**是否检查 [options.filter] 是否符合样式规范。禁用验证是一种性能优化,只有在您之前验证过将传递给此函数的值时才应使用。(可选,默认true

# Examples

// Find all features at a point
var features = map.queryRenderedFeatures(
  [20, 35],
  { layers: ['my-layer-name'] }
);
1
2
3
4
5
// Find all features within a static bounding box
var features = map.queryRenderedFeatures(
  [[10, 20], [30, 50]],
  { layers: ['my-layer-name'] }
);
1
2
3
4
5
// Find all features within a bounding box around a point
var width = 10;
var height = 20;
var features = map.queryRenderedFeatures([
  [point.x - width / 2, point.y - height / 2],
  [point.x + width / 2, point.y + height / 2]
], { layers: ['my-layer-name'] });
1
2
3
4
5
6
7
// Query all rendered features from a single layer
var features = map.queryRenderedFeatures({ layers: ['my-layer-name'] });
1
2

返回**Array< Object>** GeoJSON数组 `` 特征对象.properties每个返回的特征对象的值都包含其源特征的属性。对于以GeoJSON源,只有字符串和数值属性的值被支持(即nullArrayObject值不支持)。每个特征包括顶层layersourcesourceLayer特性。该layer属性是一个对象,表示该要素所属的样式图层。此对象中的布局和绘制属性包含针对给定缩放级别和特征进行全面评估的值。仅包括当前呈现的特征。某些功能将包括在内,例如:-visibility属性为 的图层中的功能"none"

  • 来自缩放范围不包括当前缩放级别的图层的要素。
  • 由于文本或图标碰撞而被隐藏的符号特征。包括所有其他层的特征,包括可能对渲染结果没有可见贡献的特征;例如,因为图层的不透明度或颜色 alpha 分量设置为 0。最上面渲染的特征首先出现在返回的数组中,后续特征按 z-order 降序排序。多次渲染的要素(由于在低缩放级别下环绕反子午线)仅返回一次(但需遵守以下注意事项)。因为要素来自切片矢量数据或在内部转换为切片的 GeoJSON 数据,所以要素几何可能会跨切片边界拆分或复制,因此,要素可能会在查询结果中出现多次。例如,假设有一条高速公路穿过查询的边界矩形。查询的结果将是位于覆盖边界矩形的地图图块内的高速公路部分,即使高速公路延伸到其他图块中,并且每个地图图块内的高速公路部分将作为单独的要素返回。类似地,由于瓦片缓冲,瓦片边界附近的点要素可能出现在多个瓦片中。

# querySourceFeatures

返回一个GeoJSON数组 `` 特征对象 表示满足查询参数的指定矢量切片或 GeoJSON 源中的要素。

# Parameters

  • sourceId string 要查询的矢量切片或 GeoJSON 源的 ID。
  • parameters Object? 选项对象。
    • parameters.sourceLayer string? 源层的名称 `` 查询。_对于矢量切片源,此参数是必需的。_对于 GeoJSON 源,它被忽略。
    • parameters.filter Array? 一个过滤器 限制查询结果。
    • parameters.validate **boolean**是否检查 [parameters.filter] 是否符合样式规范。禁用验证是一种性能优化,只有在您之前验证过将传递给此函数的值时才应使用。(可选,默认true

# Examples

// Find all features in one source layer in a vector source
var features = map.querySourceFeatures('your-source-id', {
  sourceLayer: 'your-source-layer'
});
1
2
3
4

返回**Array< Object>** GeoJSON](http://geojson.org/)数组 ``特征对象 . 与[Map#queryRenderedFeatures 相比,该函数返回所有匹配查询参数的特征,无论它们是否被当前样式渲染(即可见)。查询的域包括所有当前加载的矢量切片和 GeoJSON 源切片:该函数不检查当前可见视口之外的切片。因为特征来自切片矢量数据或内部转换为切片的 GeoJSON 数据,特征几何可能跨切片边界拆分或复制,因此,要素可能会在查询结果中出现多次。例如,假设有一条高速公路穿过查询的边界矩形。查询的结果将是位于覆盖边界矩形的地图图块内的高速公路部分,即使高速公路延伸到其他图块中,每个地图图块内的高速公路部分将作为单独的要素返回。类似地,由于瓦片缓冲,瓦片边界附近的点要素可能出现在多个瓦片中。

# setStyle

使用新值更新地图的 样式对象。

如果在使用时已经设置了样式并且 options.diff 设置为 true,则地图渲染器将尝试将给定样式与地图的当前状态进行比较,并仅执行使地图样式与所需状态匹配所需的更改。精灵(用于图标和图案的图像)和字形(标签文本的字体)的变化无法区分。如果当前样式中使用的精灵或字体与给定样式有任何不同,地图渲染器将强制进行完整更新,删除当前样式并从头开始构建给定样式。

# Parameters

  • style **(StyleSpecification | string| null)**符合样式规范中描述的架构的 JSON 对象 ``,或此类 JSON 的 URL。
  • options Object? 选项对象。
    • options.diff **boolean**如果为 false,则强制进行“完整”更新,删除当前样式并构建给定样式,而不是尝试基于差异的更新。(可选,默认true
    • options.localIdeographFontFamily **string**定义一个 CSS 字体系列,用于在“CJK 统一表意文字”、“平假名”、“片假名”和“韩文音节”范围内本地覆盖生成字形。在这些范围内,地图样式的字体设置将被忽略,除了字体粗细关键字(light/regular/medium/bold)。设置为false, 以针对这些字形范围启用地图样式的字体设置。强制完整更新。(可选,默认'sans-serif'

# Examples

map.setStyle("your style");
1

返回**地图** this

# getStyle

返回地图的 样式 对象,一个 JSON 对象,可用于重新创建地图的样式。

# Examples

map.on('load', function() {
  var styleJson = map.getStyle();
});
1
2
3

返回**Object**地图的样式 JSON 对象。

# isStyleLoaded

返回一个布尔值,指示地图的样式是否已完全加载。

# Examples

var styleLoadStatus = map.isStyleLoaded();
1

返回**boolean**一个布尔值,指示样式是否已完全加载。

# addSource

将源添加到地图的样式。

# Parameters

  • id **string**要添加的源的 ID。不得与现有来源发生冲突。
  • source **Object**源对象。

# Examples

map.addSource('my-data', {
  type: 'vector',
  url: 'your url'
});
1
2
3
4
map.addSource('my-data', {
  "type": "geojson",
  "data": {
    "type": "Feature",
    "geometry": {
      "type": "Point",
      "coordinates": [-77.0323, 38.9131]
    },
    "properties": {
      "title": "DC",
      "marker-symbol": "monument"
    }
  }
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14

返回**地图** this

# isSourceLoaded

返回一个布尔值,指示源是否已加载。返回true如果在地图的风格给定ID的源没有未完成的的网络请求,否则false

# Parameters

  • id string 要检查的源的 ID。

# Examples

var sourceLoaded = map.isSourceLoaded('bathymetry-data');
1

返回**boolean**一个布尔值,指示源是否已加载。

# areTilesLoaded

返回一个布尔值,指示是否加载了来自样式上所有源的视口中的所有图块。

# Examples

var tilesLoaded = map.areTilesLoaded();
1

返回**boolean**一个布尔值,指示是否已加载所有图块。

# removeSource

从地图的样式中删除源。

# Parameters

  • id string 要删除的源的 ID。

# Examples

map.removeSource('bathymetry-data');
1

返回**地图** this

# getSource

返回具有地图样式中指定 ID 的源。

此方法通常用于使用Sources 中定义的相关源类型的实例成员更新。例如,data为 GeoJSON 源设置或更新 图像源的urlcoordinates

# Parameters

  • id string 要获取的源的 ID。

# Examples

var sourceObject = map.getSource('points');
1

返回**Object?** 具有指定 ID 的样式源,或者undefined如果 ID 不对应于现有源。对象的形状因源类型而异。样式规范的源中提供了每种源类型的选项列表 `` 页。

# addImage

向样式添加图像。此图像可以像样式[精灵] 使用图像的 ID icon-image` `,background-pattern, fill-pattern` `, 或者line-pattern. 一个Map.event:错误如果没有在精灵足够的空间来添加此图像事件将被解雇。

# Parameters

  • id string 图像的 ID。
  • image **HTMLImageElement| 图像位图 | 图像数据 | {width: number, height: number, data: ( Uint8Array| Uint8ClampedArray)} | [StyleImageInterface)**图像作为HTMLImageElementImageDataImageBitmap或具有、 和 属性的对象width,其格式与.heightdataImageData`
  • options **$Shape<StyleImageMetadata>**选项对象。(可选,默认{}
    • options.pixelRatio 图像中的像素与屏幕上的物理像素的比率(可选,默认1
    • options.sdf 图像是否应被解释为 SDF 图像(可选,默认false
    • options.stretchX [[x1, x2], ...]如果icon-text-fit在具有此图像的图层中使用,则此选项定义可以水平拉伸的图像部分。
    • options.stretchY [[y1, y2], ...]如果icon-text-fit在带有此图像的图层中使用,则此选项定义可以垂直拉伸的图像部分。
    • options.content [x1, y1, x2, y2] 如果icon-text-fit在带有此图像的图层中使用,则此选项定义图像中可以被 中的内容覆盖的部分text-field

# Examples

// If the style's sprite does not already contain an image with ID 'cat',
// add the image 'cat-icon.png' to the style's sprite with the ID 'cat'.
map.loadImage('https://xxx.png', function(error, image) {
   if (error) throw error;
   if (!map.hasImage('cat')) map.addImage('cat', image);
});


// Add a stretchable image that can be used with `icon-text-fit`
// In this example, the image is 600px wide by 400px high.
map.loadImage('https:/xxx.png', function(error, image) {
   if (error) throw error;
   if (!map.hasImage('border-image')) {
     map.addImage('border-image', image, {
         content: [16, 16, 300, 384], // place text over left half of image, avoiding the 16px border
         stretchX: [[16, 584]], // stretch everything horizontally except the 16px border
         stretchY: [[16, 384]], // stretch everything vertically except the 16px border
     });
   }
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

# updateImage

更新样式中的现有图像。此图像可以像样式精灵中的任何其他图标一样显示在地图上 使用图像的 IDicon-image, background-pattern` `,fill-pattern, 或者 ``line-pattern.

# Parameters

  • id string 图像的 ID。
  • image **HTMLImageElement| 图像位图 | 图像数据 | {width: number, height: number, data: ( Uint8Array| Uint8ClampedArray)} | [StyleImageInterface)**图像作为HTMLImageElementImageDataImageBitmap或具有、 和 属性的对象width,其格式与.heightdataImageData`

# Examples

// If an image with the ID 'cat' already exists in the style's sprite,
// replace that image with a new image, 'other-cat-icon.png'.
if (map.hasImage('cat')) map.updateImage('cat', './other-cat-icon.png');
1
2
3

# hasImage

检查样式中是否存在具有特定 ID 的图像。

# Parameters

  • id string 图像的 ID。

# Examples

// Check if an image with the ID 'cat' exists in
// the style's sprite.
var catIconExists = map.hasImage('cat');
1
2
3

返回**boolean**一个布尔值,指示图像是否存在。

# removeImage

从样式中删除图像。

# Parameters

  • id string 图像的 ID。

# Examples

// If an image with the ID 'cat' exists in
// the style's sprite, remove it.
if (map.hasImage('cat')) map.removeImage('cat');
1
2
3

# loadImage

从外部 URL 加载图像以与Map#addImage一起使用。外部域必须支持CORS.

# Parameters

  • url **string**图像文件的 URL。图像文件必须为 png、webp 或 jpg 格式。
  • callback 功能期待callback(error, data)。在图像加载时调用或在出现错误时使用错误参数调用。

# Examples

// Load an image from an external URL.
map.loadImage('http://xxx', function(error, image) {
  if (error) throw error;
  // Add the loaded image to the style's sprite with the ID 'kitten'.
  map.addImage('kitten', image);
});
1
2
3
4
5
6

# listImages

返回一个字符串数组,其中包含地图中当前可用的所有图像的 ID。

# Examples

var allImages = map.listImages();
1

返回**Array< string>**包含地图中当前可用的所有精灵/图像名称的字符串数组。

# addLayer

添加样式图层到地图的样式。

层定义了来自指定源的数据的样式。在样式规范中阅读有关图层类型和可用绘制和布局属性的更多信息.

# Parameters

  • layer **( Object| CustomLayerInterface][276] )**要添加的图层,符合 样式规范的图层定义 或者,不太常见的是[CustomLayerInterface规范。样式规范的图层定义适用于大多数图层。
    • layer.id string 您定义的唯一标识符。
    • layer.type **string**层的类型(例如fillsymbol)。样式规范中提供了图层类型列表 ``.(这也可以是custom。有关更多信息,请参阅[CustomLayerInterface`。)
    • layer.source ( string| Object)? 图层的数据源。引用已使用源的唯一 id_定义_的源。使用源对象引用_新源_(如样式规范中所定义) ``) 直接地。这是需要所有layer.type的选项_,除了_为custombackground
    • layer.sourceLayer string? (可选)源层的名称 ``在指定layer.source用于此样式层的范围内。这是仅适用于矢量瓦片源并且需要layer.source是该类型vector
    • layer.filter 大批? (可选)指定源要素条件的表达式。仅显示与过滤器匹配的特征。样式规范包含有关限制的更多信息filter` `参数和可用`表达式`的完整列表. 如果未提供过滤器,则将显示源(或矢量切片集的源层)中的所有要素。
    • layer.paint Object? (可选)图层的绘制属性。可用的油漆特性因layer.type. 样式规范中提供了每种图层类型的绘制属性的完整列表 ``. 如果未指定绘制属性,则将使用默认值。
    • layer.layout Object? (可选)图层的布局属性。可用的布局属性因 而异layer.type样式规范中提供了每个图层类型的布局属性的完整列表 ``. 如果未指定布局属性,则将使用默认值。
    • layer.maxzoom number? (可选)图层的最大缩放级别。在缩放级别等于或大于 maxzoom 时,图层将被隐藏。该值可以是024(包括)之间的任何数字。如果未提供 maxzoom,则图层将在有可用图块的所有缩放级别上可见。
    • layer.minzoom number? (可选)图层的最小缩放级别。当缩放级别小于 minzoom 时,图层将被隐藏。该值可以是024(包括)之间的任何数字。如果未提供 minzoom,则图层将在有可用图块的所有缩放级别上可见。
    • layer.metadata Object? (可选)用于跟踪图层的任意属性,但不影响渲染。
    • layer.renderingMode string? 这仅适用于类型为 的图层custom。有关更多信息,请参阅CustomLayerInterface
  • beforeId string? 在现有图层之前插入新图层的现有图层的 ID,从而使新图层在视觉上出现在现有图层下方。如果未指定此参数,则图层将附加到图层数组的末尾,并在视觉上显示在所有其他图层之上。

# Examples

// Add a circle layer with a vector source
map.addLayer({
  id: 'points-of-interest',
  source: {
    type: 'vector',
    url: 'your url'
  },
  'source-layer': 'poi_label',
  type: 'circle',
  paint: {
    // Style Specification paint properties
  },
  layout: {
    // Style Specification layout properties
  }
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Define a source before using it to create a new layer
map.addSource('state-data', {
  type: 'geojson',
  data: 'path/to/data.geojson'
});

map.addLayer({
  id: 'states',
  // References the GeoJSON source defined above
  // and does not require a `source-layer`
  source: 'state-data',
  type: 'symbol',
  layout: {
    // Set the label content to the
    // feature's `name` property
    text-field: ['get', 'name']
  }
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Add a new symbol layer before an existing layer
map.addLayer({
  id: 'states',
  // References a source that's already been defined
  source: 'state-data',
  type: 'symbol',
  layout: {
    // Set the label content to the
    // feature's `name` property
    text-field: ['get', 'name']
  }
// Add the layer before the existing `cities` layer
}, 'cities');
1
2
3
4
5
6
7
8
9
10
11
12
13

返回**地图** this

# moveLayer

将图层移动到不同的 z 位置。

# Parameters

  • id string 要移动的图层的 ID。
  • beforeId string? 要在之前插入新图层的现有图层的 ID。查看地图时,id图层将出现在beforeId图层下方。如果beforeId省略,图层将被附加到图层数组的末尾并出现在地图上的所有其他图层之上。

# Examples

// Move a layer with ID 'polygon' before the layer with ID 'country-label'. The `polygon` layer will appear beneath the `country-label` layer on the map.
map.moveLayer('polygon', 'country-label');
1
2

返回**地图** this

# removeLayer

从地图的样式中删除具有给定 ID 的图层。

如果不存在这样的层,error则会触发一个事件。

# Parameters

  • id string 要删除的图层的 id

# Examples

// If a layer with ID 'state-data' exists, remove it.
if (map.getLayer('state-data')) map.removeLayer('state-data');
1
2

# getLayer

返回地图样式中具有指定 ID 的图层。

# Parameters

  • id string 要获取的图层的 ID。

# Examples

var stateDataLayer = map.getLayer('state-data');
1

返回**Object?** 具有指定 ID 的图层,或者undefined 如果 ID 对应于不存在的图层。

# setLayerZoomRange

设置指定样式图层的缩放范围。缩放范围包括 最小缩放级别最大缩放级别 图层将被渲染。

注意:对于使用矢量源的样式图层,样式图层无法以低于_源图层_的最小缩放级别的缩放级别进行渲染,因为这些缩放级别不存在数据。如果源图层的最小缩放级别高于样式图层中定义的最小缩放级别,则不会在缩放范围内的所有缩放级别渲染样式图层。

# Parameters

  • layerId string 将应用缩放范围的图层的 ID。
  • minzoom number 要设置的最小缩放 (0-24)。
  • maxzoom number 要设置的最大缩放 (0-24)。

# Examples

map.setLayerZoomRange('my-layer', 2, 5);
1

返回**地图** this

# setFilter

为指定的样式层设置过滤器。

过滤器控制样式层从其源呈现的特征。过滤器表达式计算出的任何要素true都将在地图上呈现。那些虚假的将被隐藏。

使用setFilter显示源数据的子集。

要清除过滤器,请传递nullundefined作为第二个参数。

# Parameters

  • layerId string 将应用过滤器的图层的 ID。
  • filter **( Array| null | undefined)**过滤器,符合 Style Specification 的 过滤器定义. 如果提供nullundefined,则该函数会从图层中删除任何现有过滤器。
  • options Object? 选项对象。(可选,默认{}
    • options.validate **boolean**是否检查过滤器是否符合样式规范。禁用验证是一种性能优化,只有在您之前验证过将传递给此函数的值时才应使用。(可选,默认true

# Examples

// display only features with the 'name' property 'USA'
map.setFilter('my-layer', ['==', ['get', 'name'], 'USA']);
1
2
// display only features with five or more 'available-spots'
map.setFilter('bike-docks', ['>=', ['get', 'available-spots'], 5]);
1
2
// remove the filter for the 'bike-docks' style layer
map.setFilter('bike-docks', null);
1
2

返回**地图** this

# getFilter

返回应用于指定样式层的过滤器。

# Parameters

  • layerId string 要获取其过滤器的样式图层的 ID。

返回**Array**图层的过滤器。

# setPaintProperty

设置指定样式层中绘制属性的值。

# Parameters

  • layerId string 要在其中设置 Paint 属性的图层的 ID。
  • name string 要设置的绘制属性的名称。
  • value any要设置的paint 属性的值。必须是适合该属性的类型,如样式规范中所定义 ``.
  • options Object? 选项对象。(可选,默认{}
    • options.validate **boolean**是否检查是否value符合样式规范。禁用验证是一种性能优化,只有在您之前验证过将传递给此函数的值时才应使用。(可选,默认true

# Examples

map.setPaintProperty('my-layer', 'fill-color', '#faafee');
1

返回**地图** this

# getPaintProperty

返回指定样式层中绘制属性的值。

# Parameters

  • layerId string 从中获取paint属性的图层的ID。
  • name string 要获取的油漆属性的名称。

返回任何指定的paint属性的值。

# setLayoutProperty

设置指定样式层中布局属性的值。

# Parameters

  • layerId string 要在其中设置布局属性的图层的 ID。
  • name string 要设置的布局属性的名称。
  • value any布局属性的值。必须是适合该属性的类型,如样式规范中所定义 ``.
  • options Object? 选项对象。(可选,默认{}
  • options.validate **boolean**是否检查是否value符合样式规范。禁用验证是一种性能优化,只有在您之前验证过将传递给此函数的值时才应使用。(可选,默认true

# Examples

map.setLayoutProperty('my-layer', 'visibility', 'none');
1

返回**地图** this

# getLayoutProperty

返回指定样式层中布局属性的值。

# Parameters

  • layerId string 要从中获取布局属性的图层的 ID。
  • name string 要获取的布局属性的名称。

返回任何指定布局属性的值。

# setLight

设置灯光值的任意组合。

# Parameters

  • light LightSpecification要设置的光属性。必须符合样式规范.
  • options Object? 选项对象。(可选,默认{}
    • options.validate **boolean**是否检查过滤器是否符合样式规范。禁用验证是一种性能优化,只有在您之前验证过将传递给此函数的值时才应使用。(可选,默认true

# Examples

var layerVisibility = map.getLayoutProperty('my-layer', 'visibility');
1

返回**地图** this

# getLight

返回灯光对象的值。

返回**Object**样式的 light Light 属性。

# setTerrain

设置样式的地形属性。

# Parameters

  • terrain TerrainSpecification要设置的地形属性。如果提供nullundefined,则函数会移除地形。

# Examples

map.addSource('dem', {
    'type': 'raster-dem',
    'url': 'your url',
    'tileSize': 512,
    'maxzoom': 14
});
// add the DEM source as a terrain layer with exaggerated height
map.setTerrain({ 'source': 'dem', 'exaggeration': 1.5 });
1
2
3
4
5
6
7
8

返回**地图** this

# getTerrain

返回地形规范或null地形未在地图上设置。

返回**Object**地形的地形规范属性。

# setFog

设置样式的雾属性。

# Parameters

  • fog FogSpecification要设置的雾属性。 如果提供nullundefined,则此函数调用将从地图中移除雾。

# Examples

map.setFog({
 "range": [1.0, 12.0],
 "color": 'white',
 "horizon-blend": 0.1
});
1
2
3
4
5

返回**地图** this

# getFog

返回雾规范或null地图上是否未设置雾。

返回**Object**样式的雾雾规范属性。

# queryTerrainElevation

查询当前加载的某个地理位置的高程数据。meters相对于平均海平面返回高程。null如果terrain已禁用或尚未加载该位置的地形数据,则返回。

为了保证加载地形数据,确保地理位置可见,等待idle事件发生。

# Parameters

  • lnglat **LngLatLike**要查询的地理位置。
  • options **海拔查询选项?**选项对象
    • options.exaggerated **boolean**当true返回具有exaggeration来自已应用样式的值的地形高程时。当false,返回未应用样式的基础数据的原始值。(可选,默认true

# Examples

var coordinate = [-122.420679, 37.772537];
var elevation = map.queryTerrainElevation(coordinate);
1
2

返回**( number| null)**以米为单位的海拔高度

# setFeatureState

设置state特征的 。功能state是在运行时分配给功能的一组用户定义的键值对。使用此方法时,state对象将与特征状态中的任何现有键值对合并。要素由其feature.id属性标识,该属性可以是任何数字或字符串。

此方法只能用于具有feature.id属性的源。该feature.id属性可以通过三种方式进行定义:

  • 对于矢量或 GeoJSON 源,包括id原始数据文件中的属性。
  • 对于矢量或 GeoJSON 源,使用 promoteId 定义源时的选项。
  • 对于 GeoJSON 源,使用 generateId选项id根据源数据中的特征索引自动分配一个。如果使用 更改要素数据map.getSource('some id').setData(..),则可能需要考虑更新的id值重新应用状态。

注意:您可以使用feature-state 表达式出于样式目的访问功能状态对象中的值。

# Parameters

  • feature **Object**特征标识符。从Map#queryRenderedFeatures或事件处理程序返回的特征对象 可用作特征标识符。
    • feature.id ( number| string) 功能的唯一 ID。可以是整数或字符串,但仅当promoteId 选项已应用于源或字符串可以转换为整数。
    • feature.source string 要素的矢量或 GeoJSON 源的 ID。
    • feature.sourceLayer string? (可选)对于矢量切片源,sourceLayer是必需的。
  • state **Object**一组键值对。这些值应该是有效的 JSON 类型。

# Examples

// When the mouse moves over the `my-layer` layer, update
// the feature state for the feature under the mouse
map.on('mousemove', 'my-layer', function(e) {
  if (e.features.length > 0) {
    map.setFeatureState({
      source: 'my-source',
      sourceLayer: 'my-source-layer',
      id: e.features[0].id,
    }, {
      hover: true
    });
  }
});
1
2
3
4
5
6
7
8
9
10
11
12
13

返回**Map**地图对象。

# removeFeatureState

删除state功能的 ,将其设置回默认行为。如果仅feature.source指定了 a ,它将从该源中删除所有功能的状态。如果feature.id还指定了,它将删除该功能状态的所有键。如果key还指定了,它只会从该功能的状态中删除该键。要素由其feature.id属性标识,该属性可以是任何数字或字符串。

# Parameters

  • feature **Object**在哪里删除状态的标识符。它可以是来源、功能或功能的特定键。从Map#queryRenderedFeatures或事件处理程序返回的特征对象可用作特征标识符。
    • feature.id ( number| string) 功能的唯一 ID。可以是整数或字符串,但仅当promoteId 选项已应用于源或字符串可以转换为整数。
    • feature.source string 要素的矢量或 GeoJSON 源的 ID。
    • feature.sourceLayer string? (可选)对于矢量切片源,sourceLayer是必需的。
  • key string (可选)要重置的功能状态的键。

# Examples

// Reset the entire state object for all features
// in the `my-source` source
map.removeFeatureState({
  source: 'my-source'
});
1
2
3
4
5
// When the mouse leaves the `my-layer` layer,
// reset the entire state object for the
// feature under the mouse
map.on('mouseleave', 'my-layer', function(e) {
  map.removeFeatureState({
    source: 'my-source',
    sourceLayer: 'my-source-layer',
    id: e.features[0].id
  });
});
1
2
3
4
5
6
7
8
9
10
// When the mouse leaves the `my-layer` layer,
// reset only the `hover` key-value pair in the
// state for the feature under the mouse
map.on('mouseleave', 'my-layer', function(e) {
  map.removeFeatureState({
    source: 'my-source',
    sourceLayer: 'my-source-layer',
    id: e.features[0].id
  }, 'hover');
});
1
2
3
4
5
6
7
8
9
10

# getFeatureState

获取state功能的 。功能state是在运行时分配给功能的一组用户定义的键值对。要素由其feature.id属性标识,该属性可以是任何数字或字符串。

注意:要访问功能状态对象中的值以设置功能样式,请使用``feature-state表达式.

# Parameters

  • feature **Object**特征标识符。从Map#queryRenderedFeatures或事件处理程序返回的特征对象 可用作特征标识符。
    • feature.id ( number| string) 功能的唯一 ID。可以是整数或字符串,但仅当promoteId 选项已应用于源或字符串可以转换为整数。
    • feature.source string 要素的矢量或 GeoJSON 源的 ID。
    • feature.sourceLayer string? (可选)对于矢量切片源,sourceLayer是必需的。

# Examples

// When the mouse moves over the `my-layer` layer,
// get the feature state for the feature under the mouse
map.on('mousemove', 'my-layer', function(e) {
  if (e.features.length > 0) {
    map.getFeatureState({
      source: 'my-source',
      sourceLayer: 'my-source-layer',
      id: e.features[0].id
    });
  }
});
1
2
3
4
5
6
7
8
9
10
11

返回**Object**功能状态:在运行时分配给功能的一组键值对。

# getContainer

返回地图的包含 HTML 元素。

返回**HTMLElement**地图的容器。

# getCanvasContainer

返回包含地图&lt;canvas>元素的 HTML元素。

如果要将非叠加层添加到地图,则应将它们附加到此元素。

这是地图交互性(例如平移和缩放)的事件绑定所附加到的元素。它将接收来自子元素(例如 )的冒泡事件&lt;canvas>,但不会接收来自地图控件的冒泡事件。

返回**HTMLElement**地图的容器&lt;canvas>

# getCanvas

返回地图的&lt;canvas>元素。

返回**HTMLCanvasElement**地图的&lt;canvas>元素。

# loaded

返回一个布尔值,指示地图是否已完全加载。

返回false如果样式还没有完全加载,或者如果已经更改了源或风格还没有完全加载。

返回**boolean**一个布尔值,指示地图是否已完全加载。

# remove

清理并释放与此地图关联的所有内部资源。

这包括 DOM 元素、事件绑定、Web Worker 和 WebGL 资源。

当您使用完地图并希望确保它不再消耗浏览器资源时,请使用此方法。之后,您不得在地图上调用任何其他方法。

# triggerRepaint

触发单帧渲染。当图层的属性或与图层源关联的属性发生更改时,将此方法与自定义图层一起使用以重新绘制地图。在渲染下一帧之前多次调用它仍然会导致只渲染一个帧。

# Examples

map.triggerRepaint();
1

# showTileBoundaries

获取和设置一个布尔值,指示地图是否将围绕每个图块和图块 ID 呈现轮廓。这些图块边界对于调试很有用。

第一个矢量源的未压缩文件大小绘制在每个图块的左上角,在图块 ID 旁边。

类型: boolean

# Examples

map.showTileBoundaries = true;
1

# showTerrainWireframe

获取并设置一个布尔值,指示地图是否将在显示的地形顶部呈现线框。用于调试。

线框始终为红色,仅在地形处于活动状态时绘制。

类型: boolean

# Examples

map.showTerrainWireframe = true;
1

# showPadding

获取并设置一个布尔值,指示地图是否将填充偏移可视化。

类型: boolean

# showCollisionBoxes

获取和设置一个布尔值,指示地图是否将围绕数据源中的所有符号呈现框,显示哪些符号已渲染或由于碰撞而隐藏。此信息对调试很有用。

类型: boolean

# repaint

获取和设置一个布尔值,指示地图是否会连续重绘。此信息可用于分析性能。

类型: boolean

# version

正在使用的版本。

类型: string

# getCenter

返回地图的地理中心点。

# Examples

// return a LngLat object such as {lng: 0, lat: 0}
var center = map.getCenter();
// access longitude and latitude values directly
var {longitude, latitude} = map.getCenter();
1
2
3
4

返回**LngLat**地图的地理中心点。

# setCenter

设置地图的地理中心点。相当于jumpTo({center: center})

# Parameters

  • center **LngLatLike**要设置的中心点。
  • eventData Object? 要添加到此方法触发的事件的事件对象的附加属性。

# Examples

map.setCenter([-74, 38]);
1

返回**地图** this

# panBy

按指定的偏移量平移地图。

# Parameters

  • offset PointLike xy平移地图所**依据的**坐标。
  • options **动画选项?**选项对象。
  • eventData Object? 要添加到此方法触发的事件的事件对象的附加属性。

返回**地图** this

# panTo

使用动画过渡将地图平移到指定位置。

# Parameters

  • lnglat **LngLatLike 要将地图平移到**的位置。
  • options **动画选项?**描述过渡目标和动画的选项。
  • eventData Object? 要添加到此方法触发的事件的事件对象的附加属性。

# Examples

map.panTo([-74, 38]);
1
// Specify that the panTo animation should last 5000 milliseconds.
map.panTo([-74, 38], {duration: 5000});
1
2

返回**地图** this

# getZoom

返回地图的当前缩放级别。

# Examples

map.getZoom();
1

返回**number**地图的当前缩放级别。

# setZoom

设置地图的缩放级别。相当于jumpTo({zoom: zoom})

# Parameters

  • zoom number 要设置的缩放级别 (0-20)。
  • eventData Object? 要添加到此方法触发的事件的事件对象的附加属性。

# Examples

// Zoom to the zoom level 5 without an animated transition
map.setZoom(5);
1
2

返回**地图** this

# zoomTo

使用动画过渡将地图缩放到指定的缩放级别。

# Parameters

  • zoom number 要过渡到的缩放级别。
  • options **动画选项?**选项对象。
  • eventData Object? 要添加到此方法触发的事件的事件对象的附加属性。

# Examples

// Zoom to the zoom level 5 without an animated transition
map.zoomTo(5);
// Zoom to the zoom level 8 with an animated transition
map.zoomTo(8, {
  duration: 2000,
  offset: [100, 50]
});
1
2
3
4
5
6
7

返回**地图** this

# zoomIn

将地图的缩放级别增加 1。

# Parameters

  • options **动画选项?**选项对象。
  • eventData Object? 要添加到此方法触发的事件的事件对象的附加属性。

# Examples

// zoom the map in one level with a custom animation duration
map.zoomIn({duration: 1000});
1
2

返回**地图** this

# zoomOut

将地图的缩放级别降低 1。

# Parameters

  • options **动画选项?**选项对象。
  • eventData Object? 要添加到此方法触发的事件的事件对象的附加属性。

# Examples

// zoom the map out one level with a custom animation offset
map.zoomOut({offset: [80, 60]});
1
2

返回**地图** this

# getBearing

返回地图的当前方位。方位是“向上”的罗盘方向;例如,90° 的方位角使地图定向,使东面朝上。

返回**number**地图的当前方位。

# setBearing

设置地图的方位(旋转)。方位是“向上”的罗盘方向;例如,90° 的方位角使地图定向,使东面朝上。

相当于jumpTo({bearing: bearing})

# Parameters

  • bearing number 所需的轴承。
  • eventData Object? 要添加到此方法触发的事件的事件对象的附加属性。

# Examples

// rotate the map to 90 degrees
map.setBearing(90);
1
2

返回**地图** this

# getPadding

返回在地图视口周围应用的当前填充。

返回**PaddingOptions**地图视口周围的当前填充。

# setPadding

设置视口周围的填充(以像素为单位)。

相当于jumpTo({padding: padding})

# Parameters

  • padding **PaddingOptions**所需的填充。格式:{左:数字,右:数字,上:数字,下:数字}
  • eventData Object? 要添加到此方法触发的事件的事件对象的附加属性。

# Examples

// Sets a left padding of 300px, and a top padding of 50px
map.setPadding({ left: 300, top: 50 });
1
2

返回**地图** this

# rotateTo

使用动画过渡将地图旋转到指定的方位。方位是“向上”的罗盘方向;例如,90° 的方位角使地图定向,使东面朝上。

# Parameters

  • bearing number 所需的轴承。
  • options **动画选项?**选项对象。
  • eventData Object? 要添加到此方法触发的事件的事件对象的附加属性。

返回**地图** this

# resetNorth

旋转地图,使北方向上(0° 方位角),并带有动画过渡。

# Parameters

  • options **动画选项?**选项对象。
  • eventData Object? 要添加到此方法触发的事件的事件对象的附加属性。

返回**地图** this

# resetNorthPitch

旋转和倾斜地图,使北朝上(0° 方位角)且俯仰角为 0°,并带有动画过渡。

# Parameters

  • options **动画选项?**选项对象。
  • eventData Object? 要添加到此方法触发的事件的事件对象的附加属性。

返回**地图** this

# snapToNorth

如果当前方位足够接近它(即在bearingSnap阈值内),则捕捉地图使北朝上(0° 方位 )。

# Parameters

  • options **动画选项?**选项对象。
  • eventData Object? 要添加到此方法触发的事件的事件对象的附加属性。

返回**地图** this

# getPitch

返回地图的当前倾斜度(倾斜度)。

返回**number**地图的当前间距,以距屏幕平面的度数为单位。

# setPitch

设置地图的倾斜度(倾斜度)。相当于jumpTo({pitch: pitch})

# Parameters

  • pitch number 要设置的间距,以距屏幕平面的度数为单位 (0-60)。
  • eventData Object? 要添加到此方法触发的事件的事件对象的附加属性。

返回**地图** this

# cameraForBounds

# Parameters

  • bounds **LngLatBoundsLike**计算视口中这些边界的中心,并使用最高缩放级别,包括Map#getMaxZoom()适合视口的缩放级别。LngLatBounds 表示一个始终与轴承 0 轴对齐的框。
  • options **相机选项?**选项对象。
    • options.padding **( number| PaddingOptions )?**添加到给定边界的填充量(以像素为单位)。
    • options.bearing **number**动画结束时所需的地图方位,以度为单位。(可选,默认0
    • options.offset **PointLike**相对于地图中心的给定边界的中心,以像素为单位。(可选,默认[0,0]
    • options.maxZoom number? 相机过渡到指定边界时允许的最大缩放级别。

# Examples

var bbox = [[-79, 43], [-73, 45]];
var newCameraTransform = map.cameraForBounds(bbox, {
  padding: {top: 10, bottom:25, left: 15, right: 5}
});
1
2
3
4

返回**(CameraOptions |无效)**如果地图能够适合提供的界限,收益CameraOptionscenterzoombearing。如果地图无法适应,方法将发出警告并返回未定义。

# fitBounds

平移和缩放地图以将其可见区域包含在指定的地理边界内。如果方位角非零,此函数还会将地图的方位角重置为 0。如果在地图上设置了填充,则边界适合插图。

# Parameters

  • bounds **LngLatBoundsLike**在视口中居中这些边界,并使用最高缩放级别,包括Map#getMaxZoom()适合它们在视口中的缩放级别。
  • options Object? 除了以下字段之外,Options 还支持AnimationOptionsCameraOptions中的所有属性。
    • options.padding **( number| PaddingOptions )?**添加到给定边界的填充量(以像素为单位)。
    • options.linear **boolean**如果true,则地图使用 Map#easeTo 进行转换。如果false,则地图使用Map#flyTo 进行转换。有关可用选项的信息,请参阅这些函数和AnimationOptions。(可选,默认false
    • options.easing **功能?**动画过渡的缓动函数。请参阅动画选项
    • options.offset **PointLike**相对于地图中心的给定边界的中心,以像素为单位。(可选,默认[0,0]
    • options.maxZoom number? 当地图视图转换到指定边界时允许的最大缩放级别。
  • eventData Object? 要添加到此方法触发的事件的事件对象的附加属性。

# Examples

var bbox = [[-79, 43], [-73, 45]];
map.fitBounds(bbox, {
  padding: {top: 10, bottom:25, left: 15, right: 5}
});
1
2
3
4

返回**地图** this

# fitScreenCoordinates

一旦地图旋转到指定的方位,平移、旋转和缩放地图以适应由点 p0 和 p1 构成的框。要缩放而不旋转,请传入当前地图方位。

# Parameters

  • p0 **PointLike**屏幕上的第一个点,以像素坐标表示
  • p1 **PointLike**屏幕上的第二个点,以像素坐标表示
  • bearing **number**动画结束时所需的地图方位,以度为单位。如果贴图具有非零间距,则忽略此值。
  • options **任何?**选项对象。
    • options.padding **( number| PaddingOptions )?**添加到给定边界的填充量(以像素为单位)。
    • options.linear **boolean**如果true,则地图使用 Map#easeTo 进行转换。如果false,则地图使用Map#flyTo 进行转换。有关可用选项的信息,请参阅这些函数和AnimationOptions。(可选,默认false
    • options.easing **功能?**动画过渡的缓动函数。请参阅动画选项
    • options.offset **PointLike**相对于地图中心的给定边界的中心,以像素为单位。(可选,默认[0,0]
    • options.maxZoom number? 当地图视图转换到指定边界时允许的最大缩放级别。
  • eventData Object? 要添加到此方法触发的事件的事件对象的附加属性。

# Examples

var p0 = [220, 400];
var p1 = [500, 900];
map.fitScreenCoordinates(p0, p1, map.getBearing(), {
  padding: {top: 10, bottom:25, left: 15, right: 5}
});
1
2
3
4
5

返回**地图** this

# jumpTo

更改中心、缩放、方位和俯仰的任意组合,无需动画过渡。对于 中未指定的任何详细信息,地图将保留其当前值options

# Parameters

  • options **CameraOptions**选项对象。
  • eventData Object? 要添加到此方法触发的事件的事件对象的附加属性。

# Examples

// jump to coordinates at current zoom
map.jumpTo({center: [0, 0]});
// jump with zoom, pitch, and bearing options
map.jumpTo({
  center: [0, 0],
  zoom: 8,
  pitch: 45,
  bearing: 90
});
1
2
3
4
5
6
7
8
9

返回**地图** this

# getFreeCameraOptions

返回相机实体的位置和方向。

返回**FreeCameraOptions**相机状态

# setFreeCameraOptions

FreeCameraOptions提供对底层相机实体的更直接访问。为了向后兼容,使用此 API 的状态集也必须是可表示的 CameraOptions。如果向俯仰和方位表示的转换不明确,参数将被限制在有效范围内或作为无效丢弃。例如,如果导致相机颠倒、四元数长度为零或间距超过最大间距限制,则方向可能无效。

# Parameters

  • options FreeCameraOptions FreeCameraOptions对象
  • eventData Object? 要添加到此方法触发的事件的事件对象的附加属性。

返回**地图** this

# easeTo

更改的任意组合centerzoombearingpitch,并padding与新老值之间动画转换。对于 中未指定的任何详细信息,地图将保留其当前值options

注意:如果用户reduced motion在其操作系统中启用了辅助功能,则转换将立即发生,除非options包含essential: true.

# Parameters

  • options 任何描述过渡目标和动画的选项。接受CameraOptionsAnimationOptions
  • eventData Object? 要添加到此方法触发的事件的事件对象的附加属性。

返回**地图** this

# flyTo

改变中心、缩放、方位和俯仰的任意组合,沿着一条唤起飞行的曲线动画过渡。动画无缝地结合了缩放和平移,以帮助用户即使在穿越很远的距离后也能保持她的方位。

注意:动画将被跳过,这将jumpTo 与用户reduced motion在其操作系统中启用辅助功能时的行为等效,除非 'options' 包含essential: true.

# Parameters

  • options **Object**描述过渡目标和动画的选项。接受CameraOptionsAnimationOptions和以下附加选项。
    • options.curve **number**沿飞行路径发生的缩放“曲线”。高值最大化放大动画的缩放,而低值最小化缩放以获得更接近Map#easeTo的效果。1.42 是参与者在van Wijk (2003) 中讨论的用户研究中选择的平均值 ``. 的值 Math.pow(6, 0.25)将等价于均方根平均速度。值为 1 将产生圆周运动。(可选,默认1.42
    • options.minZoom number? 飞行路径峰值处的基于零的缩放级别。如果 options.curve指定,则忽略此选项。
    • options.speed **number**相对于 定义的动画的平均速度 options.curve。速度为 1.2 意味着地图似乎每秒沿着飞行路径移动 1.2 倍options.curve屏幕。一_屏_是地图的可见跨度。它不对应于固定的物理距离,而是因缩放级别而异。(可选,默认1.2
    • options.screenSpeed number? 假设线性时间曲线,以每秒屏幕数为单位测量的动画平均速度。如果options.speed指定,则忽略此选项。
    • options.maxDuration number? 动画的最长持续时间,以毫秒为单位。如果持续时间超过最大持续时间,则重置为 0。
  • eventData Object? 要添加到此方法触发的事件的事件对象的附加属性。

# Examples

// fly with default options to null island
map.flyTo({center: [0, 0], zoom: 9});
// using flyTo options
map.flyTo({
  center: [0, 0],
  zoom: 9,
  speed: 0.2,
  curve: 1,
  easing(t) {
    return t;
  }
});
1
2
3
4
5
6
7
8
9
10
11
12

返回**地图** this

# stop

停止任何正在进行的动画过渡。

返回**地图** this

# resize

在调整地图大小后立即触发。

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener that fires
// immediately after the map has been resized.
map.on('resize', function() {
  console.log('A resize event occurred.');
});
1
2
3
4
5
6
7

# remove

在使用Map.event:remove 删除地图后立即触发

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener that fires
// just after the map is removed.
map.on('remove', function() {
  console.log('A remove event occurred.');
});
1
2
3
4
5
6
7

# mousedown

当在地图内按下定位设备(通常是鼠标)时触发。

**注意:**此事件与可选layerId参数兼容。如果layerId作为第二个参数包含在Map#on 中,则仅当在指定图层的可见部分内按下光标时,事件侦听器才会触发。

# Properties

  • data 地图鼠标事件

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener
map.on('mousedown', function() {
  console.log('A mousedown event has occurred.');
});
1
2
3
4
5
6
// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener for a specific layer
map.on('mousedown', 'poi-label', function() {
  console.log('A mousedown event has occurred on a visible portion of the poi-label layer.');
});
1
2
3
4
5
6

# mouseup

当定位设备(通常是鼠标)在地图内释放时触发。

**注意:**此事件与可选layerId参数兼容。如果layerIdMap#on 中作为第二个参数包含在内,则仅当在指定图层的可见部分内释放光标时,事件侦听器才会触发。

# Properties

  • data 地图鼠标事件

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener
map.on('mouseup', function() {
  console.log('A mouseup event has occurred.');
});
1
2
3
4
5
6
// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener for a specific layer
map.on('mouseup', 'poi-label', function() {
  console.log('A mouseup event has occurred on a visible portion of the poi-label layer.');
});
1
2
3
4
5
6

# mouseover

当定位设备(通常是鼠标)在地图内移动时触发。当您在包含地图的网页上移动光标时,每次进入地图或任何子元素时都会触发该事件。

**注意:**此事件与可选layerId参数兼容。如果layerId作为第二个参数包含在Map#on 中,则仅当光标移动到指定图层的可见部分内时,事件侦听器才会触发。

# Properties

  • data 地图鼠标事件

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener
map.on('mouseover', function() {
  console.log('A mouseover event has occurred.');
});
1
2
3
4
5
6
// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener for a specific layer
map.on('mouseover', 'poi-label', function() {
  console.log('A mouseover event has occurred on a visible portion of the poi-label layer.');
});
1
2
3
4
5
6

# mousemove

当光标在地图内时移动定点设备(通常是鼠标)时触发。当您在地图上移动光标时,每次光标在地图内更改位置时都会触发该事件。

**注意:**此事件与可选layerId参数兼容。如果layerId作为第二个参数包含在Map#on 中,则仅当光标位于指定图层的可见部分内时,事件侦听器才会触发。

# Properties

  • data 地图鼠标事件

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener
map.on('mousemove', function() {
  console.log('A mousemove event has occurred.');
});
1
2
3
4
5
6
// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener for a specific layer
map.on('mousemove', 'poi-label', function() {
  console.log('A mousemove event has occurred on a visible portion of the poi-label layer.');
});
1
2
3
4
5
6

# click

当在地图上的同一点按下并释放定位设备(通常是鼠标)时触发。

**注意:**此事件与可选layerId参数兼容。如果layerId作为第二个参数包含在Map#on 中,则仅当按下和释放的点包含指定图层的可见部分时,事件侦听器才会触发。

# Properties

  • data 地图鼠标事件

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener
map.on('click', function(e) {
  console.log('A click event has occurred at ' + e.lngLat);
});
1
2
3
4
5
6
// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener for a specific layer
map.on('click', 'poi-label', function(e) {
  console.log('A click event has occurred on a visible portion of the poi-label layer at ' + e.lngLat);
});
1
2
3
4
5
6

# dblclick

当定位设备(通常是鼠标)在地图上的同一点快速连续按下和释放两次时触发。

**注意:**此事件与可选layerId参数兼容。如果layerId作为第二个参数包含在Map#on 中,则仅当单击两次的点包含指定图层的可见部分时,事件侦听器才会触发。

# Properties

  • data 地图鼠标事件

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener
map.on('dblclick', function(e) {
  console.log('A dblclick event has occurred at ' + e.lngLat);
});
1
2
3
4
5
6
// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener for a specific layer
map.on('dblclick', 'poi-label', function(e) {
  console.log('A dblclick event has occurred on a visible portion of the poi-label layer at ' + e.lngLat);
});
1
2
3
4
5
6

# mouseenter

当定点设备(通常是鼠标)从该图层外部或地图画布外部进入指定图层的可见部分时触发。

**重要提示:**只有当Map#on包含三个参数时才能侦听此事件,其中第二个参数指定所需的层。

# Properties

  • data 地图鼠标事件

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener
map.on('mouseenter', 'water', function() {
  console.log('A mouseenter event occurred on a visible portion of the water layer.');
});
1
2
3
4
5
6

# mouseleave

当定点设备(通常是鼠标)离开指定图层的可见部分或从指定图层移动到地图画布外时触发。

**注意:**要检测鼠标何时离开画布,独立于图层,请改用Map.event:mouseout

**重要提示:**只有当Map#on包含三个参数时才能侦听此事件,其中第二个参数指定所需的层。

# Properties

  • data 地图鼠标事件

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener that fires
// when the pointing device leaves
// a visible portion of the specified layer.
map.on('mouseleave', 'water', function() {
  console.log('A mouseleave event occurred.');
});
1
2
3
4
5
6
7
8

# mouseout

当点设备(通常是鼠标)离开地图的画布时触发。

# Properties

  • data 地图鼠标事件

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener that fires
// when the pointing device leave's
// the map's canvas.
map.on('mouseout', function() {
  console.log('A mouseout event occurred.');
});
1
2
3
4
5
6
7
8

# contextmenu

单击鼠标右键或在地图内按下上下文菜单键时触发。

# Properties

  • data 地图鼠标事件

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener that fires
// when the right mouse button is
// pressed within the map.
map.on('contextmenu', function() {
  console.log('A contextmenu event occurred.');
});
1
2
3
4
5
6
7
8

# wheel

当一个 wheel事件发生在地图内。

# Properties

  • data 地图轮事件

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener that fires
// when a wheel event occurs within the map.
map.on('wheel', function() {
  console.log('A wheel event occurred.');
});
1
2
3
4
5
6
7

# touchstart

当一个 touchstart 事件发生在地图内。

# Properties

  • data MapTouchEvent // 初始化地图 var map = new vjmap.Map({ // 地图选项 }); // 设置一个事件侦听器,当地图中发生 touchstart 事件时触发该事件。map.on('touchstart', function() { console.log('A touchstart 事件发生。'); });

# touchend

当一个 touchend 事件发生在地图内。

# Properties

  • data 地图触摸事件

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener that fires
// when a touchstart event occurs within the map.
map.on('touchstart', function() {
  console.log('A touchstart event occurred.');
});
1
2
3
4
5
6
7

# touchmove

当一个 touchmove 事件发生在地图内。

# Properties

  • data 地图触摸事件

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener that fires
// when a touchmove event occurs within the map.
map.on('touchmove', function() {
  console.log('A touchmove event occurred.');
});
1
2
3
4
5
6
7

# touchcancel

当一个 touchcancel 事件发生在地图内。

# Properties

  • data 地图触摸事件

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener that fires
// when a touchcancel event occurs within the map.
map.on('touchcancel', function() {
  console.log('A touchcancel event occurred.');
});
1
2
3
4
5
6
7

# movestart

作为用户交互或Map#jumpTo等方法的结果,在地图开始从一个视图过渡到另一个视图之前触发

# Properties

  • data {originalEvent: DragEvent}

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener that fires
// just before the map begins a transition
// from one view to another.
map.on('movestart', function() {
  console.log('A movestart` event occurred.');
});
1
2
3
4
5
6
7
8

# move

作为用户交互或Map#flyTo等方法的结果,在从一个视图到另一个视图的动画过渡期间重复触发

# Properties

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener that fires
// repeatedly during an animated transition.
map.on('move', function() {
  console.log('A move event occurred.');
});
1
2
3
4
5
6
7

# moveend

作为用户交互或Map#jumpTo等方法的结果,在地图完成从一个视图到另一个视图的转换后立即触发

# Properties

  • data {originalEvent: DragEvent}

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener that fires
// just after the map completes a transition.
map.on('moveend', function() {
  console.log('A moveend event occurred.');
});
1
2
3
4
5
6
7

# dragstart

当“拖动平移”交互开始时触发。请参阅DragPanHandler

# Properties

  • data {originalEvent: DragEvent}

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener that fires
// when a "drag to pan" interaction starts.
map.on('dragstart', function() {
  console.log('A dragstart event occurred.');
});
1
2
3
4
5
6
7

# drag

在“拖动平移”交互期间反复触发。请参阅DragPanHandler

# Properties

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener that fires
// repeatedly  during a "drag to pan" interaction.
map.on('drag', function() {
  console.log('A drag event occurred.');
});
1
2
3
4
5
6
7

# dragend

当“拖动平移”交互结束时触发。请参阅DragPanHandler

# Properties

  • data {originalEvent: DragEvent}

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener that fires
// when a "drag to pan" interaction ends.
map.on('dragend', function() {
  console.log('A dragend event occurred.');
});
1
2
3
4
5
6
7

# zoomstart

作为用户交互或Map#flyTo等方法的结果,在地图开始从一个缩放级别过渡到另一个缩放级别之前触发

# Properties

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener that fires
// just before a zoom transition starts.
map.on('zoomstart', function() {
  console.log('A zoomstart event occurred.');
});
1
2
3
4
5
6
7

# zoom

作为用户交互或Map#flyTo等方法的结果,在从一个缩放级别到另一个缩放级别的动画过渡期间重复触发

# Properties

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener that fires
// repeatedly during a zoom transition.
map.on('zoom', function() {
  console.log('A zoom event occurred.');
});
1
2
3
4
5
6
7

# zoomend

作为用户交互或Map#flyTo等方法的结果,在地图完成从一个缩放级别到另一个缩放级别的转换后立即触发。缩放过渡通常会在渲染完成之前结束,因此如果您需要等待渲染完成,请改用Map#idle事件。

# Properties

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener that fires
// just after a zoom transition finishes.
map.on('zoomend', function() {
  console.log('A zoomend event occurred.');
});
1
2
3
4
5
6
7

# rotatestart

当“拖动旋转”交互开始时触发。请参阅DragRotateHandler

# Properties

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener that fires
// just before a "drag to rotate" interaction starts.
map.on('rotatestart', function() {
  console.log('A rotatestart event occurred.');
});
1
2
3
4
5
6
7

# rotate

在“拖动以旋转”交互期间反复触发。请参阅DragRotateHandler

# Properties

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener that fires
// repeatedly during "drag to rotate" interaction.
map.on('rotate', function() {
  console.log('A rotate event occurred.');
});
1
2
3
4
5
6
7

# rotateend

当“拖动旋转”交互结束时触发。请参阅DragRotateHandler

# Properties

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener that fires
// just after a "drag to rotate" interaction ends.
map.on('rotateend', function() {
  console.log('A rotateend event occurred.');
});
1
2
3
4
5
6
7

# pitchstart

每当地图的俯仰(倾斜)由于用户交互或Map#flyTo等方法而开始发生变化时触发

# Properties

  • data 地图事件数据

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener that fires
// just before a pitch (tilt) transition starts.
map.on('pitchstart', function() {
  console.log('A pitchstart event occurred.');
});
1
2
3
4
5
6
7

# pitch

作为用户交互或Map#flyTo等方法的结果,在一个状态和另一个状态之间的地图俯仰(倾斜)动画期间重复触发

# Properties

  • data 地图事件数据

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener that fires
// repeatedly during a pitch (tilt) transition.
map.on('pitch', function() {
  console.log('A pitch event occurred.');
});
1
2
3
4
5
6
7

# pitchend

由于用户交互或Map#flyTo 之类的方法,在地图的俯仰(倾斜)完成更改后立即触发

# Properties

  • data 地图事件数据

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener that fires
// just after a pitch (tilt) transition ends.
map.on('pitchend', function() {
  console.log('A pitchend event occurred.');
});
1
2
3
4
5
6
7

# boxzoomstart

当“框缩放”交互开始时触发。请参阅BoxZoomHandler

# Properties

  • data 地图框缩放事件

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener that fires
// just before a "box zoom" interaction starts.
map.on('boxzoomstart', function() {
  console.log('A boxzoomstart event occurred.');
});
1
2
3
4
5
6
7

# boxzoomend

当“框缩放”交互结束时触发。请参阅BoxZoomHandler

类型: Object

# Properties

  • data 地图框缩放事件

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener that fires
// just after a "box zoom" interaction ends.
map.on('boxzoomend', function() {
  console.log('A boxzoomend event occurred.');
});
1
2
3
4
5
6
7

# boxzoomcancel

当用户取消“框缩放”交互或边界框不满足最小尺寸阈值时触发。请参阅BoxZoomHandler

# Properties

  • data 地图框缩放事件

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener that fires
// the user cancels a "box zoom" interaction.
map.on('boxzoomcancel', function() {
  console.log('A boxzoomcancel event occurred.');
});
1
2
3
4
5
6
7

# webglcontextlost

当 WebGL 上下文丢失时触发。

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener that fires
// when the WebGL context is lost.
map.on('webglcontextlost', function() {
  console.log('A webglcontextlost event occurred.');
});
1
2
3
4
5
6
7

# webglcontextrestored

当 WebGL 上下文恢复时触发。

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener that fires
// when the WebGL context is restored.
map.on('webglcontextrestored', function() {
  console.log('A webglcontextrestored event occurred.');
});
1
2
3
4
5
6
7

# load

在下载了所有必要的资源并且地图的第一次视觉完整渲染发生后立即触发。

类型: Object

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener that fires
// when the map has finished loading.
map.on('load', function() {
  console.log('A load event occurred.');
});
1
2
3
4
5
6
7

# render

每当地图绘制到屏幕时触发,作为结果

  • 更改地图的位置、缩放、俯仰或方位
  • 地图样式的更改
  • 对 GeoJSON 源的更改
  • 加载矢量切片、GeoJSON 文件、字形或精灵

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener that fires
// whenever the map is drawn to the screen.
map.on('render', function() {
  console.log('A render event occurred.');
});
1
2
3
4
5
6
7

# idle

在地图进入“空闲”状态之前渲染的最后一帧之后触发:

  • 没有正在进行的相机转换
  • 当前请求的所有图块都已加载
  • 所有淡入淡出/过渡动画已完成

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener that fires
// just before the map enters an "idle" state.
map.on('idle', function() {
  console.log('A idle event occurred.');
});
1
2
3
4
5
6
7

# error

发生错误时触发。这是主要错误报告机制。我们使用事件而不是throw更好地适应异步操作。如果没有侦听器绑定到error事件,错误将打印到控制台。

# Properties

  • data {错误:{消息:string}}

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener that fires
// when an error occurs.
map.on('error', function() {
  console.log('A error event occurred.');
});
1
2
3
4
5
6
7

# data

当任何地图数据加载或更改时触发。有关 详细信息,请参阅MapDataEvent

# Properties

  • data 地图数据事件

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener that fires
// when map data loads or changes.
map.on('data', function() {
  console.log('A data event occurred.');
});
1
2
3
4
5
6
7

# styledata

当地图的样式加载或更改时触发。有关详细信息,请参阅 MapDataEvent

# Properties

  • data 地图数据事件

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener that fires
// when the map's style loads or changes.
map.on('styledata', function() {
  console.log('A styledata event occurred.');
});
1
2
3
4
5
6
7

# sourcedata

当地图源之一加载或更改时触发,包括属于源的图块加载或更改。有关详细信息,请参阅MapDataEvent

# Properties

  • data 地图数据事件

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener that fires
// when one of the map's sources loads or changes.
map.on('sourcedata', function() {
  console.log('A sourcedata event occurred.');
});
1
2
3
4
5
6
7

# dataloading

当任何地图数据(样式、源、图块等)开始异步加载或更改时触发。所有dataloading事件后跟一个dataerror事件。有关详细信息,请参阅MapDataEvent

# Properties

  • data 地图数据事件

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener that fires
// when any map data begins loading
// or changing asynchronously.
map.on('dataloading', function() {
  console.log('A dataloading event occurred.');
});
1
2
3
4
5
6
7
8

# styledataloading

当地图的样式开始异步加载或更改时触发。所有styledataloading事件后跟一个styledataerror事件。有关详细信息,请参阅MapDataEvent

# Properties

  • data 地图数据事件

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener that fires
// map's style begins loading or
// changing asyncronously.
map.on('styledataloading', function() {
  console.log('A styledataloading event occurred.');
});
1
2
3
4
5
6
7
8

# sourcedataloading

当地图的源之一开始异步加载或更改时触发。所有sourcedataloading事件后跟一个sourcedataerror事件。有关详细信息,请参阅MapDataEvent

# Properties

  • data 地图数据事件

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener that fires
// map's sources begin loading or
// changing asyncronously.
map.on('sourcedataloading', function() {
  console.log('A sourcedataloading event occurred.');
});
1
2
3
4
5
6
7
8

# styleimagemissing

当样式所需的图标或图案丢失时触发。可以在此事件侦听器回调中使用Map#addImage添加丢失的图像,以防止跳过图像。此事件可用于动态生成图标和图案。

# Properties

  • id string 缺失图像的 id。

# Examples

// Initialize the map
var map = new vjmap.Map({ // map options });
// Set an event listener that fires
// an icon or pattern is missing.
map.on('styleimagemissing', function() {
  console.log('A styleimagemissing event occurred.');
});
1
2
3
4
5
6
7

# IControl

添加到地图的交互式控件界面。这是实现者建模的规范:它不是导出的方法或类。

控件必须实现onAddonRemove,并且必须拥有一个元素,通常是一个div元素。要使用默认控件样式,请将vjmap-ctrl类添加到控件的节点。

# Examples

// Control implemented as ES6 class
class HelloWorldControl {
    onAdd(map) {
        this._map = map;
        this._container = document.createElement('div');
        this._container.className = 'vjmap-ctrl';
        this._container.textContent = 'Hello, world';
        return this._container;
    }

    onRemove() {
        this._container.parentNode.removeChild(this._container);
        this._map = undefined;
    }
}

// Control implemented as ES5 prototypical class
function HelloWorldControl() { }

HelloWorldControl.prototype.onAdd = function(map) {
    this._map = map;
    this._container = document.createElement('div');
    this._container.className = 'vjmap-ctrl';
    this._container.textContent = 'Hello, world';
    return this._container;
};

HelloWorldControl.prototype.onRemove = function () {
     this._container.parentNode.removeChild(this._container);
     this._map = undefined;
};
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

# onAdd

在地图上注册一个控件并让它有机会注册事件侦听器和资源。该方法由Map#addControl 内部调用。

# Parameters

  • map **映射**此控件将添加到的映射

返回**HTMLElement**控件的容器元素。这应该由控件创建并由 onAdd 返回而不附加到 DOM:地图将根据需要将控件的元素插入到 DOM 中。

# onRemove

取消注册地图上的控件并让它有机会分离事件侦听器和资源。该方法由Map#removeControl 内部调用。

# Parameters

  • map **映射**此控件将从中删除的映射

返回**undefined**此方法不需要返回值

# getDefaultPosition

(可选)为此控件提供默认位置。如果实现了该方法并且没有position 参数的情况下调用Map#addControl,则 getDefaultPosition 返回的值将用作控件的位置。

返回**string**一个控件位置,它是 addControl 中有效值之一。

# point

一个``Point几何对象,它具有 xy表示在像素的屏幕坐标特性。

类型: Object

# Examples

var point = new vjmap.Point(-77, 38);
1

# PointLike

或代表两个数字的阵列xy以像素为单位的屏幕坐标。

类型:(| Array< number>)

# Examples

var p1 = new vjmap.Point(-77, 38); // a PointLike which is a Point
var p2 = [-77, 38]; // a PointLike which is an array of two numbers
1
2

# ProxySourceCache

扩展 SourceCache

代理源缓存获得理想的屏幕图块覆盖坐标。所有其他源缓存的坐标被映射到代理坐标的子区域(反之亦然,来自所有源缓存的较大切片的子区域被映射到完整的代理切片)。这发生在 Terrain.updateTileBinding 中的每次绘制调用中。方法在这里用于地形:所有源缓存的所有可见源图块都被渲染到代理源缓存纹理,然后覆盖在地形上。它在未来可重用于处理过度调用,因为桶只能为代理瓦片内容构建,而不是为完全过度调用的矢量瓦片构建。

# Parameters

  • map 地图

# ProxiedTileID

扩展 OverscaledTileID

Canonical、wrap 和 overscaledZ 包含原始源缓存瓦片的信息。此图块被正交渲染到代理图块(由 proxyTileKey 定义)。posMatrix 保存用于将原始图块内容渲染到代理图块的正交、缩放和平移信息。代理图块覆盖原始图块的整个或子矩形。

# Parameters

  • tileID 超大TileID
  • proxyTileKey number
  • projMatrix Float32Array

# ElevationQueryOptions

Map#queryTerrainElevationMap#unproject3d 的通用选项,用于控制高程数据的返回方式。

类型: Object

# Properties

  • exaggerated **boolean**当设置为true返回exaggeration已应用样式上的地形的高程值时,当false它返回未应用样式的基础数据的原始值时。

# Elevation

提供对来自 raster-dem 源缓存的高程数据的访问。

# getAtPointOrZero

周围的帮助getAtPoint程序保证返回一个数值。

# Parameters

  • point 墨卡托坐标
  • defaultIfNotLoaded number (可选,默认0

返回 number

# getAtPoint

指定点的海拔高度(以米为单位)。

# Parameters

  • point **MercatorCoordinate点的**卡托坐标。
  • defaultIfNotLoaded number 如果未加载提供的点的 dem 磁贴,则返回的值
  • exaggerated boolean (可选,默认true

**number**以米为单位返回海拔高度。如果没有加载的包含所请求点高程信息的图块,则返回defaultIfNotLoaded。不调用网络请求来获取数据。

# getMinMaxForTile

获取由 标识的图块的最低和最高高度tileID

# Parameters

  • tileID OverscaledTileID是我们从中读取信息的 DEM 切片的子切片(或覆盖相同的空间)。

返回**{min: number, max: number}?** 最小和最大海拔。

# getMinElevationBelowMSL

获取可见图块低于 MSL 的最低高度。此函数考虑了地形夸大,并且基于最大 DEM 误差是保守的,不要期望此函数提供准确的值。如果没有可见的负高程,则此函数返回 0。

返回**number**所有可见图块低于海平面的最小海拔。

# raycast

对屏幕上的可见 DEM 图块执行光线投射并返回沿光线行进的距离。位置的 x 和 y 分量预计在标准化墨卡托坐标 [0, 1] 和 z 以米为单位。

# Parameters

  • position vec3射线原点。
  • dir vec3射线方向。
  • exaggeration number 地形夸张。

返回**number?**

# pointCoordinate

给定屏幕上的一个点,返回地形上的 3D MercatorCoordinate。包装raycast.

# Parameters

  • screenPoint **Point**左上角原点坐标系中以像素为单位的屏幕点。

返回vec3如果与地形有交点,则返回 3D 墨卡托坐标的交点,如 vec3(x, y, z),否则为 null。

# DEMSampler

Helper 类计算并缓存在切片级别查找高程偏移所需的数据。

# Parameters

  • demTile Tile
  • scale number
  • offset [ number, number]

# BoxZoomHandler

BoxZoomHandler允许用户放大地图,以适应边框内。通过shift在拖动光标的同时单击并按住来定义边界框。

# Parameters

  • map 地图
  • options {clickTolerance:number}

# isEnabled

返回一个布尔值,指示是否启用“框缩放”交互。

如果启用了“框缩放”交互,则返回。boolean true

# isActive

返回一个布尔值,指示“框缩放”交互是否处于活动状态,即当前正在使用。

返回如果“框放大”作用是积极的。boolean true

# enable

启用“框缩放”交互。

# Examples

map.boxZoom.enable();
1

# disable

禁用“框缩放”交互。

# Examples

map.boxZoom.disable();
1

# TouchPitchHandler

扩展 TwoTouchHandler

TouchPitchHandler由地图拖动向上和向下两个手指,用户可以间距。

# isEnabled

返回一个布尔值,指示是否启用了“拖动到音高”交互。

如果启用了“拖动到音高”交互,则返回。boolean true

# isActive

返回一个布尔值,指示“拖动到音高”交互是否处于活动状态,即当前正在使用。

返回如果“拖动间距”互动是有效的。boolean true

# enable

启用“拖动到音高”交互。

# Examples

map.touchPitch.enable();
1

# disable

禁用“拖动到音高”交互。

# Examples

map.touchPitch.disable();
1

# KeyboardHandler

KeyboardHandler允许用户放大,缩小,旋转,并使用以下键盘快捷键平移地图:

  • =/ +:将缩放级别增加 1。
  • Shift-=/ Shift-+:将缩放级别增加 2。
  • -:将缩放级别降低 1。
  • Shift--:将缩放级别降低 2。
  • 箭头键:平移 100 像素。
  • Shift+⇢:将旋转增加 15 度。
  • Shift+⇠:将旋转减少 15 度。
  • Shift+⇡:将音高增加 10 度。
  • Shift+⇣:将音高降低 10 度。

# enable

启用“键盘旋转和缩放”交互。

# Examples

map.keyboard.enable();
1

# disable

禁用“键盘旋转和缩放”交互。

# Examples

map.keyboard.disable();
1

# isEnabled

返回一个布尔值,指示是否启用“键盘旋转和缩放”交互。

返回是否启用了“键盘旋转和缩放”交互。boolean true

# isActive

如果处理程序已启用并检测到缩放/旋转手势的开始,则返回 true。

返回处理程序是否已启用并已检测到缩放/旋转手势的开始。boolean true

# disableRotation

禁用“键盘平移/旋转”交互,启用“键盘缩放”交互。

# Examples

map.keyboard.disableRotation();
1

# enableRotation

启用“键盘平移/旋转”交互。

# Examples

map.keyboard.enable();
  map.keyboard.enableRotation();
1
2

# ScrollZoomHandler

ScrollZoomHandler允许用户通过滚动缩放地图。

# Parameters

  • map 地图
  • handler 处理程序管理器

# setZoomRate

设置触控板的缩放率。

# Parameters

  • zoomRate **number**用于将触控板移动缩放到缩放值的速率。(可选,默认1/100

# Examples

// Speed up trackpad zoom
map.scrollZoom.setZoomRate(1/25);
1
2

# setWheelZoomRate

设置鼠标滚轮的缩放率。

# Parameters

  • wheelZoomRate **number**用于将鼠标滚轮移动缩放到缩放值的速率。(可选,默认1/450

# Examples

// Slow down zoom of mouse wheel
map.scrollZoom.setWheelZoomRate(1/600);
1
2

# isEnabled

返回一个布尔值,指示是否启用了“滚动缩放”交互。

如果启用了“滚动缩放”交互,则返回。boolean true

# enable

启用“滚动缩放”交互。

# Parameters

  • options Object? 选项对象。
    • options.around string? 如果传递“center”,地图将围绕地图中心缩放

# Examples

map.scrollZoom.enable();
1
map.scrollZoom.enable({ around: 'center' })
1

# disable

禁用“滚动缩放”交互。

# Examples

map.scrollZoom.disable();
1

# DoubleClickZoomHandler

DoubleClickZoomHandler允许用户在通过双击或双攻一个点缩放地图。

# Parameters

  • clickZoom 单击缩放处理程序
  • TapZoom TapZoomHandler

# enable

启用“双击缩放”交互。

# Examples

map.doubleClickZoom.enable();
1

# disable

禁用“双击缩放”交互。

# Examples

map.doubleClickZoom.disable();
1

# isEnabled

返回一个布尔值,指示是否启用“双击缩放”交互。

如果启用了“双击缩放”交互,则返回。boolean true

# isActive

返回一个布尔值,指示“双击缩放”交互是否处于活动状态,即当前正在使用。

返回如果“双击缩放”互动是有效的。boolean true

# DragPanHandler

DragPanHandler允许用户通过点击并拖动光标以平移地图。

# Parameters

  • el HTMLElement
  • mousePan 鼠标平移处理器
  • touchPan 触摸屏处理器

# enable

启用“拖动平移”交互。

# Parameters

  • options Object? 选项对象。
    • options.linearity **number**用于缩放拖动速度的因子(可选,默认0
    • options.easing map.panTo应用拖动时应用的函数缓动函数。(可选,默认bezier(0,0,0.3,1)
    • options.maxSpeed **number**阻力速度的最大值。(可选,默认1400
    • options.deceleration **number**平底锅结束后速度降低的速率。(可选,默认2500

# Examples

map.dragPan.enable();
1
map.dragPan.enable({
     linearity: 0.3,
     easing: bezier(0, 0, 0.3, 1),
     maxSpeed: 1400,
     deceleration: 2500,
  });
1
2
3
4
5
6

# disable

禁用“拖动平移”交互。

# Examples

map.dragPan.disable();
1

# isEnabled

返回一个布尔值,指示是否启用了“拖动平移”交互。

如果启用了“拖动平移”交互,则返回。boolean true

# isActive

返回一个布尔值,指示“拖动平移”交互是否处于活动状态,即当前正在使用。

返回如果“拖动进行平移”互动是有效的。boolean true

# DragRotateHandler

DragRotateHandler允许用户通过点击并拖动光标按住鼠标右键或向旋转地图ctrl键。

# Parameters

  • options Object?
  • mouseRotate 鼠标旋转处理程序
  • mousePitch 鼠标音调处理程序

# enable

启用“拖动旋转”交互。

# Examples

map.dragRotate.enable();
1

# disable

禁用“拖动旋转”交互。

# Examples

map.dragRotate.disable();
1

# isEnabled

返回一个布尔值,指示是否启用“拖动旋转”交互。

如果启用了“拖动旋转”交互,则返回。boolean true

# isActive

返回一个布尔值,指示“拖动旋转”交互是否处于活动状态,即当前正在使用。

返回如果“拖动以旋转”互动是有效的。boolean true

# TouchZoomRotateHandler

TouchZoomRotateHandler允许用户放大和捏在触摸屏上旋转地图。

他们可以通过双击和拖动用一根手指进行缩放。在第二次点击时,按住手指并向上或向下拖动以放大或缩小。

# Parameters

  • el HTMLElement
  • touchZoom TouchZoomHandler
  • touchRotate TouchRotateHandler
  • tapDragZoom TapDragZoomHandler

# enable

启用“捏合旋转和缩放”交互。

# Parameters

  • options Object? 选项对象。
    • options.around string? 如果传递“center”,地图将围绕中心缩放

# Examples

map.touchZoomRotate.enable();
1
map.touchZoomRotate.enable({ around: 'center' });
1

# disable

禁用“捏合旋转和缩放”交互。

# Examples

map.touchZoomRotate.disable();
1

# isEnabled

返回一个布尔值,指示是否启用了“捏合旋转和缩放”交互。

返回如果“掐去旋转和缩放”启用互动。boolean true

# isActive

如果处理程序已启用并检测到缩放/旋转手势的开始,则返回 true。

返回 boolean

# disableRotation

禁用“捏合旋转”交互,启用“捏合缩放”交互。

# Examples

map.touchZoomRotate.disableRotation();
1

# enableRotation

启用“捏合旋转”交互。

# Examples

map.touchZoomRotate.enable();
  map.touchZoomRotate.enableRotation();
1
2

# CameraOptions

常见的选项地图#jumpTo地图#easeTo地图#一个FlyTo,控制摄像机的所需位置,缩放,轴承,和俯仰。所有属性都是可选的,当省略某个属性时,该属性的当前相机值将保持不变。

类型: Object

# Properties

  • center **LngLatLike**所需的中心。
  • zoom number 所需的缩放级别。
  • bearing **number**以度为单位的所需方位。方位是“向上”的罗盘方向。例如,bearing: 90调整地图的方向,使东方朝上。
  • pitch **number**所需的度数。俯仰角是与地平线的角度,以度为单位,范围在 0 到 60 度之间。例如,pitch: 0 提供了直视地图的外观,而 pitch: 60 使用户的视角向地平线倾斜。增加间距值通常用于显示 3D 对象。
  • around **LngLatLike**如果zoom指定,则around确定缩放的中心点。
  • padding **PaddingOptions**应用在视口每一侧以移动消失点的尺寸(以像素为单位)。

# Examples

// set the map's initial perspective with CameraOptions
var map = new vjmap.Map({
  container: 'map',
  style: 'your style',
  center: [-73.5804, 45.53483],
  pitch: 60,
  bearing: -60,
  zoom: 10
});
1
2
3
4
5
6
7
8
9

# AnimationOptions

涉及动画的地图移动方法常见的选项,例如Map#panByMap#easeTo,控制动画的持续时间和缓动功能。所有属性都是可选的。

类型: Object

# Properties

  • duration number 动画的持续时间,以毫秒为单位。
  • easing 函数一个函数在 0..1 范围内花费时间并返回一个数字,其中 0 是初始状态,1 是最终状态。
  • offset 动画结束时目标中心相对于真实地图容器中心的**PointLike**。
  • animate **boolean**如果false,则不会发生动画。
  • essential **boolean**如果true,则动画被认为是必不可少的,不会受到 ``prefers-reduced-motion.

# PaddingOptions

用于在调用Map#fitBoundsMap#fitScreenCoordinatesMap#setPadding等方法时设置填充的选项。调整这些选项以设置添加到画布边缘的像素填充量。在所有边缘或每个边缘的单个值上设置统一的填充。此对象的所有属性必须是非负整数。

类型: Object

# Properties

  • top number 从地图画布顶部以像素为单位的填充。
  • bottom number 以像素为单位从地图画布底部填充。
  • left number 从地图画布左侧以像素为单位的填充。
  • right number 从地图画布右侧以像素为单位的填充。

# Examples

var bbox = [[-79, 43], [-73, 45]];
map.fitBounds(bbox, {
  padding: {top: 10, bottom:25, left: 15, right: 5}
});
1
2
3
4
var bbox = [[-79, 43], [-73, 45]];
map.fitBounds(bbox, {
  padding: 20
});
1
2
3
4

一个NavigationControl控件包含缩放按钮和一个指南针。使用Map#addControl将此控件添加到地图。

# Parameters

  • options Object?
    • options.showCompass **布尔值**如果true包含指南针按钮。(可选,默认true
    • options.showZoom **布尔值**如果true包括放大和缩小按钮。(可选,默认true
    • options.visualizePitch **布尔值**如果true通过旋转罗盘的 X 轴来可视化俯仰。(可选,默认false

# Examples

var nav = new vjmap.NavigationControl();
map.addControl(nav, 'top-left');
1
2

# GeolocateControl

扩展事件

一个GeolocateControl控件提供了使用浏览器的地理位置API,以在地图上定位用户的按钮。使用Map#addControl将此控件添加到地图。

并非所有浏览器都支持地理定位,一些用户可能会禁用该功能。对包括 Chrome 在内的现代浏览器的地理定位支持要求站点通过 HTTPS 提供服务。如果地理定位支持不可用,则 GeolocateControl 将显示为禁用。

应用的缩放级别将取决于设备提供的地理位置的准确性。

GeolocateControl 有两种模式。如果trackUserLocationfalse(默认),则控件充当按钮,按下按钮时会将地图的相机设置为定位用户位置。如果用户移动,地图将不会更新。这最适合桌面。如果trackUserLocationtrue,控制作为一个拨动按钮活性当用户的位置被主动监视更改。在这种模式下 GeolocateControl 具有三种交互状态:

  • active - 随着用户位置的变化,地图的相机会自动更新,将位置点保持在中心。初始状态和单击GeolocateControl按钮时。
  • 被动 - 用户的位置点会自动更新,但地图的相机不会。在用户启动地图移动时发生。
  • 禁用 - 如果地理位置不可用、禁用或被拒绝,则会发生。

这些交互状态不能以编程方式控制,而是根据用户交互设置。

# Parameters

  • options Object?
    • options.positionOptions **Object**地理定位 API PositionOptions目的。(可选,默认{enableHighAccuracy:false,timeout:6000}
    • options.fitBoundsOptions **Object**一个Map#fitBounds选项对象,当地图被平移和缩放到用户的位置时使用。默认值是使用maxZoom15 来限制地图为非常准确的位置放大的距离。(可选,默认{maxZoom:15}
    • options.trackUserLocation **Object**如果trueGeolocate Control 变成一个切换按钮,并且当它处于活动状态时,地图将随着用户位置的变化接收更新。(可选,默认false
    • options.showAccuracyCircle **Object**默认情况下,如果 showUserLocation 为true,则会在用户位置周围绘制一个透明圆圈,指示用户位置的准确性(95% 置信度)。设置false为禁用。当 showUserLocation 为 时始终禁用false。(可选,默认true
    • options.showUserLocation **Object**默认情况下,用户所在位置的地图上将显示一个点。设置false为禁用。(可选,默认true

# Examples

map.addControl(new vjmap.GeolocateControl({
    positionOptions: {
        enableHighAccuracy: true
    },
    trackUserLocation: true
}));
1
2
3
4
5
6

# trigger

以编程方式请求地图并将其移动到用户的位置。

# Examples

// Initialize the geolocate control.
var geolocate = new vjmap.GeolocateControl({
 positionOptions: {
   enableHighAccuracy: true
 },
 trackUserLocation: true
});
// Add the control to the map.
map.addControl(geolocate);
map.on('load', function() {
  geolocate.trigger();
});
1
2
3
4
5
6
7
8
9
10
11
12

返回**boolean**返回false如果之前控制被添加到地图叫,否则返回true

# geolocate

在每次成功返回的 Geolocation API 位置更新上触发。

# Properties

  • data **位置**返回的位置 ``Geolocation.getCurrentPosition()回调中的对象 ``或Geolocation.watchPosition().

# Examples

// Initialize the geolocate control.
var geolocate = new vjmap.GeolocateControl({
  positionOptions: {
      enableHighAccuracy: true
  },
  trackUserLocation: true
});
// Add the control to the map.
map.addControl(geolocate);
// Set an event listener that fires
// when a geolocate event occurs.
geolocate.on('geolocate', function() {
  console.log('A geolocate event has occurred.')
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14

# error

在作为错误返回的每个 Geolocation API 位置更新时触发。

# Properties

  • data **位置误差**返回的PositionError ``Geolocation.getCurrentPosition()回调中的对象 ``或Geolocation.watchPosition().

# Examples

// Initialize the geolocate control.
var geolocate = new vjmap.GeolocateControl({
  positionOptions: {
      enableHighAccuracy: true
  },
  trackUserLocation: true
});
// Add the control to the map.
map.addControl(geolocate);
// Set an event listener that fires
// when an error event occurs.
geolocate.on('error', function() {
  console.log('An error event has occurred.')
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14

# outofmaxbounds

在每个 Geolocation API 位置更新时触发,该位置更新返回成功,但用户位置超出地图 maxBounds。

# Properties

  • data **位置**返回的位置 ``Geolocation.getCurrentPosition()回调中的对象 ``或Geolocation.watchPosition().

# Examples

// Initialize the geolocate control.
var geolocate = new vjmap.GeolocateControl({
  positionOptions: {
      enableHighAccuracy: true
  },
  trackUserLocation: true
});
// Add the control to the map.
map.addControl(geolocate);
// Set an event listener that fires
// when an outofmaxbounds event occurs.
geolocate.on('outofmaxbounds', function() {
  console.log('An outofmaxbounds event has occurred.')
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14

# trackuserlocationstart

当 Geolocate Control 更改为活动锁定状态时触发,该状态发生在第一次为用户成功获取 Geolocation API 位置时(随后将发生 geolocate 事件),或者用户在使用最后一个的后台状态时单击 geolocate 按钮已知位置重新定位地图并进入活动锁定状态(除非用户的位置发生变化,否则不会发生地理定位事件)。

# Examples

// Initialize the geolocate control.
var geolocate = new vjmap.GeolocateControl({
  positionOptions: {
      enableHighAccuracy: true
  },
  trackUserLocation: true
});
// Add the control to the map.
map.addControl(geolocate);
// Set an event listener that fires
// when a trackuserlocationstart event occurs.
geolocate.on('trackuserlocationstart', function() {
  console.log('A trackuserlocationstart event has occurred.')
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14

# trackuserlocationend

当 Geolocate Control 更改为后台状态时触发,当用户在活动位置锁定期间更改相机时会发生这种情况。这仅在 trackUserLocation 为 true 时适用。在后台状态下,地图上的点会随着位置更新而更新,但相机不会。

# Examples

// Initialize the geolocate control.
var geolocate = new vjmap.GeolocateControl({
  positionOptions: {
      enableHighAccuracy: true
  },
  trackUserLocation: true
});
// Add the control to the map.
map.addControl(geolocate);
// Set an event listener that fires
// when a trackuserlocationend event occurs.
geolocate.on('trackuserlocationend', function() {
  console.log('A trackuserlocationend event has occurred.')
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14

# AttributionControl

一个AttributionControl控件显示地图的属性信息. 使用Map#addControl将此控件添加到地图。

# Parameters

  • options Object? (可选,默认{}
    • options.compact boolean? 如果true,则强制使用紧凑属性,在鼠标悬停时显示完整属性。如果false,则强制执行完全归因控制。默认为响应式属性,当地图宽度小于 640 像素时会折叠。如果可以轻松地放置在地图上,则不应折叠归因。compact仅当地图大小无法适应默认属性时,才应用于修改默认属性 当默认设置的自动紧凑调整大小不够时。
    • options.customAttribution **( string| Array< string>)?**除了任何其他属性之外要显示的一个或多个字符串。您还可以在使用customAttribution 选项初始化地图时设置自定义属性 ``.

# Examples

var map = new vjmap.Map({attributionControl: false})
    .addControl(new vjmap.AttributionControl({
        customAttribution: 'Map design by me'
    }));
1
2
3
4

# ScaleControl

ScaleControl控制显示的距离的地图可以在地面上对应的距离上的比率。使用Map#addControl将此控件添加到地图。

# Parameters

  • options Object?
    • options.maxWidth **number**缩放控件的最大长度(以像素为单位)。(可选,默认'100'
    • options.unit **string**距离单位('imperial''metric''nautical')。(可选,默认'metric'

# Examples

var scale = new vjmap.ScaleControl({
    maxWidth: 80,
    unit: 'imperial'
});
map.addControl(scale);

scale.setUnit('metric');
1
2
3
4
5
6
7

# setUnit

设置距离的比例单位

# Parameters

  • unit Unit距离的单位('imperial''metric''nautical')。

# FullscreenControl

FullscreenControl控制包含用于进出的全屏模式切换地图的按钮。查看requestFullScreen 兼容性表 ](https://developer.mozilla.org/en-US/docs/Web/API/Element/requestFullScreen#browser_compatibility)对于支持的浏览器。使用[Map#addControl将此控件添加到地图。

# Parameters

  • options Object?
    • options.container HTMLElement? container兼容的 DOM 元素这应该是全屏的。默认情况下,地图容器元素将全屏显示。

# Examples

map.addControl(new vjmap.FullscreenControl({container: document.querySelector('body')}));
1

扩展事件

一个弹出组件。

# Parameters

  • options Object?
    • options.closeButton **boolean**如果true,弹出窗口的右上角将出现一个关闭按钮。(可选,默认true
    • options.closeOnClick **boolean**如果true,则单击地图时将关闭弹出窗口。(可选,默认true
    • options.closeOnMove **boolean**如果true,则当地图移动时弹出窗口将关闭。(可选,默认false
    • options.focusAfterOpen **boolean**如果true,则弹出窗口将尝试聚焦弹出窗口内的第一个可聚焦元素。(可选,默认true
    • options.anchor string? 一个字符串,指示应该通过Popup#setLngLat定位到最接近坐标集的Popup 部分。选项包括'center''top''bottom''left''right''top-left''top-right''bottom-left',和'bottom-right'。如果未设置,锚点将被动态设置以确保弹出窗口位于地图容器内,并且优先选择'bottom'
    • options.offset ( number| PointLike | Object)? 应用于弹出窗口位置的像素偏移指定为:- 指定与弹出窗口位置距离的单个数字
      • 指定常量偏移量的PointLike
      • Point s的对象,指定每个锚点位置的偏移量负偏移表示向左和向上。
    • options.className string? 添加到弹出容器的以空格分隔的 CSS 类名
    • options.maxWidth string 设置弹出窗口最大宽度的 CSS 属性的字符串,例如'300px'. 要确保弹出窗口调整大小以适合其内容,请将此属性设置为'none'。可用值可以在这里找到:https : //developer.mozilla.org/en-US/docs/Web/CSS/max-width(可选,默认'240px'

# Examples

var markerHeight = 50, markerRadius = 10, linearOffset = 25;
var popupOffsets = {
 'top': [0, 0],
 'top-left': [0,0],
 'top-right': [0,0],
 'bottom': [0, -markerHeight],
 'bottom-left': [linearOffset, (markerHeight - markerRadius + linearOffset) * -1],
 'bottom-right': [-linearOffset, (markerHeight - markerRadius + linearOffset) * -1],
 'left': [markerRadius, (markerHeight - markerRadius) * -1],
 'right': [-markerRadius, (markerHeight - markerRadius) * -1]
 };
var popup = new vjmap.Popup({offset: popupOffsets, className: 'my-class'})
  .setLngLat(e.lngLat)
  .setHTML("&lt;h1>Hello World!&lt;/h1>")
  .setMaxWidth("300px")
  .addTo(map);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

# addTo

将弹出窗口添加到地图。

# Parameters

  • map **Map**要添加弹出窗口的地图。

# Examples

new vjmap.Popup()
  .setLngLat([0, 0])
  .setHTML("&lt;h1>Null Island&lt;/h1>")
  .addTo(map);
1
2
3
4

返回**弹出窗口** this

# isOpen

如果弹出窗口是打开的,如果它是关闭的,则返回。boolean true``false

# remove

从已添加到的地图中删除弹出窗口。

# Examples

var popup = new vjmap.Popup().addTo(map);
popup.remove();
1
2

返回**弹出窗口** this

# getLngLat

返回弹出窗口锚点的地理位置。

结果的经度可能与先前设置的经度相差 360 度的倍数,setLngLat因为Popup将锚定经度包装在世界的副本上以保持弹出窗口在屏幕上。

返回**LngLat**弹出窗口锚点的地理位置。

# setLngLat

设置弹出窗口锚点的地理位置,并将弹出窗口移动到它。替换 trackPointer() 行为。

# Parameters

  • lnglat **LngLatLike**设置为弹出窗口锚点的地理位置。

返回**弹出窗口** this

# trackPointer

使用指针设备将弹出锚点跟踪到屏幕上的光标位置(它将在触摸屏上隐藏)。替换setLngLat行为。对于大多数用例,将closeOnClick和设置closeButtonfalse

# Examples

var popup = new vjmap.Popup({ closeOnClick: false, closeButton: false })
  .setHTML("&lt;h1>Hello World!&lt;/h1>")
  .trackPointer()
  .addTo(map);
1
2
3
4

返回**弹出窗口** this

# getElement

返回Popup的 HTML 元素。

# Examples

// Change the `Popup` element's font size
var popup = new vjmap.Popup()
  .setLngLat([-96, 37.8])
  .setHTML("&lt;p>Hello World!&lt;/p>")
  .addTo(map);
var popupElem = popup.getElement();
popupElem.style.fontSize = "25px";
1
2
3
4
5
6
7

返回**HTMLElement**元素

# setText

将弹出窗口的内容设置为一串文本。

此函数创建一个文本DOM 中的节点,因此它无法插入原始 HTML。如果弹出内容是用户提供的,请使用此方法来防止 XSS。

# Parameters

  • text string 弹出窗口的文本内容。

# Examples

var popup = new vjmap.Popup()
  .setLngLat(e.lngLat)
  .setText('Hello, world!')
  .addTo(map);
1
2
3
4

返回**弹出窗口** this

# setHTML

将弹出窗口的内容设置为作为字符串提供的 HTML。

此方法不执行 HTML 过滤或清理,并且必须仅用于受信任的内容。如果内容是不受信任的文本字符串,请考虑Popup#setText

# Parameters

  • html string 表示弹出窗口的 HTML 内容的字符串。

# Examples

var popup = new vjmap.Popup()
  .setLngLat(e.lngLat)
  .setHTML("&lt;h1>Hello World!&lt;/h1>")
  .addTo(map);
1
2
3
4

返回**弹出窗口** this

# getMaxWidth

返回弹出窗口的最大宽度。

返回**string**弹出窗口的最大宽度。

# setMaxWidth

设置弹出窗口的最大宽度。这是设置 CSS 属性max-width。可用值可以在这里找到:https : //developer.mozilla.org/en-US/docs/Web/CSS/max-width

# Parameters

  • maxWidth string 表示最大宽度值的字符串。

返回**弹出窗口** this

# setDOMContent

将弹出窗口的内容设置为作为 DOM 节点提供的元素。

# Parameters

  • htmlNode 节点 用作弹出窗口内容的 DOM 节点。

# Examples

// create an element with the popup content
var div = window.document.createElement('div');
div.innerHTML = 'Hello, world!';
var popup = new vjmap.Popup()
  .setLngLat(e.lngLat)
  .setDOMContent(div)
  .addTo(map);
1
2
3
4
5
6
7

返回**弹出窗口** this

# addClassName

将 CSS 类添加到弹出式容器元素。

# Parameters

  • className string 要添加到弹出式容器的具有 CSS 类名的非空字符串

# Examples

let popup = new vjmap.Popup()
popup.addClassName('some-class')
1
2

# removeClassName

从弹出式容器元素中删除 CSS 类。

# Parameters

  • className string 要从弹出式容器中删除的具有 CSS 类名的非空字符串

# Examples

let popup = new vjmap.Popup()
popup.removeClassName('some-class')
1
2

# setOffset

设置弹出窗口的偏移量。

# Parameters

  • offset **抵消?**设置弹出窗口的偏移量。

返回**弹出窗口** this

# toggleClassName

在弹出容器上添加或删除给定的 CSS 类,具体取决于容器当前是否具有该类。

# Parameters

  • className string 要添加/删除的带有 CSS 类名的非空字符串

# Examples

let popup = new vjmap.Popup()
popup.toggleClassName('toggleClass')
1
2

返回**boolean**如果取出假回报类,如果加入的类,然后返回true

# open

当手动或以编程方式打开弹出窗口时触发。

类型: Object

# Properties

  • popup 已打开的**弹出**对象

# Examples

// Create a popup
var popup = new vjmap.Popup();
// Set an event listener that will fire
// any time the popup is opened
popup.on('open', function(){
  console.log('popup was opened');
});
1
2
3
4
5
6
7

# close

当手动或以编程方式关闭弹出窗口时触发。

类型: Object

# Properties

  • popup 已关闭的**弹出**对象

# Examples

// Create a popup
var popup = new vjmap.Popup();
// Set an event listener that will fire
// any time the popup is closed
popup.on('close', function(){
  console.log('popup was closed');
});
1
2
3
4
5
6
7

# MapMouseEvent

扩展对象

MapMouseEvent是其他类使用的类,用于生成特定类型的鼠标事件,例如“单击”或“悬停”。有关可用事件的完整列表,请参阅``Mapevents

# Parameters

  • type string
  • map 地图
  • originalEvent 鼠标事件
  • data Object (可选,默认{}

# Examples

// Example of a MapMouseEvent of type "click"
{
    lngLat: {
        lng: 40.203,
        lat: -74.451
    },
    originalEvent: {...},
    point: {
        x: 266,
        y: 464
    },
     target: {...},
     type: "click"
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14

# type

始发事件的类型。有关可用事件的完整列表,请参阅``Mapevents

类型:("mousedown"| "mouseup"| "click"| "dblclick"| "mousemove"| "mouseover"| "mouseenter"| "mouseleave"| "mouseout"| "contextmenu"

# target

Map触发事件的对象。

类型:地图

# originalEvent

引发地图事件的 DOM 事件。

类型:鼠标事件

# point

鼠标光标的像素坐标,相对于地图并从左上角开始测量。

类型:

# LngLat

鼠标光标在地图上的地理位置。

类型:LngLat

# preventDefault

阻止地图对事件的后续默认处理。

调用此方法将阻止以下默认地图行为:

  • mousedown事件上,DragPanHandler][191]的行为[
  • mousedown事件上,DragRotateHandler][192]的行为[
  • mousedown事件上,BoxZoomHandler][178]的行为[
  • dblclick事件上,DoubleClickZoomHandler][190]的行为[

# MapTouchEvent

扩展对象

MapTouchEvent是其他类用来生成特定类型的鼠标事件的类,例如“touchstart”或“touchend”。有关可用事件的完整列表,请参阅``Mapevents

# Parameters

  • type string
  • map 地图
  • originalEvent 触摸事件

# Examples

// Example of a MapTouchEvent of type "touch"
{
  lngLat: {
     lng: 40.203,
     lat: -74.451
  },
  lngLats: [
     {
        lng: 40.203,
        lat: -74.451
     }
  ],
  originalEvent: {...},
  point: {
     x: 266,
     y: 464
  },
  points: [
     {
        x: 266,
        y: 464
     }
  ]
  preventDefault(),
  target: {...},
  type: "touchstart"
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

# type

始发事件的类型。有关可用事件的完整列表,请参阅``Mapevents

类型:( "touchstart"| "touchend"| "touchcancel")

# target

Map触发事件的对象。

类型:地图

# originalEvent

引发地图事件的 DOM 事件。

类型:触摸事件

# LngLat

地图上触摸事件点中心的地理位置。

类型:LngLat

# point

触摸事件点中心的像素坐标,相对于地图,从左上角开始测量。

类型:

# points

对应于触摸事件的像素坐标数组 touches 财产。

类型:Array<>

# lngLats

地图上对应于触摸事件的地理位置 touches 财产。

类型:Array< LngLat >

# preventDefault

阻止地图对事件的后续默认处理。

调用此方法将阻止以下默认地图行为:

  • touchstart事件上,DragPanHandler][191]的行为[
  • touchstart事件上,TouchZoomRotateHandler][193]的行为[

# MapWheelEvent

扩展对象

MapWheelEvent是其他类用来生成特定类型的鼠标事件(例如“轮”)的类。有关可用事件的完整列表,请参阅``Mapevents

# Parameters

  • type string
  • map 地图
  • originalEvent 轮事件

# Examples

// Example of a MapWheelEvent of type "wheel"
{
  originalEvent: WheelEvent {...},
	 target: Map {...},
	 type: "wheel"
}
1
2
3
4
5
6

# type

始发事件的类型。有关可用事件的完整列表,请参阅``Mapevents

类型: "wheel"

# target

Map触发事件的对象。

类型:地图

# originalEvent

引发地图事件的 DOM 事件。

类型:WheelEvent

# preventDefault

阻止地图对事件的后续默认处理。

调用此方法将阻止ScrollZoomHandler的行为。

# ZoomEvent

ZoomEvent是其他类用来生成特定类型的鼠标事件的类,例如“boxzoomstart”或“boxzoomend”。有关可用事件的完整列表,请参阅``Mapevents

类型: Object

# Properties

  • originalEvent **鼠标事件**触发 boxzoom 事件的 DOM 事件。可以是一个MouseEventKeyboardEvent
  • type **string**始发事件的类型。有关可用事件的完整列表,请参阅``Mapevents
  • target MapMap触发事件的实例

# Examples

// Example of a BoxZoomEvent of type "boxzoomstart"
{
  originalEvent: {...},
  type: "boxzoomstart",
  target: {...}
}
1
2
3
4
5
6

# MapDataEvent

MapDataEvent是其他类用来生成特定类型的鼠标事件的类,例如“sourcedata”或“dataloading”。有关可用事件的完整列表,请参阅``Mapevents

类型: Object

# Properties

  • type **string**始发事件的类型。有关可用事件的完整列表,请参阅``Mapevents
  • dataType **string**已更改的数据类型。一个'source''style',其中'source'是指与任何源相关联的数据,以及'style'指的是整个的风格 被地图使用。
  • isSourceLoaded boolean? 如果事件有一个dataTypesource并且源没有未完成的网络请求,则为真。
  • source Object? 样式规范表示如果事件有一个dataTypesource
  • sourceDataType string? 如果事件具有dataTypeofsource并且事件表示内部数据已被接收或更改,则包括在内。可能的值为metadatacontentvisibility
  • tile Object? 正在加载或更改的图块,如果事件具有dataTypeofsource并且该事件与图块的加载相关。
  • coord **协调?**如果事件有瓷砖的坐标dataTypesource,而该事件涉及到瓷砖的负载。

# Examples

// Example of a MapDataEvent of type "sourcedata"
{
  dataType: "source",
  isSourceLoaded: false,
  source: {
    type: "vector",
    url: "your url"
  },
  sourceDataType: "visibility",
  sourceId: "composite",
  style: {...},
  target: {...},
  type: "sourcedata"
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14

# Marker

扩展事件

创建一个标记组件

# Parameters

  • options Object?
    • options.element HTMLElement? 用作标记的 DOM 元素。默认为浅蓝色、水滴状的 SVG 标记。
    • options.anchor **string**一个字符串,指示应该通过Marker#setLngLat定位到最接近坐标集的Marker 部分。选项包括'center''top''bottom''left''right''top-left''top-right''bottom-left',和'bottom-right'。(可选,默认'center'
    • options.offset 点像? 以像素为单位的偏移量,作为要应用的PointLike对象相对于元素的中心。负数表示向左和向上。
    • options.color **string**如果未提供 options.element,则用于默认标记的颜色。默认为浅蓝色。(可选,默认'#3FB1CE'
    • options.scale **number**如果未提供 options.element,则用于默认标记的比例。默认比例对应于 的高度41px和宽度27px。(可选,默认1
    • options.draggable **boolean**一个布尔值,指示是否可以将标记拖动到地图上的新位置。(可选,默认false
    • options.clickTolerance **number**用户在点击标记期间可以移动鼠标指针的最大像素数,以便将其视为有效点击(与标记拖动相反)。默认是继承地图的clickTolerance。(可选,默认0
    • options.rotation **number**标记相对于其各自rotationAlignment设置的旋转角度(以度为单位)。正值将顺时针旋转标记。(可选,默认0
    • options.pitchAlignment string map将 与Marker地图平面对齐。viewport将 与Marker视口平面对齐。auto自动匹配 的值rotationAlignment。(可选,默认'auto'
    • options.rotationAlignment string map对齐Marker相对于地图的旋转,在地图旋转时保持方位角。相对于视口viewport对齐Marker的旋转,与地图旋转无关。auto相当于viewport。(可选,默认'auto'
  • legacyOptions 选项?

# Examples

var marker = new vjmap.Marker()
  .setLngLat([30.5, 50.5])
  .addTo(map);
1
2
3
// Set options
var marker = new vjmap.Marker({
    color: "#FFFFFF",
    draggable: true
  }).setLngLat([30.5, 50.5])
  .addTo(map);
1
2
3
4
5
6

# addTo

将 附加MarkerMap对象。

# Parameters

  • map **Map**要添加标记的地图。

# Examples

var marker = new vjmap.Marker()
  .setLngLat([30.5, 50.5])
  .addTo(map); // add the marker to the map
1
2
3

返回**标记** this

# remove

从地图上移除标记

# Examples

var marker = new vjmap.Marker().addTo(map);
marker.remove();
1
2

返回**标记** this

# getLngLat

获取标记的地理位置。

结果的经度可能与之前设置的经度相差 360 度的倍数,setLngLat因为Marker将锚定经度包裹在世界的副本上以将标记保留在屏幕上。

# Examples

// Store the marker's longitude and latitude coordinates in a variable
var lngLat = marker.getLngLat();
// Print the marker's longitude and latitude values in the console
console.log('Longitude: ' + lngLat.lng + ', Latitude: ' + lngLat.lat )
1
2
3
4

返回**LngLat**一个LngLat描述标记的位置。

# setLngLat

设置标记的地理位置并移动它。

# Parameters

# Examples

// Create a new marker, set the longitude and latitude, and add it to the map
new vjmap.Marker()
  .setLngLat([-65.017, -16.457])
  .addTo(map);
1
2
3
4

返回**标记** this

# getElement

返回Marker的 HTML 元素。

返回**HTMLElement**元素

# setPopup

Popup绑定到Marker

# Parameters

  • popup 弹出窗口Popup类的一个实例。如果未定义或为空,则在此Marker实例上设置的任何弹出窗口都未设置。

# Examples

var marker = new vjmap.Marker()
 .setLngLat([0, 0])
 .setPopup(new vjmap.Popup().setHTML("&lt;h1>Hello World!&lt;/h1>")) // add popup
 .addTo(map);
1
2
3
4

返回**标记** this

# getPopup

返回绑定到Marker][238]的[Popup][208]实例。[

# Examples

var marker = new vjmap.Marker()
 .setLngLat([0, 0])
 .setPopup(new vjmap.Popup().setHTML("&lt;h1>Hello World!&lt;/h1>"))
 .addTo(map);

console.log(marker.getPopup()); // return the popup instance
1
2
3
4
5
6

返回**弹出**窗口

# togglePopup

打开或关闭弹出绑定到该实例标记,这取决于当前的状态弹出

# Examples

var marker = new vjmap.Marker()
 .setLngLat([0, 0])
 .setPopup(new vjmap.Popup().setHTML("&lt;h1>Hello World!&lt;/h1>"))
 .addTo(map);

marker.togglePopup(); // toggle popup open or closed
1
2
3
4
5
6

返回**标记** this

# getOffset

获取标记的偏移量。

返回**Point**标记的屏幕坐标(以像素为单位)。

# setOffset

设置标记的偏移量

# Parameters

  • offset **PointLike**作为要应用的PointLike对象相对于元素中心的偏移量(以像素为单位)。负数表示向左和向上。

返回**标记** this

# setDraggable

设置draggable标记的属性和功能

# Parameters

  • shouldBeDraggable **boolean**打开/关闭拖动功能(可选,默认false

返回**标记** this

# isDraggable

如果可以拖动标记,则返回 true

**boolean**如果标记是可拖动的,则返回True。

# setRotation

设置rotation标记的属性。

# Parameters

  • rotation **number**标记的旋转角度(顺时针,以度为单位),相对于其各自的Marker#setRotationAlignment设置。(可选,默认0

返回**标记** this

# getRotation

返回标记的当前旋转角度(以度为单位)。

返回**number**标记的当前旋转角度。

# setRotationAlignment

设置rotationAlignment标记的属性。

# Parameters

  • alignment **string**设置rotationAlignment标记的属性。(可选,默认'auto'

返回**标记** this

# getRotationAlignment

返回rotationAlignment标记的当前属性。

返回**string**标记的当前旋转对齐方式。

# setPitchAlignment

设置pitchAlignment标记的属性。

# Parameters

  • alignment string? 设置pitchAlignment标记的属性。如果对齐是“自动”,它会自动匹配rotationAlignment

返回**标记** this

# getPitchAlignment

返回pitchAlignment标记的当前属性。

返回**string**标记的当前音高对齐(以度为单位)。

# dragstart

拖动开始时触发

类型: Object

# Properties

  • marker 被拖动的**标记**对象

# drag

拖动时触发

类型: Object

# Properties

  • marker 被拖动的**标记**对象

# dragend

当标记完成拖动时触发

类型: Object

# Properties

  • marker 被拖动的**标记**对象

# StyleImageInterface

动态生成样式图像的界面。这是实现者建模的规范:它不是导出的方法或类。

可以为每一帧重新绘制实现此接口的图像。它们可用于动画图标和图案或使它们响应用户输入。样式图像可以实现 StyleImageInterface#render方法。该方法每帧调用一次,可用于更新图像。

# Properties

  • width number
  • height number
  • data ( Uint8Array| Uint8ClampedArray)

# Examples

var flashingSquare = {
    width: 64,
    height: 64,
    data: new Uint8Array(64 * 64 * 4),

    onAdd: function(map) {
        this.map = map;
    },

    render: function() {
        // keep repainting while the icon is on the map
        this.map.triggerRepaint();

        // alternate between black and white based on the time
        var value = Math.round(Date.now() / 1000) % 2 === 0  ? 255 : 0;

        // check if image needs to be changed
        if (value !== this.previousValue) {
            this.previousValue = value;

            var bytesPerPixel = 4;
            for (var x = 0; x &lt; this.width; x++) {
                for (var y = 0; y &lt; this.height; y++) {
                    var offset = (y * this.width + x) * bytesPerPixel;
                    this.data[offset + 0] = value;
                    this.data[offset + 1] = value;
                    this.data[offset + 2] = value;
                    this.data[offset + 3] = 255;
                }
            }

            // return true to indicate that the image changed
            return true;
        }
    }
 }

 map.addImage('flashing_square', flashingSquare);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

# render

在将使用图标的每一帧之前调用此方法一次。该方法可以选择data使用新图像更新图像的成员。

如果该方法更新图像,它必须返回true以提交更改。如果该方法返回false或什么都不返回,则假定图像未更改。

如果更新不频繁,使用Map#updateImage更新图像而不是实现此方法可能更容易。

如果此方法更新了图像,则返回。如果图像没有改变。boolean true``false

# onAdd

使用Map#addImage将图层添加到地图时调用的可选方法。

# Parameters

  • map **地图**此自定义图层刚刚添加到的地图。

# onRemove

使用Map#removeImage从地图中删除图标时调用的可选方法。这使图像有机会清理资源和事件侦听器。

# RequestParameters

RequestParameters从 Map.options.transformRequest 回调返回的对象。

类型: Object

# Properties

  • url string 要请求的 URL。
  • headers Object 要与请求一起发送的标头。
  • method **string**请求方法'GET' | 'POST' | 'PUT'
  • body string 请求体。
  • type **string**要返回的响应正文类型'string' | 'json' | 'arrayBuffer'
  • credentials string 'same-origin'|'include' 使用 'include' 发送带有跨域请求的 cookie。
  • collectResourceTiming boolean 如果为 true,将为这些转换后的请求收集 Resource Timing API 信息,并在相关数据事件的 resourceTiming 属性中返回。

# Examples

// use transformRequest to modify requests that begin with `http://myHost`
transformRequest: function(url, resourceType) {
 if (resourceType === 'Source' && url.indexOf('http://myHost') > -1) {
   return {
     url: url.replace('http', 'https'),
     headers: { 'my-custom-header': true },
     credentials: 'include'  // Include cookies for cross-origin requests
   }
  }
 }
1
2
3
4
5
6
7
8
9
10

# QueryGeometry

表示来自 的屏幕空间查询的数据类Map#queryRenderedFeatures。所有内部几何图形和数据都旨在是不可变的和只读的。它的生命周期仅适用于查询的持续时间和处理查询时地图的固定状态。

# isPointQuery

如果用户的初始查询是单点,则返回 true

**boolean**如果初始查询几何是单个点,则返回True

# bufferedScreenGeometry

由于数据驱动的样式特征不统一大小(例如circle-radius),并且可以与其原始位置不同地偏移(例如, with *-translate)。这意味着我们必须为每个瓦片扩展我们的查询区域以解释这些属性的变化。每个 tile 在解析时计算一个 tile 级别的最大填充值(以屏幕空间像素为单位),这个函数让我们计算每个 tile 的屏幕空间查询几何的缓冲版本。

# Parameters

  • buffer number 以屏幕空间像素为单位的平铺填充。

返回**Array< Point >**缓冲的查询几何。

# bufferedCameraGeometry

当地图倾斜时,与查询相交的一些 3D 要素将不会在地球表面与查询相交。相反,该特征可能更近,并且仅与查询相交,因为它突出到空中。

这将返回一个几何图形,它是一个凸多边形,它包含查询视锥体和相机下方的点。与 类似bufferedScreenGeometry,添加了缓冲以解决油漆属性的变化。

案例1:相机下方的点正好在查询量后面+----------+ | | | | | | + + XX XX XX XX XX

情况 2:点在右后方 +---------+ | X | X | XX + X XXX XX XXXX X XXX XX XX X XXX

情况 3:点在左后方 +---------+ X | X | XX | X + X XXXX XX XXX X XXXX X XXXX XXX

# Parameters

  • buffer number 以屏幕空间像素为单位的平铺填充。

返回**Array< Point >**缓冲的查询几何。

# containsTile

检查此查询几何图形中是否包含图块。

# Parameters

  • tile 平铺要检查的平铺。
  • transform Transform当前地图变换。
  • use3D boolean 指示是否查询 3D 特征的布尔值。

返回**TilespaceQueryGeometry?**如果 tile 不相交,则返回 undefined

# bufferedscreenmercator

这些方法在由Transform#pointCoordinate3d. 图块具有不同的填充值,但是很可能多个图块根据样式共享相同的填充值。在这种情况下,我们希望重用先前计算的地形射线投射的结果。

# Parameters

  • padding number
  • transform 转换

返回**Array<墨卡托坐标>**

# createFromScreenPoints

帮助构建实例同时考虑当前地图状态的工厂方法。

# Parameters

  • geometry **( PointLike | ` [PointLike` , PointLike ])**查询几何。
  • transform Transform当前地图变换。

返回**QueryGeometry** QueryGeometry 类的实例。

# VectorTileSource

扩展事件

包含矢量瓦片格式矢量瓦片的源 ``. (见样式规范 有关选项的详细文档。)

# Parameters

  • id string
  • options 任何
  • dispatcher 调度员
  • eventedParent 事件发生

# Examples

map.addSource('some id', {
    type: 'vector',
    url: 'your url'
});
1
2
3
4
map.addSource('some id', {
    type: 'vector',
    tiles: ['https://xxx/{z}/{x}/{y}.mvt'],
    minzoom: 6,
    maxzoom: 14
});
1
2
3
4
5
6
map.getSource('some id').setUrl("your url");
1
map.getSource('some id').setTiles(['https://xxx/{z}/{x}/{y}.mvt']);
1

# setTiles

设置源tiles属性并重新渲染地图。

# Parameters

  • tiles **Array< string>**一个或多个图块源 URL 的数组,如 TileJSON 规范中所示。

返回**VectorTileSource**这个

# setUrl

设置源url属性并重新渲染地图。

# Parameters

  • url **string**TileJSON 资源的 URL。支持的协议是http:https:

返回**VectorTileSource**这个

# VideoSource

扩展图像源

包含视频的数据源。(见样式规范 有关选项的详细文档。)

# Parameters

  • id string
  • options 视频源规范
  • dispatcher 调度员
  • eventedParent 事件发生

# Examples

// add to map
map.addSource('some id', {
   type: 'video',
   url: [
       'http://xxx.mp4',
       'https://xxx.webm'
   ],
   coordinates: [
       [-76.54, 39.18],
       [-76.52, 39.18],
       [-76.52, 39.17],
       [-76.54, 39.17]
   ]
});

// update
var mySource = map.getSource('some id');
mySource.setCoordinates([
    [-76.54335737228394, 39.18579907229748],
    [-76.52803659439087, 39.1838364847587],
    [-76.5295386314392, 39.17683392507606],
    [-76.54520273208618, 39.17876344106642]
]);

map.removeSource('some id');  // remove
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

# pause

暂停视频。

# play

播放视频。

# getVideo

返回 HTMLvideo元素。

返回**HTMLVideoElement**HTMLvideo元素。

# setCoordinates

设置视频的坐标并重新渲染地图。

返回**VideoSource**这个

# ImageSource

扩展事件

包含图像的数据源。(见样式规范 有关选项的详细文档。)

# Parameters

  • id string
  • options (ImageSourceSpecification | VideoSourceSpecification | CanvasSourceSpecification)
  • dispatcher 调度员
  • eventedParent 事件发生

# Examples

// add to map
map.addSource('some id', {
   type: 'image',
   url: 'https://xxx.png',
   coordinates: [
       [-76.54, 39.18],
       [-76.52, 39.18],
       [-76.52, 39.17],
       [-76.54, 39.17]
   ]
});

// update coordinates
var mySource = map.getSource('some id');
mySource.setCoordinates([
    [-76.54335737228394, 39.18579907229748],
    [-76.52803659439087, 39.1838364847587],
    [-76.5295386314392, 39.17683392507606],
    [-76.54520273208618, 39.17876344106642]
]);

// update url and coordinates simultaneously
mySource.updateImage({
   url: 'https://xxx.png',
   coordinates: [
       [-76.54335737228394, 39.18579907229748],
       [-76.52803659439087, 39.1838364847587],
       [-76.5295386314392, 39.17683392507606],
       [-76.54520273208618, 39.17876344106642]
   ]
})

map.removeSource('some id');  // remove
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

# updateImage

更新图像 URL 和(可选)坐标。为避免更改后图像闪烁,请将raster-fade-duration光栅图层上的paint属性设置为0。

# Parameters

  • options Object 选项对象。
    • options.url string? 必需的图像 URL。
    • options.coordinates **Array< Array< number>>?**四个地理坐标,表示为经度和纬度数字数组,用于定义图像的角点。坐标从图像的左上角开始,并按顺时针顺序进行。它们不必表示一个矩形。

返回**ImageSource**这个

# setCoordinates

设置图像的坐标并重新渲染地图。

# Parameters

  • coordinates **Array< Array< number>>**四地理坐标,表示为经度和纬度的数字阵列,它定义了图像的角上。坐标从图像的左上角开始,并按顺时针顺序进行。它们不必表示一个矩形。

返回**ImageSource**这个

# CanvasSourceOptions

将画布源类型添加到地图的选项。

类型: Object

# Properties

  • type **string**来源类型。必须是"canvas"
  • canvas **( string| HTMLCanvasElement)**从中读取像素的画布源。可以是表示画布元素 ID 或HTMLCanvasElement本身的字符串。
  • coordinates **Array< Array< number>>**四个地理坐标表示在何处放置画布的角部,在指定的[longitude, latitude]对。
  • animate boolean? 画布源是否是动画的。如果画布是静态的(即不需要在每一帧上重新读取像素),animate则应设置为false以提高性能。

# CanvasSource

扩展图像源

包含 HTML 画布内容的数据源。有关选项的详细文档,请参阅CanvasSourceOptions

# Parameters

  • id string
  • options 画布来源规范
  • dispatcher 调度员
  • eventedParent 事件发生

# Examples

// add to map
map.addSource('some id', {
   type: 'canvas',
   canvas: 'idOfMyHTMLCanvas',
   animate: true,
   coordinates: [
       [-76.54, 39.18],
       [-76.52, 39.18],
       [-76.52, 39.17],
       [-76.54, 39.17]
   ]
});

// update
var mySource = map.getSource('some id');
mySource.setCoordinates([
    [-76.54335737228394, 39.18579907229748],
    [-76.52803659439087, 39.1838364847587],
    [-76.5295386314392, 39.17683392507606],
    [-76.54520273208618, 39.17876344106642]
]);

map.removeSource('some id');  // remove
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

# play

启用动画。图像将从画布复制到每一帧的地图。

# pause

禁用动画。地图将显示画布图像的静态副本。

# getCanvas

返回 HTMLcanvas元素。

返回**HTMLCanvasElement**HTMLcanvas元素。

# setCoordinates

设置画布的坐标并重新渲染地图。

# Parameters

  • coordinates **Array< Array< number>>**四地理坐标,表示为经度和纬度的数字阵列,它定义了画布的角上。坐标从画布的左上角开始并按顺时针顺序进行。它们不必表示一个矩形。

返回**CanvasSource**这个

# GeoJSONSource

扩展事件

包含 GeoJSON 的源。(见样式规范有关选项的详细文档。)

# Parameters

  • id string
  • options 任何
  • dispatcher 调度员
  • eventedParent 事件发生

# Examples

map.addSource('some id', {
    type: 'geojson',
    data: 'https://xxx.geojson'
});
1
2
3
4
map.addSource('some id', {
   type: 'geojson',
   data: {
       "type": "FeatureCollection",
       "features": [{
           "type": "Feature",
           "properties": {},
           "geometry": {
               "type": "Point",
               "coordinates": [
                   -76.53063297271729,
                   39.18174077994108
               ]
           }
       }]
   }
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
map.getSource('some id').setData({
  "type": "FeatureCollection",
  "features": [{
      "type": "Feature",
      "properties": { "name": "Null Island" },
      "geometry": {
          "type": "Point",
          "coordinates": [ 0, 0 ]
      }
  }]
});
1
2
3
4
5
6
7
8
9
10
11

# setData

设置 GeoJSON 数据并重新渲染地图。

# Parameters

  • data ( Object| string) GeoJSON 数据对象或指向一个的 URL。在大 GeoJSON 文件的情况下,后者更可取。

返回**GeoJSONSource**这个

# getClusterExpansionZoom

对于集群源,获取给定集群扩展的缩放比例。

# Parameters

  • clusterId **number**集群的cluster_id属性值。
  • callback **回调< number>**检索缩放值时要调用的回调 ( (error, zoom) => { ... })。

返回**GeoJSONSource**这个

# getClusterChildren

对于集群源,在下一个缩放级别(作为 GeoJSON 功能数组)获取给定集群的子项。

# Parameters

  • clusterId **number**集群的cluster_id属性值。
  • callback **Callback< Array<GeoJSONFeature>>**检索要素时要调用的回调 ( (error, features) => { ... })。

返回**GeoJSONSource**这个

# getClusterLeaves

对于集群源,获取属于集群的原始点(作为 GeoJSON 特征数组)。

# Parameters

  • clusterId **number**集群的cluster_id属性值。
  • limit **number**要返回的最大特征数。(10如果给出了假值,则默认为。)
  • offset **number**要跳过的功能数量(例如分页)。(0如果给出了假值,则默认为。)
  • callback **Callback< Array<GeoJSONFeature>>**检索要素时要调用的回调 ( (error, features) => { ... })。

# Examples

// Retrieve cluster leaves on click
map.on('click', 'clusters', function(e) {
  var features = map.queryRenderedFeatures(e.point, {
    layers: ['clusters']
  });

  var clusterId = features[0].properties.cluster_id;
  var pointCount = features[0].properties.point_count;
  var clusterSource = map.getSource('clusters');

  clusterSource.getClusterLeaves(clusterId, pointCount, 0, function(error, features) {
    // Print cluster leaves in the console
    console.log('Cluster leaves:', error, features);
  })
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

返回**GeoJSONSource**这个

# CustomLayerInterface

自定义样式层的界面。这是实现者建模的规范:它不是导出的方法或类。

自定义图层允许用户使用地图的相机直接渲染到地图的上下文中。可以使用Map#addLayer在任何常规图层之间添加这些图层。

自定义层必须具有唯一id和必须具备的type"custom"。他们必须实施render并且可以实施prerender,onAddonRemove。他们可以使用Map#triggerRepaint触发渲染, 并且他们应该适当地处理Map.event:webglcontextlostMap.event:webglcontextrestored

renderingMode属性控制是将图层视为地图图层"2d"还是"3d"地图图层。用:

  • "renderingMode": "3d" 使用深度缓冲区并与其他层共享
  • "renderingMode": "2d"添加一个没有深度的图层。如果您需要为"2d"图层使用深度缓冲区,则必须使用屏幕外帧缓冲区和CustomLayerInterface#prerender

# Properties

  • id string 唯一的图层 ID。
  • type **string**图层的类型。必须是"custom"
  • renderingMode **string**无论是"2d""3d"。默认为"2d".

# Examples

// Custom layer implemented as ES6 class
class NullIslandLayer {
    constructor() {
        this.id = 'null-island';
        this.type = 'custom';
        this.renderingMode = '2d';
    }

    onAdd(map, gl) {
        const vertexSource = `
        uniform mat4 u_matrix;
        void main() {
            gl_Position = u_matrix * vec4(0.5, 0.5, 0.0, 1.0);
            gl_PointSize = 20.0;
        }`;

        const fragmentSource = `
        void main() {
            gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
        }`;

        const vertexShader = gl.createShader(gl.VERTEX_SHADER);
        gl.shaderSource(vertexShader, vertexSource);
        gl.compileShader(vertexShader);
        const fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);
        gl.shaderSource(fragmentShader, fragmentSource);
        gl.compileShader(fragmentShader);

        this.program = gl.createProgram();
        gl.attachShader(this.program, vertexShader);
        gl.attachShader(this.program, fragmentShader);
        gl.linkProgram(this.program);
    }

    render(gl, matrix) {
        gl.useProgram(this.program);
        gl.uniformMatrix4fv(gl.getUniformLocation(this.program, "u_matrix"), false, matrix);
        gl.drawArrays(gl.POINTS, 0, 1);
    }
}

map.on('load', function() {
    map.addLayer(new NullIslandLayer());
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44

# onAdd

使用Map#addLayer将图层添加到地图时调用的可选方法。这使该层有机会初始化 gl 资源并注册事件侦听器。

# Parameters

  • map **地图**此自定义图层刚刚添加到的地图。
  • gl WebGL 渲染上下文 地图的 gl 上下文。

# onRemove

使用Map#removeLayer从地图中删除图层时调用的可选方法。这使该层有机会清理 gl 资源和事件侦听器。

# Parameters

  • map **地图**此自定义图层刚刚添加到的地图。
  • gl WebGL 渲染上下文 地图的 gl 上下文。

# prerender

在渲染帧期间调用的可选方法,以允许图层准备资源或渲染到纹理中。

该层不能对当前状态做出任何假设,并且必须在渲染之前绑定一个帧缓冲区。

# Parameters

  • gl WebGL 渲染上下文 地图的 gl 上下文。
  • matrix **Array< number>**地图的相机矩阵。它将球形墨卡托坐标投影到 gl 坐标。墨卡托坐标``0, 0]代表墨卡托世界的左上角,[1, 1]代表右下角。当renderingMode是 时"3d",z 坐标是共形的。具有相同 x、y 和 z 长度(以墨卡托为单位)的盒子将被渲染为立方体。[MercatorCoordinate .fromLngLat 可用于将 a 投影LngLat到墨卡托坐标。

# render

在渲染帧期间调用,允许图层绘制到 GL 上下文中。

图层可以假设混合和深度状态设置为允许图层正确混合和剪辑其他图层。该层不能对当前 GL 状态做出任何其他假设。

如果图层需要渲染到纹理,它应该实现prerender这样做的方法,并且只使用render直接绘制到主帧缓冲区的方法。

混合函数设置为gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA)。这期望以预乘 alpha 形式提供颜色,其中r,gb值已经乘以该a值。如果您无法以预乘形式提供颜色,您可能需要将混合函数更改为 gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA).

# Parameters

  • gl WebGL 渲染上下文 地图的 gl 上下文。
  • matrix **Array< number>**地图的相机矩阵。它将球形墨卡托坐标投影到 gl 坐标。球面墨卡托坐标``0, 0]代表墨卡托世界的左上角,[1, 1]代表右下角。当renderingMode是 时"3d",z 坐标是共形的。具有相同 x、y 和 z 长度(以墨卡托为单位)的盒子将被渲染为立方体。[MercatorCoordinate .fromLngLat 可用于将 a 投影LngLat到墨卡托坐标。

# LngLat

LngLat对象表示一个给定的经度和纬度坐标,以度为单位。这些坐标基于WGS84 (EPSG:4326) 标准.

使用经度、纬度坐标顺序(相对于纬度、经度)来匹配 GeoJSON 规范.

请注意,任何接受LngLat对象作为参数或选项的方法也可以接受Array两个数字中的一个,并将执行隐式转换。这种灵活的类型记录为LngLatLike

# Parameters

  • lng number 经度,以度为单位。
  • lat number 纬度,以度为单位。

# Examples

var ll = new vjmap.LngLat(-123.9749, 40.7736);
ll.lng; // = -123.9749
1
2

# wrap

返回一个新LngLat对象,其经度被包裹到范围 (-180, 180)。

# Examples

var ll = new vjmap.LngLat(286.0251, 40.7736);
var wrapped = ll.wrap();
wrapped.lng; // = -73.9749
1
2
3

返回**LngLat**包装的LngLat对象。

# toArray

返回表示为两个数字数组的坐标。

# Examples

var ll = new vjmap.LngLat(-73.9749, 40.7736);
ll.toArray(); // = [-73.9749, 40.7736]
1
2

返回**Array< number>**坐标表示为经度和纬度数组。

# toString

返回表示为字符串的坐标。

# Examples

var ll = new vjmap.LngLat(-73.9749, 40.7736);
ll.toString(); // = "LngLat(-73.9749, 40.7736)"
1
2

返回**string**值表示为格式字符串的坐标'LngLat(lng, lat)'

# distanceTo

返回一对坐标之间的近似距离(以米为单位) 使用Haversine 公式(来自 RW Sinnott,“Haversine 的优点”,Sky and Telescope,第 68 卷,第 2 期,1984 年,第 159 页)

# Parameters

  • lngLat 计算距离的**LngLat**坐标

# Examples

var new_york = new vjmap.LngLat(-74.0060, 40.7128);
var los_angeles = new vjmap.LngLat(-118.2437, 34.0522);
new_york.distanceTo(los_angeles); // = 3935751.690893987, "true distance" using a non-spherical approximation is ~3966km
1
2
3

返回**number**两个坐标之间的距离(以米为单位)。

# toBounds

LngLatBounds从给定 扩展的坐标返回 a radius。返回的LngLatBounds完全包含radius.

# Parameters

  • radius **number**从坐标到扩展边界的距离(以米为单位)。(可选,默认0

# Examples

var ll = new vjmap.LngLat(-73.9749, 40.7736);
ll.toBounds(100).toArray(); // = [[-73.97501862141328, 40.77351016847229], [-73.97478137858673, 40.77368983152771]]
1
2

返回**LngLatBounds**一个新LngLatBounds对象,表示由 扩展的坐标radius

# convert

将包含两个数字的数组或具有lngandlatlonandlat属性的LngLat对象转换为对象。

如果LngLat传入一个对象,该函数将原样返回它。

# Parameters

  • input **LngLatLike**要转换的两个数字或对象的数组,或LngLat要返回的对象。

# Examples

var arr = [-73.9749, 40.7736];
var ll = vjmap.LngLat.convert(arr);
ll;   // = LngLat {lng: -73.9749, lat: 40.7736}
1
2
3

返回**LngLat**一个新LngLat对象(如果发生转换)或原始LngLat对象。

# LngLatLike

一个LngLat对象,一个表示经度和纬度的两个数字的数组,或者一个具有lngandlatlonandlat属性的对象。

类型: ( LngLat | {lng: number, lat: number} | {lon: number, lat: number} | [ number, number])

# Examples

var v1 = new vjmap.LngLat(-122.420679, 37.772537);
var v2 = [-122.420679, 37.772537];
var v3 = {lon: -122.420679, lat: 37.772537};
1
2
3

# LngLatBounds

一个LngLatBounds对象代表一个地理边界框,由其西南和东北经纬度点定义。

如果没有为构造函数提供参数,null则会创建一个边界框。

请注意,任何接受LngLatBounds对象作为参数或选项的方法也可以接受Array两个LngLatLike构造中的一个,并将执行隐式转换。这种灵活的类型记录为LngLatBoundsLike

# Parameters

# Examples

var sw = new vjmap.LngLat(-73.9876, 40.7661);
var ne = new vjmap.LngLat(-73.9397, 40.8002);
var llb = new vjmap.LngLatBounds(sw, ne);
1
2
3

# setNorthEast

设置边界框的东北角

# Parameters

返回**LngLatBounds** this

# setSouthWest

设置边界框的西南角

# Parameters

返回**LngLatBounds** this

# extend

扩展边界以包括给定的 LngLatLike 或 LngLatBoundsLike。

# Parameters

返回**LngLatBounds** this

# getCenter

返回与边界框角等距的地理坐标。

# Examples

var llb = new vjmap.LngLatBounds([-73.9876, 40.7661], [-73.9397, 40.8002]);
llb.getCenter(); // = LngLat {lng: -73.96365, lat: 40.78315}
1
2

返回**LngLat**边界框的中心。

# getSouthWest

返回边界框的西南角。

返回**LngLat**边界框的西南角。

# getNorthEast

返回边界框的东北角。

返回**LngLat**边界框的东北角。

# getNorthWest

返回边界框的西北角。

返回**LngLat**边界框的西北角。

# getSouthEast

返回边界框的东南角。

返回**LngLat**边界框的东南角。

# getWest

返回边界框的西边。

返回**number**边界框的西边。

# getSouth

返回边界框的南边。

返回**number**边界框的南边缘。

# getEast

返回边界框的东边。

返回**number**边界框的东边。

# getNorth

返回边界框的北边缘。

返回**number**边界框的北边缘。

# toArray

返回表示为数组的边界框。

# Examples

var llb = new vjmap.LngLatBounds([-73.9876, 40.7661], [-73.9397, 40.8002]);
llb.toArray(); // = [[-73.9876, 40.7661], [-73.9397, 40.8002]]
1
2

返回**Array< Array< number>>**表示为数组的边界框,由表示为数字数组的边界的西南和东北坐标组成。

# toString

返回表示为字符串的边界框。

# Examples

var llb = new vjmap.LngLatBounds([-73.9876, 40.7661], [-73.9397, 40.8002]);
llb.toString(); // = "LngLatBounds(LngLat(-73.9876, 40.7661), LngLat(-73.9397, 40.8002))"
1
2

返回**string**边界框表示为格式字符串 'LngLatBounds(LngLat(lng, lat), LngLat(lng, lat))'

# isEmpty

检查边界框是否为空/ null- 类型框。

**boolean**如果边界已定义,则返回True,否则返回false。

# contains

检查点是否在边界框内。

# Parameters

# Examples

var llb = new vjmap.LngLatBounds(
  new vjmap.LngLat(-73.9876, 40.7661),
  new vjmap.LngLat(-73.9397, 40.8002)
);

var ll = new vjmap.LngLat(-73.9567, 40.7789);

console.log(llb.contains(ll)); // = true
1
2
3
4
5
6
7
8

**boolean**如果点在边界框内,则返回True。

# convert

将数组转换为LngLatBounds对象。

如果LngLatBounds传入一个对象,该函数将原样返回它。

在内部,该函数调用LngLat#convert将数组转换为LngLat值。

# Parameters

  • input **LngLatBoundsLike**要转换的两个坐标数组,或LngLatBounds要返回的对象。

# Examples

var arr = [[-73.9876, 40.7661], [-73.9397, 40.8002]];
var llb = vjmap.LngLatBounds.convert(arr);
llb;   // = LngLatBounds {_sw: LngLat {lng: -73.9876, lat: 40.7661}, _ne: LngLat {lng: -73.9397, lat: 40.8002}}
1
2
3

返回**LngLatBounds**一个新LngLatBounds对象(如果发生转换)或原始LngLatBounds对象。

# LngLatBoundsLike

LngLatBounds对象,的阵列LngLatLike在[SW,NE]顺序,或数字的在[西,南,东,北]为了对象的数组。

类型:( LngLatBounds | ` [LngLatLike, [LngLatLike][284] \] | \[number,number,number,number`])

# Examples

var v1 = new vjmap.LngLatBounds(
  new vjmap.LngLat(-73.9876, 40.7661),
  new vjmap.LngLat(-73.9397, 40.8002)
);
var v2 = new vjmap.LngLatBounds([-73.9876, 40.7661], [-73.9397, 40.8002])
var v3 = [[-73.9876, 40.7661], [-73.9397, 40.8002]];
1
2
3
4
5
6

# MercatorCoordinate

MercatorCoordinate对象表示投影三维位置。

MercatorCoordinate使用 web 墨卡托投影 ( EPSG:3857) 单位略有不同:

  • 1个单位的大小是投影世界的宽度而不是“墨卡托米”
  • 坐标空间的原点在西北角而不是中间

例如,MercatorCoordinate(0, 0, 0)是墨卡托世界的西北角, MercatorCoordinate(1, 1, 0)是东南角。如果您熟悉 矢量切片将坐标空间视为0/0/0范围为 的瓦片可能会有所帮助1

z尺寸MercatorCoordinate是共形的。墨卡托坐标空间中的立方体将被渲染为立方体。

# Parameters

  • x number 位置的 x 分量。
  • y number 位置的 y 分量。
  • z **number**位置的 z 分量。(可选,默认0

# Examples

var nullIsland = new vjmap.MercatorCoordinate(0.5, 0.5, 0);
1

# toLngLat

返回LngLat坐标的 。

# Examples

var coord = new vjmap.MercatorCoordinate(0.5, 0.5, 0);
var lngLat = coord.toLngLat(); // LngLat(0, 0)
1
2

返回**LngLat**的LngLat对象。

# toAltitude

返回以米为单位的坐标高度。

# Examples

var coord = new vjmap.MercatorCoordinate(0, 0, 0.02);
coord.toAltitude(); // 6914.281956295339
1
2

返回**number**以米为单位的海拔高度。

# meterInMercatorCoordinateUnits

返回MercatorCoordinate以该纬度为单位的 1 米的距离。

对于使用米的真实世界单位坐标,这自然提供了转换为MercatorCoordinates的比例。

**number**以MercatorCoordinate单位返回1 米的距离。

# fromLngLat

LngLat将 a投影到 a MercatorCoordinate

# Parameters

  • lngLatLike **LngLatLike**要投影的位置。
  • altitude **number**位置的高度(以米为单位)。(可选,默认0

# Examples

var coord = vjmap.MercatorCoordinate.fromLngLat({ lng: 0, lat: 0}, 0);
coord; // MercatorCoordinate(0.5, 0.5, 0)
1
2

返回**MercatorCoordinate**投影的墨卡托坐标。

# Evented

Evented 将方法混合到其他类中以获得事件功能。

除非您正在开发插件,否则您很可能会通过Map或 之类的类使用这些方法Popup

有关您可以侦听的事件列表,请参阅特定类的 API 文档: Map` `,Marker, Popup` `, 和GeolocationControl.

# on

将侦听器添加到指定的事件类型。

# Parameters

  • type string 要添加侦听的事件类型。
  • listener Function触发事件时要调用的函数。使用传递给 的数据对象调用侦听器函数firetarget并使用和type属性进行扩展。

返回 Object this

# off

删除以前注册的事件侦听器。

# Parameters

  • type string 要为其删除侦听器的事件类型。
  • listener 功能监听器函数删除。

返回 Object this

# once

将仅被调用一次的侦听器添加到指定的事件类型。

注册监听器后,第一次触发事件时将调用监听器。

# Parameters

  • type string 要侦听的事件类型。
  • listener 函数(可选)当事件被触发一次时要调用的函数。如果未提供,则返回将在事件触发一次时解决的 Promise。

返回| 承诺**Object** this

# getAABBPointSquareDist

返回由 min 和 max 定义的 AABB 与一个点之间的 2D 距离的平方。如果 point 为空或未定义,则返回距原点 (0,0) 的 AABB 距离。

# Parameters

  • min ****AABB 的最小范围。
  • max ****AABB 的最大范围。
  • point **?**计算距离的点可能未定义。

返回**number**距 AABB 的平方距离,如果 AABB 包含该点,则为 0.0。

# polygonizeBounds

将 AABB 转换为具有顺时针缠绕顺序的多边形。

# Parameters

  • min ****左上点。
  • max ****右下点。
  • buffer **number**缓冲区宽度。(可选,默认0
  • close **boolean**是否关闭多边形。(可选,默认true

返回**Array<>**多边形。

# bufferConvexPolygon

取一个凸环并通过在其周围应用缓冲区将其向外扩展。此函数假定环按顺时针缠绕顺序。

# Parameters

  • ring **Array<>**输入环。
  • buffer number 缓冲区宽度。

返回**Array< Point >**扩展环。

# FreeCameraOptions

用于访问底层相机实体的物理属性的选项。直接访问这些属性可以更灵活和精确地控制相机,同时还与 CameraOptions 完全兼容和可互换。所有字段都是可选的。参见Map#setFreeCameraOptionsMap#getFreeCameraOptions

# Parameters

  • position **MercatorCoordinate**稍微修改过的 web 墨卡托坐标中的相机位置 - 1 个单位的大小是投影世界的宽度,而不是“墨卡托米”。坐标 [0, 0, 0] 是西北角,[1, 1, 0] 是东南角。
    • Z 坐标是共形的,必须遵守最小和最大缩放值。
    • 缩放是根据高度 (z) 自动计算的
  • orientation quat相机的方向表示为左手坐标空间中的单位四元数 [x, y, z, w]。旋转方向是绕各自的轴顺时针旋转。相机的默认姿势是这样的,即前向矢量在 -Z 轴上查找,向上矢量与地图的北方向对齐: forward: [0, 0, -1] up: [0, -1, 0] right [1, 0, 0] 方向可以自由设置,但某些限制仍然适用 - 方向必须只能用俯仰和轴承表示。
    • 间距有上限

# lookAtPoint

通过在地图上定义焦点来设置相机方向的辅助功能。

# Parameters

  • location **LngLatLike**焦点在地图上的位置
  • up **vec3?**在某些无法从观察方向推导出方位的情况下,相机的向上矢量是必要的。

# setPitchBearing

用于将相机的方向设置为俯仰和方位角的辅助函数。

# Parameters

  • pitch number 俯仰角(度)
  • bearing number 以度为单位的轴承角

# FreeCamera

在使用免费相机 API 时,isZooming、isMoving 和 isRotating 的结果值不是免费相机 API 的结果。如果用户将 map.interactive 设置为 true,则在使用鼠标或/和键盘通过缩放或移动与地图交互时会出现冲突行为,这将导致 isZooming、isMoving 和 isRotating 在使用免费相机 API 时返回 true。为了防止冲突行为,请将 map.interactive 设置为 false,这将导致以下事件静音:zoom、zoomend、zoomstart、rotate、rotateend、rotatestart、move、moveend、movestart、pitch、pitchend、pitchstart。

# Parameters

  • position vec3?
  • orientation quat

# prewarm

在某些情况下初始化可以跨地图共享的资源,例如 WebWorkers,以减少加载时间。vjmap.workerUrl并且vjmap.workerCount,如果使用,必须在prewarm()调用前才能生效。

默认情况下,这些资源的生命周期是自动管理的,并且在首次创建地图时延迟初始化。通过调用prewarm(),这些资源会提前创建,当最后一个地图从页面中移除时不会被清除。这允许它们被稍后创建的新地图实例重重使用。可以通过调用手动清除它们vjmap.clearPrewarmedResources()。仅当您的网页保持活动状态但完全停止使用地图时才需要破坏。

# Examples

vjmap.prewarm()
1

# clearPrewarmedResources

清除之前创建的资源vjmap.prewarm()。请注意,这通常不是必需的。如果您希望您的应用程序的用户在您的应用程序中的任何时候都不会返回到地图视图,您应该只调用此函数。

# Examples

vjmap.clearPrewarmedResources()
1

# workerCount

获取和设置在具有地图的页面上实例化的 Web Worker 的数量。默认情况下,它为 2。确保在创建任何地图实例之前设置此属性以使其生效。

类型: string

# Examples

vjmap.workerCount = 4;
1

返回**number**当前配置的workerCount

# maxParallelImageRequests

获取和设置要并行加载的图像(光栅图块、像素、图标)的最大数量,这会影响地图重地图的性能。默认为16。

类型: string

# Examples

vjmap.maxParallelImageRequests = 10;
1

返回**number**当前配置的并行请求数。

# clearStorage

清除此库的浏览器。

此 API 在API 的浏览器上受支持``Cache(新窗口显示)支持并启用。这包括通过提供页面时的所有主要浏览器https://,但 Internet Explorer 和 Edge Mobile 除外。

在不受支持的浏览器或环境(智能或隐身模式)中,将使用错误参数调用中时。

# Parameters

  • callback 功能如果出现错误,则使用错误参数调用。

# Examples

vjmap.clearStorage();
1

# workerClass

为Webpack或Rollup等外部模块打包器提供接口,将WebWorker打包成一个单独的类,并与库集成。

优先于vjmap.workerUrl

类型: Object

返回**( Object| null)**一个类对象,它的一个实例公开了Worker接口。

# time

设置在内部为所有动画使用的时间。用于生成视频。

类型: number

# version

当前版本。

类型: string

# supported

测试浏览器是否支持webgl.

# Parameters

  • options Object?
    • options.failIfMajorPerformanceCaveat **boolean**如果true,如果truefalse如果性能比预期的差很多(例如,将使用软件 WebGL 渲染器),该函数将返回。(任选,默认false

# Examples

// Show an alert if the browser does not support webgl
if (!vjmap.supported()) {
  alert('Your browser does not support `webgl`');
}
1
2
3
4

返回 boolean

vjmap / Exports

# vjmap

# Classes

vjmap / Exports / AnimateMarkerLayer

# Class: AnimateMarkerLayer

动画标记图层.

# Hierarchy

  • Evented

    AnimateMarkerLayer

# Table of contents

# Constructors

# Methods

# Constructors

# constructor

+ new AnimateMarkerLayer(features: FeatureCollection<Geometry | GeometryCollection, Properties>, options?: AnimateMarkerLayerOption): AnimateMarkerLayer

# Parameters
Name Type
features FeatureCollection<Geometry | GeometryCollection, Properties>
options? AnimateMarkerLayerOption

Returns: AnimateMarkerLayer

Overrides: Evented.constructor

# Methods

# _getMarkerElement

_getMarkerElement(): void

Returns: void


# addTo

addTo(map: Map): void

# Parameters
Name Type
map Map

Returns: void


# clearMarkerLayer

clearMarkerLayer(): void

Returns: void


# getMarkers

getMarkers(): Marker[]

Returns: Marker[]


# remove

remove(): void

Returns: void


# render

render(): void

Returns: void


# setType

setType(type: AnimateMarkerType, options?: AnimateMarkerLayerOption): void

# Parameters
Name Type
type AnimateMarkerType
options? AnimateMarkerLayerOption

Returns: void

vjmap / Exports / BackgroundLayer

# Class: BackgroundLayer

创建一个背景图层.

# Hierarchy

# Table of contents

# Constructors

# Properties

# Methods

# Constructors

# constructor

+ new BackgroundLayer(options: BackgroundLayerOptions): BackgroundLayer

# Parameters
Name Type
options BackgroundLayerOptions

Returns: BackgroundLayer

Overrides: OverlayLayerBase

# Properties

# _map

Optional _map: Map

Inherited from: OverlayLayerBase._map


# layerId

Optional layerId: string

Inherited from: OverlayLayerBase.layerId


# options

options: BackgroundLayerOptions


# sourceId

Optional sourceId: string

Inherited from: OverlayLayerBase.sourceId

# Methods

# addTo

addTo(map: Map, beforeId?: string): void

# Parameters
Name Type
map Map
beforeId? string

Returns: void

Overrides: OverlayLayerBase


# clickLayer

clickLayer(cb: any): any

每当单击这些图层中的要素时都会触发回调。

# Parameters
Name Type Description
cb any Callback that receives event with .features property

Returns: any

A function that removes the handler.

Inherited from: OverlayLayerBase


# clickPopup

clickPopup(htmlFunc: (arg0: {}) => void, popupOptions?: PopupOptions): any

每当单击这些图层中的要素时都会显示一个弹出窗口。

example clickPopup(f => <h3>${f.properties.Name}</h3> ${f.properties.Description}, { maxWidth: 500 });

# Parameters
Name Type Description
htmlFunc (arg0: {}) => void Function that receives feature and popup, returns HTML.
popupOptions? PopupOptions Options passed to Popup() to customise popup.

Returns: any

A function that removes the handler.

Inherited from: OverlayLayerBase


# getBackgroundColor

getBackgroundColor(): PropertyValueSpecificationEx<string>

Returns: PropertyValueSpecificationEx<string>


# getBackgroundOpacity

getBackgroundOpacity(): PropertyValueSpecificationEx<number>

Returns: PropertyValueSpecificationEx<number>


# getBackgroundPattern

getBackgroundPattern(): PropertyValueSpecificationEx<string>

Returns: PropertyValueSpecificationEx<string>


# getData

getData(): undefined | Feature<Geometry | GeometryCollection, Properties> | FeatureCollection<Geometry | GeometryCollection, Properties> | Geometry | GeometryCollection

获取数据源的数据

Returns: undefined | Feature<Geometry | GeometryCollection, Properties> | FeatureCollection<Geometry | GeometryCollection, Properties> | Geometry | GeometryCollection

Inherited from: OverlayLayerBase


# getLayerId

getLayerId(): undefined | string

获取图层ID

Returns: undefined | string

Inherited from: OverlayLayerBase


# getLayerStyle

getLayerStyle(): LayerSpecification

根据样式规范,获取给定图层 ID 的图层定义。

Returns: LayerSpecification

Inherited from: OverlayLayerBase


# getSourceId

getSourceId(): undefined | string

获取数据源ID

Returns: undefined | string

Inherited from: OverlayLayerBase


# hide

hide(): void

使给定的图层不可见。

Returns: void

Inherited from: OverlayLayerBase


# hoverFeatureState

hoverFeatureState(enterCb?: (arg0: {}) => void, leaveCb?: (arg0: {}) => void): void

每当将鼠标悬停在这些图层中的某个特征上时,更新连接源 [s] 中特征的特征状态。

# Parameters
Name Type
enterCb? (arg0: {}) => void
leaveCb? (arg0: {}) => void

Returns: void

Inherited from: OverlayLayerBase


# hoverLayer

hoverLayer(cb: any): any

当鼠标悬停在这些图层中的要素上时触发回调。

# Parameters
Name Type
cb any

Returns: any

A function to remove the handler.

Inherited from: OverlayLayerBase


# hoverPointer

hoverPointer(): void

每当鼠标悬停在这些图层上时,将地图的光标设置为“指针”。

Returns: void

A function to remove the handler.

Inherited from: OverlayLayerBase


# hoverPopup

hoverPopup(htmlFunc: any, popupOptions?: PopupOptions): any

将鼠标悬停在这些图层中的某个要素上时,会显示一个弹出窗口。

example hoverPopup(f => <h3>${f.properties.Name}</h3> ${f.properties.Description}, { anchor: 'left' });

# Parameters
Name Type Description
htmlFunc any Function that receives feature and popup, returns HTML.
popupOptions? PopupOptions Options passed to Popup() to customise popup.

Returns: any

Inherited from: OverlayLayerBase


# remove

remove(): void

Returns: void

Inherited from: OverlayLayerBase


# setBackgroundColor

setBackgroundColor(value: PropertyValueSpecificationEx<string>): BackgroundLayer

# Parameters
Name Type
value PropertyValueSpecificationEx<string>

Returns: BackgroundLayer


# setBackgroundOpacity

setBackgroundOpacity(value: PropertyValueSpecificationEx<number>): BackgroundLayer

# Parameters
Name Type
value PropertyValueSpecificationEx<number>

Returns: BackgroundLayer


# setBackgroundPattern

setBackgroundPattern(value: PropertyValueSpecificationEx<string>): BackgroundLayer

# Parameters
Name Type
value PropertyValueSpecificationEx<string>

Returns: BackgroundLayer


# setFilter

setFilter(filter: FilterSpecification): void

替换一个图层的过滤器。

example setFilter(['==','level','0']]);

# Parameters
Name Type Description
filter FilterSpecification New filter to set.

Returns: void

Inherited from: OverlayLayerBase


# setLayerStyle

setLayerStyle(style: any): void

设置图层样式

# Parameters
Name Type
style any

Returns: void

Inherited from: OverlayLayerBase


# setProperty

setProperty(prop: string | object, value?: any): void

在一个或多个图层上设置绘制或布局属性。

example setProperty('fillOpacity', 0.5)

# Parameters
Name Type
prop string | object
value? any

Returns: void

Inherited from: OverlayLayerBase


# show

show(): void

使给定的图层可见。

Returns: void

Inherited from: OverlayLayerBase


# toggle

toggle(state: boolean): boolean

根据参数使给定的图层隐藏或可见。

# Parameters
Name Type Description
state boolean True for visible, false for hidden.

Returns: boolean

Inherited from: OverlayLayerBase

vjmap / Exports / BreathingApertureMarker

# Class: BreathingApertureMarker

呼吸的光圈.

# Hierarchy

  • MarkerBase

    BreathingApertureMarker

# Table of contents

# Constructors

# Properties

# Methods

# Constructors

# constructor

+ new BreathingApertureMarker(features: FeatureCollection<Geometry | GeometryCollection, Properties> | { lngLat: LngLatLike ; text?: string }, options?: AnimateMarkerLayerOption): BreathingApertureMarker

# Parameters
Name Type
features FeatureCollection<Geometry | GeometryCollection, Properties> | { lngLat: LngLatLike ; text?: string }
options? AnimateMarkerLayerOption

Returns: BreathingApertureMarker

Overrides: MarkerBase.constructor

# Properties

# features

Protected features: FeatureCollection<Geometry | GeometryCollection, Properties> | { lngLat: LngLatLike ; text?: string }

Inherited from: MarkerBase.features


# markersElement

Protected markersElement: any

Inherited from: MarkerBase.markersElement


# options

Protected options: AnimateMarkerLayerOption

Inherited from: MarkerBase.options

# Methods

# _createMarker

_createMarker(): void

Returns: void


# _getColorWithOpacity

Protected _getColorWithOpacity(color: string, opacity: string | number): string

# Parameters
Name Type
color string
opacity string | number

Returns: string

Inherited from: MarkerBase._getColorWithOpacity


# _getTextContainer

Protected _getTextContainer(feature: any, className: string): null | HTMLDivElement

# Parameters
Name Type
feature any
className string

Returns: null | HTMLDivElement

Inherited from: MarkerBase._getTextContainer


# createMarker

createMarker(options?: createMarkerOptions, index?: number): Marker

# Parameters
Name Type
options? createMarkerOptions
index? number

Returns: Marker

Inherited from: MarkerBase.createMarker


# getColorWithOpacity

getColorWithOpacity(color: string, opacity: string | number): string

# Parameters
Name Type
color string
opacity string | number

Returns: string

Inherited from: MarkerBase.getColorWithOpacity


# getElement

getElement(index?: number): any

# Parameters
Name Type
index? number

Returns: any

Inherited from: MarkerBase.getElement


# getLngLat

getLngLat(index?: number): any

# Parameters
Name Type
index? number

Returns: any

Inherited from: MarkerBase.getLngLat


# getMarkersElement

getMarkersElement(): any

Returns: any

Inherited from: MarkerBase.getMarkersElement


# set16ToRgb

set16ToRgb(str: string): string

# Parameters
Name Type
str string

Returns: string

Inherited from: MarkerBase.set16ToRgb


# setDotSize

setDotSize(size: number, index?: number): void

# Parameters
Name Type
size number
index? number

Returns: void


# setFeatures

setFeatures(features: FeatureCollection<Geometry | GeometryCollection, Properties>): void

# Parameters
Name Type
features FeatureCollection<Geometry | GeometryCollection, Properties>

Returns: void

Inherited from: MarkerBase.setFeatures


# setMarkersColors

setMarkersColors(colors: string[], index?: number): void

# Parameters
Name Type
colors string[]
index? number

Returns: void


# setMarkersText

setMarkersText(text: string, index?: number): void

# Parameters
Name Type
text string
index? number

Returns: void

Inherited from: MarkerBase.setMarkersText


# setMarkersTextColor

setMarkersTextColor(textColor: string, index?: number): void

# Parameters
Name Type
textColor string
index? number

Returns: void

Inherited from: MarkerBase.setMarkersTextColor


# setMarkersTextField

setMarkersTextField(textField: string): void

# Parameters
Name Type
textField string

Returns: void

Inherited from: MarkerBase.setMarkersTextField


# setMarkersTextFontSize

setMarkersTextFontSize(textFontSize: number, index?: number): void

# Parameters
Name Type
textFontSize number
index? number

Returns: void

Inherited from: MarkerBase.setMarkersTextFontSize


# setMarkersWidth

setMarkersWidth(width: number, index?: number): void

# Parameters
Name Type
width number
index? number

Returns: void

vjmap / Exports / ButtonGroupControl

# Class: ButtonGroupControl

# Table of contents

# Constructors

# Methods

# Constructors

# constructor

+ new ButtonGroupControl(options?: Record<string, any>): ButtonGroupControl

# Parameters
Name Type Default value
options Record<string, any> {}

Returns: ButtonGroupControl

# Methods

# onAdd

onAdd(map: Map): HTMLElement

# Parameters
Name Type
map Map

Returns: HTMLElement


# onRemove

onRemove(): void

Returns: void

vjmap / Exports / Circle

# Class: Circle

创建圆符号图层.

# Hierarchy

# Table of contents

# Constructors

# Properties

# Methods

# Constructors

# constructor

+ new Circle(options: CircleOptions): Circle

# Parameters
Name Type
options CircleOptions

Returns: Circle

Overrides: OverlayLayerBase

# Properties

# _map

Optional _map: Map

Inherited from: OverlayLayerBase._map


# layerId

Optional layerId: string

Inherited from: OverlayLayerBase.layerId


# options

options: CircleOptions


# sourceId

Optional sourceId: string

Inherited from: OverlayLayerBase.sourceId

# Methods

# addTo

addTo(map: Map, beforeId?: string): void

# Parameters
Name Type
map Map
beforeId? string

Returns: void

Overrides: OverlayLayerBase


# clickLayer

clickLayer(cb: any): any

每当单击这些图层中的要素时都会触发回调。

# Parameters
Name Type Description
cb any Callback that receives event with .features property

Returns: any

A function that removes the handler.

Inherited from: OverlayLayerBase


# clickPopup

clickPopup(htmlFunc: (arg0: {}) => void, popupOptions?: PopupOptions): any

每当单击这些图层中的要素时都会显示一个弹出窗口。

example clickPopup(f => <h3>${f.properties.Name}</h3> ${f.properties.Description}, { maxWidth: 500 });

# Parameters
Name Type Description
htmlFunc (arg0: {}) => void Function that receives feature and popup, returns HTML.
popupOptions? PopupOptions Options passed to Popup() to customise popup.

Returns: any

A function that removes the handler.

Inherited from: OverlayLayerBase


# getCircleBlur

getCircleBlur(): DataDrivenPropertyValueSpecification<number>

Returns: DataDrivenPropertyValueSpecification<number>


# getCircleColor

getCircleColor(): DataDrivenPropertyValueSpecification<string>

Returns: DataDrivenPropertyValueSpecification<string>


# getCircleOpacity

getCircleOpacity(): DataDrivenPropertyValueSpecification<number>

Returns: DataDrivenPropertyValueSpecification<number>


# getCirclePitchAlignment

getCirclePitchAlignment(): PropertyValueSpecificationEx<"map" | "viewport">

Returns: PropertyValueSpecificationEx<"map" | "viewport">


# getCirclePitchScale

getCirclePitchScale(): PropertyValueSpecificationEx<"map" | "viewport">

Returns: PropertyValueSpecificationEx<"map" | "viewport">


# getCircleRadius

getCircleRadius(): DataDrivenPropertyValueSpecification<number>

Returns: DataDrivenPropertyValueSpecification<number>


# getCircleSortKey

getCircleSortKey(): DataDrivenPropertyValueSpecification<number>

Returns: DataDrivenPropertyValueSpecification<number>


# getCircleStrokeColor

getCircleStrokeColor(): DataDrivenPropertyValueSpecification<string>

Returns: DataDrivenPropertyValueSpecification<string>


# getCircleStrokeOpacity

getCircleStrokeOpacity(): DataDrivenPropertyValueSpecification<number>

Returns: DataDrivenPropertyValueSpecification<number>


# getCircleStrokeWidth

getCircleStrokeWidth(): DataDrivenPropertyValueSpecification<number>

Returns: DataDrivenPropertyValueSpecification<number>


# getCircleTranslate

getCircleTranslate(): PropertyValueSpecificationEx<[number, number]>

Returns: PropertyValueSpecificationEx<[number, number]>


# getCircleTranslateAnchor

getCircleTranslateAnchor(): PropertyValueSpecificationEx<"map" | "viewport">

Returns: PropertyValueSpecificationEx<"map" | "viewport">


# getData

getData(): undefined | Feature<Geometry | GeometryCollection, Properties> | FeatureCollection<Geometry | GeometryCollection, Properties> | Geometry | GeometryCollection

获取数据源的数据

Returns: undefined | Feature<Geometry | GeometryCollection, Properties> | FeatureCollection<Geometry | GeometryCollection, Properties> | Geometry | GeometryCollection

Inherited from: OverlayLayerBase


# getLayerId

getLayerId(): undefined | string

获取图层ID

Returns: undefined | string

Inherited from: OverlayLayerBase


# getLayerStyle

getLayerStyle(): LayerSpecification

根据样式规范,获取给定图层 ID 的图层定义。

Returns: LayerSpecification

Inherited from: OverlayLayerBase


# getSourceId

getSourceId(): undefined | string

获取数据源ID

Returns: undefined | string

Inherited from: OverlayLayerBase


# getVisibility

getVisibility(): "visible" | "none"

Returns: "visible" | "none"


# hide

hide(): void

使给定的图层不可见。

Returns: void

Inherited from: OverlayLayerBase


# hoverFeatureState

hoverFeatureState(enterCb?: (arg0: {}) => void, leaveCb?: (arg0: {}) => void): void

每当将鼠标悬停在这些图层中的某个特征上时,更新连接源 [s] 中特征的特征状态。

# Parameters
Name Type
enterCb? (arg0: {}) => void
leaveCb? (arg0: {}) => void

Returns: void

Inherited from: OverlayLayerBase


# hoverLayer

hoverLayer(cb: any): any

当鼠标悬停在这些图层中的要素上时触发回调。

# Parameters
Name Type
cb any

Returns: any

A function to remove the handler.

Inherited from: OverlayLayerBase


# hoverPointer

hoverPointer(): void

每当鼠标悬停在这些图层上时,将地图的光标设置为“指针”。

Returns: void

A function to remove the handler.

Inherited from: OverlayLayerBase


# hoverPopup

hoverPopup(htmlFunc: any, popupOptions?: PopupOptions): any

将鼠标悬停在这些图层中的某个要素上时,会显示一个弹出窗口。

example hoverPopup(f => <h3>${f.properties.Name}</h3> ${f.properties.Description}, { anchor: 'left' });

# Parameters
Name Type Description
htmlFunc any Function that receives feature and popup, returns HTML.
popupOptions? PopupOptions Options passed to Popup() to customise popup.

Returns: any

Inherited from: OverlayLayerBase


# remove

remove(): void

Returns: void

Inherited from: OverlayLayerBase


# setCircleBlur

setCircleBlur(value: DataDrivenPropertyValueSpecification<number>): Circle

# Parameters
Name Type
value DataDrivenPropertyValueSpecification<number>

Returns: Circle


# setCircleColor

setCircleColor(value: DataDrivenPropertyValueSpecification<string>): Circle

# Parameters
Name Type
value DataDrivenPropertyValueSpecification<string>

Returns: Circle


# setCircleOpacity

setCircleOpacity(value: DataDrivenPropertyValueSpecification<number>): Circle

# Parameters
Name Type
value DataDrivenPropertyValueSpecification<number>

Returns: Circle


# setCirclePitchAlignment

setCirclePitchAlignment(value: PropertyValueSpecificationEx<"map" | "viewport">): Circle

# Parameters
Name Type
value PropertyValueSpecificationEx<"map" | "viewport">

Returns: Circle


# setCirclePitchScale

setCirclePitchScale(value: PropertyValueSpecificationEx<"map" | "viewport">): Circle

# Parameters
Name Type
value PropertyValueSpecificationEx<"map" | "viewport">

Returns: Circle


# setCircleRadius

setCircleRadius(value: DataDrivenPropertyValueSpecification<number>): Circle

# Parameters
Name Type
value DataDrivenPropertyValueSpecification<number>

Returns: Circle


# setCircleSortKey

setCircleSortKey(value: DataDrivenPropertyValueSpecification<number>): Circle

# Parameters
Name Type
value DataDrivenPropertyValueSpecification<number>

Returns: Circle


# setCircleStrokeColor

setCircleStrokeColor(value: DataDrivenPropertyValueSpecification<string>): Circle

# Parameters
Name Type
value DataDrivenPropertyValueSpecification<string>

Returns: Circle


# setCircleStrokeOpacity

setCircleStrokeOpacity(value: DataDrivenPropertyValueSpecification<number>): Circle

# Parameters
Name Type
value DataDrivenPropertyValueSpecification<number>

Returns: Circle


# setCircleStrokeWidth

setCircleStrokeWidth(value: DataDrivenPropertyValueSpecification<number>): Circle

# Parameters
Name Type
value DataDrivenPropertyValueSpecification<number>

Returns: Circle


# setCircleTranslate

setCircleTranslate(value: PropertyValueSpecificationEx<[number, number]>): Circle

# Parameters
Name Type
value PropertyValueSpecificationEx<[number, number]>

Returns: Circle


# setCircleTranslateAnchor

setCircleTranslateAnchor(value: PropertyValueSpecificationEx<"map" | "viewport">): Circle

# Parameters
Name Type
value PropertyValueSpecificationEx<"map" | "viewport">

Returns: Circle


# setData

setData(data: any): void

替换 GeoJSON 图层的当前数据。

# Parameters
Name Type
data any

Returns: void


# setFilter

setFilter(filter: FilterSpecification): void

替换一个图层的过滤器。

example setFilter(['==','level','0']]);

# Parameters
Name Type Description
filter FilterSpecification New filter to set.

Returns: void

Inherited from: OverlayLayerBase


# setLayerStyle

setLayerStyle(style: any): void

设置图层样式

# Parameters
Name Type
style any

Returns: void

Inherited from: OverlayLayerBase


# setProperty

setProperty(prop: string | object, value?: any): void

在一个或多个图层上设置绘制或布局属性。

example setProperty('fillOpacity', 0.5)

# Parameters
Name Type
prop string | object
value? any

Returns: void

Inherited from: OverlayLayerBase


# setVisibility

setVisibility(value: "visible" | "none"): Circle

# Parameters
Name Type
value "visible" | "none"

Returns: Circle


# show

show(): void

使给定的图层可见。

Returns: void

Inherited from: OverlayLayerBase


# toggle

toggle(state: boolean): boolean

根据参数使给定的图层隐藏或可见。

# Parameters
Name Type Description
state boolean True for visible, false for hidden.

Returns: boolean

Inherited from: OverlayLayerBase

vjmap / Exports / CircleEdge

# Class: CircleEdge

创建只有边框的圆或圆弧

# Hierarchy

# Table of contents

# Constructors

# Properties

# Methods

# Constructors

# constructor

+ new CircleEdge(options: CircleEdgeOptions): CircleEdge

# Parameters
Name Type
options CircleEdgeOptions

Returns: CircleEdge

Overrides: Polyline

# Properties

# _map

Optional _map: Map

Inherited from: Polyline._map


# layerId

Optional layerId: string

Inherited from: Polyline.layerId


# options

options: PolylineOptions

Inherited from: Polyline.options


# sourceId

Optional sourceId: string

Inherited from: Polyline.sourceId

# Methods

# addTo

addTo(map: Map, beforeId?: string): void

# Parameters
Name Type
map Map
beforeId? string

Returns: void

Overrides: Polyline


# clickLayer

clickLayer(cb: any): any

每当单击这些图层中的要素时都会触发回调。

# Parameters
Name Type Description
cb any Callback that receives event with .features property

Returns: any

A function that removes the handler.

Inherited from: Polyline


# clickPopup

clickPopup(htmlFunc: (arg0: {}) => void, popupOptions?: PopupOptions): any

每当单击这些图层中的要素时都会显示一个弹出窗口。

example clickPopup(f => <h3>${f.properties.Name}</h3> ${f.properties.Description}, { maxWidth: 500 });

# Parameters
Name Type Description
htmlFunc (arg0: {}) => void Function that receives feature and popup, returns HTML.
popupOptions? PopupOptions Options passed to Popup() to customise popup.

Returns: any

A function that removes the handler.

Inherited from: Polyline


# getCenter

getCenter(): GeoPointLike

得到中心点。

Returns: GeoPointLike


# getData

getData(): undefined | Feature<Geometry | GeometryCollection, Properties> | FeatureCollection<Geometry | GeometryCollection, Properties> | Geometry | GeometryCollection

获取数据源的数据

Returns: undefined | Feature<Geometry | GeometryCollection, Properties> | FeatureCollection<Geometry | GeometryCollection, Properties> | Geometry | GeometryCollection

Inherited from: Polyline


# getEndAngle

getEndAngle(): number

得到结束角度。

Returns: number


# getLayerId

getLayerId(): undefined | string

获取图层ID

Returns: undefined | string

Inherited from: Polyline


# getLayerStyle

getLayerStyle(): LayerSpecification

根据样式规范,获取给定图层 ID 的图层定义。

Returns: LayerSpecification

Inherited from: Polyline


# getLineBlur

getLineBlur(): DataDrivenPropertyValueSpecification<number>

Returns: DataDrivenPropertyValueSpecification<number>

Inherited from: Polyline


# getLineCap

getLineCap(): DataDrivenPropertyValueSpecification<"butt" | "round" | "square">

Returns: DataDrivenPropertyValueSpecification<"butt" | "round" | "square">

Inherited from: Polyline


# getLineColor

getLineColor(): DataDrivenPropertyValueSpecification<string>

Returns: DataDrivenPropertyValueSpecification<string>

Inherited from: Polyline


# getLineDasharray

getLineDasharray(): DataDrivenPropertyValueSpecification<number[]>

Returns: DataDrivenPropertyValueSpecification<number[]>

Inherited from: Polyline


# getLineGapWidth

getLineGapWidth(): DataDrivenPropertyValueSpecification<number>

Returns: DataDrivenPropertyValueSpecification<number>

Inherited from: Polyline


# getLineGradient

getLineGradient(): ExpressionSpecificationEx

Returns: ExpressionSpecificationEx

Inherited from: Polyline


# getLineJoin

getLineJoin(): DataDrivenPropertyValueSpecification<"round" | "bevel" | "miter">

Returns: DataDrivenPropertyValueSpecification<"round" | "bevel" | "miter">

Inherited from: Polyline


# getLineMiterMimit

getLineMiterMimit(): PropertyValueSpecificationEx<number>

Returns: PropertyValueSpecificationEx<number>

Inherited from: Polyline


# getLineOffset

getLineOffset(): DataDrivenPropertyValueSpecification<number>

Returns: DataDrivenPropertyValueSpecification<number>

Inherited from: Polyline


# getLineOpacity

getLineOpacity(): DataDrivenPropertyValueSpecification<number>

Returns: DataDrivenPropertyValueSpecification<number>

Inherited from: Polyline


# getLinePattern

getLinePattern(): DataDrivenPropertyValueSpecification<string>

Returns: DataDrivenPropertyValueSpecification<string>

Inherited from: Polyline


# getLineRoundLimit

getLineRoundLimit(): PropertyValueSpecificationEx<number>

Returns: PropertyValueSpecificationEx<number>

Inherited from: Polyline


# getLineSortKey

getLineSortKey(): DataDrivenPropertyValueSpecification<number>

Returns: DataDrivenPropertyValueSpecification<number>

Inherited from: Polyline


# getLineTranslate

getLineTranslate(): PropertyValueSpecificationEx<[number, number]>

Returns: PropertyValueSpecificationEx<[number, number]>

Inherited from: Polyline


# getLineTranslateAnchor

getLineTranslateAnchor(): PropertyValueSpecificationEx<"map" | "viewport">

Returns: PropertyValueSpecificationEx<"map" | "viewport">

Inherited from: Polyline


# getLineWidth

getLineWidth(): DataDrivenPropertyValueSpecification<number>

Returns: DataDrivenPropertyValueSpecification<number>

Inherited from: Polyline


# getPoints

getPoints(): number

得到离散化的点的个数。

Returns: number


# getRadius

getRadius(): number

得到半径。

Returns: number


# getSourceId

getSourceId(): undefined | string

获取数据源ID

Returns: undefined | string

Inherited from: Polyline


# getStartAngle

getStartAngle(): number

得到开始角度。

Returns: number


# hide

hide(): void

使给定的图层不可见。

Returns: void

Inherited from: Polyline


# hoverFeatureState

hoverFeatureState(enterCb?: (arg0: {}) => void, leaveCb?: (arg0: {}) => void): void

每当将鼠标悬停在这些图层中的某个特征上时,更新连接源 [s] 中特征的特征状态。

# Parameters
Name Type
enterCb? (arg0: {}) => void
leaveCb? (arg0: {}) => void

Returns: void

Inherited from: Polyline


# hoverLayer

hoverLayer(cb: any): any

当鼠标悬停在这些图层中的要素上时触发回调。

# Parameters
Name Type
cb any

Returns: any

A function to remove the handler.

Inherited from: Polyline


# hoverPointer

hoverPointer(): void

每当鼠标悬停在这些图层上时,将地图的光标设置为“指针”。

Returns: void

A function to remove the handler.

Inherited from: Polyline


# hoverPopup

hoverPopup(htmlFunc: any, popupOptions?: PopupOptions): any

将鼠标悬停在这些图层中的某个要素上时,会显示一个弹出窗口。

example hoverPopup(f => <h3>${f.properties.Name}</h3> ${f.properties.Description}, { anchor: 'left' });

# Parameters
Name Type Description
htmlFunc any Function that receives feature and popup, returns HTML.
popupOptions? PopupOptions Options passed to Popup() to customise popup.

Returns: any

Inherited from: Polyline


# remove

remove(): void

Returns: void

Inherited from: Polyline


# setCenter

setCenter(value: GeoPointLike, bFocusUpdateData?: boolean): CircleEdge

设置中心点。

# Parameters
Name Type Default value
value GeoPointLike -
bFocusUpdateData boolean true

Returns: CircleEdge


# setData

setData(data: any): void

替换 GeoJSON 图层的当前数据。

# Parameters
Name Type
data any

Returns: void

Inherited from: Polyline


# setEndAngle

setEndAngle(value: number, bFocusUpdateData?: boolean): CircleEdge

设置结束角度。

# Parameters
Name Type Default value
value number -
bFocusUpdateData boolean true

Returns: CircleEdge


# setFilter

setFilter(filter: FilterSpecification): void

替换一个图层的过滤器。

example setFilter(['==','level','0']]);

# Parameters
Name Type Description
filter FilterSpecification New filter to set.

Returns: void

Inherited from: Polyline


# setLayerStyle

setLayerStyle(style: any): void

设置图层样式

# Parameters
Name Type
style any

Returns: void

Inherited from: Polyline


# setLineBlur

setLineBlur(value: DataDrivenPropertyValueSpecification<number>): CircleEdge

# Parameters
Name Type
value DataDrivenPropertyValueSpecification<number>

Returns: CircleEdge

Inherited from: Polyline


# setLineCap

setLineCap(value: DataDrivenPropertyValueSpecification<"butt" | "round" | "square">): CircleEdge

# Parameters
Name Type
value DataDrivenPropertyValueSpecification<"butt" | "round" | "square">

Returns: CircleEdge

Inherited from: Polyline


# setLineColor

setLineColor(value: DataDrivenPropertyValueSpecification<string>): CircleEdge

# Parameters
Name Type
value DataDrivenPropertyValueSpecification<string>

Returns: CircleEdge

Inherited from: Polyline


# setLineDasharray

setLineDasharray(value: DataDrivenPropertyValueSpecification<number[]>): CircleEdge

# Parameters
Name Type
value DataDrivenPropertyValueSpecification<number[]>

Returns: CircleEdge

Inherited from: Polyline


# setLineGapWidth

setLineGapWidth(value: DataDrivenPropertyValueSpecification<number>): CircleEdge

# Parameters
Name Type
value DataDrivenPropertyValueSpecification<number>

Returns: CircleEdge

Inherited from: Polyline


# setLineGradient

setLineGradient(value: ExpressionSpecificationEx): CircleEdge

# Parameters
Name Type
value ExpressionSpecificationEx

Returns: CircleEdge

Inherited from: Polyline


# setLineJoin

setLineJoin(value: DataDrivenPropertyValueSpecification<"round" | "bevel" | "miter">): CircleEdge

# Parameters
Name Type
value DataDrivenPropertyValueSpecification<"round" | "bevel" | "miter">

Returns: CircleEdge

Inherited from: Polyline


# setLineMiterMimit

setLineMiterMimit(value: PropertyValueSpecificationEx<number>): CircleEdge

# Parameters
Name Type
value PropertyValueSpecificationEx<number>

Returns: CircleEdge

Inherited from: Polyline


# setLineOffset

setLineOffset(value: DataDrivenPropertyValueSpecification<number>): CircleEdge

# Parameters
Name Type
value DataDrivenPropertyValueSpecification<number>

Returns: CircleEdge

Inherited from: Polyline


# setLineOpacity

setLineOpacity(value: DataDrivenPropertyValueSpecification<number>): CircleEdge

# Parameters
Name Type
value DataDrivenPropertyValueSpecification<number>

Returns: CircleEdge

Inherited from: Polyline


# setLinePattern

setLinePattern(value: DataDrivenPropertyValueSpecification<string>): CircleEdge

# Parameters
Name Type
value DataDrivenPropertyValueSpecification<string>

Returns: CircleEdge

Inherited from: Polyline


# setLineRoundLimit

setLineRoundLimit(value: PropertyValueSpecificationEx<number>): CircleEdge

# Parameters
Name Type
value PropertyValueSpecificationEx<number>

Returns: CircleEdge

Inherited from: Polyline


# setLineSortKey

setLineSortKey(value: DataDrivenPropertyValueSpecification<number>): CircleEdge

# Parameters
Name Type
value DataDrivenPropertyValueSpecification<number>

Returns: CircleEdge

Inherited from: Polyline


# setLineTranslate

setLineTranslate(value: PropertyValueSpecificationEx<[number, number]>): CircleEdge

# Parameters
Name Type
value PropertyValueSpecificationEx<[number, number]>

Returns: CircleEdge

Inherited from: Polyline


# setLineTranslateAnchor

setLineTranslateAnchor(value: PropertyValueSpecificationEx<"map" | "viewport">): CircleEdge

# Parameters
Name Type
value PropertyValueSpecificationEx<"map" | "viewport">

Returns: CircleEdge

Inherited from: Polyline


# setLineWidth

setLineWidth(value: DataDrivenPropertyValueSpecification<number>): CircleEdge

# Parameters
Name Type
value DataDrivenPropertyValueSpecification<number>

Returns: CircleEdge

Inherited from: Polyline


# setPoints

setPoints(value: number, bFocusUpdateData?: boolean): CircleEdge

设置离散化的点的个数。

# Parameters
Name Type Default value
value number -
bFocusUpdateData boolean true

Returns: CircleEdge


# setProperty

setProperty(prop: string | object, value?: any): void

在一个或多个图层上设置绘制或布局属性。

example setProperty('fillOpacity', 0.5)

# Parameters
Name Type
prop string | object
value? any

Returns: void

Inherited from: Polyline


# setRadius

setRadius(value: number, bFocusUpdateData?: boolean): CircleEdge

设置半径。

# Parameters
Name Type Default value
value number -
bFocusUpdateData boolean true

Returns: CircleEdge


# setStartAngle

setStartAngle(value: number, bFocusUpdateData?: boolean): CircleEdge

设置开始角度。

# Parameters
Name Type Default value
value number -
bFocusUpdateData boolean true

Returns: CircleEdge


# show

show(): void

使给定的图层可见。

Returns: void

Inherited from: Polyline


# toggle

toggle(state: boolean): boolean

根据参数使给定的图层隐藏或可见。

# Parameters
Name Type Description
state boolean True for visible, false for hidden.

Returns: boolean

Inherited from: Polyline


# updateData

updateData(): void

Returns: void

vjmap / Exports / CircleFill

# Class: CircleFill

创建填充的圆或圆弧

# Hierarchy

# Table of contents

# Constructors

# Properties

# Methods

# Constructors

# constructor

+ new CircleFill(options: CircleFillOptions): CircleFill

# Parameters
Name Type
options CircleFillOptions

Returns: CircleFill

Overrides: Polygon

# Properties

# _map

Optional _map: Map

Inherited from: Polygon._map


# layerId

Optional layerId: string

Inherited from: Polygon.layerId


# options

options: PolygonOptions

Inherited from: Polygon.options


# sourceId

Optional sourceId: string

Inherited from: Polygon.sourceId

# Methods

# addTo

addTo(map: Map, beforeId?: string): void

# Parameters
Name Type
map Map
beforeId? string

Returns: void

Overrides: Polygon


# clickLayer

clickLayer(cb: any): any

每当单击这些图层中的要素时都会触发回调。

# Parameters
Name Type Description
cb any Callback that receives event with .features property

Returns: any

A function that removes the handler.

Inherited from: Polygon


# clickPopup

clickPopup(htmlFunc: (arg0: {}) => void, popupOptions?: PopupOptions): any

每当单击这些图层中的要素时都会显示一个弹出窗口。

example clickPopup(f => <h3>${f.properties.Name}</h3> ${f.properties.Description}, { maxWidth: 500 });

# Parameters
Name Type Description
htmlFunc (arg0: {}) => void Function that receives feature and popup, returns HTML.
popupOptions? PopupOptions Options passed to Popup() to customise popup.

Returns: any

A function that removes the handler.

Inherited from: Polygon


# getCenter

getCenter(): GeoPointLike

得到中心点。

Returns: GeoPointLike


# getData

getData(): undefined | Feature<Geometry | GeometryCollection, Properties> | FeatureCollection<Geometry | GeometryCollection, Properties> | Geometry | GeometryCollection

获取数据源的数据

Returns: undefined | Feature<Geometry | GeometryCollection, Properties> | FeatureCollection<Geometry | GeometryCollection, Properties> | Geometry | GeometryCollection

Inherited from: Polygon


# getEndAngle

getEndAngle(): number

得到结束角度。

Returns: number


# getFillAntialias

getFillAntialias(): PropertyValueSpecificationEx<boolean>

获取图层的“填充抗锯齿”绘制属性。

Returns: PropertyValueSpecificationEx<boolean>

Inherited from: Polygon


# getFillColor

getFillColor(): DataDrivenPropertyValueSpecification<string>

获取图层的 fill-color 绘制属性。

Returns: DataDrivenPropertyValueSpecification<string>

Inherited from: Polygon


# getFillOpacity

getFillOpacity(): DataDrivenPropertyValueSpecification<number>

获取图层的 fill-opacity 绘制属性。

Returns: DataDrivenPropertyValueSpecification<number>

Inherited from: Polygon


# getFillOutlineColor

getFillOutlineColor(): DataDrivenPropertyValueSpecification<string>

获取图层的 fill-outline-color 绘制属性。

Returns: DataDrivenPropertyValueSpecification<string>

Inherited from: Polygon


# getFillPattern

getFillPattern(): DataDrivenPropertyValueSpecification<string>

获取图层的fill-pattern 绘制属性。

Returns: DataDrivenPropertyValueSpecification<string>

Inherited from: Polygon


# getFillSortKey

getFillSortKey(): DataDrivenPropertyValueSpecification<number>

获取图层的fill-sort-key 布局属性.

Returns: DataDrivenPropertyValueSpecification<number>

Inherited from: Polygon


# getFillTranslate

getFillTranslate(): PropertyValueSpecificationEx<[number, number]>

获取图层的 fill-translate 绘制属性。

Returns: PropertyValueSpecificationEx<[number, number]>

Inherited from: Polygon


# getFillTranslateAnchor

getFillTranslateAnchor(): PropertyValueSpecificationEx<"map" | "viewport">

获取图层的 fill-translate-anchor 绘制属性。

Returns: PropertyValueSpecificationEx<"map" | "viewport">

Inherited from: Polygon


# getLayerId

getLayerId(): undefined | string

获取图层ID

Returns: undefined | string

Inherited from: Polygon


# getLayerStyle

getLayerStyle(): LayerSpecification

根据样式规范,获取给定图层 ID 的图层定义。

Returns: LayerSpecification

Inherited from: Polygon


# getPoints

getPoints(): number

得到离散化的点的个数。

Returns: number


# getRadius

getRadius(): number

得到半径。

Returns: number


# getSourceId

getSourceId(): undefined | string

获取数据源ID

Returns: undefined | string

Inherited from: Polygon


# getStartAngle

getStartAngle(): number

得到开始角度。

Returns: number


# hide

hide(): void

使给定的图层不可见。

Returns: void

Inherited from: Polygon


# hoverFeatureState

hoverFeatureState(enterCb?: (arg0: {}) => void, leaveCb?: (arg0: {}) => void): void

每当将鼠标悬停在这些图层中的某个特征上时,更新连接源 [s] 中特征的特征状态。

# Parameters
Name Type
enterCb? (arg0: {}) => void
leaveCb? (arg0: {}) => void

Returns: void

Inherited from: Polygon


# hoverLayer

hoverLayer(cb: any): any

当鼠标悬停在这些图层中的要素上时触发回调。

# Parameters
Name Type
cb any

Returns: any

A function to remove the handler.

Inherited from: Polygon


# hoverPointer

hoverPointer(): void

每当鼠标悬停在这些图层上时,将地图的光标设置为“指针”。

Returns: void

A function to remove the handler.

Inherited from: Polygon


# hoverPopup

hoverPopup(htmlFunc: any, popupOptions?: PopupOptions): any

将鼠标悬停在这些图层中的某个要素上时,会显示一个弹出窗口。

example hoverPopup(f => <h3>${f.properties.Name}</h3> ${f.properties.Description}, { anchor: 'left' });

# Parameters
Name Type Description
htmlFunc any Function that receives feature and popup, returns HTML.
popupOptions? PopupOptions Options passed to Popup() to customise popup.

Returns: any

Inherited from: Polygon


# remove

remove(): void

Returns: void

Inherited from: Polygon


# setCenter

setCenter(value: GeoPointLike, bFocusUpdateData?: boolean): CircleFill

设置中心点。

# Parameters
Name Type Default value
value GeoPointLike -
bFocusUpdateData boolean true

Returns: CircleFill


# setData

setData(data: any): void

替换 GeoJSON 图层的当前数据。

# Parameters
Name Type
data any

Returns: void

Inherited from: Polygon


# setEndAngle

setEndAngle(value: number, bFocusUpdateData?: boolean): CircleFill

设置结束角度。

# Parameters
Name Type Default value
value number -
bFocusUpdateData boolean true

Returns: CircleFill


# setFillAntialias

setFillAntialias(value: PropertyValueSpecificationEx<boolean>): CircleFill

为一个或多个图层设置fill-antialias 绘制属性。

# Parameters
Name Type
value PropertyValueSpecificationEx<boolean>

Returns: CircleFill

Inherited from: Polygon


# setFillColor

setFillColor(value: DataDrivenPropertyValueSpecification<string>): CircleFill

为一个或多个图层设置fill-color 绘画属性。

# Parameters
Name Type
value DataDrivenPropertyValueSpecification<string>

Returns: CircleFill

Inherited from: Polygon


# setFillOpacity

setFillOpacity(value: DataDrivenPropertyValueSpecification<number>): CircleFill

为一个或多个图层设置fill-opacity 绘画属性。

# Parameters
Name Type
value DataDrivenPropertyValueSpecification<number>

Returns: CircleFill

Inherited from: Polygon


# setFillOutlineColor

setFillOutlineColor(value: DataDrivenPropertyValueSpecification<string>): CircleFill

为一个或多个图层设置fill-outline-color 绘画属性。

# Parameters
Name Type
value DataDrivenPropertyValueSpecification<string>

Returns: CircleFill

Inherited from: Polygon


# setFillPattern

setFillPattern(value: DataDrivenPropertyValueSpecification<string>): CircleFill

为一个或多个图层设置fill-pattern 绘制属性。

# Parameters
Name Type
value DataDrivenPropertyValueSpecification<string>

Returns: CircleFill

Inherited from: Polygon


# setFillSortKey

setFillSortKey(value: DataDrivenPropertyValueSpecification<number>): CircleFill

为一层或多层设置fill-sort-key布局属性。

# Parameters
Name Type
value DataDrivenPropertyValueSpecification<number>

Returns: CircleFill

Inherited from: Polygon


# setFillTranslate

setFillTranslate(value: DataDrivenPropertyValueSpecification<string>): CircleFill

为一个或多个图层设置fill-translate 绘制属性。

# Parameters
Name Type
value DataDrivenPropertyValueSpecification<string>

Returns: CircleFill

Inherited from: Polygon


# setFillTranslateAnchor

setFillTranslateAnchor(value: PropertyValueSpecificationEx<"map" | "viewport">): CircleFill

为一个或多个图层设置fill-translate-anchor 绘制属性。

# Parameters
Name Type
value PropertyValueSpecificationEx<"map" | "viewport">

Returns: CircleFill

Inherited from: Polygon


# setFilter

setFilter(filter: FilterSpecification): void

替换一个图层的过滤器。

example setFilter(['==','level','0']]);

# Parameters
Name Type Description
filter FilterSpecification New filter to set.

Returns: void

Inherited from: Polygon


# setLayerStyle

setLayerStyle(style: any): void

设置图层样式

# Parameters
Name Type
style any

Returns: void

Inherited from: Polygon


# setPoints

setPoints(value: number, bFocusUpdateData?: boolean): CircleFill

设置离散化的点的个数。

# Parameters
Name Type Default value
value number -
bFocusUpdateData boolean true

Returns: CircleFill


# setProperty

setProperty(prop: string | object, value?: any): void

在一个或多个图层上设置绘制或布局属性。

example setProperty('fillOpacity', 0.5)

# Parameters
Name Type
prop string | object
value? any

Returns: void

Inherited from: Polygon


# setRadius

setRadius(value: number, bFocusUpdateData?: boolean): CircleFill

设置半径。

# Parameters
Name Type Default value
value number -
bFocusUpdateData boolean true

Returns: CircleFill


# setStartAngle

setStartAngle(value: number, bFocusUpdateData?: boolean): CircleFill

设置开始角度。

# Parameters
Name Type Default value
value number -
bFocusUpdateData boolean true

Returns: CircleFill


# show

show(): void

使给定的图层可见。

Returns: void

Inherited from: Polygon


# toggle

toggle(state: boolean): boolean

根据参数使给定的图层隐藏或可见。

# Parameters
Name Type Description
state boolean True for visible, false for hidden.

Returns: boolean

Inherited from: Polygon


# updateData

updateData(): void

Returns: void

vjmap / Exports / CloseEvent

# Class: CloseEvent

# Hierarchy

# Table of contents

# Constructors

# Properties

# Constructors

# constructor

+ new CloseEvent(code?: number, reason?: string, target: any): CloseEvent

# Parameters
Name Type Default value
code number 1000
reason string ""
target any -

Returns: CloseEvent

Overrides: WebSocketEvent

# Properties

# code

code: number


# reason

reason: string


# target

target: any

Inherited from: WebSocketEvent.target


# type

type: string

Inherited from: WebSocketEvent.type


# wasClean

wasClean: boolean= true

vjmap / Exports / Compare

# Class: Compare

# Hierarchy

  • Evented

    Compare

# Table of contents

# Constructors

# Methods

# Constructors

# constructor

+ new Compare(a: Map, b: Map, container: string | Element, options?: { mousemove: boolean ; orientation: "vertical" | "horizontal" }): Compare

# Parameters
Name Type
a Map
b Map
container string | Element
options? object
options.mousemove boolean
options.orientation "vertical" | "horizontal"

Returns: Compare

Overrides: Evented.constructor

# Methods

# remove

remove(): void

Returns: void


# setSlider

setSlider(x: number): void

# Parameters
Name Type
x number

Returns: void

vjmap / Exports / ContextMenu

# Class: ContextMenu

上下文菜单.

# Table of contents

# Constructors

# Methods

# Constructors

# constructor

+ new ContextMenu(opts: ContextMenuOptions): ContextMenu

Creates a new ContextMenu menu

# Parameters
Name Type Description
opts ContextMenuOptions options which build the menu e.g. position and items

Returns: ContextMenu

# Methods

# add

add(item: any): void

Adds item to this ContextMenu menu instance

# Parameters
Name Type Description
item any item to add to the ContextMenu menu

Returns: void


# hide

hide(): void

Hides this ContextMenu menu

Returns: void


# show

show(): void

Makes this ContextMenu menu visible

Returns: void


# toggle

toggle(): void

Toggle visibility of menu

Returns: void

vjmap / Exports / Db2dPolyline

# Class: Db2dPolyline

Db2dPolyline 二维多段线实体.

# Hierarchy

# Table of contents

# Constructors

# Properties

# Constructors

# constructor

+ new Db2dPolyline(prop?: IDb2dPolyline): Db2dPolyline

构造函数

# Parameters
Name Type Default value
prop IDb2dPolyline {}

Returns: Db2dPolyline

Overrides: DbCurve

# Properties

# alpha

Optional alpha: number

透明度. [0-255][0完全透明,255完全不透明]

Inherited from: DbCurve.alpha


# cloneFromDb

Optional cloneFromDb: string

克隆的实体ID来源的图形,如为空,则取DbDocument中from的图形。也可以指定另外的图形

Inherited from: DbCurve.cloneFromDb


# cloneObjectId

Optional cloneObjectId: string

克隆的实体ID,DbDocument有from图形来源字段时有效.

Inherited from: DbCurve.cloneObjectId


# closed

Optional closed: boolean

是否闭合.


# color

Optional color: number

颜色.

Inherited from: DbCurve.color


# colorIndex

Optional colorIndex: number

颜色索引.

Inherited from: DbCurve.colorIndex


# elevation

Optional elevation: number

高程.


# layer

Optional layer: string

图层.

Inherited from: DbCurve.layer


# lineWidth

Optional lineWidth: number

线宽.

Inherited from: DbCurve.lineWidth


# linetype

Optional linetype: string

线型.

Inherited from: DbCurve.linetype


# linetypeScale

Optional linetypeScale: number

线型比例.

Inherited from: DbCurve.linetypeScale


# matrix

Optional matrix: IDbMatrixOp[]

矩阵.

Inherited from: DbCurve.matrix


# points

Optional points: [number, number, undefined | number][]

坐标.


# polyType

Optional polyType: k2dSimplePoly | k2dFitCurvePoly | k2dQuadSplinePoly | k2dCubicSplinePoly

2d折线类型


# typename

Optional typename: string

类型.

Inherited from: DbCurve.typename


# visibility

Optional visibility: boolean

可见.

Inherited from: DbCurve.visibility


# xdata

Optional xdata: string

扩展数据.

Inherited from: DbCurve.xdata

vjmap / Exports / Db2LineAngularDimension

# Class: Db2LineAngularDimension

Db2LineAngularDimension 角度标注[两条线]实体.

# Hierarchy

# Table of contents

# Constructors

# Properties

# Constructors

# constructor

+ new Db2LineAngularDimension(prop?: IDb2LineAngularDimension): Db2LineAngularDimension

构造函数

# Parameters
Name Type Default value
prop IDb2LineAngularDimension {}

Returns: Db2LineAngularDimension

Overrides: DbDimension

# Properties

# alpha

Optional alpha: number

透明度. [0-255][0完全透明,255完全不透明]

Inherited from: DbDimension.alpha


# arcPoint

Optional arcPoint: [number, number, undefined | number][]

圆弧点位置.


# arrowColor

Optional arrowColor: number

箭头颜色.

Inherited from: DbDimension.arrowColor


# arrowSize

Optional arrowSize: number

箭头大小.

Inherited from: DbDimension.arrowSize


# cloneFromDb

Optional cloneFromDb: string

克隆的实体ID来源的图形,如为空,则取DbDocument中from的图形。也可以指定另外的图形

Inherited from: DbDimension.cloneFromDb


# cloneObjectId

Optional cloneObjectId: string

克隆的实体ID,DbDocument有from图形来源字段时有效.

Inherited from: DbDimension.cloneObjectId


# color

Optional color: number

颜色.

Inherited from: DbDimension.color


# colorIndex

Optional colorIndex: number

颜色索引.

Inherited from: DbDimension.colorIndex


# dimDec

Optional dimDec: number

设置标注主单位显示的小数位位数.

Inherited from: DbDimension.dimDec


# dimRnd

Optional dimRnd: number

所有标注距离舍入到指定值.

Inherited from: DbDimension.dimRnd


# dimScale

Optional dimScale: number

注记比例.

Inherited from: DbDimension.dimScale


# dimStyle

Optional dimStyle: string

标注样式.

Inherited from: DbDimension.dimStyle


# layer

Optional layer: string

图层.

Inherited from: DbDimension.layer


# lineColor

Optional lineColor: number

引线颜色.

Inherited from: DbDimension.lineColor


# lineWidth

Optional lineWidth: number

线宽.

Inherited from: DbDimension.lineWidth


# linetype

Optional linetype: string

线型.

Inherited from: DbDimension.linetype


# linetypeScale

Optional linetypeScale: number

线型比例.

Inherited from: DbDimension.linetypeScale


# matrix

Optional matrix: IDbMatrixOp[]

矩阵.

Inherited from: DbDimension.matrix


# textColor

Optional textColor: number

文本颜色.

Inherited from: DbDimension.textColor


# textHeight

Optional textHeight: number

文字高度.

Inherited from: DbDimension.textHeight


# textPosition

Optional textPosition: [number, number, undefined | number][]

文字位置.

Inherited from: DbDimension.textPosition


# textRotation

Optional textRotation: number

文字旋转角度.

Inherited from: DbDimension.textRotation


# typename

Optional typename: string

类型.

Inherited from: DbDimension.typename


# visibility

Optional visibility: boolean

可见.

Inherited from: DbDimension.visibility


# xLine1End

Optional xLine1End: [number, number, undefined | number][]

线1终点.


# xLine1Start

Optional xLine1Start: [number, number, undefined | number][]

线1起点.


# xLine2End

Optional xLine2End: [number, number, undefined | number][]

线2终点.


# xLine2Start

Optional xLine2Start: [number, number, undefined | number][]

线2起点.


# xdata

Optional xdata: string

扩展数据.

Inherited from: DbDimension.xdata

vjmap / Exports / Db3dPolyline

# Class: Db3dPolyline

Db3dPolyline 三维多段线实体.

# Hierarchy

# Table of contents

# Constructors

# Properties

# Constructors

# constructor

+ new Db3dPolyline(prop?: IDb3dPolyline): Db3dPolyline

构造函数

# Parameters
Name Type Default value
prop IDb3dPolyline {}

Returns: Db3dPolyline

Overrides: DbCurve

# Properties

# alpha

Optional alpha: number

透明度. [0-255][0完全透明,255完全不透明]

Inherited from: DbCurve.alpha


# cloneFromDb

Optional cloneFromDb: string

克隆的实体ID来源的图形,如为空,则取DbDocument中from的图形。也可以指定另外的图形

Inherited from: DbCurve.cloneFromDb


# cloneObjectId

Optional cloneObjectId: string

克隆的实体ID,DbDocument有from图形来源字段时有效.

Inherited from: DbCurve.cloneObjectId


# closed

Optional closed: boolean

是否闭合.


# color

Optional color: number

颜色.

Inherited from: DbCurve.color


# colorIndex

Optional colorIndex: number

颜色索引.

Inherited from: DbCurve.colorIndex


# layer

Optional layer: string

图层.

Inherited from: DbCurve.layer


# lineWidth

Optional lineWidth: number

线宽.

Inherited from: DbCurve.lineWidth


# linetype

Optional linetype: string

线型.

Inherited from: DbCurve.linetype


# linetypeScale

Optional linetypeScale: number

线型比例.

Inherited from: DbCurve.linetypeScale


# matrix

Optional matrix: IDbMatrixOp[]

矩阵.

Inherited from: DbCurve.matrix


# points

Optional points: [number, number, undefined | number][]

坐标.


# polyType

Optional polyType: k3dSimplePoly | k3dQuadSplinePoly | k3dCubicSplinePoly

3d折线类型


# typename

Optional typename: string

类型.

Inherited from: DbCurve.typename


# visibility

Optional visibility: boolean

可见.

Inherited from: DbCurve.visibility


# xdata

Optional xdata: string

扩展数据.

Inherited from: DbCurve.xdata

vjmap / Exports / Db3PointAngularDimension

# Class: Db3PointAngularDimension

Db3PointAngularDimension 角度标注[三点]实体.

# Hierarchy

# Table of contents

# Constructors

# Properties

# Constructors

# constructor

+ new Db3PointAngularDimension(prop?: IDb3PointAngularDimension): Db3PointAngularDimension

构造函数

# Parameters
Name Type Default value
prop IDb3PointAngularDimension {}

Returns: Db3PointAngularDimension

Overrides: DbDimension

# Properties

# alpha

Optional alpha: number

透明度. [0-255][0完全透明,255完全不透明]

Inherited from: DbDimension.alpha


# arcPoint

Optional arcPoint: [number, number, undefined | number][]

圆弧点位置.


# arrowColor

Optional arrowColor: number

箭头颜色.

Inherited from: DbDimension.arrowColor


# arrowSize

Optional arrowSize: number

箭头大小.

Inherited from: DbDimension.arrowSize


# centerPoint

Optional centerPoint: [number, number, undefined | number][]

中点.


# cloneFromDb

Optional cloneFromDb: string

克隆的实体ID来源的图形,如为空,则取DbDocument中from的图形。也可以指定另外的图形

Inherited from: DbDimension.cloneFromDb


# cloneObjectId

Optional cloneObjectId: string

克隆的实体ID,DbDocument有from图形来源字段时有效.

Inherited from: DbDimension.cloneObjectId


# color

Optional color: number

颜色.

Inherited from: DbDimension.color


# colorIndex

Optional colorIndex: number

颜色索引.

Inherited from: DbDimension.colorIndex


# dimDec

Optional dimDec: number

设置标注主单位显示的小数位位数.

Inherited from: DbDimension.dimDec


# dimRnd

Optional dimRnd: number

所有标注距离舍入到指定值.

Inherited from: DbDimension.dimRnd


# dimScale

Optional dimScale: number

注记比例.

Inherited from: DbDimension.dimScale


# dimStyle

Optional dimStyle: string

标注样式.

Inherited from: DbDimension.dimStyle


# layer

Optional layer: string

图层.

Inherited from: DbDimension.layer


# lineColor

Optional lineColor: number

引线颜色.

Inherited from: DbDimension.lineColor


# lineWidth

Optional lineWidth: number

线宽.

Inherited from: DbDimension.lineWidth


# linetype

Optional linetype: string

线型.

Inherited from: DbDimension.linetype


# linetypeScale

Optional linetypeScale: number

线型比例.

Inherited from: DbDimension.linetypeScale


# matrix

Optional matrix: IDbMatrixOp[]

矩阵.

Inherited from: DbDimension.matrix


# textColor

Optional textColor: number

文本颜色.

Inherited from: DbDimension.textColor


# textHeight

Optional textHeight: number

文字高度.

Inherited from: DbDimension.textHeight


# textPosition

Optional textPosition: [number, number, undefined | number][]

文字位置.

Inherited from: DbDimension.textPosition


# textRotation

Optional textRotation: number

文字旋转角度.

Inherited from: DbDimension.textRotation


# typename

Optional typename: string

类型.

Inherited from: DbDimension.typename


# visibility

Optional visibility: boolean

可见.

Inherited from: DbDimension.visibility


# xLine1Point

Optional xLine1Point: [number, number, undefined | number][]

点1.


# xLine2Point

Optional xLine2Point: [number, number, undefined | number][]

点2.


# xdata

Optional xdata: string

扩展数据.

Inherited from: DbDimension.xdata

vjmap / Exports / DbAlignedDimension

# Class: DbAlignedDimension

DbAlignedDimension 对齐标注实体.

# Hierarchy

# Table of contents

# Constructors

# Properties

# Constructors

# constructor

+ new DbAlignedDimension(prop?: IDbAlignedDimension): DbAlignedDimension

构造函数

# Parameters
Name Type Default value
prop IDbAlignedDimension {}

Returns: DbAlignedDimension

Overrides: DbDimension

# Properties

# alpha

Optional alpha: number

透明度. [0-255][0完全透明,255完全不透明]

Inherited from: DbDimension.alpha


# arrowColor

Optional arrowColor: number

箭头颜色.

Inherited from: DbDimension.arrowColor


# arrowSize

Optional arrowSize: number

箭头大小.

Inherited from: DbDimension.arrowSize


# cloneFromDb

Optional cloneFromDb: string

克隆的实体ID来源的图形,如为空,则取DbDocument中from的图形。也可以指定另外的图形

Inherited from: DbDimension.cloneFromDb


# cloneObjectId

Optional cloneObjectId: string

克隆的实体ID,DbDocument有from图形来源字段时有效.

Inherited from: DbDimension.cloneObjectId


# color

Optional color: number

颜色.

Inherited from: DbDimension.color


# colorIndex

Optional colorIndex: number

颜色索引.

Inherited from: DbDimension.colorIndex


# dimDec

Optional dimDec: number

设置标注主单位显示的小数位位数.

Inherited from: DbDimension.dimDec


# dimLinePoint

Optional dimLinePoint: [number, number, undefined | number][]

设置定义此dimension实体尺寸线位置的WCS点.


# dimRnd

Optional dimRnd: number

所有标注距离舍入到指定值.

Inherited from: DbDimension.dimRnd


# dimScale

Optional dimScale: number

注记比例.

Inherited from: DbDimension.dimScale


# dimStyle

Optional dimStyle: string

标注样式.

Inherited from: DbDimension.dimStyle


# jogSymbolHeight

Optional jogSymbolHeight: number

设置此实体的符号高度。.


# layer

Optional layer: string

图层.

Inherited from: DbDimension.layer


# lineColor

Optional lineColor: number

引线颜色.

Inherited from: DbDimension.lineColor


# lineWidth

Optional lineWidth: number

线宽.

Inherited from: DbDimension.lineWidth


# linetype

Optional linetype: string

线型.

Inherited from: DbDimension.linetype


# linetypeScale

Optional linetypeScale: number

线型比例.

Inherited from: DbDimension.linetypeScale


# matrix

Optional matrix: IDbMatrixOp[]

矩阵.

Inherited from: DbDimension.matrix


# textColor

Optional textColor: number

文本颜色.

Inherited from: DbDimension.textColor


# textHeight

Optional textHeight: number

文字高度.

Inherited from: DbDimension.textHeight


# textPosition

Optional textPosition: [number, number, undefined | number][]

文字位置.

Inherited from: DbDimension.textPosition


# textRotation

Optional textRotation: number

文字旋转角度.

Inherited from: DbDimension.textRotation


# typename

Optional typename: string

类型.

Inherited from: DbDimension.typename


# visibility

Optional visibility: boolean

可见.

Inherited from: DbDimension.visibility


# xLine1Point

Optional xLine1Point: [number, number, undefined | number][]

线1点.


# xLine2Point

Optional xLine2Point: [number, number, undefined | number][]

线2点.


# xdata

Optional xdata: string

扩展数据.

Inherited from: DbDimension.xdata

vjmap / Exports / DbArc

# Class: DbArc

DbArc 圆弧实体.

# Hierarchy

# Table of contents

# Constructors

# Properties

# Constructors

# constructor

+ new DbArc(prop?: IDbArc): DbArc

构造函数

# Parameters
Name Type Default value
prop IDbArc {}

Returns: DbArc

Overrides: DbCurve

# Properties

# alpha

Optional alpha: number

透明度. [0-255][0完全透明,255完全不透明]

Inherited from: DbCurve.alpha


# center

Optional center: [number, number, undefined | number]

中心坐标.


# cloneFromDb

Optional cloneFromDb: string

克隆的实体ID来源的图形,如为空,则取DbDocument中from的图形。也可以指定另外的图形

Inherited from: DbCurve.cloneFromDb


# cloneObjectId

Optional cloneObjectId: string

克隆的实体ID,DbDocument有from图形来源字段时有效.

Inherited from: DbCurve.cloneObjectId


# color

Optional color: number

颜色.

Inherited from: DbCurve.color


# colorIndex

Optional colorIndex: number

颜色索引.

Inherited from: DbCurve.colorIndex


# endAngle

Optional endAngle: number

结束弧度.


# layer

Optional layer: string

图层.

Inherited from: DbCurve.layer


# lineWidth

Optional lineWidth: number

线宽.

Inherited from: DbCurve.lineWidth


# linetype

Optional linetype: string

线型.

Inherited from: DbCurve.linetype


# linetypeScale

Optional linetypeScale: number

线型比例.

Inherited from: DbCurve.linetypeScale


# matrix

Optional matrix: IDbMatrixOp[]

矩阵.

Inherited from: DbCurve.matrix


# normal

Optional normal: [number, number, undefined | number]

法向量.


# radius

Optional radius: number

半径.


# startAngle

Optional startAngle: number

开始弧度.


# thickness

Optional thickness: number

厚度.


# typename

Optional typename: string

类型.

Inherited from: DbCurve.typename


# visibility

Optional visibility: boolean

可见.

Inherited from: DbCurve.visibility


# xdata

Optional xdata: string

扩展数据.

Inherited from: DbCurve.xdata

vjmap / Exports / DbArcDimension

# Class: DbArcDimension

DbArcDimension 圆弧标注实体.

# Hierarchy

# Table of contents

# Constructors

# Properties

# Constructors

# constructor

+ new DbArcDimension(prop?: IDbArcDimension): DbArcDimension

构造函数

# Parameters
Name Type Default value
prop IDbArcDimension {}

Returns: DbArcDimension

Overrides: DbDimension

# Properties

# alpha

Optional alpha: number

透明度. [0-255][0完全透明,255完全不透明]

Inherited from: DbDimension.alpha


# arcPoint

Optional arcPoint: [number, number, undefined | number][]

圆弧点.


# arcSymbolType

Optional arcSymbolType: number

文本中使用的弧符号的类型。 0 弧符号在文本前面; 1 弧线符号在文字上方; 2 没有符号.


# arrowColor

Optional arrowColor: number

箭头颜色.

Inherited from: DbDimension.arrowColor


# arrowSize

Optional arrowSize: number

箭头大小.

Inherited from: DbDimension.arrowSize


# centerPoint

Optional centerPoint: [number, number, undefined | number][]

中心点.


# cloneFromDb

Optional cloneFromDb: string

克隆的实体ID来源的图形,如为空,则取DbDocument中from的图形。也可以指定另外的图形

Inherited from: DbDimension.cloneFromDb


# cloneObjectId

Optional cloneObjectId: string

克隆的实体ID,DbDocument有from图形来源字段时有效.

Inherited from: DbDimension.cloneObjectId


# color

Optional color: number

颜色.

Inherited from: DbDimension.color


# colorIndex

Optional colorIndex: number

颜色索引.

Inherited from: DbDimension.colorIndex


# dimDec

Optional dimDec: number

设置标注主单位显示的小数位位数.

Inherited from: DbDimension.dimDec


# dimRnd

Optional dimRnd: number

所有标注距离舍入到指定值.

Inherited from: DbDimension.dimRnd


# dimScale

Optional dimScale: number

注记比例.

Inherited from: DbDimension.dimScale


# dimStyle

Optional dimStyle: string

标注样式.

Inherited from: DbDimension.dimStyle


# layer

Optional layer: string

图层.

Inherited from: DbDimension.layer


# lineColor

Optional lineColor: number

引线颜色.

Inherited from: DbDimension.lineColor


# lineWidth

Optional lineWidth: number

线宽.

Inherited from: DbDimension.lineWidth


# linetype

Optional linetype: string

线型.

Inherited from: DbDimension.linetype


# linetypeScale

Optional linetypeScale: number

线型比例.

Inherited from: DbDimension.linetypeScale


# matrix

Optional matrix: IDbMatrixOp[]

矩阵.

Inherited from: DbDimension.matrix


# textColor

Optional textColor: number

文本颜色.

Inherited from: DbDimension.textColor


# textHeight

Optional textHeight: number

文字高度.

Inherited from: DbDimension.textHeight


# textPosition

Optional textPosition: [number, number, undefined | number][]

文字位置.

Inherited from: DbDimension.textPosition


# textRotation

Optional textRotation: number

文字旋转角度.

Inherited from: DbDimension.textRotation


# typename

Optional typename: string

类型.

Inherited from: DbDimension.typename


# visibility

Optional visibility: boolean

可见.

Inherited from: DbDimension.visibility


# xLine1Point

Optional xLine1Point: [number, number, undefined | number][]

线1点.


# xLine2Point

Optional xLine2Point: [number, number, undefined | number][]

线2点.


# xdata

Optional xdata: string

扩展数据.

Inherited from: DbDimension.xdata

vjmap / Exports / DbAttributeDefinition

# Class: DbAttributeDefinition

DbText 属性定义实体.

# Hierarchy

  • DbText

    DbAttributeDefinition

# Table of contents

# Constructors

# Properties

# Constructors

# constructor

+ new DbAttributeDefinition(prop?: IDbText): DbAttributeDefinition

构造函数

# Parameters
Name Type Default value
prop IDbText {}

Returns: DbAttributeDefinition

Overrides: DbText

# Properties

# alpha

Optional alpha: number

透明度. [0-255][0完全透明,255完全不透明]

Inherited from: DbText.alpha


# cloneFromDb

Optional cloneFromDb: string

克隆的实体ID来源的图形,如为空,则取DbDocument中from的图形。也可以指定另外的图形

Inherited from: DbText.cloneFromDb


# cloneObjectId

Optional cloneObjectId: string

克隆的实体ID,DbDocument有from图形来源字段时有效.

Inherited from: DbText.cloneObjectId


# color

Optional color: number

颜色.

Inherited from: DbText.color


# colorIndex

Optional colorIndex: number

颜色索引.

Inherited from: DbText.colorIndex


# contents

Optional contents: string

文本内容, 同text.

Inherited from: DbText.contents


# height

Optional height: number

高.

Inherited from: DbText.height


# horizontalMode

Optional horizontalMode: kTextLeft | kTextCenter | kTextRight | kTextAlign | kTextMid | kTextFit

水平模式.

Inherited from: DbText.horizontalMode


# layer

Optional layer: string

图层.

Inherited from: DbText.layer


# lineWidth

Optional lineWidth: number

线宽.

Inherited from: DbText.lineWidth


# linetype

Optional linetype: string

线型.

Inherited from: DbText.linetype


# linetypeScale

Optional linetypeScale: number

线型比例.

Inherited from: DbText.linetypeScale


# matrix

Optional matrix: IDbMatrixOp[]

矩阵.

Inherited from: DbText.matrix


# position

Optional position: [number, number, undefined | number]

位置.

Inherited from: DbText.position


# prompt

Optional prompt: string

属性提示.


# rotation

Optional rotation: number

旋转角度.

Inherited from: DbText.rotation


# tag

Optional tag: string

属性名.


# text

Optional text: string

文本内容, 同contents.

Inherited from: DbText.text


# textStyle

Optional textStyle: string

文本样式.

Inherited from: DbText.textStyle


# typename

Optional typename: string

类型.

Inherited from: DbText.typename


# verticalMode

Optional verticalMode: kTextBase | kTextBottom | kTextVertMid | kTextTop

垂直模式.

Inherited from: DbText.verticalMode


# visibility

Optional visibility: boolean

可见.

Inherited from: DbText.visibility


# xdata

Optional xdata: string

扩展数据.

Inherited from: DbText.xdata

vjmap / Exports / DbBlock

# Class: DbBlock

DbBlock 块定义.

# Table of contents

# Constructors

# Properties

# Constructors

# constructor

+ new DbBlock(prop?: IDbBlock): DbBlock

构造函数

# Parameters
Name Type Default value
prop IDbBlock {}

Returns: DbBlock

# Properties

# comments

Optional comments: string

备注.


# entitys

Optional entitys: IDbEntity[]

由哪些实体创建而成.


# explodable

Optional explodable: boolean

是否可炸开.


# insertUnits

Optional insertUnits: number

设置此块的块插入单位 .


# name

Optional name: string

块名称.


# origin

Optional origin: [number, number, undefined | number]

原点。 .


# scaling

Optional scaling: number

设置此块的参照的缩放特征.

vjmap / Exports / DbBlockReference

# Class: DbBlockReference

DbBlockReference 块参照实体.

# Hierarchy

# Table of contents

# Constructors

# Properties

# Constructors

# constructor

+ new DbBlockReference(prop?: IDbBlockReference): DbBlockReference

构造函数

# Parameters
Name Type Default value
prop IDbBlockReference {}

Returns: DbBlockReference

Overrides: DbEntity

# Properties

# alpha

Optional alpha: number

透明度. [0-255][0完全透明,255完全不透明]

Inherited from: DbEntity.alpha


# attribute

Optional attribute: Record<string, string | number | DbText>

属性字段值


# blockname

Optional blockname: string

块名称.


# cloneFromDb

Optional cloneFromDb: string

克隆的实体ID来源的图形,如为空,则取DbDocument中from的图形。也可以指定另外的图形

Inherited from: DbEntity.cloneFromDb


# cloneObjectId

Optional cloneObjectId: string

克隆的实体ID,DbDocument有from图形来源字段时有效.

Inherited from: DbEntity.cloneObjectId


# color

Optional color: number

颜色.

Inherited from: DbEntity.color


# colorIndex

Optional colorIndex: number

颜色索引.

Inherited from: DbEntity.colorIndex


# layer

Optional layer: string

图层.

Inherited from: DbEntity.layer


# lineWidth

Optional lineWidth: number

线宽.

Inherited from: DbEntity.lineWidth


# linetype

Optional linetype: string

线型.

Inherited from: DbEntity.linetype


# linetypeScale

Optional linetypeScale: number

线型比例.

Inherited from: DbEntity.linetypeScale


# matrix

Optional matrix: IDbMatrixOp[]

矩阵.

Inherited from: DbEntity.matrix


# normal

Optional normal: [number, number, undefined | number]

法向量.


# position

Optional position: [number, number, undefined | number]

坐标.


# ref

Optional ref: string

参考外部图形,形式为 mapid/version,如 exam/v1.


# rotation

Optional rotation: number

旋转角度.


# scaleFactors

Optional scaleFactors: [number, number, undefined | number]

缩放因子. [x方向,y方向,z方向]


# typename

Optional typename: string

类型.

Inherited from: DbEntity.typename


# visibility

Optional visibility: boolean

可见.

Inherited from: DbEntity.visibility


# xdata

Optional xdata: string

扩展数据.

Inherited from: DbEntity.xdata

vjmap / Exports / DbCircle

# Class: DbCircle

DbCircle 圆实体.

# Hierarchy

# Table of contents

# Constructors

# Properties

# Constructors

# constructor

+ new DbCircle(prop?: IDbCircle): DbCircle

构造函数

# Parameters
Name Type Default value
prop IDbCircle {}

Returns: DbCircle

Overrides: DbCurve

# Properties

# alpha

Optional alpha: number

透明度. [0-255][0完全透明,255完全不透明]

Inherited from: DbCurve.alpha


# center

Optional center: [number, number, undefined | number]

中心坐标.


# cloneFromDb

Optional cloneFromDb: string

克隆的实体ID来源的图形,如为空,则取DbDocument中from的图形。也可以指定另外的图形

Inherited from: DbCurve.cloneFromDb


# cloneObjectId

Optional cloneObjectId: string

克隆的实体ID,DbDocument有from图形来源字段时有效.

Inherited from: DbCurve.cloneObjectId


# color

Optional color: number

颜色.

Inherited from: DbCurve.color


# colorIndex

Optional colorIndex: number

颜色索引.

Inherited from: DbCurve.colorIndex


# layer

Optional layer: string

图层.

Inherited from: DbCurve.layer


# lineWidth

Optional lineWidth: number

线宽.

Inherited from: DbCurve.lineWidth


# linetype

Optional linetype: string

线型.

Inherited from: DbCurve.linetype


# linetypeScale

Optional linetypeScale: number

线型比例.

Inherited from: DbCurve.linetypeScale


# matrix

Optional matrix: IDbMatrixOp[]

矩阵.

Inherited from: DbCurve.matrix


# normal

Optional normal: [number, number, undefined | number]

法向量.


# radius

Optional radius: number

半径.


# thickness

Optional thickness: number

厚度.


# typename

Optional typename: string

类型.

Inherited from: DbCurve.typename


# visibility

Optional visibility: boolean

可见.

Inherited from: DbCurve.visibility


# xdata

Optional xdata: string

扩展数据.

Inherited from: DbCurve.xdata

vjmap / Exports / DbCurve

# Class: DbCurve

DbCurve 曲线实体.

# Hierarchy

# Table of contents

# Constructors

# Properties

# Constructors

# constructor

+ new DbCurve(prop?: IDbCurve): DbCurve

构造函数

# Parameters
Name Type Default value
prop IDbCurve {}

Returns: DbCurve

Overrides: DbEntity

# Properties

# alpha

Optional alpha: number

透明度. [0-255][0完全透明,255完全不透明]

Inherited from: DbEntity.alpha


# cloneFromDb

Optional cloneFromDb: string

克隆的实体ID来源的图形,如为空,则取DbDocument中from的图形。也可以指定另外的图形

Inherited from: DbEntity.cloneFromDb


# cloneObjectId

Optional cloneObjectId: string

克隆的实体ID,DbDocument有from图形来源字段时有效.

Inherited from: DbEntity.cloneObjectId


# color

Optional color: number

颜色.

Inherited from: DbEntity.color


# colorIndex

Optional colorIndex: number

颜色索引.

Inherited from: DbEntity.colorIndex


# layer

Optional layer: string

图层.

Inherited from: DbEntity.layer


# lineWidth

Optional lineWidth: number

线宽.

Inherited from: DbEntity.lineWidth


# linetype

Optional linetype: string

线型.

Inherited from: DbEntity.linetype


# linetypeScale

Optional linetypeScale: number

线型比例.

Inherited from: DbEntity.linetypeScale


# matrix

Optional matrix: IDbMatrixOp[]

矩阵.

Inherited from: DbEntity.matrix


# typename

Optional typename: string

类型.

Inherited from: DbEntity.typename


# visibility

Optional visibility: boolean

可见.

Inherited from: DbEntity.visibility


# xdata

Optional xdata: string

扩展数据.

Inherited from: DbEntity.xdata

vjmap / Exports / DbDiametricDimension

# Class: DbDiametricDimension

DbDiametricDimension 直径标注实体.

# Hierarchy

# Table of contents

# Constructors

# Properties

# Constructors

# constructor

+ new DbDiametricDimension(prop?: IDbDiametricDimension): DbDiametricDimension

构造函数

# Parameters
Name Type Default value
prop IDbDiametricDimension {}

Returns: DbDiametricDimension

Overrides: DbDimension

# Properties

# alpha

Optional alpha: number

透明度. [0-255][0完全透明,255完全不透明]

Inherited from: DbDimension.alpha


# arrowColor

Optional arrowColor: number

箭头颜色.

Inherited from: DbDimension.arrowColor


# arrowSize

Optional arrowSize: number

箭头大小.

Inherited from: DbDimension.arrowSize


# chordPoint

Optional chordPoint: [number, number, undefined | number][]

圆上1点.


# cloneFromDb

Optional cloneFromDb: string

克隆的实体ID来源的图形,如为空,则取DbDocument中from的图形。也可以指定另外的图形

Inherited from: DbDimension.cloneFromDb


# cloneObjectId

Optional cloneObjectId: string

克隆的实体ID,DbDocument有from图形来源字段时有效.

Inherited from: DbDimension.cloneObjectId


# color

Optional color: number

颜色.

Inherited from: DbDimension.color


# colorIndex

Optional colorIndex: number

颜色索引.

Inherited from: DbDimension.colorIndex


# dimDec

Optional dimDec: number

设置标注主单位显示的小数位位数.

Inherited from: DbDimension.dimDec


# dimRnd

Optional dimRnd: number

所有标注距离舍入到指定值.

Inherited from: DbDimension.dimRnd


# dimScale

Optional dimScale: number

注记比例.

Inherited from: DbDimension.dimScale


# dimStyle

Optional dimStyle: string

标注样式.

Inherited from: DbDimension.dimStyle


# farChordPoint

Optional farChordPoint: [number, number, undefined | number][]

圆上2点.


# layer

Optional layer: string

图层.

Inherited from: DbDimension.layer


# leaderLength

Optional leaderLength: number

引线长度.


# lineColor

Optional lineColor: number

引线颜色.

Inherited from: DbDimension.lineColor


# lineWidth

Optional lineWidth: number

线宽.

Inherited from: DbDimension.lineWidth


# linetype

Optional linetype: string

线型.

Inherited from: DbDimension.linetype


# linetypeScale

Optional linetypeScale: number

线型比例.

Inherited from: DbDimension.linetypeScale


# matrix

Optional matrix: IDbMatrixOp[]

矩阵.

Inherited from: DbDimension.matrix


# textColor

Optional textColor: number

文本颜色.

Inherited from: DbDimension.textColor


# textHeight

Optional textHeight: number

文字高度.

Inherited from: DbDimension.textHeight


# textPosition

Optional textPosition: [number, number, undefined | number][]

文字位置.

Inherited from: DbDimension.textPosition


# textRotation

Optional textRotation: number

文字旋转角度.

Inherited from: DbDimension.textRotation


# typename

Optional typename: string

类型.

Inherited from: DbDimension.typename


# visibility

Optional visibility: boolean

可见.

Inherited from: DbDimension.visibility


# xdata

Optional xdata: string

扩展数据.

Inherited from: DbDimension.xdata

vjmap / Exports / DbDimension

# Class: DbDimension

DbDimension 标注实体.

# Hierarchy

# Table of contents

# Constructors

# Properties

# Constructors

# constructor

+ new DbDimension(prop?: IDbDimension): DbDimension

构造函数

# Parameters
Name Type Default value
prop IDbDimension {}

Returns: DbDimension

Overrides: DbEntity

# Properties

# alpha

Optional alpha: number

透明度. [0-255][0完全透明,255完全不透明]

Inherited from: DbEntity.alpha


# arrowColor

Optional arrowColor: number

箭头颜色.


# arrowSize

Optional arrowSize: number

箭头大小.


# cloneFromDb

Optional cloneFromDb: string

克隆的实体ID来源的图形,如为空,则取DbDocument中from的图形。也可以指定另外的图形

Inherited from: DbEntity.cloneFromDb


# cloneObjectId

Optional cloneObjectId: string

克隆的实体ID,DbDocument有from图形来源字段时有效.

Inherited from: DbEntity.cloneObjectId


# color

Optional color: number

颜色.

Inherited from: DbEntity.color


# colorIndex

Optional colorIndex: number

颜色索引.

Inherited from: DbEntity.colorIndex


# dimDec

Optional dimDec: number

设置标注主单位显示的小数位位数.


# dimRnd

Optional dimRnd: number

所有标注距离舍入到指定值.


# dimScale

Optional dimScale: number

注记比例.


# dimStyle

Optional dimStyle: string

标注样式.


# layer

Optional layer: string

图层.

Inherited from: DbEntity.layer


# lineColor

Optional lineColor: number

引线颜色.


# lineWidth

Optional lineWidth: number

线宽.

Inherited from: DbEntity.lineWidth


# linetype

Optional linetype: string

线型.

Inherited from: DbEntity.linetype


# linetypeScale

Optional linetypeScale: number

线型比例.

Inherited from: DbEntity.linetypeScale


# matrix

Optional matrix: IDbMatrixOp[]

矩阵.

Inherited from: DbEntity.matrix


# textColor

Optional textColor: number

文本颜色.


# textHeight

Optional textHeight: number

文字高度.


# textPosition

Optional textPosition: [number, number, undefined | number][]

文字位置.


# textRotation

Optional textRotation: number

文字旋转角度.


# typename

Optional typename: string

类型.

Inherited from: DbEntity.typename


# visibility

Optional visibility: boolean

可见.

Inherited from: DbEntity.visibility


# xdata

Optional xdata: string

扩展数据.

Inherited from: DbEntity.xdata

vjmap / Exports / DbDocument

# Class: DbDocument

DbDocument 地图数据库文档.

# Table of contents

# Constructors

# Properties

# Methods

# Constructors

# constructor

+ new DbDocument(prop?: IDbDocument): DbDocument

构造函数

# Parameters
Name Type Default value
prop IDbDocument {}

Returns: DbDocument

# Properties

# blocks

Optional blocks: IDbBlock[]

块定义.


# dimStyles

Optional dimStyles: IDbDimStyle[]

标注样式.


# entitys

Optional entitys: IDbEntity[]

实体集.


# environment

Optional environment: Record<string, any>

文档环境,用于设置是否显示线宽等设置, 设置线宽为 LWDISPLAY ,true显示或 false不显示线宽


# from

Optional from: string

来源于哪个图,会在此图的上面进行修改或新增删除,格式如 形式为 mapid/version,如 exam/v1 .


# isClearFromDb

Optional isClearFromDb: boolean


# layers

Optional layers: IDbLayer[]

图层集.


# linetypes

Optional linetypes: IDbLinetype[]

线型.


# pickEntitys

Optional pickEntitys: string[]

来源于哪个图时有效,表示从此图中选择指定的实体ID,不在指定的实体ID将不会显示


# pickLayers

Optional pickLayers: string[]

来源于哪个图时有效,表示从此图中选择指定的图层,不在指定的图层将不会显示


# textStyles

Optional textStyles: IDbTextStyle[]

文字样式.

# Methods

# appendBlock

appendBlock(block: IDbBlock | IDbBlock[]): void

增加块

# Parameters
Name Type
block IDbBlock | IDbBlock[]

Returns: void


# appendDimStyle

appendDimStyle(dimStyle: IDbDimStyle | IDbDimStyle[]): void

增加标注样式

# Parameters
Name Type
dimStyle IDbDimStyle | IDbDimStyle[]

Returns: void


# appendEntity

appendEntity(entity: IDbEntity | IDbEntity[]): void

增加实体

# Parameters
Name Type
entity IDbEntity | IDbEntity[]

Returns: void


# appendLayer

appendLayer(layer: IDbLayer | IDbLayer[]): void

增加图层

# Parameters
Name Type
layer IDbLayer | IDbLayer[]

Returns: void


# appendLinetype

appendLinetype(linetype: IDbLinetype | IDbLinetype[]): void

增加线型

# Parameters
Name Type
linetype IDbLinetype | IDbLinetype[]

Returns: void


# appendTextStyle

appendTextStyle(textStyle: IDbTextStyle | IDbTextStyle[]): void

增加样式样式

# Parameters
Name Type
textStyle IDbTextStyle | IDbTextStyle[]

Returns: void


# toDoc

toDoc(content?: string): string

转成文档字符串

# Parameters
Name Type Description
content? string 如果传入了内容,则以content为主。json格式

Returns: string

vjmap / Exports / DbEllipse

# Class: DbEllipse

DbEllipse 椭圆实体.

# Hierarchy

# Table of contents

# Constructors

# Properties

# Constructors

# constructor

+ new DbEllipse(prop?: IDbEllipse): DbEllipse

构造函数

# Parameters
Name Type Default value
prop IDbEllipse {}

Returns: DbEllipse

Overrides: DbCurve

# Properties

# alpha

Optional alpha: number

透明度. [0-255][0完全透明,255完全不透明]

Inherited from: DbCurve.alpha


# center

Optional center: [number, number, undefined | number]

中心坐标.


# cloneFromDb

Optional cloneFromDb: string

克隆的实体ID来源的图形,如为空,则取DbDocument中from的图形。也可以指定另外的图形

Inherited from: DbCurve.cloneFromDb


# cloneObjectId

Optional cloneObjectId: string

克隆的实体ID,DbDocument有from图形来源字段时有效.

Inherited from: DbCurve.cloneObjectId


# color

Optional color: number

颜色.

Inherited from: DbCurve.color


# colorIndex

Optional colorIndex: number

颜色索引.

Inherited from: DbCurve.colorIndex


# endAngle

Optional endAngle: number

结束弧度.


# layer

Optional layer: string

图层.

Inherited from: DbCurve.layer


# lineWidth

Optional lineWidth: number

线宽.

Inherited from: DbCurve.lineWidth


# linetype

Optional linetype: string

线型.

Inherited from: DbCurve.linetype


# linetypeScale

Optional linetypeScale: number

线型比例.

Inherited from: DbCurve.linetypeScale


# matrix

Optional matrix: IDbMatrixOp[]

矩阵.

Inherited from: DbCurve.matrix


# minorAxis

Optional minorAxis: [number, number, undefined | number]

主轴方向.


# radiusRatio

Optional radiusRatio: number

短轴和长轴的比例.


# startAngle

Optional startAngle: number

开始弧度.


# typename

Optional typename: string

类型.

Inherited from: DbCurve.typename


# visibility

Optional visibility: boolean

可见.

Inherited from: DbCurve.visibility


# xdata

Optional xdata: string

扩展数据.

Inherited from: DbCurve.xdata

vjmap / Exports / DbEntity

# Class: DbEntity

DbEntity 实体基类.

# Implements

# Table of contents

# Constructors

# Properties

# Constructors

# constructor

+ Protected new DbEntity(prop?: IDbEntity): DbEntity

构造函数

# Parameters
Name Type Default value
prop IDbEntity {}

Returns: DbEntity

# Properties

# alpha

Optional alpha: number

透明度. [0-255][0完全透明,255完全不透明]

Implementation of: IDbEntity.alpha


# cloneFromDb

Optional cloneFromDb: string

克隆的实体ID来源的图形,如为空,则取DbDocument中from的图形。也可以指定另外的图形


# cloneObjectId

Optional cloneObjectId: string

克隆的实体ID,DbDocument有from图形来源字段时有效.


# color

Optional color: number

颜色.

Implementation of: IDbEntity.color


# colorIndex

Optional colorIndex: number

颜色索引.

Implementation of: IDbEntity.colorIndex


# layer

Optional layer: string

图层.

Implementation of: IDbEntity.layer


# lineWidth

Optional lineWidth: number

线宽.

Implementation of: IDbEntity.lineWidth


# linetype

Optional linetype: string

线型.

Implementation of: IDbEntity.linetype


# linetypeScale

Optional linetypeScale: number

线型比例.

Implementation of: IDbEntity.linetypeScale


# matrix

Optional matrix: IDbMatrixOp[]

矩阵.

Implementation of: IDbEntity.matrix


# typename

Optional typename: string

类型.

Implementation of: IDbEntity.typename


# visibility

Optional visibility: boolean

可见.

Implementation of: IDbEntity.visibility


# xdata

Optional xdata: string

扩展数据.

Implementation of: IDbEntity.xdata

vjmap / Exports / DbHatch

# Class: DbHatch

DbHatch 图案实体.

# Hierarchy

# Table of contents

# Constructors

# Properties

# Constructors

# constructor

+ new DbHatch(prop?: IDbHatch): DbHatch

构造函数

# Parameters
Name Type Default value
prop IDbHatch {}

Returns: DbHatch

Overrides: DbEntity

# Properties

# alpha

Optional alpha: number

透明度. [0-255][0完全透明,255完全不透明]

Inherited from: DbEntity.alpha


# cloneFromDb

Optional cloneFromDb: string

克隆的实体ID来源的图形,如为空,则取DbDocument中from的图形。也可以指定另外的图形

Inherited from: DbEntity.cloneFromDb


# cloneObjectId

Optional cloneObjectId: string

克隆的实体ID,DbDocument有from图形来源字段时有效.

Inherited from: DbEntity.cloneObjectId


# color

Optional color: number

颜色.

Inherited from: DbEntity.color


# colorIndex

Optional colorIndex: number

颜色索引.

Inherited from: DbEntity.colorIndex


# elevation

Optional elevation: number

高程.


# layer

Optional layer: string

图层.

Inherited from: DbEntity.layer


# lineWidth

Optional lineWidth: number

线宽.

Inherited from: DbEntity.lineWidth


# linetype

Optional linetype: string

线型.

Inherited from: DbEntity.linetype


# linetypeScale

Optional linetypeScale: number

线型比例.

Inherited from: DbEntity.linetypeScale


# matrix

Optional matrix: IDbMatrixOp[]

矩阵.

Inherited from: DbEntity.matrix


# pattern

Optional pattern: string

填充图案, 缺省 SOLID


# patternAngle

Optional patternAngle: number

填充角度


# patternAssociative

Optional patternAssociative: boolean

是否关联


# patternBackgroundColor

Optional patternBackgroundColor: number

填充背景色


# patternDouble

Optional patternDouble: boolean

指定用户定义的图案填充是否双向填充


# patternOrigin

Optional patternOrigin: [number, number]

填充原点坐标


# patternScale

Optional patternScale: number

填充比例


# patternSpace

Optional patternSpace: number

填充间距


# points

Optional points: [number, number, undefined | number][] | [number, number, undefined | number][][]

坐标.


# typename

Optional typename: string

类型.

Inherited from: DbEntity.typename


# visibility

Optional visibility: boolean

可见.

Inherited from: DbEntity.visibility


# xdata

Optional xdata: string

扩展数据.

Inherited from: DbEntity.xdata

vjmap / Exports / DbLayer

# Class: DbLayer

DbLayer 图层.

# Table of contents

# Constructors

# Properties

# Constructors

# constructor

+ new DbLayer(prop?: IDbLayer): DbLayer

构造函数

# Parameters
Name Type Default value
prop IDbLayer {}

Returns: DbLayer

# Properties

# color

Optional color: number

图层颜色索引.


# linetype

Optional linetype: string

图层线型,缺省 CONTINUOUS .


# name

Optional name: string

图层名称.

vjmap / Exports / DbLine

# Class: DbLine

DbLine 线实体.

# Hierarchy

# Implements

# Table of contents

# Constructors

# Properties

# Constructors

# constructor

+ new DbLine(prop?: IDbLine): DbLine

构造函数

# Parameters
Name Type Default value
prop IDbLine {}

Returns: DbLine

Overrides: DbEntity

# Properties

# alpha

Optional alpha: number

透明度. [0-255][0完全透明,255完全不透明]

Implementation of: IDbLine.alpha

Inherited from: DbEntity.alpha


# cloneFromDb

Optional cloneFromDb: string

克隆的实体ID来源的图形,如为空,则取DbDocument中from的图形。也可以指定另外的图形

Inherited from: DbEntity.cloneFromDb


# cloneObjectId

Optional cloneObjectId: string

克隆的实体ID,DbDocument有from图形来源字段时有效.

Inherited from: DbEntity.cloneObjectId


# color

Optional color: number

颜色.

Implementation of: IDbLine.color

Inherited from: DbEntity.color


# colorIndex

Optional colorIndex: number

颜色索引.

Implementation of: IDbLine.colorIndex

Inherited from: DbEntity.colorIndex


# end

Optional end: [number, number, undefined | number]

终点.

Implementation of: IDbLine.end


# layer

Optional layer: string

图层.

Implementation of: IDbLine.layer

Inherited from: DbEntity.layer


# lineWidth

Optional lineWidth: number

线宽.

Implementation of: IDbLine.lineWidth

Inherited from: DbEntity.lineWidth


# linetype

Optional linetype: string

线型.

Implementation of: IDbLine.linetype

Inherited from: DbEntity.linetype


# linetypeScale

Optional linetypeScale: number

线型比例.

Implementation of: IDbLine.linetypeScale

Inherited from: DbEntity.linetypeScale


# matrix

Optional matrix: IDbMatrixOp[]

矩阵.

Implementation of: IDbLine.matrix

Inherited from: DbEntity.matrix


# start

Optional start: [number, number, undefined | number]

起点.

Implementation of: IDbLine.start


# thickness

Optional thickness: number

厚度.

Implementation of: IDbLine.thickness


# typename

Optional typename: string

类型.

Implementation of: IDbLine.typename

Inherited from: DbEntity.typename


# visibility

Optional visibility: boolean

可见.

Implementation of: IDbLine.visibility

Inherited from: DbEntity.visibility


# xdata

Optional xdata: string

扩展数据.

Implementation of: IDbLine.xdata

Inherited from: DbEntity.xdata

vjmap / Exports / DbLineType

# Class: DbLineType

DbLineType 线型.

# Table of contents

# Constructors

# Properties

# Constructors

# constructor

+ new DbLineType(prop?: IDbLinetype): DbLineType

构造函数

# Parameters
Name Type Default value
prop IDbLinetype {}

Returns: DbLineType

# Properties

# comments

Optional comments: string

评论.


# name

Optional name: string

线型名称.


# style

Optional style: IDbLinetypeStyle[]

线型样式 .

vjmap / Exports / DbMText

# Class: DbMText

DbMText 多行文本实体.

# Hierarchy

# Table of contents

# Constructors

# Properties

# Constructors

# constructor

+ new DbMText(prop?: IDbMText): DbMText

构造函数

# Parameters
Name Type Default value
prop IDbMText {}

Returns: DbMText

Overrides: DbEntity

# Properties

# alpha

Optional alpha: number

透明度. [0-255][0完全透明,255完全不透明]

Inherited from: DbEntity.alpha


# attachment

Optional attachment: kTopLeft | kTopCenter | kTopRight | kMiddleLeft | kMiddleCenter | kMiddleRight | kBottomLeft | kBottomCenter | kBottomRight | kBaseLeft | kBaseCenter | kBaseRight | kBaseAlign | kBottomAlign | kMiddleAlign | kTopAlign | kBaseFit | kBottomFit | kMiddleFit | kTopFit | kBaseMid | kBottomMid | kMiddleMid | kTopMid

对齐方式.


# cloneFromDb

Optional cloneFromDb: string

克隆的实体ID来源的图形,如为空,则取DbDocument中from的图形。也可以指定另外的图形

Inherited from: DbEntity.cloneFromDb


# cloneObjectId

Optional cloneObjectId: string

克隆的实体ID,DbDocument有from图形来源字段时有效.

Inherited from: DbEntity.cloneObjectId


# color

Optional color: number

颜色.

Inherited from: DbEntity.color


# colorIndex

Optional colorIndex: number

颜色索引.

Inherited from: DbEntity.colorIndex


# contents

Optional contents: string

文本内容.


# height

Optional height: number

高.


# layer

Optional layer: string

图层.

Inherited from: DbEntity.layer


# lineWidth

Optional lineWidth: number

线宽.

Inherited from: DbEntity.lineWidth


# linetype

Optional linetype: string

线型.

Inherited from: DbEntity.linetype


# linetypeScale

Optional linetypeScale: number

线型比例.

Inherited from: DbEntity.linetypeScale


# location

Optional location: [number, number, undefined | number]

位置.


# matrix

Optional matrix: IDbMatrixOp[]

矩阵.

Inherited from: DbEntity.matrix


# rotation

Optional rotation: number

旋转角度.


# textHeight

Optional textHeight: number

文本高.


# textStyle

Optional textStyle: string

文本样式.


# typename

Optional typename: string

类型.

Inherited from: DbEntity.typename


# visibility

Optional visibility: boolean

可见.

Inherited from: DbEntity.visibility


# width

Optional width: number

宽.


# xdata

Optional xdata: string

扩展数据.

Inherited from: DbEntity.xdata

vjmap / Exports / DbOrdinateDimension

# Class: DbOrdinateDimension

DbOrdinateDimension 坐标标注实体.

# Hierarchy

# Table of contents

# Constructors

# Properties

# Constructors

# constructor

+ new DbOrdinateDimension(prop?: IDbOrdinateDimension): DbOrdinateDimension

构造函数

# Parameters
Name Type Default value
prop IDbOrdinateDimension {}

Returns: DbOrdinateDimension

Overrides: DbDimension

# Properties

# alpha

Optional alpha: number

透明度. [0-255][0完全透明,255完全不透明]

Inherited from: DbDimension.alpha


# arrowColor

Optional arrowColor: number

箭头颜色.

Inherited from: DbDimension.arrowColor


# arrowSize

Optional arrowSize: number

箭头大小.

Inherited from: DbDimension.arrowSize


# cloneFromDb

Optional cloneFromDb: string

克隆的实体ID来源的图形,如为空,则取DbDocument中from的图形。也可以指定另外的图形

Inherited from: DbDimension.cloneFromDb


# cloneObjectId

Optional cloneObjectId: string

克隆的实体ID,DbDocument有from图形来源字段时有效.

Inherited from: DbDimension.cloneObjectId


# color

Optional color: number

颜色.

Inherited from: DbDimension.color


# colorIndex

Optional colorIndex: number

颜色索引.

Inherited from: DbDimension.colorIndex


# definingPoint

Optional definingPoint: [number, number, undefined | number][]

定义点.


# dimDec

Optional dimDec: number

设置标注主单位显示的小数位位数.

Inherited from: DbDimension.dimDec


# dimRnd

Optional dimRnd: number

所有标注距离舍入到指定值.

Inherited from: DbDimension.dimRnd


# dimScale

Optional dimScale: number

注记比例.

Inherited from: DbDimension.dimScale


# dimStyle

Optional dimStyle: string

标注样式.

Inherited from: DbDimension.dimStyle


# layer

Optional layer: string

图层.

Inherited from: DbDimension.layer


# leaderEndPoint

Optional leaderEndPoint: [number, number, undefined | number][]

引线点.


# lineColor

Optional lineColor: number

引线颜色.

Inherited from: DbDimension.lineColor


# lineWidth

Optional lineWidth: number

线宽.

Inherited from: DbDimension.lineWidth


# linetype

Optional linetype: string

线型.

Inherited from: DbDimension.linetype


# linetypeScale

Optional linetypeScale: number

线型比例.

Inherited from: DbDimension.linetypeScale


# matrix

Optional matrix: IDbMatrixOp[]

矩阵.

Inherited from: DbDimension.matrix


# origin

Optional origin: [number, number, undefined | number][]

基点.


# textColor

Optional textColor: number

文本颜色.

Inherited from: DbDimension.textColor


# textHeight

Optional textHeight: number

文字高度.

Inherited from: DbDimension.textHeight


# textPosition

Optional textPosition: [number, number, undefined | number][]

文字位置.

Inherited from: DbDimension.textPosition


# textRotation

Optional textRotation: number

文字旋转角度.

Inherited from: DbDimension.textRotation


# typename

Optional typename: string

类型.

Inherited from: DbDimension.typename


# useXAxis

Optional useXAxis: boolean

是否用X轴.


# visibility

Optional visibility: boolean

可见.

Inherited from: DbDimension.visibility


# xdata

Optional xdata: string

扩展数据.

Inherited from: DbDimension.xdata

vjmap / Exports / DbPolyline

# Class: DbPolyline

DbPolyline 多段线实体.

# Hierarchy

# Table of contents

# Constructors

# Properties

# Constructors

# constructor

+ new DbPolyline(prop?: IDbPolyline): DbPolyline

构造函数

# Parameters
Name Type Default value
prop IDbPolyline {}

Returns: DbPolyline

Overrides: DbCurve

# Properties

# alpha

Optional alpha: number

透明度. [0-255][0完全透明,255完全不透明]

Inherited from: DbCurve.alpha


# bulge

Optional bulge: number[]

凸度.


# cloneFromDb

Optional cloneFromDb: string

克隆的实体ID来源的图形,如为空,则取DbDocument中from的图形。也可以指定另外的图形

Inherited from: DbCurve.cloneFromDb


# cloneObjectId

Optional cloneObjectId: string

克隆的实体ID,DbDocument有from图形来源字段时有效.

Inherited from: DbCurve.cloneObjectId


# closed

Optional closed: boolean

是否闭合.


# color

Optional color: number

颜色.

Inherited from: DbCurve.color


# colorIndex

Optional colorIndex: number

颜色索引.

Inherited from: DbCurve.colorIndex


# elevation

Optional elevation: number

高程.


# endWidth

Optional endWidth: number[]

终点宽.


# layer

Optional layer: string

图层.

Inherited from: DbCurve.layer


# lineWidth

Optional lineWidth: number

线宽.

Inherited from: DbCurve.lineWidth


# linetype

Optional linetype: string

线型.

Inherited from: DbCurve.linetype


# linetypeScale

Optional linetypeScale: number

线型比例.

Inherited from: DbCurve.linetypeScale


# matrix

Optional matrix: IDbMatrixOp[]

矩阵.

Inherited from: DbCurve.matrix


# points

Optional points: [number, number, undefined | number][]

坐标.


# startWidth

Optional startWidth: number[]

起点宽.


# typename

Optional typename: string

类型.

Inherited from: DbCurve.typename


# visibility

Optional visibility: boolean

可见.

Inherited from: DbCurve.visibility


# xdata

Optional xdata: string

扩展数据.

Inherited from: DbCurve.xdata

vjmap / Exports / DbRadialDimension

# Class: DbRadialDimension

DbRadialDimension 半径标注实体

# Hierarchy

# Table of contents

# Constructors

# Properties

# Constructors

# constructor

+ new DbRadialDimension(prop?: IDbRadialDimension): DbRadialDimension

构造函数

# Parameters
Name Type Default value
prop IDbRadialDimension {}

Returns: DbRadialDimension

Overrides: DbDimension

# Properties

# alpha

Optional alpha: number

透明度. [0-255][0完全透明,255完全不透明]

Inherited from: DbDimension.alpha


# arrowColor

Optional arrowColor: number

箭头颜色.

Inherited from: DbDimension.arrowColor


# arrowSize

Optional arrowSize: number

箭头大小.

Inherited from: DbDimension.arrowSize


# center

Optional center: [number, number, undefined | number][]

中心点.


# chordPoint

Optional chordPoint: [number, number, undefined | number][]

圆上点.


# cloneFromDb

Optional cloneFromDb: string

克隆的实体ID来源的图形,如为空,则取DbDocument中from的图形。也可以指定另外的图形

Inherited from: DbDimension.cloneFromDb


# cloneObjectId

Optional cloneObjectId: string

克隆的实体ID,DbDocument有from图形来源字段时有效.

Inherited from: DbDimension.cloneObjectId


# color

Optional color: number

颜色.

Inherited from: DbDimension.color


# colorIndex

Optional colorIndex: number

颜色索引.

Inherited from: DbDimension.colorIndex


# dimDec

Optional dimDec: number

设置标注主单位显示的小数位位数.

Inherited from: DbDimension.dimDec


# dimRnd

Optional dimRnd: number

所有标注距离舍入到指定值.

Inherited from: DbDimension.dimRnd


# dimScale

Optional dimScale: number

注记比例.

Inherited from: DbDimension.dimScale


# dimStyle

Optional dimStyle: string

标注样式.

Inherited from: DbDimension.dimStyle


# layer

Optional layer: string

图层.

Inherited from: DbDimension.layer


# leaderLength

Optional leaderLength: number

引线长度.


# lineColor

Optional lineColor: number

引线颜色.

Inherited from: DbDimension.lineColor


# lineWidth

Optional lineWidth: number

线宽.

Inherited from: DbDimension.lineWidth


# linetype

Optional linetype: string

线型.

Inherited from: DbDimension.linetype


# linetypeScale

Optional linetypeScale: number

线型比例.

Inherited from: DbDimension.linetypeScale


# matrix

Optional matrix: IDbMatrixOp[]

矩阵.

Inherited from: DbDimension.matrix


# textColor

Optional textColor: number

文本颜色.

Inherited from: DbDimension.textColor


# textHeight

Optional textHeight: number

文字高度.

Inherited from: DbDimension.textHeight


# textPosition

Optional textPosition: [number, number, undefined | number][]

文字位置.

Inherited from: DbDimension.textPosition


# textRotation

Optional textRotation: number

文字旋转角度.

Inherited from: DbDimension.textRotation


# typename

Optional typename: string

类型.

Inherited from: DbDimension.typename


# visibility

Optional visibility: boolean

可见.

Inherited from: DbDimension.visibility


# xdata

Optional xdata: string

扩展数据.

Inherited from: DbDimension.xdata

vjmap / Exports / DbRadialDimensionLarge

# Class: DbRadialDimensionLarge

DbRadialDimensionLarge 半径折线标注实体.

# Hierarchy

# Table of contents

# Constructors

# Properties

# Constructors

# constructor

+ new DbRadialDimensionLarge(prop?: IDbRadialDimensionLarge): DbRadialDimensionLarge

构造函数

# Parameters
Name Type Default value
prop IDbRadialDimensionLarge {}

Returns: DbRadialDimensionLarge

Overrides: DbDimension

# Properties

# alpha

Optional alpha: number

透明度. [0-255][0完全透明,255完全不透明]

Inherited from: DbDimension.alpha


# arrowColor

Optional arrowColor: number

箭头颜色.

Inherited from: DbDimension.arrowColor


# arrowSize

Optional arrowSize: number

箭头大小.

Inherited from: DbDimension.arrowSize


# center

Optional center: [number, number, undefined | number][]

中心点.


# chordPoint

Optional chordPoint: [number, number, undefined | number][]

圆上点.


# cloneFromDb

Optional cloneFromDb: string

克隆的实体ID来源的图形,如为空,则取DbDocument中from的图形。也可以指定另外的图形

Inherited from: DbDimension.cloneFromDb


# cloneObjectId

Optional cloneObjectId: string

克隆的实体ID,DbDocument有from图形来源字段时有效.

Inherited from: DbDimension.cloneObjectId


# color

Optional color: number

颜色.

Inherited from: DbDimension.color


# colorIndex

Optional colorIndex: number

颜色索引.

Inherited from: DbDimension.colorIndex


# dimDec

Optional dimDec: number

设置标注主单位显示的小数位位数.

Inherited from: DbDimension.dimDec


# dimRnd

Optional dimRnd: number

所有标注距离舍入到指定值.

Inherited from: DbDimension.dimRnd


# dimScale

Optional dimScale: number

注记比例.

Inherited from: DbDimension.dimScale


# dimStyle

Optional dimStyle: string

标注样式.

Inherited from: DbDimension.dimStyle


# jogAngle

Optional jogAngle: number

设置此Dimension实体的折角。.


# jogPoint

Optional jogPoint: [number, number, undefined | number][]

设置此Dimension实体的折角点。.


# layer

Optional layer: string

图层.

Inherited from: DbDimension.layer


# lineColor

Optional lineColor: number

引线颜色.

Inherited from: DbDimension.lineColor


# lineWidth

Optional lineWidth: number

线宽.

Inherited from: DbDimension.lineWidth


# linetype

Optional linetype: string

线型.

Inherited from: DbDimension.linetype


# linetypeScale

Optional linetypeScale: number

线型比例.

Inherited from: DbDimension.linetypeScale


# matrix

Optional matrix: IDbMatrixOp[]

矩阵.

Inherited from: DbDimension.matrix


# overrideCenter

Optional overrideCenter: [number, number, undefined | number][]

设置由该Dimension实体确定尺寸的弧的WCS覆盖中心。.


# textColor

Optional textColor: number

文本颜色.

Inherited from: DbDimension.textColor


# textHeight

Optional textHeight: number

文字高度.

Inherited from: DbDimension.textHeight


# textPosition

Optional textPosition: [number, number, undefined | number][]

文字位置.

Inherited from: DbDimension.textPosition


# textRotation

Optional textRotation: number

文字旋转角度.

Inherited from: DbDimension.textRotation


# typename

Optional typename: string

类型.

Inherited from: DbDimension.typename


# visibility

Optional visibility: boolean

可见.

Inherited from: DbDimension.visibility


# xdata

Optional xdata: string

扩展数据.

Inherited from: DbDimension.xdata

vjmap / Exports / DbRasterImage

# Class: DbRasterImage

DbRasterImage 栅格图像实体.

# Hierarchy

# Table of contents

# Constructors

# Properties

# Constructors

# constructor

+ new DbRasterImage(prop?: IDbRasterImage): DbRasterImage

构造函数

# Parameters
Name Type Default value
prop IDbRasterImage {}

Returns: DbRasterImage

Overrides: DbEntity

# Properties

# alpha

Optional alpha: number

透明度. [0-255][0完全透明,255完全不透明]

Inherited from: DbEntity.alpha


# brightness

Optional brightness: number

明亮度 [0.0 .. 100.0]


# cloneFromDb

Optional cloneFromDb: string

克隆的实体ID来源的图形,如为空,则取DbDocument中from的图形。也可以指定另外的图形

Inherited from: DbEntity.cloneFromDb


# cloneObjectId

Optional cloneObjectId: string

克隆的实体ID,DbDocument有from图形来源字段时有效.

Inherited from: DbEntity.cloneObjectId


# color

Optional color: number

颜色.

Inherited from: DbEntity.color


# colorIndex

Optional colorIndex: number

颜色索引.

Inherited from: DbEntity.colorIndex


# heightRatio

Optional heightRatio: number

高比例..


# imageDisplayOptClip

Optional imageDisplayOptClip: boolean

是否裁剪.


# imageDisplayOptShow

Optional imageDisplayOptShow: boolean

是否显示.


# imageDisplayOptShowUnAligned

Optional imageDisplayOptShowUnAligned: boolean

是否对齐.


# imageDisplayOptTransparent

Optional imageDisplayOptTransparent: boolean

是否透明.


# layer

Optional layer: string

图层.

Inherited from: DbEntity.layer


# lineWidth

Optional lineWidth: number

线宽.

Inherited from: DbEntity.lineWidth


# linetype

Optional linetype: string

线型.

Inherited from: DbEntity.linetype


# linetypeScale

Optional linetypeScale: number

线型比例.

Inherited from: DbEntity.linetypeScale


# matrix

Optional matrix: IDbMatrixOp[]

矩阵.

Inherited from: DbEntity.matrix


# pixelHeight

Optional pixelHeight: number

源图片高.


# pixelWidth

Optional pixelWidth: number

源图片宽.


# position

Optional position: [number, number, undefined | number]

位置.


# sourceHttpUrl

Optional sourceHttpUrl: string

图片url地址.


# typename

Optional typename: string

类型.

Inherited from: DbEntity.typename


# units

Optional units: kNone | kMillimeter | kCentimeter | kMeter | kKilometer | kInch | kFoot | kYard | kMile | kMicroinches | kMils | kAngstroms | kNanometers | kMicrons | kDecimeters | kDekameters | kHectometers | kGigameters | kAstronomical | kLightYears | kParsecs

单位.


# visibility

Optional visibility: boolean

可见.

Inherited from: DbEntity.visibility


# widthRatio

Optional widthRatio: number

宽比例.


# xPelsPerUnit

Optional xPelsPerUnit: number

x轴每像素代表长度.


# xdata

Optional xdata: string

扩展数据.

Inherited from: DbEntity.xdata


# yPelsPerUnit

Optional yPelsPerUnit: number

y轴每像素代表长度.

vjmap / Exports / DbRotatedDimension

# Class: DbRotatedDimension

DbRotatedDimension 转角标注实体.

# Hierarchy

# Table of contents

# Constructors

# Properties

# Constructors

# constructor

+ new DbRotatedDimension(prop?: IDbRotatedDimension): DbRotatedDimension

构造函数

# Parameters
Name Type Default value
prop IDbRotatedDimension {}

Returns: DbRotatedDimension

Overrides: DbDimension

# Properties

# alpha

Optional alpha: number

透明度. [0-255][0完全透明,255完全不透明]

Inherited from: DbDimension.alpha


# arrowColor

Optional arrowColor: number

箭头颜色.

Inherited from: DbDimension.arrowColor


# arrowSize

Optional arrowSize: number

箭头大小.

Inherited from: DbDimension.arrowSize


# cloneFromDb

Optional cloneFromDb: string

克隆的实体ID来源的图形,如为空,则取DbDocument中from的图形。也可以指定另外的图形

Inherited from: DbDimension.cloneFromDb


# cloneObjectId

Optional cloneObjectId: string

克隆的实体ID,DbDocument有from图形来源字段时有效.

Inherited from: DbDimension.cloneObjectId


# color

Optional color: number

颜色.

Inherited from: DbDimension.color


# colorIndex

Optional colorIndex: number

颜色索引.

Inherited from: DbDimension.colorIndex


# dimDec

Optional dimDec: number

设置标注主单位显示的小数位位数.

Inherited from: DbDimension.dimDec


# dimLinePoint

Optional dimLinePoint: [number, number, undefined | number][]

设置定义此dimension实体尺寸线位置的WCS点。.


# dimRnd

Optional dimRnd: number

所有标注距离舍入到指定值.

Inherited from: DbDimension.dimRnd


# dimScale

Optional dimScale: number

注记比例.

Inherited from: DbDimension.dimScale


# dimStyle

Optional dimStyle: string

标注样式.

Inherited from: DbDimension.dimStyle


# layer

Optional layer: string

图层.

Inherited from: DbDimension.layer


# lineColor

Optional lineColor: number

引线颜色.

Inherited from: DbDimension.lineColor


# lineWidth

Optional lineWidth: number

线宽.

Inherited from: DbDimension.lineWidth


# linetype

Optional linetype: string

线型.

Inherited from: DbDimension.linetype


# linetypeScale

Optional linetypeScale: number

线型比例.

Inherited from: DbDimension.linetypeScale


# matrix

Optional matrix: IDbMatrixOp[]

矩阵.

Inherited from: DbDimension.matrix


# textColor

Optional textColor: number

文本颜色.

Inherited from: DbDimension.textColor


# textHeight

Optional textHeight: number

文字高度.

Inherited from: DbDimension.textHeight


# textPosition

Optional textPosition: [number, number, undefined | number][]

文字位置.

Inherited from: DbDimension.textPosition


# textRotation

Optional textRotation: number

文字旋转角度.

Inherited from: DbDimension.textRotation


# typename

Optional typename: string

类型.

Inherited from: DbDimension.typename


# visibility

Optional visibility: boolean

可见.

Inherited from: DbDimension.visibility


# xLine1Point

Optional xLine1Point: [number, number, undefined | number][]

线上点1.


# xLine2Point

Optional xLine2Point: [number, number, undefined | number][]

线上点2.


# xdata

Optional xdata: string

扩展数据.

Inherited from: DbDimension.xdata

vjmap / Exports / DbShape

# Class: DbShape

DbShape 型实体

# Hierarchy

# Table of contents

# Constructors

# Properties

# Constructors

# constructor

+ new DbShape(prop?: IDbShape): DbShape

构造函数

# Parameters
Name Type Default value
prop IDbShape {}

Returns: DbShape

Overrides: DbEntity

# Properties

# alpha

Optional alpha: number

透明度. [0-255][0完全透明,255完全不透明]

Inherited from: DbEntity.alpha


# cloneFromDb

Optional cloneFromDb: string

克隆的实体ID来源的图形,如为空,则取DbDocument中from的图形。也可以指定另外的图形

Inherited from: DbEntity.cloneFromDb


# cloneObjectId

Optional cloneObjectId: string

克隆的实体ID,DbDocument有from图形来源字段时有效.

Inherited from: DbEntity.cloneObjectId


# color

Optional color: number

颜色.

Inherited from: DbEntity.color


# colorIndex

Optional colorIndex: number

颜色索引.

Inherited from: DbEntity.colorIndex


# layer

Optional layer: string

图层.

Inherited from: DbEntity.layer


# lineWidth

Optional lineWidth: number

线宽.

Inherited from: DbEntity.lineWidth


# linetype

Optional linetype: string

线型.

Inherited from: DbEntity.linetype


# linetypeScale

Optional linetypeScale: number

线型比例.

Inherited from: DbEntity.linetypeScale


# matrix

Optional matrix: IDbMatrixOp[]

矩阵.

Inherited from: DbEntity.matrix


# name

Optional name: string

型名称.


# normal

Optional normal: [number, number, undefined | number]

法向量.


# position

Optional position: [number, number, undefined | number]

位置.


# rotation

Optional rotation: number

旋转角度.


# size

Optional size: number

大小.


# typename

Optional typename: string

类型.

Inherited from: DbEntity.typename


# visibility

Optional visibility: boolean

可见.

Inherited from: DbEntity.visibility


# xdata

Optional xdata: string

扩展数据.

Inherited from: DbEntity.xdata

vjmap / Exports / DbSpline

# Class: DbSpline

DbSpline 样条曲线实体.

# Hierarchy

# Table of contents

# Constructors

# Properties

# Constructors

# constructor

+ new DbSpline(prop?: IDbSpline): DbSpline

构造函数

# Parameters
Name Type Default value
prop IDbSpline {}

Returns: DbSpline

Overrides: DbCurve

# Properties

# alpha

Optional alpha: number

透明度. [0-255][0完全透明,255完全不透明]

Inherited from: DbCurve.alpha


# cloneFromDb

Optional cloneFromDb: string

克隆的实体ID来源的图形,如为空,则取DbDocument中from的图形。也可以指定另外的图形

Inherited from: DbCurve.cloneFromDb


# cloneObjectId

Optional cloneObjectId: string

克隆的实体ID,DbDocument有from图形来源字段时有效.

Inherited from: DbCurve.cloneObjectId


# color

Optional color: number

颜色.

Inherited from: DbCurve.color


# colorIndex

Optional colorIndex: number

颜色索引.

Inherited from: DbCurve.colorIndex


# controlPoints

Optional controlPoints: [number, number, undefined | number][]

控制点.


# degree

Optional degree: number

Increased the degree of this spline to the specified value.


# fitPoints

Optional fitPoints: [number, number, undefined | number][]

拟合点.


# fitTol

Optional fitTol: number

the curve fitting tolerance for this Spline entity.


# layer

Optional layer: string

图层.

Inherited from: DbCurve.layer


# lineWidth

Optional lineWidth: number

线宽.

Inherited from: DbCurve.lineWidth


# linetype

Optional linetype: string

线型.

Inherited from: DbCurve.linetype


# linetypeScale

Optional linetypeScale: number

线型比例.

Inherited from: DbCurve.linetypeScale


# matrix

Optional matrix: IDbMatrixOp[]

矩阵.

Inherited from: DbCurve.matrix


# typename

Optional typename: string

类型.

Inherited from: DbCurve.typename


# visibility

Optional visibility: boolean

可见.

Inherited from: DbCurve.visibility


# xdata

Optional xdata: string

扩展数据.

Inherited from: DbCurve.xdata

vjmap / Exports / DbTable

# Class: DbTable

DbBlockReference 块参照实体.

# Hierarchy

# Table of contents

# Constructors

# Properties

# Constructors

# constructor

+ new DbTable(prop?: IDbTable): DbTable

构造函数

# Parameters
Name Type Default value
prop IDbTable {}

Returns: DbTable

Overrides: DbBlockReference

# Properties

# alignment

Optional alignment: kTopLeft | kTopCenter | kTopRight | kMiddleLeft | kMiddleCenter | kMiddleRight | kBottomLeft | kBottomCenter | kBottomRight

单元格对齐方式(所有单元格).


# alpha

Optional alpha: number

透明度. [0-255][0完全透明,255完全不透明]

Inherited from: DbBlockReference.alpha


# attribute

Optional attribute: Record<string, string | number | DbText>

属性字段值

Inherited from: DbBlockReference.attribute


# backgroundColor

Optional backgroundColor: number

背景颜色(所有单元格).


# blockname

Optional blockname: string

块名称.

Inherited from: DbBlockReference.blockname


# cloneFromDb

Optional cloneFromDb: string

克隆的实体ID来源的图形,如为空,则取DbDocument中from的图形。也可以指定另外的图形

Inherited from: DbBlockReference.cloneFromDb


# cloneObjectId

Optional cloneObjectId: string

克隆的实体ID,DbDocument有from图形来源字段时有效.

Inherited from: DbBlockReference.cloneObjectId


# color

Optional color: number

颜色.

Inherited from: DbBlockReference.color


# colorIndex

Optional colorIndex: number

颜色索引.

Inherited from: DbBlockReference.colorIndex


# columnWidth

Optional columnWidth: number

列宽.


# contentColor

Optional contentColor: number

文字颜色(所有单元格).


# data

Optional data: (string | { alignment: TableCellAlignment ; backgroundColor: number ; contentColor: number ; gridColor: number ; gridVisibility: boolean ; text: string ; textHeight: number })[][]

数据.


# directionBottomToTop

Optional directionBottomToTop: boolean

表格方向是否从上至上.


# disableTitle

Optional disableTitle: boolean

是否禁用标题.


# gridColor

Optional gridColor: number

网格线颜色(所有单元格).


# gridVisibility

Optional gridVisibility: [boolean, number, number]

显示网格线.第二个参数(kHorzTop(1), kHorzInside(2), kHorzBottom(4), kVertLeft(8), kVertInside(16), kVertRight(32); 第三个参数 kTitleRow(1), kHeaderRow(2), kDataRow(4)


# horzCellMargin

Optional horzCellMargin: number

水平方向单元格边距.


# layer

Optional layer: string

图层.

Inherited from: DbBlockReference.layer


# lineWidth

Optional lineWidth: number

线宽.

Inherited from: DbBlockReference.lineWidth


# linetype

Optional linetype: string

线型.

Inherited from: DbBlockReference.linetype


# linetypeScale

Optional linetypeScale: number

线型比例.

Inherited from: DbBlockReference.linetypeScale


# matrix

Optional matrix: IDbMatrixOp[]

矩阵.

Inherited from: DbBlockReference.matrix


# mergeCells

Optional mergeCells: [number, number, number, number][]

需要合并的单元格 [[minRow, maxRow,minColumn, maxColumn], ...]


# normal

Optional normal: [number, number, undefined | number]

法向量.

Inherited from: DbBlockReference.normal


# numColumns

Optional numColumns: number

表格列数.


# numRows

Optional numRows: number

表格行数.


# position

Optional position: [number, number, undefined | number]

坐标.

Inherited from: DbBlockReference.position


# ref

Optional ref: string

参考外部图形,形式为 mapid/version,如 exam/v1.

Inherited from: DbBlockReference.ref


# rotation

Optional rotation: number

旋转角度.

Inherited from: DbBlockReference.rotation


# rowHeight

Optional rowHeight: number

行高.


# scaleFactors

Optional scaleFactors: [number, number, undefined | number]

缩放因子. [x方向,y方向,z方向]

Inherited from: DbBlockReference.scaleFactors


# tableStyleName

Optional tableStyleName: string

表样式名称.


# textHeight

Optional textHeight: number

文字高度(所有单元格).


# typename

Optional typename: string

类型.

Inherited from: DbBlockReference.typename


# vertCellMargin

Optional vertCellMargin: number

竖直方向单元格边距.


# visibility

Optional visibility: boolean

可见.

Inherited from: DbBlockReference.visibility


# xdata

Optional xdata: string

扩展数据.

Inherited from: DbBlockReference.xdata

vjmap / Exports / DbText

# Class: DbText

DbText 文本实体.

# Hierarchy

# Table of contents

# Constructors

# Properties

# Constructors

# constructor

+ new DbText(prop?: IDbText): DbText

构造函数

# Parameters
Name Type Default value
prop IDbText {}

Returns: DbText

Overrides: DbEntity

# Properties

# alpha

Optional alpha: number

透明度. [0-255][0完全透明,255完全不透明]

Inherited from: DbEntity.alpha


# cloneFromDb

Optional cloneFromDb: string

克隆的实体ID来源的图形,如为空,则取DbDocument中from的图形。也可以指定另外的图形

Inherited from: DbEntity.cloneFromDb


# cloneObjectId

Optional cloneObjectId: string

克隆的实体ID,DbDocument有from图形来源字段时有效.

Inherited from: DbEntity.cloneObjectId


# color

Optional color: number

颜色.

Inherited from: DbEntity.color


# colorIndex

Optional colorIndex: number

颜色索引.

Inherited from: DbEntity.colorIndex


# contents

Optional contents: string

文本内容, 同text.


# height

Optional height: number

高.


# horizontalMode

Optional horizontalMode: kTextLeft | kTextCenter | kTextRight | kTextAlign | kTextMid | kTextFit

水平模式.


# layer

Optional layer: string

图层.

Inherited from: DbEntity.layer


# lineWidth

Optional lineWidth: number

线宽.

Inherited from: DbEntity.lineWidth


# linetype

Optional linetype: string

线型.

Inherited from: DbEntity.linetype


# linetypeScale

Optional linetypeScale: number

线型比例.

Inherited from: DbEntity.linetypeScale


# matrix

Optional matrix: IDbMatrixOp[]

矩阵.

Inherited from: DbEntity.matrix


# position

Optional position: [number, number, undefined | number]

位置.


# rotation

Optional rotation: number

旋转角度.


# text

Optional text: string

文本内容, 同contents.


# textStyle

Optional textStyle: string

文本样式.


# typename

Optional typename: string

类型.

Inherited from: DbEntity.typename


# verticalMode

Optional verticalMode: kTextBase | kTextBottom | kTextVertMid | kTextTop

垂直模式.


# visibility

Optional visibility: boolean

可见.

Inherited from: DbEntity.visibility


# xdata

Optional xdata: string

扩展数据.

Inherited from: DbEntity.xdata

vjmap / Exports / DbTextStyle

# Class: DbTextStyle

DbTextStyle 文字样式.

# Table of contents

# Constructors

# Properties

# Constructors

# constructor

+ new DbTextStyle(prop?: IDbTextStyle): DbTextStyle

构造函数

# Parameters
Name Type Default value
prop IDbTextStyle {}

Returns: DbTextStyle

# Properties

# bold

Optional bold: boolean

是否粗体 .


# charset

Optional charset: number

字符集标识符,缺省0 .


# fileName

Optional fileName: string

字体文件名 .


# isShapeFile

Optional isShapeFile: boolean

是否型文件.


# italic

Optional italic: boolean

是否斜体 .


# name

Optional name: string

文字样式名称.


# obliquingAngle

Optional obliquingAngle: number

设置字母的倾斜角度。正角度顺时针(向右)倾斜字母。负值使字母逆时针倾斜(向左)。通过将值2*PI相加,将负值转换为其正当量。 默认情况下,初始值为0.0.


# pitchAndFamily

Optional pitchAndFamily: number

字符间距和族,缺省34 .


# priorSize

Optional priorSize: number

设置最近使用此文本样式创建的文本的先前大小 .


# textSize

Optional textSize: number

文本大小 .


# typeFace

Optional typeFace: string

字体 .


# xScale

Optional xScale: number

x轴缩放 .

vjmap / Exports / DbWipeout

# Class: DbWipeout

DbWipeout 遮罩实体.

# Hierarchy

# Table of contents

# Constructors

# Properties

# Constructors

# constructor

+ new DbWipeout(prop?: IDbWipeout): DbWipeout

构造函数

# Parameters
Name Type Default value
prop IDbWipeout {}

Returns: DbWipeout

Overrides: DbRasterImage

# Properties

# alpha

Optional alpha: number

透明度. [0-255][0完全透明,255完全不透明]

Inherited from: DbRasterImage.alpha


# brightness

Optional brightness: number

明亮度 [0.0 .. 100.0]

Inherited from: DbRasterImage.brightness


# cloneFromDb

Optional cloneFromDb: string

克隆的实体ID来源的图形,如为空,则取DbDocument中from的图形。也可以指定另外的图形

Inherited from: DbRasterImage.cloneFromDb


# cloneObjectId

Optional cloneObjectId: string

克隆的实体ID,DbDocument有from图形来源字段时有效.

Inherited from: DbRasterImage.cloneObjectId


# color

Optional color: number

颜色.

Inherited from: DbRasterImage.color


# colorIndex

Optional colorIndex: number

颜色索引.

Inherited from: DbRasterImage.colorIndex


# heightRatio

Optional heightRatio: number

高比例..

Inherited from: DbRasterImage.heightRatio


# imageDisplayOptClip

Optional imageDisplayOptClip: boolean

是否裁剪.

Inherited from: DbRasterImage.imageDisplayOptClip


# imageDisplayOptShow

Optional imageDisplayOptShow: boolean

是否显示.

Inherited from: DbRasterImage.imageDisplayOptShow


# imageDisplayOptShowUnAligned

Optional imageDisplayOptShowUnAligned: boolean

是否对齐.

Inherited from: DbRasterImage.imageDisplayOptShowUnAligned


# imageDisplayOptTransparent

Optional imageDisplayOptTransparent: boolean

是否透明.

Inherited from: DbRasterImage.imageDisplayOptTransparent


# layer

Optional layer: string

图层.

Inherited from: DbRasterImage.layer


# lineWidth

Optional lineWidth: number

线宽.

Inherited from: DbRasterImage.lineWidth


# linetype

Optional linetype: string

线型.

Inherited from: DbRasterImage.linetype


# linetypeScale

Optional linetypeScale: number

线型比例.

Inherited from: DbRasterImage.linetypeScale


# matrix

Optional matrix: IDbMatrixOp[]

矩阵.

Inherited from: DbRasterImage.matrix


# pixelHeight

Optional pixelHeight: number

源图片高.

Inherited from: DbRasterImage.pixelHeight


# pixelWidth

Optional pixelWidth: number

源图片宽.

Inherited from: DbRasterImage.pixelWidth


# points

Optional points: [number, number, undefined | number][]

坐标.


# position

Optional position: [number, number, undefined | number]

位置.

Inherited from: DbRasterImage.position


# sourceHttpUrl

Optional sourceHttpUrl: string

图片url地址.

Inherited from: DbRasterImage.sourceHttpUrl


# typename

Optional typename: string

类型.

Inherited from: DbRasterImage.typename


# units

Optional units: kNone | kMillimeter | kCentimeter | kMeter | kKilometer | kInch | kFoot | kYard | kMile | kMicroinches | kMils | kAngstroms | kNanometers | kMicrons | kDecimeters | kDekameters | kHectometers | kGigameters | kAstronomical | kLightYears | kParsecs

单位.

Inherited from: DbRasterImage.units


# visibility

Optional visibility: boolean

可见.

Inherited from: DbRasterImage.visibility


# widthRatio

Optional widthRatio: number

宽比例.

Inherited from: DbRasterImage.widthRatio


# xPelsPerUnit

Optional xPelsPerUnit: number

x轴每像素代表长度.

Inherited from: DbRasterImage.xPelsPerUnit


# xdata

Optional xdata: string

扩展数据.

Inherited from: DbRasterImage.xdata


# yPelsPerUnit

Optional yPelsPerUnit: number

y轴每像素代表长度.

Inherited from: DbRasterImage.yPelsPerUnit

vjmap / Exports / DeckLayer

# Class: DeckLayer

deck.gl图层.

# Hierarchy

  • Evented

    DeckLayer

# Implements

  • CustomLayerInterface

# Table of contents

# Constructors

# Properties

# Methods

# Constructors

# constructor

+ new DeckLayer(props: any): DeckLayer

# Parameters
Name Type
props any

Returns: DeckLayer

Overrides: Evented.constructor

# Properties

# deckNs

deckNs: object


# id

id: string

Implementation of: CustomLayerInterface.id


# layer

layer: object


# renderingMode

Optional renderingMode: "2d" | "3d"

Implementation of: CustomLayerInterface.renderingMode


# type

type: "custom"

Implementation of: CustomLayerInterface.type

# Methods

# onAdd

onAdd(map: any, gl: any): void

# Parameters
Name Type
map any
gl any

Returns: void

Implementation of: CustomLayerInterface.onAdd


# onRemove

onRemove(): void

Returns: void

Implementation of: CustomLayerInterface.onRemove


# render

render(gl: any, matrix: any): void

# Parameters
Name Type
gl any
matrix any

Returns: void

Implementation of: CustomLayerInterface.render


# setProps

setProps(props: any): void

# Parameters
Name Type
props any

Returns: void

vjmap / Exports / default / AnimateMarkerLayer

# Class: AnimateMarkerLayer

default.AnimateMarkerLayer

动画标记图层.

# Hierarchy

  • Evented

    AnimateMarkerLayer

# Table of contents

# Constructors

# Methods

# Constructors

# constructor

+ new AnimateMarkerLayer(features: FeatureCollection<Geometry | GeometryCollection, Properties>, options?: AnimateMarkerLayerOption): AnimateMarkerLayer

# Parameters
Name Type
features FeatureCollection<Geometry | GeometryCollection, Properties>
options? AnimateMarkerLayerOption

Returns: AnimateMarkerLayer

Overrides: Evented.constructor

# Methods

# _getMarkerElement

_getMarkerElement(): void

Returns: void


# addTo

addTo(map: Map): void

# Parameters
Name Type
map Map

Returns: void


# clearMarkerLayer

clearMarkerLayer(): void

Returns: void


# getMarkers

getMarkers(): Marker[]

Returns: Marker[]


# remove

remove(): void

Returns: void


# render

render(): void

Returns: void


# setType

setType(type: AnimateMarkerType, options?: AnimateMarkerLayerOption): void

# Parameters
Name Type
type AnimateMarkerType
options? AnimateMarkerLayerOption

Returns: void

vjmap / Exports / default / BackgroundLayer

# Class: BackgroundLayer

default.BackgroundLayer

创建一个背景图层.

# Hierarchy

# Table of contents

# Constructors

# Properties

# Methods

# Constructors

# constructor

+ new BackgroundLayer(options: BackgroundLayerOptions): BackgroundLayer

# Parameters
Name Type
options BackgroundLayerOptions

Returns: BackgroundLayer

Overrides: OverlayLayerBase

# Properties

# _map

Optional _map: Map

Inherited from: OverlayLayerBase._map


# layerId

Optional layerId: string

Inherited from: OverlayLayerBase.layerId


# options

options: BackgroundLayerOptions


# sourceId

Optional sourceId: string

Inherited from: OverlayLayerBase.sourceId

# Methods

# addTo

addTo(map: Map, beforeId?: string): void

# Parameters
Name Type
map Map
beforeId? string

Returns: void

Overrides: OverlayLayerBase


# clickLayer

clickLayer(cb: any): any

每当单击这些图层中的要素时都会触发回调。

# Parameters
Name Type Description
cb any Callback that receives event with .features property

Returns: any

A function that removes the handler.

Inherited from: OverlayLayerBase


# clickPopup

clickPopup(htmlFunc: (arg0: {}) => void, popupOptions?: PopupOptions): any

每当单击这些图层中的要素时都会显示一个弹出窗口。

example clickPopup(f => <h3>${f.properties.Name}</h3> ${f.properties.Description}, { maxWidth: 500 });

# Parameters
Name Type Description
htmlFunc (arg0: {}) => void Function that receives feature and popup, returns HTML.
popupOptions? PopupOptions Options passed to Popup() to customise popup.

Returns: any

A function that removes the handler.

Inherited from: OverlayLayerBase


# getBackgroundColor

getBackgroundColor(): PropertyValueSpecificationEx<string>

Returns: PropertyValueSpecificationEx<string>


# getBackgroundOpacity

getBackgroundOpacity(): PropertyValueSpecificationEx<number>

Returns: PropertyValueSpecificationEx<number>


# getBackgroundPattern

getBackgroundPattern(): PropertyValueSpecificationEx<string>

Returns: PropertyValueSpecificationEx<string>


# getData

getData(): undefined | Feature<Geometry | GeometryCollection, Properties> | FeatureCollection<Geometry | GeometryCollection, Properties> | Geometry | GeometryCollection

获取数据源的数据

Returns: undefined | Feature<Geometry | GeometryCollection, Properties> | FeatureCollection<Geometry | GeometryCollection, Properties> | Geometry | GeometryCollection

Inherited from: OverlayLayerBase


# getLayerId

getLayerId(): undefined | string

获取图层ID

Returns: undefined | string

Inherited from: OverlayLayerBase


# getLayerStyle

getLayerStyle(): LayerSpecification

根据样式规范,获取给定图层 ID 的图层定义。

Returns: LayerSpecification

Inherited from: OverlayLayerBase


# getSourceId

getSourceId(): undefined | string

获取数据源ID

Returns: undefined | string

Inherited from: OverlayLayerBase


# hide

hide(): void

使给定的图层不可见。

Returns: void

Inherited from: OverlayLayerBase


# hoverFeatureState

hoverFeatureState(enterCb?: (arg0: {}) => void, leaveCb?: (arg0: {}) => void): void

每当将鼠标悬停在这些图层中的某个特征上时,更新连接源 [s] 中特征的特征状态。

# Parameters
Name Type
enterCb? (arg0: {}) => void
leaveCb? (arg0: {}) => void

Returns: void

Inherited from: OverlayLayerBase


# hoverLayer

hoverLayer(cb: any): any

当鼠标悬停在这些图层中的要素上时触发回调。

# Parameters
Name Type
cb any

Returns: any

A function to remove the handler.

Inherited from: OverlayLayerBase


# hoverPointer

hoverPointer(): void

每当鼠标悬停在这些图层上时,将地图的光标设置为“指针”。

Returns: void

A function to remove the handler.

Inherited from: OverlayLayerBase


# hoverPopup

hoverPopup(htmlFunc: any, popupOptions?: PopupOptions): any

将鼠标悬停在这些图层中的某个要素上时,会显示一个弹出窗口。

example hoverPopup(f => <h3>${f.properties.Name}</h3> ${f.properties.Description}, { anchor: 'left' });

# Parameters
Name Type Description
htmlFunc any Function that receives feature and popup, returns HTML.
popupOptions? PopupOptions Options passed to Popup() to customise popup.

Returns: any

Inherited from: OverlayLayerBase


# remove

remove(): void

Returns: void

Inherited from: OverlayLayerBase


# setBackgroundColor

setBackgroundColor(value: PropertyValueSpecificationEx<string>): BackgroundLayer

# Parameters
Name Type
value PropertyValueSpecificationEx<string>

Returns: BackgroundLayer


# setBackgroundOpacity

setBackgroundOpacity(value: PropertyValueSpecificationEx<number>): BackgroundLayer

# Parameters
Name Type
value PropertyValueSpecificationEx<number>

Returns: BackgroundLayer


# setBackgroundPattern

setBackgroundPattern(value: PropertyValueSpecificationEx<string>): BackgroundLayer

# Parameters
Name Type
value PropertyValueSpecificationEx<string>

Returns: BackgroundLayer


# setFilter

setFilter(filter: FilterSpecification): void

替换一个图层的过滤器。

example setFilter(['==','level','0']]);

# Parameters
Name Type Description
filter FilterSpecification New filter to set.

Returns: void

Inherited from: OverlayLayerBase


# setLayerStyle

setLayerStyle(style: any): void

设置图层样式

# Parameters
Name Type
style any

Returns: void

Inherited from: OverlayLayerBase


# setProperty

setProperty(prop: string | object, value?: any): void

在一个或多个图层上设置绘制或布局属性。

example setProperty('fillOpacity', 0.5)

# Parameters
Name Type
prop string | object
value? any

Returns: void

Inherited from: OverlayLayerBase


# show

show(): void

使给定的图层可见。

Returns: void

Inherited from: OverlayLayerBase


# toggle

toggle(state: boolean): boolean

根据参数使给定的图层隐藏或可见。

# Parameters
Name Type Description
state boolean True for visible, false for hidden.

Returns: boolean

Inherited from: OverlayLayerBase

vjmap / Exports / default / BreathingApertureMarker

# Class: BreathingApertureMarker

default.BreathingApertureMarker

呼吸的光圈.

# Hierarchy

  • MarkerBase

    BreathingApertureMarker

# Table of contents

# Constructors

# Properties

# Methods

# Constructors

# constructor

+ new BreathingApertureMarker(features: FeatureCollection<Geometry | GeometryCollection, Properties> | { lngLat: LngLatLike ; text?: string }, options?: AnimateMarkerLayerOption): BreathingApertureMarker

# Parameters
Name Type
features FeatureCollection<Geometry | GeometryCollection, Properties> | { lngLat: LngLatLike ; text?: string }
options? AnimateMarkerLayerOption

Returns: BreathingApertureMarker

Overrides: MarkerBase.constructor

# Properties

# features

Protected features: FeatureCollection<Geometry | GeometryCollection, Properties> | { lngLat: LngLatLike ; text?: string }

Inherited from: MarkerBase.features


# markersElement

Protected markersElement: any

Inherited from: MarkerBase.markersElement


# options

Protected options: AnimateMarkerLayerOption

Inherited from: MarkerBase.options

# Methods

# _createMarker

_createMarker(): void

Returns: void


# _getColorWithOpacity

Protected _getColorWithOpacity(color: string, opacity: string | number): string

# Parameters
Name Type
color string
opacity string | number

Returns: string

Inherited from: MarkerBase._getColorWithOpacity


# _getTextContainer

Protected _getTextContainer(feature: any, className: string): null | HTMLDivElement

# Parameters
Name Type
feature any
className string

Returns: null | HTMLDivElement

Inherited from: MarkerBase._getTextContainer


# createMarker

createMarker(options?: createMarkerOptions, index?: number): Marker

# Parameters
Name Type
options? createMarkerOptions
index? number

Returns: Marker

Inherited from: MarkerBase.createMarker


# getColorWithOpacity

getColorWithOpacity(color: string, opacity: string | number): string

# Parameters
Name Type
color string
opacity string | number

Returns: string

Inherited from: MarkerBase.getColorWithOpacity


# getElement

getElement(index?: number): any

# Parameters
Name Type
index? number

Returns: any

Inherited from: MarkerBase.getElement


# getLngLat

getLngLat(index?: number): any

# Parameters
Name Type
index? number

Returns: any

Inherited from: MarkerBase.getLngLat


# getMarkersElement

getMarkersElement(): any

Returns: any

Inherited from: MarkerBase.getMarkersElement


# set16ToRgb

set16ToRgb(str: string): string

# Parameters
Name Type
str string

Returns: string

Inherited from: MarkerBase.set16ToRgb


# setDotSize

setDotSize(size: number, index?: number): void

# Parameters
Name Type
size number
index? number

Returns: void


# setFeatures

setFeatures(features: FeatureCollection<Geometry | GeometryCollection, Properties>): void

# Parameters
Name Type
features FeatureCollection<Geometry | GeometryCollection, Properties>

Returns: void

Inherited from: MarkerBase.setFeatures


# setMarkersColors

setMarkersColors(colors: string[], index?: number): void

# Parameters
Name Type
colors string[]
index? number

Returns: void


# setMarkersText

setMarkersText(text: string, index?: number): void

# Parameters
Name Type
text string
index? number

Returns: void

Inherited from: MarkerBase.setMarkersText


# setMarkersTextColor

setMarkersTextColor(textColor: string, index?: number): void

# Parameters
Name Type
textColor string
index? number

Returns: void

Inherited from: MarkerBase.setMarkersTextColor


# setMarkersTextField

setMarkersTextField(textField: string): void

# Parameters
Name Type
textField string

Returns: void

Inherited from: MarkerBase.setMarkersTextField


# setMarkersTextFontSize

setMarkersTextFontSize(textFontSize: number, index?: number): void

# Parameters
Name Type
textFontSize number
index? number

Returns: void

Inherited from: MarkerBase.setMarkersTextFontSize


# setMarkersWidth

setMarkersWidth(width: number, index?: number): void

# Parameters
Name Type
width number
index? number

Returns: void

vjmap / Exports / default / ButtonGroupControl

# Class: ButtonGroupControl

default.ButtonGroupControl

# Table of contents

# Constructors

# Methods

# Constructors

# constructor

+ new ButtonGroupControl(options?: Record<string, any>): ButtonGroupControl

# Parameters
Name Type Default value
options Record<string, any> {}

Returns: ButtonGroupControl

# Methods

# onAdd

onAdd(map: Map): HTMLElement

# Parameters
Name Type
map Map

Returns: HTMLElement


# onRemove

onRemove(): void

Returns: void

vjmap / Exports / default / Circle

# Class: Circle

default.Circle

创建圆符号图层.

# Hierarchy

# Table of contents

# Constructors

# Properties

# Methods

# Constructors

# constructor

+ new Circle(options: CircleOptions): Circle

# Parameters
Name Type
options CircleOptions

Returns: Circle

Overrides: OverlayLayerBase

# Properties

# _map

Optional _map: Map

Inherited from: OverlayLayerBase._map


# layerId

Optional layerId: string

Inherited from: OverlayLayerBase.layerId


# options

options: CircleOptions


# sourceId

Optional sourceId: string

Inherited from: OverlayLayerBase.sourceId

# Methods

# addTo

addTo(map: Map, beforeId?: string): void

# Parameters
Name Type
map Map
beforeId? string

Returns: void

Overrides: OverlayLayerBase


# clickLayer

clickLayer(cb: any): any

每当单击这些图层中的要素时都会触发回调。

# Parameters
Name Type Description
cb any Callback that receives event with .features property

Returns: any

A function that removes the handler.

Inherited from: OverlayLayerBase


# clickPopup

clickPopup(htmlFunc: (arg0: {}) => void, popupOptions?: PopupOptions): any

每当单击这些图层中的要素时都会显示一个弹出窗口。

example clickPopup(f => <h3>${f.properties.Name}</h3> ${f.properties.Description}, { maxWidth: 500 });

# Parameters
Name Type Description
htmlFunc (arg0: {}) => void Function that receives feature and popup, returns HTML.
popupOptions? PopupOptions Options passed to Popup() to customise popup.

Returns: any

A function that removes the handler.

Inherited from: OverlayLayerBase


# getCircleBlur

getCircleBlur(): DataDrivenPropertyValueSpecification<number>

Returns: DataDrivenPropertyValueSpecification<number>


# getCircleColor

getCircleColor(): DataDrivenPropertyValueSpecification<string>

Returns: DataDrivenPropertyValueSpecification<string>


# getCircleOpacity

getCircleOpacity(): DataDrivenPropertyValueSpecification<number>

Returns: DataDrivenPropertyValueSpecification<number>


# getCirclePitchAlignment

getCirclePitchAlignment(): PropertyValueSpecificationEx<"map" | "viewport">

Returns: PropertyValueSpecificationEx<"map" | "viewport">


# getCirclePitchScale

getCirclePitchScale(): PropertyValueSpecificationEx<"map" | "viewport">

Returns: PropertyValueSpecificationEx<"map" | "viewport">


# getCircleRadius

getCircleRadius(): DataDrivenPropertyValueSpecification<number>

Returns: DataDrivenPropertyValueSpecification<number>


# getCircleSortKey

getCircleSortKey(): DataDrivenPropertyValueSpecification<number>

Returns: DataDrivenPropertyValueSpecification<number>


# getCircleStrokeColor

getCircleStrokeColor(): DataDrivenPropertyValueSpecification<string>

Returns: DataDrivenPropertyValueSpecification<string>


# getCircleStrokeOpacity

getCircleStrokeOpacity(): DataDrivenPropertyValueSpecification<number>

Returns: DataDrivenPropertyValueSpecification<number>


# getCircleStrokeWidth

getCircleStrokeWidth(): DataDrivenPropertyValueSpecification<number>

Returns: DataDrivenPropertyValueSpecification<number>


# getCircleTranslate

getCircleTranslate(): PropertyValueSpecificationEx<[number, number]>

Returns: PropertyValueSpecificationEx<[number, number]>


# getCircleTranslateAnchor

getCircleTranslateAnchor(): PropertyValueSpecificationEx<"map" | "viewport">

Returns: PropertyValueSpecificationEx<"map" | "viewport">


# getData

getData(): undefined | Feature<Geometry | GeometryCollection, Properties> | FeatureCollection<Geometry | GeometryCollection, Properties> | Geometry | GeometryCollection

获取数据源的数据

Returns: undefined | Feature<Geometry | GeometryCollection, Properties> | FeatureCollection<Geometry | GeometryCollection, Properties> | Geometry | GeometryCollection

Inherited from: OverlayLayerBase


# getLayerId

getLayerId(): undefined | string

获取图层ID

Returns: undefined | string

Inherited from: OverlayLayerBase


# getLayerStyle

getLayerStyle(): LayerSpecification

根据样式规范,获取给定图层 ID 的图层定义。

Returns: LayerSpecification

Inherited from: OverlayLayerBase


# getSourceId

getSourceId(): undefined | string

获取数据源ID

Returns: undefined | string

Inherited from: OverlayLayerBase


# getVisibility

getVisibility(): "visible" | "none"

Returns: "visible" | "none"


# hide

hide(): void

使给定的图层不可见。

Returns: void

Inherited from: OverlayLayerBase


# hoverFeatureState

hoverFeatureState(enterCb?: (arg0: {}) => void, leaveCb?: (arg0: {}) => void): void

每当将鼠标悬停在这些图层中的某个特征上时,更新连接源 [s] 中特征的特征状态。

# Parameters
Name Type
enterCb? (arg0: {}) => void
leaveCb? (arg0: {}) => void

Returns: void

Inherited from: OverlayLayerBase


# hoverLayer

hoverLayer(cb: any): any

当鼠标悬停在这些图层中的要素上时触发回调。

# Parameters
Name Type
cb any

Returns: any

A function to remove the handler.

Inherited from: OverlayLayerBase


# hoverPointer

hoverPointer(): void

每当鼠标悬停在这些图层上时,将地图的光标设置为“指针”。

Returns: void

A function to remove the handler.

Inherited from: OverlayLayerBase


# hoverPopup

hoverPopup(htmlFunc: any, popupOptions?: PopupOptions): any

将鼠标悬停在这些图层中的某个要素上时,会显示一个弹出窗口。

example hoverPopup(f => <h3>${f.properties.Name}</h3> ${f.properties.Description}, { anchor: 'left' });

# Parameters
Name Type Description
htmlFunc any Function that receives feature and popup, returns HTML.
popupOptions? PopupOptions Options passed to Popup() to customise popup.

Returns: any

Inherited from: OverlayLayerBase


# remove

remove(): void

Returns: void

Inherited from: OverlayLayerBase


# setCircleBlur

setCircleBlur(value: DataDrivenPropertyValueSpecification<number>): Circle

# Parameters
Name Type
value DataDrivenPropertyValueSpecification<number>

Returns: Circle


# setCircleColor

setCircleColor(value: DataDrivenPropertyValueSpecification<string>): Circle

# Parameters
Name Type
value DataDrivenPropertyValueSpecification<string>

Returns: Circle


# setCircleOpacity

setCircleOpacity(value: DataDrivenPropertyValueSpecification<number>): Circle

# Parameters
Name Type
value DataDrivenPropertyValueSpecification<number>

Returns: Circle


# setCirclePitchAlignment

setCirclePitchAlignment(value: PropertyValueSpecificationEx<"map" | "viewport">): Circle

# Parameters
Name Type
value PropertyValueSpecificationEx<"map" | "viewport">

Returns: Circle


# setCirclePitchScale

setCirclePitchScale(value: PropertyValueSpecificationEx<"map" | "viewport">): Circle

# Parameters
Name Type
value PropertyValueSpecificationEx<"map" | "viewport">

Returns: Circle


# setCircleRadius

setCircleRadius(value: DataDrivenPropertyValueSpecification<number>): Circle

# Parameters
Name Type
value DataDrivenPropertyValueSpecification<number>

Returns: Circle


# setCircleSortKey

setCircleSortKey(value: DataDrivenPropertyValueSpecification<number>): Circle

# Parameters
Name Type
value DataDrivenPropertyValueSpecification<number>

Returns: Circle


# setCircleStrokeColor

setCircleStrokeColor(value: DataDrivenPropertyValueSpecification<string>): Circle

# Parameters
Name Type
value DataDrivenPropertyValueSpecification<string>

Returns: Circle


# setCircleStrokeOpacity

setCircleStrokeOpacity(value: DataDrivenPropertyValueSpecification<number>): Circle

# Parameters
Name Type
value DataDrivenPropertyValueSpecification<number>

Returns: Circle


# setCircleStrokeWidth

setCircleStrokeWidth(value: DataDrivenPropertyValueSpecification<number>): Circle

# Parameters
Name Type
value DataDrivenPropertyValueSpecification<number>

Returns: Circle


# setCircleTranslate

setCircleTranslate(value: PropertyValueSpecificationEx<[number, number]>): Circle

# Parameters
Name Type
value PropertyValueSpecificationEx<[number, number]>

Returns: Circle


# setCircleTranslateAnchor

setCircleTranslateAnchor(value: PropertyValueSpecificationEx<"map" | "viewport">): Circle

# Parameters
Name Type
value PropertyValueSpecificationEx<"map" | "viewport">

Returns: Circle


# setData

setData(data: any): void

替换 GeoJSON 图层的当前数据。

# Parameters
Name Type
data any

Returns: void


# setFilter

setFilter(filter: FilterSpecification): void

替换一个图层的过滤器。

example setFilter(['==','level','0']]);

# Parameters
Name Type Description
filter FilterSpecification New filter to set.

Returns: void

Inherited from: OverlayLayerBase


# setLayerStyle

setLayerStyle(style: any): void

设置图层样式

# Parameters
Name Type
style any

Returns: void

Inherited from: OverlayLayerBase


# setProperty

setProperty(prop: string | object, value?: any): void

在一个或多个图层上设置绘制或布局属性。

example setProperty('fillOpacity', 0.5)

# Parameters
Name Type
prop string | object
value? any

Returns: void

Inherited from: OverlayLayerBase


# setVisibility

setVisibility(value: "visible" | "none"): Circle

# Parameters
Name Type
value "visible" | "none"

Returns: Circle


# show

show(): void

使给定的图层可见。

Returns: void

Inherited from: OverlayLayerBase


# toggle

toggle(state: boolean): boolean

根据参数使给定的图层隐藏或可见。

# Parameters
Name Type Description
state boolean True for visible, false for hidden.

Returns: boolean

Inherited from: OverlayLayerBase

vjmap / Exports / default / CircleEdge

# Class: CircleEdge

default.CircleEdge

创建只有边框的圆或圆弧

# Hierarchy

# Table of contents

# Constructors

# Properties

# Methods

# Constructors

# constructor

+ new CircleEdge(options: CircleEdgeOptions): CircleEdge

# Parameters
Name Type
options CircleEdgeOptions

Returns: CircleEdge

Overrides: Polyline

# Properties

# _map

Optional _map: Map

Inherited from: Polyline._map


# layerId

Optional layerId: string

Inherited from: Polyline.layerId


# options

options: PolylineOptions

Inherited from: Polyline.options


# sourceId

Optional sourceId: string

Inherited from: Polyline.sourceId

# Methods

# addTo

addTo(map: Map, beforeId?: string): void

# Parameters
Name Type
map Map
beforeId? string

Returns: void

Overrides: Polyline


# clickLayer

clickLayer(cb: any): any

每当单击这些图层中的要素时都会触发回调。

# Parameters
Name Type Descri