本文整理汇总了C#中ESRI.get_Layer方法的典型用法代码示例。如果您正苦于以下问题:C# ESRI.get_Layer方法的具体用法?C# ESRI.get_Layer怎么用?C# ESRI.get_Layer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ESRI
的用法示例。
在下文中一共展示了ESRI.get_Layer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConvertLayerToKML
public bool ConvertLayerToKML(string kmzOutputPath, string tmpShapefilePath, ESRI.ArcGIS.Carto.IMap map)
{
try
{
string kmzName = System.IO.Path.GetFileName(kmzOutputPath);
string folderName = System.IO.Path.GetDirectoryName(kmzOutputPath);
IGeoProcessor2 gp = new GeoProcessorClass();
IVariantArray parameters = new VarArrayClass();
parameters.Add(tmpShapefilePath);
parameters.Add(kmzName);
gp.Execute("MakeFeatureLayer_management", parameters, null);
IVariantArray parameters1 = new VarArrayClass();
// assign parameters
parameters1.Add(kmzName);
parameters1.Add(kmzOutputPath);
gp.Execute("LayerToKML_conversion", parameters1, null);
// Remove the temporary layer from the TOC
for (int i = 0; i < map.LayerCount; i++ )
{
ILayer layer = map.get_Layer(i);
if (layer.Name == "featureLayer")
{
map.DeleteLayer(layer);
break;
}
}
return true;
}
catch(Exception ex)
{
return false;
}
}
示例2: InitDatabase
/// <summary>
/// obtain the database workspace and path dynamically from the layers in the map
/// </summary>
private void InitDatabase(ESRI.ArcGIS.Carto.IMap ThisMap, ref string ErrorMessage)
{
ESRI.ArcGIS.Carto.ILayer ThisLayer;
ESRI.ArcGIS.Geodatabase.IDataset ThisDataset;
int LayerCount;
LayerCount = ThisMap.LayerCount;
for (int LayerIndex = 0; LayerIndex < LayerCount; LayerIndex++)
{
ThisLayer = ThisMap.get_Layer(LayerIndex);
if (!(ThisLayer is ESRI.ArcGIS.Carto.IFeatureLayer))
continue;
if (((ESRI.ArcGIS.Carto.IFeatureLayer)ThisLayer).FeatureClass == null)
continue;
ThisDataset = (ESRI.ArcGIS.Geodatabase.IDataset)
((ESRI.ArcGIS.Carto.IFeatureLayer)ThisLayer).FeatureClass;
if (ThisDataset.Name != m_LYR_GENERATED_TRANSECTS)
continue;
m_Workspace = ThisDataset.Workspace;
m_DatabasePath = ThisDataset.Workspace.PathName;
break;
}
if (string.IsNullOrEmpty(m_DatabasePath))
ErrorMessage = "Could not find the transect layer used to detect the database.";
}