38 |
* @param vs The VobScene to render the node into. |
* @param vs The VobScene to render the node into. |
39 |
* @param into The coordinate system inside <code>vs</code> |
* @param into The coordinate system inside <code>vs</code> |
40 |
* to render the node into. |
* to render the node into. |
41 |
* @param node The node to render. |
* @param spec Information about the node to render. |
|
* @param prop The property through which the node |
|
|
* is related to the focus (<code>null</code> |
|
|
* for the focus itself). |
|
|
* @param dir Larger than zero if the node is posward |
|
|
* from the focus; smaller than zero if the node |
|
|
* is negward from the focus; zero if the node |
|
|
* <em>is</em> the focus. |
|
42 |
*/ |
*/ |
43 |
void render(VobScene vs, int into, RDFNode node, |
void render(VobScene vs, int into, Nodespec spec); |
|
Property prop, int dir); |
|
44 |
|
|
45 |
/** Get the default size of a node. |
/** Get the default size of a node. |
46 |
* @param node The node to get size for, or null for a default size. |
* @param node The node to get size for, or null for a default size. |
49 |
*/ |
*/ |
50 |
//void getSize(RDFNode node, float[] out); |
//void getSize(RDFNode node, float[] out); |
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
/** Information about a node to be rendered. |
55 |
|
* Also used as the key for the coordsys containing |
56 |
|
* the node. |
57 |
|
* XXX better name for this class? |
58 |
|
*/ |
59 |
|
class Nodespec { |
60 |
|
/** Create a nodespec for the focused node. |
61 |
|
*/ |
62 |
|
public Nodespec(RDFNode focus) { |
63 |
|
node = focus; |
64 |
|
prop = null; |
65 |
|
dir = 0; |
66 |
|
} |
67 |
|
|
68 |
|
/** Create a nodespec for a node in the context. |
69 |
|
*/ |
70 |
|
public Nodespec(RDFNode node, Property prop, int dir) { |
71 |
|
this.node = node; |
72 |
|
this.prop = prop; |
73 |
|
this.dir = dir; |
74 |
|
} |
75 |
|
|
76 |
|
public boolean equals(Object o) { |
77 |
|
if(!(o instanceof Nodespec)) return false; |
78 |
|
Nodespec s = (Nodespec)o; |
79 |
|
|
80 |
|
boolean propeq; |
81 |
|
if(prop == null || s.prop == null) |
82 |
|
propeq = (prop == s.prop); |
83 |
|
else |
84 |
|
propeq = prop.equals(s.prop); |
85 |
|
|
86 |
|
return propeq && dir == s.dir && node.equals(s.node); |
87 |
|
} |
88 |
|
|
89 |
|
public int hashCode() { |
90 |
|
if(prop != null) |
91 |
|
return dir * (node.hashCode() ^ ~prop.hashCode()); |
92 |
|
else |
93 |
|
return node.hashCode(); |
94 |
|
} |
95 |
|
|
96 |
|
/** The node rendered in this cs. |
97 |
|
*/ |
98 |
|
public RDFNode node; |
99 |
|
|
100 |
|
/** The property through which the node |
101 |
|
* is related to the focus (<code>null</code> |
102 |
|
* for the focus itself). |
103 |
|
*/ |
104 |
|
public Property prop; |
105 |
|
|
106 |
|
/** Larger than zero if the node is posward |
107 |
|
* from the focus; smaller than zero if the node |
108 |
|
* is negward from the focus; zero if the node |
109 |
|
* <em>is</em> the focus. |
110 |
|
*/ |
111 |
|
public int dir; |
112 |
|
} |
113 |
} |
} |