@labelbee/lb-components 1.23.0-alpha.104 → 1.23.0-alpha.105
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";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),_=require("lodash"),antd=require("antd"),usePointCloudViews=require("./usePointCloudViews.js"),PointCloudContext=require("../PointCloudContext.js"),reactI18next=require("react-i18next"),ToolPointCloudBoxRenderHelper=require("../../../utils/ToolPointCloudBoxRenderHelper.js"),AnnotationDataUtils=require("../../../utils/AnnotationDataUtils.js"),lbAnnotation=require("@labelbee/lb-annotation"),useHistory=require("./useHistory.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var ___default=_interopDefaultLegacy(_),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,e,o)=>e in t?__defProp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,__spreadValues=(t,e)=>{for(var o in e||(e={}))__hasOwnProp.call(e,o)&&__defNormalProp(t,o,e[o]);if(__getOwnPropSymbols)for(var o of __getOwnPropSymbols(e))__propIsEnum.call(e,o)&&__defNormalProp(t,o,e[o]);return t},__spreadProps=(t,e)=>__defProps(t,__getOwnPropDescs(e));const updateBoxRects=(t,e=[],o=[])=>{const{rects:a=[]}=t,s=a.map(r=>{var u;return __spreadProps(__spreadValues({},r),{imageName:(u=AnnotationDataUtils.getNextPath({prePath:r.imageName,preMappingImgList:o,nextMappingImgList:e}))!=null?u:""})}).filter(r=>r.imageName!=="");return __spreadProps(__spreadValues({},t),{rects:s})},updateCopiedBoxesId=(t,e)=>{const o=Math.max(...t.map(s=>s.trackID||0),0),a
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),_=require("lodash"),antd=require("antd"),usePointCloudViews=require("./usePointCloudViews.js"),PointCloudContext=require("../PointCloudContext.js"),reactI18next=require("react-i18next"),ToolPointCloudBoxRenderHelper=require("../../../utils/ToolPointCloudBoxRenderHelper.js"),AnnotationDataUtils=require("../../../utils/AnnotationDataUtils.js"),lbAnnotation=require("@labelbee/lb-annotation"),useHistory=require("./useHistory.js"),index=require("../../../utils/index.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var ___default=_interopDefaultLegacy(_),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,e,o)=>e in t?__defProp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,__spreadValues=(t,e)=>{for(var o in e||(e={}))__hasOwnProp.call(e,o)&&__defNormalProp(t,o,e[o]);if(__getOwnPropSymbols)for(var o of __getOwnPropSymbols(e))__propIsEnum.call(e,o)&&__defNormalProp(t,o,e[o]);return t},__spreadProps=(t,e)=>__defProps(t,__getOwnPropDescs(e));const updateBoxRects=(t,e=[],o=[])=>{const{rects:a=[]}=t,s=a.map(r=>{var u;return __spreadProps(__spreadValues({},r),{imageName:(u=AnnotationDataUtils.getNextPath({prePath:r.imageName,preMappingImgList:o,nextMappingImgList:e}))!=null?u:""})}).filter(r=>r.imageName!=="");return __spreadProps(__spreadValues({},t),{rects:s})},updateCopiedBoxesId=(t,e)=>{const o=Math.max(...t.map(s=>s.trackID||0),0),a=.2;return e.map((s,r)=>__spreadProps(__spreadValues({},s),{id:lbAnnotation.uuid(),uuid:lbAnnotation.uuid(),center:{x:s.center.x-a*5,y:s.center.y+a,z:s.center.z},trackID:o+r+1}))},useBoxes=({config:t,currentData:e})=>{const{selectedIDs:o,pointCloudBoxList:a,displayPointCloudList:s,setPointCloudResult:r,syncAllViewPointCloudColor:u,imageSizes:f}=React.useContext(PointCloudContext.PointCloudContext),[c,d]=React.useState({copiedBoxes:[],copiedMappingImgList:[]}),{copiedBoxes:l}=c,{pointCloudBoxListUpdated:x}=usePointCloudViews.usePointCloudViews(),{t:g,i18n:P}=reactI18next.useTranslation(),{pushHistoryWithList:y}=useHistory.useHistory(),m=React.useMemo(()=>s.filter(n=>o.includes(n.id)),[o,s]),I=React.useCallback(()=>{var n;if(m.length>0){const p=(n=e==null?void 0:e.mappingImgList)!=null?n:[];d({copiedBoxes:___default.default.cloneDeep(m),copiedMappingImgList:p})}else d({copiedBoxes:[],copiedMappingImgList:[]}),antd.message.error(g("CopyEmptyInPointCloud"));antd.message.success(g("CopySuccess"))},[o,s,P.language,e]),B=React.useCallback(()=>{var n,p;if(l.length===0){antd.message.error(g("PasteEmptyInPointCloud"));return}const v=(n=e==null?void 0:e.mappingImgList)!=null?n:[],L=(p=c==null?void 0:c.copiedMappingImgList)!=null?p:[],O=l.map(i=>updateBoxRects(i,v,L)),b=updateCopiedBoxesId(s,O),j=i=>{r(i),x==null||x(i),d({copiedBoxes:[],copiedMappingImgList:[]}),y({pointCloudBoxList:i}),u(ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.MultiPaste,i)},C=[...s,...b];C.forEach(i=>index.generatePointCloudBoxRects({pointCloudBox:i,mappingImgList:v,imageSizes:f})),j(C)},[l,s,P.language,e]);return{copySelectedBoxes:I,pasteSelectedBoxes:B,copiedBoxes:l,selectedBoxes:m}};exports.useBoxes=useBoxes;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useContext as
|
|
1
|
+
import{useContext as N,useState as V,useMemo as D,useCallback as v}from"react";import H from"lodash";import{message as f}from"antd";import{usePointCloudViews as T}from"./usePointCloudViews.js";import{PointCloudContext as z}from"../PointCloudContext.js";import{useTranslation as A}from"react-i18next";import{EPointCloudBoxRenderTrigger as U}from"../../../utils/ToolPointCloudBoxRenderHelper.js";import k from"../../../utils/AnnotationDataUtils.js";import{uuid as B}from"@labelbee/lb-annotation";import{useHistory as W}from"./useHistory.js";import{generatePointCloudBoxRects as q}from"../../../utils/index.js";var F=Object.defineProperty,G=Object.defineProperties,J=Object.getOwnPropertyDescriptors,L=Object.getOwnPropertySymbols,K=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable,O=(t,e,o)=>e in t?F(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,P=(t,e)=>{for(var o in e||(e={}))K.call(e,o)&&O(t,o,e[o]);if(L)for(var o of L(e))Q.call(e,o)&&O(t,o,e[o]);return t},x=(t,e)=>G(t,J(e));const X=(t,e=[],o=[])=>{const{rects:p=[]}=t,s=p.map(i=>{var a;return x(P({},i),{imageName:(a=k.getNextPath({prePath:i.imageName,preMappingImgList:o,nextMappingImgList:e}))!=null?a:""})}).filter(i=>i.imageName!=="");return x(P({},t),{rects:s})},Y=(t,e)=>{const o=Math.max(...t.map(s=>s.trackID||0),0),p=.2;return e.map((s,i)=>x(P({},s),{id:B(),uuid:B(),center:{x:s.center.x-p*5,y:s.center.y+p,z:s.center.z},trackID:o+i+1}))},Z=({config:t,currentData:e})=>{const{selectedIDs:o,pointCloudBoxList:p,displayPointCloudList:s,setPointCloudResult:i,syncAllViewPointCloudColor:a,imageSizes:h}=N(z),[u,d]=V({copiedBoxes:[],copiedMappingImgList:[]}),{copiedBoxes:l}=u,{pointCloudBoxListUpdated:C}=T(),{t:m,i18n:_}=A(),{pushHistoryWithList:j}=W(),g=D(()=>s.filter(n=>o.includes(n.id)),[o,s]),w=v(()=>{var n;if(g.length>0){const c=(n=e==null?void 0:e.mappingImgList)!=null?n:[];d({copiedBoxes:H.cloneDeep(g),copiedMappingImgList:c})}else d({copiedBoxes:[],copiedMappingImgList:[]}),f.error(m("CopyEmptyInPointCloud"));f.success(m("CopySuccess"))},[o,s,_.language,e]),M=v(()=>{var n,c;if(l.length===0){f.error(m("PasteEmptyInPointCloud"));return}const I=(n=e==null?void 0:e.mappingImgList)!=null?n:[],b=(c=u==null?void 0:u.copiedMappingImgList)!=null?c:[],R=l.map(r=>X(r,I,b)),S=Y(s,R),E=r=>{i(r),C==null||C(r),d({copiedBoxes:[],copiedMappingImgList:[]}),j({pointCloudBoxList:r}),a(U.MultiPaste,r)},y=[...s,...S];y.forEach(r=>q({pointCloudBox:r,mappingImgList:I,imageSizes:h})),E(y)},[l,s,_.language,e]);return{copySelectedBoxes:w,pasteSelectedBoxes:M,copiedBoxes:l,selectedBoxes:g}};export{Z as useBoxes};
|