forked from MapComplete/MapComplete
		
	Move SPlit-points to seperate layer; fix rendering bug on minimaps
This commit is contained in:
		
							parent
							
								
									5bba0f0a9b
								
							
						
					
					
						commit
						a3185f2d13
					
				
					 4 changed files with 36 additions and 25 deletions
				
			
		|  | @ -20,7 +20,7 @@ export default class AllKnownLayers { | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|     public static added_by_default: string[] = ["gps_location", "gps_location_history", "home_location", "gps_track",] |     public static added_by_default: string[] = ["gps_location", "gps_location_history", "home_location", "gps_track",] | ||||||
|     public static no_include: string[] = ["conflation", "left_right_style"] |     public static no_include: string[] = ["conflation", "left_right_style", "split_point"] | ||||||
|     /** |     /** | ||||||
|      * Layer IDs of layers which have special properties through built-in hooks |      * Layer IDs of layers which have special properties through built-in hooks | ||||||
|      */ |      */ | ||||||
|  |  | ||||||
|  | @ -217,7 +217,7 @@ export default class PointRenderingConfig extends WithContextLoader { | ||||||
|         }else if(icon === undefined){ |         }else if(icon === undefined){ | ||||||
|             htmlEl = label |             htmlEl = label | ||||||
|         }else if(label === undefined){ |         }else if(label === undefined){ | ||||||
|             htmlEl = iconAndBadges |             htmlEl =  new Combine([iconAndBadges]).SetStyle("flex flex-col") | ||||||
|         }else { |         }else { | ||||||
|             htmlEl = new Combine([iconAndBadges, label]).SetStyle("flex flex-col") |             htmlEl = new Combine([iconAndBadges, label]).SetStyle("flex flex-col") | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  | @ -16,19 +16,10 @@ import StaticFeatureSource from "../../Logic/FeatureSource/Sources/StaticFeature | ||||||
| import ShowDataMultiLayer from "../ShowDataLayer/ShowDataMultiLayer"; | import ShowDataMultiLayer from "../ShowDataLayer/ShowDataMultiLayer"; | ||||||
| import LayerConfig from "../../Models/ThemeConfig/LayerConfig"; | import LayerConfig from "../../Models/ThemeConfig/LayerConfig"; | ||||||
| import {BBox} from "../../Logic/BBox"; | import {BBox} from "../../Logic/BBox"; | ||||||
| 
 | import * as split_point from "../../assets/layers/split_point/split_point.json" | ||||||
| export default class SplitRoadWizard extends Toggle { | export default class SplitRoadWizard extends Toggle { | ||||||
|     private static splitLayerStyling = new LayerConfig({ |     // @ts-ignore
 | ||||||
|         id: "splitpositions", |     private static splitLayerStyling = new LayerConfig(split_point, "(BUILTIN) SplitRoadWizard.ts", true) | ||||||
|         source: {osmTags: "_cutposition=yes"}, |  | ||||||
|         mapRendering: [ |  | ||||||
|             { |  | ||||||
|                 location: ["point", "centroid"], |  | ||||||
|                 icon: {render: "circle:white;./assets/svg/scissors.svg"}, |  | ||||||
|                 iconSize: {render: "30,30,center"} |  | ||||||
|             } |  | ||||||
|         ], |  | ||||||
|     }, "(BUILTIN) SplitRoadWizard.ts", true) |  | ||||||
| 
 | 
 | ||||||
|     public dialogIsOpened: UIEventSource<boolean> |     public dialogIsOpened: UIEventSource<boolean> | ||||||
| 
 | 
 | ||||||
|  | @ -68,14 +59,6 @@ export default class SplitRoadWizard extends Toggle { | ||||||
|         // Define how a cut is displayed on the map
 |         // Define how a cut is displayed on the map
 | ||||||
| 
 | 
 | ||||||
|         // Datalayer displaying the road and the cut points (if any)
 |         // Datalayer displaying the road and the cut points (if any)
 | ||||||
|         new ShowDataLayer({ |  | ||||||
|             features: new StaticFeatureSource(splitPoints, true), |  | ||||||
|             leafletMap: miniMap.leafletMap, |  | ||||||
|             zoomToFeatures: false, |  | ||||||
|             enablePopups: false, |  | ||||||
|             layerToShow: SplitRoadWizard.splitLayerStyling, |  | ||||||
|         }) |  | ||||||
| 
 |  | ||||||
|         new ShowDataMultiLayer({ |         new ShowDataMultiLayer({ | ||||||
|             features: new StaticFeatureSource([roadElement], false), |             features: new StaticFeatureSource([roadElement], false), | ||||||
|             layers: State.state.filteredLayers, |             layers: State.state.filteredLayers, | ||||||
|  | @ -85,6 +68,16 @@ export default class SplitRoadWizard extends Toggle { | ||||||
|             allElements: State.state.allElements, |             allElements: State.state.allElements, | ||||||
|         }) |         }) | ||||||
|          |          | ||||||
|  |         new ShowDataLayer({ | ||||||
|  |             features: new StaticFeatureSource(splitPoints, true), | ||||||
|  |             leafletMap: miniMap.leafletMap, | ||||||
|  |             zoomToFeatures: false, | ||||||
|  |             enablePopups: false, | ||||||
|  |             layerToShow: SplitRoadWizard.splitLayerStyling, | ||||||
|  |         }) | ||||||
|  | 
 | ||||||
|  |         | ||||||
|  | 
 | ||||||
|         /** |         /** | ||||||
|          * Handles a click on the overleaf map. |          * Handles a click on the overleaf map. | ||||||
|          * Finds the closest intersection with the road and adds a point there, ready to confirm the cut. |          * Finds the closest intersection with the road and adds a point there, ready to confirm the cut. | ||||||
|  | @ -109,10 +102,8 @@ export default class SplitRoadWizard extends Toggle { | ||||||
|             const pointOnRoad = GeoOperations.nearestPoint(roadElement, coordinates); // pointOnRoad is a geojson
 |             const pointOnRoad = GeoOperations.nearestPoint(roadElement, coordinates); // pointOnRoad is a geojson
 | ||||||
| 
 | 
 | ||||||
|             // Update point properties to let it match the layer
 |             // Update point properties to let it match the layer
 | ||||||
|             pointOnRoad.properties._cutposition = "yes"; |             pointOnRoad.properties["_split_point"] = "yes"; | ||||||
| 
 | 
 | ||||||
|             // let the state remember the point, to be able to retrieve it later by id
 |  | ||||||
|             State.state.allElements.addOrGetElement(pointOnRoad); |  | ||||||
| 
 | 
 | ||||||
|             // Add it to the list of all points and notify observers
 |             // Add it to the list of all points and notify observers
 | ||||||
|             splitPoints.data.push({feature: pointOnRoad, freshness: new Date()}); // show the point on the data layer
 |             splitPoints.data.push({feature: pointOnRoad, freshness: new Date()}); // show the point on the data layer
 | ||||||
|  |  | ||||||
							
								
								
									
										20
									
								
								assets/layers/split_point/split_point.json
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								assets/layers/split_point/split_point.json
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,20 @@ | ||||||
|  | { | ||||||
|  |   "id": "split_point", | ||||||
|  |   "description": "Layer rendering the little scissors for the minimap in the 'splitRoadWizard'", | ||||||
|  |   "minzoom": 1, | ||||||
|  |   "source": { | ||||||
|  |     "osmTags": "_split_point=yes" | ||||||
|  |   }, | ||||||
|  |   "name": "Split point", | ||||||
|  |   "title": "Split point", | ||||||
|  |   "mapRendering": [ | ||||||
|  |     { | ||||||
|  |       "location": [ | ||||||
|  |         "point", | ||||||
|  |         "centroid" | ||||||
|  |       ], | ||||||
|  |       "icon":  "circle:white;./assets/svg/scissors.svg", | ||||||
|  |       "iconSize": "30,30,center" | ||||||
|  |     } | ||||||
|  |   ] | ||||||
|  | } | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue