Ejemplo n.º 1
0
        public Album GetLocationAlbum(int locationId)
        {
            var location = _locationService.GetLocation(locationId);
            var sections = BuildFromLocation(locationId);

            return(new Album(location.DisplayName, sections));
        }
Ejemplo n.º 2
0
        private void GetLocationForPhoto(FileExtendedInfo finfo, Photo photo)
        {
            if (finfo.ExifInfo != null && finfo.ExifInfo.GPS_Latitude.HasValue && finfo.ExifInfo.GPS_Longitude.HasValue)
            {
                photo.Position = new GeoPosition(finfo.ExifInfo.GPS_Latitude.Value, finfo.ExifInfo.GPS_Longitude.Value);

                photo.Location = _locationService.GetLocation(photo.Position);

                if (photo.Location != null)
                {
                    photo.DebugInfo      += "LocFromPos" + ";";
                    photo.PositionFromGps = CheckForValidGeoPosition(photo);

                    var place = _locationService.GetNearbyPlace(photo.Position, photo.Location.Id);

                    photo.PlaceId = place?.Id ?? 0;
                }
            }

            if (photo.Location == null && _lastBuildedPhoto?.Location != null &&
                (_locationService.GetSearchPath(photo.PhotoUrl) == _locationService.GetSearchPath(_lastBuildedPhoto.PhotoUrl)) &&
                ((photo.Creation.DayOfYear - _lastBuildedPhoto.Creation.DayOfYear) <= 3)
                )
            {   // No GPS info nut photo has same search path as previous...
                photo.Location        = _lastBuildedPhoto.Location;
                photo.Position        = photo.Location.Position;
                photo.PositionFromGps = false;

                photo.DebugInfo += "LocFromPhoto" + _lastBuildedPhoto.Id + ";";
            }

            if (photo.Location == null)
            {
                photo.DebugInfo += "FromPath" + ";";
                photo.Location   = _locationService.GetLocation(finfo.RelativePath);

                if (photo.Location != null)
                {
                    photo.DebugInfo += "LocFromPath" + ";";
                }
            }
        }
Ejemplo n.º 3
0
        public Location FindPhotoLocation(FileExtendedInfo finfo)
        {
            Location location = null;

            if (finfo.ExifInfo == null)
            {
                return(null);
            }

            if (finfo.ExifInfo.GPS_Latitude.HasValue && finfo.ExifInfo.GPS_Longitude.HasValue)
            {
                var position = new GeoPosition(finfo.ExifInfo.GPS_Latitude.Value, finfo.ExifInfo.GPS_Longitude.Value);

                location = _locationService.GetLocation(position);
            }

            if (location == null)
            {
                location = _locationService.GetLocation(finfo.RelativePath);
            }

            return(location);
        }