Changeset 30738 in osm for applications/editors/josm/plugins/osmarender/src/org
- Timestamp:
- 2014-10-19T01:27:04+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/osmarender/src/org/openstreetmap/josm/plugins/osmarender/OsmarenderPlugin.java
r30737 r30738 54 54 55 55 @Override 56 56 public void actionPerformed(ActionEvent e) { 57 57 DataSet ds = Main.main.getCurrentDataSet(); 58 58 if (ds == null) { 59 59 return; 60 60 } 61 61 62 62 // get all stuff visible on screen 63 63 LatLon bottomLeft = Main.map.mapView.getLatLon(0,Main.map.mapView.getHeight()); … … 67 67 try { 68 68 writeGenerated(b); 69 } catch (Exception ex) {70 // how handle the exception?71 }72 69 } catch (Exception ex) { 70 // how handle the exception? 71 Main.error(ex); 72 } 73 73 74 74 String firefox = Main.pref.get("osmarender.firefox", "firefox"); 75 try { 75 try (OsmWriter w = OsmWriterFactory.createOsmWriter(new PrintWriter(new OutputStreamWriter( 76 new FileOutputStream(getPluginDir()+File.separator+"data.osm"), "UTF-8")), false, "0.6")) { 76 77 // write to plugin dir 77 OsmWriter w = OsmWriterFactory.createOsmWriter(new PrintWriter(new OutputStreamWriter(78 new FileOutputStream(getPluginDir()+File.separator+"data.osm"), "UTF-8")), false, "0.6");79 78 w.header(); 80 79 … … 116 115 117 116 // get the exec line 118 String argument; 117 String argument; 119 118 if (Main.platform instanceof PlatformHookWindows) 120 119 argument = "file:///"+getPluginDir().replace('\\','/').replace(" ","%20")+File.separator+"generated.xml\""; … … 198 197 "maxlon=\"" + b.getMax().lon() + "\" " + "/>"; 199 198 200 BufferedReader reader = new BufferedReader( 201 new FileReader( getPluginDir() + File.separator + "osm-map-features.xml") ); 202 PrintWriter writer = new PrintWriter( getPluginDir() + File.separator + "generated.xml", "UTF-8"); 203 204 // osm-map-features.xml contain two placemark 205 // (bounds_mkr1 and bounds_mkr2). We write the bounds tag 206 // between the two 207 String str = null; 208 while( (str = reader.readLine()) != null ) { 209 if(str.contains("<!--bounds_mkr1-->")) { 210 writer.println(str); 211 writer.println(" " + bounds_tag); 212 while(!str.contains("<!--bounds_mkr2-->")) { 213 str = reader.readLine(); 214 } 215 writer.println(str); 216 } else { 217 writer.println(str); 218 } 219 } 220 221 writer.close(); 222 reader.close(); 199 try ( 200 BufferedReader reader = new BufferedReader( 201 new FileReader( getPluginDir() + File.separator + "osm-map-features.xml") ); 202 PrintWriter writer = new PrintWriter( getPluginDir() + File.separator + "generated.xml", "UTF-8"); 203 ) { 204 // osm-map-features.xml contain two placemark 205 // (bounds_mkr1 and bounds_mkr2). We write the bounds tag between the two 206 String str = null; 207 while( (str = reader.readLine()) != null ) { 208 if(str.contains("<!--bounds_mkr1-->")) { 209 writer.println(str); 210 writer.println(" " + bounds_tag); 211 while(!str.contains("<!--bounds_mkr2-->")) { 212 str = reader.readLine(); 213 } 214 writer.println(str); 215 } else { 216 writer.println(str); 217 } 218 } 219 } 223 220 } 224 221 }
Note:
See TracChangeset
for help on using the changeset viewer.