SnapGridManager class
Manages a pixel based grid for snapping positions at integer based zoom levels.
Constructors
Snap |
Manages a pixel based grid for snapping positions at integer based zoom levels. |
Methods
dispose() | Disposes the manager. |
get |
Gets the line layer used to render the grid lines. |
get |
Gets the options used by the SnapGridManager. |
set |
Sets the options of the snap grid manager. |
snap |
Snaps an array of positions to the grid. If |
snap |
Snaps a Shape or GeoJSON feature coordinates to the grid. |
Constructor Details
SnapGridManager(azmaps.Map, SnapGridManagerOptions)
Manages a pixel based grid for snapping positions at integer based zoom levels.
new SnapGridManager(map: azmaps.Map, options?: SnapGridManagerOptions)
Parameters
- map
- azmaps.Map
The map to attache the snap grid manager to.
- options
- SnapGridManagerOptions
Options to apply to the snap grid manager.
Method Details
dispose()
Disposes the manager.
function dispose()
getGridLayer()
Gets the line layer used to render the grid lines.
function getGridLayer(): azmaps.layer.LineLayer
Returns
A line layer used to render the grid lines.
getOptions()
Gets the options used by the SnapGridManager.
function getOptions(): SnapGridManagerOptions
Returns
setOptions(SnapGridManagerOptions)
Sets the options of the snap grid manager.
function setOptions(options: SnapGridManagerOptions)
Parameters
- options
- SnapGridManagerOptions
Options to set.
snapPositions(azmaps.data.Position[], number)
Snaps an array of positions to the grid. If optimize
is set, duplicate sequential positions will be removed from the shape.
function snapPositions(positions: azmaps.data.Position[], zoom?: number): azmaps.data.Position[]
Parameters
- positions
-
azmaps.data.Position[]
The positions to snap.
- zoom
-
number
Optionally specify which zoom level to optimize the snapping for. If not specified, the map's zoom level will be used.
Returns
azmaps.data.Position[]
A new array of snapped positions.
snapShape(azmaps, number)
Snaps a Shape or GeoJSON feature coordinates to the grid.
function snapShape(shape: azmaps, zoom?: number)
Parameters
- shape
-
azmaps
A shape or GeoJSON feature to snap.
- zoom
-
number
Optionally specify which zoom level to optimize the snapping for. If not specified, the maps zoom level will be used.