@labelbee/lb-components 1.23.0-alpha.34 → 1.23.0-alpha.35

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.
@@ -0,0 +1 @@
1
+ "use strict";require("react");var img="data:image/svg+xml,%3csvg class='icon' style='width: 1em%3bheight: 1em%3bvertical-align: middle%3bfill: currentColor%3boverflow: hidden%3b' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M633.417143 429.007238a174.567619 174.567619 0 0 1 0 246.857143l-155.306667 155.306667a186.709333 186.709333 0 1 1-264.045714-264.045715l76.483048-76.507428 51.73638 51.736381-76.507428 76.507428a113.566476 113.566476 0 1 0 160.597333 160.597334l155.306667-155.306667a101.424762 101.424762 0 0 0 0-143.408762z m208.603428-225.816381a186.709333 186.709333 0 0 1 0 264.045714L765.561905 543.744l-51.736381-51.712 76.507428-76.507429a113.566476 113.566476 0 1 0-160.597333-160.597333l-155.306667 155.306667a101.424762 101.424762 0 0 0 0 143.408762l-51.736381 51.736381a174.567619 174.567619 0 0 1 0-246.857143l155.306667-155.306667a186.709333 186.709333 0 0 1 264.045714 0z' fill='white'%3e%3c/path%3e%3c/svg%3e";module.exports=img;
@@ -0,0 +1 @@
1
+ "use strict";require("react");var img="data:image/svg+xml,%3csvg class='icon' style='width: 1em%3bheight: 1em%3bvertical-align: middle%3bfill: currentColor%3boverflow: hidden%3b' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M384 128v128h64V128H384zM523.328 613.824l-147.072 147.072a80 80 0 0 1-113.152-113.152l147.072-147.072-45.248-45.248-147.072 147.072a144 144 0 0 0 203.648 203.648l147.072-147.072-45.248-45.248zM613.76 523.328l45.312 45.248 147.072-147.072a144 144 0 1 0-203.648-203.648L455.424 364.928l45.248 45.248 147.072-147.072a80 80 0 0 1 113.152 113.152L613.824 523.328zM768 576h128v64h-128V576zM128 448h128V384H128v64zM640 768v128H576v-128h64zM750.848 705.6l103.808 103.744-45.312 45.248-103.68-103.68 45.184-45.312zM169.344 214.592l103.808 103.808 45.248-45.248-103.744-103.808-45.312 45.248z' fill='white'%3e%3c/path%3e%3c/svg%3e";module.exports=img;
@@ -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(u){return u&&typeof u=="object"&&"default"in u?u:{default:u}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(u,i,n)=>i in u?__defProp(u,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):u[i]=n,__spreadValues=(u,i)=>{for(var n in i||(i={}))__hasOwnProp.call(i,n)&&__defNormalProp(u,n,i[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(i))__propIsEnum.call(i,n)&&__defNormalProp(u,n,i[n]);return u},__spreadProps=(u,i)=>__defProps(u,__getOwnPropDescs(i));const PointCloud2DRectOperationView=u=>{var i;const{mappingData:n,size:l,config:f,checkMode:V,afterImgOnLoad:y}=u,p=(i=n==null?void 0:n.url)!=null?i:"",{pointCloudBoxList:v,setPointCloudResult:b,defaultAttribute:R,rectList:_,addRectIn2DView:E,updateRectIn2DView:w,removeRectIn2DView:S}=React.useContext(PointCloudContext.PointCloudContext),{update2DViewRect:j,remove2DViewRect:q}=usePointCloudViews.usePointCloudViews(),g=React__default.default.useRef(null),r=React.useRef(null),P=ahooks.useMemoizedFn(j),C=ahooks.useMemoizedFn(q),m=React.useRef(null),[B,I]=React.useState(!0),D=React.useMemo(()=>_==null?void 0:_.filter(e=>e.imageName===(n==null?void 0:n.path)),[n==null?void 0:n.path,_]),s=ahooks.useLatest(n==null?void 0:n.path),x=e=>{const{boxID:o}=e;if(o){const t=P==null?void 0:P(e);m.current=t,b(t);return}w(e)},O=e=>{s.current&&E(__spreadProps(__spreadValues({},e),{imageName:s.current}))},h=e=>{const o=e.find(t=>t.boxID);if(o){const t=C==null?void 0:C(o);m.current=t,b(t),d();return}S(e)},M=ahooks.useMemoizedFn(()=>{let e=[];return v.forEach(o=>{const{rects:t=[],id:c,attribute:a,trackID:z}=o,L=t.find(F=>F.imageName===s.current),A=c+"_"+s.current;L&&(e=[...e,__spreadProps(__spreadValues({},L),{boxID:c,id:A,attribute:a,order:z})])}),e}),d=ahooks.useMemoizedFn(()=>{var e,o,t;const c=M(),a=(e=r.current)==null?void 0:e.selectedRectID;(o=r.current)==null||o.setResult([...c,...D]),a&&((t=r.current)==null||t.setSelectedRectID(a))});return React.useEffect(()=>{if(g.current){const e=new lbAnnotation.PointCloud2DRectOperation({container:g.current,size:l,config:__spreadProps(__spreadValues({},f),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:V});return r.current=e,r.current.init(),r.current.on("updateDragResult",x),r.current.on("afterAddingDrawingRect",O),r.current.on("deleteSelectedRects",h),()=>{var o,t,c,a;(o=r.current)==null||o.unbind("updateDragResult",x),(t=r.current)==null||t.unbind("afterAddingDrawingRect",O),(c=r.current)==null||c.unbind("deleteSelectedRects",h),(a=r.current)==null||a.destroy()}}},[]),React.useEffect(()=>{I(!0),r.current&&p&&lbAnnotation.ImgUtils.load(p).then(e=>{r.current.setImgNode(e),y(e),I(!1)})},[p]),React.useEffect(()=>{var e;(e=r.current)==null||e.setSize(l)},[l]),React.useEffect(()=>{v!==m.current&&d()},[v]),React.useEffect(()=>{var e,o,t;const c=D.find(a=>a.id===r.current.selectedRectID);(o=(e=r.current)==null?void 0:e.setDefaultAttribute)==null||o.call(e,R),c&&w(__spreadProps(__spreadValues({},(t=r.current)==null?void 0:t.selectedRect),{attribute:R})),d()},[R]),React.useEffect(()=>{d()},[D]),React.useEffect(()=>{var e,o,t,c;const a=(o=(e=r.current)==null?void 0:e.config)!=null?o:{};(c=r.current)==null||c.setConfig(JSON.stringify(__spreadProps(__spreadValues({},a),{attributeList:(t=f.attributeList)!=null?t:[]})))},[f.attributeList]),React__default.default.createElement(es.Spin,{spinning:B},React__default.default.createElement("div",{ref:g,style:__spreadValues({position:"relative"},l)}))};var PointCloud2DRectOperationView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloud2DRectOperationView);module.exports=PointCloud2DRectOperationView$1;
1
+ "use strict";var ahooks=require("ahooks"),es=require("antd/es"),React=require("react"),reactRedux=require("react-redux"),usePointCloudViews=require("../pointCloudView/hooks/usePointCloudViews.js"),PointCloudContext=require("../pointCloudView/PointCloudContext.js"),map=require("../../store/annotation/map.js"),ctx=require("../../store/ctx.js"),lbAnnotation=require("@labelbee/lb-annotation");function _interopDefaultLegacy(u){return u&&typeof u=="object"&&"default"in u?u:{default:u}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(u,i,n)=>i in u?__defProp(u,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):u[i]=n,__spreadValues=(u,i)=>{for(var n in i||(i={}))__hasOwnProp.call(i,n)&&__defNormalProp(u,n,i[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(i))__propIsEnum.call(i,n)&&__defNormalProp(u,n,i[n]);return u},__spreadProps=(u,i)=>__defProps(u,__getOwnPropDescs(i));const PointCloud2DRectOperationView=u=>{var i;const{mappingData:n,size:s,config:p,checkMode:E,afterImgOnLoad:S,shouldExcludePointCloudBoxListUpdate:d}=u,v=(i=n==null?void 0:n.url)!=null?i:"",{pointCloudBoxList:R,setPointCloudResult:P,defaultAttribute:_,rectList:g,addRectIn2DView:j,updateRectIn2DView:C,removeRectIn2DView:q}=React.useContext(PointCloudContext.PointCloudContext),{update2DViewRect:B,remove2DViewRect:M}=usePointCloudViews.usePointCloudViews(),m=React__default.default.useRef(null),r=React.useRef(null),I=ahooks.useMemoizedFn(B),x=ahooks.useMemoizedFn(M),D=React.useRef(null),[z,h]=React.useState(!0),b=React.useMemo(()=>g==null?void 0:g.filter(e=>e.imageName===(n==null?void 0:n.path)),[n==null?void 0:n.path,g]),f=ahooks.useLatest(n==null?void 0:n.path),O=e=>{const{boxID:o}=e;if(!d&&o){const t=I==null?void 0:I(e);D.current=t,P(t);return}C(e,!0)},L=e=>{f.current&&j(__spreadProps(__spreadValues({},e),{imageName:f.current}))},V=e=>{if(!d){const o=e.find(t=>t.boxID);if(o){const t=x==null?void 0:x(o);D.current=t,P(t),l();return}}q(e)},A=ahooks.useMemoizedFn(()=>{let e=[];return R.forEach(o=>{const{rects:t=[],id:c,attribute:a,trackID:w}=o,y=t.find(N=>N.imageName===f.current),F=c+"_"+f.current;y&&(e=[...e,__spreadProps(__spreadValues({},y),{boxID:c,id:F,attribute:a,order:w})])}),e}),l=ahooks.useMemoizedFn(()=>{var e,o,t;const c=d?[]:A(),a=(e=r.current)==null?void 0:e.selectedRectID;(o=r.current)==null||o.setResult([...c,...b]),a&&((t=r.current)==null||t.setSelectedRectID(a))});return React.useEffect(()=>{if(m.current){const e=new lbAnnotation.PointCloud2DRectOperation({container:m.current,size:s,config:__spreadProps(__spreadValues({},p),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:E});return r.current=e,r.current.init(),r.current.on("updateDragResult",O),r.current.on("afterAddingDrawingRect",L),r.current.on("deleteSelectedRects",V),()=>{var o,t,c,a;(o=r.current)==null||o.unbind("updateDragResult",O),(t=r.current)==null||t.unbind("afterAddingDrawingRect",L),(c=r.current)==null||c.unbind("deleteSelectedRects",V),(a=r.current)==null||a.destroy()}}},[]),React.useEffect(()=>{h(!0),r.current&&v&&lbAnnotation.ImgUtils.load(v).then(e=>{r.current.setImgNode(e),S(e),h(!1)})},[v]),React.useEffect(()=>{var e;(e=r.current)==null||e.setSize(s)},[s]),React.useEffect(()=>{R!==D.current&&l()},[R]),React.useEffect(()=>{var e,o,t;const c=b.find(a=>a.id===r.current.selectedRectID);(o=(e=r.current)==null?void 0:e.setDefaultAttribute)==null||o.call(e,_),c&&C(__spreadProps(__spreadValues({},(t=r.current)==null?void 0:t.selectedRect),{attribute:_})),l()},[_]),React.useEffect(()=>{l()},[b]),React.useEffect(()=>{l()},[d]),React.useEffect(()=>{var e,o,t,c;const a=(o=(e=r.current)==null?void 0:e.config)!=null?o:{},w=__spreadProps(__spreadValues({},a),{attributeList:(t=p.attributeList)!=null?t:[]});(c=r.current)==null||c.setConfig(JSON.stringify(w))},[p.attributeList]),React__default.default.createElement(es.Spin,{spinning:z},React__default.default.createElement("div",{ref:m,style:__spreadValues({position:"relative"},s)}))};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"),index=require("../AnnotationView/index.js"),useSize=require("../../hooks/useSize.js"),useSingleBox=require("./hooks/useSingleBox.js"),useHighlight=require("./hooks/useHighlight.js"),index$2=require("./components/HighlightVisible/index.js"),PointCloudContext=require("./PointCloudContext.js"),index$1=require("../pointCloud2DRectOperationView/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__async=(e,s,o)=>new Promise((c,a)=>{var d=t=>{try{i(o.next(t))}catch(n){a(n)}},u=t=>{try{i(o.throw(t))}catch(n){a(n)}},i=t=>t.done?c(t.value):Promise.resolve(t.value).then(d,u);i((o=o.apply(e,s)).next())});const PointCloud2DSingleView=({view2dData:e,setSelectedID:s,currentData:o,showEnlarge:c,checkMode:a=!1,measureVisible:d})=>{var u;const i=React.useRef(null),t=React.useRef(),{selectedBox:n}=useSingleBox.useSingleBox(),g=useSize(i),{url:h,calib:v,path:y}=e,{toggle2dVisible:j,isHighlightVisible:q}=useHighlight.useHighlight({currentData:o}),[S,m]=React.useState(!1),{cuboidBoxIn2DView:P,cacheImageNodeSize:_}=React.useContext(PointCloudContext.PointCloudContext),k=!e,x=r=>{f(),_({path:y,imgNode:r})},f=React.useCallback(()=>{var r,p;const C=(r=t.current)==null?void 0:r.toolInstance;if(s(""),!n||!C)return;const l=e.annotations.find(V=>V.annotation.id===n.info.id);let b="";l&&((p=l==null?void 0:l.annotation.pointList)==null?void 0:p.length)>0&&(C.focusPositionByPointList(l==null?void 0:l.annotation.pointList),b=n.info.id,s(b))},[n,t.current,e.annotations]);React.useEffect(()=>{f()},[f]);const B=()=>__async(void 0,null,function*(){m(!0),yield j(h,v),m(!1)});return React__default.default.createElement("div",{className:dom.getClassName("point-cloud-2d-image"),ref:i},P?React__default.default.createElement(index,{src:(u=e==null?void 0:e.url)!=null?u:"",annotations:e.annotations,size:g,ref:t,globalStyle:{display:k?"none":"block"},afterImgOnLoad:x,zoomInfo:{min:.01,max:1e3,ratio:.4},measureVisible:d}):React__default.default.createElement(index$1,{mappingData:e,size:g,checkMode:a,afterImgOnLoad:x}),v&&React__default.default.createElement(index$2,{visible:q(h),onClick:B,loading:S,style:{position:"absolute",right:16,top:16,zIndex:c?-1:101}}))};module.exports=PointCloud2DSingleView;
1
+ "use strict";var dom=require("../../utils/dom.js"),React=require("react"),index=require("../AnnotationView/index.js"),useSize=require("../../hooks/useSize.js"),useSingleBox=require("./hooks/useSingleBox.js"),useHighlight=require("./hooks/useHighlight.js"),index$2=require("./components/HighlightVisible/index.js"),PointCloudContext=require("./PointCloudContext.js"),useDataLinkSwitch=require("./hooks/useDataLinkSwitch.js"),index$1=require("../pointCloud2DRectOperationView/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__async=(e,a,i)=>new Promise((s,u)=>{var d=t=>{try{o(i.next(t))}catch(n){u(n)}},r=t=>{try{o(i.throw(t))}catch(n){u(n)}},o=t=>t.done?s(t.value):Promise.resolve(t.value).then(d,r);o((i=i.apply(e,a)).next())});const PointCloud2DSingleView=({view2dData:e,setSelectedID:a,currentData:i,showEnlarge:s,checkMode:u=!1,measureVisible:d})=>{var r;const o=React.useRef(null),t=React.useRef(),{selectedBox:n}=useSingleBox.useSingleBox(),g=useSize(o),{url:m,calib:p,path:b}=e,{toggle2dVisible:S,isHighlightVisible:y}=useHighlight.useHighlight({currentData:i}),[j,x]=React.useState(!1),{cuboidBoxIn2DView:f,cacheImageNodeSize:q}=React.useContext(PointCloudContext.PointCloudContext),P=!e,B=React.useMemo(()=>({zIndex:s?-1:101,is2DView:!f,imageName:e.path}),[s,f,e.path]),{rendered:V,isLinking:_}=useDataLinkSwitch(B),v=c=>{h(),q({path:b,imgNode:c})},h=React.useCallback(()=>{var c,C;const k=(c=t.current)==null?void 0:c.toolInstance;if(a(""),!n||!k)return;const l=e.annotations.find(I=>I.annotation.id===n.info.id);let L="";l&&((C=l==null?void 0:l.annotation.pointList)==null?void 0:C.length)>0&&(k.focusPositionByPointList(l==null?void 0:l.annotation.pointList),L=n.info.id,a(L))},[n,t.current,e.annotations]);React.useEffect(()=>{h()},[h]);const z=()=>__async(void 0,null,function*(){x(!0),yield S(m,p),x(!1)});return React__default.default.createElement("div",{className:dom.getClassName("point-cloud-2d-image"),ref:o},f?React__default.default.createElement(index,{src:(r=e==null?void 0:e.url)!=null?r:"",annotations:e.annotations,size:g,ref:t,globalStyle:{display:P?"none":"block"},afterImgOnLoad:v,zoomInfo:{min:.01,max:1e3,ratio:.4},measureVisible:d}):React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(index$1,{shouldExcludePointCloudBoxListUpdate:!_,mappingData:e,size:g,checkMode:u,afterImgOnLoad:v}),V),p&&React__default.default.createElement(index$2,{visible:y(m),onClick:z,loading:j,style:{position:"absolute",right:16,top:16,zIndex:s?-1:101}}))};module.exports=PointCloud2DSingleView;
@@ -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$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
+ "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:k}=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:k.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,k]),React.useEffect(()=>(window.addEventListener("keydown",S),()=>{window.removeEventListener("keydown",S)}),[s]);const S=o=>{const{keyCode:i}=o;switch(i){case EKeyCode.Esc:y&&L(!1);break;case EKeyCode.Left:j();break;case EKeyCode.Right:N();break}},j=()=>{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:()=>j()}),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,{key:o.url,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"),_=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
+ "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,e,l)=>e in o?__defProp(o,e,{enumerable:!0,configurable:!0,writable:!0,value:l}):o[e]=l,__spreadValues=(o,e)=>{for(var l in e||(e={}))__hasOwnProp.call(e,l)&&__defNormalProp(o,l,e[l]);if(__getOwnPropSymbols)for(var l of __getOwnPropSymbols(e))__propIsEnum.call(e,l)&&__defNormalProp(o,l,e[l]);return o},__spreadProps=(o,e)=>__defProps(o,__getOwnPropDescs(e)),__async=(o,e,l)=>new Promise((w,x)=>{var A=f=>{try{S(l.next(f))}catch(b){x(b)}},H=f=>{try{S(l.throw(f))}catch(b){x(b)}},S=f=>f.done?w(f.value):Promise.resolve(f.value).then(A,H);S((l=l.apply(o,e)).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:()=>{},unlinkImageItems:[],addRectFromPointCloudBoxByImageName:o=>!1,removeRectBySpecifyId:(o,e,l)=>!1,removeRectByPointCloudBoxId:o=>!1}),PointCloudProvider=({children:o})=>{const[e,l]=React.useState([]),[w,x]=React.useState([]),[A,H]=React.useState([]),[S,f]=React.useState([]),[b,ut]=React.useState([]),[m,E]=React.useState([]),[R,j]=React.useState([]),[Z,ct]=React.useState(!0),[U,ft]=React.useState(!0),[J,pt]=React.useState(1),[p,K]=React.useState(),[Q,W]=React.useState(),[X,Y]=React.useState(),[u,$]=React.useState(),[tt,gt]=React.useState(""),[k,ht]=React.useState(lbAnnotation.EToolName.Rect),vt=React.useRef(new lbAnnotation.ActionsHistory).current,[g,F]=React.useState([]),[et,mt]=React.useState(""),[q,Pt]=React.useState(lbUtils.EPointCloudPattern.Detection),[L,nt]=React.useState(void 0),[z,It]=React.useState([]),[M,St]=React.useState([]),h=index(),[it,bt]=React.useState({}),Ct=ctx.useDispatch(),yt=s=>{const{imgNode:r,path:i}=s;i&&r&&bt(c=>__spreadProps(__spreadValues({},c),{[i]:{width:r.width,height:r.height}}))},ot=React.useMemo(()=>m.length===1?m[0]:"",[m]),V=React.useCallback((s,r,i="extId")=>{const c=i||"id",d=new Set(r);return f(v=>{let C=!1;const y=v.filter(O=>{const G=O[c],N=d.has(G)?O.imageName!==s:!0;return N||(C=!0),N});return C?y:v}),!0},[]),st=React.useCallback(s=>{const r=e.map(i=>i.id);return V(s,r,"extId")},[e,V]),rt=React.useCallback(s=>{if(!s)return!1;const r=e.filter(i=>Array.isArray(i.rects)).map(i=>{const{id:c,attribute:d,trackID:v}=i,C=i.rects.find(y=>y.imageName===s);if(C){const y=___default.default.pick(C,["width","height","x","y","imageName"]);return __spreadProps(__spreadValues({},y),{id:lbAnnotation.uuid(),attribute:d,order:v,extId:c,lineDash:[]})}return null}).filter(i=>i!==null);return r.length?(f(i=>{const c=new Set(i.filter(v=>s===v.imageName).map(v=>v.extId)),d=r.filter(v=>c.has(v.extId)===!1);return d.length?[...i,...d]:i}),!0):!1},[e]),B=React.useMemo(()=>{const s=e.find(t=>t.id===ot),r=t=>{const n=e.concat(t);return l(n),n},i=t=>{const n=w.concat(t);return x(n),n},c=t=>{ct(t!==!1)},d=t=>{t===void 0&&E([]),typeof t=="string"&&E([t]),Array.isArray(t)&&E(Array.from(new Set(t)))},v=t=>{m.includes(t)?d(m.filter(n=>n!==t)):d([...m,t])},C=t=>{const n=pickRectObject(t);f(a=>[...a,n])},y=(t,n=!1)=>{const a=pickRectObject(t);f(I=>I.map(P=>P.id===t.id?n?__spreadValues(__spreadValues({},P),a):a:P))},O=t=>{f(n=>n.filter(a=>!t.find(I=>I.id===a.id)))},G=t=>{R.includes(t)?j([]):j([t])},N=()=>{if(k===lbAnnotation.EToolName.Rect){const t=e.map(n=>n.id);d(t),p==null||p.pointCloud2dOperation.setSelectedIDs(t)}},Lt=t=>{d(e.filter(n=>n.attribute===t).map(n=>n.id))},T=e.filter(t=>!g.includes(t.attribute)),lt=w.filter(t=>!g.includes(t.attribute)),at=b.filter(t=>t.attribute&&!g.includes(t.attribute)),Dt=t=>{if(g.includes(t))F(g.filter(n=>n!==t));else{const n=g.concat(t);F(n)}},xt=(()=>{const t=T.map(a=>a.id),n=new Set(t);return S.filter(a=>a.extId&&n.has(a.extId)).map(a=>a.imageName)})(),_t=(t=T,n=A,a=lt,I=at,P=z)=>{var D;u==null||u.clearAllBox(),u==null||u.clearAllSphere(),p==null||p.updatePolygonList(t,n),p==null||p.updatePointList(a),p==null||p.updateLineList(I),u==null||u.generateBoxes(t),u==null||u.generateSpheres(a),(D=L==null?void 0:L.store)==null||D.updateCurrentSegment(P),dt(t)},At=()=>{K(void 0),W(void 0),Y(void 0),$(void 0)},dt=(t,n)=>__async(void 0,null,function*(){var a;if(!u)return;const I=u.pointCloudObject;if(!!I)try{const P=yield u.getHighlightIndexByMappingImgList({mappingImgList:n!=null?n:M,points:I.geometry.attributes.position.array}),D=yield u==null?void 0:u.highlightOriginPointCloud(t,P);return D&&((a=p==null?void 0:p.pointCloudInstance)==null||a.updateColor(D)),D}catch(P){console.error(P)}});return{selectedID:ot,pointCloudBoxList:e,pointCloudSphereList:w,displayPointCloudList:T,displaySphereList:lt,displayLineList:at,selectedIDs:m,setPointCloudResult:l,setSelectedIDs:d,addPointCloudBox:r,addPointCloudSphere:i,setPointCloudSphereList:x,valid:Z,selectedPointCloudBox:s,setPointCloudValid:c,addSelectedID:v,addHighlightID:G,selectedAllBoxes:N,topViewInstance:p,setTopViewInstance:K,sideViewInstance:Q,setSideViewInstance:W,backViewInstance:X,setBackViewInstance:Y,mainViewInstance:u,setMainViewInstance:$,polygonList:A,setPolygonList:H,rectList:S,setRectList:f,addRectIn2DView:C,removeRectIn2DView:O,updateRectIn2DView:y,lineList:b,setLineList:ut,zoom:J,setZoom:pt,history:vt,toggleAttributesVisible:Dt,hideAttributes:g,setHideAttributes:F,reRender:_t,attrPanelLayout:et,setAttrPanelLayout:mt,syncAllViewPointCloudColor:dt,defaultAttribute:tt,setDefaultAttribute:gt,pointCloudPattern:k,setPointCloudPattern:ht,selectSpecAttr:Lt,globalPattern:q,setGlobalPattern:t=>{q!==t&&(Ct(actionCreators.ChangeSave),Pt(t),t===lbUtils.EPointCloudPattern.Detection&&nt(void 0))},ptSegmentInstance:L,setPtSegmentInstance:nt,segmentation:z,setSegmentation:It,clearAllDetectionInstance:At,highlight2DDataList:M,setHighlight2DDataList:St,cuboidBoxIn2DView:U,setCuboidBoxIn2DView:ft,imageSizes:it,cacheImageNodeSize:yt,highlightIDs:R,setHighlightIDs:j,unlinkImageItems:xt,removeRectByPointCloudBoxId:st,removeRectBySpecifyId:V,addRectFromPointCloudBoxByImageName:rt}},[Z,m,e,w,A,b,S,p,Q,X,u,J,g,et,tt,k,q,L,z,M,U,it,R,st,V,rt]);React.useEffect(()=>{var s,r,i;(s=h==null?void 0:h.setPointCloudBoxList)==null||s.call(h,e),(r=h==null?void 0:h.setHighlightIDs)==null||r.call(h,R),(i=h==null?void 0:h.setSelectedIDs)==null||i.call(h,m)},[e,m,R]),React.useEffect(()=>{var s;(s=h==null?void 0:h.setPtCtx)==null||s.call(h,B)},[B]);const wt=()=>{const s=e.filter(d=>g.includes(d.attribute)),{setSelectedIDs:r,reRender:i}=B,c=s.map(d=>d.id);c.length>0&&r(m.filter(d=>!c.includes(d))),i()};return React.useEffect(()=>{var s,r,i,c;wt(),(r=(s=p==null?void 0:p.toolInstance)==null?void 0:s.setHiddenAttributes)==null||r.call(s,g),(c=(i=L==null?void 0:L.store)==null?void 0:i.setHiddenAttributes)==null||c.call(i,g)},[g]),React__default.default.createElement(PointCloudContext.Provider,{value:B},o)};exports.PointCloudContext=PointCloudContext,exports.PointCloudProvider=PointCloudProvider;
@@ -0,0 +1 @@
1
+ "use strict";var React=require("react"),ahooks=require("ahooks"),PointCloudContext=require("../PointCloudContext.js"),icon_link=require("../../../assets/annotation/icon_link.svg.js"),icon_unlink=require("../../../assets/annotation/icon_unlink.svg.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const iconSize={width:16,height:16},useDataLinkSwitch=e=>{e.imageName||console.warn("missing imageName");const[n,l]=React.useState(!0),r=React.useRef(e.imageName);r.current=e.imageName;const{unlinkImageItems:c,addRectFromPointCloudBoxByImageName:d,removeRectByPointCloudBoxId:m}=React.useContext(PointCloudContext.PointCloudContext),g=ahooks.useLatest(d),f=ahooks.useLatest(m),i=React.useCallback(t=>{const a=r.current;if(!a){console.warn("invalid image name");return}l(t),t?f.current(a):g.current(a)},[]),u=React.useCallback(()=>{i(!n)},[i,n]),h=React.useMemo(()=>{var t;if(!e.is2DView)return null;const o={zIndex:(t=e.zIndex)!=null?t:999,position:"absolute",top:16,right:16+28+12,background:"rgba(0, 0, 0, 0.74)",color:"white",borderRadius:2,padding:6,display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28,cursor:"pointer"};return React__default.default.createElement("div",{style:o,onClick:u},n&&React__default.default.createElement("img",{src:icon_link,style:iconSize}),!n&&React__default.default.createElement("img",{src:icon_unlink,style:iconSize}))},[n,e.is2DView,e.zIndex,u]),s=React.useCallback(()=>{if(!e.is2DView)return;const t=r.current;if(!t){console.warn("invalid image name");return}const o=new Set(c).has(t)===!1;i(o)},[e.is2DView,c,i]);return React.useEffect(()=>{s()},[s]),{rendered:h,isLinking:n,swapSwitch:i,syncIsLinking:s}};module.exports=useDataLinkSwitch;
@@ -10,6 +10,7 @@ interface IPointCloud2DRectOperationViewProps {
10
10
  config: any;
11
11
  checkMode?: boolean;
12
12
  afterImgOnLoad: TAfterImgOnLoad;
13
+ shouldExcludePointCloudBoxListUpdate?: boolean;
13
14
  }
14
15
  declare const _default: import("react-redux").ConnectedComponent<(props: IPointCloud2DRectOperationViewProps) => React.JSX.Element, import("react-redux").Omit<IPointCloud2DRectOperationViewProps, "config">>;
15
16
  export default _default;
@@ -19,6 +19,7 @@ interface IPointCloudSegment {
19
19
  ptSegmentInstance?: PointCloud;
20
20
  setPtSegmentInstance: (instance?: PointCloud) => void;
21
21
  }
22
+ type UnlinkImageItem = string;
22
23
  type AttrPanelLayout = '' | 'left' | 'right';
23
24
  interface IHighlight2DData {
24
25
  url: string;
@@ -51,7 +52,7 @@ export interface IPointCloudContext extends IPointCloudContextInstances, IPointC
51
52
  setRectList: (rectList: IPointCloudBoxRect[]) => void;
52
53
  addRectIn2DView: (rect: IPointCloud2DRectOperationViewRect) => void;
53
54
  removeRectIn2DView: (rects: IPointCloud2DRectOperationViewRect[]) => void;
54
- updateRectIn2DView: (rect: IPointCloud2DRectOperationViewRect) => void;
55
+ updateRectIn2DView: (rect: IPointCloud2DRectOperationViewRect, mergeSelf?: boolean) => void;
55
56
  lineList: ILine[];
56
57
  setLineList: (lineList: ILine[]) => void;
57
58
  zoom: number;
@@ -83,6 +84,11 @@ export interface IPointCloudContext extends IPointCloudContextInstances, IPointC
83
84
  imgNode: HTMLImageElement;
84
85
  path: string;
85
86
  }) => void;
87
+ /** 未关联(联动)项列表 */
88
+ unlinkImageItems: UnlinkImageItem[];
89
+ addRectFromPointCloudBoxByImageName: (imageName: string) => boolean;
90
+ removeRectBySpecifyId: (imageName: string, ids: string[], idField?: keyof IPointCloudBoxRect) => boolean;
91
+ removeRectByPointCloudBoxId: (imageName: string) => boolean;
86
92
  }
87
93
  export declare const PointCloudContext: React.Context<IPointCloudContext>;
88
94
  export declare const PointCloudProvider: React.FC<{}>;
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ export interface UseDataLinkSwitchOptions {
3
+ /** DOM显示层级 */
4
+ zIndex: number;
5
+ /** 是否2d框 */
6
+ is2DView: boolean;
7
+ /**
8
+ * 用来判断图片项,
9
+ * 具体参考:packages/lb-components/src/components/pointCloud2DRectOperationView/index.tsx, getRectListByBoxList函数
10
+ *
11
+ * 基于上参考,此值需确保唯一性!
12
+ */
13
+ imageName: string;
14
+ }
15
+ declare const useDataLinkSwitch: (opts: UseDataLinkSwitchOptions) => {
16
+ rendered: React.JSX.Element | null;
17
+ isLinking: boolean;
18
+ swapSwitch: (isLinking: boolean) => void;
19
+ syncIsLinking: () => void;
20
+ };
21
+ export default useDataLinkSwitch;
@@ -51,7 +51,10 @@ export default class AnnotationDataUtils {
51
51
  * @param {ICopyResultItemHandlerParams.mappingImgList} mappingImgList - The list of images for mapping.
52
52
  * @param {ICopyResultItemHandlerParams.preMappingImgList} preMappingImgList - The list of images before mapping.
53
53
  */
54
- static copyResultItemHandler(params: ICopyResultItemHandlerParams): void;
54
+ static copyResultItemHandler(params: ICopyResultItemHandlerParams): {
55
+ value: any;
56
+ oldValue: any;
57
+ };
55
58
  /**
56
59
  * 复制上一张图片结果
57
60
  * @param copyResult 复制的结果
@@ -1 +1 @@
1
- "use strict";var lbAnnotation=require("@labelbee/lb-annotation"),index=require("./index.js"),ToolType=require("../data/enums/ToolType.js"),_=require("lodash"),StepUtils=require("./StepUtils.js"),antd=require("antd"),lbUtils=require("@labelbee/lb-utils");function _interopDefaultLegacy(c){return c&&typeof c=="object"&&"default"in c?c:{default:c}}var ___default=_interopDefaultLegacy(_);class AnnotationDataUtils{static traverseDF(t,e,s,i){e(t,s,i),typeof t=="object"&&t!==null&&(Array.isArray(t)?t.forEach((a,r)=>{this.traverseDF(a,e,r,t)}):Object.keys(t).forEach(a=>{this.traverseDF(t[a],e,a,t)}))}static getNextPath(t){var e,s,i;const{prePath:a,preMappingImgList:r,nextMappingImgList:n}=t,l=(s=(e=r==null?void 0:r.find(u=>u.path===a))==null?void 0:e.calib)==null?void 0:s.calName,o=(i=n.find(u=>{var d;return((d=u.calib)==null?void 0:d.calName)===l}))==null?void 0:i.path;if(!o)throw Error("nextPath error");return o}static copyResultItemHandler(t){const{item:e,key:s,parent:i,mappingImgList:a,preMappingImgList:r}=t;s==="id"&&(i.id=lbAnnotation.uuid(8,62)),s==="imageName"&&(i.imageName=this.getNextPath({prePath:e,preMappingImgList:r,nextMappingImgList:a}))}static copyResultChange(t){const{copyResult:e,step:s,currentResult:i,mappingImgList:a,preMappingImgList:r}=t;try{const n=index.jsonParser(e),l=index.jsonParser(i),o=`step_${s}`;if(n[o]){const u=n[o];return["result","resultRect"].forEach(p=>{u[p]&&this.traverseDF(u[p],(f,m,h)=>{this.copyResultItemHandler({item:f,key:m,parent:h,mappingImgList:a,preMappingImgList:r})})}),l[o]=u,JSON.stringify(l)}return e}catch(n){antd.message.info(lbUtils.i18n.t("FailedToCopyResults"))}}static isResultSourceMatchedDependence(t,e){const s=t==null?void 0:t.map(a=>a.sourceID).sort(),i=e==null?void 0:e.map(a=>a.id).sort();return ___default.default.isEqual(s,i)}static deltaUpdateBasicResultList(t,e){const s=t==null?void 0:t.map(i=>i.sourceID).sort();return e.filter(i=>!s.includes(i.id))}static getInitialResultList(t,e,s,i,a){const r=t!=null?t:[];switch(s.tool){case ToolType.EToolName.Tag:case ToolType.EToolName.Text:{if(s.dataSourceStep>0){const n=this.deltaUpdateBasicResultList(r,i);if(n.length>0)return r.concat(e.getInitResultList(s.dataSourceStep,n))}return a!==!0?r:e.getInitResultList(s.dataSourceStep,i)}default:return r}}static dataCorrection(t,e,s,i){var a,r;try{const l=`step_${StepUtils.getStepInfo(s,i).step}`,o=index.jsonParser(t),u=index.jsonParser(e),d=(a=o[l])==null?void 0:a.result,p=(r=u[l])==null?void 0:r.result;if(!p||___default.default.isEqual(d.sort(this.idCmp),p.sort(this.idCmp)))return t;const f=this.findDeletedIds(d,p);if(f.length===0)return t;const m=s,h=this.getStepKeys(o).sort();return this.deleteRes(o,m,f,h),JSON.stringify(o)}catch(n){return console.error(n),t}}static idCmp(t,e){const s=t.id,i=e.id;return s<i?-1:s>i?1:0}static findDeletedIds(t,e){return this.findDeletedItems(e,t).map(s=>s.id)}static findDeletedItems(t,e){const s=[];return t.forEach(i=>{e.some(r=>r.id===i.id)||s.push(i)}),s}static getStepKeys(t){return Object.keys(t).map(e=>parseInt(e.replace("step_",""),10)).filter(e=>!isNaN(e))}static deleteRes(t,e,s,i){i.forEach(a=>{if(a>e){const r=t[`step_${a}`];if([ToolType.EToolName.FolderTag,ToolType.EToolName.Segmentation].includes(r.tool))return;if(r.dataSourceStep===e){const n=[];r.result=r.result.filter(l=>s.includes(l.sourceID)?(n.push(l.id),!1):!0),this.deleteRes(t,a,n,i)}else r.result=r.result.filter(n=>!s.includes(n.sourceID))}})}}module.exports=AnnotationDataUtils;
1
+ "use strict";var lbAnnotation=require("@labelbee/lb-annotation"),index=require("./index.js"),ToolType=require("../data/enums/ToolType.js"),_=require("lodash"),StepUtils=require("./StepUtils.js"),antd=require("antd"),lbUtils=require("@labelbee/lb-utils");function _interopDefaultLegacy(m){return m&&typeof m=="object"&&"default"in m?m:{default:m}}var ___default=_interopDefaultLegacy(_);class AnnotationDataUtils{static traverseDF(t,s,e,i){s(t,e,i),typeof t=="object"&&t!==null&&(Array.isArray(t)?t.forEach((n,r)=>{this.traverseDF(n,s,r,t)}):Object.keys(t).forEach(n=>{this.traverseDF(t[n],s,n,t)}))}static getNextPath(t){var s,e,i;const{prePath:n,preMappingImgList:r,nextMappingImgList:a}=t,o=(e=(s=r==null?void 0:r.find(c=>c.path===n))==null?void 0:s.calib)==null?void 0:e.calName,u=(i=a.find(c=>{var f;return((f=c.calib)==null?void 0:f.calName)===o}))==null?void 0:i.path;if(!u)throw Error("nextPath error");return u}static copyResultItemHandler(t){const{item:s,key:e,parent:i,mappingImgList:n,preMappingImgList:r}=t,a=e===void 0?void 0:i[e];return e==="id"&&(i.id=lbAnnotation.uuid(8,62)),e==="imageName"&&(i.imageName=this.getNextPath({prePath:s,preMappingImgList:r,nextMappingImgList:n})),{value:e===void 0?void 0:i[e],oldValue:a}}static copyResultChange(t){const{copyResult:s,step:e,currentResult:i,mappingImgList:n,preMappingImgList:r}=t;try{const a=index.jsonParser(s),o=index.jsonParser(i),u=`step_${e}`;if(a[u]){const c=a[u],f=["result","resultRect"],p=new Map,g=(l,d)=>{if(l===void 0||d===void 0){console.warn("invalid id");return}p.set(d,l)};if(f.forEach(l=>{c[l]&&this.traverseDF(c[l],(d,v,h)=>{const{value:I,oldValue:y}=this.copyResultItemHandler({item:d,key:v,parent:h,mappingImgList:n,preMappingImgList:r});l==="result"&&v==="id"&&I!==void 0&&y!==void 0&&p.set(y,I)})}),p.size){const l=c.resultRect;Array.isArray(l)&&l.forEach(d=>{const v=d.extId,h=p.get(v);v!==void 0&&h!==void 0&&(d.extId=h)})}return o[u]=c,JSON.stringify(o)}return s}catch(a){antd.message.info(lbUtils.i18n.t("FailedToCopyResults"))}}static isResultSourceMatchedDependence(t,s){const e=t==null?void 0:t.map(n=>n.sourceID).sort(),i=s==null?void 0:s.map(n=>n.id).sort();return ___default.default.isEqual(e,i)}static deltaUpdateBasicResultList(t,s){const e=t==null?void 0:t.map(i=>i.sourceID).sort();return s.filter(i=>!e.includes(i.id))}static getInitialResultList(t,s,e,i,n){const r=t!=null?t:[];switch(e.tool){case ToolType.EToolName.Tag:case ToolType.EToolName.Text:{if(e.dataSourceStep>0){const a=this.deltaUpdateBasicResultList(r,i);if(a.length>0)return r.concat(s.getInitResultList(e.dataSourceStep,a))}return n!==!0?r:s.getInitResultList(e.dataSourceStep,i)}default:return r}}static dataCorrection(t,s,e,i){var n,r;try{const o=`step_${StepUtils.getStepInfo(e,i).step}`,u=index.jsonParser(t),c=index.jsonParser(s),f=(n=u[o])==null?void 0:n.result,p=(r=c[o])==null?void 0:r.result;if(!p||___default.default.isEqual(f.sort(this.idCmp),p.sort(this.idCmp)))return t;const g=this.findDeletedIds(f,p);if(g.length===0)return t;const l=e,d=this.getStepKeys(u).sort();return this.deleteRes(u,l,g,d),JSON.stringify(u)}catch(a){return console.error(a),t}}static idCmp(t,s){const e=t.id,i=s.id;return e<i?-1:e>i?1:0}static findDeletedIds(t,s){return this.findDeletedItems(s,t).map(e=>e.id)}static findDeletedItems(t,s){const e=[];return t.forEach(i=>{s.some(r=>r.id===i.id)||e.push(i)}),e}static getStepKeys(t){return Object.keys(t).map(s=>parseInt(s.replace("step_",""),10)).filter(s=>!isNaN(s))}static deleteRes(t,s,e,i){i.forEach(n=>{if(n>s){const r=t[`step_${n}`];if([ToolType.EToolName.FolderTag,ToolType.EToolName.Segmentation].includes(r.tool))return;if(r.dataSourceStep===s){const a=[];r.result=r.result.filter(o=>e.includes(o.sourceID)?(a.push(o.id),!1):!0),this.deleteRes(t,n,a,i)}else r.result=r.result.filter(a=>!e.includes(a.sourceID))}})}}module.exports=AnnotationDataUtils;
@@ -0,0 +1 @@
1
+ import"react";var a="data:image/svg+xml,%3csvg class='icon' style='width: 1em%3bheight: 1em%3bvertical-align: middle%3bfill: currentColor%3boverflow: hidden%3b' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M633.417143 429.007238a174.567619 174.567619 0 0 1 0 246.857143l-155.306667 155.306667a186.709333 186.709333 0 1 1-264.045714-264.045715l76.483048-76.507428 51.73638 51.736381-76.507428 76.507428a113.566476 113.566476 0 1 0 160.597333 160.597334l155.306667-155.306667a101.424762 101.424762 0 0 0 0-143.408762z m208.603428-225.816381a186.709333 186.709333 0 0 1 0 264.045714L765.561905 543.744l-51.736381-51.712 76.507428-76.507429a113.566476 113.566476 0 1 0-160.597333-160.597333l-155.306667 155.306667a101.424762 101.424762 0 0 0 0 143.408762l-51.736381 51.736381a174.567619 174.567619 0 0 1 0-246.857143l155.306667-155.306667a186.709333 186.709333 0 0 1 264.045714 0z' fill='white'%3e%3c/path%3e%3c/svg%3e";export{a as default};
@@ -0,0 +1 @@
1
+ import"react";var l="data:image/svg+xml,%3csvg class='icon' style='width: 1em%3bheight: 1em%3bvertical-align: middle%3bfill: currentColor%3boverflow: hidden%3b' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M384 128v128h64V128H384zM523.328 613.824l-147.072 147.072a80 80 0 0 1-113.152-113.152l147.072-147.072-45.248-45.248-147.072 147.072a144 144 0 0 0 203.648 203.648l147.072-147.072-45.248-45.248zM613.76 523.328l45.312 45.248 147.072-147.072a144 144 0 1 0-203.648-203.648L455.424 364.928l45.248 45.248 147.072-147.072a80 80 0 0 1 113.152 113.152L613.824 523.328zM768 576h128v64h-128V576zM128 448h128V384H128v64zM640 768v128H576v-128h64zM750.848 705.6l103.808 103.744-45.312 45.248-103.68-103.68 45.184-45.312zM169.344 214.592l103.808 103.808 45.248-45.248-103.744-103.808-45.312 45.248z' fill='white'%3e%3c/path%3e%3c/svg%3e";export{l as default};
@@ -1 +1 @@
1
- import{useMemoizedFn as v,useLatest as K}from"ahooks";import{Spin as Q}from"antd/es";import C,{useContext as W,useRef as E,useState as X,useMemo as Y,useEffect as a}from"react";import{connect as Z}from"react-redux";import{usePointCloudViews as tt}from"../pointCloudView/hooks/usePointCloudViews.js";import{PointCloudContext as et}from"../pointCloudView/PointCloudContext.js";import{a2MapStateToProps as rt}from"../../store/annotation/map.js";import{LabelBeeContext as nt}from"../../store/ctx.js";import{PointCloud2DRectOperation as ot,ImgUtils as it}from"@labelbee/lb-annotation";var ct=Object.defineProperty,ut=Object.defineProperties,lt=Object.getOwnPropertyDescriptors,A=Object.getOwnPropertySymbols,at=Object.prototype.hasOwnProperty,st=Object.prototype.propertyIsEnumerable,N=(u,i,n)=>i in u?ct(u,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):u[i]=n,s=(u,i)=>{for(var n in i||(i={}))at.call(i,n)&&N(u,n,i[n]);if(A)for(var n of A(i))st.call(i,n)&&N(u,n,i[n]);return u},d=(u,i)=>ut(u,lt(i));const dt=u=>{var i;const{mappingData:n,size:p,config:_,checkMode:M,afterImgOnLoad:z}=u,R=(i=n==null?void 0:n.url)!=null?i:"",{pointCloudBoxList:g,setPointCloudResult:O,defaultAttribute:D,rectList:b,addRectIn2DView:F,updateRectIn2DView:h,removeRectIn2DView:k}=W(et),{update2DViewRect:U,remove2DViewRect:J}=tt(),w=C.useRef(null),r=E(null),x=v(U),L=v(J),P=E(null),[T,V]=X(!0),I=Y(()=>b==null?void 0:b.filter(t=>t.imageName===(n==null?void 0:n.path)),[n==null?void 0:n.path,b]),f=K(n==null?void 0:n.path),y=t=>{const{boxID:o}=t;if(o){const e=x==null?void 0:x(t);P.current=e,O(e);return}h(t)},S=t=>{f.current&&F(d(s({},t),{imageName:f.current}))},j=t=>{const o=t.find(e=>e.boxID);if(o){const e=L==null?void 0:L(o);P.current=e,O(e),m();return}k(t)},$=v(()=>{let t=[];return g.forEach(o=>{const{rects:e=[],id:c,attribute:l,trackID:q}=o,B=e.find(H=>H.imageName===f.current),G=c+"_"+f.current;B&&(t=[...t,d(s({},B),{boxID:c,id:G,attribute:l,order:q})])}),t}),m=v(()=>{var t,o,e;const c=$(),l=(t=r.current)==null?void 0:t.selectedRectID;(o=r.current)==null||o.setResult([...c,...I]),l&&((e=r.current)==null||e.setSelectedRectID(l))});return a(()=>{if(w.current){const t=new ot({container:w.current,size:p,config:d(s({},_),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:M});return r.current=t,r.current.init(),r.current.on("updateDragResult",y),r.current.on("afterAddingDrawingRect",S),r.current.on("deleteSelectedRects",j),()=>{var o,e,c,l;(o=r.current)==null||o.unbind("updateDragResult",y),(e=r.current)==null||e.unbind("afterAddingDrawingRect",S),(c=r.current)==null||c.unbind("deleteSelectedRects",j),(l=r.current)==null||l.destroy()}}},[]),a(()=>{V(!0),r.current&&R&&it.load(R).then(t=>{r.current.setImgNode(t),z(t),V(!1)})},[R]),a(()=>{var t;(t=r.current)==null||t.setSize(p)},[p]),a(()=>{g!==P.current&&m()},[g]),a(()=>{var t,o,e;const c=I.find(l=>l.id===r.current.selectedRectID);(o=(t=r.current)==null?void 0:t.setDefaultAttribute)==null||o.call(t,D),c&&h(d(s({},(e=r.current)==null?void 0:e.selectedRect),{attribute:D})),m()},[D]),a(()=>{m()},[I]),a(()=>{var t,o,e,c;const l=(o=(t=r.current)==null?void 0:t.config)!=null?o:{};(c=r.current)==null||c.setConfig(JSON.stringify(d(s({},l),{attributeList:(e=_.attributeList)!=null?e:[]})))},[_.attributeList]),C.createElement(Q,{spinning:T},C.createElement("div",{ref:w,style:s({position:"relative"},p)}))};var pt=Z(rt,null,null,{context:nt})(dt);export{pt as default};
1
+ import{useMemoizedFn as _,useLatest as Q}from"ahooks";import{Spin as W}from"antd/es";import h,{useContext as X,useRef as N,useState as Y,useMemo as Z,useEffect as a}from"react";import{connect as tt}from"react-redux";import{usePointCloudViews as et}from"../pointCloudView/hooks/usePointCloudViews.js";import{PointCloudContext as rt}from"../pointCloudView/PointCloudContext.js";import{a2MapStateToProps as nt}from"../../store/annotation/map.js";import{LabelBeeContext as ot}from"../../store/ctx.js";import{PointCloud2DRectOperation as it,ImgUtils as ut}from"@labelbee/lb-annotation";var ct=Object.defineProperty,lt=Object.defineProperties,at=Object.getOwnPropertyDescriptors,M=Object.getOwnPropertySymbols,st=Object.prototype.hasOwnProperty,dt=Object.prototype.propertyIsEnumerable,z=(c,i,n)=>i in c?ct(c,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):c[i]=n,s=(c,i)=>{for(var n in i||(i={}))st.call(i,n)&&z(c,n,i[n]);if(M)for(var n of M(i))dt.call(i,n)&&z(c,n,i[n]);return c},p=(c,i)=>lt(c,at(i));const pt=c=>{var i;const{mappingData:n,size:f,config:R,checkMode:F,afterImgOnLoad:U,shouldExcludePointCloudBoxListUpdate:m}=c,g=(i=n==null?void 0:n.url)!=null?i:"",{pointCloudBoxList:D,setPointCloudResult:x,defaultAttribute:b,rectList:w,addRectIn2DView:k,updateRectIn2DView:L,removeRectIn2DView:J}=X(rt),{update2DViewRect:T,remove2DViewRect:$}=et(),P=h.useRef(null),r=N(null),V=_(T),y=_($),C=N(null),[q,S]=Y(!0),I=Z(()=>w==null?void 0:w.filter(t=>t.imageName===(n==null?void 0:n.path)),[n==null?void 0:n.path,w]),v=Q(n==null?void 0:n.path),j=t=>{const{boxID:o}=t;if(!m&&o){const e=V==null?void 0:V(t);C.current=e,x(e);return}L(t,!0)},B=t=>{v.current&&k(p(s({},t),{imageName:v.current}))},E=t=>{if(!m){const o=t.find(e=>e.boxID);if(o){const e=y==null?void 0:y(o);C.current=e,x(e),d();return}}J(t)},G=_(()=>{let t=[];return D.forEach(o=>{const{rects:e=[],id:u,attribute:l,trackID:O}=o,A=e.find(K=>K.imageName===v.current),H=u+"_"+v.current;A&&(t=[...t,p(s({},A),{boxID:u,id:H,attribute:l,order:O})])}),t}),d=_(()=>{var t,o,e;const u=m?[]:G(),l=(t=r.current)==null?void 0:t.selectedRectID;(o=r.current)==null||o.setResult([...u,...I]),l&&((e=r.current)==null||e.setSelectedRectID(l))});return a(()=>{if(P.current){const t=new it({container:P.current,size:f,config:p(s({},R),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:F});return r.current=t,r.current.init(),r.current.on("updateDragResult",j),r.current.on("afterAddingDrawingRect",B),r.current.on("deleteSelectedRects",E),()=>{var o,e,u,l;(o=r.current)==null||o.unbind("updateDragResult",j),(e=r.current)==null||e.unbind("afterAddingDrawingRect",B),(u=r.current)==null||u.unbind("deleteSelectedRects",E),(l=r.current)==null||l.destroy()}}},[]),a(()=>{S(!0),r.current&&g&&ut.load(g).then(t=>{r.current.setImgNode(t),U(t),S(!1)})},[g]),a(()=>{var t;(t=r.current)==null||t.setSize(f)},[f]),a(()=>{D!==C.current&&d()},[D]),a(()=>{var t,o,e;const u=I.find(l=>l.id===r.current.selectedRectID);(o=(t=r.current)==null?void 0:t.setDefaultAttribute)==null||o.call(t,b),u&&L(p(s({},(e=r.current)==null?void 0:e.selectedRect),{attribute:b})),d()},[b]),a(()=>{d()},[I]),a(()=>{d()},[m]),a(()=>{var t,o,e,u;const l=(o=(t=r.current)==null?void 0:t.config)!=null?o:{},O=p(s({},l),{attributeList:(e=R.attributeList)!=null?e:[]});(u=r.current)==null||u.setConfig(JSON.stringify(O))},[R.attributeList]),h.createElement(W,{spinning:q},h.createElement("div",{ref:P,style:s({position:"relative"},f)}))};var ft=tt(nt,null,null,{context:ot})(pt);export{ft as default};
@@ -1 +1 @@
1
- import{getClassName as H}from"../../utils/dom.js";import u,{useRef as y,useState as L,useContext as R,useCallback as O,useEffect as N}from"react";import w from"../AnnotationView/index.js";import A from"../../hooks/useSize.js";import{useSingleBox as q}from"./hooks/useSingleBox.js";import{useHighlight as F}from"./hooks/useHighlight.js";import G from"./components/HighlightVisible/index.js";import{PointCloudContext as J}from"./PointCloudContext.js";import K from"../pointCloud2DRectOperationView/index.js";var M=(t,s,e)=>new Promise((d,a)=>{var m=o=>{try{i(e.next(o))}catch(n){a(n)}},r=o=>{try{i(e.throw(o))}catch(n){a(n)}},i=o=>o.done?d(o.value):Promise.resolve(o.value).then(m,r);i((e=e.apply(t,s)).next())});const Q=({view2dData:t,setSelectedID:s,currentData:e,showEnlarge:d,checkMode:a=!1,measureVisible:m})=>{var r;const i=y(null),o=y(),{selectedBox:n}=q(),p=A(i),{url:h,calib:g,path:j}=t,{toggle2dVisible:P,isHighlightVisible:S}=F({currentData:e}),[k,x]=L(!1),{cuboidBoxIn2DView:_,cacheImageNodeSize:z}=R(J),B=!t,b=c=>{f(),z({path:j,imgNode:c})},f=O(()=>{var c,C;const v=(c=o.current)==null?void 0:c.toolInstance;if(s(""),!n||!v)return;const l=t.annotations.find(E=>E.annotation.id===n.info.id);let V="";l&&((C=l==null?void 0:l.annotation.pointList)==null?void 0:C.length)>0&&(v.focusPositionByPointList(l==null?void 0:l.annotation.pointList),V=n.info.id,s(V))},[n,o.current,t.annotations]);N(()=>{f()},[f]);const I=()=>M(void 0,null,function*(){x(!0),yield P(h,g),x(!1)});return u.createElement("div",{className:H("point-cloud-2d-image"),ref:i},_?u.createElement(w,{src:(r=t==null?void 0:t.url)!=null?r:"",annotations:t.annotations,size:p,ref:o,globalStyle:{display:B?"none":"block"},afterImgOnLoad:b,zoomInfo:{min:.01,max:1e3,ratio:.4},measureVisible:m}):u.createElement(K,{mappingData:t,size:p,checkMode:a,afterImgOnLoad:b}),g&&u.createElement(G,{visible:S(h),onClick:I,loading:k,style:{position:"absolute",right:16,top:16,zIndex:d?-1:101}}))};export{Q as default};
1
+ import{getClassName as H}from"../../utils/dom.js";import s,{useRef as V,useState as N,useContext as w,useMemo as A,useCallback as F,useEffect as M}from"react";import T from"../AnnotationView/index.js";import U from"../../hooks/useSize.js";import{useSingleBox as q}from"./hooks/useSingleBox.js";import{useHighlight as D}from"./hooks/useHighlight.js";import G from"./components/HighlightVisible/index.js";import{PointCloudContext as J}from"./PointCloudContext.js";import K from"./hooks/useDataLinkSwitch.js";import Q from"../pointCloud2DRectOperationView/index.js";var W=(t,r,e)=>new Promise((l,c)=>{var m=o=>{try{i(e.next(o))}catch(n){c(n)}},u=o=>{try{i(e.throw(o))}catch(n){c(n)}},i=o=>o.done?l(o.value):Promise.resolve(o.value).then(m,u);i((e=e.apply(t,r)).next())});const X=({view2dData:t,setSelectedID:r,currentData:e,showEnlarge:l,checkMode:c=!1,measureVisible:m})=>{var u;const i=V(null),o=V(),{selectedBox:n}=q(),h=U(i),{url:g,calib:x,path:P}=t,{toggle2dVisible:j,isHighlightVisible:y}=D({currentData:e}),[v,k]=N(!1),{cuboidBoxIn2DView:f,cacheImageNodeSize:z}=w(J),B=!t,I=A(()=>({zIndex:l?-1:101,is2DView:!f,imageName:t.path}),[l,f,t.path]),{rendered:_,isLinking:O}=K(I),C=d=>{p(),z({path:P,imgNode:d})},p=F(()=>{var d,b;const L=(d=o.current)==null?void 0:d.toolInstance;if(r(""),!n||!L)return;const a=t.annotations.find(E=>E.annotation.id===n.info.id);let S="";a&&((b=a==null?void 0:a.annotation.pointList)==null?void 0:b.length)>0&&(L.focusPositionByPointList(a==null?void 0:a.annotation.pointList),S=n.info.id,r(S))},[n,o.current,t.annotations]);M(()=>{p()},[p]);const R=()=>W(void 0,null,function*(){k(!0),yield j(g,x),k(!1)});return s.createElement("div",{className:H("point-cloud-2d-image"),ref:i},f?s.createElement(T,{src:(u=t==null?void 0:t.url)!=null?u:"",annotations:t.annotations,size:h,ref:o,globalStyle:{display:B?"none":"block"},afterImgOnLoad:C,zoomInfo:{min:.01,max:1e3,ratio:.4},measureVisible:m}):s.createElement(s.Fragment,null,s.createElement(Q,{shouldExcludePointCloudBoxListUpdate:!O,mappingData:t,size:h,checkMode:c,afterImgOnLoad:C}),_),x&&s.createElement(G,{visible:y(g),onClick:R,loading:v,style:{position:"absolute",right:16,top:16,zIndex:l?-1:101}}))};export{X as default};
@@ -1 +1 @@
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
+ 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,{key:l.url,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 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
+ import{EPointCloudPattern as J}from"@labelbee/lb-utils";import gt,{useState as s,useRef as Zt,useMemo as ht,useCallback as K,useEffect as Q}from"react";import{ActionsHistory as It,EToolName as U,uuid as qt}from"@labelbee/lb-annotation";import{useDispatch as Jt}from"../../store/ctx.js";import{ChangeSave as Kt}from"../../store/annotation/actionCreators.js";import Qt from"../../store/annotatedBox/index.js";import vt from"lodash";var Ut=Object.defineProperty,Wt=Object.defineProperties,Xt=Object.getOwnPropertyDescriptors,Pt=Object.getOwnPropertySymbols,Yt=Object.prototype.hasOwnProperty,$t=Object.prototype.propertyIsEnumerable,bt=(l,e,a)=>e in l?Ut(l,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):l[e]=a,N=(l,e)=>{for(var a in e||(e={}))Yt.call(e,a)&&bt(l,a,e[a]);if(Pt)for(var a of Pt(e))$t.call(e,a)&&bt(l,a,e[a]);return l},yt=(l,e)=>Wt(l,Xt(e)),te=(l,e,a)=>new Promise((L,A)=>{var _=f=>{try{y(a.next(f))}catch(C){A(C)}},j=f=>{try{y(a.throw(f))}catch(C){A(C)}},y=f=>f.done?L(f.value):Promise.resolve(f.value).then(_,j);y((a=a.apply(l,e)).next())});const Ct=l=>vt.pick(l,["id","attribute","width","height","x","y","imageName"]),wt=gt.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 It,hideAttributes:[],setHideAttributes:()=>{},toggleAttributesVisible:()=>{},reRender:()=>{},setAttrPanelLayout:()=>{},attrPanelLayout:"",syncAllViewPointCloudColor:()=>Promise.resolve(),defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:U.Rect,setPointCloudPattern:()=>{},selectSpecAttr:()=>{},globalPattern:J.Detection,setGlobalPattern:()=>{},setPtSegmentInstance:()=>{},segmentation:[],setSegmentation:()=>{},clearAllDetectionInstance:()=>{},highlight2DDataList:[],setHighlight2DDataList:()=>{},cuboidBoxIn2DView:!0,setCuboidBoxIn2DView:l=>{},imageSizes:{},cacheImageNodeSize:()=>{},unlinkImageItems:[],addRectFromPointCloudBoxByImageName:l=>!1,removeRectBySpecifyId:(l,e,a)=>!1,removeRectByPointCloudBoxId:l=>!1}),ee=({children:l})=>{const[e,a]=s([]),[L,A]=s([]),[_,j]=s([]),[y,f]=s([]),[C,St]=s([]),[v,F]=s([]),[R,k]=s([]),[W,Lt]=s(!0),[X,Dt]=s(!0),[Y,xt]=s(1),[m,$]=s(),[tt,et]=s(),[nt,it]=s(),[u,ot]=s(),[st,At]=s(""),[z,_t]=s(U.Rect),Rt=Zt(new It).current,[g,E]=s([]),[rt,Vt]=s(""),[G,Bt]=s(J.Detection),[D,lt]=s(void 0),[M,Ot]=s([]),[T,Ht]=s([]),h=Qt(),[at,Nt]=s({}),jt=Jt(),Ft=o=>{const{imgNode:r,path:i}=o;i&&r&&Nt(p=>yt(N({},p),{[i]:{width:r.width,height:r.height}}))},dt=ht(()=>v.length===1?v[0]:"",[v]),V=K((o,r,i="extId")=>{const p=i||"id",c=new Set(r);return f(I=>{let w=!1;const S=I.filter(O=>{const Z=O[p],H=c.has(Z)?O.imageName!==o:!0;return H||(w=!0),H});return w?S:I}),!0},[]),ct=K(o=>{const r=e.map(i=>i.id);return V(o,r,"extId")},[e,V]),ut=K(o=>{if(!o)return!1;const r=e.filter(i=>Array.isArray(i.rects)).map(i=>{const{id:p,attribute:c,trackID:I}=i,w=i.rects.find(S=>S.imageName===o);if(w){const S=vt.pick(w,["width","height","x","y","imageName"]);return yt(N({},S),{id:qt(),attribute:c,order:I,extId:p,lineDash:[]})}return null}).filter(i=>i!==null);return r.length?(f(i=>{const p=new Set(i.filter(I=>o===I.imageName).map(I=>I.extId)),c=r.filter(I=>p.has(I.extId)===!1);return c.length?[...i,...c]:i}),!0):!1},[e]),B=ht(()=>{const o=e.find(t=>t.id===dt),r=t=>{const n=e.concat(t);return a(n),n},i=t=>{const n=L.concat(t);return A(n),n},p=t=>{Lt(t!==!1)},c=t=>{t===void 0&&F([]),typeof t=="string"&&F([t]),Array.isArray(t)&&F(Array.from(new Set(t)))},I=t=>{v.includes(t)?c(v.filter(n=>n!==t)):c([...v,t])},w=t=>{const n=Ct(t);f(d=>[...d,n])},S=(t,n=!1)=>{const d=Ct(t);f(b=>b.map(P=>P.id===t.id?n?N(N({},P),d):d:P))},O=t=>{f(n=>n.filter(d=>!t.find(b=>b.id===d.id)))},Z=t=>{R.includes(t)?k([]):k([t])},H=()=>{if(z===U.Rect){const t=e.map(n=>n.id);c(t),m==null||m.pointCloud2dOperation.setSelectedIDs(t)}},zt=t=>{c(e.filter(n=>n.attribute===t).map(n=>n.id))},q=e.filter(t=>!g.includes(t.attribute)),pt=L.filter(t=>!g.includes(t.attribute)),ft=C.filter(t=>t.attribute&&!g.includes(t.attribute)),Et=t=>{if(g.includes(t))E(g.filter(n=>n!==t));else{const n=g.concat(t);E(n)}},Gt=(()=>{const t=q.map(d=>d.id),n=new Set(t);return y.filter(d=>d.extId&&n.has(d.extId)).map(d=>d.imageName)})(),Mt=(t=q,n=_,d=pt,b=ft,P=M)=>{var x;u==null||u.clearAllBox(),u==null||u.clearAllSphere(),m==null||m.updatePolygonList(t,n),m==null||m.updatePointList(d),m==null||m.updateLineList(b),u==null||u.generateBoxes(t),u==null||u.generateSpheres(d),(x=D==null?void 0:D.store)==null||x.updateCurrentSegment(P),mt(t)},Tt=()=>{$(void 0),et(void 0),it(void 0),ot(void 0)},mt=(t,n)=>te(void 0,null,function*(){var d;if(!u)return;const b=u.pointCloudObject;if(!!b)try{const P=yield u.getHighlightIndexByMappingImgList({mappingImgList:n!=null?n:T,points:b.geometry.attributes.position.array}),x=yield u==null?void 0:u.highlightOriginPointCloud(t,P);return x&&((d=m==null?void 0:m.pointCloudInstance)==null||d.updateColor(x)),x}catch(P){console.error(P)}});return{selectedID:dt,pointCloudBoxList:e,pointCloudSphereList:L,displayPointCloudList:q,displaySphereList:pt,displayLineList:ft,selectedIDs:v,setPointCloudResult:a,setSelectedIDs:c,addPointCloudBox:r,addPointCloudSphere:i,setPointCloudSphereList:A,valid:W,selectedPointCloudBox:o,setPointCloudValid:p,addSelectedID:I,addHighlightID:Z,selectedAllBoxes:H,topViewInstance:m,setTopViewInstance:$,sideViewInstance:tt,setSideViewInstance:et,backViewInstance:nt,setBackViewInstance:it,mainViewInstance:u,setMainViewInstance:ot,polygonList:_,setPolygonList:j,rectList:y,setRectList:f,addRectIn2DView:w,removeRectIn2DView:O,updateRectIn2DView:S,lineList:C,setLineList:St,zoom:Y,setZoom:xt,history:Rt,toggleAttributesVisible:Et,hideAttributes:g,setHideAttributes:E,reRender:Mt,attrPanelLayout:rt,setAttrPanelLayout:Vt,syncAllViewPointCloudColor:mt,defaultAttribute:st,setDefaultAttribute:At,pointCloudPattern:z,setPointCloudPattern:_t,selectSpecAttr:zt,globalPattern:G,setGlobalPattern:t=>{G!==t&&(jt(Kt),Bt(t),t===J.Detection&&lt(void 0))},ptSegmentInstance:D,setPtSegmentInstance:lt,segmentation:M,setSegmentation:Ot,clearAllDetectionInstance:Tt,highlight2DDataList:T,setHighlight2DDataList:Ht,cuboidBoxIn2DView:X,setCuboidBoxIn2DView:Dt,imageSizes:at,cacheImageNodeSize:Ft,highlightIDs:R,setHighlightIDs:k,unlinkImageItems:Gt,removeRectByPointCloudBoxId:ct,removeRectBySpecifyId:V,addRectFromPointCloudBoxByImageName:ut}},[W,v,e,L,_,C,y,m,tt,nt,u,Y,g,rt,st,z,G,D,M,T,X,at,R,ct,V,ut]);Q(()=>{var o,r,i;(o=h==null?void 0:h.setPointCloudBoxList)==null||o.call(h,e),(r=h==null?void 0:h.setHighlightIDs)==null||r.call(h,R),(i=h==null?void 0:h.setSelectedIDs)==null||i.call(h,v)},[e,v,R]),Q(()=>{var o;(o=h==null?void 0:h.setPtCtx)==null||o.call(h,B)},[B]);const kt=()=>{const o=e.filter(c=>g.includes(c.attribute)),{setSelectedIDs:r,reRender:i}=B,p=o.map(c=>c.id);p.length>0&&r(v.filter(c=>!p.includes(c))),i()};return Q(()=>{var o,r,i,p;kt(),(r=(o=m==null?void 0:m.toolInstance)==null?void 0:o.setHiddenAttributes)==null||r.call(o,g),(p=(i=D==null?void 0:D.store)==null?void 0:i.setHiddenAttributes)==null||p.call(i,g)},[g]),gt.createElement(wt.Provider,{value:B},l)};export{wt as PointCloudContext,ee as PointCloudProvider};
@@ -0,0 +1 @@
1
+ import c,{useState as C,useRef as v,useContext as y,useCallback as m,useMemo as N,useEffect as R}from"react";import{useLatest as d}from"ahooks";import{PointCloudContext as S}from"../PointCloudContext.js";import b from"../../../assets/annotation/icon_link.svg.js";import z from"../../../assets/annotation/icon_unlink.svg.js";const g={width:16,height:16},D=e=>{e.imageName||console.warn("missing imageName");const[n,f]=C(!0),s=v(e.imageName);s.current=e.imageName;const{unlinkImageItems:l,addRectFromPointCloudBoxByImageName:w,removeRectByPointCloudBoxId:h}=y(S),I=d(w),k=d(h),i=m(t=>{const o=s.current;if(!o){console.warn("invalid image name");return}f(t),t?k.current(o):I.current(o)},[]),u=m(()=>{i(!n)},[i,n]),x=N(()=>{var t;if(!e.is2DView)return null;const r={zIndex:(t=e.zIndex)!=null?t:999,position:"absolute",top:16,right:16+28+12,background:"rgba(0, 0, 0, 0.74)",color:"white",borderRadius:2,padding:6,display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28,cursor:"pointer"};return c.createElement("div",{style:r,onClick:u},n&&c.createElement("img",{src:b,style:g}),!n&&c.createElement("img",{src:z,style:g}))},[n,e.is2DView,e.zIndex,u]),a=m(()=>{if(!e.is2DView)return;const t=s.current;if(!t){console.warn("invalid image name");return}const r=new Set(l).has(t)===!1;i(r)},[e.is2DView,l,i]);return R(()=>{a()},[a]),{rendered:x,isLinking:n,swapSwitch:i,syncIsLinking:a}};export{D as default};
@@ -1 +1 @@
1
- import{uuid as D}from"@labelbee/lb-annotation";import{jsonParser as f}from"./index.js";import{EToolName as m}from"../data/enums/ToolType.js";import I from"lodash";import S from"./StepUtils.js";import{message as y}from"antd";import{i18n as v}from"@labelbee/lb-utils";class R{static traverseDF(t,e,s,i){e(t,s,i),typeof t=="object"&&t!==null&&(Array.isArray(t)?t.forEach((n,r)=>{this.traverseDF(n,e,r,t)}):Object.keys(t).forEach(n=>{this.traverseDF(t[n],e,n,t)}))}static getNextPath(t){var e,s,i;const{prePath:n,preMappingImgList:r,nextMappingImgList:a}=t,l=(s=(e=r==null?void 0:r.find(c=>c.path===n))==null?void 0:e.calib)==null?void 0:s.calName,o=(i=a.find(c=>{var u;return((u=c.calib)==null?void 0:u.calName)===l}))==null?void 0:i.path;if(!o)throw Error("nextPath error");return o}static copyResultItemHandler(t){const{item:e,key:s,parent:i,mappingImgList:n,preMappingImgList:r}=t;s==="id"&&(i.id=D(8,62)),s==="imageName"&&(i.imageName=this.getNextPath({prePath:e,preMappingImgList:r,nextMappingImgList:n}))}static copyResultChange(t){const{copyResult:e,step:s,currentResult:i,mappingImgList:n,preMappingImgList:r}=t;try{const a=f(e),l=f(i),o=`step_${s}`;if(a[o]){const c=a[o];return["result","resultRect"].forEach(d=>{c[d]&&this.traverseDF(c[d],(p,h,g)=>{this.copyResultItemHandler({item:p,key:h,parent:g,mappingImgList:n,preMappingImgList:r})})}),l[o]=c,JSON.stringify(l)}return e}catch(a){y.info(v.t("FailedToCopyResults"))}}static isResultSourceMatchedDependence(t,e){const s=t==null?void 0:t.map(n=>n.sourceID).sort(),i=e==null?void 0:e.map(n=>n.id).sort();return I.isEqual(s,i)}static deltaUpdateBasicResultList(t,e){const s=t==null?void 0:t.map(i=>i.sourceID).sort();return e.filter(i=>!s.includes(i.id))}static getInitialResultList(t,e,s,i,n){const r=t!=null?t:[];switch(s.tool){case m.Tag:case m.Text:{if(s.dataSourceStep>0){const a=this.deltaUpdateBasicResultList(r,i);if(a.length>0)return r.concat(e.getInitResultList(s.dataSourceStep,a))}return n!==!0?r:e.getInitResultList(s.dataSourceStep,i)}default:return r}}static dataCorrection(t,e,s,i){var n,r;try{const l=`step_${S.getStepInfo(s,i).step}`,o=f(t),c=f(e),u=(n=o[l])==null?void 0:n.result,d=(r=c[l])==null?void 0:r.result;if(!d||I.isEqual(u.sort(this.idCmp),d.sort(this.idCmp)))return t;const p=this.findDeletedIds(u,d);if(p.length===0)return t;const h=s,g=this.getStepKeys(o).sort();return this.deleteRes(o,h,p,g),JSON.stringify(o)}catch(a){return console.error(a),t}}static idCmp(t,e){const s=t.id,i=e.id;return s<i?-1:s>i?1:0}static findDeletedIds(t,e){return this.findDeletedItems(e,t).map(s=>s.id)}static findDeletedItems(t,e){const s=[];return t.forEach(i=>{e.some(r=>r.id===i.id)||s.push(i)}),s}static getStepKeys(t){return Object.keys(t).map(e=>parseInt(e.replace("step_",""),10)).filter(e=>!isNaN(e))}static deleteRes(t,e,s,i){i.forEach(n=>{if(n>e){const r=t[`step_${n}`];if([m.FolderTag,m.Segmentation].includes(r.tool))return;if(r.dataSourceStep===e){const a=[];r.result=r.result.filter(l=>s.includes(l.sourceID)?(a.push(l.id),!1):!0),this.deleteRes(t,n,a,i)}else r.result=r.result.filter(a=>!s.includes(a.sourceID))}})}}export{R as default};
1
+ import{uuid as S}from"@labelbee/lb-annotation";import{jsonParser as g}from"./index.js";import{EToolName as I}from"../data/enums/ToolType.js";import R from"lodash";import x from"./StepUtils.js";import{message as N}from"antd";import{i18n as E}from"@labelbee/lb-utils";class L{static traverseDF(t,s,e,i){s(t,e,i),typeof t=="object"&&t!==null&&(Array.isArray(t)?t.forEach((n,r)=>{this.traverseDF(n,s,r,t)}):Object.keys(t).forEach(n=>{this.traverseDF(t[n],s,n,t)}))}static getNextPath(t){var s,e,i;const{prePath:n,preMappingImgList:r,nextMappingImgList:o}=t,a=(e=(s=r==null?void 0:r.find(u=>u.path===n))==null?void 0:s.calib)==null?void 0:e.calName,c=(i=o.find(u=>{var f;return((f=u.calib)==null?void 0:f.calName)===a}))==null?void 0:i.path;if(!c)throw Error("nextPath error");return c}static copyResultItemHandler(t){const{item:s,key:e,parent:i,mappingImgList:n,preMappingImgList:r}=t,o=e===void 0?void 0:i[e];return e==="id"&&(i.id=S(8,62)),e==="imageName"&&(i.imageName=this.getNextPath({prePath:s,preMappingImgList:r,nextMappingImgList:n})),{value:e===void 0?void 0:i[e],oldValue:o}}static copyResultChange(t){const{copyResult:s,step:e,currentResult:i,mappingImgList:n,preMappingImgList:r}=t;try{const o=g(s),a=g(i),c=`step_${e}`;if(o[c]){const u=o[c],f=["result","resultRect"],p=new Map,v=(l,d)=>{if(l===void 0||d===void 0){console.warn("invalid id");return}p.set(d,l)};if(f.forEach(l=>{u[l]&&this.traverseDF(u[l],(d,m,h)=>{const{value:y,oldValue:D}=this.copyResultItemHandler({item:d,key:m,parent:h,mappingImgList:n,preMappingImgList:r});l==="result"&&m==="id"&&y!==void 0&&D!==void 0&&p.set(D,y)})}),p.size){const l=u.resultRect;Array.isArray(l)&&l.forEach(d=>{const m=d.extId,h=p.get(m);m!==void 0&&h!==void 0&&(d.extId=h)})}return a[c]=u,JSON.stringify(a)}return s}catch(o){N.info(E.t("FailedToCopyResults"))}}static isResultSourceMatchedDependence(t,s){const e=t==null?void 0:t.map(n=>n.sourceID).sort(),i=s==null?void 0:s.map(n=>n.id).sort();return R.isEqual(e,i)}static deltaUpdateBasicResultList(t,s){const e=t==null?void 0:t.map(i=>i.sourceID).sort();return s.filter(i=>!e.includes(i.id))}static getInitialResultList(t,s,e,i,n){const r=t!=null?t:[];switch(e.tool){case I.Tag:case I.Text:{if(e.dataSourceStep>0){const o=this.deltaUpdateBasicResultList(r,i);if(o.length>0)return r.concat(s.getInitResultList(e.dataSourceStep,o))}return n!==!0?r:s.getInitResultList(e.dataSourceStep,i)}default:return r}}static dataCorrection(t,s,e,i){var n,r;try{const a=`step_${x.getStepInfo(e,i).step}`,c=g(t),u=g(s),f=(n=c[a])==null?void 0:n.result,p=(r=u[a])==null?void 0:r.result;if(!p||R.isEqual(f.sort(this.idCmp),p.sort(this.idCmp)))return t;const v=this.findDeletedIds(f,p);if(v.length===0)return t;const l=e,d=this.getStepKeys(c).sort();return this.deleteRes(c,l,v,d),JSON.stringify(c)}catch(o){return console.error(o),t}}static idCmp(t,s){const e=t.id,i=s.id;return e<i?-1:e>i?1:0}static findDeletedIds(t,s){return this.findDeletedItems(s,t).map(e=>e.id)}static findDeletedItems(t,s){const e=[];return t.forEach(i=>{s.some(r=>r.id===i.id)||e.push(i)}),e}static getStepKeys(t){return Object.keys(t).map(s=>parseInt(s.replace("step_",""),10)).filter(s=>!isNaN(s))}static deleteRes(t,s,e,i){i.forEach(n=>{if(n>s){const r=t[`step_${n}`];if([I.FolderTag,I.Segmentation].includes(r.tool))return;if(r.dataSourceStep===s){const o=[];r.result=r.result.filter(a=>e.includes(a.sourceID)?(o.push(a.id),!1):!0),this.deleteRes(t,n,o,i)}else r.result=r.result.filter(o=>!e.includes(o.sourceID))}})}}export{L as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@labelbee/lb-components",
3
- "version": "1.23.0-alpha.34",
3
+ "version": "1.23.0-alpha.35",
4
4
  "description": "Provide a complete library of annotation components",
5
5
  "main": "./dist/index.js",
6
6
  "es": "./es/index.js",