Java 类org.jfree.chart.annotations.XYShapeAnnotation 实例源码

项目:eurocarbdb    文件:PeakListChartPanel.java   
private void showSelection() {    
thePlot.clearAnnotations();
if( selected_peaks.size()>0 ) {        
    double width = screenToDataX(6.);
    double height = screenToDataY(6.);
    double margin = screenToDataY(8.);
    for( Peak p : selected_peaks ) {
    // add annotation
    Shape shape = new Rectangle2D.Double(p.getMZ()-width/2.,p.getIntensity()-height/2.,width,height);
    if( p.equals(current_peak) ) {
        thePlot.addAnnotation( new XYShapeAnnotation(shape,new BasicStroke(2.f),Color.black) );    
        thePlot.addAnnotation( new XYTextAnnotation(new java.text.DecimalFormat("0.0000").format(p.getMZ()), p.getMZ(), p.getIntensity() + margin ) );    
    }
    else
        thePlot.addAnnotation( new XYShapeAnnotation(shape,new BasicStroke(1.f),Color.black) );    
    }
}
}
项目:eurocarbdb    文件:SpectraPanel.java   
private void showSelection() {    
thePlot.clearAnnotations();
if( selected_peaks.size()>0 ) {        
    double width = screenToDataX(6.);
    double height = screenToDataY(6.);
    double margin = screenToDataY(8.);
    for( Peak p : selected_peaks ) {
    // add annotation
    Shape shape = new Rectangle2D.Double(p.getMZ()-width/2.,p.getIntensity()-height/2.,width,height);
    if( p.equals(current_peak) ) {
        thePlot.addAnnotation( new XYShapeAnnotation(shape,new BasicStroke(2.f),Color.blue) );    
        thePlot.addAnnotation( new XYTextAnnotation(new java.text.DecimalFormat("0.0000").format(p.getMZ()), p.getMZ(), p.getIntensity() + margin ) );    
    }
    else
        thePlot.addAnnotation( new XYShapeAnnotation(shape,new BasicStroke(1.f),Color.black) );    
    }
}
}
项目:parabuild-ci    文件:XYShapeAnnotationTests.java   
/**
 * Two objects that are equal are required to return the same hashCode. 
 */
public void testHashCode() {
    XYShapeAnnotation a1 = new XYShapeAnnotation(
            new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0), 
            new BasicStroke(1.2f), Color.red, Color.blue);
    XYShapeAnnotation a2 = new XYShapeAnnotation(
            new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0), 
            new BasicStroke(1.2f), Color.red, Color.blue);
    assertTrue(a1.equals(a2));
    int h1 = a1.hashCode();
    int h2 = a2.hashCode();
    assertEquals(h1, h2);
}
项目:Benchmark    文件:ScatterPlot.java   
public static void makePoint(XYPlot xyplot, Point2D location, double radius, Color color ) {
    double x = location.getX() - radius/2;
    double y = location.getY() - radius/2;
    Shape dot = new Ellipse2D.Double(x, y, radius, radius);
    XYShapeAnnotation area = new XYShapeAnnotation(dot, new BasicStroke(), color, color );
    xyplot.addAnnotation( area );
}
项目:Benchmark    文件:ScatterPlot.java   
public static void makeTriangle(XYPlot xyplot, Point2D location, Color color ) {
    Polygon p = new Polygon();
    p.addPoint(0,0);
    p.addPoint(100,0);
    p.addPoint(100,100);
    XYShapeAnnotation area = new XYShapeAnnotation(p, new BasicStroke(), color, color );
    xyplot.addAnnotation( area );
}
项目:Benchmark    文件:ScatterPlot.java   
public static void makeOval(XYPlot xyplot, double x, double y, double w, int h, int angle) {
    x = x * Math.sqrt(2);
    Shape oval = new Ellipse2D.Double(x, y, w, h);
    Shape diag = rotate( oval, angle );
    XYShapeAnnotation area = new XYShapeAnnotation(diag, new BasicStroke(), Color.gray );
    xyplot.addAnnotation( area );
}
项目:nabs    文件:XYShapeAnnotationTests.java   
/**
 * Two objects that are equal are required to return the same hashCode. 
 */
public void testHashCode() {
    XYShapeAnnotation a1 = new XYShapeAnnotation(
            new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0), 
            new BasicStroke(1.2f), Color.red, Color.blue);
    XYShapeAnnotation a2 = new XYShapeAnnotation(
            new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0), 
            new BasicStroke(1.2f), Color.red, Color.blue);
    assertTrue(a1.equals(a2));
    int h1 = a1.hashCode();
    int h2 = a2.hashCode();
    assertEquals(h1, h2);
}
项目:astor    文件:XYShapeAnnotationTests.java   
/**
 * Two objects that are equal are required to return the same hashCode.
 */
public void testHashCode() {
    XYShapeAnnotation a1 = new XYShapeAnnotation(
            new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0),
            new BasicStroke(1.2f), Color.red, Color.blue);
    XYShapeAnnotation a2 = new XYShapeAnnotation(
            new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0),
            new BasicStroke(1.2f), Color.red, Color.blue);
    assertTrue(a1.equals(a2));
    int h1 = a1.hashCode();
    int h2 = a2.hashCode();
    assertEquals(h1, h2);
}
项目:astor    文件:XYShapeAnnotationTests.java   
/**
 * Checks that this class implements PublicCloneable.
 */
public void testPublicCloneable() {
    XYShapeAnnotation a1 = new XYShapeAnnotation(
            new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0),
            new BasicStroke(1.2f), Color.red, Color.blue);
    assertTrue(a1 instanceof PublicCloneable);
}
项目:Benchmark    文件:ScatterPlot.java   
public static void makeRect(XYPlot xyplot, Point2D location, double height, double width, Color color ) {
    Shape rect = new Rectangle2D.Double(location.getX(), location.getY(), width, height);
    XYShapeAnnotation area = new XYShapeAnnotation(rect, new BasicStroke(), color, color );
    xyplot.addAnnotation( area );
}