01: /*
02: * $Header: /cvs/j3dfly/J3dEditor/src/org/jdesktop/j3dedit/locationeditor/ViewFrameSelectionControl.java,v 1.1 2005/04/20 22:20:36 paulby Exp $
03: *
04: * Sun Public License Notice
05: *
06: * The contents of this file are subject to the Sun Public License Version
07: * 1.0 (the "License"). You may not use this file except in compliance with
08: * the License. A copy of the License is available at http://www.sun.com/
09: *
10: * The Original Code is the Java 3D(tm) Scene Graph Editor.
11: * The Initial Developer of the Original Code is Paul Byrne.
12: * Portions created by Paul Byrne are Copyright (C) 2002.
13: * All Rights Reserved.
14: *
15: * Contributor(s): Paul Byrne.
16: *
17: **/
18: package org.jdesktop.j3dedit.locationeditor;
19:
20: import javax.media.j3d.Locale;
21: import javax.media.j3d.Canvas3D;
22: import com.sun.j3d.utils.picking.PickCanvas;
23: import com.sun.j3d.utils.picking.PickResult;
24:
25: /**
26: * Specialisation of SelectionControl which only picks certain object types
27: *
28: * @author paulby
29: * @version
30: */
31: public class ViewFrameSelectionControl extends
32: org.jdesktop.j3dfly.SelectionControl {
33:
34: /** Creates new ViewFrameSelection */
35: public ViewFrameSelectionControl(Locale locale, Canvas3D canvas) {
36: super (locale, canvas);
37: }
38:
39: protected PickResult doPick(java.awt.event.MouseEvent evt) {
40: pickCanvas.setShapeLocation(evt);
41: PickResult result[];
42: PickResult ret = null;
43: try {
44: result = pickCanvas.pickAllSorted();
45: } catch (javax.media.j3d.CapabilityNotSetException e) {
46: result = null;
47: System.out.println("No Capability to pick object");
48: }
49:
50: if (result == null)
51: return null;
52:
53: for (int i = 0; i < result.length && ret == null; i++)
54: if (result[i].getObject() instanceof org.jdesktop.j3dedit.scenegrapheditor.visualtools.PointHighlightShape3D)
55: ret = result[i];
56:
57: return ret;
58: }
59:
60: }
|