/// <summary> /// Mouse handler that sets the coordinates of the clicked point into text in the toolbar. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void Map_MouseClick(object sender, client.Map.MouseEventArgs e) { try { client.Geometry.MapPoint clickPoint = e.MapPoint; WebMercator mercator = new ESRI.ArcGIS.Client.Projection.WebMercator(); client.Geometry.MapPoint pt = null; pt = mercator.ToGeographic(clickPoint) as client.Geometry.MapPoint; if (_graphicsLayer == null) { _graphicsLayer = new client.GraphicsLayer(); _graphicsLayer.ID = "ComputedPoints"; client.AcceleratedDisplayLayers aclyrs = _mapWidget.Map.Layers.FirstOrDefault(lyr => lyr is client.AcceleratedDisplayLayers) as client.AcceleratedDisplayLayers; if (aclyrs.Count() > 0) { aclyrs.ChildLayers.Add(_graphicsLayer); } } ResourceDictionary mydictionary = new ResourceDictionary(); mydictionary.Source = new Uri("/AirCraftRouteGenerationLineAddin;component/SymbolDictionary.xaml", UriKind.RelativeOrAbsolute); client.Graphic graphic = new client.Graphic(); graphic.Geometry = pt; graphic.Symbol = mydictionary["RedPin"] as client.Symbols.MarkerSymbol; _graphicsLayer.Graphics.Add(graphic); RunButton.IsEnabled = true; } catch (Exception ex) { MessageBox.Show("Error in map mouseclick: " + ex.Message); } }
void targetAreaDraw_DrawComplete(object sender, client.DrawEventArgs e) { try { if (_graphicsLayerPoly == null) { _graphicsLayerPoly = new client.GraphicsLayer(); _graphicsLayerPoly.ID = "AircraftCommunicationGraphicsPoly"; client.AcceleratedDisplayLayers aclyrs = _mapWidget.Map.Layers.FirstOrDefault(lyr => lyr is client.AcceleratedDisplayLayers) as client.AcceleratedDisplayLayers; if (aclyrs.Count() > 0) { aclyrs.ChildLayers.Add(_graphicsLayerPoly); } } ResourceDictionary mydictionary = new ResourceDictionary(); mydictionary.Source = new Uri("/AircraftCommunicationCoverageAddin;component/SymbolDictionary.xaml", UriKind.RelativeOrAbsolute); WebMercator mercator = new ESRI.ArcGIS.Client.Projection.WebMercator(); client.Graphic g = new client.Graphic(); //g.Geometry = mercator.ToGeographic(e.Geometry) as client.Geometry.Polygon; //g.Symbol = mydictionary["BasicFillSymbol_Yellow_Trans_6"] as client.Symbols.SimpleFillSymbol; g.Geometry = e.Geometry as client.Geometry.Polygon; g.Symbol = mydictionary["BasicFillSymbol_Yellow_Trans_6"] as client.Symbols.SimpleFillSymbol; _graphicsLayerPoly.Graphics.Add(g); targetAreaDraw.DrawMode = client.DrawMode.None; if (_graphicsLayer != null && _graphicsLayerPoly != null) { if (_graphicsLayer.Graphics.Count() > 0 && _graphicsLayerPoly.Graphics.Count() > 0) { RunButton.IsEnabled = true; } } targetAreaDraw.IsEnabled = false; } catch (Exception ex) { MessageBox.Show("Error in draw complete: " + ex.Message); } }
/// <summary> /// Mouse handler that sets the coordinates of the clicked point into text in the toolbar. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void Map_MouseClick(object sender, client.Map.MouseEventArgs e) { try { client.Geometry.MapPoint clickPoint = e.MapPoint; WebMercator mercator = new ESRI.ArcGIS.Client.Projection.WebMercator(); client.Geometry.MapPoint pt = null; pt = mercator.ToGeographic(clickPoint) as client.Geometry.MapPoint; if (_graphicsLayer == null) { _graphicsLayer = new client.GraphicsLayer(); _graphicsLayer.ID = "ComputedPoints"; client.AcceleratedDisplayLayers aclyrs = _mapWidget.Map.Layers.FirstOrDefault(lyr => lyr is client.AcceleratedDisplayLayers) as client.AcceleratedDisplayLayers; if (aclyrs.Count() > 0) aclyrs.ChildLayers.Add(_graphicsLayer); } ResourceDictionary mydictionary = new ResourceDictionary(); mydictionary.Source = new Uri("/AirCraftRouteGenerationLineAddin;component/SymbolDictionary.xaml", UriKind.RelativeOrAbsolute); client.Graphic graphic = new client.Graphic(); graphic.Geometry = pt; graphic.Symbol = mydictionary["RedPin"] as client.Symbols.MarkerSymbol; _graphicsLayer.Graphics.Add(graphic); RunButton.IsEnabled = true; } catch (Exception ex) { MessageBox.Show("Error in map mouseclick: " + ex.Message); } }
void targetAreaDraw_DrawComplete(object sender, client.DrawEventArgs e) { try { if (_graphicsLayerPoly == null) { _graphicsLayerPoly = new client.GraphicsLayer(); _graphicsLayerPoly.ID = "AircraftCommunicationGraphicsPoly"; client.AcceleratedDisplayLayers aclyrs = _mapWidget.Map.Layers.FirstOrDefault(lyr => lyr is client.AcceleratedDisplayLayers) as client.AcceleratedDisplayLayers; if (aclyrs.Count() > 0) aclyrs.ChildLayers.Add(_graphicsLayerPoly); } ResourceDictionary mydictionary = new ResourceDictionary(); mydictionary.Source = new Uri("/AircraftCommunicationCoverageAddin;component/SymbolDictionary.xaml", UriKind.RelativeOrAbsolute); WebMercator mercator = new ESRI.ArcGIS.Client.Projection.WebMercator(); client.Graphic g = new client.Graphic(); //g.Geometry = mercator.ToGeographic(e.Geometry) as client.Geometry.Polygon; //g.Symbol = mydictionary["BasicFillSymbol_Yellow_Trans_6"] as client.Symbols.SimpleFillSymbol; g.Geometry = e.Geometry as client.Geometry.Polygon; g.Symbol = mydictionary["BasicFillSymbol_Yellow_Trans_6"] as client.Symbols.SimpleFillSymbol; _graphicsLayerPoly.Graphics.Add(g); targetAreaDraw.DrawMode = client.DrawMode.None; if (_graphicsLayer != null && _graphicsLayerPoly != null) if (_graphicsLayer.Graphics.Count() > 0 && _graphicsLayerPoly.Graphics.Count() > 0) RunButton.IsEnabled = true; targetAreaDraw.IsEnabled = false; } catch (Exception ex) { MessageBox.Show("Error in draw complete: " + ex.Message); } }