@Override public Shape build() { GeoPath path = GeoPathFactory.makeGeoPath(planetModel, distance, points.toArray(new GeoPoint[points.size()])); return new Geo3dShape<>(path, context); } }
/** * Create a GeoPath of the right kind given the specified information. * @param planetModel is the planet model. * @param maxCutoffAngle is the width of the path, measured as an angle. * @param pathPoints are the points in the path. * @return a GeoPath corresponding to what was specified. */ public static GeoPath makeGeoPath(final PlanetModel planetModel, final double maxCutoffAngle, final GeoPoint[] pathPoints) { if (maxCutoffAngle < Vector.MINIMUM_ANGULAR_RESOLUTION) { return new GeoDegeneratePath(planetModel, filterPoints(pathPoints)); } return new GeoStandardPath(planetModel, maxCutoffAngle, filterPoints(pathPoints)); }
/** * Convert input parameters to a path. * @param pathLatitudes latitude values for points of the path: must be within standard +/-90 coordinate bounds. * @param pathLongitudes longitude values for points of the path: must be within standard +/-180 coordinate bounds. * @param pathWidthMeters width of the path in meters. * @return the path. */ static GeoPath fromPath(final double[] pathLatitudes, final double[] pathLongitudes, final double pathWidthMeters) { if (pathLatitudes.length != pathLongitudes.length) { throw new IllegalArgumentException("same number of latitudes and longitudes required"); } final GeoPoint[] points = new GeoPoint[pathLatitudes.length]; for (int i = 0; i < pathLatitudes.length; i++) { final double latitude = pathLatitudes[i]; final double longitude = pathLongitudes[i]; GeoUtils.checkLatitude(latitude); GeoUtils.checkLongitude(longitude); points[i] = new GeoPoint(PlanetModel.WGS84, fromDegrees(latitude), fromDegrees(longitude)); } return GeoPathFactory.makeGeoPath(PlanetModel.WGS84, fromMeters(pathWidthMeters), points); }