Ignore:
Timestamp:
2020-01-20T21:59:53+01:00 (5 years ago)
Author:
simon04
Message:

see #14921 - WMS: support time={time} for Sentinel-2 imagery

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/AddImageryLayerAction.java

    r15306 r15739  
    1212import java.net.MalformedURLException;
    1313import java.nio.file.InvalidPathException;
     14import java.time.Year;
     15import java.time.ZoneOffset;
    1416import java.util.Collection;
    1517import java.util.Collections;
     
    9597    private static ImageryInfo convertImagery(ImageryInfo info) {
    9698        try {
     99            if (info.getUrl().contains("{time}")) {
     100                final String instant = Year.now().atDay(1).atStartOfDay(ZoneOffset.UTC).toInstant().toString();
     101                final String example = String.join("/", instant, instant);
     102                final String initialSelectionValue = info.getDate() != null ? info.getDate() : example;
     103                final String userDate = JOptionPane.showInputDialog(MainApplication.getMainFrame(),
     104                        tr("Time filter for \"{0}\" such as \"{1}\"", info.getName(), example),
     105                        initialSelectionValue);
     106                if (userDate == null) {
     107                    return null;
     108                }
     109                info.setDate(userDate);
     110                // TODO persist new {time} value (via ImageryLayerInfo.save?)
     111            }
    97112            switch(info.getImageryType()) {
    98113            case WMS_ENDPOINT:
Note: See TracChangeset for help on using the changeset viewer.