public void add(TaggedLineString line) { TaggedLineSegment[] segs = line.getSegments(); for (int i = 0; i < segs.length; i++) { TaggedLineSegment seg = segs[i]; add(seg); } }
private boolean hasBadOutputIntersection(LineSegment candidateSeg) { List querySegs = outputIndex.query(candidateSeg); for (Iterator i = querySegs.iterator(); i.hasNext(); ) { LineSegment querySeg = (LineSegment) i.next(); if (hasInteriorIntersection(querySeg, candidateSeg)) { return true; } } return false; }
/** * 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); } } }
/** * Simplify a collection of TaggedLineStrings * * @param taggedLines the collection of lines to simplify */ public void simplify(Collection taggedLines) { for (Iterator i = taggedLines.iterator(); i.hasNext(); ) { inputIndex.add((TaggedLineString) i.next()); } for (Iterator i = taggedLines.iterator(); i.hasNext(); ) { TaggedLineStringSimplifier tlss = new TaggedLineStringSimplifier(inputIndex, outputIndex); tlss.setDistanceTolerance(distanceTolerance); tlss.simplify((TaggedLineString) i.next()); } }
private boolean hasBadInputIntersection(TaggedLineString parentLine, int[] sectionIndex, LineSegment candidateSeg) { List querySegs = inputIndex.query(candidateSeg); for (Iterator i = querySegs.iterator(); i.hasNext(); ) { TaggedLineSegment querySeg = (TaggedLineSegment) i.next(); if (hasInteriorIntersection(querySeg, candidateSeg)) { if (isInLineSection(parentLine, sectionIndex, querySeg)) continue; return true; } } return false; }
/** * 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); } } }
private LineSegment flatten(int start, int end) { // make a new segment for the simplified geometry Coordinate p0 = linePts[start]; Coordinate p1 = linePts[end]; LineSegment newSeg = new LineSegment(p0, p1); // update the indexes remove(line, start, end); outputIndex.add(newSeg); return newSeg; }
private boolean hasBadOutputIntersection(LineSegment candidateSeg) { List querySegs = outputIndex.query(candidateSeg); for (Iterator i = querySegs.iterator(); i.hasNext(); ) { LineSegment querySeg = (LineSegment) i.next(); if (hasInteriorIntersection(querySeg, candidateSeg)) { return true; } } return false; }
public void add(TaggedLineString line) { TaggedLineSegment[] segs = line.getSegments(); for (int i = 0; i < segs.length; i++) { TaggedLineSegment seg = segs[i]; add(seg); } }
private boolean hasBadInputIntersection(TaggedLineString parentLine, int[] sectionIndex, LineSegment candidateSeg) { List querySegs = inputIndex.query(candidateSeg); for (Iterator i = querySegs.iterator(); i.hasNext(); ) { TaggedLineSegment querySeg = (TaggedLineSegment) i.next(); if (hasInteriorIntersection(querySeg, candidateSeg)) { if (isInLineSection(parentLine, sectionIndex, querySeg)) continue; return true; } } return false; }
/** * Simplify a collection of TaggedLineStrings * * @param taggedLines the collection of lines to simplify */ public void simplify(Collection taggedLines) { for (Iterator i = taggedLines.iterator(); i.hasNext(); ) { inputIndex.add((TaggedLineString) i.next()); } for (Iterator i = taggedLines.iterator(); i.hasNext(); ) { TaggedLineStringSimplifier tlss = new TaggedLineStringSimplifier(inputIndex, outputIndex); tlss.setDistanceTolerance(distanceTolerance); tlss.simplify((TaggedLineString) i.next()); } }
/** * Flattens a section of the line between * indexes <code>start</code> and <code>end</code>, * replacing them with a line between the endpoints. * The input and output indexes are updated * to reflect this. * * @param start the start index of the flattened section * @param end the end index of the flattened section * @return the new segment created */ private LineSegment flatten(int start, int end) { // make a new segment for the simplified geometry Coordinate p0 = linePts[start]; Coordinate p1 = linePts[end]; LineSegment newSeg = new LineSegment(p0, p1); // update the indexes remove(line, start, end); outputIndex.add(newSeg); return newSeg; }