Changeset 13917 in josm
- Timestamp:
- 2018-06-11T03:14:29+02:00 (6 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/mappaint
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java
r13810 r13917 12 12 import java.util.Optional; 13 13 14 import org.openstreetmap.josm.data.osm.INode; 14 15 import org.openstreetmap.josm.data.osm.IPrimitive; 15 import org.openstreetmap.josm.data.osm.Node; 16 import org.openstreetmap.josm.data.osm.IRelation; 17 import org.openstreetmap.josm.data.osm.IWay; 16 18 import org.openstreetmap.josm.data.osm.Relation; 17 import org.openstreetmap.josm.data.osm.Way;18 19 import org.openstreetmap.josm.data.osm.visitor.paint.PaintColors; 19 20 import org.openstreetmap.josm.data.osm.visitor.paint.relations.Multipolygon; … … 157 158 } 158 159 Pair<StyleElementList, Range> p = getImpl(osm, scale, nc); 159 if (osm instanceof Node && isDefaultNodes()) {160 if (osm instanceof INode && isDefaultNodes()) { 160 161 if (p.a.isEmpty()) { 161 162 if (TextLabel.AUTO_LABEL_COMPOSITION_STRATEGY.compose(osm) != null) { … … 183 184 } 184 185 } 185 } else if (osm instanceof Way && isDefaultLines()) {186 } else if (osm instanceof IWay && isDefaultLines()) { 186 187 boolean hasProperLineStyle = false; 187 188 for (StyleElement s : p.a) { … … 235 236 */ 236 237 private Pair<StyleElementList, Range> getImpl(IPrimitive osm, double scale, NavigatableComponent nc) { 237 if (osm instanceof Node)238 if (osm instanceof INode) 238 239 return generateStyles(osm, scale, false); 239 else if (osm instanceof Way) {240 else if (osm instanceof IWay) { 240 241 Pair<StyleElementList, Range> p = generateStyles(osm, scale, false); 241 242 … … 245 246 // FIXME: Maybe in the future outer way styles apply to outers ignoring the multipolygon? 246 247 for (IPrimitive referrer : osm.getReferrers()) { 247 Relation r = (Relation) referrer;248 if (!drawMultipolygon || !r.isMultipolygon() || !r.isUsable() ) {248 IRelation<?> r = (IRelation<?>) referrer; 249 if (!drawMultipolygon || !r.isMultipolygon() || !r.isUsable() || !(r instanceof Relation)) { 249 250 continue; 250 251 } 251 Multipolygon multipolygon = MultipolygonCache.getInstance().get( r);252 Multipolygon multipolygon = MultipolygonCache.getInstance().get((Relation) r); 252 253 253 254 if (multipolygon.getOuterWays().contains(osm)) { … … 313 314 314 315 for (IPrimitive referrer : osm.getReferrers()) { 315 Relation ref = (Relation) referrer;316 if (!drawMultipolygon || !ref.isMultipolygon() || !ref.isUsable() ) {316 IRelation<?> ref = (IRelation<?>) referrer; 317 if (!drawMultipolygon || !ref.isMultipolygon() || !ref.isUsable() || !(ref instanceof Relation)) { 317 318 continue; 318 319 } 319 final Multipolygon multipolygon = MultipolygonCache.getInstance().get( ref);320 final Multipolygon multipolygon = MultipolygonCache.getInstance().get((Relation) ref); 320 321 321 322 if (multipolygon.getInnerWays().contains(osm)) { … … 346 347 } 347 348 return p; 348 } else if (osm instanceof Relation) {349 } else if (osm instanceof IRelation) { 349 350 return generateStyles(osm, scale, true); 350 351 } … … 383 384 } 384 385 env.layer = e.getKey(); 385 if (osm instanceof Way) {386 if (osm instanceof IWay) { 386 387 AreaElement areaStyle = AreaElement.create(env); 387 388 addIfNotNull(sl, areaStyle); … … 397 398 addIfNotNull(sl, TextElement.createForContent(env)); 398 399 } 399 } else if (osm instanceof Node) {400 } else if (osm instanceof INode) { 400 401 NodeElement nodeStyle = NodeElement.create(env); 401 402 if (nodeStyle != null) { … … 405 406 addIfNotNull(sl, BoxTextElement.create(env, NodeElement.SIMPLE_NODE_ELEMSTYLE_BOXPROVIDER)); 406 407 } 407 } else if (osm instanceof Relation) {408 if ((( Relation) osm).isMultipolygon()) {408 } else if (osm instanceof IRelation) { 409 if (((IRelation<?>) osm).isMultipolygon()) { 409 410 AreaElement areaStyle = AreaElement.create(env); 410 411 addIfNotNull(sl, areaStyle); -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSource.java
r13845 r13917 30 30 31 31 import org.openstreetmap.josm.data.Version; 32 import org.openstreetmap.josm.data.osm.INode; 32 33 import org.openstreetmap.josm.data.osm.IPrimitive; 34 import org.openstreetmap.josm.data.osm.IRelation; 35 import org.openstreetmap.josm.data.osm.IWay; 33 36 import org.openstreetmap.josm.data.osm.KeyValueVisitor; 34 37 import org.openstreetmap.josm.data.osm.Node; 35 38 import org.openstreetmap.josm.data.osm.OsmUtils; 36 import org.openstreetmap.josm.data.osm.Relation;37 39 import org.openstreetmap.josm.data.osm.Tagged; 38 import org.openstreetmap.josm.data.osm.Way;39 40 import org.openstreetmap.josm.data.preferences.sources.SourceEntry; 40 41 import org.openstreetmap.josm.gui.mappaint.Cascade; … … 647 648 public void apply(MultiCascade mc, IPrimitive osm, double scale, boolean pretendWayIsClosed) { 648 649 MapCSSRuleIndex matchingRuleIndex; 649 if (osm instanceof Node) {650 if (osm instanceof INode) { 650 651 matchingRuleIndex = nodeRules; 651 } else if (osm instanceof Way) {652 } else if (osm instanceof IWay) { 652 653 if (OsmUtils.isFalse(osm.get("area"))) { 653 654 matchingRuleIndex = wayNoAreaRules; … … 655 656 matchingRuleIndex = wayRules; 656 657 } 657 } else if (osm instanceof Relation) {658 if ((( Relation) osm).isMultipolygon()) {658 } else if (osm instanceof IRelation) { 659 if (((IRelation<?>) osm).isMultipolygon()) { 659 660 matchingRuleIndex = multipolygonRules; 660 661 } else if (osm.hasKey("#canvas")) {
Note:
See TracChangeset
for help on using the changeset viewer.