Skip to content

Latest commit

 

History

History
71 lines (47 loc) · 1.88 KB

circle.md

File metadata and controls

71 lines (47 loc) · 1.88 KB

Circle

A Circle is similar to a Polygon in that you can define custom colors, weights, and opacities for the edge of the circle (the "stroke") and custom colors and opacities for the area within the enclosed region (the "fill"). Unlike a Polygon, you do not define paths for a Circle. Instead, a circle has two additional properties which define its shape: center of the circle, radius of the circle, in meters.

Build

First of all, if you want to render a circle, you will need to build one. So let's go:

use Ivory\GoogleMap\Base\Coordinate;
use Ivory\GoogleMap\Overlay\Circle;

$circle = new Circle(new Coordinate());

The circle constructor requires a coordinate as first argument which represents the center of the circle. It also accepts additional parameters such as radius (default 1.0) and options (default empty):

use Ivory\GoogleMap\Base\Coordinate;
use Ivory\GoogleMap\Overlay\Circle;

$circle = new Circle(new Coordinate(), 10, ['clickable' => false]);

Configure variable

A variable is automatically generated when creating a circle but if you want to update it, you can use:

$circle->setVariable('circle');

Configure center

If you want to update the center, you can use:

use Ivory\GoogleMap\Base\Coordinate;

$circle->setCenter(new Coordinate(1, 1));

Configure radius

If you want to update the radius, you can use:

$circle->setRadius(10);

Configure options

The circle options allows you to configure additional circle aspects. See the list of available options in the official documentation. Then, to configure them, you can use:

$circle->setOption('clickable', false);

Append to a map

After building your circle, you need to add it to a map with:

$map->getOverlayManager()->addCircle($circle);