From 7cd21a19e2cd2968601f5bdd866bd3ac44e08dae Mon Sep 17 00:00:00 2001 From: James Lyne Date: Thu, 13 Jan 2022 14:06:18 +0000 Subject: [PATCH] Rename marker types for clarity - Add "Marker" suffix - Rename regular marker to "PointMarker" --- src/components/map/vector/Areas.vue | 6 ++--- src/components/map/vector/Circles.vue | 6 ++--- src/components/map/vector/Lines.vue | 6 ++--- src/components/map/vector/Markers.vue | 8 +++---- src/dynmap.d.ts | 10 ++++---- src/index.d.ts | 18 +++++++------- src/leaflet/marker/GenericMarker.ts | 4 ++-- src/leaflet/vector/LiveAtlasPolygon.ts | 4 ++-- src/leaflet/vector/LiveAtlasPolyline.ts | 4 ++-- src/providers/DynmapMapProvider.ts | 2 +- src/providers/Pl3xmapMapProvider.ts | 30 +++++++++++------------ src/store/mutations.ts | 26 ++++++++++---------- src/util/areas.ts | 6 ++--- src/util/circles.ts | 8 +++---- src/util/dynmap.ts | 32 ++++++++++++------------- src/util/lines.ts | 6 ++--- src/util/markers.ts | 8 +++---- src/util/paths.ts | 4 ++-- 18 files changed, 94 insertions(+), 94 deletions(-) diff --git a/src/components/map/vector/Areas.vue b/src/components/map/vector/Areas.vue index 99b12cc..f60ddf5 100644 --- a/src/components/map/vector/Areas.vue +++ b/src/components/map/vector/Areas.vue @@ -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); diff --git a/src/components/map/vector/Circles.vue b/src/components/map/vector/Circles.vue index e6893ca..22dc83c 100644 --- a/src/components/map/vector/Circles.vue +++ b/src/components/map/vector/Circles.vue @@ -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); diff --git a/src/components/map/vector/Lines.vue b/src/components/map/vector/Lines.vue index dfdfc41..8933f49 100644 --- a/src/components/map/vector/Lines.vue +++ b/src/components/map/vector/Lines.vue @@ -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); diff --git a/src/components/map/vector/Markers.vue b/src/components/map/vector/Markers.vue index 01de292..8ee7091 100644 --- a/src/components/map/vector/Markers.vue +++ b/src/components/map/vector/Markers.vue @@ -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); } } diff --git a/src/dynmap.d.ts b/src/dynmap.d.ts index b9c0f78..37111a8 100644 --- a/src/dynmap.d.ts +++ b/src/dynmap.d.ts @@ -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 { diff --git a/src/index.d.ts b/src/index.d.ts index 922779b..6d7d28b 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -174,13 +174,13 @@ interface LiveAtlasMarkerSet { } interface LiveAtlasMarkerSetContents { - markers: Map, - areas: Map; - lines: Map; - circles: Map; + points: Map, + areas: Map; + lines: Map; + circles: Map; } -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; diff --git a/src/leaflet/marker/GenericMarker.ts b/src/leaflet/marker/GenericMarker.ts index b46d156..065e062 100644 --- a/src/leaflet/marker/GenericMarker.ts +++ b/src/leaflet/marker/GenericMarker.ts @@ -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({ diff --git a/src/leaflet/vector/LiveAtlasPolygon.ts b/src/leaflet/vector/LiveAtlasPolygon.ts index 6179b83..6935b76 100644 --- a/src/leaflet/vector/LiveAtlasPolygon.ts +++ b/src/leaflet/vector/LiveAtlasPolygon.ts @@ -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); } } diff --git a/src/leaflet/vector/LiveAtlasPolyline.ts b/src/leaflet/vector/LiveAtlasPolyline.ts index 41a8c0a..c0b2b5f 100644 --- a/src/leaflet/vector/LiveAtlasPolyline.ts +++ b/src/leaflet/vector/LiveAtlasPolyline.ts @@ -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; diff --git a/src/providers/DynmapMapProvider.ts b/src/providers/DynmapMapProvider.ts index 7a48780..df837c3 100644 --- a/src/providers/DynmapMapProvider.ts +++ b/src/providers/DynmapMapProvider.ts @@ -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 || {}), diff --git a/src/providers/Pl3xmapMapProvider.ts b/src/providers/Pl3xmapMapProvider.ts index f063ef6..8caeaf7 100644 --- a/src/providers/Pl3xmapMapProvider.ts +++ b/src/providers/Pl3xmapMapProvider.ts @@ -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 = Object.freeze(new Map()), - circles: Map = Object.freeze(new Map()), - areas: Map = Object.freeze(new Map()), - lines: Map = Object.freeze(new Map()); + const points: Map = Object.freeze(new Map()), + circles: Map = Object.freeze(new Map()), + areas: Map = Object.freeze(new Map()), + lines: Map = 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, diff --git a/src/store/mutations.ts b/src/store/mutations.ts index 8442e1e..d3fade8 100644 --- a/src/store/mutations.ts +++ b/src/store/mutations.ts @@ -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 & Mutations = { lineUpdates: [], }); nonReactiveState.markers.set(entry[0], { - markers: new Map(), - areas: new Map(), - lines: new Map(), - circles: new Map(), + points: new Map(), + areas: new Map(), + lines: new Map(), + circles: new Map(), }); } }, @@ -292,9 +292,9 @@ export const mutations: MutationTree & 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 & 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 & 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 & 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); } } diff --git a/src/util/areas.ts b/src/util/areas.ts index 4ed4639..c894a43 100644 --- a/src/util/areas.ts +++ b/src/util/areas.ts @@ -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); } diff --git a/src/util/circles.ts b/src/util/circles.ts index d75253f..af954ba 100644 --- a/src/util/circles.ts +++ b/src/util/circles.ts @@ -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++) { diff --git a/src/util/dynmap.ts b/src/util/dynmap.ts index d2290ef..d3c1393 100644 --- a/src/util/dynmap.ts +++ b/src/util/dynmap.ts @@ -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 { - const markers = Object.freeze(new Map()) as Map; +export function buildMarkers(data: any): Map { + const markers = Object.freeze(new Map()) as Map; for (const key in data) { if (!Object.prototype.hasOwnProperty.call(data, key)) { @@ -281,7 +281,7 @@ export function buildMarkers(data: any): Map { 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 { - const areas = Object.freeze(new Map()) as Map; +export function buildAreas(data: any): Map { + const areas = Object.freeze(new Map()) as Map; for (const key in data) { if (!Object.prototype.hasOwnProperty.call(data, key)) { @@ -329,7 +329,7 @@ export function buildAreas(data: any): Map { 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 { - const lines = Object.freeze(new Map()) as Map; +export function buildLines(data: any): Map { + const lines = Object.freeze(new Map()) as Map; for (const key in data) { if (!Object.prototype.hasOwnProperty.call(data, key)) { @@ -366,7 +366,7 @@ export function buildLines(data: any): Map { 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 { - const circles = Object.freeze(new Map()) as Map; +export function buildCircles(data: any): Map { + const circles = Object.freeze(new Map()) as Map; for (const key in data) { if (!Object.prototype.hasOwnProperty.call(data, key)) { @@ -396,7 +396,7 @@ export function buildCircles(data: any): Map { return circles; } -export function buildCircle(circle: MarkerCircle): LiveAtlasCircle { +export function buildCircle(circle: MarkerCircle): LiveAtlasCircleMarker { return { location: { x: circle.x || 0, diff --git a/src/util/lines.ts b/src/util/lines.ts index 6d2de70..2325e33 100644 --- a/src/util/lines.ts +++ b/src/util/lines.ts @@ -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); } diff --git a/src/util/markers.ts b/src/util/markers.ts index 5c8df23..b746757 100644 --- a/src/util/markers.ts +++ b/src/util/markers.ts @@ -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) { diff --git a/src/util/paths.ts b/src/util/paths.ts index df7d583..640af04 100644 --- a/src/util/paths.ts +++ b/src/util/paths.ts @@ -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) {