mirror of
https://github.com/xuthus83/pigallery2.git
synced 2024-11-03 21:04:03 +08:00
improving position visualisation
This commit is contained in:
parent
5da852b711
commit
4a96d2a0f9
@ -40,12 +40,7 @@ export const diskManagerTask = (input: DiskManagerTask.PoolInput, done) => {
|
||||
const metadata: PhotoMetadata = <PhotoMetadata>{
|
||||
keywords: {},
|
||||
cameraData: {},
|
||||
positionData: {
|
||||
GPSData: {},
|
||||
country: null,
|
||||
state: null,
|
||||
city: null
|
||||
},
|
||||
positionData: null,
|
||||
size: {},
|
||||
creationDate: {}
|
||||
};
|
||||
@ -63,12 +58,14 @@ export const diskManagerTask = (input: DiskManagerTask.PoolInput, done) => {
|
||||
focalLength: exif.tags.FocalLength,
|
||||
lens: exif.tags.LensModel,
|
||||
};
|
||||
metadata.positionData.GPSData = <GPSMetadata> {
|
||||
latitude: exif.tags.GPSLatitude,
|
||||
longitude: exif.tags.GPSLongitude,
|
||||
altitude: exif.tags.GPSAltitude
|
||||
|
||||
};
|
||||
if (!isNaN(exif.tags.GPSLatitude) || exif.tags.GPSLongitude || exif.tags.GPSAltitude) {
|
||||
metadata.positionData = metadata.positionData || {};
|
||||
metadata.positionData.GPSData = <GPSMetadata> {
|
||||
latitude: exif.tags.GPSLatitude,
|
||||
longitude: exif.tags.GPSLongitude,
|
||||
altitude: exif.tags.GPSAltitude
|
||||
};
|
||||
}
|
||||
|
||||
metadata.size = <ImageSize> {width: exif.imageSize.width, height: exif.imageSize.height};
|
||||
} catch (err) {
|
||||
@ -89,9 +86,12 @@ export const diskManagerTask = (input: DiskManagerTask.PoolInput, done) => {
|
||||
return s.join("");
|
||||
};
|
||||
|
||||
metadata.positionData.country = iptcData.country_or_primary_location_name;
|
||||
metadata.positionData.state = iptcData.province_or_state;
|
||||
metadata.positionData.city = iptcData.city;
|
||||
if (iptcData.country_or_primary_location_name || iptcData.province_or_state || iptcData.city) {
|
||||
metadata.positionData = metadata.positionData || {};
|
||||
metadata.positionData.country = iptcData.country_or_primary_location_name;
|
||||
metadata.positionData.state = iptcData.province_or_state;
|
||||
metadata.positionData.city = iptcData.city;
|
||||
}
|
||||
|
||||
|
||||
metadata.keywords = <string[]> (iptcData.keywords || []).map((s: string) => decode(s));
|
||||
|
@ -11,7 +11,7 @@
|
||||
<gallery-directory *ngFor="let directory of directories"
|
||||
[directory]="directory"></gallery-directory>
|
||||
|
||||
<gallery-map [photos]="_galleryService.content.value.directory.photos"></gallery-map>
|
||||
<gallery-map *ngIf="isPhotoWithLocation" [photos]="_galleryService.content.value.directory.photos"></gallery-map>
|
||||
<gallery-grid [photos]="_galleryService.content.value.directory.photos" [lightbox]="lightbox"></gallery-grid>
|
||||
</div>
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
<gallery-map [photos]="_galleryService.content.value.searchResult.photos"></gallery-map>
|
||||
<gallery-map *ngIf="isPhotoWithLocation" [photos]="_galleryService.content.value.searchResult.photos"></gallery-map>
|
||||
|
||||
<div *ngFor="let directory of directories">
|
||||
<gallery-directory *ngIf="directory" [directory]="directory"></gallery-directory>
|
||||
|
@ -7,6 +7,7 @@ import {GallerySearchComponent} from "./search/search.gallery.component";
|
||||
import {SearchTypes} from "../../../common/entities/AutoCompleteItem";
|
||||
import {Config} from "../../../common/config/public/Config";
|
||||
import {DirectoryDTO} from "../../../common/entities/DirectoryDTO";
|
||||
import {SearchResultDTO} from "../../../common/entities/SearchResult";
|
||||
|
||||
@Component({
|
||||
selector: 'gallery',
|
||||
@ -20,6 +21,7 @@ export class GalleryComponent implements OnInit {
|
||||
|
||||
public showSearchBar: boolean = true;
|
||||
public directories: DirectoryDTO[] = [];
|
||||
public isPhotoWithLocation = false;
|
||||
|
||||
constructor(public _galleryService: GalleryService,
|
||||
private _authService: AuthenticationService,
|
||||
@ -39,8 +41,23 @@ export class GalleryComponent implements OnInit {
|
||||
const dirSorter = (a: DirectoryDTO, b: DirectoryDTO) => {
|
||||
return a.name.localeCompare(b.name);
|
||||
};
|
||||
const dirs = <DirectoryDTO[]>(content.searchResult || content.directory || {directories: []}).directories;
|
||||
this.directories = dirs.sort(dirSorter);
|
||||
|
||||
const tmp = <DirectoryDTO | SearchResultDTO>(content.searchResult || content.directory || {
|
||||
directories: [],
|
||||
photos: []
|
||||
});
|
||||
this.directories = tmp.directories.sort(dirSorter);
|
||||
this.isPhotoWithLocation = false;
|
||||
for (let i = 0; i < tmp.photos.length; i++) {
|
||||
if (tmp.photos[i].metadata &&
|
||||
tmp.photos[i].metadata.positionData &&
|
||||
tmp.photos[i].metadata.positionData.GPSData &&
|
||||
tmp.photos[i].metadata.positionData.GPSData.longitude
|
||||
) {
|
||||
this.isPhotoWithLocation = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this._route.params
|
||||
@ -72,6 +89,7 @@ export class GalleryComponent implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
|
||||
onLightboxLastElement() {
|
||||
this.grid.renderARow();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user