/** * Create a new instance of this class by passing in an outer {@link LineString} and optionally * one or more inner LineStrings. Each of these LineStrings should follow the linear ring rules. * <p> * Note that if a LineString breaks one of the linear ring rules, a {@link RuntimeException} will * be thrown. * * @param outer a LineString which defines the outer perimeter of the polygon * @param inner one or more LineStrings representing holes inside the outer perimeter * @return a new instance of this class defined by the values passed inside this static factory * method * @since 3.0.0 */ public static Polygon fromOuterInner(@NonNull LineString outer, @Nullable LineString... inner) { isLinearRing(outer); List<List<Point>> coordinates = new ArrayList<>(); coordinates.add(outer.coordinates()); // If inner rings are set to null, return early. if (inner == null) { return new AutoValue_Polygon(TYPE, null, coordinates); } for (LineString lineString : inner) { isLinearRing(lineString); coordinates.add(lineString.coordinates()); } return new AutoValue_Polygon(TYPE, null, coordinates); }
/** * Create a new instance of this class by passing in an outer {@link LineString} and optionally * one or more inner LineStrings. Each of these LineStrings should follow the linear ring rules. * <p> * Note that if a LineString breaks one of the linear ring rules, a {@link RuntimeException} will * be thrown. * * @param outer a LineString which defines the outer perimeter of the polygon * @param bbox optionally include a bbox definition as a double array * @param inner one or more LineStrings representing holes inside the outer perimeter * @return a new instance of this class defined by the values passed inside this static factory * method * @since 3.0.0 */ public static Polygon fromOuterInner(@NonNull LineString outer, @Nullable BoundingBox bbox, @Nullable LineString... inner) { isLinearRing(outer); List<List<Point>> coordinates = new ArrayList<>(); coordinates.add(outer.coordinates()); // If inner rings are set to null, return early. if (inner == null) { return new AutoValue_Polygon(TYPE, bbox, coordinates); } for (LineString lineString : inner) { isLinearRing(lineString); coordinates.add(lineString.coordinates()); } return new AutoValue_Polygon(TYPE, bbox, coordinates); }
/** * Create a new instance of this class by passing in an outer {@link LineString} and optionally * one or more inner LineStrings. Each of these LineStrings should follow the linear ring rules. * <p> * Note that if a LineString breaks one of the linear ring rules, a {@link RuntimeException} will * be thrown. * * @param outer a LineString which defines the outer perimeter of the polygon * @param inner one or more LineStrings representing holes inside the outer perimeter * @return a new instance of this class defined by the values passed inside this static factory * method * @since 3.0.0 */ public static Polygon fromOuterInner(@NonNull LineString outer, @Nullable LineString... inner) { isLinearRing(outer); List<List<Point>> coordinates = new ArrayList<>(); coordinates.add(outer.coordinates()); // If inner rings are set to null, return early. if (inner == null) { return new AutoValue_Polygon(TYPE, null, coordinates); } for (LineString lineString : inner) { isLinearRing(lineString); coordinates.add(lineString.coordinates()); } return new AutoValue_Polygon(TYPE, null, coordinates); }
/** * Create a new instance of this class by passing in an outer {@link LineString} and optionally * one or more inner LineStrings. Each of these LineStrings should follow the linear ring rules. * <p> * Note that if a LineString breaks one of the linear ring rules, a {@link RuntimeException} will * be thrown. * * @param outer a LineString which defines the outer perimeter of the polygon * @param bbox optionally include a bbox definition as a double array * @param inner one or more LineStrings representing holes inside the outer perimeter * @return a new instance of this class defined by the values passed inside this static factory * method * @since 3.0.0 */ public static Polygon fromOuterInner(@NonNull LineString outer, @Nullable BoundingBox bbox, @Nullable LineString... inner) { isLinearRing(outer); List<List<Point>> coordinates = new ArrayList<>(); coordinates.add(outer.coordinates()); // If inner rings are set to null, return early. if (inner == null) { return new AutoValue_Polygon(TYPE, bbox, coordinates); } for (LineString lineString : inner) { isLinearRing(lineString); coordinates.add(lineString.coordinates()); } return new AutoValue_Polygon(TYPE, bbox, coordinates); }
/** * Create a new instance of this class by passing in an outer {@link LineString} and optionally * one or more inner LineStrings contained within a list. Each of these LineStrings should follow * the linear ring rules. * <p> * Note that if a LineString breaks one of the linear ring rules, a {@link RuntimeException} will * be thrown. * * @param outer a LineString which defines the outer perimeter of the polygon * @param inner one or more LineStrings inside a list representing holes inside the outer * perimeter * @return a new instance of this class defined by the values passed inside this static factory * method * @since 3.0.0 */ public static Polygon fromOuterInner(@NonNull LineString outer, @Nullable @Size(min = 1) List<LineString> inner) { isLinearRing(outer); List<List<Point>> coordinates = new ArrayList<>(); coordinates.add(outer.coordinates()); // If inner rings are set to null, return early. if (inner == null || inner.isEmpty()) { return new AutoValue_Polygon(TYPE, null, coordinates); } for (LineString lineString : inner) { isLinearRing(lineString); coordinates.add(lineString.coordinates()); } return new AutoValue_Polygon(TYPE, null, coordinates); }
/** * Create a new instance of this class by passing in an outer {@link LineString} and optionally * one or more inner LineStrings contained within a list. Each of these LineStrings should follow * the linear ring rules. * <p> * Note that if a LineString breaks one of the linear ring rules, a {@link RuntimeException} will * be thrown. * * @param outer a LineString which defines the outer perimeter of the polygon * @param inner one or more LineStrings inside a list representing holes inside the outer * perimeter * @return a new instance of this class defined by the values passed inside this static factory * method * @since 3.0.0 */ public static Polygon fromOuterInner(@NonNull LineString outer, @Nullable @Size(min = 1) List<LineString> inner) { isLinearRing(outer); List<List<Point>> coordinates = new ArrayList<>(); coordinates.add(outer.coordinates()); // If inner rings are set to null, return early. if (inner == null || inner.isEmpty()) { return new AutoValue_Polygon(TYPE, null, coordinates); } for (LineString lineString : inner) { isLinearRing(lineString); coordinates.add(lineString.coordinates()); } return new AutoValue_Polygon(TYPE, null, coordinates); }
isLinearRing(outer); List<List<Point>> coordinates = new ArrayList<>(); coordinates.add(outer.coordinates()); isLinearRing(lineString); coordinates.add(lineString.coordinates());
isLinearRing(outer); List<List<Point>> coordinates = new ArrayList<>(); coordinates.add(outer.coordinates()); isLinearRing(lineString); coordinates.add(lineString.coordinates());