forked from MapComplete/MapComplete
		
	Formatting and small cleanups
This commit is contained in:
		
							parent
							
								
									15a6794e59
								
							
						
					
					
						commit
						4342b38e9d
					
				
					 8 changed files with 40 additions and 37 deletions
				
			
		|  | @ -81,7 +81,7 @@ export default class LayerConfig { | |||
| 
 | ||||
|             this.source = new SourceConfig({ | ||||
|                 osmTags: osmTags, | ||||
|                 geojsonSource: json.source["geoJsonSource"], | ||||
|                 geojsonSource: json.source["geoJson"], | ||||
|                 overpassScript: json.source["overpassScript"], | ||||
|             }); | ||||
|         } else { | ||||
|  |  | |||
|  | @ -10,7 +10,7 @@ export interface LayerConfigJson { | |||
|      * This should be a simple, lowercase, human readable string that is used to identify the layer. | ||||
|      */ | ||||
|     id: string; | ||||
|      | ||||
| 
 | ||||
|     /** | ||||
|      * The name of this layer | ||||
|      * Used in the layer control panel and the 'Personal theme' | ||||
|  | @ -27,22 +27,24 @@ export interface LayerConfigJson { | |||
|     /** | ||||
|      * This determines where the data for the layer is fetched. | ||||
|      * There are some options: | ||||
|      *  | ||||
|      * | ||||
|      * source: {osmTags: "key=value"} will fetch all objects with given tags from OSM. Currently, this will create a query to overpass and fetch the data - in the future this might fetch from the OSM API | ||||
|      * source: {geoJsonSource: "https://my.source.net/some-geo-data.geojson"} to fetch a geojson from a third party source | ||||
|      *  | ||||
|      * source: {overpassScript: "<custom overpass tags>"} when you want to do special things. _This should be really rare_.  | ||||
|      * | ||||
|      * source: {overpassScript: "<custom overpass tags>"} when you want to do special things. _This should be really rare_. | ||||
|      *      This means that the data will be pulled from overpass with this script, and will ignore the osmTags for the query | ||||
|      *      However, for the rest of the pipeline, the OsmTags will _still_ be used. This is important to enable layers etc... | ||||
|      *       | ||||
|      *       | ||||
|      * | ||||
|      * | ||||
|      * NOTE: the previous format was 'overpassTags: AndOrTagCOnfigJson | string', which is interpreted as a shorthand for source: {osmTags: "key=value"} | ||||
|      *  While still supported, this is considered deprecated | ||||
|      */ | ||||
|     source: {osmTags: AndOrTagConfigJson | string} | {geoJsonSource: string} | {overpassScript: string} | ||||
|     source: { osmTags: AndOrTagConfigJson | string } | | ||||
|         { osmTags: AndOrTagConfigJson | string, geoJson: string } | | ||||
|         { osmTags: AndOrTagConfigJson | string, overpassScript: string } | ||||
| 
 | ||||
|     /** | ||||
|      *  | ||||
|      * | ||||
|      * A list of extra tags to calculate, specified as "keyToAssignTo=javascript-expression". | ||||
|      * There are a few extra functions available. Refer to <a>Docs/CalculatedTags.md</a> for more information | ||||
|      * The functions will be run in order, e.g. | ||||
|  | @ -50,12 +52,12 @@ export interface LayerConfigJson { | |||
|      *  "_max_overlap_m2=Math.max(...feat.overlapsWith("someOtherLayer").map(o => o.overlap)) | ||||
|      *  "_max_overlap_ratio=Number(feat._max_overlap_m2)/feat.area | ||||
|      * ] | ||||
|      *  | ||||
|      * | ||||
|      */ | ||||
|     calculatedTags? : string[]; | ||||
|     calculatedTags?: string[]; | ||||
| 
 | ||||
|     /** | ||||
|      * If set, this layer will not query overpass; but it'll still match the tags above which are by chance returned by other layers.  | ||||
|      * If set, this layer will not query overpass; but it'll still match the tags above which are by chance returned by other layers. | ||||
|      * Works well together with 'passAllFeatures', to add decoration | ||||
|      */ | ||||
|     doNotDownload?: boolean; | ||||
|  | @ -64,7 +66,7 @@ export interface LayerConfigJson { | |||
|      * This tagrendering should either be 'yes' or 'no'. If 'no' is returned, then the feature will be hidden from view. | ||||
|      * This is useful to hide certain features from view. Important: hiding features does not work dynamically, but is only calculated when the data is first renders. | ||||
|      * This implies that it is not possible to hide a feature after a tagging change | ||||
|      *  | ||||
|      * | ||||
|      * The default value is 'yes' | ||||
|      */ | ||||
|     isShown?: TagRenderingConfigJson; | ||||
|  | @ -81,7 +83,7 @@ export interface LayerConfigJson { | |||
|      * Default: 100 (thus: always visible | ||||
|      */ | ||||
|     maxzoom?: number; | ||||
|      | ||||
| 
 | ||||
|     /** | ||||
|      * The title shown in a popup for elements of this layer. | ||||
|      */ | ||||
|  | @ -97,7 +99,7 @@ export interface LayerConfigJson { | |||
|     /** | ||||
|      * The icon for an element. | ||||
|      * Note that this also doubles as the icon for this layer (rendered with the overpass-tags) ánd the icon in the presets. | ||||
|      *  | ||||
|      * | ||||
|      * The result of the icon is rendered as follows: | ||||
|      * the resulting string is interpreted as a _list_ of items, seperated by ";". The bottommost layer is the first layer. | ||||
|      * As a result, on could use a generic pin, then overlay it with a specific icon. | ||||
|  | @ -111,13 +113,13 @@ export interface LayerConfigJson { | |||
|      * The 'badge'-toggle changes their behaviour. | ||||
|      * If badge is set, it will be added as a 25% height icon at the bottom right of the icon, with all the badges in a flex layout. | ||||
|      * If badges is false, it'll be a simple overlay | ||||
|      *  | ||||
|      * | ||||
|      * Note: strings are interpreted as icons, so layering and substituting is supported | ||||
|      */ | ||||
|     iconOverlays?: {if: string | AndOrTagConfigJson, then: string | TagRenderingConfigJson, badge?: boolean}[] | ||||
|     iconOverlays?: { if: string | AndOrTagConfigJson, then: string | TagRenderingConfigJson, badge?: boolean }[] | ||||
| 
 | ||||
|     /** | ||||
|      * A string containing "width,height" or "width,height,anchorpoint" where anchorpoint is any of 'center', 'top', 'bottom', 'left', 'right', 'bottomleft','topright', ...  | ||||
|      * A string containing "width,height" or "width,height,anchorpoint" where anchorpoint is any of 'center', 'top', 'bottom', 'left', 'right', 'bottomleft','topright', ... | ||||
|      * Default is '40,40,center' | ||||
|      */ | ||||
|     iconSize?: string | TagRenderingConfigJson; | ||||
|  | @ -156,18 +158,18 @@ export interface LayerConfigJson { | |||
|      * If set, this layer will pass all the features it receives onto the next layer. | ||||
|      * This is ideal for decoration, e.g. directionss on cameras | ||||
|      */ | ||||
|     passAllFeatures?:boolean | ||||
|      | ||||
|     passAllFeatures?: boolean | ||||
| 
 | ||||
|     /** | ||||
|      * Presets for this layer. | ||||
|      * A preset shows up when clicking the map on a without data (or when right-clicking/long-pressing); | ||||
|      * it will prompt the user to add a new point. | ||||
|      *  | ||||
|      * | ||||
|      * The most important aspect are the tags, which define which tags the new point will have; | ||||
|      * The title is shown in the dialog, along with the first sentence of the description. | ||||
|      *  | ||||
|      * | ||||
|      * Upon confirmation, the full description is shown beneath the buttons - perfect to add pictures and examples. | ||||
|      *  | ||||
|      * | ||||
|      * Note: the icon of the preset is determined automatically based on the tags and the icon above. Don't worry about that! | ||||
|      * NB: if no presets are defined, the popup to add new points doesn't show up at all | ||||
|      */ | ||||
|  | @ -183,7 +185,7 @@ export interface LayerConfigJson { | |||
|         /** | ||||
|          * The _first sentence_ of the description is shown on the button of the `add` menu. | ||||
|          * The full description is shown in the confirmation dialog. | ||||
|          *  | ||||
|          * | ||||
|          * (The first sentence is until the first '.'-character in the description) | ||||
|          */ | ||||
|         description?: string | any, | ||||
|  | @ -192,16 +194,16 @@ export interface LayerConfigJson { | |||
|     /** | ||||
|      * All the tag renderings. | ||||
|      * A tag rendering is a block that either shows the known value or asks a question. | ||||
|      *  | ||||
|      * | ||||
|      * Refer to the class `TagRenderingConfigJson` to see the possibilities. | ||||
|      *  | ||||
|      * | ||||
|      * Note that we can also use a string here - where the string refers to a tagrenering defined in `assets/questions/questions.json`, | ||||
|      * where a few very general questions are defined e.g. website, phone number, ... | ||||
|      *  | ||||
|      * | ||||
|      * A special value is 'questions', which indicates the location of the questions box. If not specified, it'll be appended to the bottom of the featureInfobox. | ||||
|      *  | ||||
|      * | ||||
|      */ | ||||
|     tagRenderings?: (string | TagRenderingConfigJson) [] | ||||
|      | ||||
|      | ||||
| 
 | ||||
| 
 | ||||
| } | ||||
|  | @ -1,5 +1,5 @@ | |||
| <wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> | ||||
| 	<s:String x:Key="/Default/CodeInspection/Highlighting/SweaWarningsMode/@EntryValue">ShowAndRun</s:String> | ||||
| 	<s:String x:Key="/Default/CodeInspection/Highlighting/SweaWarningsMode/@EntryValue">DoNotShowAndRun</s:String> | ||||
| 	<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=d2f95dca_002Defa2_002D40b6_002D8190_002D724496f13a75/@EntryIndexedValue"><SessionState ContinuousTestingMode="0" IsActive="True" Name="Session" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"> | ||||
|   <Nothing /> | ||||
| </SessionState></s:String></wpf:ResourceDictionary> | ||||
|  | @ -103,7 +103,6 @@ Some advanced functions are available on <b>feat</b> as well: | |||
|                         throw "Undefined distance!" | ||||
|                     } | ||||
|                     if(closestFeature === undefined || distance < closestDistance){ | ||||
|                         console.log("Distance between ", feature.properties.id, "and", otherFeature.properties.id, "is", distance) | ||||
|                         closestFeature = otherFeature | ||||
|                         closestDistance = distance; | ||||
|                     } | ||||
|  |  | |||
|  | @ -1,7 +1,6 @@ | |||
| import FeatureSource from "./FeatureSource"; | ||||
| import {UIEventSource} from "../UIEventSource"; | ||||
| import * as $ from "jquery"; | ||||
| import {Layer} from "leaflet"; | ||||
| 
 | ||||
| /** | ||||
|  * Fetches a geojson file somewhere and passes it along | ||||
|  |  | |||
|  | @ -57,9 +57,8 @@ export default class TagRenderingQuestion extends UIElement { | |||
|         this._inputElement = this.GenerateInputElement() | ||||
|         const self = this; | ||||
|         const save = () => { | ||||
|             console.log("Save clicked!") | ||||
|             const selection = self._inputElement.GetValue().data; | ||||
|             console.log("Selection is", selection) | ||||
|             console.log("Save button clicked, the tags are is", selection) | ||||
|             if (selection) { | ||||
|                 (State.state?.changes ?? new Changes()) | ||||
|                     .addTag(tags.data.id, selection, tags); | ||||
|  |  | |||
|  | @ -27,7 +27,9 @@ export default class ShowDataLayer { | |||
| 
 | ||||
|         layoutToUse.addCallbackAndRun(layoutToUse => { | ||||
|             for (const layer of layoutToUse.layers) { | ||||
|                 self._layerDict[layer.id] = layer; | ||||
|                 if (self._layerDict[layer.id] === undefined) { | ||||
|                     self._layerDict[layer.id] = layer; | ||||
|                 } | ||||
|             } | ||||
|         }); | ||||
| 
 | ||||
|  |  | |||
|  | @ -17,6 +17,8 @@ | |||
|   "startLon":  4.3516970, | ||||
|   "startZoom": 16, | ||||
|   "widenFactor": 0.05, | ||||
|   "layers": ["drinking_water"], | ||||
|   "layers": [ | ||||
|     "drinking_water", | ||||
|   ], | ||||
|   "roamingRenderings": [] | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue