/** Select all the nodes that intersect the PickShape, returned sorted. The "closest" object will be returned first. See note above to see how "closest" is determined. <p> @return An array of <code>PickInfo</code> objects which will contain information about the picked instances. <code>null</code> if nothing was picked. */ public PickInfo[] pickAllSorted () { PickInfo[] pickInfos = null; if (pickRootBG != null) { pickInfos = pickRootBG.pickAllSorted(mode, flags, pickShape); } else if (pickRootL != null) { pickInfos = pickRootL.pickAllSorted(mode, flags, pickShape); } return pickInfos; }
/** * Returns a sorted array of references to all the Pickable items below the * <code>BranchGroup</code> (specified in the PickObject constructor) that * intersect with the ray that starts at the viewer * position and points into the scene in the direction of (xpos, ypos) * in the window space. * Element [0] references the item closest to viewer. * * @param xpos The value along the x-axis. * @param ypos The value along the y-axis. * @return A sorted arrayof SceneGraphPath objects that contain Objects that * were picked. The array is sorted from closest to farthest from the * viewer * If no pickable object is found <code>null</code> is returned.. * * @see SceneGraphPath */ public SceneGraphPath[] pickAllSorted(int xpos, int ypos) { pickRay = (PickRay) generatePickRay(xpos, ypos); sceneGraphPathArr = pickRoot.pickAllSorted(pickRay); return sceneGraphPathArr; }
private PickResult[] pickAllSorted (PickShape pickShape) { PickResult[] pr = null; SceneGraphPath[] sgp = null; if (pickRootBG != null) { sgp = pickRootBG.pickAllSorted (pickShape); } else if (pickRootL != null) { sgp = pickRootL.pickAllSorted (pickShape); } if (sgp == null) return null; // no match // Create PickResult array pr = new PickResult [sgp.length]; for (int i=0;i<sgp.length;i++) { pr[i] = new PickResult (sgp[i], pickShape); } return pr; }