@labelbee/lb-components 1.23.0-alpha.13 → 1.23.0-alpha.14

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.
@@ -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(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 PointCloud2DRectOperationView=e=>{var r;const{mappingData:t,size:i,config:P,checkMode:C,afterImgOnLoad:g}=e,l=(r=t==null?void 0:t.url)!=null?r:"",{pointCloudBoxList:s,setPointCloudResult:w}=React.useContext(PointCloudContext.PointCloudContext),{update2DViewRect:R}=usePointCloudViews.usePointCloudViews(),c=React__default.default.useRef(null),o=React.useRef(null),d=ahooks.useLatest(R),p=React.useRef(null),[O,b]=React.useState(!0),f=n=>{var a;const u=(a=d.current)==null?void 0:a.call(d,n);p.current=u,w(u)},m=()=>{var n;let a=[];s.forEach(u=>{const{rects:D=[],id:v,attribute:x,trackID:h}=u,_=D.find(V=>V.imageName===(t==null?void 0:t.path)),y=v+"_"+(t==null?void 0:t.path);_&&(a=[...a,__spreadProps(__spreadValues({},_),{boxID:v,id:y,attribute:x,order:h})])}),(n=o.current)==null||n.setResult(a)};return React.useEffect(()=>{if(c.current){const n=new lbAnnotation.PointCloud2DRectOperation({container:c.current,size:i,config:__spreadProps(__spreadValues({},P),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:C});return o.current=n,o.current.init(),o.current.on("updateDragResult",f),()=>{var a,u;(a=o.current)==null||a.unbind("updateDragResult",f),(u=o.current)==null||u.destroy()}}},[]),React.useEffect(()=>{o.current&&l&&lbAnnotation.ImgUtils.load(l).then(n=>{o.current.setImgNode(n),g(n),b(!1)})},[l]),React.useEffect(()=>{var n;(n=o.current)==null||n.setSize(i)},[i]),React.useEffect(()=>{s!==p.current&&m()},[s,l]),React__default.default.createElement(es.Spin,{spinning:O},React__default.default.createElement("div",{ref:c,style:__spreadValues({position:"relative"},i)}))};var PointCloud2DRectOperationView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloud2DRectOperationView);module.exports=PointCloud2DRectOperationView$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(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}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=(r,n,t)=>n in r?__defProp(r,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[n]=t,__spreadValues=(r,n)=>{for(var t in n||(n={}))__hasOwnProp.call(n,t)&&__defNormalProp(r,t,n[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(n))__propIsEnum.call(n,t)&&__defNormalProp(r,t,n[t]);return r},__spreadProps=(r,n)=>__defProps(r,__getOwnPropDescs(n));const PointCloud2DRectOperationView=r=>{var n;const{mappingData:t,size:l,config:O,checkMode:h,afterImgOnLoad:x}=r,f=(n=t==null?void 0:t.url)!=null?n:"",{pointCloudBoxList:s,setPointCloudResult:L,defaultAttribute:_,rectList:p,addRectIn2DView:y,updateRectIn2DView:V,removeRectIn2DView:E}=React.useContext(PointCloudContext.PointCloudContext),{update2DViewRect:S}=usePointCloudViews.usePointCloudViews(),v=React__default.default.useRef(null),o=React.useRef(null),R=ahooks.useLatest(S),g=React.useRef(null),[j,D]=React.useState(!0),m=React.useMemo(()=>p==null?void 0:p.filter(e=>e.imageName===(t==null?void 0:t.path)),[t==null?void 0:t.path,p]),d=ahooks.useLatest(t==null?void 0:t.path),P=e=>{var u;const{boxID:i}=e;if(i){const a=(u=R.current)==null?void 0:u.call(R,e);g.current=a,L(a);return}V(e)},b=e=>{d.current&&y(__spreadProps(__spreadValues({},e),{imageName:d.current}))},w=e=>{E(e)},q=React.useCallback(()=>{let e=[];return s.forEach(u=>{const{rects:i=[],id:a,attribute:c,trackID:A}=u,I=i.find(k=>k.imageName===d.current),B=a+"_"+d.current;I&&(e=[...e,__spreadProps(__spreadValues({},I),{boxID:a,id:B,attribute:c,order:A})])}),e},[s]),C=()=>{var e,u,i;const a=q(),c=(e=o.current)==null?void 0:e.selectedRectID;(u=o.current)==null||u.setResult([...a,...m]),c&&((i=o.current)==null||i.setSelectedRectID(c))};return React.useEffect(()=>{if(v.current){const e=new lbAnnotation.PointCloud2DRectOperation({container:v.current,size:l,config:__spreadProps(__spreadValues({},O),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:h});return o.current=e,o.current.init(),o.current.on("updateDragResult",P),o.current.on("afterAddingDrawingRect",b),o.current.on("deleteSelectedRects",w),()=>{var u,i,a,c;(u=o.current)==null||u.unbind("updateDragResult",P),(i=o.current)==null||i.unbind("afterAddingDrawingRect",b),(a=o.current)==null||a.unbind("deleteSelectedRects",w),(c=o.current)==null||c.destroy()}}},[]),React.useEffect(()=>{D(!0),o.current&&f&&lbAnnotation.ImgUtils.load(f).then(e=>{o.current.setImgNode(e),x(e),D(!1)})},[f]),React.useEffect(()=>{var e;(e=o.current)==null||e.setSize(l)},[l]),React.useEffect(()=>{s!==g.current&&C()},[s]),React.useEffect(()=>{var e,u;(u=(e=o.current)==null?void 0:e.setDefaultAttribute)==null||u.call(e,_)},[_]),React.useEffect(()=>{C()},[m]),React__default.default.createElement(es.Spin,{spinning:j},React__default.default.createElement("div",{ref:v,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,t)=>l in e?__defProp(e,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[l]=t,__spreadValues=(e,l)=>{for(var t in l||(l={}))__hasOwnProp.call(l,t)&&__defNormalProp(e,t,l[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(l))__propIsEnum.call(l,t)&&__defNormalProp(e,t,l[t]);return e},__spreadProps=(e,l)=>__defProps(e,__getOwnPropDescs(l));const EKeyCode=lbAnnotation.cKeyCode.default,ContainerTitle=({showEnlarge:e,isEnlargeTopView:l,data:t,setIsEnlarge:g,setCurIndex:f,curIndex:p=0,index:w,annotations2d:b})=>l?React__default.default.createElement(index,{title:t==null?void 0:t.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:()=>{g(!1),f(void 0)}}),React__default.default.createElement("span",null,t==null?void 0:t.calName),React__default.default.createElement("span",{style:{marginLeft:"8px"}},p+1,"/",b==null?void 0:b.length)):React__default.default.createElement(index,{title:t==null?void 0:t.calName,onClick:()=>{g(!0),f(w)},style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}),PointCloud2DView=({currentData:e,config:l,thumbnailWidth:t,isEnlargeTopView:g,highlightAttribute:f,loadPCDFileLoading:p,checkMode:w,measureVisible:b})=>{var L;const[c,H]=React.useState([]),{topViewInstance:M,displayPointCloudList:q,polygonList:F,imageSizes:O,selectedIDs:S}=React.useContext(PointCloudContext.PointCloudContext),[x,U]=React.useState(""),[y,P]=React.useState(!1),[s,E]=React.useState(void 0);React.useEffect(()=>{var o;if(!p&&M&&(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(n=>{var v,N,R;const V=q.reduce((d,u)=>{var m,a;const C=u.id===x||f===u.attribute,{transferViewData:z,viewRangePointList:h}=(m=lbAnnotation.pointCloudLidar2image(u,n.calib,{createRange:C}))!=null?m:{};if(!z||!h)return[];const T=(a=lbUtils.toolStyleConverter.getColorFromConfig({attribute:u.attribute},__spreadProps(__spreadValues({},l),{attributeConfigurable:!0}),{}))==null?void 0:a.stroke,Q=$({viewDataPointList:z,pointCloudBox:u,defaultViewStyle:i,stroke:T}),K=[...d,...Q];return(h==null?void 0:h.length)>0&&K.unshift({type:"polygon",annotation:__spreadProps(__spreadValues({id:x,pointList:h},i),{stroke:T,fill:"rgba(255, 255, 255, 0.6)"})}),K},[]),A=O[(v=n==null?void 0:n.path)!=null?v:""];A&&_.isNumber((N=n==null?void 0:n.calib)==null?void 0:N.groundHeight)&&F.forEach(d=>{const u=d.pointList.map(a=>{var C;return __spreadProps(__spreadValues({},a),{z:(C=n==null?void 0:n.calib)==null?void 0:C.groundHeight})}),m=lbAnnotation.pointListLidar2Img(u,n==null?void 0:n.calib,A);if(m){const a=lbUtils.toolStyleConverter.getColorFromConfig({attribute:d.attribute},__spreadProps(__spreadValues({},l),{attributeConfigurable:!0}),{});V.push({type:"polygon",annotation:__spreadProps(__spreadValues({id:d.id,pointList:m},i),{stroke:a==null?void 0:a.stroke,fill:S.includes(d.id)?a==null?void 0:a.fill:"rgba(255, 255, 255, 0.6)"})})}}),r.push({annotations:V,url:n==null?void 0:n.url,calName:(R=n==null?void 0:n.calib)==null?void 0:R.calName,calib:n==null?void 0:n.calib,path:n==null?void 0:n.path})}),H(r)}},[q,e==null?void 0:e.mappingImgList,x,f,p,F,O,S]),React.useEffect(()=>(window.addEventListener("keydown",k),()=>{window.removeEventListener("keydown",k)}),[s]);const k=o=>{const{keyCode:i}=o;switch(i){case EKeyCode.Esc:y&&P(!1);break;case EKeyCode.Left:I();break;case EKeyCode.Right:j();break}},I=()=>{s===void 0||!y||Number(s)>0&&E(s-1)},j=()=>{s===void 0||!y||Number(s)<(c==null?void 0:c.length)-1&&E(s+1)},$=({viewDataPointList:o,pointCloudBox:i,defaultViewStyle:r,stroke:n})=>o?o.map(v=>({type:v.type,annotation:__spreadProps(__spreadValues({id:i.id,pointList:v.pointList},r),{stroke:n})})):[],G=!e||!(e==null?void 0:e.mappingImgList)||!(((L=e==null?void 0:e.mappingImgList)==null?void 0:L.length)>0),J=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:()=>I()}),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:()=>j()}),React__default.default.createElement("img",{src:icon_esc,style:{height:"24px",margin:"0px 8px 0px 12px",cursor:"pointer"},onClick:()=>{P(!1),E(void 0)}}),React__default.default.createElement("span",null,"\u952E\u9000\u51FA"));return(c==null?void 0:c.length)>0?React__default.default.createElement(React__default.default.Fragment,null,c.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:g,data:o,setIsEnlarge:P,setCurIndex:E,curIndex:s,index:i,annotations2d:c}),titleOnSurface:!r,style:{display:G?"none":"flex",width:r?"100%":t},key:i,toolbar:J},(o==null?void 0:o.annotations)&&(o==null?void 0:o.url)&&React__default.default.createElement(PointCloud2DSingleView,{currentData:e,view2dData:o,setSelectedID:U,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
+ "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";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(n){return n&&typeof n=="object"&&"default"in n?n:{default:n}}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=(n,e,i)=>e in n?__defProp(n,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[e]=i,__spreadValues=(n,e)=>{for(var i in e||(e={}))__hasOwnProp.call(e,i)&&__defNormalProp(n,i,e[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(e))__propIsEnum.call(e,i)&&__defNormalProp(n,i,e[i]);return n},__spreadProps=(n,e)=>__defProps(n,__getOwnPropDescs(e)),__async=(n,e,i)=>new Promise((h,C)=>{var I=P=>{try{f(i.next(P))}catch(s){C(s)}},_=P=>{try{f(i.throw(P))}catch(s){C(s)}},f=P=>P.done?h(P.value):Promise.resolve(P.value).then(I,_);f((i=i.apply(n,e)).next())});const PointCloudContext=React__default.default.createContext({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:()=>{},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:n=>{},imageSizes:{},cacheImageNodeSize:()=>{}}),PointCloudProvider=({children:n})=>{const[e,i]=React.useState([]),[h,C]=React.useState([]),[I,_]=React.useState([]),[f,P]=React.useState([]),[s,A]=React.useState([]),[m,x]=React.useState([]),[R,$]=React.useState(!0),[j,tt]=React.useState(!0),[z,et]=React.useState(1),[a,N]=React.useState(),[q,M]=React.useState(),[G,T]=React.useState(),[l,F]=React.useState(),[Z,ot]=React.useState(""),[V,nt]=React.useState(lbAnnotation.EToolName.Rect),it=React.useRef(new lbAnnotation.ActionsHistory).current,[c,B]=React.useState([]),[k,st]=React.useState(""),[O,lt]=React.useState(lbUtils.EPointCloudPattern.Detection),[S,U]=React.useState(void 0),[H,rt]=React.useState([]),[E,at]=React.useState([]),p=index(),[J,ut]=React.useState({}),dt=ctx.useDispatch(),ct=r=>{const{imgNode:u,path:d}=r;d&&u&&ut(g=>__spreadProps(__spreadValues({},g),{[d]:{width:u.width,height:u.height}}))},K=React.useMemo(()=>s.length===1?s[0]:"",[s]),D=React.useMemo(()=>{const r=e.find(t=>t.id===K),u=t=>{const o=e.concat(t);return i(o),o},d=t=>{const o=h.concat(t);return C(o),o},g=t=>{$(t!==!1)},v=t=>{t===void 0&&A([]),typeof t=="string"&&A([t]),Array.isArray(t)&&A(Array.from(new Set(t)))},vt=t=>{s.includes(t)?v(s.filter(o=>o!==t)):v([...s,t])},Pt=t=>{m.includes(t)?x([]):x([t])},gt=()=>{if(V===lbAnnotation.EToolName.Rect){const t=e.map(o=>o.id);v(t),a==null||a.pointCloud2dOperation.setSelectedIDs(t)}},ft=t=>{v(e.filter(o=>o.attribute===t).map(o=>o.id))},Q=e.filter(t=>!c.includes(t.attribute)),W=h.filter(t=>!c.includes(t.attribute)),X=f.filter(t=>t.attribute&&!c.includes(t.attribute)),ht=t=>{if(c.includes(t))B(c.filter(o=>o!==t));else{const o=c.concat(t);B(o)}},St=(t=Q,o=I,y=W,w=X,L=H)=>{var b;l==null||l.clearAllBox(),l==null||l.clearAllSphere(),a==null||a.updatePolygonList(t,o),a==null||a.updatePointList(y),a==null||a.updateLineList(w),l==null||l.generateBoxes(t),l==null||l.generateSpheres(y),(b=S==null?void 0:S.store)==null||b.updateCurrentSegment(L),Y(t)},bt=()=>{N(void 0),M(void 0),T(void 0),F(void 0)},Y=(t,o)=>__async(void 0,null,function*(){var y;if(!l)return;const w=l.pointCloudObject;if(!!w)try{const L=yield l.getHighlightIndexByMappingImgList({mappingImgList:o!=null?o:E,points:w.geometry.attributes.position.array}),b=yield l==null?void 0:l.highlightOriginPointCloud(t,L);return b&&((y=a==null?void 0:a.pointCloudInstance)==null||y.updateColor(b)),b}catch(L){console.error(L)}});return{selectedID:K,pointCloudBoxList:e,pointCloudSphereList:h,displayPointCloudList:Q,displaySphereList:W,displayLineList:X,selectedIDs:s,setPointCloudResult:i,setSelectedIDs:v,addPointCloudBox:u,addPointCloudSphere:d,setPointCloudSphereList:C,valid:R,selectedPointCloudBox:r,setPointCloudValid:g,addSelectedID:vt,addHighlightID:Pt,selectedAllBoxes:gt,topViewInstance:a,setTopViewInstance:N,sideViewInstance:q,setSideViewInstance:M,backViewInstance:G,setBackViewInstance:T,mainViewInstance:l,setMainViewInstance:F,polygonList:I,setPolygonList:_,lineList:f,setLineList:P,zoom:z,setZoom:et,history:it,toggleAttributesVisible:ht,hideAttributes:c,setHideAttributes:B,reRender:St,attrPanelLayout:k,setAttrPanelLayout:st,syncAllViewPointCloudColor:Y,defaultAttribute:Z,setDefaultAttribute:ot,pointCloudPattern:V,setPointCloudPattern:nt,selectSpecAttr:ft,globalPattern:O,setGlobalPattern:t=>{O!==t&&(dt(actionCreators.ChangeSave),lt(t),t===lbUtils.EPointCloudPattern.Detection&&U(void 0))},ptSegmentInstance:S,setPtSegmentInstance:U,segmentation:H,setSegmentation:rt,clearAllDetectionInstance:bt,highlight2DDataList:E,setHighlight2DDataList:at,cuboidBoxIn2DView:j,setCuboidBoxIn2DView:tt,imageSizes:J,cacheImageNodeSize:ct,highlightIDs:m,setHighlightIDs:x}},[R,s,e,h,I,f,a,q,G,l,z,c,k,Z,V,O,S,H,E,j,J,m]);React.useEffect(()=>{var r,u,d;(r=p==null?void 0:p.setPointCloudBoxList)==null||r.call(p,e),(u=p==null?void 0:p.setHighlightIDs)==null||u.call(p,m),(d=p==null?void 0:p.setSelectedIDs)==null||d.call(p,s)},[e,s,m]),React.useEffect(()=>{var r;(r=p==null?void 0:p.setPtCtx)==null||r.call(p,D)},[D]);const pt=()=>{const r=e.filter(v=>c.includes(v.attribute)),{setSelectedIDs:u,reRender:d}=D,g=r.map(v=>v.id);g.length>0&&u(s.filter(v=>!g.includes(v))),d()};return React.useEffect(()=>{var r,u,d,g;pt(),(u=(r=a==null?void 0:a.toolInstance)==null?void 0:r.setHiddenAttributes)==null||u.call(r,c),(g=(d=S==null?void 0:S.store)==null?void 0:d.setHiddenAttributes)==null||g.call(d,c)},[c]),React__default.default.createElement(PointCloudContext.Provider,{value:D},n)};exports.PointCloudContext=PointCloudContext,exports.PointCloudProvider=PointCloudProvider;
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 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:o,setPointCloudResult:d,setPointCloudSphereList:P,setPolygonList:C,pointCloudPattern:a,setPointCloudPattern:e,syncAllViewPointCloudColor:v,globalPattern:n,setLineList:b}=React.useContext(PointCloudContext.PointCloudContext),{pushHistoryWithList:h}=useHistory.useHistory(),p=()=>{o==null||o.clearAllBox(),o==null||o.clearAllSphere(),o==null||o.render(),d([]),C([]),P([]),b([]),i==null||i.toolScheduler.clearStatusAndResult(),v([]),h({pointCloudBoxList:[],polygonList:[],pointCloudSphereList:[]})},l=()=>{r==null||r.toolInstance.clearResult(),u==null||u.toolInstance.clearResult()},y=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)}),e(EToolName.Rect);break;case EToolName.Polygon:l(),s.forEach(t=>{t==null||t.switchToCanvas(EToolName.PointCloudPolygon),t==null||t.toolInstance.setPattern(EPolygonPattern.Normal)}),e(EToolName.Polygon);break;case EToolName.Point:l(),s.forEach(t=>{t==null||t.switchToCanvas(EToolName.Point)}),e(EToolName.Point);break;case EToolName.Line:l(),s.forEach(t=>{t==null||t.switchToCanvas(EToolName.Line)}),e(EToolName.Line);break}},w=React.useMemo(()=>n===lbUtils.EPointCloudPattern.Detection,[n]),L=React.useMemo(()=>n===lbUtils.EPointCloudPattern.Segmentation,[n]);return{clearAllResult:p,updatePointCloudPattern:y,pointCloudPattern:a,isPointCloudDetectionPattern:w,isPointCloudSegmentationPattern:L}};exports.useStatus=useStatus;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),PointCloudContext=require("../PointCloudContext.js"),lbAnnotation=require("@labelbee/lb-annotation"),useHistory=require("./useHistory.js"),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(l){return l&&typeof l=="object"&&"default"in l?l:{default:l}}var React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames);const PointCloudView=l=>{const{currentData:i,imgList:g,drawLayerSlot:d,checkMode:n,intelligentFit:P,imgIndex:v,config:p,measureVisible:E}=l,e=React.useContext(PointCloudContext.PointCloudContext),{globalPattern:c,setGlobalPattern:L,selectedIDs:m}=e,x=ctx.useDispatch(),[a,C]=React.useState(!1),S=(m==null?void 0:m.length)>0&&a,q=index.jsonParser(i.result),{toolInstanceRef:o,clearToolInstance:b}=annotation.useCustomToolInstance({basicInfo:q});if(React.useEffect(()=>{o.current.setPointCloudGlobalPattern=t=>{t!==c&&(L(t),e.clearAllDetectionInstance(),b())}},[c]),React.useEffect(()=>{var t;if(actionCreators.SetLoadPCDFileLoading(x,!0),i){const{boxParamsList:r,polygonList:u,lineList:s,sphereParamsList:j,segmentation:w}=lbUtils.PointCloudUtils.parsePointCloudCurrentResult((t=i==null?void 0:i.result)!=null?t:"");e.setPointCloudResult(r),e.setPolygonList(u),e.setLineList(s),e.setPointCloudSphereList(j),e.setSegmentation(w)}},[v]),React.useEffect(()=>{o.current.exportData=()=>[e.pointCloudBoxList,{valid:e.valid}],o.current.exportCustomData=()=>{var t,r,u,s;return{resultPolygon:(t=e.polygonList)!=null?t:[],resultLine:(r=e.lineList)!=null?r:[],resultPoint:(u=e.pointCloudSphereList)!=null?u:[],segmentation:(s=e.segmentation)!=null?s:[]}}},[e.pointCloudBoxList,e.valid,e.polygonList,e.lineList,e.pointCloudSphereList,e.ptSegmentInstance,e.segmentation]),g.length===0)return null;if(c===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:p}),d==null?void 0:d({direct:!0}));let f=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 a&&(f=React__default.default.createElement(index$2,{selectAndEnlarge:S,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),f),React__default.default.createElement("div",{className:classNames__default.default({[dom.getClassName("point-cloud-container","right")]:!0,[dom.getClassName("point-cloud-container","rightZoom")]:a})},React__default.default.createElement(PointCloudTopView,{drawLayerSlot:d,checkMode:n,intelligentFit:P,setIsEnlargeTopView:C,onExitZoom:()=>{C(!1)},isEnlargeTopView:a}),React__default.default.createElement("div",{className:classNames__default.default({[dom.getClassName("point-cloud-container","right-bottom")]:!a,[dom.getClassName("point-cloud-container","right-bottom-floatLeft")]:a})},React__default.default.createElement(PointCloud2DView,{isEnlargeTopView:a,thumbnailWidth:a?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;
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;
@@ -24,5 +24,5 @@ interface IProps extends IA2MapStateProps {
24
24
  checkMode?: boolean;
25
25
  measureVisible?: boolean;
26
26
  }
27
- declare const _default: import("react-redux").ConnectedComponent<({ currentData, config, thumbnailWidth, isEnlargeTopView, highlightAttribute, loadPCDFileLoading, checkMode, measureVisible }: IProps) => React.JSX.Element | null, import("react-redux").Omit<IProps, "imgIndex" | "imgList" | "config" | "highlightAttribute" | "loadPCDFileLoading" | "stepInfo" | "currentData" | "configString">>;
27
+ declare const _default: import("react-redux").ConnectedComponent<({ currentData, config, thumbnailWidth, isEnlargeTopView, highlightAttribute, loadPCDFileLoading, checkMode, measureVisible, }: IProps) => React.JSX.Element | null, import("react-redux").Omit<IProps, "imgIndex" | "imgList" | "config" | "highlightAttribute" | "loadPCDFileLoading" | "stepInfo" | "currentData" | "configString">>;
28
28
  export default _default;
@@ -1,4 +1,4 @@
1
- import { IPointCloudBox, IPointCloudBoxList, IPolygonData, IPointCloudSphereList, IPointCloudSphere, ILine, EPointCloudPattern, IPointCloudSegmentation, ICalib, ISize } from '@labelbee/lb-utils';
1
+ import { IPointCloudBox, IPointCloudBoxList, IPolygonData, IPointCloudSphereList, IPointCloudSphere, ILine, EPointCloudPattern, IPointCloudSegmentation, ICalib, ISize, IPointCloudBoxRect, IPointCloud2DRectOperationViewRect } from '@labelbee/lb-utils';
2
2
  import React from 'react';
3
3
  import { PointCloud, PointCloudAnnotation, ActionsHistory, EToolName } from '@labelbee/lb-annotation';
4
4
  interface IPointCloudContextInstances {
@@ -26,6 +26,7 @@ interface IHighlight2DData {
26
26
  }
27
27
  export interface IPointCloudContext extends IPointCloudContextInstances, IPointCloudStatus, IPointCloudSegment {
28
28
  pointCloudBoxList: IPointCloudBoxList;
29
+ rectList: IPointCloudBoxRect[];
29
30
  pointCloudSphereList: IPointCloudSphereList;
30
31
  displayPointCloudList: IPointCloudBoxList;
31
32
  displaySphereList: IPointCloudSphereList;
@@ -47,6 +48,10 @@ export interface IPointCloudContext extends IPointCloudContextInstances, IPointC
47
48
  addPointCloudSphere: (sphereParams: IPointCloudSphere) => IPointCloudSphere[];
48
49
  polygonList: IPolygonData[];
49
50
  setPolygonList: (polygonList: IPolygonData[]) => void;
51
+ setRectList: (rectList: IPointCloudBoxRect[]) => void;
52
+ addRectIn2DView: (rect: IPointCloud2DRectOperationViewRect) => void;
53
+ removeRectIn2DView: (rects: IPointCloud2DRectOperationViewRect[]) => void;
54
+ updateRectIn2DView: (rect: IPointCloud2DRectOperationViewRect) => void;
50
55
  lineList: ILine[];
51
56
  setLineList: (lineList: ILine[]) => void;
52
57
  zoom: number;
@@ -1,4 +1,4 @@
1
- import { ICoordinate, IPointCloudBox, ISize } from '@labelbee/lb-utils';
1
+ import { IBasicRect, ICoordinate, IPointCloudBox, ISize } from '@labelbee/lb-utils';
2
2
  import { IMappingImg } from '@/types/data';
3
3
  export declare const jsonParser: (content: any, defaultValue?: any) => any;
4
4
  export declare const getNewNode: <T>(newNode: T, oldNode: T) => T;
@@ -11,6 +11,9 @@ export declare const getBoundingRect: (points: ICoordinate[]) => {
11
11
  width: number;
12
12
  height: number;
13
13
  };
14
+ export declare const isBoundingRectInImage: (boundingRect: Omit<IBasicRect, "id">, path: string, imageSizes: {
15
+ [key: string]: ISize;
16
+ }) => boolean;
14
17
  interface IGetRectPointCloudBoxParams {
15
18
  pointCloudBox: IPointCloudBox;
16
19
  mappingData: IMappingImg;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _=require("lodash"),lbAnnotation=require("@labelbee/lb-annotation");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var ___default=_interopDefaultLegacy(_),__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 jsonParser=(e,t={})=>{try{return typeof e=="string"?JSON.parse(e):___default.default.isObject(e)?e:t}catch(r){return t}},classnames=e=>{if(Array.isArray(e))return e.filter(t=>t).join(" ");if(___default.default.isObject(e)){const t=[];return Object.keys(e).forEach(r=>{e[r]&&t.push(r)}),t.join(" ")}return""},getBoundingRect=e=>{let t=Infinity,r=Infinity,n=-Infinity,o=-Infinity;for(const i of e)t=Math.min(t,i.x),r=Math.min(r,i.y),n=Math.max(n,i.x),o=Math.max(o,i.y);return{x:t,y:r,width:n-t,height:o-r}},isBoundingRectInImage=(()=>{const e=(t,r)=>{const n=Math.max(t.x,r.x),o=Math.max(t.y,r.y),i=Math.min(t.x+t.width,r.x+r.width),s=Math.min(t.y+t.height,r.y+r.height),a=i-n,u=s-o;return a>=0&&u>=0?{x:n,y:o,width:a,height:u}:null};return(t,r,n)=>{if(n[r]){const o=n[r].width,i=n[r].height;return e(t,{x:0,y:0,width:o,height:i})!==null}return!1}})(),getRectPointCloudBox=e=>{var t;const{pointCloudBox:r,mappingData:n,imageSizes:o}=e,{transferViewData:i}=(t=lbAnnotation.pointCloudLidar2image(r,n.calib))!=null?t:{};if(!i)return;const s=i.reduce((c,p)=>p.type==="line"?[...c,...p.pointList]:c,[]),a=__spreadProps(__spreadValues({},getBoundingRect(s)),{imageName:n.path});if(isBoundingRectInImage(a,n.path,o))return a};exports.classnames=classnames,exports.getBoundingRect=getBoundingRect,exports.getRectPointCloudBox=getRectPointCloudBox,exports.jsonParser=jsonParser;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _=require("lodash"),lbAnnotation=require("@labelbee/lb-annotation");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var ___default=_interopDefaultLegacy(_),__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));const jsonParser=(e,t={})=>{try{return typeof e=="string"?JSON.parse(e):___default.default.isObject(e)?e:t}catch(n){return t}},classnames=e=>{if(Array.isArray(e))return e.filter(t=>t).join(" ");if(___default.default.isObject(e)){const t=[];return Object.keys(e).forEach(n=>{e[n]&&t.push(n)}),t.join(" ")}return""},getBoundingRect=e=>{let t=Infinity,n=Infinity,r=-Infinity,o=-Infinity;for(const i of e)t=Math.min(t,i.x),n=Math.min(n,i.y),r=Math.max(r,i.x),o=Math.max(o,i.y);return{x:t,y:n,width:r-t,height:o-n}},isBoundingRectInImage=(()=>{const e=(t,n)=>{const r=Math.max(t.x,n.x),o=Math.max(t.y,n.y),i=Math.min(t.x+t.width,n.x+n.width),s=Math.min(t.y+t.height,n.y+n.height),a=i-r,u=s-o;return a>=0&&u>=0?{x:r,y:o,width:a,height:u}:null};return(t,n,r)=>{if(r[n]){const o=r[n].width,i=r[n].height;return e(t,{x:0,y:0,width:o,height:i})!==null}return!1}})(),getRectPointCloudBox=e=>{var t;const{pointCloudBox:n,mappingData:r,imageSizes:o}=e,{transferViewData:i}=(t=lbAnnotation.pointCloudLidar2image(n,r.calib))!=null?t:{};if(!i)return;const s=i.reduce((c,p)=>p.type==="line"?[...c,...p.pointList]:c,[]),a=__spreadProps(__spreadValues({},getBoundingRect(s)),{imageName:r.path});if(isBoundingRectInImage(a,r.path,o))return a};exports.classnames=classnames,exports.getBoundingRect=getBoundingRect,exports.getRectPointCloudBox=getRectPointCloudBox,exports.isBoundingRectInImage=isBoundingRectInImage,exports.jsonParser=jsonParser;
@@ -1 +1 @@
1
- import{useLatest as B}from"ahooks";import{Spin as M}from"antd/es";import d,{useContext as N,useRef as w,useState as U,useEffect as u}from"react";import{connect as F}from"react-redux";import{usePointCloudViews as T}from"../pointCloudView/hooks/usePointCloudViews.js";import{PointCloudContext as $}from"../pointCloudView/PointCloudContext.js";import{a2MapStateToProps as q}from"../../store/annotation/map.js";import{LabelBeeContext as A}from"../../store/ctx.js";import{PointCloud2DRectOperation as G,ImgUtils as H}from"@labelbee/lb-annotation";var J=Object.defineProperty,K=Object.defineProperties,Q=Object.getOwnPropertyDescriptors,C=Object.getOwnPropertySymbols,W=Object.prototype.hasOwnProperty,X=Object.prototype.propertyIsEnumerable,O=(o,e,t)=>e in o?J(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,f=(o,e)=>{for(var t in e||(e={}))W.call(e,t)&&O(o,t,e[t]);if(C)for(var t of C(e))X.call(e,t)&&O(o,t,e[t]);return o},R=(o,e)=>K(o,Q(e));const Y=o=>{var e;const{mappingData:t,size:l,config:b,checkMode:D,afterImgOnLoad:h}=o,s=(e=t==null?void 0:t.url)!=null?e:"",{pointCloudBoxList:c,setPointCloudResult:x}=N($),{update2DViewRect:y}=T(),p=d.useRef(null),n=w(null),m=B(y),_=w(null),[I,V]=U(!0),v=r=>{var a;const i=(a=m.current)==null?void 0:a.call(m,r);_.current=i,x(i)},j=()=>{var r;let a=[];c.forEach(i=>{const{rects:S=[],id:P,attribute:E,trackID:L}=i,g=S.find(z=>z.imageName===(t==null?void 0:t.path)),k=P+"_"+(t==null?void 0:t.path);g&&(a=[...a,R(f({},g),{boxID:P,id:k,attribute:E,order:L})])}),(r=n.current)==null||r.setResult(a)};return u(()=>{if(p.current){const r=new G({container:p.current,size:l,config:R(f({},b),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:D});return n.current=r,n.current.init(),n.current.on("updateDragResult",v),()=>{var a,i;(a=n.current)==null||a.unbind("updateDragResult",v),(i=n.current)==null||i.destroy()}}},[]),u(()=>{n.current&&s&&H.load(s).then(r=>{n.current.setImgNode(r),h(r),V(!1)})},[s]),u(()=>{var r;(r=n.current)==null||r.setSize(l)},[l]),u(()=>{c!==_.current&&j()},[c,s]),d.createElement(M,{spinning:I},d.createElement("div",{ref:p,style:f({position:"relative"},l)}))};var Z=F(q,null,null,{context:A})(Y);export{Z as default};
1
+ import{useLatest as V}from"ahooks";import{Spin as H}from"antd/es";import R,{useContext as J,useRef as y,useState as K,useMemo as Q,useCallback as W,useEffect as u}from"react";import{connect as X}from"react-redux";import{usePointCloudViews as Y}from"../pointCloudView/hooks/usePointCloudViews.js";import{PointCloudContext as Z}from"../pointCloudView/PointCloudContext.js";import{a2MapStateToProps as ee}from"../../store/annotation/map.js";import{LabelBeeContext as te}from"../../store/ctx.js";import{PointCloud2DRectOperation as re,ImgUtils as ne}from"@labelbee/lb-annotation";var oe=Object.defineProperty,ie=Object.defineProperties,ae=Object.getOwnPropertyDescriptors,S=Object.getOwnPropertySymbols,le=Object.prototype.hasOwnProperty,ce=Object.prototype.propertyIsEnumerable,j=(i,r,t)=>r in i?oe(i,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[r]=t,f=(i,r)=>{for(var t in r||(r={}))le.call(r,t)&&j(i,t,r[t]);if(S)for(var t of S(r))ce.call(r,t)&&j(i,t,r[t]);return i},g=(i,r)=>ie(i,ae(r));const ue=i=>{var r;const{mappingData:t,size:s,config:B,checkMode:E,afterImgOnLoad:A}=i,m=(r=t==null?void 0:t.url)!=null?r:"",{pointCloudBoxList:d,setPointCloudResult:N,defaultAttribute:D,rectList:v,addRectIn2DView:k,updateRectIn2DView:M,removeRectIn2DView:z}=J(Z),{update2DViewRect:U}=Y(),_=R.useRef(null),n=y(null),w=V(U),P=y(null),[F,b]=K(!0),C=Q(()=>v==null?void 0:v.filter(e=>e.imageName===(t==null?void 0:t.path)),[t==null?void 0:t.path,v]),p=V(t==null?void 0:t.path),I=e=>{var o;const{boxID:l}=e;if(l){const a=(o=w.current)==null?void 0:o.call(w,e);P.current=a,N(a);return}M(e)},O=e=>{p.current&&k(g(f({},e),{imageName:p.current}))},h=e=>{z(e)},T=W(()=>{let e=[];return d.forEach(o=>{const{rects:l=[],id:a,attribute:c,trackID:$}=o,L=l.find(G=>G.imageName===p.current),q=a+"_"+p.current;L&&(e=[...e,g(f({},L),{boxID:a,id:q,attribute:c,order:$})])}),e},[d]),x=()=>{var e,o,l;const a=T(),c=(e=n.current)==null?void 0:e.selectedRectID;(o=n.current)==null||o.setResult([...a,...C]),c&&((l=n.current)==null||l.setSelectedRectID(c))};return u(()=>{if(_.current){const e=new re({container:_.current,size:s,config:g(f({},B),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:E});return n.current=e,n.current.init(),n.current.on("updateDragResult",I),n.current.on("afterAddingDrawingRect",O),n.current.on("deleteSelectedRects",h),()=>{var o,l,a,c;(o=n.current)==null||o.unbind("updateDragResult",I),(l=n.current)==null||l.unbind("afterAddingDrawingRect",O),(a=n.current)==null||a.unbind("deleteSelectedRects",h),(c=n.current)==null||c.destroy()}}},[]),u(()=>{b(!0),n.current&&m&&ne.load(m).then(e=>{n.current.setImgNode(e),A(e),b(!1)})},[m]),u(()=>{var e;(e=n.current)==null||e.setSize(s)},[s]),u(()=>{d!==P.current&&x()},[d]),u(()=>{var e,o;(o=(e=n.current)==null?void 0:e.setDefaultAttribute)==null||o.call(e,D)},[D]),u(()=>{x()},[C]),R.createElement(H,{spinning:F},R.createElement("div",{ref:_,style:f({position:"relative"},s)}))};var se=X(ee,null,null,{context:te})(ue);export{se as default};
@@ -1 +1 @@
1
- import{getClassName as J}from"../../utils/dom.js";import i,{useState as L,useContext as ie,useEffect as Q}from"react";import{PointCloudContainer as le}from"./PointCloudLayout.js";import{PointCloudContext as re}from"./PointCloudContext.js";import{connect as se}from"react-redux";import{cKeyCode as ae,pointCloudLidar2image as ue,pointListLidar2Img as ce}from"@labelbee/lb-annotation";import{LabelBeeContext as de}from"../../store/ctx.js";import{a2MapStateToProps as me}from"../../store/annotation/map.js";import{toolStyleConverter as U}from"@labelbee/lb-utils";import fe from"./PointCloud2DSingleView.js";import W from"./components/TitleButton/index.js";import{LeftOutlined as pe}from"@ant-design/icons";import ge from"classnames";import ve from"../../assets/annotation/common/icon_esc.svg.js";import be from"../../assets/annotation/common/icon_left_squareOutlined.svg.js";import ye from"../../assets/annotation/common/icon_right_squareOutlined.svg.js";import{isNumber as Ee}from"lodash";var _e=Object.defineProperty,he=Object.defineProperties,we=Object.getOwnPropertyDescriptors,X=Object.getOwnPropertySymbols,Ce=Object.prototype.hasOwnProperty,Pe=Object.prototype.propertyIsEnumerable,Y=(e,n,t)=>n in e?_e(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,f=(e,n)=>{for(var t in n||(n={}))Ce.call(n,t)&&Y(e,t,n[t]);if(X)for(var t of X(n))Pe.call(n,t)&&Y(e,t,n[t]);return e},p=(e,n)=>he(e,we(n));const I=ae.default,Le=({showEnlarge:e,isEnlargeTopView:n,data:t,setIsEnlarge:y,setCurIndex:g,curIndex:E=0,index:x,annotations2d:_})=>n?i.createElement(W,{title:t==null?void 0:t.calName,style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}):e?i.createElement("div",{style:{display:"flex",alignItems:"center"}},i.createElement(pe,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{y(!1),g(void 0)}}),i.createElement("span",null,t==null?void 0:t.calName),i.createElement("span",{style:{marginLeft:"8px"}},E+1,"/",_==null?void 0:_.length)):i.createElement(W,{title:t==null?void 0:t.calName,onClick:()=>{y(!0),g(x)},style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}),xe=({currentData:e,config:n,thumbnailWidth:t,isEnlargeTopView:y,highlightAttribute:g,loadPCDFileLoading:E,checkMode:x,measureVisible:_})=>{var O;const[d,Z]=L([]),{topViewInstance:B,displayPointCloudList:j,polygonList:S,imageSizes:N,selectedIDs:V}=ie(re),[F,D]=L(""),[h,k]=L(!1),[a,w]=L(void 0);Q(()=>{var l;if(!E&&B&&(e==null?void 0:e.mappingImgList)&&((l=e==null?void 0:e.mappingImgList)==null?void 0:l.length)>0){const r={fill:"transparent",color:"green"};let s=[];e==null||e.mappingImgList.forEach(o=>{var v,T,K;const $=j.reduce((m,c)=>{var b,u;const C=c.id===F||g===c.attribute,{transferViewData:H,viewRangePointList:P}=(b=ue(c,o.calib,{createRange:C}))!=null?b:{};if(!H||!P)return[];const M=(u=U.getColorFromConfig({attribute:c.attribute},p(f({},n),{attributeConfigurable:!0}),{}))==null?void 0:u.stroke,ne=ee({viewDataPointList:H,pointCloudBox:c,defaultViewStyle:r,stroke:M}),G=[...m,...ne];return(P==null?void 0:P.length)>0&&G.unshift({type:"polygon",annotation:p(f({id:F,pointList:P},r),{stroke:M,fill:"rgba(255, 255, 255, 0.6)"})}),G},[]),q=N[(v=o==null?void 0:o.path)!=null?v:""];q&&Ee((T=o==null?void 0:o.calib)==null?void 0:T.groundHeight)&&S.forEach(m=>{const c=m.pointList.map(u=>{var C;return p(f({},u),{z:(C=o==null?void 0:o.calib)==null?void 0:C.groundHeight})}),b=ce(c,o==null?void 0:o.calib,q);if(b){const u=U.getColorFromConfig({attribute:m.attribute},p(f({},n),{attributeConfigurable:!0}),{});$.push({type:"polygon",annotation:p(f({id:m.id,pointList:b},r),{stroke:u==null?void 0:u.stroke,fill:V.includes(m.id)?u==null?void 0:u.fill:"rgba(255, 255, 255, 0.6)"})})}}),s.push({annotations:$,url:o==null?void 0:o.url,calName:(K=o==null?void 0:o.calib)==null?void 0:K.calName,calib:o==null?void 0:o.calib,path:o==null?void 0:o.path})}),Z(s)}},[j,e==null?void 0:e.mappingImgList,F,g,E,S,N,V]),Q(()=>(window.addEventListener("keydown",R),()=>{window.removeEventListener("keydown",R)}),[a]);const R=l=>{const{keyCode:r}=l;switch(r){case I.Esc:h&&k(!1);break;case I.Left:A();break;case I.Right:z();break}},A=()=>{a===void 0||!h||Number(a)>0&&w(a-1)},z=()=>{a===void 0||!h||Number(a)<(d==null?void 0:d.length)-1&&w(a+1)},ee=({viewDataPointList:l,pointCloudBox:r,defaultViewStyle:s,stroke:o})=>l?l.map(v=>({type:v.type,annotation:p(f({id:r.id,pointList:v.pointList},s),{stroke:o})})):[],te=!e||!(e==null?void 0:e.mappingImgList)||!(((O=e==null?void 0:e.mappingImgList)==null?void 0:O.length)>0),oe=i.createElement("div",{style:{display:"flex",alignItems:"center",fontSize:"14px"}},i.createElement("img",{src:be,style:{height:"24px",marginRight:"8px",cursor:"pointer"},onClick:()=>A()}),i.createElement("span",{style:{marginRight:"12px"}},"\u952E\u76D8\u5DE6\u952E\u4E0A\u4E00\u5F20"),i.createElement("span",{style:{margin:"0px 8px 0px 12px"}},"\u952E\u76D8\u53F3\u952E\u4E0A\u4E00\u5F20"),i.createElement("img",{src:ye,style:{height:"24px",marginRight:"12px",cursor:"pointer"},onClick:()=>z()}),i.createElement("img",{src:ve,style:{height:"24px",margin:"0px 8px 0px 12px",cursor:"pointer"},onClick:()=>{k(!1),w(void 0)}}),i.createElement("span",null,"\u952E\u9000\u51FA"));return(d==null?void 0:d.length)>0?i.createElement(i.Fragment,null,d.map((l,r)=>{const s=h&&r===a;return i.createElement(le,{className:ge({[J("point-cloud-2d-container")]:!0,[J("point-cloud-container","zoom")]:s}),title:i.createElement(Le,{showEnlarge:s,isEnlargeTopView:y,data:l,setIsEnlarge:k,setCurIndex:w,curIndex:a,index:r,annotations2d:d}),titleOnSurface:!s,style:{display:te?"none":"flex",width:s?"100%":t},key:r,toolbar:oe},(l==null?void 0:l.annotations)&&(l==null?void 0:l.url)&&i.createElement(fe,{currentData:e,view2dData:l,setSelectedID:D,showEnlarge:s,checkMode:x,measureVisible:_}))})):null};var Fe=se(me,null,null,{context:de})(xe);export{Fe as default};
1
+ import{getClassName as Q}from"../../utils/dom.js";import i,{useState as L,useContext as ue,useEffect as U}from"react";import{PointCloudContainer as ae}from"./PointCloudLayout.js";import{PointCloudContext as ce}from"./PointCloudContext.js";import{connect as de}from"react-redux";import{cKeyCode as me,pointCloudLidar2image as fe,pointListLidar2Img as pe}from"@labelbee/lb-annotation";import{LabelBeeContext as ge}from"../../store/ctx.js";import{a2MapStateToProps as ve}from"../../store/annotation/map.js";import{toolStyleConverter as W}from"@labelbee/lb-utils";import be from"./PointCloud2DSingleView.js";import X from"./components/TitleButton/index.js";import{LeftOutlined as ye}from"@ant-design/icons";import Ee from"classnames";import he from"../../assets/annotation/common/icon_esc.svg.js";import _e from"../../assets/annotation/common/icon_left_squareOutlined.svg.js";import we from"../../assets/annotation/common/icon_right_squareOutlined.svg.js";import{isNumber as Ce}from"lodash";import{getBoundingRect as Pe,isBoundingRectInImage as Le}from"../../utils/index.js";var xe=Object.defineProperty,Ie=Object.defineProperties,Fe=Object.getOwnPropertyDescriptors,Y=Object.getOwnPropertySymbols,ke=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,Z=(e,n,o)=>n in e?xe(e,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[n]=o,m=(e,n)=>{for(var o in n||(n={}))ke.call(n,o)&&Z(e,o,n[o]);if(Y)for(var o of Y(n))Oe.call(n,o)&&Z(e,o,n[o]);return e},f=(e,n)=>Ie(e,Fe(n));const j=me.default,je=({showEnlarge:e,isEnlargeTopView:n,data:o,setIsEnlarge:y,setCurIndex:g,curIndex:E=0,index:x,annotations2d:h})=>n?i.createElement(X,{title:o==null?void 0:o.calName,style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}):e?i.createElement("div",{style:{display:"flex",alignItems:"center"}},i.createElement(ye,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{y(!1),g(void 0)}}),i.createElement("span",null,o==null?void 0:o.calName),i.createElement("span",{style:{marginLeft:"8px"}},E+1,"/",h==null?void 0:h.length)):i.createElement(X,{title:o==null?void 0:o.calName,onClick:()=>{y(!0),g(x)},style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}),Ne=({currentData:e,config:n,thumbnailWidth:o,isEnlargeTopView:y,highlightAttribute:g,loadPCDFileLoading:E,checkMode:x,measureVisible:h})=>{var N;const[p,D]=L([]),{topViewInstance:ee,displayPointCloudList:R,polygonList:S,imageSizes:I,selectedIDs:V}=ue(ce),[F,te]=L(""),[_,k]=L(!1),[u,w]=L(void 0);U(()=>{var l;if(!E&&ee&&(e==null?void 0:e.mappingImgList)&&((l=e==null?void 0:e.mappingImgList)==null?void 0:l.length)>0){const r={fill:"transparent",color:"green"};let s=[];e==null||e.mappingImgList.forEach(t=>{var v,K,$;const q=R.reduce((c,d)=>{var b,a;const C=d.id===F||g===d.attribute,{transferViewData:O,viewRangePointList:P}=(b=fe(d,t.calib,{createRange:C}))!=null?b:{};if(!O||!P)return[];const le=O.reduce((G,J)=>J.type==="line"?[...G,...J.pointList]:G,[]),re=f(m({},Pe(le)),{imageName:t.path});if(!Le(re,t.path,I))return c;const B=(a=W.getColorFromConfig({attribute:d.attribute},f(m({},n),{attributeConfigurable:!0}),{}))==null?void 0:a.stroke,se=oe({viewDataPointList:O,pointCloudBox:d,defaultViewStyle:r,stroke:B}),M=[...c,...se];return(P==null?void 0:P.length)>0&&M.unshift({type:"polygon",annotation:f(m({id:F,pointList:P},r),{stroke:B,fill:"rgba(255, 255, 255, 0.6)"})}),M},[]),H=I[(v=t==null?void 0:t.path)!=null?v:""];H&&Ce((K=t==null?void 0:t.calib)==null?void 0:K.groundHeight)&&S.forEach(c=>{const d=c.pointList.map(a=>{var C;return f(m({},a),{z:(C=t==null?void 0:t.calib)==null?void 0:C.groundHeight})}),b=pe(d,t==null?void 0:t.calib,H);if(b){const a=W.getColorFromConfig({attribute:c.attribute},f(m({},n),{attributeConfigurable:!0}),{});q.push({type:"polygon",annotation:f(m({id:c.id,pointList:b},r),{stroke:a==null?void 0:a.stroke,fill:V.includes(c.id)?a==null?void 0:a.fill:"rgba(255, 255, 255, 0.6)"})})}}),s.push({annotations:q,url:t==null?void 0:t.url,calName:($=t==null?void 0:t.calib)==null?void 0:$.calName,calib:t==null?void 0:t.calib,path:t==null?void 0:t.path})}),D(s)}},[R,e==null?void 0:e.mappingImgList,F,g,E,S,I,V]),U(()=>(window.addEventListener("keydown",A),()=>{window.removeEventListener("keydown",A)}),[u]);const A=l=>{const{keyCode:r}=l;switch(r){case j.Esc:_&&k(!1);break;case j.Left:z();break;case j.Right:T();break}},z=()=>{u===void 0||!_||Number(u)>0&&w(u-1)},T=()=>{u===void 0||!_||Number(u)<(p==null?void 0:p.length)-1&&w(u+1)},oe=({viewDataPointList:l,pointCloudBox:r,defaultViewStyle:s,stroke:t})=>l?l.map(v=>({type:v.type,annotation:f(m({id:r.id,pointList:v.pointList},s),{stroke:t})})):[],ne=!e||!(e==null?void 0:e.mappingImgList)||!(((N=e==null?void 0:e.mappingImgList)==null?void 0:N.length)>0),ie=i.createElement("div",{style:{display:"flex",alignItems:"center",fontSize:"14px"}},i.createElement("img",{src:_e,style:{height:"24px",marginRight:"8px",cursor:"pointer"},onClick:()=>z()}),i.createElement("span",{style:{marginRight:"12px"}},"\u952E\u76D8\u5DE6\u952E\u4E0A\u4E00\u5F20"),i.createElement("span",{style:{margin:"0px 8px 0px 12px"}},"\u952E\u76D8\u53F3\u952E\u4E0A\u4E00\u5F20"),i.createElement("img",{src:we,style:{height:"24px",marginRight:"12px",cursor:"pointer"},onClick:()=>T()}),i.createElement("img",{src:he,style:{height:"24px",margin:"0px 8px 0px 12px",cursor:"pointer"},onClick:()=>{k(!1),w(void 0)}}),i.createElement("span",null,"\u952E\u9000\u51FA"));return(p==null?void 0:p.length)>0?i.createElement(i.Fragment,null,p.map((l,r)=>{const s=_&&r===u;return i.createElement(ae,{className:Ee({[Q("point-cloud-2d-container")]:!0,[Q("point-cloud-container","zoom")]:s}),title:i.createElement(je,{showEnlarge:s,isEnlargeTopView:y,data:l,setIsEnlarge:k,setCurIndex:w,curIndex:u,index:r,annotations2d:p}),titleOnSurface:!s,style:{display:ne?"none":"flex",width:s?"100%":o},key:r,toolbar:ie},(l==null?void 0:l.annotations)&&(l==null?void 0:l.url)&&i.createElement(be,{currentData:e,view2dData:l,setSelectedID:te,showEnlarge:s,checkMode:x,measureVisible:h}))})):null};var Re=de(ve,null,null,{context:ge})(Ne);export{Re as default};
@@ -1 +1 @@
1
- import{EPointCloudPattern as z}from"@labelbee/lb-utils";import nt,{useState as n,useRef as Vt,useMemo as it,useEffect as E}from"react";import{ActionsHistory as st,EToolName as G}from"@labelbee/lb-annotation";import{useDispatch as Bt}from"../../store/ctx.js";import{ChangeSave as Ot}from"../../store/annotation/actionCreators.js";import Ht from"../../store/annotatedBox/index.js";var Rt=Object.defineProperty,jt=Object.defineProperties,zt=Object.getOwnPropertyDescriptors,lt=Object.getOwnPropertySymbols,Et=Object.prototype.hasOwnProperty,Gt=Object.prototype.propertyIsEnumerable,rt=(a,e,i)=>e in a?Rt(a,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[e]=i,Nt=(a,e)=>{for(var i in e||(e={}))Et.call(e,i)&&rt(a,i,e[i]);if(lt)for(var i of lt(e))Gt.call(e,i)&&rt(a,i,e[i]);return a},Ft=(a,e)=>jt(a,zt(e)),Mt=(a,e,i)=>new Promise((m,C)=>{var S=v=>{try{f(i.next(v))}catch(s){C(s)}},_=v=>{try{f(i.throw(v))}catch(s){C(s)}},f=v=>v.done?m(v.value):Promise.resolve(v.value).then(S,_);f((i=i.apply(a,e)).next())});const at=nt.createContext({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:()=>{},setLineList:()=>{},zoom:1,setZoom:()=>{},history:new st,hideAttributes:[],setHideAttributes:()=>{},toggleAttributesVisible:()=>{},reRender:()=>{},setAttrPanelLayout:()=>{},attrPanelLayout:"",syncAllViewPointCloudColor:()=>Promise.resolve(),defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:G.Rect,setPointCloudPattern:()=>{},selectSpecAttr:()=>{},globalPattern:z.Detection,setGlobalPattern:()=>{},setPtSegmentInstance:()=>{},segmentation:[],setSegmentation:()=>{},clearAllDetectionInstance:()=>{},highlight2DDataList:[],setHighlight2DDataList:()=>{},cuboidBoxIn2DView:!0,setCuboidBoxIn2DView:a=>{},imageSizes:{},cacheImageNodeSize:()=>{}}),Tt=({children:a})=>{const[e,i]=n([]),[m,C]=n([]),[S,_]=n([]),[f,v]=n([]),[s,x]=n([]),[y,V]=n([]),[N,dt]=n(!0),[F,ct]=n(!0),[M,ut]=n(1),[d,T]=n(),[Z,k]=n(),[q,J]=n(),[l,K]=n(),[Q,pt]=n(""),[B,gt]=n(G.Rect),ht=Vt(new st).current,[p,O]=n([]),[U,vt]=n(""),[H,Pt]=n(z.Detection),[b,W]=n(void 0),[R,ft]=n([]),[j,mt]=n([]),g=Ht(),[X,bt]=n({}),It=Bt(),Ct=r=>{const{imgNode:c,path:u}=r;u&&c&&bt(P=>Ft(Nt({},P),{[u]:{width:c.width,height:c.height}}))},Y=it(()=>s.length===1?s[0]:"",[s]),w=it(()=>{const r=e.find(t=>t.id===Y),c=t=>{const o=e.concat(t);return i(o),o},u=t=>{const o=m.concat(t);return C(o),o},P=t=>{dt(t!==!1)},h=t=>{t===void 0&&x([]),typeof t=="string"&&x([t]),Array.isArray(t)&&x(Array.from(new Set(t)))},yt=t=>{s.includes(t)?h(s.filter(o=>o!==t)):h([...s,t])},Lt=t=>{y.includes(t)?V([]):V([t])},Dt=()=>{if(B===G.Rect){const t=e.map(o=>o.id);h(t),d==null||d.pointCloud2dOperation.setSelectedIDs(t)}},wt=t=>{h(e.filter(o=>o.attribute===t).map(o=>o.id))},$=e.filter(t=>!p.includes(t.attribute)),tt=m.filter(t=>!p.includes(t.attribute)),et=f.filter(t=>t.attribute&&!p.includes(t.attribute)),At=t=>{if(p.includes(t))O(p.filter(o=>o!==t));else{const o=p.concat(t);O(o)}},_t=(t=$,o=S,L=tt,A=et,D=R)=>{var I;l==null||l.clearAllBox(),l==null||l.clearAllSphere(),d==null||d.updatePolygonList(t,o),d==null||d.updatePointList(L),d==null||d.updateLineList(A),l==null||l.generateBoxes(t),l==null||l.generateSpheres(L),(I=b==null?void 0:b.store)==null||I.updateCurrentSegment(D),ot(t)},xt=()=>{T(void 0),k(void 0),J(void 0),K(void 0)},ot=(t,o)=>Mt(void 0,null,function*(){var L;if(!l)return;const A=l.pointCloudObject;if(!!A)try{const D=yield l.getHighlightIndexByMappingImgList({mappingImgList:o!=null?o:j,points:A.geometry.attributes.position.array}),I=yield l==null?void 0:l.highlightOriginPointCloud(t,D);return I&&((L=d==null?void 0:d.pointCloudInstance)==null||L.updateColor(I)),I}catch(D){console.error(D)}});return{selectedID:Y,pointCloudBoxList:e,pointCloudSphereList:m,displayPointCloudList:$,displaySphereList:tt,displayLineList:et,selectedIDs:s,setPointCloudResult:i,setSelectedIDs:h,addPointCloudBox:c,addPointCloudSphere:u,setPointCloudSphereList:C,valid:N,selectedPointCloudBox:r,setPointCloudValid:P,addSelectedID:yt,addHighlightID:Lt,selectedAllBoxes:Dt,topViewInstance:d,setTopViewInstance:T,sideViewInstance:Z,setSideViewInstance:k,backViewInstance:q,setBackViewInstance:J,mainViewInstance:l,setMainViewInstance:K,polygonList:S,setPolygonList:_,lineList:f,setLineList:v,zoom:M,setZoom:ut,history:ht,toggleAttributesVisible:At,hideAttributes:p,setHideAttributes:O,reRender:_t,attrPanelLayout:U,setAttrPanelLayout:vt,syncAllViewPointCloudColor:ot,defaultAttribute:Q,setDefaultAttribute:pt,pointCloudPattern:B,setPointCloudPattern:gt,selectSpecAttr:wt,globalPattern:H,setGlobalPattern:t=>{H!==t&&(It(Ot),Pt(t),t===z.Detection&&W(void 0))},ptSegmentInstance:b,setPtSegmentInstance:W,segmentation:R,setSegmentation:ft,clearAllDetectionInstance:xt,highlight2DDataList:j,setHighlight2DDataList:mt,cuboidBoxIn2DView:F,setCuboidBoxIn2DView:ct,imageSizes:X,cacheImageNodeSize:Ct,highlightIDs:y,setHighlightIDs:V}},[N,s,e,m,S,f,d,Z,q,l,M,p,U,Q,B,H,b,R,j,F,X,y]);E(()=>{var r,c,u;(r=g==null?void 0:g.setPointCloudBoxList)==null||r.call(g,e),(c=g==null?void 0:g.setHighlightIDs)==null||c.call(g,y),(u=g==null?void 0:g.setSelectedIDs)==null||u.call(g,s)},[e,s,y]),E(()=>{var r;(r=g==null?void 0:g.setPtCtx)==null||r.call(g,w)},[w]);const St=()=>{const r=e.filter(h=>p.includes(h.attribute)),{setSelectedIDs:c,reRender:u}=w,P=r.map(h=>h.id);P.length>0&&c(s.filter(h=>!P.includes(h))),u()};return E(()=>{var r,c,u,P;St(),(c=(r=d==null?void 0:d.toolInstance)==null?void 0:r.setHiddenAttributes)==null||c.call(r,p),(P=(u=b==null?void 0:b.store)==null?void 0:u.setHiddenAttributes)==null||P.call(u,p)},[p]),nt.createElement(at.Provider,{value:w},a)};export{at as PointCloudContext,Tt as PointCloudProvider};
1
+ import{EPointCloudPattern as E}from"@labelbee/lb-utils";import it,{useState as n,useRef as zt,useMemo as st,useEffect as N}from"react";import{ActionsHistory as lt,EToolName as G}from"@labelbee/lb-annotation";import{useDispatch as Et}from"../../store/ctx.js";import{ChangeSave as Nt}from"../../store/annotation/actionCreators.js";import Gt from"../../store/annotatedBox/index.js";import Ft from"lodash";var Mt=Object.defineProperty,kt=Object.defineProperties,Tt=Object.getOwnPropertyDescriptors,rt=Object.getOwnPropertySymbols,Zt=Object.prototype.hasOwnProperty,qt=Object.prototype.propertyIsEnumerable,at=(s,o,i)=>o in s?Mt(s,o,{enumerable:!0,configurable:!0,writable:!0,value:i}):s[o]=i,Jt=(s,o)=>{for(var i in o||(o={}))Zt.call(o,i)&&at(s,i,o[i]);if(rt)for(var i of rt(o))qt.call(o,i)&&at(s,i,o[i]);return s},Kt=(s,o)=>kt(s,Tt(o)),Qt=(s,o,i)=>new Promise((b,S)=>{var D=u=>{try{C(i.next(u))}catch(I){S(I)}},_=u=>{try{C(i.throw(u))}catch(I){S(I)}},C=u=>u.done?b(u.value):Promise.resolve(u.value).then(D,_);C((i=i.apply(s,o)).next())});const ct=s=>Ft.pick(s,["id","attribute","width","height","x","y","imageName"]),dt=it.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 lt,hideAttributes:[],setHideAttributes:()=>{},toggleAttributesVisible:()=>{},reRender:()=>{},setAttrPanelLayout:()=>{},attrPanelLayout:"",syncAllViewPointCloudColor:()=>Promise.resolve(),defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:G.Rect,setPointCloudPattern:()=>{},selectSpecAttr:()=>{},globalPattern:E.Detection,setGlobalPattern:()=>{},setPtSegmentInstance:()=>{},segmentation:[],setSegmentation:()=>{},clearAllDetectionInstance:()=>{},highlight2DDataList:[],setHighlight2DDataList:()=>{},cuboidBoxIn2DView:!0,setCuboidBoxIn2DView:s=>{},imageSizes:{},cacheImageNodeSize:()=>{}}),Ut=({children:s})=>{const[o,i]=n([]),[b,S]=n([]),[D,_]=n([]),[C,u]=n([]),[I,ut]=n([]),[h,x]=n([]),[y,R]=n([]),[F,pt]=n(!0),[M,gt]=n(!0),[k,ht]=n(1),[a,T]=n(),[Z,q]=n(),[J,K]=n(),[l,Q]=n(),[U,vt]=n(""),[B,ft]=n(G.Rect),Pt=zt(new lt).current,[p,O]=n([]),[W,mt]=n(""),[H,It]=n(E.Detection),[w,X]=n(void 0),[j,bt]=n([]),[z,Ct]=n([]),g=Gt(),[Y,wt]=n({}),Lt=Et(),St=r=>{const{imgNode:c,path:d}=r;d&&c&&wt(P=>Kt(Jt({},P),{[d]:{width:c.width,height:c.height}}))},$=st(()=>h.length===1?h[0]:"",[h]),V=st(()=>{const r=o.find(t=>t.id===$),c=t=>{const e=o.concat(t);return i(e),e},d=t=>{const e=b.concat(t);return S(e),e},P=t=>{pt(t!==!1)},v=t=>{t===void 0&&x([]),typeof t=="string"&&x([t]),Array.isArray(t)&&x(Array.from(new Set(t)))},yt=t=>{h.includes(t)?v(h.filter(e=>e!==t)):v([...h,t])},At=t=>{const e=ct(t);u(f=>[...f,e])},Vt=t=>{const e=ct(t);u(f=>f.map(m=>m.id===t.id?e:m))},_t=t=>{u(e=>e.filter(f=>!t.find(m=>m.id===f.id)))},xt=t=>{y.includes(t)?R([]):R([t])},Rt=()=>{if(B===G.Rect){const t=o.map(e=>e.id);v(t),a==null||a.pointCloud2dOperation.setSelectedIDs(t)}},Bt=t=>{v(o.filter(e=>e.attribute===t).map(e=>e.id))},tt=o.filter(t=>!p.includes(t.attribute)),et=b.filter(t=>!p.includes(t.attribute)),ot=I.filter(t=>t.attribute&&!p.includes(t.attribute)),Ot=t=>{if(p.includes(t))O(p.filter(e=>e!==t));else{const e=p.concat(t);O(e)}},Ht=(t=tt,e=D,f=et,m=ot,A=j)=>{var L;l==null||l.clearAllBox(),l==null||l.clearAllSphere(),a==null||a.updatePolygonList(t,e),a==null||a.updatePointList(f),a==null||a.updateLineList(m),l==null||l.generateBoxes(t),l==null||l.generateSpheres(f),(L=w==null?void 0:w.store)==null||L.updateCurrentSegment(A),nt(t)},jt=()=>{T(void 0),q(void 0),K(void 0),Q(void 0)},nt=(t,e)=>Qt(void 0,null,function*(){var f;if(!l)return;const m=l.pointCloudObject;if(!!m)try{const A=yield l.getHighlightIndexByMappingImgList({mappingImgList:e!=null?e:z,points:m.geometry.attributes.position.array}),L=yield l==null?void 0:l.highlightOriginPointCloud(t,A);return L&&((f=a==null?void 0:a.pointCloudInstance)==null||f.updateColor(L)),L}catch(A){console.error(A)}});return{selectedID:$,pointCloudBoxList:o,pointCloudSphereList:b,displayPointCloudList:tt,displaySphereList:et,displayLineList:ot,selectedIDs:h,setPointCloudResult:i,setSelectedIDs:v,addPointCloudBox:c,addPointCloudSphere:d,setPointCloudSphereList:S,valid:F,selectedPointCloudBox:r,setPointCloudValid:P,addSelectedID:yt,addHighlightID:xt,selectedAllBoxes:Rt,topViewInstance:a,setTopViewInstance:T,sideViewInstance:Z,setSideViewInstance:q,backViewInstance:J,setBackViewInstance:K,mainViewInstance:l,setMainViewInstance:Q,polygonList:D,setPolygonList:_,rectList:C,setRectList:u,addRectIn2DView:At,removeRectIn2DView:_t,updateRectIn2DView:Vt,lineList:I,setLineList:ut,zoom:k,setZoom:ht,history:Pt,toggleAttributesVisible:Ot,hideAttributes:p,setHideAttributes:O,reRender:Ht,attrPanelLayout:W,setAttrPanelLayout:mt,syncAllViewPointCloudColor:nt,defaultAttribute:U,setDefaultAttribute:vt,pointCloudPattern:B,setPointCloudPattern:ft,selectSpecAttr:Bt,globalPattern:H,setGlobalPattern:t=>{H!==t&&(Lt(Nt),It(t),t===E.Detection&&X(void 0))},ptSegmentInstance:w,setPtSegmentInstance:X,segmentation:j,setSegmentation:bt,clearAllDetectionInstance:jt,highlight2DDataList:z,setHighlight2DDataList:Ct,cuboidBoxIn2DView:M,setCuboidBoxIn2DView:gt,imageSizes:Y,cacheImageNodeSize:St,highlightIDs:y,setHighlightIDs:R}},[F,h,o,b,D,I,C,a,Z,J,l,k,p,W,U,B,H,w,j,z,M,Y,y]);N(()=>{var r,c,d;(r=g==null?void 0:g.setPointCloudBoxList)==null||r.call(g,o),(c=g==null?void 0:g.setHighlightIDs)==null||c.call(g,y),(d=g==null?void 0:g.setSelectedIDs)==null||d.call(g,h)},[o,h,y]),N(()=>{var r;(r=g==null?void 0:g.setPtCtx)==null||r.call(g,V)},[V]);const Dt=()=>{const r=o.filter(v=>p.includes(v.attribute)),{setSelectedIDs:c,reRender:d}=V,P=r.map(v=>v.id);P.length>0&&c(h.filter(v=>!P.includes(v))),d()};return N(()=>{var r,c,d,P;Dt(),(c=(r=a==null?void 0:a.toolInstance)==null?void 0:r.setHiddenAttributes)==null||c.call(r,p),(P=(d=w==null?void 0:w.store)==null?void 0:d.setHiddenAttributes)==null||P.call(d,p)},[p]),it.createElement(dt.Provider,{value:V},s)};export{dt as PointCloudContext,Ut as PointCloudProvider};
@@ -1 +1 @@
1
- import{useContext as S,useMemo as P}from"react";import{PointCloudContext as I}from"../PointCloudContext.js";import{cTool as E}from"@labelbee/lb-annotation";import{useHistory as x}from"./useHistory.js";import{EPointCloudPattern as C}from"@labelbee/lb-utils";const{EToolName:t,EPolygonPattern:p}=E,A=()=>{const{topViewInstance:r,sideViewInstance:a,backViewInstance:u,mainViewInstance:e,setPointCloudResult:v,setPointCloudSphereList:h,setPolygonList:m,pointCloudPattern:c,setPointCloudPattern:n,syncAllViewPointCloudColor:b,globalPattern:l,setLineList:w}=S(I),{pushHistoryWithList:y}=x(),L=()=>{e==null||e.clearAllBox(),e==null||e.clearAllSphere(),e==null||e.render(),v([]),m([]),h([]),w([]),r==null||r.toolScheduler.clearStatusAndResult(),b([]),y({pointCloudBoxList:[],polygonList:[],pointCloudSphereList:[]})},i=()=>{a==null||a.toolInstance.clearResult(),u==null||u.toolInstance.clearResult()},f=d=>{if(d===c)return;const s=[r,a,u];switch(d){case t.Rect:i(),s.forEach(o=>{o==null||o.switchToCanvas(t.PointCloudPolygon),o==null||o.toolInstance.setPattern(p.Rect)}),n(t.Rect);break;case t.Polygon:i(),s.forEach(o=>{o==null||o.switchToCanvas(t.PointCloudPolygon),o==null||o.toolInstance.setPattern(p.Normal)}),n(t.Polygon);break;case t.Point:i(),s.forEach(o=>{o==null||o.switchToCanvas(t.Point)}),n(t.Point);break;case t.Line:i(),s.forEach(o=>{o==null||o.switchToCanvas(t.Line)}),n(t.Line);break}},g=P(()=>l===C.Detection,[l]),R=P(()=>l===C.Segmentation,[l]);return{clearAllResult:L,updatePointCloudPattern:f,pointCloudPattern:c,isPointCloudDetectionPattern:g,isPointCloudSegmentationPattern:R}};export{A as useStatus};
1
+ import{useContext as I,useMemo as P}from"react";import{PointCloudContext as E}from"../PointCloudContext.js";import{cTool as x}from"@labelbee/lb-annotation";import{useHistory as A}from"./useHistory.js";import{EPointCloudPattern as C}from"@labelbee/lb-utils";const{EToolName:o,EPolygonPattern:p}=x,T=()=>{const{topViewInstance:r,sideViewInstance:a,backViewInstance:u,mainViewInstance:e,setPointCloudResult:v,setPointCloudSphereList:h,setPolygonList:m,setRectList:b,pointCloudPattern:c,setPointCloudPattern:n,syncAllViewPointCloudColor:L,globalPattern:l,setLineList:w}=I(E),{pushHistoryWithList:y}=A(),f=()=>{e==null||e.clearAllBox(),e==null||e.clearAllSphere(),e==null||e.render(),v([]),m([]),h([]),w([]),b([]),r==null||r.toolScheduler.clearStatusAndResult(),L([]),y({pointCloudBoxList:[],polygonList:[],pointCloudSphereList:[]})},i=()=>{a==null||a.toolInstance.clearResult(),u==null||u.toolInstance.clearResult()},g=d=>{if(d===c)return;const s=[r,a,u];switch(d){case o.Rect:i(),s.forEach(t=>{t==null||t.switchToCanvas(o.PointCloudPolygon),t==null||t.toolInstance.setPattern(p.Rect)}),n(o.Rect);break;case o.Polygon:i(),s.forEach(t=>{t==null||t.switchToCanvas(o.PointCloudPolygon),t==null||t.toolInstance.setPattern(p.Normal)}),n(o.Polygon);break;case o.Point:i(),s.forEach(t=>{t==null||t.switchToCanvas(o.Point)}),n(o.Point);break;case o.Line:i(),s.forEach(t=>{t==null||t.switchToCanvas(o.Line)}),n(o.Line);break}},R=P(()=>l===C.Detection,[l]),S=P(()=>l===C.Segmentation,[l]);return{clearAllResult:f,updatePointCloudPattern:g,pointCloudPattern:c,isPointCloudDetectionPattern:R,isPointCloudSegmentationPattern:S}};export{T as useStatus};
@@ -1 +1 @@
1
- import{getClassName as n}from"../../utils/dom.js";import t,{useContext as I,useState as T,useEffect as p}from"react";import y from"./PointCloud3DView.js";import k from"./PointCloudBackView.js";import B from"./PointCloudTopView.js";import F from"./PointCloudSideView.js";import _ from"./PointCloud2DView.js";import R from"./PointCloudListener.js";import M from"./PointCloudSegmentListener.js";import G from"./PointCloudSegment.js";import O from"./PointCloudSegmentStatus.js";import Z from"./PointCloudSegmentToolbar.js";import U from"./PointCloudSegment2DView.js";import{connect as W}from"react-redux";import{LabelBeeContext as $,useDispatch as q}from"../../store/ctx.js";import{AnnotatedAttributesPanelFixedLeft as z,AnnotatedAttributesPanelFixedRight as H}from"../../views/MainView/toolFooter/AnnotatedAttributes/index.js";import{PointCloudContext as J}from"./PointCloudContext.js";import{PointCloudUtils as K,EPointCloudPattern as Q}from"@labelbee/lb-utils";import{useCustomToolInstance as X}from"../../hooks/annotation.js";import{jsonParser as Y}from"../../utils/index.js";import{a2MapStateToProps as tt}from"../../store/annotation/map.js";import g from"classnames";import et from"./components/sideAndBackOverView/index.js";import{SetLoadPCDFileLoading as ot}from"../../store/annotation/actionCreators.js";const nt=E=>{const{currentData:a,imgList:L,drawLayerSlot:c,checkMode:i,intelligentFit:S,imgIndex:w,config:x,measureVisible:b}=E,e=I(J),{globalPattern:d,setGlobalPattern:j,selectedIDs:C}=e,v=q(),[l,P]=T(!1),V=(C==null?void 0:C.length)>0&&l,h=Y(a.result),{toolInstanceRef:r,clearToolInstance:D}=X({basicInfo:h});if(p(()=>{r.current.setPointCloudGlobalPattern=o=>{o!==d&&(j(o),e.clearAllDetectionInstance(),D())}},[d]),p(()=>{var o;if(ot(v,!0),a){const{boxParamsList:s,polygonList:m,lineList:u,sphereParamsList:A,segmentation:N}=K.parsePointCloudCurrentResult((o=a==null?void 0:a.result)!=null?o:"");e.setPointCloudResult(s),e.setPolygonList(m),e.setLineList(u),e.setPointCloudSphereList(A),e.setSegmentation(N)}},[w]),p(()=>{r.current.exportData=()=>[e.pointCloudBoxList,{valid:e.valid}],r.current.exportCustomData=()=>{var o,s,m,u;return{resultPolygon:(o=e.polygonList)!=null?o:[],resultLine:(s=e.lineList)!=null?s:[],resultPoint:(m=e.pointCloudSphereList)!=null?m:[],segmentation:(u=e.segmentation)!=null?u:[]}}},[e.pointCloudBoxList,e.valid,e.polygonList,e.lineList,e.pointCloudSphereList,e.ptSegmentInstance,e.segmentation]),L.length===0)return null;if(d===Q.Segmentation)return t.createElement(t.Fragment,null,t.createElement(M,{checkMode:i,toolInstanceRef:r}),t.createElement(Z,null),t.createElement("div",{className:n("point-cloud-layout")},t.createElement(G,{checkMode:i}),t.createElement(U,null)),t.createElement(O,{config:x}),c==null?void 0:c({direct:!0}));let f=t.createElement("div",{className:n("point-cloud-container","left-bottom")},t.createElement(k,{checkMode:i}),t.createElement(F,{checkMode:i}));return l&&(f=t.createElement(et,{selectAndEnlarge:V,checkMode:i})),t.createElement(t.Fragment,null,t.createElement(R,{checkMode:i,toolInstanceRef:r}),t.createElement("div",{className:n("point-cloud-layout"),onContextMenu:o=>o.preventDefault()},t.createElement("div",{className:n("point-cloud-wrapper")},t.createElement(z,null),t.createElement("div",{className:n("point-cloud-content")},t.createElement("div",{className:n("point-cloud-container","left")},t.createElement(y,null),f),t.createElement("div",{className:g({[n("point-cloud-container","right")]:!0,[n("point-cloud-container","rightZoom")]:l})},t.createElement(B,{drawLayerSlot:c,checkMode:i,intelligentFit:S,setIsEnlargeTopView:P,onExitZoom:()=>{P(!1)},isEnlargeTopView:l}),t.createElement("div",{className:g({[n("point-cloud-container","right-bottom")]:!l,[n("point-cloud-container","right-bottom-floatLeft")]:l})},t.createElement(_,{isEnlargeTopView:l,thumbnailWidth:l?300:455,checkMode:i,measureVisible:b})))),t.createElement(H,null))))};var it=W(tt,null,null,{context:$})(nt);export{it as default};
1
+ import{getClassName as n}from"../../utils/dom.js";import t,{useContext as T,useState as y,useEffect as C}from"react";import _ from"./PointCloud3DView.js";import k from"./PointCloudBackView.js";import B from"./PointCloudTopView.js";import F from"./PointCloudSideView.js";import R from"./PointCloud2DView.js";import M from"./PointCloudListener.js";import G from"./PointCloudSegmentListener.js";import O from"./PointCloudSegment.js";import Z from"./PointCloudSegmentStatus.js";import U from"./PointCloudSegmentToolbar.js";import W from"./PointCloudSegment2DView.js";import{connect as $}from"react-redux";import{LabelBeeContext as q,useDispatch as z}from"../../store/ctx.js";import{AnnotatedAttributesPanelFixedLeft as H,AnnotatedAttributesPanelFixedRight as J}from"../../views/MainView/toolFooter/AnnotatedAttributes/index.js";import{PointCloudContext as K}from"./PointCloudContext.js";import{PointCloudUtils as Q,EPointCloudPattern as X}from"@labelbee/lb-utils";import{useCustomToolInstance as Y}from"../../hooks/annotation.js";import{jsonParser as tt}from"../../utils/index.js";import{a2MapStateToProps as et}from"../../store/annotation/map.js";import L from"classnames";import ot from"./components/sideAndBackOverView/index.js";import{SetLoadPCDFileLoading as nt}from"../../store/annotation/actionCreators.js";const it=E=>{const{currentData:a,imgList:S,drawLayerSlot:d,checkMode:i,intelligentFit:w,imgIndex:x,config:b,measureVisible:j}=E,e=T(K),{globalPattern:p,setGlobalPattern:v,selectedIDs:P}=e,V=z(),[l,f]=y(!1),h=(P==null?void 0:P.length)>0&&l,D=tt(a.result),{toolInstanceRef:r,clearToolInstance:A}=Y({basicInfo:D});if(C(()=>{r.current.setPointCloudGlobalPattern=o=>{o!==p&&(v(o),e.clearAllDetectionInstance(),A())}},[p]),C(()=>{var o;if(nt(V,!0),a){const{boxParamsList:s,polygonList:m,lineList:u,sphereParamsList:c,segmentation:N,rectList:I}=Q.parsePointCloudCurrentResult((o=a==null?void 0:a.result)!=null?o:"");e.setPointCloudResult(s),e.setPolygonList(m),e.setLineList(u),e.setPointCloudSphereList(c),e.setRectList(I),e.setSegmentation(N)}},[x]),C(()=>{r.current.exportData=()=>[e.pointCloudBoxList,{valid:e.valid}],r.current.exportCustomData=()=>{var o,s,m,u,c;return{resultPolygon:(o=e.polygonList)!=null?o:[],resultLine:(s=e.lineList)!=null?s:[],resultPoint:(m=e.pointCloudSphereList)!=null?m:[],resultRect:(u=e.rectList)!=null?u:[],segmentation:(c=e.segmentation)!=null?c:[]}}},[e.pointCloudBoxList,e.rectList,e.valid,e.polygonList,e.lineList,e.pointCloudSphereList,e.ptSegmentInstance,e.segmentation]),S.length===0)return null;if(p===X.Segmentation)return t.createElement(t.Fragment,null,t.createElement(G,{checkMode:i,toolInstanceRef:r}),t.createElement(U,null),t.createElement("div",{className:n("point-cloud-layout")},t.createElement(O,{checkMode:i}),t.createElement(W,null)),t.createElement(Z,{config:b}),d==null?void 0:d({direct:!0}));let g=t.createElement("div",{className:n("point-cloud-container","left-bottom")},t.createElement(k,{checkMode:i}),t.createElement(F,{checkMode:i}));return l&&(g=t.createElement(ot,{selectAndEnlarge:h,checkMode:i})),t.createElement(t.Fragment,null,t.createElement(M,{checkMode:i,toolInstanceRef:r}),t.createElement("div",{className:n("point-cloud-layout"),onContextMenu:o=>o.preventDefault()},t.createElement("div",{className:n("point-cloud-wrapper")},t.createElement(H,null),t.createElement("div",{className:n("point-cloud-content")},t.createElement("div",{className:n("point-cloud-container","left")},t.createElement(_,null),g),t.createElement("div",{className:L({[n("point-cloud-container","right")]:!0,[n("point-cloud-container","rightZoom")]:l})},t.createElement(B,{drawLayerSlot:d,checkMode:i,intelligentFit:w,setIsEnlargeTopView:f,onExitZoom:()=>{f(!1)},isEnlargeTopView:l}),t.createElement("div",{className:L({[n("point-cloud-container","right-bottom")]:!l,[n("point-cloud-container","right-bottom-floatLeft")]:l})},t.createElement(R,{isEnlargeTopView:l,thumbnailWidth:l?300:455,checkMode:i,measureVisible:j})))),t.createElement(J,null))))};var lt=$(et,null,null,{context:q})(it);export{lt as default};
package/es/utils/index.js CHANGED
@@ -1 +1 @@
1
- import f from"lodash";import{pointCloudLidar2image as l}from"@labelbee/lb-annotation";var y=Object.defineProperty,d=Object.defineProperties,_=Object.getOwnPropertyDescriptors,u=Object.getOwnPropertySymbols,x=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable,m=(r,t,n)=>t in r?y(r,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[t]=n,P=(r,t)=>{for(var n in t||(t={}))x.call(t,n)&&m(r,n,t[n]);if(u)for(var n of u(t))O.call(t,n)&&m(r,n,t[n]);return r},w=(r,t)=>d(r,_(t));const b=(r,t={})=>{try{return typeof r=="string"?JSON.parse(r):f.isObject(r)?r:t}catch(n){return t}},I=r=>{if(Array.isArray(r))return r.filter(t=>t).join(" ");if(f.isObject(r)){const t=[];return Object.keys(r).forEach(n=>{r[n]&&t.push(n)}),t.join(" ")}return""},g=r=>{let t=Infinity,n=Infinity,e=-Infinity,o=-Infinity;for(const i of r)t=Math.min(t,i.x),n=Math.min(n,i.y),e=Math.max(e,i.x),o=Math.max(o,i.y);return{x:t,y:n,width:e-t,height:o-n}},v=(()=>{const r=(t,n)=>{const e=Math.max(t.x,n.x),o=Math.max(t.y,n.y),i=Math.min(t.x+t.width,n.x+n.width),a=Math.min(t.y+t.height,n.y+n.height),s=i-e,c=a-o;return s>=0&&c>=0?{x:e,y:o,width:s,height:c}:null};return(t,n,e)=>{if(e[n]){const o=e[n].width,i=e[n].height;return r(t,{x:0,y:0,width:o,height:i})!==null}return!1}})(),j=r=>{var t;const{pointCloudBox:n,mappingData:e,imageSizes:o}=r,{transferViewData:i}=(t=l(n,e.calib))!=null?t:{};if(!i)return;const a=i.reduce((p,h)=>h.type==="line"?[...p,...h.pointList]:p,[]),s=w(P({},g(a)),{imageName:e.path});if(v(s,e.path,o))return s};export{I as classnames,g as getBoundingRect,j as getRectPointCloudBox,b as jsonParser};
1
+ import f from"lodash";import{pointCloudLidar2image as y}from"@labelbee/lb-annotation";var d=Object.defineProperty,_=Object.defineProperties,x=Object.getOwnPropertyDescriptors,u=Object.getOwnPropertySymbols,O=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable,m=(r,t,n)=>t in r?d(r,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[t]=n,w=(r,t)=>{for(var n in t||(t={}))O.call(t,n)&&m(r,n,t[n]);if(u)for(var n of u(t))P.call(t,n)&&m(r,n,t[n]);return r},b=(r,t)=>_(r,x(t));const I=(r,t={})=>{try{return typeof r=="string"?JSON.parse(r):f.isObject(r)?r:t}catch(n){return t}},v=r=>{if(Array.isArray(r))return r.filter(t=>t).join(" ");if(f.isObject(r)){const t=[];return Object.keys(r).forEach(n=>{r[n]&&t.push(n)}),t.join(" ")}return""},g=r=>{let t=Infinity,n=Infinity,e=-Infinity,o=-Infinity;for(const i of r)t=Math.min(t,i.x),n=Math.min(n,i.y),e=Math.max(e,i.x),o=Math.max(o,i.y);return{x:t,y:n,width:e-t,height:o-n}},l=(()=>{const r=(t,n)=>{const e=Math.max(t.x,n.x),o=Math.max(t.y,n.y),i=Math.min(t.x+t.width,n.x+n.width),a=Math.min(t.y+t.height,n.y+n.height),s=i-e,c=a-o;return s>=0&&c>=0?{x:e,y:o,width:s,height:c}:null};return(t,n,e)=>{if(e[n]){const o=e[n].width,i=e[n].height;return r(t,{x:0,y:0,width:o,height:i})!==null}return!1}})(),j=r=>{var t;const{pointCloudBox:n,mappingData:e,imageSizes:o}=r,{transferViewData:i}=(t=y(n,e.calib))!=null?t:{};if(!i)return;const a=i.reduce((p,h)=>h.type==="line"?[...p,...h.pointList]:p,[]),s=b(w({},g(a)),{imageName:e.path});if(l(s,e.path,o))return s};export{v as classnames,g as getBoundingRect,j as getRectPointCloudBox,l as isBoundingRectInImage,I as jsonParser};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@labelbee/lb-components",
3
- "version": "1.23.0-alpha.13",
3
+ "version": "1.23.0-alpha.14",
4
4
  "description": "Provide a complete library of annotation components",
5
5
  "main": "./dist/index.js",
6
6
  "es": "./es/index.js",
@@ -43,8 +43,8 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@ant-design/icons": "^4.6.2",
46
- "@labelbee/lb-annotation": "1.27.0-alpha.6",
47
- "@labelbee/lb-utils": "1.19.0-alpha.2",
46
+ "@labelbee/lb-annotation": "1.27.0-alpha.7",
47
+ "@labelbee/lb-utils": "1.19.0-alpha.3",
48
48
  "@labelbee/wavesurfer": "1.0.0",
49
49
  "@types/react-dom": "^18.2.7",
50
50
  "@types/react-transition-group": "^4.4.9",