/** * This method can identify sequences with no operations as equivalent to * Identity, but it does not try to nullify sequences of two opposite * operations. * @return true if this operation does not change coordinates. */ public boolean isIdentity() { for (CoordinateOperation op : sequence) { if (!op.isIdentity()) return false; } return true; } }
/** * Returns true if o is also an Identity CoordinateOperation. * * @param o The object to compare this ProjectedCRS against */ @Override public boolean equals(Object o) { if (this == o) { return true; } if (o instanceof CoordinateOperation) { return ((CoordinateOperation)o).isIdentity(); } return false; }
/** * Returns true if o is equals to <code>this</code>. * GeocentricTranslations are equals if they both are identity, or * if all their parameters are equal. * * @param o The object to compare this ProjectedCRS against */ @Override public boolean equals(Object o) { if (this == o) { return true; } if (o instanceof CoordinateOperation) { if (this.isIdentity() && ((CoordinateOperation)o).isIdentity()) { return true; } if (o instanceof GeocentricTranslation) { GeocentricTranslation gt = (GeocentricTranslation) o; return ((this.tx == gt.tx) && (this.ty == gt.ty) && (this.tz == gt.tz)); } } return false; }
/** * Returns true if o is equals to <code>this</code>. * SevenParametersTransformations are equals if they both are identity, or * if all their parameters are equal. * * @param o The object to compare this ProjectedCRS against */ @Override public boolean equals(Object o) { if (this == o) { return true; } if (o instanceof CoordinateOperation) { if (this.isIdentity() && ((CoordinateOperation)o).isIdentity()) { return true; } if (o instanceof SevenParameterTransformation) { SevenParameterTransformation transfo = (SevenParameterTransformation) o; return ((this.tx == transfo.tx) && (this.ty == transfo.ty) && (this.tz == transfo.tz) && (this.rx == transfo.rx) && (this.ry == transfo.ry) && (this.rz == transfo.rz) && (this.scale == transfo.scale) && (this.rotationConvention == transfo.rotationConvention) && (this.linearized == transfo.linearized)); } } return false; }
List<CoordinateOperation> result = new ArrayList<CoordinateOperation>(); for (CoordinateOperation op : sequence) { if (op != null && !op.isIdentity() && !(op instanceof CoordinateOperationSequence)) { result.add(op); } else if (op instanceof CoordinateOperationSequence) {
for (CoordinateOperation op1 : getGeographicTransformations(WGS84)) { for (CoordinateOperation op2 : targetDatum.getGeographicTransformations(WGS84)) { if (op1.equals(op2) || (op1.isIdentity() && op2.isIdentity())) { addGeographicTransformation(targetDatum, Identity.IDENTITY, true); } else {