Changeset 34223 in osm for applications/editors/josm/plugins
- Timestamp:
- 2018-05-29T01:26:17+02:00 (7 years ago)
- Location:
- applications/editors/josm/plugins/cadastre-fr
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/cadastre-fr/.settings/org.eclipse.jdt.core.prefs
r34115 r34223 41 41 org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled 42 42 org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled 43 org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=p ublic43 org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private 44 44 org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore 45 45 org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning … … 55 55 org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled 56 56 org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled 57 org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=p ublic57 org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private 58 58 org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore 59 59 org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled -
applications/editors/josm/plugins/cadastre-fr/src/org/openstreetmap/josm/plugins/fr/cadastre/actions/mapmode/Address.java
r33706 r34223 89 89 JLabel link = new JLabel(); 90 90 private transient Way selectedWay; 91 private boolean shift;92 private boolean ctrl;93 91 94 92 /** … … 129 127 if (e.getButton() != MouseEvent.BUTTON1) 130 128 return; 131 shift = (e.getModifiers() & ActionEvent.SHIFT_MASK) != 0; 132 ctrl = (e.getModifiers() & ActionEvent.CTRL_MASK) != 0; 129 updateKeyModifiers(e); 133 130 MapView mv = MainApplication.getMap().mapView; 134 131 Point mousePos = e.getPoint(); … … 379 376 // fall through to default action. 380 377 // (for semi-parallel lines, intersection might be miles away!) 381 if (MainApplication.getMap().mapView.getPoint(n).distance(MainApplication.getMap().mapView.getPoint(intersection)) < snapToIntersectionThreshold) { 378 MapView mv = MainApplication.getMap().mapView; 379 if (mv.getPoint(n).distance(mv.getPoint(intersection)) < snapToIntersectionThreshold) { 382 380 n.setEastNorth(intersection); 383 381 return; 384 382 } 385 383 // fall through 386 384 default: 387 385 EastNorth P = n.getEastNorth(); -
applications/editors/josm/plugins/cadastre-fr/src/org/openstreetmap/josm/plugins/fr/cadastre/actions/upload/CheckSourceUploadHook.java
r34139 r34223 55 55 /** 56 56 * Check whenever one of the keys of the object is "source" 57 * @param osm primitive to check 57 58 * @return true if one of keys is "source" 58 59 */ 59 60 private boolean tagSourceExist(OsmPrimitive osm) { 60 for (String key : osm.keySet()) { 61 if (key.equals("source")) { 62 return true; 63 } 64 } 65 return false; 61 return osm.hasKey("source"); 66 62 } 67 63 -
applications/editors/josm/plugins/cadastre-fr/src/org/openstreetmap/josm/plugins/fr/cadastre/download/CadastreDownloadData.java
r33675 r34223 18 18 /** 19 19 * Constructs a new {@code CadastreDownloadData}. 20 * @param downloadWater whether to download water layer 21 * @param downloadBuilding whether to download building layer 22 * @param downloadSymbol whether to download symbol layer 23 * @param downloadParcel whether to download parcel layer 24 * @param downloadParcelNumber whether to download parcel number layer 25 * @param downloadAddress whether to download address layer 26 * @param downloadLocality whether to download locality layer 27 * @param downloadSection whether to download section layer 28 * @param downloadCommune whether to download communal layer 20 29 */ 21 30 CadastreDownloadData(boolean downloadWater, boolean downloadBuilding, boolean downloadSymbol, -
applications/editors/josm/plugins/cadastre-fr/src/org/openstreetmap/josm/plugins/fr/cadastre/edigeo/EdigeoLotFile.java
r34115 r34223 77 77 /** 78 78 * Finds a descriptor by its identifier. 79 * @param <T> block type 79 80 * @param values 4 values obtained from a {@code EdigeoRecord}:<ol> 80 81 * <li>Lot identifier</li> -
applications/editors/josm/plugins/cadastre-fr/src/org/openstreetmap/josm/plugins/fr/cadastre/edigeo/utils/ClassToInstancesMap.java
r33649 r34223 20 20 * entry for this class is present. This will only return values that were 21 21 * bound to this specific class, not values that may have been bound to a subtype. 22 * @param <T> block type 22 23 * @param type type 23 24 * @return the values the specified class is mapped to, or {@code null} … … 28 29 * Maps the specified class to the specified values. Does <i>not</i> associate 29 30 * these values with any of the class's supertypes. 31 * @param <T> block type 30 32 * @param type type 31 33 * @param values new values … … 38 40 /** 39 41 * Adds a new value to the list mapped to the specified class. 42 * @param <T> block type 40 43 * @param type type 41 44 * @param value value to add -
applications/editors/josm/plugins/cadastre-fr/src/org/openstreetmap/josm/plugins/fr/cadastre/wms/CacheFileLambert4ZoneFilter.java
r33638 r34223 17 17 private final String description; 18 18 19 /** 20 * Filters for each one of the 4 Lambert zones. 21 */ 19 22 public static final CacheFileLambert4ZoneFilter[] filters = { 20 23 new CacheFileLambert4ZoneFilter("1", tr("Lambert Zone {0} cache file (.{0})", 1)), … … 26 29 /** 27 30 * Construct an extension file filter by giving the extension to check after. 28 * 31 * @param extension file extension 32 * @param description file description 29 33 */ 30 34 private CacheFileLambert4ZoneFilter(String extension, String description) { … … 33 37 } 34 38 35 publicboolean acceptName(String filename) {39 boolean acceptName(String filename) { 36 40 String name = filename.toLowerCase(Locale.FRANCE); 37 41 for (String ext : extension.split(",")) { -
applications/editors/josm/plugins/cadastre-fr/src/org/openstreetmap/josm/plugins/fr/cadastre/wms/CacheFileLambert9ZoneFilter.java
r33638 r34223 16 16 private final String description; 17 17 18 /** 19 * Filters for each one of the 9 Lambert zones. 20 */ 18 21 public static CacheFileLambert9ZoneFilter[] filters = { 19 22 new CacheFileLambert9ZoneFilter("cc1", tr("Lambert CC9 Zone {0} cache file (.CC{0})", 1)), … … 30 33 /** 31 34 * Construct an extension file filter by giving the extension to check after. 32 * 35 * @param extension file extension 36 * @param description file description 33 37 */ 34 38 private CacheFileLambert9ZoneFilter(String extension, String description) { … … 37 41 } 38 42 39 publicboolean acceptName(String filename) {43 boolean acceptName(String filename) { 40 44 String name = filename.toLowerCase(); 41 45 for (String ext : extension.split(",")) { … … 57 61 return description; 58 62 } 59 60 63 } -
applications/editors/josm/plugins/cadastre-fr/src/org/openstreetmap/josm/plugins/fr/cadastre/wms/CacheFileUTM20NFilter.java
r33638 r34223 16 16 private final String description; 17 17 18 /** 19 * Filters for each one of the 4 French UTM zones. 20 */ 18 21 public static CacheFileUTM20NFilter[] filters = { 19 22 new CacheFileUTM20NFilter("utm1", tr("Guadeloupe Fort-Marigot cache file (.UTM1)")), … … 25 28 /** 26 29 * Construct an extension file filter by giving the extension to check after. 27 * 30 * @param extension file extension 31 * @param description file description 28 32 */ 29 33 private CacheFileUTM20NFilter(String extension, String description) { … … 32 36 } 33 37 34 publicboolean acceptName(String filename) {38 boolean acceptName(String filename) { 35 39 String name = filename.toLowerCase(); 36 40 for (String ext : extension.split(",")) { … … 52 56 return description; 53 57 } 54 55 58 } -
applications/editors/josm/plugins/cadastre-fr/src/org/openstreetmap/josm/plugins/fr/cadastre/wms/CadastreGrabber.java
r33640 r34223 21 21 private CadastreInterface wmsInterface = new CadastreInterface(); 22 22 23 publicGeorefImage grab(WMSLayer wmsLayer, EastNorth lambertMin, EastNorth lambertMax)23 GeorefImage grab(WMSLayer wmsLayer, EastNorth lambertMin, EastNorth lambertMax) 24 24 throws IOException, OsmTransferException { 25 25 try { … … 89 89 } 90 90 91 publicCadastreInterface getWmsInterface() {91 CadastreInterface getWmsInterface() { 92 92 return wmsInterface; 93 93 } -
applications/editors/josm/plugins/cadastre-fr/src/org/openstreetmap/josm/plugins/fr/cadastre/wms/CadastreInterface.java
r34115 r34223 38 38 39 39 public class CadastreInterface { 40 publicboolean downloadCanceled;40 boolean downloadCanceled; 41 41 private Response urlConn; 42 42 … … 60 60 private long cookieTimestamp; 61 61 62 publicstatic final String BASE_URL = "https://www.cadastre.gouv.fr";62 static final String BASE_URL = "https://www.cadastre.gouv.fr"; 63 63 static final String C_IMAGE_FORMAT = "Cette commune est au format "; 64 64 static final String C_COMMUNE_LIST_START = "<select name=\"codeCommune\""; … … 84 84 static final int RETRIES_GET_COOKIE = 10; // 10 times every 3 seconds means 30 seconds trying to get a cookie 85 85 86 publicboolean retrieveInterface(WMSLayer wmsLayer) throws DuplicateLayerException, WMSException {86 boolean retrieveInterface(WMSLayer wmsLayer) throws DuplicateLayerException, WMSException { 87 87 if (wmsLayer.getName().isEmpty()) 88 88 return false; … … 120 120 * Returns if a cookie is delivered by WMS, throws exception if WMS is not opening a client session 121 121 * (too many clients or in maintenance) 122 * @throws IOException if an I/O error occurs 122 123 */ 123 124 private void getCookie() throws IOException { … … 174 175 } 175 176 176 publicvoid resetCookie() {177 void resetCookie() { 177 178 lastWMSLayerName = null; 178 179 cookie = null; 179 180 } 180 181 181 publicboolean isCookieExpired() {182 boolean isCookieExpired() { 182 183 long now = new Date().getTime(); 183 184 if ((now - cookieTimestamp) > COOKIE_EXPIRATION) { … … 188 189 } 189 190 190 publicvoid resetInterfaceRefIfNewLayer(String newWMSLayerName) {191 void resetInterfaceRefIfNewLayer(String newWMSLayerName) { 191 192 if (!newWMSLayerName.equals(lastWMSLayerName)) { 192 193 interfaceRef = null; … … 195 196 } 196 197 197 publicHttpClient getHttpClient(URL url) {198 HttpClient getHttpClient(URL url) { 198 199 return HttpClient.create(url).setHeader("Cookie", cookie); 199 200 } 200 201 201 publicHttpClient getHttpClient(URL url, String method) {202 HttpClient getHttpClient(URL url, String method) { 202 203 return HttpClient.create(url, method).setHeader("Cookie", cookie); 203 204 } … … 275 276 * The returned string is the interface name used in further requests, e.g. "afficherCarteCommune.do?c=QP224" 276 277 * where QP224 is the code commune known by the WMS (or "afficherCarteTa.do?c=..." for raster images). 278 * @param wmsLayer WMS layer 279 * @param codeCommune Commune code 277 280 * 278 281 * @return retURL url to available code commune in the cadastre; "" if not found 282 * @throws IOException if an I/O error occurs 279 283 */ 280 284 private String postForm(WMSLayer wmsLayer, String codeCommune) throws IOException { … … 466 470 * @throws IOException if any I/O error occurs 467 471 */ 468 publicvoid retrieveCommuneBBox(WMSLayer wmsLayer) throws IOException {472 void retrieveCommuneBBox(WMSLayer wmsLayer) throws IOException { 469 473 if (interfaceRef == null) 470 474 return; … … 542 546 } 543 547 544 publicvoid cancel() {548 void cancel() { 545 549 if (urlConn != null) { 546 550 urlConn.disconnect(); … … 550 554 } 551 555 552 publicInputStream getContent(URL url) throws IOException, OsmTransferException {556 InputStream getContent(URL url) throws IOException, OsmTransferException { 553 557 urlConn = getHttpClient(url).setHeader("Connection", "close").connect(); 554 558 return urlConn.getContent(); -
applications/editors/josm/plugins/cadastre-fr/src/org/openstreetmap/josm/plugins/fr/cadastre/wms/GrabThread.java
r33640 r34223 36 36 /** 37 37 * Call directly grabber for raster images or prepare thread for vector images 38 * @param moreImages more images to grab 38 39 */ 39 publicvoid addImages(ArrayList<EastNorthBound> moreImages) {40 void addImages(ArrayList<EastNorthBound> moreImages) { 40 41 lockImagesToGrag.lock(); 41 42 imagesToGrab.addAll(moreImages); … … 57 58 } 58 59 59 publicArrayList<EastNorthBound> getImagesToGrabCopy() {60 ArrayList<EastNorthBound> getImagesToGrabCopy() { 60 61 ArrayList<EastNorthBound> copyList = new ArrayList<>(); 61 62 lockImagesToGrag.lock(); … … 68 69 } 69 70 70 publicvoid clearImagesToGrab() {71 void clearImagesToGrab() { 71 72 lockImagesToGrag.lock(); 72 73 imagesToGrab.clear(); … … 143 144 } 144 145 145 publicvoid saveToCache(GeorefImage image) {146 void saveToCache(GeorefImage image) { 146 147 if (CacheControl.cacheEnabled && !wmsLayer.isRaster()) { 147 148 getCacheControl().saveCache(image); … … 160 161 } 161 162 163 /** 164 * Cancel grab. 165 */ 162 166 public void cancel() { 163 167 clearImagesToGrab(); … … 170 174 } 171 175 176 /** 177 * Returns the Cache control. 178 * @return the Cache control 179 */ 172 180 public CacheControl getCacheControl() { 173 181 if (cacheControl == null) … … 176 184 } 177 185 178 publicGrabThread(WMSLayer wmsLayer) {186 GrabThread(WMSLayer wmsLayer) { 179 187 this.wmsLayer = wmsLayer; 180 188 } 181 189 182 publicvoid paintBoxesToGrab(Graphics g, MapView mv) {190 void paintBoxesToGrab(Graphics g, MapView mv) { 183 191 if (getImagesToGrabSize() > 0) { 184 192 ArrayList<EastNorthBound> imagesToGrab = getImagesToGrabCopy(); … … 207 215 } 208 216 209 publicboolean isCanceled() {217 boolean isCanceled() { 210 218 return canceled; 211 219 } 212 220 213 publicvoid setCanceled(boolean canceled) {221 void setCanceled(boolean canceled) { 214 222 this.canceled = canceled; 215 223 } 216 224 217 publicCadastreGrabber getGrabber() {225 CadastreGrabber getGrabber() { 218 226 return grabber; 219 227 } 220 228 221 publicvoid setGrabber(CadastreGrabber grabber) {229 void setGrabber(CadastreGrabber grabber) { 222 230 this.grabber = grabber; 223 231 } -
applications/editors/josm/plugins/cadastre-fr/src/org/openstreetmap/josm/plugins/fr/cadastre/wms/ImageModifier.java
r33638 r34223 20 20 protected BufferedImage bufferedImage; 21 21 22 p ublicstatic int[] cRoofColors = new int[] {-197380, -592138};23 p ublicstatic int[] cBuilingFootColors = new int[] {-256};22 private static int[] cRoofColors = new int[] {-197380, -592138}; 23 private static int[] cBuilingFootColors = new int[] {-256}; 24 24 25 25 protected BufferedImage convert1(BufferedImage src) { … … 70 70 }; 71 71 return convert4(src, cmap); 72 72 } 73 73 74 75 76 77 78 79 80 81 74 /** 75 * Converts the source image to 4-bit colour 76 * using the given colour map. No transparency. 77 * @param src the source image to convert 78 * @param cmap the colour map, which should contain no more than 16 entries 79 * The entries are in the form RRGGBB (hex). 80 * @return a copy of the source image with a 4-bit colour depth, with the custom colour pallette 81 */ 82 82 protected BufferedImage convert4(BufferedImage src, int[] cmap) { 83 83 IndexColorModel icm = new IndexColorModel( … … 156 156 /** 157 157 * Checks if the rgb value is the black background color 158 * @param img image 159 * @param x X coordinate 160 * @param y Y coordinate 161 * @return {@code true} if the rgb value is the black background color 158 162 */ 159 163 public boolean isBackgroundColor(BufferedImage img, int x, int y) {
Note:
See TracChangeset
for help on using the changeset viewer.