From a6a466181e96caa71d3406b6e15d4351d9168893 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Wed, 16 Nov 2016 18:47:18 +0100 Subject: [PATCH] Call bbox adjustment just once MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michal Čihař --- src/ShapeRecord.php | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/ShapeRecord.php b/src/ShapeRecord.php index 23c186f..b73b04f 100644 --- a/src/ShapeRecord.php +++ b/src/ShapeRecord.php @@ -554,13 +554,12 @@ public function addPoint($point, $partIndex = 0) { switch ($this->shapeType) { case 0: //Don't add anything - break; + return; case 1: case 11: case 21: //Substitutes the value of the current point $this->SHPData = $point; - $this->_adjustBBox($point); break; case 3: case 5: @@ -568,28 +567,23 @@ public function addPoint($point, $partIndex = 0) { case 15: case 23: case 25: - $this->_adjustBBox($point); - //Adds a new point to the selected part $this->SHPData['parts'][$partIndex]['points'][] = $point; - $this->SHPData['numparts'] = count($this->SHPData['parts']); $this->SHPData['numpoints'] = 1 + (isset($this->SHPData['numpoints']) ? $this->SHPData['numpoints'] : 0); break; case 8: case 18: case 28: - - $this->_adjustBBox($point); - //Adds a new point $this->SHPData['points'][] = $point; $this->SHPData['numpoints'] = 1 + (isset($this->SHPData['numpoints']) ? $this->SHPData['numpoints'] : 0); break; default: $this->setError(sprintf('The Shape Type "%s" is not supported.', $this->shapeType)); - break; + return; } + $this->_adjustBBox($point); } public function deletePoint($pointIndex = 0, $partIndex = 0) {