本文整理匯總了Java中java.awt.geom.Arc2D.PIE屬性的典型用法代碼示例。如果您正苦於以下問題:Java Arc2D.PIE屬性的具體用法?Java Arc2D.PIE怎麽用?Java Arc2D.PIE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類java.awt.geom.Arc2D
的用法示例。
在下文中一共展示了Arc2D.PIE屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: drawNeedle
/**
* Draws the needle.
*
* @param g2 the graphics device.
* @param plotArea the plot area.
* @param rotate the rotation point.
* @param angle the angle.
*/
protected void drawNeedle(Graphics2D g2, Rectangle2D plotArea,
Point2D rotate, double angle) {
Arc2D shape = new Arc2D.Double(Arc2D.PIE);
double radius = plotArea.getHeight();
double halfX = plotArea.getWidth() / 2;
double diameter = 2 * radius;
shape.setFrame(plotArea.getMinX() + halfX - radius ,
plotArea.getMinY() - radius,
diameter, diameter);
radius = Math.toDegrees(Math.asin(halfX / radius));
shape.setAngleStart(270 - radius);
shape.setAngleExtent(2 * radius);
Area s = new Area(shape);
if ((rotate != null) && (angle != 0)) {
/// we have rotation houston, please spin me
getTransform().setToRotation(angle, rotate.getX(), rotate.getY());
s.transform(getTransform());
}
defaultDisplay(g2, s);
}
示例2: drawStatus
public void drawStatus(int status, double probability, Graphics2D g2d, Color sc, Color pc, Color borderC, boolean bold) {
double x = 2.0 * (2.0 * STATUS_RAD + ELEMS_GAP) * status + START_GAP;
double y = panelH / 2.0 - STATUS_RAD;
double pie = probability * 360;
Color ctmp = g2d.getColor();
if (bold) {
g2d.setStroke(strokeB);
}
statusE[status] = new Ellipse2D.Double(x, y, STATUS_RAD * 2.0, STATUS_RAD * 2.0);
statusP[status] = new Arc2D.Double(x, y, STATUS_RAD * 2.0, STATUS_RAD * 2.0, 0.0, pie, Arc2D.PIE);
g2d.setPaint(sc);
g2d.fill(statusE[status]);
g2d.setPaint(pc);
g2d.fill(statusP[status]);
g2d.setPaint(borderC);
g2d.draw(statusE[status]);
drawCenteredText(probabilityToString(probability, 3), Color.BLACK, x + STATUS_RAD, y - STATUS_RAD, g2d, false);
drawCenteredText("" + status, borderC, x + STATUS_RAD, panelH / 2.0, g2d, false);
g2d.setColor(ctmp);
g2d.setStroke(stroke);
}
示例3: drawLastStatus
public void drawLastStatus(String jobStr, double probability, Graphics2D g2d, Color sc, Color pc) {
double x = 2.0 * (2.0 * STATUS_RAD + ELEMS_GAP) * (queueLength() - 1) + START_GAP;
double y = panelH / 2.0 - STATUS_RAD;
Color ctmp = g2d.getColor();
lastStatusE = new Ellipse2D.Double(x, y, STATUS_RAD * 2.0, STATUS_RAD * 2.0);
g2d.setPaint(sc);
g2d.fill(lastStatusE);
//if (queueMax != 0) {
double pie = probability * 360;
lastStatusP = new Arc2D.Double(x, y, STATUS_RAD * 2.0, STATUS_RAD * 2.0, 0.0, pie, Arc2D.PIE);
g2d.setPaint(pc);
g2d.fill(lastStatusP);
g2d.setPaint(Color.BLACK);
drawCenteredText(probabilityToString(probability, 3), Color.BLACK, x + STATUS_RAD, y - STATUS_RAD, g2d, false);
//drawCenteredText("" + queueMax, Color.BLACK, x + STATUS_RAD, panelH/2.0, g2d, false);
drawCenteredText(jobStr, Color.BLACK, x + STATUS_RAD, panelH / 2.0, g2d, false);
//}
g2d.setPaint(Color.BLACK);
g2d.draw(lastStatusE);
g2d.setColor(ctmp);
}
示例4: drawLastStatus
public void drawLastStatus(String jobStr, double probability, Graphics2D g2d, Color sc, Color pc) {
double x = 2.0 * (2.0 * STATUS_RAD + ELEMS_GAP) * (queueLenght() - 1) + START_GAP;
double y = panelH / 2.0 - STATUS_RAD;
Color ctmp = g2d.getColor();
lastStatusE = new Ellipse2D.Double(x, y, STATUS_RAD * 2.0, STATUS_RAD * 2.0);
g2d.setPaint(sc);
g2d.fill(lastStatusE);
//if(queueMax != 0){
double pie = probability * 360;
lastStatusP = new Arc2D.Double(x, y, STATUS_RAD * 2.0, STATUS_RAD * 2.0, 0.0, pie, Arc2D.PIE);
g2d.setPaint(pc);
g2d.fill(lastStatusP);
g2d.setPaint(Color.BLACK);
drawCenteredText(probabilityToString(probability, 3), Color.BLACK, x + STATUS_RAD, y - STATUS_RAD, g2d, false);
//drawCenteredText("" + queueMax, Color.BLACK, x + STATUS_RAD, panelH/2.0, g2d, false);
drawCenteredText(jobStr, Color.BLACK, x + STATUS_RAD, panelH / 2.0, g2d, false);
//}
g2d.setPaint(Color.BLACK);
g2d.draw(lastStatusE);
g2d.setColor(ctmp);
}
示例5: drawNeedle
/**
* Draws the needle.
*
* @param g2 the graphics device.
* @param plotArea the plot area.
* @param rotate the rotation point.
* @param angle the angle.
*/
protected void drawNeedle(Graphics2D g2, Rectangle2D plotArea, Point2D rotate, double angle) {
Arc2D shape = new Arc2D.Double(Arc2D.PIE);
double radius = plotArea.getHeight();
double halfX = plotArea.getWidth() / 2;
double diameter = 2 * radius;
shape.setFrame(plotArea.getMinX() + halfX - radius ,
plotArea.getMinY() - radius,
diameter, diameter);
radius = Math.toDegrees(Math.asin(halfX / radius));
shape.setAngleStart(270 - radius);
shape.setAngleExtent(2 * radius);
Area s = new Area(shape);
if ((rotate != null) && (angle != 0)) {
/// we have rotation houston, please spin me
getTransform().setToRotation(angle, rotate.getX(), rotate.getY());
s.transform(getTransform());
}
defaultDisplay(g2, s);
}
示例6: getDoorOrWindowSashShape
/**
* Returns the shape of a sash of a door or a window.
*/
private GeneralPath getDoorOrWindowSashShape(HomeDoorOrWindow doorOrWindow, Sash sash)
{
float modelMirroredSign = doorOrWindow.isModelMirrored() ? -1 : 1;
float xAxis = modelMirroredSign * sash.getXAxis() * doorOrWindow.getWidth();
float yAxis = sash.getYAxis() * doorOrWindow.getDepth();
float sashWidth = sash.getWidth() * doorOrWindow.getWidth();
float startAngle = (float) Math.toDegrees(sash.getStartAngle());
if (doorOrWindow.isModelMirrored())
{
startAngle = 180 - startAngle;
}
float extentAngle = modelMirroredSign * (float) Math.toDegrees(sash.getEndAngle() - sash.getStartAngle());
Arc2D arc = new Arc2D.Float(xAxis - sashWidth, yAxis - sashWidth, 2 * sashWidth, 2 * sashWidth, startAngle,
extentAngle, Arc2D.PIE);
AffineTransform transformation = AffineTransform.getTranslateInstance(doorOrWindow.getX(), doorOrWindow.getY());
transformation.rotate(doorOrWindow.getAngle());
transformation.translate(modelMirroredSign * -doorOrWindow.getWidth() / 2, -doorOrWindow.getDepth() / 2);
PathIterator it = arc.getPathIterator(transformation);
GeneralPath sashShape = new GeneralPath();
sashShape.append(it, false);
return sashShape;
}
示例7: drawTimerOnTrap
/**
* Draws a timer on a given trap.
*
* @param graphics
* @param trap The trap on which the timer needs to be drawn
* @param fill The fill color of the timer
* @param border The border color of the timer
* @param fillTimeLow The fill color of the timer when it is low
* @param borderTimeLow The border color of the timer when it is low
*/
private void drawTimerOnTrap(Graphics2D graphics, HunterTrap trap, Color fill, Color border, Color fillTimeLow, Color borderTimeLow)
{
net.runelite.api.Point loc = trap.getGameObject().getCanvasLocation();
//Construct the arc
Arc2D.Float arc = new Arc2D.Float(Arc2D.PIE);
arc.setAngleStart(90);
double timeLeft = 1 - trap.getTrapTimeRelative();
arc.setAngleExtent(timeLeft * 360);
arc.setFrame(loc.getX() - TIMER_SIZE / 2, loc.getY() - TIMER_SIZE / 2, TIMER_SIZE, TIMER_SIZE);
//Draw the inside of the arc
graphics.setColor(timeLeft > TIMER_LOW ? fill : fillTimeLow);
graphics.fill(arc);
//Draw the outlines of the arc
graphics.setStroke(new BasicStroke(TIMER_BORDER_WIDTH));
graphics.setColor(timeLeft > TIMER_LOW ? border : borderTimeLow);
graphics.drawOval(loc.getX() - TIMER_SIZE / 2, loc.getY() - TIMER_SIZE / 2, TIMER_SIZE, TIMER_SIZE);
}
示例8: getInstructions
@Override
public Transition2DInstruction[] getInstructions(float progress,
Dimension size) {
int multiplier2 = -1;
if(type==COUNTER_CLOCKWISE)
multiplier2 = 1;
//for a good time, don't make multiplier1 = 0
int multiplier1 = 0; //multiplier2;
int k = Math.max(size.width,size.height);
Area area = new Area(new Arc2D.Double(new Rectangle2D.Double(size.width/2-2*k,size.height/2-2*k,k*4,k*4),
90+multiplier1*progress*360, multiplier2*progress*360,Arc2D.PIE));
area.intersect(new Area(new Rectangle(0,0,size.width,size.height)));
return new ImageInstruction[] {
new ImageInstruction(true),
new ImageInstruction(false, null, area)
};
}
示例9: internalCalculateImpactArea
protected Shape internalCalculateImpactArea(final float angle) {
final int impact = this.getAttributes().getImpact().getCurrentValue();
final int impactAngle = this.getAttributes().getImpactAngle().getCurrentValue();
final double arcX = this.getOrigin().getX() - impact * 0.5;
final double arcY = this.getOrigin().getY() - impact * 0.5;
// project
final Point2D appliedRange = GeometricUtilities.project(new Point2D.Double(arcX, arcY), angle, this.getAttributes().getRange().getCurrentValue() * 0.5);
final double start = angle - 90;
if (impactAngle % 360 == 0) {
return new Ellipse2D.Double(appliedRange.getX(), appliedRange.getY(), impact, impact);
}
return new Arc2D.Double(appliedRange.getX(), appliedRange.getY(), impact, impact, start, impactAngle, Arc2D.PIE);
}
示例10: renderPortsBackground
/**
* Draws the given {@link Ports}.
*
* @param ports
* @param g2
*/
private void renderPortsBackground(final Ports<? extends Port> ports, final Graphics2D g2) {
boolean input = ports instanceof InputPorts;
g2.setStroke(LINE_STROKE);
for (Port port : ports.getAllPorts()) {
Point location = ProcessDrawUtils.createPortLocation(port, model);
// the first paint can come before any of the operator register listeners fire
// thus we need to check the location for null; subsequent calls will have a location
if (location == null) {
return;
}
double x = location.getX();
double y = location.getY();
Shape ellipseBoth;
int startAngle;
if (input) {
startAngle = 90;
ellipseBoth = new Arc2D.Double(new Rectangle2D.Double(x - PORT_SIZE_BACKGROUND / 2, y - PORT_SIZE_BACKGROUND
/ 2, PORT_SIZE_BACKGROUND, PORT_SIZE_BACKGROUND), startAngle, 180, Arc2D.PIE);
} else {
startAngle = 270;
ellipseBoth = new Arc2D.Double(new Rectangle2D.Double(x - PORT_SIZE_BACKGROUND / 2, y - PORT_SIZE_BACKGROUND
/ 2, PORT_SIZE_BACKGROUND, PORT_SIZE_BACKGROUND), startAngle, 180, Arc2D.PIE);
}
g2.setColor(Color.WHITE);
g2.fill(ellipseBoth);
}
}
示例11: fillArc
/**
* Fills an arc on the dial between the given values.
*
* @param g2 the graphics device.
* @param area the plot area.
* @param minValue the minimum data value.
* @param maxValue the maximum data value.
* @param paint the background paint (<code>null</code> not permitted).
* @param dial a flag that indicates whether the arc represents the whole
* dial.
*/
protected void fillArc(Graphics2D g2, Rectangle2D area,
double minValue, double maxValue, Paint paint, boolean dial) {
ParamChecks.nullNotPermitted(paint, "paint");
double startAngle = valueToAngle(maxValue);
double endAngle = valueToAngle(minValue);
double extent = endAngle - startAngle;
double x = area.getX();
double y = area.getY();
double w = area.getWidth();
double h = area.getHeight();
int joinType = Arc2D.OPEN;
if (this.shape == DialShape.PIE) {
joinType = Arc2D.PIE;
}
else if (this.shape == DialShape.CHORD) {
if (dial && this.meterAngle > 180) {
joinType = Arc2D.CHORD;
}
else {
joinType = Arc2D.PIE;
}
}
else if (this.shape == DialShape.CIRCLE) {
joinType = Arc2D.PIE;
if (dial) {
extent = 360;
}
}
else {
throw new IllegalStateException("DialShape not recognised.");
}
g2.setPaint(paint);
Arc2D.Double arc = new Arc2D.Double(x, y, w, h, startAngle, extent,
joinType);
g2.fill(arc);
}
示例12: drawNeedle
/**
* Draws the needle.
*
* @param g2 the graphics device.
* @param plotArea the plot area.
* @param rotate the rotation point.
* @param angle the angle.
*/
@Override
protected void drawNeedle(Graphics2D g2, Rectangle2D plotArea,
Point2D rotate, double angle) {
Arc2D shape = new Arc2D.Double(Arc2D.PIE);
double radius = plotArea.getHeight();
double halfX = plotArea.getWidth() / 2;
double diameter = 2 * radius;
shape.setFrame(plotArea.getMinX() + halfX - radius ,
plotArea.getMinY() - radius,
diameter, diameter);
radius = Math.toDegrees(Math.asin(halfX / radius));
shape.setAngleStart(270 - radius);
shape.setAngleExtent(2 * radius);
Area s = new Area(shape);
if ((rotate != null) && (angle != 0)) {
/// we have rotation houston, please spin me
getTransform().setToRotation(angle, rotate.getX(), rotate.getY());
s.transform(getTransform());
}
defaultDisplay(g2, s);
}
示例13: fillArc
/**
* Fills an arc on the dial between the given values.
*
* @param g2 the graphics device.
* @param area the plot area.
* @param minValue the minimum data value.
* @param maxValue the maximum data value.
* @param paint the background paint ({@code null} not permitted).
* @param dial a flag that indicates whether the arc represents the whole
* dial.
*/
protected void fillArc(Graphics2D g2, Rectangle2D area,
double minValue, double maxValue, Paint paint, boolean dial) {
Args.nullNotPermitted(paint, "paint");
double startAngle = valueToAngle(maxValue);
double endAngle = valueToAngle(minValue);
double extent = endAngle - startAngle;
double x = area.getX();
double y = area.getY();
double w = area.getWidth();
double h = area.getHeight();
int joinType = Arc2D.OPEN;
if (this.shape == DialShape.PIE) {
joinType = Arc2D.PIE;
}
else if (this.shape == DialShape.CHORD) {
if (dial && this.meterAngle > 180) {
joinType = Arc2D.CHORD;
}
else {
joinType = Arc2D.PIE;
}
}
else if (this.shape == DialShape.CIRCLE) {
joinType = Arc2D.PIE;
if (dial) {
extent = 360;
}
}
else {
throw new IllegalStateException("DialShape not recognised.");
}
g2.setPaint(paint);
Arc2D.Double arc = new Arc2D.Double(x, y, w, h, startAngle, extent,
joinType);
g2.fill(arc);
}
示例14: drawNeedle
/**
* Draws the needle.
*
* @param g2 the graphics device.
* @param plotArea the plot area.
* @param rotate the rotation point.
* @param angle the angle.
*/
@Override
protected void drawNeedle(Graphics2D g2, Rectangle2D plotArea,
Point2D rotate, double angle) {
Arc2D shape = new Arc2D.Double(Arc2D.PIE);
double radius = plotArea.getHeight();
double halfX = plotArea.getWidth() / 2;
double diameter = 2 * radius;
shape.setFrame(plotArea.getMinX() + halfX - radius,
plotArea.getMinY() - radius,
diameter, diameter);
radius = Math.toDegrees(Math.asin(halfX / radius));
shape.setAngleStart(270 - radius);
shape.setAngleExtent(2 * radius);
Area s = new Area(shape);
if ((rotate != null) && (angle != 0)) {
/// we have rotation houston, please spin me
getTransform().setToRotation(angle, rotate.getX(), rotate.getY());
s.transform(getTransform());
}
defaultDisplay(g2, s);
}
示例15: f
@Override public Shape f( final Slice slice ) {
double epsilon = 1E-6;
Vector2D tip = slice.position;
double angle = slice.angle;
final Ellipse2D.Double boundingEllipse = new Ellipse2D.Double( tip.x - radius, tip.y - radius, radius * 2, radius * 2 - radius * 0.65 );
//Special case for half-pies since they should be vertical instead of horizontal (like pies)
if ( Math.abs( extent - Math.PI ) < epsilon ) {
angle = angle + Math.PI / 2;
}
return extent >= Math.PI * 2 - epsilon ?
boundingEllipse :
new Arc2D.Double( boundingEllipse.x, boundingEllipse.y, boundingEllipse.width, boundingEllipse.height, angle * 180.0 / Math.PI, extent * 180.0 / Math.PI, Arc2D.PIE );
}