- Timestamp:
- 2023-02-15T18:22:07+01:00 (14 months ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java
r17916 r18664 217 217 FACTORY_MAP.put("parent_tag", Factory.ofEnv(String.class, Functions::parent_tag)); 218 218 FACTORY_MAP.put("parent_tags", Factory.ofEnv(String.class, Functions::parent_tags)); 219 FACTORY_MAP.put("parent_way_angle", Factory.ofEnv(Functions::parent_way_angle)); 219 220 FACTORY_MAP.put("plus", Factory.ofNumberVarArgs(0.0, DoubleUnaryOperator.identity(), Functions::plus)); 220 221 FACTORY_MAP.put("print", Factory.of(Object.class, Functions::print)); -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Functions.java
r18489 r18664 42 42 import org.openstreetmap.josm.tools.Territories; 43 43 import org.openstreetmap.josm.tools.Utils; 44 import org.openstreetmap.josm.tools.RotationAngle.WayDirectionRotationAngle; 44 45 45 46 /** … … 479 480 480 481 /** 482 * Get the rotation angle of the preceding parent way segment at the node location. 483 * If there is no preceding parent way segment, the following way segment is used instead. 484 * Requires a parent way object matched via 485 * <a href="https://josm.openstreetmap.de/wiki/Help/Styles/MapCSSImplementation#LinkSelector">child selector</a>. 486 * 487 * @param env the environment 488 * @return the rotation angle of the parent way segment at the node in radians, 489 * otherwise null if there is no matching parent way or the object is not a node 490 * @since 18664 491 */ 492 public static Double parent_way_angle(final Environment env) { 493 if (env.osm instanceof Node && env.parent instanceof Way) { 494 return WayDirectionRotationAngle.getRotationAngleForNodeOnWay((Node) env.osm, (Way) env.parent); 495 } 496 return null; 497 } 498 499 /** 481 500 * Gets the value of the key {@code key} from the object's child. 482 501 * @param env the environment
Note:
See TracChangeset
for help on using the changeset viewer.