Examples of Line2D


Examples of java.awt.geom.Line2D

    Point2D one = new Point2D.Double(xx + 6, yy + hh / 2);
    // calculate point two
    Point2D two = new Point2D.Double(xx + ww - 6, yy + hh / 2);

    // draw a line connecting the points
    Line2D line = new Line2D.Double(one, two);
    if (stroke != null) {
      g2.setStroke(stroke);
    }
    else{
      g2.setStroke(new BasicStroke());
View Full Code Here

Examples of java.awt.geom.Line2D

        // determine the end points
        double lX = center_x + (lLineValue * Math.sin(lRotation));
        double lY = center_y + (lLineValue * Math.cos(lRotation));

        // draw the line
        Line2D lLine = new Line2D.Double(center_x, center_y, lX, lY);
            g.setColor(Color.black);
            g.draw(lLine);

        // add to polygone
        if (lCol == 0) filledPolygon.moveTo((float)lX, (float)lY);
        else filledPolygon.lineTo((float)lX, (float)lY);           
      }
     
      // draw the polygone
      filledPolygon.closePath();
      g.setPaint( rcm.getColor(lRow) );
      g.draw(filledPolygon);
        }
       
        double lRotation;
        double lX;
        double lY;
        TextLayout lLabel;

    // draw the lines
    for (int lCol = 0; lCol < lNumberOfColumns; lCol++)
    {
      // determine rotation: there are 2PI/noOfCols vertexes, this is vertex no lCol   
      // -1 : we want to rotate clockwise
      // + PI: rotate 180 degree to get the first column pointing up
            // Math.PI ... - Math.PI
      lRotation = (-1 * (2 * Math.PI / lNumberOfColumns) * lCol) + Math.PI;

      // determine the end points
      lX = center_x + (lRadius * Math.sin(lRotation));
      lY = center_y + (lRadius * Math.cos(lRotation));

      // draw the line
      Line2D lLine = new Line2D.Double(center_x, center_y, lX, lY );
          g.setColor(Color.black);
          g.draw(lLine);

          // draw the label
          lLabel = new TextLayout("" + model.getColumnValueAt(lCol), new Font("Courier", Font.BOLD, 9), new FontRenderContext(null, true, false));
View Full Code Here

Examples of java.awt.geom.Line2D

    gp.closePath();
    g2.setPaint(this.fillPaint);
    g2.fill(gp);

    g2.setPaint(this.getOutlinePaint());
    Line2D line = new Line2D.Double(frame.getCenterX(),
        frame.getCenterY(), pt1.getX(), pt1.getY());
//    g2.draw(line);

    line.setLine(pt2, pt3);
    g2.draw(line);

    line.setLine(pt3, pt1);
    g2.draw(line);

    line.setLine(pt2, pt1);
    g2.draw(line);

    line.setLine(pt2, pt4);
    g2.draw(line);

    line.setLine(pt3, pt4);
    g2.draw(line);
  }
View Full Code Here

Examples of java.awt.geom.Line2D

        this.getTickRadius() - this.getTickLabelOffset());
   
    boolean firstLabel = true;
   
    Arc2D arc = new Arc2D.Double();
    Line2D workingLine = new Line2D.Double();
    Stroke arcStroke = new BasicStroke(0.75f);
   
    for (double v = this.getLowerBound(); v <= this.getUpperBound();
        v += this.getMajorTickIncrement()) {
      arc.setArc(arcRect, this.getStartAngle(), valueToAngle(v)
          - this.getStartAngle(), Arc2D.OPEN);
      g2.setPaint(this.getMajorTickPaint());
      g2.setStroke(arcStroke);
      g2.draw(arc);
     
      Point2D pt0 = arc.getEndPoint();
      arc.setArc(arcRectMajor, this.getStartAngle(), valueToAngle(v)
          - this.getStartAngle(), Arc2D.OPEN);
      Point2D pt1 = arc.getEndPoint();
      g2.setPaint(this.getMajorTickPaint());
      g2.setStroke(this.getMajorTickStroke());
      workingLine.setLine(pt0, pt1);
      g2.draw(workingLine);
      arc.setArc(arcRectForLabels, this.getStartAngle(), valueToAngle(v)
          - this.getStartAngle(), Arc2D.OPEN);
      Point2D pt2 = arc.getEndPoint();
     
      if (this.getTickLabelsVisible()) {
        if (!firstLabel || this.getFirstTickLabelVisible()) {
          g2.setFont(this.getTickLabelFont());
          TextUtilities.drawAlignedString(
              this.getTickLabelFormatter().format(v), g2,
              (float) pt2.getX(), (float) pt2.getY(),
              TextAnchor.CENTER);
        }
      }
      firstLabel = false;
     
      // now do the minor tick marks
      if (this.getMinorTickCount() > 0 && this.getMinorTickLength() > 0.0) {
        double minorTickIncrement = this.getMajorTickIncrement()
            / (this.getMinorTickCount() + 1);
        for (int i = 0; i < this.getMinorTickCount(); i++) {
          double vv = v + ((i + 1) * minorTickIncrement);
          if (vv >= this.getUpperBound()) {
            break;
          }
          double angle = valueToAngle(vv);

          arc.setArc(arcRect, this.getStartAngle(), angle
              - this.getStartAngle(), Arc2D.OPEN);
          pt0 = arc.getEndPoint();
          arc.setArc(arcRectMinor, this.getStartAngle(), angle
              - this.getStartAngle(), Arc2D.OPEN);
          Point2D pt3 = arc.getEndPoint();
          g2.setStroke(this.getMinorTickStroke());
          g2.setPaint(this.getMinorTickPaint());
          workingLine.setLine(pt0, pt3);
          g2.draw(workingLine);
        }
      }
     
    }
View Full Code Here

Examples of java.awt.geom.Line2D

        else if(constraints.getMaximumValue().doubleValue() < 0)
            ypt = constraints.getMaximumValue().doubleValue();
       
        Point2D p = new Point2D.Double(0.0, 0.0);
        Point2D v;
        Line2D ticks = new Line2D.Double(0.0, 0.0, 0.0, 0.0);
       
    DecimalFormat df = c.getXDecimalFormat();
    FontRenderContext frc = c.getFontRenderContext();
        Font f = c.getFont();
       
    boolean paint = false;
   
        g.setFont(f);
        boolean paintLabels = c.isPaintLabels();
       
        for(double d = min; d <= max; d += tick) {
            p.setLocation(d, ypt);
            v = at.transform(p, null);
           
            ticks.setLine(v.getX(), v.getY() - marginOffset/2, v.getX(), v.getY() + marginOffset/2);
            g.draw(ticks);
            if(paint && paintLabels) {
                String sb = df.format(d);
                Rectangle2D r = f.getStringBounds(sb, frc);
               
View Full Code Here

Examples of java.awt.geom.Line2D

       
        Point2D p = new Point2D.Double(0.0, 0.0);
        Point2D v = null;
        Point2D oldv = null;
       
        Line2D ticks = new Line2D.Double(0.0, 0.0, 0.0, 0.0);
       
    DecimalFormat df = c.getXDecimalFormat();
    FontRenderContext frc = c.getFontRenderContext();
        Font f = c.getFont();
       
        boolean paint = false;
        boolean paintLabels = c.isPaintLabels();
        g.setFont(f);
       
        for(int i = min - 1; i < max; i++) {
            p.setLocation(i + 1, ypt);
           
            v = at.transform(p, null);
           
            ticks.setLine(v.getX(), v.getY() - marginOffset/2, v.getX(), v.getY() + marginOffset/2);
           
            if(i + 1 < max)
                g.draw(ticks);
           
            // Draw Strings between ticks
View Full Code Here

Examples of java.awt.geom.Line2D

        else if(constraints.getMaximumColumnValue() < 0 && c.getSecondYAxis() != null)
            xpt = constraints.getMaximumColumnValue();
       
        Point2D p = new Point2D.Double(0.0, 0.0);
        Point2D v;
        Line2D ticks = new Line2D.Double(0.0, 0.0, 0.0, 0.0);
        boolean paint = false;
       
        DecimalFormat df = c.getYDecimalFormat();
    FontRenderContext frc = c.getFontRenderContext();
        Font f = c.getFont();
   
    Color backupColor = g.getColor();
        g.setFont(f);
        boolean paintLabels = c.isPaintLabels();
       
        for(double d = min; d <= max; d += tick) {
            p.setLocation(xpt, d);
            v = at.transform(p, null);
           
            ticks.setLine(v.getX() - marginOffset/2, v.getY(), v.getX() + marginOffset/2, v.getY());
           
      g.draw(ticks);
     
      if (d != min && !c.isPaintOnlyTick()) {
                Line2D xax = getXAxisLine2D();
                ticks.setLine(v.getX() + marginOffset/2, v.getY(), xax.getX2(), v.getY());
                g.setColor(Color.lightGray);
                g.draw(ticks);
                g.setColor(backupColor);
            }
           
View Full Code Here

Examples of java.awt.geom.Line2D

     * @param g the <CODE>Graphics2D</CODE> object to paint in
     */
    public void paintDefault(Graphics2D g) {
        g.setColor(Color.black);
       
        Line2D x = c.getXAxisLine2D();
        Line2D y = c.getYAxisLine2D();
       
        g.draw(x);
        g.draw(y);
       
        // draw X-Axis Arrow
    if(shouldDrawArrows) {
      g.drawLine((int)x.getX2(), (int)x.getY2(), (int)x.getX2() + ARROWLENGTH, (int)x.getY2());
      g.fillPolygon(new int[] {(int)(x.getX2() + ARROWLENGTH / 3.0),
            (int)(x.getX2() + ARROWLENGTH / 3.0),
            (int)(x.getX2() + ARROWLENGTH)},
            new int[] {(int)x.getY2() - 3, (int)x.getY2() + 3, (int)x.getY2()},
            3);
    }
       
        // draw X-Axis label right below the Arrow ?!
        g.setColor(Color.black);
        TextLayout layoutX = new TextLayout(getXAxisUnit(), getFont(),
                                           new FontRenderContext(null, true, false));
    layoutX.draw(g, (float)x.getX2() + (float)ARROWLENGTH / 3(float)x.getY2() + (float)layoutX.getBounds().getHeight() + 5);
       
        // draw Y-Axis Arrow
    if(shouldDrawArrows) {
      g.drawLine((int)y.getX1(), (int)y.getY1(), (int)y.getX1(), (int)y.getY1() - ARROWLENGTH);
      g.fillPolygon(new int[] {(int)(y.getX1() - 3),
            (int)(y.getX1() + 3),
            (int)(y.getX1())},
            new int[] {(int)(y.getY1() - ARROWLENGTH / 3.0),
            (int)(y.getY1() - ARROWLENGTH / 3.0),
            (int)y.getY1() - ARROWLENGTH},
            3);
    }

        // draw Y-Axis label right below the Arrow ?!
        g.setColor(Color.black);
        TextLayout layoutY = new TextLayout(getYAxisUnit(), getFont(),
                                           new FontRenderContext(null, true, false));
        layoutY.draw(g, (float)y.getX1()-6-(float)layoutY.getBounds().getWidth(),
                        (float)y.getY1() - layoutX.getDescent() - 3);
       
        if(getSecondYAxis() != null) {
            Line2D y2 = c.getSecondYAxisLine2D();
            g.draw(y2);
        }
       
        if(model.isColumnNumeric())
            c.drawNumericalXAxisTicks(g);
View Full Code Here

Examples of java.awt.geom.Line2D

    /* (non-Javadoc)
     * @see org.jpox.store.mapping.JavaTypeMapping#setObject(org.jpox.ObjectManager, java.lang.Object, int[], java.lang.Object)
     */
    public void setObject(ObjectManager om, Object preparedStatement, int[] exprIndex, Object value)
    {
      Line2D line = (Line2D)value;
        if (line == null)
        {
        for (int i = 0; i < exprIndex.length; i++)
        {
          getDataStoreMapping(i).setObject(preparedStatement, exprIndex[i], null);         
      }
        }
        else
        {
            getDataStoreMapping(0).setDouble(preparedStatement,exprIndex[0],line.getX1());
            getDataStoreMapping(1).setDouble(preparedStatement,exprIndex[1],line.getY1());
            getDataStoreMapping(2).setDouble(preparedStatement,exprIndex[2],line.getX2());
            getDataStoreMapping(3).setDouble(preparedStatement,exprIndex[3],line.getY2());
        }
    }
View Full Code Here

Examples of java.awt.geom.Line2D

   * the point at (<code>x</code>, <code>y</code>)
   * with a given <code>margin</code> around the wall start line.
   */
  public boolean containsWallStartAt(float x, float y, float margin) {
    float [][] wallPoints = getPoints();
    Line2D startLine = new Line2D.Float(wallPoints [0][0], wallPoints [0][1],
        wallPoints [wallPoints.length - 1][0], wallPoints [wallPoints.length - 1][1]);
    return containsShapeAtWithMargin(startLine, x, y, margin);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.