Skip to content

Datum.isEqual maybe have a bug #110

Description

@Accelerator-Li
    public boolean isEqual(Datum datum) {
        // false if tranforms are not equal
        if (getTransformType() != datum.getTransformType()) {
            return false;
        }
        // false if ellipsoids are not (approximately) equal
        if (ellipsoid.getEquatorRadius() != ellipsoid.getEquatorRadius()) { // <- maybe have a bug here
            if (Math.abs(ellipsoid.getEccentricitySquared()
                    - datum.ellipsoid.getEccentricitySquared()) > ELLIPSOID_E2_TOLERANCE)
                return false;
        }

        // false if transform parameters are not identical
        if (getTransformType() == TYPE_3PARAM || getTransformType() == TYPE_7PARAM) {
            for (int i = 0; i < transform.length; i++) {
                if (transform[i] != datum.transform[i])
                    return false;
            }
            return true;
        } else if (getTransformType() == TYPE_GRIDSHIFT) {
            return grids.equals(datum.grids);
        }
        return true; // datums are equal

    }

ellipsoid.getEquatorRadius() compare with itself, the condition is always false.
the condition should be

ellipsoid.getEquatorRadius() != datum.ellipsoid.getEquatorRadius()

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions