| | |
| | | Geometry geom = converter.toGeometry(factory); |
| | | if (geom == null) return null; |
| | | geom.apply(coordinatesFilter); |
| | | geom.geometryChanged(); |
| | | return geom; |
| | | } |
| | | |
| | | class TWD97ConvertFilter implements CoordinateSequenceFilter |
| | | { |
| | | private boolean done = false; |
| | | private boolean geometryChanged = false; |
| | | |
| | | public void filter(CoordinateSequence coordinateSequence, int i) |
| | | { |
| | | Coordinate pt = coordinateSequence.getCoordinateCopy(i); |
| | | Coordinate pt =coordinateSequence.getCoordinate(i); |
| | | Coordinate pt97 = TWDDatumConverter.fromTM2ToTWD97(pt); |
| | | pt.x = pt97.x; |
| | | pt.y = pt97.y; |
| | | pt.z = pt97.z; |
| | | done = (i >= coordinateSequence.size()); |
| | | geometryChanged = true; |
| | | } |
| | | |
| | | public boolean isDone() |
| | | { |
| | | return done; |
| | | return false; |
| | | } |
| | | |
| | | public boolean isGeometryChanged() |
| | | { |
| | | return geometryChanged; |
| | | return true; |
| | | } |
| | | |
| | | public void reset() |
| | | { |
| | | done = false; |
| | | geometryChanged = false; |
| | | } |
| | | } |
| | | } |
| | |
| | | */ |
| | | public static Coordinate fromTM2ToTWD97(Coordinate pt) |
| | | { |
| | | return fromTM2(TWD97_A,TWD97_ECC,TWD97_ECC2, 0, 121, TWD97_TM2, pt.x - 250000.0, pt.y); |
| | | Coordinate ptTWD97 = toTWD97(fromTM2(TWD67_A, TWD67_ECC, TWD67_ECC2, 0, 121, TWD67_TM2, pt.x - 250000.0, pt.y)); |
| | | Coordinate pt97TM2 = toTM2(TWD97_A, TWD97_ECC, TWD97_ECC2, 0, 121, TWD97_TM2, ptTWD97.x, ptTWD97.y); |
| | | pt97TM2.x += 250000; |
| | | return pt97TM2; |
| | | } |
| | | } |