首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在nebula.gl的editableGeojsonLayer中,通知模式不起作用

在nebula.gl的editableGeojsonLayer中,通知模式不起作用
EN

Stack Overflow用户
提问于 2021-06-26 13:19:02
回答 2查看 58关注 0票数 0

这听起来可能有点傻,但我正尝试在EditableGeoJsonLayer的模式属性下使用ModifyMode,但是可调句柄并没有出现,正如在nebula.gl网站上发布的"Geojson编辑器“示例中所假设的那样。如果有更多关于editableGeojsonLayer应用编程接口参考的例子,那就太方便了。这就是我想要做的:

代码语言:javascript
复制
new (EditableGeoJsonLayer as any)({
            id: 'geojson',
            data: featureState.data,
            mode: ModifyMode,
            selectedFeatureIndexes,
            onEdit: ({updatedData}):any => {
                setFeatureState({ 
                    data: updatedData 
                });
                
            },
            pickable: true,
            pickingRadius: 15,
            //onClick: data => InfoWindow(data.object.properties, data.coordinate, "New Shape", "PointView"),
 }

此外,在进一步测试之后,alter模式都不能正常工作,但所有绘图模式和视图模式都工作正常

EN

回答 2

Stack Overflow用户

发布于 2021-11-08 12:53:12

您应该确保选择了该功能,事实上,首先要确保它可以被选择。

票数 0
EN

Stack Overflow用户

发布于 2021-11-20 14:21:31

在使用ModifyMode时,请确保具有selectionLayer。必须先选择多边形,然后才能修改它。当多边形/线被选中时,你应该会看到角点和新的点添加,块拖放。

selectedFeatureIndexes应为选定多边形ids的数组。您可以利用pickingInfos参数在selectionLayer onSelect中设置此数组。

这是一个示例selectionLayer

代码语言:javascript
复制
const selectionLayer = new SelectionLayer({
  id: "selection",
  selectionType: "rectangle",

  onSelect: ({ pickingInfos }) => {
  
    // use pickingInfos to set the SelectedFeatureIndexes
    setSelectedFeatureIndexes(pickingInfos.map((pi) => pi.index));

    // any other functionality for selecting, like adding id's to state
  },
  layerIds: ["geojson"],

  getTentativeFillColor: () => [255, 0, 255, 100],
  getTentativeLineColor: () => [0, 0, 255, 255],
  lineWidthMinPixels: 3,
});
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68139486

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档