Changeset 36102 in osm for applications/editors/josm/plugins/reltoolbox/src/relcontext/ChosenRelation.java
- Timestamp:
- 2023-07-24T15:55:23+02:00 (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/reltoolbox/src/relcontext/ChosenRelation.java
r34130 r36102 11 11 import java.awt.geom.GeneralPath; 12 12 import java.util.HashSet; 13 import java.util.Objects; 13 14 import java.util.Set; 14 15 … … 41 42 public class ChosenRelation implements ActiveLayerChangeListener, MapViewPaintable, DataSetListener { 42 43 protected Relation chosenRelation = null; 43 private Set<ChosenRelationListener> chosenRelationListeners = new HashSet<>(); 44 private final Set<ChosenRelationListener> chosenRelationListeners = new HashSet<>(); 44 45 45 46 public void set(Relation rel) { 46 if ( rel ==chosenRelation|| (rel != null && chosenRelation != null && rel.equals(chosenRelation)))47 if (Objects.equals(rel, chosenRelation)) 47 48 return; // new is the same as old 48 49 Relation oldRel = chosenRelation; … … 73 74 return false; 74 75 else 75 return chosenRelation != null &&r.equals(chosenRelation);76 return r.equals(chosenRelation); 76 77 } 77 78 … … 150 151 g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.3f * opacity)); 151 152 152 drawRelations(g, mv, bbox, chosenRelation, new HashSet< Relation>());153 drawRelations(g, mv, bbox, chosenRelation, new HashSet<>()); 153 154 154 155 g.setComposite(oldComposite); … … 178 179 } 179 180 g.draw(b); 180 } break; 181 } 182 break; 181 183 case RELATION: 182 184 Color oldColor = g.getColor(); … … 195 197 @Override 196 198 public void relationMembersChanged(RelationMembersChangedEvent event) { 197 if ( chosenRelation != null &&event.getRelation().equals(chosenRelation)) {199 if (event.getRelation().equals(chosenRelation)) { 198 200 fireRelationChanged(chosenRelation); 199 201 } … … 202 204 @Override 203 205 public void tagsChanged(TagsChangedEvent event) { 204 if ( chosenRelation != null &&event.getPrimitive().equals(chosenRelation)) {206 if (event.getPrimitive().equals(chosenRelation)) { 205 207 fireRelationChanged(chosenRelation); 206 208 }
Note:
See TracChangeset
for help on using the changeset viewer.