Opened 13 years ago
Closed 13 years ago
#230 closed defect (fixed)
Layer widget adds layers after some other widget layers
Reported by: | adube | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | widgets | Version: | |
Keywords: | Cc: |
Description
When using the <layer> and <mappanel> widgets instead of the <map> widget to create the resource OpenLayers.Layer objects, they are sometime created and added to the map after some other widget-specific layers.
For example, the redlining widget creates and add a blank vector layer which is added before the resources layers. Until the layer is brought to the top (zindex) when interacted with, for example using a feature handler, it stays behind every other layers.
Also, when using the new print preview widget (#227), layers are cloned to be printed. Since the redlining layer was added first, it's cloned and added first as well, thus resulting in having a layer hidden behind all the others.
Cause of this issue
Widgets that don't require to be linked to resources are created before those who are linked to resources. So, widgets that don't need to be linked to resources that create widgets are parsed first and create them first as well.
Solution
Have a new method in the .php file for the widgets that states that they create layers. Upon reordering in Config.php 'getAuthorizedWidgets', we could use this method to make sure they are added at the end.
Change History (3)
comment:1 by , 13 years ago
comment:2 by , 13 years ago
r1067, featuring :
- new "printallwidgetexecutions" event for OpenLayers.Map object (in both Map and MapPanel widgets)
- the following widgets listen to this to reorder their own created vector layer :
- GeoExtPrintForm
- VectorLayer
- ResultVectorLayer
- Redlining
More tests and comments to come.
comment:3 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
The following widgets create and add their layer after the Layer widgets, thus don't suffer the same issue.
The modified widgets now behave properly. Issue fixed.
Instead of the proposed solution mentioned above, we'll use a custom javascript event fired after all widgets have been printed (execution). Widgets creating layers that need to move them on top of all others could do so by listening to the event in an appropriate callback method.
We could define a custom OpenLayers.Map event for that.