diff --git a/src/Element/Polyline/Polyline.php b/src/Element/Polyline/Polyline.php index 3b02357..731e1ea 100644 --- a/src/Element/Polyline/Polyline.php +++ b/src/Element/Polyline/Polyline.php @@ -9,7 +9,7 @@ class Polyline protected $colorGreen = 0; protected $colorBlue = 0; - public function __construct(string $polyline, int $colorRed, int $colorGreen, int $colorBlue) + public function __construct(string $polyline, int $colorRed = 0, int $colorGreen = 0, int $colorBlue = 0) { $this->polyline = $polyline; diff --git a/src/Printer.php b/src/Printer.php index 65232c6..f99853b 100644 --- a/src/Printer.php +++ b/src/Printer.php @@ -63,7 +63,6 @@ class Printer protected $useTileCache = true; - protected $useMapCache = false; protected $mapCacheBaseDir = '../cache/maps'; protected $mapCacheID = ''; @@ -262,7 +261,7 @@ class Printer $destinationLongitude = null; $color = imagecolorallocate($this->canvas->getImage(), $polyline->getColorRed(), $polyline->getColorGreen(), $polyline->getColorBlue()); - imagesetthickness($this->image, 3); + imagesetthickness($this->image, 5); //imageantialias($this->image, true); while (!empty($polylineList)) { diff --git a/web/staticmap.php b/web/staticmap.php index 9ae7f94..c4d967b 100644 --- a/web/staticmap.php +++ b/web/staticmap.php @@ -28,6 +28,7 @@ require_once '../vendor/autoload.php'; use StaticMapLite\Element\Marker\Marker; +use StaticMapLite\Element\Polyline\Polyline; use StaticMapLite\Printer; $printer = new Printer(); @@ -47,8 +48,8 @@ $markers = $_GET['markers']; if ($markers) { $markerList = explode('|', $markers); - foreach ($markerList as $marker) { - list($markerLatitude, $markerLongitude, $markerType) = explode(',', $marker); + foreach ($markerList as $markerData) { + list($markerLatitude, $markerLongitude, $markerType) = explode(',', $markerData); $marker = new Marker($markerType, $markerLatitude, $markerLongitude); @@ -56,4 +57,20 @@ if ($markers) { } } +$polylines = $_GET['polylines']; + +if ($polylines) { + $polylineList = explode('|', $polylines); + + foreach ($polylineList as $polylineData) { + list($polyline64String, $colorRed, $colorGreen, $colorBlue) = explode(',', $polylineData); + + $polylineString = base64_decode($polyline64String); + + $polyline = new Polyline($polylineString, $colorRed, $colorGreen, $colorBlue); + + $printer->addPolyline($polyline); + } +} + print $printer->showMap();