Changeset 12816 in josm for trunk


Ignore:
Timestamp:
2017-09-10T13:58:18+02:00 (7 years ago)
Author:
Don-vip
Message:

see #15229 - see #15182 - remove GUI references from I/O subsystem

Location:
trunk/src/org/openstreetmap/josm
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java

    r12813 r12816  
    2121
    2222import org.openstreetmap.josm.Main;
    23 import org.openstreetmap.josm.data.osm.search.SearchParseError;
    2423import org.openstreetmap.josm.data.osm.search.SearchCompiler;
    2524import org.openstreetmap.josm.data.osm.search.SearchCompiler.Match;
     25import org.openstreetmap.josm.data.osm.search.SearchParseError;
    2626import org.openstreetmap.josm.data.osm.visitor.OsmPrimitiveVisitor;
    2727import org.openstreetmap.josm.gui.mappaint.StyleCache;
     
    10901090     * visitor function.
    10911091     * @param visitor The visitor from which the visit() function must be called.
    1092      * @deprecated will be removed along with {@link Visitor}
     1092     * @deprecated will be removed along with {@link org.openstreetmap.josm.data.osm.visitor.Visitor}
    10931093     */
    10941094    @Deprecated
  • trunk/src/org/openstreetmap/josm/gui/download/OverpassDownloadSource.java

    r12733 r12816  
    3535import org.openstreetmap.josm.gui.MainApplication;
    3636import org.openstreetmap.josm.gui.download.DownloadSourceSizingPolicy.AdjustableDownloadSizePolicy;
    37 import org.openstreetmap.josm.gui.preferences.server.OverpassServerPreference;
    3837import org.openstreetmap.josm.gui.util.GuiHelper;
    3938import org.openstreetmap.josm.gui.widgets.JosmTextArea;
     
    6362        task.setZoomAfterDownload(settings.zoomToData());
    6463        Future<?> future = task.download(
    65                 new OverpassDownloadReader(area, OverpassServerPreference.getOverpassServer(), data.getQuery()),
     64                new OverpassDownloadReader(area, OverpassDownloadReader.OVERPASS_SERVER.get(), data.getQuery()),
    6665                settings.asNewLayer(), area, null);
    6766        MainApplication.worker.submit(new PostDownloadHandler(task, future, data.getErrorReporter()));
  • trunk/src/org/openstreetmap/josm/gui/preferences/server/OverpassServerPreference.java

    r10306 r12816  
    55
    66import java.awt.GridBagLayout;
    7 import java.util.Arrays;
    87
    98import javax.swing.BorderFactory;
     
    1312import javax.swing.JPanel;
    1413
    15 import org.openstreetmap.josm.data.preferences.BooleanProperty;
    16 import org.openstreetmap.josm.data.preferences.CollectionProperty;
    17 import org.openstreetmap.josm.data.preferences.StringProperty;
    1814import org.openstreetmap.josm.gui.preferences.PreferenceSetting;
    1915import org.openstreetmap.josm.gui.preferences.PreferenceSettingFactory;
     
    2218import org.openstreetmap.josm.gui.preferences.TabPreferenceSetting;
    2319import org.openstreetmap.josm.gui.widgets.HistoryComboBox;
     20import org.openstreetmap.josm.io.OverpassDownloadReader;
    2421import org.openstreetmap.josm.tools.GBC;
    2522
     
    3027 */
    3128public class OverpassServerPreference implements SubPreferenceSetting {
    32 
    33     private static final StringProperty OVERPASS_SERVER = new StringProperty("download.overpass.server",
    34             "https://overpass-api.de/api/");
    35     private static final CollectionProperty OVERPASS_SERVER_HISTORY = new CollectionProperty("download.overpass.servers",
    36             Arrays.asList("https://overpass-api.de/api/", "http://overpass.osm.rambler.ru/cgi/"));
    37     private static final BooleanProperty FOR_MULTI_FETCH = new BooleanProperty("download.overpass.for-multi-fetch", false);
    3829
    3930    private final HistoryComboBox overpassServer = new HistoryComboBox();
     
    6253        panel.add(new JLabel(tr("Overpass server: ")), GBC.std().insets(5, 5, 5, 5));
    6354        panel.add(overpassServer, GBC.eop().fill(GBC.HORIZONTAL));
    64         overpassServer.setPossibleItems(OVERPASS_SERVER_HISTORY.get());
    65         overpassServer.setText(OVERPASS_SERVER.get());
     55        overpassServer.setPossibleItems(OverpassDownloadReader.OVERPASS_SERVER_HISTORY.get());
     56        overpassServer.setText(OverpassDownloadReader.OVERPASS_SERVER.get());
    6657
    6758        panel.add(forMultiFetch, GBC.eop());
    68         forMultiFetch.setSelected(useForMultiFetch());
     59        forMultiFetch.setSelected(OverpassDownloadReader.FOR_MULTI_FETCH.get());
    6960
    7061        panel.add(Box.createVerticalGlue(), GBC.eol().fill());
     
    7566    @Override
    7667    public boolean ok() {
    77         OVERPASS_SERVER.put(overpassServer.getText());
    78         OVERPASS_SERVER_HISTORY.put(overpassServer.getHistory());
    79         FOR_MULTI_FETCH.put(forMultiFetch.isSelected());
     68        OverpassDownloadReader.OVERPASS_SERVER.put(overpassServer.getText());
     69        OverpassDownloadReader.OVERPASS_SERVER_HISTORY.put(overpassServer.getHistory());
     70        OverpassDownloadReader.FOR_MULTI_FETCH.put(forMultiFetch.isSelected());
    8071        return false;
    8172    }
     
    8980     * Returns the URL of the currently selected Overpass server.
    9081     * @return the URL of the currently selected Overpass server.
     82     * @deprecated To be removed end of 2017. Use {@code OverpassDownloadReader.OVERPASS_SERVER.get()} instead
    9183     */
     84    @Deprecated
    9285    public static String getOverpassServer() {
    93         return OVERPASS_SERVER.get();
     86        return OverpassDownloadReader.OVERPASS_SERVER.get();
    9487    }
    9588
     
    9790     * Returns true if objects should be fetched from an Overpass server instead of the OSM API.
    9891     * @return true if objects should be fetched from an Overpass server instead of the OSM API.
     92     * @deprecated To be removed end of 2017. Use {@code OverpassDownloadReader.FOR_MULTI_FETCH.get()} instead
    9993     */
     94    @Deprecated
    10095    public static boolean useForMultiFetch() {
    101         return FOR_MULTI_FETCH.get();
     96        return OverpassDownloadReader.FOR_MULTI_FETCH.get();
    10297    }
    10398}
  • trunk/src/org/openstreetmap/josm/io/GeoJSONWriter.java

    r12809 r12816  
    3030import org.openstreetmap.josm.data.osm.visitor.OsmPrimitiveVisitor;
    3131import org.openstreetmap.josm.data.projection.Projection;
     32import org.openstreetmap.josm.data.projection.Projections;
    3233import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    3334import org.openstreetmap.josm.gui.mappaint.ElemStyles;
    34 import org.openstreetmap.josm.gui.preferences.projection.ProjectionPreference;
    3535import org.openstreetmap.josm.tools.Logging;
    3636import org.openstreetmap.josm.tools.Pair;
     
    6565    public GeoJSONWriter(DataSet ds) {
    6666        this.data = ds;
    67         this.projection = ProjectionPreference.wgs84.getProjection();
     67        this.projection = Projections.getProjectionByCode("EPSG:4326"); // WGS 84
    6868    }
    6969
  • trunk/src/org/openstreetmap/josm/io/MultiFetchOverpassObjectReader.java

    r10689 r12816  
    66
    77import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
    8 import org.openstreetmap.josm.gui.preferences.server.OverpassServerPreference;
    98import org.openstreetmap.josm.tools.Utils;
    109
     
    2524    @Override
    2625    protected String getBaseUrl() {
    27         return OverpassServerPreference.getOverpassServer();
     26        return OverpassDownloadReader.OVERPASS_SERVER.get();
    2827    }
    2928
  • trunk/src/org/openstreetmap/josm/io/MultiFetchServerObjectReader.java

    r12620 r12816  
    3535import org.openstreetmap.josm.data.osm.SimplePrimitiveId;
    3636import org.openstreetmap.josm.data.osm.Way;
    37 import org.openstreetmap.josm.gui.preferences.server.OverpassServerPreference;
    3837import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
    3938import org.openstreetmap.josm.gui.progress.ProgressMonitor;
     
    8786    /**
    8887     * Creates a new instance of {@link MultiFetchServerObjectReader} or {@link MultiFetchOverpassObjectReader}
    89      * depending on the {@link OverpassServerPreference#useForMultiFetch preference}.
     88     * depending on the {@link OverpassDownloadReader#FOR_MULTI_FETCH preference}.
    9089     *
    9190     * @return a new instance
     
    9392     */
    9493    public static MultiFetchServerObjectReader create() {
    95         return create(OverpassServerPreference.useForMultiFetch());
     94        return create(OverpassDownloadReader.FOR_MULTI_FETCH.get());
    9695    }
    9796
  • trunk/src/org/openstreetmap/josm/io/OverpassDownloadReader.java

    r12714 r12816  
    1111import java.time.Period;
    1212import java.time.ZoneOffset;
     13import java.util.Arrays;
    1314import java.util.EnumMap;
    1415import java.util.Locale;
     
    3132import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
    3233import org.openstreetmap.josm.data.osm.PrimitiveId;
     34import org.openstreetmap.josm.data.preferences.BooleanProperty;
     35import org.openstreetmap.josm.data.preferences.CollectionProperty;
     36import org.openstreetmap.josm.data.preferences.StringProperty;
    3337import org.openstreetmap.josm.gui.progress.ProgressMonitor;
    3438import org.openstreetmap.josm.io.NameFinder.SearchResult;
     
    4448 */
    4549public class OverpassDownloadReader extends BoundingBoxDownloader {
     50
     51    /**
     52     * Property for current Overpass server.
     53     * @since 12816
     54     */
     55    public static final StringProperty OVERPASS_SERVER = new StringProperty("download.overpass.server",
     56            "https://overpass-api.de/api/");
     57    /**
     58     * Property for list of known Overpass servers.
     59     * @since 12816
     60     */
     61    public static final CollectionProperty OVERPASS_SERVER_HISTORY = new CollectionProperty("download.overpass.servers",
     62            Arrays.asList("https://overpass-api.de/api/", "http://overpass.osm.rambler.ru/cgi/"));
     63    /**
     64     * Property to determine if Overpass API should be used for multi-fetch download.
     65     * @since 12816
     66     */
     67    public static final BooleanProperty FOR_MULTI_FETCH = new BooleanProperty("download.overpass.for-multi-fetch", false);
    4668
    4769    private static final String DATA_PREFIX = "?data=";
Note: See TracChangeset for help on using the changeset viewer.