@Override public void paint(Graphics2D g, StateRenderer2D renderer) { if ((System.currentTimeMillis() - lastStateMillis) > 2000) return; Point2D pt = renderer.getScreenPosition(simulatedState.getPosition()); g.translate(pt.getX(), pt.getY()); g.rotate(-renderer.getRotation() + simulatedState.getYaw() + Math.PI); g.setStroke(new BasicStroke(2f)); g.setColor(Color.cyan.darker().darker()); g.draw(path); g.setColor(Color.cyan.brighter().brighter()); g.fill(path); g.drawString("S", -4, -4); }
@Override public void paint(Graphics2D g, StateRenderer2D renderer, double rotation) { Point2D pt = renderer.getScreenPosition(getCenterLocation()); g.translate(pt.getX(), pt.getY()); g.rotate(getYawRad() - renderer.getRotation()); double widthScaled = width * renderer.getZoom(); double lengthScaled = length * renderer.getZoom(); Rectangle2D.Double tmp = new Rectangle2D.Double(-widthScaled / 2, -lengthScaled / 2, widthScaled, lengthScaled); if (isSelected()) g.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue())); else g.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), 100)); if (isFilled()) g.fill(tmp); g.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue())); g.draw(tmp); }