1 | <?php |
||
16 | class GeoTIFFReader extends AbstractResourceReader |
||
17 | { |
||
18 | /** |
||
19 | * The number of bytes required to hold a TIFF offset address. |
||
20 | * @var int |
||
21 | */ |
||
22 | const LEN_OFFSET = 4; |
||
23 | |||
24 | /** |
||
25 | * The number of bytes containing each item of elevation data |
||
26 | * (= BitsPerSample tag value / 8). |
||
27 | * @var int |
||
28 | */ |
||
29 | const BYTES_PER_SAMPLE = 2; |
||
30 | |||
31 | /** |
||
32 | * Magic number located at bytes 2-3 which identifies a TIFF file. |
||
33 | * @var int |
||
34 | */ |
||
35 | const MAGIC_TIFF_ID = 42; |
||
36 | |||
37 | /** @var int */ |
||
38 | const TIFF_CONST_STRIPOFSETS = 273; |
||
39 | |||
40 | /** @var int */ |
||
41 | const TIFF_CONST_IMAGE_WIDTH = 256; |
||
42 | |||
43 | /** @var int */ |
||
44 | const TIFF_CONST_IMAGE_LENGTH = 257; |
||
45 | |||
46 | /** @var int */ |
||
47 | const TIFF_CONST_STRIPBYTECOUNTS = 279; |
||
48 | |||
49 | /** @var int */ |
||
50 | const TIFF_CONST_IFD_ENTRY_BYTES = 12; |
||
51 | |||
52 | /** @var string */ |
||
53 | const BIG_ENDIAN = 'MM'; |
||
54 | |||
55 | /** @var string */ |
||
56 | const LITTLE_ENDIAN = 'II'; |
||
57 | |||
58 | /** @var int */ |
||
59 | const UNKNOWN = -32768; |
||
60 | |||
61 | /** @var int */ |
||
62 | protected $NumDataRows; |
||
63 | |||
64 | /** @var int */ |
||
65 | protected $NumDataCols; |
||
66 | |||
67 | /** @var int */ |
||
68 | protected $StripOffsets; |
||
69 | |||
70 | /** @var string */ |
||
71 | protected $ByteOrder; |
||
72 | |||
73 | /** |
||
74 | * @param string $filename |
||
|
|||
75 | */ |
||
76 | 6 | public function readHeader() |
|
82 | |||
83 | /** |
||
84 | * Go to the file header and work out the byte order (bytes 0-1) and TIFF identifier (bytes 2-3). |
||
85 | * @throws \RuntimeException |
||
86 | */ |
||
87 | 6 | protected function checkByteOrderAndTiffIdentifier() |
|
102 | |||
103 | /** |
||
104 | * The remaining 4 bytes in the header are the offset to the IFD. |
||
105 | */ |
||
106 | 6 | protected function goToIFDEntries() |
|
115 | |||
116 | /** |
||
117 | * Read IFD entries which (the number of entries in each is in the first two bytes). |
||
118 | */ |
||
119 | 6 | protected function readIFDEntries() |
|
141 | |||
142 | /** |
||
143 | * @return bool |
||
144 | */ |
||
145 | 6 | protected function isLittleEndian() |
|
149 | |||
150 | /** |
||
151 | * @param float $relativeLatitude |
||
152 | * @param float $relativeLongitude |
||
153 | * @return float[] array(row, col) |
||
154 | */ |
||
155 | 6 | public function getExactRowAndColFor($relativeLatitude, $relativeLongitude) |
|
162 | |||
163 | /** |
||
164 | * @param int $row |
||
165 | * @param int $col |
||
166 | * @return int|bool |
||
167 | */ |
||
168 | 6 | public function getElevationFor($row, $col) |
|
180 | } |
||
181 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.