isoxml-angular
Version:
JavaScript library to parse and generate ISOXML (ISO11783-10) files
65 lines (64 loc) • 1.74 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Polygon = void 0;
const classRegistry_1 = require("../classRegistry");
const utils_1 = require("../utils");
const ATTRIBUTES = {
A: {
name: "PolygonType",
type: "xs:NMTOKEN",
isPrimaryId: false,
isOptional: false,
isOnlyV4: false,
},
B: {
name: "PolygonDesignator",
type: "xs:string",
isPrimaryId: false,
isOptional: true,
isOnlyV4: false,
},
C: {
name: "PolygonArea",
type: "xs:unsignedLong",
isPrimaryId: false,
isOptional: true,
isOnlyV4: false,
minValue: 0,
maxValue: 4294967294,
},
D: {
name: "PolygonColour",
type: "xs:unsignedByte",
isPrimaryId: false,
isOptional: true,
isOnlyV4: false,
minValue: 0,
maxValue: 254,
},
E: {
name: "PolygonId",
type: "xs:ID",
isPrimaryId: true,
isOptional: true,
isOnlyV4: true,
},
};
const CHILD_TAGS = {
LSG: { name: "LineString", isOnlyV4: false },
};
class Polygon {
constructor(attributes, isoxmlManager) {
this.attributes = attributes;
this.isoxmlManager = isoxmlManager;
this.tag = "PLN" /* TAGS.Polygon */;
}
static fromXML(xml, isoxmlManager, internalId, targetClass = Polygon) {
return (0, utils_1.fromXML)(xml, isoxmlManager, targetClass, ATTRIBUTES, CHILD_TAGS, internalId);
}
toXML() {
return (0, utils_1.toXML)(this, ATTRIBUTES, CHILD_TAGS);
}
}
exports.Polygon = Polygon;
(0, classRegistry_1.registerEntityClass)("main", "PLN" /* TAGS.Polygon */, Polygon);