Commit 67a60b4d authored by Volker Krause's avatar Volker Krause
Browse files

Normalize vehicle and platform sector positions

Those need to be in relative platform coordinates, not meters.
parent aec37840
......@@ -8,7 +8,7 @@
"features": "BikeStorage",
"name": "352",
"platformPositionBegin": 0,
"platformPositionEnd": 26.399999618530273,
"platformPositionEnd": 0.17483443021774292,
"type": "PassengerCar"
},
{
......@@ -17,8 +17,8 @@
"deckCount": 1,
"features": "NoFeatures",
"name": "351",
"platformPositionBegin": 26.399999618530273,
"platformPositionEnd": 52.79999923706055,
"platformPositionBegin": 0.17483443021774292,
"platformPositionEnd": 0.34966886043548584,
"type": "PassengerCar"
},
{
......@@ -27,8 +27,8 @@
"deckCount": 1,
"features": "NoFeatures",
"name": "350",
"platformPositionBegin": 52.79999923706055,
"platformPositionEnd": 79.19999694824219,
"platformPositionBegin": 0.34966886043548584,
"platformPositionEnd": 0.5245032906532288,
"type": "PassengerCar"
},
{
......@@ -37,8 +37,8 @@
"deckCount": 1,
"features": "Restaurant",
"name": "349",
"platformPositionBegin": 79.19999694824219,
"platformPositionEnd": 105.5999984741211,
"platformPositionBegin": 0.5245032906532288,
"platformPositionEnd": 0.6993377208709717,
"type": "RestaurantCar"
},
{
......@@ -47,8 +47,8 @@
"deckCount": 1,
"features": "NoFeatures",
"name": "348",
"platformPositionBegin": 105.5999984741211,
"platformPositionEnd": 132,
"platformPositionBegin": 0.6993377208709717,
"platformPositionEnd": 0.8741722106933594,
"type": "PassengerCar"
},
{
......@@ -56,8 +56,8 @@
"connectedSides": "NoSide",
"deckCount": 1,
"features": "NoFeatures",
"platformPositionBegin": 132,
"platformPositionEnd": 151.60000610351562,
"platformPositionBegin": 0.8741722106933594,
"platformPositionEnd": 1.0039736032485962,
"type": "Engine"
}
]
......
{
"length": 451,
"length": 451,
"name": "8",
"sections": [
{
"begin": 0,
"end": 110.2699966430664,
"end": 0.24450109899044037,
"name": "A"
},
{
"begin": 110.2699966430664,
"end": 185.3199920654297,
"begin": 0.24450109899044037,
"end": 0.41090908646583557,
"name": "B"
},
{
"begin": 185.3199920654297,
"end": 260.3399963378906,
"begin": 0.41090908646583557,
"end": 0.5772505402565002,
"name": "C"
},
{
"begin": 260.3399963378906,
"end": 335.6099853515625,
"begin": 0.5772505402565002,
"end": 0.7441462874412537,
"name": "D"
},
{
"begin": 335.6099853515625,
"end": 451.0799865722656,
"begin": 0.7441462874412537,
"end": 1.0001773834228516,
"name": "E"
}
]
......
......@@ -6,8 +6,8 @@
"connectedSides": "NoSide",
"deckCount": 1,
"features": "NoFeatures",
"platformPositionBegin": 22.054000854492188,
"platformPositionEnd": 48.55400085449219,
"platformPositionBegin": 0.04890022426843643,
"platformPositionEnd": 0.10765853524208069,
"type": "Engine"
},
{
......@@ -16,8 +16,8 @@
"deckCount": 1,
"features": "ToddlerArea|BikeStorage",
"name": "21",
"platformPositionBegin": 48.55400085449219,
"platformPositionEnd": 75.05400085449219,
"platformPositionBegin": 0.10765853524208069,
"platformPositionEnd": 0.16641685366630554,
"type": "PassengerCar"
},
{
......@@ -26,8 +26,8 @@
"deckCount": 1,
"features": "NoFeatures",
"name": "22",
"platformPositionBegin": 75.05400085449219,
"platformPositionEnd": 101.55400085449219,
"platformPositionBegin": 0.16641685366630554,
"platformPositionEnd": 0.2251751720905304,
"type": "PassengerCar"
},
{
......@@ -36,8 +36,8 @@
"deckCount": 1,
"features": "NoFeatures",
"name": "23",
"platformPositionBegin": 101.55400085449219,
"platformPositionEnd": 128.0540008544922,
"platformPositionBegin": 0.2251751720905304,
"platformPositionEnd": 0.28393349051475525,
"type": "PassengerCar"
},
{
......@@ -46,8 +46,8 @@
"deckCount": 1,
"features": "NoFeatures",
"name": "24",
"platformPositionBegin": 128.0540008544922,
"platformPositionEnd": 154.5540008544922,
"platformPositionBegin": 0.28393349051475525,
"platformPositionEnd": 0.3426918089389801,
"type": "PassengerCar"
},
{
......@@ -56,8 +56,8 @@
"deckCount": 1,
"features": "Restaurant|WheelchairAccessible",
"name": "25",
"platformPositionBegin": 154.5540008544922,
"platformPositionEnd": 181.0540008544922,
"platformPositionBegin": 0.3426918089389801,
"platformPositionEnd": 0.40145012736320496,
"type": "PassengerCar"
},
{
......@@ -66,8 +66,8 @@
"deckCount": 1,
"features": "NoFeatures",
"name": "26",
"platformPositionBegin": 181.0540008544922,
"platformPositionEnd": 207.5540008544922,
"platformPositionBegin": 0.40145012736320496,
"platformPositionEnd": 0.4602084159851074,
"type": "PassengerCar"
},
{
......@@ -76,8 +76,8 @@
"deckCount": 1,
"features": "NoFeatures",
"name": "27",
"platformPositionBegin": 207.5540008544922,
"platformPositionEnd": 234.0540008544922,
"platformPositionBegin": 0.4602084159851074,
"platformPositionEnd": 0.5189667344093323,
"type": "PassengerCar"
}
]
......
......@@ -46,7 +46,6 @@ bool OebbVehicleLayoutParser::parse(const QByteArray &data)
section.setEnd(prevSectorEnd += sectorObj.value(QLatin1String("length")).toDouble());
platformSections.push_back(section);
}
platform.setSections(std::move(platformSections));
platform.setLength(prevSectorEnd);
// TODO platform.egress lists relevant features like escalators/elevators on the platform
......@@ -100,11 +99,24 @@ bool OebbVehicleLayoutParser::parse(const QByteArray &data)
vehicleSections.push_back(section);
}
vehicle.setSections(std::move(vehicleSections));
// guess platform length if we didn't get platform sectors
platform.setLength(std::max<int>(platform.length(), prevVehicleEnd));
// adjust vehicle and platform section positions to normalized platform coordinates
if (platform.length() > 0.0) {
for (auto &sec : platformSections) {
sec.setBegin(sec.begin() / platform.length());
sec.setEnd(sec.end() / platform.length());
}
for (auto &sec : vehicleSections) {
sec.setPlatformPositionBegin(sec.platformPositionBegin() / platform.length());
sec.setPlatformPositionEnd(sec.platformPositionEnd() / platform.length());
}
}
vehicle.setSections(std::move(vehicleSections));
platform.setSections(std::move(platformSections));
// departure
// TODO recover destination when possible
Location stop;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment