initial commit
This commit is contained in:
commit
4e83de6fa5
33 changed files with 4730 additions and 0 deletions
BIN
buildtools/sourcemapper
Executable file
BIN
buildtools/sourcemapper
Executable file
Binary file not shown.
72
buildtools/sourcemapper.go
Normal file
72
buildtools/sourcemapper.go
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
"strconv"
|
||||||
|
)
|
||||||
|
|
||||||
|
type LineRange struct {
|
||||||
|
Start int
|
||||||
|
End int
|
||||||
|
}
|
||||||
|
|
||||||
|
func srcMapDeserialize(s string) map[string]LineRange {
|
||||||
|
self := map[string]LineRange{}
|
||||||
|
totalLines := 0
|
||||||
|
lines := strings.Split(s, "\n");
|
||||||
|
for _, l := range lines {
|
||||||
|
file := ""
|
||||||
|
nLines := 0
|
||||||
|
|
||||||
|
fmt.Sscanf(l, "%s\t%d", &file, &nLines)
|
||||||
|
rg := LineRange{
|
||||||
|
Start: totalLines,
|
||||||
|
End: totalLines + nLines,
|
||||||
|
}
|
||||||
|
totalLines += nLines
|
||||||
|
self[file] = rg;
|
||||||
|
}
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
func buildOutputTransform(buildOutput string, srcMap map[string]LineRange) string {
|
||||||
|
self := ""
|
||||||
|
lines := strings.Split(buildOutput, "\n")
|
||||||
|
for _, l := range lines {
|
||||||
|
parts := strings.Split(l, ":")
|
||||||
|
if (len(parts) > 1) {
|
||||||
|
lineNumber, err := strconv.ParseInt(parts[1], 10, 32)
|
||||||
|
if err == nil {
|
||||||
|
for f, rg := range srcMap {
|
||||||
|
if lineNumber <= int64(rg.End) && lineNumber > int64(rg.Start) {
|
||||||
|
self += strings.Replace(
|
||||||
|
strings.Replace(l, parts[1], strconv.FormatInt(lineNumber - int64(rg.Start), 10), 1),
|
||||||
|
parts[0], f, 1) + "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
panic(err.Error())
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
self += l + "\n"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
if len(os.Args) == 2 {
|
||||||
|
errFilename := os.Args[1];
|
||||||
|
errFile, err1 := os.ReadFile(errFilename);
|
||||||
|
srcMapFile, err2 := os.ReadFile(".srcmap");
|
||||||
|
if err1 != nil || err2 != nil {
|
||||||
|
panic("Couldn't open either the error temp file or the source map");
|
||||||
|
}
|
||||||
|
srcMap := srcMapDeserialize(string(srcMapFile[:]))
|
||||||
|
fmt.Print(buildOutputTransform(string(errFile[:]), srcMap))
|
||||||
|
} else {
|
||||||
|
fmt.Println("usage: sourcemapper ERRFILE");
|
||||||
|
}
|
||||||
|
}
|
36
site/index.html
Normal file
36
site/index.html
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang='en'>
|
||||||
|
<head>
|
||||||
|
<meta charset='utf-8'>
|
||||||
|
<meta name='description' content='ONYX map annotation tool'/>
|
||||||
|
<meta name='viewport' content='width=device-width,initial-scale=1'>
|
||||||
|
<link rel='stylesheet' type='text/css' href='/static/style.css'>
|
||||||
|
<!--<link rel='shortcut icon' href='/img/favicon.png'>-->
|
||||||
|
<title>ONYX - Scry/Pendulum</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div id="map"></div>
|
||||||
|
<div id="mapControls">
|
||||||
|
<button id="addPoint-btn">·</button>
|
||||||
|
<button id="addCircle-btn">∘</button>
|
||||||
|
<button id="addPolygon-btn">⋄</button>
|
||||||
|
<div id="subControls">
|
||||||
|
<button id="save-btn"><3</button>
|
||||||
|
<button id="tiles-btn">←→</button>
|
||||||
|
<button id="clear-btn">XXX</button>
|
||||||
|
<button id="menu-btn">≡</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="modal-container">
|
||||||
|
<button class="closeBtn" id="modalCloseBtn">x</button>
|
||||||
|
<h2 id="modal-title"></h2>
|
||||||
|
<div id="modal-content">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
<link rel='stylesheet' type="text/css" href="/static/leaflet.css">
|
||||||
|
<script src="/static/leaflet.js"></script>
|
||||||
|
<script src="/static/onyx-scry.js"></script>
|
||||||
|
</html>
|
5
src/.srcmap
Normal file
5
src/.srcmap
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
10-overlay.ts 146
|
||||||
|
11-tilelayer.ts 37
|
||||||
|
20-modal.ts 78
|
||||||
|
30-handlers.ts 2
|
||||||
|
99-onyx-scry.ts 79
|
147
src/10-overlay.ts
Normal file
147
src/10-overlay.ts
Normal file
|
@ -0,0 +1,147 @@
|
||||||
|
class Point implements L.LatLngLiteral {
|
||||||
|
lat: number = 0.00;
|
||||||
|
lng: number = 0.00;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum OverlayType {
|
||||||
|
POINT = 0,
|
||||||
|
CIRCLE = 1,
|
||||||
|
POLYGON = 2,
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Overlay {
|
||||||
|
name: string;
|
||||||
|
desc: string;
|
||||||
|
points: Point[];
|
||||||
|
options: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
class OverlayData implements Overlay {
|
||||||
|
name: string;
|
||||||
|
desc: string;
|
||||||
|
points: Point[];
|
||||||
|
options: any;
|
||||||
|
type: OverlayType;
|
||||||
|
|
||||||
|
constructor(type: OverlayType, name: string, desc: string, points: Point[], options: any) {
|
||||||
|
this.type = type;
|
||||||
|
this.name = name;
|
||||||
|
this.desc = desc;
|
||||||
|
this.points = points;
|
||||||
|
this.options = options;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class OverlayBase implements Overlay {
|
||||||
|
name: string;
|
||||||
|
desc: string;
|
||||||
|
points: Point[];
|
||||||
|
options: any;
|
||||||
|
protected self: any;
|
||||||
|
|
||||||
|
constructor(name: string, desc: string, points: Point[], options: any) {
|
||||||
|
this.name = name;
|
||||||
|
this.desc = desc;
|
||||||
|
this.points = points;
|
||||||
|
this.options = options;
|
||||||
|
}
|
||||||
|
|
||||||
|
add(map: L.Map): void {
|
||||||
|
this.self.addTo(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
remove(map: L.Map): void {
|
||||||
|
this.self.removeFrom(map);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class Marker extends OverlayBase {
|
||||||
|
|
||||||
|
constructor(name: string, desc: string, point: Point, options: any) {
|
||||||
|
super(name, desc, [ point ], options);
|
||||||
|
this.self = L.marker(point);
|
||||||
|
this.self.bindPopup(`<h3>${name}</h3><p>${desc}</p>`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Circle extends OverlayBase {
|
||||||
|
|
||||||
|
constructor(name: string, desc: string, point: Point, options: any) {
|
||||||
|
super(name, desc, [ point ], options);
|
||||||
|
this.self = L.circle(point, options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Polygon extends OverlayBase {
|
||||||
|
|
||||||
|
constructor(name: string, desc: string, points: Point[], options: any) {
|
||||||
|
super(name, desc, points, options);
|
||||||
|
this.self = L.polygon(points, options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class OverlayState {
|
||||||
|
markers: Marker[];
|
||||||
|
circles: Circle[];
|
||||||
|
polygons: Polygon[];
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.markers = [];
|
||||||
|
this.circles = [];
|
||||||
|
this.polygons = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
static load(): OverlayState {
|
||||||
|
const store = localStorage.getItem("overlay_state");
|
||||||
|
if (store) {
|
||||||
|
const model = JSON.parse(store);
|
||||||
|
return {
|
||||||
|
markers: model.markers.map((m: OverlayData) => OverlayState.fromData(m)),
|
||||||
|
circles: model.circles.map((c: OverlayData) => OverlayState.fromData(c)),
|
||||||
|
polygons: model.polygons.map((p: OverlayData) => OverlayState.fromData(p)),
|
||||||
|
} as OverlayState
|
||||||
|
} else {
|
||||||
|
return new OverlayState();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static save(overlayState: OverlayState): void {
|
||||||
|
localStorage.setItem("overlay_state", JSON.stringify({
|
||||||
|
markers: overlayState.markers.map((m: OverlayBase) => OverlayState.toData(m)),
|
||||||
|
circles: overlayState.circles.map((c: OverlayBase) => OverlayState.toData(c)),
|
||||||
|
polygons: overlayState.polygons.map((p: OverlayBase) => OverlayState.toData(p)),
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
static clear(overlayState: OverlayState, map: L.Map): OverlayState {
|
||||||
|
overlayState.markers.forEach((m: Marker) => m.remove(map));
|
||||||
|
overlayState.circles.forEach((c: Circle) => c.remove(map));
|
||||||
|
overlayState.polygons.forEach((p: Polygon) => p.remove(map));
|
||||||
|
|
||||||
|
return new OverlayState();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static toData(source: OverlayBase): OverlayData {
|
||||||
|
let type = OverlayType.POINT;
|
||||||
|
if (source.points.length > 1) {
|
||||||
|
type = OverlayType.POLYGON;
|
||||||
|
} else if (source.options.radius) {
|
||||||
|
type = OverlayType.CIRCLE;
|
||||||
|
}
|
||||||
|
return new OverlayData(type, source.name, source.desc, source.points, source.options);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static fromData(data: OverlayData): OverlayBase {
|
||||||
|
switch(data.type) {
|
||||||
|
case OverlayType.POINT:
|
||||||
|
return new Marker(data.name, data.desc, data.points[0], data.options);
|
||||||
|
case OverlayType.CIRCLE:
|
||||||
|
return new Circle(data.name, data.desc, data.points[0], data.options);
|
||||||
|
case OverlayType.POLYGON:
|
||||||
|
return new Polygon(data.name, data.desc, data.points, data.options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
38
src/11-tilelayer.ts
Normal file
38
src/11-tilelayer.ts
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
class TileLayerWrapper {
|
||||||
|
self: L.TileLayer;
|
||||||
|
name: string;
|
||||||
|
visible: boolean = false;
|
||||||
|
|
||||||
|
constructor(name: string, self: L.TileLayer) {
|
||||||
|
this.self = self;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
static constructLayer(name: string, self: L.TileLayer): TileLayerWrapper {
|
||||||
|
const wrapper = new TileLayerWrapper(name, self);
|
||||||
|
TileLayerWrapper.layers.push(wrapper);
|
||||||
|
return wrapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
static getActiveLayer(): TileLayerWrapper | null {
|
||||||
|
for (const l of TileLayerWrapper.layers) {
|
||||||
|
if (l.visible == true) {
|
||||||
|
return l;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
static layers: TileLayerWrapper[] = new Array<TileLayerWrapper>();
|
||||||
|
static enableOnly(self: TileLayerWrapper, map: L.Map): void {
|
||||||
|
for (const l of TileLayerWrapper.layers) {
|
||||||
|
if (l.visible) {
|
||||||
|
l.self.removeFrom(map);
|
||||||
|
l.visible = false;
|
||||||
|
}
|
||||||
|
if (l.name == self.name) {
|
||||||
|
l.self.addTo(map);
|
||||||
|
l.visible = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
79
src/20-modal.ts
Normal file
79
src/20-modal.ts
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
class Modal {
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
const _this = this;
|
||||||
|
const closeBtn = document.getElementById("modalCloseBtn");
|
||||||
|
if (closeBtn) {
|
||||||
|
closeBtn.onclick = ()=>{_this.setVisible(false)};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
self(): HTMLElement | null {
|
||||||
|
return document.getElementById("modal-container");
|
||||||
|
}
|
||||||
|
|
||||||
|
title(): HTMLElement | null{
|
||||||
|
return document.getElementById("modal-title");
|
||||||
|
}
|
||||||
|
|
||||||
|
content(): HTMLElement | null {
|
||||||
|
return document.getElementById("modal-content");
|
||||||
|
}
|
||||||
|
|
||||||
|
submitBtn(): HTMLElement | null {
|
||||||
|
return document.getElementById("modal-submitBtn");
|
||||||
|
}
|
||||||
|
|
||||||
|
nameField(): string {
|
||||||
|
return (document.getElementById("modal-name") as HTMLInputElement)?.value ?? "";
|
||||||
|
}
|
||||||
|
|
||||||
|
descField(): string {
|
||||||
|
return (document.getElementById("modal-desc") as HTMLInputElement)?.value ?? "";
|
||||||
|
}
|
||||||
|
|
||||||
|
visible(): boolean {
|
||||||
|
return this.self()?.style.display != "none";
|
||||||
|
}
|
||||||
|
|
||||||
|
setVisible(v: boolean): void {
|
||||||
|
const modal = this.self();
|
||||||
|
if (modal) {
|
||||||
|
modal.style.display = v ? "block" : "none";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setState(state: OverlayType, args: any): void {
|
||||||
|
const _this = this;
|
||||||
|
switch (state) {
|
||||||
|
case OverlayType.POINT:
|
||||||
|
const title = this.title()
|
||||||
|
if (title) {
|
||||||
|
title.innerHTML = "Add Marker";
|
||||||
|
}
|
||||||
|
fetch("/static/pointModal.html")
|
||||||
|
.then(r=>r.text())
|
||||||
|
.then(t=> {
|
||||||
|
const content = _this.content();
|
||||||
|
if (content) { content.innerHTML = t; }
|
||||||
|
const submitBtn = _this.submitBtn();
|
||||||
|
if (submitBtn) {
|
||||||
|
submitBtn.onclick = () => {
|
||||||
|
const name = _this.nameField();
|
||||||
|
const desc = _this.descField();
|
||||||
|
const point = new Marker(name, desc, args.latlng, {title: name, alt: name});
|
||||||
|
point.add(args.map);
|
||||||
|
args.overlays.markers.push(point);
|
||||||
|
_this.setVisible(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
break;
|
||||||
|
case OverlayType.CIRCLE:
|
||||||
|
break;
|
||||||
|
case OverlayType.POLYGON:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
src/30-handlers.ts
Normal file
3
src/30-handlers.ts
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
class MapHandlers {
|
||||||
|
|
||||||
|
}
|
79
src/99-onyx-scry.ts
Normal file
79
src/99-onyx-scry.ts
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
|
||||||
|
function init(): void {
|
||||||
|
let overlays: OverlayState = OverlayState.load() ?? new OverlayState();
|
||||||
|
const map = L.map('map').setView([35.6653, -105.9507], 13);
|
||||||
|
|
||||||
|
const streetLayer = TileLayerWrapper.constructLayer(
|
||||||
|
"streetLayer",
|
||||||
|
L.tileLayer(
|
||||||
|
'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
||||||
|
{
|
||||||
|
maxZoom: 19,
|
||||||
|
attribution: '© OpenStreetMap'
|
||||||
|
}));
|
||||||
|
|
||||||
|
const satelliteLayer = TileLayerWrapper.constructLayer(
|
||||||
|
"satelliteLayer",
|
||||||
|
L.tileLayer(
|
||||||
|
'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',
|
||||||
|
{
|
||||||
|
maxZoom: 19,
|
||||||
|
attribution: "© Esri"
|
||||||
|
}));
|
||||||
|
|
||||||
|
TileLayerWrapper.enableOnly(streetLayer, map);
|
||||||
|
|
||||||
|
overlays.markers.forEach(m=>m.add(map));
|
||||||
|
overlays.circles.forEach(m=>m.add(map));
|
||||||
|
overlays.polygons.forEach(m=>m.add(map));
|
||||||
|
|
||||||
|
const modal = new Modal();
|
||||||
|
|
||||||
|
const addMarkerHandler = (e: any) => {
|
||||||
|
modal.setVisible(true);
|
||||||
|
modal.setState(OverlayType.POINT, {
|
||||||
|
latlng: e.latlng,
|
||||||
|
map: map,
|
||||||
|
overlays: overlays,
|
||||||
|
});
|
||||||
|
map.off("click", addMarkerHandler);
|
||||||
|
}
|
||||||
|
|
||||||
|
const addMarkerBtn = document.getElementById("addPoint-btn");
|
||||||
|
if (addMarkerBtn) {
|
||||||
|
addMarkerBtn.onclick = (e: any)=>{
|
||||||
|
try{
|
||||||
|
map.off("click", addMarkerHandler);
|
||||||
|
} finally {
|
||||||
|
map.on("click", addMarkerHandler);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const saveBtn = document.getElementById("save-btn");
|
||||||
|
if (saveBtn) {
|
||||||
|
saveBtn.onclick = (e: any) => {
|
||||||
|
OverlayState.save(overlays);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const clearBtn = document.getElementById("clear-btn");
|
||||||
|
if (clearBtn) {
|
||||||
|
clearBtn.onclick = (e: any) => {
|
||||||
|
overlays = OverlayState.clear(overlays, map);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const tilesBtn = document.getElementById("tiles-btn");
|
||||||
|
if (tilesBtn) {
|
||||||
|
tilesBtn.onclick = (e: any) => {
|
||||||
|
if (TileLayerWrapper.getActiveLayer() == satelliteLayer) {
|
||||||
|
TileLayerWrapper.enableOnly(streetLayer, map);
|
||||||
|
} else {
|
||||||
|
TileLayerWrapper.enableOnly(satelliteLayer, map);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
init();
|
40
src/build.sh
Executable file
40
src/build.sh
Executable file
|
@ -0,0 +1,40 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# default program name
|
||||||
|
progname="onyx-scry"
|
||||||
|
|
||||||
|
# or use first cmd line arg
|
||||||
|
if [ ! -z "$1" ]; then
|
||||||
|
progname=$1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# remove existing concatenated source file and source map
|
||||||
|
if [ -e ${progname}.ts ]; then
|
||||||
|
rm ${progname}.ts
|
||||||
|
fi
|
||||||
|
if [ -e .srcmap ]; then
|
||||||
|
rm .srcmap
|
||||||
|
fi
|
||||||
|
|
||||||
|
# build the source map and concatenate the source
|
||||||
|
for f in *.ts; do
|
||||||
|
lines=$(wc -l ${f})
|
||||||
|
set ${lines}
|
||||||
|
lines=$1
|
||||||
|
|
||||||
|
echo "${f}\t${lines}" >> .srcmap
|
||||||
|
cat ${f} >> ${progname}.ts
|
||||||
|
done
|
||||||
|
|
||||||
|
# generate temporary file for intermediate output
|
||||||
|
errorOut=$(mktemp)
|
||||||
|
|
||||||
|
# compile and write output to temporary file
|
||||||
|
tsc --strict --outFile ../static/${progname}.js ${progname}.ts | sed -e s/\(/:/ -e s/,/:/ -e s/\):// | nobs >> ${errorOut}
|
||||||
|
|
||||||
|
# translate lines into original source with the source map and output to stdout
|
||||||
|
../buildtools/sourcemapper ${errorOut}
|
||||||
|
|
||||||
|
# delete the temporary file
|
||||||
|
rm ${errorOut}
|
20
src/node_modules/.package-lock.json
generated
vendored
Normal file
20
src/node_modules/.package-lock.json
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
"name": "src",
|
||||||
|
"lockfileVersion": 2,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {
|
||||||
|
"node_modules/@types/geojson": {
|
||||||
|
"version": "7946.0.10",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.10.tgz",
|
||||||
|
"integrity": "sha512-Nmh0K3iWQJzniTuPRcJn5hxXkfB1T1pgB89SBig5PlJQU5yocazeu4jATJlaA0GYFKWMqDdvYemoSnF2pXgLVA=="
|
||||||
|
},
|
||||||
|
"node_modules/@types/leaflet": {
|
||||||
|
"version": "1.7.11",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/leaflet/-/leaflet-1.7.11.tgz",
|
||||||
|
"integrity": "sha512-VwAYom2pfIAf/pLj1VR5aLltd4tOtHyvfaJlNYCoejzP2nu52PrMi1ehsLRMUS+bgafmIIKBV1cMfKeS+uJ0Vg==",
|
||||||
|
"dependencies": {
|
||||||
|
"@types/geojson": "*"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
21
src/node_modules/@types/geojson/LICENSE
generated
vendored
Executable file
21
src/node_modules/@types/geojson/LICENSE
generated
vendored
Executable file
|
@ -0,0 +1,21 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Microsoft Corporation.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE
|
16
src/node_modules/@types/geojson/README.md
generated
vendored
Executable file
16
src/node_modules/@types/geojson/README.md
generated
vendored
Executable file
|
@ -0,0 +1,16 @@
|
||||||
|
# Installation
|
||||||
|
> `npm install --save @types/geojson`
|
||||||
|
|
||||||
|
# Summary
|
||||||
|
This package contains type definitions for geojson (https://geojson.org/).
|
||||||
|
|
||||||
|
# Details
|
||||||
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/geojson.
|
||||||
|
|
||||||
|
### Additional Details
|
||||||
|
* Last updated: Thu, 14 Jul 2022 00:02:25 GMT
|
||||||
|
* Dependencies: none
|
||||||
|
* Global values: `GeoJSON`
|
||||||
|
|
||||||
|
# Credits
|
||||||
|
These definitions were written by [Jacob Bruun](https://github.com/cobster), [Arne Schubert](https://github.com/atd-schubert), [Jeff Jacobson](https://github.com/JeffJacobson), [Ilia Choly](https://github.com/icholy), and [Dan Vanderkam](https://github.com/danvk).
|
175
src/node_modules/@types/geojson/index.d.ts
generated
vendored
Executable file
175
src/node_modules/@types/geojson/index.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,175 @@
|
||||||
|
// Type definitions for non-npm package geojson 7946.0
|
||||||
|
// Project: https://geojson.org/
|
||||||
|
// Definitions by: Jacob Bruun <https://github.com/cobster>
|
||||||
|
// Arne Schubert <https://github.com/atd-schubert>
|
||||||
|
// Jeff Jacobson <https://github.com/JeffJacobson>
|
||||||
|
// Ilia Choly <https://github.com/icholy>
|
||||||
|
// Dan Vanderkam <https://github.com/danvk>
|
||||||
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||||
|
// TypeScript Version: 2.3
|
||||||
|
|
||||||
|
// Note: as of the RFC 7946 version of GeoJSON, Coordinate Reference Systems
|
||||||
|
// are no longer supported. (See https://tools.ietf.org/html/rfc7946#appendix-B)}
|
||||||
|
|
||||||
|
export as namespace GeoJSON;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The valid values for the "type" property of GeoJSON geometry objects.
|
||||||
|
* https://tools.ietf.org/html/rfc7946#section-1.4
|
||||||
|
*/
|
||||||
|
export type GeoJsonGeometryTypes = Geometry['type'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value values for the "type" property of GeoJSON Objects.
|
||||||
|
* https://tools.ietf.org/html/rfc7946#section-1.4
|
||||||
|
*/
|
||||||
|
export type GeoJsonTypes = GeoJSON['type'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bounding box
|
||||||
|
* https://tools.ietf.org/html/rfc7946#section-5
|
||||||
|
*/
|
||||||
|
export type BBox = [number, number, number, number] | [number, number, number, number, number, number];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Position is an array of coordinates.
|
||||||
|
* https://tools.ietf.org/html/rfc7946#section-3.1.1
|
||||||
|
* Array should contain between two and three elements.
|
||||||
|
* The previous GeoJSON specification allowed more elements (e.g., which could be used to represent M values),
|
||||||
|
* but the current specification only allows X, Y, and (optionally) Z to be defined.
|
||||||
|
*/
|
||||||
|
export type Position = number[]; // [number, number] | [number, number, number];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The base GeoJSON object.
|
||||||
|
* https://tools.ietf.org/html/rfc7946#section-3
|
||||||
|
* The GeoJSON specification also allows foreign members
|
||||||
|
* (https://tools.ietf.org/html/rfc7946#section-6.1)
|
||||||
|
* Developers should use "&" type in TypeScript or extend the interface
|
||||||
|
* to add these foreign members.
|
||||||
|
*/
|
||||||
|
export interface GeoJsonObject {
|
||||||
|
// Don't include foreign members directly into this type def.
|
||||||
|
// in order to preserve type safety.
|
||||||
|
// [key: string]: any;
|
||||||
|
/**
|
||||||
|
* Specifies the type of GeoJSON object.
|
||||||
|
*/
|
||||||
|
type: GeoJsonTypes;
|
||||||
|
/**
|
||||||
|
* Bounding box of the coordinate range of the object's Geometries, Features, or Feature Collections.
|
||||||
|
* The value of the bbox member is an array of length 2*n where n is the number of dimensions
|
||||||
|
* represented in the contained geometries, with all axes of the most southwesterly point
|
||||||
|
* followed by all axes of the more northeasterly point.
|
||||||
|
* The axes order of a bbox follows the axes order of geometries.
|
||||||
|
* https://tools.ietf.org/html/rfc7946#section-5
|
||||||
|
*/
|
||||||
|
bbox?: BBox | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Union of GeoJSON objects.
|
||||||
|
*/
|
||||||
|
export type GeoJSON = Geometry | Feature | FeatureCollection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Geometry object.
|
||||||
|
* https://tools.ietf.org/html/rfc7946#section-3
|
||||||
|
*/
|
||||||
|
export type Geometry = Point | MultiPoint | LineString | MultiLineString | Polygon | MultiPolygon | GeometryCollection;
|
||||||
|
export type GeometryObject = Geometry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Point geometry object.
|
||||||
|
* https://tools.ietf.org/html/rfc7946#section-3.1.2
|
||||||
|
*/
|
||||||
|
export interface Point extends GeoJsonObject {
|
||||||
|
type: 'Point';
|
||||||
|
coordinates: Position;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MultiPoint geometry object.
|
||||||
|
* https://tools.ietf.org/html/rfc7946#section-3.1.3
|
||||||
|
*/
|
||||||
|
export interface MultiPoint extends GeoJsonObject {
|
||||||
|
type: 'MultiPoint';
|
||||||
|
coordinates: Position[];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LineString geometry object.
|
||||||
|
* https://tools.ietf.org/html/rfc7946#section-3.1.4
|
||||||
|
*/
|
||||||
|
export interface LineString extends GeoJsonObject {
|
||||||
|
type: 'LineString';
|
||||||
|
coordinates: Position[];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MultiLineString geometry object.
|
||||||
|
* https://tools.ietf.org/html/rfc7946#section-3.1.5
|
||||||
|
*/
|
||||||
|
export interface MultiLineString extends GeoJsonObject {
|
||||||
|
type: 'MultiLineString';
|
||||||
|
coordinates: Position[][];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Polygon geometry object.
|
||||||
|
* https://tools.ietf.org/html/rfc7946#section-3.1.6
|
||||||
|
*/
|
||||||
|
export interface Polygon extends GeoJsonObject {
|
||||||
|
type: 'Polygon';
|
||||||
|
coordinates: Position[][];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MultiPolygon geometry object.
|
||||||
|
* https://tools.ietf.org/html/rfc7946#section-3.1.7
|
||||||
|
*/
|
||||||
|
export interface MultiPolygon extends GeoJsonObject {
|
||||||
|
type: 'MultiPolygon';
|
||||||
|
coordinates: Position[][][];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Geometry Collection
|
||||||
|
* https://tools.ietf.org/html/rfc7946#section-3.1.8
|
||||||
|
*/
|
||||||
|
export interface GeometryCollection<G extends Geometry = Geometry> extends GeoJsonObject {
|
||||||
|
type: 'GeometryCollection';
|
||||||
|
geometries: G[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export type GeoJsonProperties = { [name: string]: any } | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A feature object which contains a geometry and associated properties.
|
||||||
|
* https://tools.ietf.org/html/rfc7946#section-3.2
|
||||||
|
*/
|
||||||
|
export interface Feature<G extends Geometry | null = Geometry, P = GeoJsonProperties> extends GeoJsonObject {
|
||||||
|
type: 'Feature';
|
||||||
|
/**
|
||||||
|
* The feature's geometry
|
||||||
|
*/
|
||||||
|
geometry: G;
|
||||||
|
/**
|
||||||
|
* A value that uniquely identifies this feature in a
|
||||||
|
* https://tools.ietf.org/html/rfc7946#section-3.2.
|
||||||
|
*/
|
||||||
|
id?: string | number | undefined;
|
||||||
|
/**
|
||||||
|
* Properties associated with this feature.
|
||||||
|
*/
|
||||||
|
properties: P;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A collection of feature objects.
|
||||||
|
* https://tools.ietf.org/html/rfc7946#section-3.3
|
||||||
|
*/
|
||||||
|
export interface FeatureCollection<G extends Geometry | null = Geometry, P = GeoJsonProperties> extends GeoJsonObject {
|
||||||
|
type: 'FeatureCollection';
|
||||||
|
features: Array<Feature<G, P>>;
|
||||||
|
}
|
45
src/node_modules/@types/geojson/package.json
generated
vendored
Executable file
45
src/node_modules/@types/geojson/package.json
generated
vendored
Executable file
|
@ -0,0 +1,45 @@
|
||||||
|
{
|
||||||
|
"name": "@types/geojson",
|
||||||
|
"version": "7946.0.10",
|
||||||
|
"description": "TypeScript definitions for geojson",
|
||||||
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/geojson",
|
||||||
|
"license": "MIT",
|
||||||
|
"contributors": [
|
||||||
|
{
|
||||||
|
"name": "Jacob Bruun",
|
||||||
|
"url": "https://github.com/cobster",
|
||||||
|
"githubUsername": "cobster"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Arne Schubert",
|
||||||
|
"url": "https://github.com/atd-schubert",
|
||||||
|
"githubUsername": "atd-schubert"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Jeff Jacobson",
|
||||||
|
"url": "https://github.com/JeffJacobson",
|
||||||
|
"githubUsername": "JeffJacobson"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Ilia Choly",
|
||||||
|
"url": "https://github.com/icholy",
|
||||||
|
"githubUsername": "icholy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Dan Vanderkam",
|
||||||
|
"url": "https://github.com/danvk",
|
||||||
|
"githubUsername": "danvk"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"main": "",
|
||||||
|
"types": "index.d.ts",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
||||||
|
"directory": "types/geojson"
|
||||||
|
},
|
||||||
|
"scripts": {},
|
||||||
|
"dependencies": {},
|
||||||
|
"typesPublisherContentHash": "c643a23a31eff03411bea631b681ed8d12f45c146cc63d329774f19aa6f904bc",
|
||||||
|
"typeScriptVersion": "4.0"
|
||||||
|
}
|
21
src/node_modules/@types/leaflet/LICENSE
generated
vendored
Executable file
21
src/node_modules/@types/leaflet/LICENSE
generated
vendored
Executable file
|
@ -0,0 +1,21 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Microsoft Corporation.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE
|
16
src/node_modules/@types/leaflet/README.md
generated
vendored
Executable file
16
src/node_modules/@types/leaflet/README.md
generated
vendored
Executable file
|
@ -0,0 +1,16 @@
|
||||||
|
# Installation
|
||||||
|
> `npm install --save @types/leaflet`
|
||||||
|
|
||||||
|
# Summary
|
||||||
|
This package contains type definitions for Leaflet.js (https://github.com/Leaflet/Leaflet).
|
||||||
|
|
||||||
|
# Details
|
||||||
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/leaflet.
|
||||||
|
|
||||||
|
### Additional Details
|
||||||
|
* Last updated: Thu, 09 Jun 2022 16:31:40 GMT
|
||||||
|
* Dependencies: [@types/geojson](https://npmjs.com/package/@types/geojson)
|
||||||
|
* Global values: `L`
|
||||||
|
|
||||||
|
# Credits
|
||||||
|
These definitions were written by [Alejandro Sánchez](https://github.com/alejo90), [Arne Schubert](https://github.com/atd-schubert), [Michael Auer](https://github.com/mcauer), [Roni Karilkar](https://github.com/ronikar), [Vladimir Dashukevich](https://github.com/life777), [Henry Thasler](https://github.com/henrythasler), and [Colin Doig](https://github.com/captain-igloo).
|
2047
src/node_modules/@types/leaflet/index.d.ts
generated
vendored
Executable file
2047
src/node_modules/@types/leaflet/index.d.ts
generated
vendored
Executable file
File diff suppressed because it is too large
Load diff
57
src/node_modules/@types/leaflet/package.json
generated
vendored
Executable file
57
src/node_modules/@types/leaflet/package.json
generated
vendored
Executable file
|
@ -0,0 +1,57 @@
|
||||||
|
{
|
||||||
|
"name": "@types/leaflet",
|
||||||
|
"version": "1.7.11",
|
||||||
|
"description": "TypeScript definitions for Leaflet.js",
|
||||||
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/leaflet",
|
||||||
|
"license": "MIT",
|
||||||
|
"contributors": [
|
||||||
|
{
|
||||||
|
"name": "Alejandro Sánchez",
|
||||||
|
"url": "https://github.com/alejo90",
|
||||||
|
"githubUsername": "alejo90"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Arne Schubert",
|
||||||
|
"url": "https://github.com/atd-schubert",
|
||||||
|
"githubUsername": "atd-schubert"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Michael Auer",
|
||||||
|
"url": "https://github.com/mcauer",
|
||||||
|
"githubUsername": "mcauer"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Roni Karilkar",
|
||||||
|
"url": "https://github.com/ronikar",
|
||||||
|
"githubUsername": "ronikar"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Vladimir Dashukevich",
|
||||||
|
"url": "https://github.com/life777",
|
||||||
|
"githubUsername": "life777"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Henry Thasler",
|
||||||
|
"url": "https://github.com/henrythasler",
|
||||||
|
"githubUsername": "henrythasler"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Colin Doig",
|
||||||
|
"url": "https://github.com/captain-igloo",
|
||||||
|
"githubUsername": "captain-igloo"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"main": "",
|
||||||
|
"types": "index.d.ts",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
||||||
|
"directory": "types/leaflet"
|
||||||
|
},
|
||||||
|
"scripts": {},
|
||||||
|
"dependencies": {
|
||||||
|
"@types/geojson": "*"
|
||||||
|
},
|
||||||
|
"typesPublisherContentHash": "5b37446fcf905a4304cf812f2408fb8848c9e7ffda0e3456dcc2ea45c6d7184b",
|
||||||
|
"typeScriptVersion": "3.9"
|
||||||
|
}
|
342
src/onyx-scry.ts
Normal file
342
src/onyx-scry.ts
Normal file
|
@ -0,0 +1,342 @@
|
||||||
|
class Point implements L.LatLngLiteral {
|
||||||
|
lat: number = 0.00;
|
||||||
|
lng: number = 0.00;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum OverlayType {
|
||||||
|
POINT = 0,
|
||||||
|
CIRCLE = 1,
|
||||||
|
POLYGON = 2,
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Overlay {
|
||||||
|
name: string;
|
||||||
|
desc: string;
|
||||||
|
points: Point[];
|
||||||
|
options: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
class OverlayData implements Overlay {
|
||||||
|
name: string;
|
||||||
|
desc: string;
|
||||||
|
points: Point[];
|
||||||
|
options: any;
|
||||||
|
type: OverlayType;
|
||||||
|
|
||||||
|
constructor(type: OverlayType, name: string, desc: string, points: Point[], options: any) {
|
||||||
|
this.type = type;
|
||||||
|
this.name = name;
|
||||||
|
this.desc = desc;
|
||||||
|
this.points = points;
|
||||||
|
this.options = options;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class OverlayBase implements Overlay {
|
||||||
|
name: string;
|
||||||
|
desc: string;
|
||||||
|
points: Point[];
|
||||||
|
options: any;
|
||||||
|
protected self: any;
|
||||||
|
|
||||||
|
constructor(name: string, desc: string, points: Point[], options: any) {
|
||||||
|
this.name = name;
|
||||||
|
this.desc = desc;
|
||||||
|
this.points = points;
|
||||||
|
this.options = options;
|
||||||
|
}
|
||||||
|
|
||||||
|
add(map: L.Map): void {
|
||||||
|
this.self.addTo(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
remove(map: L.Map): void {
|
||||||
|
this.self.removeFrom(map);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class Marker extends OverlayBase {
|
||||||
|
|
||||||
|
constructor(name: string, desc: string, point: Point, options: any) {
|
||||||
|
super(name, desc, [ point ], options);
|
||||||
|
this.self = L.marker(point);
|
||||||
|
this.self.bindPopup(`<h3>${name}</h3><p>${desc}</p>`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Circle extends OverlayBase {
|
||||||
|
|
||||||
|
constructor(name: string, desc: string, point: Point, options: any) {
|
||||||
|
super(name, desc, [ point ], options);
|
||||||
|
this.self = L.circle(point, options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Polygon extends OverlayBase {
|
||||||
|
|
||||||
|
constructor(name: string, desc: string, points: Point[], options: any) {
|
||||||
|
super(name, desc, points, options);
|
||||||
|
this.self = L.polygon(points, options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class OverlayState {
|
||||||
|
markers: Marker[];
|
||||||
|
circles: Circle[];
|
||||||
|
polygons: Polygon[];
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.markers = [];
|
||||||
|
this.circles = [];
|
||||||
|
this.polygons = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
static load(): OverlayState {
|
||||||
|
const store = localStorage.getItem("overlay_state");
|
||||||
|
if (store) {
|
||||||
|
const model = JSON.parse(store);
|
||||||
|
return {
|
||||||
|
markers: model.markers.map((m: OverlayData) => OverlayState.fromData(m)),
|
||||||
|
circles: model.circles.map((c: OverlayData) => OverlayState.fromData(c)),
|
||||||
|
polygons: model.polygons.map((p: OverlayData) => OverlayState.fromData(p)),
|
||||||
|
} as OverlayState
|
||||||
|
} else {
|
||||||
|
return new OverlayState();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static save(overlayState: OverlayState): void {
|
||||||
|
localStorage.setItem("overlay_state", JSON.stringify({
|
||||||
|
markers: overlayState.markers.map((m: OverlayBase) => OverlayState.toData(m)),
|
||||||
|
circles: overlayState.circles.map((c: OverlayBase) => OverlayState.toData(c)),
|
||||||
|
polygons: overlayState.polygons.map((p: OverlayBase) => OverlayState.toData(p)),
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
static clear(overlayState: OverlayState, map: L.Map): OverlayState {
|
||||||
|
overlayState.markers.forEach((m: Marker) => m.remove(map));
|
||||||
|
overlayState.circles.forEach((c: Circle) => c.remove(map));
|
||||||
|
overlayState.polygons.forEach((p: Polygon) => p.remove(map));
|
||||||
|
|
||||||
|
return new OverlayState();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static toData(source: OverlayBase): OverlayData {
|
||||||
|
let type = OverlayType.POINT;
|
||||||
|
if (source.points.length > 1) {
|
||||||
|
type = OverlayType.POLYGON;
|
||||||
|
} else if (source.options.radius) {
|
||||||
|
type = OverlayType.CIRCLE;
|
||||||
|
}
|
||||||
|
return new OverlayData(type, source.name, source.desc, source.points, source.options);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static fromData(data: OverlayData): OverlayBase {
|
||||||
|
switch(data.type) {
|
||||||
|
case OverlayType.POINT:
|
||||||
|
return new Marker(data.name, data.desc, data.points[0], data.options);
|
||||||
|
case OverlayType.CIRCLE:
|
||||||
|
return new Circle(data.name, data.desc, data.points[0], data.options);
|
||||||
|
case OverlayType.POLYGON:
|
||||||
|
return new Polygon(data.name, data.desc, data.points, data.options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}class TileLayerWrapper {
|
||||||
|
self: L.TileLayer;
|
||||||
|
name: string;
|
||||||
|
visible: boolean = false;
|
||||||
|
|
||||||
|
constructor(name: string, self: L.TileLayer) {
|
||||||
|
this.self = self;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
static constructLayer(name: string, self: L.TileLayer): TileLayerWrapper {
|
||||||
|
const wrapper = new TileLayerWrapper(name, self);
|
||||||
|
TileLayerWrapper.layers.push(wrapper);
|
||||||
|
return wrapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
static getActiveLayer(): TileLayerWrapper | null {
|
||||||
|
for (const l of TileLayerWrapper.layers) {
|
||||||
|
if (l.visible == true) {
|
||||||
|
return l;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
static layers: TileLayerWrapper[] = new Array<TileLayerWrapper>();
|
||||||
|
static enableOnly(self: TileLayerWrapper, map: L.Map): void {
|
||||||
|
for (const l of TileLayerWrapper.layers) {
|
||||||
|
if (l.visible) {
|
||||||
|
l.self.removeFrom(map);
|
||||||
|
l.visible = false;
|
||||||
|
}
|
||||||
|
if (l.name == self.name) {
|
||||||
|
l.self.addTo(map);
|
||||||
|
l.visible = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}class Modal {
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
const _this = this;
|
||||||
|
const closeBtn = document.getElementById("modalCloseBtn");
|
||||||
|
if (closeBtn) {
|
||||||
|
closeBtn.onclick = ()=>{_this.setVisible(false)};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
self(): HTMLElement | null {
|
||||||
|
return document.getElementById("modal-container");
|
||||||
|
}
|
||||||
|
|
||||||
|
title(): HTMLElement | null{
|
||||||
|
return document.getElementById("modal-title");
|
||||||
|
}
|
||||||
|
|
||||||
|
content(): HTMLElement | null {
|
||||||
|
return document.getElementById("modal-content");
|
||||||
|
}
|
||||||
|
|
||||||
|
submitBtn(): HTMLElement | null {
|
||||||
|
return document.getElementById("modal-submitBtn");
|
||||||
|
}
|
||||||
|
|
||||||
|
nameField(): string {
|
||||||
|
return (document.getElementById("modal-name") as HTMLInputElement)?.value ?? "";
|
||||||
|
}
|
||||||
|
|
||||||
|
descField(): string {
|
||||||
|
return (document.getElementById("modal-desc") as HTMLInputElement)?.value ?? "";
|
||||||
|
}
|
||||||
|
|
||||||
|
visible(): boolean {
|
||||||
|
return this.self()?.style.display != "none";
|
||||||
|
}
|
||||||
|
|
||||||
|
setVisible(v: boolean): void {
|
||||||
|
const modal = this.self();
|
||||||
|
if (modal) {
|
||||||
|
modal.style.display = v ? "block" : "none";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setState(state: OverlayType, args: any): void {
|
||||||
|
const _this = this;
|
||||||
|
switch (state) {
|
||||||
|
case OverlayType.POINT:
|
||||||
|
const title = this.title()
|
||||||
|
if (title) {
|
||||||
|
title.innerHTML = "Add Marker";
|
||||||
|
}
|
||||||
|
fetch("/static/pointModal.html")
|
||||||
|
.then(r=>r.text())
|
||||||
|
.then(t=> {
|
||||||
|
const content = _this.content();
|
||||||
|
if (content) { content.innerHTML = t; }
|
||||||
|
const submitBtn = _this.submitBtn();
|
||||||
|
if (submitBtn) {
|
||||||
|
submitBtn.onclick = () => {
|
||||||
|
const name = _this.nameField();
|
||||||
|
const desc = _this.descField();
|
||||||
|
const point = new Marker(name, desc, args.latlng, {title: name, alt: name});
|
||||||
|
point.add(args.map);
|
||||||
|
args.overlays.markers.push(point);
|
||||||
|
_this.setVisible(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
break;
|
||||||
|
case OverlayType.CIRCLE:
|
||||||
|
break;
|
||||||
|
case OverlayType.POLYGON:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}class MapHandlers {
|
||||||
|
|
||||||
|
}
|
||||||
|
function init(): void {
|
||||||
|
let overlays: OverlayState = OverlayState.load() ?? new OverlayState();
|
||||||
|
const map = L.map('map').setView([35.6653, -105.9507], 13);
|
||||||
|
|
||||||
|
const streetLayer = TileLayerWrapper.constructLayer(
|
||||||
|
"streetLayer",
|
||||||
|
L.tileLayer(
|
||||||
|
'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
||||||
|
{
|
||||||
|
maxZoom: 19,
|
||||||
|
attribution: '© OpenStreetMap'
|
||||||
|
}));
|
||||||
|
|
||||||
|
const satelliteLayer = TileLayerWrapper.constructLayer(
|
||||||
|
"satelliteLayer",
|
||||||
|
L.tileLayer(
|
||||||
|
'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',
|
||||||
|
{
|
||||||
|
maxZoom: 19,
|
||||||
|
attribution: "© Esri"
|
||||||
|
}));
|
||||||
|
|
||||||
|
TileLayerWrapper.enableOnly(streetLayer, map);
|
||||||
|
|
||||||
|
overlays.markers.forEach(m=>m.add(map));
|
||||||
|
overlays.circles.forEach(m=>m.add(map));
|
||||||
|
overlays.polygons.forEach(m=>m.add(map));
|
||||||
|
|
||||||
|
const modal = new Modal();
|
||||||
|
|
||||||
|
const addMarkerHandler = (e: any) => {
|
||||||
|
modal.setVisible(true);
|
||||||
|
modal.setState(OverlayType.POINT, {
|
||||||
|
latlng: e.latlng,
|
||||||
|
map: map,
|
||||||
|
overlays: overlays,
|
||||||
|
});
|
||||||
|
map.off("click", addMarkerHandler);
|
||||||
|
}
|
||||||
|
|
||||||
|
const addMarkerBtn = document.getElementById("addPoint-btn");
|
||||||
|
if (addMarkerBtn) {
|
||||||
|
addMarkerBtn.onclick = (e: any)=>{
|
||||||
|
try{
|
||||||
|
map.off("click", addMarkerHandler);
|
||||||
|
} finally {
|
||||||
|
map.on("click", addMarkerHandler);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const saveBtn = document.getElementById("save-btn");
|
||||||
|
if (saveBtn) {
|
||||||
|
saveBtn.onclick = (e: any) => {
|
||||||
|
OverlayState.save(overlays);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const clearBtn = document.getElementById("clear-btn");
|
||||||
|
if (clearBtn) {
|
||||||
|
clearBtn.onclick = (e: any) => {
|
||||||
|
overlays = OverlayState.clear(overlays, map);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const tilesBtn = document.getElementById("tiles-btn");
|
||||||
|
if (tilesBtn) {
|
||||||
|
tilesBtn.onclick = (e: any) => {
|
||||||
|
if (TileLayerWrapper.getActiveLayer() == satelliteLayer) {
|
||||||
|
TileLayerWrapper.enableOnly(streetLayer, map);
|
||||||
|
} else {
|
||||||
|
TileLayerWrapper.enableOnly(satelliteLayer, map);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
init();
|
41
src/package-lock.json
generated
Normal file
41
src/package-lock.json
generated
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
{
|
||||||
|
"name": "src",
|
||||||
|
"lockfileVersion": 2,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {
|
||||||
|
"": {
|
||||||
|
"dependencies": {
|
||||||
|
"@types/geojson": "^7946.0.10",
|
||||||
|
"@types/leaflet": "^1.7.11"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@types/geojson": {
|
||||||
|
"version": "7946.0.10",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.10.tgz",
|
||||||
|
"integrity": "sha512-Nmh0K3iWQJzniTuPRcJn5hxXkfB1T1pgB89SBig5PlJQU5yocazeu4jATJlaA0GYFKWMqDdvYemoSnF2pXgLVA=="
|
||||||
|
},
|
||||||
|
"node_modules/@types/leaflet": {
|
||||||
|
"version": "1.7.11",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/leaflet/-/leaflet-1.7.11.tgz",
|
||||||
|
"integrity": "sha512-VwAYom2pfIAf/pLj1VR5aLltd4tOtHyvfaJlNYCoejzP2nu52PrMi1ehsLRMUS+bgafmIIKBV1cMfKeS+uJ0Vg==",
|
||||||
|
"dependencies": {
|
||||||
|
"@types/geojson": "*"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@types/geojson": {
|
||||||
|
"version": "7946.0.10",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.10.tgz",
|
||||||
|
"integrity": "sha512-Nmh0K3iWQJzniTuPRcJn5hxXkfB1T1pgB89SBig5PlJQU5yocazeu4jATJlaA0GYFKWMqDdvYemoSnF2pXgLVA=="
|
||||||
|
},
|
||||||
|
"@types/leaflet": {
|
||||||
|
"version": "1.7.11",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/leaflet/-/leaflet-1.7.11.tgz",
|
||||||
|
"integrity": "sha512-VwAYom2pfIAf/pLj1VR5aLltd4tOtHyvfaJlNYCoejzP2nu52PrMi1ehsLRMUS+bgafmIIKBV1cMfKeS+uJ0Vg==",
|
||||||
|
"requires": {
|
||||||
|
"@types/geojson": "*"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
6
src/package.json
Normal file
6
src/package.json
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"dependencies": {
|
||||||
|
"@types/geojson": "^7946.0.10",
|
||||||
|
"@types/leaflet": "^1.7.11"
|
||||||
|
}
|
||||||
|
}
|
BIN
static/images/layers-2x.png
Normal file
BIN
static/images/layers-2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
static/images/layers.png
Normal file
BIN
static/images/layers.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 696 B |
BIN
static/images/marker-icon-2x.png
Normal file
BIN
static/images/marker-icon-2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
BIN
static/images/marker-icon.png
Normal file
BIN
static/images/marker-icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
BIN
static/images/marker-shadow.png
Normal file
BIN
static/images/marker-shadow.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 618 B |
657
static/leaflet.css
Normal file
657
static/leaflet.css
Normal file
|
@ -0,0 +1,657 @@
|
||||||
|
/* required styles */
|
||||||
|
|
||||||
|
.leaflet-pane,
|
||||||
|
.leaflet-tile,
|
||||||
|
.leaflet-marker-icon,
|
||||||
|
.leaflet-marker-shadow,
|
||||||
|
.leaflet-tile-container,
|
||||||
|
.leaflet-pane > svg,
|
||||||
|
.leaflet-pane > canvas,
|
||||||
|
.leaflet-zoom-box,
|
||||||
|
.leaflet-image-layer,
|
||||||
|
.leaflet-layer {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
.leaflet-container {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.leaflet-tile,
|
||||||
|
.leaflet-marker-icon,
|
||||||
|
.leaflet-marker-shadow {
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
-webkit-user-drag: none;
|
||||||
|
}
|
||||||
|
/* Prevents IE11 from highlighting tiles in blue */
|
||||||
|
.leaflet-tile::selection {
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
/* Safari renders non-retina tile on retina better with this, but Chrome is worse */
|
||||||
|
.leaflet-safari .leaflet-tile {
|
||||||
|
image-rendering: -webkit-optimize-contrast;
|
||||||
|
}
|
||||||
|
/* hack that prevents hw layers "stretching" when loading new tiles */
|
||||||
|
.leaflet-safari .leaflet-tile-container {
|
||||||
|
width: 1600px;
|
||||||
|
height: 1600px;
|
||||||
|
-webkit-transform-origin: 0 0;
|
||||||
|
}
|
||||||
|
.leaflet-marker-icon,
|
||||||
|
.leaflet-marker-shadow {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
/* .leaflet-container svg: reset svg max-width decleration shipped in Joomla! (joomla.org) 3.x */
|
||||||
|
/* .leaflet-container img: map is broken in FF if you have max-width: 100% on tiles */
|
||||||
|
.leaflet-container .leaflet-overlay-pane svg {
|
||||||
|
max-width: none !important;
|
||||||
|
max-height: none !important;
|
||||||
|
}
|
||||||
|
.leaflet-container .leaflet-marker-pane img,
|
||||||
|
.leaflet-container .leaflet-shadow-pane img,
|
||||||
|
.leaflet-container .leaflet-tile-pane img,
|
||||||
|
.leaflet-container img.leaflet-image-layer,
|
||||||
|
.leaflet-container .leaflet-tile {
|
||||||
|
max-width: none !important;
|
||||||
|
max-height: none !important;
|
||||||
|
width: auto;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.leaflet-container.leaflet-touch-zoom {
|
||||||
|
-ms-touch-action: pan-x pan-y;
|
||||||
|
touch-action: pan-x pan-y;
|
||||||
|
}
|
||||||
|
.leaflet-container.leaflet-touch-drag {
|
||||||
|
-ms-touch-action: pinch-zoom;
|
||||||
|
/* Fallback for FF which doesn't support pinch-zoom */
|
||||||
|
touch-action: none;
|
||||||
|
touch-action: pinch-zoom;
|
||||||
|
}
|
||||||
|
.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom {
|
||||||
|
-ms-touch-action: none;
|
||||||
|
touch-action: none;
|
||||||
|
}
|
||||||
|
.leaflet-container {
|
||||||
|
-webkit-tap-highlight-color: transparent;
|
||||||
|
}
|
||||||
|
.leaflet-container a {
|
||||||
|
-webkit-tap-highlight-color: rgba(51, 181, 229, 0.4);
|
||||||
|
}
|
||||||
|
.leaflet-tile {
|
||||||
|
filter: inherit;
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
.leaflet-tile-loaded {
|
||||||
|
visibility: inherit;
|
||||||
|
}
|
||||||
|
.leaflet-zoom-box {
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
|
-moz-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
|
z-index: 800;
|
||||||
|
}
|
||||||
|
/* workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=888319 */
|
||||||
|
.leaflet-overlay-pane svg {
|
||||||
|
-moz-user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.leaflet-pane { z-index: 400; }
|
||||||
|
|
||||||
|
.leaflet-tile-pane { z-index: 200; }
|
||||||
|
.leaflet-overlay-pane { z-index: 400; }
|
||||||
|
.leaflet-shadow-pane { z-index: 500; }
|
||||||
|
.leaflet-marker-pane { z-index: 600; }
|
||||||
|
.leaflet-tooltip-pane { z-index: 650; }
|
||||||
|
.leaflet-popup-pane { z-index: 700; }
|
||||||
|
|
||||||
|
.leaflet-map-pane canvas { z-index: 100; }
|
||||||
|
.leaflet-map-pane svg { z-index: 200; }
|
||||||
|
|
||||||
|
.leaflet-vml-shape {
|
||||||
|
width: 1px;
|
||||||
|
height: 1px;
|
||||||
|
}
|
||||||
|
.lvml {
|
||||||
|
behavior: url(#default#VML);
|
||||||
|
display: inline-block;
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* control positioning */
|
||||||
|
|
||||||
|
.leaflet-control {
|
||||||
|
position: relative;
|
||||||
|
z-index: 800;
|
||||||
|
pointer-events: visiblePainted; /* IE 9-10 doesn't have auto */
|
||||||
|
pointer-events: auto;
|
||||||
|
}
|
||||||
|
.leaflet-top,
|
||||||
|
.leaflet-bottom {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 1000;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
.leaflet-top {
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
.leaflet-right {
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
.leaflet-bottom {
|
||||||
|
bottom: 0;
|
||||||
|
}
|
||||||
|
.leaflet-left {
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
.leaflet-control {
|
||||||
|
float: left;
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
.leaflet-right .leaflet-control {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
.leaflet-top .leaflet-control {
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
.leaflet-bottom .leaflet-control {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
.leaflet-left .leaflet-control {
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
.leaflet-right .leaflet-control {
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* zoom and fade animations */
|
||||||
|
|
||||||
|
.leaflet-fade-anim .leaflet-popup {
|
||||||
|
opacity: 0;
|
||||||
|
-webkit-transition: opacity 0.2s linear;
|
||||||
|
-moz-transition: opacity 0.2s linear;
|
||||||
|
transition: opacity 0.2s linear;
|
||||||
|
}
|
||||||
|
.leaflet-fade-anim .leaflet-map-pane .leaflet-popup {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
.leaflet-zoom-animated {
|
||||||
|
-webkit-transform-origin: 0 0;
|
||||||
|
-ms-transform-origin: 0 0;
|
||||||
|
transform-origin: 0 0;
|
||||||
|
}
|
||||||
|
svg.leaflet-zoom-animated {
|
||||||
|
will-change: transform;
|
||||||
|
}
|
||||||
|
|
||||||
|
.leaflet-zoom-anim .leaflet-zoom-animated {
|
||||||
|
-webkit-transition: -webkit-transform 0.25s cubic-bezier(0,0,0.25,1);
|
||||||
|
-moz-transition: -moz-transform 0.25s cubic-bezier(0,0,0.25,1);
|
||||||
|
transition: transform 0.25s cubic-bezier(0,0,0.25,1);
|
||||||
|
}
|
||||||
|
.leaflet-zoom-anim .leaflet-tile,
|
||||||
|
.leaflet-pan-anim .leaflet-tile {
|
||||||
|
-webkit-transition: none;
|
||||||
|
-moz-transition: none;
|
||||||
|
transition: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.leaflet-zoom-anim .leaflet-zoom-hide {
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* cursors */
|
||||||
|
|
||||||
|
.leaflet-interactive {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.leaflet-grab {
|
||||||
|
cursor: -webkit-grab;
|
||||||
|
cursor: -moz-grab;
|
||||||
|
cursor: grab;
|
||||||
|
}
|
||||||
|
.leaflet-crosshair,
|
||||||
|
.leaflet-crosshair .leaflet-interactive {
|
||||||
|
cursor: crosshair;
|
||||||
|
}
|
||||||
|
.leaflet-popup-pane,
|
||||||
|
.leaflet-control {
|
||||||
|
cursor: auto;
|
||||||
|
}
|
||||||
|
.leaflet-dragging .leaflet-grab,
|
||||||
|
.leaflet-dragging .leaflet-grab .leaflet-interactive,
|
||||||
|
.leaflet-dragging .leaflet-marker-draggable {
|
||||||
|
cursor: move;
|
||||||
|
cursor: -webkit-grabbing;
|
||||||
|
cursor: -moz-grabbing;
|
||||||
|
cursor: grabbing;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* marker & overlays interactivity */
|
||||||
|
.leaflet-marker-icon,
|
||||||
|
.leaflet-marker-shadow,
|
||||||
|
.leaflet-image-layer,
|
||||||
|
.leaflet-pane > svg path,
|
||||||
|
.leaflet-tile-container {
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.leaflet-marker-icon.leaflet-interactive,
|
||||||
|
.leaflet-image-layer.leaflet-interactive,
|
||||||
|
.leaflet-pane > svg path.leaflet-interactive,
|
||||||
|
svg.leaflet-image-layer.leaflet-interactive path {
|
||||||
|
pointer-events: visiblePainted; /* IE 9-10 doesn't have auto */
|
||||||
|
pointer-events: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* visual tweaks */
|
||||||
|
|
||||||
|
.leaflet-container {
|
||||||
|
background: #ddd;
|
||||||
|
outline-offset: 1px;
|
||||||
|
}
|
||||||
|
.leaflet-container a {
|
||||||
|
color: #0078A8;
|
||||||
|
}
|
||||||
|
.leaflet-zoom-box {
|
||||||
|
border: 2px dotted #38f;
|
||||||
|
background: rgba(255,255,255,0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* general typography */
|
||||||
|
.leaflet-container {
|
||||||
|
font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 12px;
|
||||||
|
font-size: 0.75rem;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* general toolbar styles */
|
||||||
|
|
||||||
|
.leaflet-bar {
|
||||||
|
box-shadow: 0 1px 5px rgba(0,0,0,0.65);
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
.leaflet-bar a {
|
||||||
|
background-color: #fff;
|
||||||
|
border-bottom: 1px solid #ccc;
|
||||||
|
width: 26px;
|
||||||
|
height: 26px;
|
||||||
|
line-height: 26px;
|
||||||
|
display: block;
|
||||||
|
text-align: center;
|
||||||
|
text-decoration: none;
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
.leaflet-bar a,
|
||||||
|
.leaflet-control-layers-toggle {
|
||||||
|
background-position: 50% 50%;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.leaflet-bar a:hover,
|
||||||
|
.leaflet-bar a:focus {
|
||||||
|
background-color: #f4f4f4;
|
||||||
|
}
|
||||||
|
.leaflet-bar a:first-child {
|
||||||
|
border-top-left-radius: 4px;
|
||||||
|
border-top-right-radius: 4px;
|
||||||
|
}
|
||||||
|
.leaflet-bar a:last-child {
|
||||||
|
border-bottom-left-radius: 4px;
|
||||||
|
border-bottom-right-radius: 4px;
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
.leaflet-bar a.leaflet-disabled {
|
||||||
|
cursor: default;
|
||||||
|
background-color: #f4f4f4;
|
||||||
|
color: #bbb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.leaflet-touch .leaflet-bar a {
|
||||||
|
width: 30px;
|
||||||
|
height: 30px;
|
||||||
|
line-height: 30px;
|
||||||
|
}
|
||||||
|
.leaflet-touch .leaflet-bar a:first-child {
|
||||||
|
border-top-left-radius: 2px;
|
||||||
|
border-top-right-radius: 2px;
|
||||||
|
}
|
||||||
|
.leaflet-touch .leaflet-bar a:last-child {
|
||||||
|
border-bottom-left-radius: 2px;
|
||||||
|
border-bottom-right-radius: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* zoom control */
|
||||||
|
|
||||||
|
.leaflet-control-zoom-in,
|
||||||
|
.leaflet-control-zoom-out {
|
||||||
|
font: bold 18px 'Lucida Console', Monaco, monospace;
|
||||||
|
text-indent: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.leaflet-touch .leaflet-control-zoom-in, .leaflet-touch .leaflet-control-zoom-out {
|
||||||
|
font-size: 22px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* layers control */
|
||||||
|
|
||||||
|
.leaflet-control-layers {
|
||||||
|
box-shadow: 0 1px 5px rgba(0,0,0,0.4);
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
.leaflet-control-layers-toggle {
|
||||||
|
background-image: url(images/layers.png);
|
||||||
|
width: 36px;
|
||||||
|
height: 36px;
|
||||||
|
}
|
||||||
|
.leaflet-retina .leaflet-control-layers-toggle {
|
||||||
|
background-image: url(images/layers-2x.png);
|
||||||
|
background-size: 26px 26px;
|
||||||
|
}
|
||||||
|
.leaflet-touch .leaflet-control-layers-toggle {
|
||||||
|
width: 44px;
|
||||||
|
height: 44px;
|
||||||
|
}
|
||||||
|
.leaflet-control-layers .leaflet-control-layers-list,
|
||||||
|
.leaflet-control-layers-expanded .leaflet-control-layers-toggle {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.leaflet-control-layers-expanded .leaflet-control-layers-list {
|
||||||
|
display: block;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.leaflet-control-layers-expanded {
|
||||||
|
padding: 6px 10px 6px 6px;
|
||||||
|
color: #333;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
.leaflet-control-layers-scrollbar {
|
||||||
|
overflow-y: scroll;
|
||||||
|
overflow-x: hidden;
|
||||||
|
padding-right: 5px;
|
||||||
|
}
|
||||||
|
.leaflet-control-layers-selector {
|
||||||
|
margin-top: 2px;
|
||||||
|
position: relative;
|
||||||
|
top: 1px;
|
||||||
|
}
|
||||||
|
.leaflet-control-layers label {
|
||||||
|
display: block;
|
||||||
|
font-size: 13px;
|
||||||
|
font-size: 1.08333em;
|
||||||
|
}
|
||||||
|
.leaflet-control-layers-separator {
|
||||||
|
height: 0;
|
||||||
|
border-top: 1px solid #ddd;
|
||||||
|
margin: 5px -10px 5px -6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Default icon URLs */
|
||||||
|
.leaflet-default-icon-path { /* used only in path-guessing heuristic, see L.Icon.Default */
|
||||||
|
background-image: url(images/marker-icon.png);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* attribution and scale controls */
|
||||||
|
|
||||||
|
.leaflet-container .leaflet-control-attribution {
|
||||||
|
background: #fff;
|
||||||
|
background: rgba(255, 255, 255, 0.8);
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.leaflet-control-attribution,
|
||||||
|
.leaflet-control-scale-line {
|
||||||
|
padding: 0 5px;
|
||||||
|
color: #333;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
.leaflet-control-attribution a {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
.leaflet-control-attribution a:hover,
|
||||||
|
.leaflet-control-attribution a:focus {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
.leaflet-control-attribution svg {
|
||||||
|
display: inline !important;
|
||||||
|
}
|
||||||
|
.leaflet-left .leaflet-control-scale {
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
.leaflet-bottom .leaflet-control-scale {
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
.leaflet-control-scale-line {
|
||||||
|
border: 2px solid #777;
|
||||||
|
border-top: none;
|
||||||
|
line-height: 1.1;
|
||||||
|
padding: 2px 5px 1px;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
-moz-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
|
background: #fff;
|
||||||
|
background: rgba(255, 255, 255, 0.5);
|
||||||
|
}
|
||||||
|
.leaflet-control-scale-line:not(:first-child) {
|
||||||
|
border-top: 2px solid #777;
|
||||||
|
border-bottom: none;
|
||||||
|
margin-top: -2px;
|
||||||
|
}
|
||||||
|
.leaflet-control-scale-line:not(:first-child):not(:last-child) {
|
||||||
|
border-bottom: 2px solid #777;
|
||||||
|
}
|
||||||
|
|
||||||
|
.leaflet-touch .leaflet-control-attribution,
|
||||||
|
.leaflet-touch .leaflet-control-layers,
|
||||||
|
.leaflet-touch .leaflet-bar {
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
.leaflet-touch .leaflet-control-layers,
|
||||||
|
.leaflet-touch .leaflet-bar {
|
||||||
|
border: 2px solid rgba(0,0,0,0.2);
|
||||||
|
background-clip: padding-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* popup */
|
||||||
|
|
||||||
|
.leaflet-popup {
|
||||||
|
position: absolute;
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
.leaflet-popup-content-wrapper {
|
||||||
|
padding: 1px;
|
||||||
|
text-align: left;
|
||||||
|
border-radius: 12px;
|
||||||
|
}
|
||||||
|
.leaflet-popup-content {
|
||||||
|
margin: 13px 24px 13px 20px;
|
||||||
|
line-height: 1.3;
|
||||||
|
font-size: 13px;
|
||||||
|
font-size: 1.08333em;
|
||||||
|
min-height: 1px;
|
||||||
|
}
|
||||||
|
.leaflet-popup-content p {
|
||||||
|
margin: 17px 0;
|
||||||
|
margin: 1.3em 0;
|
||||||
|
}
|
||||||
|
.leaflet-popup-tip-container {
|
||||||
|
width: 40px;
|
||||||
|
height: 20px;
|
||||||
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
|
margin-top: -1px;
|
||||||
|
margin-left: -20px;
|
||||||
|
overflow: hidden;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
.leaflet-popup-tip {
|
||||||
|
width: 17px;
|
||||||
|
height: 17px;
|
||||||
|
padding: 1px;
|
||||||
|
|
||||||
|
margin: -10px auto 0;
|
||||||
|
pointer-events: auto;
|
||||||
|
|
||||||
|
-webkit-transform: rotate(45deg);
|
||||||
|
-moz-transform: rotate(45deg);
|
||||||
|
-ms-transform: rotate(45deg);
|
||||||
|
transform: rotate(45deg);
|
||||||
|
}
|
||||||
|
.leaflet-popup-content-wrapper,
|
||||||
|
.leaflet-popup-tip {
|
||||||
|
background: white;
|
||||||
|
color: #333;
|
||||||
|
box-shadow: 0 3px 14px rgba(0,0,0,0.4);
|
||||||
|
}
|
||||||
|
.leaflet-container a.leaflet-popup-close-button {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
border: none;
|
||||||
|
text-align: center;
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
font: 16px/24px Tahoma, Verdana, sans-serif;
|
||||||
|
color: #757575;
|
||||||
|
text-decoration: none;
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
.leaflet-container a.leaflet-popup-close-button:hover,
|
||||||
|
.leaflet-container a.leaflet-popup-close-button:focus {
|
||||||
|
color: #585858;
|
||||||
|
}
|
||||||
|
.leaflet-popup-scrolled {
|
||||||
|
overflow: auto;
|
||||||
|
border-bottom: 1px solid #ddd;
|
||||||
|
border-top: 1px solid #ddd;
|
||||||
|
}
|
||||||
|
|
||||||
|
.leaflet-oldie .leaflet-popup-content-wrapper {
|
||||||
|
-ms-zoom: 1;
|
||||||
|
}
|
||||||
|
.leaflet-oldie .leaflet-popup-tip {
|
||||||
|
width: 24px;
|
||||||
|
margin: 0 auto;
|
||||||
|
|
||||||
|
-ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)";
|
||||||
|
filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678);
|
||||||
|
}
|
||||||
|
|
||||||
|
.leaflet-oldie .leaflet-control-zoom,
|
||||||
|
.leaflet-oldie .leaflet-control-layers,
|
||||||
|
.leaflet-oldie .leaflet-popup-content-wrapper,
|
||||||
|
.leaflet-oldie .leaflet-popup-tip {
|
||||||
|
border: 1px solid #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* div icon */
|
||||||
|
|
||||||
|
.leaflet-div-icon {
|
||||||
|
background: #fff;
|
||||||
|
border: 1px solid #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Tooltip */
|
||||||
|
/* Base styles for the element that has a tooltip */
|
||||||
|
.leaflet-tooltip {
|
||||||
|
position: absolute;
|
||||||
|
padding: 6px;
|
||||||
|
background-color: #fff;
|
||||||
|
border: 1px solid #fff;
|
||||||
|
border-radius: 3px;
|
||||||
|
color: #222;
|
||||||
|
white-space: nowrap;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
-ms-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
pointer-events: none;
|
||||||
|
box-shadow: 0 1px 3px rgba(0,0,0,0.4);
|
||||||
|
}
|
||||||
|
.leaflet-tooltip.leaflet-interactive {
|
||||||
|
cursor: pointer;
|
||||||
|
pointer-events: auto;
|
||||||
|
}
|
||||||
|
.leaflet-tooltip-top:before,
|
||||||
|
.leaflet-tooltip-bottom:before,
|
||||||
|
.leaflet-tooltip-left:before,
|
||||||
|
.leaflet-tooltip-right:before {
|
||||||
|
position: absolute;
|
||||||
|
pointer-events: none;
|
||||||
|
border: 6px solid transparent;
|
||||||
|
background: transparent;
|
||||||
|
content: "";
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Directions */
|
||||||
|
|
||||||
|
.leaflet-tooltip-bottom {
|
||||||
|
margin-top: 6px;
|
||||||
|
}
|
||||||
|
.leaflet-tooltip-top {
|
||||||
|
margin-top: -6px;
|
||||||
|
}
|
||||||
|
.leaflet-tooltip-bottom:before,
|
||||||
|
.leaflet-tooltip-top:before {
|
||||||
|
left: 50%;
|
||||||
|
margin-left: -6px;
|
||||||
|
}
|
||||||
|
.leaflet-tooltip-top:before {
|
||||||
|
bottom: 0;
|
||||||
|
margin-bottom: -12px;
|
||||||
|
border-top-color: #fff;
|
||||||
|
}
|
||||||
|
.leaflet-tooltip-bottom:before {
|
||||||
|
top: 0;
|
||||||
|
margin-top: -12px;
|
||||||
|
margin-left: -6px;
|
||||||
|
border-bottom-color: #fff;
|
||||||
|
}
|
||||||
|
.leaflet-tooltip-left {
|
||||||
|
margin-left: -6px;
|
||||||
|
}
|
||||||
|
.leaflet-tooltip-right {
|
||||||
|
margin-left: 6px;
|
||||||
|
}
|
||||||
|
.leaflet-tooltip-left:before,
|
||||||
|
.leaflet-tooltip-right:before {
|
||||||
|
top: 50%;
|
||||||
|
margin-top: -6px;
|
||||||
|
}
|
||||||
|
.leaflet-tooltip-left:before {
|
||||||
|
right: 0;
|
||||||
|
margin-right: -12px;
|
||||||
|
border-left-color: #fff;
|
||||||
|
}
|
||||||
|
.leaflet-tooltip-right:before {
|
||||||
|
left: 0;
|
||||||
|
margin-left: -12px;
|
||||||
|
border-right-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Printing */
|
||||||
|
|
||||||
|
@media print {
|
||||||
|
/* Prevent printers from removing background-images of controls. */
|
||||||
|
.leaflet-control {
|
||||||
|
-webkit-print-color-adjust: exact;
|
||||||
|
color-adjust: exact;
|
||||||
|
}
|
||||||
|
}
|
6
static/leaflet.js
Normal file
6
static/leaflet.js
Normal file
File diff suppressed because one or more lines are too long
312
static/onyx-scry.js
Normal file
312
static/onyx-scry.js
Normal file
|
@ -0,0 +1,312 @@
|
||||||
|
"use strict";
|
||||||
|
var __extends = (this && this.__extends) || (function () {
|
||||||
|
var extendStatics = function (d, b) {
|
||||||
|
extendStatics = Object.setPrototypeOf ||
|
||||||
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||||
|
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||||
|
return extendStatics(d, b);
|
||||||
|
};
|
||||||
|
return function (d, b) {
|
||||||
|
extendStatics(d, b);
|
||||||
|
function __() { this.constructor = d; }
|
||||||
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
var Point = /** @class */ (function () {
|
||||||
|
function Point() {
|
||||||
|
this.lat = 0.00;
|
||||||
|
this.lng = 0.00;
|
||||||
|
}
|
||||||
|
return Point;
|
||||||
|
}());
|
||||||
|
var OverlayType;
|
||||||
|
(function (OverlayType) {
|
||||||
|
OverlayType[OverlayType["POINT"] = 0] = "POINT";
|
||||||
|
OverlayType[OverlayType["CIRCLE"] = 1] = "CIRCLE";
|
||||||
|
OverlayType[OverlayType["POLYGON"] = 2] = "POLYGON";
|
||||||
|
})(OverlayType || (OverlayType = {}));
|
||||||
|
var OverlayData = /** @class */ (function () {
|
||||||
|
function OverlayData(type, name, desc, points, options) {
|
||||||
|
this.type = type;
|
||||||
|
this.name = name;
|
||||||
|
this.desc = desc;
|
||||||
|
this.points = points;
|
||||||
|
this.options = options;
|
||||||
|
}
|
||||||
|
return OverlayData;
|
||||||
|
}());
|
||||||
|
var OverlayBase = /** @class */ (function () {
|
||||||
|
function OverlayBase(name, desc, points, options) {
|
||||||
|
this.name = name;
|
||||||
|
this.desc = desc;
|
||||||
|
this.points = points;
|
||||||
|
this.options = options;
|
||||||
|
}
|
||||||
|
OverlayBase.prototype.add = function (map) {
|
||||||
|
this.self.addTo(map);
|
||||||
|
};
|
||||||
|
OverlayBase.prototype.remove = function (map) {
|
||||||
|
this.self.removeFrom(map);
|
||||||
|
};
|
||||||
|
return OverlayBase;
|
||||||
|
}());
|
||||||
|
var Marker = /** @class */ (function (_super) {
|
||||||
|
__extends(Marker, _super);
|
||||||
|
function Marker(name, desc, point, options) {
|
||||||
|
var _this_1 = _super.call(this, name, desc, [point], options) || this;
|
||||||
|
_this_1.self = L.marker(point);
|
||||||
|
_this_1.self.bindPopup("<h3>" + name + "</h3><p>" + desc + "</p>");
|
||||||
|
return _this_1;
|
||||||
|
}
|
||||||
|
return Marker;
|
||||||
|
}(OverlayBase));
|
||||||
|
var Circle = /** @class */ (function (_super) {
|
||||||
|
__extends(Circle, _super);
|
||||||
|
function Circle(name, desc, point, options) {
|
||||||
|
var _this_1 = _super.call(this, name, desc, [point], options) || this;
|
||||||
|
_this_1.self = L.circle(point, options);
|
||||||
|
return _this_1;
|
||||||
|
}
|
||||||
|
return Circle;
|
||||||
|
}(OverlayBase));
|
||||||
|
var Polygon = /** @class */ (function (_super) {
|
||||||
|
__extends(Polygon, _super);
|
||||||
|
function Polygon(name, desc, points, options) {
|
||||||
|
var _this_1 = _super.call(this, name, desc, points, options) || this;
|
||||||
|
_this_1.self = L.polygon(points, options);
|
||||||
|
return _this_1;
|
||||||
|
}
|
||||||
|
return Polygon;
|
||||||
|
}(OverlayBase));
|
||||||
|
var OverlayState = /** @class */ (function () {
|
||||||
|
function OverlayState() {
|
||||||
|
this.markers = [];
|
||||||
|
this.circles = [];
|
||||||
|
this.polygons = [];
|
||||||
|
}
|
||||||
|
OverlayState.load = function () {
|
||||||
|
var store = localStorage.getItem("overlay_state");
|
||||||
|
if (store) {
|
||||||
|
var model = JSON.parse(store);
|
||||||
|
return {
|
||||||
|
markers: model.markers.map(function (m) { return OverlayState.fromData(m); }),
|
||||||
|
circles: model.circles.map(function (c) { return OverlayState.fromData(c); }),
|
||||||
|
polygons: model.polygons.map(function (p) { return OverlayState.fromData(p); })
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return new OverlayState();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
OverlayState.save = function (overlayState) {
|
||||||
|
localStorage.setItem("overlay_state", JSON.stringify({
|
||||||
|
markers: overlayState.markers.map(function (m) { return OverlayState.toData(m); }),
|
||||||
|
circles: overlayState.circles.map(function (c) { return OverlayState.toData(c); }),
|
||||||
|
polygons: overlayState.polygons.map(function (p) { return OverlayState.toData(p); })
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
OverlayState.clear = function (overlayState, map) {
|
||||||
|
overlayState.markers.forEach(function (m) { return m.remove(map); });
|
||||||
|
overlayState.circles.forEach(function (c) { return c.remove(map); });
|
||||||
|
overlayState.polygons.forEach(function (p) { return p.remove(map); });
|
||||||
|
return new OverlayState();
|
||||||
|
};
|
||||||
|
OverlayState.toData = function (source) {
|
||||||
|
var type = OverlayType.POINT;
|
||||||
|
if (source.points.length > 1) {
|
||||||
|
type = OverlayType.POLYGON;
|
||||||
|
}
|
||||||
|
else if (source.options.radius) {
|
||||||
|
type = OverlayType.CIRCLE;
|
||||||
|
}
|
||||||
|
return new OverlayData(type, source.name, source.desc, source.points, source.options);
|
||||||
|
};
|
||||||
|
OverlayState.fromData = function (data) {
|
||||||
|
switch (data.type) {
|
||||||
|
case OverlayType.POINT:
|
||||||
|
return new Marker(data.name, data.desc, data.points[0], data.options);
|
||||||
|
case OverlayType.CIRCLE:
|
||||||
|
return new Circle(data.name, data.desc, data.points[0], data.options);
|
||||||
|
case OverlayType.POLYGON:
|
||||||
|
return new Polygon(data.name, data.desc, data.points, data.options);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return OverlayState;
|
||||||
|
}());
|
||||||
|
var TileLayerWrapper = /** @class */ (function () {
|
||||||
|
function TileLayerWrapper(name, self) {
|
||||||
|
this.visible = false;
|
||||||
|
this.self = self;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
TileLayerWrapper.constructLayer = function (name, self) {
|
||||||
|
var wrapper = new TileLayerWrapper(name, self);
|
||||||
|
TileLayerWrapper.layers.push(wrapper);
|
||||||
|
return wrapper;
|
||||||
|
};
|
||||||
|
TileLayerWrapper.getActiveLayer = function () {
|
||||||
|
for (var _i = 0, _a = TileLayerWrapper.layers; _i < _a.length; _i++) {
|
||||||
|
var l = _a[_i];
|
||||||
|
if (l.visible == true) {
|
||||||
|
return l;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
TileLayerWrapper.enableOnly = function (self, map) {
|
||||||
|
for (var _i = 0, _a = TileLayerWrapper.layers; _i < _a.length; _i++) {
|
||||||
|
var l = _a[_i];
|
||||||
|
if (l.visible) {
|
||||||
|
l.self.removeFrom(map);
|
||||||
|
l.visible = false;
|
||||||
|
}
|
||||||
|
if (l.name == self.name) {
|
||||||
|
l.self.addTo(map);
|
||||||
|
l.visible = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
TileLayerWrapper.layers = new Array();
|
||||||
|
return TileLayerWrapper;
|
||||||
|
}());
|
||||||
|
var Modal = /** @class */ (function () {
|
||||||
|
function Modal() {
|
||||||
|
var _this = this;
|
||||||
|
var closeBtn = document.getElementById("modalCloseBtn");
|
||||||
|
if (closeBtn) {
|
||||||
|
closeBtn.onclick = function () { _this.setVisible(false); };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Modal.prototype.self = function () {
|
||||||
|
return document.getElementById("modal-container");
|
||||||
|
};
|
||||||
|
Modal.prototype.title = function () {
|
||||||
|
return document.getElementById("modal-title");
|
||||||
|
};
|
||||||
|
Modal.prototype.content = function () {
|
||||||
|
return document.getElementById("modal-content");
|
||||||
|
};
|
||||||
|
Modal.prototype.submitBtn = function () {
|
||||||
|
return document.getElementById("modal-submitBtn");
|
||||||
|
};
|
||||||
|
Modal.prototype.nameField = function () {
|
||||||
|
var _a, _b;
|
||||||
|
return (_b = (_a = document.getElementById("modal-name")) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : "";
|
||||||
|
};
|
||||||
|
Modal.prototype.descField = function () {
|
||||||
|
var _a, _b;
|
||||||
|
return (_b = (_a = document.getElementById("modal-desc")) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : "";
|
||||||
|
};
|
||||||
|
Modal.prototype.visible = function () {
|
||||||
|
var _a;
|
||||||
|
return ((_a = this.self()) === null || _a === void 0 ? void 0 : _a.style.display) != "none";
|
||||||
|
};
|
||||||
|
Modal.prototype.setVisible = function (v) {
|
||||||
|
var modal = this.self();
|
||||||
|
if (modal) {
|
||||||
|
modal.style.display = v ? "block" : "none";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Modal.prototype.setState = function (state, args) {
|
||||||
|
var _this = this;
|
||||||
|
switch (state) {
|
||||||
|
case OverlayType.POINT:
|
||||||
|
var title = this.title();
|
||||||
|
if (title) {
|
||||||
|
title.innerHTML = "Add Marker";
|
||||||
|
}
|
||||||
|
fetch("/static/pointModal.html")
|
||||||
|
.then(function (r) { return r.text(); })
|
||||||
|
.then(function (t) {
|
||||||
|
var content = _this.content();
|
||||||
|
if (content) {
|
||||||
|
content.innerHTML = t;
|
||||||
|
}
|
||||||
|
var submitBtn = _this.submitBtn();
|
||||||
|
if (submitBtn) {
|
||||||
|
submitBtn.onclick = function () {
|
||||||
|
var name = _this.nameField();
|
||||||
|
var desc = _this.descField();
|
||||||
|
var point = new Marker(name, desc, args.latlng, { title: name, alt: name });
|
||||||
|
point.add(args.map);
|
||||||
|
args.overlays.markers.push(point);
|
||||||
|
_this.setVisible(false);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case OverlayType.CIRCLE:
|
||||||
|
break;
|
||||||
|
case OverlayType.POLYGON:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return Modal;
|
||||||
|
}());
|
||||||
|
var MapHandlers = /** @class */ (function () {
|
||||||
|
function MapHandlers() {
|
||||||
|
}
|
||||||
|
return MapHandlers;
|
||||||
|
}());
|
||||||
|
function init() {
|
||||||
|
var _a;
|
||||||
|
var overlays = (_a = OverlayState.load()) !== null && _a !== void 0 ? _a : new OverlayState();
|
||||||
|
var map = L.map('map').setView([35.6653, -105.9507], 13);
|
||||||
|
var streetLayer = TileLayerWrapper.constructLayer("streetLayer", L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||||
|
maxZoom: 19,
|
||||||
|
attribution: '© OpenStreetMap'
|
||||||
|
}));
|
||||||
|
var satelliteLayer = TileLayerWrapper.constructLayer("satelliteLayer", L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
|
||||||
|
maxZoom: 19,
|
||||||
|
attribution: "© Esri"
|
||||||
|
}));
|
||||||
|
TileLayerWrapper.enableOnly(streetLayer, map);
|
||||||
|
overlays.markers.forEach(function (m) { return m.add(map); });
|
||||||
|
overlays.circles.forEach(function (m) { return m.add(map); });
|
||||||
|
overlays.polygons.forEach(function (m) { return m.add(map); });
|
||||||
|
var modal = new Modal();
|
||||||
|
var addMarkerHandler = function (e) {
|
||||||
|
modal.setVisible(true);
|
||||||
|
modal.setState(OverlayType.POINT, {
|
||||||
|
latlng: e.latlng,
|
||||||
|
map: map,
|
||||||
|
overlays: overlays
|
||||||
|
});
|
||||||
|
map.off("click", addMarkerHandler);
|
||||||
|
};
|
||||||
|
var addMarkerBtn = document.getElementById("addPoint-btn");
|
||||||
|
if (addMarkerBtn) {
|
||||||
|
addMarkerBtn.onclick = function (e) {
|
||||||
|
try {
|
||||||
|
map.off("click", addMarkerHandler);
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
map.on("click", addMarkerHandler);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
var saveBtn = document.getElementById("save-btn");
|
||||||
|
if (saveBtn) {
|
||||||
|
saveBtn.onclick = function (e) {
|
||||||
|
OverlayState.save(overlays);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
var clearBtn = document.getElementById("clear-btn");
|
||||||
|
if (clearBtn) {
|
||||||
|
clearBtn.onclick = function (e) {
|
||||||
|
overlays = OverlayState.clear(overlays, map);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
var tilesBtn = document.getElementById("tiles-btn");
|
||||||
|
if (tilesBtn) {
|
||||||
|
tilesBtn.onclick = function (e) {
|
||||||
|
if (TileLayerWrapper.getActiveLayer() == satelliteLayer) {
|
||||||
|
TileLayerWrapper.enableOnly(streetLayer, map);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
TileLayerWrapper.enableOnly(satelliteLayer, map);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
init();
|
312
static/pendulum.js
Normal file
312
static/pendulum.js
Normal file
|
@ -0,0 +1,312 @@
|
||||||
|
"use strict";
|
||||||
|
var __extends = (this && this.__extends) || (function () {
|
||||||
|
var extendStatics = function (d, b) {
|
||||||
|
extendStatics = Object.setPrototypeOf ||
|
||||||
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||||
|
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||||
|
return extendStatics(d, b);
|
||||||
|
};
|
||||||
|
return function (d, b) {
|
||||||
|
extendStatics(d, b);
|
||||||
|
function __() { this.constructor = d; }
|
||||||
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
var Point = /** @class */ (function () {
|
||||||
|
function Point() {
|
||||||
|
this.lat = 0.00;
|
||||||
|
this.lng = 0.00;
|
||||||
|
}
|
||||||
|
return Point;
|
||||||
|
}());
|
||||||
|
var OverlayType;
|
||||||
|
(function (OverlayType) {
|
||||||
|
OverlayType[OverlayType["POINT"] = 0] = "POINT";
|
||||||
|
OverlayType[OverlayType["CIRCLE"] = 1] = "CIRCLE";
|
||||||
|
OverlayType[OverlayType["POLYGON"] = 2] = "POLYGON";
|
||||||
|
})(OverlayType || (OverlayType = {}));
|
||||||
|
var OverlayData = /** @class */ (function () {
|
||||||
|
function OverlayData(type, name, desc, points, options) {
|
||||||
|
this.type = type;
|
||||||
|
this.name = name;
|
||||||
|
this.desc = desc;
|
||||||
|
this.points = points;
|
||||||
|
this.options = options;
|
||||||
|
}
|
||||||
|
return OverlayData;
|
||||||
|
}());
|
||||||
|
var OverlayBase = /** @class */ (function () {
|
||||||
|
function OverlayBase(name, desc, points, options) {
|
||||||
|
this.name = name;
|
||||||
|
this.desc = desc;
|
||||||
|
this.points = points;
|
||||||
|
this.options = options;
|
||||||
|
}
|
||||||
|
OverlayBase.prototype.add = function (map) {
|
||||||
|
this.self.addTo(map);
|
||||||
|
};
|
||||||
|
OverlayBase.prototype.remove = function (map) {
|
||||||
|
this.self.removeFrom(map);
|
||||||
|
};
|
||||||
|
return OverlayBase;
|
||||||
|
}());
|
||||||
|
var Marker = /** @class */ (function (_super) {
|
||||||
|
__extends(Marker, _super);
|
||||||
|
function Marker(name, desc, point, options) {
|
||||||
|
var _this_1 = _super.call(this, name, desc, [point], options) || this;
|
||||||
|
_this_1.self = L.marker(point);
|
||||||
|
_this_1.self.bindPopup("<h3>" + name + "</h3><p>" + desc + "</p>");
|
||||||
|
return _this_1;
|
||||||
|
}
|
||||||
|
return Marker;
|
||||||
|
}(OverlayBase));
|
||||||
|
var Circle = /** @class */ (function (_super) {
|
||||||
|
__extends(Circle, _super);
|
||||||
|
function Circle(name, desc, point, options) {
|
||||||
|
var _this_1 = _super.call(this, name, desc, [point], options) || this;
|
||||||
|
_this_1.self = L.circle(point, options);
|
||||||
|
return _this_1;
|
||||||
|
}
|
||||||
|
return Circle;
|
||||||
|
}(OverlayBase));
|
||||||
|
var Polygon = /** @class */ (function (_super) {
|
||||||
|
__extends(Polygon, _super);
|
||||||
|
function Polygon(name, desc, points, options) {
|
||||||
|
var _this_1 = _super.call(this, name, desc, points, options) || this;
|
||||||
|
_this_1.self = L.polygon(points, options);
|
||||||
|
return _this_1;
|
||||||
|
}
|
||||||
|
return Polygon;
|
||||||
|
}(OverlayBase));
|
||||||
|
var OverlayState = /** @class */ (function () {
|
||||||
|
function OverlayState() {
|
||||||
|
this.markers = [];
|
||||||
|
this.circles = [];
|
||||||
|
this.polygons = [];
|
||||||
|
}
|
||||||
|
OverlayState.load = function () {
|
||||||
|
var store = localStorage.getItem("overlay_state");
|
||||||
|
if (store) {
|
||||||
|
var model = JSON.parse(store);
|
||||||
|
return {
|
||||||
|
markers: model.markers.map(function (m) { return OverlayState.fromData(m); }),
|
||||||
|
circles: model.circles.map(function (c) { return OverlayState.fromData(c); }),
|
||||||
|
polygons: model.polygons.map(function (p) { return OverlayState.fromData(p); })
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return new OverlayState();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
OverlayState.save = function (overlayState) {
|
||||||
|
localStorage.setItem("overlay_state", JSON.stringify({
|
||||||
|
markers: overlayState.markers.map(function (m) { return OverlayState.toData(m); }),
|
||||||
|
circles: overlayState.circles.map(function (c) { return OverlayState.toData(c); }),
|
||||||
|
polygons: overlayState.polygons.map(function (p) { return OverlayState.toData(p); })
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
OverlayState.clear = function (overlayState, map) {
|
||||||
|
overlayState.markers.forEach(function (m) { return m.remove(map); });
|
||||||
|
overlayState.circles.forEach(function (c) { return c.remove(map); });
|
||||||
|
overlayState.polygons.forEach(function (p) { return p.remove(map); });
|
||||||
|
return new OverlayState();
|
||||||
|
};
|
||||||
|
OverlayState.toData = function (source) {
|
||||||
|
var type = OverlayType.POINT;
|
||||||
|
if (source.points.length > 1) {
|
||||||
|
type = OverlayType.POLYGON;
|
||||||
|
}
|
||||||
|
else if (source.options.radius) {
|
||||||
|
type = OverlayType.CIRCLE;
|
||||||
|
}
|
||||||
|
return new OverlayData(type, source.name, source.desc, source.points, source.options);
|
||||||
|
};
|
||||||
|
OverlayState.fromData = function (data) {
|
||||||
|
switch (data.type) {
|
||||||
|
case OverlayType.POINT:
|
||||||
|
return new Marker(data.name, data.desc, data.points[0], data.options);
|
||||||
|
case OverlayType.CIRCLE:
|
||||||
|
return new Circle(data.name, data.desc, data.points[0], data.options);
|
||||||
|
case OverlayType.POLYGON:
|
||||||
|
return new Polygon(data.name, data.desc, data.points, data.options);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return OverlayState;
|
||||||
|
}());
|
||||||
|
var TileLayerWrapper = /** @class */ (function () {
|
||||||
|
function TileLayerWrapper(name, self) {
|
||||||
|
this.visible = false;
|
||||||
|
this.self = self;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
TileLayerWrapper.constructLayer = function (name, self) {
|
||||||
|
var wrapper = new TileLayerWrapper(name, self);
|
||||||
|
TileLayerWrapper.layers.push(wrapper);
|
||||||
|
return wrapper;
|
||||||
|
};
|
||||||
|
TileLayerWrapper.getActiveLayer = function () {
|
||||||
|
for (var _i = 0, _a = TileLayerWrapper.layers; _i < _a.length; _i++) {
|
||||||
|
var l = _a[_i];
|
||||||
|
if (l.visible == true) {
|
||||||
|
return l;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
TileLayerWrapper.enableOnly = function (self, map) {
|
||||||
|
for (var _i = 0, _a = TileLayerWrapper.layers; _i < _a.length; _i++) {
|
||||||
|
var l = _a[_i];
|
||||||
|
if (l.visible) {
|
||||||
|
l.self.removeFrom(map);
|
||||||
|
l.visible = false;
|
||||||
|
}
|
||||||
|
if (l.name == self.name) {
|
||||||
|
l.self.addTo(map);
|
||||||
|
l.visible = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
TileLayerWrapper.layers = new Array();
|
||||||
|
return TileLayerWrapper;
|
||||||
|
}());
|
||||||
|
var Modal = /** @class */ (function () {
|
||||||
|
function Modal() {
|
||||||
|
var _this = this;
|
||||||
|
var closeBtn = document.getElementById("modalCloseBtn");
|
||||||
|
if (closeBtn) {
|
||||||
|
closeBtn.onclick = function () { _this.setVisible(false); };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Modal.prototype.self = function () {
|
||||||
|
return document.getElementById("modal-container");
|
||||||
|
};
|
||||||
|
Modal.prototype.title = function () {
|
||||||
|
return document.getElementById("modal-title");
|
||||||
|
};
|
||||||
|
Modal.prototype.content = function () {
|
||||||
|
return document.getElementById("modal-content");
|
||||||
|
};
|
||||||
|
Modal.prototype.submitBtn = function () {
|
||||||
|
return document.getElementById("modal-submitBtn");
|
||||||
|
};
|
||||||
|
Modal.prototype.nameField = function () {
|
||||||
|
var _a, _b;
|
||||||
|
return (_b = (_a = document.getElementById("modal-name")) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : "";
|
||||||
|
};
|
||||||
|
Modal.prototype.descField = function () {
|
||||||
|
var _a, _b;
|
||||||
|
return (_b = (_a = document.getElementById("modal-desc")) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : "";
|
||||||
|
};
|
||||||
|
Modal.prototype.visible = function () {
|
||||||
|
var _a;
|
||||||
|
return ((_a = this.self()) === null || _a === void 0 ? void 0 : _a.style.display) != "none";
|
||||||
|
};
|
||||||
|
Modal.prototype.setVisible = function (v) {
|
||||||
|
var modal = this.self();
|
||||||
|
if (modal) {
|
||||||
|
modal.style.display = v ? "block" : "none";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Modal.prototype.setState = function (state, args) {
|
||||||
|
var _this = this;
|
||||||
|
switch (state) {
|
||||||
|
case OverlayType.POINT:
|
||||||
|
var title = this.title();
|
||||||
|
if (title) {
|
||||||
|
title.innerHTML = "Add Marker";
|
||||||
|
}
|
||||||
|
fetch("/static/pointModal.html")
|
||||||
|
.then(function (r) { return r.text(); })
|
||||||
|
.then(function (t) {
|
||||||
|
var content = _this.content();
|
||||||
|
if (content) {
|
||||||
|
content.innerHTML = t;
|
||||||
|
}
|
||||||
|
var submitBtn = _this.submitBtn();
|
||||||
|
if (submitBtn) {
|
||||||
|
submitBtn.onclick = function () {
|
||||||
|
var name = _this.nameField();
|
||||||
|
var desc = _this.descField();
|
||||||
|
var point = new Marker(name, desc, args.latlng, { title: name, alt: name });
|
||||||
|
point.add(args.map);
|
||||||
|
args.overlays.markers.push(point);
|
||||||
|
_this.setVisible(false);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case OverlayType.CIRCLE:
|
||||||
|
break;
|
||||||
|
case OverlayType.POLYGON:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return Modal;
|
||||||
|
}());
|
||||||
|
var MapHandlers = /** @class */ (function () {
|
||||||
|
function MapHandlers() {
|
||||||
|
}
|
||||||
|
return MapHandlers;
|
||||||
|
}());
|
||||||
|
function init() {
|
||||||
|
var _a;
|
||||||
|
var overlays = (_a = OverlayState.load()) !== null && _a !== void 0 ? _a : new OverlayState();
|
||||||
|
var map = L.map('map').setView([35.6653, -105.9507], 13);
|
||||||
|
var streetLayer = TileLayerWrapper.constructLayer("streetLayer", L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||||
|
maxZoom: 19,
|
||||||
|
attribution: '© OpenStreetMap'
|
||||||
|
}));
|
||||||
|
var satelliteLayer = TileLayerWrapper.constructLayer("satelliteLayer", L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
|
||||||
|
maxZoom: 19,
|
||||||
|
attribution: "© Esri"
|
||||||
|
}));
|
||||||
|
TileLayerWrapper.enableOnly(streetLayer, map);
|
||||||
|
overlays.markers.forEach(function (m) { return m.add(map); });
|
||||||
|
overlays.circles.forEach(function (m) { return m.add(map); });
|
||||||
|
overlays.polygons.forEach(function (m) { return m.add(map); });
|
||||||
|
var modal = new Modal();
|
||||||
|
var addMarkerHandler = function (e) {
|
||||||
|
modal.setVisible(true);
|
||||||
|
modal.setState(OverlayType.POINT, {
|
||||||
|
latlng: e.latlng,
|
||||||
|
map: map,
|
||||||
|
overlays: overlays
|
||||||
|
});
|
||||||
|
map.off("click", addMarkerHandler);
|
||||||
|
};
|
||||||
|
var addMarkerBtn = document.getElementById("addPoint-btn");
|
||||||
|
if (addMarkerBtn) {
|
||||||
|
addMarkerBtn.onclick = function (e) {
|
||||||
|
try {
|
||||||
|
map.off("click", addMarkerHandler);
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
map.on("click", addMarkerHandler);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
var saveBtn = document.getElementById("save-btn");
|
||||||
|
if (saveBtn) {
|
||||||
|
saveBtn.onclick = function (e) {
|
||||||
|
OverlayState.save(overlays);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
var clearBtn = document.getElementById("clear-btn");
|
||||||
|
if (clearBtn) {
|
||||||
|
clearBtn.onclick = function (e) {
|
||||||
|
overlays = OverlayState.clear(overlays, map);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
var tilesBtn = document.getElementById("tiles-btn");
|
||||||
|
if (tilesBtn) {
|
||||||
|
tilesBtn.onclick = function (e) {
|
||||||
|
if (TileLayerWrapper.getActiveLayer() == satelliteLayer) {
|
||||||
|
TileLayerWrapper.enableOnly(streetLayer, map);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
TileLayerWrapper.enableOnly(satelliteLayer, map);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
init();
|
5
static/pointModal.html
Normal file
5
static/pointModal.html
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<label for="modal-name">Name</label>
|
||||||
|
<input type="text" id="modal-name">
|
||||||
|
<label for="modal-desc">Description</label>
|
||||||
|
<textarea id="modal-desc"></textarea>
|
||||||
|
<button id="modal-submitBtn">Add</button>
|
132
static/style.css
Normal file
132
static/style.css
Normal file
|
@ -0,0 +1,132 @@
|
||||||
|
* {
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
button, input, textarea {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
-moz-appearance: none;
|
||||||
|
appearance: none;
|
||||||
|
outline-style: none;
|
||||||
|
min-width: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
#mapControls {
|
||||||
|
position: relative;
|
||||||
|
width: 100vw;
|
||||||
|
background: black;
|
||||||
|
height: 2em;
|
||||||
|
padding: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
z-index: 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
#subControls {
|
||||||
|
backgorund: transparent;
|
||||||
|
float: right;
|
||||||
|
height: 2em;
|
||||||
|
padding: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
#mapControls button {
|
||||||
|
margin-top: 0.25em;
|
||||||
|
margin-bottom: 0.25em;
|
||||||
|
}
|
||||||
|
|
||||||
|
#map {
|
||||||
|
display: block;
|
||||||
|
position: relative;
|
||||||
|
height: calc(100vh - 2.5em);
|
||||||
|
width: 100vw;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#modal-container {
|
||||||
|
background: #222222;
|
||||||
|
color: #c9c9c9;
|
||||||
|
position: fixed;
|
||||||
|
width: 1200px;
|
||||||
|
max-width: 80vw;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate3d(-50%, -50%, 0);
|
||||||
|
max-height: 80%;
|
||||||
|
z-index: 4;
|
||||||
|
text-align: left;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#modal-container h2 {
|
||||||
|
text-align: center;
|
||||||
|
font-size: 200%;
|
||||||
|
font-wieght: normal;
|
||||||
|
text-transform: uppercase;
|
||||||
|
line-height: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
#modal-content {
|
||||||
|
margin: 2em;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
#modal-content label{
|
||||||
|
display: block;
|
||||||
|
float: left;
|
||||||
|
text-transform: uppercase;
|
||||||
|
background: dimgray;
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
#modal-content input[type="text"], #modal-content textarea {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
font-size: 150%;
|
||||||
|
color: #c9c9c9;
|
||||||
|
background: transparent;
|
||||||
|
border: none;
|
||||||
|
border: solid 2px dimgray;
|
||||||
|
margin-bottom: 1em;
|
||||||
|
font-family: sans-serif;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 0.5em;
|
||||||
|
background: rgba(0, 0, 0, 0.5);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#modal-content textarea {
|
||||||
|
resize: none;
|
||||||
|
height: 8em;
|
||||||
|
}
|
||||||
|
|
||||||
|
button.closeBtn {
|
||||||
|
float: right;
|
||||||
|
background: transparent;
|
||||||
|
font-size: 200%;
|
||||||
|
border: none;
|
||||||
|
color: #c9c9c9;
|
||||||
|
padding: 0.5em;
|
||||||
|
padding-left: 1em;
|
||||||
|
padding-right: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
button.closeBtn:hover {
|
||||||
|
color: crimson;
|
||||||
|
}
|
||||||
|
|
||||||
|
button#modal-submitBtn {
|
||||||
|
font-size: 150%;
|
||||||
|
background: black;
|
||||||
|
color: #c9c9c9;
|
||||||
|
border: none;
|
||||||
|
border-left: solid 2px dimgray;
|
||||||
|
border-right: solid 2px dimgray;
|
||||||
|
position: relative;
|
||||||
|
margin-left: auto;
|
||||||
|
padding: 0.25em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
Loading…
Reference in a new issue