Search in sources :

Example 1 with TermSyntaxVis

use of nars.gui.output.graph.TermSyntaxVis in project opennars by opennars.

the class SentenceTablePanel method newSelectedGraphPanel.

public void newSelectedGraphPanel() {
    Term[] sel = new Term[table.getSelectedRows().length];
    int k = 0;
    for (int i : table.getSelectedRows()) {
        Sentence w = (Sentence) table.getValueAt(i, 1);
        sel[k] = w.term;
        k++;
    }
    TermSyntaxVis tt = new TermSyntaxVis(sel);
    syntaxPanel = new PCanvas(tt);
    syntaxPanel.setZoom(10f);
    NWindow w = new NWindow("", syntaxPanel);
    w.setSize(400, 400);
    w.setVisible(true);
// ProcessingGraphPanel2 pgp = new ProcessingGraphPanel2(getSelectedRows(1)) {
// 
// @Override
// public DirectedMultigraph getGraph() {
// 
// DefaultGraphizer graphizer = new DefaultGraphizer(true, true, true, true, 0, false, false) {
// 
// protected void addSentence(NARGraph g, Sentence s) {
// Term t = s.content;
// addTerm(g, t);
// //g.addEdge(s, s.content, new NARGraph.SentenceContent());
// 
// if (t instanceof CompoundTerm) {
// CompoundTerm ct = ((CompoundTerm) t);
// Set<Term> contained = ct.getContainedTerms();
// 
// for (Term x : contained) {
// addTerm(g, x);
// if (ct.containsTerm(x)) {
// g.addEdge(x, t, new NARGraph.TermContent());
// }
// 
// for (Term y : contained) {
// addTerm(g, y);
// 
// if (x != y) {
// if (x.containsTerm(y)) {
// g.addEdge(y, x, new NARGraph.TermContent());
// }
// }
// }
// }
// }
// }
// 
// @Override
// public void onTime(NARGraph g, long time) {
// super.onTime(g, time);
// 
// for (Object o : getItems()) {
// 
// if (o instanceof Task) {
// g.addVertex(o);
// addSentence(g, ((Task) o).sentence);
// } else if (o instanceof Sentence) {
// g.addVertex(o);
// addSentence(g, (Sentence) o);
// }
// }
// //add sentences
// }
// 
// };
// 
// app.updating = true;
// 
// graphizer.setShowSyntax(showSyntax);
// 
// NARGraph g = new NARGraph();
// g.add(nar, newSelectedGraphFilter(), graphizer);
// return g;
// }
// 
// @Override
// public int edgeColor(Object edge) {
// return NARSwing.getColor(edge.toString(), 0.5f, 0.5f).getRGB();
// }
// 
// @Override
// public float edgeWeight(Object edge) {
// return 10;
// }
// 
// @Override
// public int vertexColor(Object vertex) {
// return NARSwing.getColor(vertex.toString(), 0.5f, 0.5f).getRGB();
// }
// 
// };
// NWindow w = new NWindow("", pgp);
// w.setSize(400, 400);
// w.setVisible(true);
}
Also used : NWindow(automenta.vivisect.swing.NWindow) PCanvas(automenta.vivisect.swing.PCanvas) Term(nars.language.Term) TermSyntaxVis(nars.gui.output.graph.TermSyntaxVis) Sentence(nars.entity.Sentence)

Aggregations

NWindow (automenta.vivisect.swing.NWindow)1 PCanvas (automenta.vivisect.swing.PCanvas)1 Sentence (nars.entity.Sentence)1 TermSyntaxVis (nars.gui.output.graph.TermSyntaxVis)1 Term (nars.language.Term)1