Example usage for java.awt.geom Path2D moveTo

List of usage examples for java.awt.geom Path2D moveTo

Introduction

In this page you can find the example usage for java.awt.geom Path2D moveTo.

Prototype

public abstract void moveTo(double x, double y);

Source Link

Document

Adds a point to the path by moving to the specified coordinates specified in double precision.

Usage

From source file:org.jfree.graphics2d.demo.ImageTest.java

private static void drawArcTest(Graphics2D g2) {
    g2.setPaint(Color.GREEN);//  ww w.ja  va 2 s . com
    g2.drawRect(0, 20, 70, 50);
    g2.setPaint(Color.RED);
    Path2D path1 = new Path2D.Double();
    double[] pts = calculateReferenceArc(90);
    path1.moveTo(pts[0], pts[1]);
    path1.curveTo(pts[2], pts[3], pts[4], pts[5], pts[6], pts[7]);
    AffineTransform t = new AffineTransform();
    t.translate(35, 45);
    t.scale(35, 25);
    t.rotate(Math.PI / 4);
    path1.transform(t);
    g2.draw(path1);

    Path2D path2 = new Path2D.Double();
    path2.moveTo(pts[0], pts[1]);
    path2.curveTo(pts[2], pts[3], pts[4], pts[5], pts[6], pts[7]);
    AffineTransform t2 = new AffineTransform();
    t2.rotate(3 * Math.PI / 4);
    t2.scale(35, 25);
    t2.translate(35, 35);
    path2.transform(t2);
    //g2.draw(path2);
    Path2D arc = new Path2D.Double();
    arc.append(path1, false);
    arc.append(path2, false);
    //g2.draw(arc);
    //g2.draw(path1);
    //g2.transform(t);
    g2.setPaint(Color.BLUE);
    g2.drawArc(0, 20, 70, 50, 0, -270);
    //Arc2D arc2d = new Arc2D.Double(0d, 20d, 70d, 50d, 0d, 90, Arc2D.OPEN);
    //g2.draw(arc2d);
}

From source file:inflor.core.gates.ui.PolygonGateAnnotation.java

@Override
public boolean containsPoint(Point2D p) {
    Path2D poly = new Path2D.Double();
    for (int i = 0; i < polygonPoints.length; i += 2) {
        if (i == 0) {
            poly.moveTo(polygonPoints[i], polygonPoints[i + 1]);
        } else {/*ww w. ja  v  a  2s. c om*/
            poly.lineTo(polygonPoints[i], polygonPoints[i + 1]);
        }
    }
    poly.closePath();
    return poly.contains(p);
}

From source file:it.unibo.alchemist.boundary.monitors.Generic2DDisplay.java

private Shape convertObstacle(final Obstacle2D o) {
    final Rectangle2D r = o.getBounds2D();
    final Position[] points = new Position[] { new Continuous2DEuclidean(r.getX(), r.getY()),
            new Continuous2DEuclidean(r.getX() + r.getWidth(), r.getY()),
            new Continuous2DEuclidean(r.getX() + r.getWidth(), r.getY() + r.getHeight()),
            new Continuous2DEuclidean(r.getX(), r.getY() + r.getHeight()) };
    final Path2D path = new GeneralPath();
    for (int i = 0; i < points.length; i++) {
        final Point pt = wormhole.getViewPoint(points[i]);
        if (i == 0) {
            path.moveTo(pt.getX(), pt.getY());
        }/*from  w ww . j  ava 2s .  c  o  m*/
        path.lineTo(pt.getX(), pt.getY());
    }
    path.closePath();
    return path;
}

From source file:net.sf.jasperreports.customizers.shape.AbstractShapeCustomizer.java

/**
 * Uses the points to build a polyline//from www .  j  a v a  2s  . c om
 * 
 * @param baseShape the points of the polyline
 * @return a polyline shape or null if it can't be build from the current configuration
 */
protected Shape buildPolyline(ShapePoints baseShape) {
    Path2D path = null;
    List<Point> points = baseShape.getPoints();
    if (points != null && !points.isEmpty()) {
        float scaleFactorX = 1.0f;
        float scaleFactorY = 1.0f;

        Rectangle2D bounds = getBounds(baseShape);
        Integer width = getWidth();
        Integer height = getHeight();
        if (width != null) {
            scaleFactorX = (float) (width / bounds.getWidth());
        }
        if (height != null) {
            scaleFactorY = (float) (height / bounds.getHeight());
        }

        path = new Path2D.Double();

        if (points.size() > 1) {
            Point offset = getOffset(bounds);
            Point point = points.get(0);

            path.moveTo((point.getX() - offset.getX()) * scaleFactorX,
                    (point.getY() - offset.getY()) * scaleFactorY);
            for (int i = 1; i < points.size(); i++) {
                point = points.get(i);
                path.lineTo((point.getX() - offset.getX()) * scaleFactorX,
                        (point.getY() - offset.getY()) * scaleFactorY);
            }
        }
    }
    return path;
}

From source file:imagingbook.pub.fd.FourierDescriptor.java

public Path2D makeEllipse(Complex G1, Complex G2, int m, double xOffset, double yOffset) {
    Path2D path = new Path2D.Float();
    int recPoints = Math.max(minReconstructionSamples, G.length * 3);
    for (int i = 0; i < recPoints; i++) {
        double t = (double) i / recPoints;
        Complex p1 = this.getEllipsePoint(G1, G2, m, t);
        double xt = p1.re;
        double yt = p1.im;
        if (i == 0) {
            path.moveTo(xt + xOffset, yt + yOffset);
        } else {// w w w  .j a  v a2 s  . c  o  m
            path.lineTo(xt + xOffset, yt + yOffset);
        }
    }
    path.closePath();
    return path;
}

From source file:imagingbook.pub.fd.FourierDescriptor.java

/**
 * Reconstructs the shape obtained from FD-pairs 0,...,Mp as a polygon (path).
 *//*from w  w  w  .  j ava 2 s.c om*/
public Path2D makeFourierPairsReconstruction(int Mp) {
    int M = G.length;
    Mp = Math.min(Mp, M / 2);
    int recPoints = Math.max(minReconstructionSamples, G.length * 3);
    Path2D path = new Path2D.Float();
    for (int i = 0; i < recPoints; i++) {
        double t = (double) i / recPoints;
        Complex pt = new Complex(getCoefficient(0)); // assumes that coefficient 0 is never scaled
        // calculate a particular reconstruction point 
        for (int m = 1; m <= Mp; m++) {
            Complex ep = getEllipsePoint(getCoefficient(-m), getCoefficient(m), m, t);
            pt = pt.add(ep.mult(reconstructionScale));
        }
        double xt = pt.re;
        double yt = pt.im;
        if (i == 0) {
            path.moveTo(xt, yt);
        } else {
            path.lineTo(xt, yt);
        }
    }
    path.closePath();
    return path;
}

From source file:org.earthtime.UPb_Redux.dateInterpretation.WeightedMeanGraphPanel.java

/**
 *
 * @param g2d//www . j av a  2  s. c om
 */
public void paint(Graphics2D g2d) {

    // setup painting parameters
    String fractionSortOrder = "name"; //random, weight, date
    if (getWeightedMeanOptions().containsKey("fractionSortOrder")) {
        fractionSortOrder = getWeightedMeanOptions().get("fractionSortOrder");
    }

    double rangeX = (getMaxX_Display() - getMinX_Display());
    double rangeY = (getMaxY_Display() - getMinY_Display());

    g2d.setClip(getLeftMargin(), getTopMargin(), getGraphWidth(), getGraphHeight());
    RenderingHints rh = g2d.getRenderingHints();
    rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    rh.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
    g2d.setRenderingHints(rh);

    // walk the sampleDateInterpretations and produce graphs
    g2d.setPaint(Color.BLACK);
    g2d.setStroke(new BasicStroke(2.0f));
    g2d.setFont(new Font("SansSerif", Font.BOLD, 10));

    double barWidth = 15.0;
    double barGap = 10.0;
    double startSamX = 10.0;
    double saveStartSamX = 0.0;
    double samSpace = 3.0;

    for (int i = 0; i < selectedSampleDateModels.length; i++) {
        for (int j = 1; j < 9; j++) {
            if (selectedSampleDateModels[i][j] instanceof SampleDateModel) {

                final SampleDateModel SAM = ((SampleDateModel) selectedSampleDateModels[i][j]);
                double wMean = SAM.getValue().movePointLeft(6).doubleValue();
                double wMeanOneSigma = SAM.getOneSigmaAbs().movePointLeft(6).doubleValue();

                Path2D mean = new Path2D.Double(Path2D.WIND_NON_ZERO);

                // july 2008
                // modified to show de-selected fractions as gray
                // this means a new special list of fractionIDs is created fromall non-rejected fractions
                // and each instance is tested for being included
                // should eventually refactor
                Vector<String> allFIDs = new Vector<String>();
                for (String f : ((UPbReduxAliquot) SAM.getAliquot()).getAliquotFractionIDs()) {
                    // test added for Sample-based wm
                    if (SAM.fractionDateIsPositive(//
                            ((UPbReduxAliquot) SAM.getAliquot()).getAliquotFractionByName(f))) {
                        allFIDs.add(f);
                    }
                }

                final int iFinal = i;
                if (fractionSortOrder.equalsIgnoreCase("weight")) {
                    Collections.sort(allFIDs, new Comparator<String>() {

                        public int compare(String fID1, String fID2) {
                            double invertOneSigmaF1 = //
                                    1.0 //
                                            / ((UPbReduxAliquot) selectedSampleDateModels[iFinal][0])//
                                                    .getAliquotFractionByName(fID1)//
                                                    .getRadiogenicIsotopeDateByName(SAM.getDateName())//
                                                    .getOneSigmaAbs().movePointLeft(6).doubleValue();
                            double invertOneSigmaF2 = //
                                    1.0 //
                                            / ((UPbReduxAliquot) selectedSampleDateModels[iFinal][0])//
                                                    .getAliquotFractionByName(fID2)//
                                                    .getRadiogenicIsotopeDateByName(SAM.getDateName())//
                                                    .getOneSigmaAbs().movePointLeft(6).doubleValue();

                            return Double.compare(invertOneSigmaF2, invertOneSigmaF1);
                        }
                    });
                } else if (fractionSortOrder.equalsIgnoreCase("date")) {
                    Collections.sort(allFIDs, new Comparator<String>() {

                        public int compare(String fID1, String fID2) {
                            double dateF1 = //
                                    ((UPbReduxAliquot) selectedSampleDateModels[iFinal][0])//
                                            .getAliquotFractionByName(fID1)//
                                            .getRadiogenicIsotopeDateByName(SAM.getDateName())//
                                            .getValue().doubleValue();
                            double dateF2 = //
                                    ((UPbReduxAliquot) selectedSampleDateModels[iFinal][0])//
                                            .getAliquotFractionByName(fID2)//
                                            .getRadiogenicIsotopeDateByName(SAM.getDateName())//
                                            .getValue().doubleValue();

                            return Double.compare(dateF1, dateF2);
                        }
                    });
                } else if ( /* ! isInRandomMode() &&*/fractionSortOrder.equalsIgnoreCase("random")) {
                    Collections.shuffle(allFIDs, new Random());
                } else if (fractionSortOrder.equalsIgnoreCase("name")) {
                    // default to alphabetic by name
                    //Collections.sort(allFIDs);
                    // april 2010 give same lexigraphic ordering that UPbFractions get
                    Collections.sort(allFIDs, new IntuitiveStringComparator<String>());
                } else {
                    // do nothing
                }

                double actualWidthX = (allFIDs.size()) * (barWidth + barGap);//; + barGap;

                // plot 2-sigma of mean
                mean.moveTo((float) mapX(startSamX, getMinX_Display(), rangeX, graphWidth),
                        (float) mapY(wMean + 2.0 * wMeanOneSigma, getMaxY_Display(), rangeY, graphHeight));
                mean.lineTo((float) mapX(startSamX + actualWidthX, getMinX_Display(), rangeX, graphWidth),
                        (float) mapY(wMean + 2.0 * wMeanOneSigma, getMaxY_Display(), rangeY, graphHeight));
                mean.lineTo((float) mapX(startSamX + actualWidthX, getMinX_Display(), rangeX, graphWidth),
                        (float) mapY(wMean - 2.0 * wMeanOneSigma, getMaxY_Display(), rangeY, graphHeight));
                mean.lineTo((float) mapX(startSamX, getMinX_Display(), rangeX, graphWidth),
                        (float) mapY(wMean - 2.0 * wMeanOneSigma, getMaxY_Display(), rangeY, graphHeight));
                mean.closePath();

                g2d.setColor(ReduxConstants.mySampleYellowColor);
                g2d.fill(mean);
                g2d.setPaint(Color.BLACK);

                // plot 1-sigma of mean
                mean.reset();
                mean.moveTo((float) mapX(startSamX, getMinX_Display(), rangeX, graphWidth),
                        (float) mapY(wMean + wMeanOneSigma, getMaxY_Display(), rangeY, graphHeight));
                mean.lineTo((float) mapX(startSamX + actualWidthX, getMinX_Display(), rangeX, graphWidth),
                        (float) mapY(wMean + wMeanOneSigma, getMaxY_Display(), rangeY, graphHeight));
                mean.lineTo((float) mapX(startSamX + actualWidthX, getMinX_Display(), rangeX, graphWidth),
                        (float) mapY(wMean - wMeanOneSigma, getMaxY_Display(), rangeY, graphHeight));
                mean.lineTo((float) mapX(startSamX, getMinX_Display(), rangeX, graphWidth),
                        (float) mapY(wMean - wMeanOneSigma, getMaxY_Display(), rangeY, graphHeight));
                mean.closePath();

                g2d.setColor(ReduxConstants.ColorOfRedux);
                g2d.fill(mean);
                g2d.setPaint(Color.BLACK);

                // plot mean
                mean.reset();
                mean.moveTo((float) mapX(startSamX, getMinX_Display(), rangeX, graphWidth),
                        (float) mapY(wMean, getMaxY_Display(), rangeY, graphHeight));
                mean.lineTo((float) mapX(startSamX + actualWidthX, getMinX_Display(), rangeX, graphWidth),
                        (float) mapY(wMean, getMaxY_Display(), rangeY, graphHeight));
                g2d.setStroke(new BasicStroke(1.0f));
                g2d.draw(mean);
                g2d.setStroke(new BasicStroke(2.0f));

                saveStartSamX = startSamX;

                // plot fraction bars
                double minPoint = 5000.0;
                double maxWeight = 0.0;
                double totalWeight = 0.0;

                int barNum = 0;

                for (String fID : allFIDs) {
                    // the dateModel has an associated aliquot, but in sample mode, it is a
                    // standin aliquot for the sample.  to get the aliquot number for
                    // use in coloring fractions, we need to query the fraction itself
                    String aliquotName = sample.getAliquotNameByFractionID(fID);

                    Color includedFillColor = new Color(0, 0, 0);
                    if (sample.getSampleDateInterpretationGUISettings().getAliquotOptions().get(aliquotName)
                            .containsKey("includedFillColor")) {
                        String[] temp = //
                                sample.getSampleDateInterpretationGUISettings().getAliquotOptions()
                                        .get(aliquotName).get("includedFillColor").split(",");
                        includedFillColor = buildRGBColor(temp);
                    }

                    Fraction f = ((UPbReduxAliquot) selectedSampleDateModels[i][0])
                            .getAliquotFractionByName(fID);

                    double date = f.//((UPbReduxAliquot) selectedSampleDateModels[i][0]).getAliquotFractionByName(fID).//
                            getRadiogenicIsotopeDateByName(SAM.getDateName()).getValue().movePointLeft(6)
                            .doubleValue();
                    double twoSigma = f.//((UPbReduxAliquot) selectedSampleDateModels[i][0]).getAliquotFractionByName(fID).//
                            getRadiogenicIsotopeDateByName(SAM.getDateName()).getTwoSigmaAbs().movePointLeft(6)
                            .doubleValue();

                    if ((date - twoSigma) < minPoint) {
                        minPoint = (date - twoSigma);
                    }

                    double invertedOneSigma = //
                            1.0 //
                                    / f.//((UPbReduxAliquot) selectedSampleDateModels[i][0]).getAliquotFractionByName(fID).//
                                            getRadiogenicIsotopeDateByName(SAM.getDateName()).getOneSigmaAbs()
                                            .movePointLeft(6).doubleValue();

                    if (invertedOneSigma > maxWeight) {
                        maxWeight = invertedOneSigma;
                    }

                    Path2D bar = new Path2D.Double(Path2D.WIND_NON_ZERO);
                    bar.moveTo(
                            (float) mapX(saveStartSamX + ((barGap / 2.0) + barNum * (barWidth + barGap)),
                                    getMinX_Display(), rangeX, graphWidth),
                            (float) mapY(date + twoSigma, getMaxY_Display(), rangeY, graphHeight));
                    bar.lineTo(
                            (float) mapX(
                                    saveStartSamX + ((barGap / 2.0) + barNum * (barWidth + barGap)) + barWidth,
                                    getMinX_Display(), rangeX, graphWidth),
                            (float) mapY(date + twoSigma, getMaxY_Display(), rangeY, graphHeight));
                    bar.lineTo(
                            (float) mapX(
                                    saveStartSamX + ((barGap / 2.0) + barNum * (barWidth + barGap)) + barWidth,
                                    getMinX_Display(), rangeX, graphWidth),
                            (float) mapY(date - twoSigma, getMaxY_Display(), rangeY, graphHeight));
                    bar.lineTo(
                            (float) mapX(saveStartSamX + ((barGap / 2.0) + barNum * (barWidth + barGap)),
                                    getMinX_Display(), rangeX, graphWidth),
                            (float) mapY(date - twoSigma, getMaxY_Display(), rangeY, graphHeight));
                    bar.closePath();

                    Composite originalComposite = g2d.getComposite();

                    if (SAM.getIncludedFractionIDsVector().contains(fID)) {
                        g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.8f));
                        totalWeight += Math.pow(invertedOneSigma, 2.0);

                        // april 2014 experiment
                        if (f.getRgbColor() != 0) {
                            includedFillColor = new Color(f.getRgbColor());
                        }

                    } else {
                        g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.2f));
                    }

                    g2d.setPaint(includedFillColor);

                    g2d.draw(bar);
                    //restore composite
                    g2d.setComposite(originalComposite);

                    g2d.setColor(Color.black);

                    // label fraction at top
                    g2d.rotate(-Math.PI / 4.0,
                            (float) mapX(saveStartSamX + ((barGap / 2.0) + barNum * (barWidth + barGap)),
                                    getMinX_Display(), rangeX, graphWidth),
                            (float) mapY(date + twoSigma, getMaxY_Display(), rangeY, graphHeight));

                    g2d.drawString(
                            ((UPbReduxAliquot) selectedSampleDateModels[i][0]).getAliquotFractionByName(fID)
                                    .getFractionID(),
                            (float) mapX(saveStartSamX + ((barGap / 2.0) + barNum * (barWidth + barGap)),
                                    getMinX_Display(), rangeX, graphWidth) + 15,
                            (float) mapY(date + twoSigma, getMaxY_Display(), rangeY, graphHeight));

                    g2d.rotate(Math.PI / 4.0,
                            (float) mapX(saveStartSamX + ((barGap / 2.0) + barNum * (barWidth + barGap)),
                                    getMinX_Display(), rangeX, graphWidth),
                            (float) mapY(date + twoSigma, getMaxY_Display(), rangeY, graphHeight));

                    barNum++;
                    // startSamX += 2 * barWidth;
                    startSamX += barWidth + barGap;
                }

                // display three info boxes below weighted means
                // each tic is the height of one calculated y-axis tic
                // determine the y axis tic
                double minYtic = Math.ceil(getMinY_Display() * 100) / 100;
                double maxYtic = Math.floor(getMaxY_Display() * 100) / 100;
                double deltay = Math.rint((maxYtic - minYtic) * 10 + 0.5);
                double yTic = deltay / 100;

                double yTopSummary = minPoint - yTic / 2.0;// wMeanOneSigma;
                //double specialYTic = yTic;
                double yTopWeights = yTopSummary - yTic * 1.1;
                double yTopMSWD_PDF = yTopWeights - yTic * 1.1;

                // summary box
                Path2D box = new Path2D.Double(Path2D.WIND_NON_ZERO);
                box.moveTo((float) mapX(saveStartSamX, getMinX_Display(), rangeX, graphWidth),
                        (float) mapY(yTopSummary, getMaxY_Display(), rangeY, graphHeight));
                box.lineTo((float) mapX(saveStartSamX + actualWidthX, getMinX_Display(), rangeX, graphWidth),
                        (float) mapY(yTopSummary, getMaxY_Display(), rangeY, graphHeight));
                box.lineTo((float) mapX(saveStartSamX + actualWidthX, getMinX_Display(), rangeX, graphWidth),
                        (float) mapY(yTopSummary - yTic, getMaxY_Display(), rangeY, graphHeight));
                box.lineTo((float) mapX(saveStartSamX, getMinX_Display(), rangeX, graphWidth),
                        (float) mapY(yTopSummary - yTic, getMaxY_Display(), rangeY, graphHeight));
                box.closePath();

                g2d.setStroke(new BasicStroke(1.5f));
                g2d.draw(box);

                // Info Box
                g2d.drawString(//
                        SAM.getAliquot().getAliquotName(),
                        (float) mapX(saveStartSamX, getMinX_Display(), rangeX, graphWidth) + 4f,
                        (float) mapY(yTopSummary, getMaxY_Display(), rangeY, graphHeight) + 13f);
                g2d.drawString(//
                        SAM.getName(), (float) mapX(saveStartSamX, getMinX_Display(), rangeX, graphWidth) + 4f,
                        (float) mapY(yTopSummary, getMaxY_Display(), rangeY, graphHeight) + 25f);
                g2d.drawString(//
                        SAM.FormatValueAndTwoSigmaABSThreeWaysForPublication(6, 2),
                        (float) mapX(saveStartSamX, getMinX_Display(), rangeX, graphWidth) + 4f,
                        (float) mapY(yTopSummary, getMaxY_Display(), rangeY, graphHeight) + 36f);
                g2d.drawString(//
                        SAM.ShowCustomMSWDwithN(),
                        (float) mapX(saveStartSamX, getMinX_Display(), rangeX, graphWidth) + 4f,
                        (float) mapY(yTopSummary, getMaxY_Display(), rangeY, graphHeight) + 48f);

                // weights box
                box.reset();
                box.moveTo((float) mapX(saveStartSamX, getMinX_Display(), rangeX, graphWidth),
                        (float) mapY(yTopWeights, getMaxY_Display(), rangeY, graphHeight));
                box.lineTo((float) mapX(saveStartSamX + actualWidthX, getMinX_Display(), rangeX, graphWidth),
                        (float) mapY(yTopWeights, getMaxY_Display(), rangeY, graphHeight));
                box.lineTo((float) mapX(saveStartSamX + actualWidthX, getMinX_Display(), rangeX, graphWidth),
                        (float) mapY(yTopWeights - yTic, getMaxY_Display(), rangeY, graphHeight));
                box.lineTo((float) mapX(saveStartSamX, getMinX_Display(), rangeX, graphWidth),
                        (float) mapY(yTopWeights - yTic, getMaxY_Display(), rangeY, graphHeight));
                box.closePath();

                g2d.setStroke(new BasicStroke(1.5f));
                g2d.draw(box);

                // plot fraction weights
                double artificialXRange = allFIDs.size();
                double count = 0;
                //double weightWidth = Math.min(3.0 * barWidth, (yTic / rangeY * graphHeight)) - 15;//yTic;//barWidth * 2.0;
                double weightWidth = (barWidth + barGap) * 0.9;

                for (String fID : allFIDs) {
                    // the dateModel has an associated aliquot, but in sample mode, it is a
                    // standin aliquot for the sample.  to get the aliquot number for
                    // use in coloring fractions, we need to query the fraction itself
                    String aliquotName = sample.getAliquotNameByFractionID(fID);

                    Fraction f = ((UPbReduxAliquot) selectedSampleDateModels[i][0])
                            .getAliquotFractionByName(fID);

                    Color includedFillColor = new Color(0, 0, 0);
                    if (sample.getSampleDateInterpretationGUISettings().getAliquotOptions().get(aliquotName)
                            .containsKey("includedFillColor")) {
                        String[] temp = //
                                sample.getSampleDateInterpretationGUISettings().getAliquotOptions()
                                        .get(aliquotName).get("includedFillColor").split(",");
                        includedFillColor = buildRGBColor(temp);
                    }

                    double invertOneSigma = //
                            1.0 //
                                    / ((UPbReduxAliquot) selectedSampleDateModels[i][0])
                                            .getAliquotFractionByName(fID)//
                                            .getRadiogenicIsotopeDateByName(SAM.getDateName()).getOneSigmaAbs()
                                            .movePointLeft(6).doubleValue();

                    Path2D weight = new Path2D.Double(Path2D.WIND_NON_ZERO);
                    weight.moveTo(
                            (float) mapX(saveStartSamX + (count + 0.5) / artificialXRange * actualWidthX,
                                    getMinX_Display(), rangeX, graphWidth) //
                                    - (float) (invertOneSigma / maxWeight / 2.0 * weightWidth),
                            (float) mapY(yTopWeights - (yTic / 2.0), getMaxY_Display(), rangeY, graphHeight) //
                                    + (float) (invertOneSigma / maxWeight / 2.0 * weightWidth) - 5f);

                    weight.lineTo(
                            (float) mapX(saveStartSamX + (count + 0.5) / artificialXRange * actualWidthX,
                                    getMinX_Display(), rangeX, graphWidth) //
                                    + (float) (invertOneSigma / maxWeight / 2.0 * weightWidth),
                            (float) mapY(yTopWeights - (yTic / 2.0), getMaxY_Display(), rangeY, graphHeight) //
                                    + (float) (invertOneSigma / maxWeight / 2.0 * weightWidth) - 5f);

                    weight.lineTo(
                            (float) mapX(saveStartSamX + (count + 0.5) / artificialXRange * actualWidthX,
                                    getMinX_Display(), rangeX, graphWidth) //
                                    + (float) (invertOneSigma / maxWeight / 2.0 * weightWidth),
                            (float) mapY(yTopWeights - (yTic / 2.0), getMaxY_Display(), rangeY, graphHeight) //
                                    - (float) (invertOneSigma / maxWeight / 2.0 * weightWidth) - 5f);

                    weight.lineTo(
                            (float) mapX(saveStartSamX + (count + 0.5) / artificialXRange * actualWidthX,
                                    getMinX_Display(), rangeX, graphWidth) //
                                    - (float) (invertOneSigma / maxWeight / 2.0 * weightWidth),
                            (float) mapY(yTopWeights - (yTic / 2.0), getMaxY_Display(), rangeY, graphHeight) //
                                    - (float) (invertOneSigma / maxWeight / 2.0 * weightWidth) - 5f);

                    weight.closePath();

                    g2d.setStroke(new BasicStroke(2.5f));

                    // test for included or not == black or gray
                    String weightPerCent = "   0";//0.0%";

                    //                        g2d.setPaint(includedFillColor);
                    Composite originalComposite = g2d.getComposite();

                    if (SAM.getIncludedFractionIDsVector().contains(fID)) {
                        g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.8f));
                        weightPerCent = formatter1DecPlace
                                .format(Math.pow(invertOneSigma, 2.0) / totalWeight * 100.0);// + "%";

                        // april 2014 experiment
                        if (f.getRgbColor() != 0) {
                            includedFillColor = new Color(f.getRgbColor());
                        }
                    } else {
                        g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.2f));
                    }

                    g2d.setPaint(includedFillColor);

                    g2d.fill(weight);
                    //restore composite
                    g2d.setComposite(originalComposite);

                    // write percent of total weight
                    g2d.drawString(weightPerCent,
                            (float) mapX(saveStartSamX + (count + 0.5) / artificialXRange * actualWidthX,
                                    getMinX_Display(), rangeX, graphWidth) //
                                    - (float) (invertOneSigma / maxWeight / 2.0 * weightWidth),
                            (float) mapY(yTopWeights - yTic, getMaxY_Display(), rangeY, graphHeight) - 5f);
                    g2d.setColor(Color.black);

                    count += 1.0;

                }

                // double box height for graph
                yTic *= 2.0;

                // plot MSWD_PDF
                // store  function x,y values
                Vector<Double> xVals = new Vector<Double>();
                Vector<Double> yVals = new Vector<Double>();

                double f = SAM.getIncludedFractionIDsVector().size() - 1;
                if (f > 1.0) {
                    g2d.setStroke(new BasicStroke(1.0f));

                    double yRange = MSWDCoordinates.valuesByPointCount[(int) f][5] * 1.03; // alitle air at the top of curve
                    double xStart = MSWDCoordinates.valuesByPointCount[(int) f][1];
                    double xRange = MSWDCoordinates.valuesByPointCount[(int) f][4] - xStart;
                    double xStep = 0.005;

                    Path2D MSWD_PDF = new Path2D.Double(Path2D.WIND_NON_ZERO);
                    Path2D MSWD_right = new Path2D.Double(Path2D.WIND_NON_ZERO);

                    // start at lower left corner of box  (may or may not be 0,0 )
                    MSWD_PDF.moveTo(//
                            (float) mapX((double) saveStartSamX, getMinX_Display(), rangeX, graphWidth),
                            (float) mapY(yTopMSWD_PDF - yTic, getMaxY_Display(), rangeY, graphHeight));

                    // setup MSWD to paint last
                    Path2D MSWD = null;

                    // calculate function values
                    for (double x = xStart; x < xRange; x += xStep) {
                        xVals.add((((x - xStart) / xRange) * actualWidthX) + (double) saveStartSamX);

                        double y = //
                                Math.pow(2, -1.0 * f / 2.0)//
                                        * Math.exp(-1.0 * f * x / 2.0)//
                                        * Math.pow(f, f / 2.0)//
                                        * Math.pow(x, (-1.0 + f / 2.0))//
                                        / Math.exp(Gamma.logGamma(f / 2.0));

                        yVals.add(((y / yRange) * yTic) + yTopMSWD_PDF - yTic);

                        MSWD_PDF.lineTo(//
                                (float) mapX(xVals.lastElement(), getMinX_Display(), rangeX, graphWidth),
                                (float) mapY(yVals.lastElement(), getMaxY_Display(), rangeY, graphHeight));

                        // test for location of left RED zone
                        if ((MSWDCoordinates.valuesByPointCount[(int) f][2] >= x)
                                && (MSWDCoordinates.valuesByPointCount[(int) f][2] < (x + xStep))) {

                            double leftX = MSWDCoordinates.valuesByPointCount[(int) f][2];
                            xVals.add((((leftX - xStart) / xRange) * actualWidthX) + (double) saveStartSamX);

                            double leftY = //
                                    Math.pow(2, -1.0 * f / 2.0)//
                                            * Math.exp(-1.0 * f * leftX / 2.0)//
                                            * Math.pow(f, f / 2.0)//
                                            * Math.pow(leftX, (-1.0 + f / 2.0))//
                                            / Math.exp(Gamma.logGamma(f / 2.0));
                            yVals.add(((leftY / yRange) * yTic) + yTopMSWD_PDF - yTic);

                            MSWD_PDF.lineTo(//
                                    (float) mapX(xVals.lastElement(), getMinX_Display(), rangeX, graphWidth),
                                    (float) mapY(yVals.lastElement(), getMaxY_Display(), rangeY, graphHeight));

                            Path2D ciLower = new Path2D.Double(Path2D.WIND_NON_ZERO);
                            ciLower.append(MSWD_PDF.getPathIterator(new AffineTransform()), true);

                            ciLower.lineTo(//
                                    (float) mapX(xVals.lastElement(), getMinX_Display(), rangeX, graphWidth),
                                    (float) mapY(yTopMSWD_PDF - yTic, getMaxY_Display(), rangeY, graphHeight));
                            ciLower.closePath();
                            g2d.setColor(Color.RED);
                            g2d.fill(ciLower);

                            // draw right hand border line to compensate for a bug in the filler
                            Line2D right = new Line2D.Double(//
                                    mapX(xVals.lastElement(), getMinX_Display(), rangeX, graphWidth),
                                    mapY(yVals.lastElement(), getMaxY_Display(), rangeY, graphHeight),
                                    mapX(xVals.lastElement(), getMinX_Display(), rangeX, graphWidth),
                                    mapY(yTopMSWD_PDF - yTic, getMaxY_Display(), rangeY, graphHeight));
                            g2d.setStroke(new BasicStroke(0.5f));
                            g2d.draw(right);
                            g2d.setStroke(new BasicStroke(1.0f));

                            g2d.setColor(Color.BLACK);

                            System.out.println("Left Red = (" + leftX + ", " + leftY + ")");
                        }

                        // test for location of right RED zone
                        if ((MSWDCoordinates.valuesByPointCount[(int) f][3] >= x)
                                && (MSWDCoordinates.valuesByPointCount[(int) f][3] < (x + xStep))) {

                            double rightX = MSWDCoordinates.valuesByPointCount[(int) f][3];
                            xVals.add((((rightX - xStart) / xRange) * actualWidthX) + (double) saveStartSamX);

                            double rightY = //
                                    Math.pow(2, -1.0 * f / 2.0)//
                                            * Math.exp(-1.0 * f * rightX / 2.0)//
                                            * Math.pow(f, f / 2.0)//
                                            * Math.pow(rightX, (-1.0 + f / 2.0))//
                                            / Math.exp(Gamma.logGamma(f / 2.0));
                            yVals.add(((rightY / yRange) * yTic) + yTopMSWD_PDF - yTic);

                            MSWD_PDF.lineTo(//
                                    (float) mapX(xVals.lastElement(), getMinX_Display(), rangeX, graphWidth),
                                    (float) mapY(yVals.lastElement(), getMaxY_Display(), rangeY, graphHeight));

                            // here the strategy is to draw the curve and then reset it to record the remainder
                            g2d.setStroke(new BasicStroke(1.0f));
                            g2d.draw(MSWD_PDF);
                            MSWD_PDF = new Path2D.Double(Path2D.WIND_NON_ZERO);
                            MSWD_PDF.moveTo(//
                                    (float) mapX(xVals.lastElement(), getMinX_Display(), rangeX, graphWidth),
                                    (float) mapY(yVals.lastElement(), getMaxY_Display(), rangeY, graphHeight));

                            MSWD_right.moveTo(//
                                    (float) mapX(xVals.lastElement(), getMinX_Display(), rangeX, graphWidth),
                                    (float) mapY(yTopMSWD_PDF - yTic, getMaxY_Display(), rangeY, graphHeight));
                            MSWD_right.lineTo(//
                                    (float) mapX(xVals.lastElement(), getMinX_Display(), rangeX, graphWidth),
                                    (float) mapY(yVals.lastElement(), getMaxY_Display(), rangeY, graphHeight));

                            System.out.println("Right Red = (" + rightX + ", " + rightY + ")");

                        }

                        // test for location of MSWD AND paint last
                        if ((SAM.getMeanSquaredWeightedDeviation().doubleValue() >= x)
                                && (SAM.getMeanSquaredWeightedDeviation().doubleValue() < (x + xStep))) {
                            MSWD = new Path2D.Double(Path2D.WIND_NON_ZERO);
                            MSWD.moveTo(//
                                    (float) mapX(xVals.lastElement(), getMinX_Display(), rangeX, graphWidth),
                                    (float) mapY(yTopMSWD_PDF - yTic, getMaxY_Display(), rangeY, graphHeight));
                            MSWD.lineTo(//
                                    (float) mapX(xVals.lastElement(), getMinX_Display(), rangeX, graphWidth),
                                    (float) mapY(yVals.lastElement(), getMaxY_Display(), rangeY, graphHeight));

                        }
                    }
                    g2d.setStroke(new BasicStroke(1.0f));
                    // merge with border of right RED and fill
                    MSWD_right.append(MSWD_PDF.getPathIterator(new AffineTransform()), true);
                    g2d.setColor(Color.RED);
                    g2d.fill(MSWD_right);
                    g2d.setColor(Color.BLACK);
                    // draw the remaining curves
                    g2d.draw(MSWD_PDF);
                    // MSWD may be off the graph and hence not exist
                    try {
                        g2d.draw(MSWD);
                    } catch (Exception e) {
                    }

                    // label 95% conf interval and MSWD
                    g2d.drawString(//
                            "95% CI: ("
                                    + formatter2DecPlaces.format(MSWDCoordinates.valuesByPointCount[(int) f][2])
                                    + ", "
                                    + formatter2DecPlaces.format(MSWDCoordinates.valuesByPointCount[(int) f][3])
                                    + ")",
                            (float) mapX(saveStartSamX + (actualWidthX / 2.0), getMinX_Display(), rangeX,
                                    graphWidth) - 30f,
                            (float) mapY(yTopMSWD_PDF, getMaxY_Display(), rangeY, graphHeight) + 15f);

                    // determine if MSWD is out of range
                    String mswdAlert = "";
                    if (SAM.getMeanSquaredWeightedDeviation()
                            .doubleValue() > MSWDCoordinates.valuesByPointCount[(int) f][4]) {
                        mswdAlert = "\n !Out of Range!";
                    }
                    g2d.drawString(//
                            "MSWD = "
                                    + formatter2DecPlaces
                                            .format(SAM.getMeanSquaredWeightedDeviation().doubleValue())
                                    + ", n = " + (int) (f + 1) + mswdAlert,
                            (float) mapX(saveStartSamX + (actualWidthX / 2.0), getMinX_Display(), rangeX,
                                    graphWidth) - 15f,
                            (float) mapY(yTopMSWD_PDF, getMaxY_Display(), rangeY, graphHeight) + 30f);

                } else {
                    g2d.drawString("need more data...",
                            (float) mapX((double) saveStartSamX, getMinX_Display(), rangeX, graphWidth) + 4f,
                            (float) mapY(yTopMSWD_PDF - yTic, getMaxY_Display(), rangeY, graphHeight) - 10f);
                }

                // MSWD_PDF box
                box.reset();
                box.moveTo((float) mapX(saveStartSamX, getMinX_Display(), rangeX, graphWidth),
                        (float) mapY(yTopMSWD_PDF, getMaxY_Display(), rangeY, graphHeight));
                box.lineTo((float) mapX(saveStartSamX + actualWidthX, getMinX_Display(), rangeX, graphWidth),
                        (float) mapY(yTopMSWD_PDF, getMaxY_Display(), rangeY, graphHeight));
                box.lineTo((float) mapX(saveStartSamX + actualWidthX, getMinX_Display(), rangeX, graphWidth),
                        (float) mapY(yTopMSWD_PDF - yTic, getMaxY_Display(), rangeY, graphHeight));
                box.lineTo((float) mapX(saveStartSamX, getMinX_Display(), rangeX, graphWidth),
                        (float) mapY(yTopMSWD_PDF - yTic, getMaxY_Display(), rangeY, graphHeight));
                box.closePath();

                g2d.setStroke(new BasicStroke(1.5f));
                g2d.draw(box);

                // MSWD_PDF x-axis tics
                if (f > 1.0) {
                    g2d.setStroke(new BasicStroke(1.0f));
                    double xStart = (MSWDCoordinates.valuesByPointCount[(int) f][1] <= 0.5) ? 0.5 : 1.0;
                    double xRange = MSWDCoordinates.valuesByPointCount[(int) f][4]
                            - MSWDCoordinates.valuesByPointCount[(int) f][1];
                    double xStep = 0.5;

                    for (double x = xStart; x < xRange; x += xStep) {
                        double xPlot = (((x - MSWDCoordinates.valuesByPointCount[(int) f][1]) / xRange)
                                * actualWidthX) + (double) saveStartSamX;
                        Line2D line = new Line2D.Double(mapX(xPlot, getMinX_Display(), rangeX, graphWidth),
                                mapY(yTopMSWD_PDF - yTic, getMaxY_Display(), rangeY, graphHeight),
                                mapX(xPlot, getMinX_Display(), rangeX, graphWidth),
                                mapY(yTopMSWD_PDF - yTic, getMaxY_Display(), rangeY, graphHeight) + 7);
                        g2d.draw(line);

                        g2d.rotate(-Math.PI / 2.0, (float) mapX(xPlot, getMinX_Display(), rangeX, graphWidth),
                                (float) mapY(yTopMSWD_PDF - yTic, getMaxY_Display(), rangeY, graphHeight));
                        g2d.drawString(formatter1DecPlace.format(x),
                                (float) mapX(xPlot, getMinX_Display(), rangeX, graphWidth) - 30f,
                                (float) mapY(yTopMSWD_PDF - yTic, getMaxY_Display(), rangeY, graphHeight) + 5f);
                        g2d.rotate(Math.PI / 2.0, (float) mapX(xPlot, getMinX_Display(), rangeX, graphWidth),
                                (float) mapY(yTopMSWD_PDF - yTic, getMaxY_Display(), rangeY, graphHeight));
                    }
                }

                // set counters
                barNum += samSpace;
                startSamX += 2 * samSpace * barWidth;
            }
        }
    }
    //        // prevents re-randomization
    //        setInRandomMode( true );

    drawAxesAndTicks(g2d, rangeX, rangeY);

    // draw zoom box if in use
    if ((Math.abs(zoomMaxX - zoomMinX) * Math.abs(zoomMinY - zoomMaxY)) > 0.0) {
        g2d.setStroke(new BasicStroke(2.0f));
        g2d.setColor(Color.red);
        g2d.drawRect(//
                Math.min(zoomMinX, zoomMaxX), Math.min(zoomMaxY, zoomMinY), Math.abs(zoomMaxX - zoomMinX),
                Math.abs(zoomMinY - zoomMaxY));
    }
}

From source file:org.eclipse.birt.chart.device.g2d.G2dRendererBase.java

public static Shape getPolygon2D(Location[] loa) {
    Path2D path = new Path2D.Double();
    path.moveTo(loa[0].getX(), loa[0].getY());
    for (int i = 1; i < loa.length; ++i) {
        path.lineTo(loa[i].getX(), loa[i].getY());
    }//  w ww  . j  a  v  a2  s  .c o m
    path.closePath();
    return path;
}

From source file:org.opensha.commons.geo.LocationList.java

/**
 * Returns a closed, stright-line {@link Path2D} representation of this list
 * @return a path representation of {@code this}
 *//*  w w  w .  java  2 s  .co  m*/
public Path2D toPath() {
    Path2D path = new Path2D.Double(Path2D.WIND_EVEN_ODD, size());
    boolean starting = true;
    for (Location loc : this) {
        double lat = loc.getLatitude();
        double lon = loc.getLongitude();
        // if just starting, then moveTo
        if (starting) {
            path.moveTo(lon, lat);
            starting = false;
            continue;
        }
        path.lineTo(lon, lat);
    }
    path.closePath();
    return path;
}

From source file:savant.view.tracks.BAMTrackRenderer.java

private void renderArcPairedMode(Graphics2D g2, GraphPaneAdapter gp) {

    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

    LOG.debug("YMAX for ARC mode: " + ((AxisRange) instructions.get(DrawingInstruction.AXIS_RANGE)).getYMax());
    AxisRange axisRange = (AxisRange) instructions.get(DrawingInstruction.AXIS_RANGE);
    ColourScheme cs = (ColourScheme) instructions.get(DrawingInstruction.COLOUR_SCHEME);
    int discordantMin = (Integer) instructions.get(DrawingInstruction.DISCORDANT_MIN);
    int discordantMax = (Integer) instructions.get(DrawingInstruction.DISCORDANT_MAX);
    //LOG.info("discordantMin=" + discordantMin + " discordantMax=" + discordantMax);

    // set up colors
    Color normalArcColor = makeTransparent(cs.getColor(ColourKey.CONCORDANT_LENGTH));
    Color invertedReadColor = makeTransparent(cs.getColor(ColourKey.ONE_READ_INVERTED));
    Color evertedPairColor = makeTransparent(cs.getColor(ColourKey.EVERTED_PAIR));
    Color discordantLengthColor = makeTransparent(cs.getColor(ColourKey.DISCORDANT_LENGTH));
    Color unmappedMateColor = makeTransparent(cs.getColor(ColourKey.UNMAPPED_MATE));

    // set graph pane's range parameters
    gp.setXRange(axisRange.getXRange());
    gp.setYRange(axisRange.getYRange());

    // iterate through the data and draw
    LOG.debug("BAMTrackRenderer.renderArcMatePairMode: " + data.size() + " records.");
    for (Record record : data) {
        BAMIntervalRecord bamRecord = (BAMIntervalRecord) record;
        SAMRecord samRecord = bamRecord.getSAMRecord();
        SAMReadUtils.PairedSequencingProtocol prot = (SAMReadUtils.PairedSequencingProtocol) instructions
                .get(DrawingInstruction.PAIRED_PROTOCOL);
        SAMReadUtils.PairMappingType type = SAMReadUtils.getPairType(samRecord, prot);

        if (samRecord.getReadPairedFlag() && type != null) {
            if (samRecord.getMateUnmappedFlag()) {
                // Read with unmapped mate.
                int alignmentStart = samRecord.getAlignmentStart();
                double x = gp.transformXPos(alignmentStart);
                double radius = 4.0;
                double top = gp.transformYPos(axisRange.getYRange().getTo() * 0.25) + radius;
                g2.setColor(unmappedMateColor);
                g2.setStroke(ONE_STROKE);
                Path2D flower = new Path2D.Double();
                flower.moveTo(x, gp.transformYPos(0.0));
                flower.lineTo(x, top);// ww w.  j a  v  a2 s. com
                flower.moveTo(x - radius, top - radius);
                flower.lineTo(x + radius, top + radius);
                flower.moveTo(x - radius, top + radius);
                flower.lineTo(x + radius, top - radius);
                //flower.append(new Ellipse2D.Double(x - radius, top - radius, radius * 2.0, radius * 2.0), false);
                g2.draw(flower);
                recordToShapeMap.put(record, flower);

                // mates map to different chrs
            } else if (!samRecord.getMateReferenceName().equals(samRecord.getReferenceName())) {

                int alignmentStart = samRecord.getAlignmentStart();
                double x = gp.transformXPos(alignmentStart);
                double arrowWidth = 10;
                double arrowHeight = 15;
                double top = gp.transformYPos(axisRange.getYRange().getTo() * 0.9);
                g2.setColor(invertedReadColor);
                g2.setStroke(TWO_STROKE);

                Path2D stem = new Path2D.Double();
                stem.moveTo(x, gp.transformYPos(0.0));
                stem.lineTo(x, top + arrowHeight);

                g2.draw(stem);

                Path2D pointer = new Path2D.Double();
                pointer.moveTo(x, top);
                pointer.lineTo(x - arrowWidth / 2, top + arrowHeight);
                pointer.lineTo(x + arrowWidth / 2, top + arrowHeight);
                pointer.lineTo(x, top);
                g2.fill(pointer);

                pointer.append(stem, false);

                //flower.append(new Ellipse2D.Double(x - radius, top - radius, radius * 2.0, radius * 2.0), false);
                //g2.draw(pointer);

                recordToShapeMap.put(record, pointer);

                // mates map to the same chr
            } else {
                // Paired read with normal mate.

                int arcLength = Math.abs(samRecord.getInferredInsertSize());

                // skip reads with a zero insert length--probably mapping errors
                if (arcLength == 0) {
                    continue;
                }

                int alignmentStart;
                int mateAlignmentStart = samRecord.getMateAlignmentStart();
                if (samRecord.getAlignmentStart() > mateAlignmentStart) {
                    if (!(mateAlignmentStart < LocationController.getInstance().getRangeStart())) {
                        // this is the second in the pair, and it doesn't span the beginning of the range, so don't draw anything
                        continue;
                    } else {
                        // switch the mate start/end for the read start/end to deal with reversed position
                        alignmentStart = mateAlignmentStart;
                    }
                } else {
                    alignmentStart = samRecord.getAlignmentStart();
                }
                // at this point alignmentStart/End refers the the start end of the first occurrence in the pair

                int intervalStart;
                switch (type) {
                case INVERTED_READ:
                case INVERTED_MATE:
                    intervalStart = alignmentStart;
                    g2.setColor(invertedReadColor);
                    g2.setStroke(TWO_STROKE);
                    break;
                case EVERTED:
                    intervalStart = alignmentStart;
                    g2.setColor(evertedPairColor);
                    g2.setStroke(TWO_STROKE);
                    break;
                default:
                    // make sure arclength is over our threshold
                    /*if (threshold != 0.0d && threshold < 1.0d && arcLength < axisRange.getXRange().getLength()*threshold) {
                     continue;
                     }
                     else if (threshold > 1.0d && arcLength < threshold) {
                     continue;
                     }*/

                    intervalStart = alignmentStart;

                    if (arcLength > discordantMax || arcLength < discordantMin) {
                        g2.setColor(discordantLengthColor);
                        g2.setStroke(TWO_STROKE);
                    } else {
                        g2.setColor(normalArcColor);
                        g2.setStroke(ONE_STROKE);
                    }
                    break;
                }
                int arcHeight = arcLength;

                double rectWidth = arcLength * gp.getUnitWidth();
                double rectHeight = arcHeight * 2 * gp.getUnitHeight();

                double xOrigin = gp.transformXPos(intervalStart);
                double yOrigin = gp.transformYPos(arcHeight);

                Arc2D arc = new Arc2D.Double(xOrigin, yOrigin, rectWidth, rectHeight, -180, -180, Arc2D.OPEN);
                g2.draw(arc);
                recordToShapeMap.put(record, arc);
            }
        }
    }
}