import { Render } from '../Render/Render' ; import { Point } from '../BasicTypes' ; /**
 * State of the page on the basis of which rendering
 */ export interface PageState { /** Page rotation angle */ angle : number ; /** Page scope */ area : Point [ ] ; /** Page position */ position : Point ; /** Rotate angle for hard pages */ hardAngle : number ; /** Rotate angle for hard pages at renedering time */ hardDrawingAngle : number ; } export const enum PageOrientation { /** Left side page */ LEFT , /** Right side page */ RIGHT } export const enum PageDensity { SOFT = 'soft' , HARD = 'hard' } /**
 * Class representing a book page
 */ export abstract class Page { /** State of the page on the basis of which rendering */ protected state : PageState ; /** Render object */ protected render : Render ; /** Page Orientation */ protected orientation : PageOrientation ; /** Density at creation */ protected createdDensity : PageDensity ; /** Density at the time of rendering (Depends on neighboring pages) */ protected nowDrawingDensity : PageDensity ; protected constructor ( render , density ) { this . state = { angle : 0 , area : [ ] , position : { x : 0 , y : 0 } , hardAngle : 0 , hardDrawingAngle : 0 , } ; this . createdDensity = density ; this . nowDrawingDensity = this . createdDensity ; this . render = render ; } param { PageOrientation } orient public abstract simpleDraw ( orient ) ; param { PageDensity } tempDensity public abstract draw ( tempDensity ? ) ; /**
     * Page loading
     */ public abstract load ( ) ; param { PageDensity } density public setDensity ( density ) { this . createdDensity = density ; this . nowDrawingDensity = density ; } param { PageDensity } density public setDrawingDensity ( density ) { this . nowDrawingDensity = density ; } param { Point } pagePos public setPosition ( pagePos ) { this . state . position = pagePos ; } param { number } angle public setAngle ( angle ) { this . state . angle = angle ; } param { Point [ ] } area public setArea ( area ) { this . state . area = area ; } param { number } angle public setHardDrawingAngle ( angle ) { this . state . hardDrawingAngle = angle ; } param { number } angle public setHardAngle ( angle ) { this . state . hardAngle = angle ; this . state . hardDrawingAngle = angle ; } param { PageOrientation } orientation public setOrientation ( orientation ) { this . orientation = orientation ; } /**
     * Get temp page density
     */ public getDrawingDensity ( ) { return this . nowDrawingDensity ; } /**
     * Get a constant page density
     */ public getDensity ( ) { return this . createdDensity ; } /**
     * Get rotate angle for hard pages
     */ public getHardAngle ( ) { return this . state . hardAngle ; } public abstract newTemporaryCopy ( ) ; public abstract getTemporaryCopy ( ) ; public abstract hideTemporaryCopy ( ) ; }