/** * Filters linear geometries. * * geom a geometry of any type */ public void filter(Geometry geom) { if (geom instanceof LineString) { LineString line = (LineString) geom; int minSize = ((LineString) line).isClosed() ? 4 : 2; TaggedLineString taggedLine = new TaggedLineString((LineString) line, minSize); linestringMap.put(line, taggedLine); } } }
int[] sectionIndex = new int[2]; if((i+1) == j) { LineSegment newSeg = line.getSegment(i); line.addToResult(newSeg); if (line.getResultSize() < line.getMinimumSize()) { int worstCaseSize = depth + 1; if (worstCaseSize < line.getMinimumSize()) isValidToSimplify = false; line.addToResult(newSeg); return;
public Coordinate[] getResultCoordinates() { return extractCoordinates(resultSegs); }
/** * Simplifies the given {@link TaggedLineString} * using the distance tolerance specified. * * @param line the linestring to simplify */ void simplify(TaggedLineString line) { this.line = line; linePts = line.getParentCoordinates(); simplifySection(0, linePts.length - 1, 0); }
protected CoordinateSequence transformCoordinates(CoordinateSequence coords, Geometry parent) { // for linear components (including rings), simplify the linestring if (parent instanceof LineString) { TaggedLineString taggedLine = (TaggedLineString) linestringMap.get(parent); return createCoordinateSequence(taggedLine.getResultCoordinates()); } // for anything else (e.g. points) just copy the coordinates return super.transformCoordinates(coords, parent); } }
public void add(TaggedLineString line) { TaggedLineSegment[] segs = line.getSegments(); for (int i = 0; i < segs.length; i++) { TaggedLineSegment seg = segs[i]; add(seg); } }
/** * Remove the segs in the section of the line * @param line * @param pts * @param sectionStartIndex * @param sectionEndIndex */ private void remove(TaggedLineString line, int start, int end) { for (int i = start; i < end; i++) { TaggedLineSegment seg = line.getSegment(i); inputIndex.remove(seg); } } }
/** * Tests whether a segment is in a section of a TaggedLineString * @param line * @param sectionIndex * @param seg * @return */ private static boolean isInLineSection( TaggedLineString line, int[] sectionIndex, TaggedLineSegment seg) { // not in this line if (seg.getParent() != line.getParent()) return false; int segIndex = seg.getIndex(); if (segIndex >= sectionIndex[0] && segIndex < sectionIndex[1]) return true; return false; }
/** * Simplifies the given {@link TaggedLineString} * using the distance tolerance specified. * * @param line the linestring to simplify */ void simplify(TaggedLineString line) { this.line = line; linePts = line.getParentCoordinates(); simplifySection(0, linePts.length - 1, 0); }
protected CoordinateSequence transformCoordinates(CoordinateSequence coords, Geometry parent) { if (coords.size() == 0) return null; // for linear components (including rings), simplify the linestring if (parent instanceof LineString) { TaggedLineString taggedLine = (TaggedLineString) linestringMap.get(parent); return createCoordinateSequence(taggedLine.getResultCoordinates()); } // for anything else (e.g. points) just copy the coordinates return super.transformCoordinates(coords, parent); } }
public void add(TaggedLineString line) { TaggedLineSegment[] segs = line.getSegments(); for (int i = 0; i < segs.length; i++) { TaggedLineSegment seg = segs[i]; add(seg); } }
/** * Remove the segs in the section of the line * @param line * @param pts * @param sectionStartIndex * @param sectionEndIndex */ private void remove(TaggedLineString line, int start, int end) { for (int i = start; i < end; i++) { TaggedLineSegment seg = line.getSegment(i); inputIndex.remove(seg); } } }
/** * Tests whether a segment is in a section of a TaggedLineString * @param line * @param sectionIndex * @param seg * @return */ private static boolean isInLineSection( TaggedLineString line, int[] sectionIndex, TaggedLineSegment seg) { // not in this line if (seg.getParent() != line.getParent()) return false; int segIndex = seg.getIndex(); if (segIndex >= sectionIndex[0] && segIndex < sectionIndex[1]) return true; return false; }
int[] sectionIndex = new int[2]; if((i+1) == j) { LineSegment newSeg = line.getSegment(i); line.addToResult(newSeg); if (line.getResultSize() < line.getMinimumSize()) { int worstCaseSize = depth + 1; if (worstCaseSize < line.getMinimumSize()) isValidToSimplify = false; line.addToResult(newSeg); return;
public LinearRing asLinearRing() { return parentLine.getFactory().createLinearRing(extractCoordinates(resultSegs)); }
/** * Filters linear geometries. * * geom a geometry of any type */ public void filter(Geometry geom) { if (geom instanceof LineString) { LineString line = (LineString) geom; // skip empty geometries if (line.isEmpty()) return; int minSize = ((LineString) line).isClosed() ? 4 : 2; TaggedLineString taggedLine = new TaggedLineString((LineString) line, minSize); linestringMap.put(line, taggedLine); } } }
public LineString asLineString() { return parentLine.getFactory().createLineString(extractCoordinates(resultSegs)); }
public Coordinate[] getResultCoordinates() { return extractCoordinates(resultSegs); }
public LineString asLineString() { return parentLine.getFactory().createLineString(extractCoordinates(resultSegs)); }
public LinearRing asLinearRing() { return parentLine.getFactory().createLinearRing(extractCoordinates(resultSegs)); }