experimental new ol.View2D(opt_options)
| Name | Type | Argument | Description | |||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
optional
View2D options.
|
|||||||||||||||||||||||||||||||||||||||||
Fires:
-
experimental
beforepropertychange(ol.ObjectEvent) - Triggered before a property is changed. -
change -
change:center(ol.ObjectEvent) -
change:projection(ol.ObjectEvent) -
change:resolution(ol.ObjectEvent) -
change:rotation(ol.ObjectEvent) -
experimental
propertychange(ol.ObjectEvent) - Triggered when a property is changed.
Extends
Observable Properties
| Name | Type | Settable | ol.ObjectEvent type | Description |
|---|---|---|---|---|
center |
ol.Coordinate | undefined | yes | change:center |
The center of the view. |
projection |
ol.proj.Projection | undefined | yes | change:projection |
The projection of the view. |
resolution |
number | undefined | yes | change:resolution |
The resolution of the view. |
rotation |
number | undefined | yes | change:rotation |
The rotation of the view. |
Methods
-
experimental inherited bindTo(key, target, opt_targetKey){ol.ObjectAccessor}
-
The bindTo method allows you to set up a two-way binding between a
sourceandtargetobject. The method returns an ol.ObjectAccessor with a transform method that lets you transform values on the way from the source to the target and on the way back.For example, if you had two map views (sourceView and targetView) and you wanted the target view to have double the resolution of the source view, you could transform the resolution on the way to and from the target with the following:
sourceView.bindTo('resolution', targetView) .transform( function(sourceResolution) { // from sourceView.resolution to targetView.resolution return 2 * sourceResolution; }, function(targetResolution) { // from targetView.resolution to sourceView.resolution return targetResolution / 2; } );Name Type Argument Description keystring Key name.
targetol.Object Target.
targetKeystring <optional>
optional Target key.
-
experimental calculateExtent(size){ol.Extent}
-
Calculate the extent for the given size in pixels, based on the current resolution and the current center.
Name Type Description sizeol.Size Box pixel size.
-
experimental centerOn(coordinate, size, position)
-
Center on coordinate and view position. Take care on the map angle.
Name Type Description coordinateol.Coordinate Coordinate.
sizeol.Size Box pixel size.
positionol.Pixel Position on the view to center on.
-
experimental constrainResolution(resolution, opt_delta, opt_direction){number|undefined}
-
Get the constrained the resolution of this view.
Name Type Argument Description resolutionnumber | undefined Resolution.
deltanumber <optional>
optional Delta. Default is
0.directionnumber <optional>
optional Direction. Default is
0.Returns:
resolution.
-
experimental constrainRotation(rotation, opt_delta){number|undefined}
-
Get the constrained rotation of this view.
Name Type Argument Description rotationnumber | undefined Rotation.
deltanumber <optional>
optional Delta. Default is
0.Returns:
rotation.
-
experimental inherited dispatchChangeEvent()
-
Dispatches a
changeevent. Register a listener for this event to get notified of changes.Fires:
-
change
-
-
experimental fitExtent(extent, size)
-
Fit the given extent based on the given map size.
Name Type Description extentol.Extent Extent.
sizeol.Size Box pixel size.
-
experimental fitGeometry(geometry, size, opt_options)
-
Fit the given geometry based on the given map size and border. Take care on the map angle.
Name Type Argument Description geometryol.geom.SimpleGeometry Geometry.
sizeol.Size Box pixel size.
optionsoptional Options.
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. -
experimental inherited get(key){*}
-
Gets a value.
Name Type Description keystring Key name.
-
experimental getCenter(){ol.Coordinate|undefined}
-
Returns:
center of the view.
-
experimental inherited getKeys(){Array.<string>}
-
Get a list of object property names.
Returns:
of property names.
-
experimental getProjection(){ol.proj.Projection|undefined}
-
Returns:
projection of the view.
-
experimental inherited getProperties(){Object.<string, *>}
-
Get an object of all property names and values.
-
experimental getResolution(){number|undefined}
-
Returns:
resolution of the view.
-
experimental getRotation(){number|undefined}
-
Returns:
rotation of the view.
-
experimental getView2D(){ol.IView2D}
-
-
experimental getZoom(){number|undefined}
-
Get the current zoom level. Return undefined if the current resolution is undefined or not a "constrained resolution".
-
experimental inherited notify(key)
-
Notify all observers of a change on this property. This notifies both objects that are bound to the object's property as well as the object that it is bound to.
Name Type Description keystring Key name.
-
experimental inherited on(type, listener, opt_this){goog.events.Key}
-
Listen for a certain type of event.
Name Type Argument Description typestring | Array.<string> The event type or array of event types.
listenerfunction The listener function.
thisObject <optional>
optional The object to use as
thisinlistener.Returns:
key for the listener.
-
experimental inherited once(type, listener, opt_this){goog.events.Key}
-
Listen once for a certain type of event.
Name Type Argument Description typestring | Array.<string> The event type or array of event types.
listenerfunction The listener function.
thisObject <optional>
optional The object to use as
thisinlistener.Returns:
key for the listener.
-
experimental rotate(rotation, opt_anchor)
-
Rotate the view around a given coordinate.
Name Type Argument Description rotationnumber New rotation value for the view.
anchorol.Coordinate <optional>
optional The rotation center.
-
experimental inherited set(key, value)
-
Sets a value.
Name Type Description keystring Key name.
value* Value.
-
experimental setCenter(center)
-
Set the center of the current view.
Name Type Description centerol.Coordinate | undefined The center of the view.
-
experimental setProjection(projection)
-
Set the projection of this view. Warning! This code is not yet implemented. Function should not be used.
Name Type Description projectionol.proj.Projection | undefined The projection of the view.
-
experimental setResolution(resolution)
-
Set the resolution for this view.
Name Type Description resolutionnumber | undefined The resolution of the view.
-
experimental setRotation(rotation)
-
Set the rotation for this view.
Name Type Description rotationnumber | undefined The rotation of the view.
-
experimental inherited setValues(values)
-
Sets a collection of key-value pairs.
Name Type Description valuesObject.<string, *> Values.
-
experimental setZoom(zoom)
-
Zoom to a specific zoom level.
Name Type Description zoomnumber Zoom level.
-
experimental inherited un(type, listener, opt_this)
-
Unlisten for a certain type of event.
Name Type Argument Description typestring | Array.<string> The event type or array of event types.
listenerfunction The listener function.
thisObject <optional>
optional The object to use as
thisinlistener. -
experimental inherited unbind(key)
-
Removes a binding. Unbinding will set the unbound property to the current value. The object will not be notified, as the value has not changed.
Name Type Description keystring Key name.
-
experimental inherited unbindAll()
-
Removes all bindings.
-
experimental inherited unByKey(key)
-
Removes an event listener using the key returned by
on()oronce().Name Type Description keygoog.events.Key Key.
OpenLayers 3