Example usage for org.jfree.util ShapeUtilities equal

List of usage examples for org.jfree.util ShapeUtilities equal

Introduction

In this page you can find the example usage for org.jfree.util ShapeUtilities equal.

Prototype

public static boolean equal(final GeneralPath p1, final GeneralPath p2) 

Source Link

Document

Tests two polygons for equality.

Usage

From source file:userinterface.graph.SeriesSettings.java

public SeriesSettings(Graph graph, Graph.SeriesKey key) {
    this.graph = graph;
    this.key = key;
    this.chart = graph.getChart();
    this.plot = chart.getXYPlot();

    /* This should really be checked first. */
    this.renderer = (XYLineAndShapeRenderer) plot.getRenderer();

    seriesHeading = new SingleLineStringSetting("heading", "heading",
            "The heading for this series, as displayed in the legend.", this, true);
    seriesColour = new ColorSetting("colour", Color.black,
            "The colour for all lines and points in this series.", this, true);
    showPoints = new BooleanSetting("show points", new Boolean(true),
            "Should points be displayed for this series?", this, true);
    String[] choices = { "Circle", "Square", "Triangle", "Horizontal Rectangle", "Vertical Rectangle", "None" };
    seriesShape = new ChoiceSetting("point shape", choices, choices[0], "The shape of points for this series.",
            this, true);
    showLines = new BooleanSetting("show lines", new Boolean(true),
            "Should lines be displayed for this series?", this, true);
    lineWidth = new DoubleSetting("line width", new Double(1.0), "The line width for this series.", this, true,
            new RangeConstraint("0.0,"));
    String[] styles = { "---------", "- - - - -", "- -- - --" };
    lineStyle = new ChoiceSetting("line style", styles, styles[0], "The line style for this series.", this,
            true);/*from   w w w. jav a  2s .  co m*/

    /** JFreeChart is smart enough to choose sensible values for colours, shapes etc. Lets try to use these if we can. */
    synchronized (graph.getSeriesLock()) {
        int seriesIndex = graph.getJFreeChartIndex(key);

        if (seriesIndex >= 0) {
            /* Set series colour. */
            if (renderer.lookupSeriesPaint(seriesIndex) instanceof Color) {
                try {
                    seriesColour.setValue((Color) renderer.getSeriesPaint(seriesIndex));
                } catch (SettingException e) {
                }
            }

            /* Set series heading. */
            try {
                seriesHeading.setValue(graph.getXYSeries(key).getKey());
            } catch (SettingException e) {
            }

            /* Set showPoints. */
            try {
                // just do it.
                Boolean pointsVisibleFlag = true;
                showPoints.setValue(new Boolean(pointsVisibleFlag == null || pointsVisibleFlag.booleanValue()));
            } catch (SettingException e) {
            }

            /* Set seriesShape. */
            Shape shape = renderer.lookupSeriesShape(seriesIndex);

            try {
                boolean foundShape = false;

                for (int i = CIRCLE; i < NONE; i++) {
                    if (ShapeUtilities.equal(shape, SHAPES[i])) {
                        seriesShape.setSelectedIndex(i);
                        foundShape = true;
                        break;
                    }
                }

                if (!foundShape)
                    seriesShape.setSelectedIndex(NONE);
            } catch (SettingException e) {
                e.printStackTrace();
            }

            /* Set showLines. */
            try {
                Boolean linesVisibleFlag = true;
                showLines.setValue(new Boolean(linesVisibleFlag == null || linesVisibleFlag.booleanValue()));
            } catch (SettingException e) {
            }
        }
    }

    updateSeries();
}

From source file:ste.travian.world.TileRenderer.java

/**
 * Tests this renderer for equality with an arbitrary object.  This method
 * returns <code>true</code> if and only if:
 * /*from  www . j  a va 2s .c  om*/
 * <ul>
 * <li><code>obj</code> is not <code>null</code>;</li>
 * <li><code>obj</code> is an instance of <code>TileRenderer</code>;</li>
 * <li>both renderers have the same attribute values.
 * </ul>
 * 
 * @param obj  the object (<code>null</code> permitted).
 * 
 * @return A boolean.
 */
public boolean equals(Object obj) {
    if (obj == this) {
        return true;
    }
    if (!(obj instanceof TileRenderer)) {
        return false;
    }
    TileRenderer that = (TileRenderer) obj;
    if (this.dotWidth != that.dotWidth) {
        return false;
    }
    if (this.dotHeight != that.dotHeight) {
        return false;
    }
    if (!ShapeUtilities.equal(this.legendShape, that.legendShape)) {
        return false;
    }
    return super.equals(obj);
}

From source file:org.pentaho.plugin.jfreereport.reportcharts.backport.XYDotRenderer.java

/**
 * Tests this renderer for equality with an arbitrary object.  This method returns <code>true</code> if and only if:
 * <p/>/*from  w  w  w  .ja  va2 s.c o  m*/
 * <ul> <li><code>obj</code> is not <code>null</code>;</li> <li><code>obj</code> is an instance of
 * <code>XYDotRenderer</code>;</li> <li>both renderers have the same attribute values. </ul>
 *
 * @param obj the object (<code>null</code> permitted).
 * @return A boolean.
 */
public boolean equals(final Object obj) {
    if (obj == this) {
        return true;
    }
    if (!(obj instanceof XYDotRenderer)) {
        return false;
    }
    final XYDotRenderer that = (XYDotRenderer) obj;
    if (this.dotWidth != that.dotWidth) {
        return false;
    }
    if (this.dotHeight != that.dotHeight) {
        return false;
    }
    if (!ShapeUtilities.equal(this.legendShape, that.legendShape)) {
        return false;
    }
    return super.equals(obj);
}

From source file:userinterface.graph.SeriesSettings.java

public void updateSeries() {
    // We don't want series to change while we are updating.
    synchronized (graph.getSeriesLock()) {
        int seriesIndex = graph.getJFreeChartIndex(key);

        if (seriesIndex >= 0) {
            /* Set series colour. */
            if (renderer.getSeriesPaint(seriesIndex) == null
                    || !renderer.getSeriesPaint(seriesIndex).equals(seriesColour)) {
                renderer.setSeriesPaint(seriesIndex, seriesColour.getColorValue());
            }// w  ww  .j a  va 2  s .  c o  m

            /* Set series heading. */
            if (!graph.getXYSeries(key).getKey().equals(seriesHeading.getStringValue())) {
                graph.changeSeriesName(key, seriesHeading.getStringValue());
                try {
                    seriesHeading.setValue(graph.getXYSeries(key).getKey());
                } catch (SettingException e) {
                }
            }

            /* Set showPoints. */
            Boolean pointsVisibleFlag = renderer.getSeriesShapesVisible(seriesIndex);

            if (pointsVisibleFlag == null || pointsVisibleFlag.booleanValue() != showPoints.getBooleanValue()) {
                renderer.setSeriesShapesVisible(seriesIndex, showPoints.getBooleanValue());
            }

            /* Set seriesShape. */
            Shape shape = renderer.getSeriesShape(seriesIndex);
            int shapeIndex = seriesShape.getCurrentIndex();

            if (!ShapeUtilities.equal(shape, SHAPES[shapeIndex]))
                renderer.setSeriesShape(seriesIndex, SHAPES[shapeIndex]);

            /* Set showLines. */
            Boolean linesVisibleFlag = renderer.getSeriesLinesVisible(seriesIndex);
            if (linesVisibleFlag == null || linesVisibleFlag.booleanValue() != showLines.getBooleanValue()) {
                renderer.setSeriesLinesVisible(seriesIndex, showLines.getBooleanValue());
            }

            /* Set stroke - hard to check*/
            if (lineStyle.getCurrentIndex() == SOLID) // solid
            {
                BasicStroke newStroke = new BasicStroke((float) lineWidth.getDoubleValue(),
                        BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 10.0f);
                renderer.setSeriesStroke(seriesIndex, newStroke);
            } else if (lineStyle.getCurrentIndex() == DASHED) // Just dash
            {
                float dash[] = { 2.0f, 3.0f };
                BasicStroke newStroke = new BasicStroke((float) lineWidth.getDoubleValue(),
                        BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 10.0f, dash, 1.0f);
                renderer.setSeriesStroke(seriesIndex, newStroke);
            } else // Funny dash
            {
                float dash[] = { 1.0f, 3.0f, 5.0f, 3.0f };
                BasicStroke newStroke = new BasicStroke((float) lineWidth.getDoubleValue(),
                        BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 10.0f, dash, 0.0f);
                renderer.setSeriesStroke(seriesIndex, newStroke);
            }
        }

        icon = new GraphSeriesIcon(renderer.getSeriesShape(seriesIndex), renderer.getSeriesStroke(seriesIndex),
                seriesColour.getColorValue(), showLines.getBooleanValue(), showPoints.getBooleanValue());
        icon.setOpaque(false);
        icon.setMinimumSize(new Dimension(20, 10));
        icon.setMaximumSize(new Dimension(50, 20));
        icon.setPreferredSize(new Dimension(30, 10));
    }
}

From source file:org.trade.ui.chart.renderer.PivotRenderer.java

/**
 * Tests this renderer for equality with an arbitrary object. This method
 * returns <code>true</code> if and only if:
 * /*  w  w w  .ja  v  a  2  s  .c om*/
 * <ul>
 * <li><code>obj</code> is not <code>null</code>;</li>
 * <li><code>obj</code> is an instance of <code>XYDotRenderer</code>;</li>
 * <li>both renderers have the same attribute values.
 * </ul>
 * 
 * @param obj
 *            the object (<code>null</code> permitted).
 * 
 * 
 * @return A boolean.
 */
public boolean equals(Object obj) {
    if (obj == this) {
        return true;
    }
    if (!(obj instanceof PivotRenderer)) {
        return false;
    }
    PivotRenderer that = (PivotRenderer) obj;
    if (this.dotWidth != that.dotWidth) {
        return false;
    }
    if (this.dotHeight != that.dotHeight) {
        return false;
    }
    if (!ShapeUtilities.equal(this.legendShape, that.legendShape)) {
        return false;
    }
    return super.equals(obj);
}

From source file:msi.gama.outputs.layers.charts.StandardXYItemRenderer.java

/**
 * Tests this renderer for equality with another object.
 *
 * @param obj/*from  www .  jav  a  2s .  c o  m*/
 *            the object (<code>null</code> permitted).
 *
 * @return A boolean.
 */
@Override
public boolean equals(final Object obj) {

    if (obj == this) {
        return true;
    }
    if (!(obj instanceof StandardXYItemRenderer)) {
        return false;
    }
    final StandardXYItemRenderer that = (StandardXYItemRenderer) obj;
    if (this.baseShapesVisible != that.baseShapesVisible) {
        return false;
    }
    if (this.plotLines != that.plotLines) {
        return false;
    }
    if (this.plotImages != that.plotImages) {
        return false;
    }
    if (this.plotDiscontinuous != that.plotDiscontinuous) {
        return false;
    }
    if (this.gapThresholdType != that.gapThresholdType) {
        return false;
    }
    if (this.gapThreshold != that.gapThreshold) {
        return false;
    }
    if (!ObjectUtilities.equal(this.shapesFilled, that.shapesFilled)) {
        return false;
    }
    if (!this.seriesShapesFilled.equals(that.seriesShapesFilled)) {
        return false;
    }
    if (this.baseShapesFilled != that.baseShapesFilled) {
        return false;
    }
    if (this.drawSeriesLineAsPath != that.drawSeriesLineAsPath) {
        return false;
    }
    if (!ShapeUtilities.equal(this.legendLine, that.legendLine)) {
        return false;
    }
    return super.equals(obj);

}

From source file:edu.dlnu.liuwenpeng.render.XYBarRenderer.java

/**
 * Tests this renderer for equality with an arbitrary object.
 * //  ww w.  ja v a  2s.  c o  m
 * @param obj  the object to test against (<code>null</code> permitted).
 * 
 * @return A boolean.
 */
public boolean equals(Object obj) {
    if (obj == this) {
        return true;
    }
    if (!(obj instanceof XYBarRenderer)) {
        return false;
    }
    if (!super.equals(obj)) {
        return false;
    }
    XYBarRenderer that = (XYBarRenderer) obj;
    if (this.base != that.base) {
        return false;
    }
    if (this.drawBarOutline != that.drawBarOutline) {
        return false;
    }
    if (this.margin != that.margin) {
        return false;
    }
    if (this.useYInterval != that.useYInterval) {
        return false;
    }
    if (!ObjectUtilities.equal(this.gradientPaintTransformer, that.gradientPaintTransformer)) {
        return false;
    }
    if (!ShapeUtilities.equal(this.legendBar, that.legendBar)) {
        return false;
    }
    if (!ObjectUtilities.equal(this.positiveItemLabelPositionFallback,
            that.positiveItemLabelPositionFallback)) {
        return false;
    }
    if (!ObjectUtilities.equal(this.negativeItemLabelPositionFallback,
            that.negativeItemLabelPositionFallback)) {
        return false;
    }
    return true;
}

From source file:edu.dlnu.liuwenpeng.render.NewXYBarRenderer.java

/**    
* Tests this renderer for equality with an arbitrary object.    
*     //from   w  ww .j  av  a2  s.c o m
* @param obj  the object to test against (<code>null</code> permitted).    
*     
* @return A boolean.    
*/
public boolean equals(Object obj) {
    if (obj == this) {
        return true;
    }
    if (!(obj instanceof NewXYBarRenderer)) {
        return false;
    }
    if (!super.equals(obj)) {
        return false;
    }
    NewXYBarRenderer that = (NewXYBarRenderer) obj;
    if (this.base != that.base) {
        return false;
    }
    if (this.drawBarOutline != that.drawBarOutline) {
        return false;
    }
    if (this.margin != that.margin) {
        return false;
    }
    if (this.useYInterval != that.useYInterval) {
        return false;
    }
    if (!ObjectUtilities.equal(this.gradientPaintTransformer, that.gradientPaintTransformer)) {
        return false;
    }
    if (!ShapeUtilities.equal(this.legendBar, that.legendBar)) {
        return false;
    }
    if (!ObjectUtilities.equal(this.positiveItemLabelPositionFallback,
            that.positiveItemLabelPositionFallback)) {
        return false;
    }
    if (!ObjectUtilities.equal(this.negativeItemLabelPositionFallback,
            that.negativeItemLabelPositionFallback)) {
        return false;
    }
    return true;
}

From source file:edu.dlnu.liuwenpeng.render.XYLineAndShapeRenderer.java

/**    
 * Tests this renderer for equality with an arbitrary object.    
 *    /* ww  w  . j a  v a 2s.co  m*/
 * @param obj  the object (<code>null</code> permitted).    
 *    
 * @return <code>true</code> or <code>false</code>.    
 */
public boolean equals(Object obj) {

    if (obj == this) {
        return true;
    }
    if (!(obj instanceof XYLineAndShapeRenderer)) {
        return false;
    }
    if (!super.equals(obj)) {
        return false;
    }
    XYLineAndShapeRenderer that = (XYLineAndShapeRenderer) obj;
    if (!ObjectUtilities.equal(this.linesVisible, that.linesVisible)) {
        return false;
    }
    if (!ObjectUtilities.equal(this.seriesLinesVisible, that.seriesLinesVisible)) {
        return false;
    }
    if (this.baseLinesVisible != that.baseLinesVisible) {
        return false;
    }
    if (!ShapeUtilities.equal(this.legendLine, that.legendLine)) {
        return false;
    }
    if (!ObjectUtilities.equal(this.shapesVisible, that.shapesVisible)) {
        return false;
    }
    if (!ObjectUtilities.equal(this.seriesShapesVisible, that.seriesShapesVisible)) {
        return false;
    }
    if (this.baseShapesVisible != that.baseShapesVisible) {
        return false;
    }
    if (!ObjectUtilities.equal(this.shapesFilled, that.shapesFilled)) {
        return false;
    }
    if (!ObjectUtilities.equal(this.seriesShapesFilled, that.seriesShapesFilled)) {
        return false;
    }
    if (this.baseShapesFilled != that.baseShapesFilled) {
        return false;
    }
    if (this.drawOutlines != that.drawOutlines) {
        return false;
    }
    if (this.useOutlinePaint != that.useOutlinePaint) {
        return false;
    }
    if (this.useFillPaint != that.useFillPaint) {
        return false;
    }
    if (this.drawSeriesLineAsPath != that.drawSeriesLineAsPath) {
        return false;
    }
    return true;

}

From source file:genlab.gui.jfreechart.EnhancedSpiderWebPlot.java

/**
 * Tests this plot for equality with an arbitrary object.
 *
 * @param obj  the object (<code>null</code> permitted).
 *
 * @return A boolean./*  ww  w  .j  a va2  s. c  o m*/
 */
public boolean equals(Object obj) {
    if (obj == this) {
        return true;
    }
    if (!(obj instanceof EnhancedSpiderWebPlot)) {
        return false;
    }
    if (!super.equals(obj)) {
        return false;
    }
    EnhancedSpiderWebPlot that = (EnhancedSpiderWebPlot) obj;
    if (!this.dataExtractOrder.equals(that.dataExtractOrder)) {
        return false;
    }
    if (this.headPercent != that.headPercent) {
        return false;
    }
    if (this.interiorGap != that.interiorGap) {
        return false;
    }
    if (this.startAngle != that.startAngle) {
        return false;
    }
    if (!this.direction.equals(that.direction)) {
        return false;
    }
    if (this.maxValue != that.maxValue) {
        return false;
    }
    if (this.webFilled != that.webFilled) {
        return false;
    }
    if (this.axisLabelGap != that.axisLabelGap) {
        return false;
    }
    if (!PaintUtilities.equal(this.axisLinePaint, that.axisLinePaint)) {
        return false;
    }
    if (!this.axisLineStroke.equals(that.axisLineStroke)) {
        return false;
    }
    if (!ShapeUtilities.equal(this.legendItemShape, that.legendItemShape)) {
        return false;
    }
    if (!PaintUtilities.equal(this.seriesPaint, that.seriesPaint)) {
        return false;
    }
    if (!this.seriesPaintList.equals(that.seriesPaintList)) {
        return false;
    }
    if (!PaintUtilities.equal(this.baseSeriesPaint, that.baseSeriesPaint)) {
        return false;
    }
    if (!PaintUtilities.equal(this.seriesOutlinePaint, that.seriesOutlinePaint)) {
        return false;
    }
    if (!this.seriesOutlinePaintList.equals(that.seriesOutlinePaintList)) {
        return false;
    }
    if (!PaintUtilities.equal(this.baseSeriesOutlinePaint, that.baseSeriesOutlinePaint)) {
        return false;
    }
    if (!ObjectUtilities.equal(this.seriesOutlineStroke, that.seriesOutlineStroke)) {
        return false;
    }
    if (!this.seriesOutlineStrokeList.equals(that.seriesOutlineStrokeList)) {
        return false;
    }
    if (!this.baseSeriesOutlineStroke.equals(that.baseSeriesOutlineStroke)) {
        return false;
    }
    if (!this.labelFont.equals(that.labelFont)) {
        return false;
    }
    if (!PaintUtilities.equal(this.labelPaint, that.labelPaint)) {
        return false;
    }
    if (!this.labelGenerator.equals(that.labelGenerator)) {
        return false;
    }
    if (!ObjectUtilities.equal(this.toolTipGenerator, that.toolTipGenerator)) {
        return false;
    }
    if (!ObjectUtilities.equal(this.urlGenerator, that.urlGenerator)) {
        return false;
    }
    return true;
}