@Test public void mainTest() { String[] args = new String[] {}; verifyInvalidArguments(args); args = new String[] { "file/not/found.map" }; verifyInvalidArguments(args); }
public static void main(String[] args) { File mapFile = getMapFile(args); MapView mapView = createMapView(); final BoundingBox boundingBox = addLayers(mapView, mapFile); PreferencesFacade preferencesFacade = new JavaUtilPreferences(Preferences.userNodeForPackage(MapViewer.class)); final Model model = mapView.getModel(); model.init(preferencesFacade); MainFrame mainFrame = new MainFrame(); mainFrame.add(mapView); mainFrame.addWindowListener(new WindowCloseDialog(mainFrame, model, preferencesFacade)); mainFrame.setVisible(true); mainFrame.addWindowListener(new WindowAdapter() { @Override public void windowOpened(WindowEvent e) { byte zoomLevel = LatLongUtils.zoomForBounds(model.mapViewDimension.getDimension(), boundingBox, model.displayModel.getTileSize()); model.mapViewPosition.setMapPosition(new MapPosition(boundingBox.getCenterPoint(), zoomLevel)); } }); }
MapViewer { public static void main(String[] args) { File mapFile = getMapFile(args); MapView mapView = createMapView(); final BoundingBox boundingBox = addLayers(mapView, mapFile); PreferencesFacade preferencesFacade = new JavaUtilPreferences(Preferences.userNodeForPackage(MapViewer.class)); final Model model = mapView.getModel(); model.init(preferencesFacade); MainFrame mainFrame = new MainFrame(); mainFrame.add(mapView); mainFrame.addWindowListener(new WindowCloseDialog(mainFrame, model, preferencesFacade)); mainFrame.setVisible(true); mainFrame.addWindowListener(new WindowAdapter() { @Override public void windowOpened(WindowEvent e) { byte zoomLevel = LatLongUtils.zoomForBounds(model.mapViewDimension.getDimension(), boundingBox, model.displayModel.getTileSize()); model.mapViewPosition.setMapPosition(new MapPosition(boundingBox.getCenterPoint(), zoomLevel)); } }); } }
MapViewer { public static void main(String[] args) { File mapFile = getMapFile(args); MapView mapView = createMapView(); final BoundingBox boundingBox = addLayers(mapView, mapFile); PreferencesFacade preferencesFacade = new JavaUtilPreferences(Preferences.userNodeForPackage(MapViewer.class)); final Model model = mapView.getModel(); model.init(preferencesFacade); MainFrame mainFrame = new MainFrame(); mainFrame.add(mapView); mainFrame.addWindowListener(new WindowCloseDialog(mainFrame, model, preferencesFacade)); mainFrame.setVisible(true); mainFrame.addWindowListener(new WindowAdapter() { @Override public void windowOpened(WindowEvent e) { byte zoomLevel = LatLongUtils.zoomForBounds(model.mapViewDimension.getDimension(), boundingBox, model.displayModel.getTileSize()); model.mapViewPosition.setMapPosition(new MapPosition(boundingBox.getCenterPoint(), zoomLevel)); } }); } private  MapViewer(); }
MapViewer { public static void main(String[] args) { File mapFile = getMapFile(args); MapView mapView = createMapView(); final BoundingBox boundingBox = addLayers(mapView, mapFile); PreferencesFacade preferencesFacade = new JavaUtilPreferences(Preferences.userNodeForPackage(MapViewer.class)); final Model model = mapView.getModel(); model.init(preferencesFacade); MainFrame mainFrame = new MainFrame(); mainFrame.add(mapView); mainFrame.addWindowListener(new WindowCloseDialog(mainFrame, model, preferencesFacade)); mainFrame.setVisible(true); mainFrame.addWindowListener(new WindowAdapter() { @Override public void windowOpened(WindowEvent e) { byte zoomLevel = LatLongUtils.zoomForBounds(model.mapViewDimension.getDimension(), boundingBox, model.displayModel.getTileSize()); model.mapViewPosition.setMapPosition(new MapPosition(boundingBox.getCenterPoint(), zoomLevel)); } }); } private  MapViewer(); static void main(String[] args); }
MapViewer { public static void main(String[] args) { File mapFile = getMapFile(args); MapView mapView = createMapView(); final BoundingBox boundingBox = addLayers(mapView, mapFile); PreferencesFacade preferencesFacade = new JavaUtilPreferences(Preferences.userNodeForPackage(MapViewer.class)); final Model model = mapView.getModel(); model.init(preferencesFacade); MainFrame mainFrame = new MainFrame(); mainFrame.add(mapView); mainFrame.addWindowListener(new WindowCloseDialog(mainFrame, model, preferencesFacade)); mainFrame.setVisible(true); mainFrame.addWindowListener(new WindowAdapter() { @Override public void windowOpened(WindowEvent e) { byte zoomLevel = LatLongUtils.zoomForBounds(model.mapViewDimension.getDimension(), boundingBox, model.displayModel.getTileSize()); model.mapViewPosition.setMapPosition(new MapPosition(boundingBox.getCenterPoint(), zoomLevel)); } }); } private  MapViewer(); static void main(String[] args);  }