Changeset 32556 in osm for applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/SVGParser.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/SVGParser.java
r30737 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 … … 7 7 * This class is not intended to be a real SVG parser. It's also not using existing 8 8 * xml parsers. It's just extracting the required strings from an SVG file coming 9 * from the French land registry cadastre.gouv.fr 9 * from the French land registry cadastre.gouv.fr 10 10 * 11 11 */ … … 29 29 try { 30 30 String str = svg.substring(s, e); 31 String [] viewBox = str.split(" ");31 String[] viewBox = str.split(" "); 32 32 double[] dbox = new double[4]; 33 for (int i = 0; i<4; i++) 34 dbox[i] = Double.parseDouble(viewBox[i]); 33 for (int i = 0; i < 4; i++) { 34 dbox[i] = Double.parseDouble(viewBox[i]); 35 } 35 36 return dbox; 36 37 } catch (Exception ex) { … … 40 41 return null; 41 42 } 42 43 43 44 /** 44 45 * Closed SVG paths are finishing with a "Z" at the end of the moves list. 45 * @param svg46 * @return47 46 */ 48 public String [] getClosedPaths(String svg) {47 public String[] getClosedPaths(String svg) { 49 48 ArrayList<String> path = new ArrayList<>(); 50 49 int i = 0; … … 53 52 int e = svg.indexOf(cClosedPathEnd, s); 54 53 if (s != -1 && e != -1) { 55 String onePath = svg.substring(s, e); 54 String onePath = svg.substring(s, e); 56 55 if (onePath.indexOf("Z") != -1) // only closed SVG path 57 56 path.add(onePath);
Note:
See TracChangeset
for help on using the changeset viewer.
