Beispiel #1
0
        async void MyMapView_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
        {
            try
            {
                RemoveContextMenu();
                //MyMapView.ContextMenu.Visibility = Visibility.Collapsed;

                _isHitTesting = true;

                Point   screenPoint = e.GetPosition(MyMapView);
                Graphic graphic     = await ProjectGraphicsLayer.HitTestAsync(MyMapView, screenPoint);

                if (graphic != null)
                {
                    _selectGraphic = graphic;
                    AddContextMenu();
                }
            }
            catch
            {
            }
            finally
            {
                _isHitTesting = false;
            }
        }
        async void MyMapView_MouseDown(object sender, MouseButtonEventArgs e)
        {
            try
            {
                _isHitTesting = true;

                Point   screenPoint = e.GetPosition(MyMapView);
                Graphic graphic     = await ProjectGraphicsLayer.HitTestAsync(MyMapView, screenPoint);

                if (graphic != null)
                {
                    string definitionFile = graphic.Attributes["DefinitionFile"] as string;
                    App    app            = Application.Current as App;

                    IS3MainWindow mw = (IS3MainWindow)app.MainWindow;
                    mw.SwitchToMainFrame(definitionFile);
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                _isHitTesting = false;
            }
        }
Beispiel #3
0
        async void MyMapView_MouseMove(object sender, MouseEventArgs e)
        {
            if (_isHitTesting)
            {
                return;
            }

            try
            {
                _isHitTesting = true;

                Point screenPoint = e.GetPosition(MyMapView);

                //设置鼠标当前坐标
                MapPoint mapPoint = screenPoint2MapPoint(screenPoint);
                if (mapPoint == null)
                {
                    return;
                }
                setCoord(mapPoint);


                Graphic graphic = await ProjectGraphicsLayer.HitTestAsync(MyMapView, screenPoint);

                if (graphic != null)
                {
                    mapTip.DataContext = graphic;
                    mapTip.Visibility  = System.Windows.Visibility.Visible;
                    ProjectTitle.Text  = (string)graphic.Attributes["ID"];
                }
                else
                {
                    mapTip.Visibility = System.Windows.Visibility.Collapsed;
                    ProjectTitle.Text = "";
                }
            }
            catch
            {
                mapTip.Visibility = System.Windows.Visibility.Collapsed;
                ProjectTitle.Text = "";
            }
            finally
            {
                _isHitTesting = false;
            }
        }
Beispiel #4
0
        async void MyMapView_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            try
            {
                AddContextMenu();
                // MyMapView.ContextMenu.Visibility = Visibility.Collapsed;

                _isHitTesting = true;

                Point   screenPoint = e.GetPosition(MyMapView);
                Graphic graphic     = await ProjectGraphicsLayer.HitTestAsync(MyMapView, screenPoint);

                if (graphic != null)
                {
                    _selectGraphic = graphic;
                    foreach (Graphic g in gLayer.Graphics)
                    {
                        g.Symbol = _MarkerSymbol_Normal;
                    }
                    _selectGraphic.Symbol = _MarkerSymbol_Select;
                    for (int i = 0; i < myProjectList.Locations.Count; i++)
                    {
                        if (myProjectList.Locations[i].ID.ToString() == graphic.Attributes["ID"].ToString())
                        {
                            projectBox.SelectedIndex = i;
                            break;
                        }
                    }
                }
            }
            catch
            {
            }
            finally
            {
                _isHitTesting = false;
            }
        }