]> Creatis software - clitk.git/commitdiff
Romulo:
authordsarrut <dsarrut>
Thu, 31 Mar 2011 13:27:30 +0000 (13:27 +0000)
committerdsarrut <dsarrut>
Thu, 31 Mar 2011 13:27:30 +0000 (13:27 +0000)
- solved bug #283
   + rendering logic in vvSlicer::Render was blocking cursor updates if corner annotation was not visible

vv/vvSlicer.cxx
vv/vvSlicerManagerCommand.cxx

index d05ae4fe69513879de10543932ff89db2fde18b0..77f75356314da830272042bfd5754b23d4a8a6e4 100644 (file)
@@ -1265,33 +1265,6 @@ void vvSlicer::Render()
     double X = (mCurrent[0] - this->GetInput()->GetOrigin()[0])/this->GetInput()->GetSpacing()[0];
     double Y = (mCurrent[1] - this->GetInput()->GetOrigin()[1])/this->GetInput()->GetSpacing()[1];
     double Z = (mCurrent[2] - this->GetInput()->GetOrigin()[2])/this->GetInput()->GetSpacing()[2];
-
-    if (pdmA->GetVisibility()) {
-      double x = mCursor[0];
-      double y = mCursor[1];
-      double z = mCursor[2];
-      double xCursor = (x - this->GetInput()->GetOrigin()[0])/this->GetInput()->GetSpacing()[0];
-      double yCursor = (y - this->GetInput()->GetOrigin()[1])/this->GetInput()->GetSpacing()[1];
-      double zCursor = (z - this->GetInput()->GetOrigin()[2])/this->GetInput()->GetSpacing()[2];
-
-      if (xCursor >= this->GetImageActor()->GetDisplayExtent()[0] &&
-          xCursor < this->GetImageActor()->GetDisplayExtent()[1]+1 &&
-          yCursor >= this->GetImageActor()->GetDisplayExtent()[2] &&
-          yCursor < this->GetImageActor()->GetDisplayExtent()[3]+1 &&
-          zCursor >= this->GetImageActor()->GetDisplayExtent()[4] &&
-          zCursor < this->GetImageActor()->GetDisplayExtent()[5]+1 ) {
-        vtkRenderer * renderer = this->Renderer;
-
-        renderer->WorldToView(x,y,z);
-        renderer->ViewToNormalizedViewport(x,y,z);
-        renderer->NormalizedViewportToViewport(x,y);
-        renderer->ViewportToNormalizedDisplay(x,y);
-        renderer->NormalizedDisplayToDisplay(x,y);
-        crossCursor->SetFocalPoint(x,y,z);
-      } else
-        crossCursor->SetFocalPoint(-1,-1,z);
-    }
-
     if (X >= this->GetInput()->GetWholeExtent()[0] &&
         X <= this->GetInput()->GetWholeExtent()[1] &&
         Y >= this->GetInput()->GetWholeExtent()[2] &&
@@ -1320,6 +1293,34 @@ void vvSlicer::Render()
     }
     ca->SetText(1,worldPos.c_str());
   }
+
+  if (pdmA->GetVisibility()) {
+    double x = mCursor[0];
+    double y = mCursor[1];
+    double z = mCursor[2];
+    double xCursor = (x - this->GetInput()->GetOrigin()[0])/this->GetInput()->GetSpacing()[0];
+    double yCursor = (y - this->GetInput()->GetOrigin()[1])/this->GetInput()->GetSpacing()[1];
+    double zCursor = (z - this->GetInput()->GetOrigin()[2])/this->GetInput()->GetSpacing()[2];
+
+    if (xCursor >= this->GetImageActor()->GetDisplayExtent()[0] &&
+        xCursor < this->GetImageActor()->GetDisplayExtent()[1]+1 &&
+        yCursor >= this->GetImageActor()->GetDisplayExtent()[2] &&
+        yCursor < this->GetImageActor()->GetDisplayExtent()[3]+1 &&
+        zCursor >= this->GetImageActor()->GetDisplayExtent()[4] &&
+        zCursor < this->GetImageActor()->GetDisplayExtent()[5]+1 ) {
+      vtkRenderer * renderer = this->Renderer;
+
+      renderer->WorldToView(x,y,z);
+      renderer->ViewToNormalizedViewport(x,y,z);
+      renderer->NormalizedViewportToViewport(x,y);
+      renderer->ViewportToNormalizedDisplay(x,y);
+      renderer->NormalizedDisplayToDisplay(x,y);
+      crossCursor->SetFocalPoint(x,y,z);
+    } else
+      crossCursor->SetFocalPoint(-1,-1,z);
+  }
+
+
   if (mOverlay && mOverlayActor->GetVisibility()) {
     mOverlayMapper->SetWindow(this->GetColorWindow());
     mOverlayMapper->SetLevel(this->GetColorLevel());
@@ -1329,7 +1330,7 @@ void vvSlicer::Render()
   }
   if (mLandMapper)
     UpdateLandmarks();
-  //this->Superclass::Render();
+
   this->GetRenderWindow()->Render();
 }
 //----------------------------------------------------------------------------
index cb2a394ec5a57c5f0e002cb383a9c3e2ca2b3713..6f59659364a712f02f07abaf08479bf0122a477c 100644 (file)
@@ -87,7 +87,6 @@ void vvSlicerManagerCommand::Execute(vtkObject *caller,
     if (event == vtkCommand::StartPickEvent && VisibleInWindow == -1) {
       for (int i = 0; i < this->SM->GetNumberOfSlicers(); i++) {
         if (this->SM->GetSlicer(i)->GetCursorVisibility()) {
-          this->SM->GetSlicer(i)->SetCursorVisibility(0);
           this->SM->GetSlicer(i)->SetCornerAnnotationVisibility(0);
           this->SM->GetSlicer(i)->Render();
         }