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

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