@labelbee/lb-components 1.23.0-alpha.47 → 1.23.0-alpha.48
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/components/pointCloud2DRectOperationView/index.js +1 -1
- package/dist/components/pointCloudView/PointCloud2DSingleView.js +1 -1
- package/dist/components/pointCloudView/PointCloudContext.js +1 -1
- package/dist/components/pointCloudView/PointCloudListener.js +1 -1
- package/dist/components/pointCloudView/hooks/useDataLinkSwitch.js +1 -1
- package/dist/components/pointCloudView/hooks/useSingleBox.js +1 -1
- package/dist/components/pointCloudView/utils/map.js +1 -0
- package/dist/index.js +1 -1
- package/dist/types/components/pointCloudView/PointCloudContext.d.ts +7 -5
- package/dist/types/components/pointCloudView/hooks/useSingleBox.d.ts +2 -1
- package/dist/types/components/pointCloudView/utils/map.d.ts +11 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/views/MainView/toolFooter/BatchSwitchConnectIn2DView/BatchSwitchConnectIn2DView.d.ts +9 -0
- package/dist/types/views/MainView/toolFooter/BatchSwitchConnectIn2DView/index.d.ts +1 -0
- package/dist/views/MainView/toolFooter/BatchSwitchConnectIn2DView/BatchSwitchConnectIn2DView.js +1 -0
- package/es/components/pointCloud2DRectOperationView/index.js +1 -1
- package/es/components/pointCloudView/PointCloud2DSingleView.js +1 -1
- package/es/components/pointCloudView/PointCloudContext.js +1 -1
- package/es/components/pointCloudView/PointCloudListener.js +1 -1
- package/es/components/pointCloudView/hooks/useDataLinkSwitch.js +1 -1
- package/es/components/pointCloudView/hooks/useSingleBox.js +1 -1
- package/es/components/pointCloudView/utils/map.js +1 -0
- package/es/index.js +1 -1
- package/es/views/MainView/toolFooter/BatchSwitchConnectIn2DView/BatchSwitchConnectIn2DView.js +1 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var ahooks=require("ahooks"),es=require("antd/es"),React=require("react"),reactRedux=require("react-redux"),usePointCloudViews=require("../pointCloudView/hooks/usePointCloudViews.js"),PointCloudContext=require("../pointCloudView/PointCloudContext.js"),map=require("../../store/annotation/map.js"),ctx=require("../../store/ctx.js"),lbAnnotation=require("@labelbee/lb-annotation");function _interopDefaultLegacy(u){return u&&typeof u=="object"&&"default"in u?u:{default:u}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(u,i,l)=>i in u?__defProp(u,i,{enumerable:!0,configurable:!0,writable:!0,value:l}):u[i]=l,__spreadValues=(u,i)=>{for(var l in i||(i={}))__hasOwnProp.call(i,l)&&__defNormalProp(u,l,i[l]);if(__getOwnPropSymbols)for(var l of __getOwnPropSymbols(i))__propIsEnum.call(i,l)&&__defNormalProp(u,l,i[l]);return u},__spreadProps=(u,i)=>__defProps(u,__getOwnPropDescs(i)),__async=(u,i,l)=>new Promise((
|
|
1
|
+
"use strict";var ahooks=require("ahooks"),es=require("antd/es"),React=require("react"),reactRedux=require("react-redux"),usePointCloudViews=require("../pointCloudView/hooks/usePointCloudViews.js"),PointCloudContext=require("../pointCloudView/PointCloudContext.js"),map=require("../../store/annotation/map.js"),ctx=require("../../store/ctx.js"),lbAnnotation=require("@labelbee/lb-annotation");function _interopDefaultLegacy(u){return u&&typeof u=="object"&&"default"in u?u:{default:u}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(u,i,l)=>i in u?__defProp(u,i,{enumerable:!0,configurable:!0,writable:!0,value:l}):u[i]=l,__spreadValues=(u,i)=>{for(var l in i||(i={}))__hasOwnProp.call(i,l)&&__defNormalProp(u,l,i[l]);if(__getOwnPropSymbols)for(var l of __getOwnPropSymbols(i))__propIsEnum.call(i,l)&&__defNormalProp(u,l,i[l]);return u},__spreadProps=(u,i)=>__defProps(u,__getOwnPropDescs(i)),__async=(u,i,l)=>new Promise((a,d)=>{var v=s=>{try{p(l.next(s))}catch(f){d(f)}},D=s=>{try{p(l.throw(s))}catch(f){d(f)}},p=s=>s.done?a(s.value):Promise.resolve(s.value).then(v,D);p((l=l.apply(u,i)).next())});const PointCloud2DRectOperationView=u=>{var i,l;const{mappingData:a,size:d,config:v,checkMode:D,afterImgOnLoad:p,shouldExcludePointCloudBoxListUpdate:s}=u,f=(i=a==null?void 0:a.url)!=null?i:"",_=(l=a==null?void 0:a.fallbackUrl)!=null?l:"",{pointCloudBoxList:w,setPointCloudResult:I,defaultAttribute:P,rectList:h,addRectIn2DView:q,updateRectIn2DView:O,removeRectIn2DView:B}=React.useContext(PointCloudContext.PointCloudContext),{update2DViewRect:M,remove2DViewRect:z}=usePointCloudViews.usePointCloudViews(),x=React__default.default.useRef(null),r=React.useRef(null),E=ahooks.useMemoizedFn(M),g=ahooks.useMemoizedFn(z),R=React.useRef(null),[A,L]=React.useState(!0),C=React.useMemo(()=>h==null?void 0:h.filter(e=>e.imageName===(a==null?void 0:a.path)),[a==null?void 0:a.path,h]),b=ahooks.useLatest(a==null?void 0:a.path),V=e=>{const{boxID:o}=e;if(!s&&o){const t=E==null?void 0:E(e);R.current=t,I(t);return}O(e,!0)},S=e=>{b.current&&q(__spreadProps(__spreadValues({},e),{imageName:b.current}))},N=e=>{if(e.length===0)return;if(!s){const t=e.find(n=>n.boxID);if(t){const n=g==null?void 0:g(t);R.current=n,I(n),m();return}}const o=e.find(t=>t.extId);if(o){const{imageName:t,extId:n}=o,c=g==null?void 0:g({boxID:n,imageName:t});R.current=c,I(c)}B(e)},F=ahooks.useMemoizedFn(()=>{let e=[];return w.forEach(o=>{const{rects:t=[],id:n,attribute:c,trackID:y}=o,j=t.find(k=>k.imageName===b.current),U=n+"_"+b.current;j&&(e=[...e,__spreadProps(__spreadValues({},j),{boxID:n,id:U,attribute:c,order:y})])}),e}),m=ahooks.useMemoizedFn(()=>{var e,o,t;const n=s?[]:F(),c=(e=r.current)==null?void 0:e.selectedRectID;(o=r.current)==null||o.setResult([...n,...C]),c&&((t=r.current)==null||t.setSelectedRectID(c))});return React.useEffect(()=>{if(x.current){const e=new lbAnnotation.PointCloud2DRectOperation({container:x.current,size:d,config:__spreadProps(__spreadValues({},v),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:D});return r.current=e,r.current.init(),r.current.on("updateDragResult",V),r.current.on("afterAddingDrawingRect",S),r.current.on("deleteSelectedRects",N),()=>{var o,t,n,c;(o=r.current)==null||o.unbind("updateDragResult",V),(t=r.current)==null||t.unbind("afterAddingDrawingRect",S),(n=r.current)==null||n.unbind("deleteSelectedRects",N),(c=r.current)==null||c.destroy()}}},[]),React.useEffect(()=>{const e=t=>__async(void 0,null,function*(){try{return yield lbAnnotation.ImgUtils.load(t)}catch(n){return console.error("Error loading image:",n),null}}),o=()=>__async(void 0,null,function*(){var t;L(!0);let n=yield e(f);!n&&_&&(n=yield e(_)),n&&((t=r.current)==null||t.setImgNode(n),p(n)),L(!1)});r.current&&(f||_)&&o()},[f,_]),React.useEffect(()=>{var e;(e=r.current)==null||e.setSize(d)},[d]),React.useEffect(()=>{w!==R.current&&m()},[w]),React.useEffect(()=>{var e,o,t;const n=C.find(c=>c.id===r.current.selectedRectID);(o=(e=r.current)==null?void 0:e.setDefaultAttribute)==null||o.call(e,P),n&&O(__spreadProps(__spreadValues({},(t=r.current)==null?void 0:t.selectedRect),{attribute:P})),m()},[P]),React.useEffect(()=>{m()},[C]),React.useEffect(()=>{m()},[s]),React.useEffect(()=>{var e,o,t,n;const c=(o=(e=r.current)==null?void 0:e.config)!=null?o:{},y=__spreadProps(__spreadValues({},c),{attributeList:(t=v.attributeList)!=null?t:[]});(n=r.current)==null||n.setConfig(JSON.stringify(y))},[v.attributeList]),React__default.default.createElement(es.Spin,{spinning:A},React__default.default.createElement("div",{ref:x,style:__spreadValues({position:"relative"},d)}))};var PointCloud2DRectOperationView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloud2DRectOperationView);module.exports=PointCloud2DRectOperationView$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var dom=require("../../utils/dom.js"),React=require("react"),index=require("../AnnotationView/index.js"),useSize=require("../../hooks/useSize.js"),useSingleBox=require("./hooks/useSingleBox.js"),useHighlight=require("./hooks/useHighlight.js"),index$2=require("./components/HighlightVisible/index.js"),PointCloudContext=require("./PointCloudContext.js"),useDataLinkSwitch=require("./hooks/useDataLinkSwitch.js"),index$1=require("../pointCloud2DRectOperationView/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__async=(e,
|
|
1
|
+
"use strict";var dom=require("../../utils/dom.js"),React=require("react"),index=require("../AnnotationView/index.js"),useSize=require("../../hooks/useSize.js"),useSingleBox=require("./hooks/useSingleBox.js"),useHighlight=require("./hooks/useHighlight.js"),index$2=require("./components/HighlightVisible/index.js"),PointCloudContext=require("./PointCloudContext.js"),useDataLinkSwitch=require("./hooks/useDataLinkSwitch.js"),index$1=require("../pointCloud2DRectOperationView/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__async=(e,u,i)=>new Promise((l,s)=>{var f=t=>{try{o(i.next(t))}catch(n){s(n)}},r=t=>{try{o(i.throw(t))}catch(n){s(n)}},o=t=>t.done?l(t.value):Promise.resolve(t.value).then(f,r);o((i=i.apply(e,u)).next())});const PointCloud2DSingleView=({view2dData:e,setSelectedID:u,currentData:i,showEnlarge:l,checkMode:s=!1,measureVisible:f})=>{var r,o;const t=React.useRef(null),n=React.useRef(),{selectedBox:c}=useSingleBox.useSingleBox(),m=useSize(t),{url:p,fallbackUrl:x,calib:v,path:y}=e,{toggle2dVisible:j,isHighlightVisible:q}=useHighlight.useHighlight({currentData:i}),[P,b]=React.useState(!1),{cuboidBoxIn2DView:h,cacheImageNodeSize:_}=React.useContext(PointCloudContext.PointCloudContext),B=!e,V=React.useMemo(()=>({zIndex:l?-1:101,is2DView:!h,imageName:e.path}),[l,h,e.path]),{rendered:z,isLinking:I}=useDataLinkSwitch(V),k=d=>{g(),_({path:y,imgNode:d})},g=React.useCallback(()=>{var d,C;const L=(d=n.current)==null?void 0:d.toolInstance;if(u(""),!c||!L)return;const a=e.annotations.find(E=>E.annotation.id===c.info.id);let S="";a&&((C=a==null?void 0:a.annotation.pointList)==null?void 0:C.length)>0&&(L.focusPositionByPointList(a==null?void 0:a.annotation.pointList),S=c.info.id,u(S))},[c,n.current,e.annotations]);React.useEffect(()=>{g()},[g]);const R=()=>__async(void 0,null,function*(){b(!0),yield j(p,x!=null?x:"",v),b(!1)});return React__default.default.createElement("div",{className:dom.getClassName("point-cloud-2d-image"),ref:t},h?React__default.default.createElement(index,{src:(r=e==null?void 0:e.url)!=null?r:"",fallbackSrc:(o=e==null?void 0:e.fallbackUrl)!=null?o:"",annotations:e.annotations,size:m,ref:n,globalStyle:{display:B?"none":"block"},afterImgOnLoad:k,zoomInfo:{min:.01,max:1e3,ratio:.4},measureVisible:f}):React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(index$1,{shouldExcludePointCloudBoxListUpdate:!I,mappingData:e,size:m,checkMode:s,afterImgOnLoad:k}),!s&&z),v&&React__default.default.createElement(index$2,{visible:q(p),onClick:R,loading:P,style:{position:"absolute",right:16,top:16,zIndex:l?-1:101}}))};module.exports=PointCloud2DSingleView;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbUtils=require("@labelbee/lb-utils"),React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),ctx=require("../../store/ctx.js"),actionCreators=require("../../store/annotation/actionCreators.js"),index=require("../../store/annotatedBox/index.js"),_=require("lodash");function _interopDefaultLegacy(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbUtils=require("@labelbee/lb-utils"),React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),ctx=require("../../store/ctx.js"),actionCreators=require("../../store/annotation/actionCreators.js"),index=require("../../store/annotatedBox/index.js"),_=require("lodash"),map=require("./utils/map.js");function _interopDefaultLegacy(a){return a&&typeof a=="object"&&"default"in a?a:{default:a}}var React__default=_interopDefaultLegacy(React),___default=_interopDefaultLegacy(_),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(a,n,l)=>n in a?__defProp(a,n,{enumerable:!0,configurable:!0,writable:!0,value:l}):a[n]=l,__spreadValues=(a,n)=>{for(var l in n||(n={}))__hasOwnProp.call(n,l)&&__defNormalProp(a,l,n[l]);if(__getOwnPropSymbols)for(var l of __getOwnPropSymbols(n))__propIsEnum.call(n,l)&&__defNormalProp(a,l,n[l]);return a},__spreadProps=(a,n)=>__defProps(a,__getOwnPropDescs(n)),__async=(a,n,l)=>new Promise((w,D)=>{var R=p=>{try{P(l.next(p))}catch(y){D(y)}},O=p=>{try{P(l.throw(p))}catch(y){D(y)}},P=p=>p.done?w(p.value):Promise.resolve(p.value).then(R,O);P((l=l.apply(a,n)).next())});const pickRectObject=a=>___default.default.pick(a,["id","attribute","width","height","x","y","imageName"]),PointCloudContext=React__default.default.createContext({rectList:[],pointCloudBoxList:[],pointCloudSphereList:[],displayPointCloudList:[],displaySphereList:[],displayLineList:[],polygonList:[],lineList:[],selectedID:"",selectedIDs:[],highlightIDs:[],setHighlightIDs:()=>{},valid:!0,setSelectedIDs:()=>{},setPointCloudResult:()=>{},setPointCloudSphereList:()=>{},setPointCloudValid:()=>{},setTopViewInstance:()=>{},setSideViewInstance:()=>{},setBackViewInstance:()=>{},setMainViewInstance:()=>{},addSelectedID:()=>{},addHighlightID:()=>{},selectedAllBoxes:()=>{},addPointCloudBox:()=>[],addPointCloudSphere:()=>[],setPolygonList:()=>{},setRectList:()=>{},addRectIn2DView:()=>{},removeRectIn2DView:()=>{},updateRectIn2DView:()=>{},setLineList:()=>{},zoom:1,setZoom:()=>{},history:new lbAnnotation.ActionsHistory,hideAttributes:[],setHideAttributes:()=>{},toggleAttributesVisible:()=>{},reRender:()=>{},setAttrPanelLayout:()=>{},attrPanelLayout:"",syncAllViewPointCloudColor:()=>Promise.resolve(),defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:lbAnnotation.EToolName.Rect,setPointCloudPattern:()=>{},selectSpecAttr:()=>{},globalPattern:lbUtils.EPointCloudPattern.Detection,setGlobalPattern:()=>{},setPtSegmentInstance:()=>{},segmentation:[],setSegmentation:()=>{},clearAllDetectionInstance:()=>{},highlight2DDataList:[],setHighlight2DDataList:()=>{},cuboidBoxIn2DView:!0,setCuboidBoxIn2DView:a=>{},imageSizes:{},cacheImageNodeSize:()=>{},addRectFromPointCloudBoxByImageName:a=>!1,removeRectBySpecifyId:(a,n,l)=>!1,removeRectByPointCloudBoxId:a=>!1,rectRotateSensitivity:2,setRectRotateSensitivity:()=>{},imageNamePointCloudBoxMap:new Map,linkageImageNameRectMap:new Map}),PointCloudProvider=({children:a})=>{const[n,l]=React.useState([]),[w,D]=React.useState([]),[R,O]=React.useState([]),[P,p]=React.useState([]),[y,fe]=React.useState([]),[h,H]=React.useState([]),[A,E]=React.useState([]),[T,ge]=React.useState(!0),[W,me]=React.useState(2),[Z,ve]=React.useState(!0),[U,he]=React.useState(1),[f,J]=React.useState(),[K,Q]=React.useState(),[X,Y]=React.useState(),[d,$]=React.useState(),[ee,Pe]=React.useState(""),[j,Ie]=React.useState(lbAnnotation.EToolName.Rect),Se=React.useRef(new lbAnnotation.ActionsHistory).current,[g,k]=React.useState([]),[te,ye]=React.useState(""),[F,Ce]=React.useState(lbUtils.EPointCloudPattern.Detection),[x,ne]=React.useState(void 0),[q,be]=React.useState([]),[z,we]=React.useState([]),m=index(),[ie,xe]=React.useState({}),Le=ctx.useDispatch(),De=i=>{const{imgNode:o,path:t}=i;t&&o&&xe(c=>__spreadProps(__spreadValues({},c),{[t]:{width:o.width,height:o.height}}))},oe=React.useMemo(()=>h.length===1?h[0]:"",[h]),B=React.useCallback((i,o,t="extId")=>{const c=t||"id",r=new Set(o);return p(u=>{let C=!1;const b=u.filter(N=>{const G=N[c],M=r.has(G)?N.imageName!==i:!0;return M||(C=!0),M});return C?b:u}),!0},[]),se=React.useCallback(i=>{const o=n.map(t=>t.id);return B(i,o,"extId")},[n,B]),ae=React.useCallback(i=>{if(!i)return!1;const o=n.filter(t=>Array.isArray(t.rects)).map(t=>{const{id:c,attribute:r,trackID:u}=t,C=t.rects.find(b=>b.imageName===i);if(C){const b=___default.default.pick(C,["width","height","x","y","imageName"]);return __spreadProps(__spreadValues({},b),{id:lbAnnotation.uuid(),attribute:r,order:u,extId:c,lineDash:[]})}return null}).filter(t=>t!==null);return o.length?(p(t=>{const c=new Set(t.filter(u=>i===u.imageName).map(u=>u.extId)),r=o.filter(u=>c.has(u.extId)===!1);return r.length?[...t,...r]:t}),!0):!1},[n]),re=React.useMemo(()=>n.filter(o=>Array.isArray(o.rects)&&o.rects.length>0).reduce((o,t)=>{var c;return(c=t.rects)==null||c.forEach(r=>{const{imageName:u}=r;if(!u){console.warn("Missing image name"),console.trace(r,t);return}map.addMapIndirectWeakSetItem(o,u,t.id,t)}),o},new Map),[n]),le=React.useMemo(()=>P.filter(i=>i.extId!==void 0&&i.id!==void 0).reduce((i,o)=>{const t=o.imageName;return t?(map.addMapIndirectWeakSetItem(i,t,o.extId,o),i):(console.warn("missing image name"),console.log(o,P),i)},new Map),[P]),V=React.useMemo(()=>{const i=n.find(e=>e.id===oe),o=e=>{const s=n.concat(e);return l(s),s},t=e=>{const s=w.concat(e);return D(s),s},c=e=>{ge(e!==!1)},r=e=>{e===void 0&&H([]),typeof e=="string"&&H([e]),Array.isArray(e)&&H(Array.from(new Set(e)))},u=e=>{h.includes(e)?r(h.filter(s=>s!==e)):r([...h,e])},C=e=>{const s=pickRectObject(e);p(v=>[...v,s])},b=(e,s=!1)=>{const v=pickRectObject(e);p(S=>S.map(I=>I.id===e.id?s?__spreadValues(__spreadValues({},I),v):v:I))},N=e=>{p(s=>s.filter(v=>!e.find(S=>S.id===v.id)))},G=e=>{A.includes(e)?E([]):E([e])},M=()=>{if(j===lbAnnotation.EToolName.Rect){const e=n.map(s=>s.id);r(e),f==null||f.pointCloud2dOperation.setSelectedIDs(e)}},_e=e=>{r(n.filter(s=>s.attribute===e).map(s=>s.id))},ce=n.filter(e=>!g.includes(e.attribute)),de=w.filter(e=>!g.includes(e.attribute)),ue=y.filter(e=>e.attribute&&!g.includes(e.attribute)),Ae=e=>{if(g.includes(e))k(g.filter(s=>s!==e));else{const s=g.concat(e);k(s)}},Be=(e=ce,s=R,v=de,S=ue,I=q)=>{var L;d==null||d.clearAllBox(),d==null||d.clearAllSphere(),f==null||f.updatePolygonList(e,s),f==null||f.updatePointList(v),f==null||f.updateLineList(S),d==null||d.generateBoxes(e),d==null||d.generateSpheres(v),(L=x==null?void 0:x.store)==null||L.updateCurrentSegment(I),pe(e)},Ve=()=>{J(void 0),Q(void 0),Y(void 0),$(void 0)},pe=(e,s)=>__async(void 0,null,function*(){var v;if(!d)return;const S=d.pointCloudObject;if(!!S)try{const I=yield d.getHighlightIndexByMappingImgList({mappingImgList:s!=null?s:z,points:S.geometry.attributes.position.array}),L=yield d==null?void 0:d.highlightOriginPointCloud(e,I);return L&&((v=f==null?void 0:f.pointCloudInstance)==null||v.updateColor(L)),L}catch(I){console.error(I)}});return{selectedID:oe,pointCloudBoxList:n,pointCloudSphereList:w,displayPointCloudList:ce,displaySphereList:de,displayLineList:ue,selectedIDs:h,setPointCloudResult:l,setSelectedIDs:r,addPointCloudBox:o,addPointCloudSphere:t,setPointCloudSphereList:D,valid:T,selectedPointCloudBox:i,setPointCloudValid:c,addSelectedID:u,addHighlightID:G,selectedAllBoxes:M,topViewInstance:f,setTopViewInstance:J,sideViewInstance:K,setSideViewInstance:Q,backViewInstance:X,setBackViewInstance:Y,mainViewInstance:d,setMainViewInstance:$,polygonList:R,setPolygonList:O,rectList:P,setRectList:p,addRectIn2DView:C,removeRectIn2DView:N,updateRectIn2DView:b,lineList:y,setLineList:fe,zoom:U,setZoom:he,history:Se,toggleAttributesVisible:Ae,hideAttributes:g,setHideAttributes:k,reRender:Be,attrPanelLayout:te,setAttrPanelLayout:ye,syncAllViewPointCloudColor:pe,defaultAttribute:ee,setDefaultAttribute:Pe,pointCloudPattern:j,setPointCloudPattern:Ie,selectSpecAttr:_e,globalPattern:F,setGlobalPattern:e=>{F!==e&&(Le(actionCreators.ChangeSave),Ce(e),e===lbUtils.EPointCloudPattern.Detection&&ne(void 0))},ptSegmentInstance:x,setPtSegmentInstance:ne,segmentation:q,setSegmentation:be,clearAllDetectionInstance:Ve,highlight2DDataList:z,setHighlight2DDataList:we,cuboidBoxIn2DView:Z,setCuboidBoxIn2DView:ve,imageSizes:ie,cacheImageNodeSize:De,highlightIDs:A,setHighlightIDs:E,removeRectByPointCloudBoxId:se,removeRectBySpecifyId:B,addRectFromPointCloudBoxByImageName:ae,rectRotateSensitivity:W,setRectRotateSensitivity:me,imageNamePointCloudBoxMap:re,linkageImageNameRectMap:le}},[T,h,n,w,R,y,P,f,K,X,d,U,g,te,ee,j,F,x,q,z,Z,ie,A,se,B,ae,W,re,le]);React.useEffect(()=>{var i,o,t;(i=m==null?void 0:m.setPointCloudBoxList)==null||i.call(m,n),(o=m==null?void 0:m.setHighlightIDs)==null||o.call(m,A),(t=m==null?void 0:m.setSelectedIDs)==null||t.call(m,h)},[n,h,A]),React.useEffect(()=>{var i;(i=m==null?void 0:m.setPtCtx)==null||i.call(m,V)},[V]);const Re=()=>{const i=n.filter(r=>g.includes(r.attribute)),{setSelectedIDs:o,reRender:t}=V,c=i.map(r=>r.id);c.length>0&&o(h.filter(r=>!c.includes(r))),t()};return React.useEffect(()=>{var i,o,t,c;Re(),(o=(i=f==null?void 0:f.toolInstance)==null?void 0:i.setHiddenAttributes)==null||o.call(i,g),(c=(t=x==null?void 0:x.store)==null?void 0:t.setHiddenAttributes)==null||c.call(t,g)},[g]),React__default.default.createElement(PointCloudContext.Provider,{value:V},a)};exports.PointCloudContext=PointCloudContext,exports.PointCloudProvider=PointCloudProvider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var PointCloudContext=require("./PointCloudContext.js"),useRotate=require("./hooks/useRotate.js"),useRotateEdge=require("./hooks/useRotateEdge.js"),useBoxes=require("./hooks/useBoxes.js"),useSingleBox=require("./hooks/useSingleBox.js"),useSphere=require("./hooks/useSphere.js"),React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),antd=require("antd"),reactRedux=require("react-redux"),map=require("../../store/annotation/map.js"),useStatus=require("./hooks/useStatus.js"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),ctx=require("../../store/ctx.js"),useHistory=require("./hooks/useHistory.js"),useAttribute=require("./hooks/useAttribute.js"),useConfig=require("./hooks/useConfig.js"),usePolygon=require("./hooks/usePolygon.js"),useLine=require("./hooks/useLine.js"),reactI18next=require("react-i18next"),actionCreators=require("../../store/annotation/actionCreators.js"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(
|
|
1
|
+
"use strict";var PointCloudContext=require("./PointCloudContext.js"),useRotate=require("./hooks/useRotate.js"),useRotateEdge=require("./hooks/useRotateEdge.js"),useBoxes=require("./hooks/useBoxes.js"),useSingleBox=require("./hooks/useSingleBox.js"),useSphere=require("./hooks/useSphere.js"),React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),antd=require("antd"),reactRedux=require("react-redux"),map=require("../../store/annotation/map.js"),useStatus=require("./hooks/useStatus.js"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),ctx=require("../../store/ctx.js"),useHistory=require("./hooks/useHistory.js"),useAttribute=require("./hooks/useAttribute.js"),useConfig=require("./hooks/useConfig.js"),usePolygon=require("./hooks/usePolygon.js"),useLine=require("./hooks/useLine.js"),reactI18next=require("react-i18next"),actionCreators=require("../../store/annotation/actionCreators.js"),ahooks=require("ahooks"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(u,r,l)=>r in u?__defProp(u,r,{enumerable:!0,configurable:!0,writable:!0,value:l}):u[r]=l,__spreadValues=(u,r)=>{for(var l in r||(r={}))__hasOwnProp.call(r,l)&&__defNormalProp(u,l,r[l]);if(__getOwnPropSymbols)for(var l of __getOwnPropSymbols(r))__propIsEnum.call(r,l)&&__defNormalProp(u,l,r[l]);return u},__spreadProps=(u,r)=>__defProps(u,__getOwnPropDescs(r));const{EPolygonPattern}=lbAnnotation.cTool,PointCloudListener=({currentData:u,config:r,checkMode:l,configString:L,imgIndex:C,toolInstanceRef:a})=>{const t=React.useContext(PointCloudContext.PointCloudContext),{changeSelectedBoxValid:V,selectNextBox:B,selectPrevBox:q,updateSelectedBox:f,deleteSelectedPointCloudBoxAndPolygon:O}=useSingleBox.useSingleBox(),{selectedSphere:P,updatePointCloudSphere:A}=useSphere.useSphere(),{clearAllResult:y,updatePointCloudPattern:j}=useStatus.useStatus(),{copySelectedBoxes:I,pasteSelectedBoxes:T,copiedBoxes:D}=useBoxes.useBoxes({config:r}),{updateRotate:g}=useRotate.useRotate({currentData:u}),{updateRotateEdge:N}=useRotateEdge.useRotateEdge({currentData:u}),{updatePointCloudData:v,topViewSelectedChanged:h}=usePointCloudViews.usePointCloudViews(),{redo:m,undo:S,pushHistoryWithList:R,pushHistoryUnderUpdatePolygon:H,pushHistoryUnderUpdateLine:K}=useHistory.useHistory(),U=ctx.useDispatch(),{syncThreeViewsAttribute:x}=useAttribute.useAttribute(),{syncAllViewsConfig:z,reRenderTopViewRange:F}=useConfig.useConfig(),{selectedPolygon:k}=usePolygon.usePolygon(),{selectedLine:_}=useLine.useLine(),{t:w}=reactI18next.useTranslation(),G=ahooks.useLatest(u),b=e=>{var o;const{topViewInstance:s}=t;!s||(o=s.pointCloud2dOperation)==null||o.updateSelectedPolygonsPoints(e)},M=(e,o)=>{var s,i;const{topViewInstance:c,mainViewInstance:n}=t;if(!c)return;const{pointCloud2dOperation:d}=c;switch(e){case"q":{g(t.rectRotateSensitivity);break}case"e":g(-Number(t.rectRotateSensitivity));break;case"g":N(-90);break;case"u":{const p=d.pattern===EPolygonPattern.Normal?lbAnnotation.EToolName.Rect:lbAnnotation.EToolName.Polygon;j(p);const Y={[lbAnnotation.EToolName.Polygon]:w("PolygonPattern"),[lbAnnotation.EToolName.Rect]:w("RectPattern")};antd.message.success(w("ChangePatternMsg",{pattern:Y[p]})),d.clearActiveStatus(),d.clearDrawingStatus()}break;case"+":n==null||n.updatePointSize({zoomIn:!0});break;case"-":n==null||n.updatePointSize({zoomIn:!1});break;case"v":t.setPointCloudValid(!t.valid);break;case"tab":if(o.shiftKey){q();break}B(),o.preventDefault();break;case"f":V();break;case"arrowup":b({y:-1});break;case"arrowdown":b({y:1});break;case"arrowleft":b({x:-1});break;case"arrowright":b({x:1});break;case"delete":O(G.current);break;default:{if(((s=r.attributeList)==null?void 0:s.length)>0){const p=lbAnnotation.AttributeUtils.getAttributeByKeycode(o.keyCode,r.attributeList);p!==void 0&&((i=a.current)==null||i.setDefaultAttribute(p))}return}}},W=(e,o)=>{switch(e){case"c":I();break;case"v":T();break;case"a":o.preventDefault(),t.selectedAllBoxes();break;case"z":{o.shiftKey?m():S();break}}},E=e=>{if(!lbAnnotation.CommonToolUtils.hotkeyFilter(e)||l===!0)return;const o=e.key.toLocaleLowerCase();if(e.ctrlKey){W(o,e);return}M(o,e)};return React.useEffect(()=>{const{topViewInstance:e}=t;if(!!e)return window.addEventListener("keydown",E),()=>{window.removeEventListener("keydown",E)}},[t,D,r,t.pointCloudBoxList,t.polygonList]),React.useEffect(()=>{z(r)},[L]),React.useEffect(()=>{(r==null?void 0:r.radius)&&F(r==null?void 0:r.radius)},[r==null?void 0:r.radius]),React.useEffect(()=>{v==null||v()},[C,t.mainViewInstance]),React.useEffect(()=>{t.setHideAttributes([])},[C]),React.useEffect(()=>{a.current.setDefaultAttribute=e=>{var o,s,i,c;x(e);const n=t.selectedPointCloudBox;if(n){n.attribute=e;const d=U(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[n],stepConfig:r,action:"viewUpdateBox"}));n.valid=d[0].valid;const p=f(n);(i=(s=(o=t==null?void 0:t.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null?void 0:s.setPolygonValidAndRender)==null||i.call(s,n.id,!0,n.valid),t.mainViewInstance&&h({newSelectedBox:n,newPointCloudList:p})}if(k&&H(__spreadProps(__spreadValues({},k),{attribute:e})),_&&K(__spreadProps(__spreadValues({},_),{attribute:e})),P){const d=A(__spreadProps(__spreadValues({},P),{attribute:e}));t.mainViewInstance&&((c=t.mainViewInstance)==null||c.generateSpheres(d),h({newSelectedSphere:P,newSphereList:d}))}},a.current.setSubAttribute=(e,o)=>{var s;const i=t.selectedPointCloudBox;if(i){const c=(s=i==null?void 0:i.subAttribute)!=null?s:{};i.subAttribute=__spreadProps(__spreadValues({},c),{[e]:o}),f(i)}},a.current.clearResult=()=>{y==null||y()},a.current.redo=()=>{m()},a.current.undo=()=>{S()},a.current.setValid=e=>{a.current.valid=e,setTimeout(()=>{t.setPointCloudValid(e),e===!1&&y()})},a.current.setForbidOperation=e=>{var o,s;(s=(o=t.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||s.setForbidOperation(e),e===!0&&t.setSelectedIDs(void 0)},a.current.setShowDefaultCursor=e=>{var o,s;(s=(o=t.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||s.setShowDefaultCursor(e)},a.current.asyncData=e=>{setTimeout(()=>{v==null||v(e)})}},[t.pointCloudBoxList,t.pointCloudSphereList,t.selectedID,t.valid,t.polygonList,t.lineList,t.mainViewInstance,t.ptSegmentInstance]),React.useEffect(()=>{a.current.updateSegmentTool=e=>{var o;(o=t.ptSegmentInstance)==null||o.emit(e)},a.current.segmentInstance=t.ptSegmentInstance},[t.ptSegmentInstance]),React.useEffect(()=>{a.current.history={pushHistory:e=>{R({pointCloudBoxList:e})},initRecord:()=>{}}},[]),React.useEffect(()=>{var e;const o=(e=t.topViewInstance)==null?void 0:e.toolInstance;if(!o||l)return;const s=n=>{x(n)},i=n=>{antd.message.error(n)},c=n=>{antd.message.info(n)};return o.on("syncAttribute",s),o.on("messageError",i),o.on("messageInfo",c),()=>{o.unbind("syncAttribute",s),o.unbind("messageError",i),o.unbind("messageInfo",c)}},[t.topViewInstance]),null};var PointCloudListener$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudListener);module.exports=PointCloudListener$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var React=require("react"),ahooks=require("ahooks"),PointCloudContext=require("../PointCloudContext.js"),icon_link=require("../../../assets/annotation/icon_link.svg.js"),icon_unlink=require("../../../assets/annotation/icon_unlink.svg.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const iconSize={width:16,height:16},useDataLinkSwitch=e=>{e.imageName||console.warn("missing imageName");const[
|
|
1
|
+
"use strict";var React=require("react"),ahooks=require("ahooks"),PointCloudContext=require("../PointCloudContext.js"),icon_link=require("../../../assets/annotation/icon_link.svg.js"),icon_unlink=require("../../../assets/annotation/icon_unlink.svg.js"),BatchSwitchConnectIn2DView=require("../../../views/MainView/toolFooter/BatchSwitchConnectIn2DView/BatchSwitchConnectIn2DView.js"),lbAnnotation=require("@labelbee/lb-annotation");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const iconSize={width:16,height:16},useDataLinkSwitch=e=>{e.imageName||console.warn("missing imageName");const[i,h]=React.useState(!0),l=ahooks.useLatest(e.imageName),{addRectFromPointCloudBoxByImageName:v,removeRectByPointCloudBoxId:w,imageNamePointCloudBoxMap:o,linkageImageNameRectMap:m}=React.useContext(PointCloudContext.PointCloudContext),r=React.useMemo(()=>e.imageName?o.has(e.imageName):(console.error("Missing image name"),!1),[e.imageName,o]),C=ahooks.useLatest(r),I=ahooks.useLatest(v),k=ahooks.useLatest(w),a=React.useCallback(n=>{if(!C.current)return;const t=l.current;if(!t){console.warn("invalid image name");return}h(n),n?k.current(t):I.current(t)},[]),x=React.useCallback(()=>{a(!i)},[a,i]),N=React.useMemo(()=>{var n;if(!e.is2DView||!r)return null;const s={zIndex:(n=e.zIndex)!=null?n:999,position:"absolute",top:16,right:16+28+12,background:"rgba(0, 0, 0, 0.74)",color:"white",borderRadius:2,padding:6,display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28};return React__default.default.createElement("div",{style:s},i&&React__default.default.createElement("img",{src:icon_link,style:iconSize}),!i&&React__default.default.createElement("img",{src:icon_unlink,style:iconSize}))},[i,e.is2DView,e.zIndex,x,r]),c=React.useCallback(()=>{var n,t,s,d;if(!e.is2DView)return;const u=l.current;if(!u){console.warn("invalid image name");return}const B=new Set([...(t=(n=o.get(u))==null?void 0:n.keys())!=null?t:[]]),g=[...(d=(s=m.get(u))==null?void 0:s.keys())!=null?d:[]];let f=!0;g.length&&(f=Boolean(g.find(b=>B.has(b)))===!1),a(f)},[e.is2DView,m,o,a]);return React.useEffect(()=>{c()},[c]),React.useEffect(()=>{const n=t=>{a(t)};return lbAnnotation.EventBus.on(BatchSwitchConnectIn2DView.EventBusEvent.switchConnect,n),()=>lbAnnotation.EventBus.unbind(BatchSwitchConnectIn2DView.EventBusEvent.switchConnect,n)},[a]),{rendered:N,isLinking:i,swapSwitch:a,syncIsLinking:c}};module.exports=useDataLinkSwitch;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),_=require("lodash"),PointCloudContext=require("../PointCloudContext.js"),lbAnnotation=require("@labelbee/lb-annotation"),useHistory=require("./useHistory.js"),usePolygon=require("./usePolygon.js");function _interopDefaultLegacy(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),_=require("lodash"),PointCloudContext=require("../PointCloudContext.js"),lbAnnotation=require("@labelbee/lb-annotation"),useHistory=require("./useHistory.js"),usePolygon=require("./usePolygon.js");function _interopDefaultLegacy(l){return l&&typeof l=="object"&&"default"in l?l:{default:l}}var ___default=_interopDefaultLegacy(_),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(l,t,i)=>t in l?__defProp(l,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):l[t]=i,__spreadValues=(l,t)=>{for(var i in t||(t={}))__hasOwnProp.call(t,i)&&__defNormalProp(l,i,t[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(t))__propIsEnum.call(t,i)&&__defNormalProp(l,i,t[i]);return l},__spreadProps=(l,t)=>__defProps(l,__getOwnPropDescs(t));const{ESortDirection}=lbAnnotation.cAnnotation,useSingleBox=l=>{const{pointCloudBoxList:t,setPointCloudResult:i,topViewInstance:a,backViewInstance:m,sideViewInstance:w,selectedIDs:P,selectedID:b,mainViewInstance:u,setSelectedIDs:N,syncAllViewPointCloudColor:h,polygonList:j,pointCloudPattern:B,rectList:O,removeRectIn2DView:D,addRectIn2DView:V}=React.useContext(PointCloudContext.PointCloudContext),{selectedPolygon:c,updateSelectedPolygon:k,updatePolygonValidByID:A,deletePolygon:M}=usePolygon.usePolygon(),{pushHistoryWithList:S}=useHistory.useHistory(),s=React.useMemo(()=>{const e=t.findIndex(n=>n.id===b);if(e>-1)return{info:t[e],index:e}},[b,t]),L=React.useCallback(e=>{var n;if(s==null?void 0:s.info){(n=l==null?void 0:l.generateRects)==null||n.call(l,e),t.splice(s.index,1,___default.default.merge(s.info,e));const o=___default.default.cloneDeep(t);return i(o),S({pointCloudBoxList:o}),o}return t},[b,t]),q=React.useCallback((e,n)=>{const o=t.findIndex(d=>d.id===n);if(o>-1){t.splice(o,1,___default.default.merge(t[o],e));const d=___default.default.cloneDeep(t);return i(d),d}return t},[t]),y=React.useCallback(e=>{a==null||a.pointCloud2dOperation.setPolygonValidAndRender(e,!0),w==null||w.pointCloud2dOperation.setPolygonValidAndRender(e,!0),m==null||m.pointCloud2dOperation.setPolygonValidAndRender(e,!0)},[a,w,m]),H=React.useCallback(()=>{if(s==null?void 0:s.info){const{id:e,valid:n=!0}=s.info,o=L({valid:!n});h(o),y(e)}c&&(k(__spreadProps(__spreadValues({},c),{valid:!c.valid})),a==null||a.pointCloud2dOperation.setPolygonValidAndRender(c.id,!0))},[y,s,c]),T=React.useCallback(e=>{const n=t.find(o=>o.id===e);if(n){const{id:o,valid:d=!0}=n,g=q({valid:!d},o);return y(o),g}A(e)},[y,t,j]),E=React.useCallback((e=ESortDirection.ascend,n=!1)=>{if(!a||P.length>1)return;if(B!==lbAnnotation.EToolName.Rect&&B!==lbAnnotation.EToolName.Polygon){n&&document.dispatchEvent(new KeyboardEvent("keydown",{keyCode:9,shiftKey:e!==ESortDirection.ascend}));return}const{pointCloud2dOperation:o}=a,d=o.switchToNextPolygon(e);d&&N(d)},[a,B,a==null?void 0:a.toolInstance]),K=(e=!1)=>{E(ESortDirection.descend,e)},W=(e=!1)=>{E(ESortDirection.ascend,e)},R=e=>{const n=t.filter(o=>o.id!==e);i(n),u==null||u.removeObjectByName(e,"box"),u==null||u.render(),h(n)},z=React.useCallback((e,n)=>{var o,d;const g=new Set((d=(o=n.mappingImgList)==null?void 0:o.map(r=>r.path))!=null?d:[]),p=new Map;e.forEach(r=>{const C=r.id;(r.rects||[]).forEach(I=>{const{imageName:x}=I;if(g.has(x)){let v=p.get(x);v||(v=new Set,p.set(x,v)),v.add(C)}})});const f=O.filter(r=>{var C;const I=r.extId,x=r.imageName;if(x!==void 0&&I!==void 0){const v=p.get(x);return(C=v==null?void 0:v.has(I))!=null?C:!1}return!1});D(f),f.forEach(r=>{V(r)})},[O,D,V]),F=e=>{s&&(R(s.info.id),a==null||a.pointCloud2dOperation.deletePolygon(s.info.id),z([s.info],e)),c&&(M(c.id),a==null||a.pointCloud2dOperation.deletePolygon(c.id))},G=React.useMemo(()=>t.filter(e=>P.includes(e.id)),[P,t]),J=React.useCallback(e=>{var n;const o=___default.default.cloneDeep(t);let d=!1;for(const g of e){const p=o.findIndex(f=>f.id===g.id);if(p>-1){const f=___default.default.merge(o[p],g);(n=l==null?void 0:l.generateRects)==null||n.call(l,f),o.splice(p,1,f),u==null||u.generateBox(f),d=!0}}if(d)return i(o),S({pointCloudBoxList:o}),u==null||u.render(),o},[P,t]),Q=React.useCallback(e=>t.find(n=>n.id===e),[t]);return{selectedBox:s,updateSelectedBox:L,changeSelectedBoxValid:H,changeValidByID:T,selectNextBox:W,selectPrevBox:K,deletePointCloudBox:R,selectedBoxes:G,updateSelectedBoxes:J,getPointCloudByID:Q,deleteSelectedPointCloudBoxAndPolygon:F}};exports.useSingleBox=useSingleBox;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const addMapIndirectWeakSetItem=(r,d,s,a)=>{let e=r.get(d);e||(e=new Map,r.set(d,e));let t=e.get(s);return t||(t=new WeakSet,e.set(s,t)),t.add(a),r};exports.addMapIndirectWeakSetItem=addMapIndirectWeakSetItem;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var index$1=require("./components/AnnotationView/index.js"),pointCloudAnnotationView=require("./components/AnnotationView/pointCloudAnnotationView.js"),index$2=require("./components/LLMToolView/questionView/index.js"),index$3=require("./components/NLPToolView/textContent/index.js"),lbUtils=require("@labelbee/lb-utils"),React=require("react"),reactI18next=require("react-i18next"),reactRedux=require("react-redux"),App=require("./App.js"),configureStore=require("./configureStore.js"),actionCreators=require("./store/annotation/actionCreators.js"),TagToolInstanceAdaptorI18nProvider=require("./components/videoAnnotate/videoTagTool/TagToolInstanceAdaptorI18nProvider.js"),PointCloudContext=require("./components/pointCloudView/PointCloudContext.js"),ctx=require("./store/ctx.js"),index$5=require("./components/predictTracking/predictTrackingIcon/index.js"),index$4=require("./components/LLMToolView/index.js"),index$6=require("./views/MainView/toolFooter/SwitchCuboidBoxIn2DView/index.js"),index$7=require("./components/measureCanvas/index.js"),index$8=require("./views/MainView/sidebar/PointCloudToolSidebar/components/annotatedBox/index.js"),index$9=require("./views/MainView/sidebar/PointCloudToolSidebar/components/rectRotateSensitivitySlider/index.js"),index$a=require("./views/MainView/sidebar/PointCloudToolSidebar/components/findTrackIDIndex/index.js"),index$b=require("./components/audioPlayer/index.js"),index$c=require("./utils/index.js"),index$d=require("./components/subAttributeList/index.js"),index$e=require("./constant/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,r)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__spreadValues=(e,t)=>{for(var r in t||(t={}))__hasOwnProp.call(t,r)&&__defNormalProp(e,r,t[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(t))__propIsEnum.call(t,r)&&__defNormalProp(e,r,t[r]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));const store=configureStore(),OutputApp=(e,t)=>{const[r,i]=React.useState();return React.useImperativeHandle(t,()=>({toolInstance:r,annotationEngine:store.getState().annotation.annotationEngine,pageBackwardActions:()=>store.dispatch(actionCreators.PageBackward()),pageForwardActions:()=>store.dispatch(actionCreators.PageForward()),pageJump:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var index$1=require("./components/AnnotationView/index.js"),pointCloudAnnotationView=require("./components/AnnotationView/pointCloudAnnotationView.js"),index$2=require("./components/LLMToolView/questionView/index.js"),index$3=require("./components/NLPToolView/textContent/index.js"),lbUtils=require("@labelbee/lb-utils"),React=require("react"),reactI18next=require("react-i18next"),reactRedux=require("react-redux"),App=require("./App.js"),configureStore=require("./configureStore.js"),actionCreators=require("./store/annotation/actionCreators.js"),TagToolInstanceAdaptorI18nProvider=require("./components/videoAnnotate/videoTagTool/TagToolInstanceAdaptorI18nProvider.js"),PointCloudContext=require("./components/pointCloudView/PointCloudContext.js"),ctx=require("./store/ctx.js"),index$5=require("./components/predictTracking/predictTrackingIcon/index.js"),index$4=require("./components/LLMToolView/index.js"),index$6=require("./views/MainView/toolFooter/SwitchCuboidBoxIn2DView/index.js"),BatchSwitchConnectIn2DView=require("./views/MainView/toolFooter/BatchSwitchConnectIn2DView/BatchSwitchConnectIn2DView.js"),index$7=require("./components/measureCanvas/index.js"),index$8=require("./views/MainView/sidebar/PointCloudToolSidebar/components/annotatedBox/index.js"),index$9=require("./views/MainView/sidebar/PointCloudToolSidebar/components/rectRotateSensitivitySlider/index.js"),index$a=require("./views/MainView/sidebar/PointCloudToolSidebar/components/findTrackIDIndex/index.js"),index$b=require("./components/audioPlayer/index.js"),index$c=require("./utils/index.js"),index$d=require("./components/subAttributeList/index.js"),index$e=require("./constant/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,r)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__spreadValues=(e,t)=>{for(var r in t||(t={}))__hasOwnProp.call(t,r)&&__defNormalProp(e,r,t[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(t))__propIsEnum.call(t,r)&&__defNormalProp(e,r,t[r]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));const store=configureStore(),OutputApp=(e,t)=>{const[r,i]=React.useState();return React.useImperativeHandle(t,()=>({toolInstance:r,annotationEngine:store.getState().annotation.annotationEngine,pageBackwardActions:()=>store.dispatch(actionCreators.PageBackward()),pageForwardActions:()=>store.dispatch(actionCreators.PageForward()),pageJump:n=>{const o=~~n-1;store.dispatch(actionCreators.PageJump(o))},hello:()=>alert("hello labelBee!!!")}),[r]),React__default.default.createElement(reactRedux.Provider,{store,context:ctx.LabelBeeContext},React__default.default.createElement(reactI18next.I18nextProvider,{i18n:lbUtils.i18n},React__default.default.createElement(PointCloudContext.PointCloudProvider,null,React__default.default.createElement(App,__spreadProps(__spreadValues({},e),{setToolInstance:n=>{var o;i(n),(o=e.onLoad)==null||o.call(e,{toolInstance:n})}})))))};var index=React__default.default.forwardRef(OutputApp);exports.AnnotationView=index$1,exports.PointCloudAnnotationView=pointCloudAnnotationView,exports.QuestionView=index$2.default,exports.TextContent=index$3,Object.defineProperty(exports,"i18n",{enumerable:!0,get:function(){return lbUtils.i18n}}),exports.VideoTagTool=TagToolInstanceAdaptorI18nProvider.VideoTagTool,exports.PredictTracking=index$5,exports.LLMToolView=index$4,exports.SwitchCuboidBoxIn2DView=index$6,exports.BatchSwitchConnectIn2DView=BatchSwitchConnectIn2DView.default,exports.MeasureCanvas=index$7,exports.AnnotatedBox=index$8,exports.RectRotateSensitivitySlider=index$9,exports.FindTrackIDIndex=index$a.FindTrackIDIndexInCheckMode,exports.AudioPlayer=index$b.WrapAudioPlayer,exports.generatePointCloudBoxRects=index$c.generatePointCloudBoxRects,exports.SubAttributeList=index$d,Object.defineProperty(exports,"EDataFormatType",{enumerable:!0,get:function(){return index$e.EDataFormatType}}),Object.defineProperty(exports,"ELLMDataType",{enumerable:!0,get:function(){return index$e.ELLMDataType}}),Object.defineProperty(exports,"EStepType",{enumerable:!0,get:function(){return index$e.EStepType}}),Object.defineProperty(exports,"ESubmitType",{enumerable:!0,get:function(){return index$e.ESubmitType}}),exports.componentCls=index$e.componentCls,exports.prefix=index$e.prefix,exports.default=index,exports.store=store;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IPointCloudBox, IPointCloudBoxList, IPolygonData, IPointCloudSphereList, IPointCloudSphere, ILine, EPointCloudPattern, IPointCloudSegmentation, ICalib, ISize, IPointCloudBoxRect, IPointCloud2DRectOperationViewRect } from '@labelbee/lb-utils';
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { PropsWithChildren } from 'react';
|
|
3
3
|
import { PointCloud, PointCloudAnnotation, ActionsHistory, EToolName } from '@labelbee/lb-annotation';
|
|
4
|
+
import type { MapIndirectWeakSet } from './utils/map';
|
|
4
5
|
interface IPointCloudContextInstances {
|
|
5
6
|
topViewInstance?: PointCloudAnnotation;
|
|
6
7
|
sideViewInstance?: PointCloudAnnotation;
|
|
@@ -19,7 +20,6 @@ interface IPointCloudSegment {
|
|
|
19
20
|
ptSegmentInstance?: PointCloud;
|
|
20
21
|
setPtSegmentInstance: (instance?: PointCloud) => void;
|
|
21
22
|
}
|
|
22
|
-
type UnlinkImageItem = string;
|
|
23
23
|
type AttrPanelLayout = '' | 'left' | 'right';
|
|
24
24
|
interface IHighlight2DData {
|
|
25
25
|
url: string;
|
|
@@ -85,14 +85,16 @@ export interface IPointCloudContext extends IPointCloudContextInstances, IPointC
|
|
|
85
85
|
imgNode: HTMLImageElement;
|
|
86
86
|
path: string;
|
|
87
87
|
}) => void;
|
|
88
|
-
/** 未关联(联动)项列表 */
|
|
89
|
-
unlinkImageItems: UnlinkImageItem[];
|
|
90
88
|
addRectFromPointCloudBoxByImageName: (imageName: string) => boolean;
|
|
91
89
|
removeRectBySpecifyId: (imageName: string, ids: string[], idField?: keyof IPointCloudBoxRect) => boolean;
|
|
92
90
|
removeRectByPointCloudBoxId: (imageName: string) => boolean;
|
|
93
91
|
rectRotateSensitivity: number;
|
|
94
92
|
setRectRotateSensitivity: (sensitivity: number) => void;
|
|
93
|
+
/** imageName -> pointCloudBox.id -> [pointCloudBox, ...] */
|
|
94
|
+
imageNamePointCloudBoxMap: MapIndirectWeakSet<IPointCloudBox>;
|
|
95
|
+
/** imageName -> pointCloudBox.id -> [rect, ...] */
|
|
96
|
+
linkageImageNameRectMap: MapIndirectWeakSet<IPointCloudBoxRect>;
|
|
95
97
|
}
|
|
96
98
|
export declare const PointCloudContext: React.Context<IPointCloudContext>;
|
|
97
|
-
export declare const PointCloudProvider: React.FC<{}
|
|
99
|
+
export declare const PointCloudProvider: React.FC<PropsWithChildren<{}>>;
|
|
98
100
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IPointCloudBox, PartialIPointCloudBoxList } from '@labelbee/lb-utils';
|
|
2
|
+
import { IFileItem } from '@/types/data';
|
|
2
3
|
interface IUseSingleBoxParams {
|
|
3
4
|
generateRects?: (box: IPointCloudBox) => void;
|
|
4
5
|
}
|
|
@@ -17,6 +18,6 @@ export declare const useSingleBox: (props?: IUseSingleBoxParams) => {
|
|
|
17
18
|
selectedBoxes: IPointCloudBox[];
|
|
18
19
|
updateSelectedBoxes: (updateList: PartialIPointCloudBoxList) => import("@labelbee/lb-utils").IPointCloudBoxList | undefined;
|
|
19
20
|
getPointCloudByID: (id: string) => IPointCloudBox | undefined;
|
|
20
|
-
deleteSelectedPointCloudBoxAndPolygon: () => void;
|
|
21
|
+
deleteSelectedPointCloudBoxAndPolygon: (currentData: IFileItem) => void;
|
|
21
22
|
};
|
|
22
23
|
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type MapIndirectWeakSet<T extends object> = Map<string, Map<string, WeakSet<T>>>;
|
|
2
|
+
/**
|
|
3
|
+
* Update MapIndirectWeakSet
|
|
4
|
+
*
|
|
5
|
+
* @param map The map will be changed
|
|
6
|
+
* @param key0 The top key
|
|
7
|
+
* @param key1 The inner key
|
|
8
|
+
* @param value The target to be set
|
|
9
|
+
* @returns return map
|
|
10
|
+
*/
|
|
11
|
+
export declare const addMapIndirectWeakSetItem: <T extends object>(map: MapIndirectWeakSet<T>, key0: string, key1: string, value: T) => MapIndirectWeakSet<T>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import './index.scss';
|
|
|
10
10
|
import PredictTracking from '@/components/predictTracking';
|
|
11
11
|
import LLMToolView from '@/components/LLMToolView';
|
|
12
12
|
import SwitchCuboidBoxIn2DView from '@/views/MainView/toolFooter/SwitchCuboidBoxIn2DView';
|
|
13
|
+
import BatchSwitchConnectIn2DView from '@/views/MainView/toolFooter/BatchSwitchConnectIn2DView';
|
|
13
14
|
import MeasureCanvas from './components/measureCanvas';
|
|
14
15
|
import AnnotatedBox from './views/MainView/sidebar/PointCloudToolSidebar/components/annotatedBox';
|
|
15
16
|
import RectRotateSensitivitySlider from './views/MainView/sidebar/PointCloudToolSidebar/components/rectRotateSensitivitySlider';
|
|
@@ -22,6 +23,6 @@ export declare const store: import("redux").Store<{}, import("redux").Action<any
|
|
|
22
23
|
};
|
|
23
24
|
declare const _default: React.ForwardRefExoticComponent<AppProps & React.RefAttributes<unknown>>;
|
|
24
25
|
export default _default;
|
|
25
|
-
export { AnnotationView, PointCloudAnnotationView, QuestionView, TextContent, LLMToolView, i18n, VideoTagTool, PredictTracking, SwitchCuboidBoxIn2DView, MeasureCanvas, AnnotatedBox, RectRotateSensitivitySlider, FindTrackIDIndex, AudioPlayer, generatePointCloudBoxRects, SubAttributeList, };
|
|
26
|
+
export { AnnotationView, PointCloudAnnotationView, QuestionView, TextContent, LLMToolView, i18n, VideoTagTool, PredictTracking, SwitchCuboidBoxIn2DView, BatchSwitchConnectIn2DView, MeasureCanvas, AnnotatedBox, RectRotateSensitivitySlider, FindTrackIDIndex, AudioPlayer, generatePointCloudBoxRects, SubAttributeList, };
|
|
26
27
|
export * from './constant';
|
|
27
28
|
export * from './typeTem';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The component which provides the batch operation for connection/disconnection
|
|
3
|
+
*/
|
|
4
|
+
import { FC } from 'react';
|
|
5
|
+
export declare enum EventBusEvent {
|
|
6
|
+
switchConnect = "batch:switch-connect"
|
|
7
|
+
}
|
|
8
|
+
declare const BatchSwitchConnectIn2DView: FC;
|
|
9
|
+
export default BatchSwitchConnectIn2DView;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default, EventBusEvent as BatchSwitchConnectionEventBusEvent } from './BatchSwitchConnectIn2DView';
|
package/dist/views/MainView/toolFooter/BatchSwitchConnectIn2DView/BatchSwitchConnectIn2DView.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),antd=require("antd"),reactI18next=require("react-i18next"),PointCloudContext=require("../../../../components/pointCloudView/PointCloudContext.js"),lbAnnotation=require("@labelbee/lb-annotation");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);exports.EventBusEvent=void 0,function(e){e.switchConnect="batch:switch-connect"}(exports.EventBusEvent||(exports.EventBusEvent={}));const BatchSwitchConnectIn2DView=()=>{const{cuboidBoxIn2DView:e}=React.useContext(PointCloudContext.PointCloudContext),{t}=reactI18next.useTranslation(),n=React.useCallback((o,r)=>{lbAnnotation.EventBus.emit(exports.EventBusEvent.switchConnect,r)},[]),c=React.useCallback(o=>{n(o,!0)},[n]),a=React.useCallback(o=>{n(o,!1)},[n]);return e?null:React__default.default.createElement("div",{style:{margin:"0 10px"}},t("2DImageBatch")," \xA0",React__default.default.createElement(antd.Popconfirm,{title:t("ConfirmToBatchConnect"),onConfirm:c,okText:t("Confirm"),cancelText:t("Cancel")},React__default.default.createElement(antd.Button,{size:"small"},t("Connect"))),"\xA0",React__default.default.createElement(antd.Popconfirm,{title:t("ConfirmToBatchDisconnect"),onConfirm:a,okText:t("Confirm"),cancelText:t("Cancel")},React__default.default.createElement(antd.Button,{size:"small"},t("Disconnect"))))};exports.default=BatchSwitchConnectIn2DView;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useMemoizedFn as
|
|
1
|
+
import{useMemoizedFn as P,useLatest as Y}from"ahooks";import{Spin as Z}from"antd/es";import N,{useContext as ee,useRef as z,useState as te,useMemo as ne,useEffect as d}from"react";import{connect as re}from"react-redux";import{usePointCloudViews as oe}from"../pointCloudView/hooks/usePointCloudViews.js";import{PointCloudContext as ie}from"../pointCloudView/PointCloudContext.js";import{a2MapStateToProps as le}from"../../store/annotation/map.js";import{LabelBeeContext as ce}from"../../store/ctx.js";import{PointCloud2DRectOperation as ue,ImgUtils as ae}from"@labelbee/lb-annotation";var se=Object.defineProperty,de=Object.defineProperties,fe=Object.getOwnPropertyDescriptors,F=Object.getOwnPropertySymbols,pe=Object.prototype.hasOwnProperty,me=Object.prototype.propertyIsEnumerable,J=(u,i,l)=>i in u?se(u,i,{enumerable:!0,configurable:!0,writable:!0,value:l}):u[i]=l,m=(u,i)=>{for(var l in i||(i={}))pe.call(i,l)&&J(u,l,i[l]);if(F)for(var l of F(i))me.call(i,l)&&J(u,l,i[l]);return u},R=(u,i)=>de(u,fe(i)),T=(u,i,l)=>new Promise((a,f)=>{var v=s=>{try{_(l.next(s))}catch(p){f(p)}},h=s=>{try{_(l.throw(s))}catch(p){f(p)}},_=s=>s.done?a(s.value):Promise.resolve(s.value).then(v,h);_((l=l.apply(u,i)).next())});const ve=u=>{var i,l;const{mappingData:a,size:f,config:v,checkMode:h,afterImgOnLoad:_,shouldExcludePointCloudBoxListUpdate:s}=u,p=(i=a==null?void 0:a.url)!=null?i:"",D=(l=a==null?void 0:a.fallbackUrl)!=null?l:"",{pointCloudBoxList:x,setPointCloudResult:C,defaultAttribute:y,rectList:O,addRectIn2DView:$,updateRectIn2DView:E,removeRectIn2DView:q}=ee(ie),{update2DViewRect:G,remove2DViewRect:H}=oe(),L=N.useRef(null),r=z(null),j=P(G),b=P(H),w=z(null),[K,B]=te(!0),V=ne(()=>O==null?void 0:O.filter(e=>e.imageName===(a==null?void 0:a.path)),[a==null?void 0:a.path,O]),I=Y(a==null?void 0:a.path),U=e=>{const{boxID:o}=e;if(!s&&o){const t=j==null?void 0:j(e);w.current=t,C(t);return}E(e,!0)},A=e=>{I.current&&$(R(m({},e),{imageName:I.current}))},k=e=>{if(e.length===0)return;if(!s){const t=e.find(n=>n.boxID);if(t){const n=b==null?void 0:b(t);w.current=n,C(n),g();return}}const o=e.find(t=>t.extId);if(o){const{imageName:t,extId:n}=o,c=b==null?void 0:b({boxID:n,imageName:t});w.current=c,C(c)}q(e)},Q=P(()=>{let e=[];return x.forEach(o=>{const{rects:t=[],id:n,attribute:c,trackID:S}=o,M=t.find(X=>X.imageName===I.current),W=n+"_"+I.current;M&&(e=[...e,R(m({},M),{boxID:n,id:W,attribute:c,order:S})])}),e}),g=P(()=>{var e,o,t;const n=s?[]:Q(),c=(e=r.current)==null?void 0:e.selectedRectID;(o=r.current)==null||o.setResult([...n,...V]),c&&((t=r.current)==null||t.setSelectedRectID(c))});return d(()=>{if(L.current){const e=new ue({container:L.current,size:f,config:R(m({},v),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:h});return r.current=e,r.current.init(),r.current.on("updateDragResult",U),r.current.on("afterAddingDrawingRect",A),r.current.on("deleteSelectedRects",k),()=>{var o,t,n,c;(o=r.current)==null||o.unbind("updateDragResult",U),(t=r.current)==null||t.unbind("afterAddingDrawingRect",A),(n=r.current)==null||n.unbind("deleteSelectedRects",k),(c=r.current)==null||c.destroy()}}},[]),d(()=>{const e=t=>T(void 0,null,function*(){try{return yield ae.load(t)}catch(n){return console.error("Error loading image:",n),null}}),o=()=>T(void 0,null,function*(){var t;B(!0);let n=yield e(p);!n&&D&&(n=yield e(D)),n&&((t=r.current)==null||t.setImgNode(n),_(n)),B(!1)});r.current&&(p||D)&&o()},[p,D]),d(()=>{var e;(e=r.current)==null||e.setSize(f)},[f]),d(()=>{x!==w.current&&g()},[x]),d(()=>{var e,o,t;const n=V.find(c=>c.id===r.current.selectedRectID);(o=(e=r.current)==null?void 0:e.setDefaultAttribute)==null||o.call(e,y),n&&E(R(m({},(t=r.current)==null?void 0:t.selectedRect),{attribute:y})),g()},[y]),d(()=>{g()},[V]),d(()=>{g()},[s]),d(()=>{var e,o,t,n;const c=(o=(e=r.current)==null?void 0:e.config)!=null?o:{},S=R(m({},c),{attributeList:(t=v.attributeList)!=null?t:[]});(n=r.current)==null||n.setConfig(JSON.stringify(S))},[v.attributeList]),N.createElement(Z,{spinning:K},N.createElement("div",{ref:L,style:m({position:"relative"},f)}))};var _e=re(le,null,null,{context:ce})(ve);export{_e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getClassName as U}from"../../utils/dom.js";import l,{useRef as j,useState as A,useContext as F,useMemo as
|
|
1
|
+
import{getClassName as U}from"../../utils/dom.js";import l,{useRef as j,useState as A,useContext as F,useMemo as T,useCallback as q,useEffect as w}from"react";import G from"../AnnotationView/index.js";import J from"../../hooks/useSize.js";import{useSingleBox as K}from"./hooks/useSingleBox.js";import{useHighlight as M}from"./hooks/useHighlight.js";import Q from"./components/HighlightVisible/index.js";import{PointCloudContext as W}from"./PointCloudContext.js";import X from"./hooks/useDataLinkSwitch.js";import Y from"../pointCloud2DRectOperationView/index.js";var Z=(t,c,e)=>new Promise((s,a)=>{var f=o=>{try{i(e.next(o))}catch(n){a(n)}},u=o=>{try{i(e.throw(o))}catch(n){a(n)}},i=o=>o.done?s(o.value):Promise.resolve(o.value).then(f,u);i((e=e.apply(t,c)).next())});const $=({view2dData:t,setSelectedID:c,currentData:e,showEnlarge:s,checkMode:a=!1,measureVisible:f})=>{var u,i;const o=j(null),n=j(),{selectedBox:d}=K(),g=J(o),{url:x,fallbackUrl:b,calib:k,path:y}=t,{toggle2dVisible:_,isHighlightVisible:v}=M({currentData:e}),[z,C]=A(!1),{cuboidBoxIn2DView:p,cacheImageNodeSize:B}=F(W),I=!t,O=T(()=>({zIndex:s?-1:101,is2DView:!p,imageName:t.path}),[s,p,t.path]),{rendered:R,isLinking:E}=X(O),L=m=>{h(),B({path:y,imgNode:m})},h=q(()=>{var m,S;const V=(m=n.current)==null?void 0:m.toolInstance;if(c(""),!d||!V)return;const r=t.annotations.find(N=>N.annotation.id===d.info.id);let P="";r&&((S=r==null?void 0:r.annotation.pointList)==null?void 0:S.length)>0&&(V.focusPositionByPointList(r==null?void 0:r.annotation.pointList),P=d.info.id,c(P))},[d,n.current,t.annotations]);w(()=>{h()},[h]);const H=()=>Z(void 0,null,function*(){C(!0),yield _(x,b!=null?b:"",k),C(!1)});return l.createElement("div",{className:U("point-cloud-2d-image"),ref:o},p?l.createElement(G,{src:(u=t==null?void 0:t.url)!=null?u:"",fallbackSrc:(i=t==null?void 0:t.fallbackUrl)!=null?i:"",annotations:t.annotations,size:g,ref:n,globalStyle:{display:I?"none":"block"},afterImgOnLoad:L,zoomInfo:{min:.01,max:1e3,ratio:.4},measureVisible:f}):l.createElement(l.Fragment,null,l.createElement(Y,{shouldExcludePointCloudBoxListUpdate:!E,mappingData:t,size:g,checkMode:a,afterImgOnLoad:L}),!a&&R),k&&l.createElement(Q,{visible:v(x),onClick:H,loading:z,style:{position:"absolute",right:16,top:16,zIndex:s?-1:101}}))};export{$ as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{EPointCloudPattern as
|
|
1
|
+
import{EPointCloudPattern as q}from"@labelbee/lb-utils";import Pt,{useState as r,useRef as Kt,useMemo as H,useCallback as J,useEffect as K}from"react";import{ActionsHistory as yt,EToolName as Q,uuid as Qt}from"@labelbee/lb-annotation";import{useDispatch as Ut}from"../../store/ctx.js";import{ChangeSave as Xt}from"../../store/annotation/actionCreators.js";import Yt from"../../store/annotatedBox/index.js";import wt from"lodash";import{addMapIndirectWeakSetItem as bt}from"./utils/map.js";var $t=Object.defineProperty,te=Object.defineProperties,ee=Object.getOwnPropertyDescriptors,Ct=Object.getOwnPropertySymbols,ne=Object.prototype.hasOwnProperty,ie=Object.prototype.propertyIsEnumerable,St=(a,n,c)=>n in a?$t(a,n,{enumerable:!0,configurable:!0,writable:!0,value:c}):a[n]=c,M=(a,n)=>{for(var c in n||(n={}))ne.call(n,c)&&St(a,c,n[c]);if(Ct)for(var c of Ct(n))ie.call(n,c)&&St(a,c,n[c]);return a},Lt=(a,n)=>te(a,ee(n)),oe=(a,n,c)=>new Promise((L,R)=>{var A=m=>{try{P(c.next(m))}catch(b){R(b)}},j=m=>{try{P(c.throw(m))}catch(b){R(b)}},P=m=>m.done?L(m.value):Promise.resolve(m.value).then(A,j);P((c=c.apply(a,n)).next())});const Dt=a=>wt.pick(a,["id","attribute","width","height","x","y","imageName"]),xt=Pt.createContext({rectList:[],pointCloudBoxList:[],pointCloudSphereList:[],displayPointCloudList:[],displaySphereList:[],displayLineList:[],polygonList:[],lineList:[],selectedID:"",selectedIDs:[],highlightIDs:[],setHighlightIDs:()=>{},valid:!0,setSelectedIDs:()=>{},setPointCloudResult:()=>{},setPointCloudSphereList:()=>{},setPointCloudValid:()=>{},setTopViewInstance:()=>{},setSideViewInstance:()=>{},setBackViewInstance:()=>{},setMainViewInstance:()=>{},addSelectedID:()=>{},addHighlightID:()=>{},selectedAllBoxes:()=>{},addPointCloudBox:()=>[],addPointCloudSphere:()=>[],setPolygonList:()=>{},setRectList:()=>{},addRectIn2DView:()=>{},removeRectIn2DView:()=>{},updateRectIn2DView:()=>{},setLineList:()=>{},zoom:1,setZoom:()=>{},history:new yt,hideAttributes:[],setHideAttributes:()=>{},toggleAttributesVisible:()=>{},reRender:()=>{},setAttrPanelLayout:()=>{},attrPanelLayout:"",syncAllViewPointCloudColor:()=>Promise.resolve(),defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:Q.Rect,setPointCloudPattern:()=>{},selectSpecAttr:()=>{},globalPattern:q.Detection,setGlobalPattern:()=>{},setPtSegmentInstance:()=>{},segmentation:[],setSegmentation:()=>{},clearAllDetectionInstance:()=>{},highlight2DDataList:[],setHighlight2DDataList:()=>{},cuboidBoxIn2DView:!0,setCuboidBoxIn2DView:a=>{},imageSizes:{},cacheImageNodeSize:()=>{},addRectFromPointCloudBoxByImageName:a=>!1,removeRectBySpecifyId:(a,n,c)=>!1,removeRectByPointCloudBoxId:a=>!1,rectRotateSensitivity:2,setRectRotateSensitivity:()=>{},imageNamePointCloudBoxMap:new Map,linkageImageNameRectMap:new Map}),se=({children:a})=>{const[n,c]=r([]),[L,R]=r([]),[A,j]=r([]),[P,m]=r([]),[b,Rt]=r([]),[I,k]=r([]),[_,F]=r([]),[U,At]=r(!0),[X,_t]=r(2),[Y,Bt]=r(!0),[$,Vt]=r(1),[f,tt]=r(),[et,nt]=r(),[it,ot]=r(),[u,st]=r(),[rt,Nt]=r(""),[z,Ot]=r(Q.Rect),Ht=Kt(new yt).current,[g,E]=r([]),[lt,Mt]=r(""),[G,jt]=r(q.Detection),[D,at]=r(void 0),[T,kt]=r([]),[Z,Ft]=r([]),h=Yt(),[ct,zt]=r({}),Et=Ut(),Gt=i=>{const{imgNode:o,path:e}=i;e&&o&&zt(d=>Lt(M({},d),{[e]:{width:o.width,height:o.height}}))},dt=H(()=>I.length===1?I[0]:"",[I]),B=J((i,o,e="extId")=>{const d=e||"id",l=new Set(o);return m(p=>{let C=!1;const S=p.filter(N=>{const W=N[d],O=l.has(W)?N.imageName!==i:!0;return O||(C=!0),O});return C?S:p}),!0},[]),ut=J(i=>{const o=n.map(e=>e.id);return B(i,o,"extId")},[n,B]),pt=J(i=>{if(!i)return!1;const o=n.filter(e=>Array.isArray(e.rects)).map(e=>{const{id:d,attribute:l,trackID:p}=e,C=e.rects.find(S=>S.imageName===i);if(C){const S=wt.pick(C,["width","height","x","y","imageName"]);return Lt(M({},S),{id:Qt(),attribute:l,order:p,extId:d,lineDash:[]})}return null}).filter(e=>e!==null);return o.length?(m(e=>{const d=new Set(e.filter(p=>i===p.imageName).map(p=>p.extId)),l=o.filter(p=>d.has(p.extId)===!1);return l.length?[...e,...l]:e}),!0):!1},[n]),mt=H(()=>n.filter(o=>Array.isArray(o.rects)&&o.rects.length>0).reduce((o,e)=>{var d;return(d=e.rects)==null||d.forEach(l=>{const{imageName:p}=l;if(!p){console.warn("Missing image name"),console.trace(l,e);return}bt(o,p,e.id,e)}),o},new Map),[n]),ft=H(()=>P.filter(i=>i.extId!==void 0&&i.id!==void 0).reduce((i,o)=>{const e=o.imageName;return e?(bt(i,e,o.extId,o),i):(console.warn("missing image name"),console.log(o,P),i)},new Map),[P]),V=H(()=>{const i=n.find(t=>t.id===dt),o=t=>{const s=n.concat(t);return c(s),s},e=t=>{const s=L.concat(t);return R(s),s},d=t=>{At(t!==!1)},l=t=>{t===void 0&&k([]),typeof t=="string"&&k([t]),Array.isArray(t)&&k(Array.from(new Set(t)))},p=t=>{I.includes(t)?l(I.filter(s=>s!==t)):l([...I,t])},C=t=>{const s=Dt(t);m(v=>[...v,s])},S=(t,s=!1)=>{const v=Dt(t);m(w=>w.map(y=>y.id===t.id?s?M(M({},y),v):v:y))},N=t=>{m(s=>s.filter(v=>!t.find(w=>w.id===v.id)))},W=t=>{_.includes(t)?F([]):F([t])},O=()=>{if(z===Q.Rect){const t=n.map(s=>s.id);l(t),f==null||f.pointCloud2dOperation.setSelectedIDs(t)}},Zt=t=>{l(n.filter(s=>s.attribute===t).map(s=>s.id))},gt=n.filter(t=>!g.includes(t.attribute)),ht=L.filter(t=>!g.includes(t.attribute)),vt=b.filter(t=>t.attribute&&!g.includes(t.attribute)),Wt=t=>{if(g.includes(t))E(g.filter(s=>s!==t));else{const s=g.concat(t);E(s)}},qt=(t=gt,s=A,v=ht,w=vt,y=T)=>{var x;u==null||u.clearAllBox(),u==null||u.clearAllSphere(),f==null||f.updatePolygonList(t,s),f==null||f.updatePointList(v),f==null||f.updateLineList(w),u==null||u.generateBoxes(t),u==null||u.generateSpheres(v),(x=D==null?void 0:D.store)==null||x.updateCurrentSegment(y),It(t)},Jt=()=>{tt(void 0),nt(void 0),ot(void 0),st(void 0)},It=(t,s)=>oe(void 0,null,function*(){var v;if(!u)return;const w=u.pointCloudObject;if(!!w)try{const y=yield u.getHighlightIndexByMappingImgList({mappingImgList:s!=null?s:Z,points:w.geometry.attributes.position.array}),x=yield u==null?void 0:u.highlightOriginPointCloud(t,y);return x&&((v=f==null?void 0:f.pointCloudInstance)==null||v.updateColor(x)),x}catch(y){console.error(y)}});return{selectedID:dt,pointCloudBoxList:n,pointCloudSphereList:L,displayPointCloudList:gt,displaySphereList:ht,displayLineList:vt,selectedIDs:I,setPointCloudResult:c,setSelectedIDs:l,addPointCloudBox:o,addPointCloudSphere:e,setPointCloudSphereList:R,valid:U,selectedPointCloudBox:i,setPointCloudValid:d,addSelectedID:p,addHighlightID:W,selectedAllBoxes:O,topViewInstance:f,setTopViewInstance:tt,sideViewInstance:et,setSideViewInstance:nt,backViewInstance:it,setBackViewInstance:ot,mainViewInstance:u,setMainViewInstance:st,polygonList:A,setPolygonList:j,rectList:P,setRectList:m,addRectIn2DView:C,removeRectIn2DView:N,updateRectIn2DView:S,lineList:b,setLineList:Rt,zoom:$,setZoom:Vt,history:Ht,toggleAttributesVisible:Wt,hideAttributes:g,setHideAttributes:E,reRender:qt,attrPanelLayout:lt,setAttrPanelLayout:Mt,syncAllViewPointCloudColor:It,defaultAttribute:rt,setDefaultAttribute:Nt,pointCloudPattern:z,setPointCloudPattern:Ot,selectSpecAttr:Zt,globalPattern:G,setGlobalPattern:t=>{G!==t&&(Et(Xt),jt(t),t===q.Detection&&at(void 0))},ptSegmentInstance:D,setPtSegmentInstance:at,segmentation:T,setSegmentation:kt,clearAllDetectionInstance:Jt,highlight2DDataList:Z,setHighlight2DDataList:Ft,cuboidBoxIn2DView:Y,setCuboidBoxIn2DView:Bt,imageSizes:ct,cacheImageNodeSize:Gt,highlightIDs:_,setHighlightIDs:F,removeRectByPointCloudBoxId:ut,removeRectBySpecifyId:B,addRectFromPointCloudBoxByImageName:pt,rectRotateSensitivity:X,setRectRotateSensitivity:_t,imageNamePointCloudBoxMap:mt,linkageImageNameRectMap:ft}},[U,I,n,L,A,b,P,f,et,it,u,$,g,lt,rt,z,G,D,T,Z,Y,ct,_,ut,B,pt,X,mt,ft]);K(()=>{var i,o,e;(i=h==null?void 0:h.setPointCloudBoxList)==null||i.call(h,n),(o=h==null?void 0:h.setHighlightIDs)==null||o.call(h,_),(e=h==null?void 0:h.setSelectedIDs)==null||e.call(h,I)},[n,I,_]),K(()=>{var i;(i=h==null?void 0:h.setPtCtx)==null||i.call(h,V)},[V]);const Tt=()=>{const i=n.filter(l=>g.includes(l.attribute)),{setSelectedIDs:o,reRender:e}=V,d=i.map(l=>l.id);d.length>0&&o(I.filter(l=>!d.includes(l))),e()};return K(()=>{var i,o,e,d;Tt(),(o=(i=f==null?void 0:f.toolInstance)==null?void 0:i.setHiddenAttributes)==null||o.call(i,g),(d=(e=D==null?void 0:D.store)==null?void 0:e.setHiddenAttributes)==null||d.call(e,g)},[g]),Pt.createElement(xt.Provider,{value:V},a)};export{xt as PointCloudContext,se 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{EPointCloudName as le,CommonToolUtils as de,AttributeUtils as ce,EToolName as P,cTool as pe}from"@labelbee/lb-annotation";import{message as g}from"antd";import{connect as me}from"react-redux";import{a2MapStateToProps as ve}from"../../store/annotation/map.js";import{useStatus as be}from"./hooks/useStatus.js";import{usePointCloudViews as Pe}from"./hooks/usePointCloudViews.js";import{LabelBeeContext as fe,useDispatch as ye}from"../../store/ctx.js";import{useHistory as we}from"./hooks/useHistory.js";import{useAttribute as Ce}from"./hooks/useAttribute.js";import{useConfig as he}from"./hooks/useConfig.js";import{usePolygon as ge}from"./hooks/usePolygon.js";import{useLine as Se}from"./hooks/useLine.js";import{useTranslation as ke}from"react-i18next";import{PreDataProcess as xe}from"../../store/annotation/actionCreators.js";import{useLatest as _e}from"ahooks";var Le=Object.defineProperty,Ve=Object.defineProperties,Be=Object.getOwnPropertyDescriptors,E=Object.getOwnPropertySymbols,Oe=Object.prototype.hasOwnProperty,je=Object.prototype.propertyIsEnumerable,I=(u,r,l)=>r in u?Le(u,r,{enumerable:!0,configurable:!0,writable:!0,value:l}):u[r]=l,f=(u,r)=>{for(var l in r||(r={}))Oe.call(r,l)&&I(u,l,r[l]);if(E)for(var l of E(r))je.call(r,l)&&I(u,l,r[l]);return u},y=(u,r)=>Ve(u,Be(r));const{EPolygonPattern:Ae}=pe,Ee=({currentData:u,config:r,checkMode:l,configString:D,imgIndex:S,toolInstanceRef:i})=>{const t=ue(oe),{changeSelectedBoxValid:T,selectNextBox:N,selectPrevBox:H,updateSelectedBox:k,deleteSelectedPointCloudBoxAndPolygon:K}=ie(),{selectedSphere:w,updatePointCloudSphere:R}=ae(),{clearAllResult:C,updatePointCloudPattern:U}=be(),{copySelectedBoxes:z,pasteSelectedBoxes:F,copiedBoxes:q}=ne({config:r}),{updateRotate:x}=re({currentData:u}),{updateRotateEdge:G}=se({currentData:u}),{updatePointCloudData:v,topViewSelectedChanged:_}=Pe(),{redo:L,undo:V,pushHistoryWithList:M,pushHistoryUnderUpdatePolygon:W,pushHistoryUnderUpdateLine:Y}=we(),$=ye(),{syncThreeViewsAttribute:B}=Ce(),{syncAllViewsConfig:J,reRenderTopViewRange:Q}=he(),{selectedPolygon:O}=ge(),{selectedLine:j}=Se(),{t:h}=ke(),X=_e(u),b=e=>{var o;const{topViewInstance:s}=t;!s||(o=s.pointCloud2dOperation)==null||o.updateSelectedPolygonsPoints(e)},Z=(e,o)=>{var s,a;const{topViewInstance:d,mainViewInstance:n}=t;if(!d)return;const{pointCloud2dOperation:p}=d;switch(e){case"q":{x(t.rectRotateSensitivity);break}case"e":x(-Number(t.rectRotateSensitivity));break;case"g":G(-90);break;case"u":{const m=p.pattern===Ae.Normal?P.Rect:P.Polygon;U(m);const te={[P.Polygon]:h("PolygonPattern"),[P.Rect]:h("RectPattern")};g.success(h("ChangePatternMsg",{pattern:te[m]})),p.clearActiveStatus(),p.clearDrawingStatus()}break;case"+":n==null||n.updatePointSize({zoomIn:!0});break;case"-":n==null||n.updatePointSize({zoomIn:!1});break;case"v":t.setPointCloudValid(!t.valid);break;case"tab":if(o.shiftKey){H();break}N(),o.preventDefault();break;case"f":T();break;case"arrowup":b({y:-1});break;case"arrowdown":b({y:1});break;case"arrowleft":b({x:-1});break;case"arrowright":b({x:1});break;case"delete":K(X.current);break;default:{if(((s=r.attributeList)==null?void 0:s.length)>0){const m=ce.getAttributeByKeycode(o.keyCode,r.attributeList);m!==void 0&&((a=i.current)==null||a.setDefaultAttribute(m))}return}}},ee=(e,o)=>{switch(e){case"c":z();break;case"v":F();break;case"a":o.preventDefault(),t.selectedAllBoxes();break;case"z":{o.shiftKey?L():V();break}}},A=e=>{if(!de.hotkeyFilter(e)||l===!0)return;const o=e.key.toLocaleLowerCase();if(e.ctrlKey){ee(o,e);return}Z(o,e)};return c(()=>{const{topViewInstance:e}=t;if(!!e)return window.addEventListener("keydown",A),()=>{window.removeEventListener("keydown",A)}},[t,q,r,t.pointCloudBoxList,t.polygonList]),c(()=>{J(r)},[D]),c(()=>{(r==null?void 0:r.radius)&&Q(r==null?void 0:r.radius)},[r==null?void 0:r.radius]),c(()=>{v==null||v()},[S,t.mainViewInstance]),c(()=>{t.setHideAttributes([])},[S]),c(()=>{i.current.setDefaultAttribute=e=>{var o,s,a,d;B(e);const n=t.selectedPointCloudBox;if(n){n.attribute=e;const p=$(xe({tool:le.PointCloud,dataList:[n],stepConfig:r,action:"viewUpdateBox"}));n.valid=p[0].valid;const m=k(n);(a=(s=(o=t==null?void 0:t.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null?void 0:s.setPolygonValidAndRender)==null||a.call(s,n.id,!0,n.valid),t.mainViewInstance&&_({newSelectedBox:n,newPointCloudList:m})}if(O&&W(y(f({},O),{attribute:e})),j&&Y(y(f({},j),{attribute:e})),w){const p=R(y(f({},w),{attribute:e}));t.mainViewInstance&&((d=t.mainViewInstance)==null||d.generateSpheres(p),_({newSelectedSphere:w,newSphereList:p}))}},i.current.setSubAttribute=(e,o)=>{var s;const a=t.selectedPointCloudBox;if(a){const d=(s=a==null?void 0:a.subAttribute)!=null?s:{};a.subAttribute=y(f({},d),{[e]:o}),k(a)}},i.current.clearResult=()=>{C==null||C()},i.current.redo=()=>{L()},i.current.undo=()=>{V()},i.current.setValid=e=>{i.current.valid=e,setTimeout(()=>{t.setPointCloudValid(e),e===!1&&C()})},i.current.setForbidOperation=e=>{var o,s;(s=(o=t.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||s.setForbidOperation(e),e===!0&&t.setSelectedIDs(void 0)},i.current.setShowDefaultCursor=e=>{var o,s;(s=(o=t.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||s.setShowDefaultCursor(e)},i.current.asyncData=e=>{setTimeout(()=>{v==null||v(e)})}},[t.pointCloudBoxList,t.pointCloudSphereList,t.selectedID,t.valid,t.polygonList,t.lineList,t.mainViewInstance,t.ptSegmentInstance]),c(()=>{i.current.updateSegmentTool=e=>{var o;(o=t.ptSegmentInstance)==null||o.emit(e)},i.current.segmentInstance=t.ptSegmentInstance},[t.ptSegmentInstance]),c(()=>{i.current.history={pushHistory:e=>{M({pointCloudBoxList:e})},initRecord:()=>{}}},[]),c(()=>{var e;const o=(e=t.topViewInstance)==null?void 0:e.toolInstance;if(!o||l)return;const s=n=>{B(n)},a=n=>{g.error(n)},d=n=>{g.info(n)};return o.on("syncAttribute",s),o.on("messageError",a),o.on("messageInfo",d),()=>{o.unbind("syncAttribute",s),o.unbind("messageError",a),o.unbind("messageInfo",d)}},[t.topViewInstance]),null};var Ie=me(ve,null,null,{context:fe})(Ee);export{Ie as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import u,{useState as V,useContext as j,useMemo as C,useCallback as d,useEffect as N}from"react";import{useLatest as s}from"ahooks";import{PointCloudContext as p}from"../PointCloudContext.js";import z from"../../../assets/annotation/icon_link.svg.js";import L from"../../../assets/annotation/icon_unlink.svg.js";import{EventBusEvent as v}from"../../../views/MainView/toolFooter/BatchSwitchConnectIn2DView/BatchSwitchConnectIn2DView.js";import{EventBus as x}from"@labelbee/lb-annotation";const k={width:16,height:16},F=e=>{e.imageName||console.warn("missing imageName");const[a,B]=V(!0),g=s(e.imageName),{addRectFromPointCloudBoxByImageName:b,removeRectByPointCloudBoxId:y,imageNamePointCloudBoxMap:o,linkageImageNameRectMap:f}=j(p),c=C(()=>e.imageName?o.has(e.imageName):(console.error("Missing image name"),!1),[e.imageName,o]),S=s(c),R=s(b),_=s(y),i=d(n=>{if(!S.current)return;const t=g.current;if(!t){console.warn("invalid image name");return}B(n),n?_.current(t):R.current(t)},[]),E=d(()=>{i(!a)},[i,a]),P=C(()=>{var n;if(!e.is2DView||!c)return null;const r={zIndex:(n=e.zIndex)!=null?n:999,position:"absolute",top:16,right:16+28+12,background:"rgba(0, 0, 0, 0.74)",color:"white",borderRadius:2,padding:6,display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28};return u.createElement("div",{style:r},a&&u.createElement("img",{src:z,style:k}),!a&&u.createElement("img",{src:L,style:k}))},[a,e.is2DView,e.zIndex,E,c]),m=d(()=>{var n,t,r,h;if(!e.is2DView)return;const l=g.current;if(!l){console.warn("invalid image name");return}const D=new Set([...(t=(n=o.get(l))==null?void 0:n.keys())!=null?t:[]]),w=[...(h=(r=f.get(l))==null?void 0:r.keys())!=null?h:[]];let I=!0;w.length&&(I=Boolean(w.find(M=>D.has(M)))===!1),i(I)},[e.is2DView,f,o,i]);return N(()=>{m()},[m]),N(()=>{const n=t=>{i(t)};return x.on(v.switchConnect,n),()=>x.unbind(v.switchConnect,n)},[i]),{rendered:P,isLinking:a,swapSwitch:i,syncIsLinking:m}};export{F as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useContext as
|
|
1
|
+
import{useContext as oe,useMemo as A,useCallback as c}from"react";import m from"lodash";import{PointCloudContext as te}from"../PointCloudContext.js";import{EToolName as M,cAnnotation as ne}from"@labelbee/lb-annotation";import{useHistory as ie}from"./useHistory.js";import{usePolygon as le}from"./usePolygon.js";var de=Object.defineProperty,re=Object.defineProperties,se=Object.getOwnPropertyDescriptors,H=Object.getOwnPropertySymbols,ae=Object.prototype.hasOwnProperty,ce=Object.prototype.propertyIsEnumerable,T=(i,o,l)=>o in i?de(i,o,{enumerable:!0,configurable:!0,writable:!0,value:l}):i[o]=l,ue=(i,o)=>{for(var l in o||(o={}))ae.call(o,l)&&T(i,l,o[l]);if(H)for(var l of H(o))ce.call(o,l)&&T(i,l,o[l]);return i},fe=(i,o)=>re(i,se(o));const{ESortDirection:B}=ne,pe=i=>{const{pointCloudBoxList:o,setPointCloudResult:l,topViewInstance:r,backViewInstance:_,sideViewInstance:h,selectedIDs:y,selectedID:O,mainViewInstance:u,setSelectedIDs:k,syncAllViewPointCloudColor:b,polygonList:K,pointCloudPattern:V,rectList:D,removeRectIn2DView:S,addRectIn2DView:L}=oe(te),{selectedPolygon:f,updateSelectedPolygon:W,updatePolygonValidByID:q,deletePolygon:z}=le(),{pushHistoryWithList:E}=ie(),s=A(()=>{const e=o.findIndex(n=>n.id===O);if(e>-1)return{info:o[e],index:e}},[O,o]),R=c(e=>{var n;if(s==null?void 0:s.info){(n=i==null?void 0:i.generateRects)==null||n.call(i,e),o.splice(s.index,1,m.merge(s.info,e));const t=m.cloneDeep(o);return l(t),E({pointCloudBoxList:t}),t}return o},[O,o]),F=c((e,n)=>{const t=o.findIndex(d=>d.id===n);if(t>-1){o.splice(t,1,m.merge(o[t],e));const d=m.cloneDeep(o);return l(d),d}return o},[o]),I=c(e=>{r==null||r.pointCloud2dOperation.setPolygonValidAndRender(e,!0),h==null||h.pointCloud2dOperation.setPolygonValidAndRender(e,!0),_==null||_.pointCloud2dOperation.setPolygonValidAndRender(e,!0)},[r,h,_]),G=c(()=>{if(s==null?void 0:s.info){const{id:e,valid:n=!0}=s.info,t=R({valid:!n});b(t),I(e)}f&&(W(fe(ue({},f),{valid:!f.valid})),r==null||r.pointCloud2dOperation.setPolygonValidAndRender(f.id,!0))},[I,s,f]),J=c(e=>{const n=o.find(t=>t.id===e);if(n){const{id:t,valid:d=!0}=n,x=F({valid:!d},t);return I(t),x}q(e)},[I,o,K]),N=c((e=B.ascend,n=!1)=>{if(!r||y.length>1)return;if(V!==M.Rect&&V!==M.Polygon){n&&document.dispatchEvent(new KeyboardEvent("keydown",{keyCode:9,shiftKey:e!==B.ascend}));return}const{pointCloud2dOperation:t}=r,d=t.switchToNextPolygon(e);d&&k(d)},[r,V,r==null?void 0:r.toolInstance]),Q=(e=!1)=>{N(B.descend,e)},U=(e=!1)=>{N(B.ascend,e)},j=e=>{const n=o.filter(t=>t.id!==e);l(n),u==null||u.removeObjectByName(e,"box"),u==null||u.render(),b(n)},X=c((e,n)=>{var t,d;const x=new Set((d=(t=n.mappingImgList)==null?void 0:t.map(a=>a.path))!=null?d:[]),v=new Map;e.forEach(a=>{const C=a.id;(a.rects||[]).forEach(w=>{const{imageName:P}=w;if(x.has(P)){let g=v.get(P);g||(g=new Set,v.set(P,g)),g.add(C)}})});const p=D.filter(a=>{var C;const w=a.extId,P=a.imageName;if(P!==void 0&&w!==void 0){const g=v.get(P);return(C=g==null?void 0:g.has(w))!=null?C:!1}return!1});S(p),p.forEach(a=>{L(a)})},[D,S,L]),Y=e=>{s&&(j(s.info.id),r==null||r.pointCloud2dOperation.deletePolygon(s.info.id),X([s.info],e)),f&&(z(f.id),r==null||r.pointCloud2dOperation.deletePolygon(f.id))},Z=A(()=>o.filter(e=>y.includes(e.id)),[y,o]),$=c(e=>{var n;const t=m.cloneDeep(o);let d=!1;for(const x of e){const v=t.findIndex(p=>p.id===x.id);if(v>-1){const p=m.merge(t[v],x);(n=i==null?void 0:i.generateRects)==null||n.call(i,p),t.splice(v,1,p),u==null||u.generateBox(p),d=!0}}if(d)return l(t),E({pointCloudBoxList:t}),u==null||u.render(),t},[y,o]),ee=c(e=>o.find(n=>n.id===e),[o]);return{selectedBox:s,updateSelectedBox:R,changeSelectedBoxValid:G,changeValidByID:J,selectNextBox:U,selectPrevBox:Q,deletePointCloudBox:j,selectedBoxes:Z,updateSelectedBoxes:$,getPointCloudByID:ee,deleteSelectedPointCloudBoxAndPolygon:Y}};export{pe as useSingleBox};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const s=(n,r,d,a)=>{let e=n.get(r);e||(e=new Map,n.set(r,e));let t=e.get(d);return t||(t=new WeakSet,e.set(d,t)),t.add(a),n};export{s as addMapIndirectWeakSetItem};
|
package/es/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{default as AnnotationView}from"./components/AnnotationView/index.js";export{default as PointCloudAnnotationView}from"./components/AnnotationView/pointCloudAnnotationView.js";export{default as QuestionView}from"./components/LLMToolView/questionView/index.js";export{default as TextContent}from"./components/NLPToolView/textContent/index.js";import{i18n as l}from"@labelbee/lb-utils";export{i18n}from"@labelbee/lb-utils";import r,{useState as c,useImperativeHandle as m}from"react";import{I18nextProvider as u}from"react-i18next";import{Provider as f}from"react-redux";import x from"./App.js";import w from"./configureStore.js";import{PageBackward as P,PageForward as v,PageJump as
|
|
1
|
+
export{default as AnnotationView}from"./components/AnnotationView/index.js";export{default as PointCloudAnnotationView}from"./components/AnnotationView/pointCloudAnnotationView.js";export{default as QuestionView}from"./components/LLMToolView/questionView/index.js";export{default as TextContent}from"./components/NLPToolView/textContent/index.js";import{i18n as l}from"@labelbee/lb-utils";export{i18n}from"@labelbee/lb-utils";import r,{useState as c,useImperativeHandle as m}from"react";import{I18nextProvider as u}from"react-i18next";import{Provider as f}from"react-redux";import x from"./App.js";import w from"./configureStore.js";import{PageBackward as P,PageForward as v,PageJump as j}from"./store/annotation/actionCreators.js";export{VideoTagTool}from"./components/videoAnnotate/videoTagTool/TagToolInstanceAdaptorI18nProvider.js";import{PointCloudProvider as T}from"./components/pointCloudView/PointCloudContext.js";import{LabelBeeContext as b}from"./store/ctx.js";export{default as PredictTracking}from"./components/predictTracking/predictTrackingIcon/index.js";export{default as LLMToolView}from"./components/LLMToolView/index.js";export{default as SwitchCuboidBoxIn2DView}from"./views/MainView/toolFooter/SwitchCuboidBoxIn2DView/index.js";export{default as BatchSwitchConnectIn2DView}from"./views/MainView/toolFooter/BatchSwitchConnectIn2DView/BatchSwitchConnectIn2DView.js";export{default as MeasureCanvas}from"./components/measureCanvas/index.js";export{default as AnnotatedBox}from"./views/MainView/sidebar/PointCloudToolSidebar/components/annotatedBox/index.js";export{default as RectRotateSensitivitySlider}from"./views/MainView/sidebar/PointCloudToolSidebar/components/rectRotateSensitivitySlider/index.js";export{FindTrackIDIndexInCheckMode as FindTrackIDIndex}from"./views/MainView/sidebar/PointCloudToolSidebar/components/findTrackIDIndex/index.js";export{WrapAudioPlayer as AudioPlayer}from"./components/audioPlayer/index.js";export{generatePointCloudBoxRects}from"./utils/index.js";export{default as SubAttributeList}from"./components/subAttributeList/index.js";export{EDataFormatType,ELLMDataType,EStepType,ESubmitType,componentCls,prefix}from"./constant/index.js";var g=Object.defineProperty,V=Object.defineProperties,C=Object.getOwnPropertyDescriptors,s=Object.getOwnPropertySymbols,I=Object.prototype.hasOwnProperty,S=Object.prototype.propertyIsEnumerable,d=(o,e,t)=>e in o?g(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,_=(o,e)=>{for(var t in e||(e={}))I.call(e,t)&&d(o,t,e[t]);if(s)for(var t of s(e))S.call(e,t)&&d(o,t,e[t]);return o},A=(o,e)=>V(o,C(e));const n=w(),h=(o,e)=>{const[t,p]=c();return m(e,()=>({toolInstance:t,annotationEngine:n.getState().annotation.annotationEngine,pageBackwardActions:()=>n.dispatch(P()),pageForwardActions:()=>n.dispatch(v()),pageJump:a=>{const i=~~a-1;n.dispatch(j(i))},hello:()=>alert("hello labelBee!!!")}),[t]),r.createElement(f,{store:n,context:b},r.createElement(u,{i18n:l},r.createElement(T,null,r.createElement(x,A(_({},o),{setToolInstance:a=>{var i;p(a),(i=o.onLoad)==null||i.call(o,{toolInstance:a})}})))))};var y=r.forwardRef(h);export{y as default,n as store};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import n,{useContext as f,useCallback as r}from"react";import{Popconfirm as a,Button as m}from"antd";import{useTranslation as u}from"react-i18next";import{PointCloudContext as x}from"../../../../components/pointCloudView/PointCloudContext.js";import{EventBus as p}from"@labelbee/lb-annotation";var c;(function(i){i.switchConnect="batch:switch-connect"})(c||(c={}));const d=()=>{const{cuboidBoxIn2DView:i}=f(x),{t}=u(),e=r((o,C)=>{p.emit(c.switchConnect,C)},[]),l=r(o=>{e(o,!0)},[e]),s=r(o=>{e(o,!1)},[e]);return i?null:n.createElement("div",{style:{margin:"0 10px"}},t("2DImageBatch")," \xA0",n.createElement(a,{title:t("ConfirmToBatchConnect"),onConfirm:l,okText:t("Confirm"),cancelText:t("Cancel")},n.createElement(m,{size:"small"},t("Connect"))),"\xA0",n.createElement(a,{title:t("ConfirmToBatchDisconnect"),onConfirm:s,okText:t("Confirm"),cancelText:t("Cancel")},n.createElement(m,{size:"small"},t("Disconnect"))))};export{c as EventBusEvent,d as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@labelbee/lb-components",
|
|
3
|
-
"version": "1.23.0-alpha.
|
|
3
|
+
"version": "1.23.0-alpha.48",
|
|
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.27.0-alpha.
|
|
46
|
+
"@labelbee/lb-annotation": "1.27.0-alpha.24",
|
|
47
47
|
"@labelbee/lb-utils": "1.19.0-alpha.16",
|
|
48
48
|
"@labelbee/wavesurfer": "1.0.0",
|
|
49
49
|
"@types/react-dom": "^18.2.7",
|