OpenLayers-Users - RootContainer styleMap problem- IE

by mortac8on 2010-05-04T03:44:36+00:00

In IE 7/8 when I create a SelectFeature control and pass in an array of
layers, all of my features' styles are lost (am using a custom StyleMap).
If I modify Control/SelectFeature:initLayer to pass the styleMap to the
RootContainer constructor, the styles will take effect if I redraw after
activating the tool. However IE makes such a redraw operation painfully
slow.
Is there any way in IE that I can activate the SelectFeature control with an
array of layers and have my features keep their styling without an expensive
redraw of the layers? As usual, this problem doesn't exist in other
browsers.
Ideas are greatly appreciated. Thanks!

Re: OpenLayers-Users - RootContainer styleMap problem- IE

by mortac8on 2010-05-04T03:55:15+00:00.

I forgot to add that my Point features with an externalGraphic retain their
styling (no problems). The loss of styling issue seems to only occur with
Polygons, Polylines, etc.

Re: OpenLayers-Users - RootContainer styleMap problem- IE

by Andreas Hocevaron 2010-05-04T10:55:46+00:00.
Hi,
posting an example that shows the issue would help. I suspect that your StyleMap has incomplete symbolizers.
Regards,
Andreas.

Re: OpenLayers-Users - RootContainer styleMap problem- IE

by mortac8on 2010-05-05T02:15:18+00:00.

It turns out my problem occurs because I am setting a custom layer.id after I
create an OpenLayers.Layer.
I guess my next question is: Is there any way to provide your own custom ID
when creating a layer? If you provide it via the options object, the div
never gets created.
>>

Re: OpenLayers-Users - RootContainer styleMap problem- IE

by Andreas Hocevaron 2010-05-05T07:20:16+00:00.
Hi,
The only workaround would be to do something like
var layer = new OpenLayers.Layer(...);
document.getElementById(layer.id).id = myCustomId;
layer.id = myCustomId;
The above should work, but is untested.
Regards,
Andreas.