[OpenLayers-Users] Layers combobox update

Tondo gpktondo at gmail.com
Sat Nov 19 11:34:15 EST 2011


Hi,

I've got several WFS vector layers and I would like to make combo box, that
contains active layers and if changed, DrawFeature, ModifyFeature,
MoveFeature and DeleteFeature will change properties too.

I've got this:

/function comboChange() {
var drawOn = draw.active;
var modifyOn = modify.active;
var moveOn = move.active;
var delOn = delete.active;
var snapOn = snap.active;
var combo = document.getElementById("layersComboBox").value;
var layers = activeLayers();    //returns array of active layers 
     for (var i in layers) {
          if (layers[i].name == combo) {
                  var layer = layers[i];
                                                 }
                               }

if (snapOn) {
      snap.setlayer = layer;
                }

if (drawOn) {
      draw.deactivate();
      draw.layer = layer;

          //how to get geometry type of layer so I can set handler???

      if(drawOn) {
             draw.activate();
                     }
                }
else if(modifyOn) {
              modify.deactivate();
              modify.layer = layer;
              if(modifyOn) {
                     modify.activate();
                               }
                       }
else if(moveOn) {
              move.deactivate();
              move.layer = layer;
              if(moveOn) {
                    move.activate();
                              }
                     }
else if(delOn) {
              delete.deactivate();
              delete.layer = layer;
              if(delOn) {
                    delete.activate();
                           }
                   }
}/

My questions are:
What does need to be set beside /<control>.layer = layer;/ ?
How do I get geometry type of layer so I can set draw handler to
point/path/polygon?
Is there anything else I have to do?

Thank you very much

Tom

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Layers-combobox-update-tp7011629p7011629.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list