etf-validator / governance

ETF Steering Group and the Technical Committee documents
1 stars 2 forks source link

Ring orientation fix with new deegree release in GmlGeoX v1 #96

Closed carlospzurita closed 2 years ago

carlospzurita commented 4 years ago

Background and Motivation:

In the PR https://github.com/deegree/deegree3/pull/1034 on the deegree repository, two auxiliar methods have been added to check the ring orientation: insInterior and isExterior, taking into account if the patch being validated is clockwise or not. This has been included on the release 3.4.12 that was integrated in the ETF in PR https://github.com/etf-validator/etf-gmlgeox/pull/25.

Proposed change

The next step would be to include this methods on the etf-gmlgeox module (version 1), in the class nl.vrom.roo.validator.core.dom4j.handlers.GMLValidationEventHandler. The proposal is to modify the current methods exteriorRingOrientation and interiorRingOrientation to make use of these methods, instead of checking directly if the geometry is clockwise and relying on deegree for this check

boolean exteriorRingOrientation( ExteriorRingOrientation evt ) {
    PolygonPatch patch = evt.getPatch();
    boolean isExterior = evt.isExterior();

    if(!isExterior) {
        String errMessage = ValidatorMessageBundle.getMessage(
                "validator.core.validation.geometry.exteriorRingCW",
                this.currentGmlId,
                this.currentOnderdeelName,
                ValidationUtil.getAffectedCoordinates(patch.getExteriorRing(), 60));
        this.validatorContext.addError(errMessage);
    }

    return isExterior;
}

boolean interiorRingOrientation( InteriorRingOrientation evt ) {
    PolygonPatch patch = evt.getPatch();
    boolean isInterior = evt.isInterior();

    if(!isInterior) {
        int idx = evt.getRindIdx();
        String errMessage = ValidatorMessageBundle.getMessage(
                "validator.core.validation.geometry.interiorRingCCW",
                this.currentGmlId,
                this.currentOnderdeelName,
                ValidationUtil.getAffectedCoordinates(patch.getInteriorRings().get(idx), 60),
                idx);
        this.validatorContext.addError(errMessage);
    }

    return isInterior;
}

Alternatives

Funding

This development is funded by JRC

Additional information

This development is intended for the currents INSPIRE datasets ETS that use BaseX. Given that the module is moving past this in the new ETF release, it was agreed that this will be kept on a separate "legacy" version of etf-gmlgeox

jonherrmann commented 4 years ago

Please open a Pull Request. EIPs are not the right place to review code.

At the moment we are not using GmlGeoX version 1 and I will not run any manual tests with it. So please make sure that your PR code is covered by unit tests.

jonherrmann commented 2 years ago

https://github.com/etf-validator/etf-gmlgeox/pull/26

jonherrmann commented 2 years ago

Implemented in Version 2.1.0