chore: automated housekeeping...

This commit is contained in:
Pieter Vander Vennet 2024-10-24 00:56:24 +02:00
parent 70934b3b8e
commit e1be5ec34d
110 changed files with 507 additions and 288 deletions

View file

@ -73,20 +73,26 @@ export default class CoordinateSearch implements GeocodingProvider {
(m) => CoordinateSearch.asResult(m[2], m[1], "latlon")
)
const matchesLonLat = Utils.NoNull(CoordinateSearch.lonLatRegexes.map(r => query.match(r)))
.map(m => CoordinateSearch.asResult(m[1], m[2], "lonlat"))
const matchesLonLat = Utils.NoNull(
CoordinateSearch.lonLatRegexes.map((r) => query.match(r))
).map((m) => CoordinateSearch.asResult(m[1], m[2], "lonlat"))
const init = matches.concat(matchesLonLat)
if (init.length > 0) {
return init
}
try {
const c = new CoordinateParser(query);
return [CoordinateSearch.asResult(""+c.getLongitude(), ""+c.getLatitude(), "coordinateParser")]
const c = new CoordinateParser(query)
return [
CoordinateSearch.asResult(
"" + c.getLongitude(),
"" + c.getLatitude(),
"coordinateParser"
),
]
} catch {
return []
}
}
private static round6(n: number): string {

View file

@ -8,11 +8,11 @@ import GeocodingProvider, {
import { decode as pluscode_decode } from "pluscodes"
export default class OpenLocationCodeSearch implements GeocodingProvider {
/**
* A regex describing all plus-codes
*/
public static readonly _isPlusCode = /^([2-9CFGHJMPQRVWX]{2}|00){2,4}\+([2-9CFGHJMPQRVWX]{2,3})?$/
public static readonly _isPlusCode =
/^([2-9CFGHJMPQRVWX]{2}|00){2,4}\+([2-9CFGHJMPQRVWX]{2,3})?$/
/**
*
@ -35,17 +35,18 @@ export default class OpenLocationCodeSearch implements GeocodingProvider {
}
const { latitude, longitude } = pluscode_decode(query)
return [{
lon: longitude,
lat: latitude,
description: "Open Location Code",
osm_id: query,
display_name: query.toUpperCase(),
}]
return [
{
lon: longitude,
lat: latitude,
description: "Open Location Code",
osm_id: query,
display_name: query.toUpperCase(),
},
]
}
suggest?(query: string, options?: GeocodingOptions): Store<GeocodeResult[]> {
return Stores.FromPromise(this.search(query, options))
}
}

View file

@ -25,7 +25,12 @@ export default class PhotonSearch implements GeocodingProvider, ReverseGeocoding
private readonly suggestionLimit: number = 5
private readonly searchLimit: number = 1
constructor(ignoreBounds: boolean = false, suggestionLimit:number = 5, searchLimit:number = 1, endpoint?: string) {
constructor(
ignoreBounds: boolean = false,
suggestionLimit: number = 5,
searchLimit: number = 1,
endpoint?: string
) {
this.ignoreBounds = ignoreBounds
this.suggestionLimit = suggestionLimit
this.searchLimit = searchLimit

View file

@ -15,27 +15,22 @@ export default class SearchUtils {
if (searchTerm === "personal") {
window.location.href = ThemeSearch.createUrlFor({ id: "personal" }, undefined)
return true
}
if (searchTerm === "bugs" || searchTerm === "issues") {
window.location.href = "https://github.com/pietervdvn/MapComplete/issues"
return true
}
if (searchTerm === "source") {
window.location.href = "https://github.com/pietervdvn/MapComplete"
return true
}
if (searchTerm === "docs") {
window.location.href = "https://github.com/pietervdvn/MapComplete/tree/develop/Docs"
return true
}
if (searchTerm === "osmcha" || searchTerm === "stats") {
window.location.href = Utils.OsmChaLinkFor(7)
return true
}
if (searchTerm === "studio") {
window.location.href = "./studio.html"