本文整理匯總了Java中java.awt.geom.Arc2D.OPEN屬性的典型用法代碼示例。如果您正苦於以下問題:Java Arc2D.OPEN屬性的具體用法?Java Arc2D.OPEN怎麽用?Java Arc2D.OPEN使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類java.awt.geom.Arc2D
的用法示例。
在下文中一共展示了Arc2D.OPEN屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getArcBounds
/**
* Returns a rectangle that can be used to create a pie section (taking
* into account the amount by which the pie section is 'exploded').
*
* @param unexploded the area inside which the unexploded pie sections are drawn.
* @param exploded the area inside which the exploded pie sections are drawn.
* @param angle the start angle.
* @param extent the extent of the arc.
* @param explodePercent the amount by which the pie section is exploded.
*
* @return a rectangle that can be used to create a pie section.
*/
protected Rectangle2D getArcBounds(Rectangle2D unexploded, Rectangle2D exploded,
double angle, double extent, double explodePercent) {
if (explodePercent == 0.0) {
return unexploded;
}
else {
Arc2D arc1 = new Arc2D.Double(unexploded, angle, extent / 2, Arc2D.OPEN);
Point2D point1 = arc1.getEndPoint();
Arc2D.Double arc2 = new Arc2D.Double(exploded, angle, extent / 2, Arc2D.OPEN);
Point2D point2 = arc2.getEndPoint();
double deltaX = (point1.getX() - point2.getX()) * explodePercent;
double deltaY = (point1.getY() - point2.getY()) * explodePercent;
return new Rectangle2D.Double(unexploded.getX() - deltaX,
unexploded.getY() - deltaY,
unexploded.getWidth(),
unexploded.getHeight());
}
}
示例2: getWindow
/**
* Returns the shape for the window for this dial. Some dial layers will
* request that their drawing be clipped within this window.
*
* @param frame the reference frame (<code>null</code> not permitted).
*
* @return The shape of the dial's window.
*/
public Shape getWindow(Rectangle2D frame) {
Rectangle2D innerFrame = DialPlot.rectangleByRadius(frame,
this.innerRadius, this.innerRadius);
Rectangle2D outerFrame = DialPlot.rectangleByRadius(frame,
this.outerRadius, this.outerRadius);
Arc2D inner = new Arc2D.Double(innerFrame, this.startAngle, this.extent,
Arc2D.OPEN);
Arc2D outer = new Arc2D.Double(outerFrame, this.startAngle
+ this.extent, - this.extent, Arc2D.OPEN);
GeneralPath p = new GeneralPath();
Point2D point1 = inner.getStartPoint();
p.moveTo((float) point1.getX(), (float) point1.getY());
p.append(inner, true);
p.append(outer, true);
p.closePath();
return p;
}
示例3: getOuterWindow
protected Shape getOuterWindow(Rectangle2D frame) {
double radiusMargin = 0.02;
double angleMargin = 1.5;
Rectangle2D innerFrame = DialPlot.rectangleByRadius(frame,
this.innerRadius - radiusMargin, this.innerRadius
- radiusMargin);
Rectangle2D outerFrame = DialPlot.rectangleByRadius(frame,
this.outerRadius + radiusMargin, this.outerRadius
+ radiusMargin);
Arc2D inner = new Arc2D.Double(innerFrame, this.startAngle
- angleMargin, this.extent + 2 * angleMargin, Arc2D.OPEN);
Arc2D outer = new Arc2D.Double(outerFrame, this.startAngle
+ angleMargin + this.extent, - this.extent - 2 * angleMargin,
Arc2D.OPEN);
GeneralPath p = new GeneralPath();
Point2D point1 = inner.getStartPoint();
p.moveTo((float) point1.getX(), (float) point1.getY());
p.append(inner, true);
p.append(outer, true);
p.closePath();
return p;
}
示例4: draw
/**
* Draws the pointer.
*
* @param g2 the graphics target.
* @param plot the plot.
* @param frame the dial's reference frame.
* @param view the dial's view.
*/
public void draw(Graphics2D g2, DialPlot plot, Rectangle2D frame,
Rectangle2D view) {
g2.setPaint(this.paint);
g2.setStroke(this.stroke);
Rectangle2D arcRect = DialPlot.rectangleByRadius(frame,
this.radius, this.radius);
double value = plot.getValue(this.datasetIndex);
DialScale scale = plot.getScaleForDataset(this.datasetIndex);
double angle = scale.valueToAngle(value);
Arc2D arc = new Arc2D.Double(arcRect, angle, 0, Arc2D.OPEN);
Point2D pt = arc.getEndPoint();
Line2D line = new Line2D.Double(frame.getCenterX(),
frame.getCenterY(), pt.getX(), pt.getY());
g2.draw(line);
}
示例5: draw
/**
* Draws the range.
*
* @param g2 the graphics target.
* @param plot the plot.
* @param frame the dial's reference frame (in Java2D space).
* @param view the dial's view rectangle (in Java2D space).
*/
public void draw(Graphics2D g2, DialPlot plot, Rectangle2D frame,
Rectangle2D view) {
Rectangle2D arcRectInner = DialPlot.rectangleByRadius(frame,
this.innerRadius, this.innerRadius);
Rectangle2D arcRectOuter = DialPlot.rectangleByRadius(frame,
this.outerRadius, this.outerRadius);
//double range = this.upperBound - this.lowerBound;
DialScale scale = plot.getScaleForDataset(0);
double angleMin = scale.valueToAngle(this.lowerBound);
double angleMax = scale.valueToAngle(this.upperBound);
Arc2D arcInner = new Arc2D.Double(arcRectInner, angleMin,
angleMax - angleMin, Arc2D.OPEN);
Arc2D arcOuter = new Arc2D.Double(arcRectOuter, angleMax,
angleMin - angleMax, Arc2D.OPEN);
g2.setPaint(this.paint);
g2.setStroke(new BasicStroke(2.0f));
g2.draw(arcInner);
g2.draw(arcOuter);
}
示例6: drawArc
/**
* Draws an arc.
*
* @param g2 the graphics device.
* @param area the plot area.
* @param minValue the minimum value.
* @param maxValue the maximum value.
* @param paint the paint.
* @param stroke the stroke.
*/
protected void drawArc(Graphics2D g2, Rectangle2D area, double minValue,
double maxValue, Paint paint, Stroke stroke) {
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();
g2.setPaint(paint);
g2.setStroke(stroke);
if (paint != null && stroke != null) {
Arc2D.Double arc = new Arc2D.Double(x, y, w, h, startAngle,
extent, Arc2D.OPEN);
g2.setPaint(paint);
g2.setStroke(stroke);
g2.draw(arc);
}
}
示例7: getArcBounds
/**
* Returns a rectangle that can be used to create a pie section (taking
* into account the amount by which the pie section is 'exploded').
*
* @param unexploded the area inside which the unexploded pie sections are
* drawn.
* @param exploded the area inside which the exploded pie sections are
* drawn.
* @param angle the start angle.
* @param extent the extent of the arc.
* @param explodePercent the amount by which the pie section is exploded.
*
* @return A rectangle that can be used to create a pie section.
*/
protected Rectangle2D getArcBounds(Rectangle2D unexploded,
Rectangle2D exploded,
double angle, double extent,
double explodePercent) {
if (explodePercent == 0.0) {
return unexploded;
}
else {
Arc2D arc1 = new Arc2D.Double(unexploded, angle, extent / 2,
Arc2D.OPEN);
Point2D point1 = arc1.getEndPoint();
Arc2D.Double arc2 = new Arc2D.Double(exploded, angle, extent / 2,
Arc2D.OPEN);
Point2D point2 = arc2.getEndPoint();
double deltaX = (point1.getX() - point2.getX()) * explodePercent;
double deltaY = (point1.getY() - point2.getY()) * explodePercent;
return new Rectangle2D.Double(unexploded.getX() - deltaX,
unexploded.getY() - deltaY, unexploded.getWidth(),
unexploded.getHeight());
}
}
示例8: drawArc
/**
* Draws an arc.
*
* @param g2 the graphics device.
* @param area the plot area.
* @param minValue the minimum value.
* @param maxValue the maximum value.
* @param paint the paint.
* @param stroke the stroke.
*/
protected void drawArc(Graphics2D g2, Rectangle2D area, double minValue,
double maxValue, Paint paint, Stroke stroke) {
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();
g2.setPaint(paint);
g2.setStroke(stroke);
if (paint != null && stroke != null) {
Arc2D.Double arc = new Arc2D.Double(x, y, w, h, startAngle,
extent, Arc2D.OPEN);
g2.setPaint(paint);
g2.setStroke(stroke);
g2.draw(arc);
}
}
示例9: draw
/**
* Draws the pointer.
*
* @param g2 the graphics target.
* @param plot the plot.
* @param frame the dial's reference frame.
* @param view the dial's view.
*/
@Override
public void draw(Graphics2D g2, DialPlot plot, Rectangle2D frame,
Rectangle2D view) {
g2.setPaint(this.paint);
g2.setStroke(this.stroke);
Rectangle2D arcRect = DialPlot.rectangleByRadius(frame,
this.radius, this.radius);
double value = plot.getValue(this.datasetIndex);
DialScale scale = plot.getScaleForDataset(this.datasetIndex);
double angle = scale.valueToAngle(value);
Arc2D arc = new Arc2D.Double(arcRect, angle, 0, Arc2D.OPEN);
Point2D pt = arc.getEndPoint();
Line2D line = new Line2D.Double(frame.getCenterX(),
frame.getCenterY(), pt.getX(), pt.getY());
g2.draw(line);
}
示例10: getWindow
/**
* Returns the shape for the window for this dial. Some dial layers will
* request that their drawing be clipped within this window.
*
* @param frame the reference frame (<code>null</code> not permitted).
*
* @return The shape of the dial's window.
*/
@Override
public Shape getWindow(Rectangle2D frame) {
Rectangle2D innerFrame = DialPlot.rectangleByRadius(frame,
this.innerRadius, this.innerRadius);
Rectangle2D outerFrame = DialPlot.rectangleByRadius(frame,
this.outerRadius, this.outerRadius);
Arc2D inner = new Arc2D.Double(innerFrame, this.startAngle,
this.extent, Arc2D.OPEN);
Arc2D outer = new Arc2D.Double(outerFrame, this.startAngle
+ this.extent, -this.extent, Arc2D.OPEN);
GeneralPath p = new GeneralPath();
Point2D point1 = inner.getStartPoint();
p.moveTo((float) point1.getX(), (float) point1.getY());
p.append(inner, true);
p.append(outer, true);
p.closePath();
return p;
}
示例11: getOuterWindow
/**
* Returns the outer window.
*
* @param frame the frame.
*
* @return The outer window.
*/
protected Shape getOuterWindow(Rectangle2D frame) {
double radiusMargin = 0.02;
double angleMargin = 1.5;
Rectangle2D innerFrame = DialPlot.rectangleByRadius(frame,
this.innerRadius - radiusMargin, this.innerRadius
- radiusMargin);
Rectangle2D outerFrame = DialPlot.rectangleByRadius(frame,
this.outerRadius + radiusMargin, this.outerRadius
+ radiusMargin);
Arc2D inner = new Arc2D.Double(innerFrame, this.startAngle
- angleMargin, this.extent + 2 * angleMargin, Arc2D.OPEN);
Arc2D outer = new Arc2D.Double(outerFrame, this.startAngle
+ angleMargin + this.extent, -this.extent - 2 * angleMargin,
Arc2D.OPEN);
GeneralPath p = new GeneralPath();
Point2D point1 = inner.getStartPoint();
p.moveTo((float) point1.getX(), (float) point1.getY());
p.append(inner, true);
p.append(outer, true);
p.closePath();
return p;
}
示例12: draw
/**
* Draws the background to the specified graphics device. If the dial
* frame specifies a window, the clipping region will already have been
* set to this window before this method is called.
*
* @param g2 the graphics device ({@code null} not permitted).
* @param plot the plot (ignored here).
* @param frame the dial frame (ignored here).
* @param view the view rectangle ({@code null} not permitted).
*/
@Override
public void draw(Graphics2D g2, DialPlot plot, Rectangle2D frame,
Rectangle2D view) {
// work out the anchor point
Rectangle2D f = DialPlot.rectangleByRadius(frame, this.radius,
this.radius);
Arc2D arc = new Arc2D.Double(f, this.angle, 0.0, Arc2D.OPEN);
Point2D pt = arc.getStartPoint();
g2.setPaint(this.paint);
g2.setFont(this.font);
TextUtils.drawAlignedString(this.label, g2, (float) pt.getX(),
(float) pt.getY(), this.anchor);
}
示例13: draw
/**
* Draws the background to the specified graphics device. If the dial
* frame specifies a window, the clipping region will already have been
* set to this window before this method is called.
*
* @param g2 the graphics device (<code>null</code> not permitted).
* @param plot the plot (ignored here).
* @param frame the dial frame (ignored here).
* @param view the view rectangle (<code>null</code> not permitted).
*/
public void draw(Graphics2D g2, DialPlot plot, Rectangle2D frame,
Rectangle2D view) {
// work out the anchor point
Rectangle2D f = DialPlot.rectangleByRadius(frame, this.radius,
this.radius);
Arc2D arc = new Arc2D.Double(f, this.angle, 0.0, Arc2D.OPEN);
Point2D pt = arc.getStartPoint();
g2.setPaint(this.paint);
g2.setFont(this.font);
TextUtilities.drawAlignedString(this.label, g2, (float) pt.getX(),
(float) pt.getY(), this.anchor);
}
示例14: calculateLabelLocation
/**
* Returns the location for a label
*
* @param labelBounds the label bounds.
* @param ascent the ascent (height of font).
* @param plotArea the plot area
* @param startAngle the start angle for the pie series.
*
* @return The location for a label.
*/
protected Point2D calculateLabelLocation(Rectangle2D labelBounds,
double ascent,
Rectangle2D plotArea,
double startAngle)
{
Arc2D arc1 = new Arc2D.Double(plotArea, startAngle, 0, Arc2D.OPEN);
Point2D point1 = arc1.getEndPoint();
double deltaX = -(point1.getX() - plotArea.getCenterX())
* this.axisLabelGap;
double deltaY = -(point1.getY() - plotArea.getCenterY())
* this.axisLabelGap;
double labelX = point1.getX() - deltaX;
double labelY = point1.getY() - deltaY;
if (labelX < plotArea.getCenterX()) {
labelX -= labelBounds.getWidth();
}
if (labelX == plotArea.getCenterX()) {
labelX -= labelBounds.getWidth() / 2;
}
if (labelY > plotArea.getCenterY()) {
labelY += ascent;
}
return new Point2D.Double(labelX, labelY);
}
示例15: drawCelementSymbols
private void drawCelementSymbols(Graphics2D g, ComponentRenderingResult rr, AffineTransform at) {
if (rr instanceof CElementRenderingResult) {
CElementRenderingResult cr = (CElementRenderingResult) rr;
Point2D labelPosition = cr.getLabelPosition();
if (labelPosition != null) {
at.transform(labelPosition, labelPosition);
Arc2D cShape = new Arc2D.Double(labelPosition.getX() - 0.15, labelPosition.getY() - 0.15, 0.30, 0.30, 60, 240, Arc2D.OPEN);
g.draw(cShape);
}
Point2D plusPosition = cr.getPlusPosition();
if (plusPosition != null) {
at.transform(plusPosition, plusPosition);
Path2D plusShape = new Path2D.Double();
plusShape.moveTo(plusPosition.getX() - 0.10, plusPosition.getY());
plusShape.lineTo(plusPosition.getX() + 0.10, plusPosition.getY());
plusShape.moveTo(plusPosition.getX(), plusPosition.getY() - 0.10);
plusShape.lineTo(plusPosition.getX(), plusPosition.getY() + 0.10);
g.draw(plusShape);
}
Point2D minusPosition = cr.getMinusPosition();
if (minusPosition != null) {
at.transform(minusPosition, minusPosition);
Line2D minusShape = new Line2D.Double(minusPosition.getX() - 0.10, minusPosition.getY(), minusPosition.getX() + 0.10, minusPosition.getY());
g.draw(minusShape);
}
}
}