After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 755808 - Implement support for public transportation routing
Implement support for public transportation routing
Status: RESOLVED OBSOLETE
Product: gnome-maps
Classification: Applications
Component: general
git master
Other Linux
: Normal enhancement
: ---
Assigned To: gnome-maps-maint
gnome-maps-maint
Depends on: 764107 764748
Blocks:
 
 
Reported: 2015-09-29 20:00 UTC by Marcus Lundblad
Modified: 2018-03-26 12:56 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
routeQuery: Add support for setting time and arrival/departure (1.86 KB, patch)
2016-10-31 21:28 UTC, Marcus Lundblad
committed Details | Review
transitOptions: Add class holding options for transit routing (2.88 KB, patch)
2016-10-31 21:29 UTC, Marcus Lundblad
none Details | Review
routeQuery: Add ability to set options for transit routing (1.40 KB, patch)
2016-10-31 21:29 UTC, Marcus Lundblad
committed Details | Review
routeQuery: Move routequery to the Application module (9.66 KB, patch)
2016-10-31 21:33 UTC, Marcus Lundblad
none Details | Review
routeService: Enable querying GraphHopper externally (3.55 KB, patch)
2016-10-31 21:34 UTC, Marcus Lundblad
committed Details | Review
Add module to handle HVT codes (hierachical vehicle types) (11.09 KB, patch)
2016-10-31 21:35 UTC, Marcus Lundblad
none Details | Review
Break out reading of the service file (3.54 KB, patch)
2016-11-01 21:33 UTC, Marcus Lundblad
committed Details | Review
mapSource: Use general service handler (3.20 KB, patch)
2016-11-01 21:34 UTC, Marcus Lundblad
committed Details | Review
Add module to query an OpenTripPlanner instance (69.98 KB, patch)
2016-11-16 21:04 UTC, Marcus Lundblad
none Details | Review
routeQuery: Add support for transit mode (1.46 KB, patch)
2016-11-16 21:04 UTC, Marcus Lundblad
committed Details | Review
application: Add initialization of the OpenTripPlanner instance (1.35 KB, patch)
2016-11-16 21:05 UTC, Marcus Lundblad
none Details | Review
Add transit mode icons (30.03 KB, patch)
2016-11-16 21:06 UTC, Marcus Lundblad
committed Details | Review
utils: Add color luminance and contrast functions (3.31 KB, patch)
2016-11-16 21:06 UTC, Marcus Lundblad
none Details | Review
Add label widget for route labels (8.38 KB, patch)
2016-11-16 21:10 UTC, Marcus Lundblad
none Details | Review
Add list box row class for representing transit itineraries (7.66 KB, patch)
2016-11-16 21:11 UTC, Marcus Lundblad
none Details | Review
Add list box row to display a leg of a transit itinerary (22.86 KB, patch)
2016-11-16 21:15 UTC, Marcus Lundblad
none Details | Review
Add a list box row to show the arrival of a transit itinerary (8.28 KB, patch)
2016-11-16 21:15 UTC, Marcus Lundblad
none Details | Review
Add list box row for loading more transit results (5.61 KB, patch)
2016-11-16 21:16 UTC, Marcus Lundblad
none Details | Review
application: Add initialization of the OpenTripPlanner instance (1.45 KB, patch)
2016-11-17 22:47 UTC, Marcus Lundblad
none Details | Review
application: Add a function to switch to/from transit route mode (1.34 KB, patch)
2016-11-21 21:29 UTC, Marcus Lundblad
none Details | Review
mapBubble: Ensure non-transit when routing (870 bytes, patch)
2016-11-21 21:30 UTC, Marcus Lundblad
none Details | Review
Add label widget for route labels (8.49 KB, patch)
2016-11-24 21:14 UTC, Marcus Lundblad
none Details | Review
sidebar: Add functionallity for transit routing (49.21 KB, patch)
2016-11-27 21:03 UTC, Marcus Lundblad
none Details | Review
Add map marker to mark start of walking transit legs (3.25 KB, patch)
2016-11-27 21:03 UTC, Marcus Lundblad
none Details | Review
Add map marker to mark end of transit itineraries (3.77 KB, patch)
2016-11-27 21:04 UTC, Marcus Lundblad
none Details | Review
Add map marker for marking boarding points in transit itineraries (6.10 KB, patch)
2016-11-27 21:04 UTC, Marcus Lundblad
none Details | Review
Add list box row class for transit stops (6.87 KB, patch)
2016-11-27 21:05 UTC, Marcus Lundblad
none Details | Review
turnPointMarker: Add support for showing markers for transit stops (3.64 KB, patch)
2016-11-27 21:05 UTC, Marcus Lundblad
none Details | Review
Add list box row to display a leg of a transit itinerary (22.85 KB, patch)
2016-11-28 20:19 UTC, Marcus Lundblad
none Details | Review
turnPointMarker: Add support for showing markers for transit stops (3.32 KB, patch)
2016-11-28 20:20 UTC, Marcus Lundblad
none Details | Review
turnPointMarker: Add support for showing markers for transit stops (3.06 KB, patch)
2016-11-28 21:07 UTC, Marcus Lundblad
none Details | Review
mapView: Implement showing transit routes (11.05 KB, patch)
2016-11-28 22:09 UTC, Marcus Lundblad
none Details | Review
mapView: Add a view property to indicate showing a route (3.75 KB, patch)
2016-11-28 22:10 UTC, Marcus Lundblad
none Details | Review
mainWindow: Show the print button when a route is rendered (1.44 KB, patch)
2016-11-28 22:11 UTC, Marcus Lundblad
none Details | Review
Add list box row to display a leg of a transit itinerary (23.15 KB, patch)
2016-11-29 21:22 UTC, Marcus Lundblad
none Details | Review
Add a list box row to show the arrival of a transit itinerary (8.42 KB, patch)
2016-11-29 21:23 UTC, Marcus Lundblad
none Details | Review
Add print layout for transit (11.34 KB, patch)
2016-11-29 22:02 UTC, Marcus Lundblad
none Details | Review
printOperation: Use transit print layout when requested (1.84 KB, patch)
2016-11-29 22:02 UTC, Marcus Lundblad
none Details | Review
Add module to query an OpenTripPlanner instance (69.98 KB, patch)
2016-11-29 22:23 UTC, Marcus Lundblad
none Details | Review
Add module to query an OpenTripPlanner instance (70.34 KB, patch)
2016-11-30 20:41 UTC, Marcus Lundblad
none Details | Review
sidebar: Add functionallity for transit routing (49.22 KB, patch)
2016-12-01 20:47 UTC, Marcus Lundblad
none Details | Review
Add module to query an OpenTripPlanner instance (70.30 KB, patch)
2016-12-01 20:52 UTC, Marcus Lundblad
none Details | Review
Add label widget for route labels (8.51 KB, patch)
2016-12-06 21:37 UTC, Marcus Lundblad
none Details | Review
Add list box row class for representing transit itineraries (7.67 KB, patch)
2016-12-09 21:53 UTC, Marcus Lundblad
none Details | Review
Add list box row to display a leg of a transit itinerary (23.55 KB, patch)
2016-12-11 21:17 UTC, Marcus Lundblad
none Details | Review
Add label widget for route labels (8.59 KB, patch)
2016-12-11 21:18 UTC, Marcus Lundblad
none Details | Review
Add module to query an OpenTripPlanner instance (70.30 KB, patch)
2016-12-15 21:33 UTC, Marcus Lundblad
none Details | Review
Add module to query an OpenTripPlanner instance (70.26 KB, patch)
2016-12-15 21:54 UTC, Marcus Lundblad
none Details | Review
Add module to query an OpenTripPlanner instance (70.26 KB, patch)
2016-12-19 22:49 UTC, Marcus Lundblad
none Details | Review
utils: Add color luminance and contrast functions (3.31 KB, patch)
2016-12-21 21:01 UTC, Marcus Lundblad
needs-work Details | Review
Add list box row to display a leg of a transit itinerary (23.70 KB, patch)
2016-12-31 12:09 UTC, Marcus Lundblad
none Details | Review
Add list box row to display a leg of a transit itinerary (23.83 KB, patch)
2017-01-05 22:06 UTC, Marcus Lundblad
none Details | Review
Add label widget for route labels (8.70 KB, patch)
2017-01-12 22:52 UTC, Marcus Lundblad
none Details | Review
Add module to handle HVT codes (hierachical vehicle types) (9.74 KB, patch)
2017-02-06 07:19 UTC, Marcus Lundblad
committed Details | Review
transitOptions: Add class holding options for transit routing (2.90 KB, patch)
2017-02-06 07:56 UTC, Marcus Lundblad
committed Details | Review
Add module to query an OpenTripPlanner instance (70.27 KB, patch)
2017-02-06 07:58 UTC, Marcus Lundblad
none Details | Review
sidebar: Add functionallity for transit routing (49.20 KB, patch)
2017-02-06 07:58 UTC, Marcus Lundblad
none Details | Review
Add list box row for loading more transit results (5.54 KB, patch)
2017-02-06 08:07 UTC, Marcus Lundblad
committed Details | Review
Add list box row to display a leg of a transit itinerary (23.99 KB, patch)
2017-02-06 20:52 UTC, Marcus Lundblad
none Details | Review
Add label widget for route labels (9.06 KB, patch)
2017-02-06 20:53 UTC, Marcus Lundblad
none Details | Review
Add module to query an OpenTripPlanner instance (70.81 KB, patch)
2017-02-06 20:54 UTC, Marcus Lundblad
none Details | Review
Add list box row class for transit stops (6.18 KB, patch)
2017-02-06 21:41 UTC, Marcus Lundblad
none Details | Review
Add module to query an OpenTripPlanner instance (70.93 KB, patch)
2017-02-06 21:42 UTC, Marcus Lundblad
none Details | Review
Add module to query an OpenTripPlanner instance (70.93 KB, patch)
2017-02-06 21:44 UTC, Marcus Lundblad
none Details | Review
Add map marker to mark start of walking transit legs (3.57 KB, patch)
2017-02-06 22:04 UTC, Marcus Lundblad
none Details | Review
Add map marker to mark start of walking transit legs (3.57 KB, patch)
2017-02-07 21:11 UTC, Marcus Lundblad
committed Details | Review
Add color luminance and contrast functions (4.36 KB, patch)
2017-02-07 21:29 UTC, Marcus Lundblad
accepted-commit_now Details | Review
Add map marker for marking boarding points in transit itineraries (6.07 KB, patch)
2017-02-07 21:43 UTC, Marcus Lundblad
none Details | Review
Add label widget for route labels (9.01 KB, patch)
2017-02-07 21:57 UTC, Marcus Lundblad
none Details | Review
mapView: Implement showing transit routes (11.37 KB, patch)
2017-02-07 22:01 UTC, Marcus Lundblad
none Details | Review
Add map marker for marking boarding points in transit itineraries (6.12 KB, patch)
2017-02-07 22:10 UTC, Marcus Lundblad
none Details | Review
Add map marker to mark end of transit itineraries (5.90 KB, patch)
2017-02-07 22:16 UTC, Marcus Lundblad
none Details | Review
Add map marker to mark end of transit itineraries (5.89 KB, patch)
2017-02-07 22:19 UTC, Marcus Lundblad
committed Details | Review
Add map marker for marking boarding points in transit itineraries (6.47 KB, patch)
2017-02-07 22:28 UTC, Marcus Lundblad
none Details | Review
Add map marker for marking boarding points in transit itineraries (6.58 KB, patch)
2017-02-07 22:35 UTC, Marcus Lundblad
committed Details | Review
Add a list box row to show the arrival of a transit itinerary (8.35 KB, patch)
2017-02-07 22:38 UTC, Marcus Lundblad
committed Details | Review
Add list box row class for transit stops (5.72 KB, patch)
2017-02-07 22:44 UTC, Marcus Lundblad
committed Details | Review
Add list box row to display a leg of a transit itinerary (24.03 KB, patch)
2017-02-07 22:44 UTC, Marcus Lundblad
committed Details | Review
routeQuery: Move routequery to the Application module (9.55 KB, patch)
2017-02-09 20:35 UTC, Marcus Lundblad
none Details | Review
Add module to query an OpenTripPlanner instance (71.05 KB, patch)
2017-02-09 20:36 UTC, Marcus Lundblad
none Details | Review
Rename the RouteService module to GraphHopper (1.94 KB, patch)
2017-02-09 20:37 UTC, Marcus Lundblad
needs-work Details | Review
Add module to delegate routing requests. (6.78 KB, patch)
2017-02-09 20:38 UTC, Marcus Lundblad
none Details | Review
mapBubble: Ensure non-transit when routing (881 bytes, patch)
2017-02-09 20:40 UTC, Marcus Lundblad
committed Details | Review
sidebar: Add functionallity for transit routing (49.38 KB, patch)
2017-02-09 20:41 UTC, Marcus Lundblad
none Details | Review
mapView: Add a view property to indicate showing a route (3.77 KB, patch)
2017-02-09 20:45 UTC, Marcus Lundblad
none Details | Review
mapView: Implement showing transit routes (11.45 KB, patch)
2017-02-09 20:46 UTC, Marcus Lundblad
none Details | Review
Add print layout for transit (11.36 KB, patch)
2017-02-09 20:50 UTC, Marcus Lundblad
committed Details | Review
routeQuery: Move routequery to the Application module (9.56 KB, patch)
2017-02-09 21:01 UTC, Marcus Lundblad
committed Details | Review
Add module to delegate routing requests. (7.28 KB, patch)
2017-02-09 22:17 UTC, Marcus Lundblad
none Details | Review
printOperation: Use transit print layout when requested (1.87 KB, patch)
2017-02-09 22:35 UTC, Marcus Lundblad
committed Details | Review
Add module to delegate routing requests. (7.79 KB, patch)
2017-02-09 22:36 UTC, Marcus Lundblad
none Details | Review
Add list box row class for representing transit itineraries (7.49 KB, patch)
2017-02-10 06:54 UTC, Marcus Lundblad
committed Details | Review
Add module to delegate routing requests. (8.88 KB, patch)
2017-02-10 07:31 UTC, Marcus Lundblad
committed Details | Review
main: Add array prototype to get last element (1.16 KB, patch)
2017-02-10 08:48 UTC, Marcus Lundblad
committed Details | Review
mapView: Implement showing transit routes (11.12 KB, patch)
2017-02-10 12:38 UTC, Marcus Lundblad
none Details | Review
mapView: Implement showing transit routes (11.12 KB, patch)
2017-02-10 12:39 UTC, Marcus Lundblad
none Details | Review
turnPointMarker: Add support for showing markers for transit stops (3.28 KB, patch)
2017-02-10 12:39 UTC, Marcus Lundblad
none Details | Review
Add label widget for route labels (8.91 KB, patch)
2017-02-10 12:41 UTC, Marcus Lundblad
committed Details | Review
Add color utils (4.73 KB, patch)
2017-02-10 12:42 UTC, Marcus Lundblad
committed Details | Review
turnPointMarker: Add support for showing markers for transit stops (3.39 KB, patch)
2017-02-10 21:18 UTC, Marcus Lundblad
none Details | Review
mapView: Implement showing transit routes (11.82 KB, patch)
2017-02-10 21:18 UTC, Marcus Lundblad
none Details | Review
mapView: Implement showing transit routes (11.82 KB, patch)
2017-02-10 21:22 UTC, Marcus Lundblad
committed Details | Review
turnPointMarker: Add support for showing markers for transit stops (3.41 KB, patch)
2017-02-10 21:35 UTC, Marcus Lundblad
committed Details | Review
mapView: Add a view property to indicate showing a route (6.71 KB, patch)
2017-02-11 21:33 UTC, Marcus Lundblad
committed Details | Review
mainWindow: Show the print button when a route is rendered (1.44 KB, patch)
2017-02-11 21:34 UTC, Marcus Lundblad
committed Details | Review
Add module to query an OpenTripPlanner instance (73.52 KB, patch)
2017-02-11 22:24 UTC, Marcus Lundblad
committed Details | Review
Add module with time utility functions (4.25 KB, patch)
2017-02-12 22:04 UTC, Marcus Lundblad
none Details | Review
Add widget to select transit options (15.91 KB, patch)
2017-02-12 22:05 UTC, Marcus Lundblad
committed Details | Review
sidebar: Add functionallity for transit routing (31.79 KB, patch)
2017-02-12 22:06 UTC, Marcus Lundblad
none Details | Review
sidebar: Add functionallity for transit routing (31.80 KB, patch)
2017-02-12 22:41 UTC, Marcus Lundblad
none Details | Review
Add module with time utility functions (4.37 KB, patch)
2017-02-13 20:55 UTC, Marcus Lundblad
committed Details | Review
sidebar: Add functionallity for transit routing (31.83 KB, patch)
2017-02-13 20:55 UTC, Marcus Lundblad
none Details | Review
sidebar: Add functionallity for transit routing (32.02 KB, patch)
2017-02-14 21:11 UTC, Marcus Lundblad
committed Details | Review

Description Marcus Lundblad 2015-09-29 20:00:47 UTC
This one issue that has been itching me for a while.
So, I have started looking at alternatives for providing support for this.
I think OpenTripPlanner looks promising for providing this support.
I have even started a little side-project for downloading GTFS feeds and updating a local OpenTripPlanner instance: https://github.com/mlundblad/otp-updater

Currently I'm running an instance with around 30 feeds (some large ones like the national Swedish and Dutch ones, Berlin, and some smaller ones).
The OTP process is consuming around 6.3 GB RAM (this is idling, so I'm not sure how it performes under real load).
Looking a bit at the REST API and playing with queries in the browser seems to indicate it would be feasable to implement routing support based on this.
Comment 1 Alaf 2015-12-01 08:15:54 UTC
Hello Marcus, I am interested in Doing this. Where should I start?
Comment 2 Marcus Lundblad 2016-10-31 21:28:17 UTC
Created attachment 338855 [details] [review]
routeQuery: Add support for setting time and arrival/departure

Adds a trip time and arrival/departure parameter, indicating if the
time means "arrive no later than the time specified" or "depart not
before the time specified".
This would be used for transit routing.
Comment 3 Marcus Lundblad 2016-10-31 21:29:03 UTC
Created attachment 338856 [details] [review]
transitOptions: Add class holding options for transit routing

Currently has options to show all route types (modes of transportation) or
restrict to a selected set of modes.
Comment 4 Marcus Lundblad 2016-10-31 21:29:42 UTC
Created attachment 338857 [details] [review]
routeQuery: Add ability to set options for transit routing

Adds the ability to set an options object specifying options when
performing a public transit route search. Currently contains options
for setting desired transportation modes.
Comment 5 Marcus Lundblad 2016-10-31 21:33:47 UTC
Created attachment 338858 [details] [review]
routeQuery: Move routequery to the Application module

Let the Application module handle the route query singleton instance.
This is needed so that the OpenTripPlanner module can access the
query.
Comment 6 Marcus Lundblad 2016-10-31 21:34:34 UTC
Created attachment 338859 [details] [review]
routeService: Enable querying GraphHopper externally

Add a way to do a route query without triggering route signals.
This will be used by the OpenTripPlanner module to use the existing
GraphHopper services to calculate walking (and maybe
pontentially in the future car and bike park-and-ride) segments
in an intinerary.
Comment 7 Marcus Lundblad 2016-10-31 21:35:04 UTC
Created attachment 338860 [details] [review]
Add module to handle HVT codes (hierachical vehicle types)

This modules contains defintions for the HVT TPEG-derived vehicle codes:
See: https://support.google.com/transitpartners/answer/3520902
Comment 8 Marcus Lundblad 2016-11-01 21:33:30 UTC
Created attachment 338907 [details] [review]
Break out reading of the service file

This will be needed to use the service definition
file to read service URL for OpenTripPlanner.
Comment 9 Marcus Lundblad 2016-11-01 21:34:36 UTC
Created attachment 338908 [details] [review]
mapSource: Use general service handler
Comment 10 Marcus Lundblad 2016-11-16 21:04:04 UTC
Created attachment 340075 [details] [review]
Add module to query an OpenTripPlanner instance

Adds an openTripPlanner module, containing functionallity for interfacing against
an OpenTripPlanner service. Also has functionallity to augment itineraries obtained
with walk routing from GraphHopper (as used by the other routing modes).

Furthermore, the transitPlan module contains interfacing classes modelling transit data

Plan:
Populated by a list of itineraries when performing a transit query.

Itinerary:
Represents one particular trip option in a search result. Contains one or more transit legs.

Leg:
Represents one distinct part of a trip, such as
"take tram #5 departuring at 10:00 from Foo Street, get off at Bar Street, arrival at 10:12".

Stop:
Represents an intermediate stop along a transit leg (a place where the vehicle stops, but
the itinerary doesn't board or alight the vehicle.
Comment 11 Marcus Lundblad 2016-11-16 21:04:49 UTC
Created attachment 340076 [details] [review]
routeQuery: Add support for transit mode
Comment 12 Marcus Lundblad 2016-11-16 21:05:32 UTC
Created attachment 340077 [details] [review]
application: Add initialization of the OpenTripPlanner instance
Comment 13 Marcus Lundblad 2016-11-16 21:06:06 UTC
Created attachment 340078 [details] [review]
Add transit mode icons
Comment 14 Marcus Lundblad 2016-11-16 21:06:39 UTC
Created attachment 340079 [details] [review]
utils: Add color luminance and contrast functions

This is needed to compute good contrasting colors for transit route
labels.
Comment 15 Marcus Lundblad 2016-11-16 21:10:43 UTC
Created attachment 340080 [details] [review]
Add label widget for route labels

This adds a label widget for representing parts of transit
journeys.
The label can use "long" or "compact" mode, where the latter
is suited for presenting in an overview and the former
for a detailed view of an itinerary.
Comment 16 Marcus Lundblad 2016-11-16 21:11:22 UTC
Created attachment 340081 [details] [review]
Add list box row class for representing transit itineraries

This list box class is used to render the overview items showing the list of
found itineraries when performing a transit route search.
Comment 17 Marcus Lundblad 2016-11-16 21:15:05 UTC
Created attachment 340082 [details] [review]
Add list box row to display a leg of a transit itinerary

This list box class is used to render a "leg" of an itinerary
when "diving in" to a particular itinerary.
I.e. part of a journey such as "Walk 500 m" or "Bus 42 leaving at 12:00".
Comment 18 Marcus Lundblad 2016-11-16 21:15:46 UTC
Created attachment 340083 [details] [review]
Add a list box row to show the arrival of a transit itinerary
Comment 19 Marcus Lundblad 2016-11-16 21:16:22 UTC
Created attachment 340084 [details] [review]
Add list box row for loading more transit results

This adds a GtkListBoxRow implementation used as clickable placeholder
for loading later/earlier transit alternatives.
Comment 20 Marcus Lundblad 2016-11-17 22:47:15 UTC
Created attachment 340198 [details] [review]
application: Add initialization of the OpenTripPlanner instance
Comment 21 Marcus Lundblad 2016-11-21 21:29:59 UTC
Created attachment 340474 [details] [review]
application: Add a function to switch to/from transit route mode

Add a utility function in the Application module to switch routing
"engine", so that modules such as the sidebar won't have to handle
it themselves.
Comment 22 Marcus Lundblad 2016-11-21 21:30:42 UTC
Created attachment 340475 [details] [review]
mapBubble: Ensure non-transit when routing

When using the route button, the mode will default to car,
so make sure the GraphHopper service is listening to route
query events.
Comment 23 Marcus Lundblad 2016-11-24 21:14:21 UTC
Created attachment 340718 [details] [review]
Add label widget for route labels

This adds a label widget for representing parts of transit
journeys.
The label can use "long" or "compact" mode, where the latter
is suited for presenting in an overview and the former
for a detailed view of an itinerary.
Comment 24 Marcus Lundblad 2016-11-27 21:03:03 UTC
Created attachment 340860 [details] [review]
sidebar: Add functionallity for transit routing

Adds a new mode button (enabled when the service file
indicates an OpenTripPlanner instance, or if explicitly
pointed out via an env variable).
Adds showing transit itineraries in addition to regular
turn-by-turn-based routes, and options for transit route
search.
Comment 25 Marcus Lundblad 2016-11-27 21:03:39 UTC
Created attachment 340861 [details] [review]
Add map marker to mark start of walking transit legs
Comment 26 Marcus Lundblad 2016-11-27 21:04:09 UTC
Created attachment 340862 [details] [review]
Add map marker to mark end of transit itineraries
Comment 27 Marcus Lundblad 2016-11-27 21:04:49 UTC
Created attachment 340863 [details] [review]
Add map marker for marking boarding points in transit itineraries
Comment 28 Marcus Lundblad 2016-11-27 21:05:21 UTC
Created attachment 340864 [details] [review]
Add list box row class for transit stops

List box row showing intermediate stops.
Comment 29 Marcus Lundblad 2016-11-27 21:05:46 UTC
Created attachment 340865 [details] [review]
turnPointMarker: Add support for showing markers for transit stops
Comment 30 Marcus Lundblad 2016-11-28 20:19:47 UTC
Created attachment 340937 [details] [review]
Add list box row to display a leg of a transit itinerary

This list box class is used to render a "leg" of an itinerary
when "diving in" to a particular itinerary.
I.e. part of a journey such as "Walk 500 m" or "Bus 42 leaving at 12:00".
Comment 31 Marcus Lundblad 2016-11-28 20:20:57 UTC
Created attachment 340938 [details] [review]
turnPointMarker: Add support for showing markers for transit stops
Comment 32 Marcus Lundblad 2016-11-28 21:07:07 UTC
Created attachment 340944 [details] [review]
turnPointMarker: Add support for showing markers for transit stops
Comment 33 Marcus Lundblad 2016-11-28 22:09:30 UTC
Created attachment 340949 [details] [review]
mapView: Implement showing transit routes

Also added functionallity to allow showing dynamically created
route layer segments, optionally using a dashed style.
This is used by transit routes to show walking and transit legs
of journeys.
Comment 34 Marcus Lundblad 2016-11-28 22:10:19 UTC
Created attachment 340950 [details] [review]
mapView: Add a view property to indicate showing a route

Adds a new boolean property that is set to true when an actual route
is rendered on the map.
This will allow only showing the print button when a transit itinerary
is "dived into".
Comment 35 Marcus Lundblad 2016-11-28 22:11:01 UTC
Created attachment 340951 [details] [review]
mainWindow: Show the print button when a route is rendered

Only show the print button when a route is rendered on the map.
This way, the print button is hidden until an itinerary is selected
when in transit mode.
Also, only activate printing with the accelerator when actually showing
a route.
Comment 36 Marcus Lundblad 2016-11-29 21:22:55 UTC
Created attachment 340998 [details] [review]
Add list box row to display a leg of a transit itinerary

This list box class is used to render a "leg" of an itinerary
when "diving in" to a particular itinerary.
I.e. part of a journey such as "Walk 500 m" or "Bus 42 leaving at 12:00".
Comment 37 Marcus Lundblad 2016-11-29 21:23:47 UTC
Created attachment 340999 [details] [review]
Add a list box row to show the arrival of a transit itinerary
Comment 38 Marcus Lundblad 2016-11-29 22:02:16 UTC
Created attachment 341000 [details] [review]
Add print layout for transit

Adds a printing layout implementation for transit itineraries.
It will print the instructions for transit switches during a
trip. Also includes minimaps for walking sections.
Comment 39 Marcus Lundblad 2016-11-29 22:02:57 UTC
Created attachment 341001 [details] [review]
printOperation: Use transit print layout when requested

Use the transit print layout when a transit itinerary was selected.
Comment 40 Marcus Lundblad 2016-11-29 22:23:15 UTC
Created attachment 341002 [details] [review]
Add module to query an OpenTripPlanner instance

Adds an openTripPlanner module, containing functionallity for interfacing against
an OpenTripPlanner service. Also has functionallity to augment itineraries obtained
with walk routing from GraphHopper (as used by the other routing modes).

Furthermore, the transitPlan module contains interfacing classes modelling transit data

Plan:
Populated by a list of itineraries when performing a transit query.

Itinerary:
Represents one particular trip option in a search result. Contains one or more transit legs.

Leg:
Represents one distinct part of a trip, such as
"take tram #5 departuring at 10:00 from Foo Street, get off at Bar Street, arrival at 10:12".

Stop:
Represents an intermediate stop along a transit leg (a place where the vehicle stops, but
the itinerary doesn't board or alight the vehicle.
Comment 41 Marcus Lundblad 2016-11-30 20:41:50 UTC
Created attachment 341088 [details] [review]
Add module to query an OpenTripPlanner instance

Adds an openTripPlanner module, containing functionallity for interfacing against
an OpenTripPlanner service. Also has functionallity to augment itineraries obtained
with walk routing from GraphHopper (as used by the other routing modes).

Furthermore, the transitPlan module contains interfacing classes modelling transit data

Plan:
Populated by a list of itineraries when performing a transit query.

Itinerary:
Represents one particular trip option in a search result. Contains one or more transit legs.

Leg:
Represents one distinct part of a trip, such as
"take tram #5 departuring at 10:00 from Foo Street, get off at Bar Street, arrival at 10:12".

Stop:
Represents an intermediate stop along a transit leg (a place where the vehicle stops, but
the itinerary doesn't board or alight the vehicle.
Comment 42 Marcus Lundblad 2016-12-01 20:47:34 UTC
Created attachment 341177 [details] [review]
sidebar: Add functionallity for transit routing

Adds a new mode button (enabled when the service file
indicates an OpenTripPlanner instance, or if explicitly
pointed out via an env variable).
Adds showing transit itineraries in addition to regular
turn-by-turn-based routes, and options for transit route
search.
Comment 43 Marcus Lundblad 2016-12-01 20:52:27 UTC
Created attachment 341178 [details] [review]
Add module to query an OpenTripPlanner instance

Adds an openTripPlanner module, containing functionallity for interfacing against
an OpenTripPlanner service. Also has functionallity to augment itineraries obtained
with walk routing from GraphHopper (as used by the other routing modes).

Furthermore, the transitPlan module contains interfacing classes modelling transit data

Plan:
Populated by a list of itineraries when performing a transit query.

Itinerary:
Represents one particular trip option in a search result. Contains one or more transit legs.

Leg:
Represents one distinct part of a trip, such as
"take tram #5 departuring at 10:00 from Foo Street, get off at Bar Street, arrival at 10:12".

Stop:
Represents an intermediate stop along a transit leg (a place where the vehicle stops, but
the itinerary doesn't board or alight the vehicle.
Comment 44 Marcus Lundblad 2016-12-06 21:37:50 UTC
Created attachment 341511 [details] [review]
Add label widget for route labels

This adds a label widget for representing parts of transit
journeys.
The label can use "long" or "compact" mode, where the latter
is suited for presenting in an overview and the former
for a detailed view of an itinerary.
Comment 45 Marcus Lundblad 2016-12-09 21:53:01 UTC
Created attachment 341695 [details] [review]
Add list box row class for representing transit itineraries

This list box class is used to render the overview items showing the list of
found itineraries when performing a transit route search.
Comment 46 Marcus Lundblad 2016-12-11 21:17:32 UTC
Created attachment 341780 [details] [review]
Add list box row to display a leg of a transit itinerary

This list box class is used to render a "leg" of an itinerary
when "diving in" to a particular itinerary.
I.e. part of a journey such as "Walk 500 m" or "Bus 42 leaving at 12:00".
Comment 47 Marcus Lundblad 2016-12-11 21:18:12 UTC
Created attachment 341781 [details] [review]
Add label widget for route labels

This adds a label widget for representing parts of transit
journeys.
The label can use "long" or "compact" mode, where the latter
is suited for presenting in an overview and the former
for a detailed view of an itinerary.
Comment 48 Marcus Lundblad 2016-12-15 21:33:49 UTC
Created attachment 342043 [details] [review]
Add module to query an OpenTripPlanner instance

Adds an openTripPlanner module, containing functionallity for interfacing against
an OpenTripPlanner service. Also has functionallity to augment itineraries obtained
with walk routing from GraphHopper (as used by the other routing modes).

Furthermore, the transitPlan module contains interfacing classes modelling transit data

Plan:
Populated by a list of itineraries when performing a transit query.

Itinerary:
Represents one particular trip option in a search result. Contains one or more transit legs.

Leg:
Represents one distinct part of a trip, such as
"take tram #5 departuring at 10:00 from Foo Street, get off at Bar Street, arrival at 10:12".

Stop:
Represents an intermediate stop along a transit leg (a place where the vehicle stops, but
the itinerary doesn't board or alight the vehicle.
Comment 49 Marcus Lundblad 2016-12-15 21:54:20 UTC
Created attachment 342044 [details] [review]
Add module to query an OpenTripPlanner instance

Adds an openTripPlanner module, containing functionallity for interfacing against
an OpenTripPlanner service. Also has functionallity to augment itineraries obtained
with walk routing from GraphHopper (as used by the other routing modes).

Furthermore, the transitPlan module contains interfacing classes modelling transit data

Plan:
Populated by a list of itineraries when performing a transit query.

Itinerary:
Represents one particular trip option in a search result. Contains one or more transit legs.

Leg:
Represents one distinct part of a trip, such as
"take tram #5 departuring at 10:00 from Foo Street, get off at Bar Street, arrival at 10:12".

Stop:
Represents an intermediate stop along a transit leg (a place where the vehicle stops, but
the itinerary doesn't board or alight the vehicle.
Comment 50 Marcus Lundblad 2016-12-19 22:49:50 UTC
Created attachment 342239 [details] [review]
Add module to query an OpenTripPlanner instance

Adds an openTripPlanner module, containing functionallity for interfacing against
an OpenTripPlanner service. Also has functionallity to augment itineraries obtained
with walk routing from GraphHopper (as used by the other routing modes).

Furthermore, the transitPlan module contains interfacing classes modelling transit data

Plan:
Populated by a list of itineraries when performing a transit query.

Itinerary:
Represents one particular trip option in a search result. Contains one or more transit legs.

Leg:
Represents one distinct part of a trip, such as
"take tram #5 departuring at 10:00 from Foo Street, get off at Bar Street, arrival at 10:12".

Stop:
Represents an intermediate stop along a transit leg (a place where the vehicle stops, but
the itinerary doesn't board or alight the vehicle.
Comment 51 Marcus Lundblad 2016-12-21 21:01:00 UTC
Created attachment 342353 [details] [review]
utils: Add color luminance and contrast functions

This is needed to compute good contrasting colors for transit route
labels.
Comment 52 Marcus Lundblad 2016-12-31 12:09:22 UTC
Created attachment 342665 [details] [review]
Add list box row to display a leg of a transit itinerary

This list box class is used to render a "leg" of an itinerary
when "diving in" to a particular itinerary.
I.e. part of a journey such as "Walk 500 m" or "Bus 42 leaving at 12:00".
Comment 53 Marcus Lundblad 2017-01-05 22:06:10 UTC
Created attachment 342985 [details] [review]
Add list box row to display a leg of a transit itinerary

This list box class is used to render a "leg" of an itinerary
when "diving in" to a particular itinerary.
I.e. part of a journey such as "Walk 500 m" or "Bus 42 leaving at 12:00".
Comment 54 Marcus Lundblad 2017-01-12 22:52:41 UTC
Created attachment 343392 [details] [review]
Add label widget for route labels

This adds a label widget for representing parts of transit
journeys.
The label can use "long" or "compact" mode, where the latter
is suited for presenting in an overview and the former
for a detailed view of an itinerary.
Comment 55 Jonas Danielsson 2017-02-04 16:24:46 UTC
Review of attachment 338855 [details] [review]:

LGTM
Comment 56 Jonas Danielsson 2017-02-04 16:30:38 UTC
Review of attachment 338856 [details] [review]:

routeType => transitType

No need for "show", it gives no extra information => addRouteTypeToShow => addTransitType

::: src/transitOptions.js
@@ +2,3 @@
+/* vim: set et ts=4 sw=4: */
+/*
+ * Copyright (c) 2016 Marcus Lundblad.

2017

@@ +35,3 @@
+
+    /* when set to true, show any mode of transportation, else only show modes
+     * added with addRouteTypeToShow() */

/*
 * This is a comment
 */

@@ +41,3 @@
+    },
+
+    /* add an explicit transport mode to show */

/* Add
Comment 57 Jonas Danielsson 2017-02-04 16:30:57 UTC
Review of attachment 338856 [details] [review]:

routeType => transitType

No need for "show", it gives no extra information => addRouteTypeToShow => addTransitType

::: src/transitOptions.js
@@ +2,3 @@
+/* vim: set et ts=4 sw=4: */
+/*
+ * Copyright (c) 2016 Marcus Lundblad.

2017

@@ +35,3 @@
+
+    /* when set to true, show any mode of transportation, else only show modes
+     * added with addRouteTypeToShow() */

/*
 * This is a comment
 */

@@ +41,3 @@
+    },
+
+    /* add an explicit transport mode to show */

/* Add
Comment 58 Jonas Danielsson 2017-02-04 16:32:15 UTC
Review of attachment 338857 [details] [review]:

LGTM
Comment 59 Jonas Danielsson 2017-02-04 16:50:40 UTC
Review of attachment 338858 [details] [review]:

Switch to using a delegator pattern for routeService to be able to better handle otp and graphhopper seemlessly

::: src/mainWindow.js
@@ -140,0 +138,2 @@
+        Application.routeQuery.connect('notify',
+                                               this._setRevealSidebar.bind(this, true));

Indentations issues, also: check if break is still needed

::: src/routeService.js
@@ +48,3 @@
         this.storedRoute = null;
+        this._query = Application.routeQuery;
+        this.parent();

Switch to taking the query as a construct time parameter
Comment 60 Jonas Danielsson 2017-02-04 16:54:11 UTC
Review of attachment 338859 [details] [review]:

LGTM but might change  a bit if we change the pattern of routeService
Comment 61 Jonas Danielsson 2017-02-04 16:57:35 UTC
Review of attachment 338860 [details] [review]:

Other than nits LGTM

::: src/hvt.js
@@ +2,3 @@
+/* vim: set et ts=4 sw=4: */
+/*
+ * Copyright (c) 2016 Marcus Lundblad

2017

@@ +16,3 @@
+ * You should have received a copy of the GNU General Public License along
+ * with GNOME Maps; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

We do not want to track the address of the FSF, look at other modules for better formulation.

@@ +150,3 @@
+const SHUTTLE_AIR_SERVICE =             1105;
+const INTERCONTINENTAL_CHARTER_AIR_SERVICE =    1106;
+const INTERNATIONAL_CHARTER_AIR_SERVICE =   1107;

Align or not align, pick one
Comment 62 Jonas Danielsson 2017-02-04 16:59:02 UTC
Review of attachment 338907 [details] [review]:

LGTM

::: src/service.js
@@ +2,3 @@
+/* vim: set et ts=4 sw=4: */
+/*
+ * Copyright (c) 2016 Marcus Lundblad.

2017
Comment 63 Jonas Danielsson 2017-02-04 16:59:41 UTC
Review of attachment 338908 [details] [review]:

LGTM
Comment 64 Jonas Danielsson 2017-02-04 17:00:01 UTC
Review of attachment 338907 [details] [review]:

LGTM

::: src/service.js
@@ +2,3 @@
+/* vim: set et ts=4 sw=4: */
+/*
+ * Copyright (c) 2016 Marcus Lundblad.

2017
Comment 65 Jonas Danielsson 2017-02-04 17:00:48 UTC
Review of attachment 340076 [details] [review]:

LGTM
Comment 66 Jonas Danielsson 2017-02-04 17:01:40 UTC
Review of attachment 340078 [details] [review]:

LGTM
Comment 67 Jonas Danielsson 2017-02-04 22:36:23 UTC
Review of attachment 342985 [details] [review]:

neat

::: data/gnome-maps.css
@@ +104,3 @@
+  background-color: transparent;
+  -gtk-outline-radius: 14px;
+}

Investigate if this can be done with standard GTK circlular-button class

::: src/transitLegRow.js
@@ +2,3 @@
+/* vim: set et ts=4 sw=4: */
+/*
+ * Copyright (c) 2016 Marcus Lundblad

2017

@@ +16,3 @@
+ * You should have received a copy of the GNU General Public License along
+ * with GNOME Maps; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

Remove address, look at other modules

@@ +64,3 @@
+        delete params.print;
+
+        this.parent();

this.parent(params);

@@ +70,3 @@
+            if (this._leg.from) {
+                /* Translators: this is a format string indicating instructions
+                 * starting a journey at the address given as the parameter */

nit: 

/*
 * This is a comment
 */

@@ +84,3 @@
+        if (this._leg.transit) {
+            let routeLabel =
+                new TransitRouteLabel.TransitRouteLabel({ leg: this._leg });

... TransitRouteLabel({
        leg: this._leg
    });


might be a prettier break

@@ +86,3 @@
+                new TransitRouteLabel.TransitRouteLabel({ leg: this._leg });
+
+            routeLabel.margin_end = 3;

Does this number have a deeper significane? Can we add a comment or in another way shed light on this number 3?

@@ +87,3 @@
+
+            routeLabel.margin_end = 3;
+            routeLabel.hexpand = false;

Add these routeLabel properties to constructor construct. Or if thety really are constant, add them to transitroutelabel ui file

@@ +91,3 @@
+            this._routeGrid.add(routeLabel);
+
+            this._agencyLabel.visible = true;

always visible? add to ui file

@@ +110,3 @@
+
+        if (!this._leg.transit || this._leg.headsign) {
+            let maxWidthChars = this._print ? -1 : 20;

a bit terse, untersify or add a comment

@@ +116,3 @@
+                                                max_width_chars: maxWidthChars,
+                                                ellipsize: Pango.EllipsizeMode.END,
+                                                halign: Gtk.Align.START });

one prop per row

@@ +122,3 @@
+            } else if (!this._leg.transit) {
+                /* Translators: this is a format string indicating walking a certain
+                 * distance, with the distance expression being the %s placeholder */

comment format

@@ +129,3 @@
+            }
+
+            headsignLabel.get_style_context().add_class('dim-label');

investigate if a small class exists and if this class handling can be added to ui file

@@ +136,3 @@
+            this._timeLabel.label = this._leg.prettyPrintDepartureTime();
+        else
+            this._timeLabel.label = this._leg.prettyPrintTimeInterval();

Maybe this can be one row if prettyPrint changes a bit

@@ +145,3 @@
+        this._expandButton.connect('clicked', (function() {
+            this._expand();
+        }).bind(this));

this.expandButton.connect('clicked', this._expand.bind(this));

@@ +149,3 @@
+        this._collapsButton.connect('clicked', (function() {
+            this._collaps();
+        }).bind(this));

Same as above.

@@ +163,3 @@
+            this._onEvent(event);
+            return true;
+        }).bind(this));

Either pick more verbose names for the handlers or add a comment

@@ +194,3 @@
+        /* collaps the time label down to just show the start time when
+         * revealing intermediate stop times, as the arrival time is displayed
+         * at the last stop */

comment format

@@ +223,3 @@
+        } else {
+            /* don't output the starting and ending instructions from the walk
+             * route, since these are explicitely added by the itinerary */

comment format
Comment 68 Jonas Danielsson 2017-02-05 11:28:13 UTC
Review of attachment 340084 [details] [review]:

Otherwise lgtm

::: src/transitMoreRow.js
@@ +2,3 @@
+/* vim: set et ts=4 sw=4: */
+/*
+ * Copyright (c) 2016 Marcus Lundblad

2017

@@ +16,3 @@
+ * You should have received a copy of the GNU General Public License along
+ * with GNOME Maps; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

No address
Comment 69 Marcus Lundblad 2017-02-06 07:19:00 UTC
Created attachment 345015 [details] [review]
Add module to handle HVT codes (hierachical vehicle types)

This modules contains defintions for the HVT TPEG-derived vehicle codes:
See: https://support.google.com/transitpartners/answer/3520902
Comment 70 Marcus Lundblad 2017-02-06 07:22:35 UTC
(In reply to Jonas Danielsson from comment #61)
> Review of attachment 338860 [details] [review] [review]:
> 
> Other than nits LGTM
> 
> ::: src/hvt.js
> @@ +2,3 @@
> +/* vim: set et ts=4 sw=4: */
> +/*
> + * Copyright (c) 2016 Marcus Lundblad
> 
> 2017
Fixed
> 
> @@ +16,3 @@
> + * You should have received a copy of the GNU General Public License along
> + * with GNOME Maps; if not, write to the Free Software Foundation,
> + * Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> 
> We do not want to track the address of the FSF, look at other modules for
> better formulation.
Fixed
> 
> @@ +150,3 @@
> +const SHUTTLE_AIR_SERVICE =             1105;
> +const INTERCONTINENTAL_CHARTER_AIR_SERVICE =    1106;
> +const INTERNATIONAL_CHARTER_AIR_SERVICE =   1107;
> 
> Align or not align, pick one
Choose not to align, looks prettier actually, and the numbers aren't the important thing in themselfs anyway.

Also changed some one-line /* */ to use // style comments
Comment 71 Marcus Lundblad 2017-02-06 07:56:24 UTC
Created attachment 345018 [details] [review]
transitOptions: Add class holding options for transit routing

Currently has options to show all route types (modes of transportation) or
restrict to a selected set of modes.
Comment 72 Marcus Lundblad 2017-02-06 07:58:02 UTC
Created attachment 345019 [details] [review]
Add module to query an OpenTripPlanner instance

Adds an openTripPlanner module, containing functionallity for interfacing against
an OpenTripPlanner service. Also has functionallity to augment itineraries obtained
with walk routing from GraphHopper (as used by the other routing modes).

Furthermore, the transitPlan module contains interfacing classes modelling transit data

Plan:
Populated by a list of itineraries when performing a transit query.

Itinerary:
Represents one particular trip option in a search result. Contains one or more transit legs.

Leg:
Represents one distinct part of a trip, such as
"take tram #5 departuring at 10:00 from Foo Street, get off at Bar Street, arrival at 10:12".

Stop:
Represents an intermediate stop along a transit leg (a place where the vehicle stops, but
the itinerary doesn't board or alight the vehicle.
Comment 73 Marcus Lundblad 2017-02-06 07:58:45 UTC
Created attachment 345020 [details] [review]
sidebar: Add functionallity for transit routing

Adds a new mode button (enabled when the service file
indicates an OpenTripPlanner instance, or if explicitly
pointed out via an env variable).
Adds showing transit itineraries in addition to regular
turn-by-turn-based routes, and options for transit route
search.
Comment 74 Marcus Lundblad 2017-02-06 08:07:11 UTC
Created attachment 345021 [details] [review]
Add list box row for loading more transit results

This adds a GtkListBoxRow implementation used as clickable placeholder
for loading later/earlier transit alternatives.
Comment 75 Marcus Lundblad 2017-02-06 08:08:38 UTC
(In reply to Jonas Danielsson from comment #68)
> Review of attachment 340084 [details] [review] [review]:
> 
> Otherwise lgtm
> 
> ::: src/transitMoreRow.js
> @@ +2,3 @@
> +/* vim: set et ts=4 sw=4: */
> +/*
> + * Copyright (c) 2016 Marcus Lundblad
> 
> 2017
> 
> @@ +16,3 @@
> + * You should have received a copy of the GNU General Public License along
> + * with GNOME Maps; if not, write to the Free Software Foundation,
> + * Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> 
> No address

Yep, fixed
Comment 76 Jonas Danielsson 2017-02-06 10:11:25 UTC
Review of attachment 345015 [details] [review]:

LGTM
Comment 77 Jonas Danielsson 2017-02-06 10:12:49 UTC
Review of attachment 345018 [details] [review]:

LGTM
Comment 78 Jonas Danielsson 2017-02-06 10:15:15 UTC
Review of attachment 345021 [details] [review]:

LGTM
Comment 79 Jonas Danielsson 2017-02-06 19:23:22 UTC
Comment on attachment 338907 [details] [review]
Break out reading of the service file

Attachment 338907 [details] pushed as ad4efcc - Break out reading of the service file
Comment 80 Jonas Danielsson 2017-02-06 19:28:03 UTC
Comment on attachment 338908 [details] [review]
mapSource: Use general service handler

Attachment 338908 [details] pushed as f6562ae - mapSource: Use general service handler
Comment 81 Jonas Danielsson 2017-02-06 19:36:15 UTC
Review of attachment 340864 [details] [review]:

some nits

::: src/transitStopRow.js
@@ +2,3 @@
+/* vim: set et ts=4 sw=4: */
+/*
+ * Copyright (c) 2016 Marcus Lundblad

2017

@@ +17,3 @@
+ * with GNOME Maps; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *

adress

@@ +41,3 @@
+        delete params.final;
+
+        this.parent();

should take params

@@ +48,3 @@
+            this._timeLabel.label = this.stop.prettyPrintArrivalTime();
+        else
+            this._timeLabel.label = this.stop.prettyPrintDepartureTime();

this.stop.prettyPrint(!this._final) so prettyPrint would be a function like prettyPrint(iSDepartureTime);
Comment 82 Marcus Lundblad 2017-02-06 20:52:40 UTC
Created attachment 345055 [details] [review]
Add list box row to display a leg of a transit itinerary

This list box class is used to render a "leg" of an itinerary
when "diving in" to a particular itinerary.
I.e. part of a journey such as "Walk 500 m" or "Bus 42 leaving at 12:00".
Comment 83 Marcus Lundblad 2017-02-06 20:53:33 UTC
Created attachment 345056 [details] [review]
Add label widget for route labels

This adds a label widget for representing parts of transit
journeys.
The label can use "long" or "compact" mode, where the latter
is suited for presenting in an overview and the former
for a detailed view of an itinerary.
Comment 84 Marcus Lundblad 2017-02-06 20:54:16 UTC
Created attachment 345057 [details] [review]
Add module to query an OpenTripPlanner instance

Adds an openTripPlanner module, containing functionallity for interfacing against
an OpenTripPlanner service. Also has functionallity to augment itineraries obtained
with walk routing from GraphHopper (as used by the other routing modes).

Furthermore, the transitPlan module contains interfacing classes modelling transit data

Plan:
Populated by a list of itineraries when performing a transit query.

Itinerary:
Represents one particular trip option in a search result. Contains one or more transit legs.

Leg:
Represents one distinct part of a trip, such as
"take tram #5 departuring at 10:00 from Foo Street, get off at Bar Street, arrival at 10:12".

Stop:
Represents an intermediate stop along a transit leg (a place where the vehicle stops, but
the itinerary doesn't board or alight the vehicle.
Comment 85 Marcus Lundblad 2017-02-06 21:06:08 UTC
(In reply to Jonas Danielsson from comment #67)
> Review of attachment 342985 [details] [review] [review]:
> 
> neat
> 
> ::: data/gnome-maps.css
> @@ +104,3 @@
> +  background-color: transparent;
> +  -gtk-outline-radius: 14px;
> +}
> 
> Investigate if this can be done with standard GTK circlular-button class
> 
> ::: src/transitLegRow.js
> @@ +2,3 @@
> +/* vim: set et ts=4 sw=4: */
> +/*
> + * Copyright (c) 2016 Marcus Lundblad
> 
> 2017
Sure
> 
> @@ +16,3 @@
> + * You should have received a copy of the GNU General Public License along
> + * with GNOME Maps; if not, write to the Free Software Foundation,
> + * Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> 
> Remove address, look at other modules
Sure
> 
> @@ +64,3 @@
> +        delete params.print;
> +
> +        this.parent();
> 
> this.parent(params);
Fixed
> 
> @@ +70,3 @@
> +            if (this._leg.from) {
> +                /* Translators: this is a format string indicating
> instructions
> +                 * starting a journey at the address given as the parameter
> */
> 
> nit: 
> 
> /*
>  * This is a comment
>  */
> 
Sure
> @@ +84,3 @@
> +        if (this._leg.transit) {
> +            let routeLabel =
> +                new TransitRouteLabel.TransitRouteLabel({ leg: this._leg });
> 
> ... TransitRouteLabel({
>         leg: this._leg
>     });
> 
> 
> might be a prettier break
Makes sense
> 
> @@ +86,3 @@
> +                new TransitRouteLabel.TransitRouteLabel({ leg: this._leg });
> +
> +            routeLabel.margin_end = 3;
> 
> Does this number have a deeper significane? Can we add a comment or in
> another way shed light on this number 3?
I moved this (and the other contruct params) to the UI file and added a
comment on the rationale (we want a padding after the route (i.e. line number) label for transit legs, while for walking legs the headsign label is the first in the grid row, and is flush-on the left side.

> 
> @@ +87,3 @@
> +
> +            routeLabel.margin_end = 3;
> +            routeLabel.hexpand = false;
> 
> Add these routeLabel properties to constructor construct. Or if thety really
> are constant, add them to transitroutelabel ui file
> 
> @@ +91,3 @@
> +            this._routeGrid.add(routeLabel);
> +
> +            this._agencyLabel.visible = true;
> 
> always visible? add to ui file
Actually, agency lable is only visible for transit legs, not walking.
> 
> @@ +110,3 @@
> +
> +        if (!this._leg.transit || this._leg.headsign) {
> +            let maxWidthChars = this._print ? -1 : 20;
> 
> a bit terse, untersify or add a comment
Added a comment here about setting max width to constrain side bar, but unlimited for printing.
> 
> @@ +116,3 @@
> +                                                max_width_chars:
> maxWidthChars,
> +                                                ellipsize:
> Pango.EllipsizeMode.END,
> +                                                halign: Gtk.Align.START });
> 
> one prop per row
Sure
> 
> @@ +122,3 @@
> +            } else if (!this._leg.transit) {
> +                /* Translators: this is a format string indicating walking
> a certain
> +                 * distance, with the distance expression being the %s
> placeholder */
> 
> comment format
Fixed
> 
> @@ +129,3 @@
> +            }
> +
> +            headsignLabel.get_style_context().add_class('dim-label');
> 
> investigate if a small class exists and if this class handling can be added
> to ui file

I didn't yet find out a way to do this with standard styles, but I wanted to
refresh this patch anyway to avoid having WIP stashes when starting the "routing engine delegator" refactoring.

> 
> @@ +136,3 @@
> +            this._timeLabel.label = this._leg.prettyPrintDepartureTime();
> +        else
> +            this._timeLabel.label = this._leg.prettyPrintTimeInterval();
> 
> Maybe this can be one row if prettyPrint changes a bit

Yes, introduces a new prettyPrintTime() taking a params object where "isStart" indicates if it's a first-in-an-itinerary leg doing this logic in there.
> 
> @@ +145,3 @@
> +        this._expandButton.connect('clicked', (function() {
> +            this._expand();
> +        }).bind(this));
> 
> this.expandButton.connect('clicked', this._expand.bind(this));
Yep
> 
> @@ +149,3 @@
> +        this._collapsButton.connect('clicked', (function() {
> +            this._collaps();
> +        }).bind(this));
> 
> Same as above.
Yep
> 
> @@ +163,3 @@
> +            this._onEvent(event);
> +            return true;
> +        }).bind(this));
> 
> Either pick more verbose names for the handlers or add a comment
Changes this to "_handleEventBox"
> 
> @@ +194,3 @@
> +        /* collaps the time label down to just show the start time when
> +         * revealing intermediate stop times, as the arrival time is
> displayed
> +         * at the last stop */
> 
> comment format
> 
> @@ +223,3 @@
> +        } else {
> +            /* don't output the starting and ending instructions from the
> walk
> +             * route, since these are explicitely added by the itinerary */
> 
> comment format
Yep
Comment 86 Marcus Lundblad 2017-02-06 21:41:26 UTC
Created attachment 345059 [details] [review]
Add list box row class for transit stops

List box row showing intermediate stops.
Comment 87 Marcus Lundblad 2017-02-06 21:42:18 UTC
Created attachment 345060 [details] [review]
Add module to query an OpenTripPlanner instance

Adds an openTripPlanner module, containing functionallity for interfacing against
an OpenTripPlanner service. Also has functionallity to augment itineraries obtained
with walk routing from GraphHopper (as used by the other routing modes).

Furthermore, the transitPlan module contains interfacing classes modelling transit data

Plan:
Populated by a list of itineraries when performing a transit query.

Itinerary:
Represents one particular trip option in a search result. Contains one or more transit legs.

Leg:
Represents one distinct part of a trip, such as
"take tram #5 departuring at 10:00 from Foo Street, get off at Bar Street, arrival at 10:12".

Stop:
Represents an intermediate stop along a transit leg (a place where the vehicle stops, but
the itinerary doesn't board or alight the vehicle.
Comment 88 Marcus Lundblad 2017-02-06 21:44:03 UTC
Created attachment 345061 [details] [review]
Add module to query an OpenTripPlanner instance

Adds an openTripPlanner module, containing functionallity for interfacing against
an OpenTripPlanner service. Also has functionallity to augment itineraries obtained
with walk routing from GraphHopper (as used by the other routing modes).

Furthermore, the transitPlan module contains interfacing classes modelling transit data

Plan:
Populated by a list of itineraries when performing a transit query.

Itinerary:
Represents one particular trip option in a search result. Contains one or more transit legs.

Leg:
Represents one distinct part of a trip, such as
"take tram #5 departuring at 10:00 from Foo Street, get off at Bar Street, arrival at 10:12".

Stop:
Represents an intermediate stop along a transit leg (a place where the vehicle stops, but
the itinerary doesn't board or alight the vehicle.
Comment 89 Marcus Lundblad 2017-02-06 21:46:43 UTC
(In reply to Jonas Danielsson from comment #81)
> Review of attachment 340864 [details] [review] [review]:
> 
> some nits
> 
> ::: src/transitStopRow.js
> @@ +2,3 @@
> +/* vim: set et ts=4 sw=4: */
> +/*
> + * Copyright (c) 2016 Marcus Lundblad
> 
> 2017
Sure
> 
> @@ +17,3 @@
> + * with GNOME Maps; if not, write to the Free Software Foundation,
> + * Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> + *
> 
> adress
> 
Sure
> @@ +41,3 @@
> +        delete params.final;
> +
> +        this.parent();
> 
> should take params
> 
Fixed
> @@ +48,3 @@
> +            this._timeLabel.label = this.stop.prettyPrintArrivalTime();
> +        else
> +            this._timeLabel.label = this.stop.prettyPrintDepartureTime();
> 
> this.stop.prettyPrint(!this._final) so prettyPrint would be a function like
> prettyPrint(iSDepartureTime);
Changed to use a prettyPrint() in TransitPlan.Stop taking a param object, using a isFinal field to select the arrival or depature to for the stop.
Comment 90 Marcus Lundblad 2017-02-06 22:04:18 UTC
Created attachment 345063 [details] [review]
Add map marker to mark start of walking transit legs
Comment 91 Jonas Danielsson 2017-02-07 07:13:32 UTC
Review of attachment 345063 [details] [review]:

Thanks!

::: src/transitWalkMarker.js
@@ +36,3 @@
+        delete params.leg;
+
+        this._previousLeg = params.previousLeg;

is this temp member variable really needed? We could just use params.previousLeg below, or failing that this could just be let prevLeg =

@@ +46,3 @@
+        let point = this._previousLeg ?
+                    this._previousLeg.polyline[this._previousLeg.polyline.length - 1] :
+                    this._leg.polyline[0];

I think I would prefer this as an if/else-statement, no strong feelings though

@@ +49,3 @@
+        let location =
+            new Location.Location({ latitude: point.get_latitude(),
+                                    longitude: point.get_longitude() });

can we break it as:

let location = new Location.Location({
    latitude: point.get_latitude(),
    longitude: point.get_longitude(),
});

?

And also what class is point? Is latitude/longitude not properties so this could be point.latitude?
Comment 92 Jonas Danielsson 2017-02-07 07:16:48 UTC
Review of attachment 342353 [details] [review]:

Nice!

I think this deserves its own module instead of piling onto Utils though!
Maybe contrast.js?
Comment 93 Jonas Danielsson 2017-02-07 07:18:30 UTC
Review of attachment 340862 [details] [review]:

thanks!

::: src/transitArrivalMarker.js
@@ +2,3 @@
+/* vim: set et ts=4 sw=4: */
+/*
+ * Copyright (c) 2016 Marcus Lundblad

2017

@@ +16,3 @@
+ * You should have received a copy of the GNU General Public License along
+ * with GNOME Maps; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

address

@@ +40,3 @@
+        let location =
+            new Location.Location({ latitude: lastPoint.get_latitude(),
+                                    longitude: lastPoint.get_longitude() });

Can we break with

({
   property: value,
   ...
})

instead?

@@ +46,3 @@
+        this.parent(params);
+
+        let color = new Gdk.RGBA({ red: 0, green: 0, blue: 0, alpha: 1.0 });

new line for each prop
Comment 94 Jonas Danielsson 2017-02-07 07:23:05 UTC
Review of attachment 340863 [details] [review]:

nice!

::: src/transitBoardMarker.js
@@ +3,3 @@
+/*
+ * Copyright (c) 2016 Marcus Lundblad
+ *

2017

@@ +16,3 @@
+ * You should have received a copy of the GNU General Public License along
+ * with GNOME Maps; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

address

@@ +51,3 @@
+        let location =
+            new Location.Location({ latitude: firstPoint.get_latitude(),
+                                    longitude: firstPoint.get_longitude() });

Break style

@@ +58,3 @@
+        let actor = this._createActor();
+
+        this.add_actor(actor);

this.add_Actor(this._createActor());

@@ +60,3 @@
+        this.add_actor(actor);
+    },
+

Could we get a comment for the quite large function below? What is it doing and why?
Comment 95 Jonas Danielsson 2017-02-07 07:24:17 UTC
Review of attachment 340999 [details] [review]:

Otherwise LGTM

::: src/transitArrivalRow.js
@@ +2,3 @@
+/* vim: set et ts=4 sw=4: */
+/*
+ * Copyright (c) 2016 Marcus Lundblad

2017

@@ +16,3 @@
+ * You should have received a copy of the GNU General Public License along
+ * with GNOME Maps; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

address
Comment 96 Jonas Danielsson 2017-02-07 07:25:31 UTC
Review of attachment 345059 [details] [review]:

hm

::: src/transitLegRow.js
@@ +27,3 @@
 const GLib = imports.gi.GLib;
 const Gtk = imports.gi.Gtk;
+const Pango = imports.gi.Pango;

mis-rebase?
Comment 97 Marcus Lundblad 2017-02-07 21:11:39 UTC
Created attachment 345147 [details] [review]
Add map marker to mark start of walking transit legs
Comment 98 Marcus Lundblad 2017-02-07 21:14:42 UTC
(In reply to Jonas Danielsson from comment #91)
> Review of attachment 345063 [details] [review] [review]:
> 
> Thanks!
> 
> ::: src/transitWalkMarker.js
> @@ +36,3 @@
> +        delete params.leg;
> +
> +        this._previousLeg = params.previousLeg;
> 
> is this temp member variable really needed? We could just use
> params.previousLeg below, or failing that this could just be let prevLeg =
> 

Indeed, changed to just use the params properties to contruct the point directly.

> @@ +46,3 @@
> +        let point = this._previousLeg ?
> +                   
> this._previousLeg.polyline[this._previousLeg.polyline.length - 1] :
> +                    this._leg.polyline[0];
> 
> I think I would prefer this as an if/else-statement, no strong feelings
> though

Sure, I have no strong feeling about it either, so might as well go for a outspoken if/else here.

> 
> @@ +49,3 @@
> +        let location =
> +            new Location.Location({ latitude: point.get_latitude(),
> +                                    longitude: point.get_longitude() });
> 
> can we break it as:
> 
> let location = new Location.Location({
>     latitude: point.get_latitude(),
>     longitude: point.get_longitude(),
> });
> 
> ?

Sure thing
> 
> And also what class is point? Is latitude/longitude not properties so this
> could be point.latitude?

Yep, actually it is a Champlain.Coordinate, so it has these as properties.
Comment 99 Marcus Lundblad 2017-02-07 21:29:44 UTC
Created attachment 345148 [details] [review]
Add color luminance and contrast functions

Add a new module with utility functions for computing lumninance
and contrast for background and foreground colors.
This is needed to compute good contrasting colors for transit route
labels.
Comment 100 Marcus Lundblad 2017-02-07 21:42:04 UTC
(In reply to Jonas Danielsson from comment #92)
> Review of attachment 342353 [details] [review] [review]:
> 
> Nice!
> 
> I think this deserves its own module instead of piling onto Utils though!
> Maybe contrast.js?

Yep, makes good sense.
I moved it to a new contrast.js (seems to be a prudent name :) )
I also re-worded the commit message a bit (as it is now a new module and all…

BTW, there is some fallout on this, so will come a few follow-up patch refreshes.
Comment 101 Marcus Lundblad 2017-02-07 21:43:32 UTC
Created attachment 345149 [details] [review]
Add map marker for marking boarding points in transit itineraries
Comment 102 Marcus Lundblad 2017-02-07 21:57:31 UTC
Created attachment 345150 [details] [review]
Add label widget for route labels

This adds a label widget for representing parts of transit
journeys.
The label can use "long" or "compact" mode, where the latter
is suited for presenting in an overview and the former
for a detailed view of an itinerary.
Comment 103 Marcus Lundblad 2017-02-07 22:01:59 UTC
Created attachment 345151 [details] [review]
mapView: Implement showing transit routes

Also added functionallity to allow showing dynamically created
route layer segments, optionally using a dashed style.
This is used by transit routes to show walking and transit legs
of journeys.
Comment 104 Marcus Lundblad 2017-02-07 22:10:02 UTC
Created attachment 345153 [details] [review]
Add map marker for marking boarding points in transit itineraries
Comment 105 Marcus Lundblad 2017-02-07 22:16:00 UTC
Created attachment 345154 [details] [review]
Add map marker to mark end of transit itineraries
Comment 106 Marcus Lundblad 2017-02-07 22:19:59 UTC
Created attachment 345155 [details] [review]
Add map marker to mark end of transit itineraries
Comment 107 Marcus Lundblad 2017-02-07 22:21:04 UTC
(In reply to Jonas Danielsson from comment #93)
> Review of attachment 340862 [details] [review] [review]:
> 
> thanks!
> 
> ::: src/transitArrivalMarker.js
> @@ +2,3 @@
> +/* vim: set et ts=4 sw=4: */
> +/*
> + * Copyright (c) 2016 Marcus Lundblad
> 
> 2017
Fixed
> 
> @@ +16,3 @@
> + * You should have received a copy of the GNU General Public License along
> + * with GNOME Maps; if not, write to the Free Software Foundation,
> + * Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> 
> address

Fixed
> 
> @@ +40,3 @@
> +        let location =
> +            new Location.Location({ latitude: lastPoint.get_latitude(),
> +                                    longitude: lastPoint.get_longitude() });
> 
> Can we break with
> 
> ({
>    property: value,
>    ...
> })
> 
> instead?
> 
Yep

> @@ +46,3 @@
> +        this.parent(params);
> +
> +        let color = new Gdk.RGBA({ red: 0, green: 0, blue: 0, alpha: 1.0 });
> 
> new line for each prop
Yep

Also got rid of the _leg instance variable here (and use params.leg directly to create the the location object) and also use the .latitude and .longitude properties directly, like in a previous patch.
Comment 108 Marcus Lundblad 2017-02-07 22:28:40 UTC
Created attachment 345156 [details] [review]
Add map marker for marking boarding points in transit itineraries
Comment 109 Marcus Lundblad 2017-02-07 22:32:39 UTC
(In reply to Jonas Danielsson from comment #94)
> Review of attachment 340863 [details] [review] [review]:
> 
> nice!

Thanks!
> 
> ::: src/transitBoardMarker.js
> @@ +3,3 @@
> +/*
> + * Copyright (c) 2016 Marcus Lundblad
> + *
> 
> 2017
Yep
> 
> @@ +16,3 @@
> + * You should have received a copy of the GNU General Public License along
> + * with GNOME Maps; if not, write to the Free Software Foundation,
> + * Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> 
> address
Fixed
> 
> @@ +51,3 @@
> +        let location =
> +            new Location.Location({ latitude: firstPoint.get_latitude(),
> +                                    longitude: firstPoint.get_longitude()
> });
> 
> Break style
> 
Fixed

> @@ +58,3 @@
> +        let actor = this._createActor();
> +
> +        this.add_actor(actor);
> 
> this.add_Actor(this._createActor());

Yep (and the _createActor takes a leg parameter now, to avoid setting a _leg instance variable like in another patch).
> 
> @@ +60,3 @@
> +        this.add_actor(actor);
> +    },
> +
> 
> Could we get a comment for the quite large function below? What is it doing
> and why?

Added a comment about this function creating a Clutter actor depicting the transit type for boarding, drawn in colors from the transit data and with foreground-colored outline to improve legibility when the background of the marker is light.
Comment 110 Marcus Lundblad 2017-02-07 22:35:50 UTC
Created attachment 345157 [details] [review]
Add map marker for marking boarding points in transit itineraries
Comment 111 Marcus Lundblad 2017-02-07 22:38:32 UTC
Created attachment 345159 [details] [review]
Add a list box row to show the arrival of a transit itinerary
Comment 112 Marcus Lundblad 2017-02-07 22:39:11 UTC
(In reply to Jonas Danielsson from comment #95)
> Review of attachment 340999 [details] [review] [review]:
> 
> Otherwise LGTM
> 
> ::: src/transitArrivalRow.js
> @@ +2,3 @@
> +/* vim: set et ts=4 sw=4: */
> +/*
> + * Copyright (c) 2016 Marcus Lundblad
> 
> 2017
Sure
> 
> @@ +16,3 @@
> + * You should have received a copy of the GNU General Public License along
> + * with GNOME Maps; if not, write to the Free Software Foundation,
> + * Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> 
> address
Sure
Comment 113 Marcus Lundblad 2017-02-07 22:44:01 UTC
Created attachment 345160 [details] [review]
Add list box row class for transit stops

List box row showing intermediate stops.
Comment 114 Marcus Lundblad 2017-02-07 22:44:47 UTC
Created attachment 345161 [details] [review]
Add list box row to display a leg of a transit itinerary

This list box class is used to render a "leg" of an itinerary
when "diving in" to a particular itinerary.
I.e. part of a journey such as "Walk 500 m" or "Bus 42 leaving at 12:00".
Comment 115 Marcus Lundblad 2017-02-07 22:48:20 UTC
(In reply to Jonas Danielsson from comment #96)
> Review of attachment 345059 [details] [review] [review]:
> 
> hm
> 
> ::: src/transitLegRow.js
> @@ +27,3 @@
>  const GLib = imports.gi.GLib;
>  const Gtk = imports.gi.Gtk;
> +const Pango = imports.gi.Pango;
> 
> mis-rebase?

Yeah, must have been a Franken-rebase :)
Re-aligned the patches, should be right now.
Comment 116 Jonas Danielsson 2017-02-08 06:24:38 UTC
Review of attachment 345155 [details] [review]:

just a nit, could be ignored-

::: src/transitArrivalMarker.js
@@ +48,3 @@
+                                   blue: 0,
+                                   alpha: 1.0
+                                 });

alpha: 1.0 });
Comment 117 Jonas Danielsson 2017-02-08 06:25:33 UTC
Review of attachment 345157 [details] [review]:

LGTM
Comment 118 Jonas Danielsson 2017-02-08 06:26:14 UTC
Review of attachment 345159 [details] [review]:

LGTM
Comment 119 Jonas Danielsson 2017-02-08 06:26:42 UTC
Review of attachment 345160 [details] [review]:

LGTM
Comment 120 Jonas Danielsson 2017-02-08 06:28:18 UTC
Review of attachment 345161 [details] [review]:

LGTM
Comment 121 Jonas Danielsson 2017-02-08 06:28:36 UTC
Review of attachment 345159 [details] [review]:

set
Comment 122 Jonas Danielsson 2017-02-08 06:28:38 UTC
Review of attachment 345159 [details] [review]:

set
Comment 123 Jonas Danielsson 2017-02-08 06:28:43 UTC
Review of attachment 345160 [details] [review]:

set
Comment 124 Jonas Danielsson 2017-02-08 06:28:47 UTC
Review of attachment 345161 [details] [review]:

set
Comment 125 Marcus Lundblad 2017-02-09 20:35:28 UTC
Created attachment 345370 [details] [review]
routeQuery: Move routequery to the Application module

Let the Application module handle the route query singleton instance.
This is needed so that the OpenTripPlanner module can access the
query.
Also change the GraphHopper object to take the query as a contruct
parameter to avoid accessing globals in Application.
Comment 126 Marcus Lundblad 2017-02-09 20:36:38 UTC
Created attachment 345371 [details] [review]
Add module to query an OpenTripPlanner instance

Adds an openTripPlanner module, containing functionallity for interfacing against
an OpenTripPlanner service. Also has functionallity to augment itineraries obtained
with walk routing from GraphHopper (as used by the other routing modes).

Furthermore, the transitPlan module contains interfacing classes modelling transit data

Plan:
Populated by a list of itineraries when performing a transit query.

Itinerary:
Represents one particular trip option in a search result. Contains one or more transit legs.

Leg:
Represents one distinct part of a trip, such as
"take tram #5 departuring at 10:00 from Foo Street, get off at Bar Street, arrival at 10:12".

Stop:
Represents an intermediate stop along a transit leg (a place where the vehicle stops, but
the itinerary doesn't board or alight the vehicle.
Comment 127 Marcus Lundblad 2017-02-09 20:37:52 UTC
Created attachment 345372 [details] [review]
Rename the RouteService module to GraphHopper

Since we are going to add a delegator abstraction to
handle delegating routing requests to the different
routing implementations, need a more specific name
for this.
Comment 128 Marcus Lundblad 2017-02-09 20:38:42 UTC
Created attachment 345373 [details] [review]
Add module to delegate routing requests.

Adds a new module implementing a delegator that
delegates routing requests to either GraphHopper
or OpenTripPlanner based on the selected mode.
Comment 129 Marcus Lundblad 2017-02-09 20:40:05 UTC
Created attachment 345374 [details] [review]
mapBubble: Ensure non-transit when routing

When using the route button, the mode will default to car,
so make sure the GraphHopper service is listening to route
query events.
Comment 130 Marcus Lundblad 2017-02-09 20:41:11 UTC
Created attachment 345375 [details] [review]
sidebar: Add functionallity for transit routing

Adds a new mode button (enabled when the service file
indicates an OpenTripPlanner instance, or if explicitly
pointed out via an env variable).
Adds showing transit itineraries in addition to regular
turn-by-turn-based routes, and options for transit route
search.
Comment 131 Marcus Lundblad 2017-02-09 20:45:38 UTC
Created attachment 345376 [details] [review]
mapView: Add a view property to indicate showing a route

Adds a new boolean property that is set to true when an actual route
is rendered on the map.
This will allow only showing the print button when a transit itinerary
is "dived into".
Comment 132 Marcus Lundblad 2017-02-09 20:46:21 UTC
Created attachment 345377 [details] [review]
mapView: Implement showing transit routes

Also added functionallity to allow showing dynamically created
route layer segments, optionally using a dashed style.
This is used by transit routes to show walking and transit legs
of journeys.
Comment 133 Marcus Lundblad 2017-02-09 20:50:47 UTC
Created attachment 345378 [details] [review]
Add print layout for transit

Adds a printing layout implementation for transit itineraries.
It will print the instructions for transit switches during a
trip. Also includes minimaps for walking sections.
Comment 134 Marcus Lundblad 2017-02-09 20:57:07 UTC
(In reply to Jonas Danielsson from comment #60)
> Review of attachment 338859 [details] [review] [review]:
> 
> LGTM but might change  a bit if we change the pattern of routeService

The routing delegator is now in place, and this patch is unaffected.
A later patch renamed the module to GraphHopper, though.
Comment 135 Marcus Lundblad 2017-02-09 21:01:26 UTC
Created attachment 345379 [details] [review]
routeQuery: Move routequery to the Application module

Let the Application module handle the route query singleton instance.
This is needed so that the OpenTripPlanner module can access the
query.
Also change the GraphHopper object to take the query as a contruct
parameter to avoid accessing globals in Application.
Comment 136 Marcus Lundblad 2017-02-09 21:48:31 UTC
(In reply to Jonas Danielsson from comment #59)
> Review of attachment 338858 [details] [review] [review]:
> 
> Switch to using a delegator pattern for routeService to be able to better
> handle otp and graphhopper seemlessly

Yep, introduced now in a new patch!
> 
> ::: src/mainWindow.js
> @@ -140,0 +138,2 @@
> +        Application.routeQuery.connect('notify',
> +                                              
> this._setRevealSidebar.bind(this, true));
> 
> Indentations issues, also: check if break is still needed
> 
Fixed and the line was overflowing 80 columns by quite a few, so I kept the break.
> ::: src/routeService.js
> @@ +48,3 @@
>          this.storedRoute = null;
> +        this._query = Application.routeQuery;
> +        this.parent();
> 
> Switch to taking the query as a construct time parameter

The query is now passed in the param object (after the renaming of the module to GraphHopper).
Comment 137 Marcus Lundblad 2017-02-09 22:17:11 UTC
Created attachment 345383 [details] [review]
Add module to delegate routing requests.

Adds a new module implementing a delegator that
delegates routing requests to either GraphHopper
or OpenTripPlanner based on the selected mode.
Comment 138 Marcus Lundblad 2017-02-09 22:35:40 UTC
Created attachment 345384 [details] [review]
printOperation: Use transit print layout when requested

Use the transit print layout when a transit itinerary was selected.
Comment 139 Marcus Lundblad 2017-02-09 22:36:20 UTC
Created attachment 345385 [details] [review]
Add module to delegate routing requests.

Adds a new module implementing a delegator that
delegates routing requests to either GraphHopper
or OpenTripPlanner based on the selected mode.
Comment 140 Jonas Danielsson 2017-02-10 06:05:31 UTC
Review of attachment 340944 [details] [review]:

LGTM
Comment 141 Jonas Danielsson 2017-02-10 06:07:53 UTC
Review of attachment 341695 [details] [review]:

nits

::: src/transitItineraryRow.js
@@ +2,3 @@
+/* vim: set et ts=4 sw=4: */
+/*
+ * Copyright (c) 2016 Marcus Lundblad

2017

@@ +16,3 @@
+ * You should have received a copy of the GNU General Public License along
+ * with GNOME Maps; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

no address

@@ +58,3 @@
+         * itinerary */
+        let useContractedLabels = this._itinerary.legs.length > 5;
+        for (let i = 0; i < this._itinerary.legs.length; i++) {

no way of doing this with an this._itinerary.legs.forEach( ... type of construct?
Comment 142 Jonas Danielsson 2017-02-10 06:08:43 UTC
Review of attachment 345147 [details] [review]:

lgtm
Comment 143 Jonas Danielsson 2017-02-10 06:08:57 UTC
Review of attachment 345148 [details] [review]:

\o/
Comment 144 Jonas Danielsson 2017-02-10 06:11:00 UTC
Review of attachment 345150 [details] [review]:

lgtm

::: src/transitRouteLabel.js
@@ +111,3 @@
+     * and getting rounded corner just using CSS styles, so doing a custom
+     * Cairo drawing of a "roundrect"
+     */

Removing the background-image, setting backround-color and using border-radius does not work?
Comment 145 Jonas Danielsson 2017-02-10 06:25:28 UTC
Review of attachment 345371 [details] [review]:

So, this all looks very nice! But it is hard for me to follow, would it be possible with a larger comment block on top of openTripPlanner.js that talks a bit about general code flow and function?

::: src/openTripPlanner.js
@@ +449,3 @@
+
+            let params = { fromPlace: stops[0].id,
+                           toPlace: stops[stops.length - 1].id };

we are stating to have a lot of this pattern, getting the last element of an array.

How about we add:

if (!Array.prototype.last){
    Array.prototype.last = function(){
        return this[this.length - 1];
    };
};

Somewhere? We already do String.prototype.format = Format.format; in application.js, not sure if that belongs there though.

Turning all those awkward constructs from stops[stops.length - 1]; to stops.last; is appealing.

@@ +702,3 @@
+                                    duration:            route.time / 1000,
+                                    distance:            route.distance,
+                                    walkingInstructions: route.turnPoints });

I am not crazy about this formatting, but not sure if an alternative is better.
Can it be de-complexed? Creating the from/to-coordinate on their own lines maybe?

let fromCoord = [from.place.location.latitude, from.place.location.longitude];
let toCoord = [to.place.location.latitude, to.place.location.longitude];

And then the constructor will be more normal looking, and maybe we skip the alignment?

::: src/transitPlan.js
@@ +399,3 @@
+        delete params.tripShortName;
+
+        this.parent();

what parent?
Comment 146 Jonas Danielsson 2017-02-10 06:26:27 UTC
Review of attachment 345372 [details] [review]:

Does this not have code fallout as well? Is this commit buildable?
Comment 147 Jonas Danielsson 2017-02-10 06:26:42 UTC
Review of attachment 340951 [details] [review]:

lgtm
Comment 148 Jonas Danielsson 2017-02-10 06:29:14 UTC
Review of attachment 345374 [details] [review]:

Ok. At some poing we should stop defaulting to car. Cars are uncivilized.
Comment 149 Jonas Danielsson 2017-02-10 06:34:22 UTC
Review of attachment 345375 [details] [review]:

This looks nice! But sidebar.js is growing! Do you see anyway of breaking out functionality from this class?

::: src/sidebar.js
@@ +85,3 @@
+                        'trainCheckButton',
+                        'subwayCheckButton',
+                        'transitParametersMenuButton',

Holy wall of widgets, Batman!

@@ +108,3 @@
+         */
+        this._modeTransitToggle.sensitive =
+            Application.routingDelegator.openTripPlanner.enabled;

I wonder if this should be this._modeTransitTogge.visible = ...

Can we get Andreas opinion?

@@ +515,3 @@
+            return null;
+        }
+        this._transitTimeEntry.connect('activate',

This is a pure function right, maybe move to Utils or if we have a bunch of similar helpers, to a [something with time].js
Comment 150 Jonas Danielsson 2017-02-10 06:35:39 UTC
Review of attachment 345376 [details] [review]:

::: src/mapView.js
@@ +84,3 @@
                                                   GObject.ParamFlags.WRITABLE,
+                                                  false),
+        /* this property is true when a route is being shown on the map */

Are the comments above the wrong way around? Or are we really bad at naming?
Comment 151 Jonas Danielsson 2017-02-10 06:40:45 UTC
Review of attachment 345377 [details] [review]:

o//

::: src/mapView.js
@@ +176,3 @@
+            lineColor ? parseInt(lineColor.substring(2, 4), 16) : 0;
+        let blue =
+            lineColor ? parseInt(lineColor.substring(4, 6), 16) : 255;

this pattern is used in other places? Maybe time for a helper?

function parseColor(string, offset, length, default) {
   ...
}

let red = parseColor(linecolor, offset, length, 0);

Or similar? Will that let us avoid the silly breaks and hard to parse trinary operators?

@@ +588,3 @@
+                let previousLeg = itinerary.legs[index - 1];
+                let lastPoint =
+            let outlineRouteLayer;

If we had the last prototype:

let lastPoing = previousLeg.polyline.last;

@@ +624,3 @@
+                    new TransitBoardMarker.TransitBoardMarker({ leg: leg,
+                                                                mapView: this});
+            }

no way to avoid this break at assignment?

startMarker = new TransitBoardMarker.TransitBoardMarker({
    ...
    ...
    ...
}); ?

Or renaming to just "start"?

@@ +633,3 @@
+        let arrivalMarker =
+            new TransitArrivalMarker.TransitArrivalMarker({ leg: lastLeg,
+            leg.polyline.forEach(routeLayer.add_node.bind(routeLayer));

same break question here
Comment 152 Jonas Danielsson 2017-02-10 06:42:25 UTC
Review of attachment 345378 [details] [review]:

Yes.
Comment 153 Jonas Danielsson 2017-02-10 06:43:13 UTC
Review of attachment 345379 [details] [review]:

ok
Comment 154 Jonas Danielsson 2017-02-10 06:43:42 UTC
Review of attachment 345384 [details] [review]:

\o/
Comment 155 Jonas Danielsson 2017-02-10 06:46:16 UTC
Review of attachment 345385 [details] [review]:

nice! nits inside!

::: src/application.js
@@ +249,3 @@
+        routeQuery       = new RouteQuery.RouteQuery();
+        routingDelegator = new RoutingDelegator.RoutingDelegator(
+                                    { query: routeQuery });

this is a silly break, is it needed? If so try to make it more standard:

new RoutingDelegator.RoutingDelegator({
    query: routeQuery
});

::: src/routingDelegator.js
@@ +38,3 @@
+        this._openTripPlanner = new OpenTripPlanner.OpenTripPlanner(
+                                        { query: this._query,
+                                          graphHopper: this._graphHopper });

silly break again
Comment 156 Marcus Lundblad 2017-02-10 06:54:51 UTC
Created attachment 345402 [details] [review]
Add list box row class for representing transit itineraries

This list box class is used to render the overview items showing the list of
found itineraries when performing a transit route search.
Comment 157 Marcus Lundblad 2017-02-10 07:11:02 UTC
(In reply to Jonas Danielsson from comment #141)
> Review of attachment 341695 [details] [review] [review]:
> 
> nits
> 
> ::: src/transitItineraryRow.js
> @@ +2,3 @@
> +/* vim: set et ts=4 sw=4: */
> +/*
> + * Copyright (c) 2016 Marcus Lundblad
> 
> 2017
Yep
> 
> @@ +16,3 @@
> + * You should have received a copy of the GNU General Public License along
> + * with GNOME Maps; if not, write to the Free Software Foundation,
> + * Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> 
> no address
Fixed
> 
> @@ +58,3 @@
> +         * itinerary */
> +        let useContractedLabels = this._itinerary.legs.length > 5;
> +        for (let i = 0; i < this._itinerary.legs.length; i++) {
> 
> no way of doing this with an this._itinerary.legs.forEach( ... type of
> construct?

Yeah, changed this to use forEach(function(leg, i) {
Should work with ES5-compatability, so should be safe, I think.
Comment 158 Marcus Lundblad 2017-02-10 07:13:02 UTC
(In reply to Jonas Danielsson from comment #148)
> Review of attachment 345374 [details] [review] [review]:
> 
> Ok. At some poing we should stop defaulting to car. Cars are uncivilized.

:-)
One cool idea would be to have it context-based, so rural area with low transit-coverage: car, short distance: walk or bike, cities: transit etc.
Comment 159 Marcus Lundblad 2017-02-10 07:31:49 UTC
Created attachment 345403 [details] [review]
Add module to delegate routing requests.

Adds a new module implementing a delegator that
delegates routing requests to either GraphHopper
or OpenTripPlanner based on the selected mode.
Also change the name of the RouteService module
to GraphHopper to make it more clear that these
are different service interfaces.
Comment 160 Marcus Lundblad 2017-02-10 07:36:54 UTC
(In reply to Jonas Danielsson from comment #155)
> Review of attachment 345385 [details] [review] [review]:
> 
> nice! nits inside!
:)
> 
> ::: src/application.js
> @@ +249,3 @@
> +        routeQuery       = new RouteQuery.RouteQuery();
> +        routingDelegator = new RoutingDelegator.RoutingDelegator(
> +                                    { query: routeQuery });
> 
> this is a silly break, is it needed? If so try to make it more standard:
> 
I moved it up (there were some equally-long lines already in the visinity).

> new RoutingDelegator.RoutingDelegator({
>     query: routeQuery
> });
> 
> ::: src/routingDelegator.js
> @@ +38,3 @@
> +        this._openTripPlanner = new OpenTripPlanner.OpenTripPlanner(
> +                                        { query: this._query,
> +                                          graphHopper: this._graphHopper });
> 
> silly break again

Yep, re-arranged a bit
I also merged this patch with the one renaming routeService.js so it should be in a consistent state along commits.
Comment 161 Marcus Lundblad 2017-02-10 08:48:15 UTC
Created attachment 345404 [details] [review]
main: Add array prototype to get last element

Add an array prototype function to get the last element.
This saves having to do some array[array.length - 1]
contructs later on.
TODO: if we grow more prototype definitions further along
this could be moved to a separate module.
Comment 162 Jonas Danielsson 2017-02-10 10:05:54 UTC
Review of attachment 345404 [details] [review]:

LGTM, Mattias?
Comment 163 Marcus Lundblad 2017-02-10 10:46:55 UTC
(In reply to Jonas Danielsson from comment #150)
> Review of attachment 345376 [details] [review] [review]:
> 
> ::: src/mapView.js
> @@ +84,3 @@
>                                                   
> GObject.ParamFlags.WRITABLE,
> +                                                  false),
> +        /* this property is true when a route is being shown on the map */
> 
> Are the comments above the wrong way around? Or are we really bad at naming?

Actually, the "routeVisible" property is what's there currently.
This is bound to the route query, so that when the query fires notify this propery is set to true if the query is in a valid state.
Actually, there is a short "race condition" today, where the print button is visible before the route is displayed (while the spinner is showing). Perhaps unlikely the user would manage to get a print of an inconsistent state, though.

So, I added the new "routeActive" property that is set when the route is actually finished, or in transit, when the user "dives into" a particular itininerary.

But, yeah, the naming is probably a bit iffy.
Comment 164 Jonas Danielsson 2017-02-10 11:27:55 UTC
(In reply to Marcus Lundblad from comment #163)
> (In reply to Jonas Danielsson from comment #150)
> > Review of attachment 345376 [details] [review] [review] [review]:
> > 
> > ::: src/mapView.js
> > @@ +84,3 @@
> >                                                   
> > GObject.ParamFlags.WRITABLE,
> > +                                                  false),
> > +        /* this property is true when a route is being shown on the map */
> > 
> > Are the comments above the wrong way around? Or are we really bad at naming?
> 
> Actually, the "routeVisible" property is what's there currently.
> This is bound to the route query, so that when the query fires notify this
> propery is set to true if the query is in a valid state.
> Actually, there is a short "race condition" today, where the print button is
> visible before the route is displayed (while the spinner is showing).
> Perhaps unlikely the user would manage to get a print of an inconsistent
> state, though.
> 
> So, I added the new "routeActive" property that is set when the route is
> actually finished, or in transit, when the user "dives into" a particular
> itininerary.
> 
> But, yeah, the naming is probably a bit iffy.

The naming is a showstopper. This is very confusing. The comment above routeVisible mentions active the comment above routeActive mentions shown.
Comment 165 Jonas Danielsson 2017-02-10 11:28:47 UTC
Review of attachment 345403 [details] [review]:

LGTM
Comment 166 Marcus Lundblad 2017-02-10 12:38:33 UTC
Created attachment 345447 [details] [review]
mapView: Implement showing transit routes

Also added functionallity to allow showing dynamically created
route layer segments, optionally using a dashed style.
This is used by transit routes to show walking and transit legs
of journeys.
Comment 167 Marcus Lundblad 2017-02-10 12:39:16 UTC
Created attachment 345448 [details] [review]
mapView: Implement showing transit routes

Also added functionallity to allow showing dynamically created
route layer segments, optionally using a dashed style.
This is used by transit routes to show walking and transit legs
of journeys.
Comment 168 Marcus Lundblad 2017-02-10 12:39:56 UTC
Created attachment 345449 [details] [review]
turnPointMarker: Add support for showing markers for transit stops
Comment 169 Marcus Lundblad 2017-02-10 12:41:26 UTC
Created attachment 345450 [details] [review]
Add label widget for route labels

This adds a label widget for representing parts of transit
journeys.
The label can use "long" or "compact" mode, where the latter
is suited for presenting in an overview and the former
for a detailed view of an itinerary.
Comment 170 Marcus Lundblad 2017-02-10 12:42:07 UTC
Created attachment 345451 [details] [review]
Add color utils

Add a new module with utility functions for computing lumninance
and contrast for background and foreground colors and for parsing
color components from hex-encoded color strings.
This is needed to compute good contrasting colors for transit route
labels.
Comment 171 Marcus Lundblad 2017-02-10 12:47:44 UTC
(In reply to Jonas Danielsson from comment #151)
> Review of attachment 345377 [details] [review] [review]:
> 
> o//
> 
> ::: src/mapView.js
> @@ +176,3 @@
> +            lineColor ? parseInt(lineColor.substring(2, 4), 16) : 0;
> +        let blue =
> +            lineColor ? parseInt(lineColor.substring(4, 6), 16) : 255;
> 
> this pattern is used in other places? Maybe time for a helper?
> 
> function parseColor(string, offset, length, default) {
>    ...
> }
> 
> let red = parseColor(linecolor, offset, length, 0);
> 
> Or similar? Will that let us avoid the silly breaks and hard to parse
> trinary operators?
> 

Moved this to a util functions in the (renamed) Color module.
Some fallout patches have been refreshed as a consequence.

> @@ +588,3 @@
> +                let previousLeg = itinerary.legs[index - 1];
> +                let lastPoint =
> +            let outlineRouteLayer;
> 
> If we had the last prototype:
> 
> let lastPoing = previousLeg.polyline.last;

Yep, now using the last() proto.
> 
> @@ +624,3 @@
> +                    new TransitBoardMarker.TransitBoardMarker({ leg: leg,
> +                                                                mapView:
> this});
> +            }
> 
> no way to avoid this break at assignment?
> 
> startMarker = new TransitBoardMarker.TransitBoardMarker({
>     ...
>     ...
>     ...
> }); ?
> 
> Or renaming to just "start"?
> 
> @@ +633,3 @@
> +        let arrivalMarker =
> +            new TransitArrivalMarker.TransitArrivalMarker({ leg: lastLeg,
> +            leg.polyline.forEach(routeLayer.add_node.bind(routeLayer));
> 
> same break question here

Renamed those and got rid of breaks.
Comment 172 Jonas Danielsson 2017-02-10 13:00:57 UTC
Review of attachment 345448 [details] [review]:

Looks nice!

There is a lot of magic numbers tho, that seems connected with the transit route style. Can they be consolidated?
So that we have transitLeg.XYZ_COLOR, transitLeg.DASH_STEP or similar? (I dunno if transitLeg is the correct class for this) Or if we should have a new module.

::: src/mapView.js
@@ +573,3 @@
+            /* draw an outline by drawing a background path layer if needed
+             * TODO: maybe we should add support for outlined path layers in
+            let color = leg.color;

Can this TODO result in a bug on the libchamplain product and then maybe be removed?

@@ +615,3 @@
+            } else {
+                start = new TransitBoardMarker.TransitBoardMarker({ leg: leg,
+                routeLayer.add_node(lastPoint);

space before }
Comment 173 Jonas Danielsson 2017-02-10 13:02:29 UTC
Review of attachment 345449 [details] [review]:

Nitty McNitface

::: src/turnPointMarker.js
@@ +89,3 @@
+        let blue = Color.parseColor(color, 2, 0x9C);
+
+        let color = this._transitLeg ? this._transitLeg.color : null;

nitty, could this be:
 
return new Gdk.RGBA({
    red: Color.parseColor(color, 0, 0x21),
    green: ...
});

And btw, what is the hex stuff?
Comment 174 Jonas Danielsson 2017-02-10 13:04:57 UTC
Review of attachment 345450 [details] [review]:

lgtm
Comment 175 Jonas Danielsson 2017-02-10 13:05:32 UTC
Review of attachment 345451 [details] [review]:

lgtm
Comment 176 Jonas Danielsson 2017-02-10 13:06:27 UTC
Review of attachment 345402 [details] [review]:

lgtm
Comment 177 Marcus Lundblad 2017-02-10 21:18:07 UTC
Created attachment 345487 [details] [review]
turnPointMarker: Add support for showing markers for transit stops
Comment 178 Marcus Lundblad 2017-02-10 21:18:41 UTC
Created attachment 345488 [details] [review]
mapView: Implement showing transit routes

Also added functionallity to allow showing dynamically created
route layer segments, optionally using a dashed style.
This is used by transit routes to show walking and transit legs
of journeys.
Comment 179 Marcus Lundblad 2017-02-10 21:22:02 UTC
Created attachment 345490 [details] [review]
mapView: Implement showing transit routes

Also added functionallity to allow showing dynamically created
route layer segments, optionally using a dashed style.
This is used by transit routes to show walking and transit legs
of journeys.
Comment 180 Marcus Lundblad 2017-02-10 21:30:35 UTC
(In reply to Jonas Danielsson from comment #172)
> Review of attachment 345448 [details] [review] [review]:
> 
> Looks nice!
> 
> There is a lot of magic numbers tho, that seems connected with the transit
> route style. Can they be consolidated?
> So that we have transitLeg.XYZ_COLOR, transitLeg.DASH_STEP or similar? (I
> dunno if transitLeg is the correct class for this) Or if we should have a
> new module.

There's the color used for non-transit route lines (blue). I added that as a constant in mapView.js. So, now that color is used as a parameter to the _createRouteLayer() function in the non-transit case when creating a route line instead of dealing with that special case inside _createRouteLayer(). This is probably cleaner, I think. Just as in the transit case, where the color comes from the transit data (or using a transit-specific fallback color). Also, I'm not sure that the dash line parameters really belongs in transitPlan.js, I think it's more a matter of rendition. Not sure if having a separate module is really worth it for that. I added this as constants in here as well (one for the filled part's length and one for the gap between dahshes), what do you think?

> 
> ::: src/mapView.js
> @@ +573,3 @@
> +            /* draw an outline by drawing a background path layer if needed
> +             * TODO: maybe we should add support for outlined path layers in
> +            let color = leg.color;
> 
> Can this TODO result in a bug on the libchamplain product and then maybe be
> removed?
> 
Yeah, sounds good! I'll file a bug!

> @@ +615,3 @@
> +            } else {
> +                start = new TransitBoardMarker.TransitBoardMarker({ leg:
> leg,
> +                routeLayer.add_node(lastPoint);
> 
> space before }

Yep
Comment 181 Marcus Lundblad 2017-02-10 21:35:13 UTC
Created attachment 345491 [details] [review]
turnPointMarker: Add support for showing markers for transit stops
Comment 182 Marcus Lundblad 2017-02-10 21:37:01 UTC
(In reply to Marcus Lundblad from comment #180)
> (In reply to Jonas Danielsson from comment #172)
> > Review of attachment 345448 [details] [review] [review] [review]:
> > 
> > Looks nice!
> > 
> > There is a lot of magic numbers tho, that seems connected with the transit
> > route style. Can they be consolidated?
> > So that we have transitLeg.XYZ_COLOR, transitLeg.DASH_STEP or similar? (I
> > dunno if transitLeg is the correct class for this) Or if we should have a
> > new module.
> 
> There's the color used for non-transit route lines (blue). I added that as a
> constant in mapView.js. So, now that color is used as a parameter to the
> _createRouteLayer() function in the non-transit case when creating a route
> line instead of dealing with that special case inside _createRouteLayer().
> This is probably cleaner, I think. Just as in the transit case, where the
> color comes from the transit data (or using a transit-specific fallback
> color). Also, I'm not sure that the dash line parameters really belongs in
> transitPlan.js, I think it's more a matter of rendition. Not sure if having
> a separate module is really worth it for that. I added this as constants in
> here as well (one for the filled part's length and one for the gap between
> dahshes), what do you think?
> 
> > 
> > ::: src/mapView.js
> > @@ +573,3 @@
> > +            /* draw an outline by drawing a background path layer if needed
> > +             * TODO: maybe we should add support for outlined path layers in
> > +            let color = leg.color;
> > 
> > Can this TODO result in a bug on the libchamplain product and then maybe be
> > removed?
> > 
> Yeah, sounds good! I'll file a bug!
> 
> > @@ +615,3 @@
> > +            } else {
> > +                start = new TransitBoardMarker.TransitBoardMarker({ leg:
> > leg,
> > +                routeLayer.add_node(lastPoint);
> > 
> > space before }
> 
> Yep

Oh, and I found a bug in my previous patch, since Clutter uses integers (0-255) for the color components, the components from the Color.parseColor needs offsetting (everyting came of black).
Comment 183 Marcus Lundblad 2017-02-10 21:43:53 UTC
(In reply to Jonas Danielsson from comment #173)
> Review of attachment 345449 [details] [review] [review]:
> 
> Nitty McNitface
> 
> ::: src/turnPointMarker.js
> @@ +89,3 @@
> +        let blue = Color.parseColor(color, 2, 0x9C);
> +
> +        let color = this._transitLeg ? this._transitLeg.color : null;
> 
> nitty, could this be:
>  
> return new Gdk.RGBA({
>     red: Color.parseColor(color, 0, 0x21),
>     green: ...
> });
Sure!

> 
> And btw, what is the hex stuff?
Actually, those are the original colors used for the turn-point marker (as the comment goes: "a GNOME:ish blue color). I made it so that these markers are kept that color for the non-transit stuff and use the transit leg color for transit. But I had hexstringyfied it before. But now changed it back to use the decimal divided by 255 notation as before (and actually the hex values where not correct here in my previous patch, as the Gdk.Color expects floating point 0.0..1.0, so it was a good nit, since I found the regression :))
Comment 184 Marcus Lundblad 2017-02-11 21:33:40 UTC
Created attachment 345540 [details] [review]
mapView: Add a view property to indicate showing a route

Adds a new boolean property that is set to true when an actual route
is rendered on the map.
This will allow only showing the print button when a transit itinerary
is "dived into".
Also rename the current "routeVisible" property to "routingOpen" to
avoid confusion, since the new property is what's set when a route is
actually rendered on the map, the former property is set when routing
is ongoing (and the routing headerbar button is pressed).
Comment 185 Marcus Lundblad 2017-02-11 21:34:13 UTC
Created attachment 345541 [details] [review]
mainWindow: Show the print button when a route is rendered

Only show the print button when a route is rendered on the map.
This way, the print button is hidden until an itinerary is selected
when in transit mode.
Also, only activate printing with the accelerator when actually showing
a route.
Comment 186 Marcus Lundblad 2017-02-11 21:38:49 UTC
(In reply to Jonas Danielsson from comment #150)
> Review of attachment 345376 [details] [review] [review]:
> 
> ::: src/mapView.js
> @@ +84,3 @@
>                                                   
> GObject.ParamFlags.WRITABLE,
> +                                                  false),
> +        /* this property is true when a route is being shown on the map */
> 
> Are the comments above the wrong way around? Or are we really bad at naming?

I have now renamed the old "routeVisible" property to "routingOpen" to reflect the toogle button being connecting to this property. And the new property is now "routeShowing" for when a route is actually rendered on the map (this will be triggering the print button now, so that printing is only enabled when selecting an individual itinerary in transit mode, this is done in a following patch).
Comment 187 Marcus Lundblad 2017-02-11 22:24:10 UTC
Created attachment 345545 [details] [review]
Add module to query an OpenTripPlanner instance

Adds an openTripPlanner module, containing functionallity for interfacing against
an OpenTripPlanner service. Also has functionallity to augment itineraries obtained
with walk routing from GraphHopper (as used by the other routing modes).

Furthermore, the transitPlan module contains interfacing classes modelling transit data

Plan:
Populated by a list of itineraries when performing a transit query.

Itinerary:
Represents one particular trip option in a search result. Contains one or more transit legs.

Leg:
Represents one distinct part of a trip, such as
"take tram #5 departuring at 10:00 from Foo Street, get off at Bar Street, arrival at 10:12".

Stop:
Represents an intermediate stop along a transit leg (a place where the vehicle stops, but
the itinerary doesn't board or alight the vehicle.
Comment 188 Marcus Lundblad 2017-02-11 22:28:57 UTC
(In reply to Jonas Danielsson from comment #145)
> Review of attachment 345371 [details] [review] [review]:
> 
> So, this all looks very nice! But it is hard for me to follow, would it be
> possible with a larger comment block on top of openTripPlanner.js that talks
> a bit about general code flow and function?
> 

Sure!
I added a comment block, I tried to explain the flow in large parts without going into details about every single function.

> ::: src/openTripPlanner.js
> @@ +449,3 @@
> +
> +            let params = { fromPlace: stops[0].id,
> +                           toPlace: stops[stops.length - 1].id };
> 
> we are stating to have a lot of this pattern, getting the last element of an
> array.
> 
> How about we add:
> 
> if (!Array.prototype.last){
>     Array.prototype.last = function(){
>         return this[this.length - 1];
>     };
> };
> 
> Somewhere? We already do String.prototype.format = Format.format; in
> application.js, not sure if that belongs there though.
> 
> Turning all those awkward constructs from stops[stops.length - 1]; to
> stops.last; is appealing.
> 
Done now, witch the aid of the new prototype added in main.js.

> @@ +702,3 @@
> +                                    duration:            route.time / 1000,
> +                                    distance:            route.distance,
> +                                    walkingInstructions: route.turnPoints
> });
> 
> I am not crazy about this formatting, but not sure if an alternative is
> better.
> Can it be de-complexed? Creating the from/to-coordinate on their own lines
> maybe?
> 
> let fromCoord = [from.place.location.latitude,
> from.place.location.longitude];
> let toCoord = [to.place.location.latitude, to.place.location.longitude];
> 
> And then the constructor will be more normal looking, and maybe we skip the
> alignment?

Yep. I did this and also elimenated the alignments. I did it an addional step by introducing temporaries for from.place.location and to.place.location to keep line lengths in check.

> 
> ::: src/transitPlan.js
> @@ +399,3 @@
> +        delete params.tripShortName;
> +
> +        this.parent();
> 
> what parent?

Fixed now by correctly chaining up params.
Comment 189 Marcus Lundblad 2017-02-12 22:04:33 UTC
Created attachment 345586 [details] [review]
Add module with time utility functions

Currently contains a function to parse an
entered time into a normalized HH:MM string
format.
Comment 190 Marcus Lundblad 2017-02-12 22:05:36 UTC
Created attachment 345587 [details] [review]
Add widget to select transit options

This is used from within the routing sidebar
when transit mode is selected.
Comment 191 Marcus Lundblad 2017-02-12 22:06:21 UTC
Created attachment 345588 [details] [review]
sidebar: Add functionallity for transit routing

Adds a new mode button (enabled when the service file
indicates an OpenTripPlanner instance, or if explicitly
pointed out via an env variable).
Adds showing transit itineraries in addition to regular
turn-by-turn-based routes, and options for transit route
search.
Comment 192 Marcus Lundblad 2017-02-12 22:13:56 UTC
(In reply to Jonas Danielsson from comment #149)
> Review of attachment 345375 [details] [review] [review]:
> 
> This looks nice! But sidebar.js is growing! Do you see anyway of breaking
> out functionality from this class?

Indeed!
I broke out the transit options "toolbar", that shows when transit is selected, into its own TransitOptionsPanel class. I also moved out the rather large function that parses the entered time into a normalized HH:MM string into a separate Time module.
> 
> ::: src/sidebar.js
> @@ +85,3 @@
> +                        'trainCheckButton',
> +                        'subwayCheckButton',
> +                        'transitParametersMenuButton',
> 
> Holy wall of widgets, Batman!

:-)
Should be a bit more manageble now, I think!

> 
> @@ +108,3 @@
> +         */
> +        this._modeTransitToggle.sensitive =
> +            Application.routingDelegator.openTripPlanner.enabled;
> 
> I wonder if this should be this._modeTransitTogge.visible = ...
> 
> Can we get Andreas opinion?

I think the consensus was to hide it, so I did that now.
> 
> @@ +515,3 @@
> +            return null;
> +        }
> +        this._transitTimeEntry.connect('activate',
> 
> This is a pure function right, maybe move to Utils or if we have a bunch of
> similar helpers, to a [something with time].js

Yep!
I moved it to a new time.js (even if it's just one function there for now, it's rather big so…)
Comment 193 Marcus Lundblad 2017-02-12 22:41:39 UTC
Created attachment 345592 [details] [review]
sidebar: Add functionallity for transit routing

Adds a new mode button (enabled when the service file
indicates an OpenTripPlanner instance, or if explicitly
pointed out via an env variable).
Adds showing transit itineraries in addition to regular
turn-by-turn-based routes, and options for transit route
search.
Comment 194 Marcus Lundblad 2017-02-12 22:43:36 UTC
(In reply to Marcus Lundblad from comment #192)
> (In reply to Jonas Danielsson from comment #149)
> > Review of attachment 345375 [details] [review] [review] [review]:
>
> > I wonder if this should be this._modeTransitTogge.visible = ...
> > 
> > Can we get Andreas opinion?
> 
> I think the consensus was to hide it, so I did that now.
> > 

I'll have to take that back. Actually it didn't work (maybe because the buttons used a linked style?), so I switched back to sensitive/insesitive for now.
Comment 195 Jonas Danielsson 2017-02-13 06:12:26 UTC
Review of attachment 345490 [details] [review]:

neat!
Comment 196 Jonas Danielsson 2017-02-13 06:14:36 UTC
Review of attachment 345491 [details] [review]:

yep
Comment 197 Jonas Danielsson 2017-02-13 06:15:00 UTC
Review of attachment 345540 [details] [review]:

ok
Comment 198 Jonas Danielsson 2017-02-13 06:15:18 UTC
Review of attachment 345541 [details] [review]:

mhm
Comment 199 Jonas Danielsson 2017-02-13 13:17:42 UTC
Review of attachment 345545 [details] [review]:

Nice!

I am not a big fan of TODO:s, can you review them and see if some of them can be turned in to bugzilla bugs instead?
Comment 200 Jonas Danielsson 2017-02-13 13:19:51 UTC
Review of attachment 345586 [details] [review]:

mis-rebase

::: src/org.gnome.Maps.src.gresource.xml
@@ -78,2 +78,4 @@
     <file>storedRoute.js</file>
     <file>togeojson/togeojson.js</file>
+    <file>time.js</file>
+    <file>transitArrivalMarker.js</file>

o_O

::: src/time.js
@@ +23,3 @@
+ * hour:min
+ * TODO: maybe try to use some library to get better locale handling,
+ * or push for something in GLib */

Could we get some example strings that this code parses here?
Comment 201 Jonas Danielsson 2017-02-13 13:20:25 UTC
Review of attachment 345587 [details] [review]:

lgtm
Comment 202 Jonas Danielsson 2017-02-13 13:23:19 UTC
Review of attachment 345592 [details] [review]:

some nits

::: src/sidebar.js
@@ +96,3 @@
+         */
+        this._transitOptionsPanel =
+        this._modeTransitToggle.sensitive =

Can this visible be set in the ui-file and this fit on one line?

@@ +232,3 @@
+            } else {
+                if (this._query.transportation ===
+                    RouteQuery.Transportation.TRANSIT) {

this break hurs me, can something be done? I think I prefer > 80 chars to this

@@ +296,3 @@
+            if (prev)
+                row.set_header(new Gtk.Separator());
+        }).bind(this));

no need to bind
Comment 203 Jonas Danielsson 2017-02-13 13:23:20 UTC
Review of attachment 345592 [details] [review]:

some nits

::: src/sidebar.js
@@ +96,3 @@
+         */
+        this._transitOptionsPanel =
+        this._modeTransitToggle.sensitive =

Can this visible be set in the ui-file and this fit on one line?

@@ +232,3 @@
+            } else {
+                if (this._query.transportation ===
+                    RouteQuery.Transportation.TRANSIT) {

this break hurs me, can something be done? I think I prefer > 80 chars to this

@@ +296,3 @@
+            if (prev)
+                row.set_header(new Gtk.Separator());
+        }).bind(this));

no need to bind
Comment 204 Marcus Lundblad 2017-02-13 14:16:13 UTC
(In reply to Jonas Danielsson from comment #202)
> Review of attachment 345592 [details] [review] [review]:
> 
> some nits
> 
> ::: src/sidebar.js
> @@ +96,3 @@
> +         */
> +        this._transitOptionsPanel =
> +        this._modeTransitToggle.sensitive =
> 
> Can this visible be set in the ui-file and this fit on one line?
> 

Something like setting sensible="False" in the UI and then:

if (Application.routingDelegator.openTripPlanner.enabled)
   this._modeTransitToggle.sensitive = true;

I guess.

> @@ +232,3 @@
> +            } else {
> +                if (this._query.transportation ===
> +                    RouteQuery.Transportation.TRANSIT) {
> 
> this break hurs me, can something be done? I think I prefer > 80 chars to
> this
> 
> @@ +296,3 @@
> +            if (prev)
> +                row.set_header(new Gtk.Separator());
> +        }).bind(this));
> 
> no need to bind
Comment 205 Marcus Lundblad 2017-02-13 20:55:12 UTC
Created attachment 345668 [details] [review]
Add module with time utility functions

Currently contains a function to parse an
entered time into a normalized HH:MM string
format.
Comment 206 Marcus Lundblad 2017-02-13 20:55:40 UTC
Created attachment 345669 [details] [review]
sidebar: Add functionallity for transit routing

Adds a new mode button (enabled when the service file
indicates an OpenTripPlanner instance, or if explicitly
pointed out via an env variable).
Adds showing transit itineraries in addition to regular
turn-by-turn-based routes, and options for transit route
search.
Comment 207 Marcus Lundblad 2017-02-13 20:57:56 UTC
(In reply to Jonas Danielsson from comment #203)
> Review of attachment 345592 [details] [review] [review]:
> 
> some nits
> 
> ::: src/sidebar.js
> @@ +96,3 @@
> +         */
> +        this._transitOptionsPanel =
> +        this._modeTransitToggle.sensitive =
> 
> Can this visible be set in the ui-file and this fit on one line?
> 
Yep. Changed to set sensitive False in the UI and then programmatically set it to true when the if-condition on .enabled is true.

> @@ +232,3 @@
> +            } else {
> +                if (this._query.transportation ===
> +                    RouteQuery.Transportation.TRANSIT) {
> 
> this break hurs me, can something be done? I think I prefer > 80 chars to
> this
> 
Yeah, it was only a couple of columns, so just moved it up.

> @@ +296,3 @@
> +            if (prev)
> +                row.set_header(new Gtk.Separator());
> +        }).bind(this));
> 
> no need to bind

Sure
Comment 208 Marcus Lundblad 2017-02-13 20:59:07 UTC
(In reply to Jonas Danielsson from comment #200)
> Review of attachment 345586 [details] [review] [review]:
> 
> mis-rebase
> 
> ::: src/org.gnome.Maps.src.gresource.xml
> @@ -78,2 +78,4 @@
>      <file>storedRoute.js</file>
>      <file>togeojson/togeojson.js</file>
> +    <file>time.js</file>
> +    <file>transitArrivalMarker.js</file>
> 
> o_O

Yeah, woops!
Should be sorted now.

> 
> ::: src/time.js
> @@ +23,3 @@
> + * hour:min
> + * TODO: maybe try to use some library to get better locale handling,
> + * or push for something in GLib */
> 
> Could we get some example strings that this code parses here?

Yep.
Added some samples of input → output pairs.
Comment 209 Jonas Danielsson 2017-02-14 06:07:30 UTC
Review of attachment 345491 [details] [review]:

mark
Comment 210 Jonas Danielsson 2017-02-14 06:17:32 UTC
Review of attachment 345668 [details] [review]:

ok
Comment 211 Jonas Danielsson 2017-02-14 06:18:36 UTC
Review of attachment 345669 [details] [review]:

lgtm
Comment 212 Marcus Lundblad 2017-02-14 21:11:37 UTC
Created attachment 345763 [details] [review]
sidebar: Add functionallity for transit routing

Adds a new mode button (enabled when the service file
indicates an OpenTripPlanner instance, or if explicitly
pointed out via an env variable).
Adds showing transit itineraries in addition to regular
turn-by-turn-based routes, and options for transit route
search.
Comment 213 Marcus Lundblad 2017-02-14 21:15:33 UTC
Since the consensus seems to be it's better to hide the transit mode button when no service is available, I updated the sidebar patch for this. Unfortunatly I couldn't get it working in the most obvious way, by setting visible = false in the template and programmatically make it visible when needed (nor the other way around), maybe some peculiarity with GtkRadioButtons and being part of a group? So, as a workaround just destroy the widget if it's not be shown (added a comment about why this was done as well)…
Comment 214 Jonas Danielsson 2017-02-15 06:06:52 UTC
Review of attachment 345763 [details] [review]:

ok
Comment 215 GNOME Infrastructure Team 2018-03-26 12:56:44 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gnome-maps/issues/25.