Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IView

视图对象接口

Hierarchy

  • OlView
    • IView

Index

Properties

$owner

$owner: WebMap

Protected disposed

disposed: boolean

The object has already been disposed.

Methods

addEventListener

  • addEventListener(type: string, listener: Listener): void
  • Parameters

    • type: string
    • listener: Listener

    Returns void

adjustCenter

  • adjustCenter(deltaCoordinates: Coordinate): void
  • Adds relative coordinates to the center of the view. Any extent constraint will apply.

    Parameters

    • deltaCoordinates: Coordinate

    Returns void

adjustCenterInternal

  • adjustCenterInternal(deltaCoordinates: Coordinate): void
  • Adds relative coordinates to the center of the view. Any extent constraint will apply.

    Parameters

    • deltaCoordinates: Coordinate

    Returns void

adjustResolution

  • adjustResolution(ratio: number, opt_anchor?: Coordinate): void
  • Multiply the view resolution by a ratio, optionally using an anchor. Any resolution constraint will apply.

    Parameters

    • ratio: number
    • Optional opt_anchor: Coordinate

    Returns void

adjustResolutionInternal

  • adjustResolutionInternal(ratio: number, opt_anchor?: Coordinate): void
  • Multiply the view resolution by a ratio, optionally using an anchor. Any resolution constraint will apply.

    Parameters

    • ratio: number
    • Optional opt_anchor: Coordinate

    Returns void

adjustRotation

  • adjustRotation(delta: number, opt_anchor?: Coordinate): void
  • Adds a value to the view rotation, optionally using an anchor. Any rotation constraint will apply.

    Parameters

    • delta: number
    • Optional opt_anchor: Coordinate

    Returns void

adjustRotationInternal

  • adjustRotationInternal(delta: number, opt_anchor?: Coordinate): void
  • Parameters

    • delta: number
    • Optional opt_anchor: Coordinate

    Returns void

adjustZoom

  • adjustZoom(delta: number, opt_anchor?: Coordinate): void
  • Adds a value to the view zoom level, optionally using an anchor. Any resolution constraint will apply.

    Parameters

    • delta: number
    • Optional opt_anchor: Coordinate

    Returns void

animate

  • animate(...var_args: (AnimationOptions | ((p0: boolean) => void))[]): void
  • Animate the view. The view's center, zoom (or resolution), and rotation can be animated for smooth transitions between view states. For example, to animate the view to a new zoom level: By default, the animation lasts one second and uses in-and-out easing. You can customize this behavior by including duration (in milliseconds) and easing options (see {@link module:ol/easing}). To chain together multiple animations, call the method with multiple animation objects. For example, to first zoom and then pan: If you provide a function as the last argument to the animate method, it will get called at the end of an animation series. The callback will be called with true if the animation series completed on its own or false if it was cancelled. Animations are cancelled by user interactions (e.g. dragging the map) or by calling view.setCenter(), view.setResolution(), or view.setRotation() (or another method that calls one of these).

    Parameters

    • Rest ...var_args: (AnimationOptions | ((p0: boolean) => void))[]

    Returns void

animateInternal

  • animateInternal(...var_args: (AnimationOptions | ((p0: boolean) => void))[]): void
  • Parameters

    • Rest ...var_args: (AnimationOptions | ((p0: boolean) => void))[]

    Returns void

applyOptions_

  • applyOptions_(options: ViewOptions): void
  • Set up the view with the given options.

    Parameters

    • options: ViewOptions

    Returns void

beginInteraction

  • beginInteraction(): void
  • Notify the View that an interaction has started. The view state will be resolved to a stable one if needed (depending on its constraints).

    Returns void

calculateCenterRotate

  • calculateCenterRotate(rotation: number, anchor: Coordinate): Coordinate
  • Parameters

    • rotation: number
    • anchor: Coordinate

    Returns Coordinate

calculateCenterZoom

  • calculateCenterZoom(resolution: number, anchor: Coordinate): Coordinate
  • Parameters

    • resolution: number
    • anchor: Coordinate

    Returns Coordinate

calculateExtent

  • calculateExtent(opt_size?: Size): Extent
  • 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().

    Parameters

    • Optional opt_size: Size

    Returns Extent

calculateExtentInternal

  • calculateExtentInternal(opt_size?: Size): Extent
  • Parameters

    • Optional opt_size: Size

    Returns Extent

cancelAnimations

  • cancelAnimations(): void
  • Cancel any ongoing animations.

    Returns void

centerOn

  • centerOn(coordinate: Coordinate, size: Size, position: Pixel): void
  • Center on coordinate and view position.

    Parameters

    • coordinate: Coordinate
    • size: Size
    • position: Pixel

    Returns void

centerOnInternal

  • centerOnInternal(coordinate: Coordinate, size: Size, position: Pixel): void
  • Parameters

    • coordinate: Coordinate
    • size: Size
    • position: Pixel

    Returns void

changed

  • changed(): void
  • Increases the revision counter and dispatches a 'change' event.

    Returns void

dispatchEvent

  • dispatchEvent(event: string | default): boolean
  • 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.

    Parameters

    • event: string | default

    Returns boolean

dispose

  • dispose(): void
  • Clean up.

    Returns void

disposeInternal

  • disposeInternal(): void
  • Clean up.

    Returns void

endInteraction

  • endInteraction(opt_duration?: number, opt_resolutionDirection?: number, opt_anchor?: Coordinate): void
  • Notify the View that an interaction has ended. The view state will be resolved to a stable one if needed (depending on its constraints).

    Parameters

    • Optional opt_duration: number
    • Optional opt_resolutionDirection: number
    • Optional opt_anchor: Coordinate

    Returns void

endInteractionInternal

  • endInteractionInternal(opt_duration?: number, opt_resolutionDirection?: number, opt_anchor?: Coordinate): void
  • Notify the View that an interaction has ended. The view state will be resolved to a stable one if needed (depending on its constraints).

    Parameters

    • Optional opt_duration: number
    • Optional opt_resolutionDirection: number
    • Optional opt_anchor: Coordinate

    Returns void

fit

  • fit(geometryOrExtent: Extent | default, opt_options?: FitOptions): void
  • 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.

    Parameters

    • geometryOrExtent: Extent | default
    • Optional opt_options: FitOptions

    Returns void

fitInternal

  • fitInternal(geometry: default, opt_options?: FitOptions): void
  • Parameters

    • geometry: default
    • Optional opt_options: FitOptions

    Returns void

get

  • get(key: string): any
  • Gets a value.

    Parameters

    • key: string

    Returns any

getAnimating

  • getAnimating(): boolean
  • Determine if the view is being animated.

    Returns boolean

getCenter

  • getCenter(): Coordinate
  • Get the view center.

    Returns Coordinate

getCenterInternal

  • getCenterInternal(): Coordinate
  • Get the view center without transforming to user projection.

    Returns Coordinate

getConstrainResolution

  • getConstrainResolution(): boolean
  • Returns boolean

getConstrainedCenter

  • getConstrainedCenter(targetCenter: Coordinate, opt_targetResolution?: number): Coordinate
  • Get a valid position for the view center according to the current constraints.

    Parameters

    • targetCenter: Coordinate
    • Optional opt_targetResolution: number

    Returns Coordinate

getConstrainedResolution

  • getConstrainedResolution(targetResolution: number, opt_direction?: number): number
  • Get a valid resolution according to the current view constraints.

    Parameters

    • targetResolution: number
    • Optional opt_direction: number

    Returns number

getConstrainedZoom

  • getConstrainedZoom(targetZoom: number, opt_direction?: number): number
  • Get a valid zoom level according to the current view constraints.

    Parameters

    • targetZoom: number
    • Optional opt_direction: number

    Returns number

getConstraints

  • getConstraints(): Constraints
  • Returns Constraints

getHints

  • getHints(opt_hints?: number[]): number[]
  • Parameters

    • Optional opt_hints: number[]

    Returns number[]

getInteracting

  • getInteracting(): boolean
  • Determine if the user is interacting with the view, such as panning or zooming.

    Returns boolean

getKeys

  • getKeys(): string[]
  • Get a list of object property names.

    Returns string[]

getListeners

  • getListeners(type: string): Listener[]
  • Get the listeners for a specified event type. Listeners are returned in the order that they will be called in.

    Parameters

    • type: string

    Returns Listener[]

getMaxResolution

  • getMaxResolution(): number
  • Get the maximum resolution of the view.

    Returns number

getMaxZoom

  • getMaxZoom(): number
  • Get the maximum zoom level for the view.

    Returns number

getMinResolution

  • getMinResolution(): number
  • Get the minimum resolution of the view.

    Returns number

getMinZoom

  • getMinZoom(): number
  • Get the minimum zoom level for the view.

    Returns number

getProjection

  • getProjection(): default
  • Get the view projection.

    Returns default

getProperties

  • getProperties(): {}
  • Get an object of all property names and values.

    Returns {}

    • [key: string]: any

getResolution

  • getResolution(): number
  • Get the view resolution.

    Returns number

getResolutionForExtent

  • getResolutionForExtent(extent: Extent, opt_size?: Size): number
  • Get the resolution for a provided extent (in map units) and size (in pixels).

    Parameters

    • extent: Extent
    • Optional opt_size: Size

    Returns number

getResolutionForExtentInternal

  • getResolutionForExtentInternal(extent: Extent, opt_size?: Size): number
  • Get the resolution for a provided extent (in map units) and size (in pixels).

    Parameters

    • extent: Extent
    • Optional opt_size: Size

    Returns number

getResolutionForValueFunction

  • getResolutionForValueFunction(opt_power?: number): (p0: number) => number
  • Return a function that returns a value between 0 and 1 for a resolution. Exponential scaling is assumed.

    Parameters

    • Optional opt_power: number

    Returns (p0: number) => number

      • (p0: number): number
      • Parameters

        • p0: number

        Returns number

getResolutionForZoom

  • getResolutionForZoom(zoom: number): number
  • Get the resolution for a zoom level.

    Parameters

    • zoom: number

    Returns number

getResolutions

  • getResolutions(): number[]
  • Get the resolutions for the view. This returns the array of resolutions passed to the constructor of the View, or undefined if none were given.

    Returns number[]

getRevision

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

    Returns number

getRotation

  • getRotation(): number
  • Get the view rotation.

    Returns number

getState

  • getState(): State
  • Returns State

getUpdatedOptions_

  • getUpdatedOptions_(newOptions: ViewOptions): ViewOptions
  • Get an updated version of the view options used to construct the view. The current resolution (or zoom), center, and rotation are applied to any stored options. The provided options can be used to apply new min/max zoom or resolution limits.

    Parameters

    • newOptions: ViewOptions

    Returns ViewOptions

getValueForResolutionFunction

  • getValueForResolutionFunction(opt_power?: number): (p0: number) => number
  • Return a function that returns a resolution for a value between 0 and 1. Exponential scaling is assumed.

    Parameters

    • Optional opt_power: number

    Returns (p0: number) => number

      • (p0: number): number
      • Parameters

        • p0: number

        Returns number

getZoom

  • getZoom(): number
  • Get the current zoom level. This method may return non-integer zoom levels if the view does not constrain the resolution, or if an interaction or animation is underway.

    Returns number

getZoomForResolution

  • getZoomForResolution(resolution: number): number
  • Get the zoom level for a resolution.

    Parameters

    • resolution: number

    Returns number

hasListener

  • hasListener(opt_type?: string): boolean
  • Parameters

    • Optional opt_type: string

    Returns boolean

hasProperties

  • hasProperties(): boolean
  • Returns boolean

isDef

  • isDef(): boolean
  • Returns boolean

notify

  • notify(key: string, oldValue: any): void
  • Parameters

    • key: string
    • oldValue: any

    Returns void

on

  • on(type: string | string[], listener: (p0: any) => any): EventsKey | EventsKey[]
  • on(type: "change", listener: (evt: default) => void): EventsKey
  • on(type: "change:center", listener: (evt: ObjectEvent) => void): EventsKey
  • on(type: "change:resolution", listener: (evt: ObjectEvent) => void): EventsKey
  • on(type: "change:rotation", listener: (evt: ObjectEvent) => void): EventsKey
  • on(type: "error", listener: (evt: default) => void): EventsKey
  • on(type: "propertychange", listener: (evt: ObjectEvent) => void): EventsKey
  • Parameters

    • type: string | string[]
    • listener: (p0: any) => any
        • (p0: any): any
        • Parameters

          • p0: any

          Returns any

    Returns EventsKey | EventsKey[]

  • Parameters

    • type: "change"
    • listener: (evt: default) => void
        • (evt: default): void
        • Parameters

          • evt: default

          Returns void

    Returns EventsKey

  • Parameters

    • type: "change:center"
    • listener: (evt: ObjectEvent) => void
        • (evt: ObjectEvent): void
        • Parameters

          • evt: ObjectEvent

          Returns void

    Returns EventsKey

  • Parameters

    • type: "change:resolution"
    • listener: (evt: ObjectEvent) => void
        • (evt: ObjectEvent): void
        • Parameters

          • evt: ObjectEvent

          Returns void

    Returns EventsKey

  • Parameters

    • type: "change:rotation"
    • listener: (evt: ObjectEvent) => void
        • (evt: ObjectEvent): void
        • Parameters

          • evt: ObjectEvent

          Returns void

    Returns EventsKey

  • Parameters

    • type: "error"
    • listener: (evt: default) => void
        • (evt: default): void
        • Parameters

          • evt: default

          Returns void

    Returns EventsKey

  • Parameters

    • type: "propertychange"
    • listener: (evt: ObjectEvent) => void
        • (evt: ObjectEvent): void
        • Parameters

          • evt: ObjectEvent

          Returns void

    Returns EventsKey

once

  • once(type: string | string[], listener: (p0: any) => any): EventsKey | EventsKey[]
  • once(type: "change", listener: (evt: default) => void): EventsKey
  • once(type: "change:center", listener: (evt: ObjectEvent) => void): EventsKey
  • once(type: "change:resolution", listener: (evt: ObjectEvent) => void): EventsKey
  • once(type: "change:rotation", listener: (evt: ObjectEvent) => void): EventsKey
  • once(type: "error", listener: (evt: default) => void): EventsKey
  • once(type: "propertychange", listener: (evt: ObjectEvent) => void): EventsKey
  • Parameters

    • type: string | string[]
    • listener: (p0: any) => any
        • (p0: any): any
        • Parameters

          • p0: any

          Returns any

    Returns EventsKey | EventsKey[]

  • Parameters

    • type: "change"
    • listener: (evt: default) => void
        • (evt: default): void
        • Parameters

          • evt: default

          Returns void

    Returns EventsKey

  • Parameters

    • type: "change:center"
    • listener: (evt: ObjectEvent) => void
        • (evt: ObjectEvent): void
        • Parameters

          • evt: ObjectEvent

          Returns void

    Returns EventsKey

  • Parameters

    • type: "change:resolution"
    • listener: (evt: ObjectEvent) => void
        • (evt: ObjectEvent): void
        • Parameters

          • evt: ObjectEvent

          Returns void

    Returns EventsKey

  • Parameters

    • type: "change:rotation"
    • listener: (evt: ObjectEvent) => void
        • (evt: ObjectEvent): void
        • Parameters

          • evt: ObjectEvent

          Returns void

    Returns EventsKey

  • Parameters

    • type: "error"
    • listener: (evt: default) => void
        • (evt: default): void
        • Parameters

          • evt: default

          Returns void

    Returns EventsKey

  • Parameters

    • type: "propertychange"
    • listener: (evt: ObjectEvent) => void
        • (evt: ObjectEvent): void
        • Parameters

          • evt: ObjectEvent

          Returns void

    Returns EventsKey

removeEventListener

  • removeEventListener(type: string, listener: Listener): void
  • Parameters

    • type: string
    • listener: Listener

    Returns void

resolveConstraints

  • resolveConstraints(opt_duration?: number, opt_resolutionDirection?: number, opt_anchor?: Coordinate): void
  • If any constraints need to be applied, an animation will be triggered. This is typically done on interaction end. Note: calling this with a duration of 0 will apply the constrained values straight away, without animation.

    Parameters

    • Optional opt_duration: number
    • Optional opt_resolutionDirection: number
    • Optional opt_anchor: Coordinate

    Returns void

set

  • set(key: string, value: any, opt_silent?: boolean): void
  • Sets a value.

    Parameters

    • key: string
    • value: any
    • Optional opt_silent: boolean

    Returns void

setCenter

  • setCenter(center: Coordinate): void
  • Set the center of the current view. Any extent constraint will apply.

    Parameters

    • center: Coordinate

    Returns void

setCenterInternal

  • setCenterInternal(center: Coordinate): void
  • Set the center using the view projection (not the user projection).

    Parameters

    • center: Coordinate

    Returns void

setConstrainResolution

  • setConstrainResolution(enabled: boolean): void
  • Set whether the view shoud allow intermediary zoom levels.

    Parameters

    • enabled: boolean

    Returns void

setHint

  • setHint(hint: ViewHint, delta: number): number
  • Parameters

    • hint: ViewHint
    • delta: number

    Returns number

setMaxZoom

  • setMaxZoom(zoom: number): void
  • Set a new maximum zoom level for the view.

    Parameters

    • zoom: number

    Returns void

setMinZoom

  • setMinZoom(zoom: number): void
  • Set a new minimum zoom level for the view.

    Parameters

    • zoom: number

    Returns void

setProperties

  • setProperties(values: {}, opt_silent?: boolean): void
  • 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).

    Parameters

    • values: {}
      • [key: string]: any
    • Optional opt_silent: boolean

    Returns void

setResolution

  • setResolution(resolution: number): void
  • Set the resolution for this view. Any resolution constraint will apply.

    Parameters

    • resolution: number

    Returns void

setRotation

  • setRotation(rotation: number): void
  • Set the rotation for this view. Any rotation constraint will apply.

    Parameters

    • rotation: number

    Returns void

setViewportSize

  • setViewportSize(opt_size?: Size): void
  • Stores the viewport size on the view. The viewport size is not read every time from the DOM to avoid performance hit and layout reflow. This should be done on map size change. Note: the constraints are not resolved during an animation to avoid stopping it

    Parameters

    • Optional opt_size: Size

    Returns void

setZoom

  • setZoom(zoom: number): void
  • Zoom to a specific zoom level. Any resolution constrain will apply.

    Parameters

    • zoom: number

    Returns void

un

  • un(type: string | string[], listener: (p0: any) => any): void
  • un(type: "change", listener: (evt: default) => void): void
  • un(type: "change:center", listener: (evt: ObjectEvent) => void): void
  • un(type: "change:resolution", listener: (evt: ObjectEvent) => void): void
  • un(type: "change:rotation", listener: (evt: ObjectEvent) => void): void
  • un(type: "error", listener: (evt: default) => void): void
  • un(type: "propertychange", listener: (evt: ObjectEvent) => void): void
  • Parameters

    • type: string | string[]
    • listener: (p0: any) => any
        • (p0: any): any
        • Parameters

          • p0: any

          Returns any

    Returns void

  • Parameters

    • type: "change"
    • listener: (evt: default) => void
        • (evt: default): void
        • Parameters

          • evt: default

          Returns void

    Returns void

  • Parameters

    • type: "change:center"
    • listener: (evt: ObjectEvent) => void
        • (evt: ObjectEvent): void
        • Parameters

          • evt: ObjectEvent

          Returns void

    Returns void

  • Parameters

    • type: "change:resolution"
    • listener: (evt: ObjectEvent) => void
        • (evt: ObjectEvent): void
        • Parameters

          • evt: ObjectEvent

          Returns void

    Returns void

  • Parameters

    • type: "change:rotation"
    • listener: (evt: ObjectEvent) => void
        • (evt: ObjectEvent): void
        • Parameters

          • evt: ObjectEvent

          Returns void

    Returns void

  • Parameters

    • type: "error"
    • listener: (evt: default) => void
        • (evt: default): void
        • Parameters

          • evt: default

          Returns void

    Returns void

  • Parameters

    • type: "propertychange"
    • listener: (evt: ObjectEvent) => void
        • (evt: ObjectEvent): void
        • Parameters

          • evt: ObjectEvent

          Returns void

    Returns void

unset

  • unset(key: string, opt_silent?: boolean): void
  • Unsets a property.

    Parameters

    • key: string
    • Optional opt_silent: boolean

    Returns void

updateAnimations_

  • updateAnimations_(): void
  • Update all animations.

    Returns void

Generated using TypeDoc