UNPKG

isoxml

Version:

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

114 lines (113 loc) 2.86 kB
import { TAGS } from './constants'; import { registerEntityClass } from '../classRegistry'; import { fromXML, toXML } from '../utils'; export var GridGridTypeEnum; (function (GridGridTypeEnum) { GridGridTypeEnum["GridType1"] = "1"; GridGridTypeEnum["GridType2"] = "2"; })(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 = {}; export class Grid { constructor(attributes, isoxmlManager) { this.attributes = attributes; this.isoxmlManager = isoxmlManager; this.tag = TAGS.Grid; } static fromXML(xml, isoxmlManager, internalId, targetClass = Grid) { return fromXML(xml, isoxmlManager, targetClass, ATTRIBUTES, CHILD_TAGS, internalId); } toXML() { return toXML(this, ATTRIBUTES, CHILD_TAGS); } } registerEntityClass('main', TAGS.Grid, Grid);