当前位置: 首页>>代码示例>>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;未经允许,请勿转载。