コード例 #1
0
        public static double ToDouble(this DmsPoint point)
        {
            if (point == null)
            {
                return(default(double));
            }
            var result = (double)Math.Abs(point.Degrees) + (double)point.Minutes / (double)60 + (double)point.Seconds / (double)3600;

            if (point.Degrees < 0)
            {
                return(result * (double)-1);
            }
            return(result);
        }
コード例 #2
0
        public DmsLocation ExtractDmsLocation(Dictionary <string, string> exifInfo)
        {
            exifInfo.TryGetValue(ExifTagNames.GPSLatitude, out string latInfo);
            exifInfo.TryGetValue(ExifTagNames.GPSLatitudeRef, out string latRef);
            exifInfo.TryGetValue(ExifTagNames.GPSLongitude, out string longInfo);
            exifInfo.TryGetValue(ExifTagNames.GPSLongitudeRef, out string longRef);

            if (!string.IsNullOrWhiteSpace(latInfo) &&
                !string.IsNullOrWhiteSpace(latRef) &&
                !string.IsNullOrWhiteSpace(longInfo) &&
                !string.IsNullOrWhiteSpace(longRef))
            {
                var lat = DmsPoint.ParseFromGps(latInfo, PointType.Lat, latRef);
                var lon = DmsPoint.ParseFromGps(longInfo, PointType.Lon, longRef);
                if (lat != null && lon != null)
                {
                    return(new DmsLocation(lat, lon));
                }
            }

            return(null);
        }
コード例 #3
0
 public DmsLocation(DmsPoint latitude, DmsPoint longitude)
 {
     Latitude  = latitude;
     Longitude = longitude;
 }