Révision c5f89cd9
Ajouté par Jocelyn Delande il y a environ 11 ans
class/site_point.class.php | ||
---|---|---|
16 | 16 |
private $params = false; |
17 | 17 |
private $zooms; |
18 | 18 |
|
19 |
public static $REF_KEY = 'reference'; |
|
20 |
|
|
19 | 21 |
public function __construct($dir) { |
20 | 22 |
$this->base_dir = $dir; |
21 | 23 |
$this->prefix = basename($dir); |
... | ... | |
57 | 59 |
$o = ''; |
58 | 60 |
$p = $this->get_params(); |
59 | 61 |
foreach ($this->get_params() as $k => $v) { |
60 |
$o.= "$k = $v\n"; |
|
62 |
if ($k == self::$REF_KEY) { |
|
63 |
foreach ($v as $refk => $refv) { |
|
64 |
$o.= sprintf("%s[\"%s\"] = %.5f,%.5f\n", |
|
65 |
self::$REF_KEY, $refk, |
|
66 |
$refv[0], $refv[1]); |
|
67 |
} |
|
68 |
} else { |
|
69 |
$o.= "$k = $v\n"; |
|
70 |
} |
|
61 | 71 |
} |
62 | 72 |
file_put_contents($this->params_path(), $o); |
63 | 73 |
} |
... | ... | |
140 | 150 |
return $o; |
141 | 151 |
} |
142 | 152 |
|
153 |
public function set_reference($ref_point, $x, $y) { |
|
154 |
/** |
|
155 |
* Registers (for saving) the position of a reference point within a |
|
156 |
* panorama. It sets or overwrite a reference. |
|
157 |
* |
|
158 |
* @param $ref_point a RefPoint instance |
|
159 |
* @param $x the relative x position of the RefPoint |
|
160 |
* @param $x the relative y position of the RefPoint |
|
161 |
*/ |
|
162 |
$p = $this->get_params(); |
|
163 |
|
|
164 |
if (!isset($this->params[self::$REF_KEY]) || |
|
165 |
!is_array($this->params[self::$REF_KEY])) { |
|
166 |
$this->params[self::$REF_KEY] = array(); |
|
167 |
} |
|
168 |
$ref_name = $ref_point->name; |
|
169 |
$dict = $this->params[self::$REF_KEY]; |
|
170 |
//$dddd = $this->params[self::$REF_KEY][$ref_name]; |
|
171 |
$this->params[self::$REF_KEY][$ref_name] = array($x, $y); |
|
172 |
} |
|
173 |
|
|
143 | 174 |
public static function get($name) { |
144 | 175 |
/** Instantiate a site_point, given its name |
145 | 176 |
*/ |
Formats disponibles : Unified diff
webservice to reference ref_points is ready