1 |
//(c): Matti J. Katila |
//(c): Matti J. Katila |
2 |
|
|
3 |
package org.fenfire.modules.pp; |
package org.fenfire.modules.pp; |
4 |
|
import org.fenfire.*; |
5 |
|
import org.fenfire.impl.*; |
6 |
|
//import org.fenfire.vocab.*; |
7 |
import org.fenfire.vocab.*; |
import org.fenfire.vocab.*; |
8 |
import org.fenfire.util.*; |
import org.fenfire.util.*; |
9 |
import org.fenfire.view.*; |
import org.fenfire.view.*; |
10 |
import org.fenfire.view.buoy.*; |
import org.fenfire.view.buoy.*; |
11 |
import org.nongnu.libvob.*; |
import org.nongnu.libvob.*; |
12 |
import org.nongnu.libvob.buoy.*; |
import org.nongnu.libvob.buoy.*; |
13 |
|
|
14 |
|
import org.nongnu.storm.*; |
15 |
|
import org.nongnu.alph.*; |
16 |
|
import org.nongnu.alph.impl.*; |
17 |
|
|
18 |
import com.hp.hpl.mesa.rdf.jena.model.*; |
import com.hp.hpl.mesa.rdf.jena.model.*; |
19 |
import com.hp.hpl.mesa.rdf.jena.common.*; |
import com.hp.hpl.mesa.rdf.jena.common.*; |
20 |
import com.hp.hpl.mesa.rdf.jena.vocabulary.*; |
import com.hp.hpl.mesa.rdf.jena.vocabulary.*; |
24 |
public static boolean dbg = false; |
public static boolean dbg = false; |
25 |
private static void pa(String s) { System.out.println("PPCanvasNode:"+s); } |
private static void pa(String s) { System.out.println("PPCanvasNode:"+s); } |
26 |
|
|
27 |
private Model model; |
private Space space; |
28 |
private GraphicsAPI.Window win; |
private GraphicsAPI.Window win; |
29 |
public PPCanvasNode(Model m, GraphicsAPI.Window w) { |
public PPCanvasNode(Space s, GraphicsAPI.Window w) { |
30 |
this.model = m; |
this.space = s; |
31 |
this.win = w; |
this.win = w; |
32 |
} |
} |
33 |
|
|
34 |
|
/** The zoom to be used for the buoys. |
35 |
|
*/ |
36 |
|
public float buoyZoom = 1; |
37 |
|
|
38 |
|
/** The zoom to be used for the link creation buoys. |
39 |
|
*/ |
40 |
|
public float linkbuoyZoom = .5f; |
41 |
|
|
42 |
/** True if this view "owns" a certain node. |
/** True if this view "owns" a certain node. |
43 |
*/ |
*/ |
44 |
public boolean ownsNode(RDFNode node) |
public boolean ownsNode(RDFNode node) |
45 |
{ |
{ |
46 |
// check if node is a note |
// check if node is a note |
47 |
if (ShortRDF.isNodeType(model, node, PP.noteType)) return true; |
if (ShortRDF.isNodeType(space.getModel(), node, PP.noteType)) return true; |
48 |
|
|
49 |
// or if node is a paper |
// or if node is a paper |
50 |
if (ShortRDF.isNodeType(model, node, PP.paperType)) return true; |
if (ShortRDF.isNodeType(space.getModel(), node, PP.paperType)) return true; |
51 |
|
|
52 |
// otherwise |
// otherwise |
53 |
return false; |
return false; |
64 |
wh[1] /= 6; |
wh[1] /= 6; |
65 |
return null; |
return null; |
66 |
} |
} |
67 |
|
|
68 |
// XXX |
wh[0] = 250; |
69 |
|
wh[1] = 250; |
70 |
return null; |
return null; |
71 |
} |
} |
72 |
|
|
84 |
|
|
85 |
int[] pan = getCoords(node); |
int[] pan = getCoords(node); |
86 |
|
|
87 |
/* |
SimpleVStreamTexter sct = (SimpleVStreamTexter)space.getNodeTexter(); |
88 |
SimpleVStreamTexter sct = (SimpleVStreamTexter)space.getCellTexter(); |
Enfilade1DImpl enf = (Enfilade1DImpl)sct.getEnfilade(node, null); |
|
Enfilade1DImpl enf = (Enfilade1DImpl)sct.getEnfilade(c, null); |
|
89 |
java.util.List enfList= enf.getList(); |
java.util.List enfList= enf.getList(); |
90 |
Span1D span = (Span1D) enfList.get(0); |
Span1D span = (Span1D) enfList.get(0); |
91 |
CellView cv; |
|
|
if (span instanceof TextSpan) |
|
|
cv = new TextCellContentView(); |
|
|
else |
|
|
cv = new PageSpanCellView(); |
|
92 |
float [] bs = new float[3]; |
float [] bs = new float[3]; |
|
cv.getSize(c, ((ViewContext)new AbstractViewContext()), bs); |
|
93 |
|
|
94 |
pan[0] += bs[0]/2; |
//cv.getSize(c, ((ViewContext)new AbstractViewContext()), bs); |
95 |
pan[1] += bs[1]/2; |
|
96 |
|
//pan[0] += bs[0]/2; |
97 |
|
//pan[1] += bs[1]/2; |
98 |
|
pan[0] += 200/2; |
99 |
|
pan[1] += 200/2; |
100 |
|
|
101 |
|
|
102 |
final int c2fCS = |
final int c2fCS = |
106 |
vs.matcher.add(into, c2fCS, "C2F"); |
vs.matcher.add(into, c2fCS, "C2F"); |
107 |
vs.matcher.add(into, c2fCSInv, "C2FINV"); |
vs.matcher.add(into, c2fCSInv, "C2FINV"); |
108 |
|
|
109 |
SinglePaper.i(space, d,win,c).render(vs, into, c2fCS, c2fCSInv, null); |
//SinglePaper.i(space, d,win,c).render(vs, into, c2fCS, c2fCSInv, null); |
|
*/ |
|
110 |
return into; |
return into; |
111 |
} |
} |
112 |
|
|
121 |
private int[] getCoords(RDFNode node) { |
private int[] getCoords(RDFNode node) { |
122 |
int [] ints = new int[2]; |
int [] ints = new int[2]; |
123 |
|
|
124 |
ints[0] = ShortRDF.getInt(model, node, SPATIAL.coordX); |
ints[0] = ShortRDF.getInt(space.getModel(), node, SPATIAL.coordX); |
125 |
ints[1] = ShortRDF.getInt(model, node, SPATIAL.coordY); |
ints[1] = ShortRDF.getInt(space.getModel(), node, SPATIAL.coordY); |
126 |
return ints; |
return ints; |
127 |
} |
} |
128 |
|
|