/**
  * function to send request
  * @param String $query query for overpass api
  * @return boolean true when request successful
  */
 static function sendRequest($query)
 {
     $link = "http://overpass-api.de/api/interpreter?data=" . urlencode($query);
     // get data from overpass api
     $content = @file_get_contents($link);
     // explanation about status codes of the overpass api can be found here: http://overpass-api.de/command_line.html
     if (isset($http_response_header[0])) {
         $status_code = self::getStatusCode($http_response_header[0]);
         if ($status_code != 200) {
             if ($status_code == 400) {
                 self::$error = Lang::l_("Invalid Overpass API query.");
                 //log error to send a correct query next time:
                 $msg = "Invalid Overpass API request. Query: " . $query;
                 log_error($msg);
             } elseif ($status_code == 429) {
                 self::$error = Lang::l_("Too many requests to Overpass API at the same time.");
             } elseif ($status_code == 504) {
                 self::$error = Lang::l_("Overpass API currently overcrowded.");
             } else {
                 self::$error = Lang::l_("Unknown Error.");
                 //log error to show a proper error message next time:
                 $msg = "Unknown Error when requesting overpass api: " . $http_response_header[0] . " | URI: " . $link;
                 log_error($msg);
             }
             return false;
         }
     } else {
         self::$error = Lang::l_("Connection failed.");
         return false;
     }
     if (!$content) {
         self::$error = Lang::l_("Empty result.");
         return false;
     }
     self::$result = $content;
     return true;
 }
 /**
  * returns description of the signals
  * @param $tags array tags of the signal
  */
 public static function showDescription()
 {
     return Lang::l_("Unknown");
 }
    /**
     * HTML Output for Search Result Box
     */
    static function showSearchResult()
    {
        ?>
<!-- Modal -->
<div class="modal fade" id="search" tabindex="-1" role="dialog" aria-labelledby="searchLabel" aria-hidden="true">
	<div class="modal-dialog modal-lg">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
	        	<h4 class="modal-title" id="searchLabel"><?php 
        echo Lang::l_("Search Results");
        ?>
</h4>
			</div>
			<div class="modal-body list-group" id="searchcontent">
			</div>      
			<div class="modal-footer">
        		<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
      		</div>
		</div>
	</div>
</div>
		<?php 
    }
 /**
  * returns description of the signals
  * @param $tags array tags of the signal
  */
 public static function showDescription()
 {
     return Lang::l_("German Hl");
 }
 /**
  * Function to get route type
  * @param string $route route type
  * @param string $service service type
  */
 static function getRouteType($route, $service = "")
 {
     $route_type_lang = array("high_speed" => Lang::l_('Highspeed Train'), "long_distance" => Lang::l_('Long Distance Train'), "car" => Lang::l_('Motorail Train'), "car_shuttle" => Lang::l_('Car Shuttle Train'), "night" => Lang::l_('Night Train'), "regional" => Lang::l_('Regional Train'), "commuter" => Lang::l_('Commuter Train'), "train" => Lang::l_('Unspecified Train'), "light_rail" => Lang::l_('Light Rail'), "tram" => Lang::l_('Tram'), "subway" => Lang::l_('Subway'), "tourism" => Lang::l_('Tourist Train'), "tourism_tram" => Lang::l_('Tourist Tram'), "unknown" => Lang::l_('N/A'));
     if ($route == "train") {
         $route_type = "train";
         if ($service == "high_speed") {
             $route_type = "high_speed";
         } elseif ($service == "long_distance") {
             $route_type = "long_distance";
         } elseif ($service == "night") {
             $route_type = "night";
         } elseif ($service == "car") {
             $route_type = "car";
         } elseif ($service == "car_shuttle") {
             $route_type = "car_shuttle";
         } elseif ($service == "regional") {
             $route_type = "regional";
         } elseif ($service == "commuter") {
             $route_type = "commuter";
         } elseif ($service == "tourism") {
             $route_type = "tourism";
         }
     } elseif ($route == "tram") {
         $route_type = "tram";
         if ($service == "tourism") {
             $route_type = "tourism_tram";
         }
     } elseif ($service == "tourism") {
         $route_type = "tourism";
     } elseif ($route == "light_rail") {
         $route_type = "light_rail";
     } elseif ($route == "subway") {
         $route_type = "subway";
     }
     return $route_type_lang[$route_type];
 }
 /**
  * returns description of the signals
  * @param $tags array tags of the signal
  */
 public static function showDescription()
 {
     return Lang::l_("German Zs 3v Speed Announcement Signal");
 }
Example #7
0
function showAbout()
{
    ?>
<!-- Modal -->
<div class="modal fade" id="about" tabindex="-1" role="dialog" aria-labelledby="aboutLabel" aria-hidden="true">
	<div class="modal-dialog  modal-lg">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
	        	<h4 class="modal-title" id="aboutLabel"><?php 
    echo Lang::l_("About This Service");
    ?>
</h4>
			</div>
			<div class="modal-body">
				<h5><?php 
    echo Lang::l_("What is this?");
    ?>
</h5>
				<p><?php 
    echo Lang::l_("What is this? text");
    ?>
</p>
				<h5><?php 
    echo Lang::l_("How do I choose a route?");
    ?>
</h5>
				<p><?php 
    echo Lang::l_("How do I choose a route? text");
    ?>
</p>
				<h5><?php 
    echo Lang::l_("Where does the data come from and is it up to date?");
    ?>
</h5>
				<p><?php 
    echo Lang::l_("Where does the data come from and is it up to date? text");
    ?>
</p>
				<h5><?php 
    echo Lang::l_("Which data is used?");
    ?>
</h5>
				<p><?php 
    echo Lang::l_("used_data_relations");
    ?>
</p>
				<ul>
					<li><a href="http://wiki.openstreetmap.org/wiki/OpenRailwayMap/Tagging#Train_Route">ref</a></li>
					<li><a href="http://wiki.openstreetmap.org/wiki/OpenRailwayMap/Tagging#Train_Route">operator</a></li>
					<li><a href="http://wiki.openstreetmap.org/wiki/OpenRailwayMap/Tagging#Train_Route">network</a></li>
					<li><a href="http://wiki.openstreetmap.org/wiki/OpenRailwayMap/Tagging#Train_Route">route=rail|train|light_rail|tram|subway</a></li>
					<li><a href="http://wiki.openstreetmap.org/wiki/OpenRailwayMap/Tagging#Train_Route">service=high_speed|long_distance|night|car|car_shuttle|regional|commuter|tourism</a></li>
					<li><a href="http://wiki.openstreetmap.org/wiki/OpenRailwayMap/Tagging#Train_Route">color|colour</a></li>
					<li><a href="http://wiki.openstreetmap.org/wiki/OpenRailwayMap/Tagging#Train_Route">text_color|text_colour|colour:text</a></li>
					<li><a href="http://wiki.openstreetmap.org/wiki/OpenRailwayMap/Tagging#Train_Route">from</a></li>
					<li><a href="http://wiki.openstreetmap.org/wiki/OpenRailwayMap/Tagging#Train_Route">to</a></li>
					<li><a href="http://wiki.openstreetmap.org/wiki/OpenRailwayMap/Tagging#Train_Route">via</a></li>
				</ul>
				<p><?php 
    echo Lang::l_("used_data_ways");
    ?>
</p>
				<ul>
					<li><a href="http://wiki.openstreetmap.org/wiki/OpenRailwayMap/Tagging#Tracks">railway=rail|light_rail|tram|narrow_gauge|subway|miniature</a></li>
					<li><a href="http://wiki.openstreetmap.org/wiki/OpenRailwayMap/Tagging#Tracks">maxspeed</a></li>
					<li><a href="http://wiki.openstreetmap.org/wiki/OpenRailwayMap/Tagging#Tracks">maxspeed:forward</a></li>
					<li><a href="http://wiki.openstreetmap.org/wiki/OpenRailwayMap/Tagging#Tracks">maxspeed:backward</a></li>
					<li><a href="http://wiki.openstreetmap.org/wiki/OpenRailwayMap/Tagging#Tracks">operator</a></li>
					<li><a href="http://wiki.openstreetmap.org/wiki/OpenRailwayMap/Tagging#Tracks">railway:traffic_mode</a></li>
					<li><a href="http://wiki.openstreetmap.org/wiki/OpenRailwayMap/Tagging#Tracks">electrified</a></li>
					<li><a href="http://wiki.openstreetmap.org/wiki/OpenRailwayMap/Tagging#Tracks">voltage</a></li>
					<li><a href="http://wiki.openstreetmap.org/wiki/OpenRailwayMap/Tagging#Tracks">frequency</a></li>
					<li><a href="http://wiki.openstreetmap.org/wiki/OpenRailwayMap/Tagging#Tracks">bridge</a></li>
					<li><a href="http://wiki.openstreetmap.org/wiki/OpenRailwayMap/Tagging#Tracks">tunnel</a></li>
					<li><a href="http://wiki.openstreetmap.org/wiki/OpenRailwayMap/Tagging#Tracks">embankment</a></li>
					<li><a href="http://wiki.openstreetmap.org/wiki/OpenRailwayMap/Tagging#Tracks">cutting</a></li>
				</ul>
				<p><?php 
    echo Lang::l_("used_data_maxspeed");
    ?>
</p>
				<ul>
					<li><a href="http://wiki.openstreetmap.org/wiki/OpenRailwayMap/Tagging#Tracks">service</a></li>
					<li><a href="http://wiki.openstreetmap.org/wiki/OpenRailwayMap/Tagging#Tracks">railway:pzb</a></li>
					<li><a href="http://wiki.openstreetmap.org/wiki/OpenRailwayMap/Tagging#Tracks">railway:lzb</a></li>
					<li><a href="http://wiki.openstreetmap.org/wiki/OpenRailwayMap/Tagging#Tracks">railway:imu</a></li>
					<li><a href="http://wiki.openstreetmap.org/wiki/OpenRailwayMap/Tagging#Tracks">railway:ects</a></li>
					<li><a href="http://wiki.openstreetmap.org/wiki/OpenRailwayMap/Tagging#Tracks">railway:selcab</a></li>
					<li><a href="http://wiki.openstreetmap.org/wiki/OpenRailwayMap/Tagging#Tracks">highspeed</a></li>
					<li><a href="http://wiki.openstreetmap.org/wiki/OpenRailwayMap/Tagging#Tracks">usage=main|branch</a></li>
				</ul>
				<p><?php 
    echo Lang::l_("used_data_stops");
    ?>
</p>
				<ul>
					<li>name</li>
					<li>ref_name</li>
					<li>description</li>
				</ul>
				<h5><?php 
    echo Lang::l_("I have a suggestion. / I found an error");
    ?>
</h5>
				<p><?php 
    echo Lang::l_("suggestion_error_text");
    ?>
</p>
				<h5><?php 
    echo Lang::l_("Changelog");
    ?>
</h5>
	<?php 
    $changelog = parseChangelog();
    $changelog_size = count($changelog);
    if ($changelog_size > 2) {
        ?>
		
				<div class="collapse" id="changelog">
		<?php 
    }
    $i = 1;
    foreach ($changelog as $changelogi) {
        if ($i > $changelog_size - 2) {
            ?>
				</div>
				<div>
			<?php 
        }
        ?>
					<h6><?php 
        echo $changelogi["heading"];
        ?>
</h6>
					<ul>
		<?php 
        foreach ($changelogi["content"] as $changelogcontent) {
            ?>
						<li><?php 
            echo $changelogcontent;
            ?>
</li>
			<?php 
        }
        ?>
					</ul>
		<?php 
        $i++;
    }
    if ($changelog_size > 2) {
        ?>
		
				</div>
				<button class="btn btn-default" type="button" data-toggle="collapse" data-target="#changelog" aria-expanded="false" aria-controls="changelog">See complete Changelog</button>
		<?php 
    }
    ?>
			</div>      
			<div class="modal-footer">
        		<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
      		</div>
		</div>
	</div>
</div>
	<?php 
}
 /**
  * returns description of the signals
  * @param $tags array tags of the signal
  */
 public static function showDescription()
 {
     return Lang::l_("ETCS Marker Board (German Ne 14)");
 }
    public static function getSignal($id, $tags, $maxspeed_array, $distance)
    {
        //find out speed for speed signal
        $next_speed_distant = "";
        if (isset(self::$signal_property[$id]["next_speed"])) {
            $next_speed = self::$signal_property[$id]["next_speed"];
        }
        if (isset(self::$signal_property[$id]["main"])) {
            if (isset(self::$signal_property[self::$signal_property[$id]["main"]]["next_speed"])) {
                $next_speed_distant = self::$signal_property[self::$signal_property[$id]["main"]]["next_speed"];
            }
        }
        //find distance to main signal
        $distant_distance = "";
        if (isset($tags["railway:signal:distant"]) || isset($tags["railway:signal:combined"])) {
            if (isset(self::$signal_property[$id]["main"])) {
                $distant_distance = round(self::$signal_property[self::$signal_property[$id]["main"]]["distance"] - self::$signal_property[$id]["distance"], 2) * 1000;
            }
        }
        //find distance between main signals
        $main_distance = "";
        if (isset($tags["railway:signal:main"]) || isset($tags["railway:signal:combined"]) || isset($tags["railway:signal:train_protection:type"]) && $tags["railway:signal:train_protection:type"] == "block_marker") {
            if (isset(self::$signal_property[$id]["next_main"])) {
                $main_distance = round(self::$signal_property[self::$signal_property[$id]["next_main"]]["distance"] - self::$signal_property[$id]["distance"], 2) * 1000;
            }
        }
        //find state of speed limit signal
        if (isset($tags["railway:signal:speed_limit"])) {
            if ($tags["railway:signal:speed_limit"] == "DE-ESO:zs3") {
                $speed = Speedlimit_zs3::findState($tags, $next_speed);
            }
        }
        //find speed for distant speed limit signals
        if (isset($tags["railway:signal:speed_limit_distant"])) {
            if ($tags["railway:signal:speed_limit_distant"] == "DE-ESO:zs3v") {
                $speed_distant = Speedlimit_zs3v::findState($tags, $next_speed_distant);
            }
        }
        //find state for main signals
        if (isset($tags["railway:signal:main"])) {
            //German Hp signals
            if ($tags["railway:signal:main"] == "DE-ESO:hp") {
                $state_main = HV_main::findState($tags, $next_speed, $main_distance);
            } elseif ($tags["railway:signal:main"] == "DE-ESO:ks") {
                $state_main = KS_main::findState($tags, $next_speed, $main_distance);
            } elseif ($tags["railway:signal:main"] == "DE-ESO:hl") {
                $state_main = HL_main::findState($tags, $next_speed, $main_distance);
            }
        }
        //German combined ks signals
        if (isset($tags["railway:signal:combined"])) {
            if ($tags["railway:signal:combined"] == "DE-ESO:ks") {
                $state_combined = KS_combined::findState($tags, $next_speed, $next_speed_distant, $main_distance);
            }
            if ($tags["railway:signal:combined"] == "DE-ESO:hl") {
                $state_combined = HL_combined::findState($tags, $next_speed, $next_speed_distant, $main_distance);
            }
        }
        //Find state for distant signals
        if (isset($tags["railway:signal:distant"])) {
            //German vr signals
            if ($tags["railway:signal:distant"] == "DE-ESO:vr") {
                $state_distant = HV_distant::findState($tags, $next_speed_distant, $main_distance);
            } elseif ($tags["railway:signal:distant"] == "DE-ESO:ks") {
                $state_distant = KS_distant::findState($tags, $next_speed_distant, $main_distance);
            } elseif ($tags["railway:signal:distant"] == "DE-ESO:hl") {
                $state_distant = HL_distant::findState($tags, $next_speed_distant, $main_distance);
            }
        }
        if (!isset($tags["railway:signal:main"]) && !isset($tags["railway:signal:combined"]) && !isset($tags["railway:signal:distant"]) && !isset($tags["railway:signal:speed"]) && !isset($tags["railway:signal:speed_distant"]) && !(isset($tags["railway:signal:train_protection:type"]) && $tags["railway:signal:train_protection:type"] == "block_marker")) {
            return;
        }
        $result = "\n\t\t\t<tr>\n\t\t\t\t<td> km " . round($distance, 2) . "</td>\n\t\t\t\t<td> ";
        //write query for svg file
        $get = "?";
        $get_ref = $get_position = false;
        foreach ($tags as $k => $v) {
            if ($k == "railway:signal:main" || $k == "railway:signal:main:states" || $k == "railway:signal:main:substitute_signal" || $k == "railway:signal:main:form" || $k == "railway:signal:combined" || $k == "railway:signal:combined:states" || $k == "railway:signal:combined:substitute_signal" || $k == "railway:signal:combined:shortened" || $k == "railway:signal:combined:form" || $k == "railway:signal:distant" || $k == "railway:signal:distant:states" || $k == "railway:signal:distant:repeated" || $k == "railway:signal:distant:form" || $k == "railway:signal:distant:shortened" || $k == "railway:signal:speed_limit" || $k == "railway:signal:speed_limit:form" || $k == "railway:signal:speed_limit:speed" || $k == "railway:signal:speed_limit_distant" || $k == "railway:signal:speed_limit_distant:form" || $k == "railway:signal:speed_limit_distant:speed" || $k == "railway:signal:train_protection" || $k == "railway:signal:minor") {
                $get .= urlencode($k) . "=" . urlencode($v) . "&";
            }
            // ref only needed for train_protection sign "blockkennzeichen"
            if ($k == "ref") {
                $ref = $v;
            }
            if ($k == "railway:signal:train_protection" && $v == "DE-ESO:blockkennzeichen") {
                $get_ref = true;
            }
            // position only needed for train_protection sign "ETCS marker board"
            if ($k == "railway:signal:position") {
                $position = $v;
            }
            if ($k == "railway:signal:train_protection" && $v == "DE-ESO:ne14") {
                $get_position = true;
            }
        }
        if ($get_ref && isset($ref)) {
            $get .= "ref=" . urlencode($ref) . "&";
        }
        if ($get_position && isset($position)) {
            $get .= "railway:signal:position=" . urlencode($position) . "&";
        }
        if (isset($speed) && $speed) {
            $get .= "&speed=" . $speed;
        }
        if (isset($speed_distant) && $speed_distant) {
            $get .= "&speed_distant=" . $speed_distant;
        }
        /* not needed yet
        		if(isset($route))
        		{
        			$get .= "&route=".$route;
        		}
        		if(isset($route_distant))
        		{
        			$get .= "&route_distant=".$route_distant;
        		}*/
        if (isset($state_main)) {
            $get .= "&state_main=" . $state_main;
        }
        if (isset($state_combined)) {
            $get .= "&state_combined=" . $state_combined;
        }
        if (isset($state_distant)) {
            $get .= "&state_distant=" . $state_distant;
        }
        $result .= '
				<object type="image/svg+xml" data="img/signals/signal.php' . $get . '" class="svg signal">
				</object>';
        // add ref
        if (isset($tags["ref"])) {
            // ref not needed for German Blockkennzeichen
            if (!isset($tags["railway:signal:train_protection"]) || $tags["railway:signal:train_protection"] != "DE-ESO:blockkennzeichen") {
                $result .= '
						<span class="signal_ref">' . $tags["ref"] . '</span>';
            }
        }
        $result .= '</td>';
        //show position
        if (isset($tags["railway:signal:position"])) {
            $img_position = "signal_unknown_position.svg";
            if ($tags["railway:signal:position"] == "right") {
                if (isset($tags["railway:signal:expected_position"]) && $tags["railway:signal:expected_position"] == "left") {
                    $img_position = "signal_right_expected_left.svg";
                } else {
                    $img_position = "signal_right.svg";
                }
            } elseif ($tags["railway:signal:position"] == "left") {
                if (isset($tags["railway:signal:expected_position"]) && $tags["railway:signal:expected_position"] == "right") {
                    $img_position = "signal_left_expected_right.svg";
                } else {
                    $img_position = "signal_left.svg";
                }
            }
            if ($tags["railway:signal:position"] == "bridge") {
                $img_position = "signal_bridge.svg";
            }
        } else {
            $img_position = "signal_unknown_position.svg";
        }
        $result .= '<td>
				<img src="img/signals/' . $img_position . '" width = "40">
				</td>';
        $result .= '<td>';
        //show description of signal
        $description_set = false;
        if (isset($tags["railway:signal:main"]) || isset($tags["railway:signal:combined"])) {
            if (isset($tags["railway:signal:combined"])) {
                $tags["railway:signal:main"] = $tags["railway:signal:combined"];
            }
            if ($tags["railway:signal:main"] == "DE-ESO:ks") {
                $result .= KS_main::showDescription();
            } elseif ($tags["railway:signal:main"] == "DE-ESO:hp") {
                $result .= HV_main::showDescription();
            } elseif ($tags["railway:signal:main"] == "DE-ESO:hl") {
                $result .= HL_main::showDescription();
            } else {
                $result .= main_light::showDescription();
            }
            if (isset($tags["railway:signal:combined:function"])) {
                $tags["railway:signal:main:function"] = $tags["railway:signal:combined:function"];
            }
            if (isset($tags["railway:signal:main:function"])) {
                if ($tags["railway:signal:main:function"] == "entry") {
                    $result .= Lang::l_(" Entry Signal");
                } elseif ($tags["railway:signal:main:function"] == "intermediate") {
                    $result .= Lang::l_(" Intermediate Signal");
                } elseif ($tags["railway:signal:main:function"] == "exit") {
                    $result .= Lang::l_(" Exit Signal");
                } elseif ($tags["railway:signal:main:function"] == "block") {
                    $result .= Lang::l_(" Block Signal");
                } else {
                    $result .= Lang::l_(" Main Signal");
                }
            } else {
                $result .= Lang::l_(" Main Signal");
            }
            $description_set = true;
        }
        if (isset($tags["railway:signal:speed_limit"])) {
            if ($description_set) {
                $result .= "<br />";
            }
            if (isset($tags["railway:signal:main"]) || isset($tags["railway:signal:combined"])) {
                $result .= Lang::l_("with ");
            }
            if ($tags["railway:signal:speed_limit"] == "DE-ESO:zs3") {
                $result .= Speedlimit_zs3::showDescription();
            } elseif ($tags["railway:signal:speed_limit"] == "DE-ESO:lf7") {
                $result .= Lang::l_("German Lf7 Speed signal");
            } else {
                $result .= Lang::l_("Unknown Speed signal");
            }
            // Show available speed limits
            if (isset($tags["railway:signal:speed_limit:speed"])) {
                $speeds = explode(";", $tags["railway:signal:speed_limit:speed"]);
                $result .= " (";
                $i = 0;
                foreach ($speeds as $speed) {
                    if ($i > 0) {
                        $result .= ", ";
                    }
                    if (is_numeric($speed)) {
                        $result .= $speed . " km/h";
                    } elseif ($speed == "off") {
                        $result .= Lang::l_("off");
                    } elseif ($speed == "?") {
                        $result .= Lang::l_("...");
                    } else {
                        $result .= Lang::l_("unknown");
                    }
                    $i++;
                }
                $result .= ")";
            }
            $description_set = true;
        }
        if (isset($tags["railway:signal:distant"]) || isset($tags["railway:signal:combined"])) {
            if ($description_set) {
                $result .= "<br />";
            }
            if (isset($tags["railway:signal:combined"])) {
                $result .= Lang::l_("combined with ");
                $tags["railway:signal:distant"] = $tags["railway:signal:combined"];
            }
            if ($tags["railway:signal:distant"] == "DE-ESO:ks") {
                $result .= KS_distant::showDescription();
            } elseif ($tags["railway:signal:distant"] == "DE-ESO:vr") {
                $result .= HV_distant::showDescription();
            } elseif ($tags["railway:signal:distant"] == "DE-ESO:hl") {
                $result .= HL_distant::showDescription();
            } else {
                $result .= distant_light::showDescription();
            }
            if (isset($tags["railway:signal:distant:repeated"]) && $tags["railway:signal:distant:repeated"] == "yes") {
                $result .= Lang::l_(" Repeated");
            }
            $result .= Lang::l_(" Distant Signal");
            $description_set = true;
        }
        if (isset($tags["railway:signal:speed_limit_distant"])) {
            if ($description_set) {
                $result .= "<br />";
            }
            if (isset($tags["railway:signal:distant"])) {
                $result .= Lang::l_("with ");
            }
            if ($tags["railway:signal:speed_limit_distant"] == "DE-ESO:zs3v") {
                $result .= Speedlimit_zs3v::showDescription();
            } elseif ($tags["railway:signal:speed_limit_distant"] == "DE-ESO:lf6") {
                $result .= Lang::l_("German Lf6 Distant Speed signal");
            } else {
                $result .= Lang::l_("Unknown Distant Speed signal");
            }
            if (isset($tags["railway:signal:speed_limit_distant:speed"])) {
                $speeds = explode(";", $tags["railway:signal:speed_limit_distant:speed"]);
                $result .= " (";
                $i = 0;
                foreach ($speeds as $speed) {
                    if ($i > 0) {
                        $result .= ", ";
                    }
                    if (is_numeric($speed)) {
                        $result .= $speed . " km/h";
                    } elseif ($speed == "off") {
                        $result .= Lang::l_("off");
                    } elseif ($speed == "?") {
                        $result .= Lang::l_("...");
                    } else {
                        $result .= Lang::l_("unknown");
                    }
                    $i++;
                }
                $result .= ")";
            }
            $description_set = true;
        }
        if (isset($tags["railway:signal:train_protection"])) {
            if ($description_set) {
                $result .= "<br />";
            }
            if ($tags["railway:signal:train_protection"] == "DE-ESO:blockkennzeichen") {
                $result .= Blockkennzeichen::showDescription();
            } elseif ($tags["railway:signal:train_protection"] == "DE-ESO:ne14") {
                $result .= ETCS_markerboard::showDescription();
            } else {
                $result .= Lang::l_("Unknown train protection sign");
            }
            $description_set = true;
        }
        $result .= '</td>';
        if (isset($tags["railway:signal:main"]) && !isset($tags["railway:signal:distant"])) {
            $distant_distance = '<span class="text-muted">x</span>';
        }
        if (isset($tags["railway:signal:distant"]) || isset($tags["railway:signal:combined"])) {
            if (isset(self::$signal_property[$id]["main"])) {
                if ($distant_distance < 300 && (!isset($tags["railway:signal:distant:repeated"]) || $tags["railway:signal:distant:repeated"] != "yes")) {
                    $distant_distance = '<strong class="text-danger">' . $distant_distance . ' m</strong>';
                } else {
                    $distant_distance = $distant_distance . ' m';
                }
            } else {
                $distant_distance = '<strong class="text-danger">?</strong>';
            }
        }
        $result .= '<td>
				' . $distant_distance . '
				</td>';
        if (isset($tags["railway:signal:distant"]) && !isset($tags["railway:signal:main"])) {
            $main_distance = '<span class="text-muted">x</span>';
        }
        if (isset($tags["railway:signal:main"]) || isset($tags["railway:signal:combined"]) || isset($tags["railway:signal:train_protection:type"]) && $tags["railway:signal:train_protection:type"] == "block_marker") {
            if (isset(self::$signal_property[$id]["next_main"])) {
                if ($main_distance < 600 && isset($tags["railway:signal:main:states"]) && strpos($tags["railway:signal:main:states"], "kennlicht")) {
                    $main_distance = '<strong class="text-info">' . $main_distance . ' m</strong>';
                } elseif ($main_distance < 300) {
                    $main_distance = '<strong class="text-danger">' . $main_distance . ' m</strong>';
                } elseif ($main_distance < 600) {
                    $main_distance = '<strong class="text-warning">' . $main_distance . ' m</strong>';
                } elseif ($main_distance > 20000) {
                    $main_distance = '<strong class="text-danger">' . $main_distance . ' m</strong>';
                } elseif ($main_distance > 10000) {
                    $main_distance = '<strong class="text-warning">' . $main_distance . ' m</strong>';
                } else {
                    $main_distance = $main_distance . ' m';
                }
            } else {
                $main_distance = '<strong class="text-danger">?</strong>';
            }
        }
        $result .= '<td>
				' . $main_distance . '
				</td>';
        $result .= '<td>
				<a href="http://www.openstreetmap.org/node/' . $id . '">' . Lang::l_("Show on map") . '</a>
				<br>' . $id . '
				</td>';
        $result .= "</td>\n\t\t\t\t</tr>\n\t\t\t\t\t\t";
        return $result;
    }
 /**
  * returns description of the signals
  * @param $tags array tags of the signal
  */
 public static function showDescription()
 {
     return Lang::l_("German Zs 3 Speed Signal");
 }
Example #11
0
// define path to home directory
define("PATH", "");
//define version numbers of external software
$v_bootstrap = "3.3.4";
$v_leaflet = "0.7.3";
$v_jquery = "1.11.2";
// load language
Lang::defineLanguage();
?>
<!DOCTYPE html>
<html>
<head>

<meta charset='utf-8'> 
<meta name="description" content="<?php 
echo Lang::l_('Analysis of Train Routes Based on OpenStreetMap Data');
?>
">

<!-- include leaflet -->
<script src="http://cdn.leafletjs.com/leaflet-<?php 
echo $v_leaflet;
?>
/leaflet.js"></script>

<!-- include bootstrap -->
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/<?php 
echo $v_bootstrap;
?>
/css/bootstrap.min.css">
 /**
  * returns description of the signals
  * @param $tags array tags of the signal
  */
 public static function showDescription()
 {
     return Lang::l_("German Blockkennzeichen");
 }
Example #13
0
    /**
     * generates form to change the train
     */
    static function changeTrain($trainref = "", $train_def = "", $formid = "train")
    {
        include "train_details.php";
        $type = "";
        ?>
		<select name="train" style="max-width:100%" id="<?php 
        echo $formid;
        ?>
" required>
		
			<option<?php 
        if (!$trainref) {
            ?>
 selected="selected"<?php 
        }
        ?>
 value=""><?php 
        echo Lang::l_('Please choose a train');
        ?>
</option>
		<?php 
        foreach ($tr_name as $ref => $name) {
            if ($tr_type[$ref] != $type) {
                if ($type) {
                    ?>
			</optgroup>
					<?php 
                }
                ?>
			<optgroup label="<?php 
                echo Lang::l_(self::$train_type[$tr_type[$ref]]);
                ?>
">
				<?php 
                $type = $tr_type[$ref];
            }
            ?>
				<option <?php 
            if ($ref == $trainref) {
                echo 'selected="selected"';
            }
            ?>
 <?php 
            if ($ref == $train_def) {
                echo 'class="bg-info"';
            }
            ?>
value="<?php 
            echo $ref;
            ?>
"><?php 
            echo $name;
            ?>
</option>
			<?php 
        }
        ?>
			</optgroup>
		</select>
		<?php 
    }