@Override public Shape createStrokedShape(Shape p) { Shape p2; if (diamond) { Polygon2D p1 = new Polygon2D(); p1.addPoint( (float) p.getBounds2D().getX() + 0, (float) p.getBounds2D().getY() - size / 2.0f); p1.addPoint((float) p.getBounds2D().getX() + size / 2.0f, (float) p.getBounds2D().getY()); p1.addPoint((float) p.getBounds2D().getX(), (float) p.getBounds2D().getY() + size / 2.0f); p1.addPoint((float) p.getBounds2D().getX() - size / 2.0f, (float) p.getBounds2D().getY()); // p1.translate((int) p.getBounds2D().getX(), (int) p.getBounds2D().getY()); p2 = p1; } else { p2 = new Ellipse2D.Float( (float) p.getBounds2D().getX() - size / 2.0f, (float) p.getBounds2D().getY() - size / 2.0f, size, size); } return p2; }
/* (non-Javadoc) * @see gui.graphics.DrawableObject#draw(java.awt.Graphics2D, gui.Translation) */ @Override public void draw(Graphics2D g2, Translation translator) { Color internalAreaColor; Polygon2D surroundingPoly; double[] tmp; double[] point; this.dataObjectsTemplate.drawAtAll( g2, this.scheme, translator.translate(this.projection.projectIndexed(this.dataObjects, null), null)); if (this.drawInternalArea) { internalAreaColor = new Color( this.scheme.getColor(this.colorIndex).getRed(), this.scheme.getColor(this.colorIndex).getGreen(), this.scheme.getColor(this.colorIndex).getBlue(), this.internalAreaAlpha); tmp = new double[2]; if (this.convexHull.size() > 1) { surroundingPoly = new Polygon2D(); for (double[] p : this.convexHull) { point = translator.translate(this.projection.project(p, tmp)); surroundingPoly.addPoint((float) point[0], (float) point[1]); // System.out.println(Arrays.toString(point)); } g2.setStroke(this.scheme.getStroke(this.convexHullStrokeIndex)); g2.setColor(internalAreaColor); g2.fill(surroundingPoly); g2.setColor(this.scheme.getColor(this.colorIndex)); g2.draw(surroundingPoly); } } }