102 |
OrthoCoordsys sys; |
OrthoCoordsys sys; |
103 |
float maxdepth = 0; |
float maxdepth = 0; |
104 |
|
|
105 |
public int getCoordsys(Object key) { |
public int coordsys(int into, float depth, float x, float y, |
|
// gets only toplevel so far |
|
|
return sys.map.get(0, key); |
|
|
} |
|
|
|
|
|
public int coordsys(int into, Object key, float depth, float x, float y, |
|
106 |
float w, float h) { |
float w, float h) { |
107 |
if(maxdepth < depth) maxdepth = depth; |
if(maxdepth < depth) maxdepth = depth; |
108 |
return sys.add(into, key, depth, x, y, w, h); |
return sys.add(into, depth, x, y, w, h); |
109 |
} |
} |
110 |
|
|
111 |
/** Remove all rectangles (except root rect); |
/** Remove all rectangles (except root rect); |
132 |
return getCSAt(x, y, null); |
return getCSAt(x, y, null); |
133 |
} |
} |
134 |
|
|
135 |
public Object getKeyAt(VobMap v, float x, float y, float[] internalcoords) { |
public void renderVobs(DefaultVobMap map, OrthoCoorder interpTo, int[] interpList, |
|
int cs = getCSAt(x, y, internalcoords); |
|
|
return sys.key[cs]; |
|
|
} |
|
|
|
|
|
public void renderVobs(DefaultVobMap map, OrthoCoorder interpTo, |
|
136 |
float fract, java.awt.Graphics g, Color fg) { |
float fract, java.awt.Graphics g, Color fg) { |
137 |
renderVobs(map, interpTo, fract, g, fg, 0, 0, 1, 1); |
renderVobs(map, interpTo, interpList, fract, g, fg, 0, 0, 1, 1); |
|
} |
|
|
|
|
|
/** Get the CS matching a CS from another OrthoCoorder. */ |
|
|
int getMatchingCS(OrthoCoordsys osys, int ocs) { |
|
|
if(ocs == 0) |
|
|
return 0; |
|
|
|
|
|
int my_parent = getMatchingCS(osys, osys.parent[ocs]); |
|
|
if(my_parent < 0) return -1; |
|
|
return sys.map.get(my_parent, osys.key[ocs]); |
|
138 |
} |
} |
139 |
|
|
140 |
/** Render the vobs, fract towards the interpTo coordinates. |
/** Render the vobs, fract towards the interpTo coordinates. |
141 |
*/ |
*/ |
142 |
public void renderVobs(final DefaultVobMap map, final OrthoCoorder interpTo, |
public void renderVobs(final DefaultVobMap map, final OrthoCoorder interpTo, final int[] interpList, |
143 |
final float fract, java.awt.Graphics g, Color fg, |
final float fract, java.awt.Graphics g, Color fg, |
144 |
final float xoffs, |
final float xoffs, |
145 |
final float yoffs, |
final float yoffs, |
164 |
DefaultVobMap.RenderInfoSetter setter = new DefaultVobMap.RenderInfoSetter() { |
DefaultVobMap.RenderInfoSetter setter = new DefaultVobMap.RenderInfoSetter() { |
165 |
public boolean set(Vob.RenderInfo info, int my) { |
public boolean set(Vob.RenderInfo info, int my) { |
166 |
int other = -1; |
int other = -1; |
167 |
if(interpTo != null && sys.map.canInterpolate && |
if(interpTo != null) { |
|
interpTo.sys.map.canInterpolate) { |
|
168 |
p("...interpTo != null"); |
p("...interpTo != null"); |
169 |
if(my == 0) { |
if(my == 0) { |
170 |
p("...my == 0."); |
p("...my == 0."); |
174 |
return true; |
return true; |
175 |
} |
} |
176 |
|
|
177 |
if(sys.key[my] == null) { |
other = interpList[my]; |
|
p("...my.key == null."); |
|
|
return false; |
|
|
} |
|
|
|
|
|
other = interpTo.getMatchingCS(sys, my); |
|
|
if(other < 0) { |
|
|
p("No corresponding key in "+interpTo+" found for "+ |
|
|
sys.key[my]+" in "+OrthoCoorder.this); |
|
|
return false; |
|
|
} |
|
|
|
|
178 |
setInterpInfo(my, interpTo, other, fract, |
setInterpInfo(my, interpTo, other, fract, |
179 |
xoffs, yoffs, xscale, yscale, |
xoffs, yoffs, xscale, yscale, |
180 |
(OrthoRenderInfo)info); |
(OrthoRenderInfo)info); |
193 |
for(int i=nsorted-1; i>=0; i--) { |
for(int i=nsorted-1; i>=0; i--) { |
194 |
p("...set: "+sorted[i]); |
p("...set: "+sorted[i]); |
195 |
if(setter.set(info, sorted[i])) { |
if(setter.set(info, sorted[i])) { |
196 |
p("...render: "+sorted[i]+" "+sys.key[sorted[i]]); |
p("...render: "+sorted[i]); |
197 |
map.renderCS(sorted[i], info, g, setter, info2); |
map.renderCS(sorted[i], info, g, setter, info2); |
198 |
} |
} |
199 |
} |
} |
200 |
p("End rendervobs "+xoffs+" "+yoffs); |
p("End rendervobs "+xoffs+" "+yoffs); |
201 |
} |
} |
202 |
|
|
203 |
public boolean needInterp(VobCoorder interpTo0) { |
public boolean needInterp(VobCoorder interpTo0, int[] interpList) { |
204 |
OrthoCoorder interpTo = (OrthoCoorder)interpTo0; |
OrthoCoorder interpTo = (OrthoCoorder)interpTo0; |
|
if(!sys.map.canInterpolate || !interpTo.sys.map.canInterpolate) |
|
|
return false; |
|
205 |
for(int my=1; my<sys.nsys; my++) { |
for(int my=1; my<sys.nsys; my++) { |
206 |
int other = interpTo.getMatchingCS(this.sys, my); |
int other = interpList[my]; |
207 |
if(other > 0) |
if(other > 0) |
208 |
if(needInterp(my, interpTo, other)) return true; |
if(needInterp(my, interpTo, other)) return true; |
209 |
} |
} |
225 |
sys.sorter.sort(); |
sys.sorter.sort(); |
226 |
pa("Depth sorted:"); |
pa("Depth sorted:"); |
227 |
for(int i=sys.sorter.nsorted-1; i>=0; i--) |
for(int i=sys.sorter.nsorted-1; i>=0; i--) |
228 |
pa(" "+sys.sorter.sorted[i]+" "+sys.key[sys.sorter.sorted[i]]); |
pa(" "+sys.sorter.sorted[i]); |
229 |
} |
} |
230 |
} |
} |
231 |
|
|