@labelbee/lb-annotation 1.14.0-alpha.3 → 1.14.0-alpha.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.
Files changed (188) hide show
  1. package/dist/_virtual/MathUtilsWorker.js +1 -8
  2. package/dist/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js +2 -35
  3. package/dist/_virtual/filterBoxWorker.js +1 -8
  4. package/dist/_virtual/highlightWorker.js +1 -8
  5. package/dist/assets/attributeIcon/icon_canvasEdit0.svg.js +1 -5
  6. package/dist/assets/attributeIcon/icon_canvasEdit1.svg.js +1 -5
  7. package/dist/assets/attributeIcon/icon_canvasEdit2.svg.js +1 -5
  8. package/dist/assets/attributeIcon/icon_canvasEdit3.svg.js +1 -5
  9. package/dist/assets/attributeIcon/icon_canvasEdit4.svg.js +1 -5
  10. package/dist/assets/attributeIcon/icon_canvasEdit5.svg.js +1 -5
  11. package/dist/assets/attributeIcon/icon_canvasEdit6.svg.js +1 -5
  12. package/dist/assets/attributeIcon/icon_canvasEdit7.svg.js +1 -5
  13. package/dist/assets/attributeIcon/icon_canvasEdit8.svg.js +1 -5
  14. package/dist/assets/attributeIcon/icon_canvasEdit_miss.svg.js +1 -5
  15. package/dist/assets/attributeIcon/icon_cuboidFAB.svg.js +5 -5
  16. package/dist/assets/attributeIcon/icon_cuboidLeft.svg.js +7 -5
  17. package/dist/assets/attributeIcon/icon_cuboidMore.svg.js +5 -5
  18. package/dist/assets/attributeIcon/icon_cuboidRight.svg.js +5 -5
  19. package/dist/assets/attributeIcon/icon_cuboidTop.svg.js +12 -5
  20. package/dist/assets/attributeIcon/icon_editFEN.svg.js +1 -5
  21. package/dist/assets/attributeIcon/icon_editHUANG.svg.js +1 -5
  22. package/dist/assets/attributeIcon/icon_editLAN.svg.js +1 -5
  23. package/dist/assets/attributeIcon/icon_editLV.svg.js +1 -5
  24. package/dist/assets/attributeIcon/icon_editQING.svg.js +1 -5
  25. package/dist/constant/annotation.js +1 -127
  26. package/dist/constant/annotationTask.js +1 -30
  27. package/dist/constant/defaultConfig.js +1 -266
  28. package/dist/constant/keyCode.js +1 -38
  29. package/dist/constant/style.js +1 -98
  30. package/dist/constant/tool.js +1 -236
  31. package/dist/core/index.js +1 -150
  32. package/dist/core/pointCloud/OrbitControls.js +1 -665
  33. package/dist/core/pointCloud/PCDLoader.js +2 -260
  34. package/dist/core/pointCloud/annotation.js +1 -215
  35. package/dist/core/pointCloud/cache.js +1 -53
  36. package/dist/core/pointCloud/index.js +5 -991
  37. package/dist/core/pointCloud/matrix.js +1 -138
  38. package/dist/core/scheduler.js +1 -233
  39. package/dist/core/toolOperation/LineToolOperation.js +1 -1434
  40. package/dist/core/toolOperation/ScribbleTool.js +1 -292
  41. package/dist/core/toolOperation/TextToolOperation.js +1 -131
  42. package/dist/core/toolOperation/ViewOperation.js +1 -556
  43. package/dist/core/toolOperation/basicToolOperation.js +1 -881
  44. package/dist/core/toolOperation/checkOperation.js +1 -208
  45. package/dist/core/toolOperation/cuboidOperation.js +1 -754
  46. package/dist/core/toolOperation/cuboidToggleButtonClass.js +7 -152
  47. package/dist/core/toolOperation/eventListener.js +1 -37
  48. package/dist/core/toolOperation/measureOperation.js +1 -41
  49. package/dist/core/toolOperation/pointCloud2dOperation.js +1 -365
  50. package/dist/core/toolOperation/pointOperation.js +1 -696
  51. package/dist/core/toolOperation/polygonOperation.js +1 -1251
  52. package/dist/core/toolOperation/rectOperation.js +1 -1233
  53. package/dist/core/toolOperation/segmentByRect.js +1 -174
  54. package/dist/core/toolOperation/tagOperation.js +3 -201
  55. package/dist/core/toolOperation/textAttributeClass.js +16 -182
  56. package/dist/index.js +1 -185
  57. package/dist/locales/constants.js +1 -24
  58. package/dist/locales/en_US/message.js +1 -25
  59. package/dist/locales/index.js +1 -19
  60. package/dist/locales/zh_CN/message.js +1 -25
  61. package/dist/newCore/CanvasScheduler.js +1 -35
  62. package/dist/utils/ActionsHistory.js +1 -84
  63. package/dist/utils/ImgUtils.js +1 -23
  64. package/dist/utils/MathUtils.js +2 -385
  65. package/dist/utils/VectorUtils.js +1 -25
  66. package/dist/utils/tool/AttributeUtils.js +1 -218
  67. package/dist/utils/tool/AxisUtils.js +1 -340
  68. package/dist/utils/tool/CanvasUtils.js +1 -62
  69. package/dist/utils/tool/CommonToolUtils.js +1 -174
  70. package/dist/utils/tool/CuboidUtils.js +1 -704
  71. package/dist/utils/tool/DblClickEventListener.js +1 -102
  72. package/dist/utils/tool/DrawUtils.js +3 -492
  73. package/dist/utils/tool/EnhanceCommonToolUtils.js +1 -53
  74. package/dist/utils/tool/ImgPosUtils.js +1 -58
  75. package/dist/utils/tool/LineToolUtils.js +1 -261
  76. package/dist/utils/tool/MarkerUtils.js +1 -56
  77. package/dist/utils/tool/PolygonUtils.js +1 -460
  78. package/dist/utils/tool/RectUtils.js +1 -155
  79. package/dist/utils/tool/RenderDomClass.js +7 -57
  80. package/dist/utils/tool/RenderDomUtils.js +4 -21
  81. package/dist/utils/tool/StyleUtils.js +1 -31
  82. package/dist/utils/tool/TagUtils.js +1 -129
  83. package/dist/utils/tool/UnitUtils.js +1 -12
  84. package/dist/utils/tool/ZoomUtils.js +1 -72
  85. package/dist/utils/tool/polygonTool.js +1 -133
  86. package/dist/utils/uuid.js +1 -26
  87. package/es/_virtual/MathUtilsWorker.js +1 -6
  88. package/es/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js +2 -31
  89. package/es/_virtual/filterBoxWorker.js +1 -6
  90. package/es/_virtual/highlightWorker.js +1 -6
  91. package/es/assets/attributeIcon/icon_canvasEdit0.svg.js +1 -3
  92. package/es/assets/attributeIcon/icon_canvasEdit1.svg.js +1 -3
  93. package/es/assets/attributeIcon/icon_canvasEdit2.svg.js +1 -3
  94. package/es/assets/attributeIcon/icon_canvasEdit3.svg.js +1 -3
  95. package/es/assets/attributeIcon/icon_canvasEdit4.svg.js +1 -3
  96. package/es/assets/attributeIcon/icon_canvasEdit5.svg.js +1 -3
  97. package/es/assets/attributeIcon/icon_canvasEdit6.svg.js +1 -3
  98. package/es/assets/attributeIcon/icon_canvasEdit7.svg.js +1 -3
  99. package/es/assets/attributeIcon/icon_canvasEdit8.svg.js +1 -3
  100. package/es/assets/attributeIcon/icon_canvasEdit_miss.svg.js +1 -3
  101. package/es/assets/attributeIcon/icon_cuboidFAB.svg.js +5 -3
  102. package/es/assets/attributeIcon/icon_cuboidLeft.svg.js +7 -3
  103. package/es/assets/attributeIcon/icon_cuboidMore.svg.js +5 -3
  104. package/es/assets/attributeIcon/icon_cuboidRight.svg.js +5 -3
  105. package/es/assets/attributeIcon/icon_cuboidTop.svg.js +12 -3
  106. package/es/assets/attributeIcon/icon_editFEN.svg.js +1 -3
  107. package/es/assets/attributeIcon/icon_editHUANG.svg.js +1 -3
  108. package/es/assets/attributeIcon/icon_editLAN.svg.js +1 -3
  109. package/es/assets/attributeIcon/icon_editLV.svg.js +1 -3
  110. package/es/assets/attributeIcon/icon_editQING.svg.js +1 -3
  111. package/es/constant/annotation.js +1 -113
  112. package/es/constant/annotationTask.js +1 -25
  113. package/es/constant/defaultConfig.js +1 -260
  114. package/es/constant/keyCode.js +1 -36
  115. package/es/constant/style.js +1 -74
  116. package/es/constant/tool.js +1 -220
  117. package/es/core/index.js +1 -148
  118. package/es/core/pointCloud/OrbitControls.js +1 -661
  119. package/es/core/pointCloud/PCDLoader.js +2 -256
  120. package/es/core/pointCloud/annotation.js +1 -211
  121. package/es/core/pointCloud/cache.js +1 -49
  122. package/es/core/pointCloud/index.js +5 -962
  123. package/es/core/pointCloud/matrix.js +1 -109
  124. package/es/core/scheduler.js +1 -228
  125. package/es/core/toolOperation/LineToolOperation.js +1 -1421
  126. package/es/core/toolOperation/ScribbleTool.js +1 -290
  127. package/es/core/toolOperation/TextToolOperation.js +1 -129
  128. package/es/core/toolOperation/ViewOperation.js +1 -549
  129. package/es/core/toolOperation/basicToolOperation.js +1 -877
  130. package/es/core/toolOperation/checkOperation.js +1 -206
  131. package/es/core/toolOperation/cuboidOperation.js +1 -752
  132. package/es/core/toolOperation/cuboidToggleButtonClass.js +7 -150
  133. package/es/core/toolOperation/eventListener.js +1 -35
  134. package/es/core/toolOperation/measureOperation.js +1 -39
  135. package/es/core/toolOperation/pointCloud2dOperation.js +1 -359
  136. package/es/core/toolOperation/pointOperation.js +1 -690
  137. package/es/core/toolOperation/polygonOperation.js +1 -1245
  138. package/es/core/toolOperation/rectOperation.js +1 -1228
  139. package/es/core/toolOperation/segmentByRect.js +1 -172
  140. package/es/core/toolOperation/tagOperation.js +3 -199
  141. package/es/core/toolOperation/textAttributeClass.js +16 -180
  142. package/es/index.js +1 -46
  143. package/es/locales/constants.js +1 -22
  144. package/es/locales/en_US/message.js +1 -23
  145. package/es/locales/index.js +1 -17
  146. package/es/locales/zh_CN/message.js +1 -23
  147. package/es/newCore/CanvasScheduler.js +1 -31
  148. package/es/utils/ActionsHistory.js +1 -78
  149. package/es/utils/ImgUtils.js +1 -21
  150. package/es/utils/MathUtils.js +2 -380
  151. package/es/utils/VectorUtils.js +1 -23
  152. package/es/utils/tool/AttributeUtils.js +1 -212
  153. package/es/utils/tool/AxisUtils.js +1 -335
  154. package/es/utils/tool/CanvasUtils.js +1 -60
  155. package/es/utils/tool/CommonToolUtils.js +1 -172
  156. package/es/utils/tool/CuboidUtils.js +1 -680
  157. package/es/utils/tool/DblClickEventListener.js +1 -100
  158. package/es/utils/tool/DrawUtils.js +3 -490
  159. package/es/utils/tool/EnhanceCommonToolUtils.js +1 -48
  160. package/es/utils/tool/ImgPosUtils.js +1 -56
  161. package/es/utils/tool/LineToolUtils.js +1 -255
  162. package/es/utils/tool/MarkerUtils.js +1 -54
  163. package/es/utils/tool/PolygonUtils.js +1 -458
  164. package/es/utils/tool/RectUtils.js +1 -153
  165. package/es/utils/tool/RenderDomClass.js +7 -55
  166. package/es/utils/tool/RenderDomUtils.js +4 -19
  167. package/es/utils/tool/StyleUtils.js +1 -29
  168. package/es/utils/tool/TagUtils.js +1 -127
  169. package/es/utils/tool/UnitUtils.js +1 -10
  170. package/es/utils/tool/ZoomUtils.js +1 -70
  171. package/es/utils/tool/polygonTool.js +1 -126
  172. package/es/utils/uuid.js +1 -24
  173. package/package.json +3 -4
  174. package/LICENSE +0 -203
  175. package/dist/core/pointCloud/segmentation.js +0 -144
  176. package/dist/core/pointCloud/selector/Sse3dLassoSelector.js +0 -26
  177. package/dist/core/pointCloud/selector/Sse3dSelector.js +0 -16
  178. package/dist/types/core/pointCloud/segmentation.d.ts +0 -0
  179. package/dist/types/core/pointCloud/selector/Sse3dLassoSelector.d.ts +0 -0
  180. package/dist/types/core/pointCloud/selector/Sse3dSelector.d.ts +0 -0
  181. package/es/_virtual/_rollup-plugin-web-worker-loader__helper__auto__createBase64WorkerFactory.js +0 -12
  182. package/es/_virtual/_rollup-plugin-web-worker-loader__helper__auto__isNodeJS.js +0 -7
  183. package/es/_virtual/_rollup-plugin-web-worker-loader__helper__node__WorkerClass.js +0 -11
  184. package/es/_virtual/_rollup-plugin-web-worker-loader__helper__node__createBase64WorkerFactory.js +0 -18
  185. package/es/core/pointCloud/segmentation.js +0 -120
  186. package/es/core/pointCloud/selector/Sse3dLassoSelector.js +0 -24
  187. package/es/core/pointCloud/selector/Sse3dSelector.js +0 -14
  188. package/es/core/toolOperation/scribbleTool2.js +0 -249
@@ -1,68 +1,20 @@
1
- import DrawUtils from './DrawUtils.js';
2
- import StyleUtils from './StyleUtils.js';
3
-
4
- class RenderDomClass {
5
- constructor(props) {
6
- this._domMap = new Map();
7
- this._container = props.container;
8
- this._height = props.height;
9
- }
10
- wheelChange(e) {
11
- e.stopPropagation();
12
- }
13
- clearTag(id) {
14
- const parentNode = this._container;
15
- const oldDom = window.self.document.getElementById(id);
16
- if (oldDom && parentNode && parentNode.contains(oldDom)) {
17
- oldDom.removeEventListener("wheel", this.wheelChange);
18
- parentNode == null ? void 0 : parentNode.removeChild(oldDom);
19
- }
20
- }
21
- render(annotations) {
22
- const oldKeys = Array.from(this._domMap.keys());
23
- const newKeys = annotations.map((v) => v.id);
24
- annotations.forEach((v) => {
25
- const {text, textMaxWidth, color = "white", background = "rgba(0, 0, 0, 0.6)", style} = v;
26
- if (this._domMap.has(v.id)) {
27
- const dom = this._domMap.get(v.id);
28
- if (dom) {
29
- dom.innerHTML = text;
30
- }
31
- } else {
32
- const dom = DrawUtils.drawTagByDom(this._container, text, v.id);
33
- if (dom) {
34
- dom.setAttribute("style", `
1
+ import d from"./DrawUtils.js";import c from"./StyleUtils.js";class p{constructor(t){this._domMap=new Map,this._container=t.container,this._height=t.height}wheelChange(t){t.stopPropagation()}clearTag(t){const o=this._container,a=window.self.document.getElementById(t);a&&o&&o.contains(a)&&(a.removeEventListener("wheel",this.wheelChange),o==null||o.removeChild(a))}render(t){const o=Array.from(this._domMap.keys()),a=t.map(e=>e.id);t.forEach(e=>{const{text:s,textMaxWidth:r,color:n="white",background:h="rgba(0, 0, 0, 0.6)",style:l}=e;if(this._domMap.has(e.id)){const i=this._domMap.get(e.id);i&&(i.innerHTML=s)}else{const i=d.drawTagByDom(this._container,s,e.id);i&&(i.setAttribute("style",`
35
2
  position: absolute;
36
3
  top: 0;
37
4
  right: 0;
38
5
  z-index: 20;
39
6
  padding: 8px 20px;
40
7
  font-size: 15px;
41
- max-width: ${textMaxWidth}px;
42
- color: ${color};
8
+ max-width: ${r}px;
9
+ color: ${n};
43
10
  text-align: left;
44
11
  line-height: 32px;
45
12
  word-break: break-all;
46
13
  white-space: pre-wrap;
47
- background: ${background};
14
+ background: ${h};
48
15
  opacity: 0.9;
49
- max-height: ${this._height * 0.8}px;
16
+ max-height: ${this._height*.8}px;
50
17
  overflow-y: scroll;
51
18
  clear: both;
52
- ${StyleUtils.getStyle2String(style)}
53
- `);
54
- dom.addEventListener("wheel", this.wheelChange);
55
- this._domMap.set(v.id, dom);
56
- }
57
- }
58
- });
59
- oldKeys.forEach((key) => {
60
- if (newKeys.indexOf(key) === -1) {
61
- this.clearTag(key);
62
- this._domMap.delete(key);
63
- }
64
- });
65
- }
66
- }
67
-
68
- export { RenderDomClass as default };
19
+ ${c.getStyle2String(l)}
20
+ `),i.addEventListener("wheel",this.wheelChange),this._domMap.set(e.id,i))}}),o.forEach(e=>{a.indexOf(e)===-1&&(this.clearTag(e),this._domMap.delete(e))})}}export{p as default};
@@ -1,16 +1,9 @@
1
- import Locale from '../../locales/index.js';
2
- import { EMessage } from '../../locales/constants.js';
3
-
4
- const INVALID_PAGE_CLASS_NAME = "bee-invalid-page";
5
- class RenderDomUtils {
6
- static renderInvalidPage(container, size, lang) {
7
- const invalidDOM = document.createElement("div");
8
- invalidDOM.setAttribute("style", `
1
+ import n from"../../locales/index.js";import{EMessage as s}from"../../locales/constants.js";const o="bee-invalid-page";class l{static renderInvalidPage(i,t,a){const e=document.createElement("div");return e.setAttribute("style",`
9
2
  position: absolute;
10
3
  left: 0px;
11
4
  top: 0px;
12
- width: ${size.width}px;
13
- height: ${size.height}px;
5
+ width: ${t.width}px;
6
+ height: ${t.height}px;
14
7
  background: rgba(255, 87, 34, 1);
15
8
  overflow: hidden;
16
9
  color: white;
@@ -20,12 +13,4 @@ class RenderDomUtils {
20
13
  font-size: 30px;
21
14
  opacity: 0.7;
22
15
  z-index: 30;
23
- `);
24
- invalidDOM.innerHTML = Locale.getMessagesByLocale(EMessage.InvalidImage, lang);
25
- invalidDOM.className = INVALID_PAGE_CLASS_NAME;
26
- container.appendChild(invalidDOM);
27
- return invalidDOM;
28
- }
29
- }
30
-
31
- export { RenderDomUtils as default };
16
+ `),e.innerHTML=n.getMessagesByLocale(s.InvalidImage,a),e.className=o,i.appendChild(e),e}}export{l as default};
@@ -1,29 +1 @@
1
- class StyleUtils {
2
- static getStrokeAndFill(toolStyle, valid = true, options = {}) {
3
- const {isSelected = false, isHover = false} = options;
4
- if (isSelected) {
5
- return {
6
- stroke: valid ? toolStyle.validSelected.stroke : toolStyle.invalidSelected.stroke,
7
- fill: valid ? toolStyle.validSelected.fill : toolStyle.invalidSelected.fill
8
- };
9
- }
10
- if (isHover) {
11
- return {
12
- stroke: valid ? toolStyle.validHover.stroke : toolStyle.invalidHover.stroke,
13
- fill: valid ? toolStyle.validHover.fill : toolStyle.invalidHover.fill
14
- };
15
- }
16
- return {
17
- stroke: valid ? toolStyle.valid.stroke : toolStyle.invalid.stroke,
18
- fill: valid ? toolStyle.valid.fill : toolStyle.invalid.fill
19
- };
20
- }
21
- static getStyle2String(style) {
22
- if (!style) {
23
- return;
24
- }
25
- return Object.entries(style).reduce((acc, cur) => `${acc} ${cur[0]}: ${cur[1]};`, "");
26
- }
27
- }
28
-
29
- export { StyleUtils as default };
1
+ class d{static getStrokeAndFill(e,i=!0,r={}){const{isSelected:s=!1,isHover:l=!1}=r;return s?{stroke:i?e.validSelected.stroke:e.invalidSelected.stroke,fill:i?e.validSelected.fill:e.invalidSelected.fill}:l?{stroke:i?e.validHover.stroke:e.invalidHover.stroke,fill:i?e.validHover.fill:e.invalidHover.fill}:{stroke:i?e.valid.stroke:e.invalid.stroke,fill:i?e.valid.fill:e.invalid.fill}}static getStyle2String(e){if(!!e)return Object.entries(e).reduce((i,r)=>`${i} ${r[0]}: ${r[1]};`,"")}}export{d as default};
@@ -1,127 +1 @@
1
- import uuid from '../uuid.js';
2
-
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {enumerable: true, configurable: true, writable: true, value}) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- class TagUtil {
20
- static getTagKeyName(key, labelInfoSet) {
21
- var _a, _b;
22
- if (!labelInfoSet) {
23
- return;
24
- }
25
- return (_b = (_a = labelInfoSet.find((v) => v.value === key)) == null ? void 0 : _a.key) != null ? _b : "";
26
- }
27
- static getTagName([key = "", value = ""], labelInfoSet) {
28
- if (!labelInfoSet) {
29
- return;
30
- }
31
- for (const i of labelInfoSet) {
32
- if (i.value === key) {
33
- if (!i.subSelected) {
34
- console.error("\u6807\u7B7E\u89E3\u6790\u9519\u8BEF", key, value);
35
- return "";
36
- }
37
- for (const j of i.subSelected) {
38
- if (j.value === value) {
39
- return j.key;
40
- }
41
- }
42
- }
43
- }
44
- }
45
- static getTagNameList(result, labelInfoSet) {
46
- if (Object.keys(result).length <= 0) {
47
- return [];
48
- }
49
- return Object.entries(result).reduce((acc, cur) => {
50
- const [key, value] = cur;
51
- if (value && value.length > 0) {
52
- const valueList = value.split(";");
53
- const nameList = {
54
- keyName: this.getTagKeyName(key, labelInfoSet),
55
- value: valueList.map((v) => this.getTagName([key, v], labelInfoSet))
56
- };
57
- return [...acc, nameList];
58
- }
59
- return acc;
60
- }, []).filter((v) => v);
61
- }
62
- static getTagnameListWithoutConfig(result) {
63
- if (Object.keys(result).length <= 0) {
64
- return [];
65
- }
66
- return Object.entries(result).reduce((acc, cur) => {
67
- const [key, value] = cur;
68
- const valueList = value.split(";");
69
- const nameList = {
70
- keyName: key,
71
- value: valueList
72
- };
73
- return [...acc, nameList];
74
- }, []).filter((v) => v);
75
- }
76
- static judgeResultIsInInputList(key, value, inputList) {
77
- if (!key || !value || !inputList) {
78
- return false;
79
- }
80
- const a = inputList.filter((v) => {
81
- if (v.value === key && v.subSelected) {
82
- const resultValue = value == null ? void 0 : value.split(";");
83
- return (v == null ? void 0 : v.subSelected.filter((i) => resultValue.indexOf(i.value) > -1).length) > 0;
84
- }
85
- return false;
86
- });
87
- return a.length > 0;
88
- }
89
- static getDefaultResultByConfig(inputList) {
90
- return inputList.reduce((acc, cur) => {
91
- if (cur.subSelected) {
92
- cur.subSelected.forEach((data) => {
93
- var _a;
94
- if (data.isDefault) {
95
- const originResult = (_a = acc[cur.value]) != null ? _a : "";
96
- let originResultList = [];
97
- if (originResult.length > 0) {
98
- originResultList = originResult.split(";");
99
- }
100
- originResultList.push(data.value);
101
- acc[cur.value] = originResultList.join(";");
102
- }
103
- });
104
- }
105
- return acc;
106
- }, {});
107
- }
108
- static getDefaultTagResult(inputList, basicResultList) {
109
- const defaultResult = this.getDefaultResultByConfig(inputList);
110
- if (basicResultList.length > 0) {
111
- return basicResultList.map((v) => ({
112
- id: uuid(),
113
- sourceID: v.id,
114
- result: __spreadValues({}, defaultResult)
115
- }));
116
- }
117
- return [
118
- {
119
- id: uuid(),
120
- sourceID: "",
121
- result: __spreadValues({}, defaultResult)
122
- }
123
- ];
124
- }
125
- }
126
-
127
- export { TagUtil as default };
1
+ import a from"../uuid.js";var p=Object.defineProperty,o=Object.getOwnPropertySymbols,m=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable,f=(l,t,e)=>t in l?p(l,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):l[t]=e,c=(l,t)=>{for(var e in t||(t={}))m.call(t,e)&&f(l,e,t[e]);if(o)for(var e of o(t))v.call(t,e)&&f(l,e,t[e]);return l};class y{static getTagKeyName(t,e){var r,i;if(!!e)return(i=(r=e.find(u=>u.value===t))==null?void 0:r.key)!=null?i:""}static getTagName([t="",e=""],r){if(!!r){for(const i of r)if(i.value===t){if(!i.subSelected)return console.error("\u6807\u7B7E\u89E3\u6790\u9519\u8BEF",t,e),"";for(const u of i.subSelected)if(u.value===e)return u.key}}}static getTagNameList(t,e){return Object.keys(t).length<=0?[]:Object.entries(t).reduce((r,i)=>{const[u,n]=i;if(n&&n.length>0){const s=n.split(";"),g={keyName:this.getTagKeyName(u,e),value:s.map(d=>this.getTagName([u,d],e))};return[...r,g]}return r},[]).filter(r=>r)}static getTagnameListWithoutConfig(t){return Object.keys(t).length<=0?[]:Object.entries(t).reduce((e,r)=>{const[i,u]=r,n=u.split(";"),s={keyName:i,value:n};return[...e,s]},[]).filter(e=>e)}static judgeResultIsInInputList(t,e,r){return!t||!e||!r?!1:r.filter(u=>{if(u.value===t&&u.subSelected){const n=e==null?void 0:e.split(";");return(u==null?void 0:u.subSelected.filter(s=>n.indexOf(s.value)>-1).length)>0}return!1}).length>0}static getDefaultResultByConfig(t){return t.reduce((e,r)=>(r.subSelected&&r.subSelected.forEach(i=>{var u;if(i.isDefault){const n=(u=e[r.value])!=null?u:"";let s=[];n.length>0&&(s=n.split(";")),s.push(i.value),e[r.value]=s.join(";")}}),e),{})}static getDefaultTagResult(t,e){const r=this.getDefaultResultByConfig(t);return e.length>0?e.map(i=>({id:a(),sourceID:i.id,result:c({},r)})):[{id:a(),sourceID:"",result:c({},r)}]}}export{y as default};
@@ -1,10 +1 @@
1
- class UnitUtils {
2
- static deg2rad(angleDeg) {
3
- return angleDeg * Math.PI / 180;
4
- }
5
- static rad2deg(angleRad) {
6
- return angleRad * 180 / Math.PI;
7
- }
8
- }
9
-
10
- export { UnitUtils as default };
1
+ class a{static deg2rad(t){return t*Math.PI/180}static rad2deg(t){return t*180/Math.PI}}export{a as default};
@@ -1,70 +1 @@
1
- import { EGrowthMode } from '../../constant/annotation.js';
2
- import MathUtils from '../MathUtils.js';
3
-
4
- const ZOOM_LEVEL = [1, 5, 10, 20, 30, 50, 80, 100].concat(Array.from({length: 9}).map((i, index) => (index + 2) * 100));
5
- class ZoomUtils {
6
- }
7
- ZoomUtils.zoomChanged = (zoom, isZoomIn, growthMode = EGrowthMode.Linear) => {
8
- switch (growthMode) {
9
- case EGrowthMode.Intelligence: {
10
- const maxZoom = Math.max(...ZOOM_LEVEL);
11
- const minZoom = Math.min(...ZOOM_LEVEL);
12
- const zoomIndex = ZOOM_LEVEL.slice(0, ZOOM_LEVEL.length).findIndex((i, index) => zoom >= i && (zoom < ZOOM_LEVEL[index + 1] || i === maxZoom));
13
- let newZoom;
14
- if (zoomIndex === -1) {
15
- if (zoom >= minZoom && zoom <= maxZoom) {
16
- newZoom = isZoomIn ? maxZoom : minZoom;
17
- } else {
18
- newZoom = isZoomIn ? minZoom : zoom;
19
- }
20
- } else {
21
- const newZoomIndex = isZoomIn ? zoomIndex + 1 : zoomIndex - (ZOOM_LEVEL.includes(zoom) ? 1 : 0);
22
- newZoom = ZOOM_LEVEL[MathUtils.withinRange(newZoomIndex, [0, ZOOM_LEVEL.length - 1])];
23
- }
24
- return newZoom;
25
- }
26
- default: {
27
- const ratio = isZoomIn ? 2 : 1 / 2;
28
- return zoom * ratio;
29
- }
30
- }
31
- };
32
- ZoomUtils.wheelChangePos = (imgNode, coord, operator, oldCurrentPos, options = {}) => {
33
- const {zoom = 1, innerZoom = 1, basicZoom = 1, zoomMax = 1e3, rotate = 0} = options;
34
- const {x, y} = oldCurrentPos;
35
- const ratio = parseFloat((zoom + 1 / 10).toFixed(1)) / 5;
36
- if (imgNode && coord) {
37
- let {width, height} = imgNode;
38
- if ([90, 270].includes(rotate)) {
39
- width = imgNode.height;
40
- height = imgNode.width;
41
- }
42
- const imgWidth = width * innerZoom;
43
- const imgHeight = height * innerZoom;
44
- const offsetLeft = coord.x - x;
45
- const offsetTop = coord.y - y;
46
- const ratioX = offsetLeft / imgWidth;
47
- const ratioY = offsetTop / imgHeight;
48
- let currentZoom = zoom + operator * ratio;
49
- currentZoom = MathUtils.withinRange(currentZoom, [basicZoom, zoomMax]);
50
- const changeX = width * currentZoom * ratioX;
51
- const changeY = height * currentZoom * ratioY;
52
- const currentX = x + (offsetLeft - changeX);
53
- const currentY = y + (offsetTop - changeY);
54
- return {
55
- zoom: currentZoom,
56
- currentPos: {
57
- x: currentX,
58
- y: currentY
59
- },
60
- imgInfo: {
61
- width: width * currentZoom,
62
- height: height * currentZoom
63
- },
64
- ratio
65
- };
66
- }
67
- return null;
68
- };
69
-
70
- export { ZoomUtils as default };
1
+ import{EGrowthMode as p}from"../../constant/annotation.js";import Z from"../MathUtils.js";const e=[1,5,10,20,30,50,80,100].concat(Array.from({length:9}).map((t,n)=>(n+2)*100));class m{}m.zoomChanged=(t,n,f=p.Linear)=>{switch(f){case p.Intelligence:{const o=Math.max(...e),r=Math.min(...e),c=e.slice(0,e.length).findIndex((a,g)=>t>=a&&(t<e[g+1]||a===o));let s;if(c===-1)t>=r&&t<=o?s=n?o:r:s=n?r:t;else{const a=n?c+1:c-(e.includes(t)?1:0);s=e[Z.withinRange(a,[0,e.length-1])]}return s}default:{const o=n?2:1/2;return t*o}}},m.wheelChangePos=(t,n,f,o,r={})=>{const{zoom:c=1,innerZoom:s=1,basicZoom:a=1,zoomMax:g=1e3,rotate:y=0}=r,{x:u,y:x}=o,d=parseFloat((c+1/10).toFixed(1))/5;if(t&&n){let{width:h,height:l}=t;[90,270].includes(y)&&(h=t.height,l=t.width);const L=h*s,E=l*s,w=n.x-u,M=n.y-x,U=w/L,X=M/E;let i=c+f*d;i=Z.withinRange(i,[a,g]);const Y=h*i*U,j=l*i*X,C=u+(w-Y),F=x+(M-j);return{zoom:i,currentPos:{x:C,y:F},imgInfo:{width:h*i,height:l*i},ratio:d}}return null};export{m as default};
@@ -1,126 +1 @@
1
- import { ELineTypes, SEGMENT_NUMBER } from '../../constant/tool.js';
2
-
3
- var __defProp = Object.defineProperty;
4
- var __defProps = Object.defineProperties;
5
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {enumerable: true, configurable: true, writable: true, value}) : obj[key] = value;
10
- var __spreadValues = (a, b) => {
11
- for (var prop in b || (b = {}))
12
- if (__hasOwnProp.call(b, prop))
13
- __defNormalProp(a, prop, b[prop]);
14
- if (__getOwnPropSymbols)
15
- for (var prop of __getOwnPropSymbols(b)) {
16
- if (__propIsEnum.call(b, prop))
17
- __defNormalProp(a, prop, b[prop]);
18
- }
19
- return a;
20
- };
21
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
22
- function createSmoothCurvePoints(points, tension = 0.5, closed = false, numberOfSegments = 16) {
23
- if (points.length < 4) {
24
- return points;
25
- }
26
- const result = [];
27
- const ps = points.slice(0);
28
- let x;
29
- let y;
30
- let t1x;
31
- let t2x;
32
- let t1y;
33
- let t2y;
34
- let c1;
35
- let c2;
36
- let c3;
37
- let c4;
38
- let st;
39
- let t;
40
- let i;
41
- if (closed) {
42
- ps.unshift(points[points.length - 1]);
43
- ps.unshift(points[points.length - 2]);
44
- ps.unshift(points[points.length - 1]);
45
- ps.unshift(points[points.length - 2]);
46
- ps.push(points[0]);
47
- ps.push(points[1]);
48
- } else {
49
- ps.unshift(points[1]);
50
- ps.unshift(points[0]);
51
- ps.push(points[points.length - 2]);
52
- ps.push(points[points.length - 1]);
53
- }
54
- for (i = 2; i < ps.length - 4; i += 2) {
55
- t1x = (ps[i + 2] - ps[i - 2]) * tension;
56
- t2x = (ps[i + 4] - ps[i - 0]) * tension;
57
- t1y = (ps[i + 3] - ps[i - 1]) * tension;
58
- t2y = (ps[i + 5] - ps[i + 1]) * tension;
59
- for (t = 0; t <= numberOfSegments; t++) {
60
- st = t / numberOfSegments;
61
- c1 = 2 * Math.pow(st, 3) - 3 * Math.pow(st, 2) + 1;
62
- c2 = -(2 * Math.pow(st, 3)) + 3 * Math.pow(st, 2);
63
- c3 = Math.pow(st, 3) - 2 * Math.pow(st, 2) + st;
64
- c4 = Math.pow(st, 3) - Math.pow(st, 2);
65
- x = c1 * ps[i] + c2 * ps[i + 2] + c3 * t1x + c4 * t2x;
66
- y = c1 * ps[i + 1] + c2 * ps[i + 3] + c3 * t1y + c4 * t2y;
67
- result.push(x);
68
- result.push(y);
69
- }
70
- }
71
- const formatResult = [];
72
- for (let j = 0; j < result.length - 1; j += 2) {
73
- formatResult.push({
74
- x: result[j],
75
- y: result[j + 1]
76
- });
77
- }
78
- if (closed) {
79
- for (let j = 0; j < numberOfSegments + 1; j++) {
80
- const d = formatResult.shift();
81
- formatResult.push(d);
82
- }
83
- }
84
- return formatResult;
85
- }
86
- const createSmoothCurvePointsFromPointList = (pointList, numberOfSegments = 16) => createSmoothCurvePoints(pointList.reduce((acc, cur) => {
87
- return [...acc, cur.x, cur.y];
88
- }, []), 0.5, false, numberOfSegments);
89
- function isInPolygon(checkPoint, polygonPoints, lineType = ELineTypes.Line) {
90
- let counter = 0;
91
- let i;
92
- let xinters;
93
- let p1;
94
- let p2;
95
- polygonPoints = [...polygonPoints];
96
- if (lineType === ELineTypes.Curve) {
97
- polygonPoints = createSmoothCurvePoints(polygonPoints.reduce((acc, cur) => {
98
- return [...acc, cur.x, cur.y];
99
- }, []), 0.5, true, SEGMENT_NUMBER);
100
- }
101
- [p1] = polygonPoints;
102
- const pointCount = polygonPoints.length;
103
- for (i = 1; i <= pointCount; i++) {
104
- p2 = polygonPoints[i % pointCount];
105
- if (checkPoint.x > Math.min(p1.x, p2.x) && checkPoint.x <= Math.max(p1.x, p2.x)) {
106
- if (checkPoint.y <= Math.max(p1.y, p2.y)) {
107
- if (p1.x !== p2.x) {
108
- xinters = (checkPoint.x - p1.x) * (p2.y - p1.y) / (p2.x - p1.x) + p1.y;
109
- if (p1.y === p2.y || checkPoint.y <= xinters) {
110
- counter++;
111
- }
112
- }
113
- }
114
- }
115
- p1 = p2;
116
- }
117
- if (counter % 2 === 0) {
118
- return false;
119
- }
120
- return true;
121
- }
122
- function getPolygonPointUnderZoom(pointList, zoom = 1) {
123
- return pointList.map((v) => __spreadProps(__spreadValues({}, v), {x: v.x * zoom, y: v.y * zoom}));
124
- }
125
-
126
- export { createSmoothCurvePoints, createSmoothCurvePointsFromPointList, getPolygonPointUnderZoom, isInPolygon };
1
+ import{ELineTypes as g,SEGMENT_NUMBER as E}from"../../constant/tool.js";var C=Object.defineProperty,I=Object.defineProperties,L=Object.getOwnPropertyDescriptors,O=Object.getOwnPropertySymbols,N=Object.prototype.hasOwnProperty,S=Object.prototype.propertyIsEnumerable,P=(e,t,l)=>t in e?C(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,b=(e,t)=>{for(var l in t||(t={}))N.call(t,l)&&P(e,l,t[l]);if(O)for(var l of O(t))S.call(t,l)&&P(e,l,t[l]);return e},D=(e,t)=>I(e,L(t));function v(e,t=.5,l=!1,s=16){if(e.length<4)return e;const h=[],r=e.slice(0);let f,u,n,y,p,d,w,i,M,m,o,c,a;for(l?(r.unshift(e[e.length-1]),r.unshift(e[e.length-2]),r.unshift(e[e.length-1]),r.unshift(e[e.length-2]),r.push(e[0]),r.push(e[1])):(r.unshift(e[1]),r.unshift(e[0]),r.push(e[e.length-2]),r.push(e[e.length-1])),a=2;a<r.length-4;a+=2)for(n=(r[a+2]-r[a-2])*t,y=(r[a+4]-r[a-0])*t,p=(r[a+3]-r[a-1])*t,d=(r[a+5]-r[a+1])*t,c=0;c<=s;c++)o=c/s,w=2*Math.pow(o,3)-3*Math.pow(o,2)+1,i=-(2*Math.pow(o,3))+3*Math.pow(o,2),M=Math.pow(o,3)-2*Math.pow(o,2)+o,m=Math.pow(o,3)-Math.pow(o,2),f=w*r[a]+i*r[a+2]+M*n+m*y,u=w*r[a+1]+i*r[a+3]+M*p+m*d,h.push(f),h.push(u);const _=[];for(let x=0;x<h.length-1;x+=2)_.push({x:h[x],y:h[x+1]});if(l)for(let x=0;x<s+1;x++){const j=_.shift();_.push(j)}return _}const R=(e,t=16)=>v(e.reduce((l,s)=>[...l,s.x,s.y],[]),.5,!1,t);function T(e,t,l=g.Line){let s=0,h,r,f,u;t=[...t],l===g.Curve&&(t=v(t.reduce((y,p)=>[...y,p.x,p.y],[]),.5,!0,E)),[f]=t;const n=t.length;for(h=1;h<=n;h++)u=t[h%n],e.x>Math.min(f.x,u.x)&&e.x<=Math.max(f.x,u.x)&&e.y<=Math.max(f.y,u.y)&&f.x!==u.x&&(r=(e.x-f.x)*(u.y-f.y)/(u.x-f.x)+f.y,(f.y===u.y||e.y<=r)&&s++),f=u;return s%2!=0}function U(e,t=1){return e.map(l=>D(b({},l),{x:l.x*t,y:l.y*t}))}export{v as createSmoothCurvePoints,R as createSmoothCurvePointsFromPointList,U as getPolygonPointUnderZoom,T as isInPolygon};
package/es/utils/uuid.js CHANGED
@@ -1,24 +1 @@
1
- function uuid(len = 8, radix = 62) {
2
- const chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");
3
- const id = [];
4
- let i;
5
- radix = radix || chars.length;
6
- if (len) {
7
- for (i = 0; i < len; i++) {
8
- id[i] = chars[0 | Math.random() * radix];
9
- }
10
- } else {
11
- let r;
12
- id[8] = id[13] = id[18] = id[23] = "-";
13
- id[14] = "4";
14
- for (i = 0; i < 36; i++) {
15
- if (!id[i]) {
16
- r = 0 | Math.random() * 16;
17
- id[i] = chars[i === 19 ? r & 3 | 8 : r];
18
- }
19
- }
20
- }
21
- return id.join("");
22
- }
23
-
24
- export { uuid as default };
1
+ function i(f=8,n=62){const e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),o=[];let t;if(n=n||e.length,f)for(t=0;t<f;t++)o[t]=e[0|Math.random()*n];else{let r;for(o[8]=o[13]=o[18]=o[23]="-",o[14]="4",t=0;t<36;t++)o[t]||(r=0|Math.random()*16,o[t]=e[t===19?r&3|8:r])}return o.join("")}export{i as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@labelbee/lb-annotation",
3
- "version": "1.14.0-alpha.3",
3
+ "version": "1.14.0-alpha.5",
4
4
  "description": "Annotation tool collection",
5
5
  "keywords": [
6
6
  "annotation",
@@ -94,11 +94,10 @@
94
94
  "typescript": "^4.2.3"
95
95
  },
96
96
  "dependencies": {
97
- "@labelbee/lb-utils": "^1.7.0-alpha.3",
97
+ "@labelbee/lb-utils": "1.7.0-alpha.5",
98
98
  "@turf/turf": "5.1.6",
99
99
  "color-rgba": "^2.3.0",
100
100
  "lodash": "^4.17.20",
101
101
  "three": ">=0.141.0"
102
- },
103
- "gitHead": "8387be3b500f75c181f38b73ea85fcc8a2543c26"
102
+ }
104
103
  }