Hi,
the gt-css module is finally ready for merge into GeoTools:
https://github.com/geotools/geotools/pull/597
The work has been carried out so that it could benefit the rest of GeoTools
as much as possible.
In particular, in the pull request you'll see other commits that improve
the rest of the GeoTools library:
* All the style building is done with the fluent style builder that I've
contributed some time ago, improving
it where necessary (and adding a lot of missing copyright headers).
* The CSS contruction requires a lot of filter simplification, and in
particular, to properly handle range
based simplification, e.g. to understand that "a < 10 or (a between 10
and 20)" is equivalent to "a <= 20",
or that "a < 10 and a < 20" is equivalent to "a < 10", and so on, this
has been integrated into the
SimplifyingFilterVisitor (to work, a target feature type needs to be
known)
* The get/setURI (String) methods have been added back to the
ExternalGraphic interface to allow
for relative paths, allowing proper translation of relative paths
between CSS and SLD, and solving
GEOT-3235 in the process
The gt-css module contains a parser based on the parboiled java library,
which allows to build
elegant parsers a simple java code, that gets instrumented on the fly by
the library to build
a runtime parser. See the CSS parser to see what I mean:
https://github.com/aaime/geotools/blob/css_merge/modules/unsupported/css/src/main/java/org/geotools/styling/css/CssParser.java
The result of the parse is then turned into a list of SLD rules by:
* Separating the rules by z index and feature type, generating "flat" sets
of rules associated to a single z index
and single fature type
* Efficiently building the power set of said rules (cascading allows all
rules to combine with each other,
respecting the selectivity order of course)
* Translating the result in SLD via the fluent StyleBuilder contained in
gt-brewer
The power set building is interesting, the implementation works as a
"filtered power set" builder, where
combination of rules that make up a selector that cannot match no feature
are stored apart, making
sure that any superset of that combination is not even taken into
consideration to quickly prune down the
actual set of possible results.
Code coverage wise, there is a set of synthetic tests, plus a set of
"integration" tests where a source
css is compared to a target SLDs. These are coming from the Scala version
of the CSS parser,
with target SLD files being occasionally fixed (some of them contained
translation bugs in the Scala version,
I've tried to make the current ones as correct as possible).
The maven cobertura plugin does not seem to work, due to the runtime
instrumentation happening
in parboiled, but I managed to get a working code coverage report using the
Jacoco/Eclemma Eclipse
plugin, reporting a 73.6% code coverage inside src/main/java:
[image: Inline image 1]
For those what are wondering, I still haven't tried integrating this work
with the Eclipse
CSS plugin, but hopefully it won't be too hard. I plan to provide an option
to choose the Scala
or the Java based CSS parser/translator.
Cheers
Andrea
--
==
GeoServer Professional Services from the experts! Visit
http://goo.gl/NWWaa2 for more information.
==
Ing. Andrea Aime
@geowolf
Technical Lead
GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549
http://www.geo-solutions.it
http://twitter.com/geosolutions_it
*AVVERTENZE AI SENSI DEL D.Lgs. 196/2003*
Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo è consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.
The information in this message and/or attachments, is intended solely for
the attention and use of the named addressee(s) and may be confidential or
proprietary in nature or covered by the provisions of privacy act
(Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
Code).Any use not in accord with its purpose, any disclosure, reproduction,
copying, distribution, or either dissemination, either whole or partial, is
strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact
immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender
does not give any warranty or accept liability as the content, accuracy or
completeness of sent messages and accepts no responsibility for changes
made after they were sent or for other risks which arise as a result of
e-mail transmission, viruses, etc.
-------------------------------------------------------
------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk
_______________________________________________
GeoTools-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel