@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.
- package/dist/_virtual/highlightWorker.js +1 -1
- package/dist/core/pointCloud/PCDLoader.js +2 -2
- package/dist/core/toolOperation/pointCloud2dOperation.js +1 -1
- package/dist/types/core/pointCloud/PCDLoader.d.ts +1 -7
- package/es/_virtual/highlightWorker.js +1 -1
- package/es/core/pointCloud/PCDLoader.js +2 -2
- package/es/core/toolOperation/pointCloud2dOperation.js +1 -1
- package/package.json +3 -3
|
@@ -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("
|
|
1
|
+
"use strict";var _rollupPluginWebWorkerLoader__helper__browser__createBase64WorkerFactory=require("./_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js"),WorkerFactory=_rollupPluginWebWorkerLoader__helper__browser__createBase64WorkerFactory.createBase64WorkerFactory("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwp2YXIgd29ya2VyX2NvZGU9ZnVuY3Rpb24oeCl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIGcodCl7Y29uc3QgZT0tNyxvPTMsaT1vLWU7cmV0dXJuIHQ8ZSYmKHQ9ZSksdD5vJiYodD1vKSxNYXRoLmZsb29yKCh0LWUpL2kqMjU1KX1mdW5jdGlvbiBwKCl7bGV0IHQ7Y29uc3QgZT1uZXcgQXJyYXkoMjU2KS5maWxsKCIiKS5tYXAoKCk9Pm5ldyBBcnJheSgzKS5maWxsKCIiKSk7Zm9yKGxldCBvPTA7bzwyMDtvKyspe2Zvcih0PTA7dDwzMjt0KyspZVt0XVswXT0xMjgr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z29uUG9pbnRMaXN0Om8sYXR0cmlidXRlOmkseDpzLHk6YSx6OnIsY29sb3JMaXN0Om4sdmFsaWQ6dX0pe2lmKG0oe3g6cyx5OmF9LG8pJiZyPj10JiZyPD1lKXJldHVybiB1PT09ITE/WzEsMTAzLzI1NSwxMDIvMjU1XTpuW2ldP25baV0ucmdiYS5zbGljZSgwLDMpLm1hcChsPT5sLzI1NSk6WzEsMCwwXX1yZXR1cm4gb25tZXNzYWdlPWZ1bmN0aW9uKGUpe2NvbnN0e3Bvc2l0aW9uOm8sY29sb3I6aSxjdWJvaWRMaXN0OnMsY29sb3JMaXN0OmF9PWUuZGF0YTtsZXQgcj0wO2ZvcihsZXQgbj0wO248by5sZW5ndGg7bis9Myl7Y29uc3QgdT1vW25dLGM9b1tuKzFdLGw9b1tuKzJdLGQ9cy5tYXAoZj0+Yih7cG9seWdvblBvaW50TGlzdDpmLnBvbHlnb25Qb2ludExpc3Qsek1pbjpmLnpNaW4sek1heDpmLnpNYXgseDp1LHk6Yyx6OmwsYXR0cmlidXRlOmYuYXR0cmlidXRlLGNvbG9yTGlzdDphLHZhbGlkOmYudmFsaWR9KSkuZmlsdGVyKGY9PmYpLnBvcCgpO2lmKGQpe3IrKztjb25zdFtmLHksTV09ZDtpW25dPWYsaVtuKzFdPXksaVtuKzJdPU19ZWxzZXtjb25zdCBmPWcobCkseT1DW2ZdLFtNLHcsX109eTtpW25dPU0vMjU1LGlbbisxXT13LzI1NSxpW24rMl09Xy8yNTV9fXBvc3RNZXNzYWdlKHtwb2ludHM6byxjb2xvcjppLG51bTpyfSl9LHguaXNJblBvbHlnb249bSxPYmplY3QuZGVmaW5lUHJvcGVydHkoeCwiX19lc01vZHVsZSIse3ZhbHVlOiEwfSkseH0oe30pOwoK",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(
|
|
2
|
-
`);for(let
|
|
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=(
|
|
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(
|
|
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
|
|
1
|
+
import{createBase64WorkerFactory as d}from"./_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js";var s=d("Lyog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dFtmLHksTV09ZDtpW25dPWYsaVtuKzFdPXksaVtuKzJdPU19ZWxzZXtjb25zdCBmPWcobCkseT1DW2ZdLFtNLHcsX109eTtpW25dPU0vMjU1LGlbbisxXT13LzI1NSxpW24rMl09Xy8yNTV9fXBvc3RNZXNzYWdlKHtwb2ludHM6byxjb2xvcjppLG51bTpyfSl9LHguaXNJblBvbHlnb249bSxPYmplY3QuZGVmaW5lUHJvcGVydHkoeCwiX19lc01vZHVsZSIse3ZhbHVlOiEwfSkseH0oe30pOwoK",null,!1);export{s as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Loader as
|
|
2
|
-
`);for(let
|
|
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
|
|
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.
|
|
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.
|
|
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": "
|
|
101
|
+
"gitHead": "47a05462b795baaad6d5ec881545fe6499e63933"
|
|
102
102
|
}
|