Page MenuHomec4science

models.ts
No OneTemporary

File Metadata

Created
Fri, Apr 26, 04:48

models.ts

// class for Everything: extended by NavigationEntity, Manuscript, Page, Word with all common properties
import {SafeUrl, ɵDomSanitizerImpl} from '@angular/platform-browser';
export class TlnEntity {
id: string; // Short id, iri in most cases
iri: string; // iri
type: string; // rdfs:type
navIndex: number;
label?: string;
constructor(id: string, iri: string, type: string, navIndex: number, label?: string) {
this.id = id;
this.iri = iri;
this.type = type;
this.navIndex = navIndex;
this.label = label;
}
}
export class TlnQueryParams {
man: string;
page: string;
row: string;
word: string;
viewMode: string;
navBarOpenState: boolean;
navTreeIndex: number;
manuscriptGroup: number;
constructor(man: string, page: string, row: string, word: string, viewMode: string, navBarOpenState: boolean, navTreeIndex: number, manuscriptGoup ) {
this.man = man;
this.page = page;
this.row = row;
this.word = word;
this.viewMode = viewMode;
this.navBarOpenState = navBarOpenState;
this.navTreeIndex = navTreeIndex;
this.manuscriptGroup = this.manuscriptGroup;
}
}
// The navigation entries in each tree for each viewtab (TlnManuscript, TlnPage, PositionalEntity) used by navigation
// TODO: add several idxes? Or choosing another order will reload all, hence there is only one idx
//
export class NavigationEntity {
idx: number;
tlnEntity: TlnEntity;
thumb?: SafeUrl; // url of image (Thumbnail)
img?: SafeUrl; // full image url
svg?: SafeUrl; // svg url
constructor(idx: number, tlnEntity: TlnEntity, thumb?: string, img?, svg?: SafeUrl ) {
this.idx = idx;
this.tlnEntity = tlnEntity;
this.thumb = thumb;
this.img = img;
this.svg = svg;
}
}
// subclass for TlnManuscript, TlnPage, Word with all common properties
export class TlnPhysicalEntity {
entity: TlnEntity;
description?: string;
image?: SafeUrl; // url of image (Thumbnail);
svg?: SafeUrl;
constructor(entity: TlnEntity, description?: string, image?: SafeUrl, svg?: SafeUrl) {
this.entity = entity;
this.description = description;
this.image = image;
this.svg = svg;
}
}
// the manuscript class
export class TlnManuscript extends TlnPhysicalEntity {
manuscriptSpec?: string;
constructor(entity: TlnEntity, description?: string, image?: SafeUrl, svg?: Svg, manuscriptSpec?: string ) {
super( entity, description, image, svg);
this.manuscriptSpec = manuscriptSpec;
}
}
// the TlnPage class
export class TlnPage extends TlnPhysicalEntity {
pageSpec?: string;
constructor(entity: TlnEntity, description?: string, image?: SafeUrl, svg?: SafeUrl, pageSpec?: string ) {
super( entity, description, image, svg);
this.pageSpec = pageSpec;
}
}
export class TlnRow extends TlnPhysicalEntity {
rowSpec?: PositionalEntity;
constructor(entity: TlnEntity, description?: string, image?: SafeUrl, svg?: Svg, rowSpec?: PositionalEntity ) {
super( entity, description, image, svg);
this.rowSpec = rowSpec;
}
}
// the TlnWord class
export class TlnWord extends TlnPhysicalEntity {
wordSpec?: PositionalEntity;
constructor(entity: TlnEntity, description?: string, image?: SafeUrl, svg?: SafeUrl, wordSpec?: PositionalEntity ) {
super( entity, description, image, svg);
this.wordSpec = wordSpec;
}
}
export class Annotation {
id: string;
text: string;
styles: Array<string>;
}
export class Svg {
id: string;
svgUrl: string;
svg?: SafeUrl;
constructor(id, svgUrl, svg?) {
this.id = id;
this.svgUrl = svgUrl;
this.svg = svg;
}
}
// Only relevant if we create an svg ourselves?
export interface PositionalEntity { // used for word rectangles as well as for line numbering
id: string;
text: string;
left: number;
top: number;
width: number;
height: number;
row?: number;
iri?: string; // TODO, change this. will be the id later when change data source to rdf ...
}
export class NavTreeIndex {
idx: number;
isActive: boolean;
label: string;
treeClass: string;
constructor( idx: number, isActive: boolean, label: string, treeClass: string ) {
this.idx = idx;
this.isActive = isActive;
this.label = label;
this.treeClass = treeClass;
}
}
export class RVPageView { // Object for "double page" view
recto: SafeUrl;
verso: SafeUrl;
constructor(recto: SafeUrl, verso: SafeUrl) {
this.recto = recto;
this.verso = verso;
}
}
export class NavTree { // a manuscript nav tree
id: number;
label: string;
entries: NavigationEntity[];
description?: string;
constructor(id: number, label: string, entries: NavigationEntity[], description?: string ) {
this.id = id;
this.label = label;
this.entries = entries;
this.description = description;
}
}
export class SubTreeSelectionDef {
id: number;
label: string;
description: string;
constructor( id: number, label: string, description: string) {
this.id = id;
this.description = description;
this.label = label;
}
}
export class NavTreeDef {
id: number;
label: string;
description: string;
isActive: boolean;
subTreeLabel?: string;
subTrees?: SubTreeDef[];
constructor(id: number, label: string, description: string, isActive: boolean, subTreeLabel?: string, subTrees?: SubTreeDef[]) {
this.id = id;
this.label = label;
this.description = description;
this.isActive = isActive;
this.subTreeLabel = subTreeLabel;
this.subTrees = subTrees;
}
}
export class SubTreeDef extends SubTreeSelectionDef {
apiDef: ApiDef;
constructor( id: number, label: string, description: string, apiDef: ApiDef) {
super( id, label, description );
this.id = id;
this.description = description;
this.label = label;
this.apiDef = apiDef;
}
}
export class ApiDef {
baseApi: string;
query?: string;
posFilterIds?: string[]; // positive Filter ids: only these id's should be loaded into manuscript nav tree
constructor( baseApi: string, query?: string, posFilterIds?: string[]) {
this.baseApi = baseApi;
this.query = query;
this.posFilterIds = posFilterIds;
}
}

Event Timeline