Changeset 5818 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2013-03-31T21:38:01+02:00 (12 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/CloseChangesetAction.java
r4982 r5818 78 78 private UserInfo userInfo; 79 79 80 /**81 *82 * @param model provides the user id of the current user and accepts the changesets83 * after download84 */85 80 public DownloadOpenChangesetsTask() { 86 81 super(tr("Downloading open changesets ...", false /* don't ignore exceptions */)); -
trunk/src/org/openstreetmap/josm/actions/CreateMultipolygonAction.java
r5225 r5818 130 130 } 131 131 132 /** Enable this action only if something is selected */ 132 /** 133 * Enable this action only if something is selected 134 * 135 * @param selection the current selection, gets tested for emptyness 136 */ 133 137 @Override protected void updateEnabledState(Collection < ? extends OsmPrimitive > selection) { 134 138 setEnabled(selection != null && !selection.isEmpty()); … … 137 141 /** 138 142 * This method analyzes ways and creates multipolygon. 139 * @param selectedWays 140 * @return null, if there was a problem with the ways.143 * @param selectedWays list of selected ways 144 * @return <code>null</code>, if there was a problem with the ways. 141 145 */ 142 146 private MultipolygonCreate analyzeWays(Collection < Way > selectedWays) { … … 155 159 /** 156 160 * Builds a relation from polygon ways. 157 * @param pol 158 * @return 161 * @param pol data storage class containing polygon information 162 * @return multipolygon relation 159 163 */ 160 164 private Relation createRelation(MultipolygonCreate pol) { … … 182 186 * This method removes tags/value pairs from inner and outer ways and put them on relation if necessary 183 187 * Function was extended in reltoolbox plugin by Zverikk and copied back to the core 184 * @param relation 188 * @param relation the multipolygon style relation to process 189 * @return a list of commands to execute 185 190 */ 186 191 private List<Command> removeTagsFromWaysIfNeeded( Relation relation ) { 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 192 Map<String, String> values = new HashMap<String, String>(); 193 194 if( relation.hasKeys() ) { 195 for( String key : relation.keySet() ) { 196 values.put(key, relation.get(key)); 197 } 198 } 199 200 List<Way> innerWays = new ArrayList<Way>(); 201 List<Way> outerWays = new ArrayList<Way>(); 202 203 Set<String> conflictingKeys = new TreeSet<String>(); 204 205 for( RelationMember m : relation.getMembers() ) { 206 207 if( m.hasRole() && "inner".equals(m.getRole()) && m.isWay() && m.getWay().hasKeys() ) { 208 innerWays.add(m.getWay()); 209 } 210 211 if( m.hasRole() && "outer".equals(m.getRole()) && m.isWay() && m.getWay().hasKeys() ) { 212 Way way = m.getWay(); 213 outerWays.add(way); 209 214 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 215 for( String key : way.keySet() ) { 216 if( !values.containsKey(key) ) { //relation values take precedence 217 values.put(key, way.get(key)); 218 } else if( !relation.hasKey(key) && !values.get(key).equals(way.get(key)) ) { 219 conflictingKeys.add(key); 220 } 221 } 222 } 223 } 224 225 // filter out empty key conflicts - we need second iteration 226 if( !Main.pref.getBoolean("multipoly.alltags", false) ) 227 for( RelationMember m : relation.getMembers() ) 228 if( m.hasRole() && m.getRole().equals("outer") && m.isWay() ) 229 for( String key : values.keySet() ) 230 if( !m.getWay().hasKey(key) && !relation.hasKey(key) ) 231 conflictingKeys.add(key); 232 233 for( String key : conflictingKeys ) 234 values.remove(key); 235 236 for( String linearTag : Main.pref.getCollection("multipoly.lineartagstokeep", DEFAULT_LINEAR_TAGS) ) 237 values.remove(linearTag); 238 239 if( values.containsKey("natural") && values.get("natural").equals("coastline") ) 240 values.remove("natural"); 241 242 values.put("area", "yes"); 243 244 List<Command> commands = new ArrayList<Command>(); 245 boolean moveTags = Main.pref.getBoolean("multipoly.movetags", true); 246 247 for( String key : values.keySet() ) { 248 List<OsmPrimitive> affectedWays = new ArrayList<OsmPrimitive>(); 249 String value = values.get(key); 250 251 for( Way way : innerWays ) { 252 if( way.hasKey(key) && (value.equals(way.get(key))) ) { 253 affectedWays.add(way); 254 } 255 } 256 257 if( moveTags ) { 258 // remove duplicated tags from outer ways 259 for( Way way : outerWays ) { 260 if( way.hasKey(key) ) { 261 affectedWays.add(way); 262 } 263 } 264 } 265 266 if( affectedWays.size() > 0 ) { 262 267 // reset key tag on affected ways 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 268 commands.add(new ChangePropertyCommand(affectedWays, key, null)); 269 } 270 } 271 272 if( moveTags ) { 273 // add those tag values to the relation 274 275 boolean fixed = false; 276 Relation r2 = new Relation(relation); 277 for( String key : values.keySet() ) { 278 if( !r2.hasKey(key) && !key.equals("area") ) { 279 if( relation.isNew() ) 280 relation.put(key, values.get(key)); 281 else 282 r2.put(key, values.get(key)); 283 fixed = true; 284 } 285 } 286 if( fixed && !relation.isNew() ) 287 commands.add(new ChangeCommand(relation, r2)); 288 } 289 290 return commands; 286 291 } 287 292 } -
trunk/src/org/openstreetmap/josm/actions/MergeNodesAction.java
r5360 r5818 272 272 * @param targetNode the target node the collection of nodes is merged to. Must not be null. 273 273 * @param targetLocationNode this node's location will be used for the targetNode. 274 * @throw IllegalArgumentException thrown if layer is null274 * @throws IllegalArgumentException thrown if layer is null 275 275 */ 276 276 public static Command mergeNodes(OsmDataLayer layer, Collection<Node> nodes, Node targetNode, Node targetLocationNode) { -
trunk/src/org/openstreetmap/josm/data/osm/User.java
r5495 r5818 119 119 * Replies the user name 120 120 * 121 * @return the user name. Never null, but may be the empty string121 * @return the user name. Never <code>null</code>, but may be the empty string 122 122 */ 123 123 public String getName() { … … 128 128 * Returns the list of user names 129 129 * 130 * @return slist of names130 * @return list of names 131 131 */ 132 132 public ArrayList<String> getNames() { … … 147 147 * 148 148 * @param name 149 * @return <code>true</code> if the name is in the names list 149 150 */ 150 151 public boolean hasName(String name) { … … 160 161 * always bound to a user with the same name. 161 162 * 163 * @return the user id 162 164 */ 163 165 public long getId() {
Note:
See TracChangeset
for help on using the changeset viewer.