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

Java Polygon类代码示例

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

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



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

import mil.nga.wkb.geom.Polygon; //导入依赖的package包/类
/**
 * Test the PolyhedralSurface conversion
 * 
 * @param converter
 * @param polyhedralSurface
 */
private static void convertMultiPolygon(GoogleMapShapeConverter converter,
		PolyhedralSurface polyhedralSurface) {

	MultiPolygonOptions mapPolygons = converter
			.toPolygons(polyhedralSurface);
	TestCase.assertNotNull(mapPolygons);
	TestCase.assertFalse(mapPolygons.getPolygonOptions().isEmpty());

	List<Polygon> polygons = polyhedralSurface.getPolygons();
	comparePolygonsAndMapPolygons(converter, polygons, mapPolygons.getPolygonOptions());

	PolyhedralSurface polyhedralSurface2 = converter
			.toPolyhedralSurfaceWithOptions(mapPolygons);
	comparePolygons(polygons, polyhedralSurface.getPolygons());
}
 
开发者ID:ngageoint,项目名称:geopackage-android-map,代码行数:22,代码来源:GoogleMapShapeConverterUtils.java


示例3: 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


示例4: 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


示例5: createPolygon

import mil.nga.wkb.geom.Polygon; //导入依赖的package包/类
private static Polygon createPolygon() {

		Polygon polygon = new Polygon();
		LineString lineString = new LineString();
		lineString.addPoint(createPoint(-180.0, 45.0, 90.0, 45.0));
		lineString.addPoint(createPoint(-180.0, -90.0, 90.0, 45.0));
		lineString.addPoint(createPoint(90.0, -90.0, 90.0, 45.0));
		lineString.addPoint(createPoint(90.0, 45.0, 90.0, 45.0));
		polygon.addRing(lineString);

		LineString holeLineString = new LineString();
		holeLineString.addPoint(createPoint(-90.0, 0.0, 90.0, 45.0));
		holeLineString.addPoint(createPoint(-90.0, -45.0, 90.0, 45.0));
		holeLineString.addPoint(createPoint(0.0, -45.0, 90.0, 45.0));
		holeLineString.addPoint(createPoint(0.0, 0.0, 90.0, 45.0));
		polygon.addRing(holeLineString);

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


示例6: addPolygonToMap

import mil.nga.wkb.geom.Polygon; //导入依赖的package包/类
/**
 * Add a Polygon to the map
 *
 * @param map

 * @return
 */
public static org.osmdroid.views.overlay.Polygon addPolygonToMap(
    MapView map,
    List<GeoPoint> pts,
    List<List<GeoPoint>> holes, PolygonOptions options) {
    org.osmdroid.views.overlay.Polygon polygon1 = new org.osmdroid.views.overlay.Polygon(map);
    polygon1.setPoints(pts);
    polygon1.getHoles().addAll(holes);
    if (options!=null) {
        polygon1.setFillColor(options.getFillColor());
        polygon1.setTitle(options.getTitle());
        polygon1.setStrokeColor(options.getStrokeColor());
        polygon1.setStrokeWidth(options.getStrokeWidth());
        polygon1.setSubDescription(options.getSubtitle());
        polygon1.setInfoWindow(new BasicInfoWindow(R.layout.bonuspack_bubble, map));

    }


    map.getOverlayManager().add(polygon1);
    return polygon1;
}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:29,代码来源:OsmMapShapeConverter.java


示例7: toPolygons

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


示例8: toMultiPolygon

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


示例9: createMultiPolygon

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


示例10: toMultiPolygonFromOptions

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


示例11: toPolyhedralSurface

import mil.nga.wkb.geom.Polygon; //导入依赖的package包/类
/**
 * Convert a list of {@link Polygon} to a {@link PolyhedralSurface}
 *
 * @param polygonList
 * @param hasZ
 * @param hasM
 * @return
 */
public PolyhedralSurface toPolyhedralSurface(
        List<com.google.android.gms.maps.model.Polygon> polygonList,
        boolean hasZ, boolean hasM) {

    PolyhedralSurface polyhedralSurface = new PolyhedralSurface(hasZ, hasM);

    for (com.google.android.gms.maps.model.Polygon mapPolygon : polygonList) {
        Polygon polygon = toPolygon(mapPolygon);
        polyhedralSurface.addPolygon(polygon);
    }

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


示例12: toPolyhedralSurfaceWithOptions

import mil.nga.wkb.geom.Polygon; //导入依赖的package包/类
/**
 * Convert a {@link MultiPolygonOptions} to a {@link PolyhedralSurface}
 *
 * @param multiPolygonOptions
 * @param hasZ
 * @param hasM
 * @return
 */
public PolyhedralSurface toPolyhedralSurfaceWithOptions(
        MultiPolygonOptions multiPolygonOptions, boolean hasZ, boolean hasM) {

    PolyhedralSurface polyhedralSurface = new PolyhedralSurface(hasZ, hasM);

    for (PolygonOptions mapPolygon : multiPolygonOptions
            .getPolygonOptions()) {
        Polygon polygon = toPolygon(mapPolygon);
        polyhedralSurface.addPolygon(polygon);
    }

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


示例13: addPolygonToMapAsMarkers

import mil.nga.wkb.geom.Polygon; //导入依赖的package包/类
/**
 * Add a Polygon to the map as markers
 *
 * @param shapeMarkers
 * @param map
 * @param polygonOptions
 * @param polygonMarkerOptions
 * @param polygonMarkerHoleOptions
 * @param globalPolygonOptions
 * @return
 */
public PolygonMarkers addPolygonToMapAsMarkers(
        GoogleMapShapeMarkers shapeMarkers, GoogleMap map,
        PolygonOptions polygonOptions, MarkerOptions polygonMarkerOptions,
        MarkerOptions polygonMarkerHoleOptions,
        PolygonOptions globalPolygonOptions) {

    PolygonMarkers polygonMarkers = new PolygonMarkers(this);

    if (globalPolygonOptions != null) {
        polygonOptions.fillColor(globalPolygonOptions.getFillColor());
        polygonOptions.strokeColor(globalPolygonOptions.getStrokeColor());
        polygonOptions.geodesic(globalPolygonOptions.isGeodesic());
    }

    com.google.android.gms.maps.model.Polygon polygon = addPolygonToMap(
            map, polygonOptions);
    polygonMarkers.setPolygon(polygon);

    List<Marker> markers = addPointsToMapAsMarkers(map,
            polygon.getPoints(), polygonMarkerOptions, true);
    polygonMarkers.setMarkers(markers);

    for (List<LatLng> holes : polygon.getHoles()) {
        List<Marker> holeMarkers = addPointsToMapAsMarkers(map, holes,
                polygonMarkerHoleOptions, true);
        PolygonHoleMarkers polygonHoleMarkers = new PolygonHoleMarkers(
                polygonMarkers);
        polygonHoleMarkers.setMarkers(holeMarkers);
        shapeMarkers.add(polygonHoleMarkers);
        polygonMarkers.addHole(polygonHoleMarkers);
    }

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


示例14: convertPolygon

import mil.nga.wkb.geom.Polygon; //导入依赖的package包/类
/**
 * Test the Polygon conversion
 * 
 * @param converter
 * @param polygon
 */
private static void convertPolygon(GoogleMapShapeConverter converter,
		Polygon polygon) {

	PolygonOptions polygonOptions = converter.toPolygon(polygon);
	TestCase.assertNotNull(polygonOptions);

	comparePolygonAndMapPolygon(converter, polygon, polygonOptions);

	Polygon polygon2 = converter.toPolygon(polygonOptions);
	comparePolygons(polygon, polygon2);
}
 
开发者ID:ngageoint,项目名称:geopackage-android-map,代码行数:18,代码来源:GoogleMapShapeConverterUtils.java


示例15: 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


示例16: comparePolygonsAndMapPolygons

import mil.nga.wkb.geom.Polygon; //导入依赖的package包/类
/**
 * Compare list of polygons with list of map polygons
 *
    * @param converter
 * @param polygons
 * @param mapPolygons
 */
private static void comparePolygonsAndMapPolygons(GoogleMapShapeConverter converter, List<Polygon> polygons,
		List<PolygonOptions> mapPolygons) {

	TestCase.assertEquals(polygons.size(), mapPolygons.size());
	for (int i = 0; i < polygons.size(); i++) {
		comparePolygonAndMapPolygon(converter, polygons.get(i), mapPolygons.get(i));
	}

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


示例17: validateMultiPolygon

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


示例18: comparePolygon

import mil.nga.wkb.geom.Polygon; //导入依赖的package包/类
/**
 * Compare the two polygons for equality
 *
 * @param expected
 * @param actual
 * @param delta
 */
private static void comparePolygon(Polygon expected, Polygon 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);
	}
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:18,代码来源:GeoPackageGeometryDataUtils.java


示例19: insertPolygon

import mil.nga.wkb.geom.Polygon; //导入依赖的package包/类
public static long insertPolygon(FeatureDao featureDao, double[][]... points) {
    FeatureRow featureRow = featureDao.newRow();
    GeoPackageGeometryData geomData = new GeoPackageGeometryData(
            ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM);
    Polygon polygon = new Polygon(false, false);
    for (double[][] ring : points) {
        LineString lineString = getLineString(ring);
        polygon.addRing(lineString);
    }
    geomData.setGeometry(polygon);
    featureRow.setGeometry(geomData);
    return featureDao.insert(featureRow);
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:14,代码来源:FeatureTileUtils.java


示例20: 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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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