Changeset 33047 in osm for applications/editors/josm
- Timestamp:
- 2016-10-30T21:24:41+01:00 (8 years ago)
- Location:
- applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastrePlugin.java
r32556 r33047 199 199 super(info); 200 200 Main.info("Pluging cadastre-fr v"+VERSION+" started..."); 201 initCacheDir(); 202 203 refreshConfiguration(); 204 205 UploadAction.registerUploadHook(new CheckSourceUploadHook()); 206 207 registerSessionLayerExporter(WMSLayer.class, CadastreSessionExporter.class); 208 registerSessionLayerImporter("cadastre-fr", CadastreSessionImporter.class); 209 } 210 211 private static void initCacheDir() { 201 212 if (Main.pref.get("cadastrewms.cacheDir").isEmpty()) { 202 213 cacheDir = new File(Main.pref.getCacheDirectory(), "cadastrewms").getAbsolutePath(); … … 207 218 cacheDir += File.separatorChar; 208 219 Main.info("current cache directory: "+cacheDir); 209 210 refreshConfiguration();211 212 UploadAction.registerUploadHook(new CheckSourceUploadHook());213 214 registerSessionLayerExporter(WMSLayer.class, CadastreSessionExporter.class);215 registerSessionLayerImporter("cadastre-fr", CadastreSessionImporter.class);216 220 } 217 221 … … 357 361 JMenuItem item = cadastreJMenu.getItem(i); 358 362 if (item != null) 359 if (item.getText().equals(MenuActionGrabPlanImage. name) /*||363 if (item.getText().equals(MenuActionGrabPlanImage.NAME) /*|| 360 364 item.getText().equals(MenuActionGrab.name) || 361 365 item.getText().equals(MenuActionBoundaries.name) || -
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/DownloadSVGTask.java
r32556 r33047 203 203 file.delete(); 204 204 try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file, true)); 205 InputStreamReader isr = new InputStreamReader(is );205 InputStreamReader isr = new InputStreamReader(is, StandardCharsets.UTF_8); 206 206 BufferedReader br = new BufferedReader(isr)) { 207 207 String line; -
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionBoundaries.java
r32556 r33047 12 12 13 13 public class MenuActionBoundaries extends JosmAction { 14 15 public static String name= "Administrative boundary";14 15 public static final String NAME = "Administrative boundary"; 16 16 17 17 private static final long serialVersionUID = 1L; 18 18 private WMSLayer wmsLayer = null; 19 19 20 /** 21 * Constructs a new {@code MenuActionBoundaries}. 22 */ 20 23 public MenuActionBoundaries() { 21 super(tr( name), "cadastre_small", tr("Extract commune boundary"), null, false);24 super(tr(NAME), "cadastre_small", tr("Extract commune boundary"), null, false); 22 25 } 23 26 … … 35 38 } 36 39 } 37 38 40 } -
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionCancelGrab.java
r32556 r33047 12 12 public class MenuActionCancelGrab extends JosmAction { 13 13 14 public static String name= marktr("Cancel current grab");14 public static final String NAME = marktr("Cancel current grab"); 15 15 16 16 private WMSLayer wmsLayer; 17 17 18 /** 19 * Constructs a new {@code MenuActionCancelGrab}. 20 * @param wmsLayer WMS layer 21 */ 18 22 public MenuActionCancelGrab(WMSLayer wmsLayer) { 19 super(tr( name), null, tr("Cancel current grab (only vector images)"), null, false);23 super(tr(NAME), null, tr("Cancel current grab (only vector images)"), null, false); 20 24 this.wmsLayer = wmsLayer; 21 25 } -
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionGrab.java
r32556 r33047 17 17 public class MenuActionGrab extends JosmAction { 18 18 19 public static String name= marktr("Cadastre grab");19 public static final String NAME = marktr("Cadastre grab"); 20 20 21 /** 22 * Constructs a new {@code MenuActionGrab}. 23 */ 21 24 public MenuActionGrab() { 22 super(tr( name), "cadastre_small", tr("Download Image from French Cadastre WMS"),25 super(tr(NAME), "cadastre_small", tr("Download Image from French Cadastre WMS"), 23 26 Shortcut.registerShortcut("cadastre:grab", tr("Cadastre: {0}", tr("Download Image from French Cadastre WMS")), 24 27 KeyEvent.VK_F10, Shortcut.DIRECT), false, "cadastrefr/grab", true); … … 38 41 new MenuActionNewLocation().actionPerformed(e); 39 42 } 40 41 43 } -
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionGrabPlanImage.java
r32556 r33047 20 20 private static final long serialVersionUID = 1L; 21 21 22 public static String name= marktr("Georeference an image");22 public static final String NAME = marktr("Georeference an image"); 23 23 24 24 private DownloadWMSPlanImage downloadWMSPlanImage; … … 26 26 private RasterImageGeoreferencer rasterImageGeoreferencer; 27 27 28 /** 29 * Constructs a new {@code MenuActionGrabPlanImage}. 30 */ 28 31 public MenuActionGrabPlanImage() { 29 super(tr( name), "cadastre_small", tr("Grab non-georeferenced image"), null, false, "cadastrefr/grabplanimage", true);32 super(tr(NAME), "cadastre_small", tr("Grab non-georeferenced image"), null, false, "cadastrefr/grabplanimage", true); 30 33 rasterImageGeoreferencer = new RasterImageGeoreferencer(); 31 34 } -
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionOpenPreferences.java
r32556 r33047 14 14 private static final long serialVersionUID = 1L; 15 15 16 public static String name= marktr("Preferences");16 public static final String NAME = marktr("Preferences"); 17 17 18 /** 19 * Constructs a new {@code MenuActionOpenPreferences}. 20 */ 18 21 public MenuActionOpenPreferences() { 19 super(tr( name), "cadastre_small", tr("Open Cadastre Preferences"), null, false, "cadastrefr/openpreferences", true);22 super(tr(NAME), "cadastre_small", tr("Open Cadastre Preferences"), null, false, "cadastrefr/openpreferences", true); 20 23 } 21 24 -
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionRefineGeoRef.java
r32556 r33047 12 12 public class MenuActionRefineGeoRef extends JosmAction { 13 13 14 public static String name= marktr("Refine georeferencing");14 public static final String NAME = marktr("Refine georeferencing"); 15 15 16 16 private WMSLayer wmsLayer; 17 17 private RasterImageGeoreferencer rasterImageGeoreferencer; 18 18 19 /** 20 * Constructs a new {@code MenuActionRefineGeoRef}. 21 * @param wmsLayer WMS layer 22 */ 19 23 public MenuActionRefineGeoRef(WMSLayer wmsLayer) { 20 super(tr( name), null, tr("Improve georeferencing (only raster images)"), null, false);24 super(tr(NAME), null, tr("Improve georeferencing (only raster images)"), null, false); 21 25 this.wmsLayer = wmsLayer; 22 26 rasterImageGeoreferencer = new RasterImageGeoreferencer(); -
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionSaveRasterAs.java
r32556 r33047 9 9 import java.io.File; 10 10 import java.io.IOException; 11 import java.util.Locale; 11 12 12 13 import javax.imageio.ImageIO; … … 29 30 public class MenuActionSaveRasterAs extends JosmAction { 30 31 31 public static String name= marktr("Save image as...");32 public static final String NAME = marktr("Save image as..."); 32 33 33 34 private static final long serialVersionUID = 1L; … … 41 42 return true; 42 43 } 43 return file.getName().toLowerCase( ).endsWith(".png");44 return file.getName().toLowerCase(Locale.ENGLISH).endsWith(".png"); 44 45 } 45 46 … … 56 57 return true; 57 58 } 58 return file.getName().toLowerCase( ).endsWith(".tif");59 return file.getName().toLowerCase(Locale.ENGLISH).endsWith(".tif"); 59 60 } 60 61 … … 68 69 FiltrePng filtrePng = new FiltrePng(); 69 70 71 /** 72 * Constructs a new {@code MenuActionSaveRasterAs}. 73 * @param wmsLayer WMS layer 74 */ 70 75 public MenuActionSaveRasterAs(WMSLayer wmsLayer) { 71 super(tr( name), "save", tr("Export image (only raster images)"), null, false);76 super(tr(NAME), "save", tr("Export image (only raster images)"), null, false); 72 77 this.wmsLayer = wmsLayer; 73 78 } … … 126 131 coverage.dispose(true); 127 132 } catch (Exception e) { 128 // TODO Auto-generated catch block 129 e.printStackTrace(); 133 Main.error(e); 130 134 } 131 135 } -
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/RasterImageGeoreferencer.java
r32556 r33047 168 168 * around org1/dst1 anchor 169 169 * @param org1 first point at original coordinate system (the grabbed image) 170 * @param org2 second point "170 * @param org2 second point 171 171 * @param dst1 first point at final destination coordinate system (the real east/north coordinate system) 172 * @param dst2 second point "172 * @param dst2 second point 173 173 */ 174 174 private void affineTransform(EastNorth org1, EastNorth org2, EastNorth dst1, EastNorth dst2) { … … 188 188 double dy = dst1.getY() - org1.getY(); 189 189 wmsLayer.getImage(0).shear(dx, dy); 190 org1 = org1.add(dx, dy); // org1=dst1 now 191 org2 = org2.add(dx, dy); 192 // rotate : org1(=dst1 now) is anchor for rotation and scale 190 // rotate : dst1 is anchor for rotation and scale 193 191 wmsLayer.getImage(0).rotate(dst1, angle); 194 org2 = org2.rotate(dst1, angle); 195 // scale image from anchor org1(=dst1 now) 192 // scale image from anchor dst1 196 193 wmsLayer.getImage(0).scale(dst1, proportion); 197 194 } -
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/SimplifyWay.java
r32556 r33047 7 7 import org.openstreetmap.josm.data.osm.Node; 8 8 import org.openstreetmap.josm.data.osm.Way; 9 import org.openstreetmap.josm.data.projection.Ellipsoid; 9 10 10 11 /** … … 34 35 } 35 36 36 /* 37 /** 37 38 * Takes an interval [from,to] and adds nodes from (from,to) to ns. 38 39 * (from and to are indices of wnew.nodes.) … … 45 46 for (int i = from + 1; i < to; i++) { 46 47 Node n = wnew.getNode(i); 47 double xte = Math.abs(E ARTH_RAD48 double xte = Math.abs(Ellipsoid.WGS84.a 48 49 * xtd(fromN.getCoor().lat() * Math.PI / 180, fromN.getCoor().lon() * Math.PI / 180, toN.getCoor().lat() * Math.PI 49 50 / 180, toN.getCoor().lon() * Math.PI / 180, n.getCoor().lat() * Math.PI / 180, n.getCoor().lon() * Math.PI … … 61 62 } 62 63 } 63 64 public static double EARTH_RAD = 6378137.0;65 64 66 65 /* From Aviaton Formulary v1.3
Note:
See TracChangeset
for help on using the changeset viewer.