Skip to main content

Marker

Marker class

@example
let location = new mapsvg.location({
geoPoint: new mapsvg.geoPoint({lat: 55.12, lng: 46.19}),
img: "/path/to/image.png"
});

let marker = new mapsvg.marker({
location: location,
mapsvg: mapInstance
});

// The marker is created but still not added to the map. Let's add it:
mapInstance.markerAdd(marker);

Hierarchy

Index

Constructors

constructor

  • Parameters

    • params: { height?: number; id?: string; location: Location; mapsvg: MapSVGMap; object?: Model; width?: number }

    Returns Marker

Properties

altAttr

altAttr: string

bubble

bubble: HTMLElement

bubbleMode

bubbleMode: boolean

centered

centered: boolean

optionaldetails

element

element: HTMLElement | SVGElement

events

events: Events

optionalgeoPoint

geoPoint?: GeoPoint

height

height: number

id

id: string

image

image: HTMLElement

label

label: HTMLElement

location

location: Location

optionalmapped

mapped?: boolean

mapsvg

mapsvg: MapSVGMap

optionalmoving

moving?: boolean

name

name: string = "marker"

optionalneedToRemove

needToRemove?: boolean

object

object: Model

optionalpopover

optionalscreenPoint

screenPoint?: ScreenPoint

selected

selected: boolean

src

src: string

optionalsvgPoint

svgPoint?: SVGPoint

optionaltooltip

tooltip?: Tooltip

visible

visible: boolean

width

width: number

Methods

adjustLabelScreenPosition

  • adjustLabelScreenPosition(): void
  • Adjust position of marker label


    Returns void

adjustScreenPosition

  • adjustScreenPosition(): void
  • Adjusts position of the Marker. Called on map zoom and on map container resize.


    Returns void

attr

  • attr(v1: any, v2?: any): string
  • Sets attribute of an SVG object


    Parameters

    • v1: any

      attribute name or object: {name: value, name: value}

    • v2: any = null

      value

    Returns string

delete

  • delete(): void
  • Deletes the Marker


    Returns void

deselect

  • deselect(): void
  • Deselect the Marker.


    Returns void

drawBubble

  • drawBubble(): void
  • Draw a choropleth bubble for the marker


    Returns void

getBBox

  • Get SVG bounding box of the Marker


    Returns ViewBox

getBubbleScreenPosition

  • getBubbleScreenPosition(): { x: number; y: number }
  • Returns screen point of the choropleth bubble


    Returns { x: number; y: number }

    • x: number
    • y: number

getBubbleSize

  • getBubbleSize(): number
  • Returns size of the choropleth bubble


    Returns number

getCenter

  • Returns center of an object in pixel coordinates


    Returns ScreenPoint

    • [x,y]

getCenterLatLng

  • Returns center of an object in geo-coordinates


    Parameters

    • yShift: any

    Returns GeoPoint

getCenterSVG

  • Returns center of an object in SVG coordinates


    Returns SVGPoint

getChoroplethColor

  • getChoroplethColor(): string
  • Returns color of the choropleth marker bubble


    Returns string

    color

getComputedStyle

  • getComputedStyle(prop: string, elem?: HTMLElement | SVGElement): string
  • Returns style of a given property of an SVG object


    Parameters

    • prop: string

      property name

    • optionalelem: HTMLElement | SVGElement

      SVG object

    Returns string

    • style

getData

getGeoBounds

  • Returns geo-bounds of an object - South-West & North-East points.


    Returns { ne: GeoPoint; sw: GeoPoint }

getOptions

  • getOptions(): { geoPoint: GeoPoint; id: string; src: string; svgPoint: SVGPoint }

getStyle

  • getStyle(prop: string): string
  • Returns style of a property of the SVG object


    Parameters

    • prop: string

      property name

    Returns string

hide

  • hide(): void
  • Hides the Marker


    Returns void

highlight

  • highlight(): void
  • Highlight the Marker. Used on mouseover.


    Returns void

inViewBox

  • inViewBox(): boolean
  • Check if the marker is inside of the viewBox


    Returns boolean

    boolean

isMoving

  • isMoving(): boolean
  • Returns boolean

moveSrceenPositionBy

  • moveSrceenPositionBy(deltaX: number, deltaY: number): void
  • Moves marker by given numbers


    Parameters

    • deltaX: number
    • deltaY: number

    Returns void

reload

  • reload(): void
  • Returns void

select

  • select(): void
  • Select the Marker.


    Returns void

setAltAttr

  • setAltAttr(): void
  • Set 'alt' attribute of the Marker


    Returns void

setBubbleMode

  • setBubbleMode(bubbleMode: boolean): void
  • Disable/enable BubbleMode for the marker


    Parameters

    • bubbleMode: boolean

    Returns void

setCentered

  • setCentered(on: boolean): void
  • Set centered propperty of the marker


    Parameters

    • on: boolean

    Returns void

setId

  • setId(id: string | number): void
  • Set ID of the Marker


    Parameters

    • id: string | number

    Returns void

setImage

  • setImage(src?: string, skipChangingLocationImage?: boolean): void
  • Set image of the Marker


    Parameters

    • optionalsrc: string
    • skipChangingLocationImage: boolean = false

    Returns void

setLabel

  • setLabel(html: string): void
  • Parameters

    • html: string

    Returns void

setMoving

  • setMoving(value: boolean): void
  • Parameters

    • value: boolean

    Returns void

setObject

  • setObject(obj: Model): void
  • Sets parent DB object of the Marker


    Parameters

    Returns void

setScreenPosition

  • setScreenPosition(x: number, y: number): void
  • Set position of the marker by given numbers


    Parameters

    • x: number
    • y: number

    Returns void

setSize

  • setSize(width: number, height: number): void
  • Parameters

    • width: number
    • height: number

    Returns void

setSvgPoint

  • Set x/y coordinates of the Marker


    Parameters

    Returns void

setSvgPointFromLocation

  • setSvgPointFromLocation(): void
  • Returns void

show

  • show(): void
  • Shows the Marker


    Returns void

unhighlight

  • unhighlight(): void
  • Unhighlight the Marker. Used on mouseout.


    Returns void

update

  • update(data: any): void
  • Update marker settings


    Parameters

    • data: any

      Options

    Returns void

updateVisibility

  • updateVisibility(): boolean
  • Set visibility of the marker


    Returns boolean

staticgetComputedStyle

  • getComputedStyle(prop: string, elem?: HTMLElement | SVGElement): string
  • Parameters

    • prop: string
    • optionalelem: HTMLElement | SVGElement

    Returns string