@labelbee/lb-annotation 1.12.0-alpha.5 → 1.12.0-alpha.7

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.
@@ -1 +1 @@
1
- "use strict";var _rollupPluginWebWorkerLoader__helper__browser__createBase64WorkerFactory=require("./_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js"),WorkerFactory=_rollupPluginWebWorkerLoader__helper__browser__createBase64WorkerFactory.createBase64WorkerFactory("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwp2YXIgd29ya2VyX2NvZGU9ZnVuY3Rpb24oeCl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIF8oKXtsZXQgdDtjb25zdCBlPW5ldyBBcnJheSgyNTYpLmZpbGwoIiIpLm1hcCgoKT0+bmV3IEFycmF5KDMpLmZpbGwoIiIpKTtmb3IobGV0IGk9MDtpPDIwO2krKyl7Zm9yKHQ9MDt0PDMyO3QrKyllW3RdWzBdPTEyOCs0KnQsZVt0XVsxXT0wLGVbdF1bMl09MDtmb3IoZVszMl1bMF09MjU1LGVbMzJdWzFdPTAsZVszMl1bMl09MCx0PTA7dDw2Mzt0KyspZVszMyt0XVswXT0yNTUsZVszMyt0XVsxXT00KzQqdCxlWzMzK3RdWzJdPTA7Zm9yKGVbOTZdWzBdPTI1NCxlWzk2XVsxXT0yNTUsZVs5Nl1bMl09Mix0PTA7dDw2Mjt0KyspZVs5Nyt0XVswXT0yNTAtNCp0LGVbOTcrdF1bMV09MjU1LGVbOTcrdF1bMl09Nis0KnQ7Zm9yKGVbMTU5XVswXT0xLGVbMTU5XVsxXT0yNTUsZVsxNTldWzJdPTI1NCx0PTA7dDw2NDt0KyspZVsxNjArdF1bMF09MCxlWzE2MCt0XVsxXT0yNTItdCo0LGVbMTYwK3RdWzJdPTI1NTtmb3IodD0wO3Q8MzI7dCsrKWVbMjI0K3RdWzBdPTAsZVsyMjQrdF1bMV09MC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cihsZXQgcj0wO3I8aS5sZW5ndGg7cis9Myl7Y29uc3QgbD1pW3JdLHA9aVtyKzFdLGc9aVtyKzJdLEU9dS5tYXAocz0+Yih7cG9seWdvblBvaW50TGlzdDpzLnBvbHlnb25Qb2ludExpc3Qsek1pbjpzLnpNaW4sek1heDpzLnpNYXgseDpsLHk6cCx6OmcsYXR0cmlidXRlOnMuYXR0cmlidXRlLGNvbG9yTGlzdDpjLHZhbGlkOnMudmFsaWR9KSkuZmlsdGVyKHM9PnMpLnBvcCgpO2lmKEUpe24rKztjb25zdFtzLE0seV09RTtmW3JdPXMsZltyKzFdPU0sZltyKzJdPXl9ZWxzZXtjb25zdCBzPW8tYSxNPU1hdGguZmxvb3IoKGctYSkvcyoyNTUpLHk9ZFtNXSxbQSxDLE5dPXk7ZltyXT1BLzI1NSxmW3IrMV09Qy8yNTUsZltyKzJdPU4vMjU1fX1wb3N0TWVzc2FnZSh7cG9pbnRzOmksY29sb3I6ZixudW06bn0pfSx4LmlzSW5Qb2x5Z29uPW0sT2JqZWN0LmRlZmluZVByb3BlcnR5KHgsIl9fZXNNb2R1bGUiLHt2YWx1ZTohMH0pLHh9KHt9KTsKCg==",null,!1);module.exports=WorkerFactory;
1
+ "use strict";var _rollupPluginWebWorkerLoader__helper__browser__createBase64WorkerFactory=require("./_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js"),WorkerFactory=_rollupPluginWebWorkerLoader__helper__browser__createBase64WorkerFactory.createBase64WorkerFactory("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwp2YXIgd29ya2VyX2NvZGU9ZnVuY3Rpb24oeCl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIGcodCl7Y29uc3QgZT0tNyxvPTMsaT1vLWU7cmV0dXJuIHQ8ZSYmKHQ9ZSksdD5vJiYodD1vKSxNYXRoLmZsb29yKCh0LWUpL2kqMjU1KX1mdW5jdGlvbiBwKCl7bGV0IHQ7Y29uc3QgZT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lOiEwfSkseH0oe30pOwoK",null,!1);module.exports=WorkerFactory;
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var THREE=require("three"),lbUtils=require("@labelbee/lb-utils");class PCDLoader extends THREE.Loader{constructor(f){super(f);this.littleEndian=!0}load(f,x,c,u){const i=this,l=new THREE.FileLoader(i.manager);l.setPath(i.path),l.setResponseType("arraybuffer"),l.setRequestHeader(i.requestHeader),l.setWithCredentials(i.withCredentials),l.load(f,function(d){try{x(i.parse(d))}catch(h){u?u(h):console.error(h),i.manager.itemError(f)}},c,u)}parse(f){function x(n,e){const a=n.length,r=new Uint8Array(e);let s=0,t=0,o,p,w;do if(o=n[s++],o<1<<5){if(o++,t+o>e)throw new Error("Output buffer is not large enough");if(s+o>a)throw new Error("Invalid compressed data");do r[t++]=n[s++];while(--o)}else{if(p=o>>5,w=t-((o&31)<<8)-1,s>=a)throw new Error("Invalid compressed data");if(p===7&&(p+=n[s++],s>=a))throw new Error("Invalid compressed data");if(w-=n[s++],t+p+2>e)throw new Error("Output buffer is not large enough");if(w<0)throw new Error("Invalid compressed data");if(w>=t)throw new Error("Invalid compressed data");do r[t++]=r[w++];while(--p+2)}while(s<a);return r}function c(n){const e={},a=n.search(/[\n\r]data\s(\S*)\s/i),r=/[\n\r]data\s(\S*)\s/i.exec(n.slice(a-1));if(e.data=r[1],e.headerLen=r[0].length+a,e.str=n.slice(0,e.headerLen),e.str=e.str.replace(/#.*/gi,""),e.version=/version (.*)/i.exec(e.str),e.fields=/fields (.*)/i.exec(e.str),e.size=/size (.*)/i.exec(e.str),e.type=/type (.*)/i.exec(e.str),e.count=/count (.*)/i.exec(e.str),e.width=/width (.*)/i.exec(e.str),e.height=/height (.*)/i.exec(e.str),e.viewpoint=/viewpoint (.*)/i.exec(e.str),e.points=/points (.*)/i.exec(e.str),e.version!==null&&(e.version=parseFloat(e.version[1])),e.fields=e.fields!==null?e.fields[1].split(" "):[],e.type!==null&&(e.type=e.type[1].split(" ")),e.width!==null&&(e.width=parseInt(e.width[1])),e.height!==null&&(e.height=parseInt(e.height[1])),e.viewpoint!==null&&(e.viewpoint=e.viewpoint[1]),e.points!==null&&(e.points=parseInt(e.points[1],10)),e.points===null&&(e.points=e.width*e.height),e.size!==null&&(e.size=e.size[1].split(" ").map(function(t){return parseInt(t,10)})),e.count!==null)e.count=e.count[1].split(" ").map(function(t){return parseInt(t,10)});else{e.count=[];for(let t=0,o=e.fields.length;t<o;t++)e.count.push(1)}e.offset={};let s=0;for(let t=0,o=e.fields.length;t<o;t++)e.data==="ascii"?e.offset[e.fields[t]]=t:(e.offset[e.fields[t]]=s,s+=e.size[t]*e.count[t]);return e.rowSize=s,e}const u=THREE.LoaderUtils.decodeText(new Uint8Array(f)),i=c(u),l=[],d=[],h=[];let g=-Number.MAX_SAFE_INTEGER,m=Number.MAX_SAFE_INTEGER;if(i.data==="ascii"){const{offset:n}=i,a=u.slice(i.headerLen).split(`
2
- `);for(let r=0,s=a.length;r<s;r++){if(a[r]==="")continue;const t=a[r].split(" ");let o;if(n.x!==void 0&&(l.push(parseFloat(t[n.x])),l.push(parseFloat(t[n.y])),o=parseFloat(t[n.z]),l.push(o)),this.genColorByCoord){const w=this.genColorByCoord(parseFloat(t[n.x]),parseFloat(t[n.y]),parseFloat(t[n.z])).map(z=>z/255);h.push(...w)}n.normal_x!==void 0&&(d.push(parseFloat(t[n.normal_x])),d.push(parseFloat(t[n.normal_y])),o=parseFloat(t[n.normal_z]),d.push(o)),o&&(o<m&&(m=o),o>g&&(g=o))}}if(i.data==="binary_compressed"){const n=new Uint32Array(f.slice(i.headerLen,i.headerLen+8)),e=n[0],a=n[1],r=x(new Uint8Array(f,i.headerLen+8,e),a),s=new DataView(r.buffer),{offset:t}=i;for(let o=0;o<i.points;o++){let p;if(t.x!==void 0&&(l.push(s.getFloat32(i.points*t.x+i.size[0]*o,this.littleEndian)),l.push(s.getFloat32(i.points*t.y+i.size[1]*o,this.littleEndian)),p=s.getFloat32(i.points*t.z+i.size[2]*o,this.littleEndian),l.push(p)),t.normal_x!==void 0&&(d.push(s.getFloat32(i.points*t.normal_x+i.size[4]*o,this.littleEndian)),d.push(s.getFloat32(i.points*t.normal_y+i.size[5]*o,this.littleEndian)),p=s.getFloat32(i.points*t.normal_z+i.size[6]*o,this.littleEndian),d.push(p)),this.genColorByCoord){const z=this.genColorByCoord(s.getFloat32(i.points*t.x+i.size[0]*o,this.littleEndian),s.getFloat32(i.points*t.y+i.size[0]*o,this.littleEndian),s.getFloat32(i.points*t.z+i.size[0]*o,this.littleEndian)).map(E=>E/255);h.push(...z)}p&&(p<m&&(m=p),p>g&&(g=p))}}if(i.data==="binary"){const n=new DataView(f,i.headerLen),{offset:e}=i;for(let a=0,r=0;a<i.points;a++,r+=i.rowSize){let s;e.x!==void 0&&(l.push(n.getFloat32(r+e.x,this.littleEndian)),l.push(n.getFloat32(r+e.y,this.littleEndian)),s=n.getFloat32(r+e.z,this.littleEndian),l.push(s)),e.normal_x!==void 0&&(d.push(n.getFloat32(r+e.normal_x,this.littleEndian)),d.push(n.getFloat32(r+e.normal_y,this.littleEndian)),s=n.getFloat32(r+e.normal_z,this.littleEndian),d.push(s)),s&&(s<m&&(m=s),s>g&&(g=s))}for(let a=0,r=0;a<i.points;a++,r+=i.rowSize)if(this.genColorByZ){const t=this.genColorByZ({x:n.getFloat32(r+e.x,this.littleEndian),y:n.getFloat32(r+e.y,this.littleEndian),z:n.getFloat32(r+e.z,this.littleEndian),minZ:m,maxZ:g}).map(o=>o/255);h.push(...t)}}const y=new THREE.BufferGeometry;l.length>0&&y.setAttribute("position",new THREE.Float32BufferAttribute(l,3)),d.length>0&&y.setAttribute("normal",new THREE.Float32BufferAttribute(d,3)),h.length>0&&y.setAttribute("color",new THREE.Float32BufferAttribute(h,3)),y.computeBoundingSphere();const F=new THREE.PointsMaterial({size:.01});return h.length>0?F.vertexColors=!0:F.color.setHex(16777215),new THREE.Points(y,F)}genColorByCoord(f,x,c){return c<=0?[128,128,128]:c<5?[255,0,0]:c<10?[0,255,0]:[0,0,255]}genColorByZ({x:f,y:x,z:c,minZ:u,maxZ:i}){const l=i-u,d=Math.floor((c-u)/l*255),h=lbUtils.COLOR_MAP_JET[d];return[h[0],h[1],h[2]]}}exports.PCDLoader=PCDLoader;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var THREE=require("three"),lbUtils=require("@labelbee/lb-utils");class PCDLoader extends THREE.Loader{constructor(a){super(a);this.littleEndian=!0}load(a,c,h,g){const i=this,l=new THREE.FileLoader(i.manager);l.setPath(i.path),l.setResponseType("arraybuffer"),l.setRequestHeader(i.requestHeader),l.setWithCredentials(i.withCredentials),l.load(a,function(d){try{c(i.parse(d))}catch(u){g?g(u):console.error(u),i.manager.itemError(a)}},h,g)}parse(a){function c(s,e){const p=s.length,n=new Uint8Array(e);let r=0,t=0,o,w,f;do if(o=s[r++],o<1<<5){if(o++,t+o>e)throw new Error("Output buffer is not large enough");if(r+o>p)throw new Error("Invalid compressed data");do n[t++]=s[r++];while(--o)}else{if(w=o>>5,f=t-((o&31)<<8)-1,r>=p)throw new Error("Invalid compressed data");if(w===7&&(w+=s[r++],r>=p))throw new Error("Invalid compressed data");if(f-=s[r++],t+w+2>e)throw new Error("Output buffer is not large enough");if(f<0)throw new Error("Invalid compressed data");if(f>=t)throw new Error("Invalid compressed data");do n[t++]=n[f++];while(--w+2)}while(r<p);return n}function h(s){const e={},p=s.search(/[\n\r]data\s(\S*)\s/i),n=/[\n\r]data\s(\S*)\s/i.exec(s.slice(p-1));if(e.data=n[1],e.headerLen=n[0].length+p,e.str=s.slice(0,e.headerLen),e.str=e.str.replace(/#.*/gi,""),e.version=/version (.*)/i.exec(e.str),e.fields=/fields (.*)/i.exec(e.str),e.size=/size (.*)/i.exec(e.str),e.type=/type (.*)/i.exec(e.str),e.count=/count (.*)/i.exec(e.str),e.width=/width (.*)/i.exec(e.str),e.height=/height (.*)/i.exec(e.str),e.viewpoint=/viewpoint (.*)/i.exec(e.str),e.points=/points (.*)/i.exec(e.str),e.version!==null&&(e.version=parseFloat(e.version[1])),e.fields=e.fields!==null?e.fields[1].split(" "):[],e.type!==null&&(e.type=e.type[1].split(" ")),e.width!==null&&(e.width=parseInt(e.width[1])),e.height!==null&&(e.height=parseInt(e.height[1])),e.viewpoint!==null&&(e.viewpoint=e.viewpoint[1]),e.points!==null&&(e.points=parseInt(e.points[1],10)),e.points===null&&(e.points=e.width*e.height),e.size!==null&&(e.size=e.size[1].split(" ").map(function(t){return parseInt(t,10)})),e.count!==null)e.count=e.count[1].split(" ").map(function(t){return parseInt(t,10)});else{e.count=[];for(let t=0,o=e.fields.length;t<o;t++)e.count.push(1)}e.offset={};let r=0;for(let t=0,o=e.fields.length;t<o;t++)e.data==="ascii"?e.offset[e.fields[t]]=t:(e.offset[e.fields[t]]=r,r+=e.size[t]*e.count[t]);return e.rowSize=r,e}const g=THREE.LoaderUtils.decodeText(new Uint8Array(a)),i=h(g),l=[],d=[],u=[];if(i.data==="ascii"){const{offset:s}=i,p=g.slice(i.headerLen).split(`
2
+ `);for(let n=0,r=p.length;n<r;n++){if(p[n]==="")continue;const t=p[n].split(" ");if(s.x!==void 0&&(l.push(parseFloat(t[s.x])),l.push(parseFloat(t[s.y])),l.push(parseFloat(t[s.z]))),this.genColorByZ){const w=this.genColorByZ(parseFloat(t[s.x]),parseFloat(t[s.y]),parseFloat(t[s.z])).map(f=>f/255);u.push(...w)}s.normal_x!==void 0&&(d.push(parseFloat(t[s.normal_x])),d.push(parseFloat(t[s.normal_y])),d.push(parseFloat(t[s.normal_z])))}}if(i.data==="binary_compressed"){const s=new Uint32Array(a.slice(i.headerLen,i.headerLen+8)),e=s[0],p=s[1],n=c(new Uint8Array(a,i.headerLen+8,e),p),r=new DataView(n.buffer),{offset:t}=i;for(let o=0;o<i.points;o++)if(t.x!==void 0&&(l.push(r.getFloat32(i.points*t.x+i.size[0]*o,this.littleEndian)),l.push(r.getFloat32(i.points*t.y+i.size[1]*o,this.littleEndian)),l.push(r.getFloat32(i.points*t.z+i.size[2]*o,this.littleEndian))),t.normal_x!==void 0&&(d.push(r.getFloat32(i.points*t.normal_x+i.size[4]*o,this.littleEndian)),d.push(r.getFloat32(i.points*t.normal_y+i.size[5]*o,this.littleEndian)),d.push(r.getFloat32(i.points*t.normal_z+i.size[6]*o,this.littleEndian))),this.genColorByZ){const f=this.genColorByZ(r.getFloat32(i.points*t.x+i.size[0]*o,this.littleEndian),r.getFloat32(i.points*t.y+i.size[0]*o,this.littleEndian),r.getFloat32(i.points*t.z+i.size[0]*o,this.littleEndian)).map(F=>F/255);u.push(...f)}}if(i.data==="binary"){const s=new DataView(a,i.headerLen),{offset:e}=i;for(let p=0,n=0;p<i.points;p++,n+=i.rowSize)if(e.x!==void 0&&(l.push(s.getFloat32(n+e.x,this.littleEndian)),l.push(s.getFloat32(n+e.y,this.littleEndian)),l.push(s.getFloat32(n+e.z,this.littleEndian))),e.normal_x!==void 0&&(d.push(s.getFloat32(n+e.normal_x,this.littleEndian)),d.push(s.getFloat32(n+e.normal_y,this.littleEndian)),d.push(s.getFloat32(n+e.normal_z,this.littleEndian))),this.genColorByZ){const t=this.genColorByZ(s.getFloat32(n+e.x,this.littleEndian),s.getFloat32(n+e.y,this.littleEndian),s.getFloat32(n+e.z,this.littleEndian)).map(o=>o/255);u.push(...t)}}const x=new THREE.BufferGeometry;l.length>0&&x.setAttribute("position",new THREE.Float32BufferAttribute(l,3)),d.length>0&&x.setAttribute("normal",new THREE.Float32BufferAttribute(d,3)),u.length>0&&x.setAttribute("color",new THREE.Float32BufferAttribute(u,3)),x.computeBoundingSphere();const y=new THREE.PointsMaterial({size:.01});return u.length>0?y.vertexColors=!0:y.color.setHex(16777215),new THREE.Points(x,y)}genColorByCoord(a,c,h){return h<=0?[128,128,128]:h<5?[255,0,0]:h<10?[0,255,0]:[0,0,255]}genColorByZ(a,c,h){const g=getIndex(h),i=lbUtils.COLOR_MAP_JET[g];return[i[0],i[1],i[2]]}}function getIndex(m){const a=-7,c=3,h=c-a;return m<a&&(m=a),m>c&&(m=c),Math.floor((m-a)/h*255)}exports.PCDLoader=PCDLoader;
@@ -1 +1 @@
1
- "use strict";var lbUtils=require("@labelbee/lb-utils"),annotation=require("../../constant/annotation.js"),tool=require("../../constant/tool.js"),AxisUtils=require("../../utils/tool/AxisUtils.js"),CommonToolUtils=require("../../utils/tool/CommonToolUtils.js"),DrawUtils=require("../../utils/tool/DrawUtils.js"),PolygonUtils=require("../../utils/tool/PolygonUtils.js"),defaultConfig=require("../../constant/defaultConfig.js"),polygonOperation=require("./polygonOperation.js"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(s,t,e)=>t in s?__defProp(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,__spreadValues=(s,t)=>{for(var e in t||(t={}))__hasOwnProp.call(t,e)&&__defNormalProp(s,e,t[e]);if(__getOwnPropSymbols)for(var e of __getOwnPropSymbols(t))__propIsEnum.call(t,e)&&__defNormalProp(s,e,t[e]);return s},__spreadProps=(s,t)=>__defProps(s,__getOwnPropDescs(t));class PointCloud2dOperation extends polygonOperation{constructor(t){super(t);this.selectedIDs=[],this.rightMouseUp=a=>{var d;if(this.drawingPointList.length>0){this.addDrawingPointToPolygonList();return}a.ctrlKey&&this.hoverID?this.emit("addSelectedIDs",this.hoverID):this.emit("setSelectedIDs",this.hoverID);const c=(d=this.polygonList.find(h=>h.id===this.hoverID))==null?void 0:d.attribute;c&&c!==this.defaultAttribute&&this.emit("syncAttribute",c)},this.onKeyDown=()=>{},this.onKeyUp=()=>{},this.renderSingleSelectedPolygon=a=>{var d;if(this.selectedPolygons){const c=this.getPointCloudLineColor(a),h=AxisUtils.default.changePointListByZoom(a.pointList,this.zoom,this.currentPos);DrawUtils.drawSelectedPolygonWithFillAndLine(this.canvas,h,{fillColor:"transparent",strokeColor:c,pointColor:"white",thickness:2,lineCap:"round",isClose:!0,lineType:(d=this.config)==null?void 0:d.lineType}),a.isRect===!0&&this.showDirectionLine===!0&&this.renderRectPolygonDirection(h)}};var e,i,o,r,n,l;this.showDirectionLine=(e=t.showDirectionLine)!=null?e:!0,this.forbidAddNew=(i=t.forbidAddNew)!=null?i:!1,this.pointCloudConfig=(o=CommonToolUtils.jsonParser(t.config))!=null?o:{},this.checkMode=(r=t.checkMode)!=null?r:!1,this.forbidAddNew===!1&&t.checkMode===!0&&(this.forbidAddNew=!0),this.config=__spreadProps(__spreadValues({},defaultConfig.polygonConfig),{textConfigurable:!1,attributeConfigurable:!0,attributeList:(l=(n=this.pointCloudConfig)==null?void 0:n.attributeList)!=null?l:[]})}get getSelectedIDs(){return this.selectedIDs}setConfig(t){var e;const i=CommonToolUtils.jsonParser(t);this.pointCloudConfig=i,this.config=__spreadProps(__spreadValues({},this.config),{attributeList:(e=i==null?void 0:i.attributeList)!=null?e:[]})}dragMouseDown(t){this.checkMode||super.dragMouseDown(t)}deletePolygon(t){this.checkMode||super.deletePolygon(t)}deletePolygonPoint(t){this.checkMode||super.deletePolygonPoint(t)}setSelectedIDs(t){this.selectedIDs=t,this.setSelectedID(this.selectedIDs.length===1?this.selectedIDs[0]:""),this.render()}deleteSelectedID(){super.deleteSelectedID(),this.selectedIDs=[],this.emit("deleteSelectedIDs")}get selectedPolygons(){return PolygonUtils.getPolygonByIDs(this.polygonList,this.selectedIDs)}getLineColor(){return"rgba(0, 255, 255, 0.5)"}getPointCloudLineColor(t){return t.valid===!1?lbUtils.INVALID_COLOR:lbUtils.toolStyleConverter.getColorFromConfig({attribute:t.attribute},__spreadProps(__spreadValues({},this.pointCloudConfig),{attributeConfigurable:!0}),{}).stroke}renderStaticPolygon(){var t;this.isHidden===!1&&((t=this.polygonList)==null||t.forEach(e=>{var i,o,r;if([...this.selectedIDs,this.editPolygonID].includes(e.id))return;const n=this.getPointCloudLineColor(e),l=AxisUtils.default.changePointListByZoom(e.pointList||[],this.zoom,this.currentPos);DrawUtils.drawPolygonWithFillAndLine(this.canvas,l,{fillColor:"transparent",strokeColor:n,pointColor:"white",thickness:(o=(i=this.style)==null?void 0:i.width)!=null?o:2,lineCap:"round",isClose:!0,lineType:(r=this.config)==null?void 0:r.lineType}),e.isRect===!0&&this.showDirectionLine===!0&&this.renderRectPolygonDirection(l)}))}renderSelectedPolygon(){var t;(t=this.selectedPolygons)==null||t.forEach(e=>{this.renderSingleSelectedPolygon(e)})}renderRectPolygonDirection(t){t.length<2||DrawUtils.drawLine(this.canvas,t[0],t[1],{color:"white",thickness:3,lineDash:[6]})}get currentPolygonListByPattern(){return this.polygonList.filter(t=>this.pattern===tool.EPolygonPattern.Rect?t.isRect===!0:this.pattern===tool.EPolygonPattern.Normal?t.isRect!==!0:!0)}getHoverID(t){var e;const i=this.getCoordinateUnderZoom(t),r=this.currentPolygonListByPattern.map(n=>__spreadProps(__spreadValues({},n),{pointList:AxisUtils.default.changePointListByZoom(n.pointList,this.zoom)}));return PolygonUtils.getHoverPolygonID(i,r,10,(e=this.config)==null?void 0:e.lineType)}switchToNextPolygon(t=annotation.ESortDirection.ascend){if(this.drawingPointList.length>0)return;const e=this.currentPolygonListByPattern.map(o=>{var r,n,l,a;return __spreadProps(__spreadValues({},o),{x:(n=(r=o.pointList[0])==null?void 0:r.x)!=null?n:0,y:(a=(l=o.pointList[0])==null?void 0:l.y)!=null?a:0})}),i=CommonToolUtils.getNextSelectedRectID(e,t,this.selectedID);if(i)return this.setSelectedIDs([i.id]),this.render(),[i.id]}setSelectedIdAfterAddingDrawing(t){this.drawingPointList.length!==0&&this.setSelectedID(t)}setSelectedID(t){var e,i;const o=this.selectedID;t!==o&&o&&((e=this._textAttributInstance)==null||e.changeSelected()),t||(i=this._textAttributInstance)==null||i.clearTextAttribute(),this.selectedID=t,this.selectedIDs=t?[t]:[],this.render()}addPointInDrawing(t){this.forbidAddNew||super.addPointInDrawing(t)}setCanvasSize(t){var e,i;const o=this.pixelRatio;this.size=t,this.setImgInfo(t),this.updateCanvasBasicStyle(this.basicCanvas,t,0),this.updateCanvasBasicStyle(this.canvas,t,10),(e=this.ctx)==null||e.scale(o,o),(i=this.basicCtx)==null||i.scale(o,o),this.initImgPos(),this.renderBasicCanvas(),this.render()}setPolygonValidAndRender(t,e=!1){if(e){super.setPolygonValidAndRender(t);return}this.emit("validUpdate",t)}}module.exports=PointCloud2dOperation;
1
+ "use strict";var lbUtils=require("@labelbee/lb-utils"),annotation=require("../../constant/annotation.js"),tool=require("../../constant/tool.js"),AxisUtils=require("../../utils/tool/AxisUtils.js"),CommonToolUtils=require("../../utils/tool/CommonToolUtils.js"),DrawUtils=require("../../utils/tool/DrawUtils.js"),PolygonUtils=require("../../utils/tool/PolygonUtils.js"),defaultConfig=require("../../constant/defaultConfig.js"),polygonOperation=require("./polygonOperation.js"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(r,t,e)=>t in r?__defProp(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,__spreadValues=(r,t)=>{for(var e in t||(t={}))__hasOwnProp.call(t,e)&&__defNormalProp(r,e,t[e]);if(__getOwnPropSymbols)for(var e of __getOwnPropSymbols(t))__propIsEnum.call(t,e)&&__defNormalProp(r,e,t[e]);return r},__spreadProps=(r,t)=>__defProps(r,__getOwnPropDescs(t));class PointCloud2dOperation extends polygonOperation{constructor(t){super(t);this.selectedIDs=[],this.rightMouseUp=a=>{var d;if(this.drawingPointList.length>0){this.addDrawingPointToPolygonList();return}if(!this.hoverID)return;if(a.ctrlKey){this.emit("addSelectedIDs",this.hoverID);return}this.emit("setSelectedIDs",this.hoverID);const c=(d=this.polygonList.find(u=>u.id===this.hoverID))==null?void 0:d.attribute;c&&c!==this.defaultAttribute&&this.emit("syncAttribute",c)},this.onKeyDown=()=>{},this.onKeyUp=()=>{},this.renderSingleSelectedPolygon=a=>{var d;if(this.selectedPolygons){const c=this.getPointCloudLineColor(a),u=AxisUtils.default.changePointListByZoom(a.pointList,this.zoom,this.currentPos);DrawUtils.drawSelectedPolygonWithFillAndLine(this.canvas,u,{fillColor:"transparent",strokeColor:c,pointColor:"white",thickness:2,lineCap:"round",isClose:!0,lineType:(d=this.config)==null?void 0:d.lineType}),a.isRect===!0&&this.showDirectionLine===!0&&this.renderRectPolygonDirection(u)}};var e,i,o,s,n,l;this.showDirectionLine=(e=t.showDirectionLine)!=null?e:!0,this.forbidAddNew=(i=t.forbidAddNew)!=null?i:!1,this.pointCloudConfig=(o=CommonToolUtils.jsonParser(t.config))!=null?o:{},this.checkMode=(s=t.checkMode)!=null?s:!1,this.forbidAddNew===!1&&t.checkMode===!0&&(this.forbidAddNew=!0),this.config=__spreadProps(__spreadValues({},defaultConfig.polygonConfig),{textConfigurable:!1,attributeConfigurable:!0,attributeList:(l=(n=this.pointCloudConfig)==null?void 0:n.attributeList)!=null?l:[]})}get getSelectedIDs(){return this.selectedIDs}setConfig(t){var e;const i=CommonToolUtils.jsonParser(t);this.pointCloudConfig=i,this.config=__spreadProps(__spreadValues({},this.config),{attributeList:(e=i==null?void 0:i.attributeList)!=null?e:[]})}dragMouseDown(t){this.checkMode||super.dragMouseDown(t)}deletePolygon(t){this.checkMode||super.deletePolygon(t)}deletePolygonPoint(t){this.checkMode||super.deletePolygonPoint(t)}setSelectedIDs(t){this.selectedIDs=t,this.setSelectedID(this.selectedIDs.length===1?this.selectedIDs[0]:""),this.render()}deleteSelectedID(){super.deleteSelectedID(),this.selectedIDs=[],this.emit("deleteSelectedIDs")}get selectedPolygons(){return PolygonUtils.getPolygonByIDs(this.polygonList,this.selectedIDs)}getLineColor(){return"rgba(0, 255, 255, 0.5)"}getPointCloudLineColor(t){return t.valid===!1?lbUtils.INVALID_COLOR:lbUtils.toolStyleConverter.getColorFromConfig({attribute:t.attribute},__spreadProps(__spreadValues({},this.pointCloudConfig),{attributeConfigurable:!0}),{}).stroke}renderStaticPolygon(){var t;this.isHidden===!1&&((t=this.polygonList)==null||t.forEach(e=>{var i,o,s;if([...this.selectedIDs,this.editPolygonID].includes(e.id))return;const n=this.getPointCloudLineColor(e),l=AxisUtils.default.changePointListByZoom(e.pointList||[],this.zoom,this.currentPos);DrawUtils.drawPolygonWithFillAndLine(this.canvas,l,{fillColor:"transparent",strokeColor:n,pointColor:"white",thickness:(o=(i=this.style)==null?void 0:i.width)!=null?o:2,lineCap:"round",isClose:!0,lineType:(s=this.config)==null?void 0:s.lineType}),e.isRect===!0&&this.showDirectionLine===!0&&this.renderRectPolygonDirection(l)}))}renderSelectedPolygon(){var t;(t=this.selectedPolygons)==null||t.forEach(e=>{this.renderSingleSelectedPolygon(e)})}renderRectPolygonDirection(t){t.length<2||DrawUtils.drawLine(this.canvas,t[0],t[1],{color:"white",thickness:3,lineDash:[6]})}get currentPolygonListByPattern(){return this.polygonList.filter(t=>this.pattern===tool.EPolygonPattern.Rect?t.isRect===!0:this.pattern===tool.EPolygonPattern.Normal?t.isRect!==!0:!0)}getHoverID(t){var e;const i=this.getCoordinateUnderZoom(t),s=this.currentPolygonListByPattern.map(n=>__spreadProps(__spreadValues({},n),{pointList:AxisUtils.default.changePointListByZoom(n.pointList,this.zoom)}));return PolygonUtils.getHoverPolygonID(i,s,10,(e=this.config)==null?void 0:e.lineType)}switchToNextPolygon(t=annotation.ESortDirection.ascend){if(this.drawingPointList.length>0)return;const e=this.currentPolygonListByPattern.map(o=>{var s,n,l,a;return __spreadProps(__spreadValues({},o),{x:(n=(s=o.pointList[0])==null?void 0:s.x)!=null?n:0,y:(a=(l=o.pointList[0])==null?void 0:l.y)!=null?a:0})}),i=CommonToolUtils.getNextSelectedRectID(e,t,this.selectedID);if(i)return this.setSelectedIDs([i.id]),this.render(),[i.id]}setSelectedIdAfterAddingDrawing(t){this.drawingPointList.length!==0&&this.setSelectedID(t)}setSelectedID(t){var e,i;const o=this.selectedID;t!==o&&o&&((e=this._textAttributInstance)==null||e.changeSelected()),t||(i=this._textAttributInstance)==null||i.clearTextAttribute(),this.selectedID=t,this.render()}addPointInDrawing(t){this.forbidAddNew||super.addPointInDrawing(t)}setCanvasSize(t){var e,i;const o=this.pixelRatio;this.size=t,this.setImgInfo(t),this.updateCanvasBasicStyle(this.basicCanvas,t,0),this.updateCanvasBasicStyle(this.canvas,t,10),(e=this.ctx)==null||e.scale(o,o),(i=this.basicCtx)==null||i.scale(o,o),this.initImgPos(),this.renderBasicCanvas(),this.render()}setPolygonValidAndRender(t,e=!1){if(e){super.setPolygonValidAndRender(t);return}this.emit("validUpdate",t)}}module.exports=PointCloud2dOperation;
@@ -4,13 +4,7 @@ export class PCDLoader extends Loader {
4
4
  load(url: any, onLoad: any, onProgress: any, onError: any): void;
5
5
  parse(data: any): Points<BufferGeometry, PointsMaterial>;
6
6
  genColorByCoord(x: any, y: any, z: any): number[];
7
- genColorByZ({ x, y, z, minZ, maxZ }: {
8
- x: any;
9
- y: any;
10
- z: any;
11
- minZ: any;
12
- maxZ: any;
13
- }): any[];
7
+ genColorByZ(x: any, y: any, z: any): any[];
14
8
  }
15
9
  import { Loader } from "three/src/loaders/Loader";
16
10
  import { BufferGeometry } from "three/src/core/BufferGeometry";
@@ -1 +1 @@
1
- import{createBase64WorkerFactory as b}from"./_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js";var d=b("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwp2YXIgd29ya2VyX2NvZGU9ZnVuY3Rpb24oeCl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIF8oKXtsZXQgdDtjb25zdCBlPW5ldyBBcnJheSgyNTYpLmZpbGwoIiIpLm1hcCgoKT0+bmV3IEFycmF5KDMpLmZpbGwoIiIpKTtmb3Iob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Sh7cG9pbnRzOmksY29sb3I6ZixudW06bn0pfSx4LmlzSW5Qb2x5Z29uPW0sT2JqZWN0LmRlZmluZVByb3BlcnR5KHgsIl9fZXNNb2R1bGUiLHt2YWx1ZTohMH0pLHh9KHt9KTsKCg==",null,!1);export{d as default};
1
+ import{createBase64WorkerFactory as d}from"./_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js";var s=d("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwp2YXIgd29ya2VyX2NvZGU9ZnVuY3Rpb24oeCl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIGcodCl7Y29uc3QgZT0tNyxvPTMsaT1vLWU7cmV0dXJuIHQ8ZSYmKHQ9ZSksdD5vJiYodD1vKSxNYXRoLmZsb29yKCh0LWUpL2kqMjU1KX1mdW5jdGlvbiBwKCl7bGV0IHQ7Y29uc3QgZT1uZXcgQXJyYXkoMjU2KS5maWxsKCIiKS5tYXAoKCk9Pm5ldyBBcnJheSgzKS5maWxsKCIiKSk7Zm9yKGxldCBvPTA7bzwyMDtvKyspe2Zvcih0PTA7dDwzMjt0KyspZVt0XVswXT0xMjgrNCp0LGVbdF1bMV09MCxlW3RdWzJdPTA7Zm9yKGVbMzJdWzBdPTI1NSxlWzMyXVsxXT0wLGVbMzJdWzJdPTAsdD0wO3Q8NjM7dCsrKWVbMzMrdF1bMF09MjU1LGVbMzMrdF1bMV09NCs0KnQsZVszMyt0XVsyXT0wO2ZvcihlWzk2XVswXT0yNTQsZVs5Nl1bMV09MjU1LGVbOTZdWzJdPTIsdD0wO3Q8NjI7dCsrKWVbOTcrdF1bMF09MjUwLTQqdCxlWzk3K3RdWzFdPTI1NSxlWzk3K3RdWzJdPTYrNCp0O2ZvcihlWzE1OV1bMF09MSxlWzE1OV1bMV09MjU1LGVbMTU5XVsyXT0yNTQsdD0wO3Q8NjQ7dCsrKWVbMTYwK3RdWzBdPTAsZVsxNjArdF1bMV09MjUyLXQqNCxlW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GQ9cy5tYXAoZj0+Yih7cG9seWdvblBvaW50TGlzdDpmLnBvbHlnb25Qb2ludExpc3Qsek1pbjpmLnpNaW4sek1heDpmLnpNYXgseDp1LHk6Yyx6OmwsYXR0cmlidXRlOmYuYXR0cmlidXRlLGNvbG9yTGlzdDphLHZhbGlkOmYudmFsaWR9KSkuZmlsdGVyKGY9PmYpLnBvcCgpO2lmKGQpe3IrKztjb25zdFtmLHksTV09ZDtpW25dPWYsaVtuKzFdPXksaVtuKzJdPU19ZWxzZXtjb25zdCBmPWcobCkseT1DW2ZdLFtNLHcsX109eTtpW25dPU0vMjU1LGlbbisxXT13LzI1NSxpW24rMl09Xy8yNTV9fXBvc3RNZXNzYWdlKHtwb2ludHM6byxjb2xvcjppLG51bTpyfSl9LHguaXNJblBvbHlnb249bSxPYmplY3QuZGVmaW5lUHJvcGVydHkoeCwiX19lc01vZHVsZSIse3ZhbHVlOiEwfSkseH0oe30pOwoK",null,!1);export{s as default};
@@ -1,2 +1,2 @@
1
- import{Loader as v,FileLoader as _,LoaderUtils as b,BufferGeometry as A,Float32BufferAttribute as E,PointsMaterial as L,Points as I}from"three";import{COLOR_MAP_JET as B}from"@labelbee/lb-utils";class S extends v{constructor(f){super(f);this.littleEndian=!0}load(f,x,c,u){const i=this,l=new _(i.manager);l.setPath(i.path),l.setResponseType("arraybuffer"),l.setRequestHeader(i.requestHeader),l.setWithCredentials(i.withCredentials),l.load(f,function(d){try{x(i.parse(d))}catch(h){u?u(h):console.error(h),i.manager.itemError(f)}},c,u)}parse(f){function x(n,e){const a=n.length,r=new Uint8Array(e);let s=0,t=0,o,p,w;do if(o=n[s++],o<1<<5){if(o++,t+o>e)throw new Error("Output buffer is not large enough");if(s+o>a)throw new Error("Invalid compressed data");do r[t++]=n[s++];while(--o)}else{if(p=o>>5,w=t-((o&31)<<8)-1,s>=a)throw new Error("Invalid compressed data");if(p===7&&(p+=n[s++],s>=a))throw new Error("Invalid compressed data");if(w-=n[s++],t+p+2>e)throw new Error("Output buffer is not large enough");if(w<0)throw new Error("Invalid compressed data");if(w>=t)throw new Error("Invalid compressed data");do r[t++]=r[w++];while(--p+2)}while(s<a);return r}function c(n){const e={},a=n.search(/[\n\r]data\s(\S*)\s/i),r=/[\n\r]data\s(\S*)\s/i.exec(n.slice(a-1));if(e.data=r[1],e.headerLen=r[0].length+a,e.str=n.slice(0,e.headerLen),e.str=e.str.replace(/#.*/gi,""),e.version=/version (.*)/i.exec(e.str),e.fields=/fields (.*)/i.exec(e.str),e.size=/size (.*)/i.exec(e.str),e.type=/type (.*)/i.exec(e.str),e.count=/count (.*)/i.exec(e.str),e.width=/width (.*)/i.exec(e.str),e.height=/height (.*)/i.exec(e.str),e.viewpoint=/viewpoint (.*)/i.exec(e.str),e.points=/points (.*)/i.exec(e.str),e.version!==null&&(e.version=parseFloat(e.version[1])),e.fields=e.fields!==null?e.fields[1].split(" "):[],e.type!==null&&(e.type=e.type[1].split(" ")),e.width!==null&&(e.width=parseInt(e.width[1])),e.height!==null&&(e.height=parseInt(e.height[1])),e.viewpoint!==null&&(e.viewpoint=e.viewpoint[1]),e.points!==null&&(e.points=parseInt(e.points[1],10)),e.points===null&&(e.points=e.width*e.height),e.size!==null&&(e.size=e.size[1].split(" ").map(function(t){return parseInt(t,10)})),e.count!==null)e.count=e.count[1].split(" ").map(function(t){return parseInt(t,10)});else{e.count=[];for(let t=0,o=e.fields.length;t<o;t++)e.count.push(1)}e.offset={};let s=0;for(let t=0,o=e.fields.length;t<o;t++)e.data==="ascii"?e.offset[e.fields[t]]=t:(e.offset[e.fields[t]]=s,s+=e.size[t]*e.count[t]);return e.rowSize=s,e}const u=b.decodeText(new Uint8Array(f)),i=c(u),l=[],d=[],h=[];let g=-Number.MAX_SAFE_INTEGER,m=Number.MAX_SAFE_INTEGER;if(i.data==="ascii"){const{offset:n}=i,a=u.slice(i.headerLen).split(`
2
- `);for(let r=0,s=a.length;r<s;r++){if(a[r]==="")continue;const t=a[r].split(" ");let o;if(n.x!==void 0&&(l.push(parseFloat(t[n.x])),l.push(parseFloat(t[n.y])),o=parseFloat(t[n.z]),l.push(o)),this.genColorByCoord){const w=this.genColorByCoord(parseFloat(t[n.x]),parseFloat(t[n.y]),parseFloat(t[n.z])).map(F=>F/255);h.push(...w)}n.normal_x!==void 0&&(d.push(parseFloat(t[n.normal_x])),d.push(parseFloat(t[n.normal_y])),o=parseFloat(t[n.normal_z]),d.push(o)),o&&(o<m&&(m=o),o>g&&(g=o))}}if(i.data==="binary_compressed"){const n=new Uint32Array(f.slice(i.headerLen,i.headerLen+8)),e=n[0],a=n[1],r=x(new Uint8Array(f,i.headerLen+8,e),a),s=new DataView(r.buffer),{offset:t}=i;for(let o=0;o<i.points;o++){let p;if(t.x!==void 0&&(l.push(s.getFloat32(i.points*t.x+i.size[0]*o,this.littleEndian)),l.push(s.getFloat32(i.points*t.y+i.size[1]*o,this.littleEndian)),p=s.getFloat32(i.points*t.z+i.size[2]*o,this.littleEndian),l.push(p)),t.normal_x!==void 0&&(d.push(s.getFloat32(i.points*t.normal_x+i.size[4]*o,this.littleEndian)),d.push(s.getFloat32(i.points*t.normal_y+i.size[5]*o,this.littleEndian)),p=s.getFloat32(i.points*t.normal_z+i.size[6]*o,this.littleEndian),d.push(p)),this.genColorByCoord){const F=this.genColorByCoord(s.getFloat32(i.points*t.x+i.size[0]*o,this.littleEndian),s.getFloat32(i.points*t.y+i.size[0]*o,this.littleEndian),s.getFloat32(i.points*t.z+i.size[0]*o,this.littleEndian)).map(C=>C/255);h.push(...F)}p&&(p<m&&(m=p),p>g&&(g=p))}}if(i.data==="binary"){const n=new DataView(f,i.headerLen),{offset:e}=i;for(let a=0,r=0;a<i.points;a++,r+=i.rowSize){let s;e.x!==void 0&&(l.push(n.getFloat32(r+e.x,this.littleEndian)),l.push(n.getFloat32(r+e.y,this.littleEndian)),s=n.getFloat32(r+e.z,this.littleEndian),l.push(s)),e.normal_x!==void 0&&(d.push(n.getFloat32(r+e.normal_x,this.littleEndian)),d.push(n.getFloat32(r+e.normal_y,this.littleEndian)),s=n.getFloat32(r+e.normal_z,this.littleEndian),d.push(s)),s&&(s<m&&(m=s),s>g&&(g=s))}for(let a=0,r=0;a<i.points;a++,r+=i.rowSize)if(this.genColorByZ){const t=this.genColorByZ({x:n.getFloat32(r+e.x,this.littleEndian),y:n.getFloat32(r+e.y,this.littleEndian),z:n.getFloat32(r+e.z,this.littleEndian),minZ:m,maxZ:g}).map(o=>o/255);h.push(...t)}}const y=new A;l.length>0&&y.setAttribute("position",new E(l,3)),d.length>0&&y.setAttribute("normal",new E(d,3)),h.length>0&&y.setAttribute("color",new E(h,3)),y.computeBoundingSphere();const z=new L({size:.01});return h.length>0?z.vertexColors=!0:z.color.setHex(16777215),new I(y,z)}genColorByCoord(f,x,c){return c<=0?[128,128,128]:c<5?[255,0,0]:c<10?[0,255,0]:[0,0,255]}genColorByZ({x:f,y:x,z:c,minZ:u,maxZ:i}){const l=i-u,d=Math.floor((c-u)/l*255),h=B[d];return[h[0],h[1],h[2]]}}export{S as PCDLoader};
1
+ import{Loader as z,FileLoader as C,LoaderUtils as v,BufferGeometry as _,Float32BufferAttribute as F,PointsMaterial as b,Points as L}from"three";import{COLOR_MAP_JET as B}from"@labelbee/lb-utils";class I extends z{constructor(a){super(a);this.littleEndian=!0}load(a,c,h,g){const i=this,l=new C(i.manager);l.setPath(i.path),l.setResponseType("arraybuffer"),l.setRequestHeader(i.requestHeader),l.setWithCredentials(i.withCredentials),l.load(a,function(d){try{c(i.parse(d))}catch(f){g?g(f):console.error(f),i.manager.itemError(a)}},h,g)}parse(a){function c(o,t){const p=o.length,n=new Uint8Array(t);let r=0,e=0,s,w,u;do if(s=o[r++],s<1<<5){if(s++,e+s>t)throw new Error("Output buffer is not large enough");if(r+s>p)throw new Error("Invalid compressed data");do n[e++]=o[r++];while(--s)}else{if(w=s>>5,u=e-((s&31)<<8)-1,r>=p)throw new Error("Invalid compressed data");if(w===7&&(w+=o[r++],r>=p))throw new Error("Invalid compressed data");if(u-=o[r++],e+w+2>t)throw new Error("Output buffer is not large enough");if(u<0)throw new Error("Invalid compressed data");if(u>=e)throw new Error("Invalid compressed data");do n[e++]=n[u++];while(--w+2)}while(r<p);return n}function h(o){const t={},p=o.search(/[\n\r]data\s(\S*)\s/i),n=/[\n\r]data\s(\S*)\s/i.exec(o.slice(p-1));if(t.data=n[1],t.headerLen=n[0].length+p,t.str=o.slice(0,t.headerLen),t.str=t.str.replace(/#.*/gi,""),t.version=/version (.*)/i.exec(t.str),t.fields=/fields (.*)/i.exec(t.str),t.size=/size (.*)/i.exec(t.str),t.type=/type (.*)/i.exec(t.str),t.count=/count (.*)/i.exec(t.str),t.width=/width (.*)/i.exec(t.str),t.height=/height (.*)/i.exec(t.str),t.viewpoint=/viewpoint (.*)/i.exec(t.str),t.points=/points (.*)/i.exec(t.str),t.version!==null&&(t.version=parseFloat(t.version[1])),t.fields=t.fields!==null?t.fields[1].split(" "):[],t.type!==null&&(t.type=t.type[1].split(" ")),t.width!==null&&(t.width=parseInt(t.width[1])),t.height!==null&&(t.height=parseInt(t.height[1])),t.viewpoint!==null&&(t.viewpoint=t.viewpoint[1]),t.points!==null&&(t.points=parseInt(t.points[1],10)),t.points===null&&(t.points=t.width*t.height),t.size!==null&&(t.size=t.size[1].split(" ").map(function(e){return parseInt(e,10)})),t.count!==null)t.count=t.count[1].split(" ").map(function(e){return parseInt(e,10)});else{t.count=[];for(let e=0,s=t.fields.length;e<s;e++)t.count.push(1)}t.offset={};let r=0;for(let e=0,s=t.fields.length;e<s;e++)t.data==="ascii"?t.offset[t.fields[e]]=e:(t.offset[t.fields[e]]=r,r+=t.size[e]*t.count[e]);return t.rowSize=r,t}const g=v.decodeText(new Uint8Array(a)),i=h(g),l=[],d=[],f=[];if(i.data==="ascii"){const{offset:o}=i,p=g.slice(i.headerLen).split(`
2
+ `);for(let n=0,r=p.length;n<r;n++){if(p[n]==="")continue;const e=p[n].split(" ");if(o.x!==void 0&&(l.push(parseFloat(e[o.x])),l.push(parseFloat(e[o.y])),l.push(parseFloat(e[o.z]))),this.genColorByZ){const w=this.genColorByZ(parseFloat(e[o.x]),parseFloat(e[o.y]),parseFloat(e[o.z])).map(u=>u/255);f.push(...w)}o.normal_x!==void 0&&(d.push(parseFloat(e[o.normal_x])),d.push(parseFloat(e[o.normal_y])),d.push(parseFloat(e[o.normal_z])))}}if(i.data==="binary_compressed"){const o=new Uint32Array(a.slice(i.headerLen,i.headerLen+8)),t=o[0],p=o[1],n=c(new Uint8Array(a,i.headerLen+8,t),p),r=new DataView(n.buffer),{offset:e}=i;for(let s=0;s<i.points;s++)if(e.x!==void 0&&(l.push(r.getFloat32(i.points*e.x+i.size[0]*s,this.littleEndian)),l.push(r.getFloat32(i.points*e.y+i.size[1]*s,this.littleEndian)),l.push(r.getFloat32(i.points*e.z+i.size[2]*s,this.littleEndian))),e.normal_x!==void 0&&(d.push(r.getFloat32(i.points*e.normal_x+i.size[4]*s,this.littleEndian)),d.push(r.getFloat32(i.points*e.normal_y+i.size[5]*s,this.littleEndian)),d.push(r.getFloat32(i.points*e.normal_z+i.size[6]*s,this.littleEndian))),this.genColorByZ){const u=this.genColorByZ(r.getFloat32(i.points*e.x+i.size[0]*s,this.littleEndian),r.getFloat32(i.points*e.y+i.size[0]*s,this.littleEndian),r.getFloat32(i.points*e.z+i.size[0]*s,this.littleEndian)).map(E=>E/255);f.push(...u)}}if(i.data==="binary"){const o=new DataView(a,i.headerLen),{offset:t}=i;for(let p=0,n=0;p<i.points;p++,n+=i.rowSize)if(t.x!==void 0&&(l.push(o.getFloat32(n+t.x,this.littleEndian)),l.push(o.getFloat32(n+t.y,this.littleEndian)),l.push(o.getFloat32(n+t.z,this.littleEndian))),t.normal_x!==void 0&&(d.push(o.getFloat32(n+t.normal_x,this.littleEndian)),d.push(o.getFloat32(n+t.normal_y,this.littleEndian)),d.push(o.getFloat32(n+t.normal_z,this.littleEndian))),this.genColorByZ){const e=this.genColorByZ(o.getFloat32(n+t.x,this.littleEndian),o.getFloat32(n+t.y,this.littleEndian),o.getFloat32(n+t.z,this.littleEndian)).map(s=>s/255);f.push(...e)}}const x=new _;l.length>0&&x.setAttribute("position",new F(l,3)),d.length>0&&x.setAttribute("normal",new F(d,3)),f.length>0&&x.setAttribute("color",new F(f,3)),x.computeBoundingSphere();const y=new b({size:.01});return f.length>0?y.vertexColors=!0:y.color.setHex(16777215),new L(x,y)}genColorByCoord(a,c,h){return h<=0?[128,128,128]:h<5?[255,0,0]:h<10?[0,255,0]:[0,0,255]}genColorByZ(a,c,h){const g=Z(h),i=B[g];return[i[0],i[1],i[2]]}}function Z(m){const a=-7,c=3,h=c-a;return m<a&&(m=a),m>c&&(m=c),Math.floor((m-a)/h*255)}export{I as PCDLoader};
@@ -1 +1 @@
1
- import{INVALID_COLOR as C,toolStyleConverter as _}from"@labelbee/lb-utils";import{ESortDirection as L}from"../../constant/annotation.js";import{EPolygonPattern as y}from"../../constant/tool.js";import f from"../../utils/tool/AxisUtils.js";import P from"../../utils/tool/CommonToolUtils.js";import p from"../../utils/tool/DrawUtils.js";import v from"../../utils/tool/PolygonUtils.js";import{polygonConfig as I}from"../../constant/defaultConfig.js";import b from"./polygonOperation.js";var w=Object.defineProperty,S=Object.defineProperties,A=Object.getOwnPropertyDescriptors,D=Object.getOwnPropertySymbols,x=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable,m=(s,t,e)=>t in s?w(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,h=(s,t)=>{for(var e in t||(t={}))x.call(t,e)&&m(s,e,t[e]);if(D)for(var e of D(t))O.call(t,e)&&m(s,e,t[e]);return s},u=(s,t)=>S(s,A(t));class j extends b{constructor(t){super(t);this.selectedIDs=[],this.rightMouseUp=a=>{var d;if(this.drawingPointList.length>0){this.addDrawingPointToPolygonList();return}a.ctrlKey&&this.hoverID?this.emit("addSelectedIDs",this.hoverID):this.emit("setSelectedIDs",this.hoverID);const c=(d=this.polygonList.find(g=>g.id===this.hoverID))==null?void 0:d.attribute;c&&c!==this.defaultAttribute&&this.emit("syncAttribute",c)},this.onKeyDown=()=>{},this.onKeyUp=()=>{},this.renderSingleSelectedPolygon=a=>{var d;if(this.selectedPolygons){const c=this.getPointCloudLineColor(a),g=f.changePointListByZoom(a.pointList,this.zoom,this.currentPos);p.drawSelectedPolygonWithFillAndLine(this.canvas,g,{fillColor:"transparent",strokeColor:c,pointColor:"white",thickness:2,lineCap:"round",isClose:!0,lineType:(d=this.config)==null?void 0:d.lineType}),a.isRect===!0&&this.showDirectionLine===!0&&this.renderRectPolygonDirection(g)}};var e,i,o,n,r,l;this.showDirectionLine=(e=t.showDirectionLine)!=null?e:!0,this.forbidAddNew=(i=t.forbidAddNew)!=null?i:!1,this.pointCloudConfig=(o=P.jsonParser(t.config))!=null?o:{},this.checkMode=(n=t.checkMode)!=null?n:!1,this.forbidAddNew===!1&&t.checkMode===!0&&(this.forbidAddNew=!0),this.config=u(h({},I),{textConfigurable:!1,attributeConfigurable:!0,attributeList:(l=(r=this.pointCloudConfig)==null?void 0:r.attributeList)!=null?l:[]})}get getSelectedIDs(){return this.selectedIDs}setConfig(t){var e;const i=P.jsonParser(t);this.pointCloudConfig=i,this.config=u(h({},this.config),{attributeList:(e=i==null?void 0:i.attributeList)!=null?e:[]})}dragMouseDown(t){this.checkMode||super.dragMouseDown(t)}deletePolygon(t){this.checkMode||super.deletePolygon(t)}deletePolygonPoint(t){this.checkMode||super.deletePolygonPoint(t)}setSelectedIDs(t){this.selectedIDs=t,this.setSelectedID(this.selectedIDs.length===1?this.selectedIDs[0]:""),this.render()}deleteSelectedID(){super.deleteSelectedID(),this.selectedIDs=[],this.emit("deleteSelectedIDs")}get selectedPolygons(){return v.getPolygonByIDs(this.polygonList,this.selectedIDs)}getLineColor(){return"rgba(0, 255, 255, 0.5)"}getPointCloudLineColor(t){return t.valid===!1?C:_.getColorFromConfig({attribute:t.attribute},u(h({},this.pointCloudConfig),{attributeConfigurable:!0}),{}).stroke}renderStaticPolygon(){var t;this.isHidden===!1&&((t=this.polygonList)==null||t.forEach(e=>{var i,o,n;if([...this.selectedIDs,this.editPolygonID].includes(e.id))return;const r=this.getPointCloudLineColor(e),l=f.changePointListByZoom(e.pointList||[],this.zoom,this.currentPos);p.drawPolygonWithFillAndLine(this.canvas,l,{fillColor:"transparent",strokeColor:r,pointColor:"white",thickness:(o=(i=this.style)==null?void 0:i.width)!=null?o:2,lineCap:"round",isClose:!0,lineType:(n=this.config)==null?void 0:n.lineType}),e.isRect===!0&&this.showDirectionLine===!0&&this.renderRectPolygonDirection(l)}))}renderSelectedPolygon(){var t;(t=this.selectedPolygons)==null||t.forEach(e=>{this.renderSingleSelectedPolygon(e)})}renderRectPolygonDirection(t){t.length<2||p.drawLine(this.canvas,t[0],t[1],{color:"white",thickness:3,lineDash:[6]})}get currentPolygonListByPattern(){return this.polygonList.filter(t=>this.pattern===y.Rect?t.isRect===!0:this.pattern===y.Normal?t.isRect!==!0:!0)}getHoverID(t){var e;const i=this.getCoordinateUnderZoom(t),n=this.currentPolygonListByPattern.map(r=>u(h({},r),{pointList:f.changePointListByZoom(r.pointList,this.zoom)}));return v.getHoverPolygonID(i,n,10,(e=this.config)==null?void 0:e.lineType)}switchToNextPolygon(t=L.ascend){if(this.drawingPointList.length>0)return;const e=this.currentPolygonListByPattern.map(o=>{var n,r,l,a;return u(h({},o),{x:(r=(n=o.pointList[0])==null?void 0:n.x)!=null?r:0,y:(a=(l=o.pointList[0])==null?void 0:l.y)!=null?a:0})}),i=P.getNextSelectedRectID(e,t,this.selectedID);if(i)return this.setSelectedIDs([i.id]),this.render(),[i.id]}setSelectedIdAfterAddingDrawing(t){this.drawingPointList.length!==0&&this.setSelectedID(t)}setSelectedID(t){var e,i;const o=this.selectedID;t!==o&&o&&((e=this._textAttributInstance)==null||e.changeSelected()),t||(i=this._textAttributInstance)==null||i.clearTextAttribute(),this.selectedID=t,this.selectedIDs=t?[t]:[],this.render()}addPointInDrawing(t){this.forbidAddNew||super.addPointInDrawing(t)}setCanvasSize(t){var e,i;const o=this.pixelRatio;this.size=t,this.setImgInfo(t),this.updateCanvasBasicStyle(this.basicCanvas,t,0),this.updateCanvasBasicStyle(this.canvas,t,10),(e=this.ctx)==null||e.scale(o,o),(i=this.basicCtx)==null||i.scale(o,o),this.initImgPos(),this.renderBasicCanvas(),this.render()}setPolygonValidAndRender(t,e=!1){if(e){super.setPolygonValidAndRender(t);return}this.emit("validUpdate",t)}}export{j as default};
1
+ import{INVALID_COLOR as C,toolStyleConverter as _}from"@labelbee/lb-utils";import{ESortDirection as I}from"../../constant/annotation.js";import{EPolygonPattern as y}from"../../constant/tool.js";import f from"../../utils/tool/AxisUtils.js";import P from"../../utils/tool/CommonToolUtils.js";import p from"../../utils/tool/DrawUtils.js";import v from"../../utils/tool/PolygonUtils.js";import{polygonConfig as L}from"../../constant/defaultConfig.js";import b from"./polygonOperation.js";var w=Object.defineProperty,S=Object.defineProperties,A=Object.getOwnPropertyDescriptors,D=Object.getOwnPropertySymbols,x=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable,m=(s,t,e)=>t in s?w(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,h=(s,t)=>{for(var e in t||(t={}))x.call(t,e)&&m(s,e,t[e]);if(D)for(var e of D(t))O.call(t,e)&&m(s,e,t[e]);return s},u=(s,t)=>S(s,A(t));class j extends b{constructor(t){super(t);this.selectedIDs=[],this.rightMouseUp=a=>{var d;if(this.drawingPointList.length>0){this.addDrawingPointToPolygonList();return}if(!this.hoverID)return;if(a.ctrlKey){this.emit("addSelectedIDs",this.hoverID);return}this.emit("setSelectedIDs",this.hoverID);const c=(d=this.polygonList.find(g=>g.id===this.hoverID))==null?void 0:d.attribute;c&&c!==this.defaultAttribute&&this.emit("syncAttribute",c)},this.onKeyDown=()=>{},this.onKeyUp=()=>{},this.renderSingleSelectedPolygon=a=>{var d;if(this.selectedPolygons){const c=this.getPointCloudLineColor(a),g=f.changePointListByZoom(a.pointList,this.zoom,this.currentPos);p.drawSelectedPolygonWithFillAndLine(this.canvas,g,{fillColor:"transparent",strokeColor:c,pointColor:"white",thickness:2,lineCap:"round",isClose:!0,lineType:(d=this.config)==null?void 0:d.lineType}),a.isRect===!0&&this.showDirectionLine===!0&&this.renderRectPolygonDirection(g)}};var e,i,o,n,r,l;this.showDirectionLine=(e=t.showDirectionLine)!=null?e:!0,this.forbidAddNew=(i=t.forbidAddNew)!=null?i:!1,this.pointCloudConfig=(o=P.jsonParser(t.config))!=null?o:{},this.checkMode=(n=t.checkMode)!=null?n:!1,this.forbidAddNew===!1&&t.checkMode===!0&&(this.forbidAddNew=!0),this.config=u(h({},L),{textConfigurable:!1,attributeConfigurable:!0,attributeList:(l=(r=this.pointCloudConfig)==null?void 0:r.attributeList)!=null?l:[]})}get getSelectedIDs(){return this.selectedIDs}setConfig(t){var e;const i=P.jsonParser(t);this.pointCloudConfig=i,this.config=u(h({},this.config),{attributeList:(e=i==null?void 0:i.attributeList)!=null?e:[]})}dragMouseDown(t){this.checkMode||super.dragMouseDown(t)}deletePolygon(t){this.checkMode||super.deletePolygon(t)}deletePolygonPoint(t){this.checkMode||super.deletePolygonPoint(t)}setSelectedIDs(t){this.selectedIDs=t,this.setSelectedID(this.selectedIDs.length===1?this.selectedIDs[0]:""),this.render()}deleteSelectedID(){super.deleteSelectedID(),this.selectedIDs=[],this.emit("deleteSelectedIDs")}get selectedPolygons(){return v.getPolygonByIDs(this.polygonList,this.selectedIDs)}getLineColor(){return"rgba(0, 255, 255, 0.5)"}getPointCloudLineColor(t){return t.valid===!1?C:_.getColorFromConfig({attribute:t.attribute},u(h({},this.pointCloudConfig),{attributeConfigurable:!0}),{}).stroke}renderStaticPolygon(){var t;this.isHidden===!1&&((t=this.polygonList)==null||t.forEach(e=>{var i,o,n;if([...this.selectedIDs,this.editPolygonID].includes(e.id))return;const r=this.getPointCloudLineColor(e),l=f.changePointListByZoom(e.pointList||[],this.zoom,this.currentPos);p.drawPolygonWithFillAndLine(this.canvas,l,{fillColor:"transparent",strokeColor:r,pointColor:"white",thickness:(o=(i=this.style)==null?void 0:i.width)!=null?o:2,lineCap:"round",isClose:!0,lineType:(n=this.config)==null?void 0:n.lineType}),e.isRect===!0&&this.showDirectionLine===!0&&this.renderRectPolygonDirection(l)}))}renderSelectedPolygon(){var t;(t=this.selectedPolygons)==null||t.forEach(e=>{this.renderSingleSelectedPolygon(e)})}renderRectPolygonDirection(t){t.length<2||p.drawLine(this.canvas,t[0],t[1],{color:"white",thickness:3,lineDash:[6]})}get currentPolygonListByPattern(){return this.polygonList.filter(t=>this.pattern===y.Rect?t.isRect===!0:this.pattern===y.Normal?t.isRect!==!0:!0)}getHoverID(t){var e;const i=this.getCoordinateUnderZoom(t),n=this.currentPolygonListByPattern.map(r=>u(h({},r),{pointList:f.changePointListByZoom(r.pointList,this.zoom)}));return v.getHoverPolygonID(i,n,10,(e=this.config)==null?void 0:e.lineType)}switchToNextPolygon(t=I.ascend){if(this.drawingPointList.length>0)return;const e=this.currentPolygonListByPattern.map(o=>{var n,r,l,a;return u(h({},o),{x:(r=(n=o.pointList[0])==null?void 0:n.x)!=null?r:0,y:(a=(l=o.pointList[0])==null?void 0:l.y)!=null?a:0})}),i=P.getNextSelectedRectID(e,t,this.selectedID);if(i)return this.setSelectedIDs([i.id]),this.render(),[i.id]}setSelectedIdAfterAddingDrawing(t){this.drawingPointList.length!==0&&this.setSelectedID(t)}setSelectedID(t){var e,i;const o=this.selectedID;t!==o&&o&&((e=this._textAttributInstance)==null||e.changeSelected()),t||(i=this._textAttributInstance)==null||i.clearTextAttribute(),this.selectedID=t,this.render()}addPointInDrawing(t){this.forbidAddNew||super.addPointInDrawing(t)}setCanvasSize(t){var e,i;const o=this.pixelRatio;this.size=t,this.setImgInfo(t),this.updateCanvasBasicStyle(this.basicCanvas,t,0),this.updateCanvasBasicStyle(this.canvas,t,10),(e=this.ctx)==null||e.scale(o,o),(i=this.basicCtx)==null||i.scale(o,o),this.initImgPos(),this.renderBasicCanvas(),this.render()}setPolygonValidAndRender(t,e=!1){if(e){super.setPolygonValidAndRender(t);return}this.emit("validUpdate",t)}}export{j as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@labelbee/lb-annotation",
3
- "version": "1.12.0-alpha.5",
3
+ "version": "1.12.0-alpha.7",
4
4
  "description": "Annotation tool collection",
5
5
  "keywords": [
6
6
  "annotation",
@@ -92,11 +92,11 @@
92
92
  "typescript": "^4.2.3"
93
93
  },
94
94
  "dependencies": {
95
- "@labelbee/lb-utils": "^1.5.0-alpha.5",
95
+ "@labelbee/lb-utils": "^1.5.0-alpha.7",
96
96
  "@turf/turf": "5.1.6",
97
97
  "color-rgba": "^2.3.0",
98
98
  "lodash": "^4.17.20",
99
99
  "three": ">=0.141.0"
100
100
  },
101
- "gitHead": "f9ca43274eff19699eabc21599bcd0303bf9c17c"
101
+ "gitHead": "47a05462b795baaad6d5ec881545fe6499e63933"
102
102
  }