本文整理汇总了Java中com.vividsolutions.jts.util.Assert.shouldNeverReachHere方法的典型用法代码示例。如果您正苦于以下问题:Java Assert.shouldNeverReachHere方法的具体用法?Java Assert.shouldNeverReachHere怎么用?Java Assert.shouldNeverReachHere使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vividsolutions.jts.util.Assert
的用法示例。
在下文中一共展示了Assert.shouldNeverReachHere方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkShellInsideHole
import com.vividsolutions.jts.util.Assert; //导入方法依赖的package包/类
/**
* This routine checks to see if a shell is properly contained in a hole.
* It assumes that the edges of the shell and hole do not
* properly intersect.
*
* @return <code>null</code> if the shell is properly contained, or
* a Coordinate which is not inside the hole if it is not
*/
private Coordinate checkShellInsideHole(LinearRing shell, LinearRing hole, GeometryGraph graph) {
Coordinate[] shellPts = shell.getCoordinates();
Coordinate[] holePts = hole.getCoordinates();
// TODO: improve performance of this - by sorting pointlists for instance?
Coordinate shellPt = findPtNotNode(shellPts, hole, graph);
// if point is on shell but not hole, check that the shell is inside the hole
if (shellPt != null) {
boolean insideHole = CGAlgorithms.isPointInRing(shellPt, holePts);
if (!insideHole) {
return shellPt;
}
}
Coordinate holePt = findPtNotNode(holePts, shell, graph);
// if point is on hole but not shell, check that the hole is outside the shell
if (holePt != null) {
boolean insideShell = CGAlgorithms.isPointInRing(holePt, shellPts);
if (insideShell) {
return holePt;
}
return null;
}
Assert.shouldNeverReachHere("points in shell and hole appear to be equal");
return null;
}
示例2: query
import com.vividsolutions.jts.util.Assert; //导入方法依赖的package包/类
private void query(Object searchBounds, AbstractNode node, List matches) {
List childBoundables = node.getChildBoundables();
for (Object childBoundable1 : childBoundables) {
Boundable childBoundable = (Boundable) childBoundable1;
if (!this.getIntersectsOp().intersects(childBoundable.getBounds(), searchBounds)) {
continue;
}
if (childBoundable instanceof AbstractNode) {
this.query(searchBounds, (AbstractNode) childBoundable, matches);
} else if (childBoundable instanceof ItemBoundable) {
matches.add(((ItemBoundable) childBoundable).getItem());
} else {
Assert.shouldNeverReachHere();
}
}
}
示例3: itemsTree
import com.vividsolutions.jts.util.Assert; //导入方法依赖的package包/类
private List itemsTree(AbstractNode node) {
List valuesTreeForNode = new ArrayList();
for (Object o : node.getChildBoundables()) {
Boundable childBoundable = (Boundable) o;
if (childBoundable instanceof AbstractNode) {
List valuesTreeForChild = this.itemsTree((AbstractNode) childBoundable);
// only add if not null (which indicates an item somewhere in this tree
if (valuesTreeForChild != null) {
valuesTreeForNode.add(valuesTreeForChild);
}
} else if (childBoundable instanceof ItemBoundable) {
valuesTreeForNode.add(((ItemBoundable) childBoundable).getItem());
} else {
Assert.shouldNeverReachHere();
}
}
if (valuesTreeForNode.size() <= 0) {
return null;
}
return valuesTreeForNode;
}
示例4: write
import com.vividsolutions.jts.util.Assert; //导入方法依赖的package包/类
/**
* Writes a {@link Geometry} to an {@link OutStream}.
*
* @param geom the geometry to write
* @param os the out stream to write to
* @throws IOException if an I/O error occurs
*/
public void write(Geometry geom, OutStream os) throws IOException {
if (geom instanceof Point) {
this.writePoint((Point) geom, os);
}
// LinearRings will be written as LineStrings
else if (geom instanceof LineString) {
this.writeLineString((LineString) geom, os);
} else if (geom instanceof Polygon) {
this.writePolygon((Polygon) geom, os);
} else if (geom instanceof MultiPoint) {
this.writeGeometryCollection(WKBConstants.wkbMultiPoint,
(MultiPoint) geom, os);
} else if (geom instanceof MultiLineString) {
this.writeGeometryCollection(WKBConstants.wkbMultiLineString,
(MultiLineString) geom, os);
} else if (geom instanceof MultiPolygon) {
this.writeGeometryCollection(WKBConstants.wkbMultiPolygon,
(MultiPolygon) geom, os);
} else if (geom instanceof GeometryCollection) {
this.writeGeometryCollection(WKBConstants.wkbGeometryCollection,
(GeometryCollection) geom, os);
} else {
Assert.shouldNeverReachHere("Unknown Geometry type");
}
}
示例5: rotateByQuarterCircle
import com.vividsolutions.jts.util.Assert; //导入方法依赖的package包/类
/**
* Rotates a vector by a given number of quarter-circles (i.e. multiples of 90
* degrees or Pi/2 radians). A positive number rotates counter-clockwise, a
* negative number rotates clockwise. Under this operation the magnitude of
* the vector and the absolute values of the ordinates do not change, only
* their sign and ordinate index.
*
* @param numQuarters the number of quarter-circles to rotate by
* @return the rotated vector.
*/
public Vector2D rotateByQuarterCircle(int numQuarters) {
int nQuad = numQuarters % 4;
if (numQuarters < 0 && nQuad != 0) {
nQuad = nQuad + 4;
}
switch (nQuad) {
case 0:
return create(x, y);
case 1:
return create(-y, x);
case 2:
return create(-x, -y);
case 3:
return create(y, -x);
}
Assert.shouldNeverReachHere();
return null;
}
示例6: query
import com.vividsolutions.jts.util.Assert; //导入方法依赖的package包/类
private void query(Object searchBounds, AbstractNode node, List matches) {
List childBoundables = node.getChildBoundables();
for (int i = 0; i < childBoundables.size(); i++) {
Boundable childBoundable = (Boundable) childBoundables.get(i);
if (!getIntersectsOp().intersects(childBoundable.getBounds(), searchBounds)) {
continue;
}
if (childBoundable instanceof AbstractNode) {
query(searchBounds, (AbstractNode) childBoundable, matches);
} else if (childBoundable instanceof ItemBoundable) {
matches.add(((ItemBoundable) childBoundable).getItem());
} else {
Assert.shouldNeverReachHere();
}
}
}
示例7: rotateByQuarterCircle
import com.vividsolutions.jts.util.Assert; //导入方法依赖的package包/类
/**
* Rotates a vector by a given number of quarter-circles (i.e. multiples of 90
* degrees or Pi/2 radians). A positive number rotates counter-clockwise, a
* negative number rotates clockwise. Under this operation the magnitude of
* the vector and the absolute values of the ordinates do not change, only
* their sign and ordinate index.
*
* @param numQuarters
* the number of quarter-circles to rotate by
* @return the rotated vector.
*/
public Vector2D rotateByQuarterCircle(int numQuarters) {
int nQuad = numQuarters % 4;
if (numQuarters < 0 && nQuad != 0) {
nQuad = nQuad + 4;
}
switch (nQuad) {
case 0:
return create(x, y);
case 1:
return create(-y, x);
case 2:
return create(-x, -y);
case 3:
return create(y, -x);
}
Assert.shouldNeverReachHere();
return null;
}
示例8: queryBoundables
import com.vividsolutions.jts.util.Assert; //导入方法依赖的package包/类
private void queryBoundables( Object searchBounds, AbstractNode node, List matches ) {
List childBoundables = node.getChildBoundables();
for( int i = 0; i < childBoundables.size(); i++ ) {
Boundable childBoundable = (Boundable) childBoundables.get(i);
if (!getIntersectsOp().intersects(childBoundable.getBounds(), searchBounds)) {
continue;
}
if (childBoundable instanceof AbstractNode) {
queryBoundables(searchBounds, (AbstractNode) childBoundable, matches);
} else if (childBoundable instanceof ItemBoundable) {
matches.add(childBoundable);
} else {
Assert.shouldNeverReachHere();
}
}
}
示例9: write
import com.vividsolutions.jts.util.Assert; //导入方法依赖的package包/类
/**
* Writes a {@link Geometry} to an {@link OutStream}.
*
* @param geom the geometry to write
* @param os the out stream to write to
* @throws IOException if an I/O error occurs
*/
public void write(Geometry geom, OutStream os) throws IOException {
if (geom instanceof Point)
writePoint((Point) geom, os);
// LinearRings will be written as LineStrings
else if (geom instanceof LineString)
writeLineString((LineString) geom, os);
else if (geom instanceof Polygon)
writePolygon((Polygon) geom, os);
else if (geom instanceof MultiPoint)
writeGeometryCollection(WKBConstants.wkbMultiPoint,
(MultiPoint) geom, os);
else if (geom instanceof MultiLineString)
writeGeometryCollection(WKBConstants.wkbMultiLineString,
(MultiLineString) geom, os);
else if (geom instanceof MultiPolygon)
writeGeometryCollection(WKBConstants.wkbMultiPolygon,
(MultiPolygon) geom, os);
else if (geom instanceof GeometryCollection)
writeGeometryCollection(WKBConstants.wkbGeometryCollection,
(GeometryCollection) geom, os);
else {
Assert.shouldNeverReachHere("Unknown Geometry type");
}
}
示例10: write
import com.vividsolutions.jts.util.Assert; //导入方法依赖的package包/类
/**
* Writes a {@link Geometry} to an {@link OutStream}.
*
* @param geom the geometry to write
* @param os the out stream to write to
* @throws IOException if an I/O error occurs
*/
public void write(Geometry geom, OutStream os) throws IOException
{
if (geom instanceof Point)
writePoint((Point) geom, os);
// LinearRings will be written as LineStrings
else if (geom instanceof LineString)
writeLineString((LineString) geom, os);
else if (geom instanceof Polygon)
writePolygon((Polygon) geom, os);
else if (geom instanceof MultiPoint)
writeGeometryCollection(WKBConstants.wkbMultiPoint,
(MultiPoint) geom, os);
else if (geom instanceof MultiLineString)
writeGeometryCollection(WKBConstants.wkbMultiLineString,
(MultiLineString) geom, os);
else if (geom instanceof MultiPolygon)
writeGeometryCollection(WKBConstants.wkbMultiPolygon,
(MultiPolygon) geom, os);
else if (geom instanceof GeometryCollection)
writeGeometryCollection(WKBConstants.wkbGeometryCollection,
(GeometryCollection) geom, os);
else {
Assert.shouldNeverReachHere("Unknown Geometry type");
}
}
示例11: parseError
import com.vividsolutions.jts.util.Assert; //导入方法依赖的package包/类
/**
* Throws a formatted ParseException for the current token.
*
* @param expected a description of what was expected
* @throws ParseException
* @throws com.vividsolutions.jts.util.AssertionFailedException if an
* invalid token is encountered
*/
private void parseError(String expected) throws ParseException {
// throws Asserts for tokens that should never be seen
if (tokenizer.ttype == StreamTokenizer.TT_NUMBER)
Assert.shouldNeverReachHere("Unexpected NUMBER token");
if (tokenizer.ttype == StreamTokenizer.TT_EOL)
Assert.shouldNeverReachHere("Unexpected EOL token");
String tokenStr = tokenString();
throw new ParseException("Expected " + expected + " but found "
+ tokenStr);
}
示例12: compare
import com.vividsolutions.jts.util.Assert; //导入方法依赖的package包/类
/**
* Compares two {@link Coordinate}s for their relative position along a segment
* lying in the specified {@link Octant}.
*
* @return -1 node0 occurs first;
* 0 the two nodes are equal;
* 1 node1 occurs first
*/
public static int compare(int octant, Coordinate p0, Coordinate p1) {
// nodes can only be equal if their coordinates are equal
if (p0.equals2D(p1)) {
return 0;
}
int xSign = relativeSign(p0.x, p1.x);
int ySign = relativeSign(p0.y, p1.y);
switch (octant) {
case 0:
return compareValue(xSign, ySign);
case 1:
return compareValue(ySign, xSign);
case 2:
return compareValue(ySign, -xSign);
case 3:
return compareValue(-xSign, ySign);
case 4:
return compareValue(-xSign, -ySign);
case 5:
return compareValue(-ySign, -xSign);
case 6:
return compareValue(-ySign, xSign);
case 7:
return compareValue(xSign, -ySign);
}
Assert.shouldNeverReachHere("invalid octant value");
return 0;
}
示例13: getRightmostEdge
import com.vividsolutions.jts.util.Assert; //导入方法依赖的package包/类
public DirectedEdge getRightmostEdge() {
List edges = this.getEdges();
int size = edges.size();
if (size < 1) {
return null;
}
DirectedEdge de0 = (DirectedEdge) edges.get(0);
if (size == 1) {
return de0;
}
DirectedEdge deLast = (DirectedEdge) edges.get(size - 1);
int quad0 = de0.getQuadrant();
int quad1 = deLast.getQuadrant();
if (Quadrant.isNorthern(quad0) && Quadrant.isNorthern(quad1)) {
return de0;
} else if (!Quadrant.isNorthern(quad0) && !Quadrant.isNorthern(quad1)) {
return deLast;
} else {
// edges are in different hemispheres - make sure we return one that is non-horizontal
//Assert.isTrue(de0.getDy() != 0, "should never return horizontal edge!");
DirectedEdge nonHorizontalEdge = null;
if (de0.getDy() != 0) {
return de0;
} else if (deLast.getDy() != 0) {
return deLast;
}
}
Assert.shouldNeverReachHere("found two horizontal edges incident on node");
return null;
}
示例14: clone
import com.vividsolutions.jts.util.Assert; //导入方法依赖的package包/类
@Override
public Object clone() {
try {
Coordinate coord = (Coordinate) super.clone();
return coord; // return the clone
} catch (CloneNotSupportedException e) {
Assert.shouldNeverReachHere(
"this shouldn't happen because this class is Cloneable");
return null;
}
}
示例15: getClassSortIndex
import com.vividsolutions.jts.util.Assert; //导入方法依赖的package包/类
private int getClassSortIndex() {
if (sortedClasses == null) {
initSortedClasses();
}
for (int i = 0; i < sortedClasses.length; i++) {
if (sortedClasses[i].isInstance(this)) {
return i;
}
}
Assert.shouldNeverReachHere("Class not supported: " + this.getClass());
return -1;
}