Changeset 13784 in osm for applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/SVGParser.java
- Timestamp:
- 2009-02-18T23:31:32+01:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/SVGParser.java ¶
r13545 r13784 14 14 private String cViewBoxEnd = "\""; 15 15 private String cPathStart = "<path d=\""; 16 private String cPathEnd = "\"/>"; 16 private String cClosedPathEnd = "\"/>"; 17 17 18 18 /** … … 40 40 } 41 41 42 public String [] getPaths(String svg) { 42 /** 43 * Closed SVG paths are finishing with a "Z" at the end of the moves list. 44 * @param svg 45 * @return 46 */ 47 public String [] getClosedPaths(String svg) { 43 48 ArrayList<String> path = new ArrayList<String>(); 44 49 int i = 0; 45 50 while (svg.indexOf(cPathStart, i) != -1) { 46 51 int s = svg.indexOf(cPathStart, i) + cViewBoxStart.length(); 47 int e = svg.indexOf(cPathEnd, s); 52 int e = svg.indexOf(cClosedPathEnd, s); 48 53 if (s != -1 && e != -1) { 49 path.add(svg.substring(s, e)); 54 String onePath = svg.substring(s, e); 55 if (onePath.indexOf("Z") != -1) // only closed SVG path 56 path.add(onePath); 50 57 } else 51 58 break;
Note:
See TracChangeset
for help on using the changeset viewer.