# Class: Polygon

## bemap.Polygon(coordinates, options)

Base class for Polygon.

## Constructor

#### new Polygon(coordinates, options)

##### Parameters:

Name | Type | Description
--- | --- | ---
`coordinates` | bemap.Coordinate | Array of bemap.Coordinate.
`options` | Object | See below the available values. ###### Properties
Name | Type | Description
--- | --- | ---
`style` | bemap.LineStyle | Style of poyline used by the renderer.
`name` | String | Name of polygon.
`properties` | Object | custom object.

Source:
  - bemap-model/bemap-polygon.js, line 16

### Members

#### (protected) callback :function

##### Type:

- function

Source:
  - bemap-model/bemap-polygon.js, line 74

#### (protected) coords :Array.<bemap.Coordinate>

##### Type:

- Array.<bemap.Coordinate>

Source:
  - bemap-model/bemap-polygon.js, line 41

#### (protected) events :Array

##### Type:

- Array

Source:
  - bemap-model/bemap-polygon.js, line 68

#### (protected) id :String

##### Type:

- String

Source:
  - bemap-model/bemap-polygon.js, line 56

#### (protected) layer :Object

##### Type:

- Object

Source:
  - bemap-model/bemap-polygon.js, line 35

#### (protected) map :Object

##### Type:

- Object

Source:
  - bemap-model/bemap-polygon.js, line 29

#### (protected) name :String

##### Type:

- String

Source:
  - bemap-model/bemap-polygon.js, line 62

#### (protected) native :Object

##### Type:

- Object

Source:
  - bemap-model/bemap-polygon.js, line 23

#### (protected) properties :Object

##### Type:

- Object

Source:
  - bemap-model/bemap-polygon.js, line 80

#### (protected) style :bemap.LineStyle

##### Type:

- bemap.LineStyle

Source:
  - bemap-model/bemap-polygon.js, line 49

### Methods

#### addCoordinate(coordinate) → {bemap.Polygon}

Add a coordinate.

##### Parameters:

Name | Type | Description
--- | --- | ---
`coordinate` | bemap.Coordinate | bemap.Coordinate.

Source:
  - bemap-model/bemap-polygon.js, line 89

##### Returns:

this

Type
  bemap.Polygon

#### addLonLat(lon, lat) → {bemap.Polygon}

Add a coordinate.

##### Parameters:

Name | Type | Description
--- | --- | ---
`lon` | double | Longitude in degres deciaml (WGS84).
`lat` | double | Latitude in degres deciaml (WGS84).

Source:
  - bemap-model/bemap-polygon.js, line 104

##### Returns:

this

Type
  bemap.Polygon

#### (protected) draggable(callback, options) → {bemap.Listener}

Define the draggable capability for bemap.Polygon.

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | function | Function will be called when the specified eventType is occur.
`options` | object | Options. ###### Properties
Name | Type | Description
--- | --- | ---
`layerFilter` | bemap.Layer | set the bemap layer used as filter.

Source:
  - bemap-model/bemap-polygon.js, line 271

##### Returns:

bemap.listener.

Type
  bemap.Listener

#### getCoordinate(index) → {bemap.Coordinate}

Return the coordinate. See bemap.Coordinate.

##### Parameters:

Name | Type | Description
--- | --- | ---
`index` | int | Index of coordinate in polygon.

Source:
  - bemap-model/bemap-polygon.js, line 211

##### Returns:

Return the coordinate. See bemap.Coordinate.

Type
  bemap.Coordinate

#### getCoordinates() → {Array.<bemap.Coordinate>}

Return an array of coordinate. See bemap.Coordinate.

Source:
  - bemap-model/bemap-polygon.js, line 220

##### Returns:

Return an array of the coordinate. See bemap.Coordinate.

Type
  Array.<bemap.Coordinate>

#### getId() → {String}

Return the id of the polygon.

Source:
  - bemap-model/bemap-polygon.js, line 170

##### Returns:

Return the id of the polygon.

Type
  String

#### getLatLonArray(index) → {array}

Return an array with latitude and longitude in degres decimal (WGS94).

##### Parameters:

Name | Type | Description
--- | --- | ---
`index` | int | Index of coordinate in polygon.

Source:
  - bemap-model/bemap-polygon.js, line 125

##### Returns:

Return an array with latitude and longitude in degres decimal (WGS94).

Type
  array

#### getLatLonArrays() → {array}

Return an array with latitude and longitude in degres decimal (WGS94). Example: [ [lat, lon], [lat, lon], ... ]

Source:
  - bemap-model/bemap-polygon.js, line 153

##### Returns:

Return an array with latitude and longitude in degres decimal (WGS94).

Type
  array

#### getLonLatArray(index) → {array}

Return an array with longitude and latitude in degres decimal (WGS94).

##### Parameters:

Name | Type | Description
--- | --- | ---
`index` | int | Index of coordinate in polygon.

Source:
  - bemap-model/bemap-polygon.js, line 115

##### Returns:

Return an array with longitude and latitude in degres decimal (WGS94).

Type
  array

#### getLonLatArrays() → {array}

Return an array with longitude and latitude in degres decimal (WGS94). Example: [ [lon, lat], [lon, lat], ... ]

Source:
  - bemap-model/bemap-polygon.js, line 135

##### Returns:

Return an array with longitude and latitude in degres decimal (WGS94).

Type
  array

#### getName() → {String}

Return the name of the polygon.

Source:
  - bemap-model/bemap-polygon.js, line 190

##### Returns:

Return the name of the polygon.

Type
  String

#### getStyle() → {bemap.LineStyle}

Return the style of the polygon.

Source:
  - bemap-model/bemap-polygon.js, line 232

##### Returns:

Return the style of the polygon.

Type
  bemap.LineStyle

#### on(eventType, callback, options) → {bemap.Polygon}

Set the listner when an specified eventType occur on bemap.Polygon.

##### Parameters:

Name | Type | Description
--- | --- | ---
`eventType` | bemap.Map.EventType | Event type.
`callback` | function | Function will be called when the specified eventType is occur.
`options` | object | options.

Source:
  - bemap-model/bemap-polygon.js, line 256

##### Returns:

this.

Type
  bemap.Polygon

#### remove() → {bemap.Polygon}

Remove the Polygon from the layer.

Source:
  - bemap-model/bemap-polygon.js, line 241

##### Returns:

this

Type
  bemap.Polygon

#### setId(id) → {bemap.Polygon}

Define the id of polygon

##### Parameters:

Name | Type | Description
--- | --- | ---
`id` | String | the new id to set.

Source:
  - bemap-model/bemap-polygon.js, line 180

##### Returns:

this

Type
  bemap.Polygon

#### setName(name) → {bemap.Polygon}

Define the name of polygon

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | String | the new name to set.

Source:
  - bemap-model/bemap-polygon.js, line 200

##### Returns:

this

Type
  bemap.Polygon