- Timestamp:
- 2014-08-15T18:53:18+02:00 (10 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 22 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r7358 r7402 77 77 import org.openstreetmap.josm.gui.io.SaveLayersDialog; 78 78 import org.openstreetmap.josm.gui.layer.Layer; 79 import org.openstreetmap.josm.gui.layer. ModifiableLayer;79 import org.openstreetmap.josm.gui.layer.AbstractModifiableLayer; 80 80 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 81 81 import org.openstreetmap.josm.gui.layer.OsmDataLayer.CommandQueueListener; … … 891 891 892 892 /** 893 * Asks user to perform "save layer" operations (save on disk and/or upload data to server) for all {@link ModifiableLayer} before JOSM exits.893 * Asks user to perform "save layer" operations (save on disk and/or upload data to server) for all {@link AbstractModifiableLayer} before JOSM exits. 894 894 * @return {@code true} if there was nothing to save, or if the user wants to proceed to save operations. {@code false} if the user cancels. 895 895 * @since 2025 … … 897 897 public static boolean saveUnsavedModifications() { 898 898 if (!isDisplayingMapView()) return true; 899 return saveUnsavedModifications(map.mapView.getLayersOfType( ModifiableLayer.class), true);899 return saveUnsavedModifications(map.mapView.getLayersOfType(AbstractModifiableLayer.class), true); 900 900 } 901 901 … … 903 903 * Asks user to perform "save layer" operations (save on disk and/or upload data to server) before data layers deletion. 904 904 * 905 * @param selectedLayers The layers to check. Only instances of {@link ModifiableLayer} are considered.905 * @param selectedLayers The layers to check. Only instances of {@link AbstractModifiableLayer} are considered. 906 906 * @param exit {@code true} if JOSM is exiting, {@code false} otherwise. 907 907 * @return {@code true} if there was nothing to save, or if the user wants to proceed to save operations. {@code false} if the user cancels. … … 910 910 public static boolean saveUnsavedModifications(Iterable<? extends Layer> selectedLayers, boolean exit) { 911 911 SaveLayersDialog dialog = new SaveLayersDialog(parent); 912 List< ModifiableLayer> layersWithUnmodifiedChanges = new ArrayList<>();912 List<AbstractModifiableLayer> layersWithUnmodifiedChanges = new ArrayList<>(); 913 913 for (Layer l: selectedLayers) { 914 if (!(l instanceof ModifiableLayer)) {914 if (!(l instanceof AbstractModifiableLayer)) { 915 915 continue; 916 916 } 917 ModifiableLayer odl = (ModifiableLayer)l;917 AbstractModifiableLayer odl = (AbstractModifiableLayer)l; 918 918 if ((odl.requiresSaveToFile() || (odl.requiresUploadToServer() && !odl.isUploadDiscouraged())) && odl.isModified()) { 919 919 layersWithUnmodifiedChanges.add(odl); -
trunk/src/org/openstreetmap/josm/actions/UploadAction.java
r7358 r7402 27 27 import org.openstreetmap.josm.gui.io.UploadDialog; 28 28 import org.openstreetmap.josm.gui.io.UploadPrimitivesTask; 29 import org.openstreetmap.josm.gui.layer. ModifiableLayer;29 import org.openstreetmap.josm.gui.layer.AbstractModifiableLayer; 30 30 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 31 31 import org.openstreetmap.josm.gui.util.GuiHelper; … … 143 143 } 144 144 145 public static boolean checkPreUploadConditions( ModifiableLayer layer) {145 public static boolean checkPreUploadConditions(AbstractModifiableLayer layer) { 146 146 return checkPreUploadConditions(layer, 147 147 layer instanceof OsmDataLayer ? new APIDataSet(((OsmDataLayer)layer).data) : null); … … 164 164 * want to continue 165 165 */ 166 public static boolean warnUploadDiscouraged( ModifiableLayer layer) {166 public static boolean warnUploadDiscouraged(AbstractModifiableLayer layer) { 167 167 return GuiHelper.warnUser(tr("Upload discouraged"), 168 168 "<html>" + … … 184 184 * @return true, if the preconditions are met; false, otherwise 185 185 */ 186 public static boolean checkPreUploadConditions( ModifiableLayer layer, APIDataSet apiData) {186 public static boolean checkPreUploadConditions(AbstractModifiableLayer layer, APIDataSet apiData) { 187 187 if (layer.isUploadDiscouraged()) { 188 188 if (warnUploadDiscouraged(layer)) { -
trunk/src/org/openstreetmap/josm/data/osm/MultipolygonBuilder.java
r7395 r7402 59 59 List<Node> nodes = new ArrayList<>(); 60 60 61 for (int waypos = 0; waypos < this.ways.size(); waypos ++) {61 for (int waypos = 0; waypos < this.ways.size(); waypos ++) { 62 62 Way way = this.ways.get(waypos); 63 63 boolean reversed = this.reversed.get(waypos).booleanValue(); … … 67 67 nodes.add(way.getNode(pos)); 68 68 } 69 } 70 else { 69 } else { 71 70 for (int pos = way.getNodesCount() - 1; pos > 0; pos--) { 72 71 nodes.add(way.getNode(pos)); … … 88 87 public List<JoinedPolygon> innerWays; 89 88 90 public PolygonLevel(JoinedPolygon _pol, int _level) {91 this.outerWay = _pol;92 this.level = _level;89 public PolygonLevel(JoinedPolygon pol, int level) { 90 this.outerWay = pol; 91 this.level = level; 93 92 this.innerWays = new ArrayList<>(); 94 93 } … … 161 160 Set<Way> usedWays = new HashSet<>(); 162 161 163 for (Way w: ways) {162 for (Way w: ways) { 164 163 if (w.getNodesCount() < 2) { 165 164 throw new JoinedPolygonCreationException(tr("Cannot add a way with only {0} nodes.", w.getNodesCount())); … … 171 170 joinedWays.add(jw); 172 171 usedWays.add(w); 173 } 174 else { 172 } else { 175 173 nodesWithConnectedWays.put(w.lastNode(), w); 176 174 nodesWithConnectedWays.put(w.firstNode(), w); … … 249 247 if (pol.level % 2 == 0) { 250 248 this.outerWays.add(pol.outerWay); 251 } 252 else { 249 } else { 253 250 this.innerWays.add(pol.outerWay); 254 251 } -
trunk/src/org/openstreetmap/josm/data/projection/Ellipsoid.java
r6987 r7402 11 11 12 12 /** 13 * the reference ellipsoids13 * Reference ellipsoids. 14 14 */ 15 15 public final class Ellipsoid { 16 16 17 /** 17 18 * Clarke 1880 IGN (French national geographic institute) 18 19 */ 19 20 public static final Ellipsoid clarkeIGN = Ellipsoid.create_a_b(6378249.2, 6356515.0); 20 /** 21 * Hayford's ellipsoid 1909 (ED50 system) 21 22 /** 23 * Hayford's ellipsoid 1909 (ED50 system)<br> 22 24 * Proj.4 code: intl 23 25 */ 24 26 public static final Ellipsoid hayford = Ellipsoid.create_a_rf(6378388.0, 297.0); 27 25 28 /** 26 29 * GRS67 ellipsoid 27 30 */ 28 31 public static final Ellipsoid GRS67 = Ellipsoid.create_a_rf(6378160.0, 298.247167472); 32 29 33 /** 30 34 * GRS80 ellipsoid … … 46 50 */ 47 51 public final double a; 52 48 53 /** 49 54 * half short axis 50 55 */ 51 56 public final double b; 57 52 58 /** 53 59 * first eccentricity 54 60 */ 55 61 public final double e; 62 56 63 /** 57 64 * first eccentricity squared … … 86 93 * @param a semimajor radius of the ellipsoid axis (in meters) 87 94 * @param b semiminor radius of the ellipsoid axis (in meters) 95 * @return the new ellipsoid 88 96 */ 89 97 public static Ellipsoid create_a_b(double a, double b) { … … 99 107 * @param a semimajor radius of the ellipsoid axis (in meters) 100 108 * @param es first eccentricity squared 109 * @return the new ellipsoid 101 110 */ 102 111 public static Ellipsoid create_a_es(double a, double es) { … … 112 121 * @param a semimajor radius of the ellipsoid axis (in meters) 113 122 * @param f flattening ( = (a - b) / a) 123 * @return the new ellipsoid 114 124 */ 115 125 public static Ellipsoid create_a_f(double a, double f) { … … 126 136 * @param a semimajor radius of the ellipsoid axis (in meters) 127 137 * @param rf inverse flattening 138 * @return the new ellipsoid 128 139 */ 129 140 public static Ellipsoid create_a_rf(double a, double rf) { … … 217 228 } 218 229 219 /* 230 /** 220 231 * Returns geographic latitude of isometric latitude of first eccentricity (e) 232 * and epsilon precision 233 * @return geographic latitude of isometric latitude of first eccentricity (e) 221 234 * and epsilon precision 222 235 */ -
trunk/src/org/openstreetmap/josm/data/projection/datum/Datum.java
r6069 r7402 18 18 19 19 /** 20 * @return the Proj.4 identifier21 * (as reported by cs2cs -ld)20 * Replies the Proj.4 identifier. 21 * @return the Proj.4 identifier (as reported by cs2cs -ld) 22 22 * If no id exists, return null. 23 23 */ -
trunk/src/org/openstreetmap/josm/gui/io/SaveLayerInfo.java
r7358 r7402 4 4 import java.io.File; 5 5 6 import org.openstreetmap.josm.gui.layer. ModifiableLayer;6 import org.openstreetmap.josm.gui.layer.AbstractModifiableLayer; 7 7 import org.openstreetmap.josm.tools.CheckParameterUtil; 8 8 … … 15 15 16 16 /** the modifiable layer */ 17 private ModifiableLayer layer;17 private AbstractModifiableLayer layer; 18 18 private boolean doCheckSaveConditions; 19 19 private boolean doSaveToFile; … … 28 28 * @throws IllegalArgumentException thrown if layer is null 29 29 */ 30 public SaveLayerInfo( ModifiableLayer layer) {30 public SaveLayerInfo(AbstractModifiableLayer layer) { 31 31 CheckParameterUtil.ensureParameterNotNull(layer, "layer"); 32 32 this.layer = layer; … … 42 42 * @return the layer this info objects holds information for 43 43 */ 44 public ModifiableLayer getLayer() {44 public AbstractModifiableLayer getLayer() { 45 45 return layer; 46 46 } -
trunk/src/org/openstreetmap/josm/gui/io/SaveLayerTask.java
r7358 r7402 11 11 12 12 /** 13 * SaveLayerTask saves the data managed by an {@link org.openstreetmap.josm.gui.layer. ModifiableLayer} to the13 * SaveLayerTask saves the data managed by an {@link org.openstreetmap.josm.gui.layer.AbstractModifiableLayer} to the 14 14 * {@link org.openstreetmap.josm.gui.layer.Layer#getAssociatedFile()}. 15 15 * -
trunk/src/org/openstreetmap/josm/gui/io/SaveLayersDialog.java
r7358 r7402 46 46 import org.openstreetmap.josm.gui.ExceptionDialogUtil; 47 47 import org.openstreetmap.josm.gui.io.SaveLayersModel.Mode; 48 import org.openstreetmap.josm.gui.layer. ModifiableLayer;48 import org.openstreetmap.josm.gui.layer.AbstractModifiableLayer; 49 49 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 50 50 import org.openstreetmap.josm.gui.progress.SwingRenderingProgressMonitor; … … 449 449 protected void uploadLayers(List<SaveLayerInfo> toUpload) { 450 450 for (final SaveLayerInfo layerInfo: toUpload) { 451 ModifiableLayer layer = layerInfo.getLayer();451 AbstractModifiableLayer layer = layerInfo.getLayer(); 452 452 if (canceled) { 453 453 model.setUploadState(layer, UploadOrSaveState.CANCELED); -
trunk/src/org/openstreetmap/josm/gui/io/SaveLayersModel.java
r7358 r7402 12 12 import javax.swing.table.DefaultTableModel; 13 13 14 import org.openstreetmap.josm.gui.layer. ModifiableLayer;14 import org.openstreetmap.josm.gui.layer.AbstractModifiableLayer; 15 15 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 16 16 … … 65 65 * @since 7358 66 66 */ 67 public void populate(List<? extends ModifiableLayer> layers) {67 public void populate(List<? extends AbstractModifiableLayer> layers) { 68 68 layerInfo = new ArrayList<>(); 69 69 if (layers == null) return; 70 for ( ModifiableLayer layer: layers) {70 for (AbstractModifiableLayer layer: layers) { 71 71 layerInfo.add(new SaveLayerInfo(layer)); 72 72 } … … 143 143 List<SaveLayerInfo> ret = new ArrayList<>(); 144 144 for (SaveLayerInfo info: layerInfo) { 145 ModifiableLayer l = info.getLayer();145 AbstractModifiableLayer l = info.getLayer(); 146 146 if (info.isDoUploadToServer() && l instanceof OsmDataLayer && !((OsmDataLayer)l).getConflicts().isEmpty()) { 147 147 ret.add(info); … … 171 171 } 172 172 173 public void setUploadState( ModifiableLayer layer, UploadOrSaveState state) {173 public void setUploadState(AbstractModifiableLayer layer, UploadOrSaveState state) { 174 174 SaveLayerInfo info = getSaveLayerInfo(layer); 175 175 if (info != null) { … … 179 179 } 180 180 181 public void setSaveState( ModifiableLayer layer, UploadOrSaveState state) {181 public void setSaveState(AbstractModifiableLayer layer, UploadOrSaveState state) { 182 182 SaveLayerInfo info = getSaveLayerInfo(layer); 183 183 if (info != null) { … … 187 187 } 188 188 189 public SaveLayerInfo getSaveLayerInfo( ModifiableLayer layer) {189 public SaveLayerInfo getSaveLayerInfo(AbstractModifiableLayer layer) { 190 190 for (SaveLayerInfo info: this.layerInfo) { 191 191 if (info.getLayer() == layer) -
trunk/src/org/openstreetmap/josm/gui/layer/AbstractModifiableLayer.java
r7401 r7402 10 10 * @since 7358 11 11 */ 12 public abstract class ModifiableLayer extends Layer {12 public abstract class AbstractModifiableLayer extends Layer { 13 13 14 14 /** … … 16 16 * @param name Layer name 17 17 */ 18 public ModifiableLayer(String name) {18 public AbstractModifiableLayer(String name) { 19 19 super(name); 20 20 } -
trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java
r7320 r7402 263 263 if (t==null) continue; 264 264 long tm = t[1].getTime(); 265 trackVisibility[i]= (tm==0 && showWithoutDate) || (from <=tm && tm <= to);265 trackVisibility[i]= (tm==0 && showWithoutDate) || (from <= tm && tm <= to); 266 266 i++; 267 267 } … … 280 280 lastTracks.addAll(data.tracks); 281 281 282 Li nkedList<WayPoint> visibleSegments = listVisibleSegments(box);283 if (!visibleSegments.isEmpty()) {282 List<WayPoint> visibleSegments = listVisibleSegments(box); 283 if (!visibleSegments.isEmpty()) { 284 284 drawHelper.readPreferences(getName()); 285 285 drawHelper.drawAll(g, mv, visibleSegments); … … 288 288 } 289 289 } 290 291 } 292 293 private LinkedList<WayPoint> listVisibleSegments(Bounds box) { 290 } 291 292 private List<WayPoint> listVisibleSegments(Bounds box) { 294 293 WayPoint last = null; 295 294 LinkedList<WayPoint> visibleSegments = new LinkedList<>(); … … 298 297 for (Collection<WayPoint> segment : data.getLinesIterable(trackVisibility)) { 299 298 300 for(WayPoint pt : segment) 301 { 299 for (WayPoint pt : segment) { 302 300 Bounds b = new Bounds(pt.getCoor()); 303 // last should never be null when this is true! 304 if(pt.drawLine) { 301 if (pt.drawLine && last != null) { 305 302 b.extend(last.getCoor()); 306 303 } 307 if(b.intersects(box)) 308 { 309 if(last != null && (visibleSegments.isEmpty() 304 if (b.intersects(box)) { 305 if (last != null && (visibleSegments.isEmpty() 310 306 || visibleSegments.getLast() != last)) { 311 if (last.drawLine) {307 if (last.drawLine) { 312 308 WayPoint l = new WayPoint(last); 313 309 l.drawLine = false; -
trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
r7358 r7402 96 96 * @author imi 97 97 */ 98 public class OsmDataLayer extends ModifiableLayer implements Listener, SelectionChangedListener {98 public class OsmDataLayer extends AbstractModifiableLayer implements Listener, SelectionChangedListener { 99 99 public static final String REQUIRES_SAVE_TO_DISK_PROP = OsmDataLayer.class.getName() + ".requiresSaveToDisk"; 100 100 public static final String REQUIRES_UPLOAD_TO_SERVER_PROP = OsmDataLayer.class.getName() + ".requiresUploadToServer"; -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java
r7345 r7402 1 1 // License: GPL. See LICENSE file for details. 2 3 2 package org.openstreetmap.josm.gui.layer.gpx; 4 3 … … 22 21 import org.openstreetmap.josm.gui.MapView; 23 22 import org.openstreetmap.josm.tools.ColorScale; 24 25 23 26 24 /** … … 106 104 } 107 105 106 /** 107 * Constructs a new {@code GpxDrawHelper}. 108 * @param gpxData GPX data 109 */ 108 110 public GpxDrawHelper(GpxData gpxData) { 109 111 data = gpxData; 110 112 setupColors(); 113 } 114 115 private static String specName(String layerName) { 116 return "layer " + layerName; 111 117 } 112 118 … … 118 124 */ 119 125 public Color getColor(String layerName, boolean ignoreCustom) { 120 Color c = Main.pref.getColor(marktr("gps point"), "layer " + layerName, Color.gray);126 Color c = Main.pref.getColor(marktr("gps point"), specName(layerName), Color.gray); 121 127 return ignoreCustom || getColorMode(layerName) == ColorMode.NONE ? c : null; 122 128 } … … 129 135 public ColorMode getColorMode(String layerName) { 130 136 try { 131 int i =Main.pref.getInteger("draw.rawgps.colors", "layer " + layerName, 0);137 int i = Main.pref.getInteger("draw.rawgps.colors", specName(layerName), 0); 132 138 return ColorMode.values()[i]; 133 139 } catch (Exception e) { … … 149 155 **/ 150 156 public void readPreferences(String layerName) { 151 String spec = "layer " + layerName;157 String spec = specName(layerName); 152 158 forceLines = Main.pref.getBoolean("draw.rawgps.lines.force", spec, false); 153 159 direction = Main.pref.getBoolean("draw.rawgps.direction", spec, false); … … 198 204 RenderingHints.VALUE_ANTIALIAS_ON : RenderingHints.VALUE_ANTIALIAS_OFF); 199 205 200 if (lineWidth != 0) {201 g.setStroke(new BasicStroke(lineWidth,BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND));206 if (lineWidth != 0) { 207 g.setStroke(new BasicStroke(lineWidth,BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND)); 202 208 } 203 209 fixColors(visibleSegments); … … 205 211 drawArrows(g, mv, visibleSegments); 206 212 drawPoints(g, mv, visibleSegments); 207 if (lineWidth != 0) {213 if (lineWidth != 0) { 208 214 g.setStroke(storedStroke); 209 215 } … … 298 304 299 305 if (colored == ColorMode.HDOP) { 300 Float hdop = ( (Float) trkPnt.attr.get("hdop"));306 Float hdop = (Float) trkPnt.attr.get("hdop"); 301 307 color = hdopScale.getColor(hdop); 302 308 } … … 346 352 } 347 353 348 349 350 354 private void drawLines(Graphics2D g, MapView mv, List<WayPoint> visibleSegments) { 351 355 if (lines) { … … 357 361 } 358 362 Point screen = mv.getPoint(trkPnt.getEastNorth()); 359 if (trkPnt.drawLine) { 360 // skip points that are on the same screenposition 361 if (old != null && ((old.x != screen.x) || (old.y != screen.y))) { 362 g.setColor(trkPnt.customColoring); 363 g.drawLine(old.x, old.y, screen.x, screen.y); 364 } 363 // skip points that are on the same screenposition 364 if (trkPnt.drawLine && old != null && ((old.x != screen.x) || (old.y != screen.y))) { 365 g.setColor(trkPnt.customColoring); 366 g.drawLine(old.x, old.y, screen.x, screen.y); 365 367 } 366 368 old = screen; … … 446 448 if (hdopCircle && trkPnt.attr.get("hdop") != null) { 447 449 // hdop value 448 float hdop = ( (Float)trkPnt.attr.get("hdop"));450 float hdop = (Float)trkPnt.attr.get("hdop"); 449 451 if (hdop < 0) { 450 452 hdop = 0; … … 534 536 public void drawColorBar(Graphics2D g, MapView mv) { 535 537 int w = mv.getWidth(); 536 int h = mv.getHeight();537 538 if (colored == ColorMode.HDOP) { 538 539 hdopScale.drawColorBar(g, w-30, 50, 20, 100, 1.0); … … 543 544 } 544 545 } 545 546 546 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java
r7383 r7402 42 42 */ 43 43 public void clearCached() { 44 // run in EDT to make sure this isn't called during rendering run 44 // run in EDT to make sure this isn't called during rendering run 45 45 // {@link org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer#render} 46 46 GuiHelper.runInEDT(new Runnable() { … … 335 335 } 336 336 env.layer = e.getKey(); 337 Cascade c = e.getValue();338 337 if (osm instanceof Way) { 339 338 addIfNotNull(sl, AreaElemStyle.create(env)); -
trunk/src/org/openstreetmap/josm/gui/mappaint/TextElement.java
r7383 r7402 16 16 /** 17 17 * Represents the rendering style for a textual label placed somewhere on the map. 18 * 18 * @since 3880 19 19 */ 20 20 public class TextElement implements StyleKeys { … … 73 73 74 74 /** 75 * Derives a suitable label composition strategy from the style properties in 76 * {@code c}. 75 * Derives a suitable label composition strategy from the style properties in {@code c}. 77 76 * 78 77 * @param c the style properties … … 108 107 * default text color {@code defaultTextColor} 109 108 * 110 * @param c the style properties109 * @param env the environment 111 110 * @param defaultTextColor the default text color. Must not be null. 112 111 * @param defaultAnnotate true, if a text label shall be rendered by default, even if the style sheet -
trunk/src/org/openstreetmap/josm/gui/preferences/display/ColorPreference.java
r7319 r7402 38 38 import org.openstreetmap.josm.gui.conflict.ConflictColors; 39 39 import org.openstreetmap.josm.gui.dialogs.ConflictDialog; 40 import org.openstreetmap.josm.gui.layer.gpx.GpxDrawHelper;41 import org.openstreetmap.josm.gui.layer.GpxLayer;42 40 import org.openstreetmap.josm.gui.layer.ImageryLayer; 43 41 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 42 import org.openstreetmap.josm.gui.layer.gpx.GpxDrawHelper; 44 43 import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer; 45 44 import org.openstreetmap.josm.gui.preferences.PreferenceSetting; -
trunk/src/org/openstreetmap/josm/gui/preferences/map/MapPaintPreference.java
r7333 r7402 43 43 44 44 private static final List<SourceProvider> styleSourceProviders = new ArrayList<>(); 45 46 private static final String OLD_ELEMSTYLES_XML = "resource://styles/standard/elemstyles.xml"; 45 47 46 48 /** … … 250 252 } 251 253 // XML style is not bundled anymore 252 knownDefaults.remove( "resource://styles/standard/elemstyles.xml");254 knownDefaults.remove(OLD_ELEMSTYLES_XML); 253 255 Main.pref.putCollection("mappaint.style.known-defaults", knownDefaults); 254 256 … … 261 263 @Override 262 264 public boolean evaluate(SourceEntry se) { 263 return "resource://styles/standard/elemstyles.xml".equals(se.url);265 return OLD_ELEMSTYLES_XML.equals(se.url); 264 266 } 265 267 }); -
trunk/src/org/openstreetmap/josm/io/remotecontrol/DNSName.java
r7347 r7402 102 102 */ 103 103 public int getType() { 104 return (GeneralNameInterface.NAME_DNS);104 return GeneralNameInterface.NAME_DNS; 105 105 } 106 106 … … 128 128 @Override 129 129 public String toString() { 130 return ("DNSName: " + name);130 return "DNSName: " + name; 131 131 } 132 132 … … 192 192 * not supported for this name type. 193 193 */ 194 public int constrains(GeneralNameInterface inputName) throws UnsupportedOperationException { 194 @Override 195 public int constrains(GeneralNameInterface inputName) { 195 196 int constraintType; 196 197 if (inputName == null) … … 231 232 * @throws UnsupportedOperationException if not supported for this name type 232 233 */ 233 public int subtreeDepth() throws UnsupportedOperationException { 234 @Override 235 public int subtreeDepth() { 234 236 String subtree=name; 235 237 int i=1; -
trunk/src/org/openstreetmap/josm/io/remotecontrol/RemoteControlHttpsServer.java
r7347 r7402 136 136 X509CertInfo info = new X509CertInfo(); 137 137 Date from = new Date(); 138 Date to = new Date(from.getTime() + days * 86400000 l);138 Date to = new Date(from.getTime() + days * 86400000L); 139 139 CertificateValidity interval = new CertificateValidity(from, to); 140 140 BigInteger sn = new BigInteger(64, new SecureRandom()); -
trunk/src/org/openstreetmap/josm/tools/ColorScale.java
r7319 r7402 1 1 // License: GPL. For details, see LICENSE file. 2 3 2 package org.openstreetmap.josm.tools; 4 3 … … 8 7 9 8 /** 10 * Utility class that helps to work with color scale 11 * for coloring GPX tracks etc. 9 * Utility class that helps to work with color scale for coloring GPX tracks etc. 12 10 * @since 7319 13 11 */ … … 17 15 private Color belowMinColor; 18 16 private Color aboveMaxColor; 19 17 20 18 private Color[] colors; 21 19 private String title = ""; 22 20 private int intervalCount = 5; 23 21 24 22 private ColorScale() { 25 23 26 24 } 27 25 28 26 public static ColorScale createHSBScale(int count) { 29 27 ColorScale sc = new ColorScale(); … … 36 34 return sc; 37 35 } 38 36 39 37 public static ColorScale createCyclicScale(int count) { 40 38 ColorScale sc = new ColorScale(); … … 46 44 sc.colors = new Color[count]; 47 45 for (int i = 0; i < sc.colors.length; i++) { 48 46 49 47 float angle = 4 - i / 256f * 4; 50 48 int quadrant = (int) angle; … … 62 60 return sc; 63 61 } 64 62 65 63 /** 66 64 * transition function: … … 80 78 this.max = max; 81 79 } 82 80 83 81 /** 84 82 * Add standard colors for values below min or above max value … … 88 86 belowMinColor = colors[0]; 89 87 } 90 88 91 89 public final Color getColor(double value) { 92 90 if (value<min) return belowMinColor; … … 100 98 return colors[n-1]; // this happens when value==max 101 99 } 102 // int hdoplvl =(int) Math.round(colorModeDynamic ? ((hdop-minval)*255/(maxval-minval))103 // : (hdop <= 0 ? 0 : hdop * hdopfactor));104 // int hdopcolor = 255 - (hdoplvl > 255 ? 255 : hdoplvl);105 100 } 106 101 107 102 public final Color getColor(Number value) { 108 103 return (value==null)? noDataColor : getColor(value.doubleValue()); … … 110 105 111 106 public Color getNoDataColor() { 112 113 107 return noDataColor; 114 108 } … … 117 111 this.noDataColor = noDataColor; 118 112 } 119 113 120 114 public ColorScale makeTransparent(int alpha) { 121 115 for (int i = 0; i < colors.length; i++) { … … 124 118 return this; 125 119 } 126 120 127 121 public ColorScale addTitle(String title) { 128 122 this.title = title; 129 123 return this; 130 124 } 131 125 132 126 public ColorScale setIntervalCount(int intervalCount) { 133 127 this.intervalCount = intervalCount; 134 128 return this; 135 129 } 136 130 137 131 public ColorScale makeReversed() { 138 132 int n = colors.length; … … 148 142 return this; 149 143 } 150 144 151 145 public void drawColorBar(Graphics2D g, int x, int y, int w, int h, double valueScale) { 152 146 int n=colors.length; 153 147 154 148 for (int i=0; i<n; i++) { 155 149 g.setColor(colors[i]); … … 160 154 } 161 155 } 162 156 163 157 int fw, fh; 164 FontMetrics fm = g.getFontMetrics(); 158 FontMetrics fm = g.getFontMetrics(); 165 159 fh = fm.getHeight()/2; 166 160 fw = fm.stringWidth(String.valueOf(Math.max((int)Math.abs(max*valueScale), (int)Math.abs(min*valueScale)))) + fm.stringWidth("0.123"); -
trunk/src/org/openstreetmap/josm/tools/FontsManager.java
r7383 r7402 9 9 import java.util.Arrays; 10 10 import java.util.Collection; 11 import java.util.Map; 11 12 12 import org.openstreetmap.josm.io.CachedFile; 13 13 14 /** 15 * Custom fonts manager that provides some embedded fonts to ensure 16 * a common rendering on different platforms. 17 * @since 7383 18 */ 14 19 public class FontsManager { 15 20 16 public static Map<String, Font> fonts; 17 public static Collection<String> includedFonts = Arrays.asList( 21 /** 22 * List of fonts embedded into JOSM jar. 23 */ 24 public static final Collection<String> INCLUDED_FONTS = Arrays.asList( 18 25 "DroidSans.ttf", 19 26 "DroidSans-Bold.ttf" 20 27 ); 21 28 29 private FontsManager() { 30 // Hide constructor for utility classes 31 } 32 33 /** 34 * Initializes the fonts manager. 35 */ 22 36 public static void initialize() { 23 37 GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); 24 for (String fontFile : includedFonts) {38 for (String fontFile : INCLUDED_FONTS) { 25 39 String url = "resource://data/fonts/"+fontFile; 26 try (InputStream i = new CachedFile(url).getInputStream()) 27 { 40 try (InputStream i = new CachedFile(url).getInputStream()) { 28 41 Font f = Font.createFont(Font.TRUETYPE_FONT, i); 29 42 if (f == null) { -
trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
r7313 r7402 93 93 /** 94 94 * Position of an overlay icon 95 * @author imi96 95 */ 97 96 public static enum OverlayPosition { … … 1277 1276 Node item = list.item(0); 1278 1277 if (item instanceof Element) { 1279 String value = ((Element)item).getAttribute("value"); 1280 String[] s = value.split(" "); 1278 String[] s = ((Element)item).getAttribute("value").split(" "); 1281 1279 if (s.length == 3) { 1282 int[] rgb = new int[3]; 1283 try { 1284 for (int i = 0; i<3; i++) { 1285 rgb[i] = Integer.parseInt(s[i]); 1286 } 1287 return new Color(rgb[0], rgb[1], rgb[2]); 1288 } catch (IllegalArgumentException e) { 1289 Main.error(e); 1290 } 1280 return parseRGB(s); 1291 1281 } 1292 }1282 } 1293 1283 } 1294 1284 } … … 1303 1293 } 1304 1294 return null; 1295 } 1296 1297 private static Color parseRGB(String[] s) { 1298 int[] rgb = new int[3]; 1299 try { 1300 for (int i = 0; i<3; i++) { 1301 rgb[i] = Integer.parseInt(s[i]); 1302 } 1303 return new Color(rgb[0], rgb[1], rgb[2]); 1304 } catch (IllegalArgumentException e) { 1305 Main.error(e); 1306 return null; 1307 } 1305 1308 } 1306 1309 -
trunk/src/org/openstreetmap/josm/tools/PlatformHookWindows.java
r7344 r7402 56 56 57 57 private static final byte[] INSECURE_PUBLIC_KEY = new byte[] { 58 0x30, (byte) 0x82, 0x1, 0x22, 0x30, 0xd, 0x6, 0x9, 0x2a, (byte) 0x86, 0x48, (byte) 0x86, (byte) 0xf7, 0xd, 0x1, 0x1, 0x1, 0x5, 0x0, 0x3, (byte) 0x82, 0x1, 0xf, 0x0, 58 0x30, (byte) 0x82, 0x1, 0x22, 0x30, 0xd, 0x6, 0x9, 0x2a, (byte) 0x86, 0x48, 59 (byte) 0x86, (byte) 0xf7, 0xd, 0x1, 0x1, 0x1, 0x5, 0x0, 0x3, (byte) 0x82, 0x1, 0xf, 0x0, 59 60 0x30, (byte) 0x82, 0x01, 0x0a, 0x02, (byte) 0x82, 0x01, 0x01, 0x00, (byte) 0x95, (byte) 0x95, (byte) 0x88, 60 (byte) 0x84, (byte) 0xc8, (byte) 0xd9, 0x6b, (byte) 0xc5, (byte) 0xda, 0x0b, 0x69, (byte) 0xbf, (byte) 0xfc, 0x7e, (byte) 0xb9, (byte) 0x96, 0x2c, (byte) 0xeb, (byte) 0x8f, 61 (byte) 0xbc, 0x6e, 0x40, (byte) 0xe6, (byte) 0xe2, (byte) 0xfc, (byte) 0xf1, 0x7f, 0x73, (byte) 0xa7, (byte) 0x9d, (byte) 0xde, (byte) 0xc7, (byte) 0x88, 62 0x57, 0x51, (byte) 0x84, (byte) 0xed, (byte) 0x96, (byte) 0xfb, (byte) 0xe1, 0x38, (byte) 0xef, 0x08, 0x2b, (byte) 0xf3, (byte) 0xc7, (byte) 0xc3, 63 0x5d, (byte) 0xfe, (byte) 0xf9, 0x51, (byte) 0xe6, 0x29, (byte) 0xfc, (byte) 0xe5, 0x0d, (byte) 0xa1, 0x0d, (byte) 0xa8, (byte) 0xb4, (byte) 0xae, 64 0x26, 0x18, 0x19, 0x4d, 0x6c, 0x0c, 0x3b, 0x12, (byte) 0xba, (byte) 0xbc, 0x5f, 0x32, (byte) 0xb3, (byte) 0xbe, 65 (byte) 0x9d, 0x17, 0x0d, 0x4d, 0x2f, 0x1a, 0x48, (byte) 0xb7, (byte) 0xac, (byte) 0xf7, 0x1a, 0x43, 0x01, (byte) 0x97, 66 (byte) 0xf4, (byte) 0xf8, 0x4c, (byte) 0xbb, 0x6a, (byte) 0xbc, 0x33, (byte) 0xe1, 0x73, 0x1e, (byte) 0x86, (byte) 0xfb, 0x2e, (byte) 0xb1, 67 0x63, 0x75, (byte) 0x85, (byte) 0xdc, (byte) 0x82, 0x6c, 0x28, (byte) 0xf1, (byte) 0xe3, (byte) 0x90, 0x63, (byte) 0x9d, 0x3d, 0x48, 68 (byte) 0x8a, (byte) 0x8c, 0x47, (byte) 0xe2, 0x10, 0x0b, (byte) 0xef, (byte) 0x91, (byte) 0x94, (byte) 0xb0, 0x6c, 0x4c, (byte) 0x80, 0x76, 69 0x03, (byte) 0xe1, (byte) 0xb6, (byte) 0x90, (byte) 0x87, (byte) 0xd9, (byte) 0xae, (byte) 0xf4, (byte) 0x8e, (byte) 0xe0, (byte) 0x9f, (byte) 0xe7, 0x3a, 0x2c, 70 0x2f, 0x21, (byte) 0xd4, 0x46, (byte) 0xba, (byte) 0x95, 0x70, (byte) 0xa9, 0x5b, 0x20, 0x2a, (byte) 0xfa, 0x52, 0x3e, 71 (byte) 0x9d, (byte) 0xd9, (byte) 0xef, 0x28, (byte) 0xc5, (byte) 0xd1, 0x60, (byte) 0x89, 0x68, 0x6e, 0x7f, (byte) 0xd7, (byte) 0x9e, (byte) 0x89, 72 0x4c, (byte) 0xeb, 0x4d, (byte) 0xd2, (byte) 0xc6, (byte) 0xf4, 0x2d, 0x02, 0x5d, (byte) 0xda, (byte) 0xde, 0x33, (byte) 0xfe, (byte) 0xc1, 73 0x7e, (byte) 0xde, 0x4f, 0x1f, (byte) 0x9b, 0x6e, 0x6f, 0x0f, 0x66, 0x71, 0x19, (byte) 0xe9, 0x43, 0x3c, 74 (byte) 0x83, 0x0a, 0x0f, 0x28, 0x21, (byte) 0xc8, 0x38, (byte) 0xd3, 0x4e, 0x48, (byte) 0xdf, (byte) 0xd4, (byte) 0x99, (byte) 0xb5, 75 (byte) 0xc6, (byte) 0x8d, (byte) 0xd4, (byte) 0xc1, 0x69, 0x58, 0x79, (byte) 0x82, 0x32, (byte) 0x82, (byte) 0xd4, (byte) 0x86, (byte) 0xe2, 0x04, 76 0x08, 0x63, (byte) 0x87, (byte) 0xf0, 0x2a, (byte) 0xf6, (byte) 0xec, 0x3e, 0x51, 0x0f, (byte) 0xda, (byte) 0xb4, 0x67, 0x19, 77 0x5e, 0x16, 0x02, (byte) 0x9f, (byte) 0xf1, 0x19, 0x0c, 0x3e, (byte) 0xb8, 0x04, 0x49, 0x07, 0x53, 0x02, 78 0x03, 0x01, 0x00, 0x01 61 (byte) 0x84, (byte) 0xc8, (byte) 0xd9, 0x6b, (byte) 0xc5, (byte) 0xda, 0x0b, 0x69, (byte) 0xbf, (byte) 0xfc, 62 0x7e, (byte) 0xb9, (byte) 0x96, 0x2c, (byte) 0xeb, (byte) 0x8f, (byte) 0xbc, 0x6e, 0x40, (byte) 0xe6, (byte) 0xe2, 63 (byte) 0xfc, (byte) 0xf1, 0x7f, 0x73, (byte) 0xa7, (byte) 0x9d, (byte) 0xde, (byte) 0xc7, (byte) 0x88, 0x57, 0x51, 64 (byte) 0x84, (byte) 0xed, (byte) 0x96, (byte) 0xfb, (byte) 0xe1, 0x38, (byte) 0xef, 0x08, 0x2b, (byte) 0xf3, 65 (byte) 0xc7, (byte) 0xc3, 0x5d, (byte) 0xfe, (byte) 0xf9, 0x51, (byte) 0xe6, 0x29, (byte) 0xfc, (byte) 0xe5, 0x0d, 66 (byte) 0xa1, 0x0d, (byte) 0xa8, (byte) 0xb4, (byte) 0xae, 0x26, 0x18, 0x19, 0x4d, 0x6c, 0x0c, 0x3b, 0x12, (byte) 0xba, 67 (byte) 0xbc, 0x5f, 0x32, (byte) 0xb3, (byte) 0xbe, (byte) 0x9d, 0x17, 0x0d, 0x4d, 0x2f, 0x1a, 0x48, (byte) 0xb7, 68 (byte) 0xac, (byte) 0xf7, 0x1a, 0x43, 0x01, (byte) 0x97, (byte) 0xf4, (byte) 0xf8, 0x4c, (byte) 0xbb, 0x6a, (byte) 0xbc, 69 0x33, (byte) 0xe1, 0x73, 0x1e, (byte) 0x86, (byte) 0xfb, 0x2e, (byte) 0xb1, 0x63, 0x75, (byte) 0x85, (byte) 0xdc, 70 (byte) 0x82, 0x6c, 0x28, (byte) 0xf1, (byte) 0xe3, (byte) 0x90, 0x63, (byte) 0x9d, 0x3d, 0x48, (byte) 0x8a, (byte) 0x8c, 71 0x47, (byte) 0xe2, 0x10, 0x0b, (byte) 0xef, (byte) 0x91, (byte) 0x94, (byte) 0xb0, 0x6c, 0x4c, (byte) 0x80, 0x76, 0x03, 72 (byte) 0xe1, (byte) 0xb6, (byte) 0x90, (byte) 0x87, (byte) 0xd9, (byte) 0xae, (byte) 0xf4, (byte) 0x8e, (byte) 0xe0, 73 (byte) 0x9f, (byte) 0xe7, 0x3a, 0x2c, 0x2f, 0x21, (byte) 0xd4, 0x46, (byte) 0xba, (byte) 0x95, 0x70, (byte) 0xa9, 0x5b, 74 0x20, 0x2a, (byte) 0xfa, 0x52, 0x3e, (byte) 0x9d, (byte) 0xd9, (byte) 0xef, 0x28, (byte) 0xc5, (byte) 0xd1, 0x60, 75 (byte) 0x89, 0x68, 0x6e, 0x7f, (byte) 0xd7, (byte) 0x9e, (byte) 0x89, 0x4c, (byte) 0xeb, 0x4d, (byte) 0xd2, (byte) 0xc6, 76 (byte) 0xf4, 0x2d, 0x02, 0x5d, (byte) 0xda, (byte) 0xde, 0x33, (byte) 0xfe, (byte) 0xc1, 0x7e, (byte) 0xde, 0x4f, 0x1f, 77 (byte) 0x9b, 0x6e, 0x6f, 0x0f, 0x66, 0x71, 0x19, (byte) 0xe9, 0x43, 0x3c, (byte) 0x83, 0x0a, 0x0f, 0x28, 0x21, (byte) 0xc8, 78 0x38, (byte) 0xd3, 0x4e, 0x48, (byte) 0xdf, (byte) 0xd4, (byte) 0x99, (byte) 0xb5, (byte) 0xc6, (byte) 0x8d, (byte) 0xd4, 79 (byte) 0xc1, 0x69, 0x58, 0x79, (byte) 0x82, 0x32, (byte) 0x82, (byte) 0xd4, (byte) 0x86, (byte) 0xe2, 0x04, 0x08, 0x63, 80 (byte) 0x87, (byte) 0xf0, 0x2a, (byte) 0xf6, (byte) 0xec, 0x3e, 0x51, 0x0f, (byte) 0xda, (byte) 0xb4, 0x67, 0x19, 0x5e, 81 0x16, 0x02, (byte) 0x9f, (byte) 0xf1, 0x19, 0x0c, 0x3e, (byte) 0xb8, 0x04, 0x49, 0x07, 0x53, 0x02, 0x03, 0x01, 0x00, 0x01 79 82 }; 80 83 … … 226 229 if (!insecureCertificates.isEmpty()) { 227 230 StringBuilder message = new StringBuilder("<html>"); 228 message.append(tr("A previous version of JOSM has installed a custom certificate in order to provide HTTPS support for Remote Control:")); 231 message.append(tr("A previous version of JOSM has installed a custom certificate "+ 232 "in order to provide HTTPS support for Remote Control:")); 229 233 message.append("<br><ul>"); 230 234 for (String alias : insecureCertificates) { … … 235 239 message.append("</ul>"); 236 240 message.append(tr("It appears it could be an important <b>security risk</b>.<br><br>"+ 237 "You are now going to be prompted by Windows to remove this insecure certificate.<br>For your own safety, <b>please click Yes</b> in next dialog.")); 241 "You are now going to be prompted by Windows to remove this insecure certificate.<br>"+ 242 "For your own safety, <b>please click Yes</b> in next dialog.")); 238 243 message.append("</html>"); 239 244 JOptionPane.showMessageDialog(Main.parent, message.toString(), tr("Warning"), JOptionPane.WARNING_MESSAGE); … … 268 273 "If unsure, you can also click No then disable HTTPS support in Remote Control preferences.")); 269 274 message.append("</html>"); 270 JOptionPane.showMessageDialog(Main.parent, message.toString(), tr("HTTPS support in Remote Control"), JOptionPane.INFORMATION_MESSAGE); 275 JOptionPane.showMessageDialog(Main.parent, message.toString(), 276 tr("HTTPS support in Remote Control"), JOptionPane.INFORMATION_MESSAGE); 271 277 // install it to Windows-ROOT keystore, used by IE, Chrome and Safari, but not by Firefox 272 278 Main.info(tr("Adding JOSM localhost certificate to {0} keystore", WINDOWS_ROOT));
Note:
See TracChangeset
for help on using the changeset viewer.