当前位置: 首页>>代码示例>>Java>>正文


Java CGAlgorithms.COUNTERCLOCKWISE属性代码示例

本文整理汇总了Java中com.vividsolutions.jts.algorithm.CGAlgorithms.COUNTERCLOCKWISE属性的典型用法代码示例。如果您正苦于以下问题:Java CGAlgorithms.COUNTERCLOCKWISE属性的具体用法?Java CGAlgorithms.COUNTERCLOCKWISE怎么用?Java CGAlgorithms.COUNTERCLOCKWISE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.vividsolutions.jts.algorithm.CGAlgorithms的用法示例。


在下文中一共展示了CGAlgorithms.COUNTERCLOCKWISE属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ensureOrientation

public Coordinate[] ensureOrientation(
		final int desiredOrientation, final Coordinate... coord) {
	if (coord.length == 0) {
		return coord;
	}

	final int orientation = CGAlgorithms.isCCW(coord) ? CGAlgorithms.COUNTERCLOCKWISE
			: CGAlgorithms.CLOCKWISE;

	if (orientation != desiredOrientation) {
		final Coordinate[] reverse = (Coordinate[]) coord.clone();
		reverse(reverse);

		return reverse;
	}

	return coord;
}
 
开发者ID:geowe,项目名称:sig-seguimiento-vehiculos,代码行数:18,代码来源:CoordinateUtil.java

示例2: findRightmostEdgeAtVertex

private void findRightmostEdgeAtVertex() {
    /**
     * The rightmost point is an interior vertex, so it has a segment on either side of it.
     * If these segments are both above or below the rightmost point, we need to
     * determine their relative orientation to decide which is rightmost.
     */
    Coordinate[] pts = this.minDe.getEdge().getCoordinates();
    Assert.isTrue(this.minIndex > 0 && this.minIndex < pts.length, "rightmost point expected to be interior vertex of edge");
    Coordinate pPrev = pts[this.minIndex - 1];
    Coordinate pNext = pts[this.minIndex + 1];
    int orientation = CGAlgorithms.computeOrientation(this.minCoord, pNext, pPrev);
    boolean usePrev = false;
    // both segments are below min point
    if (pPrev.y < this.minCoord.y && pNext.y < this.minCoord.y
            && orientation == CGAlgorithms.COUNTERCLOCKWISE) {
        usePrev = true;
    } else if (pPrev.y > this.minCoord.y && pNext.y > this.minCoord.y
            && orientation == CGAlgorithms.CLOCKWISE) {
        usePrev = true;
    }
    // if both segments are on the same side, do nothing - either is safe
    // to select as a rightmost segment
    if (usePrev) {
        this.minIndex = this.minIndex - 1;
    }
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:26,代码来源:RightmostEdgeFinder.java

示例3: findRightmostEdgeAtVertex

private void findRightmostEdgeAtVertex() {
    /**
     * The rightmost point is an interior vertex, so it has a segment on either side of it.
     * If these segments are both above or below the rightmost point, we need to
     * determine their relative orientation to decide which is rightmost.
     */
    Coordinate[] pts = minDe.getEdge().getCoordinates();
    Assert.isTrue(minIndex > 0 && minIndex < pts.length, "rightmost point expected to be interior vertex of edge");
    Coordinate pPrev = pts[minIndex - 1];
    Coordinate pNext = pts[minIndex + 1];
    int orientation = CGAlgorithms.computeOrientation(minCoord, pNext, pPrev);
    boolean usePrev = false;
    // both segments are below min point
    if (pPrev.y < minCoord.y && pNext.y < minCoord.y
            && orientation == CGAlgorithms.COUNTERCLOCKWISE) {
        usePrev = true;
    } else if (pPrev.y > minCoord.y && pNext.y > minCoord.y
            && orientation == CGAlgorithms.CLOCKWISE) {
        usePrev = true;
    }
    // if both segments are on the same side, do nothing - either is safe
    // to select as a rightmost segment
    if (usePrev) {
        minIndex = minIndex - 1;
    }
}
 
开发者ID:Semantive,项目名称:jts,代码行数:26,代码来源:RightmostEdgeFinder.java

示例4: addNextSegment

public void addNextSegment(Coordinate p, boolean addStartPoint) {
    // s0-s1-s2 are the coordinates of the previous segment and the current one
    this.s0 = this.s1;
    this.s1 = this.s2;
    this.s2 = p;
    this.seg0.setCoordinates(this.s0, this.s1);
    this.computeOffsetSegment(this.seg0, this.side, this.distance, this.offset0);
    this.seg1.setCoordinates(this.s1, this.s2);
    this.computeOffsetSegment(this.seg1, this.side, this.distance, this.offset1);

    // do nothing if points are equal
    if (this.s1.equals(this.s2)) {
        return;
    }

    int orientation = CGAlgorithms.computeOrientation(this.s0, this.s1, this.s2);
    boolean outsideTurn =
            (orientation == CGAlgorithms.CLOCKWISE && this.side == Position.LEFT)
                    || (orientation == CGAlgorithms.COUNTERCLOCKWISE && this.side == Position.RIGHT);

    if (orientation == 0) { // lines are collinear
        this.addCollinear(addStartPoint);
    } else if (outsideTurn) {
        this.addOutsideTurn(orientation, addStartPoint);
    } else { // inside turn
        this.addInsideTurn(orientation, addStartPoint);
    }
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:28,代码来源:OffsetSegmentGenerator.java

示例5: addNextSegment

public void addNextSegment(Coordinate p, boolean addStartPoint)
{
  // s0-s1-s2 are the coordinates of the previous segment and the current one
  s0 = s1;
  s1 = s2;
  s2 = p;
  seg0.setCoordinates(s0, s1);
  computeOffsetSegment(seg0, side, distance, offset0);
  seg1.setCoordinates(s1, s2);
  computeOffsetSegment(seg1, side, distance, offset1);

  // do nothing if points are equal
  if (s1.equals(s2)) return;

  int orientation = CGAlgorithms.computeOrientation(s0, s1, s2);
  boolean outsideTurn =
        (orientation == CGAlgorithms.CLOCKWISE        && side == Position.LEFT)
    ||  (orientation == CGAlgorithms.COUNTERCLOCKWISE && side == Position.RIGHT);

  if (orientation == 0) { // lines are collinear
    addCollinear(addStartPoint);
  }
  else if (outsideTurn) 
  {
    addOutsideTurn(orientation, addStartPoint);
  }
  else { // inside turn
    addInsideTurn(orientation, addStartPoint);
  }
}
 
开发者ID:GitHubDroid,项目名称:geodroid_master_update,代码行数:30,代码来源:OffsetSegmentGenerator.java


注:本文中的com.vividsolutions.jts.algorithm.CGAlgorithms.COUNTERCLOCKWISE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。