本文整理汇总了Java中mil.nga.wkb.geom.Triangle类的典型用法代码示例。如果您正苦于以下问题:Java Triangle类的具体用法?Java Triangle怎么用?Java Triangle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Triangle类属于mil.nga.wkb.geom包,在下文中一共展示了Triangle类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: compareTriangle
import mil.nga.wkb.geom.Triangle; //导入依赖的package包/类
/**
* Compare the two triangles for equality
*
* @param expected
* @param actual
* @param delta
*/
private static void compareTriangle(Triangle expected, Triangle actual,
double delta) {
compareBaseGeometryAttributes(expected, actual);
TestCase.assertEquals(expected.numRings(), actual.numRings());
for (int i = 0; i < expected.numRings(); i++) {
compareLineString(expected.getRings().get(i), actual.getRings()
.get(i), delta);
}
}
示例2: transform
import mil.nga.wkb.geom.Triangle; //导入依赖的package包/类
/**
* Transform the projected triangle
*
* @param triangle
* @return projected triangle
*/
public Triangle transform(Triangle triangle) {
Triangle to = new Triangle(triangle.hasZ(), triangle.hasM());
for (LineString ring : triangle.getRings()) {
LineString toRing = transform(ring);
to.addRing(toRing);
}
return to;
}
示例3: compareTriangle
import mil.nga.wkb.geom.Triangle; //导入依赖的package包/类
/**
* Compare the two triangles for equality
*
* @param expected
* @param actual
* @param delta
*/
private static void compareTriangle(Triangle expected, Triangle actual,
double delta) {
compareBaseGeometryAttributes(expected, actual);
TestCase.assertEquals(expected.numRings(), actual.numRings());
for (int i = 0; i < expected.numRings(); i++) {
compareLineString(expected.getRings().get(i), actual.getRings()
.get(i), delta);
}
}
示例4: writeTriangle
import mil.nga.wkb.geom.Triangle; //导入依赖的package包/类
/**
* Write a Triangle
*
* @param writer
* @param triangle
* @throws IOException
*/
public static void writeTriangle(ByteWriter writer, Triangle triangle)
throws IOException {
writer.writeInt(triangle.numRings());
for (LineString ring : triangle.getRings()) {
writeLineString(writer, ring);
}
}
示例5: compareTriangle
import mil.nga.wkb.geom.Triangle; //导入依赖的package包/类
/**
* Compare the two triangles for equality
*
* @param expected
* @param actual
*/
public static void compareTriangle(Triangle expected, Triangle actual) {
compareBaseGeometryAttributes(expected, actual);
TestCase.assertEquals(expected.numRings(), actual.numRings());
for (int i = 0; i < expected.numRings(); i++) {
compareLineString(expected.getRings().get(i), actual.getRings()
.get(i));
}
}
示例6: buildEnvelope
import mil.nga.wkb.geom.Triangle; //导入依赖的package包/类
/**
* Build Geometry Envelope
*
* @param geometry
* geometry to build envelope from
* @param envelope
* envelope to expand
*/
public static void buildEnvelope(Geometry geometry,
GeometryEnvelope envelope) {
GeometryType geometryType = geometry.getGeometryType();
switch (geometryType) {
case POINT:
addPointMessage(envelope, (Point) geometry);
break;
case LINESTRING:
addLineStringMessage(envelope, (LineString) geometry);
break;
case POLYGON:
addPolygonMessage(envelope, (Polygon) geometry);
break;
case MULTIPOINT:
addMultiPointMessage(envelope, (MultiPoint) geometry);
break;
case MULTILINESTRING:
addMultiLineStringMessage(envelope, (MultiLineString) geometry);
break;
case MULTIPOLYGON:
addMultiPolygonMessage(envelope, (MultiPolygon) geometry);
break;
case CIRCULARSTRING:
addLineStringMessage(envelope, (CircularString) geometry);
break;
case COMPOUNDCURVE:
addCompoundCurveMessage(envelope, (CompoundCurve) geometry);
break;
case POLYHEDRALSURFACE:
addPolyhedralSurfaceMessage(envelope, (PolyhedralSurface) geometry);
break;
case TIN:
addPolyhedralSurfaceMessage(envelope, (TIN) geometry);
break;
case TRIANGLE:
addPolygonMessage(envelope, (Triangle) geometry);
break;
case GEOMETRYCOLLECTION:
updateHasZandM(envelope, geometry);
@SuppressWarnings("unchecked")
GeometryCollection<Geometry> geomCollection = (GeometryCollection<Geometry>) geometry;
List<Geometry> geometries = geomCollection.getGeometries();
for (Geometry subGeometry : geometries) {
buildEnvelope(subGeometry, envelope);
}
break;
default:
}
}
示例7: getGeometryString
import mil.nga.wkb.geom.Triangle; //导入依赖的package包/类
/**
* Get Geometry Information as a String
*
* @param geometry
* geometry
* @return geometry String
*/
public static String getGeometryString(Geometry geometry) {
StringBuilder message = new StringBuilder();
GeometryType geometryType = geometry.getGeometryType();
switch (geometryType) {
case POINT:
addPointMessage(message, (Point) geometry);
break;
case LINESTRING:
addLineStringMessage(message, (LineString) geometry);
break;
case POLYGON:
addPolygonMessage(message, (Polygon) geometry);
break;
case MULTIPOINT:
addMultiPointMessage(message, (MultiPoint) geometry);
break;
case MULTILINESTRING:
addMultiLineStringMessage(message, (MultiLineString) geometry);
break;
case MULTIPOLYGON:
addMultiPolygonMessage(message, (MultiPolygon) geometry);
break;
case CIRCULARSTRING:
addLineStringMessage(message, (CircularString) geometry);
break;
case COMPOUNDCURVE:
addCompoundCurveMessage(message, (CompoundCurve) geometry);
break;
case POLYHEDRALSURFACE:
addPolyhedralSurfaceMessage(message, (PolyhedralSurface) geometry);
break;
case TIN:
addPolyhedralSurfaceMessage(message, (TIN) geometry);
break;
case TRIANGLE:
addPolygonMessage(message, (Triangle) geometry);
break;
case GEOMETRYCOLLECTION:
@SuppressWarnings("unchecked")
GeometryCollection<Geometry> geomCollection = (GeometryCollection<Geometry>) geometry;
message.append("Geometries: " + geomCollection.numGeometries());
List<Geometry> geometries = geomCollection.getGeometries();
for (int i = 0; i < geometries.size(); i++) {
Geometry subGeometry = geometries.get(i);
message.append("\n\n");
message.append(Geometry.class.getSimpleName() + " " + (i + 1));
message.append("\n");
message.append(subGeometry.getGeometryType().getName());
message.append("\n");
message.append(getGeometryString(subGeometry));
}
break;
default:
}
return message.toString();
}
示例8: getJSONCompatibleGeometry
import mil.nga.wkb.geom.Triangle; //导入依赖的package包/类
/**
* Get a Geometry object that is JSON compatible
*
* @param geometry
* geometry
* @return geometry JSON object
*/
public static Object getJSONCompatibleGeometry(Geometry geometry) {
Map<String, Object> jsonObject = new HashMap<>();
Object geometryObject = null;
GeometryType geometryType = geometry.getGeometryType();
switch (geometryType) {
case POINT:
geometryObject = getPoint((Point) geometry);
break;
case LINESTRING:
geometryObject = getLineString((LineString) geometry);
break;
case POLYGON:
geometryObject = getPolygon((Polygon) geometry);
break;
case MULTIPOINT:
geometryObject = getMultiPoint((MultiPoint) geometry);
break;
case MULTILINESTRING:
geometryObject = getMultiLineString((MultiLineString) geometry);
break;
case MULTIPOLYGON:
geometryObject = getMultiPolygon((MultiPolygon) geometry);
break;
case CIRCULARSTRING:
geometryObject = getLineString((CircularString) geometry);
break;
case COMPOUNDCURVE:
geometryObject = getCompoundCurve((CompoundCurve) geometry);
break;
case POLYHEDRALSURFACE:
geometryObject = getPolyhedralSurface((PolyhedralSurface) geometry);
break;
case TIN:
geometryObject = getPolyhedralSurface((TIN) geometry);
break;
case TRIANGLE:
geometryObject = getPolygon((Triangle) geometry);
break;
case GEOMETRYCOLLECTION:
List<Object> jsonGeoCollectionObject = new ArrayList<>();
@SuppressWarnings("unchecked")
GeometryCollection<Geometry> geomCollection = (GeometryCollection<Geometry>) geometry;
List<Geometry> geometries = geomCollection.getGeometries();
for (int i = 0; i < geometries.size(); i++) {
Geometry subGeometry = geometries.get(i);
jsonGeoCollectionObject
.add(getJSONCompatibleGeometry(subGeometry));
}
geometryObject = jsonGeoCollectionObject;
break;
default:
}
if (geometryObject != null) {
jsonObject.put(geometryType.getName(), geometryObject);
}
return jsonObject;
}
示例9: minimizeGeometry
import mil.nga.wkb.geom.Triangle; //导入依赖的package包/类
/**
* Minimize the geometry using the shortest x distance between each
* connected set of points. The resulting geometry point x values will be in
* the range: (3 * min value <= x <= 3 * max value
*
* Example: For WGS84 provide a max x of 180.0. Resulting x values will be
* in the range: -540.0 <= x <= 540.0
*
* Example: For web mercator provide a world width of 20037508.342789244.
* Resulting x values will be in the range: -60112525.028367732 <= x <=
* 60112525.028367732
*
* @param geometry
* geometry
* @param maxX
* max positive x value in the geometry projection
*/
public static void minimizeGeometry(Geometry geometry, double maxX) {
GeometryType geometryType = geometry.getGeometryType();
switch (geometryType) {
case LINESTRING:
minimize((LineString) geometry, maxX);
break;
case POLYGON:
minimize((Polygon) geometry, maxX);
break;
case MULTILINESTRING:
minimize((MultiLineString) geometry, maxX);
break;
case MULTIPOLYGON:
minimize((MultiPolygon) geometry, maxX);
break;
case CIRCULARSTRING:
minimize((CircularString) geometry, maxX);
break;
case COMPOUNDCURVE:
minimize((CompoundCurve) geometry, maxX);
break;
case POLYHEDRALSURFACE:
minimize((PolyhedralSurface) geometry, maxX);
break;
case TIN:
minimize((TIN) geometry, maxX);
break;
case TRIANGLE:
minimize((Triangle) geometry, maxX);
break;
case GEOMETRYCOLLECTION:
@SuppressWarnings("unchecked")
GeometryCollection<Geometry> geomCollection = (GeometryCollection<Geometry>) geometry;
for (Geometry subGeometry : geomCollection.getGeometries()) {
minimizeGeometry(subGeometry, maxX);
}
break;
default:
break;
}
}
示例10: normalizeGeometry
import mil.nga.wkb.geom.Triangle; //导入依赖的package包/类
/**
* Normalize the geometry so all points outside of the min and max value
* range are adjusted to fall within the range.
*
* Example: For WGS84 provide a max x of 180.0. Resulting x values will be
* in the range: -180.0 <= x <= 180.0.
*
* Example: For web mercator provide a world width of 20037508.342789244.
* Resulting x values will be in the range: -20037508.342789244 <= x <=
* 20037508.342789244.
*
* @param geometry
* geometry
* @param maxX
* max positive x value in the geometry projection
*/
public static void normalizeGeometry(Geometry geometry, double maxX) {
GeometryType geometryType = geometry.getGeometryType();
switch (geometryType) {
case POINT:
normalize((Point) geometry, maxX);
break;
case LINESTRING:
normalize((LineString) geometry, maxX);
break;
case POLYGON:
normalize((Polygon) geometry, maxX);
break;
case MULTIPOINT:
normalize((MultiPoint) geometry, maxX);
break;
case MULTILINESTRING:
normalize((MultiLineString) geometry, maxX);
break;
case MULTIPOLYGON:
normalize((MultiPolygon) geometry, maxX);
break;
case CIRCULARSTRING:
normalize((CircularString) geometry, maxX);
break;
case COMPOUNDCURVE:
normalize((CompoundCurve) geometry, maxX);
break;
case POLYHEDRALSURFACE:
normalize((PolyhedralSurface) geometry, maxX);
break;
case TIN:
normalize((TIN) geometry, maxX);
break;
case TRIANGLE:
normalize((Triangle) geometry, maxX);
break;
case GEOMETRYCOLLECTION:
@SuppressWarnings("unchecked")
GeometryCollection<Geometry> geomCollection = (GeometryCollection<Geometry>) geometry;
for (Geometry subGeometry : geomCollection.getGeometries()) {
normalizeGeometry(subGeometry, maxX);
}
break;
default:
break;
}
}
示例11: readTriangle
import mil.nga.wkb.geom.Triangle; //导入依赖的package包/类
/**
* Read a Triangle
*
* @param reader
* @param hasZ
* @param hasM
* @return triangle
*/
public static Triangle readTriangle(ByteReader reader, boolean hasZ,
boolean hasM) {
Triangle triangle = new Triangle(hasZ, hasM);
int numRings = reader.readInt();
for (int i = 0; i < numRings; i++) {
LineString ring = readLineString(reader, hasZ, hasM);
triangle.addRing(ring);
}
return triangle;
}