Changeset 32398 in osm for applications/editors/josm/plugins/reltoolbox/src/relcontext/ChosenRelation.java
- Timestamp:
- 2016-06-25T11:56:57+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/reltoolbox/src/relcontext/ChosenRelation.java
r32395 r32398 69 69 70 70 public boolean isSame(Object r) { 71 if (r == null )71 if (r == null) 72 72 return chosenRelation == null; 73 else if (!(r instanceof Relation) )73 else if (!(r instanceof Relation)) 74 74 return false; 75 75 else … … 89 89 90 90 public static boolean isMultipolygon(Relation r) { 91 if (r == null )91 if (r == null) 92 92 return false; 93 93 String type = r.get("type"); 94 if (type == null )94 if (type == null) 95 95 return false; 96 for (String t : MULTIPOLYGON_TYPES )97 if (t.equals(type) )96 for (String t : MULTIPOLYGON_TYPES) { 97 if (t.equals(type)) 98 98 return true; 99 } 99 100 return false; 100 101 } … … 138 139 return; 139 140 140 OsmDataLayer dataLayer = mv.getEditLayer(); 141 float opacity = dataLayer == null ? 0.0f : !dataLayer.isVisible() ? 0.0f : (float)dataLayer.getOpacity(); 142 if (opacity < 0.01 )141 OsmDataLayer dataLayer = mv.getLayerManager().getEditLayer(); 142 float opacity = dataLayer == null ? 0.0f : !dataLayer.isVisible() ? 0.0f : (float) dataLayer.getOpacity(); 143 if (opacity < 0.01) 143 144 return; 144 145 … … 153 154 g.setComposite(oldComposite); 154 155 g.setStroke(oldStroke); 155 156 156 } 157 157 … … 159 159 for (OsmPrimitive element : rel.getMemberPrimitives()) { 160 160 if (element.getType() == OsmPrimitiveType.NODE) { 161 Node node = (Node)element; 161 Node node = (Node) element; 162 162 Point center = mv.getPoint(node); 163 163 g.drawOval(center.x - 4, center.y - 4, 9, 9); 164 164 } else if (element.getType() == OsmPrimitiveType.WAY) { 165 Way way = (Way)element; 165 Way way = (Way) element; 166 166 if (way.getNodesCount() >= 2) { 167 167 GeneralPath b = new GeneralPath(); … … 177 177 Color oldColor = g.getColor(); 178 178 g.setColor(Color.magenta); 179 drawRelations(g, mv, bbox, (Relation)element); 179 drawRelations(g, mv, bbox, (Relation) element); 180 180 g.setColor(oldColor); 181 181 } … … 186 186 @Override 187 187 public void relationMembersChanged(RelationMembersChangedEvent event) { 188 if (chosenRelation != null && event.getRelation().equals(chosenRelation) ) {188 if (chosenRelation != null && event.getRelation().equals(chosenRelation)) { 189 189 fireRelationChanged(chosenRelation); 190 190 } … … 193 193 @Override 194 194 public void tagsChanged(TagsChangedEvent event) { 195 if (chosenRelation != null && event.getPrimitive().equals(chosenRelation) ) {195 if (chosenRelation != null && event.getPrimitive().equals(chosenRelation)) { 196 196 fireRelationChanged(chosenRelation); 197 197 } … … 200 200 @Override 201 201 public void dataChanged(DataChangedEvent event) { 202 if (chosenRelation != null ) {202 if (chosenRelation != null) { 203 203 fireRelationChanged(chosenRelation); 204 204 } … … 207 207 @Override 208 208 public void primitivesRemoved(PrimitivesRemovedEvent event) { 209 if (chosenRelation != null && event.getPrimitives().contains(chosenRelation) ) {209 if (chosenRelation != null && event.getPrimitives().contains(chosenRelation)) { 210 210 clear(); 211 211 } … … 214 214 @Override 215 215 public void wayNodesChanged(WayNodesChangedEvent event) { 216 if (chosenRelation != null ) 217 { 216 if (chosenRelation != null) { 218 217 fireRelationChanged(chosenRelation); // download incomplete primitives doesn't cause dataChanged event 219 218 } … … 222 221 @Override 223 222 public void primitivesAdded(PrimitivesAddedEvent event) {} 223 224 224 @Override 225 225 public void nodeMoved(NodeMovedEvent event) {} 226 226 227 @Override 227 228 public void otherDatasetChange(AbstractDatasetChangedEvent event) {}
Note:
See TracChangeset
for help on using the changeset viewer.
