27 |
*/ |
*/ |
28 |
package org.fenfire.view.buoy; |
package org.fenfire.view.buoy; |
29 |
import org.fenfire.view.View2D; |
import org.fenfire.view.View2D; |
30 |
|
import org.fenfire.util.ControlBinding; |
31 |
|
|
32 |
import org.nongnu.libvob.*; |
import org.nongnu.libvob.*; |
33 |
import org.nongnu.libvob.impl.DefaultVobMatcher; |
import org.nongnu.libvob.impl.DefaultVobMatcher; |
34 |
import org.nongnu.libvob.buoy.*; |
import org.nongnu.libvob.buoy.*; |
46 |
|
|
47 |
static public class MainNode2DFactory implements Factory { |
static public class MainNode2DFactory implements Factory { |
48 |
public float zoom; |
public float zoom; |
49 |
public MainNode2DFactory(float zoom) { |
protected ControlBinding controller; |
50 |
|
public MainNode2DFactory(float zoom, |
51 |
|
ControlBinding controller) { |
52 |
this.zoom = zoom; |
this.zoom = zoom; |
53 |
|
this.controller = controller; |
54 |
} |
} |
55 |
public AbstractMainNode2D create(Object plane, View2D view2d, |
public AbstractMainNode2D create(Object plane, View2D view2d, |
56 |
float panx, float pany) { |
float panx, float pany) { |
57 |
return new MainNode2D(plane, view2d, |
return new MainNode2D(plane, view2d, |
58 |
new SimpleFocus(panx, pany), zoom); |
new SimpleFocus(panx, pany), zoom, |
59 |
|
controller); |
60 |
} |
} |
61 |
} |
} |
62 |
|
|
63 |
/** Create a main node with a given plane, pan, and zoom. |
/** Create a main node with a given plane, pan, and zoom. |
64 |
*/ |
*/ |
65 |
public MainNode2D(Object plane, View2D view2d, |
public MainNode2D(Object plane, View2D view2d, |
66 |
Focus focus, float zoom) { |
Focus focus, float zoom, |
67 |
super(plane, view2d, focus); |
ControlBinding controller) { |
68 |
|
super(plane, view2d, focus, controller); |
69 |
focus.setZoom(zoom); |
focus.setZoom(zoom); |
70 |
this.zoom = zoom; |
this.zoom = zoom; |
71 |
} |
} |
72 |
|
|
73 |
/** Create a main node focused the center of a given plane. |
/** Create a main node focused the center of a given plane. |
74 |
*/ |
*/ |
75 |
public MainNode2D(Object plane, View2D view2d) { |
public MainNode2D(Object plane, View2D view2d, |
76 |
this(plane, view2d, new SimpleFocus(0, 0), 1); |
ControlBinding controller) { |
77 |
|
this(plane, view2d, new SimpleFocus(0, 0), 1, |
78 |
|
controller); |
79 |
view2d.getSize(plane, tmp); |
view2d.getSize(plane, tmp); |
80 |
if(tmp[0] >= 0) { |
if(tmp[0] >= 0) { |
81 |
focus.setPan(tmp[0] / 2f, tmp[1] / 2f); |
focus.setPan(tmp[0] / 2f, tmp[1] / 2f); |