Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add flight path preview when selecting images #1530

Merged
merged 15 commits into from
Jul 29, 2024
Binary file added app/static/app/img/accept.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion app/static/app/js/classes/Basemaps.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default [
{
attribution:
'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',
maxZoom: 21,
maxZoom: 19,
minZoom: 0,
label: _("OpenStreetMap"),
url: "//tile.openstreetmap.org/{z}/{x}/{y}.png"
Expand Down
25 changes: 22 additions & 3 deletions app/static/app/js/components/EditTaskForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ class EditTaskForm extends React.Component {
onFormChanged: PropTypes.func,
inReview: PropTypes.bool,
task: PropTypes.object,
suggestedTaskName: PropTypes.oneOfType([PropTypes.string, PropTypes.func])
suggestedTaskName: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
getCropPolygon: PropTypes.func
};

constructor(props){
Expand Down Expand Up @@ -350,14 +351,32 @@ class EditTaskForm extends React.Component {
// from a processing node)
getAvailableOptionsOnly(options, availableOptions){
const optionNames = {};
let optsCopy = Utils.clone(options);

availableOptions.forEach(opt => optionNames[opt.name] = true);
return options.filter(opt => optionNames[opt.name]);

// Override boundary and crop options (if they are available)
if (this.props.getCropPolygon){
const poly = this.props.getCropPolygon();
if (poly && optionNames['crop'] && optionNames['boundary']){
let cropOpt = optsCopy.find(opt => opt.name === 'crop');
if (!cropOpt) optsCopy.push({name: 'crop', value: "0"});

let boundaryOpt = optsCopy.find(opt => opt.name === 'boundary');
if (!boundaryOpt) optsCopy.push({name: 'boundary', value: JSON.stringify(poly)});
else boundaryOpt.value = JSON.stringify(poly);
}
}

return optsCopy.filter(opt => optionNames[opt.name]);
}

getAvailableOptionsOnlyText(options, availableOptions){
const opts = this.getAvailableOptionsOnly(options, availableOptions);
let res = opts.map(opt => `${opt.name}:${opt.value}`).join(", ");
let res = opts.map(opt => {
if (opt.name === "boundary") return `${opt.name}:geojson`;
else return `${opt.name}:${opt.value}`;
}).join(", ");
if (!res) res = _("Default");
return res;
}
Expand Down
Loading
Loading