@labelbee/lb-components 1.10.0-alpha.6 → 1.10.0-alpha.8

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.
Files changed (59) hide show
  1. package/dist/components/attributeList/index.js +1 -1
  2. package/dist/components/colorPalette/index.js +1 -0
  3. package/dist/components/colorTag/index.js +1 -1
  4. package/dist/components/pointCloudView/hooks/useHistory.js +1 -1
  5. package/dist/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
  6. package/dist/components/pointCloudView/hooks/useSphere.js +1 -1
  7. package/dist/components/pointCloudView/hooks/useStatus.js +1 -1
  8. package/dist/types/components/AnnotationView/pointCloudAnnotationView.d.ts +2 -2
  9. package/dist/types/components/annotationStepPopover/index.d.ts +2 -2
  10. package/dist/types/components/attributeList/index.d.ts +2 -0
  11. package/dist/types/components/checkboxList/index.d.ts +2 -2
  12. package/dist/types/components/colorPalette/index.d.ts +12 -0
  13. package/dist/types/components/colorTag/index.d.ts +2 -2
  14. package/dist/types/components/customAntd/IconWithText/index.d.ts +1 -1
  15. package/dist/types/components/customResizeHook/index.d.ts +2 -2
  16. package/dist/types/components/fileException/FileError.d.ts +1 -1
  17. package/dist/types/components/pointCloudView/PointCloud2DView.d.ts +2 -2
  18. package/dist/types/components/pointCloudView/PointCloudBackView.d.ts +2 -2
  19. package/dist/types/components/pointCloudView/PointCloudInfos.d.ts +4 -4
  20. package/dist/types/components/pointCloudView/components/EmptyPage/index.d.ts +7 -2
  21. package/dist/types/components/pointCloudView/components/UnifyParamsModal/index.d.ts +2 -2
  22. package/dist/types/components/pointCloudView/hooks/useHistory.d.ts +6 -4
  23. package/dist/types/components/predictTracking/predictTrackingIcon/index.d.ts +2 -2
  24. package/dist/types/components/predictTracking/previewResult/index.d.ts +2 -2
  25. package/dist/types/components/videoPlayer/TagToolInstanceAdaptor.d.ts +1 -1
  26. package/dist/types/components/videoPlayer/TagToolInstanceAdaptorI18nProvider.d.ts +2 -2
  27. package/dist/types/components/videoPlayer/components/controller/index.d.ts +2 -2
  28. package/dist/types/components/videoPlayer/index.d.ts +1 -1
  29. package/dist/types/utils/colorUtils.d.ts +20 -0
  30. package/dist/types/views/MainView/annotationTips/index.d.ts +2 -2
  31. package/dist/types/views/MainView/sidebar/ClearIcon/index.d.ts +2 -2
  32. package/dist/types/views/MainView/sidebar/ImgAttributeInfo/index.d.ts +2 -2
  33. package/dist/types/views/MainView/sidebar/PointCloudToolSidebar/components/batchUpdateModal/index.d.ts +2 -2
  34. package/dist/types/views/MainView/sidebar/PointCloudToolSidebar/index.d.ts +2 -1
  35. package/dist/types/views/MainView/sidebar/TagSidebar/index.d.ts +1 -1
  36. package/dist/types/views/MainView/sidebar/TextAreaFormat/index.d.ts +2 -2
  37. package/dist/types/views/MainView/sidebar/TextToolSidebar/index.d.ts +2 -2
  38. package/dist/types/views/MainView/sidebar/ToolIcons.d.ts +2 -2
  39. package/dist/types/views/MainView/sidebar/ToolStyle/index.d.ts +2 -2
  40. package/dist/types/views/MainView/toolFooter/AnnotatedAttributes/index.d.ts +5 -5
  41. package/dist/types/views/MainView/toolFooter/FooterPopover.d.ts +1 -1
  42. package/dist/types/views/MainView/toolFooter/HiddenTips/index.d.ts +2 -2
  43. package/dist/types/views/MainView/toolFooter/PageNumber/index.d.ts +2 -2
  44. package/dist/types/views/MainView/toolFooter/Pagination.d.ts +1 -1
  45. package/dist/types/views/MainView/toolFooter/index.d.ts +1 -1
  46. package/dist/utils/colorUtils.js +1 -0
  47. package/dist/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
  48. package/dist/views/MainView/toolFooter/AnnotatedAttributes/index.js +1 -1
  49. package/es/components/attributeList/index.js +1 -1
  50. package/es/components/colorPalette/index.js +1 -0
  51. package/es/components/colorTag/index.js +1 -1
  52. package/es/components/pointCloudView/hooks/useHistory.js +1 -1
  53. package/es/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
  54. package/es/components/pointCloudView/hooks/useSphere.js +1 -1
  55. package/es/components/pointCloudView/hooks/useStatus.js +1 -1
  56. package/es/utils/colorUtils.js +1 -0
  57. package/es/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
  58. package/es/views/MainView/toolFooter/AnnotatedAttributes/index.js +1 -1
  59. package/package.json +3 -3
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Style=require("../../data/Style.js"),index=require("../colorTag/index.js"),es=require("antd/es"),React=require("react");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const ATTRIBUTE_COLORS=[Style.NULL_COLOR].concat(Style.COLORS_ARRAY),AttributeList=React__default.default.forwardRef((e,o)=>{const d=React__default.default.useRef(),f=e.list||[];let u=[...ATTRIBUTE_COLORS];e.forbidDefault===!0&&(u=u.slice(1));let r="sensebee-radio-group";return e.noHeightLimit&&(r="sensebee-radio-group-no-limit-height"),React__default.default.createElement("div",{className:r,style:e.style},React__default.default.createElement(es.Radio.Group,{name:"radiogroup",defaultValue:e==null?void 0:e.selectedAttribute,value:e==null?void 0:e.selectedAttribute,onChange:t=>e.attributeChanged(t.target.value),ref:o},f.map((t,a)=>{var n;let l=(n=e==null?void 0:e.num)!=null?n:a;e.forbidDefault===!0&&typeof l=="number"&&l++,typeof l=="number"&&l<=9&&l>=0||(l="-");let i=a>8&&!e.forbidDefault?Style.COLORS_ARRAY[(a-1)%Style.COLORS_ARRAY.length]:u[a%u.length];return(t==null?void 0:t.color)&&(i=t.color),React__default.default.createElement(es.Radio,{value:t.value,ref:d,key:a},React__default.default.createElement("span",{className:"sensebee-radio-label",title:t.label},!(e==null?void 0:e.forbidColor)&&React__default.default.createElement(index.ColorTag,{color:i,style:{marginRight:"8px"}}),t.label),React__default.default.createElement("span",{className:"sensebee-radio-num"},l))})))});exports.ATTRIBUTE_COLORS=ATTRIBUTE_COLORS,exports.default=AttributeList;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Style=require("../../data/Style.js"),index$1=require("../colorTag/index.js"),es=require("antd/es"),React=require("react"),antd=require("antd"),index=require("../colorPalette/index.js"),icons=require("@ant-design/icons"),reactI18next=require("react-i18next");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const ATTRIBUTE_COLORS=[Style.NULL_COLOR].concat(Style.COLORS_ARRAY),AttributeList=React__default.default.forwardRef((e,f)=>{const c=React__default.default.useRef(),{t:s}=reactI18next.useTranslation(),v=e.list||[],[C,u]=React.useState(!1),[b,m]=React.useState(void 0);let n=[...ATTRIBUTE_COLORS];e.forbidDefault===!0&&(n=n.slice(1));let o="sensebee-radio-group";e.noHeightLimit&&(o="sensebee-radio-group-no-limit-height");const R=(t,l)=>{e.updateColorConfig&&e.updateColorConfig(t,l)};return React__default.default.createElement("div",{className:o,style:e.style},React__default.default.createElement(es.Radio.Group,{name:"radiogroup",defaultValue:e==null?void 0:e.selectedAttribute,value:e==null?void 0:e.selectedAttribute,onChange:t=>e.attributeChanged(t.target.value),ref:f},v.map((t,l)=>{var d;let a=(d=e==null?void 0:e.num)!=null?d:l;e.forbidDefault===!0&&typeof a=="number"&&a++,typeof a=="number"&&a<=9&&a>=0||(a="-");let i=l>8&&!e.forbidDefault?Style.COLORS_ARRAY[(l-1)%Style.COLORS_ARRAY.length]:n[l%n.length];return(t==null?void 0:t.color)&&(i=t.color),React__default.default.createElement(es.Radio,{value:t.value,ref:c,key:t.label+l},React__default.default.createElement("span",{className:"sensebee-radio-label",title:t.label},!(e==null?void 0:e.forbidColor)&&React__default.default.createElement(antd.Popover,{content:React__default.default.createElement(index,{defaultColor:i,setColor:r=>R(t.value,r)}),title:React__default.default.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},React__default.default.createElement("span",null,s("Palette")),React__default.default.createElement(icons.CloseOutlined,{onClick:()=>u(!1)})),visible:C&&b===l,onVisibleChange:r=>{!r||u(r)}},React__default.default.createElement(index$1.ColorTag,{color:i,style:{cursor:"pointer",marginRight:"8px"},onClick:()=>{(e==null?void 0:e.enableColorPicker)&&(m(l),u(!0))}})),t.label),React__default.default.createElement("span",{className:"sensebee-radio-num"},a))})))});exports.ATTRIBUTE_COLORS=ATTRIBUTE_COLORS,exports.default=AttributeList;
@@ -0,0 +1 @@
1
+ "use strict";var React=require("react"),reactColorful=require("react-colorful"),colorUtils=require("../../utils/colorUtils.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var React__default=_interopDefaultLegacy(React);const Palette=t=>{const{setColor:r,defaultColor:e}=t;return React__default.default.createElement(reactColorful.RgbaColorPicker,{color:colorUtils.toRGBAObj(e),onChange:o=>{const l=colorUtils.toRGBAStr(o);r(l)}})};module.exports=Palette;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react");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,r,t)=>r in e?__defProp(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,__spreadValues=(e,r)=>{for(var t in r||(r={}))__hasOwnProp.call(r,t)&&__defNormalProp(e,t,r[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(r))__propIsEnum.call(r,t)&&__defNormalProp(e,t,r[t]);return e};const ColorTag=({color:e,style:r})=>React__default.default.createElement("div",{style:__spreadValues({display:"inline-block",height:14,width:14,backgroundColor:e,verticalAlign:"middle"},r)});exports.ColorTag=ColorTag;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react");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,r,t)=>r in e?__defProp(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,__spreadValues=(e,r)=>{for(var t in r||(r={}))__hasOwnProp.call(r,t)&&__defNormalProp(e,t,r[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(r))__propIsEnum.call(r,t)&&__defNormalProp(e,t,r[t]);return e};const ColorTag=({color:e,style:r,onClick:t})=>React__default.default.createElement("div",{style:__spreadValues({display:"inline-block",height:14,width:14,backgroundColor:e,verticalAlign:"middle"},r),onClick:t});exports.ColorTag=ColorTag;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),PointCloudContext=require("../PointCloudContext.js"),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,s,r)=>s in e?__defProp(e,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[s]=r,__spreadValues=(e,s)=>{for(var r in s||(s={}))__hasOwnProp.call(s,r)&&__defNormalProp(e,r,s[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(s))__propIsEnum.call(s,r)&&__defNormalProp(e,r,s[r]);return e};const useHistory=()=>{const{history:e,setPointCloudResult:s,setSelectedIDs:r,pointCloudBoxList:l,pointCloudSphereList:P,mainViewInstance:p,topViewInstance:L,polygonList:u,setPolygonList:f,lineList:c,setLineList:a,syncAllViewPointCloudColor:h}=React.useContext(PointCloudContext.PointCloudContext),g=({newBoxParams:t,newPolygon:o,newLine:i})=>{const n={pointCloudBoxList:l,polygonList:u,lineList:c};t&&(n.pointCloudBoxList=l.concat(t)),o&&(n.polygonList=u.concat(o)),i&&(n.lineList=c.concat(i)),e.pushHistory(n)},v=t=>{const o={pointCloudBoxList:l,polygonList:u,lineList:c};t.pointCloudBoxList&&(o.pointCloudBoxList=t.pointCloudBoxList),t.polygonList&&(o.polygonList=t.polygonList),t.lineList&&(o.lineList=t.lineList),e.pushHistory(o)},x=t=>{if(c.find(i=>i.id===t.id)){const i=c.map(n=>n.id===t.id?t:__spreadValues({},n));e.pushHistory({lineList:i}),a(i)}},_=t=>{t&&e.pushHistory({pointCloudSphereList:P})},H=t=>{if(u.find(i=>i.id===t.id)){const i=u.map(n=>n.id===t.id?t:__spreadValues({},n));e.pushHistory({pointCloudBoxList:l,polygonList:i}),f(i)}},w=({pointCloudBoxList:t,polygonList:o})=>{e.initRecord({pointCloudBoxList:t,polygonList:o},!0)},C=t=>{if(!t)return;const{pointCloudBoxList:o=[],polygonList:i=[],lineList:n=[]}=t;if(o){l.length!==o.length&&r();const B=l.filter(d=>o.every(y=>y.id!==d.id)),O=o.filter(d=>l.every(y=>y.id!==d.id));B.forEach(d=>{p==null||p.removeObjectByName(d.id)}),O.forEach(d=>{p==null||p.generateBox(d)}),s(o),h(o)}i&&f(i),n&&a(n),L==null||L.updatePolygonList(o!=null?o:[],i!=null?i:[]),L==null||L.updateLineList(n!=null?n:[])};return{addHistory:g,pushHistoryWithList:v,initHistory:w,pushHistoryUnderUpdatePoint:_,pushHistoryUnderUpdatePolygon:H,pushHistoryUnderUpdateLine:x,redo:()=>{C(e.redo())},undo:()=>{C(e.undo())}}};exports.useHistory=useHistory;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),PointCloudContext=require("../PointCloudContext.js"),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,s,r)=>s in e?__defProp(e,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[s]=r,__spreadValues=(e,s)=>{for(var r in s||(s={}))__hasOwnProp.call(s,r)&&__defNormalProp(e,r,s[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(s))__propIsEnum.call(s,r)&&__defNormalProp(e,r,s[r]);return e};const useHistory=()=>{const{history:e,setPointCloudResult:s,setSelectedIDs:r,pointCloudBoxList:p,pointCloudSphereList:L,setPointCloudSphereList:x,mainViewInstance:u,topViewInstance:C,polygonList:y,setPolygonList:P,lineList:f,setLineList:g,syncAllViewPointCloudColor:_}=React.useContext(PointCloudContext.PointCloudContext),S=({newBoxParams:t,newPolygon:o,newLine:i,newSphereParams:l})=>{const d={pointCloudBoxList:p,polygonList:y,lineList:f,pointCloudSphereList:L};t&&(d.pointCloudBoxList=p.concat(t)),o&&(d.polygonList=y.concat(o)),i&&(d.lineList=f.concat(i)),l&&(d.pointCloudSphereList=L.concat(l)),e.pushHistory(d)},B=t=>{const o={pointCloudBoxList:p,polygonList:y,lineList:f,pointCloudSphereList:L};t.pointCloudBoxList&&(o.pointCloudBoxList=t.pointCloudBoxList),t.polygonList&&(o.polygonList=t.polygonList),t.lineList&&(o.lineList=t.lineList),t.pointCloudSphereList&&(o.pointCloudSphereList=t.pointCloudSphereList),e.pushHistory(o)},H=t=>{if(f.find(i=>i.id===t.id)){const i=f.map(l=>l.id===t.id?t:__spreadValues({},l));e.pushHistory({lineList:i}),g(i)}},O=t=>{if(y.find(i=>i.id===t.id)){const i=y.map(l=>l.id===t.id?t:__spreadValues({},l));e.pushHistory({pointCloudBoxList:p,polygonList:i}),P(i)}},w=({pointCloudBoxList:t,polygonList:o,pointCloudSphereList:i})=>{e.initRecord({pointCloudBoxList:t,polygonList:o,pointCloudSphereList:i},!0)},v=t=>{if(!t)return;const{pointCloudBoxList:o=[],polygonList:i=[],lineList:l=[],pointCloudSphereList:d=[]}=t;if(o){p.length!==o.length&&r();const h=p.filter(n=>o.every(c=>c.id!==n.id)),a=o.filter(n=>p.every(c=>c.id!==n.id));h.forEach(n=>{u==null||u.removeObjectByName(n.id)}),a.forEach(n=>{u==null||u.generateBox(n)}),s(o),_(o)}if(d){L.length!==d.length&&r();let h=L.filter(n=>d.every(c=>c.id!==n.id)),a=d.filter(n=>L.every(c=>c.id!==n.id));h.forEach(n=>{u==null||u.removeObjectByName(n.id)}),a.forEach(n=>{u==null||u.generateSphere(n)}),x(d)}i&&P(i),l&&g(l),C==null||C.updatePolygonList(o!=null?o:[],i!=null?i:[]),C==null||C.updateLineList(l!=null?l:[])};return{addHistory:S,pushHistoryWithList:B,initHistory:w,pushHistoryUnderUpdatePolygon:O,pushHistoryUnderUpdateLine:H,redo:()=>{v(e.redo())},undo:()=>{v(e.undo())}}};exports.useHistory=useHistory;
@@ -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((r,e)=>{var c=l=>{try{s(i.next(l))}catch(h){e(h)}},p=l=>{try{s(i.throw(l))}catch(h){e(h)}},s=l=>l.done?r(l.value):Promise.resolve(l.value).then(c,p);s((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,r,e)=>{const{x:c,y:p}=lbUtils.PointCloudUtils.transferCanvas2World(t,o),{defaultZ:s}=lbUtils.DEFAULT_SPHERE_PARAMS,l={center:{x:c,y:p,z:s},id:t.id},h=r?__spreadValues(__spreadValues({},r),l):__spreadProps(__spreadValues({},l),{attribute:"",valid:!0});return e&&Object.assign(h,e),h},topViewPolygon2PointCloud=(t,o,i,r,e,c)=>{let p=t.pointList.map(y=>lbUtils.PointCloudUtils.transferCanvas2World(y,o)),s=0,l=1,h={};if(i){const y=i.getSensesPointZAxisInPolygon(p,void 0,c);c&&y.fittedCoordinates.length>0&&(p=y.fittedCoordinates),s=(y.maxZ+y.minZ)/2,l=y.maxZ-y.minZ,h={count:y.zCount}}const[g,x,j]=p,b=lbAnnotation.MathUtils.getLineCenterPoint([g,j]),_=lbAnnotation.MathUtils.getLineLength(g,x),O=lbAnnotation.MathUtils.getLineLength(x,j),k=lbAnnotation.MathUtils.getRadiusFromQuadrangle(t.pointList);r&&(s=r.center.z,l=r.depth);const V={center:{x:b.x,y:b.y,z:s},width:O,height:_,depth:l,rotation:k,id:t.id},I=__spreadValues(r?__spreadValues(__spreadValues({},r),V):__spreadProps(__spreadValues({},V),{attribute:"",valid:!0}),h);e&&Object.assign(I,e);const D=p.map(y=>lbUtils.PointCloudUtils.transferWorld2Canvas(y,o));return{boxParams:I,newPointList:D}},sideViewPoint2PointCloud=(t,o,i)=>{const r={x:t.x-o.x,y:t.y-o.y};return __spreadProps(__spreadValues({},i),{center:{x:i.center.x-r.x,y:i.center.y,z:i.center.z-r.y}})},sideViewPolygon2PointCloud=(t,o,i,r)=>{const[e,c,p]=t.pointList,[s,l,h]=o.pointList,g=lbAnnotation.MathUtils.getLineCenterPoint([e,p]),x=lbAnnotation.MathUtils.getLineCenterPoint([s,h]),b={x:{x:g.x-x.x,y:g.y-x.y}.x,y:0,z:g.y-x.y},_=lbAnnotation.MathUtils.getLineLength(e,c),O=lbAnnotation.MathUtils.getLineLength(s,l),k=_-O,V=lbAnnotation.MathUtils.getLineLength(c,p),I=lbAnnotation.MathUtils.getLineLength(l,h),D=V-I,{newBoxParams:y}=r.getNewBoxBySideUpdate(b,D,k,i);return y},backViewPoint2PointCloud=(t,o,i)=>{const r={x:t.x-o.x,y:t.y-o.y};return __spreadProps(__spreadValues({},i),{center:{x:i.center.x,y:i.center.y-r.x,z:i.center.z-r.y}})},backViewPolygon2PointCloud=(t,o,i,r)=>{const[e,c,p]=t.pointList,[s,l,h]=o.pointList,g=lbAnnotation.MathUtils.getLineCenterPoint([e,p]),x=lbAnnotation.MathUtils.getLineCenterPoint([s,h]),b={x:{x:g.x-x.x,y:g.y-x.y}.x,y:0,z:g.y-x.y},_=lbAnnotation.MathUtils.getLineLength(e,c),O=lbAnnotation.MathUtils.getLineLength(s,l),k=_-O,V=lbAnnotation.MathUtils.getLineLength(c,p),I=lbAnnotation.MathUtils.getLineLength(l,h),D=V-I;let{newBoxParams:y}=r.getNewBoxByBackUpdate(b,D,k,i);return y},syncSideViewByPoint=(t,o,i,r,e)=>{var c;if(!i)return;const{toolInstance:p,pointCloudInstance:s}=i;s.loadPCDFile(r,(c=e==null?void 0:e.radius)!=null?c:DEFAULT_RADIUS);const{cameraPositionVector:l}=s.updateOrthoCameraBySphere(t,lbUtils.EPerspectiveView.Left);s.setInitCameraPosition(l);const{point2d:h,zoom:g}=s.getSphereSidePoint2DCoordinate(t);s.camera.zoom=g,s.camera.updateProjectionMatrix(),s.render(),p.initPosition(),p.zoomChangeOnCenter(g),p.setResult([__spreadProps(__spreadValues(__spreadValues({},o),h),{valid:t.valid,textAttribute:"",attribute:t.attribute})]),p.setSelectedID(o.id)},synchronizeSideView=(t,o,i,r)=>{if(!i)return;const{pointCloud2dOperation:e,pointCloudInstance:c}=i;c.loadPCDFileByBox(r,t,{width:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:p}=c.updateOrthoCamera(t,lbUtils.EPerspectiveView.Left);c.setInitCameraPosition(p);const{polygon2d:s,zoom:l}=c.getBoxSidePolygon2DCoordinate(t);c.camera.zoom=l,c.camera.updateProjectionMatrix(),c.render(),e.initPosition(),e.zoomChangeOnCenter(l),e.setResultAndSelectedID([{id:o.id,valid:t.valid,pointList:s,textAttribute:"",isRect:!0,attribute:t.attribute}],o.id)},syncBackViewByPoint=(t,o,i,r,e)=>{var c;if(!i)return;const{toolInstance:p,pointCloudInstance:s}=i;s.loadPCDFile(r,(c=e==null?void 0:e.radius)!=null?c:DEFAULT_RADIUS);const{cameraPositionVector:l}=s.updateOrthoCameraBySphere(t,lbUtils.EPerspectiveView.Back);s.setInitCameraPosition(l);const{point2d:h,zoom:g}=s.getSphereBackPoint2DCoordinate(t);s.camera.zoom=g,s.camera.updateProjectionMatrix(),s.render(),p.initPosition(),p.zoomChangeOnCenter(g),p.setResult([__spreadProps(__spreadValues(__spreadValues({},o),h),{valid:t.valid,textAttribute:"",attribute:t.attribute})]),p.setSelectedID(o.id)},synchronizeBackView=(t,o,i,r)=>{if(!i)return;const{pointCloud2dOperation:e,pointCloudInstance:c}=i;c.loadPCDFileByBox(r,t,{height:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:p}=c.updateOrthoCamera(t,lbUtils.EPerspectiveView.Back);c.setInitCameraPosition(p);const{polygon2d:s,zoom:l}=c.getBoxBackPolygon2DCoordinate(t);c.camera.zoom=l,c.camera.updateProjectionMatrix(),c.render(),e.initPosition(),e.zoomChangeOnCenter(l),e.setResultAndSelectedID([{id:o.id,valid:t.valid,pointList:s,textAttribute:"",isRect:!0,attribute:t.attribute}],o.id)},syncTopViewByPoint=(t,o,i,r)=>{if(!i||!r)return;r.generateSphere(t),r.updateCameraBySphere(t,lbUtils.EPerspectiveView.Top),r.render();const{toolInstance:e,pointCloudInstance:c}=i,{point2d:p}=c.getSphereTopPoint2DCoordinate(t),s=[...e.pointList].map(l=>l.id===o.id?__spreadProps(__spreadValues(__spreadValues({},o),p),{valid:t.valid,textAttribute:"",attribute:t.attribute}):l);e.setResult(s),e.setSelectedID(o.id)},synchronizeTopView=(t,o,i,r)=>{var e;if(!i||!r)return;r.generateBox(t,o.id),r.render();const{pointCloud2dOperation:c,pointCloudInstance:p}=i,{polygon2d:s}=p.getBoxTopPolygon2DCoordinate(t),l=[...c.polygonList],h=l.find(g=>g.id===o.id);h?h.pointList=s:l.push({id:o.id,pointList:s,textAttribute:"",isRect:!0,valid:(e=t.valid)!=null?e:!0}),c.setResultAndSelectedID(l,o.id)},usePointCloudViews=()=>{const t=React.useContext(PointCloudContext.PointCloudContext),{topViewInstance:o,sideViewInstance:i,backViewInstance:r,mainViewInstance:e,addPointCloudBox:c,addPointCloudSphere:p,setSelectedIDs:s,selectedIDs:l,pointCloudBoxList:h,pointCloudSphereList:g,hideAttributes:x}=t,{addHistory:j,initHistory:b,pushHistoryUnderUpdatePolygon:_,pushHistoryUnderUpdatePoint:O,pushHistoryUnderUpdateLine:k}=useHistory.useHistory(),{selectedPolygon:V}=usePolygon.usePolygon(),{updateSelectedBox:I,updateSelectedBoxes:D,getPointCloudByID:y}=useSingleBox.useSingleBox(),{getPointCloudSphereByID:G,updatePointCloudSphere:H,selectedSphere:z}=useSphere.useSphere(),{currentData:w,config:L}=ctx.useSelector(n=>{const{stepList:a,step:P,imgList:u,imgIndex:d}=n.annotation;return{currentData:u[d],config:index.jsonParser(StepUtils.getCurrentStepInfo(P,a).config)}}),F=ctx.useDispatch(),{selectedBox:T}=useSingleBox.useSingleBox(),{t:X}=reactI18next.useTranslation(),N=T==null?void 0:T.info;if(!o||!i||!r)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:E}=o,Y=n=>{e==null||e.generateBox(n),e==null||e.controls.update(),e==null||e.render()},Q=n=>{e==null||e.generateSphere(n),e==null||e.controls.update(),e==null||e.render()},J=({newPoint:n,size:a,zoom:P,trackConfigurable:u})=>{var d;const C={attribute:(d=o.toolInstance.defaultAttribute)!=null?d:""};u===!0&&Object.assign(C,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:g})});const f=topViewPoint2PointCloud(n,a,E,void 0,C);s(n.id);const v=p(f);M(PointCloudView.Top,n,f,P,v,L)},K=({polygon:n,size:a,imgList:P,trackConfigurable:u,zoom:d,intelligentFit:C})=>{var f;const v={attribute:(f=o.toolInstance.defaultAttribute)!=null?f:""};u===!0&&Object.assign(v,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:h,extraSphereList:g})});const m=o==null?void 0:o.toolInstance,S=__spreadValues({},n),{boxParams:B,newPointList:A}=topViewPolygon2PointCloud(S,a,E,void 0,v,C);if((L==null?void 0:L.lowerLimitPointsNumInBox)&&typeof B.count=="number"&&B.count<L.lowerLimitPointsNumInBox){antd.message.info(X("LowerLimitPointsNumInBox",{num:L.lowerLimitPointsNumInBox})),m.deletePolygon(B.id);return}C&&(A==null?void 0:A.length)&&(S.pointList=A);const q=x.includes(S.attribute),U=c(B);q?s([]):(s(B.id),m.setSelectedIDs([S.id]),R(PointCloudView.Top,S,B,d,U),C&&synchronizeTopView(B,S,o,e)),j({newBoxParams:B})},$=({newSelectedBox:n,newPointCloudList:a,newSelectedSphere:P,newSphereList:u})=>{const d=o==null?void 0:o.toolInstance;if(!(l.length===0||!d)){if(n||(T==null?void 0:T.info)){const C=n!=null?n:T==null?void 0:T.info;d.setSelectedIDs(l);const f=d.selectedPolygon;if(l.length===1&&C){R(PointCloudView.Top,f,C,void 0,a);return}}if((P||z)&&l.length===1){const C=P!=null?P:z;d.setSelectedID(l[0]);const f=d.selectedPoint;C&&M(PointCloudView.Top,f,C,void 0,u,L)}}},W=(n,a,P)=>{if(N){let u,d;switch(P){case PointCloudView.Back:u=backViewPolygon2PointCloud;break;case PointCloudView.Side:u=sideViewPolygon2PointCloud;break;default:u=sideViewPolygon2PointCloud;break}if(d=u(n,a,N,i.pointCloudInstance),e){const{count:f}=e.getSensesPointZAxisInPolygon(lbAnnotation.getCuboidFromPointCloudBox(d).polygonPointList,[d.center.z-d.depth/2,d.center.z+d.depth/2]);d=__spreadProps(__spreadValues({},d),{count:f})}const C=I(d);return R(P,n,d,void 0,C),C}},Z=(n,a,P)=>{if(z){let u,d;switch(P){case PointCloudView.Back:u=backViewPoint2PointCloud;break;case PointCloudView.Side:u=sideViewPoint2PointCloud;break;default:u=sideViewPoint2PointCloud;break}d=u(n,a,z);const C=H(d);return M(P,n,d,void 0,C,L),C}},tt=(n,a)=>{Z(n,a,PointCloudView.Side)},et=(n,a)=>{Z(n,a,PointCloudView.Back)},ot=(n,a)=>{W(n,a,PointCloudView.Side)},it=(n,a)=>{W(n,a,PointCloudView.Back)},nt=(n,a)=>{k(n)},st=(n,a)=>{const{x:P,y:u}=lbUtils.PointCloudUtils.transferCanvas2World(n,a);O(__spreadProps(__spreadValues({},n),{x:P,y:u}));const d=G(n.id),C=topViewPoint2PointCloud(n,a,E,d),f=H(C);M(PointCloudView.Top,n,C,void 0,f,L)},rt=(n,a)=>{if(V){const u=n[0].newPolygon;u.pointList=u.pointList.map(d=>lbUtils.PointCloudUtils.transferCanvas2World(d,a)),_(n[0].newPolygon);return}const P=n.map(({newPolygon:u})=>{const d=y(u.id),{boxParams:C}=topViewPolygon2PointCloud(u,a,o.pointCloudInstance,d);return C});if(P.length===1){const{newPolygon:u}=n[0],d=D(P);R(PointCloudView.Top,u,P[0],void 0,d)}else{const u=D(P);u&&t.syncAllViewPointCloudColor(u)}},M=(n,a,P,u,d,C)=>__async(void 0,null,function*(){const f=w==null?void 0:w.url,v={[PointCloudView.Side]:()=>{syncSideViewByPoint(P,a,i,f,C)},[PointCloudView.Back]:()=>{r&&syncBackViewByPoint(P,a,r,f,C)},[PointCloudView.Top]:()=>{syncTopViewByPoint(P,a,o,e)}};Object.keys(v).forEach(m=>{m!==n&&v[m]()}),u&&(e==null||e.updateCameraZoom(u)),Q(P)}),R=(n,a,P,u,d)=>__async(void 0,null,function*(){const C=w==null?void 0:w.url;d&&(yield t.syncAllViewPointCloudColor(d));const f={[PointCloudView.Side]:()=>{synchronizeSideView(P,a,i,C)},[PointCloudView.Back]:()=>{r&&synchronizeBackView(P,a,r,C)},[PointCloudView.Top]:()=>{synchronizeTopView(P,a,o,e)}};Object.keys(f).forEach(v=>{v!==n&&f[v]()}),u&&(e==null||e.updateCameraZoom(u)),Y(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 a={left:-n.width/2,right:n.width/2,top:n.height/2,bottom:-n.height/2,near:100,far:-100};e.initOrthographicCamera(a),e.initRenderer(),e.render()},updatePointCloudData:(...n)=>__async(void 0,[...n],function*(a=w){var P,u,d,C,f,v;if(!(a==null?void 0:a.url)||!e)return;actionCreators.SetPointCloudLoading(F,!0),yield e.loadPCDFile(a.url,(P=L==null?void 0:L.radius)!=null?P:DEFAULT_RADIUS),h.forEach(U=>{e==null||e.removeObjectByName(U.id)}),g.forEach(U=>{e==null||e.removeObjectByName(U.id)});let m=[],S=[],B=[],A=[];w.result?(m=lbUtils.PointCloudUtils.getBoxParamsFromResultList(w.result),B=lbUtils.PointCloudUtils.getPolygonListFromResultList(w.result),S=lbUtils.PointCloudUtils.getLineListFromResultList(w.result),A=lbUtils.PointCloudUtils.getSphereParamsFromResultList(w.result),m.forEach(U=>{e==null||e.generateBox(U)}),A.forEach(U=>{e==null||e.generateSphere(U)}),t.syncAllViewPointCloudColor(m),t.setPointCloudResult(m),t.setPolygonList(B),t.setLineList(S),t.setPointCloudSphereList(A)):(t.setPointCloudResult([]),t.setPolygonList([]),t.setPointCloudSphereList([]),t.setLineList([])),b({pointCloudBoxList:m,polygonList:B}),e.updateTopCamera();const q=(d=(u=index.jsonParser(a.result))==null?void 0:u.valid)!=null?d:!0;t.setPointCloudValid(q),(C=t.sideViewInstance)==null||C.clearAllData(),(f=t.backViewInstance)==null||f.clearAllData(),o.updateData(a.url,a.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((r,e)=>{var c=l=>{try{s(i.next(l))}catch(h){e(h)}},p=l=>{try{s(i.throw(l))}catch(h){e(h)}},s=l=>l.done?r(l.value):Promise.resolve(l.value).then(c,p);s((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,r,e)=>{const{x:c,y:p}=lbUtils.PointCloudUtils.transferCanvas2World(t,o),{defaultZ:s}=lbUtils.DEFAULT_SPHERE_PARAMS,l={center:{x:c,y:p,z:s},id:t.id},h=r?__spreadValues(__spreadValues({},r),l):__spreadProps(__spreadValues({},l),{attribute:"",valid:!0});return e&&Object.assign(h,e),h},topViewPolygon2PointCloud=(t,o,i,r,e,c)=>{let p=t.pointList.map(y=>lbUtils.PointCloudUtils.transferCanvas2World(y,o)),s=0,l=1,h={};if(i){const y=i.getSensesPointZAxisInPolygon(p,void 0,c);c&&y.fittedCoordinates.length>0&&(p=y.fittedCoordinates),s=(y.maxZ+y.minZ)/2,l=y.maxZ-y.minZ,h={count:y.zCount}}const[g,x,_]=p,V=lbAnnotation.MathUtils.getLineCenterPoint([g,_]),O=lbAnnotation.MathUtils.getLineLength(g,x),k=lbAnnotation.MathUtils.getLineLength(x,_),A=lbAnnotation.MathUtils.getRadiusFromQuadrangle(t.pointList);r&&(s=r.center.z,l=r.depth);const I={center:{x:V.x,y:V.y,z:s},width:k,height:O,depth:l,rotation:A,id:t.id},S=__spreadValues(r?__spreadValues(__spreadValues({},r),I):__spreadProps(__spreadValues({},I),{attribute:"",valid:!0}),h);e&&Object.assign(S,e);const j=p.map(y=>lbUtils.PointCloudUtils.transferWorld2Canvas(y,o));return{boxParams:S,newPointList:j}},sideViewPoint2PointCloud=(t,o,i)=>{const r={x:t.x-o.x,y:t.y-o.y};return __spreadProps(__spreadValues({},i),{center:{x:i.center.x-r.x,y:i.center.y,z:i.center.z-r.y}})},sideViewPolygon2PointCloud=(t,o,i,r)=>{const[e,c,p]=t.pointList,[s,l,h]=o.pointList,g=lbAnnotation.MathUtils.getLineCenterPoint([e,p]),x=lbAnnotation.MathUtils.getLineCenterPoint([s,h]),V={x:{x:g.x-x.x,y:g.y-x.y}.x,y:0,z:g.y-x.y},O=lbAnnotation.MathUtils.getLineLength(e,c),k=lbAnnotation.MathUtils.getLineLength(s,l),A=O-k,I=lbAnnotation.MathUtils.getLineLength(c,p),S=lbAnnotation.MathUtils.getLineLength(l,h),j=I-S,{newBoxParams:y}=r.getNewBoxBySideUpdate(V,j,A,i);return y},backViewPoint2PointCloud=(t,o,i)=>{const r={x:t.x-o.x,y:t.y-o.y};return __spreadProps(__spreadValues({},i),{center:{x:i.center.x,y:i.center.y-r.x,z:i.center.z-r.y}})},backViewPolygon2PointCloud=(t,o,i,r)=>{const[e,c,p]=t.pointList,[s,l,h]=o.pointList,g=lbAnnotation.MathUtils.getLineCenterPoint([e,p]),x=lbAnnotation.MathUtils.getLineCenterPoint([s,h]),V={x:{x:g.x-x.x,y:g.y-x.y}.x,y:0,z:g.y-x.y},O=lbAnnotation.MathUtils.getLineLength(e,c),k=lbAnnotation.MathUtils.getLineLength(s,l),A=O-k,I=lbAnnotation.MathUtils.getLineLength(c,p),S=lbAnnotation.MathUtils.getLineLength(l,h),j=I-S;let{newBoxParams:y}=r.getNewBoxByBackUpdate(V,j,A,i);return y},syncSideViewByPoint=(t,o,i,r,e)=>{var c;if(!i)return;const{toolInstance:p,pointCloudInstance:s}=i;s.loadPCDFile(r,(c=e==null?void 0:e.radius)!=null?c:DEFAULT_RADIUS);const{cameraPositionVector:l}=s.updateOrthoCameraBySphere(t,lbUtils.EPerspectiveView.Left);s.setInitCameraPosition(l);const{point2d:h,zoom:g}=s.getSphereSidePoint2DCoordinate(t);s.camera.zoom=g,s.camera.updateProjectionMatrix(),s.render(),p.initPosition(),p.zoomChangeOnCenter(g),p.setResult([__spreadProps(__spreadValues(__spreadValues({},o),h),{valid:t.valid,textAttribute:"",attribute:t.attribute})]),p.setSelectedID(o.id)},synchronizeSideView=(t,o,i,r)=>{if(!i)return;const{pointCloud2dOperation:e,pointCloudInstance:c}=i;c.loadPCDFileByBox(r,t,{width:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:p}=c.updateOrthoCamera(t,lbUtils.EPerspectiveView.Left);c.setInitCameraPosition(p);const{polygon2d:s,zoom:l}=c.getBoxSidePolygon2DCoordinate(t);c.camera.zoom=l,c.camera.updateProjectionMatrix(),c.render(),e.initPosition(),e.zoomChangeOnCenter(l),e.setResultAndSelectedID([{id:o.id,valid:t.valid,pointList:s,textAttribute:"",isRect:!0,attribute:t.attribute}],o.id)},syncBackViewByPoint=(t,o,i,r,e)=>{var c;if(!i)return;const{toolInstance:p,pointCloudInstance:s}=i;s.loadPCDFile(r,(c=e==null?void 0:e.radius)!=null?c:DEFAULT_RADIUS);const{cameraPositionVector:l}=s.updateOrthoCameraBySphere(t,lbUtils.EPerspectiveView.Back);s.setInitCameraPosition(l);const{point2d:h,zoom:g}=s.getSphereBackPoint2DCoordinate(t);s.camera.zoom=g,s.camera.updateProjectionMatrix(),s.render(),p.initPosition(),p.zoomChangeOnCenter(g),p.setResult([__spreadProps(__spreadValues(__spreadValues({},o),h),{valid:t.valid,textAttribute:"",attribute:t.attribute})]),p.setSelectedID(o.id)},synchronizeBackView=(t,o,i,r)=>{if(!i)return;const{pointCloud2dOperation:e,pointCloudInstance:c}=i;c.loadPCDFileByBox(r,t,{height:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:p}=c.updateOrthoCamera(t,lbUtils.EPerspectiveView.Back);c.setInitCameraPosition(p);const{polygon2d:s,zoom:l}=c.getBoxBackPolygon2DCoordinate(t);c.camera.zoom=l,c.camera.updateProjectionMatrix(),c.render(),e.initPosition(),e.zoomChangeOnCenter(l),e.setResultAndSelectedID([{id:o.id,valid:t.valid,pointList:s,textAttribute:"",isRect:!0,attribute:t.attribute}],o.id)},syncTopViewByPoint=(t,o,i,r)=>{if(!i||!r)return;r.generateSphere(t),r.updateCameraBySphere(t,lbUtils.EPerspectiveView.Top),r.render();const{toolInstance:e,pointCloudInstance:c}=i,{point2d:p}=c.getSphereTopPoint2DCoordinate(t),s=[...e.pointList].map(l=>l.id===o.id?__spreadProps(__spreadValues(__spreadValues({},o),p),{valid:t.valid,textAttribute:"",attribute:t.attribute}):l);e.setResult(s),e.setSelectedID(o.id)},synchronizeTopView=(t,o,i,r)=>{var e;if(!i||!r)return;r.generateBox(t,o.id),r.render();const{pointCloud2dOperation:c,pointCloudInstance:p}=i,{polygon2d:s}=p.getBoxTopPolygon2DCoordinate(t),l=[...c.polygonList],h=l.find(g=>g.id===o.id);h?h.pointList=s:l.push({id:o.id,pointList:s,textAttribute:"",isRect:!0,valid:(e=t.valid)!=null?e:!0}),c.setResultAndSelectedID(l,o.id)},usePointCloudViews=()=>{const t=React.useContext(PointCloudContext.PointCloudContext),{topViewInstance:o,sideViewInstance:i,backViewInstance:r,mainViewInstance:e,addPointCloudBox:c,addPointCloudSphere:p,setSelectedIDs:s,selectedIDs:l,pointCloudBoxList:h,pointCloudSphereList:g,hideAttributes:x}=t,{addHistory:_,initHistory:V,pushHistoryUnderUpdatePolygon:O,pushHistoryUnderUpdateLine:k}=useHistory.useHistory(),{selectedPolygon:A}=usePolygon.usePolygon(),{updateSelectedBox:I,updateSelectedBoxes:S,getPointCloudByID:j}=useSingleBox.useSingleBox(),{getPointCloudSphereByID:y,updatePointCloudSphere:H,selectedSphere:z}=useSphere.useSphere(),{currentData:w,config:L}=ctx.useSelector(n=>{const{stepList:a,step:P,imgList:u,imgIndex:d}=n.annotation;return{currentData:u[d],config:index.jsonParser(StepUtils.getCurrentStepInfo(P,a).config)}}),F=ctx.useDispatch(),{selectedBox:T}=useSingleBox.useSingleBox(),{t:G}=reactI18next.useTranslation(),N=T==null?void 0:T.info;if(!o||!i||!r)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:a,zoom:P,trackConfigurable:u})=>{var d;const C={attribute:(d=o.toolInstance.defaultAttribute)!=null?d:""};u===!0&&Object.assign(C,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:g})});const f=topViewPoint2PointCloud(n,a,E,void 0,C);s(n.id);const v=p(f);M(PointCloudView.Top,n,f,P,v,L),_({newSphereParams:f})},J=({polygon:n,size:a,imgList:P,trackConfigurable:u,zoom:d,intelligentFit:C})=>{var f;const v={attribute:(f=o.toolInstance.defaultAttribute)!=null?f:""};u===!0&&Object.assign(v,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:h,extraSphereList:g})});const m=o==null?void 0:o.toolInstance,b=__spreadValues({},n),{boxParams:B,newPointList:D}=topViewPolygon2PointCloud(b,a,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&&(D==null?void 0:D.length)&&(b.pointList=D);const q=x.includes(b.attribute),U=c(B);q?s([]):(s(B.id),m.setSelectedIDs([b.id]),R(PointCloudView.Top,b,B,d,U),C&&synchronizeTopView(B,b,o,e)),_({newBoxParams:B})},K=({newSelectedBox:n,newPointCloudList:a,newSelectedSphere:P,newSphereList:u})=>{const d=o==null?void 0:o.toolInstance;if(!(l.length===0||!d)){if(n||(T==null?void 0:T.info)){const C=n!=null?n:T==null?void 0:T.info;d.setSelectedIDs(l);const f=d.selectedPolygon;if(l.length===1&&C){R(PointCloudView.Top,f,C,void 0,a);return}}if((P||z)&&l.length===1){const C=P!=null?P:z;d.setSelectedID(l[0]);const f=d.selectedPoint;C&&M(PointCloudView.Top,f,C,void 0,u,L)}}},Z=(n,a,P)=>{if(N){let u,d;switch(P){case PointCloudView.Back:u=backViewPolygon2PointCloud;break;case PointCloudView.Side:u=sideViewPolygon2PointCloud;break;default:u=sideViewPolygon2PointCloud;break}if(d=u(n,a,N,i.pointCloudInstance),e){const{count:f}=e.getSensesPointZAxisInPolygon(lbAnnotation.getCuboidFromPointCloudBox(d).polygonPointList,[d.center.z-d.depth/2,d.center.z+d.depth/2]);d=__spreadProps(__spreadValues({},d),{count:f})}const C=I(d);return R(P,n,d,void 0,C),C}},W=(n,a,P)=>{if(z){let u,d;switch(P){case PointCloudView.Back:u=backViewPoint2PointCloud;break;case PointCloudView.Side:u=sideViewPoint2PointCloud;break;default:u=sideViewPoint2PointCloud;break}d=u(n,a,z);const C=H(d);return M(P,n,d,void 0,C,L),C}},$=(n,a)=>{W(n,a,PointCloudView.Side)},tt=(n,a)=>{W(n,a,PointCloudView.Back)},et=(n,a)=>{Z(n,a,PointCloudView.Side)},ot=(n,a)=>{Z(n,a,PointCloudView.Back)},it=(n,a)=>{k(n)},nt=(n,a)=>{const P=y(n.id),u=topViewPoint2PointCloud(n,a,E,P),d=H(u);M(PointCloudView.Top,n,u,void 0,d,L)},st=(n,a)=>{if(A){const u=n[0].newPolygon;u.pointList=u.pointList.map(d=>lbUtils.PointCloudUtils.transferCanvas2World(d,a)),O(n[0].newPolygon);return}const P=n.map(({newPolygon:u})=>{const d=j(u.id),{boxParams:C}=topViewPolygon2PointCloud(u,a,o.pointCloudInstance,d);return C});if(P.length===1){const{newPolygon:u}=n[0],d=S(P);R(PointCloudView.Top,u,P[0],void 0,d)}else{const u=S(P);u&&t.syncAllViewPointCloudColor(u)}},M=(n,a,P,u,d,C)=>__async(void 0,null,function*(){const f=w==null?void 0:w.url,v={[PointCloudView.Side]:()=>{syncSideViewByPoint(P,a,i,f,C)},[PointCloudView.Back]:()=>{r&&syncBackViewByPoint(P,a,r,f,C)},[PointCloudView.Top]:()=>{syncTopViewByPoint(P,a,o,e)}};Object.keys(v).forEach(m=>{m!==n&&v[m]()}),u&&(e==null||e.updateCameraZoom(u)),X(P)}),R=(n,a,P,u,d)=>__async(void 0,null,function*(){const C=w==null?void 0:w.url;d&&(yield t.syncAllViewPointCloudColor(d));const f={[PointCloudView.Side]:()=>{synchronizeSideView(P,a,i,C)},[PointCloudView.Back]:()=>{r&&synchronizeBackView(P,a,r,C)},[PointCloudView.Top]:()=>{synchronizeTopView(P,a,o,e)}};Object.keys(f).forEach(v=>{v!==n&&f[v]()}),u&&(e==null||e.updateCameraZoom(u)),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 a={left:-n.width/2,right:n.width/2,top:n.height/2,bottom:-n.height/2,near:100,far:-100};e.initOrthographicCamera(a),e.initRenderer(),e.render()},updatePointCloudData:(...n)=>__async(void 0,[...n],function*(a=w){var P,u,d,C,f,v;if(!(a==null?void 0:a.url)||!e)return;actionCreators.SetPointCloudLoading(F,!0),yield e.loadPCDFile(a.url,(P=L==null?void 0:L.radius)!=null?P:DEFAULT_RADIUS),h.forEach(U=>{e==null||e.removeObjectByName(U.id)}),g.forEach(U=>{e==null||e.removeObjectByName(U.id)});let m=[],b=[],B=[],D=[];w.result?(m=lbUtils.PointCloudUtils.getBoxParamsFromResultList(w.result),B=lbUtils.PointCloudUtils.getPolygonListFromResultList(w.result),b=lbUtils.PointCloudUtils.getLineListFromResultList(w.result),D=lbUtils.PointCloudUtils.getSphereParamsFromResultList(w.result),m.forEach(U=>{e==null||e.generateBox(U)}),D.forEach(U=>{e==null||e.generateSphere(U)}),t.syncAllViewPointCloudColor(m),t.setPointCloudResult(m),t.setPolygonList(B),t.setLineList(b),t.setPointCloudSphereList(D)):(t.setPointCloudResult([]),t.setPolygonList([]),t.setPointCloudSphereList([]),t.setLineList([])),V({pointCloudBoxList:m,polygonList:B,pointCloudSphereList:D}),e.updateTopCamera();const q=(d=(u=index.jsonParser(a.result))==null?void 0:u.valid)!=null?d:!0;t.setPointCloudValid(q),(C=t.sideViewInstance)==null||C.clearAllData(),(f=t.backViewInstance)==null||f.clearAllData(),o.updateData(a.url,a.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 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),PointCloudContext=require("../PointCloudContext.js"),_=require("lodash");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var ___default=_interopDefaultLegacy(_);const useSphere=()=>{const{pointCloudSphereList:e,setPointCloudSphereList:u,selectedID:i,mainViewInstance:r}=React.useContext(PointCloudContext.PointCloudContext),l=React.useMemo(()=>e.find(t=>t.id===i),[i,e]),d=React.useCallback(t=>e.find(n=>n.id===t),[e]),s=React.useCallback(t=>{const n=e.findIndex(o=>o.id===t.id);if(n>-1){e.splice(n,1,___default.default.merge(e[n],t));const o=___default.default.cloneDeep(e);return u(o),o}return e},[e]),c=React.useCallback(t=>{const n=e.filter(o=>o.id!==t);u(n),r==null||r.removeObjectByName(t),r==null||r.render()},[e]);return{selectedSphere:l,getPointCloudSphereByID:d,updatePointCloudSphere:s,deletePointCloudSphere:c}};exports.useSphere=useSphere;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),PointCloudContext=require("../PointCloudContext.js"),_=require("lodash"),useHistory=require("./useHistory.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var ___default=_interopDefaultLegacy(_);const useSphere=()=>{const{pointCloudSphereList:e,setPointCloudSphereList:u,selectedID:i,mainViewInstance:n}=React.useContext(PointCloudContext.PointCloudContext),{pushHistoryWithList:s}=useHistory.useHistory(),l=React.useMemo(()=>e.find(t=>t.id===i),[i,e]),d=React.useCallback(t=>e.find(o=>o.id===t),[e]),c=React.useCallback(t=>{const o=e.findIndex(r=>r.id===t.id);if(o>-1){e.splice(o,1,___default.default.merge(e[o],t));const r=___default.default.cloneDeep(e);return u(r),s({pointCloudSphereList:r}),r}return e},[e]),a=React.useCallback(t=>{const o=e.filter(r=>r.id!==t);u(o),n==null||n.removeObjectByName(t),n==null||n.render()},[e]);return{selectedSphere:l,getPointCloudSphereByID:d,updatePointCloudSphere:c,deletePointCloudSphere:a}};exports.useSphere=useSphere;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),PointCloudContext=require("../PointCloudContext.js"),lbAnnotation=require("@labelbee/lb-annotation"),useHistory=require("./useHistory.js");const{EToolName,EPolygonPattern}=lbAnnotation.cTool,useStatus=()=>{const{topViewInstance:i,sideViewInstance:r,backViewInstance:a,mainViewInstance:t,pointCloudBoxList:c,pointCloudSphereList:d,setPointCloudResult:P,setPointCloudSphereList:C,setPolygonList:v,pointCloudPattern:u,setPointCloudPattern:n,syncAllViewPointCloudColor:h}=React.useContext(PointCloudContext.PointCloudContext),{pushHistoryWithList:y}=useHistory.useHistory(),p=()=>{c.forEach(e=>{t==null||t.removeObjectByName(e.id)}),d.forEach(e=>{t==null||t.removeObjectByName(e.id)}),t==null||t.render(),P([]),v([]),C([]),i==null||i.toolScheduler.clearStatusAndResult(),h([]),y({pointCloudBoxList:[],polygonList:[]})},l=()=>{r==null||r.toolInstance.clearResult(),a==null||a.toolInstance.clearResult()};return{clearAllResult:p,updatePointCloudPattern:e=>{if(e===u)return;const s=[i,r,a];switch(e){case EToolName.Rect:l(),s.forEach(o=>{o==null||o.switchToCanvas(EToolName.PointCloudPolygon),o==null||o.toolInstance.setPattern(EPolygonPattern.Rect)}),n(EToolName.Rect);break;case EToolName.Polygon:l(),s.forEach(o=>{o==null||o.switchToCanvas(EToolName.PointCloudPolygon),o==null||o.toolInstance.setPattern(EPolygonPattern.Normal)}),n(EToolName.Polygon);break;case EToolName.Point:l(),s.forEach(o=>{o==null||o.switchToCanvas(EToolName.Point)}),n(EToolName.Point);break;case EToolName.Line:l(),s.forEach(o=>{o==null||o.switchToCanvas(EToolName.Line)}),n(EToolName.Line);break}},pointCloudPattern:u}};exports.useStatus=useStatus;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),PointCloudContext=require("../PointCloudContext.js"),lbAnnotation=require("@labelbee/lb-annotation"),useHistory=require("./useHistory.js");const{EToolName,EPolygonPattern}=lbAnnotation.cTool,useStatus=()=>{const{topViewInstance:i,sideViewInstance:r,backViewInstance:u,mainViewInstance:t,pointCloudBoxList:c,pointCloudSphereList:d,setPointCloudResult:P,setPointCloudSphereList:C,setPolygonList:v,pointCloudPattern:a,setPointCloudPattern:n,syncAllViewPointCloudColor:h}=React.useContext(PointCloudContext.PointCloudContext),{pushHistoryWithList:p}=useHistory.useHistory(),y=()=>{c.forEach(e=>{t==null||t.removeObjectByName(e.id)}),d.forEach(e=>{t==null||t.removeObjectByName(e.id)}),t==null||t.render(),P([]),v([]),C([]),i==null||i.toolScheduler.clearStatusAndResult(),h([]),p({pointCloudBoxList:[],polygonList:[],pointCloudSphereList:[]})},l=()=>{r==null||r.toolInstance.clearResult(),u==null||u.toolInstance.clearResult()};return{clearAllResult:y,updatePointCloudPattern:e=>{if(e===a)return;const s=[i,r,u];switch(e){case EToolName.Rect:l(),s.forEach(o=>{o==null||o.switchToCanvas(EToolName.PointCloudPolygon),o==null||o.toolInstance.setPattern(EPolygonPattern.Rect)}),n(EToolName.Rect);break;case EToolName.Polygon:l(),s.forEach(o=>{o==null||o.switchToCanvas(EToolName.PointCloudPolygon),o==null||o.toolInstance.setPattern(EPolygonPattern.Normal)}),n(EToolName.Polygon);break;case EToolName.Point:l(),s.forEach(o=>{o==null||o.switchToCanvas(EToolName.Point)}),n(EToolName.Point);break;case EToolName.Line:l(),s.forEach(o=>{o==null||o.switchToCanvas(EToolName.Line)}),n(EToolName.Line);break}},pointCloudPattern:a}};exports.useStatus=useStatus;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  interface IProps {
3
3
  src: string;
4
4
  result: string;
@@ -9,5 +9,5 @@ interface IProps {
9
9
  backgroundColor?: string;
10
10
  isOrthographicCamera?: boolean;
11
11
  }
12
- declare const PointCloudAnnotationView: (props: IProps) => JSX.Element;
12
+ declare const PointCloudAnnotationView: (props: IProps) => React.JSX.Element;
13
13
  export default PointCloudAnnotationView;
@@ -1,9 +1,9 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import { IStepInfo } from '@/types/step';
3
3
  interface IProps {
4
4
  stepList: IStepInfo[];
5
5
  currentStep: number;
6
6
  updateStep: (step: number) => void;
7
7
  }
8
- declare const AnnotationStepPopover: (props: IProps) => JSX.Element;
8
+ declare const AnnotationStepPopover: (props: IProps) => React.JSX.Element;
9
9
  export default AnnotationStepPopover;
@@ -13,6 +13,8 @@ interface IProps {
13
13
  noHeightLimit?: boolean;
14
14
  num?: number | string;
15
15
  style?: React.CSSProperties;
16
+ enableColorPicker?: boolean;
17
+ updateColorConfig?: (value: string, color: string) => void;
16
18
  }
17
19
  declare const AttributeList: React.ForwardRefExoticComponent<IProps & React.RefAttributes<unknown>>;
18
20
  export default AttributeList;
@@ -1,9 +1,9 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  interface IProps {
3
3
  selectedAttribute: string[];
4
4
  attributeChanged: () => void;
5
5
  num?: any;
6
6
  list?: any[];
7
7
  }
8
- declare const CheckboxList: (props: IProps) => JSX.Element;
8
+ declare const CheckboxList: (props: IProps) => React.JSX.Element;
9
9
  export default CheckboxList;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @file Color Palette
3
+ * @author lixinghua <lixinghua_vendor@sensetime.com>
4
+ * @date 2023.04.24
5
+ */
6
+ import React from 'react';
7
+ interface IProps {
8
+ defaultColor?: string;
9
+ setColor: (color: string) => void;
10
+ }
11
+ declare const Palette: (props: IProps) => React.JSX.Element;
12
+ export default Palette;
@@ -1,2 +1,2 @@
1
- /// <reference types="react" />
2
- export declare const ColorTag: ({ color, style }: any) => JSX.Element;
1
+ import React from 'react';
2
+ export declare const ColorTag: ({ color, style, onClick }: any) => React.JSX.Element;
@@ -5,5 +5,5 @@ interface IProps {
5
5
  iconChildren: React.ReactNode;
6
6
  marginLeft?: number;
7
7
  }
8
- declare const IconWithText: (props: IProps) => JSX.Element;
8
+ declare const IconWithText: (props: IProps) => React.JSX.Element;
9
9
  export default IconWithText;
@@ -4,8 +4,8 @@ export declare const viewportContext: React.Context<{
4
4
  width: number;
5
5
  height: number;
6
6
  }>;
7
- export declare const ViewportProviderComponent: (props: any) => JSX.Element;
8
- export declare const ViewportProvider: import("react-redux").ConnectedComponent<(props: any) => JSX.Element, import("react-redux").Omit<any, "annotation" | "dispatch">>;
7
+ export declare const ViewportProviderComponent: (props: any) => React.JSX.Element;
8
+ export declare const ViewportProvider: import("react-redux").ConnectedComponent<(props: any) => React.JSX.Element, import("react-redux").Omit<any, "annotation" | "dispatch">>;
9
9
  export declare const useViewport: () => {
10
10
  width: number;
11
11
  height: number;
@@ -11,5 +11,5 @@ export interface IFileErrorProps {
11
11
  fileType?: string;
12
12
  isError?: boolean;
13
13
  }
14
- declare const FileError: (props: IFileErrorProps) => JSX.Element;
14
+ declare const FileError: (props: IFileErrorProps) => React.JSX.Element;
15
15
  export default FileError;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import { IA2MapStateProps } from '@/store/annotation/map';
3
- declare const _default: import("react-redux").ConnectedComponent<({ currentData, config }: IA2MapStateProps) => JSX.Element, import("react-redux").Omit<IA2MapStateProps, "imgIndex" | "imgList" | "config" | "currentData" | "stepInfo" | "configString">>;
3
+ declare const _default: import("react-redux").ConnectedComponent<({ currentData, config }: IA2MapStateProps) => React.JSX.Element, import("react-redux").Omit<IA2MapStateProps, "imgIndex" | "imgList" | "config" | "currentData" | "stepInfo" | "configString">>;
4
4
  export default _default;
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import { IA2MapStateProps } from '@/store/annotation/map';
3
3
  interface IProps {
4
4
  checkMode?: boolean;
5
5
  }
6
- declare const _default: import("react-redux").ConnectedComponent<({ currentData, config, checkMode }: IA2MapStateProps & IProps) => JSX.Element, import("react-redux").Omit<IA2MapStateProps & IProps, "imgIndex" | "imgList" | "config" | "currentData" | "stepInfo" | "configString">>;
6
+ declare const _default: import("react-redux").ConnectedComponent<({ currentData, config, checkMode }: IA2MapStateProps & IProps) => React.JSX.Element, import("react-redux").Omit<IA2MapStateProps & IProps, "imgIndex" | "imgList" | "config" | "currentData" | "stepInfo" | "configString">>;
7
7
  export default _default;
@@ -3,8 +3,8 @@
3
3
  * @file Display selected box's infos
4
4
  * @createdate 2022-07-13
5
5
  */
6
- /// <reference types="react" />
7
6
  import { EPerspectiveView, IPointCloudConfig } from '@labelbee/lb-utils';
7
+ import React from 'react';
8
8
  /**
9
9
  * Display size info for views
10
10
  * @param param0
@@ -12,12 +12,12 @@ import { EPerspectiveView, IPointCloudConfig } from '@labelbee/lb-utils';
12
12
  */
13
13
  export declare const SizeInfoForView: ({ perspectiveView }: {
14
14
  perspectiveView: EPerspectiveView;
15
- }) => JSX.Element | null;
15
+ }) => React.JSX.Element | null;
16
16
  /**
17
17
  * Display selected box's infos
18
18
  */
19
19
  export declare const BoxInfos: ({ checkMode, config, }: {
20
20
  checkMode?: boolean | undefined;
21
21
  config: IPointCloudConfig;
22
- }) => JSX.Element | null;
23
- export declare const PointCloudValidity: () => JSX.Element | null;
22
+ }) => React.JSX.Element | null;
23
+ export declare const PointCloudValidity: () => React.JSX.Element | null;
@@ -1,3 +1,8 @@
1
- /// <reference types="react" />
2
- declare const EmptyPage: () => JSX.Element;
1
+ /**
2
+ * @file EmptyPage
3
+ * @createDate 2022-08-31
4
+ * @author Ron <ron.f.luo@gmail.com>
5
+ */
6
+ import React from 'react';
7
+ declare const EmptyPage: () => React.JSX.Element;
3
8
  export default EmptyPage;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import { IPointCloudConfig } from '@labelbee/lb-utils';
3
3
  import { AnnotationFileList } from '@/types/data';
4
4
  interface IProps {
@@ -9,5 +9,5 @@ interface IProps {
9
9
  imgList: AnnotationFileList;
10
10
  imgIndex: number;
11
11
  }
12
- declare const _default: import("react-redux").ConnectedComponent<({ id, visible, onCancel, config, imgList, imgIndex }: IProps) => JSX.Element, import("react-redux").Omit<IProps, "imgIndex">>;
12
+ declare const _default: import("react-redux").ConnectedComponent<({ id, visible, onCancel, config, imgList, imgIndex }: IProps) => React.JSX.Element, import("react-redux").Omit<IProps, "imgIndex">>;
13
13
  export default _default;
@@ -1,20 +1,22 @@
1
- import { IPointCloudBox, IPointCloudBoxList, IPolygonData, IPointUnit, ILine } from '@labelbee/lb-utils';
1
+ import { IPointCloudBox, IPointCloudBoxList, IPointCloudSphere, IPointCloudSphereList, IPolygonData, ILine } from '@labelbee/lb-utils';
2
2
  export declare const useHistory: () => {
3
- addHistory: ({ newBoxParams, newPolygon, newLine, }: {
3
+ addHistory: ({ newBoxParams, newPolygon, newLine, newSphereParams, }: {
4
4
  newBoxParams?: IPointCloudBox | undefined;
5
5
  newPolygon?: IPolygonData | undefined;
6
6
  newLine?: ILine | undefined;
7
+ newSphereParams?: IPointCloudSphere | undefined;
7
8
  }) => void;
8
9
  pushHistoryWithList: (params: Partial<{
9
10
  pointCloudBoxList: IPointCloudBoxList;
10
11
  polygonList: IPolygonData[];
11
12
  lineList: ILine[];
13
+ pointCloudSphereList: IPointCloudSphereList;
12
14
  }>) => void;
13
- initHistory: ({ pointCloudBoxList, polygonList, }: {
15
+ initHistory: ({ pointCloudBoxList, polygonList, pointCloudSphereList, }: {
14
16
  pointCloudBoxList: IPointCloudBoxList;
15
17
  polygonList: IPolygonData[];
18
+ pointCloudSphereList: IPointCloudSphereList;
16
19
  }) => void;
17
- pushHistoryUnderUpdatePoint: (point: IPointUnit) => void;
18
20
  pushHistoryUnderUpdatePolygon: (polygon: IPolygonData) => void;
19
21
  pushHistoryUnderUpdateLine: (line: ILine) => void;
20
22
  redo: () => void;
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  declare const _default: import("react-redux").ConnectedComponent<(props: {
3
3
  loading: boolean;
4
- }) => JSX.Element, import("react-redux").Omit<{
4
+ }) => React.JSX.Element, import("react-redux").Omit<{
5
5
  loading: boolean;
6
6
  }, "loading">>;
7
7
  export default _default;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import { IPointCloudBoxWithIndex } from '@/store/annotation/types';
3
3
  import { IFileItem } from '@/types/data';
4
4
  interface IProps {
@@ -6,5 +6,5 @@ interface IProps {
6
6
  predictionResultVisible: boolean;
7
7
  predictionResult: IPointCloudBoxWithIndex[];
8
8
  }
9
- declare const _default: import("react-redux").ConnectedComponent<(props: IProps) => JSX.Element | null, import("react-redux").Omit<IProps, "imgList" | "predictionResult" | "predictionResultVisible">>;
9
+ declare const _default: import("react-redux").ConnectedComponent<(props: IProps) => React.JSX.Element | null, import("react-redux").Omit<IProps, "imgList" | "predictionResult" | "predictionResultVisible">>;
10
10
  export default _default;
@@ -85,6 +85,6 @@ export declare class TagToolInstanceAdaptor extends React.Component<IVideoTagIns
85
85
  setResultFromImgList: (props: IVideoTagInstanceAdaptorProps) => void;
86
86
  /** Observer imgIndex and set tagResult */
87
87
  shouldComponentUpdate(props: IVideoTagInstanceAdaptorProps): boolean;
88
- render(): JSX.Element;
88
+ render(): React.JSX.Element;
89
89
  }
90
90
  export {};
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import { IVideoTagInstanceAdaptorProps } from './TagToolInstanceAdaptor';
3
3
  /**
4
4
  * I18n provider for InstanceAdaptorI18nProvider
@@ -6,4 +6,4 @@ import { IVideoTagInstanceAdaptorProps } from './TagToolInstanceAdaptor';
6
6
  */
7
7
  export declare const VideoTagTool: (props: IVideoTagInstanceAdaptorProps & {
8
8
  lang?: string;
9
- }) => JSX.Element;
9
+ }) => React.JSX.Element;
@@ -1,3 +1,3 @@
1
- /// <reference types="react" />
2
- declare const VideoController: () => JSX.Element;
1
+ import React from 'react';
2
+ declare const VideoController: () => React.JSX.Element;
3
3
  export default VideoController;
@@ -68,6 +68,6 @@ export declare class VideoPlayer extends React.Component<IVideoPlayerProps, IVid
68
68
  onError: () => void;
69
69
  componentDidMount(): void;
70
70
  componentWillUnmount(): void;
71
- render(): JSX.Element;
71
+ render(): React.JSX.Element;
72
72
  }
73
73
  export default VideoPlayer;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * transform rgba(a,g,b), to {r,g,b,a}
3
+ * @param color
4
+ */
5
+ export declare const toRGBAObj: (rgbStr: string | undefined) => {
6
+ r: number;
7
+ g: number;
8
+ b: number;
9
+ a: number;
10
+ } | undefined;
11
+ /**
12
+ * transform {a,g,b,a} to rgba{r,g,b,a}
13
+ * @param color
14
+ */
15
+ export declare const toRGBAStr: (color: {
16
+ r: number;
17
+ g: number;
18
+ b: number;
19
+ a: number;
20
+ }) => string;
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  interface IProps {
3
3
  tips?: string;
4
4
  path?: string;
5
5
  }
6
- declare const AnnotationTips: ({ path, tips }: IProps) => JSX.Element | null;
6
+ declare const AnnotationTips: ({ path, tips }: IProps) => React.JSX.Element | null;
7
7
  export default AnnotationTips;
@@ -1,3 +1,3 @@
1
- /// <reference types="react" />
2
- declare const clearIcon: () => JSX.Element;
1
+ import React from 'react';
2
+ declare const clearIcon: () => React.JSX.Element;
3
3
  export default clearIcon;
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import { ImgAttributeState } from '@/store/imgAttribute/types';
3
3
  interface IProps {
4
4
  imgAttribute: ImgAttributeState;
5
5
  }
6
- declare const _default: import("react-redux").ConnectedComponent<(props: IProps) => JSX.Element, import("react-redux").Omit<IProps, "imgAttribute">>;
6
+ declare const _default: import("react-redux").ConnectedComponent<(props: IProps) => React.JSX.Element, import("react-redux").Omit<IProps, "imgAttribute">>;
7
7
  export default _default;
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
2
1
  import { ToolInstance } from '@/store/annotation/types';
3
2
  import { AnnotationFileList } from '@/types/data';
4
3
  import { IStepInfo } from '@/types/step';
4
+ import React from 'react';
5
5
  /**
6
6
  * 检查当前数字是否为有效数字
7
7
  * @param value
@@ -16,5 +16,5 @@ interface IProps {
16
16
  imgIndex: number;
17
17
  stepList: IStepInfo[];
18
18
  }
19
- declare const _default: import("react-redux").ConnectedComponent<({ id, stepList, imgList, imgIndex, toolInstance }: IProps) => JSX.Element, import("react-redux").Omit<IProps, "stepList" | "imgIndex" | "imgList" | "toolInstance">>;
19
+ declare const _default: import("react-redux").ConnectedComponent<({ id, stepList, imgList, imgIndex, toolInstance }: IProps) => React.JSX.Element, import("react-redux").Omit<IProps, "stepList" | "imgIndex" | "imgList" | "toolInstance">>;
20
20
  export default _default;
@@ -7,8 +7,9 @@ interface IProps {
7
7
  toolInstance: ICustomToolInstance;
8
8
  imgList: IFileItem[];
9
9
  imgIndex: number;
10
+ stepList: IStepInfo[];
10
11
  }
11
12
  declare const _default: import("react-redux").ConnectedComponent<React.FC<IProps>, import("react-redux").Omit<IProps & {
12
13
  children?: React.ReactNode;
13
- }, "imgIndex" | "imgList" | "toolInstance" | "stepInfo">>;
14
+ }, "stepList" | "imgIndex" | "imgList" | "toolInstance" | "stepInfo">>;
14
15
  export default _default;
@@ -4,7 +4,7 @@ interface IProps {
4
4
  imgIndex: number;
5
5
  toolInstance: TagOperation;
6
6
  }
7
- export declare const expandIconFuc: ({ isActive }: any) => JSX.Element;
7
+ export declare const expandIconFuc: ({ isActive }: any) => React.JSX.Element;
8
8
  declare const _default: import("react-redux").ConnectedComponent<React.FC<IProps>, import("react-redux").Omit<IProps & {
9
9
  children?: React.ReactNode;
10
10
  }, "imgIndex" | "toolInstance">>;
@@ -1,9 +1,9 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  interface IProps {
3
3
  onChange: (value: string, isSubmit?: boolean) => void;
4
4
  textValue: string | undefined;
5
5
  checkString: string;
6
6
  textCheckType: number;
7
7
  }
8
- declare const TextAreaFormat: (props: IProps) => JSX.Element;
8
+ declare const TextAreaFormat: (props: IProps) => React.JSX.Element;
9
9
  export default TextAreaFormat;
@@ -5,7 +5,7 @@ interface ITextareaWithFooterProps {
5
5
  textareaProps?: any;
6
6
  footer?: any;
7
7
  }
8
- export declare const TextareaWithFooter: (props: ITextareaWithFooterProps) => JSX.Element;
8
+ export declare const TextareaWithFooter: (props: ITextareaWithFooterProps) => React.JSX.Element;
9
9
  interface IProps {
10
10
  dispatch: Function;
11
11
  toolInstance: TextToolOperation;
@@ -15,7 +15,7 @@ interface IProps {
15
15
  stepList: IStepInfo[];
16
16
  basicResultList: any[];
17
17
  }
18
- export declare const SingleTextInput: (props: any) => JSX.Element;
18
+ export declare const SingleTextInput: (props: any) => React.JSX.Element;
19
19
  declare const _default: import("react-redux").ConnectedComponent<React.FC<IProps>, import("react-redux").Omit<IProps & {
20
20
  children?: React.ReactNode;
21
21
  }, "stepList" | "step" | "imgIndex" | "basicResultList" | "toolInstance" | "triggerEventAfterIndexChanged" | "dispatch">>;
@@ -3,10 +3,10 @@
3
3
  * @author Glenfiddish <edwinlee0927@hotmail.com>
4
4
  * @createdate 2022-07-14
5
5
  */
6
- /// <reference types="react" />
7
6
  import { EToolName } from '@/data/enums/ToolType';
7
+ import React from 'react';
8
8
  export declare const ToolIcons: ({ toolName, selectedToolName, onChange, }: {
9
9
  toolName: string;
10
10
  selectedToolName?: string | undefined;
11
11
  onChange: (toolName: EToolName) => void;
12
- }) => JSX.Element;
12
+ }) => React.JSX.Element;
@@ -1,8 +1,8 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import { ToolStyleState } from '@/store/toolStyle/types';
3
3
  interface IProps {
4
4
  toolStyle: ToolStyleState;
5
5
  config: string;
6
6
  }
7
- declare const _default: import("react-redux").ConnectedComponent<(props: IProps) => JSX.Element, import("react-redux").Omit<IProps, "config" | "toolStyle">>;
7
+ declare const _default: import("react-redux").ConnectedComponent<(props: IProps) => React.JSX.Element, import("react-redux").Omit<IProps, "config" | "toolStyle">>;
8
8
  export default _default;
@@ -1,5 +1,5 @@
1
- /// <reference types="react" />
2
- export declare const AnnotatedAttributesPanel: () => JSX.Element;
3
- export declare const AnnotatedAttributesPanelFixedLeft: () => JSX.Element | null;
4
- export declare const AnnotatedAttributesPanelFixedRight: () => JSX.Element | null;
5
- export declare const AnnotatedAttributesIcon: () => JSX.Element | null;
1
+ import React from 'react';
2
+ export declare const AnnotatedAttributesPanel: () => React.JSX.Element;
3
+ export declare const AnnotatedAttributesPanelFixedLeft: () => React.JSX.Element | null;
4
+ export declare const AnnotatedAttributesPanelFixedRight: () => React.JSX.Element | null;
5
+ export declare const AnnotatedAttributesIcon: () => React.JSX.Element | null;
@@ -6,5 +6,5 @@ declare const FooterPopover: ({ hoverIcon, icon, containerStyle, content, title,
6
6
  containerStyle?: React.CSSProperties | undefined;
7
7
  content: React.ReactNode;
8
8
  title: string;
9
- }) => JSX.Element;
9
+ }) => React.JSX.Element;
10
10
  export default FooterPopover;
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import { ToolInstance } from '@/store/annotation/types';
3
3
  interface IProps {
4
4
  toolInstance: ToolInstance;
5
5
  }
6
- declare const _default: import("react-redux").ConnectedComponent<(props: IProps) => JSX.Element | null, import("react-redux").Omit<IProps, "toolInstance">>;
6
+ declare const _default: import("react-redux").ConnectedComponent<(props: IProps) => React.JSX.Element | null, import("react-redux").Omit<IProps, "toolInstance">>;
7
7
  export default _default;
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import { GraphToolInstance } from '@/store/annotation/types';
3
3
  interface IProps {
4
4
  toolInstance: GraphToolInstance;
5
5
  }
6
- declare const _default: import("react-redux").ConnectedComponent<(props: IProps) => JSX.Element | null, import("react-redux").Omit<IProps, "toolInstance">>;
6
+ declare const _default: import("react-redux").ConnectedComponent<(props: IProps) => React.JSX.Element | null, import("react-redux").Omit<IProps, "toolInstance">>;
7
7
  export default _default;
@@ -17,6 +17,6 @@ interface IPageProps {
17
17
  * @param props
18
18
  * @returns
19
19
  */
20
- export declare const PageInput: (props: IPageProps) => JSX.Element;
20
+ export declare const PageInput: (props: IPageProps) => React.JSX.Element;
21
21
  export declare const Pagination: React.FC<IPaginationProps>;
22
22
  export {};
@@ -17,7 +17,7 @@ interface IProps {
17
17
  skipBeforePageTurning?: (pageTurning: Function) => void;
18
18
  }
19
19
  export declare const footerCls: string;
20
- export declare const FooterDivider: () => JSX.Element;
20
+ export declare const FooterDivider: () => React.JSX.Element;
21
21
  declare const _default: import("react-redux").ConnectedComponent<React.FC<IProps>, import("react-redux").Omit<IProps & {
22
22
  children?: React.ReactNode;
23
23
  }, "stepList" | "step" | "imgIndex" | "basicResultList" | "basicIndex" | "skipBeforePageTurning" | "totalPage">>;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const toRGBAObj=t=>{if(!t)return;const e=t.replace(/[rgba()]/g,"").split(",");if(e){const[r,b,s,u]=e;return{r:Number(r),g:Number(b),b:Number(s),a:Number(u)}}},toRGBAStr=t=>`rgba(${t.r},${t.g},${t.b},${t.a})`;exports.toRGBAObj=toRGBAObj,exports.toRGBAStr=toRGBAStr;
@@ -1 +1 @@
1
- "use strict";var React=require("react"),icons=require("@ant-design/icons"),ToolIcons=require("../ToolIcons.js"),lbAnnotation=require("@labelbee/lb-annotation"),PointCloudContext=require("../../../../components/pointCloudView/PointCloudContext.js"),antd=require("antd"),StepUtils=require("../../../../utils/StepUtils.js"),reactRedux=require("react-redux"),index=require("../../../../utils/index.js"),useStatus=require("../../../../components/pointCloudView/hooks/useStatus.js"),useSingleBox=require("../../../../components/pointCloudView/hooks/useSingleBox.js"),reactI18next=require("react-i18next"),ctx=require("../../../../store/ctx.js"),index$1=require("./components/batchUpdateModal/index.js"),lbUtils=require("@labelbee/lb-utils"),index$2=require("../../../../components/attributeList/index.js"),useAttribute=require("../../../../components/pointCloudView/hooks/useAttribute.js");function _interopDefaultLegacy(l){return l&&typeof l=="object"&&"default"in l?l:{default:l}}var React__default=_interopDefaultLegacy(React);const AnnotatedBox=({imgList:l,imgIndex:i})=>{const s=React.useContext(PointCloudContext.PointCloudContext),[o,c]=React.useState([]),{t:r}=reactI18next.useTranslation();React.useEffect(()=>{const a=l;let t=new Map;c(lbUtils.PointCloudUtils.getAllPointCloudResult({imgList:a,extraBoxList:m,ignoreIndexList:[i]}).filter(n=>!n.trackID||t.get(n.trackID)?!1:(t.set(n.trackID,!0),!0)).sort((n,u)=>{var d,e;const p=(d=n==null?void 0:n.trackID)!=null?d:0,v=(e=u==null?void 0:u.trackID)!=null?e:0;return p-v}).map(n=>{var u;return(u=n==null?void 0:n.trackID)!=null?u:0}))},[s.pointCloudBoxList,l]);const{pointCloudBoxList:m}=s;return React__default.default.createElement("div",{style:{padding:24,borderBottom:"1px solid #eee"}},React__default.default.createElement("div",{style:{marginBottom:16}},r("AllTrackIDs")),React__default.default.createElement("div",null,o.map(a=>React__default.default.createElement(antd.Tag,{color:"#F3F4FF",key:a,style:{color:"#666",marginBottom:8}},a))))},BoxTrackIDInput=()=>{const[l,i]=React.useState(!1),{pointCloudBoxList:s}=React.useContext(PointCloudContext.PointCloudContext),{selectedBox:o,updateSelectedBox:c}=useSingleBox.useSingleBox(),[r,m]=React.useState(""),{t:a}=reactI18next.useTranslation(),t=o==null?void 0:o.info.trackID,n=d=>!!s.find(p=>p.trackID===d&&p.id!==(o==null?void 0:o.info.id)),u=(d=!1)=>{const e=parseInt(r,10);if(d&&i(!1),isNaN(e)){antd.message.error(a("PositiveIntegerCheck"));return}if(r.indexOf(".")>-1){antd.message.error(a("NotAllowDecimalPointsInTrackID"));return}if(n(e)){antd.message.error(a("DuplicateTrackIDsExist"));return}if(!(e>0)){antd.message.error(a("PositiveIntegerCheck"));return}c({trackID:e})};return React.useEffect(()=>{i(!1)},[t]),React__default.default.createElement("div",{style:{padding:24}},React__default.default.createElement("div",{style:{marginBottom:16,display:"flex",justifyContent:"space-between",alignItems:"center"}},React__default.default.createElement("span",null,a("CurrentBoxTrackIDs")),t&&React__default.default.createElement(index$1,{id:t})),React__default.default.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},l&&t?React__default.default.createElement(antd.Input,{defaultValue:t,onChange:d=>{m(d.target.value)},disabled:!t,size:"small",onBlur:()=>{u()},onPressEnter:()=>{u(!0)}}):React__default.default.createElement("span",null,t),React__default.default.createElement(icons.EditFilled,{style:{color:"#999",marginLeft:16,cursor:typeof t!="undefined"?"pointer":"not-allowed"},onClick:()=>{t&&i(!l)}})))},AttributeUpdater=({attributeList:l,subAttributeList:i,toolInstance:s})=>{const{selectedBox:o}=useSingleBox.useSingleBox(),c=React.useContext(PointCloudContext.PointCloudContext),{t:r}=reactI18next.useTranslation(),{defaultAttribute:m}=useAttribute.useAttribute(),a={fontWeight:500,fontSize:14,margin:"12px 0 8px 20px"},t={margin:"12px 20px 8px",fontSize:14,fontWeight:500,wordWrap:"break-word"},n=e=>{s.setDefaultAttribute(e)},u=(e,p)=>{s.setSubAttribute(e,p)},d=l.map(e=>({label:e.key,value:e.value,color:e==null?void 0:e.color}));return React__default.default.createElement("div",null,React__default.default.createElement("div",{style:a},r("Attribute")),React__default.default.createElement(index$2.default,{list:d,forbidDefault:!0,selectedAttribute:m!=null?m:"",attributeChanged:e=>n(e)}),React__default.default.createElement(antd.Divider,{style:{margin:0}}),o&&React__default.default.createElement(React__default.default.Fragment,null,i.map(e=>{var p,v,x,g,C;return(e==null?void 0:e.subSelected)&&React__default.default.createElement("div",{style:{marginTop:12},key:e.value},React__default.default.createElement("div",{style:t},r("SubAttribute"),"-",e.key),((p=e.subSelected)==null?void 0:p.length)<5?React__default.default.createElement(index$2.default,{list:e.subSelected.map(f=>({label:f.key,value:f.value})),selectedAttribute:(x=(v=c.selectedPointCloudBox)==null?void 0:v.subAttribute)==null?void 0:x[e.value],num:"-",forbidColor:!0,forbidDefault:!0,attributeChanged:f=>u(e.value,f),style:{marginBottom:12}}):React__default.default.createElement(antd.Select,{style:{margin:"0px 21px 17px 16px",width:"87%"},value:(C=(g=c.selectedPointCloudBox)==null?void 0:g.subAttribute)==null?void 0:C[e.value],placeholder:r("PleaseSelect"),onChange:f=>u(e.value,f),allowClear:!0},e.subSelected.map(f=>React__default.default.createElement(antd.Select.Option,{key:f.value,value:f.value},f.key))),React__default.default.createElement(antd.Divider,{style:{margin:0}}))})))},PointCloudToolSidebar=({stepInfo:l,toolInstance:i,imgList:s,imgIndex:o})=>{var c,r;const{updatePointCloudPattern:m,pointCloudPattern:a}=useStatus.useStatus(),t=index.jsonParser(l.config),n=(c=t==null?void 0:t.attributeList)!=null?c:[],u=(t==null?void 0:t.secondaryAttributeConfigurable)===!0?(r=t==null?void 0:t.inputList)!=null?r:[]:[];return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(ToolIcons.ToolIcons,{toolName:lbAnnotation.cTool.EPointCloudName.PointCloud,selectedToolName:a,onChange:d=>m==null?void 0:m(d)}),(t==null?void 0:t.trackConfigurable)===!0&&React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(AnnotatedBox,{imgList:s,imgIndex:o}),React__default.default.createElement(BoxTrackIDInput,null),React__default.default.createElement(antd.Divider,{style:{margin:0}})),React__default.default.createElement(AttributeUpdater,{toolInstance:i,attributeList:n,subAttributeList:u}))},mapStateToProps=l=>{var i,s,o;const c=StepUtils.getCurrentStepInfo((i=l.annotation)==null?void 0:i.step,(s=l.annotation)==null?void 0:s.stepList),r=(o=l.annotation)==null?void 0:o.toolInstance;return{stepInfo:c,toolInstance:r,imgList:l.annotation.imgList,imgIndex:l.annotation.imgIndex}};var PointCloudToolSidebar$1=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudToolSidebar);module.exports=PointCloudToolSidebar$1;
1
+ "use strict";var React=require("react"),icons=require("@ant-design/icons"),ToolIcons=require("../ToolIcons.js"),lbAnnotation=require("@labelbee/lb-annotation"),PointCloudContext=require("../../../../components/pointCloudView/PointCloudContext.js"),antd=require("antd"),StepUtils=require("../../../../utils/StepUtils.js"),reactRedux=require("react-redux"),index=require("../../../../utils/index.js"),useStatus=require("../../../../components/pointCloudView/hooks/useStatus.js"),useSingleBox=require("../../../../components/pointCloudView/hooks/useSingleBox.js"),reactI18next=require("react-i18next"),ctx=require("../../../../store/ctx.js"),index$1=require("./components/batchUpdateModal/index.js"),lbUtils=require("@labelbee/lb-utils"),index$2=require("../../../../components/attributeList/index.js"),useAttribute=require("../../../../components/pointCloudView/hooks/useAttribute.js"),actionCreators=require("../../../../store/annotation/actionCreators.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,r)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__spreadValues=(e,t)=>{for(var r in t||(t={}))__hasOwnProp.call(t,r)&&__defNormalProp(e,r,t[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(t))__propIsEnum.call(t,r)&&__defNormalProp(e,r,t[r]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));const AnnotatedBox=({imgList:e,imgIndex:t})=>{const r=React.useContext(PointCloudContext.PointCloudContext),[i,f]=React.useState([]),{t:s}=reactI18next.useTranslation();React.useEffect(()=>{const n=e;let a=new Map;f(lbUtils.PointCloudUtils.getAllPointCloudResult({imgList:n,extraBoxList:v,ignoreIndexList:[t]}).filter(l=>!l.trackID||a.get(l.trackID)?!1:(a.set(l.trackID,!0),!0)).sort((l,d)=>{var c,p;const g=(c=l==null?void 0:l.trackID)!=null?c:0,_=(p=d==null?void 0:d.trackID)!=null?p:0;return g-_}).map(l=>{var d;return(d=l==null?void 0:l.trackID)!=null?d:0}))},[r.pointCloudBoxList,e]);const{pointCloudBoxList:v}=r;return React__default.default.createElement("div",{style:{padding:24,borderBottom:"1px solid #eee"}},React__default.default.createElement("div",{style:{marginBottom:16}},s("AllTrackIDs")),React__default.default.createElement("div",null,i.map(n=>React__default.default.createElement(antd.Tag,{color:"#F3F4FF",key:n,style:{color:"#666",marginBottom:8}},n))))},BoxTrackIDInput=()=>{const[e,t]=React.useState(!1),{pointCloudBoxList:r}=React.useContext(PointCloudContext.PointCloudContext),{selectedBox:i,updateSelectedBox:f}=useSingleBox.useSingleBox(),[s,v]=React.useState(""),{t:n}=reactI18next.useTranslation(),a=i==null?void 0:i.info.trackID,l=c=>!!r.find(g=>g.trackID===c&&g.id!==(i==null?void 0:i.info.id)),d=(c=!1)=>{const p=parseInt(s,10);if(c&&t(!1),isNaN(p)){antd.message.error(n("PositiveIntegerCheck"));return}if(s.indexOf(".")>-1){antd.message.error(n("NotAllowDecimalPointsInTrackID"));return}if(l(p)){antd.message.error(n("DuplicateTrackIDsExist"));return}if(!(p>0)){antd.message.error(n("PositiveIntegerCheck"));return}f({trackID:p})};return React.useEffect(()=>{t(!1)},[a]),React__default.default.createElement("div",{style:{padding:24}},React__default.default.createElement("div",{style:{marginBottom:16,display:"flex",justifyContent:"space-between",alignItems:"center"}},React__default.default.createElement("span",null,n("CurrentBoxTrackIDs")),a&&React__default.default.createElement(index$1,{id:a})),React__default.default.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},e&&a?React__default.default.createElement(antd.Input,{defaultValue:a,onChange:c=>{v(c.target.value)},disabled:!a,size:"small",onBlur:()=>{d()},onPressEnter:()=>{d(!0)}}):React__default.default.createElement("span",null,a),React__default.default.createElement(icons.EditFilled,{style:{color:"#999",marginLeft:16,cursor:typeof a!="undefined"?"pointer":"not-allowed"},onClick:()=>{a&&t(!e)}})))},AttributeUpdater=({attributeList:e,subAttributeList:t,toolInstance:r,config:i,stepList:f,stepInfo:s})=>{const{selectedBox:v}=useSingleBox.useSingleBox(),n=React.useContext(PointCloudContext.PointCloudContext),{t:a}=reactI18next.useTranslation(),{defaultAttribute:l}=useAttribute.useAttribute(),d=ctx.useDispatch(),c={fontWeight:500,fontSize:14,margin:"12px 0 8px 20px"},p={margin:"12px 20px 8px",fontSize:14,fontWeight:500,wordWrap:"break-word"},g=(o,x)=>{var C,b,I,y,u;const E=(C=i==null?void 0:i.attributeList)==null?void 0:C.map(m=>m.value===o?__spreadProps(__spreadValues({},m),{color:x}):m),k=__spreadProps(__spreadValues({},i),{attributeList:E}),D=JSON.stringify(k),w=f==null?void 0:f.map(m=>(m==null?void 0:m.step)===(s==null?void 0:s.step)?__spreadProps(__spreadValues({},m),{config:D}):m);(b=n==null?void 0:n.topViewInstance)==null||b.updateAttributeList(E),(I=n==null?void 0:n.sideViewInstance)==null||I.updateAttributeList(E),(y=n==null?void 0:n.backViewInstance)==null||y.updateAttributeList(E),(u=n==null?void 0:n.mainViewInstance)==null||u.setConfig(k),d(actionCreators.SetTaskStepList({stepList:w}))},_=o=>{r.setDefaultAttribute(o)},S=(o,x)=>{r.setSubAttribute(o,x)},P=e.map(o=>({label:o.key,value:o.value,color:o==null?void 0:o.color}));return React__default.default.createElement("div",null,React__default.default.createElement("div",{style:c},a("Attribute")),React__default.default.createElement(index$2.default,{list:P,forbidDefault:!0,selectedAttribute:l!=null?l:"",attributeChanged:o=>_(o),updateColorConfig:g,enableColorPicker:!0}),React__default.default.createElement(antd.Divider,{style:{margin:0}}),v&&React__default.default.createElement(React__default.default.Fragment,null,t.map(o=>{var x,C,b,I,y;return(o==null?void 0:o.subSelected)&&React__default.default.createElement("div",{style:{marginTop:12},key:o.value},React__default.default.createElement("div",{style:p},a("SubAttribute"),"-",o.key),((x=o.subSelected)==null?void 0:x.length)<5?React__default.default.createElement(index$2.default,{list:o.subSelected.map(u=>({label:u.key,value:u.value})),selectedAttribute:(b=(C=n.selectedPointCloudBox)==null?void 0:C.subAttribute)==null?void 0:b[o.value],num:"-",forbidColor:!0,forbidDefault:!0,attributeChanged:u=>S(o.value,u),style:{marginBottom:12}}):React__default.default.createElement(antd.Select,{style:{margin:"0px 21px 17px 16px",width:"87%"},value:(y=(I=n.selectedPointCloudBox)==null?void 0:I.subAttribute)==null?void 0:y[o.value],placeholder:a("PleaseSelect"),onChange:u=>S(o.value,u),allowClear:!0},o.subSelected.map(u=>React__default.default.createElement(antd.Select.Option,{key:u.value,value:u.value},u.key))),React__default.default.createElement(antd.Divider,{style:{margin:0}}))})))},PointCloudToolSidebar=({stepInfo:e,toolInstance:t,imgList:r,imgIndex:i,stepList:f})=>{var s,v;const{updatePointCloudPattern:n,pointCloudPattern:a}=useStatus.useStatus(),l=index.jsonParser(e.config),d=(s=l==null?void 0:l.attributeList)!=null?s:[],c=(l==null?void 0:l.secondaryAttributeConfigurable)===!0?(v=l==null?void 0:l.inputList)!=null?v:[]:[];return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(ToolIcons.ToolIcons,{toolName:lbAnnotation.cTool.EPointCloudName.PointCloud,selectedToolName:a,onChange:p=>n==null?void 0:n(p)}),(l==null?void 0:l.trackConfigurable)===!0&&React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(AnnotatedBox,{imgList:r,imgIndex:i}),React__default.default.createElement(BoxTrackIDInput,null),React__default.default.createElement(antd.Divider,{style:{margin:0}})),React__default.default.createElement(AttributeUpdater,{toolInstance:t,attributeList:d,subAttributeList:c,config:l,stepList:f,stepInfo:e}))},mapStateToProps=e=>{var t,r,i,f;const s=StepUtils.getCurrentStepInfo((t=e.annotation)==null?void 0:t.step,(r=e.annotation)==null?void 0:r.stepList),v=(i=e.annotation)==null?void 0:i.toolInstance,n=(f=e.annotation)==null?void 0:f.stepList;return{stepInfo:s,toolInstance:v,imgList:e.annotation.imgList,imgIndex:e.annotation.imgIndex,stepList:n}};var PointCloudToolSidebar$1=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudToolSidebar);module.exports=PointCloudToolSidebar$1;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var PointCloudContext=require("../../../../components/pointCloudView/PointCloudContext.js"),antd=require("antd"),React=require("react"),selectors=require("../../../../store/annotation/selectors.js"),ctx=require("../../../../store/ctx.js"),lbUtils=require("@labelbee/lb-utils"),icons=require("@ant-design/icons"),useHistory=require("../../../../components/pointCloudView/hooks/useHistory.js"),dom=require("../../../../utils/dom.js"),StepUtils=require("../../../../utils/StepUtils.js"),lbAnnotation=require("@labelbee/lb-annotation"),reactI18next=require("react-i18next"),FooterPopover=require("../FooterPopover.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,n,t)=>n in e?__defProp(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,__spreadValues=(e,n)=>{for(var t in n||(n={}))__hasOwnProp.call(n,t)&&__defNormalProp(e,t,n[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(n))__propIsEnum.call(n,t)&&__defNormalProp(e,t,n[t]);return e},__spreadProps=(e,n)=>__defProps(e,__getOwnPropDescs(n));const AnnotatedAttributesItem=({attribute:e})=>{const n=React.useContext(PointCloudContext.PointCloudContext),{pointCloudBoxList:t,pointCloudSphereList:a,hideAttributes:s,toggleAttributesVisible:u,polygonList:o,setPolygonList:p,lineList:c,setLineList:i,setPointCloudResult:x,setPointCloudSphereList:y,reRender:b,selectSpecAttr:L}=n,[f,E]=React.useState(!0),{pushHistoryWithList:A}=useHistory.useHistory(),v=[...t,...o,...a,...c].filter(l=>l.attribute===e.value),g=()=>{u(e.value)},h=s.includes(e.value),_=({trackID:l,order:r})=>l||r,N=({trackID:l,order:r})=>l?`trackID_${l}`:`order_${r}`,O=l=>{if(v.length===0)return;const r=o.filter(d=>l!==d.attribute),m=t.filter(d=>l!==d.attribute),C=c.filter(d=>l!==d.attribute),P=a.filter(d=>l!==d.attribute);b(m,r,P,C),p(r),x(m),y(P),i(C),A({pointCloudBoxList:m,polygonList:r,lineList:C})},F=l=>{antd.Modal.confirm({content:lbUtils.i18n.t("onDeleteGraphByAttr",{attribute:l.key}),onOk:()=>{O(l.value)},okText:lbUtils.i18n.t("Confirm"),cancelText:lbUtils.i18n.t("Cancel")})};return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement("div",{className:dom.getClassName("annotated-attribute","item")},h?React__default.default.createElement(icons.EyeInvisibleFilled,{onClick:g}):React__default.default.createElement(icons.EyeFilled,{onClick:g}),React__default.default.createElement(icons.CaretDownFilled,{rotate:f?0:270,onClick:()=>{E(!f)}}),React__default.default.createElement("span",{className:dom.getClassName("annotated-attribute","item","text"),onClick:()=>{L(e.value)}},e.key),React__default.default.createElement(icons.DeleteOutlined,{onClick:()=>F(e)})),f&&v.map((l,r)=>React__default.default.createElement("div",{key:N(__spreadProps(__spreadValues({},l),{order:r})),style:{paddingLeft:54}},`${_(__spreadProps(__spreadValues({},l),{order:r}))}.${e.key}`)))},AnnotatedAttributesPanel=()=>{const e=ctx.useSelector(selectors.stepConfigSelector),{attrPanelLayout:n,setAttrPanelLayout:t,pointCloudBoxList:a,polygonList:s,lineList:u}=React.useContext(PointCloudContext.PointCloudContext),{t:o}=reactI18next.useTranslation(),p=React.useMemo(()=>[...a,...s,...u].map(i=>i.attribute),[a,s,u]),c=React.useMemo(()=>e.attributeList.filter(i=>p.includes(i.value)),[p]);return React__default.default.createElement("div",{className:dom.getClassName("annotated-attribute")},n?React__default.default.createElement("div",{className:dom.getClassName("annotated-attribute","text")},React__default.default.createElement("span",null,o("AnnotatedResult")),React__default.default.createElement("span",{className:dom.getClassName("annotated-attribute","pin"),onClick:()=>{t("")}},React__default.default.createElement(icons.PushpinFilled,null),o("CancelFixed"))):React__default.default.createElement("div",{className:dom.getClassName("annotated-attribute","text")},React__default.default.createElement("span",{onClick:()=>{t("left")},className:dom.getClassName("annotated-attribute","pin")},React__default.default.createElement(icons.PushpinFilled,null),o("FixedOnLeft")),React__default.default.createElement("span",{onClick:()=>{t("right")},className:dom.getClassName("annotated-attribute","pin")},React__default.default.createElement(icons.PushpinFilled,null),o("FixedOnRight"))),React__default.default.createElement("div",null,c.length>0?c.map(i=>React__default.default.createElement(AnnotatedAttributesItem,{attribute:i,key:i.value})):React__default.default.createElement("div",{style:{textAlign:"center",height:200,lineHeight:"200px"}},o("NoData"))))},AnnotatedAttributesPanelFixedLeft=()=>{const{attrPanelLayout:e}=React.useContext(PointCloudContext.PointCloudContext);return e==="left"?React__default.default.createElement(AnnotatedAttributesPanel,null):null},AnnotatedAttributesPanelFixedRight=()=>{const{attrPanelLayout:e}=React.useContext(PointCloudContext.PointCloudContext);return e==="right"?React__default.default.createElement(AnnotatedAttributesPanel,null):null},AnnotatedAttributesIcon=()=>{const{attrPanelLayout:e}=React.useContext(PointCloudContext.PointCloudContext),{t:n}=reactI18next.useTranslation(),t=ctx.useSelector(a=>{var s,u;return StepUtils.getCurrentStepInfo((s=a==null?void 0:a.annotation)==null?void 0:s.step,(u=a.annotation)==null?void 0:u.stepList)});return(t==null?void 0:t.tool)!==lbAnnotation.EPointCloudName.PointCloud||e?null:React__default.default.createElement(FooterPopover,{hoverIcon:React__default.default.createElement(icons.UnorderedListOutlined,{style:{marginRight:4}}),icon:React__default.default.createElement(icons.UnorderedListOutlined,{style:{marginRight:4}}),title:n("AnnotatedList"),content:React__default.default.createElement(AnnotatedAttributesPanel,null)})};exports.AnnotatedAttributesIcon=AnnotatedAttributesIcon,exports.AnnotatedAttributesPanel=AnnotatedAttributesPanel,exports.AnnotatedAttributesPanelFixedLeft=AnnotatedAttributesPanelFixedLeft,exports.AnnotatedAttributesPanelFixedRight=AnnotatedAttributesPanelFixedRight;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var PointCloudContext=require("../../../../components/pointCloudView/PointCloudContext.js"),antd=require("antd"),React=require("react"),selectors=require("../../../../store/annotation/selectors.js"),ctx=require("../../../../store/ctx.js"),lbUtils=require("@labelbee/lb-utils"),icons=require("@ant-design/icons"),useHistory=require("../../../../components/pointCloudView/hooks/useHistory.js"),dom=require("../../../../utils/dom.js"),StepUtils=require("../../../../utils/StepUtils.js"),lbAnnotation=require("@labelbee/lb-annotation"),reactI18next=require("react-i18next"),FooterPopover=require("../FooterPopover.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,n,t)=>n in e?__defProp(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,__spreadValues=(e,n)=>{for(var t in n||(n={}))__hasOwnProp.call(n,t)&&__defNormalProp(e,t,n[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(n))__propIsEnum.call(n,t)&&__defNormalProp(e,t,n[t]);return e},__spreadProps=(e,n)=>__defProps(e,__getOwnPropDescs(n));const AnnotatedAttributesItem=({attribute:e})=>{const n=React.useContext(PointCloudContext.PointCloudContext),{pointCloudBoxList:t,pointCloudSphereList:o,hideAttributes:i,toggleAttributesVisible:s,polygonList:c,setPolygonList:u,lineList:p,setLineList:f,setPointCloudResult:a,setPointCloudSphereList:y,reRender:L,selectSpecAttr:b}=n,[m,E]=React.useState(!0),{pushHistoryWithList:A}=useHistory.useHistory(),P=[...t,...c,...o,...p].filter(l=>l.attribute===e.value),x=()=>{s(e.value)},h=i.includes(e.value),_=({trackID:l,order:r})=>l||r,N=({trackID:l,order:r})=>l?`trackID_${l}`:`order_${r}`,O=l=>{if(P.length===0)return;const r=c.filter(d=>l!==d.attribute),C=t.filter(d=>l!==d.attribute),v=p.filter(d=>l!==d.attribute),g=o.filter(d=>l!==d.attribute);L(C,r,g,v),u(r),a(C),y(g),f(v),A({pointCloudBoxList:C,polygonList:r,lineList:v,pointCloudSphereList:g})},F=l=>{antd.Modal.confirm({content:lbUtils.i18n.t("onDeleteGraphByAttr",{attribute:l.key}),onOk:()=>{O(l.value)},okText:lbUtils.i18n.t("Confirm"),cancelText:lbUtils.i18n.t("Cancel")})};return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement("div",{className:dom.getClassName("annotated-attribute","item")},h?React__default.default.createElement(icons.EyeInvisibleFilled,{onClick:x}):React__default.default.createElement(icons.EyeFilled,{onClick:x}),React__default.default.createElement(icons.CaretDownFilled,{rotate:m?0:270,onClick:()=>{E(!m)}}),React__default.default.createElement("span",{className:dom.getClassName("annotated-attribute","item","text"),onClick:()=>{b(e.value)}},e.key),React__default.default.createElement(icons.DeleteOutlined,{onClick:()=>F(e)})),m&&P.map((l,r)=>React__default.default.createElement("div",{key:N(__spreadProps(__spreadValues({},l),{order:r})),style:{paddingLeft:54}},`${_(__spreadProps(__spreadValues({},l),{order:r}))}.${e.key}`)))},AnnotatedAttributesPanel=()=>{const e=ctx.useSelector(selectors.stepConfigSelector),{attrPanelLayout:n,setAttrPanelLayout:t,pointCloudBoxList:o,pointCloudSphereList:i,polygonList:s,lineList:c}=React.useContext(PointCloudContext.PointCloudContext),{t:u}=reactI18next.useTranslation(),p=React.useMemo(()=>[...o,...i,...s,...c].map(a=>a.attribute),[o,i,s,c]),f=React.useMemo(()=>e.attributeList.filter(a=>p.includes(a.value)),[p]);return React__default.default.createElement("div",{className:dom.getClassName("annotated-attribute")},n?React__default.default.createElement("div",{className:dom.getClassName("annotated-attribute","text")},React__default.default.createElement("span",null,u("AnnotatedResult")),React__default.default.createElement("span",{className:dom.getClassName("annotated-attribute","pin"),onClick:()=>{t("")}},React__default.default.createElement(icons.PushpinFilled,null),u("CancelFixed"))):React__default.default.createElement("div",{className:dom.getClassName("annotated-attribute","text")},React__default.default.createElement("span",{onClick:()=>{t("left")},className:dom.getClassName("annotated-attribute","pin")},React__default.default.createElement(icons.PushpinFilled,null),u("FixedOnLeft")),React__default.default.createElement("span",{onClick:()=>{t("right")},className:dom.getClassName("annotated-attribute","pin")},React__default.default.createElement(icons.PushpinFilled,null),u("FixedOnRight"))),React__default.default.createElement("div",null,f.length>0?f.map(a=>React__default.default.createElement(AnnotatedAttributesItem,{attribute:a,key:a.value})):React__default.default.createElement("div",{style:{textAlign:"center",height:200,lineHeight:"200px"}},u("NoData"))))},AnnotatedAttributesPanelFixedLeft=()=>{const{attrPanelLayout:e}=React.useContext(PointCloudContext.PointCloudContext);return e==="left"?React__default.default.createElement(AnnotatedAttributesPanel,null):null},AnnotatedAttributesPanelFixedRight=()=>{const{attrPanelLayout:e}=React.useContext(PointCloudContext.PointCloudContext);return e==="right"?React__default.default.createElement(AnnotatedAttributesPanel,null):null},AnnotatedAttributesIcon=()=>{const{attrPanelLayout:e}=React.useContext(PointCloudContext.PointCloudContext),{t:n}=reactI18next.useTranslation(),t=ctx.useSelector(o=>{var i,s;return StepUtils.getCurrentStepInfo((i=o==null?void 0:o.annotation)==null?void 0:i.step,(s=o.annotation)==null?void 0:s.stepList)});return(t==null?void 0:t.tool)!==lbAnnotation.EPointCloudName.PointCloud||e?null:React__default.default.createElement(FooterPopover,{hoverIcon:React__default.default.createElement(icons.UnorderedListOutlined,{style:{marginRight:4}}),icon:React__default.default.createElement(icons.UnorderedListOutlined,{style:{marginRight:4}}),title:n("AnnotatedList"),content:React__default.default.createElement(AnnotatedAttributesPanel,null)})};exports.AnnotatedAttributesIcon=AnnotatedAttributesIcon,exports.AnnotatedAttributesPanel=AnnotatedAttributesPanel,exports.AnnotatedAttributesPanelFixedLeft=AnnotatedAttributesPanelFixedLeft,exports.AnnotatedAttributesPanelFixedRight=AnnotatedAttributesPanelFixedRight;
@@ -1 +1 @@
1
- import{COLORS_ARRAY as n,NULL_COLOR as g}from"../../data/Style.js";import{ColorTag as R}from"../colorTag/index.js";import{Radio as f}from"antd/es";import l from"react";const c=[g].concat(n),v=l.forwardRef((e,d)=>{const s=l.useRef(),b=e.list||[];let o=[...c];e.forbidDefault===!0&&(o=o.slice(1));let i="sensebee-radio-group";return e.noHeightLimit&&(i="sensebee-radio-group-no-limit-height"),l.createElement("div",{className:i,style:e.style},l.createElement(f.Group,{name:"radiogroup",defaultValue:e==null?void 0:e.selectedAttribute,value:e==null?void 0:e.selectedAttribute,onChange:t=>e.attributeChanged(t.target.value),ref:d},b.map((t,r)=>{var u;let a=(u=e==null?void 0:e.num)!=null?u:r;e.forbidDefault===!0&&typeof a=="number"&&a++,typeof a=="number"&&a<=9&&a>=0||(a="-");let m=r>8&&!e.forbidDefault?n[(r-1)%n.length]:o[r%o.length];return(t==null?void 0:t.color)&&(m=t.color),l.createElement(f,{value:t.value,ref:s,key:r},l.createElement("span",{className:"sensebee-radio-label",title:t.label},!(e==null?void 0:e.forbidColor)&&l.createElement(R,{color:m,style:{marginRight:"8px"}}),t.label),l.createElement("span",{className:"sensebee-radio-num"},a))})))});export{c as ATTRIBUTE_COLORS,v as default};
1
+ import{COLORS_ARRAY as c,NULL_COLOR as T}from"../../data/Style.js";import{ColorTag as L}from"../colorTag/index.js";import{Radio as m}from"antd/es";import t,{useState as d}from"react";import{Popover as A}from"antd";import P from"../colorPalette/index.js";import{CloseOutlined as _}from"@ant-design/icons";import{useTranslation as I}from"react-i18next";const b=[T].concat(c),N=t.forwardRef((e,C)=>{const g=t.useRef(),{t:v}=I(),E=e.list||[],[R,r]=d(!1),[h,y]=d(void 0);let n=[...b];e.forbidDefault===!0&&(n=n.slice(1));let s="sensebee-radio-group";e.noHeightLimit&&(s="sensebee-radio-group-no-limit-height");const O=(l,a)=>{e.updateColorConfig&&e.updateColorConfig(l,a)};return t.createElement("div",{className:s,style:e.style},t.createElement(m.Group,{name:"radiogroup",defaultValue:e==null?void 0:e.selectedAttribute,value:e==null?void 0:e.selectedAttribute,onChange:l=>e.attributeChanged(l.target.value),ref:C},E.map((l,a)=>{var f;let o=(f=e==null?void 0:e.num)!=null?f:a;e.forbidDefault===!0&&typeof o=="number"&&o++,typeof o=="number"&&o<=9&&o>=0||(o="-");let u=a>8&&!e.forbidDefault?c[(a-1)%c.length]:n[a%n.length];return(l==null?void 0:l.color)&&(u=l.color),t.createElement(m,{value:l.value,ref:g,key:l.label+a},t.createElement("span",{className:"sensebee-radio-label",title:l.label},!(e==null?void 0:e.forbidColor)&&t.createElement(A,{content:t.createElement(P,{defaultColor:u,setColor:i=>O(l.value,i)}),title:t.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},t.createElement("span",null,v("Palette")),t.createElement(_,{onClick:()=>r(!1)})),visible:R&&h===a,onVisibleChange:i=>{!i||r(i)}},t.createElement(L,{color:u,style:{cursor:"pointer",marginRight:"8px"},onClick:()=>{(e==null?void 0:e.enableColorPicker)&&(y(a),r(!0))}})),l.label),t.createElement("span",{className:"sensebee-radio-num"},o))})))});export{b as ATTRIBUTE_COLORS,N as default};
@@ -0,0 +1 @@
1
+ import c from"react";import{RgbaColorPicker as a}from"react-colorful";import{toRGBAObj as s,toRGBAStr as m}from"../../utils/colorUtils.js";const n=o=>{const{setColor:t,defaultColor:r}=o;return c.createElement(a,{color:s(r),onChange:e=>{const l=m(e);t(l)}})};export{n as default};
@@ -1 +1 @@
1
- import l from"react";var i=Object.defineProperty,o=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,p=Object.prototype.propertyIsEnumerable,a=(t,r,e)=>r in t?i(t,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[r]=e,c=(t,r)=>{for(var e in r||(r={}))n.call(r,e)&&a(t,e,r[e]);if(o)for(var e of o(r))p.call(r,e)&&a(t,e,r[e]);return t};const _=({color:t,style:r})=>l.createElement("div",{style:c({display:"inline-block",height:14,width:14,backgroundColor:t,verticalAlign:"middle"},r)});export{_ as ColorTag};
1
+ import l from"react";var i=Object.defineProperty,o=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,p=Object.prototype.propertyIsEnumerable,a=(t,r,e)=>r in t?i(t,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[r]=e,c=(t,r)=>{for(var e in r||(r={}))n.call(r,e)&&a(t,e,r[e]);if(o)for(var e of o(r))p.call(r,e)&&a(t,e,r[e]);return t};const _=({color:t,style:r,onClick:e})=>l.createElement("div",{style:c({display:"inline-block",height:14,width:14,backgroundColor:t,verticalAlign:"middle"},r),onClick:e});export{_ as ColorTag};
@@ -1 +1 @@
1
- import{useContext as j}from"react";import{PointCloudContext as E}from"../PointCloudContext.js";var R=Object.defineProperty,P=Object.getOwnPropertySymbols,S=Object.prototype.hasOwnProperty,V=Object.prototype.propertyIsEnumerable,h=(n,s,r)=>s in n?R(n,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[s]=r,g=(n,s)=>{for(var r in s||(s={}))S.call(s,r)&&h(n,r,s[r]);if(P)for(var r of P(s))V.call(s,r)&&h(n,r,s[r]);return n};const b=()=>{const{history:n,setPointCloudResult:s,setSelectedIDs:r,pointCloudBoxList:l,pointCloudSphereList:x,mainViewInstance:p,topViewInstance:L,polygonList:u,setPolygonList:f,lineList:c,setLineList:a,syncAllViewPointCloudColor:v}=j(E),H=({newBoxParams:t,newPolygon:o,newLine:i})=>{const e={pointCloudBoxList:l,polygonList:u,lineList:c};t&&(e.pointCloudBoxList=l.concat(t)),o&&(e.polygonList=u.concat(o)),i&&(e.lineList=c.concat(i)),n.pushHistory(e)},_=t=>{const o={pointCloudBoxList:l,polygonList:u,lineList:c};t.pointCloudBoxList&&(o.pointCloudBoxList=t.pointCloudBoxList),t.polygonList&&(o.polygonList=t.polygonList),t.lineList&&(o.lineList=t.lineList),n.pushHistory(o)},w=t=>{if(c.find(i=>i.id===t.id)){const i=c.map(e=>e.id===t.id?t:g({},e));n.pushHistory({lineList:i}),a(i)}},B=t=>{t&&n.pushHistory({pointCloudSphereList:x})},O=t=>{if(u.find(i=>i.id===t.id)){const i=u.map(e=>e.id===t.id?t:g({},e));n.pushHistory({pointCloudBoxList:l,polygonList:i}),f(i)}},m=({pointCloudBoxList:t,polygonList:o})=>{n.initRecord({pointCloudBoxList:t,polygonList:o},!0)},C=t=>{if(!t)return;const{pointCloudBoxList:o=[],polygonList:i=[],lineList:e=[]}=t;if(o){l.length!==o.length&&r();const U=l.filter(d=>o.every(y=>y.id!==d.id)),I=o.filter(d=>l.every(y=>y.id!==d.id));U.forEach(d=>{p==null||p.removeObjectByName(d.id)}),I.forEach(d=>{p==null||p.generateBox(d)}),s(o),v(o)}i&&f(i),e&&a(e),L==null||L.updatePolygonList(o!=null?o:[],i!=null?i:[]),L==null||L.updateLineList(e!=null?e:[])};return{addHistory:H,pushHistoryWithList:_,initHistory:m,pushHistoryUnderUpdatePoint:B,pushHistoryUnderUpdatePolygon:O,pushHistoryUnderUpdateLine:w,redo:()=>{C(n.redo())},undo:()=>{C(n.undo())}}};export{b as useHistory};
1
+ import{useContext as I}from"react";import{PointCloudContext as b}from"../PointCloudContext.js";var R=Object.defineProperty,x=Object.getOwnPropertySymbols,U=Object.prototype.hasOwnProperty,V=Object.prototype.propertyIsEnumerable,S=(e,s,l)=>s in e?R(e,s,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[s]=l,_=(e,s)=>{for(var l in s||(s={}))U.call(s,l)&&S(e,l,s[l]);if(x)for(var l of x(s))V.call(s,l)&&S(e,l,s[l]);return e};const N=()=>{const{history:e,setPointCloudResult:s,setSelectedIDs:l,pointCloudBoxList:p,pointCloudSphereList:c,setPointCloudSphereList:B,mainViewInstance:u,topViewInstance:C,polygonList:f,setPolygonList:a,lineList:y,setLineList:g,syncAllViewPointCloudColor:w}=I(b),H=({newBoxParams:t,newPolygon:o,newLine:i,newSphereParams:r})=>{const d={pointCloudBoxList:p,polygonList:f,lineList:y,pointCloudSphereList:c};t&&(d.pointCloudBoxList=p.concat(t)),o&&(d.polygonList=f.concat(o)),i&&(d.lineList=y.concat(i)),r&&(d.pointCloudSphereList=c.concat(r)),e.pushHistory(d)},O=t=>{const o={pointCloudBoxList:p,polygonList:f,lineList:y,pointCloudSphereList:c};t.pointCloudBoxList&&(o.pointCloudBoxList=t.pointCloudBoxList),t.polygonList&&(o.polygonList=t.polygonList),t.lineList&&(o.lineList=t.lineList),t.pointCloudSphereList&&(o.pointCloudSphereList=t.pointCloudSphereList),e.pushHistory(o)},m=t=>{if(y.find(i=>i.id===t.id)){const i=y.map(r=>r.id===t.id?t:_({},r));e.pushHistory({lineList:i}),g(i)}},E=t=>{if(f.find(i=>i.id===t.id)){const i=f.map(r=>r.id===t.id?t:_({},r));e.pushHistory({pointCloudBoxList:p,polygonList:i}),a(i)}},j=({pointCloudBoxList:t,polygonList:o,pointCloudSphereList:i})=>{e.initRecord({pointCloudBoxList:t,polygonList:o,pointCloudSphereList:i},!0)},v=t=>{if(!t)return;const{pointCloudBoxList:o=[],polygonList:i=[],lineList:r=[],pointCloudSphereList:d=[]}=t;if(o){p.length!==o.length&&l();const h=p.filter(n=>o.every(L=>L.id!==n.id)),P=o.filter(n=>p.every(L=>L.id!==n.id));h.forEach(n=>{u==null||u.removeObjectByName(n.id)}),P.forEach(n=>{u==null||u.generateBox(n)}),s(o),w(o)}if(d){c.length!==d.length&&l();let h=c.filter(n=>d.every(L=>L.id!==n.id)),P=d.filter(n=>c.every(L=>L.id!==n.id));h.forEach(n=>{u==null||u.removeObjectByName(n.id)}),P.forEach(n=>{u==null||u.generateSphere(n)}),B(d)}i&&a(i),r&&g(r),C==null||C.updatePolygonList(o!=null?o:[],i!=null?i:[]),C==null||C.updateLineList(r!=null?r:[])};return{addHistory:H,pushHistoryWithList:O,initHistory:j,pushHistoryUnderUpdatePolygon:E,pushHistoryUnderUpdateLine:m,redo:()=>{v(e.redo())},undo:()=>{v(e.undo())}}};export{N as useHistory};
@@ -1 +1 @@
1
- import{MathUtils as x,getCuboidFromPointCloudBox as Vt}from"@labelbee/lb-annotation";import{EPerspectiveView as N,PointCloudUtils as I,DEFAULT_SPHERE_PARAMS as Ut}from"@labelbee/lb-utils";import{useContext as kt}from"react";import{PointCloudContext as At}from"../PointCloudContext.js";import{useSingleBox as st}from"./useSingleBox.js";import{useSphere as jt}from"./useSphere.js";import{useSelector as Tt,useDispatch as zt}from"../../../store/ctx.js";import Rt from"../../../utils/StepUtils.js";import{jsonParser as rt}from"../../../utils/index.js";import{SetPointCloudLoading as dt}from"../../../store/annotation/actionCreators.js";import{message as Et}from"antd";import{useTranslation as Ht}from"react-i18next";import{useHistory as Ft}from"./useHistory.js";import{usePolygon as Nt}from"./usePolygon.js";var Wt=Object.defineProperty,Zt=Object.defineProperties,Mt=Object.getOwnPropertyDescriptors,lt=Object.getOwnPropertySymbols,Gt=Object.prototype.hasOwnProperty,Xt=Object.prototype.propertyIsEnumerable,at=(t,e,n)=>e in t?Wt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,L=(t,e)=>{for(var n in e||(e={}))Gt.call(e,n)&&at(t,n,e[n]);if(lt)for(var n of lt(e))Xt.call(e,n)&&at(t,n,e[n]);return t},V=(t,e)=>Zt(t,Mt(e)),q=(t,e,n)=>new Promise((r,o)=>{var c=d=>{try{s(n.next(d))}catch(g){o(g)}},p=d=>{try{s(n.throw(d))}catch(g){o(g)}},s=d=>d.done?r(d.value):Promise.resolve(d.value).then(c,p);s((n=n.apply(t,e)).next())});const G=5,X=90,y={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},J=(t,e,n,r,o)=>{const{x:c,y:p}=I.transferCanvas2World(t,e),{defaultZ:s}=Ut,d={center:{x:c,y:p,z:s},id:t.id},g=r?L(L({},r),d):V(L({},d),{attribute:"",valid:!0});return o&&Object.assign(g,o),g},K=(t,e,n,r,o,c)=>{let p=t.pointList.map(m=>I.transferCanvas2World(m,e)),s=0,d=1,g={};if(n){const m=n.getSensesPointZAxisInPolygon(p,void 0,c);c&&m.fittedCoordinates.length>0&&(p=m.fittedCoordinates),s=(m.maxZ+m.minZ)/2,d=m.maxZ-m.minZ,g={count:m.zCount}}const[P,B,H]=p,U=x.getLineCenterPoint([P,H]),T=x.getLineLength(P,B),z=x.getLineLength(B,H),R=x.getRadiusFromQuadrangle(t.pointList);r&&(s=r.center.z,d=r.depth);const k={center:{x:U.x,y:U.y,z:s},width:z,height:T,depth:d,rotation:R,id:t.id},A=L(r?L(L({},r),k):V(L({},k),{attribute:"",valid:!0}),g);o&&Object.assign(A,o);const j=p.map(m=>I.transferWorld2Canvas(m,e));return{boxParams:A,newPointList:j}},ct=(t,e,n)=>{const r={x:t.x-e.x,y:t.y-e.y};return V(L({},n),{center:{x:n.center.x-r.x,y:n.center.y,z:n.center.z-r.y}})},ut=(t,e,n,r)=>{const[o,c,p]=t.pointList,[s,d,g]=e.pointList,P=x.getLineCenterPoint([o,p]),B=x.getLineCenterPoint([s,g]),U={x:{x:P.x-B.x,y:P.y-B.y}.x,y:0,z:P.y-B.y},T=x.getLineLength(o,c),z=x.getLineLength(s,d),R=T-z,k=x.getLineLength(c,p),A=x.getLineLength(d,g),j=k-A,{newBoxParams:m}=r.getNewBoxBySideUpdate(U,j,R,n);return m},Yt=(t,e,n)=>{const r={x:t.x-e.x,y:t.y-e.y};return V(L({},n),{center:{x:n.center.x,y:n.center.y-r.x,z:n.center.z-r.y}})},Qt=(t,e,n,r)=>{const[o,c,p]=t.pointList,[s,d,g]=e.pointList,P=x.getLineCenterPoint([o,p]),B=x.getLineCenterPoint([s,g]),U={x:{x:P.x-B.x,y:P.y-B.y}.x,y:0,z:P.y-B.y},T=x.getLineLength(o,c),z=x.getLineLength(s,d),R=T-z,k=x.getLineLength(c,p),A=x.getLineLength(d,g),j=k-A;let{newBoxParams:m}=r.getNewBoxByBackUpdate(U,j,R,n);return m},pt=(t,e,n,r,o)=>{var c;if(!n)return;const{toolInstance:p,pointCloudInstance:s}=n;s.loadPCDFile(r,(c=o==null?void 0:o.radius)!=null?c:X);const{cameraPositionVector:d}=s.updateOrthoCameraBySphere(t,N.Left);s.setInitCameraPosition(d);const{point2d:g,zoom:P}=s.getSphereSidePoint2DCoordinate(t);s.camera.zoom=P,s.camera.updateProjectionMatrix(),s.render(),p.initPosition(),p.zoomChangeOnCenter(P),p.setResult([V(L(L({},e),g),{valid:t.valid,textAttribute:"",attribute:t.attribute})]),p.setSelectedID(e.id)},ft=(t,e,n,r)=>{if(!n)return;const{pointCloud2dOperation:o,pointCloudInstance:c}=n;c.loadPCDFileByBox(r,t,{width:G,depth:G});const{cameraPositionVector:p}=c.updateOrthoCamera(t,N.Left);c.setInitCameraPosition(p);const{polygon2d:s,zoom:d}=c.getBoxSidePolygon2DCoordinate(t);c.camera.zoom=d,c.camera.updateProjectionMatrix(),c.render(),o.initPosition(),o.zoomChangeOnCenter(d),o.setResultAndSelectedID([{id:e.id,valid:t.valid,pointList:s,textAttribute:"",isRect:!0,attribute:t.attribute}],e.id)},Ct=(t,e,n,r,o)=>{var c;if(!n)return;const{toolInstance:p,pointCloudInstance:s}=n;s.loadPCDFile(r,(c=o==null?void 0:o.radius)!=null?c:X);const{cameraPositionVector:d}=s.updateOrthoCameraBySphere(t,N.Back);s.setInitCameraPosition(d);const{point2d:g,zoom:P}=s.getSphereBackPoint2DCoordinate(t);s.camera.zoom=P,s.camera.updateProjectionMatrix(),s.render(),p.initPosition(),p.zoomChangeOnCenter(P),p.setResult([V(L(L({},e),g),{valid:t.valid,textAttribute:"",attribute:t.attribute})]),p.setSelectedID(e.id)},gt=(t,e,n,r)=>{if(!n)return;const{pointCloud2dOperation:o,pointCloudInstance:c}=n;c.loadPCDFileByBox(r,t,{height:G,depth:G});const{cameraPositionVector:p}=c.updateOrthoCamera(t,N.Back);c.setInitCameraPosition(p);const{polygon2d:s,zoom:d}=c.getBoxBackPolygon2DCoordinate(t);c.camera.zoom=d,c.camera.updateProjectionMatrix(),c.render(),o.initPosition(),o.zoomChangeOnCenter(d),o.setResultAndSelectedID([{id:e.id,valid:t.valid,pointList:s,textAttribute:"",isRect:!0,attribute:t.attribute}],e.id)},Pt=(t,e,n,r)=>{if(!n||!r)return;r.generateSphere(t),r.updateCameraBySphere(t,N.Top),r.render();const{toolInstance:o,pointCloudInstance:c}=n,{point2d:p}=c.getSphereTopPoint2DCoordinate(t),s=[...o.pointList].map(d=>d.id===e.id?V(L(L({},e),p),{valid:t.valid,textAttribute:"",attribute:t.attribute}):d);o.setResult(s),o.setSelectedID(e.id)},$=(t,e,n,r)=>{var o;if(!n||!r)return;r.generateBox(t,e.id),r.render();const{pointCloud2dOperation:c,pointCloudInstance:p}=n,{polygon2d:s}=p.getBoxTopPolygon2DCoordinate(t),d=[...c.polygonList],g=d.find(P=>P.id===e.id);g?g.pointList=s:d.push({id:e.id,pointList:s,textAttribute:"",isRect:!0,valid:(o=t.valid)!=null?o:!0}),c.setResultAndSelectedID(d,e.id)},qt=()=>{const t=kt(At),{topViewInstance:e,sideViewInstance:n,backViewInstance:r,mainViewInstance:o,addPointCloudBox:c,addPointCloudSphere:p,setSelectedIDs:s,selectedIDs:d,pointCloudBoxList:g,pointCloudSphereList:P,hideAttributes:B}=t,{addHistory:H,initHistory:U,pushHistoryUnderUpdatePolygon:T,pushHistoryUnderUpdatePoint:z,pushHistoryUnderUpdateLine:R}=Ft(),{selectedPolygon:k}=Nt(),{updateSelectedBox:A,updateSelectedBoxes:j,getPointCloudByID:m}=st(),{getPointCloudSphereByID:ht,updatePointCloudSphere:tt,selectedSphere:W}=jt(),{currentData:D,config:S}=Tt(i=>{const{stepList:l,step:f,imgList:u,imgIndex:a}=i.annotation;return{currentData:u[a],config:rt(Rt.getCurrentStepInfo(f,l).config)}}),ot=zt(),{selectedBox:F}=st(),{t:yt}=Ht(),et=F==null?void 0:F.info;if(!e||!n||!r)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:Y}=e,Lt=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()},xt=({newPoint:i,size:l,zoom:f,trackConfigurable:u})=>{var a;const C={attribute:(a=e.toolInstance.defaultAttribute)!=null?a:""};u===!0&&Object.assign(C,{trackID:I.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:P})});const h=J(i,l,Y,void 0,C);s(i.id);const v=p(h);Z(y.Top,i,h,f,v,S)},vt=({polygon:i,size:l,imgList:f,trackConfigurable:u,zoom:a,intelligentFit:C})=>{var h;const v={attribute:(h=e.toolInstance.defaultAttribute)!=null?h:""};u===!0&&Object.assign(v,{trackID:I.getNextTrackID({imgList:[],extraBoxList:g,extraSphereList:P})});const w=e==null?void 0:e.toolInstance,O=L({},i),{boxParams:b,newPointList:E}=K(O,l,Y,void 0,v,C);if((S==null?void 0:S.lowerLimitPointsNumInBox)&&typeof b.count=="number"&&b.count<S.lowerLimitPointsNumInBox){Et.info(yt("LowerLimitPointsNumInBox",{num:S.lowerLimitPointsNumInBox})),w.deletePolygon(b.id);return}C&&(E==null?void 0:E.length)&&(O.pointList=E);const Q=B.includes(O.attribute),_=c(b);Q?s([]):(s(b.id),w.setSelectedIDs([O.id]),M(y.Top,O,b,a,_),C&&$(b,O,e,o)),H({newBoxParams:b})},Bt=({newSelectedBox:i,newPointCloudList:l,newSelectedSphere:f,newSphereList:u})=>{const a=e==null?void 0:e.toolInstance;if(!(d.length===0||!a)){if(i||(F==null?void 0:F.info)){const C=i!=null?i:F==null?void 0:F.info;a.setSelectedIDs(d);const h=a.selectedPolygon;if(d.length===1&&C){M(y.Top,h,C,void 0,l);return}}if((f||W)&&d.length===1){const C=f!=null?f:W;a.setSelectedID(d[0]);const h=a.selectedPoint;C&&Z(y.Top,h,C,void 0,u,S)}}},nt=(i,l,f)=>{if(et){let u,a;switch(f){case y.Back:u=Qt;break;case y.Side:u=ut;break;default:u=ut;break}if(a=u(i,l,et,n.pointCloudInstance),o){const{count:h}=o.getSensesPointZAxisInPolygon(Vt(a).polygonPointList,[a.center.z-a.depth/2,a.center.z+a.depth/2]);a=V(L({},a),{count:h})}const C=A(a);return M(f,i,a,void 0,C),C}},it=(i,l,f)=>{if(W){let u,a;switch(f){case y.Back:u=Yt;break;case y.Side:u=ct;break;default:u=ct;break}a=u(i,l,W);const C=tt(a);return Z(f,i,a,void 0,C,S),C}},St=(i,l)=>{it(i,l,y.Side)},bt=(i,l)=>{it(i,l,y.Back)},wt=(i,l)=>{nt(i,l,y.Side)},It=(i,l)=>{nt(i,l,y.Back)},Dt=(i,l)=>{R(i)},Ot=(i,l)=>{const{x:f,y:u}=I.transferCanvas2World(i,l);z(V(L({},i),{x:f,y:u}));const a=ht(i.id),C=J(i,l,Y,a),h=tt(C);Z(y.Top,i,C,void 0,h,S)},_t=(i,l)=>{if(k){const u=i[0].newPolygon;u.pointList=u.pointList.map(a=>I.transferCanvas2World(a,l)),T(i[0].newPolygon);return}const f=i.map(({newPolygon:u})=>{const a=m(u.id),{boxParams:C}=K(u,l,e.pointCloudInstance,a);return C});if(f.length===1){const{newPolygon:u}=i[0],a=j(f);M(y.Top,u,f[0],void 0,a)}else{const u=j(f);u&&t.syncAllViewPointCloudColor(u)}},Z=(i,l,f,u,a,C)=>q(void 0,null,function*(){const h=D==null?void 0:D.url,v={[y.Side]:()=>{pt(f,l,n,h,C)},[y.Back]:()=>{r&&Ct(f,l,r,h,C)},[y.Top]:()=>{Pt(f,l,e,o)}};Object.keys(v).forEach(w=>{w!==i&&v[w]()}),u&&(o==null||o.updateCameraZoom(u)),mt(f)}),M=(i,l,f,u,a)=>q(void 0,null,function*(){const C=D==null?void 0:D.url;a&&(yield t.syncAllViewPointCloudColor(a));const h={[y.Side]:()=>{ft(f,l,n,C)},[y.Back]:()=>{r&&gt(f,l,r,C)},[y.Top]:()=>{$(f,l,e,o)}};Object.keys(h).forEach(v=>{v!==i&&h[v]()}),u&&(o==null||o.updateCameraZoom(u)),Lt(f)});return{topViewAddSphere:xt,topViewAddBox:vt,topViewSelectedChanged:Bt,topViewUpdatePoint:Ot,sideViewUpdatePoint:St,backViewUpdatePoint:bt,topViewUpdateBox:_t,topViewUpdateLine:Dt,sideViewUpdateBox:wt,backViewUpdateBox:It,pointCloudBoxListUpdated:i=>{e.updatePolygonList(i),o==null||o.generateBoxes(i)},initPointCloud3d:i=>{if(!o)return;const l={left:-i.width/2,right:i.width/2,top:i.height/2,bottom:-i.height/2,near:100,far:-100};o.initOrthographicCamera(l),o.initRenderer(),o.render()},updatePointCloudData:(...i)=>q(void 0,[...i],function*(l=D){var f,u,a,C,h,v;if(!(l==null?void 0:l.url)||!o)return;dt(ot,!0),yield o.loadPCDFile(l.url,(f=S==null?void 0:S.radius)!=null?f:X),g.forEach(_=>{o==null||o.removeObjectByName(_.id)}),P.forEach(_=>{o==null||o.removeObjectByName(_.id)});let w=[],O=[],b=[],E=[];D.result?(w=I.getBoxParamsFromResultList(D.result),b=I.getPolygonListFromResultList(D.result),O=I.getLineListFromResultList(D.result),E=I.getSphereParamsFromResultList(D.result),w.forEach(_=>{o==null||o.generateBox(_)}),E.forEach(_=>{o==null||o.generateSphere(_)}),t.syncAllViewPointCloudColor(w),t.setPointCloudResult(w),t.setPolygonList(b),t.setLineList(O),t.setPointCloudSphereList(E)):(t.setPointCloudResult([]),t.setPolygonList([]),t.setPointCloudSphereList([]),t.setLineList([])),U({pointCloudBoxList:w,polygonList:b}),o.updateTopCamera();const Q=(a=(u=rt(l.result))==null?void 0:u.valid)!=null?a:!0;t.setPointCloudValid(Q),(C=t.sideViewInstance)==null||C.clearAllData(),(h=t.backViewInstance)==null||h.clearAllData(),e.updateData(l.url,l.result,{radius:(v=S==null?void 0:S.radius)!=null?v:X}),dt(ot,!1)})}};export{Ct as syncBackViewByPoint,pt as syncSideViewByPoint,Pt as syncTopViewByPoint,gt as synchronizeBackView,ft as synchronizeSideView,$ as synchronizeTopView,J as topViewPoint2PointCloud,K as topViewPolygon2PointCloud,qt as usePointCloudViews};
1
+ import{MathUtils as x,getCuboidFromPointCloudBox as _t}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,m=(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},j=(t,e)=>Zt(t,Wt(e)),q=(t,e,n)=>new Promise((r,o)=>{var c=d=>{try{s(n.next(d))}catch(P){o(P)}},p=d=>{try{s(n.throw(d))}catch(P){o(P)}},s=d=>d.done?r(d.value):Promise.resolve(d.value).then(c,p);s((n=n.apply(t,e)).next())});const G=5,Q=90,L={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},J=(t,e,n,r,o)=>{const{x:c,y:p}=D.transferCanvas2World(t,e),{defaultZ:s}=Vt,d={center:{x:c,y:p,z:s},id:t.id},P=r?m(m({},r),d):j(m({},d),{attribute:"",valid:!0});return o&&Object.assign(P,o),P},K=(t,e,n,r,o,c)=>{let p=t.pointList.map(y=>D.transferCanvas2World(y,e)),s=0,d=1,P={};if(n){const y=n.getSensesPointZAxisInPolygon(p,void 0,c);c&&y.fittedCoordinates.length>0&&(p=y.fittedCoordinates),s=(y.maxZ+y.minZ)/2,d=y.maxZ-y.minZ,P={count:y.zCount}}const[g,B,T]=p,U=x.getLineCenterPoint([g,T]),z=x.getLineLength(g,B),R=x.getLineLength(B,T),E=x.getRadiusFromQuadrangle(t.pointList);r&&(s=r.center.z,d=r.depth);const k={center:{x:U.x,y:U.y,z:s},width:R,height:z,depth:d,rotation:E,id:t.id},O=m(r?m(m({},r),k):j(m({},k),{attribute:"",valid:!0}),P);o&&Object.assign(O,o);const H=p.map(y=>D.transferWorld2Canvas(y,e));return{boxParams:O,newPointList:H}},ct=(t,e,n)=>{const r={x:t.x-e.x,y:t.y-e.y};return j(m({},n),{center:{x:n.center.x-r.x,y:n.center.y,z:n.center.z-r.y}})},ut=(t,e,n,r)=>{const[o,c,p]=t.pointList,[s,d,P]=e.pointList,g=x.getLineCenterPoint([o,p]),B=x.getLineCenterPoint([s,P]),U={x:{x:g.x-B.x,y:g.y-B.y}.x,y:0,z:g.y-B.y},z=x.getLineLength(o,c),R=x.getLineLength(s,d),E=z-R,k=x.getLineLength(c,p),O=x.getLineLength(d,P),H=k-O,{newBoxParams:y}=r.getNewBoxBySideUpdate(U,H,E,n);return y},Qt=(t,e,n)=>{const r={x:t.x-e.x,y:t.y-e.y};return j(m({},n),{center:{x:n.center.x,y:n.center.y-r.x,z:n.center.z-r.y}})},Xt=(t,e,n,r)=>{const[o,c,p]=t.pointList,[s,d,P]=e.pointList,g=x.getLineCenterPoint([o,p]),B=x.getLineCenterPoint([s,P]),U={x:{x:g.x-B.x,y:g.y-B.y}.x,y:0,z:g.y-B.y},z=x.getLineLength(o,c),R=x.getLineLength(s,d),E=z-R,k=x.getLineLength(c,p),O=x.getLineLength(d,P),H=k-O;let{newBoxParams:y}=r.getNewBoxByBackUpdate(U,H,E,n);return y},pt=(t,e,n,r,o)=>{var c;if(!n)return;const{toolInstance:p,pointCloudInstance:s}=n;s.loadPCDFile(r,(c=o==null?void 0:o.radius)!=null?c:Q);const{cameraPositionVector:d}=s.updateOrthoCameraBySphere(t,N.Left);s.setInitCameraPosition(d);const{point2d:P,zoom:g}=s.getSphereSidePoint2DCoordinate(t);s.camera.zoom=g,s.camera.updateProjectionMatrix(),s.render(),p.initPosition(),p.zoomChangeOnCenter(g),p.setResult([j(m(m({},e),P),{valid:t.valid,textAttribute:"",attribute:t.attribute})]),p.setSelectedID(e.id)},ft=(t,e,n,r)=>{if(!n)return;const{pointCloud2dOperation:o,pointCloudInstance:c}=n;c.loadPCDFileByBox(r,t,{width:G,depth:G});const{cameraPositionVector:p}=c.updateOrthoCamera(t,N.Left);c.setInitCameraPosition(p);const{polygon2d:s,zoom:d}=c.getBoxSidePolygon2DCoordinate(t);c.camera.zoom=d,c.camera.updateProjectionMatrix(),c.render(),o.initPosition(),o.zoomChangeOnCenter(d),o.setResultAndSelectedID([{id:e.id,valid:t.valid,pointList:s,textAttribute:"",isRect:!0,attribute:t.attribute}],e.id)},Ct=(t,e,n,r,o)=>{var c;if(!n)return;const{toolInstance:p,pointCloudInstance:s}=n;s.loadPCDFile(r,(c=o==null?void 0:o.radius)!=null?c:Q);const{cameraPositionVector:d}=s.updateOrthoCameraBySphere(t,N.Back);s.setInitCameraPosition(d);const{point2d:P,zoom:g}=s.getSphereBackPoint2DCoordinate(t);s.camera.zoom=g,s.camera.updateProjectionMatrix(),s.render(),p.initPosition(),p.zoomChangeOnCenter(g),p.setResult([j(m(m({},e),P),{valid:t.valid,textAttribute:"",attribute:t.attribute})]),p.setSelectedID(e.id)},Pt=(t,e,n,r)=>{if(!n)return;const{pointCloud2dOperation:o,pointCloudInstance:c}=n;c.loadPCDFileByBox(r,t,{height:G,depth:G});const{cameraPositionVector:p}=c.updateOrthoCamera(t,N.Back);c.setInitCameraPosition(p);const{polygon2d:s,zoom:d}=c.getBoxBackPolygon2DCoordinate(t);c.camera.zoom=d,c.camera.updateProjectionMatrix(),c.render(),o.initPosition(),o.zoomChangeOnCenter(d),o.setResultAndSelectedID([{id:e.id,valid:t.valid,pointList:s,textAttribute:"",isRect:!0,attribute:t.attribute}],e.id)},gt=(t,e,n,r)=>{if(!n||!r)return;r.generateSphere(t),r.updateCameraBySphere(t,N.Top),r.render();const{toolInstance:o,pointCloudInstance:c}=n,{point2d:p}=c.getSphereTopPoint2DCoordinate(t),s=[...o.pointList].map(d=>d.id===e.id?j(m(m({},e),p),{valid:t.valid,textAttribute:"",attribute:t.attribute}):d);o.setResult(s),o.setSelectedID(e.id)},$=(t,e,n,r)=>{var o;if(!n||!r)return;r.generateBox(t,e.id),r.render();const{pointCloud2dOperation:c,pointCloudInstance:p}=n,{polygon2d:s}=p.getBoxTopPolygon2DCoordinate(t),d=[...c.polygonList],P=d.find(g=>g.id===e.id);P?P.pointList=s:d.push({id:e.id,pointList:s,textAttribute:"",isRect:!0,valid:(o=t.valid)!=null?o:!0}),c.setResultAndSelectedID(d,e.id)},Yt=()=>{const t=Ut(kt),{topViewInstance:e,sideViewInstance:n,backViewInstance:r,mainViewInstance:o,addPointCloudBox:c,addPointCloudSphere:p,setSelectedIDs:s,selectedIDs:d,pointCloudBoxList:P,pointCloudSphereList:g,hideAttributes:B}=t,{addHistory:T,initHistory:U,pushHistoryUnderUpdatePolygon:z,pushHistoryUnderUpdateLine:R}=Ht(),{selectedPolygon:E}=Ft(),{updateSelectedBox:k,updateSelectedBoxes:O,getPointCloudByID:H}=st(),{getPointCloudSphereByID:y,updatePointCloudSphere:tt,selectedSphere:Z}=At(),{currentData:I,config:S}=jt(i=>{const{stepList:l,step:f,imgList:u,imgIndex:a}=i.annotation;return{currentData:u[a],config:rt(zt.getCurrentStepInfo(f,l).config)}}),ot=Tt(),{selectedBox:F}=st(),{t:ht}=Et(),et=F==null?void 0:F.info;if(!e||!n||!r)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()},mt=i=>{o==null||o.generateSphere(i),o==null||o.controls.update(),o==null||o.render()},yt=({newPoint:i,size:l,zoom:f,trackConfigurable:u})=>{var a;const C={attribute:(a=e.toolInstance.defaultAttribute)!=null?a:""};u===!0&&Object.assign(C,{trackID:D.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:g})});const h=J(i,l,X,void 0,C);s(i.id);const v=p(h);W(L.Top,i,h,f,v,S),T({newSphereParams:h})},xt=({polygon:i,size:l,imgList:f,trackConfigurable:u,zoom:a,intelligentFit:C})=>{var h;const v={attribute:(h=e.toolInstance.defaultAttribute)!=null?h:""};u===!0&&Object.assign(v,{trackID:D.getNextTrackID({imgList:[],extraBoxList:P,extraSphereList:g})});const w=e==null?void 0:e.toolInstance,_=m({},i),{boxParams:b,newPointList:A}=K(_,l,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&&(A==null?void 0:A.length)&&(_.pointList=A);const Y=B.includes(_.attribute),V=c(b);Y?s([]):(s(b.id),w.setSelectedIDs([_.id]),M(L.Top,_,b,a,V),C&&$(b,_,e,o)),T({newBoxParams:b})},vt=({newSelectedBox:i,newPointCloudList:l,newSelectedSphere:f,newSphereList:u})=>{const a=e==null?void 0:e.toolInstance;if(!(d.length===0||!a)){if(i||(F==null?void 0:F.info)){const C=i!=null?i:F==null?void 0:F.info;a.setSelectedIDs(d);const h=a.selectedPolygon;if(d.length===1&&C){M(L.Top,h,C,void 0,l);return}}if((f||Z)&&d.length===1){const C=f!=null?f:Z;a.setSelectedID(d[0]);const h=a.selectedPoint;C&&W(L.Top,h,C,void 0,u,S)}}},nt=(i,l,f)=>{if(et){let u,a;switch(f){case L.Back:u=Xt;break;case L.Side:u=ut;break;default:u=ut;break}if(a=u(i,l,et,n.pointCloudInstance),o){const{count:h}=o.getSensesPointZAxisInPolygon(_t(a).polygonPointList,[a.center.z-a.depth/2,a.center.z+a.depth/2]);a=j(m({},a),{count:h})}const C=k(a);return M(f,i,a,void 0,C),C}},it=(i,l,f)=>{if(Z){let u,a;switch(f){case L.Back:u=Qt;break;case L.Side:u=ct;break;default:u=ct;break}a=u(i,l,Z);const C=tt(a);return W(f,i,a,void 0,C,S),C}},Bt=(i,l)=>{it(i,l,L.Side)},St=(i,l)=>{it(i,l,L.Back)},bt=(i,l)=>{nt(i,l,L.Side)},wt=(i,l)=>{nt(i,l,L.Back)},It=(i,l)=>{R(i)},Dt=(i,l)=>{const f=y(i.id),u=J(i,l,X,f),a=tt(u);W(L.Top,i,u,void 0,a,S)},Ot=(i,l)=>{if(E){const u=i[0].newPolygon;u.pointList=u.pointList.map(a=>D.transferCanvas2World(a,l)),z(i[0].newPolygon);return}const f=i.map(({newPolygon:u})=>{const a=H(u.id),{boxParams:C}=K(u,l,e.pointCloudInstance,a);return C});if(f.length===1){const{newPolygon:u}=i[0],a=O(f);M(L.Top,u,f[0],void 0,a)}else{const u=O(f);u&&t.syncAllViewPointCloudColor(u)}},W=(i,l,f,u,a,C)=>q(void 0,null,function*(){const h=I==null?void 0:I.url,v={[L.Side]:()=>{pt(f,l,n,h,C)},[L.Back]:()=>{r&&Ct(f,l,r,h,C)},[L.Top]:()=>{gt(f,l,e,o)}};Object.keys(v).forEach(w=>{w!==i&&v[w]()}),u&&(o==null||o.updateCameraZoom(u)),mt(f)}),M=(i,l,f,u,a)=>q(void 0,null,function*(){const C=I==null?void 0:I.url;a&&(yield t.syncAllViewPointCloudColor(a));const h={[L.Side]:()=>{ft(f,l,n,C)},[L.Back]:()=>{r&&Pt(f,l,r,C)},[L.Top]:()=>{$(f,l,e,o)}};Object.keys(h).forEach(v=>{v!==i&&h[v]()}),u&&(o==null||o.updateCameraZoom(u)),Lt(f)});return{topViewAddSphere:yt,topViewAddBox:xt,topViewSelectedChanged:vt,topViewUpdatePoint:Dt,sideViewUpdatePoint:Bt,backViewUpdatePoint:St,topViewUpdateBox:Ot,topViewUpdateLine:It,sideViewUpdateBox:bt,backViewUpdateBox:wt,pointCloudBoxListUpdated:i=>{e.updatePolygonList(i),o==null||o.generateBoxes(i)},initPointCloud3d:i=>{if(!o)return;const l={left:-i.width/2,right:i.width/2,top:i.height/2,bottom:-i.height/2,near:100,far:-100};o.initOrthographicCamera(l),o.initRenderer(),o.render()},updatePointCloudData:(...i)=>q(void 0,[...i],function*(l=I){var f,u,a,C,h,v;if(!(l==null?void 0:l.url)||!o)return;dt(ot,!0),yield o.loadPCDFile(l.url,(f=S==null?void 0:S.radius)!=null?f:Q),P.forEach(V=>{o==null||o.removeObjectByName(V.id)}),g.forEach(V=>{o==null||o.removeObjectByName(V.id)});let w=[],_=[],b=[],A=[];I.result?(w=D.getBoxParamsFromResultList(I.result),b=D.getPolygonListFromResultList(I.result),_=D.getLineListFromResultList(I.result),A=D.getSphereParamsFromResultList(I.result),w.forEach(V=>{o==null||o.generateBox(V)}),A.forEach(V=>{o==null||o.generateSphere(V)}),t.syncAllViewPointCloudColor(w),t.setPointCloudResult(w),t.setPolygonList(b),t.setLineList(_),t.setPointCloudSphereList(A)):(t.setPointCloudResult([]),t.setPolygonList([]),t.setPointCloudSphereList([]),t.setLineList([])),U({pointCloudBoxList:w,polygonList:b,pointCloudSphereList:A}),o.updateTopCamera();const Y=(a=(u=rt(l.result))==null?void 0:u.valid)!=null?a:!0;t.setPointCloudValid(Y),(C=t.sideViewInstance)==null||C.clearAllData(),(h=t.backViewInstance)==null||h.clearAllData(),e.updateData(l.url,l.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 +1 @@
1
- import{useContext as h,useMemo as m,useCallback as i}from"react";import{PointCloudContext as S}from"../PointCloudContext.js";import l from"lodash";const f=()=>{const{pointCloudSphereList:e,setPointCloudSphereList:d,selectedID:s,mainViewInstance:r}=h(S),u=m(()=>e.find(t=>t.id===s),[s,e]),c=i(t=>e.find(o=>o.id===t),[e]),p=i(t=>{const o=e.findIndex(n=>n.id===t.id);if(o>-1){e.splice(o,1,l.merge(e[o],t));const n=l.cloneDeep(e);return d(n),n}return e},[e]),C=i(t=>{const o=e.filter(n=>n.id!==t);d(o),r==null||r.removeObjectByName(t),r==null||r.render()},[e]);return{selectedSphere:u,getPointCloudSphereByID:c,updatePointCloudSphere:p,deletePointCloudSphere:C}};export{f as useSphere};
1
+ import{useContext as m,useMemo as S,useCallback as r}from"react";import{PointCloudContext as f}from"../PointCloudContext.js";import u from"lodash";import{useHistory as P}from"./useHistory.js";const a=()=>{const{pointCloudSphereList:e,setPointCloudSphereList:s,selectedID:d,mainViewInstance:i}=m(f),{pushHistoryWithList:l}=P(),p=S(()=>e.find(t=>t.id===d),[d,e]),c=r(t=>e.find(o=>o.id===t),[e]),C=r(t=>{const o=e.findIndex(n=>n.id===t.id);if(o>-1){e.splice(o,1,u.merge(e[o],t));const n=u.cloneDeep(e);return s(n),l({pointCloudSphereList:n}),n}return e},[e]),h=r(t=>{const o=e.filter(n=>n.id!==t);s(o),i==null||i.removeObjectByName(t),i==null||i.render()},[e]);return{selectedSphere:p,getPointCloudSphereByID:c,updatePointCloudSphere:C,deletePointCloudSphere:h}};export{a as useSphere};
@@ -1 +1 @@
1
- import{useContext as w}from"react";import{PointCloudContext as b}from"../PointCloudContext.js";import{cTool as L}from"@labelbee/lb-annotation";import{useHistory as R}from"./useHistory.js";const{EToolName:t,EPolygonPattern:d}=L,E=()=>{const{topViewInstance:r,sideViewInstance:a,backViewInstance:u,mainViewInstance:e,pointCloudBoxList:P,pointCloudSphereList:C,setPointCloudResult:v,setPointCloudSphereList:h,setPolygonList:p,pointCloudPattern:c,setPointCloudPattern:n,syncAllViewPointCloudColor:m}=w(b),{pushHistoryWithList:y}=R(),f=()=>{P.forEach(l=>{e==null||e.removeObjectByName(l.id)}),C.forEach(l=>{e==null||e.removeObjectByName(l.id)}),e==null||e.render(),v([]),p([]),h([]),r==null||r.toolScheduler.clearStatusAndResult(),m([]),y({pointCloudBoxList:[],polygonList:[]})},i=()=>{a==null||a.toolInstance.clearResult(),u==null||u.toolInstance.clearResult()};return{clearAllResult:f,updatePointCloudPattern:l=>{if(l===c)return;const s=[r,a,u];switch(l){case t.Rect:i(),s.forEach(o=>{o==null||o.switchToCanvas(t.PointCloudPolygon),o==null||o.toolInstance.setPattern(d.Rect)}),n(t.Rect);break;case t.Polygon:i(),s.forEach(o=>{o==null||o.switchToCanvas(t.PointCloudPolygon),o==null||o.toolInstance.setPattern(d.Normal)}),n(t.Polygon);break;case t.Point:i(),s.forEach(o=>{o==null||o.switchToCanvas(t.Point)}),n(t.Point);break;case t.Line:i(),s.forEach(o=>{o==null||o.switchToCanvas(t.Line)}),n(t.Line);break}},pointCloudPattern:c}};export{E as useStatus};
1
+ import{useContext as w}from"react";import{PointCloudContext as L}from"../PointCloudContext.js";import{cTool as b}from"@labelbee/lb-annotation";import{useHistory as R}from"./useHistory.js";const{EToolName:t,EPolygonPattern:d}=b,E=()=>{const{topViewInstance:r,sideViewInstance:a,backViewInstance:u,mainViewInstance:e,pointCloudBoxList:P,pointCloudSphereList:C,setPointCloudResult:p,setPointCloudSphereList:v,setPolygonList:h,pointCloudPattern:c,setPointCloudPattern:n,syncAllViewPointCloudColor:m}=w(L),{pushHistoryWithList:y}=R(),f=()=>{P.forEach(l=>{e==null||e.removeObjectByName(l.id)}),C.forEach(l=>{e==null||e.removeObjectByName(l.id)}),e==null||e.render(),p([]),h([]),v([]),r==null||r.toolScheduler.clearStatusAndResult(),m([]),y({pointCloudBoxList:[],polygonList:[],pointCloudSphereList:[]})},i=()=>{a==null||a.toolInstance.clearResult(),u==null||u.toolInstance.clearResult()};return{clearAllResult:f,updatePointCloudPattern:l=>{if(l===c)return;const s=[r,a,u];switch(l){case t.Rect:i(),s.forEach(o=>{o==null||o.switchToCanvas(t.PointCloudPolygon),o==null||o.toolInstance.setPattern(d.Rect)}),n(t.Rect);break;case t.Polygon:i(),s.forEach(o=>{o==null||o.switchToCanvas(t.PointCloudPolygon),o==null||o.toolInstance.setPattern(d.Normal)}),n(t.Polygon);break;case t.Point:i(),s.forEach(o=>{o==null||o.switchToCanvas(t.Point)}),n(t.Point);break;case t.Line:i(),s.forEach(o=>{o==null||o.switchToCanvas(t.Line)}),n(t.Line);break}},pointCloudPattern:c}};export{E as useStatus};
@@ -0,0 +1 @@
1
+ const u=r=>{if(!r)return;const t=r.replace(/[rgba()]/g,"").split(",");if(t){const[e,b,a,n]=t;return{r:Number(e),g:Number(b),b:Number(a),a:Number(n)}}},g=r=>`rgba(${r.r},${r.g},${r.b},${r.a})`;export{u as toRGBAObj,g as toRGBAStr};
@@ -1 +1 @@
1
- import e,{useContext as I,useState as C,useEffect as B}from"react";import{EditFilled as w}from"@ant-design/icons";import{ToolIcons as L}from"../ToolIcons.js";import{cTool as j}from"@labelbee/lb-annotation";import{PointCloudContext as b}from"../../../../components/pointCloudView/PointCloudContext.js";import{Divider as E,Tag as _,Input as A,Select as T,message as v}from"antd";import F from"../../../../utils/StepUtils.js";import{connect as V}from"react-redux";import{jsonParser as N}from"../../../../utils/index.js";import{useStatus as U}from"../../../../components/pointCloudView/hooks/useStatus.js";import{useSingleBox as h}from"../../../../components/pointCloudView/hooks/useSingleBox.js";import{useTranslation as k}from"react-i18next";import{LabelBeeContext as M}from"../../../../store/ctx.js";import z from"./components/batchUpdateModal/index.js";import{PointCloudUtils as W}from"@labelbee/lb-utils";import P from"../../../../components/attributeList/index.js";import{useAttribute as O}from"../../../../components/pointCloudView/hooks/useAttribute.js";const R=({imgList:n,imgIndex:u})=>{const c=I(b),[a,m]=C([]),{t:i}=k();B(()=>{const r=n;let o=new Map;m(W.getAllPointCloudResult({imgList:r,extraBoxList:f,ignoreIndexList:[u]}).filter(l=>!l.trackID||o.get(l.trackID)?!1:(o.set(l.trackID,!0),!0)).sort((l,s)=>{var d,t;const x=(d=l==null?void 0:l.trackID)!=null?d:0,g=(t=s==null?void 0:s.trackID)!=null?t:0;return x-g}).map(l=>{var s;return(s=l==null?void 0:l.trackID)!=null?s:0}))},[c.pointCloudBoxList,n]);const{pointCloudBoxList:f}=c;return e.createElement("div",{style:{padding:24,borderBottom:"1px solid #eee"}},e.createElement("div",{style:{marginBottom:16}},i("AllTrackIDs")),e.createElement("div",null,a.map(r=>e.createElement(_,{color:"#F3F4FF",key:r,style:{color:"#666",marginBottom:8}},r))))},$=()=>{const[n,u]=C(!1),{pointCloudBoxList:c}=I(b),{selectedBox:a,updateSelectedBox:m}=h(),[i,f]=C(""),{t:r}=k(),o=a==null?void 0:a.info.trackID,l=d=>!!c.find(x=>x.trackID===d&&x.id!==(a==null?void 0:a.info.id)),s=(d=!1)=>{const t=parseInt(i,10);if(d&&u(!1),isNaN(t)){v.error(r("PositiveIntegerCheck"));return}if(i.indexOf(".")>-1){v.error(r("NotAllowDecimalPointsInTrackID"));return}if(l(t)){v.error(r("DuplicateTrackIDsExist"));return}if(!(t>0)){v.error(r("PositiveIntegerCheck"));return}m({trackID:t})};return B(()=>{u(!1)},[o]),e.createElement("div",{style:{padding:24}},e.createElement("div",{style:{marginBottom:16,display:"flex",justifyContent:"space-between",alignItems:"center"}},e.createElement("span",null,r("CurrentBoxTrackIDs")),o&&e.createElement(z,{id:o})),e.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},n&&o?e.createElement(A,{defaultValue:o,onChange:d=>{f(d.target.value)},disabled:!o,size:"small",onBlur:()=>{s()},onPressEnter:()=>{s(!0)}}):e.createElement("span",null,o),e.createElement(w,{style:{color:"#999",marginLeft:16,cursor:typeof o!="undefined"?"pointer":"not-allowed"},onClick:()=>{o&&u(!n)}})))},q=({attributeList:n,subAttributeList:u,toolInstance:c})=>{const{selectedBox:a}=h(),m=I(b),{t:i}=k(),{defaultAttribute:f}=O(),r={fontWeight:500,fontSize:14,margin:"12px 0 8px 20px"},o={margin:"12px 20px 8px",fontSize:14,fontWeight:500,wordWrap:"break-word"},l=t=>{c.setDefaultAttribute(t)},s=(t,x)=>{c.setSubAttribute(t,x)},d=n.map(t=>({label:t.key,value:t.value,color:t==null?void 0:t.color}));return e.createElement("div",null,e.createElement("div",{style:r},i("Attribute")),e.createElement(P,{list:d,forbidDefault:!0,selectedAttribute:f!=null?f:"",attributeChanged:t=>l(t)}),e.createElement(E,{style:{margin:0}}),a&&e.createElement(e.Fragment,null,u.map(t=>{var x,g,y,D,S;return(t==null?void 0:t.subSelected)&&e.createElement("div",{style:{marginTop:12},key:t.value},e.createElement("div",{style:o},i("SubAttribute"),"-",t.key),((x=t.subSelected)==null?void 0:x.length)<5?e.createElement(P,{list:t.subSelected.map(p=>({label:p.key,value:p.value})),selectedAttribute:(y=(g=m.selectedPointCloudBox)==null?void 0:g.subAttribute)==null?void 0:y[t.value],num:"-",forbidColor:!0,forbidDefault:!0,attributeChanged:p=>s(t.value,p),style:{marginBottom:12}}):e.createElement(T,{style:{margin:"0px 21px 17px 16px",width:"87%"},value:(S=(D=m.selectedPointCloudBox)==null?void 0:D.subAttribute)==null?void 0:S[t.value],placeholder:i("PleaseSelect"),onChange:p=>s(t.value,p),allowClear:!0},t.subSelected.map(p=>e.createElement(T.Option,{key:p.value,value:p.value},p.key))),e.createElement(E,{style:{margin:0}}))})))},G=({stepInfo:n,toolInstance:u,imgList:c,imgIndex:a})=>{var m,i;const{updatePointCloudPattern:f,pointCloudPattern:r}=U(),o=N(n.config),l=(m=o==null?void 0:o.attributeList)!=null?m:[],s=(o==null?void 0:o.secondaryAttributeConfigurable)===!0?(i=o==null?void 0:o.inputList)!=null?i:[]:[];return e.createElement(e.Fragment,null,e.createElement(L,{toolName:j.EPointCloudName.PointCloud,selectedToolName:r,onChange:d=>f==null?void 0:f(d)}),(o==null?void 0:o.trackConfigurable)===!0&&e.createElement(e.Fragment,null,e.createElement(R,{imgList:c,imgIndex:a}),e.createElement($,null),e.createElement(E,{style:{margin:0}})),e.createElement(q,{toolInstance:u,attributeList:l,subAttributeList:s}))},H=n=>{var u,c,a;const m=F.getCurrentStepInfo((u=n.annotation)==null?void 0:u.step,(c=n.annotation)==null?void 0:c.stepList),i=(a=n.annotation)==null?void 0:a.toolInstance;return{stepInfo:m,toolInstance:i,imgList:n.annotation.imgList,imgIndex:n.annotation.imgIndex}};var J=V(H,null,null,{context:M})(G);export{J as default};
1
+ import t,{useContext as S,useState as D,useEffect as A}from"react";import{EditFilled as J}from"@ant-design/icons";import{ToolIcons as $}from"../ToolIcons.js";import{cTool as q}from"@labelbee/lb-annotation";import{PointCloudContext as w}from"../../../../components/pointCloudView/PointCloudContext.js";import{Divider as L,Tag as G,Input as H,Select as V,message as k}from"antd";import K from"../../../../utils/StepUtils.js";import{connect as Q}from"react-redux";import{jsonParser as X}from"../../../../utils/index.js";import{useStatus as Y}from"../../../../components/pointCloudView/hooks/useStatus.js";import{useSingleBox as F}from"../../../../components/pointCloudView/hooks/useSingleBox.js";import{useTranslation as B}from"react-i18next";import{LabelBeeContext as Z,useDispatch as tt}from"../../../../store/ctx.js";import et from"./components/batchUpdateModal/index.js";import{PointCloudUtils as ot}from"@labelbee/lb-utils";import N from"../../../../components/attributeList/index.js";import{useAttribute as nt}from"../../../../components/pointCloudView/hooks/useAttribute.js";import{SetTaskStepList as lt}from"../../../../store/annotation/actionCreators.js";var rt=Object.defineProperty,it=Object.defineProperties,at=Object.getOwnPropertyDescriptors,U=Object.getOwnPropertySymbols,st=Object.prototype.hasOwnProperty,ut=Object.prototype.propertyIsEnumerable,M=(e,o,i)=>o in e?rt(e,o,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[o]=i,h=(e,o)=>{for(var i in o||(o={}))st.call(o,i)&&M(e,i,o[i]);if(U)for(var i of U(o))ut.call(o,i)&&M(e,i,o[i]);return e},T=(e,o)=>it(e,at(o));const ct=({imgList:e,imgIndex:o})=>{const i=S(w),[s,f]=D([]),{t:c}=B();A(()=>{const n=e;let a=new Map;f(ot.getAllPointCloudResult({imgList:n,extraBoxList:v,ignoreIndexList:[o]}).filter(l=>!l.trackID||a.get(l.trackID)?!1:(a.set(l.trackID,!0),!0)).sort((l,d)=>{var p,m;const b=(p=l==null?void 0:l.trackID)!=null?p:0,P=(m=d==null?void 0:d.trackID)!=null?m:0;return b-P}).map(l=>{var d;return(d=l==null?void 0:l.trackID)!=null?d:0}))},[i.pointCloudBoxList,e]);const{pointCloudBoxList:v}=i;return t.createElement("div",{style:{padding:24,borderBottom:"1px solid #eee"}},t.createElement("div",{style:{marginBottom:16}},c("AllTrackIDs")),t.createElement("div",null,s.map(n=>t.createElement(G,{color:"#F3F4FF",key:n,style:{color:"#666",marginBottom:8}},n))))},dt=()=>{const[e,o]=D(!1),{pointCloudBoxList:i}=S(w),{selectedBox:s,updateSelectedBox:f}=F(),[c,v]=D(""),{t:n}=B(),a=s==null?void 0:s.info.trackID,l=p=>!!i.find(b=>b.trackID===p&&b.id!==(s==null?void 0:s.info.id)),d=(p=!1)=>{const m=parseInt(c,10);if(p&&o(!1),isNaN(m)){k.error(n("PositiveIntegerCheck"));return}if(c.indexOf(".")>-1){k.error(n("NotAllowDecimalPointsInTrackID"));return}if(l(m)){k.error(n("DuplicateTrackIDsExist"));return}if(!(m>0)){k.error(n("PositiveIntegerCheck"));return}f({trackID:m})};return A(()=>{o(!1)},[a]),t.createElement("div",{style:{padding:24}},t.createElement("div",{style:{marginBottom:16,display:"flex",justifyContent:"space-between",alignItems:"center"}},t.createElement("span",null,n("CurrentBoxTrackIDs")),a&&t.createElement(et,{id:a})),t.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},e&&a?t.createElement(H,{defaultValue:a,onChange:p=>{v(p.target.value)},disabled:!a,size:"small",onBlur:()=>{d()},onPressEnter:()=>{d(!0)}}):t.createElement("span",null,a),t.createElement(J,{style:{color:"#999",marginLeft:16,cursor:typeof a!="undefined"?"pointer":"not-allowed"},onClick:()=>{a&&o(!e)}})))},pt=({attributeList:e,subAttributeList:o,toolInstance:i,config:s,stepList:f,stepInfo:c})=>{const{selectedBox:v}=F(),n=S(w),{t:a}=B(),{defaultAttribute:l}=nt(),d=tt(),p={fontWeight:500,fontSize:14,margin:"12px 0 8px 20px"},m={margin:"12px 20px 8px",fontSize:14,fontWeight:500,wordWrap:"break-word"},b=(r,x)=>{var C,I,y,E,u;const _=(C=s==null?void 0:s.attributeList)==null?void 0:C.map(g=>g.value===r?T(h({},g),{color:x}):g),O=T(h({},s),{attributeList:_}),W=JSON.stringify(O),R=f==null?void 0:f.map(g=>(g==null?void 0:g.step)===(c==null?void 0:c.step)?T(h({},g),{config:W}):g);(I=n==null?void 0:n.topViewInstance)==null||I.updateAttributeList(_),(y=n==null?void 0:n.sideViewInstance)==null||y.updateAttributeList(_),(E=n==null?void 0:n.backViewInstance)==null||E.updateAttributeList(_),(u=n==null?void 0:n.mainViewInstance)==null||u.setConfig(O),d(lt({stepList:R}))},P=r=>{i.setDefaultAttribute(r)},j=(r,x)=>{i.setSubAttribute(r,x)},z=e.map(r=>({label:r.key,value:r.value,color:r==null?void 0:r.color}));return t.createElement("div",null,t.createElement("div",{style:p},a("Attribute")),t.createElement(N,{list:z,forbidDefault:!0,selectedAttribute:l!=null?l:"",attributeChanged:r=>P(r),updateColorConfig:b,enableColorPicker:!0}),t.createElement(L,{style:{margin:0}}),v&&t.createElement(t.Fragment,null,o.map(r=>{var x,C,I,y,E;return(r==null?void 0:r.subSelected)&&t.createElement("div",{style:{marginTop:12},key:r.value},t.createElement("div",{style:m},a("SubAttribute"),"-",r.key),((x=r.subSelected)==null?void 0:x.length)<5?t.createElement(N,{list:r.subSelected.map(u=>({label:u.key,value:u.value})),selectedAttribute:(I=(C=n.selectedPointCloudBox)==null?void 0:C.subAttribute)==null?void 0:I[r.value],num:"-",forbidColor:!0,forbidDefault:!0,attributeChanged:u=>j(r.value,u),style:{marginBottom:12}}):t.createElement(V,{style:{margin:"0px 21px 17px 16px",width:"87%"},value:(E=(y=n.selectedPointCloudBox)==null?void 0:y.subAttribute)==null?void 0:E[r.value],placeholder:a("PleaseSelect"),onChange:u=>j(r.value,u),allowClear:!0},r.subSelected.map(u=>t.createElement(V.Option,{key:u.value,value:u.value},u.key))),t.createElement(L,{style:{margin:0}}))})))},mt=({stepInfo:e,toolInstance:o,imgList:i,imgIndex:s,stepList:f})=>{var c,v;const{updatePointCloudPattern:n,pointCloudPattern:a}=Y(),l=X(e.config),d=(c=l==null?void 0:l.attributeList)!=null?c:[],p=(l==null?void 0:l.secondaryAttributeConfigurable)===!0?(v=l==null?void 0:l.inputList)!=null?v:[]:[];return t.createElement(t.Fragment,null,t.createElement($,{toolName:q.EPointCloudName.PointCloud,selectedToolName:a,onChange:m=>n==null?void 0:n(m)}),(l==null?void 0:l.trackConfigurable)===!0&&t.createElement(t.Fragment,null,t.createElement(ct,{imgList:i,imgIndex:s}),t.createElement(dt,null),t.createElement(L,{style:{margin:0}})),t.createElement(pt,{toolInstance:o,attributeList:d,subAttributeList:p,config:l,stepList:f,stepInfo:e}))},ft=e=>{var o,i,s,f;const c=K.getCurrentStepInfo((o=e.annotation)==null?void 0:o.step,(i=e.annotation)==null?void 0:i.stepList),v=(s=e.annotation)==null?void 0:s.toolInstance,n=(f=e.annotation)==null?void 0:f.stepList;return{stepInfo:c,toolInstance:v,imgList:e.annotation.imgList,imgIndex:e.annotation.imgIndex,stepList:n}};var vt=Q(ft,null,null,{context:Z})(mt);export{vt as default};
@@ -1 +1 @@
1
- import{PointCloudContext as f}from"../../../../components/pointCloudView/PointCloudContext.js";import{Modal as K}from"antd";import t,{useContext as y,useMemo as _,useState as W}from"react";import{stepConfigSelector as q}from"../../../../store/annotation/selectors.js";import{useSelector as O}from"../../../../store/ctx.js";import{i18n as P}from"@labelbee/lb-utils";import{UnorderedListOutlined as w,PushpinFilled as b,EyeInvisibleFilled as z,EyeFilled as J,CaretDownFilled as Q,DeleteOutlined as X}from"@ant-design/icons";import{useHistory as Y}from"../../../../components/pointCloudView/hooks/useHistory.js";import{getClassName as c}from"../../../../utils/dom.js";import Z from"../../../../utils/StepUtils.js";import{EPointCloudName as tt}from"@labelbee/lb-annotation";import{useTranslation as k}from"react-i18next";import et from"../FooterPopover.js";var nt=Object.defineProperty,ot=Object.defineProperties,rt=Object.getOwnPropertyDescriptors,F=Object.getOwnPropertySymbols,lt=Object.prototype.hasOwnProperty,it=Object.prototype.propertyIsEnumerable,S=(e,o,n)=>o in e?nt(e,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[o]=n,N=(e,o)=>{for(var n in o||(o={}))lt.call(o,n)&&S(e,n,o[n]);if(F)for(var n of F(o))it.call(o,n)&&S(e,n,o[n]);return e},j=(e,o)=>ot(e,rt(o));const at=({attribute:e})=>{const o=y(f),{pointCloudBoxList:n,pointCloudSphereList:i,hideAttributes:u,toggleAttributesVisible:m,polygonList:a,setPolygonList:C,lineList:d,setLineList:s,setPointCloudResult:I,setPointCloudSphereList:R,reRender:D,selectSpecAttr:B}=o,[L,H]=W(!0),{pushHistoryWithList:V}=Y(),h=[...n,...a,...i,...d].filter(r=>r.attribute===e.value),x=()=>{m(e.value)},$=u.includes(e.value),G=({trackID:r,order:l})=>r||l,T=({trackID:r,order:l})=>r?`trackID_${r}`:`order_${l}`,U=r=>{if(h.length===0)return;const l=a.filter(p=>r!==p.attribute),v=n.filter(p=>r!==p.attribute),E=d.filter(p=>r!==p.attribute),A=i.filter(p=>r!==p.attribute);D(v,l,A,E),C(l),I(v),R(A),s(E),V({pointCloudBoxList:v,polygonList:l,lineList:E})},M=r=>{K.confirm({content:P.t("onDeleteGraphByAttr",{attribute:r.key}),onOk:()=>{U(r.value)},okText:P.t("Confirm"),cancelText:P.t("Cancel")})};return t.createElement(t.Fragment,null,t.createElement("div",{className:c("annotated-attribute","item")},$?t.createElement(z,{onClick:x}):t.createElement(J,{onClick:x}),t.createElement(Q,{rotate:L?0:270,onClick:()=>{H(!L)}}),t.createElement("span",{className:c("annotated-attribute","item","text"),onClick:()=>{B(e.value)}},e.key),t.createElement(X,{onClick:()=>M(e)})),L&&h.map((r,l)=>t.createElement("div",{key:T(j(N({},r),{order:l})),style:{paddingLeft:54}},`${G(j(N({},r),{order:l}))}.${e.key}`)))},g=()=>{const e=O(q),{attrPanelLayout:o,setAttrPanelLayout:n,pointCloudBoxList:i,polygonList:u,lineList:m}=y(f),{t:a}=k(),C=_(()=>[...i,...u,...m].map(s=>s.attribute),[i,u,m]),d=_(()=>e.attributeList.filter(s=>C.includes(s.value)),[C]);return t.createElement("div",{className:c("annotated-attribute")},o?t.createElement("div",{className:c("annotated-attribute","text")},t.createElement("span",null,a("AnnotatedResult")),t.createElement("span",{className:c("annotated-attribute","pin"),onClick:()=>{n("")}},t.createElement(b,null),a("CancelFixed"))):t.createElement("div",{className:c("annotated-attribute","text")},t.createElement("span",{onClick:()=>{n("left")},className:c("annotated-attribute","pin")},t.createElement(b,null),a("FixedOnLeft")),t.createElement("span",{onClick:()=>{n("right")},className:c("annotated-attribute","pin")},t.createElement(b,null),a("FixedOnRight"))),t.createElement("div",null,d.length>0?d.map(s=>t.createElement(at,{attribute:s,key:s.value})):t.createElement("div",{style:{textAlign:"center",height:200,lineHeight:"200px"}},a("NoData"))))},st=()=>{const{attrPanelLayout:e}=y(f);return e==="left"?t.createElement(g,null):null},ct=()=>{const{attrPanelLayout:e}=y(f);return e==="right"?t.createElement(g,null):null},ut=()=>{const{attrPanelLayout:e}=y(f),{t:o}=k(),n=O(i=>{var u,m;return Z.getCurrentStepInfo((u=i==null?void 0:i.annotation)==null?void 0:u.step,(m=i.annotation)==null?void 0:m.stepList)});return(n==null?void 0:n.tool)!==tt.PointCloud||e?null:t.createElement(et,{hoverIcon:t.createElement(w,{style:{marginRight:4}}),icon:t.createElement(w,{style:{marginRight:4}}),title:o("AnnotatedList"),content:t.createElement(g,null)})};export{ut as AnnotatedAttributesIcon,g as AnnotatedAttributesPanel,st as AnnotatedAttributesPanelFixedLeft,ct as AnnotatedAttributesPanelFixedRight};
1
+ import{PointCloudContext as C}from"../../../../components/pointCloudView/PointCloudContext.js";import{Modal as K}from"antd";import t,{useContext as y,useMemo as O,useState as W}from"react";import{stepConfigSelector as q}from"../../../../store/annotation/selectors.js";import{useSelector as S}from"../../../../store/ctx.js";import{i18n as h}from"@labelbee/lb-utils";import{UnorderedListOutlined as w,PushpinFilled as x,EyeInvisibleFilled as z,EyeFilled as J,CaretDownFilled as Q,DeleteOutlined as X}from"@ant-design/icons";import{useHistory as Y}from"../../../../components/pointCloudView/hooks/useHistory.js";import{getClassName as s}from"../../../../utils/dom.js";import Z from"../../../../utils/StepUtils.js";import{EPointCloudName as tt}from"@labelbee/lb-annotation";import{useTranslation as k}from"react-i18next";import et from"../FooterPopover.js";var nt=Object.defineProperty,ot=Object.defineProperties,rt=Object.getOwnPropertyDescriptors,F=Object.getOwnPropertySymbols,lt=Object.prototype.hasOwnProperty,it=Object.prototype.propertyIsEnumerable,N=(e,o,n)=>o in e?nt(e,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[o]=n,j=(e,o)=>{for(var n in o||(o={}))lt.call(o,n)&&N(e,n,o[n]);if(F)for(var n of F(o))it.call(o,n)&&N(e,n,o[n]);return e},I=(e,o)=>ot(e,rt(o));const at=({attribute:e})=>{const o=y(C),{pointCloudBoxList:n,pointCloudSphereList:i,hideAttributes:c,toggleAttributesVisible:u,polygonList:d,setPolygonList:p,lineList:f,setLineList:L,setPointCloudResult:a,setPointCloudSphereList:R,reRender:D,selectSpecAttr:B}=o,[v,H]=W(!0),{pushHistoryWithList:V}=Y(),A=[...n,...d,...i,...f].filter(r=>r.attribute===e.value),_=()=>{u(e.value)},$=c.includes(e.value),G=({trackID:r,order:l})=>r||l,T=({trackID:r,order:l})=>r?`trackID_${r}`:`order_${l}`,U=r=>{if(A.length===0)return;const l=d.filter(m=>r!==m.attribute),E=n.filter(m=>r!==m.attribute),P=f.filter(m=>r!==m.attribute),b=i.filter(m=>r!==m.attribute);D(E,l,b,P),p(l),a(E),R(b),L(P),V({pointCloudBoxList:E,polygonList:l,lineList:P,pointCloudSphereList:b})},M=r=>{K.confirm({content:h.t("onDeleteGraphByAttr",{attribute:r.key}),onOk:()=>{U(r.value)},okText:h.t("Confirm"),cancelText:h.t("Cancel")})};return t.createElement(t.Fragment,null,t.createElement("div",{className:s("annotated-attribute","item")},$?t.createElement(z,{onClick:_}):t.createElement(J,{onClick:_}),t.createElement(Q,{rotate:v?0:270,onClick:()=>{H(!v)}}),t.createElement("span",{className:s("annotated-attribute","item","text"),onClick:()=>{B(e.value)}},e.key),t.createElement(X,{onClick:()=>M(e)})),v&&A.map((r,l)=>t.createElement("div",{key:T(I(j({},r),{order:l})),style:{paddingLeft:54}},`${G(I(j({},r),{order:l}))}.${e.key}`)))},g=()=>{const e=S(q),{attrPanelLayout:o,setAttrPanelLayout:n,pointCloudBoxList:i,pointCloudSphereList:c,polygonList:u,lineList:d}=y(C),{t:p}=k(),f=O(()=>[...i,...c,...u,...d].map(a=>a.attribute),[i,c,u,d]),L=O(()=>e.attributeList.filter(a=>f.includes(a.value)),[f]);return t.createElement("div",{className:s("annotated-attribute")},o?t.createElement("div",{className:s("annotated-attribute","text")},t.createElement("span",null,p("AnnotatedResult")),t.createElement("span",{className:s("annotated-attribute","pin"),onClick:()=>{n("")}},t.createElement(x,null),p("CancelFixed"))):t.createElement("div",{className:s("annotated-attribute","text")},t.createElement("span",{onClick:()=>{n("left")},className:s("annotated-attribute","pin")},t.createElement(x,null),p("FixedOnLeft")),t.createElement("span",{onClick:()=>{n("right")},className:s("annotated-attribute","pin")},t.createElement(x,null),p("FixedOnRight"))),t.createElement("div",null,L.length>0?L.map(a=>t.createElement(at,{attribute:a,key:a.value})):t.createElement("div",{style:{textAlign:"center",height:200,lineHeight:"200px"}},p("NoData"))))},st=()=>{const{attrPanelLayout:e}=y(C);return e==="left"?t.createElement(g,null):null},ct=()=>{const{attrPanelLayout:e}=y(C);return e==="right"?t.createElement(g,null):null},ut=()=>{const{attrPanelLayout:e}=y(C),{t:o}=k(),n=S(i=>{var c,u;return Z.getCurrentStepInfo((c=i==null?void 0:i.annotation)==null?void 0:c.step,(u=i.annotation)==null?void 0:u.stepList)});return(n==null?void 0:n.tool)!==tt.PointCloud||e?null:t.createElement(et,{hoverIcon:t.createElement(w,{style:{marginRight:4}}),icon:t.createElement(w,{style:{marginRight:4}}),title:o("AnnotatedList"),content:t.createElement(g,null)})};export{ut as AnnotatedAttributesIcon,g as AnnotatedAttributesPanel,st as AnnotatedAttributesPanelFixedLeft,ct as AnnotatedAttributesPanelFixedRight};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@labelbee/lb-components",
3
- "version": "1.10.0-alpha.6",
3
+ "version": "1.10.0-alpha.8",
4
4
  "description": "Provide a complete library of annotation components",
5
5
  "main": "./dist/index.js",
6
6
  "es": "./es/index.js",
@@ -43,8 +43,8 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@ant-design/icons": "^4.6.2",
46
- "@labelbee/lb-annotation": "1.14.0-alpha.6",
47
- "@labelbee/lb-utils": "1.7.0-alpha.5",
46
+ "@labelbee/lb-annotation": "1.14.0-alpha.8",
47
+ "@labelbee/lb-utils": "1.7.0-alpha.6",
48
48
  "ahooks": "^3.4.0",
49
49
  "classnames": "^2.3.0",
50
50
  "lodash": "^4.17.21",