mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Merge branch 'v2' of https://github.com/Pax1601/DCSOlympus into v2
This commit is contained in:
commit
329e9b86fd
14
backend/vcpkg-configuration.json
Normal file
14
backend/vcpkg-configuration.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"default-registry": {
|
||||
"kind": "git",
|
||||
"baseline": "7f9f0e44db287e8e67c0e888141bfa200ab45121",
|
||||
"repository": "https://github.com/microsoft/vcpkg"
|
||||
},
|
||||
"registries": [
|
||||
{
|
||||
"kind": "artifact",
|
||||
"location": "https://github.com/microsoft/vcpkg-ce-catalog/archive/refs/heads/main.zip",
|
||||
"name": "microsoft"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,7 +1,6 @@
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
|
||||
"dependencies": [
|
||||
"cpprestsdk",
|
||||
"geographiclib"
|
||||
]
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,7 @@
|
||||
import { LatLng, LatLngBounds } from "leaflet";
|
||||
//import { MapMarkerVisibilityControl } from "../map/map";
|
||||
import { Context } from "../types/types";
|
||||
|
||||
export const DEFAULT_CONTEXT: Context = "default context";
|
||||
|
||||
export const UNITS_URI = "units";
|
||||
export const WEAPONS_URI = "weapons";
|
||||
@ -154,25 +156,8 @@ export const mapBounds = {
|
||||
"SinaiMap": { bounds: new LatLngBounds([34.312222, 28.523333], [25.946944, 36.897778]), zoom: 4 },
|
||||
}
|
||||
|
||||
export const mapMirrors = {
|
||||
"DCS Map mirror 1": "https://maps.dcsolympus.com/maps",
|
||||
"DCS Map mirror 2": "https://refugees.dcsolympus.com/maps"
|
||||
}
|
||||
|
||||
export const defaultMapLayers = {
|
||||
"ArcGIS Satellite": {
|
||||
urlTemplate: "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}",
|
||||
minZoom: 1,
|
||||
maxZoom: 19,
|
||||
attribution: "Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Mapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community"
|
||||
},
|
||||
"OpenStreetMap Mapnik": {
|
||||
urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
|
||||
minZoom: 1,
|
||||
maxZoom: 20,
|
||||
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
||||
}
|
||||
}
|
||||
export const defaultMapMirrors = {};
|
||||
export const defaultMapLayers = {};
|
||||
|
||||
/* Map constants */
|
||||
export const IDLE = "Idle";
|
||||
@ -185,18 +170,6 @@ export const IADSTypes = ["AAA", "SAM Site", "Radar (EWR)"];
|
||||
export const IADSDensities: { [key: string]: number } = { "AAA": 0.8, "SAM Site": 0.1, "Radar (EWR)": 0.05 };
|
||||
export const GROUND_UNIT_AIR_DEFENCE_REGEX: RegExp = /(\b(AAA|SAM|MANPADS?|[mM]anpads?)|[sS]tinger\b)/;
|
||||
|
||||
export const HIDE_GROUP_MEMBERS = "Hide group members when zoomed out";
|
||||
export const SHOW_UNIT_LABELS = "Show unit labels (L)";
|
||||
export const SHOW_UNITS_ENGAGEMENT_RINGS = "Show units threat range rings (Q)";
|
||||
export const HIDE_UNITS_SHORT_RANGE_RINGS = "Hide short range units threat range rings (R)";
|
||||
export const SHOW_UNITS_ACQUISITION_RINGS = "Show units detection range rings (E)";
|
||||
export const FILL_SELECTED_RING = "Fill the threat range rings of selected units (F)";
|
||||
export const SHOW_UNIT_CONTACTS = "Show selected units contact lines";
|
||||
export const SHOW_UNIT_PATHS = "Show selected unit paths";
|
||||
export const SHOW_UNIT_TARGETS = "Show selected unit targets";
|
||||
export const DCS_LINK_PORT = "DCS Camera link port";
|
||||
export const DCS_LINK_RATIO = "DCS Camera zoom";
|
||||
|
||||
export const MAP_OPTIONS_TOOLTIPS = {
|
||||
hideGroupMembers: "Hide group members when zoomed out",
|
||||
hideUnitsShortRangeRings: "Hide short range units threat range rings (R)",
|
||||
@ -216,7 +189,8 @@ export const MAP_OPTIONS_DEFAULTS = {
|
||||
showUnitTargets: false,
|
||||
showUnitLabels: true,
|
||||
showUnitsEngagementRings: true,
|
||||
showUnitsAcquisitionRings: true
|
||||
showUnitsAcquisitionRings: true,
|
||||
fillSelectedRing: false
|
||||
}
|
||||
|
||||
export const MAP_HIDDEN_TYPES_DEFAULTS = {
|
||||
@ -298,4 +272,4 @@ export const GROUPING_ZOOM_TRANSITION = 13;
|
||||
|
||||
export const MAX_SHOTS_SCATTER = 3;
|
||||
export const MAX_SHOTS_INTENSITY = 3;
|
||||
export const SHOTS_SCATTER_DEGREES = 10;
|
||||
export const SHOTS_SCATTER_DEGREES = 10;
|
||||
|
||||
2
frontend/react/src/dom.d.ts
vendored
2
frontend/react/src/dom.d.ts
vendored
@ -12,7 +12,9 @@ interface CustomEventMap {
|
||||
"mapStateChanged": CustomEvent<string>,
|
||||
"mapContextMenu": CustomEvent<any>,
|
||||
"mapOptionChanged": CustomEvent<any>,
|
||||
"mapSourceChanged": CustomEvent<string>,
|
||||
"mapOptionsChanged": CustomEvent<any>, // TODO not very clear, why the two options?
|
||||
"configLoaded": CustomEvent<any>,
|
||||
"commandModeOptionsChanged": CustomEvent<any>,
|
||||
"contactsUpdated": CustomEvent<Unit>,
|
||||
"activeCoalitionChanged": CustomEvent<any>,
|
||||
|
||||
@ -12,7 +12,7 @@ export const EventsContext = createContext({
|
||||
toggleUnitControlMenuVisible: () => {},
|
||||
toggleMeasureMenuVisible: () => {},
|
||||
toggleDrawingMenuVisible: () => {},
|
||||
toggleOptionsMenuVisible: () => {},
|
||||
toggleOptionsMenuVisible: () => {}
|
||||
})
|
||||
|
||||
export const EventsProvider = EventsContext.Provider;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { LatLng } from "leaflet";
|
||||
import { Coalition } from "./types/types";
|
||||
import { Coalition, Context } from "./types/types";
|
||||
|
||||
class Airbase {
|
||||
|
||||
@ -264,7 +264,7 @@ export interface Listener {
|
||||
export interface ShortcutOptions {
|
||||
altKey?: boolean;
|
||||
callback: CallableFunction;
|
||||
context?: string;
|
||||
context?: Context;
|
||||
ctrlKey?: boolean;
|
||||
name?: string;
|
||||
shiftKey?: boolean;
|
||||
|
||||
@ -1,26 +1,17 @@
|
||||
import * as L from "leaflet"
|
||||
import { getApp } from "../olympusapp";
|
||||
import { BoxSelect } from "./boxselect";
|
||||
//import { MapContextMenu } from "../contextmenus/mapcontextmenu";
|
||||
//import { UnitContextMenu } from "../contextmenus/unitcontextmenu";
|
||||
//import { AirbaseContextMenu } from "../contextmenus/airbasecontextmenu";
|
||||
//import { Dropdown } from "../controls/dropdown";
|
||||
import { Airbase } from "../mission/airbase";
|
||||
import { Unit } from "../unit/unit";
|
||||
import { bearing, /*createCheckboxOption, createSliderInputOption, createTextInputOption,*/ deg2rad, getGroundElevation, getUnitCategoryByBlueprint, polyContains } from "../other/utils";
|
||||
import { bearing, deg2rad, getGroundElevation, polyContains } from "../other/utils";
|
||||
import { DestinationPreviewMarker } from "./markers/destinationpreviewmarker";
|
||||
import { TemporaryUnitMarker } from "./markers/temporaryunitmarker";
|
||||
import { ClickableMiniMap } from "./clickableminimap";
|
||||
import { mapMirrors, defaultMapLayers, mapBounds, minimapBoundaries, IDLE, COALITIONAREA_DRAW_POLYGON, MOVE_UNIT, SHOW_UNIT_CONTACTS, HIDE_GROUP_MEMBERS, SHOW_UNIT_PATHS, SHOW_UNIT_TARGETS, SHOW_UNIT_LABELS, SHOW_UNITS_ENGAGEMENT_RINGS, SHOW_UNITS_ACQUISITION_RINGS, HIDE_UNITS_SHORT_RANGE_RINGS, FILL_SELECTED_RING, /*MAP_MARKER_CONTROLS,*/ DCS_LINK_PORT, DCS_LINK_RATIO, MAP_OPTIONS_DEFAULTS, MAP_HIDDEN_TYPES_DEFAULTS, SPAWN_UNIT, CONTEXT_ACTION } from "../constants/constants";
|
||||
import { defaultMapLayers, mapBounds, minimapBoundaries, IDLE, COALITIONAREA_DRAW_POLYGON, MOVE_UNIT, defaultMapMirrors, SPAWN_UNIT, CONTEXT_ACTION, MAP_OPTIONS_DEFAULTS, MAP_HIDDEN_TYPES_DEFAULTS } from "../constants/constants";
|
||||
import { CoalitionArea } from "./coalitionarea/coalitionarea";
|
||||
//import { CoalitionAreaContextMenu } from "../contextmenus/coalitionareacontextmenu";
|
||||
import { DrawingCursor } from "./coalitionarea/drawingcursor";
|
||||
//import { AirbaseSpawnContextMenu } from "../contextmenus/airbasespawnmenu";
|
||||
//import { GestureHandling } from "leaflet-gesture-handling";
|
||||
import { TouchBoxSelect } from "./touchboxselect";
|
||||
import { DestinationPreviewHandle } from "./markers/destinationpreviewHandle";
|
||||
import { ContextActionSet } from "../unit/contextactionset";
|
||||
import { DCSLayer } from "./dcslayer";
|
||||
|
||||
import './markers/stylesheets/airbase.css'
|
||||
import './markers/stylesheets/bullseye.css'
|
||||
@ -28,10 +19,11 @@ import './markers/stylesheets/units.css'
|
||||
|
||||
// Temporary
|
||||
import './theme.css'
|
||||
import { Coalition, MapHiddenTypes, MapOptions } from "../types/types";
|
||||
import { SpawnRequestTable, UnitBlueprint, UnitSpawnTable } from "../interfaces";
|
||||
import { MapHiddenTypes, MapOptions } from "../types/types";
|
||||
import { SpawnRequestTable } from "../interfaces";
|
||||
import { ContextAction } from "../unit/contextaction";
|
||||
|
||||
// Touch screen support temporarily disabled
|
||||
var hasTouchScreen = false;
|
||||
//if ("maxTouchPoints" in navigator)
|
||||
// hasTouchScreen = navigator.maxTouchPoints > 0;
|
||||
@ -43,10 +35,6 @@ else
|
||||
|
||||
//L.Map.addInitHook("addHandler", "gestureHandling", GestureHandling);
|
||||
|
||||
// TODO would be nice to convert to ts - yes
|
||||
//require("../../node_modules/leaflet.nauticscale/dist/leaflet.nauticscale.js")
|
||||
//require("../../node_modules/leaflet-path-drag/dist/index.js")
|
||||
|
||||
export class Map extends L.Map {
|
||||
/* Options */
|
||||
#options: MapOptions = MAP_OPTIONS_DEFAULTS;
|
||||
@ -105,12 +93,13 @@ export class Map extends L.Map {
|
||||
#longPressTimer: number = 0;
|
||||
|
||||
#mapLayers: any = defaultMapLayers;
|
||||
#mapMirrors: any = defaultMapMirrors;
|
||||
#layerName: string = "";
|
||||
#cameraOptionsXmlHttp: XMLHttpRequest | null = null;
|
||||
#bradcastPositionXmlHttp: XMLHttpRequest | null = null;
|
||||
#cameraZoomRatio: number = 1.0;
|
||||
|
||||
#contextAction: null | ContextAction = null;
|
||||
#contextAction: null | ContextAction = null;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -136,10 +125,8 @@ export class Map extends L.Map {
|
||||
|
||||
this.#ID = ID;
|
||||
|
||||
this.setLayer("DCS Map mirror 2");
|
||||
|
||||
/* Minimap */
|
||||
var minimapLayer = new L.TileLayer(this.#mapLayers[Object.keys(this.#mapLayers)[0]].urlTemplate, { minZoom: 0, maxZoom: 13 });
|
||||
var minimapLayer = new L.TileLayer("https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}", { minZoom: 0, maxZoom: 13 });
|
||||
this.#miniMapLayerGroup = new L.LayerGroup([minimapLayer]);
|
||||
this.#miniMapPolyline = new L.Polyline([], { color: '#202831' });
|
||||
this.#miniMapPolyline.addTo(this.#miniMapLayerGroup);
|
||||
@ -218,13 +205,36 @@ export class Map extends L.Map {
|
||||
|
||||
document.addEventListener("configLoaded", () => {
|
||||
let config = getApp().getConfig();
|
||||
if (config.additionalMaps) {
|
||||
let additionalMaps = config.additionalMaps;
|
||||
let layerSet = false;
|
||||
|
||||
/* First load the map mirrors */
|
||||
if (config.mapMirrors) {
|
||||
let mapMirrors = config.mapMirrors;
|
||||
this.#mapMirrors = {
|
||||
...this.#mapMirrors,
|
||||
...mapMirrors
|
||||
}
|
||||
this.setLayerName(Object.keys(mapMirrors)[0]);
|
||||
}
|
||||
|
||||
/* Set the options, and if at least one mirror is available, select the first */
|
||||
if (Object.keys(this.#mapMirrors).length > 0) {
|
||||
this.setLayerName(Object.keys(this.#mapMirrors)[0]);
|
||||
layerSet = true; // Needed because this is async
|
||||
}
|
||||
|
||||
/* Then load the map layers */
|
||||
if (config.mapLayers) {
|
||||
let mapLayers = config.mapLayers;
|
||||
this.#mapLayers = {
|
||||
...this.#mapLayers,
|
||||
...additionalMaps
|
||||
...mapLayers
|
||||
}
|
||||
//this.#mapSourceDropdown.setOptions(this.getLayers(), null);
|
||||
}
|
||||
|
||||
/* Append this options, and if no mirror was selected, select the first on (if available). Mirrors have the precedence */
|
||||
if (!layerSet && Object.keys(this.#mapLayers).length > 0) {
|
||||
this.setLayerName(Object.keys(this.#mapLayers)[0]);
|
||||
}
|
||||
})
|
||||
|
||||
@ -253,11 +263,11 @@ export class Map extends L.Map {
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
setLayer(layerName: string) {
|
||||
if (this.#layer != null)
|
||||
this.removeLayer(this.#layer)
|
||||
setLayerName(layerName: string) {
|
||||
if (this.#layer)
|
||||
this.removeLayer(this.#layer);
|
||||
|
||||
let theatre = getApp().getMissionManager()?.getTheatre() ?? "Nevada";
|
||||
let theatre = getApp().getMissionManager()?.getTheatre();
|
||||
|
||||
/* Normal or custom layers are handled here */
|
||||
if (layerName in this.#mapLayers) {
|
||||
@ -267,16 +277,18 @@ export class Map extends L.Map {
|
||||
return new L.TileLayer(layer.urlTemplate.replace("{theatre}", theatre.toLowerCase()), layer);
|
||||
})
|
||||
this.#layer = new L.LayerGroup(layers);
|
||||
this.#layer?.addTo(this);
|
||||
} else {
|
||||
this.#layer = new L.TileLayer(layerData.urlTemplate, layerData);
|
||||
this.#layer?.addTo(this);
|
||||
}
|
||||
/* DCS core layers are handled here */
|
||||
} else if (["DCS Map mirror 1", "DCS Map mirror 2"].includes(layerName) ) {
|
||||
let layerData = this.#mapLayers["ArcGIS Satellite"];
|
||||
let layers = [new L.TileLayer(layerData.urlTemplate, layerData)];
|
||||
|
||||
/* Mirrored layers are handled here */
|
||||
} else if (Object.keys(this.#mapMirrors).includes(layerName) ) {
|
||||
let layers: L.TileLayer[] = [];
|
||||
|
||||
/* Load the configuration file */
|
||||
const mirror = mapMirrors[layerName as keyof typeof mapMirrors];
|
||||
const mirror = this.#mapMirrors[layerName as any];
|
||||
const request = new Request(mirror + "/config.json");
|
||||
fetch(request).then((response) => {
|
||||
if (response.status === 200) {
|
||||
@ -299,16 +311,20 @@ export class Map extends L.Map {
|
||||
})
|
||||
}
|
||||
this.#layerName = layerName;
|
||||
|
||||
document.dispatchEvent(new CustomEvent("mapSourceChanged", {detail: layerName}));
|
||||
}
|
||||
|
||||
getLayerName() {
|
||||
return this.#layerName;
|
||||
}
|
||||
|
||||
getLayers() {
|
||||
let layers = ["DCS Map mirror 1", "DCS Map mirror 2"];
|
||||
layers.push(...Object.keys(this.#mapLayers));
|
||||
return layers;
|
||||
return Object.keys(this.#mapLayers);
|
||||
}
|
||||
|
||||
/* State machine */
|
||||
setState(state: string, options?: { spawnRequestTable?: SpawnRequestTable, contextAction?: ContextAction }) {
|
||||
setState(state: string, options?: { spawnRequestTable?: SpawnRequestTable, contextAction?: ContextAction | null }) {
|
||||
this.#state = state;
|
||||
|
||||
/* Operations to perform if you are NOT in a state */
|
||||
@ -317,7 +333,9 @@ export class Map extends L.Map {
|
||||
}
|
||||
|
||||
/* Operations to perform if you ARE in a state */
|
||||
if (this.#state === SPAWN_UNIT) {
|
||||
if (this.#state === IDLE) {
|
||||
getApp().getUnitsManager().deselectAllUnits();
|
||||
} else if (this.#state === SPAWN_UNIT) {
|
||||
this.#spawnRequestTable = options?.spawnRequestTable ?? null;
|
||||
this.#spawnCursor?.removeFrom(this);
|
||||
this.#spawnCursor = new TemporaryUnitMarker(new L.LatLng(0, 0), this.#spawnRequestTable?.unit.unitType ?? "unknown", this.#spawnRequestTable?.coalition ?? 'blue');
|
||||
@ -486,7 +504,7 @@ export class Map extends L.Map {
|
||||
const boundaries = this.#getMinimapBoundaries();
|
||||
this.#miniMapPolyline.setLatLngs(boundaries[theatre as keyof typeof boundaries]);
|
||||
|
||||
this.setLayer(this.#layerName);
|
||||
this.setLayerName(this.#layerName);
|
||||
}
|
||||
|
||||
getMiniMapLayerGroup() {
|
||||
@ -615,21 +633,25 @@ export class Map extends L.Map {
|
||||
}
|
||||
|
||||
increaseCameraZoom() {
|
||||
const slider = document.querySelector(`label[title="${DCS_LINK_RATIO}"] input`);
|
||||
if (slider instanceof HTMLInputElement) {
|
||||
slider.value = String(Math.min(Number(slider.max), Number(slider.value) + 10));
|
||||
slider.dispatchEvent(new Event('input'));
|
||||
slider.dispatchEvent(new Event('mouseup'));
|
||||
}
|
||||
//const slider = document.querySelector(`label[title="${DCS_LINK_RATIO}"] input`);
|
||||
//if (slider instanceof HTMLInputElement) {
|
||||
// slider.value = String(Math.min(Number(slider.max), Number(slider.value) + 10));
|
||||
// slider.dispatchEvent(new Event('input'));
|
||||
// slider.dispatchEvent(new Event('mouseup'));
|
||||
//}
|
||||
}
|
||||
|
||||
decreaseCameraZoom() {
|
||||
const slider = document.querySelector(`label[title="${DCS_LINK_RATIO}"] input`);
|
||||
if (slider instanceof HTMLInputElement) {
|
||||
slider.value = String(Math.max(Number(slider.min), Number(slider.value) - 10));
|
||||
slider.dispatchEvent(new Event('input'));
|
||||
slider.dispatchEvent(new Event('mouseup'));
|
||||
}
|
||||
//const slider = document.querySelector(`label[title="${DCS_LINK_RATIO}"] input`);
|
||||
//if (slider instanceof HTMLInputElement) {
|
||||
// slider.value = String(Math.max(Number(slider.min), Number(slider.value) - 10));
|
||||
// slider.dispatchEvent(new Event('input'));
|
||||
// slider.dispatchEvent(new Event('mouseup'));
|
||||
//}
|
||||
}
|
||||
|
||||
executeContextAction(targetUnit: Unit | null, targetPosition: L.LatLng | null) {
|
||||
this.#contextAction?.executeCallback(targetUnit, targetPosition);
|
||||
}
|
||||
|
||||
/* Event handlers */
|
||||
@ -663,6 +685,8 @@ export class Map extends L.Map {
|
||||
else {
|
||||
this.deselectAllCoalitionAreas();
|
||||
}
|
||||
} else if (this.#state === CONTEXT_ACTION) {
|
||||
this.executeContextAction(null, e.latlng);
|
||||
}
|
||||
else {
|
||||
this.setState(IDLE);
|
||||
@ -672,7 +696,7 @@ export class Map extends L.Map {
|
||||
}
|
||||
|
||||
#onDoubleClick(e: any) {
|
||||
|
||||
this.setState(IDLE);
|
||||
}
|
||||
|
||||
#onContextMenu(e: any) {
|
||||
@ -714,10 +738,6 @@ export class Map extends L.Map {
|
||||
this.#computeDestinationRotation = false;
|
||||
}
|
||||
}
|
||||
else if (this.#state === CONTEXT_ACTION) {
|
||||
if (this.#contextAction)
|
||||
this.#contextAction.executeCallback(null, e.latlng);
|
||||
}
|
||||
else {
|
||||
this.setState(IDLE);
|
||||
}
|
||||
|
||||
1044
frontend/react/src/map/map.ts.bak
Normal file
1044
frontend/react/src/map/map.ts.bak
Normal file
File diff suppressed because it is too large
Load Diff
@ -14,39 +14,25 @@ export function getApp() {
|
||||
|
||||
import { Map } from "./map/map";
|
||||
import { MissionManager } from "./mission/missionmanager";
|
||||
//import { ConnectionStatusPanel } from "./panels/connectionstatuspanel";
|
||||
//import { HotgroupPanel } from "./panels/hotgrouppanel";
|
||||
//import { LogPanel } from "./panels/logpanel";
|
||||
//import { MouseInfoPanel } from "./panels/mouseinfopanel";
|
||||
//import { ServerStatusPanel } from "./panels/serverstatuspanel";
|
||||
//import { UnitControlPanel } from "./panels/unitcontrolpanel";
|
||||
//import { UnitInfoPanel } from "./panels/unitinfopanel";
|
||||
//import { PluginsManager } from "./plugin/pluginmanager";
|
||||
//import { Popup } from "./popups/popup";
|
||||
import { ShortcutManager } from "./shortcut/shortcutmanager";
|
||||
//import { CommandModeToolbar } from "./toolbars/commandmodetoolbar";
|
||||
//import { PrimaryToolbar } from "./toolbars/primarytoolbar";
|
||||
import { UnitsManager } from "./unit/unitsmanager";
|
||||
import { WeaponsManager } from "./weapon/weaponsmanager";
|
||||
//import { Manager } from "./other/manager";
|
||||
import { ServerManager } from "./server/servermanager";
|
||||
import { sha256 } from 'js-sha256';
|
||||
|
||||
import { BLUE_COMMANDER, FILL_SELECTED_RING, GAME_MASTER, HIDE_UNITS_SHORT_RANGE_RINGS, RED_COMMANDER, SHOW_UNITS_ACQUISITION_RINGS, SHOW_UNITS_ENGAGEMENT_RINGS, SHOW_UNIT_LABELS } from "./constants/constants";
|
||||
import { BLUE_COMMANDER, DEFAULT_CONTEXT, GAME_MASTER, RED_COMMANDER } from "./constants/constants";
|
||||
import { aircraftDatabase } from "./unit/databases/aircraftdatabase";
|
||||
import { helicopterDatabase } from "./unit/databases/helicopterdatabase";
|
||||
import { groundUnitDatabase } from "./unit/databases/groundunitdatabase";
|
||||
import { navyUnitDatabase } from "./unit/databases/navyunitdatabase";
|
||||
//import { UnitListPanel } from "./panels/unitlistpanel";
|
||||
//import { ContextManager } from "./context/contextmanager";
|
||||
//import { Context } from "./context/context";
|
||||
import { Coalition, Context } from "./types/types";
|
||||
|
||||
export var VERSION = "{{OLYMPUS_VERSION_NUMBER}}";
|
||||
export var IP = window.location.toString();
|
||||
export var connectedToServer = true; // Temporary
|
||||
|
||||
export class OlympusApp {
|
||||
/* Global data */
|
||||
#activeCoalition: string = "blue";
|
||||
#activeCoalition: Coalition = "blue";
|
||||
#latestVersion: string|undefined = undefined;
|
||||
#config: any = {};
|
||||
|
||||
@ -54,54 +40,31 @@ export class OlympusApp {
|
||||
#map: Map | null = null;
|
||||
|
||||
/* Managers */
|
||||
//#contextManager!: ContextManager;
|
||||
//#dialogManager!: Manager;
|
||||
#missionManager: MissionManager | null = null;
|
||||
//#panelsManager: Manager | null = null;
|
||||
//#pluginsManager: PluginsManager | null = null;
|
||||
//#popupsManager: Manager | null = null;
|
||||
#serverManager: ServerManager | null = null;
|
||||
#shortcutManager!: ShortcutManager;
|
||||
//#toolbarsManager: Manager | null = null;
|
||||
#shortcutManager: ShortcutManager | null = null;
|
||||
#unitsManager: UnitsManager | null = null;
|
||||
#weaponsManager: WeaponsManager | null = null;
|
||||
//#pluginsManager: // TODO
|
||||
|
||||
/* Current context */
|
||||
#context: Context = DEFAULT_CONTEXT;
|
||||
|
||||
constructor() {
|
||||
}
|
||||
|
||||
// TODO add checks on null
|
||||
getDialogManager() {
|
||||
return null //this.#dialogManager as Manager;
|
||||
getCurrentContext() {
|
||||
return this.#context;
|
||||
}
|
||||
|
||||
getMap() {
|
||||
return this.#map as Map;
|
||||
}
|
||||
|
||||
getCurrentContext() {
|
||||
return null //this.getContextManager().getCurrentContext() as Context;
|
||||
}
|
||||
|
||||
getContextManager() {
|
||||
return null // this.#contextManager as ContextManager;
|
||||
}
|
||||
|
||||
getServerManager() {
|
||||
return this.#serverManager as ServerManager;
|
||||
}
|
||||
|
||||
getPanelsManager() {
|
||||
return null // this.#panelsManager as Manager;
|
||||
}
|
||||
|
||||
getPopupsManager() {
|
||||
return null // this.#popupsManager as Manager;
|
||||
}
|
||||
|
||||
getToolbarsManager() {
|
||||
return null // this.#toolbarsManager as Manager;
|
||||
}
|
||||
|
||||
getShortcutManager() {
|
||||
return this.#shortcutManager as ShortcutManager;
|
||||
}
|
||||
@ -118,15 +81,17 @@ export class OlympusApp {
|
||||
return this.#missionManager as MissionManager;
|
||||
}
|
||||
|
||||
/* TODO
|
||||
getPluginsManager() {
|
||||
return null // this.#pluginsManager as PluginsManager;
|
||||
}
|
||||
*/
|
||||
|
||||
/** Set the active coalition, i.e. the currently controlled coalition. A game master can change the active coalition, while a commander is bound to his/her coalition
|
||||
*
|
||||
* @param newActiveCoalition
|
||||
*/
|
||||
setActiveCoalition(newActiveCoalition: string) {
|
||||
setActiveCoalition(newActiveCoalition: Coalition) {
|
||||
if (this.getMissionManager().getCommandModeOptions().commandMode == GAME_MASTER) {
|
||||
this.#activeCoalition = newActiveCoalition;
|
||||
document.dispatchEvent(new CustomEvent("activeCoalitionChanged"));
|
||||
@ -137,7 +102,7 @@ export class OlympusApp {
|
||||
*
|
||||
* @returns The active coalition
|
||||
*/
|
||||
getActiveCoalition() {
|
||||
getActiveCoalition(): Coalition {
|
||||
if (this.getMissionManager().getCommandModeOptions().commandMode == GAME_MASTER)
|
||||
return this.#activeCoalition;
|
||||
else {
|
||||
@ -182,77 +147,22 @@ export class OlympusApp {
|
||||
return navyUnitDatabase;
|
||||
}
|
||||
|
||||
/** Set a message in the login splash screen
|
||||
*
|
||||
* @param status The message to show in the login splash screen
|
||||
*/
|
||||
setLoginStatus(status: string) {
|
||||
const el = document.querySelector("#login-status") as HTMLElement;
|
||||
if (el)
|
||||
el.dataset["status"] = status;
|
||||
}
|
||||
|
||||
start() {
|
||||
/* Initialize base functionalitites */
|
||||
//this.#contextManager = new ContextManager();
|
||||
//this.#contextManager.add( "olympus", {} );
|
||||
|
||||
this.#map = new Map('map-container');
|
||||
|
||||
this.#missionManager = new MissionManager();
|
||||
//this.#panelsManager = new Manager();
|
||||
//this.#popupsManager = new Manager();
|
||||
this.#serverManager = new ServerManager();
|
||||
this.#shortcutManager = new ShortcutManager();
|
||||
//this.#toolbarsManager = new Manager();
|
||||
this.#unitsManager = new UnitsManager();
|
||||
this.#weaponsManager = new WeaponsManager();
|
||||
|
||||
// Toolbars
|
||||
//this.getToolbarsManager().add("primaryToolbar", new PrimaryToolbar("primary-toolbar"))
|
||||
// .add("commandModeToolbar", new CommandModeToolbar("command-mode-toolbar"));
|
||||
//
|
||||
//// Panels
|
||||
//this.getPanelsManager()
|
||||
// .add("connectionStatus", new ConnectionStatusPanel("connection-status-panel"))
|
||||
// .add("hotgroup", new HotgroupPanel("hotgroup-panel"))
|
||||
// .add("mouseInfo", new MouseInfoPanel("mouse-info-panel"))
|
||||
// .add("log", new LogPanel("log-panel"))
|
||||
// .add("serverStatus", new ServerStatusPanel("server-status-panel"))
|
||||
// .add("unitControl", new UnitControlPanel("unit-control-panel"))
|
||||
// .add("unitInfo", new UnitInfoPanel("unit-info-panel"))
|
||||
// .add("unitList", new UnitListPanel("unit-list-panel", "unit-list-panel-content"))
|
||||
//
|
||||
//// Popups
|
||||
//this.getPopupsManager()
|
||||
// .add("infoPopup", new Popup("info-popup"));
|
||||
//
|
||||
//this.#pluginsManager = new PluginsManager();
|
||||
|
||||
/* Set the address of the server */
|
||||
this.getServerManager().setAddress(window.location.href.split('?')[0]);
|
||||
|
||||
/* Setup all global events */
|
||||
this.#setupEvents();
|
||||
|
||||
/* Set the splash background image to a random image */
|
||||
let splashScreen = document.getElementById("splash-screen") as HTMLElement;
|
||||
let i = Math.round(Math.random() * 7 + 1);
|
||||
|
||||
if (splashScreen) {
|
||||
new Promise((resolve, reject) => {
|
||||
const image = new Image();
|
||||
image.addEventListener('load', resolve);
|
||||
image.addEventListener('error', resolve);
|
||||
image.src = `/resources/theme/images/splash/${i}.jpg`;
|
||||
}).then(() => {
|
||||
splashScreen.style.backgroundImage = `url('/resources/theme/images/splash/${i}.jpg')`;
|
||||
let loadingScreen = document.getElementById("loading-screen") as HTMLElement;
|
||||
loadingScreen.classList.add("fade-out");
|
||||
window.setInterval(() => { loadingScreen.classList.add("hide"); }, 1000);
|
||||
})
|
||||
}
|
||||
|
||||
/* Check if we are running the latest version */
|
||||
const request = new Request("https://raw.githubusercontent.com/Pax1601/DCSOlympus/main/version.json");
|
||||
fetch(request).then((response) => {
|
||||
@ -285,181 +195,14 @@ export class OlympusApp {
|
||||
})
|
||||
}
|
||||
|
||||
getConfig() {
|
||||
return this.#config;
|
||||
}
|
||||
|
||||
#setupEvents() {
|
||||
/* Generic clicks */
|
||||
document.addEventListener("click", (ev) => {
|
||||
if (ev instanceof MouseEvent && ev.target instanceof HTMLElement) {
|
||||
const target = ev.target;
|
||||
|
||||
if (target.classList.contains("olympus-dialog-close")) {
|
||||
target.closest("div.olympus-dialog")?.classList.add("hide");
|
||||
}
|
||||
|
||||
const triggerElement = target.closest("[data-on-click]");
|
||||
|
||||
if (triggerElement instanceof HTMLElement) {
|
||||
const eventName: string = triggerElement.dataset.onClick || "";
|
||||
let params = JSON.parse(triggerElement.dataset.onClickParams || "{}");
|
||||
params._element = triggerElement;
|
||||
|
||||
if (eventName) {
|
||||
document.dispatchEvent(new CustomEvent(eventName, {
|
||||
detail: params
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const shortcutManager = this.getShortcutManager();
|
||||
shortcutManager.addKeyboardShortcut("togglePause", {
|
||||
"altKey": false,
|
||||
"callback": () => {
|
||||
this.getServerManager().setPaused(!this.getServerManager().getPaused());
|
||||
},
|
||||
"code": "Space",
|
||||
"context": "olympus",
|
||||
"ctrlKey": false
|
||||
}).addKeyboardShortcut("deselectAll", {
|
||||
"callback": (ev: KeyboardEvent) => {
|
||||
this.getUnitsManager().deselectAllUnits();
|
||||
},
|
||||
"code": "Escape",
|
||||
"context": "olympus"
|
||||
}).addKeyboardShortcut("toggleUnitLabels", {
|
||||
"altKey": false,
|
||||
"callback": () => {
|
||||
const chk = document.querySelector(`label[title="${SHOW_UNIT_LABELS}"] input[type="checkbox"]`);
|
||||
if (chk instanceof HTMLElement) {
|
||||
chk.click();
|
||||
}
|
||||
},
|
||||
"code": "KeyL",
|
||||
"context": "olympus",
|
||||
"ctrlKey": false,
|
||||
"shiftKey": false
|
||||
}).addKeyboardShortcut("toggleAcquisitionRings", {
|
||||
"altKey": false,
|
||||
"callback": () => {
|
||||
const chk = document.querySelector(`label[title="${SHOW_UNITS_ACQUISITION_RINGS}"] input[type="checkbox"]`);
|
||||
if (chk instanceof HTMLElement) {
|
||||
chk.click();
|
||||
}
|
||||
},
|
||||
"code": "KeyE",
|
||||
"context": "olympus",
|
||||
"ctrlKey": false,
|
||||
"shiftKey": false
|
||||
}).addKeyboardShortcut("toggleEngagementRings", {
|
||||
"altKey": false,
|
||||
"callback": () => {
|
||||
const chk = document.querySelector(`label[title="${SHOW_UNITS_ENGAGEMENT_RINGS}"] input[type="checkbox"]`);
|
||||
if (chk instanceof HTMLElement) {
|
||||
chk.click();
|
||||
}
|
||||
},
|
||||
"code": "KeyQ",
|
||||
"context": "olympus",
|
||||
"ctrlKey": false,
|
||||
"shiftKey": false
|
||||
}).addKeyboardShortcut("toggleHideShortEngagementRings", {
|
||||
"altKey": false,
|
||||
"callback": () => {
|
||||
const chk = document.querySelector(`label[title="${HIDE_UNITS_SHORT_RANGE_RINGS}"] input[type="checkbox"]`);
|
||||
if (chk instanceof HTMLElement) {
|
||||
chk.click();
|
||||
}
|
||||
},
|
||||
"code": "KeyR",
|
||||
"context": "olympus",
|
||||
"ctrlKey": false,
|
||||
"shiftKey": false
|
||||
}).addKeyboardShortcut("toggleFillEngagementRings", {
|
||||
"altKey": false,
|
||||
"callback": () => {
|
||||
const chk = document.querySelector(`label[title="${FILL_SELECTED_RING}"] input[type="checkbox"]`);
|
||||
if (chk instanceof HTMLElement) {
|
||||
chk.click();
|
||||
}
|
||||
},
|
||||
"code": "KeyF",
|
||||
"context": "olympus",
|
||||
"ctrlKey": false,
|
||||
"shiftKey": false
|
||||
}).addKeyboardShortcut("increaseCameraZoom", {
|
||||
"altKey": true,
|
||||
"callback": () => {
|
||||
//this.getMap().increaseCameraZoom();
|
||||
},
|
||||
"code": "Equal",
|
||||
"context": "olympus",
|
||||
"ctrlKey": false,
|
||||
"shiftKey": false
|
||||
}).addKeyboardShortcut("decreaseCameraZoom", {
|
||||
"altKey": true,
|
||||
"callback": () => {
|
||||
//this.getMap().decreaseCameraZoom();
|
||||
},
|
||||
"code": "Minus",
|
||||
"context": "olympus",
|
||||
"ctrlKey": false,
|
||||
"shiftKey": false
|
||||
});
|
||||
|
||||
["KeyW", "KeyA", "KeyS", "KeyD", "ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown"].forEach(code => {
|
||||
shortcutManager.addKeyboardShortcut(`pan${code}keydown`, {
|
||||
"altKey": false,
|
||||
"callback": (ev: KeyboardEvent) => {
|
||||
//this.getMap().handleMapPanning(ev);
|
||||
},
|
||||
"code": code,
|
||||
"context": "olympus",
|
||||
"ctrlKey": false,
|
||||
"event": "keydown"
|
||||
});
|
||||
|
||||
shortcutManager.addKeyboardShortcut(`pan${code}keyup`, {
|
||||
"callback": (ev: KeyboardEvent) => {
|
||||
//this.getMap().handleMapPanning(ev);
|
||||
},
|
||||
"code": code,
|
||||
"context": "olympus"
|
||||
});
|
||||
});
|
||||
|
||||
const digits = ["Digit1", "Digit2", "Digit3", "Digit4", "Digit5", "Digit6", "Digit7", "Digit8", "Digit9"];
|
||||
|
||||
digits.forEach(code => {
|
||||
shortcutManager.addKeyboardShortcut(`hotgroup${code}`, {
|
||||
"altKey": false,
|
||||
"callback": (ev: KeyboardEvent) => {
|
||||
if (ev.ctrlKey && ev.shiftKey)
|
||||
this.getUnitsManager().selectUnitsByHotgroup(parseInt(ev.code.substring(5)), false); // "Select hotgroup X in addition to any units already selected"
|
||||
else if (ev.ctrlKey && !ev.shiftKey)
|
||||
this.getUnitsManager().setHotgroup(parseInt(ev.code.substring(5))); // "These selected units are hotgroup X (forget any previous membership)"
|
||||
else if (!ev.ctrlKey && ev.shiftKey)
|
||||
this.getUnitsManager().addToHotgroup(parseInt(ev.code.substring(5))); // "Add (append) these units to hotgroup X (in addition to any existing members)"
|
||||
else
|
||||
this.getUnitsManager().selectUnitsByHotgroup(parseInt(ev.code.substring(5))); // "Select hotgroup X, deselect any units not in it."
|
||||
},
|
||||
"code": code
|
||||
});
|
||||
|
||||
// Stop hotgroup controls sending the browser to another tab
|
||||
document.addEventListener("keydown", (ev: KeyboardEvent) => {
|
||||
if (ev.code === code && ev.ctrlKey === true && ev.altKey === false && ev.shiftKey === false) {
|
||||
ev.preventDefault();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/* Reload the page, used to mimic a restart of the app */
|
||||
document.addEventListener("reloadPage", () => {
|
||||
location.reload();
|
||||
})
|
||||
}
|
||||
|
||||
getConfig() {
|
||||
return this.#config;
|
||||
}
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
import { Manager } from "./manager";
|
||||
|
||||
export abstract class EventsManager extends Manager {
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
@ -1,37 +0,0 @@
|
||||
import { Context } from "../context/context";
|
||||
|
||||
export class Manager {
|
||||
|
||||
#items: { [key: string]: any } = {};
|
||||
|
||||
constructor() {
|
||||
|
||||
}
|
||||
|
||||
add(name: string, item: any) {
|
||||
const regex = new RegExp("^[a-z][a-z0-9]{2,}$", "i");
|
||||
if (regex.test(name) === false) {
|
||||
throw new Error(`Item name "${name}" does not match regex: ${regex.toString()}.`);
|
||||
}
|
||||
|
||||
if (this.#items.hasOwnProperty(name)) {
|
||||
throw new Error(`Item with name "${name}" already exists.`);
|
||||
}
|
||||
|
||||
this.#items[name] = item;
|
||||
return this;
|
||||
}
|
||||
|
||||
get(name: string) {
|
||||
if (this.#items.hasOwnProperty(name)) {
|
||||
return this.#items[name];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
getAll() {
|
||||
return this.#items;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,13 +1,7 @@
|
||||
import { LatLng } from 'leaflet';
|
||||
import { getApp } from '../olympusapp';
|
||||
import { AIRBASES_URI, BULLSEYE_URI, COMMANDS_URI, LOGS_URI, MISSION_URI, NONE, ROEs, UNITS_URI, WEAPONS_URI, emissionsCountermeasures, reactionsToThreat } from '../constants/constants';
|
||||
//import { ServerStatusPanel } from '../panels/serverstatuspanel';
|
||||
//import { LogPanel } from '../panels/logpanel';
|
||||
//import { Popup } from '../popups/popup';
|
||||
//import { ConnectionStatusPanel } from '../panels/connectionstatuspanel';
|
||||
import { AirbasesData, BullseyesData, GeneralSettings, MissionData, Radio, ServerRequestOptions, ServerStatus, TACAN } from '../interfaces';
|
||||
import { zeroAppend } from '../other/utils';
|
||||
import { SiTheregister } from 'react-icons/si';
|
||||
|
||||
export class ServerManager {
|
||||
#connected: boolean = false;
|
||||
@ -89,7 +83,6 @@ export class ServerManager {
|
||||
} else if (xmlHttp.status == 401) {
|
||||
/* Bad credentials */
|
||||
console.error("Incorrect username/password");
|
||||
getApp().setLoginStatus("failed");
|
||||
errorCallback && errorCallback(xmlHttp.status);
|
||||
} else {
|
||||
/* Failure, probably disconnected */
|
||||
@ -118,6 +111,8 @@ export class ServerManager {
|
||||
callback(res.commandHash);
|
||||
};
|
||||
xmlHttp.send(JSON.stringify(request));
|
||||
console.log(`Sending PUT request:`);
|
||||
console.log(request);
|
||||
}
|
||||
|
||||
getConfig(callback: CallableFunction) {
|
||||
|
||||
@ -20,7 +20,7 @@ export class ShortcutKeyboard extends Shortcut {
|
||||
super(config);
|
||||
|
||||
document.addEventListener(config.event, (ev: any) => {
|
||||
if ( typeof config.context === "string" && !getApp().getContextManager().currentContextIs( config.context ) ) {
|
||||
if ( typeof config.context === "string" && getApp().getCurrentContext() !== config.context ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -1,18 +1,16 @@
|
||||
import { DEFAULT_CONTEXT } from "../constants/constants";
|
||||
import { ShortcutKeyboardOptions, ShortcutMouseOptions } from "../interfaces";
|
||||
import { Manager } from "../other/manager";
|
||||
|
||||
import { getApp } from "../olympusapp";
|
||||
import { ShortcutKeyboard, ShortcutMouse } from "./shortcut";
|
||||
|
||||
export class ShortcutManager extends Manager {
|
||||
export class ShortcutManager {
|
||||
|
||||
#items: { [key: string]: any } = {};
|
||||
#keysBeingHeld: string[] = [];
|
||||
#keyDownCallbacks: CallableFunction[] = [];
|
||||
#keyUpCallbacks: CallableFunction[] = [];
|
||||
|
||||
constructor() {
|
||||
|
||||
super();
|
||||
|
||||
document.addEventListener("keydown", (ev: KeyboardEvent) => {
|
||||
if (this.#keysBeingHeld.indexOf(ev.code) < 0) {
|
||||
this.#keysBeingHeld.push(ev.code)
|
||||
@ -25,20 +23,137 @@ export class ShortcutManager extends Manager {
|
||||
this.#keyUpCallbacks.forEach(callback => callback(ev));
|
||||
});
|
||||
|
||||
}
|
||||
this.addKeyboardShortcut("togglePause", {
|
||||
"altKey": false,
|
||||
"callback": () => {
|
||||
getApp().getServerManager().setPaused(!getApp().getServerManager().getPaused());
|
||||
},
|
||||
"code": "Space",
|
||||
"context": DEFAULT_CONTEXT,
|
||||
"ctrlKey": false
|
||||
}).addKeyboardShortcut("deselectAll", {
|
||||
"callback": (ev: KeyboardEvent) => {
|
||||
getApp().getUnitsManager().deselectAllUnits();
|
||||
},
|
||||
"code": "Escape",
|
||||
"context": DEFAULT_CONTEXT
|
||||
}).addKeyboardShortcut("toggleUnitLabels", {
|
||||
"altKey": false,
|
||||
"callback": () => { getApp().getMap().setOption("showUnitLabels", !getApp().getMap().getOptions().showUnitLabels) },
|
||||
"code": "KeyL",
|
||||
"context": DEFAULT_CONTEXT,
|
||||
"ctrlKey": false,
|
||||
"shiftKey": false
|
||||
}).addKeyboardShortcut("toggleAcquisitionRings", {
|
||||
"altKey": false,
|
||||
"callback": () => { getApp().getMap().setOption("showUnitsAcquisitionRings", !getApp().getMap().getOptions().showUnitsAcquisitionRings) },
|
||||
"code": "KeyE",
|
||||
"context": DEFAULT_CONTEXT,
|
||||
"ctrlKey": false,
|
||||
"shiftKey": false
|
||||
}).addKeyboardShortcut("toggleEngagementRings", {
|
||||
"altKey": false,
|
||||
"callback": () => { getApp().getMap().setOption("showUnitsEngagementRings", !getApp().getMap().getOptions().showUnitsEngagementRings) },
|
||||
"code": "KeyQ",
|
||||
"context": DEFAULT_CONTEXT,
|
||||
"ctrlKey": false,
|
||||
"shiftKey": false
|
||||
}).addKeyboardShortcut("toggleHideShortEngagementRings", {
|
||||
"altKey": false,
|
||||
"callback": () => { getApp().getMap().setOption("hideUnitsShortRangeRings", !getApp().getMap().getOptions().hideUnitsShortRangeRings) },
|
||||
"code": "KeyR",
|
||||
"context": DEFAULT_CONTEXT,
|
||||
"ctrlKey": false,
|
||||
"shiftKey": false
|
||||
}).addKeyboardShortcut("toggleDetectionLines", {
|
||||
"altKey": false,
|
||||
"callback": () => { getApp().getMap().setOption("showUnitTargets", !getApp().getMap().getOptions().showUnitTargets) },
|
||||
"code": "KeyF",
|
||||
"context": DEFAULT_CONTEXT,
|
||||
"ctrlKey": false,
|
||||
"shiftKey": false
|
||||
}).addKeyboardShortcut("toggleGroupMembers", {
|
||||
"altKey": false,
|
||||
"callback": () => { getApp().getMap().setOption("hideGroupMembers", !getApp().getMap().getOptions().hideGroupMembers) },
|
||||
"code": "KeyG",
|
||||
"context": DEFAULT_CONTEXT,
|
||||
"ctrlKey": false,
|
||||
"shiftKey": false
|
||||
}).addKeyboardShortcut("increaseCameraZoom", {
|
||||
"altKey": true,
|
||||
"callback": () => {
|
||||
//getApp().getMap().increaseCameraZoom();
|
||||
},
|
||||
"code": "Equal",
|
||||
"context": DEFAULT_CONTEXT,
|
||||
"ctrlKey": false,
|
||||
"shiftKey": false
|
||||
}).addKeyboardShortcut("decreaseCameraZoom", {
|
||||
"altKey": true,
|
||||
"callback": () => {
|
||||
//getApp().getMap().decreaseCameraZoom();
|
||||
},
|
||||
"code": "Minus",
|
||||
"context": DEFAULT_CONTEXT,
|
||||
"ctrlKey": false,
|
||||
"shiftKey": false
|
||||
});
|
||||
|
||||
add(name: string, shortcut: any) {
|
||||
console.error("ShortcutManager:add() cannot be used. Use addKeyboardShortcut or addMouseShortcut.");
|
||||
return this;
|
||||
["KeyW", "KeyA", "KeyS", "KeyD", "ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown"].forEach(code => {
|
||||
this.addKeyboardShortcut(`pan${code}keydown`, {
|
||||
"altKey": false,
|
||||
"callback": (ev: KeyboardEvent) => {
|
||||
//getApp().getMap().handleMapPanning(ev);
|
||||
},
|
||||
"code": code,
|
||||
"context": DEFAULT_CONTEXT,
|
||||
"ctrlKey": false,
|
||||
"event": "keydown"
|
||||
});
|
||||
|
||||
this.addKeyboardShortcut(`pan${code}keyup`, {
|
||||
"callback": (ev: KeyboardEvent) => {
|
||||
//getApp().getMap().handleMapPanning(ev);
|
||||
},
|
||||
"code": code,
|
||||
"context": DEFAULT_CONTEXT
|
||||
});
|
||||
});
|
||||
|
||||
const digits = ["Digit1", "Digit2", "Digit3", "Digit4", "Digit5", "Digit6", "Digit7", "Digit8", "Digit9"];
|
||||
|
||||
digits.forEach(code => {
|
||||
this.addKeyboardShortcut(`hotgroup${code}`, {
|
||||
"altKey": false,
|
||||
"callback": (ev: KeyboardEvent) => {
|
||||
if (ev.ctrlKey && ev.shiftKey)
|
||||
getApp().getUnitsManager().selectUnitsByHotgroup(parseInt(ev.code.substring(5)), false); // "Select hotgroup X in addition to any units already selected"
|
||||
else if (ev.ctrlKey && !ev.shiftKey)
|
||||
getApp().getUnitsManager().setHotgroup(parseInt(ev.code.substring(5))); // "These selected units are hotgroup X (forget any previous membership)"
|
||||
else if (!ev.ctrlKey && ev.shiftKey)
|
||||
getApp().getUnitsManager().addToHotgroup(parseInt(ev.code.substring(5))); // "Add (append) these units to hotgroup X (in addition to any existing members)"
|
||||
else
|
||||
getApp().getUnitsManager().selectUnitsByHotgroup(parseInt(ev.code.substring(5))); // "Select hotgroup X, deselect any units not in it."
|
||||
},
|
||||
"code": code
|
||||
});
|
||||
|
||||
// Stop hotgroup controls sending the browser to another tab
|
||||
document.addEventListener("keydown", (ev: KeyboardEvent) => {
|
||||
if (ev.code === code && ev.ctrlKey === true && ev.altKey === false && ev.shiftKey === false) {
|
||||
ev.preventDefault();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
addKeyboardShortcut(name: string, shortcutKeyboardOptions: ShortcutKeyboardOptions) {
|
||||
super.add(name, new ShortcutKeyboard(shortcutKeyboardOptions));
|
||||
this.#items[name] = new ShortcutKeyboard(shortcutKeyboardOptions);
|
||||
return this;
|
||||
}
|
||||
|
||||
addMouseShortcut(name: string, shortcutMouseOptions: ShortcutMouseOptions) {
|
||||
super.add(name, new ShortcutMouse(shortcutMouseOptions));
|
||||
this.#items[name] = new ShortcutMouse(shortcutMouseOptions);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ -9,7 +9,9 @@ export const StateContext = createContext({
|
||||
drawingMenuVisible: false,
|
||||
optionsMenuVisible: false,
|
||||
mapHiddenTypes: MAP_HIDDEN_TYPES_DEFAULTS,
|
||||
mapOptions: MAP_OPTIONS_DEFAULTS
|
||||
mapOptions: MAP_OPTIONS_DEFAULTS,
|
||||
mapSources: [] as string[],
|
||||
activeMapSource: ""
|
||||
})
|
||||
|
||||
export const StateProvider = StateContext.Provider;
|
||||
|
||||
@ -17,7 +17,8 @@ export type MapOptions = {
|
||||
showUnitTargets: boolean,
|
||||
showUnitLabels: boolean,
|
||||
showUnitsEngagementRings: boolean,
|
||||
showUnitsAcquisitionRings: boolean
|
||||
showUnitsAcquisitionRings: boolean,
|
||||
fillSelectedRing: boolean
|
||||
}
|
||||
|
||||
export type MapHiddenTypes = {
|
||||
@ -48,4 +49,6 @@ export type MGRS = {
|
||||
zoneNumber: string
|
||||
}
|
||||
|
||||
export type Coalition = "blue" | "neutral" | "red";
|
||||
export type Coalition = "blue" | "neutral" | "red";
|
||||
|
||||
export type Context = string;
|
||||
|
||||
@ -78,9 +78,10 @@ export function Header() {
|
||||
</div>
|
||||
<OlLabelToggle toggled={false} leftLabel={"Live"} rightLabel={"Map"} onClick={() => {}}></OlLabelToggle>
|
||||
<OlStateButton checked={false} icon={faCamera} onClick={() => {}} tooltip="Activate/deactivate camera plugin" />
|
||||
<OlDropdown label="DCS Sat" className="w-40">
|
||||
<OlDropdownItem className="w-full">DCS Sat</OlDropdownItem>
|
||||
<OlDropdownItem className="w-full">DCS Alt</OlDropdownItem>
|
||||
<OlDropdown label={appState.activeMapSource} className="w-80">
|
||||
{appState.mapSources.map((source) => {
|
||||
return <OlDropdownItem className="w-full" onClick={() => getApp().getMap().setLayerName(source)}>{ source }</OlDropdownItem>
|
||||
})}
|
||||
</OlDropdown>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
@ -1,16 +1,15 @@
|
||||
import React from "react";
|
||||
import { Menu } from "./components/menu";
|
||||
import { faArrowRightLong, faCheckCircle, faDatabase, faExternalLink, faExternalLinkAlt, faFile, faFileAlt, faFileExport, faFileImport, faTimesCircle } from '@fortawesome/free-solid-svg-icons';
|
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||
import { faGithub } from "@fortawesome/free-brands-svg-icons";
|
||||
import { OlCheckbox } from "../components/olcheckbox";
|
||||
import { OlLabelToggle } from "../components/ollabeltoggle";
|
||||
import { OlRangeSlider } from "../components/olrangeslider";
|
||||
import { OlNumberInput } from "../components/olnumberinput";
|
||||
import { MapOptions } from "../../types/types";
|
||||
import { getApp } from "../../olympusapp";
|
||||
|
||||
export function Options(props: {
|
||||
open: boolean,
|
||||
onClose: () => void,
|
||||
options: MapOptions,
|
||||
children?: JSX.Element | JSX.Element[],
|
||||
}) {
|
||||
return <Menu
|
||||
@ -19,31 +18,57 @@ export function Options(props: {
|
||||
showBackButton={false}
|
||||
onClose={props.onClose}
|
||||
>
|
||||
<div className="flex flex-col p-5 gap-2 font-normal text-gray-900 text-gray-800 dark:text-white ">
|
||||
<div className="group flex flex-row rounded-md justify-content gap-4 p-2 dark:hover:bg-olympus-400 cursor-pointer">
|
||||
<OlCheckbox checked={true} onChange={() => { }}></OlCheckbox>
|
||||
<span>Toggle Unit Labels</span>
|
||||
<div className="flex flex-col p-5 gap-2 font-normal text-gray-800 dark:text-white ">
|
||||
<div
|
||||
className="group flex flex-row rounded-md justify-content gap-4 p-2 dark:hover:bg-olympus-400 cursor-pointer"
|
||||
onClick={() => { getApp().getMap().setOption("showUnitLabels", !props.options.showUnitLabels) }}
|
||||
>
|
||||
<OlCheckbox checked={props.options.showUnitLabels} onChange={() => { }}></OlCheckbox>
|
||||
<span>Show Unit Labels</span>
|
||||
<kbd className="ml-auto px-2 py-1.5 text-xs font-semibold text-gray-800 bg-gray-100 border border-gray-200 rounded-lg dark:bg-gray-600 dark:text-gray-100 dark:border-gray-500">L</kbd>
|
||||
</div>
|
||||
<div className="group flex flex-row rounded-md justify-content gap-4 p-2 dark:hover:bg-olympus-400 cursor-pointer">
|
||||
<OlCheckbox checked={true} onChange={() => { }}></OlCheckbox>
|
||||
<span>Toggle Threat Rings</span>
|
||||
<div
|
||||
className="group flex flex-row rounded-md justify-content gap-4 p-2 dark:hover:bg-olympus-400 cursor-pointer"
|
||||
onClick={() => { getApp().getMap().setOption("showUnitsEngagementRings", !props.options.showUnitsEngagementRings) }}
|
||||
>
|
||||
<OlCheckbox checked={props.options.showUnitsEngagementRings} onChange={() => { }}></OlCheckbox>
|
||||
<span>Show Threat Rings</span>
|
||||
<kbd className="ml-auto px-2 py-1.5 text-xs font-semibold text-gray-800 bg-gray-100 border border-gray-200 rounded-lg dark:bg-gray-600 dark:text-gray-100 dark:border-gray-500">Q</kbd>
|
||||
</div>
|
||||
<div className="group flex flex-row rounded-md justify-content gap-4 p-2 dark:hover:bg-olympus-400 cursor-pointer">
|
||||
<OlCheckbox checked={true} onChange={() => { }}></OlCheckbox>
|
||||
<span>Toggle Detection rings</span>
|
||||
<div
|
||||
className="group flex flex-row rounded-md justify-content gap-4 p-2 dark:hover:bg-olympus-400 cursor-pointer"
|
||||
onClick={() => { getApp().getMap().setOption("showUnitsAcquisitionRings", !props.options.showUnitsAcquisitionRings) }}
|
||||
>
|
||||
<OlCheckbox checked={props.options.showUnitsAcquisitionRings} onChange={() => { }}></OlCheckbox>
|
||||
<span>Show Detection rings</span>
|
||||
<kbd className="ml-auto px-2 py-1.5 text-xs font-semibold text-gray-800 bg-gray-100 border border-gray-200 rounded-lg dark:bg-gray-600 dark:text-gray-100 dark:border-gray-500">E</kbd>
|
||||
</div>
|
||||
<div className="group flex flex-row rounded-md justify-content gap-4 p-2 dark:hover:bg-olympus-400 cursor-pointer">
|
||||
<OlCheckbox checked={true} onChange={() => { }}></OlCheckbox>
|
||||
<span>Toggle Detection lines</span>
|
||||
<div
|
||||
className="group flex flex-row rounded-md justify-content gap-4 p-2 dark:hover:bg-olympus-400 cursor-pointer"
|
||||
onClick={() => { getApp().getMap().setOption("showUnitTargets", !props.options.showUnitTargets) }}
|
||||
>
|
||||
<OlCheckbox checked={props.options.showUnitTargets} onChange={() => { }}></OlCheckbox>
|
||||
<span>Show Detection lines</span>
|
||||
<kbd className="ml-auto px-2 py-1.5 text-xs font-semibold text-gray-800 bg-gray-100 border border-gray-200 rounded-lg dark:bg-gray-600 dark:text-gray-100 dark:border-gray-500">F</kbd>
|
||||
</div>
|
||||
<div className="group flex flex-row rounded-md justify-content gap-4 p-2 dark:hover:bg-olympus-400 cursor-pointer">
|
||||
<OlCheckbox checked={true} onChange={() => { }}></OlCheckbox>
|
||||
<span>Toggle Radar lines</span>
|
||||
<div
|
||||
className="group flex flex-row rounded-md justify-content gap-4 p-2 dark:hover:bg-olympus-400 cursor-pointer"
|
||||
onClick={() => { getApp().getMap().setOption("hideUnitsShortRangeRings", !props.options.hideUnitsShortRangeRings) }}
|
||||
>
|
||||
<OlCheckbox checked={props.options.hideUnitsShortRangeRings} onChange={() => { }}></OlCheckbox>
|
||||
<span>Hide Short range Rings</span>
|
||||
<kbd className="ml-auto px-2 py-1.5 text-xs font-semibold text-gray-800 bg-gray-100 border border-gray-200 rounded-lg dark:bg-gray-600 dark:text-gray-100 dark:border-gray-500">R</kbd>
|
||||
</div>
|
||||
<div className="group flex flex-row rounded-md justify-content gap-4 p-2 dark:hover:bg-olympus-400 cursor-pointer">
|
||||
<OlCheckbox checked={true} onChange={() => { }}></OlCheckbox>
|
||||
<span>Toggle Something Else</span>
|
||||
<div
|
||||
className="group flex flex-row rounded-md justify-content gap-4 p-2 dark:hover:bg-olympus-400 cursor-pointer"
|
||||
onClick={() => { getApp().getMap().setOption("hideGroupMembers", !props.options.hideGroupMembers) }}
|
||||
>
|
||||
<OlCheckbox checked={props.options.hideGroupMembers} onChange={() => { }}></OlCheckbox>
|
||||
<span>Hide Group members</span>
|
||||
<kbd className="ml-auto px-2 py-1.5 text-xs font-semibold text-gray-800 bg-gray-100 border border-gray-200 rounded-lg dark:bg-gray-600 dark:text-gray-100 dark:border-gray-500">G</kbd>
|
||||
</div>
|
||||
|
||||
{/*
|
||||
<hr className="w-auto m-2 my-1 bg-gray-700 border-[1px] dark:border-olympus-500"></hr>
|
||||
<div className="flex flex-col content-center items-start justify-between p-2 gap-2">
|
||||
<div className="flex flex-col">
|
||||
@ -71,7 +96,7 @@ export function Options(props: {
|
||||
onChange={(ev) => { }}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div> */}
|
||||
</div>
|
||||
</Menu>
|
||||
}
|
||||
@ -1,13 +1,11 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import React, { useState } from 'react';
|
||||
import { Unit } from '../../unit/unit';
|
||||
import { ContextActionSet } from '../../unit/contextactionset';
|
||||
import { OlStateButton } from '../components/olstatebutton';
|
||||
import { faAccessibleIcon } from '@fortawesome/free-brands-svg-icons';
|
||||
import { faCamera } from '@fortawesome/free-solid-svg-icons';
|
||||
import { getApp } from '../../olympusapp';
|
||||
import { ContextAction } from '../../unit/contextaction';
|
||||
import { CONTEXT_ACTION } from '../../constants/constants';
|
||||
import { FaInfoCircle, FaQuestionCircle } from 'react-icons/fa';
|
||||
import { FaInfoCircle } from 'react-icons/fa';
|
||||
|
||||
export function UnitMouseControlBar(props: {
|
||||
|
||||
@ -38,6 +36,12 @@ export function UnitMouseControlBar(props: {
|
||||
updateData();
|
||||
})
|
||||
|
||||
/* Deselect the context action when exiting state */
|
||||
document.addEventListener("mapStateChanged", (ev) => {
|
||||
setOpen(ev.detail === CONTEXT_ACTION);
|
||||
})
|
||||
|
||||
|
||||
/* Update the current values of the shown data */
|
||||
function updateData() {
|
||||
var newContextActionSet = new ContextActionSet();
|
||||
@ -52,7 +56,7 @@ export function UnitMouseControlBar(props: {
|
||||
|
||||
return <> {
|
||||
open && <>
|
||||
<div className='flex gap-2 rounded-md absolute top-20 left-[50%] translate-x-[-50%] bg-gray-200 dark:bg-olympus-900 z-ui-1 p-2'>
|
||||
<div className='flex gap-2 rounded-md absolute top-20 left-[50%] translate-x-[-50%] bg-gray-200 dark:bg-olympus-900 z-ui-2 p-2'>
|
||||
{
|
||||
Object.values(contextActionsSet.getContextActions()).map((contextAction) => {
|
||||
return <OlStateButton checked={contextAction === activeContextAction} icon={contextAction.getIcon()} tooltip={contextAction.getLabel()} onClick={() => {
|
||||
@ -60,8 +64,13 @@ export function UnitMouseControlBar(props: {
|
||||
setActiveContextAction(null);
|
||||
contextAction.executeCallback(null, null);
|
||||
} else {
|
||||
setActiveContextAction(contextAction);
|
||||
getApp().getMap().setState(CONTEXT_ACTION, { contextAction: contextAction });
|
||||
if (activeContextAction != contextAction) {
|
||||
setActiveContextAction(contextAction);
|
||||
getApp().getMap().setState(CONTEXT_ACTION, { contextAction: contextAction });
|
||||
} else {
|
||||
setActiveContextAction(null);
|
||||
getApp().getMap().setState(CONTEXT_ACTION, { contextAction: null });
|
||||
}
|
||||
}
|
||||
}} />
|
||||
})
|
||||
|
||||
@ -42,6 +42,8 @@ export function UI() {
|
||||
var [checkingPassword, setCheckingPassword] = useState(false);
|
||||
var [loginError, setLoginError] = useState(false);
|
||||
var [commandMode, setCommandMode] = useState(null as null | string);
|
||||
var [mapSources, setMapSources] = useState([] as string[]);
|
||||
var [activeMapSource, setActiveMapSource] = useState("");
|
||||
|
||||
document.addEventListener("hiddenTypesChanged", (ev) => {
|
||||
setMapHiddenTypes({ ...getApp().getMap().getHiddenTypes() });
|
||||
@ -57,6 +59,20 @@ export function UI() {
|
||||
}
|
||||
})
|
||||
|
||||
document.addEventListener("mapSourceChanged", (ev) => {
|
||||
var source = (ev as CustomEvent).detail;
|
||||
if (source !== activeMapSource)
|
||||
setActiveMapSource(source);
|
||||
})
|
||||
|
||||
|
||||
document.addEventListener("configLoaded", (ev) => {
|
||||
let config = getApp().getConfig();
|
||||
var sources = Object.keys(config.mapMirrors).concat(Object.keys(config.mapLayers));
|
||||
setMapSources(sources);
|
||||
setActiveMapSource(sources[0]);
|
||||
})
|
||||
|
||||
function hideAllMenus() {
|
||||
setMainMenuVisible(false);
|
||||
setSpawnMenuVisible(false);
|
||||
@ -111,7 +127,9 @@ export function UI() {
|
||||
drawingMenuVisible: drawingMenuVisible,
|
||||
optionsMenuVisible: optionsMenuVisible,
|
||||
mapOptions: mapOptions,
|
||||
mapHiddenTypes: mapHiddenTypes
|
||||
mapHiddenTypes: mapHiddenTypes,
|
||||
mapSources: mapSources,
|
||||
activeMapSource: activeMapSource
|
||||
}}>
|
||||
<EventsProvider value={
|
||||
{
|
||||
@ -157,6 +175,7 @@ export function UI() {
|
||||
<Options
|
||||
open={optionsMenuVisible}
|
||||
onClose={() => setOptionsMenuVisible(false)}
|
||||
options={mapOptions}
|
||||
/>
|
||||
<MiniMapPanel />
|
||||
<UnitControlMenu />
|
||||
|
||||
@ -5,7 +5,7 @@ import { CustomMarker } from '../map/markers/custommarker';
|
||||
import { SVGInjector } from '@tanem/svg-injector';
|
||||
import { UnitDatabase } from './databases/unitdatabase';
|
||||
import { TargetMarker } from '../map/markers/targetmarker';
|
||||
import { DLINK, DataIndexes, GAME_MASTER, HIDE_GROUP_MEMBERS, IDLE, IRST, MOVE_UNIT, OPTIC, RADAR, ROEs, RWR, SHOW_UNIT_CONTACTS, SHOW_UNITS_ENGAGEMENT_RINGS, SHOW_UNIT_PATHS, SHOW_UNIT_TARGETS, VISUAL, emissionsCountermeasures, reactionsToThreat, states, SHOW_UNITS_ACQUISITION_RINGS, HIDE_UNITS_SHORT_RANGE_RINGS, FILL_SELECTED_RING, GROUPING_ZOOM_TRANSITION, MAX_SHOTS_SCATTER, SHOTS_SCATTER_DEGREES, GROUND_UNIT_AIR_DEFENCE_REGEX } from '../constants/constants';
|
||||
import { DLINK, DataIndexes, GAME_MASTER, IDLE, IRST, MOVE_UNIT, OPTIC, RADAR, ROEs, RWR, VISUAL, emissionsCountermeasures, reactionsToThreat, states, GROUPING_ZOOM_TRANSITION, MAX_SHOTS_SCATTER, SHOTS_SCATTER_DEGREES, GROUND_UNIT_AIR_DEFENCE_REGEX, CONTEXT_ACTION } from '../constants/constants';
|
||||
import { DataExtractor } from '../server/dataextractor';
|
||||
import { groundUnitDatabase } from './databases/groundunitdatabase';
|
||||
import { navyUnitDatabase } from './databases/navyunitdatabase';
|
||||
@ -708,7 +708,7 @@ export abstract class Unit extends CustomMarker {
|
||||
/* Hide the unit if it does not belong to the commanded coalition and it is not detected by a method that can pinpoint its location (RWR does not count) */
|
||||
(!this.belongsToCommandedCoalition() && (this.#detectionMethods.length == 0 || (this.#detectionMethods.length == 1 && this.#detectionMethods[0] === RWR))) ||
|
||||
/* Hide the unit if grouping is activated, the unit is not the group leader, it is not selected, and the zoom is higher than the grouping threshold */
|
||||
(getApp().getMap().getOptions()[HIDE_GROUP_MEMBERS] && !this.#isLeader && !this.getSelected() && this.getCategory() == "GroundUnit" && getApp().getMap().getZoom() < GROUPING_ZOOM_TRANSITION &&
|
||||
(getApp().getMap().getOptions().hideGroupMembers && !this.#isLeader && !this.getSelected() && this.getCategory() == "GroundUnit" && getApp().getMap().getZoom() < GROUPING_ZOOM_TRANSITION &&
|
||||
(this.belongsToCommandedCoalition() || (!this.belongsToCommandedCoalition() && this.#detectionMethods.length == 0))));
|
||||
|
||||
/* Force dead units to be hidden */
|
||||
@ -1065,6 +1065,8 @@ export abstract class Unit extends CustomMarker {
|
||||
getApp().getUnitsManager().deselectAllUnits();
|
||||
|
||||
this.setSelected(!this.getSelected());
|
||||
} else if (getApp().getMap().getState() === CONTEXT_ACTION) {
|
||||
getApp().getMap().executeContextAction(this, null);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1245,7 +1247,7 @@ export abstract class Unit extends CustomMarker {
|
||||
}
|
||||
|
||||
#drawPath() {
|
||||
if (this.#activePath != undefined && getApp().getMap().getOptions()[SHOW_UNIT_PATHS]) {
|
||||
if (this.#activePath != undefined && getApp().getMap().getOptions().showUnitPaths) {
|
||||
var points: LatLng[] = [];
|
||||
points.push(new LatLng(this.#position.lat, this.#position.lng));
|
||||
|
||||
@ -1289,7 +1291,7 @@ export abstract class Unit extends CustomMarker {
|
||||
|
||||
#drawContacts() {
|
||||
this.#clearContacts();
|
||||
if (getApp().getMap().getOptions()[SHOW_UNIT_CONTACTS]) {
|
||||
if (getApp().getMap().getOptions().showUnitContacts) {
|
||||
for (let index in this.#contacts) {
|
||||
var contactData = this.#contacts[index];
|
||||
var contact: Unit | Weapon | null;
|
||||
@ -1364,12 +1366,12 @@ export abstract class Unit extends CustomMarker {
|
||||
if (engagementRange !== this.#engagementCircle.getRadius())
|
||||
this.#engagementCircle.setRadius(engagementRange);
|
||||
|
||||
this.#engagementCircle.options.fillOpacity = this.getSelected() && getApp().getMap().getOptions()[FILL_SELECTED_RING] ? 0.3 : 0;
|
||||
this.#engagementCircle.options.fillOpacity = this.getSelected() && getApp().getMap().getOptions().fillSelectedRing ? 0.3 : 0;
|
||||
|
||||
/* Acquisition circles */
|
||||
var shortAcquisitionRangeCheck = (acquisitionRange > nmToM(3) || !getApp().getMap().getOptions()[HIDE_UNITS_SHORT_RANGE_RINGS]);
|
||||
var shortAcquisitionRangeCheck = (acquisitionRange > nmToM(3) || !getApp().getMap().getOptions().hideUnitsShortRangeRings);
|
||||
|
||||
if (getApp().getMap().getOptions()[SHOW_UNITS_ACQUISITION_RINGS] && shortAcquisitionRangeCheck && (this.belongsToCommandedCoalition() || this.getDetectionMethods().some(value => [VISUAL, OPTIC, IRST, RWR].includes(value)))) {
|
||||
if (getApp().getMap().getOptions().showUnitsAcquisitionRings && shortAcquisitionRangeCheck && (this.belongsToCommandedCoalition() || this.getDetectionMethods().some(value => [VISUAL, OPTIC, IRST, RWR].includes(value)))) {
|
||||
if (!getApp().getMap().hasLayer(this.#acquisitionCircle)) {
|
||||
this.#acquisitionCircle.addTo(getApp().getMap());
|
||||
switch (this.getCoalition()) {
|
||||
@ -1393,8 +1395,8 @@ export abstract class Unit extends CustomMarker {
|
||||
}
|
||||
|
||||
/* Engagement circles */
|
||||
var shortEngagementRangeCheck = (engagementRange > nmToM(3) || !getApp().getMap().getOptions()[HIDE_UNITS_SHORT_RANGE_RINGS]);
|
||||
if (getApp().getMap().getOptions()[SHOW_UNITS_ENGAGEMENT_RINGS] && shortEngagementRangeCheck && (this.belongsToCommandedCoalition() || this.getDetectionMethods().some(value => [VISUAL, OPTIC, IRST, RWR].includes(value)))) {
|
||||
var shortEngagementRangeCheck = (engagementRange > nmToM(3) || !getApp().getMap().getOptions().hideUnitsShortRangeRings);
|
||||
if (getApp().getMap().getOptions().showUnitsEngagementRings && shortEngagementRangeCheck && (this.belongsToCommandedCoalition() || this.getDetectionMethods().some(value => [VISUAL, OPTIC, IRST, RWR].includes(value)))) {
|
||||
if (!getApp().getMap().hasLayer(this.#engagementCircle)) {
|
||||
this.#engagementCircle.addTo(getApp().getMap());
|
||||
switch (this.getCoalition()) {
|
||||
@ -1428,10 +1430,10 @@ export abstract class Unit extends CustomMarker {
|
||||
}
|
||||
|
||||
#drawTarget() {
|
||||
if (this.#targetPosition.lat != 0 && this.#targetPosition.lng != 0 && getApp().getMap().getOptions()[SHOW_UNIT_PATHS]) {
|
||||
if (this.#targetPosition.lat != 0 && this.#targetPosition.lng != 0 && getApp().getMap().getOptions().showUnitPaths) {
|
||||
this.#drawTargetPosition(this.#targetPosition);
|
||||
}
|
||||
else if (this.#targetID != 0 && getApp().getMap().getOptions()[SHOW_UNIT_TARGETS]) {
|
||||
else if (this.#targetID != 0 && getApp().getMap().getOptions().showUnitTargets) {
|
||||
const target = getApp().getUnitsManager().getUnitByID(this.#targetID);
|
||||
if (target && (getApp().getMissionManager().getCommandModeOptions().commandMode == GAME_MASTER || (this.belongsToCommandedCoalition() && getApp().getUnitsManager().getUnitDetectedMethods(target).some(value => [VISUAL, OPTIC, RADAR, IRST, DLINK].includes(value))))) {
|
||||
this.#drawTargetPosition(target.getPosition());
|
||||
@ -1648,7 +1650,7 @@ export class GroundUnit extends Unit {
|
||||
/* When a unit is a leader of a group, the map is zoomed out and grouping when zoomed out is enabled, check if the unit should be shown as a specific group. This is used to show a SAM battery instead of the group leader */
|
||||
getDatabaseEntry() {
|
||||
let unitWhenGrouped: string | undefined | null = null;
|
||||
if (!this.getSelected() && this.getIsLeader() && getApp().getMap().getOptions()[HIDE_GROUP_MEMBERS] && getApp().getMap().getZoom() < GROUPING_ZOOM_TRANSITION) {
|
||||
if (!this.getSelected() && this.getIsLeader() && getApp().getMap().getOptions().hideGroupMembers && getApp().getMap().getZoom() < GROUPING_ZOOM_TRANSITION) {
|
||||
unitWhenGrouped = this.getDatabase()?.getByName(this.getName())?.unitWhenGrouped ?? null;
|
||||
let member = this.getGroupMembers().reduce((prev: Unit | null, unit: Unit, index: number) => {
|
||||
if (unit.getDatabaseEntry()?.unitWhenGrouped != undefined)
|
||||
@ -1665,7 +1667,7 @@ export class GroundUnit extends Unit {
|
||||
|
||||
/* When we zoom past the grouping limit, grouping is enabled and the unit is a leader, we redraw the unit to apply any possible grouped marker */
|
||||
checkZoomRedraw(): boolean {
|
||||
return (this.getIsLeader() && getApp().getMap().getOptions()[HIDE_GROUP_MEMBERS] as boolean &&
|
||||
return (this.getIsLeader() && getApp().getMap().getOptions().hideGroupMembers as boolean &&
|
||||
(getApp().getMap().getZoom() >= GROUPING_ZOOM_TRANSITION && getApp().getMap().getPreviousZoom() < GROUPING_ZOOM_TRANSITION ||
|
||||
getApp().getMap().getZoom() < GROUPING_ZOOM_TRANSITION && getApp().getMap().getPreviousZoom() >= GROUPING_ZOOM_TRANSITION))
|
||||
}
|
||||
|
||||
@ -1192,9 +1192,6 @@ export class UnitsManager {
|
||||
*
|
||||
*/
|
||||
copy(units: Unit[] | null = null) {
|
||||
//if (!getApp().getContextManager().getCurrentContext().getAllowUnitCopying())
|
||||
// return;
|
||||
|
||||
if (units === null)
|
||||
units = this.getSelectedUnits();
|
||||
|
||||
@ -1212,9 +1209,6 @@ export class UnitsManager {
|
||||
* @returns True if units were pasted successfully
|
||||
*/
|
||||
paste() {
|
||||
//if (!getApp().getContextManager().getCurrentContext().getAllowUnitPasting())
|
||||
// return;
|
||||
|
||||
let spawnPoints = 0;
|
||||
|
||||
/* If spawns are restricted, check that the user has the necessary spawn points */
|
||||
|
||||
@ -162,25 +162,9 @@ export const mapBounds = {
|
||||
"Kola": { bounds: new LatLngBounds([61.59999, 4.29982], [75.05179, 44.29982]), zoom: 3}
|
||||
}
|
||||
|
||||
export const mapMirrors = {
|
||||
"DCS Map mirror 1": "https://maps.dcsolympus.com/maps",
|
||||
"DCS Map mirror 2": "https://refugees.dcsolympus.com/maps"
|
||||
}
|
||||
export const defaultMapMirrors = {}
|
||||
|
||||
export const defaultMapLayers = {
|
||||
"ArcGIS Satellite": {
|
||||
urlTemplate: "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}",
|
||||
minZoom: 1,
|
||||
maxZoom: 19,
|
||||
attribution: "Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Mapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community"
|
||||
},
|
||||
"OpenStreetMap Mapnik": {
|
||||
urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
|
||||
minZoom: 1,
|
||||
maxZoom: 20,
|
||||
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
||||
}
|
||||
}
|
||||
export const defaultMapLayers = {}
|
||||
|
||||
/* Map constants */
|
||||
export const IDLE = "Idle";
|
||||
|
||||
@ -12,7 +12,7 @@ import { DestinationPreviewMarker } from "./markers/destinationpreviewmarker";
|
||||
import { TemporaryUnitMarker } from "./markers/temporaryunitmarker";
|
||||
import { ClickableMiniMap } from "./clickableminimap";
|
||||
import { SVGInjector } from '@tanem/svg-injector'
|
||||
import { defaultMapLayers, mapBounds, minimapBoundaries, IDLE, COALITIONAREA_DRAW_POLYGON, MOVE_UNIT, SHOW_UNIT_CONTACTS, HIDE_GROUP_MEMBERS, SHOW_UNIT_PATHS, SHOW_UNIT_TARGETS, SHOW_UNIT_LABELS, SHOW_UNITS_ENGAGEMENT_RINGS, SHOW_UNITS_ACQUISITION_RINGS, HIDE_UNITS_SHORT_RANGE_RINGS, FILL_SELECTED_RING, MAP_MARKER_CONTROLS, DCS_LINK_PORT, DCS_LINK_RATIO, mapMirrors } from "../constants/constants";
|
||||
import { defaultMapLayers, mapBounds, minimapBoundaries, IDLE, COALITIONAREA_DRAW_POLYGON, MOVE_UNIT, SHOW_UNIT_CONTACTS, HIDE_GROUP_MEMBERS, SHOW_UNIT_PATHS, SHOW_UNIT_TARGETS, SHOW_UNIT_LABELS, SHOW_UNITS_ENGAGEMENT_RINGS, SHOW_UNITS_ACQUISITION_RINGS, HIDE_UNITS_SHORT_RANGE_RINGS, FILL_SELECTED_RING, MAP_MARKER_CONTROLS, DCS_LINK_PORT, DCS_LINK_RATIO, defaultMapMirrors } from "../constants/constants";
|
||||
import { CoalitionArea } from "./coalitionarea/coalitionarea";
|
||||
import { CoalitionAreaContextMenu } from "../contextmenus/coalitionareacontextmenu";
|
||||
import { DrawingCursor } from "./coalitionarea/drawingcursor";
|
||||
@ -97,6 +97,7 @@ export class Map extends L.Map {
|
||||
|
||||
#mapSourceDropdown: Dropdown;
|
||||
#mapLayers: any = defaultMapLayers;
|
||||
#mapMirrors: any = defaultMapMirrors;
|
||||
#mapMarkerVisibilityControls: MapMarkerVisibilityControl[] = MAP_MARKER_CONTROLS;
|
||||
#mapVisibilityOptionsDropdown: Dropdown;
|
||||
#optionButtons: { [key: string]: HTMLButtonElement[] } = {}
|
||||
@ -131,10 +132,8 @@ export class Map extends L.Map {
|
||||
|
||||
this.#ID = ID;
|
||||
|
||||
this.setLayer("DCS Map mirror 1");
|
||||
|
||||
/* Minimap */
|
||||
var minimapLayer = new L.TileLayer(this.#mapLayers[Object.keys(this.#mapLayers)[0]].urlTemplate, { minZoom: 0, maxZoom: 13 });
|
||||
var minimapLayer = new L.TileLayer("https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}", { minZoom: 0, maxZoom: 13 });
|
||||
this.#miniMapLayerGroup = new L.LayerGroup([minimapLayer]);
|
||||
this.#miniMapPolyline = new L.Polyline([], { color: '#202831' });
|
||||
this.#miniMapPolyline.addTo(this.#miniMapLayerGroup);
|
||||
@ -226,13 +225,40 @@ export class Map extends L.Map {
|
||||
|
||||
document.addEventListener("configLoaded", () => {
|
||||
let config = getApp().getConfig();
|
||||
if (config.additionalMaps) {
|
||||
let additionalMaps = config.additionalMaps;
|
||||
let layerSet = false;
|
||||
|
||||
/* First load the map mirrors */
|
||||
if (config.mapMirrors) {
|
||||
let mapMirrors = config.mapMirrors;
|
||||
this.#mapMirrors = {
|
||||
...this.#mapMirrors,
|
||||
...mapMirrors
|
||||
}
|
||||
this.setLayer(Object.keys(mapMirrors)[0]);
|
||||
}
|
||||
|
||||
/* Set the options, and if at least one mirror is available, select the first */
|
||||
this.#mapSourceDropdown.setOptions(Object.keys(this.#mapMirrors), null);
|
||||
if (Object.keys(this.#mapMirrors).length > 0) {
|
||||
this.#mapSourceDropdown.selectValue(0);
|
||||
this.setLayer(Object.keys(this.#mapMirrors)[0]);
|
||||
layerSet = true; // Needed because this is async
|
||||
}
|
||||
|
||||
/* Then load the map layers */
|
||||
if (config.mapLayers) {
|
||||
let mapLayers = config.mapLayers;
|
||||
this.#mapLayers = {
|
||||
...this.#mapLayers,
|
||||
...additionalMaps
|
||||
...mapLayers
|
||||
}
|
||||
this.#mapSourceDropdown.setOptions(this.getLayers(), null);
|
||||
}
|
||||
|
||||
/* Append this options, and if no mirror was selected, select the first on (if available). Mirrors have the precedence */
|
||||
this.#mapSourceDropdown.setOptions(Object.keys(this.#mapMirrors).concat(Object.keys(this.#mapLayers)), null);
|
||||
if (!layerSet && Object.keys(this.#mapLayers).length > 0) {
|
||||
this.#mapSourceDropdown.selectValue(0);
|
||||
this.setLayer(Object.keys(this.#mapLayers)[0]);
|
||||
}
|
||||
})
|
||||
|
||||
@ -295,8 +321,8 @@ export class Map extends L.Map {
|
||||
}
|
||||
|
||||
setLayer(layerName: string) {
|
||||
if (this.#layer != null)
|
||||
this.removeLayer(this.#layer)
|
||||
if (this.#layer)
|
||||
this.removeLayer(this.#layer);
|
||||
|
||||
let theatre = getApp().getMissionManager()?.getTheatre() ?? "Nevada";
|
||||
|
||||
@ -308,16 +334,17 @@ export class Map extends L.Map {
|
||||
return new L.TileLayer(layer.urlTemplate.replace("{theatre}", theatre.toLowerCase()), layer);
|
||||
})
|
||||
this.#layer = new L.LayerGroup(layers);
|
||||
this.#layer?.addTo(this);
|
||||
} else {
|
||||
this.#layer = new L.TileLayer(layerData.urlTemplate, layerData);
|
||||
this.#layer?.addTo(this);
|
||||
}
|
||||
/* DCS core layers are handled here */
|
||||
} else if (["DCS Map mirror 1", "DCS Map mirror 2"].includes(layerName) ) {
|
||||
let layerData = this.#mapLayers["ArcGIS Satellite"];
|
||||
let layers = [new L.TileLayer(layerData.urlTemplate, layerData)];
|
||||
/* mirrored layers are handled here */
|
||||
} else if (Object.keys(this.#mapMirrors).includes(layerName) ) {
|
||||
let layers: L.TileLayer[] = [];
|
||||
|
||||
/* Load the configuration file */
|
||||
const mirror = mapMirrors[layerName as keyof typeof mapMirrors];
|
||||
const mirror = this.#mapMirrors[layerName as any];
|
||||
const request = new Request(mirror + "/config.json");
|
||||
fetch(request).then((response) => {
|
||||
if (response.status === 200) {
|
||||
@ -343,9 +370,7 @@ export class Map extends L.Map {
|
||||
}
|
||||
|
||||
getLayers() {
|
||||
let layers = ["DCS Map mirror 1", "DCS Map mirror 2"];
|
||||
layers.push(...Object.keys(this.#mapLayers));
|
||||
return layers;
|
||||
return Object.keys(this.#mapLayers);
|
||||
}
|
||||
|
||||
/* State machine */
|
||||
|
||||
69
olympus.json
69
olympus.json
@ -1,37 +1,36 @@
|
||||
{
|
||||
"backend": {
|
||||
"address": "localhost",
|
||||
"port": 4512
|
||||
},
|
||||
"authentication": {
|
||||
"gameMasterPassword": "4b8823ed9e5c2392ab4a791913bb8ce41956ea32e308b760eefb97536746dd33",
|
||||
"blueCommanderPassword": "b0ea4230c1558c5313165eda1bdb7fced008ca7f2ca6b823fb4d26292f309098",
|
||||
"redCommanderPassword": "302bcbaf2a3fdcf175b689bf102d6cdf9328f68a13d4096101bba806482bfed9"
|
||||
},
|
||||
"frontend": {
|
||||
"port": 3000,
|
||||
"elevationProvider": {
|
||||
"provider": "https://srtm.fasma.org/{lat}{lng}.SRTMGL3S.hgt.zip",
|
||||
"username": null,
|
||||
"password": null
|
||||
},
|
||||
"additionalMaps": {
|
||||
"TestMap": [
|
||||
{
|
||||
"urlTemplate": "http://localhost:3000/maps/TestMap/{z}/{x}/{y}.png",
|
||||
"minNativeZoom": 1,
|
||||
"maxNativeZoom": 13,
|
||||
"minZoom": 1,
|
||||
"maxZoom": 20
|
||||
},
|
||||
{
|
||||
"urlTemplate": "http://localhost:3000/maps/TestMap/{z}/{x}/{y}.png",
|
||||
"minNativeZoom": 14,
|
||||
"maxNativeZoom": 17,
|
||||
"minZoom": 14,
|
||||
"maxZoom": 20
|
||||
}
|
||||
]
|
||||
"backend": {
|
||||
"address": "localhost",
|
||||
"port": 4512
|
||||
},
|
||||
"authentication": {
|
||||
"gameMasterPassword": "4b8823ed9e5c2392ab4a791913bb8ce41956ea32e308b760eefb97536746dd33",
|
||||
"blueCommanderPassword": "b0ea4230c1558c5313165eda1bdb7fced008ca7f2ca6b823fb4d26292f309098",
|
||||
"redCommanderPassword": "302bcbaf2a3fdcf175b689bf102d6cdf9328f68a13d4096101bba806482bfed9"
|
||||
},
|
||||
"frontend": {
|
||||
"port": 3000,
|
||||
"elevationProvider": {
|
||||
"provider": "https://srtm.fasma.org/{lat}{lng}.SRTMGL3S.hgt.zip",
|
||||
"username": null,
|
||||
"password": null
|
||||
},
|
||||
"mapLayers": {
|
||||
"ArcGIS Satellite": {
|
||||
"urlTemplate": "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}",
|
||||
"minZoom": 1,
|
||||
"maxZoom": 19,
|
||||
"attribution": "Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Mapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community"
|
||||
},
|
||||
"OpenStreetMap Mapnik": {
|
||||
"urlTemplate": "https://tile.openstreetmap.org/{z}/{x}/{y}.png",
|
||||
"minZoom": 1,
|
||||
"maxZoom": 20,
|
||||
"attribution": "OpenStreetMap contributors"
|
||||
}
|
||||
},
|
||||
"mapMirrors": {
|
||||
"DCS Map (Refugees)": "https://refugees.dcsolympus.com/maps"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
"request": "launch",
|
||||
"program": "main.py",
|
||||
"console": "integratedTerminal",
|
||||
"args": ["./configs/PersianGulf/LowResolution.yml"],
|
||||
"args": ["./configs/PersianGulf/HighResolution.yaml"],
|
||||
"justMyCode": false
|
||||
}
|
||||
]
|
||||
|
||||
@ -0,0 +1,6 @@
|
||||
{
|
||||
"output_directory": "",
|
||||
"boundary_file": "./configs/persiangulf/boundary.kml",
|
||||
"zoom_factor": 0.7,
|
||||
"geo_width": 28.41
|
||||
}
|
||||
@ -53,15 +53,6 @@
|
||||
<snippet></snippet>
|
||||
<styleUrl>#msn_ylw-pushpin</styleUrl>
|
||||
<MultiGeometry>
|
||||
<Polygon>
|
||||
<tessellate>1</tessellate>
|
||||
<outerBoundaryIs>
|
||||
<LinearRing>
|
||||
<coordinates>
|
||||
</coordinates>
|
||||
</LinearRing>
|
||||
</outerBoundaryIs>
|
||||
</Polygon>
|
||||
<Polygon>
|
||||
<tessellate>1</tessellate>
|
||||
<outerBoundaryIs>
|
||||
|
||||
@ -0,0 +1,6 @@
|
||||
{
|
||||
"output_directory": "",
|
||||
"boundary_file": "./configs/persiangulf/highresolution.kml",
|
||||
"zoom_factor": 0.05,
|
||||
"geo_width": 1.58
|
||||
}
|
||||
@ -67,7 +67,7 @@
|
||||
<outerBoundaryIs>
|
||||
<LinearRing>
|
||||
<coordinates>
|
||||
51.14046495023259,27.97889498770899,0 51.55353431602219,27.67956231061547,0 52.12271273396132,27.54826968043618,0 52.48447085880215,27.15028440327163,0 52.71652672529243,26.89796512728381,0 53.12879512517743,26.68884941551969,0 53.37494568115115,26.5977988632661,0 53.85049019818978,26.37821106429506,0 54.24913361183636,26.2053559430932,0 54.56854641473323,26.21332231673139,0 54.82768581802085,26.32919602607321,0 55.26888050312395,26.35051081890743,0 55.80446334594801,26.35993721084362,0 56.33380786281894,26.5498201192042,0 56.48285365981736,26.61233639892026,0 56.85082806071058,26.64037142673503,0 57.17766178622572,26.66708862056534,0 57.42202625116622,26.76530994984642,0 57.42175200084923,26.78958275893595,0 57.75837609087983,27.17977467837602,0 57.98784159241647,27.5334767068154,0 58.31521962733038,27.92355619049269,0 58.83857811895194,28.42393873318583,0 58.78447751679316,28.95258319892324,0 58.49070365518425,29.75951677966167,0 57.99170980487579,30.41145443251768,0 57.29164084080367,30.56113335218462,0 56.10644792829299,30.49255474654641,0 55.38335050943599,30.2731014182876,0 54.55839222246502,30.0276205049906,0 54.29088397184947,30.12575153512911,0 53.74252371846605,30.60355068007007,0 53.08678998572581,30.81341623660898,0 51.84822979140608,30.81042419874112,0 51.30852498191112,30.52135036711869,0 50.9672043555116,30.24638484712573,0 50.64551787356796,29.52167314809455,0 50.75992419424781,28.81470435016178,0 50.98064068401045,28.23929040762457,0 51.14046495023259,27.97889498770899,0
|
||||
51.14046495023259,27.97889498770899,0 51.55353431602219,27.67956231061547,0 52.12271273396132,27.54826968043618,0 52.48447085880215,27.15028440327163,0 52.71652672529243,26.89796512728381,0 53.12879512517743,26.68884941551969,0 53.37494568115115,26.5977988632661,0 53.85049019818978,26.37821106429506,0 54.23787811313886,26.20691208719306,0 54.33271805762165,26.0894844559901,0 54.40557401608805,25.91106820893015,0 54.33693214503367,25.74559565245724,0 54.23722266288519,25.51002642472132,0 54.133241595249,25.37249411865993,0 54.09333359394986,25.2354518837233,0 54.11060811406112,25.13091928808479,0 54.22025593909834,25.06952867065685,0 54.40933693241553,25.17621859544131,0 54.58297467164004,25.507311025299,0 54.68743041455483,25.71261041853808,0 54.74910078286771,25.76911690580135,0 54.96274716677529,25.7421903717473,0 55.12301264507939,25.73073217164497,0 55.29063894539164,26.03174623372222,0 55.46414964975805,26.27240878545209,0 55.80446334594801,26.35993721084362,0 56.33380786281894,26.5498201192042,0 56.48285365981736,26.61233639892026,0 56.85082806071058,26.64037142673503,0 57.17766178622572,26.66708862056534,0 57.42202625116622,26.76530994984642,0 57.42175200084923,26.78958275893595,0 57.75837609087983,27.17977467837602,0 57.98784159241647,27.5334767068154,0 58.31521962733038,27.92355619049269,0 58.83857811895194,28.42393873318583,0 58.78447751679316,28.95258319892324,0 58.49070365518425,29.75951677966167,0 57.99170980487579,30.41145443251768,0 57.29164084080367,30.56113335218462,0 56.10644792829298,30.49255474654641,0 55.38335050943599,30.2731014182876,0 54.55839222246502,30.0276205049906,0 54.29088397184947,30.12575153512911,0 53.74252371846605,30.60355068007007,0 53.08678998572581,30.81341623660898,0 51.84822979140607,30.81042419874112,0 51.30852498191112,30.52135036711869,0 50.9672043555116,30.24638484712573,0 50.64551787356796,29.52167314809455,0 50.75992419424781,28.81470435016178,0 50.98064068401045,28.23929040762457,0 51.14046495023259,27.97889498770899,0
|
||||
</coordinates>
|
||||
</LinearRing>
|
||||
</outerBoundaryIs>
|
||||
@ -77,7 +77,7 @@
|
||||
<outerBoundaryIs>
|
||||
<LinearRing>
|
||||
<coordinates>
|
||||
53.8057811140837,23.55343439271727,0 54.16707732813894,23.63808676113464,0 54.32388774939614,23.86831181190716,0 54.70433991212435,24.06583238614991,0 55.04071193190381,24.08042313106568,0 55.62781213084946,24.05033960593778,0 55.89529470815445,23.78838696666025,0 56.88328612540428,23.71028293860385,0 57.39481730973479,23.74600242634563,0 57.61434197291053,23.86694222294323,0 57.56547100618887,23.98139643984701,0 57.25341033092799,24.14863903206592,0 57.0365711559341,24.31565932430973,0 56.79994205785796,24.6015396181255,0 56.62766466732369,24.93649209953436,0 56.57041711858137,25.15316604643681,0 56.5185519543729,25.39716505483441,0 56.59137067490876,25.75737337713514,0 56.66027045252924,26.27258369322207,0 56.54053906478659,26.45648304963149,0 56.34416424485094,26.42690029654913,0 56.13573995451507,26.25278325965957,0 55.99515194635932,26.06997020663153,0 55.79162779799368,25.84948461029359,0 55.78570489080146,25.84393126096045,0 55.52407201918845,25.65401646642523,0 55.32826077660956,25.50864178818507,0 55.04320231122364,25.31752352820883,0 54.67689634665136,25.01468736122063,0 54.50082644321805,24.8301383376733,0 54.14867248036185,24.63997143899151,0 53.61846063593983,24.43120259451614,0 53.45803049651203,24.28824233227118,0 53.38463578170503,24.00792002524971,0 53.36517219287005,23.70109887908254,0 53.5687558226762,23.52168454477098,0 53.8057811140837,23.55343439271727,0
|
||||
53.8057811140837,23.55343439271727,0 54.16707732813894,23.63808676113464,0 54.32388774939614,23.86831181190716,0 54.70433991212435,24.06583238614991,0 55.04071193190381,24.08042313106568,0 55.62781213084946,24.05033960593778,0 55.89529470815445,23.78838696666025,0 56.88328612540428,23.71028293860385,0 57.39481730973479,23.74600242634563,0 57.61434197291053,23.86694222294323,0 57.56547100618887,23.98139643984701,0 57.25341033092799,24.14863903206592,0 57.0365711559341,24.31565932430973,0 56.79994205785796,24.6015396181255,0 56.62766466732369,24.93649209953436,0 56.57041711858136,25.15316604643681,0 56.5185519543729,25.39716505483441,0 56.59137067490876,25.75737337713514,0 56.66027045252924,26.27258369322207,0 56.54053906478659,26.45648304963149,0 56.34416424485094,26.42690029654913,0 56.13573995451507,26.25278325965957,0 55.99515194635932,26.06997020663153,0 55.79162779799368,25.84948461029359,0 55.78570489080146,25.84393126096045,0 55.52407201918845,25.65401646642523,0 55.32826077660956,25.50864178818507,0 55.04320231122364,25.31752352820883,0 54.67689634665136,25.01468736122063,0 54.50082644321806,24.8301383376733,0 54.14867248036185,24.63997143899151,0 53.61846063593983,24.43120259451614,0 53.45803049651203,24.28824233227118,0 53.38463578170503,24.00792002524971,0 53.36517219287005,23.70109887908254,0 53.5687558226762,23.52168454477098,0 53.8057811140837,23.55343439271727,0
|
||||
</coordinates>
|
||||
</LinearRing>
|
||||
</outerBoundaryIs>
|
||||
|
||||
@ -0,0 +1,6 @@
|
||||
{
|
||||
"output_directory": "",
|
||||
"boundary_file": "./configs/persiangulf/lowresolution.kml",
|
||||
"zoom_factor": 0.4,
|
||||
"geo_width": 10.36
|
||||
}
|
||||
@ -20,8 +20,6 @@
|
||||
</Icon>
|
||||
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
|
||||
</IconStyle>
|
||||
<BalloonStyle>
|
||||
</BalloonStyle>
|
||||
<LineStyle>
|
||||
<width>2</width>
|
||||
</LineStyle>
|
||||
@ -37,8 +35,6 @@
|
||||
</Icon>
|
||||
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
|
||||
</IconStyle>
|
||||
<BalloonStyle>
|
||||
</BalloonStyle>
|
||||
<LineStyle>
|
||||
<width>2</width>
|
||||
</LineStyle>
|
||||
@ -56,7 +52,7 @@
|
||||
<outerBoundaryIs>
|
||||
<LinearRing>
|
||||
<coordinates>
|
||||
57.08662779551599,26.74222906685435,0 57.28481314894174,26.92299531371801,0 57.43069847386101,27.36015969177391,0 57.88416978274709,27.70555118616166,0 58.0042057443256,28.06666067600623,0 58.43292295766628,28.37877628698436,0 58.66282280324379,28.68761778545839,0 58.67265568373656,28.92845530236555,0 58.32264458411767,29.18501795573206,0 57.98470293895333,29.86973097050743,0 57.81246904926375,30.16290929906387,0 57.63210868041936,30.32649860254734,0 57.23148364578026,30.39033962486325,0 56.99269438672574,30.32922035173133,0 56.39192637435963,30.35829104571983,0 56.21051082483839,30.3913352005532,0 55.93241575671919,30.31673191396352,0 55.68692282491359,30.14593706366064,0 55.50459474810871,29.91376573153317,0 55.38019392283345,29.61325410376284,0 55.62005736468103,29.15281106584349,0 56.26879586031595,28.8873941945573,0 57.01315325085545,28.90188175533714,0 57.18746321156831,28.90981543949903,0 57.23393884601242,28.81968481562826,0 57.22931835415146,28.68863337491101,0 57.18006983441847,28.53458994708109,0 56.89259029574667,28.45164339743952,0 56.41096867944319,28.4230005305205,0 55.90896231070198,28.41463832144504,0 55.28995290351293,28.53854833393688,0 54.6907299362248,28.72036699217543,0 54.67759239657464,28.72006222261758,0 54.35213032846881,28.87295068450273,0 54.13380040639876,29.12847293545733,0 54.01771821843089,29.41175967020398,0 53.87960509127,29.63098973060083,0 53.46622012570221,29.8458340763824,0 53.36109748164392,30.07183069504149,0 53.31634843403909,30.2548008275813,0 53.37011919844125,30.39912958404357,0 53.34015595981462,30.50567519256808,0 53.33656590992216,30.50854090486732,0 52.97422597492253,30.63447613396465,0 52.64378324402295,30.69608964333785,0 52.38582508941005,30.69919222467069,0 51.93424163263478,30.63846078568024,0 51.64062563240322,30.62844974333259,0 51.56656809476638,30.60062987500587,0 51.52564949043939,30.51286263282904,0 51.42556555347527,30.2144551039222,0 51.45882264399518,30.09553531390153,0 51.4758758195529,29.80991502645059,0 51.45984842331793,29.60446451016335,0 51.37900690021137,29.53150534917414,0 51.20465159130943,29.43729914664441,0 50.89485214911348,29.44632210856937,0 50.84038777070577,29.30196126632671,0 50.93393600308552,29.21179017493654,0 51.03021815054434,29.07955934047702,0 50.99490623667714,28.95069318875168,0 50.95954820695037,28.82178720245981,0 50.9670611656345,28.66361249523314,0 50.9629723079531,28.5505677422788,0 50.98774261818584,28.48858338332086,0 51.11189158604945,28.58426578139435,0 51.1245348620256,28.7468382502921,0 51.146455549895,28.89233446085181,0 51.1555812701137,28.93508468041331,0 51.35975413307138,29.22774728682657,0 51.5246768367475,29.33121410984396,0 51.69643923569528,29.25902447100221,0 51.78556622089516,29.07766185644572,0 51.81585422025375,28.91075007631442,0 51.91322911022416,28.76838947794742,0 52.02084512456936,28.61038408598138,0 52.15446485839271,28.55968484296986,0 52.2493864131826,28.57821243633977,0 52.26512020082876,28.58243529410801,0 52.56928858850304,28.64543240915901,0 52.77130207998004,28.40228990565214,0 52.83953905561756,28.25637619409016,0 52.93946331556578,28.07142663504239,0 53.38183856470001,27.68580376993239,0 53.56292329759665,27.61174818318469,0 53.96866424078468,27.48696891702861,0 54.0408659625077,27.48199496121401,0 54.4591265736723,27.48166977000004,0 54.80500284085096,27.45348888663242,0 54.78140827645719,27.35405703505121,0 54.39285553396017,27.26087435762969,0 54.28295623960408,27.1925109459028,0 54.20510649314404,27.09826061501207,0 54.13987717421119,26.97384503596154,0 54.32854435416762,26.79853150880392,0 54.57260128570974,26.64243597383059,0 54.57724414808476,26.5844951870384,0 54.5913719314249,26.49401853840836,0 54.82139336816309,26.39374916320339,0 55.20087461601976,26.55581734485082,0 55.30074860500482,26.45546411192498,0 55.45276228217399,26.45116133996013,0 55.85249765360211,26.50043298708444,0 56.09139682670517,26.58388373526835,0 56.31288067485976,26.71204774158111,0 56.48193094296525,26.74420973333427,0 56.57020344734467,26.79057908643139,0 57.08662779551599,26.74222906685435,0
|
||||
57.08662779551599,26.74222906685435,0 57.28481314894174,26.92299531371801,0 57.43069847386101,27.36015969177391,0 57.88416978274709,27.70555118616166,0 58.00420574432561,28.06666067600623,0 58.43292295766628,28.37877628698436,0 58.66282280324379,28.68761778545839,0 58.67265568373656,28.92845530236555,0 58.32264458411767,29.18501795573206,0 57.98470293895333,29.86973097050743,0 57.81246904926375,30.16290929906387,0 57.63210868041936,30.32649860254734,0 57.23148364578026,30.39033962486325,0 56.98956095082467,30.35375793652755,0 56.39192637435963,30.35829104571983,0 56.21051082483839,30.3913352005532,0 55.93241575671919,30.31673191396352,0 55.68692282491359,30.14593706366064,0 55.50459474810871,29.91376573153318,0 55.38019392283345,29.61325410376284,0 55.62005736468103,29.15281106584349,0 56.26879586031595,28.8873941945573,0 57.01315325085545,28.90188175533714,0 57.18746321156831,28.90981543949903,0 57.23393884601242,28.81968481562826,0 57.22931835415146,28.68863337491101,0 57.18006983441847,28.53458994708109,0 56.89259029574667,28.45164339743952,0 56.41096867944319,28.4230005305205,0 55.90896231070198,28.41463832144504,0 55.28995290351293,28.53854833393688,0 54.6907299362248,28.72036699217543,0 54.67759239657464,28.72006222261758,0 54.35213032846881,28.87295068450273,0 54.13380040639876,29.12847293545733,0 54.0177182184309,29.41175967020398,0 53.87960509127,29.63098973060083,0 53.4662201257022,29.8458340763824,0 53.36109748164392,30.07183069504149,0 53.31634843403909,30.2548008275813,0 53.37011919844125,30.39912958404357,0 53.34015595981462,30.50567519256808,0 53.33656590992216,30.50854090486732,0 52.97422597492253,30.63447613396465,0 52.64378324402295,30.69608964333785,0 52.38582508941004,30.69919222467069,0 51.93424163263478,30.63846078568024,0 51.64062563240322,30.62844974333259,0 51.56656809476638,30.60062987500587,0 51.52564949043939,30.51286263282904,0 51.42556555347527,30.2144551039222,0 51.45882264399518,30.09553531390153,0 51.4758758195529,29.80991502645059,0 51.45984842331793,29.60446451016335,0 51.37900690021137,29.53150534917414,0 51.20465159130943,29.43729914664441,0 50.89485214911349,29.44632210856937,0 50.84038777070577,29.30196126632671,0 50.93393600308552,29.21179017493654,0 51.03021815054434,29.07955934047702,0 50.99490623667714,28.95069318875168,0 50.95954820695037,28.82178720245981,0 50.9670611656345,28.66361249523314,0 50.9629723079531,28.5505677422788,0 50.98774261818584,28.48858338332086,0 51.11189158604945,28.58426578139435,0 51.1245348620256,28.7468382502921,0 51.146455549895,28.89233446085181,0 51.1555812701137,28.93508468041331,0 51.35975413307137,29.22774728682657,0 51.5246768367475,29.33121410984396,0 51.69643923569528,29.25902447100221,0 51.78556622089516,29.07766185644572,0 51.81585422025375,28.91075007631442,0 51.91322911022416,28.76838947794742,0 52.02084512456936,28.61038408598138,0 52.15446485839271,28.55968484296987,0 52.2493864131826,28.57821243633977,0 52.26512020082876,28.58243529410801,0 52.56928858850304,28.64543240915901,0 52.77130207998004,28.40228990565214,0 52.83953905561756,28.25637619409016,0 52.93946331556578,28.07142663504239,0 53.38183856470001,27.68580376993239,0 53.56292329759665,27.61174818318469,0 53.96866424078468,27.48696891702861,0 54.0408659625077,27.48199496121401,0 54.4591265736723,27.48166977000004,0 54.80500284085096,27.45348888663242,0 54.78140827645719,27.35405703505121,0 54.39285553396017,27.26087435762969,0 54.28295623960409,27.1925109459028,0 54.20510649314404,27.09826061501207,0 54.13987717421119,26.97384503596154,0 54.32854435416762,26.79853150880392,0 54.57260128570974,26.64243597383059,0 54.57724414808476,26.5844951870384,0 54.5913719314249,26.49401853840836,0 54.82139336816309,26.39374916320339,0 55.20087461601976,26.55581734485082,0 55.30074860500482,26.45546411192498,0 55.45276228217399,26.45116133996013,0 55.85249765360211,26.50043298708444,0 56.09139682670517,26.58388373526835,0 56.31288067485976,26.71204774158111,0 56.48193094296525,26.74420973333427,0 56.57020344734467,26.79057908643139,0 57.08662779551599,26.74222906685435,0
|
||||
</coordinates>
|
||||
</LinearRing>
|
||||
</outerBoundaryIs>
|
||||
@ -66,7 +62,17 @@
|
||||
<outerBoundaryIs>
|
||||
<LinearRing>
|
||||
<coordinates>
|
||||
53.65471572344581,23.60707183181828,0 53.81497415962468,23.64039601077693,0 53.89006934210051,23.70030483918968,0 53.82333143229609,23.8516202627874,0 53.86319220148564,23.98332838418791,0 53.99053354492822,24.12456957062248,0 54.06970919826649,24.16390902332125,0 54.29453647311612,24.20786500130305,0 54.4269606795388,24.1621613203329,0 54.62769762272161,24.13496838655094,0 54.81618779246777,24.14356800279005,0 55.07760305886731,24.12710640153997,0 55.3717135673071,24.09408330468836,0 55.51665272247794,24.08714942578391,0 55.7130597944597,24.04771223790903,0 55.84755955669971,24.02354751356681,0 56.10545120654146,24.13762037622954,0 55.99976854056003,24.32485982077774,0 56.10486910232725,24.49774628963504,0 56.24379095616488,24.66002432190549,0 56.3757168932834,24.73517133058909,0 56.6059558780324,24.42435856267748,0 56.85872988375159,24.12755561616724,0 57.0338824559102,23.9914503374143,0 57.21308953024807,23.94929119710407,0 57.21680836491202,24.04403878815587,0 56.94869924942736,24.32708003404261,0 56.94581183443466,24.33459648384248,0 56.73500304028357,24.56368325312187,0 56.72656471071915,24.57361887978731,0 56.57309346581459,24.84701984357467,0 56.50441779853315,24.99594960265624,0 56.50433349353005,25.00093902729403,0 56.44771355470139,25.25213948764897,0 56.44763138020103,25.25712684971825,0 56.4264930810354,25.36657866141938,0 56.41171944085021,25.59595914783641,0 56.43005382355997,25.66367194197571,0 56.56194333184953,25.96084756058052,0 56.6066617166811,26.17987903949812,0 56.57980405692468,26.32794940582447,0 56.53327757140016,26.41380995505169,0 56.33457107103267,26.39306483854733,0 56.19021052846363,26.25368100717692,0 56.16768105068896,26.19579885978477,0 56.08476485694609,26.08929078790176,0 56.00685597366381,25.91695068510375,0 55.52074261151184,25.58980971732876,0 55.17612936813672,25.39222518791673,0 54.95524732310717,25.19180079080549,0 54.72370315792644,24.98180890658784,0 54.59143891565559,24.87888900005346,0 54.47725518383124,24.71026498169303,0 54.29117979539007,24.60365402476311,0 54.10668407157351,24.53002836819185,0 53.84674838021708,24.45397492570235,0 53.63051004330731,24.38355563124107,0 53.53099810274139,24.32599711001882,0 53.52655695929231,24.2430212866572,0 53.47731047620653,24.10526815199695,0 53.48409826645556,23.89833618306972,0 53.43772194035778,23.73559864214896,0 53.65471572344581,23.60707183181828,0
|
||||
53.62876614881812,23.58520953923354,0 53.81497415962468,23.64039601077693,0 53.89006934210051,23.70030483918968,0 53.82333143229609,23.8516202627874,0 53.86319220148564,23.98332838418791,0 53.99053354492822,24.12456957062248,0 54.06970919826648,24.16390902332125,0 54.29453647311612,24.20786500130305,0 54.4269606795388,24.1621613203329,0 54.62769762272161,24.13496838655094,0 54.81618779246777,24.14356800279005,0 55.07760305886731,24.12710640153997,0 55.3717135673071,24.09408330468836,0 55.51665272247794,24.08714942578391,0 55.7130597944597,24.04771223790903,0 55.8475595566997,24.02354751356681,0 56.10545120654146,24.13762037622954,0 55.99976854056003,24.32485982077774,0 56.10486910232725,24.49774628963504,0 56.24379095616488,24.66002432190549,0 56.3757168932834,24.73517133058909,0 56.6059558780324,24.42435856267748,0 56.85872988375159,24.12755561616724,0 57.0338824559102,23.9914503374143,0 57.21308953024807,23.94929119710407,0 57.21680836491202,24.04403878815587,0 56.94869924942736,24.32708003404261,0 56.94581183443466,24.33459648384248,0 56.73500304028357,24.56368325312187,0 56.72656471071916,24.57361887978731,0 56.57309346581459,24.84701984357467,0 56.50441779853315,24.99594960265624,0 56.50433349353005,25.00093902729403,0 56.44771355470139,25.25213948764897,0 56.44763138020103,25.25712684971825,0 56.4264930810354,25.36657866141938,0 56.41171944085021,25.59595914783641,0 56.43005382355997,25.66367194197571,0 56.56194333184953,25.96084756058052,0 56.6066617166811,26.17987903949812,0 56.57980405692468,26.32794940582447,0 56.53327757140016,26.41380995505169,0 56.33457107103267,26.39306483854733,0 56.19021052846363,26.25368100717692,0 56.16768105068896,26.19579885978477,0 56.08476485694609,26.08929078790176,0 56.00685597366381,25.91695068510375,0 55.52074261151184,25.58980971732876,0 55.17612936813672,25.39222518791673,0 54.95524732310717,25.19180079080549,0 54.72370315792644,24.98180890658784,0 54.59143891565559,24.87888900005346,0 54.463400225382,24.72046550155631,0 54.2874697694143,24.61403529309966,0 54.10668407157351,24.53002836819185,0 53.84674838021708,24.45397492570235,0 53.63051004330731,24.38355563124107,0 53.53099810274139,24.32599711001882,0 53.52655695929231,24.2430212866572,0 53.47731047620653,24.10526815199695,0 53.48409826645556,23.89833618306972,0 53.43772194035778,23.73559864214896,0 53.62876614881812,23.58520953923354,0
|
||||
</coordinates>
|
||||
</LinearRing>
|
||||
</outerBoundaryIs>
|
||||
</Polygon>
|
||||
<Polygon>
|
||||
<tessellate>1</tessellate>
|
||||
<outerBoundaryIs>
|
||||
<LinearRing>
|
||||
<coordinates>
|
||||
53.12492547604882,26.78128994935179,0 53.93429903281053,26.44886627234056,0 54.39518502867432,26.24317681495279,0 54.40595226013039,26.15085791066511,0 54.39402006647479,26.07275670239802,0 54.45409861019316,25.87972338154338,0 54.41724414033247,25.73480314688115,0 54.1187172157126,25.25321836400623,0 54.20987940042988,25.12047998388877,0 54.35257401277801,25.2267744278992,0 54.41550992214921,25.32036971405005,0 54.64097689900847,25.81475254728567,0 55.08139929658433,25.77655670271657,0 55.14837973740534,25.86648896219312,0 55.23438119476889,26.04611850844939,0 55.34687991216698,26.17079665300636,0 55.41772530288445,26.2809137484762,0 55.36900054746567,26.33000085609055,0 55.20397500475956,26.3236903109378,0 55.08125982524341,26.30582632988321,0 55.07529454278418,26.22195863065989,0 55.00557201138665,26.03662481453928,0 54.96119908244564,25.94100327391857,0 54.78115168217862,25.9371329700981,0 54.60398848713732,25.97924476797395,0 54.60929788338804,26.08907791015604,0 54.60926847524901,26.09196656708914,0 54.60493136791606,26.20170115253774,0 54.60709119423685,26.30570625817345,0 54.6032780887619,26.36345036596925,0 53.98968432153845,26.6143340162421,0 53.63126264971719,26.71666369444971,0 53.4267861671608,26.84118901754458,0 53.2458617324182,26.89935838924461,0 53.10187007838965,26.90286187426819,0 53.12492547604882,26.78128994935179,0
|
||||
</coordinates>
|
||||
</LinearRing>
|
||||
</outerBoundaryIs>
|
||||
|
||||
@ -0,0 +1,6 @@
|
||||
{
|
||||
"output_directory": "",
|
||||
"boundary_file": "./configs/persiangulf/mediumresolution.kml",
|
||||
"zoom_factor": 0.15,
|
||||
"geo_width": 3.05
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
cd ../..
|
||||
|
||||
call .venv/scripts/activate
|
||||
|
||||
python main.py ./configs/persiangulf/boundary.yaml -s
|
||||
python main.py ./configs/persiangulf/lowresolution.yaml -s -l 11
|
||||
python main.py ./configs/persiangulf/mediumresolution.yaml -s -l 13
|
||||
python main.py ./configs/persiangulf/highresolution.yaml -s -l 15
|
||||
|
||||
@ -0,0 +1,8 @@
|
||||
cd ../..
|
||||
|
||||
call .venv/scripts/activate
|
||||
|
||||
python main.py ./configs/persiangulf/boundary.yaml -r -o -w 0.2
|
||||
python main.py ./configs/persiangulf/lowresolution.yaml -r -o -w 0.2
|
||||
python main.py ./configs/persiangulf/mediumresolution.yaml -r -o -w 0.2
|
||||
python main.py ./configs/persiangulf/highresolution.yaml -r -o -w 0.2
|
||||
@ -331,6 +331,8 @@ def run(map_config, port):
|
||||
start_X, start_Y = deg_to_num(start_lat, start_lng, zoom)
|
||||
end_X, end_Y = deg_to_num(end_lat, end_lng, zoom)
|
||||
|
||||
print(f"Feature {f} of {len(features)}, finding screenshot locations, this may take a while...")
|
||||
|
||||
# Find all the X, Y coordinates inside of the provided area
|
||||
screenshots_XY = []
|
||||
for X in range(start_X, end_X, n_width):
|
||||
@ -400,6 +402,7 @@ def run(map_config, port):
|
||||
for current_zoom in range(zoom, map_config["final_level"], -1):
|
||||
Xs = [int(d) for d in listdir(os.path.join(map_config["tiles_folder"], str(current_zoom))) if isdir(join(map_config["tiles_folder"], str(current_zoom), d))]
|
||||
existing_tiles = []
|
||||
print("Finding tiles to merge...")
|
||||
for X in Xs:
|
||||
Ys = [int(f.removesuffix(".png")) for f in listdir(os.path.join(map_config["tiles_folder"], str(current_zoom), str(X))) if isfile(join(map_config["tiles_folder"], str(current_zoom), str(X), f))]
|
||||
for Y in Ys:
|
||||
@ -424,12 +427,12 @@ def run(map_config, port):
|
||||
res.extend([fut.result() for fut in futures.as_completed(futs)])
|
||||
print(f"Merged {len(res)} images in {datetime.datetime.now() - start_time}s")
|
||||
|
||||
########### Assemble tiles to get lower zoom levels
|
||||
########### Compress tiles to reduce storage and download times
|
||||
if not map_config["screenshots_only"] and not map_config["extraction_only"] and not map_config["merging_only"]:
|
||||
start_time = datetime.datetime.now()
|
||||
res = []
|
||||
print("Tiles compression start time: ", start_time)
|
||||
for current_zoom in range(zoom, map_config["final_level"], -1):
|
||||
for current_zoom in range(zoom, map_config["final_level"] - 1, -1):
|
||||
Xs = [int(d) for d in listdir(os.path.join(map_config["tiles_folder"], str(current_zoom))) if isdir(join(map_config["tiles_folder"], str(current_zoom), d))]
|
||||
existing_tiles = []
|
||||
for X in Xs:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user