当应用程序中有多个图层时,只编辑一个图层

29
0
6小时前
KARIMLABIDI
通过
新贡献者III

你好,

我想知道是否有一种方法来编辑在有n层的应用程序上可见的层上的一个功能?我有3个图层,我把编辑小部件弹出,我想编辑每个图层。我的脚本适用于一层,我不知道当应用程序上有n层时该如何做。

我试着用一个IF函数对层的可见性,但我不工作。

这是我的代码:

view.when(() = >{功能测试(){如果(fl_proj1.visible = true){/ /创建指定的层和一个列表的编辑字段配置编辑器=新编辑器({视图:视图,/ /隐藏控件,因为它不需要为这个特定的工作流visibleElements: {snappingControls:假},容器:document.createElement (" div "), layerInfos:[{层:fl_proj1 formTemplate:{/ /自动formTemplate元素:[/ /自动FieldElement{类型:”字段,字段名:"IDARRET", label: "IDAP",可编辑:false}]}}]});}} //每次点击“编辑功能”动作时执行函数editThis(){//如果编辑器的activeWorkflow为空,使弹出窗口不可见If (! Editor . activeWorkflow) {view.popup.visible = false;//调用编辑器更新功能编辑工作流编辑器。startUpdateWorkflowAtFeatureEdit(view.popup.selectedFeature);view.ui。添加(编辑,“右上的”);} //当编辑器的viewModel状态为“ready”时,从显示中删除编辑器小部件,并重新添加弹出窗口。就绪状态表示显示初始编辑器面板并准备进行编辑。//如果用户退出当前的编辑工作流,编辑器会显示一个面板来选择要更新的功能。 This is not needed in this specific workflow as the feature is already selected from the popup. The "ready" state indicates that this initial editor panel is active and was activated via the "back" button. In this example, we remove the editor from the view and replace it with the popup. reactiveUtils.when( () => editor.viewModel.state === "ready", () => { // Remove the editor and open the popup again view.ui.remove(editor); view.popup.open({ fetchFeatures: true, shouldFocus: true }); } ); } // Event handler that fires each time an action is clicked view.popup.on("trigger-action", (event) => { if (event.action.id === "edit-this") { editThis(); } }); }); // Watch when the popup is visible view.popup.watch("visible", (event) => { // Check the Editor's viewModel state, if it is currently open and editing existing features, disable popups if (editor.viewModel.state === "editing-existing-feature") { view.popup.close(); } else { // Grab the features of the popup features = view.popup.features; } }); featureLayer.on("apply-edits", () => { // Once edits are applied to the layer, remove the Editor from the UI view.ui.remove(editor); // Iterate through the features features.forEach((feature) => { // Reset the template for the feature if it was edited feature.popupTemplate = template; }); // Open the popup again and reset its content after updates were made on the feature if (features) { view.popup.open({ features: features }); } // Cancel the workflow so that once edits are applied, a new popup can be displayed editor.viewModel.cancelWorkflow(); });

这里是一个捕捉一个小部件和3层的可见性。

karimlabidi_0 - 1672064296732. - png

我不知道是否安全!

谢谢你的帮助。

标签(5)
0荣誉
0回答