@labelbee/lb-components 1.24.0-alpha.2 → 1.24.0-alpha.21
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.
- package/dist/_virtual/2DViewWorker.js +1 -1
- package/dist/assets/annotation/rectTool/three_points_rect.svg.js +1 -0
- package/dist/assets/annotation/rectTool/two_points_rect.svg.js +1 -0
- package/dist/components/DynamicResizer/DynamicResizer.js +1 -1
- package/dist/components/DynamicResizer/hooks/useDrag.js +1 -1
- package/dist/components/DynamicResizer/hooks/useDraggingAllowed.js +1 -0
- package/dist/components/DynamicResizer/hooks/useUpdateHeight.js +1 -1
- package/dist/components/DynamicResizer/utils/index.js +1 -0
- package/dist/components/LLMMultiWheelView/dialogView/index.js +1 -1
- package/dist/components/LLMMultiWheelView/index.js +1 -1
- package/dist/components/LLMMultiWheelView/sidebar/index.js +1 -1
- package/dist/components/LLMToolView/index.js +1 -1
- package/dist/components/LLMToolView/questionView/components/audioView/index.js +1 -0
- package/dist/components/LLMToolView/questionView/components/header/index.js +1 -1
- package/dist/components/LLMToolView/questionView/index.js +1 -1
- package/dist/components/attributeList/index.js +1 -1
- package/dist/components/audioAnnotate/index.js +1 -1
- package/dist/components/audioAnnotate/textInput/index.js +1 -1
- package/dist/components/audioAnnotate/textInput/index.module.scss.js +1 -1
- package/dist/components/audioPlayer/index.js +1 -1
- package/dist/components/longText/index.js +1 -1
- package/dist/components/pointCloudView/PointCloud2DView.js +1 -1
- package/dist/components/pointCloudView/PointCloud3DView.js +1 -1
- package/dist/components/pointCloudView/PointCloudContext.js +1 -1
- package/dist/components/pointCloudView/PointCloudListener.js +1 -1
- package/dist/components/pointCloudView/PointCloudTopView.js +1 -1
- package/dist/components/pointCloudView/components/UnifyParamsModal/index.js +1 -1
- package/dist/components/pointCloudView/hooks/usePointCloudAttribute.js +1 -0
- package/dist/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
- package/dist/components/pointCloudView/hooks/useUpdatePointCloudColor.js +1 -1
- package/dist/components/pointCloudView/index.js +1 -1
- package/dist/components/tagList/index.js +1 -1
- package/dist/constant/index.js +1 -1
- package/dist/index.css +116 -89
- package/dist/store/annotation/actionCreators.js +1 -1
- package/dist/store/annotation/reducer.js +1 -1
- package/dist/types/components/DynamicResizer/DynamicResizer.d.ts +3 -3
- package/dist/types/components/DynamicResizer/hooks/useDrag.d.ts +24 -7
- package/dist/types/components/DynamicResizer/hooks/useDraggingAllowed.d.ts +12 -0
- package/dist/types/components/DynamicResizer/hooks/useUpdateHeight.d.ts +10 -21
- package/dist/types/components/DynamicResizer/types/interface.d.ts +14 -6
- package/dist/types/components/DynamicResizer/utils/index.d.ts +4 -0
- package/dist/types/components/LLMMultiWheelView/dialogView/index.d.ts +2 -0
- package/dist/types/components/LLMMultiWheelView/index.d.ts +2 -0
- package/dist/types/components/LLMToolView/questionView/components/audioView/index.d.ts +8 -0
- package/dist/types/components/LLMToolView/questionView/components/header/index.d.ts +3 -1
- package/dist/types/components/longText/index.d.ts +1 -1
- package/dist/types/components/pointCloud2DRectOperationView/useUpdateRectList.d.ts +0 -1
- package/dist/types/components/pointCloudView/PointCloudContext.d.ts +4 -0
- package/dist/types/components/pointCloudView/PointCloudListener.d.ts +1 -0
- package/dist/types/components/pointCloudView/hooks/usePointCloudAttribute.d.ts +3 -0
- package/dist/types/components/pointCloudView/hooks/useRotate.d.ts +1 -2
- package/dist/types/components/pointCloudView/hooks/useRotateEdge.d.ts +1 -2
- package/dist/types/components/pointCloudView/index.d.ts +2 -0
- package/dist/types/constant/index.d.ts +2 -1
- package/dist/types/store/annotation/actionCreators.d.ts +1 -1
- package/dist/types/store/annotation/map.d.ts +1 -0
- package/dist/types/store/annotation/reducer.d.ts +4 -0
- package/dist/types/store/annotation/types.d.ts +3 -2
- package/dist/types/views/MainView/index.d.ts +2 -0
- package/dist/types/views/MainView/sidebar/GeneralOperation/ActionsConfirm.d.ts +3 -0
- package/dist/types/views/MainView/sidebar/GeneralOperation/index.d.ts +9 -0
- package/dist/types/views/MainView/sidebar/index.d.ts +2 -0
- package/dist/utils/ToolPointCloudBoxRenderHelper.js +1 -1
- package/dist/views/MainView/LLMMultiWheelLayout/index.js +1 -1
- package/dist/views/MainView/index.js +1 -1
- package/dist/views/MainView/sidebar/GeneralOperation/ActionsConfirm.js +1 -1
- package/dist/views/MainView/sidebar/GeneralOperation/index.js +1 -1
- package/dist/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
- package/dist/views/MainView/sidebar/ToolIcons.js +1 -1
- package/dist/views/MainView/sidebar/index.js +1 -1
- package/es/_virtual/2DViewWorker.js +1 -1
- package/es/assets/annotation/rectTool/three_points_rect.svg.js +1 -0
- package/es/assets/annotation/rectTool/two_points_rect.svg.js +1 -0
- package/es/components/DynamicResizer/DynamicResizer.js +1 -1
- package/es/components/DynamicResizer/hooks/useDrag.js +1 -1
- package/es/components/DynamicResizer/hooks/useDraggingAllowed.js +1 -0
- package/es/components/DynamicResizer/hooks/useUpdateHeight.js +1 -1
- package/es/components/DynamicResizer/utils/index.js +1 -0
- package/es/components/LLMMultiWheelView/dialogView/index.js +1 -1
- package/es/components/LLMMultiWheelView/index.js +1 -1
- package/es/components/LLMMultiWheelView/sidebar/index.js +1 -1
- package/es/components/LLMToolView/index.js +1 -1
- package/es/components/LLMToolView/questionView/components/audioView/index.js +1 -0
- package/es/components/LLMToolView/questionView/components/header/index.js +1 -1
- package/es/components/LLMToolView/questionView/index.js +1 -1
- package/es/components/attributeList/index.js +1 -1
- package/es/components/audioAnnotate/index.js +1 -1
- package/es/components/audioAnnotate/textInput/index.js +1 -1
- package/es/components/audioAnnotate/textInput/index.module.scss.js +1 -1
- package/es/components/audioPlayer/index.js +1 -1
- package/es/components/longText/index.js +1 -1
- package/es/components/pointCloudView/PointCloud2DView.js +1 -1
- package/es/components/pointCloudView/PointCloud3DView.js +1 -1
- package/es/components/pointCloudView/PointCloudContext.js +1 -1
- package/es/components/pointCloudView/PointCloudListener.js +1 -1
- package/es/components/pointCloudView/PointCloudTopView.js +1 -1
- package/es/components/pointCloudView/components/UnifyParamsModal/index.js +1 -1
- package/es/components/pointCloudView/hooks/usePointCloudAttribute.js +1 -0
- package/es/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
- package/es/components/pointCloudView/hooks/useUpdatePointCloudColor.js +1 -1
- package/es/components/pointCloudView/index.js +1 -1
- package/es/components/tagList/index.js +1 -1
- package/es/constant/index.js +1 -1
- package/es/index.css +116 -89
- package/es/store/annotation/actionCreators.js +1 -1
- package/es/store/annotation/reducer.js +1 -1
- package/es/utils/ToolPointCloudBoxRenderHelper.js +1 -1
- package/es/views/MainView/LLMMultiWheelLayout/index.js +1 -1
- package/es/views/MainView/index.js +1 -1
- package/es/views/MainView/sidebar/GeneralOperation/ActionsConfirm.js +1 -1
- package/es/views/MainView/sidebar/GeneralOperation/index.js +1 -1
- package/es/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
- package/es/views/MainView/sidebar/ToolIcons.js +1 -1
- package/es/views/MainView/sidebar/index.js +1 -1
- package/package.json +6 -6
- package/dist/components/DynamicResizer/assets/bottomToZero.svg.js +0 -1
- package/dist/components/DynamicResizer/assets/divider.svg.js +0 -1
- package/dist/components/DynamicResizer/assets/topToZero.svg.js +0 -1
- package/es/components/DynamicResizer/assets/bottomToZero.svg.js +0 -1
- package/es/components/DynamicResizer/assets/divider.svg.js +0 -1
- package/es/components/DynamicResizer/assets/topToZero.svg.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getClassName as
|
|
1
|
+
import{getClassName as u}from"../../utils/dom.js";import{cKeyCode as ee,PointCloud as te}from"@labelbee/lb-annotation";import{PointCloudUtils as T,EPerspectiveView as E}from"@labelbee/lb-utils";import O from"classnames";import o,{useContext as b,useState as y,useRef as oe,useEffect as p,useMemo as ne}from"react";import{PointCloudContainer as ie}from"./PointCloudLayout.js";import{PointCloudContext as le}from"./PointCloudContext.js";import{a2MapStateToProps as se}from"../../store/annotation/map.js";import{connect as re}from"react-redux";import{jsonParser as ae}from"../../utils/index.js";import{useSingleBox as A}from"./hooks/useSingleBox.js";import{useSphere as ce}from"./hooks/useSphere.js";import{Switch as de,Tooltip as ue}from"antd";import me from"../../hooks/useSize.js";import{usePointCloudViews as pe}from"./hooks/usePointCloudViews.js";import{useTranslation as F}from"react-i18next";import{LabelBeeContext as we}from"../../store/ctx.js";import ve from"./components/PointCloudSizeSlider/index.js";import fe from"./components/TitleButton/index.js";import{LeftOutlined as Ce}from"@ant-design/icons";import{useToolStyleContext as Ve}from"../../hooks/useToolStyle.js";import{usePointCloudAttribute as ge}from"./hooks/usePointCloudAttribute.js";var Ie=Object.defineProperty,H=Object.getOwnPropertySymbols,Pe=Object.prototype.hasOwnProperty,Ee=Object.prototype.propertyIsEnumerable,U=(n,l,s)=>l in n?Ie(n,l,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[l]=s,he=(n,l)=>{for(var s in l||(l={}))Pe.call(l,s)&&U(n,s,l[s]);if(H)for(var s of H(l))Ee.call(l,s)&&U(n,s,l[s]);return n};const xe=ee.default,_e="LABELBEE-POINTCLOUD",h=o.createContext({isActive:!1,setTarget3DView:()=>{},reset3DView:()=>{},followTopView:()=>{}}),v=({perspectiveView:n})=>{const{isActive:l,setTarget3DView:s}=b(h),f=w=>O({[u("point-cloud-3d-view",w)]:!0,active:l});return o.createElement("span",{onClick:()=>{s(E[n])},className:f(n.toLocaleLowerCase())})},K=({isEnlarge:n})=>{const{reset3DView:l,followTopView:s}=b(h),{t:f}=F(),w=o.createElement(o.Fragment,null,o.createElement(v,{perspectiveView:"Top"}),o.createElement(v,{perspectiveView:"Front"}),o.createElement(v,{perspectiveView:"Left"}),o.createElement(v,{perspectiveView:"Back"}),o.createElement(v,{perspectiveView:"Right"}),o.createElement(v,{perspectiveView:"LFT"}),o.createElement(v,{perspectiveView:"RBT"})),e=o.createElement(o.Fragment,null,o.createElement(ue,{title:f("CameraFollowTopView")},o.createElement("span",{onClick:()=>{s()},className:u("point-cloud-3d-view","followTop")})),o.createElement("span",{onClick:()=>{l()},className:u("point-cloud-3d-view","reset")}));return n?o.createElement("div",{className:u("point-cloud-3d-sidebarZoom")},e,w):o.createElement("div",{className:u("point-cloud-3d-sidebar")},w,e)},Se=({currentData:n,config:l,highlightAttribute:s,setResourceLoading:f})=>{var w;const e=b(le),{setIsLargeStatus:B}=e,[M,Z]=y(!0),[C,x]=y(!1),V=oe(null),{initPointCloud3d:L,generateRects:q}=pe(),g=me(V),{t:_}=F(),{value:j}=Ve(),{hiddenText:D}=j||{},{updatePointCloudAttribute:G}=ge(f,l),{updateSelectedBox:J}=A({generateRects:q});p(()=>{let t=e.mainViewInstance;t&&t.updateHiddenTextAndRender(D,e.pointCloudBoxList)},[j]),p(()=>{!e.mainViewInstance||L==null||L(g)},[g]);const{selectedBox:m}=A(),{selectedSphere:I}=ce(),[Q,z]=y(!0),S=t=>{var i,r;const a=m==null?void 0:m.info;if(a){const c=he({},a.center);c.x=c.x-.01,c.z=1e3;const d=t===E.Top;(i=e.mainViewInstance)==null||i.updateCameraByBox(a,t,d?c:void 0)}I&&((r=e.mainViewInstance)==null||r.updateCameraBySphere(I,t))},W=()=>{var t;(t=e.mainViewInstance)==null||t.resetCamera()},X=()=>{var t,i;const r=(t=e.topViewInstance)==null?void 0:t.pointCloudInstance.camera;r&&((i=e.mainViewInstance)==null||i.applyCameraTarget(r))};p(()=>{if(V.current&&(n==null?void 0:n.url)){let t=e.mainViewInstance;!t&&g.width&&(t=new te({container:V.current,isOrthographicCamera:!0,orthographicParams:T.getDefaultOrthographicParams(g),config:l,hiddenText:D}),t.setHandlerPipe({setSelectedIDs:e.setSelectedIDs,setNeedUpdateCenter:z}),e.setMainViewInstance(t))}},[g,n]),p(()=>{var t,i;if(V.current&&(n==null?void 0:n.url)&&n.result&&e.mainViewInstance){let r=e.mainViewInstance;const a=T.getRectParamsFromResultList(n.result),c=T.getBoxParamsFromResultList(n.result),d=c.find(P=>P.id===e.selectedID);d&&((t=e.topViewInstance)==null||t.updatePolygonList(c,void 0),G(d.attribute),J(d),e.setSelectedIDs(d.id)),e.setPointCloudValid((i=ae(n.result))==null?void 0:i.valid),e.setPointCloudResult(c),e.setRectList(a),r.generateBoxes(c)}},[n.result,e.mainViewInstance]),p(()=>{var t,i,r,a,c,d,P;const R=(t=m==null?void 0:m.info)==null?void 0:t.id;if(!Q){z(!0);return}if(R!==void 0){S(E.Top);const $=(a=(r=(i=e.topViewInstance)==null?void 0:i.pointCloudInstance)==null?void 0:r.camera.zoom)!=null?a:1;(c=e.mainViewInstance)==null||c.updateCameraZoom($)}(d=e.mainViewInstance)==null||d.setHighlightColor(R),(P=e.mainViewInstance)==null||P.render()},[(w=m==null?void 0:m.info)==null?void 0:w.id]),p(()=>{var t,i,r,a;if(I){S(E.Top);const c=(r=(i=(t=e.topViewInstance)==null?void 0:t.pointCloudInstance)==null?void 0:i.camera.zoom)!=null?r:1;(a=e.mainViewInstance)==null||a.updateCameraZoom(c)}},[I]),p(()=>(window.addEventListener("keydown",k),()=>{window.removeEventListener("keydown",k)}),[]);const k=t=>{if(t.keyCode===xe.Esc){x(!1);return}},N=ne(()=>({reset3DView:W,setTarget3DView:S,isActive:!!m,followTopView:X}),[m,e.mainViewInstance]);p(()=>{var t,i,r;const a=e.pointCloudBoxList.filter(c=>c.attribute===s);(a==null?void 0:a.length)>0&&((t=e.mainViewInstance)==null||t.clearHighlightBoxes(),(i=e.mainViewInstance)==null||i.highlightBoxes(a)),a.length===0&&((r=e.mainViewInstance)==null||r.clearHighlightBoxesAndRender())},[s,e.mainViewInstance]);const Y=o.createElement(o.Fragment,null,o.createElement(ve,{onChange:t=>{var i;(i=e.mainViewInstance)==null||i.updatePointSize({customSize:t})}}),o.createElement("span",{style:{marginRight:8}},_("ShowArrows")),o.createElement(de,{size:"small",checked:M,onChange:t=>{var i;Z(t),(i=e.mainViewInstance)==null||i.setShowDirection(t)}}),C&&o.createElement(h.Provider,{value:N},o.createElement(K,{isEnlarge:C})));return o.createElement(ie,{className:O({[u("point-cloud-3d-container")]:!0,[u("point-cloud-container","zoom")]:C}),title:C?o.createElement("div",{style:{display:"flex",alignItems:"center"}},o.createElement(Ce,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{B(!1),x(!1)}}),_("3DView")):o.createElement(fe,{title:_("3DView"),onClick:()=>{B(!0),x(!0)}}),toolbar:Y},o.createElement("div",{className:u("point-cloud-3d-content")},!C&&o.createElement(h.Provider,{value:N},o.createElement(K,null)),o.createElement("div",{className:u("point-cloud-3d-view"),id:_e,ref:V})))};var Te=re(se,null,null,{context:we})(Se);export{Te as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{EPointCloudPattern as
|
|
1
|
+
import{EPointCloudPattern as X}from"@labelbee/lb-utils";import Me,{useState as r,useRef as pt,useMemo as k,useCallback as N,useEffect as Y}from"react";import{EPointCloudBoxRenderTrigger as F,calcResetAreasAndBoxIds as mt}from"../../utils/ToolPointCloudBoxRenderHelper.js";import{ActionsHistory as je,EToolName as $,uuid as ht}from"@labelbee/lb-annotation";import{useDispatch as It}from"../../store/ctx.js";import{ChangeSave as vt}from"../../store/annotation/actionCreators.js";import Pt from"../../store/annotatedBox/index.js";import ke from"lodash";import{addMapIndirectWeakSetItem as Fe}from"./utils/map.js";import wt from"./hooks/useTimeoutFunc.js";import St,{getEmptyUseWindowKeydownListener as yt}from"./hooks/useWindowKeydownListener.js";var Lt=Object.defineProperty,bt=Object.defineProperties,Ct=Object.getOwnPropertyDescriptors,Ee=Object.getOwnPropertySymbols,Rt=Object.prototype.hasOwnProperty,xt=Object.prototype.propertyIsEnumerable,ze=(c,s,u)=>s in c?Lt(c,s,{enumerable:!0,configurable:!0,writable:!0,value:u}):c[s]=u,E=(c,s)=>{for(var u in s||(s={}))Rt.call(s,u)&&ze(c,u,s[u]);if(Ee)for(var u of Ee(s))xt.call(s,u)&&ze(c,u,s[u]);return c},Ge=(c,s)=>bt(c,Ct(s)),Dt=(c,s,u)=>new Promise((x,B)=>{var A=g=>{try{w(u.next(g))}catch(R){B(R)}},G=g=>{try{w(u.throw(g))}catch(R){B(R)}},w=g=>g.done?x(g.value):Promise.resolve(g.value).then(A,G);w((u=u.apply(c,s)).next())});const z=c=>ke.pick(c,["id","attribute","width","height","x","y","imageName"]),Ke=Me.createContext({rectList:[],pointCloudBoxList:[],pointCloudSphereList:[],displayPointCloudList:[],displaySphereList:[],displayLineList:[],polygonList:[],lineList:[],selectedID:"",selectedIDs:[],highlightIDs:[],setHighlightIDs:()=>{},valid:!0,visibleBatchSetValid:!1,setSelectedIDs:()=>{},setPointCloudResult:()=>{},setPointCloudSphereList:()=>{},setPointCloudValid:()=>{},setBatchSetValidModal:()=>{},setTopViewInstance:()=>{},setSideViewInstance:()=>{},setBackViewInstance:()=>{},setMainViewInstance:()=>{},addSelectedID:()=>{},addHighlightID:()=>{},selectedAllBoxes:()=>{},addPointCloudBox:()=>[],addPointCloudSphere:()=>[],setPolygonList:()=>{},setRectList:()=>{},addRectIn2DView:()=>{},removeRectIn2DView:()=>{},updateRectIn2DView:()=>{},setLineList:()=>{},zoom:1,setZoom:()=>{},history:new je,hideAttributes:[],setHideAttributes:()=>{},toggleAttributesVisible:()=>{},reRender:()=>{},setAttrPanelLayout:()=>{},attrPanelLayout:"",syncAllViewPointCloudColor:()=>Promise.resolve(),defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:$.Rect,setPointCloudPattern:()=>{},selectSpecAttr:()=>{},globalPattern:X.Detection,setGlobalPattern:()=>{},setPtSegmentInstance:()=>{},segmentation:[],setSegmentation:()=>{},clearAllDetectionInstance:()=>{},highlight2DDataList:[],setHighlight2DDataList:()=>{},highlight2DLoading:!1,setHighlight2DLoading:()=>{},cuboidBoxIn2DView:!0,setCuboidBoxIn2DView:c=>{},imageSizes:{},cacheImageNodeSize:()=>{},addRectFromPointCloudBoxByImageName:c=>!1,removeRectBySpecifyId:(c,s,u)=>!1,removeRectByPointCloudBoxId:c=>!1,rectRotateSensitivity:2,setRectRotateSensitivity:()=>{},imageNamePointCloudBoxMap:new Map,linkageImageNameRectMap:new Map,updateRectListByReducer:()=>{},windowKeydownListenerHook:yt(),isLargeStatus:!1,setIsLargeStatus:()=>{}}),Bt=({children:c})=>{const[s,u]=r([]),[x,B]=r([]),[A,G]=r([]),[w,g]=r([]),[R,Te]=r([]),[v,ee]=r([]),[V,K]=r([]),[te,We]=r(!0),[oe,Ze]=r(2),[ne,Ue]=r(!0),[ie,qe]=r(1),[p,se]=r(),[re,le]=r(),[ae,de]=r(),[f,ce]=r(),[ue,Je]=r(""),[T,Qe]=r($.Rect),W=pt(new je).current,[m,Z]=r([]),[ge,Xe]=r(""),[U,Ye]=r(X.Detection),[D,fe]=r(void 0),[q,$e]=r([]),[J,et]=r([]),[pe,tt]=r(!1),[me,he]=r(!1),h=Pt(),[Ie,ot]=r(!1),[ve,nt]=r({}),it=It(),st=o=>{const{imgNode:n,path:t}=o;t&&n&&nt(a=>Ge(E({},a),{[t]:{width:n.width,height:n.height}}))},Pe=k(()=>v.length===1?v[0]:"",[v]),we=St(),H=N((o,n,t="extId")=>{const a=t||"id",d=new Set(n);return g(l=>{let S=!1;const P=l.filter(M=>{const Q=M[a],j=d.has(Q)?M.imageName!==o:!0;return j||(S=!0),j});return S?P:l}),!0},[]),Se=N(o=>{const n=s.map(t=>t.id);return H(o,n,"extId")},[s,H]),ye=N(o=>{if(!o)return!1;const n=s.filter(t=>Array.isArray(t.rects)).map(t=>{const{id:a,attribute:d,trackID:l}=t,S=t.rects.find(P=>P.imageName===o);if(S){const P=ke.pick(S,["width","height","x","y","imageName"]);return Ge(E({},P),{id:ht(),attribute:d,order:l,extId:a,lineDash:[]})}return null}).filter(t=>t!==null);return n.length?(g(t=>{const a=new Set(t.filter(l=>o===l.imageName).map(l=>l.extId)),d=n.filter(l=>a.has(l.extId)===!1);return d.length?[...t,...d]:t}),!0):!1},[s]),Le=k(()=>s.filter(n=>Array.isArray(n.rects)&&n.rects.length>0).reduce((n,t)=>{var a;return(a=t.rects)==null||a.forEach(d=>{const{imageName:l}=d;if(!l){console.warn("Missing image name"),console.trace(d,t);return}Fe(n,l,t.id,t)}),n},new Map),[s]),be=N(o=>{g(n=>o(n,z))},[z]),Ce=k(()=>w.filter(o=>o.extId!==void 0&&o.id!==void 0).reduce((o,n)=>{const t=n.imageName;return t?(Fe(o,t,n.extId,n),o):(console.warn("missing image name"),console.log(n,w),o)},new Map),[w]),{fn:rt}=wt(o=>{ee(n=>{const t=o,a=new Set(t);let d=!1;const l=n.filter(S=>{const P=a.has(S);return P||(d=!0),P});return d?l:n})},200),Re=N(o=>{const n=o.map(t=>t.id);u(o),rt(n)},[]),O=k(()=>{const o=s.find(e=>e.id===Pe),n=e=>{const i=s.concat(e);return Re(i),i},t=e=>{const i=x.concat(e);return B(i),i},a=e=>{We(e!==!1)},d=e=>{ot(e)},l=e=>{let i=[];e===void 0||e===""?i=[]:typeof e=="string"?i=[e]:Array.isArray(e)&&(i=e.length>1?Array.from(new Set(e)):e),ee(i)},S=e=>{v.includes(e)?l(v.filter(i=>i!==e)):l([...v,e])},P=e=>{const i=z(e);g(I=>[...I,i])},M=(e,i=!1)=>{const I=z(e);g(y=>y.map(L=>L.id===e.id?i?E(E({},L),I):I:L))},Q=e=>{g(i=>i.filter(I=>!e.find(y=>y.id===I.id)))},j=e=>{V.includes(e)?K([]):K([e])},at=()=>{if(T===$.Rect){const e=s.map(i=>i.id);l(e),p==null||p.pointCloud2dOperation.setSelectedIDs(e)}},dt=e=>{l(s.filter(i=>i.attribute===e).map(i=>i.id))},xe=s.filter(e=>!m.includes(e.attribute)),De=x.filter(e=>!m.includes(e.attribute)),Be=R.filter(e=>e.attribute&&!m.includes(e.attribute)),ct=e=>{if(m.includes(e))Z(m.filter(i=>i!==e));else{const i=m.concat(e);Z(i)}},ut=(e=xe,i=A,I=De,y=Be,L=q)=>{var _;f==null||f.clearAllBox(),f==null||f.clearAllSphere(),p==null||p.updatePolygonList(e,i),p==null||p.updatePointList(I),p==null||p.updateLineList(y),f==null||f.generateBoxes(e),f==null||f.generateSpheres(I),(_=D==null?void 0:D.store)==null||_.updateCurrentSegment(L),Ae(F.Default,e)},gt=()=>{se(void 0),le(void 0),de(void 0),ce(void 0)},Ae=(e,i,I)=>Dt(void 0,null,function*(){var y,L,_;if(!f)return;const Ve=f.pointCloudObject;if(!Ve)return;let _e=[],Ne=[];try{if(i&&W.record.length){const{record:b,recordIndex:C}=W;let He=C;C>0&&(e===F.SingleToggleValid||e===F.SingleRotate||e===F.Single&&i.length===((y=b[C])==null?void 0:y.pointCloudBoxList.length))&&(He=C-1);let ft=(L=b[He])==null?void 0:L.pointCloudBoxList;const Oe=mt(e,i,ft);_e=Oe.modifiedBoxIds,Ne=Oe.resetAreas}}catch(b){console.error("call calcResetAreasAndBoxIds error",b)}try{const b=yield f.getHighlightIndexByMappingImgList({mappingImgList:I!=null?I:J,points:Ve.geometry.attributes.position.array}),C=yield f==null?void 0:f.highlightOriginPointCloud(i,b,{modifiedBoxIds:_e,resetAreas:Ne});return C&&((_=p==null?void 0:p.pointCloudInstance)==null||_.updateColor(C)),C}catch(b){console.error("call highlightOriginPointCloud error",b)}});return{selectedID:Pe,pointCloudBoxList:s,pointCloudSphereList:x,displayPointCloudList:xe,displaySphereList:De,displayLineList:Be,selectedIDs:v,setPointCloudResult:Re,setSelectedIDs:l,addPointCloudBox:n,addPointCloudSphere:t,setPointCloudSphereList:B,valid:te,visibleBatchSetValid:Ie,selectedPointCloudBox:o,setPointCloudValid:a,setBatchSetValidModal:d,addSelectedID:S,addHighlightID:j,selectedAllBoxes:at,topViewInstance:p,setTopViewInstance:se,sideViewInstance:re,setSideViewInstance:le,backViewInstance:ae,setBackViewInstance:de,mainViewInstance:f,setMainViewInstance:ce,polygonList:A,setPolygonList:G,rectList:w,setRectList:g,addRectIn2DView:P,removeRectIn2DView:Q,updateRectIn2DView:M,lineList:R,setLineList:Te,zoom:ie,setZoom:qe,history:W,toggleAttributesVisible:ct,hideAttributes:m,setHideAttributes:Z,reRender:ut,attrPanelLayout:ge,setAttrPanelLayout:Xe,syncAllViewPointCloudColor:Ae,defaultAttribute:ue,setDefaultAttribute:Je,pointCloudPattern:T,setPointCloudPattern:Qe,selectSpecAttr:dt,globalPattern:U,setGlobalPattern:e=>{U!==e&&(it(vt),Ye(e),e===X.Detection&&fe(void 0))},ptSegmentInstance:D,setPtSegmentInstance:fe,segmentation:q,setSegmentation:$e,clearAllDetectionInstance:gt,highlight2DDataList:J,setHighlight2DDataList:et,highlight2DLoading:pe,setHighlight2DLoading:tt,cuboidBoxIn2DView:ne,setCuboidBoxIn2DView:Ue,imageSizes:ve,cacheImageNodeSize:st,highlightIDs:V,setHighlightIDs:K,removeRectByPointCloudBoxId:Se,removeRectBySpecifyId:H,addRectFromPointCloudBoxByImageName:ye,rectRotateSensitivity:oe,setRectRotateSensitivity:Ze,imageNamePointCloudBoxMap:Le,linkageImageNameRectMap:Ce,updateRectListByReducer:be,windowKeydownListenerHook:we,isLargeStatus:me,setIsLargeStatus:he}},[te,Ie,v,s,x,A,R,w,p,re,ae,f,ie,m,ge,ue,T,U,D,q,J,pe,ne,ve,V,Se,H,ye,oe,Le,Ce,be,we,me,he]);Y(()=>{var o,n,t;(o=h==null?void 0:h.setPointCloudBoxList)==null||o.call(h,s),(n=h==null?void 0:h.setHighlightIDs)==null||n.call(h,V),(t=h==null?void 0:h.setSelectedIDs)==null||t.call(h,v)},[s,v,V]),Y(()=>{var o;(o=h==null?void 0:h.setPtCtx)==null||o.call(h,O)},[O]);const lt=()=>{const o=s.filter(d=>m.includes(d.attribute)),{setSelectedIDs:n,reRender:t}=O,a=o.map(d=>d.id);a.length>0&&n(v.filter(d=>!a.includes(d))),t()};return Y(()=>{var o,n,t,a;lt(),(n=(o=p==null?void 0:p.toolInstance)==null?void 0:o.setHiddenAttributes)==null||n.call(o,m),(a=(t=D==null?void 0:D.store)==null?void 0:t.setHiddenAttributes)==null||a.call(t,m)},[m]),Me.createElement(Ke.Provider,{value:O},c)};export{Ke as PointCloudContext,Bt as PointCloudProvider};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{PointCloudContext as
|
|
1
|
+
import{PointCloudContext as oe}from"./PointCloudContext.js";import{useRotate as re}from"./hooks/useRotate.js";import{useRotateEdge as se}from"./hooks/useRotateEdge.js";import{useBoxes as ne}from"./hooks/useBoxes.js";import{useSingleBox as ie}from"./hooks/useSingleBox.js";import{useSphere as ae}from"./hooks/useSphere.js";import{useContext as ue,useEffect as c}from"react";import{CommonToolUtils as le,EToolName as f,cTool as ce}from"@labelbee/lb-annotation";import{Modal as de,message as h}from"antd";import{connect as pe}from"react-redux";import{a2MapStateToProps as me}from"../../store/annotation/map.js";import{useStatus as fe}from"./hooks/useStatus.js";import{usePointCloudViews as Pe}from"./hooks/usePointCloudViews.js";import{LabelBeeContext as we}from"../../store/ctx.js";import{useHistory as be}from"./hooks/useHistory.js";import{useAttribute as ye}from"./hooks/useAttribute.js";import{useConfig as ve}from"./hooks/useConfig.js";import{usePolygon as he}from"./hooks/usePolygon.js";import{useLine as Ce}from"./hooks/useLine.js";import{useUpdatePointCloudColor as ge}from"./hooks/useUpdatePointCloudColor.js";import{useTranslation as Se}from"react-i18next";import{useLatest as I}from"ahooks";var ke=Object.defineProperty,xe=Object.defineProperties,Ve=Object.getOwnPropertyDescriptors,O=Object.getOwnPropertySymbols,_e=Object.prototype.hasOwnProperty,Be=Object.prototype.propertyIsEnumerable,j=(i,r,a)=>r in i?ke(i,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):i[r]=a,P=(i,r)=>{for(var a in r||(r={}))_e.call(r,a)&&j(i,a,r[a]);if(O)for(var a of O(r))Be.call(r,a)&&j(i,a,r[a]);return i},w=(i,r)=>xe(i,Ve(r));const{EPolygonPattern:Ie}=ce,Oe=({currentData:i,config:r,checkMode:a,configString:L,imgIndex:C,toolInstanceRef:u,setResourceLoading:g,isBatchSetValid:A})=>{const e=ue(oe),{changeSelectedBoxValid:E,selectNextBox:T,selectPrevBox:D,updateSelectedBox:H,deleteSelectedPointCloudBoxAndPolygon:K}=ie(),{selectedSphere:b,updatePointCloudSphere:N}=ae(),{clearAllResult:y,updatePointCloudPattern:U}=fe(),{copySelectedBoxes:z,pasteSelectedBoxes:R,copiedBoxes:Le}=ne({config:r,currentData:i}),{updateRotate:S}=re({currentData:i}),{updateRotateEdge:F}=se({currentData:i}),{updatePointCloudData:p,topViewSelectedChanged:M}=Pe({setResourceLoading:g}),{redo:k,undo:x,pushHistoryWithList:q,pushHistoryUnderUpdatePolygon:G,pushHistoryUnderUpdateLine:W}=be(),{syncThreeViewsAttribute:V}=ye(),{syncAllViewsConfig:Y,reRenderTopViewRange:$}=ve(),{selectedPolygon:_}=he(),{selectedLine:B}=Ce(),{t:v}=Se(),{updatePointCloudColor:J}=ge(g,r),Q=I(i),m=t=>{var o;const{topViewInstance:s}=e;!s||(o=s.pointCloud2dOperation)==null||o.updateSelectedPolygonsPoints(t)},X=(t,o)=>{const{topViewInstance:s,mainViewInstance:n}=e;if(!s)return;const{pointCloud2dOperation:l}=s;switch(t){case"q":{S(e.rectRotateSensitivity);break}case"e":S(-Number(e.rectRotateSensitivity));break;case"g":F(-90);break;case"u":{const d=l.pattern===Ie.Normal?f.Rect:f.Polygon;U(d);const te={[f.Polygon]:v("PolygonPattern"),[f.Rect]:v("RectPattern")};h.success(v("ChangePatternMsg",{pattern:te[d]})),l.clearActiveStatus(),l.clearDrawingStatus()}break;case"+":n==null||n.updatePointSize({zoomIn:!0});break;case"-":n==null||n.updatePointSize({zoomIn:!1});break;case"v":A?(de.destroyAll(),e.setBatchSetValidModal(!e.visibleBatchSetValid)):e.setPointCloudValid(!e.valid);break;case"tab":if(o.shiftKey){D();break}T(),o.preventDefault();break;case"f":E();break;case"arrowup":m({y:-1});break;case"arrowdown":m({y:1});break;case"arrowleft":m({x:-1});break;case"arrowright":m({x:1});break;case"delete":K(Q.current);break}},Z=(t,o)=>{switch(t){case"c":z();break;case"v":R();break;case"a":o.preventDefault(),e.selectedAllBoxes();break;case"z":{o.shiftKey?k():x();break}}},ee=I(t=>{if(!le.hotkeyFilter(t)||a===!0)return;const o=t.key.toLocaleLowerCase();if(t.ctrlKey){Z(o,t);return}X(o,t)});return c(()=>{if(!e.topViewInstance)return;const{addEventListener:o}=e.windowKeydownListenerHook;return o(l=>ee.current(l))},[e,e.topViewInstance,e.windowKeydownListenerHook]),c(()=>{Y(r)},[L]),c(()=>{(r==null?void 0:r.radius)&&$(r==null?void 0:r.radius)},[r==null?void 0:r.radius]),c(()=>{p==null||p()},[C,e.mainViewInstance]),c(()=>{e.setHideAttributes([])},[C]),c(()=>{u.current.setDefaultAttribute=t=>{var o;if(V(t),J(t),_&&G(w(P({},_),{attribute:t})),B&&W(w(P({},B),{attribute:t})),b){const s=N(w(P({},b),{attribute:t}));e.mainViewInstance&&((o=e.mainViewInstance)==null||o.generateSpheres(s),M({newSelectedSphere:b,newSphereList:s}))}},u.current.setSubAttribute=(t,o)=>{var s;const n=e.selectedPointCloudBox;if(n){const l=(s=n==null?void 0:n.subAttribute)!=null?s:{};n.subAttribute=w(P({},l),{[t]:o}),H(n),e.mainViewInstance&&e.selectedPointCloudBox&&(e.mainViewInstance.generateBox(e.selectedPointCloudBox),e.mainViewInstance.setHighlightColor(n.id),e.mainViewInstance.render())}},u.current.clearResult=()=>{y==null||y()},u.current.redo=()=>{k()},u.current.undo=()=>{x()},u.current.setValid=t=>{u.current.valid=t,setTimeout(()=>{e.setPointCloudValid(t),t===!1&&y()})},u.current.setForbidOperation=t=>{var o,s;(s=(o=e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||s.setForbidOperation(t),t===!0&&e.setSelectedIDs(void 0)},u.current.setShowDefaultCursor=t=>{var o,s;(s=(o=e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||s.setShowDefaultCursor(t)},u.current.asyncData=t=>{setTimeout(()=>{p==null||p(t)})}},[e.pointCloudBoxList,e.pointCloudSphereList,e.selectedID,e.selectedIDs,e.valid,e.polygonList,e.lineList,e.mainViewInstance,e.ptSegmentInstance]),c(()=>{u.current.updateSegmentTool=t=>{var o;(o=e.ptSegmentInstance)==null||o.emit(t)},u.current.segmentInstance=e.ptSegmentInstance},[e.ptSegmentInstance]),c(()=>{u.current.history={pushHistory:t=>{q({pointCloudBoxList:t})},initRecord:()=>{}}},[]),c(()=>{var t;const o=(t=e.topViewInstance)==null?void 0:t.toolInstance;if(!o||a)return;const s=d=>{V(d)},n=d=>{h.error(d)},l=d=>{h.info(d)};return o.on("syncAttribute",s),o.on("messageError",n),o.on("messageInfo",l),()=>{o.unbind("syncAttribute",s),o.unbind("messageError",n),o.unbind("messageInfo",l)}},[e.topViewInstance]),null};var je=pe(me,null,null,{context:we})(Oe);export{je as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getClassName as _}from"../../utils/dom.js";import{FooterDivider as
|
|
1
|
+
import{getClassName as _}from"../../utils/dom.js";import{FooterDivider as K}from"../../views/MainView/toolFooter/index.js";import{ZoomController as Ie}from"../../views/MainView/toolFooter/ZoomController/index.js";import{LeftOutlined as ye,UpSquareOutlined as xe,DownSquareOutlined as he}from"@ant-design/icons";import{cKeyCode as Ve,PointCloudAnnotation as Se,MathUtils as M,cTool as _e,cAnnotation as Ee}from"@labelbee/lb-annotation";import{PointCloudUtils as X}from"@labelbee/lb-utils";import{EPointCloudBoxRenderTrigger as Y}from"../../utils/ToolPointCloudBoxRenderHelper.js";import s,{useState as B,useRef as Le,useContext as q,useLayoutEffect as be,useEffect as P}from"react";import{PointCloudContext as $}from"./PointCloudContext.js";import{useRotate as Oe}from"./hooks/useRotate.js";import{useRotateEdge as je}from"./hooks/useRotateEdge.js";import{useSingleBox as G}from"./hooks/useSingleBox.js";import{PointCloudContainer as Te}from"./PointCloudLayout.js";import{BoxInfos as J,PointCloudValidity as De}from"./PointCloudInfos.js";import{usePolygon as Re}from"./hooks/usePolygon.js";import{useSphere as Q}from"./hooks/useSphere.js";import{useZoom as ee}from"./hooks/useZoom.js";import{Slider as ke}from"antd";import{a2MapStateToProps as Be}from"../../store/annotation/map.js";import{connect as Ae}from"react-redux";import{usePointCloudViews as Ne}from"./hooks/usePointCloudViews.js";import Ue from"../../hooks/useSize.js";import{useTranslation as ze}from"react-i18next";import{LabelBeeContext as Ze}from"../../store/ctx.js";import{jsonParser as He}from"../../utils/index.js";import Fe from"../../utils/ToolUtils.js";import We from"lodash";import Ke from"./components/PointCloudSizeSlider/index.js";import{useHistory as Me}from"./hooks/useHistory.js";import Xe from"./components/TitleButton/index.js";var Ye=Object.defineProperty,qe=Object.defineProperties,$e=Object.getOwnPropertyDescriptors,te=Object.getOwnPropertySymbols,Ge=Object.prototype.hasOwnProperty,Je=Object.prototype.propertyIsEnumerable,oe=(i,l,r)=>l in i?Ye(i,l,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[l]=r,U=(i,l)=>{for(var r in l||(l={}))Ge.call(l,r)&&oe(i,r,l[r]);if(te)for(var r of te(l))Je.call(l,r)&&oe(i,r,l[r]);return i},z=(i,l)=>qe(i,$e(l));const{EPolygonPattern:Qe,EToolName:ne}=_e,{ESortDirection:ie}=Ee,et=Ve.default,se=(i,l,r=1)=>{const{width:v,height:m}=l,y={x:i.x+v*r/2,y:i.y+m*r/2},x={x:l.width/2,y:l.height/2};return{offsetX:(x.x-y.x)/r,offsetY:-(x.y-y.y)/r}},tt=({currentData:i})=>{var l,r;const{zoom:v,zoomIn:m,zoomOut:y,initialPosition:x}=ee(),{selectNextBox:O,selectPrevBox:j}=G(),{switchToNextSphere:E}=Q(),{updateRotate:L}=Oe({currentData:i}),{updateRotateEdge:T}=je({currentData:i}),g=q($),{topViewInstance:h}=g,f=(r=(l=g==null?void 0:g.topViewInstance)==null?void 0:l.toolScheduler)==null?void 0:r.getCurrentToolName(),e=()=>{L(-Number(g.rectRotateSensitivity))},d=()=>{L(g.rectRotateSensitivity)},C=()=>{T(-90)};return s.createElement(s.Fragment,null,s.createElement(Ke,{onChange:A=>{var V;(V=h==null?void 0:h.pointCloudInstance)==null||V.updatePointSize({customSize:A})}}),s.createElement("span",{onClick:d,className:_("point-cloud","rotate-reserve")}),s.createElement("span",{onClick:e,className:_("point-cloud","rotate")}),s.createElement("span",{onClick:C,className:_("point-cloud","rotate-90")}),s.createElement(K,null),s.createElement(xe,{onClick:()=>{if(f===ne.Point){E(ie.descend);return}j(!0)},className:_("point-cloud","prev")}),s.createElement(he,{onClick:()=>{if(f===ne.Point){E(ie.ascend);return}O(!0)},className:_("point-cloud","next")}),s.createElement(K,null),s.createElement(Ie,{initialPosition:x,zoomIn:m,zoomOut:y,zoom:v}))},ot=({setZAxisLimit:i,zAxisLimit:l,checkMode:r})=>r?null:s.createElement("div",{style:{position:"absolute",top:128,right:8,height:"50%",zIndex:20}},s.createElement(ke,{vertical:!0,step:.5,max:10,min:.5,defaultValue:l,onAfterChange:v=>{i(v)}})),nt=({currentData:i,imgList:l,stepInfo:r,drawLayerSlot:v,checkMode:m,intelligentFit:y,setIsEnlargeTopView:x,isEnlargeTopView:O,onExitZoom:j,highlightAttribute:E})=>{var L,T;const[g,h]=B({zoom:1,currentPos:{x:0,y:0}}),f=Le(null),e=q($),d=Ue(f),C=He(r.config),{setZoom:A,syncTopviewToolZoom:V}=ee(),{hideAttributes:le,setIsLargeStatus:re,selectedID:ae,pointCloudBoxList:ce}=e,{addPolygon:de,deletePolygon:ue}=Re(),{deletePointCloudSphere:pe}=Q(),{deletePointCloudBox:me,changeValidByID:fe}=G(),[N,Ce]=B(10),{t:Z}=ze(),w=Ne(),{pushHistoryWithList:ve}=Me(),[we,D]=B(!0),[H,F]=B(!1);be(()=>{if(!e.topViewInstance&&f.current&&(i==null?void 0:i.url)&&(i==null?void 0:i.result)){const o={width:f.current.clientWidth,height:f.current.clientHeight},a=new Se({container:f.current,size:o,pcdPath:i.url,config:z(U({},C),{pointCloudPattern:e.pointCloudPattern}),checkMode:m,toolName:Fe.getPointCloudToolList(),proxyMode:m});e.setTopViewInstance(a)}},[i]),P(()=>{H&&ae&&(e.syncAllViewPointCloudColor(Y.Single,ce),F(!1))},[H]),P(()=>{if(!d||!e.topViewInstance||!e.sideViewInstance)return;const{toolInstance:o}=e.topViewInstance;o.singleOn("dataUpdated",(t,n)=>{const u=We.cloneDeep(t).map(c=>z(U({},c),{pointList:X.pointListTransferCanvas2World(c.pointList,d)}));e.setSelectedIDs(n),e.setLineList(u),ve({lineList:u})}),o.singleOn("pointCreated",(t,n)=>{w.topViewAddSphere({newPoint:t,size:d,trackConfigurable:C.trackConfigurable,zoom:n})}),o.singleOn("pointDeleted",t=>{pe(t)}),o.singleOn("pointSelected",t=>{e.setSelectedIDs([t])}),o.singleOn("updatePointByDrag",(t,n)=>{var u;(u=w.topViewUpdatePoint)==null||u.call(w,t,d)}),o.singleOn("polygonCreated",(t,n)=>{if(o.pattern===Qe.Normal||!(i==null?void 0:i.url)){const u=z(U({},t),{pointList:t.pointList.map(c=>X.transferCanvas2World(c,d))});de(u),e.setSelectedIDs(le.includes(t.attribute)?"":t.id);return}D(!1),w.topViewAddBox({polygon:t,size:d,imgList:l,trackConfigurable:C.trackConfigurable,zoom:n,intelligentFit:y}),F(!0)}),o.singleOn("deletedObject",({id:t})=>{me(t),ue(t)}),o.singleOn("deleteSelectedIDs",()=>{e.setSelectedIDs([])}),o.singleOn("addSelectedIDs",t=>{e.addSelectedID(t)}),o.singleOn("setSelectedIDs",t=>{D(!1),e.setSelectedIDs(t)}),o.singleOn("updatePolygonByDrag",t=>{var n;(n=w.topViewUpdateBox)==null||n.call(w,t,d)});const a=t=>{var n;const u=fe(t);u&&e.syncAllViewPointCloudColor(Y.Default,u),e.polygonList.find(c=>c.id===t)&&((n=e.topViewInstance)==null||n.toolInstance.setPolygonValidAndRender(t,!0))};return o.on("validUpdate",a),()=>{o.unbind("validUpdate",a)}},[e,d,i,w,e.polygonList,e.lineList,(L=e.topViewInstance)==null?void 0:L.toolInstance]),P(()=>{var o,a;if(!(d==null?void 0:d.width)||!e.topViewInstance)return;const t=(a=(o=C==null?void 0:C.attributeList)==null?void 0:o[0])==null?void 0:a.value;t&&e.topViewInstance.toolInstance.setDefaultAttribute(t),e.topViewInstance.initSize(d),e.topViewInstance.updatePolygonList(e.displayPointCloudList,e.polygonList),e.topViewInstance.updatePointList(e.displaySphereList),e.topViewInstance.updateLineList(e.displayLineList);const{topViewInstance:{pointCloudInstance:n,toolInstance:u}}=e;u.singleOn("renderZoom",(c,p)=>{const{offsetX:S,offsetY:b}=se(p,d,c);if(n.camera.zoom=c,p){const{x:I,y:R,z:k}=n.initCameraPosition;n.camera.position.set(I+b,R-S,k)}n.camera.updateProjectionMatrix(),n.render(),A(c),V(p,c,d),h({zoom:c,currentPos:p})}),u.singleOn("dragMove",({currentPos:c,zoom:p})=>{const{offsetX:S,offsetY:b}=se(c,d,p);n.camera.zoom=p;const{x:I,y:R,z:k}=n.initCameraPosition;n.camera.position.set(I+b,R-S,k),n.render(),V(c,p,d),h({zoom:p,currentPos:c})})},[d,e.topViewInstance,(T=e.topViewInstance)==null?void 0:T.toolInstance]),P(()=>{var o,a;(a=(o=e.topViewInstance)==null?void 0:o.pointCloudInstance)==null||a.applyZAxisPoints(N)},[N]),P(()=>{var o,a,t,n;w.topViewSelectedChanged({}),(n=(t=(a=(o=e.topViewInstance)==null?void 0:o.toolInstance)==null?void 0:a.selection)==null?void 0:t.hardSetSelectedIDs)==null||n.call(t,e.selectedIDs)},[e.selectedIDs]),P(()=>{const{topViewInstance:o,selectedID:a,selectedPointCloudBox:t,zoom:n}=e;if(!o||!a||!t||!we){D(!0);return}const{center:u}=t,{pointCloudInstance:c,toolInstance:p}=o,S=p.polygonList.find(ge=>ge.id===e.selectedID);if(!S){D(!0);return}const b=M.getRectCenterPoint(S.pointList),I=M.getCurrentPosFromRectCenter(p.size,b,n);p.setCurrentPos(I),p.render();const{x:R,y:k,z:Pe}=c.initCameraPosition;c.camera.position.set(u.x,u.y,Pe),c.render(),V(I,n,d),h({zoom:n,currentPos:I})},[e.selectedID]),P(()=>(window.addEventListener("keydown",W),()=>{window.removeEventListener("keydown",W)}),[]);const W=o=>{const{keyCode:a}=o;a===et.Esc&&j()};return P(()=>{var o,a,t;(t=(a=(o=e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null?void 0:a.setHighlightAttribute)==null||t.call(a,E)},[e.topViewInstance,E]),s.createElement(Te,{className:_("point-cloud-container","top-view"),title:O?s.createElement("div",{style:{display:"flex",alignItems:"center",position:"relative"}},s.createElement(ye,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{j()}}),s.createElement("span",null,Z("TopView")),s.createElement(J,{checkMode:m,config:C,style:{display:"flex",position:"initial",margin:"0px 20px"}})):s.createElement(Xe,{title:Z("TopView"),onClick:()=>{re(!0),x(!0)}}),toolbar:s.createElement(tt,{currentData:i})},s.createElement("div",{style:{position:"relative",flex:1}},s.createElement("div",{style:{width:"100%",height:"100%"},ref:f},v==null?void 0:v(g)),!O&&s.createElement(J,{checkMode:m,config:C}),s.createElement(ot,{checkMode:m,zAxisLimit:N,setZAxisLimit:Ce}),s.createElement(De,null)))};var it=Ae(Be,null,null,{context:Ze})(nt);export{it as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{BatchUpdateResultByTrackID as q}from"../../../../store/annotation/actionCreators.js";import{LabelBeeContext as V,useDispatch as N}from"../../../../store/ctx.js";import{Form as o,Modal as $,InputNumber as C,Radio as O,Select as v,Popover as G,message as H}from"antd";import e,{useState as K,useEffect as Q,useCallback as W}from"react";import{useTranslation as k}from"react-i18next";import{QuestionCircleOutlined as J}from"@ant-design/icons";import{PointCloudUtils as D}from"@labelbee/lb-utils";import{connect as X}from"react-redux";import{useSingleBox as Y}from"../../hooks/useSingleBox.js";import{MathUtils as Z}from"@labelbee/lb-annotation";var ee=Object.defineProperty,te=Object.defineProperties,ne=Object.getOwnPropertyDescriptors,U=Object.getOwnPropertySymbols,re=Object.prototype.hasOwnProperty,ae=Object.prototype.propertyIsEnumerable,j=(r,n,a)=>n in r?ee(r,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[n]=a,B=(r,n)=>{for(var a in n||(n={}))re.call(n,a)&&j(r,a,n[a]);if(U)for(var a of U(n))ae.call(n,a)&&j(r,a,n[a]);return r},le=(r,n)=>te(r,ne(n));const ie={labelCol:{span:8},wrapperCol:{span:16}},z=[{required:!0,message:"\u8BF7\u586B\u5199\u4E00\u4E2A\u6570\u5B57"}],ue=[{required:!0,message:"\u8BF7\u9009\u62E9\u4E3B\u5C5E\u6027"}],S=2,M=({text:r})=>e.createElement("span",{style:{borderRadius:"4px 0px 0px 4px",padding:"0px 12px",background:"#FAFAFA",border:"1px solid rgb(217 217 217)",borderRight:"0",display:"flex",alignItems:"center",height:32}},r),oe=r=>{const{t:n}=k(),{size:a,isMax:s,selectedBox:m}=r;if(!a||!m)return null;const f={marginRight:16},h=B(B({},m),s&&a),{length:l,width:p,height:E}=D.transferBox2Kitti(h);return e.createElement("div",null,e.createElement("span",{style:f},n("Length"),": ",l.toFixed(S)),e.createElement("span",{style:f},n("Width"),": ",p.toFixed(S)),e.createElement("span",{style:f},n("Height"),": ",E.toFixed(S)),e.createElement(G,{placement:"rightBottom",content:`\u7EDF\u4E00\u5C3A\u5BF8\u4E3A\u8BE5ID\u7684\u6240\u6709\u6807\u6CE8\u6846${s?"\u4E2D\u6700\u5927\u7684\u5C3A\u5BF8":"\u4EE5\u5F53\u524D\u5E27\u6846\u5C3A\u5BF8\u4E3A\u6807\u51C6"}`},e.createElement(J,null)))},se=[{value:"current",label:"\u5F53\u524D\u5E27\u5C3A\u5BF8"},{value:"max",label:"\u6700\u5927\u5C3A\u5BF8"}],ce=({id:r,visible:n,onCancel:a,config:s,imgList:m,imgIndex:f})=>{const h=N(),{selectedBox:l}=Y(),[p,E]=K(),[g]=o.useForm(),{t:c}=k();Q(()=>{n===!1?(g.resetFields(),E(void 0)):F()},[n]);const R=t=>{var i,u,d,y;if(!r)return;if(!p){H.info("\u8BE5\u8303\u56F4\u4E0D\u5B58\u5728\u66F4\u6539\u6570\u636E, \u8BF7\u66F4\u6539\u7EDF\u4E00\u8303\u56F4");return}const b={attribute:t.attribute};if(s.secondaryAttributeConfigurable){const _={};(i=s.inputList)==null||i.forEach(w=>{const x=t[w.value];if(x!==void 0){const T=Array.isArray(x)?x.join(";"):x;Object.assign(_,{[w.value]:T})}}),Object.keys(_).length>0&&Object.assign(b,{subAttribute:_})}const{UnifySize:P}=t;Object.assign(b,p&&P==="max"?p:{width:(u=l==null?void 0:l.info)==null?void 0:u.width,height:(d=l==null?void 0:l.info)==null?void 0:d.height,depth:(y=l==null?void 0:l.info)==null?void 0:y.depth}),h(q(r,b,[t.prevPage-1,t.nextPage-1],m)),a()},F=W(()=>{var t;const{prevPage:i,nextPage:u}=g.getFieldsValue(["prevPage","nextPage"]),d=m.filter((b,P)=>Z.isInRange(P,[i-1,u-1]));if(!((d==null?void 0:d.length)>0)||!(l==null?void 0:l.info)||((t=l==null?void 0:l.info)==null?void 0:t.trackID)===void 0){E(void 0);return}const y=D.getMaxSizeFromBox({trackID:l.info.trackID,imgList:d});E(y)},[m,l,f]),L=()=>g.submit(),A={width:"200px"},I={marginBottom:"24px",display:"flex",alignItems:"center"};return e.createElement($,{title:c("UnifyParams"),visible:n,onCancel:a,onOk:L,wrapClassName:"labelbee-custom-modal"},e.createElement(e.Fragment,null,e.createElement("div",{style:{marginBottom:"20px",color:"#f00"}},c("UnifyParamsTips")),e.createElement(o,le(B({},ie),{form:g,onFinish:R}),e.createElement(o.Item,{name:"id",label:c("UnifyTrackID")},r),e.createElement(o.Item,{label:c("UnifyAttributeRange"),required:!0},e.createElement(o.Item,{style:{display:"inline-block"},rules:z,name:"prevPage",noStyle:!0,initialValue:1},e.createElement(C,{precision:0,min:1,style:{width:"80px"},onChange:()=>F()})),e.createElement("span",{style:{display:"inline-block",width:"24px",textAlign:"center"}},"-"),e.createElement(o.Item,{style:{display:"inline-block"},rules:z,name:"nextPage",noStyle:!0,initialValue:m.length},e.createElement(C,{precision:0,min:1,style:{width:"80px"},onChange:()=>F()})),e.createElement("span",{style:{display:"inline-block",width:"40x",marginLeft:"10px",textAlign:"center"}},c("Page"))),e.createElement(o.Item,{name:"UnifySize",label:c("UnifySize"),required:!0,initialValue:"current"},e.createElement(O.Group,{onChange:t=>{g.setFieldValue("UnifySize",t.target.value)}},se.map(t=>{const{value:i,label:u}=t;return e.createElement(O,{value:i,key:i},e.createElement("div",null,u),e.createElement(oe,{selectedBox:l==null?void 0:l.info,size:p,isMax:i==="max"}))}))),e.createElement(o.Item,{label:c("UnifyTag"),required:!0},e.createElement("div",{style:I},e.createElement(M,{text:c("Attribute")}),e.createElement(o.Item,{name:"attribute",noStyle:!0,rules:ue},e.createElement(v,{style:A},s.attributeList.map(t=>e.createElement(v.Option,{key:t.value,value:t.value},t.key))))),s.secondaryAttributeConfigurable&&s.inputList.map(t=>{var i;return e.createElement("div",{key:t.value,style:I},e.createElement(M,{text:t.key}),e.createElement(o.Item,{name:t.value,noStyle:!0,required:!1},e.createElement(v,{style:A,mode:t.isMulti?"multiple":void 0},(i=t.subSelected)==null?void 0:i.map(u=>e.createElement(v.Option,{key:u.value,value:u.value},u.key)))))})))))},me=r=>({imgIndex:r.annotation.imgIndex});var pe=X(me,null,null,{context:V})(ce);export{pe as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useContext as j}from"react";import{PointCloudContext as v}from"../PointCloudContext.js";import{useUpdatePointCloudColor as O}from"./useUpdatePointCloudColor.js";import{useAttribute as g}from"./useAttribute.js";import{usePolygon as w}from"./usePolygon.js";import{useLine as S}from"./useLine.js";import{useSphere as c}from"./useSphere.js";import{useHistory as b}from"./useHistory.js";import{usePointCloudViews as V}from"./usePointCloudViews.js";var U=Object.defineProperty,x=Object.defineProperties,L=Object.getOwnPropertyDescriptors,P=Object.getOwnPropertySymbols,H=Object.prototype.hasOwnProperty,I=Object.prototype.propertyIsEnumerable,m=(o,e,t)=>e in o?U(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,n=(o,e)=>{for(var t in e||(e={}))H.call(e,t)&&m(o,t,e[t]);if(P)for(var t of P(e))I.call(e,t)&&m(o,t,e[t]);return o},i=(o,e)=>x(o,L(e));const A=(o,e)=>{const{updatePointCloudColor:t}=O(o,e),{syncThreeViewsAttribute:f}=g(),{selectedPolygon:p}=w(),{selectedLine:u}=S(),{selectedSphere:s}=c(),{updatePointCloudSphere:C}=c(),{pushHistoryUnderUpdatePolygon:_,pushHistoryUnderUpdateLine:y}=b(),{topViewSelectedChanged:h}=V(),a=j(v);return{updatePointCloudAttribute:r=>{var l;if(f(r),t(r),p&&_(i(n({},p),{attribute:r})),u&&y(i(n({},u),{attribute:r})),s){const d=C(i(n({},s),{attribute:r}));a.mainViewInstance&&((l=a.mainViewInstance)==null||l.generateSpheres(d),h({newSelectedSphere:s,newSphereList:d}))}}}};export{A as usePointCloudAttribute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{EPointCloudName as st,TagUtils as oo,MathUtils as w,getCuboidFromPointCloudBox as eo}from"@labelbee/lb-annotation";import{EPerspectiveView as X,PointCloudUtils as O,POINT_CLOUD_DEFAULT_STEP as no,DEFAULT_SPHERE_PARAMS as io}from"@labelbee/lb-utils";import{useContext as mt,useCallback as xt}from"react";import{PointCloudContext as ht}from"../PointCloudContext.js";import{useSingleBox as so}from"./useSingleBox.js";import{useSphere as ro}from"./useSphere.js";import{pick as lo}from"lodash";import{useSelector as ao,useDispatch as co}from"../../../store/ctx.js";import uo from"../../../utils/StepUtils.js";import{EPointCloudBoxRenderTrigger as rt}from"../../../utils/ToolPointCloudBoxRenderHelper.js";import{jsonParser as lt,generatePointCloudBoxRects as po}from"../../../utils/index.js";import{PreDataProcess as dt,SetAnnotationLoading as Lt,SetLoadPCDFileLoading as vt}from"../../../store/annotation/actionCreators.js";import{useHistory as go}from"./useHistory.js";import{usePolygon as fo}from"./usePolygon.js";import{useLatest as $}from"ahooks";var Co=Object.defineProperty,Po=Object.defineProperties,mo=Object.getOwnPropertyDescriptors,yt=Object.getOwnPropertySymbols,xo=Object.prototype.hasOwnProperty,ho=Object.prototype.propertyIsEnumerable,Bt=(e,n,t)=>n in e?Co(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,L=(e,n)=>{for(var t in n||(n={}))xo.call(n,t)&&Bt(e,t,n[t]);if(yt)for(var t of yt(n))ho.call(n,t)&&Bt(e,t,n[t]);return e},A=(e,n)=>Po(e,mo(n)),bt=(e,n,t)=>new Promise((c,p)=>{var o=d=>{try{u(t.next(d))}catch(x){p(x)}},f=d=>{try{u(t.throw(d))}catch(x){p(x)}},u=d=>d.done?c(d.value):Promise.resolve(d.value).then(o,f);u((t=t.apply(e,n)).next())});const tt=5,ot=90,wt=.01,y={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},at=(e,n,t,c,p)=>{const{x:o,y:f}=O.transferCanvas2World(e,n),{defaultZ:u}=io,d={center:{x:o,y:f,z:u},id:e.id},x=c?L(L({},c),d):A(L({},d),{attribute:"",valid:!0});return p&&Object.assign(x,p),x},ct=(e,n,t,c,p,o)=>{let f=e.pointList.map(I=>O.transferCanvas2World(I,n)),u=0,d=1,x={};if(t){const I=t.getSensesPointZAxisInPolygon(f,void 0,o);o&&I.fittedCoordinates.length>0&&(f=I.fittedCoordinates),u=(I.maxZ+I.minZ)/2,d=I.maxZ-I.minZ,x={count:I.zCount}}const[P,v,T]=f,V=w.getLineCenterPoint([P,T]),D=w.getLineLength(P,v),U=w.getLineLength(v,T),N=w.getRadiusFromQuadrangle(e.pointList);c&&(u=c.center.z,d=c.depth);const z={center:{x:V.x,y:V.y,z:u},width:o?U+wt:U,height:o?D+wt:D,depth:d,rotation:N,id:e.id},j=L(c?L(L({},c),z):A(L({},z),{attribute:"",valid:!0}),x);p&&Object.assign(j,p);const M=f.map(I=>O.transferWorld2Canvas(I,n));return{boxParams:j,newPointList:M}},It=(e,n,t)=>{const c={x:e.x-n.x,y:e.y-n.y};return A(L({},t),{center:{x:t.center.x-c.x,y:t.center.y,z:t.center.z-c.y}})},Dt=(e,n,t,c)=>{const[p,o,f]=e.pointList,[u,d,x]=n.pointList,P=w.getLineCenterPoint([p,f]),v=w.getLineCenterPoint([u,x]),V={x:{x:P.x-v.x,y:P.y-v.y}.x,y:0,z:P.y-v.y},D=w.getLineLength(p,o),U=w.getLineLength(u,d),N=D-U,z=w.getLineLength(o,f),j=w.getLineLength(d,x),M=z-j,{newBoxParams:I}=c.getNewBoxBySideUpdate(V,M,N,t);return I},Lo=(e,n,t)=>{const c={x:e.x-n.x,y:e.y-n.y};return A(L({},t),{center:{x:t.center.x,y:t.center.y-c.x,z:t.center.z-c.y}})},vo=(e,n,t,c)=>{const[p,o,f]=e.pointList,[u,d,x]=n.pointList,P=w.getLineCenterPoint([p,f]),v=w.getLineCenterPoint([u,x]),V={x:{x:P.x-v.x,y:P.y-v.y}.x,y:0,z:P.y-v.y},D=w.getLineLength(p,o),U=w.getLineLength(u,d),N=D-U,z=w.getLineLength(o,f),j=w.getLineLength(d,x),M=z-j;let{newBoxParams:I}=c.getNewBoxByBackUpdate(V,M,N,t);return I},St=(e,n,t,c,p)=>{var o;if(!t)return;const{toolInstance:f,pointCloudInstance:u}=t;u.loadPCDFile(c,(o=p==null?void 0:p.radius)!=null?o:ot);const{cameraPositionVector:d}=u.updateOrthoCameraBySphere(e,X.Left);u.setInitCameraPosition(d);const{point2d:x,zoom:P}=u.getSphereSidePoint2DCoordinate(e);u.camera.zoom=P,u.camera.updateProjectionMatrix(),u.render(),f.initPosition(),f.zoomChangeOnCenter(P),f.setResult([A(L(L({},n),x),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),f.setSelectedID(n.id)},Rt=(e,n,t,c)=>{if(!t)return;const{pointCloud2dOperation:p,pointCloudInstance:o}=t;o.loadPCDFileByBox(c,e,{width:tt,depth:tt});const{cameraPositionVector:f}=o.updateOrthoCamera(e,X.Left);o.setInitCameraPosition(f);const{polygon2d:u,zoom:d}=o.getBoxSidePolygon2DCoordinate(e);o.camera.zoom=d,o.camera.updateProjectionMatrix(),o.render(),p.initPosition(),p.zoomChangeOnCenter(d),p.setResultAndSelectedID([{id:n.id,valid:e.valid,pointList:u,textAttribute:"",isRect:!0,attribute:e.attribute}],n.id)},_t=(e,n,t,c,p)=>{var o;if(!t)return;const{toolInstance:f,pointCloudInstance:u}=t;u.loadPCDFile(c,(o=p==null?void 0:p.radius)!=null?o:ot);const{cameraPositionVector:d}=u.updateOrthoCameraBySphere(e,X.Back);u.setInitCameraPosition(d);const{point2d:x,zoom:P}=u.getSphereBackPoint2DCoordinate(e);u.camera.zoom=P,u.camera.updateProjectionMatrix(),u.render(),f.initPosition(),f.zoomChangeOnCenter(P),f.setResult([A(L(L({},n),x),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),f.setSelectedID(n.id)},Vt=(e,n,t,c)=>{if(!t)return;const{pointCloud2dOperation:p,pointCloudInstance:o}=t;o.loadPCDFileByBox(c,e,{height:tt,depth:tt});const{cameraPositionVector:f}=o.updateOrthoCamera(e,X.Back);o.setInitCameraPosition(f);const{polygon2d:u,zoom:d}=o.getBoxBackPolygon2DCoordinate(e);o.camera.zoom=d,o.camera.updateProjectionMatrix(),o.render(),p.initPosition(),p.zoomChangeOnCenter(d),p.setResultAndSelectedID([{id:n.id,valid:e.valid,pointList:u,textAttribute:"",isRect:!0,attribute:e.attribute}],n.id)},kt=(e,n,t,c)=>{if(!t||!c)return;c.generateSphere(e),c.updateCameraBySphere(e,X.Top),c.render();const{toolInstance:p,pointCloudInstance:o}=t,{point2d:f}=o.getSphereTopPoint2DCoordinate(e),u=[...p.pointList].map(d=>d.id===n.id?A(L(L({},n),f),{valid:e.valid,textAttribute:"",attribute:e.attribute}):d);p.setResult(u),p.setSelectedID(n.id)},ut=(e,n,t,c)=>{var p,o;if(!t||!c)return;c.generateBox(e),c.render();const{pointCloud2dOperation:f,pointCloudInstance:u}=t,{polygon2d:d}=u.getBoxTopPolygon2DCoordinate(e),x=[...f.polygonList],P=x.find(v=>v.id===n.id);P?(P.pointList=d,P.valid=(p=e.valid)!=null?p:!0):x.push({id:n.id,pointList:d,textAttribute:"",isRect:!0,valid:(o=e.valid)!=null?o:!0}),f.setResultAndSelectedID(x,n.id)},yo=e=>{const n=mt(ht),{topViewInstance:t,sideViewInstance:c,backViewInstance:p,mainViewInstance:o,addPointCloudBox:f,addPointCloudSphere:u,setSelectedIDs:d,selectedIDs:x,pointCloudBoxList:P,pointCloudSphereList:v,hideAttributes:T,setHighlight2DDataList:V,cuboidBoxIn2DView:D,imageSizes:U,history:N,linkageImageNameRectMap:z}=n,{addHistory:j,initHistory:M,pushHistoryUnderUpdatePolygon:I}=go(),{selectedPolygon:Ot}=fo(),{getPointCloudSphereByID:At,updatePointCloudSphere:pt,selectedSphere:Y}=ro(),{currentData:H,config:B}=ao(s=>{const{stepList:i,step:a,imgList:r,imgIndex:l}=s.annotation;return{currentData:r[l],config:lt(uo.getCurrentStepInfo(a,i).config)}}),F=co(),Tt=$(D),Ut=$(z),zt=xt((s,i)=>{const a=Ut.current,r=i.id;return s.filter(g=>{if(!g)return!1;const C=a.get(g.imageName);return C===void 0?!0:Boolean(C.get(r))})},[]),et=s=>{const{enableAutoMap2DRect:i=!1}=B;if(!Tt.current||i){const{mappingImgList:a=[]}=H;po({pointCloudBox:s,mappingImgList:a,imageSizes:U},{prepareRectsFn:zt})}},{selectedBox:k,updateSelectedBox:Nt,updateSelectedBoxes:nt,getPointCloudByID:jt}=so({generateRects:et}),gt=k==null?void 0:k.info;if(!t||!c||!p)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:it}=t,Et=s=>{o==null||o.generateSphere(s),o==null||o.controls.update(),o==null||o.render()},Mt=({newPoint:s,size:i,zoom:a,trackConfigurable:r})=>{var l;const g={attribute:(l=t.toolInstance.defaultAttribute)!=null?l:""};r===!0&&Object.assign(g,{trackID:O.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:v})});const C=at(s,i,it,void 0,g);d(s.id);const m=u(C);G(y.Top,s,C,a,m,B),j({newSphereParams:C})},Ft=({polygon:s,size:i,imgList:a,trackConfigurable:r,zoom:l,intelligentFit:g})=>{var C,m,b;const S={attribute:(C=t.toolInstance.defaultAttribute)!=null?C:""};r===!0&&Object.assign(S,{trackID:O.getNextTrackID({imgList:[],extraBoxList:P,extraSphereList:v})});const _=t==null?void 0:t.toolInstance,R=L({},s);let{boxParams:h,newPointList:E}=ct(R,i,it,void 0,S,g);h=F(dt({tool:st.PointCloud,dataList:[h],stepConfig:B,action:"viewUpdateBox"}))[0],g&&(E==null?void 0:E.length)&&(R.pointList=E);const Z=T.includes(R.attribute);et(h);const Q=f(h),q=(m=n==null?void 0:n.polygonList)!=null?m:[];h.subAttribute=oo.getDefaultResultByConfig((B==null?void 0:B.secondaryAttributeConfigurable)?(b=B==null?void 0:B.inputList)!=null?b:[]:[]),t==null||t.updatePolygonList(Q!=null?Q:[],q),Z?d([]):(d(h.id),_.selection.setSelectedIDs(R.id),W({omitView:y.Top,polygon:R,boxParams:h,zoom:l,newPointCloudBoxList:Q}),g&&ut(h,R,t,o)),j({newBoxParams:h})},Ht=s=>{const{boxID:i,imageName:a,width:r,height:l,x:g,y:C}=s,m=P.find(h=>h.id===i);if(!(m==null?void 0:m.rects)||!m.rects.find(h=>h.imageName===a))return;const S=m.rects.map(h=>h.imageName===a?A(L({},h),{width:r,height:l,x:g,y:C}):h),_=A(L({},m),{rects:S}),R=P.map(h=>h.id===i?_:h);return t==null||t.updatePolygonList(R!=null?R:[]),R},Wt=s=>{const{boxID:i,imageName:a}=s,r=P.find(m=>m.id===i);if(!(r==null?void 0:r.rects))return;const l=r.rects.filter(m=>m.imageName!==a),g=A(L({},r),{rects:l}),C=P.map(m=>m.id===i?g:m);return t==null||t.updatePolygonList(C!=null?C:[]),C},Zt=({newSelectedBox:s,newPointCloudList:i,newSelectedSphere:a,newSphereList:r})=>{var l;const g=t==null?void 0:t.toolInstance;if(!(x.length===0||!g)){if(s||(k==null?void 0:k.info)){const C=s!=null?s:k==null?void 0:k.info;(l=g==null?void 0:g.selection)==null||l.setSelectedIDs(x[0]);const m=g.selectedPolygon;if(x.length===1&&C){W({omitView:y.Top,polygon:m,boxParams:C,newPointCloudBoxList:i});return}}if((a||Y)&&x.length===1){const C=a!=null?a:Y;g.setSelectedID(x[0]);const m=g.selectedPoint;C&&G(y.Top,m,C,void 0,r,B)}}},ft=(s,i,a)=>{if(gt){let r,l;switch(a){case y.Back:r=vo;break;case y.Side:r=Dt;break;default:r=Dt;break}if(l=r(s,i,gt,c.pointCloudInstance),o){const{count:S}=o.getSensesPointZAxisInPolygon(eo(l).polygonPointList,[l.center.z-l.depth/2,l.center.z+l.depth/2]);l=A(L({},l),{count:S})}const C=F(dt({tool:st.PointCloud,dataList:[l],stepConfig:B,action:"viewUpdateBox"}))[0],m=l.valid!==C.valid;l=C;const b=Nt(l);return l=b.find(S=>S.id===l.id),W({omitView:m?void 0:a,polygon:s,boxParams:l,newPointCloudBoxList:b}),b}},Ct=(s,i,a)=>{if(Y){let r,l;switch(a){case y.Back:r=Lo;break;case y.Side:r=It;break;default:r=It;break}l=r(s,i,Y);const g=pt(l);return G(a,s,l,void 0,g,B),g}},Gt=(s,i)=>{Ct(s,i,y.Side)},Jt=(s,i)=>{Ct(s,i,y.Back)},Qt=(s,i)=>{ft(s,i,y.Side)},Xt=(s,i)=>{ft(s,i,y.Back)},Yt=(s,i)=>{const a=At(s.id),r=at(s,i,it,a),l=pt(r);G(y.Top,s,r,void 0,l,B)},qt=(s,i)=>{if(Ot){const r=L({},s[0].newPolygon);r.pointList=r.pointList.map(l=>O.transferCanvas2World(l,i)),I(r);return}let a=s.map(({newPolygon:r})=>{const l=jt(r.id),{boxParams:g}=ct(r,i,t.pointCloudInstance,l);return g});if(a=F(dt({tool:st.PointCloud,dataList:a,stepConfig:B,action:"viewUpdateBox"})),a.length===1){const{newPolygon:r}=s[0],l=nt(a);W({polygon:r,boxParams:a[0],newPointCloudBoxList:l})}else{const r=nt(a);r&&n.syncAllViewPointCloudColor(rt.MultiMove,r)}},Kt=s=>{var i,a,r,l,g;if(k){const C=Number(s.widthDefault),m=Number(s.depthDefault),b=Number(s.heightDefault),S=k==null?void 0:k.info.trackID,R=((i=t==null?void 0:t.toolInstance)==null?void 0:i.polygonList).find(K=>(K==null?void 0:K.trackID)===S),h={width:(r=(a=t==null?void 0:t.toolInstance)==null?void 0:a.basicImgInfo)==null?void 0:r.width,height:(g=(l=t==null?void 0:t.toolInstance)==null?void 0:l.basicImgInfo)==null?void 0:g.height},E=R.pointList.map(K=>O.transferCanvas2World(K,h)),J=w.getModifiedRectangleCoordinates(E,b,C),Z=J[0],Q=J[2],q=w.getLineCenterPoint([Z,Q]),$t=k.info.center.z-k.info.depth/2,Pt=A(L({},k.info),{center:{x:q.x,y:q.y,z:$t+m/2},width:C,height:b,depth:m,valid:!0}),to=nt([Pt]);W({omitView:y["3D"],polygon:R,boxParams:Pt,newPointCloudBoxList:to})}},G=(s,i,a,r,l,g)=>bt(void 0,null,function*(){const C=H==null?void 0:H.url,m={[y.Side]:()=>{St(a,i,c,C,g)},[y.Back]:()=>{p&&_t(a,i,p,C,g)},[y.Top]:()=>{kt(a,i,t,o)}};Object.keys(m).forEach(b=>{b!==s&&m[b]()}),r&&(o==null||o.updateCameraZoom(r)),Et(a)}),W=(s,i=rt.Default)=>{const{omitView:a,polygon:r,boxParams:l,zoom:g,newPointCloudBoxList:C}=s,m=H==null?void 0:H.url;C&&n.syncAllViewPointCloudColor(i,C);const b={[y.Side]:()=>{Rt(l,r,c,m)},[y.Back]:()=>{p&&Vt(l,r,p,m)},[y.Top]:()=>{ut(l,r,t,o)}};Object.keys(b).forEach(S=>{S!==a&&b[S]()}),g&&(o==null||o.updateCameraZoom(g))};return{topViewAddSphere:Mt,topViewAddBox:Ft,topViewSelectedChanged:Zt,topViewUpdatePoint:Yt,sideViewUpdatePoint:Gt,backViewUpdatePoint:Jt,topViewUpdateBox:qt,sideViewUpdateBox:Qt,backViewUpdateBox:Xt,syncPointCloudViews:W,syncPointCloudPoint:G,pointCloudBoxListUpdated:s=>{t.updatePolygonList(s),o==null||o.generateBoxes(s)},initPointCloud3d:s=>{if(!o)return;const i=O.getDefaultOrthographicParams(s);o.initOrthographicCamera(i),o.initRenderer(),o.render()},updatePointCloudData:(...s)=>bt(void 0,[...s],function*(i=H){var a,r,l,g,C,m,b,S;if(!(i==null?void 0:i.url)||!o)return;V([]),Lt(F,!0),vt(F,!0),(a=e==null?void 0:e.setResourceLoading)==null||a.call(e,!0),yield o.loadPCDFile(i.url,(r=B==null?void 0:B.radius)!=null?r:ot),o==null||o.clearAllBox(),o==null||o.clearAllSphere();let _=[],R=[],h=[],E=[];o.updateTopCamera();const J=(g=(l=lt(i.result))==null?void 0:l.valid)!=null?g:!0;if(n.setPointCloudValid(J),(C=n.sideViewInstance)==null||C.clearAllData(),(m=n.backViewInstance)==null||m.clearAllData(),i.result){if(_=O.getBoxParamsFromResultList(i.result),(_==null?void 0:_.length)>0&&i.isPreResult&&(B==null?void 0:B.lowerLimitPointsNumInBox)>0){_=yield o==null?void 0:o.filterPreResult(i.url,B,_);const Z=lt(i.result);Z[no].result=_,i.result=JSON.stringify(Z),n.setPointCloudResult(_)}h=O.getPolygonListFromResultList(i.result),R=O.getLineListFromResultList(i.result),E=O.getSphereParamsFromResultList(i.result),t.updateData(i.url,i.result,{radius:(b=B==null?void 0:B.radius)!=null?b:ot}),o==null||o.generateBoxes(_),o==null||o.generateSpheres(E),yield n.syncAllViewPointCloudColor(rt.Default,_,[])}M({pointCloudBoxList:_,polygonList:h,lineList:R,pointCloudSphereList:E}),Lt(F,!1),vt(F,!1),(S=e==null?void 0:e.setResourceLoading)==null||S.call(e,!1)}),updateViewsByDefaultSize:Kt,generateRects:et,update2DViewRect:Ht,remove2DViewRect:Wt}},Bo=()=>{const{pointCloudBoxList:e,rectList:n,setPointCloudResult:t}=mt(ht),c=$(e),p=$(n);return{syncToPointCloudBoxList:xt(()=>{const f=c.current,u=p.current;if(u.length===0)return null;const d=new Map,x=new Set;if(u.filter(P=>P.extId!==void 0).forEach(P=>{const v=P.extId,T=P.imageName,V=lo(P,["x","y","width","height"]);let D=d.get(v);D||(D=new Map,d.set(v,D)),D.set(T,V),x.add(v)}),d.size){const P=f.map(v=>{var T;const V=v.id;if(x.has(V)){const D=L({},v);return(T=D.rects)==null||T.forEach(U=>{var N;const z=U.imageName;Object.assign(U,(N=d.get(V))==null?void 0:N.get(z))}),D}return v});return t(P),P}return null},[])}};export{_t as syncBackViewByPoint,St as syncSideViewByPoint,kt as syncTopViewByPoint,Vt as synchronizeBackView,Rt as synchronizeSideView,ut as synchronizeTopView,at as topViewPoint2PointCloud,ct as topViewPolygon2PointCloud,yo as usePointCloudViews,Bo as useSyncRectPositionDimensionToPointCloudList};
|
|
1
|
+
import{EPointCloudName as st,TagUtils as oo,MathUtils as w,getCuboidFromPointCloudBox as eo}from"@labelbee/lb-annotation";import{EPerspectiveView as X,PointCloudUtils as O,POINT_CLOUD_DEFAULT_STEP as no,DEFAULT_SPHERE_PARAMS as io}from"@labelbee/lb-utils";import{useContext as mt,useCallback as ht}from"react";import{PointCloudContext as xt}from"../PointCloudContext.js";import{useSingleBox as so}from"./useSingleBox.js";import{useSphere as ro}from"./useSphere.js";import{pick as lo}from"lodash";import{useSelector as ao,useDispatch as co}from"../../../store/ctx.js";import uo from"../../../utils/StepUtils.js";import{EPointCloudBoxRenderTrigger as F}from"../../../utils/ToolPointCloudBoxRenderHelper.js";import{jsonParser as rt,generatePointCloudBoxRects as po}from"../../../utils/index.js";import{PreDataProcess as lt,SetAnnotationLoading as Lt,SetLoadPCDFileLoading as vt}from"../../../store/annotation/actionCreators.js";import{useHistory as go}from"./useHistory.js";import{usePolygon as fo}from"./usePolygon.js";import{useLatest as K}from"ahooks";var Co=Object.defineProperty,Po=Object.defineProperties,mo=Object.getOwnPropertyDescriptors,yt=Object.getOwnPropertySymbols,ho=Object.prototype.hasOwnProperty,xo=Object.prototype.propertyIsEnumerable,Bt=(e,n,t)=>n in e?Co(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,x=(e,n)=>{for(var t in n||(n={}))ho.call(n,t)&&Bt(e,t,n[t]);if(yt)for(var t of yt(n))xo.call(n,t)&&Bt(e,t,n[t]);return e},A=(e,n)=>Po(e,mo(n)),bt=(e,n,t)=>new Promise((d,p)=>{var o=a=>{try{u(t.next(a))}catch(h){p(h)}},f=a=>{try{u(t.throw(a))}catch(h){p(h)}},u=a=>a.done?d(a.value):Promise.resolve(a.value).then(o,f);u((t=t.apply(e,n)).next())});const $=5,tt=90,It=.01,b={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},dt=(e,n,t,d,p)=>{const{x:o,y:f}=O.transferCanvas2World(e,n),{defaultZ:u}=io,a={center:{x:o,y:f,z:u},id:e.id},h=d?x(x({},d),a):A(x({},a),{attribute:"",valid:!0});return p&&Object.assign(h,p),h},at=(e,n,t,d,p,o)=>{let f=e.pointList.map(D=>O.transferCanvas2World(D,n)),u=0,a=1,h={};if(t){const D=t.getSensesPointZAxisInPolygon(f,void 0,o);o&&D.fittedCoordinates.length>0&&(f=D.fittedCoordinates),u=(D.maxZ+D.minZ)/2,a=D.maxZ-D.minZ,h={count:D.zCount}}const[P,L,T]=f,V=w.getLineCenterPoint([P,T]),R=w.getLineLength(P,L),U=w.getLineLength(L,T),N=w.getRadiusFromQuadrangle(e.pointList);d&&(u=d.center.z,a=d.depth);const z={center:{x:V.x,y:V.y,z:u},width:o?U+It:U,height:o?R+It:R,depth:a,rotation:N,id:e.id},j=x(d?x(x({},d),z):A(x({},z),{attribute:"",valid:!0}),h);p&&Object.assign(j,p);const E=f.map(D=>O.transferWorld2Canvas(D,n));return{boxParams:j,newPointList:E}},wt=(e,n,t)=>{const d={x:e.x-n.x,y:e.y-n.y};return A(x({},t),{center:{x:t.center.x-d.x,y:t.center.y,z:t.center.z-d.y}})},Dt=(e,n,t,d)=>{const[p,o,f]=e.pointList,[u,a,h]=n.pointList,P=w.getLineCenterPoint([p,f]),L=w.getLineCenterPoint([u,h]),V={x:{x:P.x-L.x,y:P.y-L.y}.x,y:0,z:P.y-L.y},R=w.getLineLength(p,o),U=w.getLineLength(u,a),N=R-U,z=w.getLineLength(o,f),j=w.getLineLength(a,h),E=z-j,{newBoxParams:D}=d.getNewBoxBySideUpdate(V,E,N,t);return D},Lo=(e,n,t)=>{const d={x:e.x-n.x,y:e.y-n.y};return A(x({},t),{center:{x:t.center.x,y:t.center.y-d.x,z:t.center.z-d.y}})},vo=(e,n,t,d)=>{const[p,o,f]=e.pointList,[u,a,h]=n.pointList,P=w.getLineCenterPoint([p,f]),L=w.getLineCenterPoint([u,h]),V={x:{x:P.x-L.x,y:P.y-L.y}.x,y:0,z:P.y-L.y},R=w.getLineLength(p,o),U=w.getLineLength(u,a),N=R-U,z=w.getLineLength(o,f),j=w.getLineLength(a,h),E=z-j;let{newBoxParams:D}=d.getNewBoxByBackUpdate(V,E,N,t);return D},St=(e,n,t,d,p)=>{var o;if(!t)return;const{toolInstance:f,pointCloudInstance:u}=t;u.loadPCDFile(d,(o=p==null?void 0:p.radius)!=null?o:tt);const{cameraPositionVector:a}=u.updateOrthoCameraBySphere(e,X.Left);u.setInitCameraPosition(a);const{point2d:h,zoom:P}=u.getSphereSidePoint2DCoordinate(e);u.camera.zoom=P,u.camera.updateProjectionMatrix(),u.render(),f.initPosition(),f.zoomChangeOnCenter(P),f.setResult([A(x(x({},n),h),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),f.setSelectedID(n.id)},Rt=(e,n,t,d)=>{if(!t)return;const{pointCloud2dOperation:p,pointCloudInstance:o}=t;o.loadPCDFileByBox(d,e,{width:$,depth:$});const{cameraPositionVector:f}=o.updateOrthoCamera(e,X.Left);o.setInitCameraPosition(f);const{polygon2d:u,zoom:a}=o.getBoxSidePolygon2DCoordinate(e);o.camera.zoom=a,o.camera.updateProjectionMatrix(),o.render(),p.initPosition(),p.zoomChangeOnCenter(a),p.setResultAndSelectedID([{id:n.id,valid:e.valid,pointList:u,textAttribute:"",isRect:!0,attribute:e.attribute}],n.id)},_t=(e,n,t,d,p)=>{var o;if(!t)return;const{toolInstance:f,pointCloudInstance:u}=t;u.loadPCDFile(d,(o=p==null?void 0:p.radius)!=null?o:tt);const{cameraPositionVector:a}=u.updateOrthoCameraBySphere(e,X.Back);u.setInitCameraPosition(a);const{point2d:h,zoom:P}=u.getSphereBackPoint2DCoordinate(e);u.camera.zoom=P,u.camera.updateProjectionMatrix(),u.render(),f.initPosition(),f.zoomChangeOnCenter(P),f.setResult([A(x(x({},n),h),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),f.setSelectedID(n.id)},Vt=(e,n,t,d)=>{if(!t)return;const{pointCloud2dOperation:p,pointCloudInstance:o}=t;o.loadPCDFileByBox(d,e,{height:$,depth:$});const{cameraPositionVector:f}=o.updateOrthoCamera(e,X.Back);o.setInitCameraPosition(f);const{polygon2d:u,zoom:a}=o.getBoxBackPolygon2DCoordinate(e);o.camera.zoom=a,o.camera.updateProjectionMatrix(),o.render(),p.initPosition(),p.zoomChangeOnCenter(a),p.setResultAndSelectedID([{id:n.id,valid:e.valid,pointList:u,textAttribute:"",isRect:!0,attribute:e.attribute}],n.id)},kt=(e,n,t,d)=>{if(!t||!d)return;d.generateSphere(e),d.updateCameraBySphere(e,X.Top),d.render();const{toolInstance:p,pointCloudInstance:o}=t,{point2d:f}=o.getSphereTopPoint2DCoordinate(e),u=[...p.pointList].map(a=>a.id===n.id?A(x(x({},n),f),{valid:e.valid,textAttribute:"",attribute:e.attribute}):a);p.setResult(u),p.setSelectedID(n.id)},ct=(e,n,t,d)=>{var p,o;if(!t||!d)return;d.generateBox(e),d.setHighlightColor(e.id),d.render();const{pointCloud2dOperation:f,pointCloudInstance:u}=t,{polygon2d:a}=u.getBoxTopPolygon2DCoordinate(e),h=[...f.polygonList],P=h.find(L=>L.id===n.id);P?(P.pointList=a,P.valid=(p=e.valid)!=null?p:!0):h.push({id:n.id,pointList:a,textAttribute:"",isRect:!0,valid:(o=e.valid)!=null?o:!0}),f.setResultAndSelectedID(h,n.id)},yo=e=>{const n=mt(xt),{topViewInstance:t,sideViewInstance:d,backViewInstance:p,mainViewInstance:o,addPointCloudBox:f,addPointCloudSphere:u,setSelectedIDs:a,selectedIDs:h,pointCloudBoxList:P,pointCloudSphereList:L,hideAttributes:T,setHighlight2DDataList:V,cuboidBoxIn2DView:R,imageSizes:U,history:N,linkageImageNameRectMap:z}=n,{addHistory:j,initHistory:E,pushHistoryUnderUpdatePolygon:D}=go(),{selectedPolygon:Ot}=fo(),{getPointCloudSphereByID:At,updatePointCloudSphere:ut,selectedSphere:Y}=ro(),{currentData:W,config:y}=ao(s=>{const{stepList:i,step:c,imgList:l,imgIndex:g}=s.annotation;return{currentData:l[g],config:rt(uo.getCurrentStepInfo(c,i).config)}}),M=co(),Tt=K(R),Ut=K(z),zt=ht((s,i)=>{const c=Ut.current,l=i.id;return s.filter(r=>{if(!r)return!1;const m=c.get(r.imageName);return m===void 0?!0:Boolean(m.get(l))})},[]),ot=s=>{const{enableAutoMap2DRect:i=!1}=y;if(!Tt.current||i){const{mappingImgList:c=[]}=W;po({pointCloudBox:s,mappingImgList:c,imageSizes:U},{prepareRectsFn:zt})}},{selectedBox:k,updateSelectedBox:Nt,updateSelectedBoxes:et,getPointCloudByID:jt}=so({generateRects:ot}),pt=k==null?void 0:k.info;if(!t||!d||!p)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:nt}=t,Et=s=>{o==null||o.generateSphere(s),o==null||o.controls.update(),o==null||o.render()},Mt=({newPoint:s,size:i,zoom:c,trackConfigurable:l})=>{var g;const r={attribute:(g=t.toolInstance.defaultAttribute)!=null?g:""};l===!0&&Object.assign(r,{trackID:O.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:L})});const m=dt(s,i,nt,void 0,r);a(s.id);const C=u(m);J(b.Top,s,m,c,C,y),j({newSphereParams:m})},Ht=({polygon:s,size:i,imgList:c,trackConfigurable:l,zoom:g,intelligentFit:r})=>{var m,C,S;const _={attribute:(m=t.toolInstance.defaultAttribute)!=null?m:""};l===!0&&Object.assign(_,{trackID:O.getNextTrackID({imgList:[],extraBoxList:P,extraSphereList:L})}),t==null||t.toolInstance;const v=x({},s);let{boxParams:I,newPointList:B}=at(v,i,nt,void 0,_,r);I=M(lt({tool:st.PointCloud,dataList:[I],stepConfig:y,action:"viewUpdateBox"}))[0],r&&(B==null?void 0:B.length)&&(v.pointList=B);const G=T.includes(v.attribute);ot(I);const H=f(I),it=(C=n==null?void 0:n.polygonList)!=null?C:[];I.subAttribute=oo.getDefaultResultByConfig((y==null?void 0:y.secondaryAttributeConfigurable)?(S=y==null?void 0:y.inputList)!=null?S:[]:[]),t==null||t.updatePolygonList(H!=null?H:[],it),G?a([]):(a(I.id),r&&ct(I,v,t,o)),j({newBoxParams:I})},Ft=s=>{const{boxID:i,imageName:c,width:l,height:g,x:r,y:m}=s,C=P.find(B=>B.id===i);if(!(C==null?void 0:C.rects)||!C.rects.find(B=>B.imageName===c))return;const _=C.rects.map(B=>B.imageName===c?A(x({},B),{width:l,height:g,x:r,y:m}):B),v=A(x({},C),{rects:_}),I=P.map(B=>B.id===i?v:B);return t==null||t.updatePolygonList(I!=null?I:[]),I},Wt=s=>{const{boxID:i,imageName:c}=s,l=P.find(C=>C.id===i);if(!(l==null?void 0:l.rects))return;const g=l.rects.filter(C=>C.imageName!==c),r=A(x({},l),{rects:g}),m=P.map(C=>C.id===i?r:C);return t==null||t.updatePolygonList(m!=null?m:[]),m},Zt=({newSelectedBox:s,newPointCloudList:i,newSelectedSphere:c,newSphereList:l})=>{var g;const r=t==null?void 0:t.toolInstance;if(!(h.length===0||!r)){if(s||(k==null?void 0:k.info)){const m=s!=null?s:k==null?void 0:k.info;(g=r==null?void 0:r.selection)==null||g.setSelectedIDs(h[0]);const C=r.selectedPolygon;if(h.length===1&&m){Q({omitView:b.Top,polygon:C,boxParams:m,newPointCloudBoxList:i});return}}if((c||Y)&&h.length===1){const m=c!=null?c:Y;r.setSelectedID(h[0]);const C=r.selectedPoint;m&&J(b.Top,C,m,void 0,l,y)}}},gt=(s,i,c,l=F.Default)=>{if(pt){let g,r;switch(c){case b.Back:g=vo;break;case b.Side:g=Dt;break;default:g=Dt;break}if(r=g(s,i,pt,d.pointCloudInstance),o){const{count:v}=o.getSensesPointZAxisInPolygon(eo(r).polygonPointList,[r.center.z-r.depth/2,r.center.z+r.depth/2]);r=A(x({},r),{count:v})}const C=M(lt({tool:st.PointCloud,dataList:[r],stepConfig:y,action:"viewUpdateBox"}))[0],S=r.valid!==C.valid;r=C;const _=Nt(r);return r=_.find(v=>v.id===r.id),Q({omitView:S?void 0:c,polygon:s,boxParams:r,newPointCloudBoxList:_},l),_}},ft=(s,i,c)=>{if(Y){let l,g;switch(c){case b.Back:l=Lo;break;case b.Side:l=wt;break;default:l=wt;break}g=l(s,i,Y);const r=ut(g);return J(c,s,g,void 0,r,y),r}},Gt=(s,i)=>{ft(s,i,b.Side)},Jt=(s,i)=>{ft(s,i,b.Back)},Qt=(s,i)=>{gt(s,i,b.Side,F.Single)},Xt=(s,i)=>{gt(s,i,b.Back,F.Single)},Yt=(s,i)=>{const c=At(s.id),l=dt(s,i,nt,c),g=ut(l);J(b.Top,s,l,void 0,g,y)},qt=(s,i)=>{if(Ot){const l=x({},s[0].newPolygon);l.pointList=l.pointList.map(g=>O.transferCanvas2World(g,i)),D(l);return}let c=s.map(({newPolygon:l})=>{const g=jt(l.id),{boxParams:r}=at(l,i,t.pointCloudInstance,g);return r});if(c=M(lt({tool:st.PointCloud,dataList:c,stepConfig:y,action:"viewUpdateBox"})),c.length===1){const{newPolygon:l}=s[0],g=et(c);Q({polygon:l,boxParams:c[0],newPointCloudBoxList:g},F.Single)}else{const l=et(c);l&&n.syncAllViewPointCloudColor(F.MultiMove,l)}},Kt=s=>{var i,c,l,g,r;if(k){const m=Number(s.widthDefault),C=Number(s.depthDefault),S=Number(s.heightDefault),_=k==null?void 0:k.info.trackID,I=((i=t==null?void 0:t.toolInstance)==null?void 0:i.polygonList).find(q=>(q==null?void 0:q.trackID)===_),B={width:(l=(c=t==null?void 0:t.toolInstance)==null?void 0:c.basicImgInfo)==null?void 0:l.width,height:(r=(g=t==null?void 0:t.toolInstance)==null?void 0:g.basicImgInfo)==null?void 0:r.height},Z=I.pointList.map(q=>O.transferCanvas2World(q,B)),G=w.getModifiedRectangleCoordinates(Z,S,m),H=G[0],it=G[2],Ct=w.getLineCenterPoint([H,it]),$t=k.info.center.z-k.info.depth/2,Pt=A(x({},k.info),{center:{x:Ct.x,y:Ct.y,z:$t+C/2},width:m,height:S,depth:C,valid:!0}),to=et([Pt]);Q({omitView:b["3D"],polygon:I,boxParams:Pt,newPointCloudBoxList:to})}},J=(s,i,c,l,g,r)=>bt(void 0,null,function*(){const m=W==null?void 0:W.url,C={[b.Side]:()=>{St(c,i,d,m,r)},[b.Back]:()=>{p&&_t(c,i,p,m,r)},[b.Top]:()=>{kt(c,i,t,o)}};Object.keys(C).forEach(S=>{S!==s&&C[S]()}),l&&(o==null||o.updateCameraZoom(l)),Et(c)}),Q=(s,i=F.Default)=>{const{omitView:c,polygon:l,boxParams:g,zoom:r,newPointCloudBoxList:m}=s,C=W==null?void 0:W.url;m&&n.syncAllViewPointCloudColor(i,m);const S={[b.Side]:()=>{Rt(g,l,d,C)},[b.Back]:()=>{p&&Vt(g,l,p,C)},[b.Top]:()=>{ct(g,l,t,o)}};Object.keys(S).forEach(_=>{_!==c&&S[_]()}),r&&(o==null||o.updateCameraZoom(r))};return{topViewAddSphere:Mt,topViewAddBox:Ht,topViewSelectedChanged:Zt,topViewUpdatePoint:Yt,sideViewUpdatePoint:Gt,backViewUpdatePoint:Jt,topViewUpdateBox:qt,sideViewUpdateBox:Qt,backViewUpdateBox:Xt,syncPointCloudViews:Q,syncPointCloudPoint:J,pointCloudBoxListUpdated:s=>{t.updatePolygonList(s),o==null||o.generateBoxes(s)},initPointCloud3d:s=>{if(!o)return;const i=O.getDefaultOrthographicParams(s);o.initOrthographicCamera(i),o.initRenderer(),o.render()},updatePointCloudData:(...s)=>bt(void 0,[...s],function*(i=W){var c,l,g,r,m,C,S,_;if(!(i==null?void 0:i.url)||!o)return;V([]),Lt(M,!0),vt(M,!0),(c=e==null?void 0:e.setResourceLoading)==null||c.call(e,!0),yield o.loadPCDFile(i.url,(l=y==null?void 0:y.radius)!=null?l:tt),o==null||o.clearAllBox(),o==null||o.clearAllSphere();let v=[],I=[],B=[],Z=[];o.updateTopCamera();const G=(r=(g=rt(i.result))==null?void 0:g.valid)!=null?r:!0;if(n.setPointCloudValid(G),(m=n.sideViewInstance)==null||m.clearAllData(),(C=n.backViewInstance)==null||C.clearAllData(),i.result){if(v=O.getBoxParamsFromResultList(i.result),(v==null?void 0:v.length)>0&&i.isPreResult&&(y==null?void 0:y.lowerLimitPointsNumInBox)>0){v=yield o==null?void 0:o.filterPreResult(i.url,y,v);const H=rt(i.result);H[no].result=v,i.result=JSON.stringify(H),n.setPointCloudResult(v)}B=O.getPolygonListFromResultList(i.result),I=O.getLineListFromResultList(i.result),Z=O.getSphereParamsFromResultList(i.result),t.updateData(i.url,i.result,{radius:(S=y==null?void 0:y.radius)!=null?S:tt}),o==null||o.generateBoxes(v),o==null||o.generateSpheres(Z),yield n.syncAllViewPointCloudColor(F.Default,v,[])}E({pointCloudBoxList:v,polygonList:B,lineList:I,pointCloudSphereList:Z}),Lt(M,!1),vt(M,!1),(_=e==null?void 0:e.setResourceLoading)==null||_.call(e,!1)}),updateViewsByDefaultSize:Kt,generateRects:ot,update2DViewRect:Ft,remove2DViewRect:Wt}},Bo=()=>{const{pointCloudBoxList:e,rectList:n,setPointCloudResult:t}=mt(xt),d=K(e),p=K(n);return{syncToPointCloudBoxList:ht(()=>{const f=d.current,u=p.current;if(u.length===0)return null;const a=new Map,h=new Set;if(u.filter(P=>P.extId!==void 0).forEach(P=>{const L=P.extId,T=P.imageName,V=lo(P,["x","y","width","height"]);let R=a.get(L);R||(R=new Map,a.set(L,R)),R.set(T,V),h.add(L)}),a.size){const P=f.map(L=>{var T;const V=L.id;if(h.has(V)){const R=x({},L);return(T=R.rects)==null||T.forEach(U=>{var N;const z=U.imageName;Object.assign(U,(N=a.get(V))==null?void 0:N.get(z))}),R}return L});return t(P),P}return null},[])}};export{_t as syncBackViewByPoint,St as syncSideViewByPoint,kt as syncTopViewByPoint,Vt as synchronizeBackView,Rt as synchronizeSideView,ct as synchronizeTopView,dt as topViewPoint2PointCloud,at as topViewPolygon2PointCloud,yo as usePointCloudViews,Bo as useSyncRectPositionDimensionToPointCloudList};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useContext as w}from"react";import{useDispatch as D}from"../../../store/ctx.js";import{useSingleBox as b}from"./useSingleBox.js";import{PointCloudContext as T}from"../PointCloudContext.js";import{EPointCloudName as
|
|
1
|
+
import{useContext as w}from"react";import{useDispatch as D}from"../../../store/ctx.js";import{useSingleBox as b}from"./useSingleBox.js";import{PointCloudContext as T}from"../PointCloudContext.js";import{EPointCloudName as H}from"@labelbee/lb-annotation";import{PreDataProcess as R}from"../../../store/annotation/actionCreators.js";import{usePointCloudViews as E}from"./usePointCloudViews.js";import{useSphere as L}from"./useSphere.js";import{useHistory as _}from"./useHistory.js";import{EPointCloudBoxRenderTrigger as m}from"../../../utils/ToolPointCloudBoxRenderHelper.js";const P={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},k=(g,c)=>{const r=w(T),{topViewInstance:d,selectedIDs:n,pointCloudBoxList:s,mainViewInstance:u,selectedID:v}=r,h=D(),{selectedSphere:p}=L(),{syncPointCloudViews:C,syncPointCloudPoint:f,generateRects:V}=E({setResourceLoading:g}),{selectedBox:a,updateSelectedBox:j}=b({generateRects:V}),{pushHistoryWithList:x}=_(),y=({newSelectedSphere:e,newSphereList:o})=>{const t=d==null?void 0:d.toolInstance;if((e||p)&&n.length===1){const i=e!=null?e:p;t.setSelectedID(n[0]);const l=t.selectedPoint;i&&(f==null||f(P.Top,l,i,void 0,o,c))}},I=({trigger:e,newSelectedBox:o})=>{const t=d==null?void 0:d.toolInstance;if(!(n.length===0||!t)&&(o||(a==null?void 0:a.info))){const i=o!=null?o:a==null?void 0:a.info,l=o;if(i){C==null||C({omitView:P.Top,polygon:l,boxParams:i},e);return}}};return{updatePointCloudColor:e=>{if(s.forEach(o=>{var t,i,l;if(o&&n.includes(o.id)){o.attribute=e;const S=h(R({tool:H.PointCloud,dataList:[o],stepConfig:c,action:"viewUpdateBox"}));o.valid=S[0].valid,j(o),(l=(i=(t=r==null?void 0:r.topViewInstance)==null?void 0:t.pointCloud2dOperation)==null?void 0:i.setPolygonValidAndRender)==null||l.call(i,o.id,!0,o.valid),y({})}}),u){const o=n&&n.length>1?m.MulitSelect:m.Single;r.syncAllViewPointCloudColor(o,s);let t;n&&n.length===1&&(t=s.find(i=>i.id===n[0]),I({trigger:o,newSelectedBox:t})),u.generateBoxes(s),t&&(u.setHighlightColor(t.id),u.render())}v||x({pointCloudBoxList:s})}}};export{k as useUpdatePointCloudColor};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getClassName as
|
|
1
|
+
import{getClassName as i}from"../../utils/dom.js";import e,{useContext as K,useRef as b,useState as w,useEffect as f}from"react";import O from"./PointCloud3DView.js";import Z from"./PointCloudBackView.js";import Q from"./PointCloudTopView.js";import U from"./PointCloudSideView.js";import $ from"./PointCloud2DView.js";import q from"./PointCloudListener.js";import J from"./PointCloudSegmentListener.js";import X from"./PointCloudSegment.js";import Y from"./PointCloudSegmentStatus.js";import tt from"./PointCloudSegmentToolbar.js";import et from"./PointCloudSegment2DView.js";import{connect as ot}from"react-redux";import{LabelBeeContext as nt,useDispatch as it}from"../../store/ctx.js";import{AnnotatedAttributesPanelFixedLeft as lt,AnnotatedAttributesPanelFixedRight as rt}from"../../views/MainView/toolFooter/AnnotatedAttributes/index.js";import{PointCloudContext as at}from"./PointCloudContext.js";import{PointCloudUtils as st,EPointCloudPattern as ut}from"@labelbee/lb-utils";import{useCustomToolInstance as mt}from"../../hooks/annotation.js";import{jsonParser as dt}from"../../utils/index.js";import{a2MapStateToProps as ct}from"../../store/annotation/map.js";import j from"classnames";import pt from"./components/sideAndBackOverView/index.js";import{SetLoadPCDFileLoading as ft}from"../../store/annotation/actionCreators.js";import x from"../DynamicResizer/DynamicResizer.js";const gt=D=>{const{currentData:u,imgList:y,drawLayerSlot:g,checkMode:l,intelligentFit:I,imgIndex:R,config:A,measureVisible:B,setResourceLoading:L,stepInfo:o,setBatchSetValid:C}=D,t=K(at),{globalPattern:P,setGlobalPattern:k,selectedIDs:h,isLargeStatus:m,setIsLargeStatus:T}=t,N=it(),v=b(null),S=b(null),[_,M]=w(0),[r,E]=w(!1),F=(h==null?void 0:h.length)>0&&r,H=dt(u.result),{toolInstanceRef:s,clearToolInstance:z}=mt({basicInfo:H});if(f(()=>{s.current.setPointCloudGlobalPattern=n=>{n!==P&&(k(n),t.clearAllDetectionInstance(),z())}},[P]),f(()=>{var n;if(ft(N,!0),u){const{boxParamsList:a,polygonList:d,lineList:c,sphereParamsList:p,segmentation:W,rectList:G}=st.parsePointCloudCurrentResult((n=u==null?void 0:u.result)!=null?n:"");t.setPointCloudResult(a),t.setPolygonList(d),t.setLineList(c),t.setPointCloudSphereList(p),t.setRectList(G),t.setSegmentation(W)}},[R]),f(()=>{var n;if(v.current){const a=((n=v.current)==null?void 0:n.offsetHeight)-233;M(a)}},[S.current]),f(()=>{s.current.exportData=()=>[t.pointCloudBoxList,{valid:t.valid}],s.current.exportCustomData=()=>{var n,a,d,c,p;return{resultPolygon:(n=t.polygonList)!=null?n:[],resultLine:(a=t.lineList)!=null?a:[],resultPoint:(d=t.pointCloudSphereList)!=null?d:[],resultRect:(c=t.rectList)!=null?c:[],segmentation:(p=t.segmentation)!=null?p:[]}}},[t.pointCloudBoxList,t.rectList,t.valid,t.polygonList,t.lineList,t.pointCloudSphereList,t.ptSegmentInstance,t.segmentation]),y.length===0)return null;if(P===ut.Segmentation)return e.createElement(e.Fragment,null,e.createElement(J,{checkMode:l,toolInstanceRef:s}),e.createElement(tt,null),e.createElement("div",{className:i("point-cloud-layout")},e.createElement(X,{checkMode:l}),e.createElement(et,null)),e.createElement(Y,{config:A}),g==null?void 0:g({direct:!0}));let V=e.createElement("div",{className:i("point-cloud-container","left-bottom")},e.createElement(Z,{checkMode:l}),e.createElement(U,{checkMode:l}));return r&&(V=e.createElement(pt,{selectAndEnlarge:F,checkMode:l})),e.createElement(e.Fragment,null,e.createElement(q,{checkMode:l,toolInstanceRef:s,setResourceLoading:L,isBatchSetValid:!!C}),e.createElement("div",{className:i("point-cloud-layout"),onContextMenu:n=>n.preventDefault()},e.createElement("div",{className:i("point-cloud-wrapper")},e.createElement(lt,null),e.createElement("div",{className:i("point-cloud-content"),ref:S},e.createElement(x,{direction:"horizontal",localKey:"leftAllViewid:"+(o==null?void 0:o.id)+"taskID:"+(o==null?void 0:o.taskID)+"step:"+(o==null?void 0:o.step)+"type:"+(o==null?void 0:o.type),defaultWidth:360,minLeftWidth:244,minRightWidth:"50%",disabled:m},e.createElement("div",{className:i("point-cloud-container",m?"left-large":"left-noLarge")},e.createElement(O,{setResourceLoading:L}),V),e.createElement("div",{className:j({[i("point-cloud-container","right")]:!0,[i("point-cloud-container","rightZoom")]:r}),ref:v},e.createElement(x,{localKey:"rightAllViewid:"+(o==null?void 0:o.id)+"taskID:"+(o==null?void 0:o.taskID)+"step:"+(o==null?void 0:o.step)+"type:"+(o==null?void 0:o.type),defaultHeight:300,minTopHeight:_,minBottomHeight:160,disabled:m},e.createElement(Q,{drawLayerSlot:g,checkMode:l,intelligentFit:I,setIsEnlargeTopView:E,onExitZoom:()=>{T(!1),E(!1)},isEnlargeTopView:r}),e.createElement("div",{className:j({[i("point-cloud-container",m?"right-bottom-large":"right-bottom-noLarge")]:!r,[i("point-cloud-container","right-bottom-floatLeft")]:r})},e.createElement($,{isEnlargeTopView:r,thumbnailWidth:r?300:455,checkMode:l,measureVisible:B})))))),e.createElement(rt,null))),t.visibleBatchSetValid&&(C==null?void 0:C({valid:t.valid,isModal:!0,visibleModal:t.visibleBatchSetValid,onClose:()=>t.setBatchSetValidModal(!1),singleSetQuestionImg:()=>t.setPointCloudValid(!t.valid)})))};var Ct=ot(ct,null,null,{context:nt})(gt);export{Ct as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import l from"react";import{Row as
|
|
1
|
+
import l from"react";import{Row as E,Col as x,Radio as y,Tag as h}from"antd";import a from"./index.module.scss.js";import k from"../longText/index.js";import b from"classnames";const{CheckableTag:N}=h,C=({tagItem:d,selectedTags:o,handleChange:i,disabeledAll:v})=>{var r;const c=v,{isMulti:s,subSelected:u=[],value:m}=d,n=m;return s?l.createElement(l.Fragment,null,u.map(e=>{var t,p;return l.createElement(N,{key:e==null?void 0:e.value,checked:(t=o[n])==null?void 0:t.includes(e==null?void 0:e.value),onChange:f=>{c||i({key:n,tag:e==null?void 0:e.value,checked:f})},className:b({[`${a.disabled}`]:c,[`${a.active}`]:c&&((p=o[n])==null?void 0:p.includes(e==null?void 0:e.value))})},l.createElement("span",{className:a.tagItem},l.createElement(k,{text:e==null?void 0:e.key,openByText:!0,maxWordCount:10})))})):l.createElement(y.Group,{onChange:e=>{i({key:n,tag:e.target.value,checked:e.target.checked,isRadio:!0})},value:(r=o[n])==null?void 0:r[0]},u.map(e=>l.createElement(y,{value:e==null?void 0:e.value,key:e==null?void 0:e.value,disabled:c},l.createElement("span",{className:a.tagItem},l.createElement(k,{text:e==null?void 0:e.key,openByText:!0,maxWordCount:10})))))},T=d=>{const{selectedTags:o,updateValue:i,disabeledAll:v,inputList:r=[]}=d,c=s=>{const{key:u,checked:m,tag:n,isRadio:e}=s;let t=o[u]||[];if(e&&(t=[]),m){if(t==null?void 0:t.includes(n))return;t.push(n)}else!m&&(t==null?void 0:t.includes(n))&&(t=t.filter(f=>f!==n));i({key:u,value:t})};return(r==null?void 0:r.length)>0?l.createElement("div",{className:a.tagList},r.map((s,u)=>l.createElement(E,{key:u,className:a.content},l.createElement(x,{span:4,className:a.left},l.createElement(k,{text:s==null?void 0:s.key,openByText:!0})),l.createElement(x,{span:20,className:a.right},l.createElement(C,{selectedTags:o,handleChange:c,tagItem:s,disabeledAll:v}))))):null};export{T as default};
|
package/es/constant/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var n;(function(a){a[a.Check=0]="Check",a[a.ANNOTATION=1]="ANNOTATION",a[a.QUALITY_INSPECTION=2]="QUALITY_INSPECTION",a[a.PRE_ANNOTATION=3]="PRE_ANNOTATION",a[a.MANUAL_CORRECTION=4]="MANUAL_CORRECTION"})(n||(n={}));var c;(function(a){a[a.Backward=1]="Backward",a[a.Forward=2]="Forward",a[a.Jump=3]="Jump",a[a.Quit=4]="Quit",a[a.Export=5]="Export",a[a.StepChanged=6]="StepChanged",a[a.Save=7]="Save",a[a.BatchUpdateTrackID=8]="BatchUpdateTrackID",a[a.BatchUpdateImgList=9]="BatchUpdateImgList",a[a.SyncImgList=10001]="SyncImgList",a[a.SyncCurrentPageData=10002]="SyncCurrentPageData"})(c||(c={}));const
|
|
1
|
+
var n;(function(a){a[a.Check=0]="Check",a[a.ANNOTATION=1]="ANNOTATION",a[a.QUALITY_INSPECTION=2]="QUALITY_INSPECTION",a[a.PRE_ANNOTATION=3]="PRE_ANNOTATION",a[a.MANUAL_CORRECTION=4]="MANUAL_CORRECTION"})(n||(n={}));var c;(function(a){a[a.Backward=1]="Backward",a[a.Forward=2]="Forward",a[a.Jump=3]="Jump",a[a.Quit=4]="Quit",a[a.Export=5]="Export",a[a.StepChanged=6]="StepChanged",a[a.Save=7]="Save",a[a.BatchUpdateTrackID=8]="BatchUpdateTrackID",a[a.BatchUpdateImgList=9]="BatchUpdateImgList",a[a.SyncImgList=10001]="SyncImgList",a[a.SyncCurrentPageData=10002]="SyncCurrentPageData"})(c||(c={}));const N="bee",I=`${N}-component`;var r;(function(a){a.Default="default",a.Markdown="markdown"})(r||(r={}));var o;(function(a){a.Picture="picture",a.Text="text",a.None="none",a.Audio="audio"})(o||(o={}));export{r as EDataFormatType,o as ELLMDataType,n as EStepType,c as ESubmitType,I as componentCls,N as prefix};
|