Hi,

If you can narrow down which style properties are unique for each feature, instead of defining a unique style and use it as feature.style, you could define custom properties in the feature attributes to hold the unique values and use them in your context, as you do with ${type}.

  Here's a copy of the drawFeature method in Layer/Vector.js :
        if (typeof style != "object") {
            if(!style && feature.state === OpenLayers.State.DELETE) {
                style = "delete";
            }
            var renderIntent = style || feature.renderIntent;
            style = feature.style || this.style;
            if (!style) {
style = this.styleMap.createSymbolizer(feature, renderIntent);
            }
        }

  So, the feature style is obtained in that order of priority :
   * feature.style
   * layer.style
   * feature.renderIntent

In order to let the styleMap manage the feature style, you should avoid setting the feature.style directly.

Using this method, your layer styleMap should contain both default and select keys in order to work properly, with select containing the additionnal label: "${type}" property set.

  You could try that and see how it goes.

HTH,

Alexandre


On 12-07-30 02:56 PM, BERÉNYI Attila wrote:
Hi,

thank you for your response, it seems like I have not been clear enough.
If every single vector feature has its own style, the layer's styleMap object cannot be used (it looks like it is ignored, check here: http://gislab.hu/ol/selectFeature-selectStyle-propertyStyle-1.html) that's why I try to use selectStyle. I've update the original example as well: http://gislab.hu/ol/selectFeature-selectStyle-propertyStyle.html.

BR,
Attila

2012/7/30 Alexandre Dubé <[email protected] <mailto:[email protected]>>

    Hi,

      Instead of defining a selectStyle in the control, you could try
    setting a styleMap to your layer object.  This example should
    point you to the right direction since it uses a '${type}'
    symbolizer value and a select control :

    http://openlayers.org/dev/examples/graphic-name.html

    HTH,

    Alexandre

    P.S. Btw, this question would have been more suitable for the
    users mailing list.



    On 12-07-30 05:52 AM, BERÉNYI Attila wrote:
    Hi!

    I wanted to use the selectFeature control's selectStyle property
    to display a property-based label for the selected features,
    however, it seems that the selectStyle property doesn't support
    property-based styling.
    Example here:
    http://gislab.hu/ol/selectFeature-selectStyle-propertyStyle.html

    Is this a bug or am I doing something wrong?

    BR,
    Attila


    _______________________________________________
    Dev mailing list
    [email protected]  <mailto:[email protected]>
    http://lists.osgeo.org/mailman/listinfo/openlayers-dev


-- Alexandre Dubé
    Mapgears
    www.mapgears.com  <http://www.mapgears.com>


    _______________________________________________
    Dev mailing list
    [email protected] <mailto:[email protected]>
    http://lists.osgeo.org/mailman/listinfo/openlayers-dev




--
BERÉNYI Attila, PhD
ügyvezeto" igazgató

GISLab Hungary Kft.
1031 Budapest, Kadosa utca 59.
+36 20 457 1800



--
Alexandre Dubé
Mapgears
www.mapgears.com

_______________________________________________
Dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-dev

Reply via email to