forked from MapComplete/MapComplete
chore: automated housekeeping...
This commit is contained in:
parent
8ef7af613f
commit
00151afdea
114 changed files with 2857 additions and 2135 deletions
|
@ -61,7 +61,7 @@ export default class FilteringFeatureSource implements FeatureSource {
|
|||
|
||||
selectedElement?.addCallback(() => this.update())
|
||||
|
||||
zoomlevel?.mapD(z => Math.floor(z)).addCallback(() => this.update())
|
||||
zoomlevel?.mapD((z) => Math.floor(z)).addCallback(() => this.update())
|
||||
|
||||
this.update()
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ export default class FilteringFeatureSource implements FeatureSource {
|
|||
const newFeatures = (features ?? []).filter((f) => {
|
||||
this.registerCallback(f.properties.id)
|
||||
|
||||
if(selectedElement === f.properties.id){
|
||||
if (selectedElement === f.properties.id) {
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ export default class PanoramaxImageProvider extends ImageProvider {
|
|||
private static defaultPanoramax = new AuthorizedPanoramax(
|
||||
Constants.panoramax.url,
|
||||
Constants.panoramax.token,
|
||||
3000,
|
||||
3000
|
||||
)
|
||||
|
||||
public defaultKeyPrefixes: string[] = ["panoramax"]
|
||||
|
@ -30,7 +30,7 @@ export default class PanoramaxImageProvider extends ImageProvider {
|
|||
location?: {
|
||||
lon: number
|
||||
lat: number
|
||||
},
|
||||
}
|
||||
): BaseUIElement {
|
||||
const p = new Panoramax(img.host)
|
||||
return new Link(
|
||||
|
@ -39,7 +39,7 @@ export default class PanoramaxImageProvider extends ImageProvider {
|
|||
imageId: img?.id,
|
||||
location,
|
||||
}),
|
||||
true,
|
||||
true
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ export default class PanoramaxImageProvider extends ImageProvider {
|
|||
img?.status !== undefined &&
|
||||
img?.status !== "ready" &&
|
||||
img?.status !== "broken" &&
|
||||
img?.status !== "hidden",
|
||||
img?.status !== "hidden"
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -200,7 +200,7 @@ export class PanoramaxUploader implements ImageUploader {
|
|||
author: string,
|
||||
noblur: boolean = false,
|
||||
sequenceId?: string,
|
||||
datetime?: string,
|
||||
datetime?: string
|
||||
): Promise<{
|
||||
key: string
|
||||
value: string
|
||||
|
@ -214,25 +214,34 @@ export class PanoramaxUploader implements ImageUploader {
|
|||
const tags = await ExifReader.load(blob)
|
||||
const [[latD], [latM], [latS, latSDenom]] = <
|
||||
[[number, number], [number, number], [number, number]]
|
||||
>tags?.GPSLatitude?.value
|
||||
>tags?.GPSLatitude?.value
|
||||
const [[lonD], [lonM], [lonS, lonSDenom]] = <
|
||||
[[number, number], [number, number], [number, number]]
|
||||
>tags?.GPSLongitude?.value
|
||||
>tags?.GPSLongitude?.value
|
||||
|
||||
const exifLat = latD + latM / 60 + latS / (3600 * latSDenom)
|
||||
const exifLon = lonD + lonM / 60 + lonS / (3600 * lonSDenom)
|
||||
if (typeof exifLat === "number" && !isNaN(exifLat) && typeof exifLon === "number" && !isNaN(exifLon)
|
||||
&& !(exifLat === 0 && exifLon === 0)) {
|
||||
if (
|
||||
typeof exifLat === "number" &&
|
||||
!isNaN(exifLat) &&
|
||||
typeof exifLon === "number" &&
|
||||
!isNaN(exifLon) &&
|
||||
!(exifLat === 0 && exifLon === 0)
|
||||
) {
|
||||
lat = exifLat
|
||||
lon = exifLon
|
||||
}
|
||||
const [date, time] = tags.DateTime.value[0].split(" ")
|
||||
const exifDatetime = new Date(date.replaceAll(":", "-") + "T" + time)
|
||||
if(exifDatetime.getFullYear() === 1970){
|
||||
if (exifDatetime.getFullYear() === 1970) {
|
||||
// The data probably got reset to the epoch
|
||||
// we don't use the value
|
||||
console.log("Datetime from picture is probably invalid:", exifDatetime, "using 'now' instead")
|
||||
}else{
|
||||
console.log(
|
||||
"Datetime from picture is probably invalid:",
|
||||
exifDatetime,
|
||||
"using 'now' instead"
|
||||
)
|
||||
} else {
|
||||
datetime = exifDatetime.toISOString()
|
||||
}
|
||||
console.log("Tags are", tags)
|
||||
|
|
|
@ -563,13 +563,14 @@ export default class UserRelatedState {
|
|||
return amendedPrefs
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The disabled questions for this theme and layer
|
||||
*/
|
||||
public getThemeDisabled(themeId: string, layerId: string): UIEventSource<string[]> {
|
||||
const flatSource = this.osmConnection.getPreference("disabled-questions-" + themeId + "-" + layerId, "[]")
|
||||
const flatSource = this.osmConnection.getPreference(
|
||||
"disabled-questions-" + themeId + "-" + layerId,
|
||||
"[]"
|
||||
)
|
||||
return UIEventSource.asObject<string[]>(flatSource, [])
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,14 +1,42 @@
|
|||
import { Utils } from "../../Utils"
|
||||
/** This code is autogenerated - do not edit. Edit ./assets/layers/usersettings/usersettings.json instead */
|
||||
export class ThemeMetaTagging {
|
||||
public static readonly themeName = "usersettings"
|
||||
public static readonly themeName = "usersettings"
|
||||
|
||||
public metaTaggging_for_usersettings(feat: {properties: Record<string, string>}) {
|
||||
Utils.AddLazyProperty(feat.properties, '_mastodon_candidate_md', () => feat.properties._description.match(/\[[^\]]*\]\((.*(mastodon|en.osm.town).*)\).*/)?.at(1) )
|
||||
Utils.AddLazyProperty(feat.properties, '_d', () => feat.properties._description?.replace(/</g,'<')?.replace(/>/g,'>') ?? '' )
|
||||
Utils.AddLazyProperty(feat.properties, '_mastodon_candidate_a', () => (feat => {const e = document.createElement('div');e.innerHTML = feat.properties._d;return Array.from(e.getElementsByTagName("a")).filter(a => a.href.match(/mastodon|en.osm.town/) !== null)[0]?.href }) (feat) )
|
||||
Utils.AddLazyProperty(feat.properties, '_mastodon_link', () => (feat => {const e = document.createElement('div');e.innerHTML = feat.properties._d;return Array.from(e.getElementsByTagName("a")).filter(a => a.getAttribute("rel")?.indexOf('me') >= 0)[0]?.href})(feat) )
|
||||
Utils.AddLazyProperty(feat.properties, '_mastodon_candidate', () => feat.properties._mastodon_candidate_md ?? feat.properties._mastodon_candidate_a )
|
||||
feat.properties['__current_backgroun'] = 'initial_value'
|
||||
}
|
||||
}
|
||||
public metaTaggging_for_usersettings(feat: { properties: Record<string, string> }) {
|
||||
Utils.AddLazyProperty(feat.properties, "_mastodon_candidate_md", () =>
|
||||
feat.properties._description
|
||||
.match(/\[[^\]]*\]\((.*(mastodon|en.osm.town).*)\).*/)
|
||||
?.at(1)
|
||||
)
|
||||
Utils.AddLazyProperty(
|
||||
feat.properties,
|
||||
"_d",
|
||||
() => feat.properties._description?.replace(/</g, "<")?.replace(/>/g, ">") ?? ""
|
||||
)
|
||||
Utils.AddLazyProperty(feat.properties, "_mastodon_candidate_a", () =>
|
||||
((feat) => {
|
||||
const e = document.createElement("div")
|
||||
e.innerHTML = feat.properties._d
|
||||
return Array.from(e.getElementsByTagName("a")).filter(
|
||||
(a) => a.href.match(/mastodon|en.osm.town/) !== null
|
||||
)[0]?.href
|
||||
})(feat)
|
||||
)
|
||||
Utils.AddLazyProperty(feat.properties, "_mastodon_link", () =>
|
||||
((feat) => {
|
||||
const e = document.createElement("div")
|
||||
e.innerHTML = feat.properties._d
|
||||
return Array.from(e.getElementsByTagName("a")).filter(
|
||||
(a) => a.getAttribute("rel")?.indexOf("me") >= 0
|
||||
)[0]?.href
|
||||
})(feat)
|
||||
)
|
||||
Utils.AddLazyProperty(
|
||||
feat.properties,
|
||||
"_mastodon_candidate",
|
||||
() => feat.properties._mastodon_candidate_md ?? feat.properties._mastodon_candidate_a
|
||||
)
|
||||
feat.properties["__current_backgroun"] = "initial_value"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -504,14 +504,8 @@ export class TagUtils {
|
|||
* regex.matchesProperties({maxspeed: "50 mph"}) // => true
|
||||
*/
|
||||
|
||||
public static Tag(
|
||||
json: string,
|
||||
context?: string | ConversionContext
|
||||
): FlatTag;
|
||||
public static Tag(
|
||||
json: TagConfigJson,
|
||||
context?: string | ConversionContext
|
||||
): TagsFilterClosed;
|
||||
public static Tag(json: string, context?: string | ConversionContext): FlatTag
|
||||
public static Tag(json: TagConfigJson, context?: string | ConversionContext): TagsFilterClosed
|
||||
public static Tag(
|
||||
json: TagConfigJson,
|
||||
context: string | ConversionContext = ""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue