Hi. My gut feeling (if you care :) is an incompatibility between addUniqueValueRules and the modify feature control. It sounds like the default style is display:none, so the modify feature control's handles dont get displayed. Eric
2008/8/5, George.Muammar <[EMAIL PROTECTED]>: > > Hi List, > > I have a functional ModifyFeatures control working on a Vector layer. > > When I added a StyleMap to the vector layer (so I my features are coloured > differently based on an attribute), the ModifyFeatures control does not work > any more! > > The behaviour is this: > > polygons: when I click on the feature it get's selected (and it becomes 100% > opaque) but no handles appear and there is no handle functionalities any > more. > > paths: can't even select it > > points: everything ok (select and drag works). > > > Did this happen to anyone ? > > Thanks > > > > Some code: > > here's how I define the style: > > var styleMap = new OpenLayers.StyleMap(); > var lookup = { > 1: {fillColor: "green", fillOpacity: 0.3, strokeColor: > "green",strokeWidth: 2}, > 2: {fillColor: "blue", fillOpacity: 0.3, strokeColor: > "blue", strokeWidth: 2}, > 3: {fillColor: "red", fillOpacity: 0.3, strokeColor: "red", > strokeWidth: 2} > }; > styleMap.addUniqueValueRules("default", "attribute", lookup); > > vLayer = new OpenLayers.Layer.Vector("Vettori", { > styleMap: styleMap > }); > > > here's how I create my controls: > > function addControls() > { > vLayer.display(true); > panel = new OpenLayers.Control.Panel({'displayClass': > 'olControlEditingToolbar'}); > > > conts = { > zoombox: new OpenLayers.Control.ZoomBox(), > > nav: new OpenLayers.Control.Navigation(), > > point: new OpenLayers.Control.DrawFeature(vLayer, > OpenLayers.Handler.Point, > {'displayClass': 'olControlDrawFeaturePoint', > featureAdded:feature_added}), > > line: new OpenLayers.Control.DrawFeature(vLayer, > OpenLayers.Handler.Path, > {'displayClass': 'olControlDrawFeaturePath', > featureAdded:feature_added}), > > polygon: new OpenLayers.Control.DrawFeature(vLayer, > OpenLayers.Handler.Polygon, > {'displayClass': 'olControlDrawFeaturePolygon', > featureAdded:feature_added}), > > rectangle: new OpenLayers.Control.DrawFeature(vLayer, > OpenLayers.Handler.RegularPolygon, > {handlerOptions: {sides: 4, irregular: true}, > 'displayClass': 'olControlDrawFeatureRectangle', > featureAdded:feature_added}), > > modify: new OpenLayers.Control.ModifyFeature(vLayer, > {'displayClass': 'olControlModifyFeature', > onModification: on_modification, > mode: > OpenLayers.Control.ModifyFeature.RESHAPE | > OpenLayers.Control.ModifyFeature.DRAG | > OpenLayers.Control.ModifyFeature.RESIZE | > OpenLayers.Control.ModifyFeature.ROTATE}) > > }; > > for(var key in conts) { > panel.addControls([conts[key]]); > } > > panel.activateControl(conts.nav); > > layerSwitcher = new > OpenLayers.Control.LayerSwitcher({'ascending':false}); > panZoomBar = new OpenLayers.Control.PanZoomBar() > permalink = new OpenLayers.Control.Permalink('permalink'); > > map.addControl( layerSwitcher ); > map.addControl( panZoomBar); > map.addControl(permalink); > map.addControl(panel); > > vLayer.display(true); > > } > > > -- > View this message in context: > http://www.nabble.com/StyleMap-and-ModifyFeatures-aren%27t-compatible---tp18827878p18827878.html > Sent from the OpenLayers Users mailing list archive at Nabble.com. > > _______________________________________________ > Users mailing list > Users@openlayers.org > http://openlayers.org/mailman/listinfo/users > _______________________________________________ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users