This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<PatternItem> pattern = Arrays.asList(new Dot(), new Gap(20)); | |
PolylineOptions options = new PolylineOptions().pattern(pattern); | |
map.addPolyline(options); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let strokeStyles = [GMSStrokeStyle.solidColor(.black), GMSStrokeStyle.solidColor(.clear)] | |
let strokeLengths = [NSNumber(value: 10), NSNumber(value: 10)] | |
if let path = polyline.path { | |
polyline.spans = GMSStyleSpans(path, strokeStyles, strokeLengths, .rhumb) | |
} | |
polyline.map = mapView |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
guard let path = polyline.path else { | |
return | |
} | |
mapView.clear() | |
let intervalDistanceIncrement: CGFloat = 10 | |
let circleRadiusScale = 1 / mapView.projection.points(forMeters: 1, at: mapView.camera.target) | |
var previousCircle: GMSCircle? | |
for coordinateIndex in 0 ..< path.count() - 1 { | |
let startCoordinate = path.coordinate(at: coordinateIndex) | |
let endCoordinate = path.coordinate(at: coordinateIndex + 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func mapView(_ mapView: GMSMapView, didChange position: GMSCameraPosition) { | |
set(polyline: polyline, on: mapView) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private let polyline = GMSPolyline(path: GMSPath(fromEncodedPath: "{dq_IowzpAzkAbhF")) | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
mapView.delegate = self | |
set(polyline: polyline, on: mapView) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for coordinateIndex in 0 ..< path.count() - 1 { | |
let startCoordinate = path.coordinate(at: coordinateIndex) | |
let endCoordinate = path.coordinate(at: coordinateIndex + 1) | |
let startLocation = CLLocation(latitude: startCoordinate.latitude, longitude: startCoordinate.longitude) | |
let endLocation = CLLocation(latitude: endCoordinate.latitude, longitude: endCoordinate.longitude) | |
let pathDistance = endLocation.distance(from: startLocation) | |
let intervalLatIncrement = (endLocation.coordinate.latitude - startLocation.coordinate.latitude) / pathDistance | |
let intervalLngIncrement = (endLocation.coordinate.longitude - startLocation.coordinate.longitude) / pathDistance | |
for intervalDistance in 0 ..< Int(pathDistance) { | |
let intervalLat = startLocation.coordinate.latitude + (intervalLatIncrement * Double(intervalDistance)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if let previousCircle = previousCircle { | |
let circleLocation = CLLocation(latitude: circleCoordinate.latitude, | |
longitude: circleCoordinate.longitude) | |
let previousCircleLocation = CLLocation(latitude: previousCircle.position.latitude, | |
longitude: previousCircle.position.longitude) | |
if mapView.projection.points(forMeters: circleLocation.distance(from: previousCircleLocation), | |
at: mapView.camera.target) < intervalDistanceIncrement { | |
continue | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe("route to result card header component view model mapper test") { | |
context("when the route is a walking route") { | |
let route = Route.mockWalkingRoute | |
let departureDate = (route.segments?.first?.stops?.first?.scheduledDate)! | |
context("when the route is in less than 15 minutes") { | |
let currentDate = calendar.date(byAdding: .minute, value: -14, to: departureDate)! | |
let model = mapper.resultCardHeaderComponentViewModel(for: route, currentDate: currentDate) | |
it("returns a route type string for walking") { | |
expect(model.routeType).to(equal("Walk")) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
view = MockPlannerMapView() | |
stub(view) { stub in | |
when(stub.setPolygons(with: any())).thenDoNothing() | |
when(stub.changeHintViewToOrigin()).thenDoNothing() | |
when(stub.makeTimeBubbleVisible()).thenDoNothing() | |
when(stub.makeTimeBubbleInvisible()).thenDoNothing() | |
when(stub.expandTimeBubble(withSearchModeText: anyString(), | |
andDateText: anyString(), | |
animated: any(Bool.self))) | |
.thenDoNothing() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
verify(view).expandTimeBubble(withSearchModeText: "Arrive: ", | |
andDateText: "Wed, 00:00", | |
animated: true) |
OlderNewer