Hey all, just thought I'd give some updates since the geoscript-scala project has been pretty quiet lately. I
have been doing a bit of Scala hacking, but taking a break from the GeoScript API (and I still need to catch up with the examples section for the website. lame, i know.)
Instead I've been investigating some speed and maintainability improvements for the geocss package, and also extracted some of the core functionality out to a new "support" package. (Not sure if it's actually needed, but there's significant functionality in the CSS compiler which is not particularly geospatial in nature, so I wanted to set up some of that code to simply not have GeoTools in scope when building.)
Anyway, I am still sorting out some issues - these changes basically constitute a brain transplant for the geocss module and I don't have everything totally wired up yet. All the unit tests are passing, but:
- some selector constructs, notably feature ids, aren't recognized by the new simplifier yet, so some stylesheets that were previously compiled efficiently may produce unnecessarily large output now.
- the optimizations I added in involve processing the style rules out-of-order, and I haven't adjusted the logic for resolving CSS specificity to account for this yet, so stylesheets relying on specificity for overrides may have incorrect output now.
Hopefully I'll be able to resolve these issues in the near future, but I would like to go ahead and open it up for feedback/alpha testing. I won't be merging the improvements onto the master branch until the above-mentioned correctness issues are resolved, but in the meantime you can try out the simplifier-rewrite branch. I'm just looking for folks to try out existing styles and tools and let me know if things go awry.
After setting up SBT, you can run the translator against a CSS input file like so (it will overwrite an SLD with the same base file name so watch out.):
$ sbt 'css/run path/to/file.css'
You can also use the interactive Scala console to play around with the filter simplifier if you like:
$ sbt css/console
Welcome to Scala version 2.9.1.final (Java HotSpot(TM) Server VM, Java 1.6.0_30).
Type in expressions to have them evaluated.
Type :help for more information.
scala> reduce(cql("A > 1 AND A > 3"))
res0: org.opengis.filter.Filter = [ A > 3 ]
Or use 'sbt package' to produce jars for your own usage. These should be compatible with clients of the previous Java API, but note that the new support library is needed as well as the new version of geocss.
--
David Winslow