private Graphic CreateStopGraphic(MapPoint location, int id) { var symbol = new PictureMarkerSymbol() { Width = 48, Height = 48, YOffset = 24 }; symbol.SetSourceAsync(new Uri("ms-appx:///Assets/CollPin.png")); if (_stopsOverlay.Graphics.Count() < 1) { var graphic = new Graphic() { Geometry = location, }; return(graphic); } else { var graphic = new Graphic() { Geometry = location, Symbol = symbol }; return(graphic); } }
private async void FindAddressButton_Click(object sender, RoutedEventArgs e) { OnlineLocatorTask locator = GetLocation(); var findParams = new OnlineLocatorFindParameters(AddressTextBox.Text); findParams.OutSpatialReference = MyMapView.SpatialReference; findParams.SourceCountry = "US"; var results = await locator.FindAsync(findParams, new System.Threading.CancellationToken()); if (results.Count > 0) { var firstMatch = results[0].Feature; var matchLocation = firstMatch.Geometry as MapPoint; var matchSym = new PictureMarkerSymbol(); var pictureURI = new Uri("http://static.arcgis.com/images/Symbols/Basic/GreenStickpin.png"); await matchSym.SetSourceAsync(pictureURI); var matchGraphic = new Graphic(matchLocation, matchSym); var graphicsLayer = MyMap.Layers["GeocodeResults"] as GraphicsLayer; graphicsLayer.Graphics.Add(matchGraphic); var matchExtent = new Envelope(matchLocation.X - 100, matchLocation.Y - 100, matchLocation.X + 100, matchLocation.Y + 100); await MyMapView.SetViewAsync(matchExtent); } }
private Graphic CreateGraphic(Dictionary <string, object> attributes, double latitude, double longitude, string iconPath, int?countSymbol = 0) { CompositeSymbol compositeSymbol = new CompositeSymbol(); PictureMarkerSymbol pictureMarkerSymbol = new PictureMarkerSymbol(); TextSymbol textSymbol = new TextSymbol(); pictureMarkerSymbol.SetSourceAsync(new Uri(iconPath)); compositeSymbol.Symbols.Add(pictureMarkerSymbol); if (countSymbol.HasValue && countSymbol != 0) { textSymbol.Text = countSymbol.ToString(); textSymbol.HorizontalTextAlignment = HorizontalTextAlignment.Center; textSymbol.VerticalTextAlignment = VerticalTextAlignment.Middle; textSymbol.Font.FontSize = 18; textSymbol.YOffset = 7; textSymbol.Color = (Color)ColorConverter.ConvertFromString("#d91e18"); compositeSymbol.Symbols.Add(textSymbol); } var graphics = new Graphic(new MapPoint(longitude, latitude, new SpatialReference(4326)), compositeSymbol); foreach (KeyValuePair <string, object> item in attributes) { graphics.Attributes.Add(item.Key, item.Value); } graphics.ZIndex = MARKER_Z_INDEX; return(graphics); }
private async Task SetupSymbols() { _pinSymbol = new PictureMarkerSymbol() { Width = 48, Height = 48, YOffset = 24 }; await _pinSymbol.SetSourceAsync(new Uri("pack://application:,,,/ArcGISRuntimeSDKDotNet_DesktopSamples;component/Assets/RedStickpin.png")); _bufferSymbol = layoutGrid.Resources["BufferSymbol"] as SimpleFillSymbol; }
private Graphic GenerateGraphic(Diamond2EntityItem item) { MapPoint point = new MapPoint(item.Longitude, item.Latitude, SpatialReferences.Wgs84); var graphic = new Graphic(point); if (Validation.IsValidFloat(item.WindAngle)) { var symbol = new PictureMarkerSymbol(); symbol.SetSourceAsync(new Uri("pack://application:,,,/Pmss.Micaps.Render;component/Img/Wind.png")).GetAwaiter().GetResult(); symbol.Angle = item.WindAngle; graphic.Symbol = symbol; } else { var symbol = new SimpleMarkerSymbol { Style = SimpleMarkerStyle.Circle, Color = Colors.Black }; graphic.Symbol = symbol; } graphic.Attributes[Diamond2Attributes.StationNumber] = item.StationNumber; graphic.Attributes[Diamond2Attributes.Temperature] = Validation.IsValidFloat(item.Temperature) ? item.Temperature.ToString() : string.Empty; graphic.Attributes[Diamond2Attributes.TemperatureDiff] = Validation.IsValidFloat(item.TemperatureDiff) ? item.TemperatureDiff.ToString() : string.Empty; graphic.Attributes[Diamond2Attributes.Height] = Validation.IsValidFloat(item.Height) ? item.Height.ToString() : string.Empty; graphic.Attributes[Diamond2Attributes.DewPoint] = Validation.IsValidFloat(item.DewPoint) ? item.DewPoint.ToString() : string.Empty; graphic.Attributes[Diamond2Attributes.WindSpeed] = Validation.IsValidFloat(item.WindSpeed) ? item.WindSpeed.ToString() : string.Empty; return(graphic); }
private async Task SetupSymbols() { _pinSymbol = new PictureMarkerSymbol() { Width = 24, Height = 24, YOffset = 12 }; await _pinSymbol.SetSourceAsync(new Uri("ms-appx:///Assets/RedStickPin.png")); _bufferSymbol = LayoutRoot.Resources["BufferSymbol"] as SimpleFillSymbol; }
// Setup the pin graphic and graphics layer renderer private async Task SetSimpleRendererSymbols() { var markerSymbol = new PictureMarkerSymbol() { Width = 48, Height = 48, YOffset = 24 }; await markerSymbol.SetSourceAsync(new Uri("pack://application:,,,/ArcGISRuntimeSDKDotNet_DesktopSamples;component/Assets/RedStickpin.png")); var renderer = new SimpleRenderer() { Symbol = markerSymbol }; addressesGraphicsLayer.Renderer = renderer; }
private async Task SetupSymbols() { _pinSymbol = new PictureMarkerSymbol() { Width = 24, Height = 24, YOffset = 12 }; await _pinSymbol.SetSourceAsync(new Uri("ms-appx:///Assets/RedStickPin.png")); _bufferSymbol = LayoutRoot.Resources["BufferSymbol"] as SimpleFillSymbol; }
public T CreatSymbol <T>(Uri uri) where T : Symbol { const int size = 36; var xPictureSymbol = new PictureMarkerSymbol { Width = size, Height = size, XOffset = 0, YOffset = 0 }; xPictureSymbol.SetSourceAsync(uri); return(xPictureSymbol as T); }
static public MarkerSymbol GetSymbol(GeoStatus status) { var symbol = new PictureMarkerSymbol(); if (status == GeoStatus.Normal) { symbol.SetSourceAsync(new System.Uri("http://static.arcgis.com/images/Symbols/Basic/GreenShinyPin.png")); } else if (status == GeoStatus.Hilight) { symbol.SetSourceAsync(new System.Uri("http://static.arcgis.com/images/Symbols/Basic/GoldShinyPin.png")); } if (status == GeoStatus.Reference) { symbol.SetSourceAsync(new System.Uri("http://static.arcgis.com/images/Symbols/Basic/BlueShinyPin.png")); } return(symbol); }
private async Task SetupSymbols() { _pinSymbol = new PictureMarkerSymbol() { Width = 48, Height = 48, YOffset = 24 }; await _pinSymbol.SetSourceAsync(new Uri("pack://application:,,,/ArcGISRuntimeSDKDotNet_DesktopSamples;component/Assets/RedStickpin.png")); _bufferSymbol = layoutGrid.Resources["BufferSymbol"] as SimpleFillSymbol; }
// Load the picture symbol image private async void SetupSymbols() { try { _pictureMarkerSymbol = layoutGrid.Resources["PictureMarkerSymbol"] as PictureMarkerSymbol; await _pictureMarkerSymbol.SetSourceAsync(new Uri("pack://application:,,,/ArcGISRuntimeSDKDotNet_DesktopSamples;component/Assets/x-24x24.png")); } catch (Exception ex) { MessageBox.Show("Error occurred : " + ex.Message, "Label Point Sample"); } }
// Load the picture symbol image private async Task SetupSymbolsAsync() { try { _pictureMarkerSymbol = layoutGrid.Resources["PictureMarkerSymbol"] as PictureMarkerSymbol; await _pictureMarkerSymbol.SetSourceAsync(new Uri("pack://application:,,,/ArcGISRuntimeSDKDotNet_DesktopSamples.csproj;component/Assets/x-24x24.png")); } catch (Exception ex) { Debug.WriteLine(ex.Message); } }
// Load the picture symbol image private async Task SetupSymbolsAsync() { try { _pictureMarkerSymbol = layoutGrid.Resources["PictureMarkerSymbol"] as PictureMarkerSymbol; await _pictureMarkerSymbol.SetSourceAsync(new Uri("pack://application:,,,/ArcGISRuntimeSDKDotNet_DesktopSamples;component/Assets/x-24x24.png")); } catch (Exception ex) { Debug.WriteLine(ex.Message); } }
// Load the picture symbol image private async Task SetupSymbolsAsync() { try { _pictureMarkerSymbol = LayoutRoot.Resources["PictureMarkerSymbol"] as PictureMarkerSymbol; await _pictureMarkerSymbol.SetSourceAsync(new Uri("ms-appx:///Assets/x-24x24.png")); } catch (Exception ex) { Debug.WriteLine(ex.Message); } }
private async void SetupSymbols() { try { _pms = LayoutRoot.Resources["MyPictureMarkerSymbol"] as PictureMarkerSymbol; await _pms.SetSourceAsync(new Uri("ms-appx:///Assets/RedStickPin.png")); } catch (Exception ex) { var _x = new MessageDialog(ex.Message, "Buffer Sample").ShowAsync(); } }
// Load the picture symbol image private async void SetupSymbols() { try { _pictureMarkerSymbol = LayoutRoot.Resources["PictureMarkerSymbol"] as PictureMarkerSymbol; await _pictureMarkerSymbol.SetSourceAsync(new Uri("ms-appx:///ArcGISRuntimeSamplesStore/Assets/x-24x24.png")); } catch (Exception ex) { var _x = new MessageDialog("Error occurred : " + ex.Message, "Label Point Sample").ShowAsync(); } }
// Load the picture symbol image private async void SetupSymbols() { try { _pictureMarkerSymbol = layoutGrid.Resources["PictureMarkerSymbol"] as PictureMarkerSymbol; await _pictureMarkerSymbol.SetSourceAsync(new Uri("pack://application:,,,/ArcGISRuntimeSDKDotNet_DesktopSamples;component/Assets/x-24x24.png")); } catch (Exception ex) { MessageBox.Show("Error occurred : " + ex.Message, "Label Point Sample"); } }
// Load the picture symbol image private async Task SetupSymbolsAsync() { try { _pictureMarkerSymbol = LayoutRoot.Resources["PictureMarkerSymbol"] as PictureMarkerSymbol; await _pictureMarkerSymbol.SetSourceAsync(new Uri("ms-appx:///Assets/x-24x24.png")); } catch (Exception ex) { Debug.WriteLine(ex.Message); } }
private async Task InitializePictureMarkerSymbol() { try { pms = LayoutRoot.Resources["MyPictureMarkerSymbol"] as PictureMarkerSymbol; await pms.SetSourceAsync(new Uri("ms-appx:///Assets/RedStickPin.png")); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); } }
private async Task InitializePictureMarkerSymbol() { try { pms = LayoutRoot.Resources["MyPictureMarkerSymbol"] as PictureMarkerSymbol; await pms.SetSourceAsync(new Uri("ms-appx:///Assets/RedStickPin.png")); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); } }
// Load the picture symbol image private async void SetupSymbols() { try { _pictureMarkerSymbol = LayoutRoot.Resources["PictureMarkerSymbol"] as PictureMarkerSymbol; await _pictureMarkerSymbol.SetSourceAsync(new Uri("ms-appx:///ArcGISRuntimeSamplesStore/Assets/x-24x24.png")); } catch (Exception ex) { var _x = new MessageDialog("Error occurred : " + ex.Message, "Label Point Sample").ShowAsync(); } }
// Create marker symbols private async Task SetupSymbolsAsync() { try { const int size = 24; // Create simple marker symbols var blackOutlineSymbol = new SimpleLineSymbol() { Color = Colors.Black, Style = SimpleLineStyle.Solid, Width = 1 }; _symbols = new List<MarkerSymbol>() { new SimpleMarkerSymbol() { Color = Colors.Red, Size = 15, Style = SimpleMarkerStyle.Circle, Outline = blackOutlineSymbol }, new SimpleMarkerSymbol() { Color = Colors.Green, Size = 15, Style = SimpleMarkerStyle.Diamond, Outline = blackOutlineSymbol }, new SimpleMarkerSymbol() { Color = Colors.Blue, Size = 15, Style = SimpleMarkerStyle.Square, Outline = blackOutlineSymbol }, new SimpleMarkerSymbol() { Color = Colors.Purple, Size = 15, Style = SimpleMarkerStyle.X, Outline = blackOutlineSymbol }, }; // Set image sources for picture marker symbols List<Task> setSourceTasks = new List<Task>(); var stickPinSymbol = new PictureMarkerSymbol() { Width = size, Height = size, XOffset = 0, YOffset = 0 }; setSourceTasks.Add(stickPinSymbol.SetSourceAsync(new Uri("pack://application:,,,/ArcGISRuntimeSDKDotNet_DesktopSamples;component/Assets/RedStickpin.png"))); _symbols.Add(stickPinSymbol); var pushPinSymbol = new PictureMarkerSymbol() { Width = size, Height = size, XOffset = 0, YOffset = 0 }; setSourceTasks.Add(pushPinSymbol.SetSourceAsync(new Uri("pack://application:,,,/ArcGISRuntimeSDKDotNet_DesktopSamples;component/Assets/RedPushpin.png"))); _symbols.Add(pushPinSymbol); var xPictureSymbol = new PictureMarkerSymbol() { Width = size, Height = size, XOffset = 0, YOffset = 0 }; setSourceTasks.Add(xPictureSymbol.SetSourceAsync(new Uri("pack://application:,,,/ArcGISRuntimeSDKDotNet_DesktopSamples;component/Assets/x-24x24.png"))); _symbols.Add(xPictureSymbol); await Task.WhenAll(setSourceTasks); // Create image swatches for the UI Task<ImageSource>[] swatchTasks = _symbols.OfType<SimpleMarkerSymbol>() .Select(sym => sym.CreateSwatchAsync(size, size, 96.0, Colors.Transparent)) .ToArray(); var imageSources = new List<ImageSource>(await Task.WhenAll(swatchTasks)); // Manually create swatches for the picture marker symbols imageSources.Add(LoadImage("pack://application:,,,/ArcGISRuntimeSDKDotNet_DesktopSamples;component/Assets/RedStickpin.png", size)); imageSources.Add(LoadImage("pack://application:,,,/ArcGISRuntimeSDKDotNet_DesktopSamples;component/Assets/RedPushpin.png", size)); imageSources.Add(LoadImage("pack://application:,,,/ArcGISRuntimeSDKDotNet_DesktopSamples;component/Assets/x-24x24.png", size)); symbolCombo.ItemsSource = imageSources; } catch (Exception ex) { Debug.WriteLine("Error: " + ex.Message); } }
private async void SetupSymbols() { try { _pms = LayoutRoot.Resources["MyPictureMarkerSymbol"] as PictureMarkerSymbol; await _pms.SetSourceAsync(new Uri("ms-appx:///Assets/RedStickPin.png")); } catch (Exception ex) { var _x = new MessageDialog(ex.Message, "Buffer Sample").ShowAsync(); } }
private async void InitializePictureMarkerSymbol() { try { await _pinMarkerSymbol.SetSourceAsync( new Uri("pack://application:,,,/IS3.Config;component/Images/pin_red.png")); } catch (Exception ex) { Debug.WriteLine(ex.Message); } }
private Graphic CreateGraphic(double Latitude, double Longitude, string IconPath) { CompositeSymbol compositeSymbol = new CompositeSymbol(); PictureMarkerSymbol pictureMarkerSymbol = new PictureMarkerSymbol(); pictureMarkerSymbol.SetSourceAsync(new Uri(IconPath)); compositeSymbol.Symbols.Add(pictureMarkerSymbol); var graphics = new Graphic(new MapPoint(Longitude, Latitude, new SpatialReference(4326)), compositeSymbol); return(graphics); }
// Setup marker symbol and renderer private async Task SetupRendererSymbols() { var markerSymbol = new PictureMarkerSymbol() { Width = 48, Height = 48, YOffset = 24 }; await markerSymbol.SetSourceAsync( new Uri("pack://application:,,,/ArcGISRuntimeSDKDotNet_DesktopSamples;component/Assets/RedStickpin.png")); graphicsLayer.Renderer = new SimpleRenderer() { Symbol = markerSymbol, }; }
private async void InitializePictureMarkerSymbol() { try { var imageFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///ArcGISRuntimeSamplesPhone/Assets/x-24x24.png")); var imageSource = await imageFile.OpenReadAsync(); pictureMarkerSymbol = LayoutRoot.Resources["MyPictureMarkerSymbol"] as PictureMarkerSymbol; await pictureMarkerSymbol.SetSourceAsync(imageSource); } catch (Exception ex) { var _x = new MessageDialog("Error occurred : " + ex.Message, "Label Point Sample").ShowAsync(); } }
// Setup marker symbol and renderer private async void SetupRendererSymbols() { try { var markerSymbol = new PictureMarkerSymbol() { Width = 48, Height = 48, YOffset = 24 }; await markerSymbol.SetSourceAsync( new Uri("ms-appx:///ArcGISRuntimeSamplesStore/Assets/RedStickpin.png")); _graphicsOverlay.Renderer = new SimpleRenderer() { Symbol = markerSymbol, }; } catch (System.Exception ex) { var _x = new MessageDialog(ex.Message, "Sample Error").ShowAsync(); } }
private async Task InitializePictureMarkerSymbol() { try { var imageFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/i_pushpin.png")); var imageSource = await imageFile.OpenReadAsync(); pms = LayoutRoot.Resources["MyPictureMarkerSymbol"] as PictureMarkerSymbol; await pms.SetSourceAsync(imageSource); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); } }
// Setup marker symbol and renderer private async void SetupRendererSymbols() { try { var markerSymbol = new PictureMarkerSymbol() { Width = 48, Height = 48, YOffset = 24 }; await markerSymbol.SetSourceAsync( new Uri("pack://application:,,,/ArcGISRuntimeSamplesDesktop;component/Assets/RedStickpin.png")); _graphicsOverlay.Renderer = new SimpleRenderer() { Symbol = markerSymbol, }; } catch(Exception ex) { MessageBox.Show("Error occurred : " + ex.Message, "Sample error"); } }
private async void InitializePictureMarkerSymbol() { _pinMarkerSymbol = LayoutRoot.Resources["DefaultMarkerSymbol"] as PictureMarkerSymbol; try { await _pinMarkerSymbol.SetSourceAsync( new Uri("pack://application:,,,/iS3.Desktop;component/Images/pin_red.png")); } catch (Exception ex) { Debug.WriteLine(ex.Message); } }
private async void InitializePictureMarkerSymbol() { _pinMarkerSymbol = LayoutRoot.Resources["DefaultMarkerSymbol"] as PictureMarkerSymbol; try { await _pinMarkerSymbol.SetSourceAsync( new Uri("pack://application:,,,/IS3.Desktop;component/Images/pin_red.png")); } catch (Exception ex) { Debug.WriteLine(ex.Message); } }
private async void SetupSymbols() { try { _pinSymbol = new PictureMarkerSymbol() { Width = 48, Height = 48, YOffset = 24 }; await _pinSymbol.SetSourceAsync( new Uri("pack://application:,,,/ArcGISRuntimeSDKDotNet_DesktopSamples;component/Assets/RedStickpin.png")); _bufferSymbol = layoutGrid.Resources["BufferSymbol"] as SimpleFillSymbol; } catch (Exception ex) { MessageBox.Show("Error occured : " + ex.Message, "Buffer Sample"); } }
private async void SetupSymbols() { try { _pinSymbol = new PictureMarkerSymbol() { Width = 24, Height = 24, YOffset = 12 }; await _pinSymbol.SetSourceAsync(new Uri("ms-appx:///Assets/RedStickPin.png")); _bufferSymbol = LayoutRoot.Resources["BufferSymbol"] as SimpleFillSymbol; } catch (Exception ex) { var _x = new MessageDialog(ex.Message, "Sample Error").ShowAsync(); } }
// Setup the pin graphic and graphics overlay renderer private async void SetSimpleRendererSymbols() { try { var markerSymbol = new PictureMarkerSymbol() { Width = 48, Height = 48, YOffset = 24 }; await markerSymbol.SetSourceAsync(new Uri("ms-appx:///Assets/RedStickpin.png")); var renderer = new SimpleRenderer() { Symbol = markerSymbol }; _addressOverlay.Renderer = renderer; } catch (Exception ex) { var _x = new MessageDialog("Selection Error: " + ex.Message, "Find Place Sample").ShowAsync(); } }
// Setup the pin graphic and graphics overlay renderer private async void SetSimpleRendererSymbols() { try { var markerSymbol = new PictureMarkerSymbol() { Width = 48, Height = 48, YOffset = 24 }; await markerSymbol.SetSourceAsync(new Uri("pack://application:,,,/ArcGISRuntimeSDKDotNet_DesktopSamples;component/Assets/RedStickpin.png")); var renderer = new SimpleRenderer() { Symbol = markerSymbol }; _addressOverlay.Renderer = renderer; } catch (Exception ex) { MessageBox.Show("Error occurred : " + ex.Message, "Find Place Sample"); } }
// Create marker symbols private async Task SetupSymbolsAsync() { try { int size = Convert.ToInt32(LayoutRoot.Resources["ImageSize"]); int sizePt = (int)((float)size / DisplayInformation.GetForCurrentView().LogicalDpi * 72); // Create simple marker symbols var blackOutlineSymbol = new SimpleLineSymbol() { Color = Colors.Black, Style = SimpleLineStyle.Solid, Width = 1 }; _symbols = new List<MarkerSymbol>() { new SimpleMarkerSymbol() { Color = Colors.Red, Size = sizePt, Style = SimpleMarkerStyle.Circle, Outline = blackOutlineSymbol }, new SimpleMarkerSymbol() { Color = Colors.Green, Size = sizePt, Style = SimpleMarkerStyle.Diamond, Outline = blackOutlineSymbol }, new SimpleMarkerSymbol() { Color = Colors.Blue, Size = sizePt, Style = SimpleMarkerStyle.Square, Outline = blackOutlineSymbol }, new SimpleMarkerSymbol() { Color = Colors.Purple, Size = sizePt, Style = SimpleMarkerStyle.X, Outline = blackOutlineSymbol }, }; // Set image sources for picture marker symbols List<Task> setSourceTasks = new List<Task>(); var stickPinSymbol = new PictureMarkerSymbol() { Width = size, Height = size }; setSourceTasks.Add(stickPinSymbol.SetSourceAsync(new Uri("ms-appx:///Assets/RedStickpin.png"))); _symbols.Add(stickPinSymbol); var pushPinSymbol = new PictureMarkerSymbol() { Width = size, Height = size }; setSourceTasks.Add(pushPinSymbol.SetSourceAsync(new Uri("http://static.arcgis.com/images/Symbols/Basic/RedShinyPin.png"))); _symbols.Add(pushPinSymbol); var xPictureSymbol = new PictureMarkerSymbol() { Width = size, Height = size }; setSourceTasks.Add(xPictureSymbol.SetSourceAsync(new Uri("ms-appx:///Assets/x-24x24.png"))); _symbols.Add(xPictureSymbol); await Task.WhenAll(setSourceTasks); // Create image swatches for the UI Task<ImageSource>[] swatchTasks = _symbols .Select(sym => sym.CreateSwatchAsync()) .ToArray(); symbolCombo.ItemsSource = await Task.WhenAll(swatchTasks); symbolCombo.SelectedIndex = 0; } catch (Exception ex) { Debug.WriteLine("Error: " + ex.Message); } }
private async void InitializePictureMarkerSymbol() { try { var imageFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/x-24x24.png")); var imageSource = await imageFile.OpenReadAsync(); pictureMarkerSymbol = LayoutRoot.Resources["MyPictureMarkerSymbol"] as PictureMarkerSymbol; await pictureMarkerSymbol.SetSourceAsync(imageSource); } catch (Exception ex) { var _x = new MessageDialog("Ha ocurrido un error : " + ex.Message, "Error en Etiqueta de Punto").ShowAsync(); } }
private async void InitializePictureMarkerSymbol() { try { var imageFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/i_pushpin.png")); var imageSource = await imageFile.OpenReadAsync(); pms = LayoutRoot.Resources["MyPictureMarkerSymbol"] as PictureMarkerSymbol; await pms.SetSourceAsync(imageSource); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); } }
private async void InitializePictureMarkerSymbol() { try { var imageFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///ArcGISRuntimeSamplesPhone/Assets/x-24x24.png")); var imageSource = await imageFile.OpenReadAsync(); pictureMarkerSymbol = LayoutRoot.Resources["MyPictureMarkerSymbol"] as PictureMarkerSymbol; await pictureMarkerSymbol.SetSourceAsync(imageSource); } catch (Exception ex) { var _x = new MessageDialog("Error occurred : " + ex.Message, "Label Point Sample").ShowAsync(); } }
private async void SetupSymbols() { try { _pinSymbol = new PictureMarkerSymbol() { Width = 24, Height = 24, YOffset = 12 }; await _pinSymbol.SetSourceAsync(new Uri("ms-appx:///ArcGISRuntimeSamplesStore/Assets/RedStickPin.png")); _bufferSymbol = LayoutRoot.Resources["BufferSymbol"] as SimpleFillSymbol; } catch (Exception ex) { var _x = new MessageDialog(ex.Message, "Sample Error").ShowAsync(); } }
private async Task SetSimpleRendererSymbols() { PictureMarkerSymbol findResultMarkerSymbol = new PictureMarkerSymbol() { Width = 48, Height = 48, YOffset = 24 }; await findResultMarkerSymbol.SetSourceAsync(new Uri("pack://application:,,,/ArcGISRuntimeSDKDotNet_DesktopSamples;component/Assets/RedStickpin.png")); SimpleRenderer findResultRenderer = new SimpleRenderer() { Symbol = findResultMarkerSymbol, }; _candidateAddressesGraphicsLayer.Renderer = findResultRenderer; }
private async void SetupSymbols() { try { _pinSymbol = new PictureMarkerSymbol() { Width = 48, Height = 48, YOffset = 24 }; await _pinSymbol.SetSourceAsync( new Uri("pack://application:,,,/ArcGISRuntimeSDKDotNet_DesktopSamples;component/Assets/RedStickpin.png")); _bufferSymbol = layoutGrid.Resources["BufferSymbol"] as SimpleFillSymbol; } catch (Exception ex) { MessageBox.Show("Error occured : " + ex.Message, "Buffer Sample"); } }
//初始化地图图标 private async void InitializePictureMarkerSymbol() { _MarkerSymbol_Normal = LayoutRoot.Resources["DefaultMarkerSymbol"] as PictureMarkerSymbol; _MarkerSymbol_Select = LayoutRoot.Resources["DefaultMarkerSymbol2"] as PictureMarkerSymbol; try { await _MarkerSymbol_Normal.SetSourceAsync( new Uri("pack://application:,,,/iS3.Client.Controls;component/Images/pin_red.png")); await _MarkerSymbol_Select.SetSourceAsync( new Uri("pack://application:,,,/iS3.Client.Controls;component/Images/pin_red.png")); } catch (Exception ex) { Debug.WriteLine(ex.Message); } }
public MapPageViewModel(IFamousePersonService personService, IHistoryEventService historyEventService, IImageService imgService) { this.personService = personService; this.historyEventService = historyEventService; this.imgService = imgService; Task.Run(async() => { try { var famousePersonsDto = await this.personService.FindAllAsync(); FamousPersons = DtoConvertToModel.FamousePersonsConvert(famousePersonsDto); var eventsDto = await this.historyEventService.FindAllAsync(); HistoryEvents = DtoConvertToModel.HistoryEventsConvert(eventsDto); } catch (ApiErrorException e) { MessageBox.Show(e.Message); } await personSymbol.SetSourceAsync(new Uri(MapMarkerConfig.PERSON_MARKER)); await eventSymbol.SetSourceAsync(new Uri(MapMarkerConfig.EVENT_MARKER)); if (FamousPersons != null) { foreach (var value in FamousPersons) { personsLayers.Dispatcher.Invoke(() => { //personsLayers.Graphics.Add(new Graphic(new MapPoint(-7000000, 3900000), personSymbol)); AddPersonGraphic(value); }); } } if (HistoryEvents != null) { foreach (var value in HistoryEvents) { // eventsLayer.Graphics.Add(new Graphic(new MapPoint(-7000000, 4000000), (Symbol)GetGloabelResorce("RedMarkerSymbolCircle"))); AddEventGraphic(value); } } }); }
// Setup marker symbol and renderer private async void SetupRendererSymbols() { try { var markerSymbol = new PictureMarkerSymbol() { Width = 48, Height = 48, YOffset = 24 }; await markerSymbol.SetSourceAsync( new Uri("ms-appx:///Assets/RedStickpin.png")); _graphicsOverlay.Renderer = new SimpleRenderer() { Symbol = markerSymbol, }; } catch (System.Exception ex) { var _x = new MessageDialog(ex.Message, "Sample Error").ShowAsync(); } }
// Setup marker symbol and renderer private async void SetupRendererSymbols() { try { var markerSymbol = new PictureMarkerSymbol() { Width = 48, Height = 48, YOffset = 24 }; await markerSymbol.SetSourceAsync( new Uri("pack://application:,,,/ArcGISRuntimeSDKDotNet_DesktopSamples;component/Assets/RedStickpin.png")); _graphicsOverlay.Renderer = new SimpleRenderer() { Symbol = markerSymbol, }; } catch (Exception ex) { MessageBox.Show("Error occured : " + ex.Message, "Sample error"); } }
private async void GoOffline() { try { this.MyMapView.Map.Layers.Clear(); var assemblyPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); var appPath = assemblyPath.Substring(0, assemblyPath.LastIndexOf("bin")); var tilesPath = appPath + "\\" + this.LocalTilesPathTextBlock.Text; var localTileLayer = new ArcGISLocalTiledLayer(tilesPath); await localTileLayer.InitializeAsync(); this.MyMapView.Map.Layers.Add(localTileLayer); var localGdb = await Geodatabase.OpenAsync(this.LocalDataPathTextBlock.Text); var localPoiTable = localGdb.FeatureTables.FirstOrDefault(); var localPoiLayer = new FeatureLayer(localPoiTable); localPoiLayer.ID = "POI"; localPoiLayer.DisplayName = localPoiTable.Name; var flamePictureMarker = new PictureMarkerSymbol(); await flamePictureMarker.SetSourceAsync(new Uri(flameImageUrl)); flamePictureMarker.Height = 24; flamePictureMarker.Width = 24; var simpleRenderer = new SimpleRenderer(); simpleRenderer.Symbol = flamePictureMarker; localPoiLayer.Renderer = simpleRenderer; await localPoiLayer.InitializeAsync(); this.MyMapView.Map.Layers.Add(localPoiLayer); } catch (Exception exp) { SyncStatusTextBlock.Text = exp.Message; } }
// Setup the pin graphic and graphics overlay renderer private async void SetSimpleRendererSymbols() { try { var markerSymbol = new PictureMarkerSymbol() { Width = 48, Height = 48, YOffset = 24 }; await markerSymbol.SetSourceAsync(new Uri("ms-appx:///ArcGISRuntimeSamplesStore/Assets/RedStickpin.png")); var renderer = new SimpleRenderer() { Symbol = markerSymbol }; _addressOverlay.Renderer = renderer; } catch (Exception ex) { var _x = new MessageDialog("Selection Error: " + ex.Message, "Find Place Sample").ShowAsync(); } }
// Setup the pin graphic and graphics overlay renderer private async void SetSimpleRendererSymbols() { try { var markerSymbol = new PictureMarkerSymbol() { Width = 48, Height = 48, YOffset = 24 }; await markerSymbol.SetSourceAsync(new Uri("pack://application:,,,/ArcGISRuntimeSamplesDesktop;component/Assets/RedStickpin.png")); var renderer = new SimpleRenderer() { Symbol = markerSymbol }; _addressOverlay.Renderer = renderer; } catch (Exception ex) { MessageBox.Show("Error occurred : " + ex.Message, "Find Place Sample"); } }
private async void FindAddressButton_Click(object sender, RoutedEventArgs e) { try { progress.Visibility = Visibility.Visible; //The constructor takes two arguments: the URI for the geocode service and a token (required for secured services). var uri = new Uri("http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer"); var token = String.Empty; var locator = new OnlineLocatorTask(uri, token); // OnlineLocatorFindParameters object, which holds all relevant information for the address search. //var findParams = new OnlineLocatorFindParameters(AddressTextBox.Text); var findParams = new OnlineLocatorFindParameters(InputAddress.Text + " " + City.Text + " " + State.Text + " " + Zip.Text); findParams.OutSpatialReference = MyMapView.SpatialReference; findParams.SourceCountry = "US"; // var results = await locator.FindAsync(findParams, new System.Threading.CancellationToken()); if (results.Count > 0) { var firstMatch = results[0].Feature; var matchLocation = firstMatch.Geometry as MapPoint; //Add a point graphic at the address location var matchSym = new PictureMarkerSymbol(); var pictureUri = new Uri("http://static.arcgis.com/images/Symbols/Basic/GreenStickpin.png"); await matchSym.SetSourceAsync(pictureUri); var matchGraphic = new Graphic(matchLocation, matchSym); // Get a reference to the graphic layer you defined for the map, and add the new graphic. var graphicsLayer = MyMap.Layers["MyGraphics"] as GraphicsLayer; if (graphicsLayer.Graphics.Contains(oldGraphic)) { graphicsLayer.Graphics.Remove(oldGraphic); } graphicsLayer.Graphics.Add(matchGraphic); oldGraphic = matchGraphic; // _graphicsOverlay.Graphics.Add(matchGraphic); txtResult.Visibility = System.Windows.Visibility.Visible; txtResult.Text = ("Address Found: " + matchLocation.X +", " + matchLocation.Y); // zooms into pin point graphic: //The Envelope is created by subtracting 1000 meters from the location's //minimum X and Y values and adding 1000 meters to the maximum X and Y values. var matchExtent = new Envelope(matchLocation.X, matchLocation.Y, matchLocation.X, matchLocation.Y); await MyMapView.SetViewAsync(matchExtent); } else { MessageBox.Show("Unable to find address. "); return; } } catch (Exception ex) { MessageBox.Show("Unable to find address. ", ""); } }
private async void AddGraphics(string p_parameters, string p_textLabel ) { // check if there is a previous pinpoint //The constructor takes two arguments: the URI for the geocode service and a token (required for secured services). var uri = new Uri("http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer"); var token = String.Empty; var locator = new OnlineLocatorTask(uri, token); // OnlineLocatorFindParameters object, which holds all relevant information for the address search. var findParams = new OnlineLocatorFindParameters(p_parameters); findParams.OutSpatialReference = MyMapView.SpatialReference; findParams.SourceCountry = "US"; // var results = await locator.FindAsync(findParams, new System.Threading.CancellationToken()); if (results.Count > 0) { var firstMatch = results[0].Feature; var matchLocation = firstMatch.Geometry as MapPoint; //Add a point graphic at the address location var matchSym = new PictureMarkerSymbol(); var pictureUri = new Uri("http://static.arcgis.com/images/Symbols/Animated/EnlargeGradientSymbol.png"); await matchSym.SetSourceAsync(pictureUri); var matchGraphic = new Graphic(matchLocation, matchSym); // Get a reference to the graphic layer you defined for the map, and add the new graphic. var graphicsLayer = MyMap.Layers["MyGraphics"] as GraphicsLayer; graphicsLayer.Graphics.Add(matchGraphic); // create a text symbol: define color, font, size, and text for the label var textSym = new Esri.ArcGISRuntime.Symbology.TextSymbol(); textSym.Color = Colors.DarkRed; textSym.Font = new Esri.ArcGISRuntime.Symbology.SymbolFont("Arial", 12); textSym.BackgroundColor = Colors.White; textSym.Text = p_textLabel; //textSym.Angle = -60; // create a graphic for the text (apply TextSymbol) var textGraphic = new Esri.ArcGISRuntime.Layers.Graphic(matchLocation, textSym); graphicsLayer.Graphics.Add(textGraphic); } }
public async Task Query(string text) { try { if (Controller == null) return; IsLoadingSearchResults = true; text = text.Trim(); if (_searchCancellationTokenSource != null) { if (_currentSearchString != null && _currentSearchString == text) return; _searchCancellationTokenSource.Cancel(); } _searchCancellationTokenSource = new CancellationTokenSource(); var cancellationToken = _searchCancellationTokenSource.Token; Envelope boundingBox = Controller.Extent; if (string.IsNullOrWhiteSpace(text)) return; if (_currentSearchString != null && _currentSearchString != text) { if (!cancellationToken.IsCancellationRequested) _searchCancellationTokenSource.Cancel(); } _searchResultLayer.Graphics.Clear(); var geo = new OnlineLocatorTask(new Uri("http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer", UriKind.Absolute), ""); boundingBox = boundingBox.Expand(1.2); _currentSearchString = text; SearchResultStatus = string.Format("Searching for '{0}'...", text.Trim()); var result = await geo.FindAsync(new OnlineLocatorFindParameters(text) { MaxLocations = 25, OutSpatialReference = WebMapVM.SpatialReference, SearchExtent = boundingBox, Location = (MapPoint)GeometryEngine.NormalizeCentralMeridian(boundingBox.GetCenter()), Distance = GetDistance(boundingBox), OutFields = new List<string>() { "PlaceName", "Type", "City", "Country" } }, cancellationToken); // if no results, try again with larger and larger extent var retries = 3; while (result.Count == 0 && --retries > 0) { if (cancellationToken.IsCancellationRequested) return; boundingBox = boundingBox.Expand(2); result = await geo.FindAsync(new OnlineLocatorFindParameters(text) { MaxLocations = 25, OutSpatialReference = WebMapVM.SpatialReference, SearchExtent = boundingBox, Location = (MapPoint)GeometryEngine.NormalizeCentralMeridian(boundingBox.GetCenter()), Distance = GetDistance(boundingBox), OutFields = new List<string>() { "PlaceName", "Type", "City", "Country"} }, cancellationToken); } if (cancellationToken.IsCancellationRequested) return; if (result.Count == 0) { // atfer trying to expand the bounding box several times and finding no results, // let us try finding results without the spatial bound. result = await geo.FindAsync(new OnlineLocatorFindParameters(text) { MaxLocations = 25, OutSpatialReference = WebMapVM.SpatialReference, OutFields = new List<string>() { "PlaceName", "Type", "City", "Country"} }, cancellationToken); if (result.Any()) { // since the results are not bound by any spatial filter, let us show well known administrative // places e.g. countries and cities, and filter out other results e.g. restaurents and business names. var typesToInclude = new List<string>() { "", "city", "community", "continent", "country", "county", "district", "locality", "municipality", "national capital", "neighborhood", "other populated place", "state capital", "state or province", "territory", "village"}; for (var i = result.Count - 1; i >= 0; --i) { // get the result type var resultType = ((string)result[i].Feature.Attributes["Type"]).Trim().ToLower(); // if the result type exists in the inclusion list above, keep it in the list of results if (typesToInclude.Contains(resultType)) continue; // otherwise, remove it from the list of results result.RemoveAt(i); } } } if (result.Count == 0) { SearchResultStatus = string.Format("No results for '{0}' found", text); if (Locations != null) Locations.Clear(); //await new Windows.UI.Popups.MessageDialog(string.Format("No results for '{0}' found", text)).ShowAsync(); } else { SearchResultStatus = string.Format("Found {0} results for '{1}'", result.Count.ToString(), text); Envelope extent = null; var color = (App.Current.Resources["AppAccentBrush"] as SolidColorBrush).Color; var color2 = (App.Current.Resources["AppAccentForegroundBrush"] as SolidColorBrush).Color; SimpleMarkerSymbol symbol = new SimpleMarkerSymbol() { Color = Colors.Black, Outline = new SimpleLineSymbol() { Color = Colors.Black, Width = 2 }, Size = 16, Style = SimpleMarkerStyle.Square }; // set the picture marker symbol used in the search result composite symbol. var imageFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/Icons/SearchResult.png")); var imageSource = await imageFile.OpenReadAsync(); var pictureMarkerSymbol = new PictureMarkerSymbol(); await pictureMarkerSymbol.SetSourceAsync(imageSource); // apply an x and y offsets so that the tip of of the pin points to the correct location. pictureMarkerSymbol.XOffset = SearchResultPinXOffset; pictureMarkerSymbol.YOffset = SearchResultPinYOffset; int ID = 1; foreach (var r in result) { if (extent == null) extent = r.Extent; else if (r.Extent != null) extent = extent.Union(r.Extent); var textSymbol = new TextSymbol() { Text = ID.ToString(), Font = new SymbolFont() { FontFamily = "Verdena", FontSize = 10, FontWeight = SymbolFontWeight.Bold }, Color = color2, BorderLineColor = color2, HorizontalTextAlignment = Esri.ArcGISRuntime.Symbology.HorizontalTextAlignment.Center, VerticalTextAlignment = Esri.ArcGISRuntime.Symbology.VerticalTextAlignment.Bottom, XOffset = SearchResultPinXOffset, YOffset = SearchResultPinYOffset }; //Looks like Top and Bottom are switched - potential CR // a compsite symbol for both the PictureMarkerSymbol and the TextSymbol could be used, but we // wanted to higlight the pin without the text; therefore, we will add them separately. // add the PictureMarkerSymbol to _searchResultLayer Graphic pin = new Graphic() { Geometry = r.Extent.GetCenter(), Symbol = pictureMarkerSymbol, }; pin.Attributes["ID"] = ID; pin.Attributes["Name"] = r.Name; _searchResultLayer.Graphics.Add(pin); // add the text to _searchResultLayer Graphic pinText = new Graphic() { Geometry = r.Extent.GetCenter(), Symbol = textSymbol, }; pinText.Attributes["ID"] = ID; pinText.Attributes["Name"] = r.Name; _searchResultLayer.Graphics.Add(pinText); ID++; } SetResult(result); base.RaisePropertyChanged("IsClearGraphicsVisible"); if (extent != null) { var _ = SetViewAsync(extent, 50); } } } finally { IsLoadingSearchResults = false; _searchCancellationTokenSource = null; _currentSearchString = null; } }
private async Task SetSimpleRendererSymbols() { PictureMarkerSymbol findResultMarkerSymbol = new PictureMarkerSymbol() { Width = 48, Height = 48, YOffset = 24 }; await findResultMarkerSymbol.SetSourceAsync(new Uri("pack://application:,,,/ArcGISRuntimeSDKDotNet_DesktopSamples;component/Assets/RedStickpin.png")); SimpleRenderer findResultRenderer = new SimpleRenderer() { Symbol = findResultMarkerSymbol, }; _candidateAddressesGraphicsLayer.Renderer = findResultRenderer; }