/** * Removes the common coordinate bits from a Geometry. The coordinates of the Geometry are * changed. * * @param geom the Geometry from which to remove the common coordinate bits * @return the shifted Geometry */ public Geometry removeCommonBits(Geometry geom) { if (commonCoord.x == 0.0 && commonCoord.y == 0.0) return geom; Coordinate invCoord = new Coordinate(commonCoord); invCoord.x = -invCoord.x; invCoord.y = -invCoord.y; Translater trans = new Translater(invCoord); geom.apply(trans); geom.geometryChanged(); return geom; }
/** * Adds the common coordinate bits back into a Geometry. The coordinates of the Geometry are * changed. * * @param geom the Geometry to which to add the common coordinate bits * @return the shifted Geometry */ public void addCommonBits(Geometry geom) { Translater trans = new Translater(commonCoord); geom.apply(trans); geom.geometryChanged(); }