Ejemplo n.º 1
0
  public void addMergeNodesForMap(LWMap map, WeightAggregate weightAggregate, List<Style> styles) {

    Iterator<LWComponent> children =
        map.getAllDescendents(LWComponent.ChildKind.PROPER).iterator(); // map.getNodeIterator();
    while (children.hasNext()) {
      LWComponent component = children.next();
      if (component instanceof LWPortal) continue;

      if (component instanceof LWNode || component instanceof LWImage) {
        boolean repeat = false;
        if (nodeAlreadyPresent(component)) {
          repeat = true;
        }
        LWComponent node = component.duplicate();
        edu.tufts.vue.metadata.VueMetadataElement vme =
            new edu.tufts.vue.metadata.VueMetadataElement();
        vme.setType(edu.tufts.vue.metadata.VueMetadataElement.OTHER);
        String sourceLabel = node.getLabel();
        if (sourceLabel == null) sourceLabel = "";
        String sourceMap = component.getMap().getLabel();

        if (sourceMap == null) sourceMap = "";

        vme.setObject("source: " + sourceMap + "," + sourceLabel);
        node.getMetadataList().getMetadata().add(vme);
        if (!repeat) {
          if (!excludeNodesFromBaseMap || !nodePresentOnBaseMap(node)) {
            add(node);
          }
        }
      }
    }
  }
Ejemplo n.º 2
0
  public void addMergeNodesFromSourceMap(
      LWMap map, VoteAggregate voteAggregate, HashMap<String, LWNode> nodes) {
    Iterator<LWComponent> children =
        map.getAllDescendents(LWComponent.ChildKind.PROPER).iterator(); // map.getNodeIterator();
    while (children.hasNext()) {
      // LWNode comp = (LWNode)children.next();
      LWComponent comp = children.next();

      if (comp instanceof LWPortal) continue;

      boolean repeat = false;
      if (nodeAlreadyPresent(comp)) {
        repeat = true;
        /*if(RECORD_SOURCE_NODES)
        {
          LWNode node = nodes.get(Util.getMergeProperty(comp));
          if(node.getNotes() !=null)
          {
            node.setNotes(node.getNotes()+"\n" + map.getLabel());
          }
          else
          {
            node.setNotes(map.getLabel());
          }
        }*/
      }

      if (voteAggregate.isNodeVoteAboveThreshold(Util.getMergeProperty(comp))) {
        // LWNode node = (LWNode)comp.duplicate();
        LWComponent node = comp.duplicate();

        String sourceLabel = node.getLabel();

        if (sourceLabel == null) sourceLabel = "";

        edu.tufts.vue.metadata.VueMetadataElement vme =
            new edu.tufts.vue.metadata.VueMetadataElement();
        vme.setType(edu.tufts.vue.metadata.VueMetadataElement.OTHER);

        // todo: looks like this may be needed in future -- may be an issue
        // of map list in merge maps panel -- or otherwise might require
        // more generic approach (certainly a seperate method either here or in
        // merge maps panel or in VueMetadataElement is in order)
        /*String mapLabel = comp.getMap().getLabel();

        if(mapLabel != null)
        {
            if(mapLabel.contains(".vue"))
            {
                mapLabel = mapLabel.substring(0,mapLabel.indexOf(".vue"));
            }
        }
        else
        {
            mapLabel = "";
        }*/

        vme.setObject("source: " + comp.getMap().getLabel() + "," + sourceLabel);
        node.getMetadataList().getMetadata().add(vme);

        if (!repeat) {
          /*if(RECORD_SOURCE_NODES)
          {
            if(node.getNotes() !=null)
            {
              node.setNotes(node.getNotes()+"\n" + map.getLabel());
            }
            else
            {
              node.setNotes(map.getLabel());
            }
            nodes.put(Util.getMergeProperty(comp),node);
          }*/
          // addNode(node);
          if (!excludeNodesFromBaseMap || !nodePresentOnBaseMap(node)) {
            add(node);
          }
        }
      }
    }
  }