Skip to content

Commit a6a4661

Browse files
committed
Call bbox adjustment just once
Signed-off-by: Michal Čihař <[email protected]>
1 parent c6dd8bb commit a6a4661

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/ShapeRecord.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -554,42 +554,36 @@ public function addPoint($point, $partIndex = 0) {
554554
switch ($this->shapeType) {
555555
case 0:
556556
//Don't add anything
557-
break;
557+
return;
558558
case 1:
559559
case 11:
560560
case 21:
561561
//Substitutes the value of the current point
562562
$this->SHPData = $point;
563-
$this->_adjustBBox($point);
564563
break;
565564
case 3:
566565
case 5:
567566
case 13:
568567
case 15:
569568
case 23:
570569
case 25:
571-
$this->_adjustBBox($point);
572-
573570
//Adds a new point to the selected part
574571
$this->SHPData['parts'][$partIndex]['points'][] = $point;
575-
576572
$this->SHPData['numparts'] = count($this->SHPData['parts']);
577573
$this->SHPData['numpoints'] = 1 + (isset($this->SHPData['numpoints']) ? $this->SHPData['numpoints'] : 0);
578574
break;
579575
case 8:
580576
case 18:
581577
case 28:
582-
583-
$this->_adjustBBox($point);
584-
585578
//Adds a new point
586579
$this->SHPData['points'][] = $point;
587580
$this->SHPData['numpoints'] = 1 + (isset($this->SHPData['numpoints']) ? $this->SHPData['numpoints'] : 0);
588581
break;
589582
default:
590583
$this->setError(sprintf('The Shape Type "%s" is not supported.', $this->shapeType));
591-
break;
584+
return;
592585
}
586+
$this->_adjustBBox($point);
593587
}
594588

595589
public function deletePoint($pointIndex = 0, $partIndex = 0) {

0 commit comments

Comments
 (0)