public void pick(DrawContext dc, java.awt.Point pickPoint) { OGLStackHandler stackHandler = new OGLStackHandler(); BasicAnnotationRenderer.this.pickSupport.clearPickList(); BasicAnnotationRenderer.this.beginDrawAnnotations(dc, stackHandler); try { this.annotation.setPickSupport(BasicAnnotationRenderer.this.pickSupport); this.doRender(dc, this); // Draw as many as we can in a batch to save ogl state switching. while (dc.peekOrderedRenderables() is OrderedAnnotation) { OrderedAnnotation oa = (OrderedAnnotation)dc.pollOrderedRenderables(); oa.annotation.setPickSupport(BasicAnnotationRenderer.this.pickSupport); this.doRender(dc, oa); } } catch (WWRuntimeException e) { Logging.logger().log(Level.SEVERE, "generic.ExceptionWhilePickingAnnotation", e); } catch (Exception e) { Logging.logger().log(Level.SEVERE, "generic.ExceptionWhilePickingAnnotation", e); } finally { BasicAnnotationRenderer.this.endDrawAnnotations(dc, stackHandler); BasicAnnotationRenderer.this.pickSupport.resolvePick(dc, pickPoint, this.layer); BasicAnnotationRenderer.this.pickSupport.clearPickList(); // to ensure entries can be garbage collected } }
public void render(DrawContext dc) { OGLStackHandler stackHandler = new OGLStackHandler(); BasicAnnotationRenderer.this.beginDrawAnnotations(dc, stackHandler); try { this.doRender(dc, this); // Draw as many as we can in a batch to save ogl state switching. while (dc.peekOrderedRenderables() is OrderedAnnotation) { OrderedAnnotation oa = (OrderedAnnotation)dc.pollOrderedRenderables(); this.doRender(dc, oa); } } catch (WWRuntimeException e) { Logging.logger().log(Level.SEVERE, "generic.ExceptionWhileRenderingAnnotation", e); } catch (Exception e) { Logging.logger().log(Level.SEVERE, "generic.ExceptionWhileRenderingAnnotation", e); } finally { BasicAnnotationRenderer.this.endDrawAnnotations(dc, stackHandler); } }
protected void doRender(DrawContext dc, OrderedAnnotation oa) { // Swap the draw context's current layer with that of the ordered annotation Layer previousCurrentLayer = dc.getCurrentLayer(); try { dc.setCurrentLayer(oa.layer); oa.annotation.renderNow(dc); } finally { dc.setCurrentLayer(previousCurrentLayer); // restore the original layer } }