forked from MapComplete/MapComplete
First search with suggestions
This commit is contained in:
parent
874f82be82
commit
3cd04df60b
37 changed files with 677 additions and 85 deletions
|
|
@ -29,6 +29,9 @@ export interface MapProperties {
|
|||
* @param f
|
||||
*/
|
||||
onKeyNavigationEvent(f: (event: KeyNavigationEvent) => void | boolean): () => void
|
||||
|
||||
flyTo(lon: number, lat: number, zoom: number): void
|
||||
|
||||
}
|
||||
|
||||
export interface ExportableMap {
|
||||
|
|
|
|||
|
|
@ -1701,7 +1701,8 @@ export class ValidateLayer extends Conversion<
|
|||
try {
|
||||
layerConfig = new LayerConfig(json, "validation", true)
|
||||
} catch (e) {
|
||||
context.err("Could not parse layer due to:" + e)
|
||||
console.error("Could not parse layer due to", e)
|
||||
context.err("Could not parse layer due to: " + e)
|
||||
return undefined
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,11 +19,10 @@ import { Utils } from "../../Utils"
|
|||
import { TagsFilter } from "../../Logic/Tags/TagsFilter"
|
||||
import FilterConfigJson from "./Json/FilterConfigJson"
|
||||
import { Overpass } from "../../Logic/Osm/Overpass"
|
||||
import { ImmutableStore } from "../../Logic/UIEventSource"
|
||||
import { OsmTags } from "../OsmFeature"
|
||||
import Constants from "../Constants"
|
||||
import { QuestionableTagRenderingConfigJson } from "./Json/QuestionableTagRenderingConfigJson"
|
||||
import MarkdownUtils from "../../Utils/MarkdownUtils"
|
||||
import Combine from "../../UI/Base/Combine"
|
||||
|
||||
export default class LayerConfig extends WithContextLoader {
|
||||
public static readonly syncSelectionAllowed = ["no", "local", "theme-only", "global"] as const
|
||||
|
|
@ -344,15 +343,17 @@ export default class LayerConfig extends WithContextLoader {
|
|||
this.popupInFloatover = json.popupInFloatover ?? false
|
||||
}
|
||||
|
||||
public defaultIcon(): BaseUIElement | undefined {
|
||||
public defaultIcon(tags?: Record<string, string>): BaseUIElement | undefined {
|
||||
if (this.mapRendering === undefined || this.mapRendering === null) {
|
||||
return undefined
|
||||
}
|
||||
const mapRendering = this.mapRendering.filter((r) => r.location.has("point"))[0]
|
||||
if (mapRendering === undefined) {
|
||||
const mapRenderings = this.mapRendering.filter((r) => r.location.has("point"))
|
||||
if (mapRenderings.length === 0) {
|
||||
return undefined
|
||||
}
|
||||
return mapRendering.GetBaseIcon(this.GetBaseTags())
|
||||
return new Combine(mapRenderings.map(
|
||||
mr => mr.GetBaseIcon(tags ?? this.GetBaseTags()).SetClass("absolute left-0 top-0 w-full h-full"))
|
||||
).SetClass("relative block w-full h-full")
|
||||
}
|
||||
|
||||
public GetBaseTags(): Record<string, string> {
|
||||
|
|
|
|||
|
|
@ -74,6 +74,11 @@ import Locale from "../UI/i18n/Locale"
|
|||
import Hash from "../Logic/Web/Hash"
|
||||
import { GeoOperations } from "../Logic/GeoOperations"
|
||||
import { CombinedFetcher } from "../Logic/Web/NearbyImagesSearch"
|
||||
import GeocodingProvider from "../Logic/Geocoding/GeocodingProvider"
|
||||
import CombinedSearcher from "../Logic/Geocoding/CombinedSearcher"
|
||||
import { NominatimGeocoding } from "../Logic/Geocoding/NominatimGeocoding"
|
||||
import CoordinateSearch from "../Logic/Geocoding/CoordinateSearch"
|
||||
import LocalElementSearch from "../Logic/Geocoding/LocalElementSearch"
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -153,7 +158,8 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
public readonly visualFeedback: UIEventSource<boolean> = new UIEventSource<boolean>(false)
|
||||
public readonly toCacheSavers: ReadonlyMap<string, SaveFeatureSourceToLocalStorage>
|
||||
|
||||
public readonly nearbyImageSearcher
|
||||
public readonly nearbyImageSearcher: CombinedFetcher
|
||||
public readonly geosearch: GeocodingProvider
|
||||
|
||||
constructor(layout: LayoutConfig, mvtAvailableLayers: Set<string>) {
|
||||
Utils.initDomPurify()
|
||||
|
|
@ -379,6 +385,14 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
new LayerConfig(<LayerConfigJson>summaryLayer, "summaryLayer", true)
|
||||
)
|
||||
this.toCacheSavers = layout.enableCache ? this.initSaveToLocalStorage() : undefined
|
||||
|
||||
this.geosearch = new CombinedSearcher(
|
||||
new NominatimGeocoding(),
|
||||
new CoordinateSearch(),
|
||||
new LocalElementSearch(this)
|
||||
)
|
||||
|
||||
|
||||
this.initActors()
|
||||
this.drawSpecialLayers()
|
||||
this.initHotkeys()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue