Passed
Pull Request — master (#26)
by
unknown
11:52
created

IsraeliTMRef::getScaleFactor()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 1
c 1
b 0
f 1
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PHPCoord;
6
7
/**
8
 * Irish Transverse Mercator grid ref (the new Irish Grid system)
9
 * References are accurate to 1m.
10
 * @author Doug Wright
11
 */
12
class IsraeliTMRef extends TransverseMercator
13
{
14
    /**
15
     * @return RefEll
16
     */
17
    public function getReferenceEllipsoid(): RefEll
18
    {
19
        return RefEll::grs80();
20
    }
21
22
    /**
23
     * @return float
24
     */
25
    public function getScaleFactor(): float
26
    {
27
        return 1.0000067;
28
    }
29
30
    /**
31
     * @return int
32
     */
33
    public function getOriginNorthing(): int
34
    {
35
        return 631556;
36
    }
37
38
    /**
39
     * @return int
40
     */
41
    public function getOriginEasting(): int
42
    {
43
        return 222286;
44
    }
45
46
    /**
47
     * @return float
48
     */
49
    public function getOriginLatitude(): float
50
    {
51
        return 31.73439361;
52
    }
53
54
    /**
55
     * @return float
56
     */
57
    public function getOriginLongitude(): float
58
    {
59
        return 35.20444444;
60
    }
61
62
    /**
63
     * @param int $x
64
     * @param int $y
65
     * @param int $z
66
     */
67
    public function __construct($x, $y, $z = 0)
68
    {
69
        parent::__construct($x, $y, $z, RefEll::grs80());
70
    }
71
72
    /**
73
     * Convert this grid reference into a latitude and longitude.
74
     * @return LatLng
75
     */
76
    public function toLatLng(): LatLng
77
    {
78
        $N = $this->y;
79
        $E = $this->x;
80
        $N0 = $this->getOriginNorthing();
81
        $E0 = $this->getOriginEasting();
82
        $phi0 = $this->getOriginLatitude();
83
        $lambda0 = $this->getOriginLongitude();
84
85
        return $this->convertToLatitudeLongitude($N, $E, $N0, $E0, $phi0, $lambda0);
86
    }
87
88
    /**
89
     * String version of coordinate.
90
     * @return string
91
     */
92
    public function __toString(): string
93
    {
94
        return "({$this->x}, {$this->y})";
95
    }
96
}
97