/** * Creates a shallow copy of the specified source shape. * * @param source the shape to copy. */ public AbstractSurfaceObject(AbstractSurfaceObject source) { super(source); this.visible = source.visible; this.uniqueId = nextUniqueId(); this.lastModifiedTime = System.currentTimeMillis(); this.enableBatchPicking = source.enableBatchPicking; }
/** * Causes adjacent SurfaceObjects in the DrawContext's ordered surface renderable list to draw themselves in in a * unique pick color, and adds themselves as pickable objects to the specified pickSupport. Adjacent SurfaceObjects * are removed from the DrawContext's list and processed until one is encountered that has a different containing * layer or is not enabled for batch picking. * * @param dc the current DrawContext. * @param pickSupport the PickSupport to add the SurfaceObject to. */ protected void pickBatched(DrawContext dc, PickSupport pickSupport) { // Draw as many as we can in a batch to save pick resolution. Object nextItem = dc.getOrderedSurfaceRenderables().peek(); while (nextItem != null && nextItem is AbstractSurfaceObject) { AbstractSurfaceObject so = (AbstractSurfaceObject)nextItem; // Batch pick only within a single layer, and for objects which are enabled for batch picking. if (so.pickLayer != this.pickLayer || !so.isEnableBatchPicking()) { break; } dc.getOrderedSurfaceRenderables().poll(); // take it off the queue so.pickOrderedRenderable(dc, pickSupport); nextItem = dc.getOrderedSurfaceRenderables().peek(); } }