/// <summary> /// Shows and moves the snap vertex. /// </summary> /// <param name="sender">The sender.</param> /// <param name="graphic">The graphic.</param> /// <param name="args">The <see cref="System.Windows.Input.MouseEventArgs"/> instance containing the event data.</param> private void vertexLayer_MouseMove(object sender, GraphicMouseEventArgs args) { var graphic = args.Graphic; if (DraggingVertex != null) { return; } if (graphic.Geometry is Polyline) //We are over a hover line { Polyline line = graphic.Geometry as Polyline; Point pScreen = args.GetPosition(MyMap); MapPoint pMap = MyMap.ScreenToMap(pScreen); MapPoint snap = FindPointOnLineClosestToPoint(line.Paths[0][0], line.Paths[0][1], pMap); if (snapVertex == null) { snapVertex = new Graphic() { Symbol = snapSymbol, Geometry = snap }; vertexLayer.Graphics.Add(snapVertex); } else { snapVertex.Geometry = snap; } } }
private void GraphicsLayer_MouseEnter(object sender, GraphicMouseEventArgs args) { QueryDetailsDataGrid.Focus(); QueryDetailsDataGrid.SelectedItem = args.Graphic; QueryDetailsDataGrid.CurrentColumn = QueryDetailsDataGrid.Columns[0]; QueryDetailsDataGrid.ScrollIntoView(QueryDetailsDataGrid.SelectedItem, QueryDetailsDataGrid.Columns[0]); }
private void GraphicsLayer_MouseEnter(object sender, GraphicMouseEventArgs args) { QueryDetailsDataGrid.Focus(); QueryDetailsDataGrid.SelectedItem = args.Graphic; QueryDetailsDataGrid.CurrentColumn = QueryDetailsDataGrid.Columns[0]; QueryDetailsDataGrid.ScrollIntoView(QueryDetailsDataGrid.SelectedItem, QueryDetailsDataGrid.Columns[0]); }
/// <summary> ///Removes the snap vertex. /// </summary> /// <param name="sender">The sender.</param> /// <param name="graphic">The graphic.</param> /// <param name="args">The <see cref="System.Windows.Input.MouseEventArgs"/> instance containing the event data.</param> private void vertexLayer_MouseLeave(object sender, GraphicMouseEventArgs args) { if (snapVertex != null) { vertexLayer.Graphics.Remove(snapVertex); snapVertex = null; } }
// Get mouse position void GraphicsLayer_MouseEnterOrMove(object sender, GraphicMouseEventArgs args) { _mousePos = args.GetPosition(AssociatedObject); GraphicsLayer graphicsLayer = sender as GraphicsLayer; #if DEBUG if (args.Graphic != null) { if (args.Graphic.Symbol is ESRI.ArcGIS.Client.Clustering.FlareSymbol) { Debug.WriteLine(string.Format("@@MouseEnter/Move, flare, {0}", MapApplication.GetLayerName(graphicsLayer))); } else if (args.Graphic.Attributes.ContainsKey("NAME")) { Debug.WriteLine(string.Format("@@MouseEnter/Move, {0}, {1}", args.Graphic.Attributes["NAME"], MapApplication.GetLayerName(graphicsLayer))); } else { Debug.WriteLine(string.Format("@@MouseEnter/Move, no NAME field, {0}", MapApplication.GetLayerName(graphicsLayer))); } } #endif if (ESRI.ArcGIS.Client.Extensibility.LayerProperties.GetIsPopupEnabled(graphicsLayer)) { if (!ESRI.ArcGIS.Mapping.Core.LayerExtensions.GetPopUpsOnClick(graphicsLayer)) { HoverResults hoverResults = graphicsLayer.MapTip as HoverResults; if (graphicsLayer.MapTip == null) //if not a custom map tip { //if first time, attach map tip to layer attachApplicationMapTipToLayer(graphicsLayer, args.Graphic); hoverResults = graphicsLayer.MapTip as HoverResults; } //if map tip dirty, rebuild map tip if (hoverResults != null) { if (ESRI.ArcGIS.Mapping.Core.LayerExtensions.GetIsMapTipDirty(graphicsLayer) && args.Graphic == hoverResults.Graphic) { rebuildMapTipContentsBasedOnFieldVisibility(hoverResults); } //clear map tip dirty flag ESRI.ArcGIS.Mapping.Core.LayerExtensions.SetIsMapTipDirty(graphicsLayer, false); } } else { graphicsLayer.MapTip = null; } } else if (graphicsLayer.MapTip is HoverResults) { graphicsLayer.MapTip = null; } }
private void graphicsLayer_MouseMove(object sender, GraphicMouseEventArgs e) { //Recenter the maptip as long as the maptip isn't displaying yet if (Visibility == Visibility.Collapsed) { Point p = e.GetPosition(Parent as UIElement); SetValue(Canvas.LeftProperty, p.X + HorizontalOffset); SetValue(Canvas.TopProperty, p.Y + VerticalOffset); timer.Start(); } }
private void graphicsLayer_MouseLeave(object sender, GraphicMouseEventArgs args) { if (timer.IsEnabled) { timer.Stop(); } if (Visibility == Visibility.Visible) { timer.Start(); //Delay hiding maptip } mouseIsOver = false; }
private void GraphicsLayer_MouseEnter(object sender, GraphicMouseEventArgs e) { if (e.Graphic != null) { if (e.Graphic.Selected) { GoToVisualState(e.Graphic, "MouseOverSelected"); } else { GoToVisualState(e.Graphic, "MouseOver"); } } }
private void GraphicsLayer_MouseLeave(object sender, GraphicMouseEventArgs e) { if (e.Graphic != null) { if (e.Graphic.Selected) { GoToVisualState(e.Graphic, "NormalSelected"); } else { GoToVisualState(e.Graphic, "Normal"); } } }
private void graphicsLayer_MouseEnter(object sender, GraphicMouseEventArgs args) { mouseIsOver = true; Graphic graphic = args.Graphic; if (currentFeature != graphic) //Mouse entered a new feature { this.expanded = false; currentFeature = graphic; Point p = args.GetPosition(Parent as UIElement); SetValue(Canvas.LeftProperty, p.X + HorizontalOffset); SetValue(Canvas.TopProperty, p.Y + VerticalOffset); this.DataContext = this.ItemsSource = graphic.Attributes; if (!string.IsNullOrEmpty(TitleMember)) { object title = null; if (graphic.Attributes.ContainsKey(TitleMember)) { title = string.Format("{0}", graphic.Attributes[TitleMember]); } else { string firstKey = null; foreach (string key in graphic.Attributes.Keys) { if (firstKey == null) { firstKey = key; } if (graphic.Attributes[key].GetType() == typeof(string)) { title = graphic.Attributes[key] as string; break; } } if (title == null && !string.IsNullOrEmpty(firstKey)) { title = string.Format("{0}", graphic.Attributes[firstKey]); } } this.Title = title; } ChangeVisualState(false); Visibility = Visibility.Collapsed; } if (Visibility == Visibility.Collapsed) { timer.Start(); //Delay showing maptip } }
private void MyGraphicsLayer_MouseEnter(object sender, GraphicMouseEventArgs args) { string stateName = Convert.ToString(args.Graphic.Attributes["STATE_NAME"]); if (_lastActiveGraphics.Count > 0) { for (int i = 0; i < _lastActiveGraphics.Count; i++) { if (Convert.ToString(_lastActiveGraphics[i].Attributes["STATE_NAME"]) != stateName) { ClearVideoSymbol(_lastActiveGraphics[i]); } else { return; } } } GraphicsLayer graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer; Grid videoGrid = FindName("MediaGrid") as Grid; videoGrid.Children.Clear(); MediaElement stateMediaElement = new MediaElement() { Source = new Uri(String.Format("http://serverapps102.esri.com/media/{0}_small.wmv", stateName), UriKind.Absolute), Stretch = Stretch.None, AutoPlay = true, IsMuted = true, Opacity = 0.0, IsHitTestVisible = false }; stateMediaElement.MediaEnded += State_Media_MediaEnded; videoGrid.Children.Add(stateMediaElement); FillSymbol stateVideoFillSymbol = LayoutRoot.Resources["StateVideoFillSymbol"] as FillSymbol; (stateVideoFillSymbol.Fill as VideoBrush).SetSource(stateMediaElement); args.Graphic.Symbol = stateVideoFillSymbol; _lastActiveGraphics.Add(args.Graphic); }
private void MyGraphicsLayer_MouseEnter(object sender, GraphicMouseEventArgs args) { string stateName = Convert.ToString(args.Graphic.Attributes["STATE_NAME"]); if (_lastActiveGraphics.Count > 0) { for (int i = 0; i < _lastActiveGraphics.Count; i++) { if (Convert.ToString(_lastActiveGraphics[i].Attributes["STATE_NAME"]) != stateName) ClearVideoSymbol(_lastActiveGraphics[i]); else return; } } GraphicsLayer graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer; Grid videoGrid = FindName("MediaGrid") as Grid; videoGrid.Children.Clear(); MediaElement stateMediaElement = new MediaElement() { Source = new Uri(String.Format("http://serverapps102.esri.com/media/{0}_small.wmv", stateName), UriKind.Absolute), Stretch = Stretch.None, AutoPlay = true, IsMuted = true, Opacity = 0.0, IsHitTestVisible = false }; stateMediaElement.MediaEnded += State_Media_MediaEnded; videoGrid.Children.Add(stateMediaElement); FillSymbol stateVideoFillSymbol = LayoutRoot.Resources["StateVideoFillSymbol"] as FillSymbol; (stateVideoFillSymbol.Fill as VideoBrush).SetSource(stateMediaElement); args.Graphic.Symbol = stateVideoFillSymbol; _lastActiveGraphics.Add(args.Graphic); }
private void MyGraphicsLayer_MouseLeave(object sender, GraphicMouseEventArgs args) { ClearVideoSymbol(args.Graphic); }
private void GraphicsLayer_MouseLeave(object sender, GraphicMouseEventArgs args) { QueryDetailsDataGrid.Focus(); QueryDetailsDataGrid.SelectedItem = null; }
private void graphicsLayer_MouseEnter(object sender, GraphicMouseEventArgs args) { mouseIsOver = true; Graphic graphic = args.Graphic; if (currentFeature != graphic) //Mouse entered a new feature { this.expanded = false; currentFeature = graphic; Point p = args.GetPosition(Parent as UIElement); SetValue(Canvas.LeftProperty, p.X + HorizontalOffset); SetValue(Canvas.TopProperty, p.Y + VerticalOffset); this.DataContext = this.ItemsSource = graphic.Attributes; if (!string.IsNullOrEmpty(TitleMember)) { object title = null; if (graphic.Attributes.ContainsKey(TitleMember)) title = string.Format("{0}", graphic.Attributes[TitleMember]); else { string firstKey = null; foreach (string key in graphic.Attributes.Keys) { if (firstKey == null) firstKey = key; if (graphic.Attributes[key].GetType() == typeof(string)) { title = graphic.Attributes[key] as string; break; } } if (title == null && !string.IsNullOrEmpty(firstKey)) title = string.Format("{0}", graphic.Attributes[firstKey]); } this.Title = title; } ChangeVisualState(false); Visibility = Visibility.Collapsed; } if (Visibility == Visibility.Collapsed) { timer.Start(); //Delay showing maptip } }
void layer_MouseMove(object sender, GraphicMouseEventArgs e) { }
private void MyGraphicsLayer_MouseLeave(object sender, GraphicMouseEventArgs args) { ClearVideoSymbol(args.Graphic); }
private void graphicsLayer_MouseLeave(object sender, GraphicMouseEventArgs args) { if (timer.IsEnabled) { timer.Stop(); } if (Visibility == Visibility.Visible) { timer.Start(); //Delay hiding maptip } mouseIsOver = false; }
private void GraphicsLayer_MouseLeave(object sender, GraphicMouseEventArgs e) { if (e.Graphic != null) { if (e.Graphic.Selected) GoToVisualState(e.Graphic, "NormalSelected"); else GoToVisualState(e.Graphic, "Normal"); } }
private void graphicsLayer_MouseMove(object sender, GraphicMouseEventArgs e) { //Recenter the maptip as long as the maptip isn't displaying yet if (Visibility == Visibility.Collapsed) { Point p = e.GetPosition(Parent as UIElement); SetValue(Canvas.LeftProperty, p.X + HorizontalOffset); SetValue(Canvas.TopProperty, p.Y + VerticalOffset); timer.Start(); } }
private void GraphicsLayer_MouseEnter(object sender, GraphicMouseEventArgs e) { e.Graphic.Select(); }
private void GraphicsLayer_MouseEnter(object sender, GraphicMouseEventArgs e) { e.Graphic.Select(); }
private void graphicsLayerMouseEnter(object sender, GraphicMouseEventArgs e) { if (FeatureDataGrid == null || _isMapExtentChanging) return; if (AutoScrollToGraphic) { try { FeatureDataGrid.ScrollIntoView(e.Graphic, null); } catch { // OK to swallow, since timing issues are common } } }
private void GraphicsLayer_MouseLeave(object sender, GraphicMouseEventArgs e) { e.Graphic.UnSelect(); }
private void GraphicsLayer_MouseLeave(object sender, GraphicMouseEventArgs args) { QueryDetailsDataGrid.Focus(); QueryDetailsDataGrid.SelectedItem = null; }
private void GraphicsLayer_MouseLeave(object sender, GraphicMouseEventArgs e) { e.Graphic.UnSelect(); }
private void GraphicsLayer_MouseEnter(object sender, GraphicMouseEventArgs e) { if (e.Graphic != null) { if (e.Graphic.Selected) GoToVisualState(e.Graphic, "MouseOverSelected"); else GoToVisualState(e.Graphic, "MouseOver"); } }