Skip to main content

Class: 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);

Extends

Constructors

Constructor

new Marker(params): Marker;

Parameters

ParameterType
params{ height?: number; id?: string; location: Location; mapsvg: MapSVGMap; object?: Model; width?: number; }
params.height?number
params.id?string
params.locationLocation
params.mapsvgMapSVGMap
params.object?Model
params.width?number

Returns

Marker

Overrides

MapObject.constructor

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, v2): string;

Sets attribute of an SVG object

Parameters

ParameterTypeDefault valueDescription
v1anyundefinedattribute name or object: {name: value, name: value}
v2anynullvalue

Returns

string

Inherited from

MapObject.attr


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()

getBBox(): ViewBox;

Get SVG bounding box of the Marker

Returns

ViewBox

Overrides

MapObject.getBBox

getBubbleScreenPosition()

getBubbleScreenPosition(): object;

Returns screen point of the choropleth bubble

Returns

object

x
x: number;
y
y: number;

getBubbleSize()

getBubbleSize(): number;

Returns size of the choropleth bubble

Returns

number


getCenter()

getCenter(): ScreenPoint;

Returns center of an object in pixel coordinates

Returns

ScreenPoint

  • [x,y]

Inherited from

MapObject.getCenter


getCenterLatLng()

getCenterLatLng(yShift): GeoPoint;

Returns center of an object in geo-coordinates

Parameters

ParameterType
yShiftany

Returns

GeoPoint

Inherited from

MapObject.getCenterLatLng


getCenterSVG()

getCenterSVG(): SVGPoint;

Returns center of an object in SVG coordinates

Returns

SVGPoint

Inherited from

MapObject.getCenterSVG


getChoroplethColor()

getChoroplethColor(): string;

Returns color of the choropleth marker bubble

Returns

string

color


getComputedStyle()

getComputedStyle(prop, elem?): string;

Returns style of a given property of an SVG object

Parameters

ParameterTypeDescription
propstringproperty name
elem?HTMLElement | SVGElementSVG object

Returns

string

  • style

Inherited from

MapObject.getComputedStyle


getData()

getData(): Model;

Returns

Model


getGeoBounds()

getGeoBounds(): object;

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

Returns

object

ne
ne: GeoPoint;
sw
sw: GeoPoint;

Inherited from

MapObject.getGeoBounds


getOptions()

getOptions(): object;

Get Marker options

Returns

object

geoPoint
geoPoint: GeoPoint;
id
id: string;
src
src: string;
svgPoint
svgPoint: SVGPoint;

getStyle()

getStyle(prop): string;

Returns style of a property of the SVG object

Parameters

ParameterTypeDescription
propstringproperty name

Returns

string

Inherited from

MapObject.getStyle


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


isCluster()

isCluster(): this is MarkerCluster;

Returns

this is MarkerCluster

Inherited from

MapObject.isCluster


isMarker()

isMarker(): this is Marker;

Returns

this is Marker

Inherited from

MapObject.isMarker


isMoving()

isMoving(): boolean;

Returns

boolean


isRegion()

isRegion(): this is Region;

Returns

this is Region

Inherited from

MapObject.isRegion


moveSrceenPositionBy()

moveSrceenPositionBy(deltaX, deltaY): void;

Moves marker by given numbers

Parameters

ParameterTypeDescription
deltaXnumber
deltaYnumber

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): void;

Disable/enable BubbleMode for the marker

Parameters

ParameterTypeDescription
bubbleModeboolean

Returns

void


setCentered()

setCentered(on): void;

Set centered propperty of the marker

Parameters

ParameterTypeDescription
onboolean

Returns

void


setId()

setId(id): void;

Set ID of the Marker

Parameters

ParameterTypeDescription
idstring | number

Returns

void

Overrides

MapObject.setId


setImage()

setImage(src?, skipChangingLocationImage?): void;

Set image of the Marker

Parameters

ParameterTypeDefault valueDescription
src?stringundefined
skipChangingLocationImage?booleanfalse-

Returns

void


setLabel()

setLabel(html): void;

Parameters

ParameterType
htmlstring

Returns

void


setMoving()

setMoving(value): void;

Parameters

ParameterType
valueboolean

Returns

void


setObject()

setObject(obj): void;

Sets parent DB object of the Marker

Parameters

ParameterTypeDescription
objModel

Returns

void


setScreenPosition()

setScreenPosition(x, y): void;

Set position of the marker by given numbers

Parameters

ParameterTypeDescription
xnumber
ynumber

Returns

void


setSize()

setSize(width, height): void;

Parameters

ParameterType
widthnumber
heightnumber

Returns

void


setSvgPoint()

setSvgPoint(svgPoint): void;

Set x/y coordinates of the Marker

Parameters

ParameterTypeDescription
svgPointSVGPoint

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): void;

Update marker settings

Parameters

ParameterTypeDescription
dataanyOptions

Returns

void


updateVisibility()

updateVisibility(): boolean;

Set visibility of the marker

Returns

boolean


getComputedStyle()

static getComputedStyle(prop, elem?): string;

Parameters

ParameterType
propstring
elem?HTMLElement | SVGElement

Returns

string

Inherited from

MapObject.getComputedStyle

Properties

altAttr

altAttr: string;

bubble

bubble: HTMLElement;

bubbleMode

bubbleMode: boolean;

centered

centered: boolean;

details?

optional details: DetailsController;

Inherited from

MapObject.details


element

element: HTMLElement | SVGElement;

Inherited from

MapObject.element


events

events: Events;

Inherited from

MapObject.events


geoPoint?

optional geoPoint: GeoPoint;

height

height: number;

id

id: string;

Overrides

MapObject.id


image

image: HTMLElement;

label

label: HTMLElement;

location

location: Location;

mapped?

optional mapped: boolean;

mapsvg

mapsvg: MapSVGMap;

Inherited from

MapObject.mapsvg


moving?

optional moving: boolean;

name

name: string;

Overrides

MapObject.name


needToRemove?

optional needToRemove: boolean;

object

object: Model;

popover?

optional popover: PopoverController;

Inherited from

MapObject.popover


screenPoint?

optional screenPoint: ScreenPoint;

selected

selected: boolean;

src

src: string;

svgPoint?

optional svgPoint: SVGPoint;

tooltip?

optional tooltip: Tooltip;

Inherited from

MapObject.tooltip


type

type: MapObjectType;

Overrides

MapObject.type


visible

visible: boolean;

width

width: number;