Beispiel #1
0
        private void btn_Center_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            IPoint pPoint      = MeasureUtils.GetCenterPoint(AeUtils.GetStudentList());
            string LocationPRJ = String.Format("投影坐标:({0}, {1})", pPoint.X, pPoint.Y);

            AeUtils.DrawCenterPoint(pPoint);
            IPoint pPointCGS   = AeUtils.PRJtoGCS(pPoint);
            string LocationCGS = String.Format("地理坐标:({0}, {1})", pPointCGS.X, pPointCGS.Y);

            MessageBox.Show(String.Format("平均中心\n{0}\n{1}", LocationPRJ, LocationCGS));
        }
Beispiel #2
0
        private void FormMain_Load(object sender, EventArgs e)
        {
            AeUtils.SetMapControl(m_pMapC2);
            AeUtils.SetMapDocument(m_pMapDoc);
            AeUtils.LoadMxd(Application.StartupPath + @"\Data\Map.mxd");
            AeUtils.CloseWaitForm += CloseWaitForm;

            ShowMapScaleInfo();

            SqlUtils.UpdataDatabaseView(dataGridView_Main);
        }
Beispiel #3
0
        public static List <IPoint> GetStudentList()
        {
            List <IPoint>  pointList      = new List <IPoint>();
            IFeatureLayer  pFeatureLayer  = AeUtils.GetFeatureLayerByName("Students");
            IFeatureCursor pFeatureCursor = pFeatureLayer.FeatureClass.Search(null, false);
            IFeature       pFeature       = pFeatureCursor.NextFeature();

            while (pFeature != null)
            {
                IPoint pPoint = pFeature.Shape as IPoint;
                pPoint.Project(m_pMapC2.SpatialReference);
                pointList.Add(pPoint);
                pFeature = pFeatureCursor.NextFeature();
            }
            return(pointList);
        }
Beispiel #4
0
 private void axMapControl_Main_OnMouseDown(object sender, IMapControlEvents2_OnMouseDownEvent e)
 {
     if (e.button == 4)
     {
         AeUtils.Pan();
     }
     else if (e.button == 1 && f_EditStudent != null && !f_EditStudent.IsDisposed && f_EditStudent.IsGettingPoint)
     {
         IPoint pPoint = new PointClass()
         {
             X = e.mapX, Y = e.mapY, SpatialReference = m_pMapC2.SpatialReference
         };
         f_EditStudent.Point          = pPoint;
         f_EditStudent.IsGettingPoint = false;
         f_EditStudent.WindowState    = FormWindowState.Normal;
         AeUtils.SetMousePointer(esriControlsMousePointer.esriPointerArrow);
         f_EditStudent.Home = AeUtils.GetClickHome(pPoint); // 获取点击位置的省份
     }
     else if (e.button == 1 && m_pMapC2.MousePointer == esriControlsMousePointer.esriPointerIdentify)
     {
         if (f_StudentInfo == null || f_StudentInfo.IsDisposed)
         {
             f_StudentInfo = new Forms.FormStudentInfo();
             f_StudentInfo.SetInfo(AeUtils.SelectStudentFeatureByPoint(new PointClass()
             {
                 X = e.mapX,
                 Y = e.mapY,
                 SpatialReference = m_pMapC2.SpatialReference
             }));
             try
             {
                 f_StudentInfo.Show();
             }
             catch { }
         }
         else
         {
             f_StudentInfo.SetInfo(AeUtils.SelectStudentFeatureByPoint(new PointClass()
             {
                 X = e.mapX,
                 Y = e.mapY,
                 SpatialReference = m_pMapC2.SpatialReference
             }));
         }
     }
 }
Beispiel #5
0
 private void btn_DeleteStudent_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (f_EditStudent == null || f_EditStudent.IsDisposed)
     {
         string strSName = dataGridView_Main.SelectedRows[0].Cells[2].Value.ToString(),
                strId    = dataGridView_Main.SelectedRows[0].Cells[0].Value.ToString();
         if (MessageBox.Show(String.Format("是否删除学生【{0};Id:{1}】", strSName, strId), "提醒", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             if (SqlUtils.DeleteStudent(strId))
             {
                 AeUtils.DeleteStudent(strId);
                 MessageBox.Show(String.Format("学生【{0};Id:{1}】删除成功", strSName, strId));
                 SqlUtils.UpdataDatabaseView(dataGridView_Main);
             }
         }
     }
     else
     {
         MessageBox.Show("正在添加或编辑学生信息中", "无法删除学生信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
Beispiel #6
0
        private void ShowLocationInfo(IMapControlEvents2_OnMouseMoveEvent e)
        {
            IPoint pPoint = new PointClass()
            {
                X = e.mapX,
                Y = e.mapY,
                SpatialReference = m_pMapC2.SpatialReference
            };
            string unit = m_pMapC2.MapUnits.ToString().Substring(4);

            switch (this.m_pLocationInfoUnit)
            {
            case 0:
                tbx_LocationInfo.Text = AeUtils.GetLocationInfo(pPoint, unit);
                break;

            case 1:
                tbx_LocationInfo.Text = AeUtils.GetLocationInfo(pPoint);
                break;
            }
        }
Beispiel #7
0
        private void btn_EditStudent_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            string strId     = dataGridView_Main.SelectedRows[0].Cells[0].Value.ToString(),
                   strSId    = dataGridView_Main.SelectedRows[0].Cells[1].Value.ToString(),
                   strSName  = dataGridView_Main.SelectedRows[0].Cells[2].Value.ToString(),
                   strSSex   = dataGridView_Main.SelectedRows[0].Cells[3].Value.ToString(),
                   strSBirth = dataGridView_Main.SelectedRows[0].Cells[4].Value.ToString(),
                   strSHome  = dataGridView_Main.SelectedRows[0].Cells[5].Value.ToString();
            IPoint pPoint    = AeUtils.GetPointFromId(strId);

            if (f_EditStudent == null || f_EditStudent.IsDisposed)
            {
                f_EditStudent = new Forms.FormEditStudent(pPoint, strId, strSId, strSName, strSSex, strSBirth, strSHome);
                f_EditStudent.UpdataDatabaseView += () => {
                    SqlUtils.UpdataDatabaseView(dataGridView_Main);
                };
                f_EditStudent.Show();
            }
            else
            {
                f_EditStudent.Show();
            }
        }
Beispiel #8
0
 private void btn_SearchStudent_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     AeUtils.SetMousePointer(esriControlsMousePointer.esriPointerIdentify);
 }
Beispiel #9
0
 private void btn_Pan_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     AeUtils.PanTool(); // 漫游
 }
Beispiel #10
0
 private void btn_ClearAnalysis_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     AeUtils.DeleteAllMapElement();
     m_pMapC2.Map.DeleteLayer(AeUtils.GetFeatureLayerByName("tyson"));
 }
Beispiel #11
0
 private void btn_distributed_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     double R = MeasureUtils.GetRValue(AeUtils.GetStudentList(), 9600000000000.0);
 }
Beispiel #12
0
 private void btn_Taisen_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     OpenWaitForm();
     AeUtils.GetTysonPolygon();
 }
Beispiel #13
0
 private void btn_FullExtent_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     AeUtils.FullExtent(); // 全图
 }
Beispiel #14
0
 private void btn_ZoomToSelectedStudent_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     AeUtils.ZoomToSelectStudent();
 }
Beispiel #15
0
 private void btn_Default_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     AeUtils.DefaultTool(); // 默认
 }
Beispiel #16
0
 private void btn_SaveMxd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     AeUtils.SaveMxd();
 }
Beispiel #17
0
 private void btn_ZoomOutFiexd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     AeUtils.ZoomOutFiexd(); // 比例缩小
 }
Beispiel #18
0
 private void btn_ZoomOut_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     AeUtils.ZoomOutTool(); // 拉框缩小
 }