/** Create a GeoPolygon using the specified points and holes, using order to determine * siding of the polygon. Much like ESRI, this method uses clockwise to indicate the space * on the same side of the shape as being inside, and counter-clockwise to indicate the * space on the opposite side as being inside. * @param pointList is a list of the GeoPoints to build an arbitrary polygon out of. If points go * clockwise from a given pole, then that pole should be within the polygon. If points go * counter-clockwise, then that pole should be outside the polygon. * @return a GeoPolygon corresponding to what was specified. */ public static GeoPolygon makeGeoPolygon(final PlanetModel planetModel, final List<GeoPoint> pointList) { return makeGeoPolygon(planetModel, pointList, null); }
/** Create a GeoPolygon using the specified points and holes, using order to determine * siding of the polygon. Much like ESRI, this method uses clockwise to indicate the space * on the same side of the shape as being inside, and counter-clockwise to indicate the * space on the opposite side as being inside. * @param description describes the polygon and its associated holes. If points go * clockwise from a given pole, then that pole should be within the polygon. If points go * counter-clockwise, then that pole should be outside the polygon. * @return a GeoPolygon corresponding to what was specified, or null if a valid polygon cannot be generated * from this input. */ public static GeoPolygon makeGeoPolygon(final PlanetModel planetModel, final PolygonDescription description) { return makeGeoPolygon(planetModel, description, 0.0); }
/** Create a GeoPolygon using the specified points and holes, using order to determine * siding of the polygon. Much like ESRI, this method uses clockwise to indicate the space * on the same side of the shape as being inside, and counter-clockwise to indicate the * space on the opposite side as being inside. * @param pointList is a list of the GeoPoints to build an arbitrary polygon out of. If points go * clockwise from a given pole, then that pole should be within the polygon. If points go * counter-clockwise, then that pole should be outside the polygon. * @param holes is a list of polygons representing "holes" in the outside polygon. Holes describe the area outside * each hole as being "in set". Null == none. * @return a GeoPolygon corresponding to what was specified, or null if a valid polygon cannot be generated * from this input. */ public static GeoPolygon makeGeoPolygon(final PlanetModel planetModel, final List<GeoPoint> pointList, final List<GeoPolygon> holes) { return makeGeoPolygon(planetModel, pointList, holes, 0.0); }
@SuppressWarnings("unchecked") @Override public Shape build() { GeoPolygonFactory.PolygonDescription description = new GeoPolygonFactory.PolygonDescription(points, polyHoles); GeoPolygon polygon = GeoPolygonFactory.makeGeoPolygon(planetModel, description); if (polygon == null) { throw new InvalidShapeException("Invalid polygon, all points are coplanar"); } return new Geo3dShape<>(polygon, context); }
final GeoPolygon rval = GeoPolygonFactory.makeGeoPolygon(PlanetModel.WGS84, points, holeList);
holes = new ArrayList<>(description.holes.size()); for (final PolygonDescription holeDescription : description.holes) { final GeoPolygon gp = makeGeoPolygon(planetModel, holeDescription, leniencyValue); if (gp == null) { return null;