Rename marker types for clarity

- Add "Marker" suffix
- Rename regular marker to "PointMarker"
This commit is contained in:
James Lyne 2022-01-13 14:06:18 +00:00
parent 323b700568
commit 7cd21a19e2
18 changed files with 94 additions and 94 deletions

View File

@ -22,7 +22,7 @@ import {createArea, updateArea} from "@/util/areas";
import LiveAtlasLayerGroup from "@/leaflet/layer/LiveAtlasLayerGroup";
import LiveAtlasPolygon from "@/leaflet/vector/LiveAtlasPolygon";
import LiveAtlasPolyline from "@/leaflet/vector/LiveAtlasPolyline";
import {LiveAtlasArea, LiveAtlasMarkerSet} from "@/index";
import {LiveAtlasAreaMarker, LiveAtlasMarkerSet} from "@/index";
import {nonReactiveState} from "@/store/state";
export default defineComponent({
@ -52,7 +52,7 @@ export default defineComponent({
createAreas = () => {
const converter = currentMap.value!.locationToLatLng.bind(currentMap.value);
nonReactiveState.markers.get(props.set.id)!.areas.forEach((area: LiveAtlasArea, id: string) => {
nonReactiveState.markers.get(props.set.id)!.areas.forEach((area: LiveAtlasAreaMarker, id: string) => {
const layer = createArea(area, converter);
layers.set(id, layer);
@ -82,7 +82,7 @@ export default defineComponent({
if(update.removed) {
deleteArea(update.id);
} else {
const layer = updateArea(layers.get(update.id), update.payload as LiveAtlasArea, converter);
const layer = updateArea(layers.get(update.id), update.payload as LiveAtlasAreaMarker, converter);
if(!layers.has(update.id)) {
props.layerGroup.addLayer(layer);

View File

@ -22,7 +22,7 @@ import {createCircle, updateCircle} from "@/util/circles";
import LiveAtlasPolyline from "@/leaflet/vector/LiveAtlasPolyline";
import LiveAtlasPolygon from "@/leaflet/vector/LiveAtlasPolygon";
import LiveAtlasLayerGroup from "@/leaflet/layer/LiveAtlasLayerGroup";
import {LiveAtlasCircle, LiveAtlasMarkerSet} from "@/index";
import {LiveAtlasCircleMarker, LiveAtlasMarkerSet} from "@/index";
import {nonReactiveState} from "@/store/state";
export default defineComponent({
@ -52,7 +52,7 @@ export default defineComponent({
createCircles = () => {
const converter = currentMap.value!.locationToLatLng.bind(store.state.currentMap);
nonReactiveState.markers.get(props.set.id)!.circles.forEach((circle: LiveAtlasCircle, id: string) => {
nonReactiveState.markers.get(props.set.id)!.circles.forEach((circle: LiveAtlasCircleMarker, id: string) => {
const layer = createCircle(circle, converter);
layers.set(id, layer);
@ -82,7 +82,7 @@ export default defineComponent({
if(update.removed) {
deleteCircle(update.id);
} else {
const layer = updateCircle(layers.get(update.id), update.payload as LiveAtlasCircle, converter)
const layer = updateCircle(layers.get(update.id), update.payload as LiveAtlasCircleMarker, converter)
if(!layers.has(update.id)) {
props.layerGroup.addLayer(layer);

View File

@ -21,7 +21,7 @@ import {ActionTypes} from "@/store/action-types";
import {createLine, updateLine} from "@/util/lines";
import LiveAtlasPolyline from "@/leaflet/vector/LiveAtlasPolyline";
import LiveAtlasLayerGroup from "@/leaflet/layer/LiveAtlasLayerGroup";
import {LiveAtlasLine, LiveAtlasMarkerSet} from "@/index";
import {LiveAtlasLineMarker, LiveAtlasMarkerSet} from "@/index";
import {nonReactiveState} from "@/store/state";
export default defineComponent({
@ -51,7 +51,7 @@ export default defineComponent({
createLines = () => {
const converter = currentMap.value!.locationToLatLng.bind(store.state.currentMap);
nonReactiveState.markers.get(props.set.id)!.lines.forEach((line: LiveAtlasLine, id: string) => {
nonReactiveState.markers.get(props.set.id)!.lines.forEach((line: LiveAtlasLineMarker, id: string) => {
const layer = createLine(line, converter);
layers.set(id, layer);
@ -81,7 +81,7 @@ export default defineComponent({
if(update.removed) {
deleteLine(update.id);
} else {
const layer = updateLine(layers.get(update.id), update.payload as LiveAtlasLine, converter)
const layer = updateLine(layers.get(update.id), update.payload as LiveAtlasLineMarker, converter)
if(!layers.has(update.id)) {
props.layerGroup.addLayer(layer);

View File

@ -21,7 +21,7 @@ import {useStore} from "@/store";
import {ActionTypes} from "@/store/action-types";
import {createMarker, updateMarker} from "@/util/markers";
import LiveAtlasLayerGroup from "@/leaflet/layer/LiveAtlasLayerGroup";
import {LiveAtlasMarker, LiveAtlasMarkerSet} from "@/index";
import {LiveAtlasPointMarker, LiveAtlasMarkerSet} from "@/index";
import {nonReactiveState} from "@/store/state";
export default defineComponent({
@ -51,7 +51,7 @@ export default defineComponent({
createMarkers = () => {
const converter = currentMap.value!.locationToLatLng.bind(store.state.currentMap);
nonReactiveState.markers.get(props.set.id)!.markers.forEach((marker: LiveAtlasMarker, id: string) => {
nonReactiveState.markers.get(props.set.id)!.points.forEach((marker: LiveAtlasPointMarker, id: string) => {
const layer = createMarker(marker, converter);
layers.set(id, layer);
@ -81,7 +81,7 @@ export default defineComponent({
if(update.removed) {
deleteMarker(update.id);
} else {
const layer = updateMarker(layers.get(update.id), update.payload as LiveAtlasMarker, converter);
const layer = updateMarker(layers.get(update.id), update.payload as LiveAtlasPointMarker, converter);
if(!layers.has(update.id)) {
props.layerGroup.addLayer(layer);
@ -103,7 +103,7 @@ export default defineComponent({
if(newValue && (!oldValue || oldValue.world === newValue.world)) {
const converter = currentMap.value!.locationToLatLng.bind(store.state.currentMap);
for (const [id, marker] of nonReactiveState.markers.get(props.set.id)!.markers) {
for (const [id, marker] of nonReactiveState.markers.get(props.set.id)!.points) {
updateMarker(layers.get(id), marker, converter);
}
}

10
src/dynmap.d.ts vendored
View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
import {LiveAtlasArea, LiveAtlasCircle, LiveAtlasLine, LiveAtlasMarker} from "@/index";
import {LiveAtlasAreaMarker, LiveAtlasCircleMarker, LiveAtlasLineMarker, LiveAtlasPointMarker} from "@/index";
declare global {
// noinspection JSUnusedGlobalSymbols
@ -56,19 +56,19 @@ interface DynmapUpdate {
}
interface DynmapMarkerUpdate extends DynmapUpdate {
payload?: LiveAtlasMarker
payload?: LiveAtlasPointMarker
}
interface DynmapAreaUpdate extends DynmapUpdate {
payload?: LiveAtlasArea
payload?: LiveAtlasAreaMarker
}
interface DynmapCircleUpdate extends DynmapUpdate {
payload?: LiveAtlasCircle
payload?: LiveAtlasCircleMarker
}
interface DynmapLineUpdate extends DynmapUpdate {
payload?: LiveAtlasLine
payload?: LiveAtlasLineMarker
}
interface DynmapTileUpdate {

18
src/index.d.ts vendored
View File

@ -174,13 +174,13 @@ interface LiveAtlasMarkerSet {
}
interface LiveAtlasMarkerSetContents {
markers: Map<string, LiveAtlasMarker>,
areas: Map<string, LiveAtlasArea>;
lines: Map<string, LiveAtlasLine>;
circles: Map<string, LiveAtlasCircle>;
points: Map<string, LiveAtlasPointMarker>,
areas: Map<string, LiveAtlasAreaMarker>;
lines: Map<string, LiveAtlasLineMarker>;
circles: Map<string, LiveAtlasCircleMarker>;
}
interface LiveAtlasMarker {
interface LiveAtlasPointMarker {
dimensions: PointTuple;
icon: string;
label: string;
@ -191,7 +191,7 @@ interface LiveAtlasMarker {
popupContent?: string;
}
interface LiveAtlasPath {
interface LiveAtlasPathMarker {
style: PathOptions;
minZoom?: number;
maxZoom?: number;
@ -200,18 +200,18 @@ interface LiveAtlasPath {
isPopupHTML: boolean;
}
interface LiveAtlasArea extends LiveAtlasPath {
interface LiveAtlasAreaMarker extends LiveAtlasPathMarker {
style: PolylineOptions;
outline: boolean;
points: Coordinate[] | Coordinate[][] | Coordinate[][][]
}
interface LiveAtlasLine extends LiveAtlasPath {
interface LiveAtlasLineMarker extends LiveAtlasPathMarker {
points: Coordinate[];
style: PolylineOptions;
}
interface LiveAtlasCircle extends LiveAtlasPath {
interface LiveAtlasCircleMarker extends LiveAtlasPathMarker {
location: Coordinate;
radius: PointTuple;
style: PathOptions;

View File

@ -15,7 +15,7 @@
*/
import {MarkerOptions, Marker, LatLngExpression, Icon, Map} from 'leaflet';
import {LiveAtlasMarker} from "@/index";
import {LiveAtlasPointMarker} from "@/index";
import {GenericIcon} from "@/leaflet/icon/GenericIcon";
export interface GenericMarkerOptions extends MarkerOptions {
@ -27,7 +27,7 @@ export interface GenericMarkerOptions extends MarkerOptions {
export class GenericMarker extends Marker {
declare options: GenericMarkerOptions;
constructor(latLng: LatLngExpression, options: LiveAtlasMarker) {
constructor(latLng: LatLngExpression, options: LiveAtlasPointMarker) {
super(latLng, {});
this.options.icon = new GenericIcon({

View File

@ -15,7 +15,7 @@
*/
import {LatLngExpression, Polygon, PolylineOptions} from "leaflet";
import {LiveAtlasPath} from "@/index";
import {LiveAtlasPathMarker} from "@/index";
export interface LiveAtlasPolygonOptions extends PolylineOptions {
minZoom?: number;
@ -25,7 +25,7 @@ export interface LiveAtlasPolygonOptions extends PolylineOptions {
export default class LiveAtlasPolygon extends Polygon {
declare options: LiveAtlasPolygonOptions;
constructor(latlngs: LatLngExpression[] | LatLngExpression[][] | LatLngExpression[][][], options: LiveAtlasPath) {
constructor(latlngs: LatLngExpression[] | LatLngExpression[][] | LatLngExpression[][][], options: LiveAtlasPathMarker) {
super(latlngs, options.style);
}
}

View File

@ -15,7 +15,7 @@
*/
import {LatLngExpression, Polyline, PolylineOptions} from "leaflet";
import {LiveAtlasPath} from "@/index";
import {LiveAtlasPathMarker} from "@/index";
export interface LiveAtlasPolylineOptions extends PolylineOptions {
minZoom?: number;
@ -25,7 +25,7 @@ export interface LiveAtlasPolylineOptions extends PolylineOptions {
export default class LiveAtlasPolyline extends Polyline {
declare options: LiveAtlasPolylineOptions;
constructor(latlngs: LatLngExpression[] | LatLngExpression[][], option: LiveAtlasPath) {
constructor(latlngs: LatLngExpression[] | LatLngExpression[][], option: LiveAtlasPathMarker) {
super(latlngs, option.style);
this.options.minZoom = option.minZoom;
this.options.maxZoom = option.maxZoom;

View File

@ -77,7 +77,7 @@ export default class DynmapMapProvider extends MapProvider {
this.markerSets.set(key, markerSet);
this.markers.set(key, Object.seal({
markers: buildMarkers(set.markers || {}),
points: buildMarkers(set.markers || {}),
areas: buildAreas(set.areas || {}),
lines: buildLines(set.lines || {}),
circles: buildCircles(set.circles || {}),

View File

@ -16,12 +16,12 @@
import {
HeadQueueEntry,
LiveAtlasArea,
LiveAtlasCircle,
LiveAtlasAreaMarker,
LiveAtlasCircleMarker,
LiveAtlasComponentConfig,
LiveAtlasDimension,
LiveAtlasLine,
LiveAtlasMarker,
LiveAtlasLineMarker,
LiveAtlasPointMarker,
LiveAtlasMarkerSet, LiveAtlasMarkerSetContents,
LiveAtlasPartialComponentConfig,
LiveAtlasPlayer,
@ -246,15 +246,15 @@ export default class Pl3xmapMapProvider extends MapProvider {
const id = set.id;
const markers: Map<string, LiveAtlasMarker> = Object.freeze(new Map()),
circles: Map<string, LiveAtlasCircle> = Object.freeze(new Map()),
areas: Map<string, LiveAtlasArea> = Object.freeze(new Map()),
lines: Map<string, LiveAtlasLine> = Object.freeze(new Map());
const points: Map<string, LiveAtlasPointMarker> = Object.freeze(new Map()),
circles: Map<string, LiveAtlasCircleMarker> = Object.freeze(new Map()),
areas: Map<string, LiveAtlasAreaMarker> = Object.freeze(new Map()),
lines: Map<string, LiveAtlasLineMarker> = Object.freeze(new Map());
(set.markers || []).forEach((marker: any) => {
switch(marker.type) {
case 'icon':
markers.set(`marker-${markers.size}`, Pl3xmapMapProvider.buildMarker(marker));
points.set(`marker-${points.size}`, Pl3xmapMapProvider.buildMarker(marker));
break;
case 'polyline':
@ -286,11 +286,11 @@ export default class Pl3xmapMapProvider extends MapProvider {
priority: set.order || 0,
showLabels: false
});
this.markers.set(id, Object.seal({markers, circles, areas, lines}));
this.markers.set(id, Object.seal({points, circles, areas, lines}));
});
}
private static buildMarker(marker: any): LiveAtlasMarker {
private static buildMarker(marker: any): LiveAtlasPointMarker {
return {
location: {
x: marker.point?.x || 0,
@ -305,7 +305,7 @@ export default class Pl3xmapMapProvider extends MapProvider {
};
}
private static buildRectangle(area: any): LiveAtlasArea {
private static buildRectangle(area: any): LiveAtlasAreaMarker {
return {
style: {
stroke: typeof area.stroke !== 'undefined' ? !!area.stroke : true,
@ -331,7 +331,7 @@ export default class Pl3xmapMapProvider extends MapProvider {
};
}
private static buildArea(area: any): LiveAtlasArea {
private static buildArea(area: any): LiveAtlasAreaMarker {
return {
style: {
stroke: typeof area.stroke !== 'undefined' ? !!area.stroke : true,
@ -352,7 +352,7 @@ export default class Pl3xmapMapProvider extends MapProvider {
};
}
private static buildLine(line: any): LiveAtlasLine {
private static buildLine(line: any): LiveAtlasLineMarker {
return {
style: {
stroke: typeof line.stroke !== 'undefined' ? !!line.stroke : true,
@ -368,7 +368,7 @@ export default class Pl3xmapMapProvider extends MapProvider {
};
}
private static buildCircle(circle: any): LiveAtlasCircle {
private static buildCircle(circle: any): LiveAtlasCircleMarker {
return {
location: {
x: circle.center?.x || 0,

View File

@ -33,10 +33,10 @@ import {
LiveAtlasGlobalMessageConfig,
LiveAtlasServerMessageConfig,
LiveAtlasPlayer,
LiveAtlasCircle,
LiveAtlasLine,
LiveAtlasArea,
LiveAtlasMarker,
LiveAtlasCircleMarker,
LiveAtlasLineMarker,
LiveAtlasAreaMarker,
LiveAtlasPointMarker,
LiveAtlasMarkerSet,
LiveAtlasServerDefinition,
LiveAtlasServerConfig,
@ -217,10 +217,10 @@ export const mutations: MutationTree<State> & Mutations = {
lineUpdates: [],
});
nonReactiveState.markers.set(entry[0], {
markers: new Map<string, LiveAtlasMarker>(),
areas: new Map<string, LiveAtlasArea>(),
lines: new Map<string, LiveAtlasLine>(),
circles: new Map<string, LiveAtlasCircle>(),
points: new Map<string, LiveAtlasPointMarker>(),
areas: new Map<string, LiveAtlasAreaMarker>(),
lines: new Map<string, LiveAtlasLineMarker>(),
circles: new Map<string, LiveAtlasCircleMarker>(),
});
}
},
@ -292,9 +292,9 @@ export const mutations: MutationTree<State> & Mutations = {
//Update non-reactive lists
for(const update of entry[1].markerUpdates) {
if(update.removed) {
setContents.markers.delete(update.id);
setContents.points.delete(update.id);
} else {
setContents.markers.set(update.id, update.payload as LiveAtlasMarker);
setContents.points.set(update.id, update.payload as LiveAtlasPointMarker);
}
}
@ -302,7 +302,7 @@ export const mutations: MutationTree<State> & Mutations = {
if(update.removed) {
setContents.areas.delete(update.id);
} else {
setContents.areas.set(update.id, update.payload as LiveAtlasArea);
setContents.areas.set(update.id, update.payload as LiveAtlasAreaMarker);
}
}
@ -310,7 +310,7 @@ export const mutations: MutationTree<State> & Mutations = {
if(update.removed) {
setContents.circles.delete(update.id);
} else {
setContents.circles.set(update.id, update.payload as LiveAtlasCircle);
setContents.circles.set(update.id, update.payload as LiveAtlasCircleMarker);
}
}
@ -318,7 +318,7 @@ export const mutations: MutationTree<State> & Mutations = {
if(update.removed) {
setContents.lines.delete(update.id);
} else {
setContents.lines.set(update.id, update.payload as LiveAtlasLine);
setContents.lines.set(update.id, update.payload as LiveAtlasLineMarker);
}
}

View File

@ -20,10 +20,10 @@
import {LatLngExpression} from "leaflet";
import LiveAtlasPolyline from "@/leaflet/vector/LiveAtlasPolyline";
import LiveAtlasPolygon from "@/leaflet/vector/LiveAtlasPolygon";
import {Coordinate, LiveAtlasArea} from "@/index";
import {Coordinate, LiveAtlasAreaMarker} from "@/index";
import {arePointsEqual, createPopup, isStyleEqual, tooltipOptions} from "@/util/paths";
export const createArea = (options: LiveAtlasArea, converter: Function): LiveAtlasPolyline | LiveAtlasPolygon => {
export const createArea = (options: LiveAtlasAreaMarker, converter: Function): LiveAtlasPolyline | LiveAtlasPolygon => {
const outline = !options.style.fillOpacity || (options.style.fillOpacity <= 0),
points = options.points.map(projectPointsMapCallback, converter) as LatLngExpression[] | LatLngExpression[][],
area = outline ? new LiveAtlasPolyline(points, options) : new LiveAtlasPolygon(points, options);
@ -39,7 +39,7 @@ export const createArea = (options: LiveAtlasArea, converter: Function): LiveAtl
return area;
};
export const updateArea = (area: LiveAtlasPolyline | LiveAtlasPolygon | undefined, options: LiveAtlasArea, converter: Function): LiveAtlasPolyline | LiveAtlasPolygon => {
export const updateArea = (area: LiveAtlasPolyline | LiveAtlasPolygon | undefined, options: LiveAtlasAreaMarker, converter: Function): LiveAtlasPolyline | LiveAtlasPolygon => {
if (!area) {
return createArea(options, converter);
}

View File

@ -20,10 +20,10 @@
import {LatLngExpression} from "leaflet";
import LiveAtlasPolyline from "@/leaflet/vector/LiveAtlasPolyline";
import LiveAtlasPolygon from "@/leaflet/vector/LiveAtlasPolygon";
import {LiveAtlasCircle} from "@/index";
import {LiveAtlasCircleMarker} from "@/index";
import {createPopup, tooltipOptions} from "@/util/paths";
export const createCircle = (options: LiveAtlasCircle, converter: Function): LiveAtlasPolyline | LiveAtlasPolygon => {
export const createCircle = (options: LiveAtlasCircleMarker, converter: Function): LiveAtlasPolyline | LiveAtlasPolygon => {
const outline = !options.style.fillOpacity || (options.style.fillOpacity <= 0),
points = getCirclePoints(options, converter, outline),
circle = outline ? new LiveAtlasPolyline(points, options) : new LiveAtlasPolygon(points, options);
@ -39,7 +39,7 @@ export const createCircle = (options: LiveAtlasCircle, converter: Function): Liv
return circle;
};
export const updateCircle = (circle: LiveAtlasPolyline | LiveAtlasPolygon | undefined, options: LiveAtlasCircle, converter: Function): LiveAtlasPolyline | LiveAtlasPolygon => {
export const updateCircle = (circle: LiveAtlasPolyline | LiveAtlasPolygon | undefined, options: LiveAtlasCircleMarker, converter: Function): LiveAtlasPolyline | LiveAtlasPolygon => {
if (!circle) {
return createCircle(options, converter);
}
@ -56,7 +56,7 @@ export const updateCircle = (circle: LiveAtlasPolyline | LiveAtlasPolygon | unde
return circle;
}
export const getCirclePoints = (options: LiveAtlasCircle, converter: Function, outline: boolean): LatLngExpression[] => {
export const getCirclePoints = (options: LiveAtlasCircleMarker, converter: Function, outline: boolean): LatLngExpression[] => {
const points = [];
for(let i = 0; i < 360; i++) {

View File

@ -16,13 +16,13 @@
import {DynmapMarkerSetUpdates, DynmapTileUpdate, DynmapUpdate} from "@/dynmap";
import {
LiveAtlasArea,
LiveAtlasAreaMarker,
LiveAtlasChat,
LiveAtlasCircle,
LiveAtlasCircleMarker,
LiveAtlasComponentConfig,
LiveAtlasDimension,
LiveAtlasLine,
LiveAtlasMarker, LiveAtlasPlayerImageSize,
LiveAtlasLineMarker,
LiveAtlasPointMarker, LiveAtlasPlayerImageSize,
LiveAtlasServerConfig,
LiveAtlasServerMessageConfig,
LiveAtlasWorldDefinition
@ -267,8 +267,8 @@ export function buildMarkerSet(id: string, data: MarkerSet): any {
}
}
export function buildMarkers(data: any): Map<string, LiveAtlasMarker> {
const markers = Object.freeze(new Map()) as Map<string, LiveAtlasMarker>;
export function buildMarkers(data: any): Map<string, LiveAtlasPointMarker> {
const markers = Object.freeze(new Map()) as Map<string, LiveAtlasPointMarker>;
for (const key in data) {
if (!Object.prototype.hasOwnProperty.call(data, key)) {
@ -281,7 +281,7 @@ export function buildMarkers(data: any): Map<string, LiveAtlasMarker> {
return markers;
}
export function buildMarker(data: Marker): LiveAtlasMarker {
export function buildMarker(data: Marker): LiveAtlasPointMarker {
let dimensions;
if(data.dim) {
@ -315,8 +315,8 @@ export function buildMarker(data: Marker): LiveAtlasMarker {
return marker;
}
export function buildAreas(data: any): Map<string, LiveAtlasArea> {
const areas = Object.freeze(new Map()) as Map<string, LiveAtlasArea>;
export function buildAreas(data: any): Map<string, LiveAtlasAreaMarker> {
const areas = Object.freeze(new Map()) as Map<string, LiveAtlasAreaMarker>;
for (const key in data) {
if (!Object.prototype.hasOwnProperty.call(data, key)) {
@ -329,7 +329,7 @@ export function buildAreas(data: any): Map<string, LiveAtlasArea> {
return areas;
}
export function buildArea(area: MarkerArea): LiveAtlasArea {
export function buildArea(area: MarkerArea): LiveAtlasAreaMarker {
return {
style: {
color: area.color || '#ff0000',
@ -352,8 +352,8 @@ export function buildArea(area: MarkerArea): LiveAtlasArea {
};
}
export function buildLines(data: any): Map<string, LiveAtlasLine> {
const lines = Object.freeze(new Map()) as Map<string, LiveAtlasLine>;
export function buildLines(data: any): Map<string, LiveAtlasLineMarker> {
const lines = Object.freeze(new Map()) as Map<string, LiveAtlasLineMarker>;
for (const key in data) {
if (!Object.prototype.hasOwnProperty.call(data, key)) {
@ -366,7 +366,7 @@ export function buildLines(data: any): Map<string, LiveAtlasLine> {
return lines;
}
export function buildLine(line: MarkerLine): LiveAtlasLine {
export function buildLine(line: MarkerLine): LiveAtlasLineMarker {
return {
style: {
color: line.color || '#ff0000',
@ -382,8 +382,8 @@ export function buildLine(line: MarkerLine): LiveAtlasLine {
};
}
export function buildCircles(data: any): Map<string, LiveAtlasCircle> {
const circles = Object.freeze(new Map()) as Map<string, LiveAtlasCircle>;
export function buildCircles(data: any): Map<string, LiveAtlasCircleMarker> {
const circles = Object.freeze(new Map()) as Map<string, LiveAtlasCircleMarker>;
for (const key in data) {
if (!Object.prototype.hasOwnProperty.call(data, key)) {
@ -396,7 +396,7 @@ export function buildCircles(data: any): Map<string, LiveAtlasCircle> {
return circles;
}
export function buildCircle(circle: MarkerCircle): LiveAtlasCircle {
export function buildCircle(circle: MarkerCircle): LiveAtlasCircleMarker {
return {
location: {
x: circle.x || 0,

View File

@ -18,11 +18,11 @@
*/
import LiveAtlasPolyline from "@/leaflet/vector/LiveAtlasPolyline";
import {Coordinate, LiveAtlasLine} from "@/index";
import {Coordinate, LiveAtlasLineMarker} from "@/index";
import {LatLngExpression} from "leaflet";
import {createPopup, tooltipOptions} from "@/util/paths";
export const createLine = (options: LiveAtlasLine, converter: Function): LiveAtlasPolyline => {
export const createLine = (options: LiveAtlasLineMarker, converter: Function): LiveAtlasPolyline => {
const points = options.points.map(projectPointsMapCallback, converter),
line = new LiveAtlasPolyline(points, options);
@ -37,7 +37,7 @@ export const createLine = (options: LiveAtlasLine, converter: Function): LiveAtl
return line;
};
export const updateLine = (line: LiveAtlasPolyline | undefined, options: LiveAtlasLine, converter: Function): LiveAtlasPolyline => {
export const updateLine = (line: LiveAtlasPolyline | undefined, options: LiveAtlasLineMarker, converter: Function): LiveAtlasPolyline => {
if (!line) {
return createLine(options, converter);
}

View File

@ -20,9 +20,9 @@
import {LeafletMouseEvent, Marker} from "leaflet";
import {GenericIcon} from "@/leaflet/icon/GenericIcon";
import {GenericMarker} from "@/leaflet/marker/GenericMarker";
import {LiveAtlasMarker} from "@/index";
import {LiveAtlasPointMarker} from "@/index";
export const createMarker = (options: LiveAtlasMarker, converter: Function): Marker => {
export const createMarker = (options: LiveAtlasPointMarker, converter: Function): Marker => {
const marker = new GenericMarker(converter(options.location), options);
marker.on('click', (e: LeafletMouseEvent) => {
@ -38,7 +38,7 @@ export const createMarker = (options: LiveAtlasMarker, converter: Function): Mar
return marker;
};
export const updateMarker = (marker: Marker | undefined, options: LiveAtlasMarker, converter: Function): Marker => {
export const updateMarker = (marker: Marker | undefined, options: LiveAtlasPointMarker, converter: Function): Marker => {
if (!marker) {
return createMarker(options, converter);
}
@ -73,7 +73,7 @@ export const updateMarker = (marker: Marker | undefined, options: LiveAtlasMarke
return marker;
};
const createPopup = (options: LiveAtlasMarker) => {
const createPopup = (options: LiveAtlasPointMarker) => {
const popup = document.createElement('span');
if (options.popupContent) {

View File

@ -15,7 +15,7 @@
*/
import {Direction, LatLngExpression, PathOptions} from "leaflet";
import {LiveAtlasPath} from "@/index";
import {LiveAtlasPathMarker} from "@/index";
export const tooltipOptions = {
direction: 'top' as Direction,
@ -38,7 +38,7 @@ export const isStyleEqual = (oldStyle: PathOptions, newStyle: PathOptions) => {
&& (oldStyle.fillOpacity === newStyle.fillOpacity)
}
export const createPopup = (options: LiveAtlasPath, className: string): HTMLElement => {
export const createPopup = (options: LiveAtlasPathMarker, className: string): HTMLElement => {
const popup = document.createElement('span');
if(options.isPopupHTML) {