Changeset 30466 in osm for applications
- Timestamp:
- 2014-05-21T22:41:44+02:00 (11 years ago)
- Location:
- applications/editors/josm/plugins/pointInfo
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/pointInfo/build.xml
r30416 r30466 3 3 4 4 <!-- enter the SVN commit message --> 5 <property name="commit.message" value="PointInfo: Add more external links, nicer icons."/>5 <property name="commit.message" value="PointInfo: Add support for ghost buildings."/> 6 6 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 7 7 <property name="plugin.main.version" value="7001"/> -
applications/editors/josm/plugins/pointInfo/po/cs.po
r30328 r30466 7 7 "Project-Id-Version: \n" 8 8 "Report-Msgid-Bugs-To: \n" 9 "POT-Creation-Date: 2014-0 3-19 20:18+0100\n"9 "POT-Creation-Date: 2014-05-14 20:25+0200\n" 10 10 "PO-Revision-Date: 2014-02-09 22:48+0100\n" 11 11 "Last-Translator: Marian Kyral <mkyral@email.cz>\n" … … 18 18 "X-Generator: Lokalize 1.5\n" 19 19 20 #: ../src/org/openstreetmap/josm/plugins/pointinfo/PointInfoAction.java:7 120 #: ../src/org/openstreetmap/josm/plugins/pointinfo/PointInfoAction.java:74 21 21 msgid "Point info" 22 22 msgstr "Informace o bodu" 23 23 24 #: ../src/org/openstreetmap/josm/plugins/pointinfo/PointInfoAction.java:7 124 #: ../src/org/openstreetmap/josm/plugins/pointinfo/PointInfoAction.java:74 25 25 msgid "Point info." 26 26 msgstr "Informace o bodu." 27 27 28 #: ../src/org/openstreetmap/josm/plugins/pointinfo/PointInfoAction.java:7 128 #: ../src/org/openstreetmap/josm/plugins/pointinfo/PointInfoAction.java:74 29 29 #, java-format 30 30 msgid "Tool: {0}" 31 31 msgstr "Nástroje: {0}" 32 32 33 #: ../src/org/openstreetmap/josm/plugins/pointinfo/PointInfoAction.java:1 1833 #: ../src/org/openstreetmap/josm/plugins/pointinfo/PointInfoAction.java:107 34 34 msgid "Connecting server" 35 35 msgstr "Připojuji se na server" 36 36 37 #: ../src/org/openstreetmap/josm/plugins/pointinfo/PointInfoAction.java:156 37 #: ../src/org/openstreetmap/josm/plugins/pointinfo/PointInfoAction.java:148 38 msgid "Data not available." 39 msgstr "Data nejsou dostupná." 40 41 #: ../src/org/openstreetmap/josm/plugins/pointinfo/PointInfoAction.java:249 38 42 msgid "PointInfo" 39 43 msgstr "Informace o bodu" 40 44 41 #: ../src/org/openstreetmap/josm/plugins/pointinfo/PointInfoAction.java:185 42 msgid "Data not available." 43 msgstr "Data nejsou dostupná." 44 45 #: ../src/org/openstreetmap/josm/plugins/pointinfo/ruianModule.java:835 45 #: ../src/org/openstreetmap/josm/plugins/pointinfo/ruianModule.java:1088 46 46 msgid "Add new address point" 47 47 msgstr "Přidán nový adresní bod" 48 48 49 #: ../src/org/openstreetmap/josm/plugins/pointinfo/ruianModule.java: 85749 #: ../src/org/openstreetmap/josm/plugins/pointinfo/ruianModule.java:1110 50 50 msgid "Tags copied to clipboard." 51 51 msgstr "Tagy byly zkopírovány do schránky." 52 52 53 #: ../src/org/openstreetmap/josm/plugins/pointinfo/ruianModule.java: 86553 #: ../src/org/openstreetmap/josm/plugins/pointinfo/ruianModule.java:1118 54 54 msgid "New address point added." 55 55 msgstr "Adresní bod byl přidán." -
applications/editors/josm/plugins/pointInfo/po/pointInfo.po
r30328 r30466 9 9 "Project-Id-Version: PACKAGE VERSION\n" 10 10 "Report-Msgid-Bugs-To: \n" 11 "POT-Creation-Date: 2014-0 3-19 20:18+0100\n"11 "POT-Creation-Date: 2014-05-20 07:17+0200\n" 12 12 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 13 13 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 18 18 "Content-Transfer-Encoding: 8bit\n" 19 19 20 #: ../src/org/openstreetmap/josm/plugins/pointinfo/PointInfoAction.java:7 120 #: ../src/org/openstreetmap/josm/plugins/pointinfo/PointInfoAction.java:74 21 21 msgid "Point info" 22 22 msgstr "" 23 23 24 #: ../src/org/openstreetmap/josm/plugins/pointinfo/PointInfoAction.java:7 124 #: ../src/org/openstreetmap/josm/plugins/pointinfo/PointInfoAction.java:74 25 25 msgid "Point info." 26 26 msgstr "" 27 27 28 #: ../src/org/openstreetmap/josm/plugins/pointinfo/PointInfoAction.java:7 128 #: ../src/org/openstreetmap/josm/plugins/pointinfo/PointInfoAction.java:74 29 29 #, java-format 30 30 msgid "Tool: {0}" 31 31 msgstr "" 32 32 33 #: ../src/org/openstreetmap/josm/plugins/pointinfo/PointInfoAction.java:1 1833 #: ../src/org/openstreetmap/josm/plugins/pointinfo/PointInfoAction.java:107 34 34 msgid "Connecting server" 35 35 msgstr "" 36 36 37 #: ../src/org/openstreetmap/josm/plugins/pointinfo/PointInfoAction.java:156 37 #: ../src/org/openstreetmap/josm/plugins/pointinfo/PointInfoAction.java:148 38 msgid "Data not available." 39 msgstr "" 40 41 #: ../src/org/openstreetmap/josm/plugins/pointinfo/PointInfoAction.java:249 38 42 msgid "PointInfo" 39 43 msgstr "" 40 44 41 #: ../src/org/openstreetmap/josm/plugins/pointinfo/PointInfoAction.java:185 42 msgid "Data not available." 43 msgstr "" 44 45 #: ../src/org/openstreetmap/josm/plugins/pointinfo/ruianModule.java:835 45 #: ../src/org/openstreetmap/josm/plugins/pointinfo/ruianModule.java:1088 46 46 msgid "Add new address point" 47 47 msgstr "" 48 48 49 #: ../src/org/openstreetmap/josm/plugins/pointinfo/ruianModule.java: 85749 #: ../src/org/openstreetmap/josm/plugins/pointinfo/ruianModule.java:1110 50 50 msgid "Tags copied to clipboard." 51 51 msgstr "" 52 52 53 #: ../src/org/openstreetmap/josm/plugins/pointinfo/ruianModule.java: 86553 #: ../src/org/openstreetmap/josm/plugins/pointinfo/ruianModule.java:1118 54 54 msgid "New address point added." 55 55 msgstr "" -
applications/editors/josm/plugins/pointInfo/servers/RUIAN/index.php
r30373 r30466 4 4 $lon=$_REQUEST['lon']; 5 5 if ( !is_numeric($lat) or !is_numeric($lon) ) die; 6 7 8 // From: http://www.sitepoint.com/forums/showthread.php?656315-Adding-Distance-To-GPS-Coordinates-To-Get-Bounding-Box&p=4519646&viewfull=1#post4519646 9 function new_coords($lat, $lon, $bearing, $distance) 10 { 11 // Radius of Earth in meters 12 $radius = 6371000; 13 14 // New latitude in degrees. 15 $new_lat = rad2deg(asin(sin(deg2rad($lat)) * cos($distance / $radius) + cos(deg2rad($lat)) * sin($distance / $radius) * cos(deg2rad($bearing)))); 16 17 // New longitude in degrees. 18 $new_lon = rad2deg(deg2rad($lon) + atan2(sin(deg2rad($bearing)) * sin($distance / $radius) * cos(deg2rad($lat)), cos($distance / $radius) - sin(deg2rad($lat)) * sin(deg2rad($new_lat)))); 19 20 // Assign new latitude and longitude to an array to be returned to the caller. 21 $coord['lat'] = $new_lat; 22 $coord['lon'] = $new_lon; 23 24 return $coord; 25 } 26 27 // Boundary box 20x20 meters around the point 28 $x1_coor = new_coords($lat, $lon, 315, 10); // Left upper point 29 $x2_coor = new_coords($lat, $lon, 135, 10); // Right down point 30 31 $x1_lon = $x1_coor['lon']; 32 $x2_lon = $x2_coor['lon']; 33 $x1_lat = $x1_coor['lat']; 34 $x2_lat = $x2_coor['lat'];; 35 36 $boundary_polygon=($x1_lon) . " " . ($x1_lat) . ", " . ($x1_lon) . " " . ($x2_lat) . ", " . ($x2_lon) . " " . ($x2_lat) . ", " . ($x2_lon) . " " . ($x1_lat) . ", " . ($x1_lon) . " " . ($x1_lat); 37 6 38 header('Content-Type: application/json'); 7 39 … … 43 75 } else 44 76 $data["stavebni_objekt"] = array(); 77 78 // Ghosts: Buildings without geometry in close neighbourhood 79 $query=" 80 select * from ( 81 select s.kod, 82 s.pocet_podlazi, a.nazev zpusob_vyuziti, s.plati_od, s.pocet_bytu, s.dokonceni, 83 s.zpusob_vyuziti_kod, a.osmtag_k, a.osmtag_v, 84 s.definicni_bod, 85 st_distance( (st_transform(s.definicni_bod,4326))::geography, (st_setsrid(st_makepoint(".$lon.",".$lat."),4326))::geography ) dist 86 from rn_stavebni_objekt s 87 left outer join osmtables.zpusob_vyuziti_objektu a on s.zpusob_vyuziti_kod = a.kod 88 where st_intersects(s.definicni_bod, st_transform(st_geometryfromtext( 89 'POLYGON (( $boundary_polygon ))' ,4326),900913)) 90 and not s.deleted 91 and s.hranice is null 92 order by definicni_bod <-> 93 st_transform(st_setsrid(st_makepoint(".$lon.",".$lat."),4326),900913) 94 limit 5) as x 95 order by dist; 96 "; 97 $result=pg_query($CONNECT,$query); 98 99 if (pg_num_rows($result) > 0) 100 { 101 $so = array(); 102 for ($i = 0; $i < pg_num_rows($result); $i++) 103 { 104 $row = pg_fetch_array($result, $i); 105 array_push($so, 106 array( "ruian_id" => $row["kod"], 107 "pocet_podlazi" => $row["pocet_podlazi"], 108 "zpusob_vyuziti" => $row["zpusob_vyuziti"], 109 "zpusob_vyuziti_kod" => $row["zpusob_vyuziti_kod"], 110 "zpusob_vyuziti_key" => $row["osmtag_k"], 111 "zpusob_vyuziti_val" => $row["osmtag_v"], 112 "pocet_bytu" => $row["pocet_bytu"], 113 "dokonceni" => $row["dokonceni"], 114 "plati_od" => $row["plati_od"], 115 "vzdalenost" => $row["dist"] 116 )); 117 } 118 $data["so_bez_geometrie"] = $so; 119 } else 120 $data["so_bez_geometrie"] = array(); 45 121 46 122 // Addresses … … 136 212 am.adrp_psc psc, ul.nazev ulice, c.nazev cast_obce, 137 213 momc.nazev mestska_cast, 138 ob.nazev obec, ok.nazev okres, vu.nazev kraj 214 ob.nazev obec, ok.nazev okres, vu.nazev kraj, 215 st_distance( (st_transform(am.definicni_bod,4326))::geography, (st_setsrid(st_makepoint(".$lon.", ".$lat."),4326))::geography ) dist 139 216 from ( select kod, stavobj_kod, 140 217 cislo_domovni, cislo_orientacni_hodnota, cislo_orientacni_pismeno, … … 155 232 left outer join rn_vusc vu on ok.vusc_kod = vu.kod and not vu.deleted 156 233 where st_distance( (st_transform(am.definicni_bod,4326))::geography, (st_setsrid(st_makepoint(".$lon.", ".$lat."),4326))::geography ) < 100 157 order by st_distance( (st_transform(am.definicni_bod,4326))::geography, 158 (st_setsrid(st_makepoint(".$lon.", ".$lat."),4326))::geography) 234 order by dist 159 235 limit 5 160 236 ; … … 183 259 "okres" => $row["okres"], 184 260 "kraj" => $row["kraj"], 185 "psc" => $row["psc"] 261 "psc" => $row["psc"], 262 "vzdalenost" => $row["dist"] 186 263 )); 187 264 } -
applications/editors/josm/plugins/pointInfo/src/org/openstreetmap/josm/plugins/pointinfo/PointInfoAction.java
r30372 r30466 103 103 @Override 104 104 protected void realRun() throws SAXException { 105 infoSync(pos, progressMonitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false));105 infoSync(pos, progressMonitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, true)); 106 106 } 107 107 -
applications/editors/josm/plugins/pointInfo/src/org/openstreetmap/josm/plugins/pointinfo/ruianModule.java
r30373 r30466 37 37 import java.io.InputStream; 38 38 import java.io.ByteArrayInputStream; 39 40 import java.text.DecimalFormat; 41 import java.text.DecimalFormatSymbols; 39 42 40 43 import javax.json.Json; … … 74 77 private String m_kraj; 75 78 private String m_psc; 79 private float m_vzdalenost; 76 80 77 81 public addrPlaces () { … … 99 103 m_kraj = ""; 100 104 m_psc = ""; 105 m_vzdalenost = 0; 101 106 } 102 107 … … 177 182 } 178 183 184 public void setVzdalenost (float v) { 185 m_vzdalenost = v; 186 } 187 179 188 public long getRuianID () { 180 189 return m_ruian_id; … … 253 262 } 254 263 264 public String getVzdalenost () { 265 DecimalFormat df = new DecimalFormat("0.00"); 266 return df.format(m_vzdalenost) + "m"; 267 } 268 269 } 270 271 class objectWithoutGeometry { 272 private long m_ruian_id; 273 private int m_podlazi; 274 private int m_byty; 275 private String m_zpusob_vyuziti; 276 private String m_zpusob_vyuziti_kod; 277 private String m_zpusob_vyuziti_key; 278 private String m_zpusob_vyuziti_val; 279 private String m_dokonceni; 280 private String m_plati_od; 281 private float m_vzdalenost; 282 283 public objectWithoutGeometry () { 284 init(); 285 } 286 287 private void init () { 288 m_ruian_id = 0; 289 m_podlazi = 0; 290 m_byty = 0; 291 m_zpusob_vyuziti = ""; 292 m_zpusob_vyuziti_kod = ""; 293 m_zpusob_vyuziti_key = ""; 294 m_zpusob_vyuziti_val = ""; 295 m_dokonceni = ""; 296 m_plati_od = ""; 297 m_vzdalenost = 0; 298 } 299 300 public void setRuianID (long v) { 301 m_ruian_id = v; 302 } 303 304 public void setPodlazi (int v) { 305 m_podlazi = v; 306 } 307 308 public void setByty (int v) { 309 m_byty = v; 310 } 311 312 public void setZpusobVyuziti (String v) { 313 m_zpusob_vyuziti = v; 314 } 315 316 public void setZpusobVyuzitiKod (String v) { 317 m_zpusob_vyuziti_kod = v; 318 } 319 320 public void setZpusobVyuzitiKey (String v) { 321 m_zpusob_vyuziti_key = v; 322 } 323 324 public void setZpusobVyuzitiVal (String v) { 325 m_zpusob_vyuziti_val = v; 326 } 327 328 public void setDokonceni (String v) { 329 m_dokonceni = v; 330 } 331 332 public void setPlatiOd (String v) { 333 m_plati_od = v; 334 } 335 336 public void setVzdalenost (float v) { 337 m_vzdalenost = v; 338 } 339 340 public long getRuianID () { 341 return m_ruian_id; 342 } 343 344 public int getPodlazi () { 345 return m_podlazi; 346 } 347 348 public int getByty () { 349 return m_byty; 350 } 351 352 public String getZpusobVyuziti () { 353 return m_zpusob_vyuziti; 354 } 355 356 public String getZpusobVyuzitiKod () { 357 return m_zpusob_vyuziti_kod; 358 } 359 360 public String getZpusobVyuzitiKey () { 361 return m_zpusob_vyuziti_key; 362 } 363 364 public String getZpusobVyuzitiVal () { 365 return m_zpusob_vyuziti_val; 366 } 367 368 public String getDokonceni () { 369 return m_dokonceni; 370 } 371 372 public String getPlatiOd () { 373 return m_plati_od; 374 } 375 376 public String getVzdalenost () { 377 DecimalFormat df = new DecimalFormat("0.00"); 378 return df.format(m_vzdalenost) + "m"; 379 } 255 380 } 256 381 … … 275 400 private String m_objekt_plati_od; 276 401 402 private ArrayList <objectWithoutGeometry> m_so_bez_geometrie; 403 277 404 private ArrayList <addrPlaces> m_adresni_mista; 278 405 … … 323 450 m_objekt_plati_od = ""; 324 451 452 m_so_bez_geometrie = new ArrayList<objectWithoutGeometry> (); 325 453 m_adresni_mista = new ArrayList<addrPlaces> (); 326 454 … … 446 574 // ========================================================================= 447 575 try { 576 JsonArray arr = obj.getJsonArray("so_bez_geometrie"); 577 578 for(int i = 0; i < arr.size(); i++) 579 { 580 JsonObject soBezGeom = arr.getJsonObject(i); 581 objectWithoutGeometry so = new objectWithoutGeometry(); 582 583 try { 584 so.setRuianID(Long.parseLong(soBezGeom.getString("ruian_id"))); 585 } catch (Exception e) { 586 System.out.println("so_bez_geometrie.ruian_id: " + e.getMessage()); 587 } 588 589 try { 590 so.setPodlazi(Integer.parseInt(soBezGeom.getString("pocet_podlazi"))); 591 } catch (Exception e) { 592 System.out.println("so_bez_geometrie.pocet_podlazi: " + e.getMessage()); 593 } 594 595 try { 596 so.setByty(Integer.parseInt(soBezGeom.getString("pocet_bytu"))); 597 } catch (Exception e) { 598 System.out.println("so_bez_geometrie.pocet_bytu: " + e.getMessage()); 599 } 600 601 try { 602 so.setZpusobVyuziti(soBezGeom.getString("zpusob_vyuziti")); 603 } catch (Exception e) { 604 System.out.println("so_bez_geometrie.zpusob_vyuziti: " + e.getMessage()); 605 } 606 607 try { 608 so.setZpusobVyuzitiKod(soBezGeom.getString("zpusob_vyuziti_kod")); 609 } catch (Exception e) { 610 System.out.println("so_bez_geometrie.zpusob_vyuziti_kod: " + e.getMessage()); 611 } 612 613 try { 614 so.setZpusobVyuzitiKey(soBezGeom.getString("zpusob_vyuziti_key")); 615 } catch (Exception e) { 616 System.out.println("so_bez_geometrie.zpusob_vyuziti_key: " + e.getMessage()); 617 } 618 619 try { 620 so.setZpusobVyuzitiVal(soBezGeom.getString("zpusob_vyuziti_val")); 621 } catch (Exception e) { 622 System.out.println("so_bez_geometrie.zpusob_vyuziti_val: " + e.getMessage()); 623 } 624 625 try { 626 so.setDokonceni(soBezGeom.getString("dokonceni")); 627 } catch (Exception e) { 628 System.out.println("so_bez_geometrie.dokonceni: " + e.getMessage()); 629 } 630 631 try { 632 so.setPlatiOd(soBezGeom.getString("plati_od")); 633 } catch (Exception e) { 634 System.out.println("so_bez_geometrie.plati_od: " + e.getMessage()); 635 } 636 637 try { 638 so.setVzdalenost(Float.parseFloat(soBezGeom.getString("vzdalenost"))); 639 } catch (Exception e) { 640 System.out.println("so_bez_geometrie.vzdalenost: " + e.getMessage()); 641 } 642 643 m_so_bez_geometrie.add(so); 644 } 645 } catch (Exception e) { 646 System.out.println("so_bez_geometrie: " + e.getMessage()); 647 } 648 649 // ========================================================================= 650 try { 448 651 JsonArray arr = obj.getJsonArray("adresni_mista"); 449 652 … … 569 772 } catch (Exception e) { 570 773 System.out.println("adresni_mista.psc: " + e.getMessage()); 774 } 775 776 try { 777 am.setVzdalenost(Float.parseFloat(adresniMisto.getString("vzdalenost"))); 778 } catch (Exception e) { 779 System.out.println("adresni_mista.vzdalenost: " + e.getMessage()); 571 780 } 572 781 … … 879 1088 r.append("<tr><td bgcolor=#e5e5ff>"); 880 1089 if (!m_adresni_mista.get(i).getUlice().isEmpty()) { 1090 r.append(m_adresni_mista.get(i).getVzdalenost()); 1091 r.append("</td><td valign=\"top\" bgcolor=#e5e5ff>"); 881 1092 r.append(m_adresni_mista.get(i).getUlice() + " " + x); 882 1093 r.append("<br/><u>" + m_adresni_mista.get(i).getObec() + "</u>"); … … 887 1098 r.append(" <a href=file://tags.create-on-place/address:"+i+">"+ icon_create_addr_ruian +"</a>"); 888 1099 } else { 1100 r.append(m_adresni_mista.get(i).getVzdalenost()); 1101 r.append("</td><td valign=\"top\" bgcolor=#e5e5ff>"); 889 1102 r.append(m_adresni_mista.get(i).getCastObce() + " " + x + " "); 890 1103 if (!m_adresni_mista.get(i).getCastObce().equals(m_adresni_mista.get(i).getObec())) { … … 901 1114 r.append("</table><br/>"); 902 1115 } 1116 1117 if (m_so_bez_geometrie.size() > 0) { 1118 r.append("<i><u>Budovy bez geometrie v okolí</u></i><br/>"); 1119 r.append("<table>"); 1120 for (int i=0; i<m_so_bez_geometrie.size(); i++) { 1121 r.append("<tr><td bgcolor=#e5e5ff>"); 1122 r.append(m_so_bez_geometrie.get(i).getVzdalenost()); 1123 r.append("</td><td valign=\"top\" bgcolor=#e5e5ff>"); 1124 r.append(m_so_bez_geometrie.get(i).getRuianID()); 1125 if (m_so_bez_geometrie.get(i).getZpusobVyuziti().length() > 0) { 1126 r.append(" - " + m_so_bez_geometrie.get(i).getZpusobVyuziti()); 1127 } 1128 r.append("</td><td valign=\"top\" bgcolor=#e5e5ff>"); 1129 r.append(" <a href="+ url_stavebni_objekt + m_so_bez_geometrie.get(i).getRuianID() + ">"+ icon_ext_link +"</a> "); 1130 r.append(" <a href=file://tags.copy/building>"+ icon_copy_tags +"</a></br>"); 1131 r.append("</td></tr>"); 1132 } 1133 r.append("</table><br/>"); 1134 r.append("<br/>"); 1135 } 1136 903 1137 r.append("<hr/>"); 904 1138 r.append("<center><i><small>Zdroj: <a href=\"http://www.ruian.cz/\">" + m_source + "</a></small></i></center>"); … … 1130 1364 1131 1365 private String m_text = ""; 1132 private String URL = "http://josm.poloha.net/pointInfo/v 2/index.php";1366 private String URL = "http://josm.poloha.net/pointInfo/v3/index.php"; 1133 1367 protected PointInfoServer server = new PointInfoServer(); 1134 1368
Note:
See TracChangeset
for help on using the changeset viewer.