it is kind of weird that at the location of legend on saved image, labels were rendered above the legend, different from onscreen map (labels were not seen over the legend image).
pls see attached saved image.
Any ideas?
Guangming
Labels above legend on saved image of the map?
Hi Guangming,
Please paste some code for how you save the image so I can reproduce it and find where is the problem.
I think that’s should because the somewhere set incorrect draw level.
BTW, you missed the attached file.
Regards,
Don
here is the workflow of my codes (really following your example you gave to us earlier):
create MapPrinterLayer
Create PagePrinterLayer (configuring pagesize/orientation/…)
add PagePrinterLayer to MapPrinterLayer.Layers
add other spatial layers to MapPrinterLayer.Layers
add legendLayer to MapPrinterLayer.Layers
open MapPrinterLayer
Draw MapPrinterLayer to GdiPlusGeoCanvas
I never called any codes related to DrawLevel.
The issue just exists for saved map - I assume that onscreen map and saved map should call the same layer renderers at the server side to create image.
I attached the image with issues.
I also tried more scenarios: seems that the order of rendering layers including spatial feature layers and legend layers is correct. But for some reason, my guess is that the background of legend image is transparent when saving the map as image.
001_mapexport_(1).png (46.5 KB)
BTW, I did have set up non-transparent background mask to the legend layer:
legendLayer.BackgroundMask = AreaStyles.CreateLinearGradientStyle(new GeoColor(255, 255, 255, 255),
new GeoColor(255, 230, 230, 230), 90, GeoColor.SimpleColors.Black);
That is why onscreen labels are hidden as well as polygons/lines over the area of the legend.
I noticed one more piece of information: over the area of the legend, I just see Labels but not spatial features polygons/lines/points.
Hi Guangming,
Today I read some code and found the different between Print system and Adornment system.
For LegendAdronmentLayer, in fact we draw everything in an image then draw the image on the map, so you cannot see anything under it.
For LegendPrinterLayer, we draw the legend items and map items on same canvas, so it looks label drawn on top of legend.
Could please try to set DrawingMode equal Raster to see whether that works?
Regards,
Don
Tested that MapPrinterLayer.DrawingMode = MapDrawingMode.Raster. It did not work.
I think it is ok to draw to the same canvas but the legend layer should keep the transparency that we set by backgroundmask.
any fix?
Hi Guangming,
I am sorry to hear that don’t works. Here I have a little confused, in your first topic you want to hide label under legend, but in your last reply it looks you want to shows labels and shapes because you set transparent background for legend. I think we should want to focus on one question first because the issue for print part is not easy for fix.
Regards,
Don
no, I did not want show labels and shapes. I meant the app should keep the level of transparency we set to the background mask of the legend layer: total transparent or solid.
we are talking about the same issue.
I don’t get: why this is difficult? this should be the same as this case - you have multiple polygon layers with different transparency levels.
is it possible to have a quick fix for this issue?
Hi guangming,
I think it’s hard, because the architecture of print part is a little complex than other part, so directly modify it maybe cause more issue.
Today I want to look into your issue and run our PrintPreview sample here: wiki.thinkgeo.com/wiki/File:ServicesEditionSample_PrintPreview_CS_WinForms_111115.zip
It looks the legend is above map both in map & print preview & bitmap. I think maybe I missed something in your project, could you please modify the sample so that it can reproduce your issue or build a simpler sample for that so I can see whether we can fix that quickly?
Regards,
Don
Cool, thanks,
I figured it out I should use LegendPrinterLayer not MapPrinterLayer.
Hi Guangming,
I am glad to hear that solved.
Regards,
Don