• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MultiPolygon类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中mil.nga.wkb.geom.MultiPolygon的典型用法代码示例。如果您正苦于以下问题:Java MultiPolygon类的具体用法?Java MultiPolygon怎么用?Java MultiPolygon使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MultiPolygon类属于mil.nga.wkb.geom包,在下文中一共展示了MultiPolygon类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
 
开发者ID:ngageoint,项目名称:geopackage-android-map,代码行数:18,代码来源:GoogleMapShapeConverter.java


示例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;
}
 
开发者ID:ngageoint,项目名称:geopackage-android-map,代码行数:23,代码来源:GoogleMapShapeConverter.java


示例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;
}
 
开发者ID:ngageoint,项目名称:geopackage-android-map,代码行数:20,代码来源:GoogleMapShapeConverter.java


示例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;
}
 
开发者ID:ngageoint,项目名称:geopackage-android-map,代码行数:22,代码来源:GoogleMapShapeConverter.java


示例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());
}
 
开发者ID:ngageoint,项目名称:geopackage-android-map,代码行数:21,代码来源:GoogleMapShapeConverterUtils.java


示例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);
	}

}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:20,代码来源:FeatureUtils.java


示例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);
	}
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:18,代码来源:GeoPackageGeometryDataUtils.java


示例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;
}
 
开发者ID:ngageoint,项目名称:geopackage-core-java,代码行数:19,代码来源:GeometryProjectionTransform.java


示例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);
	}
}
 
开发者ID:ngageoint,项目名称:geopackage-java,代码行数:18,代码来源:GeoPackageGeometryDataUtils.java


示例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);
	}
}
 
开发者ID:ngageoint,项目名称:geopackage-wkb-java,代码行数:17,代码来源:GeometryEnvelopeBuilder.java


示例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);
	}
}
 
开发者ID:ngageoint,项目名称:geopackage-wkb-java,代码行数:20,代码来源:GeometryPrinter.java


示例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;
}
 
开发者ID:ngageoint,项目名称:geopackage-wkb-java,代码行数:16,代码来源:GeometryJSONCompatible.java


示例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);
	}
}
 
开发者ID:ngageoint,项目名称:geopackage-wkb-java,代码行数:47,代码来源:CentroidSurface.java


示例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);
	}
}
 
开发者ID:ngageoint,项目名称:geopackage-wkb-java,代码行数:17,代码来源:WkbGeometryWriter.java


示例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);
	}

}
 
开发者ID:ngageoint,项目名称:geopackage-wkb-java,代码行数:12,代码来源:WKBTest.java


示例16: testMultiPolygonCentroid

import mil.nga.wkb.geom.MultiPolygon; //导入依赖的package包/类
@Test
public void testMultiPolygonCentroid() throws IOException {

	for (int i = 0; i < GEOMETRIES_PER_TEST; i++) {
		// Create and test a multi polygon
		MultiPolygon multiPolygon = createMultiPolygon();
		TestCase.assertEquals(2, GeometryUtils.getDimension(multiPolygon));
		geometryCentroidTester(multiPolygon);
	}

}
 
开发者ID:ngageoint,项目名称:geopackage-wkb-java,代码行数:12,代码来源:GeometryUtilsTest.java


示例17: compareMultiPolygon

import mil.nga.wkb.geom.MultiPolygon; //导入依赖的package包/类
/**
 * Compare the two multi polygons for equality
 * 
 * @param expected
 * @param actual
 */
public static void compareMultiPolygon(MultiPolygon expected,
		MultiPolygon actual) {

	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));
	}
}
 
开发者ID:ngageoint,项目名称:geopackage-wkb-java,代码行数:17,代码来源:WKBTestUtils.java


示例18: addPolygonsToMap

import mil.nga.wkb.geom.MultiPolygon; //导入依赖的package包/类
public static  org.osmdroid.gpkg.overlay.features.MultiPolygon  addPolygonsToMap(
    MapView map, List<org.osmdroid.views.overlay.Polygon>  polygons, PolygonOptions opts) {
    org.osmdroid.gpkg.overlay.features.MultiPolygon multiPolygon = new org.osmdroid.gpkg.overlay.features.MultiPolygon();
    for (org.osmdroid.views.overlay.Polygon polygonOption : polygons) {
        org.osmdroid.views.overlay.Polygon polygon = addPolygonToMap(map,polygonOption.getPoints(), polygonOption.getHoles(), opts);

        if (polygon.getInfoWindow()==null)
            polygon.setInfoWindow(new BasicInfoWindow(R.layout.bonuspack_bubble, map));
        multiPolygon.add(polygon);
    }
    return multiPolygon;
}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:13,代码来源:OsmMapShapeConverter.java


示例19: validateGeometry

import mil.nga.wkb.geom.MultiPolygon; //导入依赖的package包/类
/**
 * Validate the geometry
 * 
 * @param geometryType
 * @param geometry
 */
private static void validateGeometry(GeometryType geometryType,
		Geometry geometry) {

	switch (geometryType) {
	case POINT:
		TestCase.assertTrue(geometry instanceof Point);
		Point point = (Point) geometry;
		validatePoint(point, point);
		break;
	case LINESTRING:
		TestCase.assertTrue(geometry instanceof LineString);
		LineString lineString = (LineString) geometry;
		validateLineString(lineString, lineString);
		break;
	case POLYGON:
		TestCase.assertTrue(geometry instanceof Polygon);
		Polygon polygon = (Polygon) geometry;
		validatePolygon(polygon, polygon);
		break;
	case MULTIPOINT:
		TestCase.assertTrue(geometry instanceof MultiPoint);
		MultiPoint multiPoint = (MultiPoint) geometry;
		validateMultiPoint(multiPoint, multiPoint);
		break;
	case MULTILINESTRING:
		TestCase.assertTrue(geometry instanceof MultiLineString);
		MultiLineString multiLineString = (MultiLineString) geometry;
		validateMultiLineString(multiLineString, multiLineString);
		break;
	case MULTIPOLYGON:
		TestCase.assertTrue(geometry instanceof MultiPolygon);
		MultiPolygon multiPolygon = (MultiPolygon) geometry;
		validateMultiPolygon(multiPolygon, multiPolygon);
		break;
	case GEOMETRYCOLLECTION:
		TestCase.assertTrue(geometry instanceof GeometryCollection);
		GeometryCollection<?> geometryCollection = (GeometryCollection<?>) geometry;
		validateGeometryCollection(geometryCollection, geometryCollection);
		break;
	default:

	}
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:50,代码来源:FeatureUtils.java


示例20: buildEnvelope

import mil.nga.wkb.geom.MultiPolygon; //导入依赖的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:
	}

}
 
开发者ID:ngageoint,项目名称:geopackage-wkb-java,代码行数:60,代码来源:GeometryEnvelopeBuilder.java



注:本文中的mil.nga.wkb.geom.MultiPolygon类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ECSSVersion类代码示例发布时间:2022-05-22
下一篇:
Java EditorFactoryAdapter类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap