gpt4 book ai didi

android - 在 map 上绘制的多边形的填充颜色问题

转载 作者:行者123 更新时间:2023-12-04 03:08:10 28 4
gpt4 key购买 nike

private void drawPolygon(List<LocationPointsModel> locationPoints, String fencingColor) {

mMap.clear();
PolygonOptions rectOptions = new PolygonOptions();
rectOptions.strokeColor(Color.parseColor(fencingColor));
rectOptions.strokeWidth(2);
String fillcolor = Constants.FILL_COLOR_GEOFENCE + fencingColor.substring(1);//creating opacity less color
rectOptions.fillColor(Color.parseColor(fillcolor));
LatLngBounds.Builder builder = new LatLngBounds.Builder();
int size = locationPoints.size();
for (int i = 0; i < size; i++) {
LatLng latLng = new LatLng(locationPoints.get(i).getLat(), locationPoints.get(i).getLon());
latList.add(latLng);
rectOptions.add(latLng);
}

Polygon polygon = mMap.addPolygon(rectOptions);
}

在某些情况下,如果多边形线相交,则填充颜色无法正确呈现。 Polygon Fill color Issue .是否可以用以下方式填充多边形。 Desired output .

最佳答案

Google Maps Android API 似乎不支持自相交多边形的填充颜色。

Google 问题跟踪器中有一个错误报告:

https://issuetracker.google.com/issues/35823225#comment15

Google 代表发表的第 15 条评论

We do not support self-intersecting polygons (either the outline or the hole intersecting)

文档中还提到了相交多边形和填充的问题。查看空心多边形部分

If the hole intersects the outline of the polygon, the polygon will be rendered without any fill.

https://developers.google.com/maps/documentation/android-api/shapes#create_a_hollow_polygon

看起来多边形交点和填充在 Maps Android API 中不兼容。

关于android - 在 map 上绘制的多边形的填充颜色问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47235351/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com