congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
PolygonOptions
Code IndexAdd Tabnine to your IDE (free)

How to use
PolygonOptions
in
com.google.android.gms.maps.model

Best Java code snippets using com.google.android.gms.maps.model.PolygonOptions (Showing top 20 results out of 315)

origin: googlemaps/android-maps-utils

/**
 * Gets a new PolygonOptions object containing styles for the GeoJsonPolygon
 *
 * @return new PolygonOptions object
 */
public PolygonOptions toPolygonOptions() {
  PolygonOptions polygonOptions = new PolygonOptions();
  polygonOptions.fillColor(mPolygonOptions.getFillColor());
  polygonOptions.geodesic(mPolygonOptions.isGeodesic());
  polygonOptions.strokeColor(mPolygonOptions.getStrokeColor());
  polygonOptions.strokeWidth(mPolygonOptions.getStrokeWidth());
  polygonOptions.visible(mPolygonOptions.isVisible());
  polygonOptions.zIndex(mPolygonOptions.getZIndex());
  polygonOptions.clickable(mPolygonOptions.isClickable());
  return polygonOptions;
}
origin: googlemaps/android-maps-utils

/**
 * Adds a DataPolygon to the map as a Polygon
 *
 * @param polygonOptions
 * @param polygon      contains coordinates for the Polygon
 * @return Polygon object created from given DataPolygon
 */
protected Polygon addPolygonToMap(PolygonOptions polygonOptions, DataPolygon polygon) {
  // First array of coordinates are the outline
  polygonOptions.addAll(polygon.getOuterBoundaryCoordinates());
  // Following arrays are holes
  List<List<LatLng>> innerBoundaries = polygon.getInnerBoundaryCoordinates();
  for (List<LatLng> innerBoundary : innerBoundaries) {
    polygonOptions.addHole(innerBoundary);
  }
  Polygon addedPolygon = mMap.addPolygon(polygonOptions);
  addedPolygon.setClickable(polygonOptions.isClickable());
  return addedPolygon;
}
origin: airbnb/AirMapView

public Builder<T> add(LatLng point) {
 this.polygonOptions.add(point);
 return this;
}
origin: airbnb/AirMapView

public Builder() {
 polygonOptions.strokeWidth(STROKE_WIDTH);
 polygonOptions.strokeColor(STROKE_COLOR);
}
origin: googlemaps/android-maps-utils

/**
 *Creates a new PolygonOption from given properties of an existing PolygonOption
 * @param originalPolygonOption An existing PolygonOption instance
 * @param isFill Whether the fill for a polygon is set
 * @param isOutline Whether the outline for a polygon is set
 * @return  A new PolygonOption
 */
private static PolygonOptions createPolygonOptions (PolygonOptions originalPolygonOption,
    boolean isFill, boolean isOutline) {
  PolygonOptions polygonOptions = new PolygonOptions();
  if (isFill) {
    polygonOptions.fillColor(originalPolygonOption.getFillColor());
  }
  if (isOutline) {
    polygonOptions.strokeColor(originalPolygonOption.getStrokeColor());
    polygonOptions.strokeWidth(originalPolygonOption.getStrokeWidth());
  }
  return polygonOptions;
}
origin: googlemaps/android-maps-utils

triangle.add(new LatLng(28.06025,-82.41030));  // Should match first point
mMap.addPolygon(new PolygonOptions()
    .addAll(triangle)
    .fillColor(Color.BLUE - ALPHA_ADJUSTMENT)
    .strokeColor(Color.BLUE)
    .strokeWidth(5));
mMap.addPolygon(new PolygonOptions()
    .addAll(simplifiedTriangle)
    .fillColor(Color.YELLOW - ALPHA_ADJUSTMENT)
    .strokeColor(Color.YELLOW)
    .strokeWidth(5));
mMap.addPolygon(new PolygonOptions()
    .addAll(oval)
    .fillColor(Color.BLUE - ALPHA_ADJUSTMENT)
    .strokeColor(Color.BLUE)
    .strokeWidth(5));
mMap.addPolygon(new PolygonOptions()
    .addAll(simplifiedOval)
    .fillColor(Color.YELLOW - ALPHA_ADJUSTMENT)
    .strokeColor(Color.YELLOW)
    .strokeWidth(5));
origin: googlemaps/android-samples

/**
 * Add a Polyline and a Polygon to the map.
 * The Polyline connects Melbourne, Adelaide and Perth. The Polygon is located in the Northern
 * Territory (Australia).
 */
private void addPolyObjects() {
  mMap.addPolyline((new PolylineOptions())
      .add(MELBOURNE, ADELAIDE, PERTH)
      .color(Color.GREEN)
      .width(5f));
  mMap.addPolygon(new PolygonOptions()
      .add(POLYGON)
      .fillColor(Color.CYAN)
      .strokeColor(Color.BLUE)
      .strokeWidth(5));
}
origin: googlemaps/android-samples

mMutablePolygon = map.addPolygon(new PolygonOptions()
    .addAll(createRectangle(CENTER, 5, 5))
    .addHole(createRectangle(new LatLng(-22, 128), 1, 1))
    .addHole(createRectangle(new LatLng(-18, 133), 0.5, 1.5))
    .fillColor(fillColorArgb)
    .strokeColor(strokeColorArgb)
    .strokeWidth(mStrokeWidthBar.getProgress())
    .clickable(mClickabilityCheckbox.isChecked()));
origin: bkhezry/ExtraMapUtils

count++;
googleMap.addPolygon(
    new PolygonOptions()
        .fillColor(polygon.getFillColor())
        .strokeColor(polygon.getUiOptions().getColor())
        .strokeWidth(polygon.getUiOptions().getWidth())
        .strokePattern(getStrokePattern(polygon.getUiOptions().getStrokePattern()))
        .zIndex(polygon.getUiOptions().getzIndex())
        .add(polygon.getPoints())
);
for (LatLng latLng : polygon.getPoints()) {
origin: wiglenet/wigle-wifi-wardriving

/**
 * Adds a KML Polygon to the map as a Polygon by combining the styling and coordinates
 *
 * @param polygon contains coordinates for the Polygon
 * @param style   contains relevant styling properties for the Polygon
 * @return Polygon object
 */
private Polygon addPolygonToMap(KmlPolygon polygon, KmlStyle style, KmlStyle inlineStyle) {
  PolygonOptions polygonOptions = style.getPolygonOptions();
  polygonOptions.addAll(polygon.getOuterBoundaryCoordinates());
  for (ArrayList<LatLng> innerBoundary : polygon.getInnerBoundaryCoordinates()) {
    polygonOptions.addHole(innerBoundary);
  }
  if (inlineStyle != null) {
    setInlinePolygonStyle(polygonOptions, inlineStyle);
  } else if (style.isPolyRandomColorMode()) {
    polygonOptions.fillColor(KmlStyle.computeRandomColor(polygonOptions.getFillColor()));
  }
  return mMap.addPolygon(polygonOptions);
}
origin: airbnb/AirMapView

@Override public <T> void addPolygon(AirMapPolygon<T> polygon) {
 try {
  JSONArray array = new JSONArray();
  for (LatLng point : polygon.getPolygonOptions().getPoints()) {
   JSONObject json = new JSONObject();
   json.put("lat", point.latitude);
   json.put("lng", point.longitude);
   array.put(json);
  }
  webView.loadUrl(String.format(Locale.US,
    "javascript:addPolygon(" + array.toString() + ", %1$d, %2$d, %3$d, %4$d);",
    polygon.getId(),
    (int) polygon.getPolygonOptions().getStrokeWidth(),
    polygon.getPolygonOptions().getStrokeColor(),
    polygon.getPolygonOptions().getFillColor()));
 } catch (JSONException e) {
  Log.e(TAG, "error constructing polyline JSON", e);
 }
}
origin: googlemaps/android-maps-utils

  public void testDefaultGetPolygonOptions() throws Exception {
    assertEquals(Color.TRANSPARENT, polygonStyle.toPolygonOptions().getFillColor());
    assertFalse(polygonStyle.toPolygonOptions().isGeodesic());
    assertEquals(Color.BLACK, polygonStyle.toPolygonOptions().getStrokeColor());
    assertEquals(10.0f, polygonStyle.toPolygonOptions().getStrokeWidth());
    assertTrue(polygonStyle.isVisible());
    assertEquals(0.0f, polygonStyle.toPolygonOptions().getZIndex());
  }
}
origin: commonsguy/cw-omnibus

new PolygonOptions().add(new LatLng(40.748429, -73.984573),
             new LatLng(40.753393, -73.996311),
             new LatLng(40.758393, -73.992705),
             new LatLng(40.753484, -73.980882))
          .strokeColor(Color.BLUE);
origin: airbnb/AirMapView

public Builder<T> strokeColor(int color) {
 polygonOptions.strokeColor(color);
 return this;
}
origin: googlemaps/android-maps-utils

  /**
   * Sets the fill color of the Polygon as a 32-bit ARGB color
   *
   * @param fillColor fill color value of the Polygon
   */
  public void setPolygonFillColor(int fillColor) {
    mPolygonOptions.fillColor(fillColor);
  }
}
origin: googlemaps/android-maps-utils

/**
 * Sets the stroke width of the Polygon in screen pixels
 *
 * @param strokeWidth stroke width value of the Polygon
 */
public void setPolygonStrokeWidth(float strokeWidth) {
  mPolygonOptions.strokeWidth(strokeWidth);
}
origin: googlemaps/android-maps-utils

/**
 * Creates a new PolygonStyle object
 */
public GeoJsonPolygonStyle() {
  mPolygonOptions = new PolygonOptions();
}
origin: googlemaps/android-maps-utils

  setInlinePolygonStyle(polygonOptions, inlineStyle);
} else if (style.isPolyRandomColorMode()) {
  polygonOptions.fillColor(KmlStyle.computeRandomColor(polygonOptions.getFillColor()));
origin: googlemaps/android-maps-utils

/**
 * Gets the fill color of the GeoJsonPolygon as a 32-bit ARGB color
 *
 * @return fill color of the GeoJsonPolygon
 */
public int getFillColor() {
  return mPolygonOptions.getFillColor();
}
origin: wiglenet/wigle-wifi-wardriving

/**
 * Adds a GeoJsonPolygon to the map as a Polygon
 *
 * @param polygonStyle contains relevant styling properties for the Polygon
 * @param polygon      contains coordinates for the Polygon
 * @return Polygon object created from given GeoJsonPolygon
 */
private Polygon addPolygonToMap(GeoJsonPolygonStyle polygonStyle, GeoJsonPolygon polygon) {
  PolygonOptions polygonOptions = polygonStyle.toPolygonOptions();
  // First array of coordinates are the outline
  polygonOptions.addAll(polygon.getCoordinates().get(POLYGON_OUTER_COORDINATE_INDEX));
  // Following arrays are holes
  for (int i = POLYGON_INNER_COORDINATE_INDEX; i < polygon.getCoordinates().size();
      i++) {
    polygonOptions.addHole(polygon.getCoordinates().get(i));
  }
  Polygon addedPolygon = mMap.addPolygon(polygonOptions);
  addedPolygon.setClickable(true);
  return addedPolygon;
}
com.google.android.gms.maps.modelPolygonOptions

Most used methods

  • fillColor
  • strokeColor
  • <init>
  • strokeWidth
  • addAll
  • add
  • getFillColor
  • getStrokeColor
  • getStrokeWidth
  • addHole
  • zIndex
  • geodesic
  • zIndex,
  • geodesic,
  • getZIndex,
  • isGeodesic,
  • isVisible,
  • visible,
  • clickable,
  • getPoints,
  • isClickable,
  • strokePattern

Popular in Java

  • Reading from database using SQL prepared statement
  • getContentResolver (Context)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getSharedPreferences (Context)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • Kernel (java.awt.image)
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now