LCOV - code coverage report
Current view: top level - model - location.dart (source / functions) Hit Total Coverage
Test: coverage.lcov Lines: 10 10 100.0 %
Date: 2017-10-11 06:51:59 Functions: 0 0 -

          Line data    Source code
       1             : import 'package:great_circle_distance/great_circle_distance.dart';
       2             : 
       3             : import 'coordinate.dart';
       4             : 
       5             : class Location extends Coordinate implements Comparable<Location> {
       6             :     DateTime timestamp;
       7             : 
       8             :     Location({latitude, longitude, this.timestamp})
       9           3 :         : super(latitude: latitude, longitude: longitude);
      10             : 
      11             :     Location.fromDegrees({double latitude, double longitude, DateTime timestamp})
      12             :     : this.timestamp = timestamp,
      13           9 :       super(latitude: new LocationDegrees(degrees: latitude), longitude :new LocationDegrees(degrees: longitude));
      14             : 
      15             :     Duration timeDifference({Location location})  {
      16           3 :         return this.timestamp.difference(location.timestamp);
      17             :     }
      18             : 
      19             :     double distanceTo(Location location) {
      20           2 :         GreatCircleDistance greatCircle = new GreatCircleDistance.fromDegrees(
      21           4 :             latitude1: this.latitude.degrees,
      22           4 :             longitude1: this.longitude.degrees,
      23           4 :             latitude2: location.latitude.degrees,
      24           4 :             longitude2: location.longitude.degrees
      25             :         );
      26           2 :         return greatCircle.vincentyDistance();
      27             :     }
      28             : 
      29             :     /**
      30             :      * Compares this Location to [other], returning zero if the values are equal.
      31             :      *
      32             :      * Returns a negative integer if this `Location` is shorter than
      33             :      * [other], or a positive integer if it is longer.
      34             :      *
      35             :      * A negative `Location` is always considered shorter than a positive one.
      36             :      *
      37             :      */
      38          33 :     int compareTo(Location other) => this.latitude.degrees.compareTo(other.latitude.degrees) | this.longitude.degrees.compareTo(other.longitude.degrees);
      39             : }

Generated by: LCOV version 1.13