Opened 14 years ago

Last modified 13 years ago

#3538 assigned defect

multiple styles and binding do not work

Reported by: assefa Owned by: sdlime
Priority: normal Milestone:
Component: MapServer C Library Version: unspecified
Severity: normal Keywords:
Cc: assefa, tbonfort

Description

a map with a binding on color with more that one style will not work:

CLASS

STYLE

WIDTH 6 COLOR [fillcolor]

END STYLE

WIDTH 3 COLOR [outlinecolor]

END

END

Attachments (3)

mapserver-3538.zip (1.7 KB ) - added by petlof 13 years ago.
Testcase for problem with multiple styles in same class
test.png (5.1 KB ) - added by petlof 13 years ago.
Output image displaying current output. All lines should have the same color on both paralell lines.
test-correct.png (4.7 KB ) - added by petlof 13 years ago.
When changing line 988 to MS_FALSE the correct result is drawn.. as this attachment shows.

Download all attachments as: .zip

Change History (19)

comment:1 by sdlime, 14 years ago

Status: newassigned

Hmmm... Should work, will check.

Steve

comment:2 by assefa, 14 years ago

I added the fix in r10498. It work with my test case.

comment:3 by assefa, 14 years ago

patching also 5.6 r10499

comment:4 by sdlime, 14 years ago

The fix doesn't look related to bindings at all? Steve

comment:5 by assefa, 14 years ago

It is on the msDrawShape call, the last parameter of this function is querymapMode. The "querymapMode" parameter is used in msBindLayerToShape on some if the bindings like color. In this function the queymapmode is used on color and outlinecolor bindings. Hopefully it is the correct fix. I tried this in trunck and 5.6.

comment:6 by sdlime, 14 years ago

Intuitively that doesn't seem like the right fix. I'll look to be sure though.

Steve

comment:7 by petlof, 13 years ago

Any news on this.

I've got a similar problem with binded colors and multiple styles in the same CLASS. When drawing the first pass draws correctly (style 0) but when reaching the phase when drawing again from the cache most drawing is done with the wrong color.

It's not obvious what goes wrong for me, but it seems that the color-binding is not reevaluated during the cache-face which results in the cached features beeing drawn with the last color that was bound to that style during the first phase (could that be the case?)

When changing line 975 in mapdraw.c (5.6-trunk) to MS_FALSE instead to disable all cache-drawing everything is drawn as it should.

Style-Example:

CLASS
NAME "B"
EXPRESSION ("[dir]" == "B")
STYLE
 SYMBOL		'circle'
 SIZE		3
 ANTIALIAS	true
 COLOR		[fwcolor]                   
 OFFSET		3 -99
END
STYLE
 SYMBOL		'circle'
 SIZE		3
 ANTIALIAS	true
 COLOR		[bwcolor]                   
 OFFSET		-3 -99
END	
END

comment:8 by sdlime, 13 years ago

Bump... Will look tonite.

Steve

comment:9 by petlof, 13 years ago

Any news Steve? Do you need more input from me?

comment:10 by sdlime, 13 years ago

Petlof, Assefa claims to have fixed this, I take it that's not the case with your last report? This is on my "todo" list before the feature freeze at the end of the week.

Steve

comment:11 by petlof, 13 years ago

I will create a sample test-case for this and verify that its still a problem.

comment:12 by petlof, 13 years ago

Hi, Issue still remains in 5.6-branch Se attached testdata

Shapefile with one field for rendercolor Two styles in same klass to draw two lines perpendicular against the shapeline.

The first style (drawn in the first pass) is drawn with the color from the field but when drawing second pass the field is not reevaluated and therefore all three lines are drawn with the last color from the first pass (blue in this case).

I've used this command for generating output shp2img.exe -m ms3538.map > test.png

by petlof, 13 years ago

Attachment: mapserver-3538.zip added

Testcase for problem with multiple styles in same class

by petlof, 13 years ago

Attachment: test.png added

Output image displaying current output. All lines should have the same color on both paralell lines.

by petlof, 13 years ago

Attachment: test-correct.png added

When changing line 988 to MS_FALSE the correct result is drawn.. as this attachment shows.

comment:13 by sdlime, 13 years ago

I assume you mean 988 in mapdraw.c in the 5.6 branch. Not the fix obviously but a good clue. Assefa's early fix was correct there are more errors. Hmmm... Thanks for the test case.

Steve

comment:14 by sdlime, 13 years ago

Cc: tbonfort added

Actually I'm not sure about Assefa's early fix. The use of MS_TRUE there looks purposeful by tbonfort as part of his RFC 49 work. CC'ing him...

Steve

comment:15 by sdlime, 13 years ago

Ok, I understand the problem. What happens with multi-style line layers is that we cache the lines and draw all features with each style in turn. This is done so intersections render correctly. msDrawShape() is called only for the first style (in general) and that's where the binding happens. So, by the time the cache is processed the styles have been re-bound to another feature and you see the result of the last bind- in the test case that's why every second style is drawn in blue.

I'm not sure of the fix. I guess we'd need to cache the styles (if necessary) in addition to the lines.

I'm going to hold off on a fix until the code sprint in a week and a half.

Steve

comment:16 by assefa, 13 years ago

I can work/test that with you at the code sprint too.

Note: See TracTickets for help on using tickets.