Changeset 32556 in osm for applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/DownloadSVGBuilding.java
- Timestamp:
- 2016-07-04T14:18:17+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/DownloadSVGBuilding.java
r32425 r32556 1 // License: GPL. v2 and later. Copyright 2008-2009 by Pieren <pieren3@gmail.com> and others1 // License: GPL. For details, see LICENSE file. 2 2 package cadastre_fr; 3 3 … … 106 106 107 107 // convert SVG nodes to eastNorth coordinates 108 for (int i =0; i< SVGpaths.length; i++) {108 for (int i = 0; i < SVGpaths.length; i++) { 109 109 ArrayList<EastNorth> eastNorth = new ArrayList<>(); 110 110 createNodes(SVGpaths[i], eastNorth); … … 147 147 for (Way w : svgDataSet.getWays()) { 148 148 int replaced = 0; 149 for (Node node : w.getNodes()) 149 for (Node node : w.getNodes()) { 150 150 if (node == n) { 151 151 node = nearestNewNode; 152 152 replaced++; 153 153 } 154 } 154 155 if (w.getNodesCount() == replaced) 155 156 w.setDeleted(true); … … 161 162 162 163 Collection<Command> cmds = new LinkedList<>(); 163 for (Node node : svgDataSet.getNodes()) 164 for (Node node : svgDataSet.getNodes()) { 164 165 if (!node.isDeleted()) 165 166 cmds.add(new AddCommand(node)); 166 for (Way way : svgDataSet.getWays()) 167 } 168 for (Way way : svgDataSet.getWays()) { 167 169 if (!way.isDeleted()) 168 170 cmds.add(new AddCommand(way)); 171 } 169 172 Main.main.undoRedo.add(new SequenceCommand(tr("Create buildings"), cmds)); 170 173 Main.map.repaint(); … … 176 179 double dx = Double.parseDouble(coor[1]); 177 180 double dy = Double.parseDouble(coor[2]); 178 for (int i =3; i<coor.length; i+=2){181 for (int i = 3; i < coor.length; i += 2) { 179 182 if (coor[i].isEmpty()) { 180 183 eastNorth.clear(); // some paths are just artifacts 181 184 return; 182 185 } 183 double east = dx +=Double.parseDouble(coor[i]);184 double north = dy +=Double.parseDouble(coor[i+1]);185 eastNorth.add(new EastNorth(east,north)); 186 double east = dx += Double.parseDouble(coor[i]); 187 double north = dy += Double.parseDouble(coor[i+1]); 188 eastNorth.add(new EastNorth(east, north)); 186 189 } 187 190 // flip the image (svg using a reversed Y coordinate system) … … 240 243 241 244 private String grabSVG(URL url) throws IOException, OsmTransferException { 242 wmsInterface.urlConn = (HttpURLConnection)url.openConnection(); 245 wmsInterface.urlConn = (HttpURLConnection) url.openConnection(); 243 246 wmsInterface.urlConn.setRequestProperty("Connection", "close"); 244 247 wmsInterface.urlConn.setRequestMethod("GET"); … … 253 256 BufferedReader br = new BufferedReader(isr)) { 254 257 String line; 255 while ( null!=(line=br.readLine())){258 while (null != (line = br.readLine())) { 256 259 line += "\n"; 257 260 bos.write(line.getBytes(StandardCharsets.UTF_8));
Note:
See TracChangeset
for help on using the changeset viewer.
