MapLayer.Names 方法将返回当前工程图中包含的地图和影像图层名称的索引字典。 键是用于标识图层的索引编号,索引值是字符串形式的图层名称。 索引编号用于在其他方法(例如 MapLayer.Get)中标识地图或影像图层。
声明
public Dictionary<int, string> Esri.ArcGISForAutoCAD.MapLayer.Names(Document doc)
参数
| 类型 | 名称 | 描述 | 必填 |
|---|---|---|---|
文档 | doc | 要进行操作的 AutoCAD 文档。 | 必填 |
返回
| 类型 | 描述 |
|---|---|
Dictionary<int, string> | 地图和影像图层名称的索引字典。 Key:索引编号,Value:图层名称。 |
错误条件备注
如果参数无效,则此方法可能会抛出异常或者返回 null。
示例
打印工程图中地图和影像图层的索引编号和名称。// Initialize
var doc = Application.DocumentManager.MdiActiveDocument;
// Get the index numbers and names
var names = Esri.ArcGISForAutoCAD.MapLayer.Names(doc);
// Print the index numbers and names
foreach (var name in names)
{
doc.Editor.WriteMessage("\nIndex: {0}, Name: {1}", name.Key, name.Value);
}
/* Example output
Index: 1, Name: SST
Index: 2, Name: Seafloor Dissolved Oxygen
Index: 3, Name: World Street Map
Index: 4, Name: World Light Gray Base
*/
另请参阅
MapLayer.Get - 此 .NET 方法用于返回由地图索引编号引用的指定地图或影像图层的地图或影像图层属性。