Modify

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#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 bastiK)

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)

mapcss 1.PNG (518.9 KB ) - added by Allroads 7 years ago.
Example of problem
mapcss 2.PNG (1.1 MB ) - added by Allroads 7 years ago.
End of the highway imagery spaces are changing.
12423 working.PNG (7.4 KB ) - added by Allroads 7 years ago.
12450 broken.PNG (3.3 KB ) - added by Allroads 7 years ago.

Download all attachments as: .zip

Change History (19)

by Allroads, 7 years ago

Attachment: mapcss 1.PNG added

Example of problem

by Allroads, 7 years ago

Attachment: mapcss 2.PNG added

End of the highway imagery spaces are changing.

comment:1 by bastiK, 7 years ago

Description: modified (diff)

comment:2 by bastiK, 7 years ago

Resolution: fixed
Status: newclosed

In 12399/josm:

fixed #14926 - repeat-image-phase: does not work

comment:3 by Don-vip, 7 years ago

Milestone: 17.06

comment:4 by bastiK, 7 years ago

In 12447/josm:

new test case for MapCSSRendererTest (repeat-image, see #14926)

comment:5 by bastiK, 7 years ago

Resolution: fixed
Status: closedreopened

comment:6 by bastiK, 7 years ago

Milestone: 17.0617.07
Owner: changed from team to michael2402
Priority: normalmajor
Status: reopenednew

Due to higher priority regression (#14980), [12399] was reverted in r12450. It means, the bug in this ticket is no longer fixed.

@michael2402, I have no clue, what this min/max does, can you add a code comment when it is fixed?

by Allroads, 7 years ago

Attachment: 12423 working.PNG added

by Allroads, 7 years ago

Attachment: 12450 broken.PNG added

comment:7 by Allroads, 7 years ago

12423 working.PNG


Now

12450 broken.PNG

Can this be fixed!! Like 12423, This is the version I am working with.

comment:8 by Klumbumbus, 7 years ago

see comment:6

comment:9 by stoecker, 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

     
    391391        private final MapViewRectangle clip;
    392392        private final PathSegmentConsumer consumer;
    393393        protected double strokeProgress;
     394        protected double strokeStart;
    394395        private final double strokeLength;
    395396
    396397        private MapViewPoint cursor;
     
    405406         */
    406407        ClampingPathVisitor(MapViewRectangle clip, double strokeOffset, double strokeLength, PathSegmentConsumer consumer) {
    407408            this.clip = clip;
    408             this.strokeProgress = Math.min(strokeLength - strokeOffset, 0);
     409            this.strokeProgress = Math.max(strokeLength - strokeOffset, 0);
     410            this.strokeStart = this.strokeProgress;
    409411            this.strokeLength = strokeLength;
    410412            this.consumer = consumer;
    411413        }
     
    440442            }
    441443
    442444            double distance = Math.sqrt(distanceSq);
    443             double offset = (strokeProgress + distance) % strokeLength;
     445            double offset = (strokeProgress - strokeStart + distance) % strokeLength;
    444446            if (offset < 0.01) {
    445447                return entry;
    446448            }
Last edited 7 years ago by Klumbumbus (previous) (diff)

comment:10 by bastiK, 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.

comment:11 by michael2402, 7 years ago

Resolution: fixed
Status: newclosed

In 12455/josm:

Fix #14926: Preserve image phase when clamping a line.

comment:12 by michael2402, 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)

in reply to:  12 ; comment:13 by bastiK, 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:14 by michael2402, 7 years ago

In 12456/josm:

See #14926: Flip the direction of repeat-image-phase to the old one.

in reply to:  13 comment:15 by michael2402, 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.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain michael2402.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.