Changeset 7081 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2014-05-09T04:49:54+02:00 (10 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/JumpToAction.java
r7025 r7081 32 32 */ 33 33 public class JumpToAction extends JosmAction { 34 34 35 35 /** 36 36 * Constructs a new {@code JumpToAction}. 37 37 */ 38 38 public JumpToAction() { 39 super(tr("Jump To Position"), (Icon) null, tr("Opens a dialog that allows to jump to a specific location"), 39 super(tr("Jump To Position"), (Icon) null, tr("Opens a dialog that allows to jump to a specific location"), 40 40 Shortcut.registerShortcut("tools:jumpto", tr("Tool: {0}", tr("Jump To Position")), 41 41 KeyEvent.VK_J, Shortcut.CTRL), true, "action/jumpto", true); … … 46 46 private final JosmTextField lon = new JosmTextField(); 47 47 private final JosmTextField zm = new JosmTextField(); 48 49 class OsmURLListener implements DocumentListener { 50 @Override public void changedUpdate(DocumentEvent e) { parseURL(); } 51 @Override public void insertUpdate(DocumentEvent e) { parseURL(); } 52 @Override public void removeUpdate(DocumentEvent e) { parseURL(); } 53 } 54 55 class OsmLonLatListener implements DocumentListener { 56 @Override public void changedUpdate(DocumentEvent e) { updateUrl(false); } 57 @Override public void insertUpdate(DocumentEvent e) { updateUrl(false); } 58 @Override public void removeUpdate(DocumentEvent e) { updateUrl(false); } 59 } 48 60 49 61 /** … … 73 85 + "</html>"), 74 86 BorderLayout.NORTH); 75 76 class OsmURLListener implements DocumentListener {77 @Override public void changedUpdate(DocumentEvent e) { parseURL(); }78 @Override public void insertUpdate(DocumentEvent e) { parseURL(); }79 @Override public void removeUpdate(DocumentEvent e) { parseURL(); }80 }81 82 class OsmLonLatListener implements DocumentListener {83 @Override public void changedUpdate(DocumentEvent e) { updateUrl(false); }84 @Override public void insertUpdate(DocumentEvent e) { updateUrl(false); }85 @Override public void removeUpdate(DocumentEvent e) { updateUrl(false); }86 }87 87 88 88 OsmLonLatListener x = new OsmLonLatListener(); … … 150 150 int eq = arg.indexOf('='); 151 151 if (eq == -1 || !"zoom".equalsIgnoreCase(arg.substring(0, eq))) continue; 152 152 153 153 zoomLvl = Integer.parseInt(arg.substring(eq + 1)); 154 154 break; -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java
r7080 r7081 80 80 final public static int noThreads; 81 81 final public static ExecutorService styleCreatorPool; 82 82 83 83 static { 84 84 noThreads = Main.pref.getInteger( … … 330 330 private boolean leftHandTraffic; 331 331 332 /** 333 * Constructs a new {@code StyledMapRenderer}. 334 * 335 * @param g the graphics context. Must not be null. 336 * @param nc the map viewport. Must not be null. 337 * @param isInactiveMode if true, the paint visitor shall render OSM objects such that they 338 * look inactive. Example: rendering of data in an inactive layer using light gray as color only. 339 * @throws IllegalArgumentException thrown if {@code g} is null 340 * @throws IllegalArgumentException thrown if {@code nc} is null 341 */ 332 342 public StyledMapRenderer(Graphics2D g, NavigatableComponent nc, boolean isInactiveMode) { 333 343 super(g, nc, isInactiveMode); … … 1329 1339 return null; 1330 1340 } 1331 1341 1332 1342 @Override 1333 1343 public void render(final DataSet data, boolean renderVirtualNodes, Bounds bounds) { … … 1343 1353 1344 1354 highlightWaySegments = data.getHighlightedWaySegments(); 1345 1355 1346 1356 long timeStart=0, timePhase1=0, timeFinished; 1347 1357 if (Main.isTraceEnabled()) { … … 1369 1379 this.output = output; 1370 1380 } 1371 1381 1372 1382 @Override 1373 1383 public List<StyleRecord> call() throws Exception { … … 1380 1390 return output; 1381 1391 } 1382 1392 1383 1393 @Override 1384 1394 public void visit(Node n) { … … 1456 1466 1457 1467 final List<StyleRecord> allStyleElems = new ArrayList<>(nodes.size()+ways.size()+relations.size()); 1458 1468 1459 1469 class ConcurrentTasksHelper { 1460 1470 1461 1471 void process(List<? extends OsmPrimitive> prims) { 1462 1472 final List<ComputeStyleListWorker> tasks = new ArrayList<>(); … … 1490 1500 } 1491 1501 ConcurrentTasksHelper helper = new ConcurrentTasksHelper(); 1492 1502 1493 1503 // Need to process all relations first. 1494 1504 // Reason: Make sure, ElemStyles.getStyleCacheWithRange is … … 1505 1515 System.err.print("phase 1 (calculate styles): " + (timePhase1 - timeStart) + " ms"); 1506 1516 } 1507 1517 1508 1518 Collections.sort(allStyleElems); 1509 1519 1510 1520 for (StyleRecord r : allStyleElems) { 1511 1521 r.style.paintPrimitive( -
trunk/src/org/openstreetmap/josm/gui/JosmUserIdentityManager.java
r7048 r7081 242 242 switch (evt.getKey()) { 243 243 case "osm-server.username": 244 if (!(evt.getNewValue() instanceof StringSetting)) return; 245 String newUserName = ((StringSetting) evt.getNewValue()).getValue(); 244 String newUserName = null; 245 if (evt.getNewValue() instanceof StringSetting) { 246 newUserName = ((StringSetting) evt.getNewValue()).getValue(); 247 } 246 248 if (newUserName == null || newUserName.trim().isEmpty()) { 247 249 setAnonymous(); 248 250 } else { 249 if (! 251 if (!newUserName.equals(userName)) { 250 252 setPartiallyIdentified(newUserName); 251 253 } … … 254 256 255 257 case "osm-server.url": 256 if (!(evt.getNewValue() instanceof StringSetting)) return; 257 String newUrl = ((StringSetting) evt.getNewValue()).getValue(); 258 String newUrl = null; 259 if (evt.getNewValue() instanceof StringSetting) { 260 newUrl = ((StringSetting) evt.getNewValue()).getValue(); 261 } 258 262 if (newUrl == null || newUrl.trim().isEmpty()) { 259 263 setAnonymous(); -
trunk/src/org/openstreetmap/josm/gui/mappaint/StyleSource.java
r7005 r7081 18 18 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles.IconReference; 19 19 import org.openstreetmap.josm.gui.preferences.SourceEntry; 20 import org.openstreetmap.josm.io.MirroredInputStream; 20 21 import org.openstreetmap.josm.tools.ImageProvider; 21 22 import org.openstreetmap.josm.tools.Utils; … … 68 69 public abstract void apply(MultiCascade mc, OsmPrimitive osm, double scale, OsmPrimitive multipolyOuterWay, boolean pretendWayIsClosed); 69 70 71 /** 72 * Loads the style source. 73 */ 70 74 public abstract void loadStyleSource(); 71 75 … … 77 81 */ 78 82 public abstract InputStream getSourceInputStream() throws IOException; 83 84 /** 85 * Returns a new {@code MirroredInputStream} to the local file containing style source (can be a text file or an archive). 86 * @return A new {@code MirroredInputStream} to the local file containing style source 87 * @throws IOException if any I/O error occurs. 88 * @since 7081 89 */ 90 public abstract MirroredInputStream getMirroredInputStream() throws IOException; 79 91 80 92 /** … … 152 164 this.lastMTime = lastMTime; 153 165 } 154 155 156 166 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Condition.java
r7069 r7081 65 65 } 66 66 67 public static Condition createPseudoClassCondition(String id, boolean not, Context context) {67 public static PseudoClassCondition createPseudoClassCondition(String id, boolean not, Context context) { 68 68 return new PseudoClassCondition(id, not, context); 69 69 } 70 70 71 public static C ondition createClassCondition(String id, boolean not, Context context) {71 public static ClassCondition createClassCondition(String id, boolean not, Context context) { 72 72 return new ClassCondition(id, not); 73 73 } 74 74 75 public static Condition createExpressionCondition(Expression e, Context context) {75 public static ExpressionCondition createExpressionCondition(Expression e, Context context) { 76 76 return new ExpressionCondition(e); 77 77 } … … 153 153 /** 154 154 * Most common case of a KeyValueCondition. 155 * 155 * 156 156 * Extra class for performance reasons. 157 157 */ … … 169 169 return v.equals(e.osm.get(k)); 170 170 } 171 171 172 172 public Tag asTag() { 173 173 return new Tag(k, v); … … 178 178 return '[' + k + '=' + v + ']'; 179 179 } 180 180 181 181 } 182 182 -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSource.java
r7074 r7081 151 151 } 152 152 } 153 153 154 154 @Override 155 155 public InputStream getSourceInputStream() throws IOException { … … 157 157 return new ByteArrayInputStream(css.getBytes(Utils.UTF_8)); 158 158 } 159 MirroredInputStream in = new MirroredInputStream(url, null, MAPCSS_STYLE_MIME_TYPES);159 MirroredInputStream in = getMirroredInputStream(); 160 160 if (isZip) { 161 161 File file = in.getFile(); … … 170 170 return in; 171 171 } 172 } 173 174 @Override 175 public MirroredInputStream getMirroredInputStream() throws IOException { 176 return new MirroredInputStream(url, null, MAPCSS_STYLE_MIME_TYPES); 172 177 } 173 178 -
trunk/src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSource.java
r7033 r7081 102 102 @Override 103 103 public InputStream getSourceInputStream() throws IOException { 104 MirroredInputStream in = new MirroredInputStream(url, null, XML_STYLE_MIME_TYPES);104 MirroredInputStream in = getMirroredInputStream(); 105 105 InputStream zip = in.findZipEntryInputStream("xml", "style"); 106 106 if (zip != null) { … … 111 111 return in; 112 112 } 113 } 114 115 @Override 116 public MirroredInputStream getMirroredInputStream() throws IOException { 117 return new MirroredInputStream(url, null, XML_STYLE_MIME_TYPES); 113 118 } 114 119 -
trunk/src/org/openstreetmap/josm/io/MirroredInputStream.java
r7058 r7081 228 228 } 229 229 230 /** 231 * Replies the local file. 232 * @return The local file on disk 233 */ 230 234 public File getFile() { 231 235 return file; -
trunk/src/org/openstreetmap/josm/io/OsmApi.java
r7037 r7081 615 615 url = new URL(new URL(getBaseUrl()), urlSuffix); 616 616 Main.info(requestMethod + " " + url + "... "); 617 Main.debug(requestBody); 617 618 // fix #5369, see http://www.tikalk.com/java/forums/httpurlconnection-disable-keep-alive 618 619 activeConnection = Utils.openHttpConnection(url, false); -
trunk/src/org/openstreetmap/josm/io/OsmReader.java
r7033 r7081 439 439 } 440 440 441 // user attribute added in 0.4 API442 441 String user = parser.getAttributeValue(null, "user"); 443 // uid attribute added in 0.6 API444 442 String uid = parser.getAttributeValue(null, "uid"); 445 443 current.setUser(createUser(uid, user)); 446 444 447 // visible attribute added in 0.4 API448 445 String visible = parser.getAttributeValue(null, "visible"); 449 446 if (visible != null) { … … 474 471 } else { 475 472 // version expected for OSM primitives with an id assigned by the server (id > 0), since API 0.6 476 //477 473 if (!current.isNew() && ds.getVersion() != null && "0.6".equals(ds.getVersion())) { 478 474 throwException(tr("Missing attribute ''version'' on OSM primitive with ID {0}.", Long.toString(current.getUniqueId()))); … … 497 493 try { 498 494 current.setChangesetId(Integer.parseInt(v)); 499 } catch(NumberFormatException e) { 495 } catch (IllegalArgumentException e) { 496 Main.debug(e.getMessage()); 500 497 if (current.isNew()) { 501 498 // for a new primitive we just log a warning … … 506 503 throwException(tr("Illegal value for attribute ''changeset''. Got {0}.", v), e); 507 504 } 508 } 509 if (current.getChangesetId() <=0) { 505 } catch (IllegalStateException e) { 506 // thrown for positive changeset id on new primitives 507 Main.info(e.getMessage()); 508 current.setChangesetId(0); 509 } 510 if (current.getChangesetId() <= 0) { 510 511 if (current.isNew()) { 511 512 // for a new primitive we just log a warning
Note:
See TracChangeset
for help on using the changeset viewer.