您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

绘图工具模块中的交互类型和键盘快捷方式Interaction types and keyboard shortcuts in the drawing tools module

本文概述了使用鼠标、触摸屏或键盘快捷方式绘制和编辑形状的所有不同方式。This article outlines all the different ways to draw and edit shapes using a mouse, touch screen, or keyboard shortcuts.

绘图管理器支持通过三种不同的方式与地图进行交互,以便绘制形状。The drawing manager supports three different ways of interacting with the map, to draw shapes.

  • click -在单击鼠标或触摸时添加坐标。click - Coordinates are added when the mouse or touch is clicked.
  • freehand -在将鼠标或触摸拖动到地图上时添加坐标。freehand - Coordinates are added when the mouse or touch is dragged on the map.
  • hybrid -在单击或拖动鼠标或触摸时添加坐标。hybrid - Coordinates are added when the mouse or touch is clicked or dragged.

如何绘制形状How to draw shapes

在可以绘制任何形状之前,请将 drawingMode "绘图管理器" 的选项设置为支持的绘图设置。Before any shape can be drawn, set the drawingMode option of the drawing manager to a supported drawing setting. 此设置可通过按工具栏上的一个绘图按钮进行编程或调用。This setting can be programmed, or invoked by pressing one of the drawing buttons on the toolbar. 即使在绘制形状后,绘制模式仍处于启用状态,这样就可以轻松地绘制相同类型的其他形状。The drawing mode stays enabled, even after a shape has been drawn, making it easy to draw additional shapes of the same type. 以编程方式将绘图模式设置为空闲状态。Programmatically set the drawing mode to an idle state. 或者,通过单击工具栏上的 "当前绘制模式" 按钮切换到空闲状态。Or, switch to an idle state by clicking the current drawing modes button on the toolbar.

以下各节概述了可在地图上绘制形状的所有不同方式。The next sections outline all the different ways that shapes can be drawn on the map.

如何绘制点How to draw a point

当绘图管理器处于 draw-point 绘制模式时,可以执行下列操作来在地图上绘制点。When the drawing manager is in draw-point drawing mode, the following actions can be done to draw points on the map. 这些方法适用于所有交互模式。These methods work with all interaction modes.

开始绘制Start drawing

  • 单击鼠标左键,或按地图,将点添加到地图中。Click the left mouse button, or touch the map to add a point to the map.
  • 如果鼠标位于地图上,请按 F 键,然后将在鼠标指针的坐标处添加一个点。If the mouse is over the map, press the F key, and a point will be added at the coordinate of the mouse pointer. 此方法为将点添加到地图提供更高的准确性。This method provides higher accuracy for adding a point to the map. 由于鼠标左键按下鼠标按钮,因此鼠标移动将减少。There will be less movement on the mouse due to the pressing motion of the left mouse button.
  • 继续单击、触摸或按 F 以将更多的点添加到地图中。Keep clicking, touching, or pressing F to add more points to the map.

完成绘制Finish drawing

  • 单击 "绘图" 工具栏中的任意一个按钮。Click on any button in the drawing toolbar.
  • 以编程方式设置绘图模式。Programmatically set the drawing mode.
  • C 键。Press the C key.

取消绘图Cancel drawing

  • Escape 键。Press the Escape key.

如何绘制线条How to draw a line

当绘图管理器处于 draw-line 模式时,可以执行下列操作来根据交互模式在地图上绘制点。When the drawing manager is in draw-line mode, the following actions can be done to draw points on the map, depending on the interaction mode.

开始绘制Start drawing

  • 单击模式Click mode
    • 单击鼠标左键,或按地图,在地图上添加直线的每个点。Click the left mouse button, or touch the map to add each point of a line on the map. 每次单击或触摸时都会向线条添加坐标。A coordinate is added to the line for each click or touch.
    • 如果鼠标位于地图上,请按 F 键,然后将在鼠标指针的坐标处添加一个点。If the mouse is over the map, press the F key, and a point will be added at the coordinate of the mouse pointer. 此方法为将点添加到地图提供更高的准确性。This method provides higher accuracy for adding a point to the map. 由于鼠标左键按下鼠标按钮,因此鼠标移动将减少。There will be less movement on the mouse due to the pressing motion of the left mouse button.
    • 继续单击直到将所有所需的点添加到该行。Keep clicking until all the desired points have been added to the line.
  • 手绘模式Freehand mode
    • 按下鼠标左键,或在地图上向下轻按,然后拖动鼠标或接触点。Press down the left mouse button, or touch-down on the map and drag the mouse, or touch point around. 当鼠标或触控点在地图上移动时,将在行中添加坐标。Coordinates are added to the line as the mouse or touch point moves around the map. 一旦触发了鼠标或触摸事件,就完成了绘制。As soon as the mouse or touch-up event is triggered, the drawing is completed. 添加坐标的频率由 "绘图管理器" freehandInterval 选项定义。The frequency at which coordinates are added is defined by the drawing managers freehandInterval option.
  • 混合模式Hybrid mode
    • 在绘制单个线条的情况下,根据需要在 "单击" 和 "手绘" 方法之间切换。Alternate between click and freehand methods, as desired, while drawing a single line. 例如,单击几个点,然后按住并拖动鼠标添加一组点,再单击几个点。For example, click a few points, then hold and drag the mouse to add a bunch of points, then click a few more.

完成绘制Finish drawing

  • 混合/单击模式Hybrid/Click mode
    • 双击最后一个点处的地图。Double-click the map at the last point.
    • 单击 "绘图" 工具栏中的任意一个按钮。Click on any button in the drawing toolbar.
    • 以编程方式设置绘图模式。Programmatically set the drawing mode.
  • 手绘模式Freehand mode
    • 释放鼠标按钮或触摸点。Release the mouse button or touch point.
  • C 键。Press the C key.

取消绘图Cancel drawing

  • Escape 键。Press the Escape key.

如何绘制多边形How to draw a polygon

当绘图管理器处于 draw-polygon 模式时,可以执行下列操作来根据交互模式在地图上绘制点。When the drawing manager is in draw-polygon mode, the following actions can be done to draw points on the map, depending on the interaction mode.

开始绘制Start drawing

  • 单击模式Click mode
    • 单击鼠标左键,或按地图,在地图上添加多边形的每个点。Click the left mouse button, or touch the map to add each point of a polygon on the map. 每次单击或触摸时都会向多边形添加坐标。A coordinate is added to the polygon for each click or touch.
    • 如果鼠标位于地图上,请按 F 键,然后将在鼠标指针的坐标处添加一个点。If the mouse is over the map, press the F key, and a point will be added at the coordinate of the mouse pointer. 此方法为将点添加到地图提供更高的准确性。This method provides higher accuracy for adding a point to the map. 由于鼠标左键按下鼠标按钮,因此鼠标移动将减少。There will be less movement on the mouse due to the pressing motion of the left mouse button.
    • 继续单击直到将所有所需的点添加到多边形。Keep clicking until all the desired points have been added to the polygon.
  • 手绘模式Freehand mode
    • 按下鼠标左键,或在地图上向下轻按,然后拖动鼠标或接触点。Press down the left mouse button, or touch-down on the map and drag the mouse, or touch point around. 当鼠标或触控点在地图上移动时,将在多边形中添加坐标。Coordinates are added to the polygon as the mouse or touch point moves around the map. 一旦触发了鼠标或触摸事件,就完成了绘制。As soon as the mouse or touch-up event is triggered, the drawing is completed. 添加坐标的频率由 "绘图管理器" freehandInterval 选项定义。The frequency at which coordinates are added is defined by the drawing managers freehandInterval option.
  • 混合模式Hybrid mode
    • 在绘制单个多边形时,根据需要在 "单击" 和 "手绘" 方法之间切换。Alternate between click and freehand methods, as desired, while drawing a single polygon. 例如,单击几个点,然后按住并拖动鼠标添加一组点,再单击几个点。For example, click a few points, then hold and drag the mouse to add a bunch of points, then click a few more.

完成绘制Finish drawing

  • 混合/单击模式Hybrid/Click mode
    • 双击最后一个点处的地图。Double-click the map at the last point.
    • 单击多边形的第一个点。Click on the first point in the polygon.
    • 单击 "绘图" 工具栏中的任意一个按钮。Click on any button in the drawing toolbar.
    • 以编程方式设置绘图模式。Programmatically set the drawing mode.
  • 手绘模式Freehand mode
    • 释放鼠标按钮或触摸点。Release the mouse button or touch point.
  • C 键。Press the C key.

取消绘图Cancel drawing

  • Escape 键。Press the Escape key.

如何绘制矩形How to draw a rectangle

当绘图管理器处于 draw-rectangle 模式时,可以执行下列操作来根据交互模式在地图上绘制点。When the drawing manager is in draw-rectangle mode, the following actions can be done to draw points on the map, depending on the interaction mode. 生成的形状将遵循 矩形的扩展 GeoJSON 规范The generated shape will follow the extended GeoJSON specification for rectangles.

开始绘制Start drawing

  • 按下鼠标左键,或在地图上向下轻按,以添加矩形的第一个角并拖动以创建矩形。Press down the left mouse button, or touch-down on the map to add the first corner of the rectangle and drag to create the rectangle.

完成绘制Finish drawing

  • 释放鼠标按钮或触摸点。Release the mouse button or touch point.
  • 以编程方式设置绘图模式。Programmatically set the drawing mode.
  • C 键。Press the C key.

取消绘图Cancel drawing

  • Escape 键。Press the Escape key.

如何绘制圆形How to draw a circle

当绘图管理器处于 draw-circle 模式时,可以执行下列操作来根据交互模式在地图上绘制点。When the drawing manager is in draw-circle mode, the following actions can be done to draw points on the map, depending on the interaction mode. 生成的形状将遵循 圆圈的扩展 GeoJSON 规范The generated shape will follow the extended GeoJSON specification for circles.

开始绘制Start drawing

  • 按下鼠标左键,或在地图上向下轻按,以添加圆形的中心,并拖动使圆圈成为半径。Press down the left mouse button, or touch-down on the map to add the center of the circle and drag give the circles a radius.

完成绘制Finish drawing

  • 释放鼠标按钮或触摸点。Release the mouse button or touch point.
  • 以编程方式设置绘图模式。Programmatically set the drawing mode.
  • C 键。Press the C key.

取消绘图Cancel drawing

  • Escape 键。Press the Escape key.

键盘快捷方式Keyboard shortcuts

绘图工具支持键盘快捷方式。The drawing tools support keyboard shortcuts. 当地图处于焦点时,这些键盘快捷方式将正常运行。These keyboard shortcuts are functional when the map is in focus.

密钥Key 操作Action
C 完成正在进行的任何绘图,并将绘图模式设置为 "空闲"。Completes any drawing that is in progress and sets the drawing mode to idle. 焦点将移到顶级地图元素。Focus will move to top-level map element.
Escape 取消正在进行的任何绘图,并将绘图模式设置为 "空闲"。Cancels any drawing that is in progress and sets the drawing mode to idle. 焦点将移到顶级地图元素。Focus will move to top-level map element.
F 如果鼠标位于地图上,则将坐标添加到点、线条或多边形。Adds a coordinate to a point, line, or polygon if the mouse is over the map. 处于单击或混合模式时,单击该映射的等效操作。Equivalent action of clicking the map when in click or hybrid mode. 此快捷方式可用于更精确、更快速的绘图。This shortcut allows for more precise and faster drawings. 您可以使用一只手使鼠标和其他人按下按钮,而无需从按下手势移动鼠标。You can use one hand to position the mouse and other to press the button without moving the mouse from the press gesture.

后续步骤Next steps

详细了解 "绘图工具" 模块中的类:Learn more about the classes in the drawing tools module: