Package chunmap.model.geom

Examples of chunmap.model.geom.LineString


    if (within)
      return true;
    if (cross)
      return false;

    LineString l1 = (LineString) g1;
    Ring r2 = ((Polygon) g2).getShell();
    if (r2.containLineStringIn(l1))
      return true;

    return false;
View Full Code Here


        geometrys.add(ls);
    }

    private void addJingXian(List<Geometry> geometrys, double jingdu)
    {
        LineString ls = new LineString(
            new CPoint[] { new Coordinate2D(jingdu, -90), new Coordinate2D(jingdu, 90) });
        geometrys.add(ls);
    }
View Full Code Here

    return false;
  }

  public boolean _hasCross(LineString me,LineString l1) {
    LineString l2 = me;
    for (int i = 0, n = l1.size() - 1; i < n; i++) {
      for (int j = 0, n2 = l2.size() - 1; j < n2; j++) {
        LineSegment s1 = l1.getLineSegment(i);
        LineSegment s2 = l2.getLineSegment(j);
        Object g = s1.intersection(s2);
        if (g == null) {
          continue;
        } else if (g instanceof CPoint) {
          CPoint p = (CPoint) g;
View Full Code Here

  }

  @Override
  protected int inner2innerDim(Geometry g1, Geometry g2) {
    GeoPoint p1 = (GeoPoint) g1;
    LineString l2 = (LineString) g2;

    // 在边界上
    if (im.get(Inner, Border) != EmptyDim)
      return EmptyDim;

    // 在内部
    if (l2.onLineString(p1.getCoordinate()))
      return PointDim;

    return EmptyDim;
  }
View Full Code Here

      GeoPoint p = (GeoPoint) g;
      if (!points.contains(p)) {
        putPoint(p);
      }
    } else if (g instanceof LineString) {
      LineString line = (LineString) g;
      if (!lines.contains(line)) {
        putLine(line);
      }
    } else {
      throw new IllegalArgumentException(
View Full Code Here

      }
    }
    points.remove(tp);

    // 合并相连的线
    LineString tl = null;
    CoordSeqEditor newLine = new CoordSeqEditor(line.getPoints());
    for (LineString ls : lines) {
      CoordinateSeq l=ls.getPoints();
      if (newLine.canJoin(l)) {
        newLine.join(l);
        tl = ls;
        break;
      }
    }

    if (tl != null) {
      lines.remove(tl);
      lines.add(new LineString(newLine.toCoordinateSeq()));
    } else {
      lines.add(line);
    }
  }
View Full Code Here

    return lines;
  }

  private void breakLine(CPoint p, List<LineString> lines) {
    for (int i = 0, n = lines.size(); i < n; i++) {
      LineString ls = lines.get(i);
      List<CoordinateSeq> newLines =LinearReference.splitLine(ls.getPoints(),p);
      if (newLines.size() == 2) {
        lines.remove(i);
        lines.add(new LineString(newLines.get(0)));
        lines.add(new LineString(newLines.get(1)));
        return;
      }
    }
  }
View Full Code Here

    boolean none = true;

    while (true) {
      for (int i = 0; i < n; i++) {
        if (!fragment.get(i).isFlag()) {
          LineString ls = fragment.get(i).getLineString();
          if (line.canJoin(ls.getPoints())) {
            line.join(ls.getPoints());
            fragment.get(i).setFlag(true);
            none = false;
          }
        }
      }
View Full Code Here

  public LineString toLineString() {
    List<CPoint> pointList = new ArrayList<CPoint>();
    pointList.add(startPoint);
    pointList.add(endPoint);
    return new LineString(pointList);
  }
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)");
    // LineString ls = (LineString) g;
    Geometry g2 = wkt
        .read("LINESTRING(-2.639991350383829 -1.7999950537374092,-1.8399918576928131 -1.7999950537374092,-1.8399918576928131 -0.9999955610463935,-2.639991350383829 -0.9999955610463935,-2.639991350383829 -1.7999950537374092)");
    LineString ls2 = (LineString) g2;

    Geometry g3 = wkt
        .read("LINESTRING(-2.639991350383829 -1.7999950537374092,-1.8399918576928131 -1.7999950537374092,-1.8399918576928131 -0.9999955610463935,-2.639991350383829 -0.9999955610463935)");

    Geometry g4 = wkt
        .read("LINESTRING(-2.639991350383829 -0.9999955610463935,-2.639991350383829 -1.7999950537374092)");
    LineString ls4 = (LineString) g4;

    if (!g3.isValid())
      throw new GeometryException();
    if (!g4.isValid())
      throw new GeometryException();
View Full Code Here

TOP

Related Classes of chunmap.model.geom.LineString

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.