예제 #1
0
 public function setUp()
 {
     $document = new Document();
     $attributes = array('creator' => 'John Doe', 'version' => 1.1);
     $document->setAttributes($attributes);
     $metadata = new Metadata();
     $metadata->setName('GPX File');
     $metadata->setDesc('Description');
     $author = new Person();
     $author->setName('John');
     $email = new Email();
     $attributes = array('id' => 'john', 'domain' => 'test.com');
     $email->setAttributes($attributes);
     $author->setEmail($email);
     $metadata->setAuthor($author);
     $copyright = new Copyright();
     $copyright->setYear(2005);
     $copyright->setLicense('MIT');
     $metadata->setCopyright($copyright);
     $link = new Link();
     $link->setAttributes(array('href' => 'test.com'));
     $metadata->setLink($link);
     $metadata->setKeywords('123');
     $bounds = new Bound();
     $bounds->setAttributes(array('minlat' => 1, 'minlon' => 5, 'maxlat' => 10, 'maxlon' => 20));
     $metadata->setBounds($bounds);
     $document->setMetadata($metadata);
     $waypoint = new Waypoint();
     $attributes = array('lat' => 46.57638889, 'lon' => 8.892638890000001);
     $waypoint->setAttributes($attributes);
     $waypoint->setEle(2372);
     $waypoint->setName('LAGORETICO');
     $document->addWaypoint($waypoint);
     $track = new Track();
     $track->setName('Example gpx');
     $track->setNumber(1);
     $ts = new TrackSegment();
     $waypoint = new Waypoint();
     $attributes = array("lat" => 46.57608333, "lon" => 8.892416669999999);
     $waypoint->setAttributes($attributes);
     $waypoint->setEle(2376);
     $waypoint->setTime('2007-10-14T10:09:57Z');
     $ts->addTrack($waypoint);
     $track->addTrackSegment($ts);
     $document->addTrack($track);
     $this->writer = new Writer($document);
 }
예제 #2
0
 public function parseBounds(SimpleXMLElement $xml)
 {
     $bound = new Bound();
     $attributes = $this->fillAttributes($xml);
     if ($this->areAttributesFilled($attributes)) {
         $bound->setAttributes($attributes);
     }
     return $bound;
 }