靜態unGet the constrained center of this view.
Center.
Constrained center.
Fit the given geometry or extent based on the given map size and border.
The size is pixel dimensions of the box to fit the extent into.
In most cases you will want to use the map size, that is map.getSize().
Takes care of the map angle.
Geometry.
Box pixel size.
可選opt_options: FitOptionsOptions.
Center on coordinate and view position.
Coordinate.
Box pixel size.
Position on the view to center on.
Rotate the view around a given coordinate.
New rotation value for the view.
可選opt_anchor: CoordinateThe rotation center.
Animate the view. The view's center, zoom (or resolution), and rotation can be animated for smooth transitions between view states.
Animation options.
Listen for a certain type of event.
The event type or array of event types.
The listener function.
可選opt_this: ObjectThe object to use as this in listener.
Unique key for the listener. If called with an array of event types as the first argument, the return will be an array of keys.
Listen once for a certain type of event.
The event type or array of event types.
The listener function.
可選opt_this: ObjectThe object to use as this in listener.
Unique key for the listener. If called with an array of event types as the first argument, the return will be an array of keys.
函數Removes an event listener using the key returned by on() or once().
Note that using the ol.Observable.unByKey static function is to
be preferred.
可選opt_options: ViewOptionsView options.
An ol.View object represents a simple 2D view of the map.
This is the object to act upon to change the center, resolution, and rotation of the map.
An ol.View is determined by three states: center, resolution,
and rotation. Each state has a corresponding getter and setter, e.g.
getCenter and setCenter for the center state.
An ol.View has a projection. The projection determines the
coordinate system of the center, and its units determine the units of the
resolution (projection units per pixel). The default projection is
Spherical Mercator (EPSG:3857).
setCenter, setResolution and setRotation can be used to change the
states of the view. Any value can be passed to the setters. And the value
that is passed to a setter will effectively be the value set in the view,
and returned by the corresponding getter.
But an ol.View object also has a resolution constraint, a
rotation constraint and a center constraint.
As said above, no constraints are applied when the setters are used to set
new states for the view. Applying constraints is done explicitly through
the use of the constrain* functions (constrainResolution and
constrainRotation and constrainCenter).
The main users of the constraints are the interactions and the controls. For example, double-clicking on the map changes the view to the "next" resolution. And releasing the fingers after pinch-zooming snaps to the closest resolution (with an animation).
The resolution constraint snaps to specific resolutions. It is
determined by the following options: resolutions, maxResolution,
maxZoom, and zoomFactor. If resolutions is set, the other three
options are ignored. See documentation for each option for more
information.
The rotation constraint snaps to specific angles. It is determined
by the following options: enableRotation and constrainRotation.
By default the rotation value is snapped to zero when approaching the
horizontal.
The center constraint is determined by the extent option. By
default the center is not constrained at all.
Classdesc
An ol.View object represents a simple 2D view of the map.
This is the object to act upon to change the center, resolution, and rotation of the map.
The view states
An
ol.Viewis determined by three states:center,resolution, androtation. Each state has a corresponding getter and setter, e.g.getCenterandsetCenterfor thecenterstate.An
ol.Viewhas aprojection. The projection determines the coordinate system of the center, and its units determine the units of the resolution (projection units per pixel). The default projection is Spherical Mercator (EPSG:3857).The constraints
setCenter,setResolutionandsetRotationcan be used to change the states of the view. Any value can be passed to the setters. And the value that is passed to a setter will effectively be the value set in the view, and returned by the corresponding getter.But an
ol.Viewobject also has a resolution constraint, a rotation constraint and a center constraint.As said above, no constraints are applied when the setters are used to set new states for the view. Applying constraints is done explicitly through the use of the
constrain*functions (constrainResolutionandconstrainRotationandconstrainCenter).The main users of the constraints are the interactions and the controls. For example, double-clicking on the map changes the view to the "next" resolution. And releasing the fingers after pinch-zooming snaps to the closest resolution (with an animation).
The resolution constraint snaps to specific resolutions. It is determined by the following options:
resolutions,maxResolution,maxZoom, andzoomFactor. Ifresolutionsis set, the other three options are ignored. See documentation for each option for more information.The rotation constraint snaps to specific angles. It is determined by the following options:
enableRotationandconstrainRotation. By default the rotation value is snapped to zero when approaching the horizontal.The center constraint is determined by the
extentoption. By default the center is not constrained at all.參數: opt_options
View options.
Api
stable