SubgraphDepthLocater locater = new SubgraphDepthLocater(processedGraphs); int outsideDepth = locater.getDepth(p);
public int getDepth(Coordinate p) { List stabbedSegments = findStabbedSegments(p); // if no segments on stabbing line subgraph must be outside all others. if (stabbedSegments.size() == 0) return 0; Collections.sort(stabbedSegments); DepthSegment ds = (DepthSegment) stabbedSegments.get(0); return ds.leftDepth; }
SubgraphDepthLocater locater = new SubgraphDepthLocater(processedGraphs); int outsideDepth = locater.getDepth(p);
/** * Finds all non-horizontal segments intersecting the stabbing line * in the list of dirEdges. * The stabbing line is the ray to the right of stabbingRayLeftPt. * * @param stabbingRayLeftPt the left-hand origin of the stabbing line * @param stabbedSegments the current list of {@link DepthSegments} intersecting the stabbing line */ private void findStabbedSegments(Coordinate stabbingRayLeftPt, List dirEdges, List stabbedSegments) { /** * Check all forward DirectedEdges only. This is still general, * because each Edge has a forward DirectedEdge. */ for (Iterator i = dirEdges.iterator(); i.hasNext();) { DirectedEdge de = (DirectedEdge) i.next(); if (! de.isForward()) continue; findStabbedSegments(stabbingRayLeftPt, de, stabbedSegments); } }
/** * Finds all non-horizontal segments intersecting the stabbing line. * The stabbing line is the ray to the right of stabbingRayLeftPt. * * @param stabbingRayLeftPt the left-hand origin of the stabbing line * @return a List of {@link DepthSegments} intersecting the stabbing line */ private List findStabbedSegments(Coordinate stabbingRayLeftPt) { List stabbedSegments = new ArrayList(); for (Iterator i = subgraphs.iterator(); i.hasNext(); ) { BufferSubgraph bsg = (BufferSubgraph) i.next(); // optimization - don't bother checking subgraphs which the ray does not intersect Envelope env = bsg.getEnvelope(); if (stabbingRayLeftPt.y < env.getMinY() || stabbingRayLeftPt.y > env.getMaxY()) continue; findStabbedSegments(stabbingRayLeftPt, bsg.getDirectedEdges(), stabbedSegments); } return stabbedSegments; }
public int getDepth(Coordinate p) { List stabbedSegments = findStabbedSegments(p); // if no segments on stabbing line subgraph must be outside all others. if (stabbedSegments.size() == 0) return 0; DepthSegment ds = (DepthSegment) Collections.min(stabbedSegments); return ds.leftDepth; }
/** * Finds all non-horizontal segments intersecting the stabbing line * in the list of dirEdges. * The stabbing line is the ray to the right of stabbingRayLeftPt. * * @param stabbingRayLeftPt the left-hand origin of the stabbing line * @param stabbedSegments the current list of {@link DepthSegments} intersecting the stabbing line */ private void findStabbedSegments(Coordinate stabbingRayLeftPt, List dirEdges, List stabbedSegments) { /** * Check all forward DirectedEdges only. This is still general, * because each Edge has a forward DirectedEdge. */ for (Iterator i = dirEdges.iterator(); i.hasNext();) { DirectedEdge de = (DirectedEdge) i.next(); if (! de.isForward()) continue; findStabbedSegments(stabbingRayLeftPt, de, stabbedSegments); } }
/** * Finds all non-horizontal segments intersecting the stabbing line. * The stabbing line is the ray to the right of stabbingRayLeftPt. * * @param stabbingRayLeftPt the left-hand origin of the stabbing line * @return a List of {@link DepthSegments} intersecting the stabbing line */ private List findStabbedSegments(Coordinate stabbingRayLeftPt) { List stabbedSegments = new ArrayList(); for (Iterator i = subgraphs.iterator(); i.hasNext(); ) { BufferSubgraph bsg = (BufferSubgraph) i.next(); // optimization - don't bother checking subgraphs which the ray does not intersect Envelope env = bsg.getEnvelope(); if (stabbingRayLeftPt.y < env.getMinY() || stabbingRayLeftPt.y > env.getMaxY()) continue; findStabbedSegments(stabbingRayLeftPt, bsg.getDirectedEdges(), stabbedSegments); } return stabbedSegments; }