List of usage examples for java.awt.geom Arc2D getPathIterator
public PathIterator getPathIterator(AffineTransform at)
From source file:Main.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; int w = getSize().width; int h = getSize().height; Arc2D arc = new Arc2D.Double(0.0, 0.5, w, h, 0.0, 60.0, Arc2D.CHORD); System.out.println(arc.getPathIterator(AffineTransform.getQuadrantRotateInstance(5))); g2.draw(arc);/* w w w .ja v a 2 s. co m*/ arc = new Arc2D.Float(0.0f, 0.0f, w, h, 80.0f, 110.0f, Arc2D.PIE); g2.fill(arc); arc = new Arc2D.Float(0.0f, 0.0f, w, h, 210.0f, 130.0f, Arc2D.OPEN); g2.draw(arc); }
From source file:org.amanzi.awe.render.network.NetworkRenderer.java
/** * render sector element on map//w w w .jav a 2 s.co m * * @param destination * @param point * @param element */ private void renderSector(final Graphics2D destination, final Point point, final double azimuth, final double beamwidth, final IDataElement sector) { int size = getSize(); int x = getSectorXCoordinate(point, size); int y = getSectorYCoordinate(point, size); destination.setColor(networkRendererStyle.changeColor(getColor(sector), networkRendererStyle.getAlpha())); GeneralPath path = new GeneralPath(); path.moveTo(x, y); Arc2D a = createSector(point, networkRendererStyle.getLargeElementSize(), getAngle(azimuth, beamwidth), beamwidth); path.append(a.getPathIterator(null), true); path.closePath(); destination.draw(path); destination.fill(path); // create border destination.setColor(networkRendererStyle.getBorderColor()); destination.draw(path); }
From source file:org.amanzi.awe.render.network.NetworkRenderer.java
/** * Draw black border around selected sector * /*from w w w.j a v a 2s. com*/ * @param destination * @param point * @param model * @param sector */ private void renderSelectionBorder(Graphics2D destination, Point point, ISectorElement sector, int index, int count) { Pair<Double, Double> sectorParameters = getSectorParameters(sector, index, count); int size = getSize(); double azimuth = sectorParameters.getLeft(); double beamwidth = sectorParameters.getRight(); GeneralPath path = new GeneralPath(); path.moveTo(getSectorXCoordinate(point, size), getSectorYCoordinate(point, size)); Arc2D a = createSector(point, networkRendererStyle.getLargeElementSize(), getAngle(azimuth, beamwidth), beamwidth); path.append(a.getPathIterator(null), true); path.closePath(); destination .setColor(networkRendererStyle.changeColor(SELECTED_SECTOR_COLOR, networkRendererStyle.getAlpha())); destination.draw(path); destination.drawString(sector.getName(), (int) a.getEndPoint().getX() + 10, (int) a.getEndPoint().getY()); }