Ejemplo n.º 1
0
        //private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        //{
        //    if (e.AddedItems.Count > 0)
        //    {
        //        string theme = e.AddedItems[0].ToString();
        //        // Application Level
        //        Application.Current.ApplyTheme(theme);
        //    }
        //}

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            switch ((sender as Button).Name)
            {
            case "btnFull":
                m_DotMap.ZoomToMaxExtent();
                break;

            case "btnSetScale":
                if (m_SetScaleDlg == null)
                {
                    m_SetScaleDlg       = new SetScaleDlg();
                    m_SetScaleDlg.Owner = this;
                    m_SetScaleDlg.Init();
                    m_SetScaleDlg.Show();
                }
                break;

            case "btnCenter":
                ZoomToCoordinatesDialog f = new ZoomToCoordinatesDialog(m_DotMap);
                f.ShowDialog();
                break;

            case "btnAttribute":
                if (m_OpenAttributeTableDlg == null)
                {
                    m_OpenAttributeTableDlg = new OpenAttributeTableDlg();
                    m_OpenAttributeTableDlg.Show();
                }
                break;
            }
        }
Ejemplo n.º 2
0
        private void ZoomToCoordinates()
        {
            //Show dialog prompting user for Lat-Long coordinates.
            ZoomToCoordinatesDialog CoordinateDialog = new ZoomToCoordinatesDialog();
            CoordinateDialog.ShowDialog();

            //If user pressed OK, then calculate and move to coordinates.
            if (CoordinateDialog.DialogResult == DialogResult.OK)
            {
                double [] xy = new double[2];
                
                //Now convert from Lat-Long to x,y coordinates that App.Map.ViewExtents can use to pan to the correct location.
                xy = LatLonReproject(CoordinateDialog.lonCoor, CoordinateDialog.latCoor);

                //Get extent where center is desired X,Y coordinate.
                Double width = App.Map.ViewExtents.Width;
                Double height = App.Map.ViewExtents.Height;
                App.Map.ViewExtents.X = (xy[0] - (width / 2));
                App.Map.ViewExtents.Y = (xy[1] + (height / 2));
                Extent e = App.Map.ViewExtents;

                //Set App.Map.ViewExtents to new extent that centers on desired LatLong.
                App.Map.ViewExtents = e;
            }
            CoordinateDialog.Dispose();
        }