X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.g3d.vtk%2Fsrc%2Forg%2Fsimantics%2Fg3d%2Fvtk%2Fswt%2FInteractiveVtkComposite.java;h=03d0d2fb8cde95f7f6e16f943119fb8dcdb1fba3;hb=ebfe6b0245b5cf9231cecedf0aaacd891eb5d344;hp=b20bcac731dc609d7d4943274a0db59e19a07947;hpb=84132a1d750c45f9161afbd58b78572964e50d26;p=simantics%2F3d.git diff --git a/org.simantics.g3d.vtk/src/org/simantics/g3d/vtk/swt/InteractiveVtkComposite.java b/org.simantics.g3d.vtk/src/org/simantics/g3d/vtk/swt/InteractiveVtkComposite.java index b20bcac7..03d0d2fb 100644 --- a/org.simantics.g3d.vtk/src/org/simantics/g3d/vtk/swt/InteractiveVtkComposite.java +++ b/org.simantics.g3d.vtk/src/org/simantics/g3d/vtk/swt/InteractiveVtkComposite.java @@ -1,17 +1,12 @@ package org.simantics.g3d.vtk.swt; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; -import javax.vecmath.Vector3d; - import org.eclipse.swt.widgets.Composite; -import org.simantics.g3d.math.Ray; import org.simantics.g3d.scenegraph.RenderListener; import org.simantics.g3d.vtk.action.vtkAction; import org.simantics.g3d.vtk.common.VtkView; -import org.simantics.g3d.vtk.utils.vtkUtil; import org.simantics.utils.threads.IThreadWorkQueue; import org.simantics.utils.threads.SWTThread; import org.simantics.utils.threads.ThreadUtils; @@ -23,7 +18,6 @@ import vtk.vtkAreaPicker; import vtk.vtkAssemblyNode; import vtk.vtkAssemblyPath; import vtk.vtkCellPicker; -import vtk.vtkCoordinate; import vtk.vtkObjectBase; import vtk.vtkPointPicker; import vtk.vtkProp; @@ -184,6 +178,7 @@ public class InteractiveVtkComposite extends vtkSwtComponent implements VtkView{ public void lock() { getVTKLock().lock(); if (getComponent().getContext() != null && !getComponent().getContext().isCurrent()) { + @SuppressWarnings("unused") int ret = getComponent().getContext().makeCurrent(); // System.out.println("Make current2 " + ret); } @@ -280,26 +275,26 @@ public class InteractiveVtkComposite extends vtkSwtComponent implements VtkView{ return processPick(picker, apath); } else if (pickType == 5) { vtkActor2DCollection coll = ren.GetActors2D(); - coll.InitTraversal(); - vtkActor2D a; - - List picked = new ArrayList(); - while ((a = coll.GetNextItem()) != null) { - double pos[] = a.GetPosition(); - // TODO : width and height do not seem to affect the perceived size of Actor2D. - // actual size should be fetched from mapper. - double w = a.GetWidth(); - double h = a.GetHeight(); - int minx = (int)(pos[0]-w*0.5); - int miny = (int)(pos[1]-h*0.5); - int maxx = (int)(pos[0]+w*0.5); - int maxy = (int)(pos[1]+h*0.5); - if (minx <= ax && maxx >= ax && - miny <= ay && maxy >= ay) { - picked.add(a); - } - } - return picked.toArray(new vtkProp[picked.size()]); + coll.InitTraversal(); + vtkActor2D a; + + List picked = new ArrayList(); + while ((a = coll.GetNextItem()) != null) { + double pos[] = a.GetPosition(); + // TODO : width and height do not seem to affect the perceived size of Actor2D. + // actual size should be fetched from mapper. + double w = a.GetWidth(); + double h = a.GetHeight(); + int minx = (int)(pos[0]-w*0.5); + int miny = (int)(pos[1]-h*0.5); + int maxx = (int)(pos[0]+w*0.5); + int maxy = (int)(pos[1]+h*0.5); + if (minx <= ax && maxx >= ax && + miny <= ay && maxy >= ay) { + picked.add(a); + } + } + return picked.toArray(new vtkProp[picked.size()]); } return null;