Browse Source

箭头问题

huangxingxing 9 months ago
parent
commit
b162997d2b
3 changed files with 62 additions and 36 deletions
  1. 14 9
      src/control/fireControl.js
  2. 46 25
      src/control/vtkModel.js
  3. 2 2
      src/view/index/first-left.vue

+ 14 - 9
src/control/fireControl.js

@@ -81,7 +81,7 @@ export class fireControl {
             this.velocitys = this.velocityMap.get(step);
         } else {
             // const url = this._url + this.aid + "&transCode=D000017&step=" + this.step;
-            const url = this._url + 7 + "&transCode=D000017&step=" + 27;
+            const url = this._url  + this.aid+ "&transCode=D000017&step=" + 27;
             await this.velocityreader.setUrl(url).then(() => {
                 const velocitys = this.velocityreader.getOutputData(1);
                 this.velocitys = velocitys;
@@ -108,16 +108,21 @@ export class fireControl {
                 // ["Height", "(m)"],
                 if(skey=="Height"){
                     scalarVarry.forEach(function(value) {
-                        if(value>=0&&value<0.2){
+                        // if(value>=0&&value<0.2){
+                        //     scalar.push(0);
+                        // }else if(value>=0.2&&value<0.5){
+                        //     scalar.push(1);
+                        // }else if(value>=0.5&&value<1){
+                        //     scalar.push(2);
+                        // }else if(value>=1){
+                        //     scalar.push(3);
+                        // }else{
+                        //     scalar.push(0);
+                        // }
+                        if(value<1.5){
                             scalar.push(0);
-                        }else if(value>=0.2&&value<0.5){
-                            scalar.push(1);
-                        }else if(value>=0.5&&value<1){
-                            scalar.push(2);
-                        }else if(value>=1){
-                            scalar.push(3);
                         }else{
-                            scalar.push(0);
+                            scalar.push(1);
                         }
                     });
                 }               

+ 46 - 25
src/control/vtkModel.js

@@ -123,7 +123,7 @@ export class VtkModel {
     this.gjMapper = vtkMapper.newInstance();
     this.gjActor.getProperty().setRepresentation(Representation.SURFACE); //面    
     this.gjscalarBarActor = vtkScalarBarActor.newInstance();
-    this.gjscalarBarActor.setGenerateTicks(this.generateTicks(4));
+    this.gjscalarBarActor.setGenerateTicks(this.generateTicks(2));
     this.gjscalarBarActor.setDrawAboveRangeSwatch(true);
     this.gjscalarBarActor.setDrawNanAnnotation(false);
     this.gjscalarBarActor.setDrawAboveRangeSwatch(false);
@@ -279,7 +279,7 @@ export class VtkModel {
 
 
     // //箭头
-    // this.arrowActors = []; 
+    this.arrowActors = []; 
     // const viewColors = [
     //   [1, 0, 0], // sagittal
     //   [0, 1, 0], // coronal
@@ -370,39 +370,57 @@ export class VtkModel {
     this.arrowActors = [];
     velocitys.forEach(velocity => {
       velocity.points.forEach(point => {
-        // const initialValues = { 
-        //   base:0,
-        //   shape: 'arrow4points',
-        //   center: [point.x,point.y,point.z],
-        //   width: 3,height:10,direction:[
-        //     velocity.vector[2],
-        //     velocity.vector[0],
-        //     velocity.vector[1]
-        //   ] };
-        // const vtk2d = vtk2DShape.newInstance(initialValues);
-
-        const initialValues = {
-          base: 0,
-          center: [point.x, point.y, point.z],
-          height: 7,
-          radius: 8,
-          resolution: 3,
-          direction: [
+        const initialValues = { 
+          base:0,
+          shape: 'triangle',
+          center: [point.x,point.y,point.z],
+          direction:[
             velocity.vector[0],
             velocity.vector[1],
             velocity.vector[2]
-          ]
-        };
-        const vtk2d = vtkConeSource.newInstance(initialValues);
+          ],
+          height: 10.0,
+          thickness: 1.5,
+          width: 3,
+         };
+        const vtk2d = vtk2DShape.newInstance(initialValues);
+
+
+        
+
+        // const initialValues = {
+        //   // base: 0,
+        //   center: [point.x, point.y, point.z],
+        //   // height: 4,
+        //   // radius: 8,
+        //   // resolution: 3,
+        //   height: 4.0,
+        //   radius: 1,
+        //   resolution: 6,
+        //   direction: [
+        //     velocity.vector[0],
+        //     velocity.vector[1],
+        //     velocity.vector[2]
+        //   ],
+        //   capping: true,
+
+        // };
+        // const vtk2d = vtkConeSource.newInstance(initialValues);
+
         const mapper = vtkMapper.newInstance();
         mapper.setInputConnection(vtk2d.getOutputPort());
         const actor = vtkActor.newInstance();
         actor.setMapper(mapper);
+          actor.getProperty().setColor(REA);
         this.arrowActors.push(actor);
         // this.renderer.addActor(actor);
       })
     });
-    // this.renderWindow.render();
+    for (let index = 0; index < this.arrowActors.length; index=index+30) {
+      let actor =this.arrowActors[index];
+      this.renderer.addActor(actor);
+     };
+    this.renderWindow.render();
   }
   clearArrow() {
     if (this.arrowActors) {
@@ -636,6 +654,8 @@ export class VtkModel {
     this.renderer.addActor(this.gjscalarBarActor);
     this.renderer.removeActor(this.jgActor);
     this.renderer.removeActor(this.scalarBarActor);
+    this.isSelectNode = false;
+    this.isSelectPipe = false;
     this.wayClearShow();
     this.modelClearShow();
     this.isJg = true; //显示结果
@@ -645,7 +665,8 @@ export class VtkModel {
   clearModeAddJg() {
     this.renderer.addActor(this.jgActor);
     this.renderer.addActor(this.scalarBarActor);
-
+    this.isSelectNode = false;
+    this.isSelectPipe = false;
     this.renderer.removeActor(this.gjActor);
     this.renderer.removeActor(this.gjscalarBarActor)
     this.wayClearShow();

+ 2 - 2
src/view/index/first-left.vue

@@ -855,7 +855,7 @@ function reddate(date) {
   newcount.value = count.value;
 }
 function velocityRead() {
-  return;
+  // return;
   // clearInterval(arrowtime.value);
    fcon
     .getVelocityByStep(fcon.step)
@@ -981,7 +981,7 @@ function vtkScalarRead() {
   fcon
     .getScalrsByStep(fcon.step)
     .then((result) => {
-      // velocityRead() ;
+      velocityRead() ;
       if(valueswitch.value==false){
         disabledshow.value=false;
         vtkShow();