com.mapbox.geojson.Point.hasAltitude()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(5.2k)|赞(0)|评价(0)|浏览(107)

本文整理了Java中com.mapbox.geojson.Point.hasAltitude()方法的一些代码示例,展示了Point.hasAltitude()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Point.hasAltitude()方法的具体详情如下:
包路径:com.mapbox.geojson.Point
类名称:Point
方法名:hasAltitude

Point.hasAltitude介绍

[英]Optionally, the coordinate spec in GeoJson allows for altitude values to be placed inside the coordinate array. If an altitude value was provided while initializing this instance, this will return true.
[中]或者,GeoJson中的坐标规范允许将高度值放置在坐标数组中。如果在初始化此实例时提供了高度值,则返回true。

代码示例

代码示例来源:origin: mapbox/mapbox-java

if (src.hasAltitude()) {
 rawCoordinates.add(new JsonPrimitive(unshiftedCoordinates.get(2)));

代码示例来源:origin: com.mapbox.mapboxsdk/mapbox-sdk-geojson

if (src.hasAltitude()) {
 rawCoordinates.add(new JsonPrimitive(unshiftedCoordinates.get(2)));

代码示例来源:origin: mapbox/mapbox-java

if (point.hasAltitude()) {
 bbox.add(new JsonPrimitive(unshiftedCoordinates.get(2)));
bbox.add(new JsonPrimitive(GeoJsonUtils.trim(unshiftedCoordinates.get(0))));
bbox.add(new JsonPrimitive(GeoJsonUtils.trim(unshiftedCoordinates.get(1))));
if (point.hasAltitude()) {
 bbox.add(new JsonPrimitive(unshiftedCoordinates.get(2)));

代码示例来源:origin: com.mapbox.mapboxsdk/mapbox-sdk-geojson

if (point.hasAltitude()) {
 bbox.add(new JsonPrimitive(unshiftedCoordinates.get(2)));
bbox.add(new JsonPrimitive(GeoJsonUtils.trim(unshiftedCoordinates.get(0))));
bbox.add(new JsonPrimitive(GeoJsonUtils.trim(unshiftedCoordinates.get(1))));
if (point.hasAltitude()) {
 bbox.add(new JsonPrimitive(unshiftedCoordinates.get(2)));

代码示例来源:origin: mapbox/mapbox-java

@Test
public void hasAltitude_returnsTrueWhenAltitudeIsPresent() throws Exception {
 Point point = Point.fromLngLat(1.0, 2.0, 5.0);
 assertTrue(point.hasAltitude());
}

代码示例来源:origin: mapbox/mapbox-java

@Test
public void fromJson() throws IOException {
 final String json = loadJsonFixture(SAMPLE_MULTIPOLYGON);
 MultiPolygon geo = MultiPolygon.fromJson(json);
 assertEquals(geo.type(), "MultiPolygon");
 assertEquals(geo.coordinates().get(0).get(0).get(0).longitude(), 102.0, DELTA);
 assertEquals(geo.coordinates().get(0).get(0).get(0).latitude(), 2.0, DELTA);
 assertFalse(geo.coordinates().get(0).get(0).get(0).hasAltitude());
}

代码示例来源:origin: mapbox/mapbox-java

@Test
public void hasAltitude_returnsFalseWhenAltitudeNotPresent() throws Exception {
 Point point = Point.fromLngLat(1.0, 2.0);
 assertFalse(point.hasAltitude());
}

代码示例来源:origin: mapbox/mapbox-java

@Test
public void fromJson() throws IOException {
 final String json = loadJsonFixture(SAMPLE_POLYGON);
 Polygon geo = Polygon.fromJson(json);
 assertEquals("Polygon", geo.type());
 assertEquals(100.0, geo.coordinates().get(0).get(0).longitude(), DELTA);
 assertEquals(0.0, geo.coordinates().get(0).get(0).latitude(), DELTA);
 assertFalse(geo.coordinates().get(0).get(0).hasAltitude());
}

代码示例来源:origin: mapbox/mapbox-java

@Test
public void fromJson() throws IOException {
 final String json = loadJsonFixture(SAMPLE_MULTILINESTRING);
 MultiLineString geo = MultiLineString.fromJson(json);
 assertEquals("MultiLineString", geo.type());
 assertEquals(geo.coordinates().get(0).get(0).longitude(), 100.0, DELTA);
 assertEquals(geo.coordinates().get(0).get(0).latitude(), 0.0, DELTA);
 assertFalse(geo.coordinates().get(0).get(0).hasAltitude());
}

代码示例来源:origin: mapbox/mapbox-java

@Test
public void fromJsonHoles() throws IOException {
 final String json = loadJsonFixture(SAMPLE_POLYGON_HOLES);
 Polygon geo = Polygon.fromJson(json);
 assertEquals("Polygon", geo.type());
 assertEquals(100.0, geo.coordinates().get(0).get(0).longitude(), DELTA);
 assertEquals(0.0, geo.coordinates().get(0).get(0).latitude(), DELTA);
 assertEquals(2, geo.coordinates().size());
 assertEquals(100.8, geo.coordinates().get(1).get(0).longitude(), DELTA);
 assertEquals(0.8, geo.coordinates().get(1).get(0).latitude(), DELTA);
 assertFalse(geo.coordinates().get(0).get(0).hasAltitude());
}

代码示例来源:origin: mapbox/mapbox-java

@Test
public void fromJson() throws IOException {
 final String json = loadJsonFixture(SAMPLE_MULTIPOINT);
 MultiPoint geo = MultiPoint.fromJson(json);
 assertEquals(geo.type(), "MultiPoint");
 assertEquals(geo.coordinates().get(0).longitude(), 100.0, DELTA);
 assertEquals(geo.coordinates().get(0).latitude(), 0.0, DELTA);
 assertEquals(geo.coordinates().get(1).longitude(), 101.0, DELTA);
 assertEquals(geo.coordinates().get(1).latitude(), 1.0, DELTA);
 assertFalse(geo.coordinates().get(0).hasAltitude());
 assertEquals(Double.NaN, geo.coordinates().get(0).altitude(), DELTA);
}

代码示例来源:origin: mapbox/mapbox-java

@Test
public void fromJson() throws IOException {
 final String json = loadJsonFixture(SAMPLE_LINESTRING_FIXTURE);
 LineString geo = LineString.fromJson(json);
 assertEquals(geo.type(), "LineString");
 assertEquals(geo.coordinates().get(0).longitude(), 100.0, 0.0);
 assertEquals(geo.coordinates().get(0).latitude(), 0.0, 0.0);
 assertFalse(geo.coordinates().get(0).hasAltitude());
}

代码示例来源:origin: mapbox/mapbox-java

@Test
public void fromJson() throws IOException {
 final String json = loadJsonFixture(SAMPLE_POINT);
 Point geo = Point.fromJson(json);
 assertEquals(geo.type(), "Point");
 assertEquals(geo.longitude(), 100.0, DELTA);
 assertEquals(geo.latitude(), 0.0, DELTA);
 assertEquals(geo.altitude(), Double.NaN, DELTA);
 assertEquals(geo.coordinates().get(0), 100.0, DELTA);
 assertEquals(geo.coordinates().get(1), 0.0, DELTA);
 assertEquals(geo.coordinates().size(), 2);
 assertFalse(geo.hasAltitude());
}

相关文章