当前位置: 首页>>代码示例>>Java>>正文


Java Polygon.getRings方法代码示例

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


在下文中一共展示了Polygon.getRings方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: comparePolygonAndMapPolygon

import mil.nga.wkb.geom.Polygon; //导入方法依赖的package包/类
/**
 * Compare Polygon with Map Polygon
 *
    * @param converter
 * @param polygon
 * @param polygon2
 */
private static void comparePolygonAndMapPolygon(GoogleMapShapeConverter converter,
           Polygon polygon,
		PolygonOptions polygon2) {
	List<LineString> rings = polygon.getRings();
	List<LatLng> points = polygon2.getPoints();
	List<List<LatLng>> holes = polygon2.getHoles();

	TestCase.assertEquals(polygon.numRings(), 1 + holes.size());

	LineString polygonRing = rings.get(0);
	compareLineStringAndLatLngs(converter, polygonRing, points);

	for (int i = 1; i < rings.size(); i++) {
		LineString ring = rings.get(i);
		List<LatLng> hole = holes.get(i - 1);
		compareLineStringAndLatLngs(converter, ring, hole);
	}
}
 
开发者ID:ngageoint,项目名称:geopackage-android-map,代码行数:26,代码来源:GoogleMapShapeConverterUtils.java

示例2: addPolygon

import mil.nga.wkb.geom.Polygon; //导入方法依赖的package包/类
/**
 * Add the polygon on the canvas
 *
 * @param simplifyTolerance simplify tolerance in meters
 * @param boundingBox
 * @param transform
 * @param path
 * @param polygon
 */
private void addPolygon(double simplifyTolerance, BoundingBox boundingBox, ProjectionTransform transform, Path path, Polygon polygon) {
    List<LineString> rings = polygon.getRings();
    if (!rings.isEmpty()) {

        // Add the polygon points
        LineString polygonLineString = rings.get(0);
        List<Point> polygonPoints = polygonLineString.getPoints();
        if (polygonPoints.size() >= 2) {
            addRing(simplifyTolerance, boundingBox, transform, path, polygonPoints);

            // Add the holes
            for (int i = 1; i < rings.size(); i++) {
                LineString holeLineString = rings.get(i);
                List<Point> holePoints = holeLineString.getPoints();
                if (holePoints.size() >= 2) {
                    addRing(simplifyTolerance, boundingBox, transform, path, holePoints);
                }
            }
        }
    }
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:31,代码来源:DefaultFeatureTiles.java

示例3: getArea

import mil.nga.wkb.geom.Polygon; //导入方法依赖的package包/类
/**
 * Get the area of the polygon
 *
 * @param simplifyTolerance
 *            simplify tolerance in meters
 * @param boundingBox
 * @param transform
 * @param lineString
 */
private Area getArea(double simplifyTolerance, BoundingBox boundingBox,
		ProjectionTransform transform, Polygon polygon) {

	Area area = null;

	for (LineString ring : polygon.getRings()) {

		Path2D path = getPath(simplifyTolerance, boundingBox, transform,
				ring);
		Area ringArea = new Area(path);

		if (area == null) {
			area = ringArea;
		} else {
			area.subtract(ringArea);
		}

	}

	return area;
}
 
开发者ID:ngageoint,项目名称:geopackage-java,代码行数:31,代码来源:DefaultFeatureTiles.java

示例4: comparePolygons

import mil.nga.wkb.geom.Polygon; //导入方法依赖的package包/类
/**
 * Compare two Polygons
 * 
 * @param polygon
 * @param polygon2
 */
private static void comparePolygons(Polygon polygon, Polygon polygon2) {
	List<LineString> rings = polygon.getRings();
	List<LineString> rings2 = polygon2.getRings();

	TestCase.assertEquals(polygon.numRings(), polygon2.numRings());

	for (int i = 0; i < polygon.numRings(); i++) {
		compareLineStrings(rings.get(i), rings2.get(i));
	}
}
 
开发者ID:ngageoint,项目名称:geopackage-android-map,代码行数:17,代码来源:GoogleMapShapeConverterUtils.java

示例5: polygonHasKinks

import mil.nga.wkb.geom.Polygon; //导入方法依赖的package包/类
public static boolean polygonHasKinks(Polygon polygon) {
    for (LineString line1 : polygon.getRings()) {
        Point lastPoint = line1.getPoints().get(line1.numPoints() - 1);
        for (LineString line2 : polygon.getRings()) {
            for (int i = 0; i < line1.numPoints() - 1; i++) {
                Point point1 = line1.getPoints().get(i);
                Point nextPoint1 = line1.getPoints().get(i + 1);
                for (int k = i; k < line2.numPoints() - 1; k++) {
                    Point point2 = line2.getPoints().get(k);
                    Point nextPoint2 = line2.getPoints().get(k + 1);
                    if (line1 != line2) {
                        continue;
                    }

                    if (Math.abs(i - k) == 1) {
                        continue;
                    }

                    if (i == 0 && k == line1.numPoints() - 2 && point1.getX() == lastPoint.getX() && point1.getY() == lastPoint.getY()) {
                        continue;
                    }

                    boolean intersects = intersects(point1, nextPoint1, point2, nextPoint2);

                    if (intersects) {
                        return true;
                    }
                }
            }
        }
    }

    return false;
}
 
开发者ID:ngageoint,项目名称:mage-android,代码行数:35,代码来源:MapUtils.java

示例6: transform

import mil.nga.wkb.geom.Polygon; //导入方法依赖的package包/类
/**
 * Transform the projected polygon
 * 
 * @param polygon
 * @return projected polygon
 */
public Polygon transform(Polygon polygon) {

	Polygon to = new Polygon(polygon.hasZ(), polygon.hasM());

	for (LineString ring : polygon.getRings()) {
		LineString toRing = transform(ring);
		to.addRing(toRing);
	}

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

示例7: addPolygonMessage

import mil.nga.wkb.geom.Polygon; //导入方法依赖的package包/类
/**
 * Add Polygon
 * 
 * @param envelope
 * @param polygon
 */
private static void addPolygonMessage(GeometryEnvelope envelope,
		Polygon polygon) {

	updateHasZandM(envelope, polygon);

	List<LineString> rings = polygon.getRings();
	for (LineString ring : rings) {
		addLineStringMessage(envelope, ring);
	}
}
 
开发者ID:ngageoint,项目名称:geopackage-wkb-java,代码行数:17,代码来源:GeometryEnvelopeBuilder.java

示例8: addPolygonMessage

import mil.nga.wkb.geom.Polygon; //导入方法依赖的package包/类
/**
 * Add Polygon message
 * 
 * @param message
 * @param polygon
 */
private static void addPolygonMessage(StringBuilder message, Polygon polygon) {
	message.append("Rings: " + polygon.numRings());
	List<LineString> rings = polygon.getRings();
	for (int i = 0; i < rings.size(); i++) {
		LineString ring = rings.get(i);
		message.append("\n\n");
		if (i > 0) {
			message.append("Hole " + i);
			message.append("\n");
		}
		addLineStringMessage(message, ring);
	}
}
 
开发者ID:ngageoint,项目名称:geopackage-wkb-java,代码行数:20,代码来源:GeometryPrinter.java

示例9: getPolygon

import mil.nga.wkb.geom.Polygon; //导入方法依赖的package包/类
/**
 * Get Polygon object
 * 
 * @param polygon
 * @return polygon object
 */
private static Object getPolygon(Polygon polygon) {
	List<Object> jsonObject = new ArrayList<>();
	List<LineString> rings = polygon.getRings();
	for (int i = 0; i < rings.size(); i++) {
		LineString ring = rings.get(i);
		jsonObject.add(getLineString(ring));
	}
	return jsonObject;
}
 
开发者ID:ngageoint,项目名称:geopackage-wkb-java,代码行数:16,代码来源:GeometryJSONCompatible.java

示例10: add

import mil.nga.wkb.geom.Polygon; //导入方法依赖的package包/类
/**
 * Add a polygon to the centroid total
 * 
 * @param polygon
 *            polygon
 */
private void add(Polygon polygon) {
	List<LineString> rings = polygon.getRings();
	add(rings.get(0));
	for (int i = 1; i < rings.size(); i++) {
		addHole(rings.get(i));
	}
}
 
开发者ID:ngageoint,项目名称:geopackage-wkb-java,代码行数:14,代码来源:CentroidSurface.java

示例11: writePolygon

import mil.nga.wkb.geom.Polygon; //导入方法依赖的package包/类
/**
 * Write a Polygon
 * 
 * @param writer
 * @param polygon
 * @throws IOException
 */
public static void writePolygon(ByteWriter writer, Polygon polygon)
		throws IOException {

	writer.writeInt(polygon.numRings());

	for (LineString ring : polygon.getRings()) {
		writeLineString(writer, ring);
	}
}
 
开发者ID:ngageoint,项目名称:geopackage-wkb-java,代码行数:17,代码来源:WkbGeometryWriter.java

示例12: validatePolygon

import mil.nga.wkb.geom.Polygon; //导入方法依赖的package包/类
/**
 * Validate Polygon
 * 
 * @param topGeometry
 * @param polygon
 */
private static void validatePolygon(Geometry topGeometry, Polygon polygon) {

	TestCase.assertEquals(GeometryType.POLYGON, polygon.getGeometryType());

	validateZAndM(topGeometry, polygon);

	for (LineString ring : polygon.getRings()) {
		validateLineString(topGeometry, ring);
	}

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

示例13: minimize

import mil.nga.wkb.geom.Polygon; //导入方法依赖的package包/类
/**
 * Minimize the polygon
 * 
 * @param polygon
 *            polygon
 * @param maxX
 *            max positive x value in the geometry projection
 */
private static void minimize(Polygon polygon, double maxX) {

	for (LineString ring : polygon.getRings()) {
		minimize(ring, maxX);
	}
}
 
开发者ID:ngageoint,项目名称:geopackage-wkb-java,代码行数:15,代码来源:GeometryUtils.java

示例14: normalize

import mil.nga.wkb.geom.Polygon; //导入方法依赖的package包/类
/**
 * Normalize the polygon
 * 
 * @param polygon
 *            polygon
 * @param maxX
 *            max positive x value in the geometry projection
 */
private static void normalize(Polygon polygon, double maxX) {

	for (LineString ring : polygon.getRings()) {
		normalize(ring, maxX);
	}
}
 
开发者ID:ngageoint,项目名称:geopackage-wkb-java,代码行数:15,代码来源:GeometryUtils.java


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