From 1df9c809d111821aef5b6aee75cac88ba8581a86 Mon Sep 17 00:00:00 2001 From: Masashi Katsumata Date: Sat, 7 Nov 2026 21:23:01 -0800 Subject: [PATCH 1/2] Interpolate the closing edge of geodesic polygons The geodesic ring was densified with createInterpolatePoints, which only interpolates between neighbouring points, so the closing edge (last vertex -> first) of a geodesic polygon was a straight chord in both fill and outline. Use android-sdk-core's densifyGeodesicRing. geodesic=false is unchanged. Requires the android-sdk-core release that adds densifyGeodesicRing. --- .../here/polygon/HerePolygonOverlayRenderer.kt | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/mapconductor/here/polygon/HerePolygonOverlayRenderer.kt b/src/main/java/com/mapconductor/here/polygon/HerePolygonOverlayRenderer.kt index 8862948..1cc4d3b 100644 --- a/src/main/java/com/mapconductor/here/polygon/HerePolygonOverlayRenderer.kt +++ b/src/main/java/com/mapconductor/here/polygon/HerePolygonOverlayRenderer.kt @@ -9,6 +9,7 @@ import com.mapconductor.core.ResourceProvider import com.mapconductor.core.features.GeoPoint import com.mapconductor.core.features.GeoPointInterface import com.mapconductor.core.features.GeoRectBounds +import com.mapconductor.core.geometry.densifyGeodesicRing import com.mapconductor.core.normalizeLng import com.mapconductor.core.polygon.AbstractPolygonOverlayRenderer import com.mapconductor.core.polygon.PolygonEntityInterface @@ -239,9 +240,8 @@ class HerePolygonOverlayRenderer( ): List = ( if (geodesic) { - com.mapconductor.core.spherical - .WGS84Geodesic - .createInterpolatePoints(points) + // 閉じる辺(末尾 → 先頭)も大圏で補間する(塗りと輪郭が同じネイティブポリゴン)。 + densifyGeodesicRing(points) } else { points } @@ -255,9 +255,8 @@ class HerePolygonOverlayRenderer( ): List = ( if (geodesic) { - com.mapconductor.core.spherical - .WGS84Geodesic - .createInterpolatePoints(points) + // 閉じる辺(末尾 → 先頭)も大圏で補間する(塗りと輪郭が同じネイティブポリゴン)。 + densifyGeodesicRing(points) } else { points } From 79b9f43a73e3c0a4b3ebeb348f5f63895df46f82 Mon Sep 17 00:00:00 2001 From: Masashi Katsumata Date: Sat, 7 Nov 2026 23:25:58 -0800 Subject: [PATCH 2/2] Densify non-geodesic polygon rings, closing edge included A geodesic=false polygon passed its raw vertices to HERE, so every edge was a straight Web Mercator segment, unlike polylines with geodesic=false (linear lat/lng interpolation), the other providers and ios-for-here. Use android-sdk-core's densifyPolygonRing for both modes; it closes the ring before densifying, so the closing edge (last vertex -> first) matches the others (it replaces the unreleased densifyGeodesicRing). Requires the android-sdk-core release that adds densifyPolygonRing. --- .../polygon/HerePolygonOverlayRenderer.kt | 25 ++++++------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/mapconductor/here/polygon/HerePolygonOverlayRenderer.kt b/src/main/java/com/mapconductor/here/polygon/HerePolygonOverlayRenderer.kt index 1cc4d3b..adf1b56 100644 --- a/src/main/java/com/mapconductor/here/polygon/HerePolygonOverlayRenderer.kt +++ b/src/main/java/com/mapconductor/here/polygon/HerePolygonOverlayRenderer.kt @@ -9,7 +9,7 @@ import com.mapconductor.core.ResourceProvider import com.mapconductor.core.features.GeoPoint import com.mapconductor.core.features.GeoPointInterface import com.mapconductor.core.features.GeoRectBounds -import com.mapconductor.core.geometry.densifyGeodesicRing +import com.mapconductor.core.geometry.densifyPolygonRing import com.mapconductor.core.normalizeLng import com.mapconductor.core.polygon.AbstractPolygonOverlayRenderer import com.mapconductor.core.polygon.PolygonEntityInterface @@ -238,14 +238,10 @@ class HerePolygonOverlayRenderer( points: List, geodesic: Boolean, ): List = - ( - if (geodesic) { - // 閉じる辺(末尾 → 先頭)も大圏で補間する(塗りと輪郭が同じネイティブポリゴン)。 - densifyGeodesicRing(points) - } else { - points - } - ).map { GeoCoordinates(it.latitude, normalizeLng(it.longitude)) } + // 閉じる辺(末尾 → 先頭)も他の辺と同じく補間する(塗りと輪郭が同じネイティブポリゴン)。 + // geodesic は大圏、geodesic=false は緯度経度の線形補間(ポリラインの false と同じ線)。 + densifyPolygonRing(points, geodesic) + .map { GeoCoordinates(it.latitude, normalizeLng(it.longitude)) } .let { pts -> if (pts.size >= 2 && pts.first() == pts.last()) pts.dropLast(1) else pts } /** [toRing] と同じ補間・正規化を、分割へ渡すため GeoPointInterface のまま返す。 */ @@ -253,14 +249,9 @@ class HerePolygonOverlayRenderer( points: List, geodesic: Boolean, ): List = - ( - if (geodesic) { - // 閉じる辺(末尾 → 先頭)も大圏で補間する(塗りと輪郭が同じネイティブポリゴン)。 - densifyGeodesicRing(points) - } else { - points - } - ).map { GeoPoint(latitude = it.latitude, longitude = normalizeLng(it.longitude)) } + // 閉じる辺(末尾 → 先頭)も他の辺と同じく補間する(塗りと輪郭が同じネイティブポリゴン)。 + // geodesic は大圏、geodesic=false は緯度経度の線形補間(ポリラインの false と同じ線)。 + densifyPolygonRing(points, geodesic).map { GeoPoint(latitude = it.latitude, longitude = normalizeLng(it.longitude)) } private fun boundsOf(points: List): GeoRectBounds? { if (points.isEmpty()) return null