Hi all,

I've been developing an application recently that uses OpenLayers and
it has been very, very useful.  Thank you!

I ran into some difficulties with placing a fixed vector layer on the
map, a compass graphic that needs to be rotated to correspond with the
orientation of the map.  I had to kluge it a bit, so I just wanted to
get some feedback to see if maybe there is a better way.

I wanted the rotation of the compass graphic to be offloaded to the
client, so I used a vector layer containing a point feature stylized
with an externalGraphic.  That way the rotation can be specified
programmatically, which works great.  I specified isFixed on the
layer, but I found that the layer would still be affected by map
movement, and it would disappear on me.  So my solution to this was to
just let the Map object render this layer and then manually remove it
from the list of layers, so it would leave it alone from that point
on:

  OpenLayers.Util.removeItem(map.layers, compassLayer);

Pretty nasty.  So that's kluge number 1.  The other problem was that I
needed this layer to be placed in between my base layer and the
features drawn on top of it, so that it's always visible there in the
corner but doesn't interfere with events like clicks and drags used to
interact with my other vector features.  Since my compass layer lives
outside the main layer container within a fixed layer div, I found
that this line of code from the Map initializer was getting in the
way:

  this.layerContainerDiv.style.zIndex=this.Z_INDEX_BASE['Popup']-1;

It means that a new stacking context is created so any fixed layer has
to be either entirely above or below all the other layers.  My
solution here was to remove this style from map.layerContainerDiv.
Any potential problems with doing so?

I'm fine with throwing in a few workarounds, I just thought I'd see if
anyone had thoughts.

Best,
Kyle Cronan
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to