forked from MapComplete/MapComplete
		
	Add propagation of metadata in changedescriptions, aggregate metadata in changeset tags
This commit is contained in:
		
							parent
							
								
									81f3ec385f
								
							
						
					
					
						commit
						21fd148f38
					
				
					 19 changed files with 545 additions and 403 deletions
				
			
		|  | @ -14,16 +14,19 @@ interface SplitInfo { | |||
| export default class SplitAction extends OsmChangeAction { | ||||
|     private readonly wayId: string; | ||||
|     private readonly _splitPointsCoordinates: [number, number] []// lon, lat
 | ||||
|     private _meta: { theme: string, changeType: "split" }; | ||||
| 
 | ||||
|     /** | ||||
|      *  | ||||
|      * @param wayId | ||||
|      * @param splitPointCoordinates: lon, lat | ||||
|      * @param meta | ||||
|      */ | ||||
|     constructor(wayId: string, splitPointCoordinates: [number, number][]) { | ||||
|     constructor(wayId: string, splitPointCoordinates: [number, number][], meta: {theme: string}) { | ||||
|         super() | ||||
|         this.wayId = wayId; | ||||
|         this._splitPointsCoordinates = splitPointCoordinates | ||||
|         this._meta = {...meta, changeType: "split"}; | ||||
|     } | ||||
| 
 | ||||
|     private static SegmentSplitInfo(splitInfo: SplitInfo[]): SplitInfo[][] { | ||||
|  | @ -89,7 +92,8 @@ export default class SplitAction extends OsmChangeAction { | |||
|                 changes: { | ||||
|                     lon: element.lngLat[0], | ||||
|                     lat: element.lngLat[1] | ||||
|                 } | ||||
|                 }, | ||||
|                 meta: this._meta | ||||
|             }) | ||||
|         } | ||||
| 
 | ||||
|  | @ -110,7 +114,8 @@ export default class SplitAction extends OsmChangeAction { | |||
|                     changes: { | ||||
|                         coordinates: wayPart.map(p => p.lngLat), | ||||
|                         nodes: nodeIds | ||||
|                     } | ||||
|                     }, | ||||
|                     meta: this._meta | ||||
|                 }) | ||||
|                 allWayIdsInOrder.push(originalElement.id) | ||||
|                 allWaysNodesInOrder.push(nodeIds) | ||||
|  | @ -135,7 +140,8 @@ export default class SplitAction extends OsmChangeAction { | |||
|                     changes: { | ||||
|                         coordinates: wayPart.map(p => p.lngLat), | ||||
|                         nodes: nodeIds | ||||
|                     } | ||||
|                     }, | ||||
|                     meta: this._meta | ||||
|                 }) | ||||
| 
 | ||||
|                 allWayIdsInOrder.push(id) | ||||
|  | @ -152,8 +158,8 @@ export default class SplitAction extends OsmChangeAction { | |||
|                 allWayIdsInOrder: allWayIdsInOrder, | ||||
|                 originalNodes: originalNodes, | ||||
|                 allWaysNodesInOrder: allWaysNodesInOrder, | ||||
|                 originalWayId: originalElement.id | ||||
|             }).CreateChangeDescriptions(changes) | ||||
|                 originalWayId: originalElement.id, | ||||
|             }, this._meta.theme).CreateChangeDescriptions(changes) | ||||
|             changeDescription.push(...changDescrs) | ||||
|         } | ||||
| 
 | ||||
|  | @ -240,7 +246,6 @@ export default class SplitAction extends OsmChangeAction { | |||
|                 closest = prevPoint | ||||
|             } | ||||
|             // Ok, we have a closest point!
 | ||||
|              | ||||
|             if(closest.originalIndex === 0 || closest.originalIndex === originalPoints.length){ | ||||
|                 // We can not split on the first or last points...
 | ||||
|                 continue | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue