Changeset 24166 in osm for applications/editors/josm/plugins/FixAddresses/src
- Timestamp:
- 2010-11-09T00:36:45+01:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/OSMAddress.java
r24146 r24166 57 57 */ 58 58 public boolean isComplete() { 59 return hasCity() && 60 hasHouseNumber() && 61 hasPostCode() && 62 hasCity() && 63 hasState() && 64 hasStreetName(); 59 boolean isComplete = hasCity() && 60 hasHouseNumber() && 61 hasPostCode() && 62 hasCity() && 63 hasStreetName(); 64 65 // Check, if "addr:state" is required (US and AU) 66 if (TagUtils.isStateRequired()) { 67 isComplete = isComplete && hasState(); 68 } 69 70 return isComplete; 65 71 } 66 72 … … 406 412 needsGuessedValue(TagUtils.ADDR_POSTCODE_TAG) || 407 413 needsGuessedValue(TagUtils.ADDR_COUNTRY_TAG) || 408 needsGuessedValue(TagUtils.ADDR_STATE_TAG) ||414 //needsGuessedValue(TagUtils.ADDR_STATE_TAG) || 409 415 needsGuessedValue(TagUtils.ADDR_STREET_TAG); 410 416 } -
applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/OsmUtils.java
r24130 r24166 15 15 16 16 import java.util.List; 17 import java.util.Locale; 17 18 18 19 import org.openstreetmap.josm.data.coor.LatLon; … … 29 30 public class OsmUtils { 30 31 private OsmUtils() {} 32 33 private static String cachedLocale = null; 31 34 32 35 /** … … 146 149 return false; 147 150 } 151 152 /** 153 * Gets the locale code as string. 154 * 155 * @return the locale 156 */ 157 public static String getLocale() { 158 // Check if user could prefer imperial system 159 if (cachedLocale == null) { 160 Locale l = Locale.getDefault(); 161 cachedLocale = l.toString(); 162 } 163 return cachedLocale; 164 } 148 165 149 166 private static void applyDerivedValue(OSMAddress address, Way w, String tag) { -
applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/TagUtils.java
r24119 r24166 27 27 */ 28 28 public final class TagUtils { 29 private static String COUNTRIES_REQUIRE_STATE[] = { 30 "en_US", /* USA */ 31 "en_AU" /* Australia */ 32 }; 29 33 30 34 /** … … 1946 1950 public static boolean isHouseMember(RelationMember relMember) { 1947 1951 return relMember != null && STREET_RELATION_ROLE.equals(relMember.getRole()); 1952 } 1953 1954 1955 1956 /** 1957 * Checks if "addr:state" tag is required. 1958 * 1959 * @return true, if is state required 1960 */ 1961 public static boolean isStateRequired() { 1962 String loc = OsmUtils.getLocale(); 1963 1964 for (int i = 0; i < COUNTRIES_REQUIRE_STATE.length; i++) { 1965 if (COUNTRIES_REQUIRE_STATE[i].equals(loc)) { 1966 return true; 1967 } 1968 } 1969 1970 return false; 1948 1971 } 1949 1972 -
applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/gui/IncompleteAddressesTableModel.java
r24117 r24166 26 26 private static final long serialVersionUID = -5951629033395186324L; 27 27 28 private static final int NUMBER_OF_COLUMNS = 6; 29 private static final String[] COLUMN_NAMES = new String[]{tr("Country"), tr("State"), tr("City"), tr("Post Code"), tr("Street"), tr("Number")}; 28 // TODO: Add "state" colum, if required 29 private static final int NUMBER_OF_COLUMNS = 5; 30 private static final String[] COLUMN_NAMES = new String[]{tr("Country"), tr("City"), tr("Postcode"), tr("Street"), tr("Number")}; 30 31 private static final Class<?>[] COLUMN_CLASSES = new Class<?>[]{ 31 32 String.class, String.class, String.class, String.class, String.class, String.class}; … … 33 34 34 35 /** 35 * @param addressContainer 36 * Instantiates a new incomplete addresses table model. 37 * 38 * @param addressContainer the address container used for display 36 39 */ 37 40 public IncompleteAddressesTableModel(AddressEditContainer addressContainer) { … … 39 42 } 40 43 44 /* (non-Javadoc) 45 * @see javax.swing.table.DefaultTableModel#getColumnCount() 46 */ 41 47 @Override 42 48 public int getColumnCount() { 43 // TODO Auto-generated method stub44 49 return NUMBER_OF_COLUMNS; 45 50 } 46 51 52 /* (non-Javadoc) 53 * @see javax.swing.table.DefaultTableModel#getColumnName(int) 54 */ 47 55 @Override 48 56 public String getColumnName(int column) { … … 50 58 } 51 59 60 /* (non-Javadoc) 61 * @see javax.swing.table.DefaultTableModel#getRowCount() 62 */ 52 63 @Override 53 64 public int getRowCount() { … … 58 69 } 59 70 71 /* (non-Javadoc) 72 * @see javax.swing.table.DefaultTableModel#getValueAt(int, int) 73 */ 60 74 @Override 61 75 public Object getValueAt(int row, int column) { … … 70 84 return aNode.getCountry(); 71 85 case 1: 72 return aNode.get State();86 return aNode.getCity(); 73 87 case 2: 74 return aNode.get City();88 return aNode.getPostCode(); 75 89 case 3: 76 return aNode.get PostCode();90 return aNode.getStreetName(); 77 91 case 4: 78 return aNode.getStreetName();79 case 5:80 92 return aNode.getHouseNumber(); 81 93 default: … … 85 97 } 86 98 99 /* (non-Javadoc) 100 * @see javax.swing.table.AbstractTableModel#getColumnClass(int) 101 */ 87 102 @Override 88 103 public Class<?> getColumnClass(int arg0) { … … 90 105 } 91 106 107 /* (non-Javadoc) 108 * @see javax.swing.table.DefaultTableModel#isCellEditable(int, int) 109 */ 92 110 @Override 93 111 public boolean isCellEditable(int row, int column) { … … 96 114 } 97 115 116 /* (non-Javadoc) 117 * @see org.openstreetmap.josm.plugins.fixAddresses.gui.AddressEditTableModel#getEntityOfRow(int) 118 */ 98 119 @Override 99 120 public IOSMEntity getEntityOfRow(int row) { … … 107 128 } 108 129 130 /* (non-Javadoc) 131 * @see org.openstreetmap.josm.plugins.fixAddresses.gui.AddressEditTableModel#getRowOfEntity(org.openstreetmap.josm.plugins.fixAddresses.IOSMEntity) 132 */ 109 133 @Override 110 134 public int getRowOfEntity(IOSMEntity entity) {
Note:
See TracChangeset
for help on using the changeset viewer.