@anov/3d 0.0.4-alpha29 → 0.0.4-alpha31
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/anov3d.js +1 -1
- package/dist/anov3d.js.map +1 -1
- package/dist/factory/3d.d.ts +4 -0
- package/dist/factory/3d.js +40 -65
- package/dist/factory/3d.js.map +1 -1
- package/dist/factory/type.d.ts +10 -0
- package/dist/factory/type.js +2 -0
- package/dist/factory/type.js.map +1 -0
- package/dist/factory/unit/CameraPoi.d.ts +11 -0
- package/dist/factory/unit/CameraPoi.js +103 -0
- package/dist/factory/unit/CameraPoi.js.map +1 -0
- package/dist/factory/unit/areaBoundingBox.d.ts +1 -1
- package/dist/factory/unit/areaBoundingBox.js.map +1 -1
- package/dist/factory/unit/circle.d.ts +1 -0
- package/dist/factory/unit/circle.js +15 -11
- package/dist/factory/unit/circle.js.map +1 -1
- package/dist/factory/unit/cylinder.js +0 -14
- package/dist/factory/unit/cylinder.js.map +1 -1
- package/dist/factory/unit/glsl/point/fragment.glsl +12 -0
- package/dist/factory/unit/glsl/point/vertex.glsl +7 -0
- package/dist/factory/unit/index.d.ts +6 -0
- package/dist/factory/unit/index.js +102 -15
- package/dist/factory/unit/index.js.map +1 -1
- package/dist/factory/unit/inspection.d.ts +30 -0
- package/dist/factory/unit/inspection.js +220 -0
- package/dist/factory/unit/inspection.js.map +1 -0
- package/dist/factory/unit/poi.d.ts +2 -1
- package/dist/factory/unit/poi.js +31 -16
- package/dist/factory/unit/poi.js.map +1 -1
- package/dist/factory/unit/wall.js +4 -2
- package/dist/factory/unit/wall.js.map +1 -1
- package/dist/factory/utils/switchMaterial.js +7 -5
- package/dist/factory/utils/switchMaterial.js.map +1 -1
- package/dist/module/camera/index.d.ts +1 -0
- package/dist/module/camera/index.js +10 -6
- package/dist/module/camera/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
2
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
5
3
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
6
4
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
@@ -12,21 +10,17 @@ import createFontMesh from "../utils/fontMesh";
|
|
|
12
10
|
import { SceneStyle } from "../3d";
|
|
13
11
|
import regionMap from "../regionData";
|
|
14
12
|
import { collisionDetection } from "../utils/areaBoundingBox";
|
|
15
|
-
import { MessageType, sendToMessage } from "../../utils/messageFn";
|
|
16
|
-
import { EMessageStatus } from "../../messageStatus";
|
|
17
13
|
import { lookAtOnYAxis } from "../utils";
|
|
18
14
|
var emitter = utils.emitter;
|
|
19
15
|
var cylinderData = [{
|
|
20
16
|
label: '8人',
|
|
21
17
|
id: '1',
|
|
22
|
-
title: regionMap.reform.title,
|
|
23
18
|
belongTo: regionMap.reform.id,
|
|
24
19
|
color: new Color('#FED602').getHex(),
|
|
25
20
|
points: regionMap.reform.poi.position,
|
|
26
21
|
height: 80
|
|
27
22
|
}, {
|
|
28
23
|
label: '7人',
|
|
29
|
-
title: regionMap.reduction.title,
|
|
30
24
|
id: '2',
|
|
31
25
|
belongTo: regionMap.reduction.id,
|
|
32
26
|
color: new Color('#FED602').getHex(),
|
|
@@ -35,7 +29,6 @@ var cylinderData = [{
|
|
|
35
29
|
}, {
|
|
36
30
|
label: '4人',
|
|
37
31
|
id: '3',
|
|
38
|
-
title: regionMap.crudeOil.title,
|
|
39
32
|
belongTo: regionMap.crudeOil.id,
|
|
40
33
|
color: new Color('#FED602').getHex(),
|
|
41
34
|
points: regionMap.crudeOil.poi.position,
|
|
@@ -43,7 +36,6 @@ var cylinderData = [{
|
|
|
43
36
|
}, {
|
|
44
37
|
label: '10人',
|
|
45
38
|
id: '4',
|
|
46
|
-
title: regionMap.catalyticCracking.title,
|
|
47
39
|
belongTo: regionMap.catalyticCracking.id,
|
|
48
40
|
color: new Color('#FED602').getHex(),
|
|
49
41
|
points: regionMap.catalyticCracking.poi.position,
|
|
@@ -51,7 +43,6 @@ var cylinderData = [{
|
|
|
51
43
|
}, {
|
|
52
44
|
label: '3人',
|
|
53
45
|
id: '5',
|
|
54
|
-
title: regionMap.hydrocrackingUnit.title,
|
|
55
46
|
belongTo: regionMap.hydrocrackingUnit.id,
|
|
56
47
|
color: new Color('#FED602').getHex(),
|
|
57
48
|
points: regionMap.hydrocrackingUnit.poi.position,
|
|
@@ -59,7 +50,6 @@ var cylinderData = [{
|
|
|
59
50
|
}, {
|
|
60
51
|
label: '8人',
|
|
61
52
|
id: '6',
|
|
62
|
-
title: regionMap.cokingUnit.title,
|
|
63
53
|
belongTo: regionMap.cokingUnit.id,
|
|
64
54
|
color: new Color('#FED602').getHex(),
|
|
65
55
|
points: regionMap.cokingUnit.poi.position,
|
|
@@ -67,7 +57,6 @@ var cylinderData = [{
|
|
|
67
57
|
}, {
|
|
68
58
|
label: '20人',
|
|
69
59
|
id: '7',
|
|
70
|
-
title: regionMap.administrative.title,
|
|
71
60
|
belongTo: regionMap.administrative.id,
|
|
72
61
|
color: new Color('#FED602').getHex(),
|
|
73
62
|
points: regionMap.administrative.poi.position,
|
|
@@ -137,9 +126,6 @@ var CylinderManage = /*#__PURE__*/function () {
|
|
|
137
126
|
currentGroup.visible = false;
|
|
138
127
|
_this2.currentoperate = item.belongTo;
|
|
139
128
|
_this2.cameraAddListener();
|
|
140
|
-
sendToMessage(MessageType.Event, 'onClick', EMessageStatus.Success, undefined, _objectSpread({
|
|
141
|
-
type: 'Bar'
|
|
142
|
-
}, item));
|
|
143
129
|
});
|
|
144
130
|
});
|
|
145
131
|
_this2.cylinderMesh.set(item.belongTo, group);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BoxGeometry","Color","Group","Mesh","ShaderMaterial","Vector3","globalObjectManage","use","utils","createFontMesh","SceneStyle","regionMap","collisionDetection","MessageType","sendToMessage","EMessageStatus","lookAtOnYAxis","emitter","cylinderData","label","id","title","reform","belongTo","color","getHex","points","poi","position","height","reduction","crudeOil","catalyticCracking","hydrocrackingUnit","cokingUnit","administrative","CylinderManage","gobal","options","Map","currentCameraPosition","control","object","box","areaBoundingBox","boundingBoxMap","get","currentoperate","iscollision","emit","cameraRemoveListener","scene","option","forEach","item","geometry","material","transparent","depthWrite","depthTest","uniforms","uHeight","value","uColor","vertexShader","fragmentShader","cylinder","group","visible","copy","fromArray","interactionManager","storeManagement","add","addEventListener","style","real","cameraUtil","set","target","then","currentGroup","cylinderMesh","cameraAddListener","Event","Success","undefined","type","font","mesh","center","useframe","camera","cameraListenerHandle","removeEventListener"],"sources":["../../../src/factory/unit/cylinder.ts"],"sourcesContent":["import type { InteractionManager, Object3D, Scene } from '@anov/3d-core'\nimport { BoxGeometry, Color, Group, Mesh, ShaderMaterial, Vector3, globalObjectManage, use, utils } from '@anov/3d-core'\nimport createFontMesh from '../utils/fontMesh'\nimport type Factory3D from '../3d'\nimport { SceneStyle } from '../3d'\nimport regionMap from '../regionData'\nimport { collisionDetection } from '../utils/areaBoundingBox'\nimport { MessageType, sendToMessage } from '../../utils/messageFn'\nimport { EMessageStatus } from '../../messageStatus'\n\nimport { lookAtOnYAxis } from '../utils'\n\nconst { emitter } = utils\n\nconst cylinderData = [\n {\n label: '8人',\n id: '1',\n title: regionMap.reform.title,\n belongTo: regionMap.reform.id,\n color: new Color('#FED602').getHex(),\n points: regionMap.reform.poi.position,\n height: 80,\n },\n {\n label: '7人',\n title: regionMap.reduction.title,\n id: '2',\n belongTo: regionMap.reduction.id,\n color: new Color('#FED602').getHex(),\n points: regionMap.reduction.poi.position,\n height: 70,\n },\n {\n label: '4人',\n id: '3',\n title: regionMap.crudeOil.title,\n belongTo: regionMap.crudeOil.id,\n color: new Color('#FED602').getHex(),\n points: regionMap.crudeOil.poi.position,\n height: 40,\n },\n {\n label: '10人',\n id: '4',\n title: regionMap.catalyticCracking.title,\n belongTo: regionMap.catalyticCracking.id,\n color: new Color('#FED602').getHex(),\n points: regionMap.catalyticCracking.poi.position,\n height: 100,\n },\n {\n label: '3人',\n id: '5',\n title: regionMap.hydrocrackingUnit.title,\n belongTo: regionMap.hydrocrackingUnit.id,\n color: new Color('#FED602').getHex(),\n points: regionMap.hydrocrackingUnit.poi.position,\n height: 30,\n },\n {\n label: '8人',\n id: '6',\n title: regionMap.cokingUnit.title,\n belongTo: regionMap.cokingUnit.id,\n color: new Color('#FED602').getHex(),\n points: regionMap.cokingUnit.poi.position,\n height: 80,\n },\n {\n label: '20人',\n id: '7',\n title: regionMap.administrative.title,\n belongTo: regionMap.administrative.id,\n color: new Color('#FED602').getHex(),\n points: regionMap.administrative.poi.position,\n height: 150,\n },\n]\n\ntype CylinderManageOption = {\n visible?: boolean\n}\n\nclass CylinderManage {\n private scene: Scene\n readonly cylinderMesh: Map<string, Object3D> = new Map()\n private option: CylinderManageOption\n private gobal: Factory3D\n private currentoperate: string\n\n constructor(gobal: Factory3D, options?: CylinderManageOption) {\n this.scene = gobal.scene.scene\n this.gobal = gobal\n this.option = options || {}\n }\n\n generateCylinder() {\n cylinderData.forEach((item) => {\n const geometry = new BoxGeometry(10, item.height, 10)\n const material = new ShaderMaterial({\n transparent: true,\n depthWrite: false,\n depthTest: false,\n uniforms: {\n uHeight: {\n value: item.height,\n },\n uColor: {\n value: new Color(item.color),\n },\n },\n vertexShader: `\n uniform float uHeight;\n varying float vOpacity;\n void main() {\n vOpacity = (position.y + uHeight/2.0) / uHeight;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position,1.0);\n }\n `,\n fragmentShader: `\n uniform vec3 uColor;\n varying float vOpacity;\n void main() {\n gl_FragColor = vec4(uColor,0.3+vOpacity/10.0*7.0);\n }\n `,\n })\n const cylinder = new Mesh(geometry, material)\n const group = new Group()\n\n group.visible = this.option?.visible ?? true\n cylinder.position.copy(new Vector3().fromArray([item.points[0], item.points[1] + item.height / 2, item.points[2]]))\n\n const interactionManager = utils.storeManagement.get<InteractionManager>('interactionManager')\n interactionManager.add(cylinder)\n\n cylinder.addEventListener('click', () => {\n if (this.gobal.style === SceneStyle.real)\n return\n\n if (group.visible === false)\n return\n\n this.gobal.cameraUtil.set({\n position: [item.points[0], item.points[1] + item.height / 2, item.points[2] + 100],\n target: [item.points[0], item.points[1] + item.height / 2, item.points[2]],\n }).then(() => {\n emitter.emit('peoplemanagement-camera-enter', item)\n const currentGroup = this.cylinderMesh.get(item.belongTo) as Group\n currentGroup.visible = false\n\n this.currentoperate = item.belongTo\n this.cameraAddListener()\n\n sendToMessage(MessageType.Event, 'onClick', EMessageStatus.Success, undefined, {\n type: 'Bar',\n ...item,\n })\n })\n })\n\n this.cylinderMesh.set(item.belongTo, group)\n group.add(cylinder)\n\n const font = createFontMesh(item.label, {\n position: new Vector3().fromArray([item.points[0], item.points[1] + item.height + 10, item.points[2]]),\n })\n\n font.then((mesh) => {\n mesh.geometry.center()\n\n group.add(mesh)\n\n use.useframe(() => {\n lookAtOnYAxis(mesh, globalObjectManage.camera.position)\n })\n this.scene.add(group)\n })\n })\n }\n\n private cameraListenerHandle = () => {\n const currentCameraPosition = this.gobal.control.object.position\n const box = this.gobal.areaBoundingBox.boundingBoxMap.get(this.currentoperate)\n const iscollision = collisionDetection(box, currentCameraPosition)\n\n if (!iscollision) {\n emitter.emit('peoplemanagement-camera-out', {\n belongTo: this.currentoperate,\n })\n\n this.cameraRemoveListener()\n }\n }\n\n private cameraAddListener() {\n this.gobal.control.addEventListener('change', this.cameraListenerHandle)\n }\n\n private cameraRemoveListener() {\n this.gobal.control.removeEventListener('change', this.cameraListenerHandle)\n }\n}\n\nexport default CylinderManage"],"mappings":";;;;;;;;;AACA,SAASA,WAAW,EAAEC,KAAK,EAAEC,KAAK,EAAEC,IAAI,EAAEC,cAAc,EAAEC,OAAO,EAAEC,kBAAkB,EAAEC,GAAG,EAAEC,KAAK,QAAQ,eAAe;AACxH,OAAOC,cAAc;AAErB,SAASC,UAAU;AACnB,OAAOC,SAAS;AAChB,SAASC,kBAAkB;AAC3B,SAASC,WAAW,EAAEC,aAAa;AACnC,SAASC,cAAc;AAEvB,SAASC,aAAa;AAEtB,IAAQC,OAAO,GAAKT,KAAK,CAAjBS,OAAO;AAEf,IAAMC,YAAY,GAAG,CACnB;EACEC,KAAK,EAAE,IAAI;EACXC,EAAE,EAAE,GAAG;EACPC,KAAK,EAAEV,SAAS,CAACW,MAAM,CAACD,KAAK;EAC7BE,QAAQ,EAAEZ,SAAS,CAACW,MAAM,CAACF,EAAE;EAC7BI,KAAK,EAAE,IAAIvB,KAAK,CAAC,SAAS,CAAC,CAACwB,MAAM,EAA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1E;EAAC;IAAA;IAAA,OAED,gCAA+B;MAC7B,IAAI,CAACxD,KAAK,CAACI,OAAO,CAACqD,mBAAmB,CAAC,QAAQ,EAAE,IAAI,CAACD,oBAAoB,CAAC;IAC7E;EAAC;EAAA;AAAA;AAGH,eAAezD,cAAc"}
|
|
1
|
+
{"version":3,"names":["BoxGeometry","Color","Group","Mesh","ShaderMaterial","Vector3","globalObjectManage","use","utils","createFontMesh","SceneStyle","regionMap","collisionDetection","lookAtOnYAxis","emitter","cylinderData","label","id","belongTo","reform","color","getHex","points","poi","position","height","reduction","crudeOil","catalyticCracking","hydrocrackingUnit","cokingUnit","administrative","CylinderManage","gobal","options","Map","currentCameraPosition","control","object","box","areaBoundingBox","boundingBoxMap","get","currentoperate","iscollision","emit","cameraRemoveListener","scene","option","forEach","item","geometry","material","transparent","depthWrite","depthTest","uniforms","uHeight","value","uColor","vertexShader","fragmentShader","cylinder","group","visible","copy","fromArray","interactionManager","storeManagement","add","addEventListener","style","real","cameraUtil","set","target","then","currentGroup","cylinderMesh","cameraAddListener","font","mesh","center","useframe","camera","cameraListenerHandle","removeEventListener"],"sources":["../../../src/factory/unit/cylinder.ts"],"sourcesContent":["import type { InteractionManager, Object3D, Scene } from '@anov/3d-core'\nimport { BoxGeometry, Color, Group, Mesh, ShaderMaterial, Vector3, globalObjectManage, use, utils } from '@anov/3d-core'\nimport createFontMesh from '../utils/fontMesh'\nimport type Factory3D from '../3d'\nimport { SceneStyle } from '../3d'\nimport regionMap from '../regionData'\nimport { collisionDetection } from '../utils/areaBoundingBox'\n\nimport { lookAtOnYAxis } from '../utils'\n\nconst { emitter } = utils\n\nconst cylinderData = [\n {\n label: '8人',\n id: '1',\n belongTo: regionMap.reform.id,\n color: new Color('#FED602').getHex(),\n points: regionMap.reform.poi.position,\n height: 80,\n },\n {\n label: '7人',\n id: '2',\n belongTo: regionMap.reduction.id,\n color: new Color('#FED602').getHex(),\n points: regionMap.reduction.poi.position,\n height: 70,\n },\n {\n label: '4人',\n id: '3',\n belongTo: regionMap.crudeOil.id,\n color: new Color('#FED602').getHex(),\n points: regionMap.crudeOil.poi.position,\n height: 40,\n },\n {\n label: '10人',\n id: '4',\n belongTo: regionMap.catalyticCracking.id,\n color: new Color('#FED602').getHex(),\n points: regionMap.catalyticCracking.poi.position,\n height: 100,\n },\n {\n label: '3人',\n id: '5',\n belongTo: regionMap.hydrocrackingUnit.id,\n color: new Color('#FED602').getHex(),\n points: regionMap.hydrocrackingUnit.poi.position,\n height: 30,\n },\n {\n label: '8人',\n id: '6',\n belongTo: regionMap.cokingUnit.id,\n color: new Color('#FED602').getHex(),\n points: regionMap.cokingUnit.poi.position,\n height: 80,\n },\n {\n label: '20人',\n id: '7',\n belongTo: regionMap.administrative.id,\n color: new Color('#FED602').getHex(),\n points: regionMap.administrative.poi.position,\n height: 150,\n },\n]\n\ntype CylinderManageOption = {\n visible?: boolean\n}\n\nclass CylinderManage {\n private scene: Scene\n readonly cylinderMesh: Map<string, Object3D> = new Map()\n private option: CylinderManageOption\n private gobal: Factory3D\n private currentoperate: string\n\n constructor(gobal: Factory3D, options?: CylinderManageOption) {\n this.scene = gobal.scene.scene\n this.gobal = gobal\n this.option = options || {}\n }\n\n generateCylinder() {\n cylinderData.forEach((item) => {\n const geometry = new BoxGeometry(10, item.height, 10)\n const material = new ShaderMaterial({\n transparent: true,\n depthWrite: false,\n depthTest: false,\n uniforms: {\n uHeight: {\n value: item.height,\n },\n uColor: {\n value: new Color(item.color),\n },\n },\n vertexShader: `\n uniform float uHeight;\n varying float vOpacity;\n void main() {\n vOpacity = (position.y + uHeight/2.0) / uHeight;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position,1.0);\n }\n `,\n fragmentShader: `\n uniform vec3 uColor;\n varying float vOpacity;\n void main() {\n gl_FragColor = vec4(uColor,0.3+vOpacity/10.0*7.0);\n }\n `,\n })\n const cylinder = new Mesh(geometry, material)\n const group = new Group()\n\n group.visible = this.option?.visible ?? true\n cylinder.position.copy(new Vector3().fromArray([item.points[0], item.points[1] + item.height / 2, item.points[2]]))\n\n const interactionManager = utils.storeManagement.get<InteractionManager>('interactionManager')\n interactionManager.add(cylinder)\n\n cylinder.addEventListener('click', () => {\n if (this.gobal.style === SceneStyle.real)\n return\n\n if (group.visible === false)\n return\n\n this.gobal.cameraUtil.set({\n position: [item.points[0], item.points[1] + item.height / 2, item.points[2] + 100],\n target: [item.points[0], item.points[1] + item.height / 2, item.points[2]],\n }).then(() => {\n emitter.emit('peoplemanagement-camera-enter', item)\n const currentGroup = this.cylinderMesh.get(item.belongTo) as Group\n currentGroup.visible = false\n\n this.currentoperate = item.belongTo\n this.cameraAddListener()\n })\n })\n\n this.cylinderMesh.set(item.belongTo, group)\n group.add(cylinder)\n\n const font = createFontMesh(item.label, {\n position: new Vector3().fromArray([item.points[0], item.points[1] + item.height + 10, item.points[2]]),\n })\n\n font.then((mesh) => {\n mesh.geometry.center()\n\n group.add(mesh)\n\n use.useframe(() => {\n lookAtOnYAxis(mesh, globalObjectManage.camera.position)\n })\n this.scene.add(group)\n })\n })\n }\n\n private cameraListenerHandle = () => {\n const currentCameraPosition = this.gobal.control.object.position\n const box = this.gobal.areaBoundingBox.boundingBoxMap.get(this.currentoperate)\n const iscollision = collisionDetection(box, currentCameraPosition)\n\n if (!iscollision) {\n emitter.emit('peoplemanagement-camera-out', {\n belongTo: this.currentoperate,\n })\n\n this.cameraRemoveListener()\n }\n }\n\n private cameraAddListener() {\n this.gobal.control.addEventListener('change', this.cameraListenerHandle)\n }\n\n private cameraRemoveListener() {\n this.gobal.control.removeEventListener('change', this.cameraListenerHandle)\n }\n}\n\nexport default CylinderManage"],"mappings":";;;;;;;AACA,SAASA,WAAW,EAAEC,KAAK,EAAEC,KAAK,EAAEC,IAAI,EAAEC,cAAc,EAAEC,OAAO,EAAEC,kBAAkB,EAAEC,GAAG,EAAEC,KAAK,QAAQ,eAAe;AACxH,OAAOC,cAAc;AAErB,SAASC,UAAU;AACnB,OAAOC,SAAS;AACh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@ -0,0 +1,12 @@
|
|
|
1
|
+
uniform vec3 color;
|
|
2
|
+
|
|
3
|
+
void main() {
|
|
4
|
+
float r = 0.0, delta = 0.0, alpha = 1.0;
|
|
5
|
+
vec2 cxy = 2.0 * gl_PointCoord - 1.0;
|
|
6
|
+
r = dot(cxy, cxy);
|
|
7
|
+
delta = fwidth(r);
|
|
8
|
+
alpha = 1.0 - smoothstep(1.0 - delta, 1.0 + delta, r);
|
|
9
|
+
if(r > 1.0)
|
|
10
|
+
discard;
|
|
11
|
+
gl_FragColor = vec4(color, alpha);
|
|
12
|
+
}
|
|
@@ -1,10 +1,103 @@
|
|
|
1
1
|
import { utils } from '@anov/3d-core';
|
|
2
|
+
import { SceneStyle, SceneTag } from "../3d";
|
|
2
3
|
import WallManage from "./wall";
|
|
3
4
|
import CylinderManage from "./cylinder";
|
|
4
5
|
import PoiManage from "./poi";
|
|
5
6
|
import CircleManage from "./circle";
|
|
6
7
|
import AreaBoundingBoxManage from "./areaBoundingBox";
|
|
8
|
+
import Inspection from "./inspection";
|
|
9
|
+
import CameraPoi from "./CameraPoi";
|
|
7
10
|
var emitter = utils.emitter;
|
|
11
|
+
|
|
12
|
+
// 临时优化
|
|
13
|
+
|
|
14
|
+
var showOverview = function showOverview() {
|
|
15
|
+
this.poi.generatePoi();
|
|
16
|
+
};
|
|
17
|
+
var closeOverview = function closeOverview() {
|
|
18
|
+
this.wall.wallMesh.forEach(function (mesh) {
|
|
19
|
+
mesh.visible = false;
|
|
20
|
+
});
|
|
21
|
+
this.poi.remove();
|
|
22
|
+
};
|
|
23
|
+
var showPeopleManagemen = function showPeopleManagemen() {
|
|
24
|
+
this.cylinder.cylinderMesh.forEach(function (mesh) {
|
|
25
|
+
mesh.visible = true;
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
var closePeopleManagemen = function closePeopleManagemen() {
|
|
29
|
+
this.cylinder.cylinderMesh.forEach(function (mesh) {
|
|
30
|
+
mesh.visible = false;
|
|
31
|
+
});
|
|
32
|
+
this.circle.remove();
|
|
33
|
+
};
|
|
34
|
+
var showSmartInspection = function showSmartInspection() {
|
|
35
|
+
this.inspection.show();
|
|
36
|
+
};
|
|
37
|
+
var closeSmartInspection = function closeSmartInspection() {
|
|
38
|
+
this.inspection.hide();
|
|
39
|
+
};
|
|
40
|
+
var toggleOverview = function toggleOverview() {
|
|
41
|
+
showOverview.apply(this);
|
|
42
|
+
closePeopleManagemen.apply(this);
|
|
43
|
+
closeSmartInspection.apply(this);
|
|
44
|
+
};
|
|
45
|
+
var togglePeopleManagemen = function togglePeopleManagemen() {
|
|
46
|
+
showPeopleManagemen.apply(this);
|
|
47
|
+
closeOverview.apply(this);
|
|
48
|
+
closeSmartInspection.apply(this);
|
|
49
|
+
};
|
|
50
|
+
var toggleSmartInspection = function toggleSmartInspection() {
|
|
51
|
+
showSmartInspection.apply(this);
|
|
52
|
+
closeOverview.apply(this);
|
|
53
|
+
closePeopleManagemen.apply(this);
|
|
54
|
+
};
|
|
55
|
+
var toggleSecurityOperation = function toggleSecurityOperation() {
|
|
56
|
+
closeOverview.apply(this);
|
|
57
|
+
closePeopleManagemen.apply(this);
|
|
58
|
+
closeSmartInspection.apply(this);
|
|
59
|
+
};
|
|
60
|
+
export var toggleTag = {
|
|
61
|
+
'overview': function overview() {
|
|
62
|
+
this.tag = SceneTag.overview;
|
|
63
|
+
this.toggleSceneStyle(SceneStyle.real);
|
|
64
|
+
/* this.cameraUtil.set({
|
|
65
|
+
position: [0, 200, 400],
|
|
66
|
+
target: [0, 0, 0],
|
|
67
|
+
}) */
|
|
68
|
+
|
|
69
|
+
toggleOverview.apply(this);
|
|
70
|
+
},
|
|
71
|
+
'people-management': function peopleManagement() {
|
|
72
|
+
this.tag = SceneTag['people-management'];
|
|
73
|
+
this.toggleSceneStyle(SceneStyle.tech);
|
|
74
|
+
/* this.cameraUtil.set({
|
|
75
|
+
position: [150, 300, 400],
|
|
76
|
+
target: [0, 0, 0],
|
|
77
|
+
}) */
|
|
78
|
+
|
|
79
|
+
togglePeopleManagemen.apply(this);
|
|
80
|
+
},
|
|
81
|
+
'smart-inspection': function smartInspection() {
|
|
82
|
+
this.tag = SceneTag['smart-inspection'];
|
|
83
|
+
this.toggleSceneStyle(SceneStyle.real);
|
|
84
|
+
this.cameraUtil.set({
|
|
85
|
+
position: [0, 200, 400],
|
|
86
|
+
target: [0, 0, 0]
|
|
87
|
+
});
|
|
88
|
+
toggleSmartInspection.apply(this);
|
|
89
|
+
},
|
|
90
|
+
'security-operation': function securityOperation() {
|
|
91
|
+
this.tag = SceneTag['security-operation'];
|
|
92
|
+
this.toggleSceneStyle(SceneStyle.real);
|
|
93
|
+
this.cameraUtil.set({
|
|
94
|
+
position: [350.99, 39.07, 194.30],
|
|
95
|
+
target: [401.89, -52.54, 3.04],
|
|
96
|
+
duration: 2
|
|
97
|
+
});
|
|
98
|
+
toggleSecurityOperation.apply(this);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
8
101
|
var handleUnit = function handleUnit() {
|
|
9
102
|
var _this = this;
|
|
10
103
|
// 围栏
|
|
@@ -14,13 +107,6 @@ var handleUnit = function handleUnit() {
|
|
|
14
107
|
wall.generateWall();
|
|
15
108
|
this.wall = wall;
|
|
16
109
|
|
|
17
|
-
// 围线
|
|
18
|
-
// const line = new LineManage(this, {
|
|
19
|
-
// visible: false,
|
|
20
|
-
// })
|
|
21
|
-
// line.generateLine()
|
|
22
|
-
// this.line = line
|
|
23
|
-
|
|
24
110
|
// 圆柱
|
|
25
111
|
var cylinder = new CylinderManage(this, {
|
|
26
112
|
visible: false
|
|
@@ -37,23 +123,24 @@ var handleUnit = function handleUnit() {
|
|
|
37
123
|
var circle = new CircleManage(this);
|
|
38
124
|
this.circle = circle;
|
|
39
125
|
emitter.on('peoplemanagement-camera-enter', function (data) {
|
|
40
|
-
|
|
41
|
-
(_this$circle = _this.circle) === null || _this$circle === void 0 ? void 0 : _this$circle.generateCircle(data === null || data === void 0 ? void 0 : data.belongTo);
|
|
126
|
+
_this.circle.generateCircle(data === null || data === void 0 ? void 0 : data.belongTo);
|
|
42
127
|
});
|
|
43
128
|
|
|
44
129
|
// boundingBox
|
|
45
130
|
var areaBoundingBox = new AreaBoundingBoxManage();
|
|
46
131
|
areaBoundingBox.generateBoundingBox();
|
|
47
132
|
this.areaBoundingBox = areaBoundingBox;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
133
|
+
var inspection = new Inspection(this);
|
|
134
|
+
this.inspection = inspection;
|
|
135
|
+
var cameraPoi = new CameraPoi(this);
|
|
136
|
+
this.cameraPoi = cameraPoi;
|
|
52
137
|
|
|
53
138
|
// some global events handle
|
|
54
139
|
this.addEventListener('peoplemanagement-camera-out', function (args) {
|
|
55
|
-
|
|
56
|
-
cylinder.cylinderMesh.
|
|
140
|
+
if (_this.tag !== SceneTag['people-management']) return;
|
|
141
|
+
cylinder.cylinderMesh.forEach(function (item) {
|
|
142
|
+
item.visible = true;
|
|
143
|
+
});
|
|
57
144
|
_this.circle.remove();
|
|
58
145
|
});
|
|
59
146
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["utils","WallManage","CylinderManage","PoiManage","CircleManage","AreaBoundingBoxManage","emitter","
|
|
1
|
+
{"version":3,"names":["utils","SceneStyle","SceneTag","WallManage","CylinderManage","PoiManage","CircleManage","AreaBoundingBoxManage","Inspection","CameraPoi","emitter","showOverview","poi","generatePoi","closeOverview","wall","wallMesh","forEach","mesh","visible","remove","showPeopleManagemen","cylinder","cylinderMesh","closePeopleManagemen","circle","showSmartInspection","inspection","show","closeSmartInspection","hide","toggleOverview","apply","togglePeopleManagemen","toggleSmartInspection","toggleSecurityOperation","toggleTag","tag","overview","toggleSceneStyle","real","tech","cameraUtil","set","position","target","duration","handleUnit","generateWall","generateCylinder","on","data","generateCircle","belongTo","areaBoundingBox","generateBoundingBox","cameraPoi","addEventListener","args","item"],"sources":["../../../src/factory/unit/index.ts"],"sourcesContent":["import { utils } from '@anov/3d-core'\nimport { SceneStyle, SceneTag } from '../3d'\nimport WallManage from './wall'\nimport CylinderManage from './cylinder'\nimport PoiManage from './poi'\nimport CircleManage from './circle'\nimport AreaBoundingBoxManage from './areaBoundingBox'\nimport Inspection from './inspection'\nimport CameraPoi from './CameraPoi'\n\nconst { emitter } = utils\n\n// 临时优化\n\nconst showOverview = function () {\n this.poi.generatePoi()\n}\n\nconst closeOverview = function () {\n this.wall.wallMesh.forEach((mesh) => {\n mesh.visible = false\n })\n\n this.poi.remove()\n}\n\nconst showPeopleManagemen = function () {\n this.cylinder.cylinderMesh.forEach((mesh) => {\n mesh.visible = true\n })\n}\n\nconst closePeopleManagemen = function () {\n this.cylinder.cylinderMesh.forEach((mesh) => {\n mesh.visible = false\n })\n\n this.circle.remove()\n}\n\nconst showSmartInspection = function () {\n this.inspection.show()\n}\n\nconst closeSmartInspection = function () {\n this.inspection.hide()\n}\n\nconst toggleOverview = function () {\n showOverview.apply(this)\n closePeopleManagemen.apply(this)\n closeSmartInspection.apply(this)\n}\n\nconst togglePeopleManagemen = function () {\n showPeopleManagemen.apply(this)\n closeOverview.apply(this)\n closeSmartInspection.apply(this)\n}\n\nconst toggleSmartInspection = function () {\n showSmartInspection.apply(this)\n closeOverview.apply(this)\n closePeopleManagemen.apply(this)\n}\n\nconst toggleSecurityOperation = function () {\n closeOverview.apply(this)\n closePeopleManagemen.apply(this)\n closeSmartInspection.apply(this)\n}\n\nexport const toggleTag = {\n 'overview': function () {\n this.tag = SceneTag.overview\n this.toggleSceneStyle(SceneStyle.real)\n /* this.cameraUtil.set({\n position: [0, 200, 400],\n target: [0, 0, 0],\n }) */\n\n toggleOverview.apply(this)\n },\n 'people-management': function () {\n this.tag = SceneTag['people-management']\n this.toggleSceneStyle(SceneStyle.tech)\n /* this.cameraUtil.set({\n position: [150, 300, 400],\n target: [0, 0, 0],\n }) */\n\n togglePeopleManagemen.apply(this)\n },\n 'smart-inspection': function () {\n this.tag = SceneTag['smart-inspection']\n this.toggleSceneStyle(SceneStyle.real)\n this.cameraUtil.set({\n position: [0, 200, 400],\n target: [0, 0, 0],\n })\n\n toggleSmartInspection.apply(this)\n },\n 'security-operation': function () {\n this.tag = SceneTag['security-operation']\n this.toggleSceneStyle(SceneStyle.real)\n this.cameraUtil.set({\n position: [350.99, 39.07, 194.30],\n target: [401.89, -52.54, 3.04],\n duration: 2,\n })\n\n toggleSecurityOperation.apply(this)\n },\n}\n\nconst handleUnit = function () {\n // 围栏\n const wall = new WallManage(this, { visible: false })\n wall.generateWall()\n this.wall = wall\n\n // 圆柱\n const cylinder = new CylinderManage(this, {\n visible: false,\n })\n cylinder.generateCylinder()\n\n this.cylinder = cylinder\n\n // POI\n const poi = new PoiManage(this)\n poi.generatePoi()\n this.poi = poi\n\n // people\n const circle = new CircleManage(this)\n this.circle = circle\n\n emitter.on('peoplemanagement-camera-enter', (data: any) => {\n this.circle.generateCircle(data?.belongTo)\n })\n\n // boundingBox\n const areaBoundingBox = new AreaBoundingBoxManage()\n areaBoundingBox.generateBoundingBox()\n this.areaBoundingBox = areaBoundingBox\n\n const inspection = new Inspection(this)\n this.inspection = inspection\n\n const cameraPoi = new CameraPoi(this)\n this.cameraPoi = cameraPoi\n\n // some global events handle\n this.addEventListener('peoplemanagement-camera-out', (args) => {\n if (this.tag !== SceneTag['people-management'])\n return\n cylinder.cylinderMesh.forEach((item) => {\n item.visible = true\n })\n this.circle.remove()\n })\n}\n\nexport default handleUnit\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,eAAe;AACrC,SAASC,UAAU,EAAEC,QAAQ;AAC7B,OAAOC,UAAU;AACjB,OAAOC,cAAc;AACrB,OAAOC,SAAS;AAChB,OAAOC,YAAY;AACnB,OAAOC,qBAAqB;AAC5B,OAAOC,UAAU;AACjB,OAAOC,SAAS;AAEhB,IAAQC,OAAO,GAAKV,KAAK,CAAjBU,OAAO;;AAEf;;AAEA,IAAMC,YAAY,GAAG,SAAfA,YAAY,GAAe;EAC/B,IAAI,CAACC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AAC1B,MAAM,CAAC2B,cAAc,CAACD,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEE,QAAQ,CAAC;EAC5C,CAAC,CAAC;;EAEF;EACA,IAAMC,eAAe,GAAG,IAAI/C,qBAAqB,EAAE;EACnD+C,eAAe,CAACC,mBAAmB,EAAE;EACrC,IAAI,CAACD,eAAe,GAAGA,eAAe;EAEtC,IAAM3B,UAAU,GAAG,IAAInB,UAAU,CAAC,IAAI,CAAC;EACvC,IAAI,CAACmB,UAAU,GAAGA,UAAU;EAE5B,IAAM6B,SAAS,GAAG,IAAI/C,SAAS,CAAC,IAAI,CAAC;EACrC,IAAI,CAAC+C,SAAS,GAAGA,SAAS;;EAE1B;EACA,IAAI,CAACC,gBAAgB,CAAC,6BAA6B,EAAE,UAACC,IAAI,EAAK;IAC7D,IAAI,KAAI,CAACrB,GAAG,KAAKnC,QAAQ,CAAC,mBAAmB,CAAC,EAC5C;IACFoB,QAAQ,CAACC,YAAY,CAACN,OAAO,CAAC,UAAC0C,IAAI,EAAK;MACtCA,IAAI,CAACxC,OAAO,GAAG,IAAI;IACrB,CAAC,CAAC;IACF,KAAI,CAACM,MAAM,CAACL,MAAM,EAAE;EACtB,CAAC,CAAC;AACJ,CAAC;AAED,eAAe2B,UAAU"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Object3D } from '@anov/3d-core';
|
|
2
|
+
import { PerspectiveCamera, Vector3 } from '@anov/3d-core';
|
|
3
|
+
import type Factory3D from '../3d';
|
|
4
|
+
declare class Inspection {
|
|
5
|
+
private gobal;
|
|
6
|
+
private inspectionObject;
|
|
7
|
+
private curve;
|
|
8
|
+
private line;
|
|
9
|
+
minCamera: PerspectiveCamera;
|
|
10
|
+
InspectionPathObject: Object3D;
|
|
11
|
+
constructor(gobal: Factory3D);
|
|
12
|
+
/**
|
|
13
|
+
* generate inspection path
|
|
14
|
+
* @param linePosition
|
|
15
|
+
*/
|
|
16
|
+
private generateInspectionPath;
|
|
17
|
+
/**
|
|
18
|
+
* open inspection camera
|
|
19
|
+
*/
|
|
20
|
+
setInspectionCamera(): void;
|
|
21
|
+
/**
|
|
22
|
+
* start inspection
|
|
23
|
+
* @param line
|
|
24
|
+
*/
|
|
25
|
+
startInspection(line: any): void;
|
|
26
|
+
goToInspectionTarget(targetPosition: Vector3): void;
|
|
27
|
+
show(): void;
|
|
28
|
+
hide(): void;
|
|
29
|
+
}
|
|
30
|
+
export default Inspection;
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
5
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
6
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
7
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
8
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
9
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
10
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
11
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
12
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
13
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
14
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
15
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
16
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
17
|
+
import { CatmullRomCurve3, Color, CurvePath, LineCurve3, ModelLoader, PerspectiveCamera, Vector3, lib, use, utils } from '@anov/3d-core';
|
|
18
|
+
var Line2 = lib.Line2,
|
|
19
|
+
LineGeometry = lib.LineGeometry,
|
|
20
|
+
LineMaterial = lib.LineMaterial;
|
|
21
|
+
var modelLoader = new ModelLoader();
|
|
22
|
+
var linePosition = [[-487.02, 0, -53.20], [-145.39, 0, -50.51], [-146.27, 0, 119.63], [21.13, 0, 125.23], [24.59, 0, -53.50], [321.58, 0, -50.13], [331.35, 0, 228.17]];
|
|
23
|
+
var InspectionObject = /*#__PURE__*/function () {
|
|
24
|
+
function InspectionObject(inspection) {
|
|
25
|
+
_classCallCheck(this, InspectionObject);
|
|
26
|
+
_defineProperty(this, "model", void 0);
|
|
27
|
+
_defineProperty(this, "inspection", void 0);
|
|
28
|
+
_defineProperty(this, "control", void 0);
|
|
29
|
+
this.inspection = inspection;
|
|
30
|
+
}
|
|
31
|
+
_createClass(InspectionObject, [{
|
|
32
|
+
key: "loadModel",
|
|
33
|
+
value: function () {
|
|
34
|
+
var _loadModel = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
35
|
+
var glb;
|
|
36
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
37
|
+
while (1) switch (_context.prev = _context.next) {
|
|
38
|
+
case 0:
|
|
39
|
+
_context.next = 2;
|
|
40
|
+
return modelLoader.loadGLTF('./car.glb');
|
|
41
|
+
case 2:
|
|
42
|
+
_context.next = 4;
|
|
43
|
+
return _context.sent;
|
|
44
|
+
case 4:
|
|
45
|
+
glb = _context.sent;
|
|
46
|
+
this.model = glb.scene;
|
|
47
|
+
glb.scene.scale.set(15, 15, 15);
|
|
48
|
+
this.inspection.gobal.scene.add(this.model);
|
|
49
|
+
case 8:
|
|
50
|
+
case "end":
|
|
51
|
+
return _context.stop();
|
|
52
|
+
}
|
|
53
|
+
}, _callee, this);
|
|
54
|
+
}));
|
|
55
|
+
function loadModel() {
|
|
56
|
+
return _loadModel.apply(this, arguments);
|
|
57
|
+
}
|
|
58
|
+
return loadModel;
|
|
59
|
+
}()
|
|
60
|
+
}, {
|
|
61
|
+
key: "startMove",
|
|
62
|
+
value: function () {
|
|
63
|
+
var _startMove = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(curve) {
|
|
64
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
65
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
66
|
+
case 0:
|
|
67
|
+
if (this.model) {
|
|
68
|
+
_context2.next = 3;
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
_context2.next = 3;
|
|
72
|
+
return this.loadModel();
|
|
73
|
+
case 3:
|
|
74
|
+
this.control = utils.moveWithLine(this.model, curve, 1000);
|
|
75
|
+
case 4:
|
|
76
|
+
case "end":
|
|
77
|
+
return _context2.stop();
|
|
78
|
+
}
|
|
79
|
+
}, _callee2, this);
|
|
80
|
+
}));
|
|
81
|
+
function startMove(_x) {
|
|
82
|
+
return _startMove.apply(this, arguments);
|
|
83
|
+
}
|
|
84
|
+
return startMove;
|
|
85
|
+
}()
|
|
86
|
+
}, {
|
|
87
|
+
key: "stop",
|
|
88
|
+
value: function stop() {
|
|
89
|
+
this.control.increaseSpeed(0);
|
|
90
|
+
}
|
|
91
|
+
}, {
|
|
92
|
+
key: "contineMove",
|
|
93
|
+
value: function contineMove() {
|
|
94
|
+
this.control.recoverSpeed();
|
|
95
|
+
}
|
|
96
|
+
}, {
|
|
97
|
+
key: "gotoTarget",
|
|
98
|
+
value: function gotoTarget(targetPosition) {}
|
|
99
|
+
}]);
|
|
100
|
+
return InspectionObject;
|
|
101
|
+
}();
|
|
102
|
+
var Inspection = /*#__PURE__*/function () {
|
|
103
|
+
function Inspection(gobal) {
|
|
104
|
+
_classCallCheck(this, Inspection);
|
|
105
|
+
_defineProperty(this, "gobal", void 0);
|
|
106
|
+
_defineProperty(this, "inspectionObject", void 0);
|
|
107
|
+
_defineProperty(this, "curve", void 0);
|
|
108
|
+
_defineProperty(this, "line", void 0);
|
|
109
|
+
_defineProperty(this, "minCamera", void 0);
|
|
110
|
+
_defineProperty(this, "InspectionPathObject", void 0);
|
|
111
|
+
this.gobal = gobal;
|
|
112
|
+
this.inspectionObject = new InspectionObject(this);
|
|
113
|
+
this.generateInspectionPath(linePosition);
|
|
114
|
+
this.startInspection(this.curve);
|
|
115
|
+
this.hide();
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* generate inspection path
|
|
120
|
+
* @param linePosition
|
|
121
|
+
*/
|
|
122
|
+
_createClass(Inspection, [{
|
|
123
|
+
key: "generateInspectionPath",
|
|
124
|
+
value: function generateInspectionPath(linePosition) {
|
|
125
|
+
var curve = new CurvePath();
|
|
126
|
+
linePosition.reduce(function (prev, current) {
|
|
127
|
+
curve.curves.push(new LineCurve3(new Vector3().fromArray(prev), new Vector3().fromArray(current)));
|
|
128
|
+
return current;
|
|
129
|
+
}, linePosition[0]);
|
|
130
|
+
var currentPoints = curve.getPoints();
|
|
131
|
+
var lastCurve = new CatmullRomCurve3(_toConsumableArray(currentPoints), false, 'catmullrom', 0);
|
|
132
|
+
this.curve = lastCurve;
|
|
133
|
+
var geometry = new LineGeometry();
|
|
134
|
+
var linePoints = [];
|
|
135
|
+
currentPoints.forEach(function (point) {
|
|
136
|
+
linePoints.push(point.x, point.y, point.z);
|
|
137
|
+
});
|
|
138
|
+
geometry.setPositions(linePoints);
|
|
139
|
+
var line = new Line2(geometry, new LineMaterial({
|
|
140
|
+
color: new Color('yellow').getHex(),
|
|
141
|
+
linewidth: 0.005
|
|
142
|
+
}));
|
|
143
|
+
this.line = line;
|
|
144
|
+
var minCamera = new PerspectiveCamera(90, 1, 0.1, 1000);
|
|
145
|
+
this.gobal.scene.cutoutCamera = minCamera;
|
|
146
|
+
this.minCamera = minCamera;
|
|
147
|
+
this.gobal.scene.cutoutArea = {
|
|
148
|
+
x: 0,
|
|
149
|
+
y: 0,
|
|
150
|
+
width: 200,
|
|
151
|
+
height: 200
|
|
152
|
+
};
|
|
153
|
+
this.gobal.scene.add(minCamera);
|
|
154
|
+
this.gobal.scene.add(line);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* open inspection camera
|
|
159
|
+
*/
|
|
160
|
+
}, {
|
|
161
|
+
key: "setInspectionCamera",
|
|
162
|
+
value: function setInspectionCamera() {
|
|
163
|
+
var _this = this;
|
|
164
|
+
var minCamera = new PerspectiveCamera(90, 1, 0.1, 1000);
|
|
165
|
+
this.gobal.scene.cutoutCamera = minCamera;
|
|
166
|
+
this.gobal.scene.cutoutArea = {
|
|
167
|
+
x: 0,
|
|
168
|
+
y: 0,
|
|
169
|
+
width: 200,
|
|
170
|
+
height: 200
|
|
171
|
+
};
|
|
172
|
+
this.gobal.scene.add(minCamera);
|
|
173
|
+
use.useframe(function () {
|
|
174
|
+
var car = _this.inspectionObject.model;
|
|
175
|
+
car && minCamera.position.set(car.position.x, car.position.y + 30, car.position.z);
|
|
176
|
+
car && minCamera.rotation.set(car.rotation.x, car.rotation.y + Math.PI, car.rotation.z);
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* start inspection
|
|
182
|
+
* @param line
|
|
183
|
+
*/
|
|
184
|
+
}, {
|
|
185
|
+
key: "startInspection",
|
|
186
|
+
value: function startInspection(line) {
|
|
187
|
+
this.inspectionObject.startMove(line);
|
|
188
|
+
this.setInspectionCamera();
|
|
189
|
+
}
|
|
190
|
+
}, {
|
|
191
|
+
key: "goToInspectionTarget",
|
|
192
|
+
value: function goToInspectionTarget(targetPosition) {
|
|
193
|
+
this.inspectionObject.gotoTarget(targetPosition);
|
|
194
|
+
}
|
|
195
|
+
}, {
|
|
196
|
+
key: "show",
|
|
197
|
+
value: function show() {
|
|
198
|
+
this.gobal.scene.cutout = true;
|
|
199
|
+
this.line.visible = true;
|
|
200
|
+
this.inspectionObject.model && (this.inspectionObject.model.visible = true);
|
|
201
|
+
}
|
|
202
|
+
}, {
|
|
203
|
+
key: "hide",
|
|
204
|
+
value: function hide() {
|
|
205
|
+
var _this2 = this;
|
|
206
|
+
this.gobal.scene.cutout = false;
|
|
207
|
+
this.gobal.scene.cutMain(this.gobal.scene.renderer);
|
|
208
|
+
this.line.visible = false;
|
|
209
|
+
var check = use.useframe(function () {
|
|
210
|
+
if (_this2.inspectionObject.model) {
|
|
211
|
+
_this2.inspectionObject.model.visible = false;
|
|
212
|
+
check();
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
}]);
|
|
217
|
+
return Inspection;
|
|
218
|
+
}();
|
|
219
|
+
export default Inspection;
|
|
220
|
+
//# sourceMappingURL=inspection.js.map
|