diff --git a/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java b/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java
index ee9bbf6..796a33c 100644
|
a
|
b
|
public class StyledMapRenderer extends AbstractMapRenderer {
|
| 539 | 539 | |
| 540 | 540 | public void drawArea(Relation r, Color color, MapImage fillImage, boolean disabled, TextElement text) { |
| 541 | 541 | Multipolygon multipolygon = MultipolygonCache.getInstance().get(nc, r); |
| 542 | | if (!r.isDisabled() && !multipolygon.getOuterWays().isEmpty()) { |
| | 542 | if (!r.isDisabled() && !multipolygon.getOuterWays().isEmpty() && multipolygon.isDrawEncouraged()) { |
| 543 | 543 | for (PolyData pd : multipolygon.getCombinedPolygons()) { |
| 544 | 544 | Path2D.Double p = pd.get(); |
| 545 | 545 | if (!isAreaVisible(p)) { |
diff --git a/src/org/openstreetmap/josm/data/osm/visitor/paint/relations/Multipolygon.java b/src/org/openstreetmap/josm/data/osm/visitor/paint/relations/Multipolygon.java
index d338709..7a726e5 100644
|
a
|
b
|
import org.openstreetmap.josm.data.osm.Way;
|
| 26 | 26 | import org.openstreetmap.josm.data.osm.event.NodeMovedEvent; |
| 27 | 27 | import org.openstreetmap.josm.data.osm.event.WayNodesChangedEvent; |
| 28 | 28 | import org.openstreetmap.josm.data.osm.visitor.paint.relations.Multipolygon.PolyData.Intersection; |
| | 29 | import org.openstreetmap.josm.tools.Geometry; |
| 29 | 30 | |
| 30 | 31 | /** |
| 31 | 32 | * Multipolygon data used to represent complex areas, see <a href="https://wiki.openstreetmap.org/wiki/Relation:multipolygon">wiki</a>. |
| … |
… |
public class Multipolygon {
|
| 592 | 593 | public List<PolyData> getCombinedPolygons() { |
| 593 | 594 | return combinedPolygons; |
| 594 | 595 | } |
| | 596 | |
| | 597 | public boolean isDrawEncouraged() { |
| | 598 | if (!isIncomplete()) { |
| | 599 | return true; |
| | 600 | } else if (Main.pref.getBoolean("mappaint.multipolygon.incomplete", false)) { |
| | 601 | return true; |
| | 602 | } |
| | 603 | |
| | 604 | // Determines if inner nodes lie on both sides of the line through the first and last node. |
| | 605 | // If this is the case, then drawing and incomplete multipolygon is problematic. |
| | 606 | int seenValues = 0; |
| | 607 | for (PolyData pd : getCombinedPolygons()) { |
| | 608 | final Node first = pd.nodes.get(0); |
| | 609 | final Node last = pd.nodes.get(pd.nodes.size() - 1); |
| | 610 | for (Node n : pd.nodes.subList(1, pd.nodes.size() - 2)) { |
| | 611 | final boolean isClockwise = Geometry.angleIsClockwise(first, last, n); |
| | 612 | seenValues |= isClockwise ? 0b10 : 0b01; |
| | 613 | if (seenValues == 0b11) { |
| | 614 | return false; |
| | 615 | } |
| | 616 | } |
| | 617 | } |
| | 618 | |
| | 619 | return true; |
| | 620 | } |
| 595 | 621 | } |
diff --git a/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java b/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java
index af28bf4..0cf7330 100644
|
a
|
b
|
public class ElemStyles {
|
| 246 | 246 | } |
| 247 | 247 | final Multipolygon multipolygon = MultipolygonCache.getInstance().get(nc, ref); |
| 248 | 248 | |
| | 249 | if (!multipolygon.isDrawEncouraged()) { |
| | 250 | continue; |
| | 251 | } |
| | 252 | |
| 249 | 253 | if (multipolygon.getInnerWays().contains(osm)) { |
| 250 | 254 | p = generateStyles(osm, scale, false); |
| 251 | 255 | boolean hasIndependentElemStyle = false; |