Skip to content

Commit 5d5d28c

Browse files
committed
Smaller gis svgs
Signed-off-by: Maximilian Krög <maxi_kroeg@web.de>
1 parent 5eaddaa commit 5d5d28c

5 files changed

Lines changed: 12 additions & 14 deletions

File tree

src/Gis/GisMultiPolygon.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,13 +272,13 @@ private function drawPath(string $polygon, ScaleData $scaleData): string
272272
{
273273
$pointsArr = $this->extractPoints1d($polygon, $scaleData);
274274

275-
$row = ' M ' . $pointsArr[0][0] . ', ' . $pointsArr[0][1];
275+
$row = 'M' . $pointsArr[0][0] . ',' . $pointsArr[0][1];
276276
$otherPoints = array_slice($pointsArr, 1, count($pointsArr) - 2);
277277
foreach ($otherPoints as $point) {
278-
$row .= ' L ' . $point[0] . ', ' . $point[1];
278+
$row .= 'L' . $point[0] . ',' . $point[1];
279279
}
280280

281-
$row .= ' Z ';
281+
$row .= 'Z';
282282

283283
return $row;
284284
}

src/Gis/GisPolygon.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,13 +235,13 @@ private function drawPath(string $polygon, ScaleData $scaleData): string
235235
{
236236
$pointsArr = $this->extractPoints1d($polygon, $scaleData);
237237

238-
$row = ' M ' . $pointsArr[0][0] . ', ' . $pointsArr[0][1];
238+
$row = 'M' . $pointsArr[0][0] . ',' . $pointsArr[0][1];
239239
$otherPoints = array_slice($pointsArr, 1, count($pointsArr) - 2);
240240
foreach ($otherPoints as $point) {
241-
$row .= ' L ' . $point[0] . ', ' . $point[1];
241+
$row .= 'L' . $point[0] . ',' . $point[1];
242242
}
243243

244-
$row .= ' Z ';
244+
$row .= 'Z';
245245

246246
return $row;
247247
}

tests/unit/Gis/GisGeometryCollectionTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,8 +379,7 @@ public static function providerForPrepareRowAsSvg(): array
379379
'svg',
380380
[176, 46, 224],
381381
new ScaleData(offsetX: 12, offsetY: 69, scale: 2, height: 150),
382-
'<path d=" M 46, 268 L -4, 248 L 6, 208 L 66, 198 Z M 16,'
383-
. ' 228 L 46, 224 L 36, 248 Z " data-label="svg"'
382+
'<path d="M46,268L-4,248L6,208L66,198ZM16,228L46,224L36,248Z" data-label="svg"'
384383
. ' class="polygon vector" stroke="black" stroke-width="0.5"'
385384
. ' fill="#b02ee0" fill-rule="evenodd" fill-opacity="0.8"/>',
386385
],

tests/unit/Gis/GisMultiPolygonTest.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -348,12 +348,11 @@ public static function providerForPrepareRowAsSvg(): array
348348
'svg',
349349
[176, 46, 224],
350350
new ScaleData(offsetX: -50, offsetY: -50, scale: 2, height: 400),
351-
'<path d=" M 110, 290 L 290, 290 L 290, 110 L 110, 110 Z M 120, 280 L 120, 220 L 180, 220 L 180, 28'
352-
. '0 Z M 220, 180 L 280, 180 L 280, 120 L 220, 120 Z " data-label="svg" class="multipolygon vector"'
353-
. ' stroke='
351+
'<path d="M110,290L290,290L290,110L110,110ZM120,280L120,220L180,220L180,280ZM220,180L280,180L280,120'
352+
. 'L220,120Z" data-label="svg" class="multipolygon vector" stroke='
354353
. '"black" stroke-width="0.5" fill="#b02ee0" fill-rule="evenodd" fill-opacity="0.8"'
355-
. '/><path d=" M 90, 310 L -90, 310 L -90, 490 L 90, 490 Z M 80, 320 L 80, 380 L 20, 380 L 20, 320 Z '
356-
. ' M -20, 420 L -80, 420 L -80, 480 L -20, 480 Z " data-label="svg" class="multipolygon vector"'
354+
. '/><path d="M90,310L-90,310L-90,490L90,490ZM80,320L80,380L20,380L20,320Z'
355+
. 'M-20,420L-80,420L-80,480L-20,480Z" data-label="svg" class="multipolygon vector"'
357356
. ' stroke="bla'
358357
. 'ck" stroke-width="0.5" fill="#b02ee0" fill-rule="evenodd" fill-opacity="0.8"/>',
359358
],

tests/unit/Gis/GisPolygonTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ public static function providerForPrepareRowAsSvg(): array
254254
'svg',
255255
[176, 46, 224],
256256
new ScaleData(offsetX: 12, offsetY: 69, scale: 2, height: 150),
257-
'<path d=" M 222, 288 L 22, 228 L 10, 162 Z M 174, 264 L 36, 218 L 26, 178 Z " data-label="svg"'
257+
'<path d="M222,288L22,228L10,162ZM174,264L36,218L26,178Z" data-label="svg"'
258258
. ' class="polygon vector" stroke="black" stroke-width="0.5" fill="#b02ee0" fill-rule="evenod'
259259
. 'd" fill-opacity="0.8"/>',
260260
],

0 commit comments

Comments
 (0)