Example #1
0
        private void StartQuery(IEnvelope ienvelope_0)
        {
            ISpatialReference spatialReference = _context.FocusMap.SpatialReference;

            ienvelope_0.SpatialReference = spatialReference;
            IMap                  focusMap             = _context.FocusMap;
            IActiveView           activeView           = focusMap as IActiveView;
            ISelectionEnvironment selectionEnvironment = _context.Config.SelectionEnvironment;

            selectionEnvironment.CombinationMethod = esriSelectionResultEnum.esriSelectionResultAdd;
            esriSpatialRelEnum linearSelectionMethod = selectionEnvironment.LinearSelectionMethod;
            esriSpatialRelEnum areaSelectionMethod   = selectionEnvironment.AreaSelectionMethod;

            if (ienvelope_0 is IEnvelope)
            {
                if (this.double_0 != -1.0)
                {
                    if (this.double_0 > this.double_1)
                    {
                        selectionEnvironment.LinearSelectionMethod = esriSpatialRelEnum.esriSpatialRelContains;
                        selectionEnvironment.AreaSelectionMethod   = esriSpatialRelEnum.esriSpatialRelContains;
                        this.double_1 = -1.0;
                    }
                    else
                    {
                        selectionEnvironment.LinearSelectionMethod = esriSpatialRelEnum.esriSpatialRelIntersects;
                        selectionEnvironment.AreaSelectionMethod   = esriSpatialRelEnum.esriSpatialRelIntersects;
                    }
                }
                else
                {
                    this.double_0 = -1.0;
                }
            }
            activeView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
            try
            {
                focusMap.SelectByShape(ienvelope_0, selectionEnvironment, false);
            }
            catch (COMException ex)
            {
                if (ex.ErrorCode == -2147467259)
                {
                    System.Windows.Forms.MessageBox.Show("执行查询时产生错误。空间索引不存在", "选择");
                }
                else
                {
                    //CErrorLog.writeErrorLog(this, ex, "");
                }
            }
            catch (Exception exception_)
            {
                //CErrorLog.writeErrorLog(this, exception_, "");
            }
            activeView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
            selectionEnvironment.LinearSelectionMethod = linearSelectionMethod;
            selectionEnvironment.AreaSelectionMethod   = areaSelectionMethod;
        }
Example #2
0
        public override void OnClick()
        {
            ISelectionEnvironment selectionEnvironmentClass = _plugin.QuerySettings.SelectionEnvironment;
            IMap pMap = _context.MapControl.Map;

            (pMap as IActiveView).PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
            pMap.SelectByShape((pMap as IActiveView).Extent, selectionEnvironmentClass, false);
            (pMap as IActiveView).PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
        }
Example #3
0
        private void method_2(IEnvelope ienvelope_0)
        {
            IGeometry ienvelope0 = ienvelope_0;

            ienvelope0.SpatialReference = this._appContext.MapControl.Map.SpatialReference;
            IMap                  focusMap             = this._appContext.MapControl.Map;
            IActiveView           activeView           = focusMap as IActiveView;
            ISelectionEnvironment selectionEnvironment = this._appContext.Config.SelectionEnvironment;

            selectionEnvironment.CombinationMethod = esriSelectionResultEnum.esriSelectionResultAdd;
            esriSpatialRelEnum linearSelectionMethod = selectionEnvironment.LinearSelectionMethod;
            esriSpatialRelEnum areaSelectionMethod   = selectionEnvironment.AreaSelectionMethod;

            if (ienvelope0 is IEnvelope)
            {
                if (this.double_0 == -1)
                {
                    this.double_0 = -1;
                }
                else if (this.double_0 <= this.double_1)
                {
                    selectionEnvironment.LinearSelectionMethod = esriSpatialRelEnum.esriSpatialRelIntersects;
                    selectionEnvironment.AreaSelectionMethod   = esriSpatialRelEnum.esriSpatialRelIntersects;
                }
                else
                {
                    selectionEnvironment.LinearSelectionMethod = esriSpatialRelEnum.esriSpatialRelContains;
                    selectionEnvironment.AreaSelectionMethod   = esriSpatialRelEnum.esriSpatialRelContains;
                    this.double_1 = -1;
                }
            }
            activeView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
            try
            {
                focusMap.SelectByShape(ienvelope0, selectionEnvironment, false);
            }
            catch (COMException cOMException1)
            {
                COMException cOMException = cOMException1;
                if (cOMException.ErrorCode != -2147467259)
                {
                    Logger.Current.Error("", cOMException, "");
                }
                else
                {
                    MessageBox.Show("执行查询时产生错误。空间索引不存在", "选择");
                }
            }
            catch (Exception exception)
            {
                Logger.Current.Error("", exception, "");
            }
            activeView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
            selectionEnvironment.LinearSelectionMethod = linearSelectionMethod;
            selectionEnvironment.AreaSelectionMethod   = areaSelectionMethod;
        }
Example #4
0
        public ArcGisPoisonous()
        {
            InitializeComponent();
            TOCControl.SetBuddyControl(MainMapControl);

            EagleEyeMapControl.Extent = MainMapControl.FullExtent;
            pEnv = EagleEyeMapControl.Extent;
            DrawRectangle(pEnv);

            //窗体初始化时新建ISelectionEnvironment接口的对象,对象具有默认的选项设置值
            selectionEnvironment = new SelectionEnvironmentClass();

            // 修改按钮状态
            ChangeButtonState(false);
        }
Example #5
0
        public Form1()
        {
            IActiveView pActiveView;
            IMap        pMap;

            InitializeComponent();
            selectionEnvironment = new SelectionEnvironmentClass();
            //this.mMapControl = mapControl;
            IMapControlDefault pMapcontrol;

            pMapcontrol          = axMapControl1.Object as IMapControlDefault;
            pMap                 = axMapControl1.Map;
            pActiveView          = pMap as IActiveView;
            skinEngine1.SkinFile = System.Environment.CurrentDirectory + "\\Skins\\MSN.ssk";
        }
Example #6
0
        public ApplicationBase()
        {
            this.IsSupportZD              = false;
            this.MapCommands              = new List <object>();
            this.iselectionEnvironment_0  = new SelectionEnvironment();
            this.iengineSnapEnvironment_0 = new EngineEditor() as IEngineSnapEnvironment;
            IEngineEditProperties2 properties = this.iengineSnapEnvironment_0 as IEngineEditProperties2;

            properties.SnapTips = true;
            this.InitConfig();
            ApplicationRef.Application = this;
            this.UseSnap           = true;
            this.IsSnapEndPoint    = true;
            this.IsSnapBoundary    = true;
            this.IsSnapPoint       = true;
            this.IsSnapVertexPoint = true;
            this.iengineSnapEnvironment_0.SnapTolerance = 10.0;
        }
Example #7
0
        private void frmSelectSet_Load(object sender, EventArgs e)
        {
            dgvGridList.ClearSelection();
            dgvGridList.Enabled = true;

            System.Drawing.Color pColor;
            IRgbColor            pRGBColor;

            m_pSelectEnv = new SelectionEnvironmentClass();
            pRGBColor    = m_pSelectEnv.DefaultColor as IRgbColor;
            pColor       = Color.FromArgb(pRGBColor.Red, pRGBColor.Green, pRGBColor.Blue);
            this.cColorPicker.SelectedColor = pColor;

            this.txtTolerance.Text   = m_pSelectEnv.SearchTolerance.ToString();
            this.txtSelectCount.Text = ClsDeclare.g_Sys.MaxSelectCount.ToString();

            PopGrid();
            this.dgvGridList.AllowUserToAddRows = false;
            this.dgvGridList.ReadOnly           = false;
        }
Example #8
0
        public override void OnClick()
        {
            ISelectionEnvironment selectionEnvironmentClass = _plugin.QuerySettings.SelectionEnvironment;
            IMap         pMap             = _context.MapControl.Map;
            IEnumElement selectedElements = (pMap as IGraphicsContainerSelect).SelectedElements;

            selectedElements.Reset();
            IElement i = selectedElements.Next();

            if (i != null)
            {
                (pMap as IActiveView).PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
                try
                {
                    pMap.SelectByShape(i.Geometry, selectionEnvironmentClass, false);
                }
                catch
                {
                }
                esriSelectionResultEnum combinationMethod = selectionEnvironmentClass.CombinationMethod;
                selectionEnvironmentClass.CombinationMethod = esriSelectionResultEnum.esriSelectionResultAdd;
                for (i = selectedElements.Next(); i != null; i = selectedElements.Next())
                {
                    try
                    {
                        pMap.SelectByShape(i.Geometry, selectionEnvironmentClass, false);
                    }
                    catch
                    {
                    }
                }
                (pMap as IActiveView).PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
                selectionEnvironmentClass.CombinationMethod = combinationMethod;
            }
            else
            {
                MessageService.Current.Info("请先选择准备用于选择要素的图形!");
            }
        }
Example #9
0
        public override void OnClick()
        {
            ISelectionEnvironment selectionEnvironmentClass = _plugin.QuerySettings.SelectionEnvironment;
            IMap pMap = _context.MapControl.Map;

            if (_plugin.QuerySettings.CurrentLayer == null)
            {
                return;
            }
            int num = (_plugin.QuerySettings.CurrentLayer as IFeatureLayer).FeatureClass.FeatureCount(null);

            if (num <= (selectionEnvironmentClass as ISelectionEnvironmentThreshold).WarningThreshold ||
                MessageService.Current.Ask("所选择记录较多,执行将花较长时间,是否继续?") != false)
            {
                (pMap as IActiveView).PartialRefresh(esriViewDrawPhase.esriViewGeoSelection,
                                                     _plugin.QuerySettings.CurrentLayer, null);
                (_plugin.QuerySettings.CurrentLayer as IFeatureSelection).SelectFeatures(null,
                                                                                         esriSelectionResultEnum.esriSelectionResultAdd, false);
                (pMap as IActiveView).PartialRefresh(esriViewDrawPhase.esriViewGeoSelection,
                                                     _plugin.QuerySettings.CurrentLayer, null);
            }
        }
Example #10
0
 public void SelectByShape(ESRI.ArcGIS.Geometry.IGeometry Shape, ISelectionEnvironment env, bool justOne)
 {
     throw new NotImplementedException();
 }
Example #11
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            int           i;
            IFeatureLayer pFeatureLayer;
            bool          bClearSelect;
            IActiveView   pActiveView;

            m_pSelectEnv = new SelectionEnvironmentClass();
            bClearSelect = false;
            for (i = 0; i < dgvGridList.RowCount; i++)
            {
                pFeatureLayer = ClsSelectQuery.FunFindFeatureLayerByName(dgvGridList.Rows[i].Cells[1].Value.ToString(), ClsDeclare.g_pMap);
                if (pFeatureLayer is IFeatureLayer)
                {
                    if (this.dgvGridList.Rows[i].Cells[0].Value != null)
                    {
                        pFeatureLayer.Selectable = true;
                    }
                    else
                    {
                        pFeatureLayer.Selectable = false;
                    }
                    if (pFeatureLayer.Selectable == false && m_ChangeSelect[i] == 1)
                    {
                        bClearSelect = true;
                    }
                }
            }
            IRgbColor pRGBColor = new RgbColorClass();

            pRGBColor.Red             = cColorPicker.SelectedColor.R;
            pRGBColor.Green           = cColorPicker.SelectedColor.G;
            pRGBColor.Blue            = cColorPicker.SelectedColor.B;
            m_pSelectEnv.DefaultColor = pRGBColor;

            if (txtTolerance != null)
            {
                m_pSelectEnv.SearchTolerance = Convert.ToInt32(txtTolerance.Text);
            }

            if (this.txtSelectCount != null)
            {
                if (this.txtSelectCount.Text == "")
                {
                    m_MaxSelectCount = 0;
                }
                else
                {
                    m_MaxSelectCount = Convert.ToInt64(this.txtSelectCount.Text);
                }
                ClsDeclare.g_Sys.MaxSelectCount = m_MaxSelectCount;
            }
            if (bClearSelect == true)
            {
                pActiveView = ClsDeclare.g_pMap as IActiveView;
                pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
                ClsDeclare.g_pMap.ClearSelection();
                pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
            }
            this.Close();
        }
Example #12
0
 public FormMain()
 {
     InitializeComponent();
     //窗体初始化时新建ISelectionEnvironment接口的对象,对象具有默认的选项设置值
     selectionEnvironment = new SelectionEnvironmentClass();
 }