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


C# IMap.get_Layer方法代码示例

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


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

示例1: FindLayer

 //private void AddField(IFeatureLayer pFeaturelayer, string strFieldName)
 //{
 //    IMxDocument pmxdoc = ArcMap.Document as IMxDocument;
 //    IMap pmap = pmxdoc.FocusMap;
 //    IFeatureClass pFeatureClass = pFeaturelayer.FeatureClass;
 //    IFieldEdit pNewField = new FieldClass();
 //    pNewField.Name_2 = strFieldName;
 //    if (pFeatureClass.FindField(strFieldName) != -1)
 //    {
 //        //MessageBox.Show("Field: " + strFieldName + " already exists.");
 //        return;
 //    }
 //    pNewField.Type_2 = esriFieldType.esriFieldTypeDouble;
 //    pNewField.Length_2 = 50;
 //    pNewField.Editable_2 = true;
 //    pNewField.IsNullable_2 = true;
 //    pNewField.DefaultValue_2 = null;
 //    pFeatureClass.AddField(pNewField);
 //    pNewField = null;
 //    GC.Collect();
 //}
 public ILayer FindLayer(IMap pmap, string layer)
 {
     for (int i = 0; i <= pmap.LayerCount - 1; i++)
     {
         if (pmap.get_Layer(i).Name == layer)
             return pmap.get_Layer(i);
     }
     return null;
 }
开发者ID:chinasio,项目名称:BathymetryTools10,代码行数:30,代码来源:clsDeepInterpolation.cs

示例2: FindLayer

        public ILayer FindLayer(IMap pmap, string aLayerName)
        {
            int i = 0;

            while (i <= pmap.LayerCount - 1)
            {
                if ((pmap.get_Layer(i).Name.ToUpper()) == (aLayerName.ToUpper()))

                    break;
                i++;
            }
            return pmap.get_Layer(i);
        }
开发者ID:chinasio,项目名称:BathymetryTools10,代码行数:13,代码来源:frmAreaVolume.cs

示例3: FindMyFeatureLayer

 public static IFeatureLayer FindMyFeatureLayer(IMap inMap, string inName)
 {
     string isfound = "false";
     ILayer tempLayer;
     IFeatureLayer goodLayer = new FeatureLayerClass();
     for (int i = 0; i < inMap.LayerCount; i++)
     {
         tempLayer = inMap.get_Layer(i);
         if (tempLayer is IFeatureLayer)
         {
             if (tempLayer.Name == inName)
             {
                 isfound = "true";
                 goodLayer = tempLayer as IFeatureLayer;
             }
         }
     }
     //duplicate name in the map.? How we deal with it
     if (isfound == "true")
     {
         return goodLayer;
     }
     else
     {
         return null;
     }
 }
开发者ID:jiang-ming,项目名称:aerialphotoviewer,代码行数:27,代码来源:Helper.cs

示例4: FindMyMosaicLayer

 public static IMosaicLayer FindMyMosaicLayer(IMap inMap, string inName)
 {
     string isfound = "false";
     ILayer tempLayer;
     IMosaicLayer goodMLayer = new MosaicLayerClass();
     for (int i = 0; i < inMap.LayerCount; i++)
     {
         tempLayer = inMap.get_Layer(i);
         if (tempLayer is IMosaicLayer)
         {
             if (tempLayer.Name == inName)
             {
                 isfound = "true";
                 goodMLayer = tempLayer as IMosaicLayer;
             }
         }
     }
     if (isfound == "true")
     {
         return goodMLayer;
     }
     else
     {
         return null;
     }
 }
开发者ID:jiang-ming,项目名称:aerialphotoviewer,代码行数:26,代码来源:Helper.cs

示例5: getLayerIndexByName

 /// <summary>
 /// 通过图层的名称获得图层在Map中的Index
 /// </summary>
 /// <param name="_pMap">地图对象</param>
 /// <param name="_LayerName">图层名称</param>
 /// <returns></returns>
 public static int getLayerIndexByName(IMap _pMap,string _LayerName)
 {
     int iIndex = -1;
     for (int i = 0; i < _pMap.LayerCount; i++)
     {
         if (_pMap.get_Layer(i).Name == _LayerName)
         {
             iIndex =i;
             return iIndex;
         }
     }
     return iIndex;
 }
开发者ID:lovelll,项目名称:DQHP,代码行数:19,代码来源:LayerOprate.cs

示例6: GetLayerByName

 public static ILayer GetLayerByName(string lyrName, IMap mapName)
 {
     if (mapName == null || lyrName == null || lyrName == "")
         return null;
     else
     {
         ILayer lyr = null;
         for (int i = 0; i < mapName.LayerCount; i++)
         {
             lyr = mapName.get_Layer(i);
             if (lyr.Name == lyrName)
                 return lyr;
         }
     }
     return null;
 }
开发者ID:cwtok123,项目名称:ArcEngine,代码行数:16,代码来源:Utilities.cs

示例7: addAttributeField

        /// <summary> 
        /// ��ӵ�ͼ�����ֶ� 
        /// </summary> 
        /// <param name="name">����</param> 
        /// <param name="aliasName">����</param> 
        /// <param name="type">����</param> 
        /// <param name="length">����</param> 
        /// <param name="defaultValue">Ĭ��ֵ</param> 
        /// <param name="editAble">�Ƿ���Ա༭</param> 
        public static void addAttributeField(string name, string aliasName,string type, int length, string defaultValue, bool editAble,IMap pMap)
        {
            try
            {
                //����
                IFieldEdit pMyField;
                pMyField = new FieldClass();
                pMyField.Name_2 = name;
                pMyField.AliasName_2 = aliasName;
                pMyField.Length_2 =length;
                if (type == "Date")
                    pMyField.Type_2 = esriFieldType.esriFieldTypeDate;
                else if (type == "Integer")
                    pMyField.Type_2 = esriFieldType.esriFieldTypeInteger;
                else if (type == "Single")
                    pMyField.Type_2 = esriFieldType.esriFieldTypeSingle;
                else if (type == "Double")
                    pMyField.Type_2 = esriFieldType.esriFieldTypeDouble;
                else if (type == "String")
                    pMyField.Type_2 = esriFieldType.esriFieldTypeString;

                if (defaultValue.Equals(""))
                { }
                else
                {
                    pMyField.IsNullable_2 = false;
                    if (type == "Date")
                        pMyField.DefaultValue_2 =DateTime.Parse(defaultValue);
                    else if (type == "Integer")
                        pMyField.DefaultValue_2 =int.Parse(defaultValue);
                    else if (type == "Single")
                        pMyField.DefaultValue_2 =float.Parse(defaultValue);
                    else if (type == "Double")
                        pMyField.DefaultValue_2 =double.Parse(defaultValue);
                    else if (type == "String")
                        pMyField.DefaultValue_2 = defaultValue;
                }
                pMyField.Editable_2 = editAble;
                ITable pTable = (ITable)pMap.get_Layer(GetLayerIdByName(globalInfo.currentLayerName,pMap));
                pTable.AddField(pMyField);
                MessageBox.Show("����ֶ�" + name+ "�ɹ�");
            }
            catch (Exception ex)
            {
                MessageBox.Show("���ʧ�ܣ�" + ex.Message);
            }
        }
开发者ID:lovelll,项目名称:DQHP,代码行数:56,代码来源:FieldOperate.cs

示例8: addAttributeFieldF

        public static void addAttributeFieldF(string name, string aliasName, string type, int length, string defaultValue, bool editAble, IMap pMap)
        {
            try
            {
                IFeatureLayer pFeatureLayer = pMap.get_Layer(GetLayerIdByName(globalInfo.currentLayerName,pMap)) as FeatureLayer;
                IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass;
                if (pFeatureClass == null)
                {
                    return;
                }
                IField pField;
                IFieldEdit pFieldEdit;
                pField = new FieldClass();
                pFieldEdit = (IFieldEdit)pField;
                pFieldEdit.Name_2 = name;
                pFieldEdit.Length_2 = length;
                if (defaultValue.Equals(""))
                { }
                else
                {
                    if (type == "Date")
                        pFieldEdit.DefaultValue_2 = DateTime.Parse(defaultValue);
                    else if (type == "Integer")
                        pFieldEdit.DefaultValue_2 = int.Parse(defaultValue);
                    else if (type == "Single")
                        pFieldEdit.DefaultValue_2 = float.Parse(defaultValue);
                    else if (type == "Double")
                        pFieldEdit.DefaultValue_2 = double.Parse(defaultValue);
                    else if (type == "String")
                        pFieldEdit.DefaultValue_2 = defaultValue;
                }
                pFieldEdit.Editable_2= editAble;
                pFeatureClass.AddField(pField);
                MessageBox.Show("����ֶ�" + name + "�ɹ�");

            }
            catch(Exception ex)
            {
                MessageBox.Show("���ʧ�ܣ�" + ex.Message);
            }
        }
开发者ID:lovelll,项目名称:DQHP,代码行数:41,代码来源:FieldOperate.cs

示例9: SetLayerVisibleByName

 /// <summary>
 /// �趨ͼ���Visible���ԣ�����true�����и�ͼ�㶼����Ϊtrue����Ϊfalse��ͼ�㲻��
 /// </summary>
 /// <params name="pMap"></params>
 /// <params name="layerName"></params>
 /// <params name="visible"></params>
 public static void SetLayerVisibleByName(IMap pMap, string layerName, bool visible)
 {
     ILayer pLayer;
     for (int i = 0; i < pMap.LayerCount; i++)
     {
         pLayer = pMap.get_Layer(i);
         if (pLayer is IGroupLayer)
         {
             pLayer = SetLayerVisibleByName((IGroupLayer)pLayer, layerName, visible);
             if (pLayer != null && visible == true)
             {
                 pMap.get_Layer(i).Visible = true;
             }
         }
         else
         {
             if (pLayer.Name == layerName)
                 pLayer.Visible = visible;
         }
     }
 }
开发者ID:ismethr,项目名称:gas-geological-map,代码行数:27,代码来源:DataEditCommon.cs

示例10: GetFabricSubLayersFromFabric

        public bool GetFabricSubLayersFromFabric(IMap Map, ICadastralFabric Fabric, out IFeatureLayer CFPointLayer, out IFeatureLayer CFLineLayer,
          out IArray CFParcelLayers, out IFeatureLayer CFControlLayer, out IFeatureLayer CFLinePointLayer)
        {
            ICadastralFabricLayer pCFLayer = null;
              ICadastralFabricSubLayer pCFSubLyr = null;
              ICompositeLayer pCompLyr = null;
              IArray CFParcelLayers2 = new ArrayClass();

              IDataset pDS = (IDataset)Fabric;
              IName pDSName = pDS.FullName;
              string FabricNameString = pDSName.NameString;

              long layerCount = Map.LayerCount;
              CFPointLayer = null; CFLineLayer = null; CFControlLayer = null; CFLinePointLayer = null;
              IFeatureLayer pParcelLayer = null;
              for (int idx = 0; idx <= (layerCount - 1); idx++)
              {
            ILayer pLayer = Map.get_Layer(idx);
            bool bIsComposite = false;
            if (pLayer is ICompositeLayer)
            {
              pCompLyr = (ICompositeLayer)pLayer;
              bIsComposite = true;
            }

            int iCompositeLyrCnt = 1;
            if (bIsComposite)
              iCompositeLyrCnt = pCompLyr.Count;

            for (int i = 0; i <= (iCompositeLyrCnt - 1); i++)
            {
              if (bIsComposite)
            pLayer = pCompLyr.get_Layer(i);
              if (pLayer is ICadastralFabricLayer)
              {
            pCFLayer = (ICadastralFabricLayer)pLayer;
            break;
              }
              if (pLayer is ICadastralFabricSubLayer)
              {
            pCFSubLyr = (ICadastralFabricSubLayer)pLayer;
            IDataset pDS2 = (IDataset)pCFSubLyr.CadastralFabric;
            IName pDSName2 = pDS2.FullName;
            if (pDSName.NameString.ToLower() == pDSName2.NameString.ToLower() &&
            pCFSubLyr.CadastralTableType == esriCadastralFabricTable.esriCFTParcels)
            {
              pParcelLayer = (IFeatureLayer)pCFSubLyr;
              CFParcelLayers2.Add(pParcelLayer);
            }
            if (CFLineLayer == null && pDSName.NameString.ToLower() == pDSName2.NameString.ToLower() &&
            pCFSubLyr.CadastralTableType == esriCadastralFabricTable.esriCFTLines)
              CFLineLayer = (IFeatureLayer)pCFSubLyr;
            if (CFPointLayer == null && pDSName.NameString.ToLower() == pDSName2.NameString.ToLower() &&
            pCFSubLyr.CadastralTableType == esriCadastralFabricTable.esriCFTPoints)
              CFPointLayer = (IFeatureLayer)pCFSubLyr;
            if (CFLinePointLayer == null && pDSName.NameString.ToLower() == pDSName2.NameString.ToLower() &&
            pCFSubLyr.CadastralTableType == esriCadastralFabricTable.esriCFTLinePoints)
              CFLinePointLayer = (IFeatureLayer)pCFSubLyr;
            if (CFControlLayer == null && pDSName.NameString.ToLower() == pDSName2.NameString.ToLower() &&
            pCFSubLyr.CadastralTableType == esriCadastralFabricTable.esriCFTControl)
              CFControlLayer = (IFeatureLayer)pCFSubLyr;
              }
            }

            //Check that the fabric layer belongs to the requested fabric
            if (pCFLayer != null)
            {
              if (pCFLayer.CadastralFabric.Equals(Fabric))
              {
            CFPointLayer = (IFeatureLayer)pCFLayer.get_CadastralSubLayer(esriCadastralFabricRenderer.esriCFRPoints);
            CFLineLayer = (IFeatureLayer)pCFLayer.get_CadastralSubLayer(esriCadastralFabricRenderer.esriCFRLines);
            pParcelLayer = (IFeatureLayer)pCFLayer.get_CadastralSubLayer(esriCadastralFabricRenderer.esriCFRParcels);
            CFParcelLayers2.Add(pParcelLayer);
            Debug.WriteLine(pParcelLayer.Name);
            CFControlLayer = (IFeatureLayer)pCFLayer.get_CadastralSubLayer(esriCadastralFabricRenderer.esriCFRControlPoints);
            CFLinePointLayer = (IFeatureLayer)pCFLayer.get_CadastralSubLayer(esriCadastralFabricRenderer.esriCFRLinePoints);
              }

              if (CFLinePointLayer != null)
            CFParcelLayers2.Add(CFLinePointLayer);

              if (CFControlLayer != null)
            CFParcelLayers2.Add(CFControlLayer);

              if (CFLineLayer != null)
            CFParcelLayers2.Add(CFLineLayer);

              if (CFPointLayer != null)
            CFParcelLayers2.Add(CFPointLayer);

              CFParcelLayers = CFParcelLayers2;
              return true;
            }
              }
              //at the minimum, just need to make sure we have a parcel sublayer for the requested fabric
              if (pParcelLayer != null)
              {
            if (CFLinePointLayer != null)
              CFParcelLayers2.Add(CFLinePointLayer);

//.........这里部分代码省略.........
开发者ID:Esri,项目名称:parcel-fabric-desktop-addins,代码行数:101,代码来源:clsFabricUtils.cs

示例11: GetFabricFromMap

 public bool GetFabricFromMap(IMap InMap, out ICadastralFabric Fabric)
 {
     //this code assumes only one fabric in the map, and will get the first that it finds.
       //Used when not in an edit session. TODO: THis could return an array of fabrics
       Fabric = null;
       for (int idx = 0; idx <= (InMap.LayerCount - 1); idx++)
       {
     ILayer pLayer = InMap.get_Layer(idx);
     Fabric = GetFabricFromLayer(pLayer);
     if (Fabric != null)
       return true;
     else
     {
       if (pLayer != null)
     Marshal.FinalReleaseComObject(pLayer);
     }
       }
       return false;
 }
开发者ID:Esri,项目名称:parcel-fabric-desktop-addins,代码行数:19,代码来源:clsFabricUtils.cs

示例12: getLayerByName

 public ILayer getLayerByName(IMap pMap, string str)
 {
     ILayer pLayer = null;
     for (int i = 0; i < pMap.LayerCount; i++)
     {
         if (str == pMap.get_Layer(i).Name)
             pLayer = pMap.get_Layer(i);
     }
         return pLayer;
 }
开发者ID:609878415,项目名称:fff12138,代码行数:10,代码来源:Form1.cs

示例13: GetLayerFromMapByName

        /// <summary>
        ///根据图层名选择图层
        /// </summary>
        /// <param name="pMap">地图</param>
        /// <param name="layerName">图层名</param>
        /// <returns>目标图层</returns>
        /// <summary>  
        public static ILayer GetLayerFromMapByName(IMap pMap, string layerName)
        {
            ILayer pLayer = null;
            for (int i = 0; i < pMap.LayerCount; i++)
            {
                pLayer = pMap.get_Layer(i);

                if (!pLayer.Valid)
                {
                    continue;
                }

                if (pLayer is ICompositeLayer)
                {
                    pLayer = GetLayerFromComposit(pLayer, layerName);
                    if (pLayer == null)
                    {
                        continue;
                    }
                    if (pLayer.Name == layerName)
                    {
                        return pLayer;
                    }
                }
                else
                {
                    if (pLayer.Name == layerName)
                    {
                        return pLayer;
                    }
                }
            }

            if (pLayer != null)
            {
                if (pLayer.Name != layerName)
                    return null;
            }

            return pLayer;
        }
开发者ID:hy1314200,项目名称:HyDM,代码行数:48,代码来源:MapOperAPI.cs

示例14: QueryLayerByDisplayName

 public static ILayer QueryLayerByDisplayName(IMap paramMap, string layerName)
 {
     int num = paramMap.LayerCount;
     layerName = layerName.ToUpper();
     for (int i = 0; i < num; i++)
     {
         ILayer layer = paramMap.get_Layer(i);
         if (layer.Name.ToUpper().Equals(layerName))
         {
             return layer;
         }
     }
     return null;
 }
开发者ID:ismethr,项目名称:gas-geological-map,代码行数:14,代码来源:LayerHelper.cs

示例15: IndexOfLayer

 public static int IndexOfLayer(IMap paramMap, ILayer paramLayer)
 {
     int num2 = paramMap.LayerCount;
     for (int i = 0; i < num2; i++)
     {
         if (paramMap.get_Layer(i) == paramLayer)
         {
             return i;
         }
     }
     return -1;
 }
开发者ID:ismethr,项目名称:gas-geological-map,代码行数:12,代码来源:LayerHelper.cs


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