Пример #1
0
 //利用计时器刷新mapcontrol
 private void Timer_Tick(object sender, EventArgs e)
 {
     GeoUtilities.ControlsSelFeature pControlsSelFeature = Mapcontrol.CurrentTool as GeoUtilities.ControlsSelFeature;
     if (pControlsSelFeature == null)
     {
         btnBrowse.Enabled = false;
     }
     else
     {
         btnBrowse.Enabled = true;
     }
 }
Пример #2
0
        private void btnSelFeaturesByCondition_Click(object sender, EventArgs e)
        {
            GeoUtilities.FrmSQLQuery frmSQL = new GeoUtilities.FrmSQLQuery(Mapcontrol, false);
            frmSQL.ShowDialog(this);

            if (frmSQL.DialogResult == DialogResult.OK)
            {
                GeoUtilities.ControlsSelFeature controlsEditSelFeature = new GeoUtilities.ControlsSelFeature();

                ITool    tool = controlsEditSelFeature as ITool;
                ICommand cmd  = tool as ICommand;
                cmd.OnCreate(Mapcontrol);
                Mapcontrol.CurrentTool = tool;

                //获得要选择的图层
                List <ILayer> layerList = new List <ILayer>(); //可以选择的图层列表
                for (int i = 0; i < Mapcontrol.Map.LayerCount; i++)
                {                                              //cyf 20110706 add
                    ILayer mLayer = Mapcontrol.Map.get_Layer(i);
                    if (mLayer is IGroupLayer)
                    {
                        ICompositeLayer pComlayer = mLayer as ICompositeLayer;
                        for (int j = 0; j < pComlayer.Count; j++)
                        {
                            IFeatureLayer featLay = pComlayer.get_Layer(j) as IFeatureLayer;
                            if (featLay == null)
                            {
                                continue;
                            }
                            if (!(featLay.FeatureClass as IDataset).Name.EndsWith("_GOH"))
                            {
                                continue;
                            }
                            layerList.Add(featLay);
                        }
                    }//end
                    else
                    {
                        IFeatureLayer featLay = Mapcontrol.Map.get_Layer(i) as IFeatureLayer;
                        if (featLay == null)
                        {
                            continue;
                        }
                        if (!(featLay.FeatureClass as IDataset).Name.EndsWith("_GOH"))
                        {
                            continue;
                        }
                        layerList.Add(featLay);
                    }
                }
                controlsEditSelFeature.LayerList = layerList;
            }
        }
Пример #3
0
        private void btnSelFeatures_Click(object sender, EventArgs e)
        {
            GeoUtilities.ControlsSelFeature controlsEditSelFeature = new GeoUtilities.ControlsSelFeature();

            ITool    tool = controlsEditSelFeature as ITool;
            ICommand cmd  = tool as ICommand;

            cmd.OnCreate(Mapcontrol);
            Mapcontrol.Map.ClearSelection();
            Mapcontrol.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, Mapcontrol.ActiveView.FullExtent);
            Mapcontrol.CurrentTool = tool;

            //获得要选择的图层
            List <ILayer> layerList = new List <ILayer>();//可以选择的图层列表

            for (int i = 0; i < Mapcontrol.Map.LayerCount; i++)
            {
                //cyf 20110706 add
                ILayer mLayer = Mapcontrol.Map.get_Layer(i);
                if (mLayer is IGroupLayer)
                {
                    ICompositeLayer pComlayer = mLayer as ICompositeLayer;
                    for (int j = 0; j < pComlayer.Count; j++)
                    {
                        IFeatureLayer featLay = pComlayer.get_Layer(j) as IFeatureLayer;
                        if (featLay == null)
                        {
                            continue;
                        }
                        if (!(featLay.FeatureClass as IDataset).Name.EndsWith("_GOH"))
                        {
                            continue;
                        }
                        layerList.Add(featLay);
                    }
                }//end
                else
                {
                    IFeatureLayer featLay = Mapcontrol.Map.get_Layer(i) as IFeatureLayer;
                    if (featLay == null)
                    {
                        continue;
                    }
                    if (!(featLay.FeatureClass as IDataset).Name.EndsWith("_GOH"))
                    {
                        continue;
                    }
                    layerList.Add(featLay);
                }
            }
            controlsEditSelFeature.LayerList = layerList;
        }