diff --git a/src/app/babylon/controller/config-manager.ts b/src/app/babylon/controller/config-manager.ts index 77bc248..b8fbb67 100644 --- a/src/app/babylon/controller/config-manager.ts +++ b/src/app/babylon/controller/config-manager.ts @@ -174,6 +174,7 @@ export class ConfigManager { [MarkType.JYY, "加油员"], [MarkType.XYY, "卸油员"], [MarkType.YGC, "油罐车"], + [MarkType.SYG, "输油管"], [MarkType.YGCSJ, "油罐车司机"], [MarkType.XFSD, "消防沙(堆)"], [MarkType.XFSQ, "消防沙(圈)"], diff --git a/src/app/babylon/controller/inputController.ts b/src/app/babylon/controller/inputController.ts index 0298e4d..330f0e4 100644 --- a/src/app/babylon/controller/inputController.ts +++ b/src/app/babylon/controller/inputController.ts @@ -296,6 +296,7 @@ export class InputController { && this.markType != MarkType.YWA && this.markType != MarkType.YWB && this.markType != MarkType.JJX + && this.markType != MarkType.SYG // && this.markType != MarkType.SD && this.markType != MarkType.JGLX && this.markType != MarkType.CT diff --git a/src/app/babylon/controller/scene-manager.ts b/src/app/babylon/controller/scene-manager.ts index ee940df..750e8f2 100644 --- a/src/app/babylon/controller/scene-manager.ts +++ b/src/app/babylon/controller/scene-manager.ts @@ -59,6 +59,8 @@ import { ModelInfo_mark_particle } from '../model/info/mark/other/mark-plan-part import { FacilityPosType, ModelData_facility } from '../model/data/model-data/model-data-facility'; import { LoadTool } from '../tool/load-tool'; import { flatten } from 'earcut'; +import { MarkData_multiLine } from '../model/data/mark/other/mark-data-multi-line'; +import { MarkPlanSYGInfo } from '../model/info/mark/other/mark-plan-syg-info'; //场景管理器 @@ -557,6 +559,10 @@ export class SceneManager { modelData = plainToClass(MarkData_multiArrow_CT, modelData); modelInfo = new ModelInfo_mark_multiArrow(modelData as MarkData, null, defaultMesh, null, isNew); break; + case MarkType.SYG: + modelData = plainToClass(MarkData_multiLine, modelData); + modelInfo = new MarkPlanSYGInfo(modelData as MarkData, null, defaultMesh, null, isNew); + break; case MarkType.H: case MarkType.SNH: case MarkType.YWA: diff --git a/src/app/babylon/model/data/mark/all-mark-data.ts b/src/app/babylon/model/data/mark/all-mark-data.ts index 85b2a20..d10d5f8 100644 --- a/src/app/babylon/model/data/mark/all-mark-data.ts +++ b/src/app/babylon/model/data/mark/all-mark-data.ts @@ -70,6 +70,7 @@ export class AllMarkData { AllMarkData.newMarkData(MarkType.JYY, MarkKindType.Persion, tagPos, result); AllMarkData.newMarkData(MarkType.XYY, MarkKindType.Persion, tagPos, result); AllMarkData.newMarkData(MarkType.YGC, MarkKindType.Car, tagPos, result); + AllMarkData.newMarkData(MarkType.SYG, MarkKindType.Virtual, tagPos, result, undefined, false); AllMarkData.newMarkData(MarkType.YGCSJ, MarkKindType.Persion, tagPos, result); AllMarkData.newMarkData(MarkType.XFSD, MarkKindType.Goods, tagPos, result); AllMarkData.newMarkData(MarkType.XFSQ, MarkKindType.Goods, tagPos, result); @@ -163,6 +164,11 @@ export class AllMarkData { case MarkType.CT: result = new MarkData_multiArrow_CT(type.toString(), type, tagPos, kindType, icon, modelPath, modelName, taskType, isModel); break; + case MarkType.SYG: + result = new MarkData_multiLine(type.toString(), type, tagPos, kindType, icon, modelPath, modelName, taskType, isModel) + result.color = "#6B6060" + result.radius = 0.07 + break; default: result = new MarkData(type.toString(), type, tagPos, kindType, icon, modelPath, modelName, taskType, isModel); break; diff --git a/src/app/babylon/model/data/mark/mark-data.ts b/src/app/babylon/model/data/mark/mark-data.ts index faf7c93..597a50d 100644 --- a/src/app/babylon/model/data/mark/mark-data.ts +++ b/src/app/babylon/model/data/mark/mark-data.ts @@ -265,6 +265,10 @@ export enum MarkType { */ YGC = "YGC", + /** + * 输油管 + */ + SYG = "SYG", /** * 油罐车司机 */ diff --git a/src/app/babylon/model/info/mark/other/mark-plan-syg-info.ts b/src/app/babylon/model/info/mark/other/mark-plan-syg-info.ts new file mode 100644 index 0000000..1e04dd2 --- /dev/null +++ b/src/app/babylon/model/info/mark/other/mark-plan-syg-info.ts @@ -0,0 +1,170 @@ +import { AbstractMesh, Color3, EventState, Mesh, MeshBuilder, Observer, PointerEventTypes, PointerInfo, StandardMaterial, Vector3 } from "@babylonjs/core"; +import { classToClass, plainToClass } from "class-transformer"; +import { SceneManager } from "src/app/babylon/controller/scene-manager"; +import { BabylonTool } from "src/app/babylon/tool/babylon-tool"; +import { MarkWindow } from "src/app/babylon/view/mark-window/mark-window"; +import { MarkData } from "../../../data/mark/mark-data"; +import { MarkData_multiLine } from "../../../data/mark/other/mark-data-multi-line"; +import { ModelInfo_mark } from "../model-info-mark"; + +export class MarkPlanSYGInfo extends ModelInfo_mark { + lineData: MarkData_multiLine; + + onPointObserver: Observer; + + lineMesh: Mesh; + + mat: StandardMaterial; + + + onCreate(isNew: boolean) { + let instance = this; + instance.lineData = this.markData as MarkData_multiLine; + + + this.mat = new StandardMaterial("mat_multiLine", SceneManager.Instance.scene); + this.mat.emissiveColor = Color3.FromHexString(this.lineData.color); + this.mat.disableLighting = true; + + if (isNew) { + instance.lineData.pointData = []; + instance.addPoint(this.modelBox.absolutePosition.clone()); + + setTimeout(() => { + instance.onPointObserver = SceneManager.Instance.scene.onPointerObservable.add((eventData: PointerInfo, eventState: EventState) => { + instance.onPointerObservable(eventData, eventState); + } + + ); + }, 300); + } + else { + instance.lineData.pointData = plainToClass(Vector3, instance.lineData.pointData); + } + instance.updateRender(); + } + + /** + * 更新显示 + */ + updateRender() { + if (this.lineData.pointData != null && this.lineData.pointData.length > 1) { + this.lineMesh = MeshBuilder.CreateTube("tube", { path: this.lineData.pointData, radius: this.lineData.radius, sideOrientation: Mesh.DOUBLESIDE, updatable: true, cap: Mesh.CAP_ALL }, SceneManager.Instance.scene); + this.lineMesh.setParent(this.modelBox); + this.lineMesh.position = Vector3.Zero(); + this.lineMesh.material = this.mat; + } + } + + /** + * 添加节点 + * @param point + */ + addPoint(point: Vector3) { + point.y = point.y + this.lineData.yPos; + this.lineData.pointData.push(point.subtract(this.modelBox.absolutePosition)); + //更新表现 + + if (this.lineData.pointData.length > 1) { + + this.updateRender(); + } + + } + + /** + * 移除事件 + */ + removeEvent() { + if (this.onPointObserver != null) { + SceneManager.Instance.scene.onPointerObservable.remove(this.onPointObserver); + this.onPointObserver = null; + } + } + + /** + * 取消创建 + */ + cancelCreate() { + if (this.lineData.pointData.length < 2) { + MarkWindow.instance.deleteMarkInfo(this); + } + // MarkWindow.instance.mulLineIsBreak_SD = -1; + + } + + + onPointerObservable(eventData: PointerInfo, eventState: EventState) { + let instance = this; + // if (MarkWindow.instance.mulLineIsBreak_SD < 0) { + // instance.cancelCreate(); + // instance.removeEvent(); + // return; + // } + + switch (eventData.type) { + case PointerEventTypes.POINTERUP: + if (eventData.event.button == 0) { //左键正常 + if (eventData.pickInfo.hit && !SceneManager.s_isPointerDrag) { + instance.addPoint(eventData.pickInfo.pickedPoint); + } + } + else if (eventData.event.button == 2) { //右键取消 + instance.cancelCreate(); + instance.removeEvent(); + } + break; + + } + } + + + onSelect(select: boolean) { + super.onSelect(select); + + if (select = false) { + this.cancelCreate(); + } + } + + + /** + * 克隆 + */ + clone(markData?: MarkData, isNew: boolean = true): ModelInfo_mark { + + let l_markData: MarkData = null; + if (markData == null) { + l_markData = classToClass(this.modelData) as MarkData; + } + else { + l_markData = markData; + } + + let childMeshes = null; + let modelBox = null; + + modelBox = BabylonTool.cloneMesh(this.modelBox as Mesh, null, (childMesh: AbstractMesh[]) => { + childMeshes = childMesh; + }); + + + let info = new MarkPlanSYGInfo(l_markData, childMeshes, modelBox, null, isNew); + + this.cloneAnimTo(info); + + + + return info; + } + + + dispose() { + if (this.mat != null) { + this.mat.dispose(); + } + + this.removeEvent(); + super.dispose(); + } +} \ No newline at end of file diff --git a/src/app/babylon/view/mark-window/mark-window.ts b/src/app/babylon/view/mark-window/mark-window.ts index f4d6847..50a5444 100644 --- a/src/app/babylon/view/mark-window/mark-window.ts +++ b/src/app/babylon/view/mark-window/mark-window.ts @@ -87,6 +87,10 @@ export class MarkWindow extends UIBase { * 撤退路线 0-表示可以开始,1-表示正在绘制,-1 表示阻止绘制 */ mulArrowIsBreak_CT: number = -1; + /** + * 输油管 0-表示可以开始,1-表示正在绘制,-1 表示阻止绘制 + */ + mulLineIsBreak_SYG: number = -1; /** * 所有的标绘方案数据 @@ -517,6 +521,7 @@ export class MarkWindow extends UIBase { this.markLineIsBreak = -1; this.mulArrowIsBreak_JG = -1; this.mulArrowIsBreak_CT = -1; + this.mulLineIsBreak_SYG = -1; } } @@ -844,6 +849,15 @@ export class MarkWindow extends UIBase { instance.mulArrowIsBreak_CT = 1; } + } + else if (instance.currentMarkDataPrefab.type == MarkType.SYG) { + if (instance.mulLineIsBreak_SYG > 0) { + return; + } + else { + instance.mulLineIsBreak_SYG = 1; + } + } readyCreateMark = true; pickPos = worldPos; @@ -893,7 +907,7 @@ export class MarkWindow extends UIBase { let l_markInfo = instance.getMarkInfoFromMesh(eventData.pickInfo.pickedMesh); if (l_markInfo != null) { if (instance.currentMarkDataPrefab != null && instance.currentMarkDataPrefab.markKindType != MarkKindType.Effect - && instance.currentMarkDataPrefab.type != MarkType.MHTK) //特效可以放在标绘物上 + && instance.currentMarkDataPrefab.type != MarkType.MHTK && instance.currentMarkDataPrefab.type != MarkType.SYG) //特效可以放在标绘物上 { readyCreateMark = false; } diff --git a/src/app/pages/criminal-records-admin/criminal-records-admin.component.ts b/src/app/pages/criminal-records-admin/criminal-records-admin.component.ts index 6abb8c1..4a12604 100644 --- a/src/app/pages/criminal-records-admin/criminal-records-admin.component.ts +++ b/src/app/pages/criminal-records-admin/criminal-records-admin.component.ts @@ -639,6 +639,9 @@ export class CriminalRecordsAdminComponent implements OnInit { if (!e) { this.warningTypesDetails = this.warningTypesDetailsCopy this.warningTypes = this.warningTypesCopy + this.validateForm.patchValue({ + type: null, + }); return } this.warningLevels.forEach(element => { diff --git a/src/app/pages/criminal-records/criminal-records.component.ts b/src/app/pages/criminal-records/criminal-records.component.ts index 1aadbfd..952789c 100644 --- a/src/app/pages/criminal-records/criminal-records.component.ts +++ b/src/app/pages/criminal-records/criminal-records.component.ts @@ -576,6 +576,9 @@ export class CriminalRecordsComponent implements OnInit { if (!e) { this.warningTypesDetails = this.warningTypesDetailsCopy this.warningTypes = this.warningTypesCopy + this.validateForm.patchValue({ + type: null, + }); return } this.warningLevels.forEach(element => { diff --git a/src/assets/images/mark/inside/syg.png b/src/assets/images/mark/inside/syg.png new file mode 100644 index 0000000..955d0d1 Binary files /dev/null and b/src/assets/images/mark/inside/syg.png differ diff --git a/src/assets/mesh/mark/inside/ygc/YGC.bin b/src/assets/mesh/mark/inside/ygc/YGC.bin index 7c636b8..deef0eb 100644 Binary files a/src/assets/mesh/mark/inside/ygc/YGC.bin and b/src/assets/mesh/mark/inside/ygc/YGC.bin differ diff --git a/src/assets/mesh/mark/inside/ygc/YGC.gltf b/src/assets/mesh/mark/inside/ygc/YGC.gltf index 7dbc17f..d46ac65 100644 --- a/src/assets/mesh/mark/inside/ygc/YGC.gltf +++ b/src/assets/mesh/mark/inside/ygc/YGC.gltf @@ -1,6 +1,6 @@ { "asset" : { - "generator" : "Khronos glTF Blender I/O v1.6.16", + "generator" : "Khronos glTF Blender I/O v1.8.19", "version" : "2.0" }, "extensionsUsed" : [ @@ -67,7 +67,7 @@ }, { "mesh" : 10, - "name" : "YouXiang" + "name" : "YouXiang.002" }, { "children" : [ @@ -514,7 +514,7 @@ ] }, { - "name" : "Object083", + "name" : "Object083.002", "primitives" : [ { "attributes" : { @@ -975,12 +975,12 @@ "componentType" : 5126, "count" : 3028, "max" : [ - 0.930234968662262, - 0.9678786993026733, + 1.0429768562316895, + 0.9093518257141113, 1.6651370525360107 ], "min" : [ - -0.9589369893074036, + -1.0429768562316895, 0.4841155409812927, -0.7362931966781616 ], @@ -1003,7 +1003,7 @@ }, { "componentType" : 5126, - "count" : 12414, + "count" : 12010, "max" : [ 1.1273759603500366, 2.7106683254241943, @@ -1011,24 +1011,24 @@ ], "min" : [ -1.1218620538711548, - 0.3482356071472168, + 0.46230417490005493, -4.180373191833496 ], "type" : "VEC3" }, { "componentType" : 5126, - "count" : 12414, + "count" : 12010, "type" : "VEC3" }, { "componentType" : 5126, - "count" : 12414, + "count" : 12010, "type" : "VEC2" }, { "componentType" : 5123, - "count" : 52836, + "count" : 51528, "type" : "SCALAR" } ], @@ -1040,7 +1040,7 @@ }, { "buffer" : 0, - "byteLength" : 38625, + "byteLength" : 38628, "byteOffset" : 6180 }, { @@ -1090,13 +1090,13 @@ }, { "buffer" : 0, - "byteLength" : 15572, + "byteLength" : 15700, "byteOffset" : 168464 }, { "buffer" : 0, - "byteLength" : 49230, - "byteOffset" : 184036 + "byteLength" : 46892, + "byteOffset" : 184164 } ], "samplers" : [ @@ -1107,7 +1107,7 @@ ], "buffers" : [ { - "byteLength" : 233268, + "byteLength" : 231056, "uri" : "YGC.bin" } ]