Skip to content

Commit

Permalink
Delete, download annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
pierotofy committed May 28, 2024
1 parent 8feb820 commit 6a9b3e4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app/static/app/js/classes/plugins/Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ export default {
"updateAnnotation",
"deleteAnnotation",
"toggleAnnotation",
"annotationDeleted"
"annotationDeleted",
"downloadAnnotations"
]
};

19 changes: 17 additions & 2 deletions app/static/app/js/components/LayersControlAnnotations.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,21 @@ export default class LayersControlAnnotations extends React.Component {
}
}

handleExportGeoJSON = e => {
if (PluginsAPI.Map.downloadAnnotations("geojson")) return;
else{
// TODO?
}
}

handleDelete = () => {
if (window.confirm(_('Are you sure you want to delete this?'))){
this.props.layers.forEach(layer => {
PluginsAPI.Map.deleteAnnotation(layer);
});
}
}


render(){
const { layers } = this.props;
Expand All @@ -129,8 +144,8 @@ export default class LayersControlAnnotations extends React.Component {
<div className="layer-control-title">
<ExpandButton bind={[this, 'expanded']} /><Checkbox bind={[this, 'visible']} className="annotation-toggle" />
<a title={_("Annotations")} className="layer-label" href="javascript:void(0);" onClick={this.handleAnnotationsClick}><div className="layer-title"><i className="layer-icon fa fa-sticky-note fa-fw"></i> {_("Annotations")}</div></a>
<a className="layer-action" href="javascript:void(0)" onClick={this.handleZoomToClick}><i title={_("Zoom To")} className="fa fa-expand"></i></a>
<a className="layer-action" href="javascript:void(0)" onClick={this.handleZoomToClick}><i title={_("Zoom To")} className="fa fa-expand"></i></a>
<a className="layer-action" href="javascript:void(0)" onClick={this.handleExportGeoJSON}><i title={_("Export to GeoJSON")} className="fa fa-download"></i></a>
<a className="layer-action" href="javascript:void(0)" onClick={this.handleDelete}><i title={_("Delete")} className="fa fa-trash"></i></a>
</div>

<div className={"layer-expanded " + (!this.state.expanded ? "hide" : "")}>
Expand Down

0 comments on commit 6a9b3e4

Please sign in to comment.