@labelbee/lb-components 1.10.0-alpha.1 → 1.10.0-alpha.10

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 (86) hide show
  1. package/dist/App.js +1 -1
  2. package/dist/components/attributeList/index.js +1 -1
  3. package/dist/components/colorPalette/index.js +1 -0
  4. package/dist/components/colorTag/index.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/PointCloudTopView.js +1 -1
  8. package/dist/components/pointCloudView/hooks/useHistory.js +1 -1
  9. package/dist/components/pointCloudView/hooks/useLine.js +1 -0
  10. package/dist/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
  11. package/dist/components/pointCloudView/hooks/useSphere.js +1 -1
  12. package/dist/components/pointCloudView/hooks/useStatus.js +1 -1
  13. package/dist/components/predictTracking/predictTrackingIcon/index.js +1 -1
  14. package/dist/components/predictTracking/previewResult/index.js +1 -1
  15. package/dist/components/predictTracking/previewResult/util.js +1 -1
  16. package/dist/store/annotation/actionCreators.js +1 -1
  17. package/dist/types/components/AnnotationView/pointCloudAnnotationView.d.ts +2 -1
  18. package/dist/types/components/annotationStepPopover/index.d.ts +2 -1
  19. package/dist/types/components/attributeList/index.d.ts +2 -0
  20. package/dist/types/components/checkboxList/index.d.ts +2 -1
  21. package/dist/types/components/colorPalette/index.d.ts +12 -0
  22. package/dist/types/components/colorTag/index.d.ts +2 -1
  23. package/dist/types/components/customAntd/IconWithText/index.d.ts +1 -1
  24. package/dist/types/components/customResizeHook/index.d.ts +2 -2
  25. package/dist/types/components/fileException/FileError.d.ts +1 -1
  26. package/dist/types/components/pointCloudView/PointCloud2DView.d.ts +2 -1
  27. package/dist/types/components/pointCloudView/PointCloudBackView.d.ts +2 -1
  28. package/dist/types/components/pointCloudView/PointCloudContext.d.ts +4 -2
  29. package/dist/types/components/pointCloudView/PointCloudInfos.d.ts +4 -3
  30. package/dist/types/components/pointCloudView/PointCloudLayout.d.ts +1 -1
  31. package/dist/types/components/pointCloudView/components/EmptyPage/index.d.ts +7 -1
  32. package/dist/types/components/pointCloudView/components/UnifyParamsModal/index.d.ts +2 -1
  33. package/dist/types/components/pointCloudView/hooks/useHistory.d.ts +9 -4
  34. package/dist/types/components/pointCloudView/hooks/useLine.d.ts +12 -0
  35. package/dist/types/components/pointCloudView/hooks/usePointCloudViews.d.ts +3 -1
  36. package/dist/types/components/predictTracking/predictTrackingIcon/index.d.ts +2 -1
  37. package/dist/types/components/predictTracking/previewResult/index.d.ts +2 -1
  38. package/dist/types/components/predictTracking/previewResult/util.d.ts +2 -1
  39. package/dist/types/components/videoPlayer/TagToolInstanceAdaptor.d.ts +1 -1
  40. package/dist/types/components/videoPlayer/TagToolInstanceAdaptorI18nProvider.d.ts +2 -1
  41. package/dist/types/components/videoPlayer/components/controller/index.d.ts +2 -1
  42. package/dist/types/components/videoPlayer/index.d.ts +1 -1
  43. package/dist/types/store/annotation/actionCreators.d.ts +1 -1
  44. package/dist/types/utils/colorUtils.d.ts +20 -0
  45. package/dist/types/views/MainView/annotationTips/index.d.ts +2 -1
  46. package/dist/types/views/MainView/sidebar/ClearIcon/index.d.ts +2 -1
  47. package/dist/types/views/MainView/sidebar/ImgAttributeInfo/index.d.ts +2 -1
  48. package/dist/types/views/MainView/sidebar/PointCloudToolSidebar/components/batchUpdateModal/index.d.ts +2 -1
  49. package/dist/types/views/MainView/sidebar/PointCloudToolSidebar/index.d.ts +2 -1
  50. package/dist/types/views/MainView/sidebar/TagSidebar/index.d.ts +1 -1
  51. package/dist/types/views/MainView/sidebar/TextAreaFormat/index.d.ts +2 -1
  52. package/dist/types/views/MainView/sidebar/TextToolSidebar/index.d.ts +2 -2
  53. package/dist/types/views/MainView/sidebar/ToolIcons.d.ts +2 -1
  54. package/dist/types/views/MainView/sidebar/ToolStyle/index.d.ts +2 -1
  55. package/dist/types/views/MainView/toolFooter/AnnotatedAttributes/index.d.ts +5 -4
  56. package/dist/types/views/MainView/toolFooter/FooterPopover.d.ts +1 -1
  57. package/dist/types/views/MainView/toolFooter/HiddenTips/index.d.ts +2 -1
  58. package/dist/types/views/MainView/toolFooter/PageNumber/index.d.ts +2 -1
  59. package/dist/types/views/MainView/toolFooter/Pagination.d.ts +1 -1
  60. package/dist/types/views/MainView/toolFooter/index.d.ts +1 -1
  61. package/dist/utils/colorUtils.js +1 -0
  62. package/dist/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
  63. package/dist/views/MainView/toolFooter/AnnotatedAttributes/index.js +1 -1
  64. package/dist/views/MainView/toolFooter/FooterTips/ToolHotKey/index.js +1 -1
  65. package/es/App.js +1 -1
  66. package/es/components/attributeList/index.js +1 -1
  67. package/es/components/colorPalette/index.js +1 -0
  68. package/es/components/colorTag/index.js +1 -1
  69. package/es/components/pointCloudView/PointCloudContext.js +1 -1
  70. package/es/components/pointCloudView/PointCloudListener.js +1 -1
  71. package/es/components/pointCloudView/PointCloudTopView.js +1 -1
  72. package/es/components/pointCloudView/hooks/useHistory.js +1 -1
  73. package/es/components/pointCloudView/hooks/useLine.js +1 -0
  74. package/es/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
  75. package/es/components/pointCloudView/hooks/useSphere.js +1 -1
  76. package/es/components/pointCloudView/hooks/useStatus.js +1 -1
  77. package/es/components/predictTracking/predictTrackingIcon/index.js +1 -1
  78. package/es/components/predictTracking/previewResult/index.js +1 -1
  79. package/es/components/predictTracking/previewResult/util.js +1 -1
  80. package/es/store/annotation/actionCreators.js +1 -1
  81. package/es/utils/colorUtils.js +1 -0
  82. package/es/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
  83. package/es/views/MainView/toolFooter/AnnotatedAttributes/index.js +1 -1
  84. package/es/views/MainView/toolFooter/FooterTips/ToolHotKey/index.js +1 -1
  85. package/package.json +8 -7
  86. package/LICENSE +0 -203
package/dist/App.js CHANGED
@@ -1 +1 @@
1
- "use strict";var index$1=require("./views/MainView/index.js"),lbUtils=require("@labelbee/lb-utils"),React=require("react"),reactRedux=require("react-redux"),index=require("./index.js"),ctx=require("./store/ctx.js"),Actions=require("./store/Actions.js"),actionCreators=require("./store/annotation/actionCreators.js"),reducer=require("./store/annotation/reducer.js"),es=require("antd/es"),zhCN=require("antd/es/locale/zh_CN"),enUS=require("antd/es/locale/en_US");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),zhCN__default=_interopDefaultLegacy(zhCN),enUS__default=_interopDefaultLegacy(enUS),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,a)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,__spreadValues=(e,t)=>{for(var a in t||(t={}))__hasOwnProp.call(t,a)&&__defNormalProp(e,a,t[a]);if(__getOwnPropSymbols)for(var a of __getOwnPropSymbols(t))__propIsEnum.call(t,a)&&__defNormalProp(e,a,t[a]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));const App=e=>{const[t,a]=React.useState(0),{imgList:o,step:i=1,stepList:s,onSubmit:l,onSave:c,onPageChange:u,onStepChange:d,initialIndex:p=0,toolInstance:h,setToolInstance:P,getFileData:f,pageSize:g=10,loadFileList:r,defaultLang:v="cn",skipBeforePageTurning:I,beforeRotate:_,checkMode:S=!1,intelligentFit:m=!0}=e;React.useEffect(()=>{index.store.dispatch(actionCreators.InitTaskData({onSubmit:l,stepList:s,step:i,getFileData:f,pageSize:g,loadFileList:r,onSave:c,onPageChange:u,onStepChange:d,skipBeforePageTurning:I,beforeRotate:_,checkMode:S})),O(),lbUtils.i18n.changeLanguage(v);const n=()=>{a(L=>L+1)};return lbUtils.i18n.on("languageChanged",n),()=>{lbUtils.i18n.off("languageChanged",n),actionCreators.InitAnnotationState(index.store.dispatch)}},[]),React.useEffect(()=>{index.store.dispatch(actionCreators.UpdateInjectFunc({onSubmit:l,stepList:s,getFileData:f,pageSize:g,loadFileList:r,onSave:c,onPageChange:u,onStepChange:d,beforeRotate:_})),lbUtils.i18n.changeLanguage(v)},[l,s,f,g,r,c,u,d,v,_]),React.useEffect(()=>{index.store.dispatch(actionCreators.UpdateProcessingStep(i))},[i]),React.useEffect(()=>{P==null||P(h)},[h]);const O=()=>{r?actionCreators.loadImgList(index.store.dispatch,index.store.getState,p,!0).then(n=>{n&&index.store.dispatch(reducer.LoadFileAndFileData(p))}):o&&o.length>0&&(index.store.dispatch({type:Actions.ANNOTATION_ACTIONS.UPDATE_IMG_LIST,payload:{imgList:o}}),index.store.dispatch(reducer.LoadFileAndFileData(p)))};return React__default.default.createElement("div",null,React__default.default.createElement(es.ConfigProvider,{locale:lbUtils.i18n.language==="en"?enUS__default.default:zhCN__default.default},React__default.default.createElement(index$1,__spreadProps(__spreadValues({},e),{intelligentFit:m}))))},mapStateToProps=e=>({toolInstance:e.annotation.toolInstance});var App$1=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(App);module.exports=App$1;
1
+ "use strict";var index$1=require("./views/MainView/index.js"),lbUtils=require("@labelbee/lb-utils"),React=require("react"),reactRedux=require("react-redux"),index=require("./index.js"),ctx=require("./store/ctx.js"),Actions=require("./store/Actions.js"),actionCreators=require("./store/annotation/actionCreators.js"),reducer=require("./store/annotation/reducer.js"),es=require("antd/es"),zhCN=require("antd/es/locale/zh_CN"),enUS=require("antd/es/locale/en_US");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),zhCN__default=_interopDefaultLegacy(zhCN),enUS__default=_interopDefaultLegacy(enUS),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,a)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,__spreadValues=(e,t)=>{for(var a in t||(t={}))__hasOwnProp.call(t,a)&&__defNormalProp(e,a,t[a]);if(__getOwnPropSymbols)for(var a of __getOwnPropSymbols(t))__propIsEnum.call(t,a)&&__defNormalProp(e,a,t[a]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));const App=e=>{const[t,a]=React.useState(0),{imgList:o,step:P=1,stepList:i,onSubmit:s,onSave:l,onPageChange:c,onStepChange:u,initialIndex:d=0,toolInstance:_,setToolInstance:h,getFileData:p,pageSize:f=10,loadFileList:r,defaultLang:g="cn",skipBeforePageTurning:I,beforeRotate:v,checkMode:m=!1,intelligentFit:O=!0}=e;React.useEffect(()=>{index.store.dispatch(actionCreators.InitTaskData({onSubmit:s,stepList:i,step:P,getFileData:p,pageSize:f,loadFileList:r,onSave:l,onPageChange:c,onStepChange:u,skipBeforePageTurning:I,beforeRotate:v,checkMode:m})),S(),lbUtils.i18n.changeLanguage(g);const n=()=>{a(L=>L+1)};return lbUtils.i18n.on("languageChanged",n),()=>{lbUtils.i18n.off("languageChanged",n),actionCreators.InitAnnotationState(index.store.dispatch)}},[]),React.useEffect(()=>{index.store.dispatch(actionCreators.UpdateInjectFunc({onSubmit:s,stepList:i,getFileData:p,pageSize:f,loadFileList:r,onSave:l,onPageChange:c,onStepChange:u,beforeRotate:v})),lbUtils.i18n.changeLanguage(g)},[s,i,p,f,r,l,c,u,g,v]),React.useEffect(()=>{h==null||h(_)},[_]);const S=()=>{r?actionCreators.loadImgList(index.store.dispatch,index.store.getState,d,!0).then(n=>{n&&index.store.dispatch(reducer.LoadFileAndFileData(d))}):o&&o.length>0&&(index.store.dispatch({type:Actions.ANNOTATION_ACTIONS.UPDATE_IMG_LIST,payload:{imgList:o}}),index.store.dispatch(reducer.LoadFileAndFileData(d)))};return React__default.default.createElement("div",null,React__default.default.createElement(es.ConfigProvider,{locale:lbUtils.i18n.language==="en"?enUS__default.default:zhCN__default.default},React__default.default.createElement(index$1,__spreadProps(__spreadValues({},e),{intelligentFit:O}))))},mapStateToProps=e=>({toolInstance:e.annotation.toolInstance});var App$1=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(App);module.exports=App$1;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Style=require("../../data/Style.js"),index=require("../colorTag/index.js"),es=require("antd/es"),React=require("react");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const ATTRIBUTE_COLORS=[Style.NULL_COLOR].concat(Style.COLORS_ARRAY),AttributeList=React__default.default.forwardRef((e,o)=>{const d=React__default.default.useRef(),f=e.list||[];let u=[...ATTRIBUTE_COLORS];e.forbidDefault===!0&&(u=u.slice(1));let r="sensebee-radio-group";return e.noHeightLimit&&(r="sensebee-radio-group-no-limit-height"),React__default.default.createElement("div",{className:r,style:e.style},React__default.default.createElement(es.Radio.Group,{name:"radiogroup",defaultValue:e==null?void 0:e.selectedAttribute,value:e==null?void 0:e.selectedAttribute,onChange:t=>e.attributeChanged(t.target.value),ref:o},f.map((t,a)=>{var n;let l=(n=e==null?void 0:e.num)!=null?n:a;e.forbidDefault===!0&&typeof l=="number"&&l++,typeof l=="number"&&l<=9&&l>=0||(l="-");let i=a>8&&!e.forbidDefault?Style.COLORS_ARRAY[(a-1)%Style.COLORS_ARRAY.length]:u[a%u.length];return(t==null?void 0:t.color)&&(i=t.color),React__default.default.createElement(es.Radio,{value:t.value,ref:d,key:a},React__default.default.createElement("span",{className:"sensebee-radio-label",title:t.label},!(e==null?void 0:e.forbidColor)&&React__default.default.createElement(index.ColorTag,{color:i,style:{marginRight:"8px"}}),t.label),React__default.default.createElement("span",{className:"sensebee-radio-num"},l))})))});exports.ATTRIBUTE_COLORS=ATTRIBUTE_COLORS,exports.default=AttributeList;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Style=require("../../data/Style.js"),index$1=require("../colorTag/index.js"),es=require("antd/es"),React=require("react"),antd=require("antd"),index=require("../colorPalette/index.js"),icons=require("@ant-design/icons"),reactI18next=require("react-i18next");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const ATTRIBUTE_COLORS=[Style.NULL_COLOR].concat(Style.COLORS_ARRAY),AttributeList=React__default.default.forwardRef((e,f)=>{const c=React__default.default.useRef(),{t:s}=reactI18next.useTranslation(),v=e.list||[],[C,u]=React.useState(!1),[b,m]=React.useState(void 0);let n=[...ATTRIBUTE_COLORS];e.forbidDefault===!0&&(n=n.slice(1));let o="sensebee-radio-group";e.noHeightLimit&&(o="sensebee-radio-group-no-limit-height");const R=(t,l)=>{e.updateColorConfig&&e.updateColorConfig(t,l)};return React__default.default.createElement("div",{className:o,style:e.style},React__default.default.createElement(es.Radio.Group,{name:"radiogroup",defaultValue:e==null?void 0:e.selectedAttribute,value:e==null?void 0:e.selectedAttribute,onChange:t=>e.attributeChanged(t.target.value),ref:f},v.map((t,l)=>{var d;let a=(d=e==null?void 0:e.num)!=null?d:l;e.forbidDefault===!0&&typeof a=="number"&&a++,typeof a=="number"&&a<=9&&a>=0||(a="-");let i=l>8&&!e.forbidDefault?Style.COLORS_ARRAY[(l-1)%Style.COLORS_ARRAY.length]:n[l%n.length];return(t==null?void 0:t.color)&&(i=t.color),React__default.default.createElement(es.Radio,{value:t.value,ref:c,key:t.label+l},React__default.default.createElement("span",{className:"sensebee-radio-label",title:t.label},!(e==null?void 0:e.forbidColor)&&React__default.default.createElement(antd.Popover,{content:React__default.default.createElement(index,{defaultColor:i,setColor:r=>R(t.value,r)}),title:React__default.default.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},React__default.default.createElement("span",null,s("Palette")),React__default.default.createElement(icons.CloseOutlined,{onClick:()=>u(!1)})),visible:C&&b===l,onVisibleChange:r=>{!r||u(r)}},React__default.default.createElement(index$1.ColorTag,{color:i,style:{cursor:"pointer",marginRight:"8px"},onClick:()=>{(e==null?void 0:e.enableColorPicker)&&(m(l),u(!0))}})),t.label),React__default.default.createElement("span",{className:"sensebee-radio-num"},a))})))});exports.ATTRIBUTE_COLORS=ATTRIBUTE_COLORS,exports.default=AttributeList;
@@ -0,0 +1 @@
1
+ "use strict";var React=require("react"),reactColorful=require("react-colorful"),colorUtils=require("../../utils/colorUtils.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var React__default=_interopDefaultLegacy(React);const Palette=t=>{const{setColor:r,defaultColor:e}=t;return React__default.default.createElement(reactColorful.RgbaColorPicker,{color:colorUtils.toRGBAObj(e),onChange:o=>{const l=colorUtils.toRGBAStr(o);r(l)}})};module.exports=Palette;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react");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 ColorTag=({color:e,style:r})=>React__default.default.createElement("div",{style:__spreadValues({display:"inline-block",height:14,width:14,backgroundColor:e,verticalAlign:"middle"},r)});exports.ColorTag=ColorTag;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react");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 ColorTag=({color:e,style:r,onClick:t})=>React__default.default.createElement("div",{style:__spreadValues({display:"inline-block",height:14,width:14,backgroundColor:e,verticalAlign:"middle"},r),onClick:t});exports.ColorTag=ColorTag;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),lbAnnotation=require("@labelbee/lb-annotation");function _interopDefaultLegacy(u){return u&&typeof u=="object"&&"default"in u?u:{default:u}}var React__default=_interopDefaultLegacy(React);const PointCloudContext=React__default.default.createContext({pointCloudBoxList:[],pointCloudSphereList:[],displayPointCloudList:[],displaySphereList:[],polygonList:[],selectedID:"",selectedIDs:[],valid:!0,setSelectedIDs:()=>{},setPointCloudResult:()=>{},setPointCloudSphereList:()=>{},setPointCloudValid:()=>{},setTopViewInstance:()=>{},setSideViewInstance:()=>{},setBackViewInstance:()=>{},setMainViewInstance:()=>{},addSelectedID:()=>{},selectedAllBoxes:()=>{},addPointCloudBox:()=>[],addPointCloudSphere:()=>[],setPolygonList:()=>{},zoom:1,setZoom:()=>{},history:new lbAnnotation.ActionsHistory,hideAttributes:[],setHideAttributes:()=>{},toggleAttributesVisible:()=>{},reRender:()=>{},setAttrPanelLayout:()=>{},attrPanelLayout:"",syncAllViewPointCloudColor:()=>{},defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:lbAnnotation.EToolName.Rect,setPointCloudPattern:()=>{},selectSpecAttr:()=>{}}),PointCloudProvider=({children:u})=>{const[i,b]=React.useState([]),[c,y]=React.useState([]),[P,O]=React.useState([]),[l,C]=React.useState([]),[h,j]=React.useState(!0),[L,N]=React.useState(1),[r,T]=React.useState(),[m,_]=React.useState(),[w,k]=React.useState(),[o,q]=React.useState(),[I,z]=React.useState(""),[V,F]=React.useState(lbAnnotation.EToolName.Rect),Z=React.useRef(new lbAnnotation.ActionsHistory).current,[s,S]=React.useState([]),[g,G]=React.useState(""),x=React.useMemo(()=>l.length===1?l[0]:"",[l]),B=React.useMemo(()=>{const a=i.find(t=>t.id===x),v=t=>{const e=i.concat(t);return b(e),e},A=t=>{const e=c.concat(t);return y(e),e},p=t=>{j(t!==!1)},n=t=>{t===void 0&&C([]),typeof t=="string"&&C([t]),Array.isArray(t)&&C(Array.from(new Set(t)))},K=t=>{l.includes(t)?n(l.filter(e=>e!==t)):n([...l,t])},Q=()=>{n(i.map(t=>t.id))},U=t=>{n(i.filter(e=>e.attribute===t).map(e=>e.id))},R=i.filter(t=>!s.includes(t.attribute)),D=c.filter(t=>!s.includes(t.attribute)),W=t=>{if(s.includes(t))S(s.filter(e=>e!==t));else{const e=s.concat(t);S(e)}},X=(t=R,e=P,f=D)=>{i.forEach(d=>{o==null||o.removeObjectByName(d.id)}),c.forEach(d=>{o==null||o.removeObjectByName(d.id)}),r==null||r.updatePolygonList(t,e),r==null||r.updatePointList(f),o==null||o.generateBoxes(t),o==null||o.generateSpheres(f),E(t)},E=t=>{const e=o==null?void 0:o.highlightOriginPointCloud(t);return new Promise(f=>{e==null||e.then(d=>{[r].forEach(H=>{var M;d&&((M=H==null?void 0:H.pointCloudInstance)==null||M.updateColor(d),f({color:d}))})})})};return{selectedID:x,pointCloudBoxList:i,pointCloudSphereList:c,displayPointCloudList:R,displaySphereList:D,selectedIDs:l,setPointCloudResult:b,setSelectedIDs:n,addPointCloudBox:v,addPointCloudSphere:A,setPointCloudSphereList:y,valid:h,selectedPointCloudBox:a,setPointCloudValid:p,addSelectedID:K,selectedAllBoxes:Q,topViewInstance:r,setTopViewInstance:T,sideViewInstance:m,setSideViewInstance:_,backViewInstance:w,setBackViewInstance:k,mainViewInstance:o,setMainViewInstance:q,polygonList:P,setPolygonList:O,zoom:L,setZoom:N,history:Z,toggleAttributesVisible:W,hideAttributes:s,setHideAttributes:S,reRender:X,attrPanelLayout:g,setAttrPanelLayout:G,syncAllViewPointCloudColor:E,defaultAttribute:I,setDefaultAttribute:z,pointCloudPattern:V,setPointCloudPattern:F,selectSpecAttr:U}},[h,l,i,c,P,r,m,w,o,L,s,g,I,V]),J=()=>{const a=i.filter(n=>s.includes(n.attribute)),{setSelectedIDs:v,reRender:A}=B,p=a.map(n=>n.id);p.length>0&&v(l.filter(n=>!p.includes(n))),A()};return React.useEffect(()=>{var a;J(),(a=r==null?void 0:r.pointCloud2dOperation)==null||a.setHiddenAttributes(s)},[s]),React__default.default.createElement(PointCloudContext.Provider,{value:B},u)};exports.PointCloudContext=PointCloudContext,exports.PointCloudProvider=PointCloudProvider;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),lbAnnotation=require("@labelbee/lb-annotation");function _interopDefaultLegacy(u){return u&&typeof u=="object"&&"default"in u?u:{default:u}}var React__default=_interopDefaultLegacy(React);const PointCloudContext=React__default.default.createContext({pointCloudBoxList:[],pointCloudSphereList:[],displayPointCloudList:[],displaySphereList:[],polygonList:[],lineList:[],selectedID:"",selectedIDs:[],valid:!0,setSelectedIDs:()=>{},setPointCloudResult:()=>{},setPointCloudSphereList:()=>{},setPointCloudValid:()=>{},setTopViewInstance:()=>{},setSideViewInstance:()=>{},setBackViewInstance:()=>{},setMainViewInstance:()=>{},addSelectedID:()=>{},selectedAllBoxes:()=>{},addPointCloudBox:()=>[],addPointCloudSphere:()=>[],setPolygonList:()=>{},setLineList:()=>{},zoom:1,setZoom:()=>{},history:new lbAnnotation.ActionsHistory,hideAttributes:[],setHideAttributes:()=>{},toggleAttributesVisible:()=>{},reRender:()=>{},setAttrPanelLayout:()=>{},attrPanelLayout:"",syncAllViewPointCloudColor:()=>{},defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:lbAnnotation.EToolName.Rect,setPointCloudPattern:()=>{},selectSpecAttr:()=>{}}),PointCloudProvider=({children:u})=>{const[l,y]=React.useState([]),[c,h]=React.useState([]),[C,j]=React.useState([]),[S,N]=React.useState([]),[r,L]=React.useState([]),[m,T]=React.useState(!0),[w,_]=React.useState(1),[n,k]=React.useState(),[I,q]=React.useState(),[V,z]=React.useState(),[o,F]=React.useState(),[g,Z]=React.useState(""),[x,G]=React.useState(lbAnnotation.EToolName.Rect),J=React.useRef(new lbAnnotation.ActionsHistory).current,[i,v]=React.useState([]),[B,K]=React.useState(""),R=React.useMemo(()=>r.length===1?r[0]:"",[r]),D=React.useMemo(()=>{const d=l.find(t=>t.id===R),A=t=>{const e=l.concat(t);return y(e),e},b=t=>{const e=c.concat(t);return h(e),e},f=t=>{T(t!==!1)},s=t=>{t===void 0&&L([]),typeof t=="string"&&L([t]),Array.isArray(t)&&L(Array.from(new Set(t)))},U=t=>{r.includes(t)?s(r.filter(e=>e!==t)):s([...r,t])},W=()=>{s(l.map(t=>t.id))},X=t=>{s(l.filter(e=>e.attribute===t).map(e=>e.id))},E=l.filter(t=>!i.includes(t.attribute)),H=c.filter(t=>!i.includes(t.attribute)),Y=t=>{if(i.includes(t))v(i.filter(e=>e!==t));else{const e=i.concat(t);v(e)}},$=(t=E,e=C,P=H,p=S)=>{l.forEach(a=>{o==null||o.removeObjectByName(a.id)}),c.forEach(a=>{o==null||o.removeObjectByName(a.id)}),n==null||n.updatePolygonList(t,e),n==null||n.updatePointList(P),n==null||n.updateLineList(p),o==null||o.generateBoxes(t),o==null||o.generateSpheres(P),M(t)},M=t=>{const e=o==null?void 0:o.highlightOriginPointCloud(t);return new Promise(P=>{e==null||e.then(p=>{[n].forEach(a=>{var O;p&&((O=a==null?void 0:a.pointCloudInstance)==null||O.updateColor(p),P({color:p}))})})})};return{selectedID:R,pointCloudBoxList:l,pointCloudSphereList:c,displayPointCloudList:E,displaySphereList:H,selectedIDs:r,setPointCloudResult:y,setSelectedIDs:s,addPointCloudBox:A,addPointCloudSphere:b,setPointCloudSphereList:h,valid:m,selectedPointCloudBox:d,setPointCloudValid:f,addSelectedID:U,selectedAllBoxes:W,topViewInstance:n,setTopViewInstance:k,sideViewInstance:I,setSideViewInstance:q,backViewInstance:V,setBackViewInstance:z,mainViewInstance:o,setMainViewInstance:F,polygonList:C,setPolygonList:j,lineList:S,setLineList:N,zoom:w,setZoom:_,history:J,toggleAttributesVisible:Y,hideAttributes:i,setHideAttributes:v,reRender:$,attrPanelLayout:B,setAttrPanelLayout:K,syncAllViewPointCloudColor:M,defaultAttribute:g,setDefaultAttribute:Z,pointCloudPattern:x,setPointCloudPattern:G,selectSpecAttr:X}},[m,r,l,c,C,S,n,I,V,o,w,i,B,g,x]),Q=()=>{const d=l.filter(s=>i.includes(s.attribute)),{setSelectedIDs:A,reRender:b}=D,f=d.map(s=>s.id);f.length>0&&A(r.filter(s=>!f.includes(s))),b()};return React.useEffect(()=>{var d;Q(),(d=n==null?void 0:n.pointCloud2dOperation)==null||d.setHiddenAttributes(i)},[i]),React__default.default.createElement(PointCloudContext.Provider,{value:D},u)};exports.PointCloudContext=PointCloudContext,exports.PointCloudProvider=PointCloudProvider;
@@ -1 +1 @@
1
- "use strict";var PointCloudContext=require("./PointCloudContext.js"),useRotate=require("./hooks/useRotate.js"),useBoxes=require("./hooks/useBoxes.js"),useSingleBox=require("./hooks/useSingleBox.js"),useSphere=require("./hooks/useSphere.js"),React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),antd=require("antd"),reactRedux=require("react-redux"),map=require("../../store/annotation/map.js"),annotation=require("../../hooks/annotation.js"),useStatus=require("./hooks/useStatus.js"),index=require("../../utils/index.js"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),ctx=require("../../store/ctx.js"),useHistory=require("./hooks/useHistory.js"),useAttribute=require("./hooks/useAttribute.js"),useConfig=require("./hooks/useConfig.js"),usePolygon=require("./hooks/usePolygon.js"),reactI18next=require("react-i18next"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(u,r,i)=>r in u?__defProp(u,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):u[r]=i,__spreadValues=(u,r)=>{for(var i in r||(r={}))__hasOwnProp.call(r,i)&&__defNormalProp(u,i,r[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(r))__propIsEnum.call(r,i)&&__defNormalProp(u,i,r[i]);return u},__spreadProps=(u,r)=>__defProps(u,__getOwnPropDescs(r));const{EPolygonPattern}=lbAnnotation.cTool,PointCloudListener=({currentData:u,config:r,checkMode:i,configString:_,imgIndex:w})=>{const o=React.useContext(PointCloudContext.PointCloudContext),{changeSelectedBoxValid:B,selectNextBox:I,selectPrevBox:V,updateSelectedBox:C,deleteSelectedPointCloudBoxAndPolygon:E}=useSingleBox.useSingleBox(),{selectedSphere:f,updatePointCloudSphere:L}=useSphere.useSphere(),{clearAllResult:b,updatePointCloudPattern:q}=useStatus.useStatus(),A=index.jsonParser(u.result),{copySelectedBoxes:O,pasteSelectedBoxes:j,copiedBoxes:T}=useBoxes.useBoxes({config:r}),{toolInstanceRef:a}=annotation.useCustomToolInstance({basicInfo:A}),{updateRotate:P}=useRotate.useRotate({currentData:u}),{updatePointCloudData:p,topViewSelectedChanged:x}=usePointCloudViews.usePointCloudViews(),{redo:h,undo:g,pushHistoryWithList:R,pushHistoryUnderUpdatePolygon:D}=useHistory.useHistory(),{syncThreeViewsAttribute:S}=useAttribute.useAttribute(),{syncAllViewsConfig:N,reRenderTopViewRange:H}=useConfig.useConfig(),{selectedPolygon:m}=usePolygon.usePolygon(),{t:y}=reactI18next.useTranslation(),v=e=>{var t;const{topViewInstance:s}=o;!s||(t=s.pointCloud2dOperation)==null||t.updateSelectedPolygonsPoints(e)},K=(e,t)=>{var s;const{topViewInstance:n,mainViewInstance:l}=o;if(!n)return;const{pointCloud2dOperation:c}=n;switch(e){case"q":{P(2);break}case"e":P(-2);break;case"g":P(180);break;case"u":{const d=c.pattern===EPolygonPattern.Normal?lbAnnotation.EToolName.Rect:lbAnnotation.EToolName.Polygon;q(d);const z={[lbAnnotation.EToolName.Polygon]:y("PolygonPattern"),[lbAnnotation.EToolName.Rect]:y("RectPattern")};antd.message.success(y("ChangePatternMsg",{pattern:z[d]})),c.clearActiveStatus(),c.clearDrawingStatus()}break;case"+":l==null||l.updatePointSize(!0);break;case"-":l==null||l.updatePointSize(!1);break;case"v":o.setPointCloudValid(!o.valid);break;case"tab":if(t.shiftKey){V();break}I(),t.preventDefault();break;case"f":B();break;case"arrowup":v({y:-1});break;case"arrowdown":v({y:1});break;case"arrowleft":v({x:-1});break;case"arrowright":v({x:1});break;case"delete":E();break;default:{if(((s=r.attributeList)==null?void 0:s.length)>0){const d=lbAnnotation.AttributeUtils.getAttributeByKeycode(t.keyCode,r.attributeList);d!==void 0&&a.current.setDefaultAttribute(d)}return}}},U=(e,t)=>{switch(e){case"c":O();break;case"v":j();break;case"a":t.preventDefault(),o.selectedAllBoxes();break;case"z":{t.shiftKey?h():g();break}}},k=e=>{if(!lbAnnotation.CommonToolUtils.hotkeyFilter(e)||i===!0)return;const t=e.key.toLocaleLowerCase();if(e.ctrlKey){U(t,e);return}K(t,e)};return React.useEffect(()=>{const{topViewInstance:e}=o;if(!!e)return window.addEventListener("keydown",k),()=>{window.removeEventListener("keydown",k)}},[o,T,r,o.pointCloudBoxList,o.polygonList]),React.useEffect(()=>{N(r)},[_]),React.useEffect(()=>{(r==null?void 0:r.radius)&&H(r==null?void 0:r.radius)},[r==null?void 0:r.radius]),React.useEffect(()=>{p==null||p()},[w,o.mainViewInstance]),React.useEffect(()=>{o.setHideAttributes([])},[w]),React.useEffect(()=>{a.current.exportData=()=>[o.pointCloudBoxList,{valid:o.valid}],a.current.exportCustomData=()=>{var e,t;return{resultPolygon:(e=o.polygonList)!=null?e:[],resultPoint:(t=o.pointCloudSphereList)!=null?t:[]}},a.current.setDefaultAttribute=e=>{var t;S(e);const s=o.selectedPointCloudBox;if(s){s.attribute=e;const n=C(s);o.mainViewInstance&&x({newSelectedBox:s,newPointCloudList:n})}if(m&&D(__spreadProps(__spreadValues({},m),{attribute:e})),f){const n=L(__spreadProps(__spreadValues({},f),{attribute:e}));o.mainViewInstance&&((t=o.mainViewInstance)==null||t.generateSpheres(n),x({newSelectedSphere:f,newSphereList:n}))}},a.current.setSubAttribute=(e,t)=>{var s;const n=o.selectedPointCloudBox;if(n){const l=(s=n==null?void 0:n.subAttribute)!=null?s:{};n.subAttribute=__spreadProps(__spreadValues({},l),{[e]:t}),C(n)}},a.current.clearResult=()=>{b==null||b()},a.current.redo=()=>{h()},a.current.undo=()=>{g()},a.current.setValid=e=>{a.current.valid=e,setTimeout(()=>{o.setPointCloudValid(e),e===!1&&b()})},a.current.setForbidOperation=e=>{var t,s;(s=(t=o.topViewInstance)==null?void 0:t.pointCloud2dOperation)==null||s.setForbidOperation(e),e===!0&&o.setSelectedIDs(void 0)},a.current.setShowDefaultCursor=e=>{var t,s;(s=(t=o.topViewInstance)==null?void 0:t.pointCloud2dOperation)==null||s.setShowDefaultCursor(e)},a.current.asyncData=e=>{setTimeout(()=>{p==null||p(e)})}},[o.pointCloudBoxList,o.pointCloudSphereList,o.selectedID,o.valid,o.polygonList,o.mainViewInstance]),React.useEffect(()=>{a.current.history={pushHistory:e=>{R({pointCloudBoxList:e})},initRecord:()=>{}}},[]),React.useEffect(()=>{var e;const t=(e=o.topViewInstance)==null?void 0:e.toolInstance;if(!t||i)return;const s=c=>{S(c)},n=c=>{antd.message.error(c)},l=c=>{antd.message.info(c)};return t.on("syncAttribute",s),t.on("messageError",n),t.on("messageInfo",l),()=>{t.unbind("syncAttribute",s),t.unbind("messageError",n),t.unbind("messageInfo",l)}},[o.topViewInstance]),null};var PointCloudListener$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudListener);module.exports=PointCloudListener$1;
1
+ "use strict";var PointCloudContext=require("./PointCloudContext.js"),useRotate=require("./hooks/useRotate.js"),useBoxes=require("./hooks/useBoxes.js"),useSingleBox=require("./hooks/useSingleBox.js"),useSphere=require("./hooks/useSphere.js"),React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),antd=require("antd"),reactRedux=require("react-redux"),map=require("../../store/annotation/map.js"),annotation=require("../../hooks/annotation.js"),useStatus=require("./hooks/useStatus.js"),index=require("../../utils/index.js"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),ctx=require("../../store/ctx.js"),useHistory=require("./hooks/useHistory.js"),useAttribute=require("./hooks/useAttribute.js"),useConfig=require("./hooks/useConfig.js"),usePolygon=require("./hooks/usePolygon.js"),reactI18next=require("react-i18next"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(u,r,i)=>r in u?__defProp(u,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):u[r]=i,__spreadValues=(u,r)=>{for(var i in r||(r={}))__hasOwnProp.call(r,i)&&__defNormalProp(u,i,r[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(r))__propIsEnum.call(r,i)&&__defNormalProp(u,i,r[i]);return u},__spreadProps=(u,r)=>__defProps(u,__getOwnPropDescs(r));const{EPolygonPattern}=lbAnnotation.cTool,PointCloudListener=({currentData:u,config:r,checkMode:i,configString:_,imgIndex:w})=>{const t=React.useContext(PointCloudContext.PointCloudContext),{changeSelectedBoxValid:B,selectNextBox:I,selectPrevBox:L,updateSelectedBox:C,deleteSelectedPointCloudBoxAndPolygon:V}=useSingleBox.useSingleBox(),{selectedSphere:f,updatePointCloudSphere:E}=useSphere.useSphere(),{clearAllResult:b,updatePointCloudPattern:q}=useStatus.useStatus(),A=index.jsonParser(u.result),{copySelectedBoxes:O,pasteSelectedBoxes:j,copiedBoxes:T}=useBoxes.useBoxes({config:r}),{toolInstanceRef:a}=annotation.useCustomToolInstance({basicInfo:A}),{updateRotate:P}=useRotate.useRotate({currentData:u}),{updatePointCloudData:p,topViewSelectedChanged:x}=usePointCloudViews.usePointCloudViews(),{redo:h,undo:g,pushHistoryWithList:R,pushHistoryUnderUpdatePolygon:D}=useHistory.useHistory(),{syncThreeViewsAttribute:S}=useAttribute.useAttribute(),{syncAllViewsConfig:N,reRenderTopViewRange:H}=useConfig.useConfig(),{selectedPolygon:m}=usePolygon.usePolygon(),{t:y}=reactI18next.useTranslation(),v=e=>{var o;const{topViewInstance:s}=t;!s||(o=s.pointCloud2dOperation)==null||o.updateSelectedPolygonsPoints(e)},K=(e,o)=>{var s;const{topViewInstance:n,mainViewInstance:l}=t;if(!n)return;const{pointCloud2dOperation:c}=n;switch(e){case"q":{P(2);break}case"e":P(-2);break;case"g":P(180);break;case"u":{const d=c.pattern===EPolygonPattern.Normal?lbAnnotation.EToolName.Rect:lbAnnotation.EToolName.Polygon;q(d);const z={[lbAnnotation.EToolName.Polygon]:y("PolygonPattern"),[lbAnnotation.EToolName.Rect]:y("RectPattern")};antd.message.success(y("ChangePatternMsg",{pattern:z[d]})),c.clearActiveStatus(),c.clearDrawingStatus()}break;case"+":l==null||l.updatePointSize(!0);break;case"-":l==null||l.updatePointSize(!1);break;case"v":t.setPointCloudValid(!t.valid);break;case"tab":if(o.shiftKey){L();break}I(),o.preventDefault();break;case"f":B();break;case"arrowup":v({y:-1});break;case"arrowdown":v({y:1});break;case"arrowleft":v({x:-1});break;case"arrowright":v({x:1});break;case"delete":V();break;default:{if(((s=r.attributeList)==null?void 0:s.length)>0){const d=lbAnnotation.AttributeUtils.getAttributeByKeycode(o.keyCode,r.attributeList);d!==void 0&&a.current.setDefaultAttribute(d)}return}}},U=(e,o)=>{switch(e){case"c":O();break;case"v":j();break;case"a":o.preventDefault(),t.selectedAllBoxes();break;case"z":{o.shiftKey?h():g();break}}},k=e=>{if(!lbAnnotation.CommonToolUtils.hotkeyFilter(e)||i===!0)return;const o=e.key.toLocaleLowerCase();if(e.ctrlKey){U(o,e);return}K(o,e)};return React.useEffect(()=>{const{topViewInstance:e}=t;if(!!e)return window.addEventListener("keydown",k),()=>{window.removeEventListener("keydown",k)}},[t,T,r,t.pointCloudBoxList,t.polygonList]),React.useEffect(()=>{N(r)},[_]),React.useEffect(()=>{(r==null?void 0:r.radius)&&H(r==null?void 0:r.radius)},[r==null?void 0:r.radius]),React.useEffect(()=>{p==null||p()},[w,t.mainViewInstance]),React.useEffect(()=>{t.setHideAttributes([])},[w]),React.useEffect(()=>{a.current.exportData=()=>[t.pointCloudBoxList,{valid:t.valid}],a.current.exportCustomData=()=>{var e,o,s;return{resultPolygon:(e=t.polygonList)!=null?e:[],resultLine:(o=t.lineList)!=null?o:[],resultPoint:(s=t.pointCloudSphereList)!=null?s:[]}},a.current.setDefaultAttribute=e=>{var o;S(e);const s=t.selectedPointCloudBox;if(s){s.attribute=e;const n=C(s);t.mainViewInstance&&x({newSelectedBox:s,newPointCloudList:n})}if(m&&D(__spreadProps(__spreadValues({},m),{attribute:e})),f){const n=E(__spreadProps(__spreadValues({},f),{attribute:e}));t.mainViewInstance&&((o=t.mainViewInstance)==null||o.generateSpheres(n),x({newSelectedSphere:f,newSphereList:n}))}},a.current.setSubAttribute=(e,o)=>{var s;const n=t.selectedPointCloudBox;if(n){const l=(s=n==null?void 0:n.subAttribute)!=null?s:{};n.subAttribute=__spreadProps(__spreadValues({},l),{[e]:o}),C(n)}},a.current.clearResult=()=>{b==null||b()},a.current.redo=()=>{h()},a.current.undo=()=>{g()},a.current.setValid=e=>{a.current.valid=e,setTimeout(()=>{t.setPointCloudValid(e),e===!1&&b()})},a.current.setForbidOperation=e=>{var o,s;(s=(o=t.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||s.setForbidOperation(e),e===!0&&t.setSelectedIDs(void 0)},a.current.setShowDefaultCursor=e=>{var o,s;(s=(o=t.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||s.setShowDefaultCursor(e)},a.current.asyncData=e=>{setTimeout(()=>{p==null||p(e)})}},[t.pointCloudBoxList,t.pointCloudSphereList,t.selectedID,t.valid,t.polygonList,t.lineList,t.mainViewInstance]),React.useEffect(()=>{a.current.history={pushHistory:e=>{R({pointCloudBoxList:e})},initRecord:()=>{}}},[]),React.useEffect(()=>{var e;const o=(e=t.topViewInstance)==null?void 0:e.toolInstance;if(!o||i)return;const s=c=>{S(c)},n=c=>{antd.message.error(c)},l=c=>{antd.message.info(c)};return o.on("syncAttribute",s),o.on("messageError",n),o.on("messageInfo",l),()=>{o.unbind("syncAttribute",s),o.unbind("messageError",n),o.unbind("messageInfo",l)}},[t.topViewInstance]),null};var PointCloudListener$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudListener);module.exports=PointCloudListener$1;
@@ -1 +1 @@
1
- "use strict";var dom=require("../../utils/dom.js"),index$1=require("../../views/MainView/toolFooter/index.js"),index$2=require("../../views/MainView/toolFooter/ZoomController/index.js"),icons=require("@ant-design/icons"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),React=require("react"),PointCloudContext=require("./PointCloudContext.js"),useRotate=require("./hooks/useRotate.js"),useSingleBox=require("./hooks/useSingleBox.js"),PointCloudLayout=require("./PointCloudLayout.js"),PointCloudInfos=require("./PointCloudInfos.js"),usePolygon=require("./hooks/usePolygon.js"),useSphere=require("./hooks/useSphere.js"),useZoom=require("./hooks/useZoom.js"),antd=require("antd"),map=require("../../store/annotation/map.js"),reactRedux=require("react-redux"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),useSize=require("../../hooks/useSize.js"),reactI18next=require("react-i18next"),ctx=require("../../store/ctx.js"),index=require("../../utils/index.js"),ToolUtils=require("../../utils/ToolUtils.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,n,i)=>n in e?__defProp(e,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[n]=i,__spreadValues=(e,n)=>{for(var i in n||(n={}))__hasOwnProp.call(n,i)&&__defNormalProp(e,i,n[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(n))__propIsEnum.call(n,i)&&__defNormalProp(e,i,n[i]);return e},__spreadProps=(e,n)=>__defProps(e,__getOwnPropDescs(n));const{EPolygonPattern}=lbAnnotation.cTool,TransferCanvas2WorldOffset=(e,n,i=1)=>{const{width:c,height:m}=n,g={x:e.x+c*i/2,y:e.y+m*i/2},C={x:n.width/2,y:n.height/2};return{offsetX:(C.x-g.x)/i,offsetY:-(C.y-g.y)/i}},TopViewToolbar=({currentData:e})=>{const{zoom:n,zoomIn:i,zoomOut:c,initialPosition:m}=useZoom.useZoom(),{selectNextBox:g,selectPrevBox:C}=useSingleBox.useSingleBox(),{updateRotate:w}=useRotate.useRotate({currentData:e}),x=2,p=()=>{w(-x)},t=()=>{w(x)},a=()=>{w(180)};return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement("span",{onClick:t,className:dom.getClassName("point-cloud","rotate-reserve")}),React__default.default.createElement("span",{onClick:p,className:dom.getClassName("point-cloud","rotate")}),React__default.default.createElement("span",{onClick:a,className:dom.getClassName("point-cloud","rotate-180")}),React__default.default.createElement(index$1.FooterDivider,null),React__default.default.createElement(icons.UpSquareOutlined,{onClick:()=>{C()},className:dom.getClassName("point-cloud","prev")}),React__default.default.createElement(icons.DownSquareOutlined,{onClick:()=>{g()},className:dom.getClassName("point-cloud","next")}),React__default.default.createElement(index$1.FooterDivider,null),React__default.default.createElement(index$2.ZoomController,{initialPosition:m,zoomIn:i,zoomOut:c,zoom:n}))},ZAxisSlider=({setZAxisLimit:e,zAxisLimit:n,checkMode:i})=>i?null:React__default.default.createElement("div",{style:{position:"absolute",top:128,right:8,height:"50%",zIndex:20}},React__default.default.createElement(antd.Slider,{vertical:!0,step:.5,max:10,min:.5,defaultValue:n,onAfterChange:c=>{e(c)}})),PointCloudTopView=({currentData:e,imgList:n,stepInfo:i,drawLayerSlot:c,checkMode:m,intelligentFit:g})=>{var C;const[w,x]=React.useState({zoom:1,currentPos:{x:0,y:0}}),p=React.useRef(null),t=React__default.default.useContext(PointCloudContext.PointCloudContext),a=useSize(p),P=index.jsonParser(i.config),{setZoom:O,syncTopviewToolZoom:_}=useZoom.useZoom(),{hideAttributes:q}=t,{addPolygon:E,deletePolygon:j}=usePolygon.usePolygon(),{deletePointCloudSphere:L}=useSphere.useSphere(),{deletePointCloudBox:A,changeValidByID:N}=useSingleBox.useSingleBox(),[y,T]=React.useState(10),{t:k}=reactI18next.useTranslation(),f=usePointCloudViews.usePointCloudViews();return React.useLayoutEffect(()=>{if(!t.topViewInstance&&p.current&&(e==null?void 0:e.url)&&(e==null?void 0:e.result)){const l={width:p.current.clientWidth,height:p.current.clientHeight},u=new lbAnnotation.PointCloudAnnotation({container:p.current,size:l,pcdPath:e.url,config:P,checkMode:m,toolName:ToolUtils.getPointCloudToolList()});t.setTopViewInstance(u)}},[e]),React.useEffect(()=>{if(!a||!t.topViewInstance||!t.sideViewInstance)return;const{toolInstance:l}=t.topViewInstance;l.singleOn("pointCreated",(o,s)=>{f.topViewAddSphere({newPoint:o,size:a,trackConfigurable:P.trackConfigurable,zoom:s})}),l.singleOn("pointDeleted",o=>{L(o)}),l.singleOn("pointSelected",o=>{t.setSelectedIDs([o])}),l.singleOn("updatePointByDrag",(o,s)=>{var d;(d=f.topViewUpdatePoint)==null||d.call(f,o,a)}),l.singleOn("polygonCreated",(o,s)=>{if(l.pattern===EPolygonPattern.Normal||!(e==null?void 0:e.url)){const d=__spreadProps(__spreadValues({},o),{pointList:o.pointList.map(r=>lbUtils.PointCloudUtils.transferCanvas2World(r,a))});E(d),t.setSelectedIDs(q.includes(o.attribute)?"":o.id);return}f.topViewAddBox({polygon:o,size:a,imgList:n,trackConfigurable:P.trackConfigurable,zoom:s,intelligentFit:g})}),l.singleOn("deletedObject",({id:o})=>{A(o),j(o)}),l.singleOn("deleteSelectedIDs",()=>{t.setSelectedIDs([])}),l.singleOn("addSelectedIDs",o=>{t.addSelectedID(o)}),l.singleOn("setSelectedIDs",o=>{t.setSelectedIDs(o)}),l.singleOn("updatePolygonByDrag",o=>{var s;(s=f.topViewUpdateBox)==null||s.call(f,o,a)});const u=o=>{var s;const d=N(o);d&&t.syncAllViewPointCloudColor(d),t.polygonList.find(r=>r.id===o)&&((s=t.topViewInstance)==null||s.toolInstance.setPolygonValidAndRender(o,!0))};return l.on("validUpdate",u),()=>{l.unbind("validUpdate",u)}},[t,a,e,f,t.polygonList]),React.useEffect(()=>{var l,u;if(!(a==null?void 0:a.width)||!t.topViewInstance)return;const o=(u=(l=P==null?void 0:P.attributeList)==null?void 0:l[0])==null?void 0:u.value;o&&t.topViewInstance.toolInstance.setDefaultAttribute(o),t.topViewInstance.initSize(a),t.topViewInstance.updatePolygonList(t.displayPointCloudList,t.polygonList),t.topViewInstance.updatePointList(t.displaySphereList);const{topViewInstance:{pointCloudInstance:s,toolInstance:d}}=t;d.singleOn("renderZoom",(r,v)=>{const{offsetX:I,offsetY:h}=TransferCanvas2WorldOffset(v,a,r);if(s.camera.zoom=r,v){const{x:V,y:S,z:b}=s.initCameraPosition;s.camera.position.set(V+h,S-I,b)}s.camera.updateProjectionMatrix(),s.render(),O(r),_(v,r,a),x({zoom:r,currentPos:v})}),d.singleOn("dragMove",({currentPos:r,zoom:v})=>{const{offsetX:I,offsetY:h}=TransferCanvas2WorldOffset(r,a,v);s.camera.zoom=v;const{x:V,y:S,z:b}=s.initCameraPosition;s.camera.position.set(V+h,S-I,b),s.render(),x({zoom:v,currentPos:r})})},[a,t.topViewInstance,(C=t.topViewInstance)==null?void 0:C.toolInstance]),React.useEffect(()=>{var l,u;(u=(l=t.topViewInstance)==null?void 0:l.pointCloudInstance)==null||u.applyZAxisPoints(y)},[y]),React.useEffect(()=>{f.topViewSelectedChanged({})},[t.selectedIDs]),React__default.default.createElement(PointCloudLayout.PointCloudContainer,{className:dom.getClassName("point-cloud-container","top-view"),title:k("TopView"),toolbar:React__default.default.createElement(TopViewToolbar,{currentData:e})},React__default.default.createElement("div",{style:{position:"relative",flex:1}},React__default.default.createElement("div",{style:{width:"100%",height:"100%"},ref:p},c==null?void 0:c(w)),React__default.default.createElement(PointCloudInfos.BoxInfos,{checkMode:m,config:P}),React__default.default.createElement(ZAxisSlider,{checkMode:m,zAxisLimit:y,setZAxisLimit:T}),React__default.default.createElement(PointCloudInfos.PointCloudValidity,null)))};var PointCloudTopView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudTopView);module.exports=PointCloudTopView$1;
1
+ "use strict";var dom=require("../../utils/dom.js"),index$1=require("../../views/MainView/toolFooter/index.js"),index$2=require("../../views/MainView/toolFooter/ZoomController/index.js"),icons=require("@ant-design/icons"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),React=require("react"),PointCloudContext=require("./PointCloudContext.js"),useRotate=require("./hooks/useRotate.js"),useSingleBox=require("./hooks/useSingleBox.js"),PointCloudLayout=require("./PointCloudLayout.js"),PointCloudInfos=require("./PointCloudInfos.js"),usePolygon=require("./hooks/usePolygon.js"),useLine=require("./hooks/useLine.js"),useSphere=require("./hooks/useSphere.js"),useZoom=require("./hooks/useZoom.js"),antd=require("antd"),map=require("../../store/annotation/map.js"),reactRedux=require("react-redux"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),useSize=require("../../hooks/useSize.js"),reactI18next=require("react-i18next"),ctx=require("../../store/ctx.js"),index=require("../../utils/index.js"),ToolUtils=require("../../utils/ToolUtils.js");function _interopDefaultLegacy(o){return o&&typeof o=="object"&&"default"in o?o:{default:o}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(o,l,s)=>l in o?__defProp(o,l,{enumerable:!0,configurable:!0,writable:!0,value:s}):o[l]=s,__spreadValues=(o,l)=>{for(var s in l||(l={}))__hasOwnProp.call(l,s)&&__defNormalProp(o,s,l[s]);if(__getOwnPropSymbols)for(var s of __getOwnPropSymbols(l))__propIsEnum.call(l,s)&&__defNormalProp(o,s,l[s]);return o},__spreadProps=(o,l)=>__defProps(o,__getOwnPropDescs(l));const{EPolygonPattern}=lbAnnotation.cTool,TransferCanvas2WorldOffset=(o,l,s=1)=>{const{width:f,height:C}=l,m={x:o.x+f*s/2,y:o.y+C*s/2},g={x:l.width/2,y:l.height/2};return{offsetX:(g.x-m.x)/s,offsetY:-(g.y-m.y)/s}},TopViewToolbar=({currentData:o})=>{const{zoom:l,zoomIn:s,zoomOut:f,initialPosition:C}=useZoom.useZoom(),{selectNextBox:m,selectPrevBox:g}=useSingleBox.useSingleBox(),{updateRotate:P}=useRotate.useRotate({currentData:o}),x=2,I=()=>{P(-x)},v=()=>{P(x)},t=()=>{P(180)};return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement("span",{onClick:v,className:dom.getClassName("point-cloud","rotate-reserve")}),React__default.default.createElement("span",{onClick:I,className:dom.getClassName("point-cloud","rotate")}),React__default.default.createElement("span",{onClick:t,className:dom.getClassName("point-cloud","rotate-180")}),React__default.default.createElement(index$1.FooterDivider,null),React__default.default.createElement(icons.UpSquareOutlined,{onClick:()=>{g()},className:dom.getClassName("point-cloud","prev")}),React__default.default.createElement(icons.DownSquareOutlined,{onClick:()=>{m()},className:dom.getClassName("point-cloud","next")}),React__default.default.createElement(index$1.FooterDivider,null),React__default.default.createElement(index$2.ZoomController,{initialPosition:C,zoomIn:s,zoomOut:f,zoom:l}))},ZAxisSlider=({setZAxisLimit:o,zAxisLimit:l,checkMode:s})=>s?null:React__default.default.createElement("div",{style:{position:"absolute",top:128,right:8,height:"50%",zIndex:20}},React__default.default.createElement(antd.Slider,{vertical:!0,step:.5,max:10,min:.5,defaultValue:l,onAfterChange:f=>{o(f)}})),PointCloudTopView=({currentData:o,imgList:l,stepInfo:s,drawLayerSlot:f,checkMode:C,intelligentFit:m})=>{var g,P;const[x,I]=React.useState({zoom:1,currentPos:{x:0,y:0}}),v=React.useRef(null),t=React__default.default.useContext(PointCloudContext.PointCloudContext),a=useSize(v),w=index.jsonParser(s.config),{setZoom:j,syncTopviewToolZoom:_}=useZoom.useZoom(),{hideAttributes:L}=t,{addPolygon:E,deletePolygon:A}=usePolygon.usePolygon(),{addLine:N,deleteLine:T}=useLine.useLine(),{deletePointCloudSphere:k}=useSphere.useSphere(),{deletePointCloudBox:q,changeValidByID:B}=useSingleBox.useSingleBox(),[y,D]=React.useState(10),{t:R}=reactI18next.useTranslation(),d=usePointCloudViews.usePointCloudViews();return React.useLayoutEffect(()=>{if(!t.topViewInstance&&v.current&&(o==null?void 0:o.url)&&(o==null?void 0:o.result)){const n={width:v.current.clientWidth,height:v.current.clientHeight},c=new lbAnnotation.PointCloudAnnotation({container:v.current,size:n,pcdPath:o.url,config:__spreadProps(__spreadValues({},w),{pointCloudPattern:t.pointCloudPattern}),checkMode:C,toolName:ToolUtils.getPointCloudToolList()});t.setTopViewInstance(c)}},[o]),React.useEffect(()=>{if(!a||!t.topViewInstance||!t.sideViewInstance)return;const{toolInstance:n}=t.topViewInstance;n.singleOn("lineCreated",(e,i)=>{const u=__spreadProps(__spreadValues({},e),{pointList:e.pointList.map(r=>lbUtils.PointCloudUtils.transferCanvas2World(r,a))});N(u),t.setSelectedIDs(L.includes(e.attribute)?"":e.id)}),n.singleOn("lineDeleted",e=>{q(e),T(e)}),n.singleOn("lineSelected",e=>{t.setSelectedIDs([e])}),n.singleOn("updateLineByDrag",e=>{var i;(i=d.topViewUpdateLine)==null||i.call(d,e,a)}),n.singleOn("pointCreated",(e,i)=>{d.topViewAddSphere({newPoint:e,size:a,trackConfigurable:w.trackConfigurable,zoom:i})}),n.singleOn("pointDeleted",e=>{k(e)}),n.singleOn("pointSelected",e=>{t.setSelectedIDs([e])}),n.singleOn("updatePointByDrag",(e,i)=>{var u;(u=d.topViewUpdatePoint)==null||u.call(d,e,a)}),n.singleOn("polygonCreated",(e,i)=>{if(n.pattern===EPolygonPattern.Normal||!(o==null?void 0:o.url)){const u=__spreadProps(__spreadValues({},e),{pointList:e.pointList.map(r=>lbUtils.PointCloudUtils.transferCanvas2World(r,a))});E(u),t.setSelectedIDs(L.includes(e.attribute)?"":e.id);return}d.topViewAddBox({polygon:e,size:a,imgList:l,trackConfigurable:w.trackConfigurable,zoom:i,intelligentFit:m})}),n.singleOn("deletedObject",({id:e})=>{q(e),A(e)}),n.singleOn("deleteSelectedIDs",()=>{t.setSelectedIDs([])}),n.singleOn("addSelectedIDs",e=>{t.addSelectedID(e)}),n.singleOn("setSelectedIDs",e=>{t.setSelectedIDs(e)}),n.singleOn("updatePolygonByDrag",e=>{var i;(i=d.topViewUpdateBox)==null||i.call(d,e,a)});const c=e=>{var i;const u=B(e);u&&t.syncAllViewPointCloudColor(u),t.polygonList.find(r=>r.id===e)&&((i=t.topViewInstance)==null||i.toolInstance.setPolygonValidAndRender(e,!0))};return n.on("validUpdate",c),()=>{n.unbind("validUpdate",c)}},[t,a,o,d,t.polygonList,t.lineList,(g=t.topViewInstance)==null?void 0:g.toolInstance]),React.useEffect(()=>{var n,c;if(!(a==null?void 0:a.width)||!t.topViewInstance)return;const e=(c=(n=w==null?void 0:w.attributeList)==null?void 0:n[0])==null?void 0:c.value;e&&t.topViewInstance.toolInstance.setDefaultAttribute(e),t.topViewInstance.initSize(a),t.topViewInstance.updatePolygonList(t.displayPointCloudList,t.polygonList),t.topViewInstance.updatePointList(t.displaySphereList);const{topViewInstance:{pointCloudInstance:i,toolInstance:u}}=t;u.singleOn("renderZoom",(r,p)=>{const{offsetX:V,offsetY:h}=TransferCanvas2WorldOffset(p,a,r);if(i.camera.zoom=r,p){const{x:O,y:S,z:b}=i.initCameraPosition;i.camera.position.set(O+h,S-V,b)}i.camera.updateProjectionMatrix(),i.render(),j(r),_(p,r,a),I({zoom:r,currentPos:p})}),u.singleOn("dragMove",({currentPos:r,zoom:p})=>{const{offsetX:V,offsetY:h}=TransferCanvas2WorldOffset(r,a,p);i.camera.zoom=p;const{x:O,y:S,z:b}=i.initCameraPosition;i.camera.position.set(O+h,S-V,b),i.render(),_(r,p,a),I({zoom:p,currentPos:r})})},[a,t.topViewInstance,(P=t.topViewInstance)==null?void 0:P.toolInstance]),React.useEffect(()=>{var n,c;(c=(n=t.topViewInstance)==null?void 0:n.pointCloudInstance)==null||c.applyZAxisPoints(y)},[y]),React.useEffect(()=>{d.topViewSelectedChanged({})},[t.selectedIDs]),React__default.default.createElement(PointCloudLayout.PointCloudContainer,{className:dom.getClassName("point-cloud-container","top-view"),title:R("TopView"),toolbar:React__default.default.createElement(TopViewToolbar,{currentData:o})},React__default.default.createElement("div",{style:{position:"relative",flex:1}},React__default.default.createElement("div",{style:{width:"100%",height:"100%"},ref:v},f==null?void 0:f(x)),React__default.default.createElement(PointCloudInfos.BoxInfos,{checkMode:C,config:w}),React__default.default.createElement(ZAxisSlider,{checkMode:C,zAxisLimit:y,setZAxisLimit:D}),React__default.default.createElement(PointCloudInfos.PointCloudValidity,null)))};var PointCloudTopView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudTopView);module.exports=PointCloudTopView$1;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),PointCloudContext=require("../PointCloudContext.js"),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,i,s)=>i in e?__defProp(e,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[i]=s,__spreadValues=(e,i)=>{for(var s in i||(i={}))__hasOwnProp.call(i,s)&&__defNormalProp(e,s,i[s]);if(__getOwnPropSymbols)for(var s of __getOwnPropSymbols(i))__propIsEnum.call(i,s)&&__defNormalProp(e,s,i[s]);return e};const useHistory=()=>{const{history:e,setPointCloudResult:i,setSelectedIDs:s,pointCloudBoxList:r,pointCloudSphereList:L,mainViewInstance:u,topViewInstance:y,polygonList:d,setPolygonList:a,syncAllViewPointCloudColor:C}=React.useContext(PointCloudContext.PointCloudContext),P=({newBoxParams:o,newPolygon:t})=>{const n={pointCloudBoxList:r,polygonList:d};o&&(n.pointCloudBoxList=r.concat(o)),t&&(n.polygonList=d.concat(t)),e.pushHistory(n)},g=o=>{const t={pointCloudBoxList:r,polygonList:d};o.pointCloudBoxList&&(t.pointCloudBoxList=o.pointCloudBoxList),o.polygonList&&(t.polygonList=o.polygonList),e.pushHistory(t)},h=o=>{o&&e.pushHistory({pointCloudSphereList:L})},v=o=>{if(d.find(n=>n.id===o.id)){const n=d.map(c=>c.id===o.id?o:__spreadValues({},c));e.pushHistory({pointCloudBoxList:r,polygonList:n}),a(n)}},x=({pointCloudBoxList:o,polygonList:t})=>{e.initRecord({pointCloudBoxList:o,polygonList:t},!0)},f=o=>{if(!o)return;const{pointCloudBoxList:t=[],polygonList:n=[]}=o;if(t){r.length!==t.length&&s();const c=r.filter(l=>t.every(p=>p.id!==l.id)),_=t.filter(l=>r.every(p=>p.id!==l.id));c.forEach(l=>{u==null||u.removeObjectByName(l.id)}),_.forEach(l=>{u==null||u.generateBox(l)}),i(t),C(t)}n&&a(n),y==null||y.updatePolygonList(t!=null?t:[],n!=null?n:[])};return{addHistory:P,pushHistoryWithList:g,initHistory:x,pushHistoryUnderUpdatePoint:h,pushHistoryUnderUpdatePolygon:v,redo:()=>{f(e.redo())},undo:()=>{f(e.undo())}}};exports.useHistory=useHistory;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),PointCloudContext=require("../PointCloudContext.js"),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,s,r)=>s in e?__defProp(e,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[s]=r,__spreadValues=(e,s)=>{for(var r in s||(s={}))__hasOwnProp.call(s,r)&&__defNormalProp(e,r,s[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(s))__propIsEnum.call(s,r)&&__defNormalProp(e,r,s[r]);return e};const useHistory=()=>{const{history:e,setPointCloudResult:s,setSelectedIDs:r,pointCloudBoxList:p,pointCloudSphereList:L,setPointCloudSphereList:x,mainViewInstance:u,topViewInstance:C,polygonList:y,setPolygonList:P,lineList:f,setLineList:g,syncAllViewPointCloudColor:_}=React.useContext(PointCloudContext.PointCloudContext),S=({newBoxParams:t,newPolygon:o,newLine:i,newSphereParams:l})=>{const d={pointCloudBoxList:p,polygonList:y,lineList:f,pointCloudSphereList:L};t&&(d.pointCloudBoxList=p.concat(t)),o&&(d.polygonList=y.concat(o)),i&&(d.lineList=f.concat(i)),l&&(d.pointCloudSphereList=L.concat(l)),e.pushHistory(d)},B=t=>{const o={pointCloudBoxList:p,polygonList:y,lineList:f,pointCloudSphereList:L};t.pointCloudBoxList&&(o.pointCloudBoxList=t.pointCloudBoxList),t.polygonList&&(o.polygonList=t.polygonList),t.lineList&&(o.lineList=t.lineList),t.pointCloudSphereList&&(o.pointCloudSphereList=t.pointCloudSphereList),e.pushHistory(o)},H=t=>{if(f.find(i=>i.id===t.id)){const i=f.map(l=>l.id===t.id?t:__spreadValues({},l));e.pushHistory({lineList:i}),g(i)}},O=t=>{if(y.find(i=>i.id===t.id)){const i=y.map(l=>l.id===t.id?t:__spreadValues({},l));e.pushHistory({pointCloudBoxList:p,polygonList:i}),P(i)}},w=({pointCloudBoxList:t,polygonList:o,pointCloudSphereList:i})=>{e.initRecord({pointCloudBoxList:t,polygonList:o,pointCloudSphereList:i},!0)},v=t=>{if(!t)return;const{pointCloudBoxList:o=[],polygonList:i=[],lineList:l=[],pointCloudSphereList:d=[]}=t;if(o){p.length!==o.length&&r();const h=p.filter(n=>o.every(c=>c.id!==n.id)),a=o.filter(n=>p.every(c=>c.id!==n.id));h.forEach(n=>{u==null||u.removeObjectByName(n.id)}),a.forEach(n=>{u==null||u.generateBox(n)}),s(o),_(o)}if(d){L.length!==d.length&&r();let h=L.filter(n=>d.every(c=>c.id!==n.id)),a=d.filter(n=>L.every(c=>c.id!==n.id));h.forEach(n=>{u==null||u.removeObjectByName(n.id)}),a.forEach(n=>{u==null||u.generateSphere(n)}),x(d)}i&&P(i),l&&g(l),C==null||C.updatePolygonList(o!=null?o:[],i!=null?i:[]),C==null||C.updateLineList(l!=null?l:[])};return{addHistory:S,pushHistoryWithList:B,initHistory:w,pushHistoryUnderUpdatePolygon:O,pushHistoryUnderUpdateLine:H,redo:()=>{v(e.redo())},undo:()=>{v(e.undo())}}};exports.useHistory=useHistory;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),PointCloudContext=require("../PointCloudContext.js"),useHistory=require("./useHistory.js"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,e,r)=>e in t?__defProp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,__spreadValues=(t,e)=>{for(var r in e||(e={}))__hasOwnProp.call(e,r)&&__defNormalProp(t,r,e[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(e))__propIsEnum.call(e,r)&&__defNormalProp(t,r,e[r]);return t},__spreadProps=(t,e)=>__defProps(t,__getOwnPropDescs(e));const useLine=()=>{const{lineList:t,setLineList:e,selectedID:r}=React.useContext(PointCloudContext.PointCloudContext),{addHistory:a,pushHistoryWithList:d}=useHistory.useHistory(),s=t.find(i=>i.id===r);return{addLine:i=>{e(t.concat(i)),a({newLine:i})},deleteLine:i=>{const o=t.filter(n=>n.id!==i).map(n=>__spreadValues({},n));e(o),d({lineList:o})},selectedLine:s,updateSelectedLine:i=>{s&&e(t.map(o=>o.id===r?i:o))},updateLineValidByID:i=>{t.find(n=>n.id===i)&&e(t.map(n=>n.id===i?__spreadProps(__spreadValues({},n),{valid:!n.valid}):n))}}};exports.useLine=useLine;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),React=require("react"),PointCloudContext=require("../PointCloudContext.js"),useSingleBox=require("./useSingleBox.js"),useSphere=require("./useSphere.js"),ctx=require("../../../store/ctx.js"),StepUtils=require("../../../utils/StepUtils.js"),index=require("../../../utils/index.js"),actionCreators=require("../../../store/annotation/actionCreators.js"),antd=require("antd"),reactI18next=require("react-i18next"),useHistory=require("./useHistory.js"),usePolygon=require("./usePolygon.js"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,o,n)=>o in t?__defProp(t,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[o]=n,__spreadValues=(t,o)=>{for(var n in o||(o={}))__hasOwnProp.call(o,n)&&__defNormalProp(t,n,o[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(o))__propIsEnum.call(o,n)&&__defNormalProp(t,n,o[n]);return t},__spreadProps=(t,o)=>__defProps(t,__getOwnPropDescs(o)),__async=(t,o,n)=>new Promise((r,e)=>{var c=l=>{try{s(n.next(l))}catch(h){e(h)}},p=l=>{try{s(n.throw(l))}catch(h){e(h)}},s=l=>l.done?r(l.value):Promise.resolve(l.value).then(c,p);s((n=n.apply(t,o)).next())});const DEFAULT_SCOPE=5,DEFAULT_RADIUS=90,PointCloudView={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},topViewPoint2PointCloud=(t,o,n,r,e)=>{const{x:c,y:p}=lbUtils.PointCloudUtils.transferCanvas2World(t,o),{defaultZ:s}=lbUtils.DEFAULT_SPHERE_PARAMS,l={center:{x:c,y:p,z:s},id:t.id},h=r?__spreadValues(__spreadValues({},r),l):__spreadProps(__spreadValues({},l),{attribute:"",valid:!0});return e&&Object.assign(h,e),h},topViewPolygon2PointCloud=(t,o,n,r,e,c)=>{let p=t.pointList.map(y=>lbUtils.PointCloudUtils.transferCanvas2World(y,o)),s=0,l=1,h={};if(n){const y=n.getSensesPointZAxisInPolygon(p,void 0,c);c&&y.fittedCoordinates.length>0&&(p=y.fittedCoordinates),s=(y.maxZ+y.minZ)/2,l=y.maxZ-y.minZ,h={count:y.zCount}}const[g,L,A]=p,U=lbAnnotation.MathUtils.getLineCenterPoint([g,A]),I=lbAnnotation.MathUtils.getLineLength(g,L),D=lbAnnotation.MathUtils.getLineLength(L,A),_=lbAnnotation.MathUtils.getRadiusFromQuadrangle(t.pointList);r&&(s=r.center.z,l=r.depth);const V={center:{x:U.x,y:U.y,z:s},width:D,height:I,depth:l,rotation:_,id:t.id},w=__spreadValues(r?__spreadValues(__spreadValues({},r),V):__spreadProps(__spreadValues({},V),{attribute:"",valid:!0}),h);e&&Object.assign(w,e);const O=p.map(y=>lbUtils.PointCloudUtils.transferWorld2Canvas(y,o));return{boxParams:w,newPointList:O}},sideViewPoint2PointCloud=(t,o,n)=>{const r={x:t.x-o.x,y:t.y-o.y};return __spreadProps(__spreadValues({},n),{center:{x:n.center.x-r.x,y:n.center.y,z:n.center.z-r.y}})},sideViewPolygon2PointCloud=(t,o,n,r)=>{const[e,c,p]=t.pointList,[s,l,h]=o.pointList,g=lbAnnotation.MathUtils.getLineCenterPoint([e,p]),L=lbAnnotation.MathUtils.getLineCenterPoint([s,h]),U={x:{x:g.x-L.x,y:g.y-L.y}.x,y:0,z:g.y-L.y},I=lbAnnotation.MathUtils.getLineLength(e,c),D=lbAnnotation.MathUtils.getLineLength(s,l),_=I-D,V=lbAnnotation.MathUtils.getLineLength(c,p),w=lbAnnotation.MathUtils.getLineLength(l,h),O=V-w,{newBoxParams:y}=r.getNewBoxBySideUpdate(U,O,_,n);return y},backViewPoint2PointCloud=(t,o,n)=>{const r={x:t.x-o.x,y:t.y-o.y};return __spreadProps(__spreadValues({},n),{center:{x:n.center.x,y:n.center.y-r.x,z:n.center.z-r.y}})},backViewPolygon2PointCloud=(t,o,n,r)=>{const[e,c,p]=t.pointList,[s,l,h]=o.pointList,g=lbAnnotation.MathUtils.getLineCenterPoint([e,p]),L=lbAnnotation.MathUtils.getLineCenterPoint([s,h]),U={x:{x:g.x-L.x,y:g.y-L.y}.x,y:0,z:g.y-L.y},I=lbAnnotation.MathUtils.getLineLength(e,c),D=lbAnnotation.MathUtils.getLineLength(s,l),_=I-D,V=lbAnnotation.MathUtils.getLineLength(c,p),w=lbAnnotation.MathUtils.getLineLength(l,h),O=V-w;let{newBoxParams:y}=r.getNewBoxByBackUpdate(U,O,_,n);return y},syncSideViewByPoint=(t,o,n,r,e)=>{var c;if(!n)return;const{toolInstance:p,pointCloudInstance:s}=n;s.loadPCDFile(r,(c=e==null?void 0:e.radius)!=null?c:DEFAULT_RADIUS);const{cameraPositionVector:l}=s.updateOrthoCameraBySphere(t,lbUtils.EPerspectiveView.Left);s.setInitCameraPosition(l);const{point2d:h,zoom:g}=s.getSphereSidePoint2DCoordinate(t);s.camera.zoom=g,s.camera.updateProjectionMatrix(),s.render(),p.initPosition(),p.zoomChangeOnCenter(g),p.setResult([__spreadProps(__spreadValues(__spreadValues({},o),h),{valid:t.valid,textAttribute:"",attribute:t.attribute})]),p.setSelectedID(o.id)},synchronizeSideView=(t,o,n,r)=>{if(!n)return;const{pointCloud2dOperation:e,pointCloudInstance:c}=n;c.loadPCDFileByBox(r,t,{width:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:p}=c.updateOrthoCamera(t,lbUtils.EPerspectiveView.Left);c.setInitCameraPosition(p);const{polygon2d:s,zoom:l}=c.getBoxSidePolygon2DCoordinate(t);c.camera.zoom=l,c.camera.updateProjectionMatrix(),c.render(),e.initPosition(),e.zoomChangeOnCenter(l),e.setResultAndSelectedID([{id:o.id,valid:t.valid,pointList:s,textAttribute:"",isRect:!0,attribute:t.attribute}],o.id)},syncBackViewByPoint=(t,o,n,r,e)=>{var c;if(!n)return;const{toolInstance:p,pointCloudInstance:s}=n;s.loadPCDFile(r,(c=e==null?void 0:e.radius)!=null?c:DEFAULT_RADIUS);const{cameraPositionVector:l}=s.updateOrthoCameraBySphere(t,lbUtils.EPerspectiveView.Back);s.setInitCameraPosition(l);const{point2d:h,zoom:g}=s.getSphereBackPoint2DCoordinate(t);s.camera.zoom=g,s.camera.updateProjectionMatrix(),s.render(),p.initPosition(),p.zoomChangeOnCenter(g),p.setResult([__spreadProps(__spreadValues(__spreadValues({},o),h),{valid:t.valid,textAttribute:"",attribute:t.attribute})]),p.setSelectedID(o.id)},synchronizeBackView=(t,o,n,r)=>{if(!n)return;const{pointCloud2dOperation:e,pointCloudInstance:c}=n;c.loadPCDFileByBox(r,t,{height:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:p}=c.updateOrthoCamera(t,lbUtils.EPerspectiveView.Back);c.setInitCameraPosition(p);const{polygon2d:s,zoom:l}=c.getBoxBackPolygon2DCoordinate(t);c.camera.zoom=l,c.camera.updateProjectionMatrix(),c.render(),e.initPosition(),e.zoomChangeOnCenter(l),e.setResultAndSelectedID([{id:o.id,valid:t.valid,pointList:s,textAttribute:"",isRect:!0,attribute:t.attribute}],o.id)},syncTopViewByPoint=(t,o,n,r)=>{if(!n||!r)return;r.generateSphere(t),r.updateCameraBySphere(t,lbUtils.EPerspectiveView.Top),r.render();const{toolInstance:e,pointCloudInstance:c}=n,{point2d:p}=c.getSphereTopPoint2DCoordinate(t),s=[...e.pointList].map(l=>l.id===o.id?__spreadProps(__spreadValues(__spreadValues({},o),p),{valid:t.valid,textAttribute:"",attribute:t.attribute}):l);e.setResult(s),e.setSelectedID(o.id)},synchronizeTopView=(t,o,n,r)=>{var e;if(!n||!r)return;r.generateBox(t,o.id),r.render();const{pointCloud2dOperation:c,pointCloudInstance:p}=n,{polygon2d:s}=p.getBoxTopPolygon2DCoordinate(t),l=[...c.polygonList],h=l.find(g=>g.id===o.id);h?h.pointList=s:l.push({id:o.id,pointList:s,textAttribute:"",isRect:!0,valid:(e=t.valid)!=null?e:!0}),c.setResultAndSelectedID(l,o.id)},usePointCloudViews=()=>{const t=React.useContext(PointCloudContext.PointCloudContext),{topViewInstance:o,sideViewInstance:n,backViewInstance:r,mainViewInstance:e,addPointCloudBox:c,addPointCloudSphere:p,setSelectedIDs:s,selectedIDs:l,pointCloudBoxList:h,pointCloudSphereList:g,hideAttributes:L}=t,{addHistory:A,initHistory:U,pushHistoryUnderUpdatePolygon:I,pushHistoryUnderUpdatePoint:D}=useHistory.useHistory(),{selectedPolygon:_}=usePolygon.usePolygon(),{updateSelectedBox:V,updateSelectedBoxes:w,getPointCloudByID:O}=useSingleBox.useSingleBox(),{getPointCloudSphereByID:y,updatePointCloudSphere:q,selectedSphere:T}=useSphere.useSphere(),{currentData:S,config:B}=ctx.useSelector(i=>{const{stepList:a,step:P,imgList:u,imgIndex:d}=i.annotation;return{currentData:u[d],config:index.jsonParser(StepUtils.getCurrentStepInfo(P,a).config)}}),H=ctx.useDispatch(),{selectedBox:j}=useSingleBox.useSingleBox(),{t:Z}=reactI18next.useTranslation(),N=j==null?void 0:j.info;if(!o||!n||!r)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:E}=o,G=i=>{e==null||e.generateBox(i),e==null||e.controls.update(),e==null||e.render()},X=i=>{e==null||e.generateSphere(i),e==null||e.controls.update(),e==null||e.render()},Y=({newPoint:i,size:a,zoom:P,trackConfigurable:u})=>{var d;const C={attribute:(d=o.toolInstance.defaultAttribute)!=null?d:""};u===!0&&Object.assign(C,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:g})});const f=topViewPoint2PointCloud(i,a,E,void 0,C);s(i.id);const x=p(f);z(PointCloudView.Top,i,f,P,x,B)},Q=({polygon:i,size:a,imgList:P,trackConfigurable:u,zoom:d,intelligentFit:C})=>{var f;const x={attribute:(f=o.toolInstance.defaultAttribute)!=null?f:""};u===!0&&Object.assign(x,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:h,extraSphereList:g})});const v=__spreadValues({},i),{boxParams:m,newPointList:k}=topViewPolygon2PointCloud(v,a,E,void 0,x,C),R=o==null?void 0:o.toolInstance;if((B==null?void 0:B.lowerLimitPointsNumInBox)&&typeof m.count=="number"&&m.count<B.lowerLimitPointsNumInBox){antd.message.info(Z("LowerLimitPointsNumInBox",{num:B.lowerLimitPointsNumInBox})),R.deletePolygon(m.id);return}C&&(k==null?void 0:k.length)&&(v.pointList=k);const b=L.includes(v.attribute),it=c(m);b?s([]):(s(m.id),R.setSelectedIDs([v.id]),M(PointCloudView.Top,v,m,d,it),C&&synchronizeTopView(m,v,o,e)),A({newBoxParams:m})},J=({newSelectedBox:i,newPointCloudList:a,newSelectedSphere:P,newSphereList:u})=>{const d=o==null?void 0:o.toolInstance;if(!(l.length===0||!d)){if(i||(j==null?void 0:j.info)){const C=i!=null?i:j==null?void 0:j.info;d.setSelectedIDs(l);const f=d.selectedPolygon;if(l.length===1&&C){M(PointCloudView.Top,f,C,void 0,a);return}}if((P||T)&&l.length===1){const C=P!=null?P:T;d.setSelectedID(l[0]);const f=d.selectedPoint;C&&z(PointCloudView.Top,f,C,void 0,u,B)}}},F=(i,a,P)=>{if(N){let u,d;switch(P){case PointCloudView.Back:u=backViewPolygon2PointCloud;break;case PointCloudView.Side:u=sideViewPolygon2PointCloud;break;default:u=sideViewPolygon2PointCloud;break}if(d=u(i,a,N,n.pointCloudInstance),e){const{count:f}=e.getSensesPointZAxisInPolygon(lbAnnotation.getCuboidFromPointCloudBox(d).polygonPointList,[d.center.z-d.depth/2,d.center.z+d.depth/2]);d=__spreadProps(__spreadValues({},d),{count:f})}const C=V(d);return M(P,i,d,void 0,C),C}},W=(i,a,P)=>{if(T){let u,d;switch(P){case PointCloudView.Back:u=backViewPoint2PointCloud;break;case PointCloudView.Side:u=sideViewPoint2PointCloud;break;default:u=sideViewPoint2PointCloud;break}d=u(i,a,T);const C=q(d);return z(P,i,d,void 0,C,B),C}},K=(i,a)=>{W(i,a,PointCloudView.Side)},$=(i,a)=>{W(i,a,PointCloudView.Back)},tt=(i,a)=>{F(i,a,PointCloudView.Side)},et=(i,a)=>{F(i,a,PointCloudView.Back)},ot=(i,a)=>{const{x:P,y:u}=lbUtils.PointCloudUtils.transferCanvas2World(i,a);D(__spreadProps(__spreadValues({},i),{x:P,y:u}));const d=y(i.id),C=topViewPoint2PointCloud(i,a,E,d),f=q(C);z(PointCloudView.Top,i,C,void 0,f,B)},nt=(i,a)=>{if(_){const u=i[0].newPolygon;u.pointList=u.pointList.map(d=>lbUtils.PointCloudUtils.transferCanvas2World(d,a)),I(i[0].newPolygon);return}const P=i.map(({newPolygon:u})=>{const d=O(u.id),{boxParams:C}=topViewPolygon2PointCloud(u,a,o.pointCloudInstance,d);return C});if(P.length===1){const{newPolygon:u}=i[0],d=w(P);M(PointCloudView.Top,u,P[0],void 0,d)}else{const u=w(P);u&&t.syncAllViewPointCloudColor(u)}},z=(i,a,P,u,d,C)=>__async(void 0,null,function*(){const f=S==null?void 0:S.url,x={[PointCloudView.Side]:()=>{syncSideViewByPoint(P,a,n,f,C)},[PointCloudView.Back]:()=>{r&&syncBackViewByPoint(P,a,r,f,C)},[PointCloudView.Top]:()=>{syncTopViewByPoint(P,a,o,e)}};Object.keys(x).forEach(v=>{v!==i&&x[v]()}),u&&(e==null||e.updateCameraZoom(u)),X(P)}),M=(i,a,P,u,d)=>__async(void 0,null,function*(){const C=S==null?void 0:S.url;d&&(yield t.syncAllViewPointCloudColor(d));const f={[PointCloudView.Side]:()=>{synchronizeSideView(P,a,n,C)},[PointCloudView.Back]:()=>{r&&synchronizeBackView(P,a,r,C)},[PointCloudView.Top]:()=>{synchronizeTopView(P,a,o,e)}};Object.keys(f).forEach(x=>{x!==i&&f[x]()}),u&&(e==null||e.updateCameraZoom(u)),G(P)});return{topViewAddSphere:Y,topViewAddBox:Q,topViewSelectedChanged:J,topViewUpdatePoint:ot,sideViewUpdatePoint:K,backViewUpdatePoint:$,topViewUpdateBox:nt,sideViewUpdateBox:tt,backViewUpdateBox:et,pointCloudBoxListUpdated:i=>{o.updatePolygonList(i),e==null||e.generateBoxes(i)},initPointCloud3d:i=>{if(!e)return;const a={left:-i.width/2,right:i.width/2,top:i.height/2,bottom:-i.height/2,near:100,far:-100};e.initOrthographicCamera(a),e.initRenderer(),e.render()},updatePointCloudData:(...i)=>__async(void 0,[...i],function*(a=S){var P,u,d,C,f,x;if(!(a==null?void 0:a.url)||!e)return;actionCreators.SetPointCloudLoading(H,!0),yield e.loadPCDFile(a.url,(P=B==null?void 0:B.radius)!=null?P:DEFAULT_RADIUS),h.forEach(b=>{e==null||e.removeObjectByName(b.id)}),g.forEach(b=>{e==null||e.removeObjectByName(b.id)});let v=[],m=[],k=[];S.result?(v=lbUtils.PointCloudUtils.getBoxParamsFromResultList(S.result),m=lbUtils.PointCloudUtils.getPolygonListFromResultList(S.result),k=lbUtils.PointCloudUtils.getSphereParamsFromResultList(S.result),v.forEach(b=>{e==null||e.generateBox(b)}),k.forEach(b=>{e==null||e.generateSphere(b)}),t.syncAllViewPointCloudColor(v),t.setPointCloudResult(v),t.setPolygonList(m),t.setPointCloudSphereList(k)):(t.setPointCloudResult([]),t.setPolygonList([]),t.setPointCloudSphereList([])),U({pointCloudBoxList:v,polygonList:m}),e.updateTopCamera();const R=(d=(u=index.jsonParser(a.result))==null?void 0:u.valid)!=null?d:!0;t.setPointCloudValid(R),(C=t.sideViewInstance)==null||C.clearAllData(),(f=t.backViewInstance)==null||f.clearAllData(),o.updateData(a.url,a.result,{radius:(x=B==null?void 0:B.radius)!=null?x:DEFAULT_RADIUS}),actionCreators.SetPointCloudLoading(H,!1)})}};exports.syncBackViewByPoint=syncBackViewByPoint,exports.syncSideViewByPoint=syncSideViewByPoint,exports.syncTopViewByPoint=syncTopViewByPoint,exports.synchronizeBackView=synchronizeBackView,exports.synchronizeSideView=synchronizeSideView,exports.synchronizeTopView=synchronizeTopView,exports.topViewPoint2PointCloud=topViewPoint2PointCloud,exports.topViewPolygon2PointCloud=topViewPolygon2PointCloud,exports.usePointCloudViews=usePointCloudViews;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),React=require("react"),PointCloudContext=require("../PointCloudContext.js"),useSingleBox=require("./useSingleBox.js"),useSphere=require("./useSphere.js"),ctx=require("../../../store/ctx.js"),StepUtils=require("../../../utils/StepUtils.js"),index=require("../../../utils/index.js"),actionCreators=require("../../../store/annotation/actionCreators.js"),antd=require("antd"),reactI18next=require("react-i18next"),useHistory=require("./useHistory.js"),usePolygon=require("./usePolygon.js"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,o,i)=>o in t?__defProp(t,o,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[o]=i,__spreadValues=(t,o)=>{for(var i in o||(o={}))__hasOwnProp.call(o,i)&&__defNormalProp(t,i,o[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(o))__propIsEnum.call(o,i)&&__defNormalProp(t,i,o[i]);return t},__spreadProps=(t,o)=>__defProps(t,__getOwnPropDescs(o)),__async=(t,o,i)=>new Promise((r,e)=>{var c=l=>{try{s(i.next(l))}catch(h){e(h)}},p=l=>{try{s(i.throw(l))}catch(h){e(h)}},s=l=>l.done?r(l.value):Promise.resolve(l.value).then(c,p);s((i=i.apply(t,o)).next())});const DEFAULT_SCOPE=5,DEFAULT_RADIUS=90,PointCloudView={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},topViewPoint2PointCloud=(t,o,i,r,e)=>{const{x:c,y:p}=lbUtils.PointCloudUtils.transferCanvas2World(t,o),{defaultZ:s}=lbUtils.DEFAULT_SPHERE_PARAMS,l={center:{x:c,y:p,z:s},id:t.id},h=r?__spreadValues(__spreadValues({},r),l):__spreadProps(__spreadValues({},l),{attribute:"",valid:!0});return e&&Object.assign(h,e),h},topViewPolygon2PointCloud=(t,o,i,r,e,c)=>{let p=t.pointList.map(y=>lbUtils.PointCloudUtils.transferCanvas2World(y,o)),s=0,l=1,h={};if(i){const y=i.getSensesPointZAxisInPolygon(p,void 0,c);c&&y.fittedCoordinates.length>0&&(p=y.fittedCoordinates),s=(y.maxZ+y.minZ)/2,l=y.maxZ-y.minZ,h={count:y.zCount}}const[g,x,_]=p,V=lbAnnotation.MathUtils.getLineCenterPoint([g,_]),O=lbAnnotation.MathUtils.getLineLength(g,x),k=lbAnnotation.MathUtils.getLineLength(x,_),A=lbAnnotation.MathUtils.getRadiusFromQuadrangle(t.pointList);r&&(s=r.center.z,l=r.depth);const I={center:{x:V.x,y:V.y,z:s},width:k,height:O,depth:l,rotation:A,id:t.id},S=__spreadValues(r?__spreadValues(__spreadValues({},r),I):__spreadProps(__spreadValues({},I),{attribute:"",valid:!0}),h);e&&Object.assign(S,e);const j=p.map(y=>lbUtils.PointCloudUtils.transferWorld2Canvas(y,o));return{boxParams:S,newPointList:j}},sideViewPoint2PointCloud=(t,o,i)=>{const r={x:t.x-o.x,y:t.y-o.y};return __spreadProps(__spreadValues({},i),{center:{x:i.center.x-r.x,y:i.center.y,z:i.center.z-r.y}})},sideViewPolygon2PointCloud=(t,o,i,r)=>{const[e,c,p]=t.pointList,[s,l,h]=o.pointList,g=lbAnnotation.MathUtils.getLineCenterPoint([e,p]),x=lbAnnotation.MathUtils.getLineCenterPoint([s,h]),V={x:{x:g.x-x.x,y:g.y-x.y}.x,y:0,z:g.y-x.y},O=lbAnnotation.MathUtils.getLineLength(e,c),k=lbAnnotation.MathUtils.getLineLength(s,l),A=O-k,I=lbAnnotation.MathUtils.getLineLength(c,p),S=lbAnnotation.MathUtils.getLineLength(l,h),j=I-S,{newBoxParams:y}=r.getNewBoxBySideUpdate(V,j,A,i);return y},backViewPoint2PointCloud=(t,o,i)=>{const r={x:t.x-o.x,y:t.y-o.y};return __spreadProps(__spreadValues({},i),{center:{x:i.center.x,y:i.center.y-r.x,z:i.center.z-r.y}})},backViewPolygon2PointCloud=(t,o,i,r)=>{const[e,c,p]=t.pointList,[s,l,h]=o.pointList,g=lbAnnotation.MathUtils.getLineCenterPoint([e,p]),x=lbAnnotation.MathUtils.getLineCenterPoint([s,h]),V={x:{x:g.x-x.x,y:g.y-x.y}.x,y:0,z:g.y-x.y},O=lbAnnotation.MathUtils.getLineLength(e,c),k=lbAnnotation.MathUtils.getLineLength(s,l),A=O-k,I=lbAnnotation.MathUtils.getLineLength(c,p),S=lbAnnotation.MathUtils.getLineLength(l,h),j=I-S;let{newBoxParams:y}=r.getNewBoxByBackUpdate(V,j,A,i);return y},syncSideViewByPoint=(t,o,i,r,e)=>{var c;if(!i)return;const{toolInstance:p,pointCloudInstance:s}=i;s.loadPCDFile(r,(c=e==null?void 0:e.radius)!=null?c:DEFAULT_RADIUS);const{cameraPositionVector:l}=s.updateOrthoCameraBySphere(t,lbUtils.EPerspectiveView.Left);s.setInitCameraPosition(l);const{point2d:h,zoom:g}=s.getSphereSidePoint2DCoordinate(t);s.camera.zoom=g,s.camera.updateProjectionMatrix(),s.render(),p.initPosition(),p.zoomChangeOnCenter(g),p.setResult([__spreadProps(__spreadValues(__spreadValues({},o),h),{valid:t.valid,textAttribute:"",attribute:t.attribute})]),p.setSelectedID(o.id)},synchronizeSideView=(t,o,i,r)=>{if(!i)return;const{pointCloud2dOperation:e,pointCloudInstance:c}=i;c.loadPCDFileByBox(r,t,{width:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:p}=c.updateOrthoCamera(t,lbUtils.EPerspectiveView.Left);c.setInitCameraPosition(p);const{polygon2d:s,zoom:l}=c.getBoxSidePolygon2DCoordinate(t);c.camera.zoom=l,c.camera.updateProjectionMatrix(),c.render(),e.initPosition(),e.zoomChangeOnCenter(l),e.setResultAndSelectedID([{id:o.id,valid:t.valid,pointList:s,textAttribute:"",isRect:!0,attribute:t.attribute}],o.id)},syncBackViewByPoint=(t,o,i,r,e)=>{var c;if(!i)return;const{toolInstance:p,pointCloudInstance:s}=i;s.loadPCDFile(r,(c=e==null?void 0:e.radius)!=null?c:DEFAULT_RADIUS);const{cameraPositionVector:l}=s.updateOrthoCameraBySphere(t,lbUtils.EPerspectiveView.Back);s.setInitCameraPosition(l);const{point2d:h,zoom:g}=s.getSphereBackPoint2DCoordinate(t);s.camera.zoom=g,s.camera.updateProjectionMatrix(),s.render(),p.initPosition(),p.zoomChangeOnCenter(g),p.setResult([__spreadProps(__spreadValues(__spreadValues({},o),h),{valid:t.valid,textAttribute:"",attribute:t.attribute})]),p.setSelectedID(o.id)},synchronizeBackView=(t,o,i,r)=>{if(!i)return;const{pointCloud2dOperation:e,pointCloudInstance:c}=i;c.loadPCDFileByBox(r,t,{height:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:p}=c.updateOrthoCamera(t,lbUtils.EPerspectiveView.Back);c.setInitCameraPosition(p);const{polygon2d:s,zoom:l}=c.getBoxBackPolygon2DCoordinate(t);c.camera.zoom=l,c.camera.updateProjectionMatrix(),c.render(),e.initPosition(),e.zoomChangeOnCenter(l),e.setResultAndSelectedID([{id:o.id,valid:t.valid,pointList:s,textAttribute:"",isRect:!0,attribute:t.attribute}],o.id)},syncTopViewByPoint=(t,o,i,r)=>{if(!i||!r)return;r.generateSphere(t),r.updateCameraBySphere(t,lbUtils.EPerspectiveView.Top),r.render();const{toolInstance:e,pointCloudInstance:c}=i,{point2d:p}=c.getSphereTopPoint2DCoordinate(t),s=[...e.pointList].map(l=>l.id===o.id?__spreadProps(__spreadValues(__spreadValues({},o),p),{valid:t.valid,textAttribute:"",attribute:t.attribute}):l);e.setResult(s),e.setSelectedID(o.id)},synchronizeTopView=(t,o,i,r)=>{var e;if(!i||!r)return;r.generateBox(t,o.id),r.render();const{pointCloud2dOperation:c,pointCloudInstance:p}=i,{polygon2d:s}=p.getBoxTopPolygon2DCoordinate(t),l=[...c.polygonList],h=l.find(g=>g.id===o.id);h?h.pointList=s:l.push({id:o.id,pointList:s,textAttribute:"",isRect:!0,valid:(e=t.valid)!=null?e:!0}),c.setResultAndSelectedID(l,o.id)},usePointCloudViews=()=>{const t=React.useContext(PointCloudContext.PointCloudContext),{topViewInstance:o,sideViewInstance:i,backViewInstance:r,mainViewInstance:e,addPointCloudBox:c,addPointCloudSphere:p,setSelectedIDs:s,selectedIDs:l,pointCloudBoxList:h,pointCloudSphereList:g,hideAttributes:x}=t,{addHistory:_,initHistory:V,pushHistoryUnderUpdatePolygon:O,pushHistoryUnderUpdateLine:k}=useHistory.useHistory(),{selectedPolygon:A}=usePolygon.usePolygon(),{updateSelectedBox:I,updateSelectedBoxes:S,getPointCloudByID:j}=useSingleBox.useSingleBox(),{getPointCloudSphereByID:y,updatePointCloudSphere:H,selectedSphere:z}=useSphere.useSphere(),{currentData:w,config:L}=ctx.useSelector(n=>{const{stepList:a,step:P,imgList:u,imgIndex:d}=n.annotation;return{currentData:u[d],config:index.jsonParser(StepUtils.getCurrentStepInfo(P,a).config)}}),F=ctx.useDispatch(),{selectedBox:T}=useSingleBox.useSingleBox(),{t:G}=reactI18next.useTranslation(),N=T==null?void 0:T.info;if(!o||!i||!r)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:E}=o,Q=n=>{e==null||e.generateBox(n),e==null||e.controls.update(),e==null||e.render()},X=n=>{e==null||e.generateSphere(n),e==null||e.controls.update(),e==null||e.render()},Y=({newPoint:n,size:a,zoom:P,trackConfigurable:u})=>{var d;const C={attribute:(d=o.toolInstance.defaultAttribute)!=null?d:""};u===!0&&Object.assign(C,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:g})});const f=topViewPoint2PointCloud(n,a,E,void 0,C);s(n.id);const v=p(f);M(PointCloudView.Top,n,f,P,v,L),_({newSphereParams:f})},J=({polygon:n,size:a,imgList:P,trackConfigurable:u,zoom:d,intelligentFit:C})=>{var f;const v={attribute:(f=o.toolInstance.defaultAttribute)!=null?f:""};u===!0&&Object.assign(v,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:h,extraSphereList:g})});const m=o==null?void 0:o.toolInstance,b=__spreadValues({},n),{boxParams:B,newPointList:D}=topViewPolygon2PointCloud(b,a,E,void 0,v,C);if((L==null?void 0:L.lowerLimitPointsNumInBox)&&typeof B.count=="number"&&B.count<L.lowerLimitPointsNumInBox){antd.message.info(G("LowerLimitPointsNumInBox",{num:L.lowerLimitPointsNumInBox})),m.deletePolygon(B.id);return}C&&(D==null?void 0:D.length)&&(b.pointList=D);const q=x.includes(b.attribute),U=c(B);q?s([]):(s(B.id),m.setSelectedIDs([b.id]),R(PointCloudView.Top,b,B,d,U),C&&synchronizeTopView(B,b,o,e)),_({newBoxParams:B})},K=({newSelectedBox:n,newPointCloudList:a,newSelectedSphere:P,newSphereList:u})=>{const d=o==null?void 0:o.toolInstance;if(!(l.length===0||!d)){if(n||(T==null?void 0:T.info)){const C=n!=null?n:T==null?void 0:T.info;d.setSelectedIDs(l);const f=d.selectedPolygon;if(l.length===1&&C){R(PointCloudView.Top,f,C,void 0,a);return}}if((P||z)&&l.length===1){const C=P!=null?P:z;d.setSelectedID(l[0]);const f=d.selectedPoint;C&&M(PointCloudView.Top,f,C,void 0,u,L)}}},Z=(n,a,P)=>{if(N){let u,d;switch(P){case PointCloudView.Back:u=backViewPolygon2PointCloud;break;case PointCloudView.Side:u=sideViewPolygon2PointCloud;break;default:u=sideViewPolygon2PointCloud;break}if(d=u(n,a,N,i.pointCloudInstance),e){const{count:f}=e.getSensesPointZAxisInPolygon(lbAnnotation.getCuboidFromPointCloudBox(d).polygonPointList,[d.center.z-d.depth/2,d.center.z+d.depth/2]);d=__spreadProps(__spreadValues({},d),{count:f})}const C=I(d);return R(P,n,d,void 0,C),C}},W=(n,a,P)=>{if(z){let u,d;switch(P){case PointCloudView.Back:u=backViewPoint2PointCloud;break;case PointCloudView.Side:u=sideViewPoint2PointCloud;break;default:u=sideViewPoint2PointCloud;break}d=u(n,a,z);const C=H(d);return M(P,n,d,void 0,C,L),C}},$=(n,a)=>{W(n,a,PointCloudView.Side)},tt=(n,a)=>{W(n,a,PointCloudView.Back)},et=(n,a)=>{Z(n,a,PointCloudView.Side)},ot=(n,a)=>{Z(n,a,PointCloudView.Back)},it=(n,a)=>{k(n)},nt=(n,a)=>{const P=y(n.id),u=topViewPoint2PointCloud(n,a,E,P),d=H(u);M(PointCloudView.Top,n,u,void 0,d,L)},st=(n,a)=>{if(A){const u=n[0].newPolygon;u.pointList=u.pointList.map(d=>lbUtils.PointCloudUtils.transferCanvas2World(d,a)),O(n[0].newPolygon);return}const P=n.map(({newPolygon:u})=>{const d=j(u.id),{boxParams:C}=topViewPolygon2PointCloud(u,a,o.pointCloudInstance,d);return C});if(P.length===1){const{newPolygon:u}=n[0],d=S(P);R(PointCloudView.Top,u,P[0],void 0,d)}else{const u=S(P);u&&t.syncAllViewPointCloudColor(u)}},M=(n,a,P,u,d,C)=>__async(void 0,null,function*(){const f=w==null?void 0:w.url,v={[PointCloudView.Side]:()=>{syncSideViewByPoint(P,a,i,f,C)},[PointCloudView.Back]:()=>{r&&syncBackViewByPoint(P,a,r,f,C)},[PointCloudView.Top]:()=>{syncTopViewByPoint(P,a,o,e)}};Object.keys(v).forEach(m=>{m!==n&&v[m]()}),u&&(e==null||e.updateCameraZoom(u)),X(P)}),R=(n,a,P,u,d)=>__async(void 0,null,function*(){const C=w==null?void 0:w.url;d&&(yield t.syncAllViewPointCloudColor(d));const f={[PointCloudView.Side]:()=>{synchronizeSideView(P,a,i,C)},[PointCloudView.Back]:()=>{r&&synchronizeBackView(P,a,r,C)},[PointCloudView.Top]:()=>{synchronizeTopView(P,a,o,e)}};Object.keys(f).forEach(v=>{v!==n&&f[v]()}),u&&(e==null||e.updateCameraZoom(u)),Q(P)});return{topViewAddSphere:Y,topViewAddBox:J,topViewSelectedChanged:K,topViewUpdatePoint:nt,sideViewUpdatePoint:$,backViewUpdatePoint:tt,topViewUpdateBox:st,topViewUpdateLine:it,sideViewUpdateBox:et,backViewUpdateBox:ot,pointCloudBoxListUpdated:n=>{o.updatePolygonList(n),e==null||e.generateBoxes(n)},initPointCloud3d:n=>{if(!e)return;const a={left:-n.width/2,right:n.width/2,top:n.height/2,bottom:-n.height/2,near:100,far:-100};e.initOrthographicCamera(a),e.initRenderer(),e.render()},updatePointCloudData:(...n)=>__async(void 0,[...n],function*(a=w){var P,u,d,C,f,v;if(!(a==null?void 0:a.url)||!e)return;actionCreators.SetPointCloudLoading(F,!0),yield e.loadPCDFile(a.url,(P=L==null?void 0:L.radius)!=null?P:DEFAULT_RADIUS),h.forEach(U=>{e==null||e.removeObjectByName(U.id)}),g.forEach(U=>{e==null||e.removeObjectByName(U.id)});let m=[],b=[],B=[],D=[];w.result?(m=lbUtils.PointCloudUtils.getBoxParamsFromResultList(w.result),B=lbUtils.PointCloudUtils.getPolygonListFromResultList(w.result),b=lbUtils.PointCloudUtils.getLineListFromResultList(w.result),D=lbUtils.PointCloudUtils.getSphereParamsFromResultList(w.result),m.forEach(U=>{e==null||e.generateBox(U)}),D.forEach(U=>{e==null||e.generateSphere(U)}),t.syncAllViewPointCloudColor(m),t.setPointCloudResult(m),t.setPolygonList(B),t.setLineList(b),t.setPointCloudSphereList(D)):(t.setPointCloudResult([]),t.setPolygonList([]),t.setPointCloudSphereList([]),t.setLineList([])),V({pointCloudBoxList:m,polygonList:B,pointCloudSphereList:D}),e.updateTopCamera();const q=(d=(u=index.jsonParser(a.result))==null?void 0:u.valid)!=null?d:!0;t.setPointCloudValid(q),(C=t.sideViewInstance)==null||C.clearAllData(),(f=t.backViewInstance)==null||f.clearAllData(),o.updateData(a.url,a.result,{radius:(v=L==null?void 0:L.radius)!=null?v:DEFAULT_RADIUS}),actionCreators.SetPointCloudLoading(F,!1)})}};exports.syncBackViewByPoint=syncBackViewByPoint,exports.syncSideViewByPoint=syncSideViewByPoint,exports.syncTopViewByPoint=syncTopViewByPoint,exports.synchronizeBackView=synchronizeBackView,exports.synchronizeSideView=synchronizeSideView,exports.synchronizeTopView=synchronizeTopView,exports.topViewPoint2PointCloud=topViewPoint2PointCloud,exports.topViewPolygon2PointCloud=topViewPolygon2PointCloud,exports.usePointCloudViews=usePointCloudViews;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),PointCloudContext=require("../PointCloudContext.js"),_=require("lodash");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var ___default=_interopDefaultLegacy(_);const useSphere=()=>{const{pointCloudSphereList:e,setPointCloudSphereList:u,selectedID:i,mainViewInstance:r}=React.useContext(PointCloudContext.PointCloudContext),l=React.useMemo(()=>e.find(t=>t.id===i),[i,e]),d=React.useCallback(t=>e.find(n=>n.id===t),[e]),s=React.useCallback(t=>{const n=e.findIndex(o=>o.id===t.id);if(n>-1){e.splice(n,1,___default.default.merge(e[n],t));const o=___default.default.cloneDeep(e);return u(o),o}return e},[e]),c=React.useCallback(t=>{const n=e.filter(o=>o.id!==t);u(n),r==null||r.removeObjectByName(t),r==null||r.render()},[e]);return{selectedSphere:l,getPointCloudSphereByID:d,updatePointCloudSphere:s,deletePointCloudSphere:c}};exports.useSphere=useSphere;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),PointCloudContext=require("../PointCloudContext.js"),_=require("lodash"),useHistory=require("./useHistory.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var ___default=_interopDefaultLegacy(_);const useSphere=()=>{const{pointCloudSphereList:e,setPointCloudSphereList:u,selectedID:i,mainViewInstance:n}=React.useContext(PointCloudContext.PointCloudContext),{pushHistoryWithList:s}=useHistory.useHistory(),l=React.useMemo(()=>e.find(t=>t.id===i),[i,e]),d=React.useCallback(t=>e.find(o=>o.id===t),[e]),c=React.useCallback(t=>{const o=e.findIndex(r=>r.id===t.id);if(o>-1){e.splice(o,1,___default.default.merge(e[o],t));const r=___default.default.cloneDeep(e);return u(r),s({pointCloudSphereList:r}),r}return e},[e]),a=React.useCallback(t=>{const o=e.filter(r=>r.id!==t);u(o),n==null||n.removeObjectByName(t),n==null||n.render()},[e]);return{selectedSphere:l,getPointCloudSphereByID:d,updatePointCloudSphere:c,deletePointCloudSphere:a}};exports.useSphere=useSphere;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),PointCloudContext=require("../PointCloudContext.js"),lbAnnotation=require("@labelbee/lb-annotation"),useHistory=require("./useHistory.js");const{EToolName,EPolygonPattern}=lbAnnotation.cTool,useStatus=()=>{const{topViewInstance:i,sideViewInstance:r,backViewInstance:a,mainViewInstance:t,pointCloudBoxList:c,pointCloudSphereList:d,setPointCloudResult:P,setPointCloudSphereList:C,setPolygonList:v,pointCloudPattern:u,setPointCloudPattern:n,syncAllViewPointCloudColor:h}=React.useContext(PointCloudContext.PointCloudContext),{pushHistoryWithList:y}=useHistory.useHistory(),p=()=>{c.forEach(e=>{t==null||t.removeObjectByName(e.id)}),d.forEach(e=>{t==null||t.removeObjectByName(e.id)}),t==null||t.render(),P([]),v([]),C([]),i==null||i.toolScheduler.clearStatusAndResult(),h([]),y({pointCloudBoxList:[],polygonList:[]})},l=()=>{r==null||r.toolInstance.clearResult(),a==null||a.toolInstance.clearResult()};return{clearAllResult:p,updatePointCloudPattern:e=>{if(e===u)return;const s=[i,r,a];switch(e){case EToolName.Rect:l(),s.forEach(o=>{o==null||o.switchToCanvas(EToolName.PointCloudPolygon),o==null||o.toolInstance.setPattern(EPolygonPattern.Rect)}),n(EToolName.Rect);break;case EToolName.Polygon:l(),s.forEach(o=>{o==null||o.switchToCanvas(EToolName.PointCloudPolygon),o==null||o.toolInstance.setPattern(EPolygonPattern.Normal)}),n(EToolName.Polygon);break;case EToolName.Point:l(),s.forEach(o=>{o==null||o.switchToCanvas(EToolName.Point)}),n(EToolName.Point);break;case EToolName.Line:l(),s.forEach(o=>{o==null||o.switchToCanvas(EToolName.Line)}),n(EToolName.Line);break}},pointCloudPattern:u}};exports.useStatus=useStatus;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),PointCloudContext=require("../PointCloudContext.js"),lbAnnotation=require("@labelbee/lb-annotation"),useHistory=require("./useHistory.js");const{EToolName,EPolygonPattern}=lbAnnotation.cTool,useStatus=()=>{const{topViewInstance:i,sideViewInstance:r,backViewInstance:u,mainViewInstance:t,pointCloudBoxList:c,pointCloudSphereList:d,setPointCloudResult:P,setPointCloudSphereList:C,setPolygonList:v,pointCloudPattern:a,setPointCloudPattern:n,syncAllViewPointCloudColor:h}=React.useContext(PointCloudContext.PointCloudContext),{pushHistoryWithList:p}=useHistory.useHistory(),y=()=>{c.forEach(e=>{t==null||t.removeObjectByName(e.id)}),d.forEach(e=>{t==null||t.removeObjectByName(e.id)}),t==null||t.render(),P([]),v([]),C([]),i==null||i.toolScheduler.clearStatusAndResult(),h([]),p({pointCloudBoxList:[],polygonList:[],pointCloudSphereList:[]})},l=()=>{r==null||r.toolInstance.clearResult(),u==null||u.toolInstance.clearResult()};return{clearAllResult:y,updatePointCloudPattern:e=>{if(e===a)return;const s=[i,r,u];switch(e){case EToolName.Rect:l(),s.forEach(o=>{o==null||o.switchToCanvas(EToolName.PointCloudPolygon),o==null||o.toolInstance.setPattern(EPolygonPattern.Rect)}),n(EToolName.Rect);break;case EToolName.Polygon:l(),s.forEach(o=>{o==null||o.switchToCanvas(EToolName.PointCloudPolygon),o==null||o.toolInstance.setPattern(EPolygonPattern.Normal)}),n(EToolName.Polygon);break;case EToolName.Point:l(),s.forEach(o=>{o==null||o.switchToCanvas(EToolName.Point)}),n(EToolName.Point);break;case EToolName.Line:l(),s.forEach(o=>{o==null||o.switchToCanvas(EToolName.Line)}),n(EToolName.Line);break}},pointCloudPattern:a}};exports.useStatus=useStatus;
@@ -1 +1 @@
1
- "use strict";var antd=require("antd"),React=require("react"),reactI18next=require("react-i18next"),reactRedux=require("react-redux"),icon=require("../../../assets/predictTracking/icon.svg.js"),useSingleBox=require("../../pointCloudView/hooks/useSingleBox.js"),actionCreators=require("../../../store/annotation/actionCreators.js"),ctx=require("../../../store/ctx.js"),util=require("../previewResult/util.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__async=(e,i,t)=>new Promise((s,o)=>{var l=r=>{try{n(t.next(r))}catch(a){o(a)}},c=r=>{try{n(t.throw(r))}catch(a){o(a)}},n=r=>r.done?s(r.value):Promise.resolve(r.value).then(l,c);n((t=t.apply(e,i)).next())});const PredictTrackingIcon=e=>{const i=ctx.useDispatch(),{t}=reactI18next.useTranslation(),{loading:s}=e,{selectedBox:o}=useSingleBox.useSingleBox(),l=()=>__async(void 0,null,function*(){if(s)return;const c=o==null?void 0:o.info.trackID;if(!c){antd.message.error(t("BeforePredictStarting"));return}yield i(actionCreators.ChangeSave);const n=yield i(actionCreators.GetBoxesByID(c));if(n.length<2){antd.message.error(t("BeforePredictStarting"));return}const r=n[n.length-2],a=n[n.length-1],u=a.index-r.index;if(u<2){antd.message.error(t("BeforePredictStarting"));return}if(u>8){antd.message.error(t("ThePredictedPointCloud"));return}actionCreators.SetPointCloudLoading(i,!0);const d=util.predict(r,a);actionCreators.SetPredictResult(i,d),actionCreators.SetPredictResultVisible(i,!0)});return React__default.default.createElement(antd.Button,{type:"link",onClick:l,style:{display:"flex",flexDirection:"column",height:"auto",alignItems:"center"}},React__default.default.createElement("img",{src:icon,style:{alignSelf:"center"}}),React__default.default.createElement("span",{style:{color:"#797979"}},t("ComplementaryTracking")))},mapStateToProps=e=>({loading:e.annotation.loading});var PredictTrackingIcon$1=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(PredictTrackingIcon);module.exports=PredictTrackingIcon$1;
1
+ "use strict";var antd=require("antd"),React=require("react"),reactI18next=require("react-i18next"),reactRedux=require("react-redux"),icon=require("../../../assets/predictTracking/icon.svg.js"),useSingleBox=require("../../pointCloudView/hooks/useSingleBox.js"),actionCreators=require("../../../store/annotation/actionCreators.js"),ctx=require("../../../store/ctx.js"),util=require("../previewResult/util.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var React__default=_interopDefaultLegacy(React),__async=(t,n,r)=>new Promise((c,a)=>{var l=e=>{try{i(r.next(e))}catch(o){a(o)}},s=e=>{try{i(r.throw(e))}catch(o){a(o)}},i=e=>e.done?c(e.value):Promise.resolve(e.value).then(l,s);i((r=r.apply(t,n)).next())});const PredictTrackingIcon=t=>{const n=ctx.useDispatch(),{t:r}=reactI18next.useTranslation(),{loading:c}=t,{selectedBox:a}=useSingleBox.useSingleBox(),l=()=>__async(void 0,null,function*(){if(c)return;const s=a==null?void 0:a.info.trackID;if(!s){antd.message.error(r("BeforePredictStarting"));return}yield n(actionCreators.ChangeSave);const i=a==null?void 0:a.info.id,e=yield n(actionCreators.GetBoxesByID(s,i));if(e.length<2){antd.message.error(r("MarkOnlyOne"));return}const o=e.findIndex(g=>g.id===i),u=e[o-1],d=e[o],f=d.index-u.index;if(f<2){antd.message.error(r("HaveNoNeed"));return}if(f>8){antd.message.error(r("ThePredictedPointCloud"));return}antd.message.success(r("PredictingDataFrom",{startPage:u.index+1,endPage:d.index+1,selectedBoxTrackID:s})),actionCreators.SetPointCloudLoading(n,!0);const x=util.predict(u,d);actionCreators.SetPredictResult(n,x),actionCreators.SetPredictResultVisible(n,!0)});return React__default.default.createElement(antd.Button,{type:"link",onClick:l,style:{display:"flex",flexDirection:"column",height:"auto",alignItems:"center"}},React__default.default.createElement("img",{src:icon,style:{alignSelf:"center"}}),React__default.default.createElement("span",{style:{color:"#797979"}},r("ComplementaryTracking")))},mapStateToProps=t=>({loading:t.annotation.loading});var PredictTrackingIcon$1=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(PredictTrackingIcon);module.exports=PredictTrackingIcon$1;
@@ -1 +1 @@
1
- "use strict";var classNames=require("classnames"),React=require("react"),reactI18next=require("react-i18next"),reactRedux=require("react-redux"),PointCloudContext=require("../../pointCloudView/PointCloudContext.js"),actionCreators=require("../../../store/annotation/actionCreators.js"),ctx=require("../../../store/ctx.js"),dom=require("../../../utils/dom.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),util=require("./util.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var classNames__default=_interopDefaultLegacy(classNames),React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,a)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,__spreadValues=(e,t)=>{for(var a in t||(t={}))__hasOwnProp.call(t,a)&&__defNormalProp(e,a,t[a]);if(__getOwnPropSymbols)for(var a of __getOwnPropSymbols(t))__propIsEnum.call(t,a)&&__defNormalProp(e,a,t[a]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t)),__async=(e,t,a)=>new Promise((c,n)=>{var o=l=>{try{i(a.next(l))}catch(s){n(s)}},r=l=>{try{i(a.throw(l))}catch(s){n(s)}},i=l=>l.done?c(l.value):Promise.resolve(l.value).then(o,r);i((a=a.apply(e,t)).next())});const PreviewResult=e=>{const{predictionResult:t,predictionResultVisible:a,imgList:c}=e,[n,o]=React.useState([]),r=ctx.useDispatch(),{t:i}=reactI18next.useTranslation(),l=()=>{actionCreators.SetPredictResultVisible(r,!1),actionCreators.SetPredictResult(r,[]),o([])},s=()=>__async(void 0,null,function*(){actionCreators.SetPointCloudLoading(r,!0),yield r(actionCreators.BatchUpdateImgListResultByPredictResult()),actionCreators.SetPointCloudLoading(r,!1),l()});return a?React__default.default.createElement(React__default.default.Fragment,null,n.length>0&&React__default.default.createElement("div",{className:dom.getClassName("point-cloud-predict-tracking-container")},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-predict-tracking-container","bar")},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-predict-tracking-container","title")},React__default.default.createElement("div",null,i("ComplementaryTrackingPrediction"),n.length>0?`\uFF08${n.length}\uFF09`:""),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-predict-tracking-container","option")},React__default.default.createElement("div",{className:classNames__default.default([dom.getClassName("point-cloud-predict-tracking-container","cancelOption"),dom.getClassName("point-cloud-predict-tracking-container","button")]),onClick:l},i("Cancel")),React__default.default.createElement("div",{className:classNames__default.default([dom.getClassName("point-cloud-predict-tracking-container","okOption"),dom.getClassName("point-cloud-predict-tracking-container","button")]),onClick:s},i("Apply")))),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-predict-tracking-container","content")},React__default.default.createElement(Result,{list:n})))),t.length>0&&React__default.default.createElement(GenerateViewsDataUrl,{result:t,imgList:c,setList:o})):null},Result=e=>{const{list:t}=e,{t:a}=reactI18next.useTranslation(),c=[a("TopView"),a("SideView"),a("BackView")];return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement("div",{className:dom.getClassName("point-cloud-predict-tracking-container","left")},c.map(n=>React__default.default.createElement("div",{className:dom.getClassName("point-cloud-predict-tracking-container","title"),key:n},n))),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-predict-tracking-container","right")},t.map(n=>React__default.default.createElement("div",{className:dom.getClassName("point-cloud-predict-tracking-container","item"),key:n.id},util.views.map(o=>{const r=n[o];return React__default.default.createElement("div",{className:dom.getClassName("point-cloud-predict-tracking-container","view"),key:`${n.id}-${o}`},React__default.default.createElement("img",{src:r}))})))))},GenerateViewsDataUrl=e=>{const t=React__default.default.useContext(PointCloudContext.PointCloudContext),a=ctx.useDispatch(),{result:c,imgList:n,setList:o}=e,r=React.useRef(null),i={width:600,height:600};return React.useEffect(()=>{(()=>__async(void 0,null,function*(){var s,f,g,v,C,h;const p=(s=t.mainViewInstance)==null?void 0:s.config;if(p&&r.current){const P={left:-i.width/2,right:i.width/2,top:i.height/2,bottom:-i.height/2,near:200,far:-200},u=new lbAnnotation.PointCloud({container:r.current,isOrthographicCamera:!0,orthographicParams:P,config:p});u.setShowDirection(!1);for(const d of c){const{index:m}=d,y=n[m].url?n[m].url:(C=(v=(g=(f=n[m])==null?void 0:f.webPointCloudFile)==null?void 0:g.lidar)==null?void 0:v.url)!=null?C:"";yield u.loadPCDFileByBox(y,d,{width:2,height:2,depth:2}),yield u.updateCameraZoom(t.zoom);const N=(h=lbUtils.toolStyleConverter.getColorFromConfig({attribute:d.attribute},__spreadProps(__spreadValues({},p),{attributeConfigurable:!0}),{}))==null?void 0:h.hex;u.generateBox(d,N),yield util.sleep(500),yield util.getViewsDataUrl(u,d,t.zoom),yield u.removeObjectByName(d.id),yield u.clearPointCloudAndRender()}o(c),actionCreators.SetPointCloudLoading(a,!1)}}))()},[]),React__default.default.createElement("div",{style:i,ref:r,className:"generate-view"})},mapStateToProps=e=>({predictionResult:e.annotation.predictionResult,predictionResultVisible:e.annotation.predictionResultVisible,imgList:e.annotation.imgList});var PreviewResult$1=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(PreviewResult);module.exports=PreviewResult$1;
1
+ "use strict";var classNames=require("classnames"),React=require("react"),reactI18next=require("react-i18next"),reactRedux=require("react-redux"),PointCloudContext=require("../../pointCloudView/PointCloudContext.js"),actionCreators=require("../../../store/annotation/actionCreators.js"),ctx=require("../../../store/ctx.js"),dom=require("../../../utils/dom.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),util=require("./util.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var classNames__default=_interopDefaultLegacy(classNames),React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,a)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,__spreadValues=(e,t)=>{for(var a in t||(t={}))__hasOwnProp.call(t,a)&&__defNormalProp(e,a,t[a]);if(__getOwnPropSymbols)for(var a of __getOwnPropSymbols(t))__propIsEnum.call(t,a)&&__defNormalProp(e,a,t[a]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t)),__async=(e,t,a)=>new Promise((c,n)=>{var o=l=>{try{i(a.next(l))}catch(s){n(s)}},r=l=>{try{i(a.throw(l))}catch(s){n(s)}},i=l=>l.done?c(l.value):Promise.resolve(l.value).then(o,r);i((a=a.apply(e,t)).next())});const PreviewResult=e=>{const{predictionResult:t,predictionResultVisible:a,imgList:c}=e,[n,o]=React.useState([]),r=ctx.useDispatch(),{t:i}=reactI18next.useTranslation(),l=()=>{actionCreators.SetPredictResultVisible(r,!1),actionCreators.SetPredictResult(r,[]),o([])},s=()=>__async(void 0,null,function*(){actionCreators.SetPointCloudLoading(r,!0),yield r(actionCreators.BatchUpdateImgListResultByPredictResult()),actionCreators.SetPointCloudLoading(r,!1),l()});return a?React__default.default.createElement(React__default.default.Fragment,null,n.length>0&&React__default.default.createElement("div",{className:dom.getClassName("point-cloud-predict-tracking-container")},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-predict-tracking-container","bar")},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-predict-tracking-container","title")},React__default.default.createElement("div",null,i("ComplementaryTrackingPrediction"),n.length>0?`\uFF08${n.length}\uFF09`:""),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-predict-tracking-container","option")},React__default.default.createElement("div",{className:classNames__default.default([dom.getClassName("point-cloud-predict-tracking-container","cancelOption"),dom.getClassName("point-cloud-predict-tracking-container","button")]),onClick:l},i("Cancel")),React__default.default.createElement("div",{className:classNames__default.default([dom.getClassName("point-cloud-predict-tracking-container","okOption"),dom.getClassName("point-cloud-predict-tracking-container","button")]),onClick:s},i("Apply")))),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-predict-tracking-container","content")},React__default.default.createElement(Result,{list:n})))),t.length>0&&React__default.default.createElement(GenerateViewsDataUrl,{result:t,imgList:c,setList:o})):null},Result=e=>{const{list:t}=e,{t:a}=reactI18next.useTranslation(),c=[a("TopView"),a("SideView"),a("BackView")];return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement("div",{className:dom.getClassName("point-cloud-predict-tracking-container","left")},c.map(n=>React__default.default.createElement("div",{className:dom.getClassName("point-cloud-predict-tracking-container","title"),key:n},n))),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-predict-tracking-container","right")},t.map(n=>React__default.default.createElement("div",{className:dom.getClassName("point-cloud-predict-tracking-container","item"),key:n.id},util.views.map(o=>{const r=n[o];return React__default.default.createElement("div",{className:dom.getClassName("point-cloud-predict-tracking-container","view"),key:`${n.id}-${o}`},React__default.default.createElement("img",{src:r}))})))))},GenerateViewsDataUrl=e=>{const t=React__default.default.useContext(PointCloudContext.PointCloudContext),a=ctx.useDispatch(),{result:c,imgList:n,setList:o}=e,r=React.useRef(null),i={width:600,height:600};return React.useEffect(()=>{(()=>__async(void 0,null,function*(){var s,f,g,v,C,h;const p=(s=t.mainViewInstance)==null?void 0:s.config;if(p&&r.current){const P={left:-i.width/2,right:i.width/2,top:i.height/2,bottom:-i.height/2,near:200,far:-200},u=new lbAnnotation.PointCloud({container:r.current,isOrthographicCamera:!0,orthographicParams:P,config:p});u.setShowDirection(!1);for(const d of c){const{index:m}=d,y=n[m].url?n[m].url:(C=(v=(g=(f=n[m])==null?void 0:f.webPointCloudFile)==null?void 0:g.lidar)==null?void 0:v.url)!=null?C:"";yield u.loadPCDFileByBox(y,d,{width:2,height:2,depth:2}),yield u.updateCameraZoom(t.zoom);const N=(h=lbUtils.toolStyleConverter.getColorFromConfig({attribute:d.attribute},__spreadProps(__spreadValues({},p),{attributeConfigurable:!0}),{}))==null?void 0:h.fill;u.generateBox(d,N),yield util.sleep(500),yield util.getViewsDataUrl(u,d,t.zoom),yield u.removeObjectByName(d.id),yield u.clearPointCloudAndRender()}o(c),actionCreators.SetPointCloudLoading(a,!1)}}))()},[]),React__default.default.createElement("div",{style:i,ref:r,className:"generate-view"})},mapStateToProps=e=>({predictionResult:e.annotation.predictionResult,predictionResultVisible:e.annotation.predictionResultVisible,imgList:e.annotation.imgList});var PreviewResult$1=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(PreviewResult);module.exports=PreviewResult$1;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var index=require("../../../utils/index.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(r,e,t)=>e in r?__defProp(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,__spreadValues=(r,e)=>{for(var t in e||(e={}))__hasOwnProp.call(e,t)&&__defNormalProp(r,t,e[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(e))__propIsEnum.call(e,t)&&__defNormalProp(r,t,e[t]);return r},__spreadProps=(r,e)=>__defProps(r,__getOwnPropDescs(e)),__async=(r,e,t)=>new Promise((o,i)=>{var s=n=>{try{c(t.next(n))}catch(l){i(l)}},u=n=>{try{c(t.throw(n))}catch(l){i(l)}},c=n=>n.done?o(n.value):Promise.resolve(n.value).then(s,u);c((t=t.apply(r,e)).next())});const EXAMPLE_IMAGE_SIZE={width:160,height:110},getDataUrl=(r,e=2)=>__async(void 0,null,function*(){return cropAndEnlarge(r.domElement,EXAMPLE_IMAGE_SIZE.width,EXAMPLE_IMAGE_SIZE.height,e)}),sleep=(r=300)=>new Promise(e=>{setTimeout(()=>{e("")},r)}),views=[lbUtils.EPerspectiveView.Top,lbUtils.EPerspectiveView.Left,lbUtils.EPerspectiveView.Back],getViewsDataUrl=(r,e,t)=>__async(void 0,null,function*(){for(const o of views)yield r.updateCameraByBox(e,o),e[o]=yield getDataUrl(r.renderer,t)}),cropAndEnlarge=(r,e,t,o)=>{if(!r)return"";const i=r.width/2,s=r.height/2,u=i-e/2,c=s-t/2,n=document.createElement("canvas");n.width=e*o,n.height=t*o;const l=n.getContext("2d");return l==null||l.drawImage(r,u,c,e,t,0,0,e*o,t*o),n.toDataURL()},getBoxesByTrackID=(r,e,t)=>{const o=[];return r.forEach((i,s)=>{var u;const c=index.jsonParser(i==null?void 0:i.result),n=(u=c==null?void 0:c[`step_${e}`])==null?void 0:u.result,l=n==null?void 0:n.find(p=>p.trackID===t);l&&o.push(__spreadProps(__spreadValues({},l),{index:s}))}),o},predict=(r,e)=>{const o=e.index-r.index-1,i=[],s={},u=["x","y","z"],c=["center","depth","height","index","rotation","width"];u.forEach(n=>{s[n]=getInteriorNumbersByStartAndEnd(r.center[n],e.center[n],o)}),c.forEach(n=>{n!=="center"&&(s[n]=getInteriorNumbersByStartAndEnd(r[n],e[n],o))});for(let n=0;n<o;n++){const l=u.reduce((a,d)=>(a[d]=s[d][n],a),{x:0,y:0,z:0}),p=c.reduce((a,d)=>(d==="center"||(a[d]=s[d][n]),a),__spreadProps(__spreadValues({},r),{id:lbAnnotation.uuid(),center:l}));i.push(p)}return i},getInteriorNumbersByStartAndEnd=(r=0,e=0,t=0)=>{const o=(e-r)/(t+1),i=new Array(t);for(let s=0;s<t;s++)i[s]=r+o*(s+1);return i};exports.getBoxesByTrackID=getBoxesByTrackID,exports.getViewsDataUrl=getViewsDataUrl,exports.predict=predict,exports.sleep=sleep,exports.views=views;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var index=require("../../../utils/index.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,e,r)=>e in t?__defProp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,__spreadValues=(t,e)=>{for(var r in e||(e={}))__hasOwnProp.call(e,r)&&__defNormalProp(t,r,e[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(e))__propIsEnum.call(e,r)&&__defNormalProp(t,r,e[r]);return t},__spreadProps=(t,e)=>__defProps(t,__getOwnPropDescs(e)),__async=(t,e,r)=>new Promise((o,i)=>{var s=n=>{try{c(r.next(n))}catch(l){i(l)}},u=n=>{try{c(r.throw(n))}catch(l){i(l)}},c=n=>n.done?o(n.value):Promise.resolve(n.value).then(s,u);c((r=r.apply(t,e)).next())});const EXAMPLE_IMAGE_SIZE={width:160,height:110},getDataUrl=(t,e=2)=>__async(void 0,null,function*(){return cropAndEnlarge(t.domElement,EXAMPLE_IMAGE_SIZE.width,EXAMPLE_IMAGE_SIZE.height,e)}),sleep=(t=300)=>new Promise(e=>{setTimeout(()=>{e("")},t)}),views=[lbUtils.EPerspectiveView.Top,lbUtils.EPerspectiveView.Left,lbUtils.EPerspectiveView.Back],getViewsDataUrl=(t,e,r)=>__async(void 0,null,function*(){for(const o of views)yield t.updateCameraByBox(e,o),e[o]=yield getDataUrl(t.renderer,r)}),cropAndEnlarge=(t,e,r,o)=>{if(!t)return"";const i=t.width/2,s=t.height/2,u=i-e/2,c=s-r/2,n=document.createElement("canvas");n.width=e*o,n.height=r*o;const l=n.getContext("2d");return l==null||l.drawImage(t,u,c,e,r,0,0,e*o,r*o),n.toDataURL()},getBoxesByTrackID=(t,e,r,o)=>{const i=[];return t.some((s,u)=>{var c;const n=index.jsonParser(s==null?void 0:s.result),l=(c=n==null?void 0:n[`step_${e}`])==null?void 0:c.result,d=l==null?void 0:l.find(a=>a.trackID===r);return d&&i.push(__spreadProps(__spreadValues({},d),{index:u})),(d==null?void 0:d.id)===o}),i},predict=(t,e)=>{const o=e.index-t.index-1,i=[],s={},u=["x","y","z"],c=["center","depth","height","index","rotation","width"];u.forEach(n=>{s[n]=getInteriorNumbersByStartAndEnd(t.center[n],e.center[n],o)}),c.forEach(n=>{n!=="center"&&(s[n]=getInteriorNumbersByStartAndEnd(t[n],e[n],o))});for(let n=0;n<o;n++){const l=u.reduce((a,p)=>(a[p]=s[p][n],a),{x:0,y:0,z:0}),d=c.reduce((a,p)=>(p==="center"||(a[p]=s[p][n]),a),__spreadProps(__spreadValues({},e),{id:lbAnnotation.uuid(),center:l}));i.push(d)}return i},getInteriorNumbersByStartAndEnd=(t=0,e=0,r=0)=>{const o=(e-t)/(r+1),i=new Array(r);for(let s=0;s<r;s++)i[s]=t+o*(s+1);return i};exports.getBoxesByTrackID=getBoxesByTrackID,exports.getViewsDataUrl=getViewsDataUrl,exports.predict=predict,exports.sleep=sleep,exports.views=views;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Actions=require("../Actions.js"),reducer=require("./reducer.js"),index=require("../../constant/index.js"),AnnotationSize=require("../../data/enums/AnnotationSize.js"),PageOperator=require("../../utils/PageOperator.js"),index$1=require("../../utils/index.js"),util=require("../../components/predictTracking/previewResult/util.js"),__async=(e,t,n)=>new Promise((a,o)=>{var i=s=>{try{p(n.next(s))}catch(r){o(r)}},T=s=>{try{p(n.throw(s))}catch(r){o(r)}},p=s=>s.done?a(s.value):Promise.resolve(s.value).then(i,T);p((n=n.apply(e,t)).next())});const dispatchTasks=(e,t)=>t.map(n=>e(n)),getSubmitByPageOperation=e=>e===AnnotationSize.EPageTurningOperation.Forward?index.ESubmitType.Forward:e===AnnotationSize.EPageTurningOperation.Backward?index.ESubmitType.Backward:e===AnnotationSize.EPageTurningOperation.Jump?index.ESubmitType.Jump:index.ESubmitType.Forward,getBasicIndex=(e,t)=>{var n,a;const{imgList:o,imgIndex:i}=e,{dataSourceStep:T}=reducer.getStepConfig(e.stepList,e.step);return((a=(n=index$1.jsonParser(o[i-1].result)[`step_${T}`])==null?void 0:n.result)==null?void 0:a.length)-1||t};function UpdateToolInstance(e){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_TOOL_INSTANCE,payload:{toolInstance:e}}}function SetTaskStepList({stepList:e}){return{type:Actions.ANNOTATION_ACTIONS.SET_TASK_STEP_LIST,payload:{stepList:e}}}function SetTaskConfig({stepList:e,step:t}){return{type:Actions.ANNOTATION_ACTIONS.SET_TASK_CONFIG,payload:{stepList:e,step:t}}}function UpdateOnSubmit(e){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_ON_SUBMIT,payload:{onSubmit:e}}}function UpdateOnSave(e){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_ON_SAVE,payload:{onSave:e}}}function UpdateOnPageChange(e){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_ON_PAGE_CHANGE,payload:{onPageChange:e}}}function UpdateOnStepChange(e){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_ON_STEP_CHANGE,payload:{onStepChange:e}}}function UpdateGetFileData(e){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_GET_FILE_DATA,payload:{getFileData:e}}}function UpdatePageSize(e){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_PAGE_SIZE,payload:{pageSize:e}}}function UpdateGetFileList(e){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_LOAD_FILE_LIST,payload:{loadFileList:e}}}function UpdateRotate(){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_ROTATE}}function UpdateSkipBeforePageTurning(e){return{type:Actions.ANNOTATION_ACTIONS.SKIP_BEFORE_PAGE_TURNING,payload:{skipBeforePageTurning:e}}}function UpdateBeforeRotate(e){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_BEFORE_ROTATE,payload:{beforeRotate:e}}}function CopyBackWordResult(){return{type:Actions.ANNOTATION_ACTIONS.COPY_BACKWARD_RESULT}}function BatchUpdateTrackID({id:e,newID:t,rangeIndex:n,imgList:a}){return{type:Actions.ANNOTATION_ACTIONS.BATCH_UPDATE_TRACK_ID,payload:{id:e,newID:t,rangeIndex:n,imgList:a}}}function BatchUpdateResultByTrackID(e,t,n){return{type:Actions.ANNOTATION_ACTIONS.BATCH_UPDATE_RESULT_BY_TRACK_ID,payload:{id:e,newData:t,rangeIndex:n}}}function BatchUpdateImgListResultByPredictResult(){return{type:Actions.ANNOTATION_ACTIONS.BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT,payload:{}}}const UpdateCheckMode=e=>({type:Actions.ANNOTATION_ACTIONS.SET_CHECK_MODE,payload:{checkMode:e}});function InitTaskData({onSubmit:e,onSave:t,onPageChange:n,onStepChange:a,getFileData:o,pageSize:i,loadFileList:T,step:p,stepList:s,skipBeforePageTurning:r,beforeRotate:A,checkMode:N}){const u=[];return e&&u.push(UpdateOnSubmit(e)),t&&u.push(UpdateOnSave(t)),n&&u.push(UpdateOnPageChange(n)),a&&u.push(UpdateOnStepChange(a)),o&&u.push(UpdateGetFileData(o)),T&&u.push(UpdateGetFileList(T)),i&&u.push(UpdatePageSize(i)),r&&u.push(UpdateSkipBeforePageTurning(r)),A&&u.push(UpdateBeforeRotate(A)),typeof N=="boolean"&&u.push(UpdateCheckMode(N)),u.push(SetTaskConfig({stepList:s,step:p})),u.push({type:Actions.ANNOTATION_ACTIONS.CALC_STEP_PROGRESS}),u.push({type:Actions.ANNOTATION_ACTIONS.INIT_TOOL}),I=>dispatchTasks(I,u)}function UpdateInjectFunc({onSubmit:e,onSave:t,onPageChange:n,onStepChange:a,getFileData:o,pageSize:i,loadFileList:T,stepList:p,beforeRotate:s}){const r=[];return e&&r.push(UpdateOnSubmit(e)),t&&r.push(UpdateOnSave(t)),n&&r.push(UpdateOnPageChange(n)),a&&r.push(UpdateOnStepChange(a)),o&&r.push(UpdateGetFileData(o)),T&&r.push(UpdateGetFileList(T)),i&&r.push(UpdatePageSize(i)),s&&r.push(UpdateBeforeRotate(s)),r.push(SetTaskStepList({stepList:p})),A=>dispatchTasks(A,r)}const getNextStep=(e,t)=>{var n;const a=t==null?void 0:t.findIndex(o=>(o==null?void 0:o.step)===e);return(n=t[a+1])==null?void 0:n.step},ToNextStep=e=>(t,n)=>{const{annotation:a}=n(),{step:o,stepList:i}=a,T=getNextStep(o,i);return[t(UpdateProcessingStep(T,e))]},UpdateProcessingStep=(e,t)=>(n,a)=>{var o,i;const{annotation:T}=a();(o=T==null?void 0:T.onStepChange)==null||o.call(T,e);const p=(i=T==null?void 0:T.imgIndex)!=null?i:0;return[n({type:Actions.ANNOTATION_ACTIONS.SUBMIT_RESULT}),n({type:Actions.ANNOTATION_ACTIONS.SUBMIT_FILE_DATA,payload:{submitType:index.ESubmitType.StepChanged}}),n({type:Actions.ANNOTATION_ACTIONS.SET_STEP,payload:{toStep:e}}),n({type:Actions.ANNOTATION_ACTIONS.CALC_STEP_PROGRESS}),n(reducer.LoadFileAndFileData(t!=null?t:p,0))]},ToSubmitFileData=e=>t=>[t({type:Actions.ANNOTATION_ACTIONS.SUBMIT_RESULT}),t({type:Actions.ANNOTATION_ACTIONS.SUBMIT_FILE_DATA,payload:{submitType:e}})],SubmitAndChangeFileIndex=(e,t,n,a)=>[e(ToSubmitFileData(n)),e(reducer.LoadFileAndFileData(t,a))],ChangeBasicIndex=(e,t)=>[e({type:Actions.ANNOTATION_ACTIONS.SUBMIT_RESULT}),e({type:Actions.ANNOTATION_ACTIONS.SET_BASIC_INDEX,payload:{basicIndex:t}})],ChangeTriggerEventAfterIndexChanged=(e,t)=>{e({type:Actions.ANNOTATION_ACTIONS.SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED,payload:{triggerEventAfterIndexChanged:t}})},PageBackward=(e=!1)=>(t,n)=>DispatcherTurning(t,n,AnnotationSize.EPageTurningOperation.Backward,e),PageForward=(e=!1)=>(t,n)=>DispatcherTurning(t,n,AnnotationSize.EPageTurningOperation.Forward,e),PageJump=(e,t=!1)=>(n,a)=>{if(e!==a().imgIndex)return DispatcherTurning(n,a,AnnotationSize.EPageTurningOperation.Jump,t,e)},loadImgList=(e,t,n,a)=>__async(void 0,null,function*(){var o;const{loadFileList:i,imgList:T,pageSize:p}=t().annotation,s=Math.floor(n/p);SetAnnotationLoading(e,!0);try{const r=yield i(s,p);if(SetAnnotationLoading(e,!1),!((o=r==null?void 0:r.fileList)==null?void 0:o.length)||!(r==null?void 0:r.total))throw new Error("fileList and total are required");const A=a?new Array(r.total):[...T];return A.splice(s*p,p,...r.fileList),e({type:Actions.ANNOTATION_ACTIONS.UPDATE_IMG_LIST,payload:{imgList:A}}),!0}catch(r){SetAnnotationLoading(e,!1),console.error(r)}}),DispatcherTurning=(e,t,n,a=!1,o)=>__async(void 0,null,function*(){var i;const T=t().annotation,{fileIndexChanged:p,fileIndex:s,basicIndexChanged:r,basicIndex:A}=PageOperator.getNextPageInfo(n,T,o),N=getSubmitByPageOperation(n);if(ChangeTriggerEventAfterIndexChanged(e,a),p){if(T.loading||!T.imgList[s]&&!(yield loadImgList(e,t,s)))return;(i=T.onPageChange)==null||i.call(T,s);const u=N===index.ESubmitType.Backward?getBasicIndex(t().annotation,A):A;return SubmitAndChangeFileIndex(e,s,N,u)}return r?ChangeBasicIndex(e,A):e(ToSubmitFileData(N))}),ChangeSave=e=>{e(ToSubmitFileData(index.ESubmitType.Save)),e({type:Actions.ANNOTATION_ACTIONS.SAVE_RESULT})},SetAnnotationLoading=(e,t)=>{e({type:Actions.ANNOTATION_ACTIONS.SET_LOADING,payload:{loading:t}})},SetPointCloudLoading=(e,t)=>{e({type:Actions.ANNOTATION_ACTIONS.SET_LOADING,payload:{loading:t}})},InitAnnotationState=e=>{e({type:Actions.ANNOTATION_ACTIONS.INIT_ALL_STATE,payload:{}})},SetPredictResult=(e,t)=>{e({type:Actions.ANNOTATION_ACTIONS.SET_PREDICT_RESULT,payload:{result:t}})},SetPredictResultVisible=(e,t)=>{e({type:Actions.ANNOTATION_ACTIONS.SET_PREDICT_RESULT_VISIBLE,payload:{visible:t}})},GetBoxesByID=e=>(t,n)=>{const{imgList:a,step:o}=n().annotation;return util.getBoxesByTrackID(a,o,e)};exports.BatchUpdateImgListResultByPredictResult=BatchUpdateImgListResultByPredictResult,exports.BatchUpdateResultByTrackID=BatchUpdateResultByTrackID,exports.BatchUpdateTrackID=BatchUpdateTrackID,exports.ChangeSave=ChangeSave,exports.CopyBackWordResult=CopyBackWordResult,exports.DispatcherTurning=DispatcherTurning,exports.GetBoxesByID=GetBoxesByID,exports.InitAnnotationState=InitAnnotationState,exports.InitTaskData=InitTaskData,exports.PageBackward=PageBackward,exports.PageForward=PageForward,exports.PageJump=PageJump,exports.SetAnnotationLoading=SetAnnotationLoading,exports.SetPointCloudLoading=SetPointCloudLoading,exports.SetPredictResult=SetPredictResult,exports.SetPredictResultVisible=SetPredictResultVisible,exports.SetTaskConfig=SetTaskConfig,exports.SetTaskStepList=SetTaskStepList,exports.ToNextStep=ToNextStep,exports.ToSubmitFileData=ToSubmitFileData,exports.UpdateBeforeRotate=UpdateBeforeRotate,exports.UpdateCheckMode=UpdateCheckMode,exports.UpdateGetFileData=UpdateGetFileData,exports.UpdateGetFileList=UpdateGetFileList,exports.UpdateInjectFunc=UpdateInjectFunc,exports.UpdateOnPageChange=UpdateOnPageChange,exports.UpdateOnSave=UpdateOnSave,exports.UpdateOnStepChange=UpdateOnStepChange,exports.UpdateOnSubmit=UpdateOnSubmit,exports.UpdatePageSize=UpdatePageSize,exports.UpdateProcessingStep=UpdateProcessingStep,exports.UpdateRotate=UpdateRotate,exports.UpdateSkipBeforePageTurning=UpdateSkipBeforePageTurning,exports.UpdateToolInstance=UpdateToolInstance,exports.loadImgList=loadImgList;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Actions=require("../Actions.js"),reducer=require("./reducer.js"),index=require("../../constant/index.js"),AnnotationSize=require("../../data/enums/AnnotationSize.js"),PageOperator=require("../../utils/PageOperator.js"),index$1=require("../../utils/index.js"),util=require("../../components/predictTracking/previewResult/util.js"),__async=(e,t,n)=>new Promise((a,o)=>{var s=i=>{try{p(n.next(i))}catch(r){o(r)}},T=i=>{try{p(n.throw(i))}catch(r){o(r)}},p=i=>i.done?a(i.value):Promise.resolve(i.value).then(s,T);p((n=n.apply(e,t)).next())});const dispatchTasks=(e,t)=>t.map(n=>e(n)),getSubmitByPageOperation=e=>e===AnnotationSize.EPageTurningOperation.Forward?index.ESubmitType.Forward:e===AnnotationSize.EPageTurningOperation.Backward?index.ESubmitType.Backward:e===AnnotationSize.EPageTurningOperation.Jump?index.ESubmitType.Jump:index.ESubmitType.Forward,getBasicIndex=(e,t)=>{var n,a;const{imgList:o,imgIndex:s}=e,{dataSourceStep:T}=reducer.getStepConfig(e.stepList,e.step);return((a=(n=index$1.jsonParser(o[s-1].result)[`step_${T}`])==null?void 0:n.result)==null?void 0:a.length)-1||t};function UpdateToolInstance(e){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_TOOL_INSTANCE,payload:{toolInstance:e}}}function SetTaskStepList({stepList:e}){return{type:Actions.ANNOTATION_ACTIONS.SET_TASK_STEP_LIST,payload:{stepList:e}}}function SetTaskConfig({stepList:e,step:t}){return{type:Actions.ANNOTATION_ACTIONS.SET_TASK_CONFIG,payload:{stepList:e,step:t}}}function UpdateOnSubmit(e){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_ON_SUBMIT,payload:{onSubmit:e}}}function UpdateOnSave(e){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_ON_SAVE,payload:{onSave:e}}}function UpdateOnPageChange(e){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_ON_PAGE_CHANGE,payload:{onPageChange:e}}}function UpdateOnStepChange(e){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_ON_STEP_CHANGE,payload:{onStepChange:e}}}function UpdateGetFileData(e){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_GET_FILE_DATA,payload:{getFileData:e}}}function UpdatePageSize(e){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_PAGE_SIZE,payload:{pageSize:e}}}function UpdateGetFileList(e){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_LOAD_FILE_LIST,payload:{loadFileList:e}}}function UpdateRotate(){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_ROTATE}}function UpdateSkipBeforePageTurning(e){return{type:Actions.ANNOTATION_ACTIONS.SKIP_BEFORE_PAGE_TURNING,payload:{skipBeforePageTurning:e}}}function UpdateBeforeRotate(e){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_BEFORE_ROTATE,payload:{beforeRotate:e}}}function CopyBackWordResult(){return{type:Actions.ANNOTATION_ACTIONS.COPY_BACKWARD_RESULT}}function BatchUpdateTrackID({id:e,newID:t,rangeIndex:n,imgList:a}){return{type:Actions.ANNOTATION_ACTIONS.BATCH_UPDATE_TRACK_ID,payload:{id:e,newID:t,rangeIndex:n,imgList:a}}}function BatchUpdateResultByTrackID(e,t,n){return{type:Actions.ANNOTATION_ACTIONS.BATCH_UPDATE_RESULT_BY_TRACK_ID,payload:{id:e,newData:t,rangeIndex:n}}}function BatchUpdateImgListResultByPredictResult(){return{type:Actions.ANNOTATION_ACTIONS.BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT,payload:{}}}const UpdateCheckMode=e=>({type:Actions.ANNOTATION_ACTIONS.SET_CHECK_MODE,payload:{checkMode:e}});function InitTaskData({onSubmit:e,onSave:t,onPageChange:n,onStepChange:a,getFileData:o,pageSize:s,loadFileList:T,step:p,stepList:i,skipBeforePageTurning:r,beforeRotate:A,checkMode:N}){const u=[];return e&&u.push(UpdateOnSubmit(e)),t&&u.push(UpdateOnSave(t)),n&&u.push(UpdateOnPageChange(n)),a&&u.push(UpdateOnStepChange(a)),o&&u.push(UpdateGetFileData(o)),T&&u.push(UpdateGetFileList(T)),s&&u.push(UpdatePageSize(s)),r&&u.push(UpdateSkipBeforePageTurning(r)),A&&u.push(UpdateBeforeRotate(A)),typeof N=="boolean"&&u.push(UpdateCheckMode(N)),u.push(SetTaskConfig({stepList:i,step:p})),u.push({type:Actions.ANNOTATION_ACTIONS.CALC_STEP_PROGRESS}),u.push({type:Actions.ANNOTATION_ACTIONS.INIT_TOOL}),I=>dispatchTasks(I,u)}function UpdateInjectFunc({onSubmit:e,onSave:t,onPageChange:n,onStepChange:a,getFileData:o,pageSize:s,loadFileList:T,stepList:p,beforeRotate:i}){const r=[];return e&&r.push(UpdateOnSubmit(e)),t&&r.push(UpdateOnSave(t)),n&&r.push(UpdateOnPageChange(n)),a&&r.push(UpdateOnStepChange(a)),o&&r.push(UpdateGetFileData(o)),T&&r.push(UpdateGetFileList(T)),s&&r.push(UpdatePageSize(s)),i&&r.push(UpdateBeforeRotate(i)),r.push(SetTaskStepList({stepList:p})),A=>dispatchTasks(A,r)}const getNextStep=(e,t)=>{var n;const a=t==null?void 0:t.findIndex(o=>(o==null?void 0:o.step)===e);return(n=t[a+1])==null?void 0:n.step},ToNextStep=e=>(t,n)=>{const{annotation:a}=n(),{step:o,stepList:s}=a,T=getNextStep(o,s);return[t(UpdateProcessingStep(T,e))]},UpdateProcessingStep=(e,t)=>(n,a)=>{var o,s;const{annotation:T}=a();(o=T==null?void 0:T.onStepChange)==null||o.call(T,e);const p=(s=T==null?void 0:T.imgIndex)!=null?s:0;return[n({type:Actions.ANNOTATION_ACTIONS.SUBMIT_RESULT}),n({type:Actions.ANNOTATION_ACTIONS.SUBMIT_FILE_DATA,payload:{submitType:index.ESubmitType.StepChanged}}),n({type:Actions.ANNOTATION_ACTIONS.SET_STEP,payload:{toStep:e}}),n({type:Actions.ANNOTATION_ACTIONS.CALC_STEP_PROGRESS}),n(reducer.LoadFileAndFileData(t!=null?t:p,0))]},ToSubmitFileData=e=>t=>[t({type:Actions.ANNOTATION_ACTIONS.SUBMIT_RESULT}),t({type:Actions.ANNOTATION_ACTIONS.SUBMIT_FILE_DATA,payload:{submitType:e}})],SubmitAndChangeFileIndex=(e,t,n,a)=>[e(ToSubmitFileData(n)),e(reducer.LoadFileAndFileData(t,a))],ChangeBasicIndex=(e,t)=>[e({type:Actions.ANNOTATION_ACTIONS.SUBMIT_RESULT}),e({type:Actions.ANNOTATION_ACTIONS.SET_BASIC_INDEX,payload:{basicIndex:t}})],ChangeTriggerEventAfterIndexChanged=(e,t)=>{e({type:Actions.ANNOTATION_ACTIONS.SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED,payload:{triggerEventAfterIndexChanged:t}})},PageBackward=(e=!1)=>(t,n)=>DispatcherTurning(t,n,AnnotationSize.EPageTurningOperation.Backward,e),PageForward=(e=!1)=>(t,n)=>DispatcherTurning(t,n,AnnotationSize.EPageTurningOperation.Forward,e),PageJump=(e,t=!1)=>(n,a)=>{if(e!==a().imgIndex)return DispatcherTurning(n,a,AnnotationSize.EPageTurningOperation.Jump,t,e)},loadImgList=(e,t,n,a)=>__async(void 0,null,function*(){var o;const{loadFileList:s,imgList:T,pageSize:p}=t().annotation,i=Math.floor(n/p);SetAnnotationLoading(e,!0);try{const r=yield s(i,p);if(SetAnnotationLoading(e,!1),!((o=r==null?void 0:r.fileList)==null?void 0:o.length)||!(r==null?void 0:r.total))throw new Error("fileList and total are required");const A=a?new Array(r.total):[...T];return A.splice(i*p,p,...r.fileList),e({type:Actions.ANNOTATION_ACTIONS.UPDATE_IMG_LIST,payload:{imgList:A}}),!0}catch(r){SetAnnotationLoading(e,!1),console.error(r)}}),DispatcherTurning=(e,t,n,a=!1,o)=>__async(void 0,null,function*(){var s;const T=t().annotation,{fileIndexChanged:p,fileIndex:i,basicIndexChanged:r,basicIndex:A}=PageOperator.getNextPageInfo(n,T,o),N=getSubmitByPageOperation(n);if(ChangeTriggerEventAfterIndexChanged(e,a),p){if(T.loading||!T.imgList[i]&&!(yield loadImgList(e,t,i)))return;(s=T.onPageChange)==null||s.call(T,i);const u=N===index.ESubmitType.Backward?getBasicIndex(t().annotation,A):A;return SubmitAndChangeFileIndex(e,i,N,u)}return r?ChangeBasicIndex(e,A):e(ToSubmitFileData(N))}),ChangeSave=e=>{e(ToSubmitFileData(index.ESubmitType.Save)),e({type:Actions.ANNOTATION_ACTIONS.SAVE_RESULT})},SetAnnotationLoading=(e,t)=>{e({type:Actions.ANNOTATION_ACTIONS.SET_LOADING,payload:{loading:t}})},SetPointCloudLoading=(e,t)=>{e({type:Actions.ANNOTATION_ACTIONS.SET_LOADING,payload:{loading:t}})},InitAnnotationState=e=>{e({type:Actions.ANNOTATION_ACTIONS.INIT_ALL_STATE,payload:{}})},SetPredictResult=(e,t)=>{e({type:Actions.ANNOTATION_ACTIONS.SET_PREDICT_RESULT,payload:{result:t}})},SetPredictResultVisible=(e,t)=>{e({type:Actions.ANNOTATION_ACTIONS.SET_PREDICT_RESULT_VISIBLE,payload:{visible:t}})},GetBoxesByID=(e,t)=>(n,a)=>{const{imgList:o,step:s}=a().annotation;return util.getBoxesByTrackID(o,s,e,t)};exports.BatchUpdateImgListResultByPredictResult=BatchUpdateImgListResultByPredictResult,exports.BatchUpdateResultByTrackID=BatchUpdateResultByTrackID,exports.BatchUpdateTrackID=BatchUpdateTrackID,exports.ChangeSave=ChangeSave,exports.CopyBackWordResult=CopyBackWordResult,exports.DispatcherTurning=DispatcherTurning,exports.GetBoxesByID=GetBoxesByID,exports.InitAnnotationState=InitAnnotationState,exports.InitTaskData=InitTaskData,exports.PageBackward=PageBackward,exports.PageForward=PageForward,exports.PageJump=PageJump,exports.SetAnnotationLoading=SetAnnotationLoading,exports.SetPointCloudLoading=SetPointCloudLoading,exports.SetPredictResult=SetPredictResult,exports.SetPredictResultVisible=SetPredictResultVisible,exports.SetTaskConfig=SetTaskConfig,exports.SetTaskStepList=SetTaskStepList,exports.ToNextStep=ToNextStep,exports.ToSubmitFileData=ToSubmitFileData,exports.UpdateBeforeRotate=UpdateBeforeRotate,exports.UpdateCheckMode=UpdateCheckMode,exports.UpdateGetFileData=UpdateGetFileData,exports.UpdateGetFileList=UpdateGetFileList,exports.UpdateInjectFunc=UpdateInjectFunc,exports.UpdateOnPageChange=UpdateOnPageChange,exports.UpdateOnSave=UpdateOnSave,exports.UpdateOnStepChange=UpdateOnStepChange,exports.UpdateOnSubmit=UpdateOnSubmit,exports.UpdatePageSize=UpdatePageSize,exports.UpdateProcessingStep=UpdateProcessingStep,exports.UpdateRotate=UpdateRotate,exports.UpdateSkipBeforePageTurning=UpdateSkipBeforePageTurning,exports.UpdateToolInstance=UpdateToolInstance,exports.loadImgList=loadImgList;
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  interface IProps {
2
3
  src: string;
3
4
  result: string;
@@ -8,5 +9,5 @@ interface IProps {
8
9
  backgroundColor?: string;
9
10
  isOrthographicCamera?: boolean;
10
11
  }
11
- declare const PointCloudAnnotationView: (props: IProps) => JSX.Element;
12
+ declare const PointCloudAnnotationView: (props: IProps) => React.JSX.Element;
12
13
  export default PointCloudAnnotationView;
@@ -1,8 +1,9 @@
1
+ import React from 'react';
1
2
  import { IStepInfo } from '@/types/step';
2
3
  interface IProps {
3
4
  stepList: IStepInfo[];
4
5
  currentStep: number;
5
6
  updateStep: (step: number) => void;
6
7
  }
7
- declare const AnnotationStepPopover: (props: IProps) => JSX.Element;
8
+ declare const AnnotationStepPopover: (props: IProps) => React.JSX.Element;
8
9
  export default AnnotationStepPopover;
@@ -13,6 +13,8 @@ interface IProps {
13
13
  noHeightLimit?: boolean;
14
14
  num?: number | string;
15
15
  style?: React.CSSProperties;
16
+ enableColorPicker?: boolean;
17
+ updateColorConfig?: (value: string, color: string) => void;
16
18
  }
17
19
  declare const AttributeList: React.ForwardRefExoticComponent<IProps & React.RefAttributes<unknown>>;
18
20
  export default AttributeList;
@@ -1,8 +1,9 @@
1
+ import React from 'react';
1
2
  interface IProps {
2
3
  selectedAttribute: string[];
3
4
  attributeChanged: () => void;
4
5
  num?: any;
5
6
  list?: any[];
6
7
  }
7
- declare const CheckboxList: (props: IProps) => JSX.Element;
8
+ declare const CheckboxList: (props: IProps) => React.JSX.Element;
8
9
  export default CheckboxList;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @file Color Palette
3
+ * @author lixinghua <lixinghua_vendor@sensetime.com>
4
+ * @date 2023.04.24
5
+ */
6
+ import React from 'react';
7
+ interface IProps {
8
+ defaultColor?: string;
9
+ setColor: (color: string) => void;
10
+ }
11
+ declare const Palette: (props: IProps) => React.JSX.Element;
12
+ export default Palette;
@@ -1 +1,2 @@
1
- export declare const ColorTag: ({ color, style }: any) => JSX.Element;
1
+ import React from 'react';
2
+ export declare const ColorTag: ({ color, style, onClick }: any) => React.JSX.Element;
@@ -5,5 +5,5 @@ interface IProps {
5
5
  iconChildren: React.ReactNode;
6
6
  marginLeft?: number;
7
7
  }
8
- declare const IconWithText: (props: IProps) => JSX.Element;
8
+ declare const IconWithText: (props: IProps) => React.JSX.Element;
9
9
  export default IconWithText;
@@ -4,8 +4,8 @@ export declare const viewportContext: React.Context<{
4
4
  width: number;
5
5
  height: number;
6
6
  }>;
7
- export declare const ViewportProviderComponent: (props: any) => JSX.Element;
8
- export declare const ViewportProvider: import("react-redux").ConnectedComponent<(props: any) => JSX.Element, import("react-redux").Omit<any, "annotation" | "dispatch">>;
7
+ export declare const ViewportProviderComponent: (props: any) => React.JSX.Element;
8
+ export declare const ViewportProvider: import("react-redux").ConnectedComponent<(props: any) => React.JSX.Element, import("react-redux").Omit<any, "annotation" | "dispatch">>;
9
9
  export declare const useViewport: () => {
10
10
  width: number;
11
11
  height: number;
@@ -11,5 +11,5 @@ export interface IFileErrorProps {
11
11
  fileType?: string;
12
12
  isError?: boolean;
13
13
  }
14
- declare const FileError: (props: IFileErrorProps) => JSX.Element;
14
+ declare const FileError: (props: IFileErrorProps) => React.JSX.Element;
15
15
  export default FileError;
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import { IA2MapStateProps } from '@/store/annotation/map';
2
- declare const _default: import("react-redux").ConnectedComponent<({ currentData, config }: IA2MapStateProps) => JSX.Element, import("react-redux").Omit<IA2MapStateProps, "imgIndex" | "imgList" | "config" | "currentData" | "stepInfo" | "configString">>;
3
+ declare const _default: import("react-redux").ConnectedComponent<({ currentData, config }: IA2MapStateProps) => React.JSX.Element, import("react-redux").Omit<IA2MapStateProps, "imgIndex" | "imgList" | "config" | "currentData" | "stepInfo" | "configString">>;
3
4
  export default _default;
@@ -1,6 +1,7 @@
1
+ import React from 'react';
1
2
  import { IA2MapStateProps } from '@/store/annotation/map';
2
3
  interface IProps {
3
4
  checkMode?: boolean;
4
5
  }
5
- declare const _default: import("react-redux").ConnectedComponent<({ currentData, config, checkMode }: IA2MapStateProps & IProps) => JSX.Element, import("react-redux").Omit<IA2MapStateProps & IProps, "imgIndex" | "imgList" | "config" | "currentData" | "stepInfo" | "configString">>;
6
+ declare const _default: import("react-redux").ConnectedComponent<({ currentData, config, checkMode }: IA2MapStateProps & IProps) => React.JSX.Element, import("react-redux").Omit<IA2MapStateProps & IProps, "imgIndex" | "imgList" | "config" | "currentData" | "stepInfo" | "configString">>;
6
7
  export default _default;
@@ -1,4 +1,4 @@
1
- import { IPointCloudBox, IPointCloudBoxList, IPolygonData, IPointCloudSphereList, IPointCloudSphere } from '@labelbee/lb-utils';
1
+ import { IPointCloudBox, IPointCloudBoxList, IPolygonData, IPointCloudSphereList, IPointCloudSphere, ILine } from '@labelbee/lb-utils';
2
2
  import React from 'react';
3
3
  import { PointCloud, PointCloudAnnotation, ActionsHistory, EToolName } from '@labelbee/lb-annotation';
4
4
  interface IPointCloudContextInstances {
@@ -31,13 +31,15 @@ export interface IPointCloudContext extends IPointCloudContextInstances {
31
31
  addPointCloudSphere: (sphereParams: IPointCloudSphere) => IPointCloudSphere[];
32
32
  polygonList: IPolygonData[];
33
33
  setPolygonList: (polygonList: IPolygonData[]) => void;
34
+ lineList: ILine[];
35
+ setLineList: (lineList: ILine[]) => void;
34
36
  zoom: number;
35
37
  setZoom: (zoom: number) => void;
36
38
  history: ActionsHistory;
37
39
  hideAttributes: string[];
38
40
  setHideAttributes: (hideAttrs: string[]) => void;
39
41
  toggleAttributesVisible: (attribute: string) => void;
40
- reRender: (_displayPointCloudList: IPointCloudBoxList, _polygonList: IPolygonData[], _displaySphereList: IPointCloudSphereList) => void;
42
+ reRender: (_displayPointCloudList: IPointCloudBoxList, _polygonList: IPolygonData[], _displaySphereList: IPointCloudSphereList, _lineList: ILine[]) => void;
41
43
  attrPanelLayout: AttrPanelLayout;
42
44
  setAttrPanelLayout: (layout: AttrPanelLayout) => void;
43
45
  syncAllViewPointCloudColor: (newPointCloudList?: IPointCloudBox[]) => void;