Examples of PathIterator


Examples of java.awt.geom.PathIterator

     * the points. The flattening is used for a
     * FlatteningPathIterator, controlling the scope of the path
     * traversal.
     */
    public static void describeShapeDetail(Shape shape, double flattening) {
        PathIterator pi2 = shape.getPathIterator(null);
        FlatteningPathIterator pi = new FlatteningPathIterator(pi2, flattening);
        double[] coords = new double[6];
        int pointCount = 0;

        Debug.output(" -- start describeShapeDetail with flattening["
View Full Code Here

Examples of java.awt.geom.PathIterator

        if (toShape == null) {
            return addShape;
        }

        PathIterator pi2 = addShape.getPathIterator(null);
        FlatteningPathIterator pi = new FlatteningPathIterator(pi2, .25);
        double[] coords = new double[6];

        while (!pi.isDone()) {
            int type = pi.currentSegment(coords);
View Full Code Here

Examples of java.awt.geom.PathIterator

                        woffset = rw;
                    }

                    AffineTransform at = new AffineTransform();
                    at.rotate(rotationAngle, rx + woffset, pt.y);
                    PathIterator pi = shape.getPathIterator(at);
                    GeneralPath gp = new GeneralPath();
                    gp.append(pi, false);
                    shape = gp;
                }
            }
View Full Code Here

Examples of java.awt.geom.PathIterator

                Shape shape = graphic.getShape();
                if (shape == null)
                    continue;

                PathIterator path = shape.getPathIterator(new AffineTransform());
                int segment = 0;
                int itemsInPath = 0;
                boolean pathValid = true;

                for (; !path.isDone() && pathValid; path.next()) {
                    int type = path.currentSegment(points);
                    itemsInPath++;
                    boolean offScreen = false;
                    if (points[0] < 0 || points[0] >= width) {
                        // logger.warning("skipping x point " +
                        // points[0] + " b/c it's off the map.");
View Full Code Here

Examples of java.awt.geom.PathIterator

  //
  //
 
 
  private void followPath(Shape s, int drawType) {
    PathIterator points;
   
      if (s==null) return;
     
      if (drawType==STROKE) {
          if (!(stroke instanceof BasicStroke)) {
              s = stroke.createStrokedShape(s);
              followPath(s, FILL);
              return;
          }
      }
//      if (drawType==STROKE) {
//          setStrokeDiff(stroke, oldStroke);
//          oldStroke = stroke;
//          setStrokePaint();
//      }
//      else if (drawType==FILL)
//          setFillPaint();
      points = s.getPathIterator(IDENTITY);
      int segments = 0;
      float[] coords = new float[6];
      while(!points.isDone()) {
          segments++;
          int segtype = points.currentSegment(coords);
          switch(segtype) {
              case PathIterator.SEG_CLOSE:
                pw.print("h ");
                  break;

              case PathIterator.SEG_CUBICTO:
                  curveto(coords[0], coords[1], coords[2], coords[3], coords[4], coords[5]);
                  break;

              case PathIterator.SEG_LINETO:
                  lineto(coords[0], coords[1]);
                  break;

              case PathIterator.SEG_MOVETO:
                  moveto(coords[0], coords[1]);
                  break;

              case PathIterator.SEG_QUADTO:
                  curveto(coords[0], coords[1], coords[2], coords[3]);
                  break;
          }
          points.next();
      }
     
      switch (drawType) {
      case FILL:
          if (segments > 0) {
              if (points.getWindingRule() == PathIterator.WIND_EVEN_ODD)
                closeBlock("B*");
              else
                closeBlock("B");
          }
          break;
      case STROKE:
          if (segments > 0)
              closeBlock("S");
          break;
      case CLIP:
      default: //drawType==CLIP
          if (segments == 0)
              drawRect(0, 0, 0, 0);
          if (points.getWindingRule() == PathIterator.WIND_EVEN_ODD)
            closeBlock("W*");
          else
            closeBlock("W");
      }
  }
View Full Code Here

Examples of java.awt.geom.PathIterator

    // converts circles into polygons
    public static OMPoly convert(OMCircle omCircle, Projection proj) {
        GeneralPath shape = omCircle.getShape();

        // get the PathIterator that defines the outline of the circle
        PathIterator circle = shape.getPathIterator(null);
        Vector initialPoints = new Vector();
        float[] segPoints = new float[2];

        while (!circle.isDone()) {
            // by passing segpoints the array is filled with each x\y
            // point iterated by the circle
//            int segType = circle.currentSegment(segPoints);
            initialPoints.add(new Float(segPoints[0]));
            initialPoints.add(new Float(segPoints[1]));
            circle.next();
        }

        float[] circlePoints = new float[initialPoints.size()];

        if (proj == null) {
View Full Code Here

Examples of java.awt.geom.PathIterator

        int refreshCounter = bufferSize;
        int[] stripCount = new int[1];
        stripCount[0] = 0;

        // null is AffineTransform...
        PathIterator pi2 = shape.getPathIterator(null);

        // flatness might need to be calculated, based
        // on scale or something. Depends on how many
        // points there should be for an accurate
        // shape rendition.
View Full Code Here

Examples of java.awt.geom.PathIterator

        maxy=my;
        scalex=sx;
        scaley=sy;

        if (drawBars){
            PathIterator p=getPathIterator(null);
            double[] v=new double[2];
            double currentValue=Double.NEGATIVE_INFINITY;
           
            if (p instanceof CurveIterator){
                CurveIterator cu = (CurveIterator)p;

                while(!cu.isDone()){
                    cu.currentSegment(v);
                    if (cu.currentSegmentIsValid){
                        int xpos = (int)Math.round(v[0]);
                        g2.drawLine(xpos, 0, xpos, -height);

                        // display a label on the bar
                        double value = cu.currentYSourceValue;
                        if (value!=currentValue){
                            currentValue=value;
                            String ySourceValue =  new Double(currentValue).toString();
                            LabelShape label = new LabelShape(ySourceValue,xpos, -height,  LabelShape.RIGHTUP, true);
                            label.draw(g2);
                        }
                    }
                    cu.next();
                }
            }

        }else{
            g2.draw(this)
            if(showPoints){
                Color oldColor = g2.getColor();
                float[] hsbs = new float[3];
                Color.RGBtoHSB(oldColor.getRed(), oldColor.getGreen(), oldColor.getBlue(), hsbs);
                float bb=(float)((hsbs[2]+0.5)%1.0);
                Color newColor = Color.getHSBColor(hsbs[0], hsbs[1], bb);
                g2.setColor(newColor);

                Stroke oldStroke = g2.getStroke();
                g2.setStroke(new BasicStroke());

                PathIterator p=getPathIterator(null);
                if (p instanceof CurveIterator){
                    CurveIterator cu = (CurveIterator)p;
                    double[] v=new double[2];
                    while(!cu.isDone()){
                        cu.currentSegment(v);
View Full Code Here

Examples of java.awt.geom.PathIterator

    return new Rectangle2D.Double(x, y, height, width);
  }
 
  /** Returns the object's PathIterator. */
  public PathIterator getPathIterator(AffineTransform at) {
    return new PathIterator() {
      int state = 0;
      int maxstate = 4;
      float[][] fcurrentSegment = { {(float)(x + width/2), (float)y, 0f, 0f, 0f, 0f},
                      {(float)x, (float)(y + height/2), 0f, 0f, 0f, 0f},
                      {(float)(x + width/2), (float)(y + height), 0f, 0f, 0f, 0f},
View Full Code Here

Examples of java.awt.geom.PathIterator

    public double getHeight() {
        return height;
    }
   
    public PathIterator getPathIterator(AffineTransform affineTransform) {
        return new PathIterator() {
      int state = 0;
      int maxstate = 3;
           
      double[][] dcurrentSegment = {{x + width/2, y},
                      {x, y + height},
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.