Changeset 36122 in osm
- Timestamp:
- 2023-08-22T17:40:36+02:00 (15 months ago)
- Location:
- applications/editors/josm
- Files:
-
- 36 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/oldplugins/public_transport_layer/src/ptl/DistanceBetweenStops.java
r34549 r36122 14 14 import org.openstreetmap.josm.actions.JosmAction; 15 15 import org.openstreetmap.josm.data.SystemOfMeasurement; 16 import org.openstreetmap.josm.data.coor.LatLon;17 16 import org.openstreetmap.josm.data.osm.DefaultNameFormatter; 18 17 import org.openstreetmap.josm.data.osm.Node; … … 46 45 final List<Node> routeNodes = new ArrayList<>(); 47 46 for (final RelationMember member : route.getMembers()) { 48 if (member.hasRole("stop", "stop_exit_only", "stop_entry_only") && OsmPrimitiveType.NODE .equals(member.getType())) {47 if (member.hasRole("stop", "stop_exit_only", "stop_entry_only") && OsmPrimitiveType.NODE == member.getType()) { 49 48 stopNodes.add(member.getNode()); 50 } else if (member.hasRole("") && OsmPrimitiveType.WAY .equals(member.getType())) {49 } else if (member.hasRole("") && OsmPrimitiveType.WAY == member.getType()) { 51 50 routeSegments.add(member); 52 51 } … … 123 122 Node lastN = null; 124 123 for (Node n : nodes) { 125 if (lastN != null) { 126 LatLon lastNcoor = lastN.getCoor(); 127 LatLon coor = n.getCoor(); 128 if (lastNcoor != null && coor != null) { 129 length += coor.greatCircleDistance(lastNcoor); 130 } 124 if (lastN != null && n != null && lastN.isLatLonKnown() && n.isLatLonKnown()) { 125 length += n.greatCircleDistance(lastN); 131 126 } 132 127 lastN = n; … … 153 148 } 154 149 155 new ExtendedDialog(MainApplication.getMainFrame(), getValue(NAME).toString(), new String[]{tr("Close")}) { 156 { 157 setButtonIcons(new String[]{"ok.png"}); 158 final JosmTextArea jte = new JosmTextArea(); 159 jte.setFont(GuiHelper.getMonospacedFont(jte)); 160 jte.setEditable(false); 161 jte.append(sb.toString()); 162 jte.setSelectionStart(0); 163 jte.setSelectionEnd(0); 164 setContent(jte); 165 } 166 167 }.showDialog(); 150 ExtendedDialog extendedDialog = new ExtendedDialog(MainApplication.getMainFrame(), getValue(NAME).toString(), tr("Close")); 151 extendedDialog.setButtonIcons("ok"); 152 final JosmTextArea jte = new JosmTextArea(); 153 jte.setFont(GuiHelper.getMonospacedFont(jte)); 154 jte.setEditable(false); 155 jte.append(sb.toString()); 156 jte.setSelectionStart(0); 157 jte.setSelectionEnd(0); 158 extendedDialog.setContent(jte); 159 extendedDialog.showDialog(); 168 160 } 169 161 } -
applications/editors/josm/oldplugins/public_transport_layer/src/ptl/PublicTransportLayer.java
r34164 r36122 38 38 import org.openstreetmap.josm.tools.MultiMap; 39 39 import org.openstreetmap.josm.tools.Pair; 40 import org.openstreetmap.josm.tools.Utils;41 40 42 41 /** … … 71 70 Node previousNode = null; 72 71 for (final RelationMember member : relation.getMembers()) { 73 if (OsmPrimitiveType.NODE .equals(member.getType()) && "stop".equals(member.getRole())) {72 if (OsmPrimitiveType.NODE == member.getType() && "stop".equals(member.getRole())) { 74 73 way.addNode(member.getNode()); 75 74 if (previousNode != null) { … … 83 82 try { 84 83 color = ColorHelper.html2color(relation.get("colour")); 85 } catch (RuntimeException ignore) {86 Logging.trace( ignore);84 } catch (RuntimeException runtimeException) { 85 Logging.trace(runtimeException); 87 86 } 88 87 renderer.drawWay(way, color, new BasicStroke(1), null, null, 0, doDrawArrows, false, false, false); … … 103 102 104 103 for (Pair<Node, Node> nodePair : segmentRefs.keySet()) { 105 final String label = Utils.join(tr(", "), new TreeSet<>(segmentRefs.get(nodePair)));104 final String label = String.join(", ", new TreeSet<>(segmentRefs.get(nodePair))); 106 105 c.put(StyleKeys.TEXT, label); 107 106 final TextLabel text = TextLabel.create(env, color, false); -
applications/editors/josm/plugins/MicrosoftStreetside/gradle.properties
r36034 r36122 8 8 # Minimum required JOSM version to run this plugin, choose the lowest version possible that is compatible. 9 9 # You can check if the plugin compiles against this version by executing `./gradlew compileJava_minJosm`. 10 plugin.main.version=18 49410 plugin.main.version=18723 11 11 #plugin.version= 12 12 # Version of JOSM against which the plugin is compiled 13 13 # Please check, if the specified version is available for download from https://josm.openstreetmap.de/download/ . 14 14 # If not, choose the next higher number that is available, or the gradle build will break. 15 plugin.compile.version=18 49415 plugin.compile.version=18724 16 16 plugin.requires=apache-commons;apache-http;jackson;javafx;log4j;utilsplugin2 17 17 -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/oauth/OAuthUtils.java
r34317 r36122 8 8 import java.net.URL; 9 9 10 import ja vax.json.Json;11 import ja vax.json.JsonException;12 import ja vax.json.JsonObject;13 import ja vax.json.JsonReader;10 import jakarta.json.Json; 11 import jakarta.json.JsonException; 12 import jakarta.json.JsonObject; 13 import jakarta.json.JsonReader; 14 14 15 15 import org.openstreetmap.josm.plugins.streetside.utils.StreetsideProperties; -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/utils/api/JsonDecoder.java
r34428 r36122 9 9 import java.util.function.Function; 10 10 11 import ja vax.json.JsonArray;12 import ja vax.json.JsonNumber;13 import ja vax.json.JsonObject;14 import ja vax.json.JsonValue;11 import jakarta.json.JsonArray; 12 import jakarta.json.JsonNumber; 13 import jakarta.json.JsonObject; 14 import jakarta.json.JsonValue; 15 15 16 import org.apache.log4j.Logger;17 16 import org.openstreetmap.josm.data.coor.LatLon; 18 17 import org.openstreetmap.josm.tools.I18n; 18 import org.openstreetmap.josm.tools.Logging; 19 19 20 20 public final class JsonDecoder { 21 22 final static Logger logger = Logger.getLogger(JsonDecoder.class); 21 private static final double[] EMPTY_DOUBLE = new double[0]; 23 22 24 23 private JsonDecoder() { … … 65 64 static LatLon decodeLatLon(final JsonArray json) { 66 65 final double[] result = decodeDoublePair(json); 67 if (result != null) {66 if (result.length == 2) { 68 67 return new LatLon(result[1], result[0]); 69 68 } … … 77 76 * if the parameter was not a {@link JsonArray} of exactly size 2 containing two {@link JsonNumber}s 78 77 */ 79 @SuppressWarnings("PMD.ReturnEmptyArrayRatherThanNull")80 78 static double[] decodeDoublePair(final JsonArray json) { 81 79 if ( … … 87 85 return new double[]{json.getJsonNumber(0).doubleValue(), json.getJsonNumber(1).doubleValue()}; 88 86 } 89 return null;87 return EMPTY_DOUBLE; 90 88 } 91 89 … … 96 94 * @return the point in time as a {@link Long} value representing the UNIX epoch time, or <code>null</code> if the 97 95 * parameter does not match the required format (this also triggers a warning via 98 * {@link Logg er}, or the parameter is <code>null</code>).96 * {@link Logging}, or the parameter is <code>null</code>). 99 97 */ 100 98 static Long decodeTimestamp(final String timestamp) { … … 104 102 } catch (ParseException e) { 105 103 StackTraceElement calledBy = e.getStackTrace()[Math.min(e.getStackTrace().length - 1, 2)]; 106 logger.warn(I18n.tr(String.format(104 Logging.warn(I18n.tr(String.format( 107 105 "Could not decode time from the timestamp `%s` (called by %s.%s:%d)", 108 106 timestamp, calledBy.getClassName(), calledBy.getMethodName(), calledBy.getLineNumber() -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/utils/api/JsonImageDetectionDecoder.java
r34399 r36122 5 5 import java.awt.geom.Path2D; 6 6 7 import ja vax.json.JsonArray;8 import ja vax.json.JsonNumber;9 import ja vax.json.JsonObject;10 import ja vax.json.JsonValue;7 import jakarta.json.JsonArray; 8 import jakarta.json.JsonNumber; 9 import jakarta.json.JsonObject; 10 import jakarta.json.JsonValue; 11 11 12 import org.apache.log4j.Logger;13 12 import org.openstreetmap.josm.plugins.streetside.model.ImageDetection; 14 13 import org.openstreetmap.josm.plugins.streetside.utils.StreetsideURL.APIv3; 14 import org.openstreetmap.josm.tools.Logging; 15 15 16 16 /** … … 19 19 */ 20 20 public final class JsonImageDetectionDecoder { 21 22 final static Logger logger = Logger.getLogger(JsonImageDetectionDecoder.class);23 21 24 22 private JsonImageDetectionDecoder() { … … 50 48 if (json instanceof JsonObject) { 51 49 if (!"Polygon".equals(((JsonObject) json).getString("type", null))) { 52 logger.warn(50 Logging.warn( 53 51 String.format("Image detections using shapes with type=%s are currently not supported!", 54 52 ((JsonObject) json).getString("type", "‹no type set›")) … … 93 91 json.forEach(val -> { 94 92 double[] coord = JsonDecoder.decodeDoublePair(val instanceof JsonArray ? (JsonArray) val : null); 95 if (shape.getCurrentPoint() == null && coord != null) {93 if (shape.getCurrentPoint() == null && coord.length == 2) { 96 94 shape.moveTo(coord[0], coord[1]); 97 } else if (coord != null ) {95 } else if (coord != null && coord.length == 2) { 98 96 shape.lineTo(coord[0], coord[1]); 99 97 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/utils/api/JsonSequencesDecoder.java
r34325 r36122 5 5 import java.util.function.Function; 6 6 7 import ja vax.json.JsonArray;8 import ja vax.json.JsonNumber;9 import ja vax.json.JsonObject;10 import ja vax.json.JsonString;11 import ja vax.json.JsonValue;7 import jakarta.json.JsonArray; 8 import jakarta.json.JsonNumber; 9 import jakarta.json.JsonObject; 10 import jakarta.json.JsonString; 11 import jakarta.json.JsonValue; 12 12 13 13 import org.openstreetmap.josm.data.coor.LatLon; -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/utils/api/JsonStreetsideDecoder.java
r34428 r36122 2 2 package org.openstreetmap.josm.plugins.streetside.utils.api; 3 3 4 import java.text.ParseException;5 import java.text.SimpleDateFormat;6 4 import java.util.Collection; 7 5 import java.util.HashSet; 8 import java.util.Locale;9 6 import java.util.function.Function; 10 7 11 import javax.json.JsonArray; 12 import javax.json.JsonNumber; 13 import javax.json.JsonObject; 14 import javax.json.JsonValue; 8 import org.openstreetmap.josm.data.coor.LatLon; 9 import org.openstreetmap.josm.tools.Logging; 15 10 16 import org.apache.log4j.Logger;17 import org.openstreetmap.josm.data.coor.LatLon;18 import org.openstreetmap.josm.tools.I18n;11 import jakarta.json.JsonArray; 12 import jakarta.json.JsonNumber; 13 import jakarta.json.JsonObject; 19 14 20 15 public final class JsonStreetsideDecoder { 21 22 final static Logger logger = Logger.getLogger(JsonStreetsideDecoder.class);23 16 24 17 private JsonStreetsideDecoder() { … … 38 31 */ 39 32 public static <T> Collection<T> decodeFeatureCollection(final JsonObject json, Function<JsonObject, T> featureDecoder) { 40 final Collection<T> result = new HashSet<>(); 41 if ( 42 json != null && "FeatureCollection".equals(json.getString("type", null)) && json.containsKey("features") 43 ) { 44 final JsonValue features = json.get("features"); 45 for (int i = 0; features instanceof JsonArray && i < ((JsonArray) features).size(); i++) { 46 final JsonValue val = ((JsonArray) features).get(i); 47 if (val instanceof JsonObject) { 48 final T feature = featureDecoder.apply((JsonObject) val); 49 if (feature != null) { 50 result.add(feature); 51 } 52 } 53 } 54 } 55 return result; 33 return JsonDecoder.decodeFeatureCollection(json, featureDecoder); 56 34 } 57 35 … … 64 42 */ 65 43 static LatLon decodeLatLon(final JsonArray json) { 66 final double[] result = decodeDoublePair(json); 67 if (result != null) { 68 return new LatLon(result[1], result[0]); 69 } 70 return null; 71 } 72 73 /** 74 * Decodes a pair of double values, which are stored in a {@link JsonArray} of exactly size 2. 75 * @param json the {@link JsonArray} containing the two values 76 * @return a double array which contains the two values in the same order, or <code>null</code> 77 * if the parameter was not a {@link JsonArray} of exactly size 2 containing two {@link JsonNumber}s 78 */ 79 @SuppressWarnings("PMD.ReturnEmptyArrayRatherThanNull") 80 static double[] decodeDoublePair(final JsonArray json) { 81 if ( 82 json != null && 83 json.size() == 2 && 84 json.get(0) instanceof JsonNumber && 85 json.get(1) instanceof JsonNumber 86 ) { 87 return new double[]{json.getJsonNumber(0).doubleValue(), json.getJsonNumber(1).doubleValue()}; 88 } 89 return null; 44 return JsonDecoder.decodeLatLon(json); 90 45 } 91 46 … … 96 51 * @return the point in time as a {@link Long} value representing the UNIX epoch time, or <code>null</code> if the 97 52 * parameter does not match the required format (this also triggers a warning via 98 * {@link Logg er}, or the parameter is <code>null</code>).53 * {@link Logging}, or the parameter is <code>null</code>). 99 54 */ 100 55 static Long decodeTimestamp(final String timestamp) { 101 if (timestamp != null) { 102 try { 103 return new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX", Locale.UK).parse(timestamp).getTime(); 104 } catch (ParseException e) { 105 StackTraceElement calledBy = e.getStackTrace()[Math.min(e.getStackTrace().length - 1, 2)]; 106 logger.warn(I18n.tr(String.format( 107 "Could not decode time from the timestamp `%s` (called by %s.%s:%d)", 108 timestamp, calledBy.getClassName(), calledBy.getMethodName(), calledBy.getLineNumber() 109 ), e)); 110 } 111 } 112 return null; 56 return JsonDecoder.decodeTimestamp(timestamp); 113 57 } 114 58 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/utils/api/JsonStreetsideSequencesDecoder.java
r34429 r36122 5 5 import java.util.function.Function; 6 6 7 import ja vax.json.JsonArray;8 import ja vax.json.JsonNumber;9 import ja vax.json.JsonObject;10 import ja vax.json.JsonString;11 import ja vax.json.JsonValue;7 import jakarta.json.JsonArray; 8 import jakarta.json.JsonNumber; 9 import jakarta.json.JsonObject; 10 import jakarta.json.JsonString; 11 import jakarta.json.JsonValue; 12 12 13 13 import org.openstreetmap.josm.data.coor.LatLon; … … 113 113 114 114 if (json.getString("id", null) != null && json.getString("la", null) != null && json.getString("lo", null) != null) { 115 result = new StreetsideSequence(json.getString("id", null), json.getJsonNumber("la").doubleValue(), json.getJsonNumber("lo").doubleValue(), json.getJsonNumber("cd").longValue()); 115 result = new StreetsideSequence(json.getString("id", null), 116 json.getJsonNumber("la").doubleValue(), json.getJsonNumber("lo").doubleValue(), json.getJsonNumber("cd").longValue()); 116 117 } 117 118 -
applications/editors/josm/plugins/MicrosoftStreetside/test/unit/org/openstreetmap/josm/plugins/streetside/utils/JsonUtil.java
r34386 r36122 5 5 import java.nio.charset.StandardCharsets; 6 6 7 import ja vax.json.Json;8 import ja vax.json.JsonObject;7 import jakarta.json.Json; 8 import jakarta.json.JsonObject; 9 9 10 10 public final class JsonUtil { -
applications/editors/josm/plugins/MicrosoftStreetside/test/unit/org/openstreetmap/josm/plugins/streetside/utils/api/JsonDecoderTest.java
r36064 r36122 3 3 4 4 5 import static org.junit.jupiter.api.Assertions.assertArrayEquals; 5 6 import static org.junit.jupiter.api.Assertions.assertNull; 6 7 … … 9 10 import java.util.function.Function; 10 11 11 import ja vax.json.Json;12 import ja vax.json.JsonObject;12 import jakarta.json.Json; 13 import jakarta.json.JsonObject; 13 14 14 15 import org.junit.jupiter.api.Test; … … 24 25 @Test 25 26 void testDecodeDoublePair() { 26 assert Null(JsonDecoder.decodeDoublePair(null));27 assertArrayEquals(new double[0], JsonDecoder.decodeDoublePair(null)); 27 28 } 28 29 -
applications/editors/josm/plugins/MicrosoftStreetside/test/unit/org/openstreetmap/josm/plugins/streetside/utils/api/JsonSequencesDecoderTest.java
r36064 r36122 13 13 import java.util.function.Function; 14 14 15 import ja vax.json.Json;16 import ja vax.json.JsonArray;17 import ja vax.json.JsonObject;18 import ja vax.json.JsonValue;15 import jakarta.json.Json; 16 import jakarta.json.JsonArray; 17 import jakarta.json.JsonObject; 18 import jakarta.json.JsonValue; 19 19 20 20 import org.junit.jupiter.api.Assertions; -
applications/editors/josm/plugins/cadastre-fr/build.xml
r35758 r36122 4 4 <property name="commit.message" value="recompile for compatibility with JOSM r17896"/> 5 5 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 6 <property name="plugin.main.version" value="1 7896"/>6 <property name="plugin.main.version" value="18723"/> 7 7 8 8 <!-- Configure these properties (replace "..." accordingly). -
applications/editors/josm/plugins/cadastre-fr/src/org/openstreetmap/josm/plugins/fr/cadastre/api/CadastreAPI.java
r35831 r36122 5 5 6 6 import java.io.IOException; 7 import java.io.StringReader;8 7 import java.net.MalformedURLException; 8 import java.net.URI; 9 9 import java.net.URL; 10 10 import java.util.Set; 11 11 import java.util.stream.Collectors; 12 12 13 import javax.json.Json; 14 import javax.json.JsonArray; 15 import javax.json.JsonObject; 16 import javax.json.JsonStructure; 13 import jakarta.json.Json; 14 import jakarta.json.JsonArray; 15 import jakarta.json.JsonObject; 16 import jakarta.json.JsonReader; 17 import jakarta.json.JsonStructure; 17 18 18 19 import org.openstreetmap.josm.data.Bounds; … … 55 56 */ 56 57 public static Set<String> getSheets(double minlon, double minlat, double maxlon, double maxlat) throws IOException { 57 URL url = new URL(API_ENDPOINT.get() + "/feuilles?bbox=" + String.join(",", 58 Double.toString(minlon), Double.toString(minlat), Double.toString(maxlon), Double.toString(maxlat))); 58 URL url = URI.create(API_ENDPOINT.get() + "/feuilles?bbox=" + String.join(",", 59 Double.toString(minlon), Double.toString(minlat), Double.toString(maxlon), Double.toString(maxlat))) 60 .toURL(); 59 61 try { 60 62 Response response = HttpClient.create(url).connect(); … … 65 67 "geo@data.gouv.fr")); 66 68 } 67 JsonStructure json = Json.createReader(new StringReader(response.fetchContent())).read(); 68 if (json instanceof JsonArray) { 69 return json.asJsonArray().stream().map(x -> x.asJsonObject().getString("id")).collect(Collectors.toSet()); 70 } else { 71 JsonObject obj = json.asJsonObject(); 72 throw new IOException(new OsmApiException(obj.getInt("code"), null, obj.getString("message"), url.toExternalForm())); 69 try (JsonReader reader = Json.createReader(response.getContentReader())) { 70 JsonStructure json = reader.read(); 71 if (json instanceof JsonArray) { 72 return json.asJsonArray().stream().map(x -> x.asJsonObject().getString("id")).collect(Collectors.toSet()); 73 } else { 74 JsonObject obj = json.asJsonObject(); 75 throw new IOException(new OsmApiException(obj.getInt("code"), null, obj.getString("message"), url.toExternalForm())); 76 } 73 77 } 74 78 } catch (MalformedURLException e) { -
applications/editors/josm/plugins/geochat/build.xml
r35978 r36122 5 5 <property name="commit.message" value="[josm_geochat] copypaste from keyboard, font size advanced parameters"/> 6 6 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 7 <property name="plugin.main.version" value="18 494"/>7 <property name="plugin.main.version" value="18723"/> 8 8 9 9 <property name="plugin.author" value="Ilya Zverev"/> -
applications/editors/josm/plugins/geochat/src/geochat/ChatServerConnection.java
r35978 r36122 15 15 import java.util.Set; 16 16 17 import ja vax.json.JsonArray;18 import ja vax.json.JsonException;19 import ja vax.json.JsonObject;17 import jakarta.json.JsonArray; 18 import jakarta.json.JsonException; 19 import jakarta.json.JsonObject; 20 20 21 21 import org.openstreetmap.josm.data.coor.ILatLon; … … 41 41 private String userName; 42 42 private static ChatServerConnection instance; 43 private Set<ChatServerConnectionListener> listeners;44 private LogRequest requestThread;43 private final Set<ChatServerConnectionListener> listeners; 44 private final LogRequest requestThread; 45 45 46 46 private ChatServerConnection() { … … 123 123 } 124 124 } catch (InterruptedException e) { 125 Thread.currentThread().interrupt(); 125 126 Logging.warn(e); 126 127 } … … 279 280 double l = lat / 180 * Math.PI; 280 281 double pf = Math.log(Math.tan(l) + (1 / Math.cos(l))); 281 return Math.pow(2.0, zoom - 1 ) * (Math.PI - pf) / Math.PI;282 return Math.pow(2.0, zoom - 1d) * (Math.PI - pf) / Math.PI; 282 283 } 283 284 284 285 private static double lonToTileX(double lon, int zoom) { 285 return Math.pow(2.0, zoom - 3 ) * (lon + 180.0) / 45.0;286 return Math.pow(2.0, zoom - 3d) * (lon + 180.0) / 45.0; 286 287 } 287 288 … … 305 306 double factor = screenPixels / tilePixels; 306 307 double result = Math.log(factor) / Math.log(2) / 2 + 1; 307 int intResult = (int) Math.floor(result); 308 return intResult; 308 return (int) Math.floor(result); 309 309 } 310 310 311 311 private class LogRequest implements Runnable { 312 312 private static final int MAX_JUMP = 20000; // in meters 313 private LatLon lastPosition = null;314 private long lastUserId = 0;315 private long lastId = 0;316 private boolean lastStatus = false;317 private boolean stopping = false;313 private LatLon lastPosition; 314 private long lastUserId; 315 private long lastId; 316 private boolean lastStatus; 317 private boolean stopping; 318 318 319 319 @Override … … 324 324 process(); 325 325 try { 326 Thread.sleep(interval * 1000 );326 Thread.sleep(interval * 1000L); 327 327 } catch (InterruptedException e) { 328 Thread.currentThread().interrupt(); 328 329 stopping = true; 330 Logging.trace(e); 329 331 } 330 332 } … … 367 369 json = JsonQueryUtil.query(query, true); 368 370 } catch (IOException ex) { 371 Logging.trace(ex); 369 372 json = null; // ? 370 373 } -
applications/editors/josm/plugins/geochat/src/geochat/JsonQueryCallback.java
r35161 r36122 2 2 package geochat; 3 3 4 import ja vax.json.JsonObject;4 import jakarta.json.JsonObject; 5 5 6 6 /** -
applications/editors/josm/plugins/geochat/src/geochat/JsonQueryUtil.java
r35162 r36122 5 5 import java.io.IOException; 6 6 import java.io.InputStream; 7 import java.net.UR L;7 import java.net.URI; 8 8 9 import javax.json.Json; 10 import javax.json.JsonException; 11 import javax.json.JsonObject; 9 import jakarta.json.Json; 10 import jakarta.json.JsonException; 11 import jakarta.json.JsonObject; 12 import jakarta.json.JsonReader; 12 13 13 14 import org.openstreetmap.josm.gui.MainApplication; … … 43 44 public static JsonObject query(String query, boolean logAtDebug) throws IOException { 44 45 String serverURL = Config.getPref().get("geochat.server", "https://zverik.dev.openstreetmap.org/osmochat.php?action="); 45 UR L url = new URL(serverURL + query);46 Response connection = HttpClient.create(url ).setLogAtDebug(logAtDebug).connect();46 URI url = URI.create(serverURL + query); 47 Response connection = HttpClient.create(url.toURL()).setLogAtDebug(logAtDebug).connect(); 47 48 if (connection.getResponseCode() != 200) { 48 49 throw new IOException("HTTP Response code " + connection.getResponseCode() + " (" + connection.getResponseMessage() + ")"); … … 51 52 if (inp == null) 52 53 throw new IOException("Empty response"); 53 try {54 return Json.createReader(inp).readObject();54 try (JsonReader reader = Json.createReader(inp)){ 55 return reader.readObject(); 55 56 } catch (JsonException e) { 56 57 throw new IOException("Failed to parse JSON: " + e.getMessage(), e); -
applications/editors/josm/plugins/livegps/src/livegps/LiveGpsAcquirer.java
r36120 r36122 16 16 import java.util.List; 17 17 18 import javax.json.Json; 19 import javax.json.JsonException; 20 import javax.json.JsonNumber; 21 import javax.json.JsonObject; 18 import jakarta.json.Json; 19 import jakarta.json.JsonException; 20 import jakarta.json.JsonNumber; 21 import jakarta.json.JsonObject; 22 import jakarta.json.JsonReader; 22 23 23 24 import org.openstreetmap.josm.spi.preferences.Config; … … 28 29 */ 29 30 public class LiveGpsAcquirer implements Runnable { 30 private String gpsdHost;31 private int gpsdPort;31 private final String gpsdHost; 32 private final int gpsdPort; 32 33 33 34 private Socket gpsdSocket; 34 35 private BufferedReader gpsdReader; 35 private boolean connected = false;36 private boolean shutdownFlag = false;36 private boolean connected; 37 private boolean shutdownFlag; 37 38 private boolean JSONProtocol = true; 38 private long skipTime = 0L;39 private int skipNum = 0;39 private long skipTime; 40 private int skipNum; 40 41 41 42 private final List<PropertyChangeListener> propertyChangeListener = new ArrayList<>(); … … 122 123 public void run() { 123 124 LiveGpsData oldGpsData = null; 124 LiveGpsData gpsData = null;125 LiveGpsData gpsData; 125 126 126 127 shutdownFlag = false; … … 131 132 connect(); 132 133 } catch (IOException iox) { 134 Logging.trace(iox); 133 135 fireGpsStatusChangeEvent(LiveGpsStatus.GpsStatus.CONNECTION_FAILED, tr("Connection Failed")); 134 136 try { 135 137 Thread.sleep(1000); 136 } catch (InterruptedException ignore) { 137 Logging.trace(ignore); 138 } catch (InterruptedException interruptedException) { 139 Logging.trace(interruptedException); 140 Thread.currentThread().interrupt(); 138 141 } 139 142 } … … 155 158 throw new IOException(); 156 159 157 if (JSONProtocol == true)160 if (JSONProtocol) 158 161 gpsData = parseJSON(line); 159 162 else … … 173 176 try { 174 177 Thread.sleep(1000); 175 } catch (InterruptedException ignore) { 176 Logging.trace(ignore); 178 } catch (InterruptedException interruptedException) { 179 Logging.trace(interruptedException); 180 Thread.currentThread().interrupt(); 177 181 } 178 182 // send warning to layer … … 219 223 } 220 224 221 if (gpsdSocket == null || gpsdSocket.isConnected() == false) {225 if (gpsdSocket == null || !gpsdSocket.isConnected()) { 222 226 if (skipTime == 0) 223 227 skipTime = System.currentTimeMillis()+60000; … … 237 241 return; 238 242 239 try {240 greeting = Json.createReader(new StringReader(line)).readObject();243 try (JsonReader reader = Json.createReader(new StringReader(line))) { 244 greeting = reader.readObject(); 241 245 type = greeting.getString("class"); 242 if ( type.equals("VERSION")) {246 if ("VERSION".equals(type)) { 243 247 release = greeting.getString("release"); 244 248 Logging.info("LiveGps: Connected to gpsd " + release); … … 252 256 fireGpsStatusChangeEvent(LiveGpsStatus.GpsStatus.CONNECTED, tr("Connected")); 253 257 } 254 } 255 256 if (JSONProtocol == true) { 258 Logging.trace(jex); 259 } 260 261 if (JSONProtocol) { 257 262 JsonObject watch = Json.createObjectBuilder() 258 263 .add("enable", true) … … 276 281 gpsdSocket.close(); 277 282 gpsdSocket = null; 278 } catch ( Exception e) {283 } catch (IOException e) { 279 284 Logging.warn("LiveGps: Unable to close socket; reconnection may not be possible"); 280 } 281 } 282 283 private LiveGpsData parseJSON(String line) { 285 Logging.trace(e); 286 } 287 } 288 289 private static LiveGpsData parseJSON(String line) { 284 290 JsonObject report; 285 291 double lat, lon; … … 289 295 float epy = 0; 290 296 291 try {292 report = Json.createReader(new StringReader(line)).readObject();297 try (JsonReader reader = Json.createReader(new StringReader(line))) { 298 report = reader.readObject(); 293 299 } catch (JsonException jex) { 294 300 Logging.warn("LiveGps: line read from gpsd is not a JSON object:" + line); 301 Logging.trace(jex); 295 302 return null; 296 303 } 297 if (! report.getString("class").equals("TPV") || report.getInt("mode") < 2)304 if (!"TPV".equals(report.getString("class")) || report.getInt("mode") < 2) 298 305 return null; 299 306 … … 322 329 } 323 330 324 private LiveGpsData parseOld(String line) {331 private static LiveGpsData parseOld(String line) { 325 332 String[] words; 326 double lat = 0;327 double lon = 0;333 double lat; 334 double lon; 328 335 float speed = 0; 329 336 float course = 0; 330 337 331 338 words = line.split(","); 332 if ((words.length == 0) || ! words[0].equals("GPSD"))339 if ((words.length == 0) || !"GPSD".equals(words[0])) 333 340 return null; 334 341 -
applications/editors/josm/plugins/opendata/build.xml
r35978 r36122 1 1 <?xml version="1.0" encoding="utf-8"?> 2 2 <project name="opendata" default="dist" basedir="."> 3 <property name="plugin.main.version" value="18 494"/>3 <property name="plugin.main.version" value="18723"/> 4 4 <property name="plugin.author" value="Don-vip"/> 5 5 <property name="plugin.class" value="org.openstreetmap.josm.plugins.opendata.OdPlugin"/> -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/GeographicReader.java
r36072 r36122 18 18 import java.util.TreeMap; 19 19 20 import ja vax.json.JsonArray;21 import ja vax.json.JsonObject;22 import ja vax.json.JsonReader;23 import ja vax.json.spi.JsonProvider;20 import jakarta.json.JsonArray; 21 import jakarta.json.JsonObject; 22 import jakarta.json.JsonReader; 23 import jakarta.json.spi.JsonProvider; 24 24 import javax.swing.JOptionPane; 25 25 … … 238 238 // CHECKSTYLE.OFF: LineLength 239 239 dlg.setContent("<html>" + 240 tr("JOSM was unable to find a strict mathematical transformation between ''{0}'' and WGS84.<br /><br />"+ 241 "Do you want to try a <i>lenient</i> method, which will perform a non-precise transformation (<b>with location errors up to 1 km</b>) ?<br/><br/>"+ 240 tr("JOSM was unable to find a strict mathematical transformation between ''{0}'' and WGS84.<br /><br />" + 241 "Do you want to try a <i>lenient</i> method, which will perform a non-precise transformation " + 242 "(<b>with location errors up to 1 km</b>) ?<br/><br/>"+ 242 243 "If so, <b>do NOT upload</b> such data to OSM !", crs.getName())+ 243 244 "</html>"); -
applications/editors/josm/plugins/pointInfo/build.xml
r35565 r36122 5 5 <property name="commit.message" value="PointInfo: Switch to SVG icons"/> 6 6 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 7 <property name="plugin.main.version" value="1 4153"/>7 <property name="plugin.main.version" value="18723"/> 8 8 9 9 <!-- plugin can load at runtime --> -
applications/editors/josm/plugins/pointInfo/src/org/openstreetmap/josm/plugins/pointinfo/PointInfoPlugin.java
r34545 r36122 73 73 if (Config.getPref().getBoolean("plugin.pointinfo.automode", true)) { 74 74 ReverseRecord r = ReverseFinder.queryNominatim(pos); 75 Iterator i = modules.values().iterator();75 Iterator<AbstractPointInfoModule> i = modules.values().iterator(); 76 76 while (module == null && i.hasNext()) { 77 AbstractPointInfoModule m = (AbstractPointInfoModule)i.next();77 AbstractPointInfoModule m = i.next(); 78 78 if (r.matchAnyArea(m.getArea())) { 79 79 module = m; -
applications/editors/josm/plugins/pointInfo/src/org/openstreetmap/josm/plugins/pointinfo/ReverseFinder.java
r34545 r36122 4 4 import java.io.ByteArrayInputStream; 5 5 import java.io.IOException; 6 import java.net.UR L;6 import java.net.URI; 7 7 import java.nio.charset.StandardCharsets; 8 8 import java.util.Locale; 9 9 10 import ja vax.json.Json;11 import ja vax.json.JsonObject;12 import ja vax.json.JsonReader;10 import jakarta.json.Json; 11 import jakarta.json.JsonObject; 12 import jakarta.json.JsonReader; 13 13 14 14 import org.openstreetmap.josm.data.coor.LatLon; … … 19 19 * @author Javier Sánchez Portero 20 20 */ 21 public class ReverseFinder {21 public final class ReverseFinder { 22 22 23 23 public static final String NOMINATIM_URL = "https://nominatim.openstreetmap.org/reverse?format=json&lat=%f&lon=%f"; … … 34 34 public static ReverseRecord queryNominatim(LatLon pos) throws IOException { 35 35 String request = String.format(Locale.ENGLISH, NOMINATIM_URL, pos.lat(), pos.lon()); 36 String result = HttpClient.create( new URL(request)).connect().fetchContent();36 String result = HttpClient.create(URI.create(request).toURL()).connect().fetchContent(); 37 37 JsonReader jsonReader = Json.createReader(new ByteArrayInputStream(result.getBytes(StandardCharsets.UTF_8))); 38 38 JsonObject obj = jsonReader.readObject(); 39 39 jsonReader.close(); 40 ReverseRecord record = new ReverseRecord(obj); 41 return record; 40 return new ReverseRecord(obj); 42 41 } 43 42 } -
applications/editors/josm/plugins/pointInfo/src/org/openstreetmap/josm/plugins/pointinfo/ReverseRecord.java
r34216 r36122 2 2 package org.openstreetmap.josm.plugins.pointinfo; 3 3 4 import ja vax.json.JsonObject;4 import jakarta.json.JsonObject; 5 5 6 6 /** … … 73 73 * @return match area matched 74 74 */ 75 public Boolean matchAnyArea(String area) {75 public boolean matchAnyArea(String area) { 76 76 if (area.equals(countryCode)) return true; 77 77 if (area.equals(country)) return true; -
applications/editors/josm/plugins/pointInfo/src/org/openstreetmap/josm/plugins/pointinfo/catastro/CatastroRecord.java
r34216 r36122 2 2 package org.openstreetmap.josm.plugins.pointinfo.catastro; 3 3 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 4 import java.io.IOException; 6 5 import java.io.InputStream; 7 6 import java.io.ByteArrayInputStream; … … 9 8 import java.util.ArrayList; 10 9 11 import ja vax.json.Json;12 import ja vax.json.JsonObject;10 import jakarta.json.Json; 11 import jakarta.json.JsonObject; 13 12 14 13 import javax.xml.parsers.DocumentBuilderFactory; 15 14 import javax.xml.parsers.DocumentBuilder; 15 import javax.xml.parsers.ParserConfigurationException; 16 16 17 import org.w3c.dom.Document; 17 18 import org.w3c.dom.NodeList; … … 20 21 21 22 import org.openstreetmap.josm.tools.Logging; 22 import java.util.logging.Level;23 import org.xml.sax.SAXException; 23 24 24 25 /** … … 50 51 */ 51 52 private void init() { 52 errors = new ArrayList< JsonObject>();53 coords = new ArrayList< JsonObject>();53 errors = new ArrayList<>(); 54 coords = new ArrayList<>(); 54 55 } 55 56 … … 68 69 parseErrors(doc); 69 70 parseCoordenadas(doc); 70 } catch ( Exception e) {71 Logging. log(Level.WARNING,e);71 } catch (ParserConfigurationException | SAXException | IOException e) { 72 Logging.warn(e); 72 73 } 73 74 } 74 75 75 76 private void parseErrors(Document doc) { 76 try { 77 NodeList nList = doc.getElementsByTagName("err"); 78 for (int temp = 0; temp < nList.getLength(); temp++) { 79 Node nNode = nList.item(temp); 80 if (nNode.getNodeType() == Node.ELEMENT_NODE) { 81 Element eElement = (Element) nNode; 82 String code = eElement.getElementsByTagName("cod").item(0).getTextContent(); 83 String desc = eElement.getElementsByTagName("des").item(0).getTextContent(); 84 JsonObject error = Json.createObjectBuilder() 85 .add("code", code) 86 .add("desc", desc) 87 .build(); 88 errors.add(error); 89 Logging.info("Error: (" + code + ") " + desc); 90 } 77 NodeList nList = doc.getElementsByTagName("err"); 78 for (int temp = 0; temp < nList.getLength(); temp++) { 79 Node nNode = nList.item(temp); 80 if (nNode.getNodeType() == Node.ELEMENT_NODE) { 81 Element eElement = (Element) nNode; 82 String code = eElement.getElementsByTagName("cod").item(0).getTextContent(); 83 String desc = eElement.getElementsByTagName("des").item(0).getTextContent(); 84 JsonObject error = Json.createObjectBuilder() 85 .add("code", code) 86 .add("desc", desc) 87 .build(); 88 errors.add(error); 89 Logging.info("Error: (" + code + ") " + desc); 91 90 } 92 } catch (Exception e) {93 Logging.log(Level.WARNING, "errors:", e);94 91 } 95 92 } 96 93 97 94 private void parseCoordenadas(Document doc) { 98 try { 99 NodeList nList = doc.getElementsByTagName("coord"); 100 for (int temp = 0; temp < nList.getLength(); temp++) { 101 Node nNode = nList.item(temp); 102 if (nNode.getNodeType() == Node.ELEMENT_NODE) { 103 Element eElement = (Element) nNode; 104 String ref = eElement.getElementsByTagName("pc1").item(0).getTextContent() 105 + eElement.getElementsByTagName("pc2").item(0).getTextContent(); 106 String address = eElement.getElementsByTagName("ldt") 107 .item(0).getTextContent(); 108 JsonObject coord = Json.createObjectBuilder() 109 .add("ref", ref) 110 .add("address", address) 111 .build(); 112 coords.add(coord); 113 Logging.info("Referencia Catastral: " + ref); 114 Logging.info("Dirección: " + address); 115 } 95 NodeList nList = doc.getElementsByTagName("coord"); 96 for (int temp = 0; temp < nList.getLength(); temp++) { 97 Node nNode = nList.item(temp); 98 if (nNode.getNodeType() == Node.ELEMENT_NODE) { 99 Element eElement = (Element) nNode; 100 String ref = eElement.getElementsByTagName("pc1").item(0).getTextContent() 101 + eElement.getElementsByTagName("pc2").item(0).getTextContent(); 102 String address = eElement.getElementsByTagName("ldt") 103 .item(0).getTextContent(); 104 JsonObject coord = Json.createObjectBuilder() 105 .add("ref", ref) 106 .add("address", address) 107 .build(); 108 coords.add(coord); 109 Logging.info("Referencia Catastral: " + ref); 110 Logging.info("Dirección: " + address); 116 111 } 117 } catch (Exception e) {118 Logging.log(Level.WARNING, "coordenadas:", e);119 112 } 120 113 } … … 130 123 for (JsonObject coord: coords) { 131 124 r.append("<i><u>Información de la parcela</u></i><br/>"); 132 r.append("<b>Referencia Catastral: </b>" + coord.getString("ref") + "<br/>"); 133 r.append("<b>Dirección: </b>" + coord.getString("address") + "<br/>"); 134 r.append("<b>Fotografía de fachada:</b> <a href=\"" 135 + fURL + coord.getString("ref") + "\">" 136 + "Enlace a web de Catastro</a> (<a href=\"" 137 + eURL + fURL + coord.getString("ref") 138 + "\">metadatos</a>)<br/><br/>"); 125 r.append("<b>Referencia Catastral: </b>").append(coord.getString("ref")).append("<br/>"); 126 r.append("<b>Dirección: </b>").append(coord.getString("address")).append("<br/>"); 127 r.append("<b>Fotografía de fachada:</b> <a href=\"").append(fURL) 128 .append(coord.getString("ref")) 129 .append("\">") 130 .append("Enlace a web de Catastro</a> (<a href=\"") 131 .append(eURL).append(fURL) 132 .append(coord.getString("ref")).append("\">metadatos</a>)<br/><br/>"); 139 133 } 140 if ( errors.size() > 0) {134 if (!errors.isEmpty()) { 141 135 r.append("<i><u>Errores</u></i><br/>"); 142 136 } 143 137 for (JsonObject error: errors) { 144 r.append("(" + error.getString("code") +") ");145 r.append(error.getString("desc") +"<br/>");138 r.append("(").append(error.getString("code")).append(") "); 139 r.append(error.getString("desc")).append("<br/>"); 146 140 } 147 141 r.append("<hr/>"); -
applications/editors/josm/plugins/pointInfo/src/org/openstreetmap/josm/plugins/pointinfo/ruian/RuianRecord.java
r34545 r36122 9 9 import java.util.Arrays; 10 10 import java.util.Collection; 11 import java.util.IllegalFormatException; 11 12 import java.util.LinkedList; 12 13 import java.util.logging.Level; 13 14 14 import javax.json.Json; 15 import javax.json.JsonArray; 16 import javax.json.JsonObject; 17 import javax.json.JsonReader; 18 import javax.json.JsonValue; 19 15 import jakarta.json.Json; 16 import jakarta.json.JsonArray; 17 import jakarta.json.JsonObject; 18 import jakarta.json.JsonReader; 19 import jakarta.json.JsonValue; 20 21 import org.apache.commons.jcs3.access.exception.InvalidArgumentException; 20 22 import org.openstreetmap.josm.command.AddCommand; 21 23 import org.openstreetmap.josm.command.Command; … … 39 41 40 42 // CHECKSTYLE.OFF: SingleSpaceSeparator 41 private double m_coor_lat, m_coor_lon;42 private String m_source;43 44 private long m_objekt_ruian_id;45 private int m_objekt_podlazi;46 private int m_objekt_byty;47 private String m_objekt_zpusob_vyuziti;48 private String m_objekt_zpusob_vyuziti_kod;49 private String m_objekt_zpusob_vyuziti_key;50 private String m_objekt_zpusob_vyuziti_val;51 private String m_objekt_dokonceni;52 private String m_objekt_plati_od;53 54 private String m_err_user;55 private String m_err_date;56 private String m_err_type;57 private String m_err_note;58 59 private ArrayList<ObjectWithoutGeometry> m _so_bez_geometrie;60 61 private ArrayList<AddrPlaces> m _adresni_mista;62 63 private long m_parcela_ruian_id;64 private String m_parcela_druh_pozemku;65 private String m_parcela_zpusob_vyuziti;66 private String m_parcela_plati_od;67 68 private long m_ulice_ruian_id;69 private String m_ulice_jmeno;70 71 private long m_katastr_ruian_id;72 private String m_katastr_nazev;73 private long m_katastr_obec_kod;74 private String m_katastr_obec;75 private long m_katastr_okres_kod;76 private String m_katastr_okres;77 private long m_katastr_kraj_kod;78 private String m_katastr_kraj;43 private double mCoorLat, mCoorLon; 44 private String mSource; 45 46 private long mObjektRuianId; 47 private int mObjektPodlazi; 48 private int mObjektByty; 49 private String mObjektZpusobVyuziti; 50 private String mObjektZpusobVyuzitiKod; 51 private String mObjektZpusobVyuzitiKey; 52 private String mObjektZpusobVyuzitiVal; 53 private String mObjektDokonceni; 54 private String mObjektPlatiOd; 55 56 private String mErrUser; 57 private String mErrDate; 58 private String mErrType; 59 private String mErrNote; 60 61 private ArrayList<ObjectWithoutGeometry> mSoBezGeometrie; 62 63 private ArrayList<AddrPlaces> mAdresniMista; 64 65 private long mParcelaRuianId; 66 private String mParcelaDruhPozemku; 67 private String mParcelaZpusobVyuziti; 68 private String mParcelaPlatiOd; 69 70 private long mUliceRuianId; 71 private String mUliceJmeno; 72 73 private long mKatastrRuianId; 74 private String mKatastrNazev; 75 private long mKatastrObecKod; 76 private String mKatastrObec; 77 private long mKatastrOkresKod; 78 private String mKatastrOkres; 79 private long mKatastrKrajKod; 80 private String mKatastrKraj; 79 81 // CHECKSTYLE.ON: SingleSpaceSeparator 80 82 … … 93 95 private void init() { 94 96 95 m _coor_lat = 0;96 m _coor_lon = 0;97 m _source = "";98 99 m _objekt_ruian_id = 0;100 m _objekt_podlazi = 0;101 m _objekt_byty = 0;102 m _objekt_zpusob_vyuziti = "";103 m _objekt_zpusob_vyuziti_kod = "";104 m _objekt_zpusob_vyuziti_key = "";105 m _objekt_zpusob_vyuziti_val = "";106 m _objekt_dokonceni = "";107 m _objekt_plati_od = "";108 109 m _err_user = "";110 m _err_date = "";111 m _err_type = "";112 m _err_note = "";113 114 m _so_bez_geometrie = new ArrayList<>();115 m _adresni_mista = new ArrayList<>();116 117 m _parcela_ruian_id = 0;118 m _parcela_druh_pozemku = "";119 m _parcela_zpusob_vyuziti = "";120 m _parcela_plati_od = "";121 122 m _ulice_ruian_id = 0;123 m _ulice_jmeno = "";124 125 m _katastr_ruian_id = 0;126 m _katastr_nazev = "";127 m _katastr_obec_kod = 0;128 m _katastr_obec = "";129 m _katastr_okres_kod = 0;130 m _katastr_okres = "";131 m _katastr_kraj_kod = 0;132 m _katastr_kraj = "";97 mCoorLat = 0; 98 mCoorLon = 0; 99 mSource = ""; 100 101 mObjektRuianId = 0; 102 mObjektPodlazi = 0; 103 mObjektByty = 0; 104 mObjektZpusobVyuziti = ""; 105 mObjektZpusobVyuzitiKod = ""; 106 mObjektZpusobVyuzitiKey = ""; 107 mObjektZpusobVyuzitiVal = ""; 108 mObjektDokonceni = ""; 109 mObjektPlatiOd = ""; 110 111 mErrUser = ""; 112 mErrDate = ""; 113 mErrType = ""; 114 mErrNote = ""; 115 116 mSoBezGeometrie = new ArrayList<>(); 117 mAdresniMista = new ArrayList<>(); 118 119 mParcelaRuianId = 0; 120 mParcelaDruhPozemku = ""; 121 mParcelaZpusobVyuziti = ""; 122 mParcelaPlatiOd = ""; 123 124 mUliceRuianId = 0; 125 mUliceJmeno = ""; 126 127 mKatastrRuianId = 0; 128 mKatastrNazev = ""; 129 mKatastrObecKod = 0; 130 mKatastrObec = ""; 131 mKatastrOkresKod = 0; 132 mKatastrOkres = ""; 133 mKatastrKrajKod = 0; 134 mKatastrKraj = ""; 133 135 } 134 136 … … 169 171 } 170 172 171 private JsonObject getSafeJsonObject(JsonObject obj, String key) {173 private static JsonObject getSafeJsonObject(JsonObject obj, String key) { 172 174 JsonValue val = obj.get(key); 173 175 if (val instanceof JsonObject) { … … 187 189 188 190 try { 189 m _coor_lat = Double.parseDouble(coorObjekt.getString("lat"));191 mCoorLat = Double.parseDouble(coorObjekt.getString("lat")); 190 192 } catch (NumberFormatException e) { 191 Logging. log(Level.WARNING, "coordinates.lat:", e);192 } 193 194 try { 195 m _coor_lon = Double.parseDouble(coorObjekt.getString("lon"));193 Logging.warn("coordinates.lat: {0}", e); 194 } 195 196 try { 197 mCoorLon = Double.parseDouble(coorObjekt.getString("lon")); 196 198 } catch (NumberFormatException e) { 197 Logging. log(Level.WARNING, "coordinates.lon:", e);198 } 199 200 try { 201 m _source = obj.getString("source");199 Logging.warn("coordinates.lon: {0}", e); 200 } 201 202 try { 203 mSource = obj.getString("source"); 202 204 } catch (RuntimeException e) { 203 Logging. log(Level.WARNING, "source:", e);204 } 205 206 } catch ( Exception e) {207 Logging. log(Level.WARNING, "coordinates:", e);205 Logging.warn("source: {0}", e); 206 } 207 208 } catch (ClassCastException e) { 209 Logging.warn("coordinates: {0}", e); 208 210 } 209 211 } … … 214 216 215 217 try { 216 m _objekt_ruian_id = Long.parseLong(stavebniObjekt.getString("ruian_id"));217 } catch ( Exception e) {218 mObjektRuianId = Long.parseLong(stavebniObjekt.getString("ruian_id", null)); 219 } catch (NumberFormatException e) { 218 220 Logging.log(Level.WARNING, "stavebni_objekt.ruian_id:", e); 219 221 } 220 222 221 223 try { 222 m _objekt_podlazi = Integer.parseInt(stavebniObjekt.getString("pocet_podlazi"));223 } catch ( Exception e) {224 mObjektPodlazi = Integer.parseInt(stavebniObjekt.getString("pocet_podlazi", null)); 225 } catch (NumberFormatException e) { 224 226 Logging.log(Level.WARNING, "stavebni_objekt.pocet_podlazi:", e); 225 227 } 226 228 227 229 try { 228 m _objekt_byty = Integer.parseInt(stavebniObjekt.getString("pocet_bytu"));229 } catch ( Exception e) {230 mObjektByty = Integer.parseInt(stavebniObjekt.getString("pocet_bytu", null)); 231 } catch (NumberFormatException e) { 230 232 Logging.log(Level.WARNING, "stavebni_objekt.pocet_bytu:", e); 231 233 } 232 234 233 try { 234 m_objekt_zpusob_vyuziti = stavebniObjekt.getString("zpusob_vyuziti"); 235 } catch (Exception e) { 236 Logging.log(Level.WARNING, "stavebni_objekt.zpusob_vyuziti:", e); 237 } 238 239 try { 240 m_objekt_zpusob_vyuziti_kod = stavebniObjekt.getString("zpusob_vyuziti_kod"); 241 } catch (Exception e) { 242 Logging.log(Level.WARNING, "stavebni_objekt.m_objekt_zpusob_vyuziti_kod:", e); 243 } 244 245 try { 246 m_objekt_zpusob_vyuziti_key = stavebniObjekt.getString("zpusob_vyuziti_key"); 247 } catch (Exception e) { 248 Logging.log(Level.WARNING, "stavebni_objekt.zpusob_vyuziti_key:", e); 249 } 250 251 try { 252 m_objekt_zpusob_vyuziti_val = stavebniObjekt.getString("zpusob_vyuziti_val"); 253 } catch (Exception e) { 254 Logging.log(Level.WARNING, "stavebni_objekt.m_objekt_zpusob_vyuziti_val:", e); 255 } 256 257 try { 258 m_objekt_plati_od = stavebniObjekt.getString("plati_od"); 259 } catch (Exception e) { 260 Logging.log(Level.WARNING, "stavebni_objekt.plati_od:", e); 261 } 262 263 try { 264 m_objekt_dokonceni = stavebniObjekt.getString("dokonceni"); 265 } catch (Exception e) { 266 Logging.log(Level.WARNING, "stavebni_objekt.dokonceni:", e); 267 } 268 269 } catch (Exception e) { 270 Logging.log(Level.WARNING, "stavebni_objekt:", e); 235 mObjektZpusobVyuziti = stavebniObjekt.getString("zpusob_vyuziti", null); 236 237 mObjektZpusobVyuzitiKod = stavebniObjekt.getString("zpusob_vyuziti_kod", null); 238 239 mObjektZpusobVyuzitiKey = stavebniObjekt.getString("zpusob_vyuziti_key", null); 240 241 mObjektZpusobVyuzitiVal = stavebniObjekt.getString("zpusob_vyuziti_val", null); 242 243 mObjektPlatiOd = stavebniObjekt.getString("plati_od", null); 244 245 mObjektDokonceni = stavebniObjekt.getString("dokonceni", null); 246 247 } catch (IllegalArgumentException e) { 248 Logging.warn("stavebni_objekt: {0}", e); 271 249 } 272 250 } … … 276 254 JsonObject errObjekt = getSafeJsonObject(obj, "nahlaseny_problem"); 277 255 278 try { 279 m_err_user = errObjekt.getString("uzivatel"); 280 } catch (Exception e) { 281 Logging.log(Level.WARNING, "nahlaseny_problem.uzivatel:", e); 282 } 283 284 try { 285 m_err_date = errObjekt.getString("datum"); 286 } catch (Exception e) { 287 Logging.log(Level.WARNING, "nahlaseny_problem.datum:", e); 288 } 289 290 try { 291 m_err_type = errObjekt.getString("duvod"); 292 } catch (Exception e) { 293 Logging.log(Level.WARNING, "nahlaseny_problem.duvod:", e); 294 } 295 296 try { 297 m_err_note = errObjekt.getString("poznamka"); 298 } catch (Exception e) { 299 Logging.log(Level.WARNING, "nahlaseny_problem.poznamka:", e); 300 } 301 302 } catch (Exception e) { 303 Logging.log(Level.WARNING, "nahlaseny_problem:", e); 256 mErrUser = errObjekt.getString("uzivatel", null); 257 258 mErrDate = errObjekt.getString("datum", null); 259 260 mErrType = errObjekt.getString("duvod", null); 261 262 mErrNote = errObjekt.getString("poznamka", null); 263 264 } catch (IllegalArgumentException e) { 265 Logging.warn("nahlaseny_problem: {0}", e); 304 266 } 305 267 } … … 314 276 315 277 try { 316 so.setRuianID(Long.parseLong(soBezGeom.getString("ruian_id" )));317 } catch ( Exception e) {278 so.setRuianID(Long.parseLong(soBezGeom.getString("ruian_id", null))); 279 } catch (NumberFormatException e) { 318 280 Logging.log(Level.WARNING, "so_bez_geometrie.ruian_id:", e); 319 281 } 320 282 321 283 try { 322 so.setPodlazi(Integer.parseInt(soBezGeom.getString("pocet_podlazi" )));323 } catch ( Exception e) {284 so.setPodlazi(Integer.parseInt(soBezGeom.getString("pocet_podlazi", null))); 285 } catch (NumberFormatException e) { 324 286 Logging.log(Level.WARNING, "so_bez_geometrie.pocet_podlazi:", e); 325 287 } 326 288 327 289 try { 328 so.setByty(Integer.parseInt(soBezGeom.getString("pocet_bytu" )));329 } catch ( Exception e) {290 so.setByty(Integer.parseInt(soBezGeom.getString("pocet_bytu", null))); 291 } catch (NumberFormatException e) { 330 292 Logging.log(Level.WARNING, "so_bez_geometrie.pocet_bytu:", e); 331 293 } 332 294 333 try { 334 so.setZpusobVyuziti(soBezGeom.getString("zpusob_vyuziti")); 335 } catch (Exception e) { 336 Logging.log(Level.WARNING, "so_bez_geometrie.zpusob_vyuziti:", e); 337 } 338 339 try { 340 so.setZpusobVyuzitiKod(soBezGeom.getString("zpusob_vyuziti_kod")); 341 } catch (Exception e) { 342 Logging.log(Level.WARNING, "so_bez_geometrie.zpusob_vyuziti_kod:", e); 343 } 344 345 try { 346 so.setZpusobVyuzitiKey(soBezGeom.getString("zpusob_vyuziti_key")); 347 } catch (Exception e) { 348 Logging.log(Level.WARNING, "so_bez_geometrie.zpusob_vyuziti_key:", e); 349 } 350 351 try { 352 so.setZpusobVyuzitiVal(soBezGeom.getString("zpusob_vyuziti_val")); 353 } catch (Exception e) { 354 Logging.log(Level.WARNING, "so_bez_geometrie.zpusob_vyuziti_val:", e); 355 } 356 357 try { 358 so.setDokonceni(soBezGeom.getString("dokonceni")); 359 } catch (Exception e) { 360 Logging.log(Level.WARNING, "so_bez_geometrie.dokonceni:", e); 361 } 362 363 try { 364 so.setPlatiOd(soBezGeom.getString("plati_od")); 365 } catch (Exception e) { 366 Logging.log(Level.WARNING, "so_bez_geometrie.plati_od:", e); 367 } 368 369 try { 370 so.setVzdalenost(Float.parseFloat(soBezGeom.getString("vzdalenost"))); 371 } catch (Exception e) { 372 Logging.log(Level.WARNING, "so_bez_geometrie.vzdalenost:", e); 373 } 374 375 m_so_bez_geometrie.add(so); 376 } 377 } catch (Exception e) { 378 Logging.log(Level.WARNING, "so_bez_geometrie:", e); 295 so.setZpusobVyuziti(soBezGeom.getString("zpusob_vyuziti", null)); 296 297 so.setZpusobVyuzitiKod(soBezGeom.getString("zpusob_vyuziti_kod", null)); 298 299 so.setZpusobVyuzitiKey(soBezGeom.getString("zpusob_vyuziti_key", null)); 300 301 so.setZpusobVyuzitiVal(soBezGeom.getString("zpusob_vyuziti_val", null)); 302 303 so.setDokonceni(soBezGeom.getString("dokonceni", null)); 304 305 so.setPlatiOd(soBezGeom.getString("plati_od", null)); 306 307 try { 308 so.setVzdalenost(Float.parseFloat(soBezGeom.getString("vzdalenost", null))); 309 } catch (NumberFormatException e) { 310 Logging.warn("so_bez_geometrie.vzdalenost: {0}", e); 311 } 312 313 mSoBezGeometrie.add(so); 314 } 315 } catch (ClassCastException e) { 316 Logging.warn("so_bez_geometrie: {0}", e); 379 317 } 380 318 } … … 389 327 390 328 try { 391 am.setRuianID(Long.parseLong(adresniMisto.getString("ruian_id" )));392 } catch ( Exception e) {329 am.setRuianID(Long.parseLong(adresniMisto.getString("ruian_id", null))); 330 } catch (NumberFormatException e) { 393 331 Logging.log(Level.WARNING, "adresni_mista.ruian_id:", e); 394 332 } … … 396 334 try { 397 335 JsonArray node = adresniMisto.getJsonArray("pozice"); 398 am.setPosition(new LatLon( 399 LatLon.roundToOsmPrecision(node.getJsonNumber(1).doubleValue()), 400 LatLon.roundToOsmPrecision(node.getJsonNumber(0).doubleValue())) 401 ); 402 } catch (Exception e) { 336 if (node.size() >= 2) { 337 am.setPosition(new LatLon( 338 LatLon.roundToOsmPrecision(node.getJsonNumber(1).doubleValue()), 339 LatLon.roundToOsmPrecision(node.getJsonNumber(0).doubleValue())) 340 ); 341 } 342 } catch (ClassCastException e) { 403 343 Logging.log(Level.WARNING, "adresni_mista.pozice:", e); 404 344 } 405 345 406 346 try { 407 am.setBudovaID(Long.parseLong(adresniMisto.getString("budova_kod" )));408 } catch ( Exception e) {347 am.setBudovaID(Long.parseLong(adresniMisto.getString("budova_kod", null))); 348 } catch (NumberFormatException e) { 409 349 Logging.log(Level.WARNING, "adresni_mista.budova_kod:", e); 410 350 } 411 351 412 try { 413 am.setCisloTyp(adresniMisto.getString("cislo_typ")); 414 } catch (Exception e) { 415 Logging.log(Level.WARNING, "adresni_mista.cislo_typ:", e); 416 } 417 418 try { 419 am.setCisloDomovni(adresniMisto.getString("cislo_domovni")); 420 } catch (Exception e) { 421 Logging.log(Level.WARNING, "adresni_mista.cislo_domovni:", e); 422 } 423 424 try { 425 am.setCisloOrientacni(adresniMisto.getString("cislo_orientacni")); 426 } catch (Exception e) { 427 Logging.log(Level.WARNING, "adresni_mista.cislo_orientacni:", e); 428 } 429 430 try { 431 am.setUliceID(Long.parseLong(adresniMisto.getString("ulice_kod"))); 432 } catch (Exception e) { 352 am.setCisloTyp(adresniMisto.getString("cislo_typ", null)); 353 354 am.setCisloDomovni(adresniMisto.getString("cislo_domovni", null)); 355 356 am.setCisloOrientacni(adresniMisto.getString("cislo_orientacni", null)); 357 358 try { 359 am.setUliceID(Long.parseLong(adresniMisto.getString("ulice_kod", null))); 360 } catch (NumberFormatException e) { 433 361 Logging.log(Level.WARNING, "adresni_mista.ulice_kod:", e); 434 362 } 435 363 436 try { 437 am.setUlice(adresniMisto.getString("ulice")); 438 } catch (Exception e) { 439 Logging.log(Level.WARNING, "adresni_mista.ulice:", e); 440 } 441 442 try { 443 am.setCastObceID(Long.parseLong(adresniMisto.getString("cast_obce_kod"))); 444 } catch (Exception e) { 364 am.setUlice(adresniMisto.getString("ulice", null)); 365 366 try { 367 am.setCastObceID(Long.parseLong(adresniMisto.getString("cast_obce_kod", null))); 368 } catch (NumberFormatException e) { 445 369 Logging.log(Level.WARNING, "adresni_mista.cast_obce_kod:", e); 446 370 } 447 371 448 try { 449 am.setCastObce(adresniMisto.getString("cast_obce")); 450 } catch (Exception e) { 451 Logging.log(Level.WARNING, "adresni_mista.m_cast_obce:", e); 452 } 453 454 try { 455 am.setMestskaCastID(Long.parseLong(adresniMisto.getString("mestska_cast_kod"))); 456 } catch (Exception e) { 372 am.setCastObce(adresniMisto.getString("cast_obce", null)); 373 374 try { 375 am.setMestskaCastID(Long.parseLong(adresniMisto.getString("mestska_cast_kod", null))); 376 } catch (NumberFormatException e) { 457 377 Logging.log(Level.WARNING, "adresni_mista.mestska_cast_kod:", e); 458 378 } 459 379 460 try { 461 am.setMestskaCast(adresniMisto.getString("mestska_cast")); 462 } catch (Exception e) { 463 Logging.log(Level.WARNING, "adresni_mista.mestska_cast:", e); 464 } 465 466 try { 467 am.setObecID(Long.parseLong(adresniMisto.getString("obec_kod"))); 468 } catch (Exception e) { 380 am.setMestskaCast(adresniMisto.getString("mestska_cast", null)); 381 382 try { 383 am.setObecID(Long.parseLong(adresniMisto.getString("obec_kod", null))); 384 } catch (NumberFormatException e) { 469 385 Logging.log(Level.WARNING, "adresni_mista.obec_kod:", e); 470 386 } 471 387 472 try { 473 am.setObec(adresniMisto.getString("obec")); 474 } catch (Exception e) { 475 Logging.log(Level.WARNING, "adresni_mista.obec:", e); 476 } 477 478 try { 479 am.setOkresID(Long.parseLong(adresniMisto.getString("okres_kod"))); 480 } catch (Exception e) { 388 am.setObec(adresniMisto.getString("obec", null)); 389 390 try { 391 am.setOkresID(Long.parseLong(adresniMisto.getString("okres_kod", null))); 392 } catch (NumberFormatException e) { 481 393 Logging.log(Level.WARNING, "adresni_mista.okres_kod:", e); 482 394 } 483 395 484 try { 485 am.setOkres(adresniMisto.getString("okres")); 486 } catch (Exception e) { 487 Logging.log(Level.WARNING, "adresni_mista.okres:", e); 488 } 489 490 try { 491 am.setKrajID(Long.parseLong(adresniMisto.getString("kraj_kod"))); 492 } catch (Exception e) { 396 am.setOkres(adresniMisto.getString("okres", null)); 397 398 try { 399 am.setKrajID(Long.parseLong(adresniMisto.getString("kraj_kod", null))); 400 } catch (NumberFormatException e) { 493 401 Logging.log(Level.WARNING, "adresni_mista.kraj_kod:", e); 494 402 } 495 403 496 try { 497 am.setKraj(adresniMisto.getString("kraj")); 498 } catch (Exception e) { 499 Logging.log(Level.WARNING, "adresni_mista.kraj:", e); 500 } 501 502 try { 503 am.setPsc(adresniMisto.getString("psc")); 504 } catch (Exception e) { 505 Logging.log(Level.WARNING, "adresni_mista.psc:", e); 506 } 507 508 try { 509 am.setVzdalenost(Float.parseFloat(adresniMisto.getString("vzdalenost"))); 510 } catch (Exception e) { 404 am.setKraj(adresniMisto.getString("kraj", null)); 405 406 am.setPsc(adresniMisto.getString("psc", null)); 407 408 try { 409 am.setVzdalenost(Float.parseFloat(adresniMisto.getString("vzdalenost", null))); 410 } catch (NumberFormatException e) { 511 411 Logging.log(Level.WARNING, "adresni_mista.vzdalenost:", e); 512 412 } 513 413 514 m _adresni_mista.add(am);515 } 516 } catch ( Exception e) {414 mAdresniMista.add(am); 415 } 416 } catch (ClassCastException e) { 517 417 Logging.log(Level.WARNING, "adresni_mista:", e); 518 418 } … … 524 424 525 425 try { 526 m _parcela_ruian_id = Long.parseLong(parcela.getString("ruian_id"));527 } catch ( Exception e) {426 mParcelaRuianId = Long.parseLong(parcela.getString("ruian_id", null)); 427 } catch (NumberFormatException e) { 528 428 Logging.log(Level.WARNING, "parcela.ruian_id:", e); 529 429 } 530 430 531 try { 532 m_parcela_druh_pozemku = parcela.getString("druh_pozemku"); 533 } catch (Exception e) { 534 Logging.log(Level.WARNING, "parcela.druh_pozemku:", e); 535 } 536 537 try { 538 m_parcela_zpusob_vyuziti = parcela.getString("zpusob_vyuziti"); 539 } catch (Exception e) { 540 Logging.log(Level.WARNING, "parcela.zpusob_vyuziti:", e); 541 } 542 543 try { 544 m_parcela_plati_od = parcela.getString("plati_od"); 545 } catch (Exception e) { 546 Logging.log(Level.WARNING, "parcela.plati_od:", e); 547 } 548 549 } catch (Exception e) { 431 mParcelaDruhPozemku = parcela.getString("druh_pozemku", null); 432 433 mParcelaZpusobVyuziti = parcela.getString("zpusob_vyuziti", null); 434 435 mParcelaPlatiOd = parcela.getString("plati_od", null); 436 } catch (InvalidArgumentException e) { 550 437 Logging.log(Level.WARNING, "parcela:", e); 551 438 } … … 557 444 558 445 try { 559 m _ulice_ruian_id = Long.parseLong(ulice.getString("ruian_id"));560 } catch ( Exception e) {446 mUliceRuianId = Long.parseLong(ulice.getString("ruian_id", null)); 447 } catch (NumberFormatException e) { 561 448 Logging.log(Level.WARNING, "ulice.ruian_id:", e); 562 449 } 563 450 564 try { 565 m_ulice_jmeno = ulice.getString("jmeno"); 566 } catch (Exception e) { 567 Logging.log(Level.WARNING, "ulice.jmeno:", e); 568 } 569 570 } catch (Exception e) { 451 mUliceJmeno = ulice.getString("jmeno", null); 452 453 } catch (IllegalArgumentException e) { 571 454 Logging.log(Level.WARNING, "ulice:", e); 572 455 } … … 578 461 579 462 try { 580 m _katastr_ruian_id = Long.parseLong(katastr.getString("ruian_id"));581 } catch ( Exception e) {463 mKatastrRuianId = Long.parseLong(katastr.getString("ruian_id", null)); 464 } catch (NumberFormatException e) { 582 465 Logging.log(Level.WARNING, "katastr.ruian_id:", e); 583 466 } 584 467 585 try { 586 m_katastr_nazev = katastr.getString("nazev"); 587 } catch (Exception e) { 588 Logging.log(Level.WARNING, "katastr.nazev:", e); 589 } 590 591 try { 592 m_katastr_obec_kod = Long.parseLong(katastr.getString("obec_kod")); 593 } catch (Exception e) { 468 mKatastrNazev = katastr.getString("nazev", null); 469 470 try { 471 mKatastrObecKod = Long.parseLong(katastr.getString("obec_kod", null)); 472 } catch (NumberFormatException e) { 594 473 Logging.log(Level.WARNING, "katastr.obec_kod:", e); 595 474 } 596 475 597 try { 598 m_katastr_obec = katastr.getString("obec"); 599 } catch (Exception e) { 600 Logging.log(Level.WARNING, "katastr.okres:", e); 601 } 602 603 try { 604 m_katastr_okres_kod = Long.parseLong(katastr.getString("okres_kod")); 605 } catch (Exception e) { 476 mKatastrObec = katastr.getString("obec", null); 477 478 try { 479 mKatastrOkresKod = Long.parseLong(katastr.getString("okres_kod", null)); 480 } catch (NumberFormatException e) { 606 481 Logging.log(Level.WARNING, "katastr.okres_kod:", e); 607 482 } 608 483 609 try { 610 m_katastr_okres = katastr.getString("okres"); 611 } catch (Exception e) { 612 Logging.log(Level.WARNING, "katastr.okres:", e); 613 } 614 615 try { 616 m_katastr_kraj_kod = Long.parseLong(katastr.getString("kraj_kod")); 617 } catch (Exception e) { 484 mKatastrOkres = katastr.getString("okres", null); 485 486 try { 487 mKatastrKrajKod = Long.parseLong(katastr.getString("kraj_kod", null)); 488 } catch (NumberFormatException e) { 618 489 Logging.log(Level.WARNING, "katastr.kraj_kod:", e); 619 490 } 620 491 621 try { 622 m_katastr_kraj = katastr.getString("kraj"); 623 } catch (Exception e) { 624 Logging.log(Level.WARNING, "katastr.kraj:", e); 625 } 626 627 } catch (Exception e) { 492 mKatastrKraj = katastr.getString("kraj", null); 493 494 } catch (IllegalArgumentException e) { 628 495 Logging.log(Level.WARNING, "katastr:", e); 629 496 } … … 636 503 public String getHtml() { 637 504 638 String icon _ext_link = "<img src=" +getClass().getResource(505 String iconExtLink = "<img src=" +getClass().getResource( 639 506 "/images/dialogs/open-external-link.png")+" border=0 alt=\"Zobrazit na externích stránkách\"/>"; 640 String icon _ext_link_ruian = "<img src=" +getClass().getResource(507 String iconExtLinkRuian = "<img src=" +getClass().getResource( 641 508 "/images/dialogs/open-external-link.png")+" border=0 alt=\"Zobrazit na stránkách RUIAN\"/>"; 642 String icon _ext_link_kn = "<img src=" +getClass().getResource(509 String iconExtLinkKn = "<img src=" +getClass().getResource( 643 510 "/images/dialogs/open-external-link-kn.png")+" border=0 alt=\"Zobrazit na stránkách katastru nemovitostí\"/>"; 644 String icon _copy_tags = "<img src=" +getClass().getResource(511 String iconCopyTags = "<img src=" +getClass().getResource( 645 512 "/images/dialogs/copy-tags.png")+" border=0 alt=\"Kopírovat tagy\"/>"; 646 String icon _create_addr = "<img src=" +getClass().getResource(513 String iconCreateAddr = "<img src=" +getClass().getResource( 647 514 "/images/dialogs/create-addr.png")+" border=0 alt=\"Vytvořit adresní bod\"/>"; 648 String icon _create_addr_ruian = "<img src=" +getClass().getResource(515 String iconCreateAddrRuian = "<img src=" +getClass().getResource( 649 516 "/images/dialogs/create-addr-ruian.png")+" border=0 alt=\"Vytvořit adresní bod dle RUIANu\"/>"; 650 String icon _ruian_error = "<img src=" +getClass().getResource(517 String iconRuianError = "<img src=" +getClass().getResource( 651 518 "/images/dialogs/create-bug-report.png")+" border=0 alt=\"Nahlásit problém v datech\"/>"; 652 519 // CHECKSTYLE.OFF: LineLength 653 String url _cpost = "http://www.postaonline.cz/vyhledani-psc?p_p_id=psc_WAR_pcpvpp&p_p_lifecycle=1&p_p_state=normal&p_p_mode=view&p_p_col_id=column-1&p_p_col_count=1&_psc_WAR_pcpvpp_struts.portlet.action=%2Fview%2FdetailPost&_psc_WAR_pcpvpp_struts.portlet.mode=view&_psc_WAR_pcpvpp_zipCode=";520 String urlCpost = "https://www.postaonline.cz/vyhledani-psc?p_p_id=psc_WAR_pcpvpp&p_p_lifecycle=1&p_p_state=normal&p_p_mode=view&p_p_col_id=column-1&p_p_col_count=1&_psc_WAR_pcpvpp_struts.portlet.action=%2Fview%2FdetailPost&_psc_WAR_pcpvpp_struts.portlet.mode=view&_psc_WAR_pcpvpp_zipCode="; 654 521 // CHECKSTYLE.ON: LineLength 655 String url _stavebni_objekt = "http://vdp.cuzk.cz/vdp/ruian/stavebniobjekty/";656 String url _adresni_misto = "http://vdp.cuzk.cz/vdp/ruian/adresnimista/";657 String url _parcela = "http://vdp.cuzk.cz/vdp/ruian/parcely/";658 String url _katastralni_uzemi = "http://vdp.cuzk.cz/vdp/ruian/katastralniuzemi/";659 String url _ulice = "http://vdp.cuzk.cz/vdp/ruian/ulice/";660 String url _mistni_cast = "http://vdp.cuzk.cz/vdp/ruian/castiobce/";661 String url _mestska_cast = "http://vdp.cuzk.cz/vdp/ruian/mestskecasti/";662 String url _obec = "http://vdp.cuzk.cz/vdp/ruian/obce/";663 String url _okres = "http://vdp.cuzk.cz/vdp/ruian/okresy/";664 String url _kraj = "http://vdp.cuzk.cz/vdp/ruian/vusc/";665 String url _vlastnici = "http://vdp.cuzk.cz/vdp/ruian/vlastnici?typ=";666 667 String url _ruian_error = "http://ruian.poloha.net/building.php?kod=";522 String urlStavebniObjekt = "https://vdp.cuzk.cz/vdp/ruian/stavebniobjekty/"; 523 String urlAdresniMisto = "https://vdp.cuzk.cz/vdp/ruian/adresnimista/"; 524 String urlParcela = "https://vdp.cuzk.cz/vdp/ruian/parcely/"; 525 String urlKatastralniUzemi = "https://vdp.cuzk.cz/vdp/ruian/katastralniuzemi/"; 526 String urlUlice = "https://vdp.cuzk.cz/vdp/ruian/ulice/"; 527 String urlMistniCast = "https://vdp.cuzk.cz/vdp/ruian/castiobce/"; 528 String urlMestskaCast = "https://vdp.cuzk.cz/vdp/ruian/mestskecasti/"; 529 String urlObec = "https://vdp.cuzk.cz/vdp/ruian/obce/"; 530 String urlOkres = "https://vdp.cuzk.cz/vdp/ruian/okresy/"; 531 String urlKraj = "https://vdp.cuzk.cz/vdp/ruian/vusc/"; 532 String urlVlastnici = "https://vdp.cuzk.cz/vdp/ruian/vlastnici?typ="; 533 534 String urlRuianError = "http://ruian.poloha.net/building.php?kod="; 668 535 669 536 StringBuilder r = new StringBuilder(); 670 537 671 if (m _objekt_ruian_id == 0 &&672 m _parcela_ruian_id == 0 &&673 m _adresni_mista.size() == 0&&674 m _ulice_ruian_id == 0 &&675 m _katastr_ruian_id == 0)538 if (mObjektRuianId == 0 && 539 mParcelaRuianId == 0 && 540 mAdresniMista.isEmpty() && 541 mUliceRuianId == 0 && 542 mKatastrRuianId == 0) 676 543 return ""; 677 544 678 545 r.append("<html><body bgcolor=\"white\" color=\"black\" ><table><tr><td>"); 679 546 r.append("<br/>"); 680 if (m_objekt_ruian_id > 0) { 681 r.append("<i><u>Informace o budově</u></i><br/>") 682 .append("<b>RUIAN id: </b>"+ m_objekt_ruian_id +" <a href="+ url_stavebni_objekt + m_objekt_ruian_id +">" 683 + icon_ext_link_ruian + "</a>") 684 .append(" <a href="+ url_vlastnici + "so&id=" + m_objekt_ruian_id + ">"+ icon_ext_link_kn +"</a>") 685 .append(" <a href=file://tags.copy/building>"+ icon_copy_tags +"</a>") 686 .append(" <a href=" + url_ruian_error + m_objekt_ruian_id + ">"+ icon_ruian_error +"</a><br/>"); 687 if (m_adresni_mista.size() == 0) r.append("<b>Budova: </b> bez č.p./č.e<br/>"); 688 else if (m_adresni_mista.get(0).getCisloTyp().equals("Číslo popisné")) r.append("<b>Budova: </b>s číslem popisným<br/>"); 547 if (mObjektRuianId > 0) { 548 r.append("<i><u>Informace o budově</u></i><br/>").append("<b>RUIAN id: </b>") 549 .append(mObjektRuianId).append(" <a href=").append(urlStavebniObjekt) 550 .append(mObjektRuianId).append(">").append(iconExtLinkRuian).append("</a>") 551 .append(" <a href=").append(urlVlastnici).append("so&id=") 552 .append(mObjektRuianId).append(">").append(iconExtLinkKn).append("</a>") 553 .append(" <a href=file://tags.copy/building>").append(iconCopyTags).append("</a>") 554 .append(" <a href=").append(urlRuianError).append(mObjektRuianId).append(">") 555 .append(iconRuianError).append("</a><br/>"); 556 if (mAdresniMista.isEmpty()) r.append("<b>Budova: </b> bez č.p./č.e<br/>"); 557 else if ("Číslo popisné".equals(mAdresniMista.get(0).getCisloTyp())) r.append("<b>Budova: </b>s číslem popisným<br/>"); 689 558 else r.append("<b>Budova: </b>s číslem evidenčním<br/>"); 690 if (m _objekt_podlazi > 0) r.append("<b>Počet podlaží: </b>" + m_objekt_podlazi +"<br/>");691 if (m _objekt_byty > 0) r.append("<b>Počet bytů: </b>" + m_objekt_byty +"<br/>");692 r.append("<b>Způsob využití: </b>" + m_objekt_zpusob_vyuziti +"<br/>")693 .append("<b>Datum dokončení: </b>" + m_objekt_dokonceni +"<br/>")694 .append("<b>Platí od: </b>" + m_objekt_plati_od +"<br/>");695 696 if (m _adresni_mista.size() > 1) {559 if (mObjektPodlazi > 0) r.append("<b>Počet podlaží: </b>").append(mObjektPodlazi).append("<br/>"); 560 if (mObjektByty > 0) r.append("<b>Počet bytů: </b>").append(mObjektByty).append("<br/>"); 561 r.append("<b>Způsob využití: </b>").append(mObjektZpusobVyuziti).append("<br/>") 562 .append("<b>Datum dokončení: </b>").append(mObjektDokonceni).append("<br/>") 563 .append("<b>Platí od: </b>").append(mObjektPlatiOd).append("<br/>"); 564 565 if (mAdresniMista.size() > 1) { 697 566 r.append("<i><u>Informace o adrese</u></i><br/>"); 698 567 // More address places 699 568 int i = 0; 700 r.append("<br/>") 701 .append("<b>" + m_adresni_mista.get(i).getCisloTyp() + "</b> (více adres)<b>: </b>" 702 + m_adresni_mista.get(i).getCisloDomovni() + "<br/>") 703 .append("<b>Část obce: </b>" + m_adresni_mista.get(i).getCastObce()) 704 .append(" <a href="+ url_mistni_cast + m_adresni_mista.get(i).getCastObceID() +">" + icon_ext_link_ruian + "</a><br/>"); 705 if (m_adresni_mista.get(i).getMestskaCast().length() > 0) { 706 r.append("<b>Městská část: </b>" + m_adresni_mista.get(i).getMestskaCast()) 707 .append(" <a href="+ url_mestska_cast + m_adresni_mista.get(i).getMestskaCastID() +">" 708 + icon_ext_link_ruian + "</a><br/>"); 709 } 710 r.append("<b>Obec: </b>" + m_adresni_mista.get(i).getObec()) 711 .append(" <a href="+ url_obec + m_adresni_mista.get(i).getObecID() +">" + icon_ext_link_ruian + "</a><br/>") 712 .append("<b>Okres: </b>" + m_adresni_mista.get(i).getOkres()) 713 .append(" <a href="+ url_okres + m_adresni_mista.get(i).getOkresID() +">" + icon_ext_link_ruian + "</a><br/>") 714 .append("<b>Kraj: </b>" + m_adresni_mista.get(i).getKraj()) 715 .append(" <a href="+ url_kraj + m_adresni_mista.get(i).getKrajID() +">" + icon_ext_link_ruian + "</a><br/>"); 716 717 } else if (m_adresni_mista.size() == 1 718 && (m_adresni_mista.get(0).getCisloDomovni() == null || m_adresni_mista.get(0).getCisloDomovni().isEmpty())) { 569 r.append("<br/>").append("<b>").append(mAdresniMista.get(i).getCisloTyp()) 570 .append("</b> (více adres)<b>: </b>").append(mAdresniMista.get(i).getCisloDomovni()) 571 .append("<br/>").append("<b>Část obce: </b>").append(mAdresniMista.get(i).getCastObce()) 572 .append(" <a href=").append(urlMistniCast).append(mAdresniMista.get(i).getCastObceID()) 573 .append(">").append(iconExtLinkRuian).append("</a><br/>"); 574 if (!mAdresniMista.get(i).getMestskaCast().isEmpty()) { 575 r.append("<b>Městská část: </b>").append(mAdresniMista.get(i).getMestskaCast()) 576 .append(" <a href=").append(urlMestskaCast) 577 .append(mAdresniMista.get(i).getMestskaCastID()).append(">") 578 .append(iconExtLinkRuian).append("</a><br/>"); 579 } 580 r.append("<b>Obec: </b>").append(mAdresniMista.get(i).getObec()).append(" <a href=") 581 .append(urlObec).append(mAdresniMista.get(i).getObecID()).append(">") 582 .append(iconExtLinkRuian).append("</a><br/>").append("<b>Okres: </b>") 583 .append(mAdresniMista.get(i).getOkres()).append(" <a href=") 584 .append(urlOkres).append(mAdresniMista.get(i).getOkresID()).append(">") 585 .append(iconExtLinkRuian).append("</a><br/>").append("<b>Kraj: </b>") 586 .append(mAdresniMista.get(i).getKraj()).append(" <a href=") 587 .append(urlKraj).append(mAdresniMista.get(i).getKrajID()).append(">") 588 .append(iconExtLinkRuian).append("</a><br/>"); 589 590 } else if (mAdresniMista.size() == 1 591 && (mAdresniMista.get(0).getCisloDomovni() == null || mAdresniMista.get(0).getCisloDomovni().isEmpty())) { 719 592 // Without building number 720 593 int i = 0; 721 r.append("<br/>") 722 .append("<i><u>Informace o adrese</u></i><br/>") 723 .append("<b>Budova: </b>" + m_adresni_mista.get(i).getCisloTyp() + "<br/>"); 724 if (m_adresni_mista.get(i).getMestskaCast().length() > 0) { 725 r.append("<b>Městská část: </b>" + m_adresni_mista.get(i).getMestskaCast()) 726 .append(" <a href="+ url_mestska_cast + m_adresni_mista.get(i).getMestskaCastID() +">" 727 + icon_ext_link_ruian + "</a><br/>"); 728 } 729 r.append("<b>Obec: </b>" + m_adresni_mista.get(i).getObec()) 730 .append(" <a href="+ url_obec + m_adresni_mista.get(i).getObecID() +">" + icon_ext_link_ruian + "</a><br/>") 731 .append("<b>Okres: </b>" + m_adresni_mista.get(i).getOkres()) 732 .append(" <a href="+ url_okres + m_adresni_mista.get(i).getOkresID() +">" + icon_ext_link_ruian + "</a><br/>") 733 .append("<b>Kraj: </b>" + m_adresni_mista.get(i).getKraj()) 734 .append(" <a href="+ url_kraj + m_adresni_mista.get(i).getKrajID() +">" + icon_ext_link_ruian + "</a><br/>"); 735 736 } else if (m_adresni_mista.size() == 1) { 594 r.append("<br/>").append("<i><u>Informace o adrese</u></i><br/>").append("<b>Budova: </b>") 595 .append(mAdresniMista.get(i).getCisloTyp()).append("<br/>"); 596 if (mAdresniMista.get(i).getMestskaCast().length() > 0) { 597 r.append("<b>Městská část: </b>").append(mAdresniMista.get(i).getMestskaCast()) 598 .append(" <a href=").append(urlMestskaCast) 599 .append(mAdresniMista.get(i).getMestskaCastID()).append(">").append(iconExtLinkRuian) 600 .append("</a><br/>"); 601 } 602 r.append("<b>Obec: </b>").append(mAdresniMista.get(i).getObec()).append(" <a href=") 603 .append(urlObec).append(mAdresniMista.get(i).getObecID()).append(">").append(iconExtLinkRuian) 604 .append("</a><br/>").append("<b>Okres: </b>").append(mAdresniMista.get(i).getOkres()) 605 .append(" <a href=").append(urlOkres).append(mAdresniMista.get(i).getOkresID()) 606 .append(">").append(iconExtLinkRuian).append("</a><br/>").append("<b>Kraj: </b>") 607 .append(mAdresniMista.get(i).getKraj()).append(" <a href=").append(urlKraj) 608 .append(mAdresniMista.get(i).getKrajID()).append(">").append(iconExtLinkRuian).append("</a><br/>"); 609 610 } else if (mAdresniMista.size() == 1) { 737 611 // Only one address place 738 612 int i = 0; 739 613 String x = ""; 740 String x _name = "";741 if (!m _adresni_mista.get(i).getCisloOrientacni().isEmpty()) {742 x = "/" + m _adresni_mista.get(i).getCisloOrientacni();743 x _name = "/orientační";614 String xName = ""; 615 if (!mAdresniMista.get(i).getCisloOrientacni().isEmpty()) { 616 x = "/" + mAdresniMista.get(i).getCisloOrientacni(); 617 xName = "/orientační"; 744 618 } 745 619 r.append("<br/>") 746 .append("<i><u>Informace o adrese</u></i><br/>") 747 .append("<b>RUIAN id: </b>"+ m_adresni_mista.get(i).getRuianID() +" <a href="+ url_adresni_misto 748 + m_adresni_mista.get(i).getRuianID() +">" + icon_ext_link_ruian + "</a>") 749 .append(" <a href=file://tags.copy/address:"+i+">"+ icon_copy_tags +"</a>") 750 .append(" <a href=file://tags.create/address:"+i+">"+ icon_create_addr +"</a>") 751 .append(" <a href=file://tags.create-on-place/address:"+i+">"+ icon_create_addr_ruian +"</a><br/>") 752 .append("<b>" + m_adresni_mista.get(i).getCisloTyp() + x_name + ": </b>" + m_adresni_mista.get(i).getCisloDomovni() + x) 620 .append("<i><u>Informace o adrese</u></i><br/>").append("<b>RUIAN id: </b>") 621 .append(mAdresniMista.get(i).getRuianID()).append(" <a href=").append(urlAdresniMisto) 622 .append(mAdresniMista.get(i).getRuianID()).append(">").append(iconExtLinkRuian).append("</a>") 623 .append(" <a href=file://tags.copy/address:").append(i).append(">").append(iconCopyTags) 624 .append("</a>").append(" <a href=file://tags.create/address:").append(i).append(">") 625 .append(iconCreateAddr).append("</a>").append(" <a href=file://tags.create-on-place/address:") 626 .append(i).append(">").append(iconCreateAddrRuian).append("</a><br/>").append("<b>") 627 .append(mAdresniMista.get(i).getCisloTyp()).append(xName).append(": </b>") 628 .append(mAdresniMista.get(i).getCisloDomovni()).append(x) 753 629 .append("<br/>"); 754 if (!m_adresni_mista.get(i).getUlice().isEmpty()) { 755 r.append("<b>Ulice: </b>" + m_adresni_mista.get(i).getUlice()) 756 .append(" <a href="+ url_ulice + m_adresni_mista.get(i).getUliceID() +">" + icon_ext_link_ruian + "</a><br/>"); 757 } 758 r.append("<b>Část obce: </b>" + m_adresni_mista.get(i).getCastObce()) 759 .append(" <a href="+ url_mistni_cast + m_adresni_mista.get(i).getCastObceID() +">" + icon_ext_link_ruian + "</a><br/>"); 760 if (m_adresni_mista.get(i).getMestskaCast().length() > 0) { 761 r.append("<b>Městská část: </b>" + m_adresni_mista.get(i).getMestskaCast()) 762 .append(" <a href="+ url_mestska_cast + m_adresni_mista.get(i).getMestskaCastID() +">" 763 + icon_ext_link_ruian + "</a><br/>"); 764 } 765 r.append("<b>Obec: </b>" + m_adresni_mista.get(i).getObec()) 766 .append(" <a href="+ url_obec + m_adresni_mista.get(i).getObecID() +">" + icon_ext_link_ruian + "</a><br/>") 767 .append("<b>Okres: </b>" + m_adresni_mista.get(i).getOkres()) 768 .append(" <a href="+ url_okres + m_adresni_mista.get(i).getOkresID() +">" + icon_ext_link_ruian + "</a><br/>") 769 .append("<b>Kraj: </b>" + m_adresni_mista.get(i).getKraj()) 770 .append(" <a href="+ url_kraj + m_adresni_mista.get(i).getKrajID() +">" + icon_ext_link_ruian + "</a><br/>") 771 .append("<b>PSČ: </b>" + m_adresni_mista.get(i).getPsc()) 772 .append(" <a href="+ url_cpost + m_adresni_mista.get(i).getPsc() +">" + icon_ext_link_ruian + "</a><br/>"); 630 if (!mAdresniMista.get(i).getUlice().isEmpty()) { 631 r.append("<b>Ulice: </b>").append(mAdresniMista.get(i).getUlice()).append(" <a href=") 632 .append(urlUlice).append(mAdresniMista.get(i).getUliceID()).append(">").append(iconExtLinkRuian) 633 .append("</a><br/>"); 634 } 635 r.append("<b>Část obce: </b>").append(mAdresniMista.get(i).getCastObce()).append(" <a href=") 636 .append(urlMistniCast).append(mAdresniMista.get(i).getCastObceID()).append(">").append(iconExtLinkRuian) 637 .append("</a><br/>"); 638 if (mAdresniMista.get(i).getMestskaCast().length() > 0) { 639 r.append("<b>Městská část: </b>").append(mAdresniMista.get(i).getMestskaCast()).append(" <a href=") 640 .append(urlMestskaCast).append(mAdresniMista.get(i).getMestskaCastID()).append(">") 641 .append(iconExtLinkRuian).append("</a><br/>"); 642 } 643 r.append("<b>Obec: </b>").append(mAdresniMista.get(i).getObec()).append(" <a href=") 644 .append(urlObec).append(mAdresniMista.get(i).getObecID()).append(">").append(iconExtLinkRuian) 645 .append("</a><br/>").append("<b>Okres: </b>").append(mAdresniMista.get(i).getOkres()) 646 .append(" <a href=").append(urlOkres).append(mAdresniMista.get(i).getOkresID()) 647 .append(">").append(iconExtLinkRuian).append("</a><br/>").append("<b>Kraj: </b>") 648 .append(mAdresniMista.get(i).getKraj()).append(" <a href=").append(urlKraj) 649 .append(mAdresniMista.get(i).getKrajID()).append(">").append(iconExtLinkRuian).append("</a><br/>") 650 .append("<b>PSČ: </b>").append(mAdresniMista.get(i).getPsc()).append(" <a href=") 651 .append(urlCpost).append(mAdresniMista.get(i).getPsc()).append(">").append(iconExtLinkRuian).append("</a><br/>"); 773 652 774 653 } … … 777 656 778 657 // Reported errors 779 if (m_objekt_ruian_id > 0 && !m_err_user.isEmpty()) { 780 r.append("<i><u>Nahlášený problém</u></i>") 781 .append(" <a href=" + url_ruian_error + m_objekt_ruian_id + ">"+ icon_ext_link +"</a><br/>") 782 .append("<b>Nahlásil: </b>" + m_err_user) 783 .append("<br/>") 784 .append("<b>Dne: </b>" + m_err_date) 785 .append("<br/>") 786 .append("<b>Typ problému: </b>" + m_err_type) 658 if (mObjektRuianId > 0 && !mErrUser.isEmpty()) { 659 r.append("<i><u>Nahlášený problém</u></i>").append(" <a href=").append(urlRuianError) 660 .append(mObjektRuianId).append(">").append(iconExtLink).append("</a><br/>") 661 .append("<b>Nahlásil: </b>").append(mErrUser) 662 .append("<br/>").append("<b>Dne: </b>").append(mErrDate) 663 .append("<br/>").append("<b>Typ problému: </b>").append(mErrType) 787 664 .append("<br/>"); 788 if (!m _err_note.isEmpty()) {789 r.append("<b>Poznámka: </b>" + m_err_note)665 if (!mErrNote.isEmpty()) { 666 r.append("<b>Poznámka: </b>").append(mErrNote) 790 667 .append("<br/>"); 791 668 } … … 794 671 795 672 // Address places 796 if (m _adresni_mista.size() > 1 && m_objekt_ruian_id > 0) {673 if (mAdresniMista.size() > 1 && mObjektRuianId > 0) { 797 674 String x = ""; 798 if ( m_adresni_mista.get(0).getCisloTyp().equals("Číslo evidenční")) {675 if ("Číslo evidenční".equals(mAdresniMista.get(0).getCisloTyp())) { 799 676 x = "ev."; 800 677 } 801 678 r.append("<i><u>Adresní místa</u></i><br/>"); 802 for (int i = 0; i < m_adresni_mista.size(); i++) { 803 r.append(m_adresni_mista.get(i).getUlice() + " " + x + m_adresni_mista.get(i).getCisloDomovni()); 804 if (!m_adresni_mista.get(i).getCisloOrientacni().isEmpty()) { 805 r.append("/" + m_adresni_mista.get(i).getCisloOrientacni()); 806 } 807 r.append(" <a href="+ url_adresni_misto + m_adresni_mista.get(i).getRuianID() + ">"+ icon_ext_link_ruian +"</a> ") 808 .append(" <a href=file://tags.copy/address:"+i+">"+ icon_copy_tags +"</a>") 809 .append(" <a href=file://tags.create/address:"+i+">"+ icon_create_addr +"</a>") 810 .append(" <a href=file://tags.create-on-place/address:"+i+">"+ icon_create_addr_ruian +"</a>") 679 for (int i = 0; i < mAdresniMista.size(); i++) { 680 r.append(mAdresniMista.get(i).getUlice()).append(" ").append(x).append(mAdresniMista.get(i).getCisloDomovni()); 681 if (!mAdresniMista.get(i).getCisloOrientacni().isEmpty()) { 682 r.append("/").append(mAdresniMista.get(i).getCisloOrientacni()); 683 } 684 r.append(" <a href=").append(urlAdresniMisto).append(mAdresniMista.get(i).getRuianID()) 685 .append(">").append(iconExtLinkRuian).append("</a> ") 686 .append(" <a href=file://tags.copy/address:").append(i).append(">") 687 .append(iconCopyTags).append("</a>").append(" <a href=file://tags.create/address:") 688 .append(i).append(">").append(iconCreateAddr).append("</a>") 689 .append(" <a href=file://tags.create-on-place/address:").append(i).append(">") 690 .append(iconCreateAddrRuian).append("</a>") 811 691 .append("<br/>"); 812 692 } … … 815 695 816 696 // Land 817 if (m_parcela_ruian_id > 0) { 697 if (mParcelaRuianId > 0) { 698 // .append(" <a href=file://tags.copy/parcel>"+ icon_copy_tags +"</a>") 818 699 r.append("<i><u>Informace o pozemku</u></i>") 819 .append("<br/>") 820 .append("<b>RUIAN id: </b>"+ m_parcela_ruian_id +" <a href="+ url_parcela + m_parcela_ruian_id +">" 821 + icon_ext_link_ruian + "</a>") 822 .append(" <a href="+ url_vlastnici + "pa&id=" + m_parcela_ruian_id + ">"+ icon_ext_link_kn +"</a><br/>") 823 // .append(" <a href=file://tags.copy/parcel>"+ icon_copy_tags +"</a>") 824 .append("<b>Druh pozemku: </b>" + m_parcela_druh_pozemku +"<br/>"); 825 if (m_parcela_zpusob_vyuziti != "") r.append("<b>Způsob využití: </b>" + m_parcela_zpusob_vyuziti +"<br/>"); 826 r.append("<b>Platí od: </b>" + m_parcela_plati_od +"<br/>") 700 .append("<br/>").append("<b>RUIAN id: </b>").append(mParcelaRuianId).append(" <a href=") 701 .append(urlParcela).append(mParcelaRuianId).append(">").append(iconExtLinkRuian).append("</a>") 702 .append(" <a href=").append(urlVlastnici).append("pa&id=").append(mParcelaRuianId) 703 .append(">").append(iconExtLinkKn).append("</a><br/>").append("<b>Druh pozemku: </b>") 704 .append(mParcelaDruhPozemku).append("<br/>"); 705 if (!"".equals(mParcelaZpusobVyuziti)) r.append("<b>Způsob využití: </b>").append(mParcelaZpusobVyuziti).append("<br/>"); 706 r.append("<b>Platí od: </b>").append(mParcelaPlatiOd).append("<br/>") 827 707 .append("<br/>"); 828 708 } 829 709 830 710 // Street 831 if (m _ulice_ruian_id > 0) {832 r.append("<i><u>Informace o ulici</u></i><br/>") 833 .append("<b>RUIAN id: </b>"+ m_ulice_ruian_id +" <a href="+ url_ulice + m_ulice_ruian_id +">" + icon_ext_link_ruian + "</a>")834 .append(" <a href=file://tags.copy/street>"+ icon_copy_tags +"</a><br/>")835 .append("<b>Jméno: </b>" + m_ulice_jmeno +"<br/>")711 if (mUliceRuianId > 0) { 712 r.append("<i><u>Informace o ulici</u></i><br/>").append("<b>RUIAN id: </b>").append(mUliceRuianId) 713 .append(" <a href=").append(urlUlice).append(mUliceRuianId).append(">") 714 .append(iconExtLinkRuian).append("</a>").append(" <a href=file://tags.copy/street>") 715 .append(iconCopyTags).append("</a><br/>").append("<b>Jméno: </b>").append(mUliceJmeno).append("<br/>") 836 716 .append("<br/>"); 837 717 } 838 718 839 719 // Cadastral area 840 if (m _katastr_ruian_id > 0) {841 r.append("<b>Katastrální území: </b>" + m_katastr_nazev)842 .append(" <a href="+ url_katastralni_uzemi + m_katastr_ruian_id +">" + icon_ext_link_ruian + "</a><br/>")843 .append("<b>Obec: </b>" + m_katastr_obec)844 .append(" <a href="+ url_obec + m_katastr_obec_kod +">" + icon_ext_link_ruian +"</a><br/>")845 .append("<b>Okres: </b>" + m_katastr_okres)846 .append(" <a href="+ url_okres + m_katastr_okres_kod +">" + icon_ext_link_ruian +"</a><br/>")847 .append("<b>Kraj: </b>" + m_katastr_kraj)848 .append(" <a href="+url_kraj + m_katastr_kraj_kod +">" + icon_ext_link_ruian +"</a><br/>")720 if (mKatastrRuianId > 0) { 721 r.append("<b>Katastrální území: </b>").append(mKatastrNazev).append(" <a href=") 722 .append(urlKatastralniUzemi).append(mKatastrRuianId).append(">").append(iconExtLinkRuian) 723 .append("</a><br/>").append("<b>Obec: </b>").append(mKatastrObec).append(" <a href=") 724 .append(urlObec).append(mKatastrObecKod).append(">").append(iconExtLinkRuian).append("</a><br/>") 725 .append("<b>Okres: </b>").append(mKatastrOkres).append(" <a href=").append(urlOkres) 726 .append(mKatastrOkresKod).append(">").append(iconExtLinkRuian).append("</a><br/>") 727 .append("<b>Kraj: </b>").append(mKatastrKraj).append(" <a href=").append(urlKraj) 728 .append(mKatastrKrajKod).append(">").append(iconExtLinkRuian).append("</a><br/>") 849 729 .append("<br/>"); 850 730 } 851 731 852 732 // Near address places 853 if (!m_adresni_mista.isEmpty() && m_objekt_ruian_id == 0) { 854 String x; 733 if (!mAdresniMista.isEmpty() && mObjektRuianId == 0) { 855 734 r.append("<i><u>Adresní místa v okolí</u></i><br/>") 856 735 .append("<table>"); 857 for (int i = 0; i < m _adresni_mista.size(); i++) {858 x = "";859 if ( m_adresni_mista.get(i).getCisloTyp().equals("Číslo evidenční")) {860 x = "ev.";861 } 862 x += m_adresni_mista.get(i).getCisloDomovni();863 if (!m _adresni_mista.get(i).getCisloOrientacni().isEmpty()) {864 x += "/" + m_adresni_mista.get(i).getCisloOrientacni();736 for (int i = 0; i < mAdresniMista.size(); i++) { 737 StringBuilder x = new StringBuilder(); 738 if ("Číslo evidenční".equals(mAdresniMista.get(i).getCisloTyp())) { 739 x.append("ev."); 740 } 741 x.append(mAdresniMista.get(i).getCisloDomovni()); 742 if (!mAdresniMista.get(i).getCisloOrientacni().isEmpty()) { 743 x.append("/").append(mAdresniMista.get(i).getCisloOrientacni()); 865 744 } 866 745 r.append("<tr><td bgcolor=#e5e5ff>"); 867 if (!m _adresni_mista.get(i).getUlice().isEmpty()) {868 r.append(m _adresni_mista.get(i).getVzdalenost())869 .append("</td><td valign=\"top\" bgcolor=#e5e5ff>")870 .append(m_adresni_mista.get(i).getUlice() + " " + x)871 .append("<br/><u>" + m_adresni_mista.get(i).getObec() + "</u>")872 .append("</td><td valign=\"top\" bgcolor=#e5e5ff>")873 .append("<a href="+ url_adresni_misto + m_adresni_mista.get(i).getRuianID() + ">"+ icon_ext_link_ruian +"</a>")874 .append(" <a href=file://tags.copy/address:"+i+">"+ icon_copy_tags +"</a>")875 .append(" <a href=file://tags.create/address:"+i+">"+ icon_create_addr +"</a>")876 .append(" <a href=file://tags.create-on-place/address:"+i+">"+ icon_create_addr_ruian +"</a>");746 if (!mAdresniMista.get(i).getUlice().isEmpty()) { 747 r.append(mAdresniMista.get(i).getVzdalenost()) 748 .append("</td><td valign=\"top\" bgcolor=#e5e5ff>").append(mAdresniMista.get(i).getUlice()) 749 .append(" ").append(x).append("<br/><u>").append(mAdresniMista.get(i).getObec()).append("</u>") 750 .append("</td><td valign=\"top\" bgcolor=#e5e5ff>").append("<a href=").append(urlAdresniMisto) 751 .append(mAdresniMista.get(i).getRuianID()).append(">").append(iconExtLinkRuian).append("</a>") 752 .append(" <a href=file://tags.copy/address:").append(i).append(">").append(iconCopyTags) 753 .append("</a>").append(" <a href=file://tags.create/address:").append(i).append(">") 754 .append(iconCreateAddr).append("</a>").append(" <a href=file://tags.create-on-place/address:") 755 .append(i).append(">").append(iconCreateAddrRuian).append("</a>"); 877 756 } else { 878 r.append(m _adresni_mista.get(i).getVzdalenost())879 .append("</td><td valign=\"top\" bgcolor=#e5e5ff>")880 .append(m_adresni_mista.get(i).getCastObce() + " " + x +" ");881 if (!m _adresni_mista.get(i).getCastObce().equals(m_adresni_mista.get(i).getObec())) {882 r.append("<br/><u>" + m_adresni_mista.get(i).getObec() +"</u>");757 r.append(mAdresniMista.get(i).getVzdalenost()) 758 .append("</td><td valign=\"top\" bgcolor=#e5e5ff>").append(mAdresniMista.get(i).getCastObce()) 759 .append(" ").append(x).append(" "); 760 if (!mAdresniMista.get(i).getCastObce().equals(mAdresniMista.get(i).getObec())) { 761 r.append("<br/><u>").append(mAdresniMista.get(i).getObec()).append("</u>"); 883 762 } 884 r.append("</td><td valign=\"top\" bgcolor=#e5e5ff>") 885 .append("<a href="+ url_adresni_misto + m_adresni_mista.get(i).getRuianID() + ">"+ icon_ext_link_ruian +"</a>") 886 .append(" <a href=file://tags.copy/address:"+i+">"+ icon_copy_tags +"</a>") 887 .append(" <a href=file://tags.create/address:"+i+">"+ icon_create_addr +"</a>") 888 .append(" <a href=file://tags.create-on-place/address:"+i+">"+ icon_create_addr_ruian +"</a>"); 763 r.append("</td><td valign=\"top\" bgcolor=#e5e5ff>").append("<a href=").append(urlAdresniMisto) 764 .append(mAdresniMista.get(i).getRuianID()).append(">").append(iconExtLinkRuian).append("</a>") 765 .append(" <a href=file://tags.copy/address:").append(i).append(">").append(iconCopyTags) 766 .append("</a>").append(" <a href=file://tags.create/address:").append(i).append(">") 767 .append(iconCreateAddr).append("</a>").append(" <a href=file://tags.create-on-place/address:") 768 .append(i).append(">").append(iconCreateAddrRuian).append("</a>"); 889 769 } 890 770 r.append("</td></tr>"); … … 893 773 } 894 774 895 if (!m _so_bez_geometrie.isEmpty()) {775 if (!mSoBezGeometrie.isEmpty()) { 896 776 r.append("<i><u>Budovy bez geometrie v okolí</u></i><br/>") 897 777 .append("<table>"); 898 for (int i = 0; i < m _so_bez_geometrie.size(); i++) {778 for (int i = 0; i < mSoBezGeometrie.size(); i++) { 899 779 r.append("<tr><td bgcolor=#e5e5ff>") 900 .append(m _so_bez_geometrie.get(i).getVzdalenost())780 .append(mSoBezGeometrie.get(i).getVzdalenost()) 901 781 .append("</td><td valign=\"top\" bgcolor=#e5e5ff>") 902 .append(m _so_bez_geometrie.get(i).getRuianID());903 if (m _so_bez_geometrie.get(i).getZpusobVyuziti().length() > 0) {904 r.append(" - " + m_so_bez_geometrie.get(i).getZpusobVyuziti());905 } 906 r.append("</td><td valign=\"top\" bgcolor=#e5e5ff>") 907 .append(" <a href="+ url_stavebni_objekt + m_so_bez_geometrie.get(i).getRuianID() + ">"+ icon_ext_link_ruian +"</a> ")908 .append(" <a href=file://tags.copy/ghost:"+i+">"+ icon_copy_tags +"</a></br>")782 .append(mSoBezGeometrie.get(i).getRuianID()); 783 if (mSoBezGeometrie.get(i).getZpusobVyuziti().length() > 0) { 784 r.append(" - ").append(mSoBezGeometrie.get(i).getZpusobVyuziti()); 785 } 786 r.append("</td><td valign=\"top\" bgcolor=#e5e5ff>").append(" <a href=").append(urlStavebniObjekt) 787 .append(mSoBezGeometrie.get(i).getRuianID()).append(">").append(iconExtLinkRuian).append("</a> ") 788 .append(" <a href=file://tags.copy/ghost:").append(i).append(">").append(iconCopyTags).append("</a></br>") 909 789 .append("</td></tr>"); 910 790 } … … 913 793 } 914 794 915 r.append("<hr/>") 916 .append("<center><i><small>Zdroj: <a href=\"http://www.ruian.cz/\">" + m_source +"</a></small></i></center>")795 r.append("<hr/>").append("<center><i><small>Zdroj: <a href=\"http://www.ruian.cz/\">").append(mSource) 796 .append("</a></small></i></center>") 917 797 .append("</td></tr></table></body></html>"); 918 798 … … 926 806 */ 927 807 String convertDate(String ruianDate) { 928 String r = new String();929 808 String[] parts = ruianDate.split("\\."); 930 809 try { … … 932 811 int month = Integer.parseInt(parts[1]); 933 812 int year = Integer.parseInt(parts[2]); 934 r = Integer.toString(year)+ "-" + String.format("%02d", month) + "-" + String.format("%02d", day);935 } catch ( Exception e) {813 return year + "-" + String.format("%02d", month) + "-" + String.format("%02d", day); 814 } catch (NumberFormatException | IllegalFormatException e) { 936 815 Logging.warn(e); 937 816 } 938 817 939 return r;818 return ""; 940 819 } 941 820 … … 959 838 960 839 // Copy building tags to clipboard 961 if ( keyType.equals("building") && m_objekt_ruian_id > 0) {962 c.append(tagToString("ref:ruian:building", Long.toString(m _objekt_ruian_id)));963 if (!m _objekt_zpusob_vyuziti_key.isEmpty() &&964 !m _objekt_zpusob_vyuziti_val.isEmpty()840 if ("building".equals(keyType) && mObjektRuianId > 0) { 841 c.append(tagToString("ref:ruian:building", Long.toString(mObjektRuianId))); 842 if (!mObjektZpusobVyuzitiKey.isEmpty() && 843 !mObjektZpusobVyuzitiVal.isEmpty() 965 844 ) { 966 c.append(tagToString(m _objekt_zpusob_vyuziti_key, m_objekt_zpusob_vyuziti_val));967 } 968 if (m _objekt_podlazi > 0) {969 c.append(tagToString("building:levels", Integer.toString(m _objekt_podlazi)));970 } 971 if (m _objekt_byty > 0) {972 c.append(tagToString("building:flats", Integer.toString(m _objekt_byty)));973 } 974 if (m _objekt_dokonceni.length() > 0 && convertDate(m_objekt_dokonceni).length() > 0) {975 c.append(tagToString("start_date", convertDate(m _objekt_dokonceni)));976 } 977 if (m _objekt_zpusob_vyuziti_kod.length() > 0) {978 c.append(tagToString("building:ruian:type", m _objekt_zpusob_vyuziti_kod));845 c.append(tagToString(mObjektZpusobVyuzitiKey, mObjektZpusobVyuzitiVal)); 846 } 847 if (mObjektPodlazi > 0) { 848 c.append(tagToString("building:levels", Integer.toString(mObjektPodlazi))); 849 } 850 if (mObjektByty > 0) { 851 c.append(tagToString("building:flats", Integer.toString(mObjektByty))); 852 } 853 if (mObjektDokonceni.length() > 0 && convertDate(mObjektDokonceni).length() > 0) { 854 c.append(tagToString("start_date", convertDate(mObjektDokonceni))); 855 } 856 if (mObjektZpusobVyuzitiKod.length() > 0) { 857 c.append(tagToString("building:ruian:type", mObjektZpusobVyuzitiKod)); 979 858 } 980 859 c.append(tagToString("source", "cuzk:ruian")); 981 860 } 982 861 983 if (keyType.startsWith("ghost") && !m _so_bez_geometrie.isEmpty()) {862 if (keyType.startsWith("ghost") && !mSoBezGeometrie.isEmpty()) { 984 863 String[] key = keyType.split(":"); 985 864 int i = Integer.parseInt(key[1]); 986 System.out.println("Ghost ID: " +i);987 988 c.append(tagToString("ref:ruian:building", Long.toString(m _so_bez_geometrie.get(i).getRuianID())));989 if (m _so_bez_geometrie.get(i).getZpusobVyuzitiKey().length() > 0 &&990 m _so_bez_geometrie.get(i).getZpusobVyuzitiVal().length() > 0865 Logging.trace("Ghost ID: {0}", i); 866 867 c.append(tagToString("ref:ruian:building", Long.toString(mSoBezGeometrie.get(i).getRuianID()))); 868 if (mSoBezGeometrie.get(i).getZpusobVyuzitiKey().length() > 0 && 869 mSoBezGeometrie.get(i).getZpusobVyuzitiVal().length() > 0 991 870 ) { 992 c.append(tagToString(m _so_bez_geometrie.get(i).getZpusobVyuzitiKey(), m_so_bez_geometrie.get(i).getZpusobVyuzitiVal()));993 } 994 if (m _so_bez_geometrie.get(i).getPodlazi() > 0) {995 c.append(tagToString("building:levels", Integer.toString(m _so_bez_geometrie.get(i).getPodlazi())));996 } 997 if (m _so_bez_geometrie.get(i).getByty() > 0) {998 c.append(tagToString("building:flats", Integer.toString(m _so_bez_geometrie.get(i).getByty())));999 } 1000 if (m _so_bez_geometrie.get(i).getDokonceni().length() > 0 && convertDate(m_so_bez_geometrie.get(i).getDokonceni()).length() > 0) {1001 c.append(tagToString("start_date", convertDate(m _so_bez_geometrie.get(i).getDokonceni())));1002 } 1003 if (m _so_bez_geometrie.get(i).getZpusobVyuzitiKod().length() > 0) {1004 c.append(tagToString("building:ruian:type", m _so_bez_geometrie.get(i).getZpusobVyuzitiKod()));871 c.append(tagToString(mSoBezGeometrie.get(i).getZpusobVyuzitiKey(), mSoBezGeometrie.get(i).getZpusobVyuzitiVal())); 872 } 873 if (mSoBezGeometrie.get(i).getPodlazi() > 0) { 874 c.append(tagToString("building:levels", Integer.toString(mSoBezGeometrie.get(i).getPodlazi()))); 875 } 876 if (mSoBezGeometrie.get(i).getByty() > 0) { 877 c.append(tagToString("building:flats", Integer.toString(mSoBezGeometrie.get(i).getByty()))); 878 } 879 if (mSoBezGeometrie.get(i).getDokonceni().length() > 0 && convertDate(mSoBezGeometrie.get(i).getDokonceni()).length() > 0) { 880 c.append(tagToString("start_date", convertDate(mSoBezGeometrie.get(i).getDokonceni()))); 881 } 882 if (mSoBezGeometrie.get(i).getZpusobVyuzitiKod().length() > 0) { 883 c.append(tagToString("building:ruian:type", mSoBezGeometrie.get(i).getZpusobVyuzitiKod())); 1005 884 } 1006 885 c.append(tagToString("source", "cuzk:ruian")); … … 1008 887 1009 888 // Copy address tags to clipboard 1010 if (keyType.startsWith("address")) { 1011 if (!m_adresni_mista.isEmpty()) { 1012 int i; 1013 1014 if (m_adresni_mista.isEmpty()) { 1015 i = 0; 1016 } else { 1017 String[] key = keyType.split(":"); 1018 i = Integer.valueOf(key[1]); 1019 Logging.info("Address ID: " + i); 1020 } 1021 1022 // Only one address place 1023 if (!m_adresni_mista.get(i).getCisloTyp().equals("Číslo evidenční")) { 1024 // Cislo popisne 1025 c.append(tagToString("addr:conscriptionnumber", m_adresni_mista.get(i).getCisloDomovni())); 1026 } else { 1027 // Cislo evidencni 1028 c.append(tagToString("addr:provisionalnumber", m_adresni_mista.get(i).getCisloDomovni())); 1029 } 1030 1031 // Cislo orientacni 1032 if (!m_adresni_mista.get(i).getCisloOrientacni().isEmpty()) { 1033 c.append(tagToString("addr:streetnumber", m_adresni_mista.get(i).getCisloOrientacni())); 1034 } 1035 1036 // Domovni cislo 1037 StringBuilder addr = new StringBuilder(); 1038 if (!m_adresni_mista.get(i).getCisloTyp().equals("Číslo evidenční")) { 1039 addr.append(m_adresni_mista.get(i).getCisloDomovni()); 1040 } else { 1041 addr.append("ev." + m_adresni_mista.get(i).getCisloDomovni()); 1042 } 1043 if (!m_adresni_mista.get(i).getCisloOrientacni().isEmpty()) { 1044 addr.append("/" + m_adresni_mista.get(i).getCisloOrientacni()); 1045 } 1046 c.append(tagToString("addr:housenumber", addr.toString())); 1047 1048 // Street 1049 if (!m_adresni_mista.get(i).getUlice().isEmpty()) { 1050 c.append(tagToString("addr:street", m_adresni_mista.get(i).getUlice())); 1051 } 1052 //RUIAN ID 1053 if (m_adresni_mista.get(i).getRuianID() > 0) { 1054 c.append(tagToString("ref:ruian:addr", Long.toString(m_adresni_mista.get(i).getRuianID()))); 1055 } 1056 1057 // Place 1058 if (!m_adresni_mista.get(i).getCastObce().isEmpty()) { 1059 c.append(tagToString("addr:place", m_adresni_mista.get(i).getCastObce())); 1060 } 1061 1062 if (!m_adresni_mista.get(i).getMestskaCast().isEmpty()) { 1063 c.append(tagToString("addr:suburb", m_adresni_mista.get(i).getMestskaCast())); 1064 } 1065 1066 // City 1067 if (!m_adresni_mista.get(i).getObec().isEmpty()) { 1068 c.append(tagToString("addr:city", m_adresni_mista.get(i).getObec())); 1069 } 1070 1071 // Postcode 1072 if (!m_adresni_mista.get(i).getPsc().isEmpty()) { 1073 c.append(tagToString("addr:postcode", m_adresni_mista.get(i).getPsc())); 1074 } 1075 1076 // Country 1077 c.append(tagToString("addr:country", "CZ")); 1078 1079 // Source 1080 c.append(tagToString("source:addr", "cuzk:ruian")); 1081 } 889 if (keyType.startsWith("address") && !mAdresniMista.isEmpty()) { 890 int i; 891 892 String[] key = keyType.split(":"); 893 i = Integer.parseInt(key[1]); 894 Logging.info("Address ID: " + i); 895 896 // Only one address place 897 if (!"Číslo evidenční".equals(mAdresniMista.get(i).getCisloTyp())) { 898 // Cislo popisne 899 c.append(tagToString("addr:conscriptionnumber", mAdresniMista.get(i).getCisloDomovni())); 900 } else { 901 // Cislo evidencni 902 c.append(tagToString("addr:provisionalnumber", mAdresniMista.get(i).getCisloDomovni())); 903 } 904 905 // Cislo orientacni 906 if (!mAdresniMista.get(i).getCisloOrientacni().isEmpty()) { 907 c.append(tagToString("addr:streetnumber", mAdresniMista.get(i).getCisloOrientacni())); 908 } 909 910 // Domovni cislo 911 StringBuilder addr = new StringBuilder(); 912 if (!"Číslo evidenční".equals(mAdresniMista.get(i).getCisloTyp())) { 913 addr.append(mAdresniMista.get(i).getCisloDomovni()); 914 } else { 915 addr.append("ev.").append(mAdresniMista.get(i).getCisloDomovni()); 916 } 917 if (!mAdresniMista.get(i).getCisloOrientacni().isEmpty()) { 918 addr.append("/").append(mAdresniMista.get(i).getCisloOrientacni()); 919 } 920 c.append(tagToString("addr:housenumber", addr.toString())); 921 922 // Street 923 if (!mAdresniMista.get(i).getUlice().isEmpty()) { 924 c.append(tagToString("addr:street", mAdresniMista.get(i).getUlice())); 925 } 926 //RUIAN ID 927 if (mAdresniMista.get(i).getRuianID() > 0) { 928 c.append(tagToString("ref:ruian:addr", Long.toString(mAdresniMista.get(i).getRuianID()))); 929 } 930 931 // Place 932 if (!mAdresniMista.get(i).getCastObce().isEmpty()) { 933 c.append(tagToString("addr:place", mAdresniMista.get(i).getCastObce())); 934 } 935 936 if (!mAdresniMista.get(i).getMestskaCast().isEmpty()) { 937 c.append(tagToString("addr:suburb", mAdresniMista.get(i).getMestskaCast())); 938 } 939 940 // City 941 if (!mAdresniMista.get(i).getObec().isEmpty()) { 942 c.append(tagToString("addr:city", mAdresniMista.get(i).getObec())); 943 } 944 945 // Postcode 946 if (!mAdresniMista.get(i).getPsc().isEmpty()) { 947 c.append(tagToString("addr:postcode", mAdresniMista.get(i).getPsc())); 948 } 949 950 // Country 951 c.append(tagToString("addr:country", "CZ")); 952 953 // Source 954 c.append(tagToString("source:addr", "cuzk:ruian")); 1082 955 } 1083 956 … … 1085 958 1086 959 // Copy street tags to clipboard 1087 if ( keyType.equals("street") && m_ulice_ruian_id > 0) {1088 c.append(tagToString("ref:ruian:street", Long.toString(m _ulice_ruian_id)));1089 c.append(tagToString("name", m _ulice_jmeno));960 if ("street".equals(keyType) && mUliceRuianId > 0) { 961 c.append(tagToString("ref:ruian:street", Long.toString(mUliceRuianId))); 962 c.append(tagToString("name", mUliceJmeno)); 1090 963 c.append(tagToString("source", "cuzk:ruian")); 1091 964 } … … 1105 978 String[] key = cmd.split(":"); 1106 979 int i = Integer.parseInt(key[1]); 1107 node = new Node(m _adresni_mista.get(i).getPosition());980 node = new Node(mAdresniMista.get(i).getPosition()); 1108 981 } else { 1109 node = new Node(new LatLon(m _coor_lat, m_coor_lon));982 node = new Node(new LatLon(mCoorLat, mCoorLon)); 1110 983 } 1111 984 commands.add(new AddCommand(MainApplication.getLayerManager().getEditDataSet(), node)); … … 1136 1009 Logging.info("act: " + act.substring(7)); 1137 1010 String[] params = act.substring(7).split("/"); 1138 if (! params[0].equals("tags.copy") && !params[0].startsWith("tags.create")) {1011 if (!"tags.copy".equals(params[0]) && !params[0].startsWith("tags.create")) { 1139 1012 return; 1140 1013 } … … 1143 1016 1144 1017 // Copy tags to clipboard 1145 if (params[0].equals("tags.copy")) { 1146 if (!task.isEmpty()) { 1147 ClipboardUtils.copyString(task); 1148 PointInfoUtils.showNotification(tr("Tags copied to clipboard."), "info"); 1149 } 1018 if ("tags.copy".equals(params[0]) && !task.isEmpty()) { 1019 ClipboardUtils.copyString(task); 1020 PointInfoUtils.showNotification(tr("Tags copied to clipboard."), "info"); 1150 1021 } 1151 1022 1152 1023 // Create address node 1153 if (params[0].startsWith("tags.create")) { 1154 if (!task.isEmpty()) { 1155 createAddrPoint(act.substring(7), task); 1156 PointInfoUtils.showNotification(tr("New address point added."), "info"); 1157 } 1024 if (params[0].startsWith("tags.create") && !task.isEmpty()) { 1025 createAddrPoint(act.substring(7), task); 1026 PointInfoUtils.showNotification(tr("New address point added."), "info"); 1158 1027 } 1159 1028 } -
applications/editors/josm/plugins/rasterfilters/build.xml
r34550 r36122 10 10 11 11 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 12 <property name="plugin.main.version" value="1 4153" />13 <property name="plugin.version" value="1.0. 3"/>12 <property name="plugin.main.version" value="18723" /> 13 <property name="plugin.version" value="1.0.4"/> 14 14 15 15 <property name="plugin.icon" value="images/josm_filters_48.png"/> -
applications/editors/josm/plugins/rasterfilters/src/org/openstreetmap/josm/plugins/rasterfilters/filters/Filter.java
r33269 r36122 4 4 import java.rmi.server.UID; 5 5 6 import ja vax.json.JsonObject;6 import jakarta.json.JsonObject; 7 7 8 8 /** -
applications/editors/josm/plugins/rasterfilters/src/org/openstreetmap/josm/plugins/rasterfilters/gui/FilterPanel.java
r34550 r36122 13 13 import java.util.Hashtable; 14 14 15 import ja vax.json.JsonArray;16 import ja vax.json.JsonObject;15 import jakarta.json.JsonArray; 16 import jakarta.json.JsonObject; 17 17 import javax.swing.BorderFactory; 18 18 import javax.swing.Box; … … 65 65 String type = json.getString("type"); 66 66 67 if (type.equals("linear_slider")) { 68 69 setNeededHeight(getNeededHeight() + 70); 70 71 return createSlider(json); 72 73 } else if (type.equals("checkbox")) { 74 75 setNeededHeight(getNeededHeight() + 30); 76 77 JCheckBox checkBox = createCheckBox(json.getString("title")); 78 checkBox.setSelected(json.getBoolean("default")); 79 checkBox.setName(json.getString("name")); 80 81 return checkBox; 82 83 } else if (type.equals("select")) { 84 85 setNeededHeight(getNeededHeight() + 50); 86 87 return createSelect(json); 88 89 } else if (type.equals("colorpicker")) { 90 91 setNeededHeight(getNeededHeight() + 220); 92 93 return createColorPicker(json); 67 switch (type) { 68 case "linear_slider": 69 setNeededHeight(getNeededHeight() + 70); 70 return createSlider(json); 71 72 case "checkbox": 73 setNeededHeight(getNeededHeight() + 30); 74 75 JCheckBox checkBox = createCheckBox(json.getString("title")); 76 checkBox.setSelected(json.getBoolean("default")); 77 checkBox.setName(json.getString("name")); 78 79 return checkBox; 80 81 case "select": 82 setNeededHeight(getNeededHeight() + 50); 83 return createSelect(json); 84 85 case "colorpicker": 86 setNeededHeight(getNeededHeight() + 220); 87 return createColorPicker(json); 88 default: 89 return null; 94 90 } 95 return null;96 91 } 97 92 … … 170 165 } 171 166 172 private JCheckBox createDisableBox(ItemListener listener) {167 private static JCheckBox createDisableBox(ItemListener listener) { 173 168 JCheckBox disable = new JCheckBox("Disable"); 174 169 Font font = new Font("Arial", Font.PLAIN, 12); … … 180 175 } 181 176 182 private JButton createRemoveButton(ActionListener listener) {177 private static JButton createRemoveButton(ActionListener listener) { 183 178 JButton removeButton = new JButton("Remove"); 184 179 Font font = new Font("Arial", Font.PLAIN, 12); … … 242 237 243 238 JSlider slider = null; 244 if ( valueType.equals("integer")) {239 if ("integer".equals(valueType)) { 245 240 int minValue = array.getInt(0); 246 241 int maxValue = array.getInt(1); … … 248 243 249 244 Logging.debug("Slider is integer\n"); 250 Logging.debug("minValue: " + String.valueOf(minValue)251 + "maxValue: " + String.valueOf(maxValue));245 Logging.debug("minValue: " + minValue 246 + "maxValue: " + maxValue); 252 247 try { 253 248 slider = new JSlider(JSlider.HORIZONTAL, minValue, maxValue, … … 257 252 slider.setMinorTickSpacing(maxValue / 4); 258 253 } catch (IllegalArgumentException e) { 259 254 Logging.trace(e); 260 255 JOptionPane.showMessageDialog( 261 256 MainApplication.getMainFrame(), … … 265 260 } 266 261 267 } else if ( valueType.equals("float")) {262 } else if ("float".equals(valueType)) { 268 263 269 264 Logging.debug("Slider is float\n"); … … 271 266 double minValueDouble = array.getJsonNumber(0).doubleValue(); 272 267 double maxValueDouble = array.getJsonNumber(1).doubleValue(); 273 Logging.debug("DminValue: " + String.valueOf(minValueDouble)274 + "DmaxValue: " + String.valueOf(maxValueDouble));268 Logging.debug("DminValue: " + minValueDouble 269 + "DmaxValue: " + maxValueDouble); 275 270 276 271 int minValue = (int) (minValueDouble * 100); … … 279 274 280 275 double initValue = json.getJsonNumber("default").doubleValue() * 100; 281 double delta = (maxValue - minValue) / 100 ;276 double delta = (maxValue - minValue) / 100d; 282 277 283 278 for (int i = 0; i <= maxValue; i++) { … … 292 287 293 288 try { 294 295 289 slider = new JSlider(JSlider.HORIZONTAL, minValue, maxValue, (int) initValue); 296 290 slider.setMinorTickSpacing(maxValue / 4); 297 291 slider.setName(json.getString("name")); 298 292 slider.setToolTipText(String.valueOf((double) slider.getValue() / 100)); 299 300 301 293 } catch (IllegalArgumentException e) { 302 294 Logging.trace(e); 303 295 JOptionPane.showMessageDialog( 304 296 MainApplication.getMainFrame(), -
applications/editors/josm/plugins/rasterfilters/src/org/openstreetmap/josm/plugins/rasterfilters/model/FilterStateModel.java
r33269 r36122 6 6 import java.util.Map.Entry; 7 7 8 import ja vax.json.Json;9 import ja vax.json.JsonObject;10 import ja vax.json.JsonObjectBuilder;8 import jakarta.json.Json; 9 import jakarta.json.JsonObject; 10 import jakarta.json.JsonObjectBuilder; 11 11 12 12 import org.openstreetmap.josm.plugins.rasterfilters.values.BooleanValue; … … 52 52 // setting up the beginning state of filter 53 53 // according to its metainfo 54 if ( json.getString("type").equals("linear_slider")) {54 if ("linear_slider".equals(json.getString("type"))) { 55 55 56 if ( valueType.equals("float") || valueType.equals("double")) {56 if ("float".equals(valueType) || "double".equals(valueType)) { 57 57 58 58 double defaultValue = json.getJsonNumber("default") … … 63 63 params.put(parameterName, value); 64 64 65 } else if ( valueType.equals("integer")) {65 } else if ("integer".equals(valueType)) { 66 66 67 67 int defaultValue = json.getJsonNumber("default").intValue(); … … 73 73 } 74 74 75 } else if ( json.getString("type").equals("checkbox")) {75 } else if ("checkbox".equals(json.getString("type"))) { 76 76 77 77 boolean defaultValue = json.getBoolean("default"); … … 80 80 params.put(parameterName, value); 81 81 82 } else if ( json.getString("type").equals("select")) {82 } else if ("select".equals(json.getString("type"))) { 83 83 84 84 String defaultValue = json.getString("default"); … … 88 88 params.put(parameterName, value); 89 89 90 } else if ( json.getString("type").equals("colorpicker")) {90 } else if ("colorpicker".equals(json.getString("type"))) { 91 91 92 92 JsonObject defaultColorJson = json.getJsonObject("default"); -
applications/editors/josm/plugins/rasterfilters/src/org/openstreetmap/josm/plugins/rasterfilters/model/FiltersManager.java
r34550 r36122 9 9 import java.rmi.server.UID; 10 10 import java.util.HashSet; 11 import java.util.Iterator;12 11 import java.util.LinkedHashMap; 13 12 import java.util.Map; 14 13 import java.util.Set; 15 14 16 import ja vax.json.JsonArray;17 import ja vax.json.JsonObject;15 import jakarta.json.JsonArray; 16 import jakarta.json.JsonObject; 18 17 import javax.swing.BorderFactory; 19 18 import javax.swing.JButton; … … 117 116 ((JComboBox<String>) component).addActionListener(filterListener); 118 117 } else if (component instanceof ColorPicker) { 119 ((ColorPicker) component).addPropertyChangeListener(filterListener);118 component.addPropertyChangeListener(filterListener); 120 119 } 121 120 … … 177 176 public BufferedImage process(BufferedImage image) { 178 177 179 Iterator<Filter> it = filtersMap.values().iterator();180 181 178 // iterating through map of filters according to the order 182 while (it.hasNext()) { 183 184 Filter curFilter = it.next(); 179 for (Filter curFilter : filtersMap.values()) { 185 180 186 181 if (!disabledFilters.contains(curFilter)) { -
applications/editors/josm/plugins/rasterfilters/src/org/openstreetmap/josm/plugins/rasterfilters/preferences/FilterInfo.java
r35647 r36122 3 3 import java.util.Objects; 4 4 5 import ja vax.json.JsonObject;5 import jakarta.json.JsonObject; 6 6 7 7 class FilterInfo { -
applications/editors/josm/plugins/rasterfilters/src/org/openstreetmap/josm/plugins/rasterfilters/preferences/FiltersDownloader.java
r35648 r36122 25 25 import java.util.regex.Pattern; 26 26 27 import ja vax.json.Json;28 import ja vax.json.JsonArray;29 import ja vax.json.JsonObject;30 import ja vax.json.JsonReader;27 import jakarta.json.Json; 28 import jakarta.json.JsonArray; 29 import jakarta.json.JsonObject; 30 import jakarta.json.JsonReader; 31 31 32 32 import org.jsoup.Jsoup; -
applications/editors/josm/plugins/reverter/build.xml
r35846 r36122 4 4 <property name="commit.message" value="Reverter: fix deleted/redacted relation members"/> 5 5 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 6 <property name="plugin.main.version" value="18 173"/>6 <property name="plugin.main.version" value="18723"/> 7 7 8 8 <!-- Configure these properties (replace "..." accordingly). -
applications/editors/josm/plugins/reverter/test/unit/reverter/ChangesetReverterTest.java
r36042 r36122 21 21 import java.util.stream.Collectors; 22 22 23 import ja vax.json.Json;24 import ja vax.json.JsonArray;25 import ja vax.json.JsonNumber;26 import ja vax.json.JsonObject;27 import ja vax.json.JsonReader;28 import ja vax.json.JsonString;29 import ja vax.json.JsonValue;23 import jakarta.json.Json; 24 import jakarta.json.JsonArray; 25 import jakarta.json.JsonNumber; 26 import jakarta.json.JsonObject; 27 import jakarta.json.JsonReader; 28 import jakarta.json.JsonString; 29 import jakarta.json.JsonValue; 30 30 31 31 import com.github.tomakehurst.wiremock.client.WireMock;
Note:
See TracChangeset
for help on using the changeset viewer.