コード例 #1
0
        //双击则创建该线,并弹出缓冲窗体
        public override void OnDblClick()
        {
            //获取折线 并获取当前视图的屏幕显示
            if (m_pNewLineFeedback == null)
            {
                return;
            }

            IPolyline pPolyline = m_pNewLineFeedback.Stop();

            m_pNewLineFeedback = null;
            pPolyline.Project(m_MapControl.Map.SpatialReference);

            if (m_frmQuery == null)
            {
                m_frmQuery             = new frmQuery(m_MapControl, m_enumQueryMode);
                m_frmQuery.Owner       = m_mainFrm;
                m_frmQuery.FormClosed += new FormClosedEventHandler(frmQuery_FormClosed);
            }
            if (this.WriteLog)
            {
                Plugin.LogTable.Writelog("线缓冲查询");//xisheng 日志记录 0928;
            }
            //清除上次的所有元素
            (m_MapControl.Map as IGraphicsContainer).DeleteAllElements();
            m_frmBufferSet = new frmBufferSet(pPolyline as IGeometry, m_MapControl.Map, m_frmQuery);
            IGeometry pGeometry = m_frmBufferSet.GetBufferGeometry();

            if (pGeometry == null || m_frmBufferSet.Res == false)
            {
                return;
            }
            _QueryBar.m_pMapControl = m_MapControl;
            _QueryBar.EmergeQueryData(m_MapControl.ActiveView.FocusMap, pGeometry, m_frmBufferSet.pesriSpatialRelEnum);
            try
            {
                DevComponents.DotNetBar.Bar pBar = _QueryBar.Parent.Parent as DevComponents.DotNetBar.Bar;
                if (pBar != null)
                {
                    pBar.AutoHide = false;
                    //pBar.SelectedDockTab = 1;
                    int tmpindex = pBar.Items.IndexOf("dockItemDataCheck");
                    pBar.SelectedDockTab = tmpindex;
                }
            }
            catch
            { }
            //m_frmQuery.Show();
            // m_frmQuery.FillData(m_MapControl.ActiveView.FocusMap, pGeometry,m_frmBufferSet.pesriSpatialRelEnum);
        }
コード例 #2
0
 private void frmQuery_FormClosed(object sender, FormClosedEventArgs e)
 {
     m_enumQueryMode = m_frmQuery.QueryMode;
     m_frmQuery      = null;
     if (m_frmBufferSet != null)
     {
         m_frmBufferSet.setBufferGeometry(null);                      //added by chulili 20110731
     }
     // m_MapControl.ActiveView.Refresh();
     //deleted by chulili 20110731
     //base.m_cursor = Cursors.Default;//鼠标回到默认状态 xisheng 20110722
     //m_MapControl.CurrentTool = null;
     //end deleted by chulili
 }
コード例 #3
0
        public override void OnClick()
        {
            if (m_Hook == null)
            {
                return;
            }

            if (m_Hook.ArcGisMapControl.Map.LayerCount == 0)
            {
                MessageBox.Show("当前没有调阅数据!", "提示", MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                return;
            }
            if (this.WriteLog)
            {
                Plugin.LogTable.Writelog(Caption);
            }
            try
            {
                frmQuerySet fmQS = new frmQuerySet(m_Hook.ArcGisMapControl.Map, queryType.Within);
                if (fmQS.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                frmQuery            fmQuery = new frmQuery(m_Hook.MapControl, enumQueryMode.Visiable, false);
                SysCommon.CProgress pgss    = new SysCommon.CProgress("正在查询,请稍候...");
                pgss.EnableCancel    = false;
                pgss.ShowDescription = false;
                pgss.FakeProgress    = true;
                pgss.TopMost         = true;
                pgss.ShowProgress();
                Application.DoEvents();
                fmQuery.FillData(fmQS.lstQueryedLayer, fmQS.GeometryBag, queryType.Within);
                pgss.Close();
                Application.DoEvents();
                if (this.WriteLog)
                {
                    Plugin.LogTable.Writelog(Caption);
                }
                fmQuery.Show(m_frmhook.MainForm);
            }
            catch (Exception exError)
            {
                ErrorHandle.ShowFrmErrorHandle("提示", exError.Message);
            }
        }
コード例 #4
0
 /// <summary>
 /// Occurs when this tool is clicked
 /// </summary>
 public override void OnClick()
 {
     if (m_frmQuery == null)
     {
         m_frmQuery             = new frmQuery(m_MapControl, m_enumQueryMode);
         m_frmQuery.Owner       = m_mainFrm;
         m_frmQuery.FormClosed += new FormClosedEventHandler(frmQuery_FormClosed);
     }
     try
     {
         base.m_cursor = new System.Windows.Forms.Cursor(GetType(), "Resources.MapIdentify.cur");
     }
     catch
     {
     }
     //deleted by chulili 20110731
     //m_frmQuery.Show();
     //m_frmQuery.FillData(m_MapControl.ActiveView.FocusMap, null);
 }
コード例 #5
0
        public override void OnMouseUp(int Button, int Shift, int X, int Y)
        {
            if (m_pNewEnvelope == null)
            {
                return;
            }

            IEnvelope pEnvelope     = m_pNewEnvelope.Stop();
            int       iPiexl        = 3;
            double    iMapTolerance = ConvertPixelsToMapUnits(m_MapControl.ActiveView, iPiexl);

            IGeometry pGeometry = null;

            if (pEnvelope == null || pEnvelope.IsEmpty)
            {
                ITopologicalOperator pTopo = (ITopologicalOperator)m_pPoint;
                if (pTopo != null)
                {
                    pGeometry = pTopo.Buffer(iMapTolerance);
                }
            }
            else
            {
                pEnvelope.SpatialReference = m_MapControl.ActiveView.FocusMap.SpatialReference;
                pGeometry = pEnvelope;
            }
            m_pNewEnvelope = null;

            if (m_frmQuery == null)
            {
                m_frmQuery             = new frmQuery(m_MapControl, m_enumQueryMode);
                m_frmQuery.Owner       = m_mainFrm;
                m_frmQuery.FormClosed += new FormClosedEventHandler(frmQuery_FormClosed);
            }
            //ygc 2012-8-28 将查询结果数据在主窗体下方显示
            // _QuerBar.m_pMapControl = m_MapControl;
            // _QuerBar.EmergeQueryData(m_MapControl.ActiveView.FocusMap, pGeometry, esriSpatialRelEnum.esriSpatialRelIntersects);
            m_frmQuery.Show();
            ///ZQ 20111119  modify
            m_frmQuery.FillData(m_MapControl.ActiveView.FocusMap, pGeometry, esriSpatialRelEnum.esriSpatialRelIntersects);
        }
コード例 #6
0
        /// <summary>
        /// Occurs when this tool is clicked
        /// </summary>
        public override void OnClick()
        {
            OpenFileDialog dlg = new OpenFileDialog();

            //dlg.Filter = "个人数据库(*.mdb)|*.mdb|shp数据|*.shp|文本文件|*.txt";
            dlg.Filter = "shp数据|*.shp|个人数据库(*.mdb)|*.mdb|文件数据库(*.gdb)|gdb";
            if (dlg.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }
            IPolygon pGon = new PolygonClass();

            pGon = GetPolyGonFromFile(dlg.FileName);
            if (pGon == null)
            {
                return;
            }
            ITopologicalOperator pTopo = pGon as ITopologicalOperator;

            if (pTopo != null)
            {
                pTopo.Simplify();
            }
            if (this.WriteLog)
            {
                Plugin.LogTable.Writelog("导入范围查询,范围文件路径为" + dlg.FileName);//xisheng 日志记录 0928;
            }
            //Zq  20111011  add 将当前视图定位到导入的范围并闪烁显示
            m_MapControl.Extent = pGon.Envelope;
            (m_MapControl.Map as IActiveView).PartialRefresh(esriViewDrawPhase.esriViewForeground, null, null);
            m_MapControl.ActiveView.ScreenDisplay.UpdateWindow();
            m_MapControl.FlashShape(pGon as IGeometry, 3, 200, null);
            ///ZQ 2011 1129 modify
            drawgeometryXOR(pGon as IGeometry);
            if (m_frmQuery == null)
            {
                m_frmQuery             = new frmQuery(m_MapControl, m_enumQueryMode);
                m_frmQuery.Owner       = m_mainFrm;
                m_frmQuery.FormClosed += new FormClosedEventHandler(frmQuery_FormClosed);
            }
            ///ZQ 2011  1128 将绘制事件插入口袋中
            SysCommon.ScreenDraw.list.Add(ImportPolygonQueryAfterDraw);
            //m_frmQuery.Show();
            ///ZQ 20111119  modify
            // m_frmQuery.FillData(m_MapControl.ActiveView.FocusMap, pGon as IGeometry,esriSpatialRelEnum.esriSpatialRelIntersects );
            _QueryBar.m_pMapControl = m_MapControl;
            _QueryBar.EmergeQueryData(m_MapControl.ActiveView.FocusMap, pGon as IGeometry, esriSpatialRelEnum.esriSpatialRelIntersects);
            try
            {
                DevComponents.DotNetBar.Bar pBar = _QueryBar.Parent.Parent as DevComponents.DotNetBar.Bar;
                if (pBar != null)
                {
                    pBar.AutoHide = false;
                    //pBar.SelectedDockTab = 1;
                    int tmpindex = pBar.Items.IndexOf("dockItemDataCheck");
                    pBar.SelectedDockTab = tmpindex;
                }
            }
            catch
            { }
        }
コード例 #7
0
ファイル: frmSelectBuffer.cs プロジェクト: siszoey/geosufan
        private void buttonOk_Click(object sender, EventArgs e)
        {
            if (comboBoxELayers.Text.Trim() == "" || comboBoxELayers.Text.Trim() == "点击选择查询图层")
            {
                System.Windows.Forms.MessageBox.Show("请先选择图层!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            List <IGeometry>    lstGeometrys = new List <IGeometry>();
            IGeometryBag        pGeometryBag = new GeometryBagClass();
            IGeometryCollection pGeomtryCol  = (IGeometryCollection)pGeometryBag;
            IMap   pMap = m_pMapControl.Map;
            object obj  = System.Reflection.Missing.Value;

            //IGeometry pTempGeo = null;
            if (pMap.SelectionCount < 1)
            {
                System.Windows.Forms.MessageBox.Show("请先选择要素!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            this.Visible = false;
            m_pMapControl.CurrentTool = null;
            ChangeSelectAble(true, "");
            if (this.WriteLog)
            {
                Plugin.LogTable.Writelog(this.Text);//xisheng 日志记录 0928;
            }
            IActiveView  pAv        = pMap as IActiveView;
            ISelection   pSelection = pMap.FeatureSelection;
            IEnumFeature pEnumFea   = pSelection as IEnumFeature;
            IFeature     pFea       = pEnumFea.Next();

            while (pFea != null)
            {
                if (pFea.Shape != null)
                {
                    lstGeometrys.Add(pFea.Shape);
                    pGeomtryCol.AddGeometry(pFea.Shape, ref obj, ref obj);
                }
                pFea = pEnumFea.Next();
            }
            pGeometryBag.Project(pMap.SpatialReference);

            if (m_frmQuery == null)
            {
                m_frmQuery             = new frmQuery(_pMapControl, m_enumQueryMode);
                m_frmQuery.Owner       = m_mainFrm;
                m_frmQuery.FormClosed += new FormClosedEventHandler(frmQuery_FormClosed);
            }
            ///ZQ 2011 1129 已经不再使用Element绘制
            //清除上次的所有元素
            //(m_pMapControl.Map as IGraphicsContainer).DeleteAllElements();
            if (m_frmBufferSet != null)
            {
                SysCommon.ScreenDraw.list.Remove(m_frmBufferSet.BufferSetAfterDraw);
                m_frmBufferSet.setBufferGeometry(null);
                m_frmBufferSet = null;
            }
            m_frmBufferSet             = new frmBufferSet(pGeometryBag as IGeometry, m_pMapControl.Map, m_frmQuery);
            m_frmBufferSet.FormClosed += new FormClosedEventHandler(frmBufferSet_FormClosed);
            IGeometry pGeometry = m_frmBufferSet.GetBufferGeometry();

            if (pGeometry == null || m_frmBufferSet.Res == false)
            {
                this.Close();  return;
            }

            // m_frmQuery.Show();
            ///ZQ 20111119  modify
            // m_frmQuery.FillData(m_pMapControl.ActiveView.FocusMap, pGeometry,m_frmBufferSet.pesriSpatialRelEnum);

            //更改查询结果显示方式
            //ygc 2012-8-10
            QueryBar.m_pMapControl = _pMapControl;
            QueryBar.EmergeQueryData(m_pMapControl.ActiveView.FocusMap, pGeometry, m_frmBufferSet.pesriSpatialRelEnum);
            try
            {
                DevComponents.DotNetBar.Bar pBar = QueryBar.Parent.Parent as DevComponents.DotNetBar.Bar;
                if (pBar != null)
                {
                    pBar.AutoHide = false;
                    //pBar.SelectedDockTab = 1;
                    int tmpindex = pBar.Items.IndexOf("dockItemDataCheck");
                    pBar.SelectedDockTab = tmpindex;
                }
            }
            catch
            { }
            this.Close();
        }
コード例 #8
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            this.Visible = false;
            if (_axmapcontrol != null)
            {
                try
                {
                    IEnvelope penvelope = new EnvelopeClass();
                    penvelope.XMin = Convert.ToDouble(textBoxWest.Text);
                    penvelope.XMax = Convert.ToDouble(textBoxEast.Text);
                    penvelope.YMax = Convert.ToDouble(textBoxNorth.Text);
                    penvelope.YMin = Convert.ToDouble(textBoxSouth.Text);
                    IPoint pmiddle = new PointClass();
                    pmiddle.PutCoords((penvelope.XMax + penvelope.XMin) / 2, (penvelope.YMax + penvelope.YMin) / 2);//中心点
                    /*********************************将Envelope转成Polygon*/
                    IPolygon         pon = new PolygonClass();
                    IPointCollection ptcoll = new PolygonClass();
                    IPoint           a = new PointClass(); IPoint b = new PointClass(); IPoint c = new PointClass(); IPoint d = new PointClass();
                    a.PutCoords(penvelope.XMin, penvelope.YMax);
                    b.PutCoords(penvelope.XMax, penvelope.YMax);
                    c.PutCoords(penvelope.XMax, penvelope.YMin);
                    d.PutCoords(penvelope.XMin, penvelope.YMin);
                    object missing = Type.Missing;
                    ptcoll.AddPoint(a, ref missing, ref missing);
                    ptcoll.AddPoint(b, ref missing, ref missing);
                    ptcoll.AddPoint(c, ref missing, ref missing);
                    ptcoll.AddPoint(d, ref missing, ref missing);
                    pon = ptcoll as IPolygon;
                    /*********************************/
                    IGeometry geo = new PolygonClass();

                    geo = pon as IGeometry;

                    /*-----xisheng 20110802------*/
                    ISpatialReference         earthref    = null;
                    ISpatialReference         flatref     = null;
                    ISpatialReferenceFactory2 pSpatRefFac = new SpatialReferenceEnvironmentClass();
                    earthref = pSpatRefFac.CreateGeographicCoordinateSystem((int)esriSRGeoCSType.esriSRGeoCS_WGS1984);
                    if (this.WriteLog)
                    {
                        Plugin.LogTable.Writelog(this.Text);//xisheng 日志记录 0928;
                    }
                    if (_axmapcontrol.MapUnits == esriUnits.esriMeters)
                    {
                        flatref = _axmapcontrol.Map.SpatialReference;
                        geo.SpatialReference = flatref;//yjl20110812
                        //geo.Project(flatref);
                    }
                    /*-----xisheng 20110802------*/


                    //创建Topo对象,简化后统一空间参考
                    ITopologicalOperator pTopo = (ITopologicalOperator)geo;
                    pTopo.Simplify();
                    geo.Project(_axmapcontrol.Map.SpatialReference);


                    if (m_frmQuery == null)
                    {
                        m_frmQuery             = new frmQuery(_axmapcontrol, m_enumQueryMode);
                        m_frmQuery.Owner       = m_mainFrm;
                        m_frmQuery.FormClosed += new FormClosedEventHandler(frmQuery_FormClosed);
                    }

                    //清除上次的所有元素
                    (_axmapcontrol.Map as IGraphicsContainer).DeleteAllElements();
                    m_frmBufferSet             = new frmBufferSet(geo, _axmapcontrol.Map, m_frmQuery);
                    m_frmBufferSet.FormClosed += new FormClosedEventHandler(frmBufferSet_FormClosed);
                    _axmapcontrol.CenterAt(pmiddle);
                    IGeometry pGeometry = m_frmBufferSet.GetBufferGeometry();
                    if (pGeometry == null || m_frmBufferSet.Res == false)
                    {
                        return;
                    }

                    m_frmQuery.Show();
                    ///ZQ 20111119  modify
                    m_frmQuery.FillData(_axmapcontrol.ActiveView.FocusMap, pGeometry, m_frmBufferSet.pesriSpatialRelEnum);
                    this.Close();
                }
                catch (Exception ex)
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "错误:" + ex.Message);
                }
            }
        }
コード例 #9
0
        //双击则创建该线,并弹出缓冲窗体
        public override void OnDblClick()
        {
            //获取折线 并获取当前视图的屏幕显示
            if (m_pNewPolygonFeedback == null)
            {
                return;
            }
            IPolygon pPolygon = m_pNewPolygonFeedback.Stop();

            m_pNewPolygonFeedback = null;

            //不存在,为空。尺寸不够均退出
            if (pPolygon == null || pPolygon.IsEmpty)
            {
                return;
            }
            //xisheng 判断面积的高度,宽度时需判断是什么单位,若是经纬度则需要转换。20111220
            double        w      = pPolygon.Envelope.Width;
            double        h      = pPolygon.Envelope.Height;
            UnitConverter conver = new UnitConverterClass();

            if (m_MapControl.Map.MapUnits == esriUnits.esriDecimalDegrees)
            {
                w = conver.ConvertUnits(w, esriUnits.esriDecimalDegrees, esriUnits.esriMeters);
                h = conver.ConvertUnits(h, esriUnits.esriDecimalDegrees, esriUnits.esriMeters);
            }
            if (w < 0.01 || h < 0.01)
            {
                return;
            }
            //xisheng 20111220 end *********************************************************

            //创建Topo对象,简化后统一空间参考
            ITopologicalOperator pTopo = (ITopologicalOperator)pPolygon;

            pTopo.Simplify();
            pPolygon.Project(m_MapControl.Map.SpatialReference);

            if (m_frmQuery == null)
            {
                m_frmQuery             = new frmQuery(m_MapControl, m_enumQueryMode);
                m_frmQuery.Owner       = m_mainFrm;
                m_frmQuery.FormClosed += new FormClosedEventHandler(frmQuery_FormClosed);
            }
            if (this.WriteLog)
            {
                Plugin.LogTable.Writelog("面缓冲查询");//xisheng 日志记录 0928;
            }
            //清除上次的所有元素
            (m_MapControl.Map as IGraphicsContainer).DeleteAllElements();
            m_frmBufferSet = new frmBufferSet(pPolygon as IGeometry, m_MapControl.Map, m_frmQuery);
            IGeometry pGeometry = m_frmBufferSet.GetBufferGeometry();

            if (pGeometry == null || m_frmBufferSet.Res == false)
            {
                return;
            }
            // m_frmQuery.Show();
            ///ZQ 20111119  modify
            //m_frmQuery.FillData(m_MapControl.ActiveView.FocusMap, pGeometry,m_frmBufferSet.pesriSpatialRelEnum);
            _QueryBar.m_pMapControl = m_MapControl;
            _QueryBar.EmergeQueryData(m_MapControl.ActiveView.FocusMap, pGeometry, m_frmBufferSet.pesriSpatialRelEnum);
            try
            {
                DevComponents.DotNetBar.Bar pBar = _QueryBar.Parent.Parent as DevComponents.DotNetBar.Bar;
                if (pBar != null)
                {
                    pBar.AutoHide = false;
                    //pBar.SelectedDockTab = 1;
                    int tmpindex = pBar.Items.IndexOf("dockItemDataCheck");
                    pBar.SelectedDockTab = tmpindex;
                }
            }
            catch
            { }
        }
コード例 #10
0
 private void frmQuery_FormClosed(object sender, FormClosedEventArgs e)
 {
     m_enumQueryMode = m_frmQuery.QueryMode;
     m_frmQuery      = null;
 }
コード例 #11
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            this.Visible = false;
            if (_axmapcontrol != null)
            {
                try
                {
                    /*xisheng 20110802 */

                    ISpatialReferenceFactory2 pSpatRefFac = new SpatialReferenceEnvironmentClass();
                    earthref = pSpatRefFac.CreateGeographicCoordinateSystem((int)esriSRGeoCSType.esriSRGeoCS_WGS1984);

                    point = new ESRI.ArcGIS.Geometry.PointClass();
                    double x1 = Convert.ToDouble(textBoxX.Text);
                    double y1 = Convert.ToDouble(textBoxY.Text);
                    if (_axmapcontrol.MapUnits == esriUnits.esriMeters)
                    {
                        flatref = _axmapcontrol.Map.SpatialReference;
                        point.PutCoords(x1, y1);//yjl20110812
                    }
                    else if (_axmapcontrol.MapUnits == esriUnits.esriDecimalDegrees)
                    {
                        point.PutCoords(x1, y1);
                    }
                    // ESRI.ArcGIS.Geometry.IPoint pPoint = _axmapcontrol.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(Convert.ToInt32(point.X), Convert.ToInt32(point.Y));
                    //end 0802
                    if (this.WriteLog)
                    {
                        Plugin.LogTable.Writelog(this.Text);//xisheng 日志记录 0928;
                    }
                    if (m_frmQuery == null)
                    {
                        m_frmQuery             = new frmQuery(_axmapcontrol, m_enumQueryMode);
                        m_frmQuery.Owner       = m_mainFrm;
                        m_frmQuery.FormClosed += new FormClosedEventHandler(frmQuery_FormClosed);
                    }
                    if (m_frmBufferSet != null)
                    {
                        m_frmBufferSet.setBufferGeometry(null);
                        m_frmBufferSet = null;
                    }
                    m_frmBufferSet             = new frmBufferSet(point as IGeometry, _axmapcontrol.Map, m_frmQuery);
                    m_frmBufferSet.FormClosed += new FormClosedEventHandler(frmBufferSet_FormClosed);
                    _axmapcontrol.CenterAt(point);
                    IGeometry pGeometry = m_frmBufferSet.GetBufferGeometry();
                    if (pGeometry == null || m_frmBufferSet.Res == false)
                    {
                        return;
                    }

                    //m_frmQuery.Show();
                    ///ZQ 20111119  modify
                    //m_frmQuery.FillData(_axmapcontrol.ActiveView.FocusMap, pGeometry, m_frmBufferSet.pesriSpatialRelEnum);
                    QueryBar.m_pMapControl = _axmapcontrol;
                    QueryBar.EmergeQueryData(_axmapcontrol.ActiveView.FocusMap, pGeometry, m_frmBufferSet.pesriSpatialRelEnum);
                    try
                    {
                        DevComponents.DotNetBar.Bar pBar = QueryBar.Parent.Parent as DevComponents.DotNetBar.Bar;
                        if (pBar != null)
                        {
                            pBar.AutoHide = false;
                            //pBar.SelectedDockTab = 1;
                            int tmpindex = pBar.Items.IndexOf("dockItemDataCheck");
                            pBar.SelectedDockTab = tmpindex;
                        }
                    }
                    catch
                    { }
                    this.Close();
                }
                catch (Exception ex)
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "错误:" + ex.Message);
                }
            }
        }