PMA.UI Documentation by Pathomation

view/definitions.js

/**
 * PMA.UI.Types contains PMA.UI type definitions
 * @namespace PMA.UI.Types
 */

/**
 * Available annotation types
 * @readonly
 * @enum {string}
 * @name Annotation
 * @memberof PMA.UI.Types
 * @property {string} Rectangle - A rectangular area
 * @property {string} Arrow - A vector arrow
 * @property {string} Line - A line segment made of a start and end point
 * @property {string} Icon - A point with an icon image
 * @property {string} Point - A point
 * @property {string} MultiPoint - Multiple points
 * @property {string} Freehand - Free hand line
 * @property {string} ClosedFreehand - Free hand polygon
 * @property {string} CompoundFreehand - Multiple free hand lines that are eventually connected together to form a closed freehand polygon
 * @property {string} Ellipse - Ellipse
 * @property {string} Circle - Circle
 * @property {string} Polygon - Polygon
 * @property {string} LineString - Multiple connected line segments
 */
export const Annotation = {
    Rectangle: "Rectangle",
    Arrow: "Arrow",
    Line: "Line",
    Icon: "Icon",
    Point: "Point",
    MultiPoint: "MultiPoint",
    Freehand: "Freehand",
    ClosedFreehand: "ClosedFreehand",
    CompoundFreehand: "CompoundFreehand",
    Ellipse: "Ellipse",
    Circle: "Circle",
    Polygon: "Polygon",
    LineString: "LineString"
};

/**
 * Available edit types
 * @readonly
 * @enum {string}
 * @name AnnotationTools
 * @memberof PMA.UI.Types
 * @property {string} Transform - Scales and rotates an annotation
 * @property {string} Modify - Changes shape of annotation using handles
 * @property {string} Wand - Creates new annotation on seleced area
 * @property {string} Brush - Changes shape of annotation using brush
 * @property {string} Eraser - Changes shape of annotation using eraser
 * @property {string} Subtract - Removes part of closed annotation
 * @property {string} Addition - Adds a new part to a closed annotation
 */
export const AnnotationTools = {
    Transform: "Transform",
    Modify: "Modify",
    Wand: "Wand",
    Brush: "Brush",
    Eraser: "Eraser",
    Subtract: "Subtract",
    Addition: "Addition"
};

/**
 * Annotations states
 * @readonly
 * @enum {number}
 * @name AnnotationState
 * @memberof PMA.UI.Types
 * @property {number} Pristine - Unchanged
 * @property {number} Added - Added but not saved yet
 * @property {number} Modified - Updated but not saved yet
 * @property {number} Deleted - Removed but not saved yet
 */
export const AnnotationState = {
    Pristine: 1,
    Added: 2,
    Modified: 3,
    Deleted: 4
};

/**
 * Available controls
 * @readonly
 * @enum {string}
 * @name Controls
 * @memberof PMA.UI.Types
 * @property {string} ZoomSlider - The zoom slider control
 * @property {string} ScaleLine - The scale line control
 * @property {string} Overview - The overview control
 * @property {string} Barcode - The barcode control
 * @property {string} Magnifier - The magnifier control
 * @property {string} ColorAdjustments - The brightness/contrast control
 * @property {string} LayerSwitch - The control to turn layers on/off. Used for server side annotation layers
 * @property {string} DimensionSelector - The control used to control z-stacks and timeframes
 * @property {string} Filename - The filename control
 * @property {string} Snapshot - The snapshot control
 * @property {string} Rotation - The rotation control
 * @property {string} Attribution - The attribution control
 */
export const Controls = {
    ZoomSlider: "zoomslider",
    ScaleLine: "scaleline",
    Overview: "overview",
    Barcode: "barcode",
    Magnifier: "magnifier",
    ColorAdjustments: "coloradjustments",
    LayerSwitch: "layerswitch",
    DimensionSelector: "dimensionselector",
    Filename: "filename",
    Snapshot: "shapshot",
    Rotation: "rotation",
    Attribution: "attribution",
    Fullscreen: "fullscreen"
};

/**
 * Available mouse wheel modes
 * @readonly
 * @enum {string}
 * @name MouseWheelZoomMode
 * @memberof PMA.UI.Types
 * @property {string} normal - Free mouse wheel zoom
 * @property {string} objectives - Snaps to objective zoom levels
 */
export const MouseWheelZoomMode = {
    normal: "Normal",
    objectives: "Objectives",
}

/**
 * Viewer themes
 * @readonly
 * @enum {string}
 * @name Themes
 * @memberof PMA.UI.View
 * @property {string} Default - OpenLayers default
 * @property {string} Classic - Classic layout found in many desktop viewers
 * @property {string} Modern - Modern layout compatible with web application UI
 */
export const Themes = {
    Default: "default",
    Classic: "classic",
    Modern: "modern"
};

/**
 * Custom button predefined locations
 * @readonly
 * @enum {string}
 * @name ButtonLocations
 * @memberof PMA.UI.View
 * @property {string} N - North of the viewport
 * @property {string} S - South of the viewport
 * @property {string} E - East of the viewport
 * @property {string} W - West of the viewport
 * @property {string} NE - North-East corner of the viewport
 * @property {string} NW - North-West corner of the viewport
 * @property {string} SE - South-East corner of the viewport
 * @property {string} SW - South-West corner of the viewport
 **/
export const ButtonLocations = {
    N: "n",
    S: "s",
    E: "e",
    W: "w",
    NE: "ne",
    NW: "nw",
    SE: "se",
    SW: "sw",
};

/**
 * Default fill color used
 * @readonly
 * @name DefaultFillColor
 * @memberof PMA.UI.View
 */
export const DefaultFillColor = 'rgba(255, 255, 255, 0.2)';

/**
 * Events fired by the viewport
 * @memberof PMA.UI.View
 * @namespace PMA.UI.View.Events
 */

/**
 * Events fired by the viewport
 * @readonly
 * @enum {string}
 * @name Events
 * @memberof PMA.UI.View
 * @property {string} DimensionsChanged - Fires when the active layer, timeframe or channels change
 * @property {string} ViewChanged - Fires when the the center, resolution (zoom) or rotation changes
 * @property {string} TilesError - Fires when an error occurs while loading tiles
 * @property {string} SlideLoadError - Fires when the slide cannot be loaded
 * @property {string} FilenameClick - Fires when the file name control is clicked
 * @property {string} AnnotationLayerChanged - Fires when an annotation layer has changed visibility/opacity
 * @property {string} MeasurementStop - Fires when the real time measurements have stoped
 * @property {string} ViewLoaded - Fires when the viewport has finished loaded
 * @ignore
 */
export const Events = {
    /** 
     * Fires when the active layer, timeframe or channels change
     * @event PMA.UI.View.Events.DimensionsChanged
    */
    DimensionsChanged: "change:dimension",
    /**
     * Fires when the the center, resolution (zoom) or rotation changes
     * @event PMA.UI.View.Events.ViewChanged
    */
    ViewChanged: "viewchanged",
    /**
     * Fires when an error occurs while loading tiles
     * @event PMA.UI.View.Events.TilesError */
    TilesError: "tileserror",
    /**
     * Fires when the slide cannot be loaded
     * @event PMA.UI.View.Events.SlideLoadError */
    SlideLoadError: "SlideLoadError",
    /**
     * Fires when the file name control is clicked
     * @event PMA.UI.View.Events.FilenameClick */
    FilenameClick: "click:filename",

    /**
     * Fires when an annotation layer has changed visibility/opacity
     * @event PMA.UI.View.Events.AnnotationLayerChanged
     */
    AnnotationLayerChanged: "layer:change",

    /**
     * Fires when the real time measurements have stoped
     * @event PMA.UI.View.Events.MeasurementStop
     */
    MeasurementStop: "measurestop",

    /**
     * Fires when the viewport has finished loaded
     * @event PMA.UI.View.Events.ViewLoaded
     * @param {Object} args - The view loaded event arguments
     * @param {number} args.time - The time in milliseconds it took to complete loading tiles
     * @param {number} args.tiles - The number of tiles that was loaded
     */
    ViewLoaded: "viewLoaded"
};

/**
 * Supported types of objective resolutions
 * @readonly
 * @enum {string}
 * @name ObjectiveResolutions
 * @memberof PMA.UI.View
 * @property {string} Min - Minimum resolution
 * @property {string} 1X - 1x
 * @property {string} 2X - 2x
 * @property {string} 5X - 5x
 * @property {string} 10X - 10x
 * @property {string} 20X - 20x
 * @property {string} 40X - 40x
 * @property {string} 1:1 - 1:1 Resolution
 * @property {string} Max - Maximum resolution
 */
export const ObjectiveResolutions = {
    "Min": "min",
    "1X": "1",
    "2X": "2",
    "5X": "5",
    "10X": "10",
    "20X": "20",
    "40X": "40",
    "1:1": "1:1",
    "Max": "max"
};