protected override void OnGraphicsLayerMouseUp(object sender, GraphicMouseButtonEventArgs e)
        {
            HighlightSelectedGraphic(e.Graphic);

            // Run the base's handler at last
            base.OnGraphicsLayerMouseUp(sender, e);
        }
Ejemplo n.º 2
0
        void graphicsLayer_MouseLeftButtonDown(object sender, GraphicMouseButtonEventArgs e)
        {
            e.Handled = true;
            Graphic graphic      = e.Graphic;
            Shape   dynamicShape = ItemsSource.FirstOrDefault(i => i.Geometry == graphic.Geometry);

            if (dynamicShape.ID == Const.ConstConnectionLine || dynamicShape.ID == Const.ConstWayPoint)
            {
                return;
            }
            var graphicsLayer = AssociatedObject.Layers["Shapes"] as GraphicsLayer;

            _vertexGraphicList.ForEach(f => ItemsSource.Remove(f));
            _vertexGraphicList.Clear();
            Graphic prevGraphic = null;

            if (EditShape != null)
            {
                prevGraphic = graphicsLayer.Graphics.FirstOrDefault(p => p.Geometry == EditShape.Geometry);
            }
            if (prevGraphic != null)
            {
                prevGraphic.Selected = false;
            }
        }
Ejemplo n.º 3
0
        private void GraphicsLayer_MouseLeftButtonDown(object sender, GraphicMouseButtonEventArgs e)
        {
            if (_OldPointGraphic != null)
            {
                _OldPointGraphic.Selected = false;
            }
            _OldPointGraphic = e.Graphic;
            e.Graphic.Select();

            if (checkClickToDownload.IsChecked.Value && !_IsDownloadingTimeSeries)
            {
                var item = cmbMaxRecords.SelectedItem as ComboBoxItem;
                if (item.Content.ToString() == "All")
                {
                    _QueryCriteria.MaximumRecord = 0;
                }
                else
                {
                    int max = 0;
                    int.TryParse(item.Content.ToString(), out max);
                    _QueryCriteria.MaximumRecord = max;
                }

                _SelectedStation = e.Graphic.Attributes["Site"] as Station;
                _OldPointGraphic = e.Graphic;
                string info = string.Format("Site Name:\t{0}\nLongitude:\t{1}\nLatitude:\t{2}",
                                            _SelectedStation.Name, _SelectedStation.Longitude, _SelectedStation.Latitude);
                _QueryCriteria.SiteID    = _SelectedStation.ID;
                CurrentAction            = UserAction.DownloadTimeSeries;
                GeneralInfo.Content      = "Retrieving time series...";
                _IsDownloadingTimeSeries = true;
                Client.GetDoubleTimeSeriesAsync(_QueryCriteria);
            }
        }
Ejemplo n.º 4
0
        void graphicsLayer_MouseLeftButtonUp(object sender, GraphicMouseButtonEventArgs e)
        {
            e.Handled = true;
            Graphic graphic      = e.Graphic;
            Shape   dynamicShape = ItemsSource.FirstOrDefault(i => i.Geometry == graphic.Geometry);

            if (dynamicShape.ID == Const.ConstConnectionLine || dynamicShape.ID == Const.ConstWayPoint)
            {
                return;
            }
            var  graphicsLayer = AssociatedObject.Layers["Shapes"] as GraphicsLayer;
            bool isValid       = IsValidGraphicChecked(graphic);

            if (!isValid)
            {
                return;
            }

            SelectByGraphic(graphic);

            if (dynamicShape != null)
            {
                Messenger.Default.Send(new TaskSelectedByShapeMessenger
                {
                    SelectedTaskId = dynamicShape.ID
                });
            }
        }
Ejemplo n.º 5
0
        }          // void Layers_LayersInitialized(object sender, EventArgs args)

        void gl_MouseLeftButtonDown(object sender, GraphicMouseButtonEventArgs e)
        {
            // call from map LB event
            try {
                log(string.Format("gl_MouseLeftButtonDown, continue draw or open popup wnd?"));
                if (this.draw != null && this.draw.IsEnabled != false)
                {
                    e.Handled = false;
                    log(string.Format("gl_MouseLeftButtonDown, make drawing - not popup"));
                    return;
                }
                var gr = e.Graphic;
                if (gr == null)
                {
                    log(string.Format("gl_MouseLeftButtonDown, e.Graphic is null, nothing to do"));
                    return;
                }
                log(string.Format("gl_MouseLeftButtonDown, open popup"));
                e.Handled = true;                 // timer business? LOG: System.NullReferenceException: Object reference not set to an instance of an object. at ESRI.ArcGIS.Mapping.Controls.Utils.EditorCommandUtility.StopEditing()
                editMarker(gr);
            }
            catch (Exception ex) {
                string msg = string.Format("Сбой редактирования пометки: \n [{0}]", ex.Message);
                MessageBox.Show(msg);
                log(msg);
            }
        }         // void gl_MouseLeftButtonDown(object sender, GraphicMouseButtonEventArgs e)
Ejemplo n.º 6
0
        private void FeatureLayer_MouseLeftButtonUp(object sender, GraphicMouseButtonEventArgs e)
        {
            var fl = (sender) as FeatureLayer;

            e.Graphic.Select();
            MyDataGrid.ScrollIntoView(e.Graphic, null);
        }
        /// <summary>
        /// Graphic Click Event Handler; An inheriting widget must override this method, but run this method at last
        /// </summary>
        protected virtual void OnGraphicsLayerMouseUp(object sender, GraphicMouseButtonEventArgs e)
        {
            PopupWindow tipGrid = ((this.graphicsLayer.MapTip == null) ? e.Graphic.MapTip : this.graphicsLayer.MapTip) as PopupWindow;

            if (tipGrid != null)
            {
                ModifierKeys keys       = Keyboard.Modifiers;
                bool         controlKey = (keys & ModifierKeys.Control) != 0;
                if (controlKey && tipGrid.Resources.Contains("HyperlinkField"))
                {
                    string hyperlinkField = tipGrid.Resources["HyperlinkField"] as string;
                    string sUrl           = (e.Graphic.Attributes.ContainsKey(hyperlinkField)) ? (e.Graphic.Attributes[hyperlinkField] as string) : "";

                    if (!string.IsNullOrEmpty(sUrl))
                    {
                        System.Windows.Browser.HtmlPopupWindowOptions winOptions = new System.Windows.Browser.HtmlPopupWindowOptions()
                        {
                            Resizeable = true, Width = 800, Height = 700
                        };
                        System.Windows.Browser.HtmlWindow win = System.Windows.Browser.HtmlPage.PopupWindow(new Uri(sUrl), "_blank", winOptions);
                    }
                }
            }

            this.DrawObject.IsEnabled = this.wasDrawObjectEnabled;
        }
        // Handle mouse-up when the target layer is a graphics layer to check whether a graphic was clicked
        private void GraphicsLayer_MouseLeftButtonUp(object sender, GraphicMouseButtonEventArgs e)
        {
            // Check whether the graphic that the mouse was released over is the same as the one that
            // the mouse was pressed over.  Also see whether the mouse was released within the click
            // interval.
            if (e.Graphic.Equals(_mouseDownGraphic) && _clickTimer.IsEnabled)
            {
                // Both conditions met - a graphic was clicked.

                // Mark the event as handled so other actions do not occur
                e.Handled = true;

                // Clear error
                Error = null;

                // Set busy state
                IsBusy = true;

                _clickTimer.Stop(); // Stop the timer

                Geometry clickGeometry = e.Graphic.Geometry.Clone();
                clickGeometry.SpatialReference = clickGeometry.SpatialReference ?? Map.SpatialReference.Clone();
                // Update the feature - make a copy of it so it can be added to other layers
                OnCompleted(new Graphic()
                {
                    Geometry = clickGeometry
                });
            }
        }
        private void GraphicsLayer_MouseLeftButtonUp(object sender, GraphicMouseButtonEventArgs e)
        {
            (sender as GraphicsLayer).ClearSelection();
            e.Graphic.Select();

            // select the corresponding item in the ListBox
            FeatureListBox.SelectedItem = e.Graphic;
        }
 private void FeatureLayer_MouseLeftButtonDown(object sender, GraphicMouseButtonEventArgs args)
 {
     args.Graphic.Selected = !args.Graphic.Selected;
     if (args.Graphic.Selected)
     {
         MyDataGrid.ScrollIntoView(args.Graphic, null);
     }
 }
        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;
        }
 /// <summary>
 /// FeatureLayer MouseUp Event Handler
 /// </summary>
 private void FeatureLayer_MouseLeftButtonUp(object sender, GraphicMouseButtonEventArgs e)
 {
     if (activeCommand == "Attributes")
     {
         FeatureLayer fLayer = sender as FeatureLayer;
         OpenFeatureDataEditor(fLayer, e.Graphic);
     }
 }
        private void GraphicsLayer_MouseLeftButtonUp(object sender, GraphicMouseButtonEventArgs e)
        {
            (sender as GraphicsLayer).ClearSelection();
            e.Graphic.Select();

            // select the corresponding item in the ListBox
            FeatureListBox.SelectedItem = e.Graphic;
        }
Ejemplo n.º 14
0
 private void FindResultLayer_MouseLeftButtonDown(object sender, GraphicMouseButtonEventArgs e)
 {
     var resultNumber = Convert.ToInt32(e.Graphic.Attributes["ResultNumber"], CultureInfo.InvariantCulture);
     if (destinations.ContainsKey(resultNumber))
     {
         var destination = destinations[resultNumber];
         GetDirectionToDestination(destination);
     }
 }
Ejemplo n.º 15
0
        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;
        }
        private void MouseDown(object sender, GraphicMouseButtonEventArgs e)
        {
            var mapEditorScreenViewModel = DataContext as MapEditorScreenViewModel;

            var vm = ViewModelHelper.GetViewModel(sender as DependencyObject);

            if (mapEditorScreenViewModel != null)
                mapEditorScreenViewModel.MouseDown(vm as IFeatureLayerViewModel, e);
        }
 // Click on a graphic in the map and select it.  Scroll to the web map item in the Listbox.
 private void GraphicsLayer_MouseLeftButtonUp(object sender, GraphicMouseButtonEventArgs e)
 {
     webmapGraphicsLayer.ClearSelection();
     Graphic graphic = e.Graphic;
     graphic.Selected = true;
     ArcGISPortalItem portalitem = graphic.Attributes["PortalItem"] as ArcGISPortalItem;
     WebMapsListBox.SelectedItem = portalitem;
     WebMapsListBox.ScrollIntoView(portalitem);
 }
Ejemplo n.º 18
0
 private void AnnotationLayer_MouseLeftButtonDown_1(object sender, GraphicMouseButtonEventArgs e)
 {
     if (toggleDeleteGraphics.IsChecked.Value) //only delete if delete tool is active
     {
         GraphicsLayer annotations = Map.Layers["Annotations"] as GraphicsLayer;
         annotations.Graphics.Remove(e.Graphic);
         return;
     }
 }
Ejemplo n.º 19
0
        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;
        }
Ejemplo n.º 20
0
 private void Layer_MouseLeftButtonDown(object sender, GraphicMouseButtonEventArgs args)
 {
     if (this.displayAttribute && sender is FeatureLayer)
     {
         FeatureLayer featureLayer = sender as FeatureLayer;
         TemplatePicker.ShowAttributeForm(featureLayer, args.Graphic);
         this.displayAttribute = this.Continuous;
         args.Handled          = true;
     }
 }
        private void FeatureLayer_MouseLeftButtonUp(object sender, GraphicMouseButtonEventArgs e)
        {
            if (_lastGraphic != null)
                _lastGraphic.UnSelect();

            e.Graphic.Select();
            if (e.Graphic.Selected)
                MyDataGrid.ScrollIntoView(e.Graphic, null);

            _lastGraphic = e.Graphic;
        }
 private void GraphicsLayer_MouseLeftButtonUp(object sender, GraphicMouseButtonEventArgs e)
 {
     if (EnableEditVerticesScaleRotate.IsChecked.Value)
       {
     MyDrawObject.DrawMode = DrawMode.None;
     UnSelectTools();
     Editor editor = LayoutRoot.Resources["MyEditor"] as Editor;
     if (e.Graphic != null && !(e.Graphic.Geometry is ESRI.ArcGIS.Client.Geometry.MapPoint))
       editor.EditVertices.Execute(e.Graphic);
       }
 }
 private void GraphicsLayer_MouseLeftButtonUp(object sender, GraphicMouseButtonEventArgs e)
 {
     if (EnableEditVerticesScaleRotate.IsChecked.Value)
     {
         Editor editor = LayoutRoot.Resources["MyEditor"] as Editor;
         if (e.Graphic != null && !(e.Graphic.Geometry is ESRI.ArcGIS.Client.Geometry.MapPoint))
         {
             editor.EditVertices.Execute(e.Graphic);
         }
     }
 }
        private void FeatureLayer_MouseLeftButtonUp(object sender, GraphicMouseButtonEventArgs e)
        {
            FeatureLayer featureLayer = sender as FeatureLayer;

            foreach (Graphic g in featureLayer.Graphics)
              if (g.Selected)
                g.UnSelect();

            e.Graphic.Select();
            MyAttachmentEditor.GraphicSource = e.Graphic;
        }
Ejemplo n.º 25
0
        // Click on a graphic in the map and select it.  Scroll to the web map item in the Listbox.
        private void GraphicsLayer_MouseLeftButtonUp(object sender, GraphicMouseButtonEventArgs e)
        {
            webmapGraphicsLayer.ClearSelection();
            Graphic graphic = e.Graphic;

            graphic.Selected = true;
            ArcGISPortalItem portalitem = graphic.Attributes["PortalItem"] as ArcGISPortalItem;

            WebMapsListBox.SelectedItem = portalitem;
            WebMapsListBox.ScrollIntoView(portalitem);
        }
Ejemplo n.º 26
0
 private void dsStaticSubLayer_MouseLeftButtonDown(object sender, GraphicMouseButtonEventArgs e)
 {
     // NOTE DO NOT REMOVE: ALTHOUGH EMPTY, WHEN NOT PRESENT, THE CLICK EVENT IS IGNORED!
     var g = e.Graphic;
     g.Select();
     foreach (var selectedGraphic in selectedGraphicItems.ToArray())
     {
         selectedGraphic.UnSelect();
     }
     selectedGraphicItems.Clear();
     selectedGraphicItems.Add(g);
 }
        // Handle mouse-down when the target layer is a graphics layer
        private void GraphicsLayer_MouseLeftButtonDown(object sender, GraphicMouseButtonEventArgs e)
        {
            // Mark the event as handled so other actions do not occur
            e.Handled = true;

            // Store the graphic so we can check to see if the same graphic is moused-up
            _mouseDownGraphic = e.Graphic;

            // Start the timer to see whether mouse-up happens quickly enough that the
            // mouse-down, mouse-up sequence can be considered a click
            _clickTimer.Start();
        }
 private void GraphicsLayer_MouseLeftButtonDown(object sender, GraphicMouseButtonEventArgs e)
 {
     if (EnableEditVerticesScaleRotate.IsChecked.Value)
     {
         if (e.Graphic != null && !(e.Graphic.Geometry is ESRI.ArcGIS.Client.Geometry.MapPoint))
         {
             MyDrawObject.DrawMode = DrawMode.None;
             UnSelectTools();
             editor.EditVertices.Execute(e.Graphic);
             activeGraphic = e.Graphic;
         }
     }
 }
 private void graphicsLayer_MouseLeftButtonDown(object sender, GraphicMouseButtonEventArgs e)
 {
     Dispatcher.BeginInvoke(() =>
     {
         if (e.Handled)
         {
             return;
         }
         _wasDoubleClick = false;
         _doubleClickTimer.Start();
     }
                            );
 }
Ejemplo n.º 30
0
        private void FeatureLayer_MouseLeftButtonUp(object sender, GraphicMouseButtonEventArgs args)
        {
            FeatureLayer featureLayer = sender as FeatureLayer;

            foreach (Graphic g in featureLayer.Graphics)
              if (g.Selected)
                g.UnSelect();

            args.Graphic.Select();
            MyFeatureDataForm.GraphicSource = args.Graphic;

            FeatureDataFormBorder.Visibility = Visibility.Visible;
        }
        private void FeatureLayer_MouseLeftButtonUp(object sender, GraphicMouseButtonEventArgs e)
        {
            foreach (Graphic g in featureLayer.Graphics)
            {
                if (g.Selected)
                {
                    g.UnSelect();
                }
            }

            e.Graphic.Select();
            attachmentEditor.GraphicSource = e.Graphic;
        }
 private void GraphicsLayer_MouseLeftButtonDown(object sender, GraphicMouseButtonEventArgs e)
 {
     if (EnableEditVerticesScaleRotate.IsChecked.Value)
     {
         if (e.Graphic != null && !(e.Graphic.Geometry is ESRI.ArcGIS.Client.Geometry.MapPoint))
         {
             MyDrawObject.DrawMode = DrawMode.None;
             UnSelectTools();
             editor.EditVertices.Execute(e.Graphic);
             activeGraphic = e.Graphic;
         }
     }
 }
        private void FeatureLayer_MouseLeftButtonUp(object sender, GraphicMouseButtonEventArgs args)
        {
            FeatureLayer featureLayer = sender as FeatureLayer;

            foreach (Graphic g in featureLayer.Graphics)
              if (g.Selected)
                g.UnSelect();

            args.Graphic.Select();
            MyFeatureDataForm.GraphicSource = args.Graphic;

            FeatureDataFormBorder.Visibility = Visibility.Visible;
        }
        private void GraphicsLayer_MouseLeftButtonDown(object sender, GraphicMouseButtonEventArgs e)
        {
            string stateName = Convert.ToString(e.Graphic.Attributes["STATE_NAME"]);

            foreach (Graphic g in _lastActiveGraphics)
            {
                g.Symbol = LayoutRoot.Resources["TransparentFillSymbol"] as Symbol;
            }
            _lastActiveGraphics.Clear();

            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://serverapps.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;
            FillSymbol stateVideoFillSymbol = LayoutRoot.Resources["RedFillSymbol"] as FillSymbol;

            //(stateVideoFillSymbol.Fill as VideoBrush).SetSource(stateMediaElement);
            e.Graphic.Symbol = stateVideoFillSymbol;

            _lastActiveGraphics.Add(e.Graphic);
        }
        private void GraphicsLayer_MouseLeftButtonDown(object sender, GraphicMouseButtonEventArgs e)
        {
            e.Handled = true;

            if (e.Graphic.Geometry is MapPoint)
            {
                e.Graphic.Selected = true;
                selectedPointGraphic = e.Graphic;
            }
            else
            {
                editGeometry.StartEdit(e.Graphic);
            }
        }
        private void GraphicsLayer_MouseLeftButtonDown(object sender, GraphicMouseButtonEventArgs e)
        {
            e.Handled = true;

            if (e.Graphic.Geometry is MapPoint)
            {
                e.Graphic.Selected   = true;
                selectedPointGraphic = e.Graphic;
            }
            else
            {
                editGeometry.StartEdit(e.Graphic);
            }
        }
Ejemplo n.º 37
0
        private void FeatureLayer_MouseLeftButtonUp(object sender, GraphicMouseButtonEventArgs e)
        {
            if (_lastGraphic != null)
            {
                _lastGraphic.UnSelect();
            }

            e.Graphic.Select();
            if (e.Graphic.Selected)
            {
                MyDataGrid.ScrollIntoView(e.Graphic, null);
            }

            _lastGraphic = e.Graphic;
        }
Ejemplo n.º 38
0
        private void FeatureLayer_MouseLeftButtonDown(object sender, GraphicMouseButtonEventArgs e)
        {
            // enable the delete icon if user is the owner, otherwise disable it
            if (e.Graphic != null && (sender as FeatureLayer).IsUpdateAllowed(e.Graphic))
            {
                (ApplicationBar.Buttons[1] as IApplicationBarIconButton).IsEnabled = true;
            }
            else
            {
                (ApplicationBar.Buttons[1] as IApplicationBarIconButton).IsEnabled = false;
            }

            (sender as FeatureLayer).ClearSelection();
            e.Graphic.Select();
            (ApplicationBar.Buttons[2] as IApplicationBarIconButton).IsEnabled = true;
        }
Ejemplo n.º 39
0
        /// <summary>
        /// Called when a feature is clicked. Makes the clicked feature "active" for editing,
        /// by creating a set of vertices in an edit layer
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="graphic">The graphic.</param>
        /// <param name="args">The <see cref="System.Windows.Input.MouseButtonEventArgs"/> instance containing the event data.</param>
        private void GraphicsLayer_MouseLeftButtonDown(object sender, GraphicMouseButtonEventArgs args)
        {
            Graphic graphic = args.Graphic;

            if (graphic.Geometry is MapPoint)
            {
                args.Handled = true;
            }
            if (activeGraphic == graphic)
            {
                StopEdit();
            }
            else
            {
                StartEdit(graphic);
            }
        }
Ejemplo n.º 40
0
        void layer_MouseLeftButtonDown(object sender, GraphicMouseButtonEventArgs e)
        {
            Graphic graphic = e.Graphic;

            var item = graphic.Attributes.Values.FirstOrDefault() as Entity;

            if (item != null)
            {
                var vehicles = ServiceLocator.Current.GetInstance <IVehiclesSource>().Vehicles;

                item.IsSelected = !item.IsSelected;
                foreach (GuiQuadVehicle vehicle in vehicles.Cast <GuiQuadVehicle>().Where(vehicle => vehicle.ID == item.Id))
                {
                    vehicle.IsSelected = item.IsSelected;
                }
            }
        }
Ejemplo n.º 41
0
        private void GridLayer_MouseLeftButtonDown(object sender, GraphicMouseButtonEventArgs e)
        {
            var id = int.Parse(e.Graphic.Attributes["ID"].ToString());

            CurrentAction            = UserAction.DownloadTimeSeries;
            GeneralInfo.Content      = "Retrieving time series...";
            _IsDownloadingTimeSeries = true;
            _selected_cell_id        = id;
            if (rbtnTemp.IsChecked.Value)
            {
                _GridRender.VariableIndex = 0;
            }
            if (rbtnChla.IsChecked.Value)
            {
                _GridRender.VariableIndex = 1;
            }
            Client.GetPointProfileAsync(_GridRender.VariableIndex, id);
        }
 private void FeatureLayer_MouseLeftButtonDown(object sender, GraphicMouseButtonEventArgs e)
 {
     if (e.Graphic != null && !e.Graphic.Selected && (sender as FeatureLayer).IsUpdateAllowed(e.Graphic))
     {
         Editor editor = LayoutRoot.Resources["MyEditor"] as Editor;
         if ((sender as FeatureLayer).IsUpdateAllowed(e.Graphic))
         {
             if (editor.EditVertices.CanExecute(null))
                 editor.EditVertices.Execute(null);
         }
         else
             if (editor.CancelActive.CanExecute(null))
                 editor.CancelActive.Execute(null);
     }
     (sender as FeatureLayer).ClearSelection();
     e.Graphic.Select();
     MyDataGrid.ScrollIntoView(e.Graphic, null);
 }
Ejemplo n.º 43
0
        void graphicsLayer_MouseLeftButtonDown(object sender, GraphicMouseButtonEventArgs e)
        {
            var entity = e.Graphic.Attributes.Values.First() as Entity;

            if (entity != null)
            {
                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.Left
                });
                var graphic = entity as Graphic;
                //graphic.
                //Application.Current.Dispatcher.Invoke(new Action(() => { graphic.Select(); }));
            }
        }
        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;
                }
            }
        }
Ejemplo n.º 45
0
        private void GraphicsLayer_MouseLeftButtonDown(object sender, GraphicMouseButtonEventArgs e)
        {
            string stateName = Convert.ToString(e.Graphic.Attributes["STATE_NAME"]);

            foreach (Graphic g in _lastActiveGraphics)
                g.Symbol = LayoutRoot.Resources["TransparentFillSymbol"] as Symbol;
            _lastActiveGraphics.Clear();

            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://serverapps.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;
            FillSymbol stateVideoFillSymbol = LayoutRoot.Resources["RedFillSymbol"] as FillSymbol;
            //(stateVideoFillSymbol.Fill as VideoBrush).SetSource(stateMediaElement);
            e.Graphic.Symbol = stateVideoFillSymbol;

            _lastActiveGraphics.Add(e.Graphic);
        }
Ejemplo n.º 46
0
 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 ) );
 }
Ejemplo n.º 47
0
 private void MouseDown(object sender, GraphicMouseButtonEventArgs e)
 {
 }
Ejemplo n.º 48
0
 private void FeatureLayer_MouseLeftButtonUp(object sender, GraphicMouseButtonEventArgs e)
 {
     var fl = (sender) as FeatureLayer;
     e.Graphic.Select();
     MyDataGrid.ScrollIntoView(e.Graphic, null);
 }
Ejemplo n.º 49
0
 private void GraphicsLayer_MouseLeftButtonUp(object sender, GraphicMouseButtonEventArgs e)
 {
     _lastActiveGraphics.Remove(e.Graphic);
 }
Ejemplo n.º 50
0
 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 FeatureLayer_MouseLeftButtonDown(object sender, GraphicMouseButtonEventArgs e)
        {
            // enable the delete icon if user is the owner, otherwise disable it
            if (e.Graphic != null && (sender as FeatureLayer).IsUpdateAllowed(e.Graphic))
                    (ApplicationBar.Buttons[1] as IApplicationBarIconButton).IsEnabled = true;
            else
                (ApplicationBar.Buttons[1] as IApplicationBarIconButton).IsEnabled = false;

            (sender as FeatureLayer).ClearSelection();
            e.Graphic.Select();
            (ApplicationBar.Buttons[2] as IApplicationBarIconButton).IsEnabled = true;
        }
        private void FeatureLayer_MouseLeftButtonDown(object sender, GraphicMouseButtonEventArgs e)
        {
            // show the attribute page for the first of the graphics returned
            FeatureInfoPage.IsOpen = true;
            ApplicationBar.IsVisible = false;

            FeatureInfoPage.DataContext = e.Graphic;
            // select the type and confirm values in the ListBoxes to match the graphic's attributes
            var facilityMatches = facilityFieldDomain.CodedValues.Where(a => a.Key.Equals(e.Graphic.Attributes["facility"]));
            if (facilityMatches.Any())
                FacilityChoicesListBox.SelectedItem = facilityMatches.First();

            var qualityMatches = qualityFieldDomain.CodedValues.Where(a => a.Key.Equals(e.Graphic.Attributes["quality"]));
            if (qualityMatches.Any())
                QualityChoicesListBox.SelectedItem = qualityMatches.First();
        }
Ejemplo n.º 53
0
 /// <summary>
 /// In case the mouse release happens, stop the edit operation
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void LayerMouseLeftButtomUp(object sender, GraphicMouseButtonEventArgs e)
 {
     if (graphicNew != null)
     {
         graphicNew = null;
         graphic2Edited = null;
         gisOperations.GetMap().MouseMove -= MapMouseMove;
         if (pointLayer != null)
         {
             pointLayer.MouseLeftButtonDown -= LayerMouseLeftButtonDown;
             pointLayer.MouseLeftButtonUp -= LayerMouseLeftButtomUp;
         }
     }
     editActionActive = false;
     RefreshButtonStatus();
 }
Ejemplo n.º 54
0
 /// <summary>
 /// Editing start with mouse down on the layer
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void LayerMouseLeftButtonDown(object sender, GraphicMouseButtonEventArgs e)
 {
     e.Handled = true;
     if (e.Graphic.Geometry is MapPoint)
     {
         graphic2Edited = e.Graphic;
         graphicNew = e.Graphic;
     }
 }
 private void GraphicsLayer_MouseLeftButtonDown(object sender, GraphicMouseButtonEventArgs e)
 {
     e.Graphic.Selected = !e.Graphic.Selected;
 }
 private void FeatureLayer_MouseLeftButtonDown(object sender, GraphicMouseButtonEventArgs args)
 {
     args.Graphic.Selected = !args.Graphic.Selected;
     if (args.Graphic.Selected)
         MyDataGrid.ScrollIntoView(args.Graphic, null);
 }
 private void GraphicsLayer_MouseLeftButtonDown(object sender, GraphicMouseButtonEventArgs e)
 {
     DataListBox.Focus();
     DataListBox.SelectedItem = e.Graphic;
     DataListBox.ScrollIntoView(DataListBox.SelectedItem);
 }
 private void Layer_MouseLeftButtonDown(object sender, GraphicMouseButtonEventArgs args)
 {
     if (this.displayAttribute && sender is FeatureLayer)
     {
         FeatureLayer featureLayer = sender as FeatureLayer;
         TemplatePicker.ShowAttributeForm(featureLayer, args.Graphic);
         this.displayAttribute = this.Continuous;
         args.Handled = true;
     }
 }
Ejemplo n.º 59
0
        private void LeftUp(object sender, GraphicMouseButtonEventArgs e)
        {
            if (SelectedGraphics == null) return;

            var point = SelectedGraphics.Geometry as MapPoint;
            if (point != null)
            {
                MovingPoint = false;
            }
        }
 private void GraphicsLayer_MouseLeftButtonUp(object sender, GraphicMouseButtonEventArgs e)
 {
     (sender as GraphicsLayer).ClearSelection();
     e.Graphic.Select();
 }