Releases: urbancamo/javaapiforkml
Support for kml22gx.xsd extension
Release Notes
Bug Fixes
Style classes no longer emit stray default elements on marshal
IconStyle, LineStyle, and LabelStyle previously serialized <scale>, <heading>, and <width> elements even when callers never set them, because the underlying fields were primitive double (always 0.0) and JAXB's defaultValue only applies during unmarshalling. Affected fields have been converted to boxed Double so that unset (null) values are correctly omitted from output.
IconStyle.scale,IconStyle.headingLineStyle.widthLabelStyle.scale
Breaking change (source-level, mostly benign): getters now return Double and setters/fluent withX(...) methods accept Double. Callers passing double literals (e.g. withWidth(6.0)) remain source-compatible via autoboxing; callers passing integer literals (e.g. withWidth(1)) must add a decimal (withWidth(1.0)). Binary compatibility is broken — downstream jars must be recompiled.
New Features
Icon palette sheet (sprite sheet) support
Added support for the Google gx: extension elements gx:x, gx:y, gx:w, gx:h on the <Icon> element, allowing callers to select a sub-rectangle of a larger sprite sheet image. This unblocks consumption of KML feeds — including some NOAA/NWS weather products and Google Earth sample data — that use sprite-based icon palettes.
iconStyle.createAndSetIcon()
.withHref("https://example.com/weather-sprites.png")
.withX(0.0).withY(0.0)
.withW(138.0).withH(138.0);Produces:
<Icon>
<href>https://example.com/weather-sprites.png</href>
<gx:x>0.0</gx:x>
<gx:y>0.0</gx:y>
<gx:w>138.0</gx:w>
<gx:h>138.0</gx:h>
</Icon>The new fields are typed Double (nullable) rather than Integer — verified necessary against Google's own libkml golden fixture, which uses floating-point values like 3.2/4.3. The local kml22gx.xsd has been updated to document the four new elements.
Test Coverage
IconStyleTest— 11 tests covering unset/explicit/zero scenarios forIconStyle.scale/heading,LineStyle.width,LabelStyle.scale, plus a verbatim reproduction of the reported bug scenario.IconPaletteSheetTest— 5 tests covering defaults, marshal, unmarshal (both integer-form and float-form values), and round-trip.RealWorldNwsFixturesTest— 4 tests parsing real NOAA/WPC KML fixtures (QPF6hr_f00-f06_latest.kml,Day1_psnow_gt_12inches.kml,Day_1_Excessive_Rainfall_Outlook.kml), including a round-trip regression check that confirms no stray<scale>/<heading>/<width>elements get introduced when a real-world file is parsed and re-serialized.- New test fixtures:
libkml-all-gx.kml(from google/libkml, Apache 2.0, included with attribution header) and a syntheticicon_palette_sheet.kmlmodeled on the Google KML reference.
Total: 263 tests passing (up from 243).
Housekeeping
- Removed the unresolvable
maven-changelog-pluginreference frompom.xml(plugin last released 2014, no longer resolvable in modern Maven setups; only affectedmvn site, which this project doesn't publish).
3.1.0
This is a breaking release, designed to address the bug reported in Issue #60
Changes:
- IconStyle.scale and IconStyle.heading → Double
- LineStyle.width → Double
- LabelStyle.scale → Double
- Each class: getters, setters, fluent withX, equals(), hashCode() updated for nullability
- Example2.java test: withWidth(1) → withWidth(1.0) (int literals don't autobox to Double)
Breaking changes:
any Java code calling withWidth(1), withScale(2), etc. with integer literals will need a .0 suffix — everything else (double literals, variables, auto-unboxing to primitive) keeps working source-compatibly.
KML Namespace and Licensing
Issue 59 - jakarta namespace prefix default behaviour mitigation
- security fixes
- specify correct BSD license tag in pom.xml
Bug fixes, enhancements and move to central repo for publishing
Release 3.0.11 - bug fixes - migrated to maven central for publishing
v3.0.9
Issue 46
- Fix Icon.hashCode NPE
- Fix jUnit deprecation errors
Maven Release v3.0.9
v3.0.8
v3.0.7
Rebase following repository move
Issue 39 (#40) * Remove idea files from repo * Merge in urbancamo's branch pom. * Merge in urbancamo's branch pom. * - merge in urbancamo's branch source code to fix javadoc errors to allow release - update groupId in pom.xml to allow me to release via apache. * - update groupId in pom.xml to allow me to release via apache. * - updated docs. * - version 3.0.6 --------- Co-authored-by: Mark Wickens <msw@wickensonline.co.uk>