Package java.awt.geom

Examples of java.awt.geom.GeneralPath


        return new Rectangle2D.Float(left, top, right-left, bottom-top);
    }

    public Shape getOutline(AffineTransform tx) {

        GeneralPath dstShape = new GeneralPath(GeneralPath.WIND_NON_ZERO);

        for (int i=0, n = 0; i < fComponents.length; i++, n += 2) {
            int vi = fComponentVisualOrder==null? i : fComponentVisualOrder[i];
            TextLineComponent tlc = fComponents[vi];

            dstShape.append(tlc.getOutline(locs[n], locs[n+1]), false);
        }

        if (tx != null) {
            dstShape.transform(tx);
        }
        return dstShape;
    }
View Full Code Here


     * @param w2v 2D affine transform
     * @return a GeneralPath generated with all the WhiteboardPoint.
     */
    private GeneralPath createPoly (AffineTransform w2v)
    {
        GeneralPath polygon = new GeneralPath (
          GeneralPath.WIND_EVEN_ODD, points.size ());
        if(points.size ()<=0)
            return polygon;
       
        WhiteboardPoint start = points.get (0);
        Point2D w = new Point2D.Double (start.getX (), start.getY ());
        Point2D v = w2v.transform (w, null);
        polygon.moveTo ((int) v.getX (), (int) v.getY ());
       
        WhiteboardPoint p;
        for (int i =0; i<points.size ();i++)
        {
            p = points.get (i);
            w = new Point2D.Double (p.getX (), p.getY ());
            v = w2v.transform (w, null);
            polygon.lineTo ((int) v.getX (), (int) v.getY ());
        }
       
        polygon.closePath ();
        return polygon;
    }
View Full Code Here

     *
     * @return a GeneralPath generated with all the WhiteboardPoint.
     */
    private GeneralPath createPolyWorld ()
    {
        GeneralPath polygon = new GeneralPath (
          GeneralPath.WIND_EVEN_ODD, points.size ());
        if(points.size ()<=0)
            return polygon;
       
        WhiteboardPoint start = points.get (0);
        polygon.moveTo ((float) start.getX (), (float) start.getY ());
       
        WhiteboardPoint p;
        for (int i =0; i<points.size ();i++)
        {
            p = points.get (i);
            polygon.lineTo ((float) p.getX (), (float) p.getY ());
        }
       
        polygon.closePath ();
        return polygon;
    }
View Full Code Here

     * @param w2v 2D affine transform
     * @return a GeneralPath generated with all the WhiteboardPoint.
     */
    private GeneralPath createPoly (AffineTransform w2v)
    {
        GeneralPath polyline = new GeneralPath (
          GeneralPath.WIND_EVEN_ODD, points.size ());
        if(points.size ()<=0)
            return polyline;
        WhiteboardPoint start = points.get (0);
        Point2D w = new Point2D.Double (start.getX (), start.getY ());
        Point2D v = w2v.transform (w, null);
        polyline.moveTo ((int) v.getX (), (int) v.getY ());
        WhiteboardPoint p;
        for (int i =0; i<points.size ();i++)
        {
            p = points.get (i);
            w = new Point2D.Double (p.getX (), p.getY ());
            v = w2v.transform (w, null);
            polyline.lineTo ((int) v.getX (), (int) v.getY ());
        }
       
        return polyline;
    }
View Full Code Here

     *
     * @return a GeneralPath generated with all the WhiteboardPoint.
     */
    private GeneralPath createPolyWorld ()
    {
        GeneralPath polyline = new GeneralPath (
          GeneralPath.WIND_EVEN_ODD, points.size ());
        if(points.size ()<=0)
            return polyline;
        WhiteboardPoint start = points.get (0);
        polyline.moveTo ((float) start.getX (), (float) start.getY ());
       
        WhiteboardPoint p;
        for (int i =0; i<points.size ();i++)
        {
            p = points.get (i);
            polyline.lineTo ((float) p.getX (), (float) p.getY ());
        }
       
        return polyline;
    }
View Full Code Here

    Point2D pt3 = arc2.getEndPoint();
    Arc2D arc3 = new Arc2D.Double(widthRect, angle - 180.0, 0.0,
        Arc2D.OPEN);
    Point2D pt4 = arc3.getStartPoint();

    GeneralPath gp = new GeneralPath();
    gp.moveTo((float) pt1.getX(), (float) pt1.getY());
    gp.lineTo((float) pt2.getX(), (float) pt2.getY());
    gp.lineTo((float) pt4.getX(), (float) pt4.getY());
    gp.lineTo((float) pt3.getX(), (float) pt3.getY());
    gp.closePath();
    g2.setPaint(this.fillPaint);
    g2.fill(gp);

    g2.setPaint(this.getOutlinePaint());
    Line2D line = new Line2D.Double(frame.getCenterX(),
View Full Code Here

    double y0 = bar.getMinY() - getYOffset();
    double y1 = bar.getMinY();
    double y2 = bar.getMaxY() - getYOffset();
    double y3 = bar.getMaxY();

    GeneralPath bar3dRight = null;
    GeneralPath bar3dTop = null;
    if (barLength > 0.0) {
      bar3dRight = new GeneralPath();
      bar3dRight.moveTo((float) x2, (float) y3);
      bar3dRight.lineTo((float) x2, (float) y1);
      bar3dRight.lineTo((float) x3, (float) y0);
      bar3dRight.lineTo((float) x3, (float) y2);
      bar3dRight.closePath();

      if (itemPaint instanceof Color) {
        g2.setPaint(((Color) itemPaint).darker());
      }
      else if (itemPaint instanceof GradientPaint)
      {
        GradientPaint gp = (GradientPaint)itemPaint;
        g2.setPaint(
          new StandardGradientPaintTransformer().transform(
            new GradientPaint(gp.getPoint1(), gp.getColor1().darker(), gp.getPoint2(), gp.getColor2().darker(), gp.isCyclic()),
            bar3dRight
            )
          );
      }
      g2.fill(bar3dRight);
    }

    bar3dTop = new GeneralPath();
    bar3dTop.moveTo((float) x0, (float) y1);
    bar3dTop.lineTo((float) x1, (float) y0);
    bar3dTop.lineTo((float) x3, (float) y0);
    bar3dTop.lineTo((float) x2, (float) y1);
    bar3dTop.closePath();
    g2.fill(bar3dTop);

    if (isDrawBarOutline()
      && state.getBarWidth() > BAR_OUTLINE_WIDTH_THRESHOLD)
    {
      g2.setStroke(getItemOutlineStroke(row, column));
      g2.setPaint(getItemOutlinePaint(row, column));
      g2.draw(bar);
      if (bar3dRight != null) {
        g2.draw(bar3dRight);
      }
      if (bar3dTop != null) {
        g2.draw(bar3dTop);
      }
    }

    CategoryItemLabelGenerator generator
    = getItemLabelGenerator(row, column);
    if (generator != null && isItemLabelVisible(row, column)) {
      drawItemLabel(g2, dataset, row, column, plot, generator, bar, (value < 0.0));
    }

    // add an item entity, if this information is being collected
    EntityCollection entities = state.getEntityCollection();
    if (entities != null) {
      GeneralPath barOutline = new GeneralPath();
      barOutline.moveTo((float) x0, (float) y3);
      barOutline.lineTo((float) x0, (float) y1);
      barOutline.lineTo((float) x1, (float) y0);
      barOutline.lineTo((float) x3, (float) y0);
      barOutline.lineTo((float) x3, (float) y2);
      barOutline.lineTo((float) x2, (float) y3);
      barOutline.closePath();
      addItemEntity(entities, dataset, row, column, barOutline);
    }
  }
View Full Code Here

    // Check pieces rotation
    assertEquals("Piece angle is wrong", angle, piece1.getAngle());
    assertEquals("Piece angle is wrong", angle, piece2.getAngle());
    assertEquals("Group angle is wrong", angle, group.getAngle());
    // Check surrounding rectangles
    Rectangle2D rotatedGroupRectangle = new GeneralPath(groupRectangle).createTransformedShape(
        AffineTransform.getRotateInstance(angle, groupRectangle.getCenterX(), groupRectangle.getCenterY())).getBounds2D();
    groupRectangle = getSurroundingRectangle(group);
    assertEquals("Surrounding rectangle is incorrect", rotatedGroupRectangle, groupRectangle);
    piecesRectangle = getSurroundingRectangle(piece1);
    piecesRectangle.add(getSurroundingRectangle(piece2));
View Full Code Here

    if (this.roomPathsCache == null) {
      // Iterate over all the paths the walls area contains
      List<GeneralPath> roomPaths = new ArrayList<GeneralPath>();
      Area wallsArea = getWallsArea();
      Area insideWallsArea = new Area(wallsArea);
      GeneralPath roomPath = new GeneralPath();
      for (PathIterator it = wallsArea.getPathIterator(null, 0.5f); !it.isDone(); ) {
        float [] roomPoint = new float[2];
        switch (it.currentSegment(roomPoint)) {
          case PathIterator.SEG_MOVETO :
            roomPath.moveTo(roomPoint [0], roomPoint [1]);
            break;
          case PathIterator.SEG_LINETO :
            roomPath.lineTo(roomPoint [0], roomPoint [1]);
            break;
          case PathIterator.SEG_CLOSE :
            roomPath.closePath();
            insideWallsArea.add(new Area(roomPath));             
            roomPaths.add(roomPath);
            roomPath = new GeneralPath();
            break;
        }
        it.next();       
      }
     
View Full Code Here

 
  /**
   * Returns the shape matching the coordinates in <code>points</code> array.
   */
  private GeneralPath getPath(float [][] points) {
    GeneralPath path = new GeneralPath();
    path.moveTo(points [0][0], points [0][1]);
    for (int i = 1; i < points.length; i++) {
      path.lineTo(points [i][0], points [i][1]);
    }
    path.closePath();
    return path;
  }
View Full Code Here

TOP

Related Classes of java.awt.geom.GeneralPath

Copyright © 2018 www.massapicom. 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.