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
| Parameter | Type |
|---|---|
params | { height?: number; id?: string; location: Location; mapsvg: MapSVGMap; object?: Model; width?: number; } |
params.height? | number |
params.id? | string |
params.location | Location |
params.mapsvg | MapSVGMap |
params.object? | Model |
params.width? | number |
Returns
Marker
Overrides
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
| Parameter | Type | Default value | Description |
|---|---|---|---|
v1 | any | undefined | attribute name or object: {name: value, name: value} |
v2 | any | null | value |
Returns
string
Inherited from
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
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
- [x,y]
Inherited from
getCenterLatLng()
getCenterLatLng(yShift): GeoPoint;
Returns center of an object in geo-coordinates
Parameters
| Parameter | Type |
|---|---|
yShift | any |
Returns
Inherited from
getCenterSVG()
getCenterSVG(): SVGPoint;
Returns center of an object in SVG coordinates
Returns
Inherited from
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
| Parameter | Type | Description |
|---|---|---|
prop | string | property name |
elem? | HTMLElement | SVGElement | SVG object |
Returns
string
- style
Inherited from
getData()
getData(): Model;
Returns
getGeoBounds()
getGeoBounds(): object;
Returns geo-bounds of an object - South-West & North-East points.
Returns
object
ne
ne: GeoPoint;
sw
sw: GeoPoint;
Inherited from
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
| Parameter | Type | Description |
|---|---|---|
prop | string | property name |
Returns
string
Inherited from
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
isMarker()
isMarker(): this is Marker;
Returns
this is Marker
Inherited from
isMoving()
isMoving(): boolean;
Returns
boolean
isRegion()
isRegion(): this is Region;
Returns
this is Region
Inherited from
moveSrceenPositionBy()
moveSrceenPositionBy(deltaX, deltaY): void;
Moves marker by given numbers
Parameters
| Parameter | Type | Description |
|---|---|---|
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): void;
Disable/enable BubbleMode for the marker
Parameters
| Parameter | Type | Description |
|---|---|---|
bubbleMode | boolean |
Returns
void
setCentered()
setCentered(on): void;
Set centered propperty of the marker
Parameters
| Parameter | Type | Description |
|---|---|---|
on | boolean |
Returns
void
setId()
setId(id): void;
Set ID of the Marker
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | number |
Returns
void
Overrides
setImage()
setImage(src?, skipChangingLocationImage?): void;
Set image of the Marker
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
src? | string | undefined | |
skipChangingLocationImage? | boolean | false | - |
Returns
void
setLabel()
setLabel(html): void;
Parameters
| Parameter | Type |
|---|---|
html | string |
Returns
void
setMoving()
setMoving(value): void;
Parameters
| Parameter | Type |
|---|---|
value | boolean |
Returns
void
setObject()
setObject(obj): void;
Sets parent DB object of the Marker
Parameters
| Parameter | Type | Description |
|---|---|---|
obj | Model |
Returns
void
setScreenPosition()
setScreenPosition(x, y): void;
Set position of the marker by given numbers
Parameters
| Parameter | Type | Description |
|---|---|---|
x | number | |
y | number |
Returns
void
setSize()
setSize(width, height): void;
Parameters
| Parameter | Type |
|---|---|
width | number |
height | number |
Returns
void
setSvgPoint()
setSvgPoint(svgPoint): void;
Set x/y coordinates of the Marker
Parameters
| Parameter | Type | Description |
|---|---|---|
svgPoint | SVGPoint |
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
| Parameter | Type | Description |
|---|---|---|
data | any | Options |
Returns
void
updateVisibility()
updateVisibility(): boolean;
Set visibility of the marker
Returns
boolean
getComputedStyle()
static getComputedStyle(prop, elem?): string;
Parameters
| Parameter | Type |
|---|---|
prop | string |
elem? | HTMLElement | SVGElement |
Returns
string
Inherited from
Properties
altAttr
altAttr: string;
bubble
bubble: HTMLElement;
bubbleMode
bubbleMode: boolean;
centered
centered: boolean;
details?
optional details: DetailsController;
Inherited from
element
element: HTMLElement | SVGElement;
Inherited from
events
events: Events;
Inherited from
geoPoint?
optional geoPoint: GeoPoint;
height
height: number;
id
id: string;
Overrides
image
image: HTMLElement;
label
label: HTMLElement;
location
location: Location;
mapped?
optional mapped: boolean;
mapsvg
mapsvg: MapSVGMap;
Inherited from
moving?
optional moving: boolean;
name
name: string;
Overrides
needToRemove?
optional needToRemove: boolean;
object
object: Model;
popover?
optional popover: PopoverController;
Inherited from
screenPoint?
optional screenPoint: ScreenPoint;
selected
selected: boolean;
src
src: string;
svgPoint?
optional svgPoint: SVGPoint;
tooltip?
optional tooltip: Tooltip;
Inherited from
type
type: MapObjectType;
Overrides
visible
visible: boolean;
width
width: number;