1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* PHPCoord. |
4
|
|
|
* |
5
|
|
|
* @author Doug Wright |
6
|
|
|
*/ |
7
|
|
|
declare(strict_types=1); |
8
|
|
|
|
9
|
|
|
namespace PHPCoord\CoordinateReferenceSystem; |
10
|
|
|
|
11
|
|
|
use PHPCoord\CoordinateSystem\CoordinateSystem; |
12
|
|
|
use PHPCoord\Datum\Datum; |
13
|
|
|
use PHPCoord\Exception\UnknownCoordinateReferenceSystemException; |
14
|
|
|
use PHPCoord\Geometry\BoundingArea; |
15
|
|
|
|
16
|
|
|
use function array_merge; |
17
|
|
|
|
18
|
|
|
abstract class CoordinateReferenceSystem |
19
|
|
|
{ |
20
|
|
|
public const CRS_TYPE_COMPOUND = 'compound'; |
21
|
|
|
|
22
|
|
|
public const CRS_TYPE_DERIVED = 'derived'; |
23
|
|
|
|
24
|
|
|
public const CRS_TYPE_DYNAMIC_GEOCENTRIC = 'dynamic geocentric'; |
25
|
|
|
|
26
|
|
|
public const CRS_TYPE_DYNAMIC_GEOGRAPHIC_2D = 'dynamic geographic 2D'; |
27
|
|
|
|
28
|
|
|
public const CRS_TYPE_DYNAMIC_GEOGRAPHIC_3D = 'dynamic geographic 3D'; |
29
|
|
|
|
30
|
|
|
public const CRS_TYPE_DYNAMIC_VERTICAL = 'dynamic vertical'; |
31
|
|
|
|
32
|
|
|
public const CRS_TYPE_ENGINEERING = 'engineering'; |
33
|
|
|
|
34
|
|
|
public const CRS_TYPE_GEOCENTRIC = 'geocentric'; |
35
|
|
|
|
36
|
|
|
public const CRS_TYPE_GEOGRAPHIC_2D = 'geographic 2D'; |
37
|
|
|
|
38
|
|
|
public const CRS_TYPE_GEOGRAPHIC_3D = 'geographic 3D'; |
39
|
|
|
|
40
|
|
|
public const CRS_TYPE_PROJECTED = 'projected'; |
41
|
|
|
|
42
|
|
|
public const CRS_TYPE_VERTICAL = 'vertical'; |
43
|
|
|
|
44
|
|
|
public const CRS_SRID_PREFIX_EPSG = 'urn:ogc:def:crs:EPSG::'; |
45
|
|
|
|
46
|
|
|
protected string $srid; |
47
|
|
|
|
48
|
|
|
protected string $name; |
49
|
|
|
|
50
|
|
|
protected CoordinateSystem $coordinateSystem; |
51
|
|
|
|
52
|
|
|
protected Datum $datum; |
53
|
|
|
|
54
|
|
|
protected BoundingArea $boundingArea; |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @var array<string, Compound|Geocentric|Geographic2D|Geographic3D|Projected|Vertical> |
58
|
5332 |
|
*/ |
59
|
|
|
private static array $cachedObjects = []; |
60
|
5332 |
|
|
61
|
|
|
public function getSRID(): string |
62
|
|
|
{ |
63
|
9126 |
|
return $this->srid; |
64
|
|
|
} |
65
|
9126 |
|
|
66
|
|
|
public function getName(): string |
67
|
|
|
{ |
68
|
11454 |
|
return $this->name; |
69
|
|
|
} |
70
|
11454 |
|
|
71
|
|
|
public function getCoordinateSystem(): CoordinateSystem |
72
|
|
|
{ |
73
|
15235 |
|
return $this->coordinateSystem; |
74
|
|
|
} |
75
|
15235 |
|
|
76
|
|
|
public function getDatum(): Datum |
77
|
|
|
{ |
78
|
418 |
|
return $this->datum; |
79
|
|
|
} |
80
|
418 |
|
|
81
|
|
|
public function getBoundingArea(): BoundingArea |
82
|
|
|
{ |
83
|
6425 |
|
return $this->boundingArea; |
84
|
|
|
} |
85
|
6425 |
|
|
86
|
3611 |
|
public static function fromSRID(string $srid): Compound|Geocentric|Geographic2D|Geographic3D|Projected|Vertical |
|
|
|
|
87
|
235 |
|
{ |
88
|
3378 |
|
if (!isset(self::$cachedObjects[$srid])) { |
89
|
3141 |
|
if (isset(Projected::getSupportedSRIDs()[$srid])) { |
90
|
703 |
|
self::$cachedObjects[$srid] = Projected::fromSRID($srid); |
91
|
503 |
|
} elseif (isset(Geographic2D::getSupportedSRIDs()[$srid])) { |
92
|
701 |
|
self::$cachedObjects[$srid] = Geographic2D::fromSRID($srid); |
93
|
529 |
|
} elseif (isset(Geographic3D::getSupportedSRIDs()[$srid])) { |
94
|
173 |
|
self::$cachedObjects[$srid] = Geographic3D::fromSRID($srid); |
95
|
10 |
|
} elseif (isset(Geocentric::getSupportedSRIDs()[$srid])) { |
96
|
163 |
|
self::$cachedObjects[$srid] = Geocentric::fromSRID($srid); |
97
|
1 |
|
} elseif (isset(Vertical::getSupportedSRIDs()[$srid])) { |
98
|
|
|
self::$cachedObjects[$srid] = Vertical::fromSRID($srid); |
99
|
162 |
|
} elseif (isset(Compound::getSupportedSRIDs()[$srid])) { |
100
|
|
|
self::$cachedObjects[$srid] = Compound::fromSRID($srid); |
101
|
|
|
} else { |
102
|
|
|
throw new UnknownCoordinateReferenceSystemException($srid); |
103
|
6263 |
|
} |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
return self::$cachedObjects[$srid]; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* @return array<string, string> |
111
|
|
|
*/ |
112
|
|
|
public static function getSupportedSRIDs(): array |
113
|
|
|
{ |
114
|
|
|
return array_merge(Compound::getSupportedSRIDs(), Geocentric::getSupportedSRIDs(), Geographic2D::getSupportedSRIDs(), Geographic3D::getSupportedSRIDs(), Projected::getSupportedSRIDs(), Vertical::getSupportedSRIDs()); |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* @return array<string, array{name: string, extent_description: string, help: string}> |
119
|
|
|
*/ |
120
|
|
|
public static function getSupportedSRIDsWithHelp(): array |
121
|
|
|
{ |
122
|
|
|
return array_merge(Compound::getSupportedSRIDsWithHelp(), Geocentric::getSupportedSRIDsWithHelp(), Geographic2D::getSupportedSRIDsWithHelp(), Geographic3D::getSupportedSRIDsWithHelp(), Projected::getSupportedSRIDsWithHelp(), Vertical::getSupportedSRIDsWithHelp()); |
123
|
|
|
} |
124
|
|
|
} |
125
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths