@mlightcad/libredwg-web 0.7.3 → 0.7.5
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/libredwg-web.js +1347 -5023
- package/dist/libredwg-web.umd.cjs +1347 -5026
- package/lib/converter/converter.d.ts +2 -0
- package/lib/converter/converter.js +272 -348
- package/lib/converter/dwgColorToMLeaderRawColor.d.ts +10 -0
- package/lib/converter/dwgColorToMLeaderRawColor.js +55 -0
- package/lib/converter/entityConverter.d.ts +3 -1
- package/lib/converter/entityConverter.js +679 -562
- package/lib/converter/index.d.ts +1 -0
- package/lib/converter/index.js +1 -0
- package/lib/database/database.d.ts +2 -1
- package/lib/database/entities/index.d.ts +2 -0
- package/lib/database/entities/index.js +2 -0
- package/lib/database/entities/multileader.d.ts +190 -0
- package/lib/database/entities/multileader.js +2 -0
- package/lib/database/entities/shape.d.ts +50 -0
- package/lib/database/entities/shape.js +2 -0
- package/lib/database/objects/index.d.ts +1 -0
- package/lib/database/objects/index.js +1 -0
- package/lib/database/objects/mleaderStyle.d.ts +101 -0
- package/lib/database/objects/mleaderStyle.js +2 -0
- package/lib/libredwg.d.ts +61 -0
- package/lib/libredwg.js +127 -21
- package/lib/types/enums.d.ts +17 -0
- package/lib/types/enums.js +18 -0
- package/package.json +11 -4
- package/wasm/libredwg-web.d.ts +24 -0
- package/wasm/libredwg-web.js +1 -1
- package/wasm/libredwg-web.wasm +0 -0
- package/lib/converter/stringConverter.d.ts +0 -3
- package/lib/converter/stringConverter.js +0 -7
- package/lib/database/entities/unknown.d.ts +0 -7
- package/lib/database/entities/unknown.js +0 -2
- package/lib/database/objects/unknown.d.ts +0 -7
- package/lib/database/objects/unknown.js +0 -2
- package/lib/debug.d.ts +0 -13
- package/lib/debug.js +0 -48
- package/lib/libredwg-web.d.ts +0 -3
- package/lib/libredwg-web.js +0 -2313
- package/lib/utils/common.d.ts +0 -4
- package/lib/utils/common.js +0 -12
- package/lib/utils/index.d.ts +0 -2
- package/lib/utils/index.js +0 -2
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Dwg_Color } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Converts a libredwg {@link Dwg_Color} (CMC) to the DXF MLEADER raw-color int32
|
|
4
|
+
* used by group codes 91/92/93/94 and {@link decodeMLeaderStyleRawColor}.
|
|
5
|
+
*
|
|
6
|
+
* Libredwg stores MLeader component colors as packed int32 in {@link Dwg_Color.rgb}
|
|
7
|
+
* with {@link Dwg_Color.method} mirroring the high-byte type flag (0xC0..0xC8).
|
|
8
|
+
*/
|
|
9
|
+
export declare function dwgColorToMLeaderRawColor(color: Dwg_Color | undefined | null): number | undefined;
|
|
10
|
+
//# sourceMappingURL=dwgColorToMLeaderRawColor.d.ts.map
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Dwg_Color_Method } from '../types';
|
|
2
|
+
/** MLEADER / MLEADERSTYLE packed raw-color type flags (DXF high byte). */
|
|
3
|
+
const RAW_COLOR_TYPE_BY_LAYER = 0xc0;
|
|
4
|
+
const RAW_COLOR_TYPE_BY_BLOCK = 0xc1;
|
|
5
|
+
const RAW_COLOR_TYPE_RGB = 0xc2;
|
|
6
|
+
const RAW_COLOR_TYPE_ACI = 0xc3;
|
|
7
|
+
const RAW_COLOR_TYPE_WINDOW_BG = 0xc8;
|
|
8
|
+
/**
|
|
9
|
+
* Converts a libredwg {@link Dwg_Color} (CMC) to the DXF MLEADER raw-color int32
|
|
10
|
+
* used by group codes 91/92/93/94 and {@link decodeMLeaderStyleRawColor}.
|
|
11
|
+
*
|
|
12
|
+
* Libredwg stores MLeader component colors as packed int32 in {@link Dwg_Color.rgb}
|
|
13
|
+
* with {@link Dwg_Color.method} mirroring the high-byte type flag (0xC0..0xC8).
|
|
14
|
+
*/
|
|
15
|
+
export function dwgColorToMLeaderRawColor(color) {
|
|
16
|
+
if (color == null)
|
|
17
|
+
return undefined;
|
|
18
|
+
const methodNum = color.method;
|
|
19
|
+
const method = color.method != null && methodNum !== 0
|
|
20
|
+
? methodNum
|
|
21
|
+
: ((color.rgb >>> 24) & 0xff);
|
|
22
|
+
const index = color.index;
|
|
23
|
+
if (color.rgb != null &&
|
|
24
|
+
method >= RAW_COLOR_TYPE_BY_LAYER &&
|
|
25
|
+
method <= RAW_COLOR_TYPE_WINDOW_BG &&
|
|
26
|
+
((color.rgb >>> 24) & 0xff) === method) {
|
|
27
|
+
return color.rgb >> 0;
|
|
28
|
+
}
|
|
29
|
+
if (method === Dwg_Color_Method.ByLayer || index === 256) {
|
|
30
|
+
return (RAW_COLOR_TYPE_BY_LAYER << 24) >> 0;
|
|
31
|
+
}
|
|
32
|
+
if (method === Dwg_Color_Method.ByBlock || index === 0) {
|
|
33
|
+
return (RAW_COLOR_TYPE_BY_BLOCK << 24) >> 0;
|
|
34
|
+
}
|
|
35
|
+
if (method === Dwg_Color_Method.None) {
|
|
36
|
+
return (RAW_COLOR_TYPE_WINDOW_BG << 24) >> 0;
|
|
37
|
+
}
|
|
38
|
+
if (method === Dwg_Color_Method.TrueColor) {
|
|
39
|
+
const rgb = color.rgb != null ? color.rgb & 0xffffff : undefined;
|
|
40
|
+
if (rgb != null) {
|
|
41
|
+
return ((RAW_COLOR_TYPE_RGB << 24) | rgb) >> 0;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (method === Dwg_Color_Method.ForegroundColor) {
|
|
45
|
+
return ((RAW_COLOR_TYPE_ACI << 24) | 7) >> 0;
|
|
46
|
+
}
|
|
47
|
+
if (method === Dwg_Color_Method.Entities && index > 0 && index < 256) {
|
|
48
|
+
return ((RAW_COLOR_TYPE_ACI << 24) | (index & 0xff)) >> 0;
|
|
49
|
+
}
|
|
50
|
+
if (index > 0 && index < 256) {
|
|
51
|
+
return ((RAW_COLOR_TYPE_ACI << 24) | (index & 0xff)) >> 0;
|
|
52
|
+
}
|
|
53
|
+
return (RAW_COLOR_TYPE_BY_BLOCK << 24) >> 0;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=dwgColorToMLeaderRawColor.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DwgDatabase, DwgEntity
|
|
1
|
+
import { DwgClassLookup, DwgDatabase, DwgEntity } from '../database';
|
|
2
2
|
import { LibreDwgEx } from '../libredwg';
|
|
3
3
|
import { Dwg_Object_Ptr } from '../types';
|
|
4
4
|
export declare class LibreEntityConverter {
|
|
@@ -32,6 +32,7 @@ export declare class LibreEntityConverter {
|
|
|
32
32
|
private convertLine;
|
|
33
33
|
private convertLWPolyline;
|
|
34
34
|
private convertMLine;
|
|
35
|
+
private convertMultiLeader;
|
|
35
36
|
private convertOle2Frame;
|
|
36
37
|
private convertOleFrame;
|
|
37
38
|
private convertMText;
|
|
@@ -42,6 +43,7 @@ export declare class LibreEntityConverter {
|
|
|
42
43
|
private getOriginalDxfName;
|
|
43
44
|
private convertRay;
|
|
44
45
|
private convertSection;
|
|
46
|
+
private convertShape;
|
|
45
47
|
private convertSolid;
|
|
46
48
|
private convertSpline;
|
|
47
49
|
private convertTable;
|