+ protected function gpx(Syj_Model_Path $path) {
+ $data = '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL; // <? <-- vim syntax goes crazy
+ $data .= '<gpx creator="syj" version="1.0" xmlns="http://www.topografix.com/GPX/1/0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd">';
+ $data .= '<trk>';
+ if ($path->creator) {
+ $data .= '<author>' . htmlspecialchars($path->creator->pseudo, ENT_COMPAT, "UTF-8") . '</author>';
+ }
+ $data .= '<name>' . htmlspecialchars($path->displayTitle, ENT_COMPAT, "UTF-8") . '</name>';
+ $data .= $path->geom->toGPX();
+ $data .= '</trk>';
+ $data .= '</gpx>';
+
+ $api = $this->_helper->SyjApi;
+ $api->setCheckIfNoneMatch(true)->setContentType('application/gpx+xml')->setBody($data);
+ }
+
+ protected function json(Syj_Model_Path $path) {
+ $data = json_decode($path->geom->toGeoJSON());
+ $data->title = (string)$path->displayTitle;
+ if ($path->creator) {
+ $data->creator = (string)$path->creator->pseudo;
+ }
+ $api = $this->_helper->SyjApi;