日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

百度地图添加带有图案的多边形区域

發布時間:2023/12/29 编程问答 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 百度地图添加带有图案的多边形区域 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

日常的工作中繪制多邊形區域可以設置單色矩形區域,但是特殊需求下,需要繪制指定圖案的邊框,下面就簡單實現下

多種顏色矩形


/*** 繪制圍欄*/private void drawBitmapDescriptor(List<LatLng> points) {BitmapDescriptor custom1 = BitmapDescriptorFactory.fromResource(R.mipmap.icon_road_red_arrow);BitmapDescriptor custom2 = BitmapDescriptorFactory.fromResource(R.mipmap.icon_road_green_arrow);BitmapDescriptor custom3 = BitmapDescriptorFactory.fromResource(R.mipmap.icon_road_blue_arrow);//構造紋理隊列List<BitmapDescriptor> customList = new ArrayList<>();customList.add(custom1);customList.add(custom2);customList.add(custom3);List<Integer> index = new ArrayList<>();index.add(0);index.add(1);index.add(2);//構造對象OverlayOptions ooPolyline = new PolylineOptions().width(25).dottedLine(true).color(0xAAFF0000).points(points).customTextureList(customList).textureIndex(index);//添加到地圖mBaiduMap.addOverlay(ooPolyline);}單色多邊形


/*** 繪制圍欄*/private void drawBitmapDescriptor(List<LatLng> points) {BitmapDescriptor custom1 = BitmapDescriptorFactory.fromResource(R.mipmap.icon_road_red_arrow1);//構造紋理隊列List<BitmapDescriptor> customList = new ArrayList<>();customList.add(custom1);List<Integer> index = new ArrayList<>();index.add(0);//構造對象OverlayOptions ooPolyline = new PolylineOptions().width(25).dottedLine(true).color(0xAAFF0000).points(points).customTextureList(customList).textureIndex(index);//添加到地圖mBaiduMap.addOverlay(ooPolyline);}
可以看出其實單色和多色區別在于customList中的圖片數量,想要更絢麗的效果,大家自行發揮。

其中width用于設置邊框的寬度,dotterLine用于設置兩個圖片拼接中間是否有分割點,points是傳入的經緯度集合,customTextureList是邊框樣式

textureIndex是指添加的邊框集合中的索引,如果有多張圖的話,index索引的變化會改變邊框矩形樣式,如果custonTextureList中只有一個樣式的話,則index中添加幾次都只顯示一種樣式。

總結

以上是生活随笔為你收集整理的百度地图添加带有图案的多边形区域的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。