Browse Source

InstancePointManager / LineSegmentManager 重构

master
修宁 6 months ago
parent
commit
e43ba249bf
  1. 3
      src/core/controls/SelectInspect.ts
  2. 1
      src/core/manager/InstancePointManager.ts
  3. 184
      src/example/example1.js

3
src/core/controls/SelectInspect.ts

@ -203,7 +203,7 @@ export default class SelectInspect implements IControls {
} }
// 创建红选包围盒 // 创建红选包围盒
private createRedSelectionBox(object: THREE.Object3D) { private createRedSelectionBox(object: Object3DLike) {
// 如果对象没有 entityId,则不创建包围盒线框 // 如果对象没有 entityId,则不创建包围盒线框
if (!object.userData.entityId) { if (!object.userData.entityId) {
return return
@ -211,6 +211,7 @@ export default class SelectInspect implements IControls {
let box: THREE.Box3 let box: THREE.Box3
if (object instanceof PointManageWrap) { if (object instanceof PointManageWrap) {
box = object.createBox3() box = object.createBox3()
} else if (object instanceof THREE.Object3D) { } else if (object instanceof THREE.Object3D) {
box = new THREE.Box3().setFromObject(object) box = new THREE.Box3().setFromObject(object)
} }

1
src/core/manager/InstancePointManager.ts

@ -245,6 +245,7 @@ export class PointManageWrap {
instancedMesh.getMatrixAt(this.meshIndex, matrix) instancedMesh.getMatrixAt(this.meshIndex, matrix)
// 创建包围盒并应用矩阵 // 创建包围盒并应用矩阵
const geometry = instancedMesh.geometry const geometry = instancedMesh.geometry
//@ts-ignore
const localBox = new THREE.Box3().setFromBufferAttribute(geometry.attributes.position) const localBox = new THREE.Box3().setFromBufferAttribute(geometry.attributes.position)
return localBox.clone().applyMatrix4(matrix) return localBox.clone().applyMatrix4(matrix)
} }

184
src/example/example1.js

@ -35,31 +35,31 @@ export default {
{ {
catalogCode: 'f1', t: 'floor', // 楼层 catalogCode: 'f1', t: 'floor', // 楼层
items: [ items: [
// { {
// id: 'rack1', id: 'rack1',
// t: 'rack', t: 'rack',
// v: true, v: true,
// tf: [[2.9, 0.1, 3.5], [0, 0, 0], [1.5, 0.25, 0.1]], tf: [[2.9, 0.1, 3.5], [0, 0, 0], [1.5, 0.25, 0.1]],
// dt: { dt: {
// rackDepth: 1, // 货架深度 rackDepth: 1, // 货架深度
// rackWidth: 5.6, rackWidth: 5.6,
// rackHeight: 4.2, rackHeight: 4.2,
// levelCount: 3, // 总层数 levelCount: 3, // 总层数
// bayCount: 4, // 总列数 bayCount: 4, // 总列数
// hideFloor: false, // 隐藏底板 hideFloor: false, // 隐藏底板
// extendColumns: true, // 扩展挡板 extendColumns: true, // 扩展挡板
// columnSpacing: 1, // 支脚跨越 columnSpacing: 1, // 支脚跨越
// bays: [ // 每列的配置 bays: [ // 每列的配置
// { {
// bayWidth: 1.4, // 列的宽度 bayWidth: 1.4, // 列的宽度
// levelHeight: [1.4, 1.4, 1.4] // 每层的高度 levelHeight: [1.4, 1.4, 1.4] // 每层的高度
// }, },
// { bayWidth: 1.4, levelHeight: [1.4, 1.4, 1.4] }, { bayWidth: 1.4, levelHeight: [1.4, 1.4, 1.4] },
// { bayWidth: 1.4, levelHeight: [1.4, 1.4, 1.4] }, { bayWidth: 1.4, levelHeight: [1.4, 1.4, 1.4] },
// { bayWidth: 1.4, levelHeight: [1.4, 1.4, 1.4] } { bayWidth: 1.4, levelHeight: [1.4, 1.4, 1.4] }
// ] ]
// } }
// }, },
{ {
id: 'P1', id: 'P1',
t: 'measure', t: 'measure',
@ -80,74 +80,74 @@ export default {
v: true, v: true,
tf: [[5, 0.1, 6.25], [90, 0, 0], [0.25, 0.25, 0.1]], tf: [[5, 0.1, 6.25], [90, 0, 0], [0.25, 0.25, 0.1]],
dt: { in: [], out: [], center: ['P2'] } dt: { in: [], out: [], center: ['P2'] }
},
{
id: '39zML1rnSOOQGQYQ2YUMGy',
t: 'way',
v: true,
tf: [[-4, 0.1, 2], [90, 0, 0], [0.25, 0.25, 0.1]],
dt: { in: [], out: [], center: ['6wrGKiVJniwgKkoggOoEy6'] }
}, {
id: '6wrGKiVJniwgKkoggOoEy6',
t: 'way',
v: true,
tf: [[5, 0.1, 2], [90, 0, 0], [0.25, 0.25, 0.1]],
dt: { in: [], out: [], center: ['39zML1rnSOOQGQYQ2YUMGy'] }
}, {
id: '6UhIIw9QPYh6acwyW8OSGs',
t: 'gstore',
v: true,
tf: [[-1, 0.1, 0.55], [0, 0, 0], [1.5, 1.2, 0.1]],
dt: { in: [], out: [], center: [], storeWidth: 1.4, storeDepth: 1.4 }
}, {
id: '1D0WSRPj8JJJwIcmA0UMqG',
t: 'gstore',
v: true,
tf: [[0.75, 0.1, 0.55], [0, 0, 0], [1.5, 1.2, 0.1]],
dt: { in: [], out: [], center: [], storeWidth: 1.4, storeDepth: 1.4 }
}, {
id: 'gstore3',
t: 'gstore',
v: true,
tf: [[3, 0.1, 0.55], [0, 0, 0], [1.5, 1.2, 0.1]],
dt: { in: [], out: [], center: [], storeWidth: 1.4, storeDepth: 1.4 }
}, {
id: 'pallet1',
t: 'pallet',
v: true,
tf: [[0.75, 0.075, 0.55], [0, 0, 0], [1.5, 1.2, 0.1]],
dt: { in: [], out: [], center: [], palletWidth: 1, palletDepth: 1.2 }
}, {
id: 'pallet2',
t: 'pallet',
v: true,
tf: [[3, 0.075, 0.55], [0, 0, 0], [1.5, 1.2, 0.1]],
dt: { in: [], out: [], center: [], palletWidth: 1, palletDepth: 1.2 }
}, {
id: 'ptr1',
t: 'ptr',
v: true,
tf: [[0.75, 0.075, 2], [0, 0, 0], [1.5, 1.2, 0.1]],
dt: { in: [], out: [], center: [], ptrWidth: 1.5, ptrDepth: 1.5, ptrHeight: 1.98 }
}, {
id: 'ptr2',
t: 'ptr',
v: true,
tf: [[3, 0.075, 2], [0, 0, 0], [1.5, 1.2, 0.1]],
dt: { in: [], out: [], center: [], ptrWidth: 1.5, ptrDepth: 1.5, ptrHeight: 1.98 }
}, {
id: 'pallet3',
t: 'pallet',
v: true,
tf: [[3, 0.175, 1.88], [0, 0, 0], [1.5, 1.2, 0.1]],
dt: { in: [], out: [], center: [], palletWidth: 1, palletDepth: 1.2 }
}, {
id: 'pallet4',
t: 'pallet',
v: true,
tf: [[0.75, 0.175, 3.5], [0, 0, 0], [1.5, 1.2, 0.1]],
dt: { in: [], out: [], center: [], palletWidth: 1, palletDepth: 1.2 }
} }
// {
// id: '39zML1rnSOOQGQYQ2YUMGy',
// t: 'way',
// v: true,
// tf: [[-4, 0.1, 2], [90, 0, 0], [0.25, 0.25, 0.1]],
// dt: { in: [], out: [], center: ['6wrGKiVJniwgKkoggOoEy6'] }
// }, {
// id: '6wrGKiVJniwgKkoggOoEy6',
// t: 'way',
// v: true,
// tf: [[5, 0.1, 2], [90, 0, 0], [0.25, 0.25, 0.1]],
// dt: { in: [], out: [], center: ['39zML1rnSOOQGQYQ2YUMGy'] }
// }, {
// id: '6UhIIw9QPYh6acwyW8OSGs',
// t: 'gstore',
// v: true,
// tf: [[-1, 0.1, 0.55], [0, 0, 0], [1.5, 1.2, 0.1]],
// dt: { in: [], out: [], center: [], storeWidth: 1.4, storeDepth: 1.4 }
// }, {
// id: '1D0WSRPj8JJJwIcmA0UMqG',
// t: 'gstore',
// v: true,
// tf: [[0.75, 0.1, 0.55], [0, 0, 0], [1.5, 1.2, 0.1]],
// dt: { in: [], out: [], center: [], storeWidth: 1.4, storeDepth: 1.4 }
// }, {
// id: 'gstore3',
// t: 'gstore',
// v: true,
// tf: [[3, 0.1, 0.55], [0, 0, 0], [1.5, 1.2, 0.1]],
// dt: { in: [], out: [], center: [], storeWidth: 1.4, storeDepth: 1.4 }
// }, {
// id: 'pallet1',
// t: 'pallet',
// v: true,
// tf: [[0.75, 0.075, 0.55], [0, 0, 0], [1.5, 1.2, 0.1]],
// dt: { in: [], out: [], center: [], palletWidth: 1, palletDepth: 1.2 }
// }, {
// id: 'pallet2',
// t: 'pallet',
// v: true,
// tf: [[3, 0.075, 0.55], [0, 0, 0], [1.5, 1.2, 0.1]],
// dt: { in: [], out: [], center: [], palletWidth: 1, palletDepth: 1.2 }
// }, {
// id: 'ptr1',
// t: 'ptr',
// v: true,
// tf: [[0.75, 0.075, 2], [0, 0, 0], [1.5, 1.2, 0.1]],
// dt: { in: [], out: [], center: [], ptrWidth: 1.5, ptrDepth: 1.5, ptrHeight: 1.98 }
// }, {
// id: 'ptr2',
// t: 'ptr',
// v: true,
// tf: [[3, 0.075, 2], [0, 0, 0], [1.5, 1.2, 0.1]],
// dt: { in: [], out: [], center: [], ptrWidth: 1.5, ptrDepth: 1.5, ptrHeight: 1.98 }
// }, {
// id: 'pallet3',
// t: 'pallet',
// v: true,
// tf: [[3, 0.175, 1.88], [0, 0, 0], [1.5, 1.2, 0.1]],
// dt: { in: [], out: [], center: [], palletWidth: 1, palletDepth: 1.2 }
// }, {
// id: 'pallet4',
// t: 'pallet',
// v: true,
// tf: [[0.75, 0.175, 3.5], [0, 0, 0], [1.5, 1.2, 0.1]],
// dt: { in: [], out: [], center: [], palletWidth: 1, palletDepth: 1.2 }
// }
] ]
}, },
{ {

Loading…
Cancel
Save