[OpenLayers-Dev] [OpenLayers-Trac] [OpenLayers] #1260:
SelectFeature and OpenLayers.Feature.Vector.style["select"]
Roald de Wit
rdewit at users.sourceforge.net
Wed Jan 16 22:46:04 EST 2008
Hi Andreas,
On Fri, 2008-01-11 at 11:39 +0100, Andreas Hocevar wrote:
> Take as an example a style map with styles ["default", "select"]. In
> that case, you would have two OL.Style objects, say myDefaultStyle and
> mySelectStyle. For the drawFeature and select methods proposed on the
> wiki to work, you would have to use an object looking like this as
> layer.style or feature.style:
>
> style = {
> 'default': /*OL.Style*/ myDefaultStyle,
> 'select': /*OL.Style*/ mySelectStyle
> }
Doing this creates a third possible style for a feature.style: a style
hash... That would only create confusion, wouldn't it?
I'd actually be very happy if the feature.style is a hash of OL.Style
objects. Having this would require changes in Layer.drawFeature, but
seems logical.
The way I see it then is:
- Control.SelectFeature adds the feature to the array of
layer.selectedFeatures, it then calls layer.drawFeature(feature)
- layer.drawFeature checks if the feature is in the list of
selectedFeatures. If so, it fetches feature.style.select. If not, it
takes feature.style.default.
- when layer.drawFeature is called with a second parameter, that can be
a style object or a name describing the render intent that is used to
lookup the style from the hash.
It would be good to have a deeper look into how we can integrate
OL.Style better into OL.
Kind regards,
Roald
P.S. Something else: Style.js is missing a method that extends a style
(or merges 2 styles).
--
Roald de Wit
Software Engineer
roald.dewit at lisasoft.com
Commercial Support for Open Source GIS Software
http://lisasoft.com/LISAsoft/SupportedProducts/
More information about the Dev
mailing list