I am currently tasked with reimplementation of an existing map solution based on your version 2.55 Win Forms library. That implementation has a feature where a number of background layers (roughly between 20 and 200 layers, average maybe 70?) are “dimmed” to allow easy recognition and interaction with “important” foreground layers (also maybe a dozen, perhaps dozens) of layers that are not “dimmed”.
So in my prototype, when the background layers are dimmed, I loop through all the layers in the background overlay and set their Transparency property to some value less than 255 (typically around 30). When I do this, zoom/pan performance is absolutely terrible, completely unusable.
Potentially relevant points:
1) These semi-opaque layers are almost all “shape file” layers.
2) I’m using LayerOverlay.TileCache = new InMemoryBitmapTileCache( ). But as expected, removing this does not improve performance.
3) It also uses a “mini map” from your samples. Again, removing it did not improve performance.
Can you provide suggestions for how this might be achieved in a way that performs acceptably well?
Performance problem with Layer.Transparency
It seems like this forum is the best (only practical?) way to get simple support from ThinkGeo. And almost all answers seem to come in the middle of the night for the US, so I’m assuming some sort of help desk in Asia? As such, I had hoped for something in response last night. If you can’t find a sample that does almost exactly what you want, the Wiki is not very useful, so I had hoped for timely answers here. Is there a better way?
Anyway, assuming TinkGeo support is looking at this, I have approval to submit a repro project to ThinkGeo support (privately) that uses a representative set of shape layers along with a simple UI that lets a user set the transparency (opacity) level. Please let me know if that might be helpful. This worked and performed very well in 2.55, and it is a solid requirement for us to maintain the same function in the new version, so I really have to find an answer for this poor performance issue.
Russ,
Applying the transparency would be a bit slower, it’s possible to be noticeable slow with 70~200 layers. I’m not sure why it is slow for panning though, as new image should come up only after the panning is completed. There should not have any rendering when panning the map.
Anyway, I think the best way is to set the transparency of the entire overlay instead of each layer. As we don’t have the API, a workaround would be drawing semi-transparent white on top of the layerOverlay to make it seems like “dimmed”. The overlays on top would not be dimmed so would stand out. Here is a quick way to do that (based on the US Demographic Map Sample)
demographicLayerOverlay.Drawn += demographicLayerOverlay_Drawn;
void demographicLayerOverlay_Drawn(object sender, DrawnOverlayEventArgs e)
{
e.GeoCanvas.DrawArea(e.GeoCanvas.CurrentWorldExtent, new GeoSolidBrush(GeoColor.FromArgb(150, 255, 255, 255)), DrawingLevel.LabelLevel);
}
Before:
After:
Ben
Nice, and thank you. I had considered that as a fallback, but had hoped to use the simple property for a nicer result instead.
And my comment on panning was in reference to the slow redraw after the pan is completed (for instance, mouse button released).
We should have added the transparency property to Desktop Overlay as well. It would make your code much simpler. Will add it in the future versions.