Skip to content

Commit

Permalink
Call bbox adjustment just once
Browse files Browse the repository at this point in the history
Signed-off-by: Michal Čihař <michal@cihar.com>
  • Loading branch information
nijel committed Nov 16, 2016
1 parent c6dd8bb commit a6a4661
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/ShapeRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -554,42 +554,36 @@ 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:
case 13:
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) {
Expand Down

0 comments on commit a6a4661

Please sign in to comment.