mxdraw 0.1.120 → 0.1.122
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/index.d.ts +210 -114
- package/dist/lib/MxModule/MxDbArcShape/index.d.ts +1 -1
- package/dist/lib/MxModule/MxDbArcShapeDraw/index.d.ts +1 -1
- package/dist/lib/MxModule/MxDbArrow/index.d.ts +20 -0
- package/dist/lib/MxModule/MxDbArrow/index.js +1 -0
- package/dist/lib/MxModule/MxDbCircleArc/index.d.ts +1 -1
- package/dist/lib/MxModule/MxDbEllipseArc/index.d.ts +3 -3
- package/dist/lib/MxModule/MxDbEllipseShape/index.d.ts +3 -0
- package/dist/lib/MxModule/MxDbEllipseShape/index.js +1 -1
- package/dist/lib/MxModule/MxDbEntity/index.d.ts +10 -0
- package/dist/lib/MxModule/MxDbEntity/index.js +1 -1
- package/dist/lib/MxModule/MxDbLineShape/index.d.ts +21 -0
- package/dist/lib/MxModule/MxDbLineShape/index.js +1 -0
- package/dist/lib/MxModule/MxDbRegularPolygon/index.d.ts +6 -8
- package/dist/lib/MxModule/MxDbRegularPolygon/index.js +1 -1
- package/dist/lib/MxModule/MxDbRegularPolygonShape/index.d.ts +2 -1
- package/dist/lib/MxModule/MxDbRegularPolygonShape/index.js +1 -1
- package/dist/lib/MxModule/MxDbSVG/index.js +1 -1
- package/dist/lib/MxModule/MxDbShape/index.d.ts +23 -3
- package/dist/lib/MxModule/MxDbShape/index.js +1 -1
- package/dist/lib/MxModule/MxDbStarShape/index.d.ts +1 -1
- package/dist/lib/MxModule/MxDbText/SpriteText.d.ts +1 -1
- package/dist/lib/MxModule/MxDrawObject/index.d.ts +10 -1
- package/dist/lib/MxModule/MxDrawObject/index.js +1 -1
- package/dist/lib/MxModule/MxFilters/index.d.ts +4 -0
- package/dist/lib/MxModule/MxFilters/index.js +1 -1
- package/dist/lib/MxModule/loadCoreCode/mxfun.es5.js +1 -1
- package/dist/lib/index.d.ts +6 -0
- package/dist/lib/mxdraw.d.ts +2 -0
- package/dist/lib/mxdraw.js +1 -1
- package/dist/mxdraw.es.js +1 -1
- package/dist/mxdraw.umd.js +1 -1
- package/package.json +3 -1
package/dist/index.d.ts
CHANGED
|
@@ -787,6 +787,16 @@ declare abstract class MxDbEntity {
|
|
|
787
787
|
* @returns void
|
|
788
788
|
*/
|
|
789
789
|
removeEvent(name: string): void;
|
|
790
|
+
/**
|
|
791
|
+
* 把一个对象变成一个json字体串.
|
|
792
|
+
* @returns void
|
|
793
|
+
*/
|
|
794
|
+
toJsonString(type?: MxType.MxCloneType): string;
|
|
795
|
+
/**
|
|
796
|
+
* 从一个josn字符串加载数据.
|
|
797
|
+
* @returns void
|
|
798
|
+
*/
|
|
799
|
+
fromJsonString(str: string): boolean;
|
|
790
800
|
}
|
|
791
801
|
|
|
792
802
|
/** @module MxDbGroup */
|
|
@@ -1744,7 +1754,7 @@ declare class MxDrawObject {
|
|
|
1744
1754
|
*/
|
|
1745
1755
|
isMxCAD(): boolean;
|
|
1746
1756
|
/**
|
|
1747
|
-
*
|
|
1757
|
+
* 得执行的内部MxObject对象.
|
|
1748
1758
|
* @example
|
|
1749
1759
|
* ```typescript
|
|
1750
1760
|
*
|
|
@@ -1761,6 +1771,15 @@ declare class MxDrawObject {
|
|
|
1761
1771
|
* ```
|
|
1762
1772
|
*/
|
|
1763
1773
|
getAllLayoutName(): string[];
|
|
1774
|
+
/**
|
|
1775
|
+
* 得到数据库Json字符串数据.
|
|
1776
|
+
* @example
|
|
1777
|
+
* ```typescript
|
|
1778
|
+
*
|
|
1779
|
+
*
|
|
1780
|
+
* ```
|
|
1781
|
+
*/
|
|
1782
|
+
getDtabaseJsonString(): string;
|
|
1764
1783
|
}
|
|
1765
1784
|
|
|
1766
1785
|
/**
|
|
@@ -3356,13 +3375,113 @@ declare class MxDb2LineAngularDimension extends MxDbEntity {
|
|
|
3356
3375
|
getTypeName(): string;
|
|
3357
3376
|
}
|
|
3358
3377
|
|
|
3378
|
+
/** 简单颜色滤镜矩阵 */
|
|
3379
|
+
interface ChannelParamTypes {
|
|
3380
|
+
r?: number;
|
|
3381
|
+
g?: number;
|
|
3382
|
+
b?: number;
|
|
3383
|
+
}
|
|
3384
|
+
declare class MxFilters {
|
|
3385
|
+
private uniformObj;
|
|
3386
|
+
private filtersStr;
|
|
3387
|
+
private filtersTypes;
|
|
3388
|
+
private VSHADER_SOURCE;
|
|
3389
|
+
private FSHADER_SOURCE;
|
|
3390
|
+
private _matrix;
|
|
3391
|
+
/**
|
|
3392
|
+
* 过滤或增强某个颜色通道
|
|
3393
|
+
* @param {ChannelParamTypes}
|
|
3394
|
+
* */
|
|
3395
|
+
channel({ r, g, b }: ChannelParamTypes): this;
|
|
3396
|
+
/**
|
|
3397
|
+
* 改变亮度
|
|
3398
|
+
* @param {number} p
|
|
3399
|
+
* p = 0 全暗,p > 0 且 p < 1 调暗,p = 1 原色, p > 1 调亮
|
|
3400
|
+
* */
|
|
3401
|
+
brightness(p: number): this;
|
|
3402
|
+
/**
|
|
3403
|
+
* 饱和度
|
|
3404
|
+
* @param {number} p
|
|
3405
|
+
* p = 0 完全灰度化,p = 1 原色,p > 1 增强饱和度
|
|
3406
|
+
* */
|
|
3407
|
+
saturate(p: number): this;
|
|
3408
|
+
/**
|
|
3409
|
+
* 对比度
|
|
3410
|
+
* @param {number} p
|
|
3411
|
+
* p = 1 原色, p < 1 减弱对比度,p > 1 增强对比度
|
|
3412
|
+
* */
|
|
3413
|
+
contrast(p: number): this;
|
|
3414
|
+
/**
|
|
3415
|
+
* 透明度
|
|
3416
|
+
* @param {number} p
|
|
3417
|
+
* p = 0 全透明,p = 1 原色
|
|
3418
|
+
* */
|
|
3419
|
+
opacity(p: number): this;
|
|
3420
|
+
/**
|
|
3421
|
+
* 反色
|
|
3422
|
+
* @param {number} p
|
|
3423
|
+
* p = 0 原色, p = 1 完全反色
|
|
3424
|
+
* */
|
|
3425
|
+
invert(p: number): this;
|
|
3426
|
+
/**
|
|
3427
|
+
* 灰度
|
|
3428
|
+
* @param {number} p 0~1
|
|
3429
|
+
* */
|
|
3430
|
+
grayscale(p?: number): this;
|
|
3431
|
+
/**
|
|
3432
|
+
* 深褐色
|
|
3433
|
+
* @param {number} p 0~1
|
|
3434
|
+
* */
|
|
3435
|
+
sepia(p?: number): this;
|
|
3436
|
+
/**
|
|
3437
|
+
* 色相旋转,将色调沿极坐标转过deg角度
|
|
3438
|
+
* @param {number} deg 0~360
|
|
3439
|
+
* */
|
|
3440
|
+
hueRotate(deg: number): this;
|
|
3441
|
+
/**
|
|
3442
|
+
* 色相旋转,将色调沿极坐标转过deg角度
|
|
3443
|
+
* @param {number} deg 0~360
|
|
3444
|
+
* */
|
|
3445
|
+
/**
|
|
3446
|
+
* 卷积
|
|
3447
|
+
* @param {Matrix3} cKernel 3*3的矩阵
|
|
3448
|
+
* @param {number} stStep 1 / 9
|
|
3449
|
+
* @param {number} scaleFactor 521
|
|
3450
|
+
* */
|
|
3451
|
+
convolution(cKernel: THREE.Matrix3, stStep?: number, scaleFactor?: number): this;
|
|
3452
|
+
/**
|
|
3453
|
+
* 重置所有滤镜效果
|
|
3454
|
+
* */
|
|
3455
|
+
reset(): this;
|
|
3456
|
+
_getFilterShaderData(texture: THREE.Texture): {
|
|
3457
|
+
uniforms: {
|
|
3458
|
+
e_Texture: {
|
|
3459
|
+
value: three.Texture;
|
|
3460
|
+
};
|
|
3461
|
+
colorMatrix: {
|
|
3462
|
+
value: three.Matrix4;
|
|
3463
|
+
};
|
|
3464
|
+
};
|
|
3465
|
+
vertexShader: string;
|
|
3466
|
+
fragmentShader: string;
|
|
3467
|
+
};
|
|
3468
|
+
_getFilterColor(color?: string | number | THREE.Color, opacity?: number): three.Color;
|
|
3469
|
+
/** 转成JSON字符串 */
|
|
3470
|
+
toJSON(): string;
|
|
3471
|
+
/** 还原序列化的数据 */
|
|
3472
|
+
static fromJSON(json: string): MxFilters;
|
|
3473
|
+
}
|
|
3474
|
+
|
|
3359
3475
|
/** 动态绘制形状
|
|
3360
|
-
* 基于THREE.Shape
|
|
3476
|
+
* 基于THREE.Shape计算实现的形状
|
|
3477
|
+
* 通过扩展可以实现各种2d 3d形状
|
|
3361
3478
|
* **/
|
|
3362
3479
|
declare class MxDbShape extends MxDbEntity {
|
|
3363
3480
|
protected _paths: THREE.CurvePath<THREE.Vector3 | THREE.Vector2>;
|
|
3364
3481
|
protected points: THREE.Vector3[];
|
|
3365
3482
|
protected closedLine: THREE.Curve<THREE.Vector3>;
|
|
3483
|
+
protected isLoadMaterialFromPath: boolean;
|
|
3484
|
+
protected material: THREE.MeshLambertMaterial | null;
|
|
3366
3485
|
/** 描边颜色 */
|
|
3367
3486
|
stroke: UnstableColor;
|
|
3368
3487
|
setStroke(stroke: UnstableColor): this;
|
|
@@ -3375,12 +3494,28 @@ declare class MxDbShape extends MxDbEntity {
|
|
|
3375
3494
|
/** 填充 */
|
|
3376
3495
|
isFill: boolean;
|
|
3377
3496
|
setIsFill(isFill: boolean): this;
|
|
3497
|
+
/** 填充图片路径 */
|
|
3498
|
+
fillImageSrc?: string;
|
|
3499
|
+
setFillImageSrc(fillImageSrc: string): this;
|
|
3500
|
+
/**
|
|
3501
|
+
* fillImageParam 填充背景图片的参数设置(如果使用了滤镜则部分参数功能失效)
|
|
3502
|
+
* */
|
|
3503
|
+
fillImageParam: {
|
|
3504
|
+
offset?: THREE.Vector2;
|
|
3505
|
+
repeat?: THREE.Vector2;
|
|
3506
|
+
rotation?: number;
|
|
3507
|
+
center?: THREE.Vector2;
|
|
3508
|
+
} | undefined;
|
|
3378
3509
|
/** 线段细分数值 */
|
|
3379
3510
|
curveSegments: number;
|
|
3380
3511
|
setCurveSegments(curveSegments: number): this;
|
|
3381
3512
|
/** 闭合 */
|
|
3382
3513
|
closed: boolean;
|
|
3383
3514
|
setClosed(closed: boolean): this;
|
|
3515
|
+
/**
|
|
3516
|
+
* 设置滤镜对象{@link MxFilters} 默认为undefined | null 则不使用该滤镜效果
|
|
3517
|
+
* */
|
|
3518
|
+
filter: MxFilters | undefined | null;
|
|
3384
3519
|
/** 圆角半径 (一个向量点对应一个角的半径值)*/
|
|
3385
3520
|
cornerRadius: number[] | number;
|
|
3386
3521
|
/**
|
|
@@ -3403,13 +3538,13 @@ declare class MxDbShape extends MxDbEntity {
|
|
|
3403
3538
|
_drawStoreLine(pWorldDraw: McGiWorldDraw, points: THREE.Vector3[], draw?: (pWorldDraw: McGiWorldDraw) => void): void;
|
|
3404
3539
|
/** 获取线段闭合后的曲线点数 */
|
|
3405
3540
|
getClosedPoints(points: THREE.Vector3[]): three.Vector3[];
|
|
3406
|
-
/** 获取闭合线段 */
|
|
3407
|
-
getClosedLine(points: THREE.Vector3[]): THREE.Curve<THREE.Vector3>;
|
|
3408
3541
|
/** 获取长度 */
|
|
3409
3542
|
getTotalLength(): number;
|
|
3410
3543
|
/** 获取面积 */
|
|
3411
3544
|
getArea(): number;
|
|
3412
3545
|
worldDraw(pWorldDraw: McGiWorldDraw): void;
|
|
3546
|
+
/** 图片填充 */
|
|
3547
|
+
_fillImg(pWorldDraw: McGiWorldDraw, points: THREE.Vector3[]): void;
|
|
3413
3548
|
getGripPoints(): THREE.Vector3[];
|
|
3414
3549
|
moveGripPointsAt(index: number, offset: THREE.Vector3): boolean;
|
|
3415
3550
|
dwgIn(obj: any): boolean;
|
|
@@ -3456,6 +3591,9 @@ declare class MxDbEllipseShape extends MxDbShape {
|
|
|
3456
3591
|
};
|
|
3457
3592
|
/** 创建圆弧 */
|
|
3458
3593
|
createEllipseCurve(x?: number, y?: number, xRadius?: number, yRadius?: number, startAngle?: number, endAngle?: number, clockwise?: boolean, rotation?: number): three.EllipseCurve;
|
|
3594
|
+
/** 获取圆角的点集合(椭圆不需要) */
|
|
3595
|
+
getCornerRadiusPoints(points: THREE.Vector3[]): three.Vector3[];
|
|
3596
|
+
getClosedPoints(points: THREE.Vector3[]): THREE.Vector3[];
|
|
3459
3597
|
getClosedLine(points: THREE.Vector3[]): three.CatmullRomCurve3;
|
|
3460
3598
|
getGripPoints(): three.Vector3[];
|
|
3461
3599
|
moveGripPointsAt(index: number, offset: THREE.Vector3): boolean;
|
|
@@ -3546,99 +3684,6 @@ declare class MxDbLine extends MxDbEntity {
|
|
|
3546
3684
|
getGetLength(): number;
|
|
3547
3685
|
}
|
|
3548
3686
|
|
|
3549
|
-
/** 简单颜色滤镜矩阵 */
|
|
3550
|
-
interface ChannelParamTypes {
|
|
3551
|
-
r?: number;
|
|
3552
|
-
g?: number;
|
|
3553
|
-
b?: number;
|
|
3554
|
-
}
|
|
3555
|
-
declare class MxFilters {
|
|
3556
|
-
private uniformObj;
|
|
3557
|
-
private filtersStr;
|
|
3558
|
-
private filtersTypes;
|
|
3559
|
-
private VSHADER_SOURCE;
|
|
3560
|
-
private FSHADER_SOURCE;
|
|
3561
|
-
private _matrix;
|
|
3562
|
-
/**
|
|
3563
|
-
* 过滤或增强某个颜色通道
|
|
3564
|
-
* @param {ChannelParamTypes}
|
|
3565
|
-
* */
|
|
3566
|
-
channel({ r, g, b }: ChannelParamTypes): this;
|
|
3567
|
-
/**
|
|
3568
|
-
* 改变亮度
|
|
3569
|
-
* @param {number} p
|
|
3570
|
-
* p = 0 全暗,p > 0 且 p < 1 调暗,p = 1 原色, p > 1 调亮
|
|
3571
|
-
* */
|
|
3572
|
-
brightness(p: number): this;
|
|
3573
|
-
/**
|
|
3574
|
-
* 饱和度
|
|
3575
|
-
* @param {number} p
|
|
3576
|
-
* p = 0 完全灰度化,p = 1 原色,p > 1 增强饱和度
|
|
3577
|
-
* */
|
|
3578
|
-
saturate(p: number): this;
|
|
3579
|
-
/**
|
|
3580
|
-
* 对比度
|
|
3581
|
-
* @param {number} p
|
|
3582
|
-
* p = 1 原色, p < 1 减弱对比度,p > 1 增强对比度
|
|
3583
|
-
* */
|
|
3584
|
-
contrast(p: number): this;
|
|
3585
|
-
/**
|
|
3586
|
-
* 透明度
|
|
3587
|
-
* @param {number} p
|
|
3588
|
-
* p = 0 全透明,p = 1 原色
|
|
3589
|
-
* */
|
|
3590
|
-
opacity(p: number): this;
|
|
3591
|
-
/**
|
|
3592
|
-
* 反色
|
|
3593
|
-
* @param {number} p
|
|
3594
|
-
* p = 0 原色, p = 1 完全反色
|
|
3595
|
-
* */
|
|
3596
|
-
invert(p: number): this;
|
|
3597
|
-
/**
|
|
3598
|
-
* 灰度
|
|
3599
|
-
* @param {number} p 0~1
|
|
3600
|
-
* */
|
|
3601
|
-
grayscale(p?: number): this;
|
|
3602
|
-
/**
|
|
3603
|
-
* 深褐色
|
|
3604
|
-
* @param {number} p 0~1
|
|
3605
|
-
* */
|
|
3606
|
-
sepia(p?: number): this;
|
|
3607
|
-
/**
|
|
3608
|
-
* 色相旋转,将色调沿极坐标转过deg角度
|
|
3609
|
-
* @param {number} deg 0~360
|
|
3610
|
-
* */
|
|
3611
|
-
hueRotate(deg: number): this;
|
|
3612
|
-
/**
|
|
3613
|
-
* 色相旋转,将色调沿极坐标转过deg角度
|
|
3614
|
-
* @param {number} deg 0~360
|
|
3615
|
-
* */
|
|
3616
|
-
/**
|
|
3617
|
-
* 卷积
|
|
3618
|
-
* @param {Matrix3} cKernel 3*3的矩阵
|
|
3619
|
-
* @param {number} stStep 1 / 9
|
|
3620
|
-
* @param {number} scaleFactor 521
|
|
3621
|
-
* */
|
|
3622
|
-
convolution(cKernel: THREE.Matrix3, stStep?: number, scaleFactor?: number): this;
|
|
3623
|
-
/**
|
|
3624
|
-
* 重置所有滤镜效果
|
|
3625
|
-
* */
|
|
3626
|
-
reset(): this;
|
|
3627
|
-
_getFilterShaderData(texture: THREE.Texture): {
|
|
3628
|
-
uniforms: {
|
|
3629
|
-
e_Texture: {
|
|
3630
|
-
value: three.Texture;
|
|
3631
|
-
};
|
|
3632
|
-
colorMatrix: {
|
|
3633
|
-
value: three.Matrix4;
|
|
3634
|
-
};
|
|
3635
|
-
};
|
|
3636
|
-
vertexShader: string;
|
|
3637
|
-
fragmentShader: string;
|
|
3638
|
-
};
|
|
3639
|
-
_getFilterColor(color?: string | number | THREE.Color, opacity?: number): three.Color;
|
|
3640
|
-
}
|
|
3641
|
-
|
|
3642
3687
|
/**
|
|
3643
3688
|
* MxRectEntity 矩形对象.
|
|
3644
3689
|
*/
|
|
@@ -3879,10 +3924,7 @@ declare class MxDbCloudLine extends MxDbEntity {
|
|
|
3879
3924
|
dwgOut(obj: any): object;
|
|
3880
3925
|
}
|
|
3881
3926
|
|
|
3882
|
-
|
|
3883
|
-
* MxDbRegularPolygon 正多边形
|
|
3884
|
-
*/
|
|
3885
|
-
declare class MxDbRegularPolygon extends MxDbEntity {
|
|
3927
|
+
declare class MxDbRegularPolygon extends MxDbShape {
|
|
3886
3928
|
/** 正多边形的中心点位置 */
|
|
3887
3929
|
centerPoint: three.Vector3;
|
|
3888
3930
|
/** 正多边形两条边之间的交点位置 */
|
|
@@ -3890,12 +3932,13 @@ declare class MxDbRegularPolygon extends MxDbEntity {
|
|
|
3890
3932
|
/** 正多边形边的数量 */
|
|
3891
3933
|
sidesNumber: number;
|
|
3892
3934
|
getTypeName(): string;
|
|
3935
|
+
/**
|
|
3936
|
+
* MxDbRegularPolygon 正多边形
|
|
3937
|
+
*/
|
|
3938
|
+
constructor();
|
|
3893
3939
|
worldDraw(pWorldDraw: McGiWorldDraw): void;
|
|
3894
3940
|
getGripPoints(): THREE.Vector3[];
|
|
3895
3941
|
moveGripPointsAt(index: number, offset: THREE.Vector3): boolean;
|
|
3896
|
-
create(): MxDbEntity;
|
|
3897
|
-
dwgIn(obj: any): boolean;
|
|
3898
|
-
dwgOut(obj: any): object;
|
|
3899
3942
|
}
|
|
3900
3943
|
|
|
3901
3944
|
/** @module MxDbLeadComment*/
|
|
@@ -4002,7 +4045,7 @@ declare class SpriteText extends THREE.Sprite {
|
|
|
4002
4045
|
underline: boolean;
|
|
4003
4046
|
fontStyle: TextFontStyle;
|
|
4004
4047
|
fontVariant: string;
|
|
4005
|
-
|
|
4048
|
+
_genCanvas(): void;
|
|
4006
4049
|
dispose(): void;
|
|
4007
4050
|
}
|
|
4008
4051
|
interface SpriteTextOptions {
|
|
@@ -4248,11 +4291,11 @@ declare class MxDbGradientLine extends MxDbEntity {
|
|
|
4248
4291
|
dwgOut(obj: any): object;
|
|
4249
4292
|
}
|
|
4250
4293
|
|
|
4251
|
-
/**
|
|
4252
|
-
* 根据中心点、椭圆开始点和结束点确定椭圆弧
|
|
4253
|
-
* */
|
|
4254
4294
|
declare class MxDbEllipseArc extends MxDbEllipseShape {
|
|
4255
4295
|
getTypeName(): string;
|
|
4296
|
+
/**
|
|
4297
|
+
* 根据中心点、椭圆开始点和结束点确定椭圆弧
|
|
4298
|
+
* */
|
|
4256
4299
|
constructor();
|
|
4257
4300
|
/** 椭圆弧决定开始点 控制x轴半径和开始角度 */
|
|
4258
4301
|
startPoint: THREE.Vector3;
|
|
@@ -4268,8 +4311,8 @@ declare class MxDbEllipseArc extends MxDbEllipseShape {
|
|
|
4268
4311
|
moveGripPointsAt(index: number, offset: THREE.Vector3): boolean;
|
|
4269
4312
|
}
|
|
4270
4313
|
|
|
4271
|
-
/** 根据圆心、起始点、结束点位置动态绘制圆弧 **/
|
|
4272
4314
|
declare class MxDbCircleArc extends MxDbCircleShape {
|
|
4315
|
+
/** 根据圆心、起始点、结束点位置动态绘制圆弧 **/
|
|
4273
4316
|
constructor();
|
|
4274
4317
|
getTypeName(): string;
|
|
4275
4318
|
/** 圆弧开始点 设置开始点将自动计算 radius、startAngle、endAngle */
|
|
@@ -4284,8 +4327,8 @@ declare class MxDbCircleArc extends MxDbCircleShape {
|
|
|
4284
4327
|
moveGripPointsAt(index: number, offset: THREE.Vector3): boolean;
|
|
4285
4328
|
}
|
|
4286
4329
|
|
|
4287
|
-
/** 弧形 */
|
|
4288
4330
|
declare class MxDbArcShape extends MxDbCircleArc {
|
|
4331
|
+
/** 环形 */
|
|
4289
4332
|
constructor();
|
|
4290
4333
|
getTypeName(): string;
|
|
4291
4334
|
create(): MxDbArcShape;
|
|
@@ -4298,9 +4341,9 @@ declare class MxDbArcShape extends MxDbCircleArc {
|
|
|
4298
4341
|
moveGripPointsAt(index: number, offset: THREE.Vector3): boolean;
|
|
4299
4342
|
}
|
|
4300
4343
|
|
|
4301
|
-
/** 绘制弧形 */
|
|
4302
4344
|
declare class MxDbArcShapeDraw extends MxDbArcShape {
|
|
4303
4345
|
getTypeName(): string;
|
|
4346
|
+
/** 绘制弧形 */
|
|
4304
4347
|
constructor();
|
|
4305
4348
|
outerRadiusPoint: three.Vector3;
|
|
4306
4349
|
interRadiusPoint: three.Vector3;
|
|
@@ -4315,9 +4358,9 @@ declare class MxDbRingShape extends MxDbArcShape {
|
|
|
4315
4358
|
worldDraw(pWorldDraw: McGiWorldDraw): void;
|
|
4316
4359
|
}
|
|
4317
4360
|
|
|
4318
|
-
/** 星形 */
|
|
4319
4361
|
declare class MxDbStarShape extends MxDbShape {
|
|
4320
4362
|
getTypeName(): string;
|
|
4363
|
+
/** 星形 */
|
|
4321
4364
|
constructor();
|
|
4322
4365
|
center: three.Vector3;
|
|
4323
4366
|
numPoints: number;
|
|
@@ -4331,11 +4374,12 @@ declare class MxDbStarShape extends MxDbShape {
|
|
|
4331
4374
|
/** 等边多边形 */
|
|
4332
4375
|
declare class MxDbRegularPolygonShape extends MxDbShape {
|
|
4333
4376
|
center: three.Vector3;
|
|
4334
|
-
|
|
4377
|
+
sidesNumber: number;
|
|
4335
4378
|
radius: number;
|
|
4336
4379
|
getTypeName(): string;
|
|
4337
4380
|
constructor();
|
|
4338
4381
|
worldDraw(pWorldDraw: McGiWorldDraw): void;
|
|
4382
|
+
_drawPolygonShape(pWorldDraw: McGiWorldDraw): void;
|
|
4339
4383
|
_getPoints(): {
|
|
4340
4384
|
x: number;
|
|
4341
4385
|
y: number;
|
|
@@ -4344,6 +4388,45 @@ declare class MxDbRegularPolygonShape extends MxDbShape {
|
|
|
4344
4388
|
moveGripPointsAt(index: number, offset: THREE.Vector3): boolean;
|
|
4345
4389
|
}
|
|
4346
4390
|
|
|
4391
|
+
declare class MxDbArrow extends MxDbShape {
|
|
4392
|
+
/** 箭头图形 */
|
|
4393
|
+
constructor();
|
|
4394
|
+
/** 开始是否为尖角 */
|
|
4395
|
+
isSharpCorner: boolean;
|
|
4396
|
+
/** 内部偏移量 */
|
|
4397
|
+
innerOffset: number;
|
|
4398
|
+
/** 外部偏移量 */
|
|
4399
|
+
outerOffset: number;
|
|
4400
|
+
/** 顶部偏移量 */
|
|
4401
|
+
topOffset: number;
|
|
4402
|
+
startPoint: three.Vector3;
|
|
4403
|
+
endPoint: three.Vector3;
|
|
4404
|
+
worldDraw(pWorldDraw: McGiWorldDraw): void;
|
|
4405
|
+
getArrowVertex(p1: THREE.Vector3, p2: THREE.Vector3, isSharpCorner?: boolean): three.Vector3[] | undefined;
|
|
4406
|
+
getGripPoints(): THREE.Vector3[];
|
|
4407
|
+
moveGripPointsAt(index: number, offset: THREE.Vector3): boolean;
|
|
4408
|
+
}
|
|
4409
|
+
|
|
4410
|
+
/** 线形状 */
|
|
4411
|
+
declare class MxDbLineShape extends MxDbShape {
|
|
4412
|
+
points: THREE.Vector3[];
|
|
4413
|
+
setPoints(points: THREE.Vector3[]): this;
|
|
4414
|
+
addPoint(point: THREE.Vector3): this;
|
|
4415
|
+
removePoint(index: number): this;
|
|
4416
|
+
constructor();
|
|
4417
|
+
getTypeName(): string;
|
|
4418
|
+
worldDraw(pWorldDraw: McGiWorldDraw): void;
|
|
4419
|
+
getGripPoints(): Array<THREE.Vector3>;
|
|
4420
|
+
moveGripPointsAt(index: number, offset: THREE.Vector3): boolean;
|
|
4421
|
+
/** 获取包围盒 */
|
|
4422
|
+
getGeomExtents(): THREE.Box3 | null;
|
|
4423
|
+
/**
|
|
4424
|
+
* 返回曲线长度.
|
|
4425
|
+
* @returns number
|
|
4426
|
+
*/
|
|
4427
|
+
getGetLength(): number;
|
|
4428
|
+
}
|
|
4429
|
+
|
|
4347
4430
|
declare const Mx_loadCoreCode: typeof loadCoreCode;
|
|
4348
4431
|
declare const Mx_useCanvasResizeListener: typeof useCanvasResizeListener;
|
|
4349
4432
|
declare const Mx_store: typeof store;
|
|
@@ -4436,6 +4519,10 @@ type Mx_MxDbStarShape = MxDbStarShape;
|
|
|
4436
4519
|
declare const Mx_MxDbStarShape: typeof MxDbStarShape;
|
|
4437
4520
|
type Mx_MxDbRegularPolygonShape = MxDbRegularPolygonShape;
|
|
4438
4521
|
declare const Mx_MxDbRegularPolygonShape: typeof MxDbRegularPolygonShape;
|
|
4522
|
+
type Mx_MxDbArrow = MxDbArrow;
|
|
4523
|
+
declare const Mx_MxDbArrow: typeof MxDbArrow;
|
|
4524
|
+
type Mx_MxDbLineShape = MxDbLineShape;
|
|
4525
|
+
declare const Mx_MxDbLineShape: typeof MxDbLineShape;
|
|
4439
4526
|
declare namespace Mx {
|
|
4440
4527
|
export {
|
|
4441
4528
|
Mx_loadCoreCode as loadCoreCode,
|
|
@@ -4491,7 +4578,16 @@ declare namespace Mx {
|
|
|
4491
4578
|
Mx_MxDbRingShape as MxDbRingShape,
|
|
4492
4579
|
Mx_MxDbStarShape as MxDbStarShape,
|
|
4493
4580
|
Mx_MxDbRegularPolygonShape as MxDbRegularPolygonShape,
|
|
4581
|
+
Mx_MxDbArrow as MxDbArrow,
|
|
4582
|
+
Mx_MxDbLineShape as MxDbLineShape,
|
|
4494
4583
|
};
|
|
4495
4584
|
}
|
|
4496
4585
|
|
|
4497
|
-
|
|
4586
|
+
declare global {
|
|
4587
|
+
type THREE = typeof THREE;
|
|
4588
|
+
interface Window {
|
|
4589
|
+
THREE: typeof THREE;
|
|
4590
|
+
}
|
|
4591
|
+
}
|
|
4592
|
+
|
|
4593
|
+
export { McEdGetPointWorldDrawObject, McGePoint3d, McGePoint3dArray, McGeTool, McGiWorldDraw, McGiWorldDrawType, MrxDbgUiPrBaseReturn, MrxDbgUiPrPoint, MrxDbgUtils, Mx3PointArc, MxCADObject, MxDb2LineAngularDimension, MxDbAlignedDimension, MxDbAnyLine, MxDbArcShapeDraw, MxDbArea, MxDbArrow, MxDbCircleArc, MxDbCircleShape, MxDbCloudLine, MxDbCoord, MxDbDatabase, MxDbEllipse, MxDbEllipseArc, MxDbEllipseShape, MxDbEntity, MxDbGradientLine, MxDbGroup, MxDbHatch, MxDbImage, MxDbLayerTableRecord, MxDbLeadComment, MxDbLeadTag, MxDbLine, MxDbLineShape, MxDbPolyline, MxDbRect, MxDbRectBoxLeadComment, MxDbRegularPolygon, MxDbRegularPolygonShape, MxDbRingShape, MxDbSVG, MxDbSVGText, MxDbShape, MxDbStarShape, MxDbText, MxDrawObject, MxFilters, MxFun, MxThreeJS, MxType, Mxassembly, Mx as default, loadCoreCode, store, useCanvasResizeListener };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import McGiWorldDraw from "../McGiWorldDraw";
|
|
2
2
|
import MxDbArcShape from "../MxDbArcShape";
|
|
3
|
-
/** 绘制弧形 */
|
|
4
3
|
export default class MxDbArcShapeDraw extends MxDbArcShape {
|
|
5
4
|
getTypeName(): string;
|
|
5
|
+
/** 绘制弧形 */
|
|
6
6
|
constructor();
|
|
7
7
|
outerRadiusPoint: import("three").Vector3;
|
|
8
8
|
interRadiusPoint: import("three").Vector3;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import McGiWorldDraw from "../McGiWorldDraw";
|
|
2
|
+
import MxDbShape from "../MxDbShape";
|
|
3
|
+
export default class MxDbArrow extends MxDbShape {
|
|
4
|
+
/** 箭头图形 */
|
|
5
|
+
constructor();
|
|
6
|
+
/** 开始是否为尖角 */
|
|
7
|
+
isSharpCorner: boolean;
|
|
8
|
+
/** 内部偏移量 */
|
|
9
|
+
innerOffset: number;
|
|
10
|
+
/** 外部偏移量 */
|
|
11
|
+
outerOffset: number;
|
|
12
|
+
/** 顶部偏移量 */
|
|
13
|
+
topOffset: number;
|
|
14
|
+
startPoint: import("three").Vector3;
|
|
15
|
+
endPoint: import("three").Vector3;
|
|
16
|
+
worldDraw(pWorldDraw: McGiWorldDraw): void;
|
|
17
|
+
getArrowVertex(p1: THREE.Vector3, p2: THREE.Vector3, isSharpCorner?: boolean): import("three").Vector3[] | undefined;
|
|
18
|
+
getGripPoints(): THREE.Vector3[];
|
|
19
|
+
moveGripPointsAt(index: number, offset: THREE.Vector3): boolean;
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import MxDbShape from"../MxDbShape";export default class MxDbArrow extends MxDbShape{constructor(){super(),this.isSharpCorner=!0,this.innerOffset=10,this.outerOffset=22,this.topOffset=36,this.startPoint=new THREE.Vector3,this.endPoint=new THREE.Vector3,this._propertyDbKeys=[...this._propertyDbKeys,"outerOffset","topOffset","innerOffset","isSharpCorner","startPoint","endPoint"]}worldDraw(t){const e=this.getArrowVertex(this.startPoint,this.endPoint);e&&(this._draw(t,e),this._drawStoreLine(t,e))}getArrowVertex(t,e,r=this.isSharpCorner){let{innerOffset:s,topOffset:n,outerOffset:o}=this;const i=[];i[3]=e;const x=Math.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y));if(0===x)return;const h=-(e.x-t.x)/x,y=(e.y-t.y)/x,a=t.x+s,f=t.y+x-n,d=t.x+o,E=t.y+x-n,p=t.x-s,c=t.y+x-n,w=t.x-o,P=t.y+x-n;return r?(i[0]=t,i[6]=i[0]):(i[0]=new THREE.Vector3(t.x-(p-t.x)*y,t.y-(p-t.x)*h),i[6]=new THREE.Vector3(t.x+(p-t.x)*y,t.y+(p-t.x)*h),i[7]=i[0]),i[1]=new THREE.Vector3(t.x+(a-t.x)*y-(f-t.y)*h,t.y+(a-t.x)*h+(f-t.y)*y),i[2]=new THREE.Vector3(t.x+(d-t.x)*y-(E-t.y)*h,t.y+(d-t.x)*h+(E-t.y)*y),i[4]=new THREE.Vector3(t.x+(w-t.x)*y-(P-t.y)*h,t.y+(w-t.x)*h+(P-t.y)*y),i[5]=new THREE.Vector3(t.x+(p-t.x)*y-(c-t.y)*h,t.y+(p-t.x)*h+(c-t.y)*y),i}getGripPoints(){const t=new THREE.Vector3;return new THREE.Line3(this.startPoint,this.endPoint).getCenter(t),[this.startPoint,t,this.endPoint]}moveGripPointsAt(t,e){return 0===t&&this.startPoint.add(e),1===t&&(this.startPoint.add(e),this.endPoint.add(e)),2===t&&this.endPoint.add(e),!0}};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import McGiWorldDraw from "../McGiWorldDraw";
|
|
2
2
|
import MxDbCircleShape from "../MxDbCircleShape";
|
|
3
|
-
/** 根据圆心、起始点、结束点位置动态绘制圆弧 **/
|
|
4
3
|
export default class MxDbCircleArc extends MxDbCircleShape {
|
|
4
|
+
/** 根据圆心、起始点、结束点位置动态绘制圆弧 **/
|
|
5
5
|
constructor();
|
|
6
6
|
getTypeName(): string;
|
|
7
7
|
/** 圆弧开始点 设置开始点将自动计算 radius、startAngle、endAngle */
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import McGiWorldDraw from "../McGiWorldDraw";
|
|
2
2
|
import MxDbEllipseShape from "../MxDbEllipseShape";
|
|
3
|
-
/**
|
|
4
|
-
* 根据中心点、椭圆开始点和结束点确定椭圆弧
|
|
5
|
-
* */
|
|
6
3
|
export default class MxDbEllipseArc extends MxDbEllipseShape {
|
|
7
4
|
getTypeName(): string;
|
|
5
|
+
/**
|
|
6
|
+
* 根据中心点、椭圆开始点和结束点确定椭圆弧
|
|
7
|
+
* */
|
|
8
8
|
constructor();
|
|
9
9
|
/** 椭圆弧决定开始点 控制x轴半径和开始角度 */
|
|
10
10
|
startPoint: THREE.Vector3;
|
|
@@ -40,6 +40,9 @@ export default class MxDbEllipseShape extends MxDbShape {
|
|
|
40
40
|
};
|
|
41
41
|
/** 创建圆弧 */
|
|
42
42
|
createEllipseCurve(x?: number, y?: number, xRadius?: number, yRadius?: number, startAngle?: number, endAngle?: number, clockwise?: boolean, rotation?: number): import("three").EllipseCurve;
|
|
43
|
+
/** 获取圆角的点集合(椭圆不需要) */
|
|
44
|
+
getCornerRadiusPoints(points: THREE.Vector3[]): import("three").Vector3[];
|
|
45
|
+
getClosedPoints(points: THREE.Vector3[]): THREE.Vector3[];
|
|
43
46
|
getClosedLine(points: THREE.Vector3[]): import("three").CatmullRomCurve3;
|
|
44
47
|
getGripPoints(): import("three").Vector3[];
|
|
45
48
|
moveGripPointsAt(index: number, offset: THREE.Vector3): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import MxDbShape from"../MxDbShape";export default class MxDbEllipseShape extends MxDbShape{constructor(){super(),this.center=new THREE.Vector3,this.xRadius=10,this.yRadius=10,this.startAngle=0,this.endAngle=2*Math.PI,this.clockwise=!1,this.rotation=0,this.isClosedToCenter=!0,this._propertyDbKeys=[...this._propertyDbKeys,"center","xRadius","yRadius","startAngle","endAngle","clockwise","rotation","isClosedToCenter"]}getTypeName(){return"MxDbEllipseShape"}setCenter(t){return this.center=t,this}setXRadius(t){return this.xRadius=t,this}setYRadius(t){return this.yRadius=t,this}setStartAngle(t){return this.startAngle=t,this}setEndAngle(t){return this.endAngle=t,this}setClockwise(t){return this.clockwise=t,this}setRotation(t){return this.rotation=t,this}setIsClosedToCenter(t){return this.isClosedToCenter=t,this}worldDraw(t){this.drawEllipseShape(t)}drawEllipseShape(t){let{startAngle:e,endAngle:s,clockwise:
|
|
1
|
+
import MxDbShape from"../MxDbShape";export default class MxDbEllipseShape extends MxDbShape{constructor(){super(),this.center=new THREE.Vector3,this.xRadius=10,this.yRadius=10,this.startAngle=0,this.endAngle=2*Math.PI,this.clockwise=!1,this.rotation=0,this.isClosedToCenter=!0,this._propertyDbKeys=[...this._propertyDbKeys,"center","xRadius","yRadius","startAngle","endAngle","clockwise","rotation","isClosedToCenter"]}getTypeName(){return"MxDbEllipseShape"}setCenter(t){return this.center=t,this}setXRadius(t){return this.xRadius=t,this}setYRadius(t){return this.yRadius=t,this}setStartAngle(t){return this.startAngle=t,this}setEndAngle(t){return this.endAngle=t,this}setClockwise(t){return this.clockwise=t,this}setRotation(t){return this.rotation=t,this}setIsClosedToCenter(t){return this.isClosedToCenter=t,this}worldDraw(t){this.drawEllipseShape(t)}drawEllipseShape(t){let{startAngle:e,endAngle:s,clockwise:i}=this;const r=this.createEllipseCurve(),n=this.createPaths(r);let a,h=this.getShapePoints(n);return this._draw(t,h),this._drawStoreLine(t,h),{centralAngle:a=i?s>e?THREE.MathUtils.radToDeg(r.aEndAngle-r.aStartAngle):360-Math.abs(THREE.MathUtils.radToDeg(r.aEndAngle-r.aStartAngle)):e>s?Math.abs(THREE.MathUtils.radToDeg(r.aEndAngle-r.aStartAngle)):360-THREE.MathUtils.radToDeg(r.aEndAngle-r.aStartAngle),curve:r,points:h}}createEllipseCurve(t=this.center.x,e=this.center.y,s=this.xRadius,i=this.yRadius,r=this.startAngle,n=this.endAngle,a=this.clockwise,h=this.rotation){return new THREE.EllipseCurve(t,e,s,i,r,n,a,h)}getCornerRadiusPoints(t){return t}getClosedPoints(t){try{let e=(this._paths||new THREE.CatmullRomCurve3(t,!1,"catmullrom",0)).getLength();this.closedLine=this.getClosedLine(t);const s=this.closedLine.getLength();let i=this.curveSegments/e,r=2.5*(e>this.curveSegments?s*i:1);if(r>20*this.curveSegments&&(r=20*this.curveSegments),r<=0)return t;const n=this.closedLine.getPoints(r);return[...t,...n]}catch(e){return[...t,t[0]]}}getClosedLine(t){const{isClosedToCenter:e,center:s}=this;let i=e?[t[t.length-1],s,t[0]]:[t[t.length-1],t[0]];return new THREE.CatmullRomCurve3(i,!1,"catmullrom",.01)}getGripPoints(){return[this.center]}moveGripPointsAt(t,e){return 0===t&&this.center.add(e),!0}};
|
|
@@ -352,4 +352,14 @@ export default abstract class MxDbEntity {
|
|
|
352
352
|
* @returns void
|
|
353
353
|
*/
|
|
354
354
|
removeEvent(name: string): void;
|
|
355
|
+
/**
|
|
356
|
+
* 把一个对象变成一个json字体串.
|
|
357
|
+
* @returns void
|
|
358
|
+
*/
|
|
359
|
+
toJsonString(type?: MxType.MxCloneType): string;
|
|
360
|
+
/**
|
|
361
|
+
* 从一个josn字符串加载数据.
|
|
362
|
+
* @returns void
|
|
363
|
+
*/
|
|
364
|
+
fromJsonString(str: string): boolean;
|
|
355
365
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import _ from"lodash";import MxType from"../MxType";import store from"../store";export var DataType;!function(t){t[t.Default=0]="Default",t[t.Color=1]="Color",t[t.Vector2=2]="Vector2",t[t.Vector3=3]="Vector3",t[t.Vector4=4]="Vector4",t[t.Matrix3=5]="Matrix3",t[t.Matrix4=6]="Matrix4"}(DataType||(DataType={}));export const MXDBDATATYPE="datatype";const propertyDbKeys=["color","renderOrder","opacity","visible","userData","sGuid","dLineWidth","lineWidthByPixels","dDashArray","dDashRatio","layer"];function getDwgKeyVal(t,e){let i,r="";return _.isObject(e)?(i=e.default,r=e.key):"string"==typeof e&&(r=e),[r,void 0===t[r]?i:t[r]]}export default class MxDbEntity{constructor(){this.color=16777215,this.renderOrder=30,this.opacity=1,this.visible=!0,this.userData={},this.sGuid="",this.dLineWidth=0,this.lineWidthByPixels=!0,this.dDashArray=0,this.dDashRatio=0,this.layer="",this._event={}}initGuid(t){this.sGuid.length>0?console.log("mx: init guid error"):this.sGuid=t}dwgInHelp(t,e,i){let r=this;const s=t.type===MxType.MxCloneType.kMxFileClone||t.type===MxType.MxCloneType.kSaveDwgClone,a=t=>{if(!t)return;const{value:e,[MXDBDATATYPE]:r}=t;switch(r){case DataType.Color:return new THREE.Color(...e);case DataType.Vector2:return new THREE.Vector2(...e);case DataType.Vector3:return new THREE.Vector3(...e);case DataType.Vector4:return new THREE.Vector4(...e);case DataType.Matrix3:return(new THREE.Matrix3).fromArray(e);case DataType.Matrix4:return(new THREE.Matrix4).fromArray(e)}return i&&i.getCacheVal?i.getCacheVal(t):void 0};function n(t){return t instanceof THREE.Color||t instanceof THREE.Vector2||t instanceof THREE.Vector3||t instanceof THREE.Vector4||t instanceof THREE.Matrix3||t instanceof THREE.Matrix4?t.clone():i&&i.getVal?i.getVal(t):void 0}return e.forEach(e=>{const[i,
|
|
1
|
+
import _ from"lodash";import MxType from"../MxType";import store from"../store";export var DataType;!function(t){t[t.Default=0]="Default",t[t.Color=1]="Color",t[t.Vector2=2]="Vector2",t[t.Vector3=3]="Vector3",t[t.Vector4=4]="Vector4",t[t.Matrix3=5]="Matrix3",t[t.Matrix4=6]="Matrix4"}(DataType||(DataType={}));export const MXDBDATATYPE="datatype";const propertyDbKeys=["color","renderOrder","opacity","visible","userData","sGuid","dLineWidth","lineWidthByPixels","dDashArray","dDashRatio","layer"];function getDwgKeyVal(t,e){let i,r="";return _.isObject(e)?(i=e.default,r=e.key):"string"==typeof e&&(r=e),[r,void 0===t[r]?i:t[r]]}export default class MxDbEntity{constructor(){this.color=16777215,this.renderOrder=30,this.opacity=1,this.visible=!0,this.userData={},this.sGuid="",this.dLineWidth=0,this.lineWidthByPixels=!0,this.dDashArray=0,this.dDashRatio=0,this.layer="",this._event={}}initGuid(t){this.sGuid.length>0?console.log("mx: init guid error"):this.sGuid=t}dwgInHelp(t,e,i){let r=this;const s=t.type===MxType.MxCloneType.kMxFileClone||t.type===MxType.MxCloneType.kSaveDwgClone,a=t=>{if(!t)return;const{value:e,[MXDBDATATYPE]:r}=t;switch(r){case DataType.Color:return new THREE.Color(...e);case DataType.Vector2:return new THREE.Vector2(...e);case DataType.Vector3:return new THREE.Vector3(...e);case DataType.Vector4:return new THREE.Vector4(...e);case DataType.Matrix3:return(new THREE.Matrix3).fromArray(e);case DataType.Matrix4:return(new THREE.Matrix4).fromArray(e)}return i&&i.getCacheVal?i.getCacheVal(t):void 0};function n(t){return t instanceof THREE.Color||t instanceof THREE.Vector2||t instanceof THREE.Vector3||t instanceof THREE.Vector4||t instanceof THREE.Matrix3||t instanceof THREE.Matrix4?t.clone():i&&i.getVal?i.getVal(t):void 0}return e.forEach(e=>{const[i,o]=getDwgKeyVal(t,e);r[i]=_.cloneDeepWith(o,s?a:n)}),!0}dwgOutHelp(t,e){const i=t=>t instanceof THREE.Color?{[MXDBDATATYPE]:DataType.Color,value:t.toArray()}:t instanceof THREE.Vector2?{[MXDBDATATYPE]:DataType.Vector2,value:t.toArray()}:t instanceof THREE.Vector3?{[MXDBDATATYPE]:DataType.Vector3,value:t.toArray()}:t instanceof THREE.Vector4?{[MXDBDATATYPE]:DataType.Vector4,value:t.toArray()}:t instanceof THREE.Matrix3?{[MXDBDATATYPE]:DataType.Matrix3,value:t.toArray()}:t instanceof THREE.Matrix4?{[MXDBDATATYPE]:DataType.Matrix4,value:t.toArray()}:void 0;let r=this;const s=t.type===MxType.MxCloneType.kMxFileClone||t.type===MxType.MxCloneType.kSaveDwgClone;return e.forEach(e=>{const[a,n]=getDwgKeyVal(r,e);t[a]=s?_.cloneDeepWith(n,i):n}),t}callEvent(t,e){return void 0!=this._event[t]?this._event[t](e):void 0}create(t){return new(0,this.constructor)(t)}transformBy(t){}getGeomExtents(){return null}getClosestPointTo(t,e=0){return null}getImp(){return this.MxDbEntityImp}setNeedUpdateDisplay(t){let e=this.getImp();return!!e&&(t?e.upDisplay():e.setDirtyDisplay(!0),!0)}getMxObject(){let t=this.getImp();return t?t.getMxObject():null}onViewChange(){return!1}objectId(){let t=this.getImp();return t?t.objectId():0}erase(){let t=this.getImp();return!!t&&t.erase()}setLayer(t){let e=this.getImp();e&&e.nodifySetLayer(),this.layer=t}getLayer(){return this.layer}setColor(t){return this.color=t,this}getColor(){return this.color||16777215}clone(t){let e=this.create(),i={type:t||MxType.MxCloneType.kClone};return this.dwgOut(i),e.dwgIn(i),e.sGuid="",e}onDwgIn(t){this.color=t.color,this.renderOrder=t.renderOrder,this.opacity=t.opacity,this.visible=t.visible,t.userData?this.userData=JSON.parse(JSON.stringify(t.userData)):this.userData={},this.dLineWidth=t.lineWidth,this.lineWidthByPixels=t.lineWidthByPixels,this.dDashArray=t.dashArray,this.dDashRatio=t.dashRatio,this.layer=t.layer,t.guid&&(this.sGuid=t.guid)}onDwgOut(t){t.color=this.color,t.renderOrder=this.renderOrder,t.opacity=this.opacity,t.visible=this.visible,t.lineWidth=this.dLineWidth,t.lineWidthByPixels=this.lineWidthByPixels,t.dashArray=this.dDashArray,t.dashRatio=this.dDashRatio,t.layer=this.layer,t.guid=this.sGuid,Object.keys(this.userData).length>0&&(t.userData=this.userData)}rxInit(){store.state.MxFun.initMxDbEntityType(this)}setRenderOrder(t){this.renderOrder=t}getRenderOrder(){return this.renderOrder}setLineWidthByPixels(t){return this.lineWidthByPixels=t,this}getLineWidthByPixels(){return this.lineWidthByPixels}setLineWidth(t){return this.dLineWidth=t,this}getLineWidth(){return this.dLineWidth}getGetLength(){return 0}setDashLen(t){let e=this.getGetLength();if(e<1e-6||t<1e-6)return this;let i=Math.floor(e/t);return i<1e-6&&(this.dDashRatio=0),this.dDashArray=1/i,this}setDashRatio(t){return this.dDashRatio=t,this}setDashArray(t){return this.dDashArray=t,this}setDash(t,e){return this.dDashArray=t,this.dDashRatio=e,0==this.dLineWidth&&(this.dLineWidth=6,this.lineWidthByPixels=!0),this}getDash(){return{dDashArray:this.dDashArray,dDashRatio:this.dDashRatio}}setDashLineDisplay(t){return t?(this.dDashArray<1e-5&&(this.dDashArray=.03),this.dDashRatio<1e-5&&(this.dDashRatio=.1),0==this.dLineWidth&&(this.dLineWidth=6,this.lineWidthByPixels=!0)):(this.dDashArray=0,this.dDashRatio=0),this}isDashLineDisplay(){return this.dDashArray>0&&this.dDashRatio>0}guid(){return this.sGuid}onEndGripEidt(){this.callEvent("onEndGripEidt")}onStartGripEidt(){return this.callEvent("onStartGripEidt")}addEvent(t,e){this._event[t]=e}removeEvent(t){this._event[t]=void 0}toJsonString(t=MxType.MxCloneType.kMxFileClone){let e={type:t};return this.dwgOut(e),e.TypeName=this.getTypeName(),JSON.stringify(e)}fromJsonString(t){let e=JSON.parse(t);return(e.type==MxType.MxCloneType.kMxFileClone||e.type==MxType.MxCloneType.kClone)&&this.dwgIn(e)}};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import McGiWorldDraw from "../McGiWorldDraw";
|
|
2
|
+
import MxDbShape from "../MxDbShape";
|
|
3
|
+
/** 线形状 */
|
|
4
|
+
export default class MxDbLineShape extends MxDbShape {
|
|
5
|
+
points: THREE.Vector3[];
|
|
6
|
+
setPoints(points: THREE.Vector3[]): this;
|
|
7
|
+
addPoint(point: THREE.Vector3): this;
|
|
8
|
+
removePoint(index: number): this;
|
|
9
|
+
constructor();
|
|
10
|
+
getTypeName(): string;
|
|
11
|
+
worldDraw(pWorldDraw: McGiWorldDraw): void;
|
|
12
|
+
getGripPoints(): Array<THREE.Vector3>;
|
|
13
|
+
moveGripPointsAt(index: number, offset: THREE.Vector3): boolean;
|
|
14
|
+
/** 获取包围盒 */
|
|
15
|
+
getGeomExtents(): THREE.Box3 | null;
|
|
16
|
+
/**
|
|
17
|
+
* 返回曲线长度.
|
|
18
|
+
* @returns number
|
|
19
|
+
*/
|
|
20
|
+
getGetLength(): number;
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import MxDbShape from"../MxDbShape";export default class MxDbLineShape extends MxDbShape{constructor(){super(),this.points=[],this._propertyDbKeys=[...this._propertyDbKeys,"points"]}setPoints(t){return this.points=t,this}addPoint(t){return this.points.push(t),this}removePoint(t){return this.points.splice(t,1),this}getTypeName(){return"MxDbLineShape"}worldDraw(t){this._draw(t,this.points),this._drawStoreLine(t,this.points)}getGripPoints(){return this.points}moveGripPointsAt(t,s){return this.points[t].add(s),!0}getGeomExtents(){return(new THREE.Box3).setFromPoints(this.points)}getGetLength(){let t=0;for(let s=0;s++;s<this.points.length)this.points[s+1]&&(t+=this.points[s].distanceTo(this.points[s+1]));return t}};
|