Example #1
0
 /**
  * render the nodes in net
  *
  * @param gl
  * @param nr
  * @param text
  */
 public void renderNodes3D(GL gl, GraphRenderer nr, int text) {
   applyPickColors();
   for (Node n : net.nNodes) {
     nr.renderNode(gl, n);
     nr.renderNodeLabels(gl, n, text, false);
   }
 }
Example #2
0
  public void render(Graphics2D g) {
    renderer.render(g, getX(), getY(), getWidth(), getHeight());

    String screenshot = (String) graph.getLabel("ui.screenshot");

    if (screenshot != null) {
      graph.removeAttribute("ui.screenshot");
      renderer.screenshot(screenshot, getWidth(), getHeight());
    }
  }
Example #3
0
 void update() {
   ThingWithProperties show = graph.getSelection();
   if (show != null) {
     Vector props = show.getProperties();
     // new
     lab[0].setText(((Property) props.elementAt(0)).toString());
     lab[1].setText(((Property) props.elementAt(1)).toString());
     if (dl1 != null) textfields[0].getDocument().removeDocumentListener(dl1);
     if (dl2 != null) textfields[1].getDocument().removeDocumentListener(dl2);
     dl1 = new PropertyListener((Property) props.elementAt(0));
     dl2 = new PropertyListener((Property) props.elementAt(1));
     textfields[0].getDocument().addDocumentListener(dl1);
     textfields[1].getDocument().addDocumentListener(dl2);
     textfields[0].setText(((Property) props.elementAt(0)).get());
     textfields[0].setEditable(((Property) props.elementAt(0)).getEditable());
     textfields[1].setText(((Property) props.elementAt(1)).get());
     textfields[1].setEditable(((Property) props.elementAt(1)).getEditable());
     /*	    setLayout(new GridLayout(2, props.size()));
        JTextField tf;
        Property p;
        JLabel n;
        for (int i = 0; i < props.size(); i++) {
     p = (Property) props.elementAt(i);
     System.out.println("Proprty " + p);
     n = new JLabel(p.toString());
     tf = new JTextField(3);
     add(n);
     add(tf);
     tf.setText(p.get());
     tf.setEditable(p.getEditable());
     tf.getDocument().addDocumentListener(new PropertyListener(p));
     }*/
   }
   repaint();
 }
Example #4
0
 /**
  * render the group labels
  *
  * @param gl
  * @param nr
  * @param net
  * @param fonttype
  */
 public void renderGroupLabels(GL gl, GraphRenderer nr, Net net, int fonttype) {
   Node center;
   for (String m : net.groups.keySet()) {
     Net group1 = net.groups.get(m);
     center = group1.hasNode(m);
     nr.renderGroupLabels(gl, center, fonttype);
   }
 }
Example #5
0
 public void paintComponent(Graphics g) {
   if (position == null) return;
   int x = (int) position.getX();
   int y = (int) position.getY();
   if (parent.inFirstPath(this)) {
     g.setColor(Color.yellow);
     g.fillOval(x - RADIUS, y - RADIUS, 2 * RADIUS, 2 * RADIUS);
   } else if (parent.inQueue(this)) {
     g.setColor(Color.orange);
     g.fillOval(x - RADIUS, y - RADIUS, 2 * RADIUS, 2 * RADIUS);
   }
   g.setColor(getColor());
   g.drawOval(x - RADIUS, y - RADIUS, 2 * RADIUS, 2 * RADIUS);
   if (parent.isGoalNode(this)) g.setColor(Color.green);
   else if (parent.isStartNode(this)) g.setColor(Color.blue);
   g.drawString(toString(), x, y);
   if (!parent.getHideHeur()) g.drawString(model.getHeuristic() + "", x + RADIUS, y + RADIUS);
 }
Example #6
0
 public void moveElementAtPx(GraphicElement element, double x, double y) {
   // The feedback on the node positions is often off since not needed
   // and generating lots of events. We activate it here since the
   // movement of the node is decided by the viewer. This is one of the
   // only moment when the viewer really moves a node.
   boolean on = graph.feedbackXYZ();
   graph.feedbackXYZ(true);
   renderer.moveElementAtPx(element, x, y);
   graph.feedbackXYZ(on);
 }
Example #7
0
  public void close(GraphicGraph graph) {
    renderer.close();
    graph.addAttribute("ui.viewClosed", getId());

    removeKeyListener(shortcuts);
    shortcuts.release();
    mouseClicks.release();

    openInAFrame(false);
  }
Example #8
0
 /**
  * setup and render the grouped nodes in net
  *
  * @param gl
  * @param nr
  */
 void renderClusters(GL gl, GraphRenderer nr) {
   clustersSetup(gl);
   HashSet<Node> cl = null;
   for (Node n : net.fNodes) {
     cl = n.cluster;
     float rad = cl.size();
     if (rad > 4 && app.drawClusters) {
       nr.renderFan(gl, cl, n);
     }
   }
 }
Example #9
0
  @Override
  public int renderGraphTick(MapCanvas canvas, int nextPosX) {
    for (int i = 0; i < graphRenderers.length; i++) {
      GraphRenderer graphRenderer = graphRenderers[i];
      int position = this.componentLastPos[i];
      position++;

      // index starts with 0 so in the end - 1
      int maxComponentWidth = (i + 1) * componentWidth + i * SPACES - 1;
      if (position > maxComponentWidth) {
        // reset it to the start pos
        position = i * componentWidth + i * SPACES;
      }

      graphRenderer.renderGraphTick(canvas, position);
      this.componentLastPos[i] = position;
    }

    return 100;
  }
Example #10
0
  public DefaultView(Viewer viewer, String identifier, GraphRenderer renderer) {
    super(identifier);

    this.viewer = viewer;
    this.graph = viewer.getGraphicGraph();
    this.renderer = renderer;

    setOpaque(false);
    setDoubleBuffered(true);
    setMouseManager(null);
    setShortcutManager(null);
    renderer.open(graph, this);
  }
Example #11
0
 /**
  * render the groups defined in the group attribute
  *
  * @param gl
  * @param nr
  * @param net
  * @param fonttype
  */
 public void renderGroups(GL gl, GraphRenderer nr, Net net, int fonttype) {
   for (String n : net.groups.keySet()) {
     Net group = net.groups.get(n);
     Node center = group.hasNode(n);
     nr.renderGroups(gl, group.nNodes, center);
     //						nr.renderNode(gl, center);
     //
     //						for (Node eref: group.nNodes) {
     //							nr.renderNode(gl, eref);
     //							nr.renderNodeLabels(gl, eref, 2, false);
     //						}
     //
     //						for (Edge eref: group.nEdges) {
     //							nr.renderEdges(gl, eref);
     //						}
   }
 }
Example #12
0
 /**
  * render node labels with font = text
  *
  * @param gl
  * @param nr
  * @param text
  */
 void renderLabels(GL gl, GraphRenderer nr, int text) {
   //		boolean fast = (net.nNodes.size()>edgeTresh);
   boolean fast = false;
   for (Edge eref : net.nEdges) nr.renderEdgeLabels(gl, eref, text, fast);
   for (Node nref : net.nNodes) nr.renderNodeLabels(gl, nref, text, fast);
 }
Example #13
0
 /**
  * render edges contained in net in 3d
  *
  * @param gl
  * @param nr
  * @param text
  */
 public void renderEdges3D(GL gl, GraphRenderer nr, int text) {
   for (Edge eref : net.nEdges) {
     nr.renderEdges(gl, eref);
     nr.renderEdgeLabels(gl, eref, text, false);
   }
 }
Example #14
0
 /**
  * render edges contained in net
  *
  * @param gl
  * @param nr
  * @param text
  */
 public void renderEdges(GL gl, GraphRenderer nr, int text) {
   for (Edge eref : net.nEdges) {
     nr.renderEdges(gl, eref);
   }
 }
Example #15
0
 public Visitor<Void, E> visitSubgraph(String name) throws E {
   return new Visualizer<E>(renderer.renderSubgraph(name));
 }
Example #16
0
 public void selectionGrowsAt(double x, double y) {
   renderer.selectionGrowsAt(x, y);
   repaint();
 }
Example #17
0
 public Camera getCamera() {
   return renderer.getCamera();
 }
Example #18
0
 public GraphicElement findNodeOrSpriteAt(double x, double y) {
   return renderer.findNodeOrSpriteAt(x, y);
 }
Example #19
0
 public Collection<GraphicElement> allNodesOrSpritesIn(
     double x1, double y1, double x2, double y2) {
   return renderer.allNodesOrSpritesIn(x1, y1, x2, y2);
 }
Example #20
0
 public void endSelectionAt(double x2, double y2) {
   renderer.endSelectionAt(x2, y2);
   repaint();
 }
Example #21
0
 /**
  * render the nodes in net
  *
  * @param gl
  * @param nr
  * @param text
  */
 public void renderNodes(GL gl, GraphRenderer nr, int text) {
   applyPickColors();
   for (Node n : net.nNodes) {
     nr.renderNode(gl, n);
   }
 }
Example #22
0
 public void visitRelationship(Relationship relationship) throws E {
   if (visitedRelationships.add(relationship)) {
     renderProperties(renderer.renderRelationship(relationship), relationship);
   }
 }
Example #23
0
 public void beginSelectionAt(double x1, double y1) {
   renderer.beginSelectionAt(x1, y1);
   repaint();
 }
Example #24
0
 public Void done() throws E {
   renderer.done();
   return null;
 }
Example #25
0
 public void visitNode(Node node) throws E {
   if (visitedNodes.add(node)) {
     renderProperties(renderer.renderNode(node), node);
   }
 }
Example #26
0
 public void mouseClicked(MouseEvent m) {
   boss.gotoStartState();
 }
Example #27
0
 // TEMPORARY SOLUTION!
 public void repaint() {
   parent.repaint();
 }