UNPKG

isoxml

Version:

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

38 lines (37 loc) 1.14 kB
import { TAGS } from './constants'; import { registerEntityClass } from '../classRegistry'; import { fromXML, toXML } from '../utils'; const ATTRIBUTES = { A: { name: 'GuidanceGroupId', type: 'xs:ID', isPrimaryId: true, isOptional: false, isOnlyV4: undefined, }, B: { name: 'GuidanceGroupDesignator', type: 'xs:string', isPrimaryId: false, isOptional: true, isOnlyV4: undefined, }, }; const CHILD_TAGS = { GPN: { name: 'GuidancePattern', isOnlyV4: undefined }, PLN: { name: 'BoundaryPolygon', isOnlyV4: undefined }, }; export class GuidanceGroup { constructor(attributes, isoxmlManager) { this.attributes = attributes; this.isoxmlManager = isoxmlManager; this.tag = TAGS.GuidanceGroup; } static fromXML(xml, isoxmlManager, internalId, targetClass = GuidanceGroup) { return fromXML(xml, isoxmlManager, targetClass, ATTRIBUTES, CHILD_TAGS, internalId); } toXML() { return toXML(this, ATTRIBUTES, CHILD_TAGS); } } registerEntityClass('main', TAGS.GuidanceGroup, GuidanceGroup);