[OpenLayers-Users] Vector select styles

Tim Schaub tschaub at openplans.org
Thu Apr 10 10:35:06 EDT 2008


Hey Bjorn-

Glad to see you find it useful.

For those who haven't followed recent style changes, the page below is a 
very nice use of "advanced context" for styles.

http://www.thematicmapping.org/experiments/openlayers/piecharts.html

Basically, you can have any value in a symbolizer (a symbolizer is what 
we used to call feature.style) be derived by any function that evaluates 
a feature for any feature property.  This includes feature attributes, 
feature geometry, or anything else you choose to store on a feature.

If you give an OpenLayers.Style instance a context property, then the 
all symbolizers will be evaluated in this context.  The 
styles-context.html example in our examples dir shows another use.

Bjorn, can you contribute these examples to our examples directory?  Any 
contributions of examples and documentation are greatly appreciated.

http://trac.openlayers.org/wiki/HowToContribute

Tim

Bjorn Sandvik wrote:
> Thanks for your response. It works:
> http://www.thematicmapping.org/experiments/openlayers/propsymbols.html
> 
> Bjorn
> 
> http://blog.thematicmapping.org
> 
> 
> Christopher Schmidt wrote:
>> On Wed, Apr 09, 2008 at 04:55:35PM +0100, Bjorn Sandvik wrote:
>>   
>>> Hi,
>>>
>>> I'm having a problem with hover styles using OpenLayers 2.6-rc1:
>>> http://www.thematicmapping.org/experiments/openlayers/propsymbols.html
>>>
>>> When you hover on of the circles the size is not preserved.
>>> Is there a way to define the "default" and "select" styles to be the same?
>>>     
>> In 2.6-rc2, this is fixed.
>>
>> In 2.6-rc1, you can do:
>>
>> StyleMap({'default': style, 'select': style});
>>
>> If you want to only change (for example) the color, and not the size,
>> you can do (in either version):
>>
>> StyleMap({'default': style, 'select': {strokeColor: '#0000ff'}});
>>
>> Regards,
>>   
> 
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> 
> !DSPAM:4033,47fd2432303661804284693!
> 




More information about the Users mailing list