Polygon Class¶
- class BeastBytes\Yii\Leaflet\Layers\Vector\Polygon¶
Represents a Polygon on a map
@Template T of array{float, float}|array{float, float, float}|array{lat: float, lng: float}|array{lat: float, lng: float, alt: float}|LatLng
- __construct(array $locations, array $options = [])¶
Create a new Polygon instance
A polygon is defined by a list of geographical locations
The polygon is automatically closed and the list of geographical locations should not have a final location equal to the first
Multiple polygon definitions can be defined by passing a list of polygon definitions; the first polygon definition is the outer polygon, the other polygon definitions define holes in the outer polygon
- Parameters:
$locations (
list<T|list<T>>.) – A list of geographical locations or a list of lists of geographical locations$options (
array<string, mixed>.) – Polygon options
Inherited from Layer¶
- BeastBytes\Yii\Leaflet\Layers\Vector\Polygon::popup(string $content, array $options = [])¶
Binds a popup to the layer
- Parameters:
$content (
string) – The popup content$options (
array<string, mixed>.) – Popup options- Returns:
A new instance of Polygon with the popup
- Return type:
Polygon
- BeastBytes\Yii\Leaflet\Layers\Vector\Polygon::tooltip(string $content, array $options = [])¶
Binds a tooltip to the layer
- Parameters:
$content (
string) – The tooltip content$options (
array<string, mixed>.) – Tooltip options- Returns:
A new instance of Polygon with the tooltip
- Return type:
Polygon
Inherited from Component¶
- BeastBytes\Yii\Leaflet\Layers\Vector\Polygon::addToMap(bool $addToMap)¶
Whether to add the component to the map
By default, a component is added to the map.
- Parameters:
$addToMap (
bool) – Whether the component is added to the map- Returns:
A new instance of Polygon with the addToMap parameter set
- Return type:
Polygon
- BeastBytes\Yii\Leaflet\Layers\Vector\Polygon::getJsVar()¶
Returns the JavaScript variable name
- Returns:
The JavaScript variable name
- Return type:
string
- BeastBytes\Yii\Leaflet\Layers\Vector\Polygon::jsVar(string $jsVar)¶
Set the JavaScript variable name
- Parameters:
$jsVar (
string) – The JavaScript variable name- Returns:
A new instance of Polygon with the JavaScript variable name set
- Return type:
Polygon
See also