UNPKG

isoxml

Version:

JavaScript library to parse and generate ISOXML (ISO11783-10) files

118 lines (117 loc) 3.09 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Grid = exports.GridGridTypeEnum = void 0; const constants_1 = require("./constants"); const classRegistry_1 = require("../classRegistry"); const utils_1 = require("../utils"); var GridGridTypeEnum; (function (GridGridTypeEnum) { GridGridTypeEnum["GridType1"] = "1"; GridGridTypeEnum["GridType2"] = "2"; })(GridGridTypeEnum || (exports.GridGridTypeEnum = GridGridTypeEnum = {})); const ATTRIBUTES = { A: { name: 'GridMinimumNorthPosition', type: 'xs:decimal', isPrimaryId: false, isOptional: false, isOnlyV4: false, minValue: -90, maxValue: 90, fractionDigits: 9, }, B: { name: 'GridMinimumEastPosition', type: 'xs:decimal', isPrimaryId: false, isOptional: false, isOnlyV4: false, minValue: -180, maxValue: 180, fractionDigits: 9, }, C: { name: 'GridCellNorthSize', type: 'xs:double', isPrimaryId: false, isOptional: false, isOnlyV4: false, minValue: 0, maxValue: 1, }, D: { name: 'GridCellEastSize', type: 'xs:double', isPrimaryId: false, isOptional: false, isOnlyV4: false, minValue: 0, maxValue: 1, }, E: { name: 'GridMaximumColumn', type: 'xs:unsignedLong', isPrimaryId: false, isOptional: false, isOnlyV4: false, minValue: 0, maxValue: 4294967295, }, F: { name: 'GridMaximumRow', type: 'xs:unsignedLong', isPrimaryId: false, isOptional: false, isOnlyV4: false, minValue: 0, maxValue: 4294967295, }, G: { name: 'Filename', type: 'xs:ID', isPrimaryId: false, isOptional: false, isOnlyV4: false, }, H: { name: 'Filelength', type: 'xs:unsignedLong', isPrimaryId: false, isOptional: true, isOnlyV4: false, minValue: 0, maxValue: 4294967294, }, I: { name: 'GridType', type: 'xs:NMTOKEN', isPrimaryId: false, isOptional: false, isOnlyV4: false, }, J: { name: 'TreatmentZoneCode', type: 'xs:unsignedByte', isPrimaryId: false, isOptional: true, isOnlyV4: false, minValue: 0, maxValue: 254, }, }; const CHILD_TAGS = {}; class Grid { constructor(attributes, isoxmlManager) { this.attributes = attributes; this.isoxmlManager = isoxmlManager; this.tag = constants_1.TAGS.Grid; } static fromXML(xml, isoxmlManager, internalId, targetClass = Grid) { return (0, utils_1.fromXML)(xml, isoxmlManager, targetClass, ATTRIBUTES, CHILD_TAGS, internalId); } toXML() { return (0, utils_1.toXML)(this, ATTRIBUTES, CHILD_TAGS); } } exports.Grid = Grid; (0, classRegistry_1.registerEntityClass)('main', constants_1.TAGS.Grid, Grid);