WebFeatureLayer.Set 方法用于更新指定 web 要素图层的属性。
声明
public bool Esri.ArcGISForAutoCAD.WebFeatureLayer.Set(Document doc, string flName, Dictionary<string, object> serviceProperties, string sublayerName = null)
参数
| 类型 | 名称 | 描述 | 必填 |
|---|---|---|---|
文档 | doc | 要进行操作的 AutoCAD 文档。 | 必填 |
string | flName | 工程图中现有的 web 要素图层名称。 | 必填 |
string | serviceProperties | 可设置的可选 web 要素图层属性的字典。 下表描述了各个键和值。 | 必填 |
string | sublayerName | 工程图中现有的要素图层子图层名称。 | 可选 |
serviceProperties 字典的键和值如下:
| 键 | 类型 | 值描述 | 必填 |
|---|---|---|---|
"BRANCH" | string | 受影响编辑分支的名称。 | 可选 |
"EDITMODE" | bool | 指定编辑选项。 true = 编辑,false = 只读。 | 可选 |
"CADLAYER" | string | 将用于覆盖 web 要素图层的默认图层的 AutoCAD 图层名称。 | 可选 |
"DEFINITIONEXPRESSION" | string | WHERE 子句表达式,用于按属性值限制图层中的要素。 WHERE 子句的语法取决于源数据。 设置定义表达式后,可以在 web 要素图层上使用 Discard Edits 或 Synchronize 查看其余要素。 | 可选 |
"TYPE" | string | 默认元素类型。 对于点和多点 web 要素图层,选项为 "Point"、"Block Reference" 和 "AECC_COGO_POINT";对于面 web 要素图层,选项为 "Hatch" 和 "Automatic"。 重新绘制 web 要素图层以查看新设置的默认元素类型。 | 可选 |
"DESCRIPTION" | string | 如果类型为 "Block Reference",则为块名称;如果类型为 "AECC_COGO_POINT",则为描述;如果类型为 "Hatch",则为影线模式。 重新绘制 web 要素图层以查看新设置的默认元素描述。 | 可选 |
"SAVEASTEMPLATE" | bool | 指定是否将相应的 AutoCAD 图层、查询表达式、类型或描述属性保存在 web 要素图层属性模板中,该模板本地存储在工程图中。 true = 另存为模板,false = 不会另存为模板(默认值)。 | 可选 |
"SUBLAYER_FIELD" | string | 用于定义子图层的字段名称。 输入一个空字符串 "",以清除所有子图层,由此将删除现有子图层并将所有要素移至父图层。 在设置子图层字段之前,必须清除子图层。 具有服务定义的子类型字段的图层不支持自定义子图层。 | 可选 |
返回
| 类型 | 描述 |
|---|---|
bool | 如果已成功设置 web 要素图层属性,则为 true |
错误条件备注
如果参数无效,则此方法可能会抛出异常或者返回 false 或 null。 如果任何属性设置失败,则此方法将返回 false。
示例 1
打印将 Damage_to_Commercial_Buildings web 要素图层 editor01.sampleBranch 分支的 web 要素图层编辑属性设置为只读成功。// Initialize
var doc = Application.DocumentManager.MdiActiveDocument;
var flName = "Damage_to_Commercial_Buildings";
var serviceProperties = new Dictionary<string, object>()
{
{ "BRANCH", "editor01.sampleBranch" },
{ "EDITMODE", false }
};
// Set the properties
var success = Esri.ArcGISForAutoCAD.WebFeatureLayer.Set(doc, flName, serviceProperties);
// Print the success
doc.Editor.WriteMessage(success.ToString());
/* Example output
True
*/
示例 2
打印将 Olympia_Meters web 要素图层 Commercial 子类型的默认 AutoCAD 图层设置为 AutoCAD 图层 AB-METERS-EX 并将此属性保存到 web 要素图层模板成功。 // Initialize
var doc = Application.DocumentManager.MdiActiveDocument;
var flName = "Olympia_Meters";
var serviceProperties = new Dictionary<string, object>()
{
{ "CADLAYER", "AB-METERS-EX" },
{ "SAVEASTEMPLATE", true }
};
// Set the properties
var success = Esri.ArcGISForAutoCAD.WebFeatureLayer.Set(doc, flName, serviceProperties, "Commercial");
// Print the success
doc.Editor.WriteMessage(success.ToString());
/* Example output
True
*/
另请参阅
esri_webfeaturelayer_set - 此 AutoLISP 函数用于更新工程图中指定 web 要素图层的属性。