# Polygon

# Polygon


```
public class Polygon
```

<br />

*** ** * ** ***

A representation of a polygon object in a 3D map.

## Summary

| ### Public methods |
|---|---|
| `int` | `@https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/AltitudeMode https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/Polygon#getAltitudeMode()()` The altitude mode of the polygon, which specifies how altitude components in the coordinates are interpreted |
| `boolean` | `https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/Polygon#getDrawsOccludedSegments()()` Whether parts of the polygon which could be occluded are drawn or not. |
| `boolean` | `https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/Polygon#getExtruded()()` Whether the polygon is extruded to the ground. |
| `@https://developer.android.com/reference/androidx/annotation/ColorInt.html int` | `https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/Polygon#getFillColor()()` The fill color of the polygon in ARGB format, i.e. 0xffffffff. |
| `boolean` | `https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/Polygon#getGeodesic()()` Whether the polygon edges are interpreted as geodesic and follow the curvature of the Earth. |
| `https://developer.android.com/reference/java/lang/String.html` | `https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/Polygon#getId()()` A read-only unique identifier for this model. |
| `https://developer.android.com/reference/java/util/List.html<https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/Hole>` | `[getInnerCoordinates](https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/Polygon#getInnerCoordinates())()` **This method is deprecated.** Use `https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/Polygon#getInnerPaths()` instead. <br /> |
| `https://developer.android.com/reference/java/util/List.html<https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/Hole>` | `https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/Polygon#getInnerPaths()()` The inner coordinates of the polygon. |
| `https://developer.android.com/reference/java/util/List.html<https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/LatLngAltitude>` | `[getOuterCoordinates](https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/Polygon#getOuterCoordinates())()` **This method is deprecated.** Use `https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/Polygon#getPath()` instead. <br /> |
| `https://developer.android.com/reference/java/util/List.html<https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/LatLngAltitude>` | `https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/Polygon#getPath()()` The outer coordinates of the polygon. |
| `@https://developer.android.com/reference/androidx/annotation/ColorInt.html int` | `https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/Polygon#getStrokeColor()()` The stroke color of the polygon in ARGB format, i.e. 0xffffffff |
| `double` | `https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/Polygon#getStrokeWidth()()` The stroke width of the polygon in pixels. |
| `int` | `https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/Polygon#getZIndex()()` The draw order of the polygon. |
| `void` | `https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/Polygon#remove()()` Removes this polygon from the 3d map scene. |
| `void` | `https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/Polygon#setAltitudeMode(int)(@https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/AltitudeMode int value)` Sets the altitude mode of the polygon. |
| `void` | `https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/Polygon#setClickListener(com.google.android.gms.maps3d.OnPolygonClickListener)(@https://developer.android.com/reference/androidx/annotation/Nullable.html https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/OnPolygonClickListener listener)` Sets the listener for click events on the model. |
| `void` | `https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/Polygon#setDrawsOccludedSegments(boolean)(boolean value)` Sets whether parts of the polygon which could be occluded are drawn or not. |
| `void` | `https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/Polygon#setExtruded(boolean)(boolean value)` Sets whether the polygon is extruded to the ground. |
| `void` | `https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/Polygon#setFillColor(int)(@https://developer.android.com/reference/androidx/annotation/ColorInt.html int value)` Sets the fill color of the polygon in ARGB format, i.e. 0xffffffff. |
| `void` | `https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/Polygon#setGeodesic(boolean)(boolean value)` Sets whether the polygon edges are interpreted as geodesic and follow the curvature of the Earth. |
| `void` | `[setInnerCoordinates](https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/Polygon#setInnerCoordinates(java.util.List<com.google.android.gms.maps3d.model.Hole>))(https://developer.android.com/reference/java/util/List.html<https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/Hole> value)` **This method is deprecated.** Use `https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/Polygon#setInnerPaths(java.util.List<com.google.android.gms.maps3d.model.Hole>)` instead. <br /> |
| `void` | `https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/Polygon#setInnerPaths(java.util.List<com.google.android.gms.maps3d.model.Hole>)(https://developer.android.com/reference/java/util/List.html<https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/Hole> value)` Sets the inner coordinates of the polygon. |
| `void` | `[setOuterCoordinates](https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/Polygon#setOuterCoordinates(java.util.List<com.google.android.gms.maps3d.model.LatLngAltitude>))(https://developer.android.com/reference/java/util/List.html<https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/LatLngAltitude> value)` **This method is deprecated.** Use `https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/Polygon#setPath(java.util.List<com.google.android.gms.maps3d.model.LatLngAltitude>)` instead. <br /> |
| `void` | `https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/Polygon#setPath(java.util.List<com.google.android.gms.maps3d.model.LatLngAltitude>)(https://developer.android.com/reference/java/util/List.html<https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/LatLngAltitude> value)` Sets the outer coordinates of the polygon. |
| `void` | `https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/Polygon#setStrokeColor(int)(@https://developer.android.com/reference/androidx/annotation/ColorInt.html int value)` Sets the stroke color of the polygon in ARGB format, i.e. 0xffffffff |
| `void` | `https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/Polygon#setStrokeWidth(double)(double value)` Sets the stroke width of the polygon in pixels. |
| `void` | `https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/Polygon#setZIndex(int)(int value)` Sets the draw order of the polygon. |

## Public methods

### getAltitudeMode

```
@AltitudeMode
public int getAltitudeMode()
```

The altitude mode of the polygon, which specifies how altitude components in the coordinates are interpreted

### getDrawsOccludedSegments

```
public boolean getDrawsOccludedSegments()
```

Whether parts of the polygon which could be occluded are drawn or not. Polygons can be occluded by map geometry (e.g. buildings).

### getExtruded

```
public boolean getExtruded()
```

Whether the polygon is extruded to the ground. To extrude a polygon, the altitude mode must be either relativeToGround or absolute.

### getFillColor

```
public @ColorInt int getFillColor()
```

The fill color of the polygon in ARGB format, i.e. 0xffffffff.

### getGeodesic

```
public boolean getGeodesic()
```

Whether the polygon edges are interpreted as geodesic and follow the curvature of the Earth. When false, edges of the polygon are rendered as straight lines in screen space.

### getId

```
public String getId()
```

A read-only unique identifier for this model. This will assigned during creation and will be used to identify the polygon when updating or removing it.

### getInnerCoordinates

```
public List<Hole> [getInnerCoordinates](https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/Polygon#getInnerCoordinates())()
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/Polygon#getInnerPaths()` instead.

The inner coordinates of the polygon. A Polygon can contain multiple inner coordinates, which create multiple cut-outs inside the polygon.

### getInnerPaths

```
public List<Hole> getInnerPaths()
```

The inner coordinates of the polygon. A Polygon can contain multiple inner coordinates, which create multiple cut-outs inside the polygon.

### getOuterCoordinates

```
public List<LatLngAltitude> [getOuterCoordinates](https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/Polygon#getOuterCoordinates())()
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/Polygon#getPath()` instead.

The outer coordinates of the polygon.

### getPath

```
public List<LatLngAltitude> getPath()
```

The outer coordinates of the polygon.

### getStrokeColor

```
public @ColorInt int getStrokeColor()
```

The stroke color of the polygon in ARGB format, i.e. 0xffffffff

### getStrokeWidth

```
public double getStrokeWidth()
```

The stroke width of the polygon in pixels.

### getZIndex

```
public int getZIndex()
```

The draw order of the polygon.

### remove

```
public void remove()
```

Removes this polygon from the 3d map scene.

### setAltitudeMode

```
public void setAltitudeMode(@AltitudeMode int value)
```

Sets the altitude mode of the polygon.

### setClickListener

```
public void setClickListener(@Nullable OnPolygonClickListener listener)
```

Sets the listener for click events on the model.

### setDrawsOccludedSegments

```
public void setDrawsOccludedSegments(boolean value)
```

Sets whether parts of the polygon which could be occluded are drawn or not. Polygons can be occluded by map geometry (e.g. buildings).

### setExtruded

```
public void setExtruded(boolean value)
```

Sets whether the polygon is extruded to the ground. To extrude a polygon, the altitude mode must be either relativeToGround or absolute.

### setFillColor

```
public void setFillColor(@ColorInt int value)
```

Sets the fill color of the polygon in ARGB format, i.e. 0xffffffff.

### setGeodesic

```
public void setGeodesic(boolean value)
```

Sets whether the polygon edges are interpreted as geodesic and follow the curvature of the Earth. When false, edges of the polygon are rendered as straight lines in screen space.

### setInnerCoordinates

```
public void [setInnerCoordinates](https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/Polygon#setInnerCoordinates(java.util.List<com.google.android.gms.maps3d.model.Hole>))(List<Hole> value)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/Polygon#setInnerPaths(java.util.List<com.google.android.gms.maps3d.model.Hole>)` instead.

Sets the inner coordinates of the polygon.

### setInnerPaths

```
public void setInnerPaths(List<Hole> value)
```

Sets the inner coordinates of the polygon.

### setOuterCoordinates

```
public void [setOuterCoordinates](https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/Polygon#setOuterCoordinates(java.util.List<com.google.android.gms.maps3d.model.LatLngAltitude>))(List<LatLngAltitude> value)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developers.google.com/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/model/Polygon#setPath(java.util.List<com.google.android.gms.maps3d.model.LatLngAltitude>)` instead.

Sets the outer coordinates of the polygon.

### setPath

```
public void setPath(List<LatLngAltitude> value)
```

Sets the outer coordinates of the polygon.

### setStrokeColor

```
public void setStrokeColor(@ColorInt int value)
```

Sets the stroke color of the polygon in ARGB format, i.e. 0xffffffff

### setStrokeWidth

```
public void setStrokeWidth(double value)
```

Sets the stroke width of the polygon in pixels.

### setZIndex

```
public void setZIndex(int value)
```

Sets the draw order of the polygon.