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

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

本文整理了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

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

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

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

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

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

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

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

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

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

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

  1. @Test
  2. public void fromJson() throws IOException {
  3. final String json = loadJsonFixture(SAMPLE_MULTIPOLYGON);
  4. MultiPolygon geo = MultiPolygon.fromJson(json);
  5. assertEquals(geo.type(), "MultiPolygon");
  6. assertEquals(geo.coordinates().get(0).get(0).get(0).longitude(), 102.0, DELTA);
  7. assertEquals(geo.coordinates().get(0).get(0).get(0).latitude(), 2.0, DELTA);
  8. assertFalse(geo.coordinates().get(0).get(0).get(0).hasAltitude());
  9. }

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

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

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

  1. @Test
  2. public void fromJson() throws IOException {
  3. final String json = loadJsonFixture(SAMPLE_POLYGON);
  4. Polygon geo = Polygon.fromJson(json);
  5. assertEquals("Polygon", geo.type());
  6. assertEquals(100.0, geo.coordinates().get(0).get(0).longitude(), DELTA);
  7. assertEquals(0.0, geo.coordinates().get(0).get(0).latitude(), DELTA);
  8. assertFalse(geo.coordinates().get(0).get(0).hasAltitude());
  9. }

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

  1. @Test
  2. public void fromJson() throws IOException {
  3. final String json = loadJsonFixture(SAMPLE_MULTILINESTRING);
  4. MultiLineString geo = MultiLineString.fromJson(json);
  5. assertEquals("MultiLineString", geo.type());
  6. assertEquals(geo.coordinates().get(0).get(0).longitude(), 100.0, DELTA);
  7. assertEquals(geo.coordinates().get(0).get(0).latitude(), 0.0, DELTA);
  8. assertFalse(geo.coordinates().get(0).get(0).hasAltitude());
  9. }

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

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

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

  1. @Test
  2. public void fromJson() throws IOException {
  3. final String json = loadJsonFixture(SAMPLE_MULTIPOINT);
  4. MultiPoint geo = MultiPoint.fromJson(json);
  5. assertEquals(geo.type(), "MultiPoint");
  6. assertEquals(geo.coordinates().get(0).longitude(), 100.0, DELTA);
  7. assertEquals(geo.coordinates().get(0).latitude(), 0.0, DELTA);
  8. assertEquals(geo.coordinates().get(1).longitude(), 101.0, DELTA);
  9. assertEquals(geo.coordinates().get(1).latitude(), 1.0, DELTA);
  10. assertFalse(geo.coordinates().get(0).hasAltitude());
  11. assertEquals(Double.NaN, geo.coordinates().get(0).altitude(), DELTA);
  12. }

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

  1. @Test
  2. public void fromJson() throws IOException {
  3. final String json = loadJsonFixture(SAMPLE_LINESTRING_FIXTURE);
  4. LineString geo = LineString.fromJson(json);
  5. assertEquals(geo.type(), "LineString");
  6. assertEquals(geo.coordinates().get(0).longitude(), 100.0, 0.0);
  7. assertEquals(geo.coordinates().get(0).latitude(), 0.0, 0.0);
  8. assertFalse(geo.coordinates().get(0).hasAltitude());
  9. }

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

  1. @Test
  2. public void fromJson() throws IOException {
  3. final String json = loadJsonFixture(SAMPLE_POINT);
  4. Point geo = Point.fromJson(json);
  5. assertEquals(geo.type(), "Point");
  6. assertEquals(geo.longitude(), 100.0, DELTA);
  7. assertEquals(geo.latitude(), 0.0, DELTA);
  8. assertEquals(geo.altitude(), Double.NaN, DELTA);
  9. assertEquals(geo.coordinates().get(0), 100.0, DELTA);
  10. assertEquals(geo.coordinates().get(1), 0.0, DELTA);
  11. assertEquals(geo.coordinates().size(), 2);
  12. assertFalse(geo.hasAltitude());
  13. }

相关文章