From a255d6af5519895fa22d592dcff06944111abba3 Mon Sep 17 00:00:00 2001
From: Jacek Kowalski <Jacek@jacekk.info>
Date: Sat, 22 Jun 2019 20:54:28 +0000
Subject: [PATCH] Update tram types: all N8C/N8S are partially low-floor now

---
 lib/mapper.php |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/lib/mapper.php b/lib/mapper.php
index 02033ae..a36b4ef 100644
--- a/lib/mapper.php
+++ b/lib/mapper.php
@@ -1,6 +1,4 @@
 <?php
-require_once(__DIR__.'/../vendor/autoload.php');
-
 use transit_realtime\FeedMessage;
 
 class Mapper {
@@ -36,13 +34,16 @@
 			if(!isset($vehicle->name) || !$vehicle->name) continue;
 			if(!isset($vehicle->latitude) || !$vehicle->latitude) continue;
 			if(!isset($vehicle->longitude) || !$vehicle->longitude) continue;
-			foreach($this->specialNames as $name) {
-				if(substr($vehicle->name, -strlen($name)) == $name) {
+			list($line, $direction) = explode(' ', $vehicle->name, 2);
+			foreach($this->specialNames as $specialName) {
+				if(substr($vehicle->name, -strlen($specialName)) == $specialName) {
 					continue;
 				}
 			}
 			$this->ttssTrips[(string)$vehicle->tripId] = [
 				'id' => (string)$vehicle->id,
+				'line' => $line,
+				'direction' => $direction,
 				'latitude' => (float)$vehicle->latitude / 3600000.0,
 				'longitude' => (float)$vehicle->longitude / 3600000.0,
 			];
@@ -54,6 +55,10 @@
 		return $this->ttssDate / 1000.0;
 	}
 	
+	public function getTTSSTrips() {
+		return $this->ttssTrips;
+	}
+	
 	public function loadGTFSRT($file) {
 		$data = file_get_contents($file);
 		$feed = new FeedMessage();

--
Gitblit v1.9.1