Skip to content

Commit

Permalink
refactor(edition-workspace): feature creation
Browse files Browse the repository at this point in the history
  • Loading branch information
olivierSaintCyr committed Apr 19, 2024
1 parent 3c6a40c commit 8a89c12
Showing 1 changed file with 17 additions and 1 deletion.
Expand Up @@ -121,13 +121,29 @@ export abstract class NewEditionWorkspace extends Workspace {
this.focusEditedFeature(feature);
}

createFeature(feature: EditionFeature) {
createFeature() {
const feature = {
type: 'Feature',
properties: this.initNewFeatureProperties()
};

if (this.edition) {
this.cancelEdit(this.edition.feature);
}
this.editFeature(feature, EditionType.CREATION);
}

private initNewFeatureProperties() {
const { sourceFields } = this.layer.options.sourceOptions;
let properties = {};
sourceFields.forEach((field) => {
if (!field.primary) {
properties[field.name] = '';
}
});
return properties;
}

deleteFeature(feature: EditionFeature) {
const dialogRef = this.dialog.open(ConfirmationPopupComponent, {
disableClose: false,
Expand Down

0 comments on commit 8a89c12

Please sign in to comment.