@labelbee/lb-components 1.23.0-alpha.34 → 1.23.0-alpha.35
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/assets/annotation/icon_link.svg.js +1 -0
- package/dist/assets/annotation/icon_unlink.svg.js +1 -0
- package/dist/components/pointCloud2DRectOperationView/index.js +1 -1
- package/dist/components/pointCloudView/PointCloud2DSingleView.js +1 -1
- package/dist/components/pointCloudView/PointCloud2DView.js +1 -1
- package/dist/components/pointCloudView/PointCloudContext.js +1 -1
- package/dist/components/pointCloudView/hooks/useDataLinkSwitch.js +1 -0
- package/dist/types/components/pointCloud2DRectOperationView/index.d.ts +1 -0
- package/dist/types/components/pointCloudView/PointCloudContext.d.ts +7 -1
- package/dist/types/components/pointCloudView/hooks/useDataLinkSwitch.d.ts +21 -0
- package/dist/types/utils/AnnotationDataUtils.d.ts +4 -1
- package/dist/utils/AnnotationDataUtils.js +1 -1
- package/es/assets/annotation/icon_link.svg.js +1 -0
- package/es/assets/annotation/icon_unlink.svg.js +1 -0
- package/es/components/pointCloud2DRectOperationView/index.js +1 -1
- package/es/components/pointCloudView/PointCloud2DSingleView.js +1 -1
- package/es/components/pointCloudView/PointCloud2DView.js +1 -1
- package/es/components/pointCloudView/PointCloudContext.js +1 -1
- package/es/components/pointCloudView/hooks/useDataLinkSwitch.js +1 -0
- package/es/utils/AnnotationDataUtils.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";require("react");var img="data:image/svg+xml,%3csvg class='icon' style='width: 1em%3bheight: 1em%3bvertical-align: middle%3bfill: currentColor%3boverflow: hidden%3b' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M633.417143 429.007238a174.567619 174.567619 0 0 1 0 246.857143l-155.306667 155.306667a186.709333 186.709333 0 1 1-264.045714-264.045715l76.483048-76.507428 51.73638 51.736381-76.507428 76.507428a113.566476 113.566476 0 1 0 160.597333 160.597334l155.306667-155.306667a101.424762 101.424762 0 0 0 0-143.408762z m208.603428-225.816381a186.709333 186.709333 0 0 1 0 264.045714L765.561905 543.744l-51.736381-51.712 76.507428-76.507429a113.566476 113.566476 0 1 0-160.597333-160.597333l-155.306667 155.306667a101.424762 101.424762 0 0 0 0 143.408762l-51.736381 51.736381a174.567619 174.567619 0 0 1 0-246.857143l155.306667-155.306667a186.709333 186.709333 0 0 1 264.045714 0z' fill='white'%3e%3c/path%3e%3c/svg%3e";module.exports=img;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";require("react");var img="data:image/svg+xml,%3csvg class='icon' style='width: 1em%3bheight: 1em%3bvertical-align: middle%3bfill: currentColor%3boverflow: hidden%3b' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M384 128v128h64V128H384zM523.328 613.824l-147.072 147.072a80 80 0 0 1-113.152-113.152l147.072-147.072-45.248-45.248-147.072 147.072a144 144 0 0 0 203.648 203.648l147.072-147.072-45.248-45.248zM613.76 523.328l45.312 45.248 147.072-147.072a144 144 0 1 0-203.648-203.648L455.424 364.928l45.248 45.248 147.072-147.072a80 80 0 0 1 113.152 113.152L613.824 523.328zM768 576h128v64h-128V576zM128 448h128V384H128v64zM640 768v128H576v-128h64zM750.848 705.6l103.808 103.744-45.312 45.248-103.68-103.68 45.184-45.312zM169.344 214.592l103.808 103.808 45.248-45.248-103.744-103.808-45.312 45.248z' fill='white'%3e%3c/path%3e%3c/svg%3e";module.exports=img;
|
|
@@ -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,n)=>i in u?__defProp(u,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):u[i]=n,__spreadValues=(u,i)=>{for(var n in i||(i={}))__hasOwnProp.call(i,n)&&__defNormalProp(u,n,i[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(i))__propIsEnum.call(i,n)&&__defNormalProp(u,n,i[n]);return u},__spreadProps=(u,i)=>__defProps(u,__getOwnPropDescs(i));const PointCloud2DRectOperationView=u=>{var i;const{mappingData:n,size:
|
|
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,n)=>i in u?__defProp(u,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):u[i]=n,__spreadValues=(u,i)=>{for(var n in i||(i={}))__hasOwnProp.call(i,n)&&__defNormalProp(u,n,i[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(i))__propIsEnum.call(i,n)&&__defNormalProp(u,n,i[n]);return u},__spreadProps=(u,i)=>__defProps(u,__getOwnPropDescs(i));const PointCloud2DRectOperationView=u=>{var i;const{mappingData:n,size:s,config:p,checkMode:E,afterImgOnLoad:S,shouldExcludePointCloudBoxListUpdate:d}=u,v=(i=n==null?void 0:n.url)!=null?i:"",{pointCloudBoxList:R,setPointCloudResult:P,defaultAttribute:_,rectList:g,addRectIn2DView:j,updateRectIn2DView:C,removeRectIn2DView:q}=React.useContext(PointCloudContext.PointCloudContext),{update2DViewRect:B,remove2DViewRect:M}=usePointCloudViews.usePointCloudViews(),m=React__default.default.useRef(null),r=React.useRef(null),I=ahooks.useMemoizedFn(B),x=ahooks.useMemoizedFn(M),D=React.useRef(null),[z,h]=React.useState(!0),b=React.useMemo(()=>g==null?void 0:g.filter(e=>e.imageName===(n==null?void 0:n.path)),[n==null?void 0:n.path,g]),f=ahooks.useLatest(n==null?void 0:n.path),O=e=>{const{boxID:o}=e;if(!d&&o){const t=I==null?void 0:I(e);D.current=t,P(t);return}C(e,!0)},L=e=>{f.current&&j(__spreadProps(__spreadValues({},e),{imageName:f.current}))},V=e=>{if(!d){const o=e.find(t=>t.boxID);if(o){const t=x==null?void 0:x(o);D.current=t,P(t),l();return}}q(e)},A=ahooks.useMemoizedFn(()=>{let e=[];return R.forEach(o=>{const{rects:t=[],id:c,attribute:a,trackID:w}=o,y=t.find(N=>N.imageName===f.current),F=c+"_"+f.current;y&&(e=[...e,__spreadProps(__spreadValues({},y),{boxID:c,id:F,attribute:a,order:w})])}),e}),l=ahooks.useMemoizedFn(()=>{var e,o,t;const c=d?[]:A(),a=(e=r.current)==null?void 0:e.selectedRectID;(o=r.current)==null||o.setResult([...c,...b]),a&&((t=r.current)==null||t.setSelectedRectID(a))});return React.useEffect(()=>{if(m.current){const e=new lbAnnotation.PointCloud2DRectOperation({container:m.current,size:s,config:__spreadProps(__spreadValues({},p),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:E});return r.current=e,r.current.init(),r.current.on("updateDragResult",O),r.current.on("afterAddingDrawingRect",L),r.current.on("deleteSelectedRects",V),()=>{var o,t,c,a;(o=r.current)==null||o.unbind("updateDragResult",O),(t=r.current)==null||t.unbind("afterAddingDrawingRect",L),(c=r.current)==null||c.unbind("deleteSelectedRects",V),(a=r.current)==null||a.destroy()}}},[]),React.useEffect(()=>{h(!0),r.current&&v&&lbAnnotation.ImgUtils.load(v).then(e=>{r.current.setImgNode(e),S(e),h(!1)})},[v]),React.useEffect(()=>{var e;(e=r.current)==null||e.setSize(s)},[s]),React.useEffect(()=>{R!==D.current&&l()},[R]),React.useEffect(()=>{var e,o,t;const c=b.find(a=>a.id===r.current.selectedRectID);(o=(e=r.current)==null?void 0:e.setDefaultAttribute)==null||o.call(e,_),c&&C(__spreadProps(__spreadValues({},(t=r.current)==null?void 0:t.selectedRect),{attribute:_})),l()},[_]),React.useEffect(()=>{l()},[b]),React.useEffect(()=>{l()},[d]),React.useEffect(()=>{var e,o,t,c;const a=(o=(e=r.current)==null?void 0:e.config)!=null?o:{},w=__spreadProps(__spreadValues({},a),{attributeList:(t=p.attributeList)!=null?t:[]});(c=r.current)==null||c.setConfig(JSON.stringify(w))},[p.attributeList]),React__default.default.createElement(es.Spin,{spinning:z},React__default.default.createElement("div",{ref:m,style:__spreadValues({position:"relative"},s)}))};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"),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,a,i)=>new Promise((s,u)=>{var d=t=>{try{o(i.next(t))}catch(n){u(n)}},r=t=>{try{o(i.throw(t))}catch(n){u(n)}},o=t=>t.done?s(t.value):Promise.resolve(t.value).then(d,r);o((i=i.apply(e,a)).next())});const PointCloud2DSingleView=({view2dData:e,setSelectedID:a,currentData:i,showEnlarge:s,checkMode:u=!1,measureVisible:d})=>{var r;const o=React.useRef(null),t=React.useRef(),{selectedBox:n}=useSingleBox.useSingleBox(),g=useSize(o),{url:m,calib:p,path:b}=e,{toggle2dVisible:S,isHighlightVisible:y}=useHighlight.useHighlight({currentData:i}),[j,x]=React.useState(!1),{cuboidBoxIn2DView:f,cacheImageNodeSize:q}=React.useContext(PointCloudContext.PointCloudContext),P=!e,B=React.useMemo(()=>({zIndex:s?-1:101,is2DView:!f,imageName:e.path}),[s,f,e.path]),{rendered:V,isLinking:_}=useDataLinkSwitch(B),v=c=>{h(),q({path:b,imgNode:c})},h=React.useCallback(()=>{var c,C;const k=(c=t.current)==null?void 0:c.toolInstance;if(a(""),!n||!k)return;const l=e.annotations.find(I=>I.annotation.id===n.info.id);let L="";l&&((C=l==null?void 0:l.annotation.pointList)==null?void 0:C.length)>0&&(k.focusPositionByPointList(l==null?void 0:l.annotation.pointList),L=n.info.id,a(L))},[n,t.current,e.annotations]);React.useEffect(()=>{h()},[h]);const z=()=>__async(void 0,null,function*(){x(!0),yield S(m,p),x(!1)});return React__default.default.createElement("div",{className:dom.getClassName("point-cloud-2d-image"),ref:o},f?React__default.default.createElement(index,{src:(r=e==null?void 0:e.url)!=null?r:"",annotations:e.annotations,size:g,ref:t,globalStyle:{display:P?"none":"block"},afterImgOnLoad:v,zoomInfo:{min:.01,max:1e3,ratio:.4},measureVisible:d}):React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(index$1,{shouldExcludePointCloudBoxListUpdate:!_,mappingData:e,size:g,checkMode:u,afterImgOnLoad:v}),V),p&&React__default.default.createElement(index$2,{visible:y(m),onClick:z,loading:j,style:{position:"absolute",right:16,top:16,zIndex:s?-1:101}}))};module.exports=PointCloud2DSingleView;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var dom=require("../../utils/dom.js"),React=require("react"),PointCloudLayout=require("./PointCloudLayout.js"),PointCloudContext=require("./PointCloudContext.js"),reactRedux=require("react-redux"),lbAnnotation=require("@labelbee/lb-annotation"),ctx=require("../../store/ctx.js"),map=require("../../store/annotation/map.js"),lbUtils=require("@labelbee/lb-utils"),PointCloud2DSingleView=require("./PointCloud2DSingleView.js"),index$1=require("./components/TitleButton/index.js"),icons=require("@ant-design/icons"),classNames=require("classnames"),icon_esc=require("../../assets/annotation/common/icon_esc.svg.js"),icon_left_squareOutlined=require("../../assets/annotation/common/icon_left_squareOutlined.svg.js"),icon_right_squareOutlined=require("../../assets/annotation/common/icon_right_squareOutlined.svg.js"),_=require("lodash"),index=require("../../utils/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,l,n)=>l in e?__defProp(e,l,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[l]=n,__spreadValues=(e,l)=>{for(var n in l||(l={}))__hasOwnProp.call(l,n)&&__defNormalProp(e,n,l[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(l))__propIsEnum.call(l,n)&&__defNormalProp(e,n,l[n]);return e},__spreadProps=(e,l)=>__defProps(e,__getOwnPropDescs(l));const EKeyCode=lbAnnotation.cKeyCode.default,ContainerTitle=({showEnlarge:e,isEnlargeTopView:l,data:n,setIsEnlarge:m,setCurIndex:f,curIndex:p=0,index:w,annotations2d:b})=>l?React__default.default.createElement(index$1,{title:n==null?void 0:n.calName,style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}):e?React__default.default.createElement("div",{style:{display:"flex",alignItems:"center"}},React__default.default.createElement(icons.LeftOutlined,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{m(!1),f(void 0)}}),React__default.default.createElement("span",null,n==null?void 0:n.calName),React__default.default.createElement("span",{style:{marginLeft:"8px"}},p+1,"/",b==null?void 0:b.length)):React__default.default.createElement(index$1,{title:n==null?void 0:n.calName,onClick:()=>{m(!0),f(w)},style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}),PointCloud2DView=({currentData:e,config:l,thumbnailWidth:n,isEnlargeTopView:m,highlightAttribute:f,loadPCDFileLoading:p,checkMode:w,measureVisible:b})=>{var I;const[d,M]=React.useState([]),{topViewInstance:U,displayPointCloudList:F,polygonList:O,imageSizes:x,selectedIDs:
|
|
1
|
+
"use strict";var dom=require("../../utils/dom.js"),React=require("react"),PointCloudLayout=require("./PointCloudLayout.js"),PointCloudContext=require("./PointCloudContext.js"),reactRedux=require("react-redux"),lbAnnotation=require("@labelbee/lb-annotation"),ctx=require("../../store/ctx.js"),map=require("../../store/annotation/map.js"),lbUtils=require("@labelbee/lb-utils"),PointCloud2DSingleView=require("./PointCloud2DSingleView.js"),index$1=require("./components/TitleButton/index.js"),icons=require("@ant-design/icons"),classNames=require("classnames"),icon_esc=require("../../assets/annotation/common/icon_esc.svg.js"),icon_left_squareOutlined=require("../../assets/annotation/common/icon_left_squareOutlined.svg.js"),icon_right_squareOutlined=require("../../assets/annotation/common/icon_right_squareOutlined.svg.js"),_=require("lodash"),index=require("../../utils/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,l,n)=>l in e?__defProp(e,l,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[l]=n,__spreadValues=(e,l)=>{for(var n in l||(l={}))__hasOwnProp.call(l,n)&&__defNormalProp(e,n,l[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(l))__propIsEnum.call(l,n)&&__defNormalProp(e,n,l[n]);return e},__spreadProps=(e,l)=>__defProps(e,__getOwnPropDescs(l));const EKeyCode=lbAnnotation.cKeyCode.default,ContainerTitle=({showEnlarge:e,isEnlargeTopView:l,data:n,setIsEnlarge:m,setCurIndex:f,curIndex:p=0,index:w,annotations2d:b})=>l?React__default.default.createElement(index$1,{title:n==null?void 0:n.calName,style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}):e?React__default.default.createElement("div",{style:{display:"flex",alignItems:"center"}},React__default.default.createElement(icons.LeftOutlined,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{m(!1),f(void 0)}}),React__default.default.createElement("span",null,n==null?void 0:n.calName),React__default.default.createElement("span",{style:{marginLeft:"8px"}},p+1,"/",b==null?void 0:b.length)):React__default.default.createElement(index$1,{title:n==null?void 0:n.calName,onClick:()=>{m(!0),f(w)},style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}),PointCloud2DView=({currentData:e,config:l,thumbnailWidth:n,isEnlargeTopView:m,highlightAttribute:f,loadPCDFileLoading:p,checkMode:w,measureVisible:b})=>{var I;const[d,M]=React.useState([]),{topViewInstance:U,displayPointCloudList:F,polygonList:O,imageSizes:x,selectedIDs:k}=React.useContext(PointCloudContext.PointCloudContext),[P,B]=React.useState(""),[y,L]=React.useState(!1),[s,E]=React.useState(void 0);React.useEffect(()=>{var o;if(!p&&U&&(e==null?void 0:e.mappingImgList)&&((o=e==null?void 0:e.mappingImgList)==null?void 0:o.length)>0){const i={fill:"transparent",color:"green"};let r=[];e==null||e.mappingImgList.forEach(t=>{var v,R,V;const A=F.reduce((a,c)=>{var g,u;const h=c.id===P||f===c.attribute,{transferViewData:q,viewRangePointList:C}=(g=lbAnnotation.pointCloudLidar2image(c,t.calib,{createRange:h}))!=null?g:{};if(!q||!C)return[];const W=q.reduce((H,$)=>$.type==="line"?[...H,...$.pointList]:H,[]),X=__spreadProps(__spreadValues({},index.getBoundingRect(W)),{imageName:t.path});if(!index.isBoundingRectInImage(X,t.path,x))return a;const T=(u=lbUtils.toolStyleConverter.getColorFromConfig({attribute:c.attribute},__spreadProps(__spreadValues({},l),{attributeConfigurable:!0}),{}))==null?void 0:u.stroke,Y=G({viewDataPointList:q,pointCloudBox:c,defaultViewStyle:i,stroke:T}),K=[...a,...Y];return(C==null?void 0:C.length)>0&&K.unshift({type:"polygon",annotation:__spreadProps(__spreadValues({id:P,pointList:C},i),{stroke:T,fill:"rgba(255, 255, 255, 0.6)"})}),K},[]),z=x[(v=t==null?void 0:t.path)!=null?v:""];z&&_.isNumber((R=t==null?void 0:t.calib)==null?void 0:R.groundHeight)&&O.forEach(a=>{const c=a.pointList.map(u=>{var h;return __spreadProps(__spreadValues({},u),{z:(h=t==null?void 0:t.calib)==null?void 0:h.groundHeight})}),g=lbAnnotation.pointListLidar2Img(c,t==null?void 0:t.calib,z);if(g){const u=lbUtils.toolStyleConverter.getColorFromConfig({attribute:a.attribute},__spreadProps(__spreadValues({},l),{attributeConfigurable:!0}),{});A.push({type:"polygon",annotation:__spreadProps(__spreadValues({id:a.id,pointList:g},i),{stroke:u==null?void 0:u.stroke,fill:k.includes(a.id)?u==null?void 0:u.fill:"rgba(255, 255, 255, 0.6)"})})}}),r.push({annotations:A,url:t==null?void 0:t.url,calName:(V=t==null?void 0:t.calib)==null?void 0:V.calName,calib:t==null?void 0:t.calib,path:t==null?void 0:t.path})}),M(r)}},[F,e==null?void 0:e.mappingImgList,P,f,p,O,x,k]),React.useEffect(()=>(window.addEventListener("keydown",S),()=>{window.removeEventListener("keydown",S)}),[s]);const S=o=>{const{keyCode:i}=o;switch(i){case EKeyCode.Esc:y&&L(!1);break;case EKeyCode.Left:j();break;case EKeyCode.Right:N();break}},j=()=>{s===void 0||!y||Number(s)>0&&E(s-1)},N=()=>{s===void 0||!y||Number(s)<(d==null?void 0:d.length)-1&&E(s+1)},G=({viewDataPointList:o,pointCloudBox:i,defaultViewStyle:r,stroke:t})=>o?o.map(v=>({type:v.type,annotation:__spreadProps(__spreadValues({id:i.id,pointList:v.pointList},r),{stroke:t})})):[],J=!e||!(e==null?void 0:e.mappingImgList)||!(((I=e==null?void 0:e.mappingImgList)==null?void 0:I.length)>0),Q=React__default.default.createElement("div",{style:{display:"flex",alignItems:"center",fontSize:"14px"}},React__default.default.createElement("img",{src:icon_left_squareOutlined,style:{height:"24px",marginRight:"8px",cursor:"pointer"},onClick:()=>j()}),React__default.default.createElement("span",{style:{marginRight:"12px"}},"\u952E\u76D8\u5DE6\u952E\u4E0A\u4E00\u5F20"),React__default.default.createElement("span",{style:{margin:"0px 8px 0px 12px"}},"\u952E\u76D8\u53F3\u952E\u4E0A\u4E00\u5F20"),React__default.default.createElement("img",{src:icon_right_squareOutlined,style:{height:"24px",marginRight:"12px",cursor:"pointer"},onClick:()=>N()}),React__default.default.createElement("img",{src:icon_esc,style:{height:"24px",margin:"0px 8px 0px 12px",cursor:"pointer"},onClick:()=>{L(!1),E(void 0)}}),React__default.default.createElement("span",null,"\u952E\u9000\u51FA"));return(d==null?void 0:d.length)>0?React__default.default.createElement(React__default.default.Fragment,null,d.map((o,i)=>{const r=y&&i===s;return React__default.default.createElement(PointCloudLayout.PointCloudContainer,{className:classNames__default.default({[dom.getClassName("point-cloud-2d-container")]:!0,[dom.getClassName("point-cloud-container","zoom")]:r}),title:React__default.default.createElement(ContainerTitle,{showEnlarge:r,isEnlargeTopView:m,data:o,setIsEnlarge:L,setCurIndex:E,curIndex:s,index:i,annotations2d:d}),titleOnSurface:!r,style:{display:J?"none":"flex",width:r?"100%":n},key:i,toolbar:Q},(o==null?void 0:o.annotations)&&(o==null?void 0:o.url)&&React__default.default.createElement(PointCloud2DSingleView,{key:o.url,currentData:e,view2dData:o,setSelectedID:B,showEnlarge:r,checkMode:w,measureVisible:b}))})):null};var PointCloud2DView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloud2DView);module.exports=PointCloud2DView$1;
|
|
@@ -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(o){return o&&typeof o=="object"&&"default"in o?o:{default:o}}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=(o,
|
|
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(o){return o&&typeof o=="object"&&"default"in o?o:{default:o}}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=(o,e,l)=>e in o?__defProp(o,e,{enumerable:!0,configurable:!0,writable:!0,value:l}):o[e]=l,__spreadValues=(o,e)=>{for(var l in e||(e={}))__hasOwnProp.call(e,l)&&__defNormalProp(o,l,e[l]);if(__getOwnPropSymbols)for(var l of __getOwnPropSymbols(e))__propIsEnum.call(e,l)&&__defNormalProp(o,l,e[l]);return o},__spreadProps=(o,e)=>__defProps(o,__getOwnPropDescs(e)),__async=(o,e,l)=>new Promise((w,x)=>{var A=f=>{try{S(l.next(f))}catch(b){x(b)}},H=f=>{try{S(l.throw(f))}catch(b){x(b)}},S=f=>f.done?w(f.value):Promise.resolve(f.value).then(A,H);S((l=l.apply(o,e)).next())});const pickRectObject=o=>___default.default.pick(o,["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:o=>{},imageSizes:{},cacheImageNodeSize:()=>{},unlinkImageItems:[],addRectFromPointCloudBoxByImageName:o=>!1,removeRectBySpecifyId:(o,e,l)=>!1,removeRectByPointCloudBoxId:o=>!1}),PointCloudProvider=({children:o})=>{const[e,l]=React.useState([]),[w,x]=React.useState([]),[A,H]=React.useState([]),[S,f]=React.useState([]),[b,ut]=React.useState([]),[m,E]=React.useState([]),[R,j]=React.useState([]),[Z,ct]=React.useState(!0),[U,ft]=React.useState(!0),[J,pt]=React.useState(1),[p,K]=React.useState(),[Q,W]=React.useState(),[X,Y]=React.useState(),[u,$]=React.useState(),[tt,gt]=React.useState(""),[k,ht]=React.useState(lbAnnotation.EToolName.Rect),vt=React.useRef(new lbAnnotation.ActionsHistory).current,[g,F]=React.useState([]),[et,mt]=React.useState(""),[q,Pt]=React.useState(lbUtils.EPointCloudPattern.Detection),[L,nt]=React.useState(void 0),[z,It]=React.useState([]),[M,St]=React.useState([]),h=index(),[it,bt]=React.useState({}),Ct=ctx.useDispatch(),yt=s=>{const{imgNode:r,path:i}=s;i&&r&&bt(c=>__spreadProps(__spreadValues({},c),{[i]:{width:r.width,height:r.height}}))},ot=React.useMemo(()=>m.length===1?m[0]:"",[m]),V=React.useCallback((s,r,i="extId")=>{const c=i||"id",d=new Set(r);return f(v=>{let C=!1;const y=v.filter(O=>{const G=O[c],N=d.has(G)?O.imageName!==s:!0;return N||(C=!0),N});return C?y:v}),!0},[]),st=React.useCallback(s=>{const r=e.map(i=>i.id);return V(s,r,"extId")},[e,V]),rt=React.useCallback(s=>{if(!s)return!1;const r=e.filter(i=>Array.isArray(i.rects)).map(i=>{const{id:c,attribute:d,trackID:v}=i,C=i.rects.find(y=>y.imageName===s);if(C){const y=___default.default.pick(C,["width","height","x","y","imageName"]);return __spreadProps(__spreadValues({},y),{id:lbAnnotation.uuid(),attribute:d,order:v,extId:c,lineDash:[]})}return null}).filter(i=>i!==null);return r.length?(f(i=>{const c=new Set(i.filter(v=>s===v.imageName).map(v=>v.extId)),d=r.filter(v=>c.has(v.extId)===!1);return d.length?[...i,...d]:i}),!0):!1},[e]),B=React.useMemo(()=>{const s=e.find(t=>t.id===ot),r=t=>{const n=e.concat(t);return l(n),n},i=t=>{const n=w.concat(t);return x(n),n},c=t=>{ct(t!==!1)},d=t=>{t===void 0&&E([]),typeof t=="string"&&E([t]),Array.isArray(t)&&E(Array.from(new Set(t)))},v=t=>{m.includes(t)?d(m.filter(n=>n!==t)):d([...m,t])},C=t=>{const n=pickRectObject(t);f(a=>[...a,n])},y=(t,n=!1)=>{const a=pickRectObject(t);f(I=>I.map(P=>P.id===t.id?n?__spreadValues(__spreadValues({},P),a):a:P))},O=t=>{f(n=>n.filter(a=>!t.find(I=>I.id===a.id)))},G=t=>{R.includes(t)?j([]):j([t])},N=()=>{if(k===lbAnnotation.EToolName.Rect){const t=e.map(n=>n.id);d(t),p==null||p.pointCloud2dOperation.setSelectedIDs(t)}},Lt=t=>{d(e.filter(n=>n.attribute===t).map(n=>n.id))},T=e.filter(t=>!g.includes(t.attribute)),lt=w.filter(t=>!g.includes(t.attribute)),at=b.filter(t=>t.attribute&&!g.includes(t.attribute)),Dt=t=>{if(g.includes(t))F(g.filter(n=>n!==t));else{const n=g.concat(t);F(n)}},xt=(()=>{const t=T.map(a=>a.id),n=new Set(t);return S.filter(a=>a.extId&&n.has(a.extId)).map(a=>a.imageName)})(),_t=(t=T,n=A,a=lt,I=at,P=z)=>{var D;u==null||u.clearAllBox(),u==null||u.clearAllSphere(),p==null||p.updatePolygonList(t,n),p==null||p.updatePointList(a),p==null||p.updateLineList(I),u==null||u.generateBoxes(t),u==null||u.generateSpheres(a),(D=L==null?void 0:L.store)==null||D.updateCurrentSegment(P),dt(t)},At=()=>{K(void 0),W(void 0),Y(void 0),$(void 0)},dt=(t,n)=>__async(void 0,null,function*(){var a;if(!u)return;const I=u.pointCloudObject;if(!!I)try{const P=yield u.getHighlightIndexByMappingImgList({mappingImgList:n!=null?n:M,points:I.geometry.attributes.position.array}),D=yield u==null?void 0:u.highlightOriginPointCloud(t,P);return D&&((a=p==null?void 0:p.pointCloudInstance)==null||a.updateColor(D)),D}catch(P){console.error(P)}});return{selectedID:ot,pointCloudBoxList:e,pointCloudSphereList:w,displayPointCloudList:T,displaySphereList:lt,displayLineList:at,selectedIDs:m,setPointCloudResult:l,setSelectedIDs:d,addPointCloudBox:r,addPointCloudSphere:i,setPointCloudSphereList:x,valid:Z,selectedPointCloudBox:s,setPointCloudValid:c,addSelectedID:v,addHighlightID:G,selectedAllBoxes:N,topViewInstance:p,setTopViewInstance:K,sideViewInstance:Q,setSideViewInstance:W,backViewInstance:X,setBackViewInstance:Y,mainViewInstance:u,setMainViewInstance:$,polygonList:A,setPolygonList:H,rectList:S,setRectList:f,addRectIn2DView:C,removeRectIn2DView:O,updateRectIn2DView:y,lineList:b,setLineList:ut,zoom:J,setZoom:pt,history:vt,toggleAttributesVisible:Dt,hideAttributes:g,setHideAttributes:F,reRender:_t,attrPanelLayout:et,setAttrPanelLayout:mt,syncAllViewPointCloudColor:dt,defaultAttribute:tt,setDefaultAttribute:gt,pointCloudPattern:k,setPointCloudPattern:ht,selectSpecAttr:Lt,globalPattern:q,setGlobalPattern:t=>{q!==t&&(Ct(actionCreators.ChangeSave),Pt(t),t===lbUtils.EPointCloudPattern.Detection&&nt(void 0))},ptSegmentInstance:L,setPtSegmentInstance:nt,segmentation:z,setSegmentation:It,clearAllDetectionInstance:At,highlight2DDataList:M,setHighlight2DDataList:St,cuboidBoxIn2DView:U,setCuboidBoxIn2DView:ft,imageSizes:it,cacheImageNodeSize:yt,highlightIDs:R,setHighlightIDs:j,unlinkImageItems:xt,removeRectByPointCloudBoxId:st,removeRectBySpecifyId:V,addRectFromPointCloudBoxByImageName:rt}},[Z,m,e,w,A,b,S,p,Q,X,u,J,g,et,tt,k,q,L,z,M,U,it,R,st,V,rt]);React.useEffect(()=>{var s,r,i;(s=h==null?void 0:h.setPointCloudBoxList)==null||s.call(h,e),(r=h==null?void 0:h.setHighlightIDs)==null||r.call(h,R),(i=h==null?void 0:h.setSelectedIDs)==null||i.call(h,m)},[e,m,R]),React.useEffect(()=>{var s;(s=h==null?void 0:h.setPtCtx)==null||s.call(h,B)},[B]);const wt=()=>{const s=e.filter(d=>g.includes(d.attribute)),{setSelectedIDs:r,reRender:i}=B,c=s.map(d=>d.id);c.length>0&&r(m.filter(d=>!c.includes(d))),i()};return React.useEffect(()=>{var s,r,i,c;wt(),(r=(s=p==null?void 0:p.toolInstance)==null?void 0:s.setHiddenAttributes)==null||r.call(s,g),(c=(i=L==null?void 0:L.store)==null?void 0:i.setHiddenAttributes)==null||c.call(i,g)},[g]),React__default.default.createElement(PointCloudContext.Provider,{value:B},o)};exports.PointCloudContext=PointCloudContext,exports.PointCloudProvider=PointCloudProvider;
|
|
@@ -0,0 +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[n,l]=React.useState(!0),r=React.useRef(e.imageName);r.current=e.imageName;const{unlinkImageItems:c,addRectFromPointCloudBoxByImageName:d,removeRectByPointCloudBoxId:m}=React.useContext(PointCloudContext.PointCloudContext),g=ahooks.useLatest(d),f=ahooks.useLatest(m),i=React.useCallback(t=>{const a=r.current;if(!a){console.warn("invalid image name");return}l(t),t?f.current(a):g.current(a)},[]),u=React.useCallback(()=>{i(!n)},[i,n]),h=React.useMemo(()=>{var t;if(!e.is2DView)return null;const o={zIndex:(t=e.zIndex)!=null?t: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,cursor:"pointer"};return React__default.default.createElement("div",{style:o,onClick:u},n&&React__default.default.createElement("img",{src:icon_link,style:iconSize}),!n&&React__default.default.createElement("img",{src:icon_unlink,style:iconSize}))},[n,e.is2DView,e.zIndex,u]),s=React.useCallback(()=>{if(!e.is2DView)return;const t=r.current;if(!t){console.warn("invalid image name");return}const o=new Set(c).has(t)===!1;i(o)},[e.is2DView,c,i]);return React.useEffect(()=>{s()},[s]),{rendered:h,isLinking:n,swapSwitch:i,syncIsLinking:s}};module.exports=useDataLinkSwitch;
|
|
@@ -10,6 +10,7 @@ interface IPointCloud2DRectOperationViewProps {
|
|
|
10
10
|
config: any;
|
|
11
11
|
checkMode?: boolean;
|
|
12
12
|
afterImgOnLoad: TAfterImgOnLoad;
|
|
13
|
+
shouldExcludePointCloudBoxListUpdate?: boolean;
|
|
13
14
|
}
|
|
14
15
|
declare const _default: import("react-redux").ConnectedComponent<(props: IPointCloud2DRectOperationViewProps) => React.JSX.Element, import("react-redux").Omit<IPointCloud2DRectOperationViewProps, "config">>;
|
|
15
16
|
export default _default;
|
|
@@ -19,6 +19,7 @@ interface IPointCloudSegment {
|
|
|
19
19
|
ptSegmentInstance?: PointCloud;
|
|
20
20
|
setPtSegmentInstance: (instance?: PointCloud) => void;
|
|
21
21
|
}
|
|
22
|
+
type UnlinkImageItem = string;
|
|
22
23
|
type AttrPanelLayout = '' | 'left' | 'right';
|
|
23
24
|
interface IHighlight2DData {
|
|
24
25
|
url: string;
|
|
@@ -51,7 +52,7 @@ export interface IPointCloudContext extends IPointCloudContextInstances, IPointC
|
|
|
51
52
|
setRectList: (rectList: IPointCloudBoxRect[]) => void;
|
|
52
53
|
addRectIn2DView: (rect: IPointCloud2DRectOperationViewRect) => void;
|
|
53
54
|
removeRectIn2DView: (rects: IPointCloud2DRectOperationViewRect[]) => void;
|
|
54
|
-
updateRectIn2DView: (rect: IPointCloud2DRectOperationViewRect) => void;
|
|
55
|
+
updateRectIn2DView: (rect: IPointCloud2DRectOperationViewRect, mergeSelf?: boolean) => void;
|
|
55
56
|
lineList: ILine[];
|
|
56
57
|
setLineList: (lineList: ILine[]) => void;
|
|
57
58
|
zoom: number;
|
|
@@ -83,6 +84,11 @@ export interface IPointCloudContext extends IPointCloudContextInstances, IPointC
|
|
|
83
84
|
imgNode: HTMLImageElement;
|
|
84
85
|
path: string;
|
|
85
86
|
}) => void;
|
|
87
|
+
/** 未关联(联动)项列表 */
|
|
88
|
+
unlinkImageItems: UnlinkImageItem[];
|
|
89
|
+
addRectFromPointCloudBoxByImageName: (imageName: string) => boolean;
|
|
90
|
+
removeRectBySpecifyId: (imageName: string, ids: string[], idField?: keyof IPointCloudBoxRect) => boolean;
|
|
91
|
+
removeRectByPointCloudBoxId: (imageName: string) => boolean;
|
|
86
92
|
}
|
|
87
93
|
export declare const PointCloudContext: React.Context<IPointCloudContext>;
|
|
88
94
|
export declare const PointCloudProvider: React.FC<{}>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface UseDataLinkSwitchOptions {
|
|
3
|
+
/** DOM显示层级 */
|
|
4
|
+
zIndex: number;
|
|
5
|
+
/** 是否2d框 */
|
|
6
|
+
is2DView: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* 用来判断图片项,
|
|
9
|
+
* 具体参考:packages/lb-components/src/components/pointCloud2DRectOperationView/index.tsx, getRectListByBoxList函数
|
|
10
|
+
*
|
|
11
|
+
* 基于上参考,此值需确保唯一性!
|
|
12
|
+
*/
|
|
13
|
+
imageName: string;
|
|
14
|
+
}
|
|
15
|
+
declare const useDataLinkSwitch: (opts: UseDataLinkSwitchOptions) => {
|
|
16
|
+
rendered: React.JSX.Element | null;
|
|
17
|
+
isLinking: boolean;
|
|
18
|
+
swapSwitch: (isLinking: boolean) => void;
|
|
19
|
+
syncIsLinking: () => void;
|
|
20
|
+
};
|
|
21
|
+
export default useDataLinkSwitch;
|
|
@@ -51,7 +51,10 @@ export default class AnnotationDataUtils {
|
|
|
51
51
|
* @param {ICopyResultItemHandlerParams.mappingImgList} mappingImgList - The list of images for mapping.
|
|
52
52
|
* @param {ICopyResultItemHandlerParams.preMappingImgList} preMappingImgList - The list of images before mapping.
|
|
53
53
|
*/
|
|
54
|
-
static copyResultItemHandler(params: ICopyResultItemHandlerParams):
|
|
54
|
+
static copyResultItemHandler(params: ICopyResultItemHandlerParams): {
|
|
55
|
+
value: any;
|
|
56
|
+
oldValue: any;
|
|
57
|
+
};
|
|
55
58
|
/**
|
|
56
59
|
* 复制上一张图片结果
|
|
57
60
|
* @param copyResult 复制的结果
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var lbAnnotation=require("@labelbee/lb-annotation"),index=require("./index.js"),ToolType=require("../data/enums/ToolType.js"),_=require("lodash"),StepUtils=require("./StepUtils.js"),antd=require("antd"),lbUtils=require("@labelbee/lb-utils");function _interopDefaultLegacy(
|
|
1
|
+
"use strict";var lbAnnotation=require("@labelbee/lb-annotation"),index=require("./index.js"),ToolType=require("../data/enums/ToolType.js"),_=require("lodash"),StepUtils=require("./StepUtils.js"),antd=require("antd"),lbUtils=require("@labelbee/lb-utils");function _interopDefaultLegacy(m){return m&&typeof m=="object"&&"default"in m?m:{default:m}}var ___default=_interopDefaultLegacy(_);class AnnotationDataUtils{static traverseDF(t,s,e,i){s(t,e,i),typeof t=="object"&&t!==null&&(Array.isArray(t)?t.forEach((n,r)=>{this.traverseDF(n,s,r,t)}):Object.keys(t).forEach(n=>{this.traverseDF(t[n],s,n,t)}))}static getNextPath(t){var s,e,i;const{prePath:n,preMappingImgList:r,nextMappingImgList:a}=t,o=(e=(s=r==null?void 0:r.find(c=>c.path===n))==null?void 0:s.calib)==null?void 0:e.calName,u=(i=a.find(c=>{var f;return((f=c.calib)==null?void 0:f.calName)===o}))==null?void 0:i.path;if(!u)throw Error("nextPath error");return u}static copyResultItemHandler(t){const{item:s,key:e,parent:i,mappingImgList:n,preMappingImgList:r}=t,a=e===void 0?void 0:i[e];return e==="id"&&(i.id=lbAnnotation.uuid(8,62)),e==="imageName"&&(i.imageName=this.getNextPath({prePath:s,preMappingImgList:r,nextMappingImgList:n})),{value:e===void 0?void 0:i[e],oldValue:a}}static copyResultChange(t){const{copyResult:s,step:e,currentResult:i,mappingImgList:n,preMappingImgList:r}=t;try{const a=index.jsonParser(s),o=index.jsonParser(i),u=`step_${e}`;if(a[u]){const c=a[u],f=["result","resultRect"],p=new Map,g=(l,d)=>{if(l===void 0||d===void 0){console.warn("invalid id");return}p.set(d,l)};if(f.forEach(l=>{c[l]&&this.traverseDF(c[l],(d,v,h)=>{const{value:I,oldValue:y}=this.copyResultItemHandler({item:d,key:v,parent:h,mappingImgList:n,preMappingImgList:r});l==="result"&&v==="id"&&I!==void 0&&y!==void 0&&p.set(y,I)})}),p.size){const l=c.resultRect;Array.isArray(l)&&l.forEach(d=>{const v=d.extId,h=p.get(v);v!==void 0&&h!==void 0&&(d.extId=h)})}return o[u]=c,JSON.stringify(o)}return s}catch(a){antd.message.info(lbUtils.i18n.t("FailedToCopyResults"))}}static isResultSourceMatchedDependence(t,s){const e=t==null?void 0:t.map(n=>n.sourceID).sort(),i=s==null?void 0:s.map(n=>n.id).sort();return ___default.default.isEqual(e,i)}static deltaUpdateBasicResultList(t,s){const e=t==null?void 0:t.map(i=>i.sourceID).sort();return s.filter(i=>!e.includes(i.id))}static getInitialResultList(t,s,e,i,n){const r=t!=null?t:[];switch(e.tool){case ToolType.EToolName.Tag:case ToolType.EToolName.Text:{if(e.dataSourceStep>0){const a=this.deltaUpdateBasicResultList(r,i);if(a.length>0)return r.concat(s.getInitResultList(e.dataSourceStep,a))}return n!==!0?r:s.getInitResultList(e.dataSourceStep,i)}default:return r}}static dataCorrection(t,s,e,i){var n,r;try{const o=`step_${StepUtils.getStepInfo(e,i).step}`,u=index.jsonParser(t),c=index.jsonParser(s),f=(n=u[o])==null?void 0:n.result,p=(r=c[o])==null?void 0:r.result;if(!p||___default.default.isEqual(f.sort(this.idCmp),p.sort(this.idCmp)))return t;const g=this.findDeletedIds(f,p);if(g.length===0)return t;const l=e,d=this.getStepKeys(u).sort();return this.deleteRes(u,l,g,d),JSON.stringify(u)}catch(a){return console.error(a),t}}static idCmp(t,s){const e=t.id,i=s.id;return e<i?-1:e>i?1:0}static findDeletedIds(t,s){return this.findDeletedItems(s,t).map(e=>e.id)}static findDeletedItems(t,s){const e=[];return t.forEach(i=>{s.some(r=>r.id===i.id)||e.push(i)}),e}static getStepKeys(t){return Object.keys(t).map(s=>parseInt(s.replace("step_",""),10)).filter(s=>!isNaN(s))}static deleteRes(t,s,e,i){i.forEach(n=>{if(n>s){const r=t[`step_${n}`];if([ToolType.EToolName.FolderTag,ToolType.EToolName.Segmentation].includes(r.tool))return;if(r.dataSourceStep===s){const a=[];r.result=r.result.filter(o=>e.includes(o.sourceID)?(a.push(o.id),!1):!0),this.deleteRes(t,n,a,i)}else r.result=r.result.filter(a=>!e.includes(a.sourceID))}})}}module.exports=AnnotationDataUtils;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"react";var a="data:image/svg+xml,%3csvg class='icon' style='width: 1em%3bheight: 1em%3bvertical-align: middle%3bfill: currentColor%3boverflow: hidden%3b' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M633.417143 429.007238a174.567619 174.567619 0 0 1 0 246.857143l-155.306667 155.306667a186.709333 186.709333 0 1 1-264.045714-264.045715l76.483048-76.507428 51.73638 51.736381-76.507428 76.507428a113.566476 113.566476 0 1 0 160.597333 160.597334l155.306667-155.306667a101.424762 101.424762 0 0 0 0-143.408762z m208.603428-225.816381a186.709333 186.709333 0 0 1 0 264.045714L765.561905 543.744l-51.736381-51.712 76.507428-76.507429a113.566476 113.566476 0 1 0-160.597333-160.597333l-155.306667 155.306667a101.424762 101.424762 0 0 0 0 143.408762l-51.736381 51.736381a174.567619 174.567619 0 0 1 0-246.857143l155.306667-155.306667a186.709333 186.709333 0 0 1 264.045714 0z' fill='white'%3e%3c/path%3e%3c/svg%3e";export{a as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"react";var l="data:image/svg+xml,%3csvg class='icon' style='width: 1em%3bheight: 1em%3bvertical-align: middle%3bfill: currentColor%3boverflow: hidden%3b' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M384 128v128h64V128H384zM523.328 613.824l-147.072 147.072a80 80 0 0 1-113.152-113.152l147.072-147.072-45.248-45.248-147.072 147.072a144 144 0 0 0 203.648 203.648l147.072-147.072-45.248-45.248zM613.76 523.328l45.312 45.248 147.072-147.072a144 144 0 1 0-203.648-203.648L455.424 364.928l45.248 45.248 147.072-147.072a80 80 0 0 1 113.152 113.152L613.824 523.328zM768 576h128v64h-128V576zM128 448h128V384H128v64zM640 768v128H576v-128h64zM750.848 705.6l103.808 103.744-45.312 45.248-103.68-103.68 45.184-45.312zM169.344 214.592l103.808 103.808 45.248-45.248-103.744-103.808-45.312 45.248z' fill='white'%3e%3c/path%3e%3c/svg%3e";export{l as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useMemoizedFn as
|
|
1
|
+
import{useMemoizedFn as _,useLatest as Q}from"ahooks";import{Spin as W}from"antd/es";import h,{useContext as X,useRef as N,useState as Y,useMemo as Z,useEffect as a}from"react";import{connect as tt}from"react-redux";import{usePointCloudViews as et}from"../pointCloudView/hooks/usePointCloudViews.js";import{PointCloudContext as rt}from"../pointCloudView/PointCloudContext.js";import{a2MapStateToProps as nt}from"../../store/annotation/map.js";import{LabelBeeContext as ot}from"../../store/ctx.js";import{PointCloud2DRectOperation as it,ImgUtils as ut}from"@labelbee/lb-annotation";var ct=Object.defineProperty,lt=Object.defineProperties,at=Object.getOwnPropertyDescriptors,M=Object.getOwnPropertySymbols,st=Object.prototype.hasOwnProperty,dt=Object.prototype.propertyIsEnumerable,z=(c,i,n)=>i in c?ct(c,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):c[i]=n,s=(c,i)=>{for(var n in i||(i={}))st.call(i,n)&&z(c,n,i[n]);if(M)for(var n of M(i))dt.call(i,n)&&z(c,n,i[n]);return c},p=(c,i)=>lt(c,at(i));const pt=c=>{var i;const{mappingData:n,size:f,config:R,checkMode:F,afterImgOnLoad:U,shouldExcludePointCloudBoxListUpdate:m}=c,g=(i=n==null?void 0:n.url)!=null?i:"",{pointCloudBoxList:D,setPointCloudResult:x,defaultAttribute:b,rectList:w,addRectIn2DView:k,updateRectIn2DView:L,removeRectIn2DView:J}=X(rt),{update2DViewRect:T,remove2DViewRect:$}=et(),P=h.useRef(null),r=N(null),V=_(T),y=_($),C=N(null),[q,S]=Y(!0),I=Z(()=>w==null?void 0:w.filter(t=>t.imageName===(n==null?void 0:n.path)),[n==null?void 0:n.path,w]),v=Q(n==null?void 0:n.path),j=t=>{const{boxID:o}=t;if(!m&&o){const e=V==null?void 0:V(t);C.current=e,x(e);return}L(t,!0)},B=t=>{v.current&&k(p(s({},t),{imageName:v.current}))},E=t=>{if(!m){const o=t.find(e=>e.boxID);if(o){const e=y==null?void 0:y(o);C.current=e,x(e),d();return}}J(t)},G=_(()=>{let t=[];return D.forEach(o=>{const{rects:e=[],id:u,attribute:l,trackID:O}=o,A=e.find(K=>K.imageName===v.current),H=u+"_"+v.current;A&&(t=[...t,p(s({},A),{boxID:u,id:H,attribute:l,order:O})])}),t}),d=_(()=>{var t,o,e;const u=m?[]:G(),l=(t=r.current)==null?void 0:t.selectedRectID;(o=r.current)==null||o.setResult([...u,...I]),l&&((e=r.current)==null||e.setSelectedRectID(l))});return a(()=>{if(P.current){const t=new it({container:P.current,size:f,config:p(s({},R),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:F});return r.current=t,r.current.init(),r.current.on("updateDragResult",j),r.current.on("afterAddingDrawingRect",B),r.current.on("deleteSelectedRects",E),()=>{var o,e,u,l;(o=r.current)==null||o.unbind("updateDragResult",j),(e=r.current)==null||e.unbind("afterAddingDrawingRect",B),(u=r.current)==null||u.unbind("deleteSelectedRects",E),(l=r.current)==null||l.destroy()}}},[]),a(()=>{S(!0),r.current&&g&&ut.load(g).then(t=>{r.current.setImgNode(t),U(t),S(!1)})},[g]),a(()=>{var t;(t=r.current)==null||t.setSize(f)},[f]),a(()=>{D!==C.current&&d()},[D]),a(()=>{var t,o,e;const u=I.find(l=>l.id===r.current.selectedRectID);(o=(t=r.current)==null?void 0:t.setDefaultAttribute)==null||o.call(t,b),u&&L(p(s({},(e=r.current)==null?void 0:e.selectedRect),{attribute:b})),d()},[b]),a(()=>{d()},[I]),a(()=>{d()},[m]),a(()=>{var t,o,e,u;const l=(o=(t=r.current)==null?void 0:t.config)!=null?o:{},O=p(s({},l),{attributeList:(e=R.attributeList)!=null?e:[]});(u=r.current)==null||u.setConfig(JSON.stringify(O))},[R.attributeList]),h.createElement(W,{spinning:q},h.createElement("div",{ref:P,style:s({position:"relative"},f)}))};var ft=tt(nt,null,null,{context:ot})(pt);export{ft as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getClassName as H}from"../../utils/dom.js";import
|
|
1
|
+
import{getClassName as H}from"../../utils/dom.js";import s,{useRef as V,useState as N,useContext as w,useMemo as A,useCallback as F,useEffect as M}from"react";import T from"../AnnotationView/index.js";import U from"../../hooks/useSize.js";import{useSingleBox as q}from"./hooks/useSingleBox.js";import{useHighlight as D}from"./hooks/useHighlight.js";import G from"./components/HighlightVisible/index.js";import{PointCloudContext as J}from"./PointCloudContext.js";import K from"./hooks/useDataLinkSwitch.js";import Q from"../pointCloud2DRectOperationView/index.js";var W=(t,r,e)=>new Promise((l,c)=>{var m=o=>{try{i(e.next(o))}catch(n){c(n)}},u=o=>{try{i(e.throw(o))}catch(n){c(n)}},i=o=>o.done?l(o.value):Promise.resolve(o.value).then(m,u);i((e=e.apply(t,r)).next())});const X=({view2dData:t,setSelectedID:r,currentData:e,showEnlarge:l,checkMode:c=!1,measureVisible:m})=>{var u;const i=V(null),o=V(),{selectedBox:n}=q(),h=U(i),{url:g,calib:x,path:P}=t,{toggle2dVisible:j,isHighlightVisible:y}=D({currentData:e}),[v,k]=N(!1),{cuboidBoxIn2DView:f,cacheImageNodeSize:z}=w(J),B=!t,I=A(()=>({zIndex:l?-1:101,is2DView:!f,imageName:t.path}),[l,f,t.path]),{rendered:_,isLinking:O}=K(I),C=d=>{p(),z({path:P,imgNode:d})},p=F(()=>{var d,b;const L=(d=o.current)==null?void 0:d.toolInstance;if(r(""),!n||!L)return;const a=t.annotations.find(E=>E.annotation.id===n.info.id);let S="";a&&((b=a==null?void 0:a.annotation.pointList)==null?void 0:b.length)>0&&(L.focusPositionByPointList(a==null?void 0:a.annotation.pointList),S=n.info.id,r(S))},[n,o.current,t.annotations]);M(()=>{p()},[p]);const R=()=>W(void 0,null,function*(){k(!0),yield j(g,x),k(!1)});return s.createElement("div",{className:H("point-cloud-2d-image"),ref:i},f?s.createElement(T,{src:(u=t==null?void 0:t.url)!=null?u:"",annotations:t.annotations,size:h,ref:o,globalStyle:{display:B?"none":"block"},afterImgOnLoad:C,zoomInfo:{min:.01,max:1e3,ratio:.4},measureVisible:m}):s.createElement(s.Fragment,null,s.createElement(Q,{shouldExcludePointCloudBoxListUpdate:!O,mappingData:t,size:h,checkMode:c,afterImgOnLoad:C}),_),x&&s.createElement(G,{visible:y(g),onClick:R,loading:v,style:{position:"absolute",right:16,top:16,zIndex:l?-1:101}}))};export{X as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getClassName as Q}from"../../utils/dom.js";import i,{useState as L,useContext as ue,useEffect as U}from"react";import{PointCloudContainer as ae}from"./PointCloudLayout.js";import{PointCloudContext as ce}from"./PointCloudContext.js";import{connect as de}from"react-redux";import{cKeyCode as me,pointCloudLidar2image as fe,pointListLidar2Img as pe}from"@labelbee/lb-annotation";import{LabelBeeContext as ge}from"../../store/ctx.js";import{a2MapStateToProps as ve}from"../../store/annotation/map.js";import{toolStyleConverter as W}from"@labelbee/lb-utils";import be from"./PointCloud2DSingleView.js";import X from"./components/TitleButton/index.js";import{LeftOutlined as ye}from"@ant-design/icons";import Ee from"classnames";import he from"../../assets/annotation/common/icon_esc.svg.js";import _e from"../../assets/annotation/common/icon_left_squareOutlined.svg.js";import we from"../../assets/annotation/common/icon_right_squareOutlined.svg.js";import{isNumber as Ce}from"lodash";import{getBoundingRect as Pe,isBoundingRectInImage as Le}from"../../utils/index.js";var xe=Object.defineProperty,Ie=Object.defineProperties,Fe=Object.getOwnPropertyDescriptors,Y=Object.getOwnPropertySymbols,ke=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,Z=(e,n,o)=>n in e?xe(e,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[n]=o,m=(e,n)=>{for(var o in n||(n={}))ke.call(n,o)&&Z(e,o,n[o]);if(Y)for(var o of Y(n))Oe.call(n,o)&&Z(e,o,n[o]);return e},f=(e,n)=>Ie(e,Fe(n));const j=me.default,je=({showEnlarge:e,isEnlargeTopView:n,data:o,setIsEnlarge:y,setCurIndex:g,curIndex:E=0,index:x,annotations2d:h})=>n?i.createElement(X,{title:o==null?void 0:o.calName,style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}):e?i.createElement("div",{style:{display:"flex",alignItems:"center"}},i.createElement(ye,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{y(!1),g(void 0)}}),i.createElement("span",null,o==null?void 0:o.calName),i.createElement("span",{style:{marginLeft:"8px"}},E+1,"/",h==null?void 0:h.length)):i.createElement(X,{title:o==null?void 0:o.calName,onClick:()=>{y(!0),g(x)},style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}),Ne=({currentData:e,config:n,thumbnailWidth:o,isEnlargeTopView:y,highlightAttribute:g,loadPCDFileLoading:E,checkMode:x,measureVisible:h})=>{var N;const[p,D]=L([]),{topViewInstance:ee,displayPointCloudList:R,polygonList:S,imageSizes:I,selectedIDs:V}=ue(ce),[F,te]=L(""),[_,k]=L(!1),[u,w]=L(void 0);U(()=>{var l;if(!E&&ee&&(e==null?void 0:e.mappingImgList)&&((l=e==null?void 0:e.mappingImgList)==null?void 0:l.length)>0){const r={fill:"transparent",color:"green"};let s=[];e==null||e.mappingImgList.forEach(t=>{var v,K,$;const q=R.reduce((c,d)=>{var b,a;const C=d.id===F||g===d.attribute,{transferViewData:O,viewRangePointList:P}=(b=fe(d,t.calib,{createRange:C}))!=null?b:{};if(!O||!P)return[];const le=O.reduce((G,J)=>J.type==="line"?[...G,...J.pointList]:G,[]),re=f(m({},Pe(le)),{imageName:t.path});if(!Le(re,t.path,I))return c;const B=(a=W.getColorFromConfig({attribute:d.attribute},f(m({},n),{attributeConfigurable:!0}),{}))==null?void 0:a.stroke,se=oe({viewDataPointList:O,pointCloudBox:d,defaultViewStyle:r,stroke:B}),M=[...c,...se];return(P==null?void 0:P.length)>0&&M.unshift({type:"polygon",annotation:f(m({id:F,pointList:P},r),{stroke:B,fill:"rgba(255, 255, 255, 0.6)"})}),M},[]),H=I[(v=t==null?void 0:t.path)!=null?v:""];H&&Ce((K=t==null?void 0:t.calib)==null?void 0:K.groundHeight)&&S.forEach(c=>{const d=c.pointList.map(a=>{var C;return f(m({},a),{z:(C=t==null?void 0:t.calib)==null?void 0:C.groundHeight})}),b=pe(d,t==null?void 0:t.calib,H);if(b){const a=W.getColorFromConfig({attribute:c.attribute},f(m({},n),{attributeConfigurable:!0}),{});q.push({type:"polygon",annotation:f(m({id:c.id,pointList:b},r),{stroke:a==null?void 0:a.stroke,fill:V.includes(c.id)?a==null?void 0:a.fill:"rgba(255, 255, 255, 0.6)"})})}}),s.push({annotations:q,url:t==null?void 0:t.url,calName:($=t==null?void 0:t.calib)==null?void 0:$.calName,calib:t==null?void 0:t.calib,path:t==null?void 0:t.path})}),D(s)}},[R,e==null?void 0:e.mappingImgList,F,g,E,S,I,V]),U(()=>(window.addEventListener("keydown",A),()=>{window.removeEventListener("keydown",A)}),[u]);const A=l=>{const{keyCode:r}=l;switch(r){case j.Esc:_&&k(!1);break;case j.Left:z();break;case j.Right:T();break}},z=()=>{u===void 0||!_||Number(u)>0&&w(u-1)},T=()=>{u===void 0||!_||Number(u)<(p==null?void 0:p.length)-1&&w(u+1)},oe=({viewDataPointList:l,pointCloudBox:r,defaultViewStyle:s,stroke:t})=>l?l.map(v=>({type:v.type,annotation:f(m({id:r.id,pointList:v.pointList},s),{stroke:t})})):[],ne=!e||!(e==null?void 0:e.mappingImgList)||!(((N=e==null?void 0:e.mappingImgList)==null?void 0:N.length)>0),ie=i.createElement("div",{style:{display:"flex",alignItems:"center",fontSize:"14px"}},i.createElement("img",{src:_e,style:{height:"24px",marginRight:"8px",cursor:"pointer"},onClick:()=>z()}),i.createElement("span",{style:{marginRight:"12px"}},"\u952E\u76D8\u5DE6\u952E\u4E0A\u4E00\u5F20"),i.createElement("span",{style:{margin:"0px 8px 0px 12px"}},"\u952E\u76D8\u53F3\u952E\u4E0A\u4E00\u5F20"),i.createElement("img",{src:we,style:{height:"24px",marginRight:"12px",cursor:"pointer"},onClick:()=>T()}),i.createElement("img",{src:he,style:{height:"24px",margin:"0px 8px 0px 12px",cursor:"pointer"},onClick:()=>{k(!1),w(void 0)}}),i.createElement("span",null,"\u952E\u9000\u51FA"));return(p==null?void 0:p.length)>0?i.createElement(i.Fragment,null,p.map((l,r)=>{const s=_&&r===u;return i.createElement(ae,{className:Ee({[Q("point-cloud-2d-container")]:!0,[Q("point-cloud-container","zoom")]:s}),title:i.createElement(je,{showEnlarge:s,isEnlargeTopView:y,data:l,setIsEnlarge:k,setCurIndex:w,curIndex:u,index:r,annotations2d:p}),titleOnSurface:!s,style:{display:ne?"none":"flex",width:s?"100%":o},key:r,toolbar:ie},(l==null?void 0:l.annotations)&&(l==null?void 0:l.url)&&i.createElement(be,{currentData:e,view2dData:l,setSelectedID:te,showEnlarge:s,checkMode:x,measureVisible:h}))})):null};var Re=de(ve,null,null,{context:ge})(Ne);export{Re as default};
|
|
1
|
+
import{getClassName as Q}from"../../utils/dom.js";import i,{useState as L,useContext as ue,useEffect as U}from"react";import{PointCloudContainer as ae}from"./PointCloudLayout.js";import{PointCloudContext as ce}from"./PointCloudContext.js";import{connect as de}from"react-redux";import{cKeyCode as me,pointCloudLidar2image as fe,pointListLidar2Img as pe}from"@labelbee/lb-annotation";import{LabelBeeContext as ge}from"../../store/ctx.js";import{a2MapStateToProps as ve}from"../../store/annotation/map.js";import{toolStyleConverter as W}from"@labelbee/lb-utils";import be from"./PointCloud2DSingleView.js";import X from"./components/TitleButton/index.js";import{LeftOutlined as ye}from"@ant-design/icons";import Ee from"classnames";import he from"../../assets/annotation/common/icon_esc.svg.js";import _e from"../../assets/annotation/common/icon_left_squareOutlined.svg.js";import we from"../../assets/annotation/common/icon_right_squareOutlined.svg.js";import{isNumber as Ce}from"lodash";import{getBoundingRect as Pe,isBoundingRectInImage as Le}from"../../utils/index.js";var xe=Object.defineProperty,Ie=Object.defineProperties,Fe=Object.getOwnPropertyDescriptors,Y=Object.getOwnPropertySymbols,ke=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,Z=(e,n,o)=>n in e?xe(e,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[n]=o,m=(e,n)=>{for(var o in n||(n={}))ke.call(n,o)&&Z(e,o,n[o]);if(Y)for(var o of Y(n))Oe.call(n,o)&&Z(e,o,n[o]);return e},f=(e,n)=>Ie(e,Fe(n));const j=me.default,je=({showEnlarge:e,isEnlargeTopView:n,data:o,setIsEnlarge:y,setCurIndex:g,curIndex:E=0,index:x,annotations2d:h})=>n?i.createElement(X,{title:o==null?void 0:o.calName,style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}):e?i.createElement("div",{style:{display:"flex",alignItems:"center"}},i.createElement(ye,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{y(!1),g(void 0)}}),i.createElement("span",null,o==null?void 0:o.calName),i.createElement("span",{style:{marginLeft:"8px"}},E+1,"/",h==null?void 0:h.length)):i.createElement(X,{title:o==null?void 0:o.calName,onClick:()=>{y(!0),g(x)},style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}),Ne=({currentData:e,config:n,thumbnailWidth:o,isEnlargeTopView:y,highlightAttribute:g,loadPCDFileLoading:E,checkMode:x,measureVisible:h})=>{var N;const[p,D]=L([]),{topViewInstance:ee,displayPointCloudList:R,polygonList:S,imageSizes:I,selectedIDs:V}=ue(ce),[F,te]=L(""),[_,k]=L(!1),[u,w]=L(void 0);U(()=>{var l;if(!E&&ee&&(e==null?void 0:e.mappingImgList)&&((l=e==null?void 0:e.mappingImgList)==null?void 0:l.length)>0){const r={fill:"transparent",color:"green"};let s=[];e==null||e.mappingImgList.forEach(t=>{var v,K,$;const q=R.reduce((c,d)=>{var b,a;const C=d.id===F||g===d.attribute,{transferViewData:O,viewRangePointList:P}=(b=fe(d,t.calib,{createRange:C}))!=null?b:{};if(!O||!P)return[];const le=O.reduce((G,J)=>J.type==="line"?[...G,...J.pointList]:G,[]),re=f(m({},Pe(le)),{imageName:t.path});if(!Le(re,t.path,I))return c;const B=(a=W.getColorFromConfig({attribute:d.attribute},f(m({},n),{attributeConfigurable:!0}),{}))==null?void 0:a.stroke,se=oe({viewDataPointList:O,pointCloudBox:d,defaultViewStyle:r,stroke:B}),M=[...c,...se];return(P==null?void 0:P.length)>0&&M.unshift({type:"polygon",annotation:f(m({id:F,pointList:P},r),{stroke:B,fill:"rgba(255, 255, 255, 0.6)"})}),M},[]),H=I[(v=t==null?void 0:t.path)!=null?v:""];H&&Ce((K=t==null?void 0:t.calib)==null?void 0:K.groundHeight)&&S.forEach(c=>{const d=c.pointList.map(a=>{var C;return f(m({},a),{z:(C=t==null?void 0:t.calib)==null?void 0:C.groundHeight})}),b=pe(d,t==null?void 0:t.calib,H);if(b){const a=W.getColorFromConfig({attribute:c.attribute},f(m({},n),{attributeConfigurable:!0}),{});q.push({type:"polygon",annotation:f(m({id:c.id,pointList:b},r),{stroke:a==null?void 0:a.stroke,fill:V.includes(c.id)?a==null?void 0:a.fill:"rgba(255, 255, 255, 0.6)"})})}}),s.push({annotations:q,url:t==null?void 0:t.url,calName:($=t==null?void 0:t.calib)==null?void 0:$.calName,calib:t==null?void 0:t.calib,path:t==null?void 0:t.path})}),D(s)}},[R,e==null?void 0:e.mappingImgList,F,g,E,S,I,V]),U(()=>(window.addEventListener("keydown",A),()=>{window.removeEventListener("keydown",A)}),[u]);const A=l=>{const{keyCode:r}=l;switch(r){case j.Esc:_&&k(!1);break;case j.Left:z();break;case j.Right:T();break}},z=()=>{u===void 0||!_||Number(u)>0&&w(u-1)},T=()=>{u===void 0||!_||Number(u)<(p==null?void 0:p.length)-1&&w(u+1)},oe=({viewDataPointList:l,pointCloudBox:r,defaultViewStyle:s,stroke:t})=>l?l.map(v=>({type:v.type,annotation:f(m({id:r.id,pointList:v.pointList},s),{stroke:t})})):[],ne=!e||!(e==null?void 0:e.mappingImgList)||!(((N=e==null?void 0:e.mappingImgList)==null?void 0:N.length)>0),ie=i.createElement("div",{style:{display:"flex",alignItems:"center",fontSize:"14px"}},i.createElement("img",{src:_e,style:{height:"24px",marginRight:"8px",cursor:"pointer"},onClick:()=>z()}),i.createElement("span",{style:{marginRight:"12px"}},"\u952E\u76D8\u5DE6\u952E\u4E0A\u4E00\u5F20"),i.createElement("span",{style:{margin:"0px 8px 0px 12px"}},"\u952E\u76D8\u53F3\u952E\u4E0A\u4E00\u5F20"),i.createElement("img",{src:we,style:{height:"24px",marginRight:"12px",cursor:"pointer"},onClick:()=>T()}),i.createElement("img",{src:he,style:{height:"24px",margin:"0px 8px 0px 12px",cursor:"pointer"},onClick:()=>{k(!1),w(void 0)}}),i.createElement("span",null,"\u952E\u9000\u51FA"));return(p==null?void 0:p.length)>0?i.createElement(i.Fragment,null,p.map((l,r)=>{const s=_&&r===u;return i.createElement(ae,{className:Ee({[Q("point-cloud-2d-container")]:!0,[Q("point-cloud-container","zoom")]:s}),title:i.createElement(je,{showEnlarge:s,isEnlargeTopView:y,data:l,setIsEnlarge:k,setCurIndex:w,curIndex:u,index:r,annotations2d:p}),titleOnSurface:!s,style:{display:ne?"none":"flex",width:s?"100%":o},key:r,toolbar:ie},(l==null?void 0:l.annotations)&&(l==null?void 0:l.url)&&i.createElement(be,{key:l.url,currentData:e,view2dData:l,setSelectedID:te,showEnlarge:s,checkMode:x,measureVisible:h}))})):null};var Re=de(ve,null,null,{context:ge})(Ne);export{Re as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{EPointCloudPattern as
|
|
1
|
+
import{EPointCloudPattern as J}from"@labelbee/lb-utils";import gt,{useState as s,useRef as Zt,useMemo as ht,useCallback as K,useEffect as Q}from"react";import{ActionsHistory as It,EToolName as U,uuid as qt}from"@labelbee/lb-annotation";import{useDispatch as Jt}from"../../store/ctx.js";import{ChangeSave as Kt}from"../../store/annotation/actionCreators.js";import Qt from"../../store/annotatedBox/index.js";import vt from"lodash";var Ut=Object.defineProperty,Wt=Object.defineProperties,Xt=Object.getOwnPropertyDescriptors,Pt=Object.getOwnPropertySymbols,Yt=Object.prototype.hasOwnProperty,$t=Object.prototype.propertyIsEnumerable,bt=(l,e,a)=>e in l?Ut(l,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):l[e]=a,N=(l,e)=>{for(var a in e||(e={}))Yt.call(e,a)&&bt(l,a,e[a]);if(Pt)for(var a of Pt(e))$t.call(e,a)&&bt(l,a,e[a]);return l},yt=(l,e)=>Wt(l,Xt(e)),te=(l,e,a)=>new Promise((L,A)=>{var _=f=>{try{y(a.next(f))}catch(C){A(C)}},j=f=>{try{y(a.throw(f))}catch(C){A(C)}},y=f=>f.done?L(f.value):Promise.resolve(f.value).then(_,j);y((a=a.apply(l,e)).next())});const Ct=l=>vt.pick(l,["id","attribute","width","height","x","y","imageName"]),wt=gt.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 It,hideAttributes:[],setHideAttributes:()=>{},toggleAttributesVisible:()=>{},reRender:()=>{},setAttrPanelLayout:()=>{},attrPanelLayout:"",syncAllViewPointCloudColor:()=>Promise.resolve(),defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:U.Rect,setPointCloudPattern:()=>{},selectSpecAttr:()=>{},globalPattern:J.Detection,setGlobalPattern:()=>{},setPtSegmentInstance:()=>{},segmentation:[],setSegmentation:()=>{},clearAllDetectionInstance:()=>{},highlight2DDataList:[],setHighlight2DDataList:()=>{},cuboidBoxIn2DView:!0,setCuboidBoxIn2DView:l=>{},imageSizes:{},cacheImageNodeSize:()=>{},unlinkImageItems:[],addRectFromPointCloudBoxByImageName:l=>!1,removeRectBySpecifyId:(l,e,a)=>!1,removeRectByPointCloudBoxId:l=>!1}),ee=({children:l})=>{const[e,a]=s([]),[L,A]=s([]),[_,j]=s([]),[y,f]=s([]),[C,St]=s([]),[v,F]=s([]),[R,k]=s([]),[W,Lt]=s(!0),[X,Dt]=s(!0),[Y,xt]=s(1),[m,$]=s(),[tt,et]=s(),[nt,it]=s(),[u,ot]=s(),[st,At]=s(""),[z,_t]=s(U.Rect),Rt=Zt(new It).current,[g,E]=s([]),[rt,Vt]=s(""),[G,Bt]=s(J.Detection),[D,lt]=s(void 0),[M,Ot]=s([]),[T,Ht]=s([]),h=Qt(),[at,Nt]=s({}),jt=Jt(),Ft=o=>{const{imgNode:r,path:i}=o;i&&r&&Nt(p=>yt(N({},p),{[i]:{width:r.width,height:r.height}}))},dt=ht(()=>v.length===1?v[0]:"",[v]),V=K((o,r,i="extId")=>{const p=i||"id",c=new Set(r);return f(I=>{let w=!1;const S=I.filter(O=>{const Z=O[p],H=c.has(Z)?O.imageName!==o:!0;return H||(w=!0),H});return w?S:I}),!0},[]),ct=K(o=>{const r=e.map(i=>i.id);return V(o,r,"extId")},[e,V]),ut=K(o=>{if(!o)return!1;const r=e.filter(i=>Array.isArray(i.rects)).map(i=>{const{id:p,attribute:c,trackID:I}=i,w=i.rects.find(S=>S.imageName===o);if(w){const S=vt.pick(w,["width","height","x","y","imageName"]);return yt(N({},S),{id:qt(),attribute:c,order:I,extId:p,lineDash:[]})}return null}).filter(i=>i!==null);return r.length?(f(i=>{const p=new Set(i.filter(I=>o===I.imageName).map(I=>I.extId)),c=r.filter(I=>p.has(I.extId)===!1);return c.length?[...i,...c]:i}),!0):!1},[e]),B=ht(()=>{const o=e.find(t=>t.id===dt),r=t=>{const n=e.concat(t);return a(n),n},i=t=>{const n=L.concat(t);return A(n),n},p=t=>{Lt(t!==!1)},c=t=>{t===void 0&&F([]),typeof t=="string"&&F([t]),Array.isArray(t)&&F(Array.from(new Set(t)))},I=t=>{v.includes(t)?c(v.filter(n=>n!==t)):c([...v,t])},w=t=>{const n=Ct(t);f(d=>[...d,n])},S=(t,n=!1)=>{const d=Ct(t);f(b=>b.map(P=>P.id===t.id?n?N(N({},P),d):d:P))},O=t=>{f(n=>n.filter(d=>!t.find(b=>b.id===d.id)))},Z=t=>{R.includes(t)?k([]):k([t])},H=()=>{if(z===U.Rect){const t=e.map(n=>n.id);c(t),m==null||m.pointCloud2dOperation.setSelectedIDs(t)}},zt=t=>{c(e.filter(n=>n.attribute===t).map(n=>n.id))},q=e.filter(t=>!g.includes(t.attribute)),pt=L.filter(t=>!g.includes(t.attribute)),ft=C.filter(t=>t.attribute&&!g.includes(t.attribute)),Et=t=>{if(g.includes(t))E(g.filter(n=>n!==t));else{const n=g.concat(t);E(n)}},Gt=(()=>{const t=q.map(d=>d.id),n=new Set(t);return y.filter(d=>d.extId&&n.has(d.extId)).map(d=>d.imageName)})(),Mt=(t=q,n=_,d=pt,b=ft,P=M)=>{var x;u==null||u.clearAllBox(),u==null||u.clearAllSphere(),m==null||m.updatePolygonList(t,n),m==null||m.updatePointList(d),m==null||m.updateLineList(b),u==null||u.generateBoxes(t),u==null||u.generateSpheres(d),(x=D==null?void 0:D.store)==null||x.updateCurrentSegment(P),mt(t)},Tt=()=>{$(void 0),et(void 0),it(void 0),ot(void 0)},mt=(t,n)=>te(void 0,null,function*(){var d;if(!u)return;const b=u.pointCloudObject;if(!!b)try{const P=yield u.getHighlightIndexByMappingImgList({mappingImgList:n!=null?n:T,points:b.geometry.attributes.position.array}),x=yield u==null?void 0:u.highlightOriginPointCloud(t,P);return x&&((d=m==null?void 0:m.pointCloudInstance)==null||d.updateColor(x)),x}catch(P){console.error(P)}});return{selectedID:dt,pointCloudBoxList:e,pointCloudSphereList:L,displayPointCloudList:q,displaySphereList:pt,displayLineList:ft,selectedIDs:v,setPointCloudResult:a,setSelectedIDs:c,addPointCloudBox:r,addPointCloudSphere:i,setPointCloudSphereList:A,valid:W,selectedPointCloudBox:o,setPointCloudValid:p,addSelectedID:I,addHighlightID:Z,selectedAllBoxes:H,topViewInstance:m,setTopViewInstance:$,sideViewInstance:tt,setSideViewInstance:et,backViewInstance:nt,setBackViewInstance:it,mainViewInstance:u,setMainViewInstance:ot,polygonList:_,setPolygonList:j,rectList:y,setRectList:f,addRectIn2DView:w,removeRectIn2DView:O,updateRectIn2DView:S,lineList:C,setLineList:St,zoom:Y,setZoom:xt,history:Rt,toggleAttributesVisible:Et,hideAttributes:g,setHideAttributes:E,reRender:Mt,attrPanelLayout:rt,setAttrPanelLayout:Vt,syncAllViewPointCloudColor:mt,defaultAttribute:st,setDefaultAttribute:At,pointCloudPattern:z,setPointCloudPattern:_t,selectSpecAttr:zt,globalPattern:G,setGlobalPattern:t=>{G!==t&&(jt(Kt),Bt(t),t===J.Detection&<(void 0))},ptSegmentInstance:D,setPtSegmentInstance:lt,segmentation:M,setSegmentation:Ot,clearAllDetectionInstance:Tt,highlight2DDataList:T,setHighlight2DDataList:Ht,cuboidBoxIn2DView:X,setCuboidBoxIn2DView:Dt,imageSizes:at,cacheImageNodeSize:Ft,highlightIDs:R,setHighlightIDs:k,unlinkImageItems:Gt,removeRectByPointCloudBoxId:ct,removeRectBySpecifyId:V,addRectFromPointCloudBoxByImageName:ut}},[W,v,e,L,_,C,y,m,tt,nt,u,Y,g,rt,st,z,G,D,M,T,X,at,R,ct,V,ut]);Q(()=>{var o,r,i;(o=h==null?void 0:h.setPointCloudBoxList)==null||o.call(h,e),(r=h==null?void 0:h.setHighlightIDs)==null||r.call(h,R),(i=h==null?void 0:h.setSelectedIDs)==null||i.call(h,v)},[e,v,R]),Q(()=>{var o;(o=h==null?void 0:h.setPtCtx)==null||o.call(h,B)},[B]);const kt=()=>{const o=e.filter(c=>g.includes(c.attribute)),{setSelectedIDs:r,reRender:i}=B,p=o.map(c=>c.id);p.length>0&&r(v.filter(c=>!p.includes(c))),i()};return Q(()=>{var o,r,i,p;kt(),(r=(o=m==null?void 0:m.toolInstance)==null?void 0:o.setHiddenAttributes)==null||r.call(o,g),(p=(i=D==null?void 0:D.store)==null?void 0:i.setHiddenAttributes)==null||p.call(i,g)},[g]),gt.createElement(wt.Provider,{value:B},l)};export{wt as PointCloudContext,ee as PointCloudProvider};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import c,{useState as C,useRef as v,useContext as y,useCallback as m,useMemo as N,useEffect as R}from"react";import{useLatest as d}from"ahooks";import{PointCloudContext as S}from"../PointCloudContext.js";import b from"../../../assets/annotation/icon_link.svg.js";import z from"../../../assets/annotation/icon_unlink.svg.js";const g={width:16,height:16},D=e=>{e.imageName||console.warn("missing imageName");const[n,f]=C(!0),s=v(e.imageName);s.current=e.imageName;const{unlinkImageItems:l,addRectFromPointCloudBoxByImageName:w,removeRectByPointCloudBoxId:h}=y(S),I=d(w),k=d(h),i=m(t=>{const o=s.current;if(!o){console.warn("invalid image name");return}f(t),t?k.current(o):I.current(o)},[]),u=m(()=>{i(!n)},[i,n]),x=N(()=>{var t;if(!e.is2DView)return null;const r={zIndex:(t=e.zIndex)!=null?t: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,cursor:"pointer"};return c.createElement("div",{style:r,onClick:u},n&&c.createElement("img",{src:b,style:g}),!n&&c.createElement("img",{src:z,style:g}))},[n,e.is2DView,e.zIndex,u]),a=m(()=>{if(!e.is2DView)return;const t=s.current;if(!t){console.warn("invalid image name");return}const r=new Set(l).has(t)===!1;i(r)},[e.is2DView,l,i]);return R(()=>{a()},[a]),{rendered:x,isLinking:n,swapSwitch:i,syncIsLinking:a}};export{D as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{uuid as
|
|
1
|
+
import{uuid as S}from"@labelbee/lb-annotation";import{jsonParser as g}from"./index.js";import{EToolName as I}from"../data/enums/ToolType.js";import R from"lodash";import x from"./StepUtils.js";import{message as N}from"antd";import{i18n as E}from"@labelbee/lb-utils";class L{static traverseDF(t,s,e,i){s(t,e,i),typeof t=="object"&&t!==null&&(Array.isArray(t)?t.forEach((n,r)=>{this.traverseDF(n,s,r,t)}):Object.keys(t).forEach(n=>{this.traverseDF(t[n],s,n,t)}))}static getNextPath(t){var s,e,i;const{prePath:n,preMappingImgList:r,nextMappingImgList:o}=t,a=(e=(s=r==null?void 0:r.find(u=>u.path===n))==null?void 0:s.calib)==null?void 0:e.calName,c=(i=o.find(u=>{var f;return((f=u.calib)==null?void 0:f.calName)===a}))==null?void 0:i.path;if(!c)throw Error("nextPath error");return c}static copyResultItemHandler(t){const{item:s,key:e,parent:i,mappingImgList:n,preMappingImgList:r}=t,o=e===void 0?void 0:i[e];return e==="id"&&(i.id=S(8,62)),e==="imageName"&&(i.imageName=this.getNextPath({prePath:s,preMappingImgList:r,nextMappingImgList:n})),{value:e===void 0?void 0:i[e],oldValue:o}}static copyResultChange(t){const{copyResult:s,step:e,currentResult:i,mappingImgList:n,preMappingImgList:r}=t;try{const o=g(s),a=g(i),c=`step_${e}`;if(o[c]){const u=o[c],f=["result","resultRect"],p=new Map,v=(l,d)=>{if(l===void 0||d===void 0){console.warn("invalid id");return}p.set(d,l)};if(f.forEach(l=>{u[l]&&this.traverseDF(u[l],(d,m,h)=>{const{value:y,oldValue:D}=this.copyResultItemHandler({item:d,key:m,parent:h,mappingImgList:n,preMappingImgList:r});l==="result"&&m==="id"&&y!==void 0&&D!==void 0&&p.set(D,y)})}),p.size){const l=u.resultRect;Array.isArray(l)&&l.forEach(d=>{const m=d.extId,h=p.get(m);m!==void 0&&h!==void 0&&(d.extId=h)})}return a[c]=u,JSON.stringify(a)}return s}catch(o){N.info(E.t("FailedToCopyResults"))}}static isResultSourceMatchedDependence(t,s){const e=t==null?void 0:t.map(n=>n.sourceID).sort(),i=s==null?void 0:s.map(n=>n.id).sort();return R.isEqual(e,i)}static deltaUpdateBasicResultList(t,s){const e=t==null?void 0:t.map(i=>i.sourceID).sort();return s.filter(i=>!e.includes(i.id))}static getInitialResultList(t,s,e,i,n){const r=t!=null?t:[];switch(e.tool){case I.Tag:case I.Text:{if(e.dataSourceStep>0){const o=this.deltaUpdateBasicResultList(r,i);if(o.length>0)return r.concat(s.getInitResultList(e.dataSourceStep,o))}return n!==!0?r:s.getInitResultList(e.dataSourceStep,i)}default:return r}}static dataCorrection(t,s,e,i){var n,r;try{const a=`step_${x.getStepInfo(e,i).step}`,c=g(t),u=g(s),f=(n=c[a])==null?void 0:n.result,p=(r=u[a])==null?void 0:r.result;if(!p||R.isEqual(f.sort(this.idCmp),p.sort(this.idCmp)))return t;const v=this.findDeletedIds(f,p);if(v.length===0)return t;const l=e,d=this.getStepKeys(c).sort();return this.deleteRes(c,l,v,d),JSON.stringify(c)}catch(o){return console.error(o),t}}static idCmp(t,s){const e=t.id,i=s.id;return e<i?-1:e>i?1:0}static findDeletedIds(t,s){return this.findDeletedItems(s,t).map(e=>e.id)}static findDeletedItems(t,s){const e=[];return t.forEach(i=>{s.some(r=>r.id===i.id)||e.push(i)}),e}static getStepKeys(t){return Object.keys(t).map(s=>parseInt(s.replace("step_",""),10)).filter(s=>!isNaN(s))}static deleteRes(t,s,e,i){i.forEach(n=>{if(n>s){const r=t[`step_${n}`];if([I.FolderTag,I.Segmentation].includes(r.tool))return;if(r.dataSourceStep===s){const o=[];r.result=r.result.filter(a=>e.includes(a.sourceID)?(o.push(a.id),!1):!0),this.deleteRes(t,n,o,i)}else r.result=r.result.filter(o=>!e.includes(o.sourceID))}})}}export{L as default};
|