[OpenLayers-Users] Detect geometry type of a wfs layer

Tondo gpktondo at gmail.com
Thu Aug 30 06:15:16 PDT 2012


Hi, 

Not sure what you want to achieve, but... maybe you could use stuff like
this:
vec.features[0].geometry.CLASS_NAME
"OpenLayers.Geometry.LineString"

If you know what kind of handler to use...

function setEditable(layer, handler /*"Point" or "Path" or "Polygon"*/) {
	snap.setLayer(layer);
	modifyControl.deactivate();
	modifyControl.layer = layer;
	modifyControl.selectControl.layer = layer;
	modifyControl.selectControl.handlers.feature.layer = layer;
	modifyControl.dragControl.layer = layer;
	modifyControl.dragControl.handlers.drag.layer = layer;
	modifyControl.dragControl.handlers.feature.layer = layer;
	drawControl.deactivate();
	drawControl.layer = layer;
	if (layer.features[0].geometry.CLASS_NAME ==
"OpenLayers.Geometry.MultiPolygon" || layer.features[0].geometry.CLASS_NAME
== "OpenLayers.Geometry.MultiLineString" ||
layer.features[0].geometry.CLASS_NAME == "OpenLayers.Geometry.MultiPoint") {
		drawControl.handler.multi = true;
		drawControl.handlerOptions.multi = true;
	} else {
		drawControl.handler.multi = false;
		drawControl.handlerOptions.multi = false;
	}
	drawControl.handler = new OpenLayers.Handler[handler]( //Nastavit handler
		drawControl, drawControl.callbacks, drawControl.handlerOptions
	);
}

Tom



--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Detect-geometry-type-of-a-wfs-layer-tp4998779p4998873.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list