Back to index

wims  3.65+svn20090927
Public Member Functions | Static Public Attributes | Package Functions | Package Attributes | Static Package Attributes
inp_panel Class Reference
Inheritance diagram for inp_panel:
Inheritance graph
[legend]
Collaboration diagram for inp_panel:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 inp_panel (Color bgcolor, Image gotbg)
String points2string (String rep)
void retry ()
void mouseDragged (MouseEvent e)
void mouseMoved (MouseEvent e)
void mousePressed (MouseEvent e)
void mouseReleased (MouseEvent e)
void mouseEntered (MouseEvent e)
void mouseExited (MouseEvent e)
void mouseClicked (MouseEvent e)
void paint (Graphics g)
 inp_panel (Color bgcolor, Image gotbg)
void retry ()
void mouseDragged (MouseEvent e)
void mouseMoved (MouseEvent e)
void mousePressed (MouseEvent e)
void mouseReleased (MouseEvent e)
void mouseEntered (MouseEvent e)
void mouseExited (MouseEvent e)
void mouseClicked (MouseEvent e)
void paint (Graphics g)

Static Public Attributes

static final int CURVE = 0
static int ctype

Package Functions

void pointPaint (Graphics g, Point p)
void pointPaint (Graphics g, Point p)

Package Attributes

Image bg
Vector lines = new Vector(16384)
int x1
int y1
int x2
int y2
int radius
int drag
int st

Static Package Attributes

static final int RECT = 1
static final int CIRCLE = 2
static final int LINES = 3
static final int LINE = 4
static final int SLINE = 5
static final int SEG = 6
static final int POLY = 7
static final int POINTS = 8
static final int VEC = 9
static int ll = 4

Detailed Description

Definition at line 125 of file input.java.


Constructor & Destructor Documentation

inp_panel.inp_panel ( Color  bgcolor,
Image  gotbg 
) [inline]

Definition at line 138 of file input.java.

                                                {
       setBackground(bgcolor);
       setForeground(Color.black);
       bg=gotbg;
       addMouseMotionListener(this);
       addMouseListener(this);
       st=0;
    }
inp_panel.inp_panel ( Color  bgcolor,
Image  gotbg 
) [inline]

Definition at line 128 of file noninput.java.

                                                {
       setBackground(bgcolor);
       setForeground(Color.black);
       bg=gotbg;
       addMouseMotionListener(this);
       addMouseListener(this);
       st=0;
    }

Member Function Documentation

void inp_panel.mouseClicked ( MouseEvent  e) [inline]

Definition at line 290 of file noninput.java.

                                           {
    }
void inp_panel.mouseClicked ( MouseEvent  e) [inline]

Definition at line 303 of file input.java.

                                           {
    }
void inp_panel.mouseDragged ( MouseEvent  e) [inline]

Definition at line 178 of file noninput.java.

                                           {
       int t=lines.size();
       int dr;
        e.consume();
       switch(ctype) {
           case CURVE: {
              if(t<2000) {
                  x1=e.getX(); y1=e.getY();
                  lines.addElement(new Point(x1, y1));
                  repaint();
              }
              st=2; return;
           }
           default: {
              dr=drag; mouseMoved(e); drag=dr+1;
              return;
           }
       }
    }

Here is the call graph for this function:

void inp_panel.mouseDragged ( MouseEvent  e) [inline]

Definition at line 189 of file input.java.

                                           {
       int t=lines.size();
       int dr;
        e.consume();
       switch(ctype) {
           case CURVE: {
              if(t<2000) {
                  x1=e.getX(); y1=e.getY();
                  lines.addElement(new Point(x1, y1));
                  repaint();
              }
              st=2; return;
           }
           default: {
              dr=drag; mouseMoved(e); drag=dr+1;
              return;
           }
       }
    }

Here is the call graph for this function:

void inp_panel.mouseEntered ( MouseEvent  e) [inline]

Definition at line 281 of file noninput.java.

                                           {
    }
void inp_panel.mouseEntered ( MouseEvent  e) [inline]

Definition at line 294 of file input.java.

                                           {
    }
void inp_panel.mouseExited ( MouseEvent  e) [inline]

Definition at line 284 of file noninput.java.

                                          {
       if(ctype!=CURVE && ctype!=LINES && ctype!=POLY) return;
       e.consume();
       x2=x1; y2=y1; if(st>0) repaint();
    }
void inp_panel.mouseExited ( MouseEvent  e) [inline]

Definition at line 297 of file input.java.

                                          {
       if(ctype!=CURVE && ctype!=LINES && ctype!=POLY) return;
       e.consume();
       x2=x1; y2=y1; if(st>0) repaint();
    }
void inp_panel.mouseMoved ( MouseEvent  e) [inline]

Definition at line 198 of file noninput.java.

                                         {
        e.consume(); drag=0;
       switch(ctype) {
           case POLY:
           case POINTS:
           case LINES:
           case CURVE: {
              if(st==0) return; else st=1;
              x2=e.getX(); y2=e.getY(); break;
           }
           case CIRCLE:
           case SLINE:
           case LINE:
           case SEG:
           case RECT: {
              if(st!=1) return;
              x2=e.getX(); y2=e.getY();
              radius=(int) Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
              break;
           }
           default: return;
       }
       if(ctype!=POINTS) repaint();
    }
void inp_panel.mouseMoved ( MouseEvent  e) [inline]

Definition at line 209 of file input.java.

                                         {
        e.consume(); drag=0;
       switch(ctype) {
           case POLY:
           case POINTS:
           case LINES:
           case CURVE: {
              if(st==0) return; else st=1;
              x2=e.getX(); y2=e.getY(); break;
           }
           case CIRCLE:
           case SLINE:
           case LINE:
           case SEG:
           case VEC:
           case RECT: {
              if(st!=1) return;
              x2=e.getX(); y2=e.getY();
              radius=(int) Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
              break;
           }
           default: return;
       }
       if(ctype!=POINTS) repaint();
    }

Here is the caller graph for this function:

void inp_panel.mousePressed ( MouseEvent  e) [inline]

Definition at line 223 of file noninput.java.

                                           {
        e.consume();
       switch(ctype) {
           case CURVE: {
              if(st>0) return;
              x1=e.getX(); y1=e.getY(); x2=x1; y2=y1;
              lines.removeAllElements();
              lines.addElement(new Point(x1,y1));
              repaint(); st=2;
              return;
           }
           case POLY:
           case POINTS:
           case LINES: {
              x2=e.getX(); y2=e.getY();
              if(st==0) lines.removeAllElements();
              lines.addElement(new Point(x2,y2));
              st=1; x1=x2; y1=y2; repaint(); return;
           }
           case CIRCLE:
           case SLINE:
           case LINE:
           case SEG:
           case RECT: {
              x2=e.getX(); y2=e.getY();
              switch(st) {
                  case 2:
                  case 0: x1=x2; y1=y2; radius=0; st=1; repaint(); return;
                  case 1: {
                     radius=(int) Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
                     st=2; return;
                  }
              }             
              break;
           }
           default: return;
       }
    }
void inp_panel.mousePressed ( MouseEvent  e) [inline]

Definition at line 235 of file input.java.

                                           {
        e.consume();
       switch(ctype) {
           case CURVE: {
              if(st>0) return;
              x1=e.getX(); y1=e.getY(); x2=x1; y2=y1;
              lines.removeAllElements();
              lines.addElement(new Point(x1,y1));
              repaint(); st=2;
              return;
           }
           case POLY:
           case POINTS:
           case LINES: {
              x2=e.getX(); y2=e.getY();
              if(st==0) lines.removeAllElements();
              lines.addElement(new Point(x2,y2));
              st=1; x1=x2; y1=y2; repaint(); return;
           }
           case CIRCLE:
           case SLINE:
           case LINE:
           case SEG:
           case VEC:
           case RECT: {
              x2=e.getX(); y2=e.getY();
              switch(st) {
                  case 2:
                  case 0: x1=x2; y1=y2; radius=0; st=1; repaint(); return;
                  case 1: {
                     radius=(int) Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
                     st=2; return;
                  }
              }             
              break;
           }
           default: return;
       }
    }

Here is the caller graph for this function:

void inp_panel.mouseReleased ( MouseEvent  e) [inline]

Definition at line 262 of file noninput.java.

                                            {
       e.consume();
       switch(ctype) {
           case CURVE: {
              if(st==2) return;
              x2=e.getX(); y2=e.getY();
              if(st==0) lines.removeAllElements();
              lines.addElement(new Point(x2,y2));
              st=1; x1=x2; y1=y2;
              return;
           }
           case POINTS: return;
           default: {
              if(st>0 && drag>=8) mousePressed(e);
              return;
           }
       }
    }

Here is the call graph for this function:

void inp_panel.mouseReleased ( MouseEvent  e) [inline]

Definition at line 275 of file input.java.

                                            {
       e.consume();
       switch(ctype) {
           case CURVE: {
              if(st==2) return;
              x2=e.getX(); y2=e.getY();
              if(st==0) lines.removeAllElements();
              lines.addElement(new Point(x2,y2));
              st=1; x1=x2; y1=y2;
              return;
           }
           case POINTS: return;
           default: {
              if(st>0 && drag>=8) mousePressed(e);
              return;
           }
       }
    }

Here is the call graph for this function:

void inp_panel.paint ( Graphics  g) [inline]

Definition at line 293 of file noninput.java.

                                  {
       int np=lines.size();
       Point pp;

       if(bg!=null) g.drawImage(bg,0,0,this);
       switch(ctype) {
           case POINTS: {
              if(np>0) for (int i=0; i < np; i++) 
                pointPaint(g,(Point)lines.elementAt(i));
              break;
           }
           case POLY:
           case CURVE:
           case LINES: {
              if(np>0) {
                  pp=(Point)lines.elementAt(0);
                  for (int i=1; i < np; i++) {
                     Point p=(Point)lines.elementAt(i);
                     g.drawLine(pp.x, pp.y, p.x, p.y);
                     pp=p;
                  }
                  if (st==1) g.drawLine(x1, y1, x2, y2);
              }
              if(ctype==POLY && np>1) {
                  Point p1=(Point)lines.elementAt(0);
                  Point p2=(Point)lines.elementAt(np-1);
                  if(st==0) g.drawLine(p1.x,p1.y,p2.x,p2.y);
                  else g.drawLine(p1.x,p1.y,x2,y2);
              }
              break;
           }
           case SEG:
           case SLINE:
           case LINE:
           case RECT: {
              if(st>0) {
                  int xx1,yy1,xx2,yy2;
                  int X1,Y1,X2,Y2,max;
                  xx1=Math.min(x1,x2); yy1=Math.min(y1,y2);
                  xx2=Math.max(x1,x2); yy2=Math.max(y1,y2);
                  max=Math.max(Math.abs(x2-x1),Math.abs(y2-y1));
                  if(max<10) max=10;
                  max=500/max+1;
                  switch(ctype) {
                     case RECT: g.drawRect(xx1,yy1,xx2-xx1,yy2-yy1); break;
                     case SLINE: {
                         g.fillOval(x1-2,y1-2,4,4);
                         g.drawLine(x1,y1,max*x2-(max-1)*x1,max*y2-(max-1)*y1); break;
                     }
                     case LINE: {
                         g.fillOval(x1-2,y1-2,4,4);
                         g.fillOval(x2-2,y2-2,4,4);
                         g.drawLine(max*x1-(max-1)*x2,max*y1-(max-1)*y2,
                                   max*x2-(max-1)*x1,max*y2-(max-1)*y1); break;
                     }
                     case SEG: g.drawLine(x1,y1,x2,y2); break;
                  }
              }
              break;
           }
           case CIRCLE: {
              if(st>0) {
                  pointPaint(g,new Point(x1,y1));
                  g.drawOval(x1-radius,y1-radius,radius*2,radius*2);
              }
              break;
           }
       }
    }

Here is the call graph for this function:

void inp_panel.paint ( Graphics  g) [inline]

Definition at line 306 of file input.java.

                                  {
       int np=lines.size();
       Point pp;

       if(bg!=null) g.drawImage(bg,0,0,this);
       switch(ctype) {
           case POINTS: {
              if(np>0) for (int i=0; i < np; i++) 
                pointPaint(g,(Point)lines.elementAt(i));
              break;
           }
           case POLY:
           case CURVE:
           case LINES: {
              if(np>0) {
                  pp=(Point)lines.elementAt(0);
                  for (int i=1; i < np; i++) {
                     Point p=(Point)lines.elementAt(i);
                     g.drawLine(pp.x, pp.y, p.x, p.y);
                     pp=p;
                  }
                  if (st==1) g.drawLine(x1, y1, x2, y2);
              }
              if(ctype==POLY && np>1) {
                  Point p1=(Point)lines.elementAt(0);
                  Point p2=(Point)lines.elementAt(np-1);
                  if(st==0) g.drawLine(p1.x,p1.y,p2.x,p2.y);
                  else g.drawLine(p1.x,p1.y,x2,y2);
              }
              break;
           }
           case SEG:
           case VEC:
           case SLINE:
           case LINE:
           case RECT: {
              if(st>0) {
                  int xx1,yy1,xx2,yy2;
                  int X1,Y1,X2,Y2,max;
                  xx1=Math.min(x1,x2); yy1=Math.min(y1,y2);
                  xx2=Math.max(x1,x2); yy2=Math.max(y1,y2);
                  max=Math.max(Math.abs(x2-x1),Math.abs(y2-y1));
                  if(max<10) max=10;
                  max=500/max+1;
                  switch(ctype) {
                     case RECT: g.drawRect(xx1,yy1,xx2-xx1,yy2-yy1); break;
                     case SLINE: {
                         g.fillOval(x1-2,y1-2,4,4);
                         g.drawLine(x1,y1,max*x2-(max-1)*x1,max*y2-(max-1)*y1); break;
                     }
                     case LINE: {
                         g.fillOval(x1-2,y1-2,4,4);
                         g.fillOval(x2-2,y2-2,4,4);
                         g.drawLine(max*x1-(max-1)*x2,max*y1-(max-1)*y2,
                                   max*x2-(max-1)*x1,max*y2-(max-1)*y1); break;
                     }
                     case SEG: g.drawLine(x1,y1,x2,y2); break;
                     case VEC: {
                         g.drawLine(x1,y1,x2,y2);
                         if(radius > 5) { /* arrow head */
                            double dx,dy,dd[];
                            int xx[], yy[];
                            dd=new double[6];
                            xx=new int[3];
                            yy=new int[3];
                            double l=12;
                            double fat=0.3;
                            xx[0]=x2;yy[0]=y2;
                            dx=x1-x2; dy=y1-y2;
                            dd[0]=l*dx/radius; dd[1]=l*dy/radius;
                            dd[2]=dd[0]+dd[1]*fat; dd[3]=dd[1]-dd[0]*fat;
                            dd[4]=dd[0]-dd[1]*fat; dd[5]=dd[1]+dd[0]*fat;
                            xx[1]=(int) dd[2]+xx[0];
                            yy[1]=(int) dd[3]+yy[0];
                            xx[2]=(int) dd[4]+xx[0];
                            yy[2]=(int) dd[5]+yy[0];
                            g.fillPolygon(xx,yy,3);
                         }
                         break;
                     }
                  }
              }
              break;
           }
           case CIRCLE: {
              if(st>0) {
                  pointPaint(g,new Point(x1,y1));
                  g.drawOval(x1-radius,y1-radius,radius*2,radius*2);
              }
              break;
           }
       }
    }

Here is the call graph for this function:

void inp_panel.pointPaint ( Graphics  g,
Point  p 
) [inline, package]

Definition at line 363 of file noninput.java.

                                         {
       g.drawLine(p.x-ll,p.y+ll,p.x+ll,p.y-ll);
       g.drawLine(p.x+ll,p.y+ll,p.x-ll,p.y-ll);
    }
void inp_panel.pointPaint ( Graphics  g,
Point  p 
) [inline, package]

Definition at line 400 of file input.java.

                                         {
       g.drawLine(p.x-ll,p.y+ll,p.x+ll,p.y-ll);
       g.drawLine(p.x+ll,p.y+ll,p.x-ll,p.y-ll);
    }

Here is the caller graph for this function:

String inp_panel.points2string ( String  rep) [inline]

Definition at line 147 of file input.java.

                                            {
       StringBuffer buf=new StringBuffer(16384);
       buf.append(rep);
       switch(ctype) {
           case POLY:
           case POINTS:
           case LINES:
           case CURVE: {
              int i, np;
              Point p=null;
              np=lines.size();
              for(i=0;i<np;i++) {
                  p=(Point)lines.elementAt(i);
                  buf.append(p.x).append(",").append(p.y).append(";");
              }
              break;
           }
           case SLINE:
           case LINE:
           case SEG:
           case VEC:
           case RECT: {
              if(st>0) {
                  buf.append(x1).append(",").append(y1).append(",").append(x2).append(",").append(y2);
              }
              break;
           }
           case CIRCLE: {
              if(st>0) {
                  buf.append(x1).append(",").append(y1).append(",").append(radius);
              }
              break;
           }
       }
       return buf.toString();
    }

Here is the caller graph for this function:

void inp_panel.retry ( ) [inline]

Definition at line 173 of file noninput.java.

                        {
       lines.removeAllElements();
       st=0; repaint();
    }
void inp_panel.retry ( ) [inline]

Definition at line 184 of file input.java.

                        {
       lines.removeAllElements();
       st=0; repaint();
    }

Here is the caller graph for this function:


Member Data Documentation

Image inp_panel.bg [package]

Definition at line 130 of file input.java.

static final int inp_panel.CIRCLE = 2 [static, package]

Definition at line 126 of file input.java.

static int inp_panel.ctype [static]

Definition at line 128 of file input.java.

static final int inp_panel.CURVE = 0 [static]

Definition at line 126 of file input.java.

int inp_panel.drag [package]

Definition at line 135 of file input.java.

static final int inp_panel.LINE = 4 [static, package]

Definition at line 126 of file input.java.

static final int inp_panel.LINES = 3 [static, package]

Definition at line 126 of file input.java.

Vector inp_panel.lines = new Vector(16384) [package]

Definition at line 131 of file input.java.

static int inp_panel.ll = 4 [static, package]

Definition at line 129 of file input.java.

static final int inp_panel.POINTS = 8 [static, package]

Definition at line 127 of file input.java.

static final int inp_panel.POLY = 7 [static, package]

Definition at line 127 of file input.java.

int inp_panel.radius [package]

Definition at line 134 of file input.java.

static final int inp_panel.RECT = 1 [static, package]

Definition at line 126 of file input.java.

static final int inp_panel.SEG = 6 [static, package]

Definition at line 127 of file input.java.

static final int inp_panel.SLINE = 5 [static, package]

Definition at line 127 of file input.java.

int inp_panel.st [package]

Definition at line 136 of file input.java.

final int inp_panel.VEC = 9 [static, package]

Definition at line 127 of file input.java.

int inp_panel.x1 [package]

Definition at line 132 of file input.java.

int inp_panel.x2 [package]

Definition at line 133 of file input.java.

int inp_panel.y1 [package]

Definition at line 132 of file input.java.

int inp_panel.y2 [package]

Definition at line 133 of file input.java.


The documentation for this class was generated from the following files: