Package chunmap.model.geom

Examples of chunmap.model.geom.Polygon


    WktReader wkt = new WktReader();
    Geometry g = wkt.read("LINESTRING(2.0 2.0,0.0 0.0)");
    Geometry g2 = wkt
        .read("POLYGON((0.98 0.94,1.0466666666666666 0.94,1.0466666666666666 1.0066666666666666,0.98 1.0066666666666666,0.98 0.94))");
    LineString ls = (LineString) g;
    Polygon pg = (Polygon) g2;

    // IntersectionMatrix rt = ComputeIm.getInstance().getIM(ls, pg);
    LineString_Polygon l2a = new LineString_Polygon(ls, pg);
    IntersectionMatrix rt = l2a.getIM();
    assertTrue(rt.get(IntersectionMatrix.Inner, IntersectionMatrix.Inner) != IntersectionMatrix.EmptyDim);
View Full Code Here


    Geometry g = wkt
        .read("LINESTRING(1.0 6.0,5.999998414659173 1.0039816335536662,1.0079632645824341 -3.999993658637697,-3.9999857319385903 0.9880551094385923,1.0 6.0)");
    Geometry g2 = wkt
        .read("POLYGON((-2.639991350383829 -1.7999950537374092,-1.8399918576928131 -1.7999950537374092,-1.8399918576928131 -0.9999955610463935,-2.639991350383829 -0.9999955610463935,-2.639991350383829 -1.7999950537374092))");
    LineString ls = (LineString) g;
    Polygon pg = (Polygon) g2;

    LineString_LinearRing l2a = new LineString_LinearRing(ls, pg.getShell());
    IntersectionMatrix rt = l2a.getIM();
    assertTrue(rt.get(IntersectionMatrix.Inner, IntersectionMatrix.Inner) != IntersectionMatrix.EmptyDim);

  }
View Full Code Here

    Geometry g = wkt
        .read("LINESTRING(1.0 6.0,5.999998414659173 1.0039816335536662,1.0079632645824341 -3.999993658637697,-3.9999857319385903 0.9880551094385923,1.0 6.0)");
    Geometry g2 = wkt
        .read("POLYGON((3.3400048574815147 -2.1999948000829175,4.140004350172529 -2.1999948000829175,4.140004350172529 -1.399995307391901,3.3400048574815147 -1.399995307391901,3.3400048574815147 -2.1999948000829175))");
    LineString ls = (LineString) g;
    Polygon pg = (Polygon) g2;

    // IntersectionMatrix rt = ComputeIm.getInstance().getIM(ls, pg);
    LineString_LinearRing l2a = new LineString_LinearRing(ls, pg.getShell());
    IntersectionMatrix rt = l2a.getIM();
    assertTrue(rt.get(IntersectionMatrix.Inner, IntersectionMatrix.Inner) != IntersectionMatrix.EmptyDim);

  }
View Full Code Here

  private void addRing(Ring r, List<Polygon> pgs) {
    List<Polygon> newPgs = new ArrayList<Polygon>();
    List<Polygon> oldPgs = new ArrayList<Polygon>();
    for (int i = 0, n = pgs.size(); i < n; i++) {
      Polygon pg = pgs.get(i);
      if (r.containLineStringIn(pg.getShell())) {
        List<Ring> rr = new ArrayList<Ring>();
        rr.add(pg.getShell());
        newPgs.add(new Polygon(r, rr));
        oldPgs.add(pg);
      } else if (pg.getShell().containLineStringIn(r)) {
        List<Ring> rr = new ArrayList<Ring>();
        rr.add(r);
        newPgs.add(new Polygon(pg.getShell(), rr));
        oldPgs.add(pg);
      }
    }

    if (newPgs.size() == 0) {
      pgs.add(new Polygon(r));
    } else {
      for (Polygon pg : oldPgs) {
        pgs.remove(pg);
      }
      pgs.addAll(newPgs);
View Full Code Here

  @Test
  public void testGetIM() {
    WktReader wkt = new WktReader();
    Geometry g = wkt
        .read("POLYGON((-5 -8,10 -20,20 15,-10 10,-5 -8),(1 2,3 1,4 0,3 -2,0 0,1 2))");
    Polygon pg = (Polygon) g;
    Geometry g2 = wkt.read("POLYGON((1 0.5,3 0.5,3.5 0,3 -1,1 0,1 0.5))");
    Polygon pg2 = (Polygon) g2;
    Geometry g3 = wkt.read("POLYGON((4 0.5,6 0.5,6.5 0,6 -1,4 0,4 0.5))");
    Polygon pg3 = (Polygon) g3;

    IntersectionMatrix rt = ComputeImFactory.getInstance().getImComputer(
        pg, pg2).getIM();
    assertTrue(rt.match(IntersectionMatrix.DisjointPattern));
View Full Code Here

  @Test
  public void testGetIM2() {
    WktReader wkt = new WktReader();
    Geometry g = wkt.read("POLYGON((1 2,3 1,4 0,3 -2,0 0,1 2))");
    Polygon pg = (Polygon) g;
    Geometry g2 = wkt.read("POLYGON((-5 -8,10 -20,20 15,-10 10,-5 -8))");
    Polygon pg2 = (Polygon) g2;
    Geometry g3 = wkt.read("POLYGON((4 0.5,6 0.5,6.5 0,6 -1,4 0,4 0.5))");
    Polygon pg3 = (Polygon) g3;

    IntersectionMatrix rt = ComputeImFactory.getInstance().getImComputer(
        pg, pg2).getIM();
    // Polygon_Polygon l2a1 = new Polygon_Polygon(pg, pg2);
    // IntersectionMatrix rt = l2a1.getIM();
View Full Code Here

  @Test
  public void testGetIM3() {
    WktReader wkt = new WktReader();
    Geometry g = wkt
        .read("POLYGON((-2.639991350383829 -1.7999950537374092,-1.8399918576928131 -1.7999950537374092,-1.8399918576928131 -0.9999955610463935,-2.639991350383829 -0.9999955610463935,-2.639991350383829 -1.7999950537374092))");
    Polygon pg = (Polygon) g;
    Geometry g2 = wkt
        .read("POLYGON((1.0 6.0,5.999998414659173 1.0039816335536662,1.0079632645824341 -3.999993658637697,-3.9999857319385903 0.9880551094385923,1.0 6.0))");
    Polygon pg2 = (Polygon) g2;

    // IntersectionMatrix rt = ComputeImFactory.getInstance().getImComputer(
    // pg, pg2).getIM();
    LinearRing_LinearRing r2r = new LinearRing_LinearRing(pg.getShell(),
        pg2.getShell());
    IntersectionMatrix rt = r2r.getIM();
    assertTrue(!rt.match(IntersectionMatrix.DisjointPattern));
  }
View Full Code Here

  @Test
  public void testGetIM4() {
    WktReader wkt = new WktReader();
    Geometry g = wkt
        .read("POLYGON((3.3400048574815147 -2.1999948000829175,4.140004350172529 -2.1999948000829175,4.140004350172529 -1.399995307391901,3.3400048574815147 -1.399995307391901,3.3400048574815147 -2.1999948000829175))");
    Polygon pg = (Polygon) g;
    Geometry g2 = wkt
        .read("POLYGON((1.0 6.0,5.999998414659173 1.0039816335536662,1.0079632645824341 -3.999993658637697,-3.9999857319385903 0.9880551094385923,1.0 6.0))");
    Polygon pg2 = (Polygon) g2;

    // IntersectionMatrix rt = ComputeImFactory.getInstance().getImComputer(
    // pg, pg2).getIM();
    LinearRing_LinearRing r2r = new LinearRing_LinearRing(pg.getShell(),
        pg2.getShell());
    IntersectionMatrix rt = r2r.getIM();
    assertTrue(!rt.match(IntersectionMatrix.DisjointPattern));
  }
View Full Code Here

  @Override
  protected void addGeometry(List<Geometry> geoms) {
    WktReader wkt = new WktReader();
    Geometry g = wkt
        .read("Polygon(1.0 6.0,5.999998414659173 1.0039816335536662,1.0079632645824341 -3.999993658637697,-3.9999857319385903 0.9880551094385923,1.0 6.0)");
    Polygon ls = (Polygon) g;
    Geometry g2 = wkt
        .read("Polygon(-2.639991350383829 -1.7999950537374092,-1.8399918576928131 -1.7999950537374092,-1.8399918576928131 -0.9999955610463935,-2.639991350383829 -0.9999955610463935,-2.639991350383829 -1.7999950537374092)");
    Polygon ls2 = (Polygon) g2;

    OverLayOp op = new OverLayOp();
    Polygon pg = op.computeUnion(ls, ls2).getGeometry(0);
    geoms.add(pg);

    // geoms.add(ls);
    // geoms.add(ls2);
  }
View Full Code Here

  @Override
  protected void addGeometry(List<Geometry> geoms) {
    WktReader wkt = new WktReader();
    Geometry g = wkt
        .read("Polygon(1.0 6.0,5.999998414659173 1.0039816335536662,1.0079632645824341 -3.999993658637697,-3.9999857319385903 0.9880551094385923,1.0 6.0)");
    Polygon ls = (Polygon) g;
    Geometry g2 = wkt
        .read("Polygon(-2.639991350383829 -1.7999950537374092,-1.8399918576928131 -1.7999950537374092,-1.8399918576928131 -0.9999955610463935,-2.639991350383829 -0.9999955610463935,-2.639991350383829 -1.7999950537374092)");
    Polygon ls2 = (Polygon) g2;

    OverLayOp op = new OverLayOp();
    Polygon pg = op.computeIntersect(ls, ls2).getGeometry(0);
    geoms.add(pg);

    // geoms.add(ls);
    // geoms.add(ls2);
  }
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.