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

Alex Dean alex at crackpot.org
Tue Aug 31 10:10:22 EDT 2010


Thanks for the help.  I see that the 'default' style is being used to  
render the vertices, but I still don't understand how to prevent  
'undefined' labels from being applied to them.

I did look at the code for  
OpenLayers.Control.ModifyFeature.collectVertices, but I'm not sure  
what to do with it.  It doesn't appear that styling is applied at this  
point, except in the case of virtual vertices (which have the  
control's virtualStyle applied).  Could you explain a little more what  
you mean here?

I've also been trying to apply a rule like this:

new OpenLayers.Rule({
   filter: new OpenLayers.Filter.Comparison({
     type: OpenLayers.Filter.Comparison.EQUAL_TO,
     property: "name",
     value: undefined,
   }),
   symbolizer: {
     label: ""
   }
});

What do you think of this approach?  It seems like this might solve my  
problem, but I'm having some difficulties getting it applied properly.

thanks,
alex

On Aug 30, 2010, at 11:55 AM, Arnd Wippermann wrote:

> 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