huangxingxing %!s(int64=6) %!d(string=hai) anos
pai
achega
3a56fdb8e7

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 0
dist/assets/appmian-2a9c5489.js


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 0
dist/assets/appmian-6b78d1b4.css


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 0
dist/assets/index-5a174fe6.js


+ 1 - 1
dist/assets/myHome-3faed24e.js → dist/assets/myHome-71b6e7d1.js

@@ -1 +1 @@
-import{_ as o,o as _,c as s,p as t,a,b as c}from"./index-81d27858.js";const n={},d=e=>(t("data-v-4734c238"),e=e(),a(),e),p=d(()=>c("div",{class:"left_container"},[c("h2",null,"我是跳转的路由")],-1)),r=[p];function l(e,i){return _(),s("div",null,r)}const u=o(n,[["render",l],["__scopeId","data-v-4734c238"]]);export{u as default};
+import{_ as o,o as _,c as s,p as t,a,b as c}from"./index-5a174fe6.js";const n={},d=e=>(t("data-v-4734c238"),e=e(),a(),e),p=d(()=>c("div",{class:"left_container"},[c("h2",null,"我是跳转的路由")],-1)),r=[p];function l(e,i){return _(),s("div",null,r)}const u=o(n,[["render",l],["__scopeId","data-v-4734c238"]]);export{u as default};

+ 1 - 1
dist/index.html

@@ -5,7 +5,7 @@
     <link rel="icon" href="/assets/logo.png" />
     <meta name="viewport" content="width=device-width, initial-scale=1.0" />
     <title></title>
-    <script type="module" crossorigin src="./assets/index-81d27858.js"></script>
+    <script type="module" crossorigin src="./assets/index-5a174fe6.js"></script>
     <link rel="stylesheet" href="./assets/index-3f45fbb0.css">
   </head>
   <body>

+ 29 - 11
src/control/vtkModel.js

@@ -9,11 +9,13 @@ import vtkColorTransferFunction from "@kitware/vtk.js/Rendering/Core/ColorTransf
 import { Representation } from "@kitware/vtk.js/Rendering/Core/Property/Constants";
 import vtkPolyData from "@kitware/vtk.js/Common/DataModel/PolyData";
 
-import vtkOpenGLHardwareSelector from '@kitware/vtk.js/Rendering/OpenGL/HardwareSelector';
+import { throttle } from '@kitware/vtk.js/macros';
 import {
   FieldDataTypes,
   FieldAssociations,
 } from '@kitware/vtk.js/Common/DataModel/DataSet/Constants';
+import vtkSphereSource from '@kitware/vtk.js/Filters/Sources/SphereSource';
+
 
 export class VtkModel {
   constructor() {
@@ -31,25 +33,39 @@ export class VtkModel {
    
     this.mapper.setInputData(this.polyData);
     this.actor.setMapper(this.mapper);
-  
+    this.renderer.addActor(this.actor);
+
     //点数据
     this.actor2 = vtkActor.newInstance();
     this.actor2.getProperty().setRepresentation(Representation.POINTS); //点   
     this.actor2.getProperty().setColor([2,0,0]);
     this.actor2.getProperty().setPointSize(2);
-    this.actor2.setMapper(this.mapper);
-
-    this.renderer.addActor(this.actor);
+    this.actor2.setMapper(this.mapper);  
     this.renderer.addActor(this.actor2);
 
     //选取
-    const openGLRenderWindow = this.renderWindowWith.getApiSpecificRenderWindow();
-    const selector = vtkOpenGLHardwareSelector.newInstance({
-      captureZValues: true,
-    });
-    selector.setFieldAssociation(FieldAssociations.FIELD_ASSOCIATION_POINTS);
-    selector.attach(openGLRenderWindow, this.renderer)
+    this.interactor = this.renderer.getRenderWindow().getInteractor();
+    this.apiSpecificRenderWindow = this.interactor.getView();
+    this.hardwareSelector = this.apiSpecificRenderWindow.getSelector();
 
+    this.hardwareSelector.setCaptureZValues(true);
+    // TODO: bug in FIELD_ASSOCIATION_POINTS mode
+    // hardwareSelector.setFieldAssociation(
+    //   FieldAssociations.FIELD_ASSOCIATION_POINTS
+    // );
+    this.hardwareSelector.setFieldAssociation(FieldAssociations.FIELD_ASSOCIATION_POINTS);
+
+
+    // this.pointerSource = vtkSphereSource.newInstance({
+    //   phiResolution: 15,
+    //   thetaResolution: 15,
+    //   radius: 0.01,
+    // });
+    // this.pointerMapper = vtkMapper.newInstance();
+    // this.pointerActor = vtkActor.newInstance();
+    // this.pointerActor.setMapper(this.pointerMapper);
+    // this.pointerMapper.setInputConnection(this.pointerSource.getOutputPort());
+    // this.renderer.addActor(this.pointerActor);
 
 
     //结果数据
@@ -105,5 +121,7 @@ export class VtkModel {
   } 
 
 }
+
+
 const vtkmodel = new VtkModel();
 export { vtkmodel };

+ 48 - 0
src/view/components/InfoVtkmodel.vue

@@ -4,9 +4,13 @@ import { ref, onMounted, reactive } from "vue";
 import { RouterView, RouterLink } from "vue-router";
 import { request, uploadFile } from "@/utils/request";
 import { vtkmodel } from "@/control/vtkModel.js";
+import { throttle } from '@kitware/vtk.js/macros';
 
 onMounted(() => {
   readNodeAndPipe();
+  // const throttleMouseHandler = throttle(pickOnMouseEvent, 20);
+  // document.addEventListener('mousemove', throttleMouseHandler);
+
 });
 const nodes = ref([]); //节点数据
 const pipes = ref([]); //管道数据
@@ -53,6 +57,50 @@ async function readePipe() {
     .catch((err) => {});
 }
 
+function pickOnMouseEvent(event) {
+  if (vtkmodel.interactor.isAnimating()) {
+    // We should not do picking when interacting with the scene
+    return;
+  }
+  const [x, y] = eventToWindowXY(event);
+  // console.log([x,y]);
+  // vtkmodel.pointerActor.setVisibility(false);
+  vtkmodel.hardwareSelector.getSourceDataAsync(vtkmodel.renderer, x, y, x, y).then((result) => {
+    if (result) {
+      processSelections(result.generateSelection(x, y, x, y));
+      // processSelections(result.generateSelection(x, y, x, y));
+    } else {
+      // processSelections(null);
+    }
+  });
+}
+function eventToWindowXY(event) {
+  // We know we are full screen => window.innerXXX
+  // Otherwise we can use pixel device ratio or else...
+  const { clientX, clientY } = event;
+  const [width, height] = vtkmodel.apiSpecificRenderWindow.getSize();
+  const x = Math.round((width * clientX) / window.innerWidth);
+  const y = Math.round(height * (1 - clientY / window.innerHeight)); // Need to flip Y
+  return [x, y];
+}
+function processSelections(selections) {
+    if (!selections || selections.length === 0) {
+    return;
+  }
+  const {
+    worldPosition: rayHitWorldPosition,
+    compositeID,
+    prop,
+    propID,
+    attributeID,
+  } = selections[0].getProperties();
+  console.log(rayHitWorldPosition);
+  prop.getProperty().setColor([0.1, 0.8, 0.1]);
+}
+
+
+
+
 /**
  * 在管道中已存在的点才可以使用
  */

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio