Legend:
- Unmodified
- Added
- Removed
-
trunk/data/validator/geometry.mapcss
r9500 r9540 212 212 throwWarning: tr("node connects waterway and bridge"); 213 213 } 214 215 way[junction=roundabout]:righthandtraffic:clockwise, 216 way[junction=roundabout]!:righthandtraffic:anticlockwise { 217 throwWarning: tr("suspicious roundabout direction"); 218 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Condition.java
r9341 r9540 612 612 613 613 /** 614 * {@code clockwise} whether the way is closed and oriented clockwise, 615 * or non-closed and the 1st, 2nd and last node are in clockwise order. 616 * @param e MapCSS environment 617 * @return {@code true} if the way clockwise 618 * @see ExpressionFactory.Functions#is_clockwise(Environment) 619 */ 620 static boolean clockwise(Environment e) { 621 return ExpressionFactory.Functions.is_clockwise(e); 622 } 623 624 /** 625 * {@code anticlockwise} whether the way is closed and oriented anticlockwise, 626 * or non-closed and the 1st, 2nd and last node are in anticlockwise order. 627 * @param e MapCSS environment 628 * @return {@code true} if the way clockwise 629 * @see ExpressionFactory.Functions#is_anticlockwise(Environment) 630 */ 631 static boolean anticlockwise(Environment e) { 632 return ExpressionFactory.Functions.is_anticlockwise(e); 633 } 634 635 /** 614 636 * {@code unclosed-multipolygon} tests whether the object is an unclosed multipolygon. 615 637 * @param e MapCSS environment -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java
r9239 r9540 869 869 870 870 /** 871 * Determines whether the way is {@link Geometry#isClockwise closed and oriented clockwise}, 872 * or non-closed and the {@link Geometry#angleIsClockwise 1st, 2nd and last node are in clockwise order}. 873 * 874 * @param env the environment 875 * @return true if the way is closed and oriented clockwise 876 */ 877 public static boolean is_clockwise(Environment env) { 878 if (!(env.osm instanceof Way)) { 879 return false; 880 } 881 final Way way = (Way) env.osm; 882 return way.isClosed() && Geometry.isClockwise(way) 883 || !way.isClosed() && way.getNodesCount() > 2 && Geometry.angleIsClockwise(way.getNode(0), way.getNode(1), way.lastNode()); 884 } 885 886 /** 887 * Determines whether the way is {@link Geometry#isClockwise closed and oriented anticlockwise}, 888 * or non-closed and the {@link Geometry#angleIsClockwise 1st, 2nd and last node are in anticlockwise order}. 889 * 890 * @param env the environment 891 * @return true if the way is closed and oriented clockwise 892 */ 893 public static boolean is_anticlockwise(Environment env) { 894 if (!(env.osm instanceof Way)) { 895 return false; 896 } 897 final Way way = (Way) env.osm; 898 return way.isClosed() && !Geometry.isClockwise(way) 899 || !way.isClosed() && way.getNodesCount() > 2 && !Geometry.angleIsClockwise(way.getNode(0), way.getNode(1), way.lastNode()); 900 } 901 902 /** 871 903 * Prints the object to the command line (for debugging purpose). 872 904 * @param o the object
Note:
See TracChangeset
for help on using the changeset viewer.