-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Nearest stations, prepare spatial indexing. - Next departures. - Active trips.
- Loading branch information
Showing
14 changed files
with
302 additions
and
71 deletions.
There are no files selected for viewing
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
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
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
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
36 changes: 0 additions & 36 deletions
36
src/main/java/ch/naviqore/gtfs/schedule/model/GtfsScheduleDay.java
This file was deleted.
Oops, something went wrong.
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
31 changes: 31 additions & 0 deletions
31
src/main/java/ch/naviqore/gtfs/schedule/spatial/Coordinate.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package ch.naviqore.gtfs.schedule.spatial; | ||
|
||
import lombok.EqualsAndHashCode; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.ToString; | ||
|
||
@RequiredArgsConstructor | ||
@EqualsAndHashCode | ||
@ToString | ||
public class Coordinate { | ||
|
||
private static final int EARTH_RADIUS = 6371000; | ||
private final double latitude; | ||
private final double longitude; | ||
|
||
/** | ||
* Calculates the distance to another Coordinates object using the Haversine formula. | ||
* | ||
* @param other The other Coordinates object to calculate the distance to. | ||
* @return The distance in meters. | ||
*/ | ||
public double distanceTo(Coordinate other) { | ||
double latDistance = Math.toRadians(other.latitude - this.latitude); | ||
double lonDistance = Math.toRadians(other.longitude - this.longitude); | ||
double a = Math.sin(latDistance / 2) * Math.sin(latDistance / 2) + Math.cos( | ||
Math.toRadians(this.latitude)) * Math.cos(Math.toRadians(other.latitude)) * Math.sin( | ||
lonDistance / 2) * Math.sin(lonDistance / 2); | ||
double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); | ||
return EARTH_RADIUS * c; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package ch.naviqore.gtfs.schedule.spatial; | ||
|
||
public class KdTree { | ||
// TODO: Implement KdTree | ||
} |
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
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
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
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
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
Oops, something went wrong.