10 |
|
|
11 |
public class PPView2 implements View { |
public class PPView2 implements View { |
12 |
|
|
13 |
|
/** The current zoom. |
14 |
|
* Pixels for 1 paper coordinate unit. |
15 |
|
*/ |
16 |
|
public float zoom = 1; |
17 |
|
|
18 |
|
/** The scale of the background. |
19 |
|
* bgscale in paper coordinates = 1 in background coords. |
20 |
|
*/ |
21 |
|
public float bgscale = 200; |
22 |
|
|
23 |
Space space; |
Space space; |
24 |
PPDims d; |
PPDims d; |
25 |
|
|
26 |
CoordinatePlaneView coordinatePlaneView; |
CoordinatePlaneView coordinatePlaneView; |
27 |
|
|
28 |
|
/** A single PP plane, with given view context. |
29 |
|
* This class takes care of drawing the stencil, |
30 |
|
* the background and the vobs inside the plane. |
31 |
|
*/ |
32 |
class SinglePlane { |
class SinglePlane { |
33 |
ViewContext context; |
ViewContext context; |
34 |
void render(final VobScene vs, final int frameCS, final int c2fCS) { |
void render(final VobScene vs, final int frameCS, final int c2fCS) { |
41 |
final BgVob bg = BgVob.create(plane); |
final BgVob bg = BgVob.create(plane); |
42 |
|
|
43 |
final IrregularFrame f = IrregularFrame.create(-100,-100,1600,1600, |
final IrregularFrame f = IrregularFrame.create(-100,-100,1600,1600, |
44 |
50.3f, 1000f); |
50.3f, 500f); |
45 |
|
|
46 |
final int frameUnit = vs.unitSqCS(frameCS, "USQ"); |
final int frameUnit = vs.unitSqCS(frameCS, "USQ"); |
47 |
|
|
55 |
float[] sqs = new float[2]; |
float[] sqs = new float[2]; |
56 |
glc.getSqSize(frameCS, sqs); |
glc.getSqSize(frameCS, sqs); |
57 |
|
|
58 |
final int c2fUnit = vs.scaleCS(c2fCS, "SCA", 1.0f/sqs[0], 1.0f/sqs[1]); |
|
59 |
|
final int c2fUnit = vs.scaleCS(c2fCS, "SCA", |
60 |
|
bgscale/sqs[0], bgscale/sqs[1]); |
61 |
|
|
62 |
Stencil.drawStenciled(vs, |
Stencil.drawStenciled(vs, |
63 |
new Putter(f.getContent()), |
new Putter(f.getContent()), |
88 |
pl.context = vc; |
pl.context = vc; |
89 |
|
|
90 |
int frameCS = vs.orthoBoxCS(0, "frame", 0, 100, 100, 1, 1, 400, 400); |
int frameCS = vs.orthoBoxCS(0, "frame", 0, 100, 100, 1, 1, 400, 400); |
91 |
int c2fCS = 0; |
|
92 |
|
int c2fCS = vs.orthoCS(0, "C2F", 0, 0, 0, 10, 10); |
93 |
|
setZoomPan(vs); |
94 |
pl.render(vs, frameCS, c2fCS); |
pl.render(vs, frameCS, c2fCS); |
95 |
|
|
96 |
} |
} |
97 |
|
|
98 |
|
/** Cause the changes to the zooming and panning variables |
99 |
|
* to be shown in the given vobscene. |
100 |
|
* This changes the parameters of the coordinate systems created by render(). |
101 |
|
*/ |
102 |
|
public void setZoomPan(VobScene vs) { |
103 |
|
int cs = vs.matcher.getCS("C2F"); |
104 |
|
vs.coords.setOrthoParams(cs, 0, 0, 0, zoom, zoom); |
105 |
|
} |
106 |
} |
} |