Code Duplication    Length = 30-30 lines in 2 locations

htdocs/lib2/logic/coordinate.class.php 1 location

@@ 559-588 (lines=30) @@
556
    }
557
558
    // return string
559
    public function getSwissGrid()
560
    {
561
        $nLat = $this->nLat * 3600;
562
        $nLon = $this->nLon * 3600;
563
564
        // Quelle: http://www.swisstopo.admin.ch/internet/swisstopo/de/home/apps/calc.html
565
        // Hilfsgrössen
566
        $b = ($nLat - 169028.66) / 10000.0;
567
        $l = ($nLon - 26782.5) / 10000.0;
568
569
        // Nord x
570
        $x = 200147.07 + 308807.95 * $b + 3745.25 * $l * $l + 76.63 * $b * $b + 119.79 * $b * $b * $b - 194.56 * $b * $l * $l;
571
        $x = floor($x);
572
573
        // Ost y
574
        $y = 600072.37 + 211455.93 * $l - 10938.51 * $l * $b - 0.36 * $l * $b * $b - 44.54 * $l * $l * $l;
575
        $y = floor($y);
576
577
        // Namen: "CH1903", "Schweizer Landeskoordinaten" oder "Swiss Grid"
578
        $swissgrid = "$y / $x";
579
        // Karten Links
580
        $mapplus = "<a href=\"http://www.mapplus.ch/frame.php?map=&x=$y&y=$x&zl=13\" target=\"_blank\">MapPlus</a>";
581
        $mapsearch = "<a href=\"http://map.search.ch/$y,$x\" target=\"_blank\">map.search.ch</a>";
582
583
        return [
584
            'coord' => $swissgrid,
585
            $mapplus,
586
            $mapsearch,
587
        ];
588
    }
589
590
    /**
591
     * @param string $name

htdocs_symfony/src/Repository/CoordinatesRepository.php 1 location

@@ 639-668 (lines=30) @@
636
     *
637
     * @return string[]
638
     */
639
    public function getSwissGrid()
640
    {
641
        $nLat = $this->nLat * 3600;
642
        $nLon = $this->nLon * 3600;
643
644
        // Quelle: http://www.swisstopo.admin.ch/internet/swisstopo/de/home/apps/calc.html
645
        // Hilfsgrössen
646
        $b = ($nLat - 169028.66) / 10000.0;
647
        $l = ($nLon - 26782.5) / 10000.0;
648
649
        // Nord x
650
        $x = 200147.07 + 308807.95 * $b + 3745.25 * $l * $l + 76.63 * $b * $b + 119.79 * $b * $b * $b - 194.56 * $b * $l * $l;
651
        $x = floor($x);
652
653
        // Ost y
654
        $y = 600072.37 + 211455.93 * $l - 10938.51 * $l * $b - 0.36 * $l * $b * $b - 44.54 * $l * $l * $l;
655
        $y = floor($y);
656
657
        // Namen: "CH1903", "Schweizer Landeskoordinaten" oder "Swiss Grid"
658
        $swissgrid = "$y / $x";
659
        // Karten Links
660
        $mapplus = "<a href=\"http://www.mapplus.ch/frame.php?map=&x=$y&y=$x&zl=13\" target=\"_blank\">MapPlus</a>";
661
        $mapsearch = "<a href=\"http://map.search.ch/$y,$x\" target=\"_blank\">map.search.ch</a>";
662
663
        return [
664
            'coord' => $swissgrid,
665
            $mapplus,
666
            $mapsearch,
667
        ];
668
    }
669
670
    /**
671
     * @param $name