Esempio n. 1
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);
     }
     //this.Visible = true;
     //this.Focus();
     //_axmapcontrol.ActiveView.Refresh();
 }
Esempio n. 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
 }
Esempio n. 3
0
        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();
        }
Esempio n. 4
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);
                }
            }
        }