UNPKG

isoxml

Version:

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

135 lines (134 loc) 3.58 kB
import { TAGS } from './constants'; import { registerEntityClass } from '../classRegistry'; import { fromXML, toXML } from '../utils'; export 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 || (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 = {}; export class Point { constructor(attributes, isoxmlManager) { this.attributes = attributes; this.isoxmlManager = isoxmlManager; this.tag = TAGS.Point; } static fromXML(xml, isoxmlManager, internalId, targetClass = Point) { return fromXML(xml, isoxmlManager, targetClass, ATTRIBUTES, CHILD_TAGS, internalId); } toXML() { return toXML(this, ATTRIBUTES, CHILD_TAGS); } } registerEntityClass('main', TAGS.Point, Point);