[OpenLayers-Users] ModifyFeatrure Control and vertexRenderIntent

Robert Sanson Robert.Sanson at asurequality.com
Tue Apr 3 21:43:23 EDT 2012


I have a polygon vector layer which I have a ModifyFeature control set against. The default StyleMap for the layer has a label based on a name property. Unfortunately, I have not been able to turn off the labels for the vertices when a feature is selected for modification.

Here is my style map:

var crop_style = new OpenLayers.StyleMap({
    "default": new OpenLayers.Style(
        {
            pointRadius: 3,
            strokeColor: "#ff6103",
            fillColor: "#ffcc99",
            fillOpacity: 0.4,
            strokeWidth: 2,
            label: "${name}",
            fontColor: "blue",
            fontSize: 10,
            fontFamily: "Arial",
            fontWeight: "bold"
        }),
    "temporary": new OpenLayers.Style(
        {
            pointRadius: 3,
            strokeColor: "#ff6103",
            fillColor: "#ffcc99",
            fillOpacity: 0.4,
            strokeWidth: 2,
	    label: null
        }),
	"select": new OpenLayers.Style(
        {
            pointRadius: 3,
            strokeColor: "#ff6103",
            fillColor: "#0000ff",
            fillOpacity: 0.4,
            strokeWidth: 2,
	    label: null,
	    fontColor: null,
            fontSize: null,
            fontFamily: null,
            fontWeight: null
        }),
	"vertex": new OpenLayers.Style(
        {
            pointRadius: 4,
            strokeColor: "#ff6103",
            fillColor: "#ff0000",
            fillOpacity: 0.4,
            strokeWidth: 2,
	    label: null,
	    fontColor: null,
            fontSize: null,
            fontFamily: null,
            fontWeight: null
        })
  }, {extendDefault: false}
  );

Here are the controls that are specified against the layer:

var fpControls = {
                dpoint: new OpenLayers.Control.DrawFeature(fpts,OpenLayers.Handler.Point),
                modify: new OpenLayers.Control.ModifyFeature(fpts, {vertexRenderIntent: "vertex"}),
                delf: new OpenLayers.Control.SelectFeature(fpts, {onSelect: function(feature) {feature.attributes.pstate = "del";
                                                                                                 feature.style = style_fptsdel;
                                                                                                 fpts.drawFeature(feature);
                                                                                                 }
											}
									)
      };

I don't seem to get the "vertex" renderintent working. The vertices and pseudovertices all have a label "undefined", which stops me being able to drag them or delete them.

Any help appreciated.

Thanks,

Robert Sanson



This email and any attachments are confidential and intended solely for the addressee(s). If you are not the intended recipient, please notify us immediately and then delete this email from your system.

This message has been scanned for Malware and Viruses by Websense Hosted Security.
www.websense.com


More information about the Users mailing list