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 LiveAtlasLayerGroup from "@/leaflet/layer/LiveAtlasLayerGroup";
import LiveAtlasPolygon from "@/leaflet/vector/LiveAtlasPolygon"; import LiveAtlasPolygon from "@/leaflet/vector/LiveAtlasPolygon";
import LiveAtlasPolyline from "@/leaflet/vector/LiveAtlasPolyline"; import LiveAtlasPolyline from "@/leaflet/vector/LiveAtlasPolyline";
import {LiveAtlasArea, LiveAtlasMarkerSet} from "@/index"; import {LiveAtlasAreaMarker, LiveAtlasMarkerSet} from "@/index";
import {nonReactiveState} from "@/store/state"; import {nonReactiveState} from "@/store/state";
export default defineComponent({ export default defineComponent({
@ -52,7 +52,7 @@ export default defineComponent({
createAreas = () => { createAreas = () => {
const converter = currentMap.value!.locationToLatLng.bind(currentMap.value); 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); const layer = createArea(area, converter);
layers.set(id, layer); layers.set(id, layer);
@ -82,7 +82,7 @@ export default defineComponent({
if(update.removed) { if(update.removed) {
deleteArea(update.id); deleteArea(update.id);
} else { } 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)) { if(!layers.has(update.id)) {
props.layerGroup.addLayer(layer); props.layerGroup.addLayer(layer);

View File

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

View File

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

View File

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

10
src/dynmap.d.ts vendored
View File

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

18
src/index.d.ts vendored
View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -33,10 +33,10 @@ import {
LiveAtlasGlobalMessageConfig, LiveAtlasGlobalMessageConfig,
LiveAtlasServerMessageConfig, LiveAtlasServerMessageConfig,
LiveAtlasPlayer, LiveAtlasPlayer,
LiveAtlasCircle, LiveAtlasCircleMarker,
LiveAtlasLine, LiveAtlasLineMarker,
LiveAtlasArea, LiveAtlasAreaMarker,
LiveAtlasMarker, LiveAtlasPointMarker,
LiveAtlasMarkerSet, LiveAtlasMarkerSet,
LiveAtlasServerDefinition, LiveAtlasServerDefinition,
LiveAtlasServerConfig, LiveAtlasServerConfig,
@ -217,10 +217,10 @@ export const mutations: MutationTree<State> & Mutations = {
lineUpdates: [], lineUpdates: [],
}); });
nonReactiveState.markers.set(entry[0], { nonReactiveState.markers.set(entry[0], {
markers: new Map<string, LiveAtlasMarker>(), points: new Map<string, LiveAtlasPointMarker>(),
areas: new Map<string, LiveAtlasArea>(), areas: new Map<string, LiveAtlasAreaMarker>(),
lines: new Map<string, LiveAtlasLine>(), lines: new Map<string, LiveAtlasLineMarker>(),
circles: new Map<string, LiveAtlasCircle>(), circles: new Map<string, LiveAtlasCircleMarker>(),
}); });
} }
}, },
@ -292,9 +292,9 @@ export const mutations: MutationTree<State> & Mutations = {
//Update non-reactive lists //Update non-reactive lists
for(const update of entry[1].markerUpdates) { for(const update of entry[1].markerUpdates) {
if(update.removed) { if(update.removed) {
setContents.markers.delete(update.id); setContents.points.delete(update.id);
} else { } 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) { if(update.removed) {
setContents.areas.delete(update.id); setContents.areas.delete(update.id);
} else { } 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) { if(update.removed) {
setContents.circles.delete(update.id); setContents.circles.delete(update.id);
} else { } 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) { if(update.removed) {
setContents.lines.delete(update.id); setContents.lines.delete(update.id);
} else { } 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 {LatLngExpression} from "leaflet";
import LiveAtlasPolyline from "@/leaflet/vector/LiveAtlasPolyline"; import LiveAtlasPolyline from "@/leaflet/vector/LiveAtlasPolyline";
import LiveAtlasPolygon from "@/leaflet/vector/LiveAtlasPolygon"; import LiveAtlasPolygon from "@/leaflet/vector/LiveAtlasPolygon";
import {Coordinate, LiveAtlasArea} from "@/index"; import {Coordinate, LiveAtlasAreaMarker} from "@/index";
import {arePointsEqual, createPopup, isStyleEqual, tooltipOptions} from "@/util/paths"; 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), const outline = !options.style.fillOpacity || (options.style.fillOpacity <= 0),
points = options.points.map(projectPointsMapCallback, converter) as LatLngExpression[] | LatLngExpression[][], points = options.points.map(projectPointsMapCallback, converter) as LatLngExpression[] | LatLngExpression[][],
area = outline ? new LiveAtlasPolyline(points, options) : new LiveAtlasPolygon(points, options); area = outline ? new LiveAtlasPolyline(points, options) : new LiveAtlasPolygon(points, options);
@ -39,7 +39,7 @@ export const createArea = (options: LiveAtlasArea, converter: Function): LiveAtl
return area; 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) { if (!area) {
return createArea(options, converter); return createArea(options, converter);
} }

View File

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

View File

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

View File

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

View File

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

View File

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