This repository has been archived on 2023-03-25. You can view files and clone it, but cannot push or open issues or pull requests.
mightyscape-1.1-deprecated/extensions/fablabchemnitz/dxfdwgimporter/node_modules/dxf/lib/handlers/header.js

82 lines
1.5 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _default = function _default(tuples) {
var state;
var header = {};
tuples.forEach(function (tuple) {
var type = tuple[0];
var value = tuple[1];
switch (value) {
case '$MEASUREMENT':
{
state = 'measurement';
break;
}
case '$INSUNITS':
{
state = 'insUnits';
break;
}
case '$EXTMIN':
header.extMin = {};
state = 'extMin';
break;
case '$EXTMAX':
header.extMax = {};
state = 'extMax';
break;
default:
switch (state) {
case 'extMin':
case 'extMax':
{
switch (type) {
case 10:
header[state].x = value;
break;
case 20:
header[state].y = value;
break;
case 30:
header[state].z = value;
state = undefined;
break;
}
break;
}
case 'measurement':
case 'insUnits':
{
switch (type) {
case 70:
{
header[state] = value;
state = undefined;
break;
}
}
break;
}
}
}
});
return header;
};
exports["default"] = _default;