forked from MapComplete/MapComplete
		
	chore: automated housekeeping...
This commit is contained in:
		
							parent
							
								
									70934b3b8e
								
							
						
					
					
						commit
						e1be5ec34d
					
				
					 110 changed files with 507 additions and 288 deletions
				
			
		|  | @ -14,7 +14,11 @@ import Link from "../../UI/Base/Link" | |||
| export default class PanoramaxImageProvider extends ImageProvider { | ||||
|     public static readonly singleton = new PanoramaxImageProvider() | ||||
|     private static readonly xyz = new PanoramaxXYZ() | ||||
|     private static defaultPanoramax =  new AuthorizedPanoramax(Constants.panoramax.url, Constants.panoramax.token, 3000) | ||||
|     private static defaultPanoramax = new AuthorizedPanoramax( | ||||
|         Constants.panoramax.url, | ||||
|         Constants.panoramax.token, | ||||
|         3000 | ||||
|     ) | ||||
| 
 | ||||
|     public defaultKeyPrefixes: string[] = ["panoramax"] | ||||
|     public readonly name: string = "panoramax" | ||||
|  | @ -48,7 +52,7 @@ export default class PanoramaxImageProvider extends ImageProvider { | |||
|      * @param id | ||||
|      * @private | ||||
|      */ | ||||
|     private async getInfoFromMapComplete(id: string): Promise<{ data: ImageData, url: string }> { | ||||
|     private async getInfoFromMapComplete(id: string): Promise<{ data: ImageData; url: string }> { | ||||
|         const url = `https://panoramax.mapcomplete.org/` | ||||
|         const data = await PanoramaxImageProvider.defaultPanoramax.imageInfo(id) | ||||
|         return { url, data } | ||||
|  | @ -138,16 +142,14 @@ export default class PanoramaxImageProvider extends ImageProvider { | |||
|             ) | ||||
|         } | ||||
| 
 | ||||
|         Stores.Chronic(1500, () => | ||||
|             hasLoading(source.data), | ||||
|         ).addCallback(_ => { | ||||
|             super.getRelevantUrlsFor(tags, prefixes).then(data => { | ||||
|         Stores.Chronic(1500, () => hasLoading(source.data)).addCallback((_) => { | ||||
|             super.getRelevantUrlsFor(tags, prefixes).then((data) => { | ||||
|                 source.set(data) | ||||
|                 return !hasLoading(data) | ||||
|             }) | ||||
|         }) | ||||
| 
 | ||||
|         return Stores.ListStabilized( source) | ||||
|         return Stores.ListStabilized(source) | ||||
|     } | ||||
| 
 | ||||
|     public async DownloadAttribution(providedImage: { | ||||
|  | @ -195,24 +197,28 @@ export class PanoramaxUploader implements ImageUploader { | |||
|         let datetime = new Date().toISOString() | ||||
|         try { | ||||
|             const tags = await ExifReader.load(blob) | ||||
|             const [[latD], [latM], [latS, latSDenom]]  =<[[number,number],[number,number],[number,number]]> tags?.GPSLatitude.value | ||||
|             const [[lonD], [lonM], [lonS, lonSDenom]]  =<[[number,number],[number,number],[number,number]]> tags?.GPSLongitude.value | ||||
|             const [[latD], [latM], [latS, latSDenom]] = < | ||||
|                 [[number, number], [number, number], [number, number]] | ||||
|             >tags?.GPSLatitude.value | ||||
|             const [[lonD], [lonM], [lonS, lonSDenom]] = < | ||||
|                 [[number, number], [number, number], [number, number]] | ||||
|             >tags?.GPSLongitude.value | ||||
|             lat = latD + latM / 60 + latS / (3600 * latSDenom) | ||||
|             lon = lonD + lonM / 60 + lonS / ( 3600 * lonSDenom) | ||||
|             lon = lonD + lonM / 60 + lonS / (3600 * lonSDenom) | ||||
| 
 | ||||
|             const [date, time] = tags.DateTime.value[0].split(" ") | ||||
|             datetime = new Date(date.replaceAll(":", "-")+"T"+time).toISOString() | ||||
|             datetime = new Date(date.replaceAll(":", "-") + "T" + time).toISOString() | ||||
| 
 | ||||
|             console.log("Tags are", tags) | ||||
|         } catch (e) { | ||||
|             console.error("Could not read EXIF-tags") | ||||
|         } | ||||
| 
 | ||||
| 
 | ||||
|         const p = this.panoramax | ||||
|         sequenceId ??= this._targetSequence?.data ?? Constants.panoramax.sequence | ||||
|         const sequence: {id: string, "stats:items":{count:number}}  = | ||||
|             (await p.mySequences()).find(s => s.id === sequenceId) | ||||
|         const sequence: { id: string; "stats:items": { count: number } } = ( | ||||
|             await p.mySequences() | ||||
|         ).find((s) => s.id === sequenceId) | ||||
|         const img = <ImageData>await p.addImage(blob, sequence, { | ||||
|             lon, | ||||
|             lat, | ||||
|  |  | |||
|  | @ -300,14 +300,19 @@ export class Changes { | |||
|         newObjects: OsmObject[] | ||||
|         modifiedObjects: OsmObject[] | ||||
|         deletedObjects: OsmObject[] | ||||
|     }{ | ||||
|         return Changes.createChangesetObjectsStatic(changes, downloadedOsmObjects, ignoreNoCreate, this.previouslyCreated) | ||||
|     } { | ||||
|         return Changes.createChangesetObjectsStatic( | ||||
|             changes, | ||||
|             downloadedOsmObjects, | ||||
|             ignoreNoCreate, | ||||
|             this.previouslyCreated | ||||
|         ) | ||||
|     } | ||||
|     public static createChangesetObjectsStatic( | ||||
|         changes: ChangeDescription[], | ||||
|         downloadedOsmObjects: OsmObject[], | ||||
|         ignoreNoCreate: boolean = false, | ||||
|         previouslyCreated : OsmObject[] | ||||
|         previouslyCreated: OsmObject[] | ||||
|     ): { | ||||
|         newObjects: OsmObject[] | ||||
|         modifiedObjects: OsmObject[] | ||||
|  |  | |||
|  | @ -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 { | ||||
|  |  | |||
|  | @ -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)) | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -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 | ||||
|  |  | |||
|  | @ -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" | ||||
|  |  | |||
|  | @ -50,7 +50,12 @@ export default class Constants { | |||
|         ...Constants.no_include, | ||||
|     ] as const | ||||
| 
 | ||||
|     public static panoramax: { url: string; token: string, sequence: string, testsequence: string } = packagefile.config.panoramax | ||||
|     public static panoramax: { | ||||
|         url: string | ||||
|         token: string | ||||
|         sequence: string | ||||
|         testsequence: string | ||||
|     } = packagefile.config.panoramax | ||||
| 
 | ||||
|     // The user journey states thresholds when a new feature gets unlocked
 | ||||
|     public static userJourney = { | ||||
|  |  | |||
|  | @ -31,9 +31,7 @@ export default class DependencyCalculator { | |||
|      * Returns a set of all other layer-ids that this layer needs to function. | ||||
|      * E.g. if this layers does snap to another layer in the preset, this other layer id will be mentioned | ||||
|      */ | ||||
|     public static getLayerDependencies( | ||||
|         layer: LayerConfig | ||||
|     ): { | ||||
|     public static getLayerDependencies(layer: LayerConfig): { | ||||
|         neededLayer: string | ||||
|         reason: string | ||||
|         context?: string | ||||
|  |  | |||
|  | @ -373,9 +373,13 @@ export default class ThemeViewState implements SpecialVisualizationState { | |||
|         this.hasDataInView = new NoElementsInViewDetector(this).hasFeatureInView | ||||
|         this.imageUploadManager = new ImageUploadManager( | ||||
|             layout, | ||||
|             new PanoramaxUploader(Constants.panoramax.url, Constants.panoramax.token, | ||||
|                 this.featureSwitchIsTesting.map(t => t ? Constants.panoramax.testsequence : Constants.panoramax.sequence) | ||||
|                 ), | ||||
|             new PanoramaxUploader( | ||||
|                 Constants.panoramax.url, | ||||
|                 Constants.panoramax.token, | ||||
|                 this.featureSwitchIsTesting.map((t) => | ||||
|                     t ? Constants.panoramax.testsequence : Constants.panoramax.sequence | ||||
|                 ) | ||||
|             ), | ||||
|             this.featureProperties, | ||||
|             this.osmConnection, | ||||
|             this.changes, | ||||
|  |  | |||
|  | @ -18,7 +18,7 @@ | |||
|         .filter( | ||||
|           (f) => | ||||
|             f.filter.options[0].fields.length === 0 && | ||||
|             Constants.priviliged_layers.indexOf(<any>f.layer.id) < 0, | ||||
|             Constants.priviliged_layers.indexOf(<any>f.layer.id) < 0 | ||||
|         ) | ||||
|         .map((af) => { | ||||
|           const index = <number>af.control.data | ||||
|  | @ -28,7 +28,7 @@ | |||
|             option: af.filter.options[index], | ||||
|           } | ||||
|           return r | ||||
|         }), | ||||
|         }) | ||||
|     ) | ||||
|   let searchTerm = state.searchState.searchTerm | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| { | ||||
|   "contributors": [ | ||||
|     { | ||||
|       "commits": 8493, | ||||
|       "commits": 8513, | ||||
|       "contributor": "Pieter Vander Vennet" | ||||
|     }, | ||||
|     { | ||||
|  |  | |||
|  | @ -181,9 +181,9 @@ | |||
|     "ar" | ||||
|   ], | ||||
|   "ER": [ | ||||
|     "en", | ||||
|     "ar", | ||||
|     "ti" | ||||
|     "ti", | ||||
|     "en" | ||||
|   ], | ||||
|   "ES": [ | ||||
|     "es", | ||||
|  | @ -572,6 +572,8 @@ | |||
|     "en" | ||||
|   ], | ||||
|   "SM": [ | ||||
|     "it", | ||||
|     "it", | ||||
|     "it" | ||||
|   ], | ||||
|   "SN": [ | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| { | ||||
|   "contributors": [ | ||||
|     { | ||||
|       "commits": 484, | ||||
|       "commits": 485, | ||||
|       "contributor": "Pieter Vander Vennet" | ||||
|     }, | ||||
|     { | ||||
|  | @ -37,7 +37,11 @@ | |||
|       "contributor": "Harry Bond" | ||||
|     }, | ||||
|     { | ||||
|       "commits": 47, | ||||
|       "commits": 49, | ||||
|       "contributor": "mike140" | ||||
|     }, | ||||
|     { | ||||
|       "commits": 48, | ||||
|       "contributor": "Jiří Podhorecký" | ||||
|     }, | ||||
|     { | ||||
|  | @ -60,10 +64,6 @@ | |||
|       "commits": 36, | ||||
|       "contributor": "Iago" | ||||
|     }, | ||||
|     { | ||||
|       "commits": 35, | ||||
|       "contributor": "mike140" | ||||
|     }, | ||||
|     { | ||||
|       "commits": 29, | ||||
|       "contributor": "Artem" | ||||
|  | @ -544,6 +544,10 @@ | |||
|       "commits": 2, | ||||
|       "contributor": "Leo Alcaraz" | ||||
|     }, | ||||
|     { | ||||
|       "commits": 1, | ||||
|       "contributor": "Teodor11" | ||||
|     }, | ||||
|     { | ||||
|       "commits": 1, | ||||
|       "contributor": "Emmanuel Arrechea" | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue