@labelbee/lb-annotation 1.12.0-alpha.3 → 1.12.0-alpha.4
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";Object.defineProperty(exports,"__esModule",{value:!0});var lbUtils=require("@labelbee/lb-utils"),tool=require("../../constant/tool.js"),CanvasScheduler=require("../../newCore/CanvasScheduler.js"),index=require("./index.js"),pointCloud2dOperation=require("../toolOperation/pointCloud2dOperation.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";Object.defineProperty(exports,"__esModule",{value:!0});var lbUtils=require("@labelbee/lb-utils"),tool=require("../../constant/tool.js"),CanvasScheduler=require("../../newCore/CanvasScheduler.js"),index=require("./index.js"),pointCloud2dOperation=require("../toolOperation/pointCloud2dOperation.js"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,o)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,__spreadValues=(e,t)=>{for(var o in t||(t={}))__hasOwnProp.call(t,o)&&__defNormalProp(e,o,t[o]);if(__getOwnPropSymbols)for(var o of __getOwnPropSymbols(t))__propIsEnum.call(t,o)&&__defNormalProp(e,o,t[o]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));const createEmptyImage=e=>{const t=document.createElement("canvas");t.width=e.width,t.height=e.height;const o=t.getContext("2d");return o?(o.fillStyle="black",o.fillRect(0,0,e.width,e.height),t.toDataURL()):""};class PointCloudAnnotation{constructor({size:t,container:o,pcdPath:n,polygonOperationProps:u,config:c,checkMode:O}){this.updatePolygonList=(m,C)=>{let d=m.map(i=>{var r;const{polygon2d:p}=this.pointCloudInstance.getBoxTopPolygon2DCoordinate(i);return{id:i.id,sourceID:"",pointList:p,isRect:!0,valid:(r=i.valid)!=null?r:!0,attribute:i.attribute}});C&&(d=d.concat(C.map(i=>{var r;return __spreadProps(__spreadValues({},i),{pointList:(r=i==null?void 0:i.pointList)==null?void 0:r.map(p=>lbUtils.PointCloudUtils.transferWorld2Canvas(p,this.pointCloud2dOperation.size))})}))),this.pointCloud2dOperation.setResult(d)};const P=this.getDefaultOrthographic(t),f=createEmptyImage(t),h=new Image;h.src=f;const s=new CanvasScheduler.CanvasScheduler({container:o}),l=new index.PointCloud({container:o,noAppend:!0,isOrthographicCamera:!0,orthographicParams:P});n&&l.loadPCDFile(n),s.createCanvas(l.renderer.domElement);const g={container:o,size:t,config:JSON.stringify(c),imgNode:h,isAppend:!1,checkMode:O};u&&Object.assign(g,u);const a=new pointCloud2dOperation(g);a.eventBinding(),a.setPattern(tool.EPolygonPattern.Rect),s.createCanvas(a.canvas,{size:t}),this.pointCloud2dOperation=a,this.pointCloudInstance=l,this.canvasScheduler=s,this.config=c}updateConfig(t){this.config=t,this.pointCloud2dOperation.setConfig(JSON.stringify(t))}getDefaultOrthographic(t){return{left:-t.width/2,right:t.width/2,top:t.height/2,bottom:-t.height/2,near:100,far:-100}}initSize(t){this.pointCloudInstance.updateTopCamera(),this.pointCloudInstance.setDefaultControls(),this.pointCloudInstance.initRenderer(),this.pointCloudInstance.initOrthographicCamera(this.getDefaultOrthographic(t)),this.pointCloudInstance.render();const o=createEmptyImage(t),n=new Image;n.src=o,n.onload=()=>{this.pointCloud2dOperation.setImgNode(n),this.pointCloud2dOperation.initImgPos()},this.pointCloud2dOperation.setCanvasSize(t)}addPolygonListOnTopView(t){const o=lbUtils.PointCloudUtils.getBoxParamsFromResultList(t),n=lbUtils.PointCloudUtils.getPolygonListFromResultList(t);this.updatePolygonList(o,n)}updateData(t,o,n){!this.pointCloud2dOperation||!this.pointCloudInstance||(this.pointCloudInstance.loadPCDFile(t,n==null?void 0:n.radius),this.addPolygonListOnTopView(o))}initAllPosition(){this.pointCloudInstance.updateTopCamera(),this.pointCloud2dOperation.initPosition()}clearAllData(){this.pointCloudInstance.clearPointCloudAndRender(),this.pointCloud2dOperation.clearResult()}}exports.PointCloudAnnotation=PointCloudAnnotation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{PointCloudUtils as
|
|
1
|
+
import{PointCloudUtils as u}from"@labelbee/lb-utils";import{EPolygonPattern as I}from"../../constant/tool.js";import{CanvasScheduler as D}from"../../newCore/CanvasScheduler.js";import{PointCloud as L}from"./index.js";import S from"../toolOperation/pointCloud2dOperation.js";var b=Object.defineProperty,R=Object.defineProperties,j=Object.getOwnPropertyDescriptors,f=Object.getOwnPropertySymbols,A=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable,O=(e,t,o)=>t in e?b(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,x=(e,t)=>{for(var o in t||(t={}))A.call(t,o)&&O(e,o,t[o]);if(f)for(var o of f(t))E.call(t,o)&&O(e,o,t[o]);return e},N=(e,t)=>R(e,j(t));const P=e=>{const t=document.createElement("canvas");t.width=e.width,t.height=e.height;const o=t.getContext("2d");return o?(o.fillStyle="black",o.fillRect(0,0,e.width,e.height),t.toDataURL()):""};class T{constructor({size:t,container:o,pcdPath:n,polygonOperationProps:c,config:h,checkMode:v}){this.updatePolygonList=(_,m)=>{let d=_.map(i=>{var r;const{polygon2d:p}=this.pointCloudInstance.getBoxTopPolygon2DCoordinate(i);return{id:i.id,sourceID:"",pointList:p,isRect:!0,valid:(r=i.valid)!=null?r:!0,attribute:i.attribute}});m&&(d=d.concat(m.map(i=>{var r;return N(x({},i),{pointList:(r=i==null?void 0:i.pointList)==null?void 0:r.map(p=>u.transferWorld2Canvas(p,this.pointCloud2dOperation.size))})}))),this.pointCloud2dOperation.setResult(d)};const y=this.getDefaultOrthographic(t),w=P(t),g=new Image;g.src=w;const s=new D({container:o}),l=new L({container:o,noAppend:!0,isOrthographicCamera:!0,orthographicParams:y});n&&l.loadPCDFile(n),s.createCanvas(l.renderer.domElement);const C={container:o,size:t,config:JSON.stringify(h),imgNode:g,isAppend:!1,checkMode:v};c&&Object.assign(C,c);const a=new S(C);a.eventBinding(),a.setPattern(I.Rect),s.createCanvas(a.canvas,{size:t}),this.pointCloud2dOperation=a,this.pointCloudInstance=l,this.canvasScheduler=s,this.config=h}updateConfig(t){this.config=t,this.pointCloud2dOperation.setConfig(JSON.stringify(t))}getDefaultOrthographic(t){return{left:-t.width/2,right:t.width/2,top:t.height/2,bottom:-t.height/2,near:100,far:-100}}initSize(t){this.pointCloudInstance.updateTopCamera(),this.pointCloudInstance.setDefaultControls(),this.pointCloudInstance.initRenderer(),this.pointCloudInstance.initOrthographicCamera(this.getDefaultOrthographic(t)),this.pointCloudInstance.render();const o=P(t),n=new Image;n.src=o,n.onload=()=>{this.pointCloud2dOperation.setImgNode(n),this.pointCloud2dOperation.initImgPos()},this.pointCloud2dOperation.setCanvasSize(t)}addPolygonListOnTopView(t){const o=u.getBoxParamsFromResultList(t),n=u.getPolygonListFromResultList(t);this.updatePolygonList(o,n)}updateData(t,o,n){!this.pointCloud2dOperation||!this.pointCloudInstance||(this.pointCloudInstance.loadPCDFile(t,n==null?void 0:n.radius),this.addPolygonListOnTopView(o))}initAllPosition(){this.pointCloudInstance.updateTopCamera(),this.pointCloud2dOperation.initPosition()}clearAllData(){this.pointCloudInstance.clearPointCloudAndRender(),this.pointCloud2dOperation.clearResult()}}export{T as PointCloudAnnotation};
|
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.4",
|
|
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.4",
|
|
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": "4322b40f804d042c085baecf8754b3813bdd89f0"
|
|
102
102
|
}
|