/// <summary> Removes a geocoding results layer from the map. </summary> /// <param name="wpfMap"> The map. </param> /// <param name="singleField"> True if the single field geocoder should be removed, false if the multi field geocoder should be removed. </param> public void Remove(WpfMap wpfMap, bool singleField) { if (singleField) { sfg?.Remove(wpfMap); sfg = null; } else { mfg?.Remove(wpfMap); mfg = null; } }
/// <summary> Adds a geocoding results layer to the given map. </summary> /// <param name="wpfMap"> The map. </param> /// <param name="layerName"> The name of the geocoding layer. </param> /// <param name="singleField"> True for a single field geocoder, false for a multi field geocoder. </param> public void AddTo(WpfMap wpfMap, string layerName, bool singleField) { if (wpfMap == null) { return; } if (singleField) { sfg?.Remove(wpfMap); sfg = new SingleFieldGeocoder(DisplayError, SetMapEnvelopeToResult, wpfMap); } else { mfg?.Remove(wpfMap); mfg = new MultiFieldGeocoder(DisplayError, SetMapEnvelopeToResult, wpfMap); } _wpfMap = wpfMap; }