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;
import vtk.vtkAssemblyNode;
import vtk.vtkAssemblyPath;
import vtk.vtkCellPicker;
-import vtk.vtkCoordinate;
import vtk.vtkObjectBase;
import vtk.vtkPointPicker;
import vtk.vtkProp;
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);
}
return processPick(picker, apath);
} else if (pickType == 5) {
vtkActor2DCollection coll = ren.GetActors2D();
- coll.InitTraversal();
- vtkActor2D a;
-
- List<vtkActor2D> picked = new ArrayList<vtkActor2D>();
- 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<vtkActor2D> picked = new ArrayList<vtkActor2D>();
+ 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;