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


Java Polygon类代码示例

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


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


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