@labelbee/lb-components 1.14.0-alpha.5 → 1.14.0-alpha.7

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 React=require("react"),antd=require("antd"),icon_defaultSize=require("../../../../assets/toolStyle/icon_defaultSize.svg.js"),reactI18next=require("react-i18next");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const LimitPopover=({limit:e,updateSize:a})=>{var n,u;const{t}=reactI18next.useTranslation(),l=(n=e==null?void 0:e.sizeLimit)==null?void 0:n.defaultSize,i=(u=e==null?void 0:e.sizeLimit)==null?void 0:u.sizeRange,r=e==null?void 0:e.positionLimit,{heightDefault:d,depthDefault:o,widthDefault:c}=l||{},{heightMax:s,heightMin:m,depthMax:f,depthMin:p,widthMax:v,widthMin:$}=i||{},{XMin:g,XMax:h,YMin:E,YMax:x,ZMin:M,ZMax:z}=r||{};return React__default.default.createElement(antd.Tooltip,{color:"rgba(0, 0, 0, 0.75)",title:React__default.default.createElement("div",{style:{padding:"8px"}},l&&React__default.default.createElement("div",{style:{marginBottom:"24px"}},React__default.default.createElement("div",null,"\u3010",t("DefaultSize"),"\u3011"),React__default.default.createElement("span",null,`${t("Length")}: ${c}m\u3001`),React__default.default.createElement("span",null,`${t("Width")}: ${d}m\u3001`),React__default.default.createElement("span",null,`${t("Height")}: ${o}m`)),i&&React__default.default.createElement("div",{style:{marginBottom:"24px"}},React__default.default.createElement("div",null,"*",t("NormalSizeRange")),React__default.default.createElement("span",null,`${t("Length")}: ${$}~${v}m\u3001`),React__default.default.createElement("span",null,`${t("Width")}: ${m}~${s}m\u3001`),React__default.default.createElement("span",null,`${t("Height")}: ${p}~${f}m`)),r&&React__default.default.createElement("div",null,React__default.default.createElement("div",null,"*",t("NormalCenterPointRange")),React__default.default.createElement("span",null,`X: ${g}~${h}\u3001`),React__default.default.createElement("span",null,`Y: ${E}~${x}\u3001`),React__default.default.createElement("span",null,`Z: ${M}~${z}`))),placement:"bottomRight"},React__default.default.createElement("img",{src:icon_defaultSize,style:{margin:"0px 8px"},onClick:L=>{L.preventDefault(),l&&(a==null||a(l))}}))};module.exports=LimitPopover;
1
+ "use strict";var React=require("react"),antd=require("antd"),icon_defaultSize=require("../../../../assets/toolStyle/icon_defaultSize.svg.js"),reactI18next=require("react-i18next");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const LimitPopover=({limit:e,updateSize:i})=>{var o,r,d,c;const{t}=reactI18next.useTranslation(),s={and:t("And"),or:t("Or")},n=(o=e==null?void 0:e.sizeLimit)==null?void 0:o.defaultSize,a=(r=e==null?void 0:e.sizeLimit)==null?void 0:r.sizeRange,u=((d=e==null?void 0:e.sizeLimit)==null?void 0:d.logicalCondition)||[],m=e==null?void 0:e.positionLimit,{heightDefault:h,depthDefault:p,widthDefault:v}=n||{},{heightMax:$,heightMin:E,depthMax:x,depthMin:L,widthMax:M,widthMin:z}=a||{},{XMin:_,XMax:R,YMin:y,YMax:S,ZMin:T,ZMax:w}=m||{},D=u.length>0||a,f=l=>{switch(l){case"width":return t("Length");case"height":return t("Width");case"depth":return t("Height")}return""};return React__default.default.createElement(antd.Tooltip,{color:"rgba(0, 0, 0, 0.75)",title:React__default.default.createElement("div",{style:{padding:"8px"}},n&&React__default.default.createElement("div",{style:{marginBottom:"24px"}},React__default.default.createElement("div",null,"\u3010",t("DefaultSize"),"\u3011"),React__default.default.createElement("span",null,`${t("Length")}: ${v}m\u3001`),React__default.default.createElement("span",null,`${t("Width")}: ${h}m\u3001`),React__default.default.createElement("span",null,`${t("Height")}: ${p}m`)),D&&React__default.default.createElement("div",{style:{marginBottom:"24px"}},React__default.default.createElement("div",null,"*",t("NormalSizeRange")),a&&React__default.default.createElement("span",null,"(",React__default.default.createElement("span",null,`${t("Length")}: ${z}~${M}m\u3001`),React__default.default.createElement("span",null,`${t("Width")}: ${E}~${$}m\u3001`),React__default.default.createElement("span",null,`${t("Height")}: ${L}~${x}m`),")"),u.length>0&&React__default.default.createElement(React__default.default.Fragment,null,a?` ${s[(c=u[0])==null?void 0:c.logical]} `:null,React__default.default.createElement("span",null,"(",u.map((l,g)=>{const C=f(l==null?void 0:l.dimensionLeft),b=f(l==null?void 0:l.dimensionRight);return React__default.default.createElement("span",{key:g},g!==0?` ${s[l==null?void 0:l.logical]} `:null,`${C} ${l==null?void 0:l.condition} ${b} `)}),")"))),m&&React__default.default.createElement("div",null,React__default.default.createElement("div",null,"*",t("NormalCenterPointRange")),React__default.default.createElement("span",null,`X: ${_}~${R}\u3001`),React__default.default.createElement("span",null,`Y: ${y}~${S}\u3001`),React__default.default.createElement("span",null,`Z: ${T}~${w}`))),placement:"bottomRight"},React__default.default.createElement("img",{src:icon_defaultSize,style:{margin:"0px 8px"},onClick:l=>{l.preventDefault(),n&&(i==null||i(n))}}))};module.exports=LimitPopover;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Style=require("../../data/Style.js"),index$1=require("../colorTag/index.js"),es=require("antd/es"),React=require("react"),antd=require("antd"),index=require("../colorPalette/index.js"),icons=require("@ant-design/icons"),reactI18next=require("react-i18next"),index$2=require("./components/limitPopover/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const ATTRIBUTE_COLORS=[Style.NULL_COLOR].concat(Style.COLORS_ARRAY),AttributeList=React__default.default.forwardRef((e,c)=>{const f=React__default.default.useRef(),{t:s}=reactI18next.useTranslation(),v=e.list||[],[m,r]=React.useState(!1),[C,b]=React.useState(void 0);let n=[...ATTRIBUTE_COLORS];e.forbidDefault===!0&&(n=n.slice(1));let o="sensebee-radio-group";e.noHeightLimit&&(o="sensebee-radio-group-no-limit-height");const R=(t,l)=>{e.updateColorConfig&&e.updateColorConfig(t,l)};return React__default.default.createElement("div",{className:o,style:e.style},React__default.default.createElement(es.Radio.Group,{name:"radiogroup",defaultValue:e==null?void 0:e.selectedAttribute,value:e==null?void 0:e.selectedAttribute,onChange:t=>e.attributeChanged(t.target.value),ref:c},v.map((t,l)=>{var d;let a=(d=e==null?void 0:e.num)!=null?d:l;const g=(t==null?void 0:t.value)===(e==null?void 0:e.selectedAttribute);e.forbidDefault===!0&&typeof a=="number"&&a++,typeof a=="number"&&a<=9&&a>=0||(a="-");let u=l>8&&!e.forbidDefault?Style.COLORS_ARRAY[(l-1)%Style.COLORS_ARRAY.length]:n[l%n.length];return(t==null?void 0:t.color)&&(u=t.color),React__default.default.createElement(es.Radio,{value:t.value,ref:f,key:t.label+l},React__default.default.createElement("span",{className:"sensebee-radio-label",title:t.label},!(e==null?void 0:e.forbidColor)&&React__default.default.createElement(antd.Popover,{content:React__default.default.createElement(index,{defaultColor:u,setColor:i=>R(t.value,i)}),title:React__default.default.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},React__default.default.createElement("span",null,s("Palette")),React__default.default.createElement(icons.CloseOutlined,{onClick:()=>r(!1)})),visible:m&&C===l,onVisibleChange:i=>{!i||r(i)}},React__default.default.createElement(index$1.ColorTag,{color:u,style:{cursor:"pointer",marginRight:"8px"},onClick:()=>{(e==null?void 0:e.enableColorPicker)&&(b(l),r(!0))}})),t.label),(t==null?void 0:t.limit)&&g&&React__default.default.createElement(index$2,{limit:t.limit,updateSize:e==null?void 0:e.updateSize}),React__default.default.createElement("span",{className:"sensebee-radio-num"},a))})))});exports.ATTRIBUTE_COLORS=ATTRIBUTE_COLORS,exports.default=AttributeList;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Style=require("../../data/Style.js"),index$1=require("../colorTag/index.js"),es=require("antd/es"),React=require("react"),antd=require("antd"),index=require("../colorPalette/index.js"),icons=require("@ant-design/icons"),reactI18next=require("react-i18next"),index$2=require("./components/limitPopover/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const ATTRIBUTE_COLORS=[Style.NULL_COLOR].concat(Style.COLORS_ARRAY),AttributeList=React__default.default.forwardRef((e,v)=>{const m=React__default.default.useRef(),{t:C}=reactI18next.useTranslation(),b=e.list||[],[g,o]=React.useState(!1),[R,E]=React.useState(void 0);let i=[...ATTRIBUTE_COLORS];e.forbidDefault===!0&&(i=i.slice(1));let r="sensebee-radio-group";e.noHeightLimit&&(r="sensebee-radio-group-no-limit-height");const L=(t,l)=>{e.updateColorConfig&&e.updateColorConfig(t,l)};return React__default.default.createElement("div",{className:r,style:e.style},React__default.default.createElement(es.Radio.Group,{name:"radiogroup",defaultValue:e==null?void 0:e.selectedAttribute,value:e==null?void 0:e.selectedAttribute,onChange:t=>e.attributeChanged(t.target.value),ref:v},b.map((t,l)=>{var d,c,s;let a=(d=e==null?void 0:e.num)!=null?d:l;const O=(t==null?void 0:t.value)===(e==null?void 0:e.selectedAttribute);e.forbidDefault===!0&&typeof a=="number"&&a++,typeof a=="number"&&a<=9&&a>=0||(a="-");let u=l>8&&!e.forbidDefault?Style.COLORS_ARRAY[(l-1)%Style.COLORS_ARRAY.length]:i[l%i.length];(t==null?void 0:t.color)&&(u=t.color);const{defaultSize:_,logicalCondition:f,sizeRange:h}=((c=t==null?void 0:t.limit)==null?void 0:c.sizeLimit)||{},y=((s=t==null?void 0:t.limit)==null?void 0:s.positionLimit)||_||h||(f==null?void 0:f.length)>0,A=O&&y;return React__default.default.createElement(es.Radio,{value:t.value,ref:m,key:t.label+l},React__default.default.createElement("span",{className:"sensebee-radio-label",title:t.label},!(e==null?void 0:e.forbidColor)&&React__default.default.createElement(antd.Popover,{content:React__default.default.createElement(index,{defaultColor:u,setColor:n=>L(t.value,n)}),title:React__default.default.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},React__default.default.createElement("span",null,C("Palette")),React__default.default.createElement(icons.CloseOutlined,{onClick:()=>o(!1)})),visible:g&&R===l,onVisibleChange:n=>{!n||o(n)}},React__default.default.createElement(index$1.ColorTag,{color:u,style:{cursor:"pointer",marginRight:"8px"},onClick:()=>{(e==null?void 0:e.enableColorPicker)&&(E(l),o(!0))}})),t.label),A&&React__default.default.createElement(index$2,{limit:t.limit,updateSize:e==null?void 0:e.updateSize}),React__default.default.createElement("span",{className:"sensebee-radio-num"},a))})))});exports.ATTRIBUTE_COLORS=ATTRIBUTE_COLORS,exports.default=AttributeList;
@@ -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$1=require("./components/HighlightVisible/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__async=(e,r,t)=>new Promise((c,o)=>{var l=n=>{try{s(t.next(n))}catch(a){o(a)}},i=n=>{try{s(t.throw(n))}catch(a){o(a)}},s=n=>n.done?c(n.value):Promise.resolve(n.value).then(l,i);s((t=t.apply(e,r)).next())});const PointCloud2DSingleView=({view2dData:e,setSelectedID:r,currentData:t})=>{var c;const o=React.useRef(null),l=React.useRef(),{selectedBox:i}=useSingleBox.useSingleBox(),s=useSize(o),{url:n,calib:a}=e,{toggle2dVisible:p,isHighlightVisible:b}=useHighlight.useHighlight({currentData:t}),[x,g]=React.useState(!1),y=!e,S=f=>{d()},d=React.useCallback(()=>{var f,h;const v=(f=l.current)==null?void 0:f.toolInstance;if(r(""),!i||!v)return;const u=e.annotations.find(j=>j.annotation.id===i.info.id);let m="";u&&((h=u==null?void 0:u.annotation.pointList)==null?void 0:h.length)>0&&(v.focusPositionByPointList(u==null?void 0:u.annotation.pointList),m=i.info.id,r(m))},[i,l.current,e.annotations]);React.useEffect(()=>{d()},[d]);const _=()=>__async(void 0,null,function*(){g(!0),yield p(n,a),g(!1)});return React__default.default.createElement("div",{className:dom.getClassName("point-cloud-2d-image"),ref:o},React__default.default.createElement(index,{src:(c=e==null?void 0:e.url)!=null?c:"",annotations:e.annotations,size:s,ref:l,globalStyle:{display:y?"none":"block"},afterImgOnLoad:S,zoomInfo:{min:.01,max:1e3,ratio:.4}}),React__default.default.createElement(index$1,{visible:b(n),onClick:_,loading:x,style:{position:"absolute",right:16,top:16}}))};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$1=require("./components/HighlightVisible/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__async=(e,u,i)=>new Promise((c,l)=>{var r=n=>{try{t(i.next(n))}catch(o){l(o)}},s=n=>{try{t(i.throw(n))}catch(o){l(o)}},t=n=>n.done?c(n.value):Promise.resolve(n.value).then(r,s);t((i=i.apply(e,u)).next())});const PointCloud2DSingleView=({view2dData:e,setSelectedID:u,currentData:i,showEnlarge:c})=>{var l;const r=React.useRef(null),s=React.useRef(),{selectedBox:t}=useSingleBox.useSingleBox(),n=useSize(r),{url:o,calib:p}=e,{toggle2dVisible:x,isHighlightVisible:b}=useHighlight.useHighlight({currentData:i}),[y,g]=React.useState(!1),S=!e,_=f=>{d()},d=React.useCallback(()=>{var f,h;const v=(f=s.current)==null?void 0:f.toolInstance;if(u(""),!t||!v)return;const a=e.annotations.find(k=>k.annotation.id===t.info.id);let m="";a&&((h=a==null?void 0:a.annotation.pointList)==null?void 0:h.length)>0&&(v.focusPositionByPointList(a==null?void 0:a.annotation.pointList),m=t.info.id,u(m))},[t,s.current,e.annotations]);React.useEffect(()=>{d()},[d]);const j=()=>__async(void 0,null,function*(){g(!0),yield x(o,p),g(!1)});return React__default.default.createElement("div",{className:dom.getClassName("point-cloud-2d-image"),ref:r},React__default.default.createElement(index,{src:(l=e==null?void 0:e.url)!=null?l:"",annotations:e.annotations,size:n,ref:s,globalStyle:{display:S?"none":"block"},afterImgOnLoad:_,zoomInfo:{min:.01,max:1e3,ratio:.4}}),React__default.default.createElement(index$1,{visible:b(o),onClick:j,loading:y,style:{position:"absolute",right:16,top:16,zIndex:c?-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=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 EKeyCode=lbAnnotation.cKeyCode.default,ContainerTitle=({showEnlarge:e,isEnlargeTopView:n,data:t,setIsEnlarge:f,setCurIndex:u,curIndex:p=0,index:a,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:()=>{f(!1),u(void 0)}}),React__default.default.createElement("span",null,t==null?void 0:t.calName),React__default.default.createElement("span",{style:{marginLeft:"8px"}},p+1,"/",v==null?void 0:v.length)):React__default.default.createElement(index,{title:t==null?void 0:t.calName,onClick:()=>{f(!0),u(a)},style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}),PointCloud2DView=({currentData:e,config:n,thumbnailWidth:t,isEnlargeTopView:f,highlightAttribute:u})=>{var p;const[a,v]=React.useState([]),{topViewInstance:q,displayPointCloudList:b}=React.useContext(PointCloudContext.PointCloudContext),[y,F]=React.useState(""),[m,E]=React.useState(!1),[r,g]=React.useState(void 0);React.useEffect(()=>{var l;if(q&&(e==null?void 0:e.mappingImgList)&&((l=e==null?void 0:e.mappingImgList)==null?void 0:l.length)>0){const o={fill:"transparent",color:"green"};let i=[];e==null||e.mappingImgList.forEach(s=>{var c;const I=b.reduce((S,d)=>{var C;const N=d.id===y||u===d.attribute,{transferViewData:R,viewRangePointList:_}=lbAnnotation.pointCloudLidar2image(d,s.calib,{createRange:N}),h=(C=lbUtils.toolStyleConverter.getColorFromConfig({attribute:d.attribute},__spreadProps(__spreadValues({},n),{attributeConfigurable:!0}),{}))==null?void 0:C.stroke,V=O({viewDataPointList:R,pointCloudBox:d,defaultViewStyle:o,stroke:h}),L=[...S,...V];return(_==null?void 0:_.length)>0&&L.push({type:"polygon",annotation:__spreadProps(__spreadValues({id:y,pointList:_},o),{stroke:h,fill:"rgba(255, 255, 255, 0.6)"})}),L},[]);i.push({annotations:I,url:s==null?void 0:s.url,calName:(c=s.calib)==null?void 0:c.calName,calib:s==null?void 0:s.calib})}),v(i)}},[b,e==null?void 0:e.mappingImgList,y,u]),React.useEffect(()=>(window.addEventListener("keydown",w),()=>{window.removeEventListener("keydown",w)}),[r]);const w=l=>{const{keyCode:o}=l;switch(o){case EKeyCode.Esc:m&&E(!1);break;case EKeyCode.Left:P();break;case EKeyCode.Right:x();break}},P=()=>{r===void 0||!m||Number(r)>0&&g(r-1)},x=()=>{r===void 0||!m||Number(r)<(a==null?void 0:a.length)-1&&g(r+1)},O=({viewDataPointList:l,pointCloudBox:o,defaultViewStyle:i,stroke:s})=>l.map(c=>({type:c.type,annotation:__spreadProps(__spreadValues({id:o.id,pointList:c.pointList},i),{stroke:s})})),j=!e||!(e==null?void 0:e.mappingImgList)||!(((p=e==null?void 0:e.mappingImgList)==null?void 0:p.length)>0),k=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:()=>P()}),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:()=>x()}),React__default.default.createElement("img",{src:icon_esc,style:{height:"24px",margin:"0px 8px 0px 12px",cursor:"pointer"},onClick:()=>{E(!1),g(void 0)}}),React__default.default.createElement("span",null,"\u952E\u9000\u51FA"));return(a==null?void 0:a.length)>0?React__default.default.createElement(React__default.default.Fragment,null,a.map((l,o)=>{const i=m&&o===r;return React__default.default.createElement(PointCloudLayout.PointCloudContainer,{className:classNames__default.default({[dom.getClassName("point-cloud-2d-container")]:!0,[dom.getClassName("point-cloud-container","zoom")]:i}),title:React__default.default.createElement(ContainerTitle,{showEnlarge:i,isEnlargeTopView:f,data:l,setIsEnlarge:E,setCurIndex:g,curIndex:r,index:o,annotations2d:a}),titleOnSurface:!i,style:{display:j?"none":"flex",width:i?"100%":t},key:o,toolbar:k},(l==null?void 0:l.annotations)&&(l==null?void 0:l.url)&&React__default.default.createElement(PointCloud2DSingleView,{currentData:e,view2dData:l,setSelectedID:F}))})):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");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 EKeyCode=lbAnnotation.cKeyCode.default,ContainerTitle=({showEnlarge:e,isEnlargeTopView:n,data:t,setIsEnlarge:f,setCurIndex:u,curIndex:p=0,index:v,annotations2d:i})=>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:()=>{f(!1),u(void 0)}}),React__default.default.createElement("span",null,t==null?void 0:t.calName),React__default.default.createElement("span",{style:{marginLeft:"8px"}},p+1,"/",i==null?void 0:i.length)):React__default.default.createElement(index,{title:t==null?void 0:t.calName,onClick:()=>{f(!0),u(v)},style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}),PointCloud2DView=({currentData:e,config:n,thumbnailWidth:t,isEnlargeTopView:f,highlightAttribute:u,loadPCDFileLoading:p})=>{var v;const[i,q]=React.useState([]),{topViewInstance:O,displayPointCloudList:b}=React.useContext(PointCloudContext.PointCloudContext),[y,F]=React.useState(""),[m,E]=React.useState(!1),[a,g]=React.useState(void 0);React.useEffect(()=>{var l;if(!p&&O&&(e==null?void 0:e.mappingImgList)&&((l=e==null?void 0:e.mappingImgList)==null?void 0:l.length)>0){const o={fill:"transparent",color:"green"};let r=[];e==null||e.mappingImgList.forEach(s=>{var c;const S=b.reduce((N,d)=>{var C;const R=d.id===y||u===d.attribute,{transferViewData:V,viewRangePointList:_}=lbAnnotation.pointCloudLidar2image(d,s.calib,{createRange:R}),h=(C=lbUtils.toolStyleConverter.getColorFromConfig({attribute:d.attribute},__spreadProps(__spreadValues({},n),{attributeConfigurable:!0}),{}))==null?void 0:C.stroke,A=j({viewDataPointList:V,pointCloudBox:d,defaultViewStyle:o,stroke:h}),L=[...N,...A];return(_==null?void 0:_.length)>0&&L.push({type:"polygon",annotation:__spreadProps(__spreadValues({id:y,pointList:_},o),{stroke:h,fill:"rgba(255, 255, 255, 0.6)"})}),L},[]);r.push({annotations:S,url:s==null?void 0:s.url,calName:(c=s.calib)==null?void 0:c.calName,calib:s==null?void 0:s.calib})}),q(r)}},[b,e==null?void 0:e.mappingImgList,y,u,p]),React.useEffect(()=>(window.addEventListener("keydown",w),()=>{window.removeEventListener("keydown",w)}),[a]);const w=l=>{const{keyCode:o}=l;switch(o){case EKeyCode.Esc:m&&E(!1);break;case EKeyCode.Left:x();break;case EKeyCode.Right:P();break}},x=()=>{a===void 0||!m||Number(a)>0&&g(a-1)},P=()=>{a===void 0||!m||Number(a)<(i==null?void 0:i.length)-1&&g(a+1)},j=({viewDataPointList:l,pointCloudBox:o,defaultViewStyle:r,stroke:s})=>l.map(c=>({type:c.type,annotation:__spreadProps(__spreadValues({id:o.id,pointList:c.pointList},r),{stroke:s})})),k=!e||!(e==null?void 0:e.mappingImgList)||!(((v=e==null?void 0:e.mappingImgList)==null?void 0:v.length)>0),I=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:()=>x()}),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:()=>P()}),React__default.default.createElement("img",{src:icon_esc,style:{height:"24px",margin:"0px 8px 0px 12px",cursor:"pointer"},onClick:()=>{E(!1),g(void 0)}}),React__default.default.createElement("span",null,"\u952E\u9000\u51FA"));return(i==null?void 0:i.length)>0?React__default.default.createElement(React__default.default.Fragment,null,i.map((l,o)=>{const r=m&&o===a;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:f,data:l,setIsEnlarge:E,setCurIndex:g,curIndex:a,index:o,annotations2d:i}),titleOnSurface:!r,style:{display:k?"none":"flex",width:r?"100%":t},key:o,toolbar:I},(l==null?void 0:l.annotations)&&(l==null?void 0:l.url)&&React__default.default.createElement(PointCloud2DSingleView,{currentData:e,view2dData:l,setSelectedID:F,showEnlarge:r}))})):null};var PointCloud2DView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloud2DView);module.exports=PointCloud2DView$1;
@@ -1 +1 @@
1
- "use strict";var React=require("react"),icons=require("@ant-design/icons");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,r,t)=>r in e?__defProp(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,__spreadValues=(e,r)=>{for(var t in r||(r={}))__hasOwnProp.call(r,t)&&__defNormalProp(e,t,r[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(r))__propIsEnum.call(r,t)&&__defNormalProp(e,t,r[t]);return e};const HighlightVisible=({visible:e,style:r,onClick:t,loading:a})=>{const o={background:"rgba(0, 0, 0, 0.74)",color:"white",borderRadius:2,padding:6,fontSize:16,zIndex:101};let i=e?icons.EyeFilled:icons.EyeInvisibleFilled;return a&&(i=icons.LoadingOutlined,Object.assign(o,{borderRadius:100})),React__default.default.createElement(i,{style:__spreadValues(__spreadValues({},o),r),onClick:a?()=>{}:t})};module.exports=HighlightVisible;
1
+ "use strict";var React=require("react"),icons=require("@ant-design/icons"),dom=require("../../../../utils/dom.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,r,t)=>r in e?__defProp(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,__spreadValues=(e,r)=>{for(var t in r||(r={}))__hasOwnProp.call(r,t)&&__defNormalProp(e,t,r[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(r))__propIsEnum.call(r,t)&&__defNormalProp(e,t,r[t]);return e};const HighlightVisible=({visible:e,style:r,onClick:t,loading:a})=>{const i={background:"rgba(0, 0, 0, 0.74)",color:"white",borderRadius:2,padding:6,fontSize:16};let o=e?icons.EyeFilled:icons.EyeInvisibleFilled;return a&&(o=icons.LoadingOutlined,Object.assign(i,{borderRadius:100})),React__default.default.createElement(o,{className:dom.getClassName("point-cloud-highlight-view"),style:__spreadValues(__spreadValues({},i),r),onClick:a?()=>{}:t})};module.exports=HighlightVisible;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),React=require("react"),PointCloudContext=require("../PointCloudContext.js"),useSingleBox=require("./useSingleBox.js"),useSphere=require("./useSphere.js"),ctx=require("../../../store/ctx.js"),StepUtils=require("../../../utils/StepUtils.js"),index=require("../../../utils/index.js"),actionCreators=require("../../../store/annotation/actionCreators.js"),antd=require("antd"),reactI18next=require("react-i18next"),useHistory=require("./useHistory.js"),usePolygon=require("./usePolygon.js"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(o,e,i)=>e in o?__defProp(o,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):o[e]=i,__spreadValues=(o,e)=>{for(var i in e||(e={}))__hasOwnProp.call(e,i)&&__defNormalProp(o,i,e[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(e))__propIsEnum.call(e,i)&&__defNormalProp(o,i,e[i]);return o},__spreadProps=(o,e)=>__defProps(o,__getOwnPropDescs(e)),__async=(o,e,i)=>new Promise((l,t)=>{var a=c=>{try{d(i.next(c))}catch(g){t(g)}},P=c=>{try{d(i.throw(c))}catch(g){t(g)}},d=c=>c.done?l(c.value):Promise.resolve(c.value).then(a,P);d((i=i.apply(o,e)).next())});const DEFAULT_SCOPE=5,DEFAULT_RADIUS=90,INTELLIGENT_FIT_MARGIN=.01,PointCloudView={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},topViewPoint2PointCloud=(o,e,i,l,t)=>{const{x:a,y:P}=lbUtils.PointCloudUtils.transferCanvas2World(o,e),{defaultZ:d}=lbUtils.DEFAULT_SPHERE_PARAMS,c={center:{x:a,y:P,z:d},id:o.id},g=l?__spreadValues(__spreadValues({},l),c):__spreadProps(__spreadValues({},c),{attribute:"",valid:!0});return t&&Object.assign(g,t),g},topViewPolygon2PointCloud=(o,e,i,l,t,a)=>{let P=o.pointList.map(f=>lbUtils.PointCloudUtils.transferCanvas2World(f,e)),d=0,c=1,g={};if(i){const f=i.getSensesPointZAxisInPolygon(P,void 0,a);a&&f.fittedCoordinates.length>0&&(P=f.fittedCoordinates),d=(f.maxZ+f.minZ)/2,c=f.maxZ-f.minZ,g={count:f.zCount}}const[h,m,T]=P,b=lbAnnotation.MathUtils.getLineCenterPoint([h,T]),D=lbAnnotation.MathUtils.getLineLength(h,m),I=lbAnnotation.MathUtils.getLineLength(m,T),O=lbAnnotation.MathUtils.getRadiusFromQuadrangle(o.pointList);l&&(d=l.center.z,c=l.depth);const _={center:{x:b.x,y:b.y,z:d},width:a?I+INTELLIGENT_FIT_MARGIN:I,height:a?D+INTELLIGENT_FIT_MARGIN:D,depth:c,rotation:O,id:o.id},k=__spreadValues(l?__spreadValues(__spreadValues({},l),_):__spreadProps(__spreadValues({},_),{attribute:"",valid:!0}),g);t&&Object.assign(k,t);const S=P.map(f=>lbUtils.PointCloudUtils.transferWorld2Canvas(f,e));return{boxParams:k,newPointList:S}},sideViewPoint2PointCloud=(o,e,i)=>{const l={x:o.x-e.x,y:o.y-e.y};return __spreadProps(__spreadValues({},i),{center:{x:i.center.x-l.x,y:i.center.y,z:i.center.z-l.y}})},sideViewPolygon2PointCloud=(o,e,i,l)=>{const[t,a,P]=o.pointList,[d,c,g]=e.pointList,h=lbAnnotation.MathUtils.getLineCenterPoint([t,P]),m=lbAnnotation.MathUtils.getLineCenterPoint([d,g]),b={x:{x:h.x-m.x,y:h.y-m.y}.x,y:0,z:h.y-m.y},D=lbAnnotation.MathUtils.getLineLength(t,a),I=lbAnnotation.MathUtils.getLineLength(d,c),O=D-I,_=lbAnnotation.MathUtils.getLineLength(a,P),k=lbAnnotation.MathUtils.getLineLength(c,g),S=_-k,{newBoxParams:f}=l.getNewBoxBySideUpdate(b,S,O,i);return f},backViewPoint2PointCloud=(o,e,i)=>{const l={x:o.x-e.x,y:o.y-e.y};return __spreadProps(__spreadValues({},i),{center:{x:i.center.x,y:i.center.y-l.x,z:i.center.z-l.y}})},backViewPolygon2PointCloud=(o,e,i,l)=>{const[t,a,P]=o.pointList,[d,c,g]=e.pointList,h=lbAnnotation.MathUtils.getLineCenterPoint([t,P]),m=lbAnnotation.MathUtils.getLineCenterPoint([d,g]),b={x:{x:h.x-m.x,y:h.y-m.y}.x,y:0,z:h.y-m.y},D=lbAnnotation.MathUtils.getLineLength(t,a),I=lbAnnotation.MathUtils.getLineLength(d,c),O=D-I,_=lbAnnotation.MathUtils.getLineLength(a,P),k=lbAnnotation.MathUtils.getLineLength(c,g),S=_-k;let{newBoxParams:f}=l.getNewBoxByBackUpdate(b,S,O,i);return f},syncSideViewByPoint=(o,e,i,l,t)=>{var a;if(!i)return;const{toolInstance:P,pointCloudInstance:d}=i;d.loadPCDFile(l,(a=t==null?void 0:t.radius)!=null?a:DEFAULT_RADIUS);const{cameraPositionVector:c}=d.updateOrthoCameraBySphere(o,lbUtils.EPerspectiveView.Left);d.setInitCameraPosition(c);const{point2d:g,zoom:h}=d.getSphereSidePoint2DCoordinate(o);d.camera.zoom=h,d.camera.updateProjectionMatrix(),d.render(),P.initPosition(),P.zoomChangeOnCenter(h),P.setResult([__spreadProps(__spreadValues(__spreadValues({},e),g),{valid:o.valid,textAttribute:"",attribute:o.attribute})]),P.setSelectedID(e.id)},synchronizeSideView=(o,e,i,l)=>{if(!i)return;const{pointCloud2dOperation:t,pointCloudInstance:a}=i;a.loadPCDFileByBox(l,o,{width:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:P}=a.updateOrthoCamera(o,lbUtils.EPerspectiveView.Left);a.setInitCameraPosition(P);const{polygon2d:d,zoom:c}=a.getBoxSidePolygon2DCoordinate(o);a.camera.zoom=c,a.camera.updateProjectionMatrix(),a.render(),t.initPosition(),t.zoomChangeOnCenter(c),t.setResultAndSelectedID([{id:e.id,valid:o.valid,pointList:d,textAttribute:"",isRect:!0,attribute:o.attribute}],e.id)},syncBackViewByPoint=(o,e,i,l,t)=>{var a;if(!i)return;const{toolInstance:P,pointCloudInstance:d}=i;d.loadPCDFile(l,(a=t==null?void 0:t.radius)!=null?a:DEFAULT_RADIUS);const{cameraPositionVector:c}=d.updateOrthoCameraBySphere(o,lbUtils.EPerspectiveView.Back);d.setInitCameraPosition(c);const{point2d:g,zoom:h}=d.getSphereBackPoint2DCoordinate(o);d.camera.zoom=h,d.camera.updateProjectionMatrix(),d.render(),P.initPosition(),P.zoomChangeOnCenter(h),P.setResult([__spreadProps(__spreadValues(__spreadValues({},e),g),{valid:o.valid,textAttribute:"",attribute:o.attribute})]),P.setSelectedID(e.id)},synchronizeBackView=(o,e,i,l)=>{if(!i)return;const{pointCloud2dOperation:t,pointCloudInstance:a}=i;a.loadPCDFileByBox(l,o,{height:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:P}=a.updateOrthoCamera(o,lbUtils.EPerspectiveView.Back);a.setInitCameraPosition(P);const{polygon2d:d,zoom:c}=a.getBoxBackPolygon2DCoordinate(o);a.camera.zoom=c,a.camera.updateProjectionMatrix(),a.render(),t.initPosition(),t.zoomChangeOnCenter(c),t.setResultAndSelectedID([{id:e.id,valid:o.valid,pointList:d,textAttribute:"",isRect:!0,attribute:o.attribute}],e.id)},syncTopViewByPoint=(o,e,i,l)=>{if(!i||!l)return;l.generateSphere(o),l.updateCameraBySphere(o,lbUtils.EPerspectiveView.Top),l.render();const{toolInstance:t,pointCloudInstance:a}=i,{point2d:P}=a.getSphereTopPoint2DCoordinate(o),d=[...t.pointList].map(c=>c.id===e.id?__spreadProps(__spreadValues(__spreadValues({},e),P),{valid:o.valid,textAttribute:"",attribute:o.attribute}):c);t.setResult(d),t.setSelectedID(e.id)},synchronizeTopView=(o,e,i,l)=>{var t,a;if(!i||!l)return;l.generateBox(o,e.id),l.render();const{pointCloud2dOperation:P,pointCloudInstance:d}=i,{polygon2d:c}=d.getBoxTopPolygon2DCoordinate(o),g=[...P.polygonList],h=g.find(m=>m.id===e.id);h?(h.pointList=c,h.valid=(t=o.valid)!=null?t:!0):g.push({id:e.id,pointList:c,textAttribute:"",isRect:!0,valid:(a=o.valid)!=null?a:!0}),P.setResultAndSelectedID(g,e.id)},usePointCloudViews=()=>{const o=React.useContext(PointCloudContext.PointCloudContext),{topViewInstance:e,sideViewInstance:i,backViewInstance:l,mainViewInstance:t,addPointCloudBox:a,addPointCloudSphere:P,setSelectedIDs:d,selectedIDs:c,pointCloudBoxList:g,pointCloudSphereList:h,hideAttributes:m,setHighlight2DDataList:T}=o,{addHistory:b,initHistory:D,pushHistoryUnderUpdatePolygon:I,pushHistoryUnderUpdateLine:O}=useHistory.useHistory(),{selectedPolygon:_}=usePolygon.usePolygon(),{updateSelectedBox:k,updateSelectedBoxes:S,getPointCloudByID:f}=useSingleBox.useSingleBox(),{getPointCloudSphereByID:G,updatePointCloudSphere:H,selectedSphere:M}=useSphere.useSphere(),{currentData:z,config:L}=ctx.useSelector(n=>{const{stepList:s,step:p,imgList:u,imgIndex:r}=n.annotation;return{currentData:u[r],config:index.jsonParser(StepUtils.getCurrentStepInfo(p,s).config)}}),A=ctx.useDispatch(),{selectedBox:w}=useSingleBox.useSingleBox(),{t:Q}=reactI18next.useTranslation(),F=w==null?void 0:w.info;if(!e||!i||!l)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:N}=e,X=n=>{t==null||t.generateBox(n),t==null||t.controls.update(),t==null||t.render()},Y=n=>{t==null||t.generateSphere(n),t==null||t.controls.update(),t==null||t.render()},J=({newPoint:n,size:s,zoom:p,trackConfigurable:u})=>{var r;const C={attribute:(r=e.toolInstance.defaultAttribute)!=null?r:""};u===!0&&Object.assign(C,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:h})});const x=topViewPoint2PointCloud(n,s,N,void 0,C);d(n.id);const y=P(x);E(PointCloudView.Top,n,x,p,y,L),b({newSphereParams:x})},K=({polygon:n,size:s,imgList:p,trackConfigurable:u,zoom:r,intelligentFit:C})=>{var x,y;const v={attribute:(x=e.toolInstance.defaultAttribute)!=null?x:""};u===!0&&Object.assign(v,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:g,extraSphereList:h})});const U=e==null?void 0:e.toolInstance,V=__spreadValues({},n);let{boxParams:B,newPointList:R}=topViewPolygon2PointCloud(V,s,N,void 0,v,C);if(B=A(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[B],stepConfig:L,action:"viewUpdateBox"}))[0],(L==null?void 0:L.lowerLimitPointsNumInBox)&&typeof B.count=="number"&&B.count<L.lowerLimitPointsNumInBox){antd.message.info(Q("LowerLimitPointsNumInBox",{num:L.lowerLimitPointsNumInBox})),U.deletePolygon(B.id);return}C&&(R==null?void 0:R.length)&&(V.pointList=R);const at=m.includes(V.attribute),q=a(B),dt=(y=o==null?void 0:o.polygonList)!=null?y:[];e==null||e.updatePolygonList(q!=null?q:[],dt),at?d([]):(d(B.id),U.selection.setSelectedIDs(V.id),j({omitView:PointCloudView.Top,polygon:V,boxParams:B,zoom:r,newPointCloudBoxList:q}),C&&synchronizeTopView(B,V,e,t)),b({newBoxParams:B})},$=({newSelectedBox:n,newPointCloudList:s,newSelectedSphere:p,newSphereList:u})=>{var r;const C=e==null?void 0:e.toolInstance;if(!(c.length===0||!C)){if(n||(w==null?void 0:w.info)){const x=n!=null?n:w==null?void 0:w.info;(r=C==null?void 0:C.selection)==null||r.setSelectedIDs(c[0]);const y=C.selectedPolygon;if(c.length===1&&x){j({omitView:PointCloudView.Top,polygon:y,boxParams:x,newPointCloudBoxList:s});return}}if((p||M)&&c.length===1){const x=p!=null?p:M;C.setSelectedID(c[0]);const y=C.selectedPoint;x&&E(PointCloudView.Top,y,x,void 0,u,L)}}},Z=(n,s,p)=>{if(F){let u,r;switch(p){case PointCloudView.Back:u=backViewPolygon2PointCloud;break;case PointCloudView.Side:u=sideViewPolygon2PointCloud;break;default:u=sideViewPolygon2PointCloud;break}r=u(n,s,F,i.pointCloudInstance);const x=A(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[r],stepConfig:L,action:"viewUpdateBox"}))[0],y=r.valid!==x.valid;if(r=x,t){const{count:U}=t.getSensesPointZAxisInPolygon(lbAnnotation.getCuboidFromPointCloudBox(r).polygonPointList,[r.center.z-r.depth/2,r.center.z+r.depth/2]);r=__spreadProps(__spreadValues({},r),{count:U})}const v=k(r);return r=v.find(U=>U.id===r.id),j({omitView:y?void 0:p,polygon:n,boxParams:r,newPointCloudBoxList:[r]}),v}},W=(n,s,p)=>{if(M){let u,r;switch(p){case PointCloudView.Back:u=backViewPoint2PointCloud;break;case PointCloudView.Side:u=sideViewPoint2PointCloud;break;default:u=sideViewPoint2PointCloud;break}r=u(n,s,M);const C=H(r);return E(p,n,r,void 0,C,L),C}},tt=(n,s)=>{W(n,s,PointCloudView.Side)},ot=(n,s)=>{W(n,s,PointCloudView.Back)},et=(n,s)=>{Z(n,s,PointCloudView.Side)},it=(n,s)=>{Z(n,s,PointCloudView.Back)},nt=(n,s)=>{O(n)},st=(n,s)=>{const p=G(n.id),u=topViewPoint2PointCloud(n,s,N,p),r=H(u);E(PointCloudView.Top,n,u,void 0,r,L)},rt=(n,s)=>{if(_){const u=n[0].newPolygon;u.pointList=u.pointList.map(r=>lbUtils.PointCloudUtils.transferCanvas2World(r,s)),I(n[0].newPolygon);return}let p=n.map(({newPolygon:u})=>{const r=f(u.id),{boxParams:C}=topViewPolygon2PointCloud(u,s,e.pointCloudInstance,r);return C});if(p=A(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:p,stepConfig:L,action:"viewUpdateBox"})),p.length===1){const{newPolygon:u}=n[0],r=S(p);j({omitView:PointCloudView.Top,polygon:u,boxParams:p[0],newPointCloudBoxList:r})}else{const u=S(p);u&&o.syncAllViewPointCloudColor(u)}},lt=n=>{var s;if(w){const p=w==null?void 0:w.info.trackID,r=((s=e==null?void 0:e.toolInstance)==null?void 0:s.polygonList).find(y=>(y==null?void 0:y.trackID)===p),C=__spreadProps(__spreadValues({},w.info),{width:Number(n.widthDefault),depth:Number(n.depthDefault),height:Number(n.heightDefault)}),x=S([C]);j({omitView:PointCloudView["3D"],polygon:r,boxParams:C,newPointCloudBoxList:x})}},E=(n,s,p,u,r,C)=>__async(void 0,null,function*(){const x=z==null?void 0:z.url,y={[PointCloudView.Side]:()=>{syncSideViewByPoint(p,s,i,x,C)},[PointCloudView.Back]:()=>{l&&syncBackViewByPoint(p,s,l,x,C)},[PointCloudView.Top]:()=>{syncTopViewByPoint(p,s,e,t)}};Object.keys(y).forEach(v=>{v!==n&&y[v]()}),u&&(t==null||t.updateCameraZoom(u)),Y(p)}),j=n=>__async(void 0,null,function*(){const{omitView:s,polygon:p,boxParams:u,zoom:r,newPointCloudBoxList:C}=n,x=z==null?void 0:z.url;C&&(yield o.syncAllViewPointCloudColor(C));const y={[PointCloudView.Side]:()=>{synchronizeSideView(u,p,i,x)},[PointCloudView.Back]:()=>{l&&synchronizeBackView(u,p,l,x)},[PointCloudView.Top]:()=>{synchronizeTopView(u,p,e,t)}};Object.keys(y).forEach(v=>{v!==s&&y[v]()}),r&&(t==null||t.updateCameraZoom(r)),X(u)});return{topViewAddSphere:J,topViewAddBox:K,topViewSelectedChanged:$,topViewUpdatePoint:st,sideViewUpdatePoint:tt,backViewUpdatePoint:ot,topViewUpdateBox:rt,topViewUpdateLine:nt,sideViewUpdateBox:et,backViewUpdateBox:it,pointCloudBoxListUpdated:n=>{e.updatePolygonList(n),t==null||t.generateBoxes(n)},initPointCloud3d:n=>{if(!t)return;const s=lbUtils.PointCloudUtils.getDefaultOrthographicParams(n);t.initOrthographicCamera(s),t.initRenderer(),t.render()},updatePointCloudData:(...n)=>__async(void 0,[...n],function*(s=z){var p,u,r,C,x,y;if(!(s==null?void 0:s.url)||!t)return;T([]),actionCreators.SetPointCloudLoading(A,!0),actionCreators.SetLoadPCDFileLoading(A,!0),yield t.loadPCDFile(s.url,(p=L==null?void 0:L.radius)!=null?p:DEFAULT_RADIUS),t==null||t.clearAllBox(),t==null||t.clearAllSphere();let v=[],U=[],V=[],B=[];t.updateTopCamera();const R=(r=(u=index.jsonParser(s.result))==null?void 0:u.valid)!=null?r:!0;o.setPointCloudValid(R),(C=o.sideViewInstance)==null||C.clearAllData(),(x=o.backViewInstance)==null||x.clearAllData(),e.updateData(s.url,s.result,{radius:(y=L==null?void 0:L.radius)!=null?y:DEFAULT_RADIUS}),s.result&&(v=lbUtils.PointCloudUtils.getBoxParamsFromResultList(s.result),V=lbUtils.PointCloudUtils.getPolygonListFromResultList(s.result),U=lbUtils.PointCloudUtils.getLineListFromResultList(s.result),B=lbUtils.PointCloudUtils.getSphereParamsFromResultList(s.result),t==null||t.generateBoxes(v),t==null||t.generateSpheres(B),yield o.syncAllViewPointCloudColor(v,[])),D({pointCloudBoxList:v,polygonList:V,lineList:U,pointCloudSphereList:B}),actionCreators.SetPointCloudLoading(A,!1),actionCreators.SetLoadPCDFileLoading(A,!1)}),updateViewsByDefaultSize:lt}};exports.syncBackViewByPoint=syncBackViewByPoint,exports.syncSideViewByPoint=syncSideViewByPoint,exports.syncTopViewByPoint=syncTopViewByPoint,exports.synchronizeBackView=synchronizeBackView,exports.synchronizeSideView=synchronizeSideView,exports.synchronizeTopView=synchronizeTopView,exports.topViewPoint2PointCloud=topViewPoint2PointCloud,exports.topViewPolygon2PointCloud=topViewPolygon2PointCloud,exports.usePointCloudViews=usePointCloudViews;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),React=require("react"),PointCloudContext=require("../PointCloudContext.js"),useSingleBox=require("./useSingleBox.js"),useSphere=require("./useSphere.js"),ctx=require("../../../store/ctx.js"),StepUtils=require("../../../utils/StepUtils.js"),index=require("../../../utils/index.js"),actionCreators=require("../../../store/annotation/actionCreators.js"),antd=require("antd"),reactI18next=require("react-i18next"),useHistory=require("./useHistory.js"),usePolygon=require("./usePolygon.js"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(o,e,i)=>e in o?__defProp(o,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):o[e]=i,__spreadValues=(o,e)=>{for(var i in e||(e={}))__hasOwnProp.call(e,i)&&__defNormalProp(o,i,e[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(e))__propIsEnum.call(e,i)&&__defNormalProp(o,i,e[i]);return o},__spreadProps=(o,e)=>__defProps(o,__getOwnPropDescs(e)),__async=(o,e,i)=>new Promise((l,t)=>{var a=c=>{try{d(i.next(c))}catch(g){t(g)}},P=c=>{try{d(i.throw(c))}catch(g){t(g)}},d=c=>c.done?l(c.value):Promise.resolve(c.value).then(a,P);d((i=i.apply(o,e)).next())});const DEFAULT_SCOPE=5,DEFAULT_RADIUS=90,INTELLIGENT_FIT_MARGIN=.01,PointCloudView={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},topViewPoint2PointCloud=(o,e,i,l,t)=>{const{x:a,y:P}=lbUtils.PointCloudUtils.transferCanvas2World(o,e),{defaultZ:d}=lbUtils.DEFAULT_SPHERE_PARAMS,c={center:{x:a,y:P,z:d},id:o.id},g=l?__spreadValues(__spreadValues({},l),c):__spreadProps(__spreadValues({},c),{attribute:"",valid:!0});return t&&Object.assign(g,t),g},topViewPolygon2PointCloud=(o,e,i,l,t,a)=>{let P=o.pointList.map(f=>lbUtils.PointCloudUtils.transferCanvas2World(f,e)),d=0,c=1,g={};if(i){const f=i.getSensesPointZAxisInPolygon(P,void 0,a);a&&f.fittedCoordinates.length>0&&(P=f.fittedCoordinates),d=(f.maxZ+f.minZ)/2,c=f.maxZ-f.minZ,g={count:f.zCount}}const[h,m,T]=P,b=lbAnnotation.MathUtils.getLineCenterPoint([h,T]),D=lbAnnotation.MathUtils.getLineLength(h,m),I=lbAnnotation.MathUtils.getLineLength(m,T),O=lbAnnotation.MathUtils.getRadiusFromQuadrangle(o.pointList);l&&(d=l.center.z,c=l.depth);const _={center:{x:b.x,y:b.y,z:d},width:a?I+INTELLIGENT_FIT_MARGIN:I,height:a?D+INTELLIGENT_FIT_MARGIN:D,depth:c,rotation:O,id:o.id},k=__spreadValues(l?__spreadValues(__spreadValues({},l),_):__spreadProps(__spreadValues({},_),{attribute:"",valid:!0}),g);t&&Object.assign(k,t);const S=P.map(f=>lbUtils.PointCloudUtils.transferWorld2Canvas(f,e));return{boxParams:k,newPointList:S}},sideViewPoint2PointCloud=(o,e,i)=>{const l={x:o.x-e.x,y:o.y-e.y};return __spreadProps(__spreadValues({},i),{center:{x:i.center.x-l.x,y:i.center.y,z:i.center.z-l.y}})},sideViewPolygon2PointCloud=(o,e,i,l)=>{const[t,a,P]=o.pointList,[d,c,g]=e.pointList,h=lbAnnotation.MathUtils.getLineCenterPoint([t,P]),m=lbAnnotation.MathUtils.getLineCenterPoint([d,g]),b={x:{x:h.x-m.x,y:h.y-m.y}.x,y:0,z:h.y-m.y},D=lbAnnotation.MathUtils.getLineLength(t,a),I=lbAnnotation.MathUtils.getLineLength(d,c),O=D-I,_=lbAnnotation.MathUtils.getLineLength(a,P),k=lbAnnotation.MathUtils.getLineLength(c,g),S=_-k,{newBoxParams:f}=l.getNewBoxBySideUpdate(b,S,O,i);return f},backViewPoint2PointCloud=(o,e,i)=>{const l={x:o.x-e.x,y:o.y-e.y};return __spreadProps(__spreadValues({},i),{center:{x:i.center.x,y:i.center.y-l.x,z:i.center.z-l.y}})},backViewPolygon2PointCloud=(o,e,i,l)=>{const[t,a,P]=o.pointList,[d,c,g]=e.pointList,h=lbAnnotation.MathUtils.getLineCenterPoint([t,P]),m=lbAnnotation.MathUtils.getLineCenterPoint([d,g]),b={x:{x:h.x-m.x,y:h.y-m.y}.x,y:0,z:h.y-m.y},D=lbAnnotation.MathUtils.getLineLength(t,a),I=lbAnnotation.MathUtils.getLineLength(d,c),O=D-I,_=lbAnnotation.MathUtils.getLineLength(a,P),k=lbAnnotation.MathUtils.getLineLength(c,g),S=_-k;let{newBoxParams:f}=l.getNewBoxByBackUpdate(b,S,O,i);return f},syncSideViewByPoint=(o,e,i,l,t)=>{var a;if(!i)return;const{toolInstance:P,pointCloudInstance:d}=i;d.loadPCDFile(l,(a=t==null?void 0:t.radius)!=null?a:DEFAULT_RADIUS);const{cameraPositionVector:c}=d.updateOrthoCameraBySphere(o,lbUtils.EPerspectiveView.Left);d.setInitCameraPosition(c);const{point2d:g,zoom:h}=d.getSphereSidePoint2DCoordinate(o);d.camera.zoom=h,d.camera.updateProjectionMatrix(),d.render(),P.initPosition(),P.zoomChangeOnCenter(h),P.setResult([__spreadProps(__spreadValues(__spreadValues({},e),g),{valid:o.valid,textAttribute:"",attribute:o.attribute})]),P.setSelectedID(e.id)},synchronizeSideView=(o,e,i,l)=>{if(!i)return;const{pointCloud2dOperation:t,pointCloudInstance:a}=i;a.loadPCDFileByBox(l,o,{width:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:P}=a.updateOrthoCamera(o,lbUtils.EPerspectiveView.Left);a.setInitCameraPosition(P);const{polygon2d:d,zoom:c}=a.getBoxSidePolygon2DCoordinate(o);a.camera.zoom=c,a.camera.updateProjectionMatrix(),a.render(),t.initPosition(),t.zoomChangeOnCenter(c),t.setResultAndSelectedID([{id:e.id,valid:o.valid,pointList:d,textAttribute:"",isRect:!0,attribute:o.attribute}],e.id)},syncBackViewByPoint=(o,e,i,l,t)=>{var a;if(!i)return;const{toolInstance:P,pointCloudInstance:d}=i;d.loadPCDFile(l,(a=t==null?void 0:t.radius)!=null?a:DEFAULT_RADIUS);const{cameraPositionVector:c}=d.updateOrthoCameraBySphere(o,lbUtils.EPerspectiveView.Back);d.setInitCameraPosition(c);const{point2d:g,zoom:h}=d.getSphereBackPoint2DCoordinate(o);d.camera.zoom=h,d.camera.updateProjectionMatrix(),d.render(),P.initPosition(),P.zoomChangeOnCenter(h),P.setResult([__spreadProps(__spreadValues(__spreadValues({},e),g),{valid:o.valid,textAttribute:"",attribute:o.attribute})]),P.setSelectedID(e.id)},synchronizeBackView=(o,e,i,l)=>{if(!i)return;const{pointCloud2dOperation:t,pointCloudInstance:a}=i;a.loadPCDFileByBox(l,o,{height:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:P}=a.updateOrthoCamera(o,lbUtils.EPerspectiveView.Back);a.setInitCameraPosition(P);const{polygon2d:d,zoom:c}=a.getBoxBackPolygon2DCoordinate(o);a.camera.zoom=c,a.camera.updateProjectionMatrix(),a.render(),t.initPosition(),t.zoomChangeOnCenter(c),t.setResultAndSelectedID([{id:e.id,valid:o.valid,pointList:d,textAttribute:"",isRect:!0,attribute:o.attribute}],e.id)},syncTopViewByPoint=(o,e,i,l)=>{if(!i||!l)return;l.generateSphere(o),l.updateCameraBySphere(o,lbUtils.EPerspectiveView.Top),l.render();const{toolInstance:t,pointCloudInstance:a}=i,{point2d:P}=a.getSphereTopPoint2DCoordinate(o),d=[...t.pointList].map(c=>c.id===e.id?__spreadProps(__spreadValues(__spreadValues({},e),P),{valid:o.valid,textAttribute:"",attribute:o.attribute}):c);t.setResult(d),t.setSelectedID(e.id)},synchronizeTopView=(o,e,i,l)=>{var t,a;if(!i||!l)return;l.generateBox(o,e.id),l.render();const{pointCloud2dOperation:P,pointCloudInstance:d}=i,{polygon2d:c}=d.getBoxTopPolygon2DCoordinate(o),g=[...P.polygonList],h=g.find(m=>m.id===e.id);h?(h.pointList=c,h.valid=(t=o.valid)!=null?t:!0):g.push({id:e.id,pointList:c,textAttribute:"",isRect:!0,valid:(a=o.valid)!=null?a:!0}),P.setResultAndSelectedID(g,e.id)},usePointCloudViews=()=>{const o=React.useContext(PointCloudContext.PointCloudContext),{topViewInstance:e,sideViewInstance:i,backViewInstance:l,mainViewInstance:t,addPointCloudBox:a,addPointCloudSphere:P,setSelectedIDs:d,selectedIDs:c,pointCloudBoxList:g,pointCloudSphereList:h,hideAttributes:m,setHighlight2DDataList:T}=o,{addHistory:b,initHistory:D,pushHistoryUnderUpdatePolygon:I,pushHistoryUnderUpdateLine:O}=useHistory.useHistory(),{selectedPolygon:_}=usePolygon.usePolygon(),{updateSelectedBox:k,updateSelectedBoxes:S,getPointCloudByID:f}=useSingleBox.useSingleBox(),{getPointCloudSphereByID:G,updatePointCloudSphere:H,selectedSphere:M}=useSphere.useSphere(),{currentData:z,config:L}=ctx.useSelector(n=>{const{stepList:s,step:p,imgList:u,imgIndex:r}=n.annotation;return{currentData:u[r],config:index.jsonParser(StepUtils.getCurrentStepInfo(p,s).config)}}),A=ctx.useDispatch(),{selectedBox:w}=useSingleBox.useSingleBox(),{t:Q}=reactI18next.useTranslation(),F=w==null?void 0:w.info;if(!e||!i||!l)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:N}=e,X=n=>{t==null||t.generateBox(n),t==null||t.controls.update(),t==null||t.render()},Y=n=>{t==null||t.generateSphere(n),t==null||t.controls.update(),t==null||t.render()},J=({newPoint:n,size:s,zoom:p,trackConfigurable:u})=>{var r;const C={attribute:(r=e.toolInstance.defaultAttribute)!=null?r:""};u===!0&&Object.assign(C,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:h})});const x=topViewPoint2PointCloud(n,s,N,void 0,C);d(n.id);const y=P(x);E(PointCloudView.Top,n,x,p,y,L),b({newSphereParams:x})},K=({polygon:n,size:s,imgList:p,trackConfigurable:u,zoom:r,intelligentFit:C})=>{var x,y;const v={attribute:(x=e.toolInstance.defaultAttribute)!=null?x:""};u===!0&&Object.assign(v,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:g,extraSphereList:h})});const U=e==null?void 0:e.toolInstance,V=__spreadValues({},n);let{boxParams:B,newPointList:R}=topViewPolygon2PointCloud(V,s,N,void 0,v,C);if(B=A(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[B],stepConfig:L,action:"viewUpdateBox"}))[0],(L==null?void 0:L.lowerLimitPointsNumInBox)&&typeof B.count=="number"&&B.count<L.lowerLimitPointsNumInBox){antd.message.info(Q("LowerLimitPointsNumInBox",{num:L.lowerLimitPointsNumInBox})),U.deletePolygon(B.id);return}C&&(R==null?void 0:R.length)&&(V.pointList=R);const at=m.includes(V.attribute),q=a(B),dt=(y=o==null?void 0:o.polygonList)!=null?y:[];e==null||e.updatePolygonList(q!=null?q:[],dt),at?d([]):(d(B.id),U.selection.setSelectedIDs(V.id),j({omitView:PointCloudView.Top,polygon:V,boxParams:B,zoom:r,newPointCloudBoxList:q}),C&&synchronizeTopView(B,V,e,t)),b({newBoxParams:B})},$=({newSelectedBox:n,newPointCloudList:s,newSelectedSphere:p,newSphereList:u})=>{var r;const C=e==null?void 0:e.toolInstance;if(!(c.length===0||!C)){if(n||(w==null?void 0:w.info)){const x=n!=null?n:w==null?void 0:w.info;(r=C==null?void 0:C.selection)==null||r.setSelectedIDs(c[0]);const y=C.selectedPolygon;if(c.length===1&&x){j({omitView:PointCloudView.Top,polygon:y,boxParams:x,newPointCloudBoxList:s});return}}if((p||M)&&c.length===1){const x=p!=null?p:M;C.setSelectedID(c[0]);const y=C.selectedPoint;x&&E(PointCloudView.Top,y,x,void 0,u,L)}}},Z=(n,s,p)=>{if(F){let u,r;switch(p){case PointCloudView.Back:u=backViewPolygon2PointCloud;break;case PointCloudView.Side:u=sideViewPolygon2PointCloud;break;default:u=sideViewPolygon2PointCloud;break}r=u(n,s,F,i.pointCloudInstance);const x=A(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[r],stepConfig:L,action:"viewUpdateBox"}))[0],y=r.valid!==x.valid;if(r=x,t){const{count:U}=t.getSensesPointZAxisInPolygon(lbAnnotation.getCuboidFromPointCloudBox(r).polygonPointList,[r.center.z-r.depth/2,r.center.z+r.depth/2]);r=__spreadProps(__spreadValues({},r),{count:U})}const v=k(r);return r=v.find(U=>U.id===r.id),j({omitView:y?void 0:p,polygon:n,boxParams:r,newPointCloudBoxList:v}),v}},W=(n,s,p)=>{if(M){let u,r;switch(p){case PointCloudView.Back:u=backViewPoint2PointCloud;break;case PointCloudView.Side:u=sideViewPoint2PointCloud;break;default:u=sideViewPoint2PointCloud;break}r=u(n,s,M);const C=H(r);return E(p,n,r,void 0,C,L),C}},tt=(n,s)=>{W(n,s,PointCloudView.Side)},ot=(n,s)=>{W(n,s,PointCloudView.Back)},et=(n,s)=>{Z(n,s,PointCloudView.Side)},it=(n,s)=>{Z(n,s,PointCloudView.Back)},nt=(n,s)=>{O(n)},st=(n,s)=>{const p=G(n.id),u=topViewPoint2PointCloud(n,s,N,p),r=H(u);E(PointCloudView.Top,n,u,void 0,r,L)},rt=(n,s)=>{if(_){const u=n[0].newPolygon;u.pointList=u.pointList.map(r=>lbUtils.PointCloudUtils.transferCanvas2World(r,s)),I(n[0].newPolygon);return}let p=n.map(({newPolygon:u})=>{const r=f(u.id),{boxParams:C}=topViewPolygon2PointCloud(u,s,e.pointCloudInstance,r);return C});if(p=A(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:p,stepConfig:L,action:"viewUpdateBox"})),p.length===1){const{newPolygon:u}=n[0],r=S(p);j({omitView:PointCloudView.Top,polygon:u,boxParams:p[0],newPointCloudBoxList:r})}else{const u=S(p);u&&o.syncAllViewPointCloudColor(u)}},lt=n=>{var s;if(w){const p=w==null?void 0:w.info.trackID,r=((s=e==null?void 0:e.toolInstance)==null?void 0:s.polygonList).find(y=>(y==null?void 0:y.trackID)===p),C=__spreadProps(__spreadValues({},w.info),{width:Number(n.widthDefault),depth:Number(n.depthDefault),height:Number(n.heightDefault)}),x=S([C]);j({omitView:PointCloudView["3D"],polygon:r,boxParams:C,newPointCloudBoxList:x})}},E=(n,s,p,u,r,C)=>__async(void 0,null,function*(){const x=z==null?void 0:z.url,y={[PointCloudView.Side]:()=>{syncSideViewByPoint(p,s,i,x,C)},[PointCloudView.Back]:()=>{l&&syncBackViewByPoint(p,s,l,x,C)},[PointCloudView.Top]:()=>{syncTopViewByPoint(p,s,e,t)}};Object.keys(y).forEach(v=>{v!==n&&y[v]()}),u&&(t==null||t.updateCameraZoom(u)),Y(p)}),j=n=>__async(void 0,null,function*(){const{omitView:s,polygon:p,boxParams:u,zoom:r,newPointCloudBoxList:C}=n,x=z==null?void 0:z.url;C&&(yield o.syncAllViewPointCloudColor(C));const y={[PointCloudView.Side]:()=>{synchronizeSideView(u,p,i,x)},[PointCloudView.Back]:()=>{l&&synchronizeBackView(u,p,l,x)},[PointCloudView.Top]:()=>{synchronizeTopView(u,p,e,t)}};Object.keys(y).forEach(v=>{v!==s&&y[v]()}),r&&(t==null||t.updateCameraZoom(r)),X(u)});return{topViewAddSphere:J,topViewAddBox:K,topViewSelectedChanged:$,topViewUpdatePoint:st,sideViewUpdatePoint:tt,backViewUpdatePoint:ot,topViewUpdateBox:rt,topViewUpdateLine:nt,sideViewUpdateBox:et,backViewUpdateBox:it,pointCloudBoxListUpdated:n=>{e.updatePolygonList(n),t==null||t.generateBoxes(n)},initPointCloud3d:n=>{if(!t)return;const s=lbUtils.PointCloudUtils.getDefaultOrthographicParams(n);t.initOrthographicCamera(s),t.initRenderer(),t.render()},updatePointCloudData:(...n)=>__async(void 0,[...n],function*(s=z){var p,u,r,C,x,y;if(!(s==null?void 0:s.url)||!t)return;T([]),actionCreators.SetPointCloudLoading(A,!0),actionCreators.SetLoadPCDFileLoading(A,!0),yield t.loadPCDFile(s.url,(p=L==null?void 0:L.radius)!=null?p:DEFAULT_RADIUS),t==null||t.clearAllBox(),t==null||t.clearAllSphere();let v=[],U=[],V=[],B=[];t.updateTopCamera();const R=(r=(u=index.jsonParser(s.result))==null?void 0:u.valid)!=null?r:!0;o.setPointCloudValid(R),(C=o.sideViewInstance)==null||C.clearAllData(),(x=o.backViewInstance)==null||x.clearAllData(),e.updateData(s.url,s.result,{radius:(y=L==null?void 0:L.radius)!=null?y:DEFAULT_RADIUS}),s.result&&(v=lbUtils.PointCloudUtils.getBoxParamsFromResultList(s.result),V=lbUtils.PointCloudUtils.getPolygonListFromResultList(s.result),U=lbUtils.PointCloudUtils.getLineListFromResultList(s.result),B=lbUtils.PointCloudUtils.getSphereParamsFromResultList(s.result),t==null||t.generateBoxes(v),t==null||t.generateSpheres(B),yield o.syncAllViewPointCloudColor(v,[])),D({pointCloudBoxList:v,polygonList:V,lineList:U,pointCloudSphereList:B}),actionCreators.SetPointCloudLoading(A,!1),actionCreators.SetLoadPCDFileLoading(A,!1)}),updateViewsByDefaultSize:lt}};exports.syncBackViewByPoint=syncBackViewByPoint,exports.syncSideViewByPoint=syncSideViewByPoint,exports.syncTopViewByPoint=syncTopViewByPoint,exports.synchronizeBackView=synchronizeBackView,exports.synchronizeSideView=synchronizeSideView,exports.synchronizeTopView=synchronizeTopView,exports.topViewPoint2PointCloud=topViewPoint2PointCloud,exports.topViewPolygon2PointCloud=topViewPolygon2PointCloud,exports.usePointCloudViews=usePointCloudViews;
@@ -1 +1 @@
1
- "use strict";var dom=require("../../utils/dom.js"),React=require("react"),PointCloud3DView=require("./PointCloud3DView.js"),PointCloudBackView=require("./PointCloudBackView.js"),PointCloudTopView=require("./PointCloudTopView.js"),PointCloudSideView=require("./PointCloudSideView.js"),PointCloud2DView=require("./PointCloud2DView.js"),PointCloudListener=require("./PointCloudListener.js"),PointCloudSegmentListener=require("./PointCloudSegmentListener.js"),PointCloudSegment=require("./PointCloudSegment.js"),PointCloudSegmentStatus=require("./PointCloudSegmentStatus.js"),PointCloudSegmentToolbar=require("./PointCloudSegmentToolbar.js"),reactRedux=require("react-redux"),ctx=require("../../store/ctx.js"),index$1=require("../../views/MainView/toolFooter/AnnotatedAttributes/index.js"),PointCloudContext=require("./PointCloudContext.js"),lbUtils=require("@labelbee/lb-utils"),annotation=require("../../hooks/annotation.js"),index=require("../../utils/index.js"),map=require("../../store/annotation/map.js"),classNames=require("classnames"),index$2=require("./components/sideAndBackOverView/index.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames);const PointCloudView=({currentData:t,imgList:C,drawLayerSlot:s,checkMode:a,intelligentFit:P,imgIndex:g,loadPCDFileLoading:v})=>{const e=React.useContext(PointCloudContext.PointCloudContext),{globalPattern:d,setGlobalPattern:p,selectedIDs:c}=e,[l,m]=React.useState(!1),E=(c==null?void 0:c.length)>0&&l,x=index.jsonParser(t.result),{toolInstanceRef:o,clearToolInstance:L}=annotation.useCustomToolInstance({basicInfo:x});if(React.useEffect(()=>{o.current.setPointCloudGlobalPattern=n=>{n!==d&&(p(n),e.clearAllDetectionInstance(),L())}},[d]),React.useEffect(()=>{var n;if(t){const{boxParamsList:i,polygonList:r,lineList:u,sphereParamsList:b,segmentation:q}=lbUtils.PointCloudUtils.parsePointCloudCurrentResult((n=t==null?void 0:t.result)!=null?n:"");e.setPointCloudResult(i),e.setPolygonList(r),e.setLineList(u),e.setPointCloudSphereList(b),e.setSegmentation(q)}},[g]),React.useEffect(()=>{o.current.exportData=()=>[e.pointCloudBoxList,{valid:e.valid}],o.current.exportCustomData=()=>{var n,i,r,u;return{resultPolygon:(n=e.polygonList)!=null?n:[],resultLine:(i=e.lineList)!=null?i:[],resultPoint:(r=e.pointCloudSphereList)!=null?r:[],segmentation:(u=e.segmentation)!=null?u:[]}}},[e.pointCloudBoxList,e.valid,e.polygonList,e.lineList,e.pointCloudSphereList,e.ptSegmentInstance,e.segmentation]),C.length===0)return null;if(d===lbUtils.EPointCloudPattern.Segmentation)return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudSegmentListener,{checkMode:a,toolInstanceRef:o}),React__default.default.createElement(PointCloudSegmentToolbar,null),React__default.default.createElement(PointCloudSegment,{checkMode:a}),React__default.default.createElement(PointCloudSegmentStatus,null),s==null?void 0:s({direct:!0}));let f=React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container","left-bottom")},React__default.default.createElement(PointCloudBackView,{checkMode:a}),React__default.default.createElement(PointCloudSideView,{checkMode:a}));return l&&(f=React__default.default.createElement(index$2,{selectAndEnlarge:E,checkMode:a})),React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudListener,{checkMode:a,toolInstanceRef:o}),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-layout"),onContextMenu:n=>n.preventDefault()},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-wrapper")},React__default.default.createElement(index$1.AnnotatedAttributesPanelFixedLeft,null),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-content")},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container","left")},React__default.default.createElement(PointCloud3DView,null),f),React__default.default.createElement("div",{className:classNames__default.default({[dom.getClassName("point-cloud-container","right")]:!0,[dom.getClassName("point-cloud-container","rightZoom")]:l})},React__default.default.createElement(PointCloudTopView,{drawLayerSlot:s,checkMode:a,intelligentFit:P,setIsEnlargeTopView:m,onExitZoom:()=>{m(!1)},isEnlargeTopView:l}),React__default.default.createElement("div",{className:classNames__default.default({[dom.getClassName("point-cloud-container","right-bottom")]:!l,[dom.getClassName("point-cloud-container","right-bottom-floatLeft")]:l})},!v&&React__default.default.createElement(PointCloud2DView,{isEnlargeTopView:l,thumbnailWidth:l?300:455})))),React__default.default.createElement(index$1.AnnotatedAttributesPanelFixedRight,null))))};var PointCloudView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudView);module.exports=PointCloudView$1;
1
+ "use strict";var dom=require("../../utils/dom.js"),React=require("react"),PointCloud3DView=require("./PointCloud3DView.js"),PointCloudBackView=require("./PointCloudBackView.js"),PointCloudTopView=require("./PointCloudTopView.js"),PointCloudSideView=require("./PointCloudSideView.js"),PointCloud2DView=require("./PointCloud2DView.js"),PointCloudListener=require("./PointCloudListener.js"),PointCloudSegmentListener=require("./PointCloudSegmentListener.js"),PointCloudSegment=require("./PointCloudSegment.js"),PointCloudSegmentStatus=require("./PointCloudSegmentStatus.js"),PointCloudSegmentToolbar=require("./PointCloudSegmentToolbar.js"),reactRedux=require("react-redux"),ctx=require("../../store/ctx.js"),index$1=require("../../views/MainView/toolFooter/AnnotatedAttributes/index.js"),PointCloudContext=require("./PointCloudContext.js"),lbUtils=require("@labelbee/lb-utils"),annotation=require("../../hooks/annotation.js"),index=require("../../utils/index.js"),map=require("../../store/annotation/map.js"),classNames=require("classnames"),index$2=require("./components/sideAndBackOverView/index.js"),actionCreators=require("../../store/annotation/actionCreators.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames);const PointCloudView=({currentData:t,imgList:f,drawLayerSlot:u,checkMode:a,intelligentFit:P,imgIndex:g,loadPCDFileLoading:j})=>{const e=React.useContext(PointCloudContext.PointCloudContext),{globalPattern:d,setGlobalPattern:v,selectedIDs:c}=e,p=ctx.useDispatch(),[l,m]=React.useState(!1),E=(c==null?void 0:c.length)>0&&l,x=index.jsonParser(t.result),{toolInstanceRef:o,clearToolInstance:L}=annotation.useCustomToolInstance({basicInfo:x});if(React.useEffect(()=>{o.current.setPointCloudGlobalPattern=n=>{n!==d&&(v(n),e.clearAllDetectionInstance(),L())}},[d]),React.useEffect(()=>{var n;if(actionCreators.SetLoadPCDFileLoading(p,!0),t){const{boxParamsList:i,polygonList:r,lineList:s,sphereParamsList:q,segmentation:b}=lbUtils.PointCloudUtils.parsePointCloudCurrentResult((n=t==null?void 0:t.result)!=null?n:"");e.setPointCloudResult(i),e.setPolygonList(r),e.setLineList(s),e.setPointCloudSphereList(q),e.setSegmentation(b)}},[g]),React.useEffect(()=>{o.current.exportData=()=>[e.pointCloudBoxList,{valid:e.valid}],o.current.exportCustomData=()=>{var n,i,r,s;return{resultPolygon:(n=e.polygonList)!=null?n:[],resultLine:(i=e.lineList)!=null?i:[],resultPoint:(r=e.pointCloudSphereList)!=null?r:[],segmentation:(s=e.segmentation)!=null?s:[]}}},[e.pointCloudBoxList,e.valid,e.polygonList,e.lineList,e.pointCloudSphereList,e.ptSegmentInstance,e.segmentation]),f.length===0)return null;if(d===lbUtils.EPointCloudPattern.Segmentation)return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudSegmentListener,{checkMode:a,toolInstanceRef:o}),React__default.default.createElement(PointCloudSegmentToolbar,null),React__default.default.createElement(PointCloudSegment,{checkMode:a}),React__default.default.createElement(PointCloudSegmentStatus,null),u==null?void 0:u({direct:!0}));let C=React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container","left-bottom")},React__default.default.createElement(PointCloudBackView,{checkMode:a}),React__default.default.createElement(PointCloudSideView,{checkMode:a}));return l&&(C=React__default.default.createElement(index$2,{selectAndEnlarge:E,checkMode:a})),React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudListener,{checkMode:a,toolInstanceRef:o}),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-layout"),onContextMenu:n=>n.preventDefault()},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-wrapper")},React__default.default.createElement(index$1.AnnotatedAttributesPanelFixedLeft,null),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-content")},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container","left")},React__default.default.createElement(PointCloud3DView,null),C),React__default.default.createElement("div",{className:classNames__default.default({[dom.getClassName("point-cloud-container","right")]:!0,[dom.getClassName("point-cloud-container","rightZoom")]:l})},React__default.default.createElement(PointCloudTopView,{drawLayerSlot:u,checkMode:a,intelligentFit:P,setIsEnlargeTopView:m,onExitZoom:()=>{m(!1)},isEnlargeTopView:l}),React__default.default.createElement("div",{className:classNames__default.default({[dom.getClassName("point-cloud-container","right-bottom")]:!l,[dom.getClassName("point-cloud-container","right-bottom-floatLeft")]:l})},React__default.default.createElement(PointCloud2DView,{isEnlargeTopView:l,thumbnailWidth:l?300:455})))),React__default.default.createElement(index$1.AnnotatedAttributesPanelFixedRight,null))))};var PointCloudView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudView);module.exports=PointCloudView$1;
package/dist/index.css CHANGED
@@ -236,7 +236,7 @@
236
236
  border-color: #666fff;
237
237
  }
238
238
  .bee-sidebar__level {
239
- padding: 28px;
239
+ padding: 20px 8px;
240
240
  border-bottom: 1px solid #eee;
241
241
  display: flex;
242
242
  justify-content: center;
@@ -1366,6 +1366,9 @@
1366
1366
  border-bottom: 1px solid;
1367
1367
  font-size: 14px;
1368
1368
  }
1369
+ .bee-point-cloud-wrapper .bee-point-cloud-container__zoom .bee-point-cloud-highlight-view {
1370
+ display: none;
1371
+ }
1369
1372
  .bee-point-cloud-wrapper .bee-point-cloud-container__left {
1370
1373
  width: 455px;
1371
1374
  display: flex;
@@ -1543,7 +1546,7 @@
1543
1546
  height: 100%;
1544
1547
  }
1545
1548
  .bee-point-cloud-wrapper .bee-point-cloud-container__rightZoom {
1546
- position: fixed;
1549
+ position: absolute;
1547
1550
  top: 0px;
1548
1551
  left: 0px;
1549
1552
  width: 100%;
@@ -1,9 +1,10 @@
1
1
  import React from 'react';
2
2
  import { IAnnotationData2dView } from './PointCloud2DView';
3
3
  import { IFileItem } from '@/types/data';
4
- declare const PointCloud2DSingleView: ({ view2dData, setSelectedID, currentData, }: {
4
+ declare const PointCloud2DSingleView: ({ view2dData, setSelectedID, currentData, showEnlarge, }: {
5
5
  view2dData: IAnnotationData2dView;
6
6
  setSelectedID: (value: string | number) => void;
7
7
  currentData: IFileItem;
8
+ showEnlarge: boolean;
8
9
  }) => React.JSX.Element;
9
10
  export default PointCloud2DSingleView;
@@ -21,5 +21,5 @@ interface IProps extends IA2MapStateProps {
21
21
  thumbnailWidth?: number;
22
22
  isEnlargeTopView?: boolean;
23
23
  }
24
- declare const _default: import("react-redux").ConnectedComponent<({ currentData, config, thumbnailWidth, isEnlargeTopView, highlightAttribute, }: IProps) => React.JSX.Element | null, import("react-redux").Omit<IProps, "imgIndex" | "imgList" | "config" | "highlightAttribute" | "loadPCDFileLoading" | "currentData" | "stepInfo" | "configString">>;
24
+ declare const _default: import("react-redux").ConnectedComponent<({ currentData, config, thumbnailWidth, isEnlargeTopView, highlightAttribute, loadPCDFileLoading, }: IProps) => React.JSX.Element | null, import("react-redux").Omit<IProps, "imgIndex" | "imgList" | "config" | "highlightAttribute" | "loadPCDFileLoading" | "currentData" | "stepInfo" | "configString">>;
25
25
  export default _default;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var index=require("../../../constant/index.js"),ToolType=require("../../../data/enums/ToolType.js"),StepUtils=require("../../../utils/StepUtils.js"),es=require("antd/es"),React=require("react"),reactI18next=require("react-i18next"),index$9=require("./AnnotationText/index.js"),index$2=require("./ClearIcon/index.js"),index$7=require("./GeneralOperation/index.js"),index$3=require("./ImgAttributeInfo/index.js"),index$8=require("./SwitchAttributeList/index.js"),index$1=require("./TagSidebar/index.js"),index$4=require("./TextToolSidebar/index.js"),index$6=require("./PointCloudToolSidebar/index.js"),index$b=require("./ToolStyle/index.js"),lbAnnotation=require("@labelbee/lb-annotation"),index$a=require("./ScribbleSidebar/index.js"),ToolIcons=require("./ToolIcons.js"),ctx=require("../../../store/ctx.js"),antd=require("antd"),index$5=require("../../../utils/index.js"),icon_menu_fold=require("../../../assets/annotation/common/icon_menu_fold.svg.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const{EVideoToolName,EPointCloudName}=lbAnnotation.cTool,{Panel}=es.Collapse,sidebarCls=`${index.prefix}-sidebar`,Sidebar=({sider:e,enableColorPicker:E,setSiderWidth:u,propsSiderWidth:$})=>{const d=ctx.useSelector(a=>StepUtils.getCurrentStepInfo(a.annotation.step,a.annotation.stepList)),[r,v]=React.useState(!0),t=d==null?void 0:d.tool,{t:c}=reactI18next.useTranslation();if(!t)return null;const b=a=>{const l=React__default.default.createElement(index$b,null);return React__default.default.createElement(Panel,{header:c("Style"),className:"panel",key:a},l)},s=React__default.default.createElement(ToolIcons.ToolIcons,{toolName:t,onChange:()=>{}}),o=React__default.default.createElement(index$8,null),f=React__default.default.createElement(index$9,null),m=React__default.default.createElement(es.Collapse,{defaultActiveKey:["1","imgAttribute"],bordered:!1,expandIconPosition:"right",className:`${sidebarCls}__content`,expandIcon:index$1.expandIconFuc},b("1")),x=React__default.default.createElement(es.Collapse,{defaultActiveKey:["1","imgAttribute"],bordered:!1,expandIconPosition:"right",className:`${sidebarCls}__content`,expandIcon:index$1.expandIconFuc},React__default.default.createElement(Panel,{header:React__default.default.createElement("div",null,c("Adjust"),React__default.default.createElement(index$2,null)),className:"panel",key:"imgAttribute"},React__default.default.createElement(index$3,null))),n=React__default.default.createElement(index$7.default,null),T=React__default.default.createElement(index$1.default,null),N=React__default.default.createElement(index$4.default,null),p=React__default.default.createElement(index$a,{onChange:(a,l)=>{}}),i=React__default.default.createElement("div",{className:`${sidebarCls}__horizontal`}),g=React__default.default.createElement(index$6.default,{enableColorPicker:E}),S=React__default.default.createElement(index$7.PointCloudOperation,null);if(e)return typeof e=="function"?React__default.default.createElement("div",{className:`${sidebarCls}`},e({toolIcon:s,attributeList:o,annotationText:f,toolStyle:m,imageAttributeInfo:x,operation:n,tagToolSideBar:T,textToolSideBar:N,horizontal:i,pointCloudToolSidebar:g,pointCloudOperation:S,scribbleSidebar:p})):e;if([ToolType.EToolName.Rect,ToolType.EToolName.Point,ToolType.EToolName.Line,ToolType.EToolName.Rect,ToolType.EToolName.Polygon,ToolType.EToolName.Cuboid].includes(t))return React__default.default.createElement("div",{className:`${sidebarCls}`},s,i,o,f,i,React__default.default.createElement("div",{className:`${sidebarCls}__content`},m,x),n);if(t===ToolType.EToolName.Tag)return React__default.default.createElement("div",{className:`${sidebarCls}`},React__default.default.createElement(index$1.default,null));if(t===EVideoToolName.VideoTagTool)return React__default.default.createElement("div",{className:`${sidebarCls}`},React__default.default.createElement("div",{className:`${sidebarCls}__content`},React__default.default.createElement(index$1.default,null)),n);if(t===ToolType.EToolName.Text)return React__default.default.createElement("div",{className:`${sidebarCls}`},React__default.default.createElement(index$4.default,null));if(t===EPointCloudName.PointCloud){const a=()=>{v(!r),u&&u(r?48:void 0)},l=React__default.default.createElement("div",{style:{width:"48px",height:"100%",display:"flex",justifyContent:"center",background:"#ffffff"}},React__default.default.createElement("span",{onClick:()=>a()},React__default.default.createElement("img",{style:{width:"16px",height:"16px",marginTop:"18px",cursor:"pointer",transform:"rotate(180deg)"},src:icon_menu_fold})));return r?React__default.default.createElement(antd.Tabs,{type:"card",activeKey:"1",className:index$5.classnames({[`${sidebarCls}`]:!0,[`${sidebarCls}__pointCloud`]:!0})},React__default.default.createElement(antd.Tabs.TabPane,{tab:React__default.default.createElement("span",{onClick:()=>a()},React__default.default.createElement("img",{style:{width:"16px",height:"16px",marginLeft:"4px",cursor:"pointer"},src:icon_menu_fold})),key:""}),React__default.default.createElement(antd.Tabs.TabPane,{tab:"\u5DE5\u5177\u9762\u677F",key:"1",style:{height:"100%",display:"flex",flexDirection:"column"}},React__default.default.createElement("div",{className:`${sidebarCls}__content`},React__default.default.createElement(index$6.default,null)),React__default.default.createElement(index$7.PointCloudOperation,null))):l}return t===ToolType.EToolName.ScribbleTool?React__default.default.createElement("div",{className:`${sidebarCls}`},React__default.default.createElement("div",{className:`${sidebarCls}__content`},p,o),n):null};exports.default=Sidebar,exports.sidebarCls=sidebarCls;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var index=require("../../../constant/index.js"),ToolType=require("../../../data/enums/ToolType.js"),StepUtils=require("../../../utils/StepUtils.js"),es=require("antd/es"),React=require("react"),reactI18next=require("react-i18next"),index$9=require("./AnnotationText/index.js"),index$2=require("./ClearIcon/index.js"),index$7=require("./GeneralOperation/index.js"),index$3=require("./ImgAttributeInfo/index.js"),index$8=require("./SwitchAttributeList/index.js"),index$1=require("./TagSidebar/index.js"),index$4=require("./TextToolSidebar/index.js"),index$6=require("./PointCloudToolSidebar/index.js"),index$b=require("./ToolStyle/index.js"),lbAnnotation=require("@labelbee/lb-annotation"),index$a=require("./ScribbleSidebar/index.js"),ToolIcons=require("./ToolIcons.js"),ctx=require("../../../store/ctx.js"),antd=require("antd"),index$5=require("../../../utils/index.js"),icon_menu_fold=require("../../../assets/annotation/common/icon_menu_fold.svg.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const{EVideoToolName,EPointCloudName}=lbAnnotation.cTool,{Panel}=es.Collapse,sidebarCls=`${index.prefix}-sidebar`,Sidebar=({sider:e,enableColorPicker:E,setSiderWidth:u,propsSiderWidth:$})=>{const d=ctx.useSelector(a=>StepUtils.getCurrentStepInfo(a.annotation.step,a.annotation.stepList)),[r,v]=React.useState(!0),t=d==null?void 0:d.tool,{t:c}=reactI18next.useTranslation();if(!t)return null;const b=a=>{const l=React__default.default.createElement(index$b,null);return React__default.default.createElement(Panel,{header:c("Style"),className:"panel",key:a},l)},s=React__default.default.createElement(ToolIcons.ToolIcons,{toolName:t,onChange:()=>{}}),o=React__default.default.createElement(index$8,null),f=React__default.default.createElement(index$9,null),m=React__default.default.createElement(es.Collapse,{defaultActiveKey:["1","imgAttribute"],bordered:!1,expandIconPosition:"right",className:`${sidebarCls}__content`,expandIcon:index$1.expandIconFuc},b("1")),x=React__default.default.createElement(es.Collapse,{defaultActiveKey:["1","imgAttribute"],bordered:!1,expandIconPosition:"right",className:`${sidebarCls}__content`,expandIcon:index$1.expandIconFuc},React__default.default.createElement(Panel,{header:React__default.default.createElement("div",null,c("Adjust"),React__default.default.createElement(index$2,null)),className:"panel",key:"imgAttribute"},React__default.default.createElement(index$3,null))),n=React__default.default.createElement(index$7.default,null),T=React__default.default.createElement(index$1.default,null),g=React__default.default.createElement(index$4.default,null),p=React__default.default.createElement(index$a,{onChange:(a,l)=>{}}),i=React__default.default.createElement("div",{className:`${sidebarCls}__horizontal`}),N=React__default.default.createElement(index$6.default,{enableColorPicker:E}),S=React__default.default.createElement(index$7.PointCloudOperation,null);if(e)return typeof e=="function"?React__default.default.createElement("div",{className:`${sidebarCls}`},e({toolIcon:s,attributeList:o,annotationText:f,toolStyle:m,imageAttributeInfo:x,operation:n,tagToolSideBar:T,textToolSideBar:g,horizontal:i,pointCloudToolSidebar:N,pointCloudOperation:S,scribbleSidebar:p})):e;if([ToolType.EToolName.Rect,ToolType.EToolName.Point,ToolType.EToolName.Line,ToolType.EToolName.Rect,ToolType.EToolName.Polygon,ToolType.EToolName.Cuboid].includes(t))return React__default.default.createElement("div",{className:`${sidebarCls}`},s,i,o,f,i,React__default.default.createElement("div",{className:`${sidebarCls}__content`},m,x),n);if(t===ToolType.EToolName.Tag)return React__default.default.createElement("div",{className:`${sidebarCls}`},React__default.default.createElement(index$1.default,null));if(t===EVideoToolName.VideoTagTool)return React__default.default.createElement("div",{className:`${sidebarCls}`},React__default.default.createElement("div",{className:`${sidebarCls}__content`},React__default.default.createElement(index$1.default,null)),n);if(t===ToolType.EToolName.Text)return React__default.default.createElement("div",{className:`${sidebarCls}`},React__default.default.createElement(index$4.default,null));if(t===EPointCloudName.PointCloud){const a=()=>{v(!r),u&&u(r?48:void 0)},l=React__default.default.createElement("div",{style:{width:"48px",height:"100%",display:"flex",justifyContent:"center",background:"#ffffff"}},React__default.default.createElement("span",{onClick:()=>a()},React__default.default.createElement("img",{style:{width:"16px",height:"16px",marginTop:"18px",cursor:"pointer",transform:"rotate(180deg)"},src:icon_menu_fold})));return r?React__default.default.createElement(antd.Tabs,{type:"card",activeKey:"1",className:index$5.classnames({[`${sidebarCls}`]:!0,[`${sidebarCls}__pointCloud`]:!0}),tabBarExtraContent:{left:React__default.default.createElement("span",{onClick:()=>a(),style:{padding:"0px 4px"}},React__default.default.createElement("img",{style:{width:"16px",height:"16px",marginLeft:"4px",cursor:"pointer"},src:icon_menu_fold}))}},React__default.default.createElement(antd.Tabs.TabPane,{tab:"\u5DE5\u5177\u9762\u677F",key:"1",style:{height:"100%",display:"flex",flexDirection:"column"}},React__default.default.createElement("div",{className:`${sidebarCls}__content`},React__default.default.createElement(index$6.default,null)),React__default.default.createElement(index$7.PointCloudOperation,null))):l}return t===ToolType.EToolName.ScribbleTool?React__default.default.createElement("div",{className:`${sidebarCls}`},React__default.default.createElement("div",{className:`${sidebarCls}__content`},p,o),n):null};exports.default=Sidebar,exports.sidebarCls=sidebarCls;
@@ -1 +1 @@
1
- import e from"react";import{Tooltip as y}from"antd";import D from"../../../../assets/toolStyle/icon_defaultSize.svg.js";import{useTranslation as S}from"react-i18next";const b=({limit:n,updateSize:a})=>{var i,o;const{t}=S(),l=(i=n==null?void 0:n.sizeLimit)==null?void 0:i.defaultSize,r=(o=n==null?void 0:n.sizeLimit)==null?void 0:o.sizeRange,m=n==null?void 0:n.positionLimit,{heightDefault:u,depthDefault:s,widthDefault:c}=l||{},{heightMax:p,heightMin:d,depthMax:$,depthMin:g,widthMax:h,widthMin:E}=r||{},{XMin:v,XMax:f,YMin:x,YMax:M,ZMin:z,ZMax:L}=m||{};return e.createElement(y,{color:"rgba(0, 0, 0, 0.75)",title:e.createElement("div",{style:{padding:"8px"}},l&&e.createElement("div",{style:{marginBottom:"24px"}},e.createElement("div",null,"\u3010",t("DefaultSize"),"\u3011"),e.createElement("span",null,`${t("Length")}: ${c}m\u3001`),e.createElement("span",null,`${t("Width")}: ${u}m\u3001`),e.createElement("span",null,`${t("Height")}: ${s}m`)),r&&e.createElement("div",{style:{marginBottom:"24px"}},e.createElement("div",null,"*",t("NormalSizeRange")),e.createElement("span",null,`${t("Length")}: ${E}~${h}m\u3001`),e.createElement("span",null,`${t("Width")}: ${d}~${p}m\u3001`),e.createElement("span",null,`${t("Height")}: ${g}~${$}m`)),m&&e.createElement("div",null,e.createElement("div",null,"*",t("NormalCenterPointRange")),e.createElement("span",null,`X: ${v}~${f}\u3001`),e.createElement("span",null,`Y: ${x}~${M}\u3001`),e.createElement("span",null,`Z: ${z}~${L}`))),placement:"bottomRight"},e.createElement("img",{src:D,style:{margin:"0px 8px"},onClick:R=>{R.preventDefault(),l&&(a==null||a(l))}}))};export{b as default};
1
+ import e from"react";import{Tooltip as B}from"antd";import H from"../../../../assets/toolStyle/icon_defaultSize.svg.js";import{useTranslation as N}from"react-i18next";const W=({limit:l,updateSize:r})=>{var c,u,s,m;const{t}=N(),d={and:t("And"),or:t("Or")},a=(c=l==null?void 0:l.sizeLimit)==null?void 0:c.defaultSize,i=(u=l==null?void 0:l.sizeLimit)==null?void 0:u.sizeRange,o=((s=l==null?void 0:l.sizeLimit)==null?void 0:s.logicalCondition)||[],g=l==null?void 0:l.positionLimit,{heightDefault:$,depthDefault:v,widthDefault:E}=a||{},{heightMax:f,heightMin:x,depthMax:L,depthMin:M,widthMax:z,widthMin:R}=i||{},{XMin:T,XMax:w,YMin:y,YMax:S,ZMin:_,ZMax:C}=g||{},D=o.length>0||i,p=n=>{switch(n){case"width":return t("Length");case"height":return t("Width");case"depth":return t("Height")}return""};return e.createElement(B,{color:"rgba(0, 0, 0, 0.75)",title:e.createElement("div",{style:{padding:"8px"}},a&&e.createElement("div",{style:{marginBottom:"24px"}},e.createElement("div",null,"\u3010",t("DefaultSize"),"\u3011"),e.createElement("span",null,`${t("Length")}: ${E}m\u3001`),e.createElement("span",null,`${t("Width")}: ${$}m\u3001`),e.createElement("span",null,`${t("Height")}: ${v}m`)),D&&e.createElement("div",{style:{marginBottom:"24px"}},e.createElement("div",null,"*",t("NormalSizeRange")),i&&e.createElement("span",null,"(",e.createElement("span",null,`${t("Length")}: ${R}~${z}m\u3001`),e.createElement("span",null,`${t("Width")}: ${x}~${f}m\u3001`),e.createElement("span",null,`${t("Height")}: ${M}~${L}m`),")"),o.length>0&&e.createElement(e.Fragment,null,i?` ${d[(m=o[0])==null?void 0:m.logical]} `:null,e.createElement("span",null,"(",o.map((n,h)=>{const X=p(n==null?void 0:n.dimensionLeft),b=p(n==null?void 0:n.dimensionRight);return e.createElement("span",{key:h},h!==0?` ${d[n==null?void 0:n.logical]} `:null,`${X} ${n==null?void 0:n.condition} ${b} `)}),")"))),g&&e.createElement("div",null,e.createElement("div",null,"*",t("NormalCenterPointRange")),e.createElement("span",null,`X: ${T}~${w}\u3001`),e.createElement("span",null,`Y: ${y}~${S}\u3001`),e.createElement("span",null,`Z: ${_}~${C}`))),placement:"bottomRight"},e.createElement("img",{src:H,style:{margin:"0px 8px"},onClick:n=>{n.preventDefault(),a&&(r==null||r(a))}}))};export{W as default};
@@ -1 +1 @@
1
- import{COLORS_ARRAY as m,NULL_COLOR as T}from"../../data/Style.js";import{ColorTag as A}from"../colorTag/index.js";import{Radio as d}from"antd/es";import l,{useState as f}from"react";import{Popover as P}from"antd";import S from"../colorPalette/index.js";import{CloseOutlined as _}from"@ant-design/icons";import{useTranslation as j}from"react-i18next";import I from"./components/limitPopover/index.js";const b=[T].concat(m),N=l.forwardRef((e,C)=>{const v=l.useRef(),{t:g}=j(),E=e.list||[],[R,r]=f(!1),[h,y]=f(void 0);let n=[...b];e.forbidDefault===!0&&(n=n.slice(1));let c="sensebee-radio-group";e.noHeightLimit&&(c="sensebee-radio-group-no-limit-height");const L=(t,o)=>{e.updateColorConfig&&e.updateColorConfig(t,o)};return l.createElement("div",{className:c,style:e.style},l.createElement(d.Group,{name:"radiogroup",defaultValue:e==null?void 0:e.selectedAttribute,value:e==null?void 0:e.selectedAttribute,onChange:t=>e.attributeChanged(t.target.value),ref:C},E.map((t,o)=>{var s;let a=(s=e==null?void 0:e.num)!=null?s:o;const O=(t==null?void 0:t.value)===(e==null?void 0:e.selectedAttribute);e.forbidDefault===!0&&typeof a=="number"&&a++,typeof a=="number"&&a<=9&&a>=0||(a="-");let u=o>8&&!e.forbidDefault?m[(o-1)%m.length]:n[o%n.length];return(t==null?void 0:t.color)&&(u=t.color),l.createElement(d,{value:t.value,ref:v,key:t.label+o},l.createElement("span",{className:"sensebee-radio-label",title:t.label},!(e==null?void 0:e.forbidColor)&&l.createElement(P,{content:l.createElement(S,{defaultColor:u,setColor:i=>L(t.value,i)}),title:l.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},l.createElement("span",null,g("Palette")),l.createElement(_,{onClick:()=>r(!1)})),visible:R&&h===o,onVisibleChange:i=>{!i||r(i)}},l.createElement(A,{color:u,style:{cursor:"pointer",marginRight:"8px"},onClick:()=>{(e==null?void 0:e.enableColorPicker)&&(y(o),r(!0))}})),t.label),(t==null?void 0:t.limit)&&O&&l.createElement(I,{limit:t.limit,updateSize:e==null?void 0:e.updateSize}),l.createElement("span",{className:"sensebee-radio-num"},a))})))});export{b as ATTRIBUTE_COLORS,N as default};
1
+ import{COLORS_ARRAY as m,NULL_COLOR as I}from"../../data/Style.js";import{ColorTag as N}from"../colorTag/index.js";import{Radio as b}from"antd/es";import l,{useState as g}from"react";import{Popover as k}from"antd";import V from"../colorPalette/index.js";import{CloseOutlined as w}from"@ant-design/icons";import{useTranslation as x}from"react-i18next";import D from"./components/limitPopover/index.js";const C=[I].concat(m),U=l.forwardRef((e,E)=>{const h=l.useRef(),{t:R}=x(),L=e.list||[],[y,r]=g(!1),[O,P]=g(void 0);let n=[...C];e.forbidDefault===!0&&(n=n.slice(1));let c="sensebee-radio-group";e.noHeightLimit&&(c="sensebee-radio-group-no-limit-height");const T=(t,o)=>{e.updateColorConfig&&e.updateColorConfig(t,o)};return l.createElement("div",{className:c,style:e.style},l.createElement(b.Group,{name:"radiogroup",defaultValue:e==null?void 0:e.selectedAttribute,value:e==null?void 0:e.selectedAttribute,onChange:t=>e.attributeChanged(t.target.value),ref:E},L.map((t,o)=>{var s,d,f;let i=(s=e==null?void 0:e.num)!=null?s:o;const A=(t==null?void 0:t.value)===(e==null?void 0:e.selectedAttribute);e.forbidDefault===!0&&typeof i=="number"&&i++,typeof i=="number"&&i<=9&&i>=0||(i="-");let u=o>8&&!e.forbidDefault?m[(o-1)%m.length]:n[o%n.length];(t==null?void 0:t.color)&&(u=t.color);const{defaultSize:S,logicalCondition:v,sizeRange:_}=((d=t==null?void 0:t.limit)==null?void 0:d.sizeLimit)||{},j=((f=t==null?void 0:t.limit)==null?void 0:f.positionLimit)||S||_||(v==null?void 0:v.length)>0,z=A&&j;return l.createElement(b,{value:t.value,ref:h,key:t.label+o},l.createElement("span",{className:"sensebee-radio-label",title:t.label},!(e==null?void 0:e.forbidColor)&&l.createElement(k,{content:l.createElement(V,{defaultColor:u,setColor:a=>T(t.value,a)}),title:l.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},l.createElement("span",null,R("Palette")),l.createElement(w,{onClick:()=>r(!1)})),visible:y&&O===o,onVisibleChange:a=>{!a||r(a)}},l.createElement(N,{color:u,style:{cursor:"pointer",marginRight:"8px"},onClick:()=>{(e==null?void 0:e.enableColorPicker)&&(P(o),r(!0))}})),t.label),z&&l.createElement(D,{limit:t.limit,updateSize:e==null?void 0:e.updateSize}),l.createElement("span",{className:"sensebee-radio-num"},i))})))});export{C as ATTRIBUTE_COLORS,U as default};
@@ -1 +1 @@
1
- import{getClassName as C}from"../../utils/dom.js";import d,{useRef as v,useState as H,useCallback as L,useEffect as P}from"react";import _ from"../AnnotationView/index.js";import z from"../../hooks/useSize.js";import{useSingleBox as E}from"./hooks/useSingleBox.js";import{useHighlight as I}from"./hooks/useHighlight.js";import N from"./components/HighlightVisible/index.js";var R=(n,c,t)=>new Promise((u,e)=>{var s=o=>{try{l(t.next(o))}catch(a){e(a)}},i=o=>{try{l(t.throw(o))}catch(a){e(a)}},l=o=>o.done?u(o.value):Promise.resolve(o.value).then(s,i);l((t=t.apply(n,c)).next())});const A=({view2dData:n,setSelectedID:c,currentData:t})=>{var u;const e=v(null),s=v(),{selectedBox:i}=E(),l=z(e),{url:o,calib:a}=n,{toggle2dVisible:y,isHighlightVisible:x}=I({currentData:t}),[k,g]=H(!1),S=!n,V=m=>{f()},f=L(()=>{var m,h;const p=(m=s.current)==null?void 0:m.toolInstance;if(c(""),!i||!p)return;const r=n.annotations.find(B=>B.annotation.id===i.info.id);let b="";r&&((h=r==null?void 0:r.annotation.pointList)==null?void 0:h.length)>0&&(p.focusPositionByPointList(r==null?void 0:r.annotation.pointList),b=i.info.id,c(b))},[i,s.current,n.annotations]);P(()=>{f()},[f]);const j=()=>R(void 0,null,function*(){g(!0),yield y(o,a),g(!1)});return d.createElement("div",{className:C("point-cloud-2d-image"),ref:e},d.createElement(_,{src:(u=n==null?void 0:n.url)!=null?u:"",annotations:n.annotations,size:l,ref:s,globalStyle:{display:S?"none":"block"},afterImgOnLoad:V,zoomInfo:{min:.01,max:1e3,ratio:.4}}),d.createElement(N,{visible:x(o),onClick:j,loading:k,style:{position:"absolute",right:16,top:16}}))};export{A as default};
1
+ import{getClassName as C}from"../../utils/dom.js";import m,{useRef as v,useState as H,useCallback as L,useEffect as P}from"react";import _ from"../AnnotationView/index.js";import E from"../../hooks/useSize.js";import{useSingleBox as I}from"./hooks/useSingleBox.js";import{useHighlight as N}from"./hooks/useHighlight.js";import R from"./components/HighlightVisible/index.js";var A=(o,r,i)=>new Promise((u,s)=>{var c=n=>{try{t(i.next(n))}catch(e){s(e)}},l=n=>{try{t(i.throw(n))}catch(e){s(e)}},t=n=>n.done?u(n.value):Promise.resolve(n.value).then(c,l);t((i=i.apply(o,r)).next())});const O=({view2dData:o,setSelectedID:r,currentData:i,showEnlarge:u})=>{var s;const c=v(null),l=v(),{selectedBox:t}=I(),n=E(c),{url:e,calib:x}=o,{toggle2dVisible:y,isHighlightVisible:k}=N({currentData:i}),[S,g]=H(!1),V=!o,j=f=>{d()},d=L(()=>{var f,h;const p=(f=l.current)==null?void 0:f.toolInstance;if(r(""),!t||!p)return;const a=o.annotations.find(B=>B.annotation.id===t.info.id);let b="";a&&((h=a==null?void 0:a.annotation.pointList)==null?void 0:h.length)>0&&(p.focusPositionByPointList(a==null?void 0:a.annotation.pointList),b=t.info.id,r(b))},[t,l.current,o.annotations]);P(()=>{d()},[d]);const z=()=>A(void 0,null,function*(){g(!0),yield y(e,x),g(!1)});return m.createElement("div",{className:C("point-cloud-2d-image"),ref:c},m.createElement(_,{src:(s=o==null?void 0:o.url)!=null?s:"",annotations:o.annotations,size:n,ref:l,globalStyle:{display:V?"none":"block"},afterImgOnLoad:j,zoomInfo:{min:.01,max:1e3,ratio:.4}}),m.createElement(R,{visible:k(e),onClick:z,loading:S,style:{position:"absolute",right:16,top:16,zIndex:u?-1:101}}))};export{O as default};
@@ -1 +1 @@
1
- import{getClassName as N}from"../../utils/dom.js";import n,{useState as E,useContext as Q,useEffect as S}from"react";import{PointCloudContainer as U}from"./PointCloudLayout.js";import{PointCloudContext as W}from"./PointCloudContext.js";import{connect as X}from"react-redux";import{cKeyCode as Y,pointCloudLidar2image as Z}from"@labelbee/lb-annotation";import{LabelBeeContext as B}from"../../store/ctx.js";import{a2MapStateToProps as ee}from"../../store/annotation/map.js";import{toolStyleConverter as te}from"@labelbee/lb-utils";import ne from"./PointCloud2DSingleView.js";import V from"./components/TitleButton/index.js";import{LeftOutlined as oe}from"@ant-design/icons";import ie from"classnames";import le from"../../assets/annotation/common/icon_esc.svg.js";import re from"../../assets/annotation/common/icon_left_squareOutlined.svg.js";import se from"../../assets/annotation/common/icon_right_squareOutlined.svg.js";var ae=Object.defineProperty,ce=Object.defineProperties,me=Object.getOwnPropertyDescriptors,R=Object.getOwnPropertySymbols,ue=Object.prototype.hasOwnProperty,pe=Object.prototype.propertyIsEnumerable,A=(e,o,t)=>o in e?ae(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t,_=(e,o)=>{for(var t in o||(o={}))ue.call(o,t)&&A(e,t,o[t]);if(R)for(var t of R(o))pe.call(o,t)&&A(e,t,o[t]);return e},C=(e,o)=>ce(e,me(o));const x=Y.default,de=({showEnlarge:e,isEnlargeTopView:o,data:t,setIsEnlarge:d,setCurIndex:m,curIndex:g=0,index:a,annotations2d:f})=>o?n.createElement(V,{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(oe,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{d(!1),m(void 0)}}),n.createElement("span",null,t==null?void 0:t.calName),n.createElement("span",{style:{marginLeft:"8px"}},g+1,"/",f==null?void 0:f.length)):n.createElement(V,{title:t==null?void 0:t.calName,onClick:()=>{d(!0),m(a)},style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}),ge=({currentData:e,config:o,thumbnailWidth:t,isEnlargeTopView:d,highlightAttribute:m})=>{var g;const[a,f]=E([]),{topViewInstance:T,displayPointCloudList:h}=Q(W),[w,K]=E(""),[v,b]=E(!1),[r,y]=E(void 0);S(()=>{var i;if(T&&(e==null?void 0:e.mappingImgList)&&((i=e==null?void 0:e.mappingImgList)==null?void 0:i.length)>0){const l={fill:"transparent",color:"green"};let s=[];e==null||e.mappingImgList.forEach(c=>{var u;const D=h.reduce((M,p)=>{var j;const G=p.id===w||m===p.attribute,{transferViewData:H,viewRangePointList:P}=Z(p,c.calib,{createRange:G}),k=(j=te.getColorFromConfig({attribute:p.attribute},C(_({},o),{attributeConfigurable:!0}),{}))==null?void 0:j.stroke,J=$({viewDataPointList:H,pointCloudBox:p,defaultViewStyle:l,stroke:k}),I=[...M,...J];return(P==null?void 0:P.length)>0&&I.push({type:"polygon",annotation:C(_({id:w,pointList:P},l),{stroke:k,fill:"rgba(255, 255, 255, 0.6)"})}),I},[]);s.push({annotations:D,url:c==null?void 0:c.url,calName:(u=c.calib)==null?void 0:u.calName,calib:c==null?void 0:c.calib})}),f(s)}},[h,e==null?void 0:e.mappingImgList,w,m]),S(()=>(window.addEventListener("keydown",L),()=>{window.removeEventListener("keydown",L)}),[r]);const L=i=>{const{keyCode:l}=i;switch(l){case x.Esc:v&&b(!1);break;case x.Left:F();break;case x.Right:O();break}},F=()=>{r===void 0||!v||Number(r)>0&&y(r-1)},O=()=>{r===void 0||!v||Number(r)<(a==null?void 0:a.length)-1&&y(r+1)},$=({viewDataPointList:i,pointCloudBox:l,defaultViewStyle:s,stroke:c})=>i.map(u=>({type:u.type,annotation:C(_({id:l.id,pointList:u.pointList},s),{stroke:c})})),q=!e||!(e==null?void 0:e.mappingImgList)||!(((g=e==null?void 0:e.mappingImgList)==null?void 0:g.length)>0),z=n.createElement("div",{style:{display:"flex",alignItems:"center",fontSize:"14px"}},n.createElement("img",{src:re,style:{height:"24px",marginRight:"8px",cursor:"pointer"},onClick:()=>F()}),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:se,style:{height:"24px",marginRight:"12px",cursor:"pointer"},onClick:()=>O()}),n.createElement("img",{src:le,style:{height:"24px",margin:"0px 8px 0px 12px",cursor:"pointer"},onClick:()=>{b(!1),y(void 0)}}),n.createElement("span",null,"\u952E\u9000\u51FA"));return(a==null?void 0:a.length)>0?n.createElement(n.Fragment,null,a.map((i,l)=>{const s=v&&l===r;return n.createElement(U,{className:ie({[N("point-cloud-2d-container")]:!0,[N("point-cloud-container","zoom")]:s}),title:n.createElement(de,{showEnlarge:s,isEnlargeTopView:d,data:i,setIsEnlarge:b,setCurIndex:y,curIndex:r,index:l,annotations2d:a}),titleOnSurface:!s,style:{display:q?"none":"flex",width:s?"100%":t},key:l,toolbar:z},(i==null?void 0:i.annotations)&&(i==null?void 0:i.url)&&n.createElement(ne,{currentData:e,view2dData:i,setSelectedID:K}))})):null};var fe=X(ee,null,null,{context:B})(ge);export{fe as default};
1
+ import{getClassName as N}from"../../utils/dom.js";import n,{useState as E,useContext as U,useEffect as S}from"react";import{PointCloudContainer as W}from"./PointCloudLayout.js";import{PointCloudContext as X}from"./PointCloudContext.js";import{connect as Y}from"react-redux";import{cKeyCode as Z,pointCloudLidar2image as B}from"@labelbee/lb-annotation";import{LabelBeeContext as ee}from"../../store/ctx.js";import{a2MapStateToProps as te}from"../../store/annotation/map.js";import{toolStyleConverter as ne}from"@labelbee/lb-utils";import oe from"./PointCloud2DSingleView.js";import V from"./components/TitleButton/index.js";import{LeftOutlined as ie}from"@ant-design/icons";import re from"classnames";import le from"../../assets/annotation/common/icon_esc.svg.js";import se from"../../assets/annotation/common/icon_left_squareOutlined.svg.js";import ae from"../../assets/annotation/common/icon_right_squareOutlined.svg.js";var ce=Object.defineProperty,me=Object.defineProperties,ue=Object.getOwnPropertyDescriptors,R=Object.getOwnPropertySymbols,pe=Object.prototype.hasOwnProperty,de=Object.prototype.propertyIsEnumerable,A=(e,o,t)=>o in e?ce(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t,_=(e,o)=>{for(var t in o||(o={}))pe.call(o,t)&&A(e,t,o[t]);if(R)for(var t of R(o))de.call(o,t)&&A(e,t,o[t]);return e},x=(e,o)=>me(e,ue(o));const C=Z.default,ge=({showEnlarge:e,isEnlargeTopView:o,data:t,setIsEnlarge:d,setCurIndex:m,curIndex:g=0,index:f,annotations2d:s})=>o?n.createElement(V,{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(ie,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{d(!1),m(void 0)}}),n.createElement("span",null,t==null?void 0:t.calName),n.createElement("span",{style:{marginLeft:"8px"}},g+1,"/",s==null?void 0:s.length)):n.createElement(V,{title:t==null?void 0:t.calName,onClick:()=>{d(!0),m(f)},style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}),fe=({currentData:e,config:o,thumbnailWidth:t,isEnlargeTopView:d,highlightAttribute:m,loadPCDFileLoading:g})=>{var f;const[s,T]=E([]),{topViewInstance:K,displayPointCloudList:h}=U(X),[w,$]=E(""),[v,b]=E(!1),[a,y]=E(void 0);S(()=>{var i;if(!g&&K&&(e==null?void 0:e.mappingImgList)&&((i=e==null?void 0:e.mappingImgList)==null?void 0:i.length)>0){const r={fill:"transparent",color:"green"};let l=[];e==null||e.mappingImgList.forEach(c=>{var u;const D=h.reduce((G,p)=>{var j;const H=p.id===w||m===p.attribute,{transferViewData:J,viewRangePointList:P}=B(p,c.calib,{createRange:H}),k=(j=ne.getColorFromConfig({attribute:p.attribute},x(_({},o),{attributeConfigurable:!0}),{}))==null?void 0:j.stroke,Q=q({viewDataPointList:J,pointCloudBox:p,defaultViewStyle:r,stroke:k}),I=[...G,...Q];return(P==null?void 0:P.length)>0&&I.push({type:"polygon",annotation:x(_({id:w,pointList:P},r),{stroke:k,fill:"rgba(255, 255, 255, 0.6)"})}),I},[]);l.push({annotations:D,url:c==null?void 0:c.url,calName:(u=c.calib)==null?void 0:u.calName,calib:c==null?void 0:c.calib})}),T(l)}},[h,e==null?void 0:e.mappingImgList,w,m,g]),S(()=>(window.addEventListener("keydown",L),()=>{window.removeEventListener("keydown",L)}),[a]);const L=i=>{const{keyCode:r}=i;switch(r){case C.Esc:v&&b(!1);break;case C.Left:F();break;case C.Right:O();break}},F=()=>{a===void 0||!v||Number(a)>0&&y(a-1)},O=()=>{a===void 0||!v||Number(a)<(s==null?void 0:s.length)-1&&y(a+1)},q=({viewDataPointList:i,pointCloudBox:r,defaultViewStyle:l,stroke:c})=>i.map(u=>({type:u.type,annotation:x(_({id:r.id,pointList:u.pointList},l),{stroke:c})})),z=!e||!(e==null?void 0:e.mappingImgList)||!(((f=e==null?void 0:e.mappingImgList)==null?void 0:f.length)>0),M=n.createElement("div",{style:{display:"flex",alignItems:"center",fontSize:"14px"}},n.createElement("img",{src:se,style:{height:"24px",marginRight:"8px",cursor:"pointer"},onClick:()=>F()}),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:ae,style:{height:"24px",marginRight:"12px",cursor:"pointer"},onClick:()=>O()}),n.createElement("img",{src:le,style:{height:"24px",margin:"0px 8px 0px 12px",cursor:"pointer"},onClick:()=>{b(!1),y(void 0)}}),n.createElement("span",null,"\u952E\u9000\u51FA"));return(s==null?void 0:s.length)>0?n.createElement(n.Fragment,null,s.map((i,r)=>{const l=v&&r===a;return n.createElement(W,{className:re({[N("point-cloud-2d-container")]:!0,[N("point-cloud-container","zoom")]:l}),title:n.createElement(ge,{showEnlarge:l,isEnlargeTopView:d,data:i,setIsEnlarge:b,setCurIndex:y,curIndex:a,index:r,annotations2d:s}),titleOnSurface:!l,style:{display:z?"none":"flex",width:l?"100%":t},key:r,toolbar:M},(i==null?void 0:i.annotations)&&(i==null?void 0:i.url)&&n.createElement(oe,{currentData:e,view2dData:i,setSelectedID:$,showEnlarge:l}))})):null};var ve=Y(te,null,null,{context:ee})(fe);export{ve as default};
@@ -1 +1 @@
1
- import c from"react";import{EyeFilled as d,EyeInvisibleFilled as p,LoadingOutlined as f}from"@ant-design/icons";var u=Object.defineProperty,n=Object.getOwnPropertySymbols,_=Object.prototype.hasOwnProperty,m=Object.prototype.propertyIsEnumerable,l=(t,e,r)=>e in t?u(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,s=(t,e)=>{for(var r in e||(e={}))_.call(e,r)&&l(t,r,e[r]);if(n)for(var r of n(e))m.call(e,r)&&l(t,r,e[r]);return t};const g=({visible:t,style:e,onClick:r,loading:o})=>{const a={background:"rgba(0, 0, 0, 0.74)",color:"white",borderRadius:2,padding:6,fontSize:16,zIndex:101};let i=t?d:p;return o&&(i=f,Object.assign(a,{borderRadius:100})),c.createElement(i,{style:s(s({},a),e),onClick:o?()=>{}:r})};export{g as default};
1
+ import c from"react";import{EyeFilled as p,EyeInvisibleFilled as d,LoadingOutlined as f}from"@ant-design/icons";import{getClassName as u}from"../../../../utils/dom.js";var m=Object.defineProperty,l=Object.getOwnPropertySymbols,g=Object.prototype.hasOwnProperty,_=Object.prototype.propertyIsEnumerable,n=(t,e,r)=>e in t?m(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,s=(t,e)=>{for(var r in e||(e={}))g.call(e,r)&&n(t,r,e[r]);if(l)for(var r of l(e))_.call(e,r)&&n(t,r,e[r]);return t};const y=({visible:t,style:e,onClick:r,loading:o})=>{const i={background:"rgba(0, 0, 0, 0.74)",color:"white",borderRadius:2,padding:6,fontSize:16};let a=t?p:d;return o&&(a=f,Object.assign(i,{borderRadius:100})),c.createElement(a,{className:u("point-cloud-highlight-view"),style:s(s({},i),e),onClick:o?()=>{}:r})};export{y as default};
@@ -1 +1 @@
1
- import{EPointCloudName as J,MathUtils as B,getCuboidFromPointCloudBox as Rt}from"@labelbee/lb-annotation";import{EPerspectiveView as W,PointCloudUtils as I,DEFAULT_SPHERE_PARAMS as Nt}from"@labelbee/lb-utils";import{useContext as Et}from"react";import{PointCloudContext as Ht}from"../PointCloudContext.js";import{useSingleBox as lt}from"./useSingleBox.js";import{useSphere as Ft}from"./useSphere.js";import{useSelector as Zt,useDispatch as Wt}from"../../../store/ctx.js";import Mt from"../../../utils/StepUtils.js";import{jsonParser as dt}from"../../../utils/index.js";import{PreDataProcess as K,SetPointCloudLoading as at,SetLoadPCDFileLoading as ct}from"../../../store/annotation/actionCreators.js";import{message as Gt}from"antd";import{useTranslation as Qt}from"react-i18next";import{useHistory as Xt}from"./useHistory.js";import{usePolygon as Yt}from"./usePolygon.js";var qt=Object.defineProperty,Jt=Object.defineProperties,Kt=Object.getOwnPropertyDescriptors,ut=Object.getOwnPropertySymbols,$t=Object.prototype.hasOwnProperty,to=Object.prototype.propertyIsEnumerable,pt=(o,e,n)=>e in o?qt(o,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[e]=n,y=(o,e)=>{for(var n in e||(e={}))$t.call(e,n)&&pt(o,n,e[n]);if(ut)for(var n of ut(e))to.call(e,n)&&pt(o,n,e[n]);return o},k=(o,e)=>Jt(o,Kt(e)),$=(o,e,n)=>new Promise((l,t)=>{var d=u=>{try{a(n.next(u))}catch(P){t(P)}},f=u=>{try{a(n.throw(u))}catch(P){t(P)}},a=u=>u.done?l(u.value):Promise.resolve(u.value).then(d,f);a((n=n.apply(o,e)).next())});const Q=5,X=90,ft=.01,L={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},tt=(o,e,n,l,t)=>{const{x:d,y:f}=I.transferCanvas2World(o,e),{defaultZ:a}=Nt,u={center:{x:d,y:f,z:a},id:o.id},P=l?y(y({},l),u):k(y({},u),{attribute:"",valid:!0});return t&&Object.assign(P,t),P},ot=(o,e,n,l,t,d)=>{let f=o.pointList.map(h=>I.transferCanvas2World(h,e)),a=0,u=1,P={};if(n){const h=n.getSensesPointZAxisInPolygon(f,void 0,d);d&&h.fittedCoordinates.length>0&&(f=h.fittedCoordinates),a=(h.maxZ+h.minZ)/2,u=h.maxZ-h.minZ,P={count:h.zCount}}const[m,b,E]=f,V=B.getLineCenterPoint([m,E]),A=B.getLineLength(m,b),T=B.getLineLength(b,E),R=B.getRadiusFromQuadrangle(o.pointList);l&&(a=l.center.z,u=l.depth);const z={center:{x:V.x,y:V.y,z:a},width:d?T+ft:T,height:d?A+ft:A,depth:u,rotation:R,id:o.id},j=y(l?y(y({},l),z):k(y({},z),{attribute:"",valid:!0}),P);t&&Object.assign(j,t);const _=f.map(h=>I.transferWorld2Canvas(h,e));return{boxParams:j,newPointList:_}},Ct=(o,e,n)=>{const l={x:o.x-e.x,y:o.y-e.y};return k(y({},n),{center:{x:n.center.x-l.x,y:n.center.y,z:n.center.z-l.y}})},Pt=(o,e,n,l)=>{const[t,d,f]=o.pointList,[a,u,P]=e.pointList,m=B.getLineCenterPoint([t,f]),b=B.getLineCenterPoint([a,P]),V={x:{x:m.x-b.x,y:m.y-b.y}.x,y:0,z:m.y-b.y},A=B.getLineLength(t,d),T=B.getLineLength(a,u),R=A-T,z=B.getLineLength(d,f),j=B.getLineLength(u,P),_=z-j,{newBoxParams:h}=l.getNewBoxBySideUpdate(V,_,R,n);return h},oo=(o,e,n)=>{const l={x:o.x-e.x,y:o.y-e.y};return k(y({},n),{center:{x:n.center.x,y:n.center.y-l.x,z:n.center.z-l.y}})},eo=(o,e,n,l)=>{const[t,d,f]=o.pointList,[a,u,P]=e.pointList,m=B.getLineCenterPoint([t,f]),b=B.getLineCenterPoint([a,P]),V={x:{x:m.x-b.x,y:m.y-b.y}.x,y:0,z:m.y-b.y},A=B.getLineLength(t,d),T=B.getLineLength(a,u),R=A-T,z=B.getLineLength(d,f),j=B.getLineLength(u,P),_=z-j;let{newBoxParams:h}=l.getNewBoxByBackUpdate(V,_,R,n);return h},gt=(o,e,n,l,t)=>{var d;if(!n)return;const{toolInstance:f,pointCloudInstance:a}=n;a.loadPCDFile(l,(d=t==null?void 0:t.radius)!=null?d:X);const{cameraPositionVector:u}=a.updateOrthoCameraBySphere(o,W.Left);a.setInitCameraPosition(u);const{point2d:P,zoom:m}=a.getSphereSidePoint2DCoordinate(o);a.camera.zoom=m,a.camera.updateProjectionMatrix(),a.render(),f.initPosition(),f.zoomChangeOnCenter(m),f.setResult([k(y(y({},e),P),{valid:o.valid,textAttribute:"",attribute:o.attribute})]),f.setSelectedID(e.id)},mt=(o,e,n,l)=>{if(!n)return;const{pointCloud2dOperation:t,pointCloudInstance:d}=n;d.loadPCDFileByBox(l,o,{width:Q,depth:Q});const{cameraPositionVector:f}=d.updateOrthoCamera(o,W.Left);d.setInitCameraPosition(f);const{polygon2d:a,zoom:u}=d.getBoxSidePolygon2DCoordinate(o);d.camera.zoom=u,d.camera.updateProjectionMatrix(),d.render(),t.initPosition(),t.zoomChangeOnCenter(u),t.setResultAndSelectedID([{id:e.id,valid:o.valid,pointList:a,textAttribute:"",isRect:!0,attribute:o.attribute}],e.id)},xt=(o,e,n,l,t)=>{var d;if(!n)return;const{toolInstance:f,pointCloudInstance:a}=n;a.loadPCDFile(l,(d=t==null?void 0:t.radius)!=null?d:X);const{cameraPositionVector:u}=a.updateOrthoCameraBySphere(o,W.Back);a.setInitCameraPosition(u);const{point2d:P,zoom:m}=a.getSphereBackPoint2DCoordinate(o);a.camera.zoom=m,a.camera.updateProjectionMatrix(),a.render(),f.initPosition(),f.zoomChangeOnCenter(m),f.setResult([k(y(y({},e),P),{valid:o.valid,textAttribute:"",attribute:o.attribute})]),f.setSelectedID(e.id)},Lt=(o,e,n,l)=>{if(!n)return;const{pointCloud2dOperation:t,pointCloudInstance:d}=n;d.loadPCDFileByBox(l,o,{height:Q,depth:Q});const{cameraPositionVector:f}=d.updateOrthoCamera(o,W.Back);d.setInitCameraPosition(f);const{polygon2d:a,zoom:u}=d.getBoxBackPolygon2DCoordinate(o);d.camera.zoom=u,d.camera.updateProjectionMatrix(),d.render(),t.initPosition(),t.zoomChangeOnCenter(u),t.setResultAndSelectedID([{id:e.id,valid:o.valid,pointList:a,textAttribute:"",isRect:!0,attribute:o.attribute}],e.id)},yt=(o,e,n,l)=>{if(!n||!l)return;l.generateSphere(o),l.updateCameraBySphere(o,W.Top),l.render();const{toolInstance:t,pointCloudInstance:d}=n,{point2d:f}=d.getSphereTopPoint2DCoordinate(o),a=[...t.pointList].map(u=>u.id===e.id?k(y(y({},e),f),{valid:o.valid,textAttribute:"",attribute:o.attribute}):u);t.setResult(a),t.setSelectedID(e.id)},et=(o,e,n,l)=>{var t,d;if(!n||!l)return;l.generateBox(o,e.id),l.render();const{pointCloud2dOperation:f,pointCloudInstance:a}=n,{polygon2d:u}=a.getBoxTopPolygon2DCoordinate(o),P=[...f.polygonList],m=P.find(b=>b.id===e.id);m?(m.pointList=u,m.valid=(t=o.valid)!=null?t:!0):P.push({id:e.id,pointList:u,textAttribute:"",isRect:!0,valid:(d=o.valid)!=null?d:!0}),f.setResultAndSelectedID(P,e.id)},no=()=>{const o=Et(Ht),{topViewInstance:e,sideViewInstance:n,backViewInstance:l,mainViewInstance:t,addPointCloudBox:d,addPointCloudSphere:f,setSelectedIDs:a,selectedIDs:u,pointCloudBoxList:P,pointCloudSphereList:m,hideAttributes:b,setHighlight2DDataList:E}=o,{addHistory:V,initHistory:A,pushHistoryUnderUpdatePolygon:T,pushHistoryUnderUpdateLine:R}=Xt(),{selectedPolygon:z}=Yt(),{updateSelectedBox:j,updateSelectedBoxes:_,getPointCloudByID:h}=lt(),{getPointCloudSphereByID:ht,updatePointCloudSphere:nt,selectedSphere:M}=Ft(),{currentData:H,config:w}=Zt(i=>{const{stepList:s,step:p,imgList:c,imgIndex:r}=i.annotation;return{currentData:c[r],config:dt(Mt.getCurrentStepInfo(p,s).config)}}),N=Wt(),{selectedBox:D}=lt(),{t:vt}=Qt(),it=D==null?void 0:D.info;if(!e||!n||!l)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:Y}=e,Bt=i=>{t==null||t.generateBox(i),t==null||t.controls.update(),t==null||t.render()},wt=i=>{t==null||t.generateSphere(i),t==null||t.controls.update(),t==null||t.render()},bt=({newPoint:i,size:s,zoom:p,trackConfigurable:c})=>{var r;const C={attribute:(r=e.toolInstance.defaultAttribute)!=null?r:""};c===!0&&Object.assign(C,{trackID:I.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:m})});const g=tt(i,s,Y,void 0,C);a(i.id);const x=f(g);G(L.Top,i,g,p,x,w),V({newSphereParams:g})},St=({polygon:i,size:s,imgList:p,trackConfigurable:c,zoom:r,intelligentFit:C})=>{var g,x;const v={attribute:(g=e.toolInstance.defaultAttribute)!=null?g:""};c===!0&&Object.assign(v,{trackID:I.getNextTrackID({imgList:[],extraBoxList:P,extraSphereList:m})});const O=e==null?void 0:e.toolInstance,U=y({},i);let{boxParams:S,newPointList:Z}=ot(U,s,Y,void 0,v,C);if(S=N(K({tool:J.PointCloud,dataList:[S],stepConfig:w,action:"viewUpdateBox"}))[0],(w==null?void 0:w.lowerLimitPointsNumInBox)&&typeof S.count=="number"&&S.count<w.lowerLimitPointsNumInBox){Gt.info(vt("LowerLimitPointsNumInBox",{num:w.lowerLimitPointsNumInBox})),O.deletePolygon(S.id);return}C&&(Z==null?void 0:Z.length)&&(U.pointList=Z);const zt=b.includes(U.attribute),q=d(S),jt=(x=o==null?void 0:o.polygonList)!=null?x:[];e==null||e.updatePolygonList(q!=null?q:[],jt),zt?a([]):(a(S.id),O.selection.setSelectedIDs(U.id),F({omitView:L.Top,polygon:U,boxParams:S,zoom:r,newPointCloudBoxList:q}),C&&et(S,U,e,t)),V({newBoxParams:S})},It=({newSelectedBox:i,newPointCloudList:s,newSelectedSphere:p,newSphereList:c})=>{var r;const C=e==null?void 0:e.toolInstance;if(!(u.length===0||!C)){if(i||(D==null?void 0:D.info)){const g=i!=null?i:D==null?void 0:D.info;(r=C==null?void 0:C.selection)==null||r.setSelectedIDs(u[0]);const x=C.selectedPolygon;if(u.length===1&&g){F({omitView:L.Top,polygon:x,boxParams:g,newPointCloudBoxList:s});return}}if((p||M)&&u.length===1){const g=p!=null?p:M;C.setSelectedID(u[0]);const x=C.selectedPoint;g&&G(L.Top,x,g,void 0,c,w)}}},st=(i,s,p)=>{if(it){let c,r;switch(p){case L.Back:c=eo;break;case L.Side:c=Pt;break;default:c=Pt;break}r=c(i,s,it,n.pointCloudInstance);const g=N(K({tool:J.PointCloud,dataList:[r],stepConfig:w,action:"viewUpdateBox"}))[0],x=r.valid!==g.valid;if(r=g,t){const{count:O}=t.getSensesPointZAxisInPolygon(Rt(r).polygonPointList,[r.center.z-r.depth/2,r.center.z+r.depth/2]);r=k(y({},r),{count:O})}const v=j(r);return r=v.find(O=>O.id===r.id),F({omitView:x?void 0:p,polygon:i,boxParams:r,newPointCloudBoxList:[r]}),v}},rt=(i,s,p)=>{if(M){let c,r;switch(p){case L.Back:c=oo;break;case L.Side:c=Ct;break;default:c=Ct;break}r=c(i,s,M);const C=nt(r);return G(p,i,r,void 0,C,w),C}},Dt=(i,s)=>{rt(i,s,L.Side)},Vt=(i,s)=>{rt(i,s,L.Back)},_t=(i,s)=>{st(i,s,L.Side)},Ot=(i,s)=>{st(i,s,L.Back)},Ut=(i,s)=>{R(i)},kt=(i,s)=>{const p=ht(i.id),c=tt(i,s,Y,p),r=nt(c);G(L.Top,i,c,void 0,r,w)},At=(i,s)=>{if(z){const c=i[0].newPolygon;c.pointList=c.pointList.map(r=>I.transferCanvas2World(r,s)),T(i[0].newPolygon);return}let p=i.map(({newPolygon:c})=>{const r=h(c.id),{boxParams:C}=ot(c,s,e.pointCloudInstance,r);return C});if(p=N(K({tool:J.PointCloud,dataList:p,stepConfig:w,action:"viewUpdateBox"})),p.length===1){const{newPolygon:c}=i[0],r=_(p);F({omitView:L.Top,polygon:c,boxParams:p[0],newPointCloudBoxList:r})}else{const c=_(p);c&&o.syncAllViewPointCloudColor(c)}},Tt=i=>{var s;if(D){const p=D==null?void 0:D.info.trackID,r=((s=e==null?void 0:e.toolInstance)==null?void 0:s.polygonList).find(x=>(x==null?void 0:x.trackID)===p),C=k(y({},D.info),{width:Number(i.widthDefault),depth:Number(i.depthDefault),height:Number(i.heightDefault)}),g=_([C]);F({omitView:L["3D"],polygon:r,boxParams:C,newPointCloudBoxList:g})}},G=(i,s,p,c,r,C)=>$(void 0,null,function*(){const g=H==null?void 0:H.url,x={[L.Side]:()=>{gt(p,s,n,g,C)},[L.Back]:()=>{l&&xt(p,s,l,g,C)},[L.Top]:()=>{yt(p,s,e,t)}};Object.keys(x).forEach(v=>{v!==i&&x[v]()}),c&&(t==null||t.updateCameraZoom(c)),wt(p)}),F=i=>$(void 0,null,function*(){const{omitView:s,polygon:p,boxParams:c,zoom:r,newPointCloudBoxList:C}=i,g=H==null?void 0:H.url;C&&(yield o.syncAllViewPointCloudColor(C));const x={[L.Side]:()=>{mt(c,p,n,g)},[L.Back]:()=>{l&&Lt(c,p,l,g)},[L.Top]:()=>{et(c,p,e,t)}};Object.keys(x).forEach(v=>{v!==s&&x[v]()}),r&&(t==null||t.updateCameraZoom(r)),Bt(c)});return{topViewAddSphere:bt,topViewAddBox:St,topViewSelectedChanged:It,topViewUpdatePoint:kt,sideViewUpdatePoint:Dt,backViewUpdatePoint:Vt,topViewUpdateBox:At,topViewUpdateLine:Ut,sideViewUpdateBox:_t,backViewUpdateBox:Ot,pointCloudBoxListUpdated:i=>{e.updatePolygonList(i),t==null||t.generateBoxes(i)},initPointCloud3d:i=>{if(!t)return;const s=I.getDefaultOrthographicParams(i);t.initOrthographicCamera(s),t.initRenderer(),t.render()},updatePointCloudData:(...i)=>$(void 0,[...i],function*(s=H){var p,c,r,C,g,x;if(!(s==null?void 0:s.url)||!t)return;E([]),at(N,!0),ct(N,!0),yield t.loadPCDFile(s.url,(p=w==null?void 0:w.radius)!=null?p:X),t==null||t.clearAllBox(),t==null||t.clearAllSphere();let v=[],O=[],U=[],S=[];t.updateTopCamera();const Z=(r=(c=dt(s.result))==null?void 0:c.valid)!=null?r:!0;o.setPointCloudValid(Z),(C=o.sideViewInstance)==null||C.clearAllData(),(g=o.backViewInstance)==null||g.clearAllData(),e.updateData(s.url,s.result,{radius:(x=w==null?void 0:w.radius)!=null?x:X}),s.result&&(v=I.getBoxParamsFromResultList(s.result),U=I.getPolygonListFromResultList(s.result),O=I.getLineListFromResultList(s.result),S=I.getSphereParamsFromResultList(s.result),t==null||t.generateBoxes(v),t==null||t.generateSpheres(S),yield o.syncAllViewPointCloudColor(v,[])),A({pointCloudBoxList:v,polygonList:U,lineList:O,pointCloudSphereList:S}),at(N,!1),ct(N,!1)}),updateViewsByDefaultSize:Tt}};export{xt as syncBackViewByPoint,gt as syncSideViewByPoint,yt as syncTopViewByPoint,Lt as synchronizeBackView,mt as synchronizeSideView,et as synchronizeTopView,tt as topViewPoint2PointCloud,ot as topViewPolygon2PointCloud,no as usePointCloudViews};
1
+ import{EPointCloudName as J,MathUtils as B,getCuboidFromPointCloudBox as Rt}from"@labelbee/lb-annotation";import{EPerspectiveView as W,PointCloudUtils as I,DEFAULT_SPHERE_PARAMS as Nt}from"@labelbee/lb-utils";import{useContext as Et}from"react";import{PointCloudContext as Ht}from"../PointCloudContext.js";import{useSingleBox as lt}from"./useSingleBox.js";import{useSphere as Ft}from"./useSphere.js";import{useSelector as Zt,useDispatch as Wt}from"../../../store/ctx.js";import Mt from"../../../utils/StepUtils.js";import{jsonParser as dt}from"../../../utils/index.js";import{PreDataProcess as K,SetPointCloudLoading as at,SetLoadPCDFileLoading as ct}from"../../../store/annotation/actionCreators.js";import{message as Gt}from"antd";import{useTranslation as Qt}from"react-i18next";import{useHistory as Xt}from"./useHistory.js";import{usePolygon as Yt}from"./usePolygon.js";var qt=Object.defineProperty,Jt=Object.defineProperties,Kt=Object.getOwnPropertyDescriptors,ut=Object.getOwnPropertySymbols,$t=Object.prototype.hasOwnProperty,to=Object.prototype.propertyIsEnumerable,pt=(o,e,n)=>e in o?qt(o,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[e]=n,y=(o,e)=>{for(var n in e||(e={}))$t.call(e,n)&&pt(o,n,e[n]);if(ut)for(var n of ut(e))to.call(e,n)&&pt(o,n,e[n]);return o},k=(o,e)=>Jt(o,Kt(e)),$=(o,e,n)=>new Promise((l,t)=>{var d=u=>{try{a(n.next(u))}catch(C){t(C)}},f=u=>{try{a(n.throw(u))}catch(C){t(C)}},a=u=>u.done?l(u.value):Promise.resolve(u.value).then(d,f);a((n=n.apply(o,e)).next())});const Q=5,X=90,ft=.01,L={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},tt=(o,e,n,l,t)=>{const{x:d,y:f}=I.transferCanvas2World(o,e),{defaultZ:a}=Nt,u={center:{x:d,y:f,z:a},id:o.id},C=l?y(y({},l),u):k(y({},u),{attribute:"",valid:!0});return t&&Object.assign(C,t),C},ot=(o,e,n,l,t,d)=>{let f=o.pointList.map(h=>I.transferCanvas2World(h,e)),a=0,u=1,C={};if(n){const h=n.getSensesPointZAxisInPolygon(f,void 0,d);d&&h.fittedCoordinates.length>0&&(f=h.fittedCoordinates),a=(h.maxZ+h.minZ)/2,u=h.maxZ-h.minZ,C={count:h.zCount}}const[m,b,E]=f,V=B.getLineCenterPoint([m,E]),A=B.getLineLength(m,b),T=B.getLineLength(b,E),R=B.getRadiusFromQuadrangle(o.pointList);l&&(a=l.center.z,u=l.depth);const z={center:{x:V.x,y:V.y,z:a},width:d?T+ft:T,height:d?A+ft:A,depth:u,rotation:R,id:o.id},j=y(l?y(y({},l),z):k(y({},z),{attribute:"",valid:!0}),C);t&&Object.assign(j,t);const _=f.map(h=>I.transferWorld2Canvas(h,e));return{boxParams:j,newPointList:_}},gt=(o,e,n)=>{const l={x:o.x-e.x,y:o.y-e.y};return k(y({},n),{center:{x:n.center.x-l.x,y:n.center.y,z:n.center.z-l.y}})},Ct=(o,e,n,l)=>{const[t,d,f]=o.pointList,[a,u,C]=e.pointList,m=B.getLineCenterPoint([t,f]),b=B.getLineCenterPoint([a,C]),V={x:{x:m.x-b.x,y:m.y-b.y}.x,y:0,z:m.y-b.y},A=B.getLineLength(t,d),T=B.getLineLength(a,u),R=A-T,z=B.getLineLength(d,f),j=B.getLineLength(u,C),_=z-j,{newBoxParams:h}=l.getNewBoxBySideUpdate(V,_,R,n);return h},oo=(o,e,n)=>{const l={x:o.x-e.x,y:o.y-e.y};return k(y({},n),{center:{x:n.center.x,y:n.center.y-l.x,z:n.center.z-l.y}})},eo=(o,e,n,l)=>{const[t,d,f]=o.pointList,[a,u,C]=e.pointList,m=B.getLineCenterPoint([t,f]),b=B.getLineCenterPoint([a,C]),V={x:{x:m.x-b.x,y:m.y-b.y}.x,y:0,z:m.y-b.y},A=B.getLineLength(t,d),T=B.getLineLength(a,u),R=A-T,z=B.getLineLength(d,f),j=B.getLineLength(u,C),_=z-j;let{newBoxParams:h}=l.getNewBoxByBackUpdate(V,_,R,n);return h},Pt=(o,e,n,l,t)=>{var d;if(!n)return;const{toolInstance:f,pointCloudInstance:a}=n;a.loadPCDFile(l,(d=t==null?void 0:t.radius)!=null?d:X);const{cameraPositionVector:u}=a.updateOrthoCameraBySphere(o,W.Left);a.setInitCameraPosition(u);const{point2d:C,zoom:m}=a.getSphereSidePoint2DCoordinate(o);a.camera.zoom=m,a.camera.updateProjectionMatrix(),a.render(),f.initPosition(),f.zoomChangeOnCenter(m),f.setResult([k(y(y({},e),C),{valid:o.valid,textAttribute:"",attribute:o.attribute})]),f.setSelectedID(e.id)},mt=(o,e,n,l)=>{if(!n)return;const{pointCloud2dOperation:t,pointCloudInstance:d}=n;d.loadPCDFileByBox(l,o,{width:Q,depth:Q});const{cameraPositionVector:f}=d.updateOrthoCamera(o,W.Left);d.setInitCameraPosition(f);const{polygon2d:a,zoom:u}=d.getBoxSidePolygon2DCoordinate(o);d.camera.zoom=u,d.camera.updateProjectionMatrix(),d.render(),t.initPosition(),t.zoomChangeOnCenter(u),t.setResultAndSelectedID([{id:e.id,valid:o.valid,pointList:a,textAttribute:"",isRect:!0,attribute:o.attribute}],e.id)},xt=(o,e,n,l,t)=>{var d;if(!n)return;const{toolInstance:f,pointCloudInstance:a}=n;a.loadPCDFile(l,(d=t==null?void 0:t.radius)!=null?d:X);const{cameraPositionVector:u}=a.updateOrthoCameraBySphere(o,W.Back);a.setInitCameraPosition(u);const{point2d:C,zoom:m}=a.getSphereBackPoint2DCoordinate(o);a.camera.zoom=m,a.camera.updateProjectionMatrix(),a.render(),f.initPosition(),f.zoomChangeOnCenter(m),f.setResult([k(y(y({},e),C),{valid:o.valid,textAttribute:"",attribute:o.attribute})]),f.setSelectedID(e.id)},Lt=(o,e,n,l)=>{if(!n)return;const{pointCloud2dOperation:t,pointCloudInstance:d}=n;d.loadPCDFileByBox(l,o,{height:Q,depth:Q});const{cameraPositionVector:f}=d.updateOrthoCamera(o,W.Back);d.setInitCameraPosition(f);const{polygon2d:a,zoom:u}=d.getBoxBackPolygon2DCoordinate(o);d.camera.zoom=u,d.camera.updateProjectionMatrix(),d.render(),t.initPosition(),t.zoomChangeOnCenter(u),t.setResultAndSelectedID([{id:e.id,valid:o.valid,pointList:a,textAttribute:"",isRect:!0,attribute:o.attribute}],e.id)},yt=(o,e,n,l)=>{if(!n||!l)return;l.generateSphere(o),l.updateCameraBySphere(o,W.Top),l.render();const{toolInstance:t,pointCloudInstance:d}=n,{point2d:f}=d.getSphereTopPoint2DCoordinate(o),a=[...t.pointList].map(u=>u.id===e.id?k(y(y({},e),f),{valid:o.valid,textAttribute:"",attribute:o.attribute}):u);t.setResult(a),t.setSelectedID(e.id)},et=(o,e,n,l)=>{var t,d;if(!n||!l)return;l.generateBox(o,e.id),l.render();const{pointCloud2dOperation:f,pointCloudInstance:a}=n,{polygon2d:u}=a.getBoxTopPolygon2DCoordinate(o),C=[...f.polygonList],m=C.find(b=>b.id===e.id);m?(m.pointList=u,m.valid=(t=o.valid)!=null?t:!0):C.push({id:e.id,pointList:u,textAttribute:"",isRect:!0,valid:(d=o.valid)!=null?d:!0}),f.setResultAndSelectedID(C,e.id)},no=()=>{const o=Et(Ht),{topViewInstance:e,sideViewInstance:n,backViewInstance:l,mainViewInstance:t,addPointCloudBox:d,addPointCloudSphere:f,setSelectedIDs:a,selectedIDs:u,pointCloudBoxList:C,pointCloudSphereList:m,hideAttributes:b,setHighlight2DDataList:E}=o,{addHistory:V,initHistory:A,pushHistoryUnderUpdatePolygon:T,pushHistoryUnderUpdateLine:R}=Xt(),{selectedPolygon:z}=Yt(),{updateSelectedBox:j,updateSelectedBoxes:_,getPointCloudByID:h}=lt(),{getPointCloudSphereByID:ht,updatePointCloudSphere:nt,selectedSphere:M}=Ft(),{currentData:H,config:w}=Zt(i=>{const{stepList:s,step:p,imgList:c,imgIndex:r}=i.annotation;return{currentData:c[r],config:dt(Mt.getCurrentStepInfo(p,s).config)}}),N=Wt(),{selectedBox:D}=lt(),{t:vt}=Qt(),it=D==null?void 0:D.info;if(!e||!n||!l)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:Y}=e,Bt=i=>{t==null||t.generateBox(i),t==null||t.controls.update(),t==null||t.render()},wt=i=>{t==null||t.generateSphere(i),t==null||t.controls.update(),t==null||t.render()},bt=({newPoint:i,size:s,zoom:p,trackConfigurable:c})=>{var r;const g={attribute:(r=e.toolInstance.defaultAttribute)!=null?r:""};c===!0&&Object.assign(g,{trackID:I.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:m})});const P=tt(i,s,Y,void 0,g);a(i.id);const x=f(P);G(L.Top,i,P,p,x,w),V({newSphereParams:P})},St=({polygon:i,size:s,imgList:p,trackConfigurable:c,zoom:r,intelligentFit:g})=>{var P,x;const v={attribute:(P=e.toolInstance.defaultAttribute)!=null?P:""};c===!0&&Object.assign(v,{trackID:I.getNextTrackID({imgList:[],extraBoxList:C,extraSphereList:m})});const O=e==null?void 0:e.toolInstance,U=y({},i);let{boxParams:S,newPointList:Z}=ot(U,s,Y,void 0,v,g);if(S=N(K({tool:J.PointCloud,dataList:[S],stepConfig:w,action:"viewUpdateBox"}))[0],(w==null?void 0:w.lowerLimitPointsNumInBox)&&typeof S.count=="number"&&S.count<w.lowerLimitPointsNumInBox){Gt.info(vt("LowerLimitPointsNumInBox",{num:w.lowerLimitPointsNumInBox})),O.deletePolygon(S.id);return}g&&(Z==null?void 0:Z.length)&&(U.pointList=Z);const zt=b.includes(U.attribute),q=d(S),jt=(x=o==null?void 0:o.polygonList)!=null?x:[];e==null||e.updatePolygonList(q!=null?q:[],jt),zt?a([]):(a(S.id),O.selection.setSelectedIDs(U.id),F({omitView:L.Top,polygon:U,boxParams:S,zoom:r,newPointCloudBoxList:q}),g&&et(S,U,e,t)),V({newBoxParams:S})},It=({newSelectedBox:i,newPointCloudList:s,newSelectedSphere:p,newSphereList:c})=>{var r;const g=e==null?void 0:e.toolInstance;if(!(u.length===0||!g)){if(i||(D==null?void 0:D.info)){const P=i!=null?i:D==null?void 0:D.info;(r=g==null?void 0:g.selection)==null||r.setSelectedIDs(u[0]);const x=g.selectedPolygon;if(u.length===1&&P){F({omitView:L.Top,polygon:x,boxParams:P,newPointCloudBoxList:s});return}}if((p||M)&&u.length===1){const P=p!=null?p:M;g.setSelectedID(u[0]);const x=g.selectedPoint;P&&G(L.Top,x,P,void 0,c,w)}}},st=(i,s,p)=>{if(it){let c,r;switch(p){case L.Back:c=eo;break;case L.Side:c=Ct;break;default:c=Ct;break}r=c(i,s,it,n.pointCloudInstance);const P=N(K({tool:J.PointCloud,dataList:[r],stepConfig:w,action:"viewUpdateBox"}))[0],x=r.valid!==P.valid;if(r=P,t){const{count:O}=t.getSensesPointZAxisInPolygon(Rt(r).polygonPointList,[r.center.z-r.depth/2,r.center.z+r.depth/2]);r=k(y({},r),{count:O})}const v=j(r);return r=v.find(O=>O.id===r.id),F({omitView:x?void 0:p,polygon:i,boxParams:r,newPointCloudBoxList:v}),v}},rt=(i,s,p)=>{if(M){let c,r;switch(p){case L.Back:c=oo;break;case L.Side:c=gt;break;default:c=gt;break}r=c(i,s,M);const g=nt(r);return G(p,i,r,void 0,g,w),g}},Dt=(i,s)=>{rt(i,s,L.Side)},Vt=(i,s)=>{rt(i,s,L.Back)},_t=(i,s)=>{st(i,s,L.Side)},Ot=(i,s)=>{st(i,s,L.Back)},Ut=(i,s)=>{R(i)},kt=(i,s)=>{const p=ht(i.id),c=tt(i,s,Y,p),r=nt(c);G(L.Top,i,c,void 0,r,w)},At=(i,s)=>{if(z){const c=i[0].newPolygon;c.pointList=c.pointList.map(r=>I.transferCanvas2World(r,s)),T(i[0].newPolygon);return}let p=i.map(({newPolygon:c})=>{const r=h(c.id),{boxParams:g}=ot(c,s,e.pointCloudInstance,r);return g});if(p=N(K({tool:J.PointCloud,dataList:p,stepConfig:w,action:"viewUpdateBox"})),p.length===1){const{newPolygon:c}=i[0],r=_(p);F({omitView:L.Top,polygon:c,boxParams:p[0],newPointCloudBoxList:r})}else{const c=_(p);c&&o.syncAllViewPointCloudColor(c)}},Tt=i=>{var s;if(D){const p=D==null?void 0:D.info.trackID,r=((s=e==null?void 0:e.toolInstance)==null?void 0:s.polygonList).find(x=>(x==null?void 0:x.trackID)===p),g=k(y({},D.info),{width:Number(i.widthDefault),depth:Number(i.depthDefault),height:Number(i.heightDefault)}),P=_([g]);F({omitView:L["3D"],polygon:r,boxParams:g,newPointCloudBoxList:P})}},G=(i,s,p,c,r,g)=>$(void 0,null,function*(){const P=H==null?void 0:H.url,x={[L.Side]:()=>{Pt(p,s,n,P,g)},[L.Back]:()=>{l&&xt(p,s,l,P,g)},[L.Top]:()=>{yt(p,s,e,t)}};Object.keys(x).forEach(v=>{v!==i&&x[v]()}),c&&(t==null||t.updateCameraZoom(c)),wt(p)}),F=i=>$(void 0,null,function*(){const{omitView:s,polygon:p,boxParams:c,zoom:r,newPointCloudBoxList:g}=i,P=H==null?void 0:H.url;g&&(yield o.syncAllViewPointCloudColor(g));const x={[L.Side]:()=>{mt(c,p,n,P)},[L.Back]:()=>{l&&Lt(c,p,l,P)},[L.Top]:()=>{et(c,p,e,t)}};Object.keys(x).forEach(v=>{v!==s&&x[v]()}),r&&(t==null||t.updateCameraZoom(r)),Bt(c)});return{topViewAddSphere:bt,topViewAddBox:St,topViewSelectedChanged:It,topViewUpdatePoint:kt,sideViewUpdatePoint:Dt,backViewUpdatePoint:Vt,topViewUpdateBox:At,topViewUpdateLine:Ut,sideViewUpdateBox:_t,backViewUpdateBox:Ot,pointCloudBoxListUpdated:i=>{e.updatePolygonList(i),t==null||t.generateBoxes(i)},initPointCloud3d:i=>{if(!t)return;const s=I.getDefaultOrthographicParams(i);t.initOrthographicCamera(s),t.initRenderer(),t.render()},updatePointCloudData:(...i)=>$(void 0,[...i],function*(s=H){var p,c,r,g,P,x;if(!(s==null?void 0:s.url)||!t)return;E([]),at(N,!0),ct(N,!0),yield t.loadPCDFile(s.url,(p=w==null?void 0:w.radius)!=null?p:X),t==null||t.clearAllBox(),t==null||t.clearAllSphere();let v=[],O=[],U=[],S=[];t.updateTopCamera();const Z=(r=(c=dt(s.result))==null?void 0:c.valid)!=null?r:!0;o.setPointCloudValid(Z),(g=o.sideViewInstance)==null||g.clearAllData(),(P=o.backViewInstance)==null||P.clearAllData(),e.updateData(s.url,s.result,{radius:(x=w==null?void 0:w.radius)!=null?x:X}),s.result&&(v=I.getBoxParamsFromResultList(s.result),U=I.getPolygonListFromResultList(s.result),O=I.getLineListFromResultList(s.result),S=I.getSphereParamsFromResultList(s.result),t==null||t.generateBoxes(v),t==null||t.generateSpheres(S),yield o.syncAllViewPointCloudColor(v,[])),A({pointCloudBoxList:v,polygonList:U,lineList:O,pointCloudSphereList:S}),at(N,!1),ct(N,!1)}),updateViewsByDefaultSize:Tt}};export{xt as syncBackViewByPoint,Pt as syncSideViewByPoint,yt as syncTopViewByPoint,Lt as synchronizeBackView,mt as synchronizeSideView,et as synchronizeTopView,tt as topViewPoint2PointCloud,ot as topViewPolygon2PointCloud,no as usePointCloudViews};
@@ -1 +1 @@
1
- import{getClassName as n}from"../../utils/dom.js";import t,{useContext as N,useState as T,useEffect as p}from"react";import h from"./PointCloud3DView.js";import I from"./PointCloudBackView.js";import B from"./PointCloudTopView.js";import D from"./PointCloudSideView.js";import F from"./PointCloud2DView.js";import R from"./PointCloudListener.js";import _ from"./PointCloudSegmentListener.js";import y from"./PointCloudSegment.js";import G from"./PointCloudSegmentStatus.js";import O from"./PointCloudSegmentToolbar.js";import{connect as Z}from"react-redux";import{LabelBeeContext as U}from"../../store/ctx.js";import{AnnotatedAttributesPanelFixedLeft as W,AnnotatedAttributesPanelFixedRight as $}from"../../views/MainView/toolFooter/AnnotatedAttributes/index.js";import{PointCloudContext as k}from"./PointCloudContext.js";import{PointCloudUtils as q,EPointCloudPattern as z}from"@labelbee/lb-utils";import{useCustomToolInstance as H}from"../../hooks/annotation.js";import{jsonParser as J}from"../../utils/index.js";import{a2MapStateToProps as K}from"../../store/annotation/map.js";import g from"classnames";import Q from"./components/sideAndBackOverView/index.js";const X=({currentData:s,imgList:E,drawLayerSlot:d,checkMode:l,intelligentFit:L,imgIndex:x,loadPCDFileLoading:b})=>{const e=N(k),{globalPattern:c,setGlobalPattern:v,selectedIDs:C}=e,[i,P]=T(!1),S=(C==null?void 0:C.length)>0&&i,j=J(s.result),{toolInstanceRef:r,clearToolInstance:w}=H({basicInfo:j});if(p(()=>{r.current.setPointCloudGlobalPattern=o=>{o!==c&&(v(o),e.clearAllDetectionInstance(),w())}},[c]),p(()=>{var o;if(s){const{boxParamsList:a,polygonList:m,lineList:u,sphereParamsList:V,segmentation:A}=q.parsePointCloudCurrentResult((o=s==null?void 0:s.result)!=null?o:"");e.setPointCloudResult(a),e.setPolygonList(m),e.setLineList(u),e.setPointCloudSphereList(V),e.setSegmentation(A)}},[x]),p(()=>{r.current.exportData=()=>[e.pointCloudBoxList,{valid:e.valid}],r.current.exportCustomData=()=>{var o,a,m,u;return{resultPolygon:(o=e.polygonList)!=null?o:[],resultLine:(a=e.lineList)!=null?a:[],resultPoint:(m=e.pointCloudSphereList)!=null?m:[],segmentation:(u=e.segmentation)!=null?u:[]}}},[e.pointCloudBoxList,e.valid,e.polygonList,e.lineList,e.pointCloudSphereList,e.ptSegmentInstance,e.segmentation]),E.length===0)return null;if(c===z.Segmentation)return t.createElement(t.Fragment,null,t.createElement(_,{checkMode:l,toolInstanceRef:r}),t.createElement(O,null),t.createElement(y,{checkMode:l}),t.createElement(G,null),d==null?void 0:d({direct:!0}));let f=t.createElement("div",{className:n("point-cloud-container","left-bottom")},t.createElement(I,{checkMode:l}),t.createElement(D,{checkMode:l}));return i&&(f=t.createElement(Q,{selectAndEnlarge:S,checkMode:l})),t.createElement(t.Fragment,null,t.createElement(R,{checkMode:l,toolInstanceRef:r}),t.createElement("div",{className:n("point-cloud-layout"),onContextMenu:o=>o.preventDefault()},t.createElement("div",{className:n("point-cloud-wrapper")},t.createElement(W,null),t.createElement("div",{className:n("point-cloud-content")},t.createElement("div",{className:n("point-cloud-container","left")},t.createElement(h,null),f),t.createElement("div",{className:g({[n("point-cloud-container","right")]:!0,[n("point-cloud-container","rightZoom")]:i})},t.createElement(B,{drawLayerSlot:d,checkMode:l,intelligentFit:L,setIsEnlargeTopView:P,onExitZoom:()=>{P(!1)},isEnlargeTopView:i}),t.createElement("div",{className:g({[n("point-cloud-container","right-bottom")]:!i,[n("point-cloud-container","right-bottom-floatLeft")]:i})},!b&&t.createElement(F,{isEnlargeTopView:i,thumbnailWidth:i?300:455})))),t.createElement($,null))))};var Y=Z(K,null,null,{context:U})(X);export{Y as default};
1
+ import{getClassName as n}from"../../utils/dom.js";import t,{useContext as h,useState as D,useEffect as p}from"react";import N from"./PointCloud3DView.js";import T from"./PointCloudBackView.js";import I from"./PointCloudTopView.js";import B from"./PointCloudSideView.js";import F from"./PointCloud2DView.js";import R from"./PointCloudListener.js";import _ from"./PointCloudSegmentListener.js";import y from"./PointCloudSegment.js";import G from"./PointCloudSegmentStatus.js";import O from"./PointCloudSegmentToolbar.js";import{connect as Z}from"react-redux";import{LabelBeeContext as U,useDispatch as W}from"../../store/ctx.js";import{AnnotatedAttributesPanelFixedLeft as $,AnnotatedAttributesPanelFixedRight as k}from"../../views/MainView/toolFooter/AnnotatedAttributes/index.js";import{PointCloudContext as q}from"./PointCloudContext.js";import{PointCloudUtils as z,EPointCloudPattern as H}from"@labelbee/lb-utils";import{useCustomToolInstance as J}from"../../hooks/annotation.js";import{jsonParser as K}from"../../utils/index.js";import{a2MapStateToProps as Q}from"../../store/annotation/map.js";import g from"classnames";import X from"./components/sideAndBackOverView/index.js";import{SetLoadPCDFileLoading as Y}from"../../store/annotation/actionCreators.js";const M=({currentData:s,imgList:E,drawLayerSlot:d,checkMode:l,intelligentFit:L,imgIndex:x,loadPCDFileLoading:et})=>{const e=h(q),{globalPattern:c,setGlobalPattern:S,selectedIDs:C}=e,b=W(),[i,P]=D(!1),j=(C==null?void 0:C.length)>0&&i,v=K(s.result),{toolInstanceRef:r,clearToolInstance:w}=J({basicInfo:v});if(p(()=>{r.current.setPointCloudGlobalPattern=o=>{o!==c&&(S(o),e.clearAllDetectionInstance(),w())}},[c]),p(()=>{var o;if(Y(b,!0),s){const{boxParamsList:a,polygonList:m,lineList:u,sphereParamsList:V,segmentation:A}=z.parsePointCloudCurrentResult((o=s==null?void 0:s.result)!=null?o:"");e.setPointCloudResult(a),e.setPolygonList(m),e.setLineList(u),e.setPointCloudSphereList(V),e.setSegmentation(A)}},[x]),p(()=>{r.current.exportData=()=>[e.pointCloudBoxList,{valid:e.valid}],r.current.exportCustomData=()=>{var o,a,m,u;return{resultPolygon:(o=e.polygonList)!=null?o:[],resultLine:(a=e.lineList)!=null?a:[],resultPoint:(m=e.pointCloudSphereList)!=null?m:[],segmentation:(u=e.segmentation)!=null?u:[]}}},[e.pointCloudBoxList,e.valid,e.polygonList,e.lineList,e.pointCloudSphereList,e.ptSegmentInstance,e.segmentation]),E.length===0)return null;if(c===H.Segmentation)return t.createElement(t.Fragment,null,t.createElement(_,{checkMode:l,toolInstanceRef:r}),t.createElement(O,null),t.createElement(y,{checkMode:l}),t.createElement(G,null),d==null?void 0:d({direct:!0}));let f=t.createElement("div",{className:n("point-cloud-container","left-bottom")},t.createElement(T,{checkMode:l}),t.createElement(B,{checkMode:l}));return i&&(f=t.createElement(X,{selectAndEnlarge:j,checkMode:l})),t.createElement(t.Fragment,null,t.createElement(R,{checkMode:l,toolInstanceRef:r}),t.createElement("div",{className:n("point-cloud-layout"),onContextMenu:o=>o.preventDefault()},t.createElement("div",{className:n("point-cloud-wrapper")},t.createElement($,null),t.createElement("div",{className:n("point-cloud-content")},t.createElement("div",{className:n("point-cloud-container","left")},t.createElement(N,null),f),t.createElement("div",{className:g({[n("point-cloud-container","right")]:!0,[n("point-cloud-container","rightZoom")]:i})},t.createElement(I,{drawLayerSlot:d,checkMode:l,intelligentFit:L,setIsEnlargeTopView:P,onExitZoom:()=>{P(!1)},isEnlargeTopView:i}),t.createElement("div",{className:g({[n("point-cloud-container","right-bottom")]:!i,[n("point-cloud-container","right-bottom-floatLeft")]:i})},t.createElement(F,{isEnlargeTopView:i,thumbnailWidth:i?300:455})))),t.createElement(k,null))))};var tt=Z(Q,null,null,{context:U})(M);export{tt as default};
package/es/index.css CHANGED
@@ -236,7 +236,7 @@
236
236
  border-color: #666fff;
237
237
  }
238
238
  .bee-sidebar__level {
239
- padding: 28px;
239
+ padding: 20px 8px;
240
240
  border-bottom: 1px solid #eee;
241
241
  display: flex;
242
242
  justify-content: center;
@@ -1366,6 +1366,9 @@
1366
1366
  border-bottom: 1px solid;
1367
1367
  font-size: 14px;
1368
1368
  }
1369
+ .bee-point-cloud-wrapper .bee-point-cloud-container__zoom .bee-point-cloud-highlight-view {
1370
+ display: none;
1371
+ }
1369
1372
  .bee-point-cloud-wrapper .bee-point-cloud-container__left {
1370
1373
  width: 455px;
1371
1374
  display: flex;
@@ -1543,7 +1546,7 @@
1543
1546
  height: 100%;
1544
1547
  }
1545
1548
  .bee-point-cloud-wrapper .bee-point-cloud-container__rightZoom {
1546
- position: fixed;
1549
+ position: absolute;
1547
1550
  top: 0px;
1548
1551
  left: 0px;
1549
1552
  width: 100%;
@@ -1 +1 @@
1
- import{prefix as O}from"../../../constant/index.js";import{EToolName as n}from"../../../data/enums/ToolType.js";import B from"../../../utils/StepUtils.js";import{Collapse as d}from"antd/es";import e,{useState as F}from"react";import{useTranslation as K}from"react-i18next";import R from"./AnnotationText/index.js";import z from"./ClearIcon/index.js";import D,{PointCloudOperation as y}from"./GeneralOperation/index.js";import G from"./ImgAttributeInfo/index.js";import U from"./SwitchAttributeList/index.js";import u,{expandIconFuc as N}from"./TagSidebar/index.js";import j from"./TextToolSidebar/index.js";import v from"./PointCloudToolSidebar/index.js";import V from"./ToolStyle/index.js";import{cTool as q}from"@labelbee/lb-annotation";import H from"./ScribbleSidebar/index.js";import{ToolIcons as J}from"./ToolIcons.js";import{useSelector as M}from"../../../store/ctx.js";import{Tabs as p}from"antd";import{classnames as Q}from"../../../utils/index.js";import C from"../../../assets/annotation/common/icon_menu_fold.svg.js";const{EVideoToolName:W,EPointCloudName:X}=q,{Panel:_}=d,t=`${O}-sidebar`,Y=({sider:l,enableColorPicker:I,setSiderWidth:f,propsSiderWidth:Z})=>{const E=M(r=>B.getCurrentStepInfo(r.annotation.step,r.annotation.stepList)),[c,$]=F(!0),o=E==null?void 0:E.tool,{t:b}=K();if(!o)return null;const A=r=>{const i=e.createElement(V,null);return e.createElement(_,{header:b("Style"),className:"panel",key:r},i)},x=e.createElement(J,{toolName:o,onChange:()=>{}}),s=e.createElement(U,null),S=e.createElement(R,null),T=e.createElement(d,{defaultActiveKey:["1","imgAttribute"],bordered:!1,expandIconPosition:"right",className:`${t}__content`,expandIcon:N},A("1")),g=e.createElement(d,{defaultActiveKey:["1","imgAttribute"],bordered:!1,expandIconPosition:"right",className:`${t}__content`,expandIcon:N},e.createElement(_,{header:e.createElement("div",null,b("Adjust"),e.createElement(z,null)),className:"panel",key:"imgAttribute"},e.createElement(G,null))),a=e.createElement(D,null),P=e.createElement(u,null),w=e.createElement(j,null),h=e.createElement(H,{onChange:(r,i)=>{}}),m=e.createElement("div",{className:`${t}__horizontal`}),k=e.createElement(v,{enableColorPicker:I}),L=e.createElement(y,null);if(l)return typeof l=="function"?e.createElement("div",{className:`${t}`},l({toolIcon:x,attributeList:s,annotationText:S,toolStyle:T,imageAttributeInfo:g,operation:a,tagToolSideBar:P,textToolSideBar:w,horizontal:m,pointCloudToolSidebar:k,pointCloudOperation:L,scribbleSidebar:h})):l;if([n.Rect,n.Point,n.Line,n.Rect,n.Polygon,n.Cuboid].includes(o))return e.createElement("div",{className:`${t}`},x,m,s,S,m,e.createElement("div",{className:`${t}__content`},T,g),a);if(o===n.Tag)return e.createElement("div",{className:`${t}`},e.createElement(u,null));if(o===W.VideoTagTool)return e.createElement("div",{className:`${t}`},e.createElement("div",{className:`${t}__content`},e.createElement(u,null)),a);if(o===n.Text)return e.createElement("div",{className:`${t}`},e.createElement(j,null));if(o===X.PointCloud){const r=()=>{$(!c),f&&f(c?48:void 0)},i=e.createElement("div",{style:{width:"48px",height:"100%",display:"flex",justifyContent:"center",background:"#ffffff"}},e.createElement("span",{onClick:()=>r()},e.createElement("img",{style:{width:"16px",height:"16px",marginTop:"18px",cursor:"pointer",transform:"rotate(180deg)"},src:C})));return c?e.createElement(p,{type:"card",activeKey:"1",className:Q({[`${t}`]:!0,[`${t}__pointCloud`]:!0})},e.createElement(p.TabPane,{tab:e.createElement("span",{onClick:()=>r()},e.createElement("img",{style:{width:"16px",height:"16px",marginLeft:"4px",cursor:"pointer"},src:C})),key:""}),e.createElement(p.TabPane,{tab:"\u5DE5\u5177\u9762\u677F",key:"1",style:{height:"100%",display:"flex",flexDirection:"column"}},e.createElement("div",{className:`${t}__content`},e.createElement(v,null)),e.createElement(y,null))):i}return o===n.ScribbleTool?e.createElement("div",{className:`${t}`},e.createElement("div",{className:`${t}__content`},h,s),a):null};export{Y as default,t as sidebarCls};
1
+ import{prefix as B}from"../../../constant/index.js";import{EToolName as n}from"../../../data/enums/ToolType.js";import O from"../../../utils/StepUtils.js";import{Collapse as d}from"antd/es";import e,{useState as F}from"react";import{useTranslation as K}from"react-i18next";import R from"./AnnotationText/index.js";import z from"./ClearIcon/index.js";import D,{PointCloudOperation as h}from"./GeneralOperation/index.js";import G from"./ImgAttributeInfo/index.js";import U from"./SwitchAttributeList/index.js";import u,{expandIconFuc as y}from"./TagSidebar/index.js";import C from"./TextToolSidebar/index.js";import N from"./PointCloudToolSidebar/index.js";import V from"./ToolStyle/index.js";import{cTool as q}from"@labelbee/lb-annotation";import H from"./ScribbleSidebar/index.js";import{ToolIcons as J}from"./ToolIcons.js";import{useSelector as M}from"../../../store/ctx.js";import{Tabs as j}from"antd";import{classnames as Q}from"../../../utils/index.js";import v from"../../../assets/annotation/common/icon_menu_fold.svg.js";const{EVideoToolName:W,EPointCloudName:X}=q,{Panel:_}=d,t=`${B}-sidebar`,Y=({sider:l,enableColorPicker:I,setSiderWidth:p,propsSiderWidth:Z})=>{const f=M(r=>O.getCurrentStepInfo(r.annotation.step,r.annotation.stepList)),[c,$]=F(!0),o=f==null?void 0:f.tool,{t:E}=K();if(!o)return null;const A=r=>{const i=e.createElement(V,null);return e.createElement(_,{header:E("Style"),className:"panel",key:r},i)},x=e.createElement(J,{toolName:o,onChange:()=>{}}),s=e.createElement(U,null),b=e.createElement(R,null),S=e.createElement(d,{defaultActiveKey:["1","imgAttribute"],bordered:!1,expandIconPosition:"right",className:`${t}__content`,expandIcon:y},A("1")),T=e.createElement(d,{defaultActiveKey:["1","imgAttribute"],bordered:!1,expandIconPosition:"right",className:`${t}__content`,expandIcon:y},e.createElement(_,{header:e.createElement("div",null,E("Adjust"),e.createElement(z,null)),className:"panel",key:"imgAttribute"},e.createElement(G,null))),a=e.createElement(D,null),P=e.createElement(u,null),w=e.createElement(C,null),g=e.createElement(H,{onChange:(r,i)=>{}}),m=e.createElement("div",{className:`${t}__horizontal`}),L=e.createElement(N,{enableColorPicker:I}),k=e.createElement(h,null);if(l)return typeof l=="function"?e.createElement("div",{className:`${t}`},l({toolIcon:x,attributeList:s,annotationText:b,toolStyle:S,imageAttributeInfo:T,operation:a,tagToolSideBar:P,textToolSideBar:w,horizontal:m,pointCloudToolSidebar:L,pointCloudOperation:k,scribbleSidebar:g})):l;if([n.Rect,n.Point,n.Line,n.Rect,n.Polygon,n.Cuboid].includes(o))return e.createElement("div",{className:`${t}`},x,m,s,b,m,e.createElement("div",{className:`${t}__content`},S,T),a);if(o===n.Tag)return e.createElement("div",{className:`${t}`},e.createElement(u,null));if(o===W.VideoTagTool)return e.createElement("div",{className:`${t}`},e.createElement("div",{className:`${t}__content`},e.createElement(u,null)),a);if(o===n.Text)return e.createElement("div",{className:`${t}`},e.createElement(C,null));if(o===X.PointCloud){const r=()=>{$(!c),p&&p(c?48:void 0)},i=e.createElement("div",{style:{width:"48px",height:"100%",display:"flex",justifyContent:"center",background:"#ffffff"}},e.createElement("span",{onClick:()=>r()},e.createElement("img",{style:{width:"16px",height:"16px",marginTop:"18px",cursor:"pointer",transform:"rotate(180deg)"},src:v})));return c?e.createElement(j,{type:"card",activeKey:"1",className:Q({[`${t}`]:!0,[`${t}__pointCloud`]:!0}),tabBarExtraContent:{left:e.createElement("span",{onClick:()=>r(),style:{padding:"0px 4px"}},e.createElement("img",{style:{width:"16px",height:"16px",marginLeft:"4px",cursor:"pointer"},src:v}))}},e.createElement(j.TabPane,{tab:"\u5DE5\u5177\u9762\u677F",key:"1",style:{height:"100%",display:"flex",flexDirection:"column"}},e.createElement("div",{className:`${t}__content`},e.createElement(N,null)),e.createElement(h,null))):i}return o===n.ScribbleTool?e.createElement("div",{className:`${t}`},e.createElement("div",{className:`${t}__content`},g,s),a):null};export{Y as default,t as sidebarCls};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@labelbee/lb-components",
3
- "version": "1.14.0-alpha.5",
3
+ "version": "1.14.0-alpha.7",
4
4
  "description": "Provide a complete library of annotation components",
5
5
  "main": "./dist/index.js",
6
6
  "es": "./es/index.js",
@@ -43,8 +43,8 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@ant-design/icons": "^4.6.2",
46
- "@labelbee/lb-annotation": "1.18.0-alpha.4",
47
- "@labelbee/lb-utils": "1.10.0-alpha.3",
46
+ "@labelbee/lb-annotation": "1.18.0-alpha.5",
47
+ "@labelbee/lb-utils": "1.10.0-alpha.4",
48
48
  "ahooks": "^3.4.0",
49
49
  "classnames": "^2.3.0",
50
50
  "lodash": "^4.17.21",