2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  BaseUIElement  from  "../BaseUIElement"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  {  SubtleButton  }  from  "../Base/SubtleButton"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  {  UIEventSource  }  from  "../../Logic/UIEventSource"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  Combine  from  "../Base/Combine"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  {  VariableUiElement  }  from  "../Base/VariableUIElement"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  Translations  from  "../i18n/Translations"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  Toggle  from  "../Input/Toggle"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  CreateNewNodeAction  from  "../../Logic/Osm/Actions/CreateNewNodeAction"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  Loading  from  "../Base/Loading"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  {  OsmConnection  }  from  "../../Logic/Osm/OsmConnection"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  Lazy  from  "../Base/Lazy"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  ConfirmLocationOfPoint  from  "../NewPoint/ConfirmLocationOfPoint"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  Img  from  "../Base/Img"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  FilteredLayer  from  "../../Models/FilteredLayer"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  SpecialVisualizations  from  "../SpecialVisualizations"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  {  FixedUiElement  }  from  "../Base/FixedUiElement"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  Svg  from  "../../Svg"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  {  Utils  }  from  "../../Utils"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  Minimap  from  "../Base/Minimap"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  ShowDataLayer  from  "../ShowDataLayer/ShowDataLayer"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  StaticFeatureSource  from  "../../Logic/FeatureSource/Sources/StaticFeatureSource"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  ShowDataMultiLayer  from  "../ShowDataLayer/ShowDataMultiLayer"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  CreateWayWithPointReuseAction ,  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    MergePointConfig , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  from  "../../Logic/Osm/Actions/CreateWayWithPointReuseAction"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  OsmChangeAction  from  "../../Logic/Osm/Actions/OsmChangeAction"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  FeatureSource  from  "../../Logic/FeatureSource/FeatureSource"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  {  OsmObject ,  OsmWay  }  from  "../../Logic/Osm/OsmObject"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  FeaturePipelineState  from  "../../Logic/State/FeaturePipelineState"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  {  DefaultGuiState  }  from  "../DefaultGuiState"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  {  PresetInfo  }  from  "../BigComponents/SimpleAddUI"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  {  TagUtils  }  from  "../../Logic/Tags/TagUtils"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  {  And  }  from  "../../Logic/Tags/And"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  ReplaceGeometryAction  from  "../../Logic/Osm/Actions/ReplaceGeometryAction"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  CreateMultiPolygonWithPointReuseAction  from  "../../Logic/Osm/Actions/CreateMultiPolygonWithPointReuseAction"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  {  Tag  }  from  "../../Logic/Tags/Tag"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  TagApplyButton  from  "./TagApplyButton"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  LayerConfig  from  "../../Models/ThemeConfig/LayerConfig"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  *  as  conflation_json  from  "../../assets/layers/conflation/conflation.json"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  {  GeoOperations  }  from  "../../Logic/GeoOperations"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  {  LoginToggle  }  from  "./LoginButton"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  {  AutoAction  }  from  "./AutoApplyButton"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  LayoutConfig  from  "../../Models/ThemeConfig/LayoutConfig"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  {  Changes  }  from  "../../Logic/Osm/Changes"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  {  ElementStorage  }  from  "../../Logic/ElementStorage"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  Hash  from  "../../Logic/Web/Hash"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  {  PreciseInput  }  from  "../../Models/ThemeConfig/PresetConfig"  
						 
					
						
							
								
									
										
										
										
											2021-10-31 02:08:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-01-17 23:50:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/ * *  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  A  helper  class  for  the  various  import - flows . 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-25 21:55:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								 *  An  import - flow  always  starts  with  a  'Import this' - button .  Upon  click ,  a  custom  confirmation  panel  is  provided 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-17 23:50:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								 * / 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 13:16:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								abstract  class  AbstractImportButton  implements  SpecialVisualizations  {  
						 
					
						
							
								
									
										
										
										
											2022-02-10 23:16:14 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    protected  static  importedIds  =  new  Set < string > ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 13:16:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    public  readonly  funcName : string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    public  readonly  docs : string 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    public  readonly  args :  {  name : string ;  defaultValue? : string ;  doc : string  } [ ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    private  readonly  showRemovedTags : boolean 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    private  readonly  cannotBeImportedMessage : BaseUIElement  |  undefined 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    constructor ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        funcName : string , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        docsIntro : string , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        extraArgs :  {  name : string ;  doc : string ;  defaultValue? : string ;  required? : boolean  } [ ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        options ? :  {  showRemovedTags? : true  |  boolean ;  cannotBeImportedMessage? : BaseUIElement  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 13:16:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . funcName  =  funcName 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . showRemovedTags  =  options ? . showRemovedTags  ? ?  true 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-08 12:53:04 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . cannotBeImportedMessage  =  options ? . cannotBeImportedMessage 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 13:16:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . docs  =  ` ${ docsIntro } 
 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-31 02:08:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 13:16:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Note  that  the  contributor  must  zoom  to  at  least  zoomlevel  18  to  be  able  to  use  this  functionality .  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								It  is  only  functional  in  official  themes ,  but  can  be  tested  in  unoffical  themes .  
						 
					
						
							
								
									
										
										
										
											2021-10-31 02:08:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# # # #  Specifying  which  tags  to  copy  or  add  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-01-10 19:10:13 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								The  argument  \ ` tags \`  of the import button takes a  \` ; \` -seperated list of tags to add (or the name of a property which contains a JSON-list of properties).
  
						 
					
						
							
								
									
										
										
										
											2021-10-31 02:08:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$ { Utils . Special_visualizations_tagsToApplyHelpText }  
						 
					
						
							
								
									
										
										
										
											2021-12-09 13:16:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								$ { Utils . special_visualizations_importRequirementDocs }  
						 
					
						
							
								
									
										
										
										
											2021-10-31 02:08:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								` 
  
						 
					
						
							
								
									
										
										
										
											2021-12-09 13:16:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . args  =  [ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                name :  "targetLayer" , 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-29 00:20:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                doc :  "The id of the layer where this point should end up. This is not very strict, it will simply result in checking that this layer is shown preventing possible duplicate elements" , 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                required : true , 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 13:16:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                name :  "tags" , 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-29 00:20:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                doc :  "The tags to add onto the new object - see specification above. If this is a key (a single word occuring in the properties of the object), the corresponding value is taken and expanded instead" , 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                required : true , 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 13:16:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                name :  "text" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                doc :  "The text to show on the button" , 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                defaultValue :  "Import this data into OpenStreetMap" , 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 13:16:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                name :  "icon" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                doc :  "A nice icon to show in the button" , 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                defaultValue :  "./assets/svg/addSmall.svg" , 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 13:16:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            } , 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            . . . extraArgs , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-03 00:44:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    abstract  constructElement ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        state : FeaturePipelineState , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        args :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            max_snap_distance : string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            snap_onto_layers : string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            icon : string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            text : string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            tags : string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            newTags : UIEventSource < any > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            targetLayer : string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        tagSource : UIEventSource < any > , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        guiState : DefaultGuiState , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        feature : any , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        onCancelClicked :  ( )  = >  void 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ) :  BaseUIElement 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-03 00:44:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-01-12 02:31:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    constr ( state ,  tagSource : UIEventSource < any > ,  argsRaw ,  guiState )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 13:16:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        / * * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								         *  Some  generic  import  button  pre - validation  is  implemented  here : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								         *  -  Are  we  logged  in ? 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								         *  -  Did  the  user  zoom  in  enough ? 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								         *  . . . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								         * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								         *  The  actual  import  flow  ( showing  the  conflation  map ,  special  cases )  are  handled  in  'constructElement' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								         * / 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-03 00:44:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        const  t  =  Translations . t . general . add . import 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        const  t0  =  Translations . t . general . add 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        const  args  =  this . parseArgs ( argsRaw ,  tagSource ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 13:16:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            // Some initial validation
 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            if  ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                ! state . layoutToUse . official  && 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                ! ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    state . featureSwitchIsTesting . data  || 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    state . osmConnection . _oauth_config . url  === 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        OsmConnection . oauth_configs [ "osm-test" ] . url 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 13:16:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                return  new  Combine ( [ t . officialThemesOnly . SetClass ( "alert" ) ,  t . howToTest ] ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            const  targetLayer : FilteredLayer  =  state . filteredLayers . data . filter ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                ( fl )  = >  fl . layerDef . id  ===  args . targetLayer 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            ) [ 0 ] 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-03 00:44:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            if  ( targetLayer  ===  undefined )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 13:16:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                const  e  =  ` Target layer not defined: error in import button for theme:  ${ state . layoutToUse . id } : layer  ${ args . targetLayer }  not found ` 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-03 00:44:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                console . error ( e ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                return  new  FixedUiElement ( e ) . SetClass ( "alert" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-31 02:08:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 13:16:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        let  img : BaseUIElement 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( args . icon  !==  undefined  &&  args . icon  !==  "" )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            img  =  new  Img ( args . icon ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            img  =  Svg . add_ui ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        const  inviteToImportButton  =  new  SubtleButton ( img ,  args . text ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-31 02:08:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        const  id  =  tagSource . data . id 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 13:16:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        const  feature  =  state . allElements . ContainingFeatures . get ( id ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        // Explanation of the tags that will be applied onto the imported/conflated object
 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-25 21:55:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        let  tagSpec  =  args . tags 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            tagSpec . indexOf ( " " )  <  0  && 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            tagSpec . indexOf ( ";" )  <  0  && 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            tagSource . data [ args . tags ]  !==  undefined 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-12 02:31:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            // This is probably a key
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            tagSpec  =  tagSource . data [ args . tags ] 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            console . debug ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                "The import button is using tags from properties["  + 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    args . tags  + 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    "] of this object, namely " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                tagSpec 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-12 02:31:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-18 02:31:45 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        const  importClicked  =  new  UIEventSource ( false ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 13:16:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        inviteToImportButton . onClick ( ( )  = >  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            importClicked . setData ( true ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 13:16:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-18 02:31:45 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        const  pleaseLoginButton  =  new  Toggle ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            t0 . pleaseLogin 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 13:16:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . onClick ( ( )  = >  state . osmConnection . AttemptLogin ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . SetClass ( "login-button-friendly" ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            undefined , 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            state . featureSwitchUserbadge 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-31 02:08:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        const  isImported  =  tagSource . map ( ( tags )  = >  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-10 23:16:14 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            AbstractImportButton . importedIds . add ( tags . id ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            return  tags . _imported  ===  "yes" 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-10 23:16:14 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 13:16:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        /**** THe actual panel showing the import guiding map ****/ 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        const  importGuidingPanel  =  this . constructElement ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            state , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            args , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            tagSource , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            guiState , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            feature , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            ( )  = >  importClicked . setData ( false ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-10-31 02:08:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        const  importFlow  =  new  Toggle ( 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 13:16:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            new  Toggle ( 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                new  Loading ( t0 . stillLoading ) , 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-17 23:50:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                importGuidingPanel , 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                state . featurePipeline . runningQuery 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            ) , 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 13:16:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            inviteToImportButton , 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-31 02:08:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            importClicked 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-31 02:08:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 13:16:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        return  new  Toggle ( 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-17 23:50:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            new  LoginToggle ( 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 13:16:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                new  Toggle ( 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    new  Toggle ( t . hasBeenImported ,  importFlow ,  isImported ) , 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-19 23:43:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    t . zoomInMore . SetClass ( "alert block" ) , 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    state . locationControl . map ( ( l )  = >  l . zoom  >=  18 ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 13:16:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                pleaseLoginButton , 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-17 23:50:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                state 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 13:16:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            ) , 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-08 12:53:04 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            this . cannotBeImportedMessage  ? ?  t . wrongType , 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            new  UIEventSource ( this . canBeImported ( feature ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 13:16:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-31 02:08:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 13:16:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    getLayerDependencies ( argsRaw : string [ ] )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        const  args  =  this . parseArgs ( argsRaw ,  undefined ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-06 14:14:41 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 13:16:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        const  dependsOnLayers : string [ ]  =  [ ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        // The target layer
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        dependsOnLayers . push ( args . targetLayer ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        const  snapOntoLayers  =  args . snap_onto_layers ? . trim ( )  ? ?  "" 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 13:16:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( snapOntoLayers  !==  "" )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            dependsOnLayers . push ( . . . snapOntoLayers . split ( ";" ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  dependsOnLayers 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    protected  abstract  canBeImported ( feature : any ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    protected  createConfirmPanelForWay ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        state : FeaturePipelineState , 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        args :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            max_snap_distance : string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            snap_onto_layers : string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            icon : string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            text : string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            newTags : UIEventSource < Tag [ ] > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            targetLayer : string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } , 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        feature : any , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        originalFeatureTags : UIEventSource < any > , 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        action : OsmChangeAction  &  {  getPreview ( ) :  Promise < FeatureSource > ;  newElementId? : string  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        onCancel :  ( )  = >  void 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ) :  BaseUIElement  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        const  self  =  this 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        const  confirmationMap  =  Minimap . createMiniMap ( { 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-23 03:36:03 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            allowMoving : state.featureSwitchIsDebugging.data  ? ?  false , 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            background : state.backgroundLayer , 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        confirmationMap . SetStyle ( "height: 20rem; overflow: hidden" ) . SetClass ( "rounded-xl" ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 13:16:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        // SHow all relevant data - including (eventually) the way of which the geometry will be replaced
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        new  ShowDataMultiLayer ( { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            leafletMap : confirmationMap.leafletMap , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            zoomToFeatures : true , 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-05 02:24:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            features : StaticFeatureSource.fromGeojson ( [ feature ] ) , 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-19 20:34:04 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            state : state , 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            layers : state.filteredLayers , 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-29 16:38:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        action . getPreview ( ) . then ( ( changePreview )  = >  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            new  ShowDataLayer ( { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                leafletMap : confirmationMap.leafletMap , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                zoomToFeatures : false , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                features : changePreview , 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-19 20:34:04 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                state , 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                layerToShow : new  LayerConfig ( conflation_json ,  "all_known_layers" ,  true ) , 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 13:16:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        const  tagsExplanation  =  new  VariableUiElement ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            args . newTags . map ( ( tagsToApply )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                const  filteredTags  =  tagsToApply . filter ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    ( t )  = >  self . showRemovedTags  ||  ( t . value  ? ?  "" )  !==  "" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                const  tagsStr  =  new  And ( filteredTags ) . asHumanString ( false ,  true ,  { } ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                return  Translations . t . general . add . import . importTags . Subs ( {  tags : tagsStr  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        ) . SetClass ( "subtle" ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        const  confirmButton  =  new  SubtleButton ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            new  Img ( args . icon ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            new  Combine ( [ args . text ,  tagsExplanation ] ) . SetClass ( "flex flex-col" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        confirmButton . onClick ( async  ( )  = >  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 13:16:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            { 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                originalFeatureTags . data [ "_imported" ]  =  "yes" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                originalFeatureTags . ping ( )  // will set isImported as per its definition
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                state . changes . applyAction ( action ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-24 02:51:10 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                const  newId  =  action . newElementId  ? ?  action . mainObjectId 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                state . selectedElement . setData ( state . allElements . ContainingFeatures . get ( newId ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 13:16:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        const  cancel  =  new  SubtleButton ( Svg . close_ui ( ) ,  Translations . t . general . cancel ) . onClick ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            onCancel 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        return  new  Combine ( [ confirmationMap ,  confirmButton ,  cancel ] ) . SetClass ( "flex flex-col" ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 13:16:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-25 21:55:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    protected  parseArgs ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        argsRaw : string [ ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        originalFeatureTags : UIEventSource < any > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ) :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        minzoom : string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        max_snap_distance : string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        snap_onto_layers : string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        icon : string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        text : string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        tags : string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        targetLayer : string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        newTags : UIEventSource < Tag [ ] > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-25 21:55:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        const  baseArgs  =  Utils . ParseVisArgs ( this . args ,  argsRaw ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( originalFeatureTags  !==  undefined )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            const  tags  =  baseArgs . tags 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            if  ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                tags . indexOf ( " " )  <  0  && 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                tags . indexOf ( ";" )  <  0  && 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                originalFeatureTags . data [ tags ]  !==  undefined 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-25 21:55:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                // This might be a property to expand...
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                const  items : string  =  originalFeatureTags . data [ tags ] 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                console . debug ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    "The import button is using tags from properties["  + 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        tags  + 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        "] of this object, namely " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    items 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-25 21:55:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                baseArgs [ "newTags" ]  =  TagApplyButton . generateTagsToApply ( items ,  originalFeatureTags ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                baseArgs [ "newTags" ]  =  TagApplyButton . generateTagsToApply ( tags ,  originalFeatureTags ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  baseArgs 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 13:16:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								export  class  ConflateButton  extends  AbstractImportButton  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    constructor ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        super ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            "conflate_button" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            "This button will modify the geometry of an existing OSM way to match the specified geometry. This can conflate OSM-ways with LineStrings and Polygons (only simple polygons with one single ring). An attempt is made to move points with special values to a decent new location (e.g. entrances)" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            [ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    name :  "way_to_conflate" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    doc :  "The key, of which the corresponding value is the id of the OSM-way that must be conflated; typically a calculatedTag" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            ] , 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-08 12:53:04 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            { 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                cannotBeImportedMessage : Translations.t.general.add.import.wrongTypeToConflate , 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-08 12:53:04 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-03 00:44:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-23 03:36:03 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    getLayerDependencies ( argsRaw : string [ ] ) :  string [ ]  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        const  deps  =  super . getLayerDependencies ( argsRaw ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-23 03:36:03 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        // Force 'type_node' as dependency
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        deps . push ( "type_node" ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        return  deps 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-23 03:36:03 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    constructElement ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        state : FeaturePipelineState , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        args :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            max_snap_distance : string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            snap_onto_layers : string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            icon : string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            text : string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            tags : string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            newTags : UIEventSource < Tag [ ] > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            targetLayer : string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        tagSource : UIEventSource < any > , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        guiState : DefaultGuiState , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        feature : any , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        onCancelClicked :  ( )  = >  void 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ) :  BaseUIElement  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        const  nodesMustMatch  =  args . snap_onto_layers 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            ? . split ( ";" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            ? . map ( ( tag ,  i )  = >  TagUtils . Tag ( tag ,  "TagsSpec for import button "  +  i ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        const  mergeConfigs  =  [ ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( nodesMustMatch  !==  undefined  &&  nodesMustMatch . length  >  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            const  mergeConfig : MergePointConfig  =  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                mode : args [ "point_move_mode" ]  ==  "move_osm"  ?  "move_osm_point"  :  "reuse_osm_point" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                ifMatches : new  And ( nodesMustMatch ) , 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                withinRangeOfM : Number ( args . max_snap_distance ) , 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            mergeConfigs . push ( mergeConfig ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-03 00:44:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        const  key  =  args [ "way_to_conflate" ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        const  wayToConflate  =  tagSource . data [ key ] 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        feature  =  GeoOperations . removeOvernoding ( feature ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        const  action  =  new  ReplaceGeometryAction ( state ,  feature ,  wayToConflate ,  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            theme : state.layoutToUse.id , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            newTags : args.newTags.data , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  this . createConfirmPanelForWay ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            state , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            args , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            feature , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            tagSource , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            action , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            onCancelClicked 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-03 00:44:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-01-25 21:55:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    protected  canBeImported ( feature : any )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        return  ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            feature . geometry . type  ===  "LineString"  || 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            ( feature . geometry . type  ===  "Polygon"  &&  feature . geometry . coordinates . length  ===  1 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-25 21:55:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2021-12-09 13:16:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-10 23:16:14 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								export  class  ImportWayButton  extends  AbstractImportButton  implements  AutoAction  {  
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    public  readonly  supportsAutoAction  =  true 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 13:16:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    constructor ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        super ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            "import_way_button" , 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            "This button will copy the data from an external dataset into OpenStreetMap" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            [ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    name :  "snap_to_point_if" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    doc :  "Points with the given tags will be snapped to or moved" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    name :  "max_snap_distance" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    doc :  "If the imported object is a LineString or (Multi)Polygon, already existing OSM-points will be reused to construct the geometry of the newly imported way" , 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    defaultValue :  "0.05" , 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    name :  "move_osm_point_if" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    doc :  "Moves the OSM-point to the newly imported point if these conditions are met" , 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    name :  "max_move_distance" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    doc :  "If an OSM-point is moved, the maximum amount of meters it is moved. Capped on 20m" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    defaultValue :  "0.05" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    name :  "snap_onto_layers" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    doc :  "If no existing nearby point exists, but a line of a specified layer is closeby, snap to this layer instead" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    name :  "snap_to_layer_max_distance" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    doc :  "Distance to distort the geometry to snap to this layer" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    defaultValue :  "0.1" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            {  showRemovedTags : false  } 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 13:16:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    private  static  CreateAction ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        feature , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        args :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            max_snap_distance : string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            snap_onto_layers : string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            icon : string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            text : string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            tags : string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            newTags : UIEventSource < any > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            targetLayer : string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        state : FeaturePipelineState , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        mergeConfigs : any [ ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-29 00:20:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        const  coors  =  feature . geometry . coordinates 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( feature . geometry . type  ===  "Polygon"  &&  coors . length  >  1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-29 00:20:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            const  outer  =  coors [ 0 ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            const  inner  =  [ . . . coors ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            inner . splice ( 0 ,  1 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            return  new  CreateMultiPolygonWithPointReuseAction ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                args . newTags . data , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                outer , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                inner , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                state , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                mergeConfigs , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                "import" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  else  if  ( feature . geometry . type  ===  "Polygon" )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            const  outer  =  coors [ 0 ] 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            return  new  CreateWayWithPointReuseAction ( args . newTags . data ,  outer ,  state ,  mergeConfigs ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-29 00:20:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        }  else  if  ( feature . geometry . type  ===  "LineString" )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            return  new  CreateWayWithPointReuseAction ( args . newTags . data ,  coors ,  state ,  mergeConfigs ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-29 00:20:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            throw  "Unsupported type" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    async  applyActionOn ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        state :  {  layoutToUse : LayoutConfig ;  changes : Changes ;  allElements : ElementStorage  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        originalFeatureTags : UIEventSource < any > , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        argument : string [ ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ) :  Promise < void >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        const  id  =  originalFeatureTags . data . id 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( AbstractImportButton . importedIds . has ( originalFeatureTags . data . id ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            return 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-10 23:16:14 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        AbstractImportButton . importedIds . add ( originalFeatureTags . data . id ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        const  args  =  this . parseArgs ( argument ,  originalFeatureTags ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        const  feature  =  state . allElements . ContainingFeatures . get ( id ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        const  mergeConfigs  =  this . GetMergeConfig ( args ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-22 14:13:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        const  action  =  ImportWayButton . CreateAction ( 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-10 23:16:14 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            feature , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            args , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            < FeaturePipelineState > state , 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-22 14:13:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            mergeConfigs 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-10 23:16:14 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        await  state . changes . applyAction ( action ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    canBeImported ( feature : any )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        const  type  =  feature . geometry . type 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  type  ===  "LineString"  ||  type  ===  "Polygon" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 13:16:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    getLayerDependencies ( argsRaw : string [ ] ) :  string [ ]  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        const  deps  =  super . getLayerDependencies ( argsRaw ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        deps . push ( "type_node" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  deps 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 13:16:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    constructElement ( state ,  args ,  originalFeatureTags ,  guiState ,  feature ,  onCancel ) :  BaseUIElement  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        const  geometry  =  feature . geometry 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-07 16:34:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( ! ( geometry . type  ==  "LineString"  ||  geometry . type  ===  "Polygon" ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            console . error ( "Invalid type to import" ,  geometry . type ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            return  new  FixedUiElement ( "Invalid geometry type:"  +  geometry . type ) . SetClass ( "alert" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-03 00:44:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        // Upload the way to OSM
 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        const  mergeConfigs  =  this . GetMergeConfig ( args ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        let  action  =  ImportWayButton . CreateAction ( feature ,  args ,  state ,  mergeConfigs ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-10 23:16:14 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        return  this . createConfirmPanelForWay ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            state , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            args , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            feature , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            originalFeatureTags , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            action , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            onCancel 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    private  GetMergeConfig ( args :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        max_snap_distance : string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        snap_onto_layers : string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        icon : string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        text : string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        tags : string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        newTags : UIEventSource < any > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        targetLayer : string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } ) :  MergePointConfig [ ]  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        const  nodesMustMatch  =  args [ "snap_to_point_if" ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            ? . split ( ";" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            ? . map ( ( tag ,  i )  = >  TagUtils . Tag ( tag ,  "TagsSpec for import button "  +  i ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-07 16:34:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        const  mergeConfigs  =  [ ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( nodesMustMatch  !==  undefined  &&  nodesMustMatch . length  >  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            const  mergeConfig : MergePointConfig  =  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                mode :  "reuse_osm_point" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                ifMatches : new  And ( nodesMustMatch ) , 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                withinRangeOfM : Number ( args . max_snap_distance ) , 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            mergeConfigs . push ( mergeConfig ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-24 02:51:01 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        const  moveOsmPointIfTags  =  args [ "move_osm_point_if" ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            ? . split ( ";" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            ? . map ( ( tag ,  i )  = >  TagUtils . Tag ( tag ,  "TagsSpec for import button "  +  i ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-07 16:34:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( nodesMustMatch  !==  undefined  &&  moveOsmPointIfTags . length  >  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-24 02:51:01 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            const  moveDistance  =  Math . min ( 20 ,  Number ( args [ "max_move_distance" ] ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            const  mergeConfig : MergePointConfig  =  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-24 02:51:01 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                mode :  "move_osm_point" , 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                ifMatches : new  And ( moveOsmPointIfTags ) , 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                withinRangeOfM : moveDistance , 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-03 00:44:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            mergeConfigs . push ( mergeConfig ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-03 00:44:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        return  mergeConfigs 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-10 23:16:14 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2021-11-03 00:44:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								export  class  ImportPointButton  extends  AbstractImportButton  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    constructor ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        super ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            "import_button" , 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            "This button will copy the point from an external dataset into OpenStreetMap" , 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-29 00:20:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            [ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    name :  "snap_onto_layers" , 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    doc :  "If a way of the given layer(s) is closeby, will snap the new point onto this way (similar as preset might snap). To show multiple layers to snap onto, use a `;`-seperated list" , 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-29 00:20:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                } , 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    name :  "max_snap_distance" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    doc :  "The maximum distance that the imported point will be moved to snap onto a way in an already existing layer (in meters). This is previewed to the contributor, similar to the 'add new point'-action of MapComplete" , 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    defaultValue :  "5" , 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-29 00:20:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    name :  "note_id" , 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    doc :  "If given, this key will be read. The corresponding note on OSM will be closed, stating 'imported'" , 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-29 00:20:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                } , 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-13 08:03:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                { 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    name :  "location_picker" , 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-29 00:20:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    defaultValue :  "photo" , 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    doc :  "Chooses the background for the precise location picker, options are 'map', 'photo' or 'osmbasedmap' or 'none' if the precise input picker should be disabled" , 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-13 08:03:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    name :  "maproulette_id" , 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    doc :  "If given, the maproulette challenge will be marked as fixed" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            {  showRemovedTags : false  } 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-03 00:44:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    private  static  createConfirmPanelForPoint ( 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        args :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            max_snap_distance : string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            snap_onto_layers : string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            icon : string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            text : string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            newTags : UIEventSource < any > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            targetLayer : string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            note_id : string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            maproulette_id : string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } , 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        state : FeaturePipelineState , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        guiState : DefaultGuiState , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        originalFeatureTags : UIEventSource < any > , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        feature : any , 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-08 04:22:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        onCancel :  ( )  = >  void , 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        close :  ( )  = >  void 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ) :  BaseUIElement  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        async  function  confirm ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            tags : any [ ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            location :  {  lat : number ;  lon : number  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            snapOntoWayId : string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            originalFeatureTags . data [ "_imported" ]  =  "yes" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            originalFeatureTags . ping ( )  // will set isImported as per its definition
 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 13:16:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            let  snapOnto : OsmObject  =  undefined 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            if  ( snapOntoWayId  !==  undefined )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                snapOnto  =  await  OsmObject . DownloadObjectAsync ( snapOntoWayId ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-05 05:21:03 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-25 00:48:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            let  specialMotivation  =  undefined 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-01 00:09:28 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            let  note_id  =  args . note_id 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-10 23:16:14 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            if  ( args . note_id  !==  undefined  &&  isNaN ( Number ( args . note_id ) ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-01 00:09:28 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                note_id  =  originalFeatureTags . data [ args . note_id ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                specialMotivation  =  "source: https://osm.org/note/"  +  note_id 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-25 00:48:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-10 23:16:14 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-05 05:21:03 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            const  newElementAction  =  new  CreateNewNodeAction ( tags ,  location . lat ,  location . lon ,  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                theme : state.layoutToUse.id , 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-05 05:21:03 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                changeType :  "import" , 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-25 00:48:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                snapOnto :  < OsmWay > snapOnto , 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                specialMotivation : specialMotivation , 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-03 00:44:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            await  state . changes . applyAction ( newElementAction ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            state . selectedElement . setData ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                state . allElements . ContainingFeatures . get ( newElementAction . newElementId ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-24 02:51:10 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            Hash . hash . setData ( newElementAction . newElementId ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-29 00:20:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-01 00:09:28 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            if  ( note_id  !==  undefined )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-25 21:55:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                state . osmConnection . closeNote ( note_id ,  "imported" ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-12 02:31:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                originalFeatureTags . data [ "closed_at" ]  =  new  Date ( ) . toISOString ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                originalFeatureTags . ping ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-13 08:03:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            let  maproulette_id  =  originalFeatureTags . data [ args . maproulette_id ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            console . log ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                "Checking if we need to mark a maproulette task as fixed ("  +  maproulette_id  +  ")" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-13 08:03:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            if  ( maproulette_id  !==  undefined )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                if  ( state . featureSwitchIsTesting . data )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    console . log ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        "Not marking maproulette task "  + 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            maproulette_id  + 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            " as fixed, because we are in testing mode" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-27 10:24:58 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    console . log ( "Marking maproulette task as fixed" ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    state . maprouletteConnection . closeTask ( Number ( maproulette_id ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    originalFeatureTags . data [ "mr_taskStatus" ]  =  "Fixed" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    originalFeatureTags . ping ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-27 10:24:58 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                } 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-13 08:03:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-31 02:08:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-29 00:20:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        let  preciseInputOption  =  args [ "location_picker" ] 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        let  preciseInputSpec : PreciseInput  =  undefined 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-29 00:20:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        console . log ( "Precise input location is " ,  preciseInputOption ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( preciseInputOption  !==  "none" )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-29 00:20:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            preciseInputSpec  =  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                snapToLayers : args.snap_onto_layers?.split ( ";" ) , 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                maxSnapDistance : Number ( args . max_snap_distance ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                preferredBackground : args [ "location_picker" ]  ? ?  [ "photo" ,  "map" ] , 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-29 00:20:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-03 00:44:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        const  presetInfo  =  < PresetInfo > { 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            tags : args.newTags.data , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            icon :  ( )  = >  new  Img ( args . icon ) , 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            layerToAddTo : state.filteredLayers.data.filter ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                ( l )  = >  l . layerDef . id  ===  args . targetLayer 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            ) [ 0 ] , 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            name : args.text , 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-21 12:39:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            title : Translations.T ( args . text ) , 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-29 00:20:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            preciseInput : preciseInputSpec ,  // must be explicitely assigned, if 'undefined' won't work otherwise
 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            boundsFactor : 3 , 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-31 02:08:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-03 00:44:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        const  [ lon ,  lat ]  =  feature . geometry . coordinates 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        return  new  ConfirmLocationOfPoint ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            state , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            guiState . filterViewIsOpened , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            presetInfo , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            Translations . W ( args . text ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                lon , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                lat , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            confirm , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            onCancel , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            close 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-01-25 21:55:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    canBeImported ( feature : any )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  feature . geometry . type  ===  "Point" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    getLayerDependencies ( argsRaw : string [ ] ) :  string [ ]  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        const  deps  =  super . getLayerDependencies ( argsRaw ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-25 21:55:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        const  layerSnap  =  argsRaw [ "snap_onto_layers" ]  ? ?  "" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( layerSnap  ===  "" )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            return  deps 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        deps . push ( . . . layerSnap . split ( ";" ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  deps 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    constructElement ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        state , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        args , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        originalFeatureTags , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        guiState , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        feature , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        onCancel :  ( )  = >  void 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ) :  BaseUIElement  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        const  geometry  =  feature . geometry 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( geometry . type  ===  "Point" )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            return  new  Lazy ( ( )  = > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                ImportPointButton . createConfirmPanelForPoint ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    args , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    state , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    guiState , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    originalFeatureTags , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    feature , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    onCancel , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        // Close the current popup
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        state . selectedElement . setData ( undefined ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        console . error ( "Invalid type to import" ,  geometry . type ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  new  FixedUiElement ( "Invalid geometry type:"  +  geometry . type ) . SetClass ( "alert" ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-31 02:08:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}