当前位置: 首页>>代码示例>>Java>>正文


Java Arc2D.getEndPoint方法代码示例

本文整理汇总了Java中java.awt.geom.Arc2D.getEndPoint方法的典型用法代码示例。如果您正苦于以下问题:Java Arc2D.getEndPoint方法的具体用法?Java Arc2D.getEndPoint怎么用?Java Arc2D.getEndPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.geom.Arc2D的用法示例。


在下文中一共展示了Arc2D.getEndPoint方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getArcBounds

import java.awt.geom.Arc2D; //导入方法依赖的package包/类
/**
 * 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());

    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:33,代码来源:PiePlot.java

示例2: draw

import java.awt.geom.Arc2D; //导入方法依赖的package包/类
/**
 * 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);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:28,代码来源:DialPointer.java

示例3: getArcBounds

import java.awt.geom.Arc2D; //导入方法依赖的package包/类
/**
 * 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());
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:37,代码来源:PiePlot.java

示例4: draw

import java.awt.geom.Arc2D; //导入方法依赖的package包/类
/**
 * 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);
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:29,代码来源:DialPointer.java

示例5: getArcBounds

import java.awt.geom.Arc2D; //导入方法依赖的package包/类
/**
 * 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;
    }
    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());
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:35,代码来源:PiePlot.java

示例6: calculateLabelLocation

import java.awt.geom.Arc2D; //导入方法依赖的package包/类
/**
 * 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);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:41,代码来源:SpiderWebPlot.java

示例7: calculateLabelLocation

import java.awt.geom.Arc2D; //导入方法依赖的package包/类
/**
 * 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);
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:41,代码来源:SpiderWebPlot.java

示例8: draw

import java.awt.geom.Arc2D; //导入方法依赖的package包/类
/**
 * Draws the scale on the dial plot.
 *
 * @param g2  the graphics target (<code>null</code> not permitted).
 * @param plot  the dial plot (<code>null</code> not permitted).
 * @param frame  the reference frame that is used to construct the
 *     geometry of the plot (<code>null</code> not permitted).
 * @param view  the visible part of the plot (<code>null</code> not 
 *     permitted).
 */
public void draw(Graphics2D g2, DialPlot plot, Rectangle2D frame, 
        Rectangle2D view) {
    
    Rectangle2D arcRect = DialPlot.rectangleByRadius(frame, 
            this.tickRadius, this.tickRadius);
    Rectangle2D arcRectInner = DialPlot.rectangleByRadius(frame, 
            this.tickRadius - this.minorTickLength, 
            this.tickRadius - this.minorTickLength);
    Rectangle2D arcRectForLabels = DialPlot.rectangleByRadius(frame, 
            this.tickRadius - this.tickLabelOffset, 
            this.tickRadius - this.tickLabelOffset);
    
    boolean firstLabel = true;
    
    Arc2D arc = new Arc2D.Double();
    for (double v = this.lowerBound; v <= this.upperBound; 
            v += this.majorTickIncrement) {
        arc.setArc(arcRect, this.startAngle, valueToAngle(v) 
                - this.startAngle, Arc2D.OPEN);
        Point2D pt0 = arc.getEndPoint();
        arc.setArc(arcRectInner, this.startAngle, valueToAngle(v) 
                - this.startAngle, Arc2D.OPEN);
        Point2D pt1 = arc.getEndPoint();
        g2.setPaint(this.majorTickPaint);
        g2.setStroke(this.majorTickStroke);
        g2.draw(new Line2D.Double(pt0, pt1));
        arc.setArc(arcRectForLabels, this.startAngle, valueToAngle(v) 
                - this.startAngle, Arc2D.OPEN);
        Point2D pt2 = arc.getEndPoint();
        
        if (tickLabelsVisible) {
            if (!firstLabel || this.firstTickLabelVisible) {
                g2.setFont(this.tickLabelFont);
                TextUtilities.drawAlignedString(String.valueOf(v), g2, 
                        (float) pt2.getX(), (float) pt2.getY(), 
                        TextAnchor.CENTER);
            }
        }
        firstLabel = false;
        
        // now do the minor tick marks
        if (this.minorTickCount > 0) {
            double minorTickIncrement = this.majorTickIncrement 
                    / (this.minorTickCount + 1);
            for (int i = 0; i < this.minorTickCount; i++) {
                double vv = v + ((i + 1) * minorTickIncrement);
                if (vv >= this.upperBound) {
                    break;
                }
                double angle = valueToAngle(vv);
               
                arc.setArc(arcRect, this.startAngle, angle 
                        - this.startAngle, Arc2D.OPEN);
                pt0 = arc.getEndPoint();
                arc.setArc(arcRectInner, this.startAngle, angle 
                        - this.startAngle, Arc2D.OPEN);
                Point2D pt3 = arc.getEndPoint();
                g2.setStroke(new BasicStroke(1.0f));
                g2.draw(new Line2D.Double(pt0, pt3));
            }
        }
        
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:75,代码来源:StandardDialScale.java

示例9: getArcCenter

import java.awt.geom.Arc2D; //导入方法依赖的package包/类
/**
 * Returns the center for the specified section.
 * Checks to see if the section is exploded and recalculates the
 * new center if so.
 *
 * @param state  PiePlotState
 * @param key  section key.
 *
 * @return The center for the specified section.
 *
 * @since 1.0.14
 */
protected Point2D getArcCenter(PiePlotState state, Comparable key) {
    Point2D center = new Point2D.Double(state.getPieCenterX(), state
        .getPieCenterY());

    double ep = getExplodePercent(key);
    double mep = getMaximumExplodePercent();
    if (mep > 0.0) {
        ep = ep / mep;
    }
    if (ep != 0) {
        Rectangle2D pieArea = state.getPieArea();
        Rectangle2D expPieArea = state.getExplodedPieArea();
        double angle1, angle2;
        Number n = this.dataset.getValue(key);
        double value = n.doubleValue();

        if (this.direction == Rotation.CLOCKWISE) {
            angle1 = state.getLatestAngle();
            angle2 = angle1 - value / state.getTotal() * 360.0;
        } else if (this.direction == Rotation.ANTICLOCKWISE) {
            angle1 = state.getLatestAngle();
            angle2 = angle1 + value / state.getTotal() * 360.0;
        } else {
            throw new IllegalStateException("Rotation type not recognised.");
        }
        double angle = (angle2 - angle1);

        Arc2D arc1 = new Arc2D.Double(pieArea, angle1, angle / 2,
                Arc2D.OPEN);
        Point2D point1 = arc1.getEndPoint();
        Arc2D.Double arc2 = new Arc2D.Double(expPieArea, angle1, angle / 2,
                Arc2D.OPEN);
        Point2D point2 = arc2.getEndPoint();
        double deltaX = (point1.getX() - point2.getX()) * ep;
        double deltaY = (point1.getY() - point2.getY()) * ep;

        center = new Point2D.Double(state.getPieCenterX() - deltaX,
                 state.getPieCenterY() - deltaY);

    }
    return center;
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:55,代码来源:PiePlot.java


注:本文中的java.awt.geom.Arc2D.getEndPoint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。