Exemple #1
0
 @Override
 public void visit(Node n) {
   if (e.child == null && left.matches(new Environment(n))) {
     if (e.osm instanceof Way && Geometry.nodeInsidePolygon(n, ((Way) e.osm).getNodes())
         || e.osm instanceof Relation
             && ((Relation) e.osm).isMultipolygon()
             && Geometry.isNodeInsideMultiPolygon(n, (Relation) e.osm, null)) {
       e.child = n;
     }
   }
 }
Exemple #2
0
  /**
   * Tests if way is inside other way
   *
   * @param outside outer polygon description
   * @param inside inner polygon description
   * @return {@code true} if inner is inside outer
   */
  public static boolean wayInsideWay(AssembledPolygon inside, AssembledPolygon outside) {
    Set<Node> outsideNodes = new HashSet<Node>(outside.getNodes());
    List<Node> insideNodes = inside.getNodes();

    for (Node insideNode : insideNodes) {

      if (!outsideNodes.contains(insideNode))
        // simply test the one node
        return Geometry.nodeInsidePolygon(insideNode, outside.getNodes());
    }

    // all nodes shared.
    return false;
  }