Changeset 16290 in osm for applications
- Timestamp:
- 2009-07-03T12:34:14+02:00 (16 years ago)
- Location:
- applications/editors/josm/plugins
- Files:
-
- 44 edited
-
Create_grid_of_ways/build.xml (modified) (1 diff)
-
Create_grid_of_ways/src/CreateGridOfWaysPlugin/CreateGridOfWaysAction.java (modified) (2 diffs)
-
agpifoj/build.xml (modified) (1 diff)
-
agpifoj/src/org/openstreetmap/josm/plugins/agpifoj/AgpifojDialog.java (modified) (2 diffs)
-
agpifoj/src/org/openstreetmap/josm/plugins/agpifoj/CorrelateGpxWithImages.java (modified) (1 diff)
-
czechaddress/build.xml (modified) (1 diff)
-
czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/MapUtils.java (modified) (2 diffs)
-
czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/AddressElement.java (modified) (1 diff)
-
czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/LocationSelector.java (modified) (9 diffs)
-
czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/proposal/ExtractAddressIntoNodeProposal.java (modified) (3 diffs)
-
editgpx/build.xml (modified) (1 diff)
-
editgpx/src/org/openstreetmap/josm/plugins/editgpx/EditGpxLayer.java (modified) (3 diffs)
-
editgpx/src/org/openstreetmap/josm/plugins/editgpx/EditGpxMode.java (modified) (1 diff)
-
livegps/build.xml (modified) (1 diff)
-
livegps/src/livegps/LiveGpsLayer.java (modified) (1 diff)
-
openstreetbugs/build.xml (modified) (1 diff)
-
openstreetbugs/src/org/openstreetmap/josm/plugins/osb/api/DownloadAction.java (modified) (2 diffs)
-
openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/OsbDialog.java (modified) (3 diffs)
-
piclayer/build.xml (modified) (1 diff)
-
piclayer/src/org/openstreetmap/josm/plugins/piclayer/PicLayerAbstract.java (modified) (4 diffs)
-
remotecontrol/build.xml (modified) (1 diff)
-
remotecontrol/src/org/openstreetmap/josm/plugins/remotecontrol/RequestProcessor.java (modified) (2 diffs)
-
routing/build.xml (modified) (1 diff)
-
routing/src/com/innovant/josm/jrt/core/RoutingGraph.java (modified) (1 diff)
-
routing/src/com/innovant/josm/jrt/osm/OsmEdge.java (modified) (2 diffs)
-
routing/src/com/innovant/josm/plugin/routing/RoutingLayer.java (modified) (4 diffs)
-
routing/src/com/innovant/josm/plugin/routing/actions/MoveRouteNodeAction.java (modified) (1 diff)
-
routing/src/com/innovant/josm/plugin/routing/actions/RemoveRouteNodeAction.java (modified) (1 diff)
-
routing/src/com/innovant/josm/plugin/routing/gui/RoutingDialog.java (modified) (2 diffs)
-
surveyor/build.xml (modified) (1 diff)
-
surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorShowAction.java (modified) (2 diffs)
-
utilsplugin/build.xml (modified) (1 diff)
-
utilsplugin/src/UtilsPlugin/JumpToAction.java (modified) (2 diffs)
-
validator/build.xml (modified) (1 diff)
-
validator/src/org/openstreetmap/josm/plugins/validator/ValidatorDialog.java (modified) (1 diff)
-
waydownloader/build.xml (modified) (1 diff)
-
waydownloader/src/WayDownloaderPlugin.java (modified) (1 diff)
-
wmsplugin/build.xml (modified) (1 diff)
-
wmsplugin/src/wmsplugin/Grabber.java (modified) (4 diffs)
-
wmsplugin/src/wmsplugin/WMSGrabber.java (modified) (6 diffs)
-
wmsplugin/src/wmsplugin/WMSLayer.java (modified) (7 diffs)
-
wmsplugin/src/wmsplugin/WMSPlugin.java (modified) (4 diffs)
-
wmsplugin/src/wmsplugin/WMSPreferenceEditor.java (modified) (3 diffs)
-
wmsplugin/src/wmsplugin/YAHOOGrabber.java (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/Create_grid_of_ways/build.xml
r14370 r16290 26 26 <attribute name="Plugin-Description" value="Create a grid of ways."/> 27 27 <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/wiki/Create_grid_of_ways"/> 28 <attribute name="Plugin-Mainversion" value="1 208"/>28 <attribute name="Plugin-Mainversion" value="1722"/> 29 29 <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/> 30 30 </manifest> -
applications/editors/josm/plugins/Create_grid_of_ways/src/CreateGridOfWaysPlugin/CreateGridOfWaysAction.java
r14370 r16290 75 75 double latDif,lonDif; 76 76 for (Node n1 : nodesWay1) { 77 latDif = n1. coor.lat()-nodeCommon.coor.lat();78 lonDif = n1. coor.lon()-nodeCommon.coor.lon();77 latDif = n1.getCoor().lat()-nodeCommon.getCoor().lat(); 78 lonDif = n1.getCoor().lon()-nodeCommon.getCoor().lon(); 79 79 c2=0; 80 80 for (Node n2 : nodesWay2) { … … 89 89 continue; 90 90 } 91 Node nodeOfGrid = new Node(new LatLon(n2. coor.lat()+latDif,n2.coor.lon()+lonDif));91 Node nodeOfGrid = new Node(new LatLon(n2.getCoor().lat()+latDif,n2.getCoor().lon()+lonDif)); 92 92 cmds.add(new AddCommand(nodeOfGrid)); 93 93 w1[c1].nodes.add(nodeOfGrid); -
applications/editors/josm/plugins/agpifoj/build.xml
r14018 r16290 34 34 <attribute name="Plugin-Early" value="false"/> 35 35 <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/index.php/JOSM/Plugins/AgPifoJ"/> 36 <attribute name="Plugin-Mainversion" value="1 465"/>36 <attribute name="Plugin-Mainversion" value="1722"/> 37 37 <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/> 38 38 </manifest> -
applications/editors/josm/plugins/agpifoj/src/org/openstreetmap/josm/plugins/agpifoj/AgpifojDialog.java
r14916 r16290 124 124 centerView = ((JToggleButton) e.getSource()).isSelected(); 125 125 if (centerView && currentEntry != null && currentEntry.pos != null) { 126 Main.map.mapView.zoomTo(currentEntry.pos , Main.map.mapView.getScale());126 Main.map.mapView.zoomTo(currentEntry.pos); 127 127 } 128 128 … … 153 153 154 154 if (centerView && Main.map != null && entry != null && entry.pos != null) { 155 Main.map.mapView.zoomTo(entry.pos , Main.map.mapView.getScale());155 Main.map.mapView.zoomTo(entry.pos); 156 156 } 157 157 -
applications/editors/josm/plugins/agpifoj/src/org/openstreetmap/josm/plugins/agpifoj/CorrelateGpxWithImages.java
r15960 r16290 623 623 BoundingXYVisitor bbox = new BoundingXYVisitor(); 624 624 l.visitBoundingBox(bbox); 625 if (bbox. min != null && bbox.max!= null) {625 if (bbox.getBounds() != null) { 626 626 boundingBoxedLayerFound = true; 627 627 break; -
applications/editors/josm/plugins/czechaddress/build.xml
r15829 r16290 51 51 <attribute name="Plugin-Description" value="Creating and handling address nodes and buildings within Czech Republic."/> 52 52 <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/index.php/Cz:JOSM/Plugins/CzechAddress"/> 53 <attribute name="Plugin-Mainversion" value="1 607"/>53 <attribute name="Plugin-Mainversion" value="1722"/> 54 54 <!--<attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>--> 55 55 <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/> -
applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/MapUtils.java
r15585 r16290 3 3 import java.util.Collection; 4 4 import org.openstreetmap.josm.Main; 5 import org.openstreetmap.josm. data.osm.Node;5 import org.openstreetmap.josm.actions.AutoScaleAction; 6 6 import org.openstreetmap.josm.data.osm.OsmPrimitive; 7 import org.openstreetmap.josm.data.osm.Way;8 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;9 import org.openstreetmap.josm.gui.MapView;10 7 11 8 /** … … 21 18 22 19 /** 23 * Zoom level used for zooming to a single node.24 */25 public static final double NODE_ZOOM_LEVEL = 0.00000007;26 27 28 /**29 20 * Selects and zooms the JOSM viewport to given primitives. 30 *31 * <p>It does so by calculating the center of given primitives and32 * then it zooms to it.</p>33 *34 * <p><b>WARNING and TODO:</b> The method {@code zoomTo()} currently35 * checks for damaged {@link Node}s, whose {@code eastNorth} is set to36 * null. This property is not accessed in this method and therefore37 * no checking is done. However the "mad GUI" problem may still arise.38 * Therefore please be careful.</p>39 *40 * @see BoundingXYVisitor41 * @see MapView42 21 */ 43 22 public static void zoomToMany(Collection<OsmPrimitive> primitives) { 44 BoundingXYVisitor visitor = new BoundingXYVisitor();45 for (OsmPrimitive op : primitives) {46 if (op instanceof Node)47 ((Node) op).visit(visitor);48 49 else if (op instanceof Way)50 ((Way) op).visit(visitor);51 }52 Main.map.mapView.zoomTo(53 visitor.min.interpolate(visitor.max, 0.5),54 NODE_ZOOM_LEVEL);55 23 Main.ds.setSelected(primitives); 24 (new AutoScaleAction("selection")).actionPerformed(null); 56 25 } 57 26 58 27 /** 59 28 * Selects and zooms the JOSM viewport to given primitive. 60 *61 * <p><b>TODO:</b> There is an error in JOSM, which makes the whole62 * GUI totally mad if we zoom to a {@link Node}, whose {@code eastNorth}63 * is set null. Currently zooming to such a node is ignored, but the64 * question is where so such damaged nodes come from?</p>65 *66 * @see BoundingXYVisitor67 * @see MapView68 29 */ 69 30 public static void zoomTo(OsmPrimitive primitive) { 70 BoundingXYVisitor visitor = new BoundingXYVisitor();71 72 if (primitive instanceof Node && ((Node) primitive).eastNorth != null)73 Main.map.mapView.zoomTo(((Node) primitive).eastNorth, NODE_ZOOM_LEVEL);74 75 else if (primitive instanceof Way) {76 ((Way) primitive).visit(visitor);77 Main.map.mapView.zoomTo(78 visitor.min.interpolate(visitor.max, 0.5),79 NODE_ZOOM_LEVEL);80 }81 82 31 Main.ds.setSelected(primitive); 32 (new AutoScaleAction("selection")).actionPerformed(null); 83 33 } 84 34 } -
applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/AddressElement.java
r15585 r16290 97 97 98 98 if (prim instanceof Node) 99 result += " " + StringUtils.latLonToString(((Node) prim). coor);99 result += " " + StringUtils.latLonToString(((Node) prim).getCoor()); 100 100 else if (prim instanceof Way) 101 result += " " + StringUtils.latLonToString(((Way) prim).firstNode(). coor);101 result += " " + StringUtils.latLonToString(((Way) prim).firstNode().getCoor()); 102 102 103 103 return result; -
applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/LocationSelector.java
r15649 r16290 40 40 LocationSelector ls = new LocationSelector(); 41 41 ls.setVisible(true); 42 42 43 43 if (ls.getValue() == 1) 44 44 return ls.selectedElement; … … 50 50 super(Main.parent, "Výběr umístění", 51 51 new String[] { "OK", "Zrušit"}, true); 52 52 53 53 initComponents(); 54 54 setupDialog(mainPanel, new String[] { "ok.png", "cancel.png"}); … … 68 68 * Hardly ever working method for autodetecting the current location. 69 69 * 70 * @deprecated 70 * @deprecated 71 71 */ 72 72 private void autodetectLocation() { … … 93 93 94 94 try { 95 Bounds bounds = visitor.getBounds(); 96 LatLon max = bounds.max; 97 LatLon min = bounds.min; 98 center = new LatLon( 99 (max.getX() + min.getX()) / 2, 100 (max.getY() + min.getY()) / 2); 101 95 center = Main.proj.eastNorth2latlon(visitor.getBounds().getCenter()); 102 96 } catch (Exception e) { 103 97 System.err.println("AUTO: No bounds to determine autolocation."); … … 128 122 } 129 123 130 double currLen = multiplicator * (node. coor.distance(center));124 double currLen = multiplicator * (node.getCoor().distance(center)); 131 125 132 126 … … 138 132 139 133 if (bestFit != null) { 140 134 141 135 if (assertions) 142 136 System.out.println("AUTO: Best fit " + bestFit.getName() 143 137 + "\t " + bestFit.get("name")); 144 138 145 139 for (Region oblast : Database.getInstance().regions) { 146 140 for (ViToCi obec : oblast.getViToCis()) { … … 263 257 ItemEvent event = new ItemEvent(this, 264 258 ItemEvent.DESELECTED, selectedElement, ItemEvent.DESELECTED); 265 259 266 260 for (ItemListener i : listeners) 267 261 i.itemStateChanged(event); … … 271 265 event = new ItemEvent(this, 272 266 ItemEvent.SELECTED, selectedElement, ItemEvent.SELECTED); 273 267 274 268 for (ItemListener i : listeners) 275 269 i.itemStateChanged(event); … … 323 317 else if (oblastComboBox.getSelectedItem() != null) 324 318 selectedElement = ((ElementWithStreets) oblastComboBox.getSelectedItem()); 325 319 326 320 }//GEN-LAST:event_suburbComboBoxItemStateChanged 327 321 -
applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/proposal/ExtractAddressIntoNodeProposal.java
r15166 r16290 51 51 if (!isApplicable(primitive)) 52 52 return; 53 53 54 54 Way way = (Way) primitive; 55 55 56 56 BoundingXYVisitor visitor = new BoundingXYVisitor(); 57 57 way.visit(visitor); 58 LatLon center = new LatLon( 59 (visitor.getBounds().max.lat() + visitor.getBounds().min.lat())/2, 60 (visitor.getBounds().max.lon() + visitor.getBounds().min.lon())/2 61 ); 62 63 Node addrNode = new Node(center); 58 59 Node addrNode = new Node(visitor.getBounds().getCenter()); 64 60 65 61 for (String key : way.keySet()) … … 75 71 /** 76 72 * Returns textual representation of this proposal. 77 * 73 * 78 74 * Currently the string is in Czech language (see {@link CzechAddressPlugin}). 79 75 */ … … 83 79 } 84 80 85 81 86 82 87 83 } -
applications/editors/josm/plugins/editgpx/build.xml
r15678 r16290 26 26 <attribute name="Plugin-Description" value="Allows the user to anonymize timestamps and delete parts of huge GPX tracks very fast." /> 27 27 <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/EditGpx" /> 28 <attribute name="Plugin-Mainversion" value="1 500" />28 <attribute name="Plugin-Mainversion" value="1722" /> 29 29 <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/> 30 30 </manifest> -
applications/editors/josm/plugins/editgpx/src/org/openstreetmap/josm/plugins/editgpx/EditGpxLayer.java
r15186 r16290 113 113 for(Node n: dataSet.nodes) { 114 114 if (!n.deleted) { 115 LatLon c = n.coor; 116 Point pnt = Main.map.mapView.getPoint(Main.proj.latlon2eastNorth(c)); 115 Point pnt = Main.map.mapView.getPoint(n.getEastNorth()); 117 116 g.drawOval(pnt.x - 2, pnt.y - 2, 4, 4); 118 117 } … … 166 165 doneNodes.add(n); 167 166 168 WayPoint wpt = new WayPoint(n. coor);167 WayPoint wpt = new WayPoint(n.getCoor()); 169 168 if (anonTime) { 170 169 wpt.attr.put("time", "1970-01-01T00:00:00"); … … 184 183 Date tstamp = n.getTimestamp(); 185 184 186 WayPoint wpt = new WayPoint(n. coor);185 WayPoint wpt = new WayPoint(n.getCoor()); 187 186 if (anonTime) { 188 187 wpt.attr.put("time", "1970-01-01T00:00:00"); -
applications/editors/josm/plugins/editgpx/src/org/openstreetmap/josm/plugins/editgpx/EditGpxMode.java
r14245 r16290 64 64 Point pointReleased = e.getPoint(); 65 65 66 //prepare vars67 EastNorth en;68 double scale = Main.map.mapView.getScale();69 EastNorth center = Main.map.mapView.getCenter(); //Center n/e coordinate of the desired screen center.70 int width = Main.map.mapView.getWidth();71 int height = Main.map.mapView.getHeight();72 66 Rectangle r = createRect(pointReleased, pointPressed); 73 67 74 68 //go through nodes and mark the ones in the selection rect as deleted 75 69 for (Node n: dataSet.nodes) { 76 en = n.eastNorth; 77 //calculate point on screen from node n 78 double x = (en.east()-center.east())/scale + width/2; 79 double y = (center.north()-en.north())/scale + height/2; 80 Point p = new Point((int)x,(int)y); 70 Point p = Main.map.mapView.getPoint(n.getEastNorth()); 81 71 if (r.contains(p)) { 82 72 n.deleted = true; //only set as deleted. this makes reset to beginning possible -
applications/editors/josm/plugins/livegps/build.xml
r14120 r16290 26 26 <attribute name="Plugin-Description" value="Support live GPS input (moving dot) through a connection to gpsd server."/> 27 27 <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/index.php/JOSM/Plugins/LiveGPS"/> 28 <attribute name="Plugin-Mainversion" value="1 498"/>28 <attribute name="Plugin-Mainversion" value="1722"/> 29 29 <attribute name="Plugin-Stage" value="50"/> 30 30 <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/> -
applications/editors/josm/plugins/livegps/src/livegps/LiveGpsLayer.java
r14057 r16290 74 74 { 75 75 if (lastPoint != null) 76 Main.map.mapView.zoomTo(lastPoint.eastNorth , Main.map.mapView.getScale());76 Main.map.mapView.zoomTo(lastPoint.eastNorth); 77 77 } 78 78 -
applications/editors/josm/plugins/openstreetbugs/build.xml
r16163 r16290 26 26 <attribute name="Plugin-Description" value="Imports issues from OpenStreetBugs"/> 27 27 <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/index.php/JOSM/Plugins/OpenStreetBugs"/> 28 <attribute name="Plugin-Mainversion" value="1 638"/>28 <attribute name="Plugin-Mainversion" value="1722"/> 29 29 <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/> 30 30 </manifest> -
applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/api/DownloadAction.java
r16134 r16290 37 37 import org.openstreetmap.josm.data.osm.DataSet; 38 38 import org.openstreetmap.josm.data.osm.Node; 39 import org.openstreetmap.josm.tools.OsmUrlToBounds; 39 40 import org.openstreetmap.josm.plugins.osb.ConfigKeys; 40 41 import org.openstreetmap.josm.plugins.osb.api.util.HttpUtils; … … 48 49 String uri = Main.pref.get(ConfigKeys.OSB_API_URI_DOWNLOAD); 49 50 51 int zoom = OsmUrlToBounds.getZoom(Main.map.mapView.getRealBounds()); 50 52 // check zoom level 51 if( Main.map.mapView.zoom()> 15 ||Main.map.mapView.zoom()< 9) {53 if(zoom > 15 || zoom < 9) { 52 54 return; 53 55 } -
applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/OsbDialog.java
r16163 r16290 75 75 import org.openstreetmap.josm.plugins.osb.gui.action.OsbActionObserver; 76 76 import org.openstreetmap.josm.plugins.osb.gui.action.PopupFactory; 77 import org.openstreetmap.josm.tools.OsmUrlToBounds; 77 78 import org.openstreetmap.josm.tools.Shortcut; 78 79 … … 118 119 119 120 public void actionPerformed(ActionEvent e) { 121 int zoom = OsmUrlToBounds.getZoom(Main.map.mapView.getRealBounds()); 120 122 // check zoom level 121 if ( Main.map.mapView.zoom()> 15 ||Main.map.mapView.zoom()< 9) {123 if (zoom > 15 || zoom < 9) { 122 124 JOptionPane.showMessageDialog(Main.parent, 123 125 tr("The visible area is either too small or too big to download data from OpenStreetBugs"), … … 257 259 258 260 public void zoomToNode(Node node) { 259 double scale = Main.map.mapView.getScale(); 260 Main.map.mapView.zoomTo(node.getEastNorth(), scale); 261 Main.map.mapView.zoomTo(node.getEastNorth()); 261 262 } 262 263 -
applications/editors/josm/plugins/piclayer/build.xml
r16177 r16290 81 81 <attribute name="Plugin-Date" value="${version.entry.commit.date}"/> 82 82 <attribute name="Plugin-Description" value="This plugin allows to display any picture as a background in the editor and align it with the map."/> 83 <attribute name="Plugin-Mainversion" value="1 529"/>83 <attribute name="Plugin-Mainversion" value="1722"/> 84 84 <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/> 85 85 </manifest> -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/PicLayerAbstract.java
r14779 r16290 47 47 * anything...) 48 48 */ 49 public abstract class PicLayerAbstract extends Layer 49 public abstract class PicLayerAbstract extends Layer 50 50 { 51 // Counter - just for naming of layers52 private static int m_counter = 0;53 // This is the main image to be displayed54 private BufferedImage m_image = null;55 // Initial position of the image in the real world56 private EastNorth m_initial_position;57 // Position of the image in the real world58 private EastNorth m_position;59 // Angle of rotation of the image60 private double m_angle = 0.0;61 // Scale of the image62 private double m_scale = 1.0;63 // The scale that was set on the map during image creation64 private double m_initial_scale = 0;65 // Popup menu items66 private Component m_popupmenu[] = null;67 // Layer icon51 // Counter - just for naming of layers 52 private static int m_counter = 0; 53 // This is the main image to be displayed 54 private BufferedImage m_image = null; 55 // Initial position of the image in the real world 56 private EastNorth m_initial_position; 57 // Position of the image in the real world 58 private EastNorth m_position; 59 // Angle of rotation of the image 60 private double m_angle = 0.0; 61 // Scale of the image 62 private double m_scale = 1.0; 63 // The scale that was set on the map during image creation 64 private double m_initial_scale = 0; 65 // Popup menu items 66 private Component m_popupmenu[] = null; 67 // Layer icon 68 68 private Icon m_layericon = null; 69 70 /**71 * Constructor72 */69 70 /** 71 * Constructor 72 */ 73 73 public PicLayerAbstract() { 74 74 super("PicLayer #" + m_counter); … … 76 76 //Increase number 77 77 m_counter++; 78 78 79 79 // Create popup menu 80 80 // Reset submenu … … 87 87 // Main menu 88 88 m_popupmenu = new Component[]{ 89 reset_submenu,90 new JSeparator(),91 new JMenuItem( new HelpAction() )89 reset_submenu, 90 new JSeparator(), 91 new JMenuItem( new HelpAction() ) 92 92 }; 93 93 94 94 // Load layer icon 95 95 m_layericon = new ImageIcon(Toolkit.getDefaultToolkit().createImage(PicLayerAbstract.class.getResource("/images/layericon.png"))); 96 } 97 96 } 97 98 98 /** 99 99 * Initializes the image. Gets the image from a subclass and stores some … … 101 101 */ 102 102 public void Initialize() throws IOException { 103 104 // Create image105 Image image = createImage();106 if ( image == null ) {107 throw new IOException( "Image not created properly.");108 }109 // Convert to Buffered Image - not sure if this is the right way...110 m_image = new BufferedImage( image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_ARGB );111 Graphics g = m_image.getGraphics();112 g.drawImage( image, 0, 0, null );113 114 // If the map does not exist - we're screwed. We should not get into this situation in the first place!115 if ( Main.map != null && Main.map.mapView != null ) {116 // Geographical position of the image117 m_initial_position = m_position = Main.map.mapView.getCenter();118 // Initial scale at which the image was loaded119 m_initial_scale = Main.map.mapView.getScale();120 } else {121 throw new IOException( "Could not find the map object." );122 }123 } 124 103 104 // Create image 105 Image image = createImage(); 106 if ( image == null ) { 107 throw new IOException( "Image not created properly."); 108 } 109 // Convert to Buffered Image - not sure if this is the right way... 110 m_image = new BufferedImage( image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_ARGB ); 111 Graphics g = m_image.getGraphics(); 112 g.drawImage( image, 0, 0, null ); 113 114 // If the map does not exist - we're screwed. We should not get into this situation in the first place! 115 if ( Main.map != null && Main.map.mapView != null ) { 116 // Geographical position of the image 117 m_initial_position = m_position = Main.map.mapView.getCenter(); 118 // Initial scale at which the image was loaded 119 m_initial_scale = Main.map.mapView.getMapScale(); 120 } else { 121 throw new IOException( "Could not find the map object." ); 122 } 123 } 124 125 125 /** 126 126 * To be overridden by subclasses. Provides an image from an external sources. 127 127 * Throws exception if something does not work. 128 * 128 * 129 129 * TODO: Replace the IOException by our own exception. 130 130 */ 131 131 protected abstract Image createImage() throws IOException; 132 132 133 133 /** 134 134 * To be overridden by subclasses. Returns the user readable name of the layer. 135 135 */ 136 136 protected abstract String getPicLayerName(); 137 138 @Override139 public Icon getIcon() {140 return m_layericon;141 }142 143 @Override144 public Object getInfoComponent() {145 // TODO Auto-generated method stub146 return null;147 }148 149 @Override150 public Component[] getMenuEntries() {151 return m_popupmenu;152 }153 154 @Override155 public String getToolTipText() {156 return getPicLayerName();157 }158 159 @Override160 public boolean isMergable(Layer arg0) {161 // TODO Auto-generated method stub162 return false;163 }164 165 @Override166 public void mergeFrom(Layer arg0) {167 // TODO Auto-generated method stub168 169 }170 171 @Override172 public void paint(Graphics arg0, MapView arg1) {173 174 if ( m_image != null && arg0 instanceof Graphics2D) {175 176 // Position image at the right graphical place177 EastNorth center = Main.map.mapView.getCenter();178 EastNorth leftop = Main.map.mapView.getEastNorth( 0, 0 );179 double pixel_per_en = ( Main.map.mapView.getWidth() / 2.0 ) / ( center.east() - leftop.east() );180 181 //This is now the offset in screen pixels182 double pic_offset_x = (( m_position.east() - leftop.east() ) * pixel_per_en);183 double pic_offset_y = (( leftop.north() - m_position.north() ) * pixel_per_en);184 185 // Let's use Graphics 2D186 Graphics2D g = (Graphics2D)arg0.create();187 // Move188 g.translate( pic_offset_x, pic_offset_y );189 // Rotate190 g.rotate( m_angle * Math.PI / 180.0 );191 // Scale192 double scale = m_scale * m_initial_scale / Main.map.mapView.getScale();193 g.scale( scale, scale );194 195 // Draw picture196 g.drawImage( m_image, -m_image.getWidth() / 2, -m_image.getHeight() / 2, null );197 198 // Draw additional rectangle for the active pic layer199 if ( Main.map.mapView.getActiveLayer() == this ) {200 g.setColor( new Color( 0xFF0000 ) );201 g.drawRect(202 -m_image.getWidth() / 2,203 -m_image.getHeight() / 2,204 m_image.getWidth(),205 m_image.getHeight()206 );207 }208 } else {209 // TODO: proper logging210 System.out.println( "PicLayerAbstract::paint - general drawing error (m_image is null or Graphics not 2D" );211 }212 }213 214 /**215 * Moves the picture. Scaled in EastNorth...216 */217 public void movePictureBy( double east, double north ) {218 m_position = m_position.add( east, north );219 }220 221 /**222 * Scales the picture. Scaled in... don't know but works ok :)223 */224 public void scalePictureBy( double scale ) {225 m_scale += scale;226 } 227 228 /**229 * Rotates the picture. Scales in angles.230 */231 public void rotatePictureBy( double angle ) {232 m_angle += angle;233 } 234 235 /**236 * Sets the image position to the initial position237 */238 public void resetPosition() {239 m_position = m_initial_position;240 }241 242 /**243 * Sets the image scale to 1.0244 */245 public void resetScale() {246 m_scale = 1.0;247 }248 249 /**250 * Sets the image angle to 0.0251 */252 public void resetAngle() {253 m_angle = 0.0;254 }255 256 @Override257 public void visitBoundingBox(BoundingXYVisitor arg0) {258 // TODO Auto-generated method stub259 260 }137 138 @Override 139 public Icon getIcon() { 140 return m_layericon; 141 } 142 143 @Override 144 public Object getInfoComponent() { 145 // TODO Auto-generated method stub 146 return null; 147 } 148 149 @Override 150 public Component[] getMenuEntries() { 151 return m_popupmenu; 152 } 153 154 @Override 155 public String getToolTipText() { 156 return getPicLayerName(); 157 } 158 159 @Override 160 public boolean isMergable(Layer arg0) { 161 // TODO Auto-generated method stub 162 return false; 163 } 164 165 @Override 166 public void mergeFrom(Layer arg0) { 167 // TODO Auto-generated method stub 168 169 } 170 171 @Override 172 public void paint(Graphics arg0, MapView arg1) { 173 174 if ( m_image != null && arg0 instanceof Graphics2D) { 175 176 // Position image at the right graphical place 177 EastNorth center = Main.map.mapView.getCenter(); 178 EastNorth leftop = Main.map.mapView.getEastNorth( 0, 0 ); 179 double pixel_per_en = ( Main.map.mapView.getWidth() / 2.0 ) / ( center.east() - leftop.east() ); 180 181 // This is now the offset in screen pixels 182 double pic_offset_x = (( m_position.east() - leftop.east() ) * pixel_per_en); 183 double pic_offset_y = (( leftop.north() - m_position.north() ) * pixel_per_en); 184 185 // Let's use Graphics 2D 186 Graphics2D g = (Graphics2D)arg0.create(); 187 // Move 188 g.translate( pic_offset_x, pic_offset_y ); 189 // Rotate 190 g.rotate( m_angle * Math.PI / 180.0 ); 191 // Scale 192 double scale = m_scale * m_initial_scale / Main.map.mapView.getMapScale(); 193 g.scale( scale, scale ); 194 195 // Draw picture 196 g.drawImage( m_image, -m_image.getWidth() / 2, -m_image.getHeight() / 2, null ); 197 198 // Draw additional rectangle for the active pic layer 199 if ( Main.map.mapView.getActiveLayer() == this ) { 200 g.setColor( new Color( 0xFF0000 ) ); 201 g.drawRect( 202 -m_image.getWidth() / 2, 203 -m_image.getHeight() / 2, 204 m_image.getWidth(), 205 m_image.getHeight() 206 ); 207 } 208 } else { 209 // TODO: proper logging 210 System.out.println( "PicLayerAbstract::paint - general drawing error (m_image is null or Graphics not 2D" ); 211 } 212 } 213 214 /** 215 * Moves the picture. Scaled in EastNorth... 216 */ 217 public void movePictureBy( double east, double north ) { 218 m_position = m_position.add( east, north ); 219 } 220 221 /** 222 * Scales the picture. Scaled in... don't know but works ok :) 223 */ 224 public void scalePictureBy( double scale ) { 225 m_scale += scale; 226 } 227 228 /** 229 * Rotates the picture. Scales in angles. 230 */ 231 public void rotatePictureBy( double angle ) { 232 m_angle += angle; 233 } 234 235 /** 236 * Sets the image position to the initial position 237 */ 238 public void resetPosition() { 239 m_position = m_initial_position; 240 } 241 242 /** 243 * Sets the image scale to 1.0 244 */ 245 public void resetScale() { 246 m_scale = 1.0; 247 } 248 249 /** 250 * Sets the image angle to 0.0 251 */ 252 public void resetAngle() { 253 m_angle = 0.0; 254 } 255 256 @Override 257 public void visitBoundingBox(BoundingXYVisitor arg0) { 258 // TODO Auto-generated method stub 259 260 } 261 261 } -
applications/editors/josm/plugins/remotecontrol/build.xml
r14015 r16290 26 26 <attribute name="Plugin-Description" value="Let other applications send commands to JOSM."/> 27 27 <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/index.php/JOSM/Plugins/RemoteControl"/> 28 <attribute name="Plugin-Mainversion" value="1 465"/>28 <attribute name="Plugin-Mainversion" value="1722"/> 29 29 <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/> 30 30 </manifest> -
applications/editors/josm/plugins/remotecontrol/src/org/openstreetmap/josm/plugins/remotecontrol/RequestProcessor.java
r14893 r16290 18 18 import org.openstreetmap.josm.actions.AutoScaleAction; 19 19 import org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTask; 20 import org.openstreetmap.josm.data.Bounds; 20 21 import org.openstreetmap.josm.data.coor.EastNorth; 21 22 import org.openstreetmap.josm.data.coor.LatLon; … … 194 195 } else if (Main.pref.getBoolean("remotecontrol.permission.change-viewport", true)) { 195 196 // after downloading, zoom to downloaded area. 196 final LatLon min =new LatLon(minlat, minlon);197 final LatLon max =new LatLon(maxlat, maxlon);197 final Bounds bounds = new Bounds(new LatLon(minlat, minlon), 198 new LatLon(maxlat, maxlon)); 198 199 199 200 Main.worker.execute(new Runnable() { 200 201 public void run() { 201 202 BoundingXYVisitor bbox = new BoundingXYVisitor(); 202 bbox.min = Main.proj.latlon2eastNorth(min); 203 bbox.max = Main.proj.latlon2eastNorth(max); 203 bbox.visit(bounds); 204 204 Main.map.mapView.recalculateCenterScale(bbox); 205 205 } -
applications/editors/josm/plugins/routing/build.xml
r15707 r16290 44 44 <attribute name="Plugin-Description" value="Provides routing capabilities."/> 45 45 <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/index.php/JOSM/Plugins/Routing"/> 46 <attribute name="Plugin-Mainversion" value="1 646"/>46 <attribute name="Plugin-Mainversion" value="1722"/> 47 47 <attribute name="Plugin-Stage" value="50"/> 48 48 <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/> -
applications/editors/josm/plugins/routing/src/com/innovant/josm/jrt/core/RoutingGraph.java
r15707 r16290 160 160 */ 161 161 private void addEdge(Way way,Node from, Node to) { 162 double length = from. coor.greatCircleDistance(to.coor);162 double length = from.getCoor().greatCircleDistance(to.getCoor()); 163 163 164 164 OsmEdge edge = new OsmEdge(way, from, to); -
applications/editors/josm/plugins/routing/src/com/innovant/josm/jrt/osm/OsmEdge.java
r15707 r16290 69 69 this.from = from; 70 70 this.to = to; 71 this.length = from. coor.greatCircleDistance(to.coor);71 this.length = from.getCoor().greatCircleDistance(to.getCoor()); 72 72 } 73 73 … … 80 80 81 81 public EastNorth fromEastNorth() { 82 return this.from. eastNorth;82 return this.from.getEastNorth(); 83 83 } 84 84 85 85 public EastNorth toEastNorth() { 86 return this.to. eastNorth;86 return this.to.getEastNorth(); 87 87 } 88 88 -
applications/editors/josm/plugins/routing/src/com/innovant/josm/plugin/routing/RoutingLayer.java
r15707 r16290 139 139 if (n.deleted || n.incomplete) continue; 140 140 141 Point P = Main.map.mapView.getPoint(n. eastNorth);141 Point P = Main.map.mapView.getPoint(n.getEastNorth()); 142 142 double dist = p.distanceSq(P); 143 143 if (dist < NavigatableComponent.snapDistance) { … … 275 275 // paint start icon 276 276 Node node = nodes.get(0); 277 Point screen = mv.getPoint(node. eastNorth);277 Point screen = mv.getPoint(node.getEastNorth()); 278 278 startIcon.paintIcon(mv, g, screen.x - startIcon.getIconWidth()/2, 279 279 screen.y - startIcon.getIconHeight()); … … 282 282 for(int index = 1; index < nodes.size() - 1; ++index) { 283 283 node = nodes.get(index); 284 screen = mv.getPoint(node. eastNorth);284 screen = mv.getPoint(node.getEastNorth()); 285 285 middleIcon.paintIcon(mv, g, screen.x - startIcon.getIconWidth()/2, 286 286 screen.y - middleIcon.getIconHeight()); … … 289 289 if(nodes.size() > 1) { 290 290 node = nodes.get(nodes.size() - 1); 291 screen = mv.getPoint(node. eastNorth);291 screen = mv.getPoint(node.getEastNorth()); 292 292 endIcon.paintIcon(mv, g, screen.x - startIcon.getIconWidth()/2, 293 293 screen.y - endIcon.getIconHeight()); -
applications/editors/josm/plugins/routing/src/com/innovant/josm/plugin/routing/actions/MoveRouteNodeAction.java
r15707 r16290 113 113 for (int i=0;i<nl.size();i++) { 114 114 Node node = nl.get(i); 115 double d = Main.map.mapView.getPoint(node. eastNorth).distanceSq(e.getPoint());115 double d = Main.map.mapView.getPoint(node.getEastNorth()).distanceSq(e.getPoint()); 116 116 if (d < dmax) { 117 117 dmax = d; -
applications/editors/josm/plugins/routing/src/com/innovant/josm/plugin/routing/actions/RemoveRouteNodeAction.java
r15707 r16290 102 102 for (int i=0;i<nl.size();i++) { 103 103 Node node = nl.get(i); 104 double d = Main.map.mapView.getPoint(node. eastNorth).distanceSq(e.getPoint());104 double d = Main.map.mapView.getPoint(node.getEastNorth()).distanceSq(e.getPoint()); 105 105 if (d < dmax) { 106 106 dmax = d; -
applications/editors/josm/plugins/routing/src/com/innovant/josm/plugin/routing/gui/RoutingDialog.java
r15707 r16290 125 125 */ 126 126 public void addNode(Node n) { 127 model.addElement(n.id+" ["+n. coor.toDisplayString()+"]");127 model.addElement(n.id+" ["+n.getCoor().toDisplayString()+"]"); 128 128 } 129 129 … … 134 134 */ 135 135 public void insertNode(int index, Node n) { 136 model.insertElementAt(n.id+" ["+n. coor.toDisplayString()+"]", index);136 model.insertElementAt(n.id+" ["+n.getCoor().toDisplayString()+"]", index); 137 137 } 138 138 -
applications/editors/josm/plugins/surveyor/build.xml
r14015 r16290 37 37 <attribute name="Plugin-Description" value="Allow adding markers/nodes on current gps positions."/> 38 38 <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/index.php/JOSM/Plugins/Surveyor"/> 39 <attribute name="Plugin-Mainversion" value="1 326"/>39 <attribute name="Plugin-Mainversion" value="1722"/> 40 40 <attribute name="Plugin-Requires" value="livegps"/> 41 41 <attribute name="Plugin-Stage" value="60"/> -
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorShowAction.java
r13497 r16290 81 81 public void actionPerformed(ActionEvent e) { 82 82 if(Main.map != null && Main.map.mapView != null) { 83 Main.map.mapView.zoomTo (Main.map.mapView.getCenter(), Main.map.mapView.getScale()*2);83 Main.map.mapView.zoomToFactor(2); 84 84 } 85 85 } … … 90 90 public void actionPerformed(ActionEvent e) { 91 91 if(Main.map != null && Main.map.mapView != null) { 92 Main.map.mapView.zoomTo (Main.map.mapView.getCenter(), Main.map.mapView.getScale()/2);92 Main.map.mapView.zoomToFactor(1/2); 93 93 } 94 94 } -
applications/editors/josm/plugins/utilsplugin/build.xml
r16162 r16290 25 25 <attribute name="Plugin-Date" value="${version.entry.commit.date}"/> 26 26 <attribute name="Plugin-Description" value="Several utilities that make your life easier: e.g. simplify way, join areas, jump to position."/> 27 <attribute name="Plugin-Mainversion" value="1 638"/>27 <attribute name="Plugin-Mainversion" value="1722"/> 28 28 <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/> 29 29 </manifest> -
applications/editors/josm/plugins/utilsplugin/src/UtilsPlugin/JumpToAction.java
r16162 r16290 43 43 lon.setText(java.lang.Double.toString(curPos.lon())); 44 44 45 LatLon ll1 = Main.map.mapView.getLatLon(0,0); 46 LatLon ll2 = Main.map.mapView.getLatLon(100,0); 47 double dist = ll1.greatCircleDistance(ll2); 48 zoomFactor = Main.map.mapView.getScale()/dist; 45 double dist = Main.map.mapView.getDist100Pixel(); 46 zoomFactor = 1/dist; 49 47 50 48 zm.setText(java.lang.Long.toString(Math.round(dist*100)/100)); … … 116 114 } 117 115 118 Main.map.mapView.zoomTo(Main.proj.latlon2eastNorth(ll), zoomFactor * zoomLvl); 116 Main.map.mapView.zoomToFactor(Main.proj.latlon2eastNorth(ll), zoomFactor * zoomLvl); 119 117 } 120 118 -
applications/editors/josm/plugins/validator/build.xml
r16159 r16290 26 26 <attribute name="Plugin-Description" value="An OSM data validator. It checks for problems in data, and provides fixes for the common ones. Spellcheck integrated for tag names."/> 27 27 <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/index.php/JOSM/Plugins/Validator"/> 28 <attribute name="Plugin-Mainversion" value="1 638"/>28 <attribute name="Plugin-Mainversion" value="1722"/> 29 29 <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/> 30 30 </manifest> -
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/ValidatorDialog.java
r13497 r16290 262 262 ValidatorBoundingXYVisitor bbox = new ValidatorBoundingXYVisitor(); 263 263 popupMenuError.visitHighlighted(bbox); 264 if (bbox. min == null || bbox.max== null)264 if (bbox.getBounds() == null) 265 265 return; 266 266 bbox.enlargeBoundingBox(); -
applications/editors/josm/plugins/waydownloader/build.xml
r16177 r16290 91 91 <attribute name="Plugin-Description" value="Easy downloading along a long set of interconnected ways"/> 92 92 <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/WayDownloaderPlugin"/> 93 <attribute name="Plugin-Mainversion" value="1"/> 93 <attribute name="Plugin-Mainversion" value="1722"/> 94 94 <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/> 95 95 </manifest> -
applications/editors/josm/plugins/waydownloader/src/WayDownloaderPlugin.java
r15412 r16290 25 25 /** 26 26 * Plugin class for the Way Downloader plugin 27 * 27 * 28 28 * @author Harry Wood 29 29 */ 30 30 public class WayDownloaderPlugin extends Plugin { 31 31 32 private Way priorConnectedWay = null; 33 private Node selectedNode = null; 34 35 36 /** Plugin constructor called at JOSM startup */ 37 public WayDownloaderPlugin() { 38 //add WayDownloadAction to tools menu 39 MainMenu.add(Main.main.menu.toolsMenu, new WayDownloadAction()); 40 } 41 42 private class WayDownloadAction extends JosmAction implements Runnable { 43 44 /** Set up the action (text appearing on the menu, keyboard shortcut etc */ 45 public WayDownloadAction() { 46 47 super( "Way Download" , 48 "way-download", 49 "Download map data on the end of selected way", 50 Shortcut.registerShortcut("waydownloader:waydownload", "Way Download", KeyEvent.VK_W, Shortcut.GROUP_MENU, Shortcut.SHIFT_DEFAULT), 51 true); 52 } 53 54 /** Called when the WayDownloadAction action is triggered (e.g. user clicked the menu option) */ 55 public void actionPerformed(ActionEvent e) { 56 57 System.out.println("Way Download"); 58 59 String errMsg = null; 60 61 selectedNode = null; 62 Collection<OsmPrimitive> selection = Main.ds.getSelectedNodes(); 63 64 if (selection.size()==0) { 65 selection = Main.ds.getSelectedWays(); 66 if (!workFromWaySelection(selection)) { 67 errMsg = tr("Select a starting node on the end of a way"); 68 } 69 selection = Main.ds.getSelectedNodes(); 70 } 71 72 if ( selection.size()==0 || selection.size()>1 ) { 73 errMsg = tr("Select a starting node on the end of a way"); 74 } else { 75 OsmPrimitive p = selection.iterator().next(); 76 77 78 79 if (!(p instanceof Node)) { 80 errMsg = tr("Select a starting node on the end of a way"); 81 } else { 82 selectedNode = (Node) p; 83 84 85 Main.map.mapView.zoomTo(selectedNode.eastNorth , Main.map.mapView.getScale()); 86 87 //Before downloading. Figure a few things out. 88 //Find connected way 89 ArrayList<Way> connectedWays = findConnectedWays(); 90 91 if (connectedWays.size()==0) { 92 errMsg = tr("Select a starting node on the end of a way"); 93 } else { 94 priorConnectedWay =(Way) connectedWays.get(0); 95 96 //Download a little rectangle around the selected node 97 double latbuffer=0.0003; //TODO make this an option 98 double lonbuffer=0.0005; 99 DownloadOsmTask downloadTask = new DownloadOsmTask(); 100 downloadTask.download( null, 101 selectedNode.coor.lat()-latbuffer, 102 selectedNode.coor.lon()-lonbuffer, 103 selectedNode.coor.lat()+latbuffer, 104 selectedNode.coor.lon()+lonbuffer); 105 106 //The download is scheduled to be executed. 107 //Now schedule the run() method (below) to be executed once that's completed. 108 Main.worker.execute(this); 109 110 } 111 } 112 } 113 114 if(errMsg != null) 115 JOptionPane.showMessageDialog(Main.parent, errMsg); 116 117 118 } 119 120 /** 121 * Logic to excute after the download has happened 122 */ 123 public void run() { 124 //Find ways connected to the node after the download 125 ArrayList<Way> connectedWays = findConnectedWays(); 126 127 String errMsg = null; 128 if (connectedWays.size()==0) { 129 throw new RuntimeException("Way downloader data inconsistency. priorConnectedWay (" + 130 priorConnectedWay.toString() + ") wasn't discovered after download"); 131 132 } else if (connectedWays.size()==1) { 133 //Just one way connecting the node still. Presumably the one which was there before 134 135 //Check if it's just a duplicate node 136 Node dupeNode = duplicateNode(); 137 if (dupeNode!=null) { 138 139 if (JOptionPane.showConfirmDialog(null, "Merge duplicate node?")==JOptionPane.YES_OPTION) { 140 LinkedList<Node> dupeNodes = new LinkedList<Node>(); 141 dupeNodes.add(dupeNode); 142 MergeNodesAction.mergeNodes(dupeNodes, selectedNode); 143 144 connectedWays = findConnectedWays(); //Carry on 145 } 146 147 148 } else { 149 errMsg = tr("Reached the end of the line"); 150 } 151 152 } 153 154 if (connectedWays.size()>2) { 155 //Three or more ways meeting at this node. Means we have a junction. 156 errMsg = tr("Reached a junction"); 157 158 } else if (connectedWays.size()==2) { 159 //Two connected ways (The "normal" way downloading case) 160 //Figure out which of the two is new. 161 System.out.println("connectedWays.toString()=" + connectedWays.toString()); 162 Way wayA = (Way) connectedWays.get(0); 163 Way wayB = (Way) connectedWays.get(1); 164 Way nextWay = wayA; 165 if (priorConnectedWay.equals(wayA)) nextWay = wayB; 166 167 Node nextNode = findOtherEnd(nextWay, selectedNode); 168 169 //Select the next node 170 Main.ds.setSelected(nextNode); 171 172 Main.map.mapView.zoomTo(nextNode.eastNorth , Main.map.mapView.getScale()); 173 174 } 175 if(errMsg != null) 176 JOptionPane.showMessageDialog(Main.parent, errMsg); 177 } 178 } 179 180 /** See if there's another node at the same coordinates. If so return it. Otherwise null */ 181 private Node duplicateNode() { 182 Iterator nodesIter = Main.ds.nodes.iterator(); 183 while (nodesIter.hasNext()) { 184 Node onNode = (Node) nodesIter.next(); 185 if (!onNode.equals(this.selectedNode) 186 && onNode.coor.lat()==selectedNode.coor.lat() 187 && onNode.coor.lon()==selectedNode.coor.lon()) { 188 return onNode; 189 } 190 } 191 return null; 192 } 193 194 /** Given the the node on one end of the way, return the node on the other end */ 195 private Node findOtherEnd(Way way, Node firstEnd) { 196 Node otherEnd = way.nodes.get(0); 197 if (otherEnd.equals(firstEnd)) otherEnd = way.nodes.get(way.nodes.size()-1); 198 return otherEnd; 199 } 200 201 /** find set of ways which have an end on the selectedNode */ 202 private ArrayList<Way> findConnectedWays() { 203 ArrayList<Way> connectedWays = new ArrayList<Way>(); 204 205 //loop through every way 206 Iterator waysIter = Main.ds.ways.iterator(); 207 while (waysIter.hasNext()) { 208 Way onWay = (Way) waysIter.next(); 209 210 211 Object[] nodes = onWay.nodes.toArray(); 212 if (nodes.length<2) { 213 //Should never happen should it? TODO: investigate. For the moment ignore these 214 System.err.println("WayDownloader plugin encountered a way with " + nodes.length + " nodes :" + onWay.toString()); 215 } else { 216 Node firstNode = (Node) nodes[0]; 217 Node lastNode = (Node) nodes[nodes.length-1]; 218 219 if (firstNode.equals(selectedNode) || lastNode.equals(selectedNode)) { 220 //Found it 221 connectedWays.add(onWay); 222 } 223 } 224 } 225 return connectedWays; 226 } 227 228 /** 229 * given a selected way, select a node on the end of the way which is not in a downloaded area 230 * return true if this worked 231 */ 232 private boolean workFromWaySelection(Collection<OsmPrimitive> selection) { 233 234 if (selection.size()>1) { 235 //more than one way selected 236 return false; 237 } else { 238 Way selectedWay = (Way) selection.toArray()[0]; 239 selectedNode = (Node) selectedWay.nodes.get(0); 32 private Way priorConnectedWay = null; 33 private Node selectedNode = null; 34 35 36 /** Plugin constructor called at JOSM startup */ 37 public WayDownloaderPlugin() { 38 //add WayDownloadAction to tools menu 39 MainMenu.add(Main.main.menu.toolsMenu, new WayDownloadAction()); 40 } 41 42 private class WayDownloadAction extends JosmAction implements Runnable { 43 44 /** Set up the action (text appearing on the menu, keyboard shortcut etc */ 45 public WayDownloadAction() { 46 47 super( "Way Download" , 48 "way-download", 49 "Download map data on the end of selected way", 50 Shortcut.registerShortcut("waydownloader:waydownload", "Way Download", KeyEvent.VK_W, Shortcut.GROUP_MENU, Shortcut.SHIFT_DEFAULT), 51 true); 52 } 53 54 /** Called when the WayDownloadAction action is triggered (e.g. user clicked the menu option) */ 55 public void actionPerformed(ActionEvent e) { 56 57 System.out.println("Way Download"); 58 59 String errMsg = null; 60 61 selectedNode = null; 62 Collection<OsmPrimitive> selection = Main.ds.getSelectedNodes(); 63 64 if (selection.size()==0) { 65 selection = Main.ds.getSelectedWays(); 66 if (!workFromWaySelection(selection)) { 67 errMsg = tr("Select a starting node on the end of a way"); 68 } 69 selection = Main.ds.getSelectedNodes(); 70 } 71 72 if ( selection.size()==0 || selection.size()>1 ) { 73 errMsg = tr("Select a starting node on the end of a way"); 74 } else { 75 OsmPrimitive p = selection.iterator().next(); 76 77 78 79 if (!(p instanceof Node)) { 80 errMsg = tr("Select a starting node on the end of a way"); 81 } else { 82 selectedNode = (Node) p; 83 84 85 Main.map.mapView.zoomTo(selectedNode.getEastNorth()); 86 87 //Before downloading. Figure a few things out. 88 //Find connected way 89 ArrayList<Way> connectedWays = findConnectedWays(); 90 91 if (connectedWays.size()==0) { 92 errMsg = tr("Select a starting node on the end of a way"); 93 } else { 94 priorConnectedWay =(Way) connectedWays.get(0); 95 96 //Download a little rectangle around the selected node 97 double latbuffer=0.0003; //TODO make this an option 98 double lonbuffer=0.0005; 99 DownloadOsmTask downloadTask = new DownloadOsmTask(); 100 downloadTask.download( null, 101 selectedNode.getCoor().lat()-latbuffer, 102 selectedNode.getCoor().lon()-lonbuffer, 103 selectedNode.getCoor().lat()+latbuffer, 104 selectedNode.getCoor().lon()+lonbuffer); 105 106 //The download is scheduled to be executed. 107 //Now schedule the run() method (below) to be executed once that's completed. 108 Main.worker.execute(this); 109 } 110 } 111 } 112 113 if(errMsg != null) 114 JOptionPane.showMessageDialog(Main.parent, errMsg); 115 } 116 117 /** 118 * Logic to excute after the download has happened 119 */ 120 public void run() { 121 //Find ways connected to the node after the download 122 ArrayList<Way> connectedWays = findConnectedWays(); 123 124 String errMsg = null; 125 if (connectedWays.size()==0) { 126 throw new RuntimeException("Way downloader data inconsistency. priorConnectedWay (" + 127 priorConnectedWay.toString() + ") wasn't discovered after download"); 128 129 } else if (connectedWays.size()==1) { 130 //Just one way connecting the node still. Presumably the one which was there before 131 132 //Check if it's just a duplicate node 133 Node dupeNode = duplicateNode(); 134 if (dupeNode!=null) { 135 136 if (JOptionPane.showConfirmDialog(null, "Merge duplicate node?")==JOptionPane.YES_OPTION) { 137 LinkedList<Node> dupeNodes = new LinkedList<Node>(); 138 dupeNodes.add(dupeNode); 139 MergeNodesAction.mergeNodes(dupeNodes, selectedNode); 140 141 connectedWays = findConnectedWays(); //Carry on 142 } 143 144 145 } else { 146 errMsg = tr("Reached the end of the line"); 147 } 148 149 } 150 151 if (connectedWays.size()>2) { 152 //Three or more ways meeting at this node. Means we have a junction. 153 errMsg = tr("Reached a junction"); 154 155 } else if (connectedWays.size()==2) { 156 //Two connected ways (The "normal" way downloading case) 157 //Figure out which of the two is new. 158 System.out.println("connectedWays.toString()=" + connectedWays.toString()); 159 Way wayA = (Way) connectedWays.get(0); 160 Way wayB = (Way) connectedWays.get(1); 161 Way nextWay = wayA; 162 if (priorConnectedWay.equals(wayA)) nextWay = wayB; 163 164 Node nextNode = findOtherEnd(nextWay, selectedNode); 165 166 //Select the next node 167 Main.ds.setSelected(nextNode); 168 169 Main.map.mapView.zoomTo(nextNode.getEastNorth()); 170 } 171 if(errMsg != null) 172 JOptionPane.showMessageDialog(Main.parent, errMsg); 173 } 174 } 175 176 /** See if there's another node at the same coordinates. If so return it. Otherwise null */ 177 private Node duplicateNode() { 178 Iterator nodesIter = Main.ds.nodes.iterator(); 179 while (nodesIter.hasNext()) { 180 Node onNode = (Node) nodesIter.next(); 181 if (!onNode.equals(this.selectedNode) 182 && onNode.getCoor().lat()==selectedNode.getCoor().lat() 183 && onNode.getCoor().lon()==selectedNode.getCoor().lon()) { 184 return onNode; 185 } 186 } 187 return null; 188 } 189 190 /** Given the the node on one end of the way, return the node on the other end */ 191 private Node findOtherEnd(Way way, Node firstEnd) { 192 Node otherEnd = way.nodes.get(0); 193 if (otherEnd.equals(firstEnd)) otherEnd = way.nodes.get(way.nodes.size()-1); 194 return otherEnd; 195 } 196 197 /** find set of ways which have an end on the selectedNode */ 198 private ArrayList<Way> findConnectedWays() { 199 ArrayList<Way> connectedWays = new ArrayList<Way>(); 200 201 //loop through every way 202 Iterator waysIter = Main.ds.ways.iterator(); 203 while (waysIter.hasNext()) { 204 Way onWay = (Way) waysIter.next(); 205 206 207 Object[] nodes = onWay.nodes.toArray(); 208 if (nodes.length<2) { 209 //Should never happen should it? TODO: investigate. For the moment ignore these 210 System.err.println("WayDownloader plugin encountered a way with " + nodes.length + " nodes :" + onWay.toString()); 211 } else { 212 Node firstNode = (Node) nodes[0]; 213 Node lastNode = (Node) nodes[nodes.length-1]; 214 215 if (firstNode.equals(selectedNode) || lastNode.equals(selectedNode)) { 216 //Found it 217 connectedWays.add(onWay); 218 } 219 } 220 } 221 return connectedWays; 222 } 223 224 /** 225 * given a selected way, select a node on the end of the way which is not in a downloaded area 226 * return true if this worked 227 */ 228 private boolean workFromWaySelection(Collection<OsmPrimitive> selection) { 229 230 if (selection.size()>1) { 231 //more than one way selected 232 return false; 233 } else { 234 Way selectedWay = (Way) selection.toArray()[0]; 235 selectedNode = (Node) selectedWay.nodes.get(0); 240 236 241 237 if (isDownloaded(selectedNode)) { 242 selectedNode = findOtherEnd(selectedWay, selectedNode);243 238 selectedNode = findOtherEnd(selectedWay, selectedNode); 239 244 240 if (isDownloaded(selectedNode)) return false; 245 }246 }247 Main.ds.setSelected(selectedNode);248 return true;249 }250 251 private boolean isDownloaded(Node node) {252 Iterator downloadedAreasIter = Main.ds.dataSources.iterator();253 while (downloadedAreasIter.hasNext()) {254 DataSource datasource = (DataSource) downloadedAreasIter.next();255 Bounds bounds = datasource.bounds;256 257 if (node.coor.lat()>bounds.min.lat() &&258 node.coor.lat()<bounds.max.lat() &&259 node.coor.lon()>bounds.min.lon() &&260 node.coor.lon()<bounds.max.lon()) {261 return true;262 }263 }264 return false;265 }241 } 242 } 243 Main.ds.setSelected(selectedNode); 244 return true; 245 } 246 247 private boolean isDownloaded(Node node) { 248 Iterator downloadedAreasIter = Main.ds.dataSources.iterator(); 249 while (downloadedAreasIter.hasNext()) { 250 DataSource datasource = (DataSource) downloadedAreasIter.next(); 251 Bounds bounds = datasource.bounds; 252 253 if (node.getCoor().lat()>bounds.min.lat() && 254 node.getCoor().lat()<bounds.max.lat() && 255 node.getCoor().lon()>bounds.min.lon() && 256 node.getCoor().lon()<bounds.max.lon()) { 257 return true; 258 } 259 } 260 return false; 261 } 266 262 } -
applications/editors/josm/plugins/wmsplugin/build.xml
r15707 r16290 29 29 <attribute name="Plugin-Description" value="Display georeferenced images as background in JOSM (WMS servers, Yahoo, ...)."/> 30 30 <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/WMSPlugin"/> 31 <attribute name="Plugin-Mainversion" value="1 646"/>31 <attribute name="Plugin-Mainversion" value="1722"/> 32 32 <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/> 33 33 <attribute name="de_Plugin-Link" value="http://wiki.openstreetmap.org/wiki/DE:JOSM/Plugins/WMSPlugin"/> -
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/Grabber.java
r15858 r16290 9 9 10 10 import org.openstreetmap.josm.Main; 11 import org.openstreetmap.josm.data.Bounds; 12 import org.openstreetmap.josm.data.coor. LatLon;11 import org.openstreetmap.josm.data.ProjectionBounds; 12 import org.openstreetmap.josm.data.coor.EastNorth; 13 13 import org.openstreetmap.josm.data.projection.Projection; 14 14 import org.openstreetmap.josm.gui.MapView; … … 16 16 17 17 abstract public class Grabber implements Runnable { 18 protected Bounds b; 18 protected ProjectionBounds b; 19 19 protected Projection proj; 20 20 protected double pixelPerDegree; … … 24 24 protected CacheFiles cache; 25 25 26 Grabber(Bounds b, GeorefImage image, MapView mv, WMSLayer layer, CacheFiles cache) 26 Grabber(ProjectionBounds b, GeorefImage image, MapView mv, WMSLayer layer, CacheFiles cache) 27 27 { 28 if (b.min != null && b.max != null && WMSPlugin.doOverlap) 29 { 30 double latCent = (b.min.lat() + b.max.lat()) / 2; 31 double lonCent = (b.min.lon() + b.max.lon()) / 2; 32 33 double latSize = b.max.lat() - b.min.lat(); 34 double lonSize = b.max.lon() - b.min.lon(); 35 36 double latCoef = (100.0 + WMSPlugin.overlapLat) / 100.0 / 2.0; 37 double lonCoef = (100.0 + WMSPlugin.overlapLon) / 100.0 / 2.0; 38 39 this.b = new Bounds( new LatLon(latCent - latCoef * latSize, 40 lonCent - lonCoef * lonSize), 41 new LatLon(latCent + latCoef * latSize, 42 lonCent + lonCoef * lonSize)); 43 } 44 else 45 this.b = b; 46 28 this.b = b; 47 29 this.proj = Main.main.proj; 48 30 this.pixelPerDegree = layer.pixelPerDegree; … … 56 38 57 39 int width(){ 58 return (int) ((b.max. lon() - b.min.lon()) * pixelPerDegree);40 return (int) ((b.max.north() - b.min.north()) * pixelPerDegree); 59 41 } 60 42 int height(){ 61 return (int) ((b.max. lat() - b.min.lat()) * pixelPerDegree);43 return (int) ((b.max.east() - b.min.east()) * pixelPerDegree); 62 44 } 63 45 -
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSGrabber.java
r15961 r16290 24 24 25 25 import org.openstreetmap.josm.Main; 26 import org.openstreetmap.josm.data.Bounds; 26 import org.openstreetmap.josm.data.ProjectionBounds; 27 import org.openstreetmap.josm.data.coor.EastNorth; 28 import org.openstreetmap.josm.data.coor.LatLon; 29 import org.openstreetmap.josm.data.projection.Epsg4326; 30 import org.openstreetmap.josm.data.projection.Mercator; 27 31 import org.openstreetmap.josm.gui.MapView; 28 32 import org.openstreetmap.josm.io.CacheFiles; … … 35 39 private final boolean urlWithPatterns; 36 40 37 WMSGrabber(Bounds b, GeorefImage image, MapView mv, WMSLayer layer, CacheFiles cache) { 41 WMSGrabber(ProjectionBounds b, GeorefImage image, MapView mv, WMSLayer layer, CacheFiles cache) { 38 42 super(b, image, mv, layer, cache); 39 43 this.baseURL = layer.baseURL; … … 51 55 try { 52 56 url = getURL( 53 b.min. lon(), b.min.lat(),54 b.max. lon(), b.max.lat(),57 b.min.east(), b.min.north(), 58 b.max.east(), b.max.north(), 55 59 width(), height()); 56 60 57 image.min = proj.latlon2eastNorth(b.min);58 image.max = proj.latlon2eastNorth(b.max);61 image.min = b.min; 62 image.max = b.max; 59 63 64 System.out.println(url + " " + b + " " + image.min + " " + image.max); 60 65 if(image.isVisible(mv)) { //don't download, if the image isn't visible already 61 66 image.image = grab(url); … … 73 78 protected URL getURL(double w, double s,double e,double n, 74 79 int wi, int ht) throws MalformedURLException { 80 String proj = Main.proj.toCode(); 81 if(Main.proj instanceof Mercator) // don't use mercator code directly 82 { 83 LatLon sw = Main.proj.eastNorth2latlon(new EastNorth(s, w)); 84 LatLon ne = Main.proj.eastNorth2latlon(new EastNorth(n, e)); 85 proj = "EPSG:4326"; 86 s = sw.lat(); 87 w = sw.lon(); 88 n = ne.lat(); 89 e = ne.lon(); 90 } 91 /* else if(!(Main.proj instanceof Epsg4326)) 92 { 93 EastNorth sw = Main.proj.latlon2eastNorth(new LatLon(s, w)); 94 EastNorth ne = Main.proj.latlon2eastNorth(new LatLon(n, e)); 95 s = sw.north(); 96 w = sw.east(); 97 n = ne.north(); 98 e = ne.east(); 99 } 100 */ 75 101 String str = baseURL; 76 102 String bbox = latLonFormat.format(w) + "," … … 80 106 81 107 if (urlWithPatterns) { 82 String proj = Main.proj.toCode();83 if(Main.proj instanceof org.openstreetmap.josm.data.projection.Mercator) // don't use mercator code directly84 proj = "EPSG:4326";85 86 108 str = MessageFormat.format(str, proj, bbox, wi, ht); 87 109 } else { … … 99 121 { 100 122 String projname = Main.proj.toCode(); 101 if(Main.proj instanceof org.openstreetmap.josm.data.projection.Mercator) // don't use mercator code123 if(Main.proj instanceof Mercator) // don't use mercator code 102 124 projname = "EPSG:4326"; 103 125 String res = ""; -
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSLayer.java
r15858 r16290 26 26 import org.openstreetmap.josm.Main; 27 27 import org.openstreetmap.josm.actions.DiskAccessAction; 28 import org.openstreetmap.josm.data.Bounds; 28 import org.openstreetmap.josm.data.ProjectionBounds; 29 29 import org.openstreetmap.josm.data.coor.EastNorth; 30 30 import org.openstreetmap.josm.data.coor.LatLon; … … 79 79 WMSGrabber.getProjection(baseURL, true); 80 80 mv = Main.map.mapView; 81 getPPD(); 81 pixelPerDegree = getPPD(); 82 82 83 83 executor = Executors.newFixedThreadPool(3); … … 92 92 } 93 93 94 public void getPPD(){ 95 pixelPerDegree = mv.getWidth() / (bounds().max.lon() - bounds().min.lon()); 94 public double getPPD(){ 95 ProjectionBounds bounds = mv.getProjectionBounds(); 96 return mv.getWidth() / (bounds.max.east() - bounds.min.east()); 96 97 } 97 98 … … 128 129 } 129 130 130 private Bounds XYtoBounds (int x, int y) { 131 return new Bounds( 132 new LatLon( x * ImageSize / pixelPerDegree, y * ImageSize / pixelPerDegree),133 new LatLon((x + 1) * ImageSize / pixelPerDegree, (y + 1) * ImageSize / pixelPerDegree));131 private ProjectionBounds XYtoBounds (int x, int y) { 132 return new ProjectionBounds( 133 new EastNorth( x * ImageSize / pixelPerDegree, y * ImageSize / pixelPerDegree), 134 new EastNorth((x + 1) * ImageSize / pixelPerDegree, (y + 1) * ImageSize / pixelPerDegree)); 134 135 } 135 136 … … 138 139 } 139 140 140 protected Bounds bounds(){141 return new Bounds(142 mv.getLatLon(0, mv.getHeight()),143 mv.getLatLon(mv.getWidth(), 0));144 }145 146 141 @Override public void paint(Graphics g, final MapView mv) { 147 142 if(baseURL == null) return; 148 143 149 if( !startstop.isSelected() || (pixelPerDegree / (mv.getWidth() / (bounds().max.lon() - bounds().min.lon())) > minZoom) ){ //don't download when it's too outzoomed144 if( !startstop.isSelected() || (pixelPerDegree / getPPD() > minZoom) ){ //don't download when it's too outzoomed 150 145 for(int x = 0; x<dax; ++x) 151 146 for(int y = 0; y<day; ++y) … … 161 156 162 157 protected void downloadAndPaintVisible(Graphics g, final MapView mv){ 163 int bminx= (int)Math.floor ((bounds().min.lat() * pixelPerDegree ) / ImageSize ); 164 int bminy= (int)Math.floor ((bounds().min.lon() * pixelPerDegree ) / ImageSize ); 165 int bmaxx= (int)Math.ceil ((bounds().max.lat() * pixelPerDegree ) / ImageSize ); 166 int bmaxy= (int)Math.ceil ((bounds().max.lon() * pixelPerDegree ) / ImageSize ); 158 ProjectionBounds bounds = mv.getProjectionBounds(); 159 int bminx= (int)Math.floor ((bounds.min.east() * pixelPerDegree ) / ImageSize ); 160 int bminy= (int)Math.floor ((bounds.min.north() * pixelPerDegree ) / ImageSize ); 161 int bmaxx= (int)Math.ceil ((bounds.max.east() * pixelPerDegree ) / ImageSize ); 162 int bmaxy= (int)Math.ceil ((bounds.max.north() * pixelPerDegree ) / ImageSize ); 167 163 168 164 if((bmaxx - bminx > dax) || (bmaxy - bminy > day)){ … … 241 237 initializeImages(); 242 238 resolution = scale(); 243 getPPD(); 239 pixelPerDegree = getPPD(); 244 240 mv.repaint(); 245 241 } -
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSPlugin.java
r15858 r16290 25 25 import org.openstreetmap.josm.Main; 26 26 import org.openstreetmap.josm.actions.JosmAction; 27 import org.openstreetmap.josm.data.Bounds; 27 import org.openstreetmap.josm.data.ProjectionBounds; 28 28 import org.openstreetmap.josm.gui.IconToggleButton; 29 29 import org.openstreetmap.josm.gui.MainMenu; … … 43 43 static ArrayList<WMSInfo> wmsList = new ArrayList<WMSInfo>(); 44 44 static TreeMap<String,String> wmsListDefault = new TreeMap<String,String>(); 45 46 static boolean doOverlap = false;47 static int overlapLat = 4;48 static int overlapLon = 14;49 45 50 46 // remember state of menu item to restore on changed preferences … … 89 85 90 86 TreeSet<String> keys = new TreeSet<String>(prefs.keySet()); 91 92 // Here we load the settings for "overlap" checkbox and spinboxes.93 94 try {95 doOverlap = Boolean.valueOf(prefs.get("wmsplugin.url.overlap"));96 } catch (Exception e) {} // If sth fails, we drop to default settings.97 98 try {99 overlapLat = Integer.valueOf(prefs.get("wmsplugin.url.overlapLat"));100 } catch (Exception e) {} // If sth fails, we drop to default settings.101 102 try {103 overlapLon = Integer.valueOf(prefs.get("wmsplugin.url.overlapLon"));104 } catch (Exception e) {} // If sth fails, we drop to default settings.105 87 106 88 // And then the names+urls of WMS servers … … 207 189 } 208 190 209 // baseURL, XYtoBounds(x,y), Main.main.proj, pixelPerDegree, img, mv, this 210 // Grabber gr = WMSPlugin.getGrabber(XYtoBounds(x,y), img, mv, this); 211 public static Grabber getGrabber(Bounds bounds, GeorefImage img, MapView mv, WMSLayer layer){ 191 public static Grabber getGrabber(ProjectionBounds bounds, GeorefImage img, MapView mv, WMSLayer layer){ 212 192 if(layer.baseURL.startsWith("yahoo://")) 213 193 return new YAHOOGrabber(bounds, img, mv, layer, cache); 214 194 else 215 195 return new WMSGrabber(bounds, img, mv, layer, cache); 216 217 // OSBGrabber should be rewrite for thread support first218 //if (wmsurl.matches("(?i).*layers=npeoocmap.*") || wmsurl.matches("(?i).*layers=npe.*") )219 // return new OSGBGrabber(_b, _proj, _pixelPerDegree, _images, _mv, _layer);220 196 } 221 197 -
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSPreferenceEditor.java
r15940 r16290 33 33 private DefaultTableModel model; 34 34 private HashMap<Integer, WMSInfo> oldValues = new HashMap<Integer, WMSInfo>(); 35 36 JCheckBox overlapCheckBox;37 JSpinner spinLat;38 JSpinner spinLon;39 35 40 36 public void addGui(final PreferenceDialog gui) { … … 117 113 p.add(buttonPanel); 118 114 p.add(Box.createHorizontalGlue(), GBC.eol().fill(GBC.HORIZONTAL)); 119 120 overlapCheckBox = new JCheckBox(tr("Overlap tiles"), WMSPlugin.doOverlap );121 JLabel labelLat = new JLabel(tr("% of lat:"));122 JLabel labelLon = new JLabel(tr("% of lon:"));123 spinLat = new JSpinner(new SpinnerNumberModel(WMSPlugin.overlapLat, 1, 50, 1));124 spinLon = new JSpinner(new SpinnerNumberModel(WMSPlugin.overlapLon, 1, 50, 1));125 126 JPanel overlapPanel = new JPanel(new FlowLayout());127 overlapPanel.add(overlapCheckBox);128 overlapPanel.add(labelLat);129 overlapPanel.add(spinLat);130 overlapPanel.add(labelLon);131 overlapPanel.add(spinLon);132 133 p.add(overlapPanel);134 115 } 135 116 … … 170 151 171 152 if (change) WMSPlugin.refreshMenu(); 172 173 WMSPlugin.doOverlap = overlapCheckBox.getModel().isSelected();174 WMSPlugin.overlapLat = (Integer) spinLat.getModel().getValue();175 WMSPlugin.overlapLon = (Integer) spinLon.getModel().getValue();176 177 Main.pref.put("wmsplugin.url.overlap", String.valueOf(WMSPlugin.doOverlap));178 Main.pref.put("wmsplugin.url.overlapLat", String.valueOf(WMSPlugin.overlapLat));179 Main.pref.put("wmsplugin.url.overlapLon", String.valueOf(WMSPlugin.overlapLon));180 153 181 154 return false; -
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/YAHOOGrabber.java
r15890 r16290 10 10 import javax.imageio.ImageIO; 11 11 12 import org.openstreetmap.josm.data.Bounds; 12 import org.openstreetmap.josm.data.ProjectionBounds; 13 13 import org.openstreetmap.josm.gui.MapView; 14 14 import org.openstreetmap.josm.io.CacheFiles; … … 18 18 protected String browserCmd; 19 19 20 YAHOOGrabber(Bounds b, GeorefImage image, MapView mv, WMSLayer layer, CacheFiles cache) { 20 YAHOOGrabber(ProjectionBounds b, GeorefImage image, MapView mv, WMSLayer layer, CacheFiles cache) { 21 21 super(b, image, mv, layer, cache); 22 22 this.baseURL = "file:///" + WMSPlugin.getPrefsPath() + "ymap.html?";
Note:
See TracChangeset
for help on using the changeset viewer.
