in modules/layers/src/layers/selection-layer.ts [141:196]
renderLayers() {
const { pendingPolygonSelection } = this.state;
const mode = MODE_MAP[this.props.selectionType] || ViewMode;
const modeConfig = MODE_CONFIG_MAP[this.props.selectionType];
const inheritedProps = {};
PASS_THROUGH_PROPS.forEach((p) => {
if (this.props[p] !== undefined) inheritedProps[p] = this.props[p];
});
const layers: any[] = [
new EditableGeoJsonLayer(
this.getSubLayerProps({
id: LAYER_ID_GEOJSON,
pickable: true,
mode,
modeConfig,
selectedFeatureIndexes: [],
data: EMPTY_DATA,
onEdit: ({ updatedData, editType }) => {
if (editType === 'addFeature') {
const { coordinates } = updatedData.features[0].geometry;
if (this.props.selectionType === SELECTION_TYPE.RECTANGLE) {
this._selectRectangleObjects(coordinates);
} else if (this.props.selectionType === SELECTION_TYPE.POLYGON) {
this._selectPolygonObjects(coordinates);
}
}
},
...inheritedProps,
})
),
];
if (pendingPolygonSelection) {
const { bigPolygon } = pendingPolygonSelection;
layers.push(
new PolygonLayer(
this.getSubLayerProps({
id: LAYER_ID_BLOCKER,
pickable: true,
stroked: false,
opacity: 1.0,
data: [bigPolygon],
getLineColor: (obj) => [0, 0, 0, 1],
getFillColor: (obj) => [0, 0, 0, 1],
getPolygon: (o) => o.geometry.coordinates,
})
)
);
}
return layers;
}