UNPKG

isoxml

Version:

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

139 lines (138 loc) 3.82 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Point = exports.PointPointTypeEnum = void 0; const constants_1 = require("./constants"); const classRegistry_1 = require("../classRegistry"); const utils_1 = require("../utils"); var PointPointTypeEnum; (function (PointPointTypeEnum) { PointPointTypeEnum["Flag"] = "1"; PointPointTypeEnum["Other"] = "2"; PointPointTypeEnum["FieldAccess"] = "3"; PointPointTypeEnum["Storage"] = "4"; PointPointTypeEnum["Obstacle"] = "5"; PointPointTypeEnum["GuidanceReferenceA"] = "6"; PointPointTypeEnum["GuidanceReferenceB"] = "7"; PointPointTypeEnum["GuidanceReferenceCenter"] = "8"; PointPointTypeEnum["GuidancePoint"] = "9"; PointPointTypeEnum["PartfieldReferencePoint"] = "10"; PointPointTypeEnum["Homebase"] = "11"; })(PointPointTypeEnum || (exports.PointPointTypeEnum = PointPointTypeEnum = {})); const ATTRIBUTES = { A: { name: 'PointType', type: 'xs:NMTOKEN', isPrimaryId: false, isOptional: false, isOnlyV4: false, allowEmptyString: true, }, B: { name: 'PointDesignator', type: 'xs:string', isPrimaryId: false, isOptional: true, isOnlyV4: false, }, C: { name: 'PointNorth', type: 'xs:decimal', isPrimaryId: false, isOptional: false, isOnlyV4: false, minValue: -90, maxValue: 90, fractionDigits: 9, allowEmptyString: true, }, D: { name: 'PointEast', type: 'xs:decimal', isPrimaryId: false, isOptional: false, isOnlyV4: false, minValue: -180, maxValue: 180, fractionDigits: 9, allowEmptyString: true, }, E: { name: 'PointUp', type: 'xs:long', isPrimaryId: false, isOptional: true, isOnlyV4: false, minValue: -2147483647, maxValue: 2147483647, allowEmptyString: true, }, F: { name: 'PointColour', type: 'xs:unsignedByte', isPrimaryId: false, isOptional: true, isOnlyV4: false, minValue: 0, maxValue: 254, allowEmptyString: true, }, G: { name: 'PointId', type: 'xs:ID', isPrimaryId: true, isOptional: true, isOnlyV4: true, }, H: { name: 'PointHorizontalAccuracy', type: 'xs:decimal', isPrimaryId: false, isOptional: true, isOnlyV4: true, minValue: 0, maxValue: 65, allowEmptyString: true, }, I: { name: 'PointVerticalAccuracy', type: 'xs:decimal', isPrimaryId: false, isOptional: true, isOnlyV4: true, minValue: 0, maxValue: 65, allowEmptyString: true, }, J: { name: 'Filename', type: 'xs:string', isPrimaryId: false, isOptional: true, isOnlyV4: true, }, K: { name: 'Filelength', type: 'xs:unsignedLong', isPrimaryId: false, isOptional: true, isOnlyV4: true, minValue: 0, maxValue: 4294967294, }, }; const CHILD_TAGS = {}; class Point { constructor(attributes, isoxmlManager) { this.attributes = attributes; this.isoxmlManager = isoxmlManager; this.tag = constants_1.TAGS.Point; } static fromXML(xml, isoxmlManager, internalId, targetClass = Point) { return (0, utils_1.fromXML)(xml, isoxmlManager, targetClass, ATTRIBUTES, CHILD_TAGS, internalId); } toXML() { return (0, utils_1.toXML)(this, ATTRIBUTES, CHILD_TAGS); } } exports.Point = Point; (0, classRegistry_1.registerEntityClass)('main', constants_1.TAGS.Point, Point);