| 147 | | /** |
|---|
| | 147 | /** Removes a layer from the map by removing its visual element (the |
|---|
| | 148 | * layer.div property), then removing it from the map's internal list |
|---|
| | 149 | * of layers, setting the layer's map property to null. |
|---|
| | 150 | * |
|---|
| | 151 | * a "removelayer" event is triggered. |
|---|
| | 152 | * |
|---|
| | 153 | * very worthy of mention is that simply removing a layer from a map |
|---|
| | 154 | * will not cause the removal of any popups which may have been created |
|---|
| | 155 | * by the layer. this is due to the fact that it was decided at some |
|---|
| | 156 | * point that popups would not belong to layers. thus there is no way |
|---|
| | 157 | * for us to know here to which layer the popup belongs. |
|---|
| | 158 | * |
|---|
| | 159 | * A simple solution to this is simply to call destroy() on the layer. |
|---|
| | 160 | * the default OpenLayers.Layer class's destroy() function |
|---|
| | 161 | * automatically takes care to remove itself from whatever map it has |
|---|
| | 162 | * been attached to. |
|---|
| | 163 | * |
|---|
| | 164 | * The correct solution is for the layer itself to register an |
|---|
| | 165 | * event-handler on "removelayer" and when it is called, if it |
|---|
| | 166 | * recognizes itself as the layer being removed, then it cycles through |
|---|
| | 167 | * its own personal list of popups, removing them from the map. |
|---|
| | 168 | * |
|---|