@labelbee/lb-annotation 1.8.0 → 1.9.0-alpha.2
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/README.md +65 -0
- package/dist/index.js +20 -9
- package/dist/types/constant/tool.d.ts +3 -1
- package/dist/types/core/index.d.ts +24 -4
- package/dist/types/core/pointCloud/OrbitControls.d.ts +60 -0
- package/dist/types/core/pointCloud/PCDLoader.d.ts +11 -0
- package/dist/types/core/pointCloud/annotation.d.ts +47 -0
- package/dist/types/core/pointCloud/cache.d.ts +16 -0
- package/dist/types/core/pointCloud/index.d.ts +325 -0
- package/dist/types/core/scheduler.d.ts +71 -0
- package/dist/types/core/toolOperation/basicToolOperation.d.ts +20 -2
- package/dist/types/core/toolOperation/eventListener.d.ts +2 -2
- package/dist/types/core/toolOperation/pointCloud2dOperation.d.ts +80 -0
- package/dist/types/core/toolOperation/polygonOperation.d.ts +21 -7
- package/dist/types/core/toolOperation/segmentByRect.d.ts +31 -0
- package/dist/types/index.d.ts +9 -3
- package/dist/types/newCore/CanvasScheduler.d.ts +31 -0
- package/dist/types/newCore/index.d.ts +1 -0
- package/dist/types/utils/MathUtils.d.ts +6 -0
- package/dist/types/utils/tool/CommonToolUtils.d.ts +0 -13
- package/dist/types/utils/tool/EnhanceCommonToolUtils.d.ts +20 -0
- package/dist/types/utils/tool/PolygonUtils.d.ts +1 -0
- package/es/assets/attributeIcon/icon_canvasEdit0.svg.js +3 -0
- package/es/assets/attributeIcon/icon_canvasEdit1.svg.js +3 -0
- package/es/assets/attributeIcon/icon_canvasEdit2.svg.js +3 -0
- package/es/assets/attributeIcon/icon_canvasEdit3.svg.js +3 -0
- package/es/assets/attributeIcon/icon_canvasEdit4.svg.js +3 -0
- package/es/assets/attributeIcon/icon_canvasEdit5.svg.js +3 -0
- package/es/assets/attributeIcon/icon_canvasEdit6.svg.js +3 -0
- package/es/assets/attributeIcon/icon_canvasEdit7.svg.js +3 -0
- package/es/assets/attributeIcon/icon_canvasEdit8.svg.js +3 -0
- package/es/assets/attributeIcon/icon_canvasEdit_miss.svg.js +3 -0
- package/es/assets/attributeIcon/icon_editFEN.svg.js +3 -0
- package/es/assets/attributeIcon/icon_editHUANG.svg.js +3 -0
- package/es/assets/attributeIcon/icon_editLAN.svg.js +3 -0
- package/es/assets/attributeIcon/icon_editLV.svg.js +3 -0
- package/es/assets/attributeIcon/icon_editQING.svg.js +3 -0
- package/es/constant/annotation.js +68 -0
- package/es/constant/annotationTask.js +25 -0
- package/es/constant/defaultConfig.js +260 -0
- package/es/constant/keyCode.js +36 -0
- package/es/constant/style.js +67 -0
- package/es/constant/tool.js +183 -0
- package/es/core/index.js +145 -0
- package/es/core/pointCloud/OrbitControls.js +661 -0
- package/es/core/pointCloud/PCDLoader.js +238 -0
- package/es/core/pointCloud/annotation.js +98 -0
- package/es/core/pointCloud/cache.js +42 -0
- package/es/core/pointCloud/index.js +771 -0
- package/es/core/scheduler.js +184 -0
- package/es/core/toolOperation/LineToolOperation.js +1369 -0
- package/es/core/toolOperation/TextToolOperation.js +129 -0
- package/es/core/toolOperation/ViewOperation.js +410 -0
- package/es/core/toolOperation/basicToolOperation.js +817 -0
- package/es/core/toolOperation/checkOperation.js +206 -0
- package/es/core/toolOperation/eventListener.js +35 -0
- package/es/core/toolOperation/measureOperation.js +39 -0
- package/es/core/toolOperation/pointCloud2dOperation.js +197 -0
- package/es/core/toolOperation/pointOperation.js +603 -0
- package/es/core/toolOperation/polygonOperation.js +1201 -0
- package/es/core/toolOperation/rectOperation.js +1170 -0
- package/es/core/toolOperation/segmentByRect.js +172 -0
- package/es/core/toolOperation/tagOperation.js +215 -0
- package/es/core/toolOperation/textAttributeClass.js +201 -0
- package/es/index.js +25 -14
- package/es/locales/constants.js +21 -0
- package/es/locales/en_US/message.js +22 -0
- package/es/locales/index.js +17 -0
- package/es/locales/zh_CN/message.js +22 -0
- package/es/newCore/CanvasScheduler.js +31 -0
- package/es/utils/ActionsHistory.js +78 -0
- package/es/utils/ImgUtils.js +20 -0
- package/es/utils/MathUtils.js +283 -0
- package/es/utils/VectorUtils.js +23 -0
- package/es/utils/tool/AttributeUtils.js +196 -0
- package/es/utils/tool/AxisUtils.js +254 -0
- package/es/utils/tool/CanvasUtils.js +60 -0
- package/es/utils/tool/CommonToolUtils.js +172 -0
- package/es/utils/tool/CurrentOperation.js +35 -0
- package/es/utils/tool/DblClickEventListener.js +100 -0
- package/es/utils/tool/DrawUtils.js +424 -0
- package/es/utils/tool/EnhanceCommonToolUtils.js +39 -0
- package/es/utils/tool/ImgPosUtils.js +56 -0
- package/es/utils/tool/LineToolUtils.js +255 -0
- package/es/utils/tool/MarkerUtils.js +9 -0
- package/es/utils/tool/PolygonUtils.js +458 -0
- package/es/utils/tool/RectUtils.js +153 -0
- package/es/utils/tool/RenderDomClass.js +68 -0
- package/es/utils/tool/RenderDomUtils.js +29 -0
- package/es/utils/tool/StyleUtils.js +29 -0
- package/es/utils/tool/TagUtils.js +127 -0
- package/es/utils/tool/UnitUtils.js +10 -0
- package/es/utils/tool/ZoomUtils.js +70 -0
- package/es/utils/tool/polygonTool.js +126 -0
- package/es/utils/uuid.js +24 -0
- package/package.json +6 -4
package/README.md
CHANGED
|
@@ -143,3 +143,68 @@ interface IPolygonData {
|
|
|
143
143
|
attribute: string;
|
|
144
144
|
}
|
|
145
145
|
```
|
|
146
|
+
|
|
147
|
+
### 多层级标注
|
|
148
|
+
|
|
149
|
+
该方式可以将多个工具进行融合,实现多个工具在统一层次进行展示。
|
|
150
|
+
|
|
151
|
+
下方以一个多边形 + 分割辅助操作进行为例子
|
|
152
|
+
|
|
153
|
+
```ts
|
|
154
|
+
import React, { useEffect } from 'react';
|
|
155
|
+
import { AnnotationEngine } from '@labelbee/lb-annotation';
|
|
156
|
+
|
|
157
|
+
const imgSrc =
|
|
158
|
+
'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6e/Andre_Iguodala_2016.jpg/1200px-Andre_Iguodala_2016.jpg';
|
|
159
|
+
|
|
160
|
+
type TRunPrediction = (params: {
|
|
161
|
+
point: { x: number; y: number };
|
|
162
|
+
rect: { x: number; y: number; w: number; h: number };
|
|
163
|
+
}) => Promise<unknown>;
|
|
164
|
+
|
|
165
|
+
const App = () => {
|
|
166
|
+
const ref = React.useRef(null);
|
|
167
|
+
|
|
168
|
+
useEffect(() => {
|
|
169
|
+
if (ref.current) {
|
|
170
|
+
const imgNode = new Image();
|
|
171
|
+
imgNode.src = imgSrc;
|
|
172
|
+
imgNode.onload = () => {
|
|
173
|
+
// 获取当前工具的类
|
|
174
|
+
const annotationEngine = new AnnotationEngine({
|
|
175
|
+
container: ref.current,
|
|
176
|
+
size: {
|
|
177
|
+
width: 1000,
|
|
178
|
+
height: 600,
|
|
179
|
+
},
|
|
180
|
+
toolName: ['segmentByRectTool', 'polygonTool'], // 创建通过多层级进行创建
|
|
181
|
+
imgNode,
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
// 1. 切换层级 (临时使用该方式切换两个层级的变换)
|
|
185
|
+
annotationEngine.switchLastTwoCanvas();
|
|
186
|
+
|
|
187
|
+
// 2. 获取分割层次的 instance, 设置 runPrediction 函数
|
|
188
|
+
const firstToolInstance = annotationEngine.firstToolInstance;
|
|
189
|
+
|
|
190
|
+
const runPrediction = (params: TRunPrediction) => {
|
|
191
|
+
return new Promise((resolve) => {
|
|
192
|
+
// 模拟异步的操作
|
|
193
|
+
setTimeout(() => {
|
|
194
|
+
// 关键,需要返回成功
|
|
195
|
+
resolve('');
|
|
196
|
+
message.success('Predict successfully');
|
|
197
|
+
annotationEngine.switchLastTwoCanvas();
|
|
198
|
+
}, 1000);
|
|
199
|
+
});
|
|
200
|
+
};
|
|
201
|
+
firstToolInstance?.setRunPrediction?.(runPrediction);
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
}, []);
|
|
205
|
+
|
|
206
|
+
return <div ref={ref} />;
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
export default App;
|
|
210
|
+
```
|