Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Itinerary
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
20
Issues
20
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PIM
Itinerary
Commits
b2aa5a05
Commit
b2aa5a05
authored
Jan 01, 2019
by
Volker Krause
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Various fixes for me mixing up latitude and longitude
parent
b4a928cb
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
29 deletions
+29
-29
src/publictransport/backends/abstractbackend.cpp
src/publictransport/backends/abstractbackend.cpp
+2
-2
src/publictransport/backends/hafasmgatebackend.cpp
src/publictransport/backends/hafasmgatebackend.cpp
+2
-2
src/publictransport/backends/hafasmgateparser.cpp
src/publictransport/backends/hafasmgateparser.cpp
+1
-1
src/publictransport/backends/navitiabackend.cpp
src/publictransport/backends/navitiabackend.cpp
+5
-5
tests/locationquery.qml
tests/locationquery.qml
+19
-19
No files found.
src/publictransport/backends/abstractbackend.cpp
View file @
b2aa5a05
...
...
@@ -40,14 +40,14 @@ void AbstractBackend::setBackendId(const QString& id)
bool
AbstractBackend
::
isLocationExcluded
(
const
Location
&
loc
)
const
{
if
(
loc
.
hasCoordinate
()
&&
!
m_geoFilter
.
isEmpty
())
{
return
!
m_geoFilter
.
containsPoint
({
loc
.
l
atitude
(),
loc
.
long
itude
()},
Qt
::
WindingFill
);
return
!
m_geoFilter
.
containsPoint
({
loc
.
l
ongitude
(),
loc
.
lat
itude
()},
Qt
::
WindingFill
);
}
return
false
;
}
bool
AbstractBackend
::
isCoordinateExcluded
(
float
lat
,
float
lon
)
const
{
return
!
m_geoFilter
.
isEmpty
()
&&
!
m_geoFilter
.
containsPoint
({
l
at
,
lon
},
Qt
::
WindingFill
);
return
!
m_geoFilter
.
isEmpty
()
&&
!
m_geoFilter
.
containsPoint
({
l
on
,
lat
},
Qt
::
WindingFill
);
}
void
AbstractBackend
::
setGeoFilter
(
const
QPolygonF
&
poly
)
...
...
src/publictransport/backends/hafasmgatebackend.cpp
View file @
b2aa5a05
...
...
@@ -289,8 +289,8 @@ QNetworkReply* HafasMgateBackend::postLocationQuery(const LocationRequest &req,
cfg
.
insert
(
QLatin1String
(
"polyEnc"
),
QLatin1String
(
"GPA"
));
QJsonObject
coord
;
coord
.
insert
(
QLatin1String
(
"x"
),
(
int
)(
req
.
l
at
itude
()
*
1000000
));
coord
.
insert
(
QLatin1String
(
"y"
),
(
int
)(
req
.
l
ong
itude
()
*
1000000
));
coord
.
insert
(
QLatin1String
(
"x"
),
(
int
)(
req
.
l
ong
itude
()
*
1000000
));
coord
.
insert
(
QLatin1String
(
"y"
),
(
int
)(
req
.
l
at
itude
()
*
1000000
));
QJsonObject
ring
;
ring
.
insert
(
QLatin1String
(
"cCrd"
),
coord
);
ring
.
insert
(
QLatin1String
(
"maxDist"
),
20000
);
// not sure which unit...
...
...
src/publictransport/backends/hafasmgateparser.cpp
View file @
b2aa5a05
...
...
@@ -73,7 +73,7 @@ std::vector<Location> HafasMgateParser::parseLocations(const QJsonArray &locL) c
loc
.
setName
(
locObj
.
value
(
QLatin1String
(
"name"
)).
toString
());
loc
.
setIdentifier
(
m_locIdType
,
locObj
.
value
(
QLatin1String
(
"extId"
)).
toString
());
const
auto
coordObj
=
locObj
.
value
(
QLatin1String
(
"crd"
)).
toObject
();
loc
.
setCoordinate
(
coordObj
.
value
(
QLatin1String
(
"
x"
)).
toDouble
()
/
1000000.0
,
coordObj
.
value
(
QLatin1String
(
"y
"
)).
toDouble
()
/
1000000.0
);
loc
.
setCoordinate
(
coordObj
.
value
(
QLatin1String
(
"
y"
)).
toDouble
()
/
1000000.0
,
coordObj
.
value
(
QLatin1String
(
"x
"
)).
toDouble
()
/
1000000.0
);
locs
.
push_back
(
loc
);
}
return
locs
;
...
...
src/publictransport/backends/navitiabackend.cpp
View file @
b2aa5a05
...
...
@@ -60,8 +60,8 @@ bool NavitiaBackend::queryJourney(JourneyReply *reply, QNetworkAccessManager *na
QStringLiteral
(
"/journeys"
));
QUrlQuery
query
;
query
.
addQueryItem
(
QStringLiteral
(
"from"
),
QString
::
number
(
req
.
from
().
l
atitude
())
+
QLatin1Char
(
';'
)
+
QString
::
number
(
req
.
from
().
long
itude
()));
query
.
addQueryItem
(
QStringLiteral
(
"to"
),
QString
::
number
(
req
.
to
().
l
atitude
())
+
QLatin1Char
(
';'
)
+
QString
::
number
(
req
.
to
().
long
itude
()));
query
.
addQueryItem
(
QStringLiteral
(
"from"
),
QString
::
number
(
req
.
from
().
l
ongitude
())
+
QLatin1Char
(
';'
)
+
QString
::
number
(
req
.
from
().
lat
itude
()));
query
.
addQueryItem
(
QStringLiteral
(
"to"
),
QString
::
number
(
req
.
to
().
l
ongitude
())
+
QLatin1Char
(
';'
)
+
QString
::
number
(
req
.
to
().
lat
itude
()));
if
(
req
.
dateTime
().
isValid
())
{
query
.
addQueryItem
(
QStringLiteral
(
"datetime"
),
req
.
dateTime
().
toString
(
QStringLiteral
(
"yyyyMMddThhmmss"
)));
query
.
addQueryItem
(
QStringLiteral
(
"datetime_represents"
),
req
.
dateTimeMode
()
==
JourneyRequest
::
Arrival
?
QStringLiteral
(
"arrival"
)
:
QStringLiteral
(
"departure"
));
...
...
@@ -108,8 +108,8 @@ bool NavitiaBackend::queryDeparture(DepartureReply *reply, QNetworkAccessManager
url
.
setHost
(
m_endpoint
);
url
.
setPath
(
QStringLiteral
(
"/v1/coverage/"
)
+
(
m_coverage
.
isEmpty
()
?
QString
::
number
(
req
.
stop
().
l
atitude
())
+
QLatin1Char
(
';'
)
+
QString
::
number
(
req
.
stop
().
long
itude
())
:
m_coverage
)
+
QStringLiteral
(
"/coord/"
)
+
QString
::
number
(
req
.
stop
().
l
atitude
())
+
QLatin1Char
(
';'
)
+
QString
::
number
(
req
.
stop
().
long
itude
())
+
(
m_coverage
.
isEmpty
()
?
QString
::
number
(
req
.
stop
().
l
ongitude
())
+
QLatin1Char
(
';'
)
+
QString
::
number
(
req
.
stop
().
lat
itude
())
:
m_coverage
)
+
QStringLiteral
(
"/coord/"
)
+
QString
::
number
(
req
.
stop
().
l
ongitude
())
+
QLatin1Char
(
';'
)
+
QString
::
number
(
req
.
stop
().
lat
itude
())
+
(
req
.
mode
()
==
DepartureRequest
::
QueryDeparture
?
QStringLiteral
(
"/departures"
)
:
QStringLiteral
(
"/arrivals"
))
);
...
...
@@ -159,7 +159,7 @@ bool NavitiaBackend::queryLocation(LocationReply *reply, QNetworkAccessManager *
if
(
req
.
hasCoordinate
())
{
url
.
setPath
(
QStringLiteral
(
"/v1/coord/"
)
+
QString
::
number
(
req
.
l
atitude
())
+
QLatin1Char
(
';'
)
+
QString
::
number
(
req
.
long
itude
())
+
QStringLiteral
(
"/v1/coord/"
)
+
QString
::
number
(
req
.
l
ongitude
())
+
QLatin1Char
(
';'
)
+
QString
::
number
(
req
.
lat
itude
())
+
QStringLiteral
(
"/places_nearby"
)
);
// TODO distance
...
...
tests/locationquery.qml
View file @
b2aa5a05
...
...
@@ -31,25 +31,25 @@ Kirigami.ApplicationWindow {
ListModel
{
id
:
exampleModel
ListElement
{
name
:
"
Charles de Gaulles
"
;
l
at
:
2.57110
;
lon
:
49.00406
;
}
ListElement
{
name
:
"
Paris Gare de Lyon
"
;
l
at
:
2.37385
;
lon
:
48.84467
;
}
ListElement
{
name
:
"
Zürich Flughafen
"
;
l
at
:
8.56275
;
lon
:
47.45050
;
}
ListElement
{
name
:
"
Randa
"
;
l
at
:
7.78315
;
lon
:
46.09901
;
}
ListElement
{
name
:
"
Brussels Gare de Midi
"
;
l
at
:
4.33620
;
lon
:
50.83588
;
}
ListElement
{
name
:
"
ULB
"
;
l
at
:
4.38116
;
lon
:
50.81360
}
ListElement
{
name
:
"
Wien Flughafen
"
;
l
at
:
16.56312
;
lon
:
48.12083
;
}
ListElement
{
name
:
"
Akademy 2018 Accomodation
"
;
l
at
:
16.37859
;
lon
:
48.18282
}
ListElement
{
name
:
"
Akademy 2018 BBQ
"
;
l
at
:
16.43191
;
lon
:
48.21612
}
ListElement
{
name
:
"
LEI
"
;
l
at
:
-
2.37251
;
lon
:
36.84774
;
}
ListElement
{
name
:
"
Akademy 2017 Accomodation
"
;
l
at
:
-
2.44788
;
lon
:
36.83731
}
ListElement
{
name
:
"
Akademy 2017 Venue
"
;
l
at
:
-
2.40377
;
lon
:
36.82784
}
ListElement
{
name
:
"
TXL
"
;
l
at
:
13.29281
;
lon
:
52.55420
;
}
ListElement
{
name
:
"
Alexanderplatz
"
;
l
at
:
13.41644
;
lon
:
52.52068
}
ListElement
{
name
:
"
SXF
"
;
l
at
:
13.51870
;
lon
:
52.38841
;
}
ListElement
{
name
:
"
Brno central station
"
;
l
at
:
16.61287
;
lon
:
49.19069
}
ListElement
{
name
:
"
Akademy 2014 venue
"
;
l
at
:
16.57564
;
lon
:
49.22462
}
ListElement
{
name
:
"
Copenhagen Central
"
;
l
at
:
12.56489
;
lon
:
55.67238
;
}
ListElement
{
name
:
"
Frankfurt (Main) Hauptbahnhof
"
;
l
at
:
8.6625
;
lon
:
50.106944
;
}
ListElement
{
name
:
"
Charles de Gaulles
"
;
l
on
:
2.57110
;
lat
:
49.00406
;
}
ListElement
{
name
:
"
Paris Gare de Lyon
"
;
l
on
:
2.37385
;
lat
:
48.84467
;
}
ListElement
{
name
:
"
Zürich Flughafen
"
;
l
on
:
8.56275
;
lat
:
47.45050
;
}
ListElement
{
name
:
"
Randa
"
;
l
on
:
7.78315
;
lat
:
46.09901
;
}
ListElement
{
name
:
"
Brussels Gare de Midi
"
;
l
on
:
4.33620
;
lat
:
50.83588
;
}
ListElement
{
name
:
"
ULB
"
;
l
on
:
4.38116
;
lat
:
50.81360
}
ListElement
{
name
:
"
Wien Flughafen
"
;
l
on
:
16.56312
;
lat
:
48.12083
;
}
ListElement
{
name
:
"
Akademy 2018 Accomodation
"
;
l
on
:
16.37859
;
lat
:
48.18282
}
ListElement
{
name
:
"
Akademy 2018 BBQ
"
;
l
on
:
16.43191
;
lat
:
48.21612
}
ListElement
{
name
:
"
LEI
"
;
l
on
:
-
2.37251
;
lat
:
36.84774
;
}
ListElement
{
name
:
"
Akademy 2017 Accomodation
"
;
l
on
:
-
2.44788
;
lat
:
36.83731
}
ListElement
{
name
:
"
Akademy 2017 Venue
"
;
l
on
:
-
2.40377
;
lat
:
36.82784
}
ListElement
{
name
:
"
TXL
"
;
l
on
:
13.29281
;
lat
:
52.55420
;
}
ListElement
{
name
:
"
Alexanderplatz
"
;
l
on
:
13.41644
;
lat
:
52.52068
}
ListElement
{
name
:
"
SXF
"
;
l
on
:
13.51870
;
lat
:
52.38841
;
}
ListElement
{
name
:
"
Brno central station
"
;
l
on
:
16.61287
;
lat
:
49.19069
}
ListElement
{
name
:
"
Akademy 2014 venue
"
;
l
on
:
16.57564
;
lat
:
49.22462
}
ListElement
{
name
:
"
Copenhagen Central
"
;
l
on
:
12.56489
;
lat
:
55.67238
;
}
ListElement
{
name
:
"
Frankfurt (Main) Hauptbahnhof
"
;
l
on
:
8.6625
;
lat
:
50.106944
;
}
}
Component
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment