Changeset 28571 in osm
- Timestamp:
- 2012-08-19T01:22:45+02:00 (12 years ago)
- Location:
- applications/editors/josm/plugins/poly
- Files:
-
- 3 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/poly/build.xml
r28570 r28571 99 99 <attribute name="Plugin-Class" value="poly.PolyPlugin"/> 100 100 <attribute name="Plugin-Date" value="${version.entry.commit.date}"/> 101 <attribute name="Plugin-Description" value="Read and write osmosis' poly fil es"/>101 <attribute name="Plugin-Description" value="Read and write osmosis' poly filter files"/> 102 102 <attribute name="Plugin-Early" value="false"/> 103 103 <!--<attribute name="Plugin-Icon" value="images/pbf_24.png"/>--> -
applications/editors/josm/plugins/poly/src/poly/PolyImporter.java
r28570 r28571 94 94 parsingSection = false; 95 95 } 96 }97 98 if( !parsingSection ) {99 area = new Area(line);100 parsingSection = true;101 96 } else { 102 // reading area, parse coordinates 103 String[] tokens = line.split("\\s+"); 104 double[] coords = new double[2]; 105 int tokenCount = 0; 106 for( String token : tokens ) { 107 if( token.length() > 0 ) { 108 if( tokenCount > 2 ) 109 throw new IllegalDataException(tr("A polygon coordinate line must contain exactly 2 numbers")); 110 try { 111 coords[tokenCount++] = Double.parseDouble(token); 112 } catch( NumberFormatException e ) { 113 throw new IllegalDataException(tr("Unable to parse {0} as a number", token)); 97 if( !parsingSection ) { 98 area = new Area(line); 99 parsingSection = true; 100 } else { 101 // reading area, parse coordinates 102 String[] tokens = line.split("\\s+"); 103 double[] coords = new double[2]; 104 int tokenCount = 0; 105 for( String token : tokens ) { 106 if( token.length() > 0 ) { 107 if( tokenCount > 2 ) 108 throw new IllegalDataException(tr("A polygon coordinate line must contain exactly 2 numbers")); 109 try { 110 coords[tokenCount++] = Double.parseDouble(token); 111 } catch( NumberFormatException e ) { 112 throw new IllegalDataException(tr("Unable to parse {0} as a number", token)); 113 } 114 114 } 115 115 } 116 if( tokenCount < 2 ) 117 throw new IllegalDataException(tr("A polygon coordinate line must contain exactly 2 numbers")); 118 LatLon coord = new LatLon(coords[1], coords[0]); 119 if( !coord.isValid() ) 120 throw new IllegalDataException(tr("Invalid coordinates were found: {0}, {1}", coord.lat(), coord.lon())); 121 area.addNode(coord); 116 122 } 117 if( tokenCount < 2 )118 throw new IllegalDataException(tr("A polygon coordinate line must contain exactly 2 numbers"));119 LatLon coord = new LatLon(coords[1], coords[0]);120 if( !coord.isValid() )121 throw new IllegalDataException(tr("Invalid coordinates were found"));122 area.addNode(coord);123 123 } 124 124 } … … 128 128 private DataSet constructDataSet( List<Area> areas ) { 129 129 DataSet ds = new DataSet(); 130 ds.setUploadDiscouraged(true); 131 130 132 boolean foundInner = false; 131 133 for( Area area : areas ) { … … 187 189 public void constructWay( DataSet ds ) { 188 190 way = new Way(); 189 for( LatLon coord : nodes ) 190 way.addNode(new Node(coord)); 191 for( LatLon coord : nodes ) { 192 Node node = new Node(coord); 193 ds.addPrimitive(node); 194 way.addNode(node); 195 } 191 196 way.addNode(way.getNode(0)); 192 197 way.put("ref", name); -
applications/editors/josm/plugins/poly/src/poly/PolyType.java
r28570 r28571 11 11 public interface PolyType { 12 12 public static final String EXTENSION = "poly"; 13 public static final ExtensionFileFilter FILE_FILTER = new ExtensionFileFilter(EXTENSION, EXTENSION, tr("Osmosis polygon fil es") + " (*." + EXTENSION + ")");13 public static final ExtensionFileFilter FILE_FILTER = new ExtensionFileFilter(EXTENSION, EXTENSION, tr("Osmosis polygon filter files") + " (*." + EXTENSION + ")"); 14 14 }
Note:
See TracChangeset
for help on using the changeset viewer.