isoxml-angular
Version:
JavaScript library to parse and generate ISOXML (ISO11783-10) files
94 lines (93 loc) • 2.48 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Partfield = void 0;
const classRegistry_1 = require("../classRegistry");
const utils_1 = require("../utils");
const ATTRIBUTES = {
A: {
name: 'PartfieldId',
type: 'xs:ID',
isPrimaryId: true,
isOptional: false,
isOnlyV4: false,
},
B: {
name: 'PartfieldCode',
type: 'xs:string',
isPrimaryId: false,
isOptional: true,
isOnlyV4: false,
},
C: {
name: 'PartfieldDesignator',
type: 'xs:string',
isPrimaryId: false,
isOptional: false,
isOnlyV4: false,
},
D: {
name: 'PartfieldArea',
type: 'xs:unsignedLong',
isPrimaryId: false,
isOptional: false,
isOnlyV4: false,
minValue: 0,
maxValue: 4294967294,
},
E: {
name: 'CustomerIdRef',
type: 'xs:IDREF',
isPrimaryId: false,
isOptional: true,
isOnlyV4: false,
},
F: {
name: 'FarmIdRef',
type: 'xs:IDREF',
isPrimaryId: false,
isOptional: true,
isOnlyV4: false,
},
G: {
name: 'CropTypeIdRef',
type: 'xs:IDREF',
isPrimaryId: false,
isOptional: true,
isOnlyV4: false,
},
H: {
name: 'CropVarietyIdRef',
type: 'xs:IDREF',
isPrimaryId: false,
isOptional: true,
isOnlyV4: false,
},
I: {
name: 'FieldIdRef',
type: 'xs:IDREF',
isPrimaryId: false,
isOptional: true,
isOnlyV4: false,
},
};
const CHILD_TAGS = {
PLN: { name: 'PolygonnonTreatmentZoneonly', isOnlyV4: false },
LSG: { name: 'LineString', isOnlyV4: false },
PNT: { name: 'Point', isOnlyV4: false },
GGP: { name: 'GuidanceGroup', isOnlyV4: true },
};
class Partfield {
constructor(attributes, isoxmlManager) {
this.attributes = attributes;
this.isoxmlManager = isoxmlManager;
this.tag = "PFD" /* TAGS.Partfield */;
}
static fromXML(xml, isoxmlManager, internalId, targetClass = Partfield) {
return (0, utils_1.fromXML)(xml, isoxmlManager, targetClass, ATTRIBUTES, CHILD_TAGS, internalId);
}
toXML() {
return (0, utils_1.toXML)(this, ATTRIBUTES, CHILD_TAGS);
}
}
exports.Partfield = Partfield;
(0, classRegistry_1.registerEntityClass)('main', "PFD" /* TAGS.Partfield */, Partfield);