X-Git-Url: https://git.rapsys.eu/packbundle/blobdiff_plain/5324c74e736bc74c7e05cc8740c1971ff82e3306..08027b19d895cc2ca5d510816b260f6598261534:/Util/MapUtil.php?ds=sidebyside diff --git a/Util/MapUtil.php b/Util/MapUtil.php index 62e6b30..407a649 100644 --- a/Util/MapUtil.php +++ b/Util/MapUtil.php @@ -14,7 +14,7 @@ namespace Rapsys\PackBundle\Util; use Symfony\Component\Routing\RouterInterface; /** - * Helps manage map + * Manages map */ class MapUtil { /** @@ -55,7 +55,7 @@ class MapUtil { const highStroke = '#3333c3'; /** - * The high stroke size + * The high stroke width */ const highStrokeWidth = 4; @@ -87,7 +87,7 @@ class MapUtil { const stroke = '#00c3f9'; /** - * The stroke size + * The stroke width */ const strokeWidth = 2; @@ -109,107 +109,82 @@ class MapUtil { const zoom = 17; /** - * The RouterInterface instance + * Creates a new map util + * + * @param RouterInterface $router The RouterInterface instance + * @param SluggerUtil $slugger The SluggerUtil instance */ - protected RouterInterface $router; + function __construct(protected RouterInterface $router, protected SluggerUtil $slugger, protected string $fill = self::fill, protected int $fontSize = self::fontSize, protected string $highFill = self::highFill, protected int $highFontSize = self::highFontSize, protected int $highRadius = self::highRadius, protected string $highStroke = self::highStroke, protected int $highStrokeWidth = self::highStrokeWidth, protected int $radius = self::radius, protected string $stroke = self::stroke, protected int $strokeWidth = self::strokeWidth) { + } /** - * The SluggerUtil instance + * Get fill color */ - protected SluggerUtil $slugger; + function getFill() { + return $this->fill; + } /** - * The fill color + * Get font size */ - public string $fill; + function getFontSize() { + return $this->fontSize; + } /** - * The font size + * Get high fill color */ - public int $fontSize; - - /** - * The high fill color - */ - public string $highFill; + function getHighFill() { + return $this->highFill; + } /** - * The font size + * Get high font size */ - public int $highFontSize; + function getHighFontSize() { + return $this->highFontSize; + } /** - * The radius size + * Get high radius size */ - public int $highRadius; + function getHighRadius() { + return $this->highRadius; + } /** - * The high stroke color + * Get high stroke color */ - public string $highStroke; + function getHighStroke() { + return $this->highStroke; + } /** - * The stroke size + * Get high stroke width */ - public int $highStrokeWidth; - - /** - * The stroke color - */ - public string $stroke; + function getHighStrokeWidth() { + return $this->highStrokeWidth; + } /** - * The stroke size + * Get radius size */ - public int $strokeWidth; + function getRadius() { + return $this->radius; + } /** - * The radius size + * Get stroke color */ - public int $radius; + function getStroke() { + return $this->stroke; + } /** - * Creates a new map util - * - * @param RouterInterface $router The RouterInterface instance - * @param SluggerUtil $slugger The SluggerUtil instance + * Get stroke width */ - function __construct(RouterInterface $router, SluggerUtil $slugger, string $fill = self::fill, int $fontSize = self::fontSize, string $highFill = self::highFill, int $highFontSize = self::highFontSize, int $highRadius = self::highRadius, string $highStroke = self::highStroke, int $highStrokeWidth = self::highStrokeWidth, int $radius = self::radius, string $stroke = self::stroke, int $strokeWidth = self::strokeWidth) { - //Set router - $this->router = $router; - - //Set slugger - $this->slugger = $slugger; - - //Set fill - $this->fill = $fill; - - //Set font size - $this->fontSize = $fontSize; - - //Set highFill - $this->highFill = $highFill; - - //Set high font size - $this->highFontSize = $highFontSize; - - //Set high radius size - $this->highRadius = $highRadius; - - //Set highStroke - $this->highStroke = $highStroke; - - //Set high stroke size - $this->highStrokeWidth = $highStrokeWidth; - - //Set radius size - $this->radius = $radius; - - //Set stroke - $this->stroke = $stroke; - - //Set stroke size - $this->strokeWidth = $strokeWidth; + function getStrokeWidth() { + return $this->strokeWidth; } /** @@ -252,6 +227,12 @@ class MapUtil { * @return array The multi map data */ public function getMultiMap(string $caption, int $updated, array $coordinates, int $width = self::width, int $height = self::height): array { + //Without coordinates + if (empty($coordinates)) { + //Return empty array + return []; + } + //Set latitudes $latitudes = array_map(function ($v) { return $v['latitude']; }, $coordinates);