fl-web-component 2.0.19-beta.3 → 2.1.1-beta.0
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/dist/fl-web-component.common.js +4417 -687
- package/dist/fl-web-component.common.js.map +1 -1
- package/dist/fl-web-component.css +1 -1
- package/package.json +1 -1
- package/packages/components/com-flcanvas/components/entityFormatting.js +134 -1
- package/packages/components/com-flcanvas/index.vue +335 -239
- package/packages/components/com-graphics/index.vue +333 -24
- package/src/utils/dxf-parser/AutoCadColorIndex.js +265 -0
- package/src/utils/dxf-parser/DimStyleCodes.js +33 -0
- package/src/utils/dxf-parser/DxfArrayScanner.js +151 -0
- package/src/utils/dxf-parser/DxfParser.js +918 -0
- package/src/utils/dxf-parser/ExtendedDataParser.js +117 -0
- package/src/utils/dxf-parser/LICENSE +21 -0
- package/src/utils/dxf-parser/ParseHelpers.js +140 -0
- package/src/utils/dxf-parser/README.md +8 -0
- package/src/utils/dxf-parser/entities/3dface.js +83 -0
- package/src/utils/dxf-parser/entities/arc.js +38 -0
- package/src/utils/dxf-parser/entities/attdef.js +89 -0
- package/src/utils/dxf-parser/entities/attribute.js +109 -0
- package/src/utils/dxf-parser/entities/circle.js +43 -0
- package/src/utils/dxf-parser/entities/dimension.js +71 -0
- package/src/utils/dxf-parser/entities/ellipse.js +48 -0
- package/src/utils/dxf-parser/entities/hatch.js +348 -0
- package/src/utils/dxf-parser/entities/insert.js +57 -0
- package/src/utils/dxf-parser/entities/line.js +34 -0
- package/src/utils/dxf-parser/entities/lwpolyline.js +103 -0
- package/src/utils/dxf-parser/entities/mtext.js +57 -0
- package/src/utils/dxf-parser/entities/point.js +35 -0
- package/src/utils/dxf-parser/entities/polyline.js +92 -0
- package/src/utils/dxf-parser/entities/solid.js +40 -0
- package/src/utils/dxf-parser/entities/spline.js +70 -0
- package/src/utils/dxf-parser/entities/text.js +50 -0
- package/src/utils/dxf-parser/entities/vertex.js +62 -0
- package/src/utils/threejs/measure-clear-distance.js +1 -1
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AutoCad files sometimes use an indexed color value between 1 and 255 inclusive.
|
|
3
|
+
* Each value corresponds to a color. index 1 is red, that is 16711680 or 0xFF0000.
|
|
4
|
+
* index 0 and 256, while included in this array, are actually reserved for inheritance
|
|
5
|
+
* values in AutoCad so they should not be used for index color lookups.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export default [
|
|
9
|
+
0,
|
|
10
|
+
16711680,
|
|
11
|
+
16776960,
|
|
12
|
+
65280,
|
|
13
|
+
65535,
|
|
14
|
+
255,
|
|
15
|
+
16711935,
|
|
16
|
+
16777215,
|
|
17
|
+
8421504,
|
|
18
|
+
12632256,
|
|
19
|
+
16711680,
|
|
20
|
+
16744319,
|
|
21
|
+
13369344,
|
|
22
|
+
13395558,
|
|
23
|
+
10027008,
|
|
24
|
+
10046540,
|
|
25
|
+
8323072,
|
|
26
|
+
8339263,
|
|
27
|
+
4980736,
|
|
28
|
+
4990502,
|
|
29
|
+
16727808,
|
|
30
|
+
16752511,
|
|
31
|
+
13382400,
|
|
32
|
+
13401958,
|
|
33
|
+
10036736,
|
|
34
|
+
10051404,
|
|
35
|
+
8331008,
|
|
36
|
+
8343359,
|
|
37
|
+
4985600,
|
|
38
|
+
4992806,
|
|
39
|
+
16744192,
|
|
40
|
+
16760703,
|
|
41
|
+
13395456,
|
|
42
|
+
13408614,
|
|
43
|
+
10046464,
|
|
44
|
+
10056268,
|
|
45
|
+
8339200,
|
|
46
|
+
8347455,
|
|
47
|
+
4990464,
|
|
48
|
+
4995366,
|
|
49
|
+
16760576,
|
|
50
|
+
16768895,
|
|
51
|
+
13408512,
|
|
52
|
+
13415014,
|
|
53
|
+
10056192,
|
|
54
|
+
10061132,
|
|
55
|
+
8347392,
|
|
56
|
+
8351551,
|
|
57
|
+
4995328,
|
|
58
|
+
4997670,
|
|
59
|
+
16776960,
|
|
60
|
+
16777087,
|
|
61
|
+
13421568,
|
|
62
|
+
13421670,
|
|
63
|
+
10000384,
|
|
64
|
+
10000460,
|
|
65
|
+
8355584,
|
|
66
|
+
8355647,
|
|
67
|
+
5000192,
|
|
68
|
+
5000230,
|
|
69
|
+
12582656,
|
|
70
|
+
14679935,
|
|
71
|
+
10079232,
|
|
72
|
+
11717734,
|
|
73
|
+
7510016,
|
|
74
|
+
8755276,
|
|
75
|
+
6258432,
|
|
76
|
+
7307071,
|
|
77
|
+
3755008,
|
|
78
|
+
4344870,
|
|
79
|
+
8388352,
|
|
80
|
+
12582783,
|
|
81
|
+
6736896,
|
|
82
|
+
10079334,
|
|
83
|
+
5019648,
|
|
84
|
+
7510092,
|
|
85
|
+
4161280,
|
|
86
|
+
6258495,
|
|
87
|
+
2509824,
|
|
88
|
+
3755046,
|
|
89
|
+
4194048,
|
|
90
|
+
10485631,
|
|
91
|
+
3394560,
|
|
92
|
+
8375398,
|
|
93
|
+
2529280,
|
|
94
|
+
6264908,
|
|
95
|
+
2064128,
|
|
96
|
+
5209919,
|
|
97
|
+
1264640,
|
|
98
|
+
3099686,
|
|
99
|
+
65280,
|
|
100
|
+
8388479,
|
|
101
|
+
52224,
|
|
102
|
+
6736998,
|
|
103
|
+
38912,
|
|
104
|
+
5019724,
|
|
105
|
+
32512,
|
|
106
|
+
4161343,
|
|
107
|
+
19456,
|
|
108
|
+
2509862,
|
|
109
|
+
65343,
|
|
110
|
+
8388511,
|
|
111
|
+
52275,
|
|
112
|
+
6737023,
|
|
113
|
+
38950,
|
|
114
|
+
5019743,
|
|
115
|
+
32543,
|
|
116
|
+
4161359,
|
|
117
|
+
19475,
|
|
118
|
+
2509871,
|
|
119
|
+
65407,
|
|
120
|
+
8388543,
|
|
121
|
+
52326,
|
|
122
|
+
6737049,
|
|
123
|
+
38988,
|
|
124
|
+
5019762,
|
|
125
|
+
32575,
|
|
126
|
+
4161375,
|
|
127
|
+
19494,
|
|
128
|
+
2509881,
|
|
129
|
+
65471,
|
|
130
|
+
8388575,
|
|
131
|
+
52377,
|
|
132
|
+
6737074,
|
|
133
|
+
39026,
|
|
134
|
+
5019781,
|
|
135
|
+
32607,
|
|
136
|
+
4161391,
|
|
137
|
+
19513,
|
|
138
|
+
2509890,
|
|
139
|
+
65535,
|
|
140
|
+
8388607,
|
|
141
|
+
52428,
|
|
142
|
+
6737100,
|
|
143
|
+
39064,
|
|
144
|
+
5019800,
|
|
145
|
+
32639,
|
|
146
|
+
4161407,
|
|
147
|
+
19532,
|
|
148
|
+
2509900,
|
|
149
|
+
49151,
|
|
150
|
+
8380415,
|
|
151
|
+
39372,
|
|
152
|
+
6730444,
|
|
153
|
+
29336,
|
|
154
|
+
5014936,
|
|
155
|
+
24447,
|
|
156
|
+
4157311,
|
|
157
|
+
14668,
|
|
158
|
+
2507340,
|
|
159
|
+
32767,
|
|
160
|
+
8372223,
|
|
161
|
+
26316,
|
|
162
|
+
6724044,
|
|
163
|
+
19608,
|
|
164
|
+
5010072,
|
|
165
|
+
16255,
|
|
166
|
+
4153215,
|
|
167
|
+
9804,
|
|
168
|
+
2505036,
|
|
169
|
+
16383,
|
|
170
|
+
8364031,
|
|
171
|
+
13260,
|
|
172
|
+
6717388,
|
|
173
|
+
9880,
|
|
174
|
+
5005208,
|
|
175
|
+
8063,
|
|
176
|
+
4149119,
|
|
177
|
+
4940,
|
|
178
|
+
2502476,
|
|
179
|
+
255,
|
|
180
|
+
8355839,
|
|
181
|
+
204,
|
|
182
|
+
6710988,
|
|
183
|
+
152,
|
|
184
|
+
5000344,
|
|
185
|
+
127,
|
|
186
|
+
4145023,
|
|
187
|
+
76,
|
|
188
|
+
2500172,
|
|
189
|
+
4129023,
|
|
190
|
+
10452991,
|
|
191
|
+
3342540,
|
|
192
|
+
8349388,
|
|
193
|
+
2490520,
|
|
194
|
+
6245528,
|
|
195
|
+
2031743,
|
|
196
|
+
5193599,
|
|
197
|
+
1245260,
|
|
198
|
+
3089996,
|
|
199
|
+
8323327,
|
|
200
|
+
12550143,
|
|
201
|
+
6684876,
|
|
202
|
+
10053324,
|
|
203
|
+
4980888,
|
|
204
|
+
7490712,
|
|
205
|
+
4128895,
|
|
206
|
+
6242175,
|
|
207
|
+
2490444,
|
|
208
|
+
3745356,
|
|
209
|
+
12517631,
|
|
210
|
+
14647295,
|
|
211
|
+
10027212,
|
|
212
|
+
11691724,
|
|
213
|
+
7471256,
|
|
214
|
+
8735896,
|
|
215
|
+
6226047,
|
|
216
|
+
7290751,
|
|
217
|
+
3735628,
|
|
218
|
+
4335180,
|
|
219
|
+
16711935,
|
|
220
|
+
16744447,
|
|
221
|
+
13369548,
|
|
222
|
+
13395660,
|
|
223
|
+
9961624,
|
|
224
|
+
9981080,
|
|
225
|
+
8323199,
|
|
226
|
+
8339327,
|
|
227
|
+
4980812,
|
|
228
|
+
4990540,
|
|
229
|
+
16711871,
|
|
230
|
+
16744415,
|
|
231
|
+
13369497,
|
|
232
|
+
13395634,
|
|
233
|
+
9961586,
|
|
234
|
+
9981061,
|
|
235
|
+
8323167,
|
|
236
|
+
8339311,
|
|
237
|
+
4980793,
|
|
238
|
+
4990530,
|
|
239
|
+
16711807,
|
|
240
|
+
16744383,
|
|
241
|
+
13369446,
|
|
242
|
+
13395609,
|
|
243
|
+
9961548,
|
|
244
|
+
9981042,
|
|
245
|
+
8323135,
|
|
246
|
+
8339295,
|
|
247
|
+
4980774,
|
|
248
|
+
4990521,
|
|
249
|
+
16711743,
|
|
250
|
+
16744351,
|
|
251
|
+
13369395,
|
|
252
|
+
13395583,
|
|
253
|
+
9961510,
|
|
254
|
+
9981023,
|
|
255
|
+
8323103,
|
|
256
|
+
8339279,
|
|
257
|
+
4980755,
|
|
258
|
+
4990511,
|
|
259
|
+
3355443,
|
|
260
|
+
5987163,
|
|
261
|
+
8684676,
|
|
262
|
+
11382189,
|
|
263
|
+
14079702,
|
|
264
|
+
16777215
|
|
265
|
+
];
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** Dimension style variables are used either in DIMSTYLE table or in DIMENSION entity style
|
|
2
|
+
* override in XDATA.
|
|
3
|
+
*/
|
|
4
|
+
const codes = new Map([
|
|
5
|
+
[140, "DIMTXT"],
|
|
6
|
+
[142, "DIMTSZ"],
|
|
7
|
+
[144, "DIMLFAC"],
|
|
8
|
+
[147, "DIMGAP"],
|
|
9
|
+
[173, "DIMSAH"],
|
|
10
|
+
[175, "DIMSOXD"],
|
|
11
|
+
[176, "DIMCLRD"],
|
|
12
|
+
[177, "DIMCLRE"],
|
|
13
|
+
[178, "DIMCLRT"],
|
|
14
|
+
[271, "DIMDEC"],
|
|
15
|
+
[278 ,"DIMDSEP"],
|
|
16
|
+
[281, "DIMSD1"],
|
|
17
|
+
[282, "DIMSD2"],
|
|
18
|
+
[3, "DIMPOST"],
|
|
19
|
+
[40, "DIMSCALE"],
|
|
20
|
+
[41, "DIMASZ"],
|
|
21
|
+
[42, "DIMEXO"],
|
|
22
|
+
[44, "DIMEXE"],
|
|
23
|
+
[45, "DIMRND"],
|
|
24
|
+
[46, "DIMDLE"],
|
|
25
|
+
[5, "DIMBLK"],
|
|
26
|
+
[6, "DIMBLK1"],
|
|
27
|
+
[7, "DIMBLK2"],
|
|
28
|
+
[75, "DIMSE1"],
|
|
29
|
+
[76, "DIMSE2"],
|
|
30
|
+
[78, "DIMZIN"],
|
|
31
|
+
])
|
|
32
|
+
|
|
33
|
+
export default codes
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DxfArrayScanner
|
|
3
|
+
*
|
|
4
|
+
* Based off the AutoCad 2012 DXF Reference
|
|
5
|
+
* http://images.autodesk.com/adsk/files/autocad_2012_pdf_dxf-reference_enu.pdf
|
|
6
|
+
*
|
|
7
|
+
* Reads through an array representing lines of a dxf file. Takes an array and
|
|
8
|
+
* provides an easy interface to extract group code and value pairs.
|
|
9
|
+
* @param data - an array where each element represents a line in the dxf file
|
|
10
|
+
* @constructor
|
|
11
|
+
*/
|
|
12
|
+
export default function DxfArrayScanner(data) {
|
|
13
|
+
this._pointer = 0;
|
|
14
|
+
this._data = data;
|
|
15
|
+
this._eof = false;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Gets the next group (code, value) from the array. A group is two consecutive elements
|
|
20
|
+
* in the array. The first is the code, the second is the value.
|
|
21
|
+
* @returns {{code: Number}|*}
|
|
22
|
+
*/
|
|
23
|
+
DxfArrayScanner.prototype.next = function() {
|
|
24
|
+
var group;
|
|
25
|
+
if(!this.hasNext()) {
|
|
26
|
+
if(!this._eof)
|
|
27
|
+
throw new Error('Unexpected end of input: EOF group not read before end of file. Ended on code ' + this._data[this._pointer]);
|
|
28
|
+
else
|
|
29
|
+
throw new Error('Cannot call \'next\' after EOF group has been read');
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
group = {
|
|
33
|
+
code: parseInt(this._data[this._pointer])
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
if (isNaN(group.code)) {
|
|
37
|
+
throw new Error("Cannot parse group code: " + this._data[this._pointer])
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
this._pointer++;
|
|
41
|
+
|
|
42
|
+
group.value = parseGroupValue(group.code, this._data[this._pointer]);
|
|
43
|
+
|
|
44
|
+
this._pointer++;
|
|
45
|
+
|
|
46
|
+
if(group.code === 0 && group.value === 'EOF') this._eof = true;
|
|
47
|
+
|
|
48
|
+
this.lastReadGroup = group;
|
|
49
|
+
|
|
50
|
+
return group;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
DxfArrayScanner.prototype.peek = function() {
|
|
54
|
+
if(!this.hasNext()) {
|
|
55
|
+
if(!this._eof)
|
|
56
|
+
throw new Error('Unexpected end of input: EOF group not read before end of file. Ended on code ' + this._data[this._pointer]);
|
|
57
|
+
else
|
|
58
|
+
throw new Error('Cannot call \'next\' after EOF group has been read');
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
var group = {
|
|
62
|
+
code: parseInt(this._data[this._pointer])
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
if (isNaN(group.code)) {
|
|
66
|
+
throw new Error("Cannot parse group code: " + this._data[this._pointer])
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
group.value = parseGroupValue(group.code, this._data[this._pointer + 1]);
|
|
70
|
+
|
|
71
|
+
return group;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
DxfArrayScanner.prototype.rewind = function(numberOfGroups) {
|
|
76
|
+
numberOfGroups = numberOfGroups || 1;
|
|
77
|
+
this._pointer = this._pointer - numberOfGroups * 2;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Returns true if there is another code/value pair (2 elements in the array).
|
|
82
|
+
* @returns {boolean}
|
|
83
|
+
*/
|
|
84
|
+
DxfArrayScanner.prototype.hasNext = function() {
|
|
85
|
+
// Check if we have read EOF group code
|
|
86
|
+
if(this._eof) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// We need to be sure there are two lines available
|
|
91
|
+
if(this._pointer > this._data.length - 2) {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
return true;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Returns true if the scanner is at the end of the array
|
|
99
|
+
* @returns {boolean}
|
|
100
|
+
*/
|
|
101
|
+
DxfArrayScanner.prototype.isEOF = function() {
|
|
102
|
+
return this._eof;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Parse a value to its proper type.
|
|
107
|
+
* See pages 3 - 10 of the AutoCad DXF 2012 reference given at the top of this file
|
|
108
|
+
*
|
|
109
|
+
* @param code
|
|
110
|
+
* @param value
|
|
111
|
+
* @returns {*}
|
|
112
|
+
*/
|
|
113
|
+
function parseGroupValue(code, value) {
|
|
114
|
+
if(code <= 9) return value;
|
|
115
|
+
if(code >= 10 && code <= 59) return parseFloat(value.trim());
|
|
116
|
+
if(code >= 60 && code <= 99) return parseInt(value.trim());
|
|
117
|
+
if(code >= 100 && code <= 109) return value;
|
|
118
|
+
if(code >= 110 && code <= 149) return parseFloat(value.trim());
|
|
119
|
+
if(code >= 160 && code <= 179) return parseInt(value.trim());
|
|
120
|
+
if(code >= 210 && code <= 239) return parseFloat(value.trim());
|
|
121
|
+
if(code >= 270 && code <= 289) return parseInt(value.trim());
|
|
122
|
+
if(code >= 290 && code <= 299) return parseBoolean(value.trim());
|
|
123
|
+
if(code >= 300 && code <= 369) return value;
|
|
124
|
+
if(code >= 370 && code <= 389) return parseInt(value.trim());
|
|
125
|
+
if(code >= 390 && code <= 399) return value;
|
|
126
|
+
if(code >= 400 && code <= 409) return parseInt(value.trim());
|
|
127
|
+
if(code >= 410 && code <= 419) return value;
|
|
128
|
+
if(code >= 420 && code <= 429) return parseInt(value.trim());
|
|
129
|
+
if(code >= 430 && code <= 439) return value;
|
|
130
|
+
if(code >= 440 && code <= 459) return parseInt(value.trim());
|
|
131
|
+
if(code >= 460 && code <= 469) return parseFloat(value.trim());
|
|
132
|
+
if(code >= 470 && code <= 481) return value;
|
|
133
|
+
if(code === 999) return value;
|
|
134
|
+
if(code >= 1000 && code <= 1009) return value;
|
|
135
|
+
if(code >= 1010 && code <= 1059) return parseFloat(value.trim());
|
|
136
|
+
if(code >= 1060 && code <= 1071) return parseInt(value.trim());
|
|
137
|
+
|
|
138
|
+
console.log('WARNING: Group code does not have a defined type: %j', { code: code, value: value });
|
|
139
|
+
return value;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Parse a boolean according to a 1 or 0 value
|
|
144
|
+
* @param str
|
|
145
|
+
* @returns {boolean}
|
|
146
|
+
*/
|
|
147
|
+
function parseBoolean(str) {
|
|
148
|
+
if(str === '0') return false;
|
|
149
|
+
if(str === '1') return true;
|
|
150
|
+
throw TypeError('String \'' + str + '\' cannot be cast to Boolean type');
|
|
151
|
+
}
|