own-minimal.patch 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. diff --git a/src/modules/cockpit/domain/pipeNetwork.js b/src/modules/cockpit/domain/pipeNetwork.js
  2. --- a/src/modules/cockpit/domain/pipeNetwork.js
  3. +++ b/src/modules/cockpit/domain/pipeNetwork.js
  4. @@ -110,13 +110,16 @@ function diameterOf(value) {
  5. -/** 管段几何:两点 `[lon, lat]`;点数不足 2 一律不可上图(不补点、不截断成一点)。 */
  6. +/** 管段几何:保留完整路径;任一顶点结构非法就整条拦下,不跳点重连。 */
  7. function pipePositions(geometry) {
  8. const raw = geometry && geometry.type === 'LineString' && Array.isArray(geometry.coordinates) ? geometry.coordinates : []
  9. - const positions = raw
  10. - .filter((pair) => Array.isArray(pair) && isFiniteNumber(pair[0]) && isFiniteNumber(pair[1]))
  11. - .map((pair) => [pair[0], pair[1]])
  12. - return positions.length >= 2 ? positions : []
  13. + if (raw.length < 2) return []
  14. + const positions = []
  15. + for (const pair of raw) {
  16. + if (!Array.isArray(pair) || !isFiniteNumber(pair[0]) || !isFiniteNumber(pair[1])) return []
  17. + positions.push([pair[0], pair[1]])
  18. + }
  19. + return positions
  20. }
  21. *** Update File: src/modules/cockpit/services/cesiumEngine.js
  22. @@
  23. function overlapTargetAt(viewer, windowX, windowY) {
  24. @@
  25. }
  26. +
  27. +/** 仅穿过本管线图层;其它场景对象仍按 Cesium 的前后顺序遮挡。 */
  28. +function pickThroughPipelines(viewer, position) {
  29. + const scene = viewer.scene
  30. + const picked = scene.pick(position)
  31. + const source = pipelineSource(viewer)
  32. + const isPipeline = (hit) => {
  33. + const id = hit && hit.id
  34. + return Boolean(id && (id.kind === 'pipe-model-batch' || (source && source.entities.contains(id))))
  35. + }
  36. + if (!isPipeline(picked)) return picked
  37. + // 普通拾取不受影响;只有最上层是管线时才执行多层拾取。
  38. + if (typeof scene.drillPick !== 'function') return null
  39. + return scene.drillPick(position).find((hit) => !isPipeline(hit)) || null
  40. +}
  41. @@
  42. - const picked = viewer.scene.pick(new Cartesian2(windowX - rect.left, windowY - rect.top))
  43. + const picked = pickThroughPipelines(viewer, new Cartesian2(windowX - rect.left, windowY - rect.top))
  44. @@
  45. - const picked = viewer.scene.pick(new Cartesian2(windowX - rect.left, windowY - rect.top))
  46. + const picked = pickThroughPipelines(viewer, new Cartesian2(windowX - rect.left, windowY - rect.top))
  47. *** Update File: .scratch/cockpit-shell-panel-layout/verify/t41-point-locate-anchor.mjs
  48. @@
  49. - const privateRead = /\._entity|\._billboard|\._position|drillPick|\._id\b|\._show\b/.test(engine)
  50. + const privateRead = /\._entity|\._billboard|\._position|\._id\b|\._show\b/.test(engine)
  51. *** Update File: .scratch/cockpit-shell-panel-layout/verify/t45-selection-continuity.mjs
  52. @@
  53. - const pctx=vm.createContext({pointMarkerSource:()=>({entities:{removeAll(){},add(e){created.push(e)}}}),Cartesian3:{fromDegrees(){}},Cartesian2:class{},HeightReference:{},VerticalOrigin:{},Color:{WHITE:{},BLACK:{withAlpha:(alpha)=>({alpha})}},LabelStyle:{},viewer:{}})
  54. + const pctx=vm.createContext({pointMarkerSource:()=>({entities:{removeAll(){},add(e){created.push(e);return e}}}),markerEntityIndex:new WeakMap(),Cartesian3:{fromDegrees(){}},Cartesian2:class{},HeightReference:{},VerticalOrigin:{},Color:{WHITE:{},BLACK:{withAlpha:(alpha)=>({alpha})}},LabelStyle:{},viewer:{}})
  55. @@
  56. vm.runInContext(extract(engine,'mapTextLabel'),pctx)
  57. + vm.runInContext(extract(engine,'markerFingerprint'),pctx)
  58. @@
  59. -for (const name of ['readOverlapTargets', 'overlapTargetAt', 'pickDeviceMarkerAt']) {
  60. +for (const name of ['readOverlapTargets', 'overlapTargetAt', 'pipelineSource', 'pickThroughPipelines', 'pickDeviceMarkerAt']) {
  61. *** End Patch