@labelbee/lb-components 1.24.0-alpha.8 → 1.24.0-alpha.9
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/pointCloudView/PointCloud3DView.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/index.js +1 -1
- package/dist/index.css +8 -0
- package/dist/store/annotation/actionCreators.js +1 -1
- package/dist/store/annotation/reducer.js +1 -1
- package/dist/types/components/pointCloudView/components/UnifyParamsModal/index.d.ts +2 -2
- package/dist/types/components/pointCloudView/hooks/usePointCloudAttribute.d.ts +3 -0
- 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/views/MainView/sidebar/ToolIcons.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/pointCloudView/PointCloud3DView.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/index.js +1 -1
- package/es/index.css +8 -0
- package/es/store/annotation/actionCreators.js +1 -1
- package/es/store/annotation/reducer.js +1 -1
- package/es/views/MainView/sidebar/ToolIcons.js +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as t from"react";var l,o,v,c,m,z;function a(){return a=Object.assign?Object.assign.bind():function(h){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(h[n]=r[n])}return h},a.apply(null,arguments)}var i=function(e){return t.createElement("svg",a({xmlns:"http://www.w3.org/2000/svg",width:20,height:20,fill:"none"},e),l||(l=t.createElement("path",{fill:"currentColor",d:"M17 5h-1.571V3H17zm-3.143 0h-1.571V3h1.571zm-3.143 0H9.143V3h1.571zM7.571 5H6V3h1.571z"})),o||(o=t.createElement("path",{fill:"currentColor",d:"M17 17h-2v-2h2zm0-4h-2v-2h2zm0-4h-2V7h2zm0-4h-2V3h2z"})),v||(v=t.createElement("path",{fill:"currentColor",d:"M17 17h-1.571v-2H17zm-3.143 0h-1.571v-2h1.571zm-3.143 0H9.143v-2h1.571zm-3.143 0H6v-2h1.571zM6 2H2v4h4zM18 2h-4v4h4zM6 14H2v4h4z"})),c||(c=t.createElement("path",{fill:"currentColor",d:"M18 14h-4v4h4z"})),m||(m=t.createElement("path",{fill:"#fff",d:"M5 6H3v9h2z"})),z||(z=t.createElement("path",{fill:"currentColor",d:"M3 6h2v9H3zM15 3v2H5V3zM15 15v2H5v-2zM15 6h2v9h-2z"})))};export{i as ReactComponent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as t from"react";var l,o,v,c;function a(){return a=Object.assign?Object.assign.bind():function(h){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(h[n]=r[n])}return h},a.apply(null,arguments)}var m=function(e){return t.createElement("svg",a({xmlns:"http://www.w3.org/2000/svg",width:20,height:20,fill:"none"},e),l||(l=t.createElement("path",{fill:"currentColor",d:"M17 5h-1.571V3H17zm-3.143 0h-1.571V3h1.571zm-3.143 0H9.143V3h1.571zM7.571 5H6V3h1.571z"})),o||(o=t.createElement("path",{fill:"currentColor",d:"M17 17h-2v-2h2zm0-4h-2v-2h2zm0-4h-2V7h2zm0-4h-2V3h2z"})),v||(v=t.createElement("path",{fill:"currentColor",d:"M17 17h-1.571v-2H17zm-3.143 0h-1.571v-2h1.571zm-3.143 0H9.143v-2h1.571zm-3.143 0H6v-2h1.571z"})),c||(c=t.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M6 2H2v4h1v11h11v1h4v-4h-1V3H6zm9 3H6v1H5v9h9v-1h1z",clipRule:"evenodd"})))};export{m as ReactComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getClassName as d}from"../../utils/dom.js";import{cKeyCode as
|
|
1
|
+
import{getClassName as d}from"../../utils/dom.js";import{cKeyCode as W,PointCloud as X}from"@labelbee/lb-annotation";import{PointCloudUtils as S,EPerspectiveView as E}from"@labelbee/lb-utils";import O from"classnames";import o,{useContext as T,useState as b,useRef as Y,useEffect as u,useMemo as $}from"react";import{PointCloudContainer as ee}from"./PointCloudLayout.js";import{PointCloudContext as te}from"./PointCloudContext.js";import{a2MapStateToProps as oe}from"../../store/annotation/map.js";import{connect as ne}from"react-redux";import{jsonParser as ie}from"../../utils/index.js";import{useSingleBox as le}from"./hooks/useSingleBox.js";import{useSphere as re}from"./hooks/useSphere.js";import{Switch as ae,Tooltip as se}from"antd";import ce from"../../hooks/useSize.js";import{usePointCloudViews as de}from"./hooks/usePointCloudViews.js";import{useTranslation as R}from"react-i18next";import{LabelBeeContext as me}from"../../store/ctx.js";import ue from"./components/PointCloudSizeSlider/index.js";import pe from"./components/TitleButton/index.js";import{LeftOutlined as we}from"@ant-design/icons";import{useToolStyleContext as ve}from"../../hooks/useToolStyle.js";import{usePointCloudAttribute as fe}from"./hooks/usePointCloudAttribute.js";var Ce=Object.defineProperty,A=Object.getOwnPropertySymbols,Ve=Object.prototype.hasOwnProperty,ge=Object.prototype.propertyIsEnumerable,F=(n,l,a)=>l in n?Ce(n,l,{enumerable:!0,configurable:!0,writable:!0,value:a}):n[l]=a,Pe=(n,l)=>{for(var a in l||(l={}))Ve.call(l,a)&&F(n,a,l[a]);if(A)for(var a of A(l))ge.call(l,a)&&F(n,a,l[a]);return n};const Ee=W.default,Ie="LABELBEE-POINTCLOUD",I=o.createContext({isActive:!1,setTarget3DView:()=>{},reset3DView:()=>{},followTopView:()=>{}}),w=({perspectiveView:n})=>{const{isActive:l,setTarget3DView:a}=T(I),f=p=>O({[d("point-cloud-3d-view",p)]:!0,active:l});return o.createElement("span",{onClick:()=>{a(E[n])},className:f(n.toLocaleLowerCase())})},H=({isEnlarge:n})=>{const{reset3DView:l,followTopView:a}=T(I),{t:f}=R(),p=o.createElement(o.Fragment,null,o.createElement(w,{perspectiveView:"Top"}),o.createElement(w,{perspectiveView:"Front"}),o.createElement(w,{perspectiveView:"Left"}),o.createElement(w,{perspectiveView:"Back"}),o.createElement(w,{perspectiveView:"Right"}),o.createElement(w,{perspectiveView:"LFT"}),o.createElement(w,{perspectiveView:"RBT"})),t=o.createElement(o.Fragment,null,o.createElement(se,{title:f("CameraFollowTopView")},o.createElement("span",{onClick:()=>{a()},className:d("point-cloud-3d-view","followTop")})),o.createElement("span",{onClick:()=>{l()},className:d("point-cloud-3d-view","reset")}));return n?o.createElement("div",{className:d("point-cloud-3d-sidebarZoom")},t,p):o.createElement("div",{className:d("point-cloud-3d-sidebar")},p,t)},he=({currentData:n,config:l,highlightAttribute:a,setResourceLoading:f})=>{var p;const t=T(te),[U,K]=b(!0),[C,h]=b(!1),V=Y(null),{initPointCloud3d:y}=de(),g=ce(V),{t:x}=R(),{value:B}=ve(),{hiddenText:L}=B||{},{updatePointCloudAttribute:M}=fe(f,l);u(()=>{let e=t.mainViewInstance;e&&e.updateHiddenTextAndRender(L,t.pointCloudBoxList)},[B]),u(()=>{!t.mainViewInstance||y==null||y(g)},[g]);const{selectedBox:m}=le(),{selectedSphere:P}=re(),[Z,j]=b(!0),_=e=>{var i,s;const r=m==null?void 0:m.info;if(r){const c=Pe({},r.center);c.x=c.x-.01,c.z=1e3;const v=e===E.Top;(i=t.mainViewInstance)==null||i.updateCameraByBox(r,e,v?c:void 0)}P&&((s=t.mainViewInstance)==null||s.updateCameraBySphere(P,e))},q=()=>{var e;(e=t.mainViewInstance)==null||e.resetCamera()},G=()=>{var e,i;const s=(e=t.topViewInstance)==null?void 0:e.pointCloudInstance.camera;s&&((i=t.mainViewInstance)==null||i.applyCameraTarget(s))};u(()=>{if(V.current&&(n==null?void 0:n.url)){let e=t.mainViewInstance;!e&&g.width&&(e=new X({container:V.current,isOrthographicCamera:!0,orthographicParams:S.getDefaultOrthographicParams(g),config:l,hiddenText:L}),e.setHandlerPipe({setSelectedIDs:t.setSelectedIDs,setNeedUpdateCenter:j}),t.setMainViewInstance(e))}},[g,n]),u(()=>{var e;if(V.current&&(n==null?void 0:n.url)&&n.result&&t.mainViewInstance){let i=t.mainViewInstance;const s=S.getRectParamsFromResultList(n.result),r=S.getBoxParamsFromResultList(n.result),c=r.find(v=>v.id===t.selectedID);c&&M(c.attribute),t.setPointCloudValid((e=ie(n.result))==null?void 0:e.valid),t.setPointCloudResult(r),t.setRectList(s),i.generateBoxes(r)}},[n.result,t.mainViewInstance]),u(()=>{var e,i,s,r,c,v,k;const N=(e=m==null?void 0:m.info)==null?void 0:e.id;if(!Z){j(!0);return}if(N!==void 0){_(E.Top);const Q=(r=(s=(i=t.topViewInstance)==null?void 0:i.pointCloudInstance)==null?void 0:s.camera.zoom)!=null?r:1;(c=t.mainViewInstance)==null||c.updateCameraZoom(Q)}(v=t.mainViewInstance)==null||v.setHighlightColor(N),(k=t.mainViewInstance)==null||k.render()},[(p=m==null?void 0:m.info)==null?void 0:p.id]),u(()=>{var e,i,s,r;if(P){_(E.Top);const c=(s=(i=(e=t.topViewInstance)==null?void 0:e.pointCloudInstance)==null?void 0:i.camera.zoom)!=null?s:1;(r=t.mainViewInstance)==null||r.updateCameraZoom(c)}},[P]),u(()=>(window.addEventListener("keydown",z),()=>{window.removeEventListener("keydown",z)}),[]);const z=e=>{if(e.keyCode===Ee.Esc){h(!1);return}},D=$(()=>({reset3DView:q,setTarget3DView:_,isActive:!!m,followTopView:G}),[m,t.mainViewInstance]);u(()=>{var e,i,s;const r=t.pointCloudBoxList.filter(c=>c.attribute===a);(r==null?void 0:r.length)>0&&((e=t.mainViewInstance)==null||e.clearHighlightBoxes(),(i=t.mainViewInstance)==null||i.highlightBoxes(r)),r.length===0&&((s=t.mainViewInstance)==null||s.clearHighlightBoxesAndRender())},[a,t.mainViewInstance]);const J=o.createElement(o.Fragment,null,o.createElement(ue,{onChange:e=>{var i;(i=t.mainViewInstance)==null||i.updatePointSize({customSize:e})}}),o.createElement("span",{style:{marginRight:8}},x("ShowArrows")),o.createElement(ae,{size:"small",checked:U,onChange:e=>{var i;K(e),(i=t.mainViewInstance)==null||i.setShowDirection(e)}}),C&&o.createElement(I.Provider,{value:D},o.createElement(H,{isEnlarge:C})));return o.createElement(ee,{className:O({[d("point-cloud-3d-container")]:!0,[d("point-cloud-container","zoom")]:C}),title:C?o.createElement("div",{style:{display:"flex",alignItems:"center"}},o.createElement(we,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{h(!1)}}),x("3DView")):o.createElement(pe,{title:x("3DView"),onClick:()=>{h(!0)}}),toolbar:J},o.createElement("div",{className:d("point-cloud-3d-content")},!C&&o.createElement(I.Provider,{value:D},o.createElement(H,null)),o.createElement("div",{className:d("point-cloud-3d-view"),id:Ie,ref:V})))};var xe=ne(oe,null,null,{context:me})(he);export{xe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{BatchUpdateResultByTrackID as z}from"../../../../store/annotation/actionCreators.js";import{LabelBeeContext as R,useDispatch as L}from"../../../../store/ctx.js";import{Form as u,Modal as M,InputNumber as I,Select as E,Popover as T,message as q}from"antd";import e,{useState as N,useEffect as V,useCallback as H}from"react";import{useTranslation as K}from"react-i18next";import{QuestionCircleOutlined as Q}from"@ant-design/icons";import{PointCloudUtils as S}from"@labelbee/lb-utils";import{connect as W}from"react-redux";import{useSingleBox as $}from"../../hooks/useSingleBox.js";import{MathUtils as G}from"@labelbee/lb-annotation";var J=Object.defineProperty,X=Object.defineProperties,Y=Object.getOwnPropertyDescriptors,F=Object.getOwnPropertySymbols,Z=Object.prototype.hasOwnProperty,ee=Object.prototype.propertyIsEnumerable,B=(r,n,a)=>n in r?J(r,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[n]=a,y=(r,n)=>{for(var a in n||(n={}))Z.call(n,a)&&B(r,a,n[a]);if(F)for(var a of F(n))ee.call(n,a)&&B(r,a,n[a]);return r},te=(r,n)=>X(r,Y(n));const re={labelCol:{span:8},wrapperCol:{span:16}},w=[{required:!0,message:"\u8BF7\u586B\u5199\u4E00\u4E2A\u6570\u5B57"}],ne=[{required:!0,message:"\u8BF7\u9009\u62E9\u4E3B\u5C5E\u6027"}],h=2,O=({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),ae=({id:r,visible:n,onCancel:a,config:m,imgList:d,imgIndex:k})=>{const A=L(),{selectedBox:i}=$(),[p,b]=N(),[f]=u.useForm(),{t:o}=K();V(()=>{n===!1?(f.resetFields(),b(void 0)):x()},[n]);const C=t=>{var s;if(!r)return;if(!p){q.info("\u8BE5\u8303\u56F4\u4E0D\u5B58\u5728\u66F4\u6539\u6570\u636E, \u8BF7\u66F4\u6539\u7EDF\u4E00\u8303\u56F4");return}const l={attribute:t.attribute};if(m.secondaryAttributeConfigurable){const c={};(s=m.inputList)==null||s.forEach(g=>{const v=t[g.value];v!==void 0&&Object.assign(c,{[g.value]:v})}),Object.keys(c).length>0&&Object.assign(l,{subAttribute:c})}p&&Object.assign(l,p),A(z(r,l,[t.prevPage-1,t.nextPage-1],d)),a()},x=H(()=>{var t;const{prevPage:s,nextPage:l}=f.getFieldsValue(["prevPage","nextPage"]),c=d.filter((v,U)=>G.isInRange(U,[s-1,l-1]));if(!((c==null?void 0:c.length)>0)||!(i==null?void 0:i.info)||((t=i==null?void 0:i.info)==null?void 0:t.trackID)===void 0){b(void 0);return}const g=S.getMaxSizeFromBox({trackID:i.info.trackID,imgList:c});b(g)},[d,i,k]),D=()=>f.submit(),j=()=>{if(!p||!(i==null?void 0:i.info))return;const t={marginRight:16},{length:s,width:l,height:c}=S.transferBox2Kitti(y(y({},i==null?void 0:i.info),p));return e.createElement("div",null,e.createElement("span",{style:t},o("Length"),": ",s.toFixed(h)),e.createElement("span",{style:t},o("Width"),": ",l.toFixed(h)),e.createElement("span",{style:t},o("Height"),": ",c.toFixed(h)),e.createElement(T,{placement:"rightBottom",content:"\u7EDF\u4E00\u5C3A\u5BF8\u4E3A\u8BE5ID\u7684\u6240\u6709\u6807\u6CE8\u6846\u4E2D\u6700\u5927\u7684\u5C3A\u5BF8"},e.createElement(Q,null)))},P={width:"200px"},_={marginBottom:"24px",display:"flex",alignItems:"center"};return e.createElement(M,{title:o("UnifyParams"),visible:n,onCancel:a,onOk:D,wrapClassName:"labelbee-custom-modal"},e.createElement(u,te(y({},re),{form:f,onFinish:C}),e.createElement(u.Item,{name:"id",label:o("UnifyTrackID")},r),e.createElement(u.Item,{label:o("UnifyAttributeRange"),required:!0},e.createElement(u.Item,{style:{display:"inline-block"},rules:w,name:"prevPage",noStyle:!0,initialValue:1},e.createElement(I,{precision:0,min:1,style:{width:"80px"},onChange:()=>x()})),e.createElement("span",{style:{display:"inline-block",width:"24px",textAlign:"center"}},"-"),e.createElement(u.Item,{style:{display:"inline-block"},rules:w,name:"nextPage",noStyle:!0,initialValue:d.length},e.createElement(I,{precision:0,min:1,style:{width:"80px"},onChange:()=>x()})),e.createElement("span",{style:{display:"inline-block",width:"40x",marginLeft:"10px",textAlign:"center"}},o("Page"))),e.createElement(u.Item,{name:"UnifySize",label:o("UnifySize")},j()),e.createElement(u.Item,{label:o("UnifyTag"),required:!0},e.createElement("div",{style:_},e.createElement(O,{text:o("Attribute")}),e.createElement(u.Item,{name:"attribute",noStyle:!0,rules:ne},e.createElement(E,{style:P},m.attributeList.map(t=>e.createElement(E.Option,{key:t.value,value:t.value},t.key))))),m.secondaryAttributeConfigurable&&m.inputList.map(t=>{var s;return e.createElement("div",{key:t.value,style:_},e.createElement(O,{text:t.key}),e.createElement(u.Item,{name:t.value,noStyle:!0,required:!1},e.createElement(E,{style:P},(s=t.subSelected)==null?void 0:s.map(l=>e.createElement(E.Option,{key:l.value,value:l.value},l.key)))))}))))},le=r=>y({imgIndex:r.annotation.imgIndex},r);var ie=W(le,null,null,{context:R})(ae);export{ie 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{getClassName as n}from"../../utils/dom.js";import t,{useContext as y,useState as R,useEffect as C}from"react";import _ from"./PointCloud3DView.js";import k from"./PointCloudBackView.js";import B from"./PointCloudTopView.js";import F from"./PointCloudSideView.js";import M from"./PointCloud2DView.js";import G from"./PointCloudListener.js";import O from"./PointCloudSegmentListener.js";import Z from"./PointCloudSegment.js";import U from"./PointCloudSegmentStatus.js";import W from"./PointCloudSegmentToolbar.js";import $ from"./PointCloudSegment2DView.js";import{connect as q}from"react-redux";import{LabelBeeContext as z,useDispatch as H}from"../../store/ctx.js";import{AnnotatedAttributesPanelFixedLeft as J,AnnotatedAttributesPanelFixedRight as K}from"../../views/MainView/toolFooter/AnnotatedAttributes/index.js";import{PointCloudContext as Q}from"./PointCloudContext.js";import{PointCloudUtils as X,EPointCloudPattern as Y}from"@labelbee/lb-utils";import{useCustomToolInstance as tt}from"../../hooks/annotation.js";import{jsonParser as et}from"../../utils/index.js";import{a2MapStateToProps as ot}from"../../store/annotation/map.js";import
|
|
1
|
+
import{getClassName as n}from"../../utils/dom.js";import t,{useContext as y,useState as R,useEffect as C}from"react";import _ from"./PointCloud3DView.js";import k from"./PointCloudBackView.js";import B from"./PointCloudTopView.js";import F from"./PointCloudSideView.js";import M from"./PointCloud2DView.js";import G from"./PointCloudListener.js";import O from"./PointCloudSegmentListener.js";import Z from"./PointCloudSegment.js";import U from"./PointCloudSegmentStatus.js";import W from"./PointCloudSegmentToolbar.js";import $ from"./PointCloudSegment2DView.js";import{connect as q}from"react-redux";import{LabelBeeContext as z,useDispatch as H}from"../../store/ctx.js";import{AnnotatedAttributesPanelFixedLeft as J,AnnotatedAttributesPanelFixedRight as K}from"../../views/MainView/toolFooter/AnnotatedAttributes/index.js";import{PointCloudContext as Q}from"./PointCloudContext.js";import{PointCloudUtils as X,EPointCloudPattern as Y}from"@labelbee/lb-utils";import{useCustomToolInstance as tt}from"../../hooks/annotation.js";import{jsonParser as et}from"../../utils/index.js";import{a2MapStateToProps as ot}from"../../store/annotation/map.js";import E from"classnames";import nt from"./components/sideAndBackOverView/index.js";import{SetLoadPCDFileLoading as it}from"../../store/annotation/actionCreators.js";const lt=S=>{const{currentData:s,imgList:w,drawLayerSlot:d,checkMode:i,intelligentFit:x,imgIndex:b,config:j,measureVisible:v,setResourceLoading:P}=S,e=y(Q),{globalPattern:p,setGlobalPattern:V,selectedIDs:f}=e,h=H(),[l,g]=R(!1),D=(f==null?void 0:f.length)>0&&l,A=et(s.result),{toolInstanceRef:r,clearToolInstance:N}=tt({basicInfo:A});if(C(()=>{r.current.setPointCloudGlobalPattern=o=>{o!==p&&(V(o),e.clearAllDetectionInstance(),N())}},[p]),C(()=>{var o;if(it(h,!0),s){const{boxParamsList:a,polygonList:m,lineList:u,sphereParamsList:c,segmentation:I,rectList:T}=X.parsePointCloudCurrentResult((o=s==null?void 0:s.result)!=null?o:"");e.setPointCloudResult(a),e.setPolygonList(m),e.setLineList(u),e.setPointCloudSphereList(c),e.setRectList(T),e.setSegmentation(I)}},[b]),C(()=>{r.current.exportData=()=>[e.pointCloudBoxList,{valid:e.valid}],r.current.exportCustomData=()=>{var o,a,m,u,c;return{resultPolygon:(o=e.polygonList)!=null?o:[],resultLine:(a=e.lineList)!=null?a:[],resultPoint:(m=e.pointCloudSphereList)!=null?m:[],resultRect:(u=e.rectList)!=null?u:[],segmentation:(c=e.segmentation)!=null?c:[]}}},[e.pointCloudBoxList,e.rectList,e.valid,e.polygonList,e.lineList,e.pointCloudSphereList,e.ptSegmentInstance,e.segmentation]),w.length===0)return null;if(p===Y.Segmentation)return t.createElement(t.Fragment,null,t.createElement(O,{checkMode:i,toolInstanceRef:r}),t.createElement(W,null),t.createElement("div",{className:n("point-cloud-layout")},t.createElement(Z,{checkMode:i}),t.createElement($,null)),t.createElement(U,{config:j}),d==null?void 0:d({direct:!0}));let L=t.createElement("div",{className:n("point-cloud-container","left-bottom")},t.createElement(k,{checkMode:i}),t.createElement(F,{checkMode:i}));return l&&(L=t.createElement(nt,{selectAndEnlarge:D,checkMode:i})),t.createElement(t.Fragment,null,t.createElement(G,{checkMode:i,toolInstanceRef:r,setResourceLoading:P}),t.createElement("div",{className:n("point-cloud-layout"),onContextMenu:o=>o.preventDefault()},t.createElement("div",{className:n("point-cloud-wrapper")},t.createElement(J,null),t.createElement("div",{className:n("point-cloud-content")},t.createElement("div",{className:n("point-cloud-container","left")},t.createElement(_,{setResourceLoading:P}),L),t.createElement("div",{className:E({[n("point-cloud-container","right")]:!0,[n("point-cloud-container","rightZoom")]:l})},t.createElement(B,{drawLayerSlot:d,checkMode:i,intelligentFit:x,setIsEnlargeTopView:g,onExitZoom:()=>{g(!1)},isEnlargeTopView:l}),t.createElement("div",{className:E({[n("point-cloud-container","right-bottom")]:!l,[n("point-cloud-container","right-bottom-floatLeft")]:l})},t.createElement(M,{isEnlargeTopView:l,thumbnailWidth:l?300:455,checkMode:i,measureVisible:v})))),t.createElement(K,null))))};var rt=q(ot,null,null,{context:z})(lt);export{rt as default};
|
package/es/index.css
CHANGED
|
@@ -1547,6 +1547,14 @@
|
|
|
1547
1547
|
.bee-sidebar__toolOption + .bee-sidebar__toolOption {
|
|
1548
1548
|
margin-left: 16px;
|
|
1549
1549
|
}
|
|
1550
|
+
.bee-sidebar__multiBox {
|
|
1551
|
+
display: flex;
|
|
1552
|
+
align-items: center;
|
|
1553
|
+
margin: 0 5px;
|
|
1554
|
+
}
|
|
1555
|
+
.bee-sidebar__dropdown .ant-dropdown-menu-item:not(.ant-dropdown-menu-item-selected) {
|
|
1556
|
+
color: #999999;
|
|
1557
|
+
}
|
|
1550
1558
|
.bee-sidebar__singleTool {
|
|
1551
1559
|
max-width: 20px;
|
|
1552
1560
|
max-height: 20px;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ANNOTATION_ACTIONS as a}from"../Actions.js";import{LoadFileAndFileData as N,getStepConfig as V}from"./reducer.js";import{ESubmitType as E}from"../../constant/index.js";import{EPageTurningOperation as y}from"../../data/enums/AnnotationSize.js";import J from"../../utils/PageOperator.js";import{jsonParser as X}from"../../utils/index.js";import{getBoxesByTrackID as Y}from"../../components/predictTracking/previewResult/util.js";var S=(t,n,e)=>new Promise((o,r)=>{var i=l=>{try{u(e.next(l))}catch(p){r(p)}},s=l=>{try{u(e.throw(l))}catch(p){r(p)}},u=l=>l.done?o(l.value):Promise.resolve(l.value).then(i,s);u((e=e.apply(t,n)).next())});const G=(t,n)=>n.map(e=>t(e)),W=t=>t===y.Forward?E.Forward:t===y.Backward?E.Backward:t===y.Jump?E.Jump:E.Forward,q=(t,n)=>{var e,o,r;const{imgList:i,imgIndex:s}=t,{dataSourceStep:u}=V(t.stepList,t.step);return((r=(o=X((e=i[s-1])==null?void 0:e.result)[`step_${u}`])==null?void 0:o.result)==null?void 0:r.length)-1||n};function z(t){return{type:a.UPDATE_TOOL_INSTANCE,payload:{toolInstance:t}}}function w({stepList:t}){return{type:a.SET_TASK_STEP_LIST,payload:{stepList:t}}}function F({stepList:t,step:n}){return{type:a.SET_TASK_CONFIG,payload:{stepList:t,step:n}}}function L(t){return{type:a.UPDATE_ON_SUBMIT,payload:{onSubmit:t}}}function D(t){return{type:a.UPDATE_ON_SAVE,payload:{onSave:t}}}function m(t){return{type:a.UPDATE_ON_PAGE_CHANGE,payload:{onPageChange:t}}}function R(t){return{type:a.UPDATE_ON_STEP_CHANGE,payload:{onStepChange:t}}}function g(t){return{type:a.UPDATE_GET_FILE_DATA,payload:{getFileData:t}}}function h(t){return{type:a.UPDATE_PAGE_SIZE,payload:{pageSize:t}}}function B(t){return{type:a.UPDATE_LOAD_FILE_LIST,payload:{loadFileList:t}}}function Z(){return{type:a.UPDATE_ROTATE}}function k(t){return{type:a.SKIP_BEFORE_PAGE_TURNING,payload:{skipBeforePageTurning:t}}}function C(t){return{type:a.UPDATE_BEFORE_ROTATE,payload:{beforeRotate:t}}}function v(t){return{type:a.UPDATE_PRE_DATA_PROCESS,payload:{preDataProcess:t}}}function $(){return{type:a.COPY_BACKWARD_RESULT}}function b(t){return{type:a.UPDATE_IMG_INDEX_BY_EXTERNAL,payload:{getImgIndexByExternal:t}}}function Q({id:t,newID:n,rangeIndex:e,imgList:o}){return{type:a.BATCH_UPDATE_TRACK_ID,payload:{id:t,newID:n,rangeIndex:e,imgList:o}}}function tt(t,n,e){return{type:a.BATCH_UPDATE_RESULT_BY_TRACK_ID,payload:{id:t,newData:n,rangeIndex:e}}}function nt(){return{type:a.BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT,payload:{}}}const H=t=>({type:a.SET_CHECK_MODE,payload:{checkMode:t}}),x=t=>({type:a.SET_HIGHLIGHT_ATTRIBUTE,payload:{attribute:t}});function et({onSubmit:t,onSave:n,onPageChange:e,onStepChange:o,getFileData:r,pageSize:i,loadFileList:s,step:u,stepList:l,skipBeforePageTurning:p,beforeRotate:_,checkMode:c,highlightAttribute:T,preDataProcess:f,getImgIndexByExternal:I}){const d=[];return t&&d.push(L(t)),n&&d.push(D(n)),e&&d.push(m(e)),o&&d.push(R(o)),r&&d.push(g(r)),s&&d.push(B(s)),i&&d.push(h(i)),p&&d.push(k(p)),_&&d.push(C(_)),f&&d.push(v(f)),typeof c=="boolean"&&d.push(H(c)),I&&d.push(b(I)),d.push(x(T)),d.push(F({stepList:l,step:u})),d.push({type:a.CALC_STEP_PROGRESS}),d.push({type:a.INIT_TOOL}),O=>G(O,d)}function at({onSubmit:t,onSave:n,onPageChange:e,onStepChange:o,getFileData:r,pageSize:i,loadFileList:s,stepList:u,beforeRotate:l,highlightAttribute:p,preDataProcess:_}){const c=[];return t&&c.push(L(t)),n&&c.push(D(n)),e&&c.push(m(e)),o&&c.push(R(o)),r&&c.push(g(r)),s&&c.push(B(s)),i&&c.push(h(i)),l&&c.push(C(l)),_&&c.push(v(_)),c.push(x(p)),c.push(w({stepList:u})),T=>G(T,c)}const ot=(t,n)=>{var e;const o=n==null?void 0:n.findIndex(r=>(r==null?void 0:r.step)===t);return(e=n[o+1])==null?void 0:e.step},rt=t=>(n,e)=>{const{annotation:o}=e(),{step:r,stepList:i}=o,s=ot(r,i);return[n(M(s,t))]},M=(t,n)=>(e,o)=>{var r,i;const{annotation:s}=o();(r=s==null?void 0:s.onStepChange)==null||r.call(s,t);const u=(i=s==null?void 0:s.imgIndex)!=null?i:0;return[e({type:a.SUBMIT_RESULT}),e({type:a.SUBMIT_FILE_DATA,payload:{submitType:E.StepChanged}}),e({type:a.SET_STEP,payload:{toStep:t}}),e({type:a.CALC_STEP_PROGRESS}),e(N(n!=null?n:u,0))]},A=t=>n=>[n({type:a.SUBMIT_RESULT}),n({type:a.SUBMIT_FILE_DATA,payload:{submitType:t}})],it=(t,n,e,o)=>S(void 0,null,function*(){t(A(e)),yield t(K(e)),t(N(n,o))}),ut=(t,n)=>[t({type:a.SUBMIT_RESULT}),t({type:a.SET_BASIC_INDEX,payload:{basicIndex:n}})],st=(t,n)=>{t({type:a.SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED,payload:{triggerEventAfterIndexChanged:n}})},lt=(t=!1)=>(n,e)=>P(n,e,y.Backward,t),pt=(t=!1)=>(n,e)=>P(n,e,y.Forward,t),dt=(t,n=!1)=>(e,o)=>{if(t!==o().imgIndex)return P(e,o,y.Jump,n,t)},j=(t,n,e,o)=>S(void 0,null,function*(){var r;const{loadFileList:i,imgList:s,pageSize:u}=n().annotation,l=Math.floor(e/u);U(t,!0);try{const p=yield i(l,u);if(U(t,!1),!((r=p==null?void 0:p.fileList)==null?void 0:r.length)||!(p==null?void 0:p.total))throw new Error("fileList and total are required");const _=o?new Array(p.total):[...s];return _.splice(l*u,u,...p.fileList),t({type:a.UPDATE_IMG_LIST,payload:{imgList:_}}),!0}catch(p){U(t,!1),console.error(p)}}),P=(t,n,e,o=!1,r)=>S(void 0,null,function*(){var i,s;const u=n().annotation,l=W(e);let{fileIndexChanged:p,fileIndex:_,basicIndexChanged:c,basicIndex:T}=J.getNextPageInfo(e,u,r);const f=(i=u==null?void 0:u.getImgIndexByExternal)==null?void 0:i.call(u,u.imgIndex,l);if(f!==void 0&&(p=!0,_=f),st(t,o),p){if(u.loading||!u.imgList[_]&&!(yield j(t,n,_)))return;const I=n();(s=u.onPageChange)==null||s.call(u,_);const d=l===E.Backward?q(I.annotation,T):T;return it(t,_,l,d)}return c?ut(t,T):t(A(l))}),ct=t=>{t(A(E.Save)),t({type:a.SAVE_RESULT})},U=(t,n)=>{t({type:a.SET_LOADING,payload:{loading:n}})},_t=(t,n)=>{t({type:a.SET_LOADPCDFILE_LOADING,payload:{loadPCDFileLoading:n}})},Tt=t=>{t({type:a.INIT_ALL_STATE,payload:{}})},Et=(t,n)=>{t({type:a.SET_PREDICT_RESULT,payload:{result:n}})},yt=(t,n)=>{t({type:a.SET_PREDICT_RESULT_VISIBLE,payload:{visible:n}})},ft=(t,n)=>(e,o)=>{const{imgList:r,step:i}=o().annotation;return Y(r,i,t,n)},It=t=>(n,e)=>{var o,r;const{annotation:i}=e();return(r=(o=i==null?void 0:i.preDataProcess)==null?void 0:o.call(i,t))!=null?r:t.dataList},K=t=>(n,e)=>S(void 0,null,function*(){const{annotation:o}=e(),{onSubmit:r,imgIndex:i,imgList:s}=o;!r||(yield r([s[i]],t,i,s))});export{nt as BatchUpdateImgListResultByPredictResult,tt as BatchUpdateResultByTrackID,Q as BatchUpdateTrackID,ct as ChangeSave,$ as CopyBackWordResult,P as DispatcherTurning,ft as GetBoxesByID,Tt as InitAnnotationState,et as InitTaskData,lt as PageBackward,pt as PageForward,dt as PageJump,It as PreDataProcess,U as SetAnnotationLoading,_t as SetLoadPCDFileLoading,Et as SetPredictResult,yt as SetPredictResultVisible,F as SetTaskConfig,w as SetTaskStepList,K as SubmitHandler,rt as ToNextStep,A as ToSubmitFileData,C as UpdateBeforeRotate,H as UpdateCheckMode,g as UpdateGetFileData,B as UpdateGetFileList,x as UpdateHighlightAttribute,b as UpdateImgIndexByExternal,at as UpdateInjectFunc,m as UpdateOnPageChange,D as UpdateOnSave,R as UpdateOnStepChange,L as UpdateOnSubmit,h as UpdatePageSize,v as UpdatePreDataProcess,M as UpdateProcessingStep,Z as UpdateRotate,k as UpdateSkipBeforePageTurning,z as UpdateToolInstance,j as loadImgList};
|
|
1
|
+
import{ANNOTATION_ACTIONS as a}from"../Actions.js";import{LoadFileAndFileData as N,getStepConfig as V}from"./reducer.js";import{ESubmitType as E}from"../../constant/index.js";import{EPageTurningOperation as y}from"../../data/enums/AnnotationSize.js";import J from"../../utils/PageOperator.js";import{jsonParser as X}from"../../utils/index.js";import{getBoxesByTrackID as Y}from"../../components/predictTracking/previewResult/util.js";var S=(t,n,e)=>new Promise((o,r)=>{var i=l=>{try{u(e.next(l))}catch(p){r(p)}},s=l=>{try{u(e.throw(l))}catch(p){r(p)}},u=l=>l.done?o(l.value):Promise.resolve(l.value).then(i,s);u((e=e.apply(t,n)).next())});const G=(t,n)=>n.map(e=>t(e)),W=t=>t===y.Forward?E.Forward:t===y.Backward?E.Backward:t===y.Jump?E.Jump:E.Forward,q=(t,n)=>{var e,o,r;const{imgList:i,imgIndex:s}=t,{dataSourceStep:u}=V(t.stepList,t.step);return((r=(o=X((e=i[s-1])==null?void 0:e.result)[`step_${u}`])==null?void 0:o.result)==null?void 0:r.length)-1||n};function z(t){return{type:a.UPDATE_TOOL_INSTANCE,payload:{toolInstance:t}}}function w({stepList:t}){return{type:a.SET_TASK_STEP_LIST,payload:{stepList:t}}}function F({stepList:t,step:n}){return{type:a.SET_TASK_CONFIG,payload:{stepList:t,step:n}}}function L(t){return{type:a.UPDATE_ON_SUBMIT,payload:{onSubmit:t}}}function D(t){return{type:a.UPDATE_ON_SAVE,payload:{onSave:t}}}function m(t){return{type:a.UPDATE_ON_PAGE_CHANGE,payload:{onPageChange:t}}}function R(t){return{type:a.UPDATE_ON_STEP_CHANGE,payload:{onStepChange:t}}}function g(t){return{type:a.UPDATE_GET_FILE_DATA,payload:{getFileData:t}}}function h(t){return{type:a.UPDATE_PAGE_SIZE,payload:{pageSize:t}}}function B(t){return{type:a.UPDATE_LOAD_FILE_LIST,payload:{loadFileList:t}}}function Z(){return{type:a.UPDATE_ROTATE}}function k(t){return{type:a.SKIP_BEFORE_PAGE_TURNING,payload:{skipBeforePageTurning:t}}}function C(t){return{type:a.UPDATE_BEFORE_ROTATE,payload:{beforeRotate:t}}}function v(t){return{type:a.UPDATE_PRE_DATA_PROCESS,payload:{preDataProcess:t}}}function $(){return{type:a.COPY_BACKWARD_RESULT}}function b(t){return{type:a.UPDATE_IMG_INDEX_BY_EXTERNAL,payload:{getImgIndexByExternal:t}}}function Q({id:t,newID:n,rangeIndex:e,imgList:o}){return{type:a.BATCH_UPDATE_TRACK_ID,payload:{id:t,newID:n,rangeIndex:e,imgList:o}}}function tt(t,n,e,o){return{type:a.BATCH_UPDATE_RESULT_BY_TRACK_ID,payload:{id:t,newData:n,rangeIndex:e,imgList:o}}}function nt(){return{type:a.BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT,payload:{}}}const H=t=>({type:a.SET_CHECK_MODE,payload:{checkMode:t}}),x=t=>({type:a.SET_HIGHLIGHT_ATTRIBUTE,payload:{attribute:t}});function et({onSubmit:t,onSave:n,onPageChange:e,onStepChange:o,getFileData:r,pageSize:i,loadFileList:s,step:u,stepList:l,skipBeforePageTurning:p,beforeRotate:_,checkMode:c,highlightAttribute:T,preDataProcess:f,getImgIndexByExternal:I}){const d=[];return t&&d.push(L(t)),n&&d.push(D(n)),e&&d.push(m(e)),o&&d.push(R(o)),r&&d.push(g(r)),s&&d.push(B(s)),i&&d.push(h(i)),p&&d.push(k(p)),_&&d.push(C(_)),f&&d.push(v(f)),typeof c=="boolean"&&d.push(H(c)),I&&d.push(b(I)),d.push(x(T)),d.push(F({stepList:l,step:u})),d.push({type:a.CALC_STEP_PROGRESS}),d.push({type:a.INIT_TOOL}),O=>G(O,d)}function at({onSubmit:t,onSave:n,onPageChange:e,onStepChange:o,getFileData:r,pageSize:i,loadFileList:s,stepList:u,beforeRotate:l,highlightAttribute:p,preDataProcess:_}){const c=[];return t&&c.push(L(t)),n&&c.push(D(n)),e&&c.push(m(e)),o&&c.push(R(o)),r&&c.push(g(r)),s&&c.push(B(s)),i&&c.push(h(i)),l&&c.push(C(l)),_&&c.push(v(_)),c.push(x(p)),c.push(w({stepList:u})),T=>G(T,c)}const ot=(t,n)=>{var e;const o=n==null?void 0:n.findIndex(r=>(r==null?void 0:r.step)===t);return(e=n[o+1])==null?void 0:e.step},rt=t=>(n,e)=>{const{annotation:o}=e(),{step:r,stepList:i}=o,s=ot(r,i);return[n(M(s,t))]},M=(t,n)=>(e,o)=>{var r,i;const{annotation:s}=o();(r=s==null?void 0:s.onStepChange)==null||r.call(s,t);const u=(i=s==null?void 0:s.imgIndex)!=null?i:0;return[e({type:a.SUBMIT_RESULT}),e({type:a.SUBMIT_FILE_DATA,payload:{submitType:E.StepChanged}}),e({type:a.SET_STEP,payload:{toStep:t}}),e({type:a.CALC_STEP_PROGRESS}),e(N(n!=null?n:u,0))]},A=t=>n=>[n({type:a.SUBMIT_RESULT}),n({type:a.SUBMIT_FILE_DATA,payload:{submitType:t}})],it=(t,n,e,o)=>S(void 0,null,function*(){t(A(e)),yield t(K(e)),t(N(n,o))}),ut=(t,n)=>[t({type:a.SUBMIT_RESULT}),t({type:a.SET_BASIC_INDEX,payload:{basicIndex:n}})],st=(t,n)=>{t({type:a.SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED,payload:{triggerEventAfterIndexChanged:n}})},lt=(t=!1)=>(n,e)=>P(n,e,y.Backward,t),pt=(t=!1)=>(n,e)=>P(n,e,y.Forward,t),dt=(t,n=!1)=>(e,o)=>{if(t!==o().imgIndex)return P(e,o,y.Jump,n,t)},j=(t,n,e,o)=>S(void 0,null,function*(){var r;const{loadFileList:i,imgList:s,pageSize:u}=n().annotation,l=Math.floor(e/u);U(t,!0);try{const p=yield i(l,u);if(U(t,!1),!((r=p==null?void 0:p.fileList)==null?void 0:r.length)||!(p==null?void 0:p.total))throw new Error("fileList and total are required");const _=o?new Array(p.total):[...s];return _.splice(l*u,u,...p.fileList),t({type:a.UPDATE_IMG_LIST,payload:{imgList:_}}),!0}catch(p){U(t,!1),console.error(p)}}),P=(t,n,e,o=!1,r)=>S(void 0,null,function*(){var i,s;const u=n().annotation,l=W(e);let{fileIndexChanged:p,fileIndex:_,basicIndexChanged:c,basicIndex:T}=J.getNextPageInfo(e,u,r);const f=(i=u==null?void 0:u.getImgIndexByExternal)==null?void 0:i.call(u,u.imgIndex,l);if(f!==void 0&&(p=!0,_=f),st(t,o),p){if(u.loading||!u.imgList[_]&&!(yield j(t,n,_)))return;const I=n();(s=u.onPageChange)==null||s.call(u,_);const d=l===E.Backward?q(I.annotation,T):T;return it(t,_,l,d)}return c?ut(t,T):t(A(l))}),ct=t=>{t(A(E.Save)),t({type:a.SAVE_RESULT})},U=(t,n)=>{t({type:a.SET_LOADING,payload:{loading:n}})},_t=(t,n)=>{t({type:a.SET_LOADPCDFILE_LOADING,payload:{loadPCDFileLoading:n}})},Tt=t=>{t({type:a.INIT_ALL_STATE,payload:{}})},Et=(t,n)=>{t({type:a.SET_PREDICT_RESULT,payload:{result:n}})},yt=(t,n)=>{t({type:a.SET_PREDICT_RESULT_VISIBLE,payload:{visible:n}})},ft=(t,n)=>(e,o)=>{const{imgList:r,step:i}=o().annotation;return Y(r,i,t,n)},It=t=>(n,e)=>{var o,r;const{annotation:i}=e();return(r=(o=i==null?void 0:i.preDataProcess)==null?void 0:o.call(i,t))!=null?r:t.dataList},K=t=>(n,e)=>S(void 0,null,function*(){const{annotation:o}=e(),{onSubmit:r,imgIndex:i,imgList:s}=o;!r||(yield r([s[i]],t,i,s))});export{nt as BatchUpdateImgListResultByPredictResult,tt as BatchUpdateResultByTrackID,Q as BatchUpdateTrackID,ct as ChangeSave,$ as CopyBackWordResult,P as DispatcherTurning,ft as GetBoxesByID,Tt as InitAnnotationState,et as InitTaskData,lt as PageBackward,pt as PageForward,dt as PageJump,It as PreDataProcess,U as SetAnnotationLoading,_t as SetLoadPCDFileLoading,Et as SetPredictResult,yt as SetPredictResultVisible,F as SetTaskConfig,w as SetTaskStepList,K as SubmitHandler,rt as ToNextStep,A as ToSubmitFileData,C as UpdateBeforeRotate,H as UpdateCheckMode,g as UpdateGetFileData,B as UpdateGetFileList,x as UpdateHighlightAttribute,b as UpdateImgIndexByExternal,at as UpdateInjectFunc,m as UpdateOnPageChange,D as UpdateOnSave,R as UpdateOnStepChange,L as UpdateOnSubmit,h as UpdatePageSize,v as UpdatePreDataProcess,M as UpdateProcessingStep,Z as UpdateRotate,k as UpdateSkipBeforePageTurning,z as UpdateToolInstance,j as loadImgList};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getFormatSize as yt}from"../../components/customResizeHook/index.js";import{ESubmitType as W}from"../../constant/index.js";import Rt from"../../constant/styleString.js";import{ANNOTATION_ACTIONS as i}from"../Actions.js";import{jsonParser as x}from"../../utils/index.js";import Y from"../../utils/AnnotationDataUtils.js";import{ConfigUtils as Pt}from"../../utils/ConfigUtils.js";import{composeResultWithBasicImgInfo as dt,composeResult as J}from"../../utils/data.js";import h from"../../utils/StepUtils.js";import q from"../../utils/ToolUtils.js";import{MathUtils as pt,CommonToolUtils as Ct,AnnotationEngine as ht,ImgUtils as Ot}from"@labelbee/lb-annotation";import{PointCloudUtils as gt,i18n as M}from"@labelbee/lb-utils";import{Modal as _t}from"antd";import{message as It}from"antd/es";import mt from"lodash";import{SetAnnotationLoading as $}from"./actionCreators.js";import{EToolName as w}from"../../data/enums/ToolType.js";var bt=Object.defineProperty,Nt=Object.defineProperties,Ut=Object.getOwnPropertyDescriptors,ft=Object.getOwnPropertySymbols,Bt=Object.prototype.hasOwnProperty,xt=Object.prototype.propertyIsEnumerable,Lt=(t,e,u)=>e in t?bt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:u}):t[e]=u,o=(t,e)=>{for(var u in e||(e={}))Bt.call(e,u)&&Lt(t,u,e[u]);if(ft)for(var u of ft(e))xt.call(e,u)&&Lt(t,u,e[u]);return t},s=(t,e)=>Nt(t,Ut(e)),Tt=(t,e,u)=>new Promise((S,d)=>{var A=m=>{try{E(u.next(m))}catch(y){d(y)}},T=m=>{try{E(u.throw(m))}catch(y){d(y)}},E=m=>m.done?S(m.value):Promise.resolve(m.value).then(A,T);E((u=u.apply(t,e)).next())});const F=(t,e)=>t.find(u=>u.step===e),Et={annotationEngine:null,toolInstance:null,imgList:[],config:"{}",imgIndex:-1,basicIndex:0,imgPageSize:1,step:1,stepList:[],imgNode:new Image,basicResultList:[],resultList:[],stepProgress:0,loading:!1,loadPCDFileLoading:!0,triggerEventAfterIndexChanged:!1,pointCloudLoading:!1,checkMode:!1,predictionResult:[],predictionResultVisible:!1,highlightAttribute:""},wt=t=>{const{imgList:e,imgPageSize:u}=t;return Math.ceil(e.length/u)},St=(t,e)=>t.reduce((u,S)=>{if(S){const d=S.result;if(x(d)[`step_${e}`])return u+1}return u},0)/t.length,Ft=(t,e)=>{const{step:u,stepList:S}=t,d=h.getCurrentStepInfo(u,S),A=Pt.jsonParser(d.config);if(q.isVideoTool(d==null?void 0:d.tool)||q.isAudioTool(d==null?void 0:d.tool)||q.isPointCloudTool(d==null?void 0:d.tool)||[w.LLM,w.NLP,w.LLMMultiWheel].includes(d==null?void 0:d.tool))return;const T=document.getElementById("toolContainer");if(!T)throw"Not exist dom named id-toolContainer";const E=yt({width:window.innerWidth,height:window.innerHeight}),m=new ht({container:T,toolName:d.tool,size:E,imgNode:e,config:A,style:JSON.parse(Rt)});return{toolInstance:m==null?void 0:m.toolInstance,annotationEngine:m}},jt=(t,e)=>(u,S)=>Tt(void 0,null,function*(){var d,A;const{stepList:T,step:E}=S().annotation,m=h.currentToolIsVideo(E,T),y=h.currentToolIsPointCloud(E,T),O=[w.LLM,w.LLMMultiWheel].includes((d=h.getCurrentStepInfo(E,T))==null?void 0:d.tool),b=((A=h.getCurrentStepInfo(E,T))==null?void 0:A.tool)===w.NLP,N=h.currentToolIsAudio(E,T);if($(u,!0),yield u(Gt(t)),m){u(Mt(t));return}if(y||O||N||b){u(Vt(t));return}u(kt(t,e))}),Gt=t=>(e,u)=>Tt(void 0,null,function*(){const{getFileData:S,imgList:d}=u().annotation;if(S){const A=yield S(d[t],t);e({type:i.SET_FILE_DATA,payload:{fileData:A,index:t}})}}),Mt=t=>e=>{e({type:i.LOAD_FILE_DATA,payload:{nextIndex:t}})},Vt=t=>e=>{$(e,!1),e({type:i.LOAD_FILE_DATA,payload:{nextIndex:t}})},kt=(t,e)=>(u,S)=>{var d;const{toolInstance:A,imgList:T}=S().annotation,E=(d=T==null?void 0:T[t])==null?void 0:d.url;Ot.load(E).then(m=>{$(u,!1),u({type:i.LOAD_FILE_DATA,payload:{imgNode:m,nextIndex:t,nextBasicIndex:e}})}).catch(()=>{$(u,!1),A==null||A.setErrorImg(),u({type:i.LOAD_FILE_DATA,payload:{nextIndex:t,nextBasicIndex:e}})})},Ht=({toolInstance:t,imgList:e,imgIndex:u,stepList:S,step:d=1})=>{var A,T,E,m;const y=((A=e[u])==null?void 0:A.result)||"",[O,b,N]=(T=t==null?void 0:t.exportData())!=null?T:[],V=(m=(E=t==null?void 0:t.exportCustomData)==null?void 0:E.call(t))!=null?m:{},k=dt(y,b),H=J(k,{step:d,stepList:S},{rect:O},V);return e.map((j,z)=>z===u?o(s(o({},j),{result:H}),N):o({},j))},zt=(t=o({},Et),e)=>{var u,S,d,A,T,E,m,y,O,b,N,V,k,H,j,z,Z,Q,tt,et,nt,ot,lt,st,it,rt,ut,at;switch(e.type){case i.INIT_ALL_STATE:return o(o({},t),Et);case i.UPDATE_TOOL_INSTANCE:return s(o({},t),{toolInstance:e.payload.toolInstance});case i.UPDATE_IMG_LIST:return s(o({},t),{imgList:e.payload.imgList});case i.CALC_STEP_PROGRESS:{const{imgList:n,step:l}=t,r=St(n,l);return s(o({},t),{stepProgress:r})}case i.SUBMIT_FILE_DATA:{const{imgList:n,imgIndex:l,step:r,stepList:a,toolInstance:p,onSubmit:c,resultList:f}=t;if(!p||!n[l])return t;const I=((u=n[l])==null?void 0:u.result)||"",[,_,g]=(S=p==null?void 0:p.exportData())!=null?S:[],L=(A=(d=p==null?void 0:p.exportCustomData)==null?void 0:d.call(p))!=null?A:{},D=dt(I,_),v=J(D,{step:r,stepList:a},{rect:f},L),P=t.imgList.map((C,R)=>{if(R===l){const G=Y.dataCorrection(v,I,r,a);return o(s(o({},C),{result:G}),g)}return C});if(((T=e.payload)==null?void 0:T.submitType)===W.SyncImgList)return s(o({},t),{imgList:P});const U=St(P,r);return s(o({},t),{stepProgress:U,imgList:P})}case i.SAVE_RESULT:{const{imgList:n,imgIndex:l,onSave:r}=t;return r==null||r(n[l],l,n),o({},t)}case i.SUBMIT_RESULT:{const{imgList:n,basicIndex:l,resultList:r,toolInstance:a,basicResultList:p}=t;if(!a)return t;const[c]=(E=a==null?void 0:a.exportData())!=null?E:[];let f=c;if((p==null?void 0:p.length)>0){const I=(m=p[l])==null?void 0:m.id,_=c.map(g=>s(o({},g),{sourceID:I}));f=mt.cloneDeep(r).filter(g=>g.sourceID!==I),f.push(..._)}return s(o({},t),{resultList:f,imgList:n})}case i.SET_BASIC_INDEX:{const{toolInstance:n,step:l,imgList:r,imgIndex:a,stepList:p,annotationEngine:c,resultList:f,basicResultList:I}=t;if(!n||!c)return t;const _=e.payload.basicIndex,g=(y=I[_])==null?void 0:y.id,L=x((O=r[a])==null?void 0:O.result),D=(f||[]).filter(G=>G.sourceID===g),v=F(p,l),{dataSourceStep:P,tool:U}=v,C=F(p,P);let R=[];return P&&U&&(R=(b=L[`step_${P}`])==null?void 0:b.result,(R==null?void 0:R.length)>0?(c==null||c.setBasicInfo(C.tool,R[_]),c==null||c.launchOperation()):(c==null||c.setBasicInfo(C.tool),c==null||c.forbidOperation(),It.info(M.t("NoDependency")))),n==null||n.setResult(D),n==null||n.history.initRecord(D,!0),s(o({},t),{basicIndex:_})}case i.SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED:{const{triggerEventAfterIndexChanged:n}=e.payload;return s(o({},t),{triggerEventAfterIndexChanged:!!n})}case i.LOAD_FILE_DATA:{const{imgList:n,step:l,toolInstance:r,annotationEngine:a,stepList:p}=t;if(!r)return s(o({},t),{imgIndex:e.payload.nextIndex});const c=h.getCurrentStepInfo(l,p),{nextIndex:f,imgNode:I,nextBasicIndex:_,imgError:g}=e.payload,L=_!=null?_:0,D=x((N=n[f])==null?void 0:N.result),v=D[`step_${c.step}`],P=!v,U={rotate:(V=D.rotate)!=null?V:0,valid:(k=D.valid)!=null?k:!0};I&&g!==!0?a==null||a.setImgNode(I,U):r==null||r.setValid(U.valid);const C=F(p,c.step),{dataSourceStep:R,tool:G}=C,ct=F(p,R),X=R&&G,B=(j=(H=D[`step_${R}`])==null?void 0:H.result)!=null?j:[],K=Y.getInitialResultList(v==null?void 0:v.result,r,C,B,P);if(a==null||a.launchOperation(),X&&((B==null?void 0:B.length)>0?a==null||a.setBasicInfo(ct.tool,B[L]):(a==null||a.setBasicInfo(ct.tool),a==null||a.forbidOperation(),It.info(M.t("NoDependency")))),c.tool!=="check"&&X){const At=(Z=(z=B[L])==null?void 0:z.id)!=null?Z:"",Dt=X?K.filter(vt=>Ct.isSameSourceID(vt.sourceID,At)):K;(Q=r==null?void 0:r.history)==null||Q.initRecord(K,!0),r==null||r.setResult(Dt)}return s(o({},t),{imgIndex:f,basicIndex:L,basicResultList:B,resultList:K})}case i.UPDATE_ANNOTATION_CONFIG:return s(o({},t),{config:(tt=e.payload.config)!=null?tt:"{}"});case i.SET_TASK_STEP_LIST:{const{stepList:n}=e.payload;return s(o({},t),{stepList:n})}case i.SET_TASK_CONFIG:{const{stepList:n,step:l}=e.payload;return s(o({},t),{stepList:n,step:l})}case i.INIT_TOOL:{const{imgNode:n}=t,l=Ft(t,n);if(l){const{toolInstance:r,annotationEngine:a}=l;return s(o({},t),{toolInstance:r,annotationEngine:a})}return o({},t)}case i.SET_TOOL:{const n=(et=e.payload)==null?void 0:et.instance;return n?s(o({},t),{toolInstance:n}):o({},t)}case i.UPDATE_ON_SUBMIT:return s(o({},t),{onSubmit:e.payload.onSubmit});case i.UPDATE_ON_SAVE:return s(o({},t),{onSave:e.payload.onSave});case i.UPDATE_ON_PAGE_CHANGE:return s(o({},t),{onPageChange:e.payload.onPageChange});case i.SET_PREDICT_RESULT:return s(o({},t),{predictionResult:e.payload.result});case i.SET_PREDICT_RESULT_VISIBLE:return s(o({},t),{predictionResultVisible:e.payload.visible});case i.UPDATE_ON_STEP_CHANGE:return s(o({},t),{onStepChange:e.payload.onStepChange});case i.UPDATE_GET_FILE_DATA:return s(o({},t),{getFileData:e.payload.getFileData});case i.UPDATE_PAGE_SIZE:return s(o({},t),{pageSize:e.payload.pageSize});case i.UPDATE_LOAD_FILE_LIST:return s(o({},t),{loadFileList:e.payload.loadFileList});case i.UPDATE_BEFORE_ROTATE:return s(o({},t),{beforeRotate:e.payload.beforeRotate});case i.UPDATE_PRE_DATA_PROCESS:return s(o({},t),{preDataProcess:e.payload.preDataProcess});case i.UPDATE_IMG_INDEX_BY_EXTERNAL:return s(o({},t),{getImgIndexByExternal:e.payload.getImgIndexByExternal});case i.SKIP_BEFORE_PAGE_TURNING:return s(o({},t),{skipBeforePageTurning:e.payload.skipBeforePageTurning});case i.SET_FILE_DATA:{const{fileData:n,index:l}=e.payload,{imgList:r}=t,a=[...r];return a[l]=o(o({},a[l]),n),s(o({},t),{imgList:a})}case i.UPDATE_ROTATE:{const{toolInstance:n,beforeRotate:l}=t;return l&&l()===!1||(nt=n==null?void 0:n.updateRotate)==null||nt.call(n),t}case i.UPDATE_ANNOTATION_VALID:{const{toolInstance:n}=t,l=(ot=n==null?void 0:n.valid)!=null?ot:!0;return _t.destroyAll(),_t.confirm({content:M.t(l?"updateValidFromValidToInValid":"updateValidFromInValidToValid"),onOk:()=>{n==null||n.setValid(!l)},okText:M.t("Confirm"),cancelText:M.t("Cancel")}),t}case i.COPY_BACKWARD_RESULT:{const{toolInstance:n,imgIndex:l,imgList:r,step:a,stepList:p}=t;if(!n)return t;if(l===0||l>=r.length)return console.error("\u65E0\u6CD5\u590D\u5236\u8FB9\u754C\u5916\u7684\u5185\u5BB9"),t;const c=r[l-1].result;if(!c)return t;const f=h.getCurrentStepInfo(a,p),I=(lt=f==null?void 0:f.step)!=null?lt:a,_=(st=n==null?void 0:n.valid)!=null?st:!0,g=Y.copyResultChange({copyResult:c,step:I,currentResult:(it=r[l].result)!=null?it:"",preMappingImgList:(rt=r[l-1].mappingImgList)!=null?rt:[],mappingImgList:(ut=r[l].mappingImgList)!=null?ut:[],valid:_});r[l]=s(o({},r[l]),{result:g});const D=x(g)[`step_${a}`],v=(D==null?void 0:D.result)||[];return n==null||n.setResult(v),n==null||n.history.pushHistory(v),(at=n==null?void 0:n.asyncData)==null||at.call(n,r[l]),s(o({},t),{imgList:[...r]})}case i.SET_STEP:{const{stepList:n,annotationEngine:l}=t,{toStep:r}=e.payload;if(l){const a=F(n,r);return l==null||l.setToolName(a.tool,a.config),s(o({},t),{step:r,toolInstance:l==null?void 0:l.toolInstance})}return s(o({},t),{step:r})}case i.SET_LOADPCDFILE_LOADING:{const{loadPCDFileLoading:n}=e.payload;return s(o({},t),{loadPCDFileLoading:!!n})}case i.SET_LOADING:{const{loading:n}=e.payload;return s(o({},t),{loading:!!n})}case i.SET_POINT_CLOUD_LOADING:{const{pointCloudLoading:n}=e.payload;return s(o({},t),{pointCloudLoading:!!n})}case i.SET_CHECK_MODE:{const{checkMode:n}=e.payload;return s(o({},t),{checkMode:!!n})}case i.SET_HIGHLIGHT_ATTRIBUTE:{const{attribute:n}=e.payload;return s(o({},t),{highlightAttribute:n})}case i.BATCH_UPDATE_TRACK_ID:{const{id:n,newID:l,rangeIndex:r,imgList:a}=e.payload,{imgIndex:p,onSubmit:c}=t,f=[],I=a.map((_,g)=>{if(pt.isInRange(g,r)){const L=s(o({},_),{result:gt.batchUpdateTrackID({id:n,newID:l,result:_.result})});return f.push({imgIndex:g,newInfo:L}),L}return _});return c&&c([I[p]],W.BatchUpdateTrackID,p,I,{updateImgList:f}),s(o({},t),{imgList:I})}case i.BATCH_UPDATE_RESULT_BY_TRACK_ID:{const{id:n,newData:l,rangeIndex:r}=e.payload,{imgList:a,imgIndex:p,onSubmit:c}=t,f=[],I=a.map((_,g)=>{if(pt.isInRange(g,r)){const L=s(o({},_),{result:gt.batchUpdateResultByTrackID({id:n,newData:l,result:_.result})});return f.push({imgIndex:g,newInfo:L}),L}return _});return c&&c([I[p]],W.BatchUpdateTrackID,p,I,{updateImgList:f}),s(o({},t),{imgList:I})}case i.BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT:{const{onSubmit:n,imgList:l,stepList:r,step:a,predictionResult:p}=t,c={};p.forEach(g=>{const{index:L}=g;c[L]=mt.pick(g,["center","width","height","depth","rotation","id","attribute","valid","trackID"])});const f=`step_${a}`,I=[],_=l.map((g,L)=>{if(c[L]){const D=g.result==="{}"?x(J("",{step:a,stepList:r},{rect:[]},{})):x(g.result);D[f].result.push(c[L]);const v=s(o({},g),{result:JSON.stringify(D)});return I.push({imgIndex:L,newInfo:v}),v}return g});return n==null||n(_,W.BatchUpdateImgList,-1,_,{updateImgList:I}),s(o({},t),{imgList:_})}default:return t}};export{jt as LoadFileAndFileData,zt as annotationReducer,Ht as composeResultByToolInstance,F as getStepConfig,wt as getTotalPage};
|
|
1
|
+
import{getFormatSize as yt}from"../../components/customResizeHook/index.js";import{ESubmitType as W}from"../../constant/index.js";import Rt from"../../constant/styleString.js";import{ANNOTATION_ACTIONS as i}from"../Actions.js";import{jsonParser as w}from"../../utils/index.js";import Y from"../../utils/AnnotationDataUtils.js";import{ConfigUtils as Pt}from"../../utils/ConfigUtils.js";import{composeResultWithBasicImgInfo as dt,composeResult as J}from"../../utils/data.js";import h from"../../utils/StepUtils.js";import q from"../../utils/ToolUtils.js";import{MathUtils as pt,CommonToolUtils as Ct,AnnotationEngine as ht,ImgUtils as Ot}from"@labelbee/lb-annotation";import{PointCloudUtils as gt,i18n as M}from"@labelbee/lb-utils";import{Modal as _t}from"antd";import{message as It}from"antd/es";import mt from"lodash";import{SetAnnotationLoading as $}from"./actionCreators.js";import{EToolName as x}from"../../data/enums/ToolType.js";var bt=Object.defineProperty,Nt=Object.defineProperties,Ut=Object.getOwnPropertyDescriptors,ft=Object.getOwnPropertySymbols,Bt=Object.prototype.hasOwnProperty,wt=Object.prototype.propertyIsEnumerable,Lt=(t,e,u)=>e in t?bt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:u}):t[e]=u,o=(t,e)=>{for(var u in e||(e={}))Bt.call(e,u)&&Lt(t,u,e[u]);if(ft)for(var u of ft(e))wt.call(e,u)&&Lt(t,u,e[u]);return t},s=(t,e)=>Nt(t,Ut(e)),Tt=(t,e,u)=>new Promise((S,d)=>{var A=m=>{try{E(u.next(m))}catch(y){d(y)}},T=m=>{try{E(u.throw(m))}catch(y){d(y)}},E=m=>m.done?S(m.value):Promise.resolve(m.value).then(A,T);E((u=u.apply(t,e)).next())});const F=(t,e)=>t.find(u=>u.step===e),Et={annotationEngine:null,toolInstance:null,imgList:[],config:"{}",imgIndex:-1,basicIndex:0,imgPageSize:1,step:1,stepList:[],imgNode:new Image,basicResultList:[],resultList:[],stepProgress:0,loading:!1,loadPCDFileLoading:!0,triggerEventAfterIndexChanged:!1,pointCloudLoading:!1,checkMode:!1,predictionResult:[],predictionResultVisible:!1,highlightAttribute:""},xt=t=>{const{imgList:e,imgPageSize:u}=t;return Math.ceil(e.length/u)},St=(t,e)=>t.reduce((u,S)=>{if(S){const d=S.result;if(w(d)[`step_${e}`])return u+1}return u},0)/t.length,Ft=(t,e)=>{const{step:u,stepList:S}=t,d=h.getCurrentStepInfo(u,S),A=Pt.jsonParser(d.config);if(q.isVideoTool(d==null?void 0:d.tool)||q.isAudioTool(d==null?void 0:d.tool)||q.isPointCloudTool(d==null?void 0:d.tool)||[x.LLM,x.NLP,x.LLMMultiWheel].includes(d==null?void 0:d.tool))return;const T=document.getElementById("toolContainer");if(!T)throw"Not exist dom named id-toolContainer";const E=yt({width:window.innerWidth,height:window.innerHeight}),m=new ht({container:T,toolName:d.tool,size:E,imgNode:e,config:A,style:JSON.parse(Rt)});return{toolInstance:m==null?void 0:m.toolInstance,annotationEngine:m}},jt=(t,e)=>(u,S)=>Tt(void 0,null,function*(){var d,A;const{stepList:T,step:E}=S().annotation,m=h.currentToolIsVideo(E,T),y=h.currentToolIsPointCloud(E,T),O=[x.LLM,x.LLMMultiWheel].includes((d=h.getCurrentStepInfo(E,T))==null?void 0:d.tool),b=((A=h.getCurrentStepInfo(E,T))==null?void 0:A.tool)===x.NLP,N=h.currentToolIsAudio(E,T);if($(u,!0),yield u(Gt(t)),m){u(Mt(t));return}if(y||O||N||b){u(Vt(t));return}u(kt(t,e))}),Gt=t=>(e,u)=>Tt(void 0,null,function*(){const{getFileData:S,imgList:d}=u().annotation;if(S){const A=yield S(d[t],t);e({type:i.SET_FILE_DATA,payload:{fileData:A,index:t}})}}),Mt=t=>e=>{e({type:i.LOAD_FILE_DATA,payload:{nextIndex:t}})},Vt=t=>e=>{$(e,!1),e({type:i.LOAD_FILE_DATA,payload:{nextIndex:t}})},kt=(t,e)=>(u,S)=>{var d;const{toolInstance:A,imgList:T}=S().annotation,E=(d=T==null?void 0:T[t])==null?void 0:d.url;Ot.load(E).then(m=>{$(u,!1),u({type:i.LOAD_FILE_DATA,payload:{imgNode:m,nextIndex:t,nextBasicIndex:e}})}).catch(()=>{$(u,!1),A==null||A.setErrorImg(),u({type:i.LOAD_FILE_DATA,payload:{nextIndex:t,nextBasicIndex:e}})})},Ht=({toolInstance:t,imgList:e,imgIndex:u,stepList:S,step:d=1})=>{var A,T,E,m;const y=((A=e[u])==null?void 0:A.result)||"",[O,b,N]=(T=t==null?void 0:t.exportData())!=null?T:[],V=(m=(E=t==null?void 0:t.exportCustomData)==null?void 0:E.call(t))!=null?m:{},k=dt(y,b),H=J(k,{step:d,stepList:S},{rect:O},V);return e.map((j,z)=>z===u?o(s(o({},j),{result:H}),N):o({},j))},zt=(t=o({},Et),e)=>{var u,S,d,A,T,E,m,y,O,b,N,V,k,H,j,z,Z,Q,tt,et,nt,ot,lt,st,it,rt,ut,at;switch(e.type){case i.INIT_ALL_STATE:return o(o({},t),Et);case i.UPDATE_TOOL_INSTANCE:return s(o({},t),{toolInstance:e.payload.toolInstance});case i.UPDATE_IMG_LIST:return s(o({},t),{imgList:e.payload.imgList});case i.CALC_STEP_PROGRESS:{const{imgList:n,step:l}=t,r=St(n,l);return s(o({},t),{stepProgress:r})}case i.SUBMIT_FILE_DATA:{const{imgList:n,imgIndex:l,step:r,stepList:a,toolInstance:g,onSubmit:c,resultList:f}=t;if(!g||!n[l])return t;const I=((u=n[l])==null?void 0:u.result)||"",[,_,p]=(S=g==null?void 0:g.exportData())!=null?S:[],L=(A=(d=g==null?void 0:g.exportCustomData)==null?void 0:d.call(g))!=null?A:{},D=dt(I,_),v=J(D,{step:r,stepList:a},{rect:f},L),P=t.imgList.map((C,R)=>{if(R===l){const G=Y.dataCorrection(v,I,r,a);return o(s(o({},C),{result:G}),p)}return C});if(((T=e.payload)==null?void 0:T.submitType)===W.SyncImgList)return s(o({},t),{imgList:P});const U=St(P,r);return s(o({},t),{stepProgress:U,imgList:P})}case i.SAVE_RESULT:{const{imgList:n,imgIndex:l,onSave:r}=t;return r==null||r(n[l],l,n),o({},t)}case i.SUBMIT_RESULT:{const{imgList:n,basicIndex:l,resultList:r,toolInstance:a,basicResultList:g}=t;if(!a)return t;const[c]=(E=a==null?void 0:a.exportData())!=null?E:[];let f=c;if((g==null?void 0:g.length)>0){const I=(m=g[l])==null?void 0:m.id,_=c.map(p=>s(o({},p),{sourceID:I}));f=mt.cloneDeep(r).filter(p=>p.sourceID!==I),f.push(..._)}return s(o({},t),{resultList:f,imgList:n})}case i.SET_BASIC_INDEX:{const{toolInstance:n,step:l,imgList:r,imgIndex:a,stepList:g,annotationEngine:c,resultList:f,basicResultList:I}=t;if(!n||!c)return t;const _=e.payload.basicIndex,p=(y=I[_])==null?void 0:y.id,L=w((O=r[a])==null?void 0:O.result),D=(f||[]).filter(G=>G.sourceID===p),v=F(g,l),{dataSourceStep:P,tool:U}=v,C=F(g,P);let R=[];return P&&U&&(R=(b=L[`step_${P}`])==null?void 0:b.result,(R==null?void 0:R.length)>0?(c==null||c.setBasicInfo(C.tool,R[_]),c==null||c.launchOperation()):(c==null||c.setBasicInfo(C.tool),c==null||c.forbidOperation(),It.info(M.t("NoDependency")))),n==null||n.setResult(D),n==null||n.history.initRecord(D,!0),s(o({},t),{basicIndex:_})}case i.SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED:{const{triggerEventAfterIndexChanged:n}=e.payload;return s(o({},t),{triggerEventAfterIndexChanged:!!n})}case i.LOAD_FILE_DATA:{const{imgList:n,step:l,toolInstance:r,annotationEngine:a,stepList:g}=t;if(!r)return s(o({},t),{imgIndex:e.payload.nextIndex});const c=h.getCurrentStepInfo(l,g),{nextIndex:f,imgNode:I,nextBasicIndex:_,imgError:p}=e.payload,L=_!=null?_:0,D=w((N=n[f])==null?void 0:N.result),v=D[`step_${c.step}`],P=!v,U={rotate:(V=D.rotate)!=null?V:0,valid:(k=D.valid)!=null?k:!0};I&&p!==!0?a==null||a.setImgNode(I,U):r==null||r.setValid(U.valid);const C=F(g,c.step),{dataSourceStep:R,tool:G}=C,ct=F(g,R),X=R&&G,B=(j=(H=D[`step_${R}`])==null?void 0:H.result)!=null?j:[],K=Y.getInitialResultList(v==null?void 0:v.result,r,C,B,P);if(a==null||a.launchOperation(),X&&((B==null?void 0:B.length)>0?a==null||a.setBasicInfo(ct.tool,B[L]):(a==null||a.setBasicInfo(ct.tool),a==null||a.forbidOperation(),It.info(M.t("NoDependency")))),c.tool!=="check"&&X){const At=(Z=(z=B[L])==null?void 0:z.id)!=null?Z:"",Dt=X?K.filter(vt=>Ct.isSameSourceID(vt.sourceID,At)):K;(Q=r==null?void 0:r.history)==null||Q.initRecord(K,!0),r==null||r.setResult(Dt)}return s(o({},t),{imgIndex:f,basicIndex:L,basicResultList:B,resultList:K})}case i.UPDATE_ANNOTATION_CONFIG:return s(o({},t),{config:(tt=e.payload.config)!=null?tt:"{}"});case i.SET_TASK_STEP_LIST:{const{stepList:n}=e.payload;return s(o({},t),{stepList:n})}case i.SET_TASK_CONFIG:{const{stepList:n,step:l}=e.payload;return s(o({},t),{stepList:n,step:l})}case i.INIT_TOOL:{const{imgNode:n}=t,l=Ft(t,n);if(l){const{toolInstance:r,annotationEngine:a}=l;return s(o({},t),{toolInstance:r,annotationEngine:a})}return o({},t)}case i.SET_TOOL:{const n=(et=e.payload)==null?void 0:et.instance;return n?s(o({},t),{toolInstance:n}):o({},t)}case i.UPDATE_ON_SUBMIT:return s(o({},t),{onSubmit:e.payload.onSubmit});case i.UPDATE_ON_SAVE:return s(o({},t),{onSave:e.payload.onSave});case i.UPDATE_ON_PAGE_CHANGE:return s(o({},t),{onPageChange:e.payload.onPageChange});case i.SET_PREDICT_RESULT:return s(o({},t),{predictionResult:e.payload.result});case i.SET_PREDICT_RESULT_VISIBLE:return s(o({},t),{predictionResultVisible:e.payload.visible});case i.UPDATE_ON_STEP_CHANGE:return s(o({},t),{onStepChange:e.payload.onStepChange});case i.UPDATE_GET_FILE_DATA:return s(o({},t),{getFileData:e.payload.getFileData});case i.UPDATE_PAGE_SIZE:return s(o({},t),{pageSize:e.payload.pageSize});case i.UPDATE_LOAD_FILE_LIST:return s(o({},t),{loadFileList:e.payload.loadFileList});case i.UPDATE_BEFORE_ROTATE:return s(o({},t),{beforeRotate:e.payload.beforeRotate});case i.UPDATE_PRE_DATA_PROCESS:return s(o({},t),{preDataProcess:e.payload.preDataProcess});case i.UPDATE_IMG_INDEX_BY_EXTERNAL:return s(o({},t),{getImgIndexByExternal:e.payload.getImgIndexByExternal});case i.SKIP_BEFORE_PAGE_TURNING:return s(o({},t),{skipBeforePageTurning:e.payload.skipBeforePageTurning});case i.SET_FILE_DATA:{const{fileData:n,index:l}=e.payload,{imgList:r}=t,a=[...r];return a[l]=o(o({},a[l]),n),s(o({},t),{imgList:a})}case i.UPDATE_ROTATE:{const{toolInstance:n,beforeRotate:l}=t;return l&&l()===!1||(nt=n==null?void 0:n.updateRotate)==null||nt.call(n),t}case i.UPDATE_ANNOTATION_VALID:{const{toolInstance:n}=t,l=(ot=n==null?void 0:n.valid)!=null?ot:!0;return _t.destroyAll(),_t.confirm({content:M.t(l?"updateValidFromValidToInValid":"updateValidFromInValidToValid"),onOk:()=>{n==null||n.setValid(!l)},okText:M.t("Confirm"),cancelText:M.t("Cancel")}),t}case i.COPY_BACKWARD_RESULT:{const{toolInstance:n,imgIndex:l,imgList:r,step:a,stepList:g}=t;if(!n)return t;if(l===0||l>=r.length)return console.error("\u65E0\u6CD5\u590D\u5236\u8FB9\u754C\u5916\u7684\u5185\u5BB9"),t;const c=r[l-1].result;if(!c)return t;const f=h.getCurrentStepInfo(a,g),I=(lt=f==null?void 0:f.step)!=null?lt:a,_=(st=n==null?void 0:n.valid)!=null?st:!0,p=Y.copyResultChange({copyResult:c,step:I,currentResult:(it=r[l].result)!=null?it:"",preMappingImgList:(rt=r[l-1].mappingImgList)!=null?rt:[],mappingImgList:(ut=r[l].mappingImgList)!=null?ut:[],valid:_});r[l]=s(o({},r[l]),{result:p});const D=w(p)[`step_${a}`],v=(D==null?void 0:D.result)||[];return n==null||n.setResult(v),n==null||n.history.pushHistory(v),(at=n==null?void 0:n.asyncData)==null||at.call(n,r[l]),s(o({},t),{imgList:[...r]})}case i.SET_STEP:{const{stepList:n,annotationEngine:l}=t,{toStep:r}=e.payload;if(l){const a=F(n,r);return l==null||l.setToolName(a.tool,a.config),s(o({},t),{step:r,toolInstance:l==null?void 0:l.toolInstance})}return s(o({},t),{step:r})}case i.SET_LOADPCDFILE_LOADING:{const{loadPCDFileLoading:n}=e.payload;return s(o({},t),{loadPCDFileLoading:!!n})}case i.SET_LOADING:{const{loading:n}=e.payload;return s(o({},t),{loading:!!n})}case i.SET_POINT_CLOUD_LOADING:{const{pointCloudLoading:n}=e.payload;return s(o({},t),{pointCloudLoading:!!n})}case i.SET_CHECK_MODE:{const{checkMode:n}=e.payload;return s(o({},t),{checkMode:!!n})}case i.SET_HIGHLIGHT_ATTRIBUTE:{const{attribute:n}=e.payload;return s(o({},t),{highlightAttribute:n})}case i.BATCH_UPDATE_TRACK_ID:{const{id:n,newID:l,rangeIndex:r,imgList:a}=e.payload,{imgIndex:g,onSubmit:c}=t,f=[],I=a.map((_,p)=>{if(pt.isInRange(p,r)){const L=s(o({},_),{result:gt.batchUpdateTrackID({id:n,newID:l,result:_.result})});return f.push({imgIndex:p,newInfo:L}),L}return _});return c&&c([I[g]],W.BatchUpdateTrackID,g,I,{updateImgList:f}),s(o({},t),{imgList:I})}case i.BATCH_UPDATE_RESULT_BY_TRACK_ID:{const n=e,{id:l,newData:r,rangeIndex:a,imgList:g}=n.payload,{imgIndex:c,onSubmit:f}=t,I=[],_=g.map((p,L)=>{if(pt.isInRange(L,a)){const D=s(o({},p),{result:gt.batchUpdateResultByTrackID({id:l,newData:r,result:p.result})});return I.push({imgIndex:L,newInfo:D}),D}return p});return f&&f([_[c]],W.BatchUpdateTrackID,c,_,{updateImgList:I}),s(o({},t),{imgList:_})}case i.BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT:{const{onSubmit:n,imgList:l,stepList:r,step:a,predictionResult:g}=t,c={};g.forEach(p=>{const{index:L}=p;c[L]=mt.pick(p,["center","width","height","depth","rotation","id","attribute","valid","trackID"])});const f=`step_${a}`,I=[],_=l.map((p,L)=>{if(c[L]){const D=p.result==="{}"?w(J("",{step:a,stepList:r},{rect:[]},{})):w(p.result);D[f].result.push(c[L]);const v=s(o({},p),{result:JSON.stringify(D)});return I.push({imgIndex:L,newInfo:v}),v}return p});return n==null||n(_,W.BatchUpdateImgList,-1,_,{updateImgList:I}),s(o({},t),{imgList:_})}default:return t}};export{jt as LoadFileAndFileData,zt as annotationReducer,Ht as composeResultByToolInstance,F as getStepConfig,xt as getTotalPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{EToolName as
|
|
1
|
+
import{EToolName as t}from"../../../data/enums/ToolType.js";import e from"react";import{sidebarCls as n}from"./index.js";import E from"../../../assets/annotation/lineTool/icon_line.svg.js";import N from"../../../assets/annotation/lineTool/icon_line_a.svg.js";import S from"../../../assets/annotation/pointTool/icon_point.svg.js";import y from"../../../assets/annotation/pointTool/icon_point_a.svg.js";import P from"../../../assets/annotation/polygonTool/icon_polygon_a.svg.js";import R from"../../../assets/annotation/polygonTool/icon_polygon.svg.js";import{cTool as w}from"@labelbee/lb-annotation";import O from"classnames";import{useTranslation as $}from"react-i18next";import{Dropdown as j}from"antd";import{DownOutlined as C}from"@ant-design/icons";import{ReactComponent as c}from"../../../assets/annotation/rectTool/two_points_rect.svg.js";import{ReactComponent as u}from"../../../assets/annotation/rectTool/three_points_rect.svg.js";import{useLocalStorageState as M}from"ahooks";const{EPointCloudName:b,TOOL_NAME:h,TOOL_NAME_EN:k,ERectToolModeType:l,RECT_TOOL_MODE_NAME:L}=w,d=[{toolName:t.Rect,dropdownItems:[{key:l.ThreePoints,icon:e.createElement(u,null),label:"\u4E09\u70B9\u753B\u77E9\u5F62"},{key:l.TwoPoints,icon:e.createElement(c,null),label:"\u4E24\u70B9\u753B\u77E9\u5F62"}]},{toolName:t.Polygon,commonSvg:R,selectedSvg:P},{toolName:t.Line,commonSvg:E,selectedSvg:N},{toolName:t.Point,commonSvg:S,selectedSvg:y}],B=s=>s==="en"?k:h,x=({toolName:s,selectedToolName:p,onChange:r})=>{const{i18n:g}=$(),m=d==null?void 0:d.filter(o=>s===b.PointCloud?[t.Polygon,t.Rect,t.Point,t.Line].includes(o==null?void 0:o.toolName):(o==null?void 0:o.toolName)===s),_=m.length>1,[a,T]=M(L,{defaultValue:l.ThreePoints,serializer:o=>o!=null?o:"",deserializer:o=>o}),v=a===l.TwoPoints?c:u,f=o=>{T(o.key)};return e.createElement("div",{className:`${n}__level`},m.map(o=>{const i=_&&p===o.toolName;return e.createElement("span",{className:`${n}__toolOption`,key:o.toolName,onClick:()=>r==null?void 0:r(o.toolName)},o.dropdownItems?e.createElement(j,{overlayClassName:`${n}__dropdown`,menu:{items:o.dropdownItems,selectable:!0,defaultSelectedKeys:a?[a]:[],onClick:f}},e.createElement("div",{className:`${n}__multiBox`,style:{color:i?"#666fff":"#999999"}},e.createElement(v,null),e.createElement(C,null))):e.createElement("img",{className:`${n}__singleTool`,src:i?o==null?void 0:o.selectedSvg:o==null?void 0:o.commonSvg}),e.createElement("span",{className:O({[`${n}__toolOption__selected`]:i})},B(g.language)[o.toolName]))}))};export{x as ToolIcons};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@labelbee/lb-components",
|
|
3
|
-
"version": "1.24.0-alpha.
|
|
3
|
+
"version": "1.24.0-alpha.9",
|
|
4
4
|
"description": "Provide a complete library of annotation components",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"es": "./es/index.js",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@ant-design/icons": "^4.6.2",
|
|
46
|
-
"@labelbee/lb-annotation": "1.28.0-alpha.
|
|
46
|
+
"@labelbee/lb-annotation": "1.28.0-alpha.5",
|
|
47
47
|
"@labelbee/lb-utils": "1.19.0",
|
|
48
48
|
"@labelbee/wavesurfer": "1.1.0",
|
|
49
49
|
"@types/react-dom": "^18.2.7",
|