1 | <?php |
||
24 | class Util { |
||
25 | private static $little_endian = null; |
||
26 | |||
27 | private static $shape_names = array( |
||
28 | 0 => 'Null Shape', |
||
29 | 1 => 'Point', |
||
30 | 3 => 'PolyLine', |
||
31 | 5 => 'Polygon', |
||
32 | 8 => 'MultiPoint', |
||
33 | 11 => 'PointZ', |
||
34 | 13 => 'PolyLineZ', |
||
35 | 15 => 'PolygonZ', |
||
36 | 18 => 'MultiPointZ', |
||
37 | 21 => 'PointM', |
||
38 | 23 => 'PolyLineM', |
||
39 | 25 => 'PolygonM', |
||
40 | 28 => 'MultiPointM', |
||
41 | 31 => 'MultiPatch', |
||
42 | ); |
||
43 | |||
44 | /** |
||
45 | * Reads data |
||
46 | * |
||
47 | * @param string $type type for unpack() |
||
48 | * @param string $data Data to process |
||
49 | * |
||
50 | * @return mixed |
||
51 | */ |
||
52 | 23 | public static function loadData($type, $data) { |
|
59 | |||
60 | /** |
||
61 | * Changes endianity |
||
62 | * |
||
63 | * @param string $binValue Binary value |
||
64 | * |
||
65 | * @return string |
||
66 | */ |
||
67 | 1 | public static function swap($binValue) { |
|
75 | |||
76 | /** |
||
77 | * Encodes double value to correct endianity |
||
78 | * |
||
79 | * @param double $value Value to pack |
||
80 | * |
||
81 | * @return string |
||
82 | */ |
||
83 | 13 | public static function packDouble($value) { |
|
96 | |||
97 | /** |
||
98 | * Returns shape name |
||
99 | * |
||
100 | * @param integer $type |
||
101 | * |
||
102 | * @return string |
||
103 | */ |
||
104 | 1 | public static function nameShape($type) |
|
111 | } |
||
112 |