Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add buildings extrusion example. #71

Merged
merged 11 commits into from
Aug 26, 2020

Conversation

MaximAlien
Copy link
Contributor

Closing #70.

Depends on work being done in #2535.

@MaximAlien MaximAlien added the improvement Improvement for an existing feature. label Aug 13, 2020
@MaximAlien MaximAlien added this to the v1.0.0 milestone Aug 13, 2020
@MaximAlien MaximAlien self-assigned this Aug 13, 2020
Copy link
Contributor

@Udumft Udumft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found some not critical points but also I could not build the project after clean checkout. pod install --repo-update modifies Navigation=Examples.xcodeproj/project.pbxproj and the build itself fails with Pods-Navigation-Examples-artifacts.sh file missing in Scripts Build Phase.

return routes?.first
}
set {
guard let selected = newValue else { routes?.remove(at: 0); return }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This creates unexpected behavior:

self.currentRoute = nil
if self.current.route == nil { // will be true if there were at least 2 `routes`
// ...

I suggest

Suggested change
guard let selected = newValue else { routes?.remove(at: 0); return }
guard let selected = newValue else { routes = nil; return }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Latest update should resolve this issue too.

Comment on lines 126 to 129
func changeToNightStyle() {
mapView?.style?.transition = MGLTransition(duration: 1.0, delay: 1.0)
mapView?.styleURL = MGLStyle.navigationNightStyleURL
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe something like toggleDayNightStyles() would be more functional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, added toggle between Day and Night styles.

// MARK: - MGLMapViewDelegate methods

func mapView(_ mapView: MGLMapView, didFinishLoading style: MGLStyle) {
removeRoutes()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we want to remove routes when style is updated?
Also, this case creates inconsistency: removeRoutes() cleans routes display on the map, but it does not clean the routes array, which remains populated and thus startNavigation() will still run. I suggest calling routes = nil instead if we need to clean routes on style change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was mainly done to have the ability to see whether dynamic changes in style cause any issues with routes, waypoints etc. For now such changes cause issue described here. I'll remove this delegate method once we have fix for it, on the other had I'll keep the ability to change styles. I think with new update inconsistency with storing routes data should be fixed.


var routes: [Route]? {
didSet {
guard let routes = routes, let current = routes.first else { mapView?.removeRoutes(); return }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to call removeRoutes() instead

Suggested change
guard let routes = routes, let current = routes.first else { mapView?.removeRoutes(); return }
guard let routes = routes, let current = routes.first else { removeRoutes(); return }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think it was handled in most recent update.

@MaximAlien
Copy link
Contributor Author

MaximAlien commented Aug 13, 2020

Found some not critical points but also I could not build the project after clean checkout. pod install --repo-update modifies Navigation=Examples.xcodeproj/project.pbxproj and the build itself fails with Pods-Navigation-Examples-artifacts.sh file missing in Scripts Build Phase.

Just did clean clone like this:

$ git clone --branch maxim/70-building-extrusion-example [email protected]:mapbox/navigation-ios-examples.git
$ cd navigation-ios-examples
$ pod install --repo-update

and able to build the project. Build job is also passing on CircleCI. Maybe it's related to your local repo state? I can also see that Pods-Navigation-Examples-artifacts.sh is present.

@MaximAlien MaximAlien requested a review from Udumft August 19, 2020 00:40
Comment on lines +95 to +101
let actions: [(String, UIAlertAction.Style, ActionHandler?)] = [
("Start Navigation", .default, startNavigation),
("Toggle Day/Night Style", .default, toggleDayNightStyle),
("Unhighlight Buildings", .default, unhighlightBuildings),
("Remove Routes", .default, removeRoutes),
("Cancel", .cancel, nil)
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example is fairly unusual in that it combines several different actions, but it is more straightforward this way than multiple examples that overlap in various ways.

@MaximAlien MaximAlien merged commit 881b2c2 into release-v1.0 Aug 26, 2020
@MaximAlien MaximAlien deleted the maxim/70-building-extrusion-example branch August 26, 2020 19:47
@MaximAlien MaximAlien linked an issue Sep 2, 2020 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improvement for an existing feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create building extrusion example.
3 participants