1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00
pigallery2/common/entities/PhotoDTO.ts

61 lines
1.3 KiB
TypeScript
Raw Normal View History

import {DirectoryDTO} from './DirectoryDTO';
2016-12-28 03:55:51 +08:00
export interface PhotoDTO {
id: number;
name: string;
directory: DirectoryDTO;
metadata: PhotoMetadata;
readyThumbnails: Array<number>;
readyIcon: boolean;
2016-12-28 03:55:51 +08:00
}
export interface PhotoMetadata {
keywords: Array<string>;
cameraData: CameraMetadata;
positionData: PositionMetaData;
size: ImageSize;
creationDate: number;
fileSize: number;
2016-12-28 03:55:51 +08:00
}
export interface ImageSize {
width: number;
height: number;
2016-12-28 03:55:51 +08:00
}
export interface CameraMetadata {
ISO?: number;
model?: string;
2017-07-11 04:00:22 +08:00
make?: string;
fStop?: number;
exposure?: number;
focalLength?: number;
lens?: string;
2016-12-28 03:55:51 +08:00
}
export interface PositionMetaData {
GPSData?: GPSMetadata;
country?: string;
state?: string;
city?: string;
2016-12-28 03:55:51 +08:00
}
export interface GPSMetadata {
latitude?: number;
longitude?: number;
2017-07-19 05:27:14 +08:00
altitude?: number;
2018-05-14 04:59:57 +08:00
}
2016-12-28 03:55:51 +08:00
2018-05-14 04:59:57 +08:00
export module PhotoDTO {
export const hasPositionData = (photo: PhotoDTO): boolean => {
return !!photo.metadata.positionData &&
!!(photo.metadata.positionData.city ||
photo.metadata.positionData.state ||
photo.metadata.positionData.country ||
(photo.metadata.positionData.GPSData &&
photo.metadata.positionData.GPSData.altitude &&
photo.metadata.positionData.GPSData.latitude &&
photo.metadata.positionData.GPSData.longitude));
};
}