Changeset 23190 in osm for applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase
- Timestamp:
- 2010-09-15T18:54:18+02:00 (15 years ago)
- Location:
- applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/AddressElement.java
r19943 r23190 14 14 * 15 15 * <p>Every element must have a <i>name</i> and may have a <i>parent</i>.</p> 16 * 16 * 17 17 * @author Radomír Černoch radomir.cernoch@gmail.com 18 18 */ … … 99 99 Node node = (Node) prim; 100 100 result += " " + StringUtils.latLonToString(node.getCoor()); 101 101 102 102 } else if (prim instanceof Way) { 103 103 Way way = (Way) prim; … … 135 135 /** 136 136 * Compares 2 elements. 137 * 137 * 138 138 * <p>Basic criterion to comparing elements is their <i>name</i> and the 139 139 * </i>parent</i>. Notice that this behaviour might be changed … … 217 217 } 218 218 219 219 220 220 protected int[] getFieldMatchList(OsmPrimitive primitive) { 221 int[] result = {0}; 221 int[] result = {0}; 222 222 return result; 223 223 } … … 242 242 */ 243 243 public int getQ(OsmPrimitive primitive) { 244 244 245 245 // Firstly get integers representing a match of every matchable field. 246 246 int[] fieldMatches = getFieldMatchList(primitive); 247 247 assert fieldMatches.length > 0; 248 248 249 249 // Now find the max and min of this array. 250 250 int minVal = fieldMatches[0]; … … 260 260 assert Math.abs(minVal) <= 1; 261 261 assert Math.abs(maxVal) <= 1; 262 262 263 263 // If the best among all fields is 'neutral' match, the given primitive 264 264 // has nothing to do with our field. 265 265 if (maxVal <= 0) 266 266 return Reasoner.MATCH_NOMATCH; 267 267 268 268 // If all fields are 1 --> ROCKSOLID MATCH 269 269 // If some are 1, none -1 --> PARTIAL MATCH … … 274 274 case +1 : return Reasoner.MATCH_ROCKSOLID; 275 275 } 276 276 277 277 return 0; // <-- just to make compilers happy. We cannot get here. 278 278 } -
applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/Database.java
r15585 r23190 9 9 * <p>Contains the tree of all regions, municipalities, suburbs, streets 10 10 * and houses in the Czech republic.</p> 11 * 11 * 12 12 * @see AddressElement 13 13 * @see DatabaseParser -
applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/ElementWithHouses.java
r15763 r23190 47 47 /** 48 48 * Returns all houses directly contained in this element. 49 * 49 * 50 50 * NOTICE: If a subclass element contains other data structured capable 51 51 * of storing houses, they are not included in the returned set. -
applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/ElementWithStreets.java
r15585 r23190 24 24 public void addStreet(Street streetToAdd) { 25 25 //if (streetToAdd.getParent() instanceof ElementWithStreets) 26 26 27 27 streetToAdd.setParent(this); 28 28 streets.add(streetToAdd); … … 79 79 // We make an conservative estimate... 80 80 List<House> result = new ArrayList<House>(20 * streets.size()); 81 81 82 82 result.addAll(this.houses); 83 83 84 84 for (Street street : streets) 85 85 result.addAll(street.getHouses()); 86 86 87 87 return result; 88 88 } -
applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/House.java
r16743 r23190 20 20 * {@link ElementWithHouses}. The {@code setParent()} method should 21 21 * be called immediatelly after the constructor.</p> 22 * 22 * 23 23 * @author Radomír Černoch, radomir.cernoch@gmail.com 24 24 */ … … 44 44 45 45 assert (co != null) || (cp != null); 46 46 47 47 //... but the the name is overwritten. 48 48 this.name = generateName(this.cp, this.co); 49 49 } 50 50 51 51 /** 52 52 * Returns the number unique in a suburb (číslo popisné) … … 128 128 super.setParent(parent); 129 129 } 130 130 131 131 /** 132 132 * Returns the parent of this house with type-checking. … … 159 159 result[0] = matchField(this.cp, prim.get(PrimUtils.KEY_ADDR_CP)); 160 160 result[2] = matchField(name, prim.get(PrimUtils.KEY_ADDR_HOUSE_N)); 161 161 162 162 // Second field is the Housenumber 163 163 if (parent instanceof Street) … … 178 178 } 179 179 180 180 181 181 182 182 /** … … 188 188 @Override 189 189 public List<Proposal> getDiff(OsmPrimitive prim) { 190 190 191 191 List<Proposal> props = new NotNullList<Proposal>(); 192 192 ParentResolver resolver = new ParentResolver(this); -
applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/Region.java
r15585 r23190 10 10 */ 11 11 public class Region extends ElementWithStreets { 12 12 13 13 private ArrayList<ViToCi> vitocis 14 14 = new ArrayList<ViToCi>(); 15 15 16 16 /** 17 17 * Adds a single municipality into this element. … … 21 21 vitocis.add(municipality); 22 22 } 23 23 24 24 /** 25 25 * Replaces the list of municipalities of this element. … … 30 30 obec.setParent(this); 31 31 } 32 32 33 33 /** 34 34 * Returns the list of all municipalities in this region. … … 53 53 String nuts3name = null; 54 54 String nuts4name = null; 55 55 56 56 /** 57 57 * Default constructor setting the name of this region. … … 61 61 super(name); 62 62 } 63 63 64 64 /** 65 65 * Constructor which sets the region's name together with higher … … 71 71 if (nuts4name != null) this.nuts4name = nuts4name; 72 72 } 73 73 74 74 public String getNuts3Name() { 75 75 return nuts3name; 76 76 } 77 77 78 78 public String getNuts4Name() { 79 79 return nuts4name; 80 80 } 81 81 82 82 /** 83 83 * Returns the name of this region. If the NUTS3 name was entered, … … 86 86 @Override 87 87 public String toString() { 88 88 89 89 String thisString = name; 90 90 91 91 if (nuts3name != null) 92 92 thisString += " (kraj " + nuts3name + ")"; 93 93 94 94 return thisString; 95 95 } -
applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/Street.java
r15582 r23190 25 25 super.setParent(parent); 26 26 } 27 27 28 28 @Override 29 29 public ElementWithStreets getParent() { … … 36 36 int[] result = {0}; 37 37 if (!isMatchable(primitive)) return result; 38 38 39 39 result[0] = matchFieldAbbrev(name, primitive.get("name")); 40 40 return result; … … 44 44 public List<Proposal> getDiff(OsmPrimitive prim) { 45 45 List<Proposal> props = new NotNullList<Proposal>(); 46 46 47 47 props.add(getStringFieldDiff(PrimUtils.KEY_NAME, prim.get(PrimUtils.KEY_NAME), getName())); 48 48 return props; -
applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/Suburb.java
r15582 r23190 6 6 /** 7 7 * Suburb is a part of a {@link Municipality}. 8 * 8 * 9 9 * @author Radomír Černoch radomir.cernoch@gmail.com 10 10 */ -
applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/ViToCi.java
r15582 r23190 6 6 /** 7 7 * ViToCi is either a village, town or a city. 8 * 8 * 9 9 * @author Radomír Černoch radomir.cernoch@gmail.com 10 10 */
Note:
See TracChangeset
for help on using the changeset viewer.