Skip to content

Commit

Permalink
Merge pull request #173 from timroesner/172-modify-coordinates
Browse files Browse the repository at this point in the history
Modify coordinates
  • Loading branch information
DennisLee authored May 11, 2019
2 parents deb15c0 + e3192a5 commit 5457c9e
Show file tree
Hide file tree
Showing 12 changed files with 114 additions and 146 deletions.
4 changes: 2 additions & 2 deletions BayPass.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@
6A009197217EAF800087A32B /* Pass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Pass.swift; sourceTree = "<group>"; };
6A009199217EAFFE0087A32B /* Ticket.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Ticket.swift; sourceTree = "<group>"; };
6A0A9BE92256F6C60093CA57 /* Array.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Array.swift; sourceTree = "<group>"; };
6A0A9BEF225734B50093CA57 /* Coordinates.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Coordinates.swift; sourceTree = "<group>"; };
6A0A9BEF225734B50093CA57 /* Coordinates.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = Coordinates.swift; path = ../Coordinates.swift; sourceTree = "<group>"; };
6A0ED235217BFA4B003CD497 /* MapAnnotation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = MapAnnotation.swift; path = BayPass/Model/Map/MapAnnotation.swift; sourceTree = SOURCE_ROOT; };
6A18FDBA2235AFB7002047B9 /* HereTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HereTests.swift; sourceTree = "<group>"; };
6A221D6B224DB37A00A36175 /* System.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = System.swift; path = ../../System.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -666,6 +666,7 @@
6A0ED235217BFA4B003CD497 /* MapAnnotation.swift */,
6A221D6B224DB37A00A36175 /* System.swift */,
6AB22BEA225FF05E0073F023 /* SystemCoordinates.swift */,
6A0A9BEF225734B50093CA57 /* Coordinates.swift */,
);
path = Map;
sourceTree = "<group>";
Expand All @@ -686,7 +687,6 @@
children = (
6A009191217EAD580087A32B /* Map */,
6A009194217EAF090087A32B /* Ticket */,
6A0A9BEF225734B50093CA57 /* Coordinates.swift */,
22B40EFB225815B5009520C6 /* PaymentMethod.swift */,
226DAA9F2266FFDE00B10E20 /* UserManager.swift */,
);
Expand Down
2 changes: 1 addition & 1 deletion BayPass/APIs/GMParseToGTFS.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ struct Parse {
"Powell Street Station": "Powell St.",
"Richmond Station": "Richmond",
"Rockridge Station": "Rockridge",
// "San Bruno",
"San Bruno Station": "San Bruno",
"San Francisco International Airport Station": "San Francisco International Airport",
"San Leandro Station": "San Leandro",
"South Hayward BART Station": "South Hayward",
Expand Down
10 changes: 7 additions & 3 deletions BayPass/APIs/Here.swift
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,19 @@ class Here {
func parseLine(from json: [String : Any]) -> Line? {
guard let lineName = json["name"] as? String,
let lineDestination = json["dir"] as? String,
let at = json["At"] as? [String: Any],
let modeNum = json["mode"] as? Int
else { return nil }
else {
print("Could not parse line json: \(json)")
return nil
}

var colorString = at["color"] as? String ?? ""
let at = json["At"] as? [String: Any]
var colorString = at?["color"] as? String ?? ""
if colorString == "#FEF0B5" || colorString == "#FFFF33" {
colorString = "#F3B43F"
}
let color = UIColor(hex: Int(colorString.dropFirst(), radix: 16) ?? 0x4A90E2)

let transitMode = transitModeConvert(num: modeNum)
let ag = Agency.zero

Expand Down
5 changes: 4 additions & 1 deletion BayPass/Controller/Map/MVCStationOverview.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ extension MapViewController {
bottomSheet.moveOverlay(toNotchAt: 0, animated: true)
mapView.removeAnnotations(mapView.annotations)

mapView.addAnnotation(MapAnnotation(fromStation: station))
let stationAnnotation = MapAnnotation(fromStation: station)
mapView.addAnnotation(stationAnnotation)
mapView.selectAnnotation(stationAnnotation, animated: true)

let insets = UIEdgeInsets(top: 0, left: view.frame.width/2, bottom: 0, right: 0)
let rect = MKMapRect(origin: MKMapPoint(station.location.coordinate), size: MKMapSize(width: 3000, height: 3000))
mapView.setVisibleMapRect(rect, edgePadding: insets, animated: true)
Expand Down
1 change: 1 addition & 0 deletions BayPass/Controller/Map/SearchViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class SearchViewController: UIViewController {

view.backgroundColor = UIColor.white
view.layer.cornerRadius = 21
view.layer.applySketchShadow(color: .black, alpha: 0.20, x: 6, y: 6, blur: 25, spread: 5)
setupViews()
}

Expand Down
22 changes: 0 additions & 22 deletions BayPass/Controller/TIcketDetailViewController.swift

This file was deleted.

3 changes: 3 additions & 0 deletions BayPass/Controller/Ticket/TicketDetailViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,13 @@ class TicketDetailViewController: UIViewController {
view.addSubview(typeInfoLb)
typeInfoLb.text = ticket?.name ?? pass?.name
typeInfoLb.textColor = UIColor.black
typeInfoLb.numberOfLines = 0
typeInfoLb.textAlignment = .center
typeInfoLb.font = UIFont.systemFont(ofSize: 26, weight: .bold)
typeInfoLb.snp.makeConstraints { (make) -> Void in
make.centerX.equalTo(typeLb.snp.centerX)
make.top.equalTo(typeLb.snp.bottom).offset(10)
make.left.right.equalToSuperview().inset(20)
}
}

Expand Down
2 changes: 1 addition & 1 deletion BayPass/Extensions/UIColor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ extension UIColor {
func isLight() -> Bool {
guard let components = cgColor.components, components.count > 2 else {return false}
let brightness = ((components[0] * 299) + (components[1] * 587) + (components[2] * 114)) / 1000
return (brightness > 0.5)
return (brightness > 0.65)
}

// https://stackoverflow.com/a/38435309/10458607
Expand Down
4 changes: 2 additions & 2 deletions BayPass/Model/Coordinates.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ struct Coordinates {
var radius: Int
var max: Int

init(center: CLLocationCoordinate2D, radius: Int, max: Int) {
self.center = center
init(latitude: Double, longitude: Double, radius: Int, max: Int) {
self.center = CLLocationCoordinate2D(latitude: latitude, longitude: longitude)
self.radius = radius
self.max = max
}
Expand Down
4 changes: 2 additions & 2 deletions BayPass/System.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class System {
group.enter()
here.getStationsNearby(center: c.center, radius: c.radius, max: c.max) { stations in
for station in stations {
if var stationThatsAlreadyThere = self.allStationsDict[station.name] {
stationThatsAlreadyThere.lines.append(contentsOf: station.lines)
if self.allStationsDict[station.name] != nil {
self.allStationsDict[station.name]?.lines.append(contentsOf: station.lines)
} else {
self.allStationsDict[station.name] = station
}
Expand Down
Loading

0 comments on commit 5457c9e

Please sign in to comment.