[OpenLayers-Dev] KML Styling
Andreas Hocevar
andreas.hocevar at gmail.com
Mon Oct 15 10:01:22 EDT 2007
Hi,
On 10/15/07, Christopher Schmidt <crschmidt at metacarta.com> wrote:
> On Mon, Oct 15, 2007 at 03:16:43PM +0200, Andreas Hocevar wrote:
> > On 10/15/07, Christopher Schmidt <crschmidt at metacarta.com> wrote:
> The 'churn' I'm talking about is converting existing
> OpenLayers.Feature.Vector.style stuff to use OpenLayers.Style instead.
> I feel like there is some significant chunk of this in the code still. I
> could be wrong though, and this will all be a trivial replacement.
This is definitely something to pay attention to. I tried to mess
with existing OL code as little as possible, so I made the new
OpenLayers.Style co-exist with the existing style hashes. In fact,
the good old style hash is still the output of
OpenLayers.Style.createStyle, which is the only APIMethod of
OpenLayers.Style. And the two files ([1] - addFeatures, drawFeature,
setStyle and [2] - select) where existing code is changed check for
the CLASS_NAME of the style property. If it is "OpenLayers.Class",
then the createStyle() method is used to calculate the style for the
feature.
> Good feedback. Some of this depends on time, I'm sure. My feeling was
> just that creating an OpenLayers.Style object should be relatively easy
> once the KML style *parsing* and so on is done -- converting a
> {'hash':'of styles'} to an OpenLayers.style object is not much more than
> a find/replace, I don't think, especially if it's done right in the KML
> code.
After thinking twice, I would finally say you're right on that. The
OpenLayers.Style class in the ahocevar/sldRenderer sandbox is quite
simple. The core of the work was indeed the parser and also the
rules. For the parser, things probably are a lot different in KML.
And for the rules, I think there are none in KML.
Regards,
Andreas.
[1] http://trac.openlayers.org/browser/sandbox/ahocevar/sldRenderer/lib/OpenLayers/Layer/Vector.js
[2] http://trac.openlayers.org/browser/sandbox/ahocevar/sldRenderer/lib/OpenLayers/Control/SelectFeature.js
More information about the Dev
mailing list