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

Java GeometryCollection类代码示例

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

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



GeometryCollection类属于mil.nga.wkb.geom包,在下文中一共展示了GeometryCollection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: readGeometryCollection

import mil.nga.wkb.geom.GeometryCollection; //导入依赖的package包/类
/**
 * Read a Geometry Collection
 * 
 * @param reader
 * @param hasZ
 * @param hasM
 * @return geometry collection
 */
public static GeometryCollection<Geometry> readGeometryCollection(
		ByteReader reader, boolean hasZ, boolean hasM) {

	GeometryCollection<Geometry> geometryCollection = new GeometryCollection<Geometry>(
			hasZ, hasM);

	int numGeometries = reader.readInt();

	for (int i = 0; i < numGeometries; i++) {
		Geometry geometry = readGeometry(reader, Geometry.class);
		geometryCollection.addGeometry(geometry);

	}

	return geometryCollection;
}
 
开发者ID:ngageoint,项目名称:geopackage-wkb-java,代码行数:25,代码来源:WkbGeometryReader.java


示例2: toShapes

import mil.nga.wkb.geom.GeometryCollection; //导入依赖的package包/类
/**
 * Convert a {@link GeometryCollection} to a list of Map shapes
 *
 * @param geometryCollection
 * @return
 */
public List<GoogleMapShape> toShapes(
        GeometryCollection<Geometry> geometryCollection) {

    List<GoogleMapShape> shapes = new ArrayList<GoogleMapShape>();

    for (Geometry geometry : geometryCollection.getGeometries()) {
        GoogleMapShape shape = toShape(geometry);
        shapes.add(shape);
    }

    return shapes;
}
 
开发者ID:ngageoint,项目名称:geopackage-android-map,代码行数:19,代码来源:GoogleMapShapeConverter.java


示例3: addToMap

import mil.nga.wkb.geom.GeometryCollection; //导入依赖的package包/类
/**
 * Convert a {@link GeometryCollection} to a list of Map shapes and add to
 * the map
 *
 * @param map
 * @param geometryCollection
 * @return
 */
public List<GoogleMapShape> addToMap(GoogleMap map,
                                     GeometryCollection<Geometry> geometryCollection) {

    List<GoogleMapShape> shapes = new ArrayList<GoogleMapShape>();

    for (Geometry geometry : geometryCollection.getGeometries()) {
        GoogleMapShape shape = addToMap(map, geometry);
        shapes.add(shape);
    }

    return shapes;
}
 
开发者ID:ngageoint,项目名称:geopackage-android-map,代码行数:21,代码来源:GoogleMapShapeConverter.java


示例4: validateGeometryCollection

import mil.nga.wkb.geom.GeometryCollection; //导入依赖的package包/类
/**
 * Validate Geometry Collection
 * 
 * @param topGeometry
 * @param geometryCollection
 */
private static void validateGeometryCollection(Geometry topGeometry,
		GeometryCollection<?> geometryCollection) {

	validateZAndM(topGeometry, geometryCollection);

	for (Geometry geometry : geometryCollection.getGeometries()) {
		validateGeometry(geometry.getGeometryType(), geometry);
	}

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


示例5: compareGeometryCollection

import mil.nga.wkb.geom.GeometryCollection; //导入依赖的package包/类
/**
 * Compare the two geometry collections for equality
 *
 * @param expected
 * @param actual
 * @param delta
 */
private static void compareGeometryCollection(
		GeometryCollection<?> expected, GeometryCollection<?> actual,
		double delta) {

	compareBaseGeometryAttributes(expected, actual);
	TestCase.assertEquals(expected.numGeometries(), actual.numGeometries());
	for (int i = 0; i < expected.numGeometries(); i++) {
		compareGeometries(expected.getGeometries().get(i), actual
				.getGeometries().get(i), delta);
	}
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:19,代码来源:GeoPackageGeometryDataUtils.java


示例6: transform

import mil.nga.wkb.geom.GeometryCollection; //导入依赖的package包/类
/**
 * Transform the projected geometry collection
 * 
 * @param geometryCollection
 * @return projected geometry collection
 */
public GeometryCollection<Geometry> transform(
		GeometryCollection<Geometry> geometryCollection) {

	GeometryCollection<Geometry> to = new GeometryCollection<Geometry>(
			geometryCollection.hasZ(), geometryCollection.hasM());

	for (Geometry geometry : geometryCollection.getGeometries()) {
		Geometry toGeometry = transform(geometry);
		to.addGeometry(toGeometry);
	}

	return to;
}
 
开发者ID:ngageoint,项目名称:geopackage-core-java,代码行数:20,代码来源:GeometryProjectionTransform.java


示例7: compareGeometryCollection

import mil.nga.wkb.geom.GeometryCollection; //导入依赖的package包/类
/**
 * Compare the two geometry collections for equality
 * 
 * @param expected
 * @param actual
 * @param delta
 */
private static void compareGeometryCollection(
		GeometryCollection<?> expected, GeometryCollection<?> actual,
		double delta) {

	compareBaseGeometryAttributes(expected, actual);
	TestCase.assertEquals(expected.numGeometries(), actual.numGeometries());
	for (int i = 0; i < expected.numGeometries(); i++) {
		compareGeometries(expected.getGeometries().get(i), actual
				.getGeometries().get(i), delta);
	}
}
 
开发者ID:ngageoint,项目名称:geopackage-java,代码行数:19,代码来源:GeoPackageGeometryDataUtils.java


示例8: add

import mil.nga.wkb.geom.GeometryCollection; //导入依赖的package包/类
/**
 * Add a curve based dimension 1 geometry to the centroid total. Ignores
 * dimension 0 geometries.
 * 
 * @param geometry
 *            geometry
 */
public void add(Geometry geometry) {

	GeometryType geometryType = geometry.getGeometryType();
	switch (geometryType) {
	case LINESTRING:
	case CIRCULARSTRING:
		add((LineString) geometry);
		break;
	case MULTILINESTRING:
		MultiLineString multiLineString = (MultiLineString) geometry;
		addLineStrings(multiLineString.getLineStrings());
		break;
	case COMPOUNDCURVE:
		CompoundCurve compoundCurve = (CompoundCurve) geometry;
		addLineStrings(compoundCurve.getLineStrings());
		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:
		// Doesn't contribute to curve dimension
		break;
	default:
		throw new WkbException("Unsupported "
				+ this.getClass().getSimpleName() + " Geometry Type: "
				+ geometryType);
	}
}
 
开发者ID:ngageoint,项目名称:geopackage-wkb-java,代码行数:42,代码来源:CentroidCurve.java


示例9: getDimension

import mil.nga.wkb.geom.GeometryCollection; //导入依赖的package包/类
/**
 * Get the dimension of the Geometry, 0 for points, 1 for curves, 2 for
 * surfaces. If a collection, the largest dimension is returned.
 * 
 * @param geometry
 *            geometry object
 * @return dimension (0, 1, or 2)
 */
public static int getDimension(Geometry geometry) {

	int dimension = -1;

	GeometryType geometryType = geometry.getGeometryType();
	switch (geometryType) {
	case POINT:
	case MULTIPOINT:
		dimension = 0;
		break;
	case LINESTRING:
	case MULTILINESTRING:
	case CIRCULARSTRING:
	case COMPOUNDCURVE:
		dimension = 1;
		break;
	case POLYGON:
	case CURVEPOLYGON:
	case MULTIPOLYGON:
	case POLYHEDRALSURFACE:
	case TIN:
	case TRIANGLE:
		dimension = 2;
		break;
	case GEOMETRYCOLLECTION:
		@SuppressWarnings("unchecked")
		GeometryCollection<Geometry> geomCollection = (GeometryCollection<Geometry>) geometry;
		List<Geometry> geometries = geomCollection.getGeometries();
		for (Geometry subGeometry : geometries) {
			dimension = Math.max(dimension, getDimension(subGeometry));
		}
		break;
	default:
		throw new WkbException("Unsupported Geometry Type: " + geometryType);
	}

	return dimension;
}
 
开发者ID:ngageoint,项目名称:geopackage-wkb-java,代码行数:47,代码来源:GeometryUtils.java


示例10: add

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


示例11: add

import mil.nga.wkb.geom.GeometryCollection; //导入依赖的package包/类
/**
 * Add a point based dimension 0 geometry to the centroid total
 * 
 * @param geometry
 *            geometry
 */
public void add(Geometry geometry) {
	GeometryType geometryType = geometry.getGeometryType();
	switch (geometryType) {
	case POINT:
		add((Point) geometry);
		break;
	case MULTIPOINT:
		MultiPoint multiPoint = (MultiPoint) geometry;
		for (Point point : multiPoint.getPoints()) {
			add(point);
		}
		break;
	case GEOMETRYCOLLECTION:
		@SuppressWarnings("unchecked")
		GeometryCollection<Geometry> geomCollection = (GeometryCollection<Geometry>) geometry;
		List<Geometry> geometries = geomCollection.getGeometries();
		for (Geometry subGeometry : geometries) {
			add(subGeometry);
		}
		break;
	default:
		throw new WkbException("Unsupported "
				+ this.getClass().getSimpleName() + " Geometry Type: "
				+ geometryType);
	}
}
 
开发者ID:ngageoint,项目名称:geopackage-wkb-java,代码行数:33,代码来源:CentroidPoint.java


示例12: writeGeometryCollection

import mil.nga.wkb.geom.GeometryCollection; //导入依赖的package包/类
/**
 * Write a Geometry Collection
 * 
 * @param writer
 * @param geometryCollection
 * @throws IOException
 */
public static void writeGeometryCollection(ByteWriter writer,
		GeometryCollection<?> geometryCollection) throws IOException {

	writer.writeInt(geometryCollection.numGeometries());

	for (Geometry geometry : geometryCollection.getGeometries()) {
		writeGeometry(writer, geometry);
	}
}
 
开发者ID:ngageoint,项目名称:geopackage-wkb-java,代码行数:17,代码来源:WkbGeometryWriter.java


示例13: testGeometryCollection

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

	for (int i = 0; i < GEOMETRIES_PER_TEST; i++) {
		// Create and test a geometry collection
		GeometryCollection<Geometry> geometryCollection = WKBTestUtils
				.createGeometryCollection(WKBTestUtils.coinFlip(),
						WKBTestUtils.coinFlip());
		geometryTester(geometryCollection);
	}

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


示例14: testGeometryCollectionCentroid

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

	for (int i = 0; i < GEOMETRIES_PER_TEST; i++) {
		// Create and test a geometry collection
		GeometryCollection<Geometry> geometryCollection = createGeometryCollection(
				WKBTestUtils.coinFlip(), WKBTestUtils.coinFlip());
		geometryCentroidTester(geometryCollection);
	}

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


示例15: createGeometryCollection

import mil.nga.wkb.geom.GeometryCollection; //导入依赖的package包/类
private static GeometryCollection<Geometry> createGeometryCollection(
		boolean hasZ, boolean hasM) {

	GeometryCollection<Geometry> geometryCollection = new GeometryCollection<Geometry>(
			hasZ, hasM);

	int num = 1 + ((int) (Math.random() * 5));

	for (int i = 0; i < num; i++) {

		Geometry geometry = null;
		int randomGeometry = (int) (Math.random() * 6);

		switch (randomGeometry) {
		case 0:
			geometry = WKBTestUtils.createPoint(hasZ, hasM);
			break;
		case 1:
			geometry = WKBTestUtils.createLineString(hasZ, hasM);
			break;
		case 2:
			geometry = createPolygon();
			break;
		case 3:
			geometry = WKBTestUtils.createMultiPoint(hasZ, hasM);
			break;
		case 4:
			geometry = WKBTestUtils.createMultiLineString(hasZ, hasM);
			break;
		case 5:
			geometry = createMultiPolygon();
			break;
		}

		geometryCollection.addGeometry(geometry);
	}

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


示例16: compareGeometryCollection

import mil.nga.wkb.geom.GeometryCollection; //导入依赖的package包/类
/**
 * Compare the two geometry collections for equality
 * 
 * @param expected
 * @param actual
 */
public static void compareGeometryCollection(
		GeometryCollection<?> expected, GeometryCollection<?> actual) {

	compareBaseGeometryAttributes(expected, actual);
	TestCase.assertEquals(expected.numGeometries(), actual.numGeometries());
	for (int i = 0; i < expected.numGeometries(); i++) {
		compareGeometries(expected.getGeometries().get(i), actual
				.getGeometries().get(i));
	}
}
 
开发者ID:ngageoint,项目名称:geopackage-wkb-java,代码行数:17,代码来源:WKBTestUtils.java


示例17: createGeometryCollection

import mil.nga.wkb.geom.GeometryCollection; //导入依赖的package包/类
/**
 * Create a random geometry collection
 * 
 * @param hasZ
 * @param hasM
 * @return
 */
public static GeometryCollection<Geometry> createGeometryCollection(
		boolean hasZ, boolean hasM) {

	GeometryCollection<Geometry> geometryCollection = new GeometryCollection<Geometry>(
			hasZ, hasM);

	int num = 1 + ((int) (Math.random() * 5));

	for (int i = 0; i < num; i++) {

		Geometry geometry = null;
		int randomGeometry = (int) (Math.random() * 6);

		switch (randomGeometry) {
		case 0:
			geometry = createPoint(hasZ, hasM);
			break;
		case 1:
			geometry = createLineString(hasZ, hasM);
			break;
		case 2:
			geometry = createPolygon(hasZ, hasM);
			break;
		case 3:
			geometry = createMultiPoint(hasZ, hasM);
			break;
		case 4:
			geometry = createMultiLineString(hasZ, hasM);
			break;
		case 5:
			geometry = createMultiPolygon(hasZ, hasM);
			break;
		}

		geometryCollection.addGeometry(geometry);
	}

	return geometryCollection;
}
 
开发者ID:ngageoint,项目名称:geopackage-wkb-java,代码行数:47,代码来源:WKBTestUtils.java


示例18: toShapes

import mil.nga.wkb.geom.GeometryCollection; //导入依赖的package包/类
/**
 * Convert a {@link GeometryCollection} to a list of Map shapes
 *
 * @param geometryCollection
 * @return
 */
public List<OsmDroidMapShape> toShapes(
    GeometryCollection<Geometry> geometryCollection) {

    List<OsmDroidMapShape> shapes = new ArrayList<OsmDroidMapShape>();

    for (Geometry geometry : geometryCollection.getGeometries()) {
        OsmDroidMapShape shape = toShape(geometry);
        shapes.add(shape);
    }

    return shapes;
}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:19,代码来源:OsmMapShapeConverter.java


示例19: addToMap

import mil.nga.wkb.geom.GeometryCollection; //导入依赖的package包/类
/**
 * Convert a {@link GeometryCollection} to a list of Map shapes and add to
 * the map
 *
 * @param map
 * @param geometryCollection
 * @return
 */
public List<OsmDroidMapShape> addToMap(MapView map,
                                     GeometryCollection<Geometry> geometryCollection) {

    List<OsmDroidMapShape> shapes = new ArrayList<OsmDroidMapShape>();

    for (Geometry geometry : geometryCollection.getGeometries()) {
        OsmDroidMapShape shape = addToMap(map, geometry);
        shapes.add(shape);
    }

    return shapes;
}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:21,代码来源:OsmMapShapeConverter.java


示例20: validateGeometry

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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java OWLXMLDocumentFormat类代码示例发布时间:2022-05-22
下一篇:
Java BuildTarget类代码示例发布时间: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