Hi, after discussing the pro and cons of evaluating rules by a pre-compiled string and eval() vs. an object-based representation of the ogc rules with Chris and Tim at the FOSS4G code sprint, I have to admit that avoiding eval() has several advantages:
- rules can be easily created independently from the sld parser (eg through a sld editor), and written out with a write() method, like with other formats. - better security - (maybe also) better performance I finally figured out a way to build an object tree with rules, including all requirements like recursively stacking logical operators. For this, I had to create a new class OpenLayers.Rule, with subclasses for the main types of rules, similar to those in the OGC filter spec sld. This class replaces the OpenLayers.Style.Rule hash we had before, and instances of this class (or its subclasses) are held in the rules array of an OpenLayers.Style instance. This Rule class has a method evaluate(feature), which is different for all rule types and returns true or false. I also rewrote parts of the SLD parser itself (OpenLayers.Format.SLD) for better readability of the code, by adding convenience methods and taking care of the length of code lines. I hope the progress I made will make it easier for you to move this sld thing into trunk. Regards, Andreas. On 10/1/07, Christopher Schmidt <[EMAIL PROTECTED]> wrote: > Andreas Hocevar and Pierre Giraud sat down on Friday at the code sprint > and got working on SLD rendering. > > The results of that are available at: > > http://dev.openlayers.org/sandbox/ahocevar/sldRenderer/examples/gml-layer-sld.html > > This small example demonstrates significant support for SLD parameters > and filters, parsing (as I understand it) a lot of the contents of the > file at: > > http://dev.openlayers.org/sandbox/ahocevar/sldRenderer/examples/xml/sld.xml > > Very cool work, and I'm looking forward to helping move the work back to > trunk! > > Regards, > -- > Christopher Schmidt > MetaCarta > _______________________________________________ > Dev mailing list > [email protected] > http://openlayers.org/mailman/listinfo/dev > _______________________________________________ Dev mailing list [email protected] http://openlayers.org/mailman/listinfo/dev
