本文整理汇总了Java中mil.nga.wkb.geom.MultiPolygon类的典型用法代码示例。如果您正苦于以下问题:Java MultiPolygon类的具体用法?Java MultiPolygon怎么用?Java MultiPolygon使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MultiPolygon类属于mil.nga.wkb.geom包,在下文中一共展示了MultiPolygon类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toPolygons
import mil.nga.wkb.geom.MultiPolygon; //导入依赖的package包/类
/**
* Convert a {@link MultiPolygon} to a {@link MultiPolygonOptions}
*
* @param multiPolygon
* @return
*/
public MultiPolygonOptions toPolygons(MultiPolygon multiPolygon) {
MultiPolygonOptions polygons = new MultiPolygonOptions();
for (Polygon polygon : multiPolygon.getPolygons()) {
PolygonOptions polygonOptions = toPolygon(polygon);
polygons.add(polygonOptions);
}
return polygons;
}
示例2: toMultiPolygon
import mil.nga.wkb.geom.MultiPolygon; //导入依赖的package包/类
/**
* Convert a list of {@link com.google.android.gms.maps.model.Polygon} to a
* {@link MultiPolygon}
*
* @param polygonList
* @param hasZ
* @param hasM
* @return
*/
public MultiPolygon toMultiPolygon(
List<com.google.android.gms.maps.model.Polygon> polygonList,
boolean hasZ, boolean hasM) {
MultiPolygon multiPolygon = new MultiPolygon(hasZ, hasM);
for (com.google.android.gms.maps.model.Polygon mapPolygon : polygonList) {
Polygon polygon = toPolygon(mapPolygon);
multiPolygon.addPolygon(polygon);
}
return multiPolygon;
}
示例3: createMultiPolygon
import mil.nga.wkb.geom.MultiPolygon; //导入依赖的package包/类
/**
* Convert a list of {@link Polygon} to a {@link MultiPolygon}
*
* @param polygonList
* @param hasZ
* @param hasM
* @return
*/
public MultiPolygon createMultiPolygon(List<Polygon> polygonList,
boolean hasZ, boolean hasM) {
MultiPolygon multiPolygon = new MultiPolygon(hasZ, hasM);
for (Polygon polygon : polygonList) {
multiPolygon.addPolygon(polygon);
}
return multiPolygon;
}
示例4: toMultiPolygonFromOptions
import mil.nga.wkb.geom.MultiPolygon; //导入依赖的package包/类
/**
* Convert a list of {@link PolygonOptions} to a {@link MultiPolygon}
*
* @param multiPolygonOptions
* @param hasZ
* @param hasM
* @return
*/
public MultiPolygon toMultiPolygonFromOptions(
MultiPolygonOptions multiPolygonOptions, boolean hasZ, boolean hasM) {
MultiPolygon multiPolygon = new MultiPolygon(hasZ, hasM);
for (PolygonOptions mapPolygon : multiPolygonOptions
.getPolygonOptions()) {
Polygon polygon = toPolygon(mapPolygon);
multiPolygon.addPolygon(polygon);
}
return multiPolygon;
}
示例5: convertMultiPolygon
import mil.nga.wkb.geom.MultiPolygon; //导入依赖的package包/类
/**
* Test the MultiPolygon conversion
*
* @param converter
* @param multiPolygon
*/
private static void convertMultiPolygon(GoogleMapShapeConverter converter,
MultiPolygon multiPolygon) {
MultiPolygonOptions mapPolygons = converter.toPolygons(multiPolygon);
TestCase.assertNotNull(mapPolygons);
TestCase.assertFalse(mapPolygons.getPolygonOptions().isEmpty());
List<Polygon> polygons = multiPolygon.getPolygons();
comparePolygonsAndMapPolygons(converter, polygons, mapPolygons.getPolygonOptions());
MultiPolygon multiPolygon2 = converter
.toMultiPolygonFromOptions(mapPolygons);
comparePolygons(polygons, multiPolygon2.getPolygons());
}
示例6: validateMultiPolygon
import mil.nga.wkb.geom.MultiPolygon; //导入依赖的package包/类
/**
* Validate Multi Polygon
*
* @param topGeometry
* @param multiPolygon
*/
private static void validateMultiPolygon(Geometry topGeometry,
MultiPolygon multiPolygon) {
TestCase.assertEquals(GeometryType.MULTIPOLYGON,
multiPolygon.getGeometryType());
validateZAndM(topGeometry, multiPolygon);
for (Polygon polygon : multiPolygon.getPolygons()) {
validatePolygon(topGeometry, polygon);
}
}
示例7: compareMultiPolygon
import mil.nga.wkb.geom.MultiPolygon; //导入依赖的package包/类
/**
* Compare the two multi polygons for equality
*
* @param expected
* @param actual
* @param delta
*/
private static void compareMultiPolygon(MultiPolygon expected,
MultiPolygon actual, double delta) {
compareBaseGeometryAttributes(expected, actual);
TestCase.assertEquals(expected.numPolygons(), actual.numPolygons());
for (int i = 0; i < expected.numPolygons(); i++) {
comparePolygon(expected.getPolygons().get(i), actual.getPolygons()
.get(i), delta);
}
}
示例8: transform
import mil.nga.wkb.geom.MultiPolygon; //导入依赖的package包/类
/**
* Transform the projected multi polygon
*
* @param multiPolygon
* @return projected multi polygon
*/
public MultiPolygon transform(MultiPolygon multiPolygon) {
MultiPolygon to = new MultiPolygon(multiPolygon.hasZ(),
multiPolygon.hasM());
for (Polygon polygon : multiPolygon.getPolygons()) {
Polygon toPolygon = transform(polygon);
to.addPolygon(toPolygon);
}
return to;
}
示例9: compareMultiPolygon
import mil.nga.wkb.geom.MultiPolygon; //导入依赖的package包/类
/**
* Compare the two multi polygons for equality
*
* @param expected
* @param actual
* @param delta
*/
private static void compareMultiPolygon(MultiPolygon expected,
MultiPolygon actual, double delta) {
compareBaseGeometryAttributes(expected, actual);
TestCase.assertEquals(expected.numPolygons(), actual.numPolygons());
for (int i = 0; i < expected.numPolygons(); i++) {
comparePolygon(expected.getPolygons().get(i), actual.getPolygons()
.get(i), delta);
}
}
示例10: addMultiPolygonMessage
import mil.nga.wkb.geom.MultiPolygon; //导入依赖的package包/类
/**
* Add MultiPolygon
*
* @param envelope
* @param multiPolygon
*/
private static void addMultiPolygonMessage(GeometryEnvelope envelope,
MultiPolygon multiPolygon) {
updateHasZandM(envelope, multiPolygon);
List<Polygon> polygons = multiPolygon.getPolygons();
for (Polygon polygon : polygons) {
addPolygonMessage(envelope, polygon);
}
}
示例11: addMultiPolygonMessage
import mil.nga.wkb.geom.MultiPolygon; //导入依赖的package包/类
/**
* Add MultiPolygon message
*
* @param message
* @param multiPolygon
*/
private static void addMultiPolygonMessage(StringBuilder message,
MultiPolygon multiPolygon) {
message.append(Polygon.class.getSimpleName() + "s: "
+ multiPolygon.numPolygons());
List<Polygon> polygons = multiPolygon.getPolygons();
for (int i = 0; i < polygons.size(); i++) {
Polygon polygon = polygons.get(i);
message.append("\n\n");
message.append(Polygon.class.getSimpleName() + " " + (i + 1));
message.append("\n");
addPolygonMessage(message, polygon);
}
}
示例12: getMultiPolygon
import mil.nga.wkb.geom.MultiPolygon; //导入依赖的package包/类
/**
* Get MultiPolygon object
*
* @param multiPolygon
* @return multi polygon object
*/
private static Object getMultiPolygon(MultiPolygon multiPolygon) {
List<Object> jsonObject = new ArrayList<>();
List<Polygon> polygons = multiPolygon.getPolygons();
for (int i = 0; i < polygons.size(); i++) {
Polygon polygon = polygons.get(i);
jsonObject.add(getPolygon(polygon));
}
return jsonObject;
}
示例13: add
import mil.nga.wkb.geom.MultiPolygon; //导入依赖的package包/类
/**
* Add a surface based dimension 2 geometry to the centroid total. Ignores
* dimension 0 and 1 geometries.
*
* @param geometry
* geometry
*/
public void add(Geometry geometry) {
GeometryType geometryType = geometry.getGeometryType();
switch (geometryType) {
case POLYGON:
case TRIANGLE:
add((Polygon) geometry);
break;
case MULTIPOLYGON:
MultiPolygon multiPolygon = (MultiPolygon) geometry;
add(multiPolygon.getPolygons());
break;
case POLYHEDRALSURFACE:
case TIN:
PolyhedralSurface polyhedralSurface = (PolyhedralSurface) geometry;
add(polyhedralSurface.getPolygons());
break;
case GEOMETRYCOLLECTION:
@SuppressWarnings("unchecked")
GeometryCollection<Geometry> geomCollection = (GeometryCollection<Geometry>) geometry;
List<Geometry> geometries = geomCollection.getGeometries();
for (Geometry subGeometry : geometries) {
add(subGeometry);
}
break;
case POINT:
case MULTIPOINT:
case LINESTRING:
case CIRCULARSTRING:
case MULTILINESTRING:
case COMPOUNDCURVE:
// Doesn't contribute to surface dimension
break;
default:
throw new WkbException("Unsupported "
+ this.getClass().getSimpleName() + " Geometry Type: "
+ geometryType);
}
}
示例14: writeMultiPolygon
import mil.nga.wkb.geom.MultiPolygon; //导入依赖的package包/类
/**
* Write a Multi Polygon
*
* @param writer
* @param multiPolygon
* @throws IOException
*/
public static void writeMultiPolygon(ByteWriter writer,
MultiPolygon multiPolygon) throws IOException {
writer.writeInt(multiPolygon.numPolygons());
for (Polygon polygon : multiPolygon.getPolygons()) {
writeGeometry(writer, polygon);
}
}
示例15: testMultiPolygon
import mil.nga.wkb.geom.MultiPolygon; //导入依赖的package包/类
@Test
public void testMultiPolygon() throws IOException {
for (int i = 0; i < GEOMETRIES_PER_TEST; i++) {
// Create and test a multi polygon
MultiPolygon multiPolygon = WKBTestUtils.createMultiPolygon(
WKBTestUtils.coinFlip(), WKBTestUtils.coinFlip());
geometryTester(multiPolygon);
}
}