mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-17 18:39:50 +00:00
added hasId() to Location
git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@513 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
parent
33e63d9b1f
commit
3b2b2bb675
5 changed files with 12 additions and 6 deletions
|
@ -1636,7 +1636,7 @@ public abstract class AbstractEfaProvider implements NetworkProvider
|
||||||
|
|
||||||
protected static final String locationValue(final Location location)
|
protected static final String locationValue(final Location location)
|
||||||
{
|
{
|
||||||
if ((location.type == LocationType.STATION || location.type == LocationType.POI) && location.id != 0)
|
if ((location.type == LocationType.STATION || location.type == LocationType.POI) && location.hasId())
|
||||||
return Integer.toString(location.id);
|
return Integer.toString(location.id);
|
||||||
else
|
else
|
||||||
return location.name;
|
return location.name;
|
||||||
|
|
|
@ -564,7 +564,7 @@ public abstract class AbstractHafasProvider implements NetworkProvider
|
||||||
|
|
||||||
private static final String location(final Location location)
|
private static final String location(final Location location)
|
||||||
{
|
{
|
||||||
if (location.type == LocationType.STATION && location.id != 0)
|
if (location.type == LocationType.STATION && location.hasId())
|
||||||
return "<Station externalId=\"" + location.id + "\" />";
|
return "<Station externalId=\"" + location.id + "\" />";
|
||||||
if (location.type == LocationType.POI && location.hasLocation())
|
if (location.type == LocationType.POI && location.hasLocation())
|
||||||
return "<Poi type=\"WGS84\" x=\"" + location.lon + "\" y=\"" + location.lat + "\" />";
|
return "<Poi type=\"WGS84\" x=\"" + location.lon + "\" y=\"" + location.lat + "\" />";
|
||||||
|
@ -582,7 +582,7 @@ public abstract class AbstractHafasProvider implements NetworkProvider
|
||||||
builder.append("@X=" + location.lon + "@Y=" + location.lat);
|
builder.append("@X=" + location.lon + "@Y=" + location.lat);
|
||||||
if (location.name != null)
|
if (location.name != null)
|
||||||
builder.append("@G=" + location.name);
|
builder.append("@G=" + location.name);
|
||||||
if (location.type == LocationType.STATION && location.id != 0)
|
if (location.type == LocationType.STATION && location.hasId())
|
||||||
builder.append("@L=").append(location.id);
|
builder.append("@L=").append(location.id);
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,7 +119,7 @@ public class VmvProvider extends AbstractEfaProvider
|
||||||
@Override
|
@Override
|
||||||
protected void appendLocation(final StringBuilder uri, final Location location, final String paramSuffix)
|
protected void appendLocation(final StringBuilder uri, final Location location, final String paramSuffix)
|
||||||
{
|
{
|
||||||
if (location.type == LocationType.POI && location.id != 0)
|
if (location.type == LocationType.POI && location.hasId())
|
||||||
{
|
{
|
||||||
uri.append("&type_").append(paramSuffix).append("=poiID");
|
uri.append("&type_").append(paramSuffix).append("=poiID");
|
||||||
uri.append("&name_").append(paramSuffix).append("=").append(location.id);
|
uri.append("&name_").append(paramSuffix).append("=").append(location.id);
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package de.schildbach.pte;
|
package de.schildbach.pte;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
|
@ -31,7 +32,7 @@ public class VvsProvider extends AbstractEfaProvider
|
||||||
{
|
{
|
||||||
public static final NetworkId NETWORK_ID = NetworkId.VVS;
|
public static final NetworkId NETWORK_ID = NetworkId.VVS;
|
||||||
public static final String OLD_NETWORK_ID = "mobil.vvs.de";
|
public static final String OLD_NETWORK_ID = "mobil.vvs.de";
|
||||||
private static final String API_BASE = "http://mobil.vvs.de/mobile/";
|
private static final String API_BASE = "http://mobil.vvs.de/mobile/"; // http://www2.vvs.de/vvs/
|
||||||
|
|
||||||
public NetworkId id()
|
public NetworkId id()
|
||||||
{
|
{
|
||||||
|
@ -119,7 +120,7 @@ public class VvsProvider extends AbstractEfaProvider
|
||||||
@Override
|
@Override
|
||||||
protected void appendLocation(final StringBuilder uri, final Location location, final String paramSuffix)
|
protected void appendLocation(final StringBuilder uri, final Location location, final String paramSuffix)
|
||||||
{
|
{
|
||||||
if (location.type == LocationType.POI && location.id != 0)
|
if (location.type == LocationType.POI && location.hasId())
|
||||||
{
|
{
|
||||||
uri.append("&type_").append(paramSuffix).append("=poiID");
|
uri.append("&type_").append(paramSuffix).append("=poiID");
|
||||||
uri.append("&name_").append(paramSuffix).append("=").append(location.id);
|
uri.append("&name_").append(paramSuffix).append("=").append(location.id);
|
||||||
|
|
|
@ -70,6 +70,11 @@ public final class Location implements Serializable
|
||||||
this.name = null;
|
this.name = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final boolean hasId()
|
||||||
|
{
|
||||||
|
return id != 0;
|
||||||
|
}
|
||||||
|
|
||||||
public final boolean hasLocation()
|
public final boolean hasLocation()
|
||||||
{
|
{
|
||||||
return lat != 0 || lon != 0;
|
return lat != 0 || lon != 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue