@labelbee/lb-components 1.23.0-alpha.3 → 1.23.0-alpha.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/App.js +1 -1
- package/dist/assets/annotation/pointCloudTool/leftArrow.svg.js +1 -1
- package/dist/assets/annotation/pointCloudTool/rightArrow.svg.js +1 -1
- package/dist/components/LLMToolView/index.js +1 -1
- package/dist/components/LLMToolView/sidebar/components/textEditor/index.js +2 -2
- package/dist/components/LLMToolView/sidebar/components/textEditor/index.module.scss.js +1 -1
- package/dist/components/LLMToolView/sidebar/components/textInputBox/index.js +2 -2
- package/dist/components/LLMToolView/sidebar/index.js +1 -1
- package/dist/components/LLMToolView/utils/data.js +1 -1
- package/dist/components/NLPToolView/index.js +1 -1
- package/dist/components/NLPToolView/textContent/index.js +1 -1
- package/dist/components/audioAnnotate/audioContext/index.js +1 -1
- package/dist/components/audioAnnotate/audioSide/clipSidebar/index.js +1 -1
- package/dist/components/audioAnnotate/index.js +1 -1
- package/dist/components/audioAnnotate/textInput/index.js +1 -1
- package/dist/components/audioAnnotate/textInput/index.module.scss.js +1 -1
- package/dist/components/audioAnnotate/utils/dataTransform.js +1 -0
- package/dist/components/audioPlayer/clipRegion/index.js +1 -1
- package/dist/components/audioPlayer/index.js +1 -1
- package/dist/components/audioPlayer/useAudioCombine/index.js +3 -2
- package/dist/components/audioPlayer/useAudioSegment/index.js +1 -1
- package/dist/components/longText/index.js +1 -1
- package/dist/components/pointCloud2DRectOperationView/index.js +1 -1
- package/dist/components/pointCloudView/PointCloud2DView.js +1 -1
- package/dist/components/pointCloudView/PointCloud3DView.js +1 -1
- package/dist/components/pointCloudView/PointCloudContext.js +1 -1
- package/dist/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
- package/dist/components/pointCloudView/hooks/useStatus.js +1 -1
- package/dist/components/pointCloudView/index.js +1 -1
- package/dist/components/subAttributeList/index.js +1 -0
- package/dist/components/videoAnnotate/videoClipTool/index.js +1 -1
- package/dist/components/videoAnnotate/videoTagTool/TagToolInstanceAdaptor.js +1 -1
- package/dist/index.css +35 -9
- package/dist/index.js +1 -1
- package/dist/store/Actions.js +1 -1
- package/dist/store/annotation/actionCreators.js +1 -1
- package/dist/store/annotation/reducer.js +1 -1
- package/dist/types/App.d.ts +3 -1
- package/dist/types/components/LLMToolView/utils/data.d.ts +1 -1
- package/dist/types/components/audioAnnotate/audioContext/index.d.ts +10 -2
- package/dist/types/components/audioAnnotate/textInput/index.d.ts +1 -0
- package/dist/types/components/audioAnnotate/utils/dataTransform.d.ts +9 -0
- package/dist/types/components/audioPlayer/index.d.ts +28 -21
- package/dist/types/components/longText/index.d.ts +1 -0
- package/dist/types/components/pointCloudView/PointCloud2DView.d.ts +1 -1
- package/dist/types/components/pointCloudView/PointCloudContext.d.ts +6 -1
- package/dist/types/components/pointCloudView/hooks/usePointCloudViews.d.ts +5 -0
- package/dist/types/components/subAttributeList/index.d.ts +9 -0
- package/dist/types/components/videoAnnotate/index.d.ts +2 -1
- package/dist/types/components/videoAnnotate/videoClipTool/index.d.ts +2 -1
- package/dist/types/components/videoAnnotate/videoTagTool/TagToolInstanceAdaptor.d.ts +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/store/Actions.d.ts +1 -0
- package/dist/types/store/annotation/actionCreators.d.ts +3 -2
- package/dist/types/store/annotation/reducer.d.ts +1 -0
- package/dist/types/store/annotation/types.d.ts +9 -2
- package/dist/types/utils/AnnotationDataUtils.d.ts +54 -1
- package/dist/types/utils/index.d.ts +4 -1
- package/dist/types/views/MainView/sidebar/TextToolSidebar/index.d.ts +1 -1
- package/dist/types/views/MainView/toolFooter/index.d.ts +1 -1
- package/dist/types/views/MainView/toolHeader/StepSwitch/index.d.ts +1 -1
- package/dist/types/views/MainView/toolHeader/index.d.ts +1 -1
- package/dist/utils/AnnotationDataUtils.js +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/views/MainView/index.js +1 -1
- package/dist/views/MainView/sidebar/GeneralOperation/ActionsConfirm.js +1 -1
- package/dist/views/MainView/sidebar/NLPSidebar/NLPAnnotatedList.js +1 -1
- package/dist/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
- package/dist/views/MainView/sidebar/TagSidebar/index.js +1 -1
- package/dist/views/MainView/sidebar/TextToolSidebar/index.js +1 -1
- package/es/App.js +1 -1
- package/es/assets/annotation/pointCloudTool/leftArrow.svg.js +1 -1
- package/es/assets/annotation/pointCloudTool/rightArrow.svg.js +1 -1
- package/es/components/LLMToolView/index.js +1 -1
- package/es/components/LLMToolView/sidebar/components/textEditor/index.js +2 -2
- package/es/components/LLMToolView/sidebar/components/textEditor/index.module.scss.js +1 -1
- package/es/components/LLMToolView/sidebar/components/textInputBox/index.js +2 -2
- package/es/components/LLMToolView/sidebar/index.js +1 -1
- package/es/components/LLMToolView/utils/data.js +1 -1
- package/es/components/NLPToolView/index.js +1 -1
- package/es/components/NLPToolView/textContent/index.js +1 -1
- package/es/components/audioAnnotate/audioContext/index.js +1 -1
- package/es/components/audioAnnotate/audioSide/clipSidebar/index.js +1 -1
- package/es/components/audioAnnotate/index.js +1 -1
- package/es/components/audioAnnotate/textInput/index.js +1 -1
- package/es/components/audioAnnotate/textInput/index.module.scss.js +1 -1
- package/es/components/audioAnnotate/utils/dataTransform.js +1 -0
- package/es/components/audioPlayer/clipRegion/index.js +1 -1
- package/es/components/audioPlayer/index.js +1 -1
- package/es/components/audioPlayer/useAudioCombine/index.js +3 -2
- package/es/components/audioPlayer/useAudioSegment/index.js +1 -1
- package/es/components/longText/index.js +1 -1
- package/es/components/pointCloud2DRectOperationView/index.js +1 -1
- package/es/components/pointCloudView/PointCloud2DView.js +1 -1
- package/es/components/pointCloudView/PointCloud3DView.js +1 -1
- package/es/components/pointCloudView/PointCloudContext.js +1 -1
- package/es/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
- package/es/components/pointCloudView/hooks/useStatus.js +1 -1
- package/es/components/pointCloudView/index.js +1 -1
- package/es/components/subAttributeList/index.js +1 -0
- package/es/components/videoAnnotate/videoClipTool/index.js +1 -1
- package/es/components/videoAnnotate/videoTagTool/TagToolInstanceAdaptor.js +1 -1
- package/es/index.css +35 -9
- package/es/index.js +1 -1
- package/es/store/Actions.js +1 -1
- package/es/store/annotation/actionCreators.js +1 -1
- package/es/store/annotation/reducer.js +1 -1
- package/es/utils/AnnotationDataUtils.js +1 -1
- package/es/utils/index.js +1 -1
- package/es/views/MainView/index.js +1 -1
- package/es/views/MainView/sidebar/GeneralOperation/ActionsConfirm.js +1 -1
- package/es/views/MainView/sidebar/NLPSidebar/NLPAnnotatedList.js +1 -1
- package/es/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
- package/es/views/MainView/sidebar/TagSidebar/index.js +1 -1
- package/es/views/MainView/sidebar/TextToolSidebar/index.js +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var React=require("react"),antd=require("antd"),ahooks=require("ahooks"),index=require("../../constant/index.js"),icons=require("@ant-design/icons");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,t,r)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__spreadValues=(e,t)=>{for(var r in t||(t={}))__hasOwnProp.call(t,r)&&__defNormalProp(e,r,t[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(t))__propIsEnum.call(t,r)&&__defNormalProp(e,r,t[r]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));const longTextCls=`${index.prefix}-longText`,
|
|
1
|
+
"use strict";var React=require("react"),antd=require("antd"),ahooks=require("ahooks"),index=require("../../constant/index.js"),icons=require("@ant-design/icons");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,t,r)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__spreadValues=(e,t)=>{for(var r in t||(t={}))__hasOwnProp.call(t,r)&&__defNormalProp(e,r,t[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(t))__propIsEnum.call(t,r)&&__defNormalProp(e,r,t[r]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t)),__objRest=(e,t)=>{var r={};for(var n in e)__hasOwnProp.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&__getOwnPropSymbols)for(var n of __getOwnPropSymbols(e))t.indexOf(n)<0&&__propIsEnum.call(e,n)&&(r[n]=e[n]);return r};const longTextCls=`${index.prefix}-longText`,TextDom=React.forwardRef((e,t)=>{var r=e,{text:n,overflowMaxLines:s,style:o}=r,c=__objRest(r,["text","overflowMaxLines","style"]);const a={whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},l={display:"-webkit-box",WebkitLineClamp:s,WebkitBoxOrient:"vertical",overflow:"hidden"},f=s>1?l:a;return React__default.default.createElement("div",__spreadValues({style:__spreadValues(__spreadValues({},f),o),ref:t},c),n)}),LongText=e=>{const{text:t,placement:r="bottom",icon:n=React__default.default.createElement(icons.SearchOutlined,null),openByText:s,style:o,isToolTips:c,overflowMaxLines:a=1}=e,l=React.useRef(null),f=ahooks.useSize(l),u=React.useMemo(()=>{var i,d,v,p;return a>1?l.current&&((i=l.current)==null?void 0:i.clientHeight)<((d=l.current)==null?void 0:d.scrollHeight):l.current&&((v=l.current)==null?void 0:v.clientWidth)<((p=l.current)==null?void 0:p.scrollWidth)},[f]);if(s){let i={placement:r,overlayClassName:`${longTextCls}-popover`,content:t,key:`${u}`};return u||Object.assign(i,{open:!1}),c?React__default.default.createElement(antd.Tooltip,__spreadProps(__spreadValues({},i),{title:t}),React__default.default.createElement(TextDom,{overflowMaxLines:a,style:o,ref:l,text:t})):React__default.default.createElement(antd.Popover,__spreadValues({},i),React__default.default.createElement(TextDom,{overflowMaxLines:a,style:o,ref:l,text:t}))}return React__default.default.createElement("div",{className:longTextCls,style:o},React__default.default.createElement(TextDom,{overflowMaxLines:a,style:o,ref:l,text:t}),u&&React__default.default.createElement(antd.Popover,{placement:r,overlayClassName:`${longTextCls}-popover`,content:t},n))};module.exports=LongText;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var ahooks=require("ahooks"),es=require("antd/es"),React=require("react"),reactRedux=require("react-redux"),usePointCloudViews=require("../pointCloudView/hooks/usePointCloudViews.js"),PointCloudContext=require("../pointCloudView/PointCloudContext.js"),map=require("../../store/annotation/map.js"),ctx=require("../../store/ctx.js"),lbAnnotation=require("@labelbee/lb-annotation");function _interopDefaultLegacy(
|
|
1
|
+
"use strict";var ahooks=require("ahooks"),es=require("antd/es"),React=require("react"),reactRedux=require("react-redux"),usePointCloudViews=require("../pointCloudView/hooks/usePointCloudViews.js"),PointCloudContext=require("../pointCloudView/PointCloudContext.js"),map=require("../../store/annotation/map.js"),ctx=require("../../store/ctx.js"),lbAnnotation=require("@labelbee/lb-annotation");function _interopDefaultLegacy(u){return u&&typeof u=="object"&&"default"in u?u:{default:u}}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=(u,i,n)=>i in u?__defProp(u,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):u[i]=n,__spreadValues=(u,i)=>{for(var n in i||(i={}))__hasOwnProp.call(i,n)&&__defNormalProp(u,n,i[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(i))__propIsEnum.call(i,n)&&__defNormalProp(u,n,i[n]);return u},__spreadProps=(u,i)=>__defProps(u,__getOwnPropDescs(i));const PointCloud2DRectOperationView=u=>{var i;const{mappingData:n,size:l,config:f,checkMode:V,afterImgOnLoad:y}=u,p=(i=n==null?void 0:n.url)!=null?i:"",{pointCloudBoxList:v,setPointCloudResult:b,defaultAttribute:R,rectList:_,addRectIn2DView:E,updateRectIn2DView:w,removeRectIn2DView:S}=React.useContext(PointCloudContext.PointCloudContext),{update2DViewRect:j,remove2DViewRect:q}=usePointCloudViews.usePointCloudViews(),g=React__default.default.useRef(null),r=React.useRef(null),P=ahooks.useMemoizedFn(j),C=ahooks.useMemoizedFn(q),m=React.useRef(null),[B,I]=React.useState(!0),D=React.useMemo(()=>_==null?void 0:_.filter(e=>e.imageName===(n==null?void 0:n.path)),[n==null?void 0:n.path,_]),s=ahooks.useLatest(n==null?void 0:n.path),x=e=>{const{boxID:o}=e;if(o){const t=P==null?void 0:P(e);m.current=t,b(t);return}w(e)},O=e=>{s.current&&E(__spreadProps(__spreadValues({},e),{imageName:s.current}))},h=e=>{const o=e.find(t=>t.boxID);if(o){const t=C==null?void 0:C(o);m.current=t,b(t),d();return}S(e)},M=ahooks.useMemoizedFn(()=>{let e=[];return v.forEach(o=>{const{rects:t=[],id:c,attribute:a,trackID:z}=o,L=t.find(F=>F.imageName===s.current),A=c+"_"+s.current;L&&(e=[...e,__spreadProps(__spreadValues({},L),{boxID:c,id:A,attribute:a,order:z})])}),e}),d=ahooks.useMemoizedFn(()=>{var e,o,t;const c=M(),a=(e=r.current)==null?void 0:e.selectedRectID;(o=r.current)==null||o.setResult([...c,...D]),a&&((t=r.current)==null||t.setSelectedRectID(a))});return React.useEffect(()=>{if(g.current){const e=new lbAnnotation.PointCloud2DRectOperation({container:g.current,size:l,config:__spreadProps(__spreadValues({},f),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:V});return r.current=e,r.current.init(),r.current.on("updateDragResult",x),r.current.on("afterAddingDrawingRect",O),r.current.on("deleteSelectedRects",h),()=>{var o,t,c,a;(o=r.current)==null||o.unbind("updateDragResult",x),(t=r.current)==null||t.unbind("afterAddingDrawingRect",O),(c=r.current)==null||c.unbind("deleteSelectedRects",h),(a=r.current)==null||a.destroy()}}},[]),React.useEffect(()=>{I(!0),r.current&&p&&lbAnnotation.ImgUtils.load(p).then(e=>{r.current.setImgNode(e),y(e),I(!1)})},[p]),React.useEffect(()=>{var e;(e=r.current)==null||e.setSize(l)},[l]),React.useEffect(()=>{v!==m.current&&d()},[v]),React.useEffect(()=>{var e,o,t;const c=D.find(a=>a.id===r.current.selectedRectID);(o=(e=r.current)==null?void 0:e.setDefaultAttribute)==null||o.call(e,R),c&&w(__spreadProps(__spreadValues({},(t=r.current)==null?void 0:t.selectedRect),{attribute:R})),d()},[R]),React.useEffect(()=>{d()},[D]),React.useEffect(()=>{var e,o,t,c;const a=(o=(e=r.current)==null?void 0:e.config)!=null?o:{};(c=r.current)==null||c.setConfig(JSON.stringify(__spreadProps(__spreadValues({},a),{attributeList:(t=f.attributeList)!=null?t:[]})))},[f.attributeList]),React__default.default.createElement(es.Spin,{spinning:B},React__default.default.createElement("div",{ref:g,style:__spreadValues({position:"relative"},l)}))};var PointCloud2DRectOperationView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloud2DRectOperationView);module.exports=PointCloud2DRectOperationView$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var dom=require("../../utils/dom.js"),React=require("react"),PointCloudLayout=require("./PointCloudLayout.js"),PointCloudContext=require("./PointCloudContext.js"),reactRedux=require("react-redux"),lbAnnotation=require("@labelbee/lb-annotation"),ctx=require("../../store/ctx.js"),map=require("../../store/annotation/map.js"),lbUtils=require("@labelbee/lb-utils"),PointCloud2DSingleView=require("./PointCloud2DSingleView.js"),index=require("./components/TitleButton/index.js"),icons=require("@ant-design/icons"),classNames=require("classnames"),icon_esc=require("../../assets/annotation/common/icon_esc.svg.js"),icon_left_squareOutlined=require("../../assets/annotation/common/icon_left_squareOutlined.svg.js"),icon_right_squareOutlined=require("../../assets/annotation/common/icon_right_squareOutlined.svg.js"),_=require("lodash");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,l,
|
|
1
|
+
"use strict";var dom=require("../../utils/dom.js"),React=require("react"),PointCloudLayout=require("./PointCloudLayout.js"),PointCloudContext=require("./PointCloudContext.js"),reactRedux=require("react-redux"),lbAnnotation=require("@labelbee/lb-annotation"),ctx=require("../../store/ctx.js"),map=require("../../store/annotation/map.js"),lbUtils=require("@labelbee/lb-utils"),PointCloud2DSingleView=require("./PointCloud2DSingleView.js"),index$1=require("./components/TitleButton/index.js"),icons=require("@ant-design/icons"),classNames=require("classnames"),icon_esc=require("../../assets/annotation/common/icon_esc.svg.js"),icon_left_squareOutlined=require("../../assets/annotation/common/icon_left_squareOutlined.svg.js"),icon_right_squareOutlined=require("../../assets/annotation/common/icon_right_squareOutlined.svg.js"),_=require("lodash"),index=require("../../utils/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,l,n)=>l in e?__defProp(e,l,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[l]=n,__spreadValues=(e,l)=>{for(var n in l||(l={}))__hasOwnProp.call(l,n)&&__defNormalProp(e,n,l[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(l))__propIsEnum.call(l,n)&&__defNormalProp(e,n,l[n]);return e},__spreadProps=(e,l)=>__defProps(e,__getOwnPropDescs(l));const EKeyCode=lbAnnotation.cKeyCode.default,ContainerTitle=({showEnlarge:e,isEnlargeTopView:l,data:n,setIsEnlarge:m,setCurIndex:f,curIndex:p=0,index:w,annotations2d:b})=>l?React__default.default.createElement(index$1,{title:n==null?void 0:n.calName,style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}):e?React__default.default.createElement("div",{style:{display:"flex",alignItems:"center"}},React__default.default.createElement(icons.LeftOutlined,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{m(!1),f(void 0)}}),React__default.default.createElement("span",null,n==null?void 0:n.calName),React__default.default.createElement("span",{style:{marginLeft:"8px"}},p+1,"/",b==null?void 0:b.length)):React__default.default.createElement(index$1,{title:n==null?void 0:n.calName,onClick:()=>{m(!0),f(w)},style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}),PointCloud2DView=({currentData:e,config:l,thumbnailWidth:n,isEnlargeTopView:m,highlightAttribute:f,loadPCDFileLoading:p,checkMode:w,measureVisible:b})=>{var I;const[d,M]=React.useState([]),{topViewInstance:U,displayPointCloudList:F,polygonList:O,imageSizes:x,selectedIDs:S}=React.useContext(PointCloudContext.PointCloudContext),[P,B]=React.useState(""),[y,L]=React.useState(!1),[s,E]=React.useState(void 0);React.useEffect(()=>{var o;if(!p&&U&&(e==null?void 0:e.mappingImgList)&&((o=e==null?void 0:e.mappingImgList)==null?void 0:o.length)>0){const i={fill:"transparent",color:"green"};let r=[];e==null||e.mappingImgList.forEach(t=>{var v,R,V;const A=F.reduce((a,c)=>{var g,u;const h=c.id===P||f===c.attribute,{transferViewData:q,viewRangePointList:C}=(g=lbAnnotation.pointCloudLidar2image(c,t.calib,{createRange:h}))!=null?g:{};if(!q||!C)return[];const W=q.reduce((H,$)=>$.type==="line"?[...H,...$.pointList]:H,[]),X=__spreadProps(__spreadValues({},index.getBoundingRect(W)),{imageName:t.path});if(!index.isBoundingRectInImage(X,t.path,x))return a;const T=(u=lbUtils.toolStyleConverter.getColorFromConfig({attribute:c.attribute},__spreadProps(__spreadValues({},l),{attributeConfigurable:!0}),{}))==null?void 0:u.stroke,Y=G({viewDataPointList:q,pointCloudBox:c,defaultViewStyle:i,stroke:T}),K=[...a,...Y];return(C==null?void 0:C.length)>0&&K.unshift({type:"polygon",annotation:__spreadProps(__spreadValues({id:P,pointList:C},i),{stroke:T,fill:"rgba(255, 255, 255, 0.6)"})}),K},[]),z=x[(v=t==null?void 0:t.path)!=null?v:""];z&&_.isNumber((R=t==null?void 0:t.calib)==null?void 0:R.groundHeight)&&O.forEach(a=>{const c=a.pointList.map(u=>{var h;return __spreadProps(__spreadValues({},u),{z:(h=t==null?void 0:t.calib)==null?void 0:h.groundHeight})}),g=lbAnnotation.pointListLidar2Img(c,t==null?void 0:t.calib,z);if(g){const u=lbUtils.toolStyleConverter.getColorFromConfig({attribute:a.attribute},__spreadProps(__spreadValues({},l),{attributeConfigurable:!0}),{});A.push({type:"polygon",annotation:__spreadProps(__spreadValues({id:a.id,pointList:g},i),{stroke:u==null?void 0:u.stroke,fill:S.includes(a.id)?u==null?void 0:u.fill:"rgba(255, 255, 255, 0.6)"})})}}),r.push({annotations:A,url:t==null?void 0:t.url,calName:(V=t==null?void 0:t.calib)==null?void 0:V.calName,calib:t==null?void 0:t.calib,path:t==null?void 0:t.path})}),M(r)}},[F,e==null?void 0:e.mappingImgList,P,f,p,O,x,S]),React.useEffect(()=>(window.addEventListener("keydown",j),()=>{window.removeEventListener("keydown",j)}),[s]);const j=o=>{const{keyCode:i}=o;switch(i){case EKeyCode.Esc:y&&L(!1);break;case EKeyCode.Left:k();break;case EKeyCode.Right:N();break}},k=()=>{s===void 0||!y||Number(s)>0&&E(s-1)},N=()=>{s===void 0||!y||Number(s)<(d==null?void 0:d.length)-1&&E(s+1)},G=({viewDataPointList:o,pointCloudBox:i,defaultViewStyle:r,stroke:t})=>o?o.map(v=>({type:v.type,annotation:__spreadProps(__spreadValues({id:i.id,pointList:v.pointList},r),{stroke:t})})):[],J=!e||!(e==null?void 0:e.mappingImgList)||!(((I=e==null?void 0:e.mappingImgList)==null?void 0:I.length)>0),Q=React__default.default.createElement("div",{style:{display:"flex",alignItems:"center",fontSize:"14px"}},React__default.default.createElement("img",{src:icon_left_squareOutlined,style:{height:"24px",marginRight:"8px",cursor:"pointer"},onClick:()=>k()}),React__default.default.createElement("span",{style:{marginRight:"12px"}},"\u952E\u76D8\u5DE6\u952E\u4E0A\u4E00\u5F20"),React__default.default.createElement("span",{style:{margin:"0px 8px 0px 12px"}},"\u952E\u76D8\u53F3\u952E\u4E0A\u4E00\u5F20"),React__default.default.createElement("img",{src:icon_right_squareOutlined,style:{height:"24px",marginRight:"12px",cursor:"pointer"},onClick:()=>N()}),React__default.default.createElement("img",{src:icon_esc,style:{height:"24px",margin:"0px 8px 0px 12px",cursor:"pointer"},onClick:()=>{L(!1),E(void 0)}}),React__default.default.createElement("span",null,"\u952E\u9000\u51FA"));return(d==null?void 0:d.length)>0?React__default.default.createElement(React__default.default.Fragment,null,d.map((o,i)=>{const r=y&&i===s;return React__default.default.createElement(PointCloudLayout.PointCloudContainer,{className:classNames__default.default({[dom.getClassName("point-cloud-2d-container")]:!0,[dom.getClassName("point-cloud-container","zoom")]:r}),title:React__default.default.createElement(ContainerTitle,{showEnlarge:r,isEnlargeTopView:m,data:o,setIsEnlarge:L,setCurIndex:E,curIndex:s,index:i,annotations2d:d}),titleOnSurface:!r,style:{display:J?"none":"flex",width:r?"100%":n},key:i,toolbar:Q},(o==null?void 0:o.annotations)&&(o==null?void 0:o.url)&&React__default.default.createElement(PointCloud2DSingleView,{currentData:e,view2dData:o,setSelectedID:B,showEnlarge:r,checkMode:w,measureVisible:b}))})):null};var PointCloud2DView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloud2DView);module.exports=PointCloud2DView$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var dom=require("../../utils/dom.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),classNames=require("classnames"),React=require("react"),PointCloudLayout=require("./PointCloudLayout.js"),PointCloudContext=require("./PointCloudContext.js"),map=require("../../store/annotation/map.js"),reactRedux=require("react-redux"),index=require("../../utils/index.js"),useSingleBox=require("./hooks/useSingleBox.js"),useSphere=require("./hooks/useSphere.js"),antd=require("antd"),useSize=require("../../hooks/useSize.js"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),reactI18next=require("react-i18next"),ctx=require("../../store/ctx.js"),index$1=require("./components/PointCloudSizeSlider/index.js"),index$2=require("./components/TitleButton/index.js"),icons=require("@ant-design/icons");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}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=(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));const EKeyCode=lbAnnotation.cKeyCode.default,pointCloudID="LABELBEE-POINTCLOUD",PointCloud3DContext=React__default.default.createContext({isActive:!1,setTarget3DView:()=>{},reset3DView:()=>{},followTopView:()=>{}}),PointCloudViewIcon=({perspectiveView:t})=>{const{isActive:o,setTarget3DView:i}=React.useContext(PointCloud3DContext),n=u=>classNames__default.default({[dom.getClassName("point-cloud-3d-view",u)]:!0,active:o});return React__default.default.createElement("span",{onClick:()=>{i(lbUtils.EPerspectiveView[t])},className:n(t.toLocaleLowerCase())})},PointCloud3DSideBar=({isEnlarge:t})=>{const{reset3DView:o,followTopView:i}=React.useContext(PointCloud3DContext),{t:n}=reactI18next.useTranslation(),u=React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Top"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Front"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Left"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Back"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Right"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"LFT"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"RBT"})),p=React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(antd.Tooltip,{title:n("CameraFollowTopView")},React__default.default.createElement("span",{onClick:()=>{i()},className:dom.getClassName("point-cloud-3d-view","followTop")})),React__default.default.createElement("span",{onClick:()=>{o()},className:dom.getClassName("point-cloud-3d-view","reset")}));return t?React__default.default.createElement("div",{className:dom.getClassName("point-cloud-3d-sidebarZoom")},p,u):React__default.default.createElement("div",{className:dom.getClassName("point-cloud-3d-sidebar")},u,p)},PointCloud3D=({currentData:t,config:o,highlightAttribute:i})=>{const n=React.useContext(PointCloudContext.PointCloudContext),[u,p]=React.useState(!0),[d,
|
|
1
|
+
"use strict";var dom=require("../../utils/dom.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),classNames=require("classnames"),React=require("react"),PointCloudLayout=require("./PointCloudLayout.js"),PointCloudContext=require("./PointCloudContext.js"),map=require("../../store/annotation/map.js"),reactRedux=require("react-redux"),index=require("../../utils/index.js"),useSingleBox=require("./hooks/useSingleBox.js"),useSphere=require("./hooks/useSphere.js"),antd=require("antd"),useSize=require("../../hooks/useSize.js"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),reactI18next=require("react-i18next"),ctx=require("../../store/ctx.js"),index$1=require("./components/PointCloudSizeSlider/index.js"),index$2=require("./components/TitleButton/index.js"),icons=require("@ant-design/icons");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}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=(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));const EKeyCode=lbAnnotation.cKeyCode.default,pointCloudID="LABELBEE-POINTCLOUD",PointCloud3DContext=React__default.default.createContext({isActive:!1,setTarget3DView:()=>{},reset3DView:()=>{},followTopView:()=>{}}),PointCloudViewIcon=({perspectiveView:t})=>{const{isActive:o,setTarget3DView:i}=React.useContext(PointCloud3DContext),n=u=>classNames__default.default({[dom.getClassName("point-cloud-3d-view",u)]:!0,active:o});return React__default.default.createElement("span",{onClick:()=>{i(lbUtils.EPerspectiveView[t])},className:n(t.toLocaleLowerCase())})},PointCloud3DSideBar=({isEnlarge:t})=>{const{reset3DView:o,followTopView:i}=React.useContext(PointCloud3DContext),{t:n}=reactI18next.useTranslation(),u=React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Top"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Front"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Left"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Back"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Right"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"LFT"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"RBT"})),p=React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(antd.Tooltip,{title:n("CameraFollowTopView")},React__default.default.createElement("span",{onClick:()=>{i()},className:dom.getClassName("point-cloud-3d-view","followTop")})),React__default.default.createElement("span",{onClick:()=>{o()},className:dom.getClassName("point-cloud-3d-view","reset")}));return t?React__default.default.createElement("div",{className:dom.getClassName("point-cloud-3d-sidebarZoom")},p,u):React__default.default.createElement("div",{className:dom.getClassName("point-cloud-3d-sidebar")},u,p)},PointCloud3D=({currentData:t,config:o,highlightAttribute:i})=>{const n=React.useContext(PointCloudContext.PointCloudContext),[u,p]=React.useState(!0),[d,C]=React.useState(!1),m=React.useRef(null),{initPointCloud3d:E}=usePointCloudViews.usePointCloudViews(),f=useSize(m),{t:g}=reactI18next.useTranslation();React.useEffect(()=>{!n.mainViewInstance||E==null||E(f)},[f]);const{selectedBox:c}=useSingleBox.useSingleBox(),{selectedSphere:v}=useSphere.useSphere(),V=e=>{var a,l;const r=c==null?void 0:c.info;if(r){const s=__spreadValues({},r.center);s.x=s.x-.01,s.z=1e3;const w=e===lbUtils.EPerspectiveView.Top;(a=n.mainViewInstance)==null||a.updateCameraByBox(r,e,w?s:void 0)}v&&((l=n.mainViewInstance)==null||l.updateCameraBySphere(v,e))},_=()=>{var e;(e=n.mainViewInstance)==null||e.resetCamera()},h=()=>{var e,a;const l=(e=n.topViewInstance)==null?void 0:e.pointCloudInstance.camera;l&&((a=n.mainViewInstance)==null||a.applyCameraTarget(l))};React.useEffect(()=>{if(m.current&&(t==null?void 0:t.url)){let e=n.mainViewInstance;!e&&f.width&&(e=new lbAnnotation.PointCloud({container:m.current,isOrthographicCamera:!0,orthographicParams:lbUtils.PointCloudUtils.getDefaultOrthographicParams(f),config:o}),n.setMainViewInstance(e))}},[f,t]),React.useEffect(()=>{var e;if(m.current&&(t==null?void 0:t.url)&&t.result&&n.mainViewInstance){let a=n.mainViewInstance;const l=lbUtils.PointCloudUtils.getBoxParamsFromResultList(t.result);l.forEach(s=>{var w;const b=(w=lbUtils.toolStyleConverter.getColorFromConfig({attribute:s.attribute},__spreadProps(__spreadValues({},o),{attributeConfigurable:!0}),{}))==null?void 0:w.hex;a==null||a.addBoxToSense(s,b)}),a.render(),n.setPointCloudResult(l);const r=lbUtils.PointCloudUtils.getRectParamsFromResultList(t.result);n.setRectList(r),n.setPointCloudValid((e=index.jsonParser(t.result))==null?void 0:e.valid)}},[t,n.mainViewInstance]),React.useEffect(()=>{var e,a,l,r;if(c){V(lbUtils.EPerspectiveView.Top);const s=(l=(a=(e=n.topViewInstance)==null?void 0:e.pointCloudInstance)==null?void 0:a.camera.zoom)!=null?l:1;(r=n.mainViewInstance)==null||r.updateCameraZoom(s)}},[c]),React.useEffect(()=>{var e,a,l,r;if(v){V(lbUtils.EPerspectiveView.Top);const s=(l=(a=(e=n.topViewInstance)==null?void 0:e.pointCloudInstance)==null?void 0:a.camera.zoom)!=null?l:1;(r=n.mainViewInstance)==null||r.updateCameraZoom(s)}},[v]),React.useEffect(()=>(window.addEventListener("keydown",P),()=>{window.removeEventListener("keydown",P)}),[]);const P=e=>{if(e.keyCode===EKeyCode.Esc){C(!1);return}},x=React.useMemo(()=>({reset3DView:_,setTarget3DView:V,isActive:!!c,followTopView:h}),[c,n.mainViewInstance]);React.useEffect(()=>{var e,a,l;const r=n.pointCloudBoxList.filter(s=>s.attribute===i);(r==null?void 0:r.length)>0&&((e=n.mainViewInstance)==null||e.clearHighlightBoxes(),(a=n.mainViewInstance)==null||a.highlightBoxes(r)),r.length===0&&((l=n.mainViewInstance)==null||l.clearHighlightBoxesAndRender())},[i,n.mainViewInstance]);const I=React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(index$1,{onChange:e=>{var a;(a=n.mainViewInstance)==null||a.updatePointSize({customSize:e})}}),React__default.default.createElement("span",{style:{marginRight:8}},g("ShowArrows")),React__default.default.createElement(antd.Switch,{size:"small",checked:u,onChange:e=>{var a;p(e),(a=n.mainViewInstance)==null||a.setShowDirection(e)}}),d&&React__default.default.createElement(PointCloud3DContext.Provider,{value:x},React__default.default.createElement(PointCloud3DSideBar,{isEnlarge:d})));return React__default.default.createElement(PointCloudLayout.PointCloudContainer,{className:classNames__default.default({[dom.getClassName("point-cloud-3d-container")]:!0,[dom.getClassName("point-cloud-container","zoom")]:d}),title:d?React__default.default.createElement("div",{style:{display:"flex",alignItems:"center"}},React__default.default.createElement(icons.LeftOutlined,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{C(!1)}}),g("3DView")):React__default.default.createElement(index$2,{title:g("3DView"),onClick:()=>{C(!0)}}),toolbar:I},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-3d-content")},!d&&React__default.default.createElement(PointCloud3DContext.Provider,{value:x},React__default.default.createElement(PointCloud3DSideBar,null)),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-3d-view"),id:pointCloudID,ref:m})))};var PointCloud3DView=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloud3D);module.exports=PointCloud3DView;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbUtils=require("@labelbee/lb-utils"),React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),ctx=require("../../store/ctx.js"),actionCreators=require("../../store/annotation/actionCreators.js"),index=require("../../store/annotatedBox/index.js");function _interopDefaultLegacy(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbUtils=require("@labelbee/lb-utils"),React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),ctx=require("../../store/ctx.js"),actionCreators=require("../../store/annotation/actionCreators.js"),index=require("../../store/annotatedBox/index.js"),_=require("lodash");function _interopDefaultLegacy(o){return o&&typeof o=="object"&&"default"in o?o:{default:o}}var React__default=_interopDefaultLegacy(React),___default=_interopDefaultLegacy(_),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(o,n,i)=>n in o?__defProp(o,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):o[n]=i,__spreadValues=(o,n)=>{for(var i in n||(n={}))__hasOwnProp.call(n,i)&&__defNormalProp(o,i,n[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(n))__propIsEnum.call(n,i)&&__defNormalProp(o,i,n[i]);return o},__spreadProps=(o,n)=>__defProps(o,__getOwnPropDescs(n)),__async=(o,n,i)=>new Promise((b,y)=>{var L=c=>{try{I(i.next(c))}catch(S){y(S)}},x=c=>{try{I(i.throw(c))}catch(S){y(S)}},I=c=>c.done?b(c.value):Promise.resolve(c.value).then(L,x);I((i=i.apply(o,n)).next())});const pickRectObject=o=>___default.default.pick(o,["id","attribute","width","height","x","y","imageName"]),PointCloudContext=React__default.default.createContext({rectList:[],pointCloudBoxList:[],pointCloudSphereList:[],displayPointCloudList:[],displaySphereList:[],displayLineList:[],polygonList:[],lineList:[],selectedID:"",selectedIDs:[],highlightIDs:[],setHighlightIDs:()=>{},valid:!0,setSelectedIDs:()=>{},setPointCloudResult:()=>{},setPointCloudSphereList:()=>{},setPointCloudValid:()=>{},setTopViewInstance:()=>{},setSideViewInstance:()=>{},setBackViewInstance:()=>{},setMainViewInstance:()=>{},addSelectedID:()=>{},addHighlightID:()=>{},selectedAllBoxes:()=>{},addPointCloudBox:()=>[],addPointCloudSphere:()=>[],setPolygonList:()=>{},setRectList:()=>{},addRectIn2DView:()=>{},removeRectIn2DView:()=>{},updateRectIn2DView:()=>{},setLineList:()=>{},zoom:1,setZoom:()=>{},history:new lbAnnotation.ActionsHistory,hideAttributes:[],setHideAttributes:()=>{},toggleAttributesVisible:()=>{},reRender:()=>{},setAttrPanelLayout:()=>{},attrPanelLayout:"",syncAllViewPointCloudColor:()=>Promise.resolve(),defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:lbAnnotation.EToolName.Rect,setPointCloudPattern:()=>{},selectSpecAttr:()=>{},globalPattern:lbUtils.EPointCloudPattern.Detection,setGlobalPattern:()=>{},setPtSegmentInstance:()=>{},segmentation:[],setSegmentation:()=>{},clearAllDetectionInstance:()=>{},highlight2DDataList:[],setHighlight2DDataList:()=>{},cuboidBoxIn2DView:!0,setCuboidBoxIn2DView:o=>{},imageSizes:{},cacheImageNodeSize:()=>{}}),PointCloudProvider=({children:o})=>{const[n,i]=React.useState([]),[b,y]=React.useState([]),[L,x]=React.useState([]),[I,c]=React.useState([]),[S,et]=React.useState([]),[v,V]=React.useState([]),[w,R]=React.useState([]),[N,nt]=React.useState(!0),[q,ot]=React.useState(!0),[z,it]=React.useState(1),[r,M]=React.useState(),[G,T]=React.useState(),[F,k]=React.useState(),[s,Z]=React.useState(),[U,st]=React.useState(""),[B,lt]=React.useState(lbAnnotation.EToolName.Rect),rt=React.useRef(new lbAnnotation.ActionsHistory).current,[d,O]=React.useState([]),[J,at]=React.useState(""),[H,ut]=React.useState(lbUtils.EPointCloudPattern.Detection),[C,K]=React.useState(void 0),[E,ct]=React.useState([]),[j,dt]=React.useState([]),p=index(),[Q,pt]=React.useState({}),vt=ctx.useDispatch(),ft=l=>{const{imgNode:a,path:u}=l;u&&a&&pt(P=>__spreadProps(__spreadValues({},P),{[u]:{width:a.width,height:a.height}}))},W=React.useMemo(()=>v.length===1?v[0]:"",[v]),A=React.useMemo(()=>{const l=n.find(t=>t.id===W),a=t=>{const e=n.concat(t);return i(e),e},u=t=>{const e=b.concat(t);return y(e),e},P=t=>{nt(t!==!1)},f=t=>{t===void 0&&V([]),typeof t=="string"&&V([t]),Array.isArray(t)&&V(Array.from(new Set(t)))},Pt=t=>{v.includes(t)?f(v.filter(e=>e!==t)):f([...v,t])},ht=t=>{const e=pickRectObject(t);c(g=>[...g,e])},St=t=>{const e=pickRectObject(t);c(g=>g.map(h=>h.id===t.id?e:h))},bt=t=>{c(e=>e.filter(g=>!t.find(h=>h.id===g.id)))},It=t=>{w.includes(t)?R([]):R([t])},Ct=()=>{if(B===lbAnnotation.EToolName.Rect){const t=n.map(e=>e.id);f(t),r==null||r.pointCloud2dOperation.setSelectedIDs(t)}},mt=t=>{f(n.filter(e=>e.attribute===t).map(e=>e.id))},X=n.filter(t=>!d.includes(t.attribute)),Y=b.filter(t=>!d.includes(t.attribute)),$=S.filter(t=>t.attribute&&!d.includes(t.attribute)),yt=t=>{if(d.includes(t))O(d.filter(e=>e!==t));else{const e=d.concat(t);O(e)}},Lt=(t=X,e=L,g=Y,h=$,D=E)=>{var m;s==null||s.clearAllBox(),s==null||s.clearAllSphere(),r==null||r.updatePolygonList(t,e),r==null||r.updatePointList(g),r==null||r.updateLineList(h),s==null||s.generateBoxes(t),s==null||s.generateSpheres(g),(m=C==null?void 0:C.store)==null||m.updateCurrentSegment(D),tt(t)},wt=()=>{M(void 0),T(void 0),k(void 0),Z(void 0)},tt=(t,e)=>__async(void 0,null,function*(){var g;if(!s)return;const h=s.pointCloudObject;if(!!h)try{const D=yield s.getHighlightIndexByMappingImgList({mappingImgList:e!=null?e:j,points:h.geometry.attributes.position.array}),m=yield s==null?void 0:s.highlightOriginPointCloud(t,D);return m&&((g=r==null?void 0:r.pointCloudInstance)==null||g.updateColor(m)),m}catch(D){console.error(D)}});return{selectedID:W,pointCloudBoxList:n,pointCloudSphereList:b,displayPointCloudList:X,displaySphereList:Y,displayLineList:$,selectedIDs:v,setPointCloudResult:i,setSelectedIDs:f,addPointCloudBox:a,addPointCloudSphere:u,setPointCloudSphereList:y,valid:N,selectedPointCloudBox:l,setPointCloudValid:P,addSelectedID:Pt,addHighlightID:It,selectedAllBoxes:Ct,topViewInstance:r,setTopViewInstance:M,sideViewInstance:G,setSideViewInstance:T,backViewInstance:F,setBackViewInstance:k,mainViewInstance:s,setMainViewInstance:Z,polygonList:L,setPolygonList:x,rectList:I,setRectList:c,addRectIn2DView:ht,removeRectIn2DView:bt,updateRectIn2DView:St,lineList:S,setLineList:et,zoom:z,setZoom:it,history:rt,toggleAttributesVisible:yt,hideAttributes:d,setHideAttributes:O,reRender:Lt,attrPanelLayout:J,setAttrPanelLayout:at,syncAllViewPointCloudColor:tt,defaultAttribute:U,setDefaultAttribute:st,pointCloudPattern:B,setPointCloudPattern:lt,selectSpecAttr:mt,globalPattern:H,setGlobalPattern:t=>{H!==t&&(vt(actionCreators.ChangeSave),ut(t),t===lbUtils.EPointCloudPattern.Detection&&K(void 0))},ptSegmentInstance:C,setPtSegmentInstance:K,segmentation:E,setSegmentation:ct,clearAllDetectionInstance:wt,highlight2DDataList:j,setHighlight2DDataList:dt,cuboidBoxIn2DView:q,setCuboidBoxIn2DView:ot,imageSizes:Q,cacheImageNodeSize:ft,highlightIDs:w,setHighlightIDs:R}},[N,v,n,b,L,S,I,r,G,F,s,z,d,J,U,B,H,C,E,j,q,Q,w]);React.useEffect(()=>{var l,a,u;(l=p==null?void 0:p.setPointCloudBoxList)==null||l.call(p,n),(a=p==null?void 0:p.setHighlightIDs)==null||a.call(p,w),(u=p==null?void 0:p.setSelectedIDs)==null||u.call(p,v)},[n,v,w]),React.useEffect(()=>{var l;(l=p==null?void 0:p.setPtCtx)==null||l.call(p,A)},[A]);const gt=()=>{const l=n.filter(f=>d.includes(f.attribute)),{setSelectedIDs:a,reRender:u}=A,P=l.map(f=>f.id);P.length>0&&a(v.filter(f=>!P.includes(f))),u()};return React.useEffect(()=>{var l,a,u,P;gt(),(a=(l=r==null?void 0:r.toolInstance)==null?void 0:l.setHiddenAttributes)==null||a.call(l,d),(P=(u=C==null?void 0:C.store)==null?void 0:u.setHiddenAttributes)==null||P.call(u,d)},[d]),React__default.default.createElement(PointCloudContext.Provider,{value:A},o)};exports.PointCloudContext=PointCloudContext,exports.PointCloudProvider=PointCloudProvider;
|
|
@@ -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"),useHistory=require("./useHistory.js"),usePolygon=require("./usePolygon.js"),ahooks=require("ahooks"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,n)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,__spreadValues=(e,t)=>{for(var n in t||(t={}))__hasOwnProp.call(t,n)&&__defNormalProp(e,n,t[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(t))__propIsEnum.call(t,n)&&__defNormalProp(e,n,t[n]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t)),__async=(e,t,n)=>new Promise((a,o)=>{var d=u=>{try{c(n.next(u))}catch(f){o(f)}},P=u=>{try{c(n.throw(u))}catch(f){o(f)}},c=u=>u.done?a(u.value):Promise.resolve(u.value).then(d,P);c((n=n.apply(e,t)).next())});const DEFAULT_SCOPE=5,DEFAULT_RADIUS=90,INTELLIGENT_FIT_MARGIN=.01,PointCloudView={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},topViewPoint2PointCloud=(e,t,n,a,o)=>{const{x:d,y:P}=lbUtils.PointCloudUtils.transferCanvas2World(e,t),{defaultZ:c}=lbUtils.DEFAULT_SPHERE_PARAMS,u={center:{x:d,y:P,z:c},id:e.id},f=a?__spreadValues(__spreadValues({},a),u):__spreadProps(__spreadValues({},u),{attribute:"",valid:!0});return o&&Object.assign(f,o),f},topViewPolygon2PointCloud=(e,t,n,a,o,d)=>{let P=e.pointList.map(y=>lbUtils.PointCloudUtils.transferCanvas2World(y,t)),c=0,u=1,f={};if(n){const y=n.getSensesPointZAxisInPolygon(P,void 0,d);d&&y.fittedCoordinates.length>0&&(P=y.fittedCoordinates),c=(y.maxZ+y.minZ)/2,u=y.maxZ-y.minZ,f={count:y.zCount}}const[v,B,j]=P,_=lbAnnotation.MathUtils.getLineCenterPoint([v,j]),O=lbAnnotation.MathUtils.getLineLength(v,B),I=lbAnnotation.MathUtils.getLineLength(B,j),A=lbAnnotation.MathUtils.getRadiusFromQuadrangle(e.pointList);a&&(c=a.center.z,u=a.depth);const k={center:{x:_.x,y:_.y,z:c},width:d?I+INTELLIGENT_FIT_MARGIN:I,height:d?O+INTELLIGENT_FIT_MARGIN:O,depth:u,rotation:A,id:e.id},R=__spreadValues(a?__spreadValues(__spreadValues({},a),k):__spreadProps(__spreadValues({},k),{attribute:"",valid:!0}),f);o&&Object.assign(R,o);const z=P.map(y=>lbUtils.PointCloudUtils.transferWorld2Canvas(y,t));return{boxParams:R,newPointList:z}},sideViewPoint2PointCloud=(e,t,n)=>{const a={x:e.x-t.x,y:e.y-t.y};return __spreadProps(__spreadValues({},n),{center:{x:n.center.x-a.x,y:n.center.y,z:n.center.z-a.y}})},sideViewPolygon2PointCloud=(e,t,n,a)=>{const[o,d,P]=e.pointList,[c,u,f]=t.pointList,v=lbAnnotation.MathUtils.getLineCenterPoint([o,P]),B=lbAnnotation.MathUtils.getLineCenterPoint([c,f]),_={x:{x:v.x-B.x,y:v.y-B.y}.x,y:0,z:v.y-B.y},O=lbAnnotation.MathUtils.getLineLength(o,d),I=lbAnnotation.MathUtils.getLineLength(c,u),A=O-I,k=lbAnnotation.MathUtils.getLineLength(d,P),R=lbAnnotation.MathUtils.getLineLength(u,f),z=k-R,{newBoxParams:y}=a.getNewBoxBySideUpdate(_,z,A,n);return y},backViewPoint2PointCloud=(e,t,n)=>{const a={x:e.x-t.x,y:e.y-t.y};return __spreadProps(__spreadValues({},n),{center:{x:n.center.x,y:n.center.y-a.x,z:n.center.z-a.y}})},backViewPolygon2PointCloud=(e,t,n,a)=>{const[o,d,P]=e.pointList,[c,u,f]=t.pointList,v=lbAnnotation.MathUtils.getLineCenterPoint([o,P]),B=lbAnnotation.MathUtils.getLineCenterPoint([c,f]),_={x:{x:v.x-B.x,y:v.y-B.y}.x,y:0,z:v.y-B.y},O=lbAnnotation.MathUtils.getLineLength(o,d),I=lbAnnotation.MathUtils.getLineLength(c,u),A=O-I,k=lbAnnotation.MathUtils.getLineLength(d,P),R=lbAnnotation.MathUtils.getLineLength(u,f),z=k-R;let{newBoxParams:y}=a.getNewBoxByBackUpdate(_,z,A,n);return y},syncSideViewByPoint=(e,t,n,a,o)=>{var d;if(!n)return;const{toolInstance:P,pointCloudInstance:c}=n;c.loadPCDFile(a,(d=o==null?void 0:o.radius)!=null?d:DEFAULT_RADIUS);const{cameraPositionVector:u}=c.updateOrthoCameraBySphere(e,lbUtils.EPerspectiveView.Left);c.setInitCameraPosition(u);const{point2d:f,zoom:v}=c.getSphereSidePoint2DCoordinate(e);c.camera.zoom=v,c.camera.updateProjectionMatrix(),c.render(),P.initPosition(),P.zoomChangeOnCenter(v),P.setResult([__spreadProps(__spreadValues(__spreadValues({},t),f),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),P.setSelectedID(t.id)},synchronizeSideView=(e,t,n,a)=>{if(!n)return;const{pointCloud2dOperation:o,pointCloudInstance:d}=n;d.loadPCDFileByBox(a,e,{width:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:P}=d.updateOrthoCamera(e,lbUtils.EPerspectiveView.Left);d.setInitCameraPosition(P);const{polygon2d:c,zoom:u}=d.getBoxSidePolygon2DCoordinate(e);d.camera.zoom=u,d.camera.updateProjectionMatrix(),d.render(),o.initPosition(),o.zoomChangeOnCenter(u),o.setResultAndSelectedID([{id:t.id,valid:e.valid,pointList:c,textAttribute:"",isRect:!0,attribute:e.attribute}],t.id)},syncBackViewByPoint=(e,t,n,a,o)=>{var d;if(!n)return;const{toolInstance:P,pointCloudInstance:c}=n;c.loadPCDFile(a,(d=o==null?void 0:o.radius)!=null?d:DEFAULT_RADIUS);const{cameraPositionVector:u}=c.updateOrthoCameraBySphere(e,lbUtils.EPerspectiveView.Back);c.setInitCameraPosition(u);const{point2d:f,zoom:v}=c.getSphereBackPoint2DCoordinate(e);c.camera.zoom=v,c.camera.updateProjectionMatrix(),c.render(),P.initPosition(),P.zoomChangeOnCenter(v),P.setResult([__spreadProps(__spreadValues(__spreadValues({},t),f),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),P.setSelectedID(t.id)},synchronizeBackView=(e,t,n,a)=>{if(!n)return;const{pointCloud2dOperation:o,pointCloudInstance:d}=n;d.loadPCDFileByBox(a,e,{height:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:P}=d.updateOrthoCamera(e,lbUtils.EPerspectiveView.Back);d.setInitCameraPosition(P);const{polygon2d:c,zoom:u}=d.getBoxBackPolygon2DCoordinate(e);d.camera.zoom=u,d.camera.updateProjectionMatrix(),d.render(),o.initPosition(),o.zoomChangeOnCenter(u),o.setResultAndSelectedID([{id:t.id,valid:e.valid,pointList:c,textAttribute:"",isRect:!0,attribute:e.attribute}],t.id)},syncTopViewByPoint=(e,t,n,a)=>{if(!n||!a)return;a.generateSphere(e),a.updateCameraBySphere(e,lbUtils.EPerspectiveView.Top),a.render();const{toolInstance:o,pointCloudInstance:d}=n,{point2d:P}=d.getSphereTopPoint2DCoordinate(e),c=[...o.pointList].map(u=>u.id===t.id?__spreadProps(__spreadValues(__spreadValues({},t),P),{valid:e.valid,textAttribute:"",attribute:e.attribute}):u);o.setResult(c),o.setSelectedID(t.id)},synchronizeTopView=(e,t,n,a)=>{var o,d;if(!n||!a)return;a.generateBox(e,t.id),a.render();const{pointCloud2dOperation:P,pointCloudInstance:c}=n,{polygon2d:u}=c.getBoxTopPolygon2DCoordinate(e),f=[...P.polygonList],v=f.find(B=>B.id===t.id);v?(v.pointList=u,v.valid=(o=e.valid)!=null?o:!0):f.push({id:t.id,pointList:u,textAttribute:"",isRect:!0,valid:(d=e.valid)!=null?d:!0}),P.setResultAndSelectedID(f,t.id)},usePointCloudViews=()=>{const e=React.useContext(PointCloudContext.PointCloudContext),{topViewInstance:t,sideViewInstance:n,backViewInstance:a,mainViewInstance:o,addPointCloudBox:d,addPointCloudSphere:P,setSelectedIDs:c,selectedIDs:u,pointCloudBoxList:f,pointCloudSphereList:v,hideAttributes:B,setHighlight2DDataList:j,cuboidBoxIn2DView:_,imageSizes:O}=e,{addHistory:I,initHistory:A,pushHistoryUnderUpdatePolygon:k}=useHistory.useHistory(),{selectedPolygon:R}=usePolygon.usePolygon(),{getPointCloudSphereByID:z,updatePointCloudSphere:y,selectedSphere:q}=useSphere.useSphere(),{currentData:M,config:w}=ctx.useSelector(i=>{const{stepList:s,step:p,imgList:l,imgIndex:r}=i.annotation;return{currentData:l[r],config:index.jsonParser(StepUtils.getCurrentStepInfo(p,s).config)}}),T=ctx.useDispatch(),tt=ahooks.useLatest(_),W=i=>{if(!tt.current){const{mappingImgList:s=[]}=M,p=s.map(l=>index.getRectPointCloudBox({pointCloudBox:i,mappingData:l,imageSizes:O}));Object.assign(i,{rects:p.filter(l=>l!==void 0)})}},{selectedBox:S,updateSelectedBox:ot,updateSelectedBoxes:Z,getPointCloudByID:et}=useSingleBox.useSingleBox({generateRects:W}),Q=S==null?void 0:S.info;if(!t||!n||!a)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:G}=t,it=i=>{o==null||o.generateBox(i),o==null||o.controls.update(),o==null||o.render()},nt=i=>{o==null||o.generateSphere(i),o==null||o.controls.update(),o==null||o.render()},st=({newPoint:i,size:s,zoom:p,trackConfigurable:l})=>{var r;const C={attribute:(r=t.toolInstance.defaultAttribute)!=null?r:""};l===!0&&Object.assign(C,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:v})});const h=topViewPoint2PointCloud(i,s,G,void 0,C);c(i.id);const x=P(h);F(PointCloudView.Top,i,h,p,x,w),I({newSphereParams:h})},lt=({polygon:i,size:s,imgList:p,trackConfigurable:l,zoom:r,intelligentFit:C})=>{var h,x;const g={attribute:(h=t.toolInstance.defaultAttribute)!=null?h:""};l===!0&&Object.assign(g,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:f,extraSphereList:v})});const b=t==null?void 0:t.toolInstance,m=__spreadValues({},i);let{boxParams:L,newPointList:D}=topViewPolygon2PointCloud(m,s,G,void 0,g,C);L=T(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[L],stepConfig:w,action:"viewUpdateBox"}))[0],C&&(D==null?void 0:D.length)&&(m.pointList=D);const U=B.includes(m.attribute);W(L);const N=d(L),J=(x=e==null?void 0:e.polygonList)!=null?x:[];t==null||t.updatePolygonList(N!=null?N:[],J),U?c([]):(c(L.id),b.selection.setSelectedIDs(m.id),E({omitView:PointCloudView.Top,polygon:m,boxParams:L,zoom:r,newPointCloudBoxList:N}),C&&synchronizeTopView(L,m,t,o)),I({newBoxParams:L})},rt=i=>{const{boxID:s,imageName:p,width:l,height:r,x:C,y:h}=i,x=f.find(g=>g.id===s);if(x==null?void 0:x.rects){const{rects:g=[]}=x,b=g.find(m=>m.imageName===p);if(b){let m=g;const L=__spreadProps(__spreadValues({},b),{width:l,height:r,x:C,y:h});m=g.map(U=>U===b?L:U);const D=__spreadProps(__spreadValues({},x),{rects:m}),V=f.map(U=>U===x?D:U);return t==null||t.updatePolygonList(V!=null?V:[]),V}}},at=({newSelectedBox:i,newPointCloudList:s,newSelectedSphere:p,newSphereList:l})=>{var r;const C=t==null?void 0:t.toolInstance;if(!(u.length===0||!C)){if(i||(S==null?void 0:S.info)){const h=i!=null?i:S==null?void 0:S.info;(r=C==null?void 0:C.selection)==null||r.setSelectedIDs(u[0]);const x=C.selectedPolygon;if(u.length===1&&h){E({omitView:PointCloudView.Top,polygon:x,boxParams:h,newPointCloudBoxList:s});return}}if((p||q)&&u.length===1){const h=p!=null?p:q;C.setSelectedID(u[0]);const x=C.selectedPoint;h&&F(PointCloudView.Top,x,h,void 0,l,w)}}},X=(i,s,p)=>{if(Q){let l,r;switch(p){case PointCloudView.Back:l=backViewPolygon2PointCloud;break;case PointCloudView.Side:l=sideViewPolygon2PointCloud;break;default:l=sideViewPolygon2PointCloud;break}if(r=l(i,s,Q,n.pointCloudInstance),o){const{count:b}=o.getSensesPointZAxisInPolygon(lbAnnotation.getCuboidFromPointCloudBox(r).polygonPointList,[r.center.z-r.depth/2,r.center.z+r.depth/2]);r=__spreadProps(__spreadValues({},r),{count:b})}const h=T(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[r],stepConfig:w,action:"viewUpdateBox"}))[0],x=r.valid!==h.valid;r=h;const g=ot(r);return r=g.find(b=>b.id===r.id),E({omitView:x?void 0:p,polygon:i,boxParams:r,newPointCloudBoxList:g}),g}},Y=(i,s,p)=>{if(q){let l,r;switch(p){case PointCloudView.Back:l=backViewPoint2PointCloud;break;case PointCloudView.Side:l=sideViewPoint2PointCloud;break;default:l=sideViewPoint2PointCloud;break}r=l(i,s,q);const C=y(r);return F(p,i,r,void 0,C,w),C}},dt=(i,s)=>{Y(i,s,PointCloudView.Side)},ct=(i,s)=>{Y(i,s,PointCloudView.Back)},ut=(i,s)=>{X(i,s,PointCloudView.Side)},pt=(i,s)=>{X(i,s,PointCloudView.Back)},Pt=(i,s)=>{const p=z(i.id),l=topViewPoint2PointCloud(i,s,G,p),r=y(l);F(PointCloudView.Top,i,l,void 0,r,w)},Ct=(i,s)=>{if(R){const l=__spreadValues({},i[0].newPolygon);l.pointList=l.pointList.map(r=>lbUtils.PointCloudUtils.transferCanvas2World(r,s)),k(l);return}let p=i.map(({newPolygon:l})=>{const r=et(l.id),{boxParams:C}=topViewPolygon2PointCloud(l,s,t.pointCloudInstance,r);return C});if(p=T(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:p,stepConfig:w,action:"viewUpdateBox"})),p.length===1){const{newPolygon:l}=i[0],r=Z(p);E({polygon:l,boxParams:p[0],newPointCloudBoxList:r})}else{const l=Z(p);l&&e.syncAllViewPointCloudColor(l)}},gt=i=>{var s,p,l,r,C;if(S){const h=Number(i.widthDefault),x=Number(i.depthDefault),g=Number(i.heightDefault),b=S==null?void 0:S.info.trackID,L=((s=t==null?void 0:t.toolInstance)==null?void 0:s.polygonList).find(H=>(H==null?void 0:H.trackID)===b),D={width:(l=(p=t==null?void 0:t.toolInstance)==null?void 0:p.basicImgInfo)==null?void 0:l.width,height:(C=(r=t==null?void 0:t.toolInstance)==null?void 0:r.basicImgInfo)==null?void 0:C.height},V=L.pointList.map(H=>lbUtils.PointCloudUtils.transferCanvas2World(H,D)),U=lbAnnotation.MathUtils.getModifiedRectangleCoordinates(V,g,h),N=U[0],J=U[2],K=lbAnnotation.MathUtils.getLineCenterPoint([N,J]),ht=S.info.center.z-S.info.depth/2,$=__spreadProps(__spreadValues({},S.info),{center:{x:K.x,y:K.y,z:ht+x/2},width:h,height:g,depth:x,valid:!0}),ft=Z([$]);E({omitView:PointCloudView["3D"],polygon:L,boxParams:$,newPointCloudBoxList:ft})}},F=(i,s,p,l,r,C)=>__async(void 0,null,function*(){const h=M==null?void 0:M.url,x={[PointCloudView.Side]:()=>{syncSideViewByPoint(p,s,n,h,C)},[PointCloudView.Back]:()=>{a&&syncBackViewByPoint(p,s,a,h,C)},[PointCloudView.Top]:()=>{syncTopViewByPoint(p,s,t,o)}};Object.keys(x).forEach(g=>{g!==i&&x[g]()}),l&&(o==null||o.updateCameraZoom(l)),nt(p)}),E=i=>__async(void 0,null,function*(){const{omitView:s,polygon:p,boxParams:l,zoom:r,newPointCloudBoxList:C}=i,h=M==null?void 0:M.url;C&&(yield e.syncAllViewPointCloudColor(C));const x={[PointCloudView.Side]:()=>{synchronizeSideView(l,p,n,h)},[PointCloudView.Back]:()=>{a&&synchronizeBackView(l,p,a,h)},[PointCloudView.Top]:()=>{synchronizeTopView(l,p,t,o)}};Object.keys(x).forEach(g=>{g!==s&&x[g]()}),r&&(o==null||o.updateCameraZoom(r)),it(l)});return{topViewAddSphere:st,topViewAddBox:lt,topViewSelectedChanged:at,topViewUpdatePoint:Pt,sideViewUpdatePoint:dt,backViewUpdatePoint:ct,topViewUpdateBox:Ct,sideViewUpdateBox:ut,backViewUpdateBox:pt,pointCloudBoxListUpdated:i=>{t.updatePolygonList(i),o==null||o.generateBoxes(i)},initPointCloud3d:i=>{if(!o)return;const s=lbUtils.PointCloudUtils.getDefaultOrthographicParams(i);o.initOrthographicCamera(s),o.initRenderer(),o.render()},updatePointCloudData:(...i)=>__async(void 0,[...i],function*(s=M){var p,l,r,C,h,x;if(!(s==null?void 0:s.url)||!o)return;j([]),actionCreators.SetPointCloudLoading(T,!0),actionCreators.SetLoadPCDFileLoading(T,!0),yield o.loadPCDFile(s.url,(p=w==null?void 0:w.radius)!=null?p:DEFAULT_RADIUS),o==null||o.clearAllBox(),o==null||o.clearAllSphere();let g=[],b=[],m=[],L=[];o.updateTopCamera();const D=(r=(l=index.jsonParser(s.result))==null?void 0:l.valid)!=null?r:!0;if(e.setPointCloudValid(D),(C=e.sideViewInstance)==null||C.clearAllData(),(h=e.backViewInstance)==null||h.clearAllData(),s.result){if(g=lbUtils.PointCloudUtils.getBoxParamsFromResultList(s.result),(g==null?void 0:g.length)>0&&s.isPreResult&&(w==null?void 0:w.lowerLimitPointsNumInBox)>0){g=yield o==null?void 0:o.filterPreResult(s.url,w,g);const V=index.jsonParser(s.result);V[lbUtils.POINT_CLOUD_DEFAULT_STEP].result=g,s.result=JSON.stringify(V),e.setPointCloudResult(g)}m=lbUtils.PointCloudUtils.getPolygonListFromResultList(s.result),b=lbUtils.PointCloudUtils.getLineListFromResultList(s.result),L=lbUtils.PointCloudUtils.getSphereParamsFromResultList(s.result),t.updateData(s.url,s.result,{radius:(x=w==null?void 0:w.radius)!=null?x:DEFAULT_RADIUS}),o==null||o.generateBoxes(g),o==null||o.generateSpheres(L),yield e.syncAllViewPointCloudColor(g,[])}A({pointCloudBoxList:g,polygonList:m,lineList:b,pointCloudSphereList:L}),actionCreators.SetPointCloudLoading(T,!1),actionCreators.SetLoadPCDFileLoading(T,!1)}),updateViewsByDefaultSize:gt,generateRects:W,update2DViewRect:rt}};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"),useHistory=require("./useHistory.js"),usePolygon=require("./usePolygon.js"),ahooks=require("ahooks"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,l)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,__spreadValues=(e,t)=>{for(var l in t||(t={}))__hasOwnProp.call(t,l)&&__defNormalProp(e,l,t[l]);if(__getOwnPropSymbols)for(var l of __getOwnPropSymbols(t))__propIsEnum.call(t,l)&&__defNormalProp(e,l,t[l]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t)),__async=(e,t,l)=>new Promise((a,o)=>{var c=p=>{try{u(l.next(p))}catch(h){o(h)}},P=p=>{try{u(l.throw(p))}catch(h){o(h)}},u=p=>p.done?a(p.value):Promise.resolve(p.value).then(c,P);u((l=l.apply(e,t)).next())});const DEFAULT_SCOPE=5,DEFAULT_RADIUS=90,INTELLIGENT_FIT_MARGIN=.01,PointCloudView={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},topViewPoint2PointCloud=(e,t,l,a,o)=>{const{x:c,y:P}=lbUtils.PointCloudUtils.transferCanvas2World(e,t),{defaultZ:u}=lbUtils.DEFAULT_SPHERE_PARAMS,p={center:{x:c,y:P,z:u},id:e.id},h=a?__spreadValues(__spreadValues({},a),p):__spreadProps(__spreadValues({},p),{attribute:"",valid:!0});return o&&Object.assign(h,o),h},topViewPolygon2PointCloud=(e,t,l,a,o,c)=>{let P=e.pointList.map(L=>lbUtils.PointCloudUtils.transferCanvas2World(L,t)),u=0,p=1,h={};if(l){const L=l.getSensesPointZAxisInPolygon(P,void 0,c);c&&L.fittedCoordinates.length>0&&(P=L.fittedCoordinates),u=(L.maxZ+L.minZ)/2,p=L.maxZ-L.minZ,h={count:L.zCount}}const[y,w,T]=P,U=lbAnnotation.MathUtils.getLineCenterPoint([y,T]),I=lbAnnotation.MathUtils.getLineLength(y,w),D=lbAnnotation.MathUtils.getLineLength(w,T),R=lbAnnotation.MathUtils.getRadiusFromQuadrangle(e.pointList);a&&(u=a.center.z,p=a.depth);const V={center:{x:U.x,y:U.y,z:u},width:c?D+INTELLIGENT_FIT_MARGIN:D,height:c?I+INTELLIGENT_FIT_MARGIN:I,depth:p,rotation:R,id:e.id},_=__spreadValues(a?__spreadValues(__spreadValues({},a),V):__spreadProps(__spreadValues({},V),{attribute:"",valid:!0}),h);o&&Object.assign(_,o);const k=P.map(L=>lbUtils.PointCloudUtils.transferWorld2Canvas(L,t));return{boxParams:_,newPointList:k}},sideViewPoint2PointCloud=(e,t,l)=>{const a={x:e.x-t.x,y:e.y-t.y};return __spreadProps(__spreadValues({},l),{center:{x:l.center.x-a.x,y:l.center.y,z:l.center.z-a.y}})},sideViewPolygon2PointCloud=(e,t,l,a)=>{const[o,c,P]=e.pointList,[u,p,h]=t.pointList,y=lbAnnotation.MathUtils.getLineCenterPoint([o,P]),w=lbAnnotation.MathUtils.getLineCenterPoint([u,h]),U={x:{x:y.x-w.x,y:y.y-w.y}.x,y:0,z:y.y-w.y},I=lbAnnotation.MathUtils.getLineLength(o,c),D=lbAnnotation.MathUtils.getLineLength(u,p),R=I-D,V=lbAnnotation.MathUtils.getLineLength(c,P),_=lbAnnotation.MathUtils.getLineLength(p,h),k=V-_,{newBoxParams:L}=a.getNewBoxBySideUpdate(U,k,R,l);return L},backViewPoint2PointCloud=(e,t,l)=>{const a={x:e.x-t.x,y:e.y-t.y};return __spreadProps(__spreadValues({},l),{center:{x:l.center.x,y:l.center.y-a.x,z:l.center.z-a.y}})},backViewPolygon2PointCloud=(e,t,l,a)=>{const[o,c,P]=e.pointList,[u,p,h]=t.pointList,y=lbAnnotation.MathUtils.getLineCenterPoint([o,P]),w=lbAnnotation.MathUtils.getLineCenterPoint([u,h]),U={x:{x:y.x-w.x,y:y.y-w.y}.x,y:0,z:y.y-w.y},I=lbAnnotation.MathUtils.getLineLength(o,c),D=lbAnnotation.MathUtils.getLineLength(u,p),R=I-D,V=lbAnnotation.MathUtils.getLineLength(c,P),_=lbAnnotation.MathUtils.getLineLength(p,h),k=V-_;let{newBoxParams:L}=a.getNewBoxByBackUpdate(U,k,R,l);return L},syncSideViewByPoint=(e,t,l,a,o)=>{var c;if(!l)return;const{toolInstance:P,pointCloudInstance:u}=l;u.loadPCDFile(a,(c=o==null?void 0:o.radius)!=null?c:DEFAULT_RADIUS);const{cameraPositionVector:p}=u.updateOrthoCameraBySphere(e,lbUtils.EPerspectiveView.Left);u.setInitCameraPosition(p);const{point2d:h,zoom:y}=u.getSphereSidePoint2DCoordinate(e);u.camera.zoom=y,u.camera.updateProjectionMatrix(),u.render(),P.initPosition(),P.zoomChangeOnCenter(y),P.setResult([__spreadProps(__spreadValues(__spreadValues({},t),h),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),P.setSelectedID(t.id)},synchronizeSideView=(e,t,l,a)=>{if(!l)return;const{pointCloud2dOperation:o,pointCloudInstance:c}=l;c.loadPCDFileByBox(a,e,{width:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:P}=c.updateOrthoCamera(e,lbUtils.EPerspectiveView.Left);c.setInitCameraPosition(P);const{polygon2d:u,zoom:p}=c.getBoxSidePolygon2DCoordinate(e);c.camera.zoom=p,c.camera.updateProjectionMatrix(),c.render(),o.initPosition(),o.zoomChangeOnCenter(p),o.setResultAndSelectedID([{id:t.id,valid:e.valid,pointList:u,textAttribute:"",isRect:!0,attribute:e.attribute}],t.id)},syncBackViewByPoint=(e,t,l,a,o)=>{var c;if(!l)return;const{toolInstance:P,pointCloudInstance:u}=l;u.loadPCDFile(a,(c=o==null?void 0:o.radius)!=null?c:DEFAULT_RADIUS);const{cameraPositionVector:p}=u.updateOrthoCameraBySphere(e,lbUtils.EPerspectiveView.Back);u.setInitCameraPosition(p);const{point2d:h,zoom:y}=u.getSphereBackPoint2DCoordinate(e);u.camera.zoom=y,u.camera.updateProjectionMatrix(),u.render(),P.initPosition(),P.zoomChangeOnCenter(y),P.setResult([__spreadProps(__spreadValues(__spreadValues({},t),h),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),P.setSelectedID(t.id)},synchronizeBackView=(e,t,l,a)=>{if(!l)return;const{pointCloud2dOperation:o,pointCloudInstance:c}=l;c.loadPCDFileByBox(a,e,{height:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:P}=c.updateOrthoCamera(e,lbUtils.EPerspectiveView.Back);c.setInitCameraPosition(P);const{polygon2d:u,zoom:p}=c.getBoxBackPolygon2DCoordinate(e);c.camera.zoom=p,c.camera.updateProjectionMatrix(),c.render(),o.initPosition(),o.zoomChangeOnCenter(p),o.setResultAndSelectedID([{id:t.id,valid:e.valid,pointList:u,textAttribute:"",isRect:!0,attribute:e.attribute}],t.id)},syncTopViewByPoint=(e,t,l,a)=>{if(!l||!a)return;a.generateSphere(e),a.updateCameraBySphere(e,lbUtils.EPerspectiveView.Top),a.render();const{toolInstance:o,pointCloudInstance:c}=l,{point2d:P}=c.getSphereTopPoint2DCoordinate(e),u=[...o.pointList].map(p=>p.id===t.id?__spreadProps(__spreadValues(__spreadValues({},t),P),{valid:e.valid,textAttribute:"",attribute:e.attribute}):p);o.setResult(u),o.setSelectedID(t.id)},synchronizeTopView=(e,t,l,a)=>{var o,c;if(!l||!a)return;a.generateBox(e,t.id),a.render();const{pointCloud2dOperation:P,pointCloudInstance:u}=l,{polygon2d:p}=u.getBoxTopPolygon2DCoordinate(e),h=[...P.polygonList],y=h.find(w=>w.id===t.id);y?(y.pointList=p,y.valid=(o=e.valid)!=null?o:!0):h.push({id:t.id,pointList:p,textAttribute:"",isRect:!0,valid:(c=e.valid)!=null?c:!0}),P.setResultAndSelectedID(h,t.id)},usePointCloudViews=()=>{const e=React.useContext(PointCloudContext.PointCloudContext),{topViewInstance:t,sideViewInstance:l,backViewInstance:a,mainViewInstance:o,addPointCloudBox:c,addPointCloudSphere:P,setSelectedIDs:u,selectedIDs:p,pointCloudBoxList:h,pointCloudSphereList:y,hideAttributes:w,setHighlight2DDataList:T,cuboidBoxIn2DView:U,imageSizes:I}=e,{addHistory:D,initHistory:R,pushHistoryUnderUpdatePolygon:V}=useHistory.useHistory(),{selectedPolygon:_}=usePolygon.usePolygon(),{getPointCloudSphereByID:k,updatePointCloudSphere:L,selectedSphere:N}=useSphere.useSphere(),{currentData:j,config:m}=ctx.useSelector(i=>{const{stepList:n,step:d,imgList:s,imgIndex:r}=i.annotation;return{currentData:s[r],config:index.jsonParser(StepUtils.getCurrentStepInfo(d,n).config)}}),A=ctx.useDispatch(),tt=ahooks.useLatest(U),W=i=>{if(!tt.current){const{mappingImgList:n=[]}=j,d=n.map(s=>index.getRectPointCloudBox({pointCloudBox:i,mappingData:s,imageSizes:I}));Object.assign(i,{rects:d.filter(s=>s!==void 0)})}},{selectedBox:S,updateSelectedBox:ot,updateSelectedBoxes:Z,getPointCloudByID:et}=useSingleBox.useSingleBox({generateRects:W}),X=S==null?void 0:S.info;if(!t||!l||!a)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:G}=t,it=i=>{o==null||o.generateBox(i),o==null||o.controls.update(),o==null||o.render()},nt=i=>{o==null||o.generateSphere(i),o==null||o.controls.update(),o==null||o.render()},st=({newPoint:i,size:n,zoom:d,trackConfigurable:s})=>{var r;const g={attribute:(r=t.toolInstance.defaultAttribute)!=null?r:""};s===!0&&Object.assign(g,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:y})});const f=topViewPoint2PointCloud(i,n,G,void 0,g);u(i.id);const C=P(f);q(PointCloudView.Top,i,f,d,C,m),D({newSphereParams:f})},lt=({polygon:i,size:n,imgList:d,trackConfigurable:s,zoom:r,intelligentFit:g})=>{var f,C,v;const b={attribute:(f=t.toolInstance.defaultAttribute)!=null?f:""};s===!0&&Object.assign(b,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:h,extraSphereList:y})});const z=t==null?void 0:t.toolInstance,B=__spreadValues({},i);let{boxParams:x,newPointList:O}=topViewPolygon2PointCloud(B,n,G,void 0,b,g);x=A(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[x],stepConfig:m,action:"viewUpdateBox"}))[0],g&&(O==null?void 0:O.length)&&(B.pointList=O);const Q=w.includes(B.attribute);W(x);const E=c(x),F=(C=e==null?void 0:e.polygonList)!=null?C:[];x.subAttribute=lbAnnotation.TagUtils.getDefaultResultByConfig((m==null?void 0:m.secondaryAttributeConfigurable)?(v=m==null?void 0:m.inputList)!=null?v:[]:[]),t==null||t.updatePolygonList(E!=null?E:[],F),Q?u([]):(u(x.id),z.selection.setSelectedIDs(B.id),M({omitView:PointCloudView.Top,polygon:B,boxParams:x,zoom:r,newPointCloudBoxList:E}),g&&synchronizeTopView(x,B,t,o)),D({newBoxParams:x})},rt=i=>{const{boxID:n,imageName:d,width:s,height:r,x:g,y:f}=i,C=h.find(x=>x.id===n);if(!(C==null?void 0:C.rects)||!C.rects.find(x=>x.imageName===d))return;const b=C.rects.map(x=>x.imageName===d?__spreadProps(__spreadValues({},x),{width:s,height:r,x:g,y:f}):x),z=__spreadProps(__spreadValues({},C),{rects:b}),B=h.map(x=>x.id===n?z:x);return t==null||t.updatePolygonList(B!=null?B:[]),B},dt=i=>{const{boxID:n,imageName:d}=i,s=h.find(C=>C.id===n);if(!(s==null?void 0:s.rects))return;const r=s.rects.filter(C=>C.imageName!==d),g=__spreadProps(__spreadValues({},s),{rects:r}),f=h.map(C=>C.id===n?g:C);return t==null||t.updatePolygonList(f!=null?f:[]),f},at=({newSelectedBox:i,newPointCloudList:n,newSelectedSphere:d,newSphereList:s})=>{var r;const g=t==null?void 0:t.toolInstance;if(!(p.length===0||!g)){if(i||(S==null?void 0:S.info)){const f=i!=null?i:S==null?void 0:S.info;(r=g==null?void 0:g.selection)==null||r.setSelectedIDs(p[0]);const C=g.selectedPolygon;if(p.length===1&&f){M({omitView:PointCloudView.Top,polygon:C,boxParams:f,newPointCloudBoxList:n});return}}if((d||N)&&p.length===1){const f=d!=null?d:N;g.setSelectedID(p[0]);const C=g.selectedPoint;f&&q(PointCloudView.Top,C,f,void 0,s,m)}}},Y=(i,n,d)=>{if(X){let s,r;switch(d){case PointCloudView.Back:s=backViewPolygon2PointCloud;break;case PointCloudView.Side:s=sideViewPolygon2PointCloud;break;default:s=sideViewPolygon2PointCloud;break}if(r=s(i,n,X,l.pointCloudInstance),o){const{count:b}=o.getSensesPointZAxisInPolygon(lbAnnotation.getCuboidFromPointCloudBox(r).polygonPointList,[r.center.z-r.depth/2,r.center.z+r.depth/2]);r=__spreadProps(__spreadValues({},r),{count:b})}const f=A(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[r],stepConfig:m,action:"viewUpdateBox"}))[0],C=r.valid!==f.valid;r=f;const v=ot(r);return r=v.find(b=>b.id===r.id),M({omitView:C?void 0:d,polygon:i,boxParams:r,newPointCloudBoxList:v}),v}},K=(i,n,d)=>{if(N){let s,r;switch(d){case PointCloudView.Back:s=backViewPoint2PointCloud;break;case PointCloudView.Side:s=sideViewPoint2PointCloud;break;default:s=sideViewPoint2PointCloud;break}r=s(i,n,N);const g=L(r);return q(d,i,r,void 0,g,m),g}},ct=(i,n)=>{K(i,n,PointCloudView.Side)},ut=(i,n)=>{K(i,n,PointCloudView.Back)},pt=(i,n)=>{Y(i,n,PointCloudView.Side)},Pt=(i,n)=>{Y(i,n,PointCloudView.Back)},gt=(i,n)=>{const d=k(i.id),s=topViewPoint2PointCloud(i,n,G,d),r=L(s);q(PointCloudView.Top,i,s,void 0,r,m)},Ct=(i,n)=>{if(_){const s=__spreadValues({},i[0].newPolygon);s.pointList=s.pointList.map(r=>lbUtils.PointCloudUtils.transferCanvas2World(r,n)),V(s);return}let d=i.map(({newPolygon:s})=>{const r=et(s.id),{boxParams:g}=topViewPolygon2PointCloud(s,n,t.pointCloudInstance,r);return g});if(d=A(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:d,stepConfig:m,action:"viewUpdateBox"})),d.length===1){const{newPolygon:s}=i[0],r=Z(d);M({polygon:s,boxParams:d[0],newPointCloudBoxList:r})}else{const s=Z(d);s&&e.syncAllViewPointCloudColor(s)}},ft=i=>{var n,d,s,r,g;if(S){const f=Number(i.widthDefault),C=Number(i.depthDefault),v=Number(i.heightDefault),b=S==null?void 0:S.info.trackID,B=((n=t==null?void 0:t.toolInstance)==null?void 0:n.polygonList).find(H=>(H==null?void 0:H.trackID)===b),x={width:(s=(d=t==null?void 0:t.toolInstance)==null?void 0:d.basicImgInfo)==null?void 0:s.width,height:(g=(r=t==null?void 0:t.toolInstance)==null?void 0:r.basicImgInfo)==null?void 0:g.height},O=B.pointList.map(H=>lbUtils.PointCloudUtils.transferCanvas2World(H,x)),J=lbAnnotation.MathUtils.getModifiedRectangleCoordinates(O,v,f),Q=J[0],E=J[2],F=lbAnnotation.MathUtils.getLineCenterPoint([Q,E]),ht=S.info.center.z-S.info.depth/2,$=__spreadProps(__spreadValues({},S.info),{center:{x:F.x,y:F.y,z:ht+C/2},width:f,height:v,depth:C,valid:!0}),vt=Z([$]);M({omitView:PointCloudView["3D"],polygon:B,boxParams:$,newPointCloudBoxList:vt})}},q=(i,n,d,s,r,g)=>__async(void 0,null,function*(){const f=j==null?void 0:j.url,C={[PointCloudView.Side]:()=>{syncSideViewByPoint(d,n,l,f,g)},[PointCloudView.Back]:()=>{a&&syncBackViewByPoint(d,n,a,f,g)},[PointCloudView.Top]:()=>{syncTopViewByPoint(d,n,t,o)}};Object.keys(C).forEach(v=>{v!==i&&C[v]()}),s&&(o==null||o.updateCameraZoom(s)),nt(d)}),M=i=>__async(void 0,null,function*(){const{omitView:n,polygon:d,boxParams:s,zoom:r,newPointCloudBoxList:g}=i,f=j==null?void 0:j.url;g&&(yield e.syncAllViewPointCloudColor(g));const C={[PointCloudView.Side]:()=>{synchronizeSideView(s,d,l,f)},[PointCloudView.Back]:()=>{a&&synchronizeBackView(s,d,a,f)},[PointCloudView.Top]:()=>{synchronizeTopView(s,d,t,o)}};Object.keys(C).forEach(v=>{v!==n&&C[v]()}),r&&(o==null||o.updateCameraZoom(r)),it(s)});return{topViewAddSphere:st,topViewAddBox:lt,topViewSelectedChanged:at,topViewUpdatePoint:gt,sideViewUpdatePoint:ct,backViewUpdatePoint:ut,topViewUpdateBox:Ct,sideViewUpdateBox:pt,backViewUpdateBox:Pt,pointCloudBoxListUpdated:i=>{t.updatePolygonList(i),o==null||o.generateBoxes(i)},initPointCloud3d:i=>{if(!o)return;const n=lbUtils.PointCloudUtils.getDefaultOrthographicParams(i);o.initOrthographicCamera(n),o.initRenderer(),o.render()},updatePointCloudData:(...i)=>__async(void 0,[...i],function*(n=j){var d,s,r,g,f,C;if(!(n==null?void 0:n.url)||!o)return;T([]),actionCreators.SetPointCloudLoading(A,!0),actionCreators.SetLoadPCDFileLoading(A,!0),yield o.loadPCDFile(n.url,(d=m==null?void 0:m.radius)!=null?d:DEFAULT_RADIUS),o==null||o.clearAllBox(),o==null||o.clearAllSphere();let v=[],b=[],z=[],B=[];o.updateTopCamera();const x=(r=(s=index.jsonParser(n.result))==null?void 0:s.valid)!=null?r:!0;if(e.setPointCloudValid(x),(g=e.sideViewInstance)==null||g.clearAllData(),(f=e.backViewInstance)==null||f.clearAllData(),n.result){if(v=lbUtils.PointCloudUtils.getBoxParamsFromResultList(n.result),(v==null?void 0:v.length)>0&&n.isPreResult&&(m==null?void 0:m.lowerLimitPointsNumInBox)>0){v=yield o==null?void 0:o.filterPreResult(n.url,m,v);const O=index.jsonParser(n.result);O[lbUtils.POINT_CLOUD_DEFAULT_STEP].result=v,n.result=JSON.stringify(O),e.setPointCloudResult(v)}z=lbUtils.PointCloudUtils.getPolygonListFromResultList(n.result),b=lbUtils.PointCloudUtils.getLineListFromResultList(n.result),B=lbUtils.PointCloudUtils.getSphereParamsFromResultList(n.result),t.updateData(n.url,n.result,{radius:(C=m==null?void 0:m.radius)!=null?C:DEFAULT_RADIUS}),o==null||o.generateBoxes(v),o==null||o.generateSpheres(B),yield e.syncAllViewPointCloudColor(v,[])}R({pointCloudBoxList:v,polygonList:z,lineList:b,pointCloudSphereList:B}),actionCreators.SetPointCloudLoading(A,!1),actionCreators.SetLoadPCDFileLoading(A,!1)}),updateViewsByDefaultSize:ft,generateRects:W,update2DViewRect:rt,remove2DViewRect:dt}};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"),lbAnnotation=require("@labelbee/lb-annotation"),useHistory=require("./useHistory.js"),lbUtils=require("@labelbee/lb-utils");const{EToolName,EPolygonPattern}=lbAnnotation.cTool,useStatus=()=>{const{topViewInstance:i,sideViewInstance:r,backViewInstance:u,mainViewInstance:
|
|
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"),lbUtils=require("@labelbee/lb-utils");const{EToolName,EPolygonPattern}=lbAnnotation.cTool,useStatus=()=>{const{topViewInstance:i,sideViewInstance:r,backViewInstance:u,mainViewInstance:e,setPointCloudResult:d,setPointCloudSphereList:P,setPolygonList:C,setRectList:v,pointCloudPattern:a,setPointCloudPattern:o,syncAllViewPointCloudColor:b,globalPattern:n,setLineList:h}=React.useContext(PointCloudContext.PointCloudContext),{pushHistoryWithList:p}=useHistory.useHistory(),y=()=>{e==null||e.clearAllBox(),e==null||e.clearAllSphere(),e==null||e.render(),d([]),C([]),P([]),h([]),v([]),i==null||i.toolScheduler.clearStatusAndResult(),b([]),p({pointCloudBoxList:[],polygonList:[],pointCloudSphereList:[]})},l=()=>{r==null||r.toolInstance.clearResult(),u==null||u.toolInstance.clearResult()},L=c=>{if(c===a)return;const s=[i,r,u];switch(c){case EToolName.Rect:l(),s.forEach(t=>{t==null||t.switchToCanvas(EToolName.PointCloudPolygon),t==null||t.toolInstance.setPattern(EPolygonPattern.Rect)}),o(EToolName.Rect);break;case EToolName.Polygon:l(),s.forEach(t=>{t==null||t.switchToCanvas(EToolName.PointCloudPolygon),t==null||t.toolInstance.setPattern(EPolygonPattern.Normal)}),o(EToolName.Polygon);break;case EToolName.Point:l(),s.forEach(t=>{t==null||t.switchToCanvas(EToolName.Point)}),o(EToolName.Point);break;case EToolName.Line:l(),s.forEach(t=>{t==null||t.switchToCanvas(EToolName.Line)}),o(EToolName.Line);break}},w=React.useMemo(()=>n===lbUtils.EPointCloudPattern.Detection,[n]),R=React.useMemo(()=>n===lbUtils.EPointCloudPattern.Segmentation,[n]);return{clearAllResult:y,updatePointCloudPattern:L,pointCloudPattern:a,isPointCloudDetectionPattern:w,isPointCloudSegmentationPattern:R}};exports.useStatus=useStatus;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var dom=require("../../utils/dom.js"),React=require("react"),PointCloud3DView=require("./PointCloud3DView.js"),PointCloudBackView=require("./PointCloudBackView.js"),PointCloudTopView=require("./PointCloudTopView.js"),PointCloudSideView=require("./PointCloudSideView.js"),PointCloud2DView=require("./PointCloud2DView.js"),PointCloudListener=require("./PointCloudListener.js"),PointCloudSegmentListener=require("./PointCloudSegmentListener.js"),PointCloudSegment=require("./PointCloudSegment.js"),PointCloudSegmentStatus=require("./PointCloudSegmentStatus.js"),PointCloudSegmentToolbar=require("./PointCloudSegmentToolbar.js"),PointCloudSegment2DView=require("./PointCloudSegment2DView.js"),reactRedux=require("react-redux"),ctx=require("../../store/ctx.js"),index$1=require("../../views/MainView/toolFooter/AnnotatedAttributes/index.js"),PointCloudContext=require("./PointCloudContext.js"),lbUtils=require("@labelbee/lb-utils"),annotation=require("../../hooks/annotation.js"),index=require("../../utils/index.js"),map=require("../../store/annotation/map.js"),classNames=require("classnames"),index$2=require("./components/sideAndBackOverView/index.js"),actionCreators=require("../../store/annotation/actionCreators.js");function _interopDefaultLegacy(
|
|
1
|
+
"use strict";var dom=require("../../utils/dom.js"),React=require("react"),PointCloud3DView=require("./PointCloud3DView.js"),PointCloudBackView=require("./PointCloudBackView.js"),PointCloudTopView=require("./PointCloudTopView.js"),PointCloudSideView=require("./PointCloudSideView.js"),PointCloud2DView=require("./PointCloud2DView.js"),PointCloudListener=require("./PointCloudListener.js"),PointCloudSegmentListener=require("./PointCloudSegmentListener.js"),PointCloudSegment=require("./PointCloudSegment.js"),PointCloudSegmentStatus=require("./PointCloudSegmentStatus.js"),PointCloudSegmentToolbar=require("./PointCloudSegmentToolbar.js"),PointCloudSegment2DView=require("./PointCloudSegment2DView.js"),reactRedux=require("react-redux"),ctx=require("../../store/ctx.js"),index$1=require("../../views/MainView/toolFooter/AnnotatedAttributes/index.js"),PointCloudContext=require("./PointCloudContext.js"),lbUtils=require("@labelbee/lb-utils"),annotation=require("../../hooks/annotation.js"),index=require("../../utils/index.js"),map=require("../../store/annotation/map.js"),classNames=require("classnames"),index$2=require("./components/sideAndBackOverView/index.js"),actionCreators=require("../../store/annotation/actionCreators.js");function _interopDefaultLegacy(a){return a&&typeof a=="object"&&"default"in a?a:{default:a}}var React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames);const PointCloudView=a=>{const{currentData:i,imgList:P,drawLayerSlot:c,checkMode:n,intelligentFit:v,imgIndex:p,config:L,measureVisible:E}=a,e=React.useContext(PointCloudContext.PointCloudContext),{globalPattern:m,setGlobalPattern:x,selectedIDs:C}=e,S=ctx.useDispatch(),[l,f]=React.useState(!1),q=(C==null?void 0:C.length)>0&&l,b=index.jsonParser(i.result),{toolInstanceRef:o,clearToolInstance:j}=annotation.useCustomToolInstance({basicInfo:b});if(React.useEffect(()=>{o.current.setPointCloudGlobalPattern=t=>{t!==m&&(x(t),e.clearAllDetectionInstance(),j())}},[m]),React.useEffect(()=>{var t;if(actionCreators.SetLoadPCDFileLoading(S,!0),i){const{boxParamsList:r,polygonList:s,lineList:u,sphereParamsList:d,segmentation:w,rectList:N}=lbUtils.PointCloudUtils.parsePointCloudCurrentResult((t=i==null?void 0:i.result)!=null?t:"");e.setPointCloudResult(r),e.setPolygonList(s),e.setLineList(u),e.setPointCloudSphereList(d),e.setRectList(N),e.setSegmentation(w)}},[p]),React.useEffect(()=>{o.current.exportData=()=>[e.pointCloudBoxList,{valid:e.valid}],o.current.exportCustomData=()=>{var t,r,s,u,d;return{resultPolygon:(t=e.polygonList)!=null?t:[],resultLine:(r=e.lineList)!=null?r:[],resultPoint:(s=e.pointCloudSphereList)!=null?s:[],resultRect:(u=e.rectList)!=null?u:[],segmentation:(d=e.segmentation)!=null?d:[]}}},[e.pointCloudBoxList,e.rectList,e.valid,e.polygonList,e.lineList,e.pointCloudSphereList,e.ptSegmentInstance,e.segmentation]),P.length===0)return null;if(m===lbUtils.EPointCloudPattern.Segmentation)return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudSegmentListener,{checkMode:n,toolInstanceRef:o}),React__default.default.createElement(PointCloudSegmentToolbar,null),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-layout")},React__default.default.createElement(PointCloudSegment,{checkMode:n}),React__default.default.createElement(PointCloudSegment2DView,null)),React__default.default.createElement(PointCloudSegmentStatus,{config:L}),c==null?void 0:c({direct:!0}));let g=React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container","left-bottom")},React__default.default.createElement(PointCloudBackView,{checkMode:n}),React__default.default.createElement(PointCloudSideView,{checkMode:n}));return l&&(g=React__default.default.createElement(index$2,{selectAndEnlarge:q,checkMode:n})),React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudListener,{checkMode:n,toolInstanceRef:o}),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-layout"),onContextMenu:t=>t.preventDefault()},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-wrapper")},React__default.default.createElement(index$1.AnnotatedAttributesPanelFixedLeft,null),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-content")},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container","left")},React__default.default.createElement(PointCloud3DView,null),g),React__default.default.createElement("div",{className:classNames__default.default({[dom.getClassName("point-cloud-container","right")]:!0,[dom.getClassName("point-cloud-container","rightZoom")]:l})},React__default.default.createElement(PointCloudTopView,{drawLayerSlot:c,checkMode:n,intelligentFit:v,setIsEnlargeTopView:f,onExitZoom:()=>{f(!1)},isEnlargeTopView:l}),React__default.default.createElement("div",{className:classNames__default.default({[dom.getClassName("point-cloud-container","right-bottom")]:!l,[dom.getClassName("point-cloud-container","right-bottom-floatLeft")]:l})},React__default.default.createElement(PointCloud2DView,{isEnlargeTopView:l,thumbnailWidth:l?300:455,checkMode:n,measureVisible:E})))),React__default.default.createElement(index$1.AnnotatedAttributesPanelFixedRight,null))))};var PointCloudView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudView);module.exports=PointCloudView$1;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var React=require("react"),antd=require("antd"),reactI18next=require("react-i18next"),index=require("../attributeList/index.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var React__default=_interopDefaultLegacy(React);const subTitleStyle={margin:"12px 20px 8px",fontSize:14,fontWeight:500,wordWrap:"break-word"},SubAttributeList=t=>{const{subAttributeList:u,setSubAttribute:n,getValue:r}=t,{t:d}=reactI18next.useTranslation(),o=(e,a)=>{if(Array.isArray(a)){n(e,a.join(";"));return}n(e,a)},i=e=>{const a=r(e);return(e==null?void 0:e.isMulti)?a?a==null?void 0:a.split(";"):[]:a};return React__default.default.createElement(React__default.default.Fragment,null,u.map(e=>{var a;return(e==null?void 0:e.subSelected)&&React__default.default.createElement("div",{style:{marginTop:12},key:e.value},React__default.default.createElement("div",{style:subTitleStyle},d("SubAttribute"),"-",e.key),((a=e.subSelected)==null?void 0:a.length)<5?(e==null?void 0:e.isMulti)?React__default.default.createElement(antd.Checkbox.Group,{style:{padding:"0px 20px 16px 16px"},options:e.subSelected.map(l=>({label:l.key,value:l.value})),value:i(e),onChange:l=>o(e.value,l)}):React__default.default.createElement(index.default,{list:e.subSelected.map(l=>({label:l.key,value:l.value})),selectedAttribute:r(e),num:"-",forbidColor:!0,forbidDefault:!0,attributeChanged:l=>n(e.value,l),style:{marginBottom:12}}):React__default.default.createElement(antd.Select,{style:{margin:"0px 20px 16px 16px",width:"87%"},mode:(e==null?void 0:e.isMulti)?"multiple":void 0,value:i(e),placeholder:d("PleaseSelect"),onChange:l=>o(e.value,l),allowClear:!0},e.subSelected.map(l=>React__default.default.createElement(antd.Select.Option,{key:l.value,value:l.value},l.key))),React__default.default.createElement(antd.Divider,{style:{margin:0}}))}))};module.exports=SubAttributeList;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var lbAnnotation=require("@labelbee/lb-annotation"),index$2=require("../../../utils/index.js"),audio=require("../../../utils/audio.js"),antd=require("antd"),_=require("lodash"),React=require("react"),index_module=require("./index.module.scss.js"),VideoClipToolContext=require("./VideoClipToolContext.js"),constant=require("./constant.js"),index=require("../../videoPlayer/index.js"),index$1=require("./components/videoTimeSlicesOverVideo/index.js"),icon_videoCutting=require("../../../assets/annotation/video/icon_videoCutting.svg.js"),utils=require("../../videoPlayer/utils.js");function _interopDefaultLegacy(S){return S&&typeof S=="object"&&"default"in S?S:{default:S}}var ___default=_interopDefaultLegacy(_),React__default=_interopDefaultLegacy(React);class VideoClipTool extends React__default.default.Component{constructor(r){super(r);this.fns=new Map,this.throttledUpdateTime=___default.default.throttle(t=>{this.videoPlayer.currentTime=t},100,{trailing:!0}),this.stepInfo=()=>this.props.stepInfo,this.emitEvent=t=>{const e=this.fns.get(t);e&&e.forEach(i=>{i&&i()})},this.setValid=t=>{this.setState({valid:t}),t===!1&&(this.clearResult(),this.updateSidebar())},this.updateSidebar=()=>{this.emitEvent("changeClipSidebar"),this.emitEvent("updateTextAttribute"),this.emitEvent("changeAttributeSidebar")},this.exportData=()=>{var t,e;const i=(e=(t=this.videoRef)==null?void 0:t.duration)!=null?e:0;return[this.state.result.filter(s=>s.end!==null),{valid:this.state.valid,duration:i}]},this.updateSelectedSliceTimeStartByPer=t=>{var e,i;if(this.state.clipStatus===constant.EClipStatus.Clipping){antd.message.info("\u622A\u53D6\u4E2D\u4E0D\u652F\u6301\u8C03\u6574\u5F00\u59CB\u65F6\u95F4");return}if(this.selectedSliceIndex>-1){const s=(i=(e=this.videoPlayer)==null?void 0:e.duration)!=null?i:0,{end:a,start:n,type:l}=this.state.result[this.selectedSliceIndex],u=lbAnnotation.MathUtils.withinRange(audio.precisionAdd(n,t),[0,audio.precisionMinus(l===constant.ETimeSliceType.Time?s:a,constant.PER_SLICE_CHANGE)]);this.updateSelectedSliceTimeProperty(u,"start")}},this.updateSelectedSliceTimeEndByPer=t=>{var e,i;if(this.state.clipStatus===constant.EClipStatus.Clipping){antd.message.info("\u622A\u53D6\u4E2D\u4E0D\u652F\u6301\u8C03\u6574\u7ED3\u675F\u65F6\u95F4");return}if(this.selectedSliceIndex>-1){const s=this.state.result[this.selectedSliceIndex],a=(i=(e=this.videoPlayer)==null?void 0:e.duration)!=null?i:0;if(s.type===constant.ETimeSliceType.Time){antd.message.info("\u65F6\u95F4\u70B9\u4EC5\u652F\u6301\u8C03\u6574\u5F00\u59CB\u65F6\u95F4");return}const{end:n,start:l}=s,u=lbAnnotation.MathUtils.withinRange(audio.precisionAdd(n,t),[audio.precisionAdd(l,constant.PER_SLICE_CHANGE),a]);this.updateSelectedSliceTimeProperty(u,"end")}},this.updateSelectedSliceTimeProperty=(t,e)=>{if(this.selectedSliceIndex>-1){const{result:i}=this.state;i[this.selectedSliceIndex][e]=t,this.setState({result:___default.default.cloneDeep(i)}),this.updateSidebar()}},this.keyDownEvents=t=>{if(!lbAnnotation.CommonToolUtils.hotkeyFilter(t))return;const e=t.target;switch(e&&(e==null?void 0:e.tag)==="INPUT"&&(e==null?void 0:e.type)==="radio"&&t.preventDefault(),t.key.toLocaleLowerCase()){case"x":this.toggleClipStatus();break;case"e":this.addTime();break;case"escape":this.cancelClipped();break;case"-":this.updateSelectedSliceTimeStartByPer(-constant.PER_SLICE_CHANGE);break;case"=":this.updateSelectedSliceTimeStartByPer(constant.PER_SLICE_CHANGE);break;case"[":this.updateSelectedSliceTimeEndByPer(-constant.PER_SLICE_CHANGE);break;case"]":this.updateSelectedSliceTimeEndByPer(constant.PER_SLICE_CHANGE);break}},this.setVideoError=(t,e,i)=>{if(t){const{clipStatus:s}=this.state;s===constant.EClipStatus.Clipping&&this.toggleClipStatus(i)}this.setState({videoError:t,loading:!1})},this.clearResult=()=>{this.setState({result:[],selectedID:"",textValue:""}),this.updateSidebar()},this.cancelClipped=()=>{const{result:t,selectedID:e,clipStatus:i}=this.state;if(i!==constant.EClipStatus.Clipping)return;const s=t.findIndex(a=>a.id===e);s>-1&&(t.splice(s,1),this.setState({result:t,selectedID:"",clipStatus:constant.EClipStatus.Stop}),this.updateSidebar())},this.toggleClipStatus=t=>{var e,i,s;if(this.disabled)return;const{clipStatus:a,selectedAttribute:n}=this.state,l=a!==constant.EClipStatus.Clipping;let u=l?constant.EClipStatus.Clipping:constant.EClipStatus.Stop,{result:d,selectedID:o,textValue:p}=this.state;const c=___default.default.cloneDeep(d),h=t||((e=this.videoPlayer)==null?void 0:e.currentTime),f=(i=this.videoPlayer)==null?void 0:i.duration;if(f===void 0||h===void 0)return;const C=utils.decimalReserved(h,2);if(l){const m=lbAnnotation.uuid();o=m,c.push({start:C,end:null,attribute:n,textAttribute:this.defaultTextAttribute,duration:f,id:m,type:constant.ETimeSliceType.Period}),p=this.defaultTextAttribute}else{const m=c.findIndex(v=>v.id===o),g=c[m];g&&(h-g.start<constant.SLICE_MIN_TIME?(c.splice(m,1),antd.message.info(`\u622A\u53D6\u7247\u6BB5\u4E0D\u80FD\u77ED\u4E8E${constant.SLICE_MIN_TIME}s`),u=constant.EClipStatus.Stop,o="",p=""):(c[m].end=utils.decimalReserved(h,2),(s=this.videoPlayer)==null||s.pause(),antd.message.success(`\u5DF2\u622A\u53D6\u7247\u6BB5${d.length}`)))}this.setState({clipStatus:u,result:c,selectedID:o,textValue:p}),this.updateSidebar()},this.addTime=()=>{var t,e,i,s;if(this.disabled)return;const{result:a,selectedAttribute:n,selectedID:l}=this.state,u=lbAnnotation.uuid(),d=___default.default.cloneDeep(a),o=((t=this.videoPlayer)==null?void 0:t.currentTime)||0;d.push({start:o,end:o,attribute:n,textAttribute:this.defaultTextAttribute,id:u,type:constant.ETimeSliceType.Time,duration:(i=(e=this.videoPlayer)==null?void 0:e.duration)!=null?i:0});const p={result:d,selectedID:u,textValue:this.defaultTextAttribute},c=d.find(h=>h.id===l);this.isClipping&&c?(delete p.selectedID,delete p.textValue,antd.message.success(`\u5DF2\u622A\u53D6\u65F6\u95F4\u70B9${d.length-1}`)):(s=this.videoPlayer)==null||s.pause(),this.setState(p),this.updateSidebar()},this.updateCurrentTime=t=>{this.setState({currentTime:t})},this.contextToCancel=t=>{this.state.clipStatus===constant.EClipStatus.Stop&&(t.preventDefault(),this.setState({selectedID:""}),this.updateSidebar())},this.onTrackResize=(t,e,i)=>{var s,a;const{result:n}=this.state,l=n.find(u=>u.id===t);if(l){const u=l.duration,d=e==="left",o=d?"start":"end",p=d?-u*i:u*i,c=d?[0,Math.max(((s=l.end)!=null?s:0)-constant.SLICE_MIN_TIME,0)]:[l.start+constant.SLICE_MIN_TIME,u],h=lbAnnotation.MathUtils.withinRange(p+((a=l==null?void 0:l[o])!=null?a:0),c);l[o]=h,this.throttledUpdateTime(h)}this.setState({result:[...n]}),this.updateSidebar()},this.renderMediaContent=()=>{var t;const{pageForward:e,pageJump:i,pageBackward:s}=this.props,{result:a,videoError:n,valid:l,currentTime:u}=this.state;return React__default.default.createElement("div",{className:index_module.clipContainer},React__default.default.createElement(index.VideoPlayer,{imgIndex:this.props.imgIndex,imgList:this.props.imgList,pageBackward:s,pageForward:e,pageJump:i,valid:l,setVideoRef:d=>{this.videoPlayer=d},showVideoTrack:!n,onTrackResize:this.onTrackResize,drawLayerSlot:this.props.drawLayerSlot,footer:this.props.footer,dataLoaded:this.props.onVideoLoaded,toggleClipStatus:this.toggleClipStatus,addTime:this.addTime,updateCurrentTime:this.updateCurrentTime}),React__default.default.createElement(index$1,{key:(t=this.videoPlayer)==null?void 0:t.currentTime,result:a,currentTime:u,attributeList:this.props.config.attributeList,extraStyle:{top:this.props.drawLayerSlot?40:0}}),this.isClipping&&React__default.default.createElement("i",{className:index_module.clipping,style:{backgroundImage:icon_videoCutting}}))},this.onSelectedTimeSlice=t=>{var e;this.isClipping||(this.setState({selectedID:t.id,selectedAttribute:t.attribute,textValue:t.textAttribute,currentTime:t.start}),this.updateSidebar(),(e=this.videoPlayer)==null||e.pause(),this.videoPlayer.currentTime=t.start)},this.removeTimeSlice=t=>{const{result:e}=this.state,i=this.state.selectedID===t.id?"":this.state.selectedID,s=e.findIndex(a=>a.id===t.id);s>-1&&(e.splice(s,1),this.setState({result:[...e],selectedID:i}),this.updateSidebar())},this.setResult=(t=!0,e=this.props)=>{try{const{imgIndex:i,imgList:s}=e;if(!s[i])return;const n=index$2.jsonParser(s[i].result)[`step_${this.stepInfo().step}`],l=(n==null?void 0:n.result)||[],u=audio.isImageValue(s[i].result||"[]");this.setState({result:l,loading:t,selectedID:"",textValue:"",selectedAttribute:"",clipStatus:constant.EClipStatus.Stop,valid:u},()=>{this.updateSidebar(),u||antd.message.info("\u65E0\u6548\u89C6\u9891\uFF0C\u8BF7\u8DF3\u8FC7")})}catch(i){console.error("\u6570\u636E\u89E3\u6790\u5931\u8D25"),this.setState({result:[],loading:!1,selectedID:"",textValue:"",selectedAttribute:"",valid:!0},()=>{this.updateSidebar()})}},this.setDefaultAttribute=t=>{const{result:e,selectedID:i}=this.state,s=e.find(a=>a.id===i);s&&i&&(s.attribute=t),this.setState({selectedAttribute:t,result:[...e]}),this.updateSidebar()},this.textChange=t=>{const{result:e,selectedID:i}=this.state;if(this.setState({textValue:t}),i){const s=e.find(a=>a.id===i);s&&(s.textAttribute=t,this.setState({result:[...e]}),this.updateSidebar())}},this.state={result:[],selectedAttribute:"",textValue:"",clipStatus:constant.EClipStatus.Stop,selectedID:"",loading:!1,videoError:!1,remainingTime:0,currentTime:0,configLoading:!1,valid:!0}}get videoUrl(){var r;const{imgIndex:t,imgList:e}=this.props;return((r=e[t])==null?void 0:r.url)||""}get isClipping(){return this.state.clipStatus===constant.EClipStatus.Clipping}get resultJSON(){const{imgIndex:r,imgList:t}=this.props;return t.length===0||!t[r]?"[]":t[r].result}get disabled(){return!this.state.valid||this.state.videoError}get loading(){return this.state.loading||this.state.configLoading}get defaultTextAttribute(){return lbAnnotation.AttributeUtils.getTextAttribute(this.state.result,this.props.config.textCheckType)}get defaultAttribute(){return this.state.selectedAttribute}get selectedID(){return this.state.selectedID}get selectedSliceIndex(){return this.state.result.findIndex(r=>r.id===this.state.selectedID)}get exportContext(){return{selectedID:this.state.selectedID,result:this.state.result,clipStatus:this.state.clipStatus,videoPlayer:this.videoPlayer,attributeList:this.props.config.attributeList,onSelectedTimeSlice:this.onSelectedTimeSlice,removeTimeSlice:this.removeTimeSlice,updateSelectedSliceTimeProperty:this.updateSelectedSliceTimeProperty}}get valid(){return this.state.valid}get config(){var r;return index$2.jsonParser((r=this.props.stepInfo)==null?void 0:r.config)}get selectedText(){var r,t;return(t=(r=this.state.result)==null?void 0:r[this.selectedSliceIndex])==null?void 0:t.textAttribute}componentDidMount(){this.setState({loading:!1}),this.setResult(!1),this.props.onMounted(this),window.addEventListener("keydown",this.keyDownEvents)}componentWillUnmount(){this.props.onUnmounted(),window.removeEventListener("keydown",this.keyDownEvents)}shouldComponentUpdate(r,t){const e=r.imgIndex-this.props.imgIndex,i=r.step-this.props.step;return(e!==0||i!==0)&&(this.setResult(!0,r),i!==0&&this.setState({loading:!1})),!0}singleOn(r,t){this.fns.set(r,[t])}on(r,t){this.singleOn(r,t)}unbindAll(r){this.fns.delete(r)}render(){const{selectedID:r,result:t,clipStatus:e,selectedAttribute:i}=this.state;return React__default.default.createElement(VideoClipToolContext.VideoClipToolContextProvider,{value:{videoPlayer:this.videoPlayer,result:t,selectedID:r,attributeList:this.props.config.attributeList,clipStatus:e,selectedAttribute:i,contextToCancel:this.contextToCancel}},this.renderMediaContent())}}module.exports=VideoClipTool;
|
|
1
|
+
"use strict";var lbAnnotation=require("@labelbee/lb-annotation"),index$2=require("../../../utils/index.js"),audio=require("../../../utils/audio.js"),antd=require("antd"),_=require("lodash"),React=require("react"),index_module=require("./index.module.scss.js"),VideoClipToolContext=require("./VideoClipToolContext.js"),constant=require("./constant.js"),index=require("../../videoPlayer/index.js"),index$1=require("./components/videoTimeSlicesOverVideo/index.js"),icon_videoCutting=require("../../../assets/annotation/video/icon_videoCutting.svg.js"),utils=require("../../videoPlayer/utils.js");function _interopDefaultLegacy(S){return S&&typeof S=="object"&&"default"in S?S:{default:S}}var ___default=_interopDefaultLegacy(_),React__default=_interopDefaultLegacy(React);class VideoClipTool extends React__default.default.Component{constructor(r){super(r);this.fns=new Map,this.throttledUpdateTime=___default.default.throttle(t=>{this.videoPlayer.currentTime=t},100,{trailing:!0}),this.stepInfo=()=>this.props.stepInfo,this.emitEvent=t=>{const e=this.fns.get(t);e&&e.forEach(i=>{i&&i()})},this.setValid=t=>{this.setState({valid:t}),t===!1&&(this.clearResult(),this.updateSidebar())},this.updateSidebar=()=>{this.emitEvent("changeClipSidebar"),this.emitEvent("updateTextAttribute"),this.emitEvent("changeAttributeSidebar")},this.exportData=()=>{var t,e;const i=(e=(t=this.videoRef)==null?void 0:t.duration)!=null?e:0;return[this.state.result.filter(s=>s.end!==null),{valid:this.state.valid,duration:i}]},this.updateSelectedSliceTimeStartByPer=t=>{var e,i;if(this.state.clipStatus===constant.EClipStatus.Clipping){antd.message.info("\u622A\u53D6\u4E2D\u4E0D\u652F\u6301\u8C03\u6574\u5F00\u59CB\u65F6\u95F4");return}if(this.selectedSliceIndex>-1){const s=(i=(e=this.videoPlayer)==null?void 0:e.duration)!=null?i:0,{end:a,start:n,type:l}=this.state.result[this.selectedSliceIndex],u=lbAnnotation.MathUtils.withinRange(audio.precisionAdd(n,t),[0,audio.precisionMinus(l===constant.ETimeSliceType.Time?s:a,constant.PER_SLICE_CHANGE)]);this.updateSelectedSliceTimeProperty(u,"start")}},this.updateSelectedSliceTimeEndByPer=t=>{var e,i;if(this.state.clipStatus===constant.EClipStatus.Clipping){antd.message.info("\u622A\u53D6\u4E2D\u4E0D\u652F\u6301\u8C03\u6574\u7ED3\u675F\u65F6\u95F4");return}if(this.selectedSliceIndex>-1){const s=this.state.result[this.selectedSliceIndex],a=(i=(e=this.videoPlayer)==null?void 0:e.duration)!=null?i:0;if(s.type===constant.ETimeSliceType.Time){antd.message.info("\u65F6\u95F4\u70B9\u4EC5\u652F\u6301\u8C03\u6574\u5F00\u59CB\u65F6\u95F4");return}const{end:n,start:l}=s,u=lbAnnotation.MathUtils.withinRange(audio.precisionAdd(n,t),[audio.precisionAdd(l,constant.PER_SLICE_CHANGE),a]);this.updateSelectedSliceTimeProperty(u,"end")}},this.updateSelectedSliceTimeProperty=(t,e)=>{if(this.selectedSliceIndex>-1){const{result:i}=this.state;i[this.selectedSliceIndex][e]=t,this.setState({result:___default.default.cloneDeep(i)}),this.updateSidebar()}},this.keyDownEvents=t=>{if(!lbAnnotation.CommonToolUtils.hotkeyFilter(t))return;const e=t.target;switch(e&&(e==null?void 0:e.tag)==="INPUT"&&(e==null?void 0:e.type)==="radio"&&t.preventDefault(),t.key.toLocaleLowerCase()){case"x":this.toggleClipStatus();break;case"e":this.addTime();break;case"escape":this.cancelClipped();break;case"-":this.updateSelectedSliceTimeStartByPer(-constant.PER_SLICE_CHANGE);break;case"=":this.updateSelectedSliceTimeStartByPer(constant.PER_SLICE_CHANGE);break;case"[":this.updateSelectedSliceTimeEndByPer(-constant.PER_SLICE_CHANGE);break;case"]":this.updateSelectedSliceTimeEndByPer(constant.PER_SLICE_CHANGE);break}},this.setVideoError=(t,e,i)=>{if(t){const{clipStatus:s}=this.state;s===constant.EClipStatus.Clipping&&this.toggleClipStatus(i)}this.setState({videoError:t,loading:!1})},this.clearResult=()=>{this.setState({result:[],selectedID:"",textValue:""}),this.updateSidebar()},this.cancelClipped=()=>{const{result:t,selectedID:e,clipStatus:i}=this.state;if(i!==constant.EClipStatus.Clipping)return;const s=t.findIndex(a=>a.id===e);s>-1&&(t.splice(s,1),this.setState({result:t,selectedID:"",clipStatus:constant.EClipStatus.Stop}),this.updateSidebar())},this.toggleClipStatus=t=>{var e,i;if(typeof((e=this.props)==null?void 0:e.annotationBefore)=="function"){(i=this.props)==null||i.annotationBefore(()=>this.setClipResult(t));return}this.setClipResult(t)},this.setClipResult=t=>{var e,i,s;if(this.disabled)return;const{clipStatus:a,selectedAttribute:n}=this.state,l=a!==constant.EClipStatus.Clipping;let u=l?constant.EClipStatus.Clipping:constant.EClipStatus.Stop,{result:d,selectedID:o,textValue:p}=this.state;const c=___default.default.cloneDeep(d),h=t||((e=this.videoPlayer)==null?void 0:e.currentTime),v=(i=this.videoPlayer)==null?void 0:i.duration;if(v===void 0||h===void 0)return;const C=utils.decimalReserved(h,2);if(l){const f=lbAnnotation.uuid();o=f,c.push({start:C,end:null,attribute:n,textAttribute:this.defaultTextAttribute,duration:v,id:f,type:constant.ETimeSliceType.Period}),p=this.defaultTextAttribute}else{const f=c.findIndex(g=>g.id===o),m=c[f];m&&(h-m.start<constant.SLICE_MIN_TIME?(c.splice(f,1),antd.message.info(`\u622A\u53D6\u7247\u6BB5\u4E0D\u80FD\u77ED\u4E8E${constant.SLICE_MIN_TIME}s`),u=constant.EClipStatus.Stop,o="",p=""):(c[f].end=utils.decimalReserved(h,2),(s=this.videoPlayer)==null||s.pause(),antd.message.success(`\u5DF2\u622A\u53D6\u7247\u6BB5${d.length}`)))}this.setState({clipStatus:u,result:c,selectedID:o,textValue:p}),this.updateSidebar()},this.addTime=()=>{var t,e,i,s;if(this.disabled)return;const{result:a,selectedAttribute:n,selectedID:l}=this.state,u=lbAnnotation.uuid(),d=___default.default.cloneDeep(a),o=((t=this.videoPlayer)==null?void 0:t.currentTime)||0;d.push({start:o,end:o,attribute:n,textAttribute:this.defaultTextAttribute,id:u,type:constant.ETimeSliceType.Time,duration:(i=(e=this.videoPlayer)==null?void 0:e.duration)!=null?i:0});const p={result:d,selectedID:u,textValue:this.defaultTextAttribute},c=d.find(h=>h.id===l);this.isClipping&&c?(delete p.selectedID,delete p.textValue,antd.message.success(`\u5DF2\u622A\u53D6\u65F6\u95F4\u70B9${d.length-1}`)):(s=this.videoPlayer)==null||s.pause(),this.setState(p),this.updateSidebar()},this.updateCurrentTime=t=>{this.setState({currentTime:t})},this.contextToCancel=t=>{this.state.clipStatus===constant.EClipStatus.Stop&&(t.preventDefault(),this.setState({selectedID:""}),this.updateSidebar())},this.onTrackResize=(t,e,i)=>{var s,a;const{result:n}=this.state,l=n.find(u=>u.id===t);if(l){const u=l.duration,d=e==="left",o=d?"start":"end",p=d?-u*i:u*i,c=d?[0,Math.max(((s=l.end)!=null?s:0)-constant.SLICE_MIN_TIME,0)]:[l.start+constant.SLICE_MIN_TIME,u],h=lbAnnotation.MathUtils.withinRange(p+((a=l==null?void 0:l[o])!=null?a:0),c);l[o]=h,this.throttledUpdateTime(h)}this.setState({result:[...n]}),this.updateSidebar()},this.renderMediaContent=()=>{var t;const{pageForward:e,pageJump:i,pageBackward:s}=this.props,{result:a,videoError:n,valid:l,currentTime:u}=this.state;return React__default.default.createElement("div",{className:index_module.clipContainer},React__default.default.createElement(index.VideoPlayer,{imgIndex:this.props.imgIndex,imgList:this.props.imgList,pageBackward:s,pageForward:e,pageJump:i,valid:l,setVideoRef:d=>{this.videoPlayer=d},showVideoTrack:!n,onTrackResize:this.onTrackResize,drawLayerSlot:this.props.drawLayerSlot,footer:this.props.footer,dataLoaded:this.props.onVideoLoaded,toggleClipStatus:this.toggleClipStatus,addTime:this.addTime,updateCurrentTime:this.updateCurrentTime}),React__default.default.createElement(index$1,{key:(t=this.videoPlayer)==null?void 0:t.currentTime,result:a,currentTime:u,attributeList:this.props.config.attributeList,extraStyle:{top:this.props.drawLayerSlot?40:0}}),this.isClipping&&React__default.default.createElement("i",{className:index_module.clipping,style:{backgroundImage:icon_videoCutting}}))},this.onSelectedTimeSlice=t=>{var e;this.isClipping||(this.setState({selectedID:t.id,selectedAttribute:t.attribute,textValue:t.textAttribute,currentTime:t.start}),this.updateSidebar(),(e=this.videoPlayer)==null||e.pause(),this.videoPlayer.currentTime=t.start)},this.removeTimeSlice=t=>{const{result:e}=this.state,i=this.state.selectedID===t.id?"":this.state.selectedID,s=e.findIndex(a=>a.id===t.id);s>-1&&(e.splice(s,1),this.setState({result:[...e],selectedID:i}),this.updateSidebar())},this.setResult=(t=!0,e=this.props)=>{try{const{imgIndex:i,imgList:s}=e;if(!s[i])return;const n=index$2.jsonParser(s[i].result)[`step_${this.stepInfo().step}`],l=(n==null?void 0:n.result)||[],u=audio.isImageValue(s[i].result||"[]");this.setState({result:l,loading:t,selectedID:"",textValue:"",selectedAttribute:"",clipStatus:constant.EClipStatus.Stop,valid:u},()=>{this.updateSidebar(),u||antd.message.info("\u65E0\u6548\u89C6\u9891\uFF0C\u8BF7\u8DF3\u8FC7")})}catch(i){console.error("\u6570\u636E\u89E3\u6790\u5931\u8D25"),this.setState({result:[],loading:!1,selectedID:"",textValue:"",selectedAttribute:"",valid:!0},()=>{this.updateSidebar()})}},this.setDefaultAttribute=t=>{const{result:e,selectedID:i}=this.state,s=e.find(a=>a.id===i);s&&i&&(s.attribute=t),this.setState({selectedAttribute:t,result:[...e]}),this.updateSidebar()},this.textChange=t=>{const{result:e,selectedID:i}=this.state;if(this.setState({textValue:t}),i){const s=e.find(a=>a.id===i);s&&(s.textAttribute=t,this.setState({result:[...e]}),this.updateSidebar())}},this.state={result:[],selectedAttribute:"",textValue:"",clipStatus:constant.EClipStatus.Stop,selectedID:"",loading:!1,videoError:!1,remainingTime:0,currentTime:0,configLoading:!1,valid:!0}}get videoUrl(){var r;const{imgIndex:t,imgList:e}=this.props;return((r=e[t])==null?void 0:r.url)||""}get isClipping(){return this.state.clipStatus===constant.EClipStatus.Clipping}get resultJSON(){const{imgIndex:r,imgList:t}=this.props;return t.length===0||!t[r]?"[]":t[r].result}get disabled(){return!this.state.valid||this.state.videoError}get loading(){return this.state.loading||this.state.configLoading}get defaultTextAttribute(){return lbAnnotation.AttributeUtils.getTextAttribute(this.state.result,this.props.config.textCheckType)}get defaultAttribute(){return this.state.selectedAttribute}get selectedID(){return this.state.selectedID}get selectedSliceIndex(){return this.state.result.findIndex(r=>r.id===this.state.selectedID)}get exportContext(){return{selectedID:this.state.selectedID,result:this.state.result,clipStatus:this.state.clipStatus,videoPlayer:this.videoPlayer,attributeList:this.props.config.attributeList,onSelectedTimeSlice:this.onSelectedTimeSlice,removeTimeSlice:this.removeTimeSlice,updateSelectedSliceTimeProperty:this.updateSelectedSliceTimeProperty}}get valid(){return this.state.valid}get config(){var r;return index$2.jsonParser((r=this.props.stepInfo)==null?void 0:r.config)}get selectedText(){var r,t;return(t=(r=this.state.result)==null?void 0:r[this.selectedSliceIndex])==null?void 0:t.textAttribute}componentDidMount(){this.setState({loading:!1}),this.setResult(!1),this.props.onMounted(this),window.addEventListener("keydown",this.keyDownEvents)}componentWillUnmount(){this.props.onUnmounted(),window.removeEventListener("keydown",this.keyDownEvents)}shouldComponentUpdate(r,t){const e=r.imgIndex-this.props.imgIndex,i=r.step-this.props.step;return(e!==0||i!==0)&&(this.setResult(!0,r),i!==0&&this.setState({loading:!1})),!0}singleOn(r,t){this.fns.set(r,[t])}on(r,t){this.singleOn(r,t)}unbindAll(r){this.fns.delete(r)}render(){const{selectedID:r,result:t,clipStatus:e,selectedAttribute:i}=this.state;return React__default.default.createElement(VideoClipToolContext.VideoClipToolContextProvider,{value:{videoPlayer:this.videoPlayer,result:t,selectedID:r,attributeList:this.props.config.attributeList,clipStatus:e,selectedAttribute:i,contextToCancel:this.contextToCancel}},this.renderMediaContent())}}module.exports=VideoClipTool;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),index=require("../../../utils/index.js"),index$1=require("../../videoPlayer/index.js"),VideoTagLayer=require("../../videoPlayer/VideoTagLayer.js"),_=require("lodash"),utils=require("../../videoPlayer/utils.js");function _interopDefaultLegacy(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),index=require("../../../utils/index.js"),index$1=require("../../videoPlayer/index.js"),VideoTagLayer=require("../../videoPlayer/VideoTagLayer.js"),_=require("lodash"),utils=require("../../videoPlayer/utils.js");function _interopDefaultLegacy(h){return h&&typeof h=="object"&&"default"in h?h:{default:h}}var React__default=_interopDefaultLegacy(React),___default=_interopDefaultLegacy(_);class TagToolInstanceAdaptor extends React__default.default.Component{constructor(e){super(e);this.fns={},this.labelSelectedList=[],this.clearResult=(t=!0,s)=>{const n=s?this.state.tagResult.map(i=>((i==null?void 0:i.result[s])&&delete i.result[s],i)):[];this.setState({tagResult:n},()=>this.emitEvent("render"))},this.exportData=()=>{var t,s;const n=(s=(t=this.videoPlayer)==null?void 0:t.duration)!=null?s:0;return[this.state.tagResult,{valid:this.state.valid,duration:n}]},this.emitEvent=t=>{this.fns[t]&&this.fns[t]()},this.combineResult=(t,s={})=>{var n,i;const l=_.cloneDeep(s),{isMulti:o}=t,{key:a,value:u}=t.value;if(o){let r=(i=(n=l[a])==null?void 0:n.split(";"))!=null?i:[];r.includes(u)?r=r.filter(c=>c!==u):r.push(u);const d=new Set(r);return l[a]=Array.from(d).join(";"),___default.default.pickBy(l,c=>c)}return l[a]=l[a]===u?void 0:u,___default.default.pickBy(l,r=>r)},this.setResult=t=>{this.setState({tagResult:t}),this.fns.render&&this.fns.render()},this.setLabel=(t,s)=>{this.setLabelBySelectedList(t,s)},this.keydown=t=>{var s;const n=utils.getKeyCodeNumber(t.keyCode);if(n){const i=n-1;if(((s=this.config.inputList)==null?void 0:s.length)===1){this.labelSelectedList=[0,i],this.setLabel(0,i),setTimeout(()=>{this.labelSelectedList=[],this.emitEvent("render")},500);return}this.labelSelectedList.length===1?(this.labelSelectedList=[this.labelSelectedList[0],i],this.setLabel(this.labelSelectedList[0],i),setTimeout(()=>{this.labelSelectedList=[],this.emitEvent("render")},500)):(this.labelSelectedList=[i],this.emitEvent("expend"))}},this.setValid=t=>{this.setState({valid:t}),t===!1&&this.setState({tagResult:[]}),this.emitEvent("render")},this.setResultFromImgList=t=>{const{imgList:s,imgIndex:n,stepInfo:i}=t;if(!s[n])return;const l=index.jsonParser(s[n].result),o=l[`step_${i.step}`],a=this.getInitResultList();this.setState({tagResult:o?o==null?void 0:o.result:a,valid:(l==null?void 0:l.valid)===void 0?!0:l.valid},()=>this.emitEvent("render"))},this.getInitResultList=()=>{var t;return lbAnnotation.TagUtils.getDefaultTagResult((t=this.config.inputList)!=null?t:[],[])},this.state={tagResult:[],labelSelectedList:[],valid:!0}}get config(){var e;return index.jsonParser((e=this.props.stepInfo)==null?void 0:e.config)}get history(){return{initRecord:()=>{},pushHistory:()=>{}}}get currentTagResult(){var e;return(e=this.state.tagResult[0])!=null?e:{}}get valid(){return this.state.valid}singleOn(e,t){this.fns[e]=t}on(e,t){this.singleOn(e,t)}unbindAll(e){delete this.fns[e]}getTagResultByCode(e,t){var s,n,i;try{const l=(n=(s=this.config)==null?void 0:s.inputList)!=null?n:[],o=(l==null?void 0:l.length)>1,a=t!==void 0?e:0,u=t!==void 0?t:e,r=o?l[a]:l[0],d=((i=r.subSelected)!=null?i:[])[u];if(r&&d)return{value:{key:r.value,value:d.value},isMulti:r.isMulti}}catch(l){return}}setLabelBySelectedList(e,t){var s,n,i,l,o,a;const u=this.getTagResultByCode(e,t);if(u){const r=this.combineResult(u,(n=(s=this.state.tagResult[0])==null?void 0:s.result)!=null?n:{}),d=[{sourceID:lbAnnotation.CommonToolUtils.getSourceID(),id:(l=(i=this.currentTagResult)==null?void 0:i.id)!=null?l:lbAnnotation.uuid(8,62),result:r}];if(typeof((o=this.props)==null?void 0:o.annotationBefore)=="function"){(a=this.props)==null||a.annotationBefore(()=>this.setState({tagResult:d},()=>this.emitEvent("render")));return}this.setState({tagResult:d},()=>this.emitEvent("render"))}}componentDidMount(){document.addEventListener("keydown",this.keydown),this.props.onMounted(this),this.setResultFromImgList(this.props)}componentWillUnmount(){document.addEventListener("keydown",this.keydown),this.props.onUnmounted()}shouldComponentUpdate(e){return e.imgIndex!==this.props.imgIndex&&this.setResultFromImgList(e),!0}render(){var e;const{imgIndex:t,imgList:s,pageForward:n,pageJump:i,pageBackward:l}=this.props,{tagResult:o,valid:a}=this.state;return React__default.default.createElement("div",{style:{height:"100%",width:"100%",position:"relative",display:"flex",flexDirection:"column"}},React__default.default.createElement(index$1.VideoPlayer,{imgIndex:t,imgList:s,pageBackward:l,pageForward:n,pageJump:i,valid:a,setVideoRef:u=>{this.videoPlayer=u},dataLoaded:this.props.onVideoLoaded,drawLayerSlot:this.props.drawLayerSlot,footer:this.props.footer}),React__default.default.createElement(VideoTagLayer.VideoTagLayer,{result:o,inputList:(e=this.config)==null?void 0:e.inputList,hasPromptLayer:!!this.props.drawLayerSlot}))}}exports.TagToolInstanceAdaptor=TagToolInstanceAdaptor;
|
package/dist/index.css
CHANGED
|
@@ -132,6 +132,12 @@
|
|
|
132
132
|
.index-module_outputDisplay__5dS48 .index-module_content__Iml6l .markdown-body {
|
|
133
133
|
font-size: 14px;
|
|
134
134
|
}
|
|
135
|
+
|
|
136
|
+
.index-module_tip__NFru6 {
|
|
137
|
+
margin-bottom: 8px;
|
|
138
|
+
color: rgba(0, 0, 0, 0.45);
|
|
139
|
+
font-size: 14px;
|
|
140
|
+
}
|
|
135
141
|
.index-module_tagList__cvWor {
|
|
136
142
|
padding: 0px 16px 16px 16px;
|
|
137
143
|
}
|
|
@@ -720,6 +726,16 @@
|
|
|
720
726
|
font-family: SourceHanSansCN-Medium;
|
|
721
727
|
font-size: 14px;
|
|
722
728
|
}
|
|
729
|
+
.index-module_label__xE6hM .index-module_labelText__Zg1c4 {
|
|
730
|
+
display: flex;
|
|
731
|
+
overflow: hidden;
|
|
732
|
+
width: 60%;
|
|
733
|
+
align-items: center;
|
|
734
|
+
}
|
|
735
|
+
.index-module_label__xE6hM .index-module_labelText__Zg1c4 .index-module_titleText__BRM44 {
|
|
736
|
+
max-width: calc(100% - 20px);
|
|
737
|
+
overflow: hidden;
|
|
738
|
+
}
|
|
723
739
|
.index-module_label__xE6hM .index-module_required__iElYl::before {
|
|
724
740
|
display: inline-block;
|
|
725
741
|
margin-right: 4px;
|
|
@@ -732,6 +748,7 @@
|
|
|
732
748
|
.index-module_label__xE6hM .index-module_extra__PW5Qk {
|
|
733
749
|
float: right;
|
|
734
750
|
margin-right: 5px;
|
|
751
|
+
width: 40%;
|
|
735
752
|
}
|
|
736
753
|
|
|
737
754
|
.index-module_textareaContainer__dTIv4 {
|
|
@@ -862,6 +879,7 @@
|
|
|
862
879
|
flex-wrap: wrap;
|
|
863
880
|
align-items: center;
|
|
864
881
|
justify-content: center;
|
|
882
|
+
overflow: hidden;
|
|
865
883
|
}
|
|
866
884
|
.index-module_placeholderHotkey__0SKPo .text {
|
|
867
885
|
color: #333;
|
|
@@ -878,7 +896,10 @@
|
|
|
878
896
|
|
|
879
897
|
.index-module_attribute__g8Vbl {
|
|
880
898
|
height: 22px;
|
|
881
|
-
padding:
|
|
899
|
+
padding: 0px 8px;
|
|
900
|
+
width: max-content;
|
|
901
|
+
max-width: 100%;
|
|
902
|
+
margin-left: auto;
|
|
882
903
|
}
|
|
883
904
|
|
|
884
905
|
.index-module_clearIcon__ZBZqI {
|
|
@@ -887,10 +908,14 @@
|
|
|
887
908
|
height: 14px;
|
|
888
909
|
margin-left: 4px;
|
|
889
910
|
vertical-align: text-top;
|
|
911
|
+
background-image: url(~@/assets/tool_Icon/icon_clearSmall.svg);
|
|
890
912
|
background-repeat: no-repeat;
|
|
891
913
|
background-position: center;
|
|
892
914
|
cursor: pointer;
|
|
893
915
|
}
|
|
916
|
+
.index-module_clearIcon__ZBZqI:not(.index-module_disabled__zqh8C):hover {
|
|
917
|
+
background-image: url(~@/assets/tool_Icon/icon_clearSmall_a.svg);
|
|
918
|
+
}
|
|
894
919
|
.index-module_clearIcon__ZBZqI.index-module_disabled__zqh8C {
|
|
895
920
|
cursor: not-allowed;
|
|
896
921
|
}
|
|
@@ -1141,7 +1166,8 @@
|
|
|
1141
1166
|
}
|
|
1142
1167
|
.index-module_clipSidebar__z2E8x .index-module_attributeList__2wnCE {
|
|
1143
1168
|
flex: 1;
|
|
1144
|
-
overflow:
|
|
1169
|
+
overflow-x: hidden;
|
|
1170
|
+
overflow-y: auto;
|
|
1145
1171
|
}
|
|
1146
1172
|
.index-module_clipSidebar__z2E8x .index-module_attributeList__2wnCE .sensebee-radio-group,
|
|
1147
1173
|
.index-module_clipSidebar__z2E8x .index-module_attributeList__2wnCE .sensebee-radio-group-no-limit-height .ant-radio-group {
|
|
@@ -1870,11 +1896,14 @@
|
|
|
1870
1896
|
-ms-user-select: none;
|
|
1871
1897
|
user-select: none;
|
|
1872
1898
|
}
|
|
1899
|
+
.generalOperation .generalOperation-col {
|
|
1900
|
+
display: flex;
|
|
1901
|
+
justify-content: center;
|
|
1902
|
+
}
|
|
1873
1903
|
.generalOperation .item {
|
|
1874
1904
|
text-align: center;
|
|
1875
|
-
flex: 1;
|
|
1876
1905
|
box-sizing: border-box;
|
|
1877
|
-
width:
|
|
1906
|
+
width: 100px;
|
|
1878
1907
|
height: 100%;
|
|
1879
1908
|
display: flex;
|
|
1880
1909
|
flex-direction: column;
|
|
@@ -3077,15 +3106,12 @@
|
|
|
3077
3106
|
display: block;
|
|
3078
3107
|
}
|
|
3079
3108
|
.bee-sidebar__content__NLPList__item__text {
|
|
3080
|
-
flex: 1 1;
|
|
3081
|
-
padding: 16px;
|
|
3082
3109
|
font-weight: 400;
|
|
3083
3110
|
font-size: 12px;
|
|
3084
3111
|
line-height: 20px;
|
|
3085
3112
|
color: #666666;
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
white-space: nowrap;
|
|
3113
|
+
padding: 16px;
|
|
3114
|
+
width: 100%;
|
|
3089
3115
|
}
|
|
3090
3116
|
.bee-sidebar__content__NLPList__item__active {
|
|
3091
3117
|
background-color: #eeefff;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var index$1=require("./components/AnnotationView/index.js"),pointCloudAnnotationView=require("./components/AnnotationView/pointCloudAnnotationView.js"),index$2=require("./components/LLMToolView/questionView/index.js"),index$3=require("./components/NLPToolView/textContent/index.js"),lbUtils=require("@labelbee/lb-utils"),React=require("react"),reactI18next=require("react-i18next"),reactRedux=require("react-redux"),App=require("./App.js"),configureStore=require("./configureStore.js"),actionCreators=require("./store/annotation/actionCreators.js"),TagToolInstanceAdaptorI18nProvider=require("./components/videoAnnotate/videoTagTool/TagToolInstanceAdaptorI18nProvider.js"),PointCloudContext=require("./components/pointCloudView/PointCloudContext.js"),ctx=require("./store/ctx.js"),index$5=require("./components/predictTracking/predictTrackingIcon/index.js"),index$4=require("./components/LLMToolView/index.js"),index$6=require("./views/MainView/toolFooter/SwitchCuboidBoxIn2DView/index.js"),index$7=require("./components/measureCanvas/index.js"),index$8=require("./views/MainView/sidebar/PointCloudToolSidebar/components/annotatedBox/index.js"),index$9=require("./views/MainView/sidebar/PointCloudToolSidebar/components/findTrackIDIndex/index.js"),index$a=require("./constant/index.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,t
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var index$1=require("./components/AnnotationView/index.js"),pointCloudAnnotationView=require("./components/AnnotationView/pointCloudAnnotationView.js"),index$2=require("./components/LLMToolView/questionView/index.js"),index$3=require("./components/NLPToolView/textContent/index.js"),lbUtils=require("@labelbee/lb-utils"),React=require("react"),reactI18next=require("react-i18next"),reactRedux=require("react-redux"),App=require("./App.js"),configureStore=require("./configureStore.js"),actionCreators=require("./store/annotation/actionCreators.js"),TagToolInstanceAdaptorI18nProvider=require("./components/videoAnnotate/videoTagTool/TagToolInstanceAdaptorI18nProvider.js"),PointCloudContext=require("./components/pointCloudView/PointCloudContext.js"),ctx=require("./store/ctx.js"),index$5=require("./components/predictTracking/predictTrackingIcon/index.js"),index$4=require("./components/LLMToolView/index.js"),index$6=require("./views/MainView/toolFooter/SwitchCuboidBoxIn2DView/index.js"),index$7=require("./components/measureCanvas/index.js"),index$8=require("./views/MainView/sidebar/PointCloudToolSidebar/components/annotatedBox/index.js"),index$9=require("./views/MainView/sidebar/PointCloudToolSidebar/components/findTrackIDIndex/index.js"),index$a=require("./components/audioPlayer/index.js"),index$b=require("./constant/index.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,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},__spreadProps=(e,r)=>__defProps(e,__getOwnPropDescs(r));const store=configureStore(),OutputApp=(e,r)=>{const[t,a]=React.useState();return React.useImperativeHandle(r,()=>({toolInstance:t,annotationEngine:store.getState().annotation.annotationEngine,pageBackwardActions:()=>store.dispatch(actionCreators.PageBackward()),pageForwardActions:()=>store.dispatch(actionCreators.PageForward()),pageJump:o=>{const n=~~o-1;store.dispatch(actionCreators.PageJump(n))},hello:()=>alert("hello labelBee!!!")}),[t]),React__default.default.createElement(reactRedux.Provider,{store,context:ctx.LabelBeeContext},React__default.default.createElement(reactI18next.I18nextProvider,{i18n:lbUtils.i18n},React__default.default.createElement(PointCloudContext.PointCloudProvider,null,React__default.default.createElement(App,__spreadProps(__spreadValues({},e),{setToolInstance:o=>{var n;a(o),(n=e.onLoad)==null||n.call(e,{toolInstance:o})}})))))};var index=React__default.default.forwardRef(OutputApp);exports.AnnotationView=index$1,exports.PointCloudAnnotationView=pointCloudAnnotationView,exports.QuestionView=index$2.default,exports.TextContent=index$3,Object.defineProperty(exports,"i18n",{enumerable:!0,get:function(){return lbUtils.i18n}}),exports.VideoTagTool=TagToolInstanceAdaptorI18nProvider.VideoTagTool,exports.PredictTracking=index$5,exports.LLMToolView=index$4,exports.SwitchCuboidBoxIn2DView=index$6,exports.MeasureCanvas=index$7,exports.AnnotatedBox=index$8,exports.FindTrackIDIndex=index$9.FindTrackIDIndexInCheckMode,exports.AudioPlayer=index$a.WrapAudioPlayer,Object.defineProperty(exports,"EDataFormatType",{enumerable:!0,get:function(){return index$b.EDataFormatType}}),Object.defineProperty(exports,"ELLMDataType",{enumerable:!0,get:function(){return index$b.ELLMDataType}}),Object.defineProperty(exports,"EStepType",{enumerable:!0,get:function(){return index$b.EStepType}}),Object.defineProperty(exports,"ESubmitType",{enumerable:!0,get:function(){return index$b.ESubmitType}}),exports.componentCls=index$b.componentCls,exports.prefix=index$b.prefix,exports.default=index,exports.store=store;
|
package/dist/store/Actions.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const ANNOTATION_ACTIONS={INIT_ALL_STATE:"@@INIT_ALL_STATE",UPDATE_TOOL_INSTANCE:"@@UPDATE_TOOL_INSTANCE",UPDATE_IMG_LIST:"@@UPDATE_IMG_LIST",UPDATE_ANNOTATION_CONFIG:"@@UPDATE_ANNOTATION_CONFIG",LOAD_FILE_DATA:"@@LOAD_FILE_DATA",SUBMIT_FILE_DATA:"@@SUBMIT_FILE_DATA",SET_TASK_CONFIG:"@@SET_TASK_CONFIG",INIT_TOOL:"@@INIT_TOOL",SET_TOOL:"@@SET_TOOL",UPDATE_ON_SUBMIT:"@@UPDATE_ON_SUBMIT",UPDATE_ON_SAVE:"@@UPDATE_ON_SAVE",UPDATE_ON_PAGE_CHANGE:"@@UPDATE_ON_PAGE_CHANGE",UPDATE_ON_STEP_CHANGE:"@@UPDATE_ON_STEP_CHANGE",UPDATE_ROTATE:"@@UPDATE_ROTATE",UPDATE_GET_FILE_DATA:"@@UPDATE_GET_FILE_DATA",UPDATE_PAGE_SIZE:"@@UPDATE_PAGE_SIZE",UPDATE_LOAD_FILE_LIST:"@@UPDATE_LOAD_FILE_LIST",GET_FILE_DATA:"@@GET_FILE_DATA",SET_FILE_DATA:"@@SET_FILE_DATA",COPY_BACKWARD_RESULT:"@@COPY_BACKWARD_RESULT",SET_STEP:"@@SET_STEP",SUBMIT_RESULT:"@@SUBMIT_RESULT",SAVE_RESULT:"@@SAVE_RESULT",SET_BASIC_INDEX:"@@SET_BASIC_INDEX",CALC_STEP_PROGRESS:"@@CALC_STEP_PROGRESS",SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED:"@@SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED",SKIP_BEFORE_PAGE_TURNING:"@@SKIP_BEFORE_PAGE_TURNING",UPDATE_BEFORE_ROTATE:"@@UPDATE_BEFORE_ROTATE",SET_LOADING:"@@SET_LOADING",SET_LOADPCDFILE_LOADING:"@@SET_LOADPCDFILE_LOADING",SET_POINT_CLOUD_LOADING:"@@SET_POINT_CLOUD_LOADING",SET_CHECK_MODE:"@@SET_CHECK_MODE",SET_TASK_STEP_LIST:"@@SET_TASK_STEP_LIST",UPDATE_ANNOTATION_VALID:"@@UPDATE_ANNOTATION_VALID",BATCH_UPDATE_TRACK_ID:"@@BATCH_UPDATE_TRACK_ID",BATCH_UPDATE_RESULT_BY_TRACK_ID:"@@BATCH_UPDATE_RESULT_BY_TRACK_ID",BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT:"@@BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT",SET_PREDICT_RESULT_VISIBLE:"@@SET_PREDICT_RESULT_VISIBLE",SET_PREDICT_RESULT:"@@SET_PREDICT_RESULT",SET_HIGHLIGHT_ATTRIBUTE:"@@SET_HIGHLIGHT_ATTRIBUTE",UPDATE_PRE_DATA_PROCESS:"@@UPDATE_PRE_DATA_PROCESS"},IMAGE_ATTRIBUTE_ACTIONS={UPDATE_IMG_ATTRIBUTE:"@@UPDATE_IMG_ATTRIBUTE",INIT_IMG_ATTRIBUTE:"@@INIT_IMG_ATTRIBUTE"},TOOL_STYLE_ACTIONS={INIT_TOOL_STYLE_CONFIG:"@@INIT_TOOL_STYLE_CONFIG",UPDATE_TOOL_STYLE_CONFIG:"@@UPDATE_TOOL_STYLE_CONFIG"};exports.ANNOTATION_ACTIONS=ANNOTATION_ACTIONS,exports.IMAGE_ATTRIBUTE_ACTIONS=IMAGE_ATTRIBUTE_ACTIONS,exports.TOOL_STYLE_ACTIONS=TOOL_STYLE_ACTIONS;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const ANNOTATION_ACTIONS={INIT_ALL_STATE:"@@INIT_ALL_STATE",UPDATE_TOOL_INSTANCE:"@@UPDATE_TOOL_INSTANCE",UPDATE_IMG_LIST:"@@UPDATE_IMG_LIST",UPDATE_ANNOTATION_CONFIG:"@@UPDATE_ANNOTATION_CONFIG",LOAD_FILE_DATA:"@@LOAD_FILE_DATA",SUBMIT_FILE_DATA:"@@SUBMIT_FILE_DATA",SET_TASK_CONFIG:"@@SET_TASK_CONFIG",INIT_TOOL:"@@INIT_TOOL",SET_TOOL:"@@SET_TOOL",UPDATE_ON_SUBMIT:"@@UPDATE_ON_SUBMIT",UPDATE_ON_SAVE:"@@UPDATE_ON_SAVE",UPDATE_ON_PAGE_CHANGE:"@@UPDATE_ON_PAGE_CHANGE",UPDATE_ON_STEP_CHANGE:"@@UPDATE_ON_STEP_CHANGE",UPDATE_ROTATE:"@@UPDATE_ROTATE",UPDATE_GET_FILE_DATA:"@@UPDATE_GET_FILE_DATA",UPDATE_PAGE_SIZE:"@@UPDATE_PAGE_SIZE",UPDATE_LOAD_FILE_LIST:"@@UPDATE_LOAD_FILE_LIST",GET_FILE_DATA:"@@GET_FILE_DATA",SET_FILE_DATA:"@@SET_FILE_DATA",COPY_BACKWARD_RESULT:"@@COPY_BACKWARD_RESULT",SET_STEP:"@@SET_STEP",SUBMIT_RESULT:"@@SUBMIT_RESULT",SAVE_RESULT:"@@SAVE_RESULT",SET_BASIC_INDEX:"@@SET_BASIC_INDEX",CALC_STEP_PROGRESS:"@@CALC_STEP_PROGRESS",SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED:"@@SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED",SKIP_BEFORE_PAGE_TURNING:"@@SKIP_BEFORE_PAGE_TURNING",UPDATE_BEFORE_ROTATE:"@@UPDATE_BEFORE_ROTATE",SET_LOADING:"@@SET_LOADING",SET_LOADPCDFILE_LOADING:"@@SET_LOADPCDFILE_LOADING",SET_POINT_CLOUD_LOADING:"@@SET_POINT_CLOUD_LOADING",SET_CHECK_MODE:"@@SET_CHECK_MODE",SET_TASK_STEP_LIST:"@@SET_TASK_STEP_LIST",UPDATE_ANNOTATION_VALID:"@@UPDATE_ANNOTATION_VALID",BATCH_UPDATE_TRACK_ID:"@@BATCH_UPDATE_TRACK_ID",BATCH_UPDATE_RESULT_BY_TRACK_ID:"@@BATCH_UPDATE_RESULT_BY_TRACK_ID",BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT:"@@BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT",SET_PREDICT_RESULT_VISIBLE:"@@SET_PREDICT_RESULT_VISIBLE",SET_PREDICT_RESULT:"@@SET_PREDICT_RESULT",SET_HIGHLIGHT_ATTRIBUTE:"@@SET_HIGHLIGHT_ATTRIBUTE",UPDATE_PRE_DATA_PROCESS:"@@UPDATE_PRE_DATA_PROCESS",UPDATE_IMG_INDEX_BY_EXTERNAL:"@@UPDATE_IMG_INDEX_BY_EXTERNAL"},IMAGE_ATTRIBUTE_ACTIONS={UPDATE_IMG_ATTRIBUTE:"@@UPDATE_IMG_ATTRIBUTE",INIT_IMG_ATTRIBUTE:"@@INIT_IMG_ATTRIBUTE"},TOOL_STYLE_ACTIONS={INIT_TOOL_STYLE_CONFIG:"@@INIT_TOOL_STYLE_CONFIG",UPDATE_TOOL_STYLE_CONFIG:"@@UPDATE_TOOL_STYLE_CONFIG"};exports.ANNOTATION_ACTIONS=ANNOTATION_ACTIONS,exports.IMAGE_ATTRIBUTE_ACTIONS=IMAGE_ATTRIBUTE_ACTIONS,exports.TOOL_STYLE_ACTIONS=TOOL_STYLE_ACTIONS;
|