public void produceRelation(HashSet<Channel> subset, int n) {
    if (isProduced(subset)) {
      return;
    }
    LinkedList<OsmPrimitive> ways = new LinkedList<OsmPrimitive>();
    Iterator<Channel> cit = subset.iterator();
    while (cit.hasNext()) {
      Channel c = cit.next();
      // System.out.println(c.getWay().getId());
      if (!(ways.contains(
          plugin.getOsmlayer().data.getPrimitiveById(c.getWay().getId(), OsmPrimitiveType.WAY)))) {
        ways.add(
            plugin.getOsmlayer().data.getPrimitiveById(c.getWay().getId(), OsmPrimitiveType.WAY));
      }
    }
    Main.map.mapView.setActiveLayer(plugin.getOsmlayer());
    plugin.getOsmlayer().data.setSelected(ways);

    Relation jrelation = new Relation();
    jrelation.put("type", "junction");
    jrelation.put("n", Integer.toString(n));
    for (int i = 0; i < ways.size(); i++) {
      jrelation.addMember(new RelationMember("part of", ways.get(i)));
    }

    plugin.getOsmlayer().data.addPrimitive(jrelation);
  }
 /**
  * Hilfemethode zur Erstellung eines Channels
  *
  * @param fromNode fromNode des zu erstellenden Channels
  * @param toNode toNode des zu erstellnenden Channels
  * @param way ein zu dem Channel gehörender Way
  * @return
  */
 private Channel createChannel(OSMNode fromNode, OSMNode toNode, OSMWay way) {
   newChannel = new Channel();
   newChannel.setFromNode(fromNode);
   newChannel.setToNode(toNode);
   setNewWayID(newChannel);
   digraph.addChannel(newChannel);
   fromNode.addOutgoingChannel(newChannel);
   newChannel.addWay(way);
   return newChannel;
 }
 private void createBackChannel(OSMNode fromNode, OSMNode toNode, OSMWay way, Channel channel) {
   backChannel = new Channel();
   backChannel = createChannel(fromNode, toNode, way);
   backChannel.setBackChannelID(channel.getNewid());
   channel.setBackChannelID(backChannel.getNewid());
 }
 private void setNewWayID(Channel channel) {
   channel.setNewid(newid);
   newid++;
 }