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();
             FrmPipeLineStatsOutput dialog = new FrmPipeLineStatsOutput();
             dialog.SetData1(dtResult);
             dialog.ShowDialog();
         }
         catch
         {
             WaitForm.Stop();
         }
     }
 }
 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();
         FrmPipeLineStatsOutput dialog = new FrmPipeLineStatsOutput();
         dialog.SetData1(dtResult);
         dialog.ShowDialog();
     }
     catch
     {
         WaitForm.Stop();
     }
 }
示例#3
0
        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();
                        FrmPipeLineStatsOutput dialog = new FrmPipeLineStatsOutput();
                        dialog.SetData1(dtResult);
                        //dialog.SetData1(dtstats);
                        dialog.ShowDialog();
                        if (dialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                        {
                            this.RestoreEnv();
                        }
                    }
                }
            }
            catch
            {
            }
        }