/** * TRP classes for objects describing geometry (of e.g. words, text lines, tables) on the page */ import { ApiBoundingBox, ApiGeometry, ApiPoint } from "./api-models/geometry"; import { ApiObjectWrapper } from "./base"; /** * The coordinate axis-aligned bounding box of a detected object */ export declare class BoundingBox> extends ApiObjectWrapper { _parentGeometry: Geometry | null; constructor(dict: ApiBoundingBox, parentGeometry?: Geometry | null); /** * 0-1, top-to-bottom Y coordinate of the bottom of the box relative to the input page/image */ get bottom(): number; /** * 0-1, left-to-right X coordinate of the center of the box relative to the input page/image */ get hCenter(): number; /** * Height of the box relative to the input page/image, from 0-1 */ get height(): number; /** * 0-1, left-to-right X coordinate of the left side of the box relative to the input page/image */ get left(): number; /** * Optional parent geometry object owning this bounding box */ get parentGeometry(): Geometry | null; /** * 0-1, top-to-bottom Y coordinate of the top of the box relative to the input page/image */ get top(): number; /** * 0-1, left-to-right X coordinate of the right side of the box relative to the input page/image */ get right(): number; /** * 0-1, top-to-bottom Y coordinate of the middle of the box relative to the input page/image */ get vCenter(): number; /** * Width of the box relative to the input page/image, from 0-1 */ get width(): number; /** * Calculate the minimum box enclosing both this and `other`. * @returns A new BoundingBox object with null `parentGeometry`. */ union(other: BoundingBox>): BoundingBox>; /** * Calculate the intersection (if there is one) between two boxes. * @returns A new BoundingBox object with null `parentGeometry`, or null if inputs don't overlap */ intersection(other: BoundingBox>): BoundingBox> | null; /** * Create a human-readable string representation of this bounding box's key characteristics */ str(): string; } /** * One X-Y point from a polygon describing the detailed shape of a detected object */ export declare class Point> extends ApiObjectWrapper { _parentGeometry: Geometry | null; constructor(dict: ApiPoint, parentGeometry?: Geometry | null); /** * Optional parent geometry object owning this point */ get parentGeometry(): Geometry | null; /** * 0-1, left-to-right X coordinate of the point relative to the input image/page */ get x(): number; /** * 0-1, top-to-bottom Y coordinate of the point relative to the input image/page */ get y(): number; /** * Create a human-readable string representation of this point's key characteristics */ str(): string; } /** * Shape/location on the page of an element detected by Textract */ export declare class Geometry> extends ApiObjectWrapper { _boundingBox: BoundingBox; _parentObject: TParent | null; _polygon: Point[]; constructor(dict: ApiGeometry, parentObject: TParent | null); /** * The minimal coordinate-axis-aligned box containing the object */ get boundingBox(): BoundingBox; /** * The (optional) TRP object that this geometry belongs to */ get parentObject(): TParent | null; /** * The detailed polygon shape of the object * * Usually this is still just a 4-point quadrilateral, but can help to indicate the element's * actual orientation as used in `.orientationRadians()` */ get polygon(): Point[]; /** * Get the slope (in radians -pi < x +pi) of the initial segment of the polygon. * * Because Textract constructs polygons with first two points as T-L and T-R corners, this yields * the approximate (since it might not be completely rectangular) orientation of the object. */ orientationRadians(): number | null; /** * Wrapper over orientationRadians to translate result to degrees (-180 < x < 180). */ orientationDegrees(): number | null; /** * Create a human-readable representation of this geometry's key characteristics */ str(): string; } /** * Basic interface for objects referencing an Amazon Textract Geometry */ export interface IWithGeometry> { /** * Geometry of this object on the page */ get geometry(): Geometry; }