Exemplo n.º 1
0
  /**
   * @param dotGraph IDotGraph
   * @param contents Draw2dGraph
   * @return Draw2dGraph
   */
  private Draw2dGraph createGraph(final IDotGraph dotGraph, final Draw2dGraph contents) {
    for (final IVertex node : dotGraph.allVertices()) {
      buildNodeFigure(contents, node);
    }

    for (final Iterator<IEdge> iter = dotGraph.edgeIterator(); iter.hasNext(); ) {
      final IEdge edge = iter.next();
      buildEdgeFigure(contents, edge);
    }

    return contents;
  }
Exemplo n.º 2
0
  /**
   * Creates a <em>basic node</em>.
   *
   * @param node Node
   * @return IVertex
   */
  private IVertex addNode(final Node node) {
    final String name = node.getName();
    final IVertex vertex = dotGraph.newVertex(name, node);

    if (node.equals(startNode)) {
      setVertexPreferences(vertex, "start");
    } else if (node.hasAttributes(Node.ATTR_MAIN_NODE)) {
      setVertexPreferences(vertex, "main");
    } else if (node.hasAttributes(Node.ATTR_MISSING_NODE)) {
      setVertexPreferences(vertex, "missing");
    } else {
      setVertexPreferences(vertex, "default");
    }

    if (node.getDescription() != null) {
      vertex.setAttr(DESCRIPTION_ATTR, node.getDescription());
    }

    if (useBusRouting) {
      final GrandUiPrefStore preferenceStore = Application.getInstance().getPreferenceStore();
      vertex.setAttr("inthreshold", preferenceStore.getInt(PreferenceKeys.GRAPH_BUS_IN_THRESHOLD));
      vertex.setAttr(
          "outthreshold", preferenceStore.getInt(PreferenceKeys.GRAPH_BUS_OUT_THRESHOLD));
    }

    vertexLUT.put(name, vertex);
    nameDimensions.put(name, vertex);
    return vertex;
  }
Exemplo n.º 3
0
 /**
  * Creates a basic link.
  *
  * @param link Link
  * @return IEdge
  */
 private IEdge addLink(final Link link) {
   final IEdge edge =
       dotGraph.newEdge(
           vertexLUT.get(link.getStartNode().getName()),
           vertexLUT.get(link.getEndNode().getName()),
           currentLinkName,
           link);
   final GrandUiPrefStore preferenceStore = Application.getInstance().getPreferenceStore();
   if (link.hasAttributes(Link.ATTR_WEAK_LINK)) {
     edge.setAttr(DRAW2DFGCOLOR_ATTR, preferenceStore.getColor(PreferenceKeys.LINK_WEAK_COLOR));
     edge.setAttr(
         DRAW2DLINEWIDTH_ATTR, preferenceStore.getInt(PreferenceKeys.LINK_WEAK_LINEWIDTH));
   } else {
     edge.setAttr(DRAW2DFGCOLOR_ATTR, preferenceStore.getColor(PreferenceKeys.LINK_DEFAULT_COLOR));
     edge.setAttr(
         DRAW2DLINEWIDTH_ATTR, preferenceStore.getInt(PreferenceKeys.LINK_DEFAULT_LINEWIDTH));
   }
   return edge;
 }