@labelbee/lb-components 1.11.0-alpha.3 → 1.11.0-alpha.5
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/AnnotationView/index.js +1 -1
- package/dist/components/pointCloudView/PointCloud2DView.js +1 -1
- package/dist/components/pointCloudView/PointCloud3DView.js +1 -1
- package/dist/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
- package/dist/index.css +11 -2
- package/dist/types/components/AnnotationView/index.d.ts +5 -0
- package/dist/views/MainView/sidebar/PointCloudToolSidebar/components/batchUpdateModal/index.js +1 -1
- package/es/components/AnnotationView/index.js +1 -1
- package/es/components/pointCloudView/PointCloud2DView.js +1 -1
- package/es/components/pointCloudView/PointCloud3DView.js +1 -1
- package/es/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
- package/es/index.css +11 -2
- package/es/views/MainView/sidebar/PointCloudToolSidebar/components/batchUpdateModal/index.js +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),es=require("antd/es"),useRefCache=require("../../hooks/useRefCache.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,o)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,__spreadValues=(e,t)=>{for(var o in t||(t={}))__hasOwnProp.call(t,o)&&__defNormalProp(e,o,t[o]);if(__getOwnPropSymbols)for(var o of __getOwnPropSymbols(t))__propIsEnum.call(t,o)&&__defNormalProp(e,o,t[o]);return e};const DEFAULT_SIZE={width:500,height:100},sizeInitialized=e=>{if(!e)return DEFAULT_SIZE;if(e.width&&e.height)return e;const t=__spreadValues({},e);return t.width||(t.width=DEFAULT_SIZE.width),t.height||(t.height=DEFAULT_SIZE.height),t},AnnotationView=(e,t)=>{var o,h;const{src:g,annotations:l=[],style:m={stroke:"blue",thickness:3},zoomChange:s,backgroundStyle:
|
|
1
|
+
"use strict";var React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),es=require("antd/es"),useRefCache=require("../../hooks/useRefCache.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,o)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,__spreadValues=(e,t)=>{for(var o in t||(t={}))__hasOwnProp.call(t,o)&&__defNormalProp(e,o,t[o]);if(__getOwnPropSymbols)for(var o of __getOwnPropSymbols(t))__propIsEnum.call(t,o)&&__defNormalProp(e,o,t[o]);return e};const DEFAULT_SIZE={width:500,height:100},sizeInitialized=e=>{if(!e)return DEFAULT_SIZE;if(e.width&&e.height)return e;const t=__spreadValues({},e);return t.width||(t.width=DEFAULT_SIZE.width),t.height||(t.height=DEFAULT_SIZE.height),t},AnnotationView=(e,t)=>{var o,h;const{src:g,annotations:l=[],style:m={stroke:"blue",thickness:3},zoomChange:s,backgroundStyle:w={},onChange:c,showLoading:p=!1,globalStyle:b,afterImgOnLoad:y}=e,f=sizeInitialized(e.size),[I,d]=React.useState(!1),v=React.useRef(null),r=React.useRef(),_=useRefCache(y);React.useImperativeHandle(t,()=>{const n=r.current;return n?{zoomIn:()=>n.zoomChanged(!0),zoomOut:()=>n.zoomChanged(!1),initImgPos:()=>n.initImgPos(),toolInstance:n}:{}},[r.current]),React.useEffect(()=>(v.current&&(r.current=new lbAnnotation.ViewOperation({container:v.current,size:f,style:m,annotations:l,config:"{}",zoomInfo:e.zoomInfo}),r.current.init()),()=>{var n;(n=r.current)==null||n.destroy()}),[]),React.useEffect(()=>{var n;r.current&&(d(!0),(n=r.current)==null||n.setLoading(!0),lbAnnotation.ImgUtils.load(g).then(i=>{var a,u;(a=r.current)==null||a.setLoading(!1),d(!1),(u=r.current)==null||u.setImgNode(i),_.current&&_.current(i)}).catch(()=>{var i;(i=r.current)==null||i.setLoading(!1),d(!1)}))},[g]),React.useEffect(()=>{r.current&&r.current.updateData(l)},[l]),React.useEffect(()=>{const n=r.current;(n==null?void 0:n.setSize)&&(n.setSize(f),n.initPosition())},[(o=e.size)==null?void 0:o.width,(h=e.size)==null?void 0:h.height]),React.useEffect(()=>{var n,i;return r.current&&((n=r.current)==null||n.on("onChange",(...a)=>{c==null||c.apply(null,a)}),(i=r.current)==null||i.on("renderZoom",a=>{s&&s(a)})),()=>{var a,u;(a=r.current)==null||a.unbindAll("onChange"),(u=r.current)==null||u.unbindAll("renderZoom")}},[s,c]);const O=React__default.default.createElement("div",{ref:v,style:__spreadValues(__spreadValues({position:"relative"},f),w)});return React__default.default.createElement(es.Spin,{spinning:p||I,delay:300,style:b},O)};var AnnotationView$1=React__default.default.forwardRef(AnnotationView);module.exports=AnnotationView$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var dom=require("../../utils/dom.js"),React=require("react"),PointCloudLayout=require("./PointCloudLayout.js"),index=require("../AnnotationView/index.js"),PointCloudContext=require("./PointCloudContext.js"),reactRedux=require("react-redux"),icons=require("@ant-design/icons"),useSize=require("../../hooks/useSize.js"),useSingleBox=require("./hooks/useSingleBox.js"),lbAnnotation=require("@labelbee/lb-annotation"),reactI18next=require("react-i18next"),ctx=require("../../store/ctx.js"),map=require("../../store/annotation/map.js"),lbUtils=require("@labelbee/lb-utils");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,n)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,__spreadValues=(e,t)=>{for(var n in t||(t={}))__hasOwnProp.call(t,n)&&__defNormalProp(e,n,t[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(t))__propIsEnum.call(t,n)&&__defNormalProp(e,n,t[n]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));const Toolbar=({onNext:e,onPrev:t,imgLength:n,imgIndex:
|
|
1
|
+
"use strict";var dom=require("../../utils/dom.js"),React=require("react"),PointCloudLayout=require("./PointCloudLayout.js"),index=require("../AnnotationView/index.js"),PointCloudContext=require("./PointCloudContext.js"),reactRedux=require("react-redux"),icons=require("@ant-design/icons"),useSize=require("../../hooks/useSize.js"),useSingleBox=require("./hooks/useSingleBox.js"),lbAnnotation=require("@labelbee/lb-annotation"),reactI18next=require("react-i18next"),ctx=require("../../store/ctx.js"),map=require("../../store/annotation/map.js"),lbUtils=require("@labelbee/lb-utils");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,n)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,__spreadValues=(e,t)=>{for(var n in t||(t={}))__hasOwnProp.call(t,n)&&__defNormalProp(e,n,t[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(t))__propIsEnum.call(t,n)&&__defNormalProp(e,n,t[n]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));const Toolbar=({onNext:e,onPrev:t,imgLength:n,imgIndex:u})=>React__default.default.createElement("div",null,React__default.default.createElement(icons.LeftOutlined,{onClick:t}),React__default.default.createElement("span",null," ",u+1," / ",n," "),React__default.default.createElement(icons.RightOutlined,{onClick:e})),PointCloud2DView=({currentData:e,config:t})=>{var n,u,P,y,x;const[p,h]=React.useState([]),{topViewInstance:q,displayPointCloudList:L}=React.useContext(PointCloudContext.PointCloudContext),[f,C]=React.useState(""),[a,v]=React.useState(0),w=React.useRef(null),m=React.useRef(),{selectedBox:d}=useSingleBox.useSingleBox(),j=useSize(w),{t:E}=reactI18next.useTranslation(),r=(n=e==null?void 0:e.mappingImgList)==null?void 0:n[a];React.useEffect(()=>{v(0)},[e]),React.useEffect(()=>{if(q&&r){const o={fill:"transparent",color:"green"},l=L.reduce((c,i)=>{var s;const{transferViewData:b,viewRangePointList:R}=lbAnnotation.pointCloudLidar2image(i,r.calib),I=(s=lbUtils.toolStyleConverter.getColorFromConfig({attribute:i.attribute},__spreadProps(__spreadValues({},t),{attributeConfigurable:!0}),{}))==null?void 0:s.stroke,O=[...c,...b.map(S=>({type:S.type,annotation:__spreadProps(__spreadValues({id:i.id,pointList:S.pointList},o),{stroke:I})}))];return i.id===f&&O.push({type:"polygon",annotation:__spreadProps(__spreadValues({id:f,pointList:R},o),{stroke:I,fill:"rgba(255, 255, 255, 0.6)"})}),O},[]);h(l)}},[L,r,f]);const g=!e||!(e==null?void 0:e.mappingImgList)||!(((u=e==null?void 0:e.mappingImgList)==null?void 0:u.length)>0),_=React.useCallback(()=>{var o,l;const c=(o=m.current)==null?void 0:o.toolInstance;if(C(""),!d||!c)return;const i=p.find(b=>b.annotation.id===d.info.id);let s="";((l=i==null?void 0:i.annotation.pointList)==null?void 0:l.length)>0&&(c.focusPositionByPointList(i==null?void 0:i.annotation.pointList),s=d.info.id,C(s))},[d,m.current,p,a]);return React.useEffect(()=>{_()},[_]),React__default.default.createElement(PointCloudLayout.PointCloudContainer,{className:dom.getClassName("point-cloud-2d-container"),title:E("2DView"),toolbar:g?void 0:React__default.default.createElement(Toolbar,{imgIndex:a,imgLength:(y=(P=e.mappingImgList)==null?void 0:P.length)!=null?y:0,onNext:()=>{var o;!e||!(e==null?void 0:e.mappingImgList)||a>=((o=e==null?void 0:e.mappingImgList)==null?void 0:o.length)-1||v(l=>l+1)},onPrev:()=>{a<=0||v(o=>o-1)}}),style:g?{display:"none"}:{display:"flex",minHeight:200,maxHeight:500}},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-2d-image"),ref:w},React__default.default.createElement(index,{src:(x=r==null?void 0:r.url)!=null?x:"",annotations:p,size:j,ref:m,globalStyle:{display:g?"none":"block"},afterImgOnLoad:_,zoomInfo:{min:.01,max:1e3,ratio:.4}})))};var PointCloud2DView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloud2DView);module.exports=PointCloud2DView$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var dom=require("../../utils/dom.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),classNames=require("classnames"),React=require("react"),PointCloudLayout=require("./PointCloudLayout.js"),PointCloudContext=require("./PointCloudContext.js"),map=require("../../store/annotation/map.js"),reactRedux=require("react-redux"),index=require("../../utils/index.js"),useSingleBox=require("./hooks/useSingleBox.js"),useSphere=require("./hooks/useSphere.js"),antd=require("antd"),useSize=require("../../hooks/useSize.js"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),reactI18next=require("react-i18next"),ctx=require("../../store/ctx.js"),index$1=require("./components/PointCloudSizeSlider/index.js");function _interopDefaultLegacy(
|
|
1
|
+
"use strict";var dom=require("../../utils/dom.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),classNames=require("classnames"),React=require("react"),PointCloudLayout=require("./PointCloudLayout.js"),PointCloudContext=require("./PointCloudContext.js"),map=require("../../store/annotation/map.js"),reactRedux=require("react-redux"),index=require("../../utils/index.js"),useSingleBox=require("./hooks/useSingleBox.js"),useSphere=require("./hooks/useSphere.js"),antd=require("antd"),useSize=require("../../hooks/useSize.js"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),reactI18next=require("react-i18next"),ctx=require("../../store/ctx.js"),index$1=require("./components/PointCloudSizeSlider/index.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var classNames__default=_interopDefaultLegacy(classNames),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=(t,n,e)=>n in t?__defProp(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e,__spreadValues=(t,n)=>{for(var e in n||(n={}))__hasOwnProp.call(n,e)&&__defNormalProp(t,e,n[e]);if(__getOwnPropSymbols)for(var e of __getOwnPropSymbols(n))__propIsEnum.call(n,e)&&__defNormalProp(t,e,n[e]);return t},__spreadProps=(t,n)=>__defProps(t,__getOwnPropDescs(n));const pointCloudID="LABELBEE-POINTCLOUD",PointCloud3DContext=React__default.default.createContext({isActive:!1,setTarget3DView:()=>{},reset3DView:()=>{},followTopView:()=>{}}),PointCloudViewIcon=({perspectiveView:t})=>{const{isActive:n,setTarget3DView:e}=React.useContext(PointCloud3DContext),m=p=>classNames__default.default({[dom.getClassName("point-cloud-3d-view",p)]:!0,active:n});return React__default.default.createElement("span",{onClick:()=>{e(lbUtils.EPerspectiveView[t])},className:m(t.toLocaleLowerCase())})},PointCloud3DSideBar=()=>{const{reset3DView:t,followTopView:n}=React.useContext(PointCloud3DContext),{t:e}=reactI18next.useTranslation();return React__default.default.createElement("div",{className:dom.getClassName("point-cloud-3d-sidebar")},React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Top"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Front"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Left"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Back"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Right"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"LFT"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"RBT"}),React__default.default.createElement(antd.Tooltip,{title:e("CameraFollowTopView")},React__default.default.createElement("span",{onClick:()=>{n()},className:dom.getClassName("point-cloud-3d-view","followTop")})),React__default.default.createElement("span",{onClick:()=>{t()},className:dom.getClassName("point-cloud-3d-view","reset")}))},PointCloud3D=({currentData:t,config:n})=>{const e=React.useContext(PointCloudContext.PointCloudContext),[m,p]=React.useState(!0),c=React.useRef(null),{initPointCloud3d:w}=usePointCloudViews.usePointCloudViews(),s=useSize(c),{t:C}=reactI18next.useTranslation();React.useEffect(()=>{!e.mainViewInstance||w==null||w(s)},[s]);const{selectedBox:u}=useSingleBox.useSingleBox(),{selectedSphere:d}=useSphere.useSphere(),v=o=>{var a,i;const r=u==null?void 0:u.info;if(r){const l=__spreadValues({},r.center);l.x=l.x-.01,l.z=10;const f=o===lbUtils.EPerspectiveView.Top;(a=e.mainViewInstance)==null||a.updateCameraByBox(r,o,f?l:void 0)}d&&((i=e.mainViewInstance)==null||i.updateCameraBySphere(d,o))},V=()=>{var o;(o=e.mainViewInstance)==null||o.resetCamera()},P=()=>{var o,a;const i=(o=e.topViewInstance)==null?void 0:o.pointCloudInstance.camera;i&&((a=e.mainViewInstance)==null||a.applyCameraTarget(i))};React.useEffect(()=>{if(c.current&&(t==null?void 0:t.url)){let o=e.mainViewInstance;if(!o&&s.width){const a={left:-s.width/2,right:s.width/2,top:s.height/2,bottom:-s.height/2,near:100,far:-100};o=new lbAnnotation.PointCloud({container:c.current,isOrthographicCamera:!0,orthographicParams:a,config:n}),e.setMainViewInstance(o)}}},[s]),React.useEffect(()=>{var o;if(c.current&&(t==null?void 0:t.url)&&t.result&&e.mainViewInstance){let a=e.mainViewInstance;const i=lbUtils.PointCloudUtils.getBoxParamsFromResultList(t.result);i.forEach(r=>{var l;const f=(l=lbUtils.toolStyleConverter.getColorFromConfig({attribute:r.attribute},__spreadProps(__spreadValues({},n),{attributeConfigurable:!0}),{}))==null?void 0:l.hex;a==null||a.generateBox(r,f)}),e.setPointCloudResult(i),e.setPointCloudValid((o=index.jsonParser(t.result))==null?void 0:o.valid)}},[t,e.mainViewInstance]),React.useEffect(()=>{var o,a,i,r;if(u){v(lbUtils.EPerspectiveView.Top);const l=(i=(a=(o=e.topViewInstance)==null?void 0:o.pointCloudInstance)==null?void 0:a.camera.zoom)!=null?i:1;(r=e.mainViewInstance)==null||r.updateCameraZoom(l)}},[u]),React.useEffect(()=>{var o,a,i,r;if(d){v(lbUtils.EPerspectiveView.Top);const l=(i=(a=(o=e.topViewInstance)==null?void 0:o.pointCloudInstance)==null?void 0:a.camera.zoom)!=null?i:1;(r=e.mainViewInstance)==null||r.updateCameraZoom(l)}},[d]);const _=React.useMemo(()=>({reset3DView:V,setTarget3DView:v,isActive:!!u,followTopView:P}),[u,e.mainViewInstance]),g=React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(index$1,{onChange:o=>{var a;(a=e.mainViewInstance)==null||a.updatePointSize({customSize:o})}}),React__default.default.createElement("span",{style:{marginRight:8}},C("ShowArrows")),React__default.default.createElement(antd.Switch,{size:"small",checked:m,onChange:o=>{var a;p(o),(a=e.mainViewInstance)==null||a.setShowDirection(o)}}));return React__default.default.createElement(PointCloudLayout.PointCloudContainer,{className:dom.getClassName("point-cloud-3d-container"),title:C("3DView"),toolbar:g},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-3d-content")},React__default.default.createElement(PointCloud3DContext.Provider,{value:_},React__default.default.createElement(PointCloud3DSideBar,null)),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-3d-view"),id:pointCloudID,ref:c})))};var PointCloud3DView=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloud3D);module.exports=PointCloud3DView;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),React=require("react"),PointCloudContext=require("../PointCloudContext.js"),useSingleBox=require("./useSingleBox.js"),useSphere=require("./useSphere.js"),ctx=require("../../../store/ctx.js"),StepUtils=require("../../../utils/StepUtils.js"),index=require("../../../utils/index.js"),actionCreators=require("../../../store/annotation/actionCreators.js"),antd=require("antd"),reactI18next=require("react-i18next"),useHistory=require("./useHistory.js"),usePolygon=require("./usePolygon.js"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,o,i)=>o in t?__defProp(t,o,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[o]=i,__spreadValues=(t,o)=>{for(var i in o||(o={}))__hasOwnProp.call(o,i)&&__defNormalProp(t,i,o[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(o))__propIsEnum.call(o,i)&&__defNormalProp(t,i,o[i]);return t},__spreadProps=(t,o)=>__defProps(t,__getOwnPropDescs(o)),__async=(t,o,i)=>new Promise((l,e)=>{var a=d=>{try{r(i.next(d))}catch(h){e(h)}},p=d=>{try{r(i.throw(d))}catch(h){e(h)}},r=d=>d.done?l(d.value):Promise.resolve(d.value).then(a,p);r((i=i.apply(t,o)).next())});const DEFAULT_SCOPE=5,DEFAULT_RADIUS=90,PointCloudView={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},topViewPoint2PointCloud=(t,o,i,l,e)=>{const{x:a,y:p}=lbUtils.PointCloudUtils.transferCanvas2World(t,o),{defaultZ:r}=lbUtils.DEFAULT_SPHERE_PARAMS,d={center:{x:a,y:p,z:r},id:t.id},h=l?__spreadValues(__spreadValues({},l),d):__spreadProps(__spreadValues({},d),{attribute:"",valid:!0});return e&&Object.assign(h,e),h},topViewPolygon2PointCloud=(t,o,i,l,e,a)=>{let p=t.pointList.map(y=>lbUtils.PointCloudUtils.transferCanvas2World(y,o)),r=0,d=1,h={};if(i){const y=i.getSensesPointZAxisInPolygon(p,void 0,a);a&&y.fittedCoordinates.length>0&&(p=y.fittedCoordinates),r=(y.maxZ+y.minZ)/2,d=y.maxZ-y.minZ,h={count:y.zCount}}const[f,x,_]=p,U=lbAnnotation.MathUtils.getLineCenterPoint([f,_]),D=lbAnnotation.MathUtils.getLineLength(f,x),O=lbAnnotation.MathUtils.getLineLength(x,_),k=lbAnnotation.MathUtils.getRadiusFromQuadrangle(t.pointList);l&&(r=l.center.z,d=l.depth);const V={center:{x:U.x,y:U.y,z:r},width:O,height:D,depth:d,rotation:k,id:t.id},w=__spreadValues(l?__spreadValues(__spreadValues({},l),V):__spreadProps(__spreadValues({},V),{attribute:"",valid:!0}),h);e&&Object.assign(w,e);const A=p.map(y=>lbUtils.PointCloudUtils.transferWorld2Canvas(y,o));return{boxParams:w,newPointList:A}},sideViewPoint2PointCloud=(t,o,i)=>{const l={x:t.x-o.x,y:t.y-o.y};return __spreadProps(__spreadValues({},i),{center:{x:i.center.x-l.x,y:i.center.y,z:i.center.z-l.y}})},sideViewPolygon2PointCloud=(t,o,i,l)=>{const[e,a,p]=t.pointList,[r,d,h]=o.pointList,f=lbAnnotation.MathUtils.getLineCenterPoint([e,p]),x=lbAnnotation.MathUtils.getLineCenterPoint([r,h]),U={x:{x:f.x-x.x,y:f.y-x.y}.x,y:0,z:f.y-x.y},D=lbAnnotation.MathUtils.getLineLength(e,a),O=lbAnnotation.MathUtils.getLineLength(r,d),k=D-O,V=lbAnnotation.MathUtils.getLineLength(a,p),w=lbAnnotation.MathUtils.getLineLength(d,h),A=V-w,{newBoxParams:y}=l.getNewBoxBySideUpdate(U,A,k,i);return y},backViewPoint2PointCloud=(t,o,i)=>{const l={x:t.x-o.x,y:t.y-o.y};return __spreadProps(__spreadValues({},i),{center:{x:i.center.x,y:i.center.y-l.x,z:i.center.z-l.y}})},backViewPolygon2PointCloud=(t,o,i,l)=>{const[e,a,p]=t.pointList,[r,d,h]=o.pointList,f=lbAnnotation.MathUtils.getLineCenterPoint([e,p]),x=lbAnnotation.MathUtils.getLineCenterPoint([r,h]),U={x:{x:f.x-x.x,y:f.y-x.y}.x,y:0,z:f.y-x.y},D=lbAnnotation.MathUtils.getLineLength(e,a),O=lbAnnotation.MathUtils.getLineLength(r,d),k=D-O,V=lbAnnotation.MathUtils.getLineLength(a,p),w=lbAnnotation.MathUtils.getLineLength(d,h),A=V-w;let{newBoxParams:y}=l.getNewBoxByBackUpdate(U,A,k,i);return y},syncSideViewByPoint=(t,o,i,l,e)=>{var a;if(!i)return;const{toolInstance:p,pointCloudInstance:r}=i;r.loadPCDFile(l,(a=e==null?void 0:e.radius)!=null?a:DEFAULT_RADIUS);const{cameraPositionVector:d}=r.updateOrthoCameraBySphere(t,lbUtils.EPerspectiveView.Left);r.setInitCameraPosition(d);const{point2d:h,zoom:f}=r.getSphereSidePoint2DCoordinate(t);r.camera.zoom=f,r.camera.updateProjectionMatrix(),r.render(),p.initPosition(),p.zoomChangeOnCenter(f),p.setResult([__spreadProps(__spreadValues(__spreadValues({},o),h),{valid:t.valid,textAttribute:"",attribute:t.attribute})]),p.setSelectedID(o.id)},synchronizeSideView=(t,o,i,l)=>{if(!i)return;const{pointCloud2dOperation:e,pointCloudInstance:a}=i;a.loadPCDFileByBox(l,t,{width:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:p}=a.updateOrthoCamera(t,lbUtils.EPerspectiveView.Left);a.setInitCameraPosition(p);const{polygon2d:r,zoom:d}=a.getBoxSidePolygon2DCoordinate(t);a.camera.zoom=d,a.camera.updateProjectionMatrix(),a.render(),e.initPosition(),e.zoomChangeOnCenter(d),e.setResultAndSelectedID([{id:o.id,valid:t.valid,pointList:r,textAttribute:"",isRect:!0,attribute:t.attribute}],o.id)},syncBackViewByPoint=(t,o,i,l,e)=>{var a;if(!i)return;const{toolInstance:p,pointCloudInstance:r}=i;r.loadPCDFile(l,(a=e==null?void 0:e.radius)!=null?a:DEFAULT_RADIUS);const{cameraPositionVector:d}=r.updateOrthoCameraBySphere(t,lbUtils.EPerspectiveView.Back);r.setInitCameraPosition(d);const{point2d:h,zoom:f}=r.getSphereBackPoint2DCoordinate(t);r.camera.zoom=f,r.camera.updateProjectionMatrix(),r.render(),p.initPosition(),p.zoomChangeOnCenter(f),p.setResult([__spreadProps(__spreadValues(__spreadValues({},o),h),{valid:t.valid,textAttribute:"",attribute:t.attribute})]),p.setSelectedID(o.id)},synchronizeBackView=(t,o,i,l)=>{if(!i)return;const{pointCloud2dOperation:e,pointCloudInstance:a}=i;a.loadPCDFileByBox(l,t,{height:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:p}=a.updateOrthoCamera(t,lbUtils.EPerspectiveView.Back);a.setInitCameraPosition(p);const{polygon2d:r,zoom:d}=a.getBoxBackPolygon2DCoordinate(t);a.camera.zoom=d,a.camera.updateProjectionMatrix(),a.render(),e.initPosition(),e.zoomChangeOnCenter(d),e.setResultAndSelectedID([{id:o.id,valid:t.valid,pointList:r,textAttribute:"",isRect:!0,attribute:t.attribute}],o.id)},syncTopViewByPoint=(t,o,i,l)=>{if(!i||!l)return;l.generateSphere(t),l.updateCameraBySphere(t,lbUtils.EPerspectiveView.Top),l.render();const{toolInstance:e,pointCloudInstance:a}=i,{point2d:p}=a.getSphereTopPoint2DCoordinate(t),r=[...e.pointList].map(d=>d.id===o.id?__spreadProps(__spreadValues(__spreadValues({},o),p),{valid:t.valid,textAttribute:"",attribute:t.attribute}):d);e.setResult(r),e.setSelectedID(o.id)},synchronizeTopView=(t,o,i,l)=>{var e;if(!i||!l)return;l.generateBox(t,o.id),l.render();const{pointCloud2dOperation:a,pointCloudInstance:p}=i,{polygon2d:r}=p.getBoxTopPolygon2DCoordinate(t),d=[...a.polygonList],h=d.find(f=>f.id===o.id);h?h.pointList=r:d.push({id:o.id,pointList:r,textAttribute:"",isRect:!0,valid:(e=t.valid)!=null?e:!0}),a.setResultAndSelectedID(d,o.id)},usePointCloudViews=()=>{const t=React.useContext(PointCloudContext.PointCloudContext),{topViewInstance:o,sideViewInstance:i,backViewInstance:l,mainViewInstance:e,addPointCloudBox:a,addPointCloudSphere:p,setSelectedIDs:r,selectedIDs:d,pointCloudBoxList:h,pointCloudSphereList:f,hideAttributes:x}=t,{addHistory:_,initHistory:U,pushHistoryUnderUpdatePolygon:D,pushHistoryUnderUpdateLine:O}=useHistory.useHistory(),{selectedPolygon:k}=usePolygon.usePolygon(),{updateSelectedBox:V,updateSelectedBoxes:w,getPointCloudByID:A}=useSingleBox.useSingleBox(),{getPointCloudSphereByID:y,updatePointCloudSphere:H,selectedSphere:z}=useSphere.useSphere(),{currentData:T,config:L}=ctx.useSelector(n=>{const{stepList:s,step:P,imgList:c,imgIndex:u}=n.annotation;return{currentData:c[u],config:index.jsonParser(StepUtils.getCurrentStepInfo(P,s).config)}}),F=ctx.useDispatch(),{selectedBox:j}=useSingleBox.useSingleBox(),{t:G}=reactI18next.useTranslation(),N=j==null?void 0:j.info;if(!o||!i||!l)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:E}=o,Q=n=>{e==null||e.generateBox(n),e==null||e.controls.update(),e==null||e.render()},X=n=>{e==null||e.generateSphere(n),e==null||e.controls.update(),e==null||e.render()},Y=({newPoint:n,size:s,zoom:P,trackConfigurable:c})=>{var u;const C={attribute:(u=o.toolInstance.defaultAttribute)!=null?u:""};c===!0&&Object.assign(C,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:f})});const g=topViewPoint2PointCloud(n,s,E,void 0,C);r(n.id);const v=p(g);M(PointCloudView.Top,n,g,P,v,L),_({newSphereParams:g})},J=({polygon:n,size:s,imgList:P,trackConfigurable:c,zoom:u,intelligentFit:C})=>{var g;const v={attribute:(g=o.toolInstance.defaultAttribute)!=null?g:""};c===!0&&Object.assign(v,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:h,extraSphereList:f})});const m=o==null?void 0:o.toolInstance,b=__spreadValues({},n),{boxParams:B,newPointList:I}=topViewPolygon2PointCloud(b,s,E,void 0,v,C);if((L==null?void 0:L.lowerLimitPointsNumInBox)&&typeof B.count=="number"&&B.count<L.lowerLimitPointsNumInBox){antd.message.info(G("LowerLimitPointsNumInBox",{num:L.lowerLimitPointsNumInBox})),m.deletePolygon(B.id);return}C&&(I==null?void 0:I.length)&&(b.pointList=I);const q=x.includes(b.attribute),S=a(B);o==null||o.updatePolygonList(S!=null?S:[]),q?r([]):(r(B.id),m.selection.setSelectedIDs(b.id),R(PointCloudView.Top,b,B,u,S),C&&synchronizeTopView(B,b,o,e)),_({newBoxParams:B})},K=({newSelectedBox:n,newPointCloudList:s,newSelectedSphere:P,newSphereList:c})=>{var u;const C=o==null?void 0:o.toolInstance;if(!(d.length===0||!C)){if(n||(j==null?void 0:j.info)){const g=n!=null?n:j==null?void 0:j.info;(u=C==null?void 0:C.selection)==null||u.setSelectedIDs(d[0]);const v=C.selectedPolygon;if(d.length===1&&g){R(PointCloudView.Top,v,g,void 0,s);return}}if((P||z)&&d.length===1){const g=P!=null?P:z;C.setSelectedID(d[0]);const v=C.selectedPoint;g&&M(PointCloudView.Top,v,g,void 0,c,L)}}},Z=(n,s,P)=>{if(N){let c,u;switch(P){case PointCloudView.Back:c=backViewPolygon2PointCloud;break;case PointCloudView.Side:c=sideViewPolygon2PointCloud;break;default:c=sideViewPolygon2PointCloud;break}if(u=c(n,s,N,i.pointCloudInstance),e){const{count:g}=e.getSensesPointZAxisInPolygon(lbAnnotation.getCuboidFromPointCloudBox(u).polygonPointList,[u.center.z-u.depth/2,u.center.z+u.depth/2]);u=__spreadProps(__spreadValues({},u),{count:g})}const C=V(u);return R(P,n,u,void 0,C),C}},W=(n,s,P)=>{if(z){let c,u;switch(P){case PointCloudView.Back:c=backViewPoint2PointCloud;break;case PointCloudView.Side:c=sideViewPoint2PointCloud;break;default:c=sideViewPoint2PointCloud;break}u=c(n,s,z);const C=H(u);return M(P,n,u,void 0,C,L),C}},$=(n,s)=>{W(n,s,PointCloudView.Side)},tt=(n,s)=>{W(n,s,PointCloudView.Back)},et=(n,s)=>{Z(n,s,PointCloudView.Side)},ot=(n,s)=>{Z(n,s,PointCloudView.Back)},it=(n,s)=>{O(n)},nt=(n,s)=>{const P=y(n.id),c=topViewPoint2PointCloud(n,s,E,P),u=H(c);M(PointCloudView.Top,n,c,void 0,u,L)},st=(n,s)=>{if(k){const c=n[0].newPolygon;c.pointList=c.pointList.map(u=>lbUtils.PointCloudUtils.transferCanvas2World(u,s)),D(n[0].newPolygon);return}const P=n.map(({newPolygon:c})=>{const u=A(c.id),{boxParams:C}=topViewPolygon2PointCloud(c,s,o.pointCloudInstance,u);return C});if(P.length===1){const{newPolygon:c}=n[0],u=w(P);R(PointCloudView.Top,c,P[0],void 0,u)}else{const c=w(P);c&&t.syncAllViewPointCloudColor(c)}},M=(n,s,P,c,u,C)=>__async(void 0,null,function*(){const g=T==null?void 0:T.url,v={[PointCloudView.Side]:()=>{syncSideViewByPoint(P,s,i,g,C)},[PointCloudView.Back]:()=>{l&&syncBackViewByPoint(P,s,l,g,C)},[PointCloudView.Top]:()=>{syncTopViewByPoint(P,s,o,e)}};Object.keys(v).forEach(m=>{m!==n&&v[m]()}),c&&(e==null||e.updateCameraZoom(c)),X(P)}),R=(n,s,P,c,u)=>__async(void 0,null,function*(){const C=T==null?void 0:T.url;u&&(yield t.syncAllViewPointCloudColor(u));const g={[PointCloudView.Side]:()=>{synchronizeSideView(P,s,i,C)},[PointCloudView.Back]:()=>{l&&synchronizeBackView(P,s,l,C)},[PointCloudView.Top]:()=>{synchronizeTopView(P,s,o,e)}};Object.keys(g).forEach(v=>{v!==n&&g[v]()}),c&&(e==null||e.updateCameraZoom(c)),Q(P)});return{topViewAddSphere:Y,topViewAddBox:J,topViewSelectedChanged:K,topViewUpdatePoint:nt,sideViewUpdatePoint:$,backViewUpdatePoint:tt,topViewUpdateBox:st,topViewUpdateLine:it,sideViewUpdateBox:et,backViewUpdateBox:ot,pointCloudBoxListUpdated:n=>{o.updatePolygonList(n),e==null||e.generateBoxes(n)},initPointCloud3d:n=>{if(!e)return;const s={left:-n.width/2,right:n.width/2,top:n.height/2,bottom:-n.height/2,near:100,far:-100};e.initOrthographicCamera(s),e.initRenderer(),e.render()},updatePointCloudData:(...n)=>__async(void 0,[...n],function*(s=T){var P,c,u,C,g,v;if(!(s==null?void 0:s.url)||!e)return;actionCreators.SetPointCloudLoading(F,!0),yield e.loadPCDFile(s.url,(P=L==null?void 0:L.radius)!=null?P:DEFAULT_RADIUS),h.forEach(S=>{e==null||e.removeObjectByName(S.id)}),f.forEach(S=>{e==null||e.removeObjectByName(S.id)});let m=[],b=[],B=[],I=[];s.result?(m=lbUtils.PointCloudUtils.getBoxParamsFromResultList(s.result),B=lbUtils.PointCloudUtils.getPolygonListFromResultList(s.result),b=lbUtils.PointCloudUtils.getLineListFromResultList(s.result),I=lbUtils.PointCloudUtils.getSphereParamsFromResultList(s.result),m.forEach(S=>{e==null||e.generateBox(S)}),I.forEach(S=>{e==null||e.generateSphere(S)}),t.syncAllViewPointCloudColor(m),t.setPointCloudResult(m),t.setPolygonList(B),t.setLineList(b),t.setPointCloudSphereList(I)):(t.setPointCloudResult([]),t.setPolygonList([]),t.setPointCloudSphereList([]),t.setLineList([])),U({pointCloudBoxList:m,polygonList:B,pointCloudSphereList:I}),e.updateTopCamera();const q=(u=(c=index.jsonParser(s.result))==null?void 0:c.valid)!=null?u:!0;t.setPointCloudValid(q),(C=t.sideViewInstance)==null||C.clearAllData(),(g=t.backViewInstance)==null||g.clearAllData(),o.updateData(s.url,s.result,{radius:(v=L==null?void 0:L.radius)!=null?v:DEFAULT_RADIUS}),actionCreators.SetPointCloudLoading(F,!1)})}};exports.syncBackViewByPoint=syncBackViewByPoint,exports.syncSideViewByPoint=syncSideViewByPoint,exports.syncTopViewByPoint=syncTopViewByPoint,exports.synchronizeBackView=synchronizeBackView,exports.synchronizeSideView=synchronizeSideView,exports.synchronizeTopView=synchronizeTopView,exports.topViewPoint2PointCloud=topViewPoint2PointCloud,exports.topViewPolygon2PointCloud=topViewPolygon2PointCloud,exports.usePointCloudViews=usePointCloudViews;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),React=require("react"),PointCloudContext=require("../PointCloudContext.js"),useSingleBox=require("./useSingleBox.js"),useSphere=require("./useSphere.js"),ctx=require("../../../store/ctx.js"),StepUtils=require("../../../utils/StepUtils.js"),index=require("../../../utils/index.js"),actionCreators=require("../../../store/annotation/actionCreators.js"),antd=require("antd"),reactI18next=require("react-i18next"),useHistory=require("./useHistory.js"),usePolygon=require("./usePolygon.js"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,o,i)=>o in t?__defProp(t,o,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[o]=i,__spreadValues=(t,o)=>{for(var i in o||(o={}))__hasOwnProp.call(o,i)&&__defNormalProp(t,i,o[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(o))__propIsEnum.call(o,i)&&__defNormalProp(t,i,o[i]);return t},__spreadProps=(t,o)=>__defProps(t,__getOwnPropDescs(o)),__async=(t,o,i)=>new Promise((l,e)=>{var a=d=>{try{r(i.next(d))}catch(g){e(g)}},p=d=>{try{r(i.throw(d))}catch(g){e(g)}},r=d=>d.done?l(d.value):Promise.resolve(d.value).then(a,p);r((i=i.apply(t,o)).next())});const DEFAULT_SCOPE=5,DEFAULT_RADIUS=90,PointCloudView={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},topViewPoint2PointCloud=(t,o,i,l,e)=>{const{x:a,y:p}=lbUtils.PointCloudUtils.transferCanvas2World(t,o),{defaultZ:r}=lbUtils.DEFAULT_SPHERE_PARAMS,d={center:{x:a,y:p,z:r},id:t.id},g=l?__spreadValues(__spreadValues({},l),d):__spreadProps(__spreadValues({},d),{attribute:"",valid:!0});return e&&Object.assign(g,e),g},topViewPolygon2PointCloud=(t,o,i,l,e,a)=>{let p=t.pointList.map(y=>lbUtils.PointCloudUtils.transferCanvas2World(y,o)),r=0,d=1,g={};if(i){const y=i.getSensesPointZAxisInPolygon(p,void 0,a);a&&y.fittedCoordinates.length>0&&(p=y.fittedCoordinates),r=(y.maxZ+y.minZ)/2,d=y.maxZ-y.minZ,g={count:y.zCount}}const[f,L,I]=p,U=lbAnnotation.MathUtils.getLineCenterPoint([f,I]),_=lbAnnotation.MathUtils.getLineLength(f,L),D=lbAnnotation.MathUtils.getLineLength(L,I),O=lbAnnotation.MathUtils.getRadiusFromQuadrangle(t.pointList);l&&(r=l.center.z,d=l.depth);const V={center:{x:U.x,y:U.y,z:r},width:D,height:_,depth:d,rotation:O,id:t.id},w=__spreadValues(l?__spreadValues(__spreadValues({},l),V):__spreadProps(__spreadValues({},V),{attribute:"",valid:!0}),g);e&&Object.assign(w,e);const k=p.map(y=>lbUtils.PointCloudUtils.transferWorld2Canvas(y,o));return{boxParams:w,newPointList:k}},sideViewPoint2PointCloud=(t,o,i)=>{const l={x:t.x-o.x,y:t.y-o.y};return __spreadProps(__spreadValues({},i),{center:{x:i.center.x-l.x,y:i.center.y,z:i.center.z-l.y}})},sideViewPolygon2PointCloud=(t,o,i,l)=>{const[e,a,p]=t.pointList,[r,d,g]=o.pointList,f=lbAnnotation.MathUtils.getLineCenterPoint([e,p]),L=lbAnnotation.MathUtils.getLineCenterPoint([r,g]),U={x:{x:f.x-L.x,y:f.y-L.y}.x,y:0,z:f.y-L.y},_=lbAnnotation.MathUtils.getLineLength(e,a),D=lbAnnotation.MathUtils.getLineLength(r,d),O=_-D,V=lbAnnotation.MathUtils.getLineLength(a,p),w=lbAnnotation.MathUtils.getLineLength(d,g),k=V-w,{newBoxParams:y}=l.getNewBoxBySideUpdate(U,k,O,i);return y},backViewPoint2PointCloud=(t,o,i)=>{const l={x:t.x-o.x,y:t.y-o.y};return __spreadProps(__spreadValues({},i),{center:{x:i.center.x,y:i.center.y-l.x,z:i.center.z-l.y}})},backViewPolygon2PointCloud=(t,o,i,l)=>{const[e,a,p]=t.pointList,[r,d,g]=o.pointList,f=lbAnnotation.MathUtils.getLineCenterPoint([e,p]),L=lbAnnotation.MathUtils.getLineCenterPoint([r,g]),U={x:{x:f.x-L.x,y:f.y-L.y}.x,y:0,z:f.y-L.y},_=lbAnnotation.MathUtils.getLineLength(e,a),D=lbAnnotation.MathUtils.getLineLength(r,d),O=_-D,V=lbAnnotation.MathUtils.getLineLength(a,p),w=lbAnnotation.MathUtils.getLineLength(d,g),k=V-w;let{newBoxParams:y}=l.getNewBoxByBackUpdate(U,k,O,i);return y},syncSideViewByPoint=(t,o,i,l,e)=>{var a;if(!i)return;const{toolInstance:p,pointCloudInstance:r}=i;r.loadPCDFile(l,(a=e==null?void 0:e.radius)!=null?a:DEFAULT_RADIUS);const{cameraPositionVector:d}=r.updateOrthoCameraBySphere(t,lbUtils.EPerspectiveView.Left);r.setInitCameraPosition(d);const{point2d:g,zoom:f}=r.getSphereSidePoint2DCoordinate(t);r.camera.zoom=f,r.camera.updateProjectionMatrix(),r.render(),p.initPosition(),p.zoomChangeOnCenter(f),p.setResult([__spreadProps(__spreadValues(__spreadValues({},o),g),{valid:t.valid,textAttribute:"",attribute:t.attribute})]),p.setSelectedID(o.id)},synchronizeSideView=(t,o,i,l)=>{if(!i)return;const{pointCloud2dOperation:e,pointCloudInstance:a}=i;a.loadPCDFileByBox(l,t,{width:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:p}=a.updateOrthoCamera(t,lbUtils.EPerspectiveView.Left);a.setInitCameraPosition(p);const{polygon2d:r,zoom:d}=a.getBoxSidePolygon2DCoordinate(t);a.camera.zoom=d,a.camera.updateProjectionMatrix(),a.render(),e.initPosition(),e.zoomChangeOnCenter(d),e.setResultAndSelectedID([{id:o.id,valid:t.valid,pointList:r,textAttribute:"",isRect:!0,attribute:t.attribute}],o.id)},syncBackViewByPoint=(t,o,i,l,e)=>{var a;if(!i)return;const{toolInstance:p,pointCloudInstance:r}=i;r.loadPCDFile(l,(a=e==null?void 0:e.radius)!=null?a:DEFAULT_RADIUS);const{cameraPositionVector:d}=r.updateOrthoCameraBySphere(t,lbUtils.EPerspectiveView.Back);r.setInitCameraPosition(d);const{point2d:g,zoom:f}=r.getSphereBackPoint2DCoordinate(t);r.camera.zoom=f,r.camera.updateProjectionMatrix(),r.render(),p.initPosition(),p.zoomChangeOnCenter(f),p.setResult([__spreadProps(__spreadValues(__spreadValues({},o),g),{valid:t.valid,textAttribute:"",attribute:t.attribute})]),p.setSelectedID(o.id)},synchronizeBackView=(t,o,i,l)=>{if(!i)return;const{pointCloud2dOperation:e,pointCloudInstance:a}=i;a.loadPCDFileByBox(l,t,{height:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:p}=a.updateOrthoCamera(t,lbUtils.EPerspectiveView.Back);a.setInitCameraPosition(p);const{polygon2d:r,zoom:d}=a.getBoxBackPolygon2DCoordinate(t);a.camera.zoom=d,a.camera.updateProjectionMatrix(),a.render(),e.initPosition(),e.zoomChangeOnCenter(d),e.setResultAndSelectedID([{id:o.id,valid:t.valid,pointList:r,textAttribute:"",isRect:!0,attribute:t.attribute}],o.id)},syncTopViewByPoint=(t,o,i,l)=>{if(!i||!l)return;l.generateSphere(t),l.updateCameraBySphere(t,lbUtils.EPerspectiveView.Top),l.render();const{toolInstance:e,pointCloudInstance:a}=i,{point2d:p}=a.getSphereTopPoint2DCoordinate(t),r=[...e.pointList].map(d=>d.id===o.id?__spreadProps(__spreadValues(__spreadValues({},o),p),{valid:t.valid,textAttribute:"",attribute:t.attribute}):d);e.setResult(r),e.setSelectedID(o.id)},synchronizeTopView=(t,o,i,l)=>{var e;if(!i||!l)return;l.generateBox(t,o.id),l.render();const{pointCloud2dOperation:a,pointCloudInstance:p}=i,{polygon2d:r}=p.getBoxTopPolygon2DCoordinate(t),d=[...a.polygonList],g=d.find(f=>f.id===o.id);g?g.pointList=r:d.push({id:o.id,pointList:r,textAttribute:"",isRect:!0,valid:(e=t.valid)!=null?e:!0}),a.setResultAndSelectedID(d,o.id)},usePointCloudViews=()=>{const t=React.useContext(PointCloudContext.PointCloudContext),{topViewInstance:o,sideViewInstance:i,backViewInstance:l,mainViewInstance:e,addPointCloudBox:a,addPointCloudSphere:p,setSelectedIDs:r,selectedIDs:d,pointCloudBoxList:g,pointCloudSphereList:f,hideAttributes:L}=t,{addHistory:I,initHistory:U,pushHistoryUnderUpdatePolygon:_,pushHistoryUnderUpdateLine:D}=useHistory.useHistory(),{selectedPolygon:O}=usePolygon.usePolygon(),{updateSelectedBox:V,updateSelectedBoxes:w,getPointCloudByID:k}=useSingleBox.useSingleBox(),{getPointCloudSphereByID:y,updatePointCloudSphere:F,selectedSphere:M}=useSphere.useSphere(),{currentData:j,config:B}=ctx.useSelector(n=>{const{stepList:s,step:P,imgList:c,imgIndex:u}=n.annotation;return{currentData:c[u],config:index.jsonParser(StepUtils.getCurrentStepInfo(P,s).config)}}),N=ctx.useDispatch(),{selectedBox:A}=useSingleBox.useSingleBox(),{t:Q}=reactI18next.useTranslation(),Z=A==null?void 0:A.info;if(!o||!i||!l)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:q}=o,X=n=>{e==null||e.generateBox(n),e==null||e.controls.update(),e==null||e.render()},Y=n=>{e==null||e.generateSphere(n),e==null||e.controls.update(),e==null||e.render()},J=({newPoint:n,size:s,zoom:P,trackConfigurable:c})=>{var u;const C={attribute:(u=o.toolInstance.defaultAttribute)!=null?u:""};c===!0&&Object.assign(C,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:f})});const h=topViewPoint2PointCloud(n,s,q,void 0,C);r(n.id);const v=p(h);R(PointCloudView.Top,n,h,P,v,B),I({newSphereParams:h})},K=({polygon:n,size:s,imgList:P,trackConfigurable:c,zoom:u,intelligentFit:C})=>{var h,v;const m={attribute:(h=o.toolInstance.defaultAttribute)!=null?h:""};c===!0&&Object.assign(m,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:g,extraSphereList:f})});const T=o==null?void 0:o.toolInstance,S=__spreadValues({},n),{boxParams:x,newPointList:z}=topViewPolygon2PointCloud(S,s,q,void 0,m,C);if((B==null?void 0:B.lowerLimitPointsNumInBox)&&typeof x.count=="number"&&x.count<B.lowerLimitPointsNumInBox){antd.message.info(Q("LowerLimitPointsNumInBox",{num:B.lowerLimitPointsNumInBox})),T.deletePolygon(x.id);return}C&&(z==null?void 0:z.length)&&(S.pointList=z);const b=L.includes(S.attribute),H=a(x),lt=(v=t==null?void 0:t.polygonList)!=null?v:[];o==null||o.updatePolygonList(H!=null?H:[],lt),b?r([]):(r(x.id),T.selection.setSelectedIDs(S.id),E(PointCloudView.Top,S,x,u,H),C&&synchronizeTopView(x,S,o,e)),I({newBoxParams:x})},$=({newSelectedBox:n,newPointCloudList:s,newSelectedSphere:P,newSphereList:c})=>{var u;const C=o==null?void 0:o.toolInstance;if(!(d.length===0||!C)){if(n||(A==null?void 0:A.info)){const h=n!=null?n:A==null?void 0:A.info;(u=C==null?void 0:C.selection)==null||u.setSelectedIDs(d[0]);const v=C.selectedPolygon;if(d.length===1&&h){E(PointCloudView.Top,v,h,void 0,s);return}}if((P||M)&&d.length===1){const h=P!=null?P:M;C.setSelectedID(d[0]);const v=C.selectedPoint;h&&R(PointCloudView.Top,v,h,void 0,c,B)}}},W=(n,s,P)=>{if(Z){let c,u;switch(P){case PointCloudView.Back:c=backViewPolygon2PointCloud;break;case PointCloudView.Side:c=sideViewPolygon2PointCloud;break;default:c=sideViewPolygon2PointCloud;break}if(u=c(n,s,Z,i.pointCloudInstance),e){const{count:h}=e.getSensesPointZAxisInPolygon(lbAnnotation.getCuboidFromPointCloudBox(u).polygonPointList,[u.center.z-u.depth/2,u.center.z+u.depth/2]);u=__spreadProps(__spreadValues({},u),{count:h})}const C=V(u);return E(P,n,u,void 0,C),C}},G=(n,s,P)=>{if(M){let c,u;switch(P){case PointCloudView.Back:c=backViewPoint2PointCloud;break;case PointCloudView.Side:c=sideViewPoint2PointCloud;break;default:c=sideViewPoint2PointCloud;break}u=c(n,s,M);const C=F(u);return R(P,n,u,void 0,C,B),C}},tt=(n,s)=>{G(n,s,PointCloudView.Side)},et=(n,s)=>{G(n,s,PointCloudView.Back)},ot=(n,s)=>{W(n,s,PointCloudView.Side)},it=(n,s)=>{W(n,s,PointCloudView.Back)},nt=(n,s)=>{D(n)},st=(n,s)=>{const P=y(n.id),c=topViewPoint2PointCloud(n,s,q,P),u=F(c);R(PointCloudView.Top,n,c,void 0,u,B)},rt=(n,s)=>{if(O){const c=n[0].newPolygon;c.pointList=c.pointList.map(u=>lbUtils.PointCloudUtils.transferCanvas2World(u,s)),_(n[0].newPolygon);return}const P=n.map(({newPolygon:c})=>{const u=k(c.id),{boxParams:C}=topViewPolygon2PointCloud(c,s,o.pointCloudInstance,u);return C});if(P.length===1){const{newPolygon:c}=n[0],u=w(P);E(PointCloudView.Top,c,P[0],void 0,u)}else{const c=w(P);c&&t.syncAllViewPointCloudColor(c)}},R=(n,s,P,c,u,C)=>__async(void 0,null,function*(){const h=j==null?void 0:j.url,v={[PointCloudView.Side]:()=>{syncSideViewByPoint(P,s,i,h,C)},[PointCloudView.Back]:()=>{l&&syncBackViewByPoint(P,s,l,h,C)},[PointCloudView.Top]:()=>{syncTopViewByPoint(P,s,o,e)}};Object.keys(v).forEach(m=>{m!==n&&v[m]()}),c&&(e==null||e.updateCameraZoom(c)),Y(P)}),E=(n,s,P,c,u)=>__async(void 0,null,function*(){const C=j==null?void 0:j.url;u&&(yield t.syncAllViewPointCloudColor(u));const h={[PointCloudView.Side]:()=>{synchronizeSideView(P,s,i,C)},[PointCloudView.Back]:()=>{l&&synchronizeBackView(P,s,l,C)},[PointCloudView.Top]:()=>{synchronizeTopView(P,s,o,e)}};Object.keys(h).forEach(v=>{v!==n&&h[v]()}),c&&(e==null||e.updateCameraZoom(c)),X(P)});return{topViewAddSphere:J,topViewAddBox:K,topViewSelectedChanged:$,topViewUpdatePoint:st,sideViewUpdatePoint:tt,backViewUpdatePoint:et,topViewUpdateBox:rt,topViewUpdateLine:nt,sideViewUpdateBox:ot,backViewUpdateBox:it,pointCloudBoxListUpdated:n=>{o.updatePolygonList(n),e==null||e.generateBoxes(n)},initPointCloud3d:n=>{if(!e)return;const s={left:-n.width/2,right:n.width/2,top:n.height/2,bottom:-n.height/2,near:100,far:-100};e.initOrthographicCamera(s),e.initRenderer(),e.render()},updatePointCloudData:(...n)=>__async(void 0,[...n],function*(s=j){var P,c,u,C,h,v;if(!(s==null?void 0:s.url)||!e)return;actionCreators.SetPointCloudLoading(N,!0),yield e.loadPCDFile(s.url,(P=B==null?void 0:B.radius)!=null?P:DEFAULT_RADIUS),g.forEach(b=>{e==null||e.removeObjectByName(b.id)}),f.forEach(b=>{e==null||e.removeObjectByName(b.id)});let m=[],T=[],S=[],x=[];s.result?(m=lbUtils.PointCloudUtils.getBoxParamsFromResultList(s.result),S=lbUtils.PointCloudUtils.getPolygonListFromResultList(s.result),T=lbUtils.PointCloudUtils.getLineListFromResultList(s.result),x=lbUtils.PointCloudUtils.getSphereParamsFromResultList(s.result),m.forEach(b=>{e==null||e.generateBox(b)}),x.forEach(b=>{e==null||e.generateSphere(b)}),t.syncAllViewPointCloudColor(m),t.setPointCloudResult(m),t.setPolygonList(S),t.setLineList(T),t.setPointCloudSphereList(x)):(t.setPointCloudResult([]),t.setPolygonList([]),t.setPointCloudSphereList([]),t.setLineList([])),U({pointCloudBoxList:m,polygonList:S,pointCloudSphereList:x}),e.updateTopCamera();const z=(u=(c=index.jsonParser(s.result))==null?void 0:c.valid)!=null?u:!0;t.setPointCloudValid(z),(C=t.sideViewInstance)==null||C.clearAllData(),(h=t.backViewInstance)==null||h.clearAllData(),o.updateData(s.url,s.result,{radius:(v=B==null?void 0:B.radius)!=null?v:DEFAULT_RADIUS}),actionCreators.SetPointCloudLoading(N,!1)})}};exports.syncBackViewByPoint=syncBackViewByPoint,exports.syncSideViewByPoint=syncSideViewByPoint,exports.syncTopViewByPoint=syncTopViewByPoint,exports.synchronizeBackView=synchronizeBackView,exports.synchronizeSideView=synchronizeSideView,exports.synchronizeTopView=synchronizeTopView,exports.topViewPoint2PointCloud=topViewPoint2PointCloud,exports.topViewPolygon2PointCloud=topViewPolygon2PointCloud,exports.usePointCloudViews=usePointCloudViews;
|
package/dist/index.css
CHANGED
|
@@ -1276,6 +1276,7 @@
|
|
|
1276
1276
|
width: 24px;
|
|
1277
1277
|
background-repeat: no-repeat;
|
|
1278
1278
|
cursor: pointer;
|
|
1279
|
+
flex: none;
|
|
1279
1280
|
margin-right: 16px;
|
|
1280
1281
|
background-image: url("../dist/assets/icons/7eadb9c4.svg");
|
|
1281
1282
|
transform: rotateY(180deg);
|
|
@@ -1286,6 +1287,7 @@
|
|
|
1286
1287
|
width: 24px;
|
|
1287
1288
|
background-repeat: no-repeat;
|
|
1288
1289
|
cursor: pointer;
|
|
1290
|
+
flex: none;
|
|
1289
1291
|
margin-right: 16px;
|
|
1290
1292
|
background-image: url("../dist/assets/icons/7eadb9c4.svg");
|
|
1291
1293
|
}
|
|
@@ -1295,6 +1297,7 @@
|
|
|
1295
1297
|
width: 24px;
|
|
1296
1298
|
background-repeat: no-repeat;
|
|
1297
1299
|
cursor: pointer;
|
|
1300
|
+
flex: none;
|
|
1298
1301
|
background-image: url("../dist/assets/icons/9d70807.svg");
|
|
1299
1302
|
}
|
|
1300
1303
|
.bee-point-cloud-wrapper .bee-point-cloud-container__header-toolbar .bee-point-cloud__next {
|
|
@@ -1345,7 +1348,7 @@
|
|
|
1345
1348
|
display: flex;
|
|
1346
1349
|
flex-direction: column;
|
|
1347
1350
|
overflow: hidden;
|
|
1348
|
-
|
|
1351
|
+
flex: 1;
|
|
1349
1352
|
}
|
|
1350
1353
|
.bee-point-cloud-wrapper .bee-point-cloud-container__left .bee-point-cloud-3d-container .bee-point-cloud-3d-content {
|
|
1351
1354
|
display: flex;
|
|
@@ -1360,7 +1363,11 @@
|
|
|
1360
1363
|
box-sizing: content-box;
|
|
1361
1364
|
display: flex;
|
|
1362
1365
|
flex-direction: column;
|
|
1363
|
-
justify-content: flex-
|
|
1366
|
+
justify-content: flex-start;
|
|
1367
|
+
overflow-y: scroll;
|
|
1368
|
+
}
|
|
1369
|
+
.bee-point-cloud-wrapper .bee-point-cloud-container__left .bee-point-cloud-3d-container .bee-point-cloud-3d-content .bee-point-cloud-3d-sidebar::-webkit-scrollbar {
|
|
1370
|
+
display: none;
|
|
1364
1371
|
}
|
|
1365
1372
|
.bee-point-cloud-wrapper .bee-point-cloud-container__left .bee-point-cloud-3d-container .bee-point-cloud-3d-content .bee-point-cloud-3d-sidebar .bee-point-cloud-3d-view__reset, .bee-point-cloud-wrapper .bee-point-cloud-container__left .bee-point-cloud-3d-container .bee-point-cloud-3d-content .bee-point-cloud-3d-sidebar .bee-point-cloud-3d-view__followTop {
|
|
1366
1373
|
display: inline-block;
|
|
@@ -1368,6 +1375,7 @@
|
|
|
1368
1375
|
width: 36px;
|
|
1369
1376
|
background-repeat: no-repeat;
|
|
1370
1377
|
cursor: pointer;
|
|
1378
|
+
flex: none;
|
|
1371
1379
|
font-size: 36px;
|
|
1372
1380
|
background-position: center;
|
|
1373
1381
|
background-color: #444;
|
|
@@ -1388,6 +1396,7 @@
|
|
|
1388
1396
|
width: 36px;
|
|
1389
1397
|
background-repeat: no-repeat;
|
|
1390
1398
|
cursor: pointer;
|
|
1399
|
+
flex: none;
|
|
1391
1400
|
background-image: url("../dist/assets/icons/c5b4262e.png");
|
|
1392
1401
|
margin-bottom: 8px;
|
|
1393
1402
|
}
|
|
@@ -22,6 +22,11 @@ interface IProps {
|
|
|
22
22
|
showLoading?: boolean;
|
|
23
23
|
globalStyle?: React.CSSProperties;
|
|
24
24
|
afterImgOnLoad?: TAfterImgOnLoad;
|
|
25
|
+
zoomInfo?: {
|
|
26
|
+
min: number;
|
|
27
|
+
max: number;
|
|
28
|
+
ratio: number;
|
|
29
|
+
};
|
|
25
30
|
}
|
|
26
31
|
declare const _default: React.ForwardRefExoticComponent<IProps & React.RefAttributes<unknown>>;
|
|
27
32
|
export default _default;
|
package/dist/views/MainView/sidebar/PointCloudToolSidebar/components/batchUpdateModal/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var actionCreators=require("../../../../../../store/annotation/actionCreators.js"),reducer=require("../../../../../../store/annotation/reducer.js"),ctx=require("../../../../../../store/ctx.js"),antd=require("antd"),React=require("react"),reactI18next=require("react-i18next"),reactRedux=require("react-redux"),lbUtils=require("@labelbee/lb-utils");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 layout={labelCol:{span:8},wrapperCol:{span:16}},inputStyle={width:"80px"},BatchUpdateModal=({id:e,stepList:t,imgList:r,imgIndex:c,toolInstance:u,updateCurrentPolygonList:m})=>{const p=ctx.useDispatch(),[d,
|
|
1
|
+
"use strict";var actionCreators=require("../../../../../../store/annotation/actionCreators.js"),reducer=require("../../../../../../store/annotation/reducer.js"),ctx=require("../../../../../../store/ctx.js"),antd=require("antd"),React=require("react"),reactI18next=require("react-i18next"),reactRedux=require("react-redux"),lbUtils=require("@labelbee/lb-utils");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 layout={labelCol:{span:8},wrapperCol:{span:16}},inputStyle={width:"80px"},BatchUpdateModal=({id:e,stepList:t,imgList:r,imgIndex:c,toolInstance:u,updateCurrentPolygonList:m})=>{const p=ctx.useDispatch(),[d,o]=React.useState(!1),[s]=antd.Form.useForm(),{t:n}=reactI18next.useTranslation(),f=a=>{const i=reducer.composeResultByToolInstance({toolInstance:u,imgList:r,imgIndex:c,stepList:t});if(a.prevPage>a.nextPage)return;if(i.slice(a.prevPage-1,a.nextPage).some(y=>{const x=parseInt(a.newID,10);return lbUtils.PointCloudUtils.batchUpdateTrackIDCheck({newID:x,result:y.result})})){antd.message.error(n("DuplicateTrackIDsExist"));return}p(actionCreators.BatchUpdateTrackID({id:e,newID:a.newID,rangeIndex:[a.prevPage-1,a.nextPage-1],imgList:i}));const b=parseInt(a.newID,10);o(!1),m(b)},I=()=>o(!1),g=()=>s.submit(),l=[{required:!0,message:n("PositiveIntegerCheck")}];return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement("a",{style:{color:"#666FFF"},onClick:()=>o(!0)},n("BatchUpdateText")),React__default.default.createElement(antd.Modal,{title:n("BatchUpdateTrackID"),visible:d,onCancel:I,onOk:g,wrapClassName:"labelbee-custom-modal"},React__default.default.createElement(antd.Form,__spreadProps(__spreadValues({},layout),{form:s,onFinish:f}),React__default.default.createElement(antd.Form.Item,{name:"id",label:n("CurrentBoxTrackIDs")},e),React__default.default.createElement(antd.Form.Item,{name:"newID",label:n("TrackIDUnifyAs"),rules:l},React__default.default.createElement(antd.InputNumber,{precision:0,min:1,style:inputStyle})),React__default.default.createElement(antd.Form.Item,{label:n("UnifyTrackIDRange"),required:!0},React__default.default.createElement(antd.Form.Item,{style:{display:"inline-block"},rules:l,name:"prevPage",noStyle:!0},React__default.default.createElement(antd.InputNumber,{precision:0,min:1,style:inputStyle})),React__default.default.createElement("span",{style:{display:"inline-block",width:"24px",textAlign:"center"}},"-"),React__default.default.createElement(antd.Form.Item,{style:{display:"inline-block"},rules:l,name:"nextPage",noStyle:!0},React__default.default.createElement(antd.InputNumber,{precision:0,min:1,style:inputStyle})),React__default.default.createElement("span",{style:{display:"inline-block",width:"40x",marginLeft:"10px",textAlign:"center"}},n("Page"))))))},mapStateToProps=e=>({toolInstance:e.annotation.toolInstance,imgList:e.annotation.imgList,imgIndex:e.annotation.imgIndex,stepList:e.annotation.stepList});var BatchUpdateModal$1=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(BatchUpdateModal);module.exports=BatchUpdateModal$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import v,{useState as A,useRef as b,useImperativeHandle as V,useEffect as u}from"react";import{ViewOperation as j,ImgUtils as Z}from"@labelbee/lb-annotation";import{Spin as k}from"antd/es";import D from"../../hooks/useRefCache.js";var U=Object.defineProperty,y=Object.getOwnPropertySymbols,x=Object.prototype.hasOwnProperty,F=Object.prototype.propertyIsEnumerable,O=(e,n,o)=>n in e?U(e,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[n]=o,g=(e,n)=>{for(var o in n||(n={}))x.call(n,o)&&O(e,o,n[o]);if(y)for(var o of y(n))F.call(n,o)&&O(e,o,n[o]);return e};const _={width:500,height:100},H=e=>{if(!e)return _;if(e.width&&e.height)return e;const n=g({},e);return n.width||(n.width=_.width),n.height||(n.height=_.height),n},N=(e,n)=>{var o,p;const{src:w,annotations:s=[],style:z={stroke:"blue",thickness:3},zoomChange:c,backgroundStyle:P={},onChange:d,showLoading:S=!1,globalStyle:C,afterImgOnLoad:L}=e,f=H(e.size),[R,h]=A(!1),m=b(null),r=b(),I=D(L);V(n,()=>{const t=r.current;return t?{zoomIn:()=>t.zoomChanged(!0),zoomOut:()=>t.zoomChanged(!1),initImgPos:()=>t.initImgPos(),toolInstance:t}:{}},[r.current]),u(()=>(m.current&&(r.current=new j({container:m.current,size:f,style:z,annotations:s,config:"{}",zoomInfo:e.zoomInfo}),r.current.init()),()=>{var t;(t=r.current)==null||t.destroy()}),[]),u(()=>{var t;r.current&&(h(!0),(t=r.current)==null||t.setLoading(!0),Z.load(w).then(a=>{var i,l;(i=r.current)==null||i.setLoading(!1),h(!1),(l=r.current)==null||l.setImgNode(a),I.current&&I.current(a)}).catch(()=>{var a;(a=r.current)==null||a.setLoading(!1),h(!1)}))},[w]),u(()=>{r.current&&r.current.updateData(s)},[s]),u(()=>{const t=r.current;(t==null?void 0:t.setSize)&&(t.setSize(f),t.initPosition())},[(o=e.size)==null?void 0:o.width,(p=e.size)==null?void 0:p.height]),u(()=>{var t,a;return r.current&&((t=r.current)==null||t.on("onChange",(...i)=>{d==null||d.apply(null,i)}),(a=r.current)==null||a.on("renderZoom",i=>{c&&c(i)})),()=>{var i,l;(i=r.current)==null||i.unbindAll("onChange"),(l=r.current)==null||l.unbindAll("renderZoom")}},[c,d]);const E=v.createElement("div",{ref:m,style:g(g({position:"relative"},f),P)});return v.createElement(k,{spinning:S||R,delay:300,style:C},E)};var T=v.forwardRef(N);export{T as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getClassName as
|
|
1
|
+
import{getClassName as A}from"../../utils/dom.js";import l,{useState as y,useContext as $,useRef as N,useEffect as L,useCallback as q}from"react";import{PointCloudContainer as G}from"./PointCloudLayout.js";import J from"../AnnotationView/index.js";import{PointCloudContext as K}from"./PointCloudContext.js";import{connect as Q}from"react-redux";import{LeftOutlined as U,RightOutlined as W}from"@ant-design/icons";import X from"../../hooks/useSize.js";import{useSingleBox as Y}from"./hooks/useSingleBox.js";import{pointCloudLidar2image as Z}from"@labelbee/lb-annotation";import{useTranslation as D}from"react-i18next";import{LabelBeeContext as tt}from"../../store/ctx.js";import{a2MapStateToProps as et}from"../../store/annotation/map.js";import{toolStyleConverter as ot}from"@labelbee/lb-utils";var nt=Object.defineProperty,it=Object.defineProperties,lt=Object.getOwnPropertyDescriptors,R=Object.getOwnPropertySymbols,rt=Object.prototype.hasOwnProperty,st=Object.prototype.propertyIsEnumerable,z=(t,e,o)=>e in t?nt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,w=(t,e)=>{for(var o in e||(e={}))rt.call(e,o)&&z(t,o,e[o]);if(R)for(var o of R(e))st.call(e,o)&&z(t,o,e[o]);return t},C=(t,e)=>it(t,lt(e));const at=({onNext:t,onPrev:e,imgLength:o,imgIndex:m})=>l.createElement("div",null,l.createElement(U,{onClick:e}),l.createElement("span",null," ",m+1," / ",o," "),l.createElement(W,{onClick:t})),pt=({currentData:t,config:e})=>{var o,m,I,x,O;const[u,T]=y([]),{topViewInstance:B,displayPointCloudList:h}=$(K),[f,j]=y(""),[s,g]=y(0),S=N(null),v=N(),{selectedBox:d}=Y(),H=X(S),{t:M}=D(),a=(o=t==null?void 0:t.mappingImgList)==null?void 0:o[s];L(()=>{g(0)},[t]),L(()=>{if(B&&a){const n={fill:"transparent",color:"green"},r=h.reduce((c,i)=>{var p;const{transferViewData:b,viewRangePointList:F}=Z(i,a.calib),E=(p=ot.getColorFromConfig({attribute:i.attribute},C(w({},e),{attributeConfigurable:!0}),{}))==null?void 0:p.stroke,V=[...c,...b.map(k=>({type:k.type,annotation:C(w({id:i.id,pointList:k.pointList},n),{stroke:E})}))];return i.id===f&&V.push({type:"polygon",annotation:C(w({id:f,pointList:F},n),{stroke:E,fill:"rgba(255, 255, 255, 0.6)"})}),V},[]);T(r)}},[h,a,f]);const _=!t||!(t==null?void 0:t.mappingImgList)||!(((m=t==null?void 0:t.mappingImgList)==null?void 0:m.length)>0),P=q(()=>{var n,r;const c=(n=v.current)==null?void 0:n.toolInstance;if(j(""),!d||!c)return;const i=u.find(b=>b.annotation.id===d.info.id);let p="";((r=i==null?void 0:i.annotation.pointList)==null?void 0:r.length)>0&&(c.focusPositionByPointList(i==null?void 0:i.annotation.pointList),p=d.info.id,j(p))},[d,v.current,u,s]);return L(()=>{P()},[P]),l.createElement(G,{className:A("point-cloud-2d-container"),title:M("2DView"),toolbar:_?void 0:l.createElement(at,{imgIndex:s,imgLength:(x=(I=t.mappingImgList)==null?void 0:I.length)!=null?x:0,onNext:()=>{var n;!t||!(t==null?void 0:t.mappingImgList)||s>=((n=t==null?void 0:t.mappingImgList)==null?void 0:n.length)-1||g(r=>r+1)},onPrev:()=>{s<=0||g(n=>n-1)}}),style:_?{display:"none"}:{display:"flex",minHeight:200,maxHeight:500}},l.createElement("div",{className:A("point-cloud-2d-image"),ref:S},l.createElement(J,{src:(O=a==null?void 0:a.url)!=null?O:"",annotations:u,size:H,ref:v,globalStyle:{display:_?"none":"block"},afterImgOnLoad:P,zoomInfo:{min:.01,max:1e3,ratio:.4}})))};var mt=Q(et,null,null,{context:tt})(pt);export{mt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getClassName as
|
|
1
|
+
import{getClassName as m}from"../../utils/dom.js";import{PointCloud as z}from"@labelbee/lb-annotation";import{PointCloudUtils as D,toolStyleConverter as N,EPerspectiveView as C}from"@labelbee/lb-utils";import L from"classnames";import n,{useContext as h,useState as k,useRef as R,useEffect as w,useMemo as F}from"react";import{PointCloudContainer as A}from"./PointCloudLayout.js";import{PointCloudContext as M}from"./PointCloudContext.js";import{a2MapStateToProps as U}from"../../store/annotation/map.js";import{connect as Z}from"react-redux";import{jsonParser as q}from"../../utils/index.js";import{useSingleBox as G}from"./hooks/useSingleBox.js";import{useSphere as H}from"./hooks/useSphere.js";import{Switch as J,Tooltip as K}from"antd";import Q from"../../hooks/useSize.js";import{usePointCloudViews as W}from"./hooks/usePointCloudViews.js";import{useTranslation as I}from"react-i18next";import{LabelBeeContext as X}from"../../store/ctx.js";import Y from"./components/PointCloudSizeSlider/index.js";var $=Object.defineProperty,ee=Object.defineProperties,te=Object.getOwnPropertyDescriptors,b=Object.getOwnPropertySymbols,oe=Object.prototype.hasOwnProperty,ne=Object.prototype.propertyIsEnumerable,S=(o,r,e)=>r in o?$(o,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[r]=e,T=(o,r)=>{for(var e in r||(r={}))oe.call(r,e)&&S(o,e,r[e]);if(b)for(var e of b(r))ne.call(r,e)&&S(o,e,r[e]);return o},ie=(o,r)=>ee(o,te(r));const re="LABELBEE-POINTCLOUD",g=n.createContext({isActive:!1,setTarget3DView:()=>{},reset3DView:()=>{},followTopView:()=>{}}),u=({perspectiveView:o})=>{const{isActive:r,setTarget3DView:e}=h(g),f=V=>L({[m("point-cloud-3d-view",V)]:!0,active:r});return n.createElement("span",{onClick:()=>{e(C[o])},className:f(o.toLocaleLowerCase())})},ae=()=>{const{reset3DView:o,followTopView:r}=h(g),{t:e}=I();return n.createElement("div",{className:m("point-cloud-3d-sidebar")},n.createElement(u,{perspectiveView:"Top"}),n.createElement(u,{perspectiveView:"Front"}),n.createElement(u,{perspectiveView:"Left"}),n.createElement(u,{perspectiveView:"Back"}),n.createElement(u,{perspectiveView:"Right"}),n.createElement(u,{perspectiveView:"LFT"}),n.createElement(u,{perspectiveView:"RBT"}),n.createElement(K,{title:e("CameraFollowTopView")},n.createElement("span",{onClick:()=>{r()},className:m("point-cloud-3d-view","followTop")})),n.createElement("span",{onClick:()=>{o()},className:m("point-cloud-3d-view","reset")}))},le=({currentData:o,config:r})=>{const e=h(M),[f,V]=k(!0),d=R(null),{initPointCloud3d:E}=W(),c=Q(d),{t:x}=I();w(()=>{!e.mainViewInstance||E==null||E(c)},[c]);const{selectedBox:p}=G(),{selectedSphere:v}=H(),P=t=>{var i,a;const l=p==null?void 0:p.info;if(l){const s=T({},l.center);s.x=s.x-.01,s.z=10;const _=t===C.Top;(i=e.mainViewInstance)==null||i.updateCameraByBox(l,t,_?s:void 0)}v&&((a=e.mainViewInstance)==null||a.updateCameraBySphere(v,t))},j=()=>{var t;(t=e.mainViewInstance)==null||t.resetCamera()},O=()=>{var t,i;const a=(t=e.topViewInstance)==null?void 0:t.pointCloudInstance.camera;a&&((i=e.mainViewInstance)==null||i.applyCameraTarget(a))};w(()=>{if(d.current&&(o==null?void 0:o.url)){let t=e.mainViewInstance;if(!t&&c.width){const i={left:-c.width/2,right:c.width/2,top:c.height/2,bottom:-c.height/2,near:100,far:-100};t=new z({container:d.current,isOrthographicCamera:!0,orthographicParams:i,config:r}),e.setMainViewInstance(t)}}},[c]),w(()=>{var t;if(d.current&&(o==null?void 0:o.url)&&o.result&&e.mainViewInstance){let i=e.mainViewInstance;const a=D.getBoxParamsFromResultList(o.result);a.forEach(l=>{var s;const _=(s=N.getColorFromConfig({attribute:l.attribute},ie(T({},r),{attributeConfigurable:!0}),{}))==null?void 0:s.hex;i==null||i.generateBox(l,_)}),e.setPointCloudResult(a),e.setPointCloudValid((t=q(o.result))==null?void 0:t.valid)}},[o,e.mainViewInstance]),w(()=>{var t,i,a,l;if(p){P(C.Top);const s=(a=(i=(t=e.topViewInstance)==null?void 0:t.pointCloudInstance)==null?void 0:i.camera.zoom)!=null?a:1;(l=e.mainViewInstance)==null||l.updateCameraZoom(s)}},[p]),w(()=>{var t,i,a,l;if(v){P(C.Top);const s=(a=(i=(t=e.topViewInstance)==null?void 0:t.pointCloudInstance)==null?void 0:i.camera.zoom)!=null?a:1;(l=e.mainViewInstance)==null||l.updateCameraZoom(s)}},[v]);const B=F(()=>({reset3DView:j,setTarget3DView:P,isActive:!!p,followTopView:O}),[p,e.mainViewInstance]),y=n.createElement(n.Fragment,null,n.createElement(Y,{onChange:t=>{var i;(i=e.mainViewInstance)==null||i.updatePointSize({customSize:t})}}),n.createElement("span",{style:{marginRight:8}},x("ShowArrows")),n.createElement(J,{size:"small",checked:f,onChange:t=>{var i;V(t),(i=e.mainViewInstance)==null||i.setShowDirection(t)}}));return n.createElement(A,{className:m("point-cloud-3d-container"),title:x("3DView"),toolbar:y},n.createElement("div",{className:m("point-cloud-3d-content")},n.createElement(g.Provider,{value:B},n.createElement(ae,null)),n.createElement("div",{className:m("point-cloud-3d-view"),id:re,ref:d})))};var se=Z(U,null,null,{context:X})(le);export{se as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{MathUtils as x,getCuboidFromPointCloudBox as Ot}from"@labelbee/lb-annotation";import{EPerspectiveView as N,PointCloudUtils as D,DEFAULT_SPHERE_PARAMS as Vt}from"@labelbee/lb-utils";import{useContext as Ut}from"react";import{PointCloudContext as kt}from"../PointCloudContext.js";import{useSingleBox as st}from"./useSingleBox.js";import{useSphere as At}from"./useSphere.js";import{useSelector as jt,useDispatch as Tt}from"../../../store/ctx.js";import zt from"../../../utils/StepUtils.js";import{jsonParser as rt}from"../../../utils/index.js";import{SetPointCloudLoading as dt}from"../../../store/annotation/actionCreators.js";import{message as Rt}from"antd";import{useTranslation as Et}from"react-i18next";import{useHistory as Ht}from"./useHistory.js";import{usePolygon as Ft}from"./usePolygon.js";var Nt=Object.defineProperty,Zt=Object.defineProperties,Wt=Object.getOwnPropertyDescriptors,lt=Object.getOwnPropertySymbols,Mt=Object.prototype.hasOwnProperty,Gt=Object.prototype.propertyIsEnumerable,at=(t,e,n)=>e in t?Nt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,y=(t,e)=>{for(var n in e||(e={}))Mt.call(e,n)&&at(t,n,e[n]);if(lt)for(var n of lt(e))Gt.call(e,n)&&at(t,n,e[n]);return t},A=(t,e)=>Zt(t,Wt(e)),q=(t,e,n)=>new Promise((d,o)=>{var a=l=>{try{r(n.next(l))}catch(P){o(P)}},p=l=>{try{r(n.throw(l))}catch(P){o(P)}},r=l=>l.done?d(l.value):Promise.resolve(l.value).then(a,p);r((n=n.apply(t,e)).next())});const G=5,Q=90,L={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},J=(t,e,n,d,o)=>{const{x:a,y:p}=D.transferCanvas2World(t,e),{defaultZ:r}=Vt,l={center:{x:a,y:p,z:r},id:t.id},P=d?y(y({},d),l):A(y({},l),{attribute:"",valid:!0});return o&&Object.assign(P,o),P},K=(t,e,n,d,o,a)=>{let p=t.pointList.map(m=>D.transferCanvas2World(m,e)),r=0,l=1,P={};if(n){const m=n.getSensesPointZAxisInPolygon(p,void 0,a);a&&m.fittedCoordinates.length>0&&(p=m.fittedCoordinates),r=(m.maxZ+m.minZ)/2,l=m.maxZ-m.minZ,P={count:m.zCount}}const[h,B,j]=p,V=x.getLineCenterPoint([h,j]),T=x.getLineLength(h,B),z=x.getLineLength(B,j),R=x.getRadiusFromQuadrangle(t.pointList);d&&(r=d.center.z,l=d.depth);const U={center:{x:V.x,y:V.y,z:r},width:z,height:T,depth:l,rotation:R,id:t.id},_=y(d?y(y({},d),U):A(y({},U),{attribute:"",valid:!0}),P);o&&Object.assign(_,o);const E=p.map(m=>D.transferWorld2Canvas(m,e));return{boxParams:_,newPointList:E}},ct=(t,e,n)=>{const d={x:t.x-e.x,y:t.y-e.y};return A(y({},n),{center:{x:n.center.x-d.x,y:n.center.y,z:n.center.z-d.y}})},ut=(t,e,n,d)=>{const[o,a,p]=t.pointList,[r,l,P]=e.pointList,h=x.getLineCenterPoint([o,p]),B=x.getLineCenterPoint([r,P]),V={x:{x:h.x-B.x,y:h.y-B.y}.x,y:0,z:h.y-B.y},T=x.getLineLength(o,a),z=x.getLineLength(r,l),R=T-z,U=x.getLineLength(a,p),_=x.getLineLength(l,P),E=U-_,{newBoxParams:m}=d.getNewBoxBySideUpdate(V,E,R,n);return m},Qt=(t,e,n)=>{const d={x:t.x-e.x,y:t.y-e.y};return A(y({},n),{center:{x:n.center.x,y:n.center.y-d.x,z:n.center.z-d.y}})},Xt=(t,e,n,d)=>{const[o,a,p]=t.pointList,[r,l,P]=e.pointList,h=x.getLineCenterPoint([o,p]),B=x.getLineCenterPoint([r,P]),V={x:{x:h.x-B.x,y:h.y-B.y}.x,y:0,z:h.y-B.y},T=x.getLineLength(o,a),z=x.getLineLength(r,l),R=T-z,U=x.getLineLength(a,p),_=x.getLineLength(l,P),E=U-_;let{newBoxParams:m}=d.getNewBoxByBackUpdate(V,E,R,n);return m},pt=(t,e,n,d,o)=>{var a;if(!n)return;const{toolInstance:p,pointCloudInstance:r}=n;r.loadPCDFile(d,(a=o==null?void 0:o.radius)!=null?a:Q);const{cameraPositionVector:l}=r.updateOrthoCameraBySphere(t,N.Left);r.setInitCameraPosition(l);const{point2d:P,zoom:h}=r.getSphereSidePoint2DCoordinate(t);r.camera.zoom=h,r.camera.updateProjectionMatrix(),r.render(),p.initPosition(),p.zoomChangeOnCenter(h),p.setResult([A(y(y({},e),P),{valid:t.valid,textAttribute:"",attribute:t.attribute})]),p.setSelectedID(e.id)},ft=(t,e,n,d)=>{if(!n)return;const{pointCloud2dOperation:o,pointCloudInstance:a}=n;a.loadPCDFileByBox(d,t,{width:G,depth:G});const{cameraPositionVector:p}=a.updateOrthoCamera(t,N.Left);a.setInitCameraPosition(p);const{polygon2d:r,zoom:l}=a.getBoxSidePolygon2DCoordinate(t);a.camera.zoom=l,a.camera.updateProjectionMatrix(),a.render(),o.initPosition(),o.zoomChangeOnCenter(l),o.setResultAndSelectedID([{id:e.id,valid:t.valid,pointList:r,textAttribute:"",isRect:!0,attribute:t.attribute}],e.id)},Ct=(t,e,n,d,o)=>{var a;if(!n)return;const{toolInstance:p,pointCloudInstance:r}=n;r.loadPCDFile(d,(a=o==null?void 0:o.radius)!=null?a:Q);const{cameraPositionVector:l}=r.updateOrthoCameraBySphere(t,N.Back);r.setInitCameraPosition(l);const{point2d:P,zoom:h}=r.getSphereBackPoint2DCoordinate(t);r.camera.zoom=h,r.camera.updateProjectionMatrix(),r.render(),p.initPosition(),p.zoomChangeOnCenter(h),p.setResult([A(y(y({},e),P),{valid:t.valid,textAttribute:"",attribute:t.attribute})]),p.setSelectedID(e.id)},Pt=(t,e,n,d)=>{if(!n)return;const{pointCloud2dOperation:o,pointCloudInstance:a}=n;a.loadPCDFileByBox(d,t,{height:G,depth:G});const{cameraPositionVector:p}=a.updateOrthoCamera(t,N.Back);a.setInitCameraPosition(p);const{polygon2d:r,zoom:l}=a.getBoxBackPolygon2DCoordinate(t);a.camera.zoom=l,a.camera.updateProjectionMatrix(),a.render(),o.initPosition(),o.zoomChangeOnCenter(l),o.setResultAndSelectedID([{id:e.id,valid:t.valid,pointList:r,textAttribute:"",isRect:!0,attribute:t.attribute}],e.id)},gt=(t,e,n,d)=>{if(!n||!d)return;d.generateSphere(t),d.updateCameraBySphere(t,N.Top),d.render();const{toolInstance:o,pointCloudInstance:a}=n,{point2d:p}=a.getSphereTopPoint2DCoordinate(t),r=[...o.pointList].map(l=>l.id===e.id?A(y(y({},e),p),{valid:t.valid,textAttribute:"",attribute:t.attribute}):l);o.setResult(r),o.setSelectedID(e.id)},$=(t,e,n,d)=>{var o;if(!n||!d)return;d.generateBox(t,e.id),d.render();const{pointCloud2dOperation:a,pointCloudInstance:p}=n,{polygon2d:r}=p.getBoxTopPolygon2DCoordinate(t),l=[...a.polygonList],P=l.find(h=>h.id===e.id);P?P.pointList=r:l.push({id:e.id,pointList:r,textAttribute:"",isRect:!0,valid:(o=t.valid)!=null?o:!0}),a.setResultAndSelectedID(l,e.id)},Yt=()=>{const t=Ut(kt),{topViewInstance:e,sideViewInstance:n,backViewInstance:d,mainViewInstance:o,addPointCloudBox:a,addPointCloudSphere:p,setSelectedIDs:r,selectedIDs:l,pointCloudBoxList:P,pointCloudSphereList:h,hideAttributes:B}=t,{addHistory:j,initHistory:V,pushHistoryUnderUpdatePolygon:T,pushHistoryUnderUpdateLine:z}=Ht(),{selectedPolygon:R}=Ft(),{updateSelectedBox:U,updateSelectedBoxes:_,getPointCloudByID:E}=st(),{getPointCloudSphereByID:m,updatePointCloudSphere:tt,selectedSphere:Z}=At(),{currentData:F,config:S}=jt(i=>{const{stepList:s,step:f,imgList:c,imgIndex:u}=i.annotation;return{currentData:c[u],config:rt(zt.getCurrentStepInfo(f,s).config)}}),ot=Tt(),{selectedBox:H}=st(),{t:ht}=Et(),et=H==null?void 0:H.info;if(!e||!n||!d)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:X}=e,Lt=i=>{o==null||o.generateBox(i),o==null||o.controls.update(),o==null||o.render()},yt=i=>{o==null||o.generateSphere(i),o==null||o.controls.update(),o==null||o.render()},mt=({newPoint:i,size:s,zoom:f,trackConfigurable:c})=>{var u;const C={attribute:(u=e.toolInstance.defaultAttribute)!=null?u:""};c===!0&&Object.assign(C,{trackID:D.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:h})});const g=J(i,s,X,void 0,C);r(i.id);const v=p(g);W(L.Top,i,g,f,v,S),j({newSphereParams:g})},vt=({polygon:i,size:s,imgList:f,trackConfigurable:c,zoom:u,intelligentFit:C})=>{var g;const v={attribute:(g=e.toolInstance.defaultAttribute)!=null?g:""};c===!0&&Object.assign(v,{trackID:D.getNextTrackID({imgList:[],extraBoxList:P,extraSphereList:h})});const w=e==null?void 0:e.toolInstance,O=y({},i),{boxParams:b,newPointList:k}=K(O,s,X,void 0,v,C);if((S==null?void 0:S.lowerLimitPointsNumInBox)&&typeof b.count=="number"&&b.count<S.lowerLimitPointsNumInBox){Rt.info(ht("LowerLimitPointsNumInBox",{num:S.lowerLimitPointsNumInBox})),w.deletePolygon(b.id);return}C&&(k==null?void 0:k.length)&&(O.pointList=k);const Y=B.includes(O.attribute),I=a(b);e==null||e.updatePolygonList(I!=null?I:[]),Y?r([]):(r(b.id),w.selection.setSelectedIDs(O.id),M(L.Top,O,b,u,I),C&&$(b,O,e,o)),j({newBoxParams:b})},xt=({newSelectedBox:i,newPointCloudList:s,newSelectedSphere:f,newSphereList:c})=>{var u;const C=e==null?void 0:e.toolInstance;if(!(l.length===0||!C)){if(i||(H==null?void 0:H.info)){const g=i!=null?i:H==null?void 0:H.info;(u=C==null?void 0:C.selection)==null||u.setSelectedIDs(l[0]);const v=C.selectedPolygon;if(l.length===1&&g){M(L.Top,v,g,void 0,s);return}}if((f||Z)&&l.length===1){const g=f!=null?f:Z;C.setSelectedID(l[0]);const v=C.selectedPoint;g&&W(L.Top,v,g,void 0,c,S)}}},nt=(i,s,f)=>{if(et){let c,u;switch(f){case L.Back:c=Xt;break;case L.Side:c=ut;break;default:c=ut;break}if(u=c(i,s,et,n.pointCloudInstance),o){const{count:g}=o.getSensesPointZAxisInPolygon(Ot(u).polygonPointList,[u.center.z-u.depth/2,u.center.z+u.depth/2]);u=A(y({},u),{count:g})}const C=U(u);return M(f,i,u,void 0,C),C}},it=(i,s,f)=>{if(Z){let c,u;switch(f){case L.Back:c=Qt;break;case L.Side:c=ct;break;default:c=ct;break}u=c(i,s,Z);const C=tt(u);return W(f,i,u,void 0,C,S),C}},Bt=(i,s)=>{it(i,s,L.Side)},St=(i,s)=>{it(i,s,L.Back)},bt=(i,s)=>{nt(i,s,L.Side)},wt=(i,s)=>{nt(i,s,L.Back)},It=(i,s)=>{z(i)},Dt=(i,s)=>{const f=m(i.id),c=J(i,s,X,f),u=tt(c);W(L.Top,i,c,void 0,u,S)},_t=(i,s)=>{if(R){const c=i[0].newPolygon;c.pointList=c.pointList.map(u=>D.transferCanvas2World(u,s)),T(i[0].newPolygon);return}const f=i.map(({newPolygon:c})=>{const u=E(c.id),{boxParams:C}=K(c,s,e.pointCloudInstance,u);return C});if(f.length===1){const{newPolygon:c}=i[0],u=_(f);M(L.Top,c,f[0],void 0,u)}else{const c=_(f);c&&t.syncAllViewPointCloudColor(c)}},W=(i,s,f,c,u,C)=>q(void 0,null,function*(){const g=F==null?void 0:F.url,v={[L.Side]:()=>{pt(f,s,n,g,C)},[L.Back]:()=>{d&&Ct(f,s,d,g,C)},[L.Top]:()=>{gt(f,s,e,o)}};Object.keys(v).forEach(w=>{w!==i&&v[w]()}),c&&(o==null||o.updateCameraZoom(c)),yt(f)}),M=(i,s,f,c,u)=>q(void 0,null,function*(){const C=F==null?void 0:F.url;u&&(yield t.syncAllViewPointCloudColor(u));const g={[L.Side]:()=>{ft(f,s,n,C)},[L.Back]:()=>{d&&Pt(f,s,d,C)},[L.Top]:()=>{$(f,s,e,o)}};Object.keys(g).forEach(v=>{v!==i&&g[v]()}),c&&(o==null||o.updateCameraZoom(c)),Lt(f)});return{topViewAddSphere:mt,topViewAddBox:vt,topViewSelectedChanged:xt,topViewUpdatePoint:Dt,sideViewUpdatePoint:Bt,backViewUpdatePoint:St,topViewUpdateBox:_t,topViewUpdateLine:It,sideViewUpdateBox:bt,backViewUpdateBox:wt,pointCloudBoxListUpdated:i=>{e.updatePolygonList(i),o==null||o.generateBoxes(i)},initPointCloud3d:i=>{if(!o)return;const s={left:-i.width/2,right:i.width/2,top:i.height/2,bottom:-i.height/2,near:100,far:-100};o.initOrthographicCamera(s),o.initRenderer(),o.render()},updatePointCloudData:(...i)=>q(void 0,[...i],function*(s=F){var f,c,u,C,g,v;if(!(s==null?void 0:s.url)||!o)return;dt(ot,!0),yield o.loadPCDFile(s.url,(f=S==null?void 0:S.radius)!=null?f:Q),P.forEach(I=>{o==null||o.removeObjectByName(I.id)}),h.forEach(I=>{o==null||o.removeObjectByName(I.id)});let w=[],O=[],b=[],k=[];s.result?(w=D.getBoxParamsFromResultList(s.result),b=D.getPolygonListFromResultList(s.result),O=D.getLineListFromResultList(s.result),k=D.getSphereParamsFromResultList(s.result),w.forEach(I=>{o==null||o.generateBox(I)}),k.forEach(I=>{o==null||o.generateSphere(I)}),t.syncAllViewPointCloudColor(w),t.setPointCloudResult(w),t.setPolygonList(b),t.setLineList(O),t.setPointCloudSphereList(k)):(t.setPointCloudResult([]),t.setPolygonList([]),t.setPointCloudSphereList([]),t.setLineList([])),V({pointCloudBoxList:w,polygonList:b,pointCloudSphereList:k}),o.updateTopCamera();const Y=(u=(c=rt(s.result))==null?void 0:c.valid)!=null?u:!0;t.setPointCloudValid(Y),(C=t.sideViewInstance)==null||C.clearAllData(),(g=t.backViewInstance)==null||g.clearAllData(),e.updateData(s.url,s.result,{radius:(v=S==null?void 0:S.radius)!=null?v:Q}),dt(ot,!1)})}};export{Ct as syncBackViewByPoint,pt as syncSideViewByPoint,gt as syncTopViewByPoint,Pt as synchronizeBackView,ft as synchronizeSideView,$ as synchronizeTopView,J as topViewPoint2PointCloud,K as topViewPolygon2PointCloud,Yt as usePointCloudViews};
|
|
1
|
+
import{MathUtils as x,getCuboidFromPointCloudBox as Ut}from"@labelbee/lb-annotation";import{EPerspectiveView as Z,PointCloudUtils as D,DEFAULT_SPHERE_PARAMS as kt}from"@labelbee/lb-utils";import{useContext as At}from"react";import{PointCloudContext as jt}from"../PointCloudContext.js";import{useSingleBox as rt}from"./useSingleBox.js";import{useSphere as Tt}from"./useSphere.js";import{useSelector as zt,useDispatch as Rt}from"../../../store/ctx.js";import Et from"../../../utils/StepUtils.js";import{jsonParser as lt}from"../../../utils/index.js";import{SetPointCloudLoading as dt}from"../../../store/annotation/actionCreators.js";import{message as Ht}from"antd";import{useTranslation as Ft}from"react-i18next";import{useHistory as Nt}from"./useHistory.js";import{usePolygon as Zt}from"./usePolygon.js";var Wt=Object.defineProperty,Mt=Object.defineProperties,Gt=Object.getOwnPropertyDescriptors,at=Object.getOwnPropertySymbols,Qt=Object.prototype.hasOwnProperty,Xt=Object.prototype.propertyIsEnumerable,ct=(t,e,n)=>e in t?Wt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,y=(t,e)=>{for(var n in e||(e={}))Qt.call(e,n)&&ct(t,n,e[n]);if(at)for(var n of at(e))Xt.call(e,n)&&ct(t,n,e[n]);return t},k=(t,e)=>Mt(t,Gt(e)),J=(t,e,n)=>new Promise((l,o)=>{var a=d=>{try{r(n.next(d))}catch(g){o(g)}},p=d=>{try{r(n.throw(d))}catch(g){o(g)}},r=d=>d.done?l(d.value):Promise.resolve(d.value).then(a,p);r((n=n.apply(t,e)).next())});const Q=5,X=90,L={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},K=(t,e,n,l,o)=>{const{x:a,y:p}=D.transferCanvas2World(t,e),{defaultZ:r}=kt,d={center:{x:a,y:p,z:r},id:t.id},g=l?y(y({},l),d):k(y({},d),{attribute:"",valid:!0});return o&&Object.assign(g,o),g},$=(t,e,n,l,o,a)=>{let p=t.pointList.map(m=>D.transferCanvas2World(m,e)),r=0,d=1,g={};if(n){const m=n.getSensesPointZAxisInPolygon(p,void 0,a);a&&m.fittedCoordinates.length>0&&(p=m.fittedCoordinates),r=(m.maxZ+m.minZ)/2,d=m.maxZ-m.minZ,g={count:m.zCount}}const[h,S,A]=p,V=x.getLineCenterPoint([h,A]),j=x.getLineLength(h,S),T=x.getLineLength(S,A),z=x.getRadiusFromQuadrangle(t.pointList);l&&(r=l.center.z,d=l.depth);const U={center:{x:V.x,y:V.y,z:r},width:T,height:j,depth:d,rotation:z,id:t.id},_=y(l?y(y({},l),U):k(y({},U),{attribute:"",valid:!0}),g);o&&Object.assign(_,o);const R=p.map(m=>D.transferWorld2Canvas(m,e));return{boxParams:_,newPointList:R}},ut=(t,e,n)=>{const l={x:t.x-e.x,y:t.y-e.y};return k(y({},n),{center:{x:n.center.x-l.x,y:n.center.y,z:n.center.z-l.y}})},pt=(t,e,n,l)=>{const[o,a,p]=t.pointList,[r,d,g]=e.pointList,h=x.getLineCenterPoint([o,p]),S=x.getLineCenterPoint([r,g]),V={x:{x:h.x-S.x,y:h.y-S.y}.x,y:0,z:h.y-S.y},j=x.getLineLength(o,a),T=x.getLineLength(r,d),z=j-T,U=x.getLineLength(a,p),_=x.getLineLength(d,g),R=U-_,{newBoxParams:m}=l.getNewBoxBySideUpdate(V,R,z,n);return m},Yt=(t,e,n)=>{const l={x:t.x-e.x,y:t.y-e.y};return k(y({},n),{center:{x:n.center.x,y:n.center.y-l.x,z:n.center.z-l.y}})},qt=(t,e,n,l)=>{const[o,a,p]=t.pointList,[r,d,g]=e.pointList,h=x.getLineCenterPoint([o,p]),S=x.getLineCenterPoint([r,g]),V={x:{x:h.x-S.x,y:h.y-S.y}.x,y:0,z:h.y-S.y},j=x.getLineLength(o,a),T=x.getLineLength(r,d),z=j-T,U=x.getLineLength(a,p),_=x.getLineLength(d,g),R=U-_;let{newBoxParams:m}=l.getNewBoxByBackUpdate(V,R,z,n);return m},ft=(t,e,n,l,o)=>{var a;if(!n)return;const{toolInstance:p,pointCloudInstance:r}=n;r.loadPCDFile(l,(a=o==null?void 0:o.radius)!=null?a:X);const{cameraPositionVector:d}=r.updateOrthoCameraBySphere(t,Z.Left);r.setInitCameraPosition(d);const{point2d:g,zoom:h}=r.getSphereSidePoint2DCoordinate(t);r.camera.zoom=h,r.camera.updateProjectionMatrix(),r.render(),p.initPosition(),p.zoomChangeOnCenter(h),p.setResult([k(y(y({},e),g),{valid:t.valid,textAttribute:"",attribute:t.attribute})]),p.setSelectedID(e.id)},Ct=(t,e,n,l)=>{if(!n)return;const{pointCloud2dOperation:o,pointCloudInstance:a}=n;a.loadPCDFileByBox(l,t,{width:Q,depth:Q});const{cameraPositionVector:p}=a.updateOrthoCamera(t,Z.Left);a.setInitCameraPosition(p);const{polygon2d:r,zoom:d}=a.getBoxSidePolygon2DCoordinate(t);a.camera.zoom=d,a.camera.updateProjectionMatrix(),a.render(),o.initPosition(),o.zoomChangeOnCenter(d),o.setResultAndSelectedID([{id:e.id,valid:t.valid,pointList:r,textAttribute:"",isRect:!0,attribute:t.attribute}],e.id)},gt=(t,e,n,l,o)=>{var a;if(!n)return;const{toolInstance:p,pointCloudInstance:r}=n;r.loadPCDFile(l,(a=o==null?void 0:o.radius)!=null?a:X);const{cameraPositionVector:d}=r.updateOrthoCameraBySphere(t,Z.Back);r.setInitCameraPosition(d);const{point2d:g,zoom:h}=r.getSphereBackPoint2DCoordinate(t);r.camera.zoom=h,r.camera.updateProjectionMatrix(),r.render(),p.initPosition(),p.zoomChangeOnCenter(h),p.setResult([k(y(y({},e),g),{valid:t.valid,textAttribute:"",attribute:t.attribute})]),p.setSelectedID(e.id)},Pt=(t,e,n,l)=>{if(!n)return;const{pointCloud2dOperation:o,pointCloudInstance:a}=n;a.loadPCDFileByBox(l,t,{height:Q,depth:Q});const{cameraPositionVector:p}=a.updateOrthoCamera(t,Z.Back);a.setInitCameraPosition(p);const{polygon2d:r,zoom:d}=a.getBoxBackPolygon2DCoordinate(t);a.camera.zoom=d,a.camera.updateProjectionMatrix(),a.render(),o.initPosition(),o.zoomChangeOnCenter(d),o.setResultAndSelectedID([{id:e.id,valid:t.valid,pointList:r,textAttribute:"",isRect:!0,attribute:t.attribute}],e.id)},ht=(t,e,n,l)=>{if(!n||!l)return;l.generateSphere(t),l.updateCameraBySphere(t,Z.Top),l.render();const{toolInstance:o,pointCloudInstance:a}=n,{point2d:p}=a.getSphereTopPoint2DCoordinate(t),r=[...o.pointList].map(d=>d.id===e.id?k(y(y({},e),p),{valid:t.valid,textAttribute:"",attribute:t.attribute}):d);o.setResult(r),o.setSelectedID(e.id)},tt=(t,e,n,l)=>{var o;if(!n||!l)return;l.generateBox(t,e.id),l.render();const{pointCloud2dOperation:a,pointCloudInstance:p}=n,{polygon2d:r}=p.getBoxTopPolygon2DCoordinate(t),d=[...a.polygonList],g=d.find(h=>h.id===e.id);g?g.pointList=r:d.push({id:e.id,pointList:r,textAttribute:"",isRect:!0,valid:(o=t.valid)!=null?o:!0}),a.setResultAndSelectedID(d,e.id)},Jt=()=>{const t=At(jt),{topViewInstance:e,sideViewInstance:n,backViewInstance:l,mainViewInstance:o,addPointCloudBox:a,addPointCloudSphere:p,setSelectedIDs:r,selectedIDs:d,pointCloudBoxList:g,pointCloudSphereList:h,hideAttributes:S}=t,{addHistory:A,initHistory:V,pushHistoryUnderUpdatePolygon:j,pushHistoryUnderUpdateLine:T}=Nt(),{selectedPolygon:z}=Zt(),{updateSelectedBox:U,updateSelectedBoxes:_,getPointCloudByID:R}=rt(),{getPointCloudSphereByID:m,updatePointCloudSphere:ot,selectedSphere:W}=Tt(),{currentData:H,config:b}=zt(i=>{const{stepList:s,step:f,imgList:c,imgIndex:u}=i.annotation;return{currentData:c[u],config:lt(Et.getCurrentStepInfo(f,s).config)}}),et=Rt(),{selectedBox:E}=rt(),{t:Lt}=Ft(),nt=E==null?void 0:E.info;if(!e||!n||!l)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:Y}=e,yt=i=>{o==null||o.generateBox(i),o==null||o.controls.update(),o==null||o.render()},mt=i=>{o==null||o.generateSphere(i),o==null||o.controls.update(),o==null||o.render()},vt=({newPoint:i,size:s,zoom:f,trackConfigurable:c})=>{var u;const C={attribute:(u=e.toolInstance.defaultAttribute)!=null?u:""};c===!0&&Object.assign(C,{trackID:D.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:h})});const P=K(i,s,Y,void 0,C);r(i.id);const v=p(P);M(L.Top,i,P,f,v,b),A({newSphereParams:P})},xt=({polygon:i,size:s,imgList:f,trackConfigurable:c,zoom:u,intelligentFit:C})=>{var P,v;const w={attribute:(P=e.toolInstance.defaultAttribute)!=null?P:""};c===!0&&Object.assign(w,{trackID:D.getNextTrackID({imgList:[],extraBoxList:g,extraSphereList:h})});const F=e==null?void 0:e.toolInstance,I=y({},i),{boxParams:B,newPointList:N}=$(I,s,Y,void 0,w,C);if((b==null?void 0:b.lowerLimitPointsNumInBox)&&typeof B.count=="number"&&B.count<b.lowerLimitPointsNumInBox){Ht.info(Lt("LowerLimitPointsNumInBox",{num:b.lowerLimitPointsNumInBox})),F.deletePolygon(B.id);return}C&&(N==null?void 0:N.length)&&(I.pointList=N);const O=S.includes(I.attribute),q=a(B),Vt=(v=t==null?void 0:t.polygonList)!=null?v:[];e==null||e.updatePolygonList(q!=null?q:[],Vt),O?r([]):(r(B.id),F.selection.setSelectedIDs(I.id),G(L.Top,I,B,u,q),C&&tt(B,I,e,o)),A({newBoxParams:B})},Bt=({newSelectedBox:i,newPointCloudList:s,newSelectedSphere:f,newSphereList:c})=>{var u;const C=e==null?void 0:e.toolInstance;if(!(d.length===0||!C)){if(i||(E==null?void 0:E.info)){const P=i!=null?i:E==null?void 0:E.info;(u=C==null?void 0:C.selection)==null||u.setSelectedIDs(d[0]);const v=C.selectedPolygon;if(d.length===1&&P){G(L.Top,v,P,void 0,s);return}}if((f||W)&&d.length===1){const P=f!=null?f:W;C.setSelectedID(d[0]);const v=C.selectedPoint;P&&M(L.Top,v,P,void 0,c,b)}}},it=(i,s,f)=>{if(nt){let c,u;switch(f){case L.Back:c=qt;break;case L.Side:c=pt;break;default:c=pt;break}if(u=c(i,s,nt,n.pointCloudInstance),o){const{count:P}=o.getSensesPointZAxisInPolygon(Ut(u).polygonPointList,[u.center.z-u.depth/2,u.center.z+u.depth/2]);u=k(y({},u),{count:P})}const C=U(u);return G(f,i,u,void 0,C),C}},st=(i,s,f)=>{if(W){let c,u;switch(f){case L.Back:c=Yt;break;case L.Side:c=ut;break;default:c=ut;break}u=c(i,s,W);const C=ot(u);return M(f,i,u,void 0,C,b),C}},St=(i,s)=>{st(i,s,L.Side)},bt=(i,s)=>{st(i,s,L.Back)},wt=(i,s)=>{it(i,s,L.Side)},It=(i,s)=>{it(i,s,L.Back)},Dt=(i,s)=>{T(i)},_t=(i,s)=>{const f=m(i.id),c=K(i,s,Y,f),u=ot(c);M(L.Top,i,c,void 0,u,b)},Ot=(i,s)=>{if(z){const c=i[0].newPolygon;c.pointList=c.pointList.map(u=>D.transferCanvas2World(u,s)),j(i[0].newPolygon);return}const f=i.map(({newPolygon:c})=>{const u=R(c.id),{boxParams:C}=$(c,s,e.pointCloudInstance,u);return C});if(f.length===1){const{newPolygon:c}=i[0],u=_(f);G(L.Top,c,f[0],void 0,u)}else{const c=_(f);c&&t.syncAllViewPointCloudColor(c)}},M=(i,s,f,c,u,C)=>J(void 0,null,function*(){const P=H==null?void 0:H.url,v={[L.Side]:()=>{ft(f,s,n,P,C)},[L.Back]:()=>{l&>(f,s,l,P,C)},[L.Top]:()=>{ht(f,s,e,o)}};Object.keys(v).forEach(w=>{w!==i&&v[w]()}),c&&(o==null||o.updateCameraZoom(c)),mt(f)}),G=(i,s,f,c,u)=>J(void 0,null,function*(){const C=H==null?void 0:H.url;u&&(yield t.syncAllViewPointCloudColor(u));const P={[L.Side]:()=>{Ct(f,s,n,C)},[L.Back]:()=>{l&&Pt(f,s,l,C)},[L.Top]:()=>{tt(f,s,e,o)}};Object.keys(P).forEach(v=>{v!==i&&P[v]()}),c&&(o==null||o.updateCameraZoom(c)),yt(f)});return{topViewAddSphere:vt,topViewAddBox:xt,topViewSelectedChanged:Bt,topViewUpdatePoint:_t,sideViewUpdatePoint:St,backViewUpdatePoint:bt,topViewUpdateBox:Ot,topViewUpdateLine:Dt,sideViewUpdateBox:wt,backViewUpdateBox:It,pointCloudBoxListUpdated:i=>{e.updatePolygonList(i),o==null||o.generateBoxes(i)},initPointCloud3d:i=>{if(!o)return;const s={left:-i.width/2,right:i.width/2,top:i.height/2,bottom:-i.height/2,near:100,far:-100};o.initOrthographicCamera(s),o.initRenderer(),o.render()},updatePointCloudData:(...i)=>J(void 0,[...i],function*(s=H){var f,c,u,C,P,v;if(!(s==null?void 0:s.url)||!o)return;dt(et,!0),yield o.loadPCDFile(s.url,(f=b==null?void 0:b.radius)!=null?f:X),g.forEach(O=>{o==null||o.removeObjectByName(O.id)}),h.forEach(O=>{o==null||o.removeObjectByName(O.id)});let w=[],F=[],I=[],B=[];s.result?(w=D.getBoxParamsFromResultList(s.result),I=D.getPolygonListFromResultList(s.result),F=D.getLineListFromResultList(s.result),B=D.getSphereParamsFromResultList(s.result),w.forEach(O=>{o==null||o.generateBox(O)}),B.forEach(O=>{o==null||o.generateSphere(O)}),t.syncAllViewPointCloudColor(w),t.setPointCloudResult(w),t.setPolygonList(I),t.setLineList(F),t.setPointCloudSphereList(B)):(t.setPointCloudResult([]),t.setPolygonList([]),t.setPointCloudSphereList([]),t.setLineList([])),V({pointCloudBoxList:w,polygonList:I,pointCloudSphereList:B}),o.updateTopCamera();const N=(u=(c=lt(s.result))==null?void 0:c.valid)!=null?u:!0;t.setPointCloudValid(N),(C=t.sideViewInstance)==null||C.clearAllData(),(P=t.backViewInstance)==null||P.clearAllData(),e.updateData(s.url,s.result,{radius:(v=b==null?void 0:b.radius)!=null?v:X}),dt(et,!1)})}};export{gt as syncBackViewByPoint,ft as syncSideViewByPoint,ht as syncTopViewByPoint,Pt as synchronizeBackView,Ct as synchronizeSideView,tt as synchronizeTopView,K as topViewPoint2PointCloud,$ as topViewPolygon2PointCloud,Jt as usePointCloudViews};
|
package/es/index.css
CHANGED
|
@@ -1276,6 +1276,7 @@
|
|
|
1276
1276
|
width: 24px;
|
|
1277
1277
|
background-repeat: no-repeat;
|
|
1278
1278
|
cursor: pointer;
|
|
1279
|
+
flex: none;
|
|
1279
1280
|
margin-right: 16px;
|
|
1280
1281
|
background-image: url("../dist/assets/icons/7eadb9c4.svg");
|
|
1281
1282
|
transform: rotateY(180deg);
|
|
@@ -1286,6 +1287,7 @@
|
|
|
1286
1287
|
width: 24px;
|
|
1287
1288
|
background-repeat: no-repeat;
|
|
1288
1289
|
cursor: pointer;
|
|
1290
|
+
flex: none;
|
|
1289
1291
|
margin-right: 16px;
|
|
1290
1292
|
background-image: url("../dist/assets/icons/7eadb9c4.svg");
|
|
1291
1293
|
}
|
|
@@ -1295,6 +1297,7 @@
|
|
|
1295
1297
|
width: 24px;
|
|
1296
1298
|
background-repeat: no-repeat;
|
|
1297
1299
|
cursor: pointer;
|
|
1300
|
+
flex: none;
|
|
1298
1301
|
background-image: url("../dist/assets/icons/9d70807.svg");
|
|
1299
1302
|
}
|
|
1300
1303
|
.bee-point-cloud-wrapper .bee-point-cloud-container__header-toolbar .bee-point-cloud__next {
|
|
@@ -1345,7 +1348,7 @@
|
|
|
1345
1348
|
display: flex;
|
|
1346
1349
|
flex-direction: column;
|
|
1347
1350
|
overflow: hidden;
|
|
1348
|
-
|
|
1351
|
+
flex: 1;
|
|
1349
1352
|
}
|
|
1350
1353
|
.bee-point-cloud-wrapper .bee-point-cloud-container__left .bee-point-cloud-3d-container .bee-point-cloud-3d-content {
|
|
1351
1354
|
display: flex;
|
|
@@ -1360,7 +1363,11 @@
|
|
|
1360
1363
|
box-sizing: content-box;
|
|
1361
1364
|
display: flex;
|
|
1362
1365
|
flex-direction: column;
|
|
1363
|
-
justify-content: flex-
|
|
1366
|
+
justify-content: flex-start;
|
|
1367
|
+
overflow-y: scroll;
|
|
1368
|
+
}
|
|
1369
|
+
.bee-point-cloud-wrapper .bee-point-cloud-container__left .bee-point-cloud-3d-container .bee-point-cloud-3d-content .bee-point-cloud-3d-sidebar::-webkit-scrollbar {
|
|
1370
|
+
display: none;
|
|
1364
1371
|
}
|
|
1365
1372
|
.bee-point-cloud-wrapper .bee-point-cloud-container__left .bee-point-cloud-3d-container .bee-point-cloud-3d-content .bee-point-cloud-3d-sidebar .bee-point-cloud-3d-view__reset, .bee-point-cloud-wrapper .bee-point-cloud-container__left .bee-point-cloud-3d-container .bee-point-cloud-3d-content .bee-point-cloud-3d-sidebar .bee-point-cloud-3d-view__followTop {
|
|
1366
1373
|
display: inline-block;
|
|
@@ -1368,6 +1375,7 @@
|
|
|
1368
1375
|
width: 36px;
|
|
1369
1376
|
background-repeat: no-repeat;
|
|
1370
1377
|
cursor: pointer;
|
|
1378
|
+
flex: none;
|
|
1371
1379
|
font-size: 36px;
|
|
1372
1380
|
background-position: center;
|
|
1373
1381
|
background-color: #444;
|
|
@@ -1388,6 +1396,7 @@
|
|
|
1388
1396
|
width: 36px;
|
|
1389
1397
|
background-repeat: no-repeat;
|
|
1390
1398
|
cursor: pointer;
|
|
1399
|
+
flex: none;
|
|
1391
1400
|
background-image: url("../dist/assets/icons/c5b4262e.png");
|
|
1392
1401
|
margin-bottom: 8px;
|
|
1393
1402
|
}
|
package/es/views/MainView/sidebar/PointCloudToolSidebar/components/batchUpdateModal/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{BatchUpdateTrackID as k}from"../../../../../../store/annotation/actionCreators.js";import{composeResultByToolInstance as
|
|
1
|
+
import{BatchUpdateTrackID as k}from"../../../../../../store/annotation/actionCreators.js";import{composeResultByToolInstance as C}from"../../../../../../store/annotation/reducer.js";import{LabelBeeContext as O,useDispatch as T}from"../../../../../../store/ctx.js";import{Form as s,Modal as L,InputNumber as c,message as v}from"antd";import r,{useState as U}from"react";import{useTranslation as B}from"react-i18next";import{connect as j}from"react-redux";import{PointCloudUtils as F}from"@labelbee/lb-utils";var S=Object.defineProperty,N=Object.defineProperties,R=Object.getOwnPropertyDescriptors,d=Object.getOwnPropertySymbols,A=Object.prototype.hasOwnProperty,M=Object.prototype.propertyIsEnumerable,I=(e,t,n)=>t in e?S(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,q=(e,t)=>{for(var n in t||(t={}))A.call(t,n)&&I(e,n,t[n]);if(d)for(var n of d(t))M.call(t,n)&&I(e,n,t[n]);return e},V=(e,t)=>N(e,R(t));const $={labelCol:{span:8},wrapperCol:{span:16}},m={width:"80px"},z=({id:e,stepList:t,imgList:n,imgIndex:g,toolInstance:f,updateCurrentPolygonList:y})=>{const b=T(),[x,i]=U(!1),[p]=s.useForm(),{t:o}=B(),P=a=>{const u=C({toolInstance:f,imgList:n,imgIndex:g,stepList:t});if(a.prevPage>a.nextPage)return;if(u.slice(a.prevPage-1,a.nextPage).some(_=>{const h=parseInt(a.newID,10);return F.batchUpdateTrackIDCheck({newID:h,result:_.result})})){v.error(o("DuplicateTrackIDsExist"));return}b(k({id:e,newID:a.newID,rangeIndex:[a.prevPage-1,a.nextPage-1],imgList:u}));const E=parseInt(a.newID,10);i(!1),y(E)},w=()=>i(!1),D=()=>p.submit(),l=[{required:!0,message:o("PositiveIntegerCheck")}];return r.createElement(r.Fragment,null,r.createElement("a",{style:{color:"#666FFF"},onClick:()=>i(!0)},o("BatchUpdateText")),r.createElement(L,{title:o("BatchUpdateTrackID"),visible:x,onCancel:w,onOk:D,wrapClassName:"labelbee-custom-modal"},r.createElement(s,V(q({},$),{form:p,onFinish:P}),r.createElement(s.Item,{name:"id",label:o("CurrentBoxTrackIDs")},e),r.createElement(s.Item,{name:"newID",label:o("TrackIDUnifyAs"),rules:l},r.createElement(c,{precision:0,min:1,style:m})),r.createElement(s.Item,{label:o("UnifyTrackIDRange"),required:!0},r.createElement(s.Item,{style:{display:"inline-block"},rules:l,name:"prevPage",noStyle:!0},r.createElement(c,{precision:0,min:1,style:m})),r.createElement("span",{style:{display:"inline-block",width:"24px",textAlign:"center"}},"-"),r.createElement(s.Item,{style:{display:"inline-block"},rules:l,name:"nextPage",noStyle:!0},r.createElement(c,{precision:0,min:1,style:m})),r.createElement("span",{style:{display:"inline-block",width:"40x",marginLeft:"10px",textAlign:"center"}},o("Page"))))))},G=e=>({toolInstance:e.annotation.toolInstance,imgList:e.annotation.imgList,imgIndex:e.annotation.imgIndex,stepList:e.annotation.stepList});var H=j(G,null,null,{context:O})(z);export{H as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@labelbee/lb-components",
|
|
3
|
-
"version": "1.11.0-alpha.
|
|
3
|
+
"version": "1.11.0-alpha.5",
|
|
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.15.0-alpha.
|
|
46
|
+
"@labelbee/lb-annotation": "1.15.0-alpha.5",
|
|
47
47
|
"@labelbee/lb-utils": "1.7.1-alpha.2",
|
|
48
48
|
"ahooks": "^3.4.0",
|
|
49
49
|
"classnames": "^2.3.0",
|