Changeset 12778 in osm for applications/editors/josm/plugins/openvisible/src/at
- Timestamp:
- 2009-01-01T18:28:53+01:00 (16 years ago)
- Location:
- applications/editors/josm/plugins/openvisible/src/at/dallermassl/josm/plugin/openvisible
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/openvisible/src/at/dallermassl/josm/plugin/openvisible/OpenVisibleAction.java
r12588 r12778 1 1 /** 2 * 2 * 3 3 */ 4 4 package at.dallermassl.josm.plugin.openvisible; … … 40 40 public class OpenVisibleAction extends JosmAction { 41 41 private File lastDirectory; 42 42 43 43 public OpenVisibleAction() { 44 44 super(tr("Open Visible ..."), "openvisible", … … 60 60 LatLon bottomLeft = view.getLatLon(bounds.x, bounds.y + bounds.height); 61 61 LatLon topRight = view.getLatLon(bounds.x + bounds.width, bounds.y); 62 62 63 63 System.err.println("FileFind Bounds: " + bottomLeft + " to " + topRight); 64 64 65 65 JFileChooser fileChooser; 66 66 if(lastDirectory != null) { … … 73 73 File[] files = fileChooser.getSelectedFiles(); 74 74 lastDirectory = fileChooser.getCurrentDirectory(); 75 75 76 76 for(File file : files) { 77 77 try { … … 85 85 openFileAsGpx(file); 86 86 } 87 87 88 88 } 89 89 } catch (FileNotFoundException e1) { … … 95 95 } 96 96 } 97 97 98 98 } 99 99 100 100 private void openAsData(File file) throws SAXException, IOException, FileNotFoundException { 101 101 String fn = file.getName(); -
applications/editors/josm/plugins/openvisible/src/at/dallermassl/josm/plugin/openvisible/OpenVisiblePlugin.java
r12588 r12778 1 1 /** 2 * 2 * 3 3 */ 4 4 package at.dallermassl.josm.plugin.openvisible; -
applications/editors/josm/plugins/openvisible/src/at/dallermassl/josm/plugin/openvisible/OsmGpxBounds.java
r5138 r12778 1 1 /** 2 * 2 * 3 3 */ 4 4 package at.dallermassl.josm.plugin.openvisible; … … 27 27 private double minLon = 90.0; 28 28 private double maxLon = -90.0; 29 29 30 30 public OsmGpxBounds() { 31 31 32 32 } 33 33 34 34 /** 35 35 * Parses the given input stream (gpx or osm file). … … 46 46 } 47 47 } 48 49 @Override 48 49 @Override 50 50 public void startElement(String ns, String lname, String qname, Attributes a) { 51 51 if (qname.equals("node") || qname.equals("trkpt")) { … … 58 58 } 59 59 } 60 60 61 61 /** 62 62 * Returns <code>true</code>, if the given coordinates intersect with the … … 75 75 return ((lat2-lat1) > 0) && ((lon2-lon1) > 0); 76 76 } 77 77 78 78 public static void main(String[] args) { 79 79 if(args.length < 5) { … … 87 87 String[] files = new String[args.length - 4]; 88 88 System.arraycopy(args, 4, files, 0, args.length - 4); 89 90 try { 89 90 try { 91 91 File file; 92 92 for(String fileName : files) { 93 93 file = new File(fileName); 94 if(!file.isDirectory() 94 if(!file.isDirectory() 95 95 && (file.getName().endsWith("gpx") || file.getName().endsWith("osm"))) { 96 96 OsmGpxBounds parser = new OsmGpxBounds(); 97 97 parser.parse(new BufferedInputStream(new FileInputStream(file))); 98 98 if(parser.intersects(minLat, maxLat, minLon, maxLon)) { 99 System.out.println(file.getAbsolutePath()); // + "," + parser.minLat + "," + parser.maxLat + "," + parser.minLon + "," + parser.maxLon); 99 System.out.println(file.getAbsolutePath()); // + "," + parser.minLat + "," + parser.maxLat + "," + parser.minLon + "," + parser.maxLon); 100 100 } 101 101 // System.out.println(parser.intersects(47.0555, 47.09, 15.406, 15.4737)); … … 112 112 113 113 /** 114 * 114 * 115 115 */ 116 116 private static void printHelp() { 117 117 System.out.println(OsmGpxBounds.class.getName() + " <minLat> <maxLat> <minLon> <maxLon> <files+>"); 118 118 119 119 } 120 120
Note:
See TracChangeset
for help on using the changeset viewer.