Changeset 16417 in osm for applications/editors/josm/plugins
- Timestamp:
- 2009-07-09T22:00:22+02:00 (15 years ago)
- Location:
- applications/editors/josm/plugins/czechaddress
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/czechaddress/nbproject/project.xml
r15558 r16417 31 31 <ide-actions> 32 32 <action name="build"> 33 <target> compile</target>33 <target>dist</target> 34 34 </action> 35 35 <action name="clean"> … … 44 44 <action name="rebuild"> 45 45 <target>clean</target> 46 <target> compile</target>46 <target>dist</target> 47 47 </action> 48 48 </ide-actions> -
applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/StringUtils.java
r15763 r16417 62 62 s1 = anglicize(s1); 63 63 s2 = anglicize(s2); 64 64 65 List<Integer> beg1 = new ArrayList<Integer>(4); 65 66 List<Integer> beg2 = new ArrayList<Integer>(4); … … 114 115 * others lower-case). Czech grammar rules are more or less obeyed. 115 116 * 116 * <p><b>TODO:</b> This should be moved somewhere else.</p>117 *118 117 * @param s string to be capitalized 119 118 * @return capitaized string … … 135 134 last = charr[i] = ch; 136 135 } 136 String result = String.valueOf(charr); 137 138 result = result.replaceAll("Nábř. ", "nábřeží "); 139 result = result.replaceAll("Ul. ", "ulice "); 140 result = result.replaceAll("Nám. ", "náměstí "); 141 result = result.replaceAll("Kpt. ", "kapitána "); 142 result = result.replaceAll("Bří. ", "bratří "); 137 143 138 144 String[] noCapitalize = { "Nad", "Pod", "U", "Na", "Z" }; 139 String result = String.valueOf(charr);140 141 145 for (String noc : noCapitalize) 142 146 result = result.replaceAll(" "+noc+" ", " "+noc.toLowerCase()+" "); 143 return result; 147 148 149 String[] mesice = {"Ledna", "Února", "Března", "Dubna", "Května", 150 "Máje", "Června", "Července", "Srpna", "Září", "Října", 151 "Listopadu", "Prosince"}; 152 for (String mesic : mesice) 153 result = result.replaceAll("."+mesic, ". " + mesic.toLowerCase()); 154 155 156 String[] noBegCap = {"Třída", "Ulice", "Náměstí", "Nábřeží"}; 157 for (String noc : noBegCap) 158 result = result.replaceAll(noc, noc.toLowerCase()); 159 160 return result.replaceAll(" ", " "); 144 161 } 145 162 -
applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/AddressElement.java
r16290 r16417 101 101 result += " " + StringUtils.latLonToString(((Way) prim).firstNode().getCoor()); 102 102 103 if (prim.deleted) 104 result += " DEL"; 105 103 106 return result; 104 107 } -
applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/LocationSelector.java
r16290 r16417 17 17 import org.openstreetmap.josm.plugins.czechaddress.addressdatabase.Region; 18 18 import org.openstreetmap.josm.Main; 19 import org.openstreetmap.josm.data.Bounds;20 19 import org.openstreetmap.josm.data.coor.LatLon; 21 20 import org.openstreetmap.josm.data.osm.Node; … … 61 60 Database.getInstance().regions.toArray())); 62 61 63 autodetectLocation(); 62 try { 63 autodetectLocation(); 64 } catch (Exception e) {} 64 65 oblastComboBoxItemStateChanged(null); 65 66 } -
applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/ManagerDialog.java
r15649 r16417 327 327 328 328 private void dbTreeValueChanged(javax.swing.event.TreeSelectionEvent evt) {//GEN-FIRST:event_dbTreeValueChanged 329 dbTreeValue = (AddressElement) dbTree.getSelectionPath().getLastPathComponent(); 329 try { 330 dbTreeValue = (AddressElement) dbTree.getSelectionPath().getLastPathComponent(); 331 } catch (NullPointerException except) { 332 dbTreeValue = null; 333 System.err.println("Strange exception has occured."+ 334 " If you find a way to reproduce it, please report a bug!"); 335 except.printStackTrace(); 336 } 330 337 dbEditButton.setEnabled( EditorFactory.isEditable(dbTreeValue) ); 331 338 }//GEN-LAST:event_dbTreeValueChanged -
applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/PointManipulatorDialog.java
r15649 r16417 90 90 if (getValue() == 1) { 91 91 92 if (updateMatchesTimer .isRunning()) {92 if (updateMatchesTimer != null && updateMatchesTimer.isRunning()) { 93 93 updateMatchesTimer.stop(); 94 94 updateMatches(); … … 135 135 Map<String,String> backup = prim.keys; 136 136 r.openTransaction(); 137 for (AddressElement elem : r.getCandidates(prim)) 138 r.unOverwrite(prim, elem); 137 139 prim.keys = null; 138 140 prim.put(PrimUtils.KEY_ADDR_CP, alternateNumberEdit.getText()); -
applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/intelligence/Reasoner.java
r15763 r16417 541 541 */ 542 542 public AddressElement getStrictlyBest(OsmPrimitive prim) { 543 544 if (!transactionOpened) 545 return primBestIndex.get(prim); 546 547 Map<AddressElement, Integer> matches = primMatchIndex.get(prim); 548 if (matches == null) return null; 549 AddressElement bestE = null; 550 int bestQ = MATCH_NOMATCH; 551 552 for (AddressElement elem : matches.keySet()) { 553 if (matches.get(elem) == bestQ) 554 bestE = null; 555 556 if (matches.get(elem) > bestQ) { 557 bestQ = matches.get(elem); 558 bestE = elem; 543 544 AddressElement result = null; 545 try { 546 if (!transactionOpened) 547 return primBestIndex.get(prim); 548 549 Map<AddressElement, Integer> matches = primMatchIndex.get(prim); 550 if (matches == null) { 551 return null; 559 552 } 560 } 561 562 return bestE; 553 554 int bestQ = MATCH_NOMATCH; 555 for (AddressElement elem : matches.keySet()) { 556 if (matches.get(elem) == bestQ) 557 result = null; 558 559 if (matches.get(elem) > bestQ) { 560 bestQ = matches.get(elem); 561 result = elem; 562 } 563 } 564 565 } catch (NullPointerException except) { 566 System.err.println("Strange exception occured." + 567 " If you find a way to reproduce this situation, please "+ 568 "e-mail the author of the CzechAddress plugin."); 569 except.printStackTrace(); 570 } 571 return result; 563 572 } 564 573 … … 582 591 public OsmPrimitive getStrictlyBest(AddressElement elem) { 583 592 584 if (!transactionOpened) 585 return elemBestIndex.get(elem); 586 587 Map<OsmPrimitive, Integer> matches = elemMatchIndex.get(elem); 588 if (matches == null) return null; 589 OsmPrimitive bestE = null; 590 int bestQ = MATCH_NOMATCH; 591 592 for (OsmPrimitive prim : matches.keySet()) { 593 if (matches.get(prim) == bestQ) 594 bestE = null; 595 596 if (matches.get(prim) > bestQ) { 597 bestQ = matches.get(prim); 598 bestE = prim; 593 OsmPrimitive result = null; 594 try { 595 if (!transactionOpened) 596 return elemBestIndex.get(elem); 597 598 Map<OsmPrimitive, Integer> matches = elemMatchIndex.get(elem); 599 if (matches == null) { 600 return null; 599 601 } 600 } 601 602 return bestE; 602 603 int bestQ = MATCH_NOMATCH; 604 for (OsmPrimitive prim : matches.keySet()) { 605 if (matches.get(prim) == bestQ) { 606 result = null; 607 } 608 609 if (matches.get(prim) > bestQ) { 610 bestQ = matches.get(prim); 611 result = prim; 612 } 613 } 614 615 } catch (NullPointerException except) { 616 System.err.println("Strange exception occured." + 617 " If you find a way to reproduce this situation, please "+ 618 "e-mail the author of the CzechAddress plugin."); 619 except.printStackTrace(); 620 } 621 return result; 603 622 } 604 623
Note:
See TracChangeset
for help on using the changeset viewer.