@labelbee/lb-components 1.9.1-alpha.1 → 1.9.1
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/components/pointCloudView/hooks/useRotate.js +1 -1
- package/dist/types/components/pointCloudView/hooks/useRotate.d.ts +1 -1
- package/es/assets/annotation/pointCloudTool/addSvg.svg.js +4 -0
- package/es/assets/annotation/pointCloudTool/addSvg.svg.js.map +1 -0
- package/es/assets/annotation/pointCloudTool/cancel.svg.js +4 -0
- package/es/assets/annotation/pointCloudTool/cancel.svg.js.map +1 -0
- package/es/assets/annotation/pointCloudTool/circleSelector.svg.js +4 -0
- package/es/assets/annotation/pointCloudTool/circleSelector.svg.js.map +1 -0
- package/es/assets/annotation/pointCloudTool/circleSelector_a.svg.js +4 -0
- package/es/assets/annotation/pointCloudTool/circleSelector_a.svg.js.map +1 -0
- package/es/assets/annotation/pointCloudTool/clearSvg.svg.js +4 -0
- package/es/assets/annotation/pointCloudTool/clearSvg.svg.js.map +1 -0
- package/es/assets/annotation/pointCloudTool/coverMode.svg.js +4 -0
- package/es/assets/annotation/pointCloudTool/coverMode.svg.js.map +1 -0
- package/es/assets/annotation/pointCloudTool/finish.svg.js +4 -0
- package/es/assets/annotation/pointCloudTool/finish.svg.js.map +1 -0
- package/es/assets/annotation/pointCloudTool/lassoSelector.svg.js +4 -0
- package/es/assets/annotation/pointCloudTool/lassoSelector.svg.js.map +1 -0
- package/es/assets/annotation/pointCloudTool/lassoSelector_a.svg.js +4 -0
- package/es/assets/annotation/pointCloudTool/lassoSelector_a.svg.js.map +1 -0
- package/es/assets/annotation/pointCloudTool/unCoverMode.svg.js +4 -0
- package/es/assets/annotation/pointCloudTool/unCoverMode.svg.js.map +1 -0
- package/es/components/colorPalette/index.js +17 -0
- package/es/components/colorPalette/index.js.map +1 -0
- package/es/components/pointCloudView/PointCloudSegment.js +86 -0
- package/es/components/pointCloudView/PointCloudSegment.js.map +1 -0
- package/es/components/pointCloudView/PointCloudSegmentListener.js +83 -0
- package/es/components/pointCloudView/PointCloudSegmentListener.js.map +1 -0
- package/es/components/pointCloudView/PointCloudSegmentStatus.js +98 -0
- package/es/components/pointCloudView/PointCloudSegmentStatus.js.map +1 -0
- package/es/components/pointCloudView/PointCloudSegmentToolbar.js +59 -0
- package/es/components/pointCloudView/PointCloudSegmentToolbar.js.map +1 -0
- package/es/components/pointCloudView/hooks/useLine.js +70 -0
- package/es/components/pointCloudView/hooks/useLine.js.map +1 -0
- package/es/components/pointCloudView/hooks/useRotate.js +1 -1
- package/es/components/pointCloudView/hooks/useRotate.js.map +1 -1
- package/es/components/pointCloudView/hooks/useSphere.js +43 -0
- package/es/components/pointCloudView/hooks/useSphere.js.map +1 -0
- package/es/components/predictTracking/predictTrackingIcon/index.js +12 -5
- package/es/components/predictTracking/predictTrackingIcon/index.js.map +1 -1
- package/es/components/predictTracking/previewResult/util.js +4 -3
- package/es/components/predictTracking/previewResult/util.js.map +1 -1
- package/es/utils/colorUtils.js +15 -0
- package/es/utils/colorUtils.js.map +1 -0
- package/es/views/MainView/toolFooter/FooterTips/ToolHotKey/cuboid/index.js +24 -0
- package/es/views/MainView/toolFooter/FooterTips/ToolHotKey/cuboid/index.js.map +1 -0
- package/es/views/MainView/toolHeader/SwitchPattern/index.js +54 -0
- package/es/views/MainView/toolHeader/SwitchPattern/index.js.map +1 -0
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),usePointCloudViews=require("./usePointCloudViews.js"),useSingleBox=require("./useSingleBox.js"),PointCloudContext=require("../PointCloudContext.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils");const{ERotateDirection}=lbAnnotation.cAnnotation,useRotate=({currentData:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),usePointCloudViews=require("./usePointCloudViews.js"),useSingleBox=require("./useSingleBox.js"),PointCloudContext=require("../PointCloudContext.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),ahooks=require("ahooks");const{ERotateDirection}=lbAnnotation.cAnnotation,useRotate=({currentData:o})=>{const t=React.useContext(PointCloudContext.PointCloudContext),{selectedBox:i,updateSelectedBox:a}=useSingleBox.useSingleBox(),{run:c}=ahooks.useThrottleFn(s=>{const{topViewInstance:l,mainViewInstance:n,syncAllViewPointCloudColor:d}=t;if(!l||!n)return;const{pointCloud2dOperation:r}=l,e=i==null?void 0:i.info;if(!e||!(o==null?void 0:o.url)||!t.backViewInstance)return;const C=a({rotation:lbUtils.PointCloudUtils.restrictAngleRange(e.rotation+Number(Math.PI*s)/180)});r.rotatePolygon(s,ERotateDirection.Anticlockwise);const u=r.selectedPolygon;n.generateBox(e),d(C),usePointCloudViews.synchronizeSideView(e,u,t.sideViewInstance,o.url),usePointCloudViews.synchronizeBackView(e,u,t.backViewInstance,o.url),n.render()},{wait:800});return{updateRotate:c}};exports.useRotate=useRotate;
|
|
@@ -4,5 +4,5 @@ import { IAnnotationStateProps } from '@/store/annotation/map';
|
|
|
4
4
|
* @returns
|
|
5
5
|
*/
|
|
6
6
|
export declare const useRotate: ({ currentData }: IAnnotationStateProps) => {
|
|
7
|
-
updateRotate: (angle: number) => void
|
|
7
|
+
updateRotate: import("lodash").DebouncedFunc<(angle: number) => void>;
|
|
8
8
|
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var img = "data:image/svg+xml,%3csvg width='9.201172' height='9.200073' viewBox='0 0 9.20117 9.20007' fill='none' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3e %3cdesc%3e Created with Pixso. %3c/desc%3e %3cpath id='Exclude' d='M8.20117 5.59998L5.60156 5.59998L5.60156 8.20007C5.60156 8.75232 5.15234 9.20007 4.60156 9.20007C4.04883 9.20007 3.60156 8.75232 3.60156 8.20007L3.60156 5.59998L1 5.59998C0.449219 5.59998 0 5.15234 0 4.59998C0 4.04773 0.449219 3.59998 1 3.59998L3.60156 3.59998L3.60156 1C3.60156 0.447754 4.04883 0 4.60156 0C5.15234 0 5.60156 0.447754 5.60156 1L5.60156 3.59998L8.20117 3.59998C8.75391 3.59998 9.20117 4.04773 9.20117 4.59998C9.20117 5.15234 8.75391 5.59998 8.20117 5.59998Z' fill-rule='evenodd' fill='%230D53DE'/%3e %3cdefs/%3e%3c/svg%3e";
|
|
2
|
+
|
|
3
|
+
export { img as default };
|
|
4
|
+
//# sourceMappingURL=addSvg.svg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addSvg.svg.js","sources":["../../../../src/assets/annotation/pointCloudTool/addSvg.svg"],"sourcesContent":["var img = \"data:image/svg+xml,%3csvg width='9.201172' height='9.200073' viewBox='0 0 9.20117 9.20007' fill='none' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3e %3cdesc%3e Created with Pixso. %3c/desc%3e %3cpath id='Exclude' d='M8.20117 5.59998L5.60156 5.59998L5.60156 8.20007C5.60156 8.75232 5.15234 9.20007 4.60156 9.20007C4.04883 9.20007 3.60156 8.75232 3.60156 8.20007L3.60156 5.59998L1 5.59998C0.449219 5.59998 0 5.15234 0 4.59998C0 4.04773 0.449219 3.59998 1 3.59998L3.60156 3.59998L3.60156 1C3.60156 0.447754 4.04883 0 4.60156 0C5.15234 0 5.60156 0.447754 5.60156 1L5.60156 3.59998L8.20117 3.59998C8.75391 3.59998 9.20117 4.04773 9.20117 4.59998C9.20117 5.15234 8.75391 5.59998 8.20117 5.59998Z' fill-rule='evenodd' fill='%230D53DE'/%3e %3cdefs/%3e%3c/svg%3e\";\n export default img;"],"names":[],"mappings":"AAAG,IAAC,GAAG,GAAG;;;;"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var img = "data:image/svg+xml,%3csvg width='10.450195' height='10.420227' viewBox='0 0 10.4502 10.4202' fill='none' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3e %3cdesc%3e Created with Pixso. %3c/desc%3e %3cpath id='%e9%94%99%e8%af%af' d='M10.1914 0.194397C9.93066 -0.0654907 9.50879 -0.0646973 9.24854 0.196106L5.21533 4.2442L1.16699 0.210693C0.90625 -0.0491943 0.484375 -0.0484619 0.224121 0.212402C-0.0356445 0.473206 -0.034668 0.895325 0.226074 1.15521L4.27393 5.18872L0.194336 9.28302C-0.0654297 9.54382 -0.0649414 9.96594 0.196289 10.2258C0.457031 10.4857 0.878906 10.4849 1.13867 10.2241L5.21875 6.12982L9.31299 10.2095C9.57373 10.4694 9.99609 10.4687 10.2559 10.2079C10.5156 9.94702 10.5151 9.52496 10.2539 9.26508L6.15967 5.1853L10.1934 1.13721C10.4531 0.876404 10.4526 0.454285 10.1914 0.194397Z' fill-rule='evenodd' fill='%23333333'/%3e %3cdefs/%3e%3c/svg%3e";
|
|
2
|
+
|
|
3
|
+
export { img as default };
|
|
4
|
+
//# sourceMappingURL=cancel.svg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cancel.svg.js","sources":["../../../../src/assets/annotation/pointCloudTool/cancel.svg"],"sourcesContent":["var img = \"data:image/svg+xml,%3csvg width='10.450195' height='10.420227' viewBox='0 0 10.4502 10.4202' fill='none' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3e %3cdesc%3e Created with Pixso. %3c/desc%3e %3cpath id='%e9%94%99%e8%af%af' d='M10.1914 0.194397C9.93066 -0.0654907 9.50879 -0.0646973 9.24854 0.196106L5.21533 4.2442L1.16699 0.210693C0.90625 -0.0491943 0.484375 -0.0484619 0.224121 0.212402C-0.0356445 0.473206 -0.034668 0.895325 0.226074 1.15521L4.27393 5.18872L0.194336 9.28302C-0.0654297 9.54382 -0.0649414 9.96594 0.196289 10.2258C0.457031 10.4857 0.878906 10.4849 1.13867 10.2241L5.21875 6.12982L9.31299 10.2095C9.57373 10.4694 9.99609 10.4687 10.2559 10.2079C10.5156 9.94702 10.5151 9.52496 10.2539 9.26508L6.15967 5.1853L10.1934 1.13721C10.4531 0.876404 10.4526 0.454285 10.1914 0.194397Z' fill-rule='evenodd' fill='%23333333'/%3e %3cdefs/%3e%3c/svg%3e\";\n export default img;"],"names":[],"mappings":"AAAG,IAAC,GAAG,GAAG;;;;"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var img = "data:image/svg+xml,%3csvg width='24.000000' height='24.000000' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3e %3cdesc%3e Created with Pixso. %3c/desc%3e %3cmask id='mask1_15950' mask-type='alpha' maskUnits='userSpaceOnUse' x='0.000000' y='0.000000' width='24.000000' height='24.000000'%3e %3crect id='Frame 1312316549 (Background/Mask)' width='24.000000' height='24.000000' fill='%23C4C4C4'/%3e %3c/mask%3e %3cg mask='url(%23mask1_15950)'%3e %3ccircle id='Ellipse 1677' cx='12.000000' cy='12.000000' r='9.000000' stroke='%23999999' stroke-width='2.000000' stroke-dasharray='0 0'/%3e %3c/g%3e %3cg mask='url(%23mask1_15950)'%3e %3ccircle id='Ellipse 1678' cx='12.000000' cy='12.000000' r='4.000000' fill='%23999999'/%3e %3c/g%3e %3cdefs/%3e%3c/svg%3e";
|
|
2
|
+
|
|
3
|
+
export { img as default };
|
|
4
|
+
//# sourceMappingURL=circleSelector.svg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"circleSelector.svg.js","sources":["../../../../src/assets/annotation/pointCloudTool/circleSelector.svg"],"sourcesContent":["var img = \"data:image/svg+xml,%3csvg width='24.000000' height='24.000000' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3e %3cdesc%3e Created with Pixso. %3c/desc%3e %3cmask id='mask1_15950' mask-type='alpha' maskUnits='userSpaceOnUse' x='0.000000' y='0.000000' width='24.000000' height='24.000000'%3e %3crect id='Frame 1312316549 (Background/Mask)' width='24.000000' height='24.000000' fill='%23C4C4C4'/%3e %3c/mask%3e %3cg mask='url(%23mask1_15950)'%3e %3ccircle id='Ellipse 1677' cx='12.000000' cy='12.000000' r='9.000000' stroke='%23999999' stroke-width='2.000000' stroke-dasharray='0 0'/%3e %3c/g%3e %3cg mask='url(%23mask1_15950)'%3e %3ccircle id='Ellipse 1678' cx='12.000000' cy='12.000000' r='4.000000' fill='%23999999'/%3e %3c/g%3e %3cdefs/%3e%3c/svg%3e\";\n export default img;"],"names":[],"mappings":"AAAG,IAAC,GAAG,GAAG;;;;"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var img = "data:image/svg+xml,%3csvg width='24.000000' height='24.000000' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3e %3cdesc%3e Created with Pixso. %3c/desc%3e %3cmask id='mask1_15950' mask-type='alpha' maskUnits='userSpaceOnUse' x='0.000000' y='0.000000' width='24.000000' height='24.000000'%3e %3crect id='Frame 1312316549 (Background/Mask)' width='24.000000' height='24.000000' fill='%231664FF'/%3e %3c/mask%3e %3cg mask='url(%23mask1_15950)'%3e %3ccircle id='Ellipse 1677' cx='12.000000' cy='12.000000' r='9.000000' stroke='%231664FF' stroke-width='2.000000' stroke-dasharray='0 0'/%3e %3c/g%3e %3cg mask='url(%23mask1_15950)'%3e %3ccircle id='Ellipse 1678' cx='12.000000' cy='12.000000' r='4.000000' fill='%231664FF'/%3e %3c/g%3e %3cdefs/%3e%3c/svg%3e";
|
|
2
|
+
|
|
3
|
+
export { img as default };
|
|
4
|
+
//# sourceMappingURL=circleSelector_a.svg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"circleSelector_a.svg.js","sources":["../../../../src/assets/annotation/pointCloudTool/circleSelector_a.svg"],"sourcesContent":["var img = \"data:image/svg+xml,%3csvg width='24.000000' height='24.000000' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3e %3cdesc%3e Created with Pixso. %3c/desc%3e %3cmask id='mask1_15950' mask-type='alpha' maskUnits='userSpaceOnUse' x='0.000000' y='0.000000' width='24.000000' height='24.000000'%3e %3crect id='Frame 1312316549 (Background/Mask)' width='24.000000' height='24.000000' fill='%231664FF'/%3e %3c/mask%3e %3cg mask='url(%23mask1_15950)'%3e %3ccircle id='Ellipse 1677' cx='12.000000' cy='12.000000' r='9.000000' stroke='%231664FF' stroke-width='2.000000' stroke-dasharray='0 0'/%3e %3c/g%3e %3cg mask='url(%23mask1_15950)'%3e %3ccircle id='Ellipse 1678' cx='12.000000' cy='12.000000' r='4.000000' fill='%231664FF'/%3e %3c/g%3e %3cdefs/%3e%3c/svg%3e\";\n export default img;"],"names":[],"mappings":"AAAG,IAAC,GAAG,GAAG;;;;"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var img = "data:image/svg+xml,%3csvg width='20.000000' height='20.000000' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3e %3cdesc%3e Created with Pixso. %3c/desc%3e %3cpath id='Exclude' d='M10 20C15.5234 20 20 15.5228 20 10C20 4.47717 15.5234 0 10 0C4.47656 0 0 4.47717 0 10C0 15.5228 4.47656 20 10 20Z' fill-rule='evenodd' fill='%230D53DE'/%3e %3cpath id='Exclude' d='M14.5547 9.99866C14.5547 9.44641 14.1074 8.99866 13.5547 8.99866L10.9551 8.99866L8.95508 8.99866L6.35352 8.99866C5.80273 8.99866 5.35352 9.44641 5.35352 9.99866C5.35352 10.551 5.80273 10.9987 6.35352 10.9987L8.95508 10.9987L10.9551 10.9987L13.5547 10.9987C14.1074 10.9987 14.5547 10.551 14.5547 9.99866Z' fill-rule='evenodd' fill='%230D53DE'/%3e %3cdefs/%3e%3c/svg%3e";
|
|
2
|
+
|
|
3
|
+
export { img as default };
|
|
4
|
+
//# sourceMappingURL=clearSvg.svg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clearSvg.svg.js","sources":["../../../../src/assets/annotation/pointCloudTool/clearSvg.svg"],"sourcesContent":["var img = \"data:image/svg+xml,%3csvg width='20.000000' height='20.000000' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3e %3cdesc%3e Created with Pixso. %3c/desc%3e %3cpath id='Exclude' d='M10 20C15.5234 20 20 15.5228 20 10C20 4.47717 15.5234 0 10 0C4.47656 0 0 4.47717 0 10C0 15.5228 4.47656 20 10 20Z' fill-rule='evenodd' fill='%230D53DE'/%3e %3cpath id='Exclude' d='M14.5547 9.99866C14.5547 9.44641 14.1074 8.99866 13.5547 8.99866L10.9551 8.99866L8.95508 8.99866L6.35352 8.99866C5.80273 8.99866 5.35352 9.44641 5.35352 9.99866C5.35352 10.551 5.80273 10.9987 6.35352 10.9987L8.95508 10.9987L10.9551 10.9987L13.5547 10.9987C14.1074 10.9987 14.5547 10.551 14.5547 9.99866Z' fill-rule='evenodd' fill='%230D53DE'/%3e %3cdefs/%3e%3c/svg%3e\";\n export default img;"],"names":[],"mappings":"AAAG,IAAC,GAAG,GAAG;;;;"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var img = "data:image/svg+xml,%3csvg width='20.250000' height='18.000000' viewBox='0 0 20.25 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3e %3crect id='Rectangle 12047' x='0.500000' y='0.500000' width='13.062500' height='13.625000' stroke='%23B4B4B4' stroke-dasharray='0 0'/%3e %3crect id='Rectangle 12048' x='5.625000' y='3.375000' width='14.625000' height='14.625000' fill='%23898989'/%3e %3cdefs/%3e%3c/svg%3e";
|
|
2
|
+
|
|
3
|
+
export { img as default };
|
|
4
|
+
//# sourceMappingURL=coverMode.svg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coverMode.svg.js","sources":["../../../../src/assets/annotation/pointCloudTool/coverMode.svg"],"sourcesContent":["var img = \"data:image/svg+xml,%3csvg width='20.250000' height='18.000000' viewBox='0 0 20.25 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3e %3crect id='Rectangle 12047' x='0.500000' y='0.500000' width='13.062500' height='13.625000' stroke='%23B4B4B4' stroke-dasharray='0 0'/%3e %3crect id='Rectangle 12048' x='5.625000' y='3.375000' width='14.625000' height='14.625000' fill='%23898989'/%3e %3cdefs/%3e%3c/svg%3e\";\n export default img;"],"names":[],"mappings":"AAAG,IAAC,GAAG,GAAG;;;;"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var img = "data:image/svg+xml,%3csvg width='13.666504' height='9.666687' viewBox='0 0 13.6665 9.66669' fill='none' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3e %3cdesc%3e Created with Pixso. %3c/desc%3e %3cpath id='%e6%ad%a3%e7%a1%ae' d='M13.4761 1.1333L5.30957 9.46661C5.18164 9.59692 5.00635 9.66919 4.82373 9.66663C4.6416 9.664 4.46826 9.58679 4.34424 9.45294L0.177734 4.95294C-0.0727539 4.6828 -0.0566406 4.26099 0.213867 4.0108C0.483887 3.76068 0.905762 3.77692 1.15576 4.04706L4.84717 8.03357L12.5239 0.200073C12.7817 -0.0629272 13.2036 -0.0671997 13.4668 0.190552C13.7295 0.448242 13.7339 0.8703 13.4761 1.1333Z' fill-rule='evenodd' fill='%23333333'/%3e %3cdefs/%3e%3c/svg%3e";
|
|
2
|
+
|
|
3
|
+
export { img as default };
|
|
4
|
+
//# sourceMappingURL=finish.svg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"finish.svg.js","sources":["../../../../src/assets/annotation/pointCloudTool/finish.svg"],"sourcesContent":["var img = \"data:image/svg+xml,%3csvg width='13.666504' height='9.666687' viewBox='0 0 13.6665 9.66669' fill='none' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3e %3cdesc%3e Created with Pixso. %3c/desc%3e %3cpath id='%e6%ad%a3%e7%a1%ae' d='M13.4761 1.1333L5.30957 9.46661C5.18164 9.59692 5.00635 9.66919 4.82373 9.66663C4.6416 9.664 4.46826 9.58679 4.34424 9.45294L0.177734 4.95294C-0.0727539 4.6828 -0.0566406 4.26099 0.213867 4.0108C0.483887 3.76068 0.905762 3.77692 1.15576 4.04706L4.84717 8.03357L12.5239 0.200073C12.7817 -0.0629272 13.2036 -0.0671997 13.4668 0.190552C13.7295 0.448242 13.7339 0.8703 13.4761 1.1333Z' fill-rule='evenodd' fill='%23333333'/%3e %3cdefs/%3e%3c/svg%3e\";\n export default img;"],"names":[],"mappings":"AAAG,IAAC,GAAG,GAAG;;;;"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var img = "data:image/svg+xml,%3csvg width='24.000000' height='24.000000' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3e %3cdesc%3e Created with Pixso. %3c/desc%3e %3cmask id='mask1_15945' mask-type='alpha' maskUnits='userSpaceOnUse' x='0.000000' y='0.000000' width='24.000000' height='24.000000'%3e %3crect id='Frame 1312316543 (Background/Mask)' width='24.000000' height='24.000000' fill='%23999999'/%3e %3c/mask%3e %3cg mask='url(%23mask1_15945)'%3e %3cpath id='Vector 197' d='M6.82031 21.1879C7.30859 20.8242 7.65674 20.4422 7.89697 20.0767C8.56055 19.0654 7.91553 17.8707 7.32861 16.813C6.78955 15.8416 6.34033 14.9126 5.68604 14.0402C3.5 11.1254 3.98877 7.18506 6.86133 4.94373C9.97998 2.51038 13.4199 2.427 15.9365 3.36963C16.5493 3.59912 17.186 3.94055 17.7881 4.3363C20.1196 5.86804 21.0063 8.93555 19.5503 11.3146C17.5649 14.5581 13.4385 15.5564 10.3657 15.641' stroke='%23999999' stroke-width='1.995000' stroke-linejoin='round' stroke-linecap='round' stroke-dasharray='0 0'/%3e %3c/g%3e %3cg mask='url(%23mask1_15945)'%3e %3cpath id='Vector 198' d='M4.979 17.3167C3.92969 16.8472 3.81592 15.4429 4.79492 14.8404C5.9707 14.1169 7.58301 13.7576 9.354 14.7828C10.374 15.3734 10.4321 16.5123 9.39893 17.0798C8.32764 17.6683 6.73828 18.1039 4.979 17.3167Z' stroke='%23999999' stroke-width='1.895129' stroke-linejoin='round' stroke-dasharray='0 0'/%3e %3c/g%3e %3cdefs/%3e%3c/svg%3e";
|
|
2
|
+
|
|
3
|
+
export { img as default };
|
|
4
|
+
//# sourceMappingURL=lassoSelector.svg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lassoSelector.svg.js","sources":["../../../../src/assets/annotation/pointCloudTool/lassoSelector.svg"],"sourcesContent":["var img = \"data:image/svg+xml,%3csvg width='24.000000' height='24.000000' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3e %3cdesc%3e Created with Pixso. %3c/desc%3e %3cmask id='mask1_15945' mask-type='alpha' maskUnits='userSpaceOnUse' x='0.000000' y='0.000000' width='24.000000' height='24.000000'%3e %3crect id='Frame 1312316543 (Background/Mask)' width='24.000000' height='24.000000' fill='%23999999'/%3e %3c/mask%3e %3cg mask='url(%23mask1_15945)'%3e %3cpath id='Vector 197' d='M6.82031 21.1879C7.30859 20.8242 7.65674 20.4422 7.89697 20.0767C8.56055 19.0654 7.91553 17.8707 7.32861 16.813C6.78955 15.8416 6.34033 14.9126 5.68604 14.0402C3.5 11.1254 3.98877 7.18506 6.86133 4.94373C9.97998 2.51038 13.4199 2.427 15.9365 3.36963C16.5493 3.59912 17.186 3.94055 17.7881 4.3363C20.1196 5.86804 21.0063 8.93555 19.5503 11.3146C17.5649 14.5581 13.4385 15.5564 10.3657 15.641' stroke='%23999999' stroke-width='1.995000' stroke-linejoin='round' stroke-linecap='round' stroke-dasharray='0 0'/%3e %3c/g%3e %3cg mask='url(%23mask1_15945)'%3e %3cpath id='Vector 198' d='M4.979 17.3167C3.92969 16.8472 3.81592 15.4429 4.79492 14.8404C5.9707 14.1169 7.58301 13.7576 9.354 14.7828C10.374 15.3734 10.4321 16.5123 9.39893 17.0798C8.32764 17.6683 6.73828 18.1039 4.979 17.3167Z' stroke='%23999999' stroke-width='1.895129' stroke-linejoin='round' stroke-dasharray='0 0'/%3e %3c/g%3e %3cdefs/%3e%3c/svg%3e\";\n export default img;"],"names":[],"mappings":"AAAG,IAAC,GAAG,GAAG;;;;"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var img = "data:image/svg+xml,%3csvg width='24.000000' height='24.000000' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3e %3cdesc%3e Created with Pixso. %3c/desc%3e %3cmask id='mask1_15945' mask-type='alpha' maskUnits='userSpaceOnUse' x='0.000000' y='0.000000' width='24.000000' height='24.000000'%3e %3crect id='Frame 1312316543 (Background/Mask)' width='24.000000' height='24.000000' fill='%23C4C4C4'/%3e %3c/mask%3e %3cg mask='url(%23mask1_15945)'%3e %3cpath id='Vector 197' d='M6.82031 21.1879C7.30859 20.8242 7.65674 20.4422 7.89697 20.0767C8.56055 19.0654 7.91553 17.8707 7.32861 16.813C6.78955 15.8416 6.34033 14.9126 5.68604 14.0402C3.5 11.1254 3.98877 7.18506 6.86133 4.94373C9.97998 2.51038 13.4199 2.427 15.9365 3.36963C16.5493 3.59912 17.186 3.94055 17.7881 4.3363C20.1196 5.86804 21.0063 8.93555 19.5503 11.3146C17.5649 14.5581 13.4385 15.5564 10.3657 15.641' stroke='%231664FF' stroke-width='1.995000' stroke-linejoin='round' stroke-linecap='round' stroke-dasharray='0 0'/%3e %3c/g%3e %3cg mask='url(%23mask1_15945)'%3e %3cpath id='Vector 198' d='M4.979 17.3167C3.92969 16.8472 3.81592 15.4429 4.79492 14.8404C5.9707 14.1169 7.58301 13.7576 9.354 14.7828C10.374 15.3734 10.4321 16.5123 9.39893 17.0798C8.32764 17.6683 6.73828 18.1039 4.979 17.3167Z' stroke='%231664FF' stroke-width='1.895129' stroke-linejoin='round' stroke-dasharray='0 0'/%3e %3c/g%3e %3cdefs/%3e%3c/svg%3e";
|
|
2
|
+
|
|
3
|
+
export { img as default };
|
|
4
|
+
//# sourceMappingURL=lassoSelector_a.svg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lassoSelector_a.svg.js","sources":["../../../../src/assets/annotation/pointCloudTool/lassoSelector_a.svg"],"sourcesContent":["var img = \"data:image/svg+xml,%3csvg width='24.000000' height='24.000000' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3e %3cdesc%3e Created with Pixso. %3c/desc%3e %3cmask id='mask1_15945' mask-type='alpha' maskUnits='userSpaceOnUse' x='0.000000' y='0.000000' width='24.000000' height='24.000000'%3e %3crect id='Frame 1312316543 (Background/Mask)' width='24.000000' height='24.000000' fill='%23C4C4C4'/%3e %3c/mask%3e %3cg mask='url(%23mask1_15945)'%3e %3cpath id='Vector 197' d='M6.82031 21.1879C7.30859 20.8242 7.65674 20.4422 7.89697 20.0767C8.56055 19.0654 7.91553 17.8707 7.32861 16.813C6.78955 15.8416 6.34033 14.9126 5.68604 14.0402C3.5 11.1254 3.98877 7.18506 6.86133 4.94373C9.97998 2.51038 13.4199 2.427 15.9365 3.36963C16.5493 3.59912 17.186 3.94055 17.7881 4.3363C20.1196 5.86804 21.0063 8.93555 19.5503 11.3146C17.5649 14.5581 13.4385 15.5564 10.3657 15.641' stroke='%231664FF' stroke-width='1.995000' stroke-linejoin='round' stroke-linecap='round' stroke-dasharray='0 0'/%3e %3c/g%3e %3cg mask='url(%23mask1_15945)'%3e %3cpath id='Vector 198' d='M4.979 17.3167C3.92969 16.8472 3.81592 15.4429 4.79492 14.8404C5.9707 14.1169 7.58301 13.7576 9.354 14.7828C10.374 15.3734 10.4321 16.5123 9.39893 17.0798C8.32764 17.6683 6.73828 18.1039 4.979 17.3167Z' stroke='%231664FF' stroke-width='1.895129' stroke-linejoin='round' stroke-dasharray='0 0'/%3e %3c/g%3e %3cdefs/%3e%3c/svg%3e\";\n export default img;"],"names":[],"mappings":"AAAG,IAAC,GAAG,GAAG;;;;"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var img = "data:image/svg+xml,%3csvg width='20.250000' height='18.000000' viewBox='0 0 20.25 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3e %3crect id='Rectangle 12047' width='14.062500' height='14.625000' fill='%23AAAAAA'/%3e %3crect id='Rectangle 12048' x='6.125000' y='3.875000' width='13.625000' height='13.625000' fill='white'/%3e %3crect id='Rectangle 12048' x='6.125000' y='3.875000' width='13.625000' height='13.625000' stroke='%23CCCCCC' stroke-dasharray='0 0'/%3e %3cdefs/%3e%3c/svg%3e";
|
|
2
|
+
|
|
3
|
+
export { img as default };
|
|
4
|
+
//# sourceMappingURL=unCoverMode.svg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unCoverMode.svg.js","sources":["../../../../src/assets/annotation/pointCloudTool/unCoverMode.svg"],"sourcesContent":["var img = \"data:image/svg+xml,%3csvg width='20.250000' height='18.000000' viewBox='0 0 20.25 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3e %3crect id='Rectangle 12047' width='14.062500' height='14.625000' fill='%23AAAAAA'/%3e %3crect id='Rectangle 12048' x='6.125000' y='3.875000' width='13.625000' height='13.625000' fill='white'/%3e %3crect id='Rectangle 12048' x='6.125000' y='3.875000' width='13.625000' height='13.625000' stroke='%23CCCCCC' stroke-dasharray='0 0'/%3e %3cdefs/%3e%3c/svg%3e\";\n export default img;"],"names":[],"mappings":"AAAG,IAAC,GAAG,GAAG;;;;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RgbaColorPicker } from 'react-colorful';
|
|
3
|
+
import { toRGBAObj, toRGBAStr } from '../../utils/colorUtils.js';
|
|
4
|
+
|
|
5
|
+
const Palette = (props) => {
|
|
6
|
+
const {setColor, defaultColor} = props;
|
|
7
|
+
return /* @__PURE__ */ React.createElement(RgbaColorPicker, {
|
|
8
|
+
color: toRGBAObj(defaultColor),
|
|
9
|
+
onChange: (values) => {
|
|
10
|
+
const colorStr = toRGBAStr(values);
|
|
11
|
+
setColor(colorStr);
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export { Palette as default };
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/colorPalette/index.tsx"],"sourcesContent":["/**\n * @file Color Palette\n * @author lixinghua <lixinghua_vendor@sensetime.com>\n * @date 2023.04.24\n */\nimport React from 'react';\nimport { RgbaColorPicker } from 'react-colorful';\nimport { toRGBAObj, toRGBAStr } from '@/utils/colorUtils';\n\ninterface IProps {\n defaultColor?: string;\n setColor: (color: string) => void;\n}\n\nconst Palette = (props: IProps) => {\n const { setColor, defaultColor } = props;\n\n return (\n <RgbaColorPicker\n color={toRGBAObj(defaultColor)}\n onChange={(values) => {\n const colorStr = toRGBAStr(values);\n setColor(colorStr);\n }}\n />\n );\n};\nexport default Palette;\n"],"names":[],"mappings":";;;;AAcM,MAAA,OAAA,GAAU,CAAC,KAAkB,KAAA;AACjC,EAAM,MAAA,CAAE,UAAU,YAAiB,CAAA,GAAA,KAAA,CAAA;AAEnC,EAAA,2CACG,eAAD,EAAA;AAAA,IACE,OAAO,SAAU,CAAA,YAAA,CAAA;AAAA,IACjB,QAAA,EAAU,CAAC,MAAW,KAAA;AACpB,MAAA,MAAM,WAAW,SAAU,CAAA,MAAA,CAAA,CAAA;AAC3B,MAAS,QAAA,CAAA,QAAA,CAAA,CAAA;AAAA,KAAA;AAAA,GAAA,CAAA,CAAA;AAAA;;;;"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import useSize from '../../hooks/useSize.js';
|
|
2
|
+
import { a2MapStateToProps } from '../../store/annotation/map.js';
|
|
3
|
+
import { LabelBeeContext } from '../../store/ctx.js';
|
|
4
|
+
import { getClassName } from '../../utils/dom.js';
|
|
5
|
+
import { PointCloud, CommonToolUtils } from '@labelbee/lb-annotation';
|
|
6
|
+
import React, { useRef, useContext, useEffect } from 'react';
|
|
7
|
+
import { connect } from 'react-redux';
|
|
8
|
+
import { PointCloudContext } from './PointCloudContext.js';
|
|
9
|
+
import { EPointCloudSegmentMode } from '@labelbee/lb-utils';
|
|
10
|
+
|
|
11
|
+
const PointCloudSegment = ({currentData, config, checkMode}) => {
|
|
12
|
+
var _a, _b;
|
|
13
|
+
const domRef = useRef(null);
|
|
14
|
+
const {setPtSegmentInstance, ptSegmentInstance, setDefaultAttribute} = useContext(PointCloudContext);
|
|
15
|
+
const size = useSize(domRef);
|
|
16
|
+
const defaultAttribute = (_b = (_a = config == null ? void 0 : config.attributeList) == null ? void 0 : _a[0]) == null ? void 0 : _b.value;
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
var _a2;
|
|
19
|
+
if (!(size == null ? void 0 : size.width) || !domRef.current) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const orthographicParams = {
|
|
23
|
+
left: -size.width / 2,
|
|
24
|
+
right: size.width / 2,
|
|
25
|
+
top: size.height / 2,
|
|
26
|
+
bottom: -size.height / 2,
|
|
27
|
+
near: 100,
|
|
28
|
+
far: -100
|
|
29
|
+
};
|
|
30
|
+
const ptSegmentInstance2 = new PointCloud({
|
|
31
|
+
container: domRef.current,
|
|
32
|
+
isOrthographicCamera: true,
|
|
33
|
+
orthographicParams,
|
|
34
|
+
config
|
|
35
|
+
});
|
|
36
|
+
ptSegmentInstance2.store.setAttribute(defaultAttribute);
|
|
37
|
+
setDefaultAttribute(defaultAttribute);
|
|
38
|
+
setPtSegmentInstance(ptSegmentInstance2);
|
|
39
|
+
if (currentData == null ? void 0 : currentData.url) {
|
|
40
|
+
ptSegmentInstance2.loadPCDFile((_a2 = currentData == null ? void 0 : currentData.url) != null ? _a2 : "");
|
|
41
|
+
}
|
|
42
|
+
}, [size]);
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
var _a2;
|
|
45
|
+
if (ptSegmentInstance && currentData.url) {
|
|
46
|
+
ptSegmentInstance.loadPCDFile((_a2 = currentData == null ? void 0 : currentData.url) != null ? _a2 : "");
|
|
47
|
+
}
|
|
48
|
+
}, [currentData, ptSegmentInstance]);
|
|
49
|
+
const segmentKeydownEvents = (lowerCaseKey, e) => {
|
|
50
|
+
switch (lowerCaseKey) {
|
|
51
|
+
case "h":
|
|
52
|
+
ptSegmentInstance == null ? void 0 : ptSegmentInstance.emit("LassoSelector");
|
|
53
|
+
break;
|
|
54
|
+
case "j":
|
|
55
|
+
ptSegmentInstance == null ? void 0 : ptSegmentInstance.emit("CircleSelector");
|
|
56
|
+
break;
|
|
57
|
+
case "u":
|
|
58
|
+
ptSegmentInstance == null ? void 0 : ptSegmentInstance.emit("setSegmentMode", EPointCloudSegmentMode.Add);
|
|
59
|
+
break;
|
|
60
|
+
case "i":
|
|
61
|
+
ptSegmentInstance == null ? void 0 : ptSegmentInstance.emit("setSegmentMode", EPointCloudSegmentMode.Remove);
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
const onKeyDown = (e) => {
|
|
66
|
+
if (!CommonToolUtils.hotkeyFilter(e) || checkMode === true) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const lowerCaseKey = e.key.toLocaleLowerCase();
|
|
70
|
+
segmentKeydownEvents(lowerCaseKey);
|
|
71
|
+
};
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
window.addEventListener("keydown", onKeyDown);
|
|
74
|
+
return () => {
|
|
75
|
+
window.removeEventListener("keydown", onKeyDown);
|
|
76
|
+
};
|
|
77
|
+
}, [ptSegmentInstance]);
|
|
78
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
79
|
+
className: getClassName("point-cloud-layout"),
|
|
80
|
+
ref: domRef
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
var PointCloudSegment$1 = connect(a2MapStateToProps, null, null, {context: LabelBeeContext})(PointCloudSegment);
|
|
84
|
+
|
|
85
|
+
export { PointCloudSegment$1 as default };
|
|
86
|
+
//# sourceMappingURL=PointCloudSegment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PointCloudSegment.js","sources":["../../../src/components/pointCloudView/PointCloudSegment.tsx"],"sourcesContent":["import useSize from '@/hooks/useSize';\nimport { IA2MapStateProps, a2MapStateToProps } from '@/store/annotation/map';\nimport { LabelBeeContext } from '@/store/ctx';\nimport { getClassName } from '@/utils/dom';\nimport { CommonToolUtils, PointCloud } from '@labelbee/lb-annotation';\nimport React, { useContext, useEffect, useRef } from 'react';\nimport { connect } from 'react-redux';\nimport { PointCloudContext } from './PointCloudContext';\nimport { EPointCloudSegmentMode } from '@labelbee/lb-utils';\n\ninterface IProps extends IA2MapStateProps {\n checkMode?: boolean;\n}\n\nconst PointCloudSegment: React.FC<IProps> = ({ currentData, config, checkMode }) => {\n const domRef = useRef<HTMLDivElement>(null);\n const { setPtSegmentInstance, ptSegmentInstance, setDefaultAttribute } =\n useContext(PointCloudContext);\n const size = useSize(domRef);\n\n const defaultAttribute = config?.attributeList?.[0]?.value;\n\n useEffect(() => {\n if (!size?.width || !domRef.current) {\n return;\n }\n\n const orthographicParams = {\n left: -size.width / 2,\n right: size.width / 2,\n top: size.height / 2,\n bottom: -size.height / 2,\n near: 100,\n far: -100,\n };\n\n const ptSegmentInstance = new PointCloud({\n container: domRef.current,\n isOrthographicCamera: true,\n orthographicParams,\n config,\n });\n\n ptSegmentInstance.store.setAttribute(defaultAttribute);\n setDefaultAttribute(defaultAttribute);\n\n setPtSegmentInstance(ptSegmentInstance);\n\n // TODO\n if (currentData?.url) {\n ptSegmentInstance.loadPCDFile(currentData?.url ?? '');\n }\n }, [size]);\n\n // Template just for Test\n useEffect(() => {\n if (ptSegmentInstance && currentData.url) {\n ptSegmentInstance.loadPCDFile(currentData?.url ?? '');\n }\n }, [currentData, ptSegmentInstance]);\n\n const segmentKeydownEvents = (lowerCaseKey: string, e: KeyboardEvent) => {\n switch (lowerCaseKey) {\n case 'h':\n ptSegmentInstance?.emit('LassoSelector');\n break;\n\n case 'j':\n ptSegmentInstance?.emit('CircleSelector');\n break;\n\n case 'u':\n ptSegmentInstance?.emit('setSegmentMode', EPointCloudSegmentMode.Add);\n break;\n\n case 'i':\n ptSegmentInstance?.emit('setSegmentMode', EPointCloudSegmentMode.Remove);\n break;\n }\n };\n\n const onKeyDown = (e: KeyboardEvent) => {\n if (!CommonToolUtils.hotkeyFilter(e) || checkMode === true) {\n return;\n }\n\n const lowerCaseKey = e.key.toLocaleLowerCase();\n\n segmentKeydownEvents(lowerCaseKey, e);\n };\n\n useEffect(() => {\n window.addEventListener('keydown', onKeyDown);\n\n return () => {\n window.removeEventListener('keydown', onKeyDown);\n };\n }, [ptSegmentInstance]);\n\n return <div className={getClassName('point-cloud-layout')} ref={domRef} />;\n};\n\nexport default connect(a2MapStateToProps, null, null, { context: LabelBeeContext })(\n PointCloudSegment,\n);\n"],"names":[],"mappings":";;;;;;;;;;AAcA,MAAM,iBAAsC,GAAA,CAAC,CAAE,WAAA,EAAa,QAAQ,SAAgB,CAAA,KAAA;AAdpF,EAAA,IAAA,EAAA,EAAA,EAAA,CAAA;AAeE,EAAA,MAAM,SAAS,MAAuB,CAAA,IAAA,CAAA,CAAA;AACtC,EAAA,MAAM,CAAE,oBAAA,EAAsB,iBAAmB,EAAA,mBAAA,CAAA,GAC/C,UAAW,CAAA,iBAAA,CAAA,CAAA;AACb,EAAA,MAAM,OAAO,OAAQ,CAAA,MAAA,CAAA,CAAA;AAErB,EAAA,MAAM,g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N,EAAM,MAAA,SAAA,GAAY,CAAC,CAAqB,KAAA;AACtC,IAAA,IAAI,CAAC,eAAA,CAAgB,YAAa,CAAA,CAAA,CAAA,IAAM,cAAc,IAAM,EAAA;AAC1D,MAAA,OAAA;AAAA,KAAA;AAGF,IAAM,MAAA,YAAA,GAAe,EAAE,GAAI,CAAA,iBAAA,EAAA,CAAA;AAE3B,IAAA,oBAAA,CAAqB,YAAc,CAAA,CAAA;AAAA,GAAA,CAAA;AAGrC,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,MAAA,CAAO,iBAAiB,SAAW,EAAA,SAAA,CAAA,CAAA;AAEnC,IAAA,OAAO,MAAM;AACX,MAAA,MAAA,CAAO,oBAAoB,SAAW,EAAA,SAAA,CAAA,CAAA;AAAA,KAAA,CAAA;AAAA,GAAA,EAEvC,CAAC,iBAAA,CAAA,CAAA,CAAA;AAEJ,EAAA,2CAAQ,KAAD,EAAA;AAAA,IAAK,WAAW,YAAa,CAAA,oBAAA,CAAA;AAAA,IAAuB,GAAK,EAAA,MAAA;AAAA,GAAA,CAAA,CAAA;AAAA,CAAA,CAAA;AAGlE,0BAAe,QAAQ,iBAAmB,EAAA,IAAA,EAAM,IAAM,EAAA,CAAE,SAAS,eAC/D,CAAA,CAAA,CAAA,iBAAA,CAAA;;;;"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { useContext, useEffect } from 'react';
|
|
2
|
+
import { a2MapStateToProps } from '../../store/annotation/map.js';
|
|
3
|
+
import { connect } from 'react-redux';
|
|
4
|
+
import { LabelBeeContext } from '../../store/ctx.js';
|
|
5
|
+
import { useCustomToolInstance } from '../../hooks/annotation.js';
|
|
6
|
+
import { jsonParser } from '../../utils/index.js';
|
|
7
|
+
import { PointCloudContext } from './PointCloudContext.js';
|
|
8
|
+
import { CommonToolUtils } from '@labelbee/lb-annotation';
|
|
9
|
+
import { EPointCloudSegmentMode } from '@labelbee/lb-utils';
|
|
10
|
+
import { useAttribute } from './hooks/useAttribute.js';
|
|
11
|
+
|
|
12
|
+
const PointCloudSegmentListener = ({checkMode, currentData}) => {
|
|
13
|
+
const basicInfo = jsonParser(currentData.result);
|
|
14
|
+
const {toolInstanceRef} = useCustomToolInstance({basicInfo});
|
|
15
|
+
const {updateSegmentAttribute} = useAttribute();
|
|
16
|
+
const ptCtx = useContext(PointCloudContext);
|
|
17
|
+
const {ptSegmentInstance} = ptCtx;
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
var _a;
|
|
20
|
+
if (ptSegmentInstance && currentData.url) {
|
|
21
|
+
ptSegmentInstance.loadPCDFile((_a = currentData == null ? void 0 : currentData.url) != null ? _a : "");
|
|
22
|
+
}
|
|
23
|
+
}, [currentData, ptSegmentInstance]);
|
|
24
|
+
const segmentKeydownEvents = (lowerCaseKey, e) => {
|
|
25
|
+
switch (lowerCaseKey) {
|
|
26
|
+
case "h":
|
|
27
|
+
ptSegmentInstance == null ? void 0 : ptSegmentInstance.emit("LassoSelector");
|
|
28
|
+
break;
|
|
29
|
+
case "j":
|
|
30
|
+
ptSegmentInstance == null ? void 0 : ptSegmentInstance.emit("CircleSelector");
|
|
31
|
+
break;
|
|
32
|
+
case "u":
|
|
33
|
+
ptSegmentInstance == null ? void 0 : ptSegmentInstance.emit("setSegmentMode", EPointCloudSegmentMode.Add);
|
|
34
|
+
break;
|
|
35
|
+
case "i":
|
|
36
|
+
ptSegmentInstance == null ? void 0 : ptSegmentInstance.emit("setSegmentMode", EPointCloudSegmentMode.Remove);
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const onKeyDown = (e) => {
|
|
41
|
+
if (!CommonToolUtils.hotkeyFilter(e) || checkMode === true) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const lowerCaseKey = e.key.toLocaleLowerCase();
|
|
45
|
+
segmentKeydownEvents(lowerCaseKey);
|
|
46
|
+
};
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
window.addEventListener("keydown", onKeyDown);
|
|
49
|
+
toolInstanceRef.current.setDefaultAttribute = (newAttribute) => {
|
|
50
|
+
updateSegmentAttribute(newAttribute);
|
|
51
|
+
};
|
|
52
|
+
return () => {
|
|
53
|
+
window.removeEventListener("keydown", onKeyDown);
|
|
54
|
+
};
|
|
55
|
+
}, [ptSegmentInstance]);
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
toolInstanceRef.current.exportData = () => {
|
|
58
|
+
return [ptCtx.pointCloudBoxList, {valid: ptCtx.valid}];
|
|
59
|
+
};
|
|
60
|
+
toolInstanceRef.current.exportCustomData = () => {
|
|
61
|
+
var _a, _b, _c, _d, _e;
|
|
62
|
+
console.log("ptSegmentInstance?.store?.segmentData", (_a = ptSegmentInstance == null ? void 0 : ptSegmentInstance.store) == null ? void 0 : _a.formatData);
|
|
63
|
+
return {
|
|
64
|
+
resultPolygon: (_b = ptCtx.polygonList) != null ? _b : [],
|
|
65
|
+
resultLine: (_c = ptCtx.lineList) != null ? _c : [],
|
|
66
|
+
resultPoint: (_d = ptCtx.pointCloudSphereList) != null ? _d : [],
|
|
67
|
+
segmentation: (_e = ptSegmentInstance == null ? void 0 : ptSegmentInstance.store) == null ? void 0 : _e.formatData
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
}, [
|
|
71
|
+
ptCtx.pointCloudBoxList,
|
|
72
|
+
ptCtx.valid,
|
|
73
|
+
ptCtx.polygonList,
|
|
74
|
+
ptCtx.lineList,
|
|
75
|
+
ptCtx.pointCloudSphereList,
|
|
76
|
+
ptCtx.ptSegmentInstance
|
|
77
|
+
]);
|
|
78
|
+
return null;
|
|
79
|
+
};
|
|
80
|
+
var PointCloudSegmentListener$1 = connect(a2MapStateToProps, null, null, {context: LabelBeeContext})(PointCloudSegmentListener);
|
|
81
|
+
|
|
82
|
+
export { PointCloudSegmentListener$1 as default };
|
|
83
|
+
//# sourceMappingURL=PointCloudSegmentListener.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PointCloudSegmentListener.js","sources":["../../../src/components/pointCloudView/PointCloudSegmentListener.tsx"],"sourcesContent":["import React, { useContext, useEffect } from 'react';\nimport { a2MapStateToProps, IA2MapStateProps } from '@/store/annotation/map';\nimport { connect } from 'react-redux';\nimport { LabelBeeContext } from '@/store/ctx';\nimport { useCustomToolInstance } from '@/hooks/annotation';\nimport { jsonParser } from '@/utils';\nimport { PointCloudContext } from './PointCloudContext';\nimport { CommonToolUtils, PointCloud } from '@labelbee/lb-annotation';\nimport { EPointCloudSegmentMode } from '@labelbee/lb-utils';\nimport { useAttribute } from './hooks/useAttribute';\n\ninterface IProps extends IA2MapStateProps {\n checkMode?: boolean;\n}\n\nconst PointCloudSegmentListener: React.FC<IProps> = ({ checkMode, currentData }) => {\n const basicInfo = jsonParser(currentData.result);\n const { toolInstanceRef } = useCustomToolInstance({ basicInfo });\n const { updateSegmentAttribute } = useAttribute();\n\n const ptCtx = useContext(PointCloudContext);\n const { ptSegmentInstance } = ptCtx;\n\n // Template just for Test\n useEffect(() => {\n if (ptSegmentInstance && currentData.url) {\n \n ptSegmentInstance.loadPCDFile(currentData?.url ?? '');\n }\n }, [currentData, ptSegmentInstance]);\n\n const segmentKeydownEvents = (lowerCaseKey: string, e: KeyboardEvent) => {\n switch (lowerCaseKey) {\n case 'h':\n ptSegmentInstance?.emit('LassoSelector');\n break;\n\n case 'j':\n ptSegmentInstance?.emit('CircleSelector');\n break;\n\n case 'u':\n ptSegmentInstance?.emit('setSegmentMode', EPointCloudSegmentMode.Add);\n break;\n\n case 'i':\n ptSegmentInstance?.emit('setSegmentMode', EPointCloudSegmentMode.Remove);\n break;\n }\n };\n\n const onKeyDown = (e: KeyboardEvent) => {\n if (!CommonToolUtils.hotkeyFilter(e) || checkMode === true) {\n return;\n }\n const lowerCaseKey = e.key.toLocaleLowerCase();\n\n segmentKeydownEvents(lowerCaseKey, e);\n };\n\n useEffect(() => {\n window.addEventListener('keydown', onKeyDown);\n\n toolInstanceRef.current.setDefaultAttribute = (newAttribute: string) => {\n updateSegmentAttribute(newAttribute);\n };\n\n return () => {\n window.removeEventListener('keydown', onKeyDown);\n };\n }, [ptSegmentInstance]);\n\n useEffect(() => {\n toolInstanceRef.current.exportData = () => {\n return [ptCtx.pointCloudBoxList, { valid: ptCtx.valid }];\n };\n\n toolInstanceRef.current.exportCustomData = () => {\n console.log('ptSegmentInstance?.store?.segmentData', ptSegmentInstance?.store?.formatData);\n\n return {\n resultPolygon: ptCtx.polygonList ?? [],\n resultLine: ptCtx.lineList ?? [],\n resultPoint: ptCtx.pointCloudSphereList ?? [],\n segmentation: ptSegmentInstance?.store?.formatData,\n };\n };\n }, [\n ptCtx.pointCloudBoxList,\n ptCtx.valid,\n ptCtx.polygonList,\n ptCtx.lineList,\n ptCtx.pointCloudSphereList,\n ptCtx.ptSegmentInstance,\n ]);\n\n return null;\n};\n\nexport default connect(a2MapStateToProps, null, null, { context: LabelBeeContext })(\n PointCloudSegmentListener,\n);\n"],"names":[],"mappings":";;;;;;;;;;;AAeA,MAAM,yBAA8C,GAAA,CAAC,CAAE,SAAA,EAAW,WAAkB,CAAA,KAAA;AAClF,EAAM,MAAA,SAAA,GAAY,WAAW,WAAY,CAAA,MAAA,CAAA,CAAA;AACzC,EAAM,MAAA,CAAE,eAAoB,CAAA,GAAA,qBAAA,CAAsB,CAAE,SAAA,CAAA,CAAA,CAAA;AACpD,EAAA,MAAM,CAAE,sBAA2B,CAAA,GAAA,YAAA,EAAA,CAAA;AAEnC,EAAA,MAAM,QAAQ,UAAW,CAAA,iBAAA,CAAA,CAAA;AACzB,EAAA,MAAM,CAAE,iBAAsB,CAAA,GAAA,KAAA,CAAA;AAG9B,EAAA,SAAA,CAAU,MAAM;AAxBlB,IAAA,IAAA,EAAA,CAAA;AAyBI,IAAI,IAAA,iBAAA,IAAqB,YAAY,GAAK,EAAA;AAExC,MAAkB,iBAAA,CAAA,WAAA,CAAY,CAAa,EAAA,GAAA,WAAA,IAAA,IAAA,GAAA,KAAA,CAAA,G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IAAA,GAAA,KAAA,CAAA,GAAA,iBAAA,CAAA,KAAA,KAAnB,IAA0B,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,UAAA;AAAA,OAAA,CAAA;AAAA,KAAA,CAAA;AAAA,GAG3C,EAAA;AAAA,IACD,KAAM,CAAA,iBAAA;AAAA,IACN,KAAM,CAAA,KAAA;AAAA,IACN,KAAM,CAAA,WAAA;AAAA,IACN,KAAM,CAAA,QAAA;AAAA,IACN,KAAM,CAAA,oBAAA;AAAA,IACN,KAAM,CAAA,iBAAA;AAAA,GAAA,CAAA,CAAA;AAGR,EAAO,OAAA,IAAA,CAAA;AAAA,CAAA,CAAA;AAGT,kCAAe,QAAQ,iBAAmB,EAAA,IAAA,EAAM,IAAM,EAAA,CAAE,SAAS,eAC/D,CAAA,CAAA,CAAA,yBAAA,CAAA;;;;"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import React, { useContext, useState, useEffect } from 'react';
|
|
2
|
+
import { getClassName } from '../../utils/dom.js';
|
|
3
|
+
import img from '../../assets/annotation/pointCloudTool/finish.svg.js';
|
|
4
|
+
import img$1 from '../../assets/annotation/pointCloudTool/cancel.svg.js';
|
|
5
|
+
import { PointCloudContext } from './PointCloudContext.js';
|
|
6
|
+
import { EPointCloudSegmentStatus } from '@labelbee/lb-utils';
|
|
7
|
+
|
|
8
|
+
const SegmentInfo = ({
|
|
9
|
+
infoList
|
|
10
|
+
}) => {
|
|
11
|
+
if (!infoList) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
15
|
+
className: getClassName("point-cloud-status", "info")
|
|
16
|
+
}, infoList.map((v) => /* @__PURE__ */ React.createElement("div", {
|
|
17
|
+
key: v.key
|
|
18
|
+
}, /* @__PURE__ */ React.createElement("span", null, v.key, "\uFF1A "), /* @__PURE__ */ React.createElement("span", null, v.value))));
|
|
19
|
+
};
|
|
20
|
+
const PointCloudSegmentStatus = () => {
|
|
21
|
+
var _a, _b, _c, _d, _e;
|
|
22
|
+
const {ptSegmentInstance, setDefaultAttribute} = useContext(PointCloudContext);
|
|
23
|
+
const [data, setData] = useState({
|
|
24
|
+
segmentStatus: EPointCloudSegmentStatus.Ready
|
|
25
|
+
});
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (ptSegmentInstance) {
|
|
28
|
+
const updateVisible = (newData) => {
|
|
29
|
+
setData(newData);
|
|
30
|
+
if (newData.cacheSegData) {
|
|
31
|
+
setDefaultAttribute(newData.cacheSegData.attribute);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
ptSegmentInstance == null ? void 0 : ptSegmentInstance.on("syncPointCloudStatus", updateVisible);
|
|
35
|
+
return () => {
|
|
36
|
+
ptSegmentInstance == null ? void 0 : ptSegmentInstance.unbind("syncPointCloudStatus", updateVisible);
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}, [ptSegmentInstance]);
|
|
40
|
+
const status = data.segmentStatus;
|
|
41
|
+
if (status === EPointCloudSegmentStatus.Ready) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
const isCheckStatus = status === EPointCloudSegmentStatus.Check;
|
|
45
|
+
const isEditStatus = status === EPointCloudSegmentStatus.Edit;
|
|
46
|
+
let customButton = null;
|
|
47
|
+
const pointsLength = ((_c = (_b = (_a = data.cacheSegData) == null ? void 0 : _a.points) == null ? void 0 : _b.length) != null ? _c : 0) / 3;
|
|
48
|
+
let infoList = [
|
|
49
|
+
{
|
|
50
|
+
key: "\u9009\u4E2D\u70B9\u6570",
|
|
51
|
+
value: pointsLength
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
key: "\u4E3B\u5C5E\u6027",
|
|
55
|
+
value: (_e = (_d = data.cacheSegData) == null ? void 0 : _d.attribute) != null ? _e : ""
|
|
56
|
+
}
|
|
57
|
+
];
|
|
58
|
+
if (isCheckStatus) {
|
|
59
|
+
customButton = /* @__PURE__ */ React.createElement("div", {
|
|
60
|
+
className: getClassName("point-cloud-status", "operation")
|
|
61
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
62
|
+
className: getClassName("point-cloud-status", "button"),
|
|
63
|
+
onClick: () => {
|
|
64
|
+
ptSegmentInstance == null ? void 0 : ptSegmentInstance.emit("updateCheck2Edit");
|
|
65
|
+
}
|
|
66
|
+
}, /* @__PURE__ */ React.createElement("img", {
|
|
67
|
+
className: getClassName("point-cloud-status", "icon"),
|
|
68
|
+
src: img
|
|
69
|
+
}), "\u8FDB\u5165\u7F16\u8F91"));
|
|
70
|
+
}
|
|
71
|
+
if (isEditStatus) {
|
|
72
|
+
customButton = /* @__PURE__ */ React.createElement("div", {
|
|
73
|
+
className: getClassName("point-cloud-status", "operation")
|
|
74
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
75
|
+
className: getClassName("point-cloud-status", "button"),
|
|
76
|
+
onClick: () => {
|
|
77
|
+
ptSegmentInstance == null ? void 0 : ptSegmentInstance.emit("addStash2Store");
|
|
78
|
+
}
|
|
79
|
+
}, /* @__PURE__ */ React.createElement("img", {
|
|
80
|
+
className: getClassName("point-cloud-status", "icon"),
|
|
81
|
+
src: img
|
|
82
|
+
}), "\u5B8C\u6210"), /* @__PURE__ */ React.createElement("span", {
|
|
83
|
+
className: getClassName("point-cloud-status", "button"),
|
|
84
|
+
onClick: () => {
|
|
85
|
+
ptSegmentInstance == null ? void 0 : ptSegmentInstance.emit("clearStash");
|
|
86
|
+
}
|
|
87
|
+
}, /* @__PURE__ */ React.createElement("img", {
|
|
88
|
+
className: getClassName("point-cloud-status", "icon"),
|
|
89
|
+
src: img$1
|
|
90
|
+
}), "\u53D6\u6D88"));
|
|
91
|
+
}
|
|
92
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, customButton, /* @__PURE__ */ React.createElement(SegmentInfo, {
|
|
93
|
+
infoList
|
|
94
|
+
}));
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export { PointCloudSegmentStatus as default };
|
|
98
|
+
//# sourceMappingURL=PointCloudSegmentStatus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PointCloudSegmentStatus.js","sources":["../../../src/components/pointCloudView/PointCloudSegmentStatus.tsx"],"sourcesContent":["import React, { useEffect, useState, useContext } from 'react';\nimport { getClassName } from '@/utils/dom';\nimport FinishSvg from '@/assets/annotation/pointCloudTool/finish.svg';\nimport CancelSvg from '@/assets/annotation/pointCloudTool/cancel.svg';\nimport { PointCloudContext } from './PointCloudContext';\nimport { EPointCloudSegmentStatus, IPointCloudSegmentation } from '@labelbee/lb-utils';\n\nconst SegmentInfo: React.FC<{ infoList?: Array<{ key: string; value: string | number }> }> = ({\n infoList,\n}) => {\n if (!infoList) {\n return null;\n }\n\n return (\n <div className={getClassName('point-cloud-status', 'info')}>\n {infoList.map((v) => (\n <div key={v.key}>\n <span>{v.key}: </span>\n <span>{v.value}</span>\n </div>\n ))}\n </div>\n );\n};\n\nconst PointCloudSegmentStatus = () => {\n const { ptSegmentInstance, setDefaultAttribute } = useContext(PointCloudContext);\n\n const [data, setData] = useState<{\n segmentStatus: EPointCloudSegmentStatus;\n cacheSegData?: IPointCloudSegmentation;\n }>({\n segmentStatus: EPointCloudSegmentStatus.Ready,\n });\n\n useEffect(() => {\n if (ptSegmentInstance) {\n const updateVisible = (newData: {\n segmentStatus: EPointCloudSegmentStatus;\n cacheSegData: IPointCloudSegmentation;\n }) => {\n setData(newData);\n if (newData.cacheSegData) {\n setDefaultAttribute(newData.cacheSegData.attribute);\n }\n };\n\n ptSegmentInstance?.on('syncPointCloudStatus', updateVisible);\n\n return () => {\n ptSegmentInstance?.unbind('syncPointCloudStatus', updateVisible);\n };\n }\n }, [ptSegmentInstance]);\n\n const status = data.segmentStatus;\n\n if (status === EPointCloudSegmentStatus.Ready) {\n return null;\n }\n\n const isCheckStatus = status === EPointCloudSegmentStatus.Check;\n const isEditStatus = status === EPointCloudSegmentStatus.Edit;\n\n let customButton: React.ReactNode = null;\n const pointsLength = (data.cacheSegData?.points?.length ?? 0) / 3;\n let infoList = [\n {\n key: '选中点数',\n value: pointsLength,\n },\n {\n key: '主属性',\n value: data.cacheSegData?.attribute ?? '',\n },\n ];\n if (isCheckStatus) {\n customButton = (\n <div className={getClassName('point-cloud-status', 'operation')}>\n <span\n className={getClassName('point-cloud-status', 'button')}\n onClick={() => {\n ptSegmentInstance?.emit('updateCheck2Edit');\n }}\n >\n <img className={getClassName('point-cloud-status', 'icon')} src={FinishSvg} />\n 进入编辑\n </span>\n </div>\n );\n }\n\n if (isEditStatus) {\n customButton = (\n <div className={getClassName('point-cloud-status', 'operation')}>\n <span\n className={getClassName('point-cloud-status', 'button')}\n onClick={() => {\n ptSegmentInstance?.emit('addStash2Store');\n }}\n >\n <img className={getClassName('point-cloud-status', 'icon')} src={FinishSvg} />\n 完成\n </span>\n <span\n className={getClassName('point-cloud-status', 'button')}\n onClick={() => {\n ptSegmentInstance?.emit('clearStash');\n }}\n >\n <img className={getClassName('point-cloud-status', 'icon')} src={CancelSvg} />\n 取消\n </span>\n </div>\n );\n }\n\n return (\n <>\n {customButton}\n <SegmentInfo infoList={infoList} />\n </>\n );\n};\nexport default PointCloudSegmentStatus;\n"],"names":["FinishSvg","CancelSvg"],"mappings":";;;;;;;AAOA,MAAM,cAAuF,CAAC;AAAA,EAC5F,QAAA;AAAA,CACI,KAAA;AACJ,EAAA,IAAI,CAAC,QAAU,EAAA;AACb,IAAO,OAAA,IAAA,CAAA;AAAA,GAAA;AAGT,EAAA,2CACG,KAAD,EAAA;AAAA,IAAK,SAAA,EAAW,aAAa,oBAAsB,EAAA,MAAA,CAAA;AAAA,GAAA,EAChD,QAAS,CAAA,GAAA,CAAI,CAAC,CAAA,yCACZ,KAAD,EAAA;AAAA,IAAK,KAAK,CAAE,CAAA,GAAA;AAAA,GACV,kBAAA,KAAA,CAAA,aAAA,CAAC,QAAD,IAAO,EAAA,CAAA,CAAE,KAAI,SACb,CAAA,kBAAA,KAAA,CAAA,a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,YAAA,uCACG,KAAD,EAAA;AAAA,MAAK,SAAA,EAAW,aAAa,oBAAsB,EAAA,WAAA,CAAA;AAAA,KAAA,sCAChD,MAAD,EAAA;AAAA,MACE,SAAA,EAAW,aAAa,oBAAsB,EAAA,QAAA,CAAA;AAAA,MAC9C,SAAS,MAAM;AACb,QAAA,iBAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,iBAAA,CAAmB,IAAK,CAAA,gBAAA,CAAA,CAAA;AAAA,OAAA;AAAA,KAAA,sCAGzB,KAAD,EAAA;AAAA,MAAK,SAAA,EAAW,aAAa,oBAAsB,EAAA,MAAA,CAAA;AAAA,MAAS,GAAK,EAAAA,GAAA;AAAA,KAAa,CAAA,EAAA,cAAA,CAAA,sCAG/E,MAAD,EAAA;AAAA,MACE,SAAA,EAAW,aAAa,oBAAsB,EAAA,QAAA,CAAA;AAAA,MAC9C,SAAS,MAAM;AACb,QAAA,iBAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,iBAAA,CAAmB,IAAK,CAAA,YAAA,CAAA,CAAA;AAAA,OAAA;AAAA,KAAA,sCAGzB,KAAD,EAAA;AAAA,MAAK,SAAA,EAAW,aAAa,oBAAsB,EAAA,MAAA,CAAA;AAAA,MAAS,GAAK,EAAAC,KAAA;AAAA,KAAa,CAAA,EAAA,cAAA,CAAA,CAAA,CAAA;AAAA,GAAA;AAOtF,EACE,uBAAA,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,EACG,YACD,kBAAA,KAAA,CAAA,aAAA,CAAC,WAAD,EAAA;AAAA,IAAa,QAAA;AAAA,GAAA,CAAA,CAAA,CAAA;AAAA;;;;"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { getClassName } from '../../utils/dom.js';
|
|
2
|
+
import { Switch, message } from 'antd';
|
|
3
|
+
import img from '../../assets/annotation/pointCloudTool/coverMode.svg.js';
|
|
4
|
+
import img$1 from '../../assets/annotation/pointCloudTool/unCoverMode.svg.js';
|
|
5
|
+
import React, { useContext, useState, useEffect } from 'react';
|
|
6
|
+
import { PointCloudContext } from './PointCloudContext.js';
|
|
7
|
+
import { EPointCloudSegmentMode, EPointCloudSegmentCoverMode } from '@labelbee/lb-utils';
|
|
8
|
+
import { useTranslation } from 'react-i18next';
|
|
9
|
+
|
|
10
|
+
const PointCloudSegmentToolbar = () => {
|
|
11
|
+
var _a, _b;
|
|
12
|
+
const {t} = useTranslation();
|
|
13
|
+
const {ptSegmentInstance} = useContext(PointCloudContext);
|
|
14
|
+
const [mode, setMode] = useState((_a = ptSegmentInstance == null ? void 0 : ptSegmentInstance.store.segmentMode) != null ? _a : EPointCloudSegmentMode.Add);
|
|
15
|
+
const [coverMode, setCoverMode] = useState((_b = ptSegmentInstance == null ? void 0 : ptSegmentInstance.store.segmentCoverMode) != null ? _b : EPointCloudSegmentCoverMode.Cover);
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
if (!ptSegmentInstance) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const updateSegmentMode = (mode2) => {
|
|
21
|
+
setMode(mode2);
|
|
22
|
+
};
|
|
23
|
+
const updateCoverMode = (coverMode2) => {
|
|
24
|
+
setCoverMode(coverMode2);
|
|
25
|
+
};
|
|
26
|
+
ptSegmentInstance.on("setSegmentMode", updateSegmentMode);
|
|
27
|
+
ptSegmentInstance.on("setSegmentCoverMode", updateCoverMode);
|
|
28
|
+
return () => {
|
|
29
|
+
ptSegmentInstance.unbind("setSegmentMode", updateSegmentMode);
|
|
30
|
+
ptSegmentInstance.unbind("setSegmentCoverMode", updateCoverMode);
|
|
31
|
+
};
|
|
32
|
+
}, [ptSegmentInstance]);
|
|
33
|
+
const checked = mode === EPointCloudSegmentMode.Add;
|
|
34
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
35
|
+
className: getClassName("point-cloud-toolbar")
|
|
36
|
+
}, /* @__PURE__ */ React.createElement(Switch, {
|
|
37
|
+
checkedChildren: "+",
|
|
38
|
+
unCheckedChildren: "-",
|
|
39
|
+
checked,
|
|
40
|
+
onChange: (checked2) => {
|
|
41
|
+
ptSegmentInstance == null ? void 0 : ptSegmentInstance.emit("setSegmentMode", checked2 ? EPointCloudSegmentMode.Add : EPointCloudSegmentMode.Remove);
|
|
42
|
+
}
|
|
43
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
44
|
+
style: {marginLeft: 16},
|
|
45
|
+
onClick: () => {
|
|
46
|
+
ptSegmentInstance == null ? void 0 : ptSegmentInstance.emit("setSegmentCoverMode", coverMode === EPointCloudSegmentCoverMode.Cover ? EPointCloudSegmentCoverMode.Uncover : EPointCloudSegmentCoverMode.Cover);
|
|
47
|
+
message.info({
|
|
48
|
+
content: t(coverMode === EPointCloudSegmentCoverMode.Cover ? "PointCloudUncoverMode" : "PointCloudCoverMode"),
|
|
49
|
+
icon: () => null
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}, /* @__PURE__ */ React.createElement("img", {
|
|
53
|
+
src: coverMode === EPointCloudSegmentCoverMode.Cover ? img : img$1,
|
|
54
|
+
style: {cursor: "pointer"}
|
|
55
|
+
})));
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export { PointCloudSegmentToolbar as default };
|
|
59
|
+
//# sourceMappingURL=PointCloudSegmentToolbar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PointCloudSegmentToolbar.js","sources":["../../../src/components/pointCloudView/PointCloudSegmentToolbar.tsx"],"sourcesContent":["import { getClassName } from '@/utils/dom';\nimport { message, Switch } from 'antd';\n// import AddSvg from '@/assets/annotation/pointCloudTool/addSvg.svg';\n// import ClearSvg from '@/assets/annotation/pointCloudTool/clearSvg.svg';\nimport CoverMode from '@/assets/annotation/pointCloudTool/coverMode.svg';\nimport UnCoverMode from '@/assets/annotation/pointCloudTool/unCoverMode.svg';\nimport React, { useContext, useEffect, useState } from 'react';\nimport { PointCloudContext } from './PointCloudContext';\nimport { EPointCloudSegmentCoverMode, EPointCloudSegmentMode } from '@labelbee/lb-utils';\nimport { useTranslation } from 'react-i18next';\n\nconst PointCloudSegmentToolbar = () => {\n const { t } = useTranslation();\n const { ptSegmentInstance } = useContext(PointCloudContext);\n const [mode, setMode] = useState(\n ptSegmentInstance?.store.segmentMode ?? EPointCloudSegmentMode.Add,\n );\n\n const [coverMode, setCoverMode] = useState(\n ptSegmentInstance?.store.segmentCoverMode ?? EPointCloudSegmentCoverMode.Cover,\n );\n\n useEffect(() => {\n if (!ptSegmentInstance) {\n return;\n }\n\n const updateSegmentMode = (mode: EPointCloudSegmentMode) => {\n setMode(mode);\n };\n const updateCoverMode = (coverMode: EPointCloudSegmentCoverMode) => {\n setCoverMode(coverMode);\n };\n\n ptSegmentInstance.on('setSegmentMode', updateSegmentMode);\n ptSegmentInstance.on('setSegmentCoverMode', updateCoverMode);\n return () => {\n ptSegmentInstance.unbind('setSegmentMode', updateSegmentMode);\n ptSegmentInstance.unbind('setSegmentCoverMode', updateCoverMode);\n };\n }, [ptSegmentInstance]);\n\n const checked = mode === EPointCloudSegmentMode.Add;\n return (\n <div className={getClassName('point-cloud-toolbar')}>\n {/* <Switch checkedChildren={<img src={AddSvg} />} unCheckedChildren={<img src={ClearSvg} />} /> */}\n <Switch\n checkedChildren='+'\n unCheckedChildren='-'\n checked={checked}\n onChange={(checked) => {\n ptSegmentInstance?.emit(\n 'setSegmentMode',\n checked ? EPointCloudSegmentMode.Add : EPointCloudSegmentMode.Remove,\n );\n }}\n />\n <div\n style={{ marginLeft: 16 }}\n onClick={() => {\n ptSegmentInstance?.emit(\n 'setSegmentCoverMode',\n coverMode === EPointCloudSegmentCoverMode.Cover\n ? EPointCloudSegmentCoverMode.Uncover\n : EPointCloudSegmentCoverMode.Cover,\n );\n message.info({\n content: t(\n coverMode === EPointCloudSegmentCoverMode.Cover\n ? 'PointCloudUncoverMode'\n : 'PointCloudCoverMode',\n ),\n icon: () => null,\n });\n }}\n >\n <img\n src={coverMode === EPointCloudSegmentCoverMode.Cover ? CoverMode : UnCoverMode}\n style={{ cursor: 'pointer' }}\n />\n </div>\n </div>\n );\n};\n\nexport default PointCloudSegmentToolbar;\n"],"names":["CoverMode","UnCoverMode"],"mappings":";;;;;;;;;AAWA,MAAM,2BAA2B,MAAM;AAXvC,EAAA,IAAA,EAAA,EAAA,EAAA,CAAA;AAYE,EAAA,MAAM,CAAE,CAAM,CAAA,GAAA,cAAA,EAAA,CAAA;AACd,EAAM,MAAA,CAAE,qBAAsB,UAAW,CAAA,iBAAA,CAAA,CAAA;AACzC,EAAM,MAAA,CAAC,MAAM,OAAW,CAAA,GAAA,QAAA,CACtB,6DAAmB,KAAM,CAAA,WAAA,KAAzB,YAAwC,sBAAuB,CAAA,GAAA,CAAA,CAAA;AAGjE,EAAM,MAAA,CAAC,WAAW,YAAgB,CAAA,GAAA,QAAA,CAChC,6DAAmB,KAAM,CAAA,gBAAA,KAAzB,YAA6C,2BAA4B,CAAA,KAAA,CAAA,CAAA;AAG3E,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,CAAC,iBAAmB,EAAA;AACtB,MAAA,OAAA;AAAA,KAAA;AAGF,IAAM,MAAA,iBAAA,GAAoB,CAAC,KAAiC,KAAA;AAC1D,MAAQ,OAAA,CAAA,KAAA,CAAA,CAAA;AAAA,KAAA,CAAA;AAEV,IAAM,MAAA,eAAA,GAAkB,CAAC,UAA2C,KAAA;AAClE,MAAa,YAAA,CAAA,UAAA,CAAA,CAAA;AAAA,KAAA,CAAA;AAGf,IAAA,iBAAA,CAAkB,GAAG,gBAAkB,EAAA,iBAAA,CAAA,CAAA;AACvC,IAAA,iBAAA,CAAkB,GAAG,qBAAuB,EAAA,eAAA,CAAA,CAAA;AAC5C,IAAA,OAAO,MAAM;AACX,MAAA,iBAAA,CAAkB,OAAO,gBAAkB,EAAA,iBAAA,CAAA,CAAA;AAC3C,MAAA,iBAAA,CAAkB,OAAO,qBAAuB,EAAA,eAAA,CAAA,CAAA;AAAA,K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-0,0 +1,70 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { PointCloudContext } from '../PointCloudContext.js';
|
|
3
|
+
import { useHistory } from './useHistory.js';
|
|
4
|
+
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __defProps = Object.defineProperties;
|
|
7
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
8
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {enumerable: true, configurable: true, writable: true, value}) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
+
const useLine = () => {
|
|
25
|
+
const {lineList, setLineList, selectedID} = useContext(PointCloudContext);
|
|
26
|
+
const {addHistory, pushHistoryWithList} = useHistory();
|
|
27
|
+
const selectedLine = lineList.find((v) => v.id === selectedID);
|
|
28
|
+
const addLine = (line) => {
|
|
29
|
+
setLineList(lineList.concat(line));
|
|
30
|
+
addHistory({newLine: line});
|
|
31
|
+
};
|
|
32
|
+
const deleteLine = (id) => {
|
|
33
|
+
const newLineList = lineList.filter((v) => v.id !== id).map((v) => __spreadValues({}, v));
|
|
34
|
+
setLineList(newLineList);
|
|
35
|
+
pushHistoryWithList({lineList: newLineList});
|
|
36
|
+
};
|
|
37
|
+
const updateSelectedLine = (line) => {
|
|
38
|
+
if (selectedLine) {
|
|
39
|
+
setLineList(lineList.map((v) => {
|
|
40
|
+
if (v.id === selectedID) {
|
|
41
|
+
return line;
|
|
42
|
+
}
|
|
43
|
+
return v;
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const updateLineValidByID = (id) => {
|
|
48
|
+
const line = lineList.find((v) => v.id === id);
|
|
49
|
+
if (line) {
|
|
50
|
+
setLineList(lineList.map((v) => {
|
|
51
|
+
if (v.id === id) {
|
|
52
|
+
return __spreadProps(__spreadValues({}, v), {
|
|
53
|
+
valid: !v.valid
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
return v;
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
return {
|
|
61
|
+
addLine,
|
|
62
|
+
deleteLine,
|
|
63
|
+
selectedLine,
|
|
64
|
+
updateSelectedLine,
|
|
65
|
+
updateLineValidByID
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export { useLine };
|
|
70
|
+
//# sourceMappingURL=useLine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLine.js","sources":["../../../../src/components/pointCloudView/hooks/useLine.ts"],"sourcesContent":["import { useContext } from 'react';\nimport { ILine } from '@labelbee/lb-utils';\nimport { PointCloudContext } from '../PointCloudContext';\nimport { useHistory } from './useHistory';\n\n/**\n * PointCloud line Hook\n * @returns\n */\nexport const useLine = () => {\n const { lineList, setLineList, selectedID } = useContext(PointCloudContext);\n const { addHistory, pushHistoryWithList } = useHistory();\n\n const selectedLine = lineList.find((v) => v.id === selectedID);\n\n const addLine = (line: ILine) => {\n setLineList(lineList.concat(line));\n addHistory({ newLine: line });\n };\n\n const deleteLine = (id: string) => {\n const newLineList = lineList.filter((v) => v.id !== id).map((v) => ({ ...v }));\n setLineList(newLineList);\n pushHistoryWithList({ lineList: newLineList });\n };\n\n const updateSelectedLine = (line: ILine) => {\n if (selectedLine) {\n setLineList(\n lineList.map((v) => {\n if (v.id === selectedID) {\n return line;\n }\n return v;\n }),\n );\n }\n };\n\n const updateLineValidByID = (id: string) => {\n const line = lineList.find((v) => v.id === id);\n if (line) {\n setLineList(\n lineList.map((v) => {\n if (v.id === id) {\n return {\n ...v,\n valid: !v.valid,\n };\n }\n return v;\n }),\n );\n }\n };\n\n return {\n addLine,\n deleteLine,\n selectedLine,\n updateSelectedLine,\n updateLineValidByID,\n };\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AASO,MAAM,UAAU,MAAM;AAC3B,EAAA,MAAM,CAAE,QAAA,EAAU,WAAa,EAAA,UAAA,CAAA,GAAe,UAAW,CAAA,iBAAA,CAAA,CAAA;AACzD,EAAM,MAAA,CAAE,YAAY,mBAAwB,CAAA,GAAA,UAAA,EAAA,CAAA;AAE5C,EAAA,MAAM,eAAe,QAAS,CAAA,IAAA,CAAK,CAAC,CAAA,KAAM,EAAE,EAAO,KAAA,UAAA,CAAA,CAAA;AAEnD,EAAM,MAAA,OAAA,GAAU,CAAC,IAAgB,KAAA;AAC/B,IAAA,WAAA,CAAY,SAAS,MAAO,CAAA,IAAA,CAAA,CAAA,CAAA;AAC5B,IAAA,UAAA,CAAW,CAAE,OAAS,EAAA,IAAA,CAAA,CAAA,CAAA;AAAA,GAAA,CAAA;AAGxB,EAAM,MAAA,UAAA,GAAa,CAAC,EAAe,KAAA;AACjC,IAAM,MAAA,WAAA,GAAc,QAAS,CAAA,MAAA,CAAO,CAAC,CAAA,KAAM,CAAE,CAAA,EAAA,KAAO,EAAI,CAAA,CAAA,GAAA,CAAI,CAAC,CAAA,KAAO,cAAK,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA;AACzE,IAAY,WAAA,CAAA,WAAA,CAAA,CAAA;AACZ,IAAA,mBAAA,CAAoB,CAAE,QAAU,EAAA,WAAA,CAAA,CAAA,CAAA;AAAA,GAAA,CAAA;AAGlC,EAAM,MAAA,kBAAA,GAAqB,CAAC,IAAgB,KAAA;AAC1C,IAAA,IAAI,YAAc,EAAA;AAChB,MACE,WAAA,CAAA,QAAA,CAAS,GAAI,CAAA,CAAC,CAAM,KAAA;AAClB,QAAI,IAAA,CAAA,CAAE,OAAO,UAAY,EAAA;AACvB,UAAO,OAAA,IAAA,CAAA;AAAA,SAAA;AAET,QAAO,OAAA,CAAA,CAAA;AAAA,OAAA,CAAA,CAAA,CAAA;AAAA,KAAA;AAAA,GAAA,CAAA;AAMf,EAAM,MAAA,mBAAA,GAAsB,CAAC,EAAe,KAAA;AAC1C,IAAA,MAAM,OAAO,QAAS,CAAA,IAAA,CAAK,CAAC,CAAA,KAAM,EAAE,EAAO,KAAA,EAAA,CAAA,CAAA;AAC3C,IAAA,IAAI,IAAM,EAAA;AACR,MACE,WAAA,CAAA,QAAA,CAAS,GAAI,CAAA,CAAC,CAAM,KAAA;AAClB,QAAI,IAAA,CAAA,CAAE,OAAO,EAAI,EAAA;AACf,UAAA,OAAO,iCACF,CADE,CAAA,EAAA;AAAA,YAEL,KAAA,EAAO,CAAC,CAAE,CAAA,KAAA;AAAA,WAAA,CAAA,CAAA;AAAA,SAAA;AAGd,QAAO,OAAA,CAAA,CAAA;AAAA,OAAA,CAAA,CAAA,CAAA;AAAA,KAAA;AAAA,GAAA,CAAA;AAMf,EAAO,OAAA;AAAA,IACL,OAAA;AAAA,IACA,UAAA;AAAA,IACA,YAAA;AAAA,IACA,kBAAA;AAAA,IACA,mBAAA;AAAA,GAAA,CAAA;AAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useContext as p
|
|
1
|
+
import{useContext as p}from"react";import{synchronizeSideView as C,synchronizeBackView as P}from"./usePointCloudViews.js";import{useSingleBox as w}from"./useSingleBox.js";import{PointCloudContext as x}from"../PointCloudContext.js";import{cAnnotation as f}from"@labelbee/lb-annotation";import{PointCloudUtils as b}from"@labelbee/lb-utils";import{useThrottleFn as V}from"ahooks";const{ERotateDirection:g}=f,y=({currentData:t})=>{const e=p(x),{selectedBox:i,updateSelectedBox:u}=w(),{run:a}=V(l=>{const{topViewInstance:s,mainViewInstance:n,syncAllViewPointCloudColor:d}=e;if(!s||!n)return;const{pointCloud2dOperation:r}=s,o=i==null?void 0:i.info;if(!o||!(t==null?void 0:t.url)||!e.backViewInstance)return;const m=u({rotation:b.restrictAngleRange(o.rotation+Number(Math.PI*l)/180)});r.rotatePolygon(l,g.Anticlockwise);const c=r.selectedPolygon;n.generateBox(o),d(m),C(o,c,e.sideViewInstance,t.url),P(o,c,e.backViewInstance,t.url),n.render()},{wait:800});return{updateRotate:a}};export{y as useRotate};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRotate.js","sources":["../../../../src/components/pointCloudView/hooks/useRotate.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"useRotate.js","sources":["../../../../src/components/pointCloudView/hooks/useRotate.ts"],"sourcesContent":["import { useContext } from 'react';\nimport { IAnnotationStateProps } from '@/store/annotation/map';\nimport { synchronizeBackView, synchronizeSideView } from './usePointCloudViews';\nimport { useSingleBox } from './useSingleBox';\nimport { PointCloudContext } from '../PointCloudContext';\nimport { cAnnotation } from '@labelbee/lb-annotation';\nimport { PointCloudUtils } from '@labelbee/lb-utils';\nimport { useThrottleFn } from 'ahooks';\n\nconst { ERotateDirection } = cAnnotation;\n\n/**\n * PointCloud Rotate Hook\n * @returns\n */\nexport const useRotate = ({ currentData }: IAnnotationStateProps) => {\n const ptCtx = useContext(PointCloudContext);\n const { selectedBox, updateSelectedBox } = useSingleBox();\n const { run: updateRotate } = useThrottleFn(\n (angle: number) => {\n const { topViewInstance, mainViewInstance, syncAllViewPointCloudColor } = ptCtx;\n if (!topViewInstance || !mainViewInstance) {\n return;\n }\n\n const { pointCloud2dOperation: TopPointCloudPolygonOperation } = topViewInstance;\n\n const selectedPointCloudBox = selectedBox?.info;\n\n if (!selectedPointCloudBox || !currentData?.url || !ptCtx.backViewInstance) {\n return;\n }\n\n const newPointCloudList = updateSelectedBox({\n rotation: PointCloudUtils.restrictAngleRange(\n selectedPointCloudBox.rotation + Number(Math.PI * angle) / 180,\n ),\n });\n\n TopPointCloudPolygonOperation.rotatePolygon(angle, ERotateDirection.Anticlockwise);\n const selectedPolygon = TopPointCloudPolygonOperation.selectedPolygon;\n\n mainViewInstance.generateBox(selectedPointCloudBox);\n syncAllViewPointCloudColor(newPointCloudList);\n synchronizeSideView(\n selectedPointCloudBox,\n selectedPolygon,\n ptCtx.sideViewInstance,\n currentData.url,\n );\n synchronizeBackView(\n selectedPointCloudBox,\n selectedPolygon,\n ptCtx.backViewInstance,\n currentData.url,\n );\n mainViewInstance.render();\n },\n {\n wait: 800,\n }\n );\n\n return { \n updateRotate,\n };\n};\n"],"names":[],"mappings":";;;;;;;;AASA,MAAM,CAAE,gBAAqB,CAAA,GAAA,WAAA,CAAA;AAMhB,MAAA,SAAA,GAAY,CAAC,CAAE,WAAyC,CAAA,KAAA;AACnE,EAAA,MAAM,QAAQ,UAAW,CAAA,iBAAA,CAAA,CAAA;AACzB,EAAM,MAAA,CAAE,aAAa,iBAAsB,CAAA,GAAA,YAAA,EAAA,CAAA;AAC3C,EAAA,MAAM,CAAE,GAAA,EAAK,YAAiB,CAAA,GAAA,aAAA,CAC5B,CAAC,KAAkB,KAAA;AACjB,IAAM,MAAA,CAAE,eAAiB,EAAA,gBAAA,EAAkB,0BAA+B,CAAA,GAAA,KAAA,CAAA;AAC1E,IAAI,IAAA,CAAC,eAAmB,IAAA,CAAC,gBAAkB,EAAA;AACzC,MAAA,OAAA;AAAA,KAAA;AAGF,IAAM,MAAA,CAAE,uBAAuB,6BAAkC,CAAA,GAAA,eAAA,CAAA;AAEjE,IAAA,MAAM,wBAAwB,WAAa,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,WAAA,CAAA,IAAA,CAAA;AAE3C,IAAA,IAAI,CAAC,qBAAyB,IAAA,6CAAc,GAAO,CAAA,IAAA,CAAC,MAAM,gBAAkB,EAAA;AAC1E,MAAA,OAAA;AAAA,KAAA;AAGF,IAAA,MAAM,oBAAoB,iBAAkB,CAAA;AAAA,MAC1C,QAAA,EAAU,gBAAgB,kBACxB,CAAA,qBAAA,CAAsB,WAAW,MAAO,CAAA,IAAA,CAAK,KAAK,KAAS,CAAA,GAAA,GAAA,CAAA;AAAA,KAAA,CAAA,CAAA;AAI/D,IAA8B,6BAAA,CAAA,aAAA,CAAc,OAAO,gBAAiB,CAAA,aAAA,CAAA,CAAA;AACpE,IAAA,MAAM,kBAAkB,6BAA8B,CAAA,eAAA,CAAA;AAEtD,IAAA,gBAAA,CAAiB,WAAY,CAAA,qBAAA,CAAA,CAAA;AAC7B,IAA2B,0BAAA,CAAA,iBAAA,CAAA,CAAA;AAC3B,IAAA,mBAAA,CACE,qBACA,EAAA,eAAA,EACA,KAAM,CAAA,gBAAA,EACN,WAAY,CAAA,GAAA,CAAA,CAAA;AAEd,IAAA,mBAAA,CACE,qBACA,EAAA,eAAA,EACA,KAAM,CAAA,gBAAA,EACN,WAAY,CAAA,GAAA,CAAA,CAAA;AAEd,IAAiB,gBAAA,CAAA,MAAA,EAAA,CAAA;AAAA,GAEnB,EAAA;AAAA,IACE,IAAM,EAAA,GAAA;AAAA,GAAA,CAAA,CAAA;AAIV,EAAO,OAAA;AAAA,IACL,YAAA;AAAA,GAAA,CAAA;AAAA;;;;"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { useContext, useMemo, useCallback } from 'react';
|
|
2
|
+
import { PointCloudContext } from '../PointCloudContext.js';
|
|
3
|
+
import _ from 'lodash';
|
|
4
|
+
|
|
5
|
+
const useSphere = () => {
|
|
6
|
+
const {
|
|
7
|
+
pointCloudSphereList,
|
|
8
|
+
setPointCloudSphereList,
|
|
9
|
+
selectedID,
|
|
10
|
+
mainViewInstance
|
|
11
|
+
} = useContext(PointCloudContext);
|
|
12
|
+
const selectedSphere = useMemo(() => {
|
|
13
|
+
return pointCloudSphereList.find((v) => v.id === selectedID);
|
|
14
|
+
}, [selectedID, pointCloudSphereList]);
|
|
15
|
+
const getPointCloudSphereByID = useCallback((id) => {
|
|
16
|
+
return pointCloudSphereList.find((i) => i.id === id);
|
|
17
|
+
}, [pointCloudSphereList]);
|
|
18
|
+
const updatePointCloudSphere = useCallback((sphereParams) => {
|
|
19
|
+
const sphereIndex = pointCloudSphereList.findIndex((v) => v.id === sphereParams.id);
|
|
20
|
+
if (sphereIndex > -1) {
|
|
21
|
+
pointCloudSphereList.splice(sphereIndex, 1, _.merge(pointCloudSphereList[sphereIndex], sphereParams));
|
|
22
|
+
const newPointCloudSphereList = _.cloneDeep(pointCloudSphereList);
|
|
23
|
+
setPointCloudSphereList(newPointCloudSphereList);
|
|
24
|
+
return newPointCloudSphereList;
|
|
25
|
+
}
|
|
26
|
+
return pointCloudSphereList;
|
|
27
|
+
}, [pointCloudSphereList]);
|
|
28
|
+
const deletePointCloudSphere = useCallback((id) => {
|
|
29
|
+
const newPointCloudSphereList = pointCloudSphereList.filter((v) => v.id !== id);
|
|
30
|
+
setPointCloudSphereList(newPointCloudSphereList);
|
|
31
|
+
mainViewInstance == null ? void 0 : mainViewInstance.removeObjectByName(id);
|
|
32
|
+
mainViewInstance == null ? void 0 : mainViewInstance.render();
|
|
33
|
+
}, [pointCloudSphereList]);
|
|
34
|
+
return {
|
|
35
|
+
selectedSphere,
|
|
36
|
+
getPointCloudSphereByID,
|
|
37
|
+
updatePointCloudSphere,
|
|
38
|
+
deletePointCloudSphere
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export { useSphere };
|
|
43
|
+
//# sourceMappingURL=useSphere.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSphere.js","sources":["../../../../src/components/pointCloudView/hooks/useSphere.ts"],"sourcesContent":["import { useCallback, useContext, useMemo } from 'react';\nimport { PointCloudContext } from '@/components/pointCloudView/PointCloudContext';\nimport _ from 'lodash';\n\nexport const useSphere = () => {\n const {\n pointCloudSphereList,\n setPointCloudSphereList,\n selectedID,\n mainViewInstance,\n } = useContext(PointCloudContext);\n\n const selectedSphere = useMemo(() => {\n return pointCloudSphereList.find((v) => v.id === selectedID)\n }, [selectedID, pointCloudSphereList])\n\n const getPointCloudSphereByID = useCallback(\n (id: string) => {\n return pointCloudSphereList.find((i) => i.id === id);\n },\n [pointCloudSphereList],\n );\n\n const updatePointCloudSphere = useCallback(\n (sphereParams) => {\n const sphereIndex = pointCloudSphereList.findIndex((v) => v.id === sphereParams.id)\n if (sphereIndex > -1) {\n pointCloudSphereList.splice(sphereIndex, 1, _.merge(pointCloudSphereList[sphereIndex], sphereParams));\n const newPointCloudSphereList = _.cloneDeep(pointCloudSphereList);\n setPointCloudSphereList(newPointCloudSphereList);\n return newPointCloudSphereList;\n }\n return pointCloudSphereList\n }, [pointCloudSphereList]\n )\n\n const deletePointCloudSphere = useCallback(\n (id: string) => {\n const newPointCloudSphereList = pointCloudSphereList.filter((v) => v.id !== id);\n setPointCloudSphereList(newPointCloudSphereList);\n mainViewInstance?.removeObjectByName(id);\n mainViewInstance?.render();\n }, [pointCloudSphereList]\n )\n\n return {\n selectedSphere,\n getPointCloudSphereByID,\n updatePointCloudSphere,\n deletePointCloudSphere,\n }\n}\n"],"names":[],"mappings":";;;;AAIO,MAAM,YAAY,MAAM;AAC7B,EAAM,MAAA;AAAA,IACJ,oBAAA;AAAA,IACA,uBAAA;AAAA,IACA,UAAA;AAAA,IACA,gBAAA;AAAA,GAAA,GACE,UAAW,CAAA,iBAAA,CAAA,CAAA;AAEf,EAAM,MAAA,cAAA,GAAiB,QAAQ,MAAM;AACnC,IAAA,OAAO,oBAAqB,CAAA,IAAA,CAAK,CAAC,CAAA,KAAM,EAAE,EAAO,KAAA,UAAA,CAAA,CAAA;AAAA,GAAA,EAChD,CAAC,UAAY,EAAA,oBAAA,CAAA,CAAA,CAAA;AAEhB,E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AA,CAAA,CAAA,CAAA;AAGN,EAAO,OAAA;AAAA,IACL,cAAA;AAAA,IACA,uBAAA;AAAA,IACA,sBAAA;AAAA,IACA,sBAAA;AAAA,GAAA,CAAA;AAAA;;;;"}
|
|
@@ -43,22 +43,29 @@ const PredictTrackingIcon = (props) => {
|
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
45
|
yield dispatch(ChangeSave);
|
|
46
|
-
const
|
|
46
|
+
const selectedBoxID = selectedBox == null ? void 0 : selectedBox.info.id;
|
|
47
|
+
const boxes = yield dispatch(GetBoxesByID(selectedBoxTrackID, selectedBoxID));
|
|
47
48
|
if (boxes.length < 2) {
|
|
48
|
-
message.error(t("
|
|
49
|
+
message.error(t("MarkOnlyOne"));
|
|
49
50
|
return;
|
|
50
51
|
}
|
|
51
|
-
const
|
|
52
|
-
const
|
|
52
|
+
const selectedBoxIDIndex = boxes.findIndex((item) => item.id === selectedBoxID);
|
|
53
|
+
const start = boxes[selectedBoxIDIndex - 1];
|
|
54
|
+
const end = boxes[selectedBoxIDIndex];
|
|
53
55
|
const difference = end.index - start.index;
|
|
54
56
|
if (difference < 2) {
|
|
55
|
-
message.error(t("
|
|
57
|
+
message.error(t("HaveNoNeed"));
|
|
56
58
|
return;
|
|
57
59
|
}
|
|
58
60
|
if (difference > 8) {
|
|
59
61
|
message.error(t("ThePredictedPointCloud"));
|
|
60
62
|
return;
|
|
61
63
|
}
|
|
64
|
+
message.success(t("PredictingDataFrom", {
|
|
65
|
+
startPage: start.index + 1,
|
|
66
|
+
endPage: end.index + 1,
|
|
67
|
+
selectedBoxTrackID
|
|
68
|
+
}));
|
|
62
69
|
SetPointCloudLoading(dispatch, true);
|
|
63
70
|
const result = predict(start, end);
|
|
64
71
|
SetPredictResult(dispatch, result);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/predictTracking/predictTrackingIcon/index.tsx"],"sourcesContent":["import { Button, message } from 'antd';\nimport React from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { connect } from 'react-redux';\n\nimport icon from '@/assets/predictTracking/icon.svg';\nimport { useSingleBox } from '@/components/pointCloudView/hooks/useSingleBox';\nimport { AppState } from '@/store';\nimport {\n ChangeSave,\n GetBoxesByID,\n SetPointCloudLoading,\n SetPredictResult,\n SetPredictResultVisible,\n} from '@/store/annotation/actionCreators';\nimport { LabelBeeContext, useDispatch } from '@/store/ctx';\n\nimport { predict } from '../previewResult/util';\n\nconst PredictTrackingIcon = (props: { loading: boolean }) => {\n const dispatch = useDispatch();\n const { t } = useTranslation();\n\n const { loading } = props;\n const { selectedBox } = useSingleBox();\n\n const handler = async () => {\n if (loading) {\n return;\n }\n\n const selectedBoxTrackID = selectedBox?.info.trackID;\n\n if (!selectedBoxTrackID) {\n message.error(t('BeforePredictStarting'));\n return;\n }\n\n await dispatch(ChangeSave);\n\n const boxes: any = await dispatch(GetBoxesByID(selectedBoxTrackID));\n\n if (boxes.length < 2) {\n message.error(t('
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/predictTracking/predictTrackingIcon/index.tsx"],"sourcesContent":["import { Button, message } from 'antd';\nimport React from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { connect } from 'react-redux';\n\nimport icon from '@/assets/predictTracking/icon.svg';\nimport { useSingleBox } from '@/components/pointCloudView/hooks/useSingleBox';\nimport { AppState } from '@/store';\nimport {\n ChangeSave,\n GetBoxesByID,\n SetPointCloudLoading,\n SetPredictResult,\n SetPredictResultVisible,\n} from '@/store/annotation/actionCreators';\nimport { IPointCloudBoxWithIndex } from '@/store/annotation/types';\nimport { LabelBeeContext, useDispatch } from '@/store/ctx';\n\nimport { predict } from '../previewResult/util';\n\nconst PredictTrackingIcon = (props: { loading: boolean }) => {\n const dispatch = useDispatch();\n const { t } = useTranslation();\n\n const { loading } = props;\n const { selectedBox } = useSingleBox();\n\n const handler = async () => {\n if (loading) {\n return;\n }\n\n const selectedBoxTrackID = selectedBox?.info.trackID;\n\n if (!selectedBoxTrackID) {\n message.error(t('BeforePredictStarting'));\n return;\n }\n\n await dispatch(ChangeSave);\n\n const selectedBoxID = selectedBox?.info.id;\n\n const boxes: any = await dispatch(GetBoxesByID(selectedBoxTrackID, selectedBoxID));\n\n if (boxes.length < 2) {\n message.error(t('MarkOnlyOne'));\n return;\n }\n\n const selectedBoxIDIndex = boxes.findIndex(\n (item: IPointCloudBoxWithIndex) => item.id === selectedBoxID,\n );\n\n const start = boxes[selectedBoxIDIndex - 1];\n const end = boxes[selectedBoxIDIndex];\n\n const difference = end.index - start.index;\n\n if (difference < 2) {\n message.error(t('HaveNoNeed'));\n return;\n }\n\n if (difference > 8) {\n message.error(t('ThePredictedPointCloud'));\n return;\n }\n\n message.success(\n t('PredictingDataFrom', {\n startPage: start.index + 1,\n endPage: end.index + 1,\n selectedBoxTrackID,\n }),\n );\n\n SetPointCloudLoading(dispatch, true);\n const result = predict(start, end);\n SetPredictResult(dispatch, result);\n SetPredictResultVisible(dispatch, true);\n };\n\n return (\n <Button\n type='link'\n onClick={handler}\n style={{\n display: 'flex',\n flexDirection: 'column',\n height: 'auto',\n alignItems: 'center',\n }}\n >\n <img src={icon} style={{ alignSelf: 'center' }} />\n <span style={{ color: '#797979' }}>{t('ComplementaryTracking')}</span>\n </Button>\n );\n};\n\nconst mapStateToProps = (state: AppState) => {\n return {\n loading: state.annotation.loading,\n };\n};\n\nexport default connect(mapStateToProps, null, null, { context: LabelBeeContext })(\n PredictTrackingIcon,\n);\n"],"names":["this","icon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,MAAM,mBAAA,GAAsB,CAAC,KAAgC,KAAA;AAC3D,EAAA,MAAM,QAAW,GAAA,WAAA,EAAA,CAAA;AACjB,EAAA,MAAM,CAAE,CAAM,CAAA,GAAA,cAAA,EAAA,CAAA;AAEd,EAAA,MAAM,CAAE,OAAY,CAAA,GAAA,KAAA,CAAA;AACpB,EAAA,MAAM,CAAE,WAAgB,CAAA,GAA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AiB,EAAA,IAAA,EAAM,IAAM,EAAA,CAAE,SAAS,eAC7D,CAAA,CAAA,CAAA,mBAAA,CAAA;;;;"}
|
|
@@ -77,9 +77,9 @@ const cropAndEnlarge = (canvas, width, height, scale) => {
|
|
|
77
77
|
newCtx == null ? void 0 : newCtx.drawImage(canvas, sx, sy, width, height, 0, 0, width * scale, height * scale);
|
|
78
78
|
return newCanvas.toDataURL();
|
|
79
79
|
};
|
|
80
|
-
const getBoxesByTrackID = (imageList, targetStep, selectedBoxTrackID) => {
|
|
80
|
+
const getBoxesByTrackID = (imageList, targetStep, selectedBoxTrackID, selectedBoxID) => {
|
|
81
81
|
const matchingBoxes = [];
|
|
82
|
-
imageList.
|
|
82
|
+
imageList.some((element, index) => {
|
|
83
83
|
var _a;
|
|
84
84
|
const fileResult = jsonParser(element == null ? void 0 : element.result);
|
|
85
85
|
const stepResult = (_a = fileResult == null ? void 0 : fileResult[`step_${targetStep}`]) == null ? void 0 : _a.result;
|
|
@@ -87,6 +87,7 @@ const getBoxesByTrackID = (imageList, targetStep, selectedBoxTrackID) => {
|
|
|
87
87
|
if (box) {
|
|
88
88
|
matchingBoxes.push(__spreadProps(__spreadValues({}, box), {index}));
|
|
89
89
|
}
|
|
90
|
+
return (box == null ? void 0 : box.id) === selectedBoxID;
|
|
90
91
|
});
|
|
91
92
|
return matchingBoxes;
|
|
92
93
|
};
|
|
@@ -117,7 +118,7 @@ const predict = (start, end) => {
|
|
|
117
118
|
}
|
|
118
119
|
acc[key] = map[key][i];
|
|
119
120
|
return acc;
|
|
120
|
-
}, __spreadProps(__spreadValues({},
|
|
121
|
+
}, __spreadProps(__spreadValues({}, end), {id: uuid(), center: nextCenter}));
|
|
121
122
|
result.push(nextValue);
|
|
122
123
|
}
|
|
123
124
|
return result;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sources":["../../../../src/components/predictTracking/previewResult/util.ts"],"sourcesContent":["import { IPointCloudBoxWithIndex } from '@/store/annotation/types';\nimport { IFileItem } from '@/types/data';\nimport { jsonParser } from '@/utils';\nimport { PointCloud, uuid } from '@labelbee/lb-annotation';\nimport { EPerspectiveView, IPointCloudBox } from '@labelbee/lb-utils';\n\nconst EXAMPLE_IMAGE_SIZE = {\n width: 160,\n height: 110,\n} as const;\n\n/**\n * Returns a data URL for an image of the rendered point cloud.\n * @param renderer - The PointCloud renderer to use.\n * @param zoom - The zoom level of the image. Defaults to 2.\n * @returns A Promise resolving to a string data URL of the rendered image.\n */\nconst getDataUrl = async (renderer: PointCloud['renderer'], zoom = 2) => {\n return cropAndEnlarge(\n renderer.domElement,\n EXAMPLE_IMAGE_SIZE.width,\n EXAMPLE_IMAGE_SIZE.height,\n zoom,\n );\n};\n\n/**\n * Returns a Promise that resolves after the specified duration.\n * @param ms - The duration to sleep, in milliseconds.\n * @returns A Promise that resolves after `ms` milliseconds.\n */\nexport const sleep = (time = 300) => {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve('');\n }, time);\n });\n};\n\nexport const views = [EPerspectiveView.Top, EPerspectiveView.Left, EPerspectiveView.Back] as const;\n\ninterface viewDataUrl {\n [EPerspectiveView.Top]?: string;\n [EPerspectiveView.Left]?: string;\n [EPerspectiveView.Back]?: string;\n}\n\nexport type IBox = IPointCloudBoxWithIndex & viewDataUrl;\n\n/**\n * Generates data URLs for each view of a given point cloud object using the provided box and zoom level.\n *\n * @param {PointCloud} pointCloud - The point cloud object to generate data URLs for.\n * @param {IBox} box - An object representing the bounding box to use for calculating camera position.\n * @param {number} zoom - The zoom level to use when generating data URLs.\n * @returns {Promise<void>} - A promise that resolves once all data URLs have been generated.\n */\nexport const getViewsDataUrl = async (pointCloud: PointCloud, box: IBox, zoom: number) => {\n for (const view of views) {\n await pointCloud.updateCameraByBox(box, view);\n box[view] = await getDataUrl(pointCloud.renderer, zoom);\n }\n};\n\n/**\n * Creates a new canvas, crops and enlarges an existing canvas, draws the cropped and enlarged image onto the new canvas,\n * and returns the data URL of the new canvas.\n *\n * @param {HTMLCanvasElement} canvas - The original canvas to be cropped and enlarged\n * @param {number} width - The width of the area to be cropped from the center of the original canvas\n * @param {number} height - The height of the area to be cropped from the center of the original canvas\n * @param {number} scale - The amount by which to enlarge the cropped area\n * @returns {string} - A data URL of the cropped and enlarged image\n */\nconst cropAndEnlarge = (\n canvas: HTMLCanvasElement,\n width: number,\n height: number,\n scale: number,\n): string => {\n if (!canvas) {\n return '';\n }\n const centerX = canvas.width / 2;\n const centerY = canvas.height / 2;\n // Calculate starting coordinates for cropping\n const sx = centerX - width / 2;\n const sy = centerY - height / 2;\n\n // Create a new canvas for the cropped and enlarged image\n const newCanvas = document.createElement('canvas');\n newCanvas.width = width * scale;\n newCanvas.height = height * scale;\n\n // Draw the cropped and enlarged image onto the new canvas\n const newCtx = newCanvas.getContext('2d');\n newCtx?.drawImage(canvas, sx, sy, width, height, 0, 0, width * scale, height * scale);\n\n // Convert the new canvas to a data URL and return it\n return newCanvas.toDataURL();\n};\n\n/**\n * Retrieve boxes with a specific trackID from an array of file items.\n *\n * @param {Array} imageList - An array of file items to search through.\n * @param {Number} targetStep - The step number within the result object to retrieve boxes from.\n * @param {Number} selectedBoxTrackID - The trackID to match when searching for boxes.\n * @return {Array} An array of point cloud boxes that match the provided trackID, along with their index in the original array.\n */\nexport const getBoxesByTrackID = (\n imageList: IFileItem[],\n targetStep: number,\n selectedBoxTrackID: number,\n) => {\n const matchingBoxes: IPointCloudBoxWithIndex[] = [];\n imageList.forEach((element, index) => {\n const fileResult = jsonParser(element?.result);\n const stepResult = fileResult?.[`step_${targetStep}`]?.result;\n const box = stepResult?.find((item: IPointCloudBox) => item.trackID === selectedBoxTrackID);\n if (box) {\n matchingBoxes.push({ ...box, index });\n }\n });\n\n return matchingBoxes;\n};\n\n/**\n * Calculate predicted values for each field in between the start and end points.\n * @param {IPointCloudBoxWithIndex} start - The starting point, should have the same properties as IPointCloudBoxWithIndex.\n * @param {IPointCloudBoxWithIndex} end - The ending point, should have the same properties as IPointCloudBoxWithIndex.\n * @returns {IPointCloudBox[]} An array of objects with the same properties as IPointCloudBox, containing interpolated values between the start and end points for each field.\n */\nexport const predict = (start: IPointCloudBoxWithIndex, end: IPointCloudBoxWithIndex) => {\n const diff = end.index - start.index;\n const len = diff - 1;\n const result: IPointCloudBox[] = [];\n const map: { [key: string]: number[] } = {};\n const centerKeys = ['x', 'y', 'z'] as const;\n const predictKeys = ['center', 'depth', 'height', 'index', 'rotation', 'width'] as const;\n\n centerKeys.forEach((key) => {\n map[key] = getInteriorNumbersByStartAndEnd(start.center[key], end.center[key], len);\n });\n\n predictKeys.forEach((key) => {\n if (key === 'center') {\n return;\n }\n map[key] = getInteriorNumbersByStartAndEnd(start[key], end[key], len);\n });\n\n for (let i = 0; i < len; i++) {\n const nextCenter = centerKeys.reduce(\n (acc, key) => {\n acc[key] = map[key][i];\n return acc;\n },\n { x: 0, y: 0, z: 0 },\n );\n\n const nextValue = predictKeys.reduce(\n (acc, key) => {\n if (key === 'center') {\n return acc;\n }\n acc[key] = map[key][i];\n return acc;\n },\n { ...start, id: uuid(), center: nextCenter },\n );\n\n result.push(nextValue);\n }\n\n return result;\n};\n\n/**\n * Calculate an array of numbers between the start and end values.\n * @param {number} [start=0] - The starting value. Defaults to 0 if not specified.\n * @param {number} [end=0] - The ending value. Defaults to 0 if not specified.\n * @param {number} [length=0] - The number of values to calculate between the start and end points. Defaults to 0 if not specified.\n * @returns {number[]} An array of numbers, containing interpolated values between the start and end points.\n */\nconst getInteriorNumbersByStartAndEnd = (start = 0, end = 0, length = 0): number[] => {\n const step = (end - start) / (length + 1);\n const resultArr = new Array(length);\n for (let i = 0; i < length; i++) {\n resultArr[i] = start + step * (i + 1);\n }\n return resultArr;\n};\n"],"names":["this"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAM,kBAAqB,GAAA;AAAA,EACzB,KAAO,EAAA,GAAA;AAAA,EACP,MAAQ,EAAA,GAAA;AAAA,CAAA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AAI,GAAA,CAAA,EAAG,CAAI,GAAA,MAAA,EAAQ,CAAK,EAAA,EAAA;AAC/B,IAAU,SAAA,CAAA,CAAA,CAAA,GAAK,KAAQ,GAAA,IAAA,IAAY,CAAA,GAAA,CAAA,CAAA,CAAA;AAAA,GAAA;AAErC,EAAO,OAAA,SAAA,CAAA;AAAA,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"util.js","sources":["../../../../src/components/predictTracking/previewResult/util.ts"],"sourcesContent":["import { IPointCloudBoxWithIndex } from '@/store/annotation/types';\nimport { IFileItem } from '@/types/data';\nimport { jsonParser } from '@/utils';\nimport { PointCloud, uuid } from '@labelbee/lb-annotation';\nimport { EPerspectiveView, IPointCloudBox } from '@labelbee/lb-utils';\n\nconst EXAMPLE_IMAGE_SIZE = {\n width: 160,\n height: 110,\n} as const;\n\n/**\n * Returns a data URL for an image of the rendered point cloud.\n * @param renderer - The PointCloud renderer to use.\n * @param zoom - The zoom level of the image. Defaults to 2.\n * @returns A Promise resolving to a string data URL of the rendered image.\n */\nconst getDataUrl = async (renderer: PointCloud['renderer'], zoom = 2) => {\n return cropAndEnlarge(\n renderer.domElement,\n EXAMPLE_IMAGE_SIZE.width,\n EXAMPLE_IMAGE_SIZE.height,\n zoom,\n );\n};\n\n/**\n * Returns a Promise that resolves after the specified duration.\n * @param ms - The duration to sleep, in milliseconds.\n * @returns A Promise that resolves after `ms` milliseconds.\n */\nexport const sleep = (time = 300) => {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve('');\n }, time);\n });\n};\n\nexport const views = [EPerspectiveView.Top, EPerspectiveView.Left, EPerspectiveView.Back] as const;\n\ninterface viewDataUrl {\n [EPerspectiveView.Top]?: string;\n [EPerspectiveView.Left]?: string;\n [EPerspectiveView.Back]?: string;\n}\n\nexport type IBox = IPointCloudBoxWithIndex & viewDataUrl;\n\n/**\n * Generates data URLs for each view of a given point cloud object using the provided box and zoom level.\n *\n * @param {PointCloud} pointCloud - The point cloud object to generate data URLs for.\n * @param {IBox} box - An object representing the bounding box to use for calculating camera position.\n * @param {number} zoom - The zoom level to use when generating data URLs.\n * @returns {Promise<void>} - A promise that resolves once all data URLs have been generated.\n */\nexport const getViewsDataUrl = async (pointCloud: PointCloud, box: IBox, zoom: number) => {\n for (const view of views) {\n await pointCloud.updateCameraByBox(box, view);\n box[view] = await getDataUrl(pointCloud.renderer, zoom);\n }\n};\n\n/**\n * Creates a new canvas, crops and enlarges an existing canvas, draws the cropped and enlarged image onto the new canvas,\n * and returns the data URL of the new canvas.\n *\n * @param {HTMLCanvasElement} canvas - The original canvas to be cropped and enlarged\n * @param {number} width - The width of the area to be cropped from the center of the original canvas\n * @param {number} height - The height of the area to be cropped from the center of the original canvas\n * @param {number} scale - The amount by which to enlarge the cropped area\n * @returns {string} - A data URL of the cropped and enlarged image\n */\nconst cropAndEnlarge = (\n canvas: HTMLCanvasElement,\n width: number,\n height: number,\n scale: number,\n): string => {\n if (!canvas) {\n return '';\n }\n const centerX = canvas.width / 2;\n const centerY = canvas.height / 2;\n // Calculate starting coordinates for cropping\n const sx = centerX - width / 2;\n const sy = centerY - height / 2;\n\n // Create a new canvas for the cropped and enlarged image\n const newCanvas = document.createElement('canvas');\n newCanvas.width = width * scale;\n newCanvas.height = height * scale;\n\n // Draw the cropped and enlarged image onto the new canvas\n const newCtx = newCanvas.getContext('2d');\n newCtx?.drawImage(canvas, sx, sy, width, height, 0, 0, width * scale, height * scale);\n\n // Convert the new canvas to a data URL and return it\n return newCanvas.toDataURL();\n};\n\n/**\n * Retrieve boxes with a specific trackID from an array of file items.\n *\n * @param {Array} imageList - An array of file items to search through.\n * @param {Number} targetStep - The step number within the result object to retrieve boxes from.\n * @param {Number} selectedBoxTrackID - The trackID to match when searching for boxes.\n * @param {string} selectedBoxID - The selected BoxID.\n * @return {Array} An array of point cloud boxes that match the provided trackID, along with their index in the original array.\n */\nexport const getBoxesByTrackID = (\n imageList: IFileItem[],\n targetStep: number,\n selectedBoxTrackID: number,\n selectedBoxID: string,\n) => {\n const matchingBoxes: IPointCloudBoxWithIndex[] = [];\n imageList.some((element, index) => {\n const fileResult = jsonParser(element?.result);\n const stepResult = fileResult?.[`step_${targetStep}`]?.result;\n const box = stepResult?.find((item: IPointCloudBox) => item.trackID === selectedBoxTrackID);\n if (box) {\n matchingBoxes.push({ ...box, index });\n }\n return box?.id === selectedBoxID;\n });\n\n return matchingBoxes;\n};\n\n/**\n * Calculate predicted values for each field in between the start and end points.\n * @param {IPointCloudBoxWithIndex} start - The starting point, should have the same properties as IPointCloudBoxWithIndex.\n * @param {IPointCloudBoxWithIndex} end - The ending point, should have the same properties as IPointCloudBoxWithIndex.\n * @returns {IPointCloudBox[]} An array of objects with the same properties as IPointCloudBox, containing interpolated values between the start and end points for each field.\n */\nexport const predict = (start: IPointCloudBoxWithIndex, end: IPointCloudBoxWithIndex) => {\n const diff = end.index - start.index;\n const len = diff - 1;\n const result: IPointCloudBox[] = [];\n const map: { [key: string]: number[] } = {};\n const centerKeys = ['x', 'y', 'z'] as const;\n const predictKeys = ['center', 'depth', 'height', 'index', 'rotation', 'width'] as const;\n\n centerKeys.forEach((key) => {\n map[key] = getInteriorNumbersByStartAndEnd(start.center[key], end.center[key], len);\n });\n\n predictKeys.forEach((key) => {\n if (key === 'center') {\n return;\n }\n map[key] = getInteriorNumbersByStartAndEnd(start[key], end[key], len);\n });\n\n for (let i = 0; i < len; i++) {\n const nextCenter = centerKeys.reduce(\n (acc, key) => {\n acc[key] = map[key][i];\n return acc;\n },\n { x: 0, y: 0, z: 0 },\n );\n\n const nextValue = predictKeys.reduce(\n (acc, key) => {\n if (key === 'center') {\n return acc;\n }\n acc[key] = map[key][i];\n return acc;\n },\n { ...end, id: uuid(), center: nextCenter },\n );\n\n result.push(nextValue);\n }\n\n return result;\n};\n\n/**\n * Calculate an array of numbers between the start and end values.\n * @param {number} [start=0] - The starting value. Defaults to 0 if not specified.\n * @param {number} [end=0] - The ending value. Defaults to 0 if not specified.\n * @param {number} [length=0] - The number of values to calculate between the start and end points. Defaults to 0 if not specified.\n * @returns {number[]} An array of numbers, containing interpolated values between the start and end points.\n */\nconst getInteriorNumbersByStartAndEnd = (start = 0, end = 0, length = 0): number[] => {\n const step = (end - start) / (length + 1);\n const resultArr = new Array(length);\n for (let i = 0; i < length; i++) {\n resultArr[i] = start + step * (i + 1);\n }\n return resultArr;\n};\n"],"names":["this"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAM,kBAAqB,GAAA;AAAA,EACzB,KAAO,EAAA,GAAA;AAAA,EACP,MAAQ,EAAA,GAAA;AAAA,CAAA,CAAA;AASV,MAAM,UAAa,GAAA,CAAO,QAAkC,EAAA,IAAA,GAAO,CAAM,KAAA,OAAA,CAAAA,SAAA,EAAA,IAAA,EAAA,aAAA;AACvE,EAAA,OAAO,eACL,QAAS,CAAA,UAAA,EACT,kBAAmB,CAAA,KAAA,EACnB,mBAAmB,MACnB,EAAA,IAAA,CAAA,CAAA;AAAA,CAAA,CAAA,CAAA;AASS,MAAA,KAAA,GAAQ,CAAC,IAAA,GAAO,GAAQ,KAAA;AACnC,EAAO,OAAA,IAAI,OAAQ,CAAA,CAAC,OAAY,KAAA;AAC9B,IAAA,UAAA,CAAW,MAAM;AACf,MAAQ,OAAA,CAAA,EAAA,CAAA,CAAA;AAAA,KACP,EAAA,IAAA,CAAA,CAAA;AAAA,GAAA,CAAA,CAAA;AAAA,EAAA;AAIA,MAAM,QAAQ,CAAC,gBAAA,CAAiB,GAAK,EAAA,gBAAA,CAAiB,MAAM,gBAAiB,CAAA,IAAA,EAAA;AAkB7E,MAAM,eAAkB,GAAA,CAAO,UAAwB,EAAA,GAAA,EAAW,IAAiB,KAAA,OAAA,CAAAA,SAAA,EAAA,IAAA,EAAA,aAAA;AACxF,EAAA,KAAA,MAAW,QAAQ,KAAO,EAAA;AACxB,IAAM,MAAA,UAAA,CAAW,kBAAkB,GAAK,EAAA,IAAA,CAAA,CAAA;AACxC,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U,EAAA,EAAI,QAAQ,MAAQ,EAAA,UAAA,CAAA,CAAA,CAAA,CAAA;AAGhC,IAAA,MAAA,CAAO,IAAK,CAAA,SAAA,CAAA,CAAA;AAAA,GAAA;AAGd,EAAO,OAAA,MAAA,CAAA;AAAA,EAAA;AAUT,MAAM,kCAAkC,CAAC,KAAA,GAAQ,GAAG,GAAM,GAAA,CAAA,EAAG,SAAS,CAAgB,KAAA;AACpF,EAAM,MAAA,IAAA,GAAQ,CAAM,GAAA,GAAA,KAAA,KAAmB,MAAA,GAAA,CAAA,CAAA,CAAA;AACvC,EAAM,MAAA,SAAA,GAAY,IAAI,KAAM,CAAA,MAAA,CAAA,CAAA;AAC5B,EAAA,KAAA,IAAS,CAAI,GAAA,CAAA,EAAG,CAAI,GAAA,MAAA,EAAQ,CAAK,EAAA,EAAA;AAC/B,IAAU,SAAA,CAAA,CAAA,CAAA,GAAK,KAAQ,GAAA,IAAA,IAAY,CAAA,GAAA,CAAA,CAAA,CAAA;AAAA,GAAA;AAErC,EAAO,OAAA,SAAA,CAAA;AAAA,CAAA;;;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const toRGBAObj = (rgbStr) => {
|
|
2
|
+
if (!rgbStr) {
|
|
3
|
+
return;
|
|
4
|
+
}
|
|
5
|
+
const match = rgbStr.replace(/[rgba()]/g, "").split(",");
|
|
6
|
+
if (match) {
|
|
7
|
+
const [r, g, b, a] = match;
|
|
8
|
+
return {r: Number(r), g: Number(g), b: Number(b), a: Number(a)};
|
|
9
|
+
}
|
|
10
|
+
return void 0;
|
|
11
|
+
};
|
|
12
|
+
const toRGBAStr = (color) => `rgba(${color.r},${color.g},${color.b},${color.a})`;
|
|
13
|
+
|
|
14
|
+
export { toRGBAObj, toRGBAStr };
|
|
15
|
+
//# sourceMappingURL=colorUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colorUtils.js","sources":["../../src/utils/colorUtils.ts"],"sourcesContent":["/**\n * transform rgba(a,g,b), to {r,g,b,a}\n * @param color\n */\nexport const toRGBAObj = (rgbStr: string | undefined) => {\n if (!rgbStr) {\n return;\n }\n const match = rgbStr.replace(/[rgba()]/g, '').split(',');\n if (match) {\n const [r, g, b, a] = match;\n return { r: Number(r), g: Number(g), b: Number(b), a: Number(a) };\n }\n return undefined;\n};\n\n/**\n * transform {a,g,b,a} to rgba{r,g,b,a}\n * @param color\n */\nexport const toRGBAStr = (color: { r: number; g: number; b: number; a: number }) =>\n `rgba(${color.r},${color.g},${color.b},${color.a})`;\n"],"names":[],"mappings":"AAIa,MAAA,SAAA,GAAY,CAAC,MAA+B,KAAA;AACvD,EAAA,IAAI,CAAC,MAAQ,EAAA;AACX,IAAA,OAAA;AAAA,GAAA;AAEF,EAAA,MAAM,KAAQ,GAAA,MAAA,CAAO,OAAQ,CAAA,WAAA,EAAa,IAAI,KAAM,CAAA,GAAA,CAAA,CAAA;AACpD,EAAA,IAAI,KAAO,EAAA;AACT,IAAA,MAAM,CAAC,CAAA,EAAG,CAAG,EAAA,CAAA,EAAG,CAAK,CAAA,GAAA,KAAA,CAAA;AACrB,IAAO,OAAA,CAAE,CAAG,EAAA,MAAA,CAAO,CAAI,CAAA,EAAA,CAAA,EAAG,MAAO,CAAA,CAAA,CAAA,EAAI,CAAG,EAAA,MAAA,CAAO,CAAI,CAAA,EAAA,CAAA,EAAG,MAAO,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,GAAA;AAE/D,EAAO,OAAA,KAAA,CAAA,CAAA;AAAA,EAAA;AAOI,MAAA,SAAA,GAAY,CAAC,KAAA,KACxB,CAAQ,KAAA,EAAA,KAAA,CAAM,KAAK,KAAM,CAAA,CAAA,CAAA,CAAA,EAAK,KAAM,CAAA,CAAA,CAAA,CAAA,EAAK,KAAM,CAAA,CAAA,CAAA,CAAA;;;;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { backward, forward, dargWithRightClick, scale, saveResult, restore, revoke, rotate, setValid, hidden } from '../common/index.js';
|
|
2
|
+
import { drawRect, drawInvalidRect, selectRect, deleteRect, changeValid, changeValidByClick } from '../rectToolShortCutTable/index.js';
|
|
3
|
+
|
|
4
|
+
const cuboidShortCutTable = [
|
|
5
|
+
backward,
|
|
6
|
+
forward,
|
|
7
|
+
drawRect,
|
|
8
|
+
drawInvalidRect,
|
|
9
|
+
dargWithRightClick,
|
|
10
|
+
selectRect,
|
|
11
|
+
deleteRect,
|
|
12
|
+
changeValid,
|
|
13
|
+
changeValidByClick,
|
|
14
|
+
scale,
|
|
15
|
+
saveResult,
|
|
16
|
+
restore,
|
|
17
|
+
revoke,
|
|
18
|
+
rotate,
|
|
19
|
+
setValid,
|
|
20
|
+
hidden
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
export { cuboidShortCutTable as default };
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../../src/views/MainView/toolFooter/FooterTips/ToolHotKey/cuboid/index.tsx"],"sourcesContent":["import {\n backward,\n dargWithRightClick,\n forward,\n restore,\n revoke,\n rotate,\n setValid,\n hidden,\n scale,\n saveResult,\n} from '../common';\nimport {\n changeValid,\n changeValidByClick,\n selectRect,\n deleteRect,\n drawInvalidRect,\n drawRect,\n} from '../rectToolShortCutTable';\n\nconst cuboidShortCutTable = [\n backward,\n forward,\n\n // Temporary reuse of react tool icons\n drawRect,\n drawInvalidRect,\n dargWithRightClick,\n selectRect,\n deleteRect,\n changeValid,\n changeValidByClick,\n\n scale,\n saveResult,\n restore,\n revoke,\n rotate,\n setValid,\n hidden,\n];\n\nexport default cuboidShortCutTable;\n"],"names":[],"mappings":";;;AAqBA,MAAM,mBAAsB,GAAA;AAAA,EAC1B,QAAA;AAAA,EACA,OAAA;AAAA,EAGA,QAAA;AAAA,EACA,eAAA;AAAA,EACA,kBAAA;AAAA,EACA,UAAA;AAAA,EACA,UAAA;AAAA,EACA,WAAA;AAAA,EACA,kBAAA;AAAA,EAEA,KAAA;AAAA,EACA,UAAA;AAAA,EACA,OAAA;AAAA,EACA,MAAA;AAAA,EACA,MAAA;AAAA,EACA,QAAA;AAAA,EACA,MAAA;AAAA;;;;"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import { EPointCloudName } from '@labelbee/lb-annotation';
|
|
3
|
+
import { EPointCloudPattern } from '@labelbee/lb-utils';
|
|
4
|
+
import { Button } from 'antd';
|
|
5
|
+
import { connect } from 'react-redux';
|
|
6
|
+
import { LabelBeeContext } from '../../../../store/ctx.js';
|
|
7
|
+
import { PointCloudContext } from '../../../../components/pointCloudView/PointCloudContext.js';
|
|
8
|
+
|
|
9
|
+
const SwitchPattern = ({toolName}) => {
|
|
10
|
+
const {
|
|
11
|
+
globalPattern,
|
|
12
|
+
setGlobalPattern,
|
|
13
|
+
setTopViewInstance,
|
|
14
|
+
setSideViewInstance,
|
|
15
|
+
setBackViewInstance,
|
|
16
|
+
setMainViewInstance
|
|
17
|
+
} = useContext(PointCloudContext);
|
|
18
|
+
if (toolName !== EPointCloudName.PointCloud) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
const clearDetection = () => {
|
|
22
|
+
setTopViewInstance(void 0);
|
|
23
|
+
setSideViewInstance(void 0);
|
|
24
|
+
setBackViewInstance(void 0);
|
|
25
|
+
setMainViewInstance(void 0);
|
|
26
|
+
};
|
|
27
|
+
const updateDetection = () => {
|
|
28
|
+
setGlobalPattern(EPointCloudPattern.Detection);
|
|
29
|
+
clearDetection();
|
|
30
|
+
};
|
|
31
|
+
const updateSegmentation = () => {
|
|
32
|
+
setGlobalPattern(EPointCloudPattern.Segmentation);
|
|
33
|
+
clearDetection();
|
|
34
|
+
};
|
|
35
|
+
return /* @__PURE__ */ React.createElement("span", {
|
|
36
|
+
style: {margin: "0 10px"}
|
|
37
|
+
}, /* @__PURE__ */ React.createElement(Button, {
|
|
38
|
+
type: globalPattern === EPointCloudPattern.Detection ? "primary" : void 0,
|
|
39
|
+
onClick: updateDetection
|
|
40
|
+
}, "\u68C0\u6D4B\u6A21\u5F0F"), /* @__PURE__ */ React.createElement(Button, {
|
|
41
|
+
type: globalPattern === EPointCloudPattern.Segmentation ? "primary" : void 0,
|
|
42
|
+
onClick: updateSegmentation
|
|
43
|
+
}, "\u5206\u5272\u6A21\u5F0F"));
|
|
44
|
+
};
|
|
45
|
+
const mapStateToProps = (state) => {
|
|
46
|
+
var _a, _b;
|
|
47
|
+
return {
|
|
48
|
+
toolName: (_b = (_a = state.annotation.stepList[state.annotation.step - 1]) == null ? void 0 : _a.tool) != null ? _b : ""
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
var SwitchPattern$1 = connect(mapStateToProps, null, null, {context: LabelBeeContext})(SwitchPattern);
|
|
52
|
+
|
|
53
|
+
export { SwitchPattern$1 as default };
|
|
54
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/views/MainView/toolHeader/SwitchPattern/index.tsx"],"sourcesContent":["/**\n * Switch Pattern in PointCloudTool\n *\n * 1. Direction\n * 2. Segmentation\n */\nimport React, { useContext } from 'react';\nimport { EPointCloudName } from '@labelbee/lb-annotation';\nimport { EPointCloudPattern } from '@labelbee/lb-utils';\nimport { Button } from 'antd';\nimport { AppState } from '@/store';\nimport { connect } from 'react-redux';\nimport { LabelBeeContext } from '@/store/ctx';\nimport { PointCloudContext } from '@/components/pointCloudView/PointCloudContext';\n\ninterface IProps {\n toolName: string;\n}\n\nconst SwitchPattern = ({ toolName }: IProps) => {\n const {\n globalPattern,\n setGlobalPattern,\n setTopViewInstance,\n setSideViewInstance,\n setBackViewInstance,\n setMainViewInstance,\n } = useContext(PointCloudContext);\n\n if (toolName !== EPointCloudName.PointCloud) {\n return null;\n }\n\n const clearDetection = () => {\n setTopViewInstance(undefined);\n setSideViewInstance(undefined);\n setBackViewInstance(undefined);\n setMainViewInstance(undefined);\n };\n\n const updateDetection = () => {\n setGlobalPattern(EPointCloudPattern.Detection);\n clearDetection();\n };\n const updateSegmentation = () => {\n setGlobalPattern(EPointCloudPattern.Segmentation);\n clearDetection();\n };\n\n return (\n <span style={{ margin: '0 10px' }}>\n <Button\n type={globalPattern === EPointCloudPattern.Detection ? 'primary' : undefined}\n onClick={updateDetection}\n >\n 检测模式\n </Button>\n <Button\n type={globalPattern === EPointCloudPattern.Segmentation ? 'primary' : undefined}\n onClick={updateSegmentation}\n >\n 分割模式\n </Button>\n </span>\n );\n};\n\nconst mapStateToProps = (state: AppState) => ({\n toolName: state.annotation.stepList[state.annotation.step - 1]?.tool ?? '',\n});\n\nexport default connect(mapStateToProps, null, null, { context: LabelBeeContext })(SwitchPattern);\n"],"names":[],"mappings":";;;;;;;;AAmBA,MAAM,aAAA,GAAgB,CAAC,CAAE,QAAuB,CAAA,KAAA;AAC9C,EAAM,MAAA;AAAA,IACJ,aAAA;AAAA,IACA,gBAAA;AAAA,IACA,kBAAA;AAAA,IACA,mBAAA;AAAA,IACA,mBAAA;AAAA,IACA,mBAAA;AAAA,GAAA,GACE,UAAW,CAAA,iBAAA,CAAA,CAAA;AAEf,EAAI,IAAA,QAAA,KAAa,gBAAgB,UAAY,EAAA;AAC3C,IAAO,OAAA,IAAA,CAAA;AAAA,GAAA;AAGT,EAAA,MAAM,iBAAiB,MAAM;AAC3B,IAAmB,kBAAA,CAAA,KAAA,CAAA,CAAA,CAAA;AACnB,IAAoB,mBAAA,CAAA,KAAA,CAAA,CAAA,CAAA;AACpB,IAAoB,mBAAA,CAAA,KAAA,CAAA,CAAA,CAAA;AACpB,IAAoB,mBAAA,CAAA,KAAA,CAAA,CAAA,CAAA;AAAA,GAAA,CAAA;AAGtB,EAAA,MAAM,kBAAkB,MAAM;AAC5B,IAAA,gBAAA,CAAiB,kBAAmB,CAAA,SAAA,CAAA,CAAA;AACpC,IAAA,cAAA,EAAA,CAAA;AAAA,GA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": "1.9.1",
|
|
4
4
|
"description": "Provide a complete library of annotation components",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"es": "./es/index.js",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@ant-design/icons": "^4.6.2",
|
|
44
|
-
"@labelbee/lb-annotation": "^1.13.1
|
|
45
|
-
"@labelbee/lb-utils": "^1.6.1
|
|
44
|
+
"@labelbee/lb-annotation": "^1.13.1",
|
|
45
|
+
"@labelbee/lb-utils": "^1.6.1",
|
|
46
46
|
"ahooks": "^3.4.0",
|
|
47
47
|
"classnames": "^2.3.0",
|
|
48
48
|
"lodash": "^4.17.21",
|
|
@@ -97,5 +97,5 @@
|
|
|
97
97
|
"path": "node_modules/cz-conventional-changelog"
|
|
98
98
|
}
|
|
99
99
|
},
|
|
100
|
-
"gitHead": "
|
|
100
|
+
"gitHead": "c95b85c66f2aa6de4a53a2745765c043e7ab113d"
|
|
101
101
|
}
|