Changeset 14120 in josm for trunk/src/org/openstreetmap/josm/data
- Timestamp:
- 2018-08-11T17:29:48+02:00 (6 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data
- Files:
-
- 2 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/coor/CachedLatLon.java
r12161 r14120 4 4 import java.util.Objects; 5 5 6 import org.openstreetmap.josm.Main;7 6 import org.openstreetmap.josm.data.projection.Projecting; 8 7 import org.openstreetmap.josm.data.projection.Projection; 8 import org.openstreetmap.josm.data.projection.ProjectionRegistry; 9 9 10 10 /** … … 46 46 */ 47 47 public CachedLatLon(EastNorth eastNorth) { 48 this(eastNorth, Main.getProjection());48 this(eastNorth, ProjectionRegistry.getProjection()); 49 49 } 50 50 -
trunk/src/org/openstreetmap/josm/data/coor/LatLon.java
r14091 r14120 17 17 import java.util.Objects; 18 18 19 import org.openstreetmap.josm.Main;20 19 import org.openstreetmap.josm.data.Bounds; 20 import org.openstreetmap.josm.data.projection.ProjectionRegistry; 21 21 import org.openstreetmap.josm.tools.Logging; 22 22 import org.openstreetmap.josm.tools.Utils; … … 195 195 */ 196 196 public boolean isOutSideWorld() { 197 Bounds b = Main.getProjection().getWorldBoundsLatLon();197 Bounds b = ProjectionRegistry.getProjection().getWorldBoundsLatLon(); 198 198 return lat() < b.getMinLat() || lat() > b.getMaxLat() || 199 199 lon() < b.getMinLon() || lon() > b.getMaxLon(); -
trunk/src/org/openstreetmap/josm/data/coor/conversion/ProjectedCoordinateFormat.java
r12741 r14120 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import org.openstreetmap.josm.Main;7 6 import org.openstreetmap.josm.data.coor.ILatLon; 7 import org.openstreetmap.josm.data.projection.ProjectionRegistry; 8 8 9 9 /** … … 25 25 @Override 26 26 public String latToString(ILatLon ll) { 27 return cDdFormatter.format(ll.getEastNorth( Main.getProjection()).north());27 return cDdFormatter.format(ll.getEastNorth(ProjectionRegistry.getProjection()).north()); 28 28 } 29 29 30 30 @Override 31 31 public String lonToString(ILatLon ll) { 32 return cDdFormatter.format(ll.getEastNorth( Main.getProjection()).east());32 return cDdFormatter.format(ll.getEastNorth(ProjectionRegistry.getProjection()).east()); 33 33 } 34 34 } -
trunk/src/org/openstreetmap/josm/data/gpx/GpxData.java
r13257 r14120 20 20 import java.util.stream.Stream; 21 21 22 import org.openstreetmap.josm.Main;23 22 import org.openstreetmap.josm.data.Bounds; 24 23 import org.openstreetmap.josm.data.Data; … … 26 25 import org.openstreetmap.josm.data.coor.EastNorth; 27 26 import org.openstreetmap.josm.data.gpx.GpxTrack.GpxTrackChangeListener; 27 import org.openstreetmap.josm.data.projection.ProjectionRegistry; 28 28 import org.openstreetmap.josm.gui.MainApplication; 29 29 import org.openstreetmap.josm.gui.layer.GpxLayer; … … 539 539 WayPoint r = null; 540 540 for (WayPoint wpSeg : seg.getWayPoints()) { 541 EastNorth en = wpSeg.getEastNorth( Main.getProjection());541 EastNorth en = wpSeg.getEastNorth(ProjectionRegistry.getProjection()); 542 542 if (r == null) { 543 543 r = wpSeg; … … 586 586 } 587 587 if (r != null) { 588 EastNorth c = r.getEastNorth( Main.getProjection());588 EastNorth c = r.getEastNorth(ProjectionRegistry.getProjection()); 589 589 /* if there is only one point in the seg, it will do this twice, but no matter */ 590 590 rx = c.east(); … … 603 603 if (bestEN == null) 604 604 return null; 605 WayPoint best = new WayPoint( Main.getProjection().eastNorth2latlon(bestEN));605 WayPoint best = new WayPoint(ProjectionRegistry.getProjection().eastNorth2latlon(bestEN)); 606 606 best.time = bestTime; 607 607 return best; -
trunk/src/org/openstreetmap/josm/data/imagery/OffsetBookmark.java
r13798 r14120 10 10 import java.util.stream.Collectors; 11 11 12 import org.openstreetmap.josm.Main;13 12 import org.openstreetmap.josm.data.StructUtils; 14 13 import org.openstreetmap.josm.data.StructUtils.StructEntry; … … 18 17 import org.openstreetmap.josm.data.coor.LatLon; 19 18 import org.openstreetmap.josm.data.projection.Projection; 19 import org.openstreetmap.josm.data.projection.ProjectionRegistry; 20 20 import org.openstreetmap.josm.data.projection.Projections; 21 21 import org.openstreetmap.josm.gui.MainApplication; … … 49 49 public boolean isUsable(ImageryLayer layer) { 50 50 if (projection_code == null) return false; 51 if (! Main.getProjection().toCode().equals(projection_code) && !hasCenter()) return false;51 if (!ProjectionRegistry.getProjection().toCode().equals(projection_code) && !hasCenter()) return false; 52 52 ImageryInfo info = layer.getInfo(); 53 53 return imagery_id != null ? Objects.equals(info.getId(), imagery_id) : Objects.equals(info.getName(), imagery_name); … … 363 363 LatLon center; 364 364 if (MainApplication.isDisplayingMapView()) { 365 center = Main.getProjection().eastNorth2latlon(MainApplication.getMap().mapView.getCenter());365 center = ProjectionRegistry.getProjection().eastNorth2latlon(MainApplication.getMap().mapView.getCenter()); 366 366 } else { 367 367 center = LatLon.ZERO; 368 368 } 369 369 OffsetBookmark nb = new OffsetBookmark( 370 Main.getProjection().toCode(), layer.getInfo().getId(), layer.getInfo().getName(),370 ProjectionRegistry.getProjection().toCode(), layer.getInfo().getId(), layer.getInfo().getName(), 371 371 name, layer.getDisplaySettings().getDisplacement(), center); 372 372 for (ListIterator<OffsetBookmark> it = allBookmarks.listIterator(); it.hasNext();) { -
trunk/src/org/openstreetmap/josm/data/imagery/TemplatedWMSTileSource.java
r13733 r14120 16 16 17 17 import org.openstreetmap.gui.jmapviewer.interfaces.TemplatedTileSource; 18 import org.openstreetmap.josm.Main;19 18 import org.openstreetmap.josm.data.coor.EastNorth; 20 19 import org.openstreetmap.josm.data.projection.Projection; 20 import org.openstreetmap.josm.data.projection.ProjectionRegistry; 21 21 import org.openstreetmap.josm.gui.layer.WMSLayer; 22 22 import org.openstreetmap.josm.tools.CheckParameterUtil; … … 108 108 } else if (baseUrl.toLowerCase(Locale.US).contains("crs=")) { 109 109 // assume WMS 1.3.0 110 switchLatLon = Main.getProjection().switchXY();110 switchLatLon = ProjectionRegistry.getProjection().switchXY(); 111 111 } 112 112 String bbox = getBbox(zoom, tilex, tiley, switchLatLon); -
trunk/src/org/openstreetmap/josm/data/imagery/WMTSTileSource.java
r13879 r14120 50 50 import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType; 51 51 import org.openstreetmap.josm.data.projection.Projection; 52 import org.openstreetmap.josm.data.projection.ProjectionRegistry; 52 53 import org.openstreetmap.josm.data.projection.Projections; 53 54 import org.openstreetmap.josm.gui.ExtendedDialog; … … 346 347 List<Layer> ls = layerById.entrySet().iterator().next().getValue() 347 348 .stream().filter( 348 u -> u.tileMatrixSet.crs.equals( Main.getProjection().toCode()))349 u -> u.tileMatrixSet.crs.equals(ProjectionRegistry.getProjection().toCode())) 349 350 .collect(Collectors.toList()); 350 351 if (ls.size() == 1) { … … 631 632 private static TileMatrix parseTileMatrix(XMLStreamReader reader, String matrixCrs) throws XMLStreamException { 632 633 Projection matrixProj = Optional.ofNullable(Projections.getProjectionByCode(matrixCrs)) 633 .orElseGet( Main::getProjection); // use current projection if none found. Maybe user is using custom string634 .orElseGet(ProjectionRegistry::getProjection); // use current projection if none found. Maybe user is using custom string 634 635 TileMatrix ret = new TileMatrix(); 635 636 for (int event = reader.getEventType(); -
trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
r14119 r14120 25 25 import java.util.stream.Stream; 26 26 27 import org.openstreetmap.josm.Main;28 27 import org.openstreetmap.josm.data.APIDataSet.APIOperation; 29 28 import org.openstreetmap.josm.data.Bounds; … … 54 53 import org.openstreetmap.josm.data.projection.Projection; 55 54 import org.openstreetmap.josm.data.projection.ProjectionChangeListener; 55 import org.openstreetmap.josm.data.projection.ProjectionRegistry; 56 56 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 57 57 import org.openstreetmap.josm.spi.preferences.Config; … … 175 175 // Transparently register as projection change listener. No need to explicitly remove 176 176 // the listener, projection change listeners are managed as WeakReferences. 177 Main.addProjectionChangeListener(this);177 ProjectionRegistry.addProjectionChangeListener(this); 178 178 addSelectionListener((DataSelectionListener) e -> fireSelectionChange(e.getSelection())); 179 179 } … … 1045 1045 */ 1046 1046 public void invalidateEastNorthCache() { 1047 if ( Main.getProjection() == null)1047 if (ProjectionRegistry.getProjection() == null) 1048 1048 return; // sanity check 1049 1049 beginUpdate(); -
trunk/src/org/openstreetmap/josm/data/osm/INode.java
r13669 r14120 6 6 import org.openstreetmap.josm.data.coor.ILatLon; 7 7 import org.openstreetmap.josm.data.coor.LatLon; 8 import org.openstreetmap.josm.data.projection.ProjectionRegistry; 8 9 9 10 /** … … 34 35 */ 35 36 default EastNorth getEastNorth() { 36 return getEastNorth( Main.getProjection());37 return getEastNorth(ProjectionRegistry.getProjection()); 37 38 } 38 39 -
trunk/src/org/openstreetmap/josm/data/osm/Node.java
r13669 r14120 10 10 import java.util.function.Predicate; 11 11 12 import org.openstreetmap.josm.Main;13 12 import org.openstreetmap.josm.data.coor.EastNorth; 14 13 import org.openstreetmap.josm.data.coor.LatLon; … … 16 15 import org.openstreetmap.josm.data.osm.visitor.PrimitiveVisitor; 17 16 import org.openstreetmap.josm.data.projection.Projecting; 17 import org.openstreetmap.josm.data.projection.ProjectionRegistry; 18 18 import org.openstreetmap.josm.tools.CheckParameterUtil; 19 19 import org.openstreetmap.josm.tools.Utils; … … 114 114 invalidateEastNorthCache(); 115 115 } else if (eastNorth != null) { 116 LatLon ll = Main.getProjection().eastNorth2latlon(eastNorth);116 LatLon ll = ProjectionRegistry.getProjection().eastNorth2latlon(eastNorth); 117 117 this.lat = ll.lat(); 118 118 this.lon = ll.lon(); 119 119 this.east = eastNorth.east(); 120 120 this.north = eastNorth.north(); 121 this.eastNorthCacheKey = Main.getProjection().getCacheKey();121 this.eastNorthCacheKey = ProjectionRegistry.getProjection().getCacheKey(); 122 122 } else { 123 123 this.lat = Double.NaN; -
trunk/src/org/openstreetmap/josm/data/osm/NodeData.java
r13764 r14120 2 2 package org.openstreetmap.josm.data.osm; 3 3 4 import org.openstreetmap.josm.Main;5 4 import org.openstreetmap.josm.data.coor.EastNorth; 6 5 import org.openstreetmap.josm.data.coor.LatLon; 7 6 import org.openstreetmap.josm.data.osm.visitor.PrimitiveVisitor; 7 import org.openstreetmap.josm.data.projection.ProjectionRegistry; 8 8 9 9 /** … … 77 77 @Override 78 78 public void setEastNorth(EastNorth eastNorth) { 79 setCoor( Main.getProjection().eastNorth2latlon(eastNorth));79 setCoor(ProjectionRegistry.getProjection().eastNorth2latlon(eastNorth)); 80 80 } 81 81 -
trunk/src/org/openstreetmap/josm/data/osm/search/SearchCompiler.java
r14098 r14120 23 23 import java.util.stream.Collectors; 24 24 25 import org.openstreetmap.josm.Main;26 25 import org.openstreetmap.josm.data.Bounds; 27 26 import org.openstreetmap.josm.data.coor.LatLon; … … 36 35 import org.openstreetmap.josm.data.osm.search.PushbackTokenizer.Range; 37 36 import org.openstreetmap.josm.data.osm.search.PushbackTokenizer.Token; 37 import org.openstreetmap.josm.data.projection.ProjectionRegistry; 38 38 import org.openstreetmap.josm.gui.mappaint.Environment; 39 39 import org.openstreetmap.josm.gui.mappaint.mapcss.Selector; … … 1895 1895 protected Collection<Bounds> getBounds(OsmPrimitive primitive) { 1896 1896 final Collection<Bounds> bounds = super.getBounds(primitive); 1897 return bounds == null || bounds.isEmpty() ? Collections.singleton(Main.getProjection().getWorldBoundsLatLon()) : bounds; 1897 return bounds == null || bounds.isEmpty() ? 1898 Collections.singleton(ProjectionRegistry.getProjection().getWorldBoundsLatLon()) : bounds; 1898 1899 } 1899 1900 -
trunk/src/org/openstreetmap/josm/data/osm/visitor/BoundingXYVisitor.java
r13906 r14120 4 4 import java.util.Collection; 5 5 6 import org.openstreetmap.josm.Main;7 6 import org.openstreetmap.josm.data.Bounds; 8 7 import org.openstreetmap.josm.data.ProjectionBounds; … … 19 18 import org.openstreetmap.josm.data.osm.Relation; 20 19 import org.openstreetmap.josm.data.osm.Way; 20 import org.openstreetmap.josm.data.projection.ProjectionRegistry; 21 21 import org.openstreetmap.josm.gui.MainApplication; 22 22 import org.openstreetmap.josm.gui.MapFrame; … … 76 76 public void visit(Bounds b) { 77 77 if (b != null) { 78 Main.getProjection().visitOutline(b, this::visit);78 ProjectionRegistry.getProjection().visitOutline(b, this::visit); 79 79 } 80 80 } … … 98 98 public void visit(ILatLon latlon) { 99 99 if (latlon != null) { 100 visit(latlon.getEastNorth( Main.getProjection()));100 visit(latlon.getEastNorth(ProjectionRegistry.getProjection())); 101 101 } 102 102 } … … 159 159 if (bounds == null) 160 160 return; 161 LatLon minLatlon = Main.getProjection().eastNorth2latlon(bounds.getMin());162 LatLon maxLatlon = Main.getProjection().eastNorth2latlon(bounds.getMax());161 LatLon minLatlon = ProjectionRegistry.getProjection().eastNorth2latlon(bounds.getMin()); 162 LatLon maxLatlon = ProjectionRegistry.getProjection().eastNorth2latlon(bounds.getMax()); 163 163 bounds = new ProjectionBounds(new LatLon( 164 164 Math.max(-90, minLatlon.lat() - enlargeDegree), 165 Math.max(-180, minLatlon.lon() - enlargeDegree)).getEastNorth( Main.getProjection()),165 Math.max(-180, minLatlon.lon() - enlargeDegree)).getEastNorth(ProjectionRegistry.getProjection()), 166 166 new LatLon( 167 167 Math.min(90, maxLatlon.lat() + enlargeDegree), 168 Math.min(180, maxLatlon.lon() + enlargeDegree)).getEastNorth( Main.getProjection()));168 Math.min(180, maxLatlon.lon() + enlargeDegree)).getEastNorth(ProjectionRegistry.getProjection())); 169 169 } 170 170 -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/relations/MultipolygonCache.java
r14000 r14120 9 9 import java.util.concurrent.ConcurrentHashMap; 10 10 11 import org.openstreetmap.josm.Main;12 11 import org.openstreetmap.josm.data.osm.DataSelectionListener; 13 12 import org.openstreetmap.josm.data.osm.DataSet; … … 29 28 import org.openstreetmap.josm.data.projection.Projection; 30 29 import org.openstreetmap.josm.data.projection.ProjectionChangeListener; 30 import org.openstreetmap.josm.data.projection.ProjectionRegistry; 31 31 import org.openstreetmap.josm.gui.MainApplication; 32 32 import org.openstreetmap.josm.gui.layer.LayerManager.LayerAddEvent; … … 49 49 50 50 private MultipolygonCache() { 51 Main.addProjectionChangeListener(this);51 ProjectionRegistry.addProjectionChangeListener(this); 52 52 SelectionEventManager.getInstance().addSelectionListener(this); 53 53 MainApplication.getLayerManager().addLayerChangeListener(this); -
trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java
r13672 r14120 31 31 import org.openstreetmap.josm.Main; 32 32 import org.openstreetmap.josm.data.preferences.sources.ValidatorPrefHelper; 33 import org.openstreetmap.josm.data.projection.ProjectionRegistry; 33 34 import org.openstreetmap.josm.data.validation.tests.Addresses; 34 35 import org.openstreetmap.josm.data.validation.tests.ApiCapabilitiesTest; … … 352 353 */ 353 354 public static void initializeGridDetail() { 354 String code = Main.getProjection().toCode();355 String code = ProjectionRegistry.getProjection().toCode(); 355 356 if (Arrays.asList(ProjectionPreference.wgs84.allCodes()).contains(code)) { 356 357 OsmValidator.griddetail = 10_000;
Note:
See TracChangeset
for help on using the changeset viewer.