Opened 6 years ago
#16174 new enhancement
please consider adding offset-start and offset-end style setting for lines
Reported by: | Owned by: | team | |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Core mappaint | Version: | |
Keywords: | Cc: |
Description
I've looked into modifying the lane and road attributes mapstyle to support placement:start and placement:end (used to indicate that the placement changes between the start and end of the way), but this will require drawing lines that are not parallel to the way, which is currently not supported.
I've looked through JOSM's source code, and think adding this should be possible with relatively low effort.
In LineElement.paintPrimitive, painter.drawWay would need to be called with a start and end offset instead of just a single offset.
In StyledMapRenderer.drawWay start and end offsets need to be passed to OffsetIterator.
In OffsetIterator, if the start and end offset are different, then instead of applying a constant offset for every node, a per node offset value is calculated like this:
total_distance = sum of distance between nodes
if total_distance is 0, then:
current_node_offset = offset_start - ( (offset_start-offset_end) * 0.5 )
otherwise:
current_distance = sum of distance from first to current node
current_node_offset = offset_start - ( (offset_start-offset_end) * (current_distance / total_distance) )