Package chunmap.model.geom

Examples of chunmap.model.geom.Polygon


    LineBuffer lb = new LineBuffer();
    OverLayOp op = new OverLayOp();

    // Polygon pg2 = lb.lineStringBuffer((LineString) g2, 0.1);
    Polygon pg3 = lb.lineStringBuffer((LineString) g3, 0.1);
    Polygon pg4 = lb.lineStringBuffer((LineString) g4, 0.1);

    // PointBuffer pb = new PointBuffer();
    // Polygon pg3 = pb.createBuffer(l2.firstPoint(), 0.1);

    // Polygon pgr = op.computeUnion(pg3, pg4).getGeometry(0);
View Full Code Here


    } else if (g1 instanceof LineString) {
      LineString l1 = (LineString) g1;
      return lineTo(l1, g2);

    } else if (g1 instanceof Polygon) {
      Polygon a1 = (Polygon) g1;
      return polygonTo(a1, g2);
    } else if (g1 instanceof GeometryCollection) {
      return multiTo(g1, g2);
    } else {
      throw new UnsupportedOperationException();
View Full Code Here

    } else if (g2 instanceof LineString) {
      LineString l2 = (LineString) g2;
      return new Point_LineString(p1, l2);

    } else if (g2 instanceof Polygon) {
      Polygon a2 = (Polygon) g2;
      return new Point_Polygon(p1, a2);
    } else if (g2 instanceof GeometryCollection) {
      return multiTo(p1, g2);
    } else {
      throw new UnsupportedOperationException();
View Full Code Here

    } else if (g2 instanceof LineString) {
      LineString l2 = (LineString) g2;
      return new LineString_LineString(l1, l2);

    } else if (g2 instanceof Polygon) {
      Polygon a2 = (Polygon) g2;
      return new LineString_Polygon(l1, a2);
    } else if (g2 instanceof GeometryCollection) {
      return multiTo(l1, g2);
    } else {
      throw new UnsupportedOperationException();
View Full Code Here

    } else if (g2 instanceof LineString) {
      LineString l2 = (LineString) g2;
      return new LineString_Polygon(l2, a1).setReverse(true);

    } else if (g2 instanceof Polygon) {
      Polygon a2 = (Polygon) g2;
      return new Polygon_Polygon(a1, a2);
    } else if (g2 instanceof GeometryCollection) {
      return multiTo(a1, g2);
    } else {
      throw new UnsupportedOperationException();
View Full Code Here

    }
    return ya;
  }

  public void drawPolygon(Graphics2D g, Geometry geo,View view) {
    Polygon pg = (Polygon) geo;
    Ring shell = pg.getShell();
    java.awt.Polygon shellPaht = createPolygon(shell,view);
    //shellPaht.closePath();
    Area area = new Area(shellPaht);
    for (Ring r : pg.getHoles()) {
      java.awt.Polygon holePath = createPolygon(r,view);
      //holePath.closePath();
      Area holeArea = new Area(holePath);
      area.subtract(holeArea);
    }

    g.setStroke(style.getStroke());
    if (style.isNeedArea()) {
      g.setPaint(style.getAreaColor());
      g.fill(area);
    }
    if (style.isNeedLine()) {
      g.setPaint(style.getLineColor());
      g.draw(area);
    }
    if (style.isNeedPoint()) {
      drawPoints4Line(g, shell, style,view);
      for (Ring r : pg.getHoles()) {
        drawPoints4Line(g, r, style,view);
      }
    }
  }
View Full Code Here

    return "Envelop [maxX=" + maxX + ", maxY=" + maxY + ", minX=" + minX
        + ", minY=" + minY + "]";
  }

  public Polygon toPolygon() {
    Polygon pg = new Polygon(toRing());
    pg._setValid(true);
    return pg;
  }
View Full Code Here

  }

  @Override
  protected int inner2innerDim(Geometry g1, Geometry g2) {
    LineString l1 = (LineString) g1;
    Polygon a2 = (Polygon) g2;

    ComputeIm l2r = new LineString_LinearRing(l1, a2.getShell());
    IntersectionMatrix tim = l2r.getIM();

    if (tim.get(Inner, Inner) == EmptyDim)
      return EmptyDim;

    if (a2.inHoles(l1)) {
      return EmptyDim;
    }

    return LineDim;
  }
View Full Code Here

  protected boolean within(Geometry g1, Geometry g2) {
    if (im.get(Inner, Inner) == EmptyDim)
      return false;

    LineString l1 = (LineString) g1;
    Polygon a2 = (Polygon) g2;

    if (!a2.getShell().containLineStringIn(l1)) {
      return false;
    }

    for (Ring r : a2.getHoles()) {
      ComputeIm l2r = new LineString_LinearRing(l1, r);
      IntersectionMatrix tim = l2r.getIM();
      if (tim.get(Inner, Inner) != EmptyDim) {
        return false;
      }
View Full Code Here

    g2 = a2;
  }

  @Override
  protected int inner2innerDim(Geometry g1, Geometry g2) {
    Polygon a1 = (Polygon) g1;
    Polygon a2 = (Polygon) g2;
    ComputeIm r2r = new LinearRing_LinearRing(a1.getShell(), a2
        .getShell());
    IntersectionMatrix tim = r2r.getIM();
    if (tim.get(Inner, Inner) != EmptyDim) {
      if (!inHoles(a1.getShell(), a2) && !inHoles(a2.getShell(), a1))
        return AreaDim;
    }
    return EmptyDim;
  }
View Full Code Here

TOP

Related Classes of chunmap.model.geom.Polygon

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.