com.mxgraph.shape.mxCylinderShape Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of AptSpringProcessor Show documentation
Show all versions of AptSpringProcessor Show documentation
This project contains the apt processor that implements all the checks enumerated in @Verify. It is a self contained, and
shaded jar.
The newest version!
package com.mxgraph.shape;
import java.awt.Rectangle;
import java.awt.geom.Area;
import java.awt.geom.Ellipse2D;
import com.mxgraph.canvas.mxGraphics2DCanvas;
import com.mxgraph.view.mxCellState;
public class mxCylinderShape extends mxBasicShape
{
/**
* Draws a cylinder for the given parameters.
*/
public void paintShape(mxGraphics2DCanvas canvas, mxCellState state)
{
Rectangle rect = state.getRectangle();
int x = rect.x;
int y = rect.y;
int w = rect.width;
int h = rect.height;
int h4 = h / 4;
int h2 = h4 / 2;
int r = w;
// Paints the background
if (configureGraphics(canvas, state, true))
{
Area area = new Area(new Rectangle(x, y + h4 / 2, r, h - h4));
area.add(new Area(new Rectangle(x, y + h4 / 2, r, h - h4)));
area.add(new Area(new Ellipse2D.Float(x, y, r, h4)));
area.add(new Area(new Ellipse2D.Float(x, y + h - h4, r, h4)));
canvas.fillShape(area, hasShadow(canvas, state));
}
// Paints the foreground
if (configureGraphics(canvas, state, false))
{
canvas.getGraphics().drawOval(x, y, r, h4);
canvas.getGraphics().drawLine(x, y + h2, x, y + h - h2);
canvas.getGraphics().drawLine(x + w, y + h2, x + w, y + h - h2);
// TODO: Use QuadCurve2D.Float() for painting the arc
canvas.getGraphics().drawArc(x, y + h - h4, r, h4, 0, -180);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy