#14926 closed defect (fixed)
repeat-image-phase: does not work.
Reported by: | Allroads | Owned by: | michael2402 |
---|---|---|---|
Priority: | major | Milestone: | 17.07 |
Component: | Core mappaint | Version: | tested |
Keywords: | template_report | Cc: |
Description (last modified by )
I try to express the access in barrier and highway with a imagery
I managed to do that on the node for barrier, but.
On the highway I do not get the string of icons like on the node.
"repeat-image-phase" doe not do anything.
I used positive and negative number 50 / -50,
My conclusion is that "repeat-image-phase" is not working well.
Note: the imagery is a svg but the original size is not all the same the imagery's, I just set the height on 15.
Because of this different size, the wides are different, this give the effect that further on the highway
I expect that with setting for each icon the "repeat-image-spacing" on the same number, I get a string of icons like on the node. This "repeat-image-spacing" needs to calculate the "repeat-image-phase" in the adjustment for each image, so that we get a string of imagery.
Now you see because of different image sizes the space further on the line/way/highway are getting different.
It should be possible to use different size of svg imagery, foot is just smaller than a bicycle, the space between then should otherwise be to big, if it must be all the same imagery sizes.
======================================================
mapcss partly to get the idea of the numbering:
/* ************************************* FOOT ************************************* */ node|z17-[barrier][foot=yes]::access_foot_nodelayer { icon-image: footNL-green.svg; icon-height: 15; icon-offset-x: 25; icon-offset-y: -12; } node|z17-[barrier][foot=no]::access_foot_nodelayer { icon-image: footNL-red.svg; icon-height: 15; icon-offset-x: 25; icon-offset-y: -12; } way|z17-[highway][foot=yes]::access_foot_waylayer { repeat-image: footNL-green.svg; repeat-image-height: 15; repeat-image-offset: 10; repeat-image-phase: 25; repeat-image-spacing: 400; } way|z17-[highway][foot=no]::access_foot_waylayer { repeat-image: footNL-red.svg; repeat-image-height: 15; repeat-image-offset: 10; repeat-image-phase: 25; repeat-image-spacing: 400; } /* ************************************* BICYCLE ************************************* */ node|z17-[barrier][bicycle=yes]::access_bicycle_nodelayer { icon-image: bicycleNL-green.svg; icon-height: 15; icon-offset-x: 45; icon-offset-y: -12; } node|z17-[barrier][bicycle=no]::access_bicycle_nodelayer { icon-image: bicycleNL-red.svg; icon-height: 15; icon-offset-x: 45; icon-offset-y: -12; } way|z17-[highway][bicycle=yes]::access_bicycle_waylayer { repeat-image: bicycleNL-green.svg; repeat-image-height: 15; repeat-image-offset: 10; repeat-image-phase: 45; repeat-image-spacing: 400; } way|z17-[highway][bicycle=no]::access_bicycle_waylayer { repeat-image: bicycleNL-red.svg; repeat-image-height: 15; repeat-image-offset: 10; repeat-image-phase: 45; repeat-image-spacing: 400; } /* ************************************* MOFA ************************************* */ node|z17-[barrier][mofa=yes]::access_mofa_nodelayer { icon-image: mofaNL-green.svg; icon-height: 15; icon-offset-x: 75; icon-offset-y: -12; } node|z17-[barrier][mofa=no]::access_mofa_nodelayer { icon-image: mofaNL-red.svg; icon-height: 15; icon-offset-x: 75; icon-offset-y: -12; } way|z17-[highway][mofa=yes]::access_mofa_waylayer { repeat-image: mofaNL-green.svg; repeat-image-height: 15; repeat-image-offset: 10; repeat-image-phase: 75; repeat-image-spacing: 400; } way|z17-[highway][mofa=no]::access_mofa_waylayer { repeat-image: mofaNL-red.svg; repeat-image-height: 15; repeat-image-offset: 10; repeat-image-phase: 75; repeat-image-spacing: 400; }
Attachments (4)
Change History (19)
by , 7 years ago
Attachment: | mapcss 1.PNG added |
---|
comment:1 by , 7 years ago
Description: | modified (diff) |
---|
comment:3 by , 7 years ago
Milestone: | → 17.06 |
---|
comment:5 by , 7 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
comment:6 by , 7 years ago
Milestone: | 17.06 → 17.07 |
---|---|
Owner: | changed from | to
Priority: | normal → major |
Status: | reopened → new |
by , 7 years ago
Attachment: | 12423 working.PNG added |
---|
by , 7 years ago
Attachment: | 12450 broken.PNG added |
---|
comment:7 by , 7 years ago
comment:9 by , 7 years ago
This seems to fix both issues, but actually I don't fully understand the code. Currently it seems strokeOffset is simply ignored, as the min() always sets the start to 0.
The min/max makes only sense to ensure that Length is > Offset.
-
src/org/openstreetmap/josm/gui/draw/MapViewPath.java
391 391 private final MapViewRectangle clip; 392 392 private final PathSegmentConsumer consumer; 393 393 protected double strokeProgress; 394 protected double strokeStart; 394 395 private final double strokeLength; 395 396 396 397 private MapViewPoint cursor; … … 405 406 */ 406 407 ClampingPathVisitor(MapViewRectangle clip, double strokeOffset, double strokeLength, PathSegmentConsumer consumer) { 407 408 this.clip = clip; 408 this.strokeProgress = Math.min(strokeLength - strokeOffset, 0); 409 this.strokeProgress = Math.max(strokeLength - strokeOffset, 0); 410 this.strokeStart = this.strokeProgress; 409 411 this.strokeLength = strokeLength; 410 412 this.consumer = consumer; 411 413 } … … 440 442 } 441 443 442 444 double distance = Math.sqrt(distanceSq); 443 double offset = (strokeProgress + distance) % strokeLength;445 double offset = (strokeProgress - strokeStart + distance) % strokeLength; 444 446 if (offset < 0.01) { 445 447 return entry; 446 448 }
comment:10 by , 7 years ago
With line dashes, the phase is already encoded in the BasicStroke
object and will be respected by the Java drawing algorithm. On the other hand, the repeat-image phase has to be added explicitly.
follow-up: 13 comment:12 by , 7 years ago
I fixed this one - at least I hope this is how it should work ;-)
I added a test case for the clamping. The camping margin is quite big (but constant for now), so you need to extend them several pixel after the border.
We currently have a test error in the way-repeat-image
test: The reference image differs from the one the test creates. The problem is with the topmost, circular way. Did something change there? (btw: I mostly hide default nodes in the test files, because changing the default node style would otherwise invalidate all test images and I want them to be as specific as possible)
follow-up: 15 comment:13 by , 7 years ago
Replying to michael2402:
I fixed this one - at least I hope this is how it should work ;-)
Great!
We currently have a test error in the
way-repeat-image
test: The reference image differs from the one the test creates. The problem is with the topmost, circular way. Did something change there?
It seems the sign for the phase has flipped. (It moves in the opposite direction.)
(btw: I mostly hide default nodes in the test files, because changing the default node style would otherwise invalidate all test images and I want them to be as specific as possible)
Sure, but a bit variety mixed in is also good for this test. Some real world problems may not show up in clean room tests.
comment:15 by , 7 years ago
Replying to bastiK:
It seems the sign for the phase has flipped. (It moves in the opposite direction.)
Thanks, fixed that. This test was failing for some revisions now, so I was not sure what the right one was. Now it behaves the way dashes-offset
works.
Example of problem