@labelbee/lb-components 1.12.0-alpha.2 → 1.12.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/pointCloudView/PointCloudContext.js +1 -1
- package/dist/components/pointCloudView/PointCloudSegment.js +1 -1
- package/dist/components/pointCloudView/index.js +1 -1
- package/dist/hooks/annotation.js +1 -1
- package/dist/types/App.d.ts +2 -8
- package/dist/types/hooks/annotation.d.ts +0 -1
- package/es/components/pointCloudView/PointCloudContext.js +1 -1
- package/es/components/pointCloudView/PointCloudSegment.js +1 -1
- package/es/components/pointCloudView/index.js +1 -1
- package/es/hooks/annotation.js +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbUtils=require("@labelbee/lb-utils"),React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),ctx=require("../../store/ctx.js"),actionCreators=require("../../store/annotation/actionCreators.js");function _interopDefaultLegacy(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var React__default=_interopDefaultLegacy(React);const PointCloudContext=React__default.default.createContext({pointCloudBoxList:[],pointCloudSphereList:[],displayPointCloudList:[],displaySphereList:[],displayLineList:[],polygonList:[],lineList:[],selectedID:"",selectedIDs:[],valid:!0,setSelectedIDs:()=>{},setPointCloudResult:()=>{},setPointCloudSphereList:()=>{},setPointCloudValid:()=>{},setTopViewInstance:()=>{},setSideViewInstance:()=>{},setBackViewInstance:()=>{},setMainViewInstance:()=>{},addSelectedID:()=>{},selectedAllBoxes:()=>{},addPointCloudBox:()=>[],addPointCloudSphere:()=>[],setPolygonList:()=>{},setLineList:()=>{},zoom:1,setZoom:()=>{},history:new lbAnnotation.ActionsHistory,hideAttributes:[],setHideAttributes:()=>{},toggleAttributesVisible:()=>{},reRender:()=>{},setAttrPanelLayout:()=>{},attrPanelLayout:"",syncAllViewPointCloudColor:()=>{},defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:lbAnnotation.EToolName.Rect,setPointCloudPattern:()=>{},selectSpecAttr:()=>{},globalPattern:lbUtils.EPointCloudPattern.Detection,setGlobalPattern:()=>{},setPtSegmentInstance:()=>{},segmentation:[],setSegmentation:()=>{}}),PointCloudProvider=({children:r})=>{const[l,V]=React.useState([]),[
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbUtils=require("@labelbee/lb-utils"),React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),ctx=require("../../store/ctx.js"),actionCreators=require("../../store/annotation/actionCreators.js");function _interopDefaultLegacy(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var React__default=_interopDefaultLegacy(React);const PointCloudContext=React__default.default.createContext({pointCloudBoxList:[],pointCloudSphereList:[],displayPointCloudList:[],displaySphereList:[],displayLineList:[],polygonList:[],lineList:[],selectedID:"",selectedIDs:[],valid:!0,setSelectedIDs:()=>{},setPointCloudResult:()=>{},setPointCloudSphereList:()=>{},setPointCloudValid:()=>{},setTopViewInstance:()=>{},setSideViewInstance:()=>{},setBackViewInstance:()=>{},setMainViewInstance:()=>{},addSelectedID:()=>{},selectedAllBoxes:()=>{},addPointCloudBox:()=>[],addPointCloudSphere:()=>[],setPolygonList:()=>{},setLineList:()=>{},zoom:1,setZoom:()=>{},history:new lbAnnotation.ActionsHistory,hideAttributes:[],setHideAttributes:()=>{},toggleAttributesVisible:()=>{},reRender:()=>{},setAttrPanelLayout:()=>{},attrPanelLayout:"",syncAllViewPointCloudColor:()=>{},defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:lbAnnotation.EToolName.Rect,setPointCloudPattern:()=>{},selectSpecAttr:()=>{},globalPattern:lbUtils.EPointCloudPattern.Detection,setGlobalPattern:()=>{},setPtSegmentInstance:()=>{},segmentation:[],setSegmentation:()=>{}}),PointCloudProvider=({children:r})=>{const[l,V]=React.useState([]),[f,x]=React.useState([]),[L,F]=React.useState([]),[g,k]=React.useState([]),[a,m]=React.useState([]),[D,z]=React.useState(!0),[B,Z]=React.useState(1),[o,U]=React.useState(),[R,J]=React.useState(),[E,K]=React.useState(),[n,Q]=React.useState(),[H,W]=React.useState(""),[y,X]=React.useState(lbAnnotation.EToolName.Rect),Y=React.useRef(new lbAnnotation.ActionsHistory).current,[s,A]=React.useState([]),[_,$]=React.useState(""),[h,tt]=React.useState(lbUtils.EPointCloudPattern.Detection),[p,j]=React.useState(void 0),[I,et]=React.useState([]),ot=ctx.useDispatch(),q=React.useMemo(()=>a.length===1?a[0]:"",[a]),G=React.useMemo(()=>{const u=l.find(t=>t.id===q),S=t=>{const e=l.concat(t);return V(e),e},d=t=>{const e=f.concat(t);return x(e),e},c=t=>{z(t!==!1)},i=t=>{t===void 0&&m([]),typeof t=="string"&&m([t]),Array.isArray(t)&&m(Array.from(new Set(t)))},st=t=>{a.includes(t)?i(a.filter(e=>e!==t)):i([...a,t])},it=()=>{if(y===lbAnnotation.EToolName.Rect){const t=l.map(e=>e.id);i(t),o==null||o.pointCloud2dOperation.setSelectedIDs(t)}},lt=t=>{i(l.filter(e=>e.attribute===t).map(e=>e.id))},M=l.filter(t=>!s.includes(t.attribute)),N=f.filter(t=>!s.includes(t.attribute)),O=g.filter(t=>t.attribute&&!s.includes(t.attribute)),at=t=>{if(s.includes(t))A(s.filter(e=>e!==t));else{const e=s.concat(t);A(e)}},rt=(t=M,e=L,v=N,P=O,b=I)=>{var C;l.forEach(w=>{n==null||n.removeObjectByName(w.id)}),f.forEach(w=>{n==null||n.removeObjectByName(w.id)}),o==null||o.updatePolygonList(t,e),o==null||o.updatePointList(v),o==null||o.updateLineList(P),n==null||n.generateBoxes(t),n==null||n.generateSpheres(v),(C=p==null?void 0:p.store)==null||C.updateCurrentSegment(b),T(t)},T=t=>{const e=n==null?void 0:n.highlightOriginPointCloud(t);return new Promise(v=>{e==null||e.then(P=>{[o].forEach(b=>{var C;P&&((C=b==null?void 0:b.pointCloudInstance)==null||C.updateColor(P),v({color:P}))})}).catch(P=>{console.error(P)})})};return{selectedID:q,pointCloudBoxList:l,pointCloudSphereList:f,displayPointCloudList:M,displaySphereList:N,displayLineList:O,selectedIDs:a,setPointCloudResult:V,setSelectedIDs:i,addPointCloudBox:S,addPointCloudSphere:d,setPointCloudSphereList:x,valid:D,selectedPointCloudBox:u,setPointCloudValid:c,addSelectedID:st,selectedAllBoxes:it,topViewInstance:o,setTopViewInstance:U,sideViewInstance:R,setSideViewInstance:J,backViewInstance:E,setBackViewInstance:K,mainViewInstance:n,setMainViewInstance:Q,polygonList:L,setPolygonList:F,lineList:g,setLineList:k,zoom:B,setZoom:Z,history:Y,toggleAttributesVisible:at,hideAttributes:s,setHideAttributes:A,reRender:rt,attrPanelLayout:_,setAttrPanelLayout:$,syncAllViewPointCloudColor:T,defaultAttribute:H,setDefaultAttribute:W,pointCloudPattern:y,setPointCloudPattern:X,selectSpecAttr:lt,globalPattern:h,setGlobalPattern:t=>{h!==t&&(ot(actionCreators.ChangeSave),tt(t),t===lbUtils.EPointCloudPattern.Detection&&j(void 0))},ptSegmentInstance:p,setPtSegmentInstance:j,segmentation:I,setSegmentation:et}},[D,a,l,f,L,g,o,R,E,n,B,s,_,H,y,h,p,I]),nt=()=>{const u=l.filter(i=>s.includes(i.attribute)),{setSelectedIDs:S,reRender:d}=G,c=u.map(i=>i.id);c.length>0&&S(a.filter(i=>!c.includes(i))),d()};return React.useEffect(()=>{var u,S,d,c;nt(),(S=(u=o==null?void 0:o.toolInstance)==null?void 0:u.setHiddenAttributes)==null||S.call(u,s),(c=(d=p==null?void 0:p.store)==null?void 0:d.setHiddenAttributes)==null||c.call(d,s)},[s]),React__default.default.createElement(PointCloudContext.Provider,{value:G},r)};exports.PointCloudContext=PointCloudContext,exports.PointCloudProvider=PointCloudProvider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var useSize=require("../../hooks/useSize.js"),map=require("../../store/annotation/map.js"),ctx=require("../../store/ctx.js"),dom=require("../../utils/dom.js"),lbAnnotation=require("@labelbee/lb-annotation"),React=require("react"),reactRedux=require("react-redux"),PointCloudContext=require("./PointCloudContext.js"),lbUtils=require("@labelbee/lb-utils");function _interopDefaultLegacy(
|
|
1
|
+
"use strict";var useSize=require("../../hooks/useSize.js"),map=require("../../store/annotation/map.js"),ctx=require("../../store/ctx.js"),dom=require("../../utils/dom.js"),lbAnnotation=require("@labelbee/lb-annotation"),React=require("react"),reactRedux=require("react-redux"),PointCloudContext=require("./PointCloudContext.js"),lbUtils=require("@labelbee/lb-utils");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var React__default=_interopDefaultLegacy(React);const PointCloudSegment=({currentData:t,config:a,checkMode:f})=>{var o,u;const n=React.useRef(null),{setPtSegmentInstance:c,setDefaultAttribute:d,ptSegmentInstance:r}=React.useContext(PointCloudContext.PointCloudContext),e=useSize(n),i=(u=(o=a==null?void 0:a.attributeList)==null?void 0:o[0])==null?void 0:u.value;return React.useEffect(()=>{var l;if(!(e==null?void 0:e.width)||!n.current||r)return;const v={left:-e.width/2,right:e.width/2,top:e.height/2,bottom:-e.height/2,near:1e3,far:-1e3},s=new lbAnnotation.PointCloud({container:n.current,isOrthographicCamera:!0,isSegment:!0,orthographicParams:v,config:a});(l=s.store)==null||l.setAttribute(i),d(i),c(s)},[e]),React.useEffect(()=>{r&&(r.initRenderer(),r.initOrthographicCamera(lbUtils.PointCloudUtils.getDefaultOrthographic(e)),r.render())},[e]),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-layout"),ref:n})};var PointCloudSegment$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudSegment);module.exports=PointCloudSegment$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var dom=require("../../utils/dom.js"),React=require("react"),PointCloud3DView=require("./PointCloud3DView.js"),PointCloudBackView=require("./PointCloudBackView.js"),PointCloudTopView=require("./PointCloudTopView.js"),PointCloudSideView=require("./PointCloudSideView.js"),PointCloud2DView=require("./PointCloud2DView.js"),PointCloudListener=require("./PointCloudListener.js"),PointCloudSegmentListener=require("./PointCloudSegmentListener.js"),PointCloudSegment=require("./PointCloudSegment.js"),PointCloudSegmentStatus=require("./PointCloudSegmentStatus.js"),PointCloudSegmentToolbar=require("./PointCloudSegmentToolbar.js"),reactRedux=require("react-redux"),ctx=require("../../store/ctx.js"),index$1=require("../../views/MainView/toolFooter/AnnotatedAttributes/index.js"),PointCloudContext=require("./PointCloudContext.js"),lbUtils=require("@labelbee/lb-utils"),annotation=require("../../hooks/annotation.js"),index=require("../../utils/index.js"),map=require("../../store/annotation/map.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var React__default=_interopDefaultLegacy(React);const PointCloudView=({currentData:t,imgList:
|
|
1
|
+
"use strict";var dom=require("../../utils/dom.js"),React=require("react"),PointCloud3DView=require("./PointCloud3DView.js"),PointCloudBackView=require("./PointCloudBackView.js"),PointCloudTopView=require("./PointCloudTopView.js"),PointCloudSideView=require("./PointCloudSideView.js"),PointCloud2DView=require("./PointCloud2DView.js"),PointCloudListener=require("./PointCloudListener.js"),PointCloudSegmentListener=require("./PointCloudSegmentListener.js"),PointCloudSegment=require("./PointCloudSegment.js"),PointCloudSegmentStatus=require("./PointCloudSegmentStatus.js"),PointCloudSegmentToolbar=require("./PointCloudSegmentToolbar.js"),reactRedux=require("react-redux"),ctx=require("../../store/ctx.js"),index$1=require("../../views/MainView/toolFooter/AnnotatedAttributes/index.js"),PointCloudContext=require("./PointCloudContext.js"),lbUtils=require("@labelbee/lb-utils"),annotation=require("../../hooks/annotation.js"),index=require("../../utils/index.js"),map=require("../../store/annotation/map.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var React__default=_interopDefaultLegacy(React);const PointCloudView=({currentData:t,imgList:d,drawLayerSlot:o,checkMode:l,intelligentFit:c})=>{const e=React.useContext(PointCloudContext.PointCloudContext),{globalPattern:r,setGlobalPattern:m}=e,C=index.jsonParser(t.result),{toolInstanceRef:a,clearToolInstance:f}=annotation.useCustomToolInstance({basicInfo:C});return React.useEffect(()=>{a.current.setPointCloudGlobalPattern=n=>{n!==r&&(m(n),f())}},[r]),React.useEffect(()=>{a.current.exportData=()=>[e.pointCloudBoxList,{valid:e.valid}],a.current.exportCustomData=()=>{var n,u,i,s;return{resultPolygon:(n=e.polygonList)!=null?n:[],resultLine:(u=e.lineList)!=null?u:[],resultPoint:(i=e.pointCloudSphereList)!=null?i:[],segmentation:(s=e.segmentation)!=null?s:[]}}},[e.pointCloudBoxList,e.valid,e.polygonList,e.lineList,e.pointCloudSphereList,e.ptSegmentInstance,e.segmentation]),d.length===0?null:r===lbUtils.EPointCloudPattern.Segmentation?React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudSegmentListener,{checkMode:l,toolInstanceRef:a}),React__default.default.createElement(PointCloudSegmentToolbar,null),React__default.default.createElement(PointCloudSegment,null),React__default.default.createElement(PointCloudSegmentStatus,null),o==null?void 0:o({direct:!0})):React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudListener,{checkMode:l,toolInstanceRef:a}),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-layout"),onContextMenu:n=>n.preventDefault()},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-wrapper")},React__default.default.createElement(index$1.AnnotatedAttributesPanelFixedLeft,null),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-content")},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container","left")},React__default.default.createElement(PointCloud2DView,null),React__default.default.createElement(PointCloud3DView,null)),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container","right")},React__default.default.createElement(PointCloudTopView,{drawLayerSlot:o,checkMode:l,intelligentFit:c}),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container","right-bottom")},React__default.default.createElement(PointCloudSideView,{checkMode:l}),React__default.default.createElement(PointCloudBackView,{checkMode:l})))),React__default.default.createElement(index$1.AnnotatedAttributesPanelFixedRight,null))))};var PointCloudView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudView);module.exports=PointCloudView$1;
|
package/dist/hooks/annotation.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),ctx=require("../store/ctx.js"),Actions=require("../store/Actions.js")
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),ctx=require("../store/ctx.js"),Actions=require("../store/Actions.js");const useCustomToolInstance=({basicInfo:o}={})=>{var s;const r=ctx.useDispatch(),n={valid:(s=o==null?void 0:o.valid)!=null?s:!0,exportData:()=>[[],{}],exportCustomData:()=>({}),clearResult:()=>{},singleOn:()=>{},on:()=>{},unbind:()=>{},setResult:()=>{},history:{initRecord:()=>{},pushHistory:()=>{}},setDefaultAttribute:t=>{},setForbidOperation:()=>{},setShowDefaultCursor:()=>{},setSubAttribute:(t,l)=>{},setValid:()=>{},updateRotate:()=>{},redo:()=>{},undo:()=>{},setPointCloudGlobalPattern:t=>{}},e=React.useRef(n),u=t=>{r({type:Actions.ANNOTATION_ACTIONS.SET_TOOL,payload:{instance:t}})},a=()=>{r({type:Actions.ANNOTATION_ACTIONS.SET_TOOL,payload:{instance:void 0}})},i=()=>{Object.assign(e.current,n)};return React.useEffect(()=>(u(e.current),()=>{a()}),[]),{toolInstanceRef:e,clearToolInstance:i}};exports.useCustomToolInstance=useCustomToolInstance;
|
package/dist/types/App.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ToolInstance } from './store/annotation/types';
|
|
3
3
|
import { GetFileData, IFileItem, LoadFileList, OnPageChange, OnSave, OnStepChange, OnSubmit } from './types/data';
|
|
4
|
-
import { Header, RenderFooter, Sider } from './types/main';
|
|
4
|
+
import { Header, RenderFooter, Sider, TDrawLayerSlot } from './types/main';
|
|
5
5
|
import { IStepInfo } from './types/step';
|
|
6
6
|
interface IAnnotationStyle {
|
|
7
7
|
strokeColor: string;
|
|
@@ -52,13 +52,7 @@ export interface AppProps {
|
|
|
52
52
|
leftSider?: () => React.ReactNode | React.ReactNode;
|
|
53
53
|
skipBeforePageTurning?: (pageTurning: Function) => void;
|
|
54
54
|
beforeRotate?: () => boolean;
|
|
55
|
-
drawLayerSlot?:
|
|
56
|
-
zoom: number;
|
|
57
|
-
currentPos: {
|
|
58
|
-
x: number;
|
|
59
|
-
y: number;
|
|
60
|
-
};
|
|
61
|
-
}) => React.ReactNode;
|
|
55
|
+
drawLayerSlot?: TDrawLayerSlot;
|
|
62
56
|
dataInjectionAtCreation: (annotationData: any) => {};
|
|
63
57
|
renderEnhance: {
|
|
64
58
|
staticRender?: (canvas: HTMLCanvasElement, data: any, style: IAnnotationStyle) => void;
|
|
@@ -22,7 +22,6 @@ export interface ICustomToolInstance {
|
|
|
22
22
|
undo: () => void;
|
|
23
23
|
redo: () => void;
|
|
24
24
|
setPointCloudGlobalPattern: (globalPattern: EPointCloudPattern) => void;
|
|
25
|
-
getPointCloudGlobalPattern: () => EPointCloudPattern;
|
|
26
25
|
[str: string]: any;
|
|
27
26
|
}
|
|
28
27
|
export interface ICustomToolInstanceProps {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{EPointCloudPattern as V}from"@labelbee/lb-utils";import
|
|
1
|
+
import{EPointCloudPattern as V}from"@labelbee/lb-utils";import Z,{useState as o,useRef as bt,useMemo as q,useEffect as mt}from"react";import{ActionsHistory as J,EToolName as x}from"@labelbee/lb-annotation";import{useDispatch as vt}from"../../store/ctx.js";import{ChangeSave as Lt}from"../../store/annotation/actionCreators.js";const K=Z.createContext({pointCloudBoxList:[],pointCloudSphereList:[],displayPointCloudList:[],displaySphereList:[],displayLineList:[],polygonList:[],lineList:[],selectedID:"",selectedIDs:[],valid:!0,setSelectedIDs:()=>{},setPointCloudResult:()=>{},setPointCloudSphereList:()=>{},setPointCloudValid:()=>{},setTopViewInstance:()=>{},setSideViewInstance:()=>{},setBackViewInstance:()=>{},setMainViewInstance:()=>{},addSelectedID:()=>{},selectedAllBoxes:()=>{},addPointCloudBox:()=>[],addPointCloudSphere:()=>[],setPolygonList:()=>{},setLineList:()=>{},zoom:1,setZoom:()=>{},history:new J,hideAttributes:[],setHideAttributes:()=>{},toggleAttributesVisible:()=>{},reRender:()=>{},setAttrPanelLayout:()=>{},attrPanelLayout:"",syncAllViewPointCloudColor:()=>{},defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:x.Rect,setPointCloudPattern:()=>{},selectSpecAttr:()=>{},globalPattern:V.Detection,setGlobalPattern:()=>{},setPtSegmentInstance:()=>{},segmentation:[],setSegmentation:()=>{}}),St=({children:Q})=>{const[r,D]=o([]),[C,B]=o([]),[L,U]=o([]),[S,W]=o([]),[a,g]=o([]),[R,X]=o(!0),[E,Y]=o(1),[n,$]=o(),[H,tt]=o(),[G,et]=o(),[i,ot]=o(),[j,nt]=o(""),[h,it]=o(x.Rect),st=bt(new J).current,[s,A]=o([]),[F,lt]=o(""),[I,rt]=o(V.Detection),[P,O]=o(void 0),[y,at]=o([]),dt=vt(),k=q(()=>a.length===1?a[0]:"",[a]),M=q(()=>{const d=r.find(t=>t.id===k),f=t=>{const e=r.concat(t);return D(e),e},c=t=>{const e=C.concat(t);return B(e),e},u=t=>{X(t!==!1)},l=t=>{t===void 0&&g([]),typeof t=="string"&&g([t]),Array.isArray(t)&&g(Array.from(new Set(t)))},ut=t=>{a.includes(t)?l(a.filter(e=>e!==t)):l([...a,t])},pt=()=>{if(h===x.Rect){const t=r.map(e=>e.id);l(t),n==null||n.pointCloud2dOperation.setSelectedIDs(t)}},Pt=t=>{l(r.filter(e=>e.attribute===t).map(e=>e.id))},N=r.filter(t=>!s.includes(t.attribute)),T=C.filter(t=>!s.includes(t.attribute)),_=S.filter(t=>t.attribute&&!s.includes(t.attribute)),ft=t=>{if(s.includes(t))A(s.filter(e=>e!==t));else{const e=s.concat(t);A(e)}},Ct=(t=N,e=L,m=T,p=_,v=y)=>{var b;r.forEach(w=>{i==null||i.removeObjectByName(w.id)}),C.forEach(w=>{i==null||i.removeObjectByName(w.id)}),n==null||n.updatePolygonList(t,e),n==null||n.updatePointList(m),n==null||n.updateLineList(p),i==null||i.generateBoxes(t),i==null||i.generateSpheres(m),(b=P==null?void 0:P.store)==null||b.updateCurrentSegment(v),z(t)},z=t=>{const e=i==null?void 0:i.highlightOriginPointCloud(t);return new Promise(m=>{e==null||e.then(p=>{[n].forEach(v=>{var b;p&&((b=v==null?void 0:v.pointCloudInstance)==null||b.updateColor(p),m({color:p}))})}).catch(p=>{console.error(p)})})};return{selectedID:k,pointCloudBoxList:r,pointCloudSphereList:C,displayPointCloudList:N,displaySphereList:T,displayLineList:_,selectedIDs:a,setPointCloudResult:D,setSelectedIDs:l,addPointCloudBox:f,addPointCloudSphere:c,setPointCloudSphereList:B,valid:R,selectedPointCloudBox:d,setPointCloudValid:u,addSelectedID:ut,selectedAllBoxes:pt,topViewInstance:n,setTopViewInstance:$,sideViewInstance:H,setSideViewInstance:tt,backViewInstance:G,setBackViewInstance:et,mainViewInstance:i,setMainViewInstance:ot,polygonList:L,setPolygonList:U,lineList:S,setLineList:W,zoom:E,setZoom:Y,history:st,toggleAttributesVisible:ft,hideAttributes:s,setHideAttributes:A,reRender:Ct,attrPanelLayout:F,setAttrPanelLayout:lt,syncAllViewPointCloudColor:z,defaultAttribute:j,setDefaultAttribute:nt,pointCloudPattern:h,setPointCloudPattern:it,selectSpecAttr:Pt,globalPattern:I,setGlobalPattern:t=>{I!==t&&(dt(Lt),rt(t),t===V.Detection&&O(void 0))},ptSegmentInstance:P,setPtSegmentInstance:O,segmentation:y,setSegmentation:at}},[R,a,r,C,L,S,n,H,G,i,E,s,F,j,h,I,P,y]),ct=()=>{const d=r.filter(l=>s.includes(l.attribute)),{setSelectedIDs:f,reRender:c}=M,u=d.map(l=>l.id);u.length>0&&f(a.filter(l=>!u.includes(l))),c()};return mt(()=>{var d,f,c,u;ct(),(f=(d=n==null?void 0:n.toolInstance)==null?void 0:d.setHiddenAttributes)==null||f.call(d,s),(u=(c=P==null?void 0:P.store)==null?void 0:c.setHiddenAttributes)==null||u.call(c,s)},[s]),Z.createElement(K.Provider,{value:M},Q)};export{K as PointCloudContext,St as PointCloudProvider};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import f from"../../hooks/useSize.js";import{a2MapStateToProps as p}from"../../store/annotation/map.js";import{LabelBeeContext as h}from"../../store/ctx.js";import{getClassName as b}from"../../utils/dom.js";import{PointCloud as g}from"@labelbee/lb-annotation";import C,{useRef as v,useContext as P,useEffect as u}from"react";import{connect as S}from"react-redux";import{PointCloudContext as x}from"./PointCloudContext.js";import{PointCloudUtils as j}from"@labelbee/lb-utils";const w=({currentData:z,config:r,checkMode:A})=>{var n,i;const o=v(null),{setPtSegmentInstance:m,setDefaultAttribute:c,ptSegmentInstance:e}=P(x),t=f(o),a=(i=(n=r==null?void 0:r.attributeList)==null?void 0:n[0])==null?void 0:i.value;return u(()=>{var l;if(!(t==null?void 0:t.width)||!o.current||e)return;const d={left:-t.width/2,right:t.width/2,top:t.height/2,bottom:-t.height/2,near:
|
|
1
|
+
import f from"../../hooks/useSize.js";import{a2MapStateToProps as p}from"../../store/annotation/map.js";import{LabelBeeContext as h}from"../../store/ctx.js";import{getClassName as b}from"../../utils/dom.js";import{PointCloud as g}from"@labelbee/lb-annotation";import C,{useRef as v,useContext as P,useEffect as u}from"react";import{connect as S}from"react-redux";import{PointCloudContext as x}from"./PointCloudContext.js";import{PointCloudUtils as j}from"@labelbee/lb-utils";const w=({currentData:z,config:r,checkMode:A})=>{var n,i;const o=v(null),{setPtSegmentInstance:m,setDefaultAttribute:c,ptSegmentInstance:e}=P(x),t=f(o),a=(i=(n=r==null?void 0:r.attributeList)==null?void 0:n[0])==null?void 0:i.value;return u(()=>{var l;if(!(t==null?void 0:t.width)||!o.current||e)return;const d={left:-t.width/2,right:t.width/2,top:t.height/2,bottom:-t.height/2,near:1e3,far:-1e3},s=new g({container:o.current,isOrthographicCamera:!0,isSegment:!0,orthographicParams:d,config:r});(l=s.store)==null||l.setAttribute(a),c(a),m(s)},[t]),u(()=>{e&&(e.initRenderer(),e.initOrthographicCamera(j.getDefaultOrthographic(t)),e.render())},[t]),C.createElement("div",{className:b("point-cloud-layout"),ref:o})};var R=S(p,null,null,{context:h})(w);export{R as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getClassName as
|
|
1
|
+
import{getClassName as n}from"../../utils/dom.js";import t,{useContext as E,useEffect as c}from"react";import j from"./PointCloud3DView.js";import x from"./PointCloudBackView.js";import b from"./PointCloudTopView.js";import S from"./PointCloudSideView.js";import v from"./PointCloud2DView.js";import w from"./PointCloudListener.js";import L from"./PointCloudSegmentListener.js";import V from"./PointCloudSegment.js";import D from"./PointCloudSegmentStatus.js";import N from"./PointCloudSegmentToolbar.js";import{connect as T}from"react-redux";import{LabelBeeContext as A}from"../../store/ctx.js";import{AnnotatedAttributesPanelFixedLeft as B,AnnotatedAttributesPanelFixedRight as F}from"../../views/MainView/toolFooter/AnnotatedAttributes/index.js";import{PointCloudContext as I}from"./PointCloudContext.js";import{EPointCloudPattern as _}from"@labelbee/lb-utils";import{useCustomToolInstance as h}from"../../hooks/annotation.js";import{jsonParser as R}from"../../utils/index.js";import{a2MapStateToProps as y}from"../../store/annotation/map.js";const G=({currentData:d,imgList:p,drawLayerSlot:r,checkMode:l,intelligentFit:C})=>{const e=E(I),{globalPattern:a,setGlobalPattern:P}=e,f=R(d.result),{toolInstanceRef:i,clearToolInstance:g}=h({basicInfo:f});return c(()=>{i.current.setPointCloudGlobalPattern=o=>{o!==a&&(P(o),g())}},[a]),c(()=>{i.current.exportData=()=>[e.pointCloudBoxList,{valid:e.valid}],i.current.exportCustomData=()=>{var o,m,u,s;return{resultPolygon:(o=e.polygonList)!=null?o:[],resultLine:(m=e.lineList)!=null?m:[],resultPoint:(u=e.pointCloudSphereList)!=null?u:[],segmentation:(s=e.segmentation)!=null?s:[]}}},[e.pointCloudBoxList,e.valid,e.polygonList,e.lineList,e.pointCloudSphereList,e.ptSegmentInstance,e.segmentation]),p.length===0?null:a===_.Segmentation?t.createElement(t.Fragment,null,t.createElement(L,{checkMode:l,toolInstanceRef:i}),t.createElement(N,null),t.createElement(V,null),t.createElement(D,null),r==null?void 0:r({direct:!0})):t.createElement(t.Fragment,null,t.createElement(w,{checkMode:l,toolInstanceRef:i}),t.createElement("div",{className:n("point-cloud-layout"),onContextMenu:o=>o.preventDefault()},t.createElement("div",{className:n("point-cloud-wrapper")},t.createElement(B,null),t.createElement("div",{className:n("point-cloud-content")},t.createElement("div",{className:n("point-cloud-container","left")},t.createElement(v,null),t.createElement(j,null)),t.createElement("div",{className:n("point-cloud-container","right")},t.createElement(b,{drawLayerSlot:r,checkMode:l,intelligentFit:C}),t.createElement("div",{className:n("point-cloud-container","right-bottom")},t.createElement(S,{checkMode:l}),t.createElement(x,{checkMode:l})))),t.createElement(F,null))))};var $=T(y,null,null,{context:A})(G);export{$ as default};
|
package/es/hooks/annotation.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useRef as c,useEffect as d}from"react";import{useDispatch as p}from"../store/ctx.js";import{ANNOTATION_ACTIONS as a}from"../store/Actions.js";
|
|
1
|
+
import{useRef as c,useEffect as d}from"react";import{useDispatch as p}from"../store/ctx.js";import{ANNOTATION_ACTIONS as a}from"../store/Actions.js";const m=({basicInfo:o}={})=>{var n;const r=p(),s={valid:(n=o==null?void 0:o.valid)!=null?n:!0,exportData:()=>[[],{}],exportCustomData:()=>({}),clearResult:()=>{},singleOn:()=>{},on:()=>{},unbind:()=>{},setResult:()=>{},history:{initRecord:()=>{},pushHistory:()=>{}},setDefaultAttribute:t=>{},setForbidOperation:()=>{},setShowDefaultCursor:()=>{},setSubAttribute:(t,O)=>{},setValid:()=>{},updateRotate:()=>{},redo:()=>{},undo:()=>{},setPointCloudGlobalPattern:t=>{}},e=c(s),u=t=>{r({type:a.SET_TOOL,payload:{instance:t}})},i=()=>{r({type:a.SET_TOOL,payload:{instance:void 0}})},l=()=>{Object.assign(e.current,s)};return d(()=>(u(e.current),()=>{i()}),[]),{toolInstanceRef:e,clearToolInstance:l}};export{m as useCustomToolInstance};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@labelbee/lb-components",
|
|
3
|
-
"version": "1.12.0-alpha.
|
|
3
|
+
"version": "1.12.0-alpha.3",
|
|
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.16.0-alpha.
|
|
47
|
-
"@labelbee/lb-utils": "1.8.0-alpha.
|
|
46
|
+
"@labelbee/lb-annotation": "1.16.0-alpha.3",
|
|
47
|
+
"@labelbee/lb-utils": "1.8.0-alpha.3",
|
|
48
48
|
"ahooks": "^3.4.0",
|
|
49
49
|
"classnames": "^2.3.0",
|
|
50
50
|
"lodash": "^4.17.21",
|