diff --git a/Logic/ExtraFunctions.ts b/Logic/ExtraFunctions.ts index 47bfc9a4a9..a25a7c75d7 100644 --- a/Logic/ExtraFunctions.ts +++ b/Logic/ExtraFunctions.ts @@ -14,7 +14,7 @@ export interface ExtraFuncParams { */ getFeaturesWithin: (layerId: string, bbox: BBox) => any[][], memberships: RelationsTracker - getFeatureById: (id:string) => any + getFeatureById: (id: string) => any } /** @@ -80,11 +80,12 @@ class IntersectionFunc implements ExtraFunction { _f(params: ExtraFuncParams, feat) { return (...layerIds: string[]) => { - const result: { feat: any, intersections: [number,number][] }[] = [] + const result: { feat: any, intersections: [number, number][] }[] = [] const bbox = BBox.get(feat) for (const layerId of layerIds) { + console.log("Calculating the intersection with layer ", layerId) const otherLayers = params.getFeaturesWithin(layerId, bbox) if (otherLayers === undefined) { continue; @@ -94,9 +95,12 @@ class IntersectionFunc implements ExtraFunction { } for (const tile of otherLayers) { for (const otherFeature of tile) { - - const intersections = GeoOperations.LineIntersections(feat, otherFeature) - result.push({feat, intersections}) + + const intersections = GeoOperations.LineIntersections(feat, otherFeature) + if(intersections.length === 0){ + continue + } + result.push({feat: otherFeature, intersections}) } } } @@ -124,7 +128,7 @@ class DistanceToFunc implements ExtraFunction { } if (typeof arg0 === "string") { // This is an identifier - const feature = featuresPerLayer.getFeatureById(arg0) + const feature = featuresPerLayer.getFeatureById(arg0) if (feature === undefined) { return undefined; } @@ -172,9 +176,9 @@ class ClosestNObjectFunc implements ExtraFunction { _doc = "Given either a list of geojson features or a single layer name, gives the n closest objects which are nearest to the feature (excluding the feature itself). In the case of ways/polygons, only the centerpoint is considered. " + "Returns a list of `{feat: geojson, distance:number}` the empty list if nothing is found (or not yet loaded)\n\n" + "If a 'unique tag key' is given, the tag with this key will only appear once (e.g. if 'name' is given, all features will have a different name)" - _args = ["list of features or layer name or '*' to get all features", "amount of features", "unique tag key (optional)", "maxDistanceInMeters (optional)"] + _args = ["list of features or layer name or '*' to get all features", "amount of features", "unique tag key (optional)", "maxDistanceInMeters (optional)"] + - /** * Gets the closes N features, sorted by ascending distance. * @@ -205,11 +209,11 @@ class ClosestNObjectFunc implements ExtraFunction { const selfCenter = GeoOperations.centerpointCoordinates(feature) let closestFeatures: { feat: any, distance: number }[] = []; - + for (const featureList of features) { // Features is provided by 'getFeaturesWithin' which returns a list of lists of features, hence the double loop here for (const otherFeature of featureList) { - + if (otherFeature === feature || otherFeature.properties.id === feature.properties.id) { continue; // We ignore self } @@ -332,6 +336,7 @@ class GetParsed implements ExtraFunction { _name = "get" _doc = "Gets the property of the feature, parses it (as JSON) and returns it. Might return 'undefined' if not defined, null, ..." _args = ["key"] + _f(params, feat) { return key => { const value = feat.properties[key] diff --git a/Logic/Osm/Actions/ReplaceGeometryAction.ts b/Logic/Osm/Actions/ReplaceGeometryAction.ts index 7c7202d233..3b4aa31ef4 100644 --- a/Logic/Osm/Actions/ReplaceGeometryAction.ts +++ b/Logic/Osm/Actions/ReplaceGeometryAction.ts @@ -64,7 +64,6 @@ export default class ReplaceGeometryAction extends OsmChangeAction { for (let j = i + 1; j < coordinates.length; j++) { const d = GeoOperations.distanceBetween(coordinates[i], coordinates[j]) if (d < 0.1) { - console.log("Identical coordinates detected: ", i, " and ", j, ": ", coordinates[i], coordinates[j], "distance is", d) this.identicalTo[j] = i } } @@ -77,7 +76,7 @@ export default class ReplaceGeometryAction extends OsmChangeAction { public async getPreview(): Promise { const {closestIds, allNodesById} = await this.GetClosestIds(); - console.log("Generating preview, identicals are ",) + console.debug("Generating preview, identicals are ",) const preview = closestIds.map((newId, i) => { if (this.identicalTo[i] !== undefined) { return undefined diff --git a/Models/Constants.ts b/Models/Constants.ts index d6438d6dd9..6614e3ea17 100644 --- a/Models/Constants.ts +++ b/Models/Constants.ts @@ -18,7 +18,7 @@ export default class Constants { public static readonly added_by_default: string[] = ["gps_location", "gps_location_history", "home_location", "gps_track"] - public static readonly no_include: string[] = ["conflation", "left_right_style", "split_point","current_view"] + public static readonly no_include: string[] = ["conflation", "left_right_style", "split_point","current_view","matchpoint"] /** * Layer IDs of layers which have special properties through built-in hooks */ diff --git a/Models/ThemeConfig/PointRenderingConfig.ts b/Models/ThemeConfig/PointRenderingConfig.ts index 32d0b2caab..7ecb713e70 100644 --- a/Models/ThemeConfig/PointRenderingConfig.ts +++ b/Models/ThemeConfig/PointRenderingConfig.ts @@ -69,7 +69,7 @@ export default class PointRenderingConfig extends WithContextLoader { if (iconPath !== undefined && iconPath.startsWith(Utils.assets_path)) { const iconKey = iconPath.substr(Utils.assets_path.length); if (Svg.All[iconKey] === undefined) { - throw "Builtin SVG asset not found: " + iconPath; + throw context+": builtin SVG asset not found: " + iconPath; } } this.iconSize = this.tr("iconSize", "40,40,center"); diff --git a/UI/BigComponents/LeftControls.ts b/UI/BigComponents/LeftControls.ts index 6fe0a317b1..a669b856c1 100644 --- a/UI/BigComponents/LeftControls.ts +++ b/UI/BigComponents/LeftControls.ts @@ -62,7 +62,6 @@ export default class LeftControls extends Combine { const elem = currentViewFL.layerDef.mapRendering[0]?.GenerateLeafletStyle(new UIEventSource(tags), false, { noSize: true })?.html - console.log("Elem is ", elem, "for", tags) if (elem === undefined) { return defaultIcon } diff --git a/UI/Input/LocationInput.ts b/UI/Input/LocationInput.ts index fe2f66bfe5..107b396394 100644 --- a/UI/Input/LocationInput.ts +++ b/UI/Input/LocationInput.ts @@ -15,20 +15,10 @@ import {FixedUiElement} from "../Base/FixedUiElement"; import ShowDataLayer from "../ShowDataLayer/ShowDataLayer"; import BaseUIElement from "../BaseUIElement"; import Toggle from "./Toggle"; - +import * as matchpoint from "../../assets/layers/matchpoint/matchpoint.json" export default class LocationInput extends InputElement implements MinimapObj { - private static readonly matchLayer = new LayerConfig( - { - id: "matchpoint", source: { - osmTags: {and: []} - }, - mapRendering: [{ - location: ["point","centroid"], - icon: "./assets/svg/crosshair-empty.svg" - }] - }, "matchpoint icon", true - ) + private static readonly matchLayer = new LayerConfig(matchpoint, "LocationInput.matchpoint", true) IsSelected: UIEventSource = new UIEventSource(false); public readonly snappedOnto: UIEventSource = new UIEventSource(undefined) diff --git a/UI/Popup/DeleteWizard.ts b/UI/Popup/DeleteWizard.ts index b0981f78bc..5b66956f2a 100644 --- a/UI/Popup/DeleteWizard.ts +++ b/UI/Popup/DeleteWizard.ts @@ -93,7 +93,7 @@ export default class DeleteWizard extends Toggle { * The button which is shown first. Opening it will trigger the check for deletions */ const deleteButton = new SubtleButton( - Svg.delete_icon_ui().SetStyle("width: auto; height: 1.5rem;"), t.delete.Clone()).onClick( + Svg.delete_icon_svg().SetStyle("width: 1.5rem; height: 1.5rem;"), t.delete.Clone()).onClick( () => { deleteAbility.CheckDeleteability(true) confirm.setData(true); diff --git a/UI/Popup/MoveWizard.ts b/UI/Popup/MoveWizard.ts index 212494023d..8bb889ece3 100644 --- a/UI/Popup/MoveWizard.ts +++ b/UI/Popup/MoveWizard.ts @@ -85,14 +85,14 @@ export default class MoveWizard extends Toggle { const reason = reasons[0] moveReason.setData(reason) moveButton = new SubtleButton( - reason.icon.SetStyle("height: 1.5rem; width: auto;"), + reason.icon.SetStyle("height: 1.5rem; width: 1.5rem;"), Translations.WT(reason.invitingText) ).onClick(() => { currentStep.setData("pick_location") }) } else { moveButton = new SubtleButton( - Svg.move_ui().SetStyle("height: 1.5rem; width: auto"), + Svg.move_ui().SetStyle("width: 1.5rem; height: 1.5rem"), t.inviteToMove.generic ).onClick(() => { currentStep.setData("reason") diff --git a/assets/layers/matchpoint/matchpoint.json b/assets/layers/matchpoint/matchpoint.json new file mode 100644 index 0000000000..983ba8025e --- /dev/null +++ b/assets/layers/matchpoint/matchpoint.json @@ -0,0 +1,13 @@ +{ + "id": "matchpoint", + "description": "The default rendering for a locationInput which snaps onto another object", + "source": { + "osmTags": { + "and": []} + }, + "mapRendering": [{ + "location": ["point","centroid"], + "icon": "./assets/svg/crosshair-empty.svg" + }] + +} \ No newline at end of file diff --git a/assets/svg/arrow-download.svg b/assets/svg/arrow-download.svg deleted file mode 100644 index b1f2ff8eaf..0000000000 --- a/assets/svg/arrow-download.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - diff --git a/assets/svg/arrow-left-smooth.svg b/assets/svg/arrow-left-smooth.svg deleted file mode 100644 index d5bb1d8e49..0000000000 --- a/assets/svg/arrow-left-smooth.svg +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - image/svg+xml - - - - - - - - - diff --git a/assets/svg/arrow-left-thin.svg b/assets/svg/arrow-left-thin.svg deleted file mode 100644 index 5eb76481bb..0000000000 --- a/assets/svg/arrow-left-thin.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/svg/arrow-right-smooth.svg b/assets/svg/arrow-right-smooth.svg deleted file mode 100644 index 4fec56311d..0000000000 --- a/assets/svg/arrow-right-smooth.svg +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - image/svg+xml - - - - - - - - - diff --git a/assets/svg/direction.svg b/assets/svg/direction.svg deleted file mode 100644 index 9e2f0e9110..0000000000 --- a/assets/svg/direction.svg +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - diff --git a/assets/svg/direction_masked.svg b/assets/svg/direction_masked.svg deleted file mode 100644 index af763459eb..0000000000 --- a/assets/svg/direction_masked.svg +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - - - Created by potrace 1.15, written by Peter Selinger 2001-2017 - - - image/svg+xml - - - - - - diff --git a/assets/svg/direction_outline.svg b/assets/svg/direction_outline.svg deleted file mode 100644 index e90b7da5b3..0000000000 --- a/assets/svg/direction_outline.svg +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - Created by potrace 1.15, written by Peter Selinger 2001-2017 - - - image/svg+xml - - - - - - - diff --git a/assets/svg/down.svg b/assets/svg/down.svg deleted file mode 100644 index 0f1acab6bf..0000000000 --- a/assets/svg/down.svg +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - - diff --git a/assets/svg/home_white_bg.svg b/assets/svg/home_white_bg.svg deleted file mode 100644 index 96d62bcb41..0000000000 --- a/assets/svg/home_white_bg.svg +++ /dev/null @@ -1,29 +0,0 @@ - -image/svg+xml - - - - \ No newline at end of file diff --git a/assets/svg/layersAdd.svg b/assets/svg/layersAdd.svg deleted file mode 100644 index ff0535d1fe..0000000000 --- a/assets/svg/layersAdd.svg +++ /dev/null @@ -1,299 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/assets/svg/license_info.json b/assets/svg/license_info.json index 0b19904d78..b2e4b5704b 100644 --- a/assets/svg/license_info.json +++ b/assets/svg/license_info.json @@ -71,54 +71,6 @@ "authors": [], "sources": [] }, - { - "path": "arrow-download.svg", - "license": "CC0", - "authors": [ - "Hannah Declerck" - ], - "sources": [] - }, - { - "path": "arrow-left-smooth.svg", - "license": "CC0", - "authors": [ - "Pieter Vander Vennet" - ], - "sources": [] - }, - { - "path": "arrow-left-smooth.svg", - "license": "CC0", - "authors": [ - "Pieter Vander Vennet" - ], - "sources": [] - }, - { - "path": "arrow-left-thin.svg", - "license": "CC0", - "authors": [ - "Hannah Declerck" - ], - "sources": [] - }, - { - "path": "arrow-right-smooth.svg", - "license": "CC0", - "authors": [ - "Pieter Vander Vennet" - ], - "sources": [] - }, - { - "path": "arrow-right-smooth.svg", - "license": "CC0", - "authors": [ - "Pieter Vander Vennet" - ], - "sources": [] - }, { "path": "back.svg", "license": "CC0", @@ -373,18 +325,6 @@ ], "sources": [] }, - { - "path": "direction.svg", - "license": "CC0; trivial", - "authors": [], - "sources": [] - }, - { - "path": "direction.svg", - "license": "CC0; trivial", - "authors": [], - "sources": [] - }, { "path": "direction_gradient.svg", "license": "CC0; trivial", @@ -397,38 +337,6 @@ "authors": [], "sources": [] }, - { - "path": "direction_masked.svg", - "license": "CC0", - "authors": [ - "Pieter Vander Vennet" - ], - "sources": [] - }, - { - "path": "direction_masked.svg", - "license": "CC0", - "authors": [ - "Pieter Vander Vennet" - ], - "sources": [] - }, - { - "path": "direction_outline.svg", - "license": "CC0", - "authors": [ - "Pieter Vander Vennet" - ], - "sources": [] - }, - { - "path": "direction_outline.svg", - "license": "CC0", - "authors": [ - "Pieter Vander Vennet" - ], - "sources": [] - }, { "path": "direction_stroke.svg", "license": "CC0", @@ -445,18 +353,6 @@ ], "sources": [] }, - { - "path": "down.svg", - "license": "CC0; trivial", - "authors": [], - "sources": [] - }, - { - "path": "down.svg", - "license": "CC0; trivial", - "authors": [], - "sources": [] - }, { "path": "download.svg", "license": "CC0", @@ -679,26 +575,6 @@ "https://commons.wikimedia.org/wiki/File:Home-icon.svg" ] }, - { - "path": "home_white_bg.svg", - "license": "CC-BY-SA 3.0", - "authors": [ - "Timothy Miller" - ], - "sources": [ - "https://commons.wikimedia.org/wiki/File:Home-icon.svg" - ] - }, - { - "path": "home_white_bg.svg", - "license": "CC-BY-SA 3.0", - "authors": [ - "Timothy Miller" - ], - "sources": [ - "https://commons.wikimedia.org/wiki/File:Home-icon.svg" - ] - }, { "path": "josm_logo.svg", "license": "CC0", @@ -733,18 +609,6 @@ "authors": [], "sources": [] }, - { - "path": "layersAdd.svg", - "license": "CC0; trivial", - "authors": [], - "sources": [] - }, - { - "path": "layersAdd.svg", - "license": "CC0; trivial", - "authors": [], - "sources": [] - }, { "path": "length-crosshair.svg", "license": "CC0", @@ -953,34 +817,6 @@ "authors": [], "sources": [] }, - { - "path": "or.svg", - "license": "CC0; trivial", - "authors": [], - "sources": [] - }, - { - "path": "or.svg", - "license": "CC0; trivial", - "authors": [], - "sources": [] - }, - { - "path": "osm-copyright.svg", - "license": "logo; all rights reserved", - "authors": [], - "sources": [ - "https://www.OpenStreetMap.org" - ] - }, - { - "path": "osm-copyright.svg", - "license": "logo; all rights reserved", - "authors": [], - "sources": [ - "https://www.OpenStreetMap.org" - ] - }, { "path": "osm-logo-us.svg", "license": "Logo", diff --git a/assets/svg/or.svg b/assets/svg/or.svg deleted file mode 100644 index 20841f19be..0000000000 --- a/assets/svg/or.svg +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - diff --git a/assets/svg/osm-copyright.svg b/assets/svg/osm-copyright.svg deleted file mode 100644 index 42c1744d2f..0000000000 --- a/assets/svg/osm-copyright.svg +++ /dev/null @@ -1,115 +0,0 @@ - - diff --git a/assets/themes/grb_import/grb.json b/assets/themes/grb_import/grb.json index 23c4012822..3133c41e41 100644 --- a/assets/themes/grb_import/grb.json +++ b/assets/themes/grb_import/grb.json @@ -349,6 +349,7 @@ "all_tags" ] }, + "address", { "builtin": "crab_address", "override": { @@ -463,7 +464,7 @@ "title": "GRB outline", "calculatedTags": [ "_overlaps_with_buildings=feat.overlapWith('OSM-buildings')", - "_overlap_with=feat.get('_overlaps_with_buildings').filter(f => f.overlap > 1 && (feat.get('_surface') < 20 || f.overlap / feat.get('_surface')) > 0.5)[0] ?? ''", + "_overlaps_with=feat.get('_overlaps_with_buildings').filter(f => f.overlap > 1 /* square meter */ )[0] ?? ''", "_overlap_absolute=feat.get('_overlaps_with')?.overlap", "_overlap_percentage=Math.round(100 * feat.get('_overlap_absolute') / feat.get('_surface')) ", "_osm_obj:source:ref=feat.get('_overlaps_with')?.feat?.properties['source:geometry:ref']", @@ -478,16 +479,16 @@ "_imported_osm_still_fresh= feat.properties['_osm_obj:source:date'] == feat.properties._grb_date", "_target_building_type=feat.properties['_osm_obj:building'] === 'yes' ? feat.properties.building : (feat.properties['_osm_obj:building'] ?? feat.properties.building)", "_building:min_level= feat.properties['fixme']?.startsWith('verdieping, correct the building tag, add building:level and building:min_level before upload in JOSM!') ? '1' : ''", - "_overlaps_with_other_features=feat.overlapWith('generic_osm_object').map(f => \"\" + f.feat.properties.id + \"\").join(', ')" + "_intersects_with_other_features=feat.intersectionsWith('generic_osm_object').map(f => \"\" + f.feat.properties.id + \"\").join(', ')" ], "tagRenderings": [ { "id": "Import-button", "render": "{import_way_button(OSM-buildings,building=$building;man_made=$man_made; source:geometry:date=$_grb_date; source:geometry:ref=$_grb_ref; addr:street=$addr:street; addr:housenumber=$addr:housenumber; building:min_level=$_building:min_level, Upload this building to OpenStreetMap,,_is_part_of_building=true,1,_moveable=true)}", "mappings": [ - { - "if": "_overlaps_with_other_features~*", - "then": "This GRB building overlaps with the following features: {_overlaps_with_other_features}.
Fix the overlap and try again" + {"#": "Hide import button if intersection with other objects are detected", + "if": "_intersects_with_other_features~*", + "then": "This GRB building intersects with the following features: {_intersects_with_other_features}.
Fix the overlap and try again" }, { "if": { @@ -532,6 +533,7 @@ "if": "_osm_obj:addr:housenumber~*", "then": "The overlapping building only has a housenumber known: {_osm_obj:addr:housenumber}" }, + { "if": "_osm_obj:id=", "then": "No overlapping OpenStreetMap-building found" @@ -606,6 +608,10 @@ "icon": { "render": "./assets/themes/grb_import/housenumber_blank.svg", "mappings": [ + { + "if": "_intersects_with_other_features~*", + "then": "./assets/themes/grb_import/warning.svg" + }, { "if": "addr:housenumber=", "then": "" diff --git a/assets/themes/grb_import/license_info.json b/assets/themes/grb_import/license_info.json index 8ea1617ec5..a6cdd3da52 100644 --- a/assets/themes/grb_import/license_info.json +++ b/assets/themes/grb_import/license_info.json @@ -6,5 +6,15 @@ "Pieter Vander Vennet" ], "sources": [] + }, + { + "path": "warning.svg", + "license": "CC0", + "authors": [ + "penubag" + ], + "sources": [ + "https://commons.wikimedia.org/wiki/File:Ambox_warning_pn.svg" + ] } ] \ No newline at end of file diff --git a/assets/themes/grb_import/warning.svg b/assets/themes/grb_import/warning.svg new file mode 100644 index 0000000000..20121c65a8 --- /dev/null +++ b/assets/themes/grb_import/warning.svg @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/scripts/generateIncludedImages.ts b/scripts/generateIncludedImages.ts index ae15697198..a716751de9 100644 --- a/scripts/generateIncludedImages.ts +++ b/scripts/generateIncludedImages.ts @@ -31,10 +31,15 @@ function genImages(dryrun = false) { svg = "xxx" } + let rawName = name; + if(dryrun){ + rawName = "add"; + } + module += ` public static ${name} = "${svg}"\n` - module += ` public static ${name}_img = Img.AsImageElement(Svg.${name})\n` - module += ` public static ${name}_svg() { return new Img(Svg.${name}, true);}\n` - module += ` public static ${name}_ui() { return new FixedUiElement(Svg.${name}_img);}\n\n` + module += ` public static ${name}_img = Img.AsImageElement(Svg.${rawName})\n` + module += ` public static ${name}_svg() { return new Img(Svg.${rawName}, true);}\n` + module += ` public static ${name}_ui() { return new FixedUiElement(Svg.${rawName}_img);}\n\n` if (!dryrun) { allNames.push(`"${path}": Svg.${name}`) }