[OpenLayers-Users] Style context doesn't work

totom tommaso.lavoro at gmail.com
Sun May 10 09:46:35 EDT 2009


Hi, I have a problem with style, stylemap and context.
Wath I need is to use an image for a WFS layer specified in the feature's
attributes.
Here is my code:

var pippo = {
                getImage: function(feature) {
                    var fixPath = 'style/images/features/';
                   return fixPath+"$(_status)_image.png";
                },
		getSize: function(feature){return 10;}
            };
var style = new OpenLayers.Style( 
			{
                           pointRadius: "$(getSize)", 
                           externalGraphic: "$(getImage)" 
                      }, 
			{context: pippo});
var selectedStyle = new OpenLayers.Style({pointRadius: 15});
var styleMap = new OpenLayers.StyleMap({'default': style, 'select':
selectedStyle});

and in the layer definition I set styleMap: styleMap.


Now, nothing is displayed in the map, and if I make a 
layer.styleMap.default.externalGraphic I get a funny "$(getImage)" -_-

What I'm doing wrong? Is possible that mootools (that i'm using ) with is $
function creates some troubles?

-- 
View this message in context: http://n2.nabble.com/Style-context-doesn%27t-work-tp2855557p2855557.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list