org.geolatte.geom.crs.trans.EnvelopeTransform Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of geolatte-geom Show documentation
Show all versions of geolatte-geom Show documentation
This geoLatte-geom library offers a geometry model that conforms to the OGC Simple Features for SQL
specification.
The newest version!
package org.geolatte.geom.crs.trans;
import org.geolatte.geom.Envelope;
import org.geolatte.geom.Position;
import org.geolatte.geom.crs.CoordinateReferenceSystem;
/**
* Created by Karel Maesen, Geovise BVBA on 2019-03-28.
*/
public class EnvelopeTransform {
final private TransformOperation
operation;
public EnvelopeTransform(TransformOperation
operation) {
this.operation = operation;
}
public Envelope forward(Envelope envelope) {
P ll = envelope.lowerLeft();
P ur = envelope.upperRight();
Q tll = operation.forward(ll);
Q tur = operation.forward(ur);
return new Envelope<>(tll, tur, operation.getTarget());
}
public Envelope
reverse(Envelope envelope) {
Q ll = envelope.lowerLeft();
Q ur = envelope.upperRight();
P tll = operation.reverse(ll);
P tur = operation.reverse(ur);
return new Envelope<>(tll, tur, operation.getSource());
}
}