Changeset 6613 in josm for trunk/src/org
- Timestamp:
- 2014-01-03T17:47:52+01:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 1 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java
r6611 r6613 38 38 import org.openstreetmap.josm.data.validation.tests.NodesDuplicatingWayTags; 39 39 import org.openstreetmap.josm.data.validation.tests.OpeningHourTest; 40 import org.openstreetmap.josm.data.validation.tests.OverlappingAreas;41 40 import org.openstreetmap.josm.data.validation.tests.OverlappingWays; 42 41 import org.openstreetmap.josm.data.validation.tests.PowerLines; … … 110 109 TurnrestrictionTest.class, // ID 1801 .. 1899 111 110 DuplicateRelation.class, // ID 1901 .. 1999 112 OverlappingAreas.class, // ID 2201 .. 2299113 111 WayConnectedToArea.class, // ID 2301 .. 2399 114 112 NodesDuplicatingWayTags.class, // ID 2401 .. 2499 -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParser.jj
r6611 r6613 81 81 | < FULLSTOP: "." > 82 82 | < ELEMENT_OF: "∈" > 83 | < CROSSING: "⧉" > 83 84 | < COMMENT_START: "/*" > : COMMENT 84 85 | < UNEXPECTED_CHAR : ~[] > // avoid TokenMgrErrors because they are hard to recover from … … 278 279 | 279 280 <ELEMENT_OF> { type = Selector.ChildOrParentSelectorType.ELEMENT_OF; } 281 | 282 <CROSSING> { type = Selector.ChildOrParentSelectorType.CROSSING; } 280 283 ) 281 284 { selLink = new LinkSelector(conditions); } -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java
r6611 r6613 39 39 40 40 public static enum ChildOrParentSelectorType { 41 CHILD, PARENT, ELEMENT_OF 41 CHILD, PARENT, ELEMENT_OF, CROSSING 42 42 } 43 43 … … 150 150 } 151 151 152 private class ContainsFinder extends AbstractVisitor {153 pr ivatefinal Environment e;154 155 pr ivate ContainsFinder(Environment e) {152 private abstract class AbstractFinder extends AbstractVisitor { 153 protected final Environment e; 154 155 protected AbstractFinder(Environment e) { 156 156 this.e = e; 157 CheckParameterUtil.ensureThat(!(e.osm instanceof Node), "Nodes not supported");158 157 } 159 158 160 159 @Override 161 160 public void visit(Node n) { 162 if (e.child == null && left.matches(e.withPrimitive(n))) {163 if (e.osm instanceof Way && Geometry.nodeInsidePolygon(n, ((Way) e.osm).getNodes())164 || e.osm instanceof Relation && ((Relation) e.osm).isMultipolygon() && Geometry.isNodeInsideMultiPolygon(n, (Relation) e.osm, null)) {165 e.child = n;166 }167 }168 161 } 169 162 170 163 @Override 171 164 public void visit(Way w) { 172 if (e.child == null && left.matches(e.withPrimitive(w))) {173 if (e.osm instanceof Way && Geometry.PolygonIntersection.FIRST_INSIDE_SECOND.equals(Geometry.polygonIntersection(w.getNodes(), ((Way) e.osm).getNodes()))174 || e.osm instanceof Relation && ((Relation) e.osm).isMultipolygon() && Geometry.isPolygonInsideMultiPolygon(w.getNodes(), (Relation) e.osm, null)) {175 e.child = w;176 }177 }178 165 } 179 166 … … 194 181 } 195 182 183 private class CrossingFinder extends AbstractFinder { 184 private CrossingFinder(Environment e) { 185 super(e); 186 CheckParameterUtil.ensureThat(e.osm instanceof Way, "Only ways are supported"); 187 } 188 189 @Override 190 public void visit(Way w) { 191 if (e.child == null && left.matches(e.withPrimitive(w))) { 192 if (e.osm instanceof Way && Geometry.PolygonIntersection.CROSSING.equals(Geometry.polygonIntersection(w.getNodes(), ((Way) e.osm).getNodes()))) { 193 e.child = w; 194 } 195 } 196 } 197 } 198 199 private class ContainsFinder extends AbstractFinder { 200 private ContainsFinder(Environment e) { 201 super(e); 202 CheckParameterUtil.ensureThat(!(e.osm instanceof Node), "Nodes not supported"); 203 } 204 205 @Override 206 public void visit(Node n) { 207 if (e.child == null && left.matches(e.withPrimitive(n))) { 208 if (e.osm instanceof Way && Geometry.nodeInsidePolygon(n, ((Way) e.osm).getNodes()) 209 || e.osm instanceof Relation && ((Relation) e.osm).isMultipolygon() && Geometry.isNodeInsideMultiPolygon(n, (Relation) e.osm, null)) { 210 e.child = n; 211 } 212 } 213 } 214 215 @Override 216 public void visit(Way w) { 217 if (e.child == null && left.matches(e.withPrimitive(w))) { 218 if (e.osm instanceof Way && Geometry.PolygonIntersection.FIRST_INSIDE_SECOND.equals(Geometry.polygonIntersection(w.getNodes(), ((Way) e.osm).getNodes())) 219 || e.osm instanceof Relation && ((Relation) e.osm).isMultipolygon() && Geometry.isPolygonInsideMultiPolygon(w.getNodes(), (Relation) e.osm, null)) { 220 e.child = w; 221 } 222 } 223 } 224 } 225 196 226 @Override 197 227 public boolean matches(Environment e) { … … 223 253 return e.child != null; 224 254 255 } else if (ChildOrParentSelectorType.CROSSING.equals(type) && e.osm instanceof Way) { 256 final CrossingFinder crossingFinder = new CrossingFinder(e); 257 if (((GeneralSelector) right).matchesBase(OsmPrimitiveType.WAY)) { 258 crossingFinder.visit(e.osm.getDataSet().searchWays(e.osm.getBBox())); 259 } 260 return e.child != null; 225 261 } else if (ChildOrParentSelectorType.CHILD.equals(type)) { 226 262 MatchingReferrerFinder collector = new MatchingReferrerFinder(e);
Note:
See TracChangeset
for help on using the changeset viewer.