这听起来可能有点傻,但我正尝试在EditableGeoJsonLayer的模式属性下使用ModifyMode,但是可调句柄并没有出现,正如在nebula.gl网站上发布的"Geojson编辑器“示例中所假设的那样。如果有更多关于editableGeojsonLayer应用编程接口参考的例子,那就太方便了。这就是我想要做的:
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模式都不能正常工作,但所有绘图模式和视图模式都工作正常
发布于 2021-11-08 12:53:12
您应该确保选择了该功能,事实上,首先要确保它可以被选择。
发布于 2021-11-20 14:21:31
在使用ModifyMode时,请确保具有selectionLayer。必须先选择多边形,然后才能修改它。当多边形/线被选中时,你应该会看到角点和新的点添加,块拖放。
selectedFeatureIndexes应为选定多边形ids的数组。您可以利用pickingInfos参数在selectionLayer onSelect中设置此数组。
这是一个示例selectionLayer
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,
});https://stackoverflow.com/questions/68139486
复制相似问题