Beispiel #1
0
        public override void OnMouseDown(int Button, int Shift, int X, int Y)
        {
            // TODO:  Add LHSBCrePoly.OnMouseDown implementation

            IRubberBand ipRubber = new RubberPolygonClass();
            IGeometry   ipGeo    = ipRubber.TrackNew(m_hookHelper.ActiveView.ScreenDisplay,
                                                     null);
            IFeatureLayer layer = null;

            for (int i = 0; i < m_hookHelper.FocusMap.LayerCount; i++)
            {
                layer = (IFeatureLayer)m_hookHelper.FocusMap.get_Layer(i);
                if (layer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPolygon)
                {
                    break;
                }
                layer = null;
            }
            if (layer != null)
            {
                IFeature feature = layer.FeatureClass.CreateFeature();
                feature.Shape = ipGeo;
                feature.Store();
                m_hookHelper.ActiveView.Refresh();
            }
        }
Beispiel #2
0
        public void SelectByPolygon(int IndexOfLayer, RubberPolygonClass Polygon)
        {
            int            ConstantNum     = 255;
            IActiveView    CurrentView     = axMapControl1.ActiveView;
            IScreenDisplay MyScreenDispaly = CurrentView.ScreenDisplay;

            MyScreenDispaly.StartDrawing(MyScreenDispaly.hDC, (System.Int16)esriScreenCache.esriNoScreenCache);
            IRgbColor MYRGBCOLOR = new RgbColorClass();

            MYRGBCOLOR.Red = ConstantNum;
            IColor            MyColor             = MYRGBCOLOR;
            ISimpleFillSymbol MySimpleFillPolygon = new SimpleFillSymbolClass();

            MySimpleFillPolygon.Color = MyColor;
            ISymbol     MySymbol      = MySimpleFillPolygon as ISymbol;
            IRubberBand MyIRubberBand = Polygon;
            IGeometry   MyGeometry    = MyIRubberBand.TrackNew(MyScreenDispaly, MySymbol);

            MyScreenDispaly.SetSymbol(MySymbol);
            MyScreenDispaly.DrawPolygon(MyGeometry);
            MyScreenDispaly.FinishDrawing();
            ISpatialFilter MyISpatialFilter = new SpatialFilterClass();

            MyISpatialFilter.Geometry   = MyGeometry;
            MyISpatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;
            IFeatureLayer     SelectedLayer   = axMapControl1.ActiveView.FocusMap.get_Layer(IndexOfLayer) as IFeatureLayer;
            IFeatureSelection SelectedFeature = SelectedLayer as IFeatureSelection;

            SelectedFeature.SelectFeatures(MyISpatialFilter, esriSelectionResultEnum.esriSelectionResultNew, false);
            ISelectionSet MyISelectionSet = SelectedFeature.SelectionSet;

            axMapControl1.ActiveView.Refresh();
        }
Beispiel #3
0
        public override void OnMouseDown(int Button, int Shift, int X, int Y)
        {
            IRubberBand ipRubber = new RubberPolygonClass();
            IGeometry   ipGeo    = ipRubber.TrackNew(m_hookHelper.
                                                     ActiveView.ScreenDisplay, null);
            IFeatureLayer layer = null;

            for (int i = 0; i < m_hookHelper.FocusMap.LayerCount; i++)
            {
                layer = (IFeatureLayer)m_hookHelper.FocusMap.
                        get_Layer(i);
                if (layer.Name == "polygon")
                {
                    break;
                }
                layer = null;
            }
            if (layer != null)
            {
                IFeature feature = layer.FeatureClass.CreateFeature();

                feature.set_Value(1, 2);

                feature.Shape = ipGeo;

                feature.Store();
                m_hookHelper.ActiveView.Refresh();
            }
        }
Beispiel #4
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)
            {
                return;
            }
            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   pGeo   = band.TrackNew(m_Display, null);
                    app.Current2DMapControl.DrawShape(pGeo, ref symbol);
                    WaitForm.Start("正在查询...", "请稍后");
                    if (pGeo.IsEmpty)
                    {
                        IPoint searchPoint = new PointClass();
                        searchPoint.PutCoords(mapX, mapY);
                        pGeo = PublicFunction.DoBuffer(searchPoint, PublicFunction.ConvertPixelsToMapUnits(m_ActiveView, GlobalValue.System_Selection_Option().Tolerate));
                        //m_ActiveView.FocusMap.SelectByShape(geo, s, false);
                    }
                    if (ready)
                    {
                        IMap pMap = app.Current2DMapControl.Map;
                        ISelectionEnvironment selEnv = new SelectionEnvironmentClass();
                        pMap.SelectByShape(pGeo, selEnv, false);
                        ISelection   pSelection = pMap.FeatureSelection;
                        FrmDxfExport dialog     = new FrmDxfExport(pSelection, pMap);
                        WaitForm.Stop();
                        dialog.ShowDialog();
                    }
                }
            }
            catch (System.Exception ex)
            {
                WaitForm.Stop();
            }
        }
Beispiel #5
0
        private void button4_Click(object sender, EventArgs e)
        {
            if (button4.Text == "确认添加")
            {
                string sql = "insert into build(id,gid,name,owner_type,owner_name,owner_address_name,using_type,isbuilding,build_person_id,build_height,begin_time,end_time)values(" +
                             textBox1.Text.Trim() + "," + textBox2.Text.Trim() + ",'" + textBox3.Text.Trim() + "','" + comboBox4.Text.Trim() + "','" + textBox5.Text.Trim() + "','" + textBox6.Text.Trim() + "','"
                             + comboBox1.Text.Trim() + "','" + comboBox2.Text.Trim() + "'," + comboBox3.Text.Trim() + "," + textBox9.Text.Trim() + ",'"
                             + dateTimePicker1.Text.Trim() + "','" + dateTimePicker2.Text.Trim() + "')";

                if (checkHasNull())
                {
                    Dao.dml(sql);
                    MessageBox.Show("添加成功!");
                    button4.Enabled = false;
                    //更新表格内容
                    DataSet dataset = null;
                    dataset = Dao.query("select*from build");
                    dataGridView1.DataSource = dataset.Tables[0];



                    IRubberBand ipRubber = new RubberPolygonClass();
                    IGeometry   ipGeo    = ipRubber.TrackNew(m_hookhelper.
                                                             ActiveView.ScreenDisplay, null);
                    IFeature feature = me.FeatureClass.CreateFeature();
                    feature.set_Value(1, textBox2.Text.Trim());

                    feature.Shape = ipGeo;
                    feature.Store();
                    m_hookhelper.ActiveView.Refresh();
                }
                else
                {
                    MessageBox.Show("信息填写不完整!");
                }
            }
            if (button4.Text == "确认修改")
            {
                string sql = "update build set gid =" + textBox2.Text.Trim() + ",name='" + textBox3.Text.Trim() + "',owner_type='" + comboBox4.Text.Trim() + "',owner_name='"
                             + textBox5.Text.Trim() + "',owner_address_name='" + textBox6.Text.Trim() + "',using_type='" + comboBox1.Text.Trim() + "',isbuilding='" + comboBox2.Text.Trim() +
                             "',build_person_id=" + comboBox3.Text.Trim() + ",begin_time='" + dateTimePicker1.Value + "',end_time='" + dateTimePicker2.Value + "',build_height=" + textBox9.Text.Trim() +
                             " where id =" + textBox1.Text.Trim() + "";
                if (checkHasNull())
                {
                    Dao.dml(sql);
                    MessageBox.Show("修改成功!");
                    button4.Enabled = false;
                    //更新表格内容
                    DataSet dataset = null;
                    dataset = Dao.query("select*from build");
                    dataGridView1.DataSource = dataset.Tables[0];
                }
                else
                {
                    MessageBox.Show("信息填写不完整!");
                }
            }
        }
Beispiel #6
0
        ///<summary>
        ///Create a polyline geometry object using the RubberBand.TrackNew method when a user click the mouse on the map control.
        ///</summary>
        ///<param name="activeView">An ESRI.ArcGIS.Carto.IActiveView interface that will user will interace with to draw a polyline.</param>
        ///<returns>An ESRI.ArcGIS.Geometry.IPolyline interface that is the polyline the user drew</returns>
        ///<remarks>Double click the left mouse button to end tracking the polyline.</remarks>
        public IPolygon GetPolygonFromMouseClicks(IActiveView activeView)
        {
            IScreenDisplay screenDisplay = activeView.ScreenDisplay;
            IRubberBand    rubberBand    = new RubberPolygonClass();
            IGeometry      geometry      = rubberBand.TrackNew(screenDisplay, null);

            IPolygon polyline = (IPolygon)geometry;

            return(polyline);
        }
Beispiel #7
0
        /// <summary>
        /// 画多边形
        /// </summary>
        /// <param name="mapControl">绑定的地图控件</param>
        /// <returns>多边形</returns>
        public IPolygon DrawPolygon(AxMapControl mapControl)
        {
            if (mapControl == null)
            {
                return(null);
            }
            IRubberBand rubberBand = new RubberPolygonClass();

            return((IPolygon)rubberBand.TrackNew(mapControl.ActiveView.ScreenDisplay, null));
        }
Beispiel #8
0
        /// <summary>
        /// 绘制多边形
        /// </summary>
        /// <param name="mapCtrl"></param>
        /// <returns></returns>
        public static IPolygon DrawPolygon(AxMapControl mapCtrl)
        {
            if (mapCtrl == null)
            {
                return(null);
            }
            IRubberBand rb        = new RubberPolygonClass();
            IGeometry   pGeometry = rb.TrackNew(mapCtrl.ActiveView.ScreenDisplay, null);

            return(pGeometry as IPolygon);
        }
        /// <summary>
        /// 绘制面要素
        /// </summary>
        /// <param name="view">活动窗体</param>
        /// <param name="symbol">面样式SimpleSymbolHelper</param>
        /// <returns>要素</returns>
        public static IGeometry DreawPolygon(IActiveView view, ISymbol symbol)
        {
            //初始rubberband
            IRubberBand band   = new RubberPolygonClass();
            IGeometry   newGeo = band.TrackNew(view.ScreenDisplay, symbol);

            if (newGeo == null)
            {
                return(null);
            }
            return(newGeo);
        }
Beispiel #10
0
        private IPolygon DrawPolygon(AxMapControl axMaxControl)
        {
            IPolygon Geometry = null;

            if (axMaxControl == null)
            {
                return(null);
            }
            IRubberBand rb = new RubberPolygonClass();

            Geometry = rb.TrackNew(axMaxControl.ActiveView.ScreenDisplay, null) as IPolygon;
            return(Geometry);
        }
Beispiel #11
0
        private IPolygon DrawPolygon(AxMapControl mapcontrol)
        {
            if (mapcontrol == null)
            {
                return(null);
            }
            IGeometry pGeometry = null;
            //实例图形绘制对象
            IRubberBand rub = new RubberPolygonClass();

            pGeometry = rub.TrackNew(mapcontrol.ActiveView.ScreenDisplay, null);
            return(pGeometry as IPolygon);
        }
Beispiel #12
0
        /// <summary>
        /// Occurs when this tool is clicked
        /// </summary>
        public override void OnClick()
        {
            // TODO: Add LHSBBuffer.OnClick implementation
            IRubberBand ipRubberPolygon = new RubberPolygonClass();
            //在选定的图层上画出一个新的多边形
            IPolygon polygon = ipRubberPolygon.TrackNew(m_hookHelper.ActiveView.ScreenDisplay, null) as IPolygon;
            //空间过滤器实现过滤功能
            ISpatialFilter ipSpatialFilter = new SpatialFilterClass();

            //定义过滤的对象类型
            ipSpatialFilter.Geometry = polygon;
            //过滤时使用的空间关系,当多边形位于所选区域范围时则该多边形被选中。
            ipSpatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;
            //得到第一个图层
            IFeatureSelection ipFeatSelect = m_hookHelper.FocusMap.get_Layer(1) as IFeatureSelection;

            //将选择的图层内容清空
            ipFeatSelect.Clear();
            //选中要素
            ipFeatSelect.SelectFeatures(ipSpatialFilter, esriSelectionResultEnum.esriSelectionResultNew, true);
            //刷新
            ipFeatSelect.SelectionSet.Refresh();
            //检索选中的范围,赋给cur
            ICursor cur = null;

            ipFeatSelect.SelectionSet.Search(null, true, out cur);
            //得到cur中的第一行数据,给feature
            IFeature feature = cur.NextRow() as IFeature;

            while (feature != null)
            {//得到feature的几何图形,给to,to是拓扑运算
                ITopologicalOperator to = feature.Shape as ITopologicalOperator;
                //对to做缓冲区分析,对距离为3的范围作缓冲区分析,得到一个polygon。
                IPolygon poly = to.Buffer(500) as IPolygon;

                //得到第0个图层
                IFeatureLayer fl = m_hookHelper.FocusMap.get_Layer(0) as IFeatureLayer;

                //在第0个图层上添加要素
                IFeature polyFeature = fl.FeatureClass.CreateFeature();
                //添加要素的类型为polygon类型
                polyFeature.Shape = poly;
                //将得到的polygon进行存储
                polyFeature.Store();
                feature = cur.NextRow() as IFeature;
            }
            m_hookHelper.ActiveView.Refresh();
            m_hookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
        }
Beispiel #13
0
        public override void OnMouseDown(int button, int shift, int x, int y, double mapX, double mapY)
        {
            if (button == 1)
            {
                int         dis;
                IPolygon    pPoly;
                IRubberBand pRubberPoly = new RubberPolygonClass();
                pPoly = (IPolygon)pRubberPoly.TrackNew(m_Display, null);

                IFeatureSelection pFeaSel = m_pCurEditLayer as IFeatureSelection;
                dis = Class.SelectionEnv.System_Selection_Environment(m_ActiveView).SearchTolerance;

                IGeometry      pGeoSel    = Class.Common.DoBuffer(pPoly, dis);
                ISpatialFilter pSpaFilter = new SpatialFilter();
                pSpaFilter.Geometry   = pGeoSel;
                pSpaFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;

                if (shift == 1)
                {
                    pFeaSel.CombinationMethod = esriSelectionResultEnum.esriSelectionResultAdd;
                    //Class.SelectionEnv.System_Selection_Environment(m_ActiveView).CombinationMethod = esriSelectionResultEnum.esriSelectionResultAdd;
                }
                else
                {
                    pFeaSel.CombinationMethod = esriSelectionResultEnum.esriSelectionResultNew;
                    this.m_ActiveView.FocusMap.ClearSelection();
                }
                pFeaSel.SelectFeatures(pSpaFilter, pFeaSel.CombinationMethod, false);

                //if (Class.SelectionEnv.System_Selection_Environment(m_ActiveView).CombinationMethod == 0)//new selection
                //{
                //    this.m_ActiveView.FocusMap.ClearSelection();
                //}
                //m_ActiveView.FocusMap.SelectByShape(Class.Common.DoBuffer(pPoly, dis), Class.SelectionEnv.System_Selection_Environment(m_ActiveView), false);
                m_App.Workbench.UpdateMenu();

                if (m_ActiveView.FocusMap.SelectionCount > 0)
                {
                    m_ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
                }
                else
                {
                    m_ActiveView.Refresh();
                }
            }
        }
Beispiel #14
0
        public override void OnMouseDown(int Button, int Shift, int X, int Y)
        {
            IRubberBand polygonRubber = new RubberPolygonClass();
            IPolygon    polygon       = polygonRubber.TrackNew(
                m_hookHelper.ActiveView.ScreenDisplay, null) as IPolygon;
            ISpatialFilter spFilter = new SpatialFilterClass();

            spFilter.Geometry   = polygon;
            spFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;
            ILayer            layer = m_hookHelper.FocusMap.get_Layer(0);
            IFeatureSelection fSel  = layer as IFeatureSelection;

            fSel.SelectFeatures(spFilter,
                                esriSelectionResultEnum.esriSelectionResultNew, false);
            fSel.SelectionSet.Refresh();
            m_hookHelper.ActiveView.Refresh();
        }
Beispiel #15
0
        public override void OnMouseDown(int Button, int Shift, int X, int Y)
        {
            try
            {
                IMxDocument    pMxDoc         = (IMxDocument)m_application.Document;
                IActiveView    pActiveView    = (IActiveView)pMxDoc.FocusMap;
                IScreenDisplay pScreenDisplay = (IScreenDisplay)pActiveView.ScreenDisplay;
                IRubberBand    pRubberBand    = new RubberPolygonClass();
                IPolygon       pPolygon       = null;
                ILineSymbol    pLineSymbol    = new SimpleLineSymbolClass();
                IColor         myColor        = new RgbColorClass();
                myColor.RGB       = 255;
                pLineSymbol.Color = myColor;

                pPolygon = (IPolygon)pRubberBand.TrackNew(pScreenDisplay, (ISymbol)pLineSymbol);

                if (pPolygon == null)
                {
                    return;
                }

                IArea myArea = (IArea)pPolygon;
                if (myArea.Area < 0)
                {
                    pPolygon.ReverseOrientation();
                }

                clsStatic.g_pAnalyzePolygon = (IGeometry)pPolygon;

                IRgbColor rgbColor = new RgbColorClass();
                rgbColor.Red = 255;
                AddGraphicToMap(ArcMap.Document.FocusMap, (IGeometry)pPolygon, rgbColor, rgbColor);

                ArcMap.Document.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);

                Marshal.ReleaseComObject(pMxDoc);
                pMxDoc = null;
            }
            catch (Exception ex)
            {
                clsStatic.ShowErrorMessage(ex.ToString());
            }
        }
Beispiel #16
0
        protected override void OnMouseDown(ESRI.ArcGIS.Desktop.AddIns.Tool.MouseEventArgs e)
        {
            IScreenDisplay screenDisplay = ArcMap.Document.ActiveView.ScreenDisplay;

            //创建选取多边形
            IRubberBand pRubberPolygon = new RubberPolygonClass();
            IPolygon    pPolygon       = pRubberPolygon.TrackNew(screenDisplay, null) as IPolygon;

            //构建选取环境;选取对象颜色为红色;选取方法为累加
            SelectionEnvironment se = new SelectionEnvironmentClass();

            se.DefaultColor      = getRGB(255, 0, 0);
            se.CombinationMethod = esriSelectionResultEnum.esriSelectionResultAdd;

            //选取要素
            IMap map = ArcMap.Document.FocusMap;

            map.SelectByShape(pPolygon, se, false);

            //刷新屏幕
            ArcMap.Document.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
        }
Beispiel #17
0
        public override void OnMouseDown(int button, int shift, int x, int y, double mapX, double mapY)
        {
            DF2DApplication app = DF2DApplication.Application;

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

            try
            {
                if (button == 1)
                {
                    IRubberBand rubberBand = new RubberPolygonClass();
                    IGeometry   pGeo       = rubberBand.TrackNew(m_Display, null);
                    if (pGeo != null)
                    {
                        AddPolygonElement(pGeo, this.m_ActiveView);
                        this.m_ActiveView.Refresh();
                    }
                    if (pGeo.IsEmpty)
                    {
                        return;
                    }
                    Object obj = Math.Abs(double.Parse(((IArea)pGeo).Area.ToString(".##")));
                    strResult1 = obj.ToString() + "平方米";
                    strResult2 = ((IPolygon)pGeo).Length.ToString(".##") + "米";
                    app.Current2DMapControl.ActiveView.Refresh();
                    FrmArea.Instance().ShowDialog();
                }
            }
            catch
            {
            }
        }
Beispiel #18
0
        public override void OnMouseDown(int Button, int Shift, int X, int Y)
        {
            // TODO:  Add CBR_SelectFeature.OnMouseDown implementation
            IRubberBand    ipRubberPolygon = new RubberPolygonClass();
            IPolygon       polygon         = ipRubberPolygon.TrackNew(m_hookHelper.ActiveView.ScreenDisplay, null) as IPolygon;
            ISpatialFilter ipSpatialFilter = new SpatialFilterClass();

            ipSpatialFilter.Geometry   = polygon;
            ipSpatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;
            IFeatureSelection ipFeatSelect = m_hookHelper.FocusMap.get_Layer(1) as IFeatureSelection;

            ipFeatSelect.Clear();
            ipFeatSelect.SelectFeatures(ipSpatialFilter, esriSelectionResultEnum.esriSelectionResultNew, false);
            ipFeatSelect.SelectionSet.Refresh();
            m_hookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);

            ICursor cur = null;

            ipFeatSelect.SelectionSet.Search(null, true, out cur);
            IFeature      feature = cur.NextRow() as IFeature;
            IFeatureLayer fl      = m_hookHelper.FocusMap.get_Layer(0) as IFeatureLayer;

            while (feature != null)
            {
                ITopologicalOperator to   = feature.Shape as ITopologicalOperator;
                IPolygon             poly = to.Buffer(0.01) as IPolygon;


                IFeature polyFeature = fl.FeatureClass.CreateFeature();
                polyFeature.Shape = poly;
                feature           = cur.NextRow() as IFeature;
                polyFeature.Store();
            }

            m_hookHelper.ActiveView.Refresh();
        }
Beispiel #19
0
        public override void OnMouseDown(int Button, int Shift, int X, int Y)
        {
            m_ActiveView = m_hookHelper.ActiveView;
            m_Map        = m_hookHelper.FocusMap;
            IScreenDisplay    pScreenDisplay = m_ActiveView.ScreenDisplay;
            IRubberBand       pRubberPolygon = new RubberPolygonClass();
            ISimpleFillSymbol pFillSymbol    = new SimpleFillSymbolClass();

            pFillSymbol.Color = getRGB(255, 255, 0);
            IPolygon pPolygon = pRubberPolygon.TrackNew(pScreenDisplay, (ISymbol)pFillSymbol) as IPolygon;

            pFillSymbol.Style = esriSimpleFillStyle.esriSFSDiagonalCross;
            pFillSymbol.Color = getRGB(0, 0, 255);
            IFillShapeElement pPolygonEle = new PolygonElementClass();

            pPolygonEle.Symbol = pFillSymbol;
            IElement pEle = pPolygonEle as IElement;

            pEle.Geometry = pPolygon;
            IGraphicsContainer pGraphicsContainer = m_Map as IGraphicsContainer;

            pGraphicsContainer.AddElement(pEle, 0);
            m_ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
        }
Beispiel #20
0
        public void points()
        {
            string strs = "Marker";

            switch (strs)
            {
            case "Marker":
                IMarkerElement pMarkerElement;            //对于点,线,面的element定义这里都不一样,他是可实例化的类,而IElement是实例化的类,必须通过 IMarkerElement 初始化负值给 IElement 。
                IElement       pMElement;
                IPoint         pPoint = new PointClass(); //你画的图形式什么就是什么,特别的是LINE则需要定义为POLYLINE
                pMarkerElement = new MarkerElementClass();

                pMElement = pMarkerElement as IElement;

                //RubberPointClass pRubberBand = new RubberPointClass();//你的RUBBERBAND随着你的图形耳边
                //pPoint = pRubberBand.TrackNew(axMapControl.ActiveView.ScreenDisplay, null) as IPoint;
                ////pPoint = pRubberBand.TrackNew(axMapControl.ActiveView.ScreenDisplay, null) as IPoint;
                //pPoint.X = 101;
                //pPoint.Y = 37;

                // pPoint.PutCoords(Convert.ToDouble(101), Convert.ToDouble(37));
                //pPoint = axMapControl.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(200, 200);
                // pPoint.PutCoords(Convert.ToDouble(textBox1.Text), Convert.ToDouble(textBox2.Text));

                // pPoint = axMapControl.ToMapPoint(334, 344);
                //pPoint.X = pPoint.X;
                //pPoint.Y = pPoint.Y;

                /*00000000000000000000000000000000000经纬度转换坐标*/
                //IGlobeDisplay m_globeDisplay = axGlobeControl1.GlobeDisplay;

                //// IGlobeDisplay pGlobeDisplay = axGlobeControl1.GlobeDisplay;

                ////axGlobeControl1.GlobeDisplay.ActiveViewer;
                //ISceneViewer sceneViewer = m_globeDisplay.ActiveViewer;
                //IGlobeViewUtil globeViewUtil = (IGlobeViewUtil)sceneViewer.Camera;

                //int winX, winY;
                ////globeViewUtil.GeographicToWindow(Convert.ToDouble(textBox1.Text), Convert.ToDouble(textBox2.Text), 0, out winX, out winY);



                ////pPoint.PutCoords(Convert.ToDouble(textBox1.Text), Convert.ToDouble(textBox2.Text));//x,y地理坐标

                //pPoint=axMapControl.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(0, 0);//x,y为屏幕坐标
                ////pPoint.X = Convert.ToDouble(textBox1.Text);
                ////pPoint.Y = Convert.ToDouble(textBox2.Text);
                //pPoint.PutCoords(Convert.ToDouble(textBox1.Text), Convert.ToDouble(textBox2.Text));//x,y地理坐标

                //axMapControl.ActiveView.ScreenDisplay.DisplayTransformation.FromMapPoint(pPoint, out winX, out winY);
                // int mx = winX;
                //int my = winY;
                //pPoint=axMapControl.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(200, 400);//x,y为屏幕坐标
                pPoint.PutCoords(Convert.ToDouble(textBox3.Text), Convert.ToDouble(textBox4.Text));
                /*00000000000000000000000000000000000*/

                // pPoint = axMapControl.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(mx, my);

                //pPoint.PutCoords(mx, my);
                //pPoint.X = mx;
                //pPoint.Y = my;

                //ISpatialReferenceFactory pSRF = new SpatialReferenceEnvironmentClass();
                //pPoint.SpatialReference = pSRF.CreateProjectedCoordinateSystem(2414);
                //pPoint.Project(pSRF.CreateGeographicCoordinateSystem((int)esriSRGeoCSType.esriSRGeoCS_Beijing1954));


                pMElement.Geometry = pPoint;                                                           //把你在屏幕中画好的图形付给 IElement 储存
                IGraphicsContainer pGraphicsContainer = axMapControl.ActiveView as IGraphicsContainer; //把地图的当前view作为图片的容器

                pGraphicsContainer.AddElement(pMElement, 0);                                           //显示储存在 IElement 中图形,这样就持久化了。
                axMapControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
                //axMapControl.Refresh();
                break;

            case "Line":

                ILineElement pLineElement;
                IElement     pLElement;

                IPolyline pLine;

                pLineElement = new LineElementClass();
                pLElement    = pLineElement as IElement;

                RubberLineClass pRubberBandd = new RubberLineClass();
                pLine = pRubberBandd.TrackNew(axMapControl.ActiveView.ScreenDisplay, null) as IPolyline;

                pLElement.Geometry = pLine;

                pGraphicsContainer = axMapControl.ActiveView as IGraphicsContainer;    //把地图的当前view作为图片的容器


                pGraphicsContainer.AddElement(pLElement, 0);    //把刚刚的element转到容器上
                axMapControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);

                break;

            case "Fill":
                IFillShapeElement pFillShapeElement;
                IElement          pgonElemnt;

                IPolygon pPolygon;
                pFillShapeElement = new PolygonElementClass();
                pgonElemnt        = pFillShapeElement as IElement;//Element


                RubberPolygonClass pRubberBand3 = new RubberPolygonClass();    //在屏幕上画个多边形
                pPolygon = pRubberBand3.TrackNew(axMapControl.ActiveView.ScreenDisplay, null) as IPolygon;

                pgonElemnt.Geometry = pPolygon;                                     //把这个多边形转成Element

                pGraphicsContainer = axMapControl.ActiveView as IGraphicsContainer; //把地图的当前view作为图片的容器

                //pGraphicsContainer.DeleteAllElements ();
                pGraphicsContainer.AddElement(pgonElemnt, 0);    //把刚刚的element转到容器上
                axMapControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
                break;
            }
        }
Beispiel #21
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
            {
            }
        }
        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);
                    }
                    _geo         = geo;
                    spatialStats = true;
                    if (spatialStats)
                    {
                        FrmCompoundConditionStats2D dialog = new FrmCompoundConditionStats2D();
                        dialog.SetData(LogicDataStructureManage2D.Instance.RootLogicGroups, LogicDataStructureManage2D.Instance.RootMajorClasses, _geo);
                        WaitForm.Stop();
                        dialog.ShowDialog();
                        if (dialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                        {
                            this.RestoreEnv();
                        }
                    }
                }
            }
            catch
            {
            }
        }
 //
 //
 //
 public static void drawPolygon(IActiveView pActiveView)
 {
     IGraphicsContainer iGC = pActiveView as IGraphicsContainer;
     IRubberBand pRubberPoly = new RubberPolygonClass();
     IScreenDisplay pScreenDisp = pActiveView.ScreenDisplay;
     IGeometry pGeom;
     pGeom = pRubberPoly.TrackNew(pScreenDisp, null);
     IPolygon pPoly = pGeom as IPolygon;
     IElement pEle;
     if (pPoly != null)
     {
         pEle = new PolygonElementClass() as IElement;
         pEle.Geometry = pPoly;
         iGC.AddElement(pEle, 0);
     }
     pActiveView.Refresh();
 }
Beispiel #24
0
        private void mapCtlMain_OnMouseDown(object sender, IMapControlEvents2_OnMouseDownEvent e)
        {
            if (this.m_rasterMeasureDis) //距离量算
            {
                IPolyline polyline = null;
                IGraphicsContainer graCont = (IGraphicsContainer)mapCtlMain.ActiveView;
                if (e.button == 1)
                {
                    double Dis = 0;
                    IRubberBand rubberPoly = new RubberLineClass();
                    polyline = (IPolyline)rubberPoly.TrackNew(mapCtlMain.ActiveView.ScreenDisplay, null);
                    IElement elem;
                    if (polyline != null)
                    {
                        elem = new LineElementClass();
                        elem.Geometry = polyline;
                        graCont.AddElement(elem, 0);
                    }
                    mapCtlMain.ActiveView.Refresh();
                    Dis = polyline.Length;
                    Dis = Dis / 1000;
                    frmDis frmdis = new frmDis("测量长度是:" + Dis.ToString("f3") + "公里", "距离量测");
                    frmdis.ShowDialog();
                    //MessageBox.Show("测量长度是:" + Dis.ToString("f3") + "公里", "确认");
                    graCont = (IGraphicsContainer)mapCtlMain.ActiveView;
                    graCont.DeleteAllElements();
                    mapCtlMain.ActiveView.Refresh();
                }

            }

            if (this.m_rasterMeasureArea) //面积量算
            {
                double Area = 0;
                double Area1 = 0;
                ISimpleLineSymbol lineSymbol = new SimpleLineSymbolClass();
                IRgbColor color = new RgbColorClass();
                color.Red = 0;
                color.Green = 0;
                color.Blue = 225;

                lineSymbol.Width = 1;
                lineSymbol.Color = color;
                lineSymbol.Style = esriSimpleLineStyle.esriSLSSolid;
                //Dim pPolySymbol As ISimpleFillSymbol
                ISimpleFillSymbol polySymbol = new SimpleFillSymbolClass();

                polySymbol.Color = color;
                polySymbol.Outline = lineSymbol;
                polySymbol.Style = esriSimpleFillStyle.esriSFSHollow;
                //Dim pSymbol As ISymbol
                ISymbol symbol = (ISymbol)polySymbol;
                //设置结束
                IGraphicsContainer graCont = (IGraphicsContainer)mapCtlMain.ActiveView;
                IRubberBand rubberPoly = new RubberPolygonClass();
                IPolygon polygon = (IPolygon)rubberPoly.TrackNew(mapCtlMain.ActiveView.ScreenDisplay, symbol);
                IElement elem;
                if (polygon != null)
                {
                    elem = new PolygonElementClass();
                    elem.Geometry = polygon;
                    IFillShapeElement fillShapeElement = (IFillShapeElement)elem;
                    fillShapeElement.Symbol = (IFillSymbol)symbol;
                    graCont.AddElement(elem, 0);
                }
                mapCtlMain.ActiveView.Refresh();
                IArea area = (IArea)polygon;
                Area = Math.Abs(area.Area) / 1000000;
                Area1 = Area * 100;
                frmDis frmdis = new frmDis("测量面积是:" + Area.ToString("f3") + "平方公里" + "\n     (合" + Area1.ToString("f3") + "公顷)","面积量测");
                frmdis.ShowDialog();
                //MessageBox.Show("测量面积是:" + Area.ToString("f3") + "平方公里" + "(合" + Area1.ToString("f3") + "公顷)", "确认");
                graCont = (IGraphicsContainer)mapCtlMain.ActiveView;
                graCont.DeleteAllElements();
                mapCtlMain.ActiveView.Refresh();
            }

            if (this.m_bEditNode)
            {
                m_editor.EditFeatureMouseDown(e.x, e.y);

            }

            if(this.m_out)
            {

               IFeatureLayer featureLayer = this.mapCtlMain.get_Layer(0) as IFeatureLayer;
               IFeatureClass featureClass = featureLayer.FeatureClass;
               IPoint point = mapCtlMain.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(e.x, e.y);
               IGeometry geometry = point as IGeometry;

               ITopologicalOperator pTopo = geometry as ITopologicalOperator;
               IGeometry buffer = pTopo.Buffer(200);
               geometry = buffer.Envelope as IGeometry;

               ISpatialFilter spatialFilter = new SpatialFilterClass();
               spatialFilter.Geometry = geometry;
               spatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelContains;

               spatialFilter.GeometryField = featureClass.ShapeFieldName;
               IQueryFilter filter = spatialFilter as IQueryFilter;

               IFeatureCursor cursor = featureClass.Search(filter, false);
               IFeature pfeature = cursor.NextFeature();
               if (pfeature!= null)
               {
                   frmTip tip = new frmTip(pfeature.get_Value(3).ToString(), pfeature.get_Value(4).ToString(),this.m_oraCmd);
                   tip.ShowDialog();
               }

            }
        }
        public override void OnMouseDown(int button, int shift, int x, int y, double mapX, double mapY)
        {
            base.OnMouseDown(button, shift, x, y, mapX, mapY);
            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();
                geo = band.TrackNew(m_Display, null);
                DF2DApplication.Application.Current2DMapControl.DrawShape(geo, ref symbol);
                //WaitForm.Start("正在查询...", "请稍后");
            }
            if (geo == null)
            {
                return;
            }
            h   = GetH(geo);
            pFc = GetGCD();
            AddHField(pFc);
            beforeGeo = GetBeforeGeo(pFc);
            afterGeo  = GetAfterGeo(pFc);
            if (beforeGeo == null || afterGeo == null)
            {
                return;
            }
            SurfaceProcess(beforeGeo, afterGeo);

            FrmEarthworkCalculation2D dialog = new FrmEarthworkCalculation2D(surfaceArea, projectArea, dig, fill);

            dialog.ShowDialog();
            if (dialog.DialogResult == DialogResult.OK)
            {
                RestoreEnv();
            }
            //IRasterSurface rasterSurface = new RasterSurfaceClass();
            //rasterSurface.PutRaster((IRaster)beforeGeo, 0);
            //ISurface pSurface = rasterSurface as ISurface;

            //surfaceArea = pSurface.GetSurfaceArea(h, esriPlaneReferenceType.esriPlaneReferenceAbove).ToString(".###") + "㎡";
            //projectArea = pSurface.GetProjectedArea(h, esriPlaneReferenceType.esriPlaneReferenceAbove).ToString(".###") + "㎡";

            //ISurfaceOp SurfaceOp = new RasterSurfaceOpClass();
            //IGeoDataset outGeoDataset = SurfaceOp.CutFill(beforeGeo, afterGeo, Type.Missing);
            //IRasterBandCollection pRsBandCol = outGeoDataset as IRasterBandCollection;

            //double area = 0.0;//涉及面积
            //double volume = 0.0;//挖方方量
            //double volume1 = 0.0;//填方方量
            //double sumVolume = 0;//挖方总量
            //double sumVolume1 = 0;//填方总量
            //for (int i = 0; i < pRsBandCol.Count; i++)
            //{
            //    IRasterBand pBand = pRsBandCol.Item(0);
            //    ITable pRTable = pBand.AttributeTable;
            //    ICursor pCursor = pRTable.Search(null, true);
            //    获取像素块中的值
            //    IRow pRrow = pCursor.NextRow();
            //    while (pRrow != null)
            //    {
            //        area += Convert.ToDouble(pRrow.get_Value(pRrow.Fields.FindField("AREA")).ToString());
            //        volume = Convert.ToDouble(pRrow.get_Value(pRrow.Fields.FindField("VOLUME")).ToString());
            //        if (volume > 0)
            //        {
            //            sumVolume += volume;
            //        }
            //        else
            //        {
            //            sumVolume1 += volume;
            //        }
            //        pRrow = pCursor.NextRow();
            //    }
            //}
            //string dig = Math.Round(sumVolume, 3).ToString() + "m³";
            //string fill = Math.Round(sumVolume1, 3).ToString() + "m³";
            //FrmEarthworkCalculation2D dialog = new FrmEarthworkCalculation2D(surfaceArea, projectArea, dig, fill);
            //if (dialog.DialogResult == DialogResult.OK)
            //{
            //    RestoreEnv();
            //}
        }
Beispiel #26
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);
                    }
                    _geo         = geo;
                    spatialQuery = true;
                    if (spatialQuery)
                    {
                        FrmCompoundConditionQuery dialog = new FrmCompoundConditionQuery();
                        dialog.SetData(LogicDataStructureManage2D.Instance.RootLogicGroups, LogicDataStructureManage2D.Instance.RootMajorClasses, _geo);
                        WaitForm.Stop();
                        IMap2DView mapView = UCService.GetContent(typeof(Map2DView)) as Map2DView;
                        mapView.UnBind(this);
                        if (dialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                        {
                            return;
                        }
                        this._uPanel               = new UIDockPanel("查询结果", "查询结果", this.Location, this._width, this._height);
                        this._dockPanel            = FloatPanelManager.Instance.Add(ref this._uPanel, DockingStyle.Right);
                        this._dockPanel.Visibility = DockVisibility.Visible;
                        this._dockPanel.FloatSize  = new System.Drawing.Size(this._width, this._height);
                        this._dockPanel.Width      = this._width;
                        this._dockPanel.Height     = this._height;
                        this._uc      = new UCPropertyInfo2D();
                        this._uc.Dock = System.Windows.Forms.DockStyle.Fill;
                        this._uPanel.RegisterEvent(new PanelClose(this.Close));
                        this._dockPanel.Controls.Add(this._uc);
                        this._uc.SetPropertyInfo(dialog.Dict);
                    }
                }
            }


            catch
            {
                this.RestoreEnv();
            }
        }
        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)
            {
                return;
            }
            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   pGeo   = band.TrackNew(m_Display, null);
                    app.Current2DMapControl.DrawShape(pGeo, ref symbol);
                    WaitForm.Start("正在查询...", "请稍后");
                    if (pGeo.IsEmpty)
                    {
                        IPoint searchPoint = new PointClass();
                        searchPoint.PutCoords(mapX, mapY);
                        pGeo = PublicFunction.DoBuffer(searchPoint, PublicFunction.ConvertPixelsToMapUnits(m_ActiveView, GlobalValue.System_Selection_Option().Tolerate));
                        //m_ActiveView.FocusMap.SelectByShape(geo, s, false);
                    }
                    if (ready)
                    {
                        WaitForm.Start("正在准备导出,请稍后...");
                        IFeatureClass fc = GetUpdateRegionFC();
                        if (fc == null)
                        {
                            XtraMessageBox.Show("当前地图中没有找到\"修测范围\"图层,无法绘制修测范围!", "修测范围确定");
                            return;
                        }


                        IMap pMap = app.Current2DMapControl.Map;
                        if (pMap == null)
                        {
                            WaitForm.Stop(); return;
                        }
                        //ISelectionEnvironment selEnv = new SelectionEnvironmentClass();
                        //pMap.SelectByShape(pGeo, selEnv, false);

                        //ISelection pSelection = pMap.FeatureSelection;

                        FolderBrowserDialog sfd = new FolderBrowserDialog();
                        if (sfd.ShowDialog() == DialogResult.OK)
                        {
                            string strRegionName = string.Format("{0}{1}点{2}分", DateTime.Now.ToLongDateString(), DateTime.Now.Hour, DateTime.Now.Minute);
                            //存储范围线
                            WaitForm.SetCaption("正在存储范围线,请稍后...");
                            SaveFanWei(pGeo, strRegionName, fc);
                            string strPath = String.Format(@"{0}\{1}.dxf", sfd.SelectedPath, strRegionName);
                            if (this.m_Workspace == null)
                            {
                                XtraMessageBox.Show("获得数据工作空间失败");
                                WaitForm.Stop();
                                return;
                            }
                            WaitForm.SetCaption("开始导出数据,请稍后...");
                            ExportData(strPath, pGeo, pMap, this.m_Workspace);
                            WaitForm.SetCaption("数据导出成功!");
                            XtraMessageBox.Show("数据导出成功!");
                            RestoreEnv();

                            //CreateFeature(pGeo, pMap, fc);
                        }

                        WaitForm.Stop();
                    }
                }
            }
            catch (System.Exception ex)
            {
                WaitForm.Stop();
                return;
            }
        }
Beispiel #28
0
        /// <summary>
        /// 绘制几何图形
        /// </summary>
        /// <param name="geoType"></param>
        /// <param name="geometry"></param>
        /// <returns></returns>
        ESRI.ArcGIS.Carto.IElement createElement_x(ESRI.ArcGIS.Geometry.IGeometry geometry)
        {
            IElement element = null;

            try
            {
                switch (geometry.GeometryType)
                {
                case esriGeometryType.esriGeometryPolygon:
                    IFillShapeElement pPolygonElement;
                    ISimpleFillSymbol pSimpleFillSymbol = new SimpleFillSymbolClass();
                    IPolygon          pPolygon          = new PolygonClass();
                    IRubberBand       pRubberBand       = new RubberPolygonClass();
                    ISimpleLineSymbol pSimpleLineSymbol = new SimpleLineSymbolClass();
                    pPolygonElement = new PolygonElementClass();

                    //if (e.button == 1)
                    //{
                    //   pPolygon=(IPolygon) pRubberBand.TrackNew(axMapControl1.ActiveView.ScreenDisplay, null);
                    //}
                    pSimpleLineSymbol.Width = 2;
                    pSimpleLineSymbol.Style = esriSimpleLineStyle.esriSLSSolid;
                    pSimpleLineSymbol.Color = TransColorToAEColor(Color.Blue);

                    //pSimpleFillSymbol.Color = GetRGBColor(11, 200, 145);
                    pSimpleFillSymbol.Style   = esriSimpleFillStyle.esriSFSNull;
                    pSimpleFillSymbol.Outline = pSimpleLineSymbol;
                    IElement pElement = (IElement)pPolygonElement;
                    pElement.Geometry      = geometry;
                    pPolygonElement.Symbol = pSimpleFillSymbol;

                    element = (IElement)pPolygonElement;
                    break;

                case esriGeometryType.esriGeometryPolyline:    //Polyline线
                    ISimpleLineSymbol simpleLineSymbol = m_NewPolygonFeedback.Symbol as ISimpleLineSymbol;

                    ILineElement lineElement = new LineElementClass();
                    lineElement.Symbol = simpleLineSymbol as ILineSymbol;
                    element            = lineElement as IElement;
                    element.Geometry   = geometry;
                    break;

                case esriGeometryType.esriGeometryPoint:
                    //设置结点符号
                    IRgbColor pRGB = new RgbColorClass();
                    pRGB.Red   = 255;
                    pRGB.Green = 0;
                    pRGB.Blue  = 0;

                    ISimpleMarkerSymbol pSimpleMarkSymbol = new SimpleMarkerSymbolClass();
                    pSimpleMarkSymbol.Color = pRGB as IColor;
                    pSimpleMarkSymbol.Size  = 2;
                    pSimpleMarkSymbol.Style = esriSimpleMarkerStyle.esriSMSSquare;

                    IMarkerElement pMarkerElement = new MarkerElementClass();
                    pMarkerElement.Symbol = pSimpleMarkSymbol as IMarkerSymbol;
                    element          = pMarkerElement as IElement;
                    element.Geometry = geometry as IGeometry;
                    break;
                }
            }
            catch
            { }
            return(element);
        }
Beispiel #29
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)
            {
                return;
            }
            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();
                    geo = band.TrackNew(m_Display, null);
                    app.Current2DMapControl.DrawShape(geo, ref symbol);
                    //WaitForm.Start("正在查询...", "请稍后");
                }
                #region  备用代码

                /*
                 * IGeoDataset pRasterGeo = GetDEM();
                 * IExtractionOp pExOp = new RasterExtractionOpClass();
                 * IPolygon polygon = geo as IPolygon;
                 * polygon.SpatialReference = pRasterGeo.SpatialReference;
                 * beforeGeo = pExOp.Polygon(pRasterGeo, polygon, true);
                 *
                 * IGeoDataset geoDatasetTemp = new RasterDatasetClass();
                 * geoDatasetTemp = beforeGeo;
                 * IRasterBandCollection rbCol = geoDatasetTemp as IRasterBandCollection;
                 * for (int i = 0; i < rbCol.Count;i++ )
                 * {
                 *  if (rbCol.Item(i) == null) continue;
                 *  IRasterBand rb = rbCol.Item(i);
                 *  ITable table = rb.AttributeTable;
                 *  ICursor cursor = table.Search(null, false);
                 *  IRow row ;
                 *  while ((row = cursor.NextRow()) != null)
                 *  {
                 *      row.set_Value(1,50);
                 *      row.Store();
                 *  }
                 * }
                 * afterGeo = geoDatasetTemp;
                 *
                 * ISurfaceOp surOp = new RasterSurfaceOpClass();
                 * IGeoDataset outputGeo = surOp.CutFill(beforeGeo, afterGeo, Type.Missing);*/
                #endregion
                pFc       = GetGCD();
                beforeGeo = GetBeforeGeo(pFc);
            }
            catch (System.Exception ex)
            {
            }
        }
Beispiel #30
0
        public void points()
        {
            string strs = "Marker";
            switch (strs)
            {
                case "Marker":

                    IMarkerElement pMarkerElement;//对于点,线,面的element定义这里都不一样,他是可实例化的类,而IElement是实例化的类,必须通过 IMarkerElement 初始化负值给 IElement 。
                    IElement pMElement;
                    IPoint pPoint=new PointClass();//你画的图形式什么就是什么,特别的是LINE则需要定义为POLYLINE
                    pMarkerElement = new MarkerElementClass();

                    pMElement = pMarkerElement as IElement;

                    RubberPointClass pRubberBand = new RubberPointClass();//你的RUBBERBAND随着你的图形耳边
                    //pPoint = pRubberBand.TrackNew(axMapControl.ActiveView.ScreenDisplay, null) as IPoint;
                    ////pPoint = pRubberBand.TrackNew(axMapControl.ActiveView.ScreenDisplay, null) as IPoint;
                    //pPoint.X = 101;
                    //pPoint.Y = 37;

                    // pPoint.PutCoords(Convert.ToDouble(101), Convert.ToDouble(37));
                    //pPoint = axMapControl.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(200, 200);
                    // pPoint.PutCoords(Convert.ToDouble(textBox1.Text), Convert.ToDouble(textBox2.Text));

                   // pPoint = axMapControl.ToMapPoint(334, 344);
                    //pPoint.X = pPoint.X;
                    //pPoint.Y = pPoint.Y;

                    /*00000000000000000000000000000000000经纬度转换坐标*/
                    //IGlobeDisplay m_globeDisplay = axGlobeControl1.GlobeDisplay;

                    //// IGlobeDisplay pGlobeDisplay = axGlobeControl1.GlobeDisplay;

                    ////axGlobeControl1.GlobeDisplay.ActiveViewer;
                    //ISceneViewer sceneViewer = m_globeDisplay.ActiveViewer;
                    //IGlobeViewUtil globeViewUtil = (IGlobeViewUtil)sceneViewer.Camera;

                    //int winX, winY;
                    ////globeViewUtil.GeographicToWindow(Convert.ToDouble(textBox1.Text), Convert.ToDouble(textBox2.Text), 0, out winX, out winY);

                    ////pPoint.PutCoords(Convert.ToDouble(textBox1.Text), Convert.ToDouble(textBox2.Text));//x,y地理坐标

                    //pPoint=axMapControl.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(0, 0);//x,y为屏幕坐标
                    ////pPoint.X = Convert.ToDouble(textBox1.Text);
                    ////pPoint.Y = Convert.ToDouble(textBox2.Text);
                    //pPoint.PutCoords(Convert.ToDouble(textBox1.Text), Convert.ToDouble(textBox2.Text));//x,y地理坐标

                    //axMapControl.ActiveView.ScreenDisplay.DisplayTransformation.FromMapPoint(pPoint, out winX, out winY);
                    // int mx = winX;
                    //int my = winY;
                    //pPoint=axMapControl.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(200, 400);//x,y为屏幕坐标

                    //调用GetProject2方法经纬度转换成米
                    pPoint = GetProject2(Convert.ToDouble(textBox1.Text), Convert.ToDouble(textBox2.Text));

                    //pPoint.PutCoords(Convert.ToDouble(textBox3.Text), Convert.ToDouble(textBox4.Text));
                    /*00000000000000000000000000000000000*/

                   // pPoint = axMapControl.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(mx, my);

                    //pPoint.PutCoords(mx, my);
                    //pPoint.X = mx;
                    //pPoint.Y = my;

                    //ISpatialReferenceFactory pSRF = new SpatialReferenceEnvironmentClass();
                    //pPoint.SpatialReference = pSRF.CreateProjectedCoordinateSystem(2414);
                    //pPoint.Project(pSRF.CreateGeographicCoordinateSystem((int)esriSRGeoCSType.esriSRGeoCS_Beijing1954));

                    pMElement.Geometry = pPoint;//把你在屏幕中画好的图形付给 IElement 储存

                    IGraphicsContainer pGraphicsContainer = axMapControl.ActiveView as IGraphicsContainer;//把地图的当前view作为图片的容器
                   // axMapControl.get_Layer(0)

                    // ILayer pLayer = this.axMapControl.get_Layer(1);//所要加的层

                    pGraphicsContainer.AddElement(pMElement, 0);//显示储存在 IElement 中图形,这样就持久化了。
                    axMapControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);

                    //axMapControl.Refresh();
                    break;

                case "Line":

                    //ILineElement pLineElement;
                    //IElement pLElement;

                    //IPolyline pLine;
                    // IGraphicsContainer pGraphicsContainerl = axMapControl.ActiveView as IGraphicsContainer;//把地图的当前view作为图片的容器
                    //pLineElement = new LineElementClass();
                    //pLElement = pLineElement as IElement;

                    //RubberLineClass pRubberBandd = new RubberLineClass();
                    //pLine = pRubberBandd.TrackNew(axMapControl.ActiveView.ScreenDisplay, null) as IPolyline;

                    //pLElement.Geometry = pLine;

                    //pGraphicsContainerl = axMapControl.ActiveView as IGraphicsContainer;//把地图的当前view作为图片的容器

                    //pGraphicsContainerl.AddElement(pLElement, 0);//把刚刚的element转到容器上
                    //axMapControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);

                    //00000000000
                    //调用GetProject2方法经纬度转换成米
                    IPoint pPointl=new PointClass();//你画的图形式什么就是什么,特别的是LINE则需要定义为POLYLINE
                    pPointl = GetProject2(Convert.ToDouble(textBox1.Text), Convert.ToDouble(textBox2.Text));

                    IPoint pPointl2=new PointClass();//你画的图形式什么就是什么,特别的是LINE则需要定义为POLYLINE
                    pPointl2 = GetProject2(-120, 40);

                    //创建一个Line对象
                    ILine pLine2 = new LineClass();

                    //Polyline pLine2 = new PolylineClass();
                    //设置Line对象的起始终止点
                    pLine2.PutCoords(pPointl, pPointl2);

                    //IPointCollection pMultipoint = new MultipointClass();
                    //object o=Type.Missing;
                    //pMultipoint.AddPoint(pPointl, ref o, ref o);
                    //pMultipoint.AddPoint(pPointl2, ref o, ref o);

                      axMapControl.ActiveView.Refresh();//刷新当前视图
                    break;
                case "Fill":
                    IFillShapeElement pFillShapeElement;
                    IElement pgonElemnt;

                    IPolygon pPolygon;
                    pFillShapeElement = new PolygonElementClass();
                    pgonElemnt = pFillShapeElement as IElement;//Element

                    RubberPolygonClass pRubberBand3 = new RubberPolygonClass();//在屏幕上画个多边形
                    pPolygon = pRubberBand3.TrackNew(axMapControl.ActiveView.ScreenDisplay, null) as IPolygon;

                    pgonElemnt.Geometry = pPolygon;//把这个多边形转成Element

                    pGraphicsContainer = axMapControl.ActiveView as IGraphicsContainer;//把地图的当前view作为图片的容器

                    //pGraphicsContainer.DeleteAllElements ();
                    pGraphicsContainer.AddElement(pgonElemnt, 0);//把刚刚的element转到容器上
                    axMapControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
                    break;
            }
        }
        ///<summary>Draws a polygon on the screen in the ActiveView where the mouse is clicked.</summary>
        ///
        ///<param name="activeView">An IActiveView interface</param>
        /// 
        ///<remarks>Ideally, this function would be called from within the OnMouseDown event that was created with the ArcGIS base tool template.</remarks>
        protected IGeometry DrawPolygon(IActiveView activeView)
        {
            if (activeView == null)
            {
                return null;
            }

            try
            {
                IScreenDisplay screenDisplay = activeView.ScreenDisplay;

                // Constant
                screenDisplay.StartDrawing(screenDisplay.hDC, (System.Int16)esriScreenCache.esriNoScreenCache); // Explicit Cast
                IRgbColor rgbColor = new RgbColorClass();
                rgbColor.Red = 255;

                IColor color = rgbColor; // Implicit Cast
                ISimpleFillSymbol simpleFillSymbol = new SimpleFillSymbolClass();
                simpleFillSymbol.Color = color;

                ISymbol symbol = simpleFillSymbol as ISymbol; // Dynamic Cast
                IRubberBand rubberBand = new RubberPolygonClass();

                IGeometry geometry = rubberBand.TrackNew(screenDisplay, symbol);
                ITopologicalOperator2 ito = (ITopologicalOperator2)geometry;
                ito.Simplify();

                screenDisplay.SetSymbol(symbol);
                screenDisplay.DrawPolygon(geometry);
                screenDisplay.FinishDrawing();

                //activeView.Extent = geometry.Envelope;
                //ArcMap.Application.RefreshWindow();
                return geometry;
            }
            catch(Exception e) {
                return null;
            }
        }
        /// <summary>
        /// ���Ƽ���ͼ��
        /// </summary>
        /// <params name="geoType"></params>
        /// <params name="geometry"></params>
        /// <returns></returns>
        ESRI.ArcGIS.Carto.IElement createElement_x(ESRI.ArcGIS.Geometry.IGeometry geometry)
        {
            IElement element = null;
            try
            {
                switch (geometry.GeometryType)
                {
                    case esriGeometryType.esriGeometryPolygon:
                        IFillShapeElement pPolygonElement;
                        ISimpleFillSymbol pSimpleFillSymbol = new SimpleFillSymbolClass();
                        IPolygon pPolygon = new PolygonClass();
                        IRubberBand pRubberBand = new RubberPolygonClass();
                        ISimpleLineSymbol pSimpleLineSymbol = new SimpleLineSymbolClass();
                        pPolygonElement = new PolygonElementClass();

                        //if (e.button == 1)
                        //{
                        //   pPolygon=(IPolygon) pRubberBand.TrackNew(axMapControl1.ActiveView.ScreenDisplay, null);
                        //}
                        pSimpleLineSymbol.Width = 2;
                        pSimpleLineSymbol.Style = esriSimpleLineStyle.esriSLSSolid;
                        pSimpleLineSymbol.Color = TransColorToAEColor(Color.Blue);

                        //pSimpleFillSymbol.Color = GetRGBColor(11, 200, 145);
                        pSimpleFillSymbol.Style = esriSimpleFillStyle.esriSFSNull;
                        pSimpleFillSymbol.Outline = pSimpleLineSymbol;
                        IElement pElement = (IElement)pPolygonElement;
                        pElement.Geometry = geometry;
                        pPolygonElement.Symbol = pSimpleFillSymbol;

                        element = (IElement)pPolygonElement;
                        break;
                    case esriGeometryType.esriGeometryPolyline://Polyline��
                        ISimpleLineSymbol simpleLineSymbol = m_NewPolygonFeedback.Symbol as ISimpleLineSymbol;

                        ILineElement lineElement = new LineElementClass();
                        lineElement.Symbol = simpleLineSymbol as ILineSymbol;
                        element = lineElement as IElement;
                        element.Geometry = geometry;
                        break;
                    case esriGeometryType.esriGeometryPoint:
                        //���ý�����
                        IRgbColor pRGB = new RgbColorClass();
                        pRGB.Red = 255;
                        pRGB.Green = 0;
                        pRGB.Blue = 0;

                        ISimpleMarkerSymbol pSimpleMarkSymbol = new SimpleMarkerSymbolClass();
                        pSimpleMarkSymbol.Color = pRGB as IColor;
                        pSimpleMarkSymbol.Size = 2;
                        pSimpleMarkSymbol.Style = esriSimpleMarkerStyle.esriSMSSquare;

                        IMarkerElement pMarkerElement = new MarkerElementClass();
                        pMarkerElement.Symbol = pSimpleMarkSymbol as IMarkerSymbol;
                        element = pMarkerElement as IElement;
                        element.Geometry = geometry as IGeometry;
                        break;
                }
            }
            catch
            { }
            return element;
        }
Beispiel #33
0
        /// <summary>
        /// 屏幕上绘画几何形状
        /// </summary>
        /// <param name="screenDisplay">ESRI屏幕显示接口</param>
        /// <param name="geomType">几何形状类型的枚举类</param>
        /// <returns>ESRI几何形状接口</returns>
        public static IGeometry ScreenTrackGeometry(IScreenDisplay screenDisplay, dsGeometryType geomType)
        {
            IGeometry trackGeom = null;

            if (screenDisplay != null)
            {
                IRubberBand rubberBand = null;
                switch (geomType)
                {
                case dsGeometryType.dsGTPoint:
                    rubberBand = new RubberPointClass();
                    break;

                case dsGeometryType.dsGTLine:
                    rubberBand = new RubberLineClass();
                    break;

                case dsGeometryType.dsGTPolyline:
                    rubberBand = new RubberLineClass();
                    break;

                case dsGeometryType.dsGTRectangle:
                    rubberBand = new RubberEnvelopeClass();
                    break;

                case dsGeometryType.dsGTCircle:
                    rubberBand = new RubberCircleClass();
                    break;

                case dsGeometryType.dsGTEllipse:
                    rubberBand = new RubberEnvelopeClass();
                    break;

                case dsGeometryType.dsGTPolygon:
                    rubberBand = new RubberPolygonClass();
                    break;

                case dsGeometryType.dsGTRectangularPolygon:
                    rubberBand = new RubberRectangularPolygonClass();
                    break;

                default:
                    break;
                }
                if (rubberBand != null)
                {
                    trackGeom = rubberBand.TrackNew(screenDisplay, null);
                }
                if (geomType == dsGeometryType.dsGTEllipse)
                {
                    trackGeom = ConvertEnvelopeToEllipticArc(trackGeom);
                }
                else if ((geomType == dsGeometryType.dsGTLine) ||
                         (geomType == dsGeometryType.dsGTPolyline) ||
                         (geomType == dsGeometryType.dsGTPolygon))
                {
                    if (trackGeom is ITopologicalOperator)
                    {
                        (trackGeom as ITopologicalOperator).Simplify();
                    }
                }
            }
            return(trackGeom);
        }
        public override void OnMouseDown(int button, int shift, int x, int y, double mapX, double mapY)
        {
            DF2DApplication app   = DF2DApplication.Application;
            bool            ready = true;

            //cross = new Dictionary<string, string>();
            if (app == null || app.Current2DMapControl == null)
            {
                return;
            }
            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);



                    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)
                    {
                        Dictionary <string, List <IFeature> > lines = GetPipeLines(geo);
                        if (lines == null)
                        {
                            return;
                        }
                        WaitForm.Start("正在查询...", "请稍后");
                        int n = 0;

                        foreach (List <IFeature> l in lines.Values)
                        {
                            n += l.Count;
                        }
                        if (n > 500)
                        {
                            XtraMessageBox.Show("区域内管线大于500条,请重新选择区域", "提示");
                            WaitForm.Stop();
                            return;
                        }
                        FrmPipelineCross dialog = new FrmPipelineCross(geo, diameter, sysName, lines);
                        WaitForm.Stop();
                        UnBind();
                        dialog.Show();
                        if (dialog.DialogResult == DialogResult.Cancel || dialog.DialogResult == DialogResult.OK)
                        {
                            RestoreEnv();
                        }

                        //DataTable dt = CrossAnalysis(lines);
                        //FrmPipelineCross2D dialog = new FrmPipelineCross2D(dt);
                        //WaitForm.Stop();
                        //dialog.ShowDialog();
                    }
                }
            }
            catch (System.Exception ex)
            {
            }
        }