UNPKG

isoxml

Version:

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

64 lines (63 loc) 1.7 kB
import { TAGS } from './constants'; import { registerEntityClass } from '../classRegistry'; import { fromXML, toXML } from '../utils'; const ATTRIBUTES = { A: { name: 'BaseStationId', type: 'xs:ID', isPrimaryId: true, isOptional: false, isOnlyV4: undefined, }, B: { name: 'BaseStationDesignator', type: 'xs:string', isPrimaryId: false, isOptional: false, isOnlyV4: undefined, }, C: { name: 'BaseStationNorth', type: 'xs:decimal', isPrimaryId: false, isOptional: false, isOnlyV4: undefined, minValue: -90, maxValue: 90, fractionDigits: 9, }, D: { name: 'BaseStationEast', type: 'xs:decimal', isPrimaryId: false, isOptional: false, isOnlyV4: undefined, minValue: -180, maxValue: 180, fractionDigits: 9, }, E: { name: 'BaseStationUp', type: 'xs:long', isPrimaryId: false, isOptional: false, isOnlyV4: undefined, minValue: -2147483647, maxValue: 2147483647, }, }; const CHILD_TAGS = {}; export class BaseStation { constructor(attributes, isoxmlManager) { this.attributes = attributes; this.isoxmlManager = isoxmlManager; this.tag = TAGS.BaseStation; } static fromXML(xml, isoxmlManager, internalId, targetClass = BaseStation) { return fromXML(xml, isoxmlManager, targetClass, ATTRIBUTES, CHILD_TAGS, internalId); } toXML() { return toXML(this, ATTRIBUTES, CHILD_TAGS); } } registerEntityClass('main', TAGS.BaseStation, BaseStation);