@vitrosoftware/common-ui-ts 1.1.122 → 1.1.124
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/std/controls/checkbox/checkbox.css +4 -0
- package/css/std/controls/checkbox/img/checkbox-indeterminate.svg +4 -0
- package/css/std/controls/date-picker/date-picker.css +1 -25
- package/css/std/controls/dxf-viewer/annotation.css +85 -0
- package/css/std/controls/dxf-viewer/common.css +24 -0
- package/css/std/controls/dxf-viewer/dxf-viewer-index.css +14081 -0
- package/css/std/controls/dxf-viewer/dxf-viewer.css +194 -0
- package/css/std/controls/dxf-viewer/img/cancel-dark-grey.svg +5 -0
- package/css/std/controls/dxf-viewer/img/collapse-bottom.svg +5 -0
- package/css/std/controls/dxf-viewer/img/collapse-up-blue.svg +5 -0
- package/css/std/controls/dxf-viewer/img/delete-active.svg +11 -0
- package/css/std/controls/dxf-viewer/img/delete.svg +11 -0
- package/css/std/controls/dxf-viewer/img/draw-annotation.svg +3 -0
- package/css/std/controls/dxf-viewer/img/invisible-eye.svg +4 -0
- package/css/std/controls/dxf-viewer/img/show-annotation.svg +3 -0
- package/css/std/controls/dxf-viewer/img/sidebar-layers-toggle.svg +6 -0
- package/css/std/controls/dxf-viewer/img/sidebar-notes-toggle.svg +5 -0
- package/css/std/controls/dxf-viewer/img/sidebar-resizer.svg +6 -0
- package/css/std/controls/dxf-viewer/img/sidebar-toggle.svg +7 -0
- package/css/std/controls/dxf-viewer/img/visible-eye.svg +4 -0
- package/css/std/controls/dxf-viewer/img/zoom-in.svg +6 -0
- package/css/std/controls/dxf-viewer/img/zoom-out.svg +5 -0
- package/css/std/controls/dxf-viewer/layer-list.css +104 -0
- package/css/std/controls/dxf-viewer/panel.css +34 -0
- package/css/std/controls/dxf-viewer/prop-inspector.css +102 -0
- package/css/std/controls/dxf-viewer/select.css +111 -0
- package/css/std/controls/dxf-viewer/sidebar.css +190 -0
- package/css/std/controls/dxf-viewer/thumbnail-list.css +65 -0
- package/css/std/controls/dxf-viewer/toolbar.css +117 -0
- package/css/std/controls/dxf-viewer/treeview.css +3 -0
- package/css/std/controls/dxf-viewer/treeview.panel.css +108 -0
- package/css/std/controls/error-message/error-message.css +22 -0
- package/css/std/controls/image-picker/image-picker.css +0 -26
- package/css/std/controls/input/input.css +1 -24
- package/css/std/controls/issue-tile/issue-tile-header.css +1 -0
- package/css/std/controls/login/ntlm-authentication-form.css +9 -12
- package/css/std/controls/lookup-picker/lookup-picker-value-list.css +38 -2
- package/css/std/controls/lookup-picker/lookup-picker.css +1 -25
- package/css/std/controls/table-view/treegrid-context-menu.css +44 -18
- package/css/std/controls/table-view/treegrid-message.css +4 -4
- package/css/std/controls/time-picker/time-picker.css +1 -25
- package/dist/index.css +81 -143
- package/dist/index.js +15137 -489
- package/dist/index.js.map +1 -1
- package/dist/src/controls/Checkbox/Checkbox.d.ts +1 -0
- package/dist/src/controls/DxfViewer/DxfViewer.d.ts +6 -0
- package/dist/src/controls/DxfViewer/DxfViewerContext.d.ts +31 -0
- package/dist/src/controls/DxfViewer/Layer.d.ts +9 -0
- package/dist/src/controls/DxfViewer/LayerList.d.ts +11 -0
- package/dist/src/controls/DxfViewer/Thumbnail.d.ts +7 -0
- package/dist/src/controls/DxfViewer/ThumbnailList.d.ts +6 -0
- package/dist/src/controls/DxfViewer/Viewer.d.ts +6 -0
- package/dist/src/controls/ErrorMessage/ErrorMessage.d.ts +6 -0
- package/dist/src/controls/Login/FormRef.d.ts +3 -0
- package/dist/src/controls/Login/LoginConstants.d.ts +2 -1
- package/dist/src/controls/Login/LoginFormRef.d.ts +2 -2
- package/dist/src/controls/Login/NTLMAuthenticationForm.d.ts +5 -2
- package/dist/src/controls/LookupPicker/LookupPicker.d.ts +2 -0
- package/dist/src/controls/LookupPicker/ValueList.d.ts +2 -0
- package/dist/src/controls/TableView/TableViewConstants.d.ts +11 -0
- package/dist/src/controls/TableView/TreeGridTableViewContextImpl.d.ts +1 -0
- package/dist/src/controls/TreeView/TreeView.d.ts +4 -0
- package/dist/src/controls/TreeView/TreeViewConfig.d.ts +3 -0
- package/dist/src/controls/TreeView/TreeViewConstants.d.ts +2 -1
- package/dist/src/index.d.ts +7 -1
- package/lib/dxf-viewer/BatchingKey.js +91 -0
- package/lib/dxf-viewer/DxfFetcher.js +39 -0
- package/lib/dxf-viewer/DxfScene.js +2695 -0
- package/lib/dxf-viewer/DxfViewer.js +1056 -0
- package/lib/dxf-viewer/DxfWorker.js +229 -0
- package/lib/dxf-viewer/DynamicBuffer.js +100 -0
- package/lib/dxf-viewer/HatchCalculator.js +345 -0
- package/lib/dxf-viewer/LinearDimension.js +323 -0
- package/lib/dxf-viewer/MTextFormatParser.js +211 -0
- package/lib/dxf-viewer/MaterialKey.js +37 -0
- package/lib/dxf-viewer/OrbitControls.js +1253 -0
- package/lib/dxf-viewer/Pattern.js +94 -0
- package/lib/dxf-viewer/RBTree.js +471 -0
- package/lib/dxf-viewer/TextRenderer.js +1038 -0
- package/lib/dxf-viewer/index.js +42 -0
- package/lib/dxf-viewer/math/Matrix2.js +77 -0
- package/lib/dxf-viewer/math/utils.js +59 -0
- package/lib/dxf-viewer/parser/AutoCadColorIndex.js +265 -0
- package/lib/dxf-viewer/parser/DimStyleCodes.js +33 -0
- package/lib/dxf-viewer/parser/DxfArrayScanner.js +143 -0
- package/lib/dxf-viewer/parser/DxfParser.js +980 -0
- package/lib/dxf-viewer/parser/ExtendedDataParse-My.js +91 -0
- package/lib/dxf-viewer/parser/ExtendedDataParser.js +123 -0
- package/lib/dxf-viewer/parser/ParseHelpers.js +142 -0
- package/lib/dxf-viewer/parser/entities/3dface.js +83 -0
- package/lib/dxf-viewer/parser/entities/arc.js +38 -0
- package/lib/dxf-viewer/parser/entities/attdef.js +89 -0
- package/lib/dxf-viewer/parser/entities/attrib.js +34 -0
- package/lib/dxf-viewer/parser/entities/attribute.js +109 -0
- package/lib/dxf-viewer/parser/entities/circle.js +43 -0
- package/lib/dxf-viewer/parser/entities/dimension.js +72 -0
- package/lib/dxf-viewer/parser/entities/ellipse.js +46 -0
- package/lib/dxf-viewer/parser/entities/hatch.js +343 -0
- package/lib/dxf-viewer/parser/entities/insert.js +62 -0
- package/lib/dxf-viewer/parser/entities/leader.js +84 -0
- package/lib/dxf-viewer/parser/entities/line.js +34 -0
- package/lib/dxf-viewer/parser/entities/lwpolyline.js +100 -0
- package/lib/dxf-viewer/parser/entities/mtext.js +54 -0
- package/lib/dxf-viewer/parser/entities/point.js +35 -0
- package/lib/dxf-viewer/parser/entities/polyline.js +92 -0
- package/lib/dxf-viewer/parser/entities/solid.js +40 -0
- package/lib/dxf-viewer/parser/entities/spline.js +70 -0
- package/lib/dxf-viewer/parser/entities/text.js +47 -0
- package/lib/dxf-viewer/parser/entities/vertex.js +62 -0
- package/lib/dxf-viewer/parser/entities/viewport.js +56 -0
- package/lib/dxf-viewer/parser/objects/dictionary.js +29 -0
- package/lib/dxf-viewer/parser/objects/layout.js +35 -0
- package/lib/dxf-viewer/parser/objects/xrecord.js +29 -0
- package/lib/opentype/opentype.module.js +14571 -0
- package/lib/three/CSS2DRenderer.js +235 -0
- package/lib/three/three.module.js +49912 -0
- package/package.json +12 -10
- package/src/controls/BimViewer/js/bim-viewer.js +2 -2
- package/src/controls/DxfViewer/js/dxf-viewer.js +3580 -0
- package/src/controls/PdfViewer/js/pdf-viewer.js +1 -1
- package/css/std/controls/input/img/error-message.svg +0 -6
- package/css/std/controls/lookup-picker/img/error-message.svg +0 -6
- package/css/std/controls/time-picker/img/error-message.svg +0 -6
- /package/css/std/controls/{date-picker → error-message}/img/error-message.svg +0 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
//import log from "loglevel"
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export default class ExtendedDataParser {
|
|
5
|
+
|
|
6
|
+
constructor() {
|
|
7
|
+
this.appName = null
|
|
8
|
+
this.appNameWarningShown = false
|
|
9
|
+
this.lastString = null
|
|
10
|
+
this.sectionStack = []
|
|
11
|
+
this.failure = false
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Feed next token.
|
|
16
|
+
* @return {boolean} True if new parser instance should be created for this token.
|
|
17
|
+
*/
|
|
18
|
+
Feed(curr) {
|
|
19
|
+
if (!this.appName) {
|
|
20
|
+
if (curr.code == 1001) {
|
|
21
|
+
this.appName = curr.value
|
|
22
|
+
return false
|
|
23
|
+
}
|
|
24
|
+
if (!this.appNameWarningShown) {
|
|
25
|
+
this.appNameWarningShown = true
|
|
26
|
+
//vitrolog.warn("XDATA section does not start with application name")
|
|
27
|
+
}
|
|
28
|
+
return false
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (curr.code == 1001) {
|
|
32
|
+
return true
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (this.failure) {
|
|
36
|
+
/* Ignore all the rest content in case of parsing failure. */
|
|
37
|
+
return false
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const curSection = this._currentSection
|
|
41
|
+
|
|
42
|
+
if (curr.code == 1002) {
|
|
43
|
+
if (curr.value == "{") {
|
|
44
|
+
const newSection = this._CreateSection()
|
|
45
|
+
this.sectionStack.push(newSection)
|
|
46
|
+
return false
|
|
47
|
+
}
|
|
48
|
+
if (curr.value == "}") {
|
|
49
|
+
return false
|
|
50
|
+
}
|
|
51
|
+
//vitrolog.warn("Bad XDATA section control string encountered: " + curr.value)
|
|
52
|
+
this.failure = true
|
|
53
|
+
return false
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
curSection.values.push(this._CreateValue(curr.code, curr.value))
|
|
57
|
+
|
|
58
|
+
return false
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Finalize XDATA section parsing. */
|
|
62
|
+
Finish(entity) {
|
|
63
|
+
if (this.failure) {
|
|
64
|
+
return
|
|
65
|
+
}
|
|
66
|
+
if (this.appName) {
|
|
67
|
+
let xdata
|
|
68
|
+
if (entity.hasOwnProperty("xdata")) {
|
|
69
|
+
xdata = entity.xdata
|
|
70
|
+
} else {
|
|
71
|
+
xdata = {}
|
|
72
|
+
entity.xdata = xdata
|
|
73
|
+
}
|
|
74
|
+
xdata[this.appName] = this.sectionStack
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
get _currentSection() {
|
|
79
|
+
return this.sectionStack[this.sectionStack.length - 1]
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
_CreateSection() {
|
|
83
|
+
return {
|
|
84
|
+
values: []
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
_CreateValue(code, value) {
|
|
89
|
+
return { code, value }
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
//import log from "loglevel"
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export default class ExtendedDataParser {
|
|
5
|
+
|
|
6
|
+
constructor() {
|
|
7
|
+
this.appName = null
|
|
8
|
+
this.appNameWarningShown = false
|
|
9
|
+
this.lastString = null
|
|
10
|
+
this.lastIndex = 1
|
|
11
|
+
this.sectionFinished = true
|
|
12
|
+
this.sectionStack = [this._CreateSection()]
|
|
13
|
+
this.failure = false
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Feed next token.
|
|
18
|
+
* @return {boolean} True if new parser instance should be created for this token.
|
|
19
|
+
*/
|
|
20
|
+
Feed(curr) {
|
|
21
|
+
if (!this.appName) {
|
|
22
|
+
if (curr.code == 1001) {
|
|
23
|
+
this.appName = curr.value
|
|
24
|
+
return false
|
|
25
|
+
}
|
|
26
|
+
if (!this.appNameWarningShown) {
|
|
27
|
+
this.appNameWarningShown = true
|
|
28
|
+
//vitrolog.warn("XDATA section does not start with application name")
|
|
29
|
+
}
|
|
30
|
+
return false
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (curr.code == 1001) {
|
|
34
|
+
return true
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (this.failure) {
|
|
38
|
+
/* Ignore all the rest content in case of parsing failure. */
|
|
39
|
+
return false
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (this.sectionFinished) {
|
|
43
|
+
if (curr.code == 1000) {
|
|
44
|
+
if (this.lastString) {
|
|
45
|
+
//vitrolog.warn("XDATA section unused string: " + this.lastString)
|
|
46
|
+
}
|
|
47
|
+
this.lastString = curr.value
|
|
48
|
+
return false
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const curSection = this._currentSection
|
|
53
|
+
|
|
54
|
+
if (curr.code == 1002) {
|
|
55
|
+
if (curr.value == "{") {
|
|
56
|
+
this.sectionFinished = false
|
|
57
|
+
if (!this.lastString) {
|
|
58
|
+
//vitrolog.warn("Unnamed XDATA section encountered")
|
|
59
|
+
this.lastString = this.lastIndex
|
|
60
|
+
}
|
|
61
|
+
const newSection = this._CreateSection()
|
|
62
|
+
curSection[this.lastString] = newSection
|
|
63
|
+
this.lastString = null
|
|
64
|
+
this.sectionStack.push(newSection)
|
|
65
|
+
return false
|
|
66
|
+
}
|
|
67
|
+
if (curr.value == "}") {
|
|
68
|
+
this.sectionFinished = true
|
|
69
|
+
if (this.sectionStack.length < 2) {
|
|
70
|
+
//vitrolog.warn("Unmatched XDATA section closing")
|
|
71
|
+
this.failure = true
|
|
72
|
+
return false
|
|
73
|
+
}
|
|
74
|
+
this.sectionStack.length = this.sectionStack.length - 1
|
|
75
|
+
this.lastIndex++
|
|
76
|
+
return false
|
|
77
|
+
}
|
|
78
|
+
//vitrolog.warn("Bad XDATA section control string encountered: " + curr.value)
|
|
79
|
+
this.failure = true
|
|
80
|
+
return false
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (this.lastString !== null) {
|
|
84
|
+
curSection.values.push(this._CreateValue(1000, this.lastString))
|
|
85
|
+
this.lastString = null
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
curSection.values.push(this._CreateValue(curr.code, curr.value))
|
|
89
|
+
|
|
90
|
+
return false
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** Finalize XDATA section parsing. */
|
|
94
|
+
Finish(entity) {
|
|
95
|
+
if (this.failure) {
|
|
96
|
+
return
|
|
97
|
+
}
|
|
98
|
+
if (this.appName) {
|
|
99
|
+
let xdata
|
|
100
|
+
if (entity.hasOwnProperty("xdata")) {
|
|
101
|
+
xdata = entity.xdata
|
|
102
|
+
} else {
|
|
103
|
+
xdata = {}
|
|
104
|
+
entity.xdata = xdata
|
|
105
|
+
}
|
|
106
|
+
xdata[this.appName] = this.sectionStack[0]
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
get _currentSection() {
|
|
111
|
+
return this.sectionStack[this.sectionStack.length - 1]
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
_CreateSection() {
|
|
115
|
+
return {
|
|
116
|
+
values: []
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
_CreateValue(code, value) {
|
|
121
|
+
return { code, value }
|
|
122
|
+
}
|
|
123
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import AUTO_CAD_COLOR_INDEX from './AutoCadColorIndex.js';
|
|
2
|
+
import ExtendedDataParser from './ExtendedDataParser.js';
|
|
3
|
+
/**
|
|
4
|
+
* Returns the truecolor value of the given AutoCad color index value
|
|
5
|
+
* @return {Number} truecolor value as a number
|
|
6
|
+
*/
|
|
7
|
+
export function getAcadColor(index) {
|
|
8
|
+
return AUTO_CAD_COLOR_INDEX[index];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Parses the 2D or 3D coordinate, vector, or point. When complete,
|
|
13
|
+
* the scanner remains on the last group of the coordinate.
|
|
14
|
+
* @param {*} scanner
|
|
15
|
+
*/
|
|
16
|
+
export function parsePoint(scanner) {
|
|
17
|
+
var point = {};
|
|
18
|
+
|
|
19
|
+
// Reread group for the first coordinate
|
|
20
|
+
scanner.rewind();
|
|
21
|
+
var curr = scanner.next();
|
|
22
|
+
|
|
23
|
+
var code = curr.code;
|
|
24
|
+
point.x = curr.value;
|
|
25
|
+
|
|
26
|
+
code += 10;
|
|
27
|
+
curr = scanner.next();
|
|
28
|
+
if(curr.code !== code)
|
|
29
|
+
throw new Error('Expected code for point value to be ' + code +
|
|
30
|
+
' but got ' + curr.code + '.');
|
|
31
|
+
point.y = curr.value;
|
|
32
|
+
|
|
33
|
+
code += 10;
|
|
34
|
+
curr = scanner.next();
|
|
35
|
+
if(curr.code !== code)
|
|
36
|
+
{
|
|
37
|
+
// Only the x and y are specified. Don't read z.
|
|
38
|
+
scanner.rewind(); // Let the calling code advance off the point
|
|
39
|
+
return point;
|
|
40
|
+
}
|
|
41
|
+
point.z = curr.value;
|
|
42
|
+
|
|
43
|
+
return point;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Some entities may contain embedded object which is started by group 101. All the rest data until
|
|
47
|
+
* end of entity should not be interpreted as entity attributes. There is no documentation for this
|
|
48
|
+
* feature.
|
|
49
|
+
* @param scanner
|
|
50
|
+
*/
|
|
51
|
+
export function skipEmbeddedObject(scanner) {
|
|
52
|
+
/* Ensure proper start group. */
|
|
53
|
+
scanner.rewind()
|
|
54
|
+
let curr = scanner.next()
|
|
55
|
+
if (curr.code !== 101) {
|
|
56
|
+
throw new Error("Bad call for skipEmbeddedObject()")
|
|
57
|
+
}
|
|
58
|
+
do {
|
|
59
|
+
curr = scanner.next()
|
|
60
|
+
} while (curr.code !== 0)
|
|
61
|
+
scanner.rewind()
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Attempts to parse codes common to all entities. Returns true if the group
|
|
66
|
+
* was handled by this function.
|
|
67
|
+
* @param {*} entity - the entity currently being parsed
|
|
68
|
+
* @param {*} curr - the current group being parsed
|
|
69
|
+
*/
|
|
70
|
+
export function checkCommonEntityProperties(entity, curr, scanner) {
|
|
71
|
+
if (!scanner) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
let xdataParser = null
|
|
75
|
+
while (curr.code >= 1000) {
|
|
76
|
+
if (xdataParser == null) {
|
|
77
|
+
xdataParser = new ExtendedDataParser()
|
|
78
|
+
}
|
|
79
|
+
if (xdataParser.Feed(curr)) {
|
|
80
|
+
xdataParser.Finish(entity)
|
|
81
|
+
xdataParser = null
|
|
82
|
+
} else {
|
|
83
|
+
curr = scanner.next()
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (xdataParser) {
|
|
87
|
+
xdataParser.Finish(entity)
|
|
88
|
+
/* Groups following XDATA should be parsed on next iteration. */
|
|
89
|
+
scanner.rewind()
|
|
90
|
+
return true
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
switch (curr.code) {
|
|
94
|
+
case 0:
|
|
95
|
+
entity.type = curr.value;
|
|
96
|
+
break;
|
|
97
|
+
case 5:
|
|
98
|
+
entity.handle = curr.value;
|
|
99
|
+
break;
|
|
100
|
+
case 6:
|
|
101
|
+
entity.lineType = curr.value;
|
|
102
|
+
break;
|
|
103
|
+
case 8: // Layer name
|
|
104
|
+
entity.layer = curr.value;
|
|
105
|
+
break;
|
|
106
|
+
case 48:
|
|
107
|
+
entity.lineTypeScale = curr.value;
|
|
108
|
+
break;
|
|
109
|
+
case 60:
|
|
110
|
+
entity.visible = curr.value === 0;
|
|
111
|
+
break;
|
|
112
|
+
case 62: // Acad Index Color. 0 inherits ByBlock. 256 inherits ByLayer. Default is bylayer
|
|
113
|
+
entity.colorIndex = curr.value;
|
|
114
|
+
entity.color = getAcadColor(Math.abs(curr.value));
|
|
115
|
+
break;
|
|
116
|
+
case 67:
|
|
117
|
+
entity.inPaperSpace = curr.value !== 0;
|
|
118
|
+
break;
|
|
119
|
+
case 100:
|
|
120
|
+
//ignore
|
|
121
|
+
break;
|
|
122
|
+
case 330:
|
|
123
|
+
entity.ownerHandle = curr.value;
|
|
124
|
+
break;
|
|
125
|
+
case 347:
|
|
126
|
+
entity.materialObjectHandle = curr.value;
|
|
127
|
+
break;
|
|
128
|
+
case 370:
|
|
129
|
+
//From https://www.woutware.com/Forum/Topic/955/lineweight?returnUrl=%2FForum%2FUserPosts%3FuserId%3D478262319
|
|
130
|
+
// An integer representing 100th of mm, must be one of the following values:
|
|
131
|
+
// 0, 5, 9, 13, 15, 18, 20, 25, 30, 35, 40, 50, 53, 60, 70, 80, 90, 100, 106, 120, 140, 158, 200, 211.
|
|
132
|
+
// -3 = STANDARD, -2 = BYLAYER, -1 = BYBLOCK
|
|
133
|
+
entity.lineweight = curr.value;
|
|
134
|
+
break;
|
|
135
|
+
case 420: // TrueColor Color
|
|
136
|
+
entity.color = curr.value;
|
|
137
|
+
break;
|
|
138
|
+
default:
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
|
|
2
|
+
import * as helpers from '../ParseHelpers.js'
|
|
3
|
+
|
|
4
|
+
export default function EntityParser() {}
|
|
5
|
+
|
|
6
|
+
EntityParser.ForEntityName = '3DFACE';
|
|
7
|
+
|
|
8
|
+
EntityParser.prototype.parseEntity = function(scanner, curr) {
|
|
9
|
+
|
|
10
|
+
var entity = { type: curr.value, vertices: [] };
|
|
11
|
+
curr = scanner.next();
|
|
12
|
+
while (curr !== 'EOF') {
|
|
13
|
+
if (curr.code === 0) break;
|
|
14
|
+
switch (curr.code) {
|
|
15
|
+
case 70: // 1 = Closed shape, 128 = plinegen?, 0 = default
|
|
16
|
+
entity.shape = ((curr.value & 1) === 1);
|
|
17
|
+
entity.hasContinuousLinetypePattern = ((curr.value & 128) === 128);
|
|
18
|
+
break;
|
|
19
|
+
case 10: // X coordinate of point
|
|
20
|
+
entity.vertices = parse3dFaceVertices(scanner, curr);
|
|
21
|
+
curr = scanner.lastReadGroup;
|
|
22
|
+
break;
|
|
23
|
+
default:
|
|
24
|
+
helpers.checkCommonEntityProperties(entity, curr, scanner);
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
curr = scanner.next();
|
|
28
|
+
}
|
|
29
|
+
return entity;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
function parse3dFaceVertices(scanner, curr) {
|
|
33
|
+
var vertices = [],
|
|
34
|
+
i;
|
|
35
|
+
var vertexIsStarted = false;
|
|
36
|
+
var vertexIsFinished = false;
|
|
37
|
+
var verticesPer3dFace = 4; // there can be up to four vertices per face, although 3 is most used for TIN
|
|
38
|
+
|
|
39
|
+
for (i = 0; i <= verticesPer3dFace; i++) {
|
|
40
|
+
var vertex = {};
|
|
41
|
+
while (curr !== 'EOF') {
|
|
42
|
+
if (curr.code === 0 || vertexIsFinished) break;
|
|
43
|
+
|
|
44
|
+
switch (curr.code) {
|
|
45
|
+
case 10: // X0
|
|
46
|
+
case 11: // X1
|
|
47
|
+
case 12: // X2
|
|
48
|
+
case 13: // X3
|
|
49
|
+
if (vertexIsStarted) {
|
|
50
|
+
vertexIsFinished = true;
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
vertex.x = curr.value;
|
|
54
|
+
vertexIsStarted = true;
|
|
55
|
+
break;
|
|
56
|
+
case 20: // Y
|
|
57
|
+
case 21:
|
|
58
|
+
case 22:
|
|
59
|
+
case 23:
|
|
60
|
+
vertex.y = curr.value;
|
|
61
|
+
break;
|
|
62
|
+
case 30: // Z
|
|
63
|
+
case 31:
|
|
64
|
+
case 32:
|
|
65
|
+
case 33:
|
|
66
|
+
vertex.z = curr.value;
|
|
67
|
+
break;
|
|
68
|
+
default:
|
|
69
|
+
// it is possible to have entity codes after the vertices.
|
|
70
|
+
// So if code is not accounted for return to entity parser where it might be accounted for
|
|
71
|
+
return vertices;
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
curr = scanner.next();
|
|
75
|
+
}
|
|
76
|
+
// See https://groups.google.com/forum/#!topic/comp.cad.autocad/9gn8s5O_w6E
|
|
77
|
+
vertices.push(vertex);
|
|
78
|
+
vertexIsStarted = false;
|
|
79
|
+
vertexIsFinished = false;
|
|
80
|
+
}
|
|
81
|
+
scanner.rewind();
|
|
82
|
+
return vertices;
|
|
83
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
|
|
2
|
+
import * as helpers from '../ParseHelpers.js'
|
|
3
|
+
|
|
4
|
+
export default function EntityParser() {}
|
|
5
|
+
|
|
6
|
+
EntityParser.ForEntityName = 'ARC';
|
|
7
|
+
|
|
8
|
+
EntityParser.prototype.parseEntity = function(scanner, curr) {
|
|
9
|
+
var entity, endAngle;
|
|
10
|
+
entity = { type: curr.value };
|
|
11
|
+
curr = scanner.next();
|
|
12
|
+
while(curr !== 'EOF') {
|
|
13
|
+
if(curr.code === 0) break;
|
|
14
|
+
|
|
15
|
+
switch(curr.code) {
|
|
16
|
+
case 10: // X coordinate of point
|
|
17
|
+
entity.center = helpers.parsePoint(scanner);
|
|
18
|
+
break;
|
|
19
|
+
case 40: // radius
|
|
20
|
+
entity.radius = curr.value;
|
|
21
|
+
break;
|
|
22
|
+
case 50: // start angle
|
|
23
|
+
entity.startAngle = Math.PI / 180 * curr.value;
|
|
24
|
+
break;
|
|
25
|
+
case 51: // end angle
|
|
26
|
+
entity.endAngle = Math.PI / 180 * curr.value;
|
|
27
|
+
break;
|
|
28
|
+
case 210:
|
|
29
|
+
entity.extrusionDirection = helpers.parsePoint(scanner);
|
|
30
|
+
break;
|
|
31
|
+
default: // ignored attribute
|
|
32
|
+
helpers.checkCommonEntityProperties(entity, curr, scanner);
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
curr = scanner.next();
|
|
36
|
+
}
|
|
37
|
+
return entity;
|
|
38
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import * as helpers from '../ParseHelpers.js';
|
|
2
|
+
|
|
3
|
+
export default function EntityParser() {}
|
|
4
|
+
|
|
5
|
+
EntityParser.ForEntityName = 'ATTDEF';
|
|
6
|
+
|
|
7
|
+
EntityParser.prototype.parseEntity = function (scanner, curr) {
|
|
8
|
+
var entity = {
|
|
9
|
+
type: curr.value,
|
|
10
|
+
scale: 1,
|
|
11
|
+
textStyle: 'STANDARD',
|
|
12
|
+
};
|
|
13
|
+
curr = scanner.next();
|
|
14
|
+
while (curr !== 'EOF') {
|
|
15
|
+
if (curr.code === 0) {
|
|
16
|
+
break;
|
|
17
|
+
}
|
|
18
|
+
switch (curr.code) {
|
|
19
|
+
case 1:
|
|
20
|
+
entity.text = curr.value;
|
|
21
|
+
break;
|
|
22
|
+
case 2:
|
|
23
|
+
entity.tag = curr.value;
|
|
24
|
+
break;
|
|
25
|
+
case 3:
|
|
26
|
+
entity.prompt = curr.value;
|
|
27
|
+
break;
|
|
28
|
+
case 7:
|
|
29
|
+
entity.textStyle = curr.value;
|
|
30
|
+
break;
|
|
31
|
+
case 10: // X coordinate of 'first alignment point'
|
|
32
|
+
entity.startPoint = helpers.parsePoint(scanner);
|
|
33
|
+
break;
|
|
34
|
+
case 11: // X coordinate of 'second alignment point'
|
|
35
|
+
entity.endPoint = helpers.parsePoint(scanner);
|
|
36
|
+
break;
|
|
37
|
+
case 39:
|
|
38
|
+
entity.thickness = curr.value;
|
|
39
|
+
break;
|
|
40
|
+
case 40:
|
|
41
|
+
entity.textHeight = curr.value;
|
|
42
|
+
break;
|
|
43
|
+
case 41:
|
|
44
|
+
entity.scale = curr.value;
|
|
45
|
+
break;
|
|
46
|
+
case 50:
|
|
47
|
+
entity.rotation = curr.value;
|
|
48
|
+
break;
|
|
49
|
+
case 51:
|
|
50
|
+
entity.obliqueAngle = curr.value;
|
|
51
|
+
break;
|
|
52
|
+
case 70:
|
|
53
|
+
entity.invisible = !!(curr.value & 0x01);
|
|
54
|
+
entity.constant = !!(curr.value & 0x02);
|
|
55
|
+
entity.verificationRequired = !!(curr.value & 0x04);
|
|
56
|
+
entity.preset = !!(curr.value & 0x08);
|
|
57
|
+
break;
|
|
58
|
+
case 71:
|
|
59
|
+
entity.backwards = !!(curr.value & 0x02);
|
|
60
|
+
entity.mirrored = !!(curr.value & 0x04);
|
|
61
|
+
break;
|
|
62
|
+
case 72:
|
|
63
|
+
// TODO: enum values?
|
|
64
|
+
entity.horizontalJustification = curr.value;
|
|
65
|
+
break;
|
|
66
|
+
case 73:
|
|
67
|
+
entity.fieldLength = curr.value;
|
|
68
|
+
break;
|
|
69
|
+
case 74:
|
|
70
|
+
// TODO: enum values?
|
|
71
|
+
entity.verticalJustification = curr.value;
|
|
72
|
+
break;
|
|
73
|
+
case 100:
|
|
74
|
+
break;
|
|
75
|
+
case 101:
|
|
76
|
+
helpers.skipEmbeddedObject(scanner);
|
|
77
|
+
break;
|
|
78
|
+
case 210:
|
|
79
|
+
entity.extrusionDirection = helpers.parsePoint(scanner);
|
|
80
|
+
break;
|
|
81
|
+
default:
|
|
82
|
+
helpers.checkCommonEntityProperties(entity, curr, scanner);
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
curr = scanner.next();
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return entity;
|
|
89
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
|
|
2
|
+
import * as attdef from './attdef.js'
|
|
3
|
+
|
|
4
|
+
export default function EntityParser() {}
|
|
5
|
+
|
|
6
|
+
EntityParser.ForEntityName = 'ATTRIB';
|
|
7
|
+
|
|
8
|
+
EntityParser.prototype.parseEntity = function(scanner, curr) {
|
|
9
|
+
var entity = {
|
|
10
|
+
type: curr.value,
|
|
11
|
+
scale: 1,
|
|
12
|
+
textStyle: 'STANDARD'
|
|
13
|
+
};
|
|
14
|
+
curr = scanner.next();
|
|
15
|
+
while (curr !== 'EOF') {
|
|
16
|
+
if (curr.code === 0) {
|
|
17
|
+
break;
|
|
18
|
+
}
|
|
19
|
+
switch(curr.code) {
|
|
20
|
+
case 72: // Horizontal alignment
|
|
21
|
+
entity.halign = curr.value;
|
|
22
|
+
break;
|
|
23
|
+
case 74: // Vertical alignment
|
|
24
|
+
entity.valign = curr.value;
|
|
25
|
+
break;
|
|
26
|
+
default:
|
|
27
|
+
attdef.checkAttProperties(entity, scanner, curr);
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
curr = scanner.next();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return entity;
|
|
34
|
+
};
|