[OpenLayers-Users] 'undefined' at vertices while editing vectorlayer

Arnd Wippermann arnd.wippermann at web.de
Mon Aug 30 12:55:29 EDT 2010


Hi,

Most likely it's the label, what's undefined. 

OpenLayers use the default style for rendering the vertices and in this
context the attribute 'name' isn't defined. Were your color undefined, then
the renderer would use black to render the features, but doesn't display a
text message.

If you want to change this behaviour, then look at the function
OpenLayers.Control.ModifyFeature.collectVertices

Arnd

-----Ursprüngliche Nachricht-----
Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im
Auftrag von Alex Dean
Gesendet: Montag, 30. August 2010 16:10
An: users at openlayers.org
Betreff: [OpenLayers-Users] 'undefined' at vertices while editing
vectorlayer

When I define my own styling for a vector layer, I see 'undefined' at the
vertices while editing a feature.

Screenshot of feature when I'm not editing it :
http://skitch.com/alexdean/dwe1i/without-editing
Screenshot of feature while editing:
http://skitch.com/alexdean/dwe14/with-editing

Using Firebug/Firefox, I can see the following SVG for one vertex.
<circle id="OpenLayers.Geometry.Point_146" cx="827.6666666759318"  
cy="79.09283407817736" r="6" fill="undefined" fill-opacity="0.5"  
stroke="undefined" stroke-opacity="0.8" stroke-width="4" stroke-
linecap="round" stroke-linejoin="round" stroke-dasharray="none"/>

I see 'undefined' is the value use for 'fill' and 'stroke', so I imagine one
of these may be the problem.  I can't figure out what keys I need to define
in my style objects to resolve this problem.  Can someone help?

This is how I've defined the layer:

wfs = new OpenLayers.Layer.Vector("Regions", {
   styleMap: new OpenLayers.StyleMap( {
     'default':{
       label: "${name}",
       fillColor: "${color}",
       fillOpacity: 0.5,
       strokeColor: "${color}",
       strokeOpacity: 0.8,
       strokeWidth: 4,
       pointRadius: 6,
       fontColor: "#000000",
       fontSize: "24px",
       fontFamily: "Courier New, monospace",
       fontWeight: "bold"
     }
   })
});

The edit control is defined as follows:

var edit = new OpenLayers.Control.ModifyFeature(wfs, {
   title: "Edit Existing Region",
   displayClass: "olControlModifyFeature"
});

As you can see in the screenshots, the 'color' attribute (eg "$
{color}") has been set for the feature in question and is rendered correctly
when I'm not editing the feature.  The 'undefined' text only appears when I
edit the feature using an instance of OpenLayers.Control.ModifyFeature.

thanks,
alex
_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users




More information about the Users mailing list