Page MenuHomec4science

models.ts
No OneTemporary

File Metadata

Created
Sat, May 4, 23:56

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;
navBarOpenState: boolean;
navTreeIndex: number;
constructor(man: string, page: string, row: string, word: string, navBarOpenState: boolean, navTreeIndex: number ) {
this.man = man;
this.page = page;
this.word = word;
this.navBarOpenState = navBarOpenState;
this.navTreeIndex = navTreeIndex;
}
}
// 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;
img?: SafeUrl; // url of image (Thumbnail)
constructor(idx: number, tlnEntity: TlnEntity, img?: string ) {
this.idx = idx;
this.img = img; // iri of image for passing
this.tlnEntity = tlnEntity;
}
}
// subclass for TlnManuscript, TlnPage, Word with all common properties
export class TlnPhysicalEntity {
entity: TlnEntity;
description?: string;
image?: Image;
svg?: Svg;
constructor(entity: TlnEntity, description?: string, image?: Image, svg?: Svg) {
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?: Image, 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?: Image, svg?: Svg, pageSpec?: string ) {
super( entity, description, image, svg);
this.pageSpec = pageSpec;
}
}
export class TlnRow extends TlnPhysicalEntity {
rowSpec?: PositionalEntity;
constructor(entity: TlnEntity, description?: string, image?: Image, 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?: Image, svg?: Svg, wordSpec?: PositionalEntity ) {
super( entity, description, image, svg);
this.wordSpec = wordSpec;
}
}
export class Annotation {
id: string;
text: string;
styles: Array<string>;
}
export class Image {
id: string;
imageUrl: string;
thumbnailUrl: string;
}
export class Svg {
id: string;
svgUrl: string;
binaryValue?: string;
constructor(id, svgUrl, binaryValue?) {
this.id = id;
this.svgUrl = svgUrl;
this.binaryValue = this.binaryValue;
}
}
// 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 NavTree {
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;
}
}

Event Timeline