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


Java Assert.isTrue方法代码示例

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


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

示例1: labelIsolatedNodes

import com.vividsolutions.jts.util.Assert; //导入方法依赖的package包/类
/**
 * Isolated nodes are nodes whose labels are incomplete
 * (e.g. the location for one Geometry is null).
 * This is the case because nodes in one graph which don't intersect
 * nodes in the other are not completely labelled by the initial process
 * of adding nodes to the nodeList.
 * To complete the labelling we need to check for nodes that lie in the
 * interior of edges, and in the interior of areas.
 */
private void labelIsolatedNodes() {
    for (Iterator ni = this.nodes.iterator(); ni.hasNext(); ) {
        Node n = (Node) ni.next();
        Label label = n.getLabel();
        // isolated nodes should always have at least one geometry in their label
        Assert.isTrue(label.getGeometryCount() > 0, "node with empty label found");
        if (n.isIsolated()) {
            if (label.isNull(0)) {
                this.labelIsolatedNode(n, 0);
            } else {
                this.labelIsolatedNode(n, 1);
            }
        }
    }
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:25,代码来源:RelateComputer.java

示例2: findIntersectionNodes

import com.vividsolutions.jts.util.Assert; //导入方法依赖的package包/类
/**
 * Finds all nodes in a maximal edgering which are self-intersection nodes
 *
 * @param startDE
 * @param label
 * @return the list of intersection nodes found,
 * or <code>null</code> if no intersection nodes were found
 */
private static List findIntersectionNodes(PolygonizeDirectedEdge startDE, long label) {
    PolygonizeDirectedEdge de = startDE;
    List intNodes = null;
    do {
        Node node = de.getFromNode();
        if (getDegree(node, label) > 1) {
            if (intNodes == null) {
                intNodes = new ArrayList();
            }
            intNodes.add(node);
        }

        de = de.getNext();
        Assert.isTrue(de != null, "found null DE in ring");
        Assert.isTrue(de == startDE || !de.isInRing(), "found DE already in ring");
    } while (de != startDE);

    return intNodes;
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:28,代码来源:PolygonizeGraph.java

示例3: visitInteriorRing

import com.vividsolutions.jts.util.Assert; //导入方法依赖的package包/类
private void visitInteriorRing(LineString ring, PlanarGraph graph) {
    Coordinate[] pts = ring.getCoordinates();
    Coordinate pt0 = pts[0];
    /**
     * Find first point in coord list different to initial point.
     * Need special check since the first point may be repeated.
     */
    Coordinate pt1 = findDifferentPoint(pts, pt0);
    Edge e = graph.findEdgeInSameDirection(pt0, pt1);
    DirectedEdge de = (DirectedEdge) graph.findEdgeEnd(e);
    DirectedEdge intDe = null;
    if (de.getLabel().getLocation(0, Position.RIGHT) == Location.INTERIOR) {
        intDe = de;
    } else if (de.getSym().getLabel().getLocation(0, Position.RIGHT) == Location.INTERIOR) {
        intDe = de.getSym();
    }
    Assert.isTrue(intDe != null, "unable to find dirEdge with Interior on RHS");

    this.visitLinkedDirectedEdges(intDe);
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:21,代码来源:ConnectedInteriorTester.java

示例4: computeSequence

import com.vividsolutions.jts.util.Assert; //导入方法依赖的package包/类
private void computeSequence() {
    if (this.isRun) {
        return;
    }
    this.isRun = true;

    List sequences = this.findSequences();
    if (sequences == null) {
        return;
    }

    this.sequencedGeometry = this.buildSequencedGeometry(sequences);
    this.isSequenceable = true;

    int finalLineCount = this.sequencedGeometry.getNumGeometries();
    Assert.isTrue(this.lineCount == finalLineCount, "Lines were missing from result");
    Assert.isTrue(this.sequencedGeometry instanceof LineString
                    || this.sequencedGeometry instanceof MultiLineString,
            "Result is not lineal");
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:21,代码来源:LineSequencer.java

示例5: collectBoundaryTouchEdge

import com.vividsolutions.jts.util.Assert; //导入方法依赖的package包/类
/**
 * Collect edges from Area inputs which should be in the result but
 * which have not been included in a result area.
 * This happens ONLY:
 * <ul>
 * <li>during an intersection when the boundaries of two
 * areas touch in a line segment
 * <li> OR as a result of a dimensional collapse.
 * </ul>
 */
private void collectBoundaryTouchEdge(DirectedEdge de, int opCode, List edges) {
    Label label = de.getLabel();
    if (de.isLineEdge()) {
        return;  // only interested in area edges
    }
    if (de.isVisited()) {
        return;  // already processed
    }
    if (de.isInteriorAreaEdge()) {
        return;  // added to handle dimensional collapses
    }
    if (de.getEdge().isInResult()) {
        return;  // if the edge linework is already included, don't include it again
    }

    // sanity check for labelling of result edgerings
    Assert.isTrue(!(de.isInResult() || de.getSym().isInResult()) || !de.getEdge().isInResult());

    // include the linework if it's in the result of the operation
    if (OverlayOp.isResultOfOp(label, opCode)
            && opCode == OverlayOp.INTERSECTION) {
        edges.add(de.getEdge());
        de.setVisitedEdge(true);
    }
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:36,代码来源:LineBuilder.java

示例6: insertNode

import com.vividsolutions.jts.util.Assert; //导入方法依赖的package包/类
void insertNode(Node node) {
        Assert.isTrue(this.env == null || this.env.contains(node.env));
//System.out.println(env);
//System.out.println(quad.env);
        int index = getSubnodeIndex(node.env, this.centrex, this.centrey);
//System.out.println(index);
        if (node.level == this.level - 1) {
            this.subnode[index] = node;
//System.out.println("inserted");
        } else {
            // the quad is not a direct child, so make a new child quad to contain it
            // and recursively insert the quad
            Node childNode = this.createSubnode(index);
            childNode.insertNode(node);
            this.subnode[index] = childNode;
        }
    }
 
开发者ID:gegy1000,项目名称:Earth,代码行数:18,代码来源:Node.java

示例7: findIntersectionNodes

import com.vividsolutions.jts.util.Assert; //导入方法依赖的package包/类
/**
 * Finds all nodes in a maximal edgering which are self-intersection nodes
 *
 * @param startDE
 * @param label
 * @return the list of intersection nodes found,
 * or <code>null</code> if no intersection nodes were found
 */
private static List findIntersectionNodes(PolygonizeDirectedEdge startDE, long label) {
    PolygonizeDirectedEdge de = startDE;
    List intNodes = null;
    do {
        Node node = de.getFromNode();
        if (getDegree(node, label) > 1) {
            if (intNodes == null)
                intNodes = new ArrayList();
            intNodes.add(node);
        }

        de = de.getNext();
        Assert.isTrue(de != null, "found null DE in ring");
        Assert.isTrue(de == startDE || !de.isInRing(), "found DE already in ring");
    } while (de != startDE);

    return intNodes;
}
 
开发者ID:Semantive,项目名称:jts,代码行数:27,代码来源:PolygonizeGraph.java

示例8: computePoints

import com.vividsolutions.jts.util.Assert; //导入方法依赖的package包/类
/**
     * Collect all the points from the DirectedEdges of this ring into a contiguous list
     */
    protected void computePoints(DirectedEdge start) {
//System.out.println("buildRing");
        startDe = start;
        DirectedEdge de = start;
        boolean isFirstEdge = true;
        do {
//      Assert.isTrue(de != null, "found null Directed Edge");
            if (de == null)
                throw new TopologyException("Found null DirectedEdge");
            if (de.getEdgeRing() == this)
                throw new TopologyException("Directed Edge visited twice during ring-building at " + de.getCoordinate());

            edges.add(de);
//Debug.println(de);
//Debug.println(de.getEdge());
            Label label = de.getLabel();
            Assert.isTrue(label.isArea());
            mergeLabel(label);
            addPoints(de.getEdge(), de.isForward(), isFirstEdge);
            isFirstEdge = false;
            setEdgeRing(de, this);
            de = getNext(de);
        } while (de != startDe);
    }
 
开发者ID:Semantive,项目名称:jts,代码行数:28,代码来源:EdgeRing.java

示例9: insertContained

import com.vividsolutions.jts.util.Assert; //导入方法依赖的package包/类
/**
 * insert an item which is known to be contained in the tree rooted at
 * the given QuadNode root.  Lower levels of the tree will be created
 * if necessary to hold the item.
 */
private void insertContained(Node tree, Envelope itemEnv, Object item)
{
  Assert.isTrue(tree.getEnvelope().contains(itemEnv));
 /**
  * Do NOT create a new quad for zero-area envelopes - this would lead
  * to infinite recursion. Instead, use a heuristic of simply returning
  * the smallest existing quad containing the query
  */
  boolean isZeroX = IntervalSize.isZeroWidth(itemEnv.getMinX(), itemEnv.getMaxX());
  boolean isZeroY = IntervalSize.isZeroWidth(itemEnv.getMinY(), itemEnv.getMaxY());
  NodeBase node;
  if (isZeroX || isZeroY)
    node = tree.find(itemEnv);
  else
    node = tree.getNode(itemEnv);
  node.add(item);
}
 
开发者ID:GitHubDroid,项目名称:geodroid_master_update,代码行数:23,代码来源:Root.java

示例10: insertNode

import com.vividsolutions.jts.util.Assert; //导入方法依赖的package包/类
void insertNode(Node node) {
        Assert.isTrue(env == null || env.contains(node.env));
//System.out.println(env);
//System.out.println(quad.env);
        int index = getSubnodeIndex(node.env, centrex, centrey);
//System.out.println(index);
        if (node.level == level - 1) {
            subnode[index] = node;
//System.out.println("inserted");
        } else {
            // the quad is not a direct child, so make a new child quad to contain it
            // and recursively insert the quad
            Node childNode = createSubnode(index);
            childNode.insertNode(node);
            subnode[index] = childNode;
        }
    }
 
开发者ID:Semantive,项目名称:jts,代码行数:18,代码来源:Node.java

示例11: computeSequence

import com.vividsolutions.jts.util.Assert; //导入方法依赖的package包/类
private void computeSequence() {
    if (isRun) {
        return;
    }
    isRun = true;

    List sequences = findSequences();
    if (sequences == null)
        return;

    sequencedGeometry = buildSequencedGeometry(sequences);
    isSequenceable = true;

    int finalLineCount = sequencedGeometry.getNumGeometries();
    Assert.isTrue(lineCount == finalLineCount, "Lines were missing from result");
    Assert.isTrue(sequencedGeometry instanceof LineString
            || sequencedGeometry instanceof MultiLineString,
            "Result is not lineal");
}
 
开发者ID:Semantive,项目名称:jts,代码行数:20,代码来源:LineSequencer.java

示例12: indexOfAfter

import com.vividsolutions.jts.util.Assert; //导入方法依赖的package包/类
/**
 * Find the nearest {@link LinearLocation} along the linear {@link Geometry}
 * to a given {@link Coordinate}
 * after the specified minimum {@link LinearLocation}.
 * If possible the location returned will be strictly greater than the
 * <code>minLocation</code>.
 * If this is not possible, the
 * value returned will equal <code>minLocation</code>.
 * (An example where this is not possible is when
 * minLocation = [end of line] ).
 *
 * @param inputPt the coordinate to locate
 * @param minLocation the minimum location for the point location
 * @return the location of the nearest point
 */
public LinearLocation indexOfAfter(Coordinate inputPt, LinearLocation minIndex)
{
  if (minIndex == null) return indexOf(inputPt);

  // sanity check for minLocation at or past end of line
  LinearLocation endLoc = LinearLocation.getEndLocation(linearGeom);
  if (endLoc.compareTo(minIndex) <= 0)
    return endLoc;

  LinearLocation closestAfter = indexOfFromStart(inputPt, minIndex);
  /**
   * Return the minDistanceLocation found.
   * This will not be null, since it was initialized to minLocation
   */
  Assert.isTrue(closestAfter.compareTo(minIndex) >= 0,
                "computed location is before specified minimum location");
  return closestAfter;
}
 
开发者ID:GitHubDroid,项目名称:geodroid_master_update,代码行数:34,代码来源:LocationIndexOfPoint.java

示例13: indexOfAfter

import com.vividsolutions.jts.util.Assert; //导入方法依赖的package包/类
/**
 * Finds the nearest index along the linear {@link Geometry}
 * to a given {@link Coordinate}
 * after the specified minimum index.
 * If possible the location returned will be strictly greater than the
 * <code>minLocation</code>.
 * If this is not possible, the
 * value returned will equal <code>minLocation</code>.
 * (An example where this is not possible is when
 * minLocation = [end of line] ).
 *
 * @param inputPt the coordinate to locate
 * @param minLocation the minimum location for the point location
 * @return the location of the nearest point
 */
public double indexOfAfter(Coordinate inputPt, double minIndex)
{
  if (minIndex < 0.0) return indexOf(inputPt);

  // sanity check for minIndex at or past end of line
  double endIndex = linearGeom.getLength();
  if (endIndex < minIndex)
    return endIndex;

  double closestAfter = indexOfFromStart(inputPt, minIndex);
  /**
   * Return the minDistanceLocation found.
   * This will not be null, since it was initialized to minLocation
   */
  Assert.isTrue(closestAfter > minIndex,
                "computed index is before specified minimum index");
  return closestAfter;
}
 
开发者ID:GitHubDroid,项目名称:geodroid_master_update,代码行数:34,代码来源:LengthIndexOfPoint.java

示例14: findRightmostEdgeAtVertex

import com.vividsolutions.jts.util.Assert; //导入方法依赖的package包/类
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,代码行数:27,代码来源:RightmostEdgeFinder.java

示例15: findDirEdgesInRing

import com.vividsolutions.jts.util.Assert; //导入方法依赖的package包/类
/**
 * Traverses a ring of DirectedEdges, accumulating them into a list.
 * This assumes that all dangling directed edges have been removed
 * from the graph, so that there is always a next dirEdge.
 *
 * @param startDE the DirectedEdge to start traversing at
 * @return a List of DirectedEdges that form a ring
 */
private static List findDirEdgesInRing(PolygonizeDirectedEdge startDE) {
    PolygonizeDirectedEdge de = startDE;
    List edges = new ArrayList();
    do {
        edges.add(de);
        de = de.getNext();
        Assert.isTrue(de != null, "found null DE in ring");
        Assert.isTrue(de == startDE || !de.isInRing(), "found DE already in ring");
    } while (de != startDE);

    return edges;
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:21,代码来源:PolygonizeGraph.java


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