Skip To Content

MapLayer.Get (.NET)

このメソッドは、マップ インデックス番号で参照されている指定のマップ レイヤーまたはイメージ レイヤーのマップ レイヤーまたはイメージ レイヤー プロパティを返します。

宣言

public Dictionary<string, object> Esri.ArcGISForAutoCAD.MapLayer.Get(Document doc, int mapLayerId)

パラメーター

タイプ名前説明必須

ドキュメント

doc

操作対象の AutoCAD ドキュメント。

必須

int

mapLayerId

MapLayer.Names を使用して取得できるレイヤーに関連付けられたインデックス整数番号。

必須

リターン

タイプ説明

Dictionary<string, object>

マップ レイヤーまたはイメージ レイヤー プロパティのディクショナリー。 これらのプロパティはサービスによって異なります。 次の表で、ディクショナリーのキーと値について説明します。

ディクショナリーには、次の値などを含めることができます:

キータイプ値の説明

"Allow_Raster_Function"

ブール値

レイヤーがラスター関数をサポートしているかどうか。

"Dynamic"

ブール値

ビューの変更時にマップ レイヤーを更新する方法 (動的の場合は true、オンデマンドで更新の場合は false)。

"DatumTransformations"

IEnumerable<Dictionary<string, object>>

測地基準系変換ステップを含むディクショナリーのコレクション。

"Id"

int

レイヤーに関連付けられたインデックス整数番号。

"IsConnected"

ブール値

レイヤーが接続されているかどうか。

"Name"

string

マップ レイヤーまたはイメージ レイヤーの名前。

"ProcessingTemplate"

string

イメージ レイヤー処理テンプレート名。

"ProcessingTemplateNames"

IEnumerable<string>

使用可能なイメージ レイヤー処理テンプレート名のコレクション。

"SpatialReference"

string

WKID または WKT 文字列としてのレイヤーの空間参照。

"Transparency"

int

マップに適用された画像透過率 (0 ~ 99、0 は不透明)。

"Visible"

ブール値

マップの表示設定 (表示の場合は true、非表示の場合は false)

エラー条件に関する注記

パラメーターが無効な場合、このメソッドは例外をスローするか、null を返すことがあります。

例 1

インデックス 1 のマップ レイヤーのマップ レイヤー プロパティを印刷します。

// Initialize
var doc = Application.DocumentManager.MdiActiveDocument;
var mapLayerId = 1;

// Get the map layer properties 
var mapLayerProperties = Esri.ArcGISForAutoCAD.MapLayer.Get(doc, mapLayerId);

// Print the map layer properties 
foreach (var property in mapLayerProperties)
{
  if (property.Key == "DatumTransformations")
  {
    doc.Editor.WriteMessage("\n{0}: ", property.Key);
    foreach (var value in property.Value as IEnumerable<Dictionary<string, object>>)
    {
      doc.Editor.WriteMessage("\nFrom {0}: To {1}", value["From"], value["To"]);
      doc.Editor.WriteMessage("\nTransformation:");
      foreach (var dict in value["Steps"] as List<Dictionary<string, object>>)
      {
        foreach (var kvp in dict)
        {
          doc.Editor.WriteMessage("\n\t{0}: {1}", kvp.Key, kvp.Value);
        }
      }
    }
    continue;
  }
  doc.Editor.WriteMessage("\n{0}: {1}", property.Key, property.Value);
}

/* Example output 
Id: 1
Name: ThreeLayers
ItemType: MapImageServiceLayer
IsConnected: True
ServiceUri: https://cadserver.esri.com/server/rest/services/afaHarness/ThreeLayers/MapServer
SpatialReference: 3857
Sublayer_0_Name: myGroupOfLayers
Sublayer_0_Visible: True
Sublayer_1_Name: ETH_ThreeLayers_6543
Sublayer_1_Visible: True
Sublayer_1_SourceSpRef: 103122
Sublayer_2_Name: ETH_ThreeLayers_2882
Sublayer_2_Visible: True
Sublayer_2_SourceSpRef: 2882
Sublayer_3_Name: ETH_ThreeLayers_6425
Sublayer_3_Visible: True
Sublayer_3_SourceSpRef: 103002
Visible: True
Transparency: 30
Dynamic: True
DatumTransformations:
From 6543: To 3857
Transformation:  
 Direction: Reverse
 Step: 108354
From 2882: To 3857
Transformation:
 Direction: Forward
 Step: 1901
*/

例 2

インデックス 2 のイメージ レイヤーのイメージ レイヤー プロパティを印刷します。

// Initialize
var doc = Application.DocumentManager.MdiActiveDocument;
var layerId = 2;

// Get the imagery layer properties 
var imageryLayerProperties = Esri.ArcGISForAutoCAD.MapLayer.Get(doc, layerId);

// Print the imagery layer properties 
foreach (var property in imageryLayerProperties)
{
  if (property.Key == "ProcessingTemplateNames")
  {
    doc.Editor.WriteMessage("\n{0}:", property.Key);
    foreach (var value in property.Value as List<string>)
    {
      doc.Editor.WriteMessage(" " + value);
    }
    continue;
  }
  doc.Editor.WriteMessage("\n{0}: {1} ", property.Key, property.Value);
}

/* Example output 
Id: 2
Name: CharlotteLAS
ItemType: RasterServiceLayer
IsConnected: True
ServiceUri: https://sampleserver6.arcgisonline.com/arcgis/rest/services/CharlotteLAS/ImageServer
SpatialReference: 102719
Visible: True
Transparency: 30
Dynamic: True
Allow_Raster_Function: True
ProcessingTemplateNames: None RFTAspectColor RFTHillshade RFTShadedReliefElevationColorRamp
*/

次もご参照ください。

MapLayer.Names - 現在のドローイングに含まれているマップ レイヤー名とイメージ レイヤー名のインデックス付きディクショナリーを返す .NET メソッドです。

esri_maplayer_get - 指定したレイヤー インデックス番号のマップ レイヤーまたはイメージ レイヤー プロパティを返す AutoLISP 関数です。