/** {@inheritDoc} */ protected void applyDelegateOwner(Object owner) { if (this.rings == null) return; for (SurfaceCircle ring : this.rings) { ring.setDelegateOwner(owner); } }
/** {@inheritDoc} */ public void preRender(DrawContext dc) { if (!this.isVisible()) { return; } if (this.rings == null) { this.createShapes(dc); } this.determineActiveAttributes(); for (SurfaceCircle ring : this.rings) { ring.preRender(dc); } }
/** {@inheritDoc} */ @Override protected void determineLabelPositions(DrawContext dc) { Position center = this.getReferencePosition(); if (center == null) return; // Position the labels along a line radiating out from the center of the circle. The angle (60 // degrees) is // chosen to match the graphic template defined by MIL-STD-2525C, pg. 613. double globeRadius = dc.getGlobe().getRadius(); Angle labelAngle = this.getLabelAngle(); int i = 0; for (SurfaceCircle ring : this.rings) { double radius = ring.getRadius(); LatLon ll = LatLon.greatCircleEndPosition(center, labelAngle.radians, radius / globeRadius); this.labels.get(i).setPosition(new Position(ll, 0)); i += 1; } }
/** * Create the circles used to draw this graphic. * * @param dc Current draw context. */ protected void createShapes(DrawContext dc) { if (this.positions == null) return; this.rings = new ArrayList<SurfaceCircle>(); Iterator<? extends Position> iterator = this.positions.iterator(); Position center = iterator.next(); double globeRadius = dc.getGlobe().getRadius(); while (iterator.hasNext()) { SurfaceCircle ring = this.createCircle(); ring.setCenter(center); Position pos = iterator.next(); Angle radius = LatLon.greatCircleDistance(center, pos); double radiusMeters = radius.radians * globeRadius; ring.setRadius(radiusMeters); this.rings.add(ring); } }
/** * Create a circle for a range ring. * * @return New circle. */ protected SurfaceCircle createCircle() { SurfaceCircle circle = new SurfaceCircle(); circle.setDelegateOwner(this.getActiveDelegateOwner()); circle.setAttributes(this.getActiveShapeAttributes()); return circle; }
/** * Render the polygon. * * @param dc Current draw context. */ protected void doRenderGraphic(DrawContext dc) { for (SurfaceCircle ring : this.rings) { ring.render(dc); } }