public int getZoneFromNearestMeridian(double longitude) { int zone = (int) Math.floor((MapMath.normalizeLongitude(longitude) + Math.PI) * 30.0 / Math.PI) + 1; if (zone < 1) zone = 1; else if (zone > 60) zone = 60; return zone; }
public int getZoneFromNearestMeridian(double longitude) { int zone = (int) Math.floor((MapMath.normalizeLongitude(longitude) + Math.PI) * 30.0 / Math.PI) + 1; if (zone < 1) zone = 1; else if (zone > 60) zone = 60; return zone; }
public int getZoneFromNearestMeridian(double longitude) { int zone = (int) Math.floor((MapMath.normalizeLongitude(longitude) + Math.PI) * 30.0 / Math.PI) + 1; if (zone < 1) zone = 1; else if (zone > 60) zone = 60; return zone; }
public int getZoneFromNearestMeridian(double longitude) { int zone = (int)Math.floor((MapMath.normalizeLongitude(longitude) + Math.PI) * 30.0 / Math.PI) + 1; if (zone < 1) zone = 1; else if (zone > 60) zone = 60; return zone; }
@Override public ProjectionPoint latLonToProj(LatLonPoint latLon, ProjectionPointImpl destPoint) { double fromLat = Math.toRadians(latLon.getLatitude()); double theta = Math.toRadians(latLon.getLongitude()); if (projectionLongitude != 0) { theta = MapMath.normalizeLongitude(theta - projectionLongitude); } Point2D.Double res = project(theta, fromLat, new Point2D.Double()); destPoint.setLocation(totalScale * res.x + falseEasting, totalScale * res.y + falseNorthing); return destPoint; }
@Override public ProjectionPoint latLonToProj(LatLonPoint latLon, ProjectionPointImpl destPoint) { double fromLat = Math.toRadians(latLon.getLatitude()); double theta = Math.toRadians(latLon.getLongitude()); if (projectionLongitude != 0) { theta = MapMath.normalizeLongitude(theta-projectionLongitude); } Point2D.Double res = project(theta, fromLat, new Point2D.Double()); destPoint.setLocation(totalScale * res.x + falseEasting, totalScale * res.y + falseNorthing); return destPoint; }
/** * Convert a LatLonPoint to projection coordinates * * @param latlon convert from these lat, lon coordinates * @param result the object to write to * @return the given result */ @Override public ProjectionPoint latLonToProj(LatLonPoint latlon, ProjectionPointImpl result) { double fromLat = Math.toRadians(latlon.getLatitude()); double theta = Math.toRadians(latlon.getLongitude()); if (projectionLongitude != 0 && !Double.isNaN(theta)) { theta = MapMath.normalizeLongitude(theta - projectionLongitude); } Point2D.Double out = new Point2D.Double(); out = project(theta, fromLat, out); result.setLocation(totalScale * out.x + falseEasting, totalScale * out.y + falseNorthing); return result; }
@Override public LatLonPoint projToLatLon(ProjectionPoint world, LatLonPointImpl result) { double fromX = (world.getX() - falseEasting) / totalScale; // assumes cartesian coords in km double fromY = (world.getY() - falseNorthing) / totalScale; Point2D.Double dst = projectInverse(fromX, fromY, new Point2D.Double()); if (dst.x < -Math.PI) dst.x = -Math.PI; else if (dst.x > Math.PI) dst.x = Math.PI; if (projectionLongitude != 0) dst.x = MapMath.normalizeLongitude(dst.x+projectionLongitude); result.setLongitude(Math.toDegrees(dst.x)); result.setLatitude(Math.toDegrees(dst.y)); return result; }
@Override public LatLonPoint projToLatLon(ProjectionPoint world, LatLonPointImpl result) { double fromX = (world.getX() - falseEasting) / totalScale; // assumes cartesian coords in km double fromY = (world.getY() - falseNorthing) / totalScale; Point2D.Double dst = projectInverse(fromX, fromY, new Point2D.Double()); if (dst.x < -Math.PI) dst.x = -Math.PI; else if (dst.x > Math.PI) dst.x = Math.PI; if (projectionLongitude != 0) dst.x = MapMath.normalizeLongitude(dst.x+projectionLongitude); result.setLongitude(Math.toDegrees(dst.x)); result.setLatitude(Math.toDegrees(dst.y)); return result; }
@Override public LatLonPoint projToLatLon(ProjectionPoint world, LatLonPointImpl result) { double fromX = (world.getX() - falseEasting) / totalScale; // assumes cartesian coords in km double fromY = (world.getY() - falseNorthing) / totalScale; Point2D.Double dst = projectInverse(fromX, fromY, new Point2D.Double()); if (dst.x < -Math.PI) dst.x = -Math.PI; else if (dst.x > Math.PI) dst.x = Math.PI; if (projectionLongitude != 0) dst.x = MapMath.normalizeLongitude(dst.x + projectionLongitude); result.setLongitude(Math.toDegrees(dst.x)); result.setLatitude(Math.toDegrees(dst.y)); return result; }
@Override public LatLonPoint projToLatLon(ProjectionPoint world, LatLonPointImpl result) { double fromX = (world.getX() - falseEasting) / totalScale; // assumes cartesian coords in km double fromY = (world.getY() - falseNorthing) / totalScale; Point2D.Double dst = projectInverse(fromX, fromY, new Point2D.Double()); if (dst.x < -Math.PI) dst.x = -Math.PI; else if (dst.x > Math.PI) dst.x = Math.PI; if (projectionLongitude != 0) dst.x = MapMath.normalizeLongitude(dst.x + projectionLongitude); result.setLongitude(Math.toDegrees(dst.x)); result.setLatitude(Math.toDegrees(dst.y)); return result; }
/** * Convert projection coordinates to a LatLonPoint * Note: a new object is not created on each call for the return value. * * @param world convert from these projection coordinates * @param result the object to write to * @return LatLonPoint convert to these lat/lon coordinates */ @Override public LatLonPoint projToLatLon(ProjectionPoint world, LatLonPointImpl result) { double fromX = (world.getX() - falseEasting) / totalScale; // assumes cartesian coords in km double fromY = (world.getY() - falseNorthing) / totalScale; Point2D.Double dst = projectInverse(fromX, fromY, new Point2D.Double()); if (dst.x < -Math.PI) { dst.x = -Math.PI; } else if (dst.x > Math.PI) { dst.x = Math.PI; } if (projectionLongitude != 0 && !Double.isNaN(dst.x)) { dst.x = MapMath.normalizeLongitude(dst.x + projectionLongitude); } result.setLatitude(Math.toDegrees(dst.y)); result.setLongitude(Math.toDegrees(dst.x)); return result; }
@Override public ProjectionPoint latLonToProj(LatLonPoint latLon, ProjectionPointImpl destPoint) { double fromLat = Math.toRadians(latLon.getLatitude()); double theta = Math.toRadians(latLon.getLongitude()); if (projectionLongitude != 0) { theta = MapMath.normalizeLongitude(theta - projectionLongitude); } ProjectionPoint res = project(theta, fromLat, new ProjectionPointImpl()); destPoint.setLocation(totalScale * res.getX() + falseEasting, totalScale * res.getY() + falseNorthing); return destPoint; }
@Override public ProjectionPoint latLonToProj(LatLonPoint latLon, ProjectionPointImpl destPoint) { double fromLat = Math.toRadians(latLon.getLatitude()); double theta = Math.toRadians(latLon.getLongitude()); if (projectionLongitude != 0) { theta = MapMath.normalizeLongitude(theta - projectionLongitude); } ProjectionPoint res = project(theta, fromLat, new ProjectionPointImpl()); destPoint.setLocation(totalScale * res.getX() + falseEasting, totalScale * res.getY() + falseNorthing); return destPoint; }
/** * Convert a LatLonPoint to projection coordinates * * @param latlon convert from these lat, lon coordinates * @param result the object to write to * @return the given result */ @Override public ProjectionPoint latLonToProj(LatLonPoint latlon, ProjectionPointImpl result) { double fromLat = Math.toRadians(latlon.getLatitude()); double theta = Math.toRadians(latlon.getLongitude()); if (projectionLongitude != 0 && !Double.isNaN(theta)) { theta = MapMath.normalizeLongitude(theta - projectionLongitude); } ProjectionPointImpl out = new ProjectionPointImpl(); project(theta, fromLat, out); result.setLocation(totalScale * out.getX() + falseEasting, totalScale * out.getY() + falseNorthing); return result; }
/** * Convert a LatLonPoint to projection coordinates * * @param latlon convert from these lat, lon coordinates * @param result the object to write to * @return the given result */ @Override public ProjectionPoint latLonToProj(LatLonPoint latlon, ProjectionPointImpl result) { double fromLat = Math.toRadians(latlon.getLatitude()); double theta = Math.toRadians(latlon.getLongitude()); if (projectionLongitude != 0 && !Double.isNaN(theta)) { theta = MapMath.normalizeLongitude(theta - projectionLongitude); } ProjectionPointImpl out = new ProjectionPointImpl(); project(theta, fromLat, out); result.setLocation(totalScale * out.getX() + falseEasting, totalScale * out.getY() + falseNorthing); return result; }
@Override public LatLonPoint projToLatLon(ProjectionPoint world, LatLonPointImpl result) { double fromX = (world.getX() - falseEasting) / totalScale; // assumes cartesian coords in km double fromY = (world.getY() - falseNorthing) / totalScale; ProjectionPointImpl dst = new ProjectionPointImpl(); projectInverse(fromX, fromY, dst); if (dst.getX() < -Math.PI) dst.setX(-Math.PI); else if (dst.getX() > Math.PI) dst.setX(Math.PI); if (projectionLongitude != 0) dst.setX(MapMath.normalizeLongitude(dst.getX() + projectionLongitude)); result.setLongitude(Math.toDegrees(dst.getX())); result.setLatitude(Math.toDegrees(dst.getY())); return result; }
@Override public LatLonPoint projToLatLon(ProjectionPoint world, LatLonPointImpl result) { double fromX = (world.getX() - falseEasting) / totalScale; // assumes cartesian coords in km double fromY = (world.getY() - falseNorthing) / totalScale; ProjectionPointImpl dst = new ProjectionPointImpl(); projectInverse(fromX, fromY, dst); if (dst.getX() < -Math.PI) dst.setX(-Math.PI); else if (dst.getX() > Math.PI) dst.setX(Math.PI); if (projectionLongitude != 0) dst.setX(MapMath.normalizeLongitude(dst.getX()) + projectionLongitude); result.setLongitude(Math.toDegrees(dst.getX())); result.setLatitude(Math.toDegrees(dst.getY())); return result; }
@Override public LatLonPoint projToLatLon(ProjectionPoint world, LatLonPointImpl result) { double fromX = (world.getX() - falseEasting) / totalScale; // assumes cartesian coords in km double fromY = (world.getY() - falseNorthing) / totalScale; ProjectionPointImpl dst = new ProjectionPointImpl(); projectInverse(fromX, fromY, dst); if (dst.getX() < -Math.PI) dst.setX(-Math.PI); else if (dst.getX() > Math.PI) dst.setX(Math.PI); if (projectionLongitude != 0) dst.setX(MapMath.normalizeLongitude(dst.getX() + projectionLongitude)); result.setLongitude(Math.toDegrees(dst.getX())); result.setLatitude(Math.toDegrees(dst.getY())); return result; }
@Override public LatLonPoint projToLatLon(ProjectionPoint world, LatLonPointImpl result) { double fromX = (world.getX() - falseEasting) / totalScale; // assumes cartesian coords in km double fromY = (world.getY() - falseNorthing) / totalScale; ProjectionPointImpl dst = new ProjectionPointImpl(); projectInverse(fromX, fromY, dst); if (dst.getX() < -Math.PI) dst.setX(-Math.PI); else if (dst.getX() > Math.PI) dst.setX(Math.PI); if (projectionLongitude != 0) dst.setX(MapMath.normalizeLongitude(dst.getX()) + projectionLongitude); result.setLongitude(Math.toDegrees(dst.getX())); result.setLatitude(Math.toDegrees(dst.getY())); return result; }