dxf-json 0.0.21 → 0.0.23
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/package.json +8 -1
- package/.github/FUNDING.yml +0 -1
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -38
- package/.github/ISSUE_TEMPLATE/custom.md +0 -10
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
- package/.github/pull_request_template.md +0 -23
- package/.github/workflows/npm-publish.yml +0 -55
- package/.swcrc +0 -8
- package/jest.config.js +0 -20
- package/src/consts/block.ts +0 -22
- package/src/consts/color.ts +0 -6
- package/src/consts/config.ts +0 -2
- package/src/consts/dimension.ts +0 -69
- package/src/consts/hatch.ts +0 -52
- package/src/consts/header.ts +0 -10
- package/src/consts/index.ts +0 -9
- package/src/consts/lineweight.ts +0 -5
- package/src/consts/measurement.ts +0 -4
- package/src/consts/obscuredLineTypes.ts +0 -21
- package/src/consts/scene.ts +0 -2
- package/src/consts/viewport.ts +0 -62
- package/src/index.ts +0 -3
- package/src/parser/AutoCadColorIndex.ts +0 -265
- package/src/parser/DxfArrayScanner.ts +0 -161
- package/src/parser/DxfParser.ts +0 -109
- package/src/parser/ParseHelpers.ts +0 -124
- package/src/parser/blocks/blocks.test.ts +0 -97
- package/src/parser/blocks/index.ts +0 -88
- package/src/parser/blocks/types.ts +0 -15
- package/src/parser/entities/arc/index.ts +0 -2
- package/src/parser/entities/arc/parser.ts +0 -67
- package/src/parser/entities/arc/types.ts +0 -13
- package/src/parser/entities/attdef/consts.ts +0 -12
- package/src/parser/entities/attdef/index.ts +0 -3
- package/src/parser/entities/attdef/parser.ts +0 -119
- package/src/parser/entities/attdef/types.ts +0 -19
- package/src/parser/entities/attribute/consts.ts +0 -6
- package/src/parser/entities/attribute/index.ts +0 -3
- package/src/parser/entities/attribute/parser.ts +0 -198
- package/src/parser/entities/attribute/types.ts +0 -31
- package/src/parser/entities/circle/index.ts +0 -2
- package/src/parser/entities/circle/parser.ts +0 -58
- package/src/parser/entities/circle/types.ts +0 -11
- package/src/parser/entities/dimension/common.ts +0 -98
- package/src/parser/entities/dimension/index.ts +0 -24
- package/src/parser/entities/dimension/types.ts +0 -65
- package/src/parser/entities/ellipse/index.ts +0 -2
- package/src/parser/entities/ellipse/parser.ts +0 -66
- package/src/parser/entities/ellipse/types.ts +0 -13
- package/src/parser/entities/entities.test.ts +0 -86
- package/src/parser/entities/hatch/boundaryPathData/edge.ts +0 -190
- package/src/parser/entities/hatch/boundaryPathData/index.ts +0 -27
- package/src/parser/entities/hatch/boundaryPathData/polyline.ts +0 -43
- package/src/parser/entities/hatch/boundaryPathData/shared.ts +0 -16
- package/src/parser/entities/hatch/index.ts +0 -189
- package/src/parser/entities/hatch/patternData.ts +0 -57
- package/src/parser/entities/hatch/types/boundaryPath.ts +0 -72
- package/src/parser/entities/hatch/types/definitionLine.ts +0 -14
- package/src/parser/entities/hatch/types/hatch.ts +0 -47
- package/src/parser/entities/hatch/types/index.ts +0 -3
- package/src/parser/entities/index.ts +0 -87
- package/src/parser/entities/insert/index.ts +0 -2
- package/src/parser/entities/insert/parser.ts +0 -106
- package/src/parser/entities/insert/types.ts +0 -19
- package/src/parser/entities/leader/consts.ts +0 -6
- package/src/parser/entities/leader/index.ts +0 -3
- package/src/parser/entities/leader/parser.ts +0 -119
- package/src/parser/entities/leader/types.ts +0 -24
- package/src/parser/entities/line/index.ts +0 -2
- package/src/parser/entities/line/parser.ts +0 -55
- package/src/parser/entities/line/types.ts +0 -11
- package/src/parser/entities/lwpolyline/consts.ts +0 -4
- package/src/parser/entities/lwpolyline/index.ts +0 -3
- package/src/parser/entities/lwpolyline/parser.ts +0 -122
- package/src/parser/entities/lwpolyline/types.ts +0 -21
- package/src/parser/entities/mtext/consts.ts +0 -5
- package/src/parser/entities/mtext/index.ts +0 -3
- package/src/parser/entities/mtext/parser.ts +0 -195
- package/src/parser/entities/mtext/types.ts +0 -34
- package/src/parser/entities/point/index.ts +0 -2
- package/src/parser/entities/point/parser.ts +0 -60
- package/src/parser/entities/point/types.ts +0 -10
- package/src/parser/entities/polyline/consts.ts +0 -17
- package/src/parser/entities/polyline/index.ts +0 -3
- package/src/parser/entities/polyline/parser.ts +0 -126
- package/src/parser/entities/polyline/types.ts +0 -20
- package/src/parser/entities/section/index.ts +0 -2
- package/src/parser/entities/section/parser.ts +0 -104
- package/src/parser/entities/section/types.ts +0 -20
- package/src/parser/entities/shared.ts +0 -166
- package/src/parser/entities/solid/index.ts +0 -2
- package/src/parser/entities/solid/parser.ts +0 -56
- package/src/parser/entities/solid/types.ts +0 -10
- package/src/parser/entities/spline/consts.ts +0 -8
- package/src/parser/entities/spline/index.ts +0 -3
- package/src/parser/entities/spline/parser.ts +0 -121
- package/src/parser/entities/spline/types.ts +0 -22
- package/src/parser/entities/text/consts.ts +0 -21
- package/src/parser/entities/text/index.ts +0 -3
- package/src/parser/entities/text/parser.ts +0 -117
- package/src/parser/entities/text/types.ts +0 -21
- package/src/parser/entities/vertex/consts.ts +0 -10
- package/src/parser/entities/vertex/index.ts +0 -3
- package/src/parser/entities/vertex/parser.ts +0 -90
- package/src/parser/entities/vertex/types.ts +0 -17
- package/src/parser/entities/viewport/index.ts +0 -178
- package/src/parser/entities/viewport/types.ts +0 -58
- package/src/parser/filterDummyBlocks.ts +0 -49
- package/src/parser/header/index.ts +0 -30
- package/src/parser/objects/common.ts +0 -55
- package/src/parser/objects/dictionary.ts +0 -61
- package/src/parser/objects/index.ts +0 -45
- package/src/parser/objects/layout.ts +0 -136
- package/src/parser/objects/plotSettings.ts +0 -231
- package/src/parser/objects/treefy.ts +0 -53
- package/src/parser/objects/types.ts +0 -17
- package/src/parser/shared/index.ts +0 -21
- package/src/parser/shared/parsePoint.ts +0 -37
- package/src/parser/shared/parserGenerator.test.ts +0 -164
- package/src/parser/shared/parserGenerator.ts +0 -180
- package/src/parser/shared/xdata/index.ts +0 -3
- package/src/parser/shared/xdata/interpreter.test.ts +0 -85
- package/src/parser/shared/xdata/interpreter.ts +0 -65
- package/src/parser/shared/xdata/parser.test.ts +0 -66
- package/src/parser/shared/xdata/parser.ts +0 -140
- package/src/parser/shared/xdata/types.ts +0 -22
- package/src/parser/tables/blockRecord/index.ts +0 -2
- package/src/parser/tables/blockRecord/parser.ts +0 -49
- package/src/parser/tables/blockRecord/types.ts +0 -11
- package/src/parser/tables/dimStyle/consts.ts +0 -428
- package/src/parser/tables/dimStyle/index.ts +0 -3
- package/src/parser/tables/dimStyle/parser.ts +0 -37
- package/src/parser/tables/dimStyle/types.ts +0 -164
- package/src/parser/tables/index.ts +0 -2
- package/src/parser/tables/layer/index.ts +0 -2
- package/src/parser/tables/layer/parser.ts +0 -58
- package/src/parser/tables/layer/types.ts +0 -14
- package/src/parser/tables/ltype/consts.ts +0 -6
- package/src/parser/tables/ltype/index.ts +0 -3
- package/src/parser/tables/ltype/parser.ts +0 -110
- package/src/parser/tables/ltype/types.ts +0 -23
- package/src/parser/tables/parser.ts +0 -100
- package/src/parser/tables/shared.ts +0 -32
- package/src/parser/tables/style/index.ts +0 -2
- package/src/parser/tables/style/parser.ts +0 -70
- package/src/parser/tables/style/types.ts +0 -15
- package/src/parser/tables/types.ts +0 -15
- package/src/parser/tables/vport/index.ts +0 -2
- package/src/parser/tables/vport/parser.ts +0 -205
- package/src/parser/tables/vport/types.ts +0 -48
- package/src/parser/types.ts +0 -30
- package/src/types/color.ts +0 -5
- package/src/types/dxfHeader.ts +0 -21
- package/src/types/entity.ts +0 -7
- package/src/types/index.ts +0 -30
- package/src/utils/binarySearch.ts +0 -20
- package/src/utils/disjointSet.ts +0 -52
- package/src/utils/flooding.ts +0 -37
- package/src/utils/functional.ts +0 -124
- package/src/utils/graph.ts +0 -53
- package/src/utils/index.ts +0 -102
- package/src/utils/queue.ts +0 -77
- package/src/utils/triangle.ts +0 -28
- package/tsconfig.json +0 -37
- package/webpack.config.js +0 -53
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { DXFParserSnippet, Identity } from '../../../shared/parserGenerator';
|
|
2
|
-
|
|
3
|
-
export const CommonBoundaryPathDataSnippets: DXFParserSnippet[] = [
|
|
4
|
-
{
|
|
5
|
-
code: 330,
|
|
6
|
-
name: 'sourceBoundaryObjects',
|
|
7
|
-
parser: Identity,
|
|
8
|
-
isMultiple: true,
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
code: 97,
|
|
12
|
-
name: 'numberOfSourceBoundaryObjects',
|
|
13
|
-
parser: Identity,
|
|
14
|
-
},
|
|
15
|
-
// 92는 분기에 써야해서 외부에서 주입함
|
|
16
|
-
];
|
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
import type DxfArrayScanner from '../../DxfArrayScanner';
|
|
2
|
-
import type { ScannerGroup } from '../../DxfArrayScanner';
|
|
3
|
-
import {
|
|
4
|
-
createParser,
|
|
5
|
-
DXFParserSnippet,
|
|
6
|
-
Identity,
|
|
7
|
-
PointParser,
|
|
8
|
-
ToBoolean,
|
|
9
|
-
} from '../../shared/parserGenerator';
|
|
10
|
-
import { CommonEntitySnippets } from '../shared';
|
|
11
|
-
import { parseBoundaryPathData } from './boundaryPathData';
|
|
12
|
-
import { parsePatternData } from './patternData';
|
|
13
|
-
import type { HatchEntity } from './types';
|
|
14
|
-
|
|
15
|
-
const DefaultHathEntity = {
|
|
16
|
-
extrusionDirection: { x: 0, y: 0, z: 1 },
|
|
17
|
-
gradientRotation: 0,
|
|
18
|
-
colorTint: 0,
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const HatchSnippet: DXFParserSnippet[] = [
|
|
22
|
-
{
|
|
23
|
-
// Unused - String (default = LINEAR)
|
|
24
|
-
code: 470,
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
// Unused - Reserved for future use:
|
|
28
|
-
code: 463,
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
code: 462,
|
|
32
|
-
name: 'colorTint',
|
|
33
|
-
parser: Identity,
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
code: 461,
|
|
37
|
-
name: 'gradientDefinition',
|
|
38
|
-
parser: Identity,
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
code: 460,
|
|
42
|
-
name: 'gradientRotation', // radian
|
|
43
|
-
parser: Identity,
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
code: 453,
|
|
47
|
-
name: 'numberOfColors',
|
|
48
|
-
parser: Identity,
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
code: 452,
|
|
52
|
-
name: 'gradientColorFlag',
|
|
53
|
-
parser: Identity,
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
// Unused - Zero is reserved for future use
|
|
57
|
-
code: 451,
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
code: 450,
|
|
61
|
-
name: 'gradientFlag',
|
|
62
|
-
parser: Identity,
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
code: 10,
|
|
66
|
-
name: 'seedPoints',
|
|
67
|
-
parser: PointParser,
|
|
68
|
-
isMultiple: true,
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
// Unused - Number of degenerate boundary paths
|
|
72
|
-
code: 99,
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
code: 11,
|
|
76
|
-
name: 'offsetVector',
|
|
77
|
-
parser: PointParser,
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
code: 98,
|
|
81
|
-
name: 'numberOfSeedPoints',
|
|
82
|
-
parser: Identity,
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
code: 47,
|
|
86
|
-
name: 'pixelSize',
|
|
87
|
-
parser: Identity,
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
code: 53,
|
|
91
|
-
name: 'definitionLines',
|
|
92
|
-
parser: parsePatternData,
|
|
93
|
-
isMultiple: true,
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
code: 78,
|
|
97
|
-
name: 'numberOfDefinitionLines',
|
|
98
|
-
parser: Identity,
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
code: 77,
|
|
102
|
-
name: 'isDouble',
|
|
103
|
-
parser: ToBoolean,
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
code: 73,
|
|
107
|
-
name: 'isAnnotated',
|
|
108
|
-
parser: ToBoolean,
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
code: 41,
|
|
112
|
-
name: 'patternScale',
|
|
113
|
-
parser: Identity,
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
code: 52,
|
|
117
|
-
name: 'patternAngle',
|
|
118
|
-
parser: Identity,
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
code: 76,
|
|
122
|
-
name: 'patternType',
|
|
123
|
-
parser: Identity,
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
code: 75,
|
|
127
|
-
name: 'hatchStyle',
|
|
128
|
-
parser: Identity,
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
code: 92,
|
|
132
|
-
name: 'boundaryPaths',
|
|
133
|
-
parser: parseBoundaryPathData,
|
|
134
|
-
isMultiple: true,
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
code: 91,
|
|
138
|
-
name: 'numberOfBoundaryPaths',
|
|
139
|
-
parser: Identity,
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
code: 71,
|
|
143
|
-
name: 'associativity',
|
|
144
|
-
parser: Identity,
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
code: 63,
|
|
148
|
-
name: 'patternFillColor',
|
|
149
|
-
parser: Identity,
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
code: 70,
|
|
153
|
-
name: 'solidFill',
|
|
154
|
-
parser: Identity,
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
code: 2,
|
|
158
|
-
name: 'patternName',
|
|
159
|
-
parser: Identity,
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
code: 210,
|
|
163
|
-
name: 'extrusionDirection',
|
|
164
|
-
parser: PointParser,
|
|
165
|
-
},
|
|
166
|
-
{
|
|
167
|
-
code: 10,
|
|
168
|
-
name: 'elevationPoint',
|
|
169
|
-
parser: PointParser,
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
code: 100,
|
|
173
|
-
name: 'subclassMarker',
|
|
174
|
-
parser: Identity,
|
|
175
|
-
pushContext: true,
|
|
176
|
-
},
|
|
177
|
-
...CommonEntitySnippets,
|
|
178
|
-
];
|
|
179
|
-
|
|
180
|
-
export class HatchEntityParser {
|
|
181
|
-
static ForEntityName = 'HATCH';
|
|
182
|
-
private parser = createParser(HatchSnippet, DefaultHathEntity);
|
|
183
|
-
|
|
184
|
-
parseEntity(scanner: DxfArrayScanner, curr: ScannerGroup) {
|
|
185
|
-
const entity = {} as any;
|
|
186
|
-
this.parser(curr, scanner, entity);
|
|
187
|
-
return entity as HatchEntity;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import type DxfArrayScanner from '../../DxfArrayScanner';
|
|
2
|
-
import type { ScannerGroup } from '../../DxfArrayScanner';
|
|
3
|
-
import {
|
|
4
|
-
createParser,
|
|
5
|
-
DXFParserSnippet,
|
|
6
|
-
Identity,
|
|
7
|
-
} from '../../shared/parserGenerator';
|
|
8
|
-
|
|
9
|
-
const PatternDataSnippets: DXFParserSnippet[] = [
|
|
10
|
-
{
|
|
11
|
-
code: 49,
|
|
12
|
-
name: 'dashLengths',
|
|
13
|
-
parser: Identity,
|
|
14
|
-
isMultiple: true,
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
code: 79,
|
|
18
|
-
name: 'numberOfDashLengths',
|
|
19
|
-
parser: Identity,
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
code: 45,
|
|
23
|
-
name: 'offset',
|
|
24
|
-
parser: pseudoPointParser,
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
code: 43,
|
|
28
|
-
name: 'base',
|
|
29
|
-
parser: pseudoPointParser,
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
code: 53,
|
|
33
|
-
name: 'angle',
|
|
34
|
-
parser: Identity,
|
|
35
|
-
},
|
|
36
|
-
];
|
|
37
|
-
|
|
38
|
-
function pseudoPointParser(curr: ScannerGroup, scanner: DxfArrayScanner) {
|
|
39
|
-
const nextCode = curr.code + 1;
|
|
40
|
-
const offset = {
|
|
41
|
-
x: curr.value,
|
|
42
|
-
y: 1,
|
|
43
|
-
};
|
|
44
|
-
curr = scanner.next();
|
|
45
|
-
if (curr.code === nextCode) {
|
|
46
|
-
offset.y = curr.value;
|
|
47
|
-
} else {
|
|
48
|
-
scanner.rewind();
|
|
49
|
-
}
|
|
50
|
-
return offset;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export function parsePatternData(curr: ScannerGroup, scanner: DxfArrayScanner) {
|
|
54
|
-
const patternData: any = {};
|
|
55
|
-
createParser(PatternDataSnippets)(curr, scanner, patternData);
|
|
56
|
-
return patternData;
|
|
57
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import type { BoundaryPathEdgeType } from '../../../../consts/hatch';
|
|
2
|
-
import type { Point2D } from '../../../../types';
|
|
3
|
-
|
|
4
|
-
interface BoundaryPathBase {
|
|
5
|
-
boundaryPathTypeFlag: number; // bit combination of BoundaryPathTypeFlag
|
|
6
|
-
numberOfSourceBoundaryObjects: number;
|
|
7
|
-
sourceBoundaryObjects: string[];
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface PolylineBoundaryPath extends BoundaryPathBase {
|
|
11
|
-
hasBulge: boolean;
|
|
12
|
-
isClosed: boolean;
|
|
13
|
-
numberOfVertices: number;
|
|
14
|
-
vertices: (Point2D & {
|
|
15
|
-
bulge: number;
|
|
16
|
-
})[];
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface EdgeBoundaryPath<EdgeType extends BoundaryPathEdge>
|
|
20
|
-
extends BoundaryPathBase {
|
|
21
|
-
numberOfEdges: number;
|
|
22
|
-
edges: EdgeType[];
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
interface BoundaryPathEdgeCommon {
|
|
26
|
-
type: BoundaryPathEdgeType;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export type BoundaryPath =
|
|
30
|
-
| PolylineBoundaryPath
|
|
31
|
-
| EdgeBoundaryPath<BoundaryPathEdge>;
|
|
32
|
-
|
|
33
|
-
export interface LineEdge extends BoundaryPathEdgeCommon {
|
|
34
|
-
start: Point2D;
|
|
35
|
-
end: Point2D;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export interface ArcEdge extends BoundaryPathEdgeCommon {
|
|
39
|
-
center: Point2D;
|
|
40
|
-
radius: number;
|
|
41
|
-
startAngle: number;
|
|
42
|
-
endAngle: number;
|
|
43
|
-
isCCW?: boolean;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export interface EllipseEdge extends BoundaryPathEdgeCommon {
|
|
47
|
-
center: Point2D;
|
|
48
|
-
// end point of major axis relative to center
|
|
49
|
-
end: Point2D;
|
|
50
|
-
lengthOfMinorAxis: number;
|
|
51
|
-
startAngle: number;
|
|
52
|
-
endAngle: number;
|
|
53
|
-
isCCW?: boolean;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export interface SplineEdge extends BoundaryPathEdgeCommon {
|
|
57
|
-
degree: number;
|
|
58
|
-
splineFlag: number;
|
|
59
|
-
isPeriodic?: boolean;
|
|
60
|
-
numberOfKnots: number;
|
|
61
|
-
numberOfControlPoints: number;
|
|
62
|
-
knots: number[];
|
|
63
|
-
controlPoints: (Point2D & {
|
|
64
|
-
weight?: number; // default = 1
|
|
65
|
-
})[];
|
|
66
|
-
numberOfFitData: number;
|
|
67
|
-
fitDatum: Point2D[];
|
|
68
|
-
startTangent: Point2D;
|
|
69
|
-
endTangent: Point2D;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export type BoundaryPathEdge = LineEdge | ArcEdge | EllipseEdge | SplineEdge;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Point2D } from '../../../../types';
|
|
2
|
-
|
|
3
|
-
/*
|
|
4
|
-
* offset이란 선과 선 사이의 간격을 만드는 벡터이다.
|
|
5
|
-
* 그런데 이게 무조건 y축과 평행하다는 보장은 없다.
|
|
6
|
-
* (angle과도 무관하다)
|
|
7
|
-
*/
|
|
8
|
-
export interface HatchDefinitionLine {
|
|
9
|
-
angle: number; // degree
|
|
10
|
-
base: Point2D;
|
|
11
|
-
offset: Point2D;
|
|
12
|
-
numberOfDashLengths: number;
|
|
13
|
-
dashLengths: number[];
|
|
14
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
HatchAssociativity,
|
|
3
|
-
HatchGradientColorFlag,
|
|
4
|
-
HatchGradientFlag,
|
|
5
|
-
HatchPatternType,
|
|
6
|
-
HatchSolidFill,
|
|
7
|
-
HatchStyle,
|
|
8
|
-
} from '../../../../consts/hatch';
|
|
9
|
-
import type { Point3D } from '../../../../types';
|
|
10
|
-
import type { CommonDxfEntity } from '../../shared';
|
|
11
|
-
import type { BoundaryPath } from './boundaryPath';
|
|
12
|
-
import type { HatchDefinitionLine } from './definitionLine';
|
|
13
|
-
|
|
14
|
-
interface HatchEntityBase extends CommonDxfEntity {
|
|
15
|
-
type: 'HATCH';
|
|
16
|
-
subclassMarker: 'AcDbHatch';
|
|
17
|
-
elevationPoint: Point3D;
|
|
18
|
-
extrusionDirection?: Point3D;
|
|
19
|
-
patternName: string;
|
|
20
|
-
solidFill: HatchSolidFill;
|
|
21
|
-
patternFillColor: any; // ?
|
|
22
|
-
associativity: HatchAssociativity;
|
|
23
|
-
numberOfBoundaryPaths: number;
|
|
24
|
-
boundaryPaths: BoundaryPath[];
|
|
25
|
-
hatchStyle: HatchStyle;
|
|
26
|
-
patternType: HatchPatternType;
|
|
27
|
-
patternAngle?: number; // Pattern Fill Only
|
|
28
|
-
patternScale?: number; // Pattern Fill Only
|
|
29
|
-
numberOfDefinitionLines: number;
|
|
30
|
-
definitionLines: HatchDefinitionLine[];
|
|
31
|
-
pixelSize: number;
|
|
32
|
-
numberOfSeedPoints: number;
|
|
33
|
-
offsetVector?: Point3D;
|
|
34
|
-
seedPoints?: Point3D[];
|
|
35
|
-
gradientFlag?: HatchGradientFlag;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export interface GradientHatchEntity extends HatchEntityBase {
|
|
39
|
-
gradientFlag: HatchGradientFlag.Gradient;
|
|
40
|
-
gradientColorFlag: HatchGradientColorFlag;
|
|
41
|
-
numberOfColors: 0 | 2;
|
|
42
|
-
gradientRotation?: number; // radian, default = 0
|
|
43
|
-
gradientDefinition: number; // 0 ~ 1
|
|
44
|
-
colorTint?: number; // 0 ~ 1, default = 0
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export type HatchEntity = GradientHatchEntity | HatchEntityBase;
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import type DxfArrayScanner from '../DxfArrayScanner';
|
|
2
|
-
import { ScannerGroup } from '../DxfArrayScanner';
|
|
3
|
-
import { ensureHandle, isMatched } from '../shared';
|
|
4
|
-
|
|
5
|
-
import { ArcEntityParser } from './arc';
|
|
6
|
-
import { AttDefEntityParser } from './attdef';
|
|
7
|
-
import { AttributeEntityParser } from './attribute';
|
|
8
|
-
import { CircleEntityParser } from './circle';
|
|
9
|
-
import Dimension from './dimension';
|
|
10
|
-
import { EllipseEntityParser } from './ellipse';
|
|
11
|
-
import { InsertEntityParser } from './insert';
|
|
12
|
-
import { LeaderEntityParser } from './leader';
|
|
13
|
-
import { LineEntityParser } from './line/parser';
|
|
14
|
-
import { LWPolylineParser } from './lwpolyline';
|
|
15
|
-
import { MTextEntityParser } from './mtext/parser';
|
|
16
|
-
import { PointEntityParser } from './point';
|
|
17
|
-
import { PolylineParser } from './polyline';
|
|
18
|
-
import { SectionEntityParser } from './section';
|
|
19
|
-
import { SolidEntityParser } from './solid';
|
|
20
|
-
import { SplineEntityParser } from './spline';
|
|
21
|
-
import { TextEntityParser } from './text';
|
|
22
|
-
import { HatchEntityParser } from './hatch';
|
|
23
|
-
import Viewport from './viewport';
|
|
24
|
-
import { CommonDxfEntity } from './shared';
|
|
25
|
-
|
|
26
|
-
const Parsers = Object.fromEntries(
|
|
27
|
-
[
|
|
28
|
-
ArcEntityParser,
|
|
29
|
-
AttDefEntityParser,
|
|
30
|
-
AttributeEntityParser,
|
|
31
|
-
CircleEntityParser,
|
|
32
|
-
Dimension,
|
|
33
|
-
EllipseEntityParser,
|
|
34
|
-
InsertEntityParser,
|
|
35
|
-
LeaderEntityParser,
|
|
36
|
-
LineEntityParser,
|
|
37
|
-
LWPolylineParser,
|
|
38
|
-
MTextEntityParser,
|
|
39
|
-
PointEntityParser,
|
|
40
|
-
PolylineParser,
|
|
41
|
-
SectionEntityParser,
|
|
42
|
-
SolidEntityParser,
|
|
43
|
-
SplineEntityParser,
|
|
44
|
-
TextEntityParser,
|
|
45
|
-
HatchEntityParser,
|
|
46
|
-
Viewport,
|
|
47
|
-
].map((parser) => [parser.ForEntityName, new parser()]),
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Is called after the parser first reads the 0:ENTITIES group. The scanner
|
|
52
|
-
* should be on the start of the first entity already.
|
|
53
|
-
*/
|
|
54
|
-
export function parseEntities(
|
|
55
|
-
curr: ScannerGroup,
|
|
56
|
-
scanner: DxfArrayScanner,
|
|
57
|
-
): CommonDxfEntity[] {
|
|
58
|
-
let entities: any[] = [];
|
|
59
|
-
|
|
60
|
-
while (!isMatched(curr, 0, 'EOF')) {
|
|
61
|
-
if (curr.code === 0) {
|
|
62
|
-
// BLOCK 섹션 안에 ENTITY 섹션이 있을 수도 있고
|
|
63
|
-
// ENTITY 섹션만 따로 있을 수도 있음
|
|
64
|
-
// BLOCK 섹션 안에 들어있는 ENTITY는 ENDBLK으로 끝남
|
|
65
|
-
if (curr.value === 'ENDBLK' || curr.value === 'ENDSEC') {
|
|
66
|
-
scanner.rewind();
|
|
67
|
-
break;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const handler = Parsers[curr.value];
|
|
71
|
-
if (handler) {
|
|
72
|
-
const entityType = curr.value;
|
|
73
|
-
curr = scanner.next();
|
|
74
|
-
|
|
75
|
-
const entity = handler.parseEntity(scanner, curr) as any;
|
|
76
|
-
entity.type = entityType;
|
|
77
|
-
ensureHandle(entity);
|
|
78
|
-
entities.push(entity);
|
|
79
|
-
} else {
|
|
80
|
-
console.warn(`Unsupported ENTITY type: ${curr.value}`);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
curr = scanner.next();
|
|
85
|
-
}
|
|
86
|
-
return entities;
|
|
87
|
-
}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import type DxfArrayScanner from '../../DxfArrayScanner';
|
|
2
|
-
import type { ScannerGroup } from '../../DxfArrayScanner';
|
|
3
|
-
import {
|
|
4
|
-
createParser,
|
|
5
|
-
DXFParserSnippet,
|
|
6
|
-
Identity,
|
|
7
|
-
PointParser,
|
|
8
|
-
ToBoolean,
|
|
9
|
-
} from '../../shared/parserGenerator';
|
|
10
|
-
import { CommonEntitySnippets } from '../shared';
|
|
11
|
-
import type { InsertEntity } from './types';
|
|
12
|
-
|
|
13
|
-
const DefaultInsertEntity = {
|
|
14
|
-
xScale: 1,
|
|
15
|
-
yScale: 1,
|
|
16
|
-
zScale: 1,
|
|
17
|
-
rotation: 0,
|
|
18
|
-
columnCount: 0,
|
|
19
|
-
rowCount: 0,
|
|
20
|
-
columnSpacing: 0,
|
|
21
|
-
rowSpacing: 0,
|
|
22
|
-
extrusionDirection: { x: 0, y: 0, z: 1 },
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const InsertEntityParserSnippets: DXFParserSnippet[] = [
|
|
26
|
-
{
|
|
27
|
-
code: 210,
|
|
28
|
-
name: 'extrusionDirection',
|
|
29
|
-
parser: PointParser,
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
code: 45,
|
|
33
|
-
name: 'rowSpacing',
|
|
34
|
-
parser: Identity,
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
code: 44,
|
|
38
|
-
name: 'columnSpacing',
|
|
39
|
-
parser: Identity,
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
code: 71,
|
|
43
|
-
name: 'rowCount',
|
|
44
|
-
parser: Identity,
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
code: 70,
|
|
48
|
-
name: 'columnCount',
|
|
49
|
-
parser: Identity,
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
code: 50,
|
|
53
|
-
name: 'rotation',
|
|
54
|
-
parser: Identity,
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
code: 43,
|
|
58
|
-
name: 'zScale',
|
|
59
|
-
parser: Identity,
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
code: 42,
|
|
63
|
-
name: 'yScale',
|
|
64
|
-
parser: Identity,
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
code: 41,
|
|
68
|
-
name: 'xScale',
|
|
69
|
-
parser: Identity,
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
code: 10,
|
|
73
|
-
name: 'insertionPoint',
|
|
74
|
-
parser: PointParser,
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
code: 2,
|
|
78
|
-
name: 'name',
|
|
79
|
-
parser: Identity,
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
code: 66,
|
|
83
|
-
name: 'isVariableAttributes',
|
|
84
|
-
parser: ToBoolean,
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
code: 100,
|
|
88
|
-
name: 'subclassMarker',
|
|
89
|
-
parser: Identity,
|
|
90
|
-
},
|
|
91
|
-
...CommonEntitySnippets,
|
|
92
|
-
];
|
|
93
|
-
|
|
94
|
-
export class InsertEntityParser {
|
|
95
|
-
static ForEntityName = 'INSERT';
|
|
96
|
-
private parser = createParser(
|
|
97
|
-
InsertEntityParserSnippets,
|
|
98
|
-
DefaultInsertEntity,
|
|
99
|
-
);
|
|
100
|
-
|
|
101
|
-
parseEntity(scanner: DxfArrayScanner, curr: ScannerGroup) {
|
|
102
|
-
const entity = {} as any;
|
|
103
|
-
this.parser(curr, scanner, entity);
|
|
104
|
-
return entity as InsertEntity;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { Point3D } from '../../../types';
|
|
2
|
-
import type { CommonDxfEntity } from '../shared';
|
|
3
|
-
|
|
4
|
-
export interface InsertEntity extends CommonDxfEntity {
|
|
5
|
-
type: 'INSERT';
|
|
6
|
-
subclassMarker: 'AcDbBlockReference';
|
|
7
|
-
isVariableAttributes?: boolean;
|
|
8
|
-
name: string;
|
|
9
|
-
insertionPoint: Point3D;
|
|
10
|
-
xScale: number;
|
|
11
|
-
yScale: number;
|
|
12
|
-
zScale: number;
|
|
13
|
-
rotation: number; // degree
|
|
14
|
-
columnCount: number;
|
|
15
|
-
rowCount: number;
|
|
16
|
-
columnSpacing: number;
|
|
17
|
-
rowSpacing: number;
|
|
18
|
-
extrusionDirection: Point3D;
|
|
19
|
-
}
|