PilotGaea 2D O'view
    正在準備搜尋索引...

    類別 View

    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.

    View options.

    stable

    層級 (查看層級一覽)

    索引

    方法

    • Removes an event listener using the key returned by on() or once().

      參數

      • key: Object | Object[]

        The key returned by on() or once() (or an array of keys).

      回傳 void

      stable

    • Get the constrained resolution of this view.

      參數

      • resolution: number

        Resolution.

      • 可選opt_delta: number

        Delta. Default is 0.

      • 可選opt_direction: number

        Direction. Default is 0.

      回傳 number

      Constrained resolution.

    • Get the constrained rotation of this view.

      參數

      • rotation: number

        Rotation.

      • 可選opt_delta: number

        Delta. Default is 0.

      回傳 number

      Constrained rotation.

    • Get the view center.

      回傳 Coordinate

      The center of the view.

      stable

    • Calculate the extent for the current view state and the passed size. The size is the pixel dimensions of the box into which the calculated extent should fit. In most cases you want to get the extent of the entire map, that is map.getSize().

      參數

      • size: Size

        Box pixel size.

      回傳 Extent

      Extent.

      stable

    • Get the maximum resolution of the view.

      回傳 number

      The maximum resolution of the view.

    • Get the minimum resolution of the view.

      回傳 number

      The minimum resolution of the view.

    • Get the view projection.

      回傳 Projection

      The projection of the view.

      stable

    • Get the view resolution.

      回傳 number

      The resolution of the view.

      stable

    • Get the resolutions for the view. This returns the array of resolutions passed to the constructor of the {ol.View}, or undefined if none were given.

      回傳 number[]

      The resolutions of the view.

      stable

    • Get the view rotation.

      回傳 number

      The rotation of the view in radians.

      stable

    • Get the current zoom level. Return undefined if the current resolution is undefined or not within the "resolution constraints".

      回傳 number

      Zoom.

      stable

    • 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.

      參數

      回傳 void

    • Center on coordinate and view position.

      參數

      • coordinate: Coordinate

        Coordinate.

      • size: Size

        Box pixel size.

      • position: Pixel

        Position on the view to center on.

      回傳 void

    • Rotate the view around a given coordinate.

      參數

      • rotation: number

        New rotation value for the view.

      • 可選opt_anchor: Coordinate

        The rotation center.

      回傳 void

      stable

    • Set the center of the current view.

      參數

      回傳 void

      stable

    • Set the resolution for this view.

      參數

      • resolution: number

        The resolution of the view.

      回傳 void

      stable

    • Set the rotation for this view.

      參數

      • rotation: number

        The rotation of the view in radians.

      回傳 void

      stable

    • Zoom to a specific zoom level.

      參數

      • zoom: number

        Zoom level.

      回傳 void

      stable

    • Animate the view. The view's center, zoom (or resolution), and rotation can be animated for smooth transitions between view states.

      參數

      回傳 void

      experimental

    • Gets a value.

      參數

      • key: string

        Key name.

      回傳 any

      Value.

      stable

    • Get a list of object property names.

      回傳 string[]

      List of property names.

      stable

    • Get an object of all property names and values.

      回傳 { [k: string]: any }

      Object.

      stable

    • Sets a value.

      參數

      • key: string

        Key name.

      • value: any

        Value.

      • 可選opt_silent: boolean

        Update without triggering an event.

      回傳 void

      stable

    • Sets a collection of key-value pairs. Note that this changes any existing properties and adds new ones (it does not remove any existing properties).

      參數

      • values: { [k: string]: any }

        Values.

      • 可選opt_silent: boolean

        Update without triggering an event.

      回傳 void

      stable

    • Unsets a property.

      參數

      • key: string

        Key name.

      • 可選opt_silent: boolean

        Unset without triggering an event.

      回傳 void

      stable

    • Increases the revision counter and dispatches a 'change' event.

      回傳 void

    • 函數

      Dispatches an event and calls all listeners listening for events of this type. The event parameter can either be a string or an Object with a type property.

      參數

      回傳 void

    • Get the version number for this object. Each time the object is modified, its version number will be incremented.

      回傳 number

      Revision.

    • Listen for a certain type of event.

      參數

      • type: string | string[]

        The event type or array of event types.

      • listener: Function

        The listener function.

      • 可選opt_this: Object

        The object to use as this in listener.

      回傳 Object | Object[]

      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.

      stable

    • Listen once for a certain type of event.

      參數

      • type: string | string[]

        The event type or array of event types.

      • listener: Function

        The listener function.

      • 可選opt_this: Object

        The object to use as this in listener.

      回傳 Object | Object[]

      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.

      stable

    • Unlisten for a certain type of event.

      參數

      • type: string | string[]

        The event type or array of event types.

      • listener: Function

        The listener function.

      • 可選opt_this: Object

        The object which was used as this by the listener.

      回傳 void

      stable

    • 函數

      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.

      參數

      • key: Object | Object[]

        The key returned by on() or once() (or an array of keys).

      回傳 void

      stable

    構造函數

    • 參數

      回傳 View

      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.

      stable