private void graphicsLayerFromFeatureSet_MouseLeftButtonDown(object sender, GraphicMouseButtonEventArgs e) { Point pt = e.GetPosition(ContentPanel); myInfoWindow.DataContext = e.Graphic.Attributes; myInfoWindow.Anchor = MyMap.ScreenToMap(pt); myInfoWindow.IsOpen = true; }
void WebMapKML_MouseLeftButtonUp(object sender, GraphicMouseButtonEventArgs e) { GraphicsLayer glayer = sender as GraphicsLayer; MapPoint clickPoint = MyMap.ScreenToMap(e.GetPosition(MyMap)); MyInfoWindow.Anchor = clickPoint; MyInfoWindow.Content = e.Graphic.Attributes["name"]; MyInfoWindow.IsOpen = true; }
void WebMapKML_MouseLeftButtonUp(object sender, GraphicMouseButtonEventArgs e) { GraphicsLayer glayer = sender as GraphicsLayer; MapPoint clickPoint = MyMap.ScreenToMap(e.GetPosition(MyMap)); MyInfoWindow.Anchor = clickPoint; MyInfoWindow.Content = e.Graphic.Attributes["name"]; MyInfoWindow.IsOpen = true; }
void WebMapMapNotesPopups_MouseLeftButtonUp(object sender, GraphicMouseButtonEventArgs e) { GraphicsLayer glayer = sender as GraphicsLayer; MapPoint clickPoint = MyMap.ScreenToMap(e.GetPosition(MyMap)); if (clickPoint != lastPoint) { if (glayer.GetValue(Document.PopupTemplateProperty) != null) { DataTemplate dt = glayer.GetValue(Document.PopupTemplateProperty) as DataTemplate; MyInfoWindow.Anchor = clickPoint; MyInfoWindow.ContentTemplate = dt; MyInfoWindow.Content = e.Graphic.Attributes; MyInfoWindow.IsOpen = true; lastPoint = clickPoint; } } }
void WebMapFeatureServicePopups_MouseLeftButtonUp(object sender, GraphicMouseButtonEventArgs e) { FeatureLayer flayer = sender as FeatureLayer; MapPoint clickPoint = MyMap.ScreenToMap(e.GetPosition(MyMap)); if (clickPoint != lastPoint) { if (flayer.GetValue(Document.PopupTemplateProperty) != null) { DataTemplate dt = flayer.GetValue(Document.PopupTemplateProperty) as DataTemplate; MyInfoWindow.Anchor = clickPoint; MyInfoWindow.ContentTemplate = dt; MyInfoWindow.Content = e.Graphic.Attributes; MyInfoWindow.IsOpen = true; lastPoint = clickPoint; } } }
void WebMapFeatureServicePopups_MouseLeftButtonUp(object sender, GraphicMouseButtonEventArgs e) { FeatureLayer flayer = sender as FeatureLayer; MapPoint clickPoint = MyMap.ScreenToMap(e.GetPosition(MyMap)); if (clickPoint != lastPoint) { if (flayer.GetValue(Document.PopupTemplateProperty) != null) { DataTemplate dt = flayer.GetValue(Document.PopupTemplateProperty) as DataTemplate; MyInfoWindow.Anchor = clickPoint; MyInfoWindow.ContentTemplate = dt; MyInfoWindow.Foreground = new SolidColorBrush(Colors.Black); MyInfoWindow.Content = e.Graphic.Attributes; MyInfoWindow.IsOpen = true; lastPoint = clickPoint; } } }
private void vertexLayer_MouseLeftButtonDown(object sender, GraphicMouseButtonEventArgs args) { Graphic graphic = args.Graphic; if (graphic.Geometry is MapPoint) //Moving point { DraggingVertex = graphic; args.Handled = true; //Prevent map from reacting to mouse event DraggingVertex.Select(); StartTracking(); fromPoint = new MapPoint((graphic.Geometry as MapPoint).X, (graphic.Geometry as MapPoint).Y); } else if (graphic.Geometry is Polyline) //Adding vertex { 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); args.Handled = true; PointCollection pnts = graphic.Attributes["PointCollection"] as PointCollection; Graphic parent = graphic.Attributes["Feature"] as Graphic; //Add new vertex and immediately start tracking it if (snapVertex != null) { vertexLayer.Graphics.Remove(snapVertex); } DraggingVertex = AddVertexToEditLayer(parent, vertexLayer, snap); DraggingVertex.Select(); args.Handled = true; //Prevent map from reacting to mouse event StartTracking(); DraggingVertex.Attributes.Add("PointCollection", pnts); int index = pnts.IndexOf(line.Paths[0][0]); pnts.Insert(index + 1, snap); vertexLayer.Graphics.Remove(graphic); AddHoverLineSegment(pnts, line.Paths[0][0], snap, parent); AddHoverLineSegment(pnts, snap, line.Paths[0][1], parent); OnGeometryEdit(graphic, snap, null, Action.VertexAdded); fromPoint = new MapPoint(snap.X, snap.Y); } }
void graphicsLayer_MouseRightButtonDown(object sender, GraphicMouseButtonEventArgs e) { var entity = e.Graphic.Attributes.Values.First() as Entity; if (entity != null) { var point = e.GetPosition(AssociatedObject); IVehicle vehicleSelected = null; foreach (var vehicle in ServiceLocator.Current.GetInstance <IVehiclesSource>().Vehicles.Where(vehicle => vehicle.ID == entity.Id)) { vehicleSelected = vehicle as GuiQuadVehicle; } Messenger.Default.Send(new VehicleSelected { Vehicle = vehicleSelected, MouseClick = MouseClickEnum.Right, Thickness = new Thickness(point.X - 100, point.Y, 0, 0), }); } IsGraphicsLayerMouseButton = true; }
void graphicsLayer_MouseLeftButtonUp( object sender, GraphicMouseButtonEventArgs e ) { double X = e.GetPosition( MyMap ).X; double Y = e.GetPosition( MyMap ).Y; Debug.WriteLine( string.Format( "X: {0}, Y: {1}", X, Y ) ); }
private void FeatureLayer_MouseLeftButtonDown(object sender, GraphicMouseButtonEventArgs e) { if (showEditOptions) { // Ensures only one feature is selected and activated for edit. var l = sender as FeatureLayer; l.ClearSelection(); e.Graphic.Select(); // Displays edit options in an InfoWindow var clickPoint = MyMap.ScreenToMap(e.GetPosition(MyMap)); var isNew = !e.Graphic.Attributes.ContainsKey("objectid"); MyInfoWindow.ContentTemplate = isNew ? LayoutRoot.Resources["EditInfoWindowTemplateNewFeature"] as DataTemplate : LayoutRoot.Resources["EditInfoWindowTemplate"] as DataTemplate; MyInfoWindow.Placement = InfoWindow.PlacementMode.Auto; MyInfoWindow.Anchor = clickPoint; MyInfoWindow.Content = e.Graphic; MyInfoWindow.IsOpen = true; } }
private void graphicsLayerFromFeatureSet_MouseLeftButtonDown(object sender, GraphicMouseButtonEventArgs e) { Point pt = e.GetPosition(ContentPanel); myInfoWindow.DataContext = e.Graphic.Attributes; myInfoWindow.Anchor = MyMap.ScreenToMap(pt); myInfoWindow.IsOpen = true; }