/[gzz]/gzz/gzz/modules/pp/BuoyView.java
ViewVC logotype

Diff of /gzz/gzz/modules/pp/BuoyView.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.28 by tjl, Tue Oct 8 07:34:54 2002 UTC revision 1.29 by tjl, Wed Oct 9 14:38:41 2002 UTC
# Line 28  import gzz.view.ViewContext; Line 28  import gzz.view.ViewContext;
28  import gzz.*;  import gzz.*;
29  import gzz.errors.*;  import gzz.errors.*;
30  import gzz.vob.*;  import gzz.vob.*;
31    import gzz.vob.buoy.*;
32  import java.util.ArrayList;  import java.util.ArrayList;
33  import java.util.List;  import java.util.List;
34  import java.util.Iterator;  import java.util.Iterator;
# Line 59  public static final String rcsid = "$Id$ Line 60  public static final String rcsid = "$Id$
60      Object crosshairKey = new Object();      Object crosshairKey = new Object();
61      CursorVob crosshair = new CursorVob();      CursorVob crosshair = new CursorVob();
62    
     // Seed for toArray to get the return type right  
     private Buoy[] seed = new Buoy[0];  
   
     private Buoy2 buoy2 = new Buoy2();  
   
63      private VobKeyer keyer;      private VobKeyer keyer;
64    
65      public BuoyView(VobKeyer keyer) {      public BuoyView(VobKeyer keyer) {
66          this.keyer = keyer;          this.keyer = keyer;
         planeView = new PlaneView(keyer);  
67      }      }
68    
69      static int bwid;      static int bwid;
70    
71      static Object BGKEY = new Object();      static Object BGKEY = new Object();
72    
73        int mainviewCS;
74    
75        public int offsetx = 0, offsety = 0;
76        public float scale = 0.01f;
77        VobScene currentvs;
78    
79        public void setMainAffineParams() {
80            ((GLVobCoorder)currentvs.coords).setAffineParams(mainviewCS, 0,
81                    .5f - scale * offsetx,
82                    .5f - scale * offsety,
83                    scale, 0, 0, scale);
84        }
85    
86      private void putBackground(VobScene into) {      private void putBackground(VobScene into) {
87          Dimension d = into.getSize();          Dimension d = into.getSize();
88    
# Line 96  public static final String rcsid = "$Id$ Line 104  public static final String rcsid = "$Id$
104          */          */
105      }      }
106    
107        CircleFloater4  lbf, rbf;
108    
109      /** Draw the whole view into a <code>VobScene</code>.      /** Draw the whole view into a <code>VobScene</code>.
110       */       */
111      public void render(VobScene into, int intoCS, ViewContext context) {      public void render(VobScene into, int intoCS, ViewContext context) {
   
         putBackground(into);  
   
112          Dimension d = into.getSize();          Dimension d = into.getSize();
113            float rad = d.height/2;
   
         List leftBuoys = new ArrayList(),  
              rightBuoys = new ArrayList();  
114    
115          int          int
116              ctrw = d.width * 3/5,              ctrw = d.width * 3/5,
# Line 116  public static final String rcsid = "$Id$ Line 120  public static final String rcsid = "$Id$
120    
121          bwid = d.width / 5;          bwid = d.width / 5;
122    
123    
124    
125            lbf = new CircleFloater4(into, 0, ctrx, ctry, rad, ctrx+rad, ctry);
126            rbf = new CircleFloater4(into, 0, ctrx, ctry, rad, ctrx-rad, ctry);
127    
128    
129            planeView = new PlaneView(keyer, lbf, rbf);
130    
131            putBackground(into);
132    
133    
134    
135            List leftBuoys = new ArrayList(),
136                 rightBuoys = new ArrayList();
137          // Render the central view and gather the buoys.          // Render the central view and gather the buoys.
138          renderCenterView(into, context.getAccursed(),          renderCenterView(into, context.getAccursed(),
139                  ctrx, ctry, ctrw, ctrh, leftBuoys, rightBuoys);                  ctrx, ctry, ctrw, ctrh, leftBuoys, rightBuoys);
140    
         mapBuoySizes(leftBuoys);  
         mapBuoySizes(rightBuoys);  
   
141          int cx = ctrx + ctrw/2;          int cx = ctrx + ctrw/2;
142          int cy = ctry + ctrh/2;          int cy = ctry + ctrh/2;
143    
144          into.put(crosshair, crosshairKey, 2, cx-5, cy-5, 10, 10);          into.put(crosshair, crosshairKey, 2, cx-5, cy-5, 10, 10);
145    
         // Render the left and right buoys  
         p("Place left buoys");  
         Buoy[] store = (Buoy[])leftBuoys.toArray(seed);  
         buoy2.place(into, store, new Rectangle(0, 0, bwid, d.height));  
   
         p("Place right buoys");  
         store = (Buoy[])rightBuoys.toArray(seed);  
         buoy2.place(into, store, new Rectangle(d.width - bwid, 0,  
                                                 bwid, d.height));  
   
   
146          renderDirectory(into, context.getWindow(), 0, 0, d.width, d.height/3,          renderDirectory(into, context.getWindow(), 0, 0, d.width, d.height/3,
147                          keyer);                          keyer);
148    
# Line 149  public static final String rcsid = "$Id$ Line 153  public static final String rcsid = "$Id$
153          into.dump();          into.dump();
154      }      }
155    
     void mapBuoySizes(List l) {  
         for(Iterator i = l.iterator(); i.hasNext(); ) {  
             AbstractBuoy buoy = (AbstractBuoy)i.next();  
             buoy.setPreferredSize(new Dimension(bwid, bwid * 8/10));  
         }  
     }  
   
156      /** Draws the central view into a <code>VobScene</code>.      /** Draws the central view into a <code>VobScene</code>.
157       */       */
158      private void renderCenterView(VobScene into, Cell center,      private void renderCenterView(VobScene into, Cell center,
159                  int x, int y, int w, int h,                  int x, int y, int w, int h,
160                  List leftBuoys, List rightBuoys) {                  List leftBuoys, List rightBuoys) {
161    
162            /*
163          int panx = Win.xctr, pany = Win.yctr;          int panx = Win.xctr, pany = Win.yctr;
164          float zoom = Win.zoom;          float zoom = Win.zoom;
165          VobKeyer.Entry keyEntry =          VobKeyer.Entry keyEntry =
# Line 169  public static final String rcsid = "$Id$ Line 167  public static final String rcsid = "$Id$
167          planeView.renderSinglePaper(into, center,  x, y, w, h, 15,          planeView.renderSinglePaper(into, center,  x, y, w, h, 15,
168                      panx, pany, zoom,                      panx, pany, zoom,
169                      leftBuoys, rightBuoys, keyEntry);                      leftBuoys, rightBuoys, keyEntry);
170                        */
171      }      }
172    
173      /** Draws the view directory, which is currently a little funny,      /** Draws the view directory, which is currently a little funny,
# Line 192  public static final String rcsid = "$Id$ Line 191  public static final String rcsid = "$Id$
191    
192          while(plane != null)  {          while(plane != null)  {
193    
194                /*
195              planeView.renderSinglePaper(into, plane,              planeView.renderSinglePaper(into, plane,
196                          vx, vy, vw, vh, vd,                          vx, vy, vw, vh, vd,
197                          0, 0, 400,                          0, 0, 400,
198                          null, null,                          null, null,
199                          keyer.getDirectoryEntry(plane)                          keyer.getDirectoryEntry(plane)
200                    );                    );
201                    */
202              vd += 20;              vd += 20;
203              vx -= dx; vy += dy;              vx -= dx; vy += dy;
204              vw *= 0.8; vh *= 0.8;              vw *= 0.8; vh *= 0.8;
# Line 212  public static final String rcsid = "$Id$ Line 213  public static final String rcsid = "$Id$
213    
214          while(plane != null) {          while(plane != null) {
215    
216                /*
217              planeView.renderSinglePaper(into, plane,              planeView.renderSinglePaper(into, plane,
218                          vx, vy, vw, vh, vd,                          vx, vy, vw, vh, vd,
219                          0, 0, 400,                          0, 0, 400,
220                          null, null,                          null, null,
221                          keyer.getDirectoryEntry(plane)                          keyer.getDirectoryEntry(plane)
222                    );                    );
223                    */
224              vd += 20;              vd += 20;
225              vx += dx; vy += dy;              vx += dx; vy += dy;
226              vw *= 0.8; vh *= 0.8;              vw *= 0.8; vh *= 0.8;
227              plane = plane.s(d_1, 1);              plane = plane.s(d_1, 1);
228          }          }
   
   
229      }      }
230    
231      static TextStyle style = GraphicsAPI.getInstance()      static TextStyle style = GraphicsAPI.getInstance()

Legend:
Removed from v.1.28  
changed lines
  Added in v.1.29

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26