本文整理匯總了Java中com.google.android.gms.maps.model.PolygonOptions.add方法的典型用法代碼示例。如果您正苦於以下問題:Java PolygonOptions.add方法的具體用法?Java PolygonOptions.add怎麽用?Java PolygonOptions.add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.android.gms.maps.model.PolygonOptions
的用法示例。
在下文中一共展示了PolygonOptions.add方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addPolygon
import com.google.android.gms.maps.model.PolygonOptions; //導入方法依賴的package包/類
private void addPolygon(String name, Polygon poly, int color) {
final PolygonOptions polyOptions = new PolygonOptions();
final LineString exteriorRing = poly.getExteriorRing();
for (int iPnt = 0; iPnt < exteriorRing.getNumPoints(); iPnt++) {
final Point p = exteriorRing.getPointN(iPnt);
polyOptions.add(new LatLng(p.getY(), p.getX()));
}
for (int iHole = 0; iHole < poly.getNumInteriorRing(); iHole++) {
final LineString interiorRing = poly.getInteriorRingN(iHole);
final List<LatLng> holePnts = new ArrayList<LatLng>();
for (int iPnt = 0; iPnt < interiorRing.getNumPoints(); iPnt++) {
final Point pnt = interiorRing.getPointN(iPnt);
holePnts.add(new LatLng(pnt.getY(), pnt.getX()));
}
polyOptions.addHole(holePnts);
}
mMap.addPolygon(polyOptions
.strokeWidth(1)
.strokeColor(Color.DKGRAY)
.fillColor(color));
}
示例2: addCameraFootprint
import com.google.android.gms.maps.model.PolygonOptions; //導入方法依賴的package包/類
@Override
public void addCameraFootprint(FootPrint footprintToBeDraw) {
PolygonOptions pathOptions = new PolygonOptions();
pathOptions.strokeColor(FOOTPRINT_DEFAULT_COLOR).strokeWidth(FOOTPRINT_DEFAULT_WIDTH);
pathOptions.fillColor(FOOTPRINT_FILL_COLOR);
for (LatLong vertex : footprintToBeDraw.getVertexInGlobalFrame()) {
pathOptions.add(MapUtils.coordToLatLng(vertex));
}
getMap().addPolygon(pathOptions);
}
示例3: drawPolygon
import com.google.android.gms.maps.model.PolygonOptions; //導入方法依賴的package包/類
private void drawPolygon( LatLng startingLocation ) {
LatLng point2 = new LatLng( startingLocation.latitude + .001, startingLocation.longitude );
LatLng point3 = new LatLng( startingLocation.latitude, startingLocation.longitude + .001 );
PolygonOptions options = new PolygonOptions();
options.add(startingLocation, point2, point3);
options.fillColor( getResources().getColor( R.color.fill_color ) );
options.strokeColor( getResources().getColor( R.color.stroke_color ) );
options.strokeWidth( 10 );
getMap().addPolygon(options);
}
示例4: addCameraFootprint
import com.google.android.gms.maps.model.PolygonOptions; //導入方法依賴的package包/類
@Override
public void addCameraFootprint(FootPrint footprintToBeDraw) {
PolygonOptions pathOptions = new PolygonOptions();
pathOptions.strokeColor(FOOTPRINT_DEFAULT_COLOR).strokeWidth(FOOTPRINT_DEFAULT_WIDTH);
pathOptions.fillColor(FOOTPRINT_FILL_COLOR);
for (LatLong vertex : footprintToBeDraw.getVertexInGlobalFrame()) {
pathOptions.add(DroneHelper.CoordToLatLang(vertex));
}
getMap().addPolygon(pathOptions);
}
示例5: drawField
import com.google.android.gms.maps.model.PolygonOptions; //導入方法依賴的package包/類
/**
* 戦場1つを描畫する
*/
private void drawField(Field field) {
// マーカー定義
MarkerOptions markerOptions = new MarkerOptions();
markerOptions.title(field.getName()); // 名前を設定
markerOptions.snippet(field.getMemo()); // 説明を設定
markerOptions.position(calcCenter(field.getVertexes())); // マーカーの座標を設定(區畫の中心を自動算出)
markerOptions.icon(BitmapDescriptorFactory.defaultMarker(field.getColorHue())); // 色を設定
// マップにマーカーを追加
mGoogleMap.addMarker(markerOptions);
// 區畫を描畫
final LatLng[] vertexes = field.getVertexes();
if (vertexes != null && vertexes.length > 3) {
// ポリゴン定義
PolygonOptions polygonOptions = new PolygonOptions();
// RGBそれぞれの色を作成
final int[] colorRgb = field.getColorRgb();
int colorRed = colorRgb[0];
int colorGreen = colorRgb[1];
int colorBlue = colorRgb[2];
// 區畫の輪郭について設定
polygonOptions.strokeColor(Color.argb(0x255, colorRed, colorGreen, colorBlue));
polygonOptions.strokeWidth(5);
// 區畫の塗りつぶしについて設定
polygonOptions.fillColor(Color.argb(0x40, colorRed, colorGreen, colorBlue));
// 各頂點の座標を設定
polygonOptions.add(vertexes); // LatLngでもLatLng[]でもOK
// マップにポリゴンを追加
mGoogleMap.addPolygon(polygonOptions);
}
}
示例6: createPolygon
import com.google.android.gms.maps.model.PolygonOptions; //導入方法依賴的package包/類
/**
* Create polygon
* @param args
* @param callbackContext
* @throws JSONException
*/
@SuppressWarnings("unused")
private void createPolygon(final JSONArray args, final CallbackContext callbackContext) throws JSONException {
final PolygonOptions polygonOptions = new PolygonOptions();
int color;
LatLngBounds.Builder builder = new LatLngBounds.Builder();
JSONObject opts = args.getJSONObject(1);
if (opts.has("points")) {
JSONArray points = opts.getJSONArray("points");
List<LatLng> path = PluginUtil.JSONArray2LatLngList(points);
int i = 0;
for (i = 0; i < path.size(); i++) {
polygonOptions.add(path.get(i));
builder.include(path.get(i));
}
}
if (opts.has("strokeColor")) {
color = PluginUtil.parsePluginColor(opts.getJSONArray("strokeColor"));
polygonOptions.strokeColor(color);
}
if (opts.has("fillColor")) {
color = PluginUtil.parsePluginColor(opts.getJSONArray("fillColor"));
polygonOptions.fillColor(color);
}
if (opts.has("strokeWidth")) {
polygonOptions.strokeWidth(opts.getInt("strokeWidth") * this.density);
}
if (opts.has("visible")) {
polygonOptions.visible(opts.getBoolean("visible"));
}
if (opts.has("geodesic")) {
polygonOptions.geodesic(opts.getBoolean("geodesic"));
}
if (opts.has("zIndex")) {
polygonOptions.zIndex(opts.getInt("zIndex"));
}
Polygon polygon = map.addPolygon(polygonOptions);
String id = "polygon_"+ polygon.getId();
this.objects.put(id, polygon);
String boundsId = "polygon_bounds_" + polygon.getId();
this.objects.put(boundsId, builder.build());
JSONObject result = new JSONObject();
result.put("hashCode", polygon.hashCode());
result.put("id", id);
callbackContext.success(result);
}
示例7: buildPolygonOptions
import com.google.android.gms.maps.model.PolygonOptions; //導入方法依賴的package包/類
public static PolygonOptions buildPolygonOptions(TaggedPolygon<TaggedPoint> polygonRecord) {
PolygonOptions polygonOptions = new PolygonOptions();
for(TaggedPoint point : polygonRecord.getPoints())
polygonOptions.add(buildLatLng(point));
return polygonOptions;
}