Completed
Push — master ( b47f29...4465ab )
by Michal
03:24
created
src/ShapeRecord.php 1 patch
Braces   +78 added lines, -24 removed lines patch added patch discarded remove patch
@@ -465,8 +465,14 @@  discard block
 block discarded – undo
465 465
             case 1:
466 466
             case 11:
467 467
             case 21:
468
-                if (in_array($this->shapeType,array(11,21)) && !isset($point["m"])) $point["m"] = 0.0; // no_value
469
-                if (in_array($this->shapeType,array(11)) && !isset($point["z"])) $point["z"] = 0.0; // no_value
468
+                if (in_array($this->shapeType,array(11,21)) && !isset($point["m"])) {
469
+                    $point["m"] = 0.0;
470
+                }
471
+                // no_value
472
+                if (in_array($this->shapeType,array(11)) && !isset($point["z"])) {
473
+                    $point["z"] = 0.0;
474
+                }
475
+                // no_value
470 476
                 //Substitutes the value of the current point
471 477
                 $this->SHPData = $point;
472 478
                 break;
@@ -476,18 +482,40 @@  discard block
 block discarded – undo
476 482
             case 15:
477 483
             case 23:
478 484
             case 25:
479
-                if (in_array($this->shapeType,array(13,15,23,25)) && !isset($point["m"])) $point["m"] = 0.0; // no_value
480
-                if (in_array($this->shapeType,array(13,15)) && !isset($point["z"])) $point["z"] = 0.0; // no_value
485
+                if (in_array($this->shapeType,array(13,15,23,25)) && !isset($point["m"])) {
486
+                    $point["m"] = 0.0;
487
+                }
488
+                // no_value
489
+                if (in_array($this->shapeType,array(13,15)) && !isset($point["z"])) {
490
+                    $point["z"] = 0.0;
491
+                }
492
+                // no_value
481 493
 
482 494
                 //Adds a new point to the selected part
483
-                if (!isset($this->SHPData["xmin"]) || ($this->SHPData["xmin"] > $point["x"])) $this->SHPData["xmin"] = $point["x"];
484
-                if (!isset($this->SHPData["ymin"]) || ($this->SHPData["ymin"] > $point["y"])) $this->SHPData["ymin"] = $point["y"];
485
-                if (isset($point["m"]) && (!isset($this->SHPData["mmin"]) || ($this->SHPData["mmin"] > $point["m"]))) $this->SHPData["mmin"] = $point["m"];
486
-                if (isset($point["z"]) && (!isset($this->SHPData["zmin"]) || ($this->SHPData["zmin"] > $point["z"]))) $this->SHPData["zmin"] = $point["z"];
487
-                if (!isset($this->SHPData["xmax"]) || ($this->SHPData["xmax"] < $point["x"])) $this->SHPData["xmax"] = $point["x"];
488
-                if (!isset($this->SHPData["ymax"]) || ($this->SHPData["ymax"] < $point["y"])) $this->SHPData["ymax"] = $point["y"];
489
-                if (isset($point["m"]) && (!isset($this->SHPData["mmax"]) || ($this->SHPData["mmax"] < $point["m"]))) $this->SHPData["mmax"] = $point["m"];
490
-                if (isset($point["z"]) && (!isset($this->SHPData["zmax"]) || ($this->SHPData["zmax"] < $point["z"]))) $this->SHPData["zmax"] = $point["z"];
495
+                if (!isset($this->SHPData["xmin"]) || ($this->SHPData["xmin"] > $point["x"])) {
496
+                    $this->SHPData["xmin"] = $point["x"];
497
+                }
498
+                if (!isset($this->SHPData["ymin"]) || ($this->SHPData["ymin"] > $point["y"])) {
499
+                    $this->SHPData["ymin"] = $point["y"];
500
+                }
501
+                if (isset($point["m"]) && (!isset($this->SHPData["mmin"]) || ($this->SHPData["mmin"] > $point["m"]))) {
502
+                    $this->SHPData["mmin"] = $point["m"];
503
+                }
504
+                if (isset($point["z"]) && (!isset($this->SHPData["zmin"]) || ($this->SHPData["zmin"] > $point["z"]))) {
505
+                    $this->SHPData["zmin"] = $point["z"];
506
+                }
507
+                if (!isset($this->SHPData["xmax"]) || ($this->SHPData["xmax"] < $point["x"])) {
508
+                    $this->SHPData["xmax"] = $point["x"];
509
+                }
510
+                if (!isset($this->SHPData["ymax"]) || ($this->SHPData["ymax"] < $point["y"])) {
511
+                    $this->SHPData["ymax"] = $point["y"];
512
+                }
513
+                if (isset($point["m"]) && (!isset($this->SHPData["mmax"]) || ($this->SHPData["mmax"] < $point["m"]))) {
514
+                    $this->SHPData["mmax"] = $point["m"];
515
+                }
516
+                if (isset($point["z"]) && (!isset($this->SHPData["zmax"]) || ($this->SHPData["zmax"] < $point["z"]))) {
517
+                    $this->SHPData["zmax"] = $point["z"];
518
+                }
491 519
 
492 520
                 $this->SHPData["parts"][$partIndex]["points"][] = $point;
493 521
 
@@ -497,18 +525,40 @@  discard block
 block discarded – undo
497 525
             case 8:
498 526
             case 18:
499 527
             case 28:
500
-                if (in_array($this->shapeType,array(18,28)) && !isset($point["m"])) $point["m"] = 0.0; // no_value
501
-                if (in_array($this->shapeType,array(18)) && !isset($point["z"])) $point["z"] = 0.0; // no_value
528
+                if (in_array($this->shapeType,array(18,28)) && !isset($point["m"])) {
529
+                    $point["m"] = 0.0;
530
+                }
531
+                // no_value
532
+                if (in_array($this->shapeType,array(18)) && !isset($point["z"])) {
533
+                    $point["z"] = 0.0;
534
+                }
535
+                // no_value
502 536
 
503 537
                 //Adds a new point
504
-                if (!isset($this->SHPData["xmin"]) || ($this->SHPData["xmin"] > $point["x"])) $this->SHPData["xmin"] = $point["x"];
505
-                if (!isset($this->SHPData["ymin"]) || ($this->SHPData["ymin"] > $point["y"])) $this->SHPData["ymin"] = $point["y"];
506
-                if (isset($point["m"]) && (!isset($this->SHPData["mmin"]) || ($this->SHPData["mmin"] > $point["m"]))) $this->SHPData["mmin"] = $point["m"];
507
-                if (isset($point["z"]) && (!isset($this->SHPData["zmin"]) || ($this->SHPData["zmin"] > $point["z"]))) $this->SHPData["zmin"] = $point["z"];
508
-                if (!isset($this->SHPData["xmax"]) || ($this->SHPData["xmax"] < $point["x"])) $this->SHPData["xmax"] = $point["x"];
509
-                if (!isset($this->SHPData["ymax"]) || ($this->SHPData["ymax"] < $point["y"])) $this->SHPData["ymax"] = $point["y"];
510
-                if (isset($point["m"]) && (!isset($this->SHPData["mmax"]) || ($this->SHPData["mmax"] < $point["m"]))) $this->SHPData["mmax"] = $point["m"];
511
-                if (isset($point["z"]) && (!isset($this->SHPData["zmax"]) || ($this->SHPData["zmax"] < $point["z"]))) $this->SHPData["zmax"] = $point["z"];
538
+                if (!isset($this->SHPData["xmin"]) || ($this->SHPData["xmin"] > $point["x"])) {
539
+                    $this->SHPData["xmin"] = $point["x"];
540
+                }
541
+                if (!isset($this->SHPData["ymin"]) || ($this->SHPData["ymin"] > $point["y"])) {
542
+                    $this->SHPData["ymin"] = $point["y"];
543
+                }
544
+                if (isset($point["m"]) && (!isset($this->SHPData["mmin"]) || ($this->SHPData["mmin"] > $point["m"]))) {
545
+                    $this->SHPData["mmin"] = $point["m"];
546
+                }
547
+                if (isset($point["z"]) && (!isset($this->SHPData["zmin"]) || ($this->SHPData["zmin"] > $point["z"]))) {
548
+                    $this->SHPData["zmin"] = $point["z"];
549
+                }
550
+                if (!isset($this->SHPData["xmax"]) || ($this->SHPData["xmax"] < $point["x"])) {
551
+                    $this->SHPData["xmax"] = $point["x"];
552
+                }
553
+                if (!isset($this->SHPData["ymax"]) || ($this->SHPData["ymax"] < $point["y"])) {
554
+                    $this->SHPData["ymax"] = $point["y"];
555
+                }
556
+                if (isset($point["m"]) && (!isset($this->SHPData["mmax"]) || ($this->SHPData["mmax"] < $point["m"]))) {
557
+                    $this->SHPData["mmax"] = $point["m"];
558
+                }
559
+                if (isset($point["z"]) && (!isset($this->SHPData["zmax"]) || ($this->SHPData["zmax"] < $point["z"]))) {
560
+                    $this->SHPData["zmax"] = $point["z"];
561
+                }
512 562
 
513 563
                 $this->SHPData["points"][] = $point;
514 564
                 $this->SHPData["numpoints"] = 1 + (isset($this->SHPData["numpoints"])?$this->SHPData["numpoints"]:0);
@@ -530,8 +580,12 @@  discard block
 block discarded – undo
530 580
                 //Sets the value of the point to zero
531 581
                 $this->SHPData["x"] = 0.0;
532 582
                 $this->SHPData["y"] = 0.0;
533
-                if (in_array($this->shapeType,array(11,21))) $this->SHPData["m"] = 0.0;
534
-                if (in_array($this->shapeType,array(11))) $this->SHPData["z"] = 0.0;
583
+                if (in_array($this->shapeType,array(11,21))) {
584
+                    $this->SHPData["m"] = 0.0;
585
+                }
586
+                if (in_array($this->shapeType,array(11))) {
587
+                    $this->SHPData["z"] = 0.0;
588
+                }
535 589
                 break;
536 590
             case 3:
537 591
             case 5:
Please login to merge, or discard this patch.