new View2D
Parameters:
| Name | Type | Argument | Description | |||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
olx.View2DOptions |
<optional> |
View2D options. Properties
|
- Source:
- view2d.js, line 95
Fires:
- ol.ObjectEvent ol.event:ObjectEvent
Extends
- ol.IView2D (Interface)
- ol.IView3D (Interface)
- ol.View
Observable Properties
| Name | Type | Settable | ol.ObjectEvent type | Description |
|---|---|---|---|---|
center |
ol.Coordinate | yes | change:center |
the center of the view |
projection |
ol.proj.Projection | yes | change:projection |
the projection of the view |
resolution |
number | yes | change:resolution |
the resolution of the view |
rotation |
number | yes | change:rotation |
the rotation of the view |
Methods
-
calculateExtent
Stability: experimental -
Calculate the extent for the given size in pixels, based on the current resolution and the current center.
Parameters:
Name Type Description sizeol.Size Box pixel size.
- Source:
- view2d.js, line 243
Returns:
Extent.
- Type
- ol.Extent
-
centerOn
Stability: experimental -
Center on coordinate and view position. Take care on the map angle.
Parameters:
Name Type Description coordinateol.Coordinate Coordinate.
sizeol.Size Box pixel size.
positionol.Pixel Position on the view to center on.
- Source:
- view2d.js, line 513
-
constrainResolution
Stability: experimental -
Get the constrained the resolution of this view.
Parameters:
Name Type Argument Description resolutionnumber | undefined Resolution.
deltanumber <optional>
Delta. Default is
0.directionnumber <optional>
Direction. Default is
0.- Source:
- view2d.js, line 201
Returns:
Constrained resolution.
- Type
- number | undefined
-
constrainRotation
Stability: experimental -
Get the constrained rotation of this view.
Parameters:
Name Type Argument Description rotationnumber | undefined Rotation.
deltanumber <optional>
Delta. Default is
0.- Source:
- view2d.js, line 216
Returns:
Constrained rotation.
- Type
- number | undefined
-
fitExtent
Stability: experimental -
Fit the given extent based on the given map size.
Parameters:
Name Type Description extentol.Extent Extent.
sizeol.Size Box pixel size.
- Source:
- view2d.js, line 424
-
fitGeometry
Stability: experimental -
Fit the given geometry based on the given map size and border. Take care on the map angle.
Parameters:
Name Type Argument Description geometryol.geom.SimpleGeometry Geometry.
sizeol.Size Box pixel size.
optionsolx.View2D.fitGeometryOptions <optional>
Options.
Properties
Name Type Description padding!Array.<number> Padding (in pixels) to be cleared inside the view. Values in the array are top, right, bottom and left padding. Default is
[0, 0, 0, 0].constrainResolutionboolean | undefined Constrain the resolution. Default is
true.nearestboolean | undefined Get the nearest extent. Default is
false.minResolutionnumber | undefined Minimum resolution that we zoom to. Default is
0.- Source:
- view2d.js, line 446
-
getCenter
Stability: experimental -
- Source:
- view2d.js, line 226
Returns:
Map center.
- Type
- ol.Coordinate | undefined
-
getProjection
Stability: experimental -
- Source:
- view2d.js, line 259
Returns:
Map projection.
- Type
- ol.proj.Projection | undefined
-
getResolution
Stability: experimental -
- Source:
- view2d.js, line 273
Returns:
Map resolution.
- Type
- number | undefined
-
getRotation
Stability: experimental -
- Source:
- view2d.js, line 324
Returns:
Map rotation.
- Type
- number | undefined
-
getView2D
Stability: experimental -
- Source:
- view2d.js, line 362
Returns:
View2D.
- Type
- ol.IView2D
-
getZoom
Stability: experimental -
Get the current zoom level. Return undefined if the current resolution is undefined or not a "constrained resolution".
- Source:
- view2d.js, line 398
Returns:
Zoom.
- Type
- number | undefined
-
rotate
Stability: experimental -
Rotate the view around a given coordinate.
Parameters:
Name Type Argument Description rotationnumber New rotation value for the view.
anchorol.Coordinate <optional>
The rotation center.
- Source:
- view2d.js, line 548
-
setCenter
Stability: experimental -
Set the center of the current view.
Parameters:
Name Type Description centerol.Coordinate | undefined Center.
- Source:
- view2d.js, line 562
-
setProjection
Stability: experimental -
Set the projection of this view. Warning! This code is not yet implemented. Function should not be used.
Parameters:
Name Type Description projectionol.proj.Projection | undefined Projection.
- Source:
- view2d.js, line 577
-
setResolution
Stability: experimental -
Set the resolution for this view.
Parameters:
Name Type Description resolutionnumber | undefined Resolution.
- Source:
- view2d.js, line 591
-
setRotation
Stability: experimental -
Set the rotation for this view.
Parameters:
Name Type Description rotationnumber | undefined Rotation.
- Source:
- view2d.js, line 605
-
setZoom
Stability: experimental -
Zoom to a specific zoom level.
Parameters:
Name Type Description zoomnumber Zoom level.
- Source:
- view2d.js, line 619
OpenLayers 3