Ticket #18123: 0001-Add-Yandex-as-a-possible-imagery-source.patch
| File 0001-Add-Yandex-as-a-possible-imagery-source.patch, 13.3 KB (added by , 6 years ago) |
|---|
-
new file images/dialogs/yandex.svg
From af530b015aabd58fb937d2d55338e4f0f22e5400 Mon Sep 17 00:00:00 2001 From: Taylor Smock <taylor.smock@kaartgroup.com> Date: Thu, 5 Sep 2019 14:25:22 -0600 Subject: [PATCH] Add Yandex as a possible imagery source * See https://wiki.openstreetmap.org/wiki/Contributors#Yandex.Panoramas Signed-off-by: Taylor Smock <taylor.smock@kaartgroup.com> --- images/dialogs/yandex.svg | 138 ++++++++++++++++++ .../plugins/osmobjinfo/OSMObjInfoActions.java | 47 +++--- .../plugins/osmobjinfo/OSMObjInfotDialog.java | 17 ++- 3 files changed, 171 insertions(+), 31 deletions(-) create mode 100644 images/dialogs/yandex.svg diff --git a/images/dialogs/yandex.svg b/images/dialogs/yandex.svg new file mode 100644 index 0000000..97e9437
- + 1 <?xml version="1.0" encoding="UTF-8" standalone="no"?> 2 <!-- Created with Inkscape (http://www.inkscape.org/) --> 3 4 <svg 5 xmlns:dc="http://purl.org/dc/elements/1.1/" 6 xmlns:cc="http://creativecommons.org/ns#" 7 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 8 xmlns:svg="http://www.w3.org/2000/svg" 9 xmlns="http://www.w3.org/2000/svg" 10 xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" 11 xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" 12 width="6.5060625mm" 13 height="7.715291mm" 14 viewBox="0 0 6.5060625 7.715291" 15 version="1.1" 16 id="svg8" 17 inkscape:version="0.92.2 5c3e80d, 2017-08-06" 18 sodipodi:docname="yandex.svg"> 19 <defs 20 id="defs2" /> 21 <sodipodi:namedview 22 id="base" 23 pagecolor="#ffffff" 24 bordercolor="#666666" 25 borderopacity="1.0" 26 inkscape:pageopacity="0.0" 27 inkscape:pageshadow="2" 28 inkscape:zoom="5.5546296" 29 inkscape:cx="-4.2959195" 30 inkscape:cy="5.7142445" 31 inkscape:document-units="mm" 32 inkscape:current-layer="layer1" 33 showgrid="false" 34 inkscape:snap-text-baseline="true" 35 inkscape:window-width="1965" 36 inkscape:window-height="1034" 37 inkscape:window-x="1923" 38 inkscape:window-y="0" 39 inkscape:window-maximized="0" /> 40 <metadata 41 id="metadata5"> 42 <rdf:RDF> 43 <cc:Work 44 rdf:about=""> 45 <dc:format>image/svg+xml</dc:format> 46 <dc:type 47 rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> 48 <dc:title></dc:title> 49 </cc:Work> 50 </rdf:RDF> 51 </metadata> 52 <g 53 inkscape:label="Layer 1" 54 inkscape:groupmode="layer" 55 id="layer1" 56 transform="translate(-61.96742,-144.14184)"> 57 <text 58 xml:space="preserve" 59 style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#d40000;fill-opacity:1;stroke:none;stroke-width:0.26458332" 60 x="61.988091" 61 y="151.85713" 62 id="text3701"><tspan 63 sodipodi:role="line" 64 id="tspan3699" 65 x="61.988091" 66 y="151.85713" 67 style="fill:#d40000;stroke-width:0.26458332">Y</tspan></text> 68 </g> 69 </svg> 70 <?xml version="1.0" encoding="UTF-8" standalone="no"?> 71 <!-- Created with Inkscape (http://www.inkscape.org/) --> 72 73 <svg 74 xmlns:dc="http://purl.org/dc/elements/1.1/" 75 xmlns:cc="http://creativecommons.org/ns#" 76 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 77 xmlns:svg="http://www.w3.org/2000/svg" 78 xmlns="http://www.w3.org/2000/svg" 79 xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" 80 xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" 81 width="6.5060625mm" 82 height="7.715291mm" 83 viewBox="0 0 6.5060625 7.715291" 84 version="1.1" 85 id="svg8" 86 inkscape:version="0.92.2 5c3e80d, 2017-08-06" 87 sodipodi:docname="yandex.svg"> 88 <defs 89 id="defs2" /> 90 <sodipodi:namedview 91 id="base" 92 pagecolor="#ffffff" 93 bordercolor="#666666" 94 borderopacity="1.0" 95 inkscape:pageopacity="0.0" 96 inkscape:pageshadow="2" 97 inkscape:zoom="5.5546296" 98 inkscape:cx="-4.2959195" 99 inkscape:cy="5.7142445" 100 inkscape:document-units="mm" 101 inkscape:current-layer="layer1" 102 showgrid="false" 103 inkscape:snap-text-baseline="true" 104 inkscape:window-width="1965" 105 inkscape:window-height="1034" 106 inkscape:window-x="1923" 107 inkscape:window-y="0" 108 inkscape:window-maximized="0" /> 109 <metadata 110 id="metadata5"> 111 <rdf:RDF> 112 <cc:Work 113 rdf:about=""> 114 <dc:format>image/svg+xml</dc:format> 115 <dc:type 116 rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> 117 <dc:title></dc:title> 118 </cc:Work> 119 </rdf:RDF> 120 </metadata> 121 <g 122 inkscape:label="Layer 1" 123 inkscape:groupmode="layer" 124 id="layer1" 125 transform="translate(-61.96742,-144.14184)"> 126 <text 127 xml:space="preserve" 128 style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#d40000;fill-opacity:1;stroke:none;stroke-width:0.26458332" 129 x="61.988091" 130 y="151.85713" 131 id="text3701"><tspan 132 sodipodi:role="line" 133 id="tspan3699" 134 x="61.988091" 135 y="151.85713" 136 style="fill:#d40000;stroke-width:0.26458332">Y</tspan></text> 137 </g> 138 </svg> -
src/org/openstreetmap/josm/plugins/osmobjinfo/OSMObjInfoActions.java
diff --git a/src/org/openstreetmap/josm/plugins/osmobjinfo/OSMObjInfoActions.java b/src/org/openstreetmap/josm/plugins/osmobjinfo/OSMObjInfoActions.java index 89020d4..4bbe239 100644
a b public class OSMObjInfoActions { 26 26 27 27 public static void openinBrowserUser(String user) { 28 28 if (!user.isEmpty()) { 29 String url = "http://www.openstreetmap.org/user/" + user; 30 new Notification(tr("Open in browser " + url)).setIcon(JOptionPane.INFORMATION_MESSAGE).setDuration(Notification.TIME_SHORT).show(); 31 OpenBrowser.displayUrl(url); 29 openInBrowser("http://www.openstreetmap.org/user/".concat(user)); 32 30 } 33 31 34 32 } 35 33 36 34 public static void openinBrowserUserNeis(String user) { 37 35 if (!user.isEmpty()) { 38 String url = "http://hdyc.neis-one.org/?" + user; 39 new Notification(tr("Open in browser " + url)).setIcon(JOptionPane.INFORMATION_MESSAGE).setDuration(Notification.TIME_SHORT).show(); 40 OpenBrowser.displayUrl(url); 36 openInBrowser("http://hdyc.neis-one.org/?".concat(user)); 41 37 } 42 38 } 43 39 44 40 static void openinBrowserUserOsmComments(String user) { 45 41 if (!user.isEmpty()) { 46 String url = "https://www.mapbox.com/osm-comments/#/changesets/?q=users:" + user; 47 new Notification(tr("Open in browser " + url)).setIcon(JOptionPane.INFORMATION_MESSAGE).setDuration(Notification.TIME_SHORT).show(); 48 OpenBrowser.displayUrl(url); 42 openInBrowser( "https://www.mapbox.com/osm-comments/#/changesets/?q=users:".concat(user)); 49 43 } 50 44 } 51 45 … … public class OSMObjInfoActions { 61 55 62 56 public static void openinBrowserChangeset(String idChangeset) { 63 57 if (!idChangeset.isEmpty()) { 64 String url = "https://www.openstreetmap.org/changeset/" + idChangeset; 65 new Notification(tr("Open in browser " + url)).setIcon(JOptionPane.INFORMATION_MESSAGE).setDuration(Notification.TIME_SHORT).show(); 66 OpenBrowser.displayUrl(url); 58 openInBrowser("https://www.openstreetmap.org/changeset/".concat(idChangeset)); 67 59 } 68 60 } 69 61 70 62 public static void openinBrowserChangesetMap(String idChangeset) { 71 63 if (!idChangeset.isEmpty()) { 72 String url = "https://osmcha.mapbox.com/" + idChangeset; 73 new Notification(tr("Open in browser " + url)).setIcon(JOptionPane.INFORMATION_MESSAGE).setDuration(Notification.TIME_SHORT).show(); 74 OpenBrowser.displayUrl(url); 64 openInBrowser("https://osmcha.mapbox.com/".concat(idChangeset)); 75 65 } 76 66 } 77 67 … … public class OSMObjInfoActions { 87 77 88 78 public static void openinBrowserIdobj(String typeObj, String idobj) { 89 79 if (typeObj != null && !idobj.isEmpty()) { 90 String url = "https://www.openstreetmap.org/" + typeObj + "/" + idobj; 91 new Notification(tr("Open in browser " + url)).setIcon(JOptionPane.INFORMATION_MESSAGE).setDuration(Notification.TIME_SHORT).show(); 92 OpenBrowser.displayUrl(url); 80 openInBrowser("https://www.openstreetmap.org/" + typeObj + "/" + idobj); 93 81 } 94 82 } 95 83 96 84 public static void openinBrowserIdobjOsmDeepHistory(String typeObj, String idobj) { 97 85 if (typeObj != null && !idobj.isEmpty()) { 98 String url = "http://osmlab.github.io/osm-deep-history/#/" + typeObj + "/" + idobj; 99 new Notification(tr("Open in browser " + url)).setIcon(JOptionPane.INFORMATION_MESSAGE).setDuration(Notification.TIME_SHORT).show(); 100 OpenBrowser.displayUrl(url); 86 openInBrowser("http://osmlab.github.io/osm-deep-history/#/" + typeObj + "/" + idobj); 101 87 } 102 88 } 103 89 104 90 public static void openinBrowserMapillary(String coords) { 105 91 if (coords == null || coords.isEmpty()) return; 106 92 String[] arrCoords = coords.split(","); 107 String url = "https://www.mapillary.com/app/?lat=" + arrCoords[0] + "&lng=" + arrCoords[1] + "&z=20&focus=map&dateFrom=2017-01-01"; 108 new Notification(tr("Open in browser " + url)).setIcon(JOptionPane.INFORMATION_MESSAGE).setDuration(Notification.TIME_SHORT).show(); 109 OpenBrowser.displayUrl(url); 110 93 openInBrowser("https://www.mapillary.com/app/?lat=" + arrCoords[0] + "&lng=" + arrCoords[1] + "&z=20&focus=map&dateFrom=2017-01-01"); 111 94 } 112 95 113 96 public static void openinBrowserOpenstreetcam(String coords) { 114 97 if (coords == null || coords.isEmpty()) return; 115 98 String[] arrCoords = coords.split(","); 116 String url = "http://openstreetcam.org/map/@" + arrCoords[0] + "," + arrCoords[1] + ",18z"; 117 new Notification(tr("Open in browser " + url)).setIcon(JOptionPane.INFORMATION_MESSAGE).setDuration(Notification.TIME_SHORT).show(); 118 OpenBrowser.displayUrl(url); 99 openInBrowser("http://openstreetcam.org/map/@" + arrCoords[0] + "," + arrCoords[1] + ",18z"); 119 100 } 120 101 102 public static void openInBrowserYandex(String coords) { 103 if (coords == null || coords.isEmpty()) return; 104 String[] arrCoords = coords.split(","); 105 openInBrowser("https://yandex.com/maps/?l=stv,sta&ll=" + arrCoords[1] + "," + arrCoords[0] + "&z=18"); 106 } 107 108 private static void openInBrowser(String url) { 109 new Notification(tr("Open in browser {0}", url)).setIcon(JOptionPane.INFORMATION_MESSAGE).setDuration(Notification.TIME_SHORT).show(); 110 OpenBrowser.displayUrl(url); 111 } 121 112 } -
src/org/openstreetmap/josm/plugins/osmobjinfo/OSMObjInfotDialog.java
diff --git a/src/org/openstreetmap/josm/plugins/osmobjinfo/OSMObjInfotDialog.java b/src/org/openstreetmap/josm/plugins/osmobjinfo/OSMObjInfotDialog.java index 8da1d88..67395bc 100644
a b public class OSMObjInfotDialog extends ToggleDialog { 44 44 protected JLabel lbLinnkIdobj; 45 45 protected JLabel lbLinkMapillary; 46 46 protected JLabel lbLinkOSMcamp; 47 protected JLabel lbLinkYandex; 47 48 protected JLabel lbLinkIdChangeset; 48 49 protected JLabel lbCopyUser; 49 50 protected JLabel lbCopyIdobj; … … public class OSMObjInfotDialog extends ToggleDialog { 346 347 private JPanel MapillaryImages() { 347 348 JPanel jpIMapillary = new JPanel(new BorderLayout()); 348 349 lbMapillary = new JLabel(); 349 lbLinkMapillary = new JLabel(ImageProvider.get("dialogs", "mapillary.png")); 350 lbLinkOSMcamp = new JLabel(ImageProvider.get("dialogs", "openstreetcam.png")); 350 lbLinkMapillary = new JLabel(ImageProvider.get("dialogs", "mapillary")); 351 lbLinkOSMcamp = new JLabel(ImageProvider.get("dialogs", "openstreetcam")); 352 // TODO replace with real image 353 lbLinkYandex = new JLabel(ImageProvider.get("dialogs", "yandex")); 351 354 lbLinkMapillary.setCursor(new Cursor(Cursor.HAND_CURSOR)); 352 355 lbLinkOSMcamp.setCursor(new Cursor(Cursor.HAND_CURSOR)); 356 lbLinkYandex.setCursor(new Cursor(Cursor.HAND_CURSOR)); 353 357 JPanel jpIMapillaryOptions = new JPanel(new GridLayout(1, 2, 5, 5)); 354 358 jpIMapillaryOptions.add(lbLinkMapillary); 355 359 jpIMapillaryOptions.add(lbLinkOSMcamp); 360 jpIMapillaryOptions.add(lbLinkYandex); 356 361 //add 357 362 jpIMapillary.add(lbMapillary, BorderLayout.LINE_START); 358 363 jpIMapillary.add(jpIMapillaryOptions, BorderLayout.LINE_END); 359 //id obj actions 364 //id obj actions 360 365 lbLinkMapillary.addMouseListener(new MouseAdapter() { 361 366 @Override 362 367 public void mouseClicked(MouseEvent e) { … … public class OSMObjInfotDialog extends ToggleDialog { 369 374 OSMObjInfoActions.openinBrowserOpenstreetcam(lbMapillary.getText()); 370 375 } 371 376 }); 377 lbLinkYandex.addMouseListener(new MouseAdapter() { 378 @Override 379 public void mouseClicked(MouseEvent e) { 380 OSMObjInfoActions.openInBrowserYandex(lbMapillary.getText()); 381 } 382 }); 372 383 return jpIMapillary; 373 384 } 374 385 }
