本文整理了Java中org.locationtech.jts.util.Assert.equals()
方法的一些代码示例,展示了Assert.equals()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Assert.equals()
方法的具体详情如下:
包路径:org.locationtech.jts.util.Assert
类名称:Assert
方法名:equals
[英]Throws an AssertionFailedException
if the given objects are not equal, according to the equals
method.
[中]根据equals
方法,如果给定对象不相等,则抛出AssertionFailedException
。
代码示例来源:origin: mapsforge/mapsforge
@Test
public void testBuildValidMultiLineString() {
String testfile = "valid-multilinestring.wkt";
List<TDWay> ways = MockingUtils.wktMultiLineStringToWays(testfile);
MultiLineString mls = JTSUtils.buildMultiLineString(ways.get(0), ways.subList(1, ways.size()));
Geometry expected = MockingUtils.readWKTFile(testfile);
Assert.isTrue(mls.isValid());
Assert.equals(expected, mls);
}
代码示例来源:origin: mapsforge/mapsforge
@Test
public void testBuildNonSimpleMultiLineString() {
String testfile = "non-simple-multilinestring.wkt";
List<TDWay> ways = MockingUtils.wktMultiLineStringToWays(testfile);
MultiLineString mls = JTSUtils.buildMultiLineString(ways.get(0), ways.subList(1, ways.size()));
Geometry expected = MockingUtils.readWKTFile(testfile);
Assert.isTrue(!mls.isSimple());
Assert.equals(expected, mls);
}
代码示例来源:origin: mapsforge/mapsforge
@Test
public void testBuildInValidPolygonWith2InnerRings() {
String testfile = "invalid-polygon-2-inner-rings.wkt";
List<TDWay> ways = MockingUtils.wktPolygonToWays(testfile);
Polygon polygon = JTSUtils.buildPolygon(ways.get(0), ways.subList(1, ways.size()));
Geometry expected = MockingUtils.readWKTFile(testfile);
Assert.isTrue(!polygon.isValid());
Assert.equals(expected, polygon);
}
代码示例来源:origin: mapsforge/mapsforge
@Test
public void testBuildValidPolygonWith2InnerRings() {
String testfile = "valid-polygon-2-inner-rings.wkt";
List<TDWay> ways = MockingUtils.wktPolygonToWays(testfile);
Polygon polygon = JTSUtils.buildPolygon(ways.get(0), ways.subList(1, ways.size()));
Geometry expected = MockingUtils.readWKTFile(testfile);
Assert.isTrue(polygon.isValid());
Assert.equals(expected, polygon);
}
}
代码示例来源:origin: mapsforge/mapsforge
@Test
public void testBuildGeometryFromInValidPolygonWithHoles() {
String testfile = "invalid-polygon-2-inner-rings.wkt";
String expectedfile = "invalid-polygon-2-inner-rings-repaired.wkt";
List<TDWay> ways = MockingUtils.wktPolygonToWays(testfile);
Geometry geometry = JTSUtils.toJtsGeometry(ways.get(0), ways.subList(1, ways.size()));
Assert.isTrue(geometry instanceof Polygon);
Assert.isTrue(geometry.isValid());
Geometry expected = MockingUtils.readWKTFile(expectedfile);
Assert.equals(expected, geometry);
}
代码示例来源:origin: locationtech/jts
/**
* Throws an <code>AssertionFailedException</code> if the given objects are
* not equal, according to the <code>equals</code> method.
*
*@param expectedValue the correct value
*@param actualValue the value being checked
*@throws AssertionFailedException if the two objects are not equal
*/
public static void equals(Object expectedValue, Object actualValue) {
equals(expectedValue, actualValue, null);
}
代码示例来源:origin: mapsforge/mapsforge
@Test
public void testBuildInvalidPolygon() {
String testfile = "invalid-polygon.wkt";
List<TDWay> ways = MockingUtils.wktPolygonToWays(testfile);
Polygon polygon = JTSUtils.buildPolygon(ways.get(0));
Geometry expected = MockingUtils.readWKTFile(testfile);
Assert.isTrue(!polygon.isValid());
Assert.equals(expected, polygon);
}
代码示例来源:origin: mapsforge/mapsforge
@Test
public void testBuildValidPolygon() {
String testfile = "valid-polygon.wkt";
List<TDWay> ways = MockingUtils.wktPolygonToWays(testfile);
Polygon polygon = JTSUtils.buildPolygon(ways.get(0));
Geometry expected = MockingUtils.readWKTFile(testfile);
Assert.isTrue(polygon.isValid());
Assert.equals(expected, polygon);
}
代码示例来源:origin: locationtech/jts
/**
*@param vertices the vertices of a linear ring, which may or may not be
* flattened (i.e. vertices collinear)
*@return the coordinates with unnecessary (collinear) vertices
* removed
*/
private Coordinate[] cleanRing(Coordinate[] original) {
Assert.equals(original[0], original[original.length - 1]);
ArrayList cleanedRing = new ArrayList();
Coordinate previousDistinctCoordinate = null;
for (int i = 0; i <= original.length - 2; i++) {
Coordinate currentCoordinate = original[i];
Coordinate nextCoordinate = original[i+1];
if (currentCoordinate.equals(nextCoordinate)) {
continue;
}
if (previousDistinctCoordinate != null
&& isBetween(previousDistinctCoordinate, currentCoordinate, nextCoordinate)) {
continue;
}
cleanedRing.add(currentCoordinate);
previousDistinctCoordinate = currentCoordinate;
}
cleanedRing.add(original[original.length - 1]);
Coordinate[] cleanedRingCoordinates = new Coordinate[cleanedRing.size()];
return (Coordinate[]) cleanedRing.toArray(cleanedRingCoordinates);
}
代码示例来源:origin: orbisgis/h2gis
/**
*@param vertices the vertices of a linear ring, which may or may not be
* flattened (i.e. vertices collinear)
*@return the coordinates with unnecessary (collinear) vertices
* removed
*/
private Coordinate[] cleanRing(Coordinate[] original) {
Assert.equals(original[0], original[original.length - 1]);
ArrayList cleanedRing = new ArrayList();
Coordinate previousDistinctCoordinate = null;
for (int i = 0; i <= original.length - 2; i++) {
Coordinate currentCoordinate = original[i];
Coordinate nextCoordinate = original[i+1];
if (currentCoordinate.equals(nextCoordinate)) {
continue;
}
if (previousDistinctCoordinate != null
&& isBetween(previousDistinctCoordinate, currentCoordinate, nextCoordinate)) {
continue;
}
cleanedRing.add(currentCoordinate);
previousDistinctCoordinate = currentCoordinate;
}
cleanedRing.add(original[original.length - 1]);
Coordinate[] cleanedRingCoordinates = new Coordinate[cleanedRing.size()];
return (Coordinate[]) cleanedRing.toArray(cleanedRingCoordinates);
}
代码示例来源:origin: locationtech/jts
/**
* Insert an edge with the same origin after this one.
* Assumes that the inserted edge is in the correct
* position around the ring.
*
* @param e the edge to insert (with same origin)
*/
private void insertAfter(HalfEdge e) {
Assert.equals(orig, e.orig());
HalfEdge save = oNext();
sym.setNext(e);
e.sym().setNext(save);
}
代码示例来源:origin: org.geoserver/gs-wms
@Test
public void testGetCustomDomainRepresentation() {
final String[] vals = new String[] {"value with spaces", "value", " other values "};
final List<String> values = new ArrayList<String>();
for (String val : vals) values.add(val);
DimensionInfo dimensionInfo = new DimensionInfoImpl();
dimensionInfo.setPresentation(DimensionPresentation.LIST);
dimensionInfo.setResolution(new BigDecimal(1));
String customDimRepr = dimensionHelper.getCustomDomainRepresentation(dimensionInfo, values);
// value with spaces,value
Assert.equals(customDimRepr, vals[0] + "," + vals[1] + "," + vals[2].trim());
// System.out.print(vals.toString());
}
内容来源于网络,如有侵权,请联系作者删除!