/** * Create a Point from the given coordinates. * * @param lon The x axis value. Longitude in a geographic projection. * @param lat The y axis value. Latitude in a geographic projection. * @return Point instance. */ public static Point from(double lon, double lat) { return from(lon, lat, Double.NaN); }
/** * The z-axis coordinate in map units (degree, kilometer, meter, mile, foot * and inch). If your map is in a geographic projection, this will be the * Altitude. Otherwise, it will be the z coordinate of the map location in * your map units. * * @return the z-axis value of this point. */ public double alt() { return positions().alt(); }
@Test public void equalsHashCodeShouldDependByCoordinate() { Point base = Point.from(10, 20); Point same = Point.from(10, 20); Point different = Point.from(10, 21); assertThat(base.equals(null), is(false)); assertThat(base.equals(base), is(true)); assertThat(base.equals(same), is(true)); assertThat(base.equals(different), is(false)); assertThat(same.equals(different), is(false)); assertThat(base.hashCode() == base.hashCode(), is(true)); assertThat(base.hashCode() == same.hashCode(), is(true)); assertThat(base.hashCode() == different.hashCode(), is(false)); assertThat(same.hashCode() == different.hashCode(), is(false)); }
/** * Create a Point from the given coordinates. * * @param lon The x axis value. Longitude in a geographic projection. * @param lat The y axis value. Latitude in a geographic projection. * @param alt The z axis value. Altitude in a geographic projection. * @return Point instance. */ public static Point from(double lon, double lat, double alt) { return new Point(new SinglePosition(lon, lat, alt)); }
/** * The y-axis coordinate in map units (degree, kilometer, meter, mile, foot * and inch). If your map is in a geographic projection, this will be the * Latitude. Otherwise, it will be the y coordinate of the map location in * your map units. * * @return the y-axis value of this point. */ public double lat() { return positions().lat(); }
/** * Create a Point from the given coordinates. * * @param lon The x axis value. Longitude in a geographic projection. * @param lat The y axis value. Latitude in a geographic projection. * @param alt The z axis value. Altitude in a geographic projection. * @return Point instance. */ public static Point from(double lon, double lat, double alt) { return new Point(new SinglePosition(lon, lat, alt)); }
/** * Create a Point from the given coordinates. * * @param lon The x axis value. Longitude in a geographic projection. * @param lat The y axis value. Latitude in a geographic projection. * @return Point instance. */ public static Point from(double lon, double lat) { return from(lon, lat, Double.NaN); }
/** * The z-axis coordinate in map units (degree, kilometer, meter, mile, foot * and inch). If your map is in a geographic projection, this will be the * Altitude. Otherwise, it will be the z coordinate of the map location in * your map units. * * @return the z-axis value of this point. */ public double alt() { return positions().alt(); }