- Timestamp:
- 2014-06-02T14:45:10+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetSelector.java
r7153 r7207 341 341 presetClassification.classification = 0; 342 342 343 if (onlyApplicable && !preset.typeMatches(getTypesInSelection())) { 344 final Predicate<Role> memberExpressionMatchesOnePrimitive = new Predicate<Role>() { 345 @Override 346 public boolean evaluate(Role object) { 347 return object.memberExpression != null && Utils.exists(Main.main.getCurrentDataSet().getSelected(), object.memberExpression); 348 } 349 }; 350 if (preset.types.contains(TaggingPresetType.RELATION) && preset.roles != null 351 && Utils.exists(preset.roles.roles, memberExpressionMatchesOnePrimitive)) { 352 // keep to allow the creation of new relations 353 } else { 343 if (onlyApplicable) { 344 boolean suitable = preset.typeMatches(getTypesInSelection()); 345 346 if (!suitable && preset.types.contains(TaggingPresetType.RELATION) && preset.roles != null) { 347 final Predicate<Role> memberExpressionMatchesOnePrimitive = new Predicate<Role>() { 348 final Collection<OsmPrimitive> selected = Main.main.getCurrentDataSet().getSelected(); 349 @Override public boolean evaluate(Role object) { 350 return object.memberExpression != null 351 && Utils.exists(selected, object.memberExpression); 352 } 353 }; 354 suitable = Utils.exists(preset.roles.roles, memberExpressionMatchesOnePrimitive); 355 // keep the preset to allow the creation of new relations 356 } 357 if (!suitable) { 354 358 continue; 355 359 } … … 400 404 typesInSelection.add(TaggingPresetType.NODE); 401 405 } else if (primitive instanceof Way) { 402 typesInSelection.add(TaggingPresetType.WAY);403 406 if (((Way) primitive).isClosed()) { 404 407 typesInSelection.add(TaggingPresetType.CLOSEDWAY); 408 } else { 409 // closedway is not a way for preset checking, the types are mutually exclusive 410 typesInSelection.add(TaggingPresetType.WAY); 405 411 } 406 412 } else if (primitive instanceof Relation) {
Note:
See TracChangeset
for help on using the changeset viewer.