Polygon
Example
#include "xtensor/containers/xarray.hpp"
#include "xleaflet/xmap.hpp"
#include "xleaflet/xpolygon.hpp"
xt::xarray<double> locations = {{42, -49}, {43, -49}, {43, -48}};
auto polygon = xlf::polygon::initialize();
polygon.locations = locations;
polygon.color = "green";
polygon.fill_color = "green";
polygon.finalize();
auto map = xlf::map::initialize();
map.center = xlf::map::point_type{42.5531, -48.6914};
map.zoom = 6;
map.finalize();
map.add_layer(polygon);
map
Attributes
Attribute |
Type |
Default Value |
Doc |
|---|---|---|---|
locations |
|
{} |
List of points of the polygon |
stroke |
|
true |
Set it to false to disable borders |
color |
|
“#0033FF” |
Color of the stroke |
opacity |
|
1.0 |
Opacity of the stroke |
weight |
|
5 |
Width of the stroke in pixels |
fill |
|
true |
Whether to fill the polygon or not |
fill_color |
|
“#0033FF” |
|
fill_opacity |
|
0.2 |
|
dash_array |
|
||
line_cap |
|
“round” |
|
line_join |
|
“round” |