@labelbee/lb-components 1.8.0 → 1.9.0-alpha.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.
Files changed (89) hide show
  1. package/dist/assets/icons/bcc2b407.svg +11 -0
  2. package/dist/components/pointCloudView/PointCloud2DView.js +1 -1
  3. package/dist/components/pointCloudView/PointCloud3DView.js +1 -1
  4. package/dist/components/pointCloudView/PointCloudBackView.js +1 -1
  5. package/dist/components/pointCloudView/PointCloudContext.js +1 -1
  6. package/dist/components/pointCloudView/PointCloudListener.js +1 -1
  7. package/dist/components/pointCloudView/PointCloudSideView.js +1 -1
  8. package/dist/components/pointCloudView/PointCloudTopView.js +1 -1
  9. package/dist/components/pointCloudView/hooks/useBoxes.js +1 -1
  10. package/dist/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
  11. package/dist/components/pointCloudView/hooks/useSingleBox.js +1 -1
  12. package/dist/components/pointCloudView/hooks/useStatus.js +1 -1
  13. package/dist/components/pointCloudView/index.js +1 -1
  14. package/dist/index.css +52 -3
  15. package/dist/store/annotation/selectors.js +1 -0
  16. package/dist/types/components/AnnotationView/index.d.ts +1 -1
  17. package/dist/types/components/pointCloudView/PointCloudContext.d.ts +8 -1
  18. package/dist/types/components/pointCloudView/hooks/usePointCloudViews.d.ts +3 -16
  19. package/dist/types/components/pointCloudView/hooks/useSingleBox.d.ts +4 -1
  20. package/dist/types/components/videoPlayer/types.d.ts +1 -1
  21. package/dist/types/store/annotation/selectors.d.ts +7 -0
  22. package/dist/types/store/annotation/types.d.ts +3 -3
  23. package/dist/types/store/imgAttribute/types.d.ts +1 -1
  24. package/dist/types/store/index.d.ts +1 -1
  25. package/dist/types/store/toolStyle/types.d.ts +1 -1
  26. package/dist/types/utils/dom.d.ts +2 -2
  27. package/dist/types/views/MainView/toolFooter/AnnotatedAttributes/index.d.ts +4 -0
  28. package/dist/types/views/MainView/toolFooter/FooterPopover.d.ts +10 -0
  29. package/dist/types/views/MainView/toolFooter/index.d.ts +1 -1
  30. package/dist/views/MainView/toolFooter/AnnotatedAttributes/index.js +1 -0
  31. package/dist/views/MainView/toolFooter/FooterPopover.js +1 -0
  32. package/dist/views/MainView/toolFooter/FooterTips/ToolHotKey/index.js +1 -1
  33. package/dist/views/MainView/toolFooter/index.js +1 -1
  34. package/es/assets/annotation/rectTool/icon_rectPattern.svg.js +1 -4
  35. package/es/components/ImageError/index.js +1 -53
  36. package/es/components/pointCloudView/PointCloud2DView.js +1 -1
  37. package/es/components/pointCloudView/PointCloud2DView.js.map +1 -1
  38. package/es/components/pointCloudView/PointCloud3DView.js +1 -1
  39. package/es/components/pointCloudView/PointCloud3DView.js.map +1 -1
  40. package/es/components/pointCloudView/PointCloudBackView.js +1 -1
  41. package/es/components/pointCloudView/PointCloudBackView.js.map +1 -1
  42. package/es/components/pointCloudView/PointCloudContext.js +1 -1
  43. package/es/components/pointCloudView/PointCloudContext.js.map +1 -1
  44. package/es/components/pointCloudView/PointCloudListener.js +1 -1
  45. package/es/components/pointCloudView/PointCloudListener.js.map +1 -1
  46. package/es/components/pointCloudView/PointCloudSideView.js +1 -1
  47. package/es/components/pointCloudView/PointCloudSideView.js.map +1 -1
  48. package/es/components/pointCloudView/PointCloudTopView.js +1 -1
  49. package/es/components/pointCloudView/PointCloudTopView.js.map +1 -1
  50. package/es/components/pointCloudView/hooks/useBoxes.js +1 -1
  51. package/es/components/pointCloudView/hooks/useBoxes.js.map +1 -1
  52. package/es/components/pointCloudView/hooks/usePointCloudBoxes.js +119 -0
  53. package/es/components/pointCloudView/hooks/usePointCloudBoxes.js.map +1 -0
  54. package/es/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
  55. package/es/components/pointCloudView/hooks/usePointCloudViews.js.map +1 -1
  56. package/es/components/pointCloudView/hooks/usePolygon.js.map +1 -1
  57. package/es/components/pointCloudView/hooks/useSingleBox.js +1 -1
  58. package/es/components/pointCloudView/hooks/useSingleBox.js.map +1 -1
  59. package/es/components/pointCloudView/hooks/useStatus.js +1 -1
  60. package/es/components/pointCloudView/hooks/useStatus.js.map +1 -1
  61. package/es/components/pointCloudView/index.js +1 -1
  62. package/es/components/pointCloudView/index.js.map +1 -1
  63. package/es/components/pointCloudView/useSingleBox.js +44 -0
  64. package/es/components/pointCloudView/useSingleBox.js.map +1 -0
  65. package/es/index.css +52 -3
  66. package/es/store/annotation/selectors.js +1 -0
  67. package/es/store/annotation/selectors.js.map +1 -0
  68. package/es/views/MainView/sidebar/GeneralOperation/OperationList.js +77 -0
  69. package/es/views/MainView/sidebar/GeneralOperation/OperationList.js.map +1 -0
  70. package/es/views/MainView/toolFooter/AnnotatedAttributes/index.js +1 -0
  71. package/es/views/MainView/toolFooter/AnnotatedAttributes/index.js.map +1 -0
  72. package/es/views/MainView/toolFooter/FooterPopover.js +1 -0
  73. package/es/views/MainView/toolFooter/FooterPopover.js.map +1 -0
  74. package/es/views/MainView/toolFooter/FooterTips/ToolHotKey/index.js +1 -1
  75. package/es/views/MainView/toolFooter/FooterTips/ToolHotKey/index.js.map +1 -1
  76. package/es/views/MainView/toolFooter/index.js +1 -1
  77. package/es/views/MainView/toolFooter/index.js.map +1 -1
  78. package/package.json +4 -4
  79. package/es/assets/annotation/toolHotKeyIcon/icon_copyBackwardResult.svg.js +0 -4
  80. package/es/assets/annotation/toolHotKeyIcon/icon_copyBackwardResult.svg.js.map +0 -1
  81. package/es/assets/cssIcon/annotation/icon_clearSmall.svg +0 -10
  82. package/es/assets/cssIcon/annotation/icon_clearSmall_a.svg +0 -10
  83. package/es/assets/cssIcon/slide_btn.svg +0 -23
  84. package/es/components/pointCloudView/components/UnifiedParamsModal/index.js +0 -228
  85. package/es/components/pointCloudView/components/UnifiedParamsModal/index.js.map +0 -1
  86. package/es/components/pointCloudView/data.js +0 -4
  87. package/es/components/pointCloudView/data.js.map +0 -1
  88. package/es/hooks/useConfig.js +0 -18
  89. package/es/hooks/useConfig.js.map +0 -1
@@ -2,7 +2,7 @@ export interface ITagLabelItem {
2
2
  keyLabel: string;
3
3
  valuesLabelArray: string[];
4
4
  }
5
- export type ITagLabelsArray = ITagLabelItem[];
5
+ export declare type ITagLabelsArray = ITagLabelItem[];
6
6
  export interface ObjectString {
7
7
  [key: string]: string | undefined;
8
8
  }
@@ -0,0 +1,7 @@
1
+ import { AnnotationState } from './types';
2
+ /**
3
+ * select current step config
4
+ */
5
+ export declare const stepConfigSelector: ({ annotation }: {
6
+ annotation: AnnotationState;
7
+ }) => any;
@@ -4,8 +4,8 @@ import { IStepInfo } from '@/types/step';
4
4
  import { OnSubmit, IFileItem, GetFileData, OnSave, OnPageChange, OnStepChange, LoadFileList } from '@/types/data';
5
5
  import { ESubmitType } from '@/constant';
6
6
  import { IPointCloudBox } from '@labelbee/lb-utils';
7
- export type GraphToolInstance = RectOperation | PointOperation | PolygonOperation | LineToolOperation;
8
- export type ToolInstance = GraphToolInstance | TagOperation | TextToolOperation;
7
+ export declare type GraphToolInstance = RectOperation | PointOperation | PolygonOperation | LineToolOperation;
8
+ export declare type ToolInstance = GraphToolInstance | TagOperation | TextToolOperation;
9
9
  interface CommonActions {
10
10
  type: string;
11
11
  payload?: any;
@@ -149,5 +149,5 @@ interface BatchUpdateResultByTrackID {
149
149
  range: [number, number];
150
150
  };
151
151
  }
152
- export type AnnotationActionTypes = UpdateToolInstance | UpdateImgList | UpdateAnnotationConfig | SubmitFileData | LoadFileData | SetTaskConfig | InitTool | UpdateOnSubmit | UpdateOnPageChange | UpdateOnStepChange | UpdateGetFileData | UpdatePageSize | UpdateGetFileList | CopyBackWordResult | UpdateOnSave | BatchUpdateTrackID | BatchUpdateResultByTrackID | InitAnnotationState;
152
+ export declare type AnnotationActionTypes = UpdateToolInstance | UpdateImgList | UpdateAnnotationConfig | SubmitFileData | LoadFileData | SetTaskConfig | InitTool | UpdateOnSubmit | UpdateOnPageChange | UpdateOnStepChange | UpdateGetFileData | UpdatePageSize | UpdateGetFileList | CopyBackWordResult | UpdateOnSave | BatchUpdateTrackID | BatchUpdateResultByTrackID | InitAnnotationState;
153
153
  export {};
@@ -19,5 +19,5 @@ interface InitImgAttribute {
19
19
  type: typeof IMAGE_ATTRIBUTE_ACTIONS.INIT_IMG_ATTRIBUTE;
20
20
  payload: {};
21
21
  }
22
- export type ImgAttributeActionTypes = UpdateImgAttribute | InitImgAttribute;
22
+ export declare type ImgAttributeActionTypes = UpdateImgAttribute | InitImgAttribute;
23
23
  export {};
@@ -1,3 +1,3 @@
1
1
  import { CombinedState } from 'redux';
2
2
  export declare const rootReducer: CombinedState<any>;
3
- export type AppState = ReturnType<typeof rootReducer>;
3
+ export declare type AppState = ReturnType<typeof rootReducer>;
@@ -19,5 +19,5 @@ interface InitToolStyleConfig {
19
19
  type: typeof TOOL_STYLE_ACTIONS.INIT_TOOL_STYLE_CONFIG;
20
20
  payload: undefined;
21
21
  }
22
- export type ToolStyleActionTypes = InitToolStyleConfig | UpdateToolStyleConfig;
22
+ export declare type ToolStyleActionTypes = InitToolStyleConfig | UpdateToolStyleConfig;
23
23
  export {};
@@ -1,6 +1,6 @@
1
1
  import { MutableRefObject } from 'react';
2
- export type BasicTarget<T = HTMLElement> = (() => T | null) | T | null | MutableRefObject<T | null | undefined>;
3
- type TargetElement = HTMLElement | Element | Document | Window;
2
+ export declare type BasicTarget<T = HTMLElement> = (() => T | null) | T | null | MutableRefObject<T | null | undefined>;
3
+ declare type TargetElement = HTMLElement | Element | Document | Window;
4
4
  export declare function getTargetElement(target?: BasicTarget<TargetElement>, defaultElement?: TargetElement): TargetElement | undefined | null;
5
5
  /**
6
6
  * Get class like BEM
@@ -0,0 +1,4 @@
1
+ export declare const AnnotatedAttributesPanel: () => JSX.Element;
2
+ export declare const AnnotatedAttributesPanelFixedLeft: () => JSX.Element | null;
3
+ export declare const AnnotatedAttributesPanelFixedRight: () => JSX.Element | null;
4
+ export declare const AnnotatedAttributesIcon: () => JSX.Element | null;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ declare type Source = string | React.ReactElement;
3
+ declare const FooterPopover: ({ hoverIcon, icon, containerStyle, content, title, }: {
4
+ hoverIcon: Source;
5
+ icon: Source;
6
+ containerStyle?: React.CSSProperties | undefined;
7
+ content: React.ReactNode;
8
+ title: string;
9
+ }) => JSX.Element;
10
+ export default FooterPopover;
@@ -1,7 +1,7 @@
1
1
  import { RenderFooter } from '@/types/main';
2
2
  import { IStepInfo } from '@/types/step';
3
3
  import React from 'react';
4
- export type FooterTheme = 'light' | 'dark';
4
+ export declare type FooterTheme = 'light' | 'dark';
5
5
  interface IProps {
6
6
  totalPage: number;
7
7
  imgIndex: number;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var PointCloudContext=require("../../../../components/pointCloudView/PointCloudContext.js"),antd=require("antd"),React=require("react"),selectors=require("../../../../store/annotation/selectors.js"),ctx=require("../../../../store/ctx.js"),lbUtils=require("@labelbee/lb-utils"),icons=require("@ant-design/icons"),useHistory=require("../../../../components/pointCloudView/hooks/useHistory.js"),dom=require("../../../../utils/dom.js"),StepUtils=require("../../../../utils/StepUtils.js"),lbAnnotation=require("@labelbee/lb-annotation"),reactI18next=require("react-i18next"),FooterPopover=require("../FooterPopover.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const AnnotatedAttributesItem=({attribute:e})=>{const a=React.useContext(PointCloudContext.PointCloudContext),{pointCloudBoxList:n,hideAttributes:l,toggleAttributesVisible:u,polygonList:o,setPolygonList:C,setPointCloudResult:p,reRender:v}=a,[d,x]=React.useState(!1),{pushHistoryWithList:A}=useHistory.useHistory(),c=[...n,...o].filter(t=>t.attribute===e.value),m=()=>{u(e.value)},E=l.includes(e.value),f=({trackID:t,order:r})=>t||r,b=t=>{if(c.length===0)return;const r=o.filter(s=>t!==s.attribute),i=n.filter(s=>t!==s.attribute);C(r),p(i),v(i,r),A({pointCloudBoxList:i,polygonList:r})},g=t=>{antd.Modal.confirm({content:lbUtils.i18n.t("onDeleteGraphByAttr",{attribute:t.key}),onOk:()=>{b(t.value)},okText:lbUtils.i18n.t("Confirm"),cancelText:lbUtils.i18n.t("Cancel")})};return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement("div",{className:dom.getClassName("annotated-attribute","item")},E?React__default.default.createElement(icons.EyeInvisibleFilled,{onClick:m}):React__default.default.createElement(icons.EyeFilled,{onClick:m}),React__default.default.createElement(icons.CaretDownFilled,{rotate:d?270:0,onClick:()=>{x(!d)}}),React__default.default.createElement("span",{className:dom.getClassName("annotated-attribute","item","text")},e.key),React__default.default.createElement(icons.DeleteOutlined,{onClick:()=>g(e)})),c.map(t=>React__default.default.createElement("div",{key:f(t),style:{paddingLeft:54}},`${f(t)}.${e.key}`)))},AnnotatedAttributesPanel=()=>{const e=ctx.useSelector(selectors.stepConfigSelector),{attrPanelLayout:a,setAttrPanelLayout:n}=React.useContext(PointCloudContext.PointCloudContext);return React__default.default.createElement("div",{className:dom.getClassName("annotated-attribute")},a?React__default.default.createElement("div",{className:dom.getClassName("annotated-attribute","text")},React__default.default.createElement("span",null,"\u6807\u6CE8\u7ED3\u679C"),React__default.default.createElement("span",{className:dom.getClassName("annotated-attribute","pin"),onClick:()=>{n("")}},React__default.default.createElement(icons.PushpinFilled,null),"\u53D6\u6D88\u56FA\u5B9A")):React__default.default.createElement("div",{className:dom.getClassName("annotated-attribute","text")},React__default.default.createElement("span",{onClick:()=>{n("left")},className:dom.getClassName("annotated-attribute","pin")},React__default.default.createElement(icons.PushpinFilled,null),"\u56FA\u5B9A\u5728\u5DE6\u4FA7"),React__default.default.createElement("span",{onClick:()=>{n("right")},className:dom.getClassName("annotated-attribute","pin")},React__default.default.createElement(icons.PushpinFilled,null),"\u56FA\u5B9A\u5728\u53F3\u4FA7")),React__default.default.createElement("div",null,e.attributeList.map(l=>React__default.default.createElement(AnnotatedAttributesItem,{attribute:l,key:l.value}))))},AnnotatedAttributesPanelFixedLeft=()=>{const{attrPanelLayout:e}=React.useContext(PointCloudContext.PointCloudContext);return e==="left"?React__default.default.createElement(AnnotatedAttributesPanel,null):null},AnnotatedAttributesPanelFixedRight=()=>{const{attrPanelLayout:e}=React.useContext(PointCloudContext.PointCloudContext);return e==="right"?React__default.default.createElement(AnnotatedAttributesPanel,null):null},AnnotatedAttributesIcon=()=>{const{attrPanelLayout:e}=React.useContext(PointCloudContext.PointCloudContext),{t:a}=reactI18next.useTranslation(),n=ctx.useSelector(l=>{var u,o;return StepUtils.getCurrentStepInfo((u=l==null?void 0:l.annotation)==null?void 0:u.step,(o=l.annotation)==null?void 0:o.stepList)});return(n==null?void 0:n.tool)!==lbAnnotation.EPointCloudName.PointCloud||e?null:React__default.default.createElement(FooterPopover,{hoverIcon:React__default.default.createElement(icons.UnorderedListOutlined,{style:{marginRight:4}}),icon:React__default.default.createElement(icons.UnorderedListOutlined,{style:{marginRight:4}}),title:a("AnnotatedList"),content:React__default.default.createElement(AnnotatedAttributesPanel,null)})};exports.AnnotatedAttributesIcon=AnnotatedAttributesIcon,exports.AnnotatedAttributesPanel=AnnotatedAttributesPanel,exports.AnnotatedAttributesPanelFixedLeft=AnnotatedAttributesPanelFixedLeft,exports.AnnotatedAttributesPanelFixedRight=AnnotatedAttributesPanelFixedRight;
@@ -0,0 +1 @@
1
+ "use strict";var React=require("react"),antd=require("antd");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const Icon=({source:e})=>typeof e=="string"?React__default.default.createElement("img",{src:e,width:14,height:14,style:{marginRight:4}}):e,FooterPopover=({hoverIcon:e,icon:a,containerStyle:r,content:s,title:o})=>{const[l,t]=React.useState(!1),n=React__default.default.createElement(Icon,{source:l&&e!=null?e:a});return React__default.default.createElement(antd.Popover,{placement:"topLeft",content:s,onMouseMove:()=>{t(!0)},onMouseLeave:()=>{t(!1)},overlayClassName:"tool-hotkeys-popover",className:"tipsBar"},React__default.default.createElement("div",{className:"shortCutTitle",onMouseMove:()=>t(!0),onMouseLeave:()=>t(!1),style:r},React__default.default.createElement("a",{className:"svg"},n,o)))};module.exports=FooterPopover;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var es=require("antd/es"),React=require("react"),icon_kj1=require("../../../../../assets/annotation/toolHotKeyIcon/icon_kj1.svg.js"),icon_kj_h=require("../../../../../assets/annotation/toolHotKeyIcon/icon_kj_h.svg.js"),ToolType=require("../../../../../data/enums/ToolType.js"),index=require("./rectToolShortCutTable/index.js"),index$2=require("./point/index.js"),index$3=require("./polygon/index.js"),index$4=require("./line/index.js"),index$1=require("./tag/index.js"),index$5=require("./text/index.js"),index$6=require("./videoTag/index.js"),index$7=require("./pointCloud/index.js"),index$8=require("./scribble/index.js"),index$9=require("../../index.js"),reactI18next=require("react-i18next"),lbAnnotation=require("@labelbee/lb-annotation"),PointCloudContext=require("../../../../../components/pointCloudView/PointCloudContext.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,a,t)=>a in e?__defProp(e,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[a]=t,__spreadValues=(e,a)=>{for(var t in a||(a={}))__hasOwnProp.call(a,t)&&__defNormalProp(e,t,a[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(a))__propIsEnum.call(a,t)&&__defNormalProp(e,t,a[t]);return e};const{EVideoToolName,EPointCloudName}=lbAnnotation.cTool,shortCutTable={[ToolType.EToolName.Rect]:index.default,[ToolType.EToolName.Tag]:index$1.default,[ToolType.EToolName.Point]:index$2.default,[ToolType.EToolName.Polygon]:index$3.default,[ToolType.EToolName.Line]:index$4.default,[ToolType.EToolName.Text]:index$5,[EVideoToolName.VideoTagTool]:index$6,[EPointCloudName.PointCloud]:index$7.default,[EPointCloudName.PointCloud+"_POLYGON"]:index$7.pointCloudShortCutTable_POLYGON,[ToolType.EToolName.ScribbleTool]:index$8},ToolHotKeyIcon=({icon:e})=>typeof e=="string"?React__default.default.createElement("img",{width:16,height:16,src:e}):e||null,ToolHotKeyCom=({title:e,style:a,shortCutList:t})=>{const[c,n]=React.useState(!1),{t:s}=reactI18next.useTranslation(),m={width:320,display:"flex",justifyContent:"space-between",margin:16},u={display:"block",padding:"0 3px",minWidth:"20px",marginRight:"3px",border:"1px solid rgba(204,204,204,1)",verticalAlign:"middle",fontSize:"12px",textAlign:"center"},y=(r,i)=>React__default.default.createElement("div",{style:m,key:i},React__default.default.createElement("span",{style:{display:"flex",alignItems:"center"}},React__default.default.createElement(ToolHotKeyIcon,{icon:r.icon}),React__default.default.createElement("span",{style:{marginLeft:r.icon?16:0}},s(r.name))),React__default.default.createElement("span",{style:{display:"flex",alignItems:"center"}},r.noticeInfo&&React__default.default.createElement("span",{style:{marginRight:"5px",color:"#CCCCCC"}},s(r.noticeInfo)),g(r.shortCut,r.shortCutUseHtml,r.linkSymbol))),g=(r,i=!1,x="+")=>{if(!r)return null;const E=r.map((l,o)=>{var p,f;const d={display:"flex",alignItems:"center"};return i?React__default.default.createElement("span",{key:o,style:d},React__default.default.createElement("span",{style:u,dangerouslySetInnerHTML:{__html:l}})):o<r.length-1?typeof l=="number"?React__default.default.createElement("span",{key:o,style:d},React__default.default.createElement("span",{style:u},l),React__default.default.createElement("span",{style:{marginRight:"3px"}},"~")):((p=l==null?void 0:l.startsWith)==null?void 0:p.call(l,"data"))?React__default.default.createElement("span",{key:o,style:d},React__default.default.createElement("span",{className:"shortCutButton",style:{marginRight:"3px"}},React__default.default.createElement("img",{width:16,height:23,src:l})),React__default.default.createElement("span",{style:{marginRight:"3px"}},"+")):React__default.default.createElement("span",{key:o,style:d},React__default.default.createElement("span",{style:u},l),React__default.default.createElement("span",{style:{marginRight:"3px"}},x)):typeof l=="number"?React__default.default.createElement("span",{key:o,style:d},React__default.default.createElement("span",{style:u},l)):((f=l==null?void 0:l.startsWith)==null?void 0:f.call(l,"data"))?React__default.default.createElement("span",{className:"shortCutButton",key:o,style:{marginRight:"3px"}},React__default.default.createElement("img",{width:16,height:23,src:l})):React__default.default.createElement("span",{style:u,key:o},l)});return React__default.default.createElement("div",{style:{display:"flex",justifyContent:"space-around",alignItems:"center"}},E)},v=React__default.default.createElement("div",{className:`${index$9.footerCls}__hotkey-content`},t==null?void 0:t.map((r,i)=>y(r,i))),h=a||{width:100};return React__default.default.createElement(es.Popover,{placement:"topLeft",content:v,onMouseMove:()=>n(!0),onMouseLeave:()=>{n(!1)},overlayClassName:"tool-hotkeys-popover",className:"tipsBar"},React__default.default.createElement("div",{className:"shortCutTitle",onMouseMove:()=>n(!0),onMouseLeave:()=>n(!1),style:h},e!=null?e:React__default.default.createElement("a",{className:"svg"},React__default.default.createElement("img",{src:c?icon_kj_h:icon_kj1,width:15,height:13,style:{marginRight:"5px"}}),s("Hotkeys"))))},ToolHotKey=({style:e,title:a,toolName:t})=>{const{pointCloudPattern:c}=React.useContext(PointCloudContext.PointCloudContext);if(!t||!shortCutTable[t])return null;let n=t;n===`${EPointCloudName.PointCloud}`&&c===ToolType.EToolName.Polygon&&(n+="_POLYGON");const s={style:e,title:a,shortCutList:shortCutTable[n]};return React__default.default.createElement(ToolHotKeyCom,__spreadValues({},s))};exports.ToolHotKeyCom=ToolHotKeyCom,exports.default=ToolHotKey,exports.shortCutTable=shortCutTable;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),icon_kj1=require("../../../../../assets/annotation/toolHotKeyIcon/icon_kj1.svg.js"),icon_kj_h=require("../../../../../assets/annotation/toolHotKeyIcon/icon_kj_h.svg.js"),ToolType=require("../../../../../data/enums/ToolType.js"),index=require("./rectToolShortCutTable/index.js"),index$2=require("./point/index.js"),index$3=require("./polygon/index.js"),index$4=require("./line/index.js"),index$1=require("./tag/index.js"),index$5=require("./text/index.js"),index$6=require("./videoTag/index.js"),index$7=require("./pointCloud/index.js"),index$8=require("./scribble/index.js"),index$9=require("../../index.js"),reactI18next=require("react-i18next"),lbAnnotation=require("@labelbee/lb-annotation"),PointCloudContext=require("../../../../../components/pointCloudView/PointCloudContext.js"),FooterPopover=require("../../FooterPopover.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,r,t)=>r in e?__defProp(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,__spreadValues=(e,r)=>{for(var t in r||(r={}))__hasOwnProp.call(r,t)&&__defNormalProp(e,t,r[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(r))__propIsEnum.call(r,t)&&__defNormalProp(e,t,r[t]);return e};const{EVideoToolName,EPointCloudName}=lbAnnotation.cTool,shortCutTable={[ToolType.EToolName.Rect]:index.default,[ToolType.EToolName.Tag]:index$1.default,[ToolType.EToolName.Point]:index$2.default,[ToolType.EToolName.Polygon]:index$3.default,[ToolType.EToolName.Line]:index$4.default,[ToolType.EToolName.Text]:index$5,[EVideoToolName.VideoTagTool]:index$6,[EPointCloudName.PointCloud]:index$7.default,[EPointCloudName.PointCloud+"_POLYGON"]:index$7.pointCloudShortCutTable_POLYGON,[ToolType.EToolName.ScribbleTool]:index$8},ToolHotKeyIcon=({icon:e})=>typeof e=="string"?React__default.default.createElement("img",{width:16,height:16,src:e}):e||null,ToolHotKeyCom=({title:e,style:r,shortCutList:t})=>{const{t:s}=reactI18next.useTranslation(),i={width:320,display:"flex",justifyContent:"space-between",margin:16},o={display:"block",padding:"0 3px",minWidth:"20px",marginRight:"3px",border:"1px solid rgba(204,204,204,1)",verticalAlign:"middle",fontSize:"12px",textAlign:"center"},f=(a,u)=>React__default.default.createElement("div",{style:i,key:u},React__default.default.createElement("span",{style:{display:"flex",alignItems:"center"}},React__default.default.createElement(ToolHotKeyIcon,{icon:a.icon}),React__default.default.createElement("span",{style:{marginLeft:a.icon?16:0}},s(a.name))),React__default.default.createElement("span",{style:{display:"flex",alignItems:"center"}},a.noticeInfo&&React__default.default.createElement("span",{style:{marginRight:"5px",color:"#CCCCCC"}},s(a.noticeInfo)),y(a.shortCut,a.shortCutUseHtml,a.linkSymbol))),y=(a,u=!1,v="+")=>{if(!a)return null;const x=a.map((n,l)=>{var c,p;const d={display:"flex",alignItems:"center"};return u?React__default.default.createElement("span",{key:l,style:d},React__default.default.createElement("span",{style:o,dangerouslySetInnerHTML:{__html:n}})):l<a.length-1?typeof n=="number"?React__default.default.createElement("span",{key:l,style:d},React__default.default.createElement("span",{style:o},n),React__default.default.createElement("span",{style:{marginRight:"3px"}},"~")):((c=n==null?void 0:n.startsWith)==null?void 0:c.call(n,"data"))?React__default.default.createElement("span",{key:l,style:d},React__default.default.createElement("span",{className:"shortCutButton",style:{marginRight:"3px"}},React__default.default.createElement("img",{width:16,height:23,src:n})),React__default.default.createElement("span",{style:{marginRight:"3px"}},"+")):React__default.default.createElement("span",{key:l,style:d},React__default.default.createElement("span",{style:o},n),React__default.default.createElement("span",{style:{marginRight:"3px"}},v)):typeof n=="number"?React__default.default.createElement("span",{key:l,style:d},React__default.default.createElement("span",{style:o},n)):((p=n==null?void 0:n.startsWith)==null?void 0:p.call(n,"data"))?React__default.default.createElement("span",{className:"shortCutButton",key:l,style:{marginRight:"3px"}},React__default.default.createElement("img",{width:16,height:23,src:n})):React__default.default.createElement("span",{style:o,key:l},n)});return React__default.default.createElement("div",{style:{display:"flex",justifyContent:"space-around",alignItems:"center"}},x)},m=React__default.default.createElement("div",{className:`${index$9.footerCls}__hotkey-content`},t==null?void 0:t.map((a,u)=>f(a,u))),g=r||{};return React__default.default.createElement(FooterPopover,{hoverIcon:icon_kj_h,icon:icon_kj1,title:s("Hotkeys"),content:m,containerStyle:g})},ToolHotKey=({style:e,title:r,toolName:t})=>{const{pointCloudPattern:s}=React.useContext(PointCloudContext.PointCloudContext);if(!t||!shortCutTable[t])return null;let i=t;i===`${EPointCloudName.PointCloud}`&&s===ToolType.EToolName.Polygon&&(i+="_POLYGON");const o={style:e,title:r,shortCutList:shortCutTable[i]};return React__default.default.createElement(ToolHotKeyCom,__spreadValues({},o))};exports.ToolHotKeyCom=ToolHotKeyCom,exports.default=ToolHotKey,exports.shortCutTable=shortCutTable;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var index$5=require("../../../constant/index.js"),actionCreators=require("../../../store/annotation/actionCreators.js"),reducer=require("../../../store/annotation/reducer.js"),es=require("antd/es"),React=require("react"),reactI18next=require("react-i18next"),reactRedux=require("react-redux"),ctx=require("../../../store/ctx.js"),index=require("./FooterTips/index.js"),index$1=require("./HiddenTips/index.js"),index$2=require("./PageNumber/index.js"),index$3=require("./ZoomController/index.js"),Pagination=require("./Pagination.js"),lbAnnotation=require("@labelbee/lb-annotation"),index$4=require("./FooterTips/ToolHotKey/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const{EPointCloudName}=lbAnnotation.cTool,footerCls=`${index$5.prefix}-footer`,FooterDivider=()=>React__default.default.createElement(es.Divider,{type:"vertical",style:{background:"rgba(153, 153, 153, 1)",height:"16px"}}),renderFooter=({footerTips:e,hiddenTips:a,pageNumber:i,pagination:l,zoomController:n,curItems:u,footerDivider:s})=>React__default.default.createElement(React__default.default.Fragment,null,e,React__default.default.createElement("div",{style:{flex:1}}),a,i,l,u,s,n),ToolFooter=e=>{var a;const{stepList:i,step:l,basicResultList:n,basicIndex:u,mode:s="light",footer:o=renderFooter,skipBeforePageTurning:t}=e,r=ctx.useDispatch(),{t:g}=reactI18next.useTranslation(),c=(a=i[l-1])!=null?a:{},m=!!c.dataSourceStep,x=()=>{if(t){t(()=>r(actionCreators.PageBackward()));return}r(actionCreators.PageBackward())},p=()=>{if(t){t(()=>r(actionCreators.PageForward()));return}r(actionCreators.PageForward())},v=b=>{const f=~~b-1;if(t){t(()=>r(actionCreators.PageJump(f)));return}r(actionCreators.PageJump(f))},d=React__default.default.createElement(Pagination.Pagination,{imgIndex:e.imgIndex,totalPage:e.totalPage,pageJump:v,pageBackward:x,pageForward:p,footerCls}),P=m&&n.length>0?React__default.default.createElement("span",null,g("curItems",{current:u+1,total:n.length})):null;return typeof o=="function"?o===renderFooter&&c.tool===EPointCloudName.PointCloud?React__default.default.createElement("div",{className:`${footerCls}`,style:e.style},React__default.default.createElement(index,null),React__default.default.createElement("div",{style:{flex:1}}),d):React__default.default.createElement("div",{className:`${footerCls}`,style:e.style},o({footerTips:React__default.default.createElement(index,null),hiddenTips:React__default.default.createElement(index$1,null),pageNumber:React__default.default.createElement(index$2,null),pagination:d,zoomController:React__default.default.createElement(index$3.default,{mode:s}),curItems:P,footerDivider:React__default.default.createElement(FooterDivider,null),shortCutTable:index$4.shortCutTable,ToolHotKeyCom:index$4.ToolHotKeyCom})):o},mapStateToProps=e=>({totalPage:reducer.getTotalPage(e.annotation),imgIndex:e.annotation.imgIndex,stepList:e.annotation.stepList,step:e.annotation.step,basicIndex:e.annotation.basicIndex,basicResultList:e.annotation.basicResultList,skipBeforePageTurning:e.annotation.skipBeforePageTurning});var ToolFooter$1=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(ToolFooter);exports.FooterDivider=FooterDivider,exports.default=ToolFooter$1,exports.footerCls=footerCls;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var index$6=require("../../../constant/index.js"),actionCreators=require("../../../store/annotation/actionCreators.js"),reducer=require("../../../store/annotation/reducer.js"),es=require("antd/es"),React=require("react"),reactI18next=require("react-i18next"),reactRedux=require("react-redux"),ctx=require("../../../store/ctx.js"),index=require("./FooterTips/index.js"),index$2=require("./HiddenTips/index.js"),index$3=require("./PageNumber/index.js"),index$4=require("./ZoomController/index.js"),Pagination=require("./Pagination.js"),index$1=require("./AnnotatedAttributes/index.js"),lbAnnotation=require("@labelbee/lb-annotation"),index$5=require("./FooterTips/ToolHotKey/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const{EPointCloudName}=lbAnnotation.cTool,footerCls=`${index$6.prefix}-footer`,FooterDivider=()=>React__default.default.createElement(es.Divider,{type:"vertical",style:{background:"rgba(153, 153, 153, 1)",height:"16px"}}),renderFooter=({footerTips:e,hiddenTips:a,pageNumber:i,pagination:l,zoomController:o,curItems:u,footerDivider:s,annotateAttrList:t})=>React__default.default.createElement(React__default.default.Fragment,null,e,t,React__default.default.createElement("div",{style:{flex:1}}),a,i,l,u,s,o),ToolFooter=e=>{var a;const{stepList:i,step:l,basicResultList:o,basicIndex:u,mode:s="light",footer:t=renderFooter,skipBeforePageTurning:n}=e,r=ctx.useDispatch(),{t:g}=reactI18next.useTranslation(),c=(a=i[l-1])!=null?a:{},m=!!c.dataSourceStep,x=()=>{if(n){n(()=>r(actionCreators.PageBackward()));return}r(actionCreators.PageBackward())},p=()=>{if(n){n(()=>r(actionCreators.PageForward()));return}r(actionCreators.PageForward())},v=P=>{const f=~~P-1;if(n){n(()=>r(actionCreators.PageJump(f)));return}r(actionCreators.PageJump(f))},d=React__default.default.createElement(Pagination.Pagination,{imgIndex:e.imgIndex,totalPage:e.totalPage,pageJump:v,pageBackward:x,pageForward:p,footerCls}),b=m&&o.length>0?React__default.default.createElement("span",null,g("curItems",{current:u+1,total:o.length})):null;return typeof t=="function"?t===renderFooter&&c.tool===EPointCloudName.PointCloud?React__default.default.createElement("div",{className:`${footerCls}`,style:e.style},React__default.default.createElement(index,null),React__default.default.createElement(index$1.AnnotatedAttributesIcon,null),React__default.default.createElement("div",{style:{flex:1}}),d):React__default.default.createElement("div",{className:`${footerCls}`,style:e.style},t({footerTips:React__default.default.createElement(index,null),hiddenTips:React__default.default.createElement(index$2,null),pageNumber:React__default.default.createElement(index$3,null),annotateAttrList:React__default.default.createElement(index$1.AnnotatedAttributesIcon,null),pagination:d,zoomController:React__default.default.createElement(index$4.default,{mode:s}),curItems:b,footerDivider:React__default.default.createElement(FooterDivider,null),shortCutTable:index$5.shortCutTable,ToolHotKeyCom:index$5.ToolHotKeyCom})):t},mapStateToProps=e=>({totalPage:reducer.getTotalPage(e.annotation),imgIndex:e.annotation.imgIndex,stepList:e.annotation.stepList,step:e.annotation.step,basicIndex:e.annotation.basicIndex,basicResultList:e.annotation.basicResultList,skipBeforePageTurning:e.annotation.skipBeforePageTurning});var ToolFooter$1=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(ToolFooter);exports.FooterDivider=FooterDivider,exports.default=ToolFooter$1,exports.footerCls=footerCls;
@@ -1,4 +1 @@
1
- var img = "data:image/svg+xml,%3csvg width='72' height='72' viewBox='0 0 72 72' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M20 8H8V20H20V8Z' fill='%23666FFF'/%3e%3cpath d='M11 22H17V50H11V22Z' fill='%23666FFF' fill-opacity='0.25'/%3e%3cpath d='M55 22H61V50H55V22Z' fill='%23666FFF' fill-opacity='0.25'/%3e%3cpath d='M50 55L50 61L22 61L22 55L50 55Z' fill='%23666FFF' fill-opacity='0.25'/%3e%3cpath d='M50 11L50 17L22 17L22 11L50 11Z' fill='%23666FFF' fill-opacity='0.25'/%3e%3cpath d='M64 8H52V20H64V8Z' fill='%23666FFF'/%3e%3cpath d='M20 52H8V64H20V52Z' fill='%23666FFF'/%3e%3cpath d='M64 52H52V64H64V52Z' fill='%23666FFF'/%3e%3c/svg%3e";
2
-
3
- export { img as default };
4
- //# sourceMappingURL=icon_rectPattern.svg.js.map
1
+ var l="data:image/svg+xml,%3csvg width='72' height='72' viewBox='0 0 72 72' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M20 8H8V20H20V8Z' fill='%23666FFF'/%3e%3cpath d='M11 22H17V50H11V22Z' fill='%23666FFF' fill-opacity='0.25'/%3e%3cpath d='M55 22H61V50H55V22Z' fill='%23666FFF' fill-opacity='0.25'/%3e%3cpath d='M50 55L50 61L22 61L22 55L50 55Z' fill='%23666FFF' fill-opacity='0.25'/%3e%3cpath d='M50 11L50 17L22 17L22 11L50 11Z' fill='%23666FFF' fill-opacity='0.25'/%3e%3cpath d='M64 8H52V20H64V8Z' fill='%23666FFF'/%3e%3cpath d='M20 52H8V64H20V52Z' fill='%23666FFF'/%3e%3cpath d='M64 52H52V64H64V52Z' fill='%23666FFF'/%3e%3c/svg%3e";export{l as default};
@@ -1,53 +1 @@
1
- import { ReloadOutlined } from '@ant-design/icons';
2
- import { Button } from 'antd/es';
3
- import React from 'react';
4
-
5
- const ImageError = (props) => {
6
- const {
7
- width,
8
- height,
9
- reloadImage,
10
- hideSetInvalidTips,
11
- ignoreOffsetY,
12
- backgroundColor,
13
- fileTypeName = "\u56FE\u7247"
14
- } = props;
15
- const top = !ignoreOffsetY ? 40 : 0;
16
- const layerStyle = props.layerStyle || {
17
- position: "absolute",
18
- left: 0,
19
- top,
20
- cursor: "initial",
21
- zIndex: 20,
22
- fontSize: 12
23
- };
24
- if (width && height) {
25
- Object.assign(layerStyle, {width, height});
26
- } else {
27
- Object.assign(layerStyle, {bottom: 0, right: 0});
28
- }
29
- if (backgroundColor) {
30
- Object.assign(layerStyle, {backgroundColor});
31
- }
32
- const buttonStyle = {
33
- position: "absolute",
34
- top: "30%",
35
- left: "50%",
36
- transform: "translate(-50%, -50%)"
37
- };
38
- return /* @__PURE__ */ React.createElement("div", {
39
- style: layerStyle
40
- }, /* @__PURE__ */ React.createElement("div", {
41
- style: buttonStyle
42
- }, /* @__PURE__ */ React.createElement("div", {
43
- style: {textAlign: "center", marginBottom: 10}
44
- }, /* @__PURE__ */ React.createElement(Button, {
45
- type: "primary",
46
- shape: "circle",
47
- icon: /* @__PURE__ */ React.createElement(ReloadOutlined, null),
48
- onClick: reloadImage
49
- })), /* @__PURE__ */ React.createElement("div", null, `${fileTypeName}\u52A0\u8F7D\u5931\u8D25, \u8BF7\u91CD\u65B0\u52A0\u8F7D${hideSetInvalidTips ? "" : ` \u6216 \u5C06${fileTypeName}\u6807\u4E3A\u65E0\u6548`}`)));
50
- };
51
-
52
- export { ImageError as default };
53
- //# sourceMappingURL=index.js.map
1
+ import{ReloadOutlined as d}from"@ant-design/icons";import{Button as f}from"antd/es";import e from"react";const g=n=>{const{width:o,height:i,reloadImage:a,hideSetInvalidTips:s,ignoreOffsetY:u,backgroundColor:l,fileTypeName:r="\u56FE\u7247"}=n,c=u?0:40,t=n.layerStyle||{position:"absolute",left:0,top:c,cursor:"initial",zIndex:20,fontSize:12};o&&i?Object.assign(t,{width:o,height:i}):Object.assign(t,{bottom:0,right:0}),l&&Object.assign(t,{backgroundColor:l});const m={position:"absolute",top:"30%",left:"50%",transform:"translate(-50%, -50%)"};return e.createElement("div",{style:t},e.createElement("div",{style:m},e.createElement("div",{style:{textAlign:"center",marginBottom:10}},e.createElement(f,{type:"primary",shape:"circle",icon:e.createElement(d,null),onClick:a})),e.createElement("div",null,`${r}\u52A0\u8F7D\u5931\u8D25, \u8BF7\u91CD\u65B0\u52A0\u8F7D${s?"":` \u6216 \u5C06${r}\u6807\u4E3A\u65E0\u6548`}`)))};export{g as default};
@@ -1 +1 @@
1
- import{getClassName as I}from"../../utils/dom.js";import l,{useState as O,useContext as T,useRef as j,useEffect as b,useCallback as M}from"react";import{PointCloudContainer as F}from"./PointCloudLayout.js";import $ from"../AnnotationView/index.js";import{PointCloudContext as q}from"./PointCloudContext.js";import{connect as G}from"react-redux";import{LeftOutlined as H,RightOutlined as J}from"@ant-design/icons";import K from"../../hooks/useSize.js";import{useSingleBox as Q}from"./hooks/useSingleBox.js";import{pointCloudLidar2image as U}from"@labelbee/lb-annotation";import{useTranslation as W}from"react-i18next";import{LabelBeeContext as X}from"../../store/ctx.js";import{a2MapStateToProps as Y}from"../../store/annotation/map.js";import{toolStyleConverter as Z}from"@labelbee/lb-utils";var D=Object.defineProperty,tt=Object.defineProperties,ot=Object.getOwnPropertyDescriptors,h=Object.getOwnPropertySymbols,et=Object.prototype.hasOwnProperty,nt=Object.prototype.propertyIsEnumerable,E=(t,o,e)=>o in t?D(t,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[o]=e,S=(t,o)=>{for(var e in o||(o={}))et.call(o,e)&&E(t,e,o[e]);if(h)for(var e of h(o))nt.call(o,e)&&E(t,e,o[e]);return t},V=(t,o)=>tt(t,ot(o));const it=({onNext:t,onPrev:o,imgLength:e,imgIndex:p})=>l.createElement("div",null,l.createElement(H,{onClick:o}),l.createElement("span",null," ",p+1," / ",e," "),l.createElement(J,{onClick:t})),lt=({currentData:t,config:o})=>{var e,p,P,C,L;const[u,k]=O([]),{pointCloudBoxList:w,topViewInstance:N}=T(q),[s,c]=O(0),x=j(null),f=j(),{selectedBox:g}=Q(),A=K(x),{t:B}=W(),a=(e=t==null?void 0:t.mappingImgList)==null?void 0:e[s];b(()=>{c(0)},[t]),b(()=>{if(N&&a){const n={fill:"transparent",color:"green"},r=w.reduce((m,i)=>{var d;const R=U(i,a.calib),z=(d=Z.getColorFromConfig({attribute:i.attribute},V(S({},o),{attributeConfigurable:!0}),{}))==null?void 0:d.stroke;return[...m,...R.map(y=>({type:y.type,annotation:V(S({id:i.id,pointList:y.pointList},n),{stroke:z})}))]},[]);k(r)}},[w,a]);const v=!t||!(t==null?void 0:t.mappingImgList)||!(((p=t==null?void 0:t.mappingImgList)==null?void 0:p.length)>0),_=M(()=>{var n,r;const m=(n=f.current)==null?void 0:n.toolInstance;if(!g||!m)return;const i=u.find(d=>d.annotation.id===g.info.id);((r=i==null?void 0:i.annotation.pointList)==null?void 0:r.length)>0&&m.focusPositionByPointList(i==null?void 0:i.annotation.pointList)},[g,f.current,u,s]);return b(()=>{_()},[_]),l.createElement(F,{className:I("point-cloud-2d-container"),title:B("2DView"),toolbar:v?void 0:l.createElement(it,{imgIndex:s,imgLength:(C=(P=t.mappingImgList)==null?void 0:P.length)!=null?C:0,onNext:()=>{var n;!t||!(t==null?void 0:t.mappingImgList)||s>=((n=t==null?void 0:t.mappingImgList)==null?void 0:n.length)-1||c(r=>r+1)},onPrev:()=>{s<=0||c(n=>n-1)}}),style:{display:v?"none":"flex"}},l.createElement("div",{className:I("point-cloud-2d-image"),ref:x},l.createElement($,{src:(L=a==null?void 0:a.url)!=null?L:"",annotations:u,size:A,ref:f,globalStyle:{display:v?"none":"block"},afterImgOnLoad:_})))};var rt=G(Y,null,null,{context:X})(lt);export{rt as default};
1
+ import{getClassName as I}from"../../utils/dom.js";import l,{useState as O,useContext as T,useRef as j,useEffect as P,useCallback as M}from"react";import{PointCloudContainer as F}from"./PointCloudLayout.js";import $ from"../AnnotationView/index.js";import{PointCloudContext as q}from"./PointCloudContext.js";import{connect as G}from"react-redux";import{LeftOutlined as H,RightOutlined as J}from"@ant-design/icons";import K from"../../hooks/useSize.js";import{useSingleBox as Q}from"./hooks/useSingleBox.js";import{pointCloudLidar2image as U}from"@labelbee/lb-annotation";import{useTranslation as W}from"react-i18next";import{LabelBeeContext as X}from"../../store/ctx.js";import{a2MapStateToProps as Y}from"../../store/annotation/map.js";import{toolStyleConverter as Z}from"@labelbee/lb-utils";var D=Object.defineProperty,tt=Object.defineProperties,et=Object.getOwnPropertyDescriptors,h=Object.getOwnPropertySymbols,ot=Object.prototype.hasOwnProperty,nt=Object.prototype.propertyIsEnumerable,E=(t,e,o)=>e in t?D(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,S=(t,e)=>{for(var o in e||(e={}))ot.call(e,o)&&E(t,o,e[o]);if(h)for(var o of h(e))nt.call(e,o)&&E(t,o,e[o]);return t},V=(t,e)=>tt(t,et(e));const it=({onNext:t,onPrev:e,imgLength:o,imgIndex:p})=>l.createElement("div",null,l.createElement(H,{onClick:e}),l.createElement("span",null," ",p+1," / ",o," "),l.createElement(J,{onClick:t})),lt=({currentData:t,config:e})=>{var o,p,b,C,L;const[u,k]=O([]),{topViewInstance:N,displayPointCloudList:y}=T(q),[s,c]=O(0),w=j(null),f=j(),{selectedBox:g}=Q(),A=K(w),{t:R}=W(),a=(o=t==null?void 0:t.mappingImgList)==null?void 0:o[s];P(()=>{c(0)},[t]),P(()=>{if(N&&a){const n={fill:"transparent",color:"green"},r=y.reduce((m,i)=>{var d;const z=U(i,a.calib),B=(d=Z.getColorFromConfig({attribute:i.attribute},V(S({},e),{attributeConfigurable:!0}),{}))==null?void 0:d.stroke;return[...m,...z.map(x=>({type:x.type,annotation:V(S({id:i.id,pointList:x.pointList},n),{stroke:B})}))]},[]);k(r)}},[y,a]);const v=!t||!(t==null?void 0:t.mappingImgList)||!(((p=t==null?void 0:t.mappingImgList)==null?void 0:p.length)>0),_=M(()=>{var n,r;const m=(n=f.current)==null?void 0:n.toolInstance;if(!g||!m)return;const i=u.find(d=>d.annotation.id===g.info.id);((r=i==null?void 0:i.annotation.pointList)==null?void 0:r.length)>0&&m.focusPositionByPointList(i==null?void 0:i.annotation.pointList)},[g,f.current,u,s]);return P(()=>{_()},[_]),l.createElement(F,{className:I("point-cloud-2d-container"),title:R("2DView"),toolbar:v?void 0:l.createElement(it,{imgIndex:s,imgLength:(C=(b=t.mappingImgList)==null?void 0:b.length)!=null?C:0,onNext:()=>{var n;!t||!(t==null?void 0:t.mappingImgList)||s>=((n=t==null?void 0:t.mappingImgList)==null?void 0:n.length)-1||c(r=>r+1)},onPrev:()=>{s<=0||c(n=>n-1)}}),style:{display:v?"none":"flex"}},l.createElement("div",{className:I("point-cloud-2d-image"),ref:w},l.createElement($,{src:(L=a==null?void 0:a.url)!=null?L:"",annotations:u,size:A,ref:f,globalStyle:{display:v?"none":"block"},afterImgOnLoad:_})))};var rt=G(Y,null,null,{context:X})(lt);export{rt as default};
@@ -1 +1 @@
1
- {"version":3,"file":"PointCloud2DView.js","sources":["../../../src/components/pointCloudView/PointCloud2DView.tsx"],"sourcesContent":["import { getClassName } from '@/utils/dom';\nimport React, { useCallback, useContext, useEffect, useRef, useState } from 'react';\nimport { PointCloudContainer } from './PointCloudLayout';\nimport AnnotationView from '@/components/AnnotationView';\nimport { PointCloudContext } from './PointCloudContext';\nimport { connect } from 'react-redux';\nimport { LeftOutlined, RightOutlined } from '@ant-design/icons';\nimport useSize from '@/hooks/useSize';\nimport { useSingleBox } from './hooks/useSingleBox';\nimport { ViewOperation, pointCloudLidar2image } from '@labelbee/lb-annotation';\nimport { useTranslation } from 'react-i18next';\nimport { LabelBeeContext } from '@/store/ctx';\nimport { a2MapStateToProps, IA2MapStateProps } from '@/store/annotation/map';\nimport { toolStyleConverter } from '@labelbee/lb-utils';\n\nconst Toolbar = ({\n onNext,\n onPrev,\n imgLength,\n imgIndex,\n}: {\n onNext: () => void;\n onPrev: () => void;\n imgLength: number;\n imgIndex: number;\n}) => {\n return (\n <div>\n <LeftOutlined onClick={onPrev} />\n <span>\n {' '}\n {imgIndex + 1} / {imgLength}{' '}\n </span>\n\n <RightOutlined onClick={onNext} />\n </div>\n );\n};\n\n// TODO, It will be deleted when the exported type of lb-annotation is work.\ninterface IAnnotationDataTemporarily {\n type: string;\n annotation: any;\n}\n\nconst PointCloud2DView = ({ currentData, config }: IA2MapStateProps) => {\n const [annotations2d, setAnnotations2d] = useState<IAnnotationDataTemporarily[]>([]);\n const { pointCloudBoxList, topViewInstance } = useContext(PointCloudContext);\n const [mappingIndex, setMappingIndex] = useState(0);\n const ref = useRef(null);\n const viewRef = useRef<{ toolInstance: ViewOperation }>();\n const { selectedBox } = useSingleBox();\n const size = useSize(ref);\n const { t } = useTranslation();\n\n const mappingData = currentData?.mappingImgList?.[mappingIndex];\n\n useEffect(() => {\n setMappingIndex(0);\n }, [currentData]);\n\n useEffect(() => {\n if (topViewInstance && mappingData) {\n const defaultViewStyle = {\n fill: 'transparent',\n color: 'green',\n };\n\n const newAnnotations2d: IAnnotationDataTemporarily[] = pointCloudBoxList.reduce(\n (acc: IAnnotationDataTemporarily[], pointCloudBox) => {\n const viewDataPointList = pointCloudLidar2image(pointCloudBox, mappingData.calib);\n\n const stroke = toolStyleConverter.getColorFromConfig(\n { attribute: pointCloudBox.attribute },\n {\n ...config,\n attributeConfigurable: true,\n },\n {},\n )?.stroke;\n\n return [\n ...acc,\n ...viewDataPointList.map((v: any) => {\n return {\n type: v.type,\n annotation: {\n id: pointCloudBox.id,\n pointList: v.pointList,\n ...defaultViewStyle,\n stroke,\n },\n };\n }),\n ];\n },\n [],\n );\n\n setAnnotations2d(newAnnotations2d);\n }\n }, [pointCloudBoxList, mappingData]);\n\n const hiddenData =\n !currentData || !currentData?.mappingImgList || !(currentData?.mappingImgList?.length > 0);\n\n const afterImgOnLoad = useCallback(() => {\n const toolInstance = viewRef.current?.toolInstance;\n\n if (!selectedBox || !toolInstance) {\n return;\n }\n const selected2data = annotations2d.find((v) => v.annotation.id === selectedBox.info.id);\n\n if (selected2data?.annotation.pointList?.length > 0) {\n toolInstance.focusPositionByPointList(selected2data?.annotation.pointList);\n }\n }, [selectedBox, viewRef.current, annotations2d, mappingIndex]);\n\n /**\n * If the status is updated, it needs to\n */\n useEffect(() => {\n afterImgOnLoad();\n }, [afterImgOnLoad]);\n\n return (\n <PointCloudContainer\n className={getClassName('point-cloud-2d-container')}\n title={t('2DView')}\n toolbar={\n hiddenData ? undefined : (\n <Toolbar\n imgIndex={mappingIndex}\n imgLength={currentData.mappingImgList?.length ?? 0}\n onNext={() => {\n if (!currentData || !currentData?.mappingImgList) {\n return;\n }\n\n if (mappingIndex >= currentData?.mappingImgList?.length - 1) {\n return;\n }\n setMappingIndex((v) => v + 1);\n }}\n onPrev={() => {\n if (mappingIndex <= 0) {\n return;\n }\n setMappingIndex((v) => v - 1);\n }}\n />\n )\n }\n style={{ display: hiddenData ? 'none' : 'flex' }}\n >\n <div className={getClassName('point-cloud-2d-image')} ref={ref}>\n <AnnotationView\n src={mappingData?.url ?? ''}\n annotations={annotations2d}\n size={size}\n ref={viewRef}\n globalStyle={{ display: hiddenData ? 'none' : 'block' }}\n afterImgOnLoad={afterImgOnLoad}\n />\n </div>\n </PointCloudContainer>\n );\n};\n\nexport default connect(a2MapStateToProps, null, null, { context: LabelBeeContext })(\n PointCloud2DView,\n);\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,MAAM,UAAU,CAAC;AAAA,EACf,MAAA;AAAA,EACA,MAAA;AAAA,EACA,SAAA;AAAA,EACA,QAAA;AAAA,CAMI,KAAA;AACJ,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,KAAA,EAAD,IACE,kBAAA,KAAA,CAAA,aAAA,CAAC,YAAD,EAAA;AAAA,IAAc,OAAS,EAAA,MAAA;AAAA,GACvB,CAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,MAAD,EAAA,IAAA,EACG,GACA,EAAA,QAAA,GAAW,GAAE,KAAI,EAAA,SAAA,EAAW,GAG/B,CAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,aAAD,EAAA;AAAA,IAAe,OAAS,EAAA,MAAA;AAAA,GAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CAAA;AAW9B,MAAM,gBAAmB,GAAA,CAAC,CAAE,WAAA,EAAa,MAA+B,CAAA,KAAA;AA7CxE,EAAA,IAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,CAAA;AA8CE,EAAM,MAAA,CAAC,aAAe,EAAA,gBAAA,CAAA,GAAoB,QAAuC,CAAA,EAAA,CAAA,CAAA;AACjF,EAAM,MAAA,CAAE,iBAAmB,EAAA,eAAA,CAAA,GAAoB,UAAW,CAAA,iBAAA,CAAA,CAAA;AAC1D,EAAM,MAAA,CAAC,YAAc,EAAA,eAAA,CAAA,GAAmB,QAAS,CAAA,CAAA,CAAA,CAAA;AACjD,EAAA,MAAM,MAAM,MAAO,CAAA,IAAA,CAAA,CAAA;AACnB,EAAA,MAAM,OAAU,GAAA,MAAA,EAAA,CAAA;AAChB,EAAA,MAAM,CAA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AAI,GAAA,CAAA,CAAA,CAAA;AAAA,OAAA;AAAA,MAE7B,QAAQ,MAAM;AACZ,QAAA,IAAI,gBAAgB,CAAG,EAAA;AACrB,UAAA,OAAA;AAAA,SAAA;AAEF,QAAgB,eAAA,CAAA,CAAC,MAAM,CAAI,GAAA,CAAA,CAAA,CAAA;AAAA,OAAA;AAAA,KAAA,CAAA;AAAA,IAKnC,KAAO,EAAA,CAAE,OAAS,EAAA,UAAA,GAAa,MAAS,GAAA,MAAA,CAAA;AAAA,GAAA,sCAEvC,KAAD,EAAA;AAAA,IAAK,WAAW,YAAa,CAAA,sBAAA,CAAA;AAAA,IAAyB,GAAA;AAAA,GAAA,sCACnD,cAAD,EAAA;AAAA,IACE,GAAA,EAAK,CAAa,EAAA,GAAA,WAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,WAAA,CAAA,GAAA,KAAb,IAAoB,GAAA,EAAA,GAAA,EAAA;AAAA,IACzB,WAAa,EAAA,aAAA;AAAA,IACb,IAAA;AAAA,IACA,GAAK,EAAA,OAAA;AAAA,IACL,WAAa,EAAA,CAAE,OAAS,EAAA,UAAA,GAAa,MAAS,GAAA,OAAA,CAAA;AAAA,IAC9C,cAAA;AAAA,GAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CAAA;AAOV,yBAAe,QAAQ,iBAAmB,EAAA,IAAA,EAAM,IAAM,EAAA,CAAE,SAAS,eAC/D,CAAA,CAAA,CAAA,gBAAA,CAAA;;;;"}
1
+ {"version":3,"file":"PointCloud2DView.js","sources":["../../../src/components/pointCloudView/PointCloud2DView.tsx"],"sourcesContent":["import { getClassName } from '@/utils/dom';\nimport React, { useCallback, useContext, useEffect, useRef, useState } from 'react';\nimport { PointCloudContainer } from './PointCloudLayout';\nimport AnnotationView from '@/components/AnnotationView';\nimport { PointCloudContext } from './PointCloudContext';\nimport { connect } from 'react-redux';\nimport { LeftOutlined, RightOutlined } from '@ant-design/icons';\nimport useSize from '@/hooks/useSize';\nimport { useSingleBox } from './hooks/useSingleBox';\nimport { ViewOperation, pointCloudLidar2image } from '@labelbee/lb-annotation';\nimport { useTranslation } from 'react-i18next';\nimport { LabelBeeContext } from '@/store/ctx';\nimport { a2MapStateToProps, IA2MapStateProps } from '@/store/annotation/map';\nimport { toolStyleConverter } from '@labelbee/lb-utils';\n\nconst Toolbar = ({\n onNext,\n onPrev,\n imgLength,\n imgIndex,\n}: {\n onNext: () => void;\n onPrev: () => void;\n imgLength: number;\n imgIndex: number;\n}) => {\n return (\n <div>\n <LeftOutlined onClick={onPrev} />\n <span>\n {' '}\n {imgIndex + 1} / {imgLength}{' '}\n </span>\n\n <RightOutlined onClick={onNext} />\n </div>\n );\n};\n\n// TODO, It will be deleted when the exported type of lb-annotation is work.\ninterface IAnnotationDataTemporarily {\n type: string;\n annotation: any;\n}\n\nconst PointCloud2DView = ({ currentData, config }: IA2MapStateProps) => {\n const [annotations2d, setAnnotations2d] = useState<IAnnotationDataTemporarily[]>([]);\n const { topViewInstance, displayPointCloudList } = useContext(PointCloudContext);\n const [mappingIndex, setMappingIndex] = useState(0);\n const ref = useRef(null);\n const viewRef = useRef<{ toolInstance: ViewOperation }>();\n const { selectedBox } = useSingleBox();\n const size = useSize(ref);\n const { t } = useTranslation();\n\n const mappingData = currentData?.mappingImgList?.[mappingIndex];\n\n useEffect(() => {\n setMappingIndex(0);\n }, [currentData]);\n\n useEffect(() => {\n if (topViewInstance && mappingData) {\n const defaultViewStyle = {\n fill: 'transparent',\n color: 'green',\n };\n\n const newAnnotations2d: IAnnotationDataTemporarily[] = displayPointCloudList.reduce(\n (acc: IAnnotationDataTemporarily[], pointCloudBox) => {\n const viewDataPointList = pointCloudLidar2image(pointCloudBox, mappingData.calib);\n\n const stroke = toolStyleConverter.getColorFromConfig(\n { attribute: pointCloudBox.attribute },\n {\n ...config,\n attributeConfigurable: true,\n },\n {},\n )?.stroke;\n\n return [\n ...acc,\n ...viewDataPointList.map((v: any) => {\n return {\n type: v.type,\n annotation: {\n id: pointCloudBox.id,\n pointList: v.pointList,\n ...defaultViewStyle,\n stroke,\n },\n };\n }),\n ];\n },\n [],\n );\n\n setAnnotations2d(newAnnotations2d);\n }\n }, [displayPointCloudList, mappingData]);\n\n const hiddenData =\n !currentData || !currentData?.mappingImgList || !(currentData?.mappingImgList?.length > 0);\n\n const afterImgOnLoad = useCallback(() => {\n const toolInstance = viewRef.current?.toolInstance;\n\n if (!selectedBox || !toolInstance) {\n return;\n }\n const selected2data = annotations2d.find((v) => v.annotation.id === selectedBox.info.id);\n\n if (selected2data?.annotation.pointList?.length > 0) {\n toolInstance.focusPositionByPointList(selected2data?.annotation.pointList);\n }\n }, [selectedBox, viewRef.current, annotations2d, mappingIndex]);\n\n /**\n * If the status is updated, it needs to\n */\n useEffect(() => {\n afterImgOnLoad();\n }, [afterImgOnLoad]);\n\n return (\n <PointCloudContainer\n className={getClassName('point-cloud-2d-container')}\n title={t('2DView')}\n toolbar={\n hiddenData ? undefined : (\n <Toolbar\n imgIndex={mappingIndex}\n imgLength={currentData.mappingImgList?.length ?? 0}\n onNext={() => {\n if (!currentData || !currentData?.mappingImgList) {\n return;\n }\n\n if (mappingIndex >= currentData?.mappingImgList?.length - 1) {\n return;\n }\n setMappingIndex((v) => v + 1);\n }}\n onPrev={() => {\n if (mappingIndex <= 0) {\n return;\n }\n setMappingIndex((v) => v - 1);\n }}\n />\n )\n }\n style={{ display: hiddenData ? 'none' : 'flex' }}\n >\n <div className={getClassName('point-cloud-2d-image')} ref={ref}>\n <AnnotationView\n src={mappingData?.url ?? ''}\n annotations={annotations2d}\n size={size}\n ref={viewRef}\n globalStyle={{ display: hiddenData ? 'none' : 'block' }}\n afterImgOnLoad={afterImgOnLoad}\n />\n </div>\n </PointCloudContainer>\n );\n};\n\nexport default connect(a2MapStateToProps, null, null, { context: LabelBeeContext })(\n PointCloud2DView,\n);\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,MAAM,UAAU,CAAC;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A;AAAA,KAAA,CAAA;AAAA,IAKnC,KAAO,EAAA,CAAE,OAAS,EAAA,UAAA,GAAa,MAAS,GAAA,MAAA,CAAA;AAAA,GAAA,sCAEvC,KAAD,EAAA;AAAA,IAAK,WAAW,YAAa,CAAA,sBAAA,CAAA;AAAA,IAAyB,GAAA;AAAA,GAAA,sCACnD,cAAD,EAAA;AAAA,IACE,GAAA,EAAK,CAAa,EAAA,GAAA,WAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,WAAA,CAAA,GAAA,KAAb,IAAoB,GAAA,EAAA,GAAA,EAAA;AAAA,IACzB,WAAa,EAAA,aAAA;AAAA,IACb,IAAA;AAAA,IACA,GAAK,EAAA,OAAA;AAAA,IACL,WAAa,EAAA,CAAE,OAAS,EAAA,UAAA,GAAa,MAAS,GAAA,OAAA,CAAA;AAAA,IAC9C,cAAA;AAAA,GAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CAAA;AAOV,yBAAe,QAAQ,iBAAmB,EAAA,IAAA,EAAM,IAAM,EAAA,CAAE,SAAS,eAC/D,CAAA,CAAA,CAAA,gBAAA,CAAA;;;;"}
@@ -1 +1 @@
1
- import{getClassName as u}from"../../utils/dom.js";import{PointCloud as B}from"@labelbee/lb-annotation";import{PointCloudUtils as D,toolStyleConverter as L,EPerspectiveView as _}from"@labelbee/lb-utils";import y from"classnames";import t,{useContext as f,useState as T,useRef as N,useEffect as C,useMemo as R}from"react";import{PointCloudContainer as z}from"./PointCloudLayout.js";import{PointCloudContext as k}from"./PointCloudContext.js";import{a2MapStateToProps as A}from"../../store/annotation/map.js";import{connect as F}from"react-redux";import{jsonParser as M}from"../../utils/index.js";import{useSingleBox as U}from"./hooks/useSingleBox.js";import{Switch as Z}from"antd";import q from"../../hooks/useSize.js";import{usePointCloudViews as G}from"./hooks/usePointCloudViews.js";import{useTranslation as H}from"react-i18next";import{LabelBeeContext as J}from"../../store/ctx.js";var K=Object.defineProperty,Q=Object.defineProperties,W=Object.getOwnPropertyDescriptors,E=Object.getOwnPropertySymbols,X=Object.prototype.hasOwnProperty,Y=Object.prototype.propertyIsEnumerable,x=(e,o,i)=>o in e?K(e,o,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[o]=i,$=(e,o)=>{for(var i in o||(o={}))X.call(o,i)&&x(e,i,o[i]);if(E)for(var i of E(o))Y.call(o,i)&&x(e,i,o[i]);return e},ee=(e,o)=>Q(e,W(o));const te="LABELBEE-POINTCLOUD",P=t.createContext({isActive:!1,setTarget3DView:()=>{},reset3DView:()=>{}}),c=({perspectiveView:e})=>{const{isActive:o,setTarget3DView:i}=f(P),s=w=>y({[u("point-cloud-3d-view",w)]:!0,active:o});return t.createElement("span",{onClick:()=>{i(_[e])},className:s(e.toLocaleLowerCase())})},oe=()=>{const{reset3DView:e}=f(P);return t.createElement("div",{className:u("point-cloud-3d-sidebar")},t.createElement(c,{perspectiveView:"Top"}),t.createElement(c,{perspectiveView:"Front"}),t.createElement(c,{perspectiveView:"Left"}),t.createElement(c,{perspectiveView:"Back"}),t.createElement(c,{perspectiveView:"Right"}),t.createElement(c,{perspectiveView:"LFT"}),t.createElement(c,{perspectiveView:"RBT"}),t.createElement("span",{onClick:()=>{e()},className:u("point-cloud-3d-view","reset")}))},ie=({currentData:e,config:o})=>{var i;const s=f(k),[w,b]=T(!0),d=N(null),{initPointCloud3d:g}=G(),l=q(d),{t:h}=H();C(()=>{!s.mainViewInstance||g==null||g(l)},[l]);const{selectedBox:m}=U(),V=n=>{var r;const a=m==null?void 0:m.info;a&&((r=s.mainViewInstance)==null||r.updateCameraByBox(a,n))},I=()=>{var n;(n=s.mainViewInstance)==null||n.resetCamera()};C(()=>{var n;if(d.current&&(e==null?void 0:e.url)){let r=s.mainViewInstance;if(!r&&l.width){const a={left:-l.width/2,right:l.width/2,top:l.height/2,bottom:-l.height/2,near:100,far:-100};r=new B({container:d.current,isOrthographicCamera:!0,orthographicParams:a,config:o}),s.setMainViewInstance(r)}if(e.result){const a=D.getBoxParamsFromResultList(e.result);a.forEach(p=>{var v;const S=(v=L.getColorFromConfig({attribute:p.attribute},ee($({},o),{attributeConfigurable:!0}),{}))==null?void 0:v.hex;r==null||r.generateBox(p,S)}),s.setPointCloudResult(a),s.setPointCloudValid((n=M(e.result))==null?void 0:n.valid)}}},[e,l]),C(()=>{var n,r,a,p;if(m){V(_.Top);const v=(a=(r=(n=s.topViewInstance)==null?void 0:n.pointCloudInstance)==null?void 0:r.camera.zoom)!=null?a:1;(p=s.mainViewInstance)==null||p.updateCameraZoom(v)}},[m]);const O=R(()=>({reset3DView:I,setTarget3DView:V,isActive:!!m}),[m]),j=t.createElement("div",null,t.createElement("span",{style:{marginRight:8}},h("ShowArrows")),t.createElement(Z,{size:"small",checked:w,onChange:n=>{var r;b(n),(r=s.mainViewInstance)==null||r.setShowDirection(n)}}));return t.createElement(z,{className:u("point-cloud-3d-container"),title:h("3DView"),toolbar:j,style:{height:e.mappingImgList&&((i=e.mappingImgList)==null?void 0:i.length)>0?"55%":"100%"}},t.createElement("div",{className:u("point-cloud-3d-content")},t.createElement(P.Provider,{value:O},t.createElement(oe,null)),t.createElement("div",{className:u("point-cloud-3d-view"),id:te,ref:d})))};var re=F(A,null,null,{context:J})(ie);export{re as default};
1
+ import{getClassName as c}from"../../utils/dom.js";import{PointCloud as y}from"@labelbee/lb-annotation";import{PointCloudUtils as B,toolStyleConverter as D,EPerspectiveView as _}from"@labelbee/lb-utils";import L from"classnames";import o,{useContext as f,useState as N,useRef as R,useEffect as C,useMemo as k}from"react";import{PointCloudContainer as z}from"./PointCloudLayout.js";import{PointCloudContext as A}from"./PointCloudContext.js";import{a2MapStateToProps as F}from"../../store/annotation/map.js";import{connect as M}from"react-redux";import{jsonParser as U}from"../../utils/index.js";import{useSingleBox as Z}from"./hooks/useSingleBox.js";import{Switch as q}from"antd";import G from"../../hooks/useSize.js";import{usePointCloudViews as H}from"./hooks/usePointCloudViews.js";import{useTranslation as J}from"react-i18next";import{LabelBeeContext as K}from"../../store/ctx.js";var Q=Object.defineProperty,W=Object.defineProperties,X=Object.getOwnPropertyDescriptors,E=Object.getOwnPropertySymbols,Y=Object.prototype.hasOwnProperty,$=Object.prototype.propertyIsEnumerable,x=(e,t,r)=>t in e?Q(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ee=(e,t)=>{for(var r in t||(t={}))Y.call(t,r)&&x(e,r,t[r]);if(E)for(var r of E(t))$.call(t,r)&&x(e,r,t[r]);return e},te=(e,t)=>W(e,X(t));const oe="LABELBEE-POINTCLOUD",P=o.createContext({isActive:!1,setTarget3DView:()=>{},reset3DView:()=>{},followTopView:()=>{}}),m=({perspectiveView:e})=>{const{isActive:t,setTarget3DView:r}=f(P),a=v=>L({[c("point-cloud-3d-view",v)]:!0,active:t});return o.createElement("span",{onClick:()=>{r(_[e])},className:a(e.toLocaleLowerCase())})},ie=()=>{const{reset3DView:e,followTopView:t}=f(P);return o.createElement("div",{className:c("point-cloud-3d-sidebar")},o.createElement(m,{perspectiveView:"Top"}),o.createElement(m,{perspectiveView:"Front"}),o.createElement(m,{perspectiveView:"Left"}),o.createElement(m,{perspectiveView:"Back"}),o.createElement(m,{perspectiveView:"Right"}),o.createElement(m,{perspectiveView:"LFT"}),o.createElement(m,{perspectiveView:"RBT"}),o.createElement("span",{onClick:()=>{t()},className:c("point-cloud-3d-view","followTop")}),o.createElement("span",{onClick:()=>{e()},className:c("point-cloud-3d-view","reset")}))},ne=({currentData:e,config:t})=>{var r;const a=f(A),[v,b]=N(!0),d=R(null),{initPointCloud3d:V}=H(),s=G(d),{t:g}=J();C(()=>{!a.mainViewInstance||V==null||V(s)},[s]);const{selectedBox:u}=Z(),h=n=>{var i;const l=u==null?void 0:u.info;l&&((i=a.mainViewInstance)==null||i.updateCameraByBox(l,n))},I=()=>{var n;(n=a.mainViewInstance)==null||n.resetCamera()},T=()=>{var n,i;const l=(n=a.topViewInstance)==null?void 0:n.pointCloudInstance.camera;l&&((i=a.mainViewInstance)==null||i.applyCameraTarget(l))};C(()=>{var n;if(d.current&&(e==null?void 0:e.url)){let i=a.mainViewInstance;if(!i&&s.width){const l={left:-s.width/2,right:s.width/2,top:s.height/2,bottom:-s.height/2,near:100,far:-100};i=new y({container:d.current,isOrthographicCamera:!0,orthographicParams:l,config:t}),a.setMainViewInstance(i)}if(e.result){const l=B.getBoxParamsFromResultList(e.result);l.forEach(p=>{var w;const S=(w=D.getColorFromConfig({attribute:p.attribute},te(ee({},t),{attributeConfigurable:!0}),{}))==null?void 0:w.hex;i==null||i.generateBox(p,S)}),a.setPointCloudResult(l),a.setPointCloudValid((n=U(e.result))==null?void 0:n.valid)}}},[e,s]),C(()=>{var n,i,l,p;if(u){h(_.Top);const w=(l=(i=(n=a.topViewInstance)==null?void 0:n.pointCloudInstance)==null?void 0:i.camera.zoom)!=null?l:1;(p=a.mainViewInstance)==null||p.updateCameraZoom(w)}},[u]);const O=k(()=>({reset3DView:I,setTarget3DView:h,isActive:!!u,followTopView:T}),[u]),j=o.createElement("div",null,o.createElement("span",{style:{marginRight:8}},g("ShowArrows")),o.createElement(q,{size:"small",checked:v,onChange:n=>{var i;b(n),(i=a.mainViewInstance)==null||i.setShowDirection(n)}}));return o.createElement(z,{className:c("point-cloud-3d-container"),title:g("3DView"),toolbar:j,style:{height:e.mappingImgList&&((r=e.mappingImgList)==null?void 0:r.length)>0?"55%":"100%"}},o.createElement("div",{className:c("point-cloud-3d-content")},o.createElement(P.Provider,{value:O},o.createElement(ie,null)),o.createElement("div",{className:c("point-cloud-3d-view"),id:oe,ref:d})))};var re=M(F,null,null,{context:K})(ne);export{re as default};
@@ -1 +1 @@
1
- {"version":3,"file":"PointCloud3DView.js","sources":["../../../src/components/pointCloudView/PointCloud3DView.tsx"],"sourcesContent":["/*\n * @Author: Laoluo luozefeng@sensetime.com\n * @Date: 2022-06-13 19:31:36\n * @LastEditors: Laoluo luozefeng@sensetime.com\n * @LastEditTime: 2022-06-27 19:43:25\n */\n\nimport { getClassName } from '@/utils/dom';\nimport { PointCloud } from '@labelbee/lb-annotation';\nimport {\n EPerspectiveView,\n IPointCloudBox,\n PointCloudUtils,\n toolStyleConverter,\n} from '@labelbee/lb-utils';\nimport classNames from 'classnames';\nimport React, { useContext, useEffect, useMemo, useRef, useState } from 'react';\nimport { PointCloudContainer } from './PointCloudLayout';\nimport { PointCloudContext } from './PointCloudContext';\nimport { a2MapStateToProps, IA2MapStateProps } from '@/store/annotation/map';\nimport { connect } from 'react-redux';\nimport { jsonParser } from '@/utils';\nimport { useSingleBox } from './hooks/useSingleBox';\nimport { Switch } from 'antd';\nimport useSize from '@/hooks/useSize';\nimport { usePointCloudViews } from './hooks/usePointCloudViews';\nimport { useTranslation } from 'react-i18next';\nimport { LabelBeeContext } from '@/store/ctx';\n\nconst pointCloudID = 'LABELBEE-POINTCLOUD';\nconst PointCloud3DContext = React.createContext<{\n isActive: boolean;\n setTarget3DView: (perspectiveView: EPerspectiveView) => void;\n reset3DView: () => void;\n}>({\n isActive: false,\n setTarget3DView: () => {},\n reset3DView: () => {},\n});\n\nconst PointCloudViewIcon = ({\n perspectiveView,\n}: {\n perspectiveView: keyof typeof EPerspectiveView;\n}) => {\n const { isActive, setTarget3DView } = useContext(PointCloud3DContext);\n\n const getTarget3DViewClassName = (position: string) => {\n return classNames({\n [getClassName('point-cloud-3d-view', position)]: true,\n active: isActive,\n });\n };\n\n return (\n <span\n onClick={() => {\n setTarget3DView(EPerspectiveView[perspectiveView]);\n }}\n className={getTarget3DViewClassName(perspectiveView.toLocaleLowerCase())}\n />\n );\n};\n\nconst PointCloud3DSideBar = () => {\n const { reset3DView } = useContext(PointCloud3DContext);\n return (\n <div className={getClassName('point-cloud-3d-sidebar')}>\n <PointCloudViewIcon perspectiveView='Top' />\n <PointCloudViewIcon perspectiveView='Front' />\n <PointCloudViewIcon perspectiveView='Left' />\n <PointCloudViewIcon perspectiveView='Back' />\n <PointCloudViewIcon perspectiveView='Right' />\n <PointCloudViewIcon perspectiveView='LFT' />\n <PointCloudViewIcon perspectiveView='RBT' />\n <span\n onClick={() => {\n reset3DView();\n }}\n className={getClassName('point-cloud-3d-view', 'reset')}\n />\n </div>\n );\n};\n\nconst PointCloud3D: React.FC<IA2MapStateProps> = ({ currentData, config }) => {\n const ptCtx = useContext(PointCloudContext);\n const [showDirection, setShowDirection] = useState(true);\n const ref = useRef<HTMLDivElement>(null);\n const { initPointCloud3d } = usePointCloudViews();\n const size = useSize(ref);\n const { t } = useTranslation();\n\n useEffect(() => {\n if (!ptCtx.mainViewInstance) {\n return;\n }\n initPointCloud3d?.(size);\n }, [size]);\n const { selectedBox } = useSingleBox();\n\n const setTarget3DView = (perspectiveView: EPerspectiveView) => {\n const box = selectedBox?.info;\n\n if (box) {\n ptCtx.mainViewInstance?.updateCameraByBox(box, perspectiveView);\n }\n };\n\n const reset3DView = () => {\n ptCtx.mainViewInstance?.resetCamera();\n };\n\n /**\n * Listen for data changes.\n */\n useEffect(() => {\n if (ref.current && currentData?.url) {\n let pointCloud = ptCtx.mainViewInstance;\n if (!pointCloud && size.width) {\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 // Need to be showed\n pointCloud = new PointCloud({\n container: ref.current,\n isOrthographicCamera: true,\n orthographicParams,\n config,\n });\n ptCtx.setMainViewInstance(pointCloud);\n }\n\n if (currentData.result) {\n const boxParamsList = PointCloudUtils.getBoxParamsFromResultList(currentData.result);\n\n // Add Init Box\n boxParamsList.forEach((v: IPointCloudBox) => {\n const hex = toolStyleConverter.getColorFromConfig(\n { attribute: v.attribute },\n { ...config, attributeConfigurable: true },\n {},\n )?.hex;\n\n pointCloud?.generateBox(v, hex);\n });\n\n ptCtx.setPointCloudResult(boxParamsList);\n ptCtx.setPointCloudValid(jsonParser(currentData.result)?.valid);\n }\n }\n }, [currentData, size]);\n\n /**\n * Observe selectedID and reset camera to target top-view\n */\n useEffect(() => {\n if (selectedBox) {\n setTarget3DView(EPerspectiveView.Top);\n\n\n /**\n * 3DView's zoom synchronizes with topView' zoom. \n */\n const zoom = ptCtx.topViewInstance?.pointCloudInstance?.camera.zoom ?? 1;\n ptCtx.mainViewInstance?.updateCameraZoom(zoom);\n }\n }, [selectedBox]);\n\n const ptCloud3DCtx = useMemo(() => {\n return { reset3DView, setTarget3DView, isActive: !!selectedBox };\n }, [selectedBox]);\n\n const PointCloud3DTitle = (\n <div>\n <span style={{ marginRight: 8 }}>{t('ShowArrows')}</span>\n <Switch\n size='small'\n checked={showDirection}\n onChange={(showDirection) => {\n setShowDirection(showDirection);\n ptCtx.mainViewInstance?.setShowDirection(showDirection);\n }}\n />\n </div>\n );\n\n return (\n <PointCloudContainer\n className={getClassName('point-cloud-3d-container')}\n title={t('3DView')}\n toolbar={PointCloud3DTitle}\n style={{\n height:\n currentData.mappingImgList && currentData.mappingImgList?.length > 0 ? '55%' : '100%',\n }}\n >\n <div className={getClassName('point-cloud-3d-content')}>\n <PointCloud3DContext.Provider value={ptCloud3DCtx}>\n <PointCloud3DSideBar />\n </PointCloud3DContext.Provider>\n <div className={getClassName('point-cloud-3d-view')} id={pointCloudID} ref={ref} />\n </div>\n </PointCloudContainer>\n );\n};\n\nexport default connect(a2MapStateToProps, null, null, { context: LabelBeeContext })(PointCloud3D);\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAM,YAAe,GAAA,qBAAA,CAAA;AACrB,MAAM,mBAAA,GAAsB,MAAM,aAI/B,CAAA;AAAA,EACD,QAAU,EAAA,KAAA;AAAA,EACV,iBAAiB,MAAM;AAAA,GAAA;AAAA,EACvB,aAAa,MAAM;AAAA,GAAA;AAAA,CAAA,CAAA,CAAA;AAGrB,MAAM,qBAAqB,CAAC;AAAA,EAC1B,eAAA;AAAA,CAGI,KAAA;AACJ,EAAM,MAAA,CAAE,QAAU,EAAA,eAAA,CAAA,GAAoB,UAAW,CAAA,mBAAA,CAAA,CAAA;AAEjD,E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,CAAA;AAAA,GAC3B,kBAAA,KAAA,CAAA,aAAA,CAAC,oBAAoB,QAArB,EAAA;AAAA,IAA8B,KAAO,EAAA,YAAA;AAAA,GAAA,kBAClC,KAAA,CAAA,aAAA,CAAA,mBAAA,EAAD,IAEF,CAAA,CAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,KAAD,EAAA;AAAA,IAAK,WAAW,YAAa,CAAA,qBAAA,CAAA;AAAA,IAAwB,EAAI,EAAA,YAAA;AAAA,IAAc,GAAA;AAAA,GAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CAAA;AAM/E,uBAAe,QAAQ,iBAAmB,EAAA,IAAA,EAAM,IAAM,EAAA,CAAE,SAAS,eAAmB,CAAA,CAAA,CAAA,YAAA,CAAA;;;;"}
1
+ {"version":3,"file":"PointCloud3DView.js","sources":["../../../src/components/pointCloudView/PointCloud3DView.tsx"],"sourcesContent":["/*\n * @Author: Laoluo luozefeng@sensetime.com\n * @Date: 2022-06-13 19:31:36\n * @LastEditors: Laoluo luozefeng@sensetime.com\n * @LastEditTime: 2022-06-27 19:43:25\n */\n\nimport { getClassName } from '@/utils/dom';\nimport { PointCloud } from '@labelbee/lb-annotation';\nimport {\n EPerspectiveView,\n IPointCloudBox,\n PointCloudUtils,\n toolStyleConverter,\n} from '@labelbee/lb-utils';\nimport classNames from 'classnames';\nimport React, { useContext, useEffect, useMemo, useRef, useState } from 'react';\nimport { PointCloudContainer } from './PointCloudLayout';\nimport { PointCloudContext } from './PointCloudContext';\nimport { a2MapStateToProps, IA2MapStateProps } from '@/store/annotation/map';\nimport { connect } from 'react-redux';\nimport { jsonParser } from '@/utils';\nimport { useSingleBox } from './hooks/useSingleBox';\nimport { Switch } from 'antd';\nimport useSize from '@/hooks/useSize';\nimport { usePointCloudViews } from './hooks/usePointCloudViews';\nimport { useTranslation } from 'react-i18next';\nimport { LabelBeeContext } from '@/store/ctx';\n\nconst pointCloudID = 'LABELBEE-POINTCLOUD';\nconst PointCloud3DContext = React.createContext<{\n isActive: boolean;\n setTarget3DView: (perspectiveView: EPerspectiveView) => void;\n reset3DView: () => void;\n followTopView: () => void;\n}>({\n isActive: false,\n setTarget3DView: () => {},\n reset3DView: () => {},\n followTopView: () => {},\n});\n\nconst PointCloudViewIcon = ({\n perspectiveView,\n}: {\n perspectiveView: keyof typeof EPerspectiveView;\n}) => {\n const { isActive, setTarget3DView } = useContext(PointCloud3DContext);\n\n const getTarget3DViewClassName = (position: string) => {\n return classNames({\n [getClassName('point-cloud-3d-view', position)]: true,\n active: isActive,\n });\n };\n\n return (\n <span\n onClick={() => {\n setTarget3DView(EPerspectiveView[perspectiveView]);\n }}\n className={getTarget3DViewClassName(perspectiveView.toLocaleLowerCase())}\n />\n );\n};\n\nconst PointCloud3DSideBar = () => {\n const { reset3DView, followTopView } = useContext(PointCloud3DContext);\n return (\n <div className={getClassName('point-cloud-3d-sidebar')}>\n <PointCloudViewIcon perspectiveView='Top' />\n <PointCloudViewIcon perspectiveView='Front' />\n <PointCloudViewIcon perspectiveView='Left' />\n <PointCloudViewIcon perspectiveView='Back' />\n <PointCloudViewIcon perspectiveView='Right' />\n <PointCloudViewIcon perspectiveView='LFT' />\n <PointCloudViewIcon perspectiveView='RBT' />\n\n <span\n onClick={() => {\n followTopView();\n }}\n className={getClassName('point-cloud-3d-view', 'followTop')}\n />\n\n <span\n onClick={() => {\n reset3DView();\n }}\n className={getClassName('point-cloud-3d-view', 'reset')}\n />\n </div>\n );\n};\n\nconst PointCloud3D: React.FC<IA2MapStateProps> = ({ currentData, config }) => {\n const ptCtx = useContext(PointCloudContext);\n const [showDirection, setShowDirection] = useState(true);\n const ref = useRef<HTMLDivElement>(null);\n const { initPointCloud3d } = usePointCloudViews();\n const size = useSize(ref);\n const { t } = useTranslation();\n\n useEffect(() => {\n if (!ptCtx.mainViewInstance) {\n return;\n }\n initPointCloud3d?.(size);\n }, [size]);\n const { selectedBox } = useSingleBox();\n\n const setTarget3DView = (perspectiveView: EPerspectiveView) => {\n const box = selectedBox?.info;\n\n if (box) {\n ptCtx.mainViewInstance?.updateCameraByBox(box, perspectiveView);\n }\n };\n\n const reset3DView = () => {\n ptCtx.mainViewInstance?.resetCamera();\n };\n\n const followTopView = () => {\n const topViewCamera = ptCtx.topViewInstance?.pointCloudInstance.camera;\n if (topViewCamera) {\n ptCtx.mainViewInstance?.applyCameraTarget(topViewCamera);\n }\n };\n\n /**\n * Listen for data changes.\n */\n useEffect(() => {\n if (ref.current && currentData?.url) {\n let pointCloud = ptCtx.mainViewInstance;\n if (!pointCloud && size.width) {\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 // Need to be showed\n pointCloud = new PointCloud({\n container: ref.current,\n isOrthographicCamera: true,\n orthographicParams,\n config,\n });\n ptCtx.setMainViewInstance(pointCloud);\n }\n\n if (currentData.result) {\n const boxParamsList = PointCloudUtils.getBoxParamsFromResultList(currentData.result);\n\n // Add Init Box\n boxParamsList.forEach((v: IPointCloudBox) => {\n const hex = toolStyleConverter.getColorFromConfig(\n { attribute: v.attribute },\n { ...config, attributeConfigurable: true },\n {},\n )?.hex;\n\n pointCloud?.generateBox(v, hex);\n });\n\n ptCtx.setPointCloudResult(boxParamsList);\n ptCtx.setPointCloudValid(jsonParser(currentData.result)?.valid);\n }\n }\n }, [currentData, size]);\n\n /**\n * Observe selectedID and reset camera to target top-view\n */\n useEffect(() => {\n if (selectedBox) {\n setTarget3DView(EPerspectiveView.Top);\n\n /**\n * 3DView's zoom synchronizes with topView' zoom.\n */\n const zoom = ptCtx.topViewInstance?.pointCloudInstance?.camera.zoom ?? 1;\n ptCtx.mainViewInstance?.updateCameraZoom(zoom);\n }\n }, [selectedBox]);\n\n const ptCloud3DCtx = useMemo(() => {\n return { reset3DView, setTarget3DView, isActive: !!selectedBox, followTopView };\n }, [selectedBox]);\n\n const PointCloud3DTitle = (\n <div>\n <span style={{ marginRight: 8 }}>{t('ShowArrows')}</span>\n <Switch\n size='small'\n checked={showDirection}\n onChange={(showDirection) => {\n setShowDirection(showDirection);\n ptCtx.mainViewInstance?.setShowDirection(showDirection);\n }}\n />\n </div>\n );\n\n return (\n <PointCloudContainer\n className={getClassName('point-cloud-3d-container')}\n title={t('3DView')}\n toolbar={PointCloud3DTitle}\n style={{\n height:\n currentData.mappingImgList && currentData.mappingImgList?.length > 0 ? '55%' : '100%',\n }}\n >\n <div className={getClassName('point-cloud-3d-content')}>\n <PointCloud3DContext.Provider value={ptCloud3DCtx}>\n <PointCloud3DSideBar />\n </PointCloud3DContext.Provider>\n <div className={getClassName('point-cloud-3d-view')} id={pointCloudID} ref={ref} />\n </div>\n </PointCloudContainer>\n );\n};\n\nexport default connect(a2MapStateToProps, null, null, { context: LabelBeeContext })(PointCloud3D);\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAM,YAAe,GAAA,qBAAA,CAAA;AACrB,MAAM,mBAAA,GAAsB,MAAM,aAK/B,CAAA;AAAA,EACD,QAAU,EAAA,KAAA;AAAA,EACV,iBAAiB,MAAM;AAAA,GAAA;AAAA,EACvB,aAAa,MAAM;AAAA,GAAA;AAAA,EACnB,eAAe,MAAM;AAAA,GAAA;AAAA,CAAA,CAAA,CAAA;AAGvB,MAAM,qBAAqB,CAAC;AAAA,EAC1B,eAAA;AAAA,CAGI,KAAA;AACJ,EAAM,MAAA,CAAE,QAAU,EAAA,eAAA,CAAA,GAAoB,UAAW,CAAA,mBAAA,CAAA,CAAA;AAEjD,EAAM,MAAA,wBAAA,GAA2B,CAAC,QAAqB,KAAA;AACrD,IAAA,OAAO,UAAW,CAAA;AAAA,MACf,CAAA,YAAA,CAAa,uBAAuB,QAAY,CAAA,GAAA,IAAA;AAAA,MACjD,MAAQ,EAAA,QAAA;AAAA,KAAA,CAAA,CAAA;AAAA,GAAA,CAAA;AAIZ,EAAA,2CACG,MAAD,EAAA;AAAA,IACE,SAAS,M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,CAAA,QAAA,CAAA;AAAA,IACT,OAAS,EAAA,iBAAA;AAAA,IACT,KAAO,EAAA;AAAA,MACL,MAAA,EACE,YAAY,cAAkB,IAAA,CAAA,CAAA,EAAA,GAAA,WAAA,CAAY,mBAAZ,IAA4B,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,MAAA,IAAS,IAAI,KAAQ,GAAA,MAAA;AAAA,KAAA;AAAA,GAAA,sCAGlF,KAAD,EAAA;AAAA,IAAK,WAAW,YAAa,CAAA,wBAAA,CAAA;AAAA,GAC3B,kBAAA,KAAA,CAAA,aAAA,CAAC,oBAAoB,QAArB,EAAA;AAAA,IAA8B,KAAO,EAAA,YAAA;AAAA,GAAA,kBAClC,KAAA,CAAA,aAAA,CAAA,mBAAA,EAAD,IAEF,CAAA,CAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,KAAD,EAAA;AAAA,IAAK,WAAW,YAAa,CAAA,qBAAA,CAAA;AAAA,IAAwB,EAAI,EAAA,YAAA;AAAA,IAAc,GAAA;AAAA,GAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CAAA;AAM/E,uBAAe,QAAQ,iBAAmB,EAAA,IAAA,EAAM,IAAM,EAAA,CAAE,SAAS,eAAmB,CAAA,CAAA,CAAA,YAAA,CAAA;;;;"}
@@ -1 +1 @@
1
- import{PointCloudAnnotation as P}from"@labelbee/lb-annotation";import{getClassName as p}from"../../utils/dom.js";import{PointCloudContainer as h}from"./PointCloudLayout.js";import d,{useRef as g,useEffect as C}from"react";import{PointCloudContext as v}from"./PointCloudContext.js";import{useSingleBox as B}from"./hooks/useSingleBox.js";import{EPerspectiveView as y}from"@labelbee/lb-utils";import{SizeInfoForView as V}from"./PointCloudInfos.js";import{connect as b}from"react-redux";import{a2MapStateToProps as j}from"../../store/annotation/map.js";import{usePointCloudViews as k}from"./hooks/usePointCloudViews.js";import E from"../../hooks/useSize.js";import S from"./components/EmptyPage/index.js";import{useTranslation as I}from"react-i18next";import{LabelBeeContext as O}from"../../store/ctx.js";const M=(c,i,r=1)=>{const{width:t,height:e}=i,o={x:c.x+t*r/2,y:c.y+e*r/2},l={x:i.width/2,y:i.height/2};return{offsetX:(l.x-o.x)/r,offsetY:-(l.y-o.y)/r}},x=(c,i,r,t,e)=>{const{offsetX:o,offsetY:l}=M(c,r,i);if(e.camera.zoom=i,c){const f=Math.cos(t.rotation),m=Math.sin(t.rotation),n=o*f,u=o*m,{x:s,y:a,z:w}=e.initCameraPosition;e.camera.position.set(s+u,a-n,w+l)}e.camera.updateProjectionMatrix(),e.render()},N=({currentData:c,config:i,checkMode:r})=>{const t=d.useContext(v),e=g(null),o=E(e),{selectedBox:l}=B(),{t:f}=I(),{backViewUpdateBox:m}=k();return C(()=>{if(e.current){const n={width:e.current.clientWidth,height:e.current.clientHeight},u=new P({container:e.current,size:n,polygonOperationProps:{showDirectionLine:!1,forbidAddNew:!0},config:i,checkMode:r});t.setBackViewInstance(u)}},[]),C(()=>{if(!o||!t.backViewInstance)return;const{pointCloud2dOperation:n,pointCloudInstance:u}=t.backViewInstance;n.singleOn("renderZoom",(s,a)=>{!t.selectedPointCloudBox||x(a,s,o,t.selectedPointCloudBox,u)}),n.singleOn("dragMove",({currentPos:s,zoom:a})=>{!t.selectedPointCloudBox||x(s,a,o,t.selectedPointCloudBox,u)}),n.singleOn("updatePolygonByDrag",({newPolygon:s,originPolygon:a})=>{m==null||m(s,a)})},[t,o]),C(()=>{var n;(n=t==null?void 0:t.backViewInstance)==null||n.initSize(o)},[o]),d.createElement(h,{className:p("point-cloud-container","back-view"),title:f("BackView"),toolbar:d.createElement(V,{perspectiveView:y.Back})},d.createElement("div",{className:p("point-cloud-container","bottom-view-content")},d.createElement("div",{className:p("point-cloud-container","core-instance"),ref:e}),!l&&d.createElement(S,null)))};var X=b(j,null,null,{context:O})(N);export{X as default};
1
+ import{PointCloudAnnotation as T,MathUtils as u,getCuboidFromPointCloudBox as X}from"@labelbee/lb-annotation";import{getClassName as y}from"../../utils/dom.js";import{PointCloudContainer as A}from"./PointCloudLayout.js";import m,{useRef as W,useEffect as V}from"react";import{PointCloudContext as H}from"./PointCloudContext.js";import{EPerspectiveView as U}from"@labelbee/lb-utils";import{useSingleBox as Y}from"./hooks/useSingleBox.js";import{SizeInfoForView as F}from"./PointCloudInfos.js";import{connect as R}from"react-redux";import{a2MapStateToProps as Z}from"../../store/annotation/map.js";import{usePointCloudViews as q,synchronizeTopView as G,synchronizeSideView as J}from"./hooks/usePointCloudViews.js";import K from"../../hooks/useSize.js";import Q from"./components/EmptyPage/index.js";import{useTranslation as $}from"react-i18next";import{LabelBeeContext as ee}from"../../store/ctx.js";var te=Object.defineProperty,oe=Object.defineProperties,ne=Object.getOwnPropertyDescriptors,O=Object.getOwnPropertySymbols,ie=Object.prototype.hasOwnProperty,re=Object.prototype.propertyIsEnumerable,_=(n,t,o)=>t in n?te(n,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[t]=o,se=(n,t)=>{for(var o in t||(t={}))ie.call(t,o)&&_(n,o,t[o]);if(O)for(var o of O(t))re.call(t,o)&&_(n,o,t[o]);return n},ae=(n,t)=>oe(n,ne(t));const ce=(n,t,o=1)=>{const{width:e,height:i}=t,s={x:n.x+e*o/2,y:n.y+i*o/2},d={x:t.width/2,y:t.height/2};return{offsetX:(d.x-s.x)/o,offsetY:-(d.y-s.y)/o}},j=(n,t,o,e,i)=>{const{offsetX:s,offsetY:d}=ce(n,o,t);if(i.camera.zoom=t,n){const P=Math.cos(e.rotation),g=Math.sin(e.rotation),w=s*P,h=s*g,{x:r,y:p,z:c}=i.initCameraPosition;i.camera.position.set(r+h,p-w,c+d)}i.camera.updateProjectionMatrix(),i.render()},le=({currentData:n,config:t,checkMode:o})=>{const e=m.useContext(H),i=W(null),s=K(i),{selectedBox:d,updateSelectedBox:P}=Y(),{t:g}=$(),{backViewUpdateBox:w}=q(),h=(r,p)=>{if(!e.selectedPointCloudBox||!e.mainViewInstance||!n.url||!e.backViewInstance)return;const{pointCloudInstance:c}=e.backViewInstance,[l,f,v]=r.pointList,[B,b,I]=p.pointList,x=u.getLineCenterPoint([l,v]),C=u.getLineCenterPoint([B,I]),L={x:{x:x.x-C.x,y:x.y-C.y}.x,y:0,z:x.y-C.y},k=u.getLineLength(l,f),S=u.getLineLength(B,b),E=k-S,z=u.getLineLength(f,v),N=u.getLineLength(b,I),D=z-N;let{newBoxParams:a}=c.getNewBoxByBackUpdate(L,D,E,e.selectedPointCloudBox);if(e.mainViewInstance){const{count:M}=e.mainViewInstance.getSensesPointZAxisInPolygon(X(a).polygonPointList,[a.center.z-a.depth/2,a.center.z+a.depth/2]);a=ae(se({},a),{count:M})}G(a,r,e.topViewInstance,e.mainViewInstance),J(a,r,e.sideViewInstance,n.url),e.mainViewInstance.highlightOriginPointCloud([a]),P(a)};return V(()=>{if(i.current){const r={width:i.current.clientWidth,height:i.current.clientHeight},p=new T({container:i.current,size:r,polygonOperationProps:{showDirectionLine:!1,forbidAddNew:!0},config:t,checkMode:o});e.setBackViewInstance(p)}},[]),V(()=>{if(!s||!e.backViewInstance)return;const{pointCloud2dOperation:r,pointCloudInstance:p}=e.backViewInstance;r.singleOn("renderZoom",(c,l)=>{!e.selectedPointCloudBox||j(l,c,s,e.selectedPointCloudBox,p)}),r.singleOn("dragMove",({currentPos:c,zoom:l})=>{!e.selectedPointCloudBox||j(c,l,s,e.selectedPointCloudBox,p)}),r.singleOn("updatePolygonByDrag",c=>{if(e.selectedIDs.length===1&&c.length===1){const{newPolygon:l,originPolygon:f}=c[0];l&&f&&(h(l,f),w(l,f))}})},[e,s]),V(()=>{var r;(r=e==null?void 0:e.backViewInstance)==null||r.initSize(s)},[s]),m.createElement(A,{className:y("point-cloud-container","back-view"),title:g("BackView"),toolbar:m.createElement(F,{perspectiveView:U.Back})},m.createElement("div",{className:y("point-cloud-container","bottom-view-content")},m.createElement("div",{className:y("point-cloud-container","core-instance"),ref:i}),!d&&m.createElement(Q,null)))};var pe=R(Z,null,null,{context:ee})(le);export{pe as default};
@@ -1 +1 @@
1
- {"version":3,"file":"PointCloudBackView.js","sources":["../../../src/components/pointCloudView/PointCloudBackView.tsx"],"sourcesContent":["/*\n * @Author: Laoluo luozefeng@sensetime.com\n * @Date: 2022-06-22 11:08:31\n * @LastEditors: Laoluo luozefeng@sensetime.com\n * @LastEditTime: 2022-07-08 11:08:02\n */\nimport {\n PointCloud,\n PointCloudAnnotation,\n} from '@labelbee/lb-annotation';\nimport { getClassName } from '@/utils/dom';\nimport { PointCloudContainer } from './PointCloudLayout';\nimport React, { useEffect, useRef } from 'react';\nimport { PointCloudContext } from './PointCloudContext';\nimport { useSingleBox } from './hooks/useSingleBox';\nimport { EPerspectiveView, IPointCloudBox } from '@labelbee/lb-utils';\nimport { SizeInfoForView } from './PointCloudInfos';\nimport { connect } from 'react-redux';\nimport { a2MapStateToProps, IA2MapStateProps } from '@/store/annotation/map';\nimport { usePointCloudViews } from './hooks/usePointCloudViews';\nimport useSize from '@/hooks/useSize';\nimport EmptyPage from './components/EmptyPage';\nimport { useTranslation } from 'react-i18next';\nimport { LabelBeeContext } from '@/store/ctx';\n\n/**\n * 统一一下,将其拓展为 二维转换为 三维坐标的转换\n * Get the offset from canvas2d-coordinate to world coordinate\n * @param currentPos\n * @param size\n * @param zoom\n * @returns\n */\nconst TransferCanvas2WorldOffset = (\n currentPos: { x: number; y: number },\n size: { width: number; height: number },\n zoom = 1,\n) => {\n const { width: w, height: h } = size;\n\n const canvasCenterPoint = {\n x: currentPos.x + (w * zoom) / 2,\n y: currentPos.y + (h * zoom) / 2,\n };\n\n const worldCenterPoint = {\n x: size.width / 2,\n y: size.height / 2,\n };\n\n return {\n offsetX: (worldCenterPoint.x - canvasCenterPoint.x) / zoom,\n offsetY: -(worldCenterPoint.y - canvasCenterPoint.y) / zoom,\n };\n};\nconst updateBackViewByCanvas2D = (\n currentPos: { x: number; y: number },\n zoom: number,\n size: { width: number; height: number },\n selectedPointCloudBox: IPointCloudBox,\n backPointCloud: PointCloud,\n) => {\n const { offsetX, offsetY } = TransferCanvas2WorldOffset(currentPos, size, zoom);\n backPointCloud.camera.zoom = zoom;\n if (currentPos) {\n const cos = Math.cos(selectedPointCloudBox.rotation);\n const sin = Math.sin(selectedPointCloudBox.rotation);\n const offsetXX = offsetX * cos;\n const offsetXY = offsetX * sin;\n const { x, y, z } = backPointCloud.initCameraPosition;\n backPointCloud.camera.position.set(x + offsetXY, y - offsetXX, z + offsetY);\n }\n backPointCloud.camera.updateProjectionMatrix();\n backPointCloud.render();\n};\n\ninterface IProps {\n checkMode?: boolean\n}\n\nconst PointCloudSideView = ({ currentData, config, checkMode }: IA2MapStateProps & IProps) => {\n const ptCtx = React.useContext(PointCloudContext);\n const ref = useRef<HTMLDivElement>(null);\n const size = useSize(ref);\n const { selectedBox } = useSingleBox();\n const { t } = useTranslation();\n const { backViewUpdateBox } = usePointCloudViews();\n\n useEffect(() => {\n if (ref.current) {\n const size = {\n width: ref.current.clientWidth,\n height: ref.current.clientHeight,\n };\n\n const pointCloudAnnotation = new PointCloudAnnotation({\n container: ref.current,\n size,\n polygonOperationProps: { showDirectionLine: false, forbidAddNew: true },\n config,\n checkMode\n });\n ptCtx.setBackViewInstance(pointCloudAnnotation);\n }\n }, []);\n\n useEffect(() => {\n // By the way as an initialization judgment\n if (!size || !ptCtx.backViewInstance) {\n return;\n }\n\n const {\n pointCloud2dOperation: backPointCloudPolygonOperation,\n pointCloudInstance: backPointCloud,\n } = ptCtx.backViewInstance;\n\n /**\n * Synchronized 3d point cloud view displacement operations\n *\n * Change Orthographic Camera size\n */\n backPointCloudPolygonOperation.singleOn('renderZoom', (zoom: number, currentPos: any) => {\n if (!ptCtx.selectedPointCloudBox) {\n return;\n }\n updateBackViewByCanvas2D(currentPos, zoom, size, ptCtx.selectedPointCloudBox, backPointCloud);\n });\n\n // Synchronized 3d point cloud view displacement operations\n backPointCloudPolygonOperation.singleOn('dragMove', ({ currentPos, zoom }: any) => {\n if (!ptCtx.selectedPointCloudBox) {\n return;\n }\n updateBackViewByCanvas2D(currentPos, zoom, size, ptCtx.selectedPointCloudBox, backPointCloud);\n });\n\n backPointCloudPolygonOperation.singleOn(\n 'updatePolygonByDrag',\n ({ newPolygon, originPolygon }: any) => {\n backViewUpdateBox?.(newPolygon, originPolygon)\n },\n );\n }, [ptCtx, size]);\n\n useEffect(() => {\n // Update Size\n ptCtx?.backViewInstance?.initSize(size);\n }, [size]);\n\n return (\n <PointCloudContainer\n className={getClassName('point-cloud-container', 'back-view')}\n title={t('BackView')}\n toolbar={<SizeInfoForView perspectiveView={EPerspectiveView.Back} />}\n >\n <div className={getClassName('point-cloud-container', 'bottom-view-content')}>\n <div className={getClassName('point-cloud-container', 'core-instance')} ref={ref} />\n {!selectedBox && <EmptyPage />}\n </div>\n </PointCloudContainer>\n );\n};\n\nexport default connect(a2MapStateToProps, null, null, { context: LabelBeeContext })(\n PointCloudSideView,\n);\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAiCA,MAAM,0BAA6B,GAAA,CACjC,UACA,EAAA,IAAA,EACA,OAAO,CACJ,KAAA;AACH,EAAA,MAAM,CAAE,KAAA,EAAO,CAAG,EAAA,MAAA,EAAQ,CAAM,CAAA,GAAA,IAAA,CAAA;AAEhC,EAAA,MAAM,iBAAoB,GAAA;AAAA,IACxB,CAAG,EAAA,UAAA,CAAW,CAAK,GAAA,CAAA,GAAI,IAAQ,GAAA,CAAA;AAAA,IAC/B,CAAG,EAAA,UAAA,CAAW,CAAK,GAAA,CAAA,GAAI,IAAQ,GAAA,CAAA;AAAA,GAAA,CAAA;AAGjC,EAAA,MAAM,gBAAmB,GAAA;AAAA,IACvB,CAAA,EAAG,KAAK,KAAQ,GAAA,CAAA;AAAA,IAChB,CAAA,EAAG,KAAK,MAAS,GAAA,CAAA;AAAA,GAAA,CAAA;AAGnB,EAAO,OAAA;AAAA,IACL,OAAU,EAAA,CAAA,gBAAA,CAAiB,CAAI,GAAA,iBAAA,CAAkB,CAAK,IAAA,IAAA;AAAA,IACtD,O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AAA,GAAA,sCACnD,KAAD,EAAA;AAAA,IAAK,SAAA,EAAW,aAAa,uBAAyB,EAAA,eAAA,CAAA;AAAA,IAAkB,GAAA;AAAA,GACvE,CAAA,EAAA,CAAC,WAAe,oBAAA,KAAA,CAAA,aAAA,CAAC,SAAD,EAAA,IAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CAAA;AAMzB,yBAAe,QAAQ,iBAAmB,EAAA,IAAA,EAAM,IAAM,EAAA,CAAE,SAAS,eAC/D,CAAA,CAAA,CAAA,kBAAA,CAAA;;;;"}
1
+ {"version":3,"file":"PointCloudBackView.js","sources":["../../../src/components/pointCloudView/PointCloudBackView.tsx"],"sourcesContent":["/*\n * @Author: Laoluo luozefeng@sensetime.com\n * @Date: 2022-06-22 11:08:31\n * @LastEditors: Laoluo luozefeng@sensetime.com\n * @LastEditTime: 2022-07-08 11:08:02\n */\nimport {\n getCuboidFromPointCloudBox,\n MathUtils,\n PointCloud,\n PointCloudAnnotation,\n} from '@labelbee/lb-annotation';\nimport { getClassName } from '@/utils/dom';\nimport { PointCloudContainer } from './PointCloudLayout';\nimport React, { useEffect, useRef } from 'react';\nimport { PointCloudContext } from './PointCloudContext';\nimport {\n EPerspectiveView,\n IPointCloudBox,\n IPolygonData,\n IPolygonPoint,\n UpdatePolygonByDragList,\n} from '@labelbee/lb-utils';\nimport { useSingleBox } from './hooks/useSingleBox';\nimport { SizeInfoForView } from './PointCloudInfos';\nimport { connect } from 'react-redux';\nimport { a2MapStateToProps, IA2MapStateProps } from '@/store/annotation/map';\nimport {\n synchronizeSideView,\n synchronizeTopView,\n usePointCloudViews,\n} from './hooks/usePointCloudViews';\nimport useSize from '@/hooks/useSize';\nimport EmptyPage from './components/EmptyPage';\nimport { useTranslation } from 'react-i18next';\nimport { LabelBeeContext } from '@/store/ctx';\n\n/**\n * 统一一下,将其拓展为 二维转换为 三维坐标的转换\n * Get the offset from canvas2d-coordinate to world coordinate\n * @param currentPos\n * @param size\n * @param zoom\n * @returns\n */\nconst TransferCanvas2WorldOffset = (\n currentPos: { x: number; y: number },\n size: { width: number; height: number },\n zoom = 1,\n) => {\n const { width: w, height: h } = size;\n\n const canvasCenterPoint = {\n x: currentPos.x + (w * zoom) / 2,\n y: currentPos.y + (h * zoom) / 2,\n };\n\n const worldCenterPoint = {\n x: size.width / 2,\n y: size.height / 2,\n };\n\n return {\n offsetX: (worldCenterPoint.x - canvasCenterPoint.x) / zoom,\n offsetY: -(worldCenterPoint.y - canvasCenterPoint.y) / zoom,\n };\n};\nconst updateBackViewByCanvas2D = (\n currentPos: { x: number; y: number },\n zoom: number,\n size: { width: number; height: number },\n selectedPointCloudBox: IPointCloudBox,\n backPointCloud: PointCloud,\n) => {\n const { offsetX, offsetY } = TransferCanvas2WorldOffset(currentPos, size, zoom);\n backPointCloud.camera.zoom = zoom;\n if (currentPos) {\n const cos = Math.cos(selectedPointCloudBox.rotation);\n const sin = Math.sin(selectedPointCloudBox.rotation);\n const offsetXX = offsetX * cos;\n const offsetXY = offsetX * sin;\n const { x, y, z } = backPointCloud.initCameraPosition;\n backPointCloud.camera.position.set(x + offsetXY, y - offsetXX, z + offsetY);\n }\n backPointCloud.camera.updateProjectionMatrix();\n backPointCloud.render();\n};\n\ninterface IProps {\n checkMode?: boolean;\n}\n\nconst PointCloudSideView = ({ currentData, config, checkMode }: IA2MapStateProps & IProps) => {\n const ptCtx = React.useContext(PointCloudContext);\n const ref = useRef<HTMLDivElement>(null);\n const size = useSize(ref);\n const { selectedBox, updateSelectedBox } = useSingleBox();\n const { t } = useTranslation();\n const { backViewUpdateBox } = usePointCloudViews();\n\n const transferPolygonDataToBoxParams = (\n newPolygon: IPolygonData,\n originPolygon: IPolygonData,\n ) => {\n if (\n !ptCtx.selectedPointCloudBox ||\n !ptCtx.mainViewInstance ||\n !currentData.url ||\n !ptCtx.backViewInstance\n ) {\n return;\n }\n\n const { pointCloudInstance: backPointCloud } = ptCtx.backViewInstance;\n\n // Notice. The sort of polygon is important.\n const [point1, point2, point3] = newPolygon.pointList;\n const [op1, op2, op3] = originPolygon.pointList;\n\n // 2D centerPoint => 3D x & z\n const newCenterPoint = MathUtils.getLineCenterPoint([point1, point3]);\n const oldCenterPoint = MathUtils.getLineCenterPoint([op1, op3]);\n\n const offset = {\n x: newCenterPoint.x - oldCenterPoint.x,\n y: newCenterPoint.y - oldCenterPoint.y,\n };\n\n const offsetCenterPoint = {\n x: offset.x,\n y: 0, // Not be used.\n z: newCenterPoint.y - oldCenterPoint.y,\n };\n\n // 2D height => 3D depth\n const height = MathUtils.getLineLength(point1, point2);\n const oldHeight = MathUtils.getLineLength(op1, op2);\n const offsetHeight = height - oldHeight; // 3D depth\n\n // 2D width => 3D width\n const width = MathUtils.getLineLength(point2, point3);\n const oldWidth = MathUtils.getLineLength(op2, op3);\n const offsetWidth = width - oldWidth; // 3D width\n\n let { newBoxParams } = backPointCloud.getNewBoxByBackUpdate(\n offsetCenterPoint,\n offsetWidth,\n offsetHeight,\n ptCtx.selectedPointCloudBox,\n );\n\n // Update count\n if (ptCtx.mainViewInstance) {\n const { count } = ptCtx.mainViewInstance.getSensesPointZAxisInPolygon(\n getCuboidFromPointCloudBox(newBoxParams).polygonPointList as IPolygonPoint[],\n [\n newBoxParams.center.z - newBoxParams.depth / 2,\n newBoxParams.center.z + newBoxParams.depth / 2,\n ],\n );\n\n newBoxParams = {\n ...newBoxParams,\n count,\n };\n }\n\n synchronizeTopView(newBoxParams, newPolygon, ptCtx.topViewInstance, ptCtx.mainViewInstance);\n synchronizeSideView(newBoxParams, newPolygon, ptCtx.sideViewInstance, currentData.url);\n ptCtx.mainViewInstance.highlightOriginPointCloud([newBoxParams]);\n\n updateSelectedBox(newBoxParams);\n };\n\n useEffect(() => {\n if (ref.current) {\n const size = {\n width: ref.current.clientWidth,\n height: ref.current.clientHeight,\n };\n\n const pointCloudAnnotation = new PointCloudAnnotation({\n container: ref.current,\n size,\n polygonOperationProps: { showDirectionLine: false, forbidAddNew: true },\n config,\n checkMode,\n });\n ptCtx.setBackViewInstance(pointCloudAnnotation);\n }\n }, []);\n\n useEffect(() => {\n // By the way as an initialization judgment\n if (!size || !ptCtx.backViewInstance) {\n return;\n }\n\n const {\n pointCloud2dOperation: backPointCloudPolygonOperation,\n pointCloudInstance: backPointCloud,\n } = ptCtx.backViewInstance;\n\n /**\n * Synchronized 3d point cloud view displacement operations\n *\n * Change Orthographic Camera size\n */\n backPointCloudPolygonOperation.singleOn('renderZoom', (zoom: number, currentPos: any) => {\n if (!ptCtx.selectedPointCloudBox) {\n return;\n }\n updateBackViewByCanvas2D(currentPos, zoom, size, ptCtx.selectedPointCloudBox, backPointCloud);\n });\n\n // Synchronized 3d point cloud view displacement operations\n backPointCloudPolygonOperation.singleOn('dragMove', ({ currentPos, zoom }: any) => {\n if (!ptCtx.selectedPointCloudBox) {\n return;\n }\n updateBackViewByCanvas2D(currentPos, zoom, size, ptCtx.selectedPointCloudBox, backPointCloud);\n });\n\n backPointCloudPolygonOperation.singleOn(\n 'updatePolygonByDrag',\n (updateList: UpdatePolygonByDragList) => {\n if (ptCtx.selectedIDs.length === 1 && updateList.length === 1) {\n const { newPolygon, originPolygon } = updateList[0];\n\n if (newPolygon && originPolygon) {\n transferPolygonDataToBoxParams(newPolygon, originPolygon);\n backViewUpdateBox(newPolygon, originPolygon);\n }\n }\n },\n );\n }, [ptCtx, size]);\n\n useEffect(() => {\n // Update Size\n ptCtx?.backViewInstance?.initSize(size);\n }, [size]);\n\n return (\n <PointCloudContainer\n className={getClassName('point-cloud-container', 'back-view')}\n title={t('BackView')}\n toolbar={<SizeInfoForView perspectiveView={EPerspectiveView.Back} />}\n >\n <div className={getClassName('point-cloud-container', 'bottom-view-content')}>\n <div className={getClassName('point-cloud-container', 'core-instance')} ref={ref} />\n {!selectedBox && <EmptyPage />}\n </div>\n </PointCloudContainer>\n );\n};\n\nexport default connect(a2MapStateToProps, null, null, { context: LabelBeeContext })(\n PointCloudSideView,\n);\n"],"names":[],"mappings":";;;;;;;;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 +1 @@
1
- import{ActionsHistory as A,EToolName as x}from"@labelbee/lb-annotation";import v,{useState as e,useRef as j,useMemo as S}from"react";const B=v.createContext({pointCloudBoxList:[],polygonList:[],selectedID:"",selectedIDs:[],valid:!0,setSelectedIDs:()=>{},setPointCloudResult:()=>{},setPointCloudValid:()=>{},setTopViewInstance:()=>{},setSideViewInstance:()=>{},setBackViewInstance:()=>{},setMainViewInstance:()=>{},addSelectedID:()=>{},selectedAllBoxes:()=>{},addPointCloudBox:()=>[],setPolygonList:()=>{},zoom:1,setZoom:()=>{},history:new A,syncAllViewPointCloudColor:()=>{},defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:x.Rect,setPointCloudPattern:()=>{}}),q=({children:g})=>{const[s,r]=e([]),[u,b]=e([]),[o,c]=e([]),[C,h]=e(!0),[P,L]=e(1),[d,D]=e(),[w,R]=e(),[f,k]=e(),[i,E]=e(),[V,M]=e(""),[p,T]=e(x.Rect),z=j(new A).current,I=S(()=>o.length===1?o[0]:"",[o]),Z=S(()=>{const H=s.find(t=>t.id===I),N=t=>{const n=s.concat(t);return r(n),n},O=t=>{h(t!==!1)},l=t=>{t===void 0&&c([]),typeof t=="string"&&c([t]),Array.isArray(t)&&c(Array.from(new Set(t)))};return{selectedID:I,pointCloudBoxList:s,selectedIDs:o,setPointCloudResult:r,setSelectedIDs:l,addPointCloudBox:N,valid:C,selectedPointCloudBox:H,setPointCloudValid:O,addSelectedID:t=>{o.includes(t)?l(o.filter(n=>n!==t)):l([...o,t])},selectedAllBoxes:()=>{l(s.map(t=>t.id))},topViewInstance:d,setTopViewInstance:D,sideViewInstance:w,setSideViewInstance:R,backViewInstance:f,setBackViewInstance:k,mainViewInstance:i,setMainViewInstance:E,polygonList:u,setPolygonList:b,zoom:P,setZoom:L,history:z,syncAllViewPointCloudColor:t=>{const n=i==null?void 0:i.highlightOriginPointCloud(t);return new Promise(_=>{n==null||n.then(a=>{[d].forEach(m=>{var y;a&&((y=m==null?void 0:m.pointCloudInstance)==null||y.updateColor(a),_({color:a}))})})})},defaultAttribute:V,setDefaultAttribute:M,pointCloudPattern:p,setPointCloudPattern:T}},[C,o,s,u,d,w,f,i,P,V,p]);return v.createElement(B.Provider,{value:Z},g)};export{B as PointCloudContext,q as PointCloudProvider};
1
+ import E,{useState as o,useRef as _,useMemo as H,useEffect as tt}from"react";import{ActionsHistory as k,EToolName as M}from"@labelbee/lb-annotation";const O=E.createContext({pointCloudBoxList:[],displayPointCloudList:[],polygonList:[],selectedID:"",selectedIDs:[],valid:!0,setSelectedIDs:()=>{},setPointCloudResult:()=>{},setPointCloudValid:()=>{},setTopViewInstance:()=>{},setSideViewInstance:()=>{},setBackViewInstance:()=>{},setMainViewInstance:()=>{},addSelectedID:()=>{},selectedAllBoxes:()=>{},addPointCloudBox:()=>[],setPolygonList:()=>{},zoom:1,setZoom:()=>{},history:new k,hideAttributes:[],toggleAttributesVisible:()=>{},reRender:()=>{},setAttrPanelLayout:()=>{},attrPanelLayout:"",syncAllViewPointCloudColor:()=>{},defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:M.Rect,setPointCloudPattern:()=>{}}),et=({children:T})=>{const[l,w]=o([]),[u,z]=o([]),[n,f]=o([]),[I,F]=o(!0),[V,N]=o(1),[d,Z]=o(),[b,j]=o(),[v,q]=o(),[i,G]=o(),[y,J]=o(""),[g,K]=o(M.Rect),Q=_(new k).current,[s,P]=o([]),[h,U]=o(""),x=H(()=>n.length===1?n[0]:"",[n]),L=H(()=>{const a=l.find(t=>t.id===x),C=t=>{const e=l.concat(t);return w(e),e},p=t=>{F(t!==!1)},r=t=>{t===void 0&&f([]),typeof t=="string"&&f([t]),Array.isArray(t)&&f(Array.from(new Set(t)))},c=t=>{n.includes(t)?r(n.filter(e=>e!==t)):r([...n,t])},X=()=>{r(l.map(t=>t.id))},S=l.filter(t=>!s.includes(t.attribute)),Y=t=>{if(s.includes(t))P(s.filter(e=>e!==t));else{const e=s.concat(t);P(e)}},$=(t=S,e=u)=>{t.forEach(A=>{i==null||i.removeObjectByName(A.id)}),d==null||d.updatePolygonList(t,e),i==null||i.generateBoxes(t),B(t)},B=t=>{const e=i==null?void 0:i.highlightOriginPointCloud(t);return new Promise(A=>{e==null||e.then(m=>{[d].forEach(R=>{var D;m&&((D=R==null?void 0:R.pointCloudInstance)==null||D.updateColor(m),A({color:m}))})})})};return{selectedID:x,pointCloudBoxList:l,displayPointCloudList:S,selectedIDs:n,setPointCloudResult:w,setSelectedIDs:r,addPointCloudBox:C,valid:I,selectedPointCloudBox:a,setPointCloudValid:p,addSelectedID:c,selectedAllBoxes:X,topViewInstance:d,setTopViewInstance:Z,sideViewInstance:b,setSideViewInstance:j,backViewInstance:v,setBackViewInstance:q,mainViewInstance:i,setMainViewInstance:G,polygonList:u,setPolygonList:z,zoom:V,setZoom:N,history:Q,toggleAttributesVisible:Y,hideAttributes:s,setHideAttributes:P,reRender:$,attrPanelLayout:h,setAttrPanelLayout:U,syncAllViewPointCloudColor:B,defaultAttribute:y,setDefaultAttribute:J,pointCloudPattern:g,setPointCloudPattern:K}},[I,n,l,u,d,b,v,i,V,s,h,y,g]),W=()=>{const a=l.filter(c=>s.includes(c.attribute)),{setSelectedIDs:C,reRender:p}=L,r=a.map(c=>c.id);r.length>0&&C(n.filter(c=>!r.includes(c))),p()};return tt(()=>{var a;W(),(a=d==null?void 0:d.pointCloud2dOperation)==null||a.setHiddenAttributes(s)},[s]),E.createElement(O.Provider,{value:L},T)};export{O as PointCloudContext,et as PointCloudProvider};