@labelbee/lb-components 1.17.1-alpha.1 → 1.17.1-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";var dom=require("../../utils/dom.js"),React=require("react"),PointCloudLayout=require("./PointCloudLayout.js"),PointCloudContext=require("./PointCloudContext.js"),reactRedux=require("react-redux"),lbAnnotation=require("@labelbee/lb-annotation"),ctx=require("../../store/ctx.js"),map=require("../../store/annotation/map.js"),lbUtils=require("@labelbee/lb-utils"),PointCloud2DSingleView=require("./PointCloud2DSingleView.js"),index=require("./components/TitleButton/index.js"),icons=require("@ant-design/icons"),classNames=require("classnames"),icon_esc=require("../../assets/annotation/common/icon_esc.svg.js"),icon_left_squareOutlined=require("../../assets/annotation/common/icon_left_squareOutlined.svg.js"),icon_right_squareOutlined=require("../../assets/annotation/common/icon_right_squareOutlined.svg.js");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,n,t)=>n in e?__defProp(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,__spreadValues=(e,n)=>{for(var t in n||(n={}))__hasOwnProp.call(n,t)&&__defNormalProp(e,t,n[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(n))__propIsEnum.call(n,t)&&__defNormalProp(e,t,n[t]);return e},__spreadProps=(e,n)=>__defProps(e,__getOwnPropDescs(n));const DEFAULT_GROUND_HEIGHT=-1.345,EKeyCode=lbAnnotation.cKeyCode.default,ContainerTitle=({showEnlarge:e,isEnlargeTopView:n,data:t,setIsEnlarge:b,setCurIndex:f,curIndex:y=0,index:w,annotations2d:v})=>n?React__default.default.createElement(index,{title:t==null?void 0:t.calName,style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}):e?React__default.default.createElement("div",{style:{display:"flex",alignItems:"center"}},React__default.default.createElement(icons.LeftOutlined,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{b(!1),f(void 0)}}),React__default.default.createElement("span",null,t==null?void 0:t.calName),React__default.default.createElement("span",{style:{marginLeft:"8px"}},y+1,"/",v==null?void 0:v.length)):React__default.default.createElement(index,{title:t==null?void 0:t.calName,onClick:()=>{b(!0),f(w)},style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}),PointCloud2DView=({currentData:e,config:n,thumbnailWidth:t,isEnlargeTopView:b,highlightAttribute:f,loadPCDFileLoading:y,checkMode:w})=>{var v;const[c,T]=React.useState([]),{topViewInstance:z,displayPointCloudList:L,polygonList:q,imageSizes:F,selectedIDs:O}=React.useContext(PointCloudContext.PointCloudContext),[x,H]=React.useState(""),[_,P]=React.useState(!1),[s,E]=React.useState(void 0);React.useEffect(()=>{var o;if(!y&&z&&(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(l=>{var m,j;const N=L.reduce((d,u)=>{var g,a;const C=u.id===x||f===u.attribute,{transferViewData:p,viewRangePointList:h}=(g=lbAnnotation.pointCloudLidar2image(u,l.calib,{createRange:C}))!=null?g:{};if(!p||!h)return[];const V=(a=lbUtils.toolStyleConverter.getColorFromConfig({attribute:u.attribute},__spreadProps(__spreadValues({},n),{attributeConfigurable:!0}),{}))==null?void 0:a.stroke,M=K({viewDataPointList:p,pointCloudBox:u,defaultViewStyle:i,stroke:V}),A=[...d,...M];return(h==null?void 0:h.length)>0&&A.unshift({type:"polygon",annotation:__spreadProps(__spreadValues({id:x,pointList:h},i),{stroke:V,fill:"rgba(255, 255, 255, 0.6)"})}),A},[]),R=F[(m=l==null?void 0:l.path)!=null?m:""];R&&q.forEach(d=>{const u=d.pointList.map(a=>{var C,p;return __spreadProps(__spreadValues({},a),{z:(p=(C=l==null?void 0:l.calib)==null?void 0:C.groundHeight)!=null?p:DEFAULT_GROUND_HEIGHT})}),g=lbAnnotation.pointListLidar2Img(u,l==null?void 0:l.calib,R);if(g){const a=lbUtils.toolStyleConverter.getColorFromConfig({attribute:d.attribute},__spreadProps(__spreadValues({},n),{attributeConfigurable:!0}),{});N.push({type:"polygon",annotation:__spreadProps(__spreadValues({id:d.id,pointList:g},i),{stroke:a==null?void 0:a.stroke,fill:O.includes(d.id)?a==null?void 0:a.fill:"rgba(255, 255, 255, 0.6)"})})}}),r.push({annotations:N,url:l==null?void 0:l.url,calName:(j=l==null?void 0:l.calib)==null?void 0:j.calName,calib:l==null?void 0:l.calib,path:l==null?void 0:l.path})}),T(r)}},[L,e==null?void 0:e.mappingImgList,x,f,y,q,F,O]),React.useEffect(()=>(window.addEventListener("keydown",I),()=>{window.removeEventListener("keydown",I)}),[s]);const I=o=>{const{keyCode:i}=o;switch(i){case EKeyCode.Esc:_&&P(!1);break;case EKeyCode.Left:S();break;case EKeyCode.Right:k();break}},S=()=>{s===void 0||!_||Number(s)>0&&E(s-1)},k=()=>{s===void 0||!_||Number(s)<(c==null?void 0:c.length)-1&&E(s+1)},K=({viewDataPointList:o,pointCloudBox:i,defaultViewStyle:r,stroke:l})=>o?o.map(m=>({type:m.type,annotation:__spreadProps(__spreadValues({id:i.id,pointList:m.pointList},r),{stroke:l})})):[],U=!e||!(e==null?void 0:e.mappingImgList)||!(((v=e==null?void 0:e.mappingImgList)==null?void 0:v.length)>0),G=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:()=>S()}),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:()=>k()}),React__default.default.createElement("img",{src:icon_esc,style:{height:"24px",margin:"0px 8px 0px 12px",cursor:"pointer"},onClick:()=>{P(!1),E(void 0)}}),React__default.default.createElement("span",null,"\u952E\u9000\u51FA"));return(c==null?void 0:c.length)>0?React__default.default.createElement(React__default.default.Fragment,null,c.map((o,i)=>{const r=_&&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:b,data:o,setIsEnlarge:P,setCurIndex:E,curIndex:s,index:i,annotations2d:c}),titleOnSurface:!r,style:{display:U?"none":"flex",width:r?"100%":t},key:i,toolbar:G},(o==null?void 0:o.annotations)&&(o==null?void 0:o.url)&&React__default.default.createElement(PointCloud2DSingleView,{currentData:e,view2dData:o,setSelectedID:H,showEnlarge:r,checkMode:w}))})):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=require("./components/TitleButton/index.js"),icons=require("@ant-design/icons"),classNames=require("classnames"),icon_esc=require("../../assets/annotation/common/icon_esc.svg.js"),icon_left_squareOutlined=require("../../assets/annotation/common/icon_left_squareOutlined.svg.js"),icon_right_squareOutlined=require("../../assets/annotation/common/icon_right_squareOutlined.svg.js"),_=require("lodash");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,l,t)=>l in e?__defProp(e,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[l]=t,__spreadValues=(e,l)=>{for(var t in l||(l={}))__hasOwnProp.call(l,t)&&__defNormalProp(e,t,l[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(l))__propIsEnum.call(l,t)&&__defNormalProp(e,t,l[t]);return e},__spreadProps=(e,l)=>__defProps(e,__getOwnPropDescs(l));const EKeyCode=lbAnnotation.cKeyCode.default,ContainerTitle=({showEnlarge:e,isEnlargeTopView:l,data:t,setIsEnlarge:p,setCurIndex:f,curIndex:b=0,index:w,annotations2d:v})=>l?React__default.default.createElement(index,{title:t==null?void 0:t.calName,style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}):e?React__default.default.createElement("div",{style:{display:"flex",alignItems:"center"}},React__default.default.createElement(icons.LeftOutlined,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{p(!1),f(void 0)}}),React__default.default.createElement("span",null,t==null?void 0:t.calName),React__default.default.createElement("span",{style:{marginLeft:"8px"}},b+1,"/",v==null?void 0:v.length)):React__default.default.createElement(index,{title:t==null?void 0:t.calName,onClick:()=>{p(!0),f(w)},style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}),PointCloud2DView=({currentData:e,config:l,thumbnailWidth:t,isEnlargeTopView:p,highlightAttribute:f,loadPCDFileLoading:b,checkMode:w})=>{var v;const[c,K]=React.useState([]),{topViewInstance:H,displayPointCloudList:L,polygonList:q,imageSizes:F,selectedIDs:O}=React.useContext(PointCloudContext.PointCloudContext),[x,M]=React.useState(""),[y,P]=React.useState(!1),[s,E]=React.useState(void 0);React.useEffect(()=>{var o;if(!b&&H&&(e==null?void 0:e.mappingImgList)&&((o=e==null?void 0:e.mappingImgList)==null?void 0:o.length)>0){const i={fill:"transparent",color:"green"};let r=[];e==null||e.mappingImgList.forEach(n=>{var m,j,N;const R=L.reduce((d,u)=>{var g,a;const C=u.id===x||f===u.attribute,{transferViewData:A,viewRangePointList:h}=(g=lbAnnotation.pointCloudLidar2image(u,n.calib,{createRange:C}))!=null?g:{};if(!A||!h)return[];const z=(a=lbUtils.toolStyleConverter.getColorFromConfig({attribute:u.attribute},__spreadProps(__spreadValues({},l),{attributeConfigurable:!0}),{}))==null?void 0:a.stroke,J=U({viewDataPointList:A,pointCloudBox:u,defaultViewStyle:i,stroke:z}),T=[...d,...J];return(h==null?void 0:h.length)>0&&T.unshift({type:"polygon",annotation:__spreadProps(__spreadValues({id:x,pointList:h},i),{stroke:z,fill:"rgba(255, 255, 255, 0.6)"})}),T},[]),V=F[(m=n==null?void 0:n.path)!=null?m:""];V&&_.isNumber((j=n==null?void 0:n.calib)==null?void 0:j.groundHeight)&&q.forEach(d=>{const u=d.pointList.map(a=>{var C;return __spreadProps(__spreadValues({},a),{z:(C=n==null?void 0:n.calib)==null?void 0:C.groundHeight})}),g=lbAnnotation.pointListLidar2Img(u,n==null?void 0:n.calib,V);if(g){const a=lbUtils.toolStyleConverter.getColorFromConfig({attribute:d.attribute},__spreadProps(__spreadValues({},l),{attributeConfigurable:!0}),{});R.push({type:"polygon",annotation:__spreadProps(__spreadValues({id:d.id,pointList:g},i),{stroke:a==null?void 0:a.stroke,fill:O.includes(d.id)?a==null?void 0:a.fill:"rgba(255, 255, 255, 0.6)"})})}}),r.push({annotations:R,url:n==null?void 0:n.url,calName:(N=n==null?void 0:n.calib)==null?void 0:N.calName,calib:n==null?void 0:n.calib,path:n==null?void 0:n.path})}),K(r)}},[L,e==null?void 0:e.mappingImgList,x,f,b,q,F,O]),React.useEffect(()=>(window.addEventListener("keydown",S),()=>{window.removeEventListener("keydown",S)}),[s]);const S=o=>{const{keyCode:i}=o;switch(i){case EKeyCode.Esc:y&&P(!1);break;case EKeyCode.Left:k();break;case EKeyCode.Right:I();break}},k=()=>{s===void 0||!y||Number(s)>0&&E(s-1)},I=()=>{s===void 0||!y||Number(s)<(c==null?void 0:c.length)-1&&E(s+1)},U=({viewDataPointList:o,pointCloudBox:i,defaultViewStyle:r,stroke:n})=>o?o.map(m=>({type:m.type,annotation:__spreadProps(__spreadValues({id:i.id,pointList:m.pointList},r),{stroke:n})})):[],$=!e||!(e==null?void 0:e.mappingImgList)||!(((v=e==null?void 0:e.mappingImgList)==null?void 0:v.length)>0),G=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:()=>I()}),React__default.default.createElement("img",{src:icon_esc,style:{height:"24px",margin:"0px 8px 0px 12px",cursor:"pointer"},onClick:()=>{P(!1),E(void 0)}}),React__default.default.createElement("span",null,"\u952E\u9000\u51FA"));return(c==null?void 0:c.length)>0?React__default.default.createElement(React__default.default.Fragment,null,c.map((o,i)=>{const r=y&&i===s;return React__default.default.createElement(PointCloudLayout.PointCloudContainer,{className:classNames__default.default({[dom.getClassName("point-cloud-2d-container")]:!0,[dom.getClassName("point-cloud-container","zoom")]:r}),title:React__default.default.createElement(ContainerTitle,{showEnlarge:r,isEnlargeTopView:p,data:o,setIsEnlarge:P,setCurIndex:E,curIndex:s,index:i,annotations2d:c}),titleOnSurface:!r,style:{display:$?"none":"flex",width:r?"100%":t},key:i,toolbar:G},(o==null?void 0:o.annotations)&&(o==null?void 0:o.url)&&React__default.default.createElement(PointCloud2DSingleView,{currentData:e,view2dData:o,setSelectedID:M,showEnlarge:r,checkMode:w}))})):null};var PointCloud2DView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloud2DView);module.exports=PointCloud2DView$1;
@@ -1 +1 @@
1
- import{getClassName as G}from"../../utils/dom.js";import n,{useState as x,useContext as oe,useEffect as U}from"react";import{PointCloudContainer as ne}from"./PointCloudLayout.js";import{PointCloudContext as ie}from"./PointCloudContext.js";import{connect as le}from"react-redux";import{cKeyCode as re,pointCloudLidar2image as se,pointListLidar2Img as ae}from"@labelbee/lb-annotation";import{LabelBeeContext as ue}from"../../store/ctx.js";import{a2MapStateToProps as ce}from"../../store/annotation/map.js";import{toolStyleConverter as M}from"@labelbee/lb-utils";import me from"./PointCloud2DSingleView.js";import J from"./components/TitleButton/index.js";import{LeftOutlined as de}from"@ant-design/icons";import pe from"classnames";import fe from"../../assets/annotation/common/icon_esc.svg.js";import ge from"../../assets/annotation/common/icon_left_squareOutlined.svg.js";import ve from"../../assets/annotation/common/icon_right_squareOutlined.svg.js";var be=Object.defineProperty,Ee=Object.defineProperties,ye=Object.getOwnPropertyDescriptors,Q=Object.getOwnPropertySymbols,_e=Object.prototype.hasOwnProperty,we=Object.prototype.propertyIsEnumerable,W=(e,o,t)=>o in e?be(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t,p=(e,o)=>{for(var t in o||(o={}))_e.call(o,t)&&W(e,t,o[t]);if(Q)for(var t of Q(o))we.call(o,t)&&W(e,t,o[t]);return e},f=(e,o)=>Ee(e,ye(o));const he=-1.345,k=re.default,Ce=({showEnlarge:e,isEnlargeTopView:o,data:t,setIsEnlarge:_,setCurIndex:g,curIndex:w=0,index:F,annotations2d:v})=>o?n.createElement(J,{title:t==null?void 0:t.calName,style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}):e?n.createElement("div",{style:{display:"flex",alignItems:"center"}},n.createElement(de,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{_(!1),g(void 0)}}),n.createElement("span",null,t==null?void 0:t.calName),n.createElement("span",{style:{marginLeft:"8px"}},w+1,"/",v==null?void 0:v.length)):n.createElement(J,{title:t==null?void 0:t.calName,onClick:()=>{_(!0),g(F)},style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}),Pe=({currentData:e,config:o,thumbnailWidth:t,isEnlargeTopView:_,highlightAttribute:g,loadPCDFileLoading:w,checkMode:F})=>{var v;const[m,X]=x([]),{topViewInstance:Y,displayPointCloudList:j,polygonList:S,imageSizes:N,selectedIDs:R}=oe(ie),[I,Z]=x(""),[h,O]=x(!1),[a,C]=x(void 0);U(()=>{var l;if(!w&&Y&&(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(i=>{var b,z;const H=j.reduce((d,c)=>{var E,u;const P=c.id===I||g===c.attribute,{transferViewData:y,viewRangePointList:L}=(E=se(c,i.calib,{createRange:P}))!=null?E:{};if(!y||!L)return[];const $=(u=M.getColorFromConfig({attribute:c.attribute},f(p({},o),{attributeConfigurable:!0}),{}))==null?void 0:u.stroke,te=B({viewDataPointList:y,pointCloudBox:c,defaultViewStyle:r,stroke:$}),q=[...d,...te];return(L==null?void 0:L.length)>0&&q.unshift({type:"polygon",annotation:f(p({id:I,pointList:L},r),{stroke:$,fill:"rgba(255, 255, 255, 0.6)"})}),q},[]),K=N[(b=i==null?void 0:i.path)!=null?b:""];K&&S.forEach(d=>{const c=d.pointList.map(u=>{var P,y;return f(p({},u),{z:(y=(P=i==null?void 0:i.calib)==null?void 0:P.groundHeight)!=null?y:he})}),E=ae(c,i==null?void 0:i.calib,K);if(E){const u=M.getColorFromConfig({attribute:d.attribute},f(p({},o),{attributeConfigurable:!0}),{});H.push({type:"polygon",annotation:f(p({id:d.id,pointList:E},r),{stroke:u==null?void 0:u.stroke,fill:R.includes(d.id)?u==null?void 0:u.fill:"rgba(255, 255, 255, 0.6)"})})}}),s.push({annotations:H,url:i==null?void 0:i.url,calName:(z=i==null?void 0:i.calib)==null?void 0:z.calName,calib:i==null?void 0:i.calib,path:i==null?void 0:i.path})}),X(s)}},[j,e==null?void 0:e.mappingImgList,I,g,w,S,N,R]),U(()=>(window.addEventListener("keydown",V),()=>{window.removeEventListener("keydown",V)}),[a]);const V=l=>{const{keyCode:r}=l;switch(r){case k.Esc:h&&O(!1);break;case k.Left:A();break;case k.Right:T();break}},A=()=>{a===void 0||!h||Number(a)>0&&C(a-1)},T=()=>{a===void 0||!h||Number(a)<(m==null?void 0:m.length)-1&&C(a+1)},B=({viewDataPointList:l,pointCloudBox:r,defaultViewStyle:s,stroke:i})=>l?l.map(b=>({type:b.type,annotation:f(p({id:r.id,pointList:b.pointList},s),{stroke:i})})):[],D=!e||!(e==null?void 0:e.mappingImgList)||!(((v=e==null?void 0:e.mappingImgList)==null?void 0:v.length)>0),ee=n.createElement("div",{style:{display:"flex",alignItems:"center",fontSize:"14px"}},n.createElement("img",{src:ge,style:{height:"24px",marginRight:"8px",cursor:"pointer"},onClick:()=>A()}),n.createElement("span",{style:{marginRight:"12px"}},"\u952E\u76D8\u5DE6\u952E\u4E0A\u4E00\u5F20"),n.createElement("span",{style:{margin:"0px 8px 0px 12px"}},"\u952E\u76D8\u53F3\u952E\u4E0A\u4E00\u5F20"),n.createElement("img",{src:ve,style:{height:"24px",marginRight:"12px",cursor:"pointer"},onClick:()=>T()}),n.createElement("img",{src:fe,style:{height:"24px",margin:"0px 8px 0px 12px",cursor:"pointer"},onClick:()=>{O(!1),C(void 0)}}),n.createElement("span",null,"\u952E\u9000\u51FA"));return(m==null?void 0:m.length)>0?n.createElement(n.Fragment,null,m.map((l,r)=>{const s=h&&r===a;return n.createElement(ne,{className:pe({[G("point-cloud-2d-container")]:!0,[G("point-cloud-container","zoom")]:s}),title:n.createElement(Ce,{showEnlarge:s,isEnlargeTopView:_,data:l,setIsEnlarge:O,setCurIndex:C,curIndex:a,index:r,annotations2d:m}),titleOnSurface:!s,style:{display:D?"none":"flex",width:s?"100%":t},key:r,toolbar:ee},(l==null?void 0:l.annotations)&&(l==null?void 0:l.url)&&n.createElement(me,{currentData:e,view2dData:l,setSelectedID:Z,showEnlarge:s,checkMode:F}))})):null};var Le=le(ce,null,null,{context:ue})(Pe);export{Le as default};
1
+ import{getClassName as G}from"../../utils/dom.js";import i,{useState as L,useContext as ne,useEffect as J}from"react";import{PointCloudContainer as ie}from"./PointCloudLayout.js";import{PointCloudContext as le}from"./PointCloudContext.js";import{connect as re}from"react-redux";import{cKeyCode as se,pointCloudLidar2image as ae,pointListLidar2Img as ue}from"@labelbee/lb-annotation";import{LabelBeeContext as ce}from"../../store/ctx.js";import{a2MapStateToProps as de}from"../../store/annotation/map.js";import{toolStyleConverter as Q}from"@labelbee/lb-utils";import me from"./PointCloud2DSingleView.js";import U from"./components/TitleButton/index.js";import{LeftOutlined as pe}from"@ant-design/icons";import fe from"classnames";import ge from"../../assets/annotation/common/icon_esc.svg.js";import ve from"../../assets/annotation/common/icon_left_squareOutlined.svg.js";import be from"../../assets/annotation/common/icon_right_squareOutlined.svg.js";import{isNumber as ye}from"lodash";var Ee=Object.defineProperty,he=Object.defineProperties,we=Object.getOwnPropertyDescriptors,W=Object.getOwnPropertySymbols,_e=Object.prototype.hasOwnProperty,Ce=Object.prototype.propertyIsEnumerable,X=(e,n,t)=>n in e?Ee(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,p=(e,n)=>{for(var t in n||(n={}))_e.call(n,t)&&X(e,t,n[t]);if(W)for(var t of W(n))Ce.call(n,t)&&X(e,t,n[t]);return e},f=(e,n)=>he(e,we(n));const I=se.default,Pe=({showEnlarge:e,isEnlargeTopView:n,data:t,setIsEnlarge:E,setCurIndex:g,curIndex:h=0,index:x,annotations2d:v})=>n?i.createElement(U,{title:t==null?void 0:t.calName,style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}):e?i.createElement("div",{style:{display:"flex",alignItems:"center"}},i.createElement(pe,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{E(!1),g(void 0)}}),i.createElement("span",null,t==null?void 0:t.calName),i.createElement("span",{style:{marginLeft:"8px"}},h+1,"/",v==null?void 0:v.length)):i.createElement(U,{title:t==null?void 0:t.calName,onClick:()=>{E(!0),g(x)},style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}),Le=({currentData:e,config:n,thumbnailWidth:t,isEnlargeTopView:E,highlightAttribute:g,loadPCDFileLoading:h,checkMode:x})=>{var v;const[d,Y]=L([]),{topViewInstance:Z,displayPointCloudList:O,polygonList:j,imageSizes:S,selectedIDs:N}=ne(le),[F,B]=L(""),[w,k]=L(!1),[a,_]=L(void 0);J(()=>{var l;if(!h&&Z&&(e==null?void 0:e.mappingImgList)&&((l=e==null?void 0:e.mappingImgList)==null?void 0:l.length)>0){const r={fill:"transparent",color:"green"};let s=[];e==null||e.mappingImgList.forEach(o=>{var b,z,T;const K=O.reduce((m,c)=>{var y,u;const C=c.id===F||g===c.attribute,{transferViewData:q,viewRangePointList:P}=(y=ae(c,o.calib,{createRange:C}))!=null?y:{};if(!q||!P)return[];const H=(u=Q.getColorFromConfig({attribute:c.attribute},f(p({},n),{attributeConfigurable:!0}),{}))==null?void 0:u.stroke,oe=D({viewDataPointList:q,pointCloudBox:c,defaultViewStyle:r,stroke:H}),M=[...m,...oe];return(P==null?void 0:P.length)>0&&M.unshift({type:"polygon",annotation:f(p({id:F,pointList:P},r),{stroke:H,fill:"rgba(255, 255, 255, 0.6)"})}),M},[]),$=S[(b=o==null?void 0:o.path)!=null?b:""];$&&ye((z=o==null?void 0:o.calib)==null?void 0:z.groundHeight)&&j.forEach(m=>{const c=m.pointList.map(u=>{var C;return f(p({},u),{z:(C=o==null?void 0:o.calib)==null?void 0:C.groundHeight})}),y=ue(c,o==null?void 0:o.calib,$);if(y){const u=Q.getColorFromConfig({attribute:m.attribute},f(p({},n),{attributeConfigurable:!0}),{});K.push({type:"polygon",annotation:f(p({id:m.id,pointList:y},r),{stroke:u==null?void 0:u.stroke,fill:N.includes(m.id)?u==null?void 0:u.fill:"rgba(255, 255, 255, 0.6)"})})}}),s.push({annotations:K,url:o==null?void 0:o.url,calName:(T=o==null?void 0:o.calib)==null?void 0:T.calName,calib:o==null?void 0:o.calib,path:o==null?void 0:o.path})}),Y(s)}},[O,e==null?void 0:e.mappingImgList,F,g,h,j,S,N]),J(()=>(window.addEventListener("keydown",V),()=>{window.removeEventListener("keydown",V)}),[a]);const V=l=>{const{keyCode:r}=l;switch(r){case I.Esc:w&&k(!1);break;case I.Left:R();break;case I.Right:A();break}},R=()=>{a===void 0||!w||Number(a)>0&&_(a-1)},A=()=>{a===void 0||!w||Number(a)<(d==null?void 0:d.length)-1&&_(a+1)},D=({viewDataPointList:l,pointCloudBox:r,defaultViewStyle:s,stroke:o})=>l?l.map(b=>({type:b.type,annotation:f(p({id:r.id,pointList:b.pointList},s),{stroke:o})})):[],ee=!e||!(e==null?void 0:e.mappingImgList)||!(((v=e==null?void 0:e.mappingImgList)==null?void 0:v.length)>0),te=i.createElement("div",{style:{display:"flex",alignItems:"center",fontSize:"14px"}},i.createElement("img",{src:ve,style:{height:"24px",marginRight:"8px",cursor:"pointer"},onClick:()=>R()}),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:be,style:{height:"24px",marginRight:"12px",cursor:"pointer"},onClick:()=>A()}),i.createElement("img",{src:ge,style:{height:"24px",margin:"0px 8px 0px 12px",cursor:"pointer"},onClick:()=>{k(!1),_(void 0)}}),i.createElement("span",null,"\u952E\u9000\u51FA"));return(d==null?void 0:d.length)>0?i.createElement(i.Fragment,null,d.map((l,r)=>{const s=w&&r===a;return i.createElement(ie,{className:fe({[G("point-cloud-2d-container")]:!0,[G("point-cloud-container","zoom")]:s}),title:i.createElement(Pe,{showEnlarge:s,isEnlargeTopView:E,data:l,setIsEnlarge:k,setCurIndex:_,curIndex:a,index:r,annotations2d:d}),titleOnSurface:!s,style:{display:ee?"none":"flex",width:s?"100%":t},key:r,toolbar:te},(l==null?void 0:l.annotations)&&(l==null?void 0:l.url)&&i.createElement(me,{currentData:e,view2dData:l,setSelectedID:B,showEnlarge:s,checkMode:x}))})):null};var xe=re(de,null,null,{context:ce})(Le);export{xe as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@labelbee/lb-components",
3
- "version": "1.17.1-alpha.1",
3
+ "version": "1.17.1-alpha.2",
4
4
  "description": "Provide a complete library of annotation components",
5
5
  "main": "./dist/index.js",
6
6
  "es": "./es/index.js",