Beispiel #1
0
 private void OnFinishedDraw()
 {
     if (this._drawTool != null && this._drawTool.GeoType == DrawType.Polygon && this._drawTool.GetGeo() != null)
     {
         try
         {
             WaitForm.Start("正在统计...", "请稍后");
             DataTable dtResult = RegionAnalysis();
             if (dtResult == null || dtResult.Rows.Count == 0)
             {
                 WaitForm.Stop();
                 XtraMessageBox.Show("统计结果为空!", "提示");
                 return;
             }
             WaitForm.Stop();
             FrmPipeNodeStatsOutput dialog = new FrmPipeNodeStatsOutput();
             dialog.SetData1(dtResult);
             dialog.ShowDialog();
         }
         catch
         {
             WaitForm.Stop();
         }
     }
 }
Beispiel #2
0
 public override void Run(object sender, EventArgs e)
 {
     try
     {
         WaitForm.Start("正在统计...", "请稍后");
         DataTable dtResult = DoStats();
         if (dtResult == null || dtResult.Rows.Count == 0)
         {
             WaitForm.Stop();
             XtraMessageBox.Show("统计结果为空!", "提示");
             return;
         }
         WaitForm.Stop();
         FrmPipeNodeStatsOutput dialog = new FrmPipeNodeStatsOutput();
         dialog.SetData1(dtResult);
         dialog.ShowDialog();
     }
     catch
     {
         WaitForm.Stop();
     }
 }
        public override void OnMouseDown(int button, int shift, int x, int y, double mapX, double mapY)
        {
            DF2DApplication app   = DF2DApplication.Application;
            bool            ready = true;

            if (app == null || app.Current2DMapControl == null || app.Workbench == null)
            {
                return;
            }
            app.Workbench.SetMenuEnable(true);
            m_ActiveView = app.Current2DMapControl.ActiveView;
            IScreenDisplay m_Display = app.Current2DMapControl.ActiveView.ScreenDisplay;

            try
            {
                if (button == 1)
                {
                    ISimpleLineSymbol pLineSym = new SimpleLineSymbol();
                    IRgbColor         pColor   = new RgbColorClass();
                    pColor.Red     = 255;
                    pColor.Green   = 255;
                    pColor.Blue    = 0;
                    pLineSym.Color = pColor;
                    pLineSym.Style = esriSimpleLineStyle.esriSLSSolid;
                    pLineSym.Width = 2;

                    ISimpleFillSymbol pFillSym = new SimpleFillSymbol();

                    pFillSym.Color   = pColor;
                    pFillSym.Style   = esriSimpleFillStyle.esriSFSDiagonalCross;
                    pFillSym.Outline = pLineSym;

                    object      symbol = pFillSym as object;
                    IRubberBand band   = new RubberPolygonClass();
                    IGeometry   geo    = band.TrackNew(m_Display, null);
                    app.Current2DMapControl.DrawShape(geo, ref symbol);
                    WaitForm.Start("正在查询...", "请稍后");
                    if (geo.IsEmpty)
                    {
                        IPoint searchPoint = new PointClass();
                        searchPoint.PutCoords(mapX, mapY);
                        geo = PublicFunction.DoBuffer(searchPoint, PublicFunction.ConvertPixelsToMapUnits(m_ActiveView, GlobalValue.System_Selection_Option().Tolerate));
                        //m_ActiveView.FocusMap.SelectByShape(geo, s, false);
                    }
                    if (ready)
                    {
                        WaitForm.Start("正在统计...", "请稍后");
                        DataTable dtResult = RegionAnalysis(geo);
                        if (dtResult == null || dtResult.Rows.Count == 0)
                        {
                            WaitForm.Stop();
                            XtraMessageBox.Show("统计结果为空!", "提示");
                            return;
                        }
                        WaitForm.Stop();
                        FrmPipeNodeStatsOutput dialog = new FrmPipeNodeStatsOutput();
                        dialog.SetData1(dtResult);
                        //dialog.SetData1(dtstats);
                        dialog.ShowDialog();
                        if (dialog.DialogResult != System.Windows.Forms.DialogResult.OK)
                        {
                            this.RestoreEnv();
                        }
                    }
                }
            }
            catch
            {
            }
        }