1
|
<?php
|
2
|
require_once(dirname(__FILE__).'/../constants.inc.php');
|
3
|
|
4
|
|
5
|
class RefPoint {
|
6
|
static $all_ref_points_cache;
|
7
|
public $name;
|
8
|
public $lon;
|
9
|
public $lat;
|
10
|
public $ele;
|
11
|
|
12
|
public function __construct($name, $values) {
|
13
|
$this->name = $name;
|
14
|
$this->lon = $values[0];
|
15
|
$this->lat = $values[1];
|
16
|
$this->ele = $values[2];
|
17
|
}
|
18
|
|
19
|
public static function load_if_needed() {
|
20
|
if (!isset(self::$all_ref_points_cache)) {
|
21
|
if (file_exists(REF_POINTS_PATH)) {
|
22
|
require(REF_POINTS_PATH);
|
23
|
self::$all_ref_points_cache = $ref_points;
|
24
|
return $ref_points;
|
25
|
} else {
|
26
|
return array();
|
27
|
}
|
28
|
}
|
29
|
return self::$all_ref_points_cache;
|
30
|
}
|
31
|
|
32
|
public static function get($name) {
|
33
|
self::load_if_needed();
|
34
|
$values = self::$all_ref_points_cache[$name];
|
35
|
return new RefPoint($name, $values);
|
36
|
}
|
37
|
|
38
|
}
|
39
|
?>
|