本文整理汇总了Java中java.awt.geom.Ellipse2D.Double方法的典型用法代码示例。如果您正苦于以下问题:Java Ellipse2D.Double方法的具体用法?Java Ellipse2D.Double怎么用?Java Ellipse2D.Double使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.geom.Ellipse2D
的用法示例。
在下文中一共展示了Ellipse2D.Double方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawMultipleEllipse
import java.awt.geom.Ellipse2D; //导入方法依赖的package包/类
/**
* Draws two ellipses to represent overlapping outliers.
*
* @param point the location.
* @param boxWidth the box width.
* @param oRadius the radius.
* @param g2 the graphics device.
*/
protected void drawMultipleEllipse(Point2D point, double boxWidth,
double oRadius, Graphics2D g2) {
Ellipse2D.Double dot1 = new Ellipse2D.Double(point.getX()
- (boxWidth / 2) + oRadius, point.getY(), oRadius, oRadius);
Ellipse2D.Double dot2 = new Ellipse2D.Double(point.getX()
+ (boxWidth / 2), point.getY(), oRadius, oRadius);
g2.draw(dot1);
g2.draw(dot2);
}
示例2: CompassPlot
import java.awt.geom.Ellipse2D; //导入方法依赖的package包/类
/**
* Constructs a new compass plot.
*
* @param dataset the dataset for the plot.
*/
public CompassPlot(ValueDataset dataset) {
super();
if (dataset != null) {
this.datasets[0] = dataset;
dataset.addChangeListener(this);
}
this.circle1 = new Ellipse2D.Double();
this.circle2 = new Ellipse2D.Double();
this.rect1 = new Rectangle2D.Double();
setSeriesNeedle(0);
}
示例3: drawStatus
import java.awt.geom.Ellipse2D; //导入方法依赖的package包/类
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);
}
示例4: setLocation
import java.awt.geom.Ellipse2D; //导入方法依赖的package包/类
@Override
public void setLocation(final Point2D location) {
super.setLocation(location);
switch (this.getLightShapeType()) {
case LightSource.ELLIPSE:
this.lightShape = new Ellipse2D.Double(location.getX(), location.getY(), this.getWidth(), this.getHeight());
break;
case LightSource.RECTANGLE:
this.lightShape = new Rectangle2D.Double(location.getX(), location.getY(), this.getWidth(), this.getHeight());
break;
default:
this.lightShape = new Ellipse2D.Double(location.getX(), location.getY(), this.getWidth(), this.getHeight());
break;
}
}
示例5: calculatePotentialImpactArea
import java.awt.geom.Ellipse2D; //导入方法依赖的package包/类
public Ellipse2D calculatePotentialImpactArea() {
final int range = this.getAttributes().getImpact().getCurrentValue();
final double arcX = this.getExecutor().getCollisionBox().getCenterX() - range * 0.5;
final double arcY = this.getExecutor().getCollisionBox().getCenterY() - range * 0.5;
return new Ellipse2D.Double(arcX, arcY, range, range);
}
示例6: drawOccupiedPercentage
import java.awt.geom.Ellipse2D; //导入方法依赖的package包/类
private void drawOccupiedPercentage(Color startC, Color border, boolean gradientFill, Graphics2D g2d) {
if (remainingTime[0] != 0) {
double x = getProcessorXY().x, y = getProcessorXY().y;
occupiedRect = new Rectangle2D.Double(x, y, 2 * PROC_RAD, 2 * PROC_RAD * (1 - (double) remainingTime[0] / (double) totTime[0]));
occupiedEll = new Ellipse2D.Double(x, y, 2 * PROC_RAD, 2 * PROC_RAD);
if (gradientFill) {
GradientPaint gp = new GradientPaint((float) x, (float) y, startC.brighter(), (float) x, (float) (y + 2 * PROC_RAD), startC.darker(),
false);
g2d.setPaint(gp);
} else {
g2d.setPaint(startC);
}
occupiedArea = new Area(occupiedEll);
occupiedArea.subtract(new Area(occupiedRect));
g2d.fill(occupiedArea);
g2d.setPaint(Color.BLACK);
g2d.draw(occupiedArea);
// draw orizontal line parallel to occupation
Line2D.Double l = new Line2D.Double(x + PROC_RAD * 2 + ELEMS_GAP, y + PROC_RAD * 2
* (1 - (double) remainingTime[0] / (double) totTime[0]), x + PROC_RAD * 2 + 2 * ELEMS_GAP, y + PROC_RAD * 2
* (1 - (double) remainingTime[0] / (double) totTime[0]));
g2d.draw(l);
// draw vertical line
l = new Line2D.Double(x + PROC_RAD * 2 + 2 * ELEMS_GAP, y + PROC_RAD * 2 * (1 - (double) remainingTime[0] / (double) totTime[0]), x
+ PROC_RAD * 2 + 2 * ELEMS_GAP, y + 2 * PROC_RAD + 4 * ELEMS_GAP - txtBounds.getHeight() / 2);
g2d.draw(l);
// draw horizontal line under text
txtBounds.setFrame(x + PROC_RAD - txtBounds.getWidth() / 2, y + 2 * PROC_RAD + 4 * ELEMS_GAP - txtBounds.getHeight() / 2, txtBounds
.getWidth(), txtBounds.getHeight());
g2d.draw(txtBounds);
}
}
示例7: drawRadialGridLines
import java.awt.geom.Ellipse2D; //导入方法依赖的package包/类
/**
* Draw the radial gridlines - the rings.
*
* @param g2 the drawing surface.
* @param plot the plot.
* @param radialAxis the radial axis.
* @param ticks the ticks.
* @param dataArea the data area.
*/
public void drawRadialGridLines(Graphics2D g2,
PolarPlot plot,
ValueAxis radialAxis,
List ticks,
Rectangle2D dataArea) {
g2.setFont(radialAxis.getTickLabelFont());
g2.setPaint(plot.getRadiusGridlinePaint());
g2.setStroke(plot.getRadiusGridlineStroke());
double axisMin = radialAxis.getLowerBound();
Point center = plot.translateValueThetaRadiusToJava2D(axisMin, axisMin,
dataArea);
Iterator iterator = ticks.iterator();
while (iterator.hasNext()) {
NumberTick tick = (NumberTick) iterator.next();
Point p = plot.translateValueThetaRadiusToJava2D(90.0,
tick.getNumber().doubleValue(), dataArea);
int r = p.x - center.x;
int upperLeftX = center.x - r;
int upperLeftY = center.y - r;
int d = 2 * r;
Ellipse2D ring = new Ellipse2D.Double(upperLeftX, upperLeftY, d, d);
g2.setPaint(plot.getRadiusGridlinePaint());
g2.draw(ring);
}
}
示例8: drawUtilization2
import java.awt.geom.Ellipse2D; //导入方法依赖的package包/类
private void drawUtilization2(double U, Color startC, Color border, boolean gradientFill, Graphics2D g2d, int cpu) {
double x = getProcessorXY().x, y = getProcessorXY().y;
try {
occupiedRect = new Rectangle2D.Double(x + PROC_RAD / 2, y + cpu * PROC_RAD + ELEMS_GAP * cpu - ELEMS_GAP / 2, 2 * PROC_RAD / 2, PROC_RAD
* (1 - U / nCpu));
} catch (Exception e) {
occupiedRect = new Rectangle2D.Double(x + PROC_RAD / 2, y + cpu * PROC_RAD + ELEMS_GAP * cpu - ELEMS_GAP / 2, 2 * PROC_RAD / 2, 0.0);
}
occupiedEll = new Ellipse2D.Double(x + PROC_RAD / 2, y + cpu * PROC_RAD + ELEMS_GAP * cpu - ELEMS_GAP / 2, 2 * PROC_RAD / 2, 2 * PROC_RAD / 2);
if (gradientFill) {
GradientPaint gp = new GradientPaint((float) x, (float) y, startC.brighter(), (float) x, (float) (y + 2 * PROC_RAD), startC.darker(),
false);
g2d.setPaint(gp);
} else {
g2d.setPaint(startC);
}
occupiedArea = new Area(occupiedEll);
occupiedArea.subtract(new Area(occupiedRect));
g2d.fill(occupiedArea);
g2d.setPaint(Color.BLACK);
g2d.draw(occupiedArea);
// //draw informations about processes
// txtBounds = drawCenteredText("job n.:" + donejobs, Color.BLACK, x +
// PROC_RAD,y + PROC_RAD * 2 + 4 * ELEMS_GAP,g2d, false);
// //draw orizontal line parallel to occupation
//
// //draw box around text
// txtBounds.setFrame(
// x + PROC_RAD - txtBounds.getWidth() / 2,
// y + 2 * PROC_RAD + 4 * ELEMS_GAP - txtBounds.getHeight() / 2,
// txtBounds.getWidth(),
// txtBounds.getHeight());
//
// g2d.draw(txtBounds);
}
示例9: draw
import java.awt.geom.Ellipse2D; //导入方法依赖的package包/类
@Override
public void draw(Graphics2D graphics) {
double[] radii = {.8 * radius, .5 * radius, .2 * radius};
Color color = new Color(1f, 0f, 0f, 1f);
graphics.setColor(color);
graphics.setStroke(new BasicStroke((float)(radius/6), BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
Ellipse2D.Double circle = null;
for (double drawRadius : radii) {
circle = new Ellipse2D.Double(currentPosition.getX() - drawRadius,
currentPosition.getY() - drawRadius, 2 * drawRadius, 2 * drawRadius);
graphics.draw(circle);
}
graphics.fill(circle);
Line2D.Double line = new Line2D.Double(
currentPosition.getX() - radius,
currentPosition.getY(),
currentPosition.getX() + radius,
currentPosition.getY());
graphics.setStroke(JSpaceSettlersComponent.THIN_STROKE);
graphics.draw(line);
line = new Line2D.Double(
currentPosition.getX(),
currentPosition.getY() - radius,
currentPosition.getX(),
currentPosition.getY() + radius);
graphics.draw(line);
}
示例10: setBounds
import java.awt.geom.Ellipse2D; //导入方法依赖的package包/类
/**
* ���ñ߽磬�ڴ˷��������¼���뾶������Ȳ���
* @see java.awt.Component.setBounds(int, int, int, int)
*/
@Override
public void setBounds(int x, int y, int width, int height){
region = new Ellipse2D.Double(x, y, width, height);
radius = (width > height) ? width/2 : height/2;
super.setBounds(x, y, width, height);
}
示例11: updateQueueSettings
import java.awt.geom.Ellipse2D; //导入方法依赖的package包/类
private void updateQueueSettings() {
//queue is initializing
statusE = new Ellipse2D.Double[queueLength() + 1];
statusP = new Arc2D.Double[queueLength() + 1];
arc = new QuadCurve2D.Double[queueLength() + 3][queueLength() + 3];
}
示例12: draw
import java.awt.geom.Ellipse2D; //导入方法依赖的package包/类
@Override
public void draw(Graphics2D graphics) {
float radius = Base.BASE_RADIUS;
float diameter = Base.BASE_RADIUS * 2;
// change the base's transparency based upon the energy level
int alpha = (int) (((float) base.getEnergy() / base.getMaxEnergy()) * 255.0);
Color energyColor = new Color(teamColor.getRed(), teamColor.getGreen(), teamColor.getBlue(), alpha);
graphics.setColor(energyColor);
graphics.fillOval((int)(drawLocation.getX() - radius), (int)(drawLocation.getY() - radius),
(int)diameter, (int)diameter);
// draw an outline around the base (in case its healing energy goes to 0)
final Ellipse2D.Double shape = new Ellipse2D.Double(drawLocation.getX() - radius,
drawLocation.getY() - radius, diameter, diameter);
graphics.setStroke(JSpaceSettlersComponent.STROKE);
Color outlineColor = new Color(teamColor.getRed(), teamColor.getGreen(), teamColor.getBlue());
graphics.setColor(outlineColor);
graphics.draw(shape);
// if the base is shielded, put a white circle around the outside
if (base.isShielded()) {
double shieldRadius = radius + 8;
final Ellipse2D.Double shieldShape = new Ellipse2D.Double(drawLocation.getX() - shieldRadius,
drawLocation.getY() - shieldRadius, 2 * shieldRadius, 2 * shieldRadius);
graphics.setStroke(JSpaceSettlersComponent.THIN_STROKE);
graphics.setColor(BASE_SHIELD_COLOR);
graphics.draw(shieldShape);
}
// show the healing energy level of the base
final Font font = new Font("Arial", Font.BOLD, 12);
graphics.setFont(font);
String number = Integer.toString(base.getHealingEnergy());
graphics.setPaint(JSpaceSettlersComponent.TEXT_COLOR);
graphics.drawString(number, (int) drawLocation.getX() + 12, (int) drawLocation.getY() + 12);
// show the resourcesAvailable collected by the team at this base
//number = Integer.toString(base.getMoney());
//graphics.setPaint(JSpaceSettlersComponent.TEXT_COLOR);
//graphics.drawString(number, (int) drawLocation.getX() + 12, (int) drawLocation.getY() - 12);
// if it is a home base, put a H inside it
if (base.isHomeBase()) {
graphics.setPaint(Color.BLACK);
graphics.drawString("H", (int) drawLocation.getX()-4, (int) drawLocation.getY() + 4);
}
}
示例13: animateTransition3
import java.awt.geom.Ellipse2D; //导入方法依赖的package包/类
private void animateTransition3(int from, int to, boolean bold, Graphics2D g2d, Color b, Color f) {
Color oldc = g2d.getColor();
g2d.setColor(f);
//arrow = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
double gap, x1, x2, y, ctrlx, ctrly;
if (bold) {
g2d.setStroke(strokeB);
}
if (from > to) {
x2 = to * (4 * STATUS_RAD + 2 * ELEMS_GAP) + START_GAP + STATUS_RAD * 2;//+ ELEMS_GAP;
x1 = from * (4 * STATUS_RAD + 2 * ELEMS_GAP) + START_GAP;// - ELEMS_GAP;
y = (panelH) / 2.0 + STATUS_RAD;
ctrly = y + STATUS_RAD;
gap = ELEMS_GAP;
} else {
x1 = from * (4 * STATUS_RAD + 2 * ELEMS_GAP) + START_GAP + STATUS_RAD * 2;//+ ELEMS_GAP;
x2 = to * (4 * STATUS_RAD + 2 * ELEMS_GAP) + START_GAP;// - ELEMS_GAP;
y = (panelH) / 2.0 - STATUS_RAD;
ctrly = y - STATUS_RAD / 2.0;
gap = 2 * ELEMS_GAP;
}
ctrlx = (x1 + x2) / 2;
QuadCurve2D prova;
switch (frame) {
case 1:
prova = new QuadCurve2D.Double(x1, y, ctrlx, ctrly, x2, y);
prova.subdivide(prova, null);
prova.subdivide(prova, null);
break;
case 2:
prova = new QuadCurve2D.Double(x1, y, ctrlx, ctrly, x2, y);
prova.subdivide(prova, null);
break;
case 3:
prova = new QuadCurve2D.Double(x1, y, ctrlx, ctrly, x2, y);
prova.subdivide(null, prova);
prova.subdivide(null, prova);
break;
default:
prova = new QuadCurve2D.Double(x1, y, ctrlx, ctrly, x2, y);
prova.subdivide(prova, null);
break;
}
Point2D p = prova.getP2();
transitionE = new Ellipse2D.Double(p.getX() - ELEMS_GAP, p.getY() - gap, 2 * ELEMS_GAP, 2 * ELEMS_GAP);
g2d.fill(transitionE);
g2d.setPaint(b);
g2d.draw(transitionE);
g2d.setColor(oldc);
g2d.setStroke(stroke);
}
示例14: getErectedEllipse2D
import java.awt.geom.Ellipse2D; //导入方法依赖的package包/类
public Ellipse2D.Double getErectedEllipse2D() {
return new Ellipse2D.Double(x - major, y - minor, major * 2, minor * 2);
}
示例15: paintNodes
import java.awt.geom.Ellipse2D; //导入方法依赖的package包/类
private void paintNodes(Graphics2D g, int height) {
for (Map.Entry<Integer, List<Node>> entry : layers.entrySet()) {
int layerIndex = entry.getKey();
List<Node> layer = entry.getValue();
int nodes = layer.size();
if (layerIndex < layers.size() - 1) {
nodes++;
}
String layerName = null;
if (layerIndex == 0) {
layerName = "Input";
} else if (layerIndex == layers.size() - 1) {
layerName = "Output";
} else {
layerName = "Hidden " + layerIndex;
}
Rectangle2D stringBounds = LABEL_FONT.getStringBounds(layerName, g.getFontRenderContext());
g.setColor(Color.BLACK);
g.drawString(layerName, (int) (((-1) * stringBounds.getWidth() / 2) + NODE_RADIUS / 2), 0);
int yPos = (height / 2) - (nodes * ROW_HEIGHT / 2);
for (int r = 0; r < nodes; r++) {
Shape node = new Ellipse2D.Double(0, yPos, NODE_RADIUS, NODE_RADIUS);
if ((layerIndex == 0) || (layerIndex == layers.size() - 1)) {
if ((r < nodes - 1) || (layerIndex == layers.size() - 1)) {
g.setPaint(SwingTools.makeYellowPaint(NODE_RADIUS, NODE_RADIUS));
} else {
g.setPaint(new Color(233, 233, 233));
}
} else {
if (r < nodes - 1) {
g.setPaint(SwingTools.makeBluePaint(NODE_RADIUS, NODE_RADIUS));
} else {
g.setPaint(new Color(233, 233, 233));
}
}
g.fill(node);
if ((layerIndex == this.selectedLayerIndex) && (r == this.selectedRowIndex)) {
g.setColor(Color.RED);
} else {
g.setColor(Color.BLACK);
}
g.draw(node);
yPos += ROW_HEIGHT;
}
g.translate(LAYER_WIDTH, 0);
layerIndex++;
}
}