@@ -27,6 +27,8 @@ discard block |
||
| 27 | 27 | * along with this program; if not, you can download one from |
| 28 | 28 | * http://www.gnu.org/copyleft/gpl.html. |
| 29 | 29 | * |
| 30 | + * @param string $type |
|
| 31 | + * @param string $data |
|
| 30 | 32 | */ |
| 31 | 33 | function loadData($type, $data) { |
| 32 | 34 | if (!$data) return $data; |
@@ -34,6 +36,9 @@ discard block |
||
| 34 | 36 | return current($tmp); |
| 35 | 37 | } |
| 36 | 38 | |
| 39 | + /** |
|
| 40 | + * @param string $binValue |
|
| 41 | + */ |
|
| 37 | 42 | function swap($binValue) { |
| 38 | 43 | $result = $binValue{strlen($binValue) - 1}; |
| 39 | 44 | for($i = strlen($binValue) - 2; $i >= 0 ; $i--) { |
@@ -43,6 +48,9 @@ discard block |
||
| 43 | 48 | return $result; |
| 44 | 49 | } |
| 45 | 50 | |
| 51 | + /** |
|
| 52 | + * @return string |
|
| 53 | + */ |
|
| 46 | 54 | function packDouble($value, $mode = 'LE') { |
| 47 | 55 | $value = (double)$value; |
| 48 | 56 | $bin = pack("d", $value); |
@@ -339,6 +347,9 @@ discard block |
||
| 339 | 347 | } |
| 340 | 348 | } |
| 341 | 349 | |
| 350 | + /** |
|
| 351 | + * @param string $error |
|
| 352 | + */ |
|
| 342 | 353 | function setError($error) { |
| 343 | 354 | $this->lastError = $error; |
| 344 | 355 | return false; |
@@ -357,6 +368,9 @@ discard block |
||
| 357 | 368 | var $SHPData = array(); |
| 358 | 369 | var $DBFData = array(); |
| 359 | 370 | |
| 371 | + /** |
|
| 372 | + * @param integer $shapeType |
|
| 373 | + */ |
|
| 360 | 374 | public function __construct($shapeType) { |
| 361 | 375 | $this->shapeType = $shapeType; |
| 362 | 376 | } |
@@ -672,6 +686,9 @@ discard block |
||
| 672 | 686 | } |
| 673 | 687 | } |
| 674 | 688 | |
| 689 | + /** |
|
| 690 | + * @param string $error |
|
| 691 | + */ |
|
| 675 | 692 | function setError($error) { |
| 676 | 693 | $this->lastError = $error; |
| 677 | 694 | return false; |
@@ -29,7 +29,9 @@ discard block |
||
| 29 | 29 | * |
| 30 | 30 | */ |
| 31 | 31 | function loadData($type, $data) { |
| 32 | - if (!$data) return $data; |
|
| 32 | + if (!$data) { |
|
| 33 | + return $data; |
|
| 34 | + } |
|
| 33 | 35 | $tmp = unpack($type, $data); |
| 34 | 36 | return current($tmp); |
| 35 | 37 | } |
@@ -104,7 +106,9 @@ discard block |
||
| 104 | 106 | } |
| 105 | 107 | |
| 106 | 108 | function saveToFile($FileName = NULL) { |
| 107 | - if ($FileName != NULL) $this->FileName = $FileName; |
|
| 109 | + if ($FileName != NULL) { |
|
| 110 | + $this->FileName = $FileName; |
|
| 111 | + } |
|
| 108 | 112 | |
| 109 | 113 | if (($this->_openSHPFile(TRUE)) && ($this->_openSHXFile(TRUE)) && ($this->_openDBFFile(TRUE))) { |
| 110 | 114 | $this->_saveHeaders(); |
@@ -562,10 +566,18 @@ discard block |
||
| 562 | 566 | case 3: |
| 563 | 567 | case 5: |
| 564 | 568 | //Adds a new point to the selected part |
| 565 | - if (!isset($this->SHPData["xmin"]) || ($this->SHPData["xmin"] > $point["x"])) $this->SHPData["xmin"] = $point["x"]; |
|
| 566 | - if (!isset($this->SHPData["ymin"]) || ($this->SHPData["ymin"] > $point["y"])) $this->SHPData["ymin"] = $point["y"]; |
|
| 567 | - if (!isset($this->SHPData["xmax"]) || ($this->SHPData["xmax"] < $point["x"])) $this->SHPData["xmax"] = $point["x"]; |
|
| 568 | - if (!isset($this->SHPData["ymax"]) || ($this->SHPData["ymax"] < $point["y"])) $this->SHPData["ymax"] = $point["y"]; |
|
| 569 | + if (!isset($this->SHPData["xmin"]) || ($this->SHPData["xmin"] > $point["x"])) { |
|
| 570 | + $this->SHPData["xmin"] = $point["x"]; |
|
| 571 | + } |
|
| 572 | + if (!isset($this->SHPData["ymin"]) || ($this->SHPData["ymin"] > $point["y"])) { |
|
| 573 | + $this->SHPData["ymin"] = $point["y"]; |
|
| 574 | + } |
|
| 575 | + if (!isset($this->SHPData["xmax"]) || ($this->SHPData["xmax"] < $point["x"])) { |
|
| 576 | + $this->SHPData["xmax"] = $point["x"]; |
|
| 577 | + } |
|
| 578 | + if (!isset($this->SHPData["ymax"]) || ($this->SHPData["ymax"] < $point["y"])) { |
|
| 579 | + $this->SHPData["ymax"] = $point["y"]; |
|
| 580 | + } |
|
| 569 | 581 | |
| 570 | 582 | $this->SHPData["parts"][$partIndex]["points"][] = $point; |
| 571 | 583 | |
@@ -574,10 +586,18 @@ discard block |
||
| 574 | 586 | break; |
| 575 | 587 | case 8: |
| 576 | 588 | //Adds a new point |
| 577 | - if (!isset($this->SHPData["xmin"]) || ($this->SHPData["xmin"] > $point["x"])) $this->SHPData["xmin"] = $point["x"]; |
|
| 578 | - if (!isset($this->SHPData["ymin"]) || ($this->SHPData["ymin"] > $point["y"])) $this->SHPData["ymin"] = $point["y"]; |
|
| 579 | - if (!isset($this->SHPData["xmax"]) || ($this->SHPData["xmax"] < $point["x"])) $this->SHPData["xmax"] = $point["x"]; |
|
| 580 | - if (!isset($this->SHPData["ymax"]) || ($this->SHPData["ymax"] < $point["y"])) $this->SHPData["ymax"] = $point["y"]; |
|
| 589 | + if (!isset($this->SHPData["xmin"]) || ($this->SHPData["xmin"] > $point["x"])) { |
|
| 590 | + $this->SHPData["xmin"] = $point["x"]; |
|
| 591 | + } |
|
| 592 | + if (!isset($this->SHPData["ymin"]) || ($this->SHPData["ymin"] > $point["y"])) { |
|
| 593 | + $this->SHPData["ymin"] = $point["y"]; |
|
| 594 | + } |
|
| 595 | + if (!isset($this->SHPData["xmax"]) || ($this->SHPData["xmax"] < $point["x"])) { |
|
| 596 | + $this->SHPData["xmax"] = $point["x"]; |
|
| 597 | + } |
|
| 598 | + if (!isset($this->SHPData["ymax"]) || ($this->SHPData["ymax"] < $point["y"])) { |
|
| 599 | + $this->SHPData["ymax"] = $point["y"]; |
|
| 600 | + } |
|
| 581 | 601 | |
| 582 | 602 | $this->SHPData["points"][] = $point; |
| 583 | 603 | $this->SHPData["numpoints"]++; |