当前位置: 首页>>代码示例>>C#>>正文


C# IMap.get_Layers方法代码示例

本文整理汇总了C#中IMap.get_Layers方法的典型用法代码示例。如果您正苦于以下问题:C# IMap.get_Layers方法的具体用法?C# IMap.get_Layers怎么用?C# IMap.get_Layers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IMap的用法示例。


在下文中一共展示了IMap.get_Layers方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: frmBuffer

        public frmBuffer(IMap _pMap)
        {
            InitializeComponent();
            //load all the feature layers in the map to the layers combo
            UID uid = new UIDClass();
            uid.Value = "{40A9E885-5533-11d0-98BE-00805F7CED21}";
            pMap = _pMap;
            layers = pMap.get_Layers(uid, true);
            layers.Reset();
            ILayer layer = null;
            while ((layer = layers.Next()) != null)
            {
                cboLayers.Items.Add(layer.Name);
            }
            //select the first layer
            if (cboLayers.Items.Count > 0)
                cboLayers.SelectedIndex = 0;

            string tempDir = System.IO.Path.GetTempPath();
            txtOutputPath.Text = System.IO.Path.Combine(tempDir, ((string)cboLayers.SelectedItem + "_buffer.shp"));

            //set the default units of the buffer
            int units = Convert.ToInt32(pMap.MapUnits);
            cboUnits.SelectedIndex = units;
        }
开发者ID:lovelll,项目名称:DQHP,代码行数:25,代码来源:frmBuffer.cs

示例2: UpdateFeature

        public void UpdateFeature( IMap pMap ,ILayer pCurrentLayer,IPoint pPoint )
        {
            //处理具体数据
            if (pMap == null || pPoint == null )
                return;
            m_pMap = pMap;

            //如果没有地图图层 ,则不处理
            long nLayerCount = pMap.LayerCount;
            if( nLayerCount == 0 )
                return;

            //删除树结点
            FtTreeView.Nodes.Clear();

            this.FTtreeList.Nodes.Clear();

            //开始选择
            IGeometry geom = pPoint;

            ISpatialReference spatialReference = m_pMap.SpatialReference;
            geom.SpatialReference = spatialReference;

            //Refresh the active view
            IActiveView activeView = (IActiveView)m_pMap;

            ISelectionEnvironment selEnv =  new SelectionEnvironment();
            selEnv.PointSelectionMethod = esriSpatialRelEnum.esriSpatialRelWithin;
            m_pMap.SelectByShape(geom, selEnv, false);
            activeView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, activeView.Extent);

            //如果没有设置 当前图层pCurrentLayer ,则不处理

            ESRI.ArcGIS.esriSystem.IPersist pPersist = new FeatureLayer() as ESRI.ArcGIS.esriSystem.IPersist;
            UID uid = pPersist as UID ;

            IEnumLayer pEnumlayer = pMap.get_Layers(uid,true );

            pEnumlayer.Reset();
            ILayer pLayer = pEnumlayer.Next();
            while( pLayer != null )
            {

                if( pLayer.Visible == false )
                {
                    pLayer = pEnumlayer.Next();
                    continue;
                }

                IFeatureLayer2 pFtLayer = (IFeatureLayer2)pLayer;
                IFeatureSelection pFtSelect = (IFeatureSelection)pFtLayer;
                ISelectionSet pSelectset = (ISelectionSet)pFtSelect.SelectionSet;

                InitTreeView(pSelectset, pLayer);

                pLayer = pEnumlayer.Next();
            }
        }
开发者ID:hy1314200,项目名称:HyDM,代码行数:58,代码来源:FrmFtAttr.cs

示例3: GetEditablePolyLines

 //从地图内获取可编辑要素图层列表
 public static IList<IFeatureLayer> GetEditablePolyLines(IMap map)
 {
     IList<IFeatureLayer> pEditablePolyLines = new List<IFeatureLayer>();
     IEnumLayer pEnumLayer = map.get_Layers();
     pEnumLayer.Reset();
     ILayer pLayer = pEnumLayer.Next();
     while (pLayer != null)
     {
         //Mark 非要素图层是否有问题
         IFeatureLayer pFeatureLayer = pLayer as IFeatureLayer;
         IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass;
         IDatasetEdit pDataEdit = pFeatureClass as IDatasetEdit;
         if (pDataEdit.IsBeingEdited() && pFeatureClass.ShapeType == esriGeometryType.esriGeometryPolyline)
             pEditablePolyLines.Add(pFeatureLayer);
         pLayer = pEnumLayer.Next();
     }
     return pEditablePolyLines;
 }
开发者ID:weepingdog,项目名称:VerticesToCenter,代码行数:19,代码来源:FunctionCommonFeatureManage.cs

示例4: Buffer

        public Buffer(IMap _pMap)
        {
            InitializeComponent();

            //����Glass����
            this.EnableGlass = false;
            //����ʾ�����С����ť
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            //
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable;
            //ȥ��ͼ��
            this.ShowIcon = false;

            //load all the feature layers in the map to the layers combo
            UID uid = new UIDClass();
            uid.Value = "{40A9E885-5533-11d0-98BE-00805F7CED21}";
            pMap = _pMap;
            layers = pMap.get_Layers(uid, true);
            layers.Reset();
            ILayer layer = null;
            while ((layer = layers.Next()) != null)
            {
                cboLayers.Items.Add(layer.Name);
            }
            //select the first layer
            if (cboLayers.Items.Count > 0)
                cboLayers.SelectedIndex = 0;

            string tempDir = System.IO.Path.GetTempPath();
            txtOutputPath.Text = System.IO.Path.Combine(tempDir, ((string)cboLayers.SelectedItem + "_buffer.shp"));

            //set the default units of the buffer
            int units = Convert.ToInt32(pMap.MapUnits);
            cboUnits.SelectedIndex = units;
        }
开发者ID:lovelll,项目名称:MyDatapreMenu,代码行数:36,代码来源:Buffer.cs

示例5: GetRasterLayer

        public IRasterLayer GetRasterLayer(IMap map, string layerName)
        {
            try
            {
                if (layerName == "")
                    return null;
                //Get list of geofeature layers in the map
                UID geoRasterLayerID = new UIDClass();
                geoRasterLayerID.Value = "{D02371C7-35F7-11D2-B1F2-00C04F8EDEFF}";
                IEnumLayer enumLayer = map.get_Layers(((ESRI.ArcGIS.esriSystem.UID)geoRasterLayerID), true);

                // Step through each geofeature layer in the map
                enumLayer.Reset();
                IRasterLayer layer = enumLayer.Next() as IRasterLayer;
                //IRasterProps pRastProp = layer.raster as IRasterProps;

                while (layer != null)
                {
                    if (layer.Valid)
                    {

                        if ((layer.Name).ToUpper() == (layerName).ToUpper())
                        {
                            return layer;

                        }
                        // MessageBox.Show(layer.FilePath);

                    }
                    layer = enumLayer.Next() as IRasterLayer;
                }
                return null;
            }
            catch (Exception ex)
            {
                MessageBox.Show("GetView: " + ex.Message);
                return null;
            }
        }
开发者ID:riordabr,项目名称:3d-cities-template,代码行数:39,代码来源:AttributeAssistantEditorExtension.cs

示例6: RotatePoint

        public double RotatePoint(IMap pMap, IFeature pPointFeature, bool bArithmeticAngle, string strDiameterFld, string strLayerName)
        {
            IFeatureClass pPointFC = default(IFeatureClass);
            ISpatialFilter pSFilter = default(ISpatialFilter);
            IFeatureCursor pLineCursor = default(IFeatureCursor);
            IFeature pLineFeature = default(IFeature);
            IPoint pPoint = default(IPoint);
            IEnumLayer pEnumLayer = default(IEnumLayer);
            ILayer pLayer = default(ILayer);
            IFeatureLayer pFLayer = default(IFeatureLayer);
            UID pId = new UID();
            UID pUID = new UID();
            ITopologicalOperator pTopo = null;

            List<Double> cAngles = new List<Double>();
            List<string> pLstInt = new List<string>();
            List<double> cDiameters = new List<double>();

            double dblAngle = 0;
            double dblDiameter = 0;
            double ltest = 0;
            int iLineDiameterFieldPos = 0;
            try
            {
            //This routine is used by both RotateDuringCreateFeature and RotateSelectedFeature.
            //It contains all of logic for determining the rotation angle.

            const int iAngleTol = 5;
            //Used for Tees> a straight line is 180 + or - iAngleTol

                pPointFC = (IFeatureClass)pPointFeature.Class;
            pPoint = (IPoint)pPointFeature.Shape;

            //Create spatial filter to find intersecting features at this given point
            pTopo = (ITopologicalOperator)pPoint;

            pSFilter = new SpatialFilter();
            pSFilter.Geometry = pTopo.Buffer(0.5);
            //pPoint
            pSFilter.GeometryField = pPointFC.ShapeFieldName;
            pSFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;

            //Step through each feature layer
            pUID.Value = "{E156D7E5-22AF-11D3-9F99-00C04F6BC78E}";
            //GeoFeatureLayer
            pEnumLayer = (IEnumLayer)pMap.get_Layers(pUID, true);
            pEnumLayer.Reset();
            pLayer = (ILayer)pEnumLayer.Next();

            while ((pLayer != null))
            {
                //Verify that this is a line layer
                pFLayer = (IFeatureLayer)pLayer;

                if (pFLayer.FeatureClass != null)
                {

                    if (pFLayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPolyline && pFLayer.Visible && (strLayerName == "" || strLayerName == Globals.getClassName((IDataset)pFLayer.FeatureClass)))
                    {
                        //Apply the filter this line layer
                        pLineCursor = pFLayer.FeatureClass.Search(pSFilter, true);

                        //Loop through the found lines for this layer
                        pLineFeature = pLineCursor.NextFeature();
                        while ((pLineFeature != null))
                        {
                            if (pLstInt.Count > 0)
                            {
                                if (pLstInt.Contains(pLineFeature.Class.ObjectClassID + " " + pLineFeature.OID))
                                {
                                    pLineFeature = pLineCursor.NextFeature();
                                    continue;
                                }
                            }
                            pLstInt.Add(pLineFeature.Class.ObjectClassID.ToString() + " " + pLineFeature.OID.ToString());

                            dblAngle = Globals.GetAngleOfLineAtPoint((IPolyline)pLineFeature.ShapeCopy, (IPoint)pPointFeature.ShapeCopy, Globals.GetXYTolerance(pPointFeature));
                            dblAngle = Globals.ConvertRadsToDegrees(dblAngle);

                            //Convert to geographic degrees(zero north clockwise)
                            if (!(bArithmeticAngle))
                            {
                                dblAngle = Globals.ConvertArithmeticToGeographic(dblAngle);
                            }
                            //Round angle
                            dblAngle = Math.Round(dblAngle, 4);

                            //Find diameter field, if it exists
                            iLineDiameterFieldPos = pFLayer.FeatureClass.FindField(strDiameterFld);

                            //Get diameter of line
                            if (iLineDiameterFieldPos < 0)
                            {
                                dblDiameter = -9999;
                            }
                            else if (pLineFeature.get_Value(iLineDiameterFieldPos) == null)
                            {
                                dblDiameter = -9999;
                            }
                            else if (object.ReferenceEquals(pLineFeature.get_Value(iLineDiameterFieldPos), DBNull.Value))
//.........这里部分代码省略.........
开发者ID:jrinks,项目名称:local-government-desktop-addins,代码行数:101,代码来源:Rotate.cs

示例7: FindTOCFeatureLayerByDatasetName

        //        public static ILayer FindTOCLayerByLayerName(string layerName, IMap pMap)
        //        {
        //            try
        //            {
        //                if (pMap != null)
        //                {
        //                    if(pMap.LayerCount > 0)
        //                    {
        //                        UID pUID = new UIDClass();
        //                        pUID.Value = "{E156D7E5-22AF-11D3-9F99-00C04F6BC78E}";
        //
        //                        IEnumLayer pEnumLayer = pMap.get_Layers(pUID,true);
        //
        //                        ILayer pLayer;
        //                        pLayer = pEnumLayer.Next();
        //                
        //                        while (pLayer != null)
        //                        {
        //                            if (pLayer.Valid)
        //                            {
        //                                if (pLayer is IFeatureLayer)
        //                                {
        //                                    IFeatureLayer pFL = (IFeatureLayer)pLayer;
        //                        
        //                                    IDataset pDS = (IDataset)pFL.FeatureClass;
        //
        //                                    if (pDS.Name.ToLower() == dsName.ToLower())
        //                                    {
        //                                        break;
        //                                    }
        //                                }
        //                            }
        //                            pLayer = pEnumLayer.Next();
        //                        }
        //                    
        //                        return (IFeatureLayer)pLayer;
        //                    }
        //                }
        //                return null;
        //
        //            }
        //            catch(Exception ex)
        //            {
        //                Debug.WriteLine("Layer Not Found in Map: " + ex.Message);
        //                return null;
        //
        //            }
        //
        //        }
        public static IFeatureLayer FindTOCFeatureLayerByDatasetName(string dsName, IMap pMap)
        {
            try
            {
                if (pMap != null)
                {
                    if(pMap.LayerCount > 0)
                    {
                        UID pUID = new UIDClass();
                        pUID.Value = "{E156D7E5-22AF-11D3-9F99-00C04F6BC78E}";

                        IEnumLayer pEnumLayer = pMap.get_Layers(pUID,true);

                        ILayer pLayer;
                        pLayer = pEnumLayer.Next();

                        while (pLayer != null)
                        {
                            if (pLayer.Valid)
                            {
                                if (pLayer is IFeatureLayer)
                                {
                                    IFeatureLayer pFL = (IFeatureLayer)pLayer;

                                    IDataset pDS = (IDataset)pFL.FeatureClass;

                                    if (pDS.Name.ToLower() == dsName.ToLower())
                                    {
                                        break;
                                    }
                                }
                            }
                            pLayer = pEnumLayer.Next();
                        }

                        return (IFeatureLayer)pLayer;
                    }
                }
                return null;

            }
            catch(Exception ex)
            {
                Debug.WriteLine("Layer Not Found in Map: " + ex.Message);
                return null;

            }
        }
开发者ID:EAWCS1,项目名称:SUITT,代码行数:97,代码来源:ToolUtils.cs

示例8: GetFabricSubLayers

 public bool GetFabricSubLayers(IMap Map, esriCadastralFabricTable FabricSubClass, out IArray CFParcelFabSubLayers)
 {
     ICadastralFabricSubLayer pCFSubLyr = null;
       IArray CFParcelFabricSubLayers2 = new ArrayClass();
       IFeatureLayer pParcelFabricSubLayer = null;
       UID pId = new UIDClass();
       pId.Value = "{E156D7E5-22AF-11D3-9F99-00C04F6BC78E}";
       IEnumLayer pEnumLayer = Map.get_Layers(pId, true);
       pEnumLayer.Reset();
       ILayer pLayer = pEnumLayer.Next();
       while (pLayer != null)
       {
     if (pLayer is ICadastralFabricSubLayer)
     {
       pCFSubLyr = (ICadastralFabricSubLayer)pLayer;
       if (pCFSubLyr.CadastralTableType == FabricSubClass)
       {
     pParcelFabricSubLayer = (IFeatureLayer)pCFSubLyr;
     CFParcelFabricSubLayers2.Add(pParcelFabricSubLayer);
       }
     }
     pLayer = pEnumLayer.Next();
       }
       CFParcelFabSubLayers = CFParcelFabricSubLayers2;
       if (CFParcelFabricSubLayers2.Count > 0)
     return true;
       else
     return false;
 }
开发者ID:Esri,项目名称:parcel-fabric-desktop-addins,代码行数:29,代码来源:Utilities.cs

示例9: ResetMapWorkspace

        /// <summary>
        /// 重置工作空间
        /// </summary>
        /// <param name="pNewWksp"></param>
        /// <param name="pMap"></param>
        /// <returns></returns>
        public static bool ResetMapWorkspace(IWorkspace pNewWksp, IMap pMap)
        {
            UID uid = new UIDClass();
            uid.Value = "{40A9E885-5533-11d0-98BE-00805F7CED21}";

            IEnumLayer pEnumLayer = pMap.get_Layers(uid, true);
            pEnumLayer.Reset();
            ILayer pLayer = pEnumLayer.Next();
            while (pLayer != null)
            {
                //if (pLayer.Name.Contains("XZQ_") || pLayer.Name.Contains("Dist_"))
                //{
                //    ResetLayerDatasource2(pLayer as IDataLayer2, pNewWksp);
                //}
                //else
                //{
                    ResetLayerDatasource(pLayer as IDataLayer2, pNewWksp);
                //}
                pLayer = pEnumLayer.Next();
            }
            return true;
        }
开发者ID:hy1314200,项目名称:HyDM,代码行数:28,代码来源:AEAccessFactory.cs

示例10: GetMapLayerByLayerName

        /// <summary>
        /// Gets the layer from the map matching the specified map layer name and layer type.
        /// </summary>
        /// <param name="map">The map from which to get the map layer.</param>
        /// <param name="layerName">The name of the map layer to get.</param>
        /// <param name="type">The type of map layer to get.</param>
        /// <returns>Returns a map layer.</returns>
        public static ILayer GetMapLayerByLayerName(IMap map, string layerName, LayerType type)
        {
            // string methodName = MethodInfo.GetCurrentMethod().Name;

            ILayer mapLayer = null;
            if (map != null && string.IsNullOrEmpty(layerName) == false)
            {
                UID layerId = GetLayerIdByLayerType(type);
                if (map.LayerCount > 0)
                {
                    try
                    {
                        IEnumLayer layers = map.get_Layers(layerId, true);
                        layers.Reset();
                        ILayer layer = layers.Next();
                        while (layer != null)
                        {
                            if (string.Compare(layer.Name, layerName, true) == 0)
                            {
                                mapLayer = layer;
                                break;
                            }
                            layer = layers.Next();
                        }
                    }
                    catch (Exception ex)
                    {
                        //map.get_Layers(layerId, true) fails if layer type does not exist in map i.e looking for
                        //grouplayers and there are no grouplayers in map
                        // _logger.LogException(ex);
                    }
                }
            }
            // else
            // _logger.LogFormat("{0}: Null map or layer name parameter.", methodName, LogLevel.enumLogLevelWarn);

            return mapLayer;
        }
开发者ID:Ramakrishnapv,项目名称:FuturaNetwork,代码行数:45,代码来源:DisplayMap.cs

示例11: GetWorkspacesFromMap

        /// <summary>
        /// Gets all workspaces from the map.
        /// </summary>
        /// <param name="map">The map.</param>
        /// <returns>Returns a dictionary of the number of layers by workspace.</returns>
        public static IDictionary<IWorkspace, int> GetWorkspacesFromMap(IMap map)
        {
            IDictionary<IWorkspace, int> workspaces = new Dictionary<IWorkspace, int>();
            if (map != null && map.LayerCount > 0)
            {
                UID uid = new UIDClass();
                uid.Value = EsriConstants.FeatureLayerGUID;

                try
                {
                    IEnumLayer enumLayer = map.get_Layers(uid, true);
                    IFeatureLayer featLayer = enumLayer.Next() as IFeatureLayer;

                    IDataset ds;
                    int count = 0;
                    IWorkspace workspace;

                    while (featLayer != null)
                    {
                        try
                        {
                            if (featLayer.FeatureClass != null)
                            {
                                ds = (IDataset)featLayer.FeatureClass;
                                if (ds != null)
                                {
                                    if (ds.Workspace != null)
                                    {
                                        workspace = ds.Workspace;
                                        if (workspaces.ContainsKey(workspace))
                                        {
                                            count = workspaces[workspace];
                                            count++;
                                        }
                                        else
                                            count = 1;
                                        workspaces[workspace] = count;
                                    }
                                }
                            }
                            featLayer = enumLayer.Next() as IFeatureLayer;
                        }
                        catch (Exception e)
                        {
                            // _logger.LogException(e);
                            continue;
                        }

                    }
                }
                catch (Exception e)
                {
                    //_logger.LogException(e);
                }
            }
            return workspaces;
        }
开发者ID:Ramakrishnapv,项目名称:FuturaNetwork,代码行数:62,代码来源:DisplayMap.cs

示例12: GetFeatureClass

        /// <summary>
        /// Retorna uma featureClass a partir do seu nome no geodatabase
        /// </summary>
        /// <param name="nomeLayer">Nome da classe</param>
        /// <param name="mapa">Mana onde se encontra a classe</param>
        /// <returns></returns>
        public static IFeatureClass GetFeatureClass(String nomeDaClasse, IMap mapa)
        {
            IFeatureClass fclassReturn = null;
            UID uid = new UID();
            uid.Value = "{E156D7E5-22AF-11D3-9F99-00C04F6BC78E}"; // FeatureLayers
            IEnumLayer enumLayers = mapa.get_Layers(uid, false);
            ILayer layer = enumLayers.Next();

            IFeatureClass fClass = null;
            while (layer != null)
            {
                fClass = (layer as IFeatureLayer).FeatureClass;
                string[] className = (fClass as IDataset).Name.Split('.');
                if (className.Length > 1)
                {
                    if (className[1] == nomeDaClasse)
                    {
                        return fClass;
                    }
                }
                else
                {
                    if ((fClass as IDataset).Name == nomeDaClasse)
                    {
                        return fClass;
                    }
                }
                layer = enumLayers.Next();
            }

            return fclassReturn;
        }
开发者ID:ezequias,项目名称:Esri,代码行数:38,代码来源:GisUtils.cs

示例13: GetOIDArraysBySourceNameFromMapSelection

		public static Dictionary<string, ILongArray> GetOIDArraysBySourceNameFromMapSelection(IMap map, List<string> sourceNames)
		{
			UIDClass uid = new UIDClass();
			uid.Value = "{E156D7E5-22AF-11D3-9F99-00C04F6BC78E}"; //IGeoFeatureLayer

			IEnumLayer searchEnumLayer = map.get_Layers(uid, true);
			searchEnumLayer.Reset();

			//create result dictionary from source names with empty oidArrays

			Dictionary<string, ILongArray> oidArraysBySourceName = new Dictionary<string, ILongArray>();
			ILongArray oidArray = null;

			foreach (string sourceName in sourceNames)
			{
				if (!oidArraysBySourceName.TryGetValue(sourceName, out oidArray))
				{
					oidArray = new LongArrayClass();
					oidArraysBySourceName.Add(sourceName, oidArray);
				}
			}

			ILayer layer = searchEnumLayer.Next();
			while (layer != null)
			{
				IDisplayTable displayTable = layer as IDisplayTable;
				string sourceName = "";
				if (layer.Valid && layer.Visible && displayTable != null)
				{
					IDataset ds = displayTable.DisplayTable as IDataset;
					if (ds != null)
						sourceName = ds.Name;
				}

				if (sourceName.Length > 0)
				{
					if (oidArraysBySourceName.TryGetValue(sourceName, out oidArray))
					{
						ISelectionSet selSet = displayTable.DisplaySelectionSet;
						IEnumIDs enumOIDs = null;
						if (selSet != null)
							enumOIDs = selSet.IDs;

						if (enumOIDs != null)
						{
							enumOIDs.Reset();
							int oid = enumOIDs.Next();
							while (oid != -1)
							{
								oidArray.Add(oid);
								oid = enumOIDs.Next();
							}
						}
					}
				}

				layer = searchEnumLayer.Next();
			}

			return oidArraysBySourceName;
		}
开发者ID:Esri,项目名称:arcobjects-sdk-community-samples,代码行数:61,代码来源:SubsetHelperUI.cs

示例14: GetLayerByName

        /// <summary>
        /// 根据图层名获得图层
        /// </summary>
        /// <params name="map">Map</params>
        /// <params name="lyrname">图层名</params>
        /// <returns>要素图层</returns>
        public static IFeatureLayer GetLayerByName(IMap map, string lyrname)
        {
            try
            {
                UID puid = new UID();
                puid.Value = GIS_Const.STR_IFeatureLayer; //"{40A9E885-5533-11d0-98BE-00805F7CED21}";//IFeatureLayer
                IEnumLayer enumLayer = map.get_Layers(puid, true);
                enumLayer.Reset();
                ILayer player;
                player = enumLayer.Next();
                IFeatureLayer featureLayer = new FeatureLayerClass();

                while (player != null)
                {
                    featureLayer = player as IFeatureLayer;
                    string layerName = featureLayer.Name;
                    if (layerName == lyrname)
                    {
                        return featureLayer;
                        //break;
                    }
                    player = enumLayer.Next();
                }

                return null;
            }
            catch
            {
                return null;
            }
        }
开发者ID:ismethr,项目名称:gas-geological-map,代码行数:37,代码来源:LayerHelper.cs

示例15: GetLayer

        /// <summary>
        /// 根据图层名称获取图层
        /// </summary>
        /// <param name="pMap"></param>
        /// <param name="LayerName"></param>
        /// <returns></returns>
        public ILayer GetLayer(IMap pMap, string LayerName)
        {
            IEnumLayer pEnunLayer = pMap.get_Layers(null, false);

            pEnunLayer.Reset();

            ILayer pRetureLayer;

            pRetureLayer = pEnunLayer.Next();

            while (pRetureLayer != null)
            {
                if (pRetureLayer.Name == LayerName)
                {
                    break;
                }

                pRetureLayer = pEnunLayer.Next();
            }
            return pRetureLayer;
        }
开发者ID:Krystal001025,项目名称:temp,代码行数:27,代码来源:GDBInput.cs


注:本文中的IMap.get_Layers方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。