Skip to content

Commit

Permalink
Merge pull request #2171 from WikiWatershed/mjm/rwd-aoi-shows
Browse files Browse the repository at this point in the history
Keep invalid RWD AoI on map
  • Loading branch information
Matthew McFarland committed Aug 22, 2017
2 parents e860700 + 8f4a1ab commit b2c056f
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions src/mmw/js/src/draw/views.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,12 @@ var DrawWindow = Marionette.LayoutView.extend({

onShow: function() {
var self = this,
resetDrawingState = function() {
self.resetDrawingState();
};
resetRwdDrawingState = function() {
self.resetDrawingState({
clearOnFailure: false
});
},
resetDrawingState = _.bind(self.resetDrawingState, self);

this.selectBoundaryRegion.show(new SelectBoundaryView({
model: this.model,
Expand All @@ -189,24 +192,34 @@ var DrawWindow = Marionette.LayoutView.extend({
this.watershedDelineationRegion.show(
new WatershedDelineationView({
model: this.model,
resetDrawingState: resetDrawingState,
resetDrawingState: resetRwdDrawingState,
rwdTaskModel: this.rwdTaskModel
})
);

this.uploadFileRegion.show(new AoIUploadView({
model: this.model,
resetDrawingState: resetDrawingState,
resetDrawingState: resetDrawingState
}));
},

resetDrawingState: function() {
this.model.clearRwdClickedPoint(App.getLeafletMap());
resetDrawingState: function(options) {
var opts = _.extend({
clearOnFailure: true,
}, options);

this.rwdTaskModel.reset();
this.model.reset();

utils.cancelDrawing(App.getLeafletMap());
clearAoiLayer();

// RWD typically does not clear the AoI generated, even if it
// not possible to move to analyze
if (opts.clearOnFailure) {
clearAoiLayer();
this.model.clearRwdClickedPoint(App.getLeafletMap());
}

clearBoundaryLayer(this.model);
}
});
Expand Down

0 comments on commit b2c056f

Please sign in to comment.