@Test public void lineSlice_throwLineMustContainTwoOrMorePoints() throws Exception { thrown.expect(TurfException.class); thrown.expectMessage(startsWith("Start and stop points in Turf lineSlice cannot equal each " + "other.")); List<Point> coords = new ArrayList<>(); coords.add(Point.fromLngLat(1.0, 1.0)); coords.add(Point.fromLngLat(2.0, 2.0)); Point point = Point.fromLngLat(1.0, 1.0); LineString lineString = LineString.fromLngLats(coords); TurfMisc.lineSlice(point, point, lineString); }
@NonNull public static LineString lineSlice(@NonNull Point startPt, @NonNull Point stopPt, @NonNull Feature line) { if (line.geometry() == null) { throw new NullPointerException("Feature.geometry() == null"); } if (!line.geometry().type().equals("LineString")) { throw new TurfException("input must be a LineString Feature or Geometry"); } return lineSlice(startPt, stopPt, (LineString) line.geometry()); }
TurfMisc { @NonNull public static LineString lineSlice(@NonNull Point startPt, @NonNull Point stopPt, @NonNull Feature line) { if (line.geometry() == null) { throw new NullPointerException("Feature.geometry() == null"); } if (!line.geometry().type().equals("LineString")) { throw new TurfException("input must be a LineString Feature or Geometry"); } return lineSlice(startPt, stopPt, (LineString) line.geometry()); } }
TurfMisc { @NonNull public static LineString lineSlice(@NonNull Point startPt, @NonNull Point stopPt, @NonNull Feature line) { if (line.geometry() == null) { throw new NullPointerException("Feature.geometry() == null"); } if (!line.geometry().type().equals("LineString")) { throw new TurfException("input must be a LineString Feature or Geometry"); } return lineSlice(startPt, stopPt, (LineString) line.geometry()); } private  TurfMisc(); }
TurfMisc { @NonNull public static LineString lineSlice(@NonNull Point startPt, @NonNull Point stopPt, @NonNull Feature line) { if (line.geometry() == null) { throw new NullPointerException("Feature.geometry() == null"); } if (!line.geometry().type().equals("LineString")) { throw new TurfException("input must be a LineString Feature or Geometry"); } return lineSlice(startPt, stopPt, (LineString) line.geometry()); } private  TurfMisc(); @NonNull static LineString lineSlice(@NonNull Point startPt, @NonNull Point stopPt,
                                     @NonNull Feature line); @NonNull static LineString lineSlice(@NonNull Point startPt, @NonNull Point stopPt,
                                     @NonNull LineString line); @NonNull static LineString lineSliceAlong(@NonNull Feature line,
                                          @FloatRange(from = 0) double startDist,
                                          @FloatRange(from = 0) double stopDist,
                                          @NonNull @TurfConstants.TurfUnitCriteria String units); @NonNull static LineString lineSliceAlong(@NonNull LineString line,
                                          @FloatRange(from = 0) double startDist,
                                          @FloatRange(from = 0) double stopDist,
                                          @NonNull @TurfConstants.TurfUnitCriteria String units); @NonNull static Feature nearestPointOnLine(@NonNull Point pt, @NonNull List<Point> coords); @NonNull static Feature nearestPointOnLine(@NonNull Point pt, @NonNull List<Point> coords,
                                           @Nullable @TurfConstants.TurfUnitCriteria String units); }
TurfMisc { @NonNull public static LineString lineSlice(@NonNull Point startPt, @NonNull Point stopPt, @NonNull Feature line) { if (line.geometry() == null) { throw new NullPointerException("Feature.geometry() == null"); } if (!line.geometry().type().equals("LineString")) { throw new TurfException("input must be a LineString Feature or Geometry"); } return lineSlice(startPt, stopPt, (LineString) line.geometry()); } private  TurfMisc(); @NonNull static LineString lineSlice(@NonNull Point startPt, @NonNull Point stopPt,
                                     @NonNull Feature line); @NonNull static LineString lineSlice(@NonNull Point startPt, @NonNull Point stopPt,
                                     @NonNull LineString line); @NonNull static LineString lineSliceAlong(@NonNull Feature line,
                                          @FloatRange(from = 0) double startDist,
                                          @FloatRange(from = 0) double stopDist,
                                          @NonNull @TurfConstants.TurfUnitCriteria String units); @NonNull static LineString lineSliceAlong(@NonNull LineString line,
                                          @FloatRange(from = 0) double startDist,
                                          @FloatRange(from = 0) double stopDist,
                                          @NonNull @TurfConstants.TurfUnitCriteria String units); @NonNull static Feature nearestPointOnLine(@NonNull Point pt, @NonNull List<Point> coords); @NonNull static Feature nearestPointOnLine(@NonNull Point pt, @NonNull List<Point> coords,
                                           @Nullable @TurfConstants.TurfUnitCriteria String units);  }