Skip to content

Commit eeb5ebf

Browse files
author
zhaokai
committed
新编规则测试
1 parent 9f7745f commit eeb5ebf

File tree

16 files changed

+1058
-348
lines changed

16 files changed

+1058
-348
lines changed

src/service/2DPlot/Draw/DrawPolyline2D.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export default class DrawPolyline2D extends DrawObject {
4040
innerOnMouseMove(event) {
4141
const pnt = this.m_coordSys.pointToData([event.pointer.x, event.pointer.y]);
4242
this.m_coords[this.m_coords.length - 1] = new Point(pnt[0], pnt[1]);
43-
if (this.m_coords.length >= 2) {
43+
if (this.m_coords.length >= 2 && this.m_object) {
4444
this.m_object.setPnts(this.m_coords);
4545
this.m_fabricCanvas.requestRenderAll();
4646
}

src/service/2DPlot/Draw/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @Author: zk
44
* @Date: 2021-11-15 17:47:45
55
* @LastEditors: zk
6-
* @LastEditTime: 2022-05-16 19:03:08
6+
* @LastEditTime: 2022-05-18 09:51:56
77
*/
88
import DrawPoint2D from './DrawPoint2D';
99
import DrawPolyline2D from './DrawPolyline2D';
@@ -17,7 +17,8 @@ DrawPlotObjectFactory2D.register("msbl_kidneyarea", DrawPolyline2D);
1717

1818
// 新修规则
1919
DrawPlotObjectFactory2D.register("simpleline", DrawPolyline2D);
20-
20+
DrawPlotObjectFactory2D.register("simplearea", DrawPolyline2D);
21+
DrawPlotObjectFactory2D.register("simplepoint", DrawPoint2D);
2122
// 非规则符号
2223
DrawPlotObjectFactory2D.register("msbl_AssaultArrow", DrawPolyline2D);
2324
DrawPlotObjectFactory2D.register("msbl_MultiArrow", DrawPolyline2D);

src/service/2DPlot/PlotCanvasGroup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* @Author: zk
55
* @Date: 2022-05-13 11:01:10
66
* @LastEditors: zk
7-
* @LastEditTime: 2022-05-13 16:54:34
7+
* @LastEditTime: 2022-05-18 14:52:57
88
*/
99

1010
import { fabric } from 'fabric';

src/service/2DPlot/Shapes/RegularShapes/PlotRegularObject.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @Author: zk
44
* @Date: 2021-11-17 16:12:55
55
* @LastEditors: zk
6-
* @LastEditTime: 2022-05-16 18:52:26
6+
* @LastEditTime: 2022-05-18 14:49:44
77
*/
88

99
import { fabric } from 'fabric';
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* @Description:
3+
* @Author: zk
4+
* @Date: 2021-11-15 17:47:45
5+
* @LastEditors: zk
6+
* @LastEditTime: 2022-05-17 16:34:09
7+
*/
8+
import { fabric } from "fabric";
9+
import PlotRegularObject from "./PlotRegularObject";
10+
import { defined } from "../../../PlotUtilBase/Check";
11+
12+
13+
const _ = require("lodash");
14+
15+
const PlotSimpleArea = fabric.util.createClass(PlotRegularObject, {
16+
isCalcCompareLine:true,
17+
_drawPath(ctx, style) {
18+
if(!this._elem.isMustFill){
19+
this.callSuper("_drawPath",ctx,style)
20+
return
21+
}
22+
Object.keys(style).forEach((key) => {
23+
ctx[key] = style[key];
24+
});
25+
26+
if (defined(style.strokeStyle) && style.strokeStyle !== "") {
27+
ctx.stroke();
28+
}
29+
30+
const canvas = this._elem._getFillCanvas();
31+
if (canvas&&canvas.height>0 && canvas.width>0 ) {
32+
// 创建CanvasPattern对象
33+
const pattern = ctx.createPattern(canvas, "repeat");
34+
// 将新创建的CanvasPattern对象赋值给fillStyle属性
35+
ctx.fillStyle = pattern;
36+
}
37+
if (defined(style.fillRuleStyle) && style.fillRuleStyle !== "") {
38+
ctx.fill(style.fillRuleStyle);
39+
} else {
40+
ctx.fill();
41+
}
42+
},
43+
});
44+
45+
fabric.PlotSimpleArea = PlotSimpleArea;
46+
export default PlotSimpleArea

src/service/2DPlot/Shapes/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @Author: zk
44
* @Date: 2021-11-15 17:47:45
55
* @LastEditors: zk
6-
* @LastEditTime: 2022-05-16 19:02:53
6+
* @LastEditTime: 2022-05-18 09:45:46
77
*/
88
import {PlotObjectFactory} from "./PlotObjectFactory";
99
import PlotRegularPoint from "./RegularShapes/PlotRegularPoint";
@@ -12,6 +12,7 @@ import PlotRegularSurface from "./RegularShapes/PlotRegularSurface";
1212
import PlotIrregularShape from "./IrregularShapes/PlotIrregularShape";
1313
import PlotIrregularShapeByLatlng from "./IrregularShapes/PlotIrregularShapeByLatlng";
1414
import PlotKidneyarea from "./RegularShapes/PlotKidneyarea";
15+
import PlotSimpleArea from "./RegularShapes/PlotSimpleArea";
1516

1617
PlotObjectFactory.register("msbl_regularpoint", PlotRegularPoint);
1718
PlotObjectFactory.register("msbl_regularLine1", PlotRegularObject);
@@ -21,6 +22,9 @@ PlotObjectFactory.register("msbl_kidneyarea", PlotKidneyarea);
2122

2223
// 新修规则
2324
PlotObjectFactory.register("simpleline", PlotRegularObject);
25+
PlotObjectFactory.register("simplearea", PlotSimpleArea);
26+
PlotObjectFactory.register("simplepoint", PlotRegularPoint);
27+
2428

2529
// 非规则符号
2630
PlotObjectFactory.register("msbl_AssaultArrow", PlotIrregularShape);

src/service/PlotBase/SvgLoader/element/Element.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @Author: zk
44
* @Date: 2021-11-04 17:02:07
55
* @LastEditors: zk
6-
* @LastEditTime: 2022-05-16 20:14:26
6+
* @LastEditTime: 2022-05-18 12:41:37
77
*/
88

99
/* eslint-disable guard-for-in */

src/service/PlotBase/SvgLoader/element/RegularElement/KidneyArea.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
22
* @Author: your name
33
* @Date: 2021-06-02 15:16:15
4-
* @LastEditTime: 2022-05-10 17:08:03
5-
* @LastEditors: Do not edit
4+
* @LastEditTime: 2022-05-17 16:18:38
5+
* @LastEditors: zk
66
* @Description: In User Settings Edit
77
* @FilePath: \TypeScript-Babel-Starter\src\Object\RegularElement\RegularSurface.ts
88
*/

0 commit comments

Comments
 (0)