當前位置: 首頁>>代碼示例>>Java>>正文


Java LineString.getCoordinateSequence方法代碼示例

本文整理匯總了Java中com.vividsolutions.jts.geom.LineString.getCoordinateSequence方法的典型用法代碼示例。如果您正苦於以下問題:Java LineString.getCoordinateSequence方法的具體用法?Java LineString.getCoordinateSequence怎麽用?Java LineString.getCoordinateSequence使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.vividsolutions.jts.geom.LineString的用法示例。


在下文中一共展示了LineString.getCoordinateSequence方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: checkRepeatedPoints2d

import com.vividsolutions.jts.geom.LineString; //導入方法依賴的package包/類
private static int checkRepeatedPoints2d(LineString lineString) {
  int repeatedPoints = 0;

  final CoordinateSequence coordSeq = lineString.getCoordinateSequence();
  Coordinate nextCoord = null;
  Coordinate prevCoord;
  for (int i = 0; i < coordSeq.size(); ++i) {
    prevCoord = nextCoord;
    nextCoord = coordSeq.getCoordinate(i);
    if (nextCoord.equals(prevCoord)) {
      ++repeatedPoints;
    }
  }

  return repeatedPoints;
}
 
開發者ID:OrdnanceSurvey,項目名稱:vt-support,代碼行數:17,代碼來源:JtsGeomStats.java

示例2: toJSON

import com.vividsolutions.jts.geom.LineString; //導入方法依賴的package包/類
public static JSONArray toJSON(LineString line, boolean inverseSeq)
{
	// "coordinates": [ [100.0, 0.0], [101.0, 1.0] ]
	int size = line.getNumPoints();

	JSONArray arrCoords = new JSONArray(size);

	CoordinateSequence seq = line.getCoordinateSequence();
	Coordinate coord = null;

	for (int i = 0; i < size; ++i) 
	{
		coord = seq.getCoordinate(inverseSeq ? size - i - 1: i);

		arrCoords.put(toJSON(coord));
	}

	return arrCoords;
}
 
開發者ID:GIScience,項目名稱:openrouteservice,代碼行數:20,代碼來源:GeometryJSON.java

示例3: isLineStringContainedInBoundary

import com.vividsolutions.jts.geom.LineString; //導入方法依賴的package包/類
/**
 * Tests if a linestring is completely contained in the boundary of the target rectangle.
 *
 * @param line the linestring to test
 * @return true if the linestring is contained in the boundary
 */
private boolean isLineStringContainedInBoundary(LineString line) {
    CoordinateSequence seq = line.getCoordinateSequence();
    Coordinate p0 = new Coordinate();
    Coordinate p1 = new Coordinate();
    for (int i = 0; i < seq.size() - 1; i++) {
        seq.getCoordinate(i, p0);
        seq.getCoordinate(i + 1, p1);

        if (!this.isLineSegmentContainedInBoundary(p0, p1)) {
            return false;
        }
    }
    return true;
}
 
開發者ID:gegy1000,項目名稱:Earth,代碼行數:21,代碼來源:RectangleContains.java

示例4: checkIntersectionWithSegments

import com.vividsolutions.jts.geom.LineString; //導入方法依賴的package包/類
private void checkIntersectionWithSegments(LineString testLine) {
    CoordinateSequence seq1 = testLine.getCoordinateSequence();
    for (int j = 1; j < seq1.size(); j++) {
        seq1.getCoordinate(j - 1, this.p0);
        seq1.getCoordinate(j, this.p1);

        if (this.rectIntersector.intersects(this.p0, this.p1)) {
            this.hasIntersection = true;
            return;
        }
    }
}
 
開發者ID:gegy1000,項目名稱:Earth,代碼行數:13,代碼來源:RectangleIntersects.java

示例5: isWithinToleranceOfBoundary

import com.vividsolutions.jts.geom.LineString; //導入方法依賴的package包/類
private boolean isWithinToleranceOfBoundary(Coordinate pt) {
    for (int i = 0; i < this.linework.getNumGeometries(); i++) {
        LineString line = (LineString) this.linework.getGeometryN(i);
        CoordinateSequence seq = line.getCoordinateSequence();
        for (int j = 0; j < seq.size() - 1; j++) {
            seq.getCoordinate(j, this.seg.p0);
            seq.getCoordinate(j + 1, this.seg.p1);
            double dist = this.seg.distance(pt);
            if (dist <= this.boundaryDistanceTolerance) {
                return true;
            }
        }
    }
    return false;
}
 
開發者ID:gegy1000,項目名稱:Earth,代碼行數:16,代碼來源:FuzzyPointLocator.java

示例6: intersection

import com.vividsolutions.jts.geom.LineString; //導入方法依賴的package包/類
private Coordinate intersection(PlanarPolygon3D poly, LineString line) {
    CoordinateSequence seq = line.getCoordinateSequence();
    if (seq.size() == 0) {
        return null;
    }

    // start point of line
    Coordinate p0 = new Coordinate();
    seq.getCoordinate(0, p0);
    double d0 = poly.getPlane().orientedDistance(p0);

    // for each segment in the line
    Coordinate p1 = new Coordinate();
    for (int i = 0; i < seq.size() - 1; i++) {
        seq.getCoordinate(i, p0);
        seq.getCoordinate(i + 1, p1);
        double d1 = poly.getPlane().orientedDistance(p1);

        /**
         * If the oriented distances of the segment endpoints have the same sign,
         * the segment does not cross the plane, and is skipped.
         */
        if (d0 * d1 > 0) {
            continue;
        }

        /**
         * Compute segment-plane intersection point
         * which is then used for a point-in-polygon test.
         * The endpoint distances to the plane d0 and d1
         * give the proportional distance of the intersection point
         * along the segment.
         */
        Coordinate intPt = segmentPoint(p0, p1, d0, d1);
        // Coordinate intPt = polyPlane.intersection(p0, p1, s0, s1);
        if (poly.intersects(intPt)) {
            return intPt;
        }

        // shift to next segment
        d0 = d1;
    }
    return null;
}
 
開發者ID:gegy1000,項目名稱:Earth,代碼行數:45,代碼來源:Distance3DOp.java

示例7: locate

import com.vividsolutions.jts.geom.LineString; //導入方法依賴的package包/類
private int locate(Coordinate pt, LineString ring) {
    CoordinateSequence seq = ring.getCoordinateSequence();
    CoordinateSequence seqProj = project(seq, this.facingPlane);
    Coordinate ptProj = project(pt, this.facingPlane);
    return RayCrossingCounter.locatePointInRing(ptProj, seqProj);
}
 
開發者ID:gegy1000,項目名稱:Earth,代碼行數:7,代碼來源:PlanarPolygon3D.java

示例8: intersects

import com.vividsolutions.jts.geom.LineString; //導入方法依賴的package包/類
public boolean intersects(Coordinate pt, LineString ring) {
    CoordinateSequence seq = ring.getCoordinateSequence();
    CoordinateSequence seqProj = project(seq, this.facingPlane);
    Coordinate ptProj = project(pt, this.facingPlane);
    return Location.EXTERIOR != RayCrossingCounter.locatePointInRing(ptProj, seqProj);
}
 
開發者ID:gegy1000,項目名稱:Earth,代碼行數:7,代碼來源:PlanarPolygon3D.java


注:本文中的com.vividsolutions.jts.geom.LineString.getCoordinateSequence方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。